mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-11 17:59:17 +00:00
Fix #644 step 2: add context menu to TextViewer
This commit is contained in:
@@ -19,6 +19,7 @@ using System;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
@@ -50,6 +51,12 @@ namespace QuickLook.Plugin.TextViewer
|
|||||||
Options.EnableEmailHyperlinks = false;
|
Options.EnableEmailHyperlinks = false;
|
||||||
Options.EnableHyperlinks = false;
|
Options.EnableHyperlinks = false;
|
||||||
|
|
||||||
|
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});
|
||||||
|
|
||||||
ManipulationInertiaStarting += Viewer_ManipulationInertiaStarting;
|
ManipulationInertiaStarting += Viewer_ManipulationInertiaStarting;
|
||||||
ManipulationStarting += Viewer_ManipulationStarting;
|
ManipulationStarting += Viewer_ManipulationStarting;
|
||||||
ManipulationDelta += Viewer_ManipulationDelta;
|
ManipulationDelta += Viewer_ManipulationDelta;
|
||||||
@@ -124,7 +131,7 @@ namespace QuickLook.Plugin.TextViewer
|
|||||||
{
|
{
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
const int maxLength = 50 * 1024 * 1024;
|
const int maxLength = 5 * 1024 * 1024;
|
||||||
var buffer = new MemoryStream();
|
var buffer = new MemoryStream();
|
||||||
bool tooLong;
|
bool tooLong;
|
||||||
|
|
||||||
@@ -146,7 +153,7 @@ namespace QuickLook.Plugin.TextViewer
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (tooLong)
|
if (tooLong)
|
||||||
_context.Title += " (0 ~ 50MB)";
|
_context.Title += " (0 ~ 5MB)";
|
||||||
|
|
||||||
var bufferCopy = buffer.ToArray();
|
var bufferCopy = buffer.ToArray();
|
||||||
buffer.Dispose();
|
buffer.Dispose();
|
||||||
|
@@ -9,6 +9,8 @@
|
|||||||
</de-DE>
|
</de-DE>
|
||||||
<en>
|
<en>
|
||||||
<Editor_FontFamily>Consolas</Editor_FontFamily>
|
<Editor_FontFamily>Consolas</Editor_FontFamily>
|
||||||
|
<Editor_Copy>Copy</Editor_Copy>
|
||||||
|
<Editor_SelectAll>Select All</Editor_SelectAll>
|
||||||
</en>
|
</en>
|
||||||
<es-ES>
|
<es-ES>
|
||||||
<Editor_FontFamily>Consolas</Editor_FontFamily>
|
<Editor_FontFamily>Consolas</Editor_FontFamily>
|
||||||
@@ -21,6 +23,8 @@
|
|||||||
</it>
|
</it>
|
||||||
<ja-JP>
|
<ja-JP>
|
||||||
<Editor_FontFamily>Consolas,Meiryo UI,MS UI Gothic,MS Gothic</Editor_FontFamily>
|
<Editor_FontFamily>Consolas,Meiryo UI,MS UI Gothic,MS Gothic</Editor_FontFamily>
|
||||||
|
<Editor_Copy>コピー</Editor_Copy>
|
||||||
|
<Editor_SelectAll>すべて選択</Editor_SelectAll>
|
||||||
</ja-JP>
|
</ja-JP>
|
||||||
<ko-KR>
|
<ko-KR>
|
||||||
<Editor_FontFamily>Consolas,Malgun Gothic,Batang</Editor_FontFamily>
|
<Editor_FontFamily>Consolas,Malgun Gothic,Batang</Editor_FontFamily>
|
||||||
@@ -54,9 +58,13 @@
|
|||||||
</vi>
|
</vi>
|
||||||
<zh-CN>
|
<zh-CN>
|
||||||
<Editor_FontFamily>Consolas,Microsoft Yahei UI,Microsoft Yahei,SimSun</Editor_FontFamily>
|
<Editor_FontFamily>Consolas,Microsoft Yahei UI,Microsoft Yahei,SimSun</Editor_FontFamily>
|
||||||
|
<Editor_Copy>复制</Editor_Copy>
|
||||||
|
<Editor_SelectAll>全选</Editor_SelectAll>
|
||||||
</zh-CN>
|
</zh-CN>
|
||||||
<zh-TW>
|
<zh-TW>
|
||||||
<Editor_FontFamily>Consolas,Microsoft JhengHei UI,Microsoft JhengHei,MingLiU</Editor_FontFamily>
|
<Editor_FontFamily>Consolas,Microsoft JhengHei UI,Microsoft JhengHei,MingLiU</Editor_FontFamily>
|
||||||
|
<Editor_Copy>複製</Editor_Copy>
|
||||||
|
<Editor_SelectAll>全選</Editor_SelectAll>
|
||||||
</zh-TW>
|
</zh-TW>
|
||||||
<mr>
|
<mr>
|
||||||
<Editor_FontFamily>Consolas,Mangal,Nirmala UI</Editor_FontFamily>
|
<Editor_FontFamily>Consolas,Mangal,Nirmala UI</Editor_FontFamily>
|
||||||
|
Reference in New Issue
Block a user