fix: 修复网格徽标菜单与标签页编号,重构样式区并新增透明度与浮动拾色器

信号列表
- 网格徽标(G1/G2)改为在左键抬起时弹出菜单,修复此前「按住才显示、松手即消失」的问题。
- 文件分组行新增关闭按钮(✕),可直接从工作区移除文件,与右键菜单「关闭该文件」等价。
- 信号名改为完整保留文件内的列名原文,不再剥离 "[n]" 序号前缀与括号内容。

标签页
- 新建标签页改用「当前未被占用的最小编号」,关闭标签页后编号可被复用,
  修复「开 3 关 2 再新建会变成视图 4」的问题。

样式编辑区(统一为固定四行网格布局,面板缩放时不再错位)
- 移除顶部「样式 · 信号名 · 文件名」标题行,选中信号即为编辑对象。
- 绘制方式取消「阶梯」,标签由「方式」改为「样式」,仅保留线段 / 散点 / 点线。
- 线宽仅保留最细与最粗两个预设,中间改为带左右箭头的数值旋钮,单位为 px;
  支持单击或双击数值框直接键入(首次键入替换原值,回车提交、Esc 取消、越界钳制到 0.5-6.0)。
- 颜色预设后新增与预设色块完全同尺寸、同外框样式的「加号」小方格,
  点击后弹出浮动拾色面板(与 G1/G2 菜单同风格的浮动窗口),支持 RGB 三通道滑块、
  实时预览与十六进制显示;点击面板外部即收起,取色实时应用到当前信号。
- 移除样式区末尾的网格选择控件,该功能统一由信号行的 G 徽标承载。
- 新增透明度滑块,默认 100%,可在 0-100% 之间调节,并实时反映到波形、
  图例色块与信号行色块的显示效果。

其他
- 信号面板默认宽度与行内间距微调,使较长的列名可以完整显示。
- 失焦时提交线宽输入并收起浮动拾色器与弹出菜单。
This commit is contained in:
DeepSeek V4.1 Flash committed 2026-09-29 17:14:27 +08:00
1 parent eb868b2679
commit 729494d1ec
9 files changed
+1254 -471

No files matched your search

+23 -13
View File
@@ -43,23 +43,32 @@ namespace jdi
}
/**
* @brief 组装图例文本:信号名已在括号中携带单位时不再重复追加。
* @brief 组装图例文本:直接使用列名原文(已含序号与括号描述)。
* @param [IN] data 信号数据。
* @return 图例文本。
*/
std::wstring BuildLegendText(const SignalData& data)
{
if (data.unit.empty())
{
return data.name;
}
return data.name;
}
const std::wstring bracketed = L"(" + data.unit + L")";
if (ContainsInsensitive(data.name, bracketed))
/**
* @brief 将信号样式颜色按不透明度换算为实际绘制颜色。
* @param [IN] style 信号样式。
* @return 叠加不透明度后的 0xAARRGGBB 颜色值。
*/
std::uint32_t StyleColor(const SignalStyle& style)
{
double opacity = static_cast<double>(style.opacity);
if (opacity < 0.0)
{
return data.name;
opacity = 0.0;
}
return data.name + L" [" + data.unit + L"]";
if (opacity > 1.0)
{
opacity = 1.0;
}
return WithAlpha(style.color, static_cast<unsigned int>(opacity * 255.0 + 0.5));
}
}
@@ -1096,7 +1105,8 @@ namespace jdi
if (drawLine && !breaks.empty())
{
gd::Pen pen(ToGdiColor(resolved.style->color), resolved.style->lineWidth * m_scale);
gd::Pen pen(ToGdiColor(StyleColor(*resolved.style)),
resolved.style->lineWidth * m_scale);
pen.SetLineJoin(gd::LineJoinRound);
pen.SetStartCap(gd::LineCapRound);
pen.SetEndCap(gd::LineCapRound);
@@ -1121,7 +1131,7 @@ namespace jdi
m_scale);
const std::size_t scatterStride =
std::max<std::size_t>(1, points.size() / kMaxScatterPoints);
gd::SolidBrush brush(ToGdiColor(resolved.style->color));
gd::SolidBrush brush(ToGdiColor(StyleColor(*resolved.style)));
for (std::size_t k = 0; k < points.size(); k += scatterStride)
{
g.FillEllipse(&brush, points[k].X - radius, points[k].Y - radius, radius * 2.0f,
@@ -1228,7 +1238,7 @@ namespace jdi
const float swatchSize = 8.0f * m_scale;
UiFillRoundRect(g,
gd::RectF(cursorX, top + (height - swatchSize) * 0.5f, swatchSize, swatchSize),
1.5f * m_scale, resolved.style->color);
1.5f * m_scale, StyleColor(*resolved.style));
cursorX += swatchSize + 5.0f * m_scale;
UiText(g, label, m_fonts->uiSmall, gd::RectF(cursorX, top, textWidth + 2.0f, height),
@@ -1425,7 +1435,7 @@ namespace jdi
const float radius = 3.4f * m_scale;
gd::SolidBrush ring(ToGdiColor(m_theme->cardBg));
gd::SolidBrush fill(ToGdiColor(resolved.style->color));
gd::SolidBrush fill(ToGdiColor(StyleColor(*resolved.style)));
g.FillEllipse(&ring, x - radius - 1.2f * m_scale, y - radius - 1.2f * m_scale,
(radius + 1.2f * m_scale) * 2.0f, (radius + 1.2f * m_scale) * 2.0f);
g.FillEllipse(&fill, x - radius, y - radius, radius * 2.0f, radius * 2.0f);