diff --git a/BeefLibs/Beefy2D/src/widgets/TabbedView.bf b/BeefLibs/Beefy2D/src/widgets/TabbedView.bf index 0b9f30f6..174ba12d 100644 --- a/BeefLibs/Beefy2D/src/widgets/TabbedView.bf +++ b/BeefLibs/Beefy2D/src/widgets/TabbedView.bf @@ -320,7 +320,7 @@ namespace Beefy.widgets //tabbedView.mSharedData.mOpenNewWindowDelegate = mTabbedView.mSharedData.mOpenNewWindowDelegate; tabbedView.SetRequestedSize(mTabbedView.mWidth, mTabbedView.mHeight); mTabbedView.RemoveTab(this, false); - tabbedView.AddTab(this); + tabbedView.AddTab(this, 0); float rootX; float rootY; @@ -481,7 +481,7 @@ namespace Beefy.widgets aTabButton.mWantWidth = width; aTabButton.mHeight = mTabHeight; aTabButton.mContent = content; - AddTab(aTabButton); + AddTab(aTabButton, 0); return aTabButton; } @@ -501,7 +501,7 @@ namespace Beefy.widgets return bestIdx; } - public virtual void AddTab(TabButton tabButton, int insertIdx = 0) + public virtual void AddTab(TabButton tabButton, int insertIdx) { AddWidget(tabButton); mTabs.Insert(insertIdx, tabButton); diff --git a/IDE/src/IDEApp.bf b/IDE/src/IDEApp.bf index 936f7d21..7d8ea22a 100644 --- a/IDE/src/IDEApp.bf +++ b/IDE/src/IDEApp.bf @@ -5840,7 +5840,7 @@ namespace IDE newTabButton.mWantWidth = newTabButton.GetWantWidth(); newTabButton.mHeight = tabbedView.mTabHeight; newTabButton.mContent = disassemblyPanel; - tabbedView.AddTab(newTabButton); + tabbedView.AddTab(newTabButton, GetTabInsertIndex(tabbedView)); newTabButton.mCloseClickedEvent.Add(new () => CloseDocument(disassemblyPanel)); newTabButton.Activate(); @@ -5850,6 +5850,14 @@ namespace IDE return disassemblyPanel; } + int GetTabInsertIndex(TabbedView tabs) + { + if (mSettings.mUISettings.mInsertNewTabs == .RightOfExistingTabs) + return tabs.mTabs.Count; + else + return 0; + } + public class SourceViewTab : DarkTabbedView.DarkTabButton { public float GetWantWidth() @@ -6021,7 +6029,7 @@ namespace IDE tabButton.mIsRightTab = false; var darkTabbedView = (DarkTabbedView)tabButton.mTabbedView; darkTabbedView.SetRightTab(null, false); - darkTabbedView.AddTab(tabButton); + darkTabbedView.AddTab(tabButton, GetTabInsertIndex(darkTabbedView)); tabButton.Activate(); } @@ -6397,7 +6405,7 @@ namespace IDE tabbedView.SetRightTab(newTabButton); } else - tabbedView.AddTab(newTabButton); + tabbedView.AddTab(newTabButton, GetTabInsertIndex(tabbedView)); newTabButton.mCloseClickedEvent.Add(new () => DocumentCloseClicked(sourceViewPanel)); newTabButton.Activate(setFocus); if ((setFocus) && (sourceViewPanel.mWidgetWindow != null)) diff --git a/IDE/src/Settings.bf b/IDE/src/Settings.bf index 1fb81417..a965c6d5 100644 --- a/IDE/src/Settings.bf +++ b/IDE/src/Settings.bf @@ -416,8 +416,15 @@ namespace IDE public class UISettings { + public enum InsertNewTabsKind + { + LeftOfExistingTabs, + RightOfExistingTabs, + } + public Colors mColors = new .() ~ delete _; public float mScale = 100; + public InsertNewTabsKind mInsertNewTabs = .LeftOfExistingTabs; public List mTheme = new .() ~ DeleteContainerAndItems!(_); public void SetDefaults() @@ -557,6 +564,7 @@ namespace IDE for (let str in mTheme) sd.Add(str); } + sd.Add("InsertNewTabs", mInsertNewTabs); } public void Deserialize(StructuredData sd) @@ -569,6 +577,7 @@ namespace IDE sd.GetCurString(str); mTheme.Add(str); } + sd.Get("InsertNewTabs", ref mInsertNewTabs); } } diff --git a/IDE/src/ui/SettingsDialog.bf b/IDE/src/ui/SettingsDialog.bf index 6add48a8..38cf60b3 100644 --- a/IDE/src/ui/SettingsDialog.bf +++ b/IDE/src/ui/SettingsDialog.bf @@ -78,6 +78,7 @@ namespace IDE.ui AddPropertiesItem(category, "Scale", "mScale"); AddPropertiesItem(category, "Theme", "mTheme"); + AddPropertiesItem(category, "Insert New Tabs", "mInsertNewTabs"); category.Open(true, true); }