Docking: Minor renaming. DockContextAddNode() uses 0 as marker for automatic ID selection + TODO update and moved docking entries to docs/TODO.txt

This commit is contained in:
omar 2018-09-25 22:05:53 +02:00
parent d3e8e5731a
commit dc92431328
3 changed files with 37 additions and 41 deletions

View File

@ -123,8 +123,30 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
- splitter/separator: formalize the splitter idiom into an official api (we want to handle n-way split) (#319) - splitter/separator: formalize the splitter idiom into an official api (we want to handle n-way split) (#319)
- dock: docking extension - dock: A~ Unreal style document system (requires low-level controls of dockspace serialization fork/copy/delete)
- dock: dock out from a collapsing header? would work nicely but need emitting window to keep submitting the code. - dock: A- implicit, invisible per-viewport dockspace to dock to.
- dock: B~ document root node resizing behavior incorrect
- dock: B~ document root node retrieval of ID ?
- dock: B- full rebuild loses viewport of floating dock nodes
- dock: B- dock node inside its own viewports creates 1 temporary viewport per window on startup before ditching them
- dock: B- resize sibling locking behavior may be less desirable if we merged same-axis sibling in a same node level?
- dock: A- single visible node part of a hidden split hierarchy (OnlyNodeWithWindows != NULL) should show a normal title bar (not a tab bar)
- dock: B~ SetNextWindowDock() calls (with conditional) -> defer everything to DockContextUpdate (repro: Documents->[X]Windows->Dock 1 elsewhere->Click Redock All
- dock: B~ tidy up tab list popup buttons features (available with manual tab-bar, see ImGuiTabBarFlags_NoTabListPopupButton code, not used by docking nodes)
- dock: B- DockSpace() border issues
- dock: B- inconsistent clipping/border 1-pixel issue (#2)
- dock: B- fix/disable auto-resize grip on split host nodes (~#2)
- dock: B- SetNextWindowFocus() doesn't seem to apply if the window is hidden this frame, need repro (#4)
- dock: B- resizing a dock tree small currently has glitches (overlapping collapse and close button, etc.)
- dock: B- dpi: look at interaction with the hi-dpi and multi-dpi stuff.
- dock: 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()
- dock: B- tab bar: make selected tab always shows its full title?
- dock: B- tab bar: the order/focus restoring code could be part of TabBar and not DockNode? (#8)
- dock: B- nav: design interactions so nav controls can dock/undock
- dock: B- dockspace: flag to lock the dock tree and/or sizes
- dock: B- reintroduce collapsing a floating dock node. also collapsing a docked dock node!
- dock: B- allow dragging a non-floating dock node by clicking on the title-bar-looking section (not just the collapse/menu button)
- dock: C- 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)
- tabs: re-ordering, close buttons, context menu, persistent order (#261, #351) - tabs: re-ordering, close buttons, context menu, persistent order (#261, #351)

View File

@ -9539,31 +9539,6 @@ void ImGui::EndDragDropTarget()
// Docking: Begin/End Functions (called from Begin/End) // Docking: Begin/End Functions (called from Begin/End)
// Docking: Settings // Docking: Settings
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// TODO:
// A~ document root node resizing behavior incorrect
// A~ document root node retrieval of ID ?
// B- full rebuild loses viewport of floating dock nodes
// B- dock node inside its own viewports creates 1 temporary viewport per window on startup before ditching them
// A~ Unreal style document system (requires low-level controls of dockspace serialization fork/copy/delete)
// B- implicit, invisible per-viewport dockspace to dock to.
// 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 title bar (not a tab bar)
// B~ SetNextWindowDock() calls (with conditional) -> defer everything to DockContextUpdate (repro: Documents->[X]Windows->Dock 1 elsewhere->Click Redock All
// 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- fix/disable auto-resize grip on split host nodes (~#2)
// B- SetNextWindowFocus() doesn't seem to apply if the window is hidden this frame, need repro (#4)
// B- resizing a dock tree small currently has glitches (overlapping collapse and close button, etc.)
// B- dpi: look at interaction with the hi-dpi and multi-dpi stuff.
// 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? (#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
// B- dockspace: flag to lock the dock tree and/or sizes
// C- allow dragging a non-floating dock node by clicking on the title-bar-looking section (not just the collapse/menu button)
//-----------------------------------------------------------------------------
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Docking: Internal Types // Docking: Internal Types
@ -9831,7 +9806,7 @@ static ImGuiDockNode* ImGui::DockContextFindNodeByID(ImGuiContext* ctx, ImGuiID
static ImGuiDockNode* ImGui::DockContextAddNode(ImGuiContext* ctx, ImGuiID id) static ImGuiDockNode* ImGui::DockContextAddNode(ImGuiContext* ctx, ImGuiID id)
{ {
// Generate an ID for the new node (the exact ID value doesn't matter as long as it is not already used) and add the first window. // Generate an ID for the new node (the exact ID value doesn't matter as long as it is not already used) and add the first window.
if (id == (ImGuiID)-1) if (id == 0)
{ {
// FIXME-OPT: This is suboptimal, even if the node count is small enough not to be a worry. We could poke in ctx->Nodes to find a suitable ID faster. // FIXME-OPT: This is suboptimal, even if the node count is small enough not to be a worry. We could poke in ctx->Nodes to find a suitable ID faster.
id = 0x0001; id = 0x0001;
@ -10045,7 +10020,7 @@ void ImGui::DockContextProcessDock(ImGuiContext* ctx, ImGuiDockRequest* req)
// Create new node and add existing window to it // Create new node and add existing window to it
if (target_node == NULL) if (target_node == NULL)
{ {
target_node = DockContextAddNode(ctx, (ImGuiID)-1); target_node = DockContextAddNode(ctx, 0);
target_node->Pos = target_window->Pos; target_node->Pos = target_window->Pos;
target_node->Size = target_window->Size; target_node->Size = target_window->Size;
if (target_window->DockNodeAsHost == NULL) if (target_window->DockNodeAsHost == NULL)
@ -10156,7 +10131,7 @@ void ImGui::DockContextProcessUndockNode(ImGuiContext* ctx, ImGuiDockNode* node)
if (node->IsRootNode()) if (node->IsRootNode())
{ {
// FIXME-DOCK: Transition persistent DockId for all non-active windows // FIXME-DOCK: Transition persistent DockId for all non-active windows
ImGuiDockNode* new_node = DockContextAddNode(ctx, (ImGuiID)-1); ImGuiDockNode* new_node = DockContextAddNode(ctx, 0);
DockNodeMoveWindows(new_node, node); DockNodeMoveWindows(new_node, node);
for (int n = 0; n < new_node->Windows.Size; n++) for (int n = 0; n < new_node->Windows.Size; n++)
UpdateWindowParentAndRootLinks(new_node->Windows[n], new_node->Windows[n]->Flags, NULL); UpdateWindowParentAndRootLinks(new_node->Windows[n], new_node->Windows[n]->Flags, NULL);
@ -10879,11 +10854,11 @@ static bool DockNodeIsDropAllowedOne(ImGuiWindow* payload, ImGuiWindow* host_win
ImGuiDockFamily* host_family = host_window->DockNodeAsHost ? &host_window->DockNodeAsHost->DockFamily : &host_window->DockFamily; ImGuiDockFamily* host_family = host_window->DockNodeAsHost ? &host_window->DockNodeAsHost->DockFamily : &host_window->DockFamily;
ImGuiDockFamily* payload_family = &payload->DockFamily; ImGuiDockFamily* payload_family = &payload->DockFamily;
if (host_family->FamilyId != payload_family->FamilyId) if (host_family->ID != payload_family->ID)
{ {
if (host_family->FamilyId != 0 && host_family->CompatibleWithFamilyZero && payload_family->FamilyId == 0) if (host_family->ID != 0 && host_family->CompatibleWithFamilyZero && payload_family->ID == 0)
return true; return true;
if (payload_family->FamilyId != 0 && payload_family->CompatibleWithFamilyZero && host_family->FamilyId == 0) if (payload_family->ID != 0 && payload_family->CompatibleWithFamilyZero && host_family->ID == 0)
return true; return true;
return false; return false;
} }
@ -11170,10 +11145,10 @@ void ImGui::DockNodeTreeSplit(ImGuiContext* ctx, ImGuiDockNode* parent_node, ImG
{ {
IM_ASSERT(split_axis != ImGuiAxis_None); IM_ASSERT(split_axis != ImGuiAxis_None);
ImGuiDockNode* child_0 = (new_node && split_inheritor_child_idx != 0) ? new_node : DockContextAddNode(ctx, (ImGuiID)-1); ImGuiDockNode* child_0 = (new_node && split_inheritor_child_idx != 0) ? new_node : DockContextAddNode(ctx, 0);
child_0->ParentNode = parent_node; child_0->ParentNode = parent_node;
ImGuiDockNode* child_1 = (new_node && split_inheritor_child_idx != 1) ? new_node : DockContextAddNode(ctx, (ImGuiID)-1); ImGuiDockNode* child_1 = (new_node && split_inheritor_child_idx != 1) ? new_node : DockContextAddNode(ctx, 0);
child_1->ParentNode = parent_node; child_1->ParentNode = parent_node;
ImGuiDockNode* child_inheritor = (split_inheritor_child_idx == 0) ? child_0 : child_1; ImGuiDockNode* child_inheritor = (split_inheritor_child_idx == 0) ? child_0 : child_1;
@ -11970,8 +11945,6 @@ static void ImGui::DockSettingsHandler_ReadLine(ImGuiContext* ctx, ImGuiSettings
if (sscanf(line, " Split=%c%n", &c, &r) == 1) { line += r; if (c == 'X') node.SplitAxis = ImGuiAxis_X; else if (c == 'Y') node.SplitAxis = ImGuiAxis_Y; } if (sscanf(line, " Split=%c%n", &c, &r) == 1) { line += r; if (c == 'X') node.SplitAxis = ImGuiAxis_X; else if (c == 'Y') node.SplitAxis = ImGuiAxis_Y; }
if (sscanf(line, " DocRoot=%d%n", &x, &r) == 1) { line += r; node.IsDocumentRoot = (x != 0); } if (sscanf(line, " DocRoot=%d%n", &x, &r) == 1) { line += r; node.IsDocumentRoot = (x != 0); }
if (sscanf(line, " SelectedTab=0x%08X%n", &node.SelectedTabID,&r) == 1) { line += r; } if (sscanf(line, " SelectedTab=0x%08X%n", &node.SelectedTabID,&r) == 1) { line += r; }
//if (node.ParentID == 0 && node.SplitAxis == ImGuiAxis_None)
// return;
ImGuiDockContext* dc = ctx->DockContext; ImGuiDockContext* dc = ctx->DockContext;
if (node.ParentID != 0) if (node.ParentID != 0)
if (ImGuiDockNodeSettings* parent_settings = DockSettingsFindNodeSettings(ctx, node.ParentID)) if (ImGuiDockNodeSettings* parent_settings = DockSettingsFindNodeSettings(ctx, node.ParentID))
@ -12035,7 +12008,8 @@ static void ImGui::DockSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettings
if (node_settings->SelectedTabID) if (node_settings->SelectedTabID)
buf->appendf(" SelectedTab=0x%08X", node_settings->SelectedTabID); buf->appendf(" SelectedTab=0x%08X", node_settings->SelectedTabID);
#if 0 // [DEBUG] Include comments in the .ini file to ease debugging #if 0
// [DEBUG] Include comments in the .ini file to ease debugging
if (ImGuiDockNode* node = DockContextFindNodeByID(ctx, node_settings->ID)) if (ImGuiDockNode* node = DockContextFindNodeByID(ctx, node_settings->ID))
{ {
buf->appendf("%*s", ImMax(2, (line_start_pos + 90) - buf->size()), ""); // Align everything buf->appendf("%*s", ImMax(2, (line_start_pos + 90) - buf->size()), ""); // Align everything
@ -12441,7 +12415,7 @@ static void SettingsHandlerWindow_WriteAll(ImGuiContext* imgui_ctx, ImGuiSetting
settings->ViewportPos = window->ViewportPos; settings->ViewportPos = window->ViewportPos;
IM_ASSERT(window->DockNode == NULL || window->DockNode->ID == window->DockId); IM_ASSERT(window->DockNode == NULL || window->DockNode->ID == window->DockId);
settings->DockId = window->DockId; settings->DockId = window->DockId;
settings->DockFamilyId = window->DockFamily.FamilyId; settings->DockFamilyId = window->DockFamily.ID;
settings->DockOrder = window->DockOrder; settings->DockOrder = window->DockOrder;
settings->Collapsed = window->Collapsed; settings->Collapsed = window->Collapsed;
} }

View File

@ -1568,10 +1568,10 @@ struct ImGuiSizeCallbackData
// For SetNextWindowDockFamily() and DockSpace() function // For SetNextWindowDockFamily() and DockSpace() function
struct ImGuiDockFamily struct ImGuiDockFamily
{ {
ImGuiID FamilyId; // 0 = unaffiliated ImGuiID ID; // 0 = unaffiliated
bool CompatibleWithFamilyZero; // true = can be docked/merged with an unaffiliated window bool CompatibleWithFamilyZero; // true = can be docked/merged with an unaffiliated window
ImGuiDockFamily() { FamilyId = 0; CompatibleWithFamilyZero = true; } ImGuiDockFamily() { ID = 0; CompatibleWithFamilyZero = true; }
}; };
// Data payload for Drag and Drop operations // Data payload for Drag and Drop operations