--- a/ArrayedCollection.st Thu Mar 08 16:21:22 2012 +0100
+++ b/ArrayedCollection.st Thu Mar 08 21:26:34 2012 +0100
@@ -384,6 +384,73 @@
"Modified: 18.7.1996 / 21:39:09 / cg"
! !
+!ArrayedCollection methodsFor:'inspecting'!
+
+inspector2TabForHexDump
+ "a tab, showing a hex dump"
+
+ |wrapper myByteSize v genDump baseAddress|
+
+ myByteSize := self size * self class elementByteSize.
+
+ wrapper := Plug new.
+ wrapper respondTo:#size with:[ myByteSize ].
+ wrapper respondTo:#at: with:[:byteIdx | self byteAt:byteIdx ].
+ wrapper respondTo:#do: with:[:aBlock | 1 to:myByteSize
+ do:[:i |
+ aBlock value:(self byteAt:i)
+ ].
+ ].
+
+ baseAddress := 0.
+ genDump := [
+ |dump|
+
+ v topView withWaitCursorDo:[
+ dump := AbstractFileBrowser
+ contentsOfBytesAsHexDump:wrapper
+ numberOfAddressDigits:(myByteSize hexPrintString size)
+ addressStart:baseAddress.
+ v list:dump expandTabs:false scanForNonStrings:false includesNonStrings:false.
+ ].
+ ].
+
+ v := ScrollableView for:TextView.
+ genDump value.
+
+ v scrolledView
+ menuHolder:
+ [
+ |m|
+
+ m := v scrolledView editMenu.
+ m addLabel:'-' selector:nil.
+ m addLabel:'Change Base Address...' selector:#changeBase.
+ m actionAt:#changeBase
+ put:[
+ |s b|
+
+ s := Dialog request:'Base address (hex):' initialAnswer:(baseAddress printStringRadix:16).
+ s notEmptyOrNil ifTrue:[
+ b := Integer readFrom:s radix:16 onError:nil.
+ b notNil ifTrue:[
+ baseAddress := b. genDump value
+ ].
+ ].
+ ].
+ m.
+ ];
+ menuMessage: #value.
+
+ ^ Tools::Inspector2Tab new
+ priority: 40;
+ label:'Hexdump';
+ view: v;
+ yourself
+
+ "Created: / 13-02-2012 / 15:08:42 / cg"
+! !
+
!ArrayedCollection methodsFor:'printing & storing'!
storeOn:aStream
@@ -502,5 +569,5 @@
!ArrayedCollection class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ArrayedCollection.st,v 1.60 2012-02-15 14:16:01 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ArrayedCollection.st,v 1.61 2012-03-08 20:26:34 cg Exp $'
! !