Skip to content

Commit

Permalink
cant shwo variable only for log, log 2nd, and hovered list
Browse files Browse the repository at this point in the history
all view have compact settings in menubar now
  • Loading branch information
aiekick committed Nov 30, 2024
1 parent 569fe60 commit 901fb8f
Show file tree
Hide file tree
Showing 15 changed files with 173 additions and 121 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/ImGuiPack
2 changes: 1 addition & 1 deletion 3rdparty/ezlibs
4 changes: 2 additions & 2 deletions plugins/LuaScripting/src/Headers/LuaScriptingBuild.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#define LuaScripting_Prefix "LuaScripting"
#define LuaScripting_BuildNumber 70
#define LuaScripting_BuildNumber 71
#define LuaScripting_MinorNumber 0
#define LuaScripting_MajorNumber 0
#define LuaScripting_BuildId "0.0.70"
#define LuaScripting_BuildId "0.0.71"
13 changes: 1 addition & 12 deletions src/headers/CustomImGuiConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,4 @@ namespace ImGui

#include <ezlibs/ezTools.hpp>
#include <ezlibs/ezXmlConfig.hpp>

#ifndef IM_VEC2_CLASS_EXTRA
#define IM_VEC2_CLASS_EXTRA \
ImVec2(const ez::fvec2& v) : x(v.x), y(v.y) {} \
ImVec2(const ez::dvec2& v) : x(static_cast<float>(v.x)), y(static_cast<float>(v.y)) {}
#endif

