Skip to content

Commit 901fb8f

Browse files
committed
cant shwo variable only for log, log 2nd, and hovered list
all view have compact settings in menubar now
1 parent 569fe60 commit 901fb8f

15 files changed

+173
-121
lines changed

3rdparty/ezlibs

Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22

33
#define LuaScripting_Prefix "LuaScripting"
4-
#define LuaScripting_BuildNumber 70
4+
#define LuaScripting_BuildNumber 71
55
#define LuaScripting_MinorNumber 0
66
#define LuaScripting_MajorNumber 0
7-
#define LuaScripting_BuildId "0.0.70"
7+
#define LuaScripting_BuildId "0.0.71"

src/headers/CustomImGuiConfig.h

+1-12
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,4 @@ namespace ImGui
121121

122122
#include <ezlibs/ezTools.hpp>
123123
#include <ezlibs/ezXmlConfig.hpp>
124-
125-
#ifndef IM_VEC2_CLASS_EXTRA
126-
#define IM_VEC2_CLASS_EXTRA \
127-
ImVec2(const ez::fvec2& v) : x(v.x), y(v.y) {} \
128-
ImVec2(const ez::dvec2& v) : x(static_cast<float>(v.x)), y(static_cast<float>(v.y)) {}
129-
#endif
130-
131-
#ifndef IM_VEC4_CLASS_EXTRA
132-
#define IM_VEC4_CLASS_EXTRA \
133-
ImVec4(const ez::fvec4& v) : x(v.x), y(v.y), z(v.z), w(v.w) {} \
134-
ImVec4(const ez::dvec4& v) : x(static_cast<float>(v.x)), y(static_cast<float>(v.y)), z(static_cast<float>(v.z)), w(static_cast<float>(v.w)) {}
135-
#endif
124+
#include <ezlibs/ezImGui.hpp>

src/headers/LogToGraphBuild.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22

33
#define LogToGraph_Prefix "LogToGraph"
4-
#define LogToGraph_BuildNumber 1056
4+
#define LogToGraph_BuildNumber 1061
55
#define LogToGraph_MinorNumber 2
66
#define LogToGraph_MajorNumber 0
7-
#define LogToGraph_BuildId "0.2.1056"
7+
#define LogToGraph_BuildId "0.2.1061"

src/models/log/LogEngine.cpp

