From 452e7c4a91599fa1a686e7039797ce1f24609645 Mon Sep 17 00:00:00 2001 From: Isayama_Kagura Date: Wed, 10 Aug 2022 22:52:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=BA=90=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TsubakiTranslator/BasicLibrary/WindowConfig.cs | 7 +++++++ TsubakiTranslator/TranslateWindow.xaml | 3 +-- TsubakiTranslator/TranslateWindow.xaml.cs | 15 +++++++++++++++ TsubakiTranslator/WinStylePage.xaml | 15 ++++++++++++++- 4 files changed, 37 insertions(+), 3 deletions(-) diff --git a/TsubakiTranslator/BasicLibrary/WindowConfig.cs b/TsubakiTranslator/BasicLibrary/WindowConfig.cs index adfd3b3..9b1b4f6 100644 --- a/TsubakiTranslator/BasicLibrary/WindowConfig.cs +++ b/TsubakiTranslator/BasicLibrary/WindowConfig.cs @@ -18,6 +18,7 @@ public WindowConfig() TranslateWindowTransparency = 165; SourceTextColor = Colors.BurlyWood; TranslatedTextColor = Colors.WhiteSmoke; + SourceTextVisibility = "Auto"; } private double mainWindowWidth; @@ -30,6 +31,7 @@ public WindowConfig() private int translateWindowTransparency; private Color sourceTextColor; private Color translatedTextColor; + private string sourceTextVisibility; public double MainWindowWidth @@ -91,5 +93,10 @@ public Color TranslatedTextColor set => SetProperty(ref translatedTextColor, value); } + public string SourceTextVisibility + { + get => sourceTextVisibility; + set => SetProperty(ref sourceTextVisibility, value); + } } } diff --git a/TsubakiTranslator/TranslateWindow.xaml b/TsubakiTranslator/TranslateWindow.xaml index dda24fb..a99ba3c 100644 --- a/TsubakiTranslator/TranslateWindow.xaml +++ b/TsubakiTranslator/TranslateWindow.xaml @@ -12,8 +12,7 @@ Topmost="{Binding TranslateWindowTopmost, Mode=TwoWay}" MaxWidth="{StaticResource {x:Static SystemParameters.MaximizedPrimaryScreenWidthKey}}" MaxHeight="{StaticResource {x:Static SystemParameters.MaximizedPrimaryScreenHeightKey}}" - Closing="On_TranslateWindow_Closing" MouseEnter="TranslateWindow_MouseEnter" - MinHeight="100" MinWidth="400" MouseLeave="TranslateWindow_MouseLeave" + Closing="On_TranslateWindow_Closing" MinHeight="100" MinWidth="400" MouseLeftButtonDown="Window_MouseLeftButtonDown"> diff --git a/TsubakiTranslator/TranslateWindow.xaml.cs b/TsubakiTranslator/TranslateWindow.xaml.cs index e9e0450..024ecad 100644 --- a/TsubakiTranslator/TranslateWindow.xaml.cs +++ b/TsubakiTranslator/TranslateWindow.xaml.cs @@ -49,6 +49,21 @@ private void Init() } this.Background = new SolidColorBrush(Color.FromArgb((byte)App.WindowConfig.TranslateWindowTransparency, 0, 0, 0)); + switch (App.WindowConfig.SourceTextVisibility) + { + case "Visible": + TranslatedResultDisplay.SourceText.Visibility = Visibility.Visible; + break; + case "Auto": + this.MouseEnter += TranslateWindow_MouseEnter; + this.MouseLeave += TranslateWindow_MouseLeave; + break; + case "Collapsed": + TranslatedResultDisplay.SourceText.Visibility = Visibility.Collapsed; + break; + } + + //TTS if (App.TranslateAPIConfig.TTSIsEnabled) { diff --git a/TsubakiTranslator/WinStylePage.xaml b/TsubakiTranslator/WinStylePage.xaml index 82d111a..38b8634 100644 --- a/TsubakiTranslator/WinStylePage.xaml +++ b/TsubakiTranslator/WinStylePage.xaml @@ -42,8 +42,21 @@ SelectedValue="{Binding TranslatedTextColor, Mode=TwoWay}" materialDesign:HintAssist.Hint="翻译文本颜色"/> - + + + + + + + + + + +