前提:加载完成后全部采样都已驻留内存,程序此后与源文件再无联系。 据此修正了一批会让人误以为"仍在读写文件"的命名: - 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 无任何警告。
84 lines
2.7 KiB
C++
84 lines
2.7 KiB
C++
#include "Theme.hpp"
|
||
|
||
namespace jdi
|
||
{
|
||
|
||
namespace
|
||
{
|
||
// Solarised Light 基础色板。
|
||
const std::uint32_t kBase03 = 0x002B36u; // #002B36
|
||
const std::uint32_t kBase02 = 0x073642u; // #073642
|
||
const std::uint32_t kBase01 = 0x586E75u; // #586E75
|
||
const std::uint32_t kBase00 = 0x657B83u; // #657B83
|
||
const std::uint32_t kBase0 = 0x839496u; // #839496
|
||
const std::uint32_t kBase1 = 0x93A1A1u; // #93A1A1
|
||
const std::uint32_t kBase2 = 0xEEE8D5u; // #EEE8D5
|
||
const std::uint32_t kBase3 = 0xFDF6E3u; // #FDF6E3
|
||
|
||
// Solarised 强调色。
|
||
const std::uint32_t kYellow = 0xB58900u; // #B58900
|
||
const std::uint32_t kOrange = 0xCB4B16u; // #CB4B16
|
||
const std::uint32_t kRed = 0xDC322Fu; // #DC322F
|
||
const std::uint32_t kMagenta = 0xD33682u; // #D33682
|
||
const std::uint32_t kViolet = 0x6C71C4u; // #6C71C4
|
||
const std::uint32_t kBlue = 0x268BD2u; // #268BD2
|
||
const std::uint32_t kCyan = 0x2AA198u; // #2AA198
|
||
const std::uint32_t kGreen = 0x859900u; // #859900
|
||
|
||
/** @brief 波形默认配色,按视觉对比度排序。 */
|
||
const std::uint32_t kSignalPalette[] = {
|
||
MakeArgb(kBlue), MakeArgb(kGreen), MakeArgb(kRed), MakeArgb(kViolet),
|
||
MakeArgb(kYellow), MakeArgb(kCyan), MakeArgb(kMagenta), MakeArgb(kOrange),
|
||
MakeArgb(kBase01), MakeArgb(kBase0),
|
||
};
|
||
|
||
/** @brief 全局唯一主题实例。 */
|
||
const Theme kSolarizedLight = []
|
||
{
|
||
Theme theme;
|
||
theme.windowBg = MakeArgb(kBase3);
|
||
theme.toolbarBg = MakeArgb(kBase2);
|
||
theme.panelBg = MakeArgb(kBase2);
|
||
theme.cardBg = MakeArgb(kBase3);
|
||
theme.statusBg = MakeArgb(kBase2);
|
||
theme.plotBg = MakeArgb(kBase3);
|
||
theme.border = MakeArgb(0xD9D1BCu);
|
||
theme.borderStrong = MakeArgb(kBase1);
|
||
|
||
theme.text = MakeArgb(kBase00);
|
||
theme.textStrong = MakeArgb(kBase02);
|
||
theme.textMuted = MakeArgb(kBase1);
|
||
theme.textOnAccent = MakeArgb(kBase3);
|
||
|
||
theme.accent = MakeArgb(kBlue);
|
||
theme.accentSoft = MakeArgb(0xCFE4F3u);
|
||
theme.hover = MakeArgb(0xE4DCC6u);
|
||
theme.pressed = MakeArgb(0xD8CFB6u);
|
||
theme.selection = MakeArgb(0xDCEAF6u);
|
||
|
||
// 网格线需要在绘图区底色(kBase3)上清晰可辨,同时又要与网格边界
|
||
// (axisLine/borderStrong 的蓝灰)明显区分——因此采用偏暖的加深米色。
|
||
theme.gridWeak = MakeArgb(0xDDD3B8u);
|
||
theme.gridStrong = MakeArgb(0xC3B896u);
|
||
theme.axisLine = MakeArgb(kBase1);
|
||
theme.cursor = MakeArgb(kOrange);
|
||
theme.readoutBg = MakeArgb(0xF6EFDCu);
|
||
theme.danger = MakeArgb(kRed);
|
||
theme.warning = MakeArgb(kYellow);
|
||
return theme;
|
||
}();
|
||
}
|
||
|
||
const Theme& SolarizedLight()
|
||
{
|
||
return kSolarizedLight;
|
||
}
|
||
|
||
const std::uint32_t* SignalPalette(int& count)
|
||
{
|
||
count = static_cast<int>(sizeof(kSignalPalette) / sizeof(kSignalPalette[0]));
|
||
return kSignalPalette;
|
||
}
|
||
|
||
} // namespace jdi
|