Marcel Taeumel uploaded a new version of ShoutCore to project The Trunk:
http://source.squeak.org/trunk/ShoutCore-mt.56.mcz ==================== Summary ==================== Name: ShoutCore-mt.56 Author: mt Time: 31 July 2016, 10:54:09.29549 am UUID: a1a7570e-2171-8e4a-b231-0bd7b2b5e290 Ancestors: ShoutCore-eem.55 *** Widget Refactorings and UI Themes (Part 3 of 11) *** Prepare Shout syntax highlighting for UI themes. (Temporarily no syntax highlighting. Sorry. Be patient.) =============== Diff against ShoutCore-eem.55 =============== Item was changed: SHTextStyler subclass: #SHTextStylerST80 instanceVariableNames: 'classOrMetaClass workspace font parser formatAssignments environment sourceMap processedSourceMap pixelHeight attributesByPixelHeight parseAMethod' + classVariableNames: 'SyntaxHighlightingAsYouType SyntaxHighlightingAsYouTypeAnsiAssignment SyntaxHighlightingAsYouTypeLeftArrowAssignment TextAttributesByPixelHeight' - classVariableNames: 'SubduedSyntaxHighlights SyntaxHighlightingAsYouType SyntaxHighlightingAsYouTypeAnsiAssignment SyntaxHighlightingAsYouTypeLeftArrowAssignment' poolDictionaries: '' category: 'ShoutCore-Styling'! - SHTextStylerST80 class - instanceVariableNames: 'styleTable textAttributesByPixelHeight'! !SHTextStylerST80 commentStamp: 'tween 8/27/2004 10:55' prior: 0! I style Smalltalk methods and expressions. My 'styleTable' class instance var holds an array ofArrays which control how each token is styled/coloured. See my defaultStyleTable class method for its structure. My styleTable can be changed by either modifying the defaultStyleTable class method and then executing SHTextStylerST80 initialize ; or by giving me a new styleTable through my #styleTable: class method. My 'textAttributesByPixelSize' class instance var contains a dictionary of dictionaries. The key is a pixelSize and the value a Dictionary from token type Symbol to TextAttribute array. It is created/maintained automatically. I also install these 3 preferences when my class initialize method is executed.... #syntaxHighlightingAsYouType - controls whether methods are styled in browsers #syntaxHighlightingAsYouTypeAnsiAssignment - controls whether assignments are formatted to be := #syntaxHighlightingAsYouTypeLeftArrowAssignment - controls whether assignments are formatted to be _ I reimplement #unstyledTextFrom: so that TextActions are preserved in the unstyled text ! - SHTextStylerST80 class - instanceVariableNames: 'styleTable textAttributesByPixelHeight'! Item was added: + ----- Method: SHTextStylerST80 class>>applyUserInterfaceTheme (in category 'preferences') ----- + applyUserInterfaceTheme + + self resetTextAttributesByPixelHeight.! Item was removed: - ----- Method: SHTextStylerST80 class>>attributeArrayForColor:emphasis:font: (in category 'style table') ----- - attributeArrayForColor: aColorOrNil emphasis: anEmphasisSymbolOrArrayorNil font: aTextStyleOrFontOrNil - "Answer a new Array containing any non nil TextAttributes specified" - | answer emphArray | - - answer := Array new. - aColorOrNil ifNotNil: [answer := answer, {TextColor color: aColorOrNil}]. - anEmphasisSymbolOrArrayorNil ifNotNil: [ - emphArray := anEmphasisSymbolOrArrayorNil isSymbol - ifTrue: [{anEmphasisSymbolOrArrayorNil}] - ifFalse: [anEmphasisSymbolOrArrayorNil]. - emphArray do: [:each | - each ~= #normal - ifTrue:[ - answer := answer, {TextEmphasis perform: each}]]]. - aTextStyleOrFontOrNil ifNotNil: [ - answer := answer, {TextFontReference toFont: aTextStyleOrFontOrNil}]. - ^answer! Item was removed: - ----- Method: SHTextStylerST80 class>>attributesByPixelHeight: (in category 'style table') ----- - attributesByPixelHeight: aNumber - - ^self textAttributesByPixelHeight - at: aNumber - ifAbsent: [ - | result | - result := self initialTextAttributesForPixelHeight: aNumber. - " thread safety first " - textAttributesByPixelHeight := textAttributesByPixelHeight copy - at: aNumber put: result; - yourself. - result ]! Item was removed: - ----- Method: SHTextStylerST80 class>>attributesFor:pixelHeight: (in category 'style table') ----- - attributesFor: aSymbol pixelHeight: aNumber - - ^(self textAttributesByPixelHeight - at: aNumber - ifAbsentPut:[self initialTextAttributesForPixelHeight: aNumber]) - at: aSymbol ifAbsent:[nil]! Item was added: + ----- Method: SHTextStylerST80 class>>canApplyThemeToInstances (in category 'preferences') ----- + canApplyThemeToInstances + + ^ false! Item was removed: - ----- Method: SHTextStylerST80 class>>chooseDefaultStyleTable (in category 'style table') ----- - chooseDefaultStyleTable - "Choose the default style table" - ^self subduedSyntaxHighlights - ifTrue:[self subduedStyleTable] - ifFalse:[self defaultStyleTable]! Item was removed: - ----- Method: SHTextStylerST80 class>>defaultStyleTable (in category 'style table') ----- - defaultStyleTable - "color can be a valid argument to Color class>>colorFrom: , or nil to - use the editor text color. - Multiple emphases can be specified using an array e.g. #(bold italic). - If emphasis is not specified, #normal will be used. - if pixel height is not specified , then the editor font size will be used. - " - - ^#( - "(symbol color [emphasisSymbolOrArray [textStyleName [pixelHeight]]])" - (default black ) - (invalid red ) - (excessCode red ) - (comment (green muchDarker) italic) - (unfinishedComment (red muchDarker) italic) - (#'$' (red muchDarker) ) - (character (red muchDarker) ) - (integer (red muchDarker) ) - (number (red muchDarker) ) - (#- (red muchDarker) ) - (symbol (blue muchDarker) bold) - (stringSymbol (blue muchDarker) bold) - (literalArray (blue muchDarker) bold) - (string (magenta muchDarker) normal) - (unfinishedString red normal ) - (assignment nil bold ) - (ansiAssignment nil bold) - (literal nil italic) - (keyword (blue muchDarker) ) - (binary (blue muchDarker) ) - (unary (blue muchDarker) ) - (incompleteKeyword (gray muchDarker) underlined) - (incompleteBinary (gray muchDarker) underlined) - (incompleteUnary (gray muchDarker) underlined) - (undefinedKeyword red ) - (undefinedBinary red ) - (undefinedUnary red ) - (patternKeyword nil bold) - (patternBinary nil bold) - (patternUnary nil bold) - (#self (red muchDarker) bold) - (#super (red muchDarker) bold) - (#true (red muchDarker) bold) - (#false (red muchDarker) bold) - (#nil (red muchDarker) bold) - (#thisContext (red muchDarker) bold) - (#return (red muchDarker) bold) - (patternArg (blue muchDarker) italic) - (methodArg (blue muchDarker) italic) - (blockPatternArg (blue muchDarker) italic) - (blockArg (blue muchDarker) italic) - (argument (blue muchDarker) italic) - (blockArgColon black ) - (leftParenthesis black ) - (rightParenthesis black ) - (leftParenthesis1 (green muchDarker) ) - (rightParenthesis1 (green muchDarker) ) - (leftParenthesis2 (magenta muchDarker) ) - (rightParenthesis2 (magenta muchDarker) ) - (leftParenthesis3 (red muchDarker) ) - (rightParenthesis3 (red muchDarker) ) - (leftParenthesis4 (green darker) ) - (rightParenthesis4 (green darker) ) - (leftParenthesis5 (orange darker) ) - (rightParenthesis5 (orange darker) ) - (leftParenthesis6 (magenta darker) ) - (rightParenthesis6 (magenta darker) ) - (leftParenthesis7 blue ) - (rightParenthesis7 blue ) - (blockStart black ) - (blockEnd black ) - (blockStart1 (green muchDarker) ) - (blockEnd1 (green muchDarker) ) - (blockStart2 (magenta muchDarker) ) - (blockEnd2 (magenta muchDarker) ) - (blockStart3 (red muchDarker) ) - (blockEnd3 (red muchDarker) ) - (blockStart4 (green darker) ) - (blockEnd4 (green darker) ) - (blockStart5 (orange darker) ) - (blockEnd5 (orange darker) ) - (blockStart6 (magenta darker) ) - (blockEnd6 (magenta darker) ) - (blockStart7 blue ) - (blockEnd7 blue ) - (arrayStart black ) - (arrayEnd black ) - (arrayStart1 black ) - (arrayEnd1 black ) - (byteArrayStart black ) - (byteArrayEnd black ) - (byteArrayStart1 black ) - (byteArrayEnd1 black ) - (leftBrace black ) - (rightBrace black ) - (cascadeSeparator black ) - (statementSeparator black ) - (externalCallType black ) - (externalCallTypePointerIndicator black ) - (primitiveOrExternalCallStart black bold ) - (primitiveOrExternalCallEnd black bold ) - (methodTempBar gray ) - (blockTempBar gray ) - (blockArgsBar gray ) - (primitive (green muchDarker) bold) - (pragmaKeyword (green muchDarker) bold) - (pragmaUnary (green muchDarker) bold) - (pragmaBinary (green muchDarker) bold) - (externalFunctionCallingConvention (green muchDarker) bold) - (module (green muchDarker) bold) - (blockTempVar gray italic) - (blockPatternTempVar gray italic) - (instVar black bold) - (workspaceVar black bold) - (undefinedIdentifier red bold) - (incompleteIdentifier (gray darker) (italic underlined)) - (tempVar (gray darker) italic) - (patternTempVar (gray darker) italic) - (poolConstant (gray darker) italic) - (classVar (gray darker) bold) - (globalVar black bold) ) - ! Item was removed: - ----- Method: SHTextStylerST80 class>>initialTextAttributesForPixelHeight: (in category 'style table') ----- - initialTextAttributesForPixelHeight: aNumber - | d | - - d := IdentityDictionary new. - self styleTable do: [:each | | textStyle element emphasis font pixelHeight attrArray color textStyleName | - element := each first. - color := each at: 2 ifAbsent:[nil]. - color:=color ifNotNil: [Color colorFrom: color]. - emphasis := each at: 3 ifAbsent:[nil]. - textStyleName := each at: 4 ifAbsent: [nil]. - pixelHeight := each at: 5 ifAbsent: [aNumber]. - textStyleName ifNil:[pixelHeight := nil]. - textStyle := TextStyle named: textStyleName. - font := textStyle ifNotNil:[pixelHeight ifNotNil:[textStyle fontOfSize: pixelHeight]]. - attrArray := self attributeArrayForColor: color emphasis: emphasis font: font. - attrArray notEmpty - ifTrue:[ - d at: element put: attrArray]]. - ^d - ! Item was removed: - ----- Method: SHTextStylerST80 class>>initialize (in category 'class initialization') ----- - initialize - "Clear styleTable and textAttributesByPixelSize cache so that they will - reinitialize. - - SHTextStylerST80 initialize - " - - styleTable := nil. - textAttributesByPixelHeight := nil. ! Item was added: + ----- Method: SHTextStylerST80 class>>resetTextAttributesByPixelHeight (in category 'style table') ----- + resetTextAttributesByPixelHeight + + TextAttributesByPixelHeight := nil.! Item was removed: - ----- Method: SHTextStylerST80 class>>styleTable (in category 'style table') ----- - styleTable - - ^styleTable ifNil: [ styleTable := self chooseDefaultStyleTable ]! Item was removed: - ----- Method: SHTextStylerST80 class>>styleTable: (in category 'style table') ----- - styleTable: anArray - "Set the receiver's styleTable to anArray. - Clear textAttributesByPixelSize cache so that it will reinitialize. - " - - styleTable := anArray. - textAttributesByPixelHeight := nil! Item was removed: - ----- Method: SHTextStylerST80 class>>subduedStyleTable (in category 'style table') ----- - subduedStyleTable - "color can be a valid argument to Color class>>colorFrom: , or nil to - use the editor text color. - Multiple emphases can be specified using an array e.g. #(bold italic). - If emphasis is not specified, #normal will be used. - if pixel height is not specified , then the editor font size will be used. - " - - ^#( - "(symbol color [emphasisSymbolOrArray [textStyleName [pixelHeight]]])" - (default black ) - (invalid red ) - (excessCode red ) - (comment (cyan muchDarker) ) - (unfinishedComment (red muchDarker) italic) - (#'$' (red muchDarker) ) - (character (red muchDarker) ) - (integer (red muchDarker) ) - (number (red muchDarker) ) - (#- (red muchDarker) ) - (symbol (blue muchDarker) ) - (stringSymbol (blue muchDarker) ) - (literalArray (blue muchDarker) ) - (string (magenta muchDarker) normal ) - (unfinishedString red normal ) - (assignment nil bold ) - (ansiAssignment nil bold) - (literal nil italic) - (keyword (blue muchDarker) ) - (binary (blue muchDarker) ) - (unary (blue muchDarker) ) - (incompleteKeyword (gray muchDarker) underlined) - (incompleteBinary (gray muchDarker) underlined) - (incompleteUnary (gray muchDarker) underlined) - (undefinedKeyword red ) - (undefinedBinary red ) - (undefinedUnary red ) - (patternKeyword nil bold) - (patternBinary nil bold) - (patternUnary nil bold) - (#self (red muchDarker) ) - (#super (red muchDarker) ) - (#true (red muchDarker) ) - (#false (red muchDarker) ) - (#nil (red muchDarker) ) - (#thisContext (red muchDarker) ) - (#return (red muchDarker) ) - (patternArg (blue muchDarker) ) - (methodArg (blue muchDarker) ) - (blockPatternArg (blue muchDarker) ) - (blockArg (blue muchDarker) ) - (argument (blue muchDarker) ) - (blockArgColon black ) - (leftParenthesis black ) - (rightParenthesis black ) - (leftParenthesis1 (green muchDarker) ) - (rightParenthesis1 (green muchDarker) ) - (leftParenthesis2 (magenta muchDarker) ) - (rightParenthesis2 (magenta muchDarker) ) - (leftParenthesis3 (red muchDarker) ) - (rightParenthesis3 (red muchDarker) ) - (leftParenthesis4 (green darker) ) - (rightParenthesis4 (green darker) ) - (leftParenthesis5 (orange darker) ) - (rightParenthesis5 (orange darker) ) - (leftParenthesis6 (magenta darker) ) - (rightParenthesis6 (magenta darker) ) - (leftParenthesis7 blue ) - (rightParenthesis7 blue ) - (blockStart black ) - (blockEnd black ) - (blockStart1 (green muchDarker) ) - (blockEnd1 (green muchDarker) ) - (blockStart2 (magenta muchDarker) ) - (blockEnd2 (magenta muchDarker) ) - (blockStart3 (red muchDarker) ) - (blockEnd3 (red muchDarker) ) - (blockStart4 (green darker) ) - (blockEnd4 (green darker) ) - (blockStart5 (orange darker) ) - (blockEnd5 (orange darker) ) - (blockStart6 (magenta darker) ) - (blockEnd6 (magenta darker) ) - (blockStart7 blue ) - (blockEnd7 blue ) - (arrayStart black ) - (arrayEnd black ) - (arrayStart1 black ) - (arrayEnd1 black ) - (byteArrayStart black ) - (byteArrayEnd black ) - (byteArrayStart1 black ) - (byteArrayEnd1 black ) - (leftBrace black ) - (rightBrace black ) - (cascadeSeparator black ) - (statementSeparator black ) - (externalCallType black ) - (externalCallTypePointerIndicator black ) - (primitiveOrExternalCallStart black ) - (primitiveOrExternalCallEnd black ) - (methodTempBar gray ) - (blockTempBar gray ) - (blockArgsBar gray ) - (primitive (green muchDarker) bold) - (pragmaKeyword (green muchDarker) bold) - (pragmaUnary (green muchDarker) bold) - (pragmaBinary (green muchDarker) bold) - (externalFunctionCallingConvention (green muchDarker) bold) - (module (green muchDarker) bold) - (blockTempVar gray ) - (blockPatternTempVar gray ) - (instVar black ) - (workspaceVar black ) - (undefinedIdentifier red ) - (incompleteIdentifier (gray darker) (italic underlined)) - (tempVar (gray darker) ) - (patternTempVar (gray darker) ) - (poolConstant (gray muchDarker) ) - (classVar (gray muchDarker) ) - (globalVar black ) )! Item was removed: - ----- Method: SHTextStylerST80 class>>subduedSyntaxHighlights (in category 'preferences') ----- - subduedSyntaxHighlights - <preference: 'Subdued Syntax Highlighting' - category: 'browsing' - description: 'When enabled, use a more subdued syntax highlighting approach that is not as aggressive in the face newbies. Intended to introduce people gracefully to the shiny colorful world of Squeak syntax' - type: #Boolean> - ^SubduedSyntaxHighlights ifNil:[true]! Item was removed: - ----- Method: SHTextStylerST80 class>>subduedSyntaxHighlights: (in category 'preferences') ----- - subduedSyntaxHighlights: aBool - "Change the subdued syntax highlighting preference" - SubduedSyntaxHighlights := aBool. - "Force reload" - styleTable := nil. - textAttributesByPixelHeight := nil.! Item was changed: ----- Method: SHTextStylerST80 class>>textAttributesByPixelHeight (in category 'style table') ----- textAttributesByPixelHeight + "A cache for text attributes used by all instances of text styler." + ^ TextAttributesByPixelHeight ifNil: [ TextAttributesByPixelHeight := Dictionary new ]! - ^ textAttributesByPixelHeight ifNil: [ textAttributesByPixelHeight := Dictionary new ]! Item was added: + ----- Method: SHTextStylerST80 class>>textAttributesByPixelHeightAt:put: (in category 'style table') ----- + textAttributesByPixelHeightAt: aNumber put: someTextAttributes + "Thread-safety first." + + TextAttributesByPixelHeight := self textAttributesByPixelHeight copy + at: aNumber put: someTextAttributes; + yourself. + ^ someTextAttributes! Item was added: + ----- Method: SHTextStylerST80 class>>themeProperties (in category 'preferences') ----- + themeProperties + + ^ { + { #default. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #invalid. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #excessCode. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #comment. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #unfinishedComment. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #'$'. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #character. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #integer. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #number. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #-. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #symbol. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #stringSymbol. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #literalArray. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #string. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #unfinishedString. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #assignment. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #ansiAssignment. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #literal. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #keyword. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #binary. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #unary. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #incompleteKeyword. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #incompleteBinary. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #incompleteUnary. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #undefinedKeyword. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #undefinedBinary. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #undefinedUnary. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #patternKeyword. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #patternBinary. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #patternUnary. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #self. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #super. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #true. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #false. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #nil. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #thisContext. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #return. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #patternArg. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #methodArg. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #blockPatternArg. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #blockArg. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #argument. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #blockArgColon. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #leftParenthesis. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #rightParenthesis. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #leftParenthesis1. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #rightParenthesis1. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #leftParenthesis2. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #rightParenthesis2. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #leftParenthesis3. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #rightParenthesis3. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #leftParenthesis4. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #rightParenthesis4. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #leftParenthesis5. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #rightParenthesis5. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #leftParenthesis6. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #rightParenthesis6. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #leftParenthesis7. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #rightParenthesis7. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #blockStart. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #blockEnd. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #blockStart1. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #blockEnd1. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #blockStart2. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #blockEnd2. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #blockStart3. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #blockEnd3. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #blockStart4. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #blockEnd4. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #blockStart5. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #blockEnd5. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #blockStart6. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #blockEnd6. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #blockStart7. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #blockEnd7. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #arrayStart. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #arrayEnd. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #arrayStart1. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #arrayEnd1. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #byteArrayStart. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #byteArrayEnd. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #byteArrayStart1. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #byteArrayEnd1. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #leftBrace. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #rightBrace. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #cascadeSeparator. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #statementSeparator. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #externalCallType. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #externalCallTypePointerIndicator. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #primitiveOrExternalCallStart. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #primitiveOrExternalCallEnd. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #methodTempBar. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #blockTempBar. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #blockArgsBar. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #primitive. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #pragmaKeyword. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #pragmaUnary. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #pragmaBinary. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #externalFunctionCallingConvention. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #module. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #blockTempVar. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #blockPatternTempVar. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #instVar. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #workspaceVar. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #undefinedIdentifier. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #incompleteIdentifier. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #tempVar. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #patternTempVar. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #poolConstant. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #classVar. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + { #globalVar. 'Styling'. 'Specify color, emphasis, and font in a triple.' }. + }! Item was added: + ----- Method: SHTextStylerST80>>applyUserInterfaceTheme (in category 'updating') ----- + applyUserInterfaceTheme + "My dependents should take care of invalidating my caches and then ask me to style again. It is of no use to invalidate my caches right now because I have no idea when my dependents will ask me to style again."! Item was added: + ----- Method: SHTextStylerST80>>attributesByPixelHeight (in category 'style table') ----- + attributesByPixelHeight + + ^ attributesByPixelHeight ifNil: [ + attributesByPixelHeight := self attributesByPixelHeight: self pixelHeight]! Item was added: + ----- Method: SHTextStylerST80>>attributesByPixelHeight: (in category 'style table') ----- + attributesByPixelHeight: aNumber + + ^ self class textAttributesByPixelHeight + at: aNumber + ifAbsent: [ + self class + textAttributesByPixelHeightAt: aNumber + put: (self createTextAttributesForPixelHeight: aNumber)]! Item was changed: + ----- Method: SHTextStylerST80>>attributesFor: (in category 'style table') ----- - ----- Method: SHTextStylerST80>>attributesFor: (in category 'private') ----- attributesFor: aSymbol + ^ self attributesByPixelHeight at: aSymbol ifAbsent: nil! - ^(attributesByPixelHeight ifNil: [ - attributesByPixelHeight := self class attributesByPixelHeight: self pixelHeight ]) - at: aSymbol - ifAbsent: nil! Item was added: + ----- Method: SHTextStylerST80>>createAttributeArrayForColor:emphasis:font: (in category 'style table') ----- + createAttributeArrayForColor: aColorOrNil emphasis: anEmphasisOrArrayorNil font: aFontOrNil + "Answer a new Array containing any non nil TextAttributes specified" + + | answer emphArray | + answer := Array new. + aColorOrNil ifNotNil: [answer := answer, {TextColor color: aColorOrNil}]. + anEmphasisOrArrayorNil ifNotNil: [ + emphArray := anEmphasisOrArrayorNil isArray + ifFalse: [{anEmphasisOrArrayorNil}] + ifTrue: [anEmphasisOrArrayorNil]. + answer := answer, emphArray]. + aFontOrNil ifNotNil: [ + answer := answer, {TextFontReference toFont: aFontOrNil}]. + ^answer! Item was added: + ----- Method: SHTextStylerST80>>createTextAttributesForPixelHeight: (in category 'style table') ----- + createTextAttributesForPixelHeight: aNumber + + | result | + result := IdentityDictionary new. + result at: #default put: {}. "Required as fall-back for non-existing attributes." + + self class themeProperties do: [:each | + | spec element emphasis font color | + element := each first. + spec := self userInterfaceTheme perform: element. + spec isArray ifFalse: [spec := {spec}]. "Support color-only hints." + + color := spec first ifNotNil: [:colorSpec | Color colorFrom: colorSpec]. + emphasis := spec at: 2 ifAbsent:[nil]. + font := spec at: 3 ifAbsent: [nil]. + + "Support for named text styles." + font isString ifTrue: [ + | textStyle | + textStyle := TextStyle named: font. + font := textStyle ifNotNil: [textStyle fontOfSize: aNumber]]. + + (self createAttributeArrayForColor: color emphasis: emphasis font: font) + ifNotEmpty: [:attrArray | result at: element put: attrArray]]. + ^ result + ! Item was added: + ----- Method: SHTextStylerST80>>reset (in category 'initialize-release') ----- + reset + + attributesByPixelHeight := nil.! |
Free forum by Nabble | Edit this page |