--- a/InspectorView.st Mon Feb 13 18:52:36 2012 +0000
+++ b/InspectorView.st Mon Feb 13 19:19:58 2012 +0000
@@ -19,7 +19,7 @@
suppressPseudoSlots dereferenceValueHolders suppressHeadline
headLineLabel'
classVariableNames:'DefaultIcon IdDictionary NextSequentialID LastExtent
- DefaultIntegerDisplayRadix'
+ DefaultIntegerDisplayRadix ExpandArraysInAllLists'
poolDictionaries:''
category:'Interface-Inspector'
!
@@ -307,6 +307,12 @@
"Modified: / 17-09-2007 / 11:36:17 / cg"
!
+defaultIntegerDisplayRadix
+ ^ DefaultIntegerDisplayRadix ? 10
+
+ "Created: / 10-02-2012 / 19:51:38 / cg"
+!
+
defaultTopViewExtent
|def|
@@ -316,6 +322,22 @@
"Created: / 23-10-2007 / 19:04:13 / cg"
!
+expandArraysInAllLists
+ "in the 'all instvars' list, expand arrays"
+
+ ^ ExpandArraysInAllLists ? false
+
+ "Created: / 30-01-2012 / 16:52:57 / cg"
+!
+
+expandArraysInAllLists:aBoolean
+ "in the 'all instvars' list, expand arrays"
+
+ ExpandArraysInAllLists := aBoolean
+
+ "Created: / 30-01-2012 / 16:53:01 / cg"
+!
+
rememberLastExtent:anExtent
LastExtent := anExtent
@@ -1490,6 +1512,227 @@
"Modified: / 6.2.2000 / 13:47:37 / cg"
! !
+!InspectorView methodsFor:'presentation'!
+
+appendDisplayStringForElementsOf:val indent:lvl pad:padding to:aStream
+ val doWithIndex:[:el :idx |
+ |elValString|
+
+ aStream spaces:lvl.
+ aStream nextPutAll:(' ' paddedTo:padding with:$.).
+ aStream nextPutAll:(' [',(idx printString leftPaddedTo:2),']').
+ aStream nextPutAll:' : '.
+ elValString := self basicDisplayStringForValue:el.
+ aStream nextPutAll:elValString.
+ aStream cr.
+ "/ s nextPutAll:(self stringWithAllInstVarValuesFor:el level:lvl+4)
+ ].
+
+ "Created: / 12-02-2012 / 09:55:53 / cg"
+!
+
+basicDisplayStringForValue:someValue
+ "return the value's displayString to be pasted into the workspace."
+
+ |s|
+
+ Error handle:[:ex |
+ s := someValue classNameWithArticle.
+ displayStringMessage == #displayString ifTrue:[
+ s := s , ' "error in displayString: ' , ex description , '"'
+ ] ifFalse:[
+ s := s , ' "error in displayString (' , displayStringMessage , '): ' , ex description , '"'
+ ].
+ ^ s
+ ] do:[
+ integerDisplayRadix ~= 10 ifTrue:[
+ "/ not everything can be shown in HEX/Binary
+
+ someValue isInteger ifTrue:[
+ ^ someValue radixPrintStringRadix:integerDisplayRadix
+ ].
+ (someValue isMemberOf:ByteArray) ifTrue:[
+ s := WriteStream on:(String new:10).
+ s writeLimit:100000.
+ someValue printOn:s base:integerDisplayRadix showRadix:true.
+ ^ s contents
+ ]
+ ].
+
+ "/ displayStringMessage := #classNameWithArticle
+ "/ displayStringMessage := #displayString
+ "/ displayStringMessage := #printString
+
+ s := CharacterWriteStream on:(String new:10).
+ s writeLimit:100000.
+
+ someValue isLazyValue ifTrue:[
+ s nextPutAll:someValue class nameWithArticle
+ ] ifFalse:[
+ "/ mhmh - avoid sending #perform: (bad for proxy objects which pass it to somewhere..)
+ displayStringMessage == #displayString ifTrue:[
+ someValue displayOn:s.
+ "/ s := someValue displayString.
+ ] ifFalse:[
+ displayStringMessage == #printString ifTrue:[
+ someValue printOn:s.
+ "/ s := someValue printString.
+ ] ifFalse:[
+ displayStringMessage == #storeString ifTrue:[
+ someValue storeOn:s.
+ "/ s := someValue storeString.
+ ] ifFalse:[
+ ^ someValue perform:displayStringMessage.
+ ].
+ ].
+ ].
+ ].
+ ^ s contents
+ ].
+
+ "Modified: / 24-08-2010 / 17:29:08 / cg"
+!
+
+displayStringForValue:someValue
+ "return the value's displayString to be pasted into the workspace."
+
+ |idx sel extraAttributes|
+
+ idx := self theSingleSelectionIndex.
+ idx notNil ifTrue:[
+ sel := listView at:idx.
+
+ extraAttributes := object inspectorExtraAttributes.
+ (extraAttributes notNil and:[extraAttributes includesKey:sel]) ifTrue:[
+ ^ someValue "(extraAttributes at:sel) value" printString
+ ].
+
+ (sel startsWith:'-all inst vars') ifTrue:[
+ ^ self stringWithAllInstVarValues
+ ].
+ (sel startsWith:'-all indexed vars') ifTrue:[
+ ^ self stringWithAllIndexedVarValues
+ ].
+ (sel startsWith:'-all messages') ifTrue:[
+ ^ self stringWithMessages:#all
+ ].
+ (sel startsWith:'-local messages') ifTrue:[
+ ^ self stringWithMessages:#local
+ ].
+ (sel startsWith:'-inherited messages') ifTrue:[
+ ^ self stringWithMessages:#inherited
+ ].
+ ].
+ ^ self basicDisplayStringForValue:someValue
+
+ "Modified: / 17-11-2010 / 19:20:47 / cg"
+!
+
+stringWithAllIndexedVarValues
+ |nIdx s names maxLen varString padLeft|
+
+ nIdx := object size.
+
+ s := CharacterWriteStream on:''.
+ names := self indexList.
+ names size > 0 ifTrue:[
+ maxLen := (names collect:[:eachName | eachName printString size]) max.
+ padLeft := names conform:[:eachIdx | eachIdx isInteger].
+
+ names do:[:eachIdx |
+ |val|
+
+ padLeft ifTrue:[
+ s nextPutAll:(eachIdx printStringLeftPaddedTo:maxLen).
+ ] ifFalse:[
+ s nextPutAll:((eachIdx printString , ' ') paddedTo:maxLen+1 with:$.).
+ ].
+ s nextPutAll:' : '.
+
+ val := self indexedValueAtKey:eachIdx.
+
+ ((ExpandArraysInAllLists == true) and:[val isSequenceable and:[ val class isPointers]]) ifTrue:[
+ s cr.
+ self appendDisplayStringForElementsOf:val indent:2 pad:maxLen+1+1 to:s.
+ ] ifFalse:[
+ varString := self basicDisplayStringForValue:val.
+ (varString includes:Character cr) ifTrue:[
+ varString := varString copyTo:(varString indexOf:Character cr)-1.
+ varString := varString , '...'.
+ ].
+ s nextPutLine:varString.
+ ].
+ ].
+ ].
+ nShown < nIdx ifTrue:[
+ s nextPutLine:' ...'.
+ ].
+ ^ s contents
+
+ "Modified: / 12-02-2012 / 10:52:04 / cg"
+!
+
+stringWithAllInstVarValues
+ ^ self stringWithAllInstVarValuesFor:object level:0
+
+ "Modified: / 31-01-2012 / 18:23:11 / cg"
+!
+
+stringWithAllInstVarValuesFor:anObject level:lvl
+ |s names maxLen|
+
+ s := CharacterWriteStream on:''.
+ names := anObject class allInstVarNames.
+ maxLen := (names collect:[:eachName | eachName size]) max.
+ names keysAndValuesDo:[:eachInstVarIndex :eachInstVarName |
+ |val valString|
+
+ val := anObject instVarAt:eachInstVarIndex.
+
+ s spaces:lvl.
+ s nextPutAll:((eachInstVarName , ' ') paddedTo:maxLen+1 with:$.).
+ s nextPutAll:' : '.
+
+ ((ExpandArraysInAllLists == true) and:[val isSequenceable and:[ val class isPointers] ]) ifTrue:[
+ s cr.
+ self appendDisplayStringForElementsOf:val indent:lvl pad:maxLen+1+1 to:s.
+ ] ifFalse:[
+ valString := self basicDisplayStringForValue:val.
+ (valString includes:Character cr) ifTrue:[
+ valString := valString copyTo:(valString indexOf:Character cr)-1.
+ valString := valString , '...'.
+ ].
+ s nextPutAll:valString.
+ s cr.
+ ].
+ ].
+ ^ s contents
+
+ "Created: / 31-01-2012 / 18:23:15 / cg"
+!
+
+stringWithMessages:which
+ |cls s messages |
+
+ s := CharacterWriteStream on:''.
+ cls := object class.
+ which == #local ifTrue:[
+ messages := cls selectors.
+ ] ifFalse:[
+ which == #all ifTrue:[
+ messages := cls allSelectors.
+ ] ifFalse:[
+ messages := cls allSelectors copy asSet removeAll:cls selectors; yourself.
+ ].
+ ].
+
+ messages asOrderedCollection sort do:[:eachSelector |
+ s nextPutAll:eachSelector.
+ s cr.
+ ].
+ ^ s contents
+! !
+
!InspectorView methodsFor:'private'!
baseInspectedObjectClass
@@ -2017,85 +2260,6 @@
"Modified: / 26.8.1998 / 19:05:25 / cg"
!
-stringWithAllIndexedVarValues
- |nIdx s names maxLen varString padLeft|
-
- nIdx := object size.
-
- s := CharacterWriteStream on:''.
- names := self indexList.
- names size > 0 ifTrue:[
- maxLen := (names collect:[:eachName | eachName printString size]) max.
- padLeft := names conform:[:eachIdx | eachIdx isInteger].
-
- names do:[:eachIdx |
- |val|
-
- padLeft ifTrue:[
- s nextPutAll:(eachIdx printStringLeftPaddedTo:maxLen).
- ] ifFalse:[
- s nextPutAll:((eachIdx printString , ' ') paddedTo:maxLen+1 with:$.).
- ].
-
- s nextPutAll:' : '.
- val := self indexedValueAtKey:eachIdx.
-
- varString := self basicDisplayStringForValue:val.
- (varString includes:Character cr) ifTrue:[
- varString := varString copyTo:(varString indexOf:Character cr)-1.
- varString := varString , '...'.
- ].
- s nextPutLine:varString.
- ].
- ].
- nShown < nIdx ifTrue:[
- s nextPutLine:' ...'.
- ].
- ^ s contents
-!
-
-stringWithAllInstVarValues
- |s names maxLen varString|
-
- s := CharacterWriteStream on:''.
- names := object class allInstVarNames.
- maxLen := (names collect:[:eachName | eachName size]) max.
- names keysAndValuesDo:[:eachInstVarIndex :eachInstVarName |
- s nextPutAll:((eachInstVarName , ' ') paddedTo:maxLen+1 with:$.).
- s nextPutAll:' : '.
- varString := self basicDisplayStringForValue:(object instVarAt:eachInstVarIndex).
- (varString includes:Character cr) ifTrue:[
- varString := varString copyTo:(varString indexOf:Character cr)-1.
- varString := varString , '...'.
- ].
- s nextPutAll:varString.
- s cr.
- ].
- ^ s contents
-!
-
-stringWithMessages:which
- |cls s messages |
-
- s := CharacterWriteStream on:''.
- cls := object class.
- which == #local ifTrue:[
- messages := cls selectors.
- ] ifFalse:[
- which == #all ifTrue:[
- messages := cls allSelectors.
- ] ifFalse:[
- messages := cls allSelectors copy asSet removeAll:cls selectors; yourself.
- ].
- ].
-
- messages asOrderedCollection sort do:[:eachSelector |
- s nextPutAll:eachSelector.
- s cr.
- ].
- ^ s contents
-!
-
theSingleSelectionIndex
"helper - return the index of the (single) selected entry.
Nil if nothing or multiple items are selected"
@@ -2311,103 +2475,6 @@
!InspectorView methodsFor:'selection'!
-basicDisplayStringForValue:someValue
- "return the value's displayString to be pasted into the workspace."
-
- |s|
-
- Error handle:[:ex |
- s := someValue classNameWithArticle.
- displayStringMessage == #displayString ifTrue:[
- s := s , ' "error in displayString: ' , ex description , '"'
- ] ifFalse:[
- s := s , ' "error in displayString (' , displayStringMessage , '): ' , ex description , '"'
- ].
- ^ s
- ] do:[
- integerDisplayRadix ~= 10 ifTrue:[
- "/ not everything can be shown in HEX/Binary
-
- someValue isInteger ifTrue:[
- ^ someValue radixPrintStringRadix:integerDisplayRadix
- ].
- (someValue isMemberOf:ByteArray) ifTrue:[
- s := WriteStream on:(String new:10).
- s writeLimit:100000.
- someValue printOn:s base:integerDisplayRadix showRadix:true.
- ^ s contents
- ]
- ].
-
- "/ displayStringMessage := #classNameWithArticle
- "/ displayStringMessage := #displayString
- "/ displayStringMessage := #printString
-
- s := CharacterWriteStream on:(String new:10).
- s writeLimit:100000.
-
- someValue isLazyValue ifTrue:[
- s nextPutAll:someValue class nameWithArticle
- ] ifFalse:[
- "/ mhmh - avoid sending #perform: (bad for proxy objects which pass it to somewhere..)
- displayStringMessage == #displayString ifTrue:[
- someValue displayOn:s.
- "/ s := someValue displayString.
- ] ifFalse:[
- displayStringMessage == #printString ifTrue:[
- someValue printOn:s.
- "/ s := someValue printString.
- ] ifFalse:[
- displayStringMessage == #storeString ifTrue:[
- someValue storeOn:s.
- "/ s := someValue storeString.
- ] ifFalse:[
- ^ someValue perform:displayStringMessage.
- ].
- ].
- ].
- ].
- ^ s contents
- ].
-
- "Modified: / 24-08-2010 / 17:29:08 / cg"
-!
-
-displayStringForValue:someValue
- "return the value's displayString to be pasted into the workspace."
-
- |idx sel extraAttributes|
-
- idx := self theSingleSelectionIndex.
- idx notNil ifTrue:[
- sel := listView at:idx.
-
- extraAttributes := object inspectorExtraAttributes.
- (extraAttributes notNil and:[extraAttributes includesKey:sel]) ifTrue:[
- ^ someValue "(extraAttributes at:sel) value" printString
- ].
-
- (sel startsWith:'-all inst vars') ifTrue:[
- ^ self stringWithAllInstVarValues
- ].
- (sel startsWith:'-all indexed vars') ifTrue:[
- ^ self stringWithAllIndexedVarValues
- ].
- (sel startsWith:'-all messages') ifTrue:[
- ^ self stringWithMessages:#all
- ].
- (sel startsWith:'-local messages') ifTrue:[
- ^ self stringWithMessages:#local
- ].
- (sel startsWith:'-inherited messages') ifTrue:[
- ^ self stringWithMessages:#inherited
- ].
- ].
- ^ self basicDisplayStringForValue:someValue
-
- "Modified: / 17-11-2010 / 19:20:47 / cg"
-!
-
selection:lineNr
self showSelection:lineNr
!
@@ -2638,13 +2705,14 @@
!InspectorView class methodsFor:'documentation'!
version
- ^ '$Id: InspectorView.st 7854 2012-01-30 17:49:41Z vranyj1 $'
+ ^ '$Header: /cvs/stx/stx/libtool/InspectorView.st,v 1.247 2012/02/12 09:54:31 cg Exp $'
!
version_CVS
- ^ '§Header: /cvs/stx/stx/libtool/InspectorView.st,v 1.240 2011/11/14 11:58:18 cg Exp §'
+ ^ 'Header: /cvs/stx/stx/libtool/InspectorView.st,v 1.247 2012/02/12 09:54:31 cg Exp '
!
version_SVN
- ^ '$Id: InspectorView.st 7854 2012-01-30 17:49:41Z vranyj1 $'
+ ^ '$Id: InspectorView.st 7887 2012-02-13 19:19:58Z vranyj1 $'
! !
+