Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added close_tab variations #221

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/df/core/df_core.mdesk
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ DF_CoreCmdTable:// | | |
{MoveTabLeft 0 Null Nil 0 0 0 0 0 0 LeftArrow "move_tab_left" "Move Tab Left" "Moves the selected tab left one slot." "" }
{OpenTab 1 Null Nil 0 0 0 0 0 0 Null "open_tab" "Open Tab" "Opens a new tab with the parameterized view specification." "" }
{CloseTab 0 Null Nil 0 0 0 0 0 0 X "close_tab" "Close Tab" "Closes the currently opened tab." "" }
{CloseAllOtherTabs 0 Null Nil 0 0 0 0 0 0 X "close_all_other_tabs" "Close All Others" "Closes all the tabs except this one." "" }
{CloseAllLeftTabs 0 Null Nil 0 0 0 0 0 0 X "close_all_left_tabs" "Close All (Left)" "Closes all the tabs to the left." "" }
{CloseAllRightTabs 0 Null Nil 0 0 0 0 0 0 X "close_all_right_tabs" "Close All (Right)" "Closes the the tabs to the right." "" }
{CloseAllTabs 0 Null Nil 0 0 0 0 0 0 X "close_all_tabs" "Close All" "Closes all the tabs." "" }
{MoveTab 1 Null Nil 0 0 0 0 0 0 Null "move_tab" "Move Tab" "Moves a tab to a new panel." "" }
{TabBarTop 0 Null Nil 0 0 0 0 0 0 UpArrow "tab_bar_top" "Anchor Tab Bar To Top" "Anchors a panel's tab bar to the top of the panel." "" }
{TabBarBottom 0 Null Nil 0 0 0 0 0 0 DownArrow "tab_bar_bottom" "Anchor Tab Bar To Bottom" "Anchors a panel's tab bar to the bottom of the panel." "" }
Expand Down
6 changes: 5 additions & 1 deletion src/df/core/generated/df_core.meta.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ DF_CoreCmdKind_Null,
DF_CoreCmdKind_Null,
};

DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[221] =
DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[225] =
{
{ str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
{ str8_lit_comp("exit"), str8_lit_comp("Exits the debugger."), str8_lit_comp("quit,close,abort"), str8_lit_comp("Exit"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_X},
Expand Down Expand Up @@ -292,6 +292,10 @@ DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[221] =
{ str8_lit_comp("move_tab_left"), str8_lit_comp("Moves the selected tab left one slot."), str8_lit_comp(""), str8_lit_comp("Move Tab Left"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_LeftArrow},
{ str8_lit_comp("open_tab"), str8_lit_comp("Opens a new tab with the parameterized view specification."), str8_lit_comp(""), str8_lit_comp("Open Tab"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
{ str8_lit_comp("close_tab"), str8_lit_comp("Closes the currently opened tab."), str8_lit_comp(""), str8_lit_comp("Close Tab"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_X},
{ str8_lit_comp("close_all_other_tabs"), str8_lit_comp("Closes all the tabs except this one."), str8_lit_comp(""), str8_lit_comp("Close All Others"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_X},
{ str8_lit_comp("close_all_left_tabs"), str8_lit_comp("Closes all the tabs to the left."), str8_lit_comp(""), str8_lit_comp("Close All (Left)"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_X},
{ str8_lit_comp("close_all_right_tabs"), str8_lit_comp("Closes the the tabs to the right."), str8_lit_comp(""), str8_lit_comp("Close All (Right)"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_X},
{ str8_lit_comp("close_all_tabs"), str8_lit_comp("Closes all the tabs."), str8_lit_comp(""), str8_lit_comp("Close All"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_X},
{ str8_lit_comp("move_tab"), str8_lit_comp("Moves a tab to a new panel."), str8_lit_comp(""), str8_lit_comp("Move Tab"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
{ str8_lit_comp("tab_bar_top"), str8_lit_comp("Anchors a panel's tab bar to the top of the panel."), str8_lit_comp(""), str8_lit_comp("Anchor Tab Bar To Top"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_UpArrow},
{ str8_lit_comp("tab_bar_bottom"), str8_lit_comp("Anchors a panel's tab bar to the bottom of the panel."), str8_lit_comp(""), str8_lit_comp("Anchor Tab Bar To Bottom"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_DownArrow},
Expand Down
4 changes: 4 additions & 0 deletions src/df/core/generated/df_core.meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ DF_CoreCmdKind_MoveTabRight,
DF_CoreCmdKind_MoveTabLeft,
DF_CoreCmdKind_OpenTab,
DF_CoreCmdKind_CloseTab,
DF_CoreCmdKind_CloseAllOtherTabs,
DF_CoreCmdKind_CloseAllLeftTabs,
DF_CoreCmdKind_CloseAllRightTabs,
DF_CoreCmdKind_CloseAllTabs,
DF_CoreCmdKind_MoveTab,
DF_CoreCmdKind_TabBarTop,
DF_CoreCmdKind_TabBarBottom,
Expand Down
114 changes: 114 additions & 0 deletions src/df/gfx/df_gfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2061,6 +2061,73 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
df_panel_notify_mutation(ws, panel);
}
}break;
case DF_CoreCmdKind_CloseAllOtherTabs:
{
DF_Panel *panel = df_panel_from_handle(params.panel);
DF_View *view = df_view_from_handle(params.view);
if(!df_view_is_nil(view))
{
for(DF_View *v = panel->first_tab_view; !df_view_is_nil(v);)
{
DF_View *temp_view = v;
v = temp_view->next;
if(view != temp_view)
{
df_panel_remove_tab_view(panel, temp_view);
df_view_release(temp_view);
df_panel_notify_mutation(ws, panel);
}
}
}
}break;
case DF_CoreCmdKind_CloseAllLeftTabs:
{
DF_Panel *panel = df_panel_from_handle(params.panel);
DF_View *view = df_view_from_handle(params.view);
if(!df_view_is_nil(view))
{
for(DF_View *v = view->prev; !df_view_is_nil(v);)
{
DF_View *temp_view = v;
v = temp_view->prev;
df_panel_remove_tab_view(panel, temp_view);
df_view_release(temp_view);
df_panel_notify_mutation(ws, panel);
}
}
}break;
case DF_CoreCmdKind_CloseAllRightTabs:
{
DF_Panel *panel = df_panel_from_handle(params.panel);
DF_View *view = df_view_from_handle(params.view);
if(!df_view_is_nil(view))
{
for(DF_View *v = view->next; !df_view_is_nil(v);)
{
DF_View *temp_view = v;
v = temp_view->next;
df_panel_remove_tab_view(panel, temp_view);
df_view_release(temp_view);
df_panel_notify_mutation(ws, panel);
}
}
}break;
case DF_CoreCmdKind_CloseAllTabs:
{
DF_Panel *panel = df_panel_from_handle(params.panel);
DF_View *view = df_view_from_handle(params.view);
if(!df_view_is_nil(view))
{
for(DF_View *v = panel->first_tab_view; !df_view_is_nil(v);)
{
DF_View *temp_view = v;
v = temp_view->next;
df_panel_remove_tab_view(panel, temp_view);
df_view_release(temp_view);
df_panel_notify_mutation(ws, panel);
}
}
}break;
case DF_CoreCmdKind_MoveTab:
{
DF_Panel *src_panel = df_panel_from_handle(params.panel);
Expand Down Expand Up @@ -4352,6 +4419,53 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
ui_ctx_menu_close();
}

// close all other tabs
if(ui_clicked(df_icon_buttonf(DF_IconKind_X, 0, "Close All Other Tabs")))
{
DF_CmdParams params = df_cmd_params_from_window(ws);
{
params.view = df_handle_from_view(view);
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_View);
}
df_push_cmd__root(&params, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_CloseAllOtherTabs));
ui_ctx_menu_close();
}

// close all (left) tabs
if(ui_clicked(df_icon_buttonf(DF_IconKind_X, 0, "Close All (Left) Tabs")))
{
DF_CmdParams params = df_cmd_params_from_window(ws);
{
params.view = df_handle_from_view(view);
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_View);
}
df_push_cmd__root(&params, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_CloseAllLeftTabs));
ui_ctx_menu_close();
}

// close all (right) tabs
if(ui_clicked(df_icon_buttonf(DF_IconKind_X, 0, "Close All (Right) Tabs")))
{
DF_CmdParams params = df_cmd_params_from_window(ws);
{
params.view = df_handle_from_view(view);
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_View);
}
df_push_cmd__root(&params, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_CloseAllRightTabs));
ui_ctx_menu_close();
}

// close all tabs
if(ui_clicked(df_icon_buttonf(DF_IconKind_X, 0, "Close All Tabs")))
{
DF_CmdParams params = df_cmd_params_from_window(ws);
{
params.view = df_handle_from_view(view);
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_View);
}
df_push_cmd__root(&params, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_CloseAllTabs));
ui_ctx_menu_close();
}
}

scratch_end(scratch);
Expand Down
Loading