[Pkg] The Trunk: Morphic-mt.1208.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Jul 31 08:28:27 UTC 2016


Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1208.mcz

==================== Summary ====================

Name: Morphic-mt.1208
Author: mt
Time: 31 July 2016, 10:27:47.31449 am
UUID: e9b6775b-a536-0145-9d2f-ef874b6e84f4
Ancestors: Morphic-mt.1207

*** Widget Refactorings and UI Themes (Part 2 of 11) ***

Simplify window colors and prepare them and other properties of system windows to be themed.

=============== Diff against Morphic-mt.1207 ===============

Item was changed:
  ----- Method: CornerGripMorph class>>activeColor (in category 'handle settings') -----
  activeColor
  	<preference: 'Corner Grip highlight color'
+ 		category: 'colors'
- 		category: 'window colors'
  		description: 'The highlight-color of window corners'
  		type: #Color>
  	^(self activeForm colorAt: 24 at 24) alpha:  1!

Item was changed:
  ----- Method: CornerGripMorph class>>passiveColor (in category 'handle settings') -----
  passiveColor
  	<preference: 'Corner Grip color'
+ 		category: 'colors'
- 		category: 'window colors'
  		description: 'The default color of window corners'
  		type: #Color>
  	^(self passiveForm colorAt: 24 at 24) alpha:  1!

Item was changed:
  ----- Method: Morph>>embeddedInMorphicWindowLabeled: (in category 'e-toy support') -----
  embeddedInMorphicWindowLabeled: labelString
  	| window |
  	window := (SystemWindow labelled: labelString) model: nil.
+ 	window setStripeColorsFrom: Color white.
- 	window setStripeColorsFrom: nil defaultBackgroundColor.
  	window addMorph: self frame: (0 at 0 extent: 1 at 1).
  	^ window!

