Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 904373a

Browse files
fix #234: Short cuts/toolbar actions do not always work in non-WPF view contents
1 parent e5dde6f commit 904373a

2 files changed

Lines changed: 13 additions & 16 deletions

File tree

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ public bool HasSomethingSelected {
3434
get { return hexEditControl.HasSomethingSelected; }
3535
}
3636

37-
public bool EditorFocused {
38-
get { return hexEditControl.Focused; }
39-
}
40-
4137
public bool CanUndo {
4238
get { return hexEditControl.CanUndo; }
4339
}

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

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@
1818

1919
using System;
2020
using System.IO;
21-
using ICSharpCode.Core;
22-
using ICSharpCode.Core.WinForms;
21+
using System.Windows.Input;
2322
using ICSharpCode.SharpDevelop;
24-
using ICSharpCode.SharpDevelop.Gui;
2523
using ICSharpCode.SharpDevelop.WinForms;
2624
using ICSharpCode.SharpDevelop.Workbench;
2725

@@ -34,7 +32,8 @@ public class HexEditView : AbstractViewContent, IClipboardHandler, IUndoHandler
3432
public HexEditView(OpenedFile file)
3533
{
3634
hexEditContainer = new HexEditContainer();
37-
hexEditContainer.hexEditControl.DocumentChanged += new EventHandler(DocumentChanged);
35+
hexEditContainer.hexEditControl.DocumentChanged += DocumentChanged;
36+
hexEditContainer.hexEditControl.Selection.SelectionChanged += SelectionChanged;
3837

3938
this.Files.Add(file);
4039

@@ -67,23 +66,23 @@ public override bool IsReadOnly {
6766

6867
#region IClipboardHandler
6968
public bool EnableCut {
70-
get { return hexEditContainer.HasSomethingSelected & hexEditContainer.EditorFocused; }
69+
get { return hexEditContainer.HasSomethingSelected; }
7170
}
7271

7372
public bool EnableCopy {
74-
get { return hexEditContainer.HasSomethingSelected & hexEditContainer.EditorFocused; }
73+
get { return hexEditContainer.HasSomethingSelected; }
7574
}
7675

7776
public bool EnablePaste {
78-
get { return hexEditContainer.EditorFocused; }
77+
get { return true; }
7978
}
8079

8180
public bool EnableDelete {
82-
get { return hexEditContainer.HasSomethingSelected & hexEditContainer.EditorFocused; }
81+
get { return hexEditContainer.HasSomethingSelected; }
8382
}
8483

8584
public bool EnableSelectAll {
86-
get { return hexEditContainer.EditorFocused; }
85+
get { return true; }
8786
}
8887

8988
public void Cut()
@@ -137,10 +136,12 @@ public void Redo()
137136
void DocumentChanged(object sender, EventArgs e)
138137
{
139138
if (PrimaryFile != null) PrimaryFile.MakeDirty();
139+
CommandManager.InvalidateRequerySuggested();
140140
}
141-
142-
public override bool IsDirty {
143-
get { return base.IsDirty; }
141+
142+
void SelectionChanged(object sender, System.EventArgs e)
143+
{
144+
CommandManager.InvalidateRequerySuggested();
144145
}
145146
}
146147
}

0 commit comments

Comments
 (0)