From 3aecbf57395d2b6933e2de0189bfd478dfee42a7 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 15 Mar 2017 20:11:50 -0400 Subject: [PATCH] Rearrange things somewhat --- .../Tests/TestCaseTabControl.cs | 6 +++--- .../UserInterface/OsuTabControl.cs} | 12 ++++++------ .../UserInterface/OsuTabDropDownHeader.cs} | 7 ++++--- .../UserInterface/OsuTabDropDownMenu.cs} | 13 +++++++------ .../UserInterface/OsuTabDropDownMenuItem.cs} | 6 +++--- .../UserInterface/OsuTabItem.cs} | 6 +++--- osu.Game/Screens/Select/FilterControl.cs | 15 +++++++++------ osu.Game/osu.Game.csproj | 10 +++++----- 8 files changed, 40 insertions(+), 35 deletions(-) rename osu.Game/{Screens/Select/Tab/FilterTabControl.cs => Graphics/UserInterface/OsuTabControl.cs} (57%) rename osu.Game/{Screens/Select/Tab/FilterTabDropDownHeader.cs => Graphics/UserInterface/OsuTabDropDownHeader.cs} (81%) rename osu.Game/{Screens/Select/Tab/FilterTabDropDownMenu.cs => Graphics/UserInterface/OsuTabDropDownMenu.cs} (83%) rename osu.Game/{Screens/Select/Tab/FilterTabDropDownMenuItem.cs => Graphics/UserInterface/OsuTabDropDownMenuItem.cs} (86%) rename osu.Game/{Screens/Select/Tab/FilterTabItem.cs => Graphics/UserInterface/OsuTabItem.cs} (92%) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs index 7fda6a4bbf..a072087956 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics.Primitives; using osu.Framework.Screens.Testing; using osu.Game.Graphics.Sprites; using osu.Game.Screens.Select.Filter; -using osu.Game.Screens.Select.Tab; +using osu.Game.Graphics.UserInterface; namespace osu.Desktop.VisualTests.Tests { @@ -21,7 +21,7 @@ namespace osu.Desktop.VisualTests.Tests base.Reset(); OsuSpriteText text; - FilterTabControl filter; + OsuTabControl filter; Add(new FillFlowContainer { @@ -29,7 +29,7 @@ namespace osu.Desktop.VisualTests.Tests AutoSizeAxes = Axes.Both, Children = new Drawable[] { - filter = new FilterTabControl + filter = new OsuTabControl { Width = 229, AutoSort = true diff --git a/osu.Game/Screens/Select/Tab/FilterTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs similarity index 57% rename from osu.Game/Screens/Select/Tab/FilterTabControl.cs rename to osu.Game/Graphics/UserInterface/OsuTabControl.cs index 3f2e0d9a8e..51df8e7830 100644 --- a/osu.Game/Screens/Select/Tab/FilterTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -4,18 +4,18 @@ using System; using osu.Framework.Graphics.UserInterface.Tab; -namespace osu.Game.Screens.Select.Tab +namespace osu.Game.Graphics.UserInterface { - public class FilterTabControl : TabControl + public class OsuTabControl : TabControl { - protected override TabDropDownMenu CreateDropDownMenu() => new FilterTabDropDownMenu(); + protected override TabDropDownMenu CreateDropDownMenu() => new OsuTabDropDownMenu(); - protected override TabItem CreateTabItem(T value) => new FilterTabItem { Value = value }; + protected override TabItem CreateTabItem(T value) => new OsuTabItem { Value = value }; - public FilterTabControl(float offset = 0) : base(offset) + public OsuTabControl(float offset = 0) : base(offset) { if (!typeof(T).IsEnum) - throw new InvalidOperationException("FilterTabControl only supports enums as the generic type argument"); + throw new InvalidOperationException("OsuTabControl only supports enums as the generic type argument"); foreach (var val in (T[])Enum.GetValues(typeof(T))) AddTab(val); diff --git a/osu.Game/Screens/Select/Tab/FilterTabDropDownHeader.cs b/osu.Game/Graphics/UserInterface/OsuTabDropDownHeader.cs similarity index 81% rename from osu.Game/Screens/Select/Tab/FilterTabDropDownHeader.cs rename to osu.Game/Graphics/UserInterface/OsuTabDropDownHeader.cs index 6a0ed9044e..5506365aef 100644 --- a/osu.Game/Screens/Select/Tab/FilterTabDropDownHeader.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabDropDownHeader.cs @@ -6,13 +6,14 @@ using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.UserInterface.Tab; using osu.Game.Graphics; -namespace osu.Game.Screens.Select.Tab +namespace osu.Game.Graphics.UserInterface { - public class FilterTabDropDownHeader : TabDropDownHeader + public class OsuTabDropDownHeader : TabDropDownHeader { protected override string Label { get; set; } - public FilterTabDropDownHeader() { + public OsuTabDropDownHeader() + { Foreground.Children = new Drawable[] { new TextAwesome diff --git a/osu.Game/Screens/Select/Tab/FilterTabDropDownMenu.cs b/osu.Game/Graphics/UserInterface/OsuTabDropDownMenu.cs similarity index 83% rename from osu.Game/Screens/Select/Tab/FilterTabDropDownMenu.cs rename to osu.Game/Graphics/UserInterface/OsuTabDropDownMenu.cs index b47976446c..57f298513a 100644 --- a/osu.Game/Screens/Select/Tab/FilterTabDropDownMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabDropDownMenu.cs @@ -12,18 +12,18 @@ using osu.Framework.Graphics.UserInterface.Tab; using osu.Game.Graphics; using osu.Game.Screens.Select.Filter; -namespace osu.Game.Screens.Select.Tab +namespace osu.Game.Graphics.UserInterface { - public class FilterTabDropDownMenu : TabDropDownMenu + public class OsuTabDropDownMenu : TabDropDownMenu { public override float HeaderWidth => 14; public override float HeaderHeight => 24; - protected override DropDownHeader CreateHeader() => new FilterTabDropDownHeader(); + protected override DropDownHeader CreateHeader() => new OsuTabDropDownHeader(); - protected override DropDownMenuItem CreateDropDownItem(string key, T value) => new FilterTabDropDownMenuItem(key, value); + protected override DropDownMenuItem CreateDropDownItem(string key, T value) => new OsuTabDropDownMenuItem(key, value); - public FilterTabDropDownMenu() + public OsuTabDropDownMenu() { MaxDropDownHeight = int.MaxValue; ContentContainer.CornerRadius = 4; @@ -48,7 +48,8 @@ namespace osu.Game.Screens.Select.Tab } [BackgroundDependencyLoader] - private void load(OsuColour colours) { + private void load(OsuColour colours) + { Header.Colour = typeof(T) == typeof(SortMode) ? colours.GreenLight : colours.Blue; } } diff --git a/osu.Game/Screens/Select/Tab/FilterTabDropDownMenuItem.cs b/osu.Game/Graphics/UserInterface/OsuTabDropDownMenuItem.cs similarity index 86% rename from osu.Game/Screens/Select/Tab/FilterTabDropDownMenuItem.cs rename to osu.Game/Graphics/UserInterface/OsuTabDropDownMenuItem.cs index 166ce33f05..130e026ab4 100644 --- a/osu.Game/Screens/Select/Tab/FilterTabDropDownMenuItem.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabDropDownMenuItem.cs @@ -11,11 +11,11 @@ using OpenTK.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Screens.Select.Filter; -namespace osu.Game.Screens.Select.Tab +namespace osu.Game.Graphics.UserInterface { - public class FilterTabDropDownMenuItem : DropDownMenuItem + public class OsuTabDropDownMenuItem : DropDownMenuItem { - public FilterTabDropDownMenuItem(string text, T value) : base(text, value) + public OsuTabDropDownMenuItem(string text, T value) : base(text, value) { Foreground.Padding = new MarginPadding { Top = 4, Bottom = 4 }; Foreground.Margin = new MarginPadding { Left = 7 }; diff --git a/osu.Game/Screens/Select/Tab/FilterTabItem.cs b/osu.Game/Graphics/UserInterface/OsuTabItem.cs similarity index 92% rename from osu.Game/Screens/Select/Tab/FilterTabItem.cs rename to osu.Game/Graphics/UserInterface/OsuTabItem.cs index 3847c84c92..8b62829df3 100644 --- a/osu.Game/Screens/Select/Tab/FilterTabItem.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabItem.cs @@ -14,9 +14,9 @@ using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Screens.Select.Filter; -namespace osu.Game.Screens.Select.Tab +namespace osu.Game.Graphics.UserInterface { - public class FilterTabItem : TabItem + public class OsuTabItem : TabItem { private SpriteText text; private Box box; @@ -68,7 +68,7 @@ namespace osu.Game.Screens.Select.Tab fadeInactive(); } - public FilterTabItem() + public OsuTabItem() { AutoSizeAxes = Axes.Both; Children = new Drawable[] diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index a70af1a2b5..7bf237d378 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -9,12 +9,12 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.UserInterface.Tab; using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.Sprites; using osu.Game.Screens.Select.Filter; -using osu.Game.Screens.Select.Tab; using Container = osu.Framework.Graphics.Containers.Container; +using osu.Framework.Graphics.UserInterface.Tab; namespace osu.Game.Screens.Select { @@ -23,8 +23,10 @@ namespace osu.Game.Screens.Select public Action FilterChanged; public string Search => searchTextBox.Text; + private SortMode sort = SortMode.Title; - public SortMode Sort { + public SortMode Sort + { get { return sort; } set { @@ -37,7 +39,8 @@ namespace osu.Game.Screens.Select } private GroupMode group = GroupMode.All; - public GroupMode Group { + public GroupMode Group + { get { return group; } set { @@ -105,7 +108,7 @@ namespace osu.Game.Screens.Select Anchor = Anchor.TopLeft, Position = new Vector2(0, 23) }, - groupTabs = new FilterTabControl + groupTabs = new OsuTabControl { Width = 230, AutoSort = true @@ -128,7 +131,7 @@ namespace osu.Game.Screens.Select Bottom = 5 }, }, - sortTabs = new FilterTabControl(87) + sortTabs = new OsuTabControl(87) { Width = 191, AutoSort = true diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 5368b08260..1b6ea5d84b 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -85,11 +85,6 @@ - - - - - @@ -354,6 +349,11 @@ + + + + +