Item was added:
+ ----- Method: SystemWindow class>>themeProperties (in category 'preferences') -----
+ themeProperties
+ 
+ 	^ super themeProperties, {	
+ 		{ #borderColorModifier. 'Colors'. 'How to derive the borderColor from the window color.' }.
+ 		{ #borderWidth. 'Borders'. 'Width of the menu''s border.' }.
+ 		{ #titleFont. 'Fonts'. 'Font of the window title.' }.
+ 		
+ 		{ #unfocusedWindowColorModifier. 'Colors'. 'A block with one argument that modifies a color to look unfocused.' }.
+ 		{ #unfocusedLabelColor. 'Colors'. 'Window title color when window has no focus.'}.
+ 		{ #focusedLabelColor. 'Colors'. 'Window title color when window has focus.'}.
+ 	}!

Item was removed:
- ----- Method: SystemWindow>>adoptPaneColor: (in category 'colors') -----
- adoptPaneColor: aPaneColor
- 
- 	super adoptPaneColor: (self class gradientWindow
- 		ifTrue: [aPaneColor ifNotNil: [:c | c duller]]
- 		ifFalse: [aPaneColor]).!

Item was added:
+ ----- Method: SystemWindow>>applyUserInterfaceTheme (in category 'user interface') -----
+ applyUserInterfaceTheme
+ 
+ 	super applyUserInterfaceTheme.
+ 	
+ 	self
+ 		setDefaultParameters;
+ 		refreshWindowColor.
+ 
+ 	self isLookingFocused
+ 		ifTrue: [self lookUnfocused; lookFocused]
+ 		ifFalse: [self lookFocused; lookUnfocused].
+ 		
+ 	self isCollapsed ifTrue: [self setProperty: #applyTheme toValue: true].!

Item was changed:
  ----- Method: SystemWindow>>collapseOrExpand (in category 'resize/collapse') -----
  collapseOrExpand
  	"Collapse or expand the window, depending on existing state"
  	| cf |
  	isCollapsed
  		ifTrue: 
  			["Expand -- restore panes to morphics structure"
  			isCollapsed := false.
  			self beKeyWindow.  "Bring to frint first"
  			Preferences collapseWindowsInPlace
  				ifTrue: 
  					[fullFrame := fullFrame align: fullFrame topLeft with: self getBoundsWithFlex topLeft]
  				ifFalse:
  					[collapsedFrame := self getBoundsWithFlex].
  			collapseBox ifNotNil: [collapseBox setBalloonText: 'collapse this window' translated].
  			self setBoundsWithFlex: fullFrame.
  			paneMorphs reverseDo: 
  					[:m |  self addMorph: m unlock.
  					self world startSteppingSubmorphsOf: m].
+ 			self addPaneSplitters.
+ 			(self hasProperty: #applyTheme) ifTrue: [
+ 				self removeProperty: #applyTheme.
+ 				self userInterfaceTheme applyTo: self allMorphs]]
- 			self addPaneSplitters]
  		ifFalse: 
  			["Collapse -- remove panes from morphics structure"
  			isCollapsed := true.
  			fullFrame := self getBoundsWithFlex.
  			"First save latest fullFrame"
  			paneMorphs do: [:m | m delete; releaseCachedState].
  			self removePaneSplitters.
  			self removeCornerGrips.
  			model modelSleep.
  			cf := self getCollapsedFrame.
  			(collapsedFrame isNil and: [Preferences collapseWindowsInPlace not]) ifTrue:
  				[collapsedFrame := cf].
  			self setBoundsWithFlex: cf.
  			collapseBox ifNotNil: [collapseBox setBalloonText: 'expand this window' translated ].
  			expandBox ifNotNil: [expandBox setBalloonText: 'expand this window' translated ].
  			self sendToBack].
  	self layoutChanged!

Item was removed:
- ----- Method: SystemWindow>>defaultBorderColor (in category 'initialization') -----
- defaultBorderColor
- 	"answer the default border color/fill style for the receiver"
- 	^ self defaultColor muchDarker!

Item was removed:
- ----- Method: SystemWindow>>defaultBorderWidth (in category 'initialization') -----
- defaultBorderWidth
- 	"answer the default border width for the receiver"
- 	^ 1!

Item was removed:
- ----- Method: SystemWindow>>defaultColor (in category 'initialization') -----
- defaultColor
- 	"answer the default color/fill style for the receiver"
- 	^ Preferences uniformWindowColor!

Item was changed:
  ----- Method: SystemWindow>>gradientWithColor: (in category 'colors') -----
  gradientWithColor: aColor
  
+ 	| gradient cc |
+ 	cc := aColor adjustSaturation: -0.08 brightness: 0.4.
- 	| gradient |
  	gradient := GradientFillStyle ramp: {
+ 		0.0 -> (self isKeyWindow ifTrue: [cc muchLighter] ifFalse: [cc]). 
+ 		0.25 -> (aColor mixed: 0.5 with: cc). 
+ 		1.0 -> aColor.
- 		0.0 -> Color white. 
- 		0.2 -> (aColor duller mixed: 0.5 with: (Color gray: 0.9)) lighter. 
- 		1.0 -> aColor duller.
  	}.
  	gradient origin: self topLeft.
  	gradient direction: 0 @ self labelHeight.
  	^gradient!

Item was changed:
  ----- Method: SystemWindow>>initializeLabelArea (in category 'initialization') -----
  initializeLabelArea
  	"Initialize the label area (titlebar) for the window."
  	
  	labelString ifNil: [labelString := 'Untitled Window'].
+ 	label := StringMorph new contents: labelString.
- 	label := StringMorph new contents: labelString;
- 						 font: Preferences windowTitleFont emphasis: 0.
  			"Add collapse box so #labelHeight will work"
  			collapseBox := self createCollapseBox.
  			stripes := Array
  						with: (RectangleMorph newBounds: bounds)
  						with: (RectangleMorph newBounds: bounds).
  			"see extent:"
  			self addLabelArea.
  			self setLabelWidgetAllowance.
  			self addCloseBox.
  			self class moveMenuButtonRight 
  				ifTrue: [self addLabel. self addMenuControl]
  				ifFalse: [self addMenuControl. self addLabel].
  			self addExpandBox.
  			labelArea addMorphBack: collapseBox.
  			self setFramesForLabelArea.
  			Preferences noviceMode
  				ifTrue: [closeBox
  						ifNotNil: [closeBox setBalloonText: 'close window'].
  					menuBox
  						ifNotNil: [menuBox setBalloonText: 'window menu'].
  					collapseBox
  						ifNotNil: [collapseBox setBalloonText: 'collapse/expand window']].
  !

Item was changed:
  ----- Method: SystemWindow>>lookFocused (in category 'focus') -----
  lookFocused
  
  	"Optimize performance."
  	self isLookingFocused ifTrue: [^ self].
  	self isLookingFocused: true.
  
+ 	label ifNotNil: [ label color: (self userInterfaceTheme focusedLabelColor ifNil: [Color black]) ].
- 	label ifNotNil: [ label color: Color black ].
  	
  	(self isKeyWindow or: [self class windowTitleActiveOnFirstClick])
  		ifTrue: [self undimWindowButtons].
  		
  	self paneColorToUse in: [ : col |
  		self
  			 setStripeColorsFrom: col ;
  			 adoptPaneColor: col].!

Item was changed:
  ----- Method: SystemWindow>>lookUnfocused (in category 'focus') -----
  lookUnfocused
  
  	"Optimize performance."
  	self isLookingFocused ifFalse: [^ self].
  	self isLookingFocused: false.
  
+ 	label ifNotNil: [ label color: (self userInterfaceTheme unfocusedLabelColor ifNil: [Color darkGray]) ].
- 	label ifNotNil: [ label color: Color darkGray ].
  	self dimWindowButtons.
  	self paneColorToUseWhenNotActive in: [ : col |
  		self
  			 setStripeColorsFrom: col ;
  			 adoptPaneColor: col ]!

Item was changed:
  ----- Method: SystemWindow>>paneColor (in category 'colors') -----
  paneColor
  	| cc |
  	(cc := self valueOfProperty: #paneColor) ifNotNil: [^cc].
+ 	model notNil ifTrue: [cc := model windowColorToUse].
+ 	cc ifNil: [cc := paneMorphs isEmptyOrNil ifFalse: [paneMorphs first color]].
+ 	cc ifNil: [cc := self defaultColor].
- 	Display depth > 2 
- 		ifTrue: 
- 			[model ifNotNil: 
- 					[model isInMemory 
- 						ifTrue: 
- 							[cc := Color colorFrom: model defaultBackgroundColor]].
- 	cc ifNil: [cc := paneMorphs isEmptyOrNil ifFalse: [paneMorphs first color]]].
- 	cc ifNil: [cc := self defaultBackgroundColor].
  	self paneColor: cc.
  	^cc!

Item was changed:
  ----- Method: SystemWindow>>paneColorToUseWhenNotActive (in category 'colors') -----
  paneColorToUseWhenNotActive
  
+ 	^ (self userInterfaceTheme unfocusedWindowColorModifier ifNil: [ [:color | color darker] ])
+ 		value: self paneColorToUse!
- 	^ self paneColorToUse darker!

Item was changed:
  ----- Method: SystemWindow>>setDefaultParameters (in category 'initialization') -----
  setDefaultParameters
  
  	Preferences menuAppearance3d ifTrue: [
+ 		self addDropShadow.
+ 		self hasDropShadow: self isKeyWindow. "maybe turn off again"].
+ 	
+ 	self borderWidth: (self userInterfaceTheme borderWidth ifNil: [1]).
+ 	label font: (self userInterfaceTheme titleFont ifNil: [TextStyle defaultFont]).!
- 		self hasDropShadow: self isKeyWindow.
- 		
- 		self useSoftDropShadow
- 			ifTrue: [	
- 				self
- 					shadowColor: (TranslucentColor r: 0.0 g: 0.0 b: 0.0 alpha: 0.01);
- 					shadowOffset: (10 at 8 corner: 10 at 12)]
- 			ifFalse: [
- 				self
- 					shadowColor: (TranslucentColor r: 0.0 g: 0.0 b: 0.0 alpha: 0.333);
- 					shadowOffset: 1 at 1] ].
- 	self changed.!

Item was removed:
- ----- Method: SystemWindow>>setLabelFont: (in category 'label') -----
- setLabelFont: aFont
- 
- 	label ifNil: [^ self].
- 	label font: aFont.
- !

Item was changed:
  ----- Method: SystemWindow>>setStripeColorsFrom: (in category 'colors') -----
  setStripeColorsFrom: paneColor 
  	"Set the stripe color based on the given paneColor"
  
  	labelArea ifNotNil: [labelArea color: Color transparent].
  	self updateBoxesColor: paneColor.
  	stripes ifNil: [^self].
  
+ 	self borderColor: ((self userInterfaceTheme borderColorModifier ifNil: [ [:c | c adjustBrightness: -0.3] ])
+ 							value: paneColor).
- 	self borderColor: (paneColor adjustBrightness: -0.3).
  
  	self class gradientWindow
  		ifTrue: [self fillStyle: (self gradientWithColor: paneColor)]
  		ifFalse: [self color: paneColor].!

Item was changed:
  ----- Method: TheWorldMainDockingBar>>browserMenuItemOn: (in category 'submenu - tools') -----
  browserMenuItemOn: menu
  
  	menu addItem: [ :item |
  		item
  			contents: 'Browser' translated;
  			help: 'Open a browser' translated;
+ 			icon: (self colorIcon: Browser basicNew windowColorToUse);
- 			icon: (self colorIcon: Preferences browserWindowColor);
  			target: StandardToolSet;
  			selector: #openClassBrowser ]!

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 = (UserInterfaceTheme current get: #uniformWindowColor for: Model) or: [Preferences tinyDisplay]) ifTrue: [ ^nil ].
- 	(aColor = Preferences uniformWindowColor or: [Preferences tinyDisplay]) ifTrue: [ ^nil ].
  	^(aColor iconOrThumbnailOfSize: 14)
  		borderWidth: 3 color: MenuMorph menuColor muchDarker;
  		borderWidth: 2 color: Color transparent!

Item was changed:
  ----- Method: TheWorldMainDockingBar>>dualChangeSorterMenuItemOn: (in category 'submenu - tools') -----
  dualChangeSorterMenuItemOn: menu
  
  	menu addItem: [ :item |
  		item
  			contents: 'Dual Change Sorter' translated;
  			help: 'Open a Dual Change Sorter' translated;
+ 			icon: (self colorIcon: ChangeSorter basicNew windowColorToUse);
- 			icon: (self colorIcon: ChangeSorter basicNew defaultBackgroundColor);
  			target: DualChangeSorter;
  			selector: #open ]!

Item was changed:
  ----- Method: TheWorldMainDockingBar>>fileListMenuItemOn: (in category 'submenu - tools') -----
  fileListMenuItemOn: menu
  
  	menu addItem: [ :item |
  		item
  			contents: 'File List' translated;
  			help: 'Open a file list' translated;
+ 			icon: (self colorIcon: FileList basicNew windowColorToUse);
- 			icon: (self colorIcon: Preferences fileListWindowColor);
  			target: StandardToolSet;
  			selector: #openFileList ]!

Item was changed:
  ----- Method: TheWorldMainDockingBar>>methodFinderMenuItemOn: (in category 'submenu - tools') -----
  methodFinderMenuItemOn: menu 
  
  	menu addItem: [:item | 
  		item 
  			contents: 'Method Finder' translated;
  			help: 'Open the Method Finder' translated;
+ 			icon: (self colorIcon: SelectorBrowser basicNew windowColorToUse);
- 			icon: (self colorIcon: Preferences methodFinderWindowColor);
  			target: StandardToolSet;
  			selector: #openSelectorBrowser]!

Item was changed:
  ----- Method: TheWorldMainDockingBar>>monticelloBrowserMenuItemOn: (in category 'submenu - tools') -----
  monticelloBrowserMenuItemOn: menu
  
  	menu addItem: [ :item |
  		item
  			contents: 'Monticello Browser' translated;
  			help: 'Open a Monticello Browser' translated;
+ 			icon: (self colorIcon: MCTool basicNew windowColorToUse);
- 			icon: (self colorIcon: MCTool basicNew defaultBackgroundColor);
  			target: MCWorkingCopyBrowser;
  			selector: #open ]!

Item was changed:
  ----- Method: TheWorldMainDockingBar>>monticelloConfigurationsMenuItemOn: (in category 'submenu - tools') -----
  monticelloConfigurationsMenuItemOn: menu
  
  	menu addItem: [ :item |
  		item
  			contents: 'Monticello Configurations' translated;
  			help: 'Open a Monticello Configurations Editor' translated;
+ 			icon: (self colorIcon: MCConfigurationBrowser basicNew windowColorToUse);
- 			icon: (self colorIcon: MCConfigurationBrowser basicNew defaultBackgroundColor);
  			target: MCConfigurationBrowser;
  			selector: #open ]!

Item was changed:
  ----- Method: TheWorldMainDockingBar>>preferenceBrowserMenuItemOn: (in category 'submenu - tools') -----
  preferenceBrowserMenuItemOn: menu
  	Smalltalk at: #PreferenceBrowser ifPresent:[:pb|
  		menu addItem: [ :item |
  			item
  				contents: 'Preferences' translated;
  				help: 'Open a Preferences Browser' translated;
+ 				icon: (self colorIcon: pb basicNew windowColorToUse);
- 				icon: (self colorIcon: pb basicNew defaultBackgroundColor);
  				target: pb;
  				selector: #open ]
  	].!

Item was changed:
  ----- Method: TheWorldMainDockingBar>>processBrowserMenuItemOn: (in category 'submenu - tools') -----
  processBrowserMenuItemOn: menu
  
  	menu addItem: [ :item |
  		item
  			contents: 'Process Browser' translated;
  			help: 'Open a Process Browser' translated;
+ 			icon: (self colorIcon: ProcessBrowser basicNew windowColorToUse);
- 			icon: (self colorIcon: ProcessBrowser basicNew defaultBackgroundColor);
  			target: ProcessBrowser;
  			selector: #open ]!

Item was changed:
  ----- Method: TheWorldMainDockingBar>>simpleChangeSorterMenuItemOn: (in category 'submenu - tools') -----
  simpleChangeSorterMenuItemOn: menu
  
  	menu addItem: [ :item |
  		item
  			contents: 'Simple Change Sorter' translated;
  			help: 'Open a Change Sorter' translated;
+ 			icon: (self colorIcon: ChangeSorter basicNew windowColorToUse);
- 			icon: (self colorIcon: ChangeSorter basicNew defaultBackgroundColor);
  			target: ChangeSorter;
  			selector: #open ]!

Item was changed:
  ----- Method: TheWorldMainDockingBar>>testRunnerMenuItemOn: (in category 'submenu - tools') -----
  testRunnerMenuItemOn: menu
  	Smalltalk at: #TestRunner ifPresent:[:aClass|
  		menu addItem: [ :item |
  			item
  				contents: 'Test Runner' translated;
  				help: 'Open the Test Runner' translated;
+ 				icon: (self colorIcon: aClass basicNew windowColorToUse);
- 				icon: (self colorIcon: aClass basicNew defaultBackgroundColor);
  				target: aClass;
  				selector: #open ]
  	].!

Item was changed:
  ----- Method: TheWorldMainDockingBar>>transcriptMenuItemOn: (in category 'submenu - tools') -----
  transcriptMenuItemOn: menu
  
  	menu addItem: [ :item |
  		item
  			contents: 'Transcript' translated;
  			help: 'Open the Transcript' translated;
+ 			icon: (self colorIcon: Transcript windowColorToUse);
- 			icon: (self colorIcon: Preferences transcriptWindowColor);
  			target: Transcript;
  			selector: #open ]!

Item was changed:
  ----- Method: TheWorldMainDockingBar>>workspaceMenuItemOn: (in category 'submenu - tools') -----
  workspaceMenuItemOn: menu
  
  	menu addItem: [ :item |
  		item
  			contents: 'Workspace' translated;
  			help: 'Open a Workspace' translated;
+ 			icon: (self colorIcon: Workspace basicNew windowColorToUse);
- 			icon: (self colorIcon: Preferences workspaceWindowColor);
  			target: StandardToolSet;
  			selector: #openWorkspace ]!

Item was changed:
+ (PackageInfo named: 'Morphic') postscript: 'TheWorldMainDockingBar updateInstances. "..."'!
- (PackageInfo named: 'Morphic') postscript: 'TheWorldMainDockingBar updateInstances.'!



More information about the Packages mailing list