Skip to content

Commit

Permalink
Merge pull request #1473 from andy840119/implement-reference-lyric-mode
Browse files Browse the repository at this point in the history
Implement an individual edit mode for let user to select the lyric.
  • Loading branch information
andy840119 authored Jul 25, 2022
2 parents bc46bf4 + 45092bd commit 31d13e2
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ public void TestTextingMode()
clickEditModeButtons<TextingEditMode>();
}

[Test]
public void TestReferenceMode()
{
switchToMode(LyricEditorMode.Reference);
}

[Test]
public void TestLanguageMode()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public LyricEditorModeMenu(Bindable<LyricEditorMode> config, string text)
{
LyricEditorMode.View,
LyricEditorMode.Texting,
LyricEditorMode.Reference,
LyricEditorMode.Language,
LyricEditorMode.EditRuby,
LyricEditorMode.EditRomaji,
Expand Down
9 changes: 9 additions & 0 deletions osu.Game.Rulesets.Karaoke/Edit/Lyrics/LyricEditorClipboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ private bool performCut()
throw new ArgumentOutOfRangeException();
}

case LyricEditorMode.Reference:
return false;

case LyricEditorMode.Language:
languageChangeHandler.SetLanguage(null);
return true;
Expand Down Expand Up @@ -227,6 +230,9 @@ private bool performCopy(Lyric lyric)
throw new ArgumentOutOfRangeException();
}

case LyricEditorMode.Reference:
return false;

case LyricEditorMode.Language:
saveObjectToTheClipboardContent(lyric.Language);
copyObjectToClipboard(lyric.Language);
Expand Down Expand Up @@ -299,6 +305,9 @@ private bool performPaste(Lyric lyric)
throw new ArgumentOutOfRangeException();
}

case LyricEditorMode.Reference:
return false;

case LyricEditorMode.Language:
var pasteLanguage = getObjectFromClipboardContent<CultureInfo>();
if (pasteLanguage == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ private static float getBaseHue(LyricEditorMode mode)
return 200 / 360f; // blue

case LyricEditorMode.Texting:
case LyricEditorMode.Reference:
return 0 / 360f; // red

case LyricEditorMode.Language:
Expand Down
6 changes: 6 additions & 0 deletions osu.Game.Rulesets.Karaoke/Edit/Lyrics/LyricEditorMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ public enum LyricEditorMode
[Description("Texting")]
Texting,

/// <summary>
/// Mark the lyric is "similar" to another lyric.
/// </summary>
[Description("Reference")]
Reference,

/// <summary>
/// Can edit each lyric's language.
/// </summary>
Expand Down
4 changes: 4 additions & 0 deletions osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/EditLyricRow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ Drawable createSubInfo()
case LyricEditorMode.Texting:
return null;

case LyricEditorMode.Reference:
// todo: add the reference info.
return null;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ private void refreshAlgorithmAndCaretPosition()
{
LyricEditorMode.View => null,
LyricEditorMode.Texting => getTextingmodeAlgorithm(),
LyricEditorMode.Reference => new NavigateCaretPositionAlgorithm(lyrics),
LyricEditorMode.Language => new ClickingCaretPositionAlgorithm(lyrics),
LyricEditorMode.EditRuby => new NavigateCaretPositionAlgorithm(lyrics),
LyricEditorMode.EditRomaji => new NavigateCaretPositionAlgorithm(lyrics),
Expand Down

0 comments on commit 31d13e2

Please sign in to comment.