From 52d723aaa6ee71876054fcb240f8f2bcc182338a Mon Sep 17 00:00:00 2001 From: CenTdemeern1 Date: Thu, 31 Mar 2022 20:11:07 +0200 Subject: [PATCH 1/3] Remove BPM slider --- osu.Game/Screens/Edit/Timing/TimingSection.cs | 50 ------------------- 1 file changed, 50 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TimingSection.cs b/osu.Game/Screens/Edit/Timing/TimingSection.cs index cd0b56d338..f3c468de4c 100644 --- a/osu.Game/Screens/Edit/Timing/TimingSection.cs +++ b/osu.Game/Screens/Edit/Timing/TimingSection.cs @@ -13,7 +13,6 @@ namespace osu.Game.Screens.Edit.Timing { internal class TimingSection : Section { - private SettingsSlider bpmSlider; private LabelledTimeSignature timeSignature; private BPMTextBox bpmTextEntry; @@ -23,7 +22,6 @@ namespace osu.Game.Screens.Edit.Timing Flow.AddRange(new Drawable[] { bpmTextEntry = new BPMTextBox(), - bpmSlider = new BPMSlider(), timeSignature = new LabelledTimeSignature { Label = "Time Signature" @@ -35,9 +33,6 @@ namespace osu.Game.Screens.Edit.Timing { if (point.NewValue != null) { - bpmSlider.Current = point.NewValue.BeatLengthBindable; - bpmSlider.Current.BindValueChanged(_ => ChangeHandler?.SaveState()); - bpmTextEntry.Bindable = point.NewValue.BeatLengthBindable; // no need to hook change handler here as it's the same bindable as above @@ -102,51 +97,6 @@ namespace osu.Game.Screens.Edit.Timing } } - private class BPMSlider : SettingsSlider - { - private const double sane_minimum = 60; - private const double sane_maximum = 240; - - private readonly BindableNumber beatLengthBindable = new TimingControlPoint().BeatLengthBindable; - - private readonly BindableDouble bpmBindable = new BindableDouble(60000 / TimingControlPoint.DEFAULT_BEAT_LENGTH) - { - MinValue = sane_minimum, - MaxValue = sane_maximum, - }; - - public BPMSlider() - { - beatLengthBindable.BindValueChanged(beatLength => updateCurrent(beatLengthToBpm(beatLength.NewValue)), true); - bpmBindable.BindValueChanged(bpm => beatLengthBindable.Value = beatLengthToBpm(bpm.NewValue)); - - base.Current = bpmBindable; - - TransferValueOnCommit = true; - } - - public override Bindable Current - { - get => base.Current; - set - { - // incoming will be beat length, not bpm - beatLengthBindable.UnbindBindings(); - beatLengthBindable.BindTo(value); - } - } - - private void updateCurrent(double newValue) - { - // we use a more sane range for the slider display unless overridden by the user. - // if a value comes in outside our range, we should expand temporarily. - bpmBindable.MinValue = Math.Min(newValue, sane_minimum); - bpmBindable.MaxValue = Math.Max(newValue, sane_maximum); - - bpmBindable.Value = newValue; - } - } - private static double beatLengthToBpm(double beatLength) => 60000 / beatLength; } } From a6875383fcd5da6d50304bc40a660f35112e3f3f Mon Sep 17 00:00:00 2001 From: CenTdemeern1 Date: Thu, 31 Mar 2022 21:06:05 +0200 Subject: [PATCH 2/3] Rebind `SaveState()` to bpmTextEntry --- osu.Game/Screens/Edit/Timing/TimingSection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/TimingSection.cs b/osu.Game/Screens/Edit/Timing/TimingSection.cs index f3c468de4c..07f8f2ba3a 100644 --- a/osu.Game/Screens/Edit/Timing/TimingSection.cs +++ b/osu.Game/Screens/Edit/Timing/TimingSection.cs @@ -34,7 +34,7 @@ namespace osu.Game.Screens.Edit.Timing if (point.NewValue != null) { bpmTextEntry.Bindable = point.NewValue.BeatLengthBindable; - // no need to hook change handler here as it's the same bindable as above + bpmTextEntry.Current.BindValueChanged(_ => ChangeHandler?.SaveState()); timeSignature.Current = point.NewValue.TimeSignatureBindable; timeSignature.Current.BindValueChanged(_ => ChangeHandler?.SaveState()); From e14d5b8adbc26bff6b9f9f184a9a9444ba18bb8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 31 Mar 2022 21:20:30 +0200 Subject: [PATCH 3/3] Remove unused using directives --- osu.Game/Screens/Edit/Timing/TimingSection.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/TimingSection.cs b/osu.Game/Screens/Edit/Timing/TimingSection.cs index 07f8f2ba3a..13af04cd4b 100644 --- a/osu.Game/Screens/Edit/Timing/TimingSection.cs +++ b/osu.Game/Screens/Edit/Timing/TimingSection.cs @@ -1,13 +1,11 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics.UserInterfaceV2; -using osu.Game.Overlays.Settings; namespace osu.Game.Screens.Edit.Timing {