'From Squeak3.5 of ''11 April 2003'' [latest update: #5180] on 27 April 2003 at 6:13:08 pm'! "Change Set: editTxtColors-sbw Date: 17 September 2002 Author: Stephan B. Wessels SM Name: Edit Text Colors This change set provides a new editor allowing the easy modification of #colorPrint values. If you turn on the Browsing preferences of browseWithPrettyPrint colorWhenPrettyPrinting you can see these colors and attributes in action on code panes. To open the editor perform: DialectStreamAttributesEditor open With Squeak 3.5 this tool registers with the appearance registry and consequently appears in the appearance menu. Date Update ------------- ----------------------------------------------------------------------- 20-apr-2003 Added prerequisite change set checking to preamble. 15-apr-2003 update for Squeak 3.5 22-nov-2002 Modified to work with Squeak 3.4. 17-sep-2002 initial file release. " | prereqSMName continue cs prereqCSName prereqRevDateRqd | prereqCSName _ 'AppearanceMenuReg-sbw'. prereqSMName _ 'Appearance Menu Registry'. prereqRevDateRqd _ '15-apr-2003' asDate. continue _ (ChangeSorter respondsTo: #assurePrerequisiteChangeSetNamed:withSqueakMapName:revisionDate:) ifTrue: [ChangeSorter assurePrerequisiteChangeSetNamed: prereqCSName withSqueakMapName: prereqSMName revisionDate: prereqRevDateRqd] ifFalse: [cs _ ChangeSorter changeSetNamed: prereqCSName. cs isNil ifTrue: [(Object confirm: 'The package "' , prereqSMName , '" is not installed in your image. Do you want me to install it for you?. Please note that "' , prereqSMName , '" is required for the package you are about to install.') and: []. (Smalltalk at: #SMSqueakMap ifAbsent: []) ifNil: [Object error: 'You don''t have installed Squeakmap in your image']. Utilities informUser: 'Installing "' , prereqSMName , '"...' during: [(Smalltalk at: #SMSqueakMap) default installPackageNamed: prereqSMName]. true] ifFalse: [true]]. continue ifFalse: [Object error: 'Unable to load prerequisite package.']. ! SystemWindow subclass: #DialectStreamAttributesEditor instanceVariableNames: 'dictionary codeMorph ' classVariableNames: '' poolDictionaries: '' category: 'System-Support'! Model subclass: #EmphasisModel instanceVariableNames: 'key emphasis color ' classVariableNames: '' poolDictionaries: '' category: 'System-Support'! ThreePhaseButtonMorph subclass: #ToggleButtonMorph instanceVariableNames: 'stateSelector ' classVariableNames: '' poolDictionaries: '' category: 'Morphic-Widgets'! !Object methodsFor: 'testing' stamp: 'sbw 9/15/2002 18:54'! isTextEmphasis ^ false! ! !DialectStream methodsFor: 'color/style' stamp: 'sbw 9/15/2002 18:56'! withColor: colorSymbol emphasis: emphasisSymbol do: aBlock "Evaluate the given block with the given color and style text attribute" "New handling to intercept. If the is a symbol we process as before. Otherwise it may be a pre-formed TextEmphasis. Also, the may be an actual Color. - sbw" ^ self withAttributes: (Array with: (TextColor color: (colorSymbol isColor ifTrue: [colorSymbol] ifFalse: [Color perform: colorSymbol])) with: (emphasisSymbol isTextEmphasis ifTrue: [emphasisSymbol] ifFalse: [TextEmphasis perform: emphasisSymbol])) do: aBlock! ! !DialectStream class methodsFor: 'class initialization' stamp: 'sbw 9/15/2002 18:15'! st80ColorTable ^ST80ColorTable! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 21:51'! blockArgumentBold ^ self stateBoldFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 21:57'! blockArgumentItalic ^ self stateItalicFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 22:13'! blockArgumentUnderlined ^ self stateUnderlinedFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 21:51'! commentBold ^ self stateBoldFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 21:57'! commentItalic ^ self stateItalicFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 22:13'! commentUnderlined ^ self stateUnderlinedFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 21:51'! keywordBold ^ self stateBoldFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 21:57'! keywordItalic ^ self stateItalicFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 22:14'! keywordUnderlined ^ self stateUnderlinedFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 21:51'! literalBold ^ self stateBoldFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 21:57'! literalItalic ^ self stateItalicFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 22:14'! literalUnderlined ^ self stateUnderlinedFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 21:52'! methodArgumentBold ^ self stateBoldFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 21:57'! methodArgumentItalic ^ self stateItalicFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 22:14'! methodArgumentUnderlined ^ self stateUnderlinedFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 21:52'! methodSelectorBold ^ self stateBoldFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 21:58'! methodSelectorItalic ^ self stateItalicFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 22:14'! methodSelectorUnderlined ^ self stateUnderlinedFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 21:52'! prefixKeywordBold ^ self stateBoldFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 21:58'! prefixKeywordItalic ^ self stateItalicFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 22:14'! prefixKeywordUnderlined ^ self stateUnderlinedFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 21:52'! setOrReturnBold ^ self stateBoldFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 21:58'! setOrReturnItalic ^ self stateItalicFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 22:14'! setOrReturnUnderlined ^ self stateUnderlinedFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 21:52'! temporaryVariableBold ^ self stateBoldFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 21:58'! temporaryVariableItalic ^ self stateItalicFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 22:14'! temporaryVariableUnderlined ^ self stateUnderlinedFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 21:52'! variableBold ^ self stateBoldFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 21:58'! variableItalic ^ self stateItalicFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'actions' stamp: 'sbw 9/15/2002 22:14'! variableUnderlined ^ self stateUnderlinedFor: thisContext method selector! ! !DialectStreamAttributesEditor methodsFor: 'code sample' stamp: 'sbw 9/16/2002 23:16'! codeContents ^ DialectStream dialect: #ST80 contents: [:strm | strm nextPutAll: self sampleCodeString]! ! !DialectStreamAttributesEditor methodsFor: 'code sample' stamp: 'sbw 9/30/2002 00:12'! sampleCodeString ^ 'addAllMethodsToCurrentChangeSet: someArgumentObject "This is an example comment." | aClass | (aClass _ self selectedClassOrMetaClass) ifNotNil: [aClass selectors do: [:sel | Smalltalk changes adoptSelector: sel forClass: aClass]. self changed: #annotation]. dictionary = ''just testing instance var'''! ! !DialectStreamAttributesEditor methodsFor: 'code sample' stamp: 'sbw 9/17/2002 18:41'! updateCodePane | newText | codeMorph isNil ifTrue: [^ nil]. newText _ self class compilerClass new format: self sampleCodeString in: self class notifying: nil decorated: true. codeMorph deselect; selectInvisiblyFrom: 1 to: self sampleCodeString size. codeMorph replaceSelectionWith: (newText asText makeSelectorBoldIn: self class). codeMorph hasUnacceptedEdits: false. codeMorph setSelection: (0 to: 0).! ! !DialectStreamAttributesEditor methodsFor: 'gui building' stamp: 'sbw 9/16/2002 21:19'! addHeaderToSelectionTable: aMorph "DialectStreamAttributesEditor open" | row stringMorph | row _ AlignmentMorph newRow beTransparent. row addTransparentSpacerOfSize: 52 @ 0. #('B' #bold 'I' #italic 'U' #underlined ) pairsDo: [:heading :emphasisSymbol | stringMorph _ StringMorph contents: heading. stringMorph emphasis: (TextEmphasis perform: emphasisSymbol) emphasisCode. row addMorphBack: stringMorph. row addTransparentSpacerOfSize: 11 @ 0]. aMorph addMorphBack: row! ! !DialectStreamAttributesEditor methodsFor: 'gui building' stamp: 'sbw 9/17/2002 18:29'! buildMorphicCodePaneWith: editString codeMorph _ PluggableTextMorph on: self text: #codeContents accept: nil readSelection: nil menu: nil. codeMorph editString: editString. codeMorph hasUnacceptedEdits: false. ^ codeMorph! ! !DialectStreamAttributesEditor methodsFor: 'gui building' stamp: 'sbw 9/30/2002 21:38'! buttonRow | aRow btn | aRow _ AlignmentMorph newRow. aRow beSticky. aRow hResizing: #spaceFill; wrapCentering: #center; cellPositioning: #rightCenter; clipSubmorphs: true; cellInset: 3. btn _ PluggableButtonMorph on: self getState: nil action: #reset. btn setBalloonText: 'click here to reset colors and text attributes back to default values.'. btn useRoundedCorners; hResizing: #spaceFill; vResizing: #spaceFill; onColor: Color transparent offColor: Color transparent; label: 'Revert to Defaults'. aRow addMorphBack: btn. ^ aRow! ! !DialectStreamAttributesEditor methodsFor: 'gui building' stamp: 'sbw 9/16/2002 21:20'! colorSwatchForSelectionTableEmphasisModel: emModel addedTo: row | swatch | swatch _ ColorSwatch new target: self; getSelector: #textColorFor:; putSelector: #setTextColorFor:to:; argument: emModel; extent: 40 @ 20; setBalloonText: 'click here to change the color'; yourself. row addTransparentSpacerOfSize: 4 @ 0. row addMorphBack: swatch. row addTransparentSpacerOfSize: 6 @ 0! ! !DialectStreamAttributesEditor methodsFor: 'gui building' stamp: 'sbw 9/16/2002 23:00'! initialExtent ^ 600 @ 400! ! !DialectStreamAttributesEditor methodsFor: 'gui building' stamp: 'sbw 9/30/2002 21:52'! morphicWindow "DialectStreamAttributesEditor open" | tableMorph buttonRow leftOffset bHeight | leftOffset _ 240. bHeight _ 40. self setLabel: self windowLabel. self model: EmphasisModel useST80ColorTable. Cursor execute showWhile: [tableMorph _ self selectionTable]. self addMorph: tableMorph fullFrame: (LayoutFrame fractions: (0 @ 0 corner: 0 @ 1) offsets: (10 @ 10 corner: leftOffset @ bHeight negated)). buttonRow _ self buttonRow. self addMorph: buttonRow fullFrame: (LayoutFrame fractions: (0 @ 1 corner: 0 @ 1) offsets: (10 @ bHeight negated corner: leftOffset @ 10 negated)). self buildMorphicCodePaneWith: self sampleCodeString. self addMorph: codeMorph fullFrame: (LayoutFrame fractions: (0 @ 0 corner: 1 @ 1) offsets: (leftOffset + 10 @ 10 corner: 10 negated @ 10 negated)). tableMorph color: Color white. buttonRow color: Color white. Preferences alternativeWindowLook ifTrue: [buttonRow submorphsDo: [:m | m borderWidth: 2; color: Color white darker; borderColor: #raised]]. codeMorph color: Color white. self fillWithRamp: self paneColorRamp oriented: 1. self updateCodePane! ! !DialectStreamAttributesEditor methodsFor: 'gui building' stamp: 'sbw 9/15/2002 19:38'! openAsMorph "DialectStreamAttributesEditor open" ^ self morphicWindow openInWorld! ! !DialectStreamAttributesEditor methodsFor: 'gui building' stamp: 'sbw 9/17/2002 18:44'! optionsAndTagsForSelectionTableEmphasisModel: emModel addedTo: row | keyString stringMorph checkBox | keyString _ emModel key asString. stringMorph _ StringMorph contents: keyString. #(#bold #italic #underlined ) do: [:emOption | checkBox _ ToggleButtonMorph checkBox. checkBox target: self. checkBox actionSelector: #checkSelected:kind:. checkBox arguments: (Array with: emModel key with: emOption). checkBox stateSelector: (keyString , emOption capitalized) asSymbol. checkBox setInitialState. checkBox setBalloonText: 'click here to change the ', emOption asString, ' attribute.'. row addMorphBack: checkBox. row addTransparentSpacerOfSize: 4 @ 0]. row addTransparentSpacerOfSize: 4 @ 0. row addMorphBack: stringMorph! ! !DialectStreamAttributesEditor methodsFor: 'gui building' stamp: 'sbw 9/16/2002 23:08'! paneColorRamp "DialectStreamAttributesEditor open" ^ {0.0 -> Color paleTan muchDarker. 1.0 -> (Color white darker alpha: 0.8)}! ! !DialectStreamAttributesEditor methodsFor: 'gui building' stamp: 'sbw 9/16/2002 19:41'! selectionTable | column row | column _ AlignmentMorph newColumn beTransparent. self addHeaderToSelectionTable: column. self model do: [:emModel | row _ AlignmentMorph newRow beTransparent. self colorSwatchForSelectionTableEmphasisModel: emModel addedTo: row. self optionsAndTagsForSelectionTableEmphasisModel: emModel addedTo: row. column addMorphBack: row]. ^ column! ! !DialectStreamAttributesEditor methodsFor: 'gui building' stamp: 'sbw 9/17/2002 18:33'! setTextColorFor: emModel to: aColor | key index theEmphasisModel | key _ emModel key. index _ dictionary at: key ifAbsent: [index _ self model findFirst: [:each | each key = key]. dictionary at: key put: index]. theEmphasisModel _ self model at: index. theEmphasisModel color: aColor. theEmphasisModel update. self updateCodePane! ! !DialectStreamAttributesEditor methodsFor: 'gui building' stamp: 'sbw 9/16/2002 12:57'! textColorFor: emModel | key index theEmphasisModel | key _ emModel key. index _ dictionary at: key ifAbsent: [index _ self model findFirst: [:each | each key = key]. dictionary at: key put: index]. theEmphasisModel _ self model at: index. ^theEmphasisModel color! ! !DialectStreamAttributesEditor methodsFor: 'gui building' stamp: 'sbw 9/15/2002 19:43'! windowLabel ^'Color Print Text Attributes'! ! !DialectStreamAttributesEditor methodsFor: 'as yet unclassified' stamp: 'sbw 9/17/2002 18:32'! checkSelected: tag kind: kind | index | index _ dictionary at: tag. (model at: index) toggle: kind. self updateCodePane! ! !DialectStreamAttributesEditor methodsFor: 'as yet unclassified' stamp: 'sbw 9/15/2002 21:28'! initialize super initialize. dictionary _ Dictionary new! ! !DialectStreamAttributesEditor methodsFor: 'as yet unclassified' stamp: 'sbw 9/17/2002 18:32'! reset DialectStream initializeST80ColorTable. self model: EmphasisModel useST80ColorTable. self allMorphsDo: [:m | (m isKindOf: ToggleButtonMorph) ifTrue: [m setInitialState; invalidRect: m bounds]]. self updateCodePane! ! !DialectStreamAttributesEditor methodsFor: 'as yet unclassified' stamp: 'sbw 9/15/2002 22:01'! stateBoldFor: aSymbol | index theEmphasisModel emphasis emphasisCode key | key _ (aSymbol copyFrom: 1 to: (aSymbol size - 4)) asSymbol. index _ dictionary at: key ifAbsent: [index _ self model findFirst: [:each | each key = key]. dictionary at: key put: index]. theEmphasisModel _ self model at: index. emphasis _ theEmphasisModel emphasis. emphasisCode _ emphasis emphasisCode. ^ (emphasisCode bitAnd: 1) = 1! ]style[(14 7 4 49 4 3 4 7 15 1 6 7 8 1 14 5 3 10 9 3 16 5 3 4 27 6 2 4 7 3 8 10 5 3 6 5 4 16 3 4 11 5 3 8 3 16 12 12 3 8 19 12 9 1 6 1)f1b,f1cblue;b,f1,f1cblue;i,f1,f1cblue;i,f1,f1cblue;i,f1,f1c150150089,f1,f1cblue;i,f1,f1c150150089,f1,f1cblue;i,f1,f1cmagenta;,f1,f1cblue;i,f1,f1cblue;i,f1,f1cmagenta;,f1,f1cred;,f1,f1cblue;i,f1,f1cblue;i,f1,f1cmagenta;,f1,f1cblue;i,f1,f1cblue;i,f1,f1cblue;i,f1,f1cmagenta;,f1,f1cblue;i,f1,f1cblue;i,f1,f1cblue;i,f1,f1cblue;i,f1,f1cblue;i,f1,f1cblue;i,f1,f1c150150089,f1,f1c150150089! ! !DialectStreamAttributesEditor methodsFor: 'as yet unclassified' stamp: 'sbw 9/15/2002 22:01'! stateItalicFor: aSymbol | index theEmphasisModel emphasis emphasisCode key | key _ (aSymbol copyFrom: 1 to: (aSymbol size - 6)) asSymbol. index _ dictionary at: key ifAbsent: [index _ self model findFirst: [:each | each key = key]. dictionary at: key put: index]. theEmphasisModel _ self model at: index. emphasis _ theEmphasisModel emphasis. emphasisCode _ emphasis emphasisCode. ^ (emphasisCode bitAnd: 2) = 2! ]style[(16 7 4 49 4 3 4 7 15 1 6 7 8 1 14 5 3 10 9 3 16 5 3 4 27 6 2 4 7 3 8 10 5 3 6 5 4 16 3 4 11 5 3 8 3 16 12 12 3 8 19 12 9 1 6 1)f1b,f1cblue;b,f1,f1cblue;i,f1,f1cblue;i,f1,f1cblue;i,f1,f1c150150089,f1,f1cblue;i,f1,f1c150150089,f1,f1cblue;i,f1,f1cmagenta;,f1,f1cblue;i,f1,f1cblue;i,f1,f1cmagenta;,f1,f1cred;,f1,f1cblue;i,f1,f1cblue;i,f1,f1cmagenta;,f1,f1cblue;i,f1,f1cblue;i,f1,f1cblue;i,f1,f1cmagenta;,f1,f1cblue;i,f1,f1cblue;i,f1,f1cblue;i,f1,f1cblue;i,f1,f1cblue;i,f1,f1cblue;i,f1,f1c150150089,f1,f1c150150089! ! !DialectStreamAttributesEditor methodsFor: 'as yet unclassified' stamp: 'sbw 9/15/2002 22:13'! stateUnderlinedFor: aSymbol | index theEmphasisModel emphasis emphasisCode key | key _ (aSymbol copyFrom: 1 to: aSymbol size - 10) asSymbol. index _ dictionary at: key ifAbsent: [index _ self model findFirst: [:each | each key = key]. dictionary at: key put: index]. theEmphasisModel _ self model at: index. emphasis _ theEmphasisModel emphasis. emphasisCode _ emphasis emphasisCode. ^ (emphasisCode bitAnd: 4) = 4 ! ! !DialectStreamAttributesEditor class methodsFor: 'as yet unclassified' stamp: 'sbw 9/15/2002 19:37'! open "DialectStreamAttributesEditor open" ^ DialectStreamAttributesEditor new openAsMorph; yourself! ! !DialectStreamAttributesEditor class methodsFor: 'as yet unclassified' stamp: 'sbw 9/15/2002 19:38'! prototypicalToolWindow ^ self open! ! !DialectStreamAttributesEditor class methodsFor: 'as yet unclassified' stamp: 'sbw 11/22/2002 18:41'! registerEditTextColorsWithAppearanceMenu "DialectStreamAttributesEditor registerEditTextColorsWithAppearanceMenu" TheWorldMenu registerAppearanceCommand: {'edit pretty print text colors'. {DialectStreamAttributesEditor. #open}. 'open up an editor to modify code pretty print text colors'}! ! !EmphasisModel methodsFor: 'as yet unclassified' stamp: 'sbw 9/15/2002 19:33'! color ^color! ! !EmphasisModel methodsFor: 'as yet unclassified' stamp: 'sbw 9/15/2002 19:31'! color: aColor color _ aColor! ! !EmphasisModel methodsFor: 'as yet unclassified' stamp: 'sbw 9/15/2002 19:33'! emphasis ^emphasis! ! !EmphasisModel methodsFor: 'as yet unclassified' stamp: 'sbw 9/15/2002 19:32'! emphasis: aTextEmphasis emphasis _ aTextEmphasis! ! !EmphasisModel methodsFor: 'as yet unclassified' stamp: 'sbw 9/15/2002 19:33'! key ^key! ! !EmphasisModel methodsFor: 'as yet unclassified' stamp: 'sbw 9/15/2002 19:31'! key: aSymbol key _ aSymbol! ! !EmphasisModel methodsFor: 'as yet unclassified' stamp: 'sbw 9/16/2002 07:10'! populateFrom: array | symbol | symbol _ array first. self color: (symbol isColor ifTrue: [symbol] ifFalse: [Color perform: symbol]). symbol _ array second. self emphasis: (symbol isTextEmphasis ifTrue: [symbol] ifFalse: [TextEmphasis perform: symbol])! ! !EmphasisModel methodsFor: 'as yet unclassified' stamp: 'sbw 9/16/2002 12:55'! printOn: aStream super printOn: aStream. aStream cr; nextPutAll: ' key = #' , self key; cr; nextPutAll: ' emphasis = ' , self emphasis printString; cr; nextPutAll: ' color = ' , self color printString; cr! ! !EmphasisModel methodsFor: 'as yet unclassified' stamp: 'sbw 9/15/2002 22:43'! toggle: aSymbol aSymbol == #bold ifTrue: [self toggleBold]. aSymbol == #italic ifTrue: [self toggleItalic]. aSymbol == #underlined ifTrue: [self toggleUnderlined]. self update! ! !EmphasisModel methodsFor: 'as yet unclassified' stamp: 'sbw 9/15/2002 22:42'! toggleBold self emphasis emphasisCode: (self emphasis emphasisCode bitXor: 1)! ! !EmphasisModel methodsFor: 'as yet unclassified' stamp: 'sbw 9/15/2002 22:42'! toggleItalic self emphasis emphasisCode: (self emphasis emphasisCode bitXor: 2)! ! !EmphasisModel methodsFor: 'as yet unclassified' stamp: 'sbw 9/15/2002 22:43'! toggleUnderlined self emphasis emphasisCode: (self emphasis emphasisCode bitXor: 4)! ! !EmphasisModel methodsFor: 'as yet unclassified' stamp: 'sbw 9/15/2002 22:22'! update (DialectStream st80ColorTable at: self key) at: 1 put: self color. (DialectStream st80ColorTable at: self key) at: 2 put: self emphasis. ! ! !EmphasisModel class methodsFor: 'as yet unclassified' stamp: 'sbw 9/15/2002 19:50'! useST80ColorTable | coll model array | coll _ OrderedCollection new. DialectStream st80ColorTable keys asSortedCollection do: [:k | model _ self new. model key: k. array _ DialectStream st80ColorTable at: k. model populateFrom: array. coll add: model]. ^ coll! ! !TextEmphasis methodsFor: 'as yet unclassified' stamp: 'sbw 9/15/2002 18:54'! isTextEmphasis ^true! ! !ToggleButtonMorph methodsFor: 'as yet unclassified' stamp: 'sw 10/2/97 16:52'! buttonDownToToggleState | targetState | self doButtonAction. targetState _ (target perform: stateSelector) ifTrue: [#on] ifFalse: [#off]. targetState = state ifFalse: [self toggleState]! ! !ToggleButtonMorph methodsFor: 'as yet unclassified' stamp: 'sw 9/19/97 15:11'! mouseDown: evt self buttonDownToToggleState! ! !ToggleButtonMorph methodsFor: 'as yet unclassified' stamp: 'sw 9/19/97 15:06'! mouseMove: evt ! ! !ToggleButtonMorph methodsFor: 'as yet unclassified' stamp: 'sw 9/19/97 15:02'! mouseUp: evt ! ! !ToggleButtonMorph methodsFor: 'as yet unclassified' stamp: 'sw 9/19/97 19:43'! setInitialState state _ (target perform: stateSelector) == true ifTrue: [#on] ifFalse: [#off]! ! !ToggleButtonMorph methodsFor: 'as yet unclassified' stamp: 'sw 9/19/97 15:23'! stateSelector: sym stateSelector _ sym! ! !ToggleButtonMorph methodsFor: 'as yet unclassified' stamp: 'sw 10/2/97 17:03'! toggleState self state: ((state == #off) ifTrue: [#on] ifFalse: [#off])! ! !ToggleButtonMorph class methodsFor: 'as yet unclassified' stamp: 'tk 6/24/1999 11:50'! fixTargetPresenters "ToggleButtonMorph fixTargetPresenters" "Repair faulty instances from the first 'etoy-template' experiment, such that the instances refer to the local presenter rather than to a phantom and irrelevant world" self allSubInstancesDo: [:m | (m target isKindOf: Presenter) ifTrue: [m target: m presenter]]! ! "Postscript: Regsiter a hook in the world appearance menu." DialectStreamAttributesEditor registerEditTextColorsWithAppearanceMenu!