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

This commit is contained in:
omar 2018-09-07 19:17:30 +02:00
parent a82be53407
commit b872aa5c8e
5 changed files with 15 additions and 9 deletions

View File

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

View File

@ -1093,7 +1093,7 @@ ImGuiIO::ImGuiIO()
ConfigMacOSXBehaviors = false; ConfigMacOSXBehaviors = false;
#endif #endif
ConfigInputTextCursorBlink = true; ConfigInputTextCursorBlink = true;
ConfigResizeWindowsFromEdges = false; ConfigResizeWindowsFromEdges = true;
// Settings (User Functions) // Settings (User Functions)
GetClipboardTextFn = GetClipboardTextFn_DefaultImpl; // Platform dependent default implementations GetClipboardTextFn = GetClipboardTextFn_DefaultImpl; // Platform dependent default implementations
@ -9468,16 +9468,20 @@ void ImGui::EndDragDropTarget()
// TODO: // TODO:
// A~ document root node resizing behavior incorrect // A~ document root node resizing behavior incorrect
// A~ document root node retrieval of ID ? // 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? // 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 // 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~ 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- fix/disable auto-resize grip on split host nodes
// B~ tidy up tab list popup buttons (see old ImGuiTabBarFlags_NoTabListPopupButton code) // B~ tidy up tab list popup buttons (see old ImGuiTabBarFlags_NoTabListPopupButton code)
// B- DockSpace() border issues // 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- implicit per-viewport dockspace to dock to
// B- resizing a dock tree small currently has glitches (overlapping collapse and close button, etc.) // 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: 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: 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 // B- nav: design interactions so nav controls can dock/undock
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -1195,7 +1195,7 @@ struct ImGuiIO
bool ConfigDockingWithKeyMod; // = true // Enable docking with holding Shift key (reduce visual noise, allows dropping in wider space) 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 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 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) // Settings (User Functions)

View File

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

View File

@ -6496,15 +6496,15 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
TabBarCloseTab(tab_bar, tab); 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 // Restore main window position so user can draw there
if (want_clip_rect) if (want_clip_rect)
PopClipRect(); PopClipRect();
window->DC.CursorPos = backup_main_cursor_pos; 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; return tab_contents_visible;
} }