2019-01-24 17:43:03 +09:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-05-18 13:05:58 +09:00
|
|
|
|
2019-12-05 20:12:25 +09:00
|
|
|
using osu.Framework.Allocation;
|
2018-05-18 13:05:58 +09:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2019-03-27 19:29:27 +09:00
|
|
|
using osu.Framework.Graphics.Sprites;
|
2023-07-14 15:58:53 +09:00
|
|
|
using osu.Game.Graphics;
|
2018-05-18 13:05:58 +09:00
|
|
|
using osu.Game.Graphics.UserInterface;
|
2023-01-15 01:50:41 +03:00
|
|
|
using osu.Game.Localisation;
|
2022-05-24 16:32:44 +09:00
|
|
|
using osu.Game.Overlays;
|
2023-01-15 14:39:34 +03:00
|
|
|
using osu.Game.Resources.Localisation.Web;
|
2023-07-21 14:39:15 +09:00
|
|
|
using osu.Game.Rulesets.Edit;
|
2018-11-20 16:51:59 +09:00
|
|
|
using osuTK;
|
2018-05-18 13:05:58 +09:00
|
|
|
|
2018-11-06 18:28:22 +09:00
|
|
|
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
2018-05-18 13:05:58 +09:00
|
|
|
{
|
2021-04-14 20:55:12 +09:00
|
|
|
public partial class TimelineArea : CompositeDrawable
|
2018-05-18 13:05:58 +09:00
|
|
|
{
|
2023-07-14 14:04:12 +09:00
|
|
|
public Timeline Timeline = null!;
|
2018-05-18 13:05:58 +09:00
|
|
|
|
2021-04-14 20:55:12 +09:00
|
|
|
private readonly Drawable userContent;
|
|
|
|
|
2023-07-14 14:04:12 +09:00
|
|
|
public TimelineArea(Drawable? content = null)
|
2021-04-14 20:55:12 +09:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
AutoSizeAxes = Axes.Y;
|
|
|
|
|
2023-07-14 14:04:12 +09:00
|
|
|
userContent = content ?? Empty();
|
2021-04-14 20:55:12 +09:00
|
|
|
}
|
2019-12-05 20:12:25 +09:00
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2023-07-14 15:58:53 +09:00
|
|
|
private void load(OverlayColourProvider colourProvider, OsuColour colours)
|
2018-05-18 13:05:58 +09:00
|
|
|
{
|
|
|
|
OsuCheckbox waveformCheckbox;
|
2020-10-01 17:19:35 +09:00
|
|
|
OsuCheckbox controlPointsCheckbox;
|
2020-10-01 18:14:10 +09:00
|
|
|
OsuCheckbox ticksCheckbox;
|
2018-06-11 20:08:17 +09:00
|
|
|
|
2023-07-21 14:39:15 +09:00
|
|
|
const float padding = 10;
|
|
|
|
|
2018-05-18 13:05:58 +09:00
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
{
|
|
|
|
new GridContainer
|
|
|
|
{
|
2021-04-14 16:00:49 +09:00
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2023-07-14 14:19:04 +09:00
|
|
|
RowDimensions = new[]
|
|
|
|
{
|
|
|
|
new Dimension(GridSizeMode.AutoSize),
|
|
|
|
},
|
|
|
|
ColumnDimensions = new[]
|
|
|
|
{
|
2023-07-21 15:26:41 +09:00
|
|
|
new Dimension(GridSizeMode.Absolute, 135),
|
2023-07-14 14:19:04 +09:00
|
|
|
new Dimension(),
|
2023-07-14 15:58:53 +09:00
|
|
|
new Dimension(GridSizeMode.Absolute, 35),
|
2023-07-21 14:39:15 +09:00
|
|
|
new Dimension(GridSizeMode.Absolute, HitObjectComposer.TOOLBOX_CONTRACTED_SIZE_RIGHT - padding * 2),
|
2023-07-14 14:19:04 +09:00
|
|
|
},
|
2018-05-18 13:05:58 +09:00
|
|
|
Content = new[]
|
|
|
|
{
|
|
|
|
new Drawable[]
|
|
|
|
{
|
|
|
|
new Container
|
|
|
|
{
|
2023-07-14 14:19:04 +09:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
2022-05-24 16:32:44 +09:00
|
|
|
Name = @"Toggle controls",
|
2018-05-18 13:05:58 +09:00
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2022-05-24 16:32:44 +09:00
|
|
|
Colour = colourProvider.Background2,
|
2018-05-18 13:05:58 +09:00
|
|
|
},
|
|
|
|
new FillFlowContainer
|
|
|
|
{
|
2023-07-14 14:24:40 +09:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
2023-07-21 14:39:15 +09:00
|
|
|
Padding = new MarginPadding(padding),
|
2018-05-18 13:05:58 +09:00
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
Spacing = new Vector2(0, 4),
|
|
|
|
Children = new[]
|
|
|
|
{
|
2023-07-14 14:24:40 +09:00
|
|
|
waveformCheckbox = new OsuCheckbox(nubSize: 30f)
|
2020-10-01 17:19:35 +09:00
|
|
|
{
|
2023-01-15 01:50:41 +03:00
|
|
|
LabelText = EditorStrings.TimelineWaveform,
|
2020-10-01 17:19:35 +09:00
|
|
|
Current = { Value = true },
|
|
|
|
},
|
2023-07-14 14:24:40 +09:00
|
|
|
ticksCheckbox = new OsuCheckbox(nubSize: 30f)
|
2020-10-01 17:19:35 +09:00
|
|
|
{
|
2023-01-15 01:50:41 +03:00
|
|
|
LabelText = EditorStrings.TimelineTicks,
|
2020-10-01 17:19:35 +09:00
|
|
|
Current = { Value = true },
|
2020-10-01 18:14:10 +09:00
|
|
|
},
|
2023-07-14 14:24:40 +09:00
|
|
|
controlPointsCheckbox = new OsuCheckbox(nubSize: 30f)
|
2020-10-01 18:14:10 +09:00
|
|
|
{
|
2023-01-15 14:39:34 +03:00
|
|
|
LabelText = BeatmapsetsStrings.ShowStatsBpm,
|
2020-10-01 18:14:10 +09:00
|
|
|
Current = { Value = true },
|
2022-10-13 15:44:33 +09:00
|
|
|
},
|
2018-05-18 13:05:58 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2023-07-14 14:24:40 +09:00
|
|
|
new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
2023-07-14 15:58:53 +09:00
|
|
|
// 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,
|
|
|
|
},
|
2023-07-14 14:24:40 +09:00
|
|
|
new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Depth = float.MaxValue,
|
|
|
|
Colour = colourProvider.Background5
|
|
|
|
},
|
|
|
|
Timeline = new Timeline(userContent),
|
|
|
|
}
|
|
|
|
},
|
2018-05-18 13:05:58 +09:00
|
|
|
new Container
|
|
|
|
{
|
2023-07-14 14:19:04 +09:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
2022-05-24 16:32:44 +09:00
|
|
|
Name = @"Zoom controls",
|
2023-07-21 14:39:15 +09:00
|
|
|
Padding = new MarginPadding { Right = padding },
|
2018-05-18 13:05:58 +09:00
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2023-07-14 14:19:04 +09:00
|
|
|
Colour = colourProvider.Background2,
|
2018-05-18 13:05:58 +09:00
|
|
|
},
|
|
|
|
new Container<TimelineButton>
|
|
|
|
{
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
Origin = Anchor.CentreLeft,
|
2023-07-14 14:19:04 +09:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
2018-05-18 13:05:58 +09:00
|
|
|
Children = new[]
|
|
|
|
{
|
|
|
|
new TimelineButton
|
|
|
|
{
|
2023-07-14 14:19:04 +09:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Size = new Vector2(1, 0.5f),
|
2019-04-02 19:55:24 +09:00
|
|
|
Icon = FontAwesome.Solid.SearchPlus,
|
2022-07-22 14:44:48 +09:00
|
|
|
Action = () => Timeline.AdjustZoomRelatively(1)
|
2018-05-18 13:05:58 +09:00
|
|
|
},
|
|
|
|
new TimelineButton
|
|
|
|
{
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
Origin = Anchor.BottomLeft,
|
2023-07-14 14:19:04 +09:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Size = new Vector2(1, 0.5f),
|
2019-04-02 19:55:24 +09:00
|
|
|
Icon = FontAwesome.Solid.SearchMinus,
|
2022-07-22 14:44:48 +09:00
|
|
|
Action = () => Timeline.AdjustZoomRelatively(-1)
|
2018-05-18 13:05:58 +09:00
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2023-07-14 14:19:04 +09:00
|
|
|
new BeatDivisorControl { RelativeSizeAxes = Axes.Both }
|
2018-05-18 13:05:58 +09:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-09-30 16:39:27 +09:00
|
|
|
Timeline.WaveformVisible.BindTo(waveformCheckbox.Current);
|
2020-10-01 17:19:35 +09:00
|
|
|
Timeline.ControlPointsVisible.BindTo(controlPointsCheckbox.Current);
|
2020-10-01 18:14:10 +09:00
|
|
|
Timeline.TicksVisible.BindTo(ticksCheckbox.Current);
|
2018-05-18 13:05:58 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|