Browse Source

Docking: io.ConfigResizeWindowsFromEdges default to true in Docking branch. Moved code in BeginTabItem().

omar 7 years ago
parent
commit
b872aa5c8e
5 changed files with 15 additions and 9 deletions
  1. 2 0
      examples/example_win32_directx11/main.cpp
  2. 6 2
      imgui.cpp
  3. 1 1
      imgui.h
  4. 2 2
      imgui_demo.cpp
  5. 4 4
      imgui_widgets.cpp

+ 2 - 0
examples/example_win32_directx11/main.cpp

@@ -141,6 +141,8 @@ int main(int, char**)
     //io.ConfigFlags |= ImGuiConfigFlags_ViewportsNoMerge;
     io.ConfigFlags |= ImGuiConfigFlags_DpiEnableScaleFonts;     // FIXME-DPI: THIS CURRENTLY DOESN'T WORK AS EXPECTED. DON'T USE IN USER APP!
     io.ConfigFlags |= ImGuiConfigFlags_DpiEnableScaleViewports; // FIXME-DPI
+    io.ConfigResizeWindowsFromEdges = true;
+    io.ConfigDockingWithKeyMod = true;
 
     ImGui_ImplWin32_Init(hwnd);
     ImGui_ImplDX11_Init(g_pd3dDevice, g_pd3dDeviceContext);

+ 6 - 2
imgui.cpp

@@ -1093,7 +1093,7 @@ ImGuiIO::ImGuiIO()
     ConfigMacOSXBehaviors = false;
 #endif
     ConfigInputTextCursorBlink = true;
-    ConfigResizeWindowsFromEdges = false;
+    ConfigResizeWindowsFromEdges = true;
 
     // Settings (User Functions)
     GetClipboardTextFn = GetClipboardTextFn_DefaultImpl;   // Platform dependent default implementations
@@ -9468,16 +9468,20 @@ void ImGui::EndDragDropTarget()
 // TODO:
 // A~ document root node resizing behavior incorrect
 // A~ document root node retrieval of ID ?
+// A~ Unreal style document system (requires low-level controls of dockspace serialization fork/copy/delete)
 // B- resize sibling locking behavior may be less desirable if we merged same-axis sibling in a same node level?
 // A- single visible node part of a hidden split hierarchy (OnlyNodeWithWindows) should show a normal tab bar
 // B~ SetNextWindowDock() calls (with conditional) -> defer everything to DockContextUpdate (repro: Documents->[X]Windows->Dock 1 elsewhere->Click Redock All
 // B- fix/disable auto-resize grip on split host nodes
 // B~ tidy up tab list popup buttons (see old ImGuiTabBarFlags_NoTabListPopupButton code)
 // B- DockSpace() border issues
+// B- inconsistent clipping/border 1-pixel issue (#2)
+// B- SetNextWindowFocus() doesn't seem to apply if the window is hidden this frame, need repro (#4)
 // B- implicit per-viewport dockspace to dock to
 // B- resizing a dock tree small currently has glitches (overlapping collapse and close button, etc.)
+// B- tab bar: appearing on first frame with a dumb layout would do less harm that not appearing? (when behind dynamic branch) or store titles + render in EndTabBar()
 // B- tab bar: make selected tab always shows its full title?
-// B- tab bar: the order/focus restoring code could be part of TabBar and not DockNode?
+// B- tab bar: the order/focus restoring code could be part of TabBar and not DockNode? (#8)
 // B- nav: CTRL+TAB highlighting tabs shows the mismatch between focus-stack and tab-order (not visible in VS because it doesn't highlight the tabs)
 // B- nav: design interactions so nav controls can dock/undock
 //-----------------------------------------------------------------------------

+ 1 - 1
imgui.h

@@ -1195,7 +1195,7 @@ struct ImGuiIO
     bool          ConfigDockingWithKeyMod;      // = true           // Enable docking with holding Shift key (reduce visual noise, allows dropping in wider space)
     bool          ConfigMacOSXBehaviors;        // = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl (was called io.OptMacOSXBehaviors prior to 1.63)
     bool          ConfigInputTextCursorBlink;   // = true           // Set to false to disable blinking cursor, for users who consider it distracting. (was called: io.OptCursorBlink prior to 1.63)
-    bool          ConfigResizeWindowsFromEdges; // = false          // [BETA] Enable resizing of windows from their edges and from the lower-left corner. This requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback. (This used to be the ImGuiWindowFlags_ResizeFromAnySide flag)
+    bool          ConfigResizeWindowsFromEdges; // = true           // [BETA] Enable resizing of windows from their edges and from the lower-left corner. This requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback. (This used to be the ImGuiWindowFlags_ResizeFromAnySide flag)
 
     //------------------------------------------------------------------
     // Settings (User Functions)

+ 2 - 2
imgui_demo.cpp

@@ -267,7 +267,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
             ImGui::MenuItem("Simple overlay", NULL, &show_app_simple_overlay);
             ImGui::MenuItem("Manipulating window titles", NULL, &show_app_window_titles);
             ImGui::MenuItem("Custom rendering", NULL, &show_app_custom_rendering);
-            ImGui::MenuItem("Docking", NULL, &show_app_dockspace);
+            ImGui::MenuItem("Dockspace", NULL, &show_app_dockspace);
             ImGui::MenuItem("Documents", NULL, &show_app_documents);
             ImGui::EndMenu();
         }
@@ -3713,7 +3713,7 @@ void ShowExampleAppDockSpace(bool* p_open)
         flags |= ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus;
     }
     ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
-    ImGui::Begin("Docking Documents Demo", p_open, flags);
+    ImGui::Begin("DockSpace Demo", p_open, flags);
     ImGui::PopStyleVar();
 
     if (ImGui::BeginMenuBar())

+ 4 - 4
imgui_widgets.cpp

@@ -6496,15 +6496,15 @@ bool    ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
         TabBarCloseTab(tab_bar, tab);
     }
 
-    // Tooltip (FIXME: Won't work over the close button because ItemOverlap systems messes up with HoveredIdTimer)
-    if (g.HoveredId == id && !held && g.HoveredIdTimer > 0.50f)
-        SetTooltip("%.*s", (int)(FindRenderedTextEnd(label) - label), label);
-
     // Restore main window position so user can draw there
     if (want_clip_rect)
         PopClipRect();
     window->DC.CursorPos = backup_main_cursor_pos;
 
+    // Tooltip (FIXME: Won't work over the close button because ItemOverlap systems messes up with HoveredIdTimer)
+    if (g.HoveredId == id && !held && g.HoveredIdTimer > 0.50f)
+        SetTooltip("%.*s", (int)(FindRenderedTextEnd(label) - label), label);
+
     return tab_contents_visible;
 }