diff options
author | Lluis Sanchez <llsan@microsoft.com> | 2019-03-29 19:49:19 +0300 |
---|---|---|
committer | Lluis Sanchez <llsan@microsoft.com> | 2019-03-31 19:20:51 +0300 |
commit | 5ac39c14e80ff7a0b136974d27316fedeb25cafb (patch) | |
tree | 2595748354a4721cbdc987d53a32c95b1aa3a582 /main/src/addins/MonoDevelop.HexEditor | |
parent | c3e30fb85814da74f1adfb0e65a9c9f7e62ef76a (diff) |
Hex editor fixes
Fixed loading of the byte buffer model.
Diffstat (limited to 'main/src/addins/MonoDevelop.HexEditor')
3 files changed, 6 insertions, 0 deletions
diff --git a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/ByteBuffer.cs b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/ByteBuffer.cs index 294c0d6b4c..155ca70ece 100644 --- a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/ByteBuffer.cs +++ b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/ByteBuffer.cs @@ -54,8 +54,10 @@ namespace Mono.MHex.Data return this.buffer; } set { + var oldCount = Length; this.buffer = value; pieceTable.SetBuffer (buffer); + OnReplaced (new ReplaceEventArgs (0, oldCount, Bytes)); } } diff --git a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/ByteBufferModel.cs b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/ByteBufferModel.cs index 89205fe6be..dbdbbdfacb 100644 --- a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/ByteBufferModel.cs +++ b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/ByteBufferModel.cs @@ -43,6 +43,8 @@ namespace Mono.MHex.Data ByteBufferInstanceChanged?.Invoke (this, EventArgs.Empty); } + protected override Type RepresentationType => typeof (ByteBufferModelRepresentation); + protected class ByteBufferModelRepresentation : FileModelRepresentation { ByteBuffer byteBuffer; @@ -66,6 +68,7 @@ namespace Mono.MHex.Data protected override void OnCreateNew () { byteBuffer = new ByteBuffer (); + byteBuffer.Replaced += ByteBuffer_Replaced; byteBuffer.Buffer = new ArrayBuffer (new byte [0]); } diff --git a/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorView.cs b/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorView.cs index ffa4cb3e58..9870b6171d 100644 --- a/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorView.cs +++ b/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorView.cs @@ -52,6 +52,7 @@ namespace MonoDevelop.HexEditor protected override async Task<Control> OnGetViewControlAsync (CancellationToken token, DocumentViewContent view) { + view.Title = GettextCatalog.GetString ("Binary"); hexEditor = new Mono.MHex.HexEditor (); await Model.Load (); hexEditor.HexEditorData.ByteBuffer = ((ByteBufferModel)Model).ByteBuffer; |