Pārlūkot izejas kodu

Changelog formatting update, Todo, comments. Tweak Child demo. Shuffle some code in NavUpdate().

omar 7 gadi atpakaļ
vecāks
revīzija
2bdf0b54a2
4 mainītis faili ar 55 papildinājumiem un 43 dzēšanām
  1. 39 30
      CHANGELOG.txt
  2. 2 2
      TODO.txt
  3. 12 8
      imgui.cpp
  4. 2 3
      imgui_demo.cpp

+ 39 - 30
CHANGELOG.txt

@@ -1,28 +1,19 @@
 dear imgui
 CHANGELOG
 
------------------------------------------------------------------------
-
-This document holds the programmer changelog that we also use in release notes.
-We generally fold multiple commits pertaining to the same topic as a single entry, and simplify various things.
-
-Release notes: (with links and screenshots)
-  https://github.com/ocornut/imgui/releases
-
-Changes to the examples/bindings are included within the individual .cpp files in examples.
+This document holds the user-facing changelog that we also use in release notes.
+We generally fold multiple commits pertaining to the same topic as a single entry.
+Changes to the examples/bindings are included within the individual .cpp files in the examples/ folder.
 
-Individual commits:
-  https://github.com/ocornut/imgui/commits/master
-
-Report issues, ask questions:
-  https://github.com/ocornut/imgui/issues
-
------------------------------------------------------------------------
+RELEASE NOTES:                  https://github.com/ocornut/imgui/releases
+REPORT ISSUES, ASK QUESTIONS:   https://github.com/ocornut/imgui/issues
+COMMITS HISTORY:                https://github.com/ocornut/imgui/commits/master
 
 WHEN TO UPDATE?
 
-It is generally safe to sync to the latest commit in master. The library is fairly stable and regressions tends to be fixed fast when reported.
-Keeping your copy of dear imgui updated once in a while is recommended.
+- Keeping your copy of dear imgui updated once in a while is recommended.
+- It is generally safe to sync to the latest commit in master. 
+  The library is fairly stable and regressions tends to be fixed fast when reported.
 
 HOW TO UPDATE?
 
@@ -32,12 +23,15 @@ HOW TO UPDATE?
 - If you have a problem with a missing function/symbols, search for its name in the code, there will likely be a comment about it.
 - If you are dropping this repository in your codebase, please leave the demo and text files in there, they will be useful.
 - You may diff your previous Changelog with the one you just copied and read that diff.
-- You may enable `IMGUI_DISABLE_OBSOLETE_FUNCTIONS` in imconfig.h to forcefully disable legacy names and symbols. Doing it every once in a while is a good way to make sure you are not using obsolete symbols. Dear ImGui is in active development API updates have a little more frequent lately. They are carefully documented and should not affect all users.
+- You may enable `IMGUI_DISABLE_OBSOLETE_FUNCTIONS` in imconfig.h to forcefully disable legacy names and symbols. 
+  Doing it every once in a while is a good way to make sure you are not using obsolete symbols. Dear ImGui is in active development, 
+  and API updates have been a little more frequent lately. They are documented below and in imgui.cpp and should not affect all users.
 - Please report any issue!
 
------------------------------------------------------------------------
 
-VERSION 1.62 WIP (IN PROGRESS)
+-----------------------------------------------------------------------
+ VERSION 1.62 WIP (IN PROGRESS)
+-----------------------------------------------------------------------
 
 Breaking Changes:
 
