命名审查与垃圾代码清理(纯重命名 / 死代码删除,无行为变更)

前提:加载完成后全部采样都已驻留内存,程序此后与源文件再无联系。
据此修正了一批会让人误以为"仍在读写文件"的命名:

- SampleFileAt → SampleSignalAt(取的是内存信号在给定时刻的采样值)。
- DataSet::AddPreparedFile → AddDataFile。
- PlotView::InvalidatePolylineCache → InvalidateDerivedCaches
  (它同时清空折线、边沿统计、中心平均值曲线、静态场景缓存与悬停引用)。
- PlotView::CursorColor(int which) → CursorColor()(两条光标同色,参数从未使用)。
- UiEllipsize(g,…) → UiEllipsize(…):纯测量不绘制,删掉被忽略的绘图上下文参数;
  同时删除与 UiMeasureTextWidth 完全重复的 UiTextWidth,调用点统一到 UiMeasureTextWidth。

清理残留参数((void)xxx;):
- TabConfig 的可见性/网格族(SetVisible / ToggleVisible / SetFileVisible / SetAllVisible /
  SoloSignal / SetMode / SyncLanes / FileHasVisible / FileAllVisible)去掉从未使用的
  const DataSet& 参数(仅 SyncToDataSet 真正需要数据层,保留)。
- PlotView::OnLButtonUp(int y)、OnMouseWheel(int delta, bool shift);PainterSignalHalo 去掉未用的 ref。
- BuildDataFile 中未使用的局部 rowCount。

删除无人调用的死函数:
  DataSet::Clear / AddFromTable;SignalColorCount;WideToUtf8 / StartsWith;
  PlotView::ViewMinTime / ViewMaxTime / EdgePanelRect / EdgePanelCloseRect /
  EdgeCenterPanelRect / ScaleLaneRange / BeginLaneValueEdit / LaneContentHeight;
  SignalPanel::NeedsScrollBar / IsFilterEditing / FilterText / ContentHeight;
  PopupMenu::EditingItemId;TabBar::IsDragging;TextEdit::PlaceCaret。

删除只写不读的死字段:CsvTable::sourceRowCount(与 rowCount 等义)与 skippedRowCount。

以 VERY_BIG_DATA.CSV 回归验证:加载与勾选、筛选框(含"无匹配的筛选信号")、
样式区线宽文案省略、选区放大(横向与纵向)、双光标读数与 Δt、右键菜单(Y 轴数值与
实验性功能子菜单)、合并/拆分网格、标签与信号重命名省略号,行为均与改动前一致;
make clean && make all 无任何警告。
This commit is contained in:
DeepSeek V4.1 Flash committed 2026-10-09 21:52:46 +08:00
1 parent f5028b1e18
commit 350538c634
21 files changed
+118 -456

No files matched your search

+12 -12
View File
@@ -547,8 +547,8 @@ namespace jdi
m_dataSet.ValidateSelection();
m_panel.InvalidateRows();
// 文件/信号结构变化会让信号引用与文件地址改变,折线顶点缓存必须作废。
m_plot.InvalidatePolylineCache();
// 文件/信号结构变化会让信号引用与文件地址改变,派生缓存必须整体作废。
m_plot.InvalidateDerivedCaches();
// 强制下一次同步重新计算视图状态。
m_cachedVisibleCount = -1;
@@ -892,7 +892,7 @@ namespace jdi
int fileIndex = -1;
// 此处只做一次指针/缓冲移动,不拷贝任何采样数据,因此不会造成可见卡顿。
if (!m_dataSet.AddPreparedFile(std::move(file), fileIndex))
if (!m_dataSet.AddDataFile(std::move(file), fileIndex))
{
SetStatusMessage(L"解析失败:数据为空。", true);
InvalidateRect(m_hwnd, nullptr, FALSE);
@@ -1033,7 +1033,7 @@ namespace jdi
// 超长文件名用省略号截断,避免撑破卡片。
const std::wstring nameText =
UiEllipsize(g, m_loadingText, m_fonts.uiSmall, textWidth);
UiEllipsize(m_loadingText, m_fonts.uiSmall, textWidth);
UiText(g, nameText, m_fonts.uiSmall,
gd::RectF(textLeft, card.Y + 42.0f * m_scale, textWidth, 20.0f * m_scale),
m_theme.textMuted, TextAlign::LEFT);
@@ -1125,21 +1125,21 @@ namespace jdi
case ToolbarAction::MERGE_LANES:
if (!m_dataSet.Empty())
{
ActiveTab().SetMode(m_dataSet, LaneMode::MERGED);
ActiveTab().SetMode(LaneMode::MERGED);
SetStatusMessage(L"已将当前标签页的全部可见信号合并到同一网格。", false);
}
break;
case ToolbarAction::SPLIT_LANES:
if (!m_dataSet.Empty())
{
ActiveTab().SetMode(m_dataSet, LaneMode::PER_SIGNAL);
ActiveTab().SetMode(LaneMode::PER_SIGNAL);
SetStatusMessage(L"当前标签页已切换为「每信号一格」。", false);
}
break;
case ToolbarAction::CLEAR_ALL:
if (!m_dataSet.Empty())
{
ActiveTab().SetAllVisible(m_dataSet, false);
ActiveTab().SetAllVisible(false);
m_panel.InvalidateRows();
SetStatusMessage(L"已清空当前标签页的全部网格。", false);
}
@@ -1436,7 +1436,7 @@ namespace jdi
SignalRef derivedRef;
derivedRef.fileIndex = fileIndex;
derivedRef.signalIndex = newIndex;
ActiveTab().SetVisible(m_dataSet, derivedRef, true);
ActiveTab().SetVisible(derivedRef, true);
SignalRef sourceRef;
sourceRef.fileIndex = fileIndex;
@@ -1812,7 +1812,7 @@ namespace jdi
m_activeTarget = Target::NONE;
m_draggingSplitter = false;
m_panel.OnLButtonUp(0, 0);
m_plot.OnLButtonUp(0, 0);
m_plot.OnLButtonUp(0);
}
switch (message)
@@ -1937,7 +1937,7 @@ namespace jdi
// 拾色器接管输入后,取消底层组件可能仍在进行的拖拽。
m_panel.OnLButtonUp(0, 0);
m_plot.OnLButtonUp(0, 0);
m_plot.OnLButtonUp(0);
m_activeTarget = Target::NONE;
m_draggingSplitter = false;
@@ -2295,7 +2295,7 @@ namespace jdi
m_panel.OnLButtonUp(x, y);
break;
case Target::PLOT:
m_plot.OnLButtonUp(x, y);
m_plot.OnLButtonUp(y);
break;
case Target::NONE:
default:
@@ -2469,7 +2469,7 @@ namespace jdi
}
else if (m_plot.HitTest(point.x, point.y))
{
changed = m_plot.OnMouseWheel(point.x, point.y, delta, shift);
changed = m_plot.OnMouseWheel(delta, shift);
}
if (changed)
{