refactor(panels): 平行数组合并为 std::vector<PanelRow>(消除错位与字段重载)

对应 Code_Review_Report §15.6 第 1 项(方案 B:有结构,无列视图)。

结构
- EdgePanelLayout 的 16 个平行 std::vector 合并为 std::vector<PanelRow> rows,
  PanelRow 带 17 个具名成员:ref / header / nameRect / nameClose / triangle / check /
  stats / levelTrack / levelValue / levelReset / iterTrack / iterValue / iterReset /
  infoMaxInterval / infoMinInterval / intervalField / frequencyField。
- 唯一新增入口:AppendRow(ref, header, nameRect, triangle, check)(返回新行引用)与
  AppendMarkerGroupRow(ref, nameRect, nameClose)(「自由标记」分组行)。
  参数行/重采样行一律 layout.rows.back().xxx = … 赋值。
- 原 int rows(可见信号数)与新容器同名 ⇒ 改名 signalCount,并注明它与 rows.size()
  在 MARK 面板里不相等(只有有固定点的信号才有行)。

消掉的两类问题
1. 某分支漏 push 一列 ⇒ 该列之后所有行读到别人的矩形(静默错位)。现在一行一次成型。
2. rowRefs 字段重载(列表式 = 行信号 / MARK = 分组信号,其余 12 列必须为空)。
   现在每行自带 ref,语义由“填哪些字段”表达;不变式简化为语义断言
   (每行必须有名称区;MARK 行不得带 header/check/stats/滑块/重采样字段)。

顺带清理
- 合并后 rowIndex < layout.rowXxx.size() 全部变成恒真,批量删除 50+ 处
  (含 15 元组长度数组、? x : gd::RectF() 三元判空、if(...){extendRow(...)} 包裹)。
- 调试框与缓存键改为逐行遍历(新增字段只需在 PanelRow 与这两处循环各加一行)。

等价性证明(rowgeom 键名刻意保持不变,故可逐键比对)
  old keys = 919, new keys = 965
  仅存在于旧 = 0;已有键值变化 = 20(全部是 ".count":0 -> N)
  仅存在于新 = 46(全部是新增列的 [NNN],值 0.00,0.00,0.00,0.00)
⇒ 逐行逐字段的真实几何零位移;7 个面板像素哈希(含 resample=2BFC74B3D9B3239C)逐项不变。

验证
- make release:零 warning;784,896 → 782,336 B(−2,560);make debug / make -C Tools 同样零 warning
- UnitTests:checks=260 failed=0 cases=19
- OffscreenChecks -all:7 检查 / 133 断言(上轮 127)全 PASS
- panels -mode compare:7 面板像素哈希逐项不变
- rowgeom -mode compare:965+7 键 0 差异;-data MF4-Record.MF4 时 1268+7 键 0 差异
- 读点:旧 243 处 layout.rowXxx[…] → 现 95 处 layout.rows[…](84 命中判定 / 11 绘制)

过程记录:清理恒真判空时曾用整段替换把「均值滤波」双滑块段误换成「弱峰」双滑块,
编译器报 brace 不平衡,用备份回滚后重做 —— 整段替换必须先精确读出上下文。

文档:Plan §十一、Progress 第 39 轮、Report §16、agent_mem 第 39 轮、Tools/README §4.1/§4.4
This commit is contained in:
DeepSeek V4.1 Flash committed 2026-11-04 16:18:56 +08:00
1 parent f07ac74988
commit 1463f9d3f8
11 files changed
+672 -591

No files matched your search

+102 -135
View File
@@ -1127,36 +1127,36 @@ namespace jdi
Tab().Lanes()[static_cast<std::size_t>(panelLane)];
if (listCursor)
{
for (std::size_t rowIndex = 0; rowIndex < layout.rowHeaders.size(); ++rowIndex)
for (std::size_t rowIndex = 0; rowIndex < layout.rows.size(); ++rowIndex)
{
if (layout.rowHeaders[rowIndex].Width > 0.0f &&
UiPointInRect(layout.rowHeaders[rowIndex], static_cast<float>(x),
if (layout.rows[rowIndex].header.Width > 0.0f &&
UiPointInRect(layout.rows[rowIndex].header, static_cast<float>(x),
static_cast<float>(y)))
{
bool checked = false;
if (cursorKind == EdgePanelKind::PEAK)
{
checked = cursorLane.FindWeakPeakItem(
layout.rowRefs[rowIndex]) != nullptr;
layout.rows[rowIndex].ref) != nullptr;
}
else if (cursorKind == EdgePanelKind::CENTER)
{
checked = cursorLane.FindEdgeCenterItem(
layout.rowRefs[rowIndex]) != nullptr;
layout.rows[rowIndex].ref) != nullptr;
}
else if (cursorKind == EdgePanelKind::RESAMPLE)
{
checked = cursorLane.FindResampleItem(
layout.rowRefs[rowIndex]) != nullptr;
layout.rows[rowIndex].ref) != nullptr;
}
else if (cursorKind == EdgePanelKind::CLIP)
{
checked = cursorLane.ClipEnabled(layout.rowRefs[rowIndex]);
checked = cursorLane.ClipEnabled(layout.rows[rowIndex].ref);
}
else
{
checked = cursorLane.FindMeanFilterItem(
layout.rowRefs[rowIndex]) != nullptr;
layout.rows[rowIndex].ref) != nullptr;
}
// ⚠️⚠️ **「选区截取」的条目栏不可展开**(只有右侧复选框有效):
// 因此条目栏本体**绝不能**给手型 —— 否则会误导用户去点它
@@ -1174,14 +1174,12 @@ namespace jdi
if (cursorKind == EdgePanelKind::RESAMPLE)
{
// 两行输入框是可点击控件(点击进入就地编辑)。
if (rowIndex < layout.rowIntervalField.size() &&
UiPointInRect(layout.rowIntervalField[rowIndex], static_cast<float>(x),
if (UiPointInRect(layout.rows[rowIndex].intervalField, static_cast<float>(x),
static_cast<float>(y)))
{
return LoadCursorW(nullptr, IDC_HAND);
}
if (rowIndex < layout.rowFrequencyField.size() &&
UiPointInRect(layout.rowFrequencyField[rowIndex], static_cast<float>(x),
if (UiPointInRect(layout.rows[rowIndex].frequencyField, static_cast<float>(x),
static_cast<float>(y)))
{
return LoadCursorW(nullptr, IDC_HAND);
@@ -1189,50 +1187,43 @@ namespace jdi
continue;
}
const bool hasParams =
rowIndex < layout.rowLevelTracks.size() &&
layout.rowLevelTracks[rowIndex].Width > 0.0f;
layout.rows[rowIndex].levelTrack.Width > 0.0f;
if (!hasParams)
{
continue; // 参数行未展开(未勾选 / 已收起)⇒ 该行没有可交互控件
}
// 「均值点数 / 调整幅度」数值:均值滤波与中心轴可点击改上限(弱峰不能)。
if (cursorKind != EdgePanelKind::PEAK &&
rowIndex < layout.rowLevelValues.size() &&
layout.rowLevelValues[rowIndex].Width > 0.0f &&
UiPointInRect(layout.rowLevelValues[rowIndex], static_cast<float>(x),
layout.rows[rowIndex].levelValue.Width > 0.0f &&
UiPointInRect(layout.rows[rowIndex].levelValue, static_cast<float>(x),
static_cast<float>(y)))
{
return LoadCursorW(nullptr, IDC_HAND);
}
if (rowIndex < layout.rowIterValues.size() &&
layout.rowIterValues[rowIndex].Width > 0.0f &&
UiPointInRect(layout.rowIterValues[rowIndex], static_cast<float>(x),
if (layout.rows[rowIndex].iterValue.Width > 0.0f &&
UiPointInRect(layout.rows[rowIndex].iterValue, static_cast<float>(x),
static_cast<float>(y)))
{
return LoadCursorW(nullptr, IDC_HAND);
}
if (rowIndex < layout.rowLevelResets.size() &&
layout.rowLevelResets[rowIndex].Width > 0.0f &&
UiPointInRect(layout.rowLevelResets[rowIndex], static_cast<float>(x),
if (layout.rows[rowIndex].levelReset.Width > 0.0f &&
UiPointInRect(layout.rows[rowIndex].levelReset, static_cast<float>(x),
static_cast<float>(y)))
{
return LoadCursorW(nullptr, IDC_HAND);
}
if (rowIndex < layout.rowIterResets.size() &&
layout.rowIterResets[rowIndex].Width > 0.0f &&
UiPointInRect(layout.rowIterResets[rowIndex], static_cast<float>(x),
if (layout.rows[rowIndex].iterReset.Width > 0.0f &&
UiPointInRect(layout.rows[rowIndex].iterReset, static_cast<float>(x),
static_cast<float>(y)))
{
return LoadCursorW(nullptr, IDC_HAND);
}
if (rowIndex < layout.rowLevelTracks.size() &&
WeakPeakSliderHit(layout.rowLevelTracks[rowIndex], m_scale,
if (WeakPeakSliderHit(layout.rows[rowIndex].levelTrack, m_scale,
static_cast<float>(x), static_cast<float>(y)))
{
return LoadCursorW(nullptr, IDC_SIZEWE);
}
if (rowIndex < layout.rowIterTracks.size() &&
WeakPeakSliderHit(layout.rowIterTracks[rowIndex], m_scale,
if (WeakPeakSliderHit(layout.rows[rowIndex].iterTrack, m_scale,
static_cast<float>(x), static_cast<float>(y)))
{
return LoadCursorW(nullptr, IDC_SIZEWE);
@@ -1542,13 +1533,13 @@ namespace jdi
}
Lane::WeakPeakItem& item = lane.EnsureWeakPeakItem(m_peakDragRef);
const int rowIndex = PeakRowIndexOf(layout, m_peakDragRef);
if (rowIndex < 0 || rowIndex >= static_cast<int>(layout.rowLevelTracks.size()) ||
layout.rowLevelTracks[static_cast<std::size_t>(rowIndex)].Width <= 0.0f)
if (rowIndex < 0 || rowIndex >= static_cast<int>(layout.rows.size()) ||
layout.rows[static_cast<std::size_t>(rowIndex)].levelTrack.Width <= 0.0f)
{
break;
}
const double ratio =
UiSliderRatioFromX(layout.rowLevelTracks[static_cast<std::size_t>(rowIndex)], fx);
UiSliderRatioFromX(layout.rows[static_cast<std::size_t>(rowIndex)].levelTrack, fx);
// 滑块量程 -200% – +200%:0 在正中间。
// 滑块量程 -400% – +400%(三组规则的梯度区间):0 在正中间。
item.amountPercent = std::max(
@@ -1575,13 +1566,13 @@ namespace jdi
}
Lane::WeakPeakItem& item = lane.EnsureWeakPeakItem(m_peakDragRef);
const int rowIndex = PeakRowIndexOf(layout, m_peakDragRef);
if (rowIndex < 0 || rowIndex >= static_cast<int>(layout.rowIterTracks.size()) ||
layout.rowIterTracks[static_cast<std::size_t>(rowIndex)].Width <= 0.0f)
if (rowIndex < 0 || rowIndex >= static_cast<int>(layout.rows.size()) ||
layout.rows[static_cast<std::size_t>(rowIndex)].iterTrack.Width <= 0.0f)
{
break;
}
const double ratio =
UiSliderRatioFromX(layout.rowIterTracks[static_cast<std::size_t>(rowIndex)], fx);
UiSliderRatioFromX(layout.rows[static_cast<std::size_t>(rowIndex)].iterTrack, fx);
const int peakMax = std::max(kWeakPeakIterationsMin,
std::min(kWeakPeakIterationsMaxLimit, item.maxIterations));
item.iterations = std::max(
@@ -1629,9 +1620,9 @@ namespace jdi
const EdgePanelLayout layout = EdgePanelLayoutFor(
m_meanDragLane, m_meanDragKind);
int rowIndex = -1;
for (std::size_t candidate = 0; candidate < layout.rowRefs.size(); ++candidate)
for (std::size_t candidate = 0; candidate < layout.rows.size(); ++candidate)
{
if (layout.rowRefs[candidate] == m_meanDragRef)
if (layout.rows[candidate].ref == m_meanDragRef)
{
rowIndex = static_cast<int>(candidate);
break;
@@ -1641,15 +1632,15 @@ namespace jdi
{
break;
}
const std::vector<gd::RectF>& tracks =
pointsMode ? layout.rowLevelTracks : layout.rowIterTracks;
if (static_cast<std::size_t>(rowIndex) >= tracks.size() ||
tracks[static_cast<std::size_t>(rowIndex)].Width <= 0.0f)
// 两行滑块的轨道由 `pointsMode` 决定:这里取**引用**而不是"整个数组",
// 因为行字段现在同属一个 `PanelRow`(不再有可切换的平行数组)。
const gd::RectF& track = pointsMode ? layout.rows[static_cast<std::size_t>(rowIndex)].levelTrack
: layout.rows[static_cast<std::size_t>(rowIndex)].iterTrack;
if (track.Width <= 0.0f)
{
break;
}
const double ratio =
UiSliderRatioFromX(tracks[static_cast<std::size_t>(rowIndex)], fx);
const double ratio = UiSliderRatioFromX(track, fx);
if (pointsMode)
{
// ⚠️ 下限:均值滤波 = 1(用户 2026-10-30 要求不能为 0);中心轴 = 0(0 = 不平滑)。
@@ -2006,20 +1997,16 @@ namespace jdi
const EdgePanelLayout layout = EdgePanelLayoutFor(panelLane, hoverKind);
if (UiPointInRect(layout.content, static_cast<float>(x), static_cast<float>(y)))
{
for (std::size_t rowIndex = 0; rowIndex < layout.rowRefs.size(); ++rowIndex)
for (std::size_t rowIndex = 0; rowIndex < layout.rows.size(); ++rowIndex)
{
if (rowIndex >= layout.rowHeaders.size())
{
break;
}
const gd::RectF& headerRect = layout.rowHeaders[rowIndex];
const gd::RectF& headerRect = layout.rows[rowIndex].header;
// 半截滚出的行**也算命中**:绘制时行本来就会被裁剪成半截显示,
// 若这里要求“完整落在内容区内”,就会出现“看得见却悬停不到”的不一致。
// 命中点本身已被限定在内容区里,因此不会出现“看得见一半却点到”的幽灵热区。
if (UiPointInRect(headerRect, static_cast<float>(x), static_cast<float>(y)))
{
hoverLane = panelLane;
hoverRef = layout.rowRefs[rowIndex];
hoverRef = layout.rows[rowIndex].ref;
break;
}
}
@@ -2042,17 +2029,17 @@ namespace jdi
static_cast<EdgePanelKind>(hoverPanelKind) == EdgePanelKind::PEAK)
{
const EdgePanelLayout resetLayout = EdgePanelLayoutFor(panelLane, EdgePanelKind::PEAK);
for (std::size_t rowIndex = 0; rowIndex < resetLayout.rowLevelResets.size(); ++rowIndex)
for (std::size_t rowIndex = 0; rowIndex < resetLayout.rows.size(); ++rowIndex)
{
const gd::RectF& level = resetLayout.rowLevelResets[rowIndex];
const gd::RectF& level = resetLayout.rows[rowIndex].levelReset;
if (level.Width > 0.0f && UiPointInRect(level, fx, static_cast<float>(y)))
{
overPeakReset = true;
break;
}
if (rowIndex < resetLayout.rowIterResets.size())
if (rowIndex < resetLayout.rows.size())
{
const gd::RectF& iter = resetLayout.rowIterResets[rowIndex];
const gd::RectF& iter = resetLayout.rows[rowIndex].iterReset;
if (iter.Width > 0.0f && UiPointInRect(iter, fx, static_cast<float>(y)))
{
overPeakReset = true;
@@ -2456,39 +2443,37 @@ namespace jdi
// 条目栏 = 复选框切换 + 已勾选时整行收起/展开(与其它列表式面板一致)。
if (resampleMode)
{
for (std::size_t rowIndex = 0; rowIndex < layout.rowRefs.size(); ++rowIndex)
for (std::size_t rowIndex = 0; rowIndex < layout.rows.size(); ++rowIndex)
{
if (!insideContent)
{
break;
}
const SignalRef& ref = layout.rowRefs[rowIndex];
const SignalRef& ref = layout.rows[rowIndex].ref;
const Lane::ResampleItem* item = meanLane.FindResampleItem(ref);
if (item == nullptr)
{
continue;
}
// 点击「重采样间隔」输入框 → 编辑**秒**数(不带单位、不用科学计数法)。
if (rowIndex < layout.rowIntervalField.size() &&
layout.rowIntervalField[rowIndex].Width > 0.0f &&
UiPointInRect(layout.rowIntervalField[rowIndex], fx, fy))
if (layout.rows[rowIndex].intervalField.Width > 0.0f &&
UiPointInRect(layout.rows[rowIndex].intervalField, fx, fy))
{
m_editMeanRef = ref;
m_editMeanKind = kind;
const gd::RectF& field = layout.rowIntervalField[rowIndex];
const gd::RectF& field = layout.rows[rowIndex].intervalField;
BeginEdit(PlotEditTarget::RESAMPLE_INTERVAL, index,
FormatDurationSeconds(item->interval), field);
m_dragMode = PlotDragMode::NONE;
return true;
}
// 点击「重采样频率」输入框 → 编辑频率(Hz,与间隔联动;不带单位)。
if (rowIndex < layout.rowFrequencyField.size() &&
layout.rowFrequencyField[rowIndex].Width > 0.0f &&
UiPointInRect(layout.rowFrequencyField[rowIndex], fx, fy))
if (layout.rows[rowIndex].frequencyField.Width > 0.0f &&
UiPointInRect(layout.rows[rowIndex].frequencyField, fx, fy))
{
m_editMeanRef = ref;
m_editMeanKind = kind;
const gd::RectF& field = layout.rowFrequencyField[rowIndex];
const gd::RectF& field = layout.rows[rowIndex].frequencyField;
const double hz = (item->interval > 0.0) ? (1.0 / item->interval) : 0.0;
BeginEdit(PlotEditTarget::RESAMPLE_FREQUENCY, index,
FormatDecimal(hz, 12), field);
@@ -2497,19 +2482,17 @@ namespace jdi
}
}
// 条目栏(信号色叠底):复选框切换;已勾选时整行切换参数行收起/展开。
for (std::size_t rowIndex = 0; rowIndex < layout.rowRefs.size(); ++rowIndex)
for (std::size_t rowIndex = 0; rowIndex < layout.rows.size(); ++rowIndex)
{
const SignalRef& ref = layout.rowRefs[rowIndex];
if (!insideContent || rowIndex >= layout.rowHeaders.size() ||
layout.rowHeaders[rowIndex].Width <= 0.0f ||
!UiPointInRect(layout.rowHeaders[rowIndex], fx, fy))
const SignalRef& ref = layout.rows[rowIndex].ref;
if (!insideContent || layout.rows[rowIndex].header.Width <= 0.0f ||
!UiPointInRect(layout.rows[rowIndex].header, fx, fy))
{
continue;
}
const bool onCheckBox =
rowIndex < layout.rowChecks.size() &&
layout.rowChecks[rowIndex].Width > 0.0f &&
UiPointInRect(layout.rowChecks[rowIndex], fx, fy);
layout.rows[rowIndex].check.Width > 0.0f &&
UiPointInRect(layout.rows[rowIndex].check, fx, fy);
const Lane::ResampleItem* existing = meanLane.FindResampleItem(ref);
if (onCheckBox)
{
@@ -2577,15 +2560,14 @@ namespace jdi
const bool doubleCursor = (Tab().CursorMode() == PlotCursorMode::DOUBLE);
Lane& clipLane = m_tab->Lanes()[static_cast<std::size_t>(index)];
// 条目复选框:切换该信号是否为截取目标。
for (std::size_t rowIndex = 0; rowIndex < layout.rowRefs.size(); ++rowIndex)
for (std::size_t rowIndex = 0; rowIndex < layout.rows.size(); ++rowIndex)
{
if (!insideContent || rowIndex >= layout.rowChecks.size() ||
layout.rowChecks[rowIndex].Width <= 0.0f ||
!UiPointInRect(layout.rowChecks[rowIndex], fx, fy))
if (!insideContent || layout.rows[rowIndex].check.Width <= 0.0f ||
!UiPointInRect(layout.rows[rowIndex].check, fx, fy))
{
continue;
}
ToggleLaneClipSignal(index, layout.rowRefs[rowIndex]);
ToggleLaneClipSignal(index, layout.rows[rowIndex].ref);
m_meanRowHoverLane = -1;
m_meanRowHoverRef = SignalRef();
m_dragMode = PlotDragMode::NONE;
@@ -2651,26 +2633,24 @@ namespace jdi
// 语义与该面板旧式排版完全一致,只是外观改成与均值滤波同款的可滚动列表。
if (boostMode)
{
for (std::size_t rowIndex = 0; rowIndex < layout.rowRefs.size(); ++rowIndex)
for (std::size_t rowIndex = 0; rowIndex < layout.rows.size(); ++rowIndex)
{
const SignalRef& ref = layout.rowRefs[rowIndex];
const SignalRef& ref = layout.rows[rowIndex].ref;
if (!insideContent)
{
break;
}
const Lane::WeakPeakItem* peakItem = meanLane.FindWeakPeakItem(ref);
const bool hasParams =
peakItem != nullptr && rowIndex < layout.rowLevelTracks.size() &&
layout.rowLevelTracks[rowIndex].Width > 0.0f;
peakItem != nullptr && layout.rows[rowIndex].levelTrack.Width > 0.0f;
if (!hasParams)
{
continue;
}
Lane::WeakPeakItem& item = meanLane.EnsureWeakPeakItem(ref);
// 复位:调整幅度 → 0%
if (rowIndex < layout.rowLevelResets.size() &&
layout.rowLevelResets[rowIndex].Width > 0.0f &&
UiPointInRect(layout.rowLevelResets[rowIndex], fx, fy))
if (layout.rows[rowIndex].levelReset.Width > 0.0f &&
UiPointInRect(layout.rows[rowIndex].levelReset, fx, fy))
{
item.amountPercent = 0;
m_weakPeakCurveCache.clear();
@@ -2678,9 +2658,8 @@ namespace jdi
return true;
}
// 复位:迭代次数 → 1(上限恢复为默认上限)。
if (rowIndex < layout.rowIterResets.size() &&
layout.rowIterResets[rowIndex].Width > 0.0f &&
UiPointInRect(layout.rowIterResets[rowIndex], fx, fy))
if (layout.rows[rowIndex].iterReset.Width > 0.0f &&
UiPointInRect(layout.rows[rowIndex].iterReset, fx, fy))
{
item.iterations = kWeakPeakIterationsMin;
item.maxIterations = kWeakPeakIterationsDefaultMax;
@@ -2690,14 +2669,13 @@ namespace jdi
}
// 迭代次数行的**数值文本**:点击后整行变成输入框以修改滑块上限。
// ⚠️ 必须放在轨道命中之前(数值区在轨道右侧,命中区不重叠,但顺序更安全)。
if (rowIndex < layout.rowIterValues.size() &&
layout.rowIterValues[rowIndex].Width > 0.0f &&
UiPointInRect(layout.rowIterValues[rowIndex], fx, fy))
if (layout.rows[rowIndex].iterValue.Width > 0.0f &&
UiPointInRect(layout.rows[rowIndex].iterValue, fx, fy))
{
m_editMeanRef = ref;
m_peakEditCurrentMax = item.maxIterations;
const gd::RectF& track = layout.rowIterTracks[rowIndex];
const gd::RectF& value = layout.rowIterValues[rowIndex];
const gd::RectF& track = layout.rows[rowIndex].iterTrack;
const gd::RectF& value = layout.rows[rowIndex].iterValue;
const gd::RectF rowRect(track.X, value.Y, value.X + value.Width - track.X,
value.Height);
BeginEdit(PlotEditTarget::PEAK_ITERATIONS_MAX, index, L"", rowRect);
@@ -2706,14 +2684,13 @@ namespace jdi
return true;
}
// 拖动「迭代次数」滑块。
if (rowIndex < layout.rowIterTracks.size() &&
WeakPeakSliderHit(layout.rowIterTracks[rowIndex], m_scale, fx, fy))
if (WeakPeakSliderHit(layout.rows[rowIndex].iterTrack, m_scale, fx, fy))
{
m_dragMode = PlotDragMode::PEAK_ITERATIONS;
m_peakDragLane = index;
m_peakDragRef = ref;
const double ratio =
UiSliderRatioFromX(layout.rowIterTracks[rowIndex], fx);
UiSliderRatioFromX(layout.rows[rowIndex].iterTrack, fx);
const int peakMax = std::max(
kWeakPeakIterationsMin,
std::min(kWeakPeakIterationsMaxLimit, item.maxIterations));
@@ -2727,14 +2704,13 @@ namespace jdi
return true;
}
// 拖动「调整幅度」滑块(0 在正中间 ⇒ ±400%)。
if (rowIndex < layout.rowLevelTracks.size() &&
WeakPeakSliderHit(layout.rowLevelTracks[rowIndex], m_scale, fx, fy))
if (WeakPeakSliderHit(layout.rows[rowIndex].levelTrack, m_scale, fx, fy))
{
m_dragMode = PlotDragMode::PEAK_LEVEL;
m_peakDragLane = index;
m_peakDragRef = ref;
item.amountPercent = static_cast<int>(std::lround(
(UiSliderRatioFromX(layout.rowLevelTracks[rowIndex], fx) * 2.0 - 1.0) *
(UiSliderRatioFromX(layout.rows[rowIndex].levelTrack, fx) * 2.0 - 1.0) *
100.0 * kWeakPeakSliderScale));
item.amountPercent = std::max(
kWeakPeakAmountMin,
@@ -2746,9 +2722,9 @@ namespace jdi
}
else
{
for (std::size_t rowIndex = 0; rowIndex < layout.rowRefs.size(); ++rowIndex)
for (std::size_t rowIndex = 0; rowIndex < layout.rows.size(); ++rowIndex)
{
const SignalRef& ref = layout.rowRefs[rowIndex];
const SignalRef& ref = layout.rows[rowIndex].ref;
if (!insideContent)
{
break;
@@ -2756,16 +2732,14 @@ namespace jdi
// 行可以“半截”显示(绘制时会按内容区裁剪),因此这里不再要求整行落在内容区;
// 命中点已由上面的 `insideContent` 限定在内容区内,不会抢走底部按钮的点击。
const bool hasParams =
rowIndex < layout.rowLevelTracks.size() &&
layout.rowLevelTracks[rowIndex].Width > 0.0f &&
layout.rows[rowIndex].levelTrack.Width > 0.0f &&
findItem(ref) != nullptr;
if (hasParams)
{
Lane::MeanFilterItem& item = ensureItem(ref);
// 复位:均值点数 → 默认值(同时把滑块上限恢复为默认上限)。
if (rowIndex < layout.rowLevelResets.size() &&
layout.rowLevelResets[rowIndex].Width > 0.0f &&
UiPointInRect(layout.rowLevelResets[rowIndex], fx, fy))
if (layout.rows[rowIndex].levelReset.Width > 0.0f &&
UiPointInRect(layout.rows[rowIndex].levelReset, fx, fy))
{
item.points = kMeanFilterPointsDefault;
item.maxPoints = kMeanFilterPointsDefaultMax;
@@ -2778,9 +2752,8 @@ namespace jdi
return true;
}
// 复位:迭代次数 → 1(上限恢复为默认上限)。
if (rowIndex < layout.rowIterResets.size() &&
layout.rowIterResets[rowIndex].Width > 0.0f &&
UiPointInRect(layout.rowIterResets[rowIndex], fx, fy))
if (layout.rows[rowIndex].iterReset.Width > 0.0f &&
UiPointInRect(layout.rows[rowIndex].iterReset, fx, fy))
{
item.iterations = kMeanFilterIterationsMin;
item.maxIterations = kMeanFilterIterationsDefaultMax;
@@ -2793,15 +2766,14 @@ namespace jdi
return true;
}
// 点击「均值点数」右侧数值 → 输入滑块上限。
if (rowIndex < layout.rowLevelValues.size() &&
layout.rowLevelValues[rowIndex].Width > 0.0f &&
UiPointInRect(layout.rowLevelValues[rowIndex], fx, fy))
if (layout.rows[rowIndex].levelValue.Width > 0.0f &&
UiPointInRect(layout.rows[rowIndex].levelValue, fx, fy))
{
m_editMeanRef = ref;
m_meanEditCurrentMax = item.maxPoints;
m_editMeanKind = kind;
const gd::RectF& track = layout.rowLevelTracks[rowIndex];
const gd::RectF& value = layout.rowLevelValues[rowIndex];
const gd::RectF& track = layout.rows[rowIndex].levelTrack;
const gd::RectF& value = layout.rows[rowIndex].levelValue;
const gd::RectF rowRect(track.X, value.Y,
value.X + value.Width - track.X,
value.Height);
@@ -2811,15 +2783,14 @@ namespace jdi
return true;
}
// 点击「迭代次数」右侧数值 → 输入滑块上限。
if (rowIndex < layout.rowIterValues.size() &&
layout.rowIterValues[rowIndex].Width > 0.0f &&
UiPointInRect(layout.rowIterValues[rowIndex], fx, fy))
if (layout.rows[rowIndex].iterValue.Width > 0.0f &&
UiPointInRect(layout.rows[rowIndex].iterValue, fx, fy))
{
m_editMeanRef = ref;
m_meanEditCurrentMax = item.maxIterations;
m_editMeanKind = kind;
const gd::RectF& track = layout.rowIterTracks[rowIndex];
const gd::RectF& value = layout.rowIterValues[rowIndex];
const gd::RectF& track = layout.rows[rowIndex].iterTrack;
const gd::RectF& value = layout.rows[rowIndex].iterValue;
const gd::RectF rowRect(track.X, value.Y,
value.X + value.Width - track.X,
value.Height);
@@ -2829,8 +2800,7 @@ namespace jdi
return true;
}
// 拖动「均值点数」滑块。
if (rowIndex < layout.rowLevelTracks.size() &&
WeakPeakSliderHit(layout.rowLevelTracks[rowIndex], m_scale, fx, fy))
if (WeakPeakSliderHit(layout.rows[rowIndex].levelTrack, m_scale, fx, fy))
{
const int floorValue = centerMode ? 0 : kMeanFilterPointsMin;
const int maximum =
@@ -2839,7 +2809,7 @@ namespace jdi
m_meanDragLane = index;
m_meanDragRef = ref;
m_meanDragKind = kind;
const double ratio = UiSliderRatioFromX(layout.rowLevelTracks[rowIndex], fx);
const double ratio = UiSliderRatioFromX(layout.rows[rowIndex].levelTrack, fx);
item.points = std::max(
floorValue,
std::min(maximum,
@@ -2852,8 +2822,7 @@ namespace jdi
return true;
}
// 拖动「迭代次数」滑块。
if (rowIndex < layout.rowIterTracks.size() &&
WeakPeakSliderHit(layout.rowIterTracks[rowIndex], m_scale, fx, fy))
if (WeakPeakSliderHit(layout.rows[rowIndex].iterTrack, m_scale, fx, fy))
{
const int maximum = std::max(
kMeanFilterIterationsMin,
@@ -2862,7 +2831,7 @@ namespace jdi
m_meanDragLane = index;
m_meanDragRef = ref;
m_meanDragKind = kind;
const double ratio = UiSliderRatioFromX(layout.rowIterTracks[rowIndex], fx);
const double ratio = UiSliderRatioFromX(layout.rows[rowIndex].iterTrack, fx);
item.iterations = std::max(
kMeanFilterIterationsMin,
std::min(maximum,
@@ -2886,23 +2855,21 @@ namespace jdi
// * **未启用 → 什么都不做**(用户 2026-10-30 明确要求:未勾选前点击条目栏
// 既不能自动勾选、也不能展开 / 收起,只能点复选框;此时鼠标指针也保持箭头)。
// 仍然消费这次点击(不穿透到底层的平移 / 选区等)。
for (std::size_t rowIndex = 0; rowIndex < layout.rowRefs.size(); ++rowIndex)
for (std::size_t rowIndex = 0; rowIndex < layout.rows.size(); ++rowIndex)
{
if (!insideContent)
{
break;
}
const SignalRef& ref = layout.rowRefs[rowIndex];
if (rowIndex >= layout.rowHeaders.size() ||
layout.rowHeaders[rowIndex].Width <= 0.0f ||
!UiPointInRect(layout.rowHeaders[rowIndex], fx, fy))
const SignalRef& ref = layout.rows[rowIndex].ref;
if (layout.rows[rowIndex].header.Width <= 0.0f ||
!UiPointInRect(layout.rows[rowIndex].header, fx, fy))
{
continue;
}
const bool onCheckBox =
rowIndex < layout.rowChecks.size() &&
layout.rowChecks[rowIndex].Width > 0.0f &&
UiPointInRect(layout.rowChecks[rowIndex], fx, fy);
layout.rows[rowIndex].check.Width > 0.0f &&
UiPointInRect(layout.rows[rowIndex].check, fx, fy);
bool checked = false;
bool collapsed = false;
if (boostMode)
@@ -4225,9 +4192,9 @@ namespace jdi
int PlotView::PeakRowIndexOf(const EdgePanelLayout& layout, const SignalRef& ref) const
{
for (std::size_t index = 0; index < layout.rowRefs.size(); ++index)
for (std::size_t index = 0; index < layout.rows.size(); ++index)
{
if (layout.rowRefs[index] == ref)
if (layout.rows[index].ref == ref)
{
return static_cast<int>(index);
}