Fix #644 step 2: add context menu to TextViewer

This commit is contained in:
Paddy Xu
2020-05-09 19:33:46 +03:00
parent af608dc9d9
commit 5c96abd1cb
2 changed files with 17 additions and 2 deletions

View File

@@ -19,6 +19,7 @@ using System;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Threading;
@@ -50,6 +51,12 @@ namespace QuickLook.Plugin.TextViewer
Options.EnableEmailHyperlinks = 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;
ManipulationStarting += Viewer_ManipulationStarting;
ManipulationDelta += Viewer_ManipulationDelta;
@@ -124,7 +131,7 @@ namespace QuickLook.Plugin.TextViewer
{
Task.Run(() =>
{
const int maxLength = 50 * 1024 * 1024;
const int maxLength = 5 * 1024 * 1024;
var buffer = new MemoryStream();
bool tooLong;
@@ -146,7 +153,7 @@ namespace QuickLook.Plugin.TextViewer
return;
if (tooLong)
_context.Title += " (0 ~ 50MB)";
_context.Title += " (0 ~ 5MB)";
var bufferCopy = buffer.ToArray();
buffer.Dispose();