+12-23
Original file line numberDiff line numberDiff line change
@@ -389,45 +389,34 @@ SignalSeriesContainerRef LogEngine::GetSignalSeries() {
389389

390390
void LogEngine::SetHoveredTime(const SignalEpochTime& vHoveredTime) {
391391
m_HoveredTime = vHoveredTime;
392-
393392
ProjectFile::Instance()->SetProjectChange();
394-
395-
if (m_PreviewTicks.empty()) {
396-
m_PreviewTicks.resize(m_SignalsCount);
397-
}
398-
399-
size_t idx = 0U;
393+
m_PreviewTicks.clear();
394+
m_PreviewTicks.reserve(m_SignalsCount);
400395
size_t visible_idx = 0U;
401396
for (auto& item_cat : m_SignalSeries) {
402397
for (auto& item_name : item_cat.second) {
403398
if (item_name.second) {
399+
if (ProjectFile::Instance()->m_ShowVariableSignalsInHoveredListView && item_name.second->isConstant()) {
400+
continue;
401+
}
404402
SignalTickPtr last_ptr = nullptr;
405403
for (const auto& tick_weak : item_name.second->datas_values) {
406404
auto ptr = tick_weak.lock();
407405
if (last_ptr && vHoveredTime >= last_ptr->time_epoch && ptr && vHoveredTime <= ptr->time_epoch) {
408-
if (idx < (size_t)m_SignalsCount) {
409-
m_PreviewTicks[idx] = last_ptr;
410-
411-
if (ProjectFile::Instance()->m_AutoColorize) {
412-
auto parent_ptr = last_ptr->parent.lock();
413-
if (parent_ptr && parent_ptr->show) {
414-
parent_ptr->color_u32 = ImGui::GetColorU32(GraphView::GetRainBow((int32_t)visible_idx, m_VisibleCount));
415-
parent_ptr->color_v4 = ImGui::ColorConvertU32ToFloat4(parent_ptr->color_u32);
406+
m_PreviewTicks.push_back(last_ptr);
407+
if (ProjectFile::Instance()->m_AutoColorize) {
408+
auto parent_ptr = last_ptr->parent.lock();
409+
if (parent_ptr && parent_ptr->show) {
410+
parent_ptr->color_u32 = ImGui::GetColorU32(GraphView::GetRainBow((int32_t)visible_idx, m_VisibleCount));
411+
parent_ptr->color_v4 = ImGui::ColorConvertU32ToFloat4(parent_ptr->color_u32);
416412

417-
++visible_idx;
418-
}
413+
++visible_idx;
419414
}
420-
} else {
421-
EZ_TOOLS_DEBUG_BREAK;
422415
}
423-
424416
break;
425417
}
426-
427418
last_ptr = ptr;
428419
}
429-
430-
++idx;
431420
}
432421
}
433422
}

src/panes/GraphPane.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ bool GraphPane::DrawPanes(const uint32_t& /*vCurrentFrame*/, bool* vOpened, ImGu
5151
if (ProjectFile::Instance()->IsProjectLoaded()) {
5252
if (ImGui::BeginMenuBar()) {
5353
GraphView::Instance()->DrawMenuBar();
54-
5554
ImGui::EndMenuBar();
5655
}
5756

src/panes/LogPane.cpp

+49-28
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ bool LogPane::DrawPanes(const uint32_t& /*vCurrentFrame*/, bool* vOpened, ImGuiC
5555
flags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_MenuBar;
5656
#endif
5757
if (ProjectFile::Instance()->IsProjectLoaded()) {
58+
if (ImGui::BeginMenuBar()) {
59+
DrawMenuBar();
60+
ImGui::EndMenuBar();
61+
}
5862
DrawTable();
5963
}
6064
}
@@ -101,38 +105,48 @@ void LogPane::CheckItem(SignalTickPtr vSignalTick) {
101105
}
102106
}
103107

104-
void LogPane::DrawTable() {
105-
if (ImGui::BeginMenuBar()) {
106-
bool need_update = ImGui::Checkbox("Collapse Selection", &ProjectFile::Instance()->m_CollapseLogSelection);
107-
need_update |= ImGui::Checkbox("Hide some values", &ProjectFile::Instance()->m_HideSomeValues);
108-
109-
if (ProjectFile::Instance()->m_HideSomeValues) {
110-
ImGui::Text("(?)");
111-
if (ImGui::IsItemHovered()) {
112-
ImGui::SetTooltip("%s", "you can define many values, ex : 1,2,3.2,5.8");
113-
}
114-
115-
if (ImGui::ContrastedButton("R##ResetLogPaneTable")) {
116-
ProjectFile::Instance()->m_ValuesToHide.clear();
117-
need_update = true;
118-
}
108+
void LogPane::DrawMenuBar() {
109+
bool need_update = false;
110+
if (ImGui::BeginMenu("Settings")) {
111+
if (ImGui::MenuItem("Show variable signals only", nullptr, &ProjectFile::Instance()->m_ShowVariableSignalsInLogView)) {
112+
LogEngine::Instance()->SetHoveredTime(LogEngine::Instance()->GetHoveredTime());
113+
need_update = true;
114+
}
115+
if (ImGui::MenuItem("Collapse Selection", nullptr, &ProjectFile::Instance()->m_CollapseLogSelection)) {
116+
need_update = true;
117+
}
118+
if (ImGui::MenuItem("Hide some values", nullptr, &ProjectFile::Instance()->m_HideSomeLogValues)) {
119+
need_update = true;
120+
}
121+
ImGui::EndMenu();
122+
}
119123

120-
static char _values_hide_buffer[1024 + 1] = "";
121-
snprintf(_values_hide_buffer, 1024, "%s", ProjectFile::Instance()->m_ValuesToHide.c_str());
122-
if (ImGui::InputText("##Valuestohide", _values_hide_buffer, 1024)) {
123-
need_update = true;
124-
ProjectFile::Instance()->m_ValuesToHide = _values_hide_buffer;
125-
}
124+
if (ProjectFile::Instance()->m_HideSomeLogValues) {
125+
ImGui::Text("(?)");
126+
if (ImGui::IsItemHovered()) {
127+
ImGui::SetTooltip("%s", "you can define many values, ex : 1,2,3.2,5.8");
126128
}
127129

128-
if (need_update) {
129-
PrepareLog();
130+
if (ImGui::ContrastedButton("R##ResetLogPaneTable")) {
131+
ProjectFile::Instance()->m_LogValuesToHide.clear();
132+
need_update = true;
133+
}
130134

131-
ProjectFile::Instance()->SetProjectChange();
135+
static char _values_hide_buffer[1024 + 1] = "";
136+
snprintf(_values_hide_buffer, 1024, "%s", ProjectFile::Instance()->m_LogValuesToHide.c_str());
137+
if (ImGui::InputText("##Valuestohide", _values_hide_buffer, 1024)) {
138+
need_update = true;
139+
ProjectFile::Instance()->m_LogValuesToHide = _values_hide_buffer;
132140
}
141+
}
133142

134-
ImGui::EndMenuBar();
143+
if (need_update) {
144+
PrepareLog();
145+
ProjectFile::Instance()->SetProjectChange();
135146
}
147+
}
148+
149+
void LogPane::DrawTable() {
136150

137151
static ImGuiTableFlags flags = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_RowBg | ImGuiTableFlags_Hideable | ImGuiTableFlags_ScrollY |
138152
ImGuiTableFlags_Resizable |
@@ -253,9 +267,9 @@ void LogPane::PrepareLog() {
253267

254268
m_LogDatas.clear();
255269

256-
if (ProjectFile::Instance()->m_HideSomeValues) {
270+
if (ProjectFile::Instance()->m_HideSomeLogValues) {
257271
m_ValuesToHide.clear();
258-
auto arr = ez::str::splitStringToVector(ProjectFile::Instance()->m_ValuesToHide, ",");
272+
auto arr = ez::str::splitStringToVector(ProjectFile::Instance()->m_LogValuesToHide, ",");
259273
for (const auto& a : arr) {
260274
m_ValuesToHide.push_back(ez::dvariant(a).GetD());
261275
}
@@ -267,11 +281,18 @@ void LogPane::PrepareLog() {
267281
for (size_t idx = 0U; idx < _count_logs; ++idx) {
268282
const auto& infos_ptr = LogEngine::Instance()->GetSignalTicks().at(idx);
269283
if (infos_ptr) {
284+
auto parent_ptr = infos_ptr->parent.lock();
285+
if (parent_ptr != nullptr) {
286+
if (ProjectFile::Instance()->m_ShowVariableSignalsInLogView && parent_ptr->isConstant()) {
287+
continue;
288+
}
289+
}
290+
270291
auto selected = LogEngine::Instance()->isSignalShown(infos_ptr->category, infos_ptr->name);
271292
if (_collapseSelection && !selected)
272293
continue;
273294

274-
if (ProjectFile::Instance()->m_HideSomeValues) {
295+
if (ProjectFile::Instance()->m_HideSomeLogValues) {
275296
bool found = false;
276297

277298
for (const auto& a : m_ValuesToHide) {

src/panes/LogPane.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ class LogPane : public AbstractPane {
4141
void CheckItem(SignalTickPtr vSignalTick);
4242
void PrepareLog();
4343

44+
private:
45+
void DrawMenuBar();
46+
void DrawTable();
47+
4448
public: // singleton
4549
static std::shared_ptr<LogPane> Instance() {
4650
static auto _instance = std::make_shared<LogPane>();
@@ -52,7 +56,4 @@ class LogPane : public AbstractPane {
5256
LogPane(const LogPane&) = delete; // Prevent construction by copying
5357
LogPane& operator=(const LogPane&) { return *this; }; // Prevent assignment
5458
virtual ~LogPane() = default; // Prevent unwanted destruction};
55-
56-
private:
57-
void DrawTable();
5859
};

src/panes/LogPaneSecondView.cpp

+49-29
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ bool LogPaneSecondView::DrawPanes(const uint32_t& /*vCurrentFrame*/, bool* vOpen
5252
flags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_MenuBar;
5353
#endif
5454
if (ProjectFile::Instance()->IsProjectLoaded()) {
55+
if (ImGui::BeginMenuBar()) {
56+
DrawMenuBar();
57+
ImGui::EndMenuBar();
58+
}
5559
DrawTable();
5660
}
5761
}
@@ -98,39 +102,48 @@ void LogPaneSecondView::CheckItem(const SignalTickPtr& vSignalTick) {
98102
}
99103
}
100104

101-
void LogPaneSecondView::DrawTable() {
102-
if (ImGui::BeginMenuBar()) {
103-
bool need_update = ImGui::Checkbox("Collapse Selection", &ProjectFile::Instance()->m_CollapseLogSelection);
104-
need_update |= ImGui::Checkbox("Hide some values", &ProjectFile::Instance()->m_HideSomeValues);
105-
106-
if (ProjectFile::Instance()->m_HideSomeValues) {
107-
ImGui::Text("(?)");
108-
if (ImGui::IsItemHovered()) {
109-
ImGui::SetTooltip("%s", "you can define many values, ex : 1,2,3.2,5.8");
110-
}
111-
112-
if (ImGui::ContrastedButton("R##ResetLogPaneSecondViewTable")) {
113-
ProjectFile::Instance()->m_ValuesToHide.clear();
114-
need_update = true;
115-
}
105+
void LogPaneSecondView::DrawMenuBar() {
106+
bool need_update = false;
107+
if (ImGui::BeginMenu("Settings")) {
108+
if (ImGui::MenuItem("Show variable signals only", nullptr, &ProjectFile::Instance()->m_ShowVariableSignalsInLog2ndView)) {
109+
LogEngine::Instance()->SetHoveredTime(LogEngine::Instance()->GetHoveredTime());
110+
need_update = true;
111+
}
112+
if (ImGui::MenuItem("Collapse Selection", nullptr, &ProjectFile::Instance()->m_CollapseLog2ndSelection)) {
113+
need_update = true;
114+
}
115+
if (ImGui::MenuItem("Hide some values", nullptr, &ProjectFile::Instance()->m_HideSomeLog2ndValues)) {
116+
need_update = true;
117+
}
118+
ImGui::EndMenu();
119+
}
116120

117-
static char _values_hide_buffer[1024 + 1] = "";
118-
snprintf(_values_hide_buffer, 1024, "%s", ProjectFile::Instance()->m_ValuesToHide.c_str());
119-
if (ImGui::InputText("##Valuestohide", _values_hide_buffer, 1024)) {
120-
need_update = true;
121-
ProjectFile::Instance()->m_ValuesToHide = _values_hide_buffer;
122-
}
121+
if (ProjectFile::Instance()->m_HideSomeLog2ndValues) {
122+
ImGui::Text("(?)");
123+
if (ImGui::IsItemHovered()) {
124+
ImGui::SetTooltip("%s", "you can define many values, ex : 1,2,3.2,5.8");
123125
}
124126

125-
if (need_update) {
126-
PrepareLog();
127+
if (ImGui::ContrastedButton("R##ResetLogPaneTable")) {
128+
ProjectFile::Instance()->m_Log2ndValuesToHide.clear();
129+
need_update = true;
130+
}
127131

128-
ProjectFile::Instance()->SetProjectChange();
132+
static char _values_hide_buffer[1024 + 1] = "";
133+
snprintf(_values_hide_buffer, 1024, "%s", ProjectFile::Instance()->m_Log2ndValuesToHide.c_str());
134+
if (ImGui::InputText("##Valuestohide", _values_hide_buffer, 1024)) {
135+
need_update = true;
136+
ProjectFile::Instance()->m_Log2ndValuesToHide = _values_hide_buffer;
129137
}
138+
}
130139

131-
ImGui::EndMenuBar();
140+
if (need_update) {
141+
PrepareLog();
142+
ProjectFile::Instance()->SetProjectChange();
132143
}
144+
}
133145

146+
void LogPaneSecondView::DrawTable() {
134147
static ImGuiTableFlags flags = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_RowBg | ImGuiTableFlags_Hideable | ImGuiTableFlags_ScrollY |
135148
ImGuiTableFlags_Resizable |
136149
ImGuiTableFlags_NoHostExtendY;
@@ -250,25 +263,32 @@ void LogPaneSecondView::PrepareLog() {
250263

251264
m_LogDatas.clear();
252265

253-
if (ProjectFile::Instance()->m_HideSomeValues) {
266+
if (ProjectFile::Instance()->m_HideSomeLog2ndValues) {
254267
m_ValuesToHide.clear();
255-
auto arr = ez::str::splitStringToVector(ProjectFile::Instance()->m_ValuesToHide, ",");
268+
auto arr = ez::str::splitStringToVector(ProjectFile::Instance()->m_Log2ndValuesToHide, ",");
256269
for (const auto& a : arr) {
257270
m_ValuesToHide.push_back(ez::dvariant(a).GetD());
258271
}
259272
}
260273

261274
const auto _count_logs = LogEngine::Instance()->GetSignalTicks().size();
262-
const auto _collapseSelection = ProjectFile::Instance()->m_CollapseLogSelection;
275+
const auto _collapseSelection = ProjectFile::Instance()->m_CollapseLog2ndSelection;
263276

264277
for (size_t idx = 0U; idx < _count_logs; ++idx) {
265278
const auto& infos_ptr = LogEngine::Instance()->GetSignalTicks().at(idx);
266279
if (infos_ptr) {
280+
auto parent_ptr = infos_ptr->parent.lock();
281+
if (parent_ptr != nullptr) {
282+
if (ProjectFile::Instance()->m_ShowVariableSignalsInLog2ndView && parent_ptr->isConstant()) {
283+
continue;
284+
}
285+
}
286+
267287
auto selected = LogEngine::Instance()->isSignalShown(infos_ptr->category, infos_ptr->name);
268288
if (_collapseSelection && !selected)
269289
continue;
270290

271-
if (ProjectFile::Instance()->m_HideSomeValues) {
291+
if (ProjectFile::Instance()->m_HideSomeLog2ndValues) {
272292
bool found = false;
273293

274294
for (const auto& a : m_ValuesToHide) {

src/panes/LogPaneSecondView.h

+7-6
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,21 @@ class LogPaneSecondView : public AbstractPane {
3939

4040
void Clear();
4141
void CheckItem(const SignalTickPtr& vSignalTick);
42-
void PrepareLog();
42+
void PrepareLog(); // Prevent unwanted destruction};
43+
44+
private:
45+
void DrawMenuBar();
46+
void DrawTable();
4347

4448
public: // singleton
4549
static std::shared_ptr<LogPaneSecondView> Instance() {
4650
static auto _instance = std::make_shared<LogPaneSecondView>();
4751
return _instance;
48-
}
52+
}
4953

5054
public:
5155
LogPaneSecondView() = default; // Prevent construction
5256
LogPaneSecondView(const LogPaneSecondView&) = delete; // Prevent construction by copying
5357
LogPaneSecondView& operator=(const LogPaneSecondView&) { return *this; }; // Prevent assignment
54-
virtual ~LogPaneSecondView() = default; // Prevent unwanted destruction};
55-
56-
private:
57-
void DrawTable();
58+
virtual ~LogPaneSecondView() = default;
5859
};

0 commit comments

Comments
 (0)