From 38ec269f1d95b1acdbff119488807f5effa61859 Mon Sep 17 00:00:00 2001 From: SplitGemini <764402868@qq.com> Date: Fri, 22 May 2020 12:24:30 +0800 Subject: [PATCH] update to 3.6.9, fix some error and update CsvViewer plugin --- .../CsvViewerPanel.xaml.cs | 17 ++++- .../QuickLook.Plugin.CsvViewer/Plugin.cs | 7 +- .../QuickLook.Plugin.CsvViewer.csproj | 4 + .../Translations.config | 75 +++++++++++++++++++ .../GitVersion.cs | 6 -- .../QuickLook.Plugin.OfficeViewer.csproj | 1 + .../GlassLayer/ElementCoordinateConverter.cs | 3 +- QuickLook/ViewerWindow.xaml.cs | 39 +--------- 8 files changed, 106 insertions(+), 46 deletions(-) create mode 100644 QuickLook.Plugin/QuickLook.Plugin.CsvViewer/Translations.config delete mode 100644 QuickLook.Plugin/QuickLook.Plugin.OfficeViewer-Native/GitVersion.cs diff --git a/QuickLook.Plugin/QuickLook.Plugin.CsvViewer/CsvViewerPanel.xaml.cs b/QuickLook.Plugin/QuickLook.Plugin.CsvViewer/CsvViewerPanel.xaml.cs index bba5918c9..3ab828d6f 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.CsvViewer/CsvViewerPanel.xaml.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.CsvViewer/CsvViewerPanel.xaml.cs @@ -22,9 +22,12 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Data; +using System.Windows.Input; using System.Windows.Media; using CsvHelper; using QuickLook.Common.ExtensionMethods; +using QuickLook.Common.Helpers; +using QuickLook.Common.Plugin; namespace QuickLook.Plugin.CsvViewer { @@ -33,9 +36,18 @@ namespace QuickLook.Plugin.CsvViewer /// public partial class CsvViewerPanel : UserControl { - public CsvViewerPanel() + private readonly ContextObject _context; + public CsvViewerPanel(string path, ContextObject context) { + _context = context; InitializeComponent(); + ContextMenu = new ContextMenu(); + ContextMenu.Items.Add(new MenuItem + { Header = TranslationHelper.Get("Editor_Copy"), Command = ApplicationCommands.Copy }); + ContextMenu.Items.Add(new MenuItem + { Header = TranslationHelper.Get("Editor_SelectAll"), Command = ApplicationCommands.SelectAll }); + LoadFile(path); + context.IsBusy = false; } public List Rows { get; private set; } = new List(); @@ -87,7 +99,8 @@ private void SetupColumnBinding(int rowLength) { var col = new DataGridTextColumn { - FontFamily = new FontFamily("Consolas"), + //FontFamily = new FontFamily("Consolas"), + FontFamily = new FontFamily(TranslationHelper.Get("Editor_FontFamily")), FontWeight = FontWeight.FromOpenTypeWeight(i == 0 ? 700 : 400), Binding = new Binding($"[{i}]") }; diff --git a/QuickLook.Plugin/QuickLook.Plugin.CsvViewer/Plugin.cs b/QuickLook.Plugin/QuickLook.Plugin.CsvViewer/Plugin.cs index bc6101637..a3d0892b4 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.CsvViewer/Plugin.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.CsvViewer/Plugin.cs @@ -44,13 +44,16 @@ public void Prepare(string path, ContextObject context) public void View(string path, ContextObject context) { - _panel = new CsvViewerPanel(); - + //edit by gh + _panel = new CsvViewerPanel(path, context); + //_panel = new CsvViewerPanel(); context.ViewerContent = _panel; context.Title = $"{Path.GetFileName(path)}"; + /* _panel.LoadFile(path); context.IsBusy = false; + */ } public void Cleanup() diff --git a/QuickLook.Plugin/QuickLook.Plugin.CsvViewer/QuickLook.Plugin.CsvViewer.csproj b/QuickLook.Plugin/QuickLook.Plugin.CsvViewer/QuickLook.Plugin.CsvViewer.csproj index 50e464c66..6e5e3ecb7 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.CsvViewer/QuickLook.Plugin.CsvViewer.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.CsvViewer/QuickLook.Plugin.CsvViewer.csproj @@ -121,6 +121,10 @@ + + Designer + PreserveNewest + \ No newline at end of file diff --git a/QuickLook.Plugin/QuickLook.Plugin.CsvViewer/Translations.config b/QuickLook.Plugin/QuickLook.Plugin.CsvViewer/Translations.config new file mode 100644 index 000000000..83518cff0 --- /dev/null +++ b/QuickLook.Plugin/QuickLook.Plugin.CsvViewer/Translations.config @@ -0,0 +1,75 @@ + + + + + Consolas + + + Consolas + + + Consolas + Copy + Select All + + + Consolas + + + Consolas + + + Consolas + + + Consolas,Meiryo UI,MS UI Gothic,MS Gothic + コピー + すべて選択 + + + Consolas,Malgun Gothic,Batang + + + Consolas + + + Consolas + + + Consolas + + + Consolas + + + Consolas + + + Consolas + + + Consolas + + + Consolas + + + Consolas + + + Consolas,Microsoft Yahei UI,Microsoft Yahei,SimSun + 复制 + 全选 + + + Consolas,Microsoft JhengHei UI,Microsoft JhengHei,MingLiU + 複製 + 全選 + + + Consolas,Mangal,Nirmala UI + + + Consolas,Mangal,Nirmala UI + + diff --git a/QuickLook.Plugin/QuickLook.Plugin.OfficeViewer-Native/GitVersion.cs b/QuickLook.Plugin/QuickLook.Plugin.OfficeViewer-Native/GitVersion.cs deleted file mode 100644 index 3ae786713..000000000 --- a/QuickLook.Plugin/QuickLook.Plugin.OfficeViewer-Native/GitVersion.cs +++ /dev/null @@ -1,6 +0,0 @@ -// This file is generated by update-version.ps1 - -using System.Reflection; - -[assembly: AssemblyVersion("3.6.5")] -[assembly: AssemblyInformationalVersion("3.6.5")] diff --git a/QuickLook.Plugin/QuickLook.Plugin.OfficeViewer-Native/QuickLook.Plugin.OfficeViewer.csproj b/QuickLook.Plugin/QuickLook.Plugin.OfficeViewer-Native/QuickLook.Plugin.OfficeViewer.csproj index 51aab6171..bf3b94539 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.OfficeViewer-Native/QuickLook.Plugin.OfficeViewer.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.OfficeViewer-Native/QuickLook.Plugin.OfficeViewer.csproj @@ -72,6 +72,7 @@ x64 prompt MinimumRecommendedRules.ruleset + 3 diff --git a/QuickLook/Controls/GlassLayer/ElementCoordinateConverter.cs b/QuickLook/Controls/GlassLayer/ElementCoordinateConverter.cs index 0ae269de7..a9b645b57 100644 --- a/QuickLook/Controls/GlassLayer/ElementCoordinateConverter.cs +++ b/QuickLook/Controls/GlassLayer/ElementCoordinateConverter.cs @@ -29,7 +29,8 @@ public object Convert(object value, Type targetType, object parameter, CultureIn var glass = value as GlassLayer; if (glass?.BlurredElement == null) - return null; + return new Rect(); + //return null; var target = glass.BlurredElement; diff --git a/QuickLook/ViewerWindow.xaml.cs b/QuickLook/ViewerWindow.xaml.cs index 845fb75d5..978146ff9 100644 --- a/QuickLook/ViewerWindow.xaml.cs +++ b/QuickLook/ViewerWindow.xaml.cs @@ -18,13 +18,14 @@ using System; using System.Windows; using System.Windows.Input; -using System.Windows.Interop; -using System.Windows.Media; using System.Windows.Media.Animation; using QuickLook.Common.ExtensionMethods; using QuickLook.Common.Helpers; using QuickLook.Common.Plugin; using QuickLook.Helpers; +using Brush = System.Windows.Media.Brush; +using FontFamily = System.Windows.Media.FontFamily; +using Size = System.Windows.Size; namespace QuickLook { @@ -54,14 +55,8 @@ internal ViewerWindow() StateChanged += (sender, e) => _ignoreNextWindowSizeChange = true; - // bring the window to top when users click in the client area. - // the non-client area is handled by the WndProc inside OnSourceInitialized(). - // This is buggy for Windows 7 and 8: https://github.com/QL-Win/QuickLook/issues/644#issuecomment-628921704 - if (App.IsWin10) - PreviewMouseDown += (sender, e) => this.BringToFront(false); - windowFrameContainer.PreviewMouseMove += ShowWindowCaptionContainer; - + Topmost = SettingHelper.Get("Topmost", false); buttonTop.Tag = Topmost ? "Top" : "Auto"; @@ -103,32 +98,6 @@ internal ViewerWindow() buttonOpenWith.Click += (sender, e) => ShareHelper.Share(_path, this, true); } - // bring the window to top when users click in the non-client area. - protected override void OnSourceInitialized(EventArgs e) - { - base.OnSourceInitialized(e); - - // The non-focusable trick is buggy for Windows 7 and 8 - // https://github.com/QL-Win/QuickLook/issues/644#issuecomment-628921704 - if (App.IsWin10) - { - this.SetNoactivate(); - - HwndSource.FromHwnd(new WindowInteropHelper(this).Handle)?.AddHook( - (IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) => - { - switch (msg) - { - case 0x0112: // WM_SYSCOMMAND - this.BringToFront(false); - break; - } - - return IntPtr.Zero; - }); - } - } - public override void OnApplyTemplate() { base.OnApplyTemplate();