Committed our own changes in ImGUI, see commits

042880ba2d
67c55c7490
a94c952b40
b3f8ae5ca7
2455df4017
3ca3a544a8
870aba8d15
62c2095fe8

This should contain exactly the same changes.
This commit is contained in:
Lukas Matena 2021-07-15 10:24:11 +02:00
parent 63dfb8f5f2
commit 935675a35a
2 changed files with 49 additions and 3 deletions

View file

@ -113,9 +113,34 @@
//#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 character is used here as markup symbols for tokens to be highlighted as a for hovered item
const char ColorMarkerHovered = 0x1; // STX
// 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
// Special ASCII characters are used here as an ikons markers
const char PrintIconMarker = 0x4;
const char PrinterIconMarker = 0x5;
const char PrinterSlaIconMarker = 0x6;
const char FilamentIconMarker = 0x7;
const char MaterialIconMarker = 0x8;
const char CloseNotifButton = 0xB;
const char CloseNotifHoverButton = 0xC;
// const char TimerDotMarker = 0xE;
// const char TimerDotEmptyMarker = 0xF;
const char MinimalizeButton = 0xE;
const char MinimalizeHoverButton = 0xF;
const char WarningMarker = 0x10;
const char ErrorMarker = 0x11;
const char EjectButton = 0x12;
const char EjectHoverButton = 0x13;
const char CancelButton = 0x14;
const char CancelHoverButton = 0x15;
// void MyFunction(const char* name, const MyMatrix44& v);
}
*/

View file

@ -34,6 +34,8 @@ Index of this file:
#endif
#include "imgui_internal.h"
#include "imconfig.h"
#ifdef IMGUI_ENABLE_FREETYPE
#include "misc/freetype/imgui_freetype.h"
#endif
@ -3564,6 +3566,14 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col
const ImU32 col_untinted = col | ~IM_COL32_A_MASK;
ImU32 defaultCol = col;
ImU32 highlighCol = ImGui::GetColorU32(ImGuiCol_ButtonHovered);
// if text is started with ColorMarkerHovered symbol, we should use another color for a highlighting
if (*s == ImGui::ColorMarkerHovered) {
highlighCol = ImGui::GetColorU32(ImGuiCol_FrameBg);
s += 1;
}
while (s < text_end)
{
if (word_wrap_enabled)
@ -3592,6 +3602,17 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col
}
}
if (*s == ImGui::ColorMarkerStart) {
col = highlighCol;
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)