'From Squeakland 3.8.5976 of 10 August 2004 [latest update: #229] on 12 August 2004 at 2:30:13 am'! "Change Set: watcherFixes-sw Date: 12 August 2004 Author: Scott Wallace Fixes the launching of watcher items, which temporarily got broken during a recent integration."! !Player methodsFor: 'slots-user' stamp: 'sw 8/12/2004 02:27'! tearOffFancyWatcherFor: aGetter "Hand the user a labeled readout for viewing a numeric value" | aWatcher aTile aLine aColor aTower ms slotMsg info isNumeric anInterface watcherWording delta | info _ self slotInfoForGetter: aGetter. info ifNotNil: [isNumeric _ info type == #Number. watcherWording _ Utilities inherentSelectorForGetter: aGetter] ifNil: [anInterface _Vocabulary eToyVocabulary methodInterfaceAt: aGetter ifAbsent: [nil]. isNumeric _ anInterface notNil and: [anInterface resultType == #Number]. watcherWording _ anInterface wording]. aColor _ Color r: 0.387 g: 0.581 b: 1.0. aWatcher _ UpdatingStringMorph new. aWatcher growable: true; getSelector: aGetter; putSelector: (info notNil ifTrue: [ScriptingSystem setterSelectorForGetter: aGetter] ifFalse: [anInterface companionSetterSelector]). aWatcher target: self. isNumeric ifTrue: "at the moment, actually, only numeric is allowed" [aTile _ NumericReadoutTile new typeColor: aColor. self setFloatPrecisionFor: aWatcher. (delta _ self arrowDeltaFor: aGetter) ~= 1 ifTrue: [aTile setProperty: #arrowDelta toValue: delta]]. aTile addMorphBack: aWatcher. aTile addArrows. aTile setLiteralTo: (self perform: aGetter) width: 30. Preferences universalTiles ifTrue: [ ms _ MessageSend receiver: self selector: aGetter asSymbol arguments: #(). slotMsg _ ms asTilesIn: self class globalNames: (self class officialClass ~~ CardPlayer). "For CardPlayers, use 'self'. For others, name it, and use its name." ms _ MessageSend receiver: 3 selector: #= asSymbol arguments: #(5). aLine _ ms asTilesIn: self class globalNames: false. aLine firstSubmorph delete. aLine addMorphFront: slotMsg. aLine lastSubmorph delete. aLine lastSubmorph delete. aLine color: aColor. aLine addMorphBack: aTile. aLine cellPositioning: #leftCenter] ifFalse: [ aLine _ AlignmentMorph newRow hResizing: #shrinkWrap; vResizing: #shrinkWrap; color: aColor. aLine layoutInset: -1. aLine borderWidth: 1; borderColor: aColor darker. aLine addMorphBack: (self tileReferringToSelf borderWidth: 0; typeColor: aColor; color: aColor; bePossessive). aLine addTransparentSpacerOfSize: (4@0). aTower _ AlignmentMorph newColumn color: aColor. aTower addTransparentSpacerOfSize: (0 @ 1). aTower addMorphBack: (StringMorph contents: watcherWording, ' = ' font: ScriptingSystem fontForTiles). aLine addMorphBack: aTower. aLine addMorphBack: aTile]. aWatcher step; fitContents. aLine openInHand! ! !Player methodsFor: 'slots-user' stamp: 'sw 8/12/2004 02:27'! tearOffWatcherFor: aSlotGetter "Tear off a simple textual watcher for the slot whose getter is provided" | aWatcher anInterface info isNumeric | info _ self slotInfoForGetter: aSlotGetter. info ifNotNil: [isNumeric _ info type == #Number] ifNil: [anInterface _ Vocabulary eToyVocabulary methodInterfaceAt: aSlotGetter ifAbsent: [nil]. isNumeric _ anInterface notNil and: [anInterface resultType == #Number]]. aWatcher _ UpdatingStringMorph new. aWatcher growable: true; getSelector: aSlotGetter; putSelector: (info notNil ifTrue: [ScriptingSystem setterSelectorForGetter: aSlotGetter] ifFalse: [anInterface companionSetterSelector]); setNameTo: (info notNil ifTrue: [Utilities inherentSelectorForGetter: aSlotGetter] ifFalse: [anInterface wording]); target: self. isNumeric ifFalse: [aWatcher useStringFormat] ifTrue: [self setFloatPrecisionFor: aWatcher]. aWatcher step; fitContents; openInHand! !