Skip to content

Commit

Permalink
Remove the last of the tab control manual ifs
Browse files Browse the repository at this point in the history
  • Loading branch information
FenPhoenix committed Mar 7, 2024
1 parent 8bbe2bf commit f08dd17
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,16 @@ private void Construct()
{
if (_constructed) return;

var container =
_which == WhichTabControl.Bottom
? _owner.LowerSplitContainer.Panel2
: _owner.TopSplitContainer.Panel2;
FMTabControlGroup group = _owner.GetFMTabControlGroup(_which);

DarkArrowButton collapseButton =
_which == WhichTabControl.Bottom
? _owner.BottomFMTabsCollapseButton
: _owner.TopFMTabsCollapseButton;
var container = group.Splitter.Panel2;

Panel = new DrawnPanel
{
Location = Point.Empty,
Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom,
Size = new Size(
container.Width - collapseButton.Width,
container.Width - group.CollapseButton.Width,
container.Height),
DarkModeDrawnBackColor = DarkColors.Fen_ControlBackground,

Expand Down
15 changes: 4 additions & 11 deletions AngelLoader/Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ need to check the accuracy of the selection itself (eg. in FMsDGV nav) so we can
private readonly DarkButton[] _readmeControlButtons;

private readonly FMTabControlGroup[] _fmTabControlGroups = new FMTabControlGroup[FormsData.WhichTabCount];
private FMTabControlGroup GetFMTabControlGroup(WhichTabControl which) => _fmTabControlGroups[(int)which];
internal FMTabControlGroup GetFMTabControlGroup(WhichTabControl which) => _fmTabControlGroups[(int)which];

#endregion

Expand Down Expand Up @@ -5677,16 +5677,9 @@ private void MoveFMTab(WhichTabControl source, WhichTabControl dest, TabPage tab

private void ShowFMTab(WhichTabControl which, TabPage tabPage)
{
if (which == WhichTabControl.Bottom)
{
BottomFMTabsEmptyMessageLabel.Hide();
Lazy_LowerTabControl.TabControl.ShowTab(tabPage, true);
}
else
{
TopFMTabsEmptyMessageLabel.Hide();
TopFMTabControl.ShowTab(tabPage, true);
}
FMTabControlGroup group = GetFMTabControlGroup(which);
group.EmptyMessageLabel.Hide();
group.TabControl.ShowTab(tabPage, true);
}

private void HideFMTab(WhichTabControl which, TabPage tabPage)
Expand Down

0 comments on commit f08dd17

Please sign in to comment.