Skip to content

Commit 3cecd05

Browse files
committed
graph and all graph view can show only variable signals. see the options in settings menu of each panes
1 parent c2eab08 commit 3cecd05

File tree

8 files changed

+71
-21
lines changed

8 files changed

+71
-21
lines changed

src/headers/LogToGraphBuild.h

Lines changed: 2 additions & 2 deletions
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 1046
4+
#define LogToGraph_BuildNumber 1051
55
#define LogToGraph_MinorNumber 2
66
#define LogToGraph_MajorNumber 0
7-
#define LogToGraph_BuildId "0.2.1046"
7+
#define LogToGraph_BuildId "0.2.1051"

src/models/graphs/GraphView.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,10 @@ void GraphView::DrawMenuBar() {
283283
if (ImGui::BeginMenu("Settings")) {
284284
ImGui::MenuItem("Synchronize Graphs", nullptr, &ProjectFile::Instance()->m_SyncGraphs);
285285

286+
if (ImGui::MenuItem("Show variable signals only", nullptr, &ProjectFile::Instance()->m_ShowVariableSignalsInGraphView)) {
287+
ProjectFile::Instance()->SetProjectChange();
288+
}
289+
286290
if (ImGui::BeginMenu("Axis Labels")) {
287291
if (ImGui::MenuItem(m_show_hide_x_axis ? "Show X Axis LabelsR##GraphPaneDrawPanes" : "Hide X Axis LabelsR##GraphPaneDrawPanes")) {
288292
m_show_hide_x_axis = !m_show_hide_x_axis;
@@ -739,6 +743,9 @@ void GraphView::DrawAloneGraphs(const GraphGroupPtr& vGraphGroupPtr, const ImVec
739743
for (auto& name : cat.second) {
740744
auto datas_ptr = name.second.lock();
741745
if (datas_ptr) {
746+
if (ProjectFile::Instance()->m_ShowVariableSignalsInGraphView && datas_ptr->isConstant()) {
747+
continue;
748+
}
742749
prDrawSignalGraph_ImPlot(datas_ptr, vSize, vFirstGraph);
743750

744751
vFirstGraph = false;
@@ -786,6 +793,9 @@ void GraphView::DrawGroupedGraphs(const GraphGroupPtr& vGraphGroupPtr, const ImV
786793
for (auto& name : cat.second) {
787794
auto datas_ptr = name.second.lock();
788795
if (datas_ptr && datas_ptr->show_hide_temporary) {
796+
if (ProjectFile::Instance()->m_ShowVariableSignalsInGraphView && datas_ptr->isConstant()) {
797+
continue;
798+
}
789799
const auto& name_str = datas_ptr->category + " / " + datas_ptr->name;
790800
if (ImPlot::BeginItem(name_str.c_str())) {
791801
bool _is_zone_reached = false;

src/models/log/SignalSerie.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,8 @@ void SignalSerie::drawAnnotations() {
7575

7676
void SignalSerie::finalize() {
7777
label = ez::str::toStr("%s (%u)", name.c_str(), static_cast<uint32_t>(count_base_records));
78-
}
78+
}
79+
80+
bool SignalSerie::isConstant() {
81+
return ez::isEqual(range_value.x, range_value.y);
82+
}

src/models/log/SignalSerie.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ limitations under the License.
2222
#include <string>
2323
#include <unordered_map>
2424
#include <headers/DatasDef.h>
25+
#include <ezlibs/ezVec2.hpp>
2526

2627
class SignalSerie {
2728
public:
@@ -58,5 +59,6 @@ class SignalSerie {
5859

5960
void drawAnnotations();
6061

62+
bool isConstant();
6163
void finalize();
6264
};

src/panes/GraphListPane.cpp

Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ bool GraphListPane::DrawPanes(const uint32_t& /*vCurrentFrame*/, bool* vOpened,
6060
flags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_MenuBar;
6161
#endif
6262
if (ProjectFile::Instance()->IsProjectLoaded()) {
63+
if (ImGui::BeginMenuBar()) {
64+
DrawMenuBar();
65+
ImGui::EndMenuBar();
66+
}
6367
DrawTree();
6468
}
6569
}
@@ -90,6 +94,7 @@ void GraphListPane::DisplayItem(const int& vIdx, const SignalSerieWeak& vDatasSe
9094
ImGui::PushID(vIdx);
9195
ImGui::TableSetColumnIndex(0);
9296
if (ImGui::Selectable(datas_ptr->category.c_str(), &datas_ptr->show, ImGuiSelectableFlags_SpanAllColumns, ImVec2(0, GRAPHS_HEIGHT))) {
97+
ProjectFile::Instance()->SetProjectChange();
9398
LogEngine::Instance()->ShowHideSignal(datas_ptr->category, datas_ptr->name, datas_ptr->show);
9499
if (ProjectFile::Instance()->m_CollapseLogSelection) {
95100
LogPane::Instance()->PrepareLog();
@@ -99,6 +104,7 @@ void GraphListPane::DisplayItem(const int& vIdx, const SignalSerieWeak& vDatasSe
99104

100105
ImGui::TableSetColumnIndex(1);
101106
if (ImGui::Selectable(datas_ptr->name.c_str(), &datas_ptr->show, ImGuiSelectableFlags_SpanAllColumns, ImVec2(0, GRAPHS_HEIGHT))) {
107+
ProjectFile::Instance()->SetProjectChange();
102108
LogEngine::Instance()->ShowHideSignal(datas_ptr->category, datas_ptr->name, datas_ptr->show);
103109
if (ProjectFile::Instance()->m_CollapseLogSelection) {
104110
LogPane::Instance()->PrepareLog();
@@ -159,28 +165,45 @@ void GraphListPane::DisplayItem(const int& vIdx, const SignalSerieWeak& vDatasSe
159165
}
160166
}
161167

162-
void GraphListPane::DrawTree() {
163-
auto& search_string = ProjectFile::Instance()->m_AllGraphSignalsSearchString;
164-
165-
if (ImGui::BeginMenuBar()) {
166-
ImGui::Text("%s", "Search : ");
168+
void GraphListPane::DrawMenuBar() {
169+
bool change = false;
167170

168-
snprintf(m_search_buffer, 1024, "%s", search_string.c_str());
169-
if (ImGui::ContrastedButton("R##GraphListPane_SearchDrawTree")) {
170-
search_string.clear();
171-
m_search_buffer[0] = '\0';
172-
PrepareLog(search_string);
171+
if (ImGui::BeginMenu("Settings")) {
172+
if (ImGui::MenuItem("Show variable signals only", nullptr, &ProjectFile::Instance()->m_ShowVariableSignalsInAllGraphView)) {
173+
ProjectFile::Instance()->SetProjectChange();
174+
change = true;
173175
}
174176

175-
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
176-
if (ImGui::InputText("##GraphListPane_Search", m_search_buffer, 1024)) {
177-
search_string = ez::str::toLower(m_search_buffer);
178-
PrepareLog(search_string);
179-
}
180-
ImGui::PopItemWidth();
177+
ImGui::EndMenu();
178+
}
179+
180+
ImGui::Text("%s", "Search : ");
181+
182+
auto& search_string = ProjectFile::Instance()->m_AllGraphSignalsSearchString;
183+
snprintf(m_search_buffer, 1024, "%s", search_string.c_str());
184+
185+
if (ImGui::ContrastedButton("R##GraphListPane_SearchDrawTree")) {
186+
ProjectFile::Instance()->SetProjectChange();
187+
search_string.clear();
188+
m_search_buffer[0] = '\0';
189+
change = true;
190+
}
181191

182-
ImGui::EndMenuBar();
192+
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
193+
if (ImGui::InputText("##GraphListPane_Search", m_search_buffer, 1024)) {
194+
ProjectFile::Instance()->SetProjectChange();
195+
search_string = ez::str::toLower(m_search_buffer);
196+
change = true;
183197
}
198+
ImGui::PopItemWidth();
199+
200+
if (change) {
201+
PrepareLog(search_string);
202+
}
203+
}
204+
205+
void GraphListPane::DrawTree() {
206+
auto& search_string = ProjectFile::Instance()->m_AllGraphSignalsSearchString;
184207

185208
static ImGuiTableFlags flags = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_RowBg | ImGuiTableFlags_Hideable | ImGuiTableFlags_ScrollY |
186209
ImGuiTableFlags_NoHostExtendY | ImGuiTableFlags_Resizable;
@@ -232,7 +255,9 @@ void GraphListPane::PrepareLog(const std::string& vSearchString) {
232255
if (is_their_some_search && signal_ptr->low_case_name_for_search.find(vSearchString) == std::string::npos) {
233256
continue;
234257
}
235-
258+
if (ProjectFile::Instance()->m_ShowVariableSignalsInAllGraphView && signal_ptr->isConstant()) {
259+
continue;
260+
}
236261
m_FilteredSignalSeries.push_back(item_name);
237262
}
238263
}

src/panes/GraphListPane.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class GraphListPane : public AbstractPane {
5353

5454
private:
5555
void DisplayItem(const int& vIdx, const SignalSerieWeak& vDatasSerie);
56+
void DrawMenuBar();
5657
void DrawTree();
5758
void PrepareLog(const std::string& vSearchString);
5859
void HideAllGraphs();

src/project/ProjectFile.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ ez::xml::Nodes ProjectFile::getXmlNodes(const std::string& /*vUserDatas*/) {
276276
node.addChild("default_curve_display_thickness").setContent(m_DefaultCurveDisplayThickNess);
277277
node.addChild("use_predefined_zero_value").setContent(m_UsePredefinedZeroValue);
278278
node.addChild("predefined_zero_value").setContent(m_PredefinedZeroValue);
279+
node.addChild("show_variable_signals_in_all_graph_view").setContent(m_ShowVariableSignalsInAllGraphView);
280+
node.addChild("show_variable_signals_in_graph_view").setContent(m_ShowVariableSignalsInGraphView);
279281
node.addChild("last_log_file_path").setContent(m_LastLogFilePath);
280282
node.addChild("script_file").setContent(m_ScriptFilePathName);
281283
auto& childNode = node.addChild("log_files");
@@ -341,6 +343,10 @@ bool ProjectFile::setFromXmlNodes(const ez::xml::Node& vNode, const ez::xml::Nod
341343
m_UsePredefinedZeroValue = ez::ivariant(strValue).GetB();
342344
} else if (strName == "predefined_zero_value") {
343345
m_PredefinedZeroValue = ez::dvariant(strValue).GetD();
346+
} else if (strName == "show_variable_signals_in_all_graph_view") {
347+
m_ShowVariableSignalsInAllGraphView = ez::dvariant(strValue).GetB();
348+
} else if (strName == "show_variable_signals_in_graph_view") {
349+
m_ShowVariableSignalsInGraphView = ez::dvariant(strValue).GetB();
344350
} else if (strName == "last_log_file_path") {
345351
m_LastLogFilePath = strValue;
346352
} else if (strName == "script_file") {

src/project/ProjectFile.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ class ProjectFile : public Ltg::IProject, public ez::xml::Config {
5959
SourceFileName m_ScriptFileName;
6060
std::vector<std::pair<SourceFileName, SourceFilePathName>> m_SourceFilePathNames;
6161
Ltg::ScriptingModuleName m_ScriptingModuleName;
62+
bool m_ShowVariableSignalsInAllGraphView = false;
63+
bool m_ShowVariableSignalsInGraphView = false;
6264

6365
private: // dont save
6466
bool m_IsLoaded = false;

0 commit comments

Comments
 (0)