Skip to content

Commit

Permalink
Rename the property.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Jun 23, 2024
1 parent 560e861 commit a370b09
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Screens.Edit.Beatmap.Lyrics;

public class LyricEditorTest
{
[TestCase(LyricEditorLayout.Preview, LyricEditorLayout.Preview, LyricEditorLayout.Preview)]
[TestCase(LyricEditorLayout.Detail, LyricEditorLayout.Detail, LyricEditorLayout.Detail)]
[TestCase(LyricEditorLayout.Preview | LyricEditorLayout.Detail, LyricEditorLayout.Preview, LyricEditorLayout.Preview)]
[TestCase(LyricEditorLayout.Preview | LyricEditorLayout.Detail, LyricEditorLayout.Detail, LyricEditorLayout.Detail)]
[TestCase(LyricEditorLayout.Preview, LyricEditorLayout.Detail, LyricEditorLayout.Preview)] // should use the support layout if prefer layout is not matched.
[TestCase(LyricEditorLayout.Detail, LyricEditorLayout.Preview, LyricEditorLayout.Detail)]
[TestCase(LyricEditorLayout.List, LyricEditorLayout.List, LyricEditorLayout.List)]
[TestCase(LyricEditorLayout.Compose, LyricEditorLayout.Compose, LyricEditorLayout.Compose)]
[TestCase(LyricEditorLayout.List | LyricEditorLayout.Compose, LyricEditorLayout.List, LyricEditorLayout.List)]
[TestCase(LyricEditorLayout.List | LyricEditorLayout.Compose, LyricEditorLayout.Compose, LyricEditorLayout.Compose)]
[TestCase(LyricEditorLayout.List, LyricEditorLayout.Compose, LyricEditorLayout.List)] // should use the support layout if prefer layout is not matched.
[TestCase(LyricEditorLayout.Compose, LyricEditorLayout.List, LyricEditorLayout.Compose)]
public void TestGetSuitableLayout(LyricEditorLayout supportedLayout, LyricEditorLayout preferLayout, LyricEditorLayout actualLayout)
{
var expectedLayout = LyricEditor.GetSuitableLayout(supportedLayout, preferLayout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ protected override void InitialiseDefaults()
base.InitialiseDefaults();

// General
SetDefault(KaraokeRulesetLyricEditorSetting.LyricEditorPreferLayout, LyricEditorLayout.Preview);
SetDefault(KaraokeRulesetLyricEditorSetting.LyricEditorPreferLayout, LyricEditorLayout.List);
SetDefault(KaraokeRulesetLyricEditorSetting.LyricEditorFontSize, FontUtils.DEFAULT_FONT_SIZE);
SetDefault(KaraokeRulesetLyricEditorSetting.AutoFocusToEditLyric, true);
SetDefault(KaraokeRulesetLyricEditorSetting.AutoFocusToEditLyricSkipRows, 1, 0, 4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public partial class LyricEditor : Container, ILyricEditorState, IKeyBindingHand

private readonly Bindable<LyricEditorMode> bindableMode = new();
private readonly Bindable<EditorModeWithEditStep> bindableModeWithEditStep = new();
private readonly IBindable<LyricEditorLayout> bindablePreferLayout = new Bindable<LyricEditorLayout>(LyricEditorLayout.Preview);
private readonly IBindable<LyricEditorLayout> bindablePreferLayout = new Bindable<LyricEditorLayout>(LyricEditorLayout.List);
private readonly Bindable<LyricEditorLayout> bindableCurrentLayout = new();

public IBindable<LyricEditorMode> BindableMode => bindableMode;
Expand Down Expand Up @@ -288,15 +288,15 @@ private void reCalculateLayout()
static LyricEditorLayout getSupportedLayout(LyricEditorMode mode) =>
mode switch
{
LyricEditorMode.View => LyricEditorLayout.Preview,
LyricEditorMode.EditText => LyricEditorLayout.Preview | LyricEditorLayout.Detail,
LyricEditorMode.EditReferenceLyric => LyricEditorLayout.Preview | LyricEditorLayout.Detail,
LyricEditorMode.EditLanguage => LyricEditorLayout.Preview | LyricEditorLayout.Detail,
LyricEditorMode.EditRuby => LyricEditorLayout.Preview | LyricEditorLayout.Detail,
LyricEditorMode.EditTimeTag => LyricEditorLayout.Detail,
LyricEditorMode.EditRomanisation => LyricEditorLayout.Preview | LyricEditorLayout.Detail,
LyricEditorMode.EditNote => LyricEditorLayout.Detail,
LyricEditorMode.EditSinger => LyricEditorLayout.Preview,
LyricEditorMode.View => LyricEditorLayout.List,
LyricEditorMode.EditText => LyricEditorLayout.List | LyricEditorLayout.Compose,
LyricEditorMode.EditReferenceLyric => LyricEditorLayout.List | LyricEditorLayout.Compose,
LyricEditorMode.EditLanguage => LyricEditorLayout.List | LyricEditorLayout.Compose,
LyricEditorMode.EditRuby => LyricEditorLayout.List | LyricEditorLayout.Compose,
LyricEditorMode.EditTimeTag => LyricEditorLayout.Compose,
LyricEditorMode.EditRomanisation => LyricEditorLayout.List | LyricEditorLayout.Compose,
LyricEditorMode.EditNote => LyricEditorLayout.Compose,
LyricEditorMode.EditSinger => LyricEditorLayout.List,
_ => throw new ArgumentOutOfRangeException(nameof(mode), mode, null),
};
}
Expand Down Expand Up @@ -345,7 +345,7 @@ private void switchLayout(LyricEditorLayout layout)
static Container getContent(LyricEditorLayout layout) =>
layout switch
{
LyricEditorLayout.Preview => new Container
LyricEditorLayout.List => new Container
{
Children = new[]
{
Expand All @@ -355,7 +355,7 @@ static Container getContent(LyricEditorLayout layout) =>
},
},
},
LyricEditorLayout.Detail => new Container
LyricEditorLayout.Compose => new Container
{
Children = new Drawable[]
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics;
[Flags]
public enum LyricEditorLayout
{
Preview = 1,
/// <summary>
/// Show the list of lyrics in the main content area.
/// </summary>
List = 1,

Detail = 1 << 1,
/// <summary>
/// Show the compose area at the top of the main content area.
/// User can select the edit lyric at the bottom of the compose area.
/// </summary>
Compose = 1 << 1,
}

0 comments on commit a370b09

Please sign in to comment.