2019-01-24 16:43:03 +08: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 12:05:58 +08:00
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
#nullable disable
|
|
|
|
|
2019-12-05 19:12:25 +08:00
|
|
|
using osu.Framework.Allocation;
|
2018-05-18 12:05:58 +08:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2019-03-27 18:29:27 +08:00
|
|
|
using osu.Framework.Graphics.Sprites;
|
2018-05-18 12:05:58 +08:00
|
|
|
using osu.Game.Graphics.UserInterface;
|
2022-05-24 15:32:44 +08:00
|
|
|
using osu.Game.Overlays;
|
2018-11-20 15:51:59 +08:00
|
|
|
using osuTK;
|
2018-05-18 12:05:58 +08:00
|
|
|
|
2018-11-06 17:28:22 +08:00
|
|
|
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
2018-05-18 12:05:58 +08:00
|
|
|
{
|
2021-04-14 19:55:12 +08:00
|
|
|
public class TimelineArea : CompositeDrawable
|
2018-05-18 12:05:58 +08:00
|
|
|
{
|
2021-04-14 19:55:12 +08:00
|
|
|
public Timeline Timeline;
|
2018-05-18 12:05:58 +08:00
|
|
|
|
2021-04-14 19:55:12 +08:00
|
|
|
private readonly Drawable userContent;
|
|
|
|
|
|
|
|
public TimelineArea(Drawable content = null)
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
AutoSizeAxes = Axes.Y;
|
|
|
|
|
|
|
|
userContent = content ?? Drawable.Empty();
|
|
|
|
}
|
2019-12-05 19:12:25 +08:00
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2022-05-24 15:32:44 +08:00
|
|
|
private void load(OverlayColourProvider colourProvider)
|
2018-05-18 12:05:58 +08:00
|
|
|
{
|
|
|
|
Masking = true;
|
|
|
|
|
|
|
|
OsuCheckbox waveformCheckbox;
|
2020-10-01 16:19:35 +08:00
|
|
|
OsuCheckbox controlPointsCheckbox;
|
2020-10-01 17:14:10 +08:00
|
|
|
OsuCheckbox ticksCheckbox;
|
2018-06-11 19:08:17 +08:00
|
|
|
|
2018-05-18 12:05:58 +08:00
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
{
|
|
|
|
new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2022-05-24 15:32:44 +08:00
|
|
|
Colour = colourProvider.Background5
|
2018-05-18 12:05:58 +08:00
|
|
|
},
|
|
|
|
new GridContainer
|
|
|
|
{
|
2021-04-14 15:00:49 +08:00
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2018-05-18 12:05:58 +08:00
|
|
|
Content = new[]
|
|
|
|
{
|
|
|
|
new Drawable[]
|
|
|
|
{
|
|
|
|
new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
AutoSizeAxes = Axes.X,
|
2022-05-24 15:32:44 +08:00
|
|
|
Name = @"Toggle controls",
|
2018-05-18 12:05:58 +08:00
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2022-05-24 15:32:44 +08:00
|
|
|
Colour = colourProvider.Background2,
|
2018-05-18 12:05:58 +08:00
|
|
|
},
|
|
|
|
new FillFlowContainer
|
|
|
|
{
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
Width = 160,
|
2021-04-14 19:11:32 +08:00
|
|
|
Padding = new MarginPadding(10),
|
2018-05-18 12:05:58 +08:00
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
Spacing = new Vector2(0, 4),
|
|
|
|
Children = new[]
|
|
|
|
{
|
2020-10-01 16:19:35 +08:00
|
|
|
waveformCheckbox = new OsuCheckbox
|
|
|
|
{
|
|
|
|
LabelText = "Waveform",
|
|
|
|
Current = { Value = true },
|
|
|
|
},
|
|
|
|
controlPointsCheckbox = new OsuCheckbox
|
|
|
|
{
|
|
|
|
LabelText = "Control Points",
|
|
|
|
Current = { Value = true },
|
2020-10-01 17:14:10 +08:00
|
|
|
},
|
|
|
|
ticksCheckbox = new OsuCheckbox
|
|
|
|
{
|
|
|
|
LabelText = "Ticks",
|
|
|
|
Current = { Value = true },
|
2020-10-01 16:19:35 +08:00
|
|
|
}
|
2018-05-18 12:05:58 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
AutoSizeAxes = Axes.X,
|
2022-05-24 15:32:44 +08:00
|
|
|
Name = @"Zoom controls",
|
2018-05-18 12:05:58 +08:00
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2022-05-24 15:32:44 +08:00
|
|
|
Colour = colourProvider.Background3,
|
2018-05-18 12:05:58 +08:00
|
|
|
},
|
|
|
|
new Container<TimelineButton>
|
|
|
|
{
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
AutoSizeAxes = Axes.X,
|
|
|
|
Masking = true,
|
|
|
|
Children = new[]
|
|
|
|
{
|
|
|
|
new TimelineButton
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
Height = 0.5f,
|
2019-04-02 18:55:24 +08:00
|
|
|
Icon = FontAwesome.Solid.SearchPlus,
|
2022-07-22 13:44:48 +08:00
|
|
|
Action = () => Timeline.AdjustZoomRelatively(1)
|
2018-05-18 12:05:58 +08:00
|
|
|
},
|
|
|
|
new TimelineButton
|
|
|
|
{
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
Height = 0.5f,
|
2019-04-02 18:55:24 +08:00
|
|
|
Icon = FontAwesome.Solid.SearchMinus,
|
2022-07-22 13:44:48 +08:00
|
|
|
Action = () => Timeline.AdjustZoomRelatively(-1)
|
2018-05-18 12:05:58 +08:00
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2021-04-14 19:55:12 +08:00
|
|
|
Timeline = new Timeline(userContent),
|
2018-05-18 12:05:58 +08:00
|
|
|
},
|
|
|
|
},
|
2021-04-14 15:00:49 +08:00
|
|
|
RowDimensions = new[]
|
|
|
|
{
|
|
|
|
new Dimension(GridSizeMode.AutoSize),
|
|
|
|
},
|
2018-05-18 12:05:58 +08:00
|
|
|
ColumnDimensions = new[]
|
|
|
|
{
|
|
|
|
new Dimension(GridSizeMode.AutoSize),
|
|
|
|
new Dimension(GridSizeMode.AutoSize),
|
2021-04-14 15:00:49 +08:00
|
|
|
new Dimension(),
|
2018-05-18 12:05:58 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-09-30 15:39:27 +08:00
|
|
|
Timeline.WaveformVisible.BindTo(waveformCheckbox.Current);
|
2020-10-01 16:19:35 +08:00
|
|
|
Timeline.ControlPointsVisible.BindTo(controlPointsCheckbox.Current);
|
2020-10-01 17:14:10 +08:00
|
|
|
Timeline.TicksVisible.BindTo(ticksCheckbox.Current);
|
2018-05-18 12:05:58 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|