mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-13 22:04:09 +02:00
Merge pull request #1252 from blat-blatnik/OpenTabsOnRight
[IDE] Added setting to open new tabs on right instead of left
This commit is contained in:
commit
9f57be150e
5 changed files with 29 additions and 10 deletions
|
@ -398,12 +398,12 @@ namespace Beefy.theme.dark
|
||||||
func(mRightTab);
|
func(mRightTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override TabButton AddTab(String label, float width, Widget content, bool ownsContent)
|
public override TabButton AddTab(String label, float width, Widget content, bool ownsContent, int insertIdx)
|
||||||
{
|
{
|
||||||
float useWidth = width;
|
float useWidth = width;
|
||||||
if (useWidth == 0)
|
if (useWidth == 0)
|
||||||
useWidth = DarkTheme.sDarkTheme.mSmallFont.GetWidth(label) + GS!(30);
|
useWidth = DarkTheme.sDarkTheme.mSmallFont.GetWidth(label) + GS!(30);
|
||||||
return base.AddTab(label, useWidth, content, ownsContent);
|
return base.AddTab(label, useWidth, content, ownsContent, insertIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void RemoveTab(TabButton tabButton, bool deleteTab = true)
|
public override void RemoveTab(TabButton tabButton, bool deleteTab = true)
|
||||||
|
|
|
@ -320,7 +320,7 @@ namespace Beefy.widgets
|
||||||
//tabbedView.mSharedData.mOpenNewWindowDelegate = mTabbedView.mSharedData.mOpenNewWindowDelegate;
|
//tabbedView.mSharedData.mOpenNewWindowDelegate = mTabbedView.mSharedData.mOpenNewWindowDelegate;
|
||||||
tabbedView.SetRequestedSize(mTabbedView.mWidth, mTabbedView.mHeight);
|
tabbedView.SetRequestedSize(mTabbedView.mWidth, mTabbedView.mHeight);
|
||||||
mTabbedView.RemoveTab(this, false);
|
mTabbedView.RemoveTab(this, false);
|
||||||
tabbedView.AddTab(this);
|
tabbedView.AddTab(this, 0);
|
||||||
|
|
||||||
float rootX;
|
float rootX;
|
||||||
float rootY;
|
float rootY;
|
||||||
|
@ -472,7 +472,7 @@ namespace Beefy.widgets
|
||||||
return activeTab;
|
return activeTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual TabButton AddTab(String label, float width, Widget content, bool ownsContent)
|
public virtual TabButton AddTab(String label, float width, Widget content, bool ownsContent, int insertIdx)
|
||||||
{
|
{
|
||||||
TabButton aTabButton = CreateTabButton();
|
TabButton aTabButton = CreateTabButton();
|
||||||
aTabButton.mTabbedView = this;
|
aTabButton.mTabbedView = this;
|
||||||
|
@ -481,7 +481,7 @@ namespace Beefy.widgets
|
||||||
aTabButton.mWantWidth = width;
|
aTabButton.mWantWidth = width;
|
||||||
aTabButton.mHeight = mTabHeight;
|
aTabButton.mHeight = mTabHeight;
|
||||||
aTabButton.mContent = content;
|
aTabButton.mContent = content;
|
||||||
AddTab(aTabButton);
|
AddTab(aTabButton, insertIdx);
|
||||||
return aTabButton;
|
return aTabButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,7 +501,7 @@ namespace Beefy.widgets
|
||||||
return bestIdx;
|
return bestIdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void AddTab(TabButton tabButton, int insertIdx = 0)
|
public virtual void AddTab(TabButton tabButton, int insertIdx)
|
||||||
{
|
{
|
||||||
AddWidget(tabButton);
|
AddWidget(tabButton);
|
||||||
mTabs.Insert(insertIdx, tabButton);
|
mTabs.Insert(insertIdx, tabButton);
|
||||||
|
|
|
@ -5807,7 +5807,7 @@ namespace IDE
|
||||||
|
|
||||||
TabbedView.TabButton SetupTab(TabbedView tabView, String name, float width, Widget content, bool ownsContent) // 2
|
TabbedView.TabButton SetupTab(TabbedView tabView, String name, float width, Widget content, bool ownsContent) // 2
|
||||||
{
|
{
|
||||||
TabbedView.TabButton tabButton = tabView.AddTab(name, width, content, ownsContent);
|
TabbedView.TabButton tabButton = tabView.AddTab(name, width, content, ownsContent, GetTabInsertIndex(tabView));
|
||||||
if ((var panel = content as Panel) && (var darkTabButton = tabButton as DarkTabbedView.DarkTabButton))
|
if ((var panel = content as Panel) && (var darkTabButton = tabButton as DarkTabbedView.DarkTabButton))
|
||||||
{
|
{
|
||||||
darkTabButton.mTabWidthOffset = panel.TabWidthOffset;
|
darkTabButton.mTabWidthOffset = panel.TabWidthOffset;
|
||||||
|
@ -5840,7 +5840,7 @@ namespace IDE
|
||||||
newTabButton.mWantWidth = newTabButton.GetWantWidth();
|
newTabButton.mWantWidth = newTabButton.GetWantWidth();
|
||||||
newTabButton.mHeight = tabbedView.mTabHeight;
|
newTabButton.mHeight = tabbedView.mTabHeight;
|
||||||
newTabButton.mContent = disassemblyPanel;
|
newTabButton.mContent = disassemblyPanel;
|
||||||
tabbedView.AddTab(newTabButton);
|
tabbedView.AddTab(newTabButton, GetTabInsertIndex(tabbedView));
|
||||||
|
|
||||||
newTabButton.mCloseClickedEvent.Add(new () => CloseDocument(disassemblyPanel));
|
newTabButton.mCloseClickedEvent.Add(new () => CloseDocument(disassemblyPanel));
|
||||||
newTabButton.Activate();
|
newTabButton.Activate();
|
||||||
|
@ -5850,6 +5850,14 @@ namespace IDE
|
||||||
return disassemblyPanel;
|
return disassemblyPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetTabInsertIndex(TabbedView tabs)
|
||||||
|
{
|
||||||
|
if (mSettings.mUISettings.mInsertNewTabs == .RightOfExistingTabs)
|
||||||
|
return tabs.mTabs.Count;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
public class SourceViewTab : DarkTabbedView.DarkTabButton
|
public class SourceViewTab : DarkTabbedView.DarkTabButton
|
||||||
{
|
{
|
||||||
public float GetWantWidth()
|
public float GetWantWidth()
|
||||||
|
@ -6021,7 +6029,7 @@ namespace IDE
|
||||||
tabButton.mIsRightTab = false;
|
tabButton.mIsRightTab = false;
|
||||||
var darkTabbedView = (DarkTabbedView)tabButton.mTabbedView;
|
var darkTabbedView = (DarkTabbedView)tabButton.mTabbedView;
|
||||||
darkTabbedView.SetRightTab(null, false);
|
darkTabbedView.SetRightTab(null, false);
|
||||||
darkTabbedView.AddTab(tabButton);
|
darkTabbedView.AddTab(tabButton, GetTabInsertIndex(darkTabbedView));
|
||||||
tabButton.Activate();
|
tabButton.Activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6397,7 +6405,7 @@ namespace IDE
|
||||||
tabbedView.SetRightTab(newTabButton);
|
tabbedView.SetRightTab(newTabButton);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tabbedView.AddTab(newTabButton);
|
tabbedView.AddTab(newTabButton, GetTabInsertIndex(tabbedView));
|
||||||
newTabButton.mCloseClickedEvent.Add(new () => DocumentCloseClicked(sourceViewPanel));
|
newTabButton.mCloseClickedEvent.Add(new () => DocumentCloseClicked(sourceViewPanel));
|
||||||
newTabButton.Activate(setFocus);
|
newTabButton.Activate(setFocus);
|
||||||
if ((setFocus) && (sourceViewPanel.mWidgetWindow != null))
|
if ((setFocus) && (sourceViewPanel.mWidgetWindow != null))
|
||||||
|
|
|
@ -416,8 +416,15 @@ namespace IDE
|
||||||
|
|
||||||
public class UISettings
|
public class UISettings
|
||||||
{
|
{
|
||||||
|
public enum InsertNewTabsKind
|
||||||
|
{
|
||||||
|
LeftOfExistingTabs,
|
||||||
|
RightOfExistingTabs,
|
||||||
|
}
|
||||||
|
|
||||||
public Colors mColors = new .() ~ delete _;
|
public Colors mColors = new .() ~ delete _;
|
||||||
public float mScale = 100;
|
public float mScale = 100;
|
||||||
|
public InsertNewTabsKind mInsertNewTabs = .LeftOfExistingTabs;
|
||||||
public List<String> mTheme = new .() ~ DeleteContainerAndItems!(_);
|
public List<String> mTheme = new .() ~ DeleteContainerAndItems!(_);
|
||||||
|
|
||||||
public void SetDefaults()
|
public void SetDefaults()
|
||||||
|
@ -425,6 +432,7 @@ namespace IDE
|
||||||
DeleteAndNullify!(mColors);
|
DeleteAndNullify!(mColors);
|
||||||
mColors = new .();
|
mColors = new .();
|
||||||
mScale = 100;
|
mScale = 100;
|
||||||
|
mInsertNewTabs = .LeftOfExistingTabs;
|
||||||
ClearAndDeleteItems(mTheme);
|
ClearAndDeleteItems(mTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,6 +565,7 @@ namespace IDE
|
||||||
for (let str in mTheme)
|
for (let str in mTheme)
|
||||||
sd.Add(str);
|
sd.Add(str);
|
||||||
}
|
}
|
||||||
|
sd.Add("InsertNewTabs", mInsertNewTabs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Deserialize(StructuredData sd)
|
public void Deserialize(StructuredData sd)
|
||||||
|
@ -569,6 +578,7 @@ namespace IDE
|
||||||
sd.GetCurString(str);
|
sd.GetCurString(str);
|
||||||
mTheme.Add(str);
|
mTheme.Add(str);
|
||||||
}
|
}
|
||||||
|
sd.Get("InsertNewTabs", ref mInsertNewTabs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,7 @@ namespace IDE.ui
|
||||||
|
|
||||||
AddPropertiesItem(category, "Scale", "mScale");
|
AddPropertiesItem(category, "Scale", "mScale");
|
||||||
AddPropertiesItem(category, "Theme", "mTheme");
|
AddPropertiesItem(category, "Theme", "mTheme");
|
||||||
|
AddPropertiesItem(category, "Insert New Tabs", "mInsertNewTabs");
|
||||||
|
|
||||||
category.Open(true, true);
|
category.Open(true, true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue