Browse Source

fix #234: Short cuts/toolbar actions do not always work in non-WPF view contents

pull/520/merge
Siegfried Pammer 11 years ago
parent
commit
904373afe2
  1. 4
      src/AddIns/DisplayBindings/HexEditor/Project/Src/View/HexEditContainer.cs
  2. 25
      src/AddIns/DisplayBindings/HexEditor/Project/Src/View/HexEditView.cs

4
src/AddIns/DisplayBindings/HexEditor/Project/Src/View/HexEditContainer.cs

@ -34,10 +34,6 @@ namespace HexEditor.View
get { return hexEditControl.HasSomethingSelected; } get { return hexEditControl.HasSomethingSelected; }
} }
public bool EditorFocused {
get { return hexEditControl.Focused; }
}
public bool CanUndo { public bool CanUndo {
get { return hexEditControl.CanUndo; } get { return hexEditControl.CanUndo; }
} }

25
src/AddIns/DisplayBindings/HexEditor/Project/Src/View/HexEditView.cs

@ -18,10 +18,8 @@
using System; using System;
using System.IO; using System.IO;
using ICSharpCode.Core; using System.Windows.Input;
using ICSharpCode.Core.WinForms;
using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.WinForms; using ICSharpCode.SharpDevelop.WinForms;
using ICSharpCode.SharpDevelop.Workbench; using ICSharpCode.SharpDevelop.Workbench;
@ -34,7 +32,8 @@ namespace HexEditor.View
public HexEditView(OpenedFile file) public HexEditView(OpenedFile file)
{ {
hexEditContainer = new HexEditContainer(); hexEditContainer = new HexEditContainer();
hexEditContainer.hexEditControl.DocumentChanged += new EventHandler(DocumentChanged); hexEditContainer.hexEditControl.DocumentChanged += DocumentChanged;
hexEditContainer.hexEditControl.Selection.SelectionChanged += SelectionChanged;
this.Files.Add(file); this.Files.Add(file);
@ -67,23 +66,23 @@ namespace HexEditor.View
#region IClipboardHandler #region IClipboardHandler
public bool EnableCut { public bool EnableCut {
get { return hexEditContainer.HasSomethingSelected & hexEditContainer.EditorFocused; } get { return hexEditContainer.HasSomethingSelected; }
} }
public bool EnableCopy { public bool EnableCopy {
get { return hexEditContainer.HasSomethingSelected & hexEditContainer.EditorFocused; } get { return hexEditContainer.HasSomethingSelected; }
} }
public bool EnablePaste { public bool EnablePaste {
get { return hexEditContainer.EditorFocused; } get { return true; }
} }
public bool EnableDelete { public bool EnableDelete {
get { return hexEditContainer.HasSomethingSelected & hexEditContainer.EditorFocused; } get { return hexEditContainer.HasSomethingSelected; }
} }
public bool EnableSelectAll { public bool EnableSelectAll {
get { return hexEditContainer.EditorFocused; } get { return true; }
} }
public void Cut() public void Cut()
@ -137,10 +136,12 @@ namespace HexEditor.View
void DocumentChanged(object sender, EventArgs e) void DocumentChanged(object sender, EventArgs e)
{ {
if (PrimaryFile != null) PrimaryFile.MakeDirty(); if (PrimaryFile != null) PrimaryFile.MakeDirty();
CommandManager.InvalidateRequerySuggested();
} }
public override bool IsDirty { void SelectionChanged(object sender, System.EventArgs e)
get { return base.IsDirty; } {
CommandManager.InvalidateRequerySuggested();
} }
} }
} }

Loading…
Cancel
Save