mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-20 08:58:00 +02:00
Separate Close Panel and Close Document
This commit is contained in:
parent
077ebe2659
commit
da508156c1
3 changed files with 50 additions and 6 deletions
|
@ -190,7 +190,8 @@ namespace IDE
|
|||
Add("Clean", new => gApp.Cmd_Clean);
|
||||
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 Document", new () => { gApp.[Friend]TryCloseCurrentDocument(); });
|
||||
Add("Close Panel", new () => { gApp.[Friend]TryCloseCurrentPanel(); });
|
||||
Add("Close Workspace", new => gApp.[Friend]Cmd_CloseWorkspaceAndSetupNew);
|
||||
Add("Comment Selection", new => gApp.[Friend]CommentSelection);
|
||||
Add("Compile File", new => gApp.Cmd_CompileFile);
|
||||
|
|
|
@ -5065,6 +5065,11 @@ namespace IDE
|
|||
menu.SetDisabled(GetActiveDocumentPanel() == null);
|
||||
}
|
||||
|
||||
public void UpdateMenuItem_HasLastActiveDocument(IMenu menu)
|
||||
{
|
||||
menu.SetDisabled(GetLastActiveDocumentPanel() == null);
|
||||
}
|
||||
|
||||
public void UpdateMenuItem_HasWorkspace(IMenu menu)
|
||||
{
|
||||
menu.SetDisabled(!gApp.mWorkspace.IsInitialized);
|
||||
|
@ -5377,7 +5382,8 @@ namespace IDE
|
|||
//////////
|
||||
|
||||
mWindowMenu = root.AddMenuItem("&Window");
|
||||
AddMenuItem(mWindowMenu, "&Close", "Close Panel", new => UpdateMenuItem_HasActivePanel);
|
||||
AddMenuItem(mWindowMenu, "&Close Document", "Close Document", new => UpdateMenuItem_HasLastActiveDocument);
|
||||
AddMenuItem(mWindowMenu, "Close &Panel", "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);
|
||||
|
@ -5588,6 +5594,24 @@ namespace IDE
|
|||
return null;
|
||||
}
|
||||
|
||||
public Widget GetLastActiveDocumentPanel()
|
||||
{
|
||||
var activePanel = GetActiveDocumentPanel();
|
||||
if (activePanel != null)
|
||||
return activePanel;
|
||||
if (mActiveDocumentsTabbedView != null)
|
||||
{
|
||||
let activeTab = mActiveDocumentsTabbedView.GetActiveTab();
|
||||
if (activeTab != null)
|
||||
{
|
||||
var lastActivePanel = activeTab.mContent;
|
||||
if ((lastActivePanel is SourceViewPanel) || (lastActivePanel is DisassemblyPanel))
|
||||
return lastActivePanel;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void WithTabs(delegate void(TabbedView.TabButton) func)
|
||||
{
|
||||
WithDocumentTabbedViews(scope (documentTabbedView) =>
|
||||
|
@ -6514,7 +6538,7 @@ namespace IDE
|
|||
|
||||
void TryCloseCurrentDocument()
|
||||
{
|
||||
var activeDocumentPanel = GetActiveDocumentPanel();
|
||||
var activeDocumentPanel = GetLastActiveDocumentPanel();
|
||||
if (activeDocumentPanel != null)
|
||||
{
|
||||
if (activeDocumentPanel is SourceViewPanel)
|
||||
|
@ -6524,13 +6548,28 @@ namespace IDE
|
|||
return;
|
||||
}
|
||||
CloseDocument(activeDocumentPanel);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void TryCloseCurrentPanel()
|
||||
{
|
||||
var activeDocumentPanel = GetActiveDocumentPanel();
|
||||
if (activeDocumentPanel != null)
|
||||
{
|
||||
if (activeDocumentPanel is SourceViewPanel)
|
||||
{
|
||||
var sourceViewPanel = (SourceViewPanel)activeDocumentPanel;
|
||||
DocumentCloseClicked(sourceViewPanel);
|
||||
return;
|
||||
}
|
||||
CloseDocument(activeDocumentPanel);
|
||||
return;
|
||||
}
|
||||
|
||||
var activePanel = GetActivePanel();
|
||||
if (activePanel != null)
|
||||
CloseDocument(activePanel);
|
||||
}
|
||||
}
|
||||
|
||||
void TryCloseAllDocuments(bool closeCurrent)
|
||||
{
|
||||
|
|
|
@ -670,7 +670,7 @@ namespace IDE
|
|||
Add("Breakpoint Toggle Thread", "Shift+F9");
|
||||
Add("Build Solution", "F7");
|
||||
Add("Cancel Build", "Ctrl+Break");
|
||||
Add("Close Panel", "Ctrl+W");
|
||||
Add("Close Document", "Ctrl+W");
|
||||
Add("Compile File", "Ctrl+F7");
|
||||
Add("Comment Selection", "Ctrl+K, Ctrl+C");
|
||||
Add("Duplicate Line", "Ctrl+D");
|
||||
|
@ -890,6 +890,10 @@ namespace IDE
|
|||
let entry = new Entry();
|
||||
entry.mCommand = new String(cmdStr);
|
||||
|
||||
// Fix for command rename
|
||||
if ((cmdStr == "Close Panel") && (!sd.Contains("Close Document")))
|
||||
entry.mCommand.Set("Close Document");
|
||||
|
||||
let keyList = scope List<KeyState>();
|
||||
KeyState.Parse(keyStr, keyList);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue