1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-14 14:24:10 +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:
Joseph Battelle 2021-02-01 17:02:22 -08:00
parent e33ca41fd0
commit 9fbfcb7a07

View file

@ -5560,11 +5560,8 @@ namespace IDE
});
}
public void WithDocumentTabbedViews(delegate void(DarkTabbedView) func)
public void WithDocumentTabbedViewsOf(BFWindow window, delegate void(DarkTabbedView) func)
{
for (int32 windowIdx = 0; windowIdx < mWindows.Count; windowIdx++)
{
var window = mWindows[windowIdx];
var widgetWindow = window as WidgetWindow;
if (widgetWindow != null)
{
@ -5583,6 +5580,11 @@ namespace IDE
}
}
}
public void WithDocumentTabbedViews(delegate void(DarkTabbedView) func)
{
for (let window in mWindows)
WithDocumentTabbedViewsOf(window, func);
}
public void EnsureDocumentArea()
@ -5682,14 +5684,20 @@ namespace IDE
return null;
}
public void WithTabs(delegate void(TabbedView.TabButton) func)
public void WithTabsOf(BFWindow window, delegate void(TabbedView.TabButton) func)
{
WithDocumentTabbedViews(scope (documentTabbedView) =>
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)
{
TabbedView.TabButton tab = null;
@ -5701,9 +5709,9 @@ namespace IDE
return tab;
}
public void WithSourceViewPanels(delegate void(SourceViewPanel) func)
public void WithSourceViewPanelsOf(BFWindow window, delegate void(SourceViewPanel) func)
{
WithTabs(scope (tab) =>
WithTabsOf(window, scope (tab) =>
{
var sourceViewPanel = tab.mContent as SourceViewPanel;
if (sourceViewPanel != null)
@ -5711,6 +5719,12 @@ namespace IDE
});
}
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
{
TabbedView.TabButton tabButton = tabView.AddTab(name, width, content, ownsContent);