Comments, tweaks, metrics window tweak

This commit is contained in:
ocornut 2015-05-02 17:54:25 +01:00
parent a3560b274e
commit 221f36e116
2 changed files with 4 additions and 7 deletions

View File

@ -3154,6 +3154,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
window->DrawList->Clear(); window->DrawList->Clear();
window->ClipRectStack.resize(0); window->ClipRectStack.resize(0);
window->LastFrameDrawn = current_frame; window->LastFrameDrawn = current_frame;
window->IDStack.resize(1);
} }
// Setup texture, outer clipping rectangle // Setup texture, outer clipping rectangle
@ -3191,9 +3192,6 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
window->SizeFull = size_on_first_use; window->SizeFull = size_on_first_use;
} }
// Reset ID stack
window->IDStack.resize(1);
// Move window (at the beginning of the frame to avoid input lag or sheering). Only valid for root windows. // Move window (at the beginning of the frame to avoid input lag or sheering). Only valid for root windows.
RegisterAliveId(window->MoveID); RegisterAliveId(window->MoveID);
if (g.ActiveId == window->MoveID) if (g.ActiveId == window->MoveID)
@ -3335,7 +3333,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
ImU32 resize_col = 0; ImU32 resize_col = 0;
if (!(flags & ImGuiWindowFlags_AlwaysAutoResize) && window->AutoFitFrames <= 0 && !(flags & ImGuiWindowFlags_NoResize)) if (!(flags & ImGuiWindowFlags_AlwaysAutoResize) && window->AutoFitFrames <= 0 && !(flags & ImGuiWindowFlags_NoResize))
{ {
// Manual resize grip // Manual resize
const ImRect resize_rect(window->Rect().GetBR()-ImVec2(14,14), window->Rect().GetBR()); const ImRect resize_rect(window->Rect().GetBR()-ImVec2(14,14), window->Rect().GetBR());
const ImGuiID resize_id = window->GetID("#RESIZE"); const ImGuiID resize_id = window->GetID("#RESIZE");
bool hovered, held; bool hovered, held;
@ -3355,7 +3353,6 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
} }
else if (held) else if (held)
{ {
// Resize
window->SizeFull = ImMax(window->SizeFull + g.IO.MouseDelta, style.WindowMinSize); window->SizeFull = ImMax(window->SizeFull + g.IO.MouseDelta, style.WindowMinSize);
if (!(flags & ImGuiWindowFlags_NoSavedSettings)) if (!(flags & ImGuiWindowFlags_NoSavedSettings))
MarkSettingsDirty(); MarkSettingsDirty();
@ -10731,7 +10728,7 @@ void ImGui::ShowMetricsWindow(bool* opened)
static void NodeWindow(ImGuiWindow* window, const char* label) static void NodeWindow(ImGuiWindow* window, const char* label)
{ {
if (!ImGui::TreeNode(window, "%s '%s', %d @ 0x%p", label, window->Name, window->Active, window)) if (!ImGui::TreeNode(window, "%s '%s', %d @ 0x%p", label, window->Name, window->Active || window->WasActive, window))
return; return;
NodeDrawList(window->DrawList, "DrawList"); NodeDrawList(window->DrawList, "DrawList");
if (window->RootWindow != window) NodeWindow(window->RootWindow, "RootWindow"); if (window->RootWindow != window) NodeWindow(window->RootWindow, "RootWindow");

View File

@ -159,7 +159,7 @@ namespace ImGui
IMGUI_API void ShowUserGuide(); // help block IMGUI_API void ShowUserGuide(); // help block
IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); // style editor block IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); // style editor block
IMGUI_API void ShowTestWindow(bool* opened = NULL); // test window, demonstrate ImGui features IMGUI_API void ShowTestWindow(bool* opened = NULL); // test window, demonstrate ImGui features
IMGUI_API void ShowMetricsWindow(bool* opened = NULL); // metrics window IMGUI_API void ShowMetricsWindow(bool* opened = NULL); // metrics window for debugging imgui
// Window // Window
// See implementation in .cpp for details // See implementation in .cpp for details