From a3188b4ab9956f21d111fc0b4cc76dfeef2a9f6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=2E=E5=96=9C?= <50934714+Hellobaka@users.noreply.github.com> Date: Sat, 3 Sep 2022 22:32:03 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=8F=8C=E8=AF=AD?= =?UTF-8?q?=E6=AD=8C=E8=AF=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dialogs/EditLineDialog.xaml | 7 ++++++- Dialogs/EditLineDialog.xaml.cs | 4 ++++ Models/LrcModel.cs | 14 ++++++++++++-- Views/LyricEditorViewCommandBinding.cs | 2 +- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/Dialogs/EditLineDialog.xaml b/Dialogs/EditLineDialog.xaml index fd7422c..0a2bc2c 100644 --- a/Dialogs/EditLineDialog.xaml +++ b/Dialogs/EditLineDialog.xaml @@ -62,6 +62,7 @@ + @@ -89,7 +90,11 @@ IsEnabled="False" TypeList="{x:Static models:ModeType.PreType}"/> - + 双语: + + + + + - + Margin="-2,0,0,6" Text="{Binding PlayButtonText}" /> - + - {Wnd1, Wnd2, Wnd3, Wnd4, Wnd5, Wnd6, Wnd7}; + {Wnd1, Wnd2, Wnd3, Wnd4, Wnd5, Wnd6, Wnd7, SpeedPanel}; PlaybackView.Current.DockControl.Show(); if (!LayoutHelper.ApplyLayout(DockManager, this)) LyricEditorView.Current.DockControl.Show(); @@ -147,5 +147,10 @@ private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref b private const int WM_NCHITTEST = 0x0084; #endregion + + private void ResetSpeed_Click(object sender, RoutedEventArgs e) + { + PlaybackView.Current.PlaySpeed = 1.0; + } } } diff --git a/Windows/MainWindowCommandBindings.cs b/Windows/MainWindowCommandBindings.cs index 040e720..4217051 100644 --- a/Windows/MainWindowCommandBindings.cs +++ b/Windows/MainWindowCommandBindings.cs @@ -271,6 +271,15 @@ private void TriggerKeyPress(Key key) case Key.Right: PlaybackView.Current.JumpDuration(+1000); break; + case Key.Q: + case Key.I: + PlaybackView.Current.PlaySpeed -= 0.1; + break; + case Key.E: + case Key.P: + PlaybackView.Current.PlaySpeed += 0.1; + break; + } } From 0cd2e883b64e5ddfff08a20099b86b97f9f0489f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=2E=E5=96=9C?= <50934714+Hellobaka@users.noreply.github.com> Date: Sat, 3 Sep 2022 22:51:55 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=8F=8C=E8=AF=AD=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E7=A9=BA=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Models/LrcModel.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Models/LrcModel.cs b/Models/LrcModel.cs index e113bcb..a04a589 100644 --- a/Models/LrcModel.cs +++ b/Models/LrcModel.cs @@ -186,9 +186,10 @@ public void AddLyrics(string lyrics, bool isDualLanguage = false) { if(isDualLanguage) { - AddLyrics(lyrics.Split('\n').Where((x, index) => + lyrics = lyrics.Replace("\r", ""); + AddLyrics(lyrics.Split('\n').Where(x => string.IsNullOrEmpty(x) is false).ToList().Where((x, index) => { - return index % 2 == 0; + return index % 2 == 0 ; }).ToArray()); } else @@ -313,6 +314,11 @@ public void RemoveLine(LrcLine line) if (decreaseIndex) GlobalIndex -= oldCount; } + public void ClearAll() + { + Current.Items.Clear(); + } + #endregion } From d37632353e029524e046e0bb858ce8d5e3c857ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=2E=E5=96=9C?= <50934714+Hellobaka@users.noreply.github.com> Date: Sat, 3 Sep 2022 22:52:10 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=B8=85=E7=A9=BA=E6=89=80=E6=9C=89?= =?UTF-8?q?=E6=AD=8C=E8=AF=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Commands/EditCommands.cs | 6 ++++++ Views/LyricEditorViewCommandBinding.cs | 12 ++++++++++++ Windows/MainWindow.xaml | 1 + 3 files changed, 19 insertions(+) diff --git a/Commands/EditCommands.cs b/Commands/EditCommands.cs index d178d29..cfd5dbc 100644 --- a/Commands/EditCommands.cs +++ b/Commands/EditCommands.cs @@ -20,6 +20,12 @@ public static partial class UICommands new KeyGesture(Key.F5, ModifierKeys.None, "F5") })); + public static RoutedUICommand ClearLyrics { get; } = new RoutedUICommand( + "清空歌词(_C)...", + "ClearLyrics", + typeof(UICommands), + new InputGestureCollection()); + public static RoutedUICommand EditSkipData { get; } = new RoutedUICommand( "编辑跳过单字(_E)", "EditSkipData", diff --git a/Views/LyricEditorViewCommandBinding.cs b/Views/LyricEditorViewCommandBinding.cs index b855393..e934f50 100644 --- a/Views/LyricEditorViewCommandBinding.cs +++ b/Views/LyricEditorViewCommandBinding.cs @@ -22,6 +22,18 @@ public void AddCommandBindings() UICommands.AddLyrics, AddLyrics_Executed, CanExecute)); + Application.Current.MainWindow?.CommandBindings.Add(new CommandBinding( + UICommands.ClearLyrics, + ClearLyrics_Executed, + CanExecute)); + } + + public void ClearLyrics_Executed(object sender, ExecutedRoutedEventArgs e) + { + if(MessageBox.Show("确认清空所有歌词吗?", "确认", MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK) + { + LrcModel.Current.ClearAll(); + } } public void AddLyrics_Executed(object sender, ExecutedRoutedEventArgs e) diff --git a/Windows/MainWindow.xaml b/Windows/MainWindow.xaml index 4e40c8d..9bb3a6d 100644 --- a/Windows/MainWindow.xaml +++ b/Windows/MainWindow.xaml @@ -72,6 +72,7 @@ +