|
@@ -15637,25 +15637,7 @@ void ImGui::ShowDebugLogWindow(bool* p_open)
|
|
|
clipper.Begin(g.DebugLogIndex.size());
|
|
|
while (clipper.Step())
|
|
|
for (int line_no = clipper.DisplayStart; line_no < clipper.DisplayEnd; line_no++)
|
|
|
- {
|
|
|
- const char* line_begin = g.DebugLogIndex.get_line_begin(g.DebugLogBuf.c_str(), line_no);
|
|
|
- const char* line_end = g.DebugLogIndex.get_line_end(g.DebugLogBuf.c_str(), line_no);
|
|
|
- TextUnformatted(line_begin, line_end); // Display line
|
|
|
- ImRect text_rect = g.LastItemData.Rect;
|
|
|
- if (IsItemHovered())
|
|
|
- for (const char* p = line_begin; p <= line_end - 10; p++) // Search for 0x???????? identifiers
|
|
|
- {
|
|
|
- ImGuiID id = 0;
|
|
|
- if (p[0] != '0' || (p[1] != 'x' && p[1] != 'X') || sscanf(p + 2, "%X", &id) != 1)
|
|
|
- continue;
|
|
|
- ImVec2 p0 = CalcTextSize(line_begin, p);
|
|
|
- ImVec2 p1 = CalcTextSize(p, p + 10);
|
|
|
- g.LastItemData.Rect = ImRect(text_rect.Min + ImVec2(p0.x, 0.0f), text_rect.Min + ImVec2(p0.x + p1.x, p1.y));
|
|
|
- if (IsMouseHoveringRect(g.LastItemData.Rect.Min, g.LastItemData.Rect.Max, true))
|
|
|
- DebugLocateItemOnHover(id);
|
|
|
- p += 10;
|
|
|
- }
|
|
|
- }
|
|
|
+ DebugTextUnformattedWithLocateItem(g.DebugLogIndex.get_line_begin(g.DebugLogBuf.c_str(), line_no), g.DebugLogIndex.get_line_end(g.DebugLogBuf.c_str(), line_no));
|
|
|
g.DebugLogFlags = backup_log_flags;
|
|
|
if (GetScrollY() >= GetScrollMaxY())
|
|
|
SetScrollHereY(1.0f);
|
|
@@ -15664,6 +15646,28 @@ void ImGui::ShowDebugLogWindow(bool* p_open)
|
|
|
End();
|
|
|
}
|
|
|
|
|
|
+// Display line, search for 0xXXXXXXXX identifiers and call DebugLocateItemOnHover() when hovered.
|
|
|
+void ImGui::DebugTextUnformattedWithLocateItem(const char* line_begin, const char* line_end)
|
|
|
+{
|
|
|
+ TextUnformatted(line_begin, line_end);
|
|
|
+ if (!IsItemHovered())
|
|
|
+ return;
|
|
|
+ ImGuiContext& g = *GImGui;
|
|
|
+ ImRect text_rect = g.LastItemData.Rect;
|
|
|
+ for (const char* p = line_begin; p <= line_end - 10; p++)
|
|
|
+ {
|
|
|
+ ImGuiID id = 0;
|
|
|
+ if (p[0] != '0' || (p[1] != 'x' && p[1] != 'X') || sscanf(p + 2, "%X", &id) != 1)
|
|
|
+ continue;
|
|
|
+ ImVec2 p0 = CalcTextSize(line_begin, p);
|
|
|
+ ImVec2 p1 = CalcTextSize(p, p + 10);
|
|
|
+ g.LastItemData.Rect = ImRect(text_rect.Min + ImVec2(p0.x, 0.0f), text_rect.Min + ImVec2(p0.x + p1.x, p1.y));
|
|
|
+ if (IsMouseHoveringRect(g.LastItemData.Rect.Min, g.LastItemData.Rect.Max, true))
|
|
|
+ DebugLocateItemOnHover(id);
|
|
|
+ p += 10;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
//-----------------------------------------------------------------------------
|
|
|
// [SECTION] OTHER DEBUG TOOLS (ITEM PICKER, ID STACK TOOL)
|
|
|
//-----------------------------------------------------------------------------
|