Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1770.mcz ==================== Summary ==================== Name: Morphic-mt.1770 Author: mt Time: 11 June 2021, 7:54:44.535233 am UUID: 538ca9f9-e591-3344-a2b9-e83cd482d4c8 Ancestors: Morphic-mt.1769 Updates representation of integers in ObjectExplorer. For a small discussion, see http://forum.world.st/The-Trunk-Morphic-mt-1769-mcz-tp5129501p5129804.html Enables the use of #balloonText: for ObjectExplorerWrapper. Already used in FileDirectoryWrapper. Not available in basic ListItemWrapper. (Yet?) =============== Diff against Morphic-mt.1769 =============== Item was changed: ----- Method: Integer>>explorerContents (in category '*Morphic-Explorer') ----- explorerContents + ^ Array streamContents: [:stream | + #( + 'hex' 16 2 0 'hexadecimal, base 16' + 'oct' 8 3 0 'octal, base 8' + 'bin' 2 4 0 'binary, base 2' + 'bit' nil 4 8 'Logical bit field\- Two complement\- Infinite sign bits\- Try #bitAt:') groupsDo: [ :key :base :group :padding :balloon | | label | + label := self abs printStringBase: (base ifNil: [2]). + base ifNil: [ + label := String streamContents: [:s | + (label size roundUpTo: padding) to: 1 by: -1 do: [:index | + s nextPutAll: (self bitAt: index) asString]]]. + label := label + padded: #left + to: (label size roundUpTo: group) + padding + with: ((base isNil and: [self negative]) ifTrue: [$1] ifFalse: [$0]). - ^#( - ('hexadecimal' 16 2) - ('octal' 8 3) - ('binary' 2 4)) collect: [ :each | | label group | - group := each third. - label := self abs printStringBase: each second. - label := label padded: #left to: (label size roundUpTo: group) with: $0. label := String streamContents: [:s | + (self negative and: [base notNil]) ifTrue: [s nextPutAll: '-']. + base ifNil: [s nextPutAll: '... ']. + (1 to: label size by: group) + do: [:index | + 1 to: group do: [:gIndex | + s nextPut: (label at: index + gIndex - 1)]] + separatedBy: [s space]]. + stream nextPut: (( + ObjectExplorerWrapper + with: label + name: key + model: self) + balloonText: balloon withCRs; + yourself) ]]! - self negative ifTrue: [s nextPutAll: '- ']. - (1 to: label size by: group) - do: [:index | - 1 to: group do: [:gIndex | - s nextPut: (label at: index + gIndex - 1)]] - separatedBy: [s space]]. - - ObjectExplorerWrapper - with: label - name: each first translated - model: self ]! Item was changed: ListItemWrapper subclass: #ObjectExplorerWrapper + instanceVariableNames: 'itemName parent balloonText' - instanceVariableNames: 'itemName parent' classVariableNames: 'ShowContentsInColumns' poolDictionaries: '' category: 'Morphic-Explorer'! !ObjectExplorerWrapper commentStamp: 'pre 5/15/2017 21:23' prior: 0! ObjectExplorerWrappers represent an item displayed in an object explorer tree. In addition to the common ListItemWrapper behavior it adds methods to refresh the list entry with updated values from the model. It is mostly used in #explorerContents methods to describe which instance variables of an object should be displayed in the explorer. Additionally, the value displayed can be visualized with a small icon which is defined by the class of the value object through the method #iconOrThumbnailOfSize:. Contributed by Bob Arning as part of the ObjectExplorer package. ! Item was added: + ----- Method: ObjectExplorerWrapper>>balloonText (in category 'accessing') ----- + balloonText + + ^ balloonText! Item was added: + ----- Method: ObjectExplorerWrapper>>balloonText: (in category 'accessing') ----- + balloonText: stringOrNil + + balloonText := stringOrNil.! |
|
In reply to this post by commits-2
> Updates representation of integers in ObjectExplorer. For a small discussion, see http://forum.world.st/The-Trunk-Morphic-mt-1769-mcz-tp5129501p5129804.html
I'm a bit late to the party, but may I suggest to make the whole integer representation in ObjectExplorer a preference? Rationale: when peeking at an ObjectExplorer tree, one gets a first idea of the structure of an object. Having a subtree for each Integer gives the wrong feeling, that there is some extra structure there, while it is only some extra information about the same very simple object. So there is an obfuscation inherent to having the explorer represent in the very same way two different categories of information: one about structure, and one about representation. This goes for strings too, although in the opposite way: if you explore 'abc', you will not get any information on $a, $b or $c from there (like their ASCII code, for example) - this times the explorer hides structure. I am not sure about my suggestion for a preference, so let me restate the problem as I see it as follows: Why is an ObjectExplorer telling you all these things about 3 and nothing at all about 'three'? Stef |
Hi Stéphane. > Why is an ObjectExplorer telling you all these things about 3 and > nothing at all about 'three'?I have no clue. :-) I am in favor of configuring the ObjectExplorer in a more consistent way, maybe through a preference. One could as well interpret an integer as a character and vice versa. 'three' |-- $t |-- 116 |-- hex : '74' |-- oct ... |-- ... |-- $h |-- $r |-- $e |-- $e But this would never stop because '74' is a string again. :-D Expanding 'three' to its elements is also kind of different form showing various representations for integers. Hmm... a simple step forward could be: [ ] Show string elements in object explorer [x] Show integer representations in object explorer [ ] Show character representations in object explorer The [x][ ] mark the default preference value. Best, Marcel
|
Free forum by Nabble | Edit this page |