mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-14 14:24:10 +02:00
IDE - Close All Except / Close Tabs
This commit is contained in:
parent
7f3ab3878f
commit
8d934192c0
4 changed files with 52 additions and 21 deletions
|
@ -257,16 +257,17 @@ namespace Beefy.theme.dark
|
||||||
mTabbedView.mAutoClose = !mTabbedView.mAutoClose;
|
mTabbedView.mAutoClose = !mTabbedView.mAutoClose;
|
||||||
});
|
});
|
||||||
|
|
||||||
menuItem = menu.AddItem("Close");
|
void CloseTabs(bool autoClose, bool closeCurrent)
|
||||||
menuItem.mOnMenuItemSelected.Add(new (evt) =>
|
{
|
||||||
{
|
let prevAutoClose = mTabbedView.mAutoClose;
|
||||||
let prevAutoClose = mTabbedView.mAutoClose;
|
mTabbedView.mAutoClose = autoClose;
|
||||||
mTabbedView.mAutoClose = true;
|
var tabs = scope List<TabButton>();
|
||||||
var tabs = scope List<TabButton>();
|
for (var tab in mTabbedView.mTabs)
|
||||||
for (var tab in mTabbedView.mTabs)
|
tabs.Add(tab);
|
||||||
tabs.Add(tab);
|
|
||||||
|
|
||||||
if (tabs.IsEmpty)
|
if (tabs.IsEmpty)
|
||||||
|
{
|
||||||
|
if (autoClose)
|
||||||
{
|
{
|
||||||
if (var dockingFrame = mTabbedView.mParent as DockingFrame)
|
if (var dockingFrame = mTabbedView.mParent as DockingFrame)
|
||||||
{
|
{
|
||||||
|
@ -274,12 +275,35 @@ namespace Beefy.theme.dark
|
||||||
BFApp.sApp.DeferDelete(mTabbedView);
|
BFApp.sApp.DeferDelete(mTabbedView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (var tab in tabs)
|
||||||
{
|
{
|
||||||
for (var tab in tabs)
|
if ((!closeCurrent) && (tab.mIsActive))
|
||||||
tab.mCloseClickedEvent();
|
continue;
|
||||||
|
tab.mCloseClickedEvent();
|
||||||
}
|
}
|
||||||
mTabbedView.mAutoClose = prevAutoClose;
|
}
|
||||||
|
mTabbedView.mAutoClose = prevAutoClose;
|
||||||
|
}
|
||||||
|
|
||||||
|
menuItem = menu.AddItem("Close");
|
||||||
|
menuItem.mOnMenuItemSelected.Add(new (evt) =>
|
||||||
|
{
|
||||||
|
CloseTabs(true, true);
|
||||||
|
});
|
||||||
|
|
||||||
|
menuItem = menu.AddItem("Close Tabs");
|
||||||
|
menuItem.mOnMenuItemSelected.Add(new (evt) =>
|
||||||
|
{
|
||||||
|
CloseTabs(false, true);
|
||||||
|
});
|
||||||
|
|
||||||
|
menuItem = menu.AddItem("Close Tabs Except Current");
|
||||||
|
menuItem.mOnMenuItemSelected.Add(new (evt) =>
|
||||||
|
{
|
||||||
|
CloseTabs(false, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
menu.AddItem();
|
menu.AddItem();
|
||||||
|
|
|
@ -188,8 +188,9 @@ namespace IDE
|
||||||
Add("Cancel Build", new => gApp.[Friend]CancelBuild);
|
Add("Cancel Build", new => gApp.[Friend]CancelBuild);
|
||||||
Add("Clean Beef", new => gApp.Cmd_CleanBeef);
|
Add("Clean Beef", new => gApp.Cmd_CleanBeef);
|
||||||
Add("Clean", new => gApp.Cmd_Clean);
|
Add("Clean", new => gApp.Cmd_Clean);
|
||||||
Add("Close All Windows", new () => { gApp.[Friend]TryCloseAllDocuments(); });
|
Add("Close All Panels", new () => { gApp.[Friend]TryCloseAllDocuments(true); });
|
||||||
Add("Close Window", new () => { gApp.[Friend]TryCloseCurrentDocument(); });
|
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("Close Workspace", new => gApp.[Friend]Cmd_CloseWorkspaceAndSetupNew);
|
||||||
Add("Comment Selection", new => gApp.[Friend]CommentSelection);
|
Add("Comment Selection", new => gApp.[Friend]CommentSelection);
|
||||||
Add("Compile File", new => gApp.Cmd_CompileFile);
|
Add("Compile File", new => gApp.Cmd_CompileFile);
|
||||||
|
|
|
@ -5342,8 +5342,9 @@ namespace IDE
|
||||||
//////////
|
//////////
|
||||||
|
|
||||||
mWindowMenu = root.AddMenuItem("&Window");
|
mWindowMenu = root.AddMenuItem("&Window");
|
||||||
AddMenuItem(mWindowMenu, "&Close", "Close Window", new => UpdateMenuItem_HasActivePanel);
|
AddMenuItem(mWindowMenu, "&Close", "Close Panel", new => UpdateMenuItem_HasActivePanel);
|
||||||
AddMenuItem(mWindowMenu, "&Close All", "Close All Windows");
|
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, "&New View into File", "View New", new => UpdateMenuItem_HasActiveDocument);
|
||||||
AddMenuItem(mWindowMenu, "&Split View", "View Split", new => UpdateMenuItem_HasActiveDocument);
|
AddMenuItem(mWindowMenu, "&Split View", "View Split", new => UpdateMenuItem_HasActiveDocument);
|
||||||
|
|
||||||
|
@ -6484,15 +6485,20 @@ namespace IDE
|
||||||
CloseDocument(activePanel);
|
CloseDocument(activePanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TryCloseAllDocuments()
|
void TryCloseAllDocuments(bool closeCurrent)
|
||||||
{
|
{
|
||||||
var docPanels = scope List<Widget>();
|
var docPanels = scope List<Widget>();
|
||||||
|
|
||||||
|
Widget skipDocumentPanel = null;
|
||||||
|
if (!closeCurrent)
|
||||||
|
skipDocumentPanel = GetActiveDocumentPanel();
|
||||||
|
|
||||||
WithTabs(scope [&] (tab) =>
|
WithTabs(scope [&] (tab) =>
|
||||||
{
|
{
|
||||||
if ((tab.mContent is SourceViewPanel) || (tab.mTabbedView.mIsFillWidget))
|
if ((tab.mContent is SourceViewPanel) || (tab.mTabbedView.mIsFillWidget))
|
||||||
{
|
{
|
||||||
docPanels.Add(tab.mContent);
|
if (tab.mContent != skipDocumentPanel)
|
||||||
|
docPanels.Add(tab.mContent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -670,7 +670,7 @@ namespace IDE
|
||||||
Add("Breakpoint Toggle Thread", "Shift+F9");
|
Add("Breakpoint Toggle Thread", "Shift+F9");
|
||||||
Add("Build Solution", "F7");
|
Add("Build Solution", "F7");
|
||||||
Add("Cancel Build", "Ctrl+Break");
|
Add("Cancel Build", "Ctrl+Break");
|
||||||
Add("Close Window", "Ctrl+W");
|
Add("Close Panel", "Ctrl+W");
|
||||||
Add("Compile File", "Ctrl+F7");
|
Add("Compile File", "Ctrl+F7");
|
||||||
Add("Comment Selection", "Ctrl+K, Ctrl+C");
|
Add("Comment Selection", "Ctrl+K, Ctrl+C");
|
||||||
Add("Duplicate Line", "Ctrl+D");
|
Add("Duplicate Line", "Ctrl+D");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue