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 @@ -34,10 +34,6 @@ namespace HexEditor.View
get { return hexEditControl.HasSomethingSelected; }
}
public bool EditorFocused {
get { return hexEditControl.Focused; }
}
public bool CanUndo {
get { return hexEditControl.CanUndo; }
}

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

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

Loading…
Cancel
Save