2023-06-17 17:00:55 +00:00
|
|
|
WORKSPACE_COMMAND(Workspace_Command_SplitPanelHorizontal)
|
|
|
|
{
|
2023-07-19 15:09:41 +00:00
|
|
|
workspace *Workspace = Workspace_GetState();
|
|
|
|
Workspace_SplitPanel(Workspace->CurrentPanel, Axis2_X);
|
2023-06-17 17:00:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
WORKSPACE_COMMAND(Workspace_Command_SplitPanelVertical)
|
|
|
|
{
|
2023-07-19 15:09:41 +00:00
|
|
|
workspace *Workspace = Workspace_GetState();
|
|
|
|
Workspace_SplitPanel(Workspace->CurrentPanel, Axis2_Y);
|
2023-06-17 17:00:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
WORKSPACE_COMMAND(Workspace_Command_ClosePanel)
|
|
|
|
{
|
2023-07-19 15:09:41 +00:00
|
|
|
workspace *Workspace = Workspace_GetState();
|
|
|
|
|
2023-06-17 17:00:55 +00:00
|
|
|
workspace_panel *Panel = (workspace_panel *)Argument;
|
|
|
|
if(!Panel)
|
|
|
|
{
|
|
|
|
Panel = Workspace->CurrentPanel;
|
|
|
|
}
|
|
|
|
|
|
|
|
workspace_panel *Parent = Panel->Parent;
|
|
|
|
|
|
|
|
Assert(Parent);
|
|
|
|
Assert(Panel != Workspace->RootPanel);
|
|
|
|
|
|
|
|
DLLRemove(Parent->First, Parent->Last, Panel);
|
|
|
|
|
|
|
|
b32 OneChildRemains = (Parent->First == Parent->Last);
|
|
|
|
if(OneChildRemains)
|
|
|
|
{
|
|
|
|
workspace_panel *Child = Parent->First;
|
|
|
|
Assert(DLLIsEmpty(Parent->FirstView));
|
|
|
|
|
|
|
|
Parent->FirstView = Child->FirstView;
|
|
|
|
Parent->LastView = Child->LastView;
|
|
|
|
Parent->First = Child->First;
|
|
|
|
Parent->Last = Child->Last;
|
|
|
|
Parent->SplitAxis = Child->SplitAxis;
|
|
|
|
|
|
|
|
// sixten: Update the parents of the children.
|
|
|
|
for(workspace_view *View = Parent->FirstView;
|
|
|
|
View != 0;
|
|
|
|
View = View->Next)
|
|
|
|
{
|
|
|
|
View->Parent = Parent;
|
|
|
|
}
|
|
|
|
for(workspace_panel *ParentChild = Parent->First;
|
|
|
|
ParentChild != 0;
|
|
|
|
ParentChild = ParentChild->Next)
|
|
|
|
{
|
|
|
|
ParentChild->Parent = Parent;
|
|
|
|
}
|
|
|
|
|
|
|
|
DLLRemove(Parent->First, Parent->Last, Child);
|
2023-07-19 15:09:41 +00:00
|
|
|
Workspace_DeletePanel(Child);
|
2023-06-17 17:00:55 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s32 ChildCount = 0;
|
|
|
|
for(workspace_panel *Child = Parent->First;
|
|
|
|
Child != 0;
|
|
|
|
Child = Child->Next)
|
|
|
|
{
|
|
|
|
++ChildCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
r32 ToAppend = Panel->PercentOfParent / ChildCount;
|
|
|
|
for(workspace_panel *Child = Parent->First;
|
|
|
|
Child != 0;
|
|
|
|
Child = Child->Next)
|
|
|
|
{
|
|
|
|
Child->PercentOfParent += ToAppend;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// sixten: Delete all child views.
|
|
|
|
for(workspace_view *Child = Panel->FirstView;
|
|
|
|
Child != 0;
|
|
|
|
Child = Child->Next)
|
|
|
|
{
|
|
|
|
//Workspace_DeleteView(Child);
|
|
|
|
}
|
|
|
|
|
2023-07-19 15:09:41 +00:00
|
|
|
Workspace_DeletePanel(Panel);
|
|
|
|
}
|
|
|
|
|
2023-08-06 10:35:09 +00:00
|
|
|
WORKSPACE_COMMAND(Workspace_Command_OpenView)
|
|
|
|
{
|
|
|
|
workspace *Workspace = Workspace_GetState();
|
|
|
|
Workspace_CreateNewView((workspace_view_type)Argument, Workspace->CurrentPanel);
|
|
|
|
}
|
|
|
|
|
2023-07-19 15:09:41 +00:00
|
|
|
#if VN_INTERNAL
|
|
|
|
WORKSPACE_COMMAND(Workspace_Command_ToggleRenderUIDebugRects)
|
|
|
|
{
|
|
|
|
DEBUG_DebugSettings->RenderUIDebugRects = !DEBUG_DebugSettings->RenderUIDebugRects;
|
|
|
|
}
|
|
|
|
#endif
|