mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 20:42:21 +02:00
Per-window SourceViewPanel and Tab visitors
In order to fix an issue with closing secondary windows with changed, inactive 'SourceViewPanel's we need a way to visit the tabs of just a specific Window. The current 'SecondaryAllowClose' logic that relies on checking 'mWidgetWindow' is broken. This commit just introduces the needed utility methods and refactors the all-window methods to use them.
This commit is contained in:
parent
e33ca41fd0
commit
9fbfcb7a07
1 changed files with 53 additions and 39 deletions
|
@ -5560,30 +5560,32 @@ namespace IDE
|
|||
});
|
||||
}
|
||||
|
||||
public void WithDocumentTabbedViews(delegate void(DarkTabbedView) func)
|
||||
{
|
||||
for (int32 windowIdx = 0; windowIdx < mWindows.Count; windowIdx++)
|
||||
{
|
||||
var window = mWindows[windowIdx];
|
||||
var widgetWindow = window as WidgetWindow;
|
||||
if (widgetWindow != null)
|
||||
{
|
||||
var darkDockingFrame = widgetWindow.mRootWidget as DarkDockingFrame;
|
||||
if (widgetWindow == mMainWindow)
|
||||
darkDockingFrame = mDockingFrame;
|
||||
public void WithDocumentTabbedViewsOf(BFWindow window, delegate void(DarkTabbedView) func)
|
||||
{
|
||||
var widgetWindow = window as WidgetWindow;
|
||||
if (widgetWindow != null)
|
||||
{
|
||||
var darkDockingFrame = widgetWindow.mRootWidget as DarkDockingFrame;
|
||||
if (widgetWindow == mMainWindow)
|
||||
darkDockingFrame = mDockingFrame;
|
||||
|
||||
if (darkDockingFrame != null)
|
||||
{
|
||||
darkDockingFrame.WithAllDockedWidgets(scope (dockedWidget) =>
|
||||
{
|
||||
var tabbedView = dockedWidget as DarkTabbedView;
|
||||
if (tabbedView != null)
|
||||
func(tabbedView);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (darkDockingFrame != null)
|
||||
{
|
||||
darkDockingFrame.WithAllDockedWidgets(scope (dockedWidget) =>
|
||||
{
|
||||
var tabbedView = dockedWidget as DarkTabbedView;
|
||||
if (tabbedView != null)
|
||||
func(tabbedView);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void WithDocumentTabbedViews(delegate void(DarkTabbedView) func)
|
||||
{
|
||||
for (let window in mWindows)
|
||||
WithDocumentTabbedViewsOf(window, func);
|
||||
}
|
||||
|
||||
public void EnsureDocumentArea()
|
||||
{
|
||||
|
@ -5682,13 +5684,19 @@ namespace IDE
|
|||
return null;
|
||||
}
|
||||
|
||||
public void WithTabs(delegate void(TabbedView.TabButton) func)
|
||||
{
|
||||
WithDocumentTabbedViews(scope (documentTabbedView) =>
|
||||
{
|
||||
documentTabbedView.WithTabs(func);
|
||||
});
|
||||
}
|
||||
public void WithTabsOf(BFWindow window, delegate void(TabbedView.TabButton) func)
|
||||
{
|
||||
WithDocumentTabbedViewsOf(window, scope (documentTabbedView) =>
|
||||
{
|
||||
documentTabbedView.WithTabs(func);
|
||||
});
|
||||
}
|
||||
|
||||
public void WithTabs(delegate void(TabbedView.TabButton) func)
|
||||
{
|
||||
for (let window in mWindows)
|
||||
WithTabsOf(window, func);
|
||||
}
|
||||
|
||||
public TabbedView.TabButton GetTab(Widget content)
|
||||
{
|
||||
|
@ -5701,15 +5709,21 @@ namespace IDE
|
|||
return tab;
|
||||
}
|
||||
|
||||
public void WithSourceViewPanels(delegate void(SourceViewPanel) func)
|
||||
{
|
||||
WithTabs(scope (tab) =>
|
||||
{
|
||||
var sourceViewPanel = tab.mContent as SourceViewPanel;
|
||||
if (sourceViewPanel != null)
|
||||
func(sourceViewPanel);
|
||||
});
|
||||
}
|
||||
public void WithSourceViewPanelsOf(BFWindow window, delegate void(SourceViewPanel) func)
|
||||
{
|
||||
WithTabsOf(window, scope (tab) =>
|
||||
{
|
||||
var sourceViewPanel = tab.mContent as SourceViewPanel;
|
||||
if (sourceViewPanel != null)
|
||||
func(sourceViewPanel);
|
||||
});
|
||||
}
|
||||
|
||||
public void WithSourceViewPanels(delegate void(SourceViewPanel) func)
|
||||
{
|
||||
for (let window in mWindows)
|
||||
WithSourceViewPanelsOf(window, func);
|
||||
}
|
||||
|
||||
TabbedView.TabButton SetupTab(TabbedView tabView, String name, float width, Widget content, bool ownsContent) // 2
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue