Skip to content

Commit

Permalink
update to 3.6.9, fix some error and update CsvViewer plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
SplitGemini committed May 22, 2020
1 parent 51275c6 commit 38ec269
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 46 deletions.
17 changes: 15 additions & 2 deletions QuickLook.Plugin/QuickLook.Plugin.CsvViewer/CsvViewerPanel.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -33,9 +36,18 @@ namespace QuickLook.Plugin.CsvViewer
/// </summary>
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<string[]> Rows { get; private set; } = new List<string[]>();
Expand Down Expand Up @@ -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}]")
};
Expand Down
7 changes: 5 additions & 2 deletions QuickLook.Plugin/QuickLook.Plugin.CsvViewer/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Translations.config">
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
75 changes: 75 additions & 0 deletions QuickLook.Plugin/QuickLook.Plugin.CsvViewer/Translations.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>

<Translations>
<ca>
<Editor_FontFamily>Consolas</Editor_FontFamily>
</ca>
<de-DE>
<Editor_FontFamily>Consolas</Editor_FontFamily>
</de-DE>
<en>
<Editor_FontFamily>Consolas</Editor_FontFamily>
<Editor_Copy>Copy</Editor_Copy>
<Editor_SelectAll>Select All</Editor_SelectAll>
</en>
<es-ES>
<Editor_FontFamily>Consolas</Editor_FontFamily>
</es-ES>
<fr-FR>
<Editor_FontFamily>Consolas</Editor_FontFamily>
</fr-FR>
<it>
<Editor_FontFamily>Consolas</Editor_FontFamily>
</it>
<ja-JP>
<Editor_FontFamily>Consolas,Meiryo UI,MS UI Gothic,MS Gothic</Editor_FontFamily>
<Editor_Copy>コピー</Editor_Copy>
<Editor_SelectAll>すべて選択</Editor_SelectAll>
</ja-JP>
<ko-KR>
<Editor_FontFamily>Consolas,Malgun Gothic,Batang</Editor_FontFamily>
</ko-KR>
<nb-NO>
<Editor_FontFamily>Consolas</Editor_FontFamily>
</nb-NO>
<nl-NL>
<Editor_FontFamily>Consolas</Editor_FontFamily>
</nl-NL>
<pl>
<Editor_FontFamily>Consolas</Editor_FontFamily>
</pl>
<pt-BR>
<Editor_FontFamily>Consolas</Editor_FontFamily>
</pt-BR>
<pt-PT>
<Editor_FontFamily>Consolas</Editor_FontFamily>
</pt-PT>
<ru-RU>
<Editor_FontFamily>Consolas</Editor_FontFamily>
</ru-RU>
<tr-TR>
<Editor_FontFamily>Consolas</Editor_FontFamily>
</tr-TR>
<uk-UA>
<Editor_FontFamily>Consolas</Editor_FontFamily>
</uk-UA>
<vi>
<Editor_FontFamily>Consolas</Editor_FontFamily>
</vi>
<zh-CN>
<Editor_FontFamily>Consolas,Microsoft Yahei UI,Microsoft Yahei,SimSun</Editor_FontFamily>
<Editor_Copy>复制</Editor_Copy>
<Editor_SelectAll>全选</Editor_SelectAll>
</zh-CN>
<zh-TW>
<Editor_FontFamily>Consolas,Microsoft JhengHei UI,Microsoft JhengHei,MingLiU</Editor_FontFamily>
<Editor_Copy>複製</Editor_Copy>
<Editor_SelectAll>全選</Editor_SelectAll>
</zh-TW>
<mr>
<Editor_FontFamily>Consolas,Mangal,Nirmala UI</Editor_FontFamily>
</mr>
<hi>
<Editor_FontFamily>Consolas,Mangal,Nirmala UI</Editor_FontFamily>
</hi>
</Translations>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<WarningLevel>3</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down
3 changes: 2 additions & 1 deletion QuickLook/Controls/GlassLayer/ElementCoordinateConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
39 changes: 4 additions & 35 deletions QuickLook/ViewerWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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";

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 38ec269

Please sign in to comment.