AbstractFileBrowser.st
branchjv
changeset 12205 f210b6224ef0
parent 12158 54259ef3a49d
child 12217 2c68d7169f97
--- a/AbstractFileBrowser.st	Wed Mar 21 14:05:42 2012 +0000
+++ b/AbstractFileBrowser.st	Wed Mar 21 17:50:14 2012 +0000
@@ -1056,7 +1056,7 @@
        (SpecCollection
           collection: (
            (LabelSpec
-              label: 'Select the Line-End Convention:'
+              label: 'Select the Line-End Convention (used when saving files):'
               name: 'Label1'
               layout: (LayoutFrame 0 0 0 0 0 1 30 0)
               translateLabel: true
@@ -1155,6 +1155,8 @@
          
         )
       )
+
+    "Modified: / 28-02-2012 / 11:12:03 / cg"
 !
 
 tabStopConversionDialogSpec
@@ -1185,7 +1187,7 @@
        (SpecCollection
           collection: (
            (LabelSpec
-              label: 'Select the Tab-Stop Conversion:'
+              label: 'Select the Tab-Stop Conversion (used when saving files):'
               name: 'Label1'
               layout: (LayoutFrame 0 0 0 0 0 1 30 0)
               translateLabel: true
@@ -1257,6 +1259,8 @@
          
         )
       )
+
+    "Modified: / 28-02-2012 / 11:12:38 / cg"
 ! !
 
 !AbstractFileBrowser class methodsFor:'menu specs'!
@@ -1644,6 +1648,7 @@
             label: 'Settings...'
             itemValue: doOpenSettings
             translateLabel: true
+            labelImage: (ResourceRetriever ToolbarIconLibrary settings16x16Icon 'Settings...')
           )
          )
         nil
@@ -2190,6 +2195,7 @@
     "Do not manually edit this!! If it is corrupted,
      the MenuEditor may not be able to read the specification."
 
+
     "
      MenuEditor new openOnClass:AbstractFileBrowser andSelector:#toolsMenuSpec
      (Menu new fromLiteralArrayEncoding:(AbstractFileBrowser toolsMenuSpec)) startUp
@@ -2229,6 +2235,7 @@
             itemValue: openTerminal
             translateLabel: true
             isVisible: canDoTerminalAndSystemIsUnix
+            labelImage: (ResourceRetriever ToolbarIconLibrary terminal16x16Icon 'Shell Terminal')
           )
          (MenuItem
             enabled: canDoTerminal
@@ -2236,6 +2243,7 @@
             itemValue: openTerminal
             translateLabel: true
             isVisible: canDoTerminalAndSystemIsDOS
+            labelImage: (ResourceRetriever ToolbarIconLibrary terminal16x16Icon 'DOS Terminal')
           )
          (MenuItem
             label: '-'
@@ -2554,8 +2562,6 @@
         nil
         nil
       )
-
-    "Modified: / 11-07-2011 / 14:28:09 / cg"
 !
 
 viewDetailsMenuSpec
@@ -2783,49 +2789,99 @@
 contentsOfBytesAsHexDump:data numberOfAddressDigits:addrDigits addressStart:virtualStart
     "utility helper: generate a hexDump with addresses"
 
