'From Squeakland 3.8.5976 of 25 August 2004 [latest update: #388] on 19 February 2005 at 2:51:51 am'! !Color class methodsFor: 'color from user' stamp: 'ka 2/18/2005 02:29'! colorPaletteForDepth: depth extent: chartExtent "Display a palette of colors sorted horizontally by hue and vertically by lightness. Useful for eyeballing the color gamut of the display, or for choosing a color interactively." "Note: It is slow to build this palette, so it should be cached for quick access." "(Color colorPaletteForDepth: 16 extent: 190@60) display" | basicHue x y c startHue palette transHt vSteps transCaption grayWidth hSteps formTranslator noColorForm | formTranslator := NaturalLanguageFormTranslator localeID: Locale current localeID. noColorForm := formTranslator translate: 'no color'. noColorForm ifNil: [noColorForm := Form extent: 34 @ 9 depth: 1 fromArray: #(0 0 256 0 256 0 3808663859 2147483648 2491688266 2147483648 2491688266 0 2491688266 0 2466486578 0 0 0 ) offset: 0 @ 0]. palette _ Form extent: chartExtent depth: depth. transCaption _ "(DisplayText text: 'no color' asText textStyle: (TextConstants at: #ComicPlain)) form storeString" noColorForm. transHt _ transCaption height. palette fillWhite: (0@0 extent: palette width@transHt). palette fillBlack: (0@transHt extent: palette width@1). transCaption displayOn: palette at: palette boundingBox topCenter - ((transCaption width // 2)@0). grayWidth _ 10. startHue _ 338.0. vSteps _ palette height - transHt // 2. hSteps _ palette width - grayWidth. x _ 0. startHue to: startHue + 360.0 by: 360.0/hSteps do: [:h | basicHue _ Color h: h asFloat s: 1.0 v: 1.0. y _ transHt+1. 0 to: vSteps do: [:n | c _ basicHue mixed: (n asFloat / vSteps asFloat) with: Color white. palette fill: (x@y extent: 1@1) fillColor: c. y _ y + 1]. 1 to: vSteps do: [:n | c _ Color black mixed: (n asFloat / vSteps asFloat) with: basicHue. palette fill: (x@y extent: 1@1) fillColor: c. y _ y + 1]. x _ x + 1]. y _ transHt + 1. 1 to: vSteps * 2 do: [:n | c _ Color black mixed: (n asFloat / (vSteps*2) asFloat) with: Color white. palette fill: (x@y extent: 10@1) fillColor: c. y _ y + 1]. ^ palette ! ! !ColorPickerMorph class methodsFor: 'class initialization' stamp: 'ka 2/19/2005 02:39'! initialize "ColorPickerMorph initialize" | formTranslator | ColorChart _ Color colorPaletteForDepth: 16 extent: 190@60. DragBox _ (11@0) extent: 9@8. RevertBox _ (ColorChart width - 20)@1 extent: 9@8. FeedbackBox _ (ColorChart width - 10)@1 extent: 9@8. TransparentBox _ DragBox topRight corner: RevertBox bottomLeft. ColorChart fillBlack: ((DragBox left - 1)@0 extent: 1@9). ColorChart fillBlack: ((TransparentBox left)@0 extent: 1@9). ColorChart fillBlack: ((FeedbackBox left - 1)@0 extent: 1@9). ColorChart fillBlack: ((RevertBox left - 1)@0 extent: 1@9). (Form dotOfSize: 5) displayOn: ColorChart at: DragBox center + (0@1). formTranslator := NaturalLanguageFormTranslator localeID: Locale current localeID. TransText := formTranslator translate: 'translucent'. TransText ifNil: [TransText := Form extent: 63 @ 8 depth: 1 fromArray: #(4194306 1024 4194306 1024 15628058 2476592640 4887714 2485462016 1883804850 2486772764 4756618 2485462016 4748474 1939416064 0 0) offset: 0 @ 0]. TransText _ ColorForm mappingWhiteToTransparentFrom: TransText ! ! !Locale class methodsFor: 'private' stamp: 'ka 2/18/2005 02:40'! migrateSystem "Locale migrateSystem" "Do all the necessary operations to switch to the new Locale environment." LocaleChangeListeners _ nil. self addLocalChangedListener: HandMorph; addLocalChangedListener: Clipboard; addLocalChangedListener: Vocabulary; addLocalChangedListener: PartsBin; addLocalChangedListener: Project; addLocalChangedListener: PaintBoxMorph; yourself! ! !Locale class methodsFor: 'notification' stamp: 'ka 2/19/2005 02:15'! localeChanged #(PartsBin ParagraphEditor BitEditor FormEditor StandardSystemController ColorPickerMorph) do: [ :key | Smalltalk at: key ifPresent: [ :class | class initialize ]]. Project current localeChanged. self localeChangedListeners do: [:each | each localeChanged]! ! !PaintBoxMorph class methodsFor: 'notification' stamp: 'ka 2/19/2005 01:54'! localeChanged self initializeColorChart! ! ColorPickerMorph initialize! | formTranslator | formTranslator := NaturalLanguageFormTranslator localeID: (LocaleID isoString: 'ja'). formTranslator name: 'translucent' form: (Form extent: 63 @ 8 depth: 1 fromArray: #(131328 1073881088 131266 3791790080 90563 1377918976 125927969 1242661344 131106 2324824064 131138 3398565888 123265 822206464 0 0 ) offset: 0 @ 0). formTranslator name: 'no color' form: (Form extent: 34 @ 9 depth: 1 fromArray: #(0 0 135266306 0 512753668 0 139461640 0 403703568 0 412156936 0 412163588 0 252583170 0 0 0 ) offset: 0 @ 0)! Locale migrateSystem!