[squeak-dev] The Trunk: PreferenceBrowser-mt.63.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Aug 1 15:18:16 UTC 2016


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

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

Name: PreferenceBrowser-mt.63
Author: mt
Time: 1 August 2016, 5:18:07.719106 pm
UUID: b534f79f-adbf-164f-80c0-4eb1c4740b8d
Ancestors: PreferenceBrowser-mt.62

Fixes the appearance of the preference browser considering themes.

There are still some UI glitches, but at least a freshly opened preference browser looks now like the current UI theme suggests it.

Yeah, we borrow UI properties from the PluggableListMorph because the whole preference browser is subject to refactoring in the future. (Sorry for this small hack. Kids, do not use UserInterfaceTheme like that! Look away! Hurry! What's that? Ice cream? Ice cream!)

=============== Diff against PreferenceBrowser-mt.62 ===============

Item was changed:
  ----- Method: PBBooleanPreferenceView>>enabledButton (in category 'user interface') -----
  enabledButton
+ 	| aButton |
- 	| aButton aLabel |
  	aButton := UpdatingThreePhaseButtonMorph checkBox
  		target: self preference;
  		actionSelector: #togglePreferenceValue;
  		getSelector: #preferenceValue;
+ 		label: 'enabled' translated;
  		yourself.
- 	aLabel := (StringMorph contents: 'enabled' translated
- 				font: (StrikeFont familyName: TextStyle defaultFont familyName
- 							pointSize: TextStyle defaultFont pointSize - 1)).
  	^self horizontalPanel
  		addMorphBack: aButton;
- 		addMorphBack: aLabel;
  		yourself.!

Item was changed:
  ----- Method: PBBooleanPreferenceView>>localToProjectButton (in category 'user interface') -----
  localToProjectButton
+ 	| aButton |
- 	| aButton aLabel |
  	aButton := UpdatingThreePhaseButtonMorph checkBox
  		target: self preference;
  		actionSelector: #toggleProjectLocalness;
  		getSelector: #localToProject;
+ 		label: 'local' translated;
  		yourself.
- 	aLabel := (StringMorph contents: 'local' translated
- 				font: (StrikeFont familyName: TextStyle defaultFont familyName
- 							pointSize: TextStyle defaultFont pointSize - 1)).		
  	^self horizontalPanel
  		addMorphBack: aButton;
- 		addMorphBack: aLabel;
  		yourself.!

Item was changed:
  ----- Method: PBBooleanPreferenceView>>representativeButtonWithColor:inPanel: (in category 'user interface') -----
  representativeButtonWithColor: aColor inPanel: aPreferencesPanel
  	^self horizontalPanel
  		layoutInset: 2;
  		cellInset: 7;
  		color: aColor;
+ 		addMorphBack: self morphForName;
- 		addMorphBack: (StringMorph contents: self preference name);
  		addMorphBack: self horizontalFiller; 
  		addMorphBack: self enabledButton;
  		addMorphBack: self localToProjectButton;
  		yourself.!

Item was changed:
  ----- Method: PBColorPreferenceView>>representativeButtonWithColor:inPanel: (in category 'user interface') -----
  representativeButtonWithColor: aColor inPanel: aPreferenceBrowser
  	^self horizontalPanel
  		layoutInset: 2;
  		color: aColor;
  		cellInset: 20;
  		cellPositioning: #center;
+ 		addMorphBack: self morphForName;
- 		addMorphBack: (StringMorph contents: self preference name);
  		addMorphBack: self horizontalFiller;
  		addMorphBack: self colorMenuButton;
  		yourself!

Item was changed:
  ----- Method: PBHaloThemePreferenceView>>representativeButtonWithColor:inPanel: (in category 'user interface') -----
  representativeButtonWithColor: aColor inPanel: aPreferencesPanel
  	| innerPanel |
  	innerPanel := self horizontalPanel
  		addMorphBack: (self blankSpaceOf: 10 at 0);
  		addMorphBack: self haloThemeRadioButtons;
  		yourself.
  	^self verticalPanel
  		color: aColor;
  		layoutInset: 2;
+ 		addMorphBack: self morphForName;
- 		addMorphBack: (StringMorph contents: self preference name);
  		addMorphBack: innerPanel.!

Item was changed:
  ----- Method: PBNumericPreferenceView>>representativeButtonWithColor:inPanel: (in category 'user interface') -----
  representativeButtonWithColor: aColor inPanel: aPreferenceBrowser
  	^self horizontalPanel
  		layoutInset: 2;
  		color: aColor;
  		cellInset: 20;
  		cellPositioning: #center;
+ 		addMorphBack: self morphForName;
- 		addMorphBack: (StringMorph contents: self preference name);
  		addMorphBack: self horizontalFiller;
  		addMorphBack: self textField;
  		yourself.!

Item was changed:
  ----- Method: PBNumericPreferenceView>>textField (in category 'user interface') -----
  textField
  	^(PluggableTextMorph
  		on: self
  		text: #preferenceValue
  		accept: #preferenceValue:)
  			hideScrollBarsIndefinitely;
- 			borderColor: #inset;
  			acceptOnCR: true;
- 			color: Color gray veryMuchLighter;
  			vResizing: #rigid;
  			hResizing: #spaceFill;
  			height: TextStyle defaultFont height + 6;
  			yourself.!

Item was changed:
  ----- Method: PBPreferenceButtonMorph>>highlightOff (in category 'highlighting') -----
  highlightOff
  	self beTransparent.
+ 	self label
+ 		color: ((UserInterfaceTheme current get: #textColor for: PluggableListMorph) ifNil: [Color black]);
+ 		font: ((UserInterfaceTheme current get: #font for: PluggableListMorph) ifNil: [TextStyle defaultFont]).
- 	self label color: Color black.
  	self removeExtraControls.!

Item was changed:
  ----- Method: PBPreferenceButtonMorph>>highlightOn (in category 'highlighting') -----
  highlightOn
  	
+ 	self color: ((UserInterfaceTheme current get: #selectionColor for: PluggableListMorph) ifNil: [Color gray alpha: 0.1]).
+ 
+ 	self label
+ 		color: ((UserInterfaceTheme current get: #selectionTextColor for: PluggableListMorph) ifNil: [Color black]);
+ 		font: ((UserInterfaceTheme current get: #font for: PluggableListMorph) ifNil: [TextStyle defaultFont]).
+ 		
- 	self color: (Color gray alpha: 0.1).
- 	
  	self addExtraControls.!

Item was changed:
  ----- Method: PBPreferenceButtonMorph>>preferenceHelpText (in category 'preference accessing') -----
  preferenceHelpText
  	^self preferenceHelp asText
  		addAttribute: TextEmphasis italic;
+ 		addAttribute: (TextColor color: ((UserInterfaceTheme current get: #textColor for: PluggableListMorph) ifNil: [Color black]));
  		yourself.!

Item was changed:
  ----- Method: PBTextPreferenceView>>representativeButtonWithColor:inPanel: (in category 'user interface') -----
  representativeButtonWithColor: aColor inPanel: aPreferenceBrowser
  	^self horizontalPanel
  		layoutInset: 2;
  		color: aColor;
  		cellInset: 20;
  		cellPositioning: #center;
+ 		addMorphBack: self morphForName;
- 		addMorphBack: (StringMorph contents: self preference name);
  		addMorphBack: self textField;
  		yourself.!

Item was changed:
  ----- Method: PreferenceBrowserMorph>>basicButton (in category 'submorphs - buttons') -----
  basicButton
+ 
+ 	^ PluggableButtonMorph new
+ 		model: self model;
+ 		offColor: self paneColor;
+ 		hResizing: #shrinkWrap;
+ 		layoutInset: (15 at 5 corner: 15 at 5);
+ 		yourself!
- 	| button |
- 	button := SimpleButtonMorph new.
- 	button
- 		borderWidth: 2;
- 		borderColor: #raised;
- 		on: #mouseEnter send: #value to: [button borderColor: self paneColor];
- 		on: #mouseLeave send: #value to: [button borderColor: #raised];
- 		vResizing: #spaceFill;
- 		useRoundedCorners;
- 		clipSubmorphs: true;
- 		color: self paneColor muchLighter;
- 		target: self model.
- 	^button!

Item was changed:
  ----- Method: PreferenceBrowserMorph>>defaultButton (in category 'submorphs - buttons') -----
  defaultButton
  	^defaultButton ifNil: 
  		[defaultButton := self basicButton 
  						label: 'default' translated; 
+ 						action: #defaultSelected;						
- 						actionSelector: #defaultSelected;						
  						setBalloonText: 
  							'Click here to reset all the preferences to their standard ',
  							'default values.' translated]!

Item was changed:
  ----- Method: PreferenceBrowserMorph>>helpButton (in category 'submorphs - buttons') -----
  helpButton
  	^helpButton ifNil: 
  		[helpButton := self basicButton 
  						label: 'help' translated; 
  						setBalloonText: 
  							'Click here to get some hints on use of this Preferences ',
  							'Panel' translated;
+ 						action: #helpSelected]!
- 						actionSelector: #helpSelected]!

Item was changed:
  ----- Method: PreferenceBrowserMorph>>loadButton (in category 'submorphs - buttons') -----
  loadButton
  	^loadButton ifNil: 
  		[loadButton := self basicButton 
  						label: 'load' translated; 
+ 						action: #loadSelected;						
- 						actionSelector: #loadSelected;						
  						setBalloonText: 
  							'Click here to reset all the preferences to their values ',
  							'in your Personal Preferences.' translated]!

Item was changed:
  ----- Method: PreferenceBrowserMorph>>loadFromDiskButton (in category 'submorphs - buttons') -----
  loadFromDiskButton
  	^loadFromDiskButton ifNil: 
  		[loadFromDiskButton := self basicButton 
  						label: 'load from disk' translated; 
+ 						action: #loadFromDiskSelected;						
- 						actionSelector: #loadFromDiskSelected;						
  						setBalloonText: 
  							'Click here to load all the preferences from ',
  							'their saved values on disk.' translated]!

Item was changed:
  ----- Method: PreferenceBrowserMorph>>newCategoryList (in category 'submorphs - category list') -----
  newCategoryList 
  	^(PluggableListMorph
  		on: self model
  		list: #categoryList
  		selected: #selectedCategoryIndex
  		changeSelected: #selectedCategoryIndex:)
- 			color: Color white;
- 			borderInset;
  			hResizing: #spaceFill;
  			vResizing: #spaceFill;
  			layoutFrame: (LayoutFrame fractions: (0 at 0 corner: 0.25 at 1));
  			yourself.!

Item was changed:
  ----- Method: PreferenceBrowserMorph>>newSearchTextField (in category 'submorphs - search panel') -----
  newSearchTextField
  	
  	| ptm  |
  	ptm := PluggableTextMorphPlus
  		on: self model
  		text: #searchPatternNeverTriggered
  		accept: #searchPattern:.
  	
  	ptm
  		minimumHeight: 0;
  		balloonText: 'Search preferences ...';
  		hideScrollBarsIndefinitely;
  		layoutFrame: (LayoutFrame fractions: (0 at 0 corner: 1 at 0) offsets: (0 at 0 corner: 0@ (TextStyle default lineGrid * 2)));
  		borderInset;
- 		color: Color white;
  		vResizing: #spaceFill;
  		hResizing: #spaceFill;
  		acceptOnCR: true;
  		onKeyStrokeSend: #value to: [ ptm hasUnacceptedEdits ifTrue: [ ptm accept ] ].
  	^ptm.!

Item was changed:
  ----- Method: PreferenceBrowserMorph>>preferenceList (in category 'submorphs - preference list') -----
  preferenceList 
  	^preferenceList ifNil:
  		[preferenceList := ScrollPane new
- 			color: Color white;
- 			borderInset;
  			vResizing: #spaceFill;
  			hResizing: #spaceFill;
+ 			layoutFrame: (LayoutFrame fractions: (0.25 at 0 corner: 1 at 1) offsets: (4 at 0 corner: 0 at 0)).
- 			layoutFrame: (LayoutFrame fractions: (0.25 at 0 corner: 1 at 1)).
  		preferenceList scroller
- 			on: #mouseEnter send: #value: 
- 				to: [:event | event hand newKeyboardFocus: preferenceList scroller];
  			on: #keyStroke send: #keyPressed: to: self.
  		preferenceList.]!

Item was changed:
  ----- Method: PreferenceBrowserMorph>>saveButton (in category 'submorphs - buttons') -----
  saveButton
  	^saveButton ifNil: 
  		[saveButton := self basicButton 
  						label: 'save' translated; 
+ 						action: #saveSelected;						
- 						actionSelector: #saveSelected;						
  						setBalloonText: 
  							'Click here to save the current constellation of Preferences ',
  							'settings as your personal defaults; you can get them all ',
  							'reinstalled with a single gesture by clicking the "Restore ',
  							'my Personal Preferences".' translated]!

Item was changed:
  ----- Method: PreferenceBrowserMorph>>saveToDiskButton (in category 'submorphs - buttons') -----
  saveToDiskButton
  	^saveToDiskButton ifNil: 
  		[saveToDiskButton := self basicButton 
  						label: 'save to disk' translated; 
+ 						action: #saveToDiskSelected;						
- 						actionSelector: #saveToDiskSelected;						
  						setBalloonText: 
  							'Click here to save the current constellation of Preferences ',
  							'settings to a file; you can get them all reinstalled with a ', 
  							'single gesture by clicking "Restore Settings From Disk".'
  								 translated]!

Item was changed:
  ----- Method: PreferenceBrowserMorph>>themeButton (in category 'submorphs - buttons') -----
  themeButton
  	^themeButton ifNil: 
  		[themeButton := self basicButton 
  						label: 'theme...' translated; 
+ 						action: #themeSelected;
- 						actionSelector: #themeSelected;
  						setBalloonText: 
  							'Numerous "Preferences" govern many things about the ',
  							'way Squeak looks and behaves.  Set individual preferences ',
  							'using a "Preferences" panel.  Set an entire "theme" of many ',
  							'Preferences all at the same time by pressing this "change ',
  							'theme" button and choosing a theme to install.  Look in ',
  							'category "themes" in Preferences class to see what each ', 
  							'theme does; add your own methods to the "themes" ',
  							'category and they will show up in the list of theme ',
  							'choices.' translated].!

Item was added:
+ ----- Method: PreferenceView>>morphForName (in category 'user interface') -----
+ morphForName
+ 
+ 	^ ((StringMorph contents: self preference name)
+ 			color: ((UserInterfaceTheme current get: #textColor for: PluggableListMorph) ifNil: [Color black]);
+ 			font: ((UserInterfaceTheme current get: #font for: PluggableListMorph) ifNil: [TextStyle defaultFont]);
+ 			yourself)!

Item was changed:
  ----- Method: PreferenceView>>tearOffButton (in category 'user interface') -----
  tearOffButton
  	"Hand the user a button the can control this"
  
  	| aButton |
+ 	aButton := self representativeButtonWithColor: ((UserInterfaceTheme current get: #uniformWindowColor for: Model) ifNil: [Color white]) inPanel: nil.
- 	aButton := self representativeButtonWithColor: Color white inPanel: nil.
  	aButton borderWidth: 1; borderColor:  Color black; useRoundedCorners.
  	aButton openInHand!



More information about the Squeak-dev mailing list