Karl Ramberg uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-kfr.908.mcz ==================== Summary ==================== Name: Morphic-kfr.908 Author: kfr Time: 19 April 2015, 4:35:04.246 pm UUID: 0ec7f662-2f9e-0948-9ca4-9a67043af0a3 Ancestors: Morphic-kfr.907, Morphic-kfr.900 Changes to access several menu colors etc. via preference browser =============== Diff against Morphic-kfr.907 =============== Item was changed: ----- Method: DockingBarMorph>>setDefaultParameters (in category 'initialize-release') ----- setDefaultParameters "private - set the default parameter using Preferences as the inspiration source" | colorFromMenu worldColor menuColor menuBorderColor | colorFromMenu := Preferences menuColorFromWorld and: [Display depth > 4 and: [(worldColor := self currentWorld color) isColor]]. "" menuColor := colorFromMenu ifTrue: [worldColor luminance > 0.7 ifTrue: [worldColor mixed: 0.85 with: Color black] ifFalse: [worldColor mixed: 0.4 with: Color white]] + ifFalse: [MenuMorph menuColor]. - ifFalse: [Preferences menuColor]. "" menuBorderColor := Preferences menuAppearance3d ifTrue: [#raised] ifFalse: [colorFromMenu ifTrue: [worldColor muchDarker] + ifFalse: [MenuMorph menuBorderColor]]. - ifFalse: [Preferences menuBorderColor]]. "" self setColor: menuColor + borderWidth: MenuMorph menuBorderWidth - borderWidth: Preferences menuBorderWidth borderColor: menuBorderColor! Item was changed: ----- Method: FillInTheBlankMorph>>setDefaultParameters (in category 'initialization') ----- setDefaultParameters "change the receiver's appareance parameters" | colorFromMenu worldColor menuColor | colorFromMenu := Preferences menuColorFromWorld and: [Display depth > 4 and: [(worldColor := self currentWorld color) isColor]]. menuColor := colorFromMenu ifTrue: [worldColor luminance > 0.7 ifTrue: [worldColor mixed: 0.85 with: Color black] ifFalse: [worldColor mixed: 0.4 with: Color white]] + ifFalse: [MenuMorph menuColor]. - ifFalse: [Preferences menuColor]. self color: menuColor. + self borderWidth: MenuMorph menuBorderWidth. - self borderWidth: Preferences menuBorderWidth. Preferences menuAppearance3d ifTrue: [ self borderStyle: BorderStyle thinGray. self hasDropShadow: true. self useSoftDropShadow ifFalse: [ self shadowColor: (TranslucentColor r: 0.0 g: 0.0 b: 0.0 alpha: 0.666); shadowOffset: 1 @ 1] ifTrue: [ self shadowColor: (TranslucentColor r: 0.0 g: 0.0 b: 0.0 alpha: 0.01); shadowOffset: (10@8 corner: 10@12) ] ] ifFalse: [ | menuBorderColor | menuBorderColor := colorFromMenu ifTrue: [worldColor muchDarker] + ifFalse: [MenuMorph menuBorderColor]. - ifFalse: [Preferences menuBorderColor]. self borderColor: menuBorderColor. ]. self layoutInset: 3. ! Item was changed: ----- Method: HaloMorph>>drawOn: (in category 'drawing') ----- drawOn: aCanvas "Draw this morph only if it has no target." target isNil ifTrue: [^ super drawOn: aCanvas]. (Preferences showBoundsInHalo and: [target isWorldMorph not]) ifTrue: [| boundsColor | + boundsColor := MenuMorph menuSelectionColor - boundsColor := Preferences menuSelectionColor ifNil: [Color blue]. aCanvas frameAndFillRectangle: self bounds fillColor: Color transparent borderWidth: 2 borderColor: (boundsColor isTranslucent ifTrue: [boundsColor] ifFalse: [boundsColor alpha: 0.8])]! Item was changed: ----- Method: ListItemWrapper>>highlightingColor (in category 'accessing') ----- highlightingColor + ^MenuMorph menuSelectionColor makeForegroundColor! - ^Preferences menuSelectionColor makeForegroundColor! Item was changed: ----- Method: MenuItemMorph>>selectionFillStyle (in category 'private') ----- selectionFillStyle " Answer the fill style to use with the receiver is the selected element " | fill baseColor preferenced | Display depth <= 2 ifTrue: [ ^Color gray ]. + preferenced := MenuMorph menuSelectionColor. - preferenced := Preferences menuSelectionColor. preferenced notNil ifTrue: [ ^preferenced ]. baseColor := owner color negated. MenuMorph gradientMenu ifFalse: [ ^baseColor ]. fill := GradientFillStyle ramp: { 0.0 -> baseColor twiceLighter. 1 -> baseColor twiceDarker }. fill origin: self topLeft. ^ fill! Item was changed: ----- Method: MenuLineMorph>>drawOn: (in category 'drawing') ----- drawOn: aCanvas | baseColor | baseColor := Preferences menuColorFromWorld ifTrue: [owner color twiceDarker] ifFalse: [Preferences menuAppearance3d ifTrue: [owner color] + ifFalse: [MenuMorph menuLineColor]]. - ifFalse: [Preferences menuLineColor]]. Preferences menuAppearance3d ifTrue: [ aCanvas fillRectangle: (bounds topLeft corner: bounds rightCenter) color: baseColor twiceDarker. aCanvas fillRectangle: (bounds leftCenter corner: bounds bottomRight) color: baseColor twiceLighter] ifFalse: [ aCanvas fillRectangle: (bounds topLeft corner: bounds bottomRight) color: baseColor]! Item was changed: AlignmentMorph subclass: #MenuMorph instanceVariableNames: 'defaultTarget selectedItem stayUp popUpOwner activeSubMenu' + classVariableNames: 'CloseBoxImage CloseBoxImageFlat CloseBoxImageGradient GradientMenu MenuBorderColor MenuBorderWidth MenuColor MenuLineColor MenuSelectionColor MenuTitleBorderColor MenuTitleBorderWidth MenuTitleColor PushPinImage RoundedMenuCorners' - classVariableNames: 'CloseBoxImage CloseBoxImageFlat CloseBoxImageGradient GradientMenu PushPinImage RoundedMenuCorners' poolDictionaries: '' category: 'Morphic-Menus'! !MenuMorph commentStamp: '<historical>' prior: 0! Instance variables: defaultTarget <Object> The default target for creating menu items selectedItem <MenuItemMorph> The currently selected item in the receiver stayUp <Boolean> True if the receiver should stay up after clicks popUpOwner <MenuItemMorph> The menu item that automatically invoked the receiver, if any. activeSubMenu <MenuMorph> The currently active submenu.! Item was added: + ----- Method: MenuMorph class>>menuBorderColor (in category 'preferences') ----- + menuBorderColor + + <preference: 'menuBorderColor' + category: #menus + description: 'Menus border color' + type: #Color> + Display depth <= 2 ifTrue: [^ Color black]. + ^MenuBorderColor ifNil: [(Color r: 0.2 g: 0.3 b: 0.9)]! Item was added: + ----- Method: MenuMorph class>>menuBorderColor: (in category 'preferences') ----- + menuBorderColor: aColor + MenuBorderColor := aColor! Item was added: + ----- Method: MenuMorph class>>menuBorderWidth (in category 'preferences') ----- + menuBorderWidth + <preference: 'menuBorderWidth' + category: #menus + description: 'Menus border width' + type: #Number> + ^MenuBorderWidth ifNil: [2]! Item was added: + ----- Method: MenuMorph class>>menuBorderWidth: (in category 'preferences') ----- + menuBorderWidth: anInteger + MenuBorderWidth := anInteger! Item was added: + ----- Method: MenuMorph class>>menuColor (in category 'preferences') ----- + menuColor + <preference: 'menuColor' + category: #menus + description: 'Menus color' + type: #Color> + Display depth <= 2 ifTrue: [^ Color black]. + ^MenuColor ifNil: [(Color r: 0.9 g: 0.9 b: 0.9)]! Item was added: + ----- Method: MenuMorph class>>menuColor: (in category 'preferences') ----- + menuColor: aColor + MenuColor := aColor! Item was added: + ----- Method: MenuMorph class>>menuLineColor (in category 'preferences') ----- + menuLineColor + <preference: 'menuLineColor' + category: #menus + description: 'Menus color of separating lines' + type: #Color> + ^MenuLineColor ifNil: [(Color r: 0.6 g: 0.7 b: 1)]! Item was added: + ----- Method: MenuMorph class>>menuLineColor: (in category 'preferences') ----- + menuLineColor: aColor + MenuLineColor := aColor! Item was added: + ----- Method: MenuMorph class>>menuSelectionColor (in category 'preferences') ----- + menuSelectionColor + <preference: 'menuSelectionColor' + category: #menus + description: 'Color of selected item in menu' + type: #Color> + Display depth <= 2 ifTrue: [^ Color black]. + ^MenuSelectionColor ifNil: [(Color r: 0.4 g: 0.5 b: 0.7)]! Item was added: + ----- Method: MenuMorph class>>menuSelectionColor: (in category 'preferences') ----- + menuSelectionColor: aColor + MenuSelectionColor := aColor! Item was added: + ----- Method: MenuMorph class>>menuTitleBorderColor (in category 'preferences') ----- + menuTitleBorderColor + <preference: 'menuTitleBorderColor' + category: #menus + description: 'Border color of frame around menu title' + type: #Color> + Display depth <= 2 ifTrue: [^ Color black]. + ^MenuTitleBorderColor ifNil: [(Color r: 0.6 g: 0.7 b: 1)]! Item was added: + ----- Method: MenuMorph class>>menuTitleBorderColor: (in category 'preferences') ----- + menuTitleBorderColor: aColor + MenuTitleBorderColor := aColor! Item was added: + ----- Method: MenuMorph class>>menuTitleBorderWidth (in category 'preferences') ----- + menuTitleBorderWidth + <preference: 'menuTitleBorderWidth' + category: #menus + description: 'Width of frame around menus title' + type: #Number> + ^MenuTitleBorderWidth ifNil: [0]! Item was added: + ----- Method: MenuMorph class>>menuTitleBorderWidth: (in category 'preferences') ----- + menuTitleBorderWidth: anInteger + MenuTitleBorderWidth := anInteger! Item was added: + ----- Method: MenuMorph class>>menuTitleColor (in category 'preferences') ----- + menuTitleColor + <preference: 'menuTitleColor' + category: #menus + description: 'Color of background of menus title' + type: #Color> + Display depth = 1 ifTrue: [^ Color white]. + Display depth = 2 ifTrue: [^ Color gray]. + ^MenuTitleColor ifNil: [ Color transparent]! Item was added: + ----- Method: MenuMorph class>>menuTitleColor: (in category 'preferences') ----- + menuTitleColor: aColor + MenuTitleColor := aColor! Item was changed: ----- Method: MenuMorph>>setDefaultParameters (in category 'initialization') ----- setDefaultParameters "change the receiver's appareance parameters" | colorFromMenu worldColor menuColor | colorFromMenu := Preferences menuColorFromWorld and: [Display depth > 4 and: [(worldColor := self currentWorld color) isColor]]. menuColor := colorFromMenu ifTrue: [worldColor luminance > 0.7 ifTrue: [worldColor mixed: 0.85 with: Color black] ifFalse: [worldColor mixed: 0.4 with: Color white]] + ifFalse: [self class menuColor]. - ifFalse: [Preferences menuColor]. self color: menuColor. + self borderWidth: self class menuBorderWidth. - self borderWidth: Preferences menuBorderWidth. Preferences menuAppearance3d ifTrue: [ self borderStyle: BorderStyle thinGray. self hasDropShadow: true. self useSoftDropShadow ifFalse: [ self shadowColor: (TranslucentColor r: 0.0 g: 0.0 b: 0.0 alpha: 0.666); shadowOffset: 1 @ 1] ifTrue: [ self shadowColor: (TranslucentColor r: 0.0 g: 0.0 b: 0.0 alpha: 0.01); shadowOffset: (10@8 corner: 10@12) ] ] ifFalse: [ | menuBorderColor | menuBorderColor := colorFromMenu ifTrue: [worldColor muchDarker] + ifFalse: [self class menuBorderColor]. - ifFalse: [Preferences menuBorderColor]. self borderColor: menuBorderColor. ]. self layoutInset: 3. ! Item was changed: ----- Method: MorphHierarchyListMorph>>createContainer (in category 'private') ----- createContainer "Private - Create a container" | container | container := BorderedMorph new. container extent: (World extent * (1 / 4 @ (2 / 3))) rounded. container layoutPolicy: TableLayout new. container hResizing: #rigid. container vResizing: #rigid. container + setColor: MenuMorph menuColor + borderWidth: MenuMorph menuBorderWidth + borderColor: MenuMorph menuBorderColor. - setColor: Preferences menuColor - borderWidth: Preferences menuBorderWidth - borderColor: Preferences menuBorderColor. container layoutInset: 0. "container useRoundedCorners." "" container setProperty: #morphHierarchy toValue: true. container setNameTo: 'Objects Hierarchy' translated. "" ^ container! Item was changed: ----- Method: SelectionMorph>>defaultBorderColor (in category 'initialization') ----- defaultBorderColor "answer the default border color/fill style for the receiver" + ^ ( MenuMorph menuSelectionColor ifNil: [Color blue]) twiceDarker alpha: 0.75! - ^ (Preferences menuSelectionColor ifNil: [Color blue]) twiceDarker alpha: 0.75! Item was changed: ----- Method: SelectionMorph>>defaultColor (in category 'initialization') ----- defaultColor "answer the default color/fill style for the receiver" + ^ (MenuMorph menuSelectionColor ifNil: [Color blue]) alpha: 0.08 - ^ (Preferences menuSelectionColor ifNil: [Color blue]) alpha: 0.08 ! Item was changed: ----- Method: SimpleHierarchicalListMorph>>drawOn: (in category 'drawing') ----- drawOn: aCanvas super drawOn: aCanvas. selectedMorph ifNotNil: [aCanvas fillRectangle: (((scroller transformFrom: self) invertBoundsRect: selectedMorph bounds) intersect: scroller bounds) + color: MenuMorph menuSelectionColor]. - color: Preferences menuSelectionColor]. self drawLinesOn: aCanvas! Item was changed: ----- Method: SystemProgressBarMorph>>initialize (in category 'initialization') ----- initialize super initialize. self borderWidth: 0; + color: MenuMorph menuColor muchLighter. - color: Preferences menuColor muchLighter. barSize := 0. ! Item was changed: ----- Method: SystemProgressMorph>>setDefaultParameters (in category 'initialization') ----- setDefaultParameters "change the receiver's appareance parameters" | colorFromMenu worldColor menuColor | colorFromMenu := Preferences menuColorFromWorld and: [Display depth > 4 and: [(worldColor := self currentWorld color) isColor]]. menuColor := colorFromMenu ifTrue: [worldColor luminance > 0.7 ifTrue: [worldColor mixed: 0.85 with: Color black] ifFalse: [worldColor mixed: 0.4 with: Color white]] + ifFalse: [MenuMorph menuColor]. - ifFalse: [Preferences menuColor]. self color: menuColor. MenuMorph roundedMenuCorners ifTrue: [self useRoundedCorners]. + self borderWidth: MenuMorph menuBorderWidth. - self borderWidth: Preferences menuBorderWidth. Preferences menuAppearance3d ifTrue: [ self borderStyle: BorderStyle thinGray. self hasDropShadow: true. self useSoftDropShadow ifFalse: [ self shadowColor: (TranslucentColor r: 0.0 g: 0.0 b: 0.0 alpha: 0.666); shadowOffset: 1 @ 1] ifTrue: [ self shadowColor: (TranslucentColor r: 0.0 g: 0.0 b: 0.0 alpha: 0.01); shadowOffset: (10@8 corner: 10@12) ] ] ifFalse: [ | menuBorderColor | menuBorderColor := colorFromMenu ifTrue: [worldColor muchDarker] + ifFalse: [MenuMorph menuBorderColor]. - ifFalse: [Preferences menuBorderColor]. self borderColor: menuBorderColor. ]. self updateColor: self color: self color intensity: 1.! Item was changed: ----- Method: SystemWindow class>>updatePreferences (in category 'initializing') ----- updatePreferences "Temporary method to update system-wide preferences" Preferences installNormalWindowColors. Preferences setPreference: #menuAppearance3d toValue: true. (Preferences preferenceAt: #menuAppearance3d) defaultValue: true. Preferences setPreference: #menuColorFromWorld toValue: false. (Preferences preferenceAt: #menuColorFromWorld) defaultValue: false. MenuMorph roundedMenuCorners: false. + MenuMorph menuColor: (Color gray: 0.9). + MenuMorph menuTitleColor: (Color transparent). + MenuMorph menuTitleBorderWidth: 0. + Preferences + setParameter: #defaultWorldColor + to: (Color gray: 0.25). - Preferences setParameter: #menuColor to: (Color gray: 0.9). - Preferences setParameter: #menuTitleColor to: (Color transparent). - Preferences setParameter: #menuTitleBorderWidth to: 0. - Preferences setParameter: #defaultWorldColor to: (Color gray: 0.25). Preferences setPreference: #showSplitterHandles toValue: false. (Preferences preferenceAt: #showSplitterHandles) defaultValue: true. Preferences setPreference: #showSharedFlaps toValue: false. (Preferences preferenceAt: #showSharedFlaps) defaultValue: false. CornerGripMorph drawCornerResizeHandles: false. FillInTheBlankMorph roundedDialogCorners: true. LazyListMorph listSelectionColor: LazyListMorph listSelectionColor; listSelectionTextColor: Color black. PluggableButtonMorph roundedButtonCorners: true. SystemWindow clickOnLabelToEdit: false; doubleClickOnLabelToExpand: true; moveMenuButtonRight: true; hideExpandButton: false.! Item was changed: ----- Method: SystemWindow>>openInWorldExtent: (in category 'open/close') ----- openInWorldExtent: extent "This msg and its callees result in the window being activeOnlyOnTop" ^ self openInWorld: self currentWorld extent: extent! Item was changed: ----- Method: TheWorldMainDockingBar>>colorIcon: (in category 'private') ----- colorIcon: aColor "Guess if 'uniform window colors' are used and avoid all icons to be just gray" (aColor = Preferences uniformWindowColor or: [Preferences tinyDisplay]) ifTrue: [ ^nil ]. ^(aColor iconOrThumbnailOfSize: 14) + borderWidth: 3 color: MenuMorph menuColor muchDarker; - borderWidth: 3 color: Preferences menuColor muchDarker; borderWidth: 2 color: Color transparent! Item was changed: ----- Method: TheWorldMainDockingBar>>createDockingBar (in category 'construction') ----- createDockingBar "Create a docking bar from the receiver's representation" | dockingBar | dockingBar := DockingBarMorph new adhereToTop; + color: MenuMorph menuColor; - color: Preferences menuColor; gradientRamp: self gradientRamp; autoGradient: MenuMorph gradientMenu; borderWidth: 0. self fillDockingBar: dockingBar. self labelIfNeeded: dockingBar. ^ dockingBar! Item was changed: ----- Method: TheWorldMainDockingBar>>gradientRamp (in category 'private') ----- gradientRamp ^{ 0.0 -> Color white. + 1.0 -> MenuMorph menuColor darker }! - 1.0 -> Preferences menuColor darker }! |
Free forum by Nabble | Edit this page |