@@ -52,9 +46,10 @@ Other Changes:
  - Examples: GLFW: Made it possible to Shutdown/Init the backend again (by reseting the time storage properly). (#1827) [@ice1000]
  - Internals: PushItemFlag() flags are inherited by BeginChild().
 
------------------------------------------------------------------------
 
-VERSION 1.61 (Released 2018-05-14)
+-----------------------------------------------------------------------
+ VERSION 1.61 (Released 2018-05-14)
+-----------------------------------------------------------------------
 
 Breaking Changes:
 
@@ -110,9 +105,11 @@ Other Changes:
 - Examples: SDL: Fixed clipboard paste memory leak in the SDL binding code. (#1803) [@eliasdaler]
 - Various minor fixes, tweaks, refactoring, comments.
 
+
+-----------------------------------------------------------------------
+ VERSION 1.60 (Released 2018-04-07)
 -----------------------------------------------------------------------
 
-VERSION 1.60 (Released 2018-04-07)
 Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.60
 
 The gamepad/keyboard navigation branch (which has been in the work since July 2016) has been merged.
@@ -271,9 +268,11 @@ Other Changes:
 - Examples: Visual Studio: Disabled extraneous function-level check in Release build.
 - Various fixes, tweaks, internal refactoring, optimizations, comments.
 
+
+-----------------------------------------------------------------------
+ VERSION 1.53 (Released 2017-12-25)
 -----------------------------------------------------------------------
 
-VERSION 1.53 (Released 2017-12-25)
 Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.53
 
 Breaking Changes:
@@ -409,9 +408,11 @@ Other Changes:
 - Fix for using alloca() in "Clang with Microsoft Codechain" mode.
 - Various fixes, optimizations, comments.
 
+
+-----------------------------------------------------------------------
+ VERSION 1.52 (2017-10-27)
 -----------------------------------------------------------------------
 
-VERSION 1.52 (2017-10-27)
 Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.52
 
 Breaking Changes:
@@ -510,9 +511,11 @@ Beta Navigation Branch:
 - Nav: More consistently drawing a (thin) navigation rectangle hover filled frames such as tree nodes, collapsing header, menus. (#787)
 - Nav: Various internal refactoring.
 
+
+-----------------------------------------------------------------------
+ VERSION 1.51 (2017-08-24)
 -----------------------------------------------------------------------
 
-VERSION 1.51 (2017-08-24)
 Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.51
 
 Breaking Changes:
@@ -572,9 +575,11 @@ Other Changes:
 - Examples: Enabled vsync by default in example applications, so it doesn't confuse people that the sample run at 2000+ fps and waste an entire CPU. (#1213, #1151).
 - Various other small fixes, tweaks, comments, optimizations.
 
+
+-----------------------------------------------------------------------
+ VERSION 1.50 (2017-06-02)
 -----------------------------------------------------------------------
 
-VERSION 1.50 (2017-06-02)
 Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.50
 
 Breaking Changes:
@@ -666,9 +671,11 @@ Other Changes:
 - Added various links to language/engine bindings.
 - Various other minor fixes, tweaks, comments, optimizations.
 
+
+-----------------------------------------------------------------------
+ VERSION 1.49 (2016-05-09)
 -----------------------------------------------------------------------
 
-VERSION 1.49 (2016-05-09)
 Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.49
 
 Breaking Changes:
@@ -742,9 +749,11 @@ Other changes:
 - Examples: SDL: Initialize video+timer subsystem only.
 - Examples: Apple/iOS: lowered XCode project deployment target from 10.7 to 10.11. (#598, #575)
 
+
+-----------------------------------------------------------------------
+ VERSION 1.48 (2016-04-09)
 -----------------------------------------------------------------------
 
-VERSION 1.48 (2016-04-09)
 Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.48
 
 Breaking Changes:

+ 2 - 2
TODO.txt

@@ -252,16 +252,16 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
  - nav: SetItemDefaultFocus() level of priority, so widget like Selectable when inside a popup could claim a low-priority default focus on the first selected iem
  - nav: allow input system to be be more tolerant of io.DeltaTime=0.0f
  - nav: ESC within a menu of a child window seems to exit the child window.
- - nav: ESC on a flattened child
+ - nav: NavFlattened: ESC on a flattened child should select something.
  - nav: NavFlattened: broken: in typical usage scenario, the items of a fully clipped child are currently not considered to enter into a NavFlattened child.
  - nav: NavFlattened: init request doesn't select items that are part of a NavFlattened child
+ - nav: NavFlattened: cannot access menubar of a flattened child window with Alt/menu key (not a very common use case..).
  - nav: Left within a tree node block as a fallback (ImGuiTreeNodeFlags_NavLeftJumpsBackHere by default?)
  - nav: menus: pressing left-right on a vertically clipped menu bar tends to jump to the collapse/close buttons.
  - nav: menus: allow pressing Menu to leave a sub-menu.
  - nav: simulate right-click or context activation? (SHIFT+F10)
  - nav: tabs should go through most/all widgets (in submission order?).
  - nav: when CTRL-Tab/windowing is active, the HoveredWindow detection doesn't take account of the window display re-ordering.
- - nav: cannot access menubar of a flattened child window with Alt/menu key (not a very common use case..).
  - nav: esc/enter default behavior for popups, e.g. be able to mark an "ok" or "cancel" button that would get triggered by those keys.
  - nav: when activating a button that changes label (without a static ID) or disappear, can we somehow automatically recover into a nearest highlight item?
  - nav: there's currently no way to completely clear focus with the keyboard. depending on patterns used by the application to dispatch inputs, it may be desirable.

+ 12 - 8
imgui.cpp

@@ -2519,6 +2519,8 @@ static void ImGui::NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, con
 
     const ImGuiItemFlags item_flags = window->DC.ItemFlags;
     const ImRect nav_bb_rel(nav_bb.Min - window->Pos, nav_bb.Max - window->Pos);
+
+    // Process Init Request
     if (g.NavInitRequest && g.NavLayer == window->DC.NavLayerCurrent)
     {
         // Even if 'ImGuiItemFlags_NoNavDefaultFocus' is on (typically collapse/close button) we record the first ResultId so they can be used as a fallback
@@ -2534,7 +2536,7 @@ static void ImGui::NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, con
         }
     }
 
-    // Scoring for navigation
+    // Process Move Request (scoring for navigation)
     // FIXME-NAV: Consider policy for double scoring (scoring from NavScoringRectScreen + scoring from a rect wrapped according to current wrapping policy)
     if (g.NavId != id && !(item_flags & ImGuiItemFlags_NoNav))
     {
@@ -3104,10 +3106,10 @@ static void ImGui::NavUpdateWindowing()
     }
 }
 
+// Scroll to keep newly navigated item fully into view
 // NB: We modify rect_rel by the amount we scrolled for, so it is immediately updated.
 static void NavScrollToBringItemIntoView(ImGuiWindow* window, const ImRect& item_rect)
 {
-    // Scroll to keep newly navigated item fully into view
     ImRect window_rect(window->InnerMainRect.Min - ImVec2(1, 1), window->InnerMainRect.Max + ImVec2(1, 1));
     //g.OverlayDrawList.AddRect(window_rect.Min, window_rect.Max, IM_COL32_WHITE); // [DEBUG]
     if (window_rect.Contains(item_rect))
@@ -3145,12 +3147,16 @@ static void ImGui::NavUpdate()
     if (g.NavScoringCount > 0) printf("[%05d] NavScoringCount %d for '%s' layer %d (Init:%d, Move:%d)\n", g.FrameCount, g.NavScoringCount, g.NavWindow ? g.NavWindow->Name : "NULL", g.NavLayer, g.NavInitRequest || g.NavInitResultId != 0, g.NavMoveRequest);
 #endif
 
-    if ((g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) && (g.IO.BackendFlags & ImGuiBackendFlags_HasGamepad))
+    bool nav_keyboard_active = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
+    bool nav_gamepad_active = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (g.IO.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0;
+
+    // Set input source as Gamepad when buttons are pressed before we map Keyboard (some features differs when used with Gamepad vs Keyboard)
+    if (nav_gamepad_active)
         if (g.IO.NavInputs[ImGuiNavInput_Activate] > 0.0f || g.IO.NavInputs[ImGuiNavInput_Input] > 0.0f || g.IO.NavInputs[ImGuiNavInput_Cancel] > 0.0f || g.IO.NavInputs[ImGuiNavInput_Menu] > 0.0f)
             g.NavInputSource = ImGuiInputSource_NavGamepad;
 
     // Update Keyboard->Nav inputs mapping
-    if (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard)
+    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; }
         NAV_MAP_KEY(ImGuiKey_Space,     ImGuiNavInput_Activate );
@@ -3256,8 +3262,6 @@ static void ImGui::NavUpdate()
     NavUpdateWindowing();
 
     // Set output flags for user application
-    bool nav_keyboard_active = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
-    bool nav_gamepad_active = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (g.IO.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0;
     g.IO.NavActive = (nav_keyboard_active || nav_gamepad_active) && g.NavWindow && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs);
     g.IO.NavVisible = (g.IO.NavActive && g.NavId != 0 && !g.NavDisableHighlight) || (g.NavWindowingTarget != NULL) || g.NavInitRequest;
 
@@ -3369,7 +3373,7 @@ static void ImGui::NavUpdate()
     // Scrolling
     if (g.NavWindow && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs) && !g.NavWindowingTarget)
     {
-        // *Fallback* manual-scroll with NavUp/NavDown when window has no navigable item
+        // *Fallback* manual-scroll with Nav directional keys when window has no navigable item
         ImGuiWindow* window = g.NavWindow;
         const float scroll_speed = ImFloor(window->CalcFontSize() * 100 * g.IO.DeltaTime + 0.5f); // We need round the scrolling speed because sub-pixel scroll isn't reliably supported.
         if (window->DC.NavLayerActiveMask == 0x00 && window->DC.NavHasScroll && g.NavMoveRequest)
@@ -13372,7 +13376,7 @@ bool ImGui::SetDragDropPayload(const char* type, const void* data, size_t data_s
         cond = ImGuiCond_Always;
 
     IM_ASSERT(type != NULL);
-    IM_ASSERT(strlen(type) < IM_ARRAYSIZE(payload.DataType) && "Payload type can be at most 12 characters long");
+    IM_ASSERT(strlen(type) < IM_ARRAYSIZE(payload.DataType) && "Payload type can be at most 32 characters long");
     IM_ASSERT((data != NULL && data_size > 0) || (data == NULL && data_size == 0));
     IM_ASSERT(cond == ImGuiCond_Always || cond == ImGuiCond_Once);
     IM_ASSERT(payload.SourceId != 0);                               // Not called between BeginDragDropSource() and EndDragDropSource()

+ 2 - 3
imgui_demo.cpp

@@ -1221,11 +1221,10 @@ void ImGui::ShowDemoWindow(bool* p_open)
                 ImGui::Columns(2);
                 for (int i = 0; i < 100; i++)
                 {
-                    if (i == 50)
-                        ImGui::NextColumn();
                     char buf[32];
-                    sprintf(buf, "%08x", i*5731);
+                    sprintf(buf, "%03d", i);
                     ImGui::Button(buf, ImVec2(-1.0f, 0.0f));
+                    ImGui::NextColumn();
                 }
                 ImGui::EndChild();
                 ImGui::PopStyleVar();