1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 16:07:24 +08:00

Merge pull request #28505 from bdach/move-timeline-toggles-elsewhere

Move timeline toggle controls to "view" menu
This commit is contained in:
Dean Herbert 2024-06-17 18:59:38 +09:00 committed by GitHub
commit cc0ef20afd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 49 additions and 84 deletions

View File

@ -208,6 +208,9 @@ namespace osu.Game.Configuration
SetDefault(OsuSetting.ComboColourNormalisationAmount, 0.2f, 0f, 1f, 0.01f); SetDefault(OsuSetting.ComboColourNormalisationAmount, 0.2f, 0f, 1f, 0.01f);
SetDefault<UserStatus?>(OsuSetting.UserOnlineStatus, null); SetDefault<UserStatus?>(OsuSetting.UserOnlineStatus, null);
SetDefault(OsuSetting.EditorTimelineShowTimingChanges, true);
SetDefault(OsuSetting.EditorTimelineShowTicks, true);
} }
protected override bool CheckLookupContainsPrivateInformation(OsuSetting lookup) protected override bool CheckLookupContainsPrivateInformation(OsuSetting lookup)
@ -439,5 +442,7 @@ namespace osu.Game.Configuration
UserOnlineStatus, UserOnlineStatus,
MultiplayerRoomFilter, MultiplayerRoomFilter,
HideCountryFlags, HideCountryFlags,
EditorTimelineShowTimingChanges,
EditorTimelineShowTicks,
} }
} }

View File

@ -99,16 +99,6 @@ namespace osu.Game.Localisation
/// </summary> /// </summary>
public static LocalisableString TestBeatmap => new TranslatableString(getKey(@"test_beatmap"), @"Test!"); public static LocalisableString TestBeatmap => new TranslatableString(getKey(@"test_beatmap"), @"Test!");
/// <summary>
/// "Waveform"
/// </summary>
public static LocalisableString TimelineWaveform => new TranslatableString(getKey(@"timeline_waveform"), @"Waveform");
/// <summary>
/// "Ticks"
/// </summary>
public static LocalisableString TimelineTicks => new TranslatableString(getKey(@"timeline_ticks"), @"Ticks");
/// <summary> /// <summary>
/// "{0:0}&#176;" /// "{0:0}&#176;"
/// </summary> /// </summary>
@ -134,6 +124,21 @@ namespace osu.Game.Localisation
/// </summary> /// </summary>
public static LocalisableString FailedToParseEditorLink => new TranslatableString(getKey(@"failed_to_parse_edtior_link"), @"Failed to parse editor link"); public static LocalisableString FailedToParseEditorLink => new TranslatableString(getKey(@"failed_to_parse_edtior_link"), @"Failed to parse editor link");
/// <summary>
/// "Timeline"
/// </summary>
public static LocalisableString Timeline => new TranslatableString(getKey(@"timeline"), @"Timeline");
/// <summary>
/// "Show timing changes"
/// </summary>
public static LocalisableString TimelineShowTimingChanges => new TranslatableString(getKey(@"timeline_show_timing_changes"), @"Show timing changes");
/// <summary>
/// "Show ticks"
/// </summary>
public static LocalisableString TimelineShowTicks => new TranslatableString(getKey(@"timeline_show_ticks"), @"Show ticks");
private static string getKey(string key) => $@"{prefix}:{key}"; private static string getKey(string key) => $@"{prefix}:{key}";
} }
} }

View File

