diff options
author | Sandy Armstrong <sandy@xamarin.com> | 2019-01-25 18:05:34 +0300 |
---|---|---|
committer | Sandy Armstrong <sandy@xamarin.com> | 2019-01-25 18:24:42 +0300 |
commit | 2325b5d4c5f79fcbe37acf617eb87e23c56a1684 (patch) | |
tree | f9c8fd4da08b7bbac6b26ef1602fd35ec7ac4bd9 /main/src/addins/MonoDevelop.HexEditor | |
parent | 4a92358ddf393435c36fb742aeecda2e45d9c238 (diff) | |
parent | 2e188887d8e5ee2901fd803d4374f0c0fb8ad69a (diff) |
Merge remote-tracking branch 'origin/master' into pr-sandy-md-master
Diffstat (limited to 'main/src/addins/MonoDevelop.HexEditor')
4 files changed, 27 insertions, 3 deletions
diff --git a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditor.cs b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditor.cs index bdea66542d..c6bf1290fc 100644 --- a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditor.cs +++ b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditor.cs @@ -37,6 +37,8 @@ using Xwt; using Mono.MHex.Data; using Mono.MHex.Rendering; using Xwt.Drawing; +using MonoDevelop.Components.AtkCocoaHelper; +using MonoDevelop.Core; namespace Mono.MHex { @@ -99,8 +101,14 @@ namespace Mono.MHex } } + public bool IsReadOnly { get; set; } + + readonly Gtk.Widget hexWidget; + public HexEditor () { + hexWidget = (Gtk.Widget)Xwt.Toolkit.CurrentEngine.GetNativeWidget (this); + BackgroundColor = Color.FromBytes (0, 0, 0); CanGetFocus = true; HexEditorData = new HexEditorData (); @@ -112,6 +120,7 @@ namespace Mono.MHex if (HexEditorData.Caret.AutoScrollToCaret) ScrollToCaret (); RepaintLine (HexEditorData.Caret.Line); + AnnounceCurrentSelection (); }; HexEditorData.Caret.OffsetChanged += delegate(object sender, CaretLocationEventArgs e) { if (!HexEditorData.Caret.PreserveSelection) @@ -516,6 +525,17 @@ namespace Mono.MHex requestResetCaretBlink = true; } + void AnnounceCurrentSelection () + { + try { + var character = HexEditorData.Bytes [HexEditorData.Caret.Offset]; + var data = Convert.ToString (character, 16); + var message = GettextCatalog.GetString ("Selected '{0}' char:'{1}'", data [HexEditorData.Caret.SubPosition], (char)character); + hexWidget.Accessible.MakeAccessibilityAnnouncement (message); + } catch { + } + } + public void DrawCaret (Context ctx, Rectangle area) { if (!caretBlink || HexEditorData.IsSomethingSelected) diff --git a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditorDebugger.cs b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditorDebugger.cs index 28bac51da9..68e508820b 100644 --- a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditorDebugger.cs +++ b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditorDebugger.cs @@ -80,6 +80,8 @@ namespace Mono.MHex comboBox.Items.Add ("Hex 16"); comboBox.SelectedIndex = 0; editor.Options.StringRepresentationType = StringRepresentationTypes.ASCII; + editor.Accessible.Label = GettextCatalog.GetString ("Hexadecimal Text Editor"); + comboBox.SelectionChanged += delegate { switch (comboBox.SelectedIndex) { case 0: diff --git a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/SimpleEditMode.cs b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/SimpleEditMode.cs index 6b16f35e5b..29db8e9ab0 100644 --- a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/SimpleEditMode.cs +++ b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/SimpleEditMode.cs @@ -184,8 +184,10 @@ namespace Mono.MHex keyBindings [keyCode] (HexEditorData); return; } - - InsertCharacter (unicodeChar); + + if (!Editor.IsReadOnly) { + InsertCharacter (unicodeChar); + } } void InsertCharacter (uint unicodeChar) diff --git a/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorVisualizer.cs b/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorVisualizer.cs index 7897809fdd..40c0f444db 100644 --- a/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorVisualizer.cs +++ b/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorVisualizer.cs @@ -130,7 +130,7 @@ namespace MonoDevelop.HexEditor } hexEditor.HexEditorData.Buffer = buffer; - hexEditor.Editor.Sensitive = CanEdit (val); + hexEditor.Editor.IsReadOnly = !CanEdit (val); var xwtScrollView = new Xwt.ScrollView (hexEditor); var scrollWidget = (Widget) Xwt.Toolkit.CurrentEngine.GetNativeWidget (xwtScrollView); |