1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-24 18:48:01 +02:00

IDE - Close All Except / Close Tabs

This commit is contained in:
Brian Fiete 2020-09-11 17:47:38 -07:00
parent 7f3ab3878f
commit 8d934192c0
4 changed files with 52 additions and 21 deletions

View file

@ -188,8 +188,9 @@ namespace IDE
Add("Cancel Build", new => gApp.[Friend]CancelBuild);
Add("Clean Beef", new => gApp.Cmd_CleanBeef);
Add("Clean", new => gApp.Cmd_Clean);
Add("Close All Windows", new () => { gApp.[Friend]TryCloseAllDocuments(); });
Add("Close Window", new () => { gApp.[Friend]TryCloseCurrentDocument(); });
Add("Close All Panels", new () => { gApp.[Friend]TryCloseAllDocuments(true); });
Add("Close All Panels Except", new () => { gApp.[Friend]TryCloseAllDocuments(false); });
Add("Close Panel", new () => { gApp.[Friend]TryCloseCurrentDocument(); });
Add("Close Workspace", new => gApp.[Friend]Cmd_CloseWorkspaceAndSetupNew);
Add("Comment Selection", new => gApp.[Friend]CommentSelection);
Add("Compile File", new => gApp.Cmd_CompileFile);

View file

@ -5342,8 +5342,9 @@ namespace IDE
//////////
mWindowMenu = root.AddMenuItem("&Window");
AddMenuItem(mWindowMenu, "&Close", "Close Window", new => UpdateMenuItem_HasActivePanel);
AddMenuItem(mWindowMenu, "&Close All", "Close All Windows");
AddMenuItem(mWindowMenu, "&Close", "Close Panel", new => UpdateMenuItem_HasActivePanel);
AddMenuItem(mWindowMenu, "&Close All", "Close All Panels");
AddMenuItem(mWindowMenu, "Close All Except Current", "Close All Panels Except");
AddMenuItem(mWindowMenu, "&New View into File", "View New", new => UpdateMenuItem_HasActiveDocument);
AddMenuItem(mWindowMenu, "&Split View", "View Split", new => UpdateMenuItem_HasActiveDocument);
@ -6484,15 +6485,20 @@ namespace IDE
CloseDocument(activePanel);
}
void TryCloseAllDocuments()
void TryCloseAllDocuments(bool closeCurrent)
{
var docPanels = scope List<Widget>();
Widget skipDocumentPanel = null;
if (!closeCurrent)
skipDocumentPanel = GetActiveDocumentPanel();
WithTabs(scope [&] (tab) =>
{
if ((tab.mContent is SourceViewPanel) || (tab.mTabbedView.mIsFillWidget))
{
docPanels.Add(tab.mContent);
{
if (tab.mContent != skipDocumentPanel)
docPanels.Add(tab.mContent);
}
});

View file

@ -670,7 +670,7 @@ namespace IDE
Add("Breakpoint Toggle Thread", "Shift+F9");
Add("Build Solution", "F7");
Add("Cancel Build", "Ctrl+Break");
Add("Close Window", "Ctrl+W");
Add("Close Panel", "Ctrl+W");
Add("Compile File", "Ctrl+F7");
Add("Comment Selection", "Ctrl+K, Ctrl+C");
Add("Duplicate Line", "Ctrl+D");