#ifndef IM_VEC4_CLASS_EXTRA
#define IM_VEC4_CLASS_EXTRA \
ImVec4(const ez::fvec4& v) : x(v.x), y(v.y), z(v.z), w(v.w) {} \
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)) {}
#endif
#include <ezlibs/ezImGui.hpp>
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 1056
#define LogToGraph_BuildNumber 1061
#define LogToGraph_MinorNumber 2
#define LogToGraph_MajorNumber 0
#define LogToGraph_BuildId "0.2.1056"
#define LogToGraph_BuildId "0.2.1061"
35 changes: 12 additions & 23 deletions src/models/log/LogEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,45 +389,34 @@ SignalSeriesContainerRef LogEngine::GetSignalSeries() {

void LogEngine::SetHoveredTime(const SignalEpochTime& vHoveredTime) {
m_HoveredTime = vHoveredTime;

ProjectFile::Instance()->SetProjectChange();

if (m_PreviewTicks.empty()) {
m_PreviewTicks.resize(m_SignalsCount);
}

size_t idx = 0U;
m_PreviewTicks.clear();
m_PreviewTicks.reserve(m_SignalsCount);
size_t visible_idx = 0U;
for (auto& item_cat : m_SignalSeries) {
for (auto& item_name : item_cat.second) {
if (item_name.second) {
if (ProjectFile::Instance()->m_ShowVariableSignalsInHoveredListView && item_name.second->isConstant()) {
continue;
}
SignalTickPtr last_ptr = nullptr;
for (const auto& tick_weak : item_name.second->datas_values) {
auto ptr = tick_weak.lock();
if (last_ptr && vHoveredTime >= last_ptr->time_epoch && ptr && vHoveredTime <= ptr->time_epoch) {
if (idx < (size_t)m_SignalsCount) {
m_PreviewTicks[idx] = last_ptr;

if (ProjectFile::Instance()->m_AutoColorize) {
auto parent_ptr = last_ptr->parent.lock();
if (parent_ptr && parent_ptr->show) {
parent_ptr->color_u32 = ImGui::GetColorU32(GraphView::GetRainBow((int32_t)visible_idx, m_VisibleCount));
parent_ptr->color_v4 = ImGui::ColorConvertU32ToFloat4(parent_ptr->color_u32);
m_PreviewTicks.push_back(last_ptr);
if (ProjectFile::Instance()->m_AutoColorize) {
auto parent_ptr = last_ptr->parent.lock();
if (parent_ptr && parent_ptr->show) {
parent_ptr->color_u32 = ImGui::GetColorU32(GraphView::GetRainBow((int32_t)visible_idx, m_VisibleCount));
parent_ptr->color_v4 = ImGui::ColorConvertU32ToFloat4(parent_ptr->color_u32);

++visible_idx;
}
++visible_idx;
}
} else {
EZ_TOOLS_DEBUG_BREAK;
}

break;
}

last_ptr = ptr;
}

++idx;
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/panes/GraphPane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ bool GraphPane::DrawPanes(const uint32_t& /*vCurrentFrame*/, bool* vOpened, ImGu
if (ProjectFile::Instance()->IsProjectLoaded()) {
if (ImGui::BeginMenuBar()) {
GraphView::Instance()->DrawMenuBar();

ImGui::EndMenuBar();
}

Expand Down
77 changes: 49 additions & 28 deletions src/panes/LogPane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ bool LogPane::DrawPanes(const uint32_t& /*vCurrentFrame*/, bool* vOpened, ImGuiC
flags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_MenuBar;
#endif
if (ProjectFile::Instance()->IsProjectLoaded()) {
if (ImGui::BeginMenuBar()) {
DrawMenuBar();
ImGui::EndMenuBar();
}
DrawTable();
}
}
Expand Down Expand Up @@ -101,38 +105,48 @@ void LogPane::CheckItem(SignalTickPtr vSignalTick) {
}
}

void LogPane::DrawTable() {
if (ImGui::BeginMenuBar()) {
bool need_update = ImGui::Checkbox("Collapse Selection", &ProjectFile::Instance()->m_CollapseLogSelection);
need_update |= ImGui::Checkbox("Hide some values", &ProjectFile::Instance()->m_HideSomeValues);

if (ProjectFile::Instance()->m_HideSomeValues) {
ImGui::Text("(?)");
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("%s", "you can define many values, ex : 1,2,3.2,5.8");
}

if (ImGui::ContrastedButton("R##ResetLogPaneTable")) {
ProjectFile::Instance()->m_ValuesToHide.clear();
need_update = true;
}
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());
need_update = true;
}
if (ImGui::MenuItem("Collapse Selection", nullptr, &ProjectFile::Instance()->m_CollapseLogSelection)) {
need_update = true;
}
if (ImGui::MenuItem("Hide some values", nullptr, &ProjectFile::Instance()->m_HideSomeLogValues)) {
need_update = true;
}
ImGui::EndMenu();
}

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

if (need_update) {
PrepareLog();
if (ImGui::ContrastedButton("R##ResetLogPaneTable")) {
ProjectFile::Instance()->m_LogValuesToHide.clear();
need_update = true;
}

ProjectFile::Instance()->SetProjectChange();
static char _values_hide_buffer[1024 + 1] = "";
snprintf(_values_hide_buffer, 1024, "%s", ProjectFile::Instance()->m_LogValuesToHide.c_str());
if (ImGui::InputText("##Valuestohide", _values_hide_buffer, 1024)) {
need_update = true;
ProjectFile::Instance()->m_LogValuesToHide = _values_hide_buffer;
}
}

ImGui::EndMenuBar();
if (need_update) {
PrepareLog();
ProjectFile::Instance()->SetProjectChange();
}
}

void LogPane::DrawTable() {

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

m_LogDatas.clear();

if (ProjectFile::Instance()->m_HideSomeValues) {
if (ProjectFile::Instance()->m_HideSomeLogValues) {
m_ValuesToHide.clear();
auto arr = ez::str::splitStringToVector(ProjectFile::Instance()->m_ValuesToHide, ",");
auto arr = ez::str::splitStringToVector(ProjectFile::Instance()->m_LogValuesToHide, ",");
for (const auto& a : arr) {
m_ValuesToHide.push_back(ez::dvariant(a).GetD());
}
Expand All @@ -267,11 +281,18 @@ void LogPane::PrepareLog() {
for (size_t idx = 0U; idx < _count_logs; ++idx) {
const auto& infos_ptr = LogEngine::Instance()->GetSignalTicks().at(idx);
if (infos_ptr) {
auto parent_ptr = infos_ptr->parent.lock();
if (parent_ptr != nullptr) {
if (ProjectFile::Instance()->m_ShowVariableSignalsInLogView && parent_ptr->isConstant()) {
continue;
}
}

auto selected = LogEngine::Instance()->isSignalShown(infos_ptr->category, infos_ptr->name);
if (_collapseSelection && !selected)
continue;

if (ProjectFile::Instance()->m_HideSomeValues) {
if (ProjectFile::Instance()->m_HideSomeLogValues) {
bool found = false;

for (const auto& a : m_ValuesToHide) {
Expand Down
7 changes: 4 additions & 3 deletions src/panes/LogPane.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ class LogPane : public AbstractPane {
void CheckItem(SignalTickPtr vSignalTick);
void PrepareLog();

private:
void DrawMenuBar();
void DrawTable();

public: // singleton
static std::shared_ptr<LogPane> Instance() {
static auto _instance = std::make_shared<LogPane>();
Expand All @@ -52,7 +56,4 @@ class LogPane : public AbstractPane {
LogPane(const LogPane&) = delete; // Prevent construction by copying
LogPane& operator=(const LogPane&) { return *this; }; // Prevent assignment
virtual ~LogPane() = default; // Prevent unwanted destruction};

private:
void DrawTable();
};
78 changes: 49 additions & 29 deletions src/panes/LogPaneSecondView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ bool LogPaneSecondView::DrawPanes(const uint32_t& /*vCurrentFrame*/, bool* vOpen
flags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_MenuBar;
#endif
if (ProjectFile::Instance()->IsProjectLoaded()) {
if (ImGui::BeginMenuBar()) {
DrawMenuBar();
ImGui::EndMenuBar();
}
DrawTable();
}
}
Expand Down Expand Up @@ -98,39 +102,48 @@ void LogPaneSecondView::CheckItem(const SignalTickPtr& vSignalTick) {
}
}

void LogPaneSecondView::DrawTable() {
if (ImGui::BeginMenuBar()) {
bool need_update = ImGui::Checkbox("Collapse Selection", &ProjectFile::Instance()->m_CollapseLogSelection);
need_update |= ImGui::Checkbox("Hide some values", &ProjectFile::Instance()->m_HideSomeValues);

if (ProjectFile::Instance()->m_HideSomeValues) {
ImGui::Text("(?)");
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("%s", "you can define many values, ex : 1,2,3.2,5.8");
}

if (ImGui::ContrastedButton("R##ResetLogPaneSecondViewTable")) {
ProjectFile::Instance()->m_ValuesToHide.clear();
need_update = true;
}
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());
need_update = true;
}
if (ImGui::MenuItem("Collapse Selection", nullptr, &ProjectFile::Instance()->m_CollapseLog2ndSelection)) {
need_update = true;
}
if (ImGui::MenuItem("Hide some values", nullptr, &ProjectFile::Instance()->m_HideSomeLog2ndValues)) {
need_update = true;
}
ImGui::EndMenu();
}

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

if (need_update) {
PrepareLog();
if (ImGui::ContrastedButton("R##ResetLogPaneTable")) {
ProjectFile::Instance()->m_Log2ndValuesToHide.clear();
need_update = true;
}

ProjectFile::Instance()->SetProjectChange();
static char _values_hide_buffer[1024 + 1] = "";
snprintf(_values_hide_buffer, 1024, "%s", ProjectFile::Instance()->m_Log2ndValuesToHide.c_str());
if (ImGui::InputText("##Valuestohide", _values_hide_buffer, 1024)) {
need_update = true;
ProjectFile::Instance()->m_Log2ndValuesToHide = _values_hide_buffer;
}
}

ImGui::EndMenuBar();
if (need_update) {
PrepareLog();
ProjectFile::Instance()->SetProjectChange();
}
}

void LogPaneSecondView::DrawTable() {
static ImGuiTableFlags flags = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_RowBg | ImGuiTableFlags_Hideable | ImGuiTableFlags_ScrollY |
ImGuiTableFlags_Resizable |
ImGuiTableFlags_NoHostExtendY;
Expand Down Expand Up @@ -250,25 +263,32 @@ void LogPaneSecondView::PrepareLog() {

m_LogDatas.clear();

if (ProjectFile::Instance()->m_HideSomeValues) {
if (ProjectFile::Instance()->m_HideSomeLog2ndValues) {
m_ValuesToHide.clear();
auto arr = ez::str::splitStringToVector(ProjectFile::Instance()->m_ValuesToHide, ",");
auto arr = ez::str::splitStringToVector(ProjectFile::Instance()->m_Log2ndValuesToHide, ",");
for (const auto& a : arr) {
m_ValuesToHide.push_back(ez::dvariant(a).GetD());
}
}

const auto _count_logs = LogEngine::Instance()->GetSignalTicks().size();
const auto _collapseSelection = ProjectFile::Instance()->m_CollapseLogSelection;
const auto _collapseSelection = ProjectFile::Instance()->m_CollapseLog2ndSelection;

for (size_t idx = 0U; idx < _count_logs; ++idx) {
const auto& infos_ptr = LogEngine::Instance()->GetSignalTicks().at(idx);
if (infos_ptr) {
auto parent_ptr = infos_ptr->parent.lock();
if (parent_ptr != nullptr) {
if (ProjectFile::Instance()->m_ShowVariableSignalsInLog2ndView && parent_ptr->isConstant()) {
continue;
}
}

auto selected = LogEngine::Instance()->isSignalShown(infos_ptr->category, infos_ptr->name);
if (_collapseSelection && !selected)
continue;

if (ProjectFile::Instance()->m_HideSomeValues) {
if (ProjectFile::Instance()->m_HideSomeLog2ndValues) {
bool found = false;

for (const auto& a : m_ValuesToHide) {
Expand Down
13 changes: 7 additions & 6 deletions src/panes/LogPaneSecondView.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,21 @@ class LogPaneSecondView : public AbstractPane {

void Clear();
void CheckItem(const SignalTickPtr& vSignalTick);
void PrepareLog();
void PrepareLog(); // Prevent unwanted destruction};

private:
void DrawMenuBar();
void DrawTable();

public: // singleton
static std::shared_ptr<LogPaneSecondView> Instance() {
static auto _instance = std::make_shared<LogPaneSecondView>();
return _instance;
}
}

public:
LogPaneSecondView() = default; // Prevent construction
LogPaneSecondView(const LogPaneSecondView&) = delete; // Prevent construction by copying
LogPaneSecondView& operator=(const LogPaneSecondView&) { return *this; }; // Prevent assignment
virtual ~LogPaneSecondView() = default; // Prevent unwanted destruction};

private:
void DrawTable();
virtual ~LogPaneSecondView() = default;
};
Loading

0 comments on commit 901fb8f

Please sign in to comment.