2019-01-24 08:43:03 +00: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-04-13 09:19:50 +00:00
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
#nullable disable
|
|
|
|
|
2018-05-23 08:37:39 +00:00
|
|
|
using osu.Framework.Allocation;
|
2021-11-08 13:54:31 +00:00
|
|
|
using osu.Framework.Bindables;
|
2017-10-02 00:26:41 +00:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2021-08-28 16:49:24 +00:00
|
|
|
using osu.Framework.Graphics.Cursor;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
2018-11-06 09:28:22 +00:00
|
|
|
namespace osu.Game.Screens.Edit
|
2017-10-02 00:26:41 +00:00
|
|
|
{
|
2018-03-14 06:18:21 +00:00
|
|
|
/// <summary>
|
2019-10-09 07:04:58 +00:00
|
|
|
/// TODO: eventually make this inherit Screen and add a local screen stack inside the Editor.
|
2018-03-14 06:18:21 +00:00
|
|
|
/// </summary>
|
2021-08-25 13:58:06 +00:00
|
|
|
public abstract class EditorScreen : VisibilityContainer
|
2017-10-02 00:26:41 +00:00
|
|
|
{
|
2019-12-27 10:46:33 +00:00
|
|
|
[Resolved]
|
|
|
|
protected EditorBeatmap EditorBeatmap { get; private set; }
|
|
|
|
|
2017-10-02 00:34:51 +00:00
|
|
|
protected override Container<Drawable> Content => content;
|
2017-10-02 00:26:41 +00:00
|
|
|
private readonly Container content;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
2020-09-24 08:03:54 +00:00
|
|
|
public readonly EditorScreenMode Type;
|
|
|
|
|
|
|
|
protected EditorScreen(EditorScreenMode type)
|
2017-10-02 00:26:41 +00:00
|
|
|
{
|
2020-09-24 08:03:54 +00:00
|
|
|
Type = type;
|
|
|
|
|
2017-10-02 00:26:41 +00:00
|
|
|
Anchor = Anchor.Centre;
|
|
|
|
Origin = Anchor.Centre;
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
2021-08-28 16:49:24 +00:00
|
|
|
InternalChild = content = new PopoverContainer { RelativeSizeAxes = Axes.Both };
|
2017-10-02 00:26:41 +00:00
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
2022-05-24 08:23:42 +00:00
|
|
|
protected override void PopIn() => this.FadeIn();
|
2018-04-13 09:19:50 +00:00
|
|
|
|
2022-05-24 08:23:42 +00:00
|
|
|
protected override void PopOut() => this.FadeOut();
|
2021-11-08 13:24:39 +00:00
|
|
|
|
|
|
|
#region Clipboard operations
|
|
|
|
|
2021-11-08 13:54:31 +00:00
|
|
|
public BindableBool CanCut { get; } = new BindableBool();
|
|
|
|
|
2021-11-08 13:24:39 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Performs a "cut to clipboard" operation appropriate for the given screen.
|
|
|
|
/// </summary>
|
2021-11-08 13:54:31 +00:00
|
|
|
protected virtual void PerformCut()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Cut()
|
2021-11-08 13:24:39 +00:00
|
|
|
{
|
2021-11-08 13:54:31 +00:00
|
|
|
if (CanCut.Value)
|
|
|
|
PerformCut();
|
2021-11-08 13:24:39 +00:00
|
|
|
}
|
|
|
|
|
2021-11-08 13:54:31 +00:00
|
|
|
public BindableBool CanCopy { get; } = new BindableBool();
|
|
|
|
|
2021-11-08 13:24:39 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Performs a "copy to clipboard" operation appropriate for the given screen.
|
|
|
|
/// </summary>
|
2021-11-08 13:54:31 +00:00
|
|
|
protected virtual void PerformCopy()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-11-08 13:24:39 +00:00
|
|
|
public virtual void Copy()
|
|
|
|
{
|
2021-11-08 13:54:31 +00:00
|
|
|
if (CanCopy.Value)
|
|
|
|
PerformCopy();
|
2021-11-08 13:24:39 +00:00
|
|
|
}
|
|
|
|
|
2021-11-08 13:54:31 +00:00
|
|
|
public BindableBool CanPaste { get; } = new BindableBool();
|
|
|
|
|
2021-11-08 13:24:39 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Performs a "paste from clipboard" operation appropriate for the given screen.
|
|
|
|
/// </summary>
|
2021-11-08 13:54:31 +00:00
|
|
|
protected virtual void PerformPaste()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-11-08 13:24:39 +00:00
|
|
|
public virtual void Paste()
|
|
|
|
{
|
2021-11-08 13:54:31 +00:00
|
|
|
if (CanPaste.Value)
|
|
|
|
PerformPaste();
|
2021-11-08 13:24:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
2017-10-02 00:26:41 +00:00
|
|
|
}
|
|
|
|
}
|