diff --git a/src/headers/LogToGraphBuild.h b/src/headers/LogToGraphBuild.h index 9c97862..6249da4 100644 --- a/src/headers/LogToGraphBuild.h +++ b/src/headers/LogToGraphBuild.h @@ -1,7 +1,7 @@ #pragma once #define LogToGraph_Prefix "LogToGraph" -#define LogToGraph_BuildNumber 1046 +#define LogToGraph_BuildNumber 1051 #define LogToGraph_MinorNumber 2 #define LogToGraph_MajorNumber 0 -#define LogToGraph_BuildId "0.2.1046" +#define LogToGraph_BuildId "0.2.1051" diff --git a/src/models/graphs/GraphView.cpp b/src/models/graphs/GraphView.cpp index 182057a..f5e8f99 100644 --- a/src/models/graphs/GraphView.cpp +++ b/src/models/graphs/GraphView.cpp @@ -283,6 +283,10 @@ void GraphView::DrawMenuBar() { if (ImGui::BeginMenu("Settings")) { ImGui::MenuItem("Synchronize Graphs", nullptr, &ProjectFile::Instance()->m_SyncGraphs); + if (ImGui::MenuItem("Show variable signals only", nullptr, &ProjectFile::Instance()->m_ShowVariableSignalsInGraphView)) { + ProjectFile::Instance()->SetProjectChange(); + } + if (ImGui::BeginMenu("Axis Labels")) { if (ImGui::MenuItem(m_show_hide_x_axis ? "Show X Axis LabelsR##GraphPaneDrawPanes" : "Hide X Axis LabelsR##GraphPaneDrawPanes")) { m_show_hide_x_axis = !m_show_hide_x_axis; @@ -739,6 +743,9 @@ void GraphView::DrawAloneGraphs(const GraphGroupPtr& vGraphGroupPtr, const ImVec for (auto& name : cat.second) { auto datas_ptr = name.second.lock(); if (datas_ptr) { + if (ProjectFile::Instance()->m_ShowVariableSignalsInGraphView && datas_ptr->isConstant()) { + continue; + } prDrawSignalGraph_ImPlot(datas_ptr, vSize, vFirstGraph); vFirstGraph = false; @@ -786,6 +793,9 @@ void GraphView::DrawGroupedGraphs(const GraphGroupPtr& vGraphGroupPtr, const ImV for (auto& name : cat.second) { auto datas_ptr = name.second.lock(); if (datas_ptr && datas_ptr->show_hide_temporary) { + if (ProjectFile::Instance()->m_ShowVariableSignalsInGraphView && datas_ptr->isConstant()) { + continue; + } const auto& name_str = datas_ptr->category + " / " + datas_ptr->name; if (ImPlot::BeginItem(name_str.c_str())) { bool _is_zone_reached = false; diff --git a/src/models/log/SignalSerie.cpp b/src/models/log/SignalSerie.cpp index 7db394b..22d6b65 100644 --- a/src/models/log/SignalSerie.cpp +++ b/src/models/log/SignalSerie.cpp @@ -75,4 +75,8 @@ void SignalSerie::drawAnnotations() { void SignalSerie::finalize() { label = ez::str::toStr("%s (%u)", name.c_str(), static_cast(count_base_records)); -} \ No newline at end of file +} + +bool SignalSerie::isConstant() { + return ez::isEqual(range_value.x, range_value.y); +} diff --git a/src/models/log/SignalSerie.h b/src/models/log/SignalSerie.h index 5748d02..fa67bbb 100644 --- a/src/models/log/SignalSerie.h +++ b/src/models/log/SignalSerie.h @@ -22,6 +22,7 @@ limitations under the License. #include #include #include +#include class SignalSerie { public: @@ -58,5 +59,6 @@ class SignalSerie { void drawAnnotations(); + bool isConstant(); void finalize(); }; diff --git a/src/panes/GraphListPane.cpp b/src/panes/GraphListPane.cpp index ec2c225..b6ac9fb 100644 --- a/src/panes/GraphListPane.cpp +++ b/src/panes/GraphListPane.cpp @@ -60,6 +60,10 @@ bool GraphListPane::DrawPanes(const uint32_t& /*vCurrentFrame*/, bool* vOpened, flags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_MenuBar; #endif if (ProjectFile::Instance()->IsProjectLoaded()) { + if (ImGui::BeginMenuBar()) { + DrawMenuBar(); + ImGui::EndMenuBar(); + } DrawTree(); } } @@ -90,6 +94,7 @@ void GraphListPane::DisplayItem(const int& vIdx, const SignalSerieWeak& vDatasSe ImGui::PushID(vIdx); ImGui::TableSetColumnIndex(0); if (ImGui::Selectable(datas_ptr->category.c_str(), &datas_ptr->show, ImGuiSelectableFlags_SpanAllColumns, ImVec2(0, GRAPHS_HEIGHT))) { + ProjectFile::Instance()->SetProjectChange(); LogEngine::Instance()->ShowHideSignal(datas_ptr->category, datas_ptr->name, datas_ptr->show); if (ProjectFile::Instance()->m_CollapseLogSelection) { LogPane::Instance()->PrepareLog(); @@ -99,6 +104,7 @@ void GraphListPane::DisplayItem(const int& vIdx, const SignalSerieWeak& vDatasSe ImGui::TableSetColumnIndex(1); if (ImGui::Selectable(datas_ptr->name.c_str(), &datas_ptr->show, ImGuiSelectableFlags_SpanAllColumns, ImVec2(0, GRAPHS_HEIGHT))) { + ProjectFile::Instance()->SetProjectChange(); LogEngine::Instance()->ShowHideSignal(datas_ptr->category, datas_ptr->name, datas_ptr->show); if (ProjectFile::Instance()->m_CollapseLogSelection) { LogPane::Instance()->PrepareLog(); @@ -159,28 +165,45 @@ void GraphListPane::DisplayItem(const int& vIdx, const SignalSerieWeak& vDatasSe } } -void GraphListPane::DrawTree() { - auto& search_string = ProjectFile::Instance()->m_AllGraphSignalsSearchString; - - if (ImGui::BeginMenuBar()) { - ImGui::Text("%s", "Search : "); +void GraphListPane::DrawMenuBar() { + bool change = false; - snprintf(m_search_buffer, 1024, "%s", search_string.c_str()); - if (ImGui::ContrastedButton("R##GraphListPane_SearchDrawTree")) { - search_string.clear(); - m_search_buffer[0] = '\0'; - PrepareLog(search_string); + if (ImGui::BeginMenu("Settings")) { + if (ImGui::MenuItem("Show variable signals only", nullptr, &ProjectFile::Instance()->m_ShowVariableSignalsInAllGraphView)) { + ProjectFile::Instance()->SetProjectChange(); + change = true; } - ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::InputText("##GraphListPane_Search", m_search_buffer, 1024)) { - search_string = ez::str::toLower(m_search_buffer); - PrepareLog(search_string); - } - ImGui::PopItemWidth(); + ImGui::EndMenu(); + } + + ImGui::Text("%s", "Search : "); + + auto& search_string = ProjectFile::Instance()->m_AllGraphSignalsSearchString; + snprintf(m_search_buffer, 1024, "%s", search_string.c_str()); + + if (ImGui::ContrastedButton("R##GraphListPane_SearchDrawTree")) { + ProjectFile::Instance()->SetProjectChange(); + search_string.clear(); + m_search_buffer[0] = '\0'; + change = true; + } - ImGui::EndMenuBar(); + ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x); + if (ImGui::InputText("##GraphListPane_Search", m_search_buffer, 1024)) { + ProjectFile::Instance()->SetProjectChange(); + search_string = ez::str::toLower(m_search_buffer); + change = true; } + ImGui::PopItemWidth(); + + if (change) { + PrepareLog(search_string); + } +} + +void GraphListPane::DrawTree() { + auto& search_string = ProjectFile::Instance()->m_AllGraphSignalsSearchString; static ImGuiTableFlags flags = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_RowBg | ImGuiTableFlags_Hideable | ImGuiTableFlags_ScrollY | ImGuiTableFlags_NoHostExtendY | ImGuiTableFlags_Resizable; @@ -232,7 +255,9 @@ void GraphListPane::PrepareLog(const std::string& vSearchString) { if (is_their_some_search && signal_ptr->low_case_name_for_search.find(vSearchString) == std::string::npos) { continue; } - + if (ProjectFile::Instance()->m_ShowVariableSignalsInAllGraphView && signal_ptr->isConstant()) { + continue; + } m_FilteredSignalSeries.push_back(item_name); } } diff --git a/src/panes/GraphListPane.h b/src/panes/GraphListPane.h index 40f1eeb..6642c68 100644 --- a/src/panes/GraphListPane.h +++ b/src/panes/GraphListPane.h @@ -53,6 +53,7 @@ class GraphListPane : public AbstractPane { private: void DisplayItem(const int& vIdx, const SignalSerieWeak& vDatasSerie); + void DrawMenuBar(); void DrawTree(); void PrepareLog(const std::string& vSearchString); void HideAllGraphs(); diff --git a/src/project/ProjectFile.cpp b/src/project/ProjectFile.cpp index 1179a2c..b30f6e6 100644 --- a/src/project/ProjectFile.cpp +++ b/src/project/ProjectFile.cpp @@ -276,6 +276,8 @@ ez::xml::Nodes ProjectFile::getXmlNodes(const std::string& /*vUserDatas*/) { node.addChild("default_curve_display_thickness").setContent(m_DefaultCurveDisplayThickNess); node.addChild("use_predefined_zero_value").setContent(m_UsePredefinedZeroValue); node.addChild("predefined_zero_value").setContent(m_PredefinedZeroValue); + node.addChild("show_variable_signals_in_all_graph_view").setContent(m_ShowVariableSignalsInAllGraphView); + node.addChild("show_variable_signals_in_graph_view").setContent(m_ShowVariableSignalsInGraphView); node.addChild("last_log_file_path").setContent(m_LastLogFilePath); node.addChild("script_file").setContent(m_ScriptFilePathName); auto& childNode = node.addChild("log_files"); @@ -341,6 +343,10 @@ bool ProjectFile::setFromXmlNodes(const ez::xml::Node& vNode, const ez::xml::Nod m_UsePredefinedZeroValue = ez::ivariant(strValue).GetB(); } else if (strName == "predefined_zero_value") { m_PredefinedZeroValue = ez::dvariant(strValue).GetD(); + } else if (strName == "show_variable_signals_in_all_graph_view") { + m_ShowVariableSignalsInAllGraphView = ez::dvariant(strValue).GetB(); + } else if (strName == "show_variable_signals_in_graph_view") { + m_ShowVariableSignalsInGraphView = ez::dvariant(strValue).GetB(); } else if (strName == "last_log_file_path") { m_LastLogFilePath = strValue; } else if (strName == "script_file") { diff --git a/src/project/ProjectFile.h b/src/project/ProjectFile.h index 6b2be5c..5d8fe69 100644 --- a/src/project/ProjectFile.h +++ b/src/project/ProjectFile.h @@ -59,6 +59,8 @@ class ProjectFile : public Ltg::IProject, public ez::xml::Config { SourceFileName m_ScriptFileName; std::vector> m_SourceFilePathNames; Ltg::ScriptingModuleName m_ScriptingModuleName; + bool m_ShowVariableSignalsInAllGraphView = false; + bool m_ShowVariableSignalsInGraphView = false; private: // dont save bool m_IsLoaded = false;