Browse Source

Misc renaming, comments. Docs: add missing spacing to Changelog.

omar 5 years ago
parent
commit
47fab0e166
4 changed files with 25 additions and 13 deletions
  1. 11 0
      docs/CHANGELOG.txt
  2. 8 7
      imgui.cpp
  3. 3 3
      imgui_demo.cpp
  4. 3 3
      imgui_internal.h

+ 11 - 0
docs/CHANGELOG.txt

@@ -8,6 +8,7 @@ Changes to the examples/bindings are included within the individual .cpp files i
 RELEASE NOTES:                  https://github.com/ocornut/imgui/releases
 RELEASE NOTES:                  https://github.com/ocornut/imgui/releases
 REPORT ISSUES, ASK QUESTIONS:   https://github.com/ocornut/imgui/issues
 REPORT ISSUES, ASK QUESTIONS:   https://github.com/ocornut/imgui/issues
 COMMITS HISTORY:                https://github.com/ocornut/imgui/commits/master
 COMMITS HISTORY:                https://github.com/ocornut/imgui/commits/master
+FAQ                             https://www.dearimgui.org/faq/
 
 
 WHEN TO UPDATE?
 WHEN TO UPDATE?
 
 
@@ -34,6 +35,7 @@ HOW TO UPDATE?
 -----------------------------------------------------------------------
 -----------------------------------------------------------------------
 
 
 Breaking Changes:
 Breaking Changes:
+
 - Removed redirecting functions/enums names that were marked obsolete in 1.53 (December 2017):
 - Removed redirecting functions/enums names that were marked obsolete in 1.53 (December 2017):
   - ShowTestWindow()                    -> use ShowDemoWindow()
   - ShowTestWindow()                    -> use ShowDemoWindow()
   - IsRootWindowFocused()               -> use IsWindowFocused(ImGuiFocusedFlags_RootWindow)
   - IsRootWindowFocused()               -> use IsWindowFocused(ImGuiFocusedFlags_RootWindow)
@@ -63,6 +65,7 @@ Breaking Changes:
   adding multiple points into it, you may need to fix your initial value.
   adding multiple points into it, you may need to fix your initial value.
 
 
 Other Changes:
 Other Changes:
+
 - Inputs: Added ImGuiMouseButton enum for convenience (e.g. ImGuiMouseButton_Right=1).
 - Inputs: Added ImGuiMouseButton enum for convenience (e.g. ImGuiMouseButton_Right=1).
   We forever guarantee that the existing value will not changes so existing code is free to use 0/1/2.
   We forever guarantee that the existing value will not changes so existing code is free to use 0/1/2.
 - ColorEdit: Fix label alignment when using ImGuiColorEditFlags_NoInputs. (#2955) [@rokups]
 - ColorEdit: Fix label alignment when using ImGuiColorEditFlags_NoInputs. (#2955) [@rokups]
@@ -118,6 +121,7 @@ Other Changes:
 Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.74
 Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.74
 
 
 Breaking Changes:
 Breaking Changes:
+
 - Removed redirecting functions/enums names that were marked obsolete in 1.52 (October 2017):
 - Removed redirecting functions/enums names that were marked obsolete in 1.52 (October 2017):
   - Begin() [old 5 args version]     -> use Begin() [3 args], use SetNextWindowSize() SetNextWindowBgAlpha() if needed
   - Begin() [old 5 args version]     -> use Begin() [3 args], use SetNextWindowSize() SetNextWindowBgAlpha() if needed
   - IsRootWindowOrAnyChildHovered()  -> use IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows)
   - IsRootWindowOrAnyChildHovered()  -> use IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows)