-    |offs 
-     col line lineStream asciiLineStream lines|
-
-    col := 1.
-    offs := virtualStart.
-    lines := StringCollection new.
-
-    lineStream := String writeStream.
-    asciiLineStream := String writeStream.
-
-    lineStream nextPutAll:(offs hexPrintString:addrDigits).
-    lineStream nextPutAll:': '.
-
-    data do:[:byte |
-        lineStream nextPutAll:(byte hexPrintString:2).
-        (byte between:32 and:127) ifTrue:[
-            asciiLineStream nextPut:(Character value:byte)
-        ] ifFalse:[
-            asciiLineStream nextPut:$.
-        ].
-
-        offs := offs + 1.
-        col := col + 1.
-        col > 16 ifTrue:[
-            lineStream nextPutAll:'        '.
-            lineStream nextPutAll:asciiLineStream contents.
-            lines add:(lineStream contents).
-            (offs bitAnd:16rFF) == 0 ifTrue:[
-                lines add:nil
+    |lines nHexLines|
+
+    "generate a virtual collection which evaluates and returns lines on-demand"
+
+    nHexLines := (data size + 15) // 16.
+
+    lines := VirtualArray new.
+    lines setSize:nHexLines + (nHexLines // 16).
+    lines 
+        generator:[:lineNr |
+            |blockNr lineNrInBlock startOffset lineStream asciiLineStream byte line|
+
+            blockNr := (lineNr - 1) // 17.
+            lineNrInBlock := (lineNr - 1) \\ 17.
+
+            lineNrInBlock == 16 ifTrue:[
+                line := ''
+            ] ifFalse:[
+                startOffset := ((blockNr * 16) + lineNrInBlock) * 16.
+                lineStream := String writeStream.
+                asciiLineStream := String writeStream.
+
+                lineStream nextPutAll:((startOffset+virtualStart) hexPrintString:addrDigits).
+                lineStream nextPutAll:': '.
+                1 to:16 do:[:i |
+                    i ~~ 1 ifTrue:[ lineStream space ].
+
+                    (startOffset + i) > data size ifTrue:[
+                        asciiLineStream nextPut:(Character space).
+                        lineStream nextPutAll:'  '.
+                    ] ifFalse:[
+                        byte := data at:startOffset + i.
+
+                        lineStream nextPutAll:(byte hexPrintString:2).
+                        
+                        (byte between:32 and:127) ifTrue:[
+                            asciiLineStream nextPut:(Character value:byte)
+                        ] ifFalse:[
+                            asciiLineStream nextPut:$.
+                        ].
+                    ].
+                ].
+                line := (lineStream contents paddedTo:(3*16 + addrDigits + 1))
+                        , '        ' 
+                        , asciiLineStream contents.
             ].
-            lineStream reset.
-            asciiLineStream reset.
-
-            lineStream nextPutAll:(offs hexPrintString:addrDigits).
-            lineStream nextPutAll:': '.
-            col := 1.
-        ] ifFalse:[
-            lineStream space
-        ]
-    ].
-    line := lineStream contents paddedTo:(3*16 + addrDigits + 1).
-    lines add:(line , '        ' , asciiLineStream contents).
-    ^ lines
+            line
+        ].
+    ^ lines.
+
+"/    |offs 
+"/     col line lineStream asciiLineStream lines|
+"/
+"/    col := 1.
+"/    offs := virtualStart.
+"/    lines := StringCollection new.
+"/
+"/    lineStream := String writeStream.
+"/    asciiLineStream := String writeStream.
+"/
+"/    lineStream nextPutAll:(offs hexPrintString:addrDigits).
+"/    lineStream nextPutAll:': '.
+"/
+"/    data do:[:byte |
+"/        lineStream nextPutAll:(byte hexPrintString:2).
+"/        (byte between:32 and:127) ifTrue:[
+"/            asciiLineStream nextPut:(Character value:byte)
+"/        ] ifFalse:[
+"/            asciiLineStream nextPut:$.
+"/        ].
+"/
+"/        offs := offs + 1.
+"/        col := col + 1.
+"/        col > 16 ifTrue:[
+"/            lineStream nextPutAll:'        '.
+"/            lineStream nextPutAll:asciiLineStream contents.
+"/            lines add:(lineStream contents).
+"/            (offs bitAnd:16rFF) == 0 ifTrue:[
+"/                lines add:nil
+"/            ].
+"/            lineStream reset.
+"/            asciiLineStream reset.
+"/
+"/            lineStream nextPutAll:(offs hexPrintString:addrDigits).
+"/            lineStream nextPutAll:': '.
+"/            col := 1.
+"/        ] ifFalse:[
+"/            lineStream space
+"/        ]
+"/    ].
+"/    line := lineStream contents paddedTo:(3*16 + addrDigits + 1).
+"/    lines add:(line , '        ' , asciiLineStream contents).
+"/    ^ lines
 
     "Created: / 13-02-2012 / 15:01:46 / cg"
 !
@@ -9153,14 +9209,13 @@
 !AbstractFileBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.490 2012/02/13 14:02:29 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.492 2012/02/28 10:16:29 cg Exp $'
 !
 
 version_CVS
-    ^ 'Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.490 2012/02/13 14:02:29 cg Exp '
+    ^ '§Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.492 2012/02/28 10:16:29 cg Exp §'
 !
 
 version_SVN
-    ^ '$Id: AbstractFileBrowser.st 7887 2012-02-13 19:19:58Z vranyj1 $'
+    ^ '$Id: AbstractFileBrowser.st 7952 2012-03-21 17:50:14Z vranyj1 $'
 ! !
-