Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/imgui
diff options
context:
space:
mode:
authorYuSanka <yusanka@gmail.com>2020-03-31 23:46:12 +0300
committerYuSanka <yusanka@gmail.com>2020-04-01 10:07:33 +0300
commit042880ba2df913916b2cc77f7bb677e07bfd2c58 (patch)
treea7bdb3cb3e64d72a5075f76394ee89100787fdc7 /src/imgui
parentabad9133ebfd48a1e048203cf1a42379207e4890 (diff)
Search: Implemented highlighting of a letters from the search string
Diffstat (limited to 'src/imgui')
-rw-r--r--src/imgui/imconfig.h11
-rw-r--r--src/imgui/imgui_draw.cpp14
2 files changed, 22 insertions, 3 deletions
diff --git a/src/imgui/imconfig.h b/src/imgui/imconfig.h
index 09bfd16c9..26dccd5c3 100644
--- a/src/imgui/imconfig.h
+++ b/src/imgui/imconfig.h
@@ -97,9 +97,14 @@
//#define IMGUI_DEBUG_PARANOID
//---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files.
-/*
+
namespace ImGui
{
- void MyFunction(const char* name, const MyMatrix44& v);
+ // Special ASCII characters STX and ETX are used here as markup symbols for tokens to be highlighted.
+ const char ColorMarkerStart = 0x2; // STX
+ const char ColorMarkerEnd = 0x3; // ETX
+
+// void MyFunction(const char* name, const MyMatrix44& v);
+
}
-*/
+
diff --git a/src/imgui/imgui_draw.cpp b/src/imgui/imgui_draw.cpp
index 4bb91ccfe..bee1fdfa7 100644
--- a/src/imgui/imgui_draw.cpp
+++ b/src/imgui/imgui_draw.cpp
@@ -33,6 +33,7 @@ Index of this file:
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
#include "imgui_internal.h"
+#include "imconfig.h"
#include <stdio.h> // vsnprintf, sscanf, printf
#if !defined(alloca)
@@ -2991,6 +2992,8 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col
ImDrawIdx* idx_write = draw_list->_IdxWritePtr;
unsigned int vtx_current_idx = draw_list->_VtxCurrentIdx;
+ ImU32 defaultCol = col;
+
while (s < text_end)
{
if (word_wrap_enabled)
@@ -3019,6 +3022,17 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col
}
}
+ if (*s == ImGui::ColorMarkerStart) {
+ col = ImGui::GetColorU32(ImGuiCol_ButtonHovered);
+ s += 1;
+ }
+ else if (*s == ImGui::ColorMarkerEnd) {
+ col = defaultCol;
+ s += 1;
+ if (s == text_end)
+ break;
+ }
+
// Decode and advance source
unsigned int c = (unsigned int)*s;
if (c < 0x80)