Compare commits

..

4 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
7d872b526f Add README for QuickLook.Plugin.InsvBlocker
Co-authored-by: emako <24737061+emako@users.noreply.github.com>
2025-11-02 15:55:34 +00:00
copilot-swe-agent[bot]
ed5c34735f Address code review feedback: improve comments and dispatcher priority
Co-authored-by: emako <24737061+emako@users.noreply.github.com>
2025-11-02 15:54:51 +00:00
copilot-swe-agent[bot]
45403ad402 Add QuickLook.Plugin.InsvBlocker to block .insv files
Co-authored-by: emako <24737061+emako@users.noreply.github.com>
2025-11-02 15:51:04 +00:00
copilot-swe-agent[bot]
26f5707977 Initial plan 2025-11-02 15:38:35 +00:00
24 changed files with 42 additions and 758 deletions

View File

@@ -30,7 +30,7 @@
HWND hMsgWnd;
HANDLE hGetResultEvent;
PCHAR pXmlBuffer = nullptr;
PCHAR pXmlBuffer;
void DOpus::GetSelected(PWCHAR buffer)
{
@@ -72,12 +72,9 @@ void DOpus::GetSelected(PWCHAR buffer)
WaitForSingleObject(hGetResultEvent, 2000);
if (pXmlBuffer != nullptr)
{
ParseXmlBuffer(buffer);
delete[] pXmlBuffer;
pXmlBuffer = nullptr;
}
ParseXmlBuffer(buffer);
delete[] pXmlBuffer;
}
void DOpus::ParseXmlBuffer(PWCHAR buffer)
@@ -91,9 +88,6 @@ void DOpus::ParseXmlBuffer(PWCHAR buffer)
* ...
*/
if (pXmlBuffer == nullptr)
return;
using namespace rapidxml;
xml_document<> doc;

View File

@@ -1,85 +0,0 @@
<UserControl x:Class="QuickLook.Plugin.CsvViewer.Controls.SearchPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="35"
d:DesignWidth="300"
mc:Ignorable="d">
<Border Margin="0,-1,16,0"
Padding="2"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Background="{DynamicResource WindowBackground}"
BorderBrush="#102E2E3E"
BorderThickness="1"
CornerRadius="4"
Cursor="Arrow">
<StackPanel Orientation="Horizontal">
<TextBox Name="searchTextBox"
Width="150"
Height="29"
Padding="4,5,0,0"
FocusVisualStyle="{x:Null}"
Focusable="True"
KeyDown="SearchTextBox_KeyDown"
TextChanged="SearchTextBox_TextChanged" />
<TextBlock Name="matchCountText"
Width="50"
Margin="4,0,0,0"
VerticalAlignment="Center"
FontSize="11"
Foreground="{DynamicResource WindowTextForeground}"
Text="" />
<Button Width="24"
Height="24"
Margin="3,3,0,3"
Padding="0"
Click="FindPrevious_Click"
ToolTip="Find Previous (Shift+Enter)">
<!-- ChevronUp -->
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{DynamicResource SymbolThemeFontFamily}"
FontSize="12"
Text="&#xe70e;" />
</Button>
<Button Width="24"
Height="24"
Margin="3"
Padding="0"
Click="FindNext_Click"
ToolTip="Find Next (Enter)">
<!-- ChevronDown -->
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{DynamicResource SymbolThemeFontFamily}"
FontSize="12"
Text="&#xe70d;" />
</Button>
<CheckBox Name="matchCaseCheckBox"
Margin="3,0"
VerticalAlignment="Center"
Checked="MatchCase_Changed"
Content="Match case"
Unchecked="MatchCase_Changed" />
<Button Width="16"
Height="16"
Padding="0"
HorizontalAlignment="Right"
VerticalAlignment="Top"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Click="CloseSearch_Click"
Focusable="False"
ToolTip="Close (Escape)">
<!-- CalculatorMultiply -->
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{DynamicResource SymbolThemeFontFamily}"
FontSize="10"
Text="&#xe947;" />
</Button>
</StackPanel>
</Border>
</UserControl>

View File

@@ -1,124 +0,0 @@
// Copyright © 2017-2025 QL-Win Contributors
//
// This file is part of QuickLook program.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace QuickLook.Plugin.CsvViewer.Controls;
public partial class SearchPanel : UserControl
{
public event EventHandler<SearchEventArgs> SearchRequested;
public event EventHandler<NavigateEventArgs> NavigateRequested;
public event EventHandler CloseRequested;
public SearchPanel()
{
InitializeComponent();
}
public string SearchText => searchTextBox.Text;
public bool MatchCase => matchCaseCheckBox.IsChecked == true;
public new void Focus()
{
searchTextBox.Focus();
searchTextBox.SelectAll();
}
public void UpdateMatchCount(int totalCount, int currentIndex)
{
if (totalCount == 0)
{
matchCountText.Text = string.IsNullOrEmpty(searchTextBox.Text) ? "" : "0/0";
}
else
{
matchCountText.Text = $"{currentIndex + 1}/{totalCount}";
}
}
private void SearchTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
SearchRequested?.Invoke(this, new SearchEventArgs(searchTextBox.Text, MatchCase));
}
private void SearchTextBox_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
if (Keyboard.Modifiers == ModifierKeys.Shift)
{
FindPrevious_Click(sender, e);
}
else
{
FindNext_Click(sender, e);
}
e.Handled = true;
}
else if (e.Key == Key.Escape)
{
CloseSearch_Click(sender, e);
e.Handled = true;
}
}
private void FindPrevious_Click(object sender, RoutedEventArgs e)
{
NavigateRequested?.Invoke(this, new NavigateEventArgs(false));
}
private void FindNext_Click(object sender, RoutedEventArgs e)
{
NavigateRequested?.Invoke(this, new NavigateEventArgs(true));
}
private void MatchCase_Changed(object sender, RoutedEventArgs e)
{
SearchRequested?.Invoke(this, new SearchEventArgs(searchTextBox.Text, MatchCase));
}
private void CloseSearch_Click(object sender, RoutedEventArgs e)
{
CloseRequested?.Invoke(this, EventArgs.Empty);
}
}
public class SearchEventArgs : EventArgs
{
public string SearchText { get; }
public bool MatchCase { get; }
public SearchEventArgs(string searchText, bool matchCase)
{
SearchText = searchText;
MatchCase = matchCase;
}
}
public class NavigateEventArgs : EventArgs
{
public bool Forward { get; }
public NavigateEventArgs(bool forward)
{
Forward = forward;
}
}