@@ -142,6 +146,7 @@ Breaking Changes:
   The value is unused in master branch but will be used by the multi-viewport feature. (#2851) [@obfuscate]
   The value is unused in master branch but will be used by the multi-viewport feature. (#2851) [@obfuscate]
 
 
 Other Changes:
 Other Changes:
+
 - InputText, Nav: Fixed Home/End key broken when activating Keyboard Navigation. (#787)
 - InputText, Nav: Fixed Home/End key broken when activating Keyboard Navigation. (#787)
 - InputText: Filter out ASCII 127 (DEL) emitted by low-level OSX layer, as we are using the Key value. (#2578)
 - InputText: Filter out ASCII 127 (DEL) emitted by low-level OSX layer, as we are using the Key value. (#2578)
 - Layout: Fixed a couple of subtle bounding box vertical positioning issues relating to the handling of text
 - Layout: Fixed a couple of subtle bounding box vertical positioning issues relating to the handling of text
@@ -274,6 +279,7 @@ Other Changes:
 Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.72
 Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.72
 
 
 Breaking Changes:
 Breaking Changes:
+
 - Removed redirecting functions/enums names that were marked obsolete in 1.51 (June 2017):
 - Removed redirecting functions/enums names that were marked obsolete in 1.51 (June 2017):
   - ImGuiCol_Column*, ImGuiSetCond_* enums.
   - ImGuiCol_Column*, ImGuiSetCond_* enums.
   - IsItemHoveredRect(), IsPosHoveringAnyWindow(), IsMouseHoveringAnyWindow(), IsMouseHoveringWindow() functions.
   - IsItemHoveredRect(), IsPosHoveringAnyWindow(), IsMouseHoveringAnyWindow(), IsMouseHoveringWindow() functions.
@@ -285,6 +291,7 @@ Breaking Changes:
   Kept redirection function (will obsolete). (#581, #324)
   Kept redirection function (will obsolete). (#581, #324)
 
 
 Other Changes:
 Other Changes:
+
 - Scrolling: Made mouse-wheel scrolling lock the underlying window until the mouse is moved again or
 - Scrolling: Made mouse-wheel scrolling lock the underlying window until the mouse is moved again or
   until a short delay expires (~2 seconds). This allow uninterrupted scroll even if child windows are
   until a short delay expires (~2 seconds). This allow uninterrupted scroll even if child windows are
   passing under the mouse cursor. (#2604)
   passing under the mouse cursor. (#2604)
@@ -357,6 +364,7 @@ Other Changes:
 Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.71
 Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.71
 
 
 Breaking Changes:
 Breaking Changes:
+
 - IO: changed AddInputCharacter(unsigned short c) signature to AddInputCharacter(unsigned int c).
 - IO: changed AddInputCharacter(unsigned short c) signature to AddInputCharacter(unsigned int c).
 - Renamed SetNextTreeNodeOpen() to SetNextItemOpen(). Kept inline redirection function (will obsolete).
 - Renamed SetNextTreeNodeOpen() to SetNextItemOpen(). Kept inline redirection function (will obsolete).
 - Window: rendering of child windows outer decorations (e.g. bg color, border, scrollbars) is now
 - Window: rendering of child windows outer decorations (e.g. bg color, border, scrollbars) is now
@@ -367,6 +375,7 @@ Breaking Changes:
   to the creation of overlapping child windows. Please reach out if you are affected by this change!
   to the creation of overlapping child windows. Please reach out if you are affected by this change!
 
 
 Other Changes:
 Other Changes:
+
 - Window: clarified behavior of SetNextWindowContentSize(). Content size is defined as the size available
 - Window: clarified behavior of SetNextWindowContentSize(). Content size is defined as the size available
   after removal of WindowPadding on each sides. So SetNextWindowContentSize(ImVec2(100,100)) + auto-resize
   after removal of WindowPadding on each sides. So SetNextWindowContentSize(ImVec2(100,100)) + auto-resize
   will always allow submitting a 100x100 item without creating a scrollbar, regarding of WindowPadding.
   will always allow submitting a 100x100 item without creating a scrollbar, regarding of WindowPadding.
@@ -439,6 +448,7 @@ Other Changes:
 Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.70
 Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.70
 
 
 Breaking Changes:
 Breaking Changes:
+
 - ImDrawList: Improved algorithm for mitre joints on thick lines, preserving correct thickness
 - ImDrawList: Improved algorithm for mitre joints on thick lines, preserving correct thickness
   up to 90 degrees angles (e.g. rectangles). If you have custom rendering using thick lines,
   up to 90 degrees angles (e.g. rectangles). If you have custom rendering using thick lines,
   they will appear a little thicker now. (#2518) [@rmitton]
   they will appear a little thicker now. (#2518) [@rmitton]
@@ -451,6 +461,7 @@ Breaking Changes:
   on them but it is possible you have!).
   on them but it is possible you have!).
 
 
 Other Changes:
 Other Changes:
+
 - ImDrawList: Added ImDrawCallback_ResetRenderState, a special ImDrawList::AddCallback() value
 - ImDrawList: Added ImDrawCallback_ResetRenderState, a special ImDrawList::AddCallback() value
   to request the renderer back-end to reset its render state. (#2037, #1639, #2452)
   to request the renderer back-end to reset its render state. (#2037, #1639, #2452)
   Examples: Added support for ImDrawCallback_ResetRenderState in all renderer back-ends. Each
   Examples: Added support for ImDrawCallback_ResetRenderState in all renderer back-ends. Each

+ 8 - 7
imgui.cpp

@@ -3766,7 +3766,7 @@ void ImGui::NewFrame()
         window->Active = false;
         window->Active = false;
         window->WriteAccessed = false;
         window->WriteAccessed = false;
 
 
-        // Garbage collect (this is totally functional but we may need decide if the side-effects are desirable)
+        // Garbage collect transient buffers of recently unused windows
         if (!window->WasActive && !window->MemoryCompacted && window->LastTimeActive < memory_compact_start_time)
         if (!window->WasActive && !window->MemoryCompacted && window->LastTimeActive < memory_compact_start_time)
             GcCompactTransientWindowBuffers(window);
             GcCompactTransientWindowBuffers(window);
     }
     }
@@ -3887,7 +3887,7 @@ void ImGui::Shutdown(ImGuiContext* context)
         IM_DELETE(g.Windows[i]);
         IM_DELETE(g.Windows[i]);
     g.Windows.clear();
     g.Windows.clear();
     g.WindowsFocusOrder.clear();
     g.WindowsFocusOrder.clear();
-    g.WindowsSortBuffer.clear();
+    g.WindowsTempSortBuffer.clear();
     g.CurrentWindow = NULL;
     g.CurrentWindow = NULL;
     g.CurrentWindowStack.clear();
     g.CurrentWindowStack.clear();
     g.WindowsById.Clear();
     g.WindowsById.Clear();
@@ -4123,19 +4123,19 @@ void ImGui::EndFrame()
 
 
     // Sort the window list so that all child windows are after their parent
     // Sort the window list so that all child windows are after their parent
     // We cannot do that on FocusWindow() because childs may not exist yet
     // We cannot do that on FocusWindow() because childs may not exist yet
-    g.WindowsSortBuffer.resize(0);
-    g.WindowsSortBuffer.reserve(g.Windows.Size);
+    g.WindowsTempSortBuffer.resize(0);
+    g.WindowsTempSortBuffer.reserve(g.Windows.Size);
     for (int i = 0; i != g.Windows.Size; i++)
     for (int i = 0; i != g.Windows.Size; i++)
     {
     {
         ImGuiWindow* window = g.Windows[i];
         ImGuiWindow* window = g.Windows[i];
         if (window->Active && (window->Flags & ImGuiWindowFlags_ChildWindow))       // if a child is active its parent will add it
         if (window->Active && (window->Flags & ImGuiWindowFlags_ChildWindow))       // if a child is active its parent will add it
             continue;
             continue;
-        AddWindowToSortBuffer(&g.WindowsSortBuffer, window);
+        AddWindowToSortBuffer(&g.WindowsTempSortBuffer, window);
     }
     }
 
 
     // This usually assert if there is a mismatch between the ImGuiWindowFlags_ChildWindow / ParentWindow values and DC.ChildWindows[] in parents, aka we've done something wrong.
     // This usually assert if there is a mismatch between the ImGuiWindowFlags_ChildWindow / ParentWindow values and DC.ChildWindows[] in parents, aka we've done something wrong.
-    IM_ASSERT(g.Windows.Size == g.WindowsSortBuffer.Size);
-    g.Windows.swap(g.WindowsSortBuffer);
+    IM_ASSERT(g.Windows.Size == g.WindowsTempSortBuffer.Size);
+    g.Windows.swap(g.WindowsTempSortBuffer);
     g.IO.MetricsActiveWindows = g.WindowsActiveCount;
     g.IO.MetricsActiveWindows = g.WindowsActiveCount;
 
 
     // Unlock font atlas
     // Unlock font atlas
@@ -10119,6 +10119,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
     };
     };
 
 
     Funcs::NodeWindows(g.Windows, "Windows");
     Funcs::NodeWindows(g.Windows, "Windows");
+    //Funcs::NodeWindows(g.WindowsFocusOrder, "WindowsFocusOrder");
     if (ImGui::TreeNode("DrawLists", "Active DrawLists (%d)", g.DrawDataBuilder.Layers[0].Size))
     if (ImGui::TreeNode("DrawLists", "Active DrawLists (%d)", g.DrawDataBuilder.Layers[0].Size))
     {
     {
         for (int i = 0; i < g.DrawDataBuilder.Layers[0].Size; i++)
         for (int i = 0; i < g.DrawDataBuilder.Layers[0].Size; i++)

+ 3 - 3
imgui_demo.cpp

@@ -1790,7 +1790,7 @@ static void ShowDemoWindowLayout()
         // Child 1: no border, enable horizontal scrollbar
         // Child 1: no border, enable horizontal scrollbar
         {
         {
             ImGuiWindowFlags window_flags = ImGuiWindowFlags_HorizontalScrollbar | (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0);
             ImGuiWindowFlags window_flags = ImGuiWindowFlags_HorizontalScrollbar | (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0);
-            ImGui::BeginChild("Child1", ImVec2(ImGui::GetWindowContentRegionWidth() * 0.5f, 260), false, window_flags);
+            ImGui::BeginChild("ChildL", ImVec2(ImGui::GetWindowContentRegionWidth() * 0.5f, 260), false, window_flags);
             for (int i = 0; i < 100; i++)
             for (int i = 0; i < 100; i++)
             {
             {
                 ImGui::Text("%04d: scrollable region", i);
                 ImGui::Text("%04d: scrollable region", i);
@@ -1808,7 +1808,7 @@ static void ShowDemoWindowLayout()
         {
         {
             ImGuiWindowFlags window_flags = (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0) | (disable_menu ? 0 : ImGuiWindowFlags_MenuBar);
             ImGuiWindowFlags window_flags = (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0) | (disable_menu ? 0 : ImGuiWindowFlags_MenuBar);
             ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f);
             ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f);
-            ImGui::BeginChild("Child2", ImVec2(0, 260), true, window_flags);
+            ImGui::BeginChild("ChildR", ImVec2(0, 260), true, window_flags);
             if (!disable_menu && ImGui::BeginMenuBar())
             if (!disable_menu && ImGui::BeginMenuBar())
             {
             {
                 if (ImGui::BeginMenu("Menu"))
                 if (ImGui::BeginMenu("Menu"))
@@ -1841,7 +1841,7 @@ static void ShowDemoWindowLayout()
         {
         {
             ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 10);
             ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 10);
             ImGui::PushStyleColor(ImGuiCol_ChildBg, IM_COL32(255, 0, 0, 100));
             ImGui::PushStyleColor(ImGuiCol_ChildBg, IM_COL32(255, 0, 0, 100));
-            ImGui::BeginChild("blah", ImVec2(200, 100), true, ImGuiWindowFlags_None);
+            ImGui::BeginChild("Red", ImVec2(200, 100), true, ImGuiWindowFlags_None);
             for (int n = 0; n < 50; n++)
             for (int n = 0; n < 50; n++)
                 ImGui::Text("Some test %d", n);
                 ImGui::Text("Some test %d", n);
             ImGui::EndChild();
             ImGui::EndChild();

+ 3 - 3
imgui_internal.h

@@ -1006,8 +1006,8 @@ struct ImGuiContext
 
 
     // Windows state
     // Windows state
     ImVector<ImGuiWindow*>  Windows;                            // Windows, sorted in display order, back to front
     ImVector<ImGuiWindow*>  Windows;                            // Windows, sorted in display order, back to front
-    ImVector<ImGuiWindow*>  WindowsFocusOrder;                  // Windows, sorted in focus order, back to front
-    ImVector<ImGuiWindow*>  WindowsSortBuffer;
+    ImVector<ImGuiWindow*>  WindowsFocusOrder;                  // Windows, sorted in focus order, back to front. (FIXME: We could only store root windows here! Need to sort out the Docking equivalent which is RootWindowDockStop and is unfortunately a little more dynamic)
+    ImVector<ImGuiWindow*>  WindowsTempSortBuffer;              // Temporary buffer used in EndFrame() to reorder windows so parents are kept before their child
     ImVector<ImGuiWindow*>  CurrentWindowStack;
     ImVector<ImGuiWindow*>  CurrentWindowStack;
     ImGuiStorage            WindowsById;                        // Map window's ImGuiID to ImGuiWindow*
     ImGuiStorage            WindowsById;                        // Map window's ImGuiID to ImGuiWindow*
     int                     WindowsActiveCount;                 // Number of unique windows submitted by frame
     int                     WindowsActiveCount;                 // Number of unique windows submitted by frame
@@ -1424,7 +1424,7 @@ struct IMGUI_API ImGuiWindowTempData
 // Storage for one window
 // Storage for one window
 struct IMGUI_API ImGuiWindow
 struct IMGUI_API ImGuiWindow
 {
 {
-    char*                   Name;
+    char*                   Name;                               // Window name, owned by the window.
     ImGuiID                 ID;                                 // == ImHashStr(Name)
     ImGuiID                 ID;                                 // == ImHashStr(Name)
     ImGuiWindowFlags        Flags;                              // See enum ImGuiWindowFlags_
     ImGuiWindowFlags        Flags;                              // See enum ImGuiWindowFlags_
     ImVec2                  Pos;                                // Position (always rounded-up to nearest pixel)
     ImVec2                  Pos;                                // Position (always rounded-up to nearest pixel)