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
|
|
|
|
|
|
|
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;
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
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
|
|
|
{
|
|
|
|
public class TimelineArea : CompositeDrawable
|
|
|
|
{
|
|
|
|
private readonly Timeline timeline;
|
|
|
|
|
|
|
|
public TimelineArea()
|
|
|
|
{
|
|
|
|
Masking = true;
|
|
|
|
CornerRadius = 5;
|
|
|
|
|
|
|
|
OsuCheckbox hitObjectsCheckbox;
|
|
|
|
OsuCheckbox hitSoundsCheckbox;
|
|
|
|
OsuCheckbox waveformCheckbox;
|
2018-06-11 19:08:17 +08:00
|
|
|
|
2018-05-18 12:05:58 +08:00
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
{
|
|
|
|
new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Colour = OsuColour.FromHex("111")
|
|
|
|
},
|
|
|
|
new GridContainer
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Content = new[]
|
|
|
|
{
|
|
|
|
new Drawable[]
|
|
|
|
{
|
|
|
|
new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
AutoSizeAxes = Axes.X,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Colour = OsuColour.FromHex("222")
|
|
|
|
},
|
|
|
|
new FillFlowContainer
|
|
|
|
{
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
Width = 160,
|
|
|
|
Padding = new MarginPadding { Horizontal = 15 },
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
Spacing = new Vector2(0, 4),
|
|
|
|
Children = new[]
|
|
|
|
{
|
2018-09-15 22:30:11 +08:00
|
|
|
hitObjectsCheckbox = new OsuCheckbox { LabelText = "Hit objects" },
|
|
|
|
hitSoundsCheckbox = new OsuCheckbox { LabelText = "Hit sounds" },
|
2018-05-18 12:05:58 +08:00
|
|
|
waveformCheckbox = new OsuCheckbox { LabelText = "Waveform" }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
AutoSizeAxes = Axes.X,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Colour = OsuColour.FromHex("333")
|
|
|
|
},
|
|
|
|
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-03-27 18:29:27 +08:00
|
|
|
Icon = FontAwesome.SearchPlus,
|
2019-03-02 13:34:56 +08:00
|
|
|
Action = () => changeZoom(1)
|
2018-05-18 12:05:58 +08:00
|
|
|
},
|
|
|
|
new TimelineButton
|
|
|
|
{
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
Height = 0.5f,
|
2019-03-27 18:29:27 +08:00
|
|
|
Icon = FontAwesome.SearchMinus,
|
2019-03-02 13:34:56 +08:00
|
|
|
Action = () => changeZoom(-1)
|
2018-05-18 12:05:58 +08:00
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
timeline = new Timeline { RelativeSizeAxes = Axes.Both }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
ColumnDimensions = new[]
|
|
|
|
{
|
|
|
|
new Dimension(GridSizeMode.AutoSize),
|
|
|
|
new Dimension(GridSizeMode.AutoSize),
|
|
|
|
new Dimension(GridSizeMode.Distributed),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
hitObjectsCheckbox.Current.Value = true;
|
|
|
|
hitSoundsCheckbox.Current.Value = true;
|
|
|
|
waveformCheckbox.Current.Value = true;
|
|
|
|
|
|
|
|
timeline.WaveformVisible.BindTo(waveformCheckbox.Current);
|
|
|
|
}
|
2019-03-02 13:34:56 +08:00
|
|
|
|
|
|
|
private void changeZoom(float change) => timeline.Zoom += change;
|
2018-05-18 12:05:58 +08:00
|
|
|
}
|
|
|
|
}
|