GUI: finish lock layout

This commit is contained in:
tildearrow 2022-05-24 02:38:10 -05:00
parent eb926a668d
commit d490746325
5 changed files with 13 additions and 7 deletions

View File

@ -14,7 +14,6 @@
- volume commands should work on Game Boy
- add another FM editor layout
- try to find out why does VSlider not accept keyboard input
- finish lock layout
- if macros have release, note off should release them
- add ability to select a column by double clicking
- add ability to move selection by dragging

View File

@ -3909,6 +3909,8 @@ void ImGui::StartMouseMovingWindowOrNode(ImGuiWindow* window, ImGuiDockNode* nod
if (root_node->OnlyNodeWithWindows != node || root_node->CentralNode != NULL) // -V1051 PVS-Studio thinks node should be root_node and is wrong about that.
if (undock_floating_node || root_node->IsDockSpace())
can_undock_node = true;
if (node->MergedFlags & ImGuiDockNodeFlags_NoMove)
can_undock_node = false;
}
const bool clicked = IsMouseClicked(0);
@ -6122,7 +6124,7 @@ void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar
// Docking: Unhide tab bar (small triangle in the corner), drag from small triangle to quickly undock
ImGuiDockNode* node = window->DockNode;
if (window->DockIsActive && node->IsHiddenTabBar() && !node->IsNoTabBar())
if (window->DockIsActive && node->IsHiddenTabBar() && !node->IsNoTabBar() && !(node->MergedFlags & ImGuiDockNodeFlags_NoMove))
{
float unhide_sz_draw = ImFloor(g.FontSize * 0.70f);
float unhide_sz_hit = ImFloor(g.FontSize * 0.55f);

View File

@ -1342,7 +1342,8 @@ enum ImGuiDockNodeFlags_
ImGuiDockNodeFlags_PassthruCentralNode = 1 << 3, // Shared // Enable passthru dockspace: 1) DockSpace() will render a ImGuiCol_WindowBg background covering everything excepted the Central Node when empty. Meaning the host window should probably use SetNextWindowBgAlpha(0.0f) prior to Begin() when using this. 2) When Central Node is empty: let inputs pass-through + won't display a DockingEmptyBg background. See demo for details.
ImGuiDockNodeFlags_NoSplit = 1 << 4, // Shared/Local // Disable splitting the node into smaller nodes. Useful e.g. when embedding dockspaces into a main root one (the root one may have splitting disabled to reduce confusion). Note: when turned off, existing splits will be preserved.
ImGuiDockNodeFlags_NoResize = 1 << 5, // Shared/Local // Disable resizing node using the splitter/separators. Useful with programmatically setup dockspaces.
ImGuiDockNodeFlags_AutoHideTabBar = 1 << 6 // Shared/Local // Tab bar will automatically hide when there is a single window in the dock node.
ImGuiDockNodeFlags_AutoHideTabBar = 1 << 6, // Shared/Local // Tab bar will automatically hide when there is a single window in the dock node.
ImGuiDockNodeFlags_NoMove = 1 << 7 // Shared/Local // Disable moving node
};
// Flags for ImGui::BeginDragDropSource(), ImGui::AcceptDragDropPayload()

View File

@ -8160,12 +8160,16 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
// Drag and drop a single floating window node moves it
ImGuiDockNode* node = docked_window ? docked_window->DockNode : NULL;
const bool single_floating_window_node = node && node->IsFloatingNode() && (node->Windows.Size == 1);
bool can_undock = true;
if (node) {
if (node->MergedFlags & ImGuiDockNodeFlags_NoMove) can_undock = false;
}
if (held && single_floating_window_node && IsMouseDragging(0, 0.0f))
{
// Move
StartMouseMovingWindow(docked_window);
}
else if (held && !tab_appearing && IsMouseDragging(0))
else if (held && !tab_appearing && IsMouseDragging(0) && can_undock)
{
// Drag and drop: re-order tabs
int drag_dir = 0;
@ -8247,7 +8251,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
flags |= ImGuiTabItemFlags_NoCloseWithMiddleMouseButton;
// Render tab label, process close button
const ImGuiID close_button_id = p_open ? GetIDWithSeed("#CLOSE", NULL, docked_window ? docked_window->ID : id) : 0;
const ImGuiID close_button_id = (p_open && can_undock) ? GetIDWithSeed("#CLOSE", NULL, docked_window ? docked_window->ID : id) : 0;
bool just_closed;
bool text_clipped;
TabItemLabelAndCloseButton(display_draw_list, bb, flags, tab_bar->FramePadding, label, id, close_button_id, tab_contents_visible, &just_closed, &text_clipped);

View File

@ -3022,8 +3022,8 @@ bool FurnaceGUI::loop() {
drawPattern();
drawPiano();
} else {
globalWinFlags=lockLayout?ImGuiWindowFlags_NoMove:0;
ImGui::DockSpaceOverViewport(NULL,lockLayout?(ImGuiDockNodeFlags_NoResize|ImGuiDockNodeFlags_NoCloseButton|ImGuiDockNodeFlags_NoDocking|ImGuiDockNodeFlags_NoDockingSplitMe|ImGuiDockNodeFlags_NoDockingSplitOther):0);
globalWinFlags=0;
ImGui::DockSpaceOverViewport(NULL,lockLayout?(ImGuiDockNodeFlags_NoWindowMenuButton|ImGuiDockNodeFlags_NoMove|ImGuiDockNodeFlags_NoResize|ImGuiDockNodeFlags_NoCloseButton|ImGuiDockNodeFlags_NoDocking|ImGuiDockNodeFlags_NoDockingSplitMe|ImGuiDockNodeFlags_NoDockingSplitOther):0);
drawSubSongs();
drawPattern();