View File

@@ -1,14 +1,12 @@
<UserControl x:Class="QuickLook.Plugin.CsvViewer.CsvViewerPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:QuickLook.Plugin.CsvViewer.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:QuickLook.Plugin.CsvViewer"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="csvViewer"
d:DesignHeight="300"
d:DesignWidth="300"
Focusable="True"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary>
@@ -32,7 +30,5 @@
ItemsSource="{Binding Path=Rows, ElementName=csvViewer}"
RowBackground="#00FFFFFF"
VerticalGridLinesBrush="#19000000" />
<controls:SearchPanel x:Name="searchPanel"
Visibility="Collapsed" />
</Grid>
</UserControl>

View File

@@ -17,7 +17,6 @@
using CsvHelper;
using CsvHelper.Configuration;
using QuickLook.Plugin.CsvViewer.Controls;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -26,9 +25,7 @@ using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Media;
using UtfUnknown;
@@ -36,228 +33,13 @@ namespace QuickLook.Plugin.CsvViewer;
public partial class CsvViewerPanel : UserControl
{
// Highlight color for search results (semi-transparent yellow)
private static readonly SolidColorBrush HighlightBrush = new SolidColorBrush(Color.FromArgb(128, 255, 255, 0));
private List<(int Row, int Column)> _searchResults = new List<(int, int)>();
private int _currentResultIndex = -1;
private string _currentSearchText = string.Empty;
private bool _currentMatchCase;
private DataGridCell _highlightedCell; // Track currently highlighted cell for efficient clearing
public CsvViewerPanel()
{
InitializeComponent();
KeyDown += CsvViewerPanel_KeyDown;
searchPanel.SearchRequested += SearchPanel_SearchRequested;
searchPanel.NavigateRequested += SearchPanel_NavigateRequested;
searchPanel.CloseRequested += SearchPanel_CloseRequested;
}
public List<string[]> Rows { get; private set; } = [];
private void CsvViewerPanel_KeyDown(object sender, KeyEventArgs e)
{
if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control && e.Key == Key.F)
{
OpenSearchPanel();
e.Handled = true;
}
else if (e.Key == Key.Escape && searchPanel.Visibility == Visibility.Visible)
{
CloseSearchPanel();
e.Handled = true;
}
else if (e.Key == Key.F3)
{
if (searchPanel.Visibility == Visibility.Visible && _searchResults.Count > 0)
{
if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
{
NavigateToPreviousResult();
}
else
{
NavigateToNextResult();
}
}
e.Handled = true;
}
}
private void OpenSearchPanel()
{
searchPanel.Visibility = Visibility.Visible;
searchPanel.Focus();
}
private void CloseSearchPanel()
{
searchPanel.Visibility = Visibility.Collapsed;
ClearHighlighting();
_searchResults.Clear();
_currentResultIndex = -1;
dataGrid.Focus();
}
private void SearchPanel_SearchRequested(object sender, SearchEventArgs e)
{
_currentSearchText = e.SearchText;
_currentMatchCase = e.MatchCase;
PerformSearch();
}
private void SearchPanel_NavigateRequested(object sender, NavigateEventArgs e)
{
if (e.Forward)
{
NavigateToNextResult();
}
else
{
NavigateToPreviousResult();
}
}
private void SearchPanel_CloseRequested(object sender, EventArgs e)
{
CloseSearchPanel();
}
private void PerformSearch()
{
ClearHighlighting();
_searchResults.Clear();
_currentResultIndex = -1;
if (string.IsNullOrEmpty(_currentSearchText))
{
searchPanel.UpdateMatchCount(0, _currentResultIndex);
return;
}
var comparison = _currentMatchCase ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase;
for (int rowIndex = 0; rowIndex < Rows.Count; rowIndex++)
{
var row = Rows[rowIndex];
for (int colIndex = 0; colIndex < row.Length; colIndex++)
{
if (row[colIndex] != null && row[colIndex].IndexOf(_currentSearchText, comparison) >= 0)
{
_searchResults.Add((rowIndex, colIndex));
}
}
}
if (_searchResults.Count > 0)
{
_currentResultIndex = 0;
NavigateToCurrentResult();
}
searchPanel.UpdateMatchCount(_searchResults.Count, _currentResultIndex);
}
private void NavigateToNextResult()
{
if (_searchResults.Count == 0)
return;
_currentResultIndex = (_currentResultIndex + 1) % _searchResults.Count;
NavigateToCurrentResult();
searchPanel.UpdateMatchCount(_searchResults.Count, _currentResultIndex);
}
private void NavigateToPreviousResult()
{
if (_searchResults.Count == 0)
return;
_currentResultIndex = (_currentResultIndex - 1 + _searchResults.Count) % _searchResults.Count;
NavigateToCurrentResult();
searchPanel.UpdateMatchCount(_searchResults.Count, _currentResultIndex);
}
private void NavigateToCurrentResult()
{
if (_currentResultIndex < 0 || _currentResultIndex >= _searchResults.Count)
return;
var (rowIndex, colIndex) = _searchResults[_currentResultIndex];
// Scroll to the row
if (rowIndex < dataGrid.Items.Count)
{
dataGrid.ScrollIntoView(dataGrid.Items[rowIndex]);
dataGrid.UpdateLayout();
// Select the cell
dataGrid.SelectedIndex = rowIndex;
// Try to highlight the specific cell
HighlightCurrentCell(rowIndex, colIndex);
}
}
private void HighlightCurrentCell(int rowIndex, int colIndex)
{
// Clear previous highlight first
ClearHighlighting();
try
{
var row = dataGrid.ItemContainerGenerator.ContainerFromIndex(rowIndex) as DataGridRow;
if (row != null)
{
var presenter = FindVisualChild<DataGridCellsPresenter>(row);
if (presenter != null)
{
var cell = presenter.ItemContainerGenerator.ContainerFromIndex(colIndex) as DataGridCell;
if (cell != null)
{
cell.Background = HighlightBrush;
_highlightedCell = cell;
}
}
}
}
catch (InvalidOperationException)
{
// Can occur when visual tree is being rebuilt during scrolling.
// Safe to ignore as the cell will be highlighted on next navigation.
}
}
private void ClearHighlighting()
{
// Only clear the previously highlighted cell instead of iterating all cells
if (_highlightedCell != null)
{
_highlightedCell.ClearValue(DataGridCell.BackgroundProperty);
_highlightedCell = null;
}
}
private static T FindVisualChild<T>(DependencyObject parent) where T : DependencyObject
{
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++)
{
var child = VisualTreeHelper.GetChild(parent, i);
if (child is T typedChild)
{
return typedChild;
}
var result = FindVisualChild<T>(child);
if (result != null)
{
return result;
}
}
return null;
}
public void LoadFile(string path)
{
const int limit = 10000;

View File

@@ -73,7 +73,7 @@
<ItemGroup>
<PackageReference Include="FreeTypeSharp" Version="3.0.1" />
<PackageReference Include="QuickLook.Typography.OpenFont" Version="1.0.1" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3595.46">
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3537.50">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

View File

@@ -61,7 +61,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3595.46">
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3537.50">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

View File

@@ -109,7 +109,7 @@ internal class ImageMagickProvider : AnimationProvider
{
if (mi.ColorSpace == ColorSpace.RGB || mi.ColorSpace == ColorSpace.sRGB || mi.ColorSpace == ColorSpace.scRGB)
{
mi.SetProfile(ColorProfiles.SRGB);
mi.SetProfile(ColorProfile.SRGB);
if (ContextObject.ColorProfileName != null)
mi.SetProfile(new ColorProfile(ContextObject.ColorProfileName)); // map to monitor color
}

View File

@@ -62,10 +62,10 @@
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="14.9.1">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3595.46">
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3537.50">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Google.Protobuf" Version="3.33.1">
<PackageReference Include="Google.Protobuf" Version="3.33.0">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="System.Memory" Version="4.6.3">

View File

@@ -45,16 +45,31 @@ public class Plugin : IViewer
public void Prepare(string path, ContextObject context)
{
// Set Ignore to true to display "blocked" in the preview window
context.IsBlocked = true;
context.Title = $"[BLOCKED] {Path.GetFileName(path)}";
context.PreferredSize = new Size(400, 200);
// Set a minimal window size (1x1 pixels) to make the window as small as possible
// This window will be closed immediately in View() before becoming visible
context.PreferredSize = new Size { Width = 1, Height = 1 };
}
public void View(string path, ContextObject context)
{
// This should not be called since Ignore is set to true in Prepare
// But if called, do nothing
// Create an empty text block as content (required to avoid errors)
var textBlock = new TextBlock
{
Text = "",
Visibility = Visibility.Collapsed
};
context.ViewerContent = textBlock;
context.IsBusy = false;
// Close the window immediately using Send priority for immediate execution
// This prevents the window from becoming visible to the user
Application.Current?.Dispatcher?.BeginInvoke(new Action(() =>
{
if (context.Source is Window window)
{
window.Close();
}
}), DispatcherPriority.Send);
}
public void Cleanup()

View File

@@ -55,7 +55,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MsgReader" Version="6.0.6" />
<PackageReference Include="MsgReader" Version="6.0.5" />
</ItemGroup>
<ItemGroup>

View File

@@ -61,7 +61,7 @@
<ItemGroup>
<PackageReference Include="UTF.Unknown" Version="2.6.0" />
<Reference Include="WindowsBase" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3595.46">
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3537.50">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

View File

@@ -64,7 +64,7 @@
<ItemGroup>
<PackageReference Include="PdfiumViewer.Updated" Version="2.14.5" />
<PackageReference Include="bblanchon.PDFiumV8.Win32" Version="144.0.7543" />
<PackageReference Include="bblanchon.PDFiumV8.Win32" Version="143.0.7497" />
<Reference Include="WindowsBase" />
</ItemGroup>

View File

@@ -8,7 +8,7 @@
<FileAlignment>512</FileAlignment>
<SignAssembly>false</SignAssembly>
<UseWPF>true</UseWPF>
<LangVersion>preview</LangVersion>
<LangVersion>latest</LangVersion>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>

View File

@@ -1,113 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<SyntaxDefinition name="Svelte" extensions=".svelte" xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008">
<Color name="Comment" foreground="#6A9955" />
<Color name="Tag" foreground="#569CD6" exampleText="div" />
<Color name="Attribute" foreground="#9CDCFE" exampleText="on:click" />
<Color name="String" foreground="#CE9178" exampleText="&quot;text&quot;" />
<Color name="Directive" foreground="#DCDCAA" exampleText="bind:" />
<Color name="Keyword" foreground="#C586C0" exampleText="import" />
<Color name="Script" foreground="#D4D4D4" />
<Color name="Style" foreground="#4EC9B0" />
<RuleSet name="Html">
<Span color="Comment" begin="&lt;!--" end="--&gt;" />
<Span color="String" begin="&quot;" end="&quot;" />
<Span color="String" begin="&apos;" end="&apos;" />
<!-- Tags -->
<Span color="Tag" begin="&lt;" end="&gt;">
<RuleSet>
<Keywords color="Tag">
<Word>script</Word>
<Word>style</Word>
<Word>div</Word>
<Word>span</Word>
<Word>input</Word>
<Word>button</Word>
<Word>section</Word>
<Word>article</Word>
<Word>header</Word>
<Word>footer</Word>
<Word>main</Word>
<Word>nav</Word>
<Word>aside</Word>
<Word>p</Word>
<Word>h1</Word>
<Word>h2</Word>
<Word>h3</Word>
<Word>ul</Word>
<Word>li</Word>
<Word>a</Word>
<Word>img</Word>
</Keywords>
<Keywords color="Directive">
<Word>bind:</Word>
<Word>on:</Word>
<Word>use:</Word>
<Word>transition:</Word>
<Word>in:</Word>
<Word>out:</Word>
<Word>animate:</Word>
<Word>class:</Word>
<Word>style:</Word>
</Keywords>
<Keywords color="Attribute">
<Word>export</Word>
<Word>let</Word>
<Word>const</Word>
</Keywords>
</RuleSet>
</Span>
</RuleSet>
<RuleSet name="JavaScript">
<Span color="Comment" begin="//" end="\n" />
<Span color="Comment" begin="/\*" end="\*/" />
<Span color="String" begin="&quot;" end="&quot;" />
<Span color="String" begin="&apos;" end="&apos;" />
<Keywords color="Keyword">
<Word>import</Word>
<Word>export</Word>
<Word>default</Word>
<Word>return</Word>
<Word>const</Word>
<Word>let</Word>
<Word>var</Word>
<Word>if</Word>
<Word>else</Word>
<Word>for</Word>
<Word>while</Word>
<Word>function</Word>
<Word>async</Word>
<Word>await</Word>
<Word>new</Word>
<Word>this</Word>
<Word>true</Word>
<Word>false</Word>
<Word>null</Word>
<Word>undefined</Word>
<Word>each</Word>
<Word>if</Word>
<Word>else</Word>
<Word>await</Word>
<Word>then</Word>
<Word>catch</Word>
</Keywords>
</RuleSet>
<RuleSet name="CSS">
<Span color="Comment" begin="/\*" end="\*/" />
<Span color="String" begin="&quot;" end="&quot;" />
<Span color="String" begin="&apos;" end="&apos;" />
</RuleSet>
<RuleSet name="MainRuleSet">
<Import ruleSet="Html" />
<Import ruleSet="JavaScript" />
<Import ruleSet="CSS" />
</RuleSet>
<RuleSet>
<Import ruleSet="MainRuleSet" />
</RuleSet>
</SyntaxDefinition>

View File

@@ -1,113 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<SyntaxDefinition name="Svelte" extensions=".svelte" xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008">
<Color name="Comment" foreground="#008000" />
<Color name="Tag" foreground="#800000" exampleText="div" />
<Color name="Attribute" foreground="#0000FF" exampleText="on:click" />
<Color name="String" foreground="#A31515" exampleText="&quot;text&quot;" />
<Color name="Directive" foreground="#B000B0" exampleText="bind:" />
<Color name="Keyword" foreground="#000080" exampleText="import" />
<Color name="Script" foreground="#333333" />
<Color name="Style" foreground="#0055A5" />
<RuleSet name="Html">
<Span color="Comment" begin="&lt;!--" end="--&gt;" />
<Span color="String" begin="&quot;" end="&quot;" />
<Span color="String" begin="&apos;" end="&apos;" />
<!-- Tags -->
<Span color="Tag" begin="&lt;" end="&gt;">
<RuleSet>
<Keywords color="Tag">
<Word>script</Word>
<Word>style</Word>
<Word>div</Word>
<Word>span</Word>
<Word>input</Word>
<Word>button</Word>
<Word>section</Word>
<Word>article</Word>
<Word>header</Word>
<Word>footer</Word>
<Word>main</Word>
<Word>nav</Word>
<Word>aside</Word>
<Word>p</Word>
<Word>h1</Word>
<Word>h2</Word>
<Word>h3</Word>
<Word>ul</Word>
<Word>li</Word>
<Word>a</Word>
<Word>img</Word>
</Keywords>
<Keywords color="Directive">
<Word>bind:</Word>
<Word>on:</Word>
<Word>use:</Word>
<Word>transition:</Word>
<Word>in:</Word>
<Word>out:</Word>
<Word>animate:</Word>
<Word>class:</Word>
<Word>style:</Word>
</Keywords>
<Keywords color="Attribute">
<Word>export</Word>
<Word>let</Word>
<Word>const</Word>
</Keywords>
</RuleSet>
</Span>
</RuleSet>
<RuleSet name="JavaScript">
<Span color="Comment" begin="//" end="\n" />
<Span color="Comment" begin="/\*" end="\*/" />
<Span color="String" begin="&quot;" end="&quot;" />
<Span color="String" begin="&apos;" end="&apos;" />
<Keywords color="Keyword">
<Word>import</Word>
<Word>export</Word>
<Word>default</Word>
<Word>return</Word>
<Word>const</Word>
<Word>let</Word>
<Word>var</Word>
<Word>if</Word>
<Word>else</Word>
<Word>for</Word>
<Word>while</Word>
<Word>function</Word>
<Word>async</Word>
<Word>await</Word>
<Word>new</Word>
<Word>this</Word>
<Word>true</Word>
<Word>false</Word>
<Word>null</Word>
<Word>undefined</Word>
<Word>each</Word>
<Word>if</Word>
<Word>else</Word>
<Word>await</Word>
<Word>then</Word>
<Word>catch</Word>
</Keywords>
</RuleSet>
<RuleSet name="CSS">
<Span color="Comment" begin="/\*" end="\*/" />
<Span color="String" begin="&quot;" end="&quot;" />
<Span color="String" begin="&apos;" end="&apos;" />
</RuleSet>
<RuleSet name="MainRuleSet">
<Import ruleSet="Html" />
<Import ruleSet="JavaScript" />
<Import ruleSet="CSS" />
</RuleSet>
<RuleSet>
<Import ruleSet="MainRuleSet" />
</RuleSet>
</SyntaxDefinition>

View File

@@ -17,7 +17,6 @@
using ICSharpCode.AvalonEdit;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Editing;
using ICSharpCode.AvalonEdit.Rendering;
using ICSharpCode.AvalonEdit.Search;
using QuickLook.Common.Helpers;
@@ -28,7 +27,6 @@ using QuickLook.Plugin.TextViewer.Themes.HighlightingDefinitions;
using System;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows;
@@ -70,33 +68,16 @@ public partial class TextViewerPanel : TextEditor, IDisposable
ShowLineNumbers = true;
WordWrap = true;
IsReadOnly = true;
// Enable manipulation events (touch gestures like pan/scroll).
IsManipulationEnabled = true;
// Disable automatic hyperlink detection for email addresses.
Options.EnableEmailHyperlinks = false;
// Disable automatic hyperlink detection for general URLs.
Options.EnableHyperlinks = false;
// Search for the separator line inside the left margins of the TextArea.
// The default LineNumberMargin in AvalonEdit often contains a thin Line element
// used as a visual separator between line numbers and the text.
// If found, set its Stroke to Transparent to hide the separator visually.
TextArea.LeftMargins
.OfType<System.Windows.Shapes.Line>()
.FirstOrDefault()
?.Stroke = Brushes.Transparent;
ContextMenu = new ContextMenu();
// Add "Copy" menu item.
ContextMenu.Items.Add(new MenuItem
{
Header = TranslationHelper.Get("Editor_Copy", domain: Assembly.GetExecutingAssembly().GetName().Name),
Command = ApplicationCommands.Copy
});
// Add "Select All" menu item.
ContextMenu.Items.Add(new MenuItem
{
Header = TranslationHelper.Get("Editor_SelectAll",
@@ -114,10 +95,8 @@ public partial class TextViewerPanel : TextEditor, IDisposable
FontFamily = new FontFamily(TranslationHelper.Get("Editor_FontFamily",
domain: Assembly.GetExecutingAssembly().GetName().Name));
// Add a custom element generator (e.g., to truncate extremely long lines).
TextArea.TextView.ElementGenerators.Add(new TruncateLongLines());
// Install the search panel (Ctrl+F style search UI).
SearchPanel.Install(this);
}

View File

@@ -351,7 +351,7 @@ public partial class ViewerPanel : UserControl, IDisposable, INotifyPropertyChan
private void ChangeVolume(double delta)
{
LinearVolume = Math.Max(0d, Math.Min(1d, LinearVolume + delta));
LinearVolume += delta;
}
private void TogglePlayPause(object sender, EventArgs e)
@@ -385,16 +385,16 @@ public partial class ViewerPanel : UserControl, IDisposable, INotifyPropertyChan
UpdateMeta(path, info);
// detect rotation
_ = double.TryParse(info?.Get(StreamKind.Video, 0, "Rotation"), out var rotation);
double.TryParse(info?.Get(StreamKind.Video, 0, "Rotation"), out var rotation);
// Correct rotation: on some machine the value "90" becomes "90000" by some reason
if (rotation > 360d)
if (rotation > 360)
rotation /= 1e3;
if (Math.Abs(rotation) > 0.1d)
mediaElement.LayoutTransform = new RotateTransform(rotation, 0.5d, 0.5d);
if (Math.Abs(rotation) > 0.1)
mediaElement.LayoutTransform = new RotateTransform(rotation, 0.5, 0.5);
mediaElement.Source = new Uri(path);
// old plugin use an int-typed "Volume" config key ranged from 0 to 100. Let's use a new one here.
LinearVolume = Math.Max(0d, Math.Min(1d, SettingHelper.Get("VolumeDouble", 1d, "QuickLook.Plugin.VideoViewer")));
LinearVolume = SettingHelper.Get("VolumeDouble", 1d, "QuickLook.Plugin.VideoViewer");
mediaElement.Play();
}

View File

@@ -259,9 +259,6 @@ public partial class App : Application
private void CheckUpdate()
{
if (SettingHelper.Get("DisableAutoUpdateCheck", false))
return;
if (DateTime.Now.Ticks - SettingHelper.Get<long>("LastUpdateTicks") < TimeSpan.FromDays(30).Ticks)
return;

View File

@@ -105,7 +105,7 @@
<PackageReference Include="WPF-UI.Violeta" Version="4.0.3.6">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Lib.Harmony" Version="2.4.2">
<PackageReference Include="Lib.Harmony" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="UnblockZoneIdentifier" Version="1.0.0">

View File

@@ -11,7 +11,6 @@
<MW_Open>افتح الملف {0} باستخدام البرنامج الافتراضي</MW_Open>
<MW_OpenWith>افتح الملف {0} باستخدام برنامج محدد</MW_OpenWith>
<MW_Run>شغل الملف {0} المحدد</MW_Run>
<MW_FileBlocked>هذا النوع من الملفات محظور.</MW_FileBlocked>
<Icon_RunAtStartup>شغل البرنامج أوتوماتيكيًا عند تشغيل النظام</Icon_RunAtStartup>
<Icon_ToolTip>النسخة {0} من كويك لووك</Icon_ToolTip>
<Icon_CheckUpdate>تأكد من وجود أي تحديث للبرنامج</Icon_CheckUpdate>
@@ -41,7 +40,6 @@
<MW_Open>Megnyitás {0}</MW_Open>
<MW_OpenWith>Megnyitás ezzel {0}</MW_OpenWith>
<MW_Run>Futtatás {0}</MW_Run>
<MW_FileBlocked>Ez a fájltípus blokkolva van.</MW_FileBlocked>
<Icon_RunAtStartup>Futattás &amp;Indításkor</Icon_RunAtStartup>
<Icon_ToolTip>QuickLook v{0}</Icon_ToolTip>
<Icon_CheckUpdate>Keressen új &amp;Frissítést...</Icon_CheckUpdate>
@@ -71,7 +69,6 @@
<MW_Open>Otvoriť {0}</MW_Open>
<MW_OpenWith>Otvoriť v programe {0}</MW_OpenWith>
<MW_Run>Spustiť {0}</MW_Run>
<MW_FileBlocked>Tento typ súboru je blokovaný.</MW_FileBlocked>
<Icon_RunAtStartup>Spustiť pri &amp;štarte</Icon_RunAtStartup>
<Icon_ToolTip>QuickLook v{0}</Icon_ToolTip>
<Icon_CheckUpdate>Skontrolovať &amp;aktualizácie...</Icon_CheckUpdate>
@@ -100,7 +97,6 @@
<MW_Open>Buka {0}</MW_Open>
<MW_OpenWith>Buka dengan {0}</MW_OpenWith>
<MW_Run>Jalankan {0}</MW_Run>
<MW_FileBlocked>Jenis file ini diblokir.</MW_FileBlocked>
<Icon_RunAtStartup>Jalankan saat &amp;Memulai</Icon_RunAtStartup>
<Icon_ToolTip>QuickLook v. {0}</Icon_ToolTip>
<Icon_CheckUpdate>Memeriksa &amp;Pembaharuan...</Icon_CheckUpdate>
@@ -134,7 +130,6 @@
<MW_Open>{0} 열기</MW_Open>
<MW_OpenWith>{0}(으)로 열기</MW_OpenWith>
<MW_Run>{0} 실행</MW_Run>
<MW_FileBlocked>이 파일 유형은 차단되었습니다.</MW_FileBlocked>
<MW_Share>공유</MW_Share>
<Icon_RunAtStartup>시작 시 실행(&amp;S)</Icon_RunAtStartup>
<Icon_ToolTip>QuickLook v{0}</Icon_ToolTip>
@@ -165,7 +160,6 @@
<MW_Open>Obre {0}</MW_Open>
<MW_OpenWith>Obre'l amb {0}</MW_OpenWith>
<MW_Run>Executa'l {0}</MW_Run>
<MW_FileBlocked>Aquest tipus de fitxer està bloquejat.</MW_FileBlocked>
<Icon_RunAtStartup>Executa'l a l'&amp;inici</Icon_RunAtStartup>
<Icon_ToolTip>QuickLook v{0}</Icon_ToolTip>
<Icon_CheckUpdate>Cerca &amp;actualitzacions...</Icon_CheckUpdate>
@@ -198,7 +192,6 @@
<MW_OpenWith>Öffnen mit {0}</MW_OpenWith>
<MW_OpenWithMenu>Öffnen mit ...</MW_OpenWithMenu>
<MW_Run>{0} ausführen</MW_Run>
<MW_FileBlocked>Dieser Dateityp ist blockiert.</MW_FileBlocked>
<MW_Share>Freigeben</MW_Share>
<MW_Reload>Neu laden</MW_Reload>
<MW_More>Mehr</MW_More>
@@ -236,7 +229,6 @@
<MW_OpenWith>Open with {0}</MW_OpenWith>
<MW_OpenWithMenu>Open With Menu</MW_OpenWithMenu>
<MW_Run>Run {0}</MW_Run>
<MW_FileBlocked>This file type is blocked.</MW_FileBlocked>
<MW_Share>Share</MW_Share>
<MW_Reload>Reload</MW_Reload>
<MW_More>More</MW_More>
@@ -274,7 +266,6 @@
<MW_OpenWith>Abrir con {0}</MW_OpenWith>
<MW_OpenWithMenu>Abrir Con Menu</MW_OpenWithMenu>
<MW_Run>Iniciar {0}</MW_Run>
<MW_FileBlocked>Este tipo de archivo está bloqueado.</MW_FileBlocked>
<MW_Share>Compartir</MW_Share>
<MW_Reload>Recargar</MW_Reload>
<MW_More>Más</MW_More>
@@ -308,7 +299,6 @@
<MW_Open>Ouvrir {0}</MW_Open>
<MW_OpenWith>Ouvrir avec {0}</MW_OpenWith>
<MW_Run>Exécuter {0}</MW_Run>
<MW_FileBlocked>Ce type de fichier est bloqué.</MW_FileBlocked>
<MW_Reload>Recharger</MW_Reload>
<MW_More>Plus</MW_More>
<Icon_RunAtStartup>Exécuter au &amp;démarrage</Icon_RunAtStartup>
@@ -341,7 +331,6 @@
<MW_Open>Apri {0}</MW_Open>
<MW_OpenWith>Apri con {0}</MW_OpenWith>
<MW_Run>Esegui {0}</MW_Run>
<MW_FileBlocked>Questo tipo di file è bloccato.</MW_FileBlocked>
<MW_Reload>Ricarica</MW_Reload>
<MW_More>Altro</MW_More>
<Icon_RunAtStartup>Esegui all'&amp;Avvio</Icon_RunAtStartup>
@@ -376,7 +365,6 @@
<MW_OpenWith>{0} で開く</MW_OpenWith>
<MW_OpenWithMenu>メニューから選択して開く</MW_OpenWithMenu>
<MW_Run>{0} を起動</MW_Run>
<MW_FileBlocked>このファイルタイプはブロックされています.</MW_FileBlocked>
<MW_Share>シェア</MW_Share>
<MW_Reload>再読み込み</MW_Reload>
<MW_More>その他</MW_More>
@@ -409,7 +397,6 @@
<MW_Open>Åpne {0}</MW_Open>
<MW_OpenWith>Åpne med {0}</MW_OpenWith>
<MW_Run>Kjør {0}</MW_Run>
<MW_FileBlocked>Denne filtypen er blokkert.</MW_FileBlocked>
<Icon_RunAtStartup>Kjør ved &amp;oppstart</Icon_RunAtStartup>
<Icon_ToolTip>QuickLook v{0}</Icon_ToolTip>
<Icon_CheckUpdate>Se etter &amp;oppdateringer...</Icon_CheckUpdate>
@@ -437,7 +424,6 @@
<MW_Open>Open {0}</MW_Open>
<MW_OpenWith>Openen met {0}</MW_OpenWith>
<MW_Run>Uitvoeren {0}</MW_Run>
<MW_FileBlocked>Dit bestandstype is geblokkeerd.</MW_FileBlocked>
<Icon_RunAtStartup>Uitvoeren bij &amp;Opstarten</Icon_RunAtStartup>
<Icon_ToolTip>QuickLook v{0}</Icon_ToolTip>
<Icon_CheckUpdate>Controleren op &amp;Updates...</Icon_CheckUpdate>
@@ -470,7 +456,6 @@
<MW_OpenWith>Otwórz w {0}</MW_OpenWith>
<MW_OpenWithMenu>Otwórz za pomocą...</MW_OpenWithMenu>
<MW_Run>Uruchom {0}</MW_Run>
<MW_FileBlocked>Ten typ pliku jest zablokowany.</MW_FileBlocked>
<MW_Share>Udostępnij</MW_Share>
<MW_Reload>Przeładuj</MW_Reload>
<MW_More>Więcej</MW_More>
@@ -508,7 +493,6 @@
<MW_OpenWith>Abrir com {0}</MW_OpenWith>
<MW_OpenWithMenu>Menu abrir com</MW_OpenWithMenu>
<MW_Run>Executar {0}</MW_Run>
<MW_FileBlocked>Este tipo de arquivo está bloqueado.</MW_FileBlocked>
<MW_Share>Compartilhar</MW_Share>
<MW_Reload>Recarregar</MW_Reload>
<MW_More>Mais</MW_More>
@@ -541,7 +525,6 @@
<MW_Open>Abrir {0}</MW_Open>
<MW_OpenWith>Abrir com {0}</MW_OpenWith>
<MW_Run>Executar {0}</MW_Run>
<MW_FileBlocked>Este tipo de ficheiro está bloqueado.</MW_FileBlocked>
<Icon_RunAtStartup>Executar no &amp;Arranque</Icon_RunAtStartup>
<Icon_ToolTip>QuickLook v{0}</Icon_ToolTip>
<Icon_CheckUpdate>Procurar por &amp;Atualizações...</Icon_CheckUpdate>
@@ -570,7 +553,6 @@
<MW_Open>Открыть {0}</MW_Open>
<MW_OpenWith>Открыть с помощью {0}</MW_OpenWith>
<MW_Run>Запустить {0}</MW_Run>
<MW_FileBlocked>Этот тип файла заблокирован.</MW_FileBlocked>
<MW_StayTop>Поверх всех окон</MW_StayTop>
<MW_PreventClosing>Закрепить</MW_PreventClosing>
<MW_Share>Поделиться</MW_Share>
@@ -605,7 +587,6 @@
<MW_Open>Aç: {0}</MW_Open>
<MW_OpenWith>Birlikte aç: {0}</MW_OpenWith>
<MW_Run>Çalıştır: {0}</MW_Run>
<MW_FileBlocked>Bu dosya türü engellenmiştir.</MW_FileBlocked>
<Icon_RunAtStartup>B&amp;aşlangıçta çalıştır</Icon_RunAtStartup>
<Icon_ToolTip>QuickLook v{0}</Icon_ToolTip>
<Icon_CheckUpdate>&amp;Güncellemeleri denetle...</Icon_CheckUpdate>
@@ -639,7 +620,6 @@
<MW_OpenWith>Відкрити за допомогою {0}</MW_OpenWith>
<MW_OpenWithMenu>Відкрити за допомогою меню</MW_OpenWithMenu>
<MW_Run>Запустити {0}</MW_Run>
<MW_FileBlocked>Цей тип файлу заблоковано.</MW_FileBlocked>
<MW_Share>Поширити</MW_Share>
<MW_Reload>Перезавантажити</MW_Reload>
<MW_More>Більше</MW_More>
@@ -672,7 +652,6 @@
<MW_Open>Mở {0}</MW_Open>
<MW_OpenWith>Mở bằng {0}</MW_OpenWith>
<MW_Run>Chạy {0}</MW_Run>
<MW_FileBlocked>Loại tệp này bị chặn.</MW_FileBlocked>
<Icon_RunAtStartup>&amp;Khởi động cùng hệ thống</Icon_RunAtStartup>
<Icon_ToolTip>QuickLook v{0}</Icon_ToolTip>
<Icon_CheckUpdate>&amp;Kiểm tra cập nhật...</Icon_CheckUpdate>
@@ -705,7 +684,6 @@
<MW_OpenWith>用 {0} 打开</MW_OpenWith>
<MW_OpenWithMenu>从菜单选择打开</MW_OpenWithMenu>
<MW_Run>运行 {0}</MW_Run>
<MW_FileBlocked>此文件类型已被阻止。</MW_FileBlocked>
<MW_Share>分享</MW_Share>
<MW_Reload>重新加载</MW_Reload>
<MW_More>更多</MW_More>
@@ -743,7 +721,6 @@
<MW_OpenWith>使用 {0} 開啟</MW_OpenWith>
<MW_OpenWithMenu>從選單選擇開啟</MW_OpenWithMenu>
<MW_Run>執行 {0}</MW_Run>
<MW_FileBlocked>此檔案類型已被阻止。</MW_FileBlocked>
<MW_Share>分享</MW_Share>
<MW_Reload>重新載入</MW_Reload>
<MW_More>更多</MW_More>
@@ -777,7 +754,6 @@
<MW_Open>{0} उघडा</MW_Open>
<MW_OpenWith>{0} च्या सह उघडा</MW_OpenWith>
<MW_Run>{0} चालवा</MW_Run>
<MW_FileBlocked>हा फाइल प्रकार ब्लॉक केला आहे.</MW_FileBlocked>
<Icon_RunAtStartup>&amp;सुरूवातीस चालवा</Icon_RunAtStartup>
<Icon_ToolTip>QuickLook आवृत्ती v{0}</Icon_ToolTip>
<Icon_CheckUpdate>&amp;अद्यतनांसाठी तपासा...</Icon_CheckUpdate>
@@ -805,7 +781,6 @@
<MW_Open>{0} खोलें</MW_Open>
<MW_OpenWith>{0} के साथ खोलें</MW_OpenWith>
<MW_Run>{0} चलाएं</MW_Run>
<MW_FileBlocked>यह फ़ाइल प्रकार अवरुद्ध है.</MW_FileBlocked>
<Icon_RunAtStartup>&amp;शुरु होते समय चलाएं</Icon_RunAtStartup>
<Icon_ToolTip>QuickLook आवृत्ती v{0}</Icon_ToolTip>
<Icon_CheckUpdate>&amp;अद्यतन के लिए जाँच करें...</Icon_CheckUpdate>
@@ -833,8 +808,6 @@
<MW_BrowseFolder>סייר ב{0}</MW_BrowseFolder>
<MW_Open>פתח את {0}</MW_Open>
<MW_OpenWith>פתח בעזרת {0}</MW_OpenWith>
<MW_Run>הפעל {0}</MW_Run>
<MW_FileBlocked>סוג קובץ זה חסום.</MW_FileBlocked>
<MW_Run>הרץ {0}</MW_Run>
<Icon_RunAtStartup>הרץ ב&amp;אתחול</Icon_RunAtStartup>
<Icon_ToolTip>'תצוגה מהירה' v{0}</Icon_ToolTip>
@@ -864,7 +837,6 @@
<MW_Open>Άνοιγμα {0}</MW_Open>
<MW_OpenWith>Άνοιγμα με {0}</MW_OpenWith>
<MW_Run>Εκτέλεση {0}</MW_Run>
<MW_FileBlocked>Αυτός ο τύπος αρχείου είναι αποκλεισμένος.</MW_FileBlocked>
<Icon_RunAtStartup>Εκτέλεση κατά &amp;την εκκίνηση</Icon_RunAtStartup>
<Icon_ToolTip>QuickLook v{0}</Icon_ToolTip>
<Icon_CheckUpdate>Ελεγχος για &amp;ενημερώσεις...</Icon_CheckUpdate>
@@ -896,7 +868,6 @@
<MW_OpenWith>Öppna med {0}</MW_OpenWith>
<MW_OpenWithMenu>Öppna med…</MW_OpenWithMenu>
<MW_Run>Kör {0}</MW_Run>
<MW_FileBlocked>Den här filtypen är blockerad.</MW_FileBlocked>
<MW_Share>Dela</MW_Share>
<MW_Reload>Ladda om</MW_Reload>
<Icon_RunAtStartup>Kör vid &amp;start</Icon_RunAtStartup>

View File

@@ -201,19 +201,6 @@ public partial class ViewerWindow
return;
}
if (ContextObject.IsBlocked)
{
ContextObject.ViewerContent = new System.Windows.Controls.TextBlock
{
Text = TranslationHelper.Get("MW_FileBlocked", failsafe: "This file type is blocked."),
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
FontSize = 14,
};
ContextObject.IsBusy = false;
return;
}
SetOpenWithButtonAndPath();
// Revert UI changes

View File

@@ -64,8 +64,6 @@ public partial class ViewerWindow : Window
Topmost = SettingHelper.Get("Topmost", false);
buttonTop.Tag = Topmost ? "Top" : "Auto";
ShowInTaskbar = SettingHelper.Get("ShowInTaskbar", false);
buttonTop.Click += (_, _) =>
{
Topmost = !Topmost;