Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby mode should after time tag mode. #2133

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ private void updateModeWithEditStep()
LyricEditorMode.Reference => null,
LyricEditorMode.Language => throw new NotSupportedException(),
LyricEditorMode.EditRuby => throw new NotSupportedException(),
LyricEditorMode.EditRomaji => throw new NotSupportedException(),
LyricEditorMode.EditTimeTag => throw new NotSupportedException(),
LyricEditorMode.EditRomaji => throw new NotSupportedException(),
LyricEditorMode.EditNote => throw new NotSupportedException(),
LyricEditorMode.Singer => throw new NotSupportedException(),
_ => throw new ArgumentOutOfRangeException(nameof(mode), mode, null),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,17 @@ public void TestEditRubyMode()
}

[Test]
public void TestEditRomajiMode()
public void TestEditTimeTagMode()
{
switchToMode(LyricEditorMode.EditRomaji);
clickEditStepButtons<RomajiTagEditStep>();
switchToMode(LyricEditorMode.EditTimeTag);
clickEditStepButtons<TimeTagEditStep>();
}

[Test]
public void TestEditTimeTagMode()
public void TestEditRomajiMode()
{
switchToMode(LyricEditorMode.EditTimeTag);
clickEditStepButtons<TimeTagEditStep>();
switchToMode(LyricEditorMode.EditRomaji);
clickEditStepButtons<RomajiTagEditStep>();
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public LyricEditorModeMenu(Bindable<LyricEditorMode> config, string text)
LyricEditorMode.Reference,
LyricEditorMode.Language,
LyricEditorMode.EditRuby,
LyricEditorMode.EditRomaji,
LyricEditorMode.EditTimeTag,
LyricEditorMode.EditRomaji,
LyricEditorMode.EditNote,
LyricEditorMode.Singer,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ protected void InitializeBlueprint()
modeWithEditStep.Mode switch
{
LyricEditorMode.EditRuby => rubyTagEditMode == RubyTagEditMode.Create ? null : new RubyBlueprintContainer(lyric),
LyricEditorMode.EditRomaji => new RomajiBlueprintContainer(lyric),
LyricEditorMode.EditTimeTag => modeWithEditStep.EditStep is TimeTagEditStep.Adjust ? new TimeTagBlueprintContainer(lyric) : null,
LyricEditorMode.EditRomaji => new RomajiBlueprintContainer(lyric),
_ => null,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ private void triggerWritableVersionChanged()
LyricEditorMode.Reference => HitObjectWritableUtils.GetLyricPropertyLockedBy(lyric, nameof(Objects.Lyric.ReferenceLyric), nameof(Objects.Lyric.ReferenceLyricConfig)),
LyricEditorMode.Language => HitObjectWritableUtils.GetLyricPropertyLockedBy(lyric, nameof(Objects.Lyric.Language)),
LyricEditorMode.EditRuby => HitObjectWritableUtils.GetLyricPropertyLockedBy(lyric, nameof(Objects.Lyric.RubyTags)),
LyricEditorMode.EditRomaji => HitObjectWritableUtils.GetLyricPropertyLockedBy(lyric, nameof(Objects.Lyric.RomajiTags)),
LyricEditorMode.EditTimeTag => HitObjectWritableUtils.GetLyricPropertyLockedBy(lyric, nameof(Objects.Lyric.TimeTags)),
LyricEditorMode.EditRomaji => HitObjectWritableUtils.GetLyricPropertyLockedBy(lyric, nameof(Objects.Lyric.RomajiTags)),
LyricEditorMode.EditNote => HitObjectWritableUtils.GetCreateOrRemoveNoteLockedBy(lyric),
LyricEditorMode.Singer => HitObjectWritableUtils.GetLyricPropertyLockedBy(lyric, nameof(Objects.Lyric.SingerIds)),
_ => throw new ArgumentOutOfRangeException(nameof(mode), mode, null),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ private static IEnumerable<Drawable> createItemForEditMode(EditorModeWithEditSte
LyricEditorMode.Reference => Array.Empty<Drawable>(),
LyricEditorMode.Language => Array.Empty<Drawable>(),
LyricEditorMode.EditRuby => Array.Empty<Drawable>(),
LyricEditorMode.EditRomaji => Array.Empty<Drawable>(),
LyricEditorMode.EditTimeTag => createItemsForTimeTagEditStep(editorModeWithEditStep.GetEditStep<TimeTagEditStep>()),
LyricEditorMode.EditRomaji => Array.Empty<Drawable>(),
LyricEditorMode.EditNote => createItemsForNoteEditStep(editorModeWithEditStep.GetEditStep<NoteEditStep>()),
LyricEditorMode.Singer => Array.Empty<Drawable>(),
_ => throw new ArgumentOutOfRangeException(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public partial class IssueNavigator : Component, IIssueNavigator
private IEditRubyModeState editRubyModeState { get; set; } = null!;

[Resolved]
private IEditRomajiModeState editRomajiModeState { get; set; } = null!;
private ITimeTagModeState timeTagModeState { get; set; } = null!;

[Resolved]
private ITimeTagModeState timeTagModeState { get; set; } = null!;
private IEditRomajiModeState editRomajiModeState { get; set; } = null!;

[Resolved]
private IEditNoteModeState noteModeState { get; set; } = null!;
Expand Down Expand Up @@ -85,12 +85,12 @@ public void Navigate(Issue issue)
case CheckLyricRubyTag:
return LyricEditorMode.EditRuby;

case CheckLyricRomajiTag:
return LyricEditorMode.EditRomaji;

case CheckLyricTimeTag:
return LyricEditorMode.EditTimeTag;

case CheckLyricRomajiTag:
return LyricEditorMode.EditRomaji;

case CheckNoteReferenceLyric:
case CheckNoteText:
return LyricEditorMode.EditNote;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ public partial class LyricEditor : Container, ILyricEditorState, IKeyBindingHand
[Cached(typeof(IEditRubyModeState))]
private readonly EditRubyModeState editRubyModeState;

[Cached(typeof(IEditRomajiModeState))]
private readonly EditRomajiModeState editRomajiModeState;

[Cached(typeof(ITimeTagModeState))]
private readonly TimeTagModeState timeTagModeState;

[Cached(typeof(IEditRomajiModeState))]
private readonly EditRomajiModeState editRomajiModeState;

[Cached(typeof(IEditNoteModeState))]
private readonly EditNoteModeState editNoteModeState;

Expand Down Expand Up @@ -103,8 +103,8 @@ public LyricEditor()
AddInternal(editReferenceLyricModeState = new EditReferenceLyricModeState());
AddInternal(languageModeState = new LanguageModeState());
AddInternal(editRubyModeState = new EditRubyModeState());
AddInternal(editRomajiModeState = new EditRomajiModeState());
AddInternal(timeTagModeState = new TimeTagModeState());
AddInternal(editRomajiModeState = new EditRomajiModeState());
AddInternal(editNoteModeState = new EditNoteModeState());

// Separated feature.
Expand Down Expand Up @@ -207,8 +207,8 @@ private void updateModeWithEditStep()
LyricEditorMode.Reference => editReferenceLyricModeState.BindableEditStep.Value,
LyricEditorMode.Language => languageModeState.BindableEditStep.Value,
LyricEditorMode.EditRuby => editRubyModeState.BindableEditStep.Value,
LyricEditorMode.EditRomaji => editRomajiModeState.BindableEditStep.Value,
LyricEditorMode.EditTimeTag => timeTagModeState.BindableEditStep.Value,
LyricEditorMode.EditRomaji => editRomajiModeState.BindableEditStep.Value,
LyricEditorMode.EditNote => editNoteModeState.BindableEditStep.Value,
LyricEditorMode.Singer => null,
_ => throw new ArgumentOutOfRangeException(nameof(mode), mode, null),
Expand Down Expand Up @@ -258,8 +258,8 @@ private void initializeSettingsArea()
LyricEditorMode.Reference => new ReferenceSettings(),
LyricEditorMode.Language => new LanguageSettings(),
LyricEditorMode.EditRuby => new RubyTagSettings(),
LyricEditorMode.EditRomaji => new RomajiTagSettings(),
LyricEditorMode.EditTimeTag => new TimeTagSettings(),
LyricEditorMode.EditRomaji => new RomajiTagSettings(),
LyricEditorMode.EditNote => new NoteSettings(),
LyricEditorMode.Singer => new SingerSettings(),
_ => null,
Expand Down Expand Up @@ -293,8 +293,8 @@ static LyricEditorLayout getSupportedLayout(LyricEditorMode mode) =>
LyricEditorMode.Reference => LyricEditorLayout.Preview | LyricEditorLayout.Detail,
LyricEditorMode.Language => LyricEditorLayout.Preview | LyricEditorLayout.Detail,
LyricEditorMode.EditRuby => LyricEditorLayout.Preview | LyricEditorLayout.Detail,
LyricEditorMode.EditRomaji => LyricEditorLayout.Preview | LyricEditorLayout.Detail,
LyricEditorMode.EditTimeTag => LyricEditorLayout.Detail,
LyricEditorMode.EditRomaji => LyricEditorLayout.Preview | LyricEditorLayout.Detail,
LyricEditorMode.EditNote => LyricEditorLayout.Detail,
LyricEditorMode.Singer => LyricEditorLayout.Preview,
_ => throw new ArgumentOutOfRangeException(nameof(mode), mode, null),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ public partial class LyricEditorClipboard : Component, ILyricEditorClipboard
private IEditRubyModeState editRubyModeState { get; set; } = null!;

[Resolved]
private IEditRomajiModeState editRomajiModeState { get; set; } = null!;
private ITimeTagModeState timeTagModeState { get; set; } = null!;

[Resolved]
private ITimeTagModeState timeTagModeState { get; set; } = null!;
private IEditRomajiModeState editRomajiModeState { get; set; } = null!;

[Resolved]
private ILyricsChangeHandler? lyricsChangeHandler { get; set; }
Expand Down Expand Up @@ -187,17 +187,6 @@ private bool performCut()
lyricRubyTagsChangeHandler.RemoveRange(rubies);
return true;

case LyricEditorMode.EditRomaji:
var romajies = editRomajiModeState.SelectedItems;
if (!romajies.Any())
return false;

if (lyricRomajiTagsChangeHandler == null)
throw new NullDependencyException($"Missing {nameof(lyricRomajiTagsChangeHandler)}");

lyricRomajiTagsChangeHandler.RemoveRange(romajies);
return true;

case LyricEditorMode.EditTimeTag:
var timeTags = timeTagModeState.SelectedItems;
if (!timeTags.Any())
Expand All @@ -209,6 +198,17 @@ private bool performCut()
lyricTimeTagsChangeHandler.RemoveRange(timeTags);
return true;

case LyricEditorMode.EditRomaji:
var romajies = editRomajiModeState.SelectedItems;
if (!romajies.Any())
return false;

if (lyricRomajiTagsChangeHandler == null)
throw new NullDependencyException($"Missing {nameof(lyricRomajiTagsChangeHandler)}");

lyricRomajiTagsChangeHandler.RemoveRange(romajies);
return true;

case LyricEditorMode.EditNote:
return false;

Expand Down Expand Up @@ -270,15 +270,6 @@ private bool performCopy(Lyric lyric)
copyObjectToClipboard(rubies);
return true;

case LyricEditorMode.EditRomaji:
var romajies = editRomajiModeState.SelectedItems;
if (!romajies.Any())
return false;

saveObjectToTheClipboardContent(romajies);
copyObjectToClipboard(romajies);
return true;

case LyricEditorMode.EditTimeTag:
var timeTags = timeTagModeState.SelectedItems;
if (!timeTags.Any())
Expand All @@ -288,6 +279,15 @@ private bool performCopy(Lyric lyric)
copyObjectToClipboard(timeTags);
return true;

case LyricEditorMode.EditRomaji:
var romajies = editRomajiModeState.SelectedItems;
if (!romajies.Any())
return false;

saveObjectToTheClipboardContent(romajies);
copyObjectToClipboard(romajies);
return true;

case LyricEditorMode.EditNote:
return false;

Expand Down Expand Up @@ -360,17 +360,6 @@ private bool performPaste(Lyric lyric)
lyricRubyTagsChangeHandler.AddRange(pasteRubies);
return true;

case LyricEditorMode.EditRomaji:
var pasteRomajies = getObjectFromClipboardContent<RomajiTag[]>();
if (pasteRomajies == null)
return false;

if (lyricRomajiTagsChangeHandler == null)
throw new NullDependencyException($"Missing {nameof(lyricRomajiTagsChangeHandler)}");

lyricRomajiTagsChangeHandler.AddRange(pasteRomajies);
return true;

case LyricEditorMode.EditTimeTag:
var pasteTimeTags = getObjectFromClipboardContent<TimeTag[]>();
if (pasteTimeTags == null)
Expand All @@ -382,6 +371,17 @@ private bool performPaste(Lyric lyric)
lyricTimeTagsChangeHandler.AddRange(pasteTimeTags);
return true;

case LyricEditorMode.EditRomaji:
var pasteRomajies = getObjectFromClipboardContent<RomajiTag[]>();
if (pasteRomajies == null)
return false;

if (lyricRomajiTagsChangeHandler == null)
throw new NullDependencyException($"Missing {nameof(lyricRomajiTagsChangeHandler)}");

lyricRomajiTagsChangeHandler.AddRange(pasteRomajies);
return true;

case LyricEditorMode.EditNote:
return false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ private static float getBaseHue(LyricEditorMode mode)

case LyricEditorMode.Language:
case LyricEditorMode.EditRuby:
case LyricEditorMode.EditRomaji:
return 333 / 360f; // pink

case LyricEditorMode.EditTimeTag:
case LyricEditorMode.EditRomaji:
return 45 / 360f; // orange

case LyricEditorMode.EditNote:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ public enum LyricEditorMode
[Description("Edit ruby")]
EditRuby,

/// <summary>
/// Able to create/delete romaji.
/// </summary>
[Description("Edit romaji")]
EditRomaji,

/// <summary>
/// Enable to create/delete and reset time tag.
/// </summary>
[Description("Edit time tag")]
EditTimeTag,

/// <summary>
/// Able to edit the romaji from the time-tag.
/// </summary>
[Description("Edit romaji")]
EditRomaji,

/// <summary>
/// Enable to create/delete notes.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ protected override IEnumerable<ICheck> CreateChecks(LyricEditorMode type) =>
LyricEditorMode.Reference => new ICheck[] { new CheckLyricReferenceLyric() },
LyricEditorMode.Language => new ICheck[] { new CheckLyricLanguage() },
LyricEditorMode.EditRuby => new ICheck[] { new CheckLyricRubyTag() },
LyricEditorMode.EditRomaji => new ICheck[] { new CheckLyricRomajiTag() },
LyricEditorMode.EditTimeTag => new ICheck[] { new CheckLyricTimeTag() },
LyricEditorMode.EditRomaji => new ICheck[] { new CheckLyricRomajiTag() },
LyricEditorMode.EditNote => new ICheck[] { new CheckNoteReferenceLyric(), new CheckNoteText(), new CheckNoteTime() },
LyricEditorMode.Singer => Array.Empty<ICheck>(),
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,14 @@ private void initializeBadge(EditorModeWithEditStep editorMode)
return new LanguageInfo(Lyric);

case LyricEditorMode.EditRuby:
case LyricEditorMode.EditRomaji:
return new LanguageInfo(Lyric);

case LyricEditorMode.EditTimeTag:
return createTimeTagModeSubInfo(editorMode.GetEditStep<TimeTagEditStep>(), Lyric);

case LyricEditorMode.EditRomaji:
return new LanguageInfo(Lyric);

case LyricEditorMode.EditNote:
return null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ private void refreshAlgorithmAndCaretPosition()
LyricEditorMode.Reference => new NavigateCaretPositionAlgorithm(lyrics),
LyricEditorMode.Language => new ClickingCaretPositionAlgorithm(lyrics),
LyricEditorMode.EditRuby => getRubyTagModeAlgorithm(),
LyricEditorMode.EditRomaji => new NavigateCaretPositionAlgorithm(lyrics),
LyricEditorMode.EditTimeTag => getTimeTagModeAlgorithm(editorModeWithEditStep.GetEditStep<TimeTagEditStep>()),
LyricEditorMode.EditRomaji => new NavigateCaretPositionAlgorithm(lyrics),
LyricEditorMode.EditNote => new NavigateCaretPositionAlgorithm(lyrics),
LyricEditorMode.Singer => new NavigateCaretPositionAlgorithm(lyrics),
_ => throw new InvalidOperationException(nameof(mode)),
Expand Down