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