Skip to content

Commit 4c847ee

Browse files
committed
-
1 parent f12fcc0 commit 4c847ee

File tree

10 files changed

+50
-39
lines changed

10 files changed

+50
-39
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 332
4+
#define LuaScripting_BuildNumber 334
55
#define LuaScripting_MinorNumber 1
66
#define LuaScripting_MajorNumber 0
7-
#define LuaScripting_BuildId "0.1.332"
7+
#define LuaScripting_BuildId "0.1.334"

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 3618
4+
#define LogToGraph_BuildNumber 3627
55
#define LogToGraph_MinorNumber 3
66
#define LogToGraph_MajorNumber 0
7-
#define LogToGraph_BuildId "0.3.3618"
7+
#define LogToGraph_BuildId "0.3.3627"

src/models/graphs/GraphView.cpp

+6-17
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,15 @@ limitations under the License.
3333
#include <models/graphs/GraphAnnotation.h>
3434
#include <models/graphs/GraphAnnotationModel.h>
3535

36+
#include <ezlibs/ezTools.hpp>
37+
3638
#define DRAG_LINE_LOG_HOVERED_TIME 0
3739
#define DRAG_LINE_FIRST_DIFF_MARK 1
3840
#define DRAG_LINE_SECOND_DIFF_MARK 2
3941
#define DRAG_LINE_MOUSE_HOVERED_TIME 2
4042

4143
static GraphColor s_DefaultGraphColors;
4244

