输入框鼠标编辑、图例省略、信号跨视图共享选择与网格菜单布局修复

- 输入框:支持鼠标左键点击定位插入符、拖拽框选区域,并且不再限制字符长度
- 输入框:长文本使用 ETO_CLIPPED 裁剪绘制,避免字符溢出到编辑区域之外
- 图例:信号名称超过 200px 时省略号截断,不再挤压标尺区域
- 选中状态从 TabConfig 迁移到 DataSet,切换视图后信号选中状态保持一致
- 网格右键菜单:Y 轴最大值/最小值直接显示当前值,点击后原位置弹出内联编辑框
- 标尺数值改为绘制在图例下层,不再因避让图例而隐藏
- 移除已无用的 LegendBandRect,新增共享的编辑框布局与命中检测工具
- .gitignore 忽略 TestData 测试数据目录
This commit is contained in:
DeepSeek V4.1 Flash committed 2026-09-30 17:10:23 +08:00
1 parent e3744f3eff
commit 12b3531485
19 files changed
+790 -186

No files matched your search

+48 -12
View File
@@ -82,7 +82,7 @@ namespace jdi
* @param [IN] dataSet 数据集合,允许为空。
* @param [IN] tab 当前标签页配置,允许为空。
*/
void SetContext(const DataSet* dataSet, TabConfig* tab);
void SetContext(DataSet* dataSet, TabConfig* tab);
/**
* @brief 设置 DPI 缩放比例。
@@ -287,7 +287,16 @@ namespace jdi
* @param [IN] editMax 为 true 编辑上限,为 false 编辑下限。
* @return 进入成功返回 true。
*/
bool BeginLaneValueEdit(int laneIndex, bool editMax);
bool BeginLaneValueEdit(int laneIndex, bool editMax, const gd::RectF& anchorRect);
/**
* @brief 查询某网格当前的 Y 轴显示范围。
* @param [IN] laneIndex 网格下标。
* @param [OUT] yMin 输出下限。
* @param [OUT] yMax 输出上限。
* @return 网格下标合法返回 true。
*/
bool LaneRange(int laneIndex, double& yMin, double& yMax) const;
/**
* @brief 判断是否处于任意内联数值输入状态。
@@ -324,6 +333,27 @@ namespace jdi
*/
bool CollapseEditSelectionToEnd();
/**
* @brief 编辑态下在输入框内按下鼠标左键:定位插入符并开始拖拽框选。
* @param [IN] x 客户区横坐标。
* @param [IN] y 客户区纵坐标。
* @return 命中输入框返回 true。
*/
bool OnEditMouseDown(int x, int y);
/**
* @brief 编辑态下拖拽鼠标:扩展选区。
* @param [IN] x 客户区横坐标。
* @return 选区发生变化返回 true。
*/
bool OnEditMouseMove(int x);
/**
* @brief 编辑态下松开鼠标左键:结束拖拽框选。
* @return 之前处于拖拽中返回 true。
*/
bool OnEditMouseUp();
/**
* @brief 获取当前视图左边界时间。
* @return 视图左边界时间。
@@ -402,6 +432,18 @@ namespace jdi
*/
bool LaneSpansMultipleFiles(int laneIndex) const;
/**
* @brief 获取当前选中信号(跨标签页共享,切换视图后选中项保持一致)。
* @return 信号引用。
*/
const SignalRef& SelectedRef() const;
/**
* @brief 设置当前选中信号(跨标签页共享)。
* @param [IN] ref 信号引用。
*/
void SelectSignal(const SignalRef& ref);
/**
* @brief 重新计算各网格的布局与幅值范围。
*/
@@ -533,7 +575,8 @@ namespace jdi
* @param [IN] initialText 初始文本。
* @return 进入成功返回 true。
*/
bool BeginEdit(PlotEditTarget target, int laneIndex, const std::wstring& initialText);
bool BeginEdit(PlotEditTarget target, int laneIndex, const std::wstring& initialText,
const gd::RectF& anchorRect = gd::RectF());
/**
* @brief 结束内联输入。
@@ -641,7 +684,8 @@ namespace jdi
const UiFonts* m_fonts = nullptr; /**< 字体资源。 */
const Theme* m_theme = nullptr; /**< 主题资源。 */
const DataSet* m_dataSet = nullptr; /**< 数据集合。 */
const DataSet* m_dataSet = nullptr; /**< 数据集合(只读访问)。 */
DataSet* m_dataSetWritable = nullptr; /**< 数据集合(选中状态写入)。 */
TabConfig* m_tab = nullptr; /**< 当前标签页配置。 */
TabConfig m_localTab; /**< 未绑定标签页时使用的占位配置。 */
HWND m_host = nullptr; /**< 剪贴板所有者窗口句柄。 */
@@ -705,14 +749,6 @@ namespace jdi
* @return 命中的信号引用,未命中返回无效引用。
*/
SignalRef LegendAtPoint(int x, int y) const;
/**
* @brief 计算指定网格图例带所占据的矩形(用于让标尺数字避让)。
* @param [IN] laneIndex 网格下标。
* @param [IN] lane 网格绘制信息。
* @return 图例带矩形,无可见信号时返回空矩形。
*/
gd::RectF LegendBandRect(int laneIndex, const LaneVisual& lane) const;
};
} // namespace jdi