mirror of
https://github.com/ocornut/imgui.git
synced 2025-09-05 19:08:19 +00:00
Compare commits
5 Commits
9e864012ae
...
87c1ab7988
Author | SHA1 | Date | |
---|---|---|---|
![]() |
87c1ab7988 | ||
![]() |
319c481abb | ||
![]() |
229d56e37a | ||
![]() |
7d230594de | ||
![]() |
75a4a48d1f |
@@ -50,6 +50,8 @@ Other Changes:
|
||||
pointer, which could to issue when deleting the cloned list. (#8894, #1860)
|
||||
- Debug Tools: ID Stack Tool: fixed using fixed-size buffers preventing long identifiers
|
||||
from being displayed in the tool. (#8905, #4631)
|
||||
- Debug Tools: ID Stack Tool: when ### is used, uncontributing prefix before the ###
|
||||
is now skipped. (#8904, #4631)
|
||||
- Debug Tools: ID Stack Tool: added option to hex-encode non-ASCII characters in
|
||||
output path. (#8904, #4631)
|
||||
- Examples: Android: Android+OpenGL3: update Gradle project (#8888, #8878) [@scribam]
|
||||
|
30
imgui.cpp
30
imgui.cpp
@@ -2387,6 +2387,17 @@ ImGuiID ImHashStr(const char* data_p, size_t data_size, ImGuiID seed)
|
||||
return ~crc;
|
||||
}
|
||||
|
||||
// Skip to the "###" marker if any. We don't skip past to match the behavior of GetID()
|
||||
// FIXME-OPT: This is not designed to be optimal. Use with care.
|
||||
const char* ImHashSkipUncontributingPrefix(const char* label)
|
||||
{
|
||||
const char* result = label;
|
||||
while (unsigned char c = *label++)
|
||||
if (c == '#' && label[0] == '#' && label[1] == '#')
|
||||
result = label - 1;
|
||||
return result;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] MISC HELPERS/UTILITIES (File functions)
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -7102,10 +7113,11 @@ void ImGui::RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& titl
|
||||
// Close button
|
||||
if (has_close_button)
|
||||
{
|
||||
ImGuiItemFlags backup_item_flags = g.CurrentItemFlags;
|
||||
g.CurrentItemFlags |= ImGuiItemFlags_NoFocus;
|
||||
if (CloseButton(window->GetID("#CLOSE"), close_button_pos))
|
||||
*p_open = false;
|
||||
g.CurrentItemFlags &= ~ImGuiItemFlags_NoFocus;
|
||||
g.CurrentItemFlags = backup_item_flags;
|
||||
}
|
||||
|
||||
window->DC.NavLayerCurrent = ImGuiNavLayer_Main;
|
||||
@@ -15259,13 +15271,9 @@ ImGuiWindowSettings* ImGui::CreateNewWindowSettings(const char* name)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
|
||||
// Preserve the full string when ConfigDebugVerboseIniSettings is set to make .ini inspection easier.
|
||||
if (g.IO.ConfigDebugIniSettings == false)
|
||||
{
|
||||
// Skip to the "###" marker if any. We don't skip past to match the behavior of GetID()
|
||||
// Preserve the full string when ConfigDebugVerboseIniSettings is set to make .ini inspection easier.
|
||||
if (const char* p = strstr(name, "###"))
|
||||
name = p;
|
||||
}
|
||||
name = ImHashSkipUncontributingPrefix(name);
|
||||
const size_t name_len = ImStrlen(name);
|
||||
|
||||
// Allocate chunk
|
||||
@@ -17153,7 +17161,7 @@ void ImGui::DebugNodeFontGlyph(ImFont* font, const ImFontGlyph* glyph)
|
||||
if (glyph->PackId >= 0)
|
||||
{
|
||||
ImTextureRect* r = ImFontAtlasPackGetRect(font->ContainerAtlas, glyph->PackId);
|
||||
Text("PackId: %d (%dx%d rect at %d,%d)", glyph->PackId, r->w, r->h, r->x, r->y);
|
||||
Text("PackId: 0x%X (%dx%d rect at %d,%d)", glyph->PackId, r->w, r->h, r->x, r->y);
|
||||
}
|
||||
Text("SourceIdx: %d", glyph->SourceIdx);
|
||||
}
|
||||
@@ -17726,14 +17734,14 @@ static int StackToolFormatLevelInfo(ImGuiIDStackTool* tool, int n, bool format_f
|
||||
ImGuiStackLevelInfo* info = &tool->Results[n];
|
||||
ImGuiWindow* window = (info->DescOffset == -1 && n == 0) ? ImGui::FindWindowByID(info->ID) : NULL;
|
||||
if (window) // Source: window name (because the root ID don't call GetID() and so doesn't get hooked)
|
||||
return ImFormatString(buf, buf_size, format_for_ui ? "\"%s\" [window]" : "%s", window->Name);
|
||||
return ImFormatString(buf, buf_size, format_for_ui ? "\"%s\" [window]" : "%s", ImHashSkipUncontributingPrefix(window->Name));
|
||||
if (info->QuerySuccess) // Source: GetID() hooks (prioritize over ItemInfo() because we frequently use patterns like: PushID(str), Button("") where they both have same id)
|
||||
return ImFormatString(buf, buf_size, (format_for_ui && info->DataType == ImGuiDataType_String) ? "\"%s\"" : "%s", &tool->ResultPathsBuf.Buf[info->DescOffset]);
|
||||
return ImFormatString(buf, buf_size, (format_for_ui && info->DataType == ImGuiDataType_String) ? "\"%s\"" : "%s", ImHashSkipUncontributingPrefix(&tool->ResultPathsBuf.Buf[info->DescOffset]));
|
||||
if (tool->StackLevel < tool->Results.Size) // Only start using fallback below when all queries are done, so during queries we don't flickering ??? markers.
|
||||
return (*buf = 0);
|
||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||||
if (const char* label = ImGuiTestEngine_FindItemDebugLabel(GImGui, info->ID)) // Source: ImGuiTestEngine's ItemInfo()
|
||||
return ImFormatString(buf, buf_size, format_for_ui ? "??? \"%s\"" : "%s", label);
|
||||
return ImFormatString(buf, buf_size, format_for_ui ? "??? \"%s\"" : "%s", ImHashSkipUncontributingPrefix(label));
|
||||
#endif
|
||||
return ImFormatString(buf, buf_size, "???");
|
||||
}
|
||||
|
@@ -3116,9 +3116,7 @@ ImFont* ImFontAtlas::AddFontDefault(const ImFontConfig* font_cfg_template)
|
||||
|
||||
int ttf_compressed_size = 0;
|
||||
const char* ttf_compressed = GetDefaultCompressedFontDataTTF(&ttf_compressed_size);
|
||||
const ImWchar* glyph_ranges = font_cfg.GlyphRanges != NULL ? font_cfg.GlyphRanges : GetGlyphRangesDefault();
|
||||
ImFont* font = AddFontFromMemoryCompressedTTF(ttf_compressed, ttf_compressed_size, font_cfg.SizePixels, &font_cfg, glyph_ranges);
|
||||
return font;
|
||||
return AddFontFromMemoryCompressedTTF(ttf_compressed, ttf_compressed_size, font_cfg.SizePixels, &font_cfg);
|
||||
#else
|
||||
IM_ASSERT(0 && "AddFontDefault() disabled in this build.");
|
||||
IM_UNUSED(font_cfg_template);
|
||||
|
@@ -367,6 +367,7 @@ extern IMGUI_API ImGuiContext* GImGui; // Current implicit context pointer
|
||||
// Helpers: Hashing
|
||||
IMGUI_API ImGuiID ImHashData(const void* data, size_t data_size, ImGuiID seed = 0);
|
||||
IMGUI_API ImGuiID ImHashStr(const char* data, size_t data_size = 0, ImGuiID seed = 0);
|
||||
IMGUI_API const char* ImHashSkipUncontributingPrefix(const char* label);
|
||||
|
||||
// Helpers: Sorting
|
||||
#ifndef ImQsort
|
||||
|
Reference in New Issue
Block a user