43-
// todo : to put in a common file
44-
// https://www.shadertoy.com/view/ld3fzf
45-
ez::fvec4 GraphView::GetRainBow(const int32_t& vIdx, const int32_t& vCount) {
46-
float r = (float)(vIdx + 1U) / (float)vCount;
47-
auto c = ez::cos(ez::fvec4(0.0f, 23.0f, 21.0f, 1.0f) + r * 6.3f) * 0.5f + 0.5f;
48-
c.w = 0.75f;
49-
return c;
50-
}
51-
5245
GraphView::GraphView() {
5346
Clear();
5447
}
@@ -125,11 +118,10 @@ void GraphView::RemoveEmptyGroups() {
125118
// first pass : we will save the group id of empty groups
126119
size_t idx = 0U;
127120
for (const auto& group_ptr : m_GraphGroups) {
128-
if (group_ptr && // valid group ptr
121+
if (group_ptr && // valid group ptr
129122
group_ptr != m_GraphGroups.front() && // not the first group (must always be selectable, so we keep it)
130-
group_ptr != m_GraphGroups.back() && // not the last group (must always be selectable, so we keep it)
131-
group_ptr->GetSignalSeries().empty()) // no signals series
132-
{
123+
group_ptr != m_GraphGroups.back() && // not the last group (must always be selectable, so we keep it)
124+
group_ptr->GetSignalSeries().empty()) { // no signals series
133125
// we insert in front
134126
// like that we will erase in inverse order
135127
// because if we delete e index 1 before a 2
@@ -162,10 +154,8 @@ size_t GraphView::GetGroupID(const GraphGroupPtr& vToGroupPtr) const {
162154
if (group_ptr == vToGroupPtr) {
163155
break;
164156
}
165-
166157
++idx;
167158
}
168-
169159
return idx;
170160
}
171161

@@ -176,7 +166,6 @@ GraphGroupsRef GraphView::GetGraphGroups() {
176166
void GraphView::DrawGraphGroupTable() {
177167
if (ImGui::BeginMenuBar()) {
178168
ImGui::MenuItem("ReColorize (Rainbow)", nullptr, &ProjectFile::Instance()->m_AutoColorize);
179-
180169
ImGui::EndMenuBar();
181170
}
182171

@@ -210,7 +199,7 @@ void GraphView::DrawGraphGroupTable() {
210199
if (datas_ptr) {
211200
if (datas_ptr->show) {
212201
if (ProjectFile::Instance()->m_AutoColorize) {
213-
datas_ptr->color_u32 = ImGui::GetColorU32(GetRainBow(visible_idx, visible_count));
202+
datas_ptr->color_u32 = ImGui::GetColorU32(ez::getRainBowColor(visible_idx, visible_count));
214203
datas_ptr->color_v4 = ImGui::ColorConvertU32ToFloat4(datas_ptr->color_u32);
215204
}
216205

src/models/graphs/GraphView.h

-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ limitations under the License.
2424
#include <headers/DatasDef.h>
2525

2626
class GraphView {
27-
public:
28-
// https://www.shadertoy.com/view/ld3fzf
29-
static ez::fvec4 GetRainBow(const int32_t& vIdx, const int32_t& vCount);
30-
3127
private:
3228
GraphGroups m_GraphGroups;
3329
SignalValueRange m_Range_Value = SignalValueRange(0.5, -0.5) * DBL_MAX;

src/models/log/LogEngine.cpp

+10-3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ limitations under the License.
3434

3535
#include <project/ProjectFile.h>
3636

37+
#include <ezlibs/ezTools.hpp>
38+
3739
///////////////////////////////////////////////////
3840
/// STATIC'S //////////////////////////////////////
3941
///////////////////////////////////////////////////
@@ -319,6 +321,7 @@ void LogEngine::ShowHideSignal(const SignalCategory& vCategory, const SignalName
319321

320322
ProjectFile::Instance()->SetProjectChange();
321323
GraphView::Instance()->ComputeGraphsCount();
324+
UpdateVisibleSignalsColoring();
322325
}
323326
}
324327
}
@@ -342,6 +345,7 @@ void LogEngine::ShowHideSignal(const SignalCategory& vCategory, const SignalName
342345

343346
ProjectFile::Instance()->SetProjectChange();
344347
GraphView::Instance()->ComputeGraphsCount();
348+
UpdateVisibleSignalsColoring();
345349
}
346350
}
347351
}
@@ -367,6 +371,10 @@ bool LogEngine::isSignalShown(const SignalCategory& vCategory, const SignalName&
367371
return res;
368372
}
369373

374+
bool LogEngine::isSomeSelection() const {
375+
return (m_VisibleCount > 0);
376+
}
377+
370378
SourceFilesContainerRef LogEngine::GetSourceFiles() {
371379
return m_SourceFiles;
372380
}
@@ -409,7 +417,7 @@ void LogEngine::SetHoveredTime(const SignalEpochTime& vHoveredTime, const bool v
409417
if (ProjectFile::Instance()->m_AutoColorize) {
410418
auto parent_ptr = last_ptr->parent.lock();
411419
if (parent_ptr && parent_ptr->show) {
412-
parent_ptr->color_u32 = ImGui::GetColorU32(GraphView::GetRainBow((int32_t)visible_idx, m_VisibleCount));
420+
parent_ptr->color_u32 = ImGui::GetColorU32(ez::getRainBowColor((int32_t)visible_idx, m_VisibleCount));
413421
parent_ptr->color_v4 = ImGui::ColorConvertU32ToFloat4(parent_ptr->color_u32);
414422

415423
++visible_idx;
@@ -447,9 +455,8 @@ void LogEngine::UpdateVisibleSignalsColoring() {
447455
if (last_ptr) {
448456
auto parent_ptr = last_ptr->parent.lock();
449457
if (parent_ptr && parent_ptr->show) {
450-
parent_ptr->color_u32 = ImGui::GetColorU32(GraphView::GetRainBow((int32_t)visible_idx, m_VisibleCount));
458+
parent_ptr->color_u32 = ImGui::GetColorU32(ez::getRainBowColor((int32_t)visible_idx, m_VisibleCount));
451459
parent_ptr->color_v4 = ImGui::ColorConvertU32ToFloat4(parent_ptr->color_u32);
452-
453460
++visible_idx;
454461
}
455462
}

src/models/log/LogEngine.h

+1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ class LogEngine : public ez::xml::Config {
9999
void ShowHideSignal(const SignalCategory& vCategory, const SignalName& vName);
100100
void ShowHideSignal(const SignalCategory& vCategory, const SignalName& vName, const bool vFlag);
101101
bool isSignalShown(const SignalCategory& vCategory, const SignalName& vName, SignalColor* vOutColorPtr = nullptr);
102+
bool isSomeSelection() const;
102103

103104
SourceFilesContainerRef GetSourceFiles();
104105
SignalValueRangeConstRef GetTicksTimeSerieRange() const;

src/panes/LogPane.cpp

+12-7
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,18 @@ void LogPane::DrawMenuBar() {
122122
ImGui::EndMenu();
123123
}
124124

125-
if (!ProjectFile::Instance()->m_CollapseLogSelection) {
126-
if (ImGui::MenuItem("<<")) {
127-
m_backSelectionNeeded = true;
128-
}
129-
130-
if (ImGui::MenuItem(">>")) {
131-
m_nextSelectionNeeded = true;
125+
if (LogEngine::Instance()->isSomeSelection()) {
126+
if (!ProjectFile::Instance()->m_CollapseLogSelection) {
127+
if (m_LogListClipper.DisplayStart > 0) {
128+
if (ImGui::MenuItem(ICON_FONT_ARROW_UP_THICK)) {
129+
m_backSelectionNeeded = true;
130+
}
131+
}
132+
if (m_LogListClipper.DisplayEnd < (static_cast<int32_t>(m_LogDatas.size()) - 1)) {
133+
if (ImGui::MenuItem(ICON_FONT_ARROW_DOWN_THICK)) {
134+
m_nextSelectionNeeded = true;
135+
}
136+
}
132137
}
133138
}
134139

src/panes/LogPaneSecondView.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,21 @@ void LogPaneSecondView::DrawMenuBar() {
121121
ImGui::EndMenu();
122122
}
123123

124+
if (LogEngine::Instance()->isSomeSelection()) {
125+
if (!ProjectFile::Instance()->m_CollapseLogSelection) {
126+
if (m_LogListClipper.DisplayStart > 0) {
127+
if (ImGui::MenuItem(ICON_FONT_ARROW_UP_THICK)) {
128+
m_backSelectionNeeded = true;
129+
}
130+
}
131+
if (m_LogListClipper.DisplayEnd < (static_cast<int32_t>(m_LogDatas.size()) - 1)) {
132+
if (ImGui::MenuItem(ICON_FONT_ARROW_DOWN_THICK)) {
133+
m_nextSelectionNeeded = true;
134+
}
135+
}
136+
}
137+
}
138+
124139
if (ProjectFile::Instance()->m_HideSomeLog2ndValues) {
125140
ImGui::Text("(?)");
126141
if (ImGui::IsItemHovered()) {

src/panes/SignalsPreview.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,11 @@ void SignalsPreview::SetHoveredTime(const SignalEpochTime& vHoveredTime) {
8686
if (last_ptr && vHoveredTime >= last_ptr->time_epoch && ptr && vHoveredTime <= ptr->time_epoch) {
8787
if (idx < count_signals) {
8888
m_PreviewTicks[idx] = last_ptr;
89-
9089
if (ProjectFile::Instance()->m_AutoColorize) {
9190
auto parent_ptr = last_ptr->parent.lock();
9291
if (parent_ptr && parent_ptr->show) {
93-
parent_ptr->color_u32 = ImGui::GetColorU32(GraphView::GetRainBow((int32_t)visible_idx, (int32_t)visible_count));
92+
parent_ptr->color_u32 = ImGui::GetColorU32(ez::getRainBowColor((int32_t)visible_idx, (int32_t)visible_count));
9493
parent_ptr->color_v4 = ImGui::ColorConvertU32ToFloat4(parent_ptr->color_u32);
95-
9694
++visible_idx;
9795
}
9896
}

0 commit comments

Comments
 (0)