[squeak-dev] The Trunk: System-tpr.964.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Sep 25 19:03:41 UTC 2017


tim Rowledge uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-tpr.964.mcz

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

Name: System-tpr.964
Author: tpr
Time: 25 September 2017, 12:03:05.473661 pm
UUID: ee9898d1-8279-4c25-b78c-f423cf7eb408
Ancestors: System-mt.963

A proposed improvement to the class comment to reflect recent changes, along with adding the most basic property setting message to the request instances. 
I suggest that there are a number of other messages that ought to be passed along in a similar manner but others are likely to have a better idea of the right ones.

=============== Diff against System-mt.963 ===============

Item was changed:
  Object subclass: #UserInterfaceTheme
  	instanceVariableNames: 'properties name next ignoreApply lastScaleFactor'
  	classVariableNames: 'All Current Default'
  	poolDictionaries: ''
  	category: 'System-Support'!
  
+ !UserInterfaceTheme commentStamp: 'tpr 9/25/2017 11:59' prior: 0!
- !UserInterfaceTheme commentStamp: '<historical>' prior: 0!
  A UserInterfaceTheme is a dictionary of preferred visual-properties; colors, borderStyles, borderWidths, fonts, forms, etc. used to color and style the IDE.
  
  Accessing The Theme
+ To access the proper UserInterfaceTheme instance for an object, send it #userInterfaceTheme.  The default implementation on Object provides the an instance of UserInterfaceThemeRequest that provides a lightweight, clean proxy of the actual theme in-use by the IDE at the current time. To do anything more sophisticated than basic query and setting of properties you must ask the proxy for the actual theme by sending #theme.
- To access the proper UserInterfaceTheme instance for an object, send it #userInterfaceTheme.  The default implementation on Object provides the one instance of that is in-use by the IDE at the current time.
  
  Customizing The Theme
  We can ask the userInterfaceTheme for the value of any visual-property, by name:
  
  	mySystemWindow userInterfaceTheme closeBoxImage
  
+ Initially that would answer nil, which causes the legacy code to use whatever default it's always used.  To override various visual-properties of any kind of object, the #set: for: to: message can be used.  For example, 
- Initially, the above answers nil, which causes the legacy code to use whatever default it's always used.  To override various visual-properties of any kind of object, the #set: onAny: to: message can be used.  For example, 
  
  	myUserInterfaceTheme
  		set: #closeBoxImage 
  		for: SystemWindow
  		to: MenuIcons smallCancelIcon
  
+ Now the closeBoxImage message will answer the MenuIcons icon instead of nil.
+ 
  Alternatively, values may be derived based on other values in the theme, as in:
  
  	myUserInterfaceTheme
  		set: #color 
  		for: FillInTheBlankMorph
  		to: { MenuMorph->#color.  #twiceDarker }
  
+ This would make FillInTheBlankMorph use the same color as a MenuMorph but twiceDarker, providing a clean way to build coherent seets of colors within a theme.  SystemWindow's code can be changed to use the expression above to access elements of the theme.
- Now, the accessing expression, above, will answer will answer MenuIcons' smallCancelIcon instead of nil.  SystemWindow's code can be changed to use the expression above to access elements of the theme.
  
  Upgrading Legacy Code
  Following the introduction of this class, various client code all around the system must be modified to access it.  This variety of legacy code uses a variety of methods to specify their visual properties:
  
  	1) a hard-coded values.
  	2) a values derived from some other value.
  	3) providing local storage for a settable value which can be nil.
  	4) providing local storage for a settable value which is expected to always have a particular valid value (never nil).
  
  The requirement, for each case, is to let the value be overridden.  
  
  The solution for each of the above should be handled respectively to the above list, as follows:
  
  	1) Check the userInterfaceTheme, if that property returns nil, use the legacy hard-coded value.  (see example: SystemWindow>>#createCloseBox).
  	2) Nothing to do -- simply perform the same derivation on the result of (1).
  	3) Check the local storage, if present, use it.  If nil, then check the userInterfaceTheme, if it has this property present, use it, else return nil.
  	4) Check the userInterfaceTheme, if the property is not nil, use it, otherwise use the local value.
  
  Tool Support
  If a new access to #userInterfaceTheme is added to the code, be sure to add the property and its description to the #themeSettings for that class.  See implementors of #themeSettings for examples.!

Item was added:
+ ----- Method: UserInterfaceThemeRequest>>set:for:to: (in category 'accessing') -----
+ set: propertySymbol for: aClassOrSymbol to: valueObject
+ 	"Where aClass asks its userInterfaceTheme for propertySymbol, provide valueObject. Pass this on to the actual theme"
+ 	
+ 	^self theme set: propertySymbol for: aClassOrSymbol to: valueObject
+ 	
+ !



More information about the Squeak-dev mailing list