Skip to content

Commit

Permalink
add a settings do enable/disbale auto resize columns in log and log 2…
Browse files Browse the repository at this point in the history
…nd views for #17
  • Loading branch information
aiekick committed Nov 30, 2024
1 parent 901fb8f commit f1a5270
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/headers/LogToGraphBuild.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#define LogToGraph_Prefix "LogToGraph"
#define LogToGraph_BuildNumber 1061
#define LogToGraph_BuildNumber 1063
#define LogToGraph_MinorNumber 2
#define LogToGraph_MajorNumber 0
#define LogToGraph_BuildId "0.2.1061"
#define LogToGraph_BuildId "0.2.1063"
17 changes: 11 additions & 6 deletions src/panes/LogPane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,14 @@ void LogPane::CheckItem(SignalTickPtr vSignalTick) {
void LogPane::DrawMenuBar() {
bool need_update = false;
if (ImGui::BeginMenu("Settings")) {
if (ImGui::MenuItem("Show variable signals only", nullptr, &ProjectFile::Instance()->m_ShowVariableSignalsInLogView)) {
LogEngine::Instance()->SetHoveredTime(LogEngine::Instance()->GetHoveredTime());
if (ImGui::MenuItem("Collapse Selection", nullptr, &ProjectFile::Instance()->m_CollapseLogSelection)) {
need_update = true;
}
if (ImGui::MenuItem("Collapse Selection", nullptr, &ProjectFile::Instance()->m_CollapseLogSelection)) {
if (ImGui::MenuItem("Auto resize columns", nullptr, &ProjectFile::Instance()->m_AutoResizeLogColumns)) {
need_update = true;
}
if (ImGui::MenuItem("Show variable signals only", nullptr, &ProjectFile::Instance()->m_ShowVariableSignalsInLogView)) {
LogEngine::Instance()->SetHoveredTime(LogEngine::Instance()->GetHoveredTime());
need_update = true;
}
if (ImGui::MenuItem("Hide some values", nullptr, &ProjectFile::Instance()->m_HideSomeLogValues)) {
Expand Down Expand Up @@ -147,11 +150,13 @@ void LogPane::DrawMenuBar() {
}

void LogPane::DrawTable() {

static ImGuiTableFlags flags = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_RowBg | ImGuiTableFlags_Hideable | ImGuiTableFlags_ScrollY |
ImGuiTableFlags_Resizable |
ImGuiTableFlags flags = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_RowBg | ImGuiTableFlags_Hideable | ImGuiTableFlags_ScrollY |
ImGuiTableFlags_NoHostExtendY;

if (!ProjectFile::Instance()->m_AutoResizeLogColumns) {
flags |= ImGuiTableFlags_Resizable;
}

// first display
if (m_LogDatas.empty()) {
PrepareLog();
Expand Down
16 changes: 11 additions & 5 deletions src/panes/LogPaneSecondView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,14 @@ void LogPaneSecondView::CheckItem(const SignalTickPtr& vSignalTick) {
void LogPaneSecondView::DrawMenuBar() {
bool need_update = false;
if (ImGui::BeginMenu("Settings")) {
if (ImGui::MenuItem("Show variable signals only", nullptr, &ProjectFile::Instance()->m_ShowVariableSignalsInLog2ndView)) {
LogEngine::Instance()->SetHoveredTime(LogEngine::Instance()->GetHoveredTime());
if (ImGui::MenuItem("Collapse Selection", nullptr, &ProjectFile::Instance()->m_CollapseLog2ndSelection)) {
need_update = true;
}
if (ImGui::MenuItem("Collapse Selection", nullptr, &ProjectFile::Instance()->m_CollapseLog2ndSelection)) {
if (ImGui::MenuItem("Auto resize columns", nullptr, &ProjectFile::Instance()->m_AutoResizeLog2ndColumns)) {
need_update = true;
}
if (ImGui::MenuItem("Show variable signals only", nullptr, &ProjectFile::Instance()->m_ShowVariableSignalsInLog2ndView)) {
LogEngine::Instance()->SetHoveredTime(LogEngine::Instance()->GetHoveredTime());
need_update = true;
}
if (ImGui::MenuItem("Hide some values", nullptr, &ProjectFile::Instance()->m_HideSomeLog2ndValues)) {
Expand Down Expand Up @@ -144,10 +147,13 @@ void LogPaneSecondView::DrawMenuBar() {
}

void LogPaneSecondView::DrawTable() {
static ImGuiTableFlags flags = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_RowBg | ImGuiTableFlags_Hideable | ImGuiTableFlags_ScrollY |
ImGuiTableFlags_Resizable |
ImGuiTableFlags flags = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_RowBg | ImGuiTableFlags_Hideable | ImGuiTableFlags_ScrollY |
ImGuiTableFlags_NoHostExtendY;

if (!ProjectFile::Instance()->m_AutoResizeLog2ndColumns) {
flags |= ImGuiTableFlags_Resizable;
}

// first display
if (m_LogDatas.empty()) {
PrepareLog();
Expand Down
10 changes: 8 additions & 2 deletions src/project/ProjectFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,9 @@ ez::xml::Nodes ProjectFile::getXmlNodes(const std::string& /*vUserDatas*/) {
node.addChild("show_variable_signals_in_graph_view").setContent(m_ShowVariableSignalsInGraphView);
node.addChild("show_variable_signals_in_hovered_list_view").setContent(m_ShowVariableSignalsInHoveredListView);
node.addChild("show_variable_signals_in_log_view").setContent(m_ShowVariableSignalsInLogView);
node.addChild("show_variable_signals_in_log2nd_view").setContent(m_ShowVariableSignalsInLog2ndView);
node.addChild("show_variable_signals_in_log_2nd_view").setContent(m_ShowVariableSignalsInLog2ndView);
node.addChild("auto_resize_columns_log_view").setContent(m_AutoResizeLogColumns);
node.addChild("auto_resize_columns_log_2nd_view").setContent(m_AutoResizeLog2ndColumns);
node.addChild("last_log_file_path").setContent(m_LastLogFilePath);
node.addChild("script_file").setContent(m_ScriptFilePathName);
auto& childNode = node.addChild("log_files");
Expand Down Expand Up @@ -356,8 +358,12 @@ bool ProjectFile::setFromXmlNodes(const ez::xml::Node& vNode, const ez::xml::Nod
m_ShowVariableSignalsInHoveredListView = ez::dvariant(strValue).GetB();
} else if (strName == "show_variable_signals_in_log_view") {
m_ShowVariableSignalsInLogView = ez::dvariant(strValue).GetB();
} else if (strName == "show_variable_signals_in_log2nd_view") {
} else if (strName == "show_variable_signals_in_log_2nd_view") {
m_ShowVariableSignalsInLog2ndView = ez::dvariant(strValue).GetB();
} else if (strName == "auto_resize_columns_log_view") {
m_AutoResizeLogColumns = ez::dvariant(strValue).GetB();
} else if (strName == "auto_resize_columns_log_2nd_view") {
m_AutoResizeLog2ndColumns = ez::dvariant(strValue).GetB();
} else if (strName == "last_log_file_path") {
m_LastLogFilePath = strValue;
} else if (strName == "script_file") {
Expand Down
2 changes: 2 additions & 0 deletions src/project/ProjectFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class ProjectFile : public Ltg::IProject, public ez::xml::Config {
bool m_ShowVariableSignalsInAllGraphView = false;
bool m_ShowVariableSignalsInGraphView = false;
bool m_ShowVariableSignalsInHoveredListView = false;
bool m_AutoResizeLogColumns = false;
bool m_AutoResizeLog2ndColumns = false;

private: // dont save
bool m_IsLoaded = false;
Expand Down

0 comments on commit f1a5270

Please sign in to comment.