@ -30,12 +30,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
private readonly Drawable userContent; private readonly Drawable userContent;
public readonly Bindable<bool> WaveformVisible = new Bindable<bool>();
public readonly Bindable<bool> ControlPointsVisible = new Bindable<bool>();
public readonly Bindable<bool> TicksVisible = new Bindable<bool>();
[Resolved] [Resolved]
private EditorClock editorClock { get; set; } private EditorClock editorClock { get; set; }
@ -88,6 +82,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
private Container mainContent; private Container mainContent;
private Bindable<float> waveformOpacity; private Bindable<float> waveformOpacity;
private Bindable<bool> controlPointsVisible;
private Bindable<bool> ticksVisible;
private double trackLengthForZoom; private double trackLengthForZoom;
@ -139,6 +135,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
}); });
waveformOpacity = config.GetBindable<float>(OsuSetting.EditorWaveformOpacity); waveformOpacity = config.GetBindable<float>(OsuSetting.EditorWaveformOpacity);
controlPointsVisible = config.GetBindable<bool>(OsuSetting.EditorTimelineShowTimingChanges);
ticksVisible = config.GetBindable<bool>(OsuSetting.EditorTimelineShowTicks);
track.BindTo(editorClock.Track); track.BindTo(editorClock.Track);
track.BindValueChanged(_ => track.BindValueChanged(_ =>
@ -168,12 +166,11 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{ {
base.LoadComplete(); base.LoadComplete();
WaveformVisible.BindValueChanged(_ => updateWaveformOpacity());
waveformOpacity.BindValueChanged(_ => updateWaveformOpacity(), true); waveformOpacity.BindValueChanged(_ => updateWaveformOpacity(), true);
TicksVisible.BindValueChanged(visible => ticks.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint), true); ticksVisible.BindValueChanged(visible => ticks.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint), true);
ControlPointsVisible.BindValueChanged(visible => controlPointsVisible.BindValueChanged(visible =>
{ {
if (visible.NewValue) if (visible.NewValue)
{ {
@ -195,7 +192,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
} }
private void updateWaveformOpacity() => private void updateWaveformOpacity() =>
waveform.FadeTo(WaveformVisible.Value ? waveformOpacity.Value : 0, 200, Easing.OutQuint); waveform.FadeTo(waveformOpacity.Value, 200, Easing.OutQuint);
protected override void Update() protected override void Update()
{ {

View File

@ -7,10 +7,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Localisation;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit;
using osuTK; using osuTK;
@ -33,10 +30,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider, OsuColour colours) private void load(OverlayColourProvider colourProvider, OsuColour colours)
{ {
OsuCheckbox waveformCheckbox;
OsuCheckbox controlPointsCheckbox;
OsuCheckbox ticksCheckbox;
const float padding = 10; const float padding = 10;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
@ -51,69 +44,20 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
}, },
ColumnDimensions = new[] ColumnDimensions = new[]
{ {
new Dimension(GridSizeMode.Absolute, 135),
new Dimension(), new Dimension(),
new Dimension(GridSizeMode.Absolute, 35), new Dimension(GridSizeMode.Absolute, 35),
new Dimension(GridSizeMode.Absolute, HitObjectComposer.TOOLBOX_CONTRACTED_SIZE_RIGHT - padding * 2), new Dimension(GridSizeMode.Absolute, HitObjectComposer.TOOLBOX_CONTRACTED_SIZE_RIGHT),
}, },
Content = new[] Content = new[]
{ {
new Drawable[] new Drawable[]
{ {
new Container
{
RelativeSizeAxes = Axes.Both,
Name = @"Toggle controls",
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background2,
},
new FillFlowContainer
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding(padding),
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 4),
Children = new[]
{
waveformCheckbox = new OsuCheckbox(nubSize: 30f)
{
LabelText = EditorStrings.TimelineWaveform,
Current = { Value = true },
},
ticksCheckbox = new OsuCheckbox(nubSize: 30f)
{
LabelText = EditorStrings.TimelineTicks,
Current = { Value = true },
},
controlPointsCheckbox = new OsuCheckbox(nubSize: 30f)
{
LabelText = BeatmapsetsStrings.ShowStatsBpm,
Current = { Value = true },
},
}
}
}
},
new Container new Container
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Children = new Drawable[] Children = new Drawable[]
{ {
// the out-of-bounds portion of the centre marker.
new Box
{
Width = 24,
Height = EditorScreenWithTimeline.PADDING,
Depth = float.MaxValue,
Colour = colours.Red1,
Anchor = Anchor.TopCentre,
Origin = Anchor.BottomCentre,
},
new Box new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -167,10 +111,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
}, },
} }
}; };
Timeline.WaveformVisible.BindTo(waveformCheckbox.Current);
Timeline.ControlPointsVisible.BindTo(controlPointsCheckbox.Current);
Timeline.TicksVisible.BindTo(ticksCheckbox.Current);
} }
} }
} }

View File

@ -211,6 +211,8 @@ namespace osu.Game.Screens.Edit
private Bindable<bool> editorHitMarkers; private Bindable<bool> editorHitMarkers;
private Bindable<bool> editorAutoSeekOnPlacement; private Bindable<bool> editorAutoSeekOnPlacement;
private Bindable<bool> editorLimitedDistanceSnap; private Bindable<bool> editorLimitedDistanceSnap;
private Bindable<bool> editorTimelineShowTimingChanges;
private Bindable<bool> editorTimelineShowTicks;
public Editor(EditorLoader loader = null) public Editor(EditorLoader loader = null)
{ {
@ -305,6 +307,8 @@ namespace osu.Game.Screens.Edit
editorHitMarkers = config.GetBindable<bool>(OsuSetting.EditorShowHitMarkers); editorHitMarkers = config.GetBindable<bool>(OsuSetting.EditorShowHitMarkers);
editorAutoSeekOnPlacement = config.GetBindable<bool>(OsuSetting.EditorAutoSeekOnPlacement); editorAutoSeekOnPlacement = config.GetBindable<bool>(OsuSetting.EditorAutoSeekOnPlacement);
editorLimitedDistanceSnap = config.GetBindable<bool>(OsuSetting.EditorLimitedDistanceSnap); editorLimitedDistanceSnap = config.GetBindable<bool>(OsuSetting.EditorLimitedDistanceSnap);
editorTimelineShowTimingChanges = config.GetBindable<bool>(OsuSetting.EditorTimelineShowTimingChanges);
editorTimelineShowTicks = config.GetBindable<bool>(OsuSetting.EditorTimelineShowTicks);
AddInternal(new OsuContextMenuContainer AddInternal(new OsuContextMenuContainer
{ {
@ -355,9 +359,23 @@ namespace osu.Game.Screens.Edit
}, },
new MenuItem(CommonStrings.MenuBarView) new MenuItem(CommonStrings.MenuBarView)
{ {
Items = new MenuItem[] Items = new[]
{ {
new WaveformOpacityMenuItem(config.GetBindable<float>(OsuSetting.EditorWaveformOpacity)), new MenuItem(EditorStrings.Timeline)
{
Items =
[
new WaveformOpacityMenuItem(config.GetBindable<float>(OsuSetting.EditorWaveformOpacity)),
new ToggleMenuItem(EditorStrings.TimelineShowTimingChanges)
{
State = { BindTarget = editorTimelineShowTimingChanges }
},
new ToggleMenuItem(EditorStrings.TimelineShowTicks)
{
State = { BindTarget = editorTimelineShowTicks }
},
]
},
new BackgroundDimMenuItem(editorBackgroundDim), new BackgroundDimMenuItem(editorBackgroundDim),
new ToggleMenuItem(EditorStrings.ShowHitMarkers) new ToggleMenuItem(EditorStrings.ShowHitMarkers)
{ {

View File

@ -62,7 +62,6 @@ namespace osu.Game.Screens.Edit
Name = "Timeline content", Name = "Timeline content",
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = PADDING, Top = PADDING },
Content = new[] Content = new[]
{ {
new Drawable[] new Drawable[]

View File

@ -20,6 +20,7 @@ namespace osu.Game.Screens.Edit
{ {
Items = new[] Items = new[]
{ {
createMenuItem(0f),
createMenuItem(0.25f), createMenuItem(0.25f),
createMenuItem(0.5f), createMenuItem(0.5f),
createMenuItem(0.75f), createMenuItem(0.75f),