预览曲线按面板高亮 + 统计数字不再卡在“统计中…” + 中心轴面板改表格 + 默认主题 Light + 标签页 DPI 修复 + 布局边界幽灵元素

一、预览曲线悬停高亮(只开弱峰+中心轴时无反应;三个全开时总亮均值曲线)
   根因:PaintLaneDerivedOverlays 里只有 MEAN 分支传 highlight,且悬停状态没有记录面板种类。
   修法:新增 m_meanRowHoverKind,高亮条件 = 悬停行 == 本行 && 面板种类 == 本曲线来源;
         条目栏强调色同样按种类门控;悬停种类进入面板缓存键。

二、统计数字松手后停在“统计中…”
   根因:交互期间面板缓存键被冻结(为拖动跟手),冻结期满后没有重绘请求(鼠标已停、
         统计也已完成),最后一次绘制仍是冻结帧。
   修法:记录 m_panelKeysFrozen 并公开 PanelRefreshPending();Render 末尾把它并入
         滚动动画定时器的武装条件 ⇒ 空闲后自动补一帧真实数字,随后停表。

三、「中心轴边沿计数」面板改为表格
   表头固定:信号名 / 上升沿计数 / 下降沿计数;每行底色 = 该信号配色(未勾选的行普通底色),
   三列与表头严格对齐,内容可滚动,单击行展开两行参数滑块。
   - EdgePanelLayout 新增 tableHeader / tableColumns[3];EdgePanelLayoutFor 新增 centerTable 分支;
   - 新增 EdgeCenterTableHeader() / EdgeCountCellText();EnsureEdgeCenterItem 默认 collapsed;
   - PanelSlotKey 的 CENTER 分支改为按 item 判断并混合计数(表格已没有 rowStats)。

四、默认主题改为 Light(Application、ThemeFor/ThemeName 默认分支、CurrentTheme 兜底)。

五、标签页文本在 DPI 切换后被省略
   根因:标签宽度恰好等于“内边距+文本+间距+关闭按钮”,无任何余量;TabItemWidget 缓存了
         Configure 时的 scale 并用它反推可用文本宽度,而 TabBar::SetScale 不重建控件树
         ⇒ 125%→100% 后可用宽度少约 4.5px ⇒ 吃掉末字。
   修法:SetScale 变化时重建控件树;并把文本可用矩形改由 ArrangeWidgets 统一下发
         (SetState 增加 textRect 参数),绘制侧不再自行反推。

六、布局边界里的幽灵元素
   - 新增 SignalPanel::HasStyleTarget();BuildBoxes 与 QueryCursor 在无样式目标时
     不再上报/响应色块、样式、调整、线宽、透明度等控件;
   - Paint 的“无网格”分支显式清空 m_legendHits / m_cursorLabelRects / m_cursorSpanRect /
     m_freeMarkerHits / m_panelSlots / m_panelOrder(关闭整个分组后不再残留边界框);
   - 浮动面板之上的滚动条 / 回到最上方 / 内联输入框改为按可见性上报几何。

验证(离屏探针,SW_HIDE + 合成消息,不占用鼠标键盘屏幕)
  .preflight/p21.exe 9/9   .preflight/p22.exe 14/14   .preflight/p23.exe 7/7
  .preflight/p20 系列(9/11/5)全部回归通过
  make release / make debug 零 warning;Release 813,568 B
This commit is contained in:
DeepSeek V4.1 Flash committed 2026-11-02 15:22:26 +08:00
1 parent 7a6fcd68e2
commit 8de8a8fb85
14 files changed
+934 -141

No files matched your search

+228 -37
View File
@@ -28,12 +28,12 @@ namespace jdi
const bool centerAxis = (kind == EdgePanelKind::CENTER);
const bool meanFilter = (kind == EdgePanelKind::MEAN);
const bool weakPeak = (kind == EdgePanelKind::PEAK);
// 「均值滤波」「中心轴边沿计数」「弱峰调整」自 2026-11-02 起全部是**可滚动的分组列表**
//(信号色叠底条目栏 + 右侧复选框 + 展开后的参数行)。
// 「均值滤波」「弱峰调整」= 可滚动的分组列表(信号色叠底条目栏 + 右侧复选框 +
// 展开后的两行滑块);**「中心轴边沿计数」= 表格**(信号名 / 上升沿计数 / 下降沿计数)。
// ⚠️ 旧式「逐条目」排版(名称 + 复选框 + 参数行,无滚动)已彻底删除:
// 上百个信号时它会算出上万像素高的面板,超出绘图区后**面板像素缓存一次都存不进去**
// ⇒ 每一帧整块重画 ⇒ 所有交互卡顿(用户 2026-11-02 报告)。
const bool listStyle = (meanFilter || centerAxis || weakPeak);
const bool listStyle = (meanFilter || weakPeak);
// 标题行 = “GX” 徽标 + 标题(“边沿计数” / “中心轴边沿计数” / “均值滤波” / “弱峰调整”
// + 光标区间尾缀)。
@@ -106,13 +106,31 @@ namespace jdi
const float pendingWidth = UiMeasureTextWidth(m_fonts->monoSmall, L"统计中…");
statRisingWidth = std::max(
statRisingWidth,
std::max(UiMeasureTextWidth(m_fonts->monoSmall, EdgeRisingText(rising, complete)),
std::max(UiMeasureTextWidth(m_fonts->monoSmall, EdgeCountCellText(rising, complete)),
pendingWidth));
statFallingWidth =
std::max(statFallingWidth,
UiMeasureTextWidth(m_fonts->monoSmall, EdgeFallingText(falling, complete)));
UiMeasureTextWidth(m_fonts->monoSmall, EdgeCountCellText(falling, complete)));
}
if (statRisingWidth > 0.0f || statFallingWidth > 0.0f)
if (centerAxis)
{
// 「中心轴边沿计数」= **表格**(信号名 / 上升沿计数 / 下降沿计数):
// 宽度 = 复选框 + 名称列 + 两列计数(列宽取「表头文字」「实际数字」的较大者)+ 滚动条。
const float headerRising =
UiMeasureTextWidth(m_fonts->uiSmall, EdgeCenterTableHeader(1));
const float headerFalling =
UiMeasureTextWidth(m_fonts->uiSmall, EdgeCenterTableHeader(2));
const float risingColumn = std::max(headerRising, statRisingWidth) + 10.0f * m_scale;
const float fallingColumn = std::max(headerFalling, statFallingWidth) + 10.0f * m_scale;
const float gap = kEdgePanelStatColumnGap * m_scale;
width = std::max(width, kEdgePanelPad * 2.0f * m_scale +
kEdgePanelDisclosureWidth * m_scale + 6.0f * m_scale +
kEdgePanelMeanCheckSize * m_scale + 6.0f * m_scale +
std::min(nameColumnWidth, kEdgePanelNameMaxWidth * m_scale) +
gap + risingColumn + gap + fallingColumn +
(kFreeMarkerScrollWidth + 4.0f) * m_scale);
}
else if (statRisingWidth > 0.0f || statFallingWidth > 0.0f)
{
// 两列**等宽**(取两列最大值中的较大者)→ 绘制时两列起点固定,
// 多条信号的“上升沿 / 下降沿”文字严格垂直对齐(用户明确要求)。
@@ -254,13 +272,10 @@ namespace jdi
const bool meanFilter = (kind == EdgePanelKind::MEAN);
const bool weakPeak = (kind == EdgePanelKind::PEAK);
const bool freeMarker = (kind == EdgePanelKind::MARK);
// 「均值滤波」与「弱峰调整」共用同一套「逐条目 + 底部按钮」排布。
// ⚠️ 「均值滤波」从 2026-10-30 起改为**可滚动的分组列表**(信号色叠底标题栏 +
// 展开后的两行滑块),与「自由标记」同一套浏览方式 ⇒ 不再走这里的 `itemized` 分支。
// ⚠️ 「中心轴边沿计数」从 2026-11-02 起同样改为**可滚动的分组列表**(用户明确要求
// “改造为与均值滤波相同的风格”)⇒ 也不走 `itemized`。它没有「构建为新信号」按钮,
// 但内容多一行「上升沿 / 下降沿」统计。
const bool listStyle = (meanFilter || centerAxis || weakPeak);
// 「均值滤波」与「弱峰调整」共用同一套**可滚动分组列表**排布(信号色叠底条目栏 +
// 展开后的两行滑块);「中心轴边沿计数」自 2026-11-02 起单独走**表格**分支(`centerTable`)。
const bool listStyle = (meanFilter || weakPeak);
const bool centerTable = centerAxis;
const bool hasButton = (meanFilter || weakPeak);
const bool enabled = meanFilter ? lane.meanFilter
: (weakPeak ? lane.weakPeak
@@ -318,12 +333,46 @@ namespace jdi
const float weakPeakSliderRow = kWeakPeakSliderRowHeight * m_scale;
float meanContentHeight = 0.0f;
float height = 0.0f;
if (listStyle)
float tableHeaderHeight = 0.0f;
if (centerTable)
{
// 「均值滤波 / 中心轴边沿计数 / 弱峰调整」:内容区 = 逐信号的**信号色叠底条目栏**
//(内容总是显示,用于勾选/取消)+(勾选且未收起时)参数行。
// 「中心轴」的参数行 = 一行「上升沿 / 下降沿」统计 + 两行滑块;
// 「均值滤波」与「弱峰调整」= 两行滑块。
// 「中心轴边沿计数」= **表格**:表头(信号名 / 上升沿计数 / 下降沿计数)固定不滚动,
// 下面每条**已勾选**的信号占一行(行底色 = 信号配色),单击行展开两行参数滑块。
// 默认只显示表格行(`EnsureEdgeCenterItem` 新建条目时 `collapsed = true`)。
const float rowH = kEdgePanelMeanRowHeight * m_scale;
float content = 0.0f;
for (const SignalRef& ref : lane.signals)
{
const ResolvedSignal resolved = ResolveSignal(ref);
if (resolved.data == nullptr || !resolved.visible)
{
continue;
}
const Lane::EdgeCenterItem* item = lane.FindEdgeCenterItem(ref);
if (item == nullptr && !resolved.visible)
{
continue;
}
content += rowH;
if (item != nullptr && !item->collapsed)
{
content += weakPeakSliderRow * 2.0f;
}
}
meanContentHeight = content;
tableHeaderHeight = rowH;
const float budget =
m_plotRect.Height - (titleHeight + pad + tableHeaderHeight + bottomPad);
const float maxContent =
std::max(3.0f * rowH, std::min(kFreeMarkerContentMaxHeight * m_scale,
std::max(3.0f * rowH, budget)));
const float view = std::min(content, maxContent);
height = titleHeight + pad + tableHeaderHeight + view + bottomPad;
}
else if (listStyle)
{
// 「均值滤波 / 弱峰调整」:内容区 = 逐信号的**信号色叠底条目栏**
//(内容总是显示,用于勾选/取消)+(勾选且未收起时)两行参数滑块。
// 内容超高时出现滚动条;底部「构建为新信号」按钮固定不滚动。
const float groupRow = kEdgePanelMeanRowHeight * m_scale;
const float sliderRow = weakPeakSliderRow;
@@ -344,17 +393,12 @@ namespace jdi
}
else
{
const Lane::MeanFilterItem* item = meanFilter ? lane.FindMeanFilterItem(ref)
: lane.FindEdgeCenterItem(ref);
const Lane::MeanFilterItem* item = lane.FindMeanFilterItem(ref);
expanded = (item != nullptr && !item->collapsed);
}
if (expanded)
{
content += sliderRow * 2.0f;
if (centerAxis)
{
content += groupRow; // 统计行(上升沿 / 下降沿)
}
}
}
meanContentHeight = content;
@@ -554,10 +598,164 @@ namespace jdi
{
return layout;
}
if (listStyle)
if (centerTable)
{
// 「均值滤波 / 中心轴边沿计数」:可滚动内容区
//(逐信号的信号色叠底条目栏 + 展开后的统计行与两行滑块)+(均值滤波)底部按钮。
// 「中心轴边沿计数」= **表格**:表头固定、内容区可滚动。
// 列:① 信号名(含复选框与展开三角)② 上升沿计数 ③ 下降沿计数。
const float rowH = kEdgePanelMeanRowHeight * m_scale;
const float sliderRow = kWeakPeakSliderRowHeight * m_scale;
const float scrollW = kFreeMarkerScrollWidth * m_scale;
const float viewHeight =
std::max(0.0f, height - titleHeight - pad - tableHeaderHeight - pad);
const bool scrollable = meanContentHeight > viewHeight + 0.5f;
const float maxScroll = std::max(0.0f, meanContentHeight - viewHeight);
const float scroll = std::max(0.0f, std::min(lane.edgeCenterScroll, maxScroll));
const float innerWidth =
std::max(0.0f, width - pad * 2.0f - (scrollable ? (scrollW + 4.0f * m_scale) : 0.0f));
layout.tableHeader =
gd::RectF(left + pad, top + titleHeight + pad, innerWidth, tableHeaderHeight);
layout.content = gd::RectF(left + pad, layout.tableHeader.Y + tableHeaderHeight, innerWidth,
viewHeight);
layout.markerContentHeight = meanContentHeight;
layout.scrollOffset = scroll;
if (scrollable)
{
// 滚动条只占**内容区**(不覆盖固定的表头,表头永远干净可读)。
layout.scrollTrack =
gd::RectF(left + pad + innerWidth + 4.0f * m_scale, layout.content.Y, scrollW,
viewHeight);
const float thumbHeight =
std::max(18.0f * m_scale, viewHeight * (viewHeight / meanContentHeight));
const float thumbTop =
layout.content.Y +
(viewHeight - thumbHeight) * ((maxScroll > 0.0f) ? (scroll / maxScroll) : 0.0f);
layout.scrollThumb = gd::RectF(layout.scrollTrack.X, thumbTop, scrollW, thumbHeight);
}
// 三列:名称列吃掉剩余宽度,两列计数按内容宽度固定右对齐 —— 表头与数据行严格对齐。
const float closeSize = kEdgePanelMeanCheckSize * m_scale;
const float gap = kEdgePanelStatColumnGap * m_scale;
const float contentLeft = layout.content.X;
// 计数列宽 = 「表头文字」「当前数字」的较大者(与 `EdgePanelWidth` 同源)。
float risingCol = UiMeasureTextWidth(m_fonts->uiSmall, EdgeCenterTableHeader(1)) + 10.0f * m_scale;
float fallingCol = UiMeasureTextWidth(m_fonts->uiSmall, EdgeCenterTableHeader(2)) + 10.0f * m_scale;
for (const SignalRef& ref : lane.signals)
{
const ResolvedSignal resolved = ResolveSignal(ref);
const Lane::EdgeCenterItem* item = lane.FindEdgeCenterItem(ref);
if (resolved.data == nullptr || resolved.axis == nullptr || resolved.style == nullptr ||
item == nullptr)
{
continue;
}
std::size_t rising = 0;
std::size_t falling = 0;
bool complete = true;
EdgeCenterCountsFor(*resolved.axis, *resolved.data, *resolved.style, item->points,
item->iterations, EdgeRangeActive(), EdgeRangeMin(), EdgeRangeMax(),
rising, falling, complete);
risingCol = std::max(risingCol,
UiMeasureTextWidth(m_fonts->monoSmall, EdgeCountCellText(rising, complete)) +
10.0f * m_scale);
fallingCol = std::max(
fallingCol,
UiMeasureTextWidth(m_fonts->monoSmall, EdgeCountCellText(falling, complete)) +
10.0f * m_scale);
}
const float nameColumn =
std::max(20.0f * m_scale, innerWidth - gap - risingCol - gap - fallingCol);
layout.tableColumns[0].left = contentLeft;
layout.tableColumns[0].width = nameColumn;
layout.tableColumns[1].left = contentLeft + nameColumn + gap;
layout.tableColumns[1].width = risingCol;
layout.tableColumns[2].left = layout.tableColumns[1].left + risingCol + gap;
layout.tableColumns[2].width = fallingCol;
// 参数行(两行滑块)的列宽:与均值滤波同一套算式。
const float labelColumn =
std::max(UiMeasureTextWidth(m_fonts->uiSmall, kMeanFilterPointsSliderLabel),
UiMeasureTextWidth(m_fonts->uiSmall, kMeanFilterIterationsSliderLabel));
const float valueColumn = UiMeasureTextWidth(m_fonts->monoSmall, L"100000");
const float resetSize = kWeakPeakResetButtonSize * m_scale;
const float resetGap = kWeakPeakResetGap * m_scale;
const float trackHeight = kWeakPeakTrackHeight * m_scale;
const float trackLeft = contentLeft + labelColumn + 6.0f * m_scale;
const float resetLeft = contentLeft + innerWidth - resetSize;
const float trackWidth =
std::max(10.0f * m_scale,
(resetLeft - resetGap - valueColumn - 6.0f * m_scale) - trackLeft);
float rowY = layout.content.Y - scroll;
for (const SignalRef& ref : lane.signals)
{
const ResolvedSignal resolved = ResolveSignal(ref);
if (resolved.data == nullptr || !resolved.visible)
{
continue;
}
const Lane::EdgeCenterItem* item = lane.FindEdgeCenterItem(ref);
if (item == nullptr && !resolved.visible)
{
continue;
}
// 未勾选(`item == nullptr`)的行也列出来:它是“启用统计”的唯一入口
//(表格模式下没有独立的开关;点行内复选框即启用 / 取消)。
const bool checked = (item != nullptr);
const bool expanded = (item != nullptr && !item->collapsed);
layout.rowRefs.push_back(ref);
layout.rowHeaders.push_back(gd::RectF(contentLeft, rowY, innerWidth, rowH));
layout.rowNameRects.push_back(gd::RectF(
layout.tableColumns[0].left + kEdgePanelDisclosureWidth * m_scale + 4.0f * m_scale,
rowY, std::max(10.0f, nameColumn - closeSize - kEdgePanelDisclosureWidth * m_scale),
rowH));
layout.rowTriangles.push_back(
checked ? gd::RectF(contentLeft + 2.0f * m_scale,
rowY + (rowH - kEdgePanelRowTriangleSize * m_scale) * 0.5f,
kEdgePanelRowTriangleSize * m_scale,
kEdgePanelRowTriangleSize * m_scale)
: gd::RectF());
layout.rowChecks.push_back(gd::RectF(
contentLeft + nameColumn - closeSize - 2.0f * m_scale,
rowY + (rowH - closeSize) * 0.5f, closeSize, closeSize));
layout.rowPoints.push_back(gd::RectF());
layout.rowIterations.push_back(gd::RectF());
layout.rowStats.push_back(gd::RectF());
rowY += rowH;
if (!expanded)
{
layout.rowLevelTracks.push_back(gd::RectF());
layout.rowLevelValues.push_back(gd::RectF());
layout.rowLevelResets.push_back(gd::RectF());
layout.rowIterTracks.push_back(gd::RectF());
layout.rowIterValues.push_back(gd::RectF());
layout.rowIterResets.push_back(gd::RectF());
continue;
}
const gd::RectF pointsTrack(trackLeft, rowY + (sliderRow - trackHeight) * 0.5f,
trackWidth, trackHeight);
layout.rowLevelTracks.push_back(pointsTrack);
layout.rowLevelValues.push_back(
gd::RectF(pointsTrack.X + pointsTrack.Width + 6.0f * m_scale, rowY, valueColumn,
sliderRow));
layout.rowLevelResets.push_back(
gd::RectF(resetLeft, rowY + (sliderRow - resetSize) * 0.5f, resetSize, resetSize));
rowY += sliderRow;
const gd::RectF iterTrack(trackLeft, rowY + (sliderRow - trackHeight) * 0.5f,
trackWidth, trackHeight);
layout.rowIterTracks.push_back(iterTrack);
layout.rowIterValues.push_back(
gd::RectF(iterTrack.X + iterTrack.Width + 6.0f * m_scale, rowY, valueColumn,
sliderRow));
layout.rowIterResets.push_back(
gd::RectF(resetLeft, rowY + (sliderRow - resetSize) * 0.5f, resetSize, resetSize));
rowY += sliderRow;
}
}
else if (listStyle)
{
// 「均值滤波 / 弱峰调整」:可滚动内容区(信号色叠底条目栏 + 展开后的两行滑块)
// +(均值滤波 / 弱峰调整)底部按钮。
const float buttonRowHeight = kEdgePanelButtonHeight * m_scale;
if (hasButton)
{
@@ -573,8 +771,7 @@ namespace jdi
std::max(0.0f, height - titleHeight - pad - pad - footerHeight);
const bool scrollable = meanContentHeight > viewHeight + 0.5f;
const float maxScroll = std::max(0.0f, meanContentHeight - viewHeight);
const float storedScroll = meanFilter ? lane.meanFilterScroll
: (weakPeak ? lane.weakPeakScroll : lane.edgeCenterScroll);
const float storedScroll = meanFilter ? lane.meanFilterScroll : lane.weakPeakScroll;
const float scroll = std::max(0.0f, std::min(storedScroll, maxScroll));
const float innerWidth =
std::max(0.0f, width - pad * 2.0f - (scrollable ? (scrollW + 4.0f * m_scale) : 0.0f));
@@ -632,8 +829,7 @@ namespace jdi
}
else
{
const Lane::MeanFilterItem* item = meanFilter ? lane.FindMeanFilterItem(ref)
: lane.FindEdgeCenterItem(ref);
const Lane::MeanFilterItem* item = lane.FindMeanFilterItem(ref);
checked = (item != nullptr);
itemCollapsed = (item != nullptr && item->collapsed);
}
@@ -667,12 +863,7 @@ namespace jdi
layout.rowIterResets.push_back(gd::RectF());
continue;
}
// 「中心轴边沿计数」:参数行最上面是**同一行**的「上升沿 / 下降沿」统计。
if (centerAxis && !layout.rowStats.empty())
{
layout.rowStats.back() = gd::RectF(contentLeft, rowY, innerWidth, groupRow);
rowY += groupRow;
}
// 「中心轴边沿计数」已改为独立表格分支,这里不再需要额外的统计行。
const gd::RectF pointsTrack(trackLeft, rowY + (sliderRow - trackHeight) * 0.5f,
trackWidth, trackHeight);
layout.rowLevelTracks.push_back(pointsTrack);