|
|
@@ -998,6 +998,7 @@ CODE
|
|
|
// Debug options
|
|
|
#define IMGUI_DEBUG_NAV_SCORING 0 // Display navigation scoring preview when hovering items. Display last moving direction matches when holding CTRL
|
|
|
#define IMGUI_DEBUG_NAV_RECTS 0 // Display the reference navigation rectangle for each window
|
|
|
+#define IMGUI_DEBUG_INI_SETTINGS 0 // Save additional comments in .ini file
|
|
|
|
|
|
// Visual Studio warnings
|
|
|
#ifdef _MSC_VER
|
|
|
@@ -3936,6 +3937,11 @@ void ImGui::Shutdown(ImGuiContext* context)
|
|
|
g.DrawDataBuilder.ClearFreeMemory();
|
|
|
g.BackgroundDrawList.ClearFreeMemory();
|
|
|
g.ForegroundDrawList.ClearFreeMemory();
|
|
|
+
|
|
|
+ g.TabBars.Clear();
|
|
|
+ g.CurrentTabBarStack.clear();
|
|
|
+ g.ShrinkWidthBuffer.clear();
|
|
|
+
|
|
|
g.PrivateClipboard.clear();
|
|
|
g.InputTextState.ClearFreeMemory();
|
|
|
|
|
|
@@ -4792,6 +4798,7 @@ ImGuiWindow* ImGui::FindWindowByName(const char* name)
|
|
|
static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFlags flags)
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
+ //IMGUI_DEBUG_LOG("CreateNewWindow '%s', flags = 0x%08X\n", name, flags);
|
|
|
|
|
|
// Create window the first time
|
|
|
ImGuiWindow* window = IM_NEW(ImGuiWindow)(&g, name);
|
|
|
@@ -6746,7 +6753,8 @@ void ImGui::SetNextWindowBgAlpha(float alpha)
|
|
|
// FIXME: This is in window space (not screen space!). We should try to obsolete all those functions.
|
|
|
ImVec2 ImGui::GetContentRegionMax()
|
|
|
{
|
|
|
- ImGuiWindow* window = GImGui->CurrentWindow;
|
|
|
+ ImGuiContext& g = *GImGui;
|
|
|
+ ImGuiWindow* window = g.CurrentWindow;
|
|
|
ImVec2 mx = window->ContentsRegionRect.Max - window->Pos;
|
|
|
if (window->DC.CurrentColumns)
|
|
|
mx.x = window->WorkRect.Max.x - window->Pos.x;
|
|
|
@@ -6756,7 +6764,8 @@ ImVec2 ImGui::GetContentRegionMax()
|
|
|
// [Internal] Absolute coordinate. Saner. This is not exposed until we finishing refactoring work rect features.
|
|
|
ImVec2 ImGui::GetContentRegionMaxAbs()
|
|
|
{
|
|
|
- ImGuiWindow* window = GImGui->CurrentWindow;
|
|
|
+ ImGuiContext& g = *GImGui;
|
|
|
+ ImGuiWindow* window = g.CurrentWindow;
|
|
|
ImVec2 mx = window->ContentsRegionRect.Max;
|
|
|
if (window->DC.CurrentColumns)
|
|
|
mx.x = window->WorkRect.Max.x;
|
|
|
@@ -8164,7 +8173,7 @@ static void ImGui::NavUpdate()
|
|
|
// Update Keyboard->Nav inputs mapping
|
|
|
if (nav_keyboard_active)
|
|
|
{
|
|
|
- #define NAV_MAP_KEY(_KEY, _NAV_INPUT) if (IsKeyDown(g.IO.KeyMap[_KEY])) { g.IO.NavInputs[_NAV_INPUT] = 1.0f; g.NavInputSource = ImGuiInputSource_NavKeyboard; }
|
|
|
+ #define NAV_MAP_KEY(_KEY, _NAV_INPUT) do { if (IsKeyDown(g.IO.KeyMap[_KEY])) { g.IO.NavInputs[_NAV_INPUT] = 1.0f; g.NavInputSource = ImGuiInputSource_NavKeyboard; } } while (0)
|
|
|
NAV_MAP_KEY(ImGuiKey_Space, ImGuiNavInput_Activate );
|
|
|
NAV_MAP_KEY(ImGuiKey_Enter, ImGuiNavInput_Input );
|
|
|
NAV_MAP_KEY(ImGuiKey_Escape, ImGuiNavInput_Cancel );
|
|
|
@@ -9260,8 +9269,12 @@ ImGuiWindowSettings* ImGui::CreateNewWindowSettings(const char* name)
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
g.SettingsWindows.push_back(ImGuiWindowSettings());
|
|
|
ImGuiWindowSettings* settings = &g.SettingsWindows.back();
|
|
|
- if (const char* p = strstr(name, "###")) // Skip to the "###" marker if any. We don't skip past to match the behavior of GetID()
|
|
|
+#if !IMGUI_DEBUG_INI_SETTINGS
|
|
|
+ // Skip to the "###" marker if any. We don't skip past to match the behavior of GetID()
|
|
|
+ // Preserve the full string when IMGUI_DEBUG_INI_SETTINGS is set to make .ini inspection easier.
|
|
|
+ if (const char* p = strstr(name, "###"))
|
|
|
name = p;
|
|
|
+#endif
|
|
|
settings->Name = ImStrdup(name);
|
|
|
settings->ID = ImHashStr(name);
|
|
|
return settings;
|
|
|
@@ -9652,14 +9665,16 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ // State
|
|
|
enum { WRT_OuterRect, WRT_OuterRectClipped, WRT_InnerRect, WRT_InnerClipRect, WRT_WorkRect, WRT_Contents, WRT_ContentsRegionRect, WRT_Count }; // Windows Rect Type
|
|
|
const char* wrt_rects_names[WRT_Count] = { "OuterRect", "OuterRectClipped", "InnerRect", "InnerClipRect", "WorkRect", "Contents", "ContentsRegionRect" };
|
|
|
-
|
|
|
- static bool show_windows_begin_order = false;
|
|
|
static bool show_windows_rects = false;
|
|
|
static int show_windows_rect_type = WRT_WorkRect;
|
|
|
+ static bool show_windows_begin_order = false;
|
|
|
static bool show_drawcmd_clip_rects = true;
|
|
|
|
|
|
+ // Basic info
|
|
|
+ ImGuiContext& g = *GImGui;
|
|
|
ImGuiIO& io = ImGui::GetIO();
|
|
|
ImGui::Text("Dear ImGui %s", ImGui::GetVersion());
|
|
|
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
|
|
|
@@ -9668,6 +9683,12 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|
|
ImGui::Text("%d active allocations", io.MetricsActiveAllocations);
|
|
|
ImGui::Separator();
|
|
|
|
|
|
+ // Helper functions to display common structures:
|
|
|
+ // - NodeDrawList
|
|
|
+ // - NodeColumns
|
|
|
+ // - NodeWindow
|
|
|
+ // - NodeWindows
|
|
|
+ // - NodeTabBar
|
|
|
struct Funcs
|
|
|
{
|
|
|
static ImRect GetWindowRect(ImGuiWindow* window, int rect_type)
|
|
|
@@ -9778,7 +9799,12 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|
|
|
|
|
static void NodeWindow(ImGuiWindow* window, const char* label)
|
|
|
{
|
|
|
- if (!ImGui::TreeNode(window, "%s '%s', %d @ 0x%p", label, window->Name, window->Active || window->WasActive, window))
|
|
|
+ if (window == NULL)
|
|
|
+ {
|
|
|
+ ImGui::BulletText("%s: NULL", label);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!ImGui::TreeNode(window, "%s '%s', %d @ 0x%p", label, window->Name, (window->Active || window->WasActive), window))
|
|
|
return;
|
|
|
ImGuiWindowFlags flags = window->Flags;
|
|
|
NodeDrawList(window, window->DrawList, "DrawList");
|
|
|
@@ -9832,8 +9858,6 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- // Access private state, we are going to display the draw lists from last frame
|
|
|
- ImGuiContext& g = *GImGui;
|
|
|
Funcs::NodeWindows(g.Windows, "Windows");
|
|
|
if (ImGui::TreeNode("DrawList", "Active DrawLists (%d)", g.DrawDataBuilder.Layers[0].Size))
|
|
|
{
|
|
|
@@ -9859,6 +9883,20 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|
|
ImGui::TreePop();
|
|
|
}
|
|
|
|
|
|
+#if 0
|
|
|
+ if (ImGui::TreeNode("Docking"))
|
|
|
+ {
|
|
|
+ ImGui::TreePop();
|
|
|
+ }
|
|
|
+#endif
|
|
|
+
|
|
|
+#if 0
|
|
|
+ if (ImGui::TreeNode("Tables", "Tables (%d)", g.Tables.Data.Size))
|
|
|
+ {
|
|
|
+ ImGui::TreePop();
|
|
|
+ }
|
|
|
+#endif
|
|
|
+
|
|
|
if (ImGui::TreeNode("Internal state"))
|
|
|
{
|
|
|
const char* input_source_names[] = { "None", "Mouse", "Nav", "NavKeyboard", "NavGamepad" }; IM_ASSERT(IM_ARRAYSIZE(input_source_names) == ImGuiInputSource_COUNT);
|
|
|
@@ -9905,6 +9943,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|
|
ImGui::TreePop();
|
|
|
}
|
|
|
|
|
|
+ // Tool: Display windows Rectangles and Begin Order
|
|
|
if (show_windows_rects || show_windows_begin_order)
|
|
|
{
|
|
|
for (int n = 0; n < g.Windows.Size; n++)
|