1818
1919using System ;
2020using System . IO ;
21- using ICSharpCode . Core ;
22- using ICSharpCode . Core . WinForms ;
21+ using System . Windows . Input ;
2322using ICSharpCode . SharpDevelop ;
24- using ICSharpCode . SharpDevelop . Gui ;
2523using ICSharpCode . SharpDevelop . WinForms ;
2624using 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