The Trunk: System-mt.1024.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: System-mt.1024.mcz

commits-2
Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.1024.mcz

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

Name: System-mt.1024
Author: mt
Time: 9 May 2018, 8:36:00.223271 am
UUID: 74d2ef0a-9d9a-2847-a108-68482bd91da4
Ancestors: System-mt.1023

Updates code comments and some code formatting.

=============== Diff against System-mt.1023 ===============

Item was changed:
  UserInterfaceTheme subclass: #CommunityTheme
  instanceVariableNames: ''
  classVariableNames: ''
  poolDictionaries: ''
  category: 'System-Support'!
 
+ !CommunityTheme commentStamp: 'rhi 5/5/2018 09:27' prior: 0!
+ A dark theme designed by members of the Squeak community.!
- !CommunityTheme commentStamp: 'mt 7/26/2016 16:22' prior: 0!
- A dark theme designed by members the Squeak community such as Karl Ramberg, Chris Muller, and Marcel Taeumel.!

Item was changed:
  Object subclass: #UserInterfaceTheme
  instanceVariableNames: 'properties name next ignoreApply lastScaleFactor'
  classVariableNames: 'All Current Default'
  poolDictionaries: ''
  category: 'System-Support'!
 
+ !UserInterfaceTheme commentStamp: 'rhi 5/5/2018 09:18' prior: 0!
+ A UserInterfaceTheme is a dictionary of preferred visual properties; colors, borderStyles, borderWidths, fonts, forms, etc. used to color and style the IDE.
- !UserInterfaceTheme commentStamp: 'tpr 9/25/2017 11:59' 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 returns 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 queryinh and setting of properties, you must ask the proxy for the actual theme by sending #theme.
- 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.
 
+ Customizing the Theme
+ We can ask the #userInterfaceTheme for the value of any visual property by name:
- 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 used so far. To override various visual properties of any kind of object, the #set:for:to: message can be used, for example:
- 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,
 
  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 }
- to: { MenuMorph->#color.  #twiceDarker }
 
+ This makes FillInTheBlankMorph use the same color as a MenuMorph but #twiceDarker, providing a clean way to build coherent sets of colors within a theme. SystemWindow's code can be changed to use the expression above to access elements of the theme.
- 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.
 
  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:
- 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 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).
- 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.
- 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.!
- 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 changed:
  ----- Method: UserInterfaceTheme class>>allThemeProperties (in category 'tools') -----
  allThemeProperties
+ "Answer an Array of 3-element Arrays.  Each inner Array holds the information needed to present a theme editor tool; the property name, category, and description."
+
+ "self allThemeProperties"
+
+ ^ Array streamContents: [:stream |
+ self allThemePropertiesDo: [:cls :prop |
+ stream nextPut: {cls}, prop]]!
- "Answer an Array of 3-element Array's.  Each inner Array are the information needed to present a Theme editor tool; the property name, category, and description.
-
- self allThemeProperties"
-
- ^ Array streamContents:
- [ : stream | self allThemePropertiesDo: [ : cls : prop | stream nextPut: {cls}, prop ]]!

Item was changed:
  ----- Method: UserInterfaceTheme class>>allThemes (in category 'accessing') -----
  allThemes
+
  ^ All ifNil: [All := IdentitySet new]!

Item was changed:
  ----- Method: UserInterfaceTheme class>>cleanUp: (in category 'initialize-release') -----
  cleanUp: aggressive
 
  aggressive ifTrue: [
  All := nil.
+ SqueakTheme
+ create;
+ createDuller.
+ SolarizedTheme
+ createDark;
+ createLight.
- SqueakTheme create; createDuller.
- SolarizedTheme createDark; createLight.
  MonokaiTheme createDark.
  CommunityTheme createDark.
  TrimTheme create].!

Item was changed:
  ----- Method: UserInterfaceTheme class>>clientClassesToReapply (in category 'private') -----
  clientClassesToReapply
  "All client classes plus their unique subclasses."
 
+ ^ IdentitySet new in: [:result |
+ self clientClasses do: [:cc |
+ cc withAllSubclassesDo: [:sc |
+ result add: sc]].
+ result]!
- ^ IdentitySet new in: [:result | self clientClasses do: [:cc | cc withAllSubclassesDo: [:sc |
- result add: sc]]. result]
- !

Item was changed:
  ----- Method: UserInterfaceTheme class>>current: (in category 'accessing') -----
  current: aUserInterfaceTheme
  "Replace the current system theme with aUserInterfaceTheme."
+
+ Current := aUserInterfaceTheme.
+ "Notify?"!
- Current := aUserInterfaceTheme
- "Notify?"!

Item was changed:
  ----- Method: UserInterfaceTheme class>>default (in category 'accessing') -----
  default
+ ^ Default ifNil: [Default := self new
+ name: 'Autogenerated Default';
+ yourself]!
- ^ Default ifNil: [Default := self new name: 'Autogenerated Default'; yourself]!

Item was changed:
  ----- Method: UserInterfaceTheme class>>default: (in category 'accessing') -----
  default: aUserInterfaceTheme
+
  Default := aUserInterfaceTheme.!

Item was changed:
  ----- Method: UserInterfaceTheme class>>named: (in category 'initialize-release') -----
  named: aString
+
  ^ self allThemes
  detect: [:ea | ea name = aString]
+ ifNone: [self new
+ name: aString;
+ register]!
- ifNone: [self new name: aString; register]!

Item was changed:
  ----- Method: UserInterfaceTheme class>>propertiesForCategory: (in category 'tools') -----
  propertiesForCategory: categoryName
+
+ ^ self allThemeProperties select: [:each | each third = categoryName]!
- ^ self allThemeProperties select: [ : each | each third = categoryName ]!

Item was changed:
  ----- Method: UserInterfaceTheme class>>propertiesForClass: (in category 'tools') -----
  propertiesForClass: aClass
+
+ ^ self allThemeProperties select: [:each | each first == aClass]!
- ^ self allThemeProperties select: [ : each | each first = aClass ]!

Item was changed:
  Object subclass: #UserInterfaceThemeRequest
  instanceVariableNames: 'target theme'
  classVariableNames: ''
  poolDictionaries: ''
  category: 'System-Support'!
 
+ !UserInterfaceThemeRequest commentStamp: 'rhi 5/5/2018 09:30' prior: 0!
+ To be able to use a UserInterfaceTheme as a container of fairly arbitrary properties whilst making it seem like we are sending regular messages as a way of accessing those properties, we can handle #doesNotUnderstand: and check the name of the message not understood against our property list. This is clever, devious, interesting, and may confuse users until they get to see an explanation like this.
- !UserInterfaceThemeRequest commentStamp: 'mt 9/23/2017 10:37' prior: 0!
- In order to be able to use a UserInterfaceTheme as a container of fairly arbitrary properties whilst making it seem like we are sending regular messages as a way of accessing those properties we can handle the dNU: and check the not understood message name against our property list. This is clever, devious, interesting and may confuse users until they get to see an explanation like this.
 
  Answer nil or a value for the property specified by aMessage's #selector. Searching for the property proceeds by
+ a) searching my dictionary for a key made up of an Association with a key of the class of the 'client' and a value of the message name. For example SimpleButtonMorph->#borderColor
+ b) searching again for a key made from the superclass(es) of the client - e.g. RectangleMorph->borderColor and then if required BorderedMorph->#borderColor etc.
- a) searching my dictionary for a key made up of an Association with a key of the class of the 'client' and a value of the message name. For example SimpleButtonMorph->borderColor
- b) searching again for a key made from the superclass(es) of the client - e.g. RectangleMorph->borderColor and then if required BorderedMorph->borderColor etc.
  c) if there is a linked theme, search it in the same manner.
 
+ As an extreme example, consider a basic theme with a linked theme specific to buttons:
- As an extreme example, consider a basic theme with a linked theme specifically for buttons.
 
  mySimpleButtonMorph borderColor
 
+ ... would search the basic theme for SimpleButtonMorph->#borderColor, the superclass equivalents as in b) above, then search the linked theme for SimpleButtonMorph->#borderColor and (hopefully) find something meaningful.!
- ... would search the basic theme for SimpleButtonMorph->borderColor, the superclass equivalents as in b) above, then search the linked theme for SimpleButtonMorph->borderColor and, we hope, find something meaningful.!

Item was changed:
  ----- Method: UserInterfaceThemeRequest>>doesNotUnderstand: (in category 'lookup') -----
  doesNotUnderstand: aMessage
+ "Look up the visual attribute specified by aMessage's #selector in the current theme for the current target object."
- "Look up the visual-attribute specified by aMessage's #selector in the current theme for the current target object."
 
  aMessage numArgs = 0 ifTrue: [
  ^ (self theme get: self target class -> aMessage selector)
  ifNil: [(self theme respondsTo: aMessage selector)
  ifTrue: [self theme perform: aMessage selector]
+ ifFalse: [nil "unset property"]]].
- ifFalse: [nil "means unset property"]]].
 
  ^ self theme
  perform: aMessage selector
  withArguments: aMessage arguments.!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: System-mt.1024.mcz

John Pfersich-2
Isn’t that:

anything more sophisticated than basic queryinh 

Supposed to be:

querying


On May 8, 2018, at 23:36, [hidden email] wrote:

anything more sophisticated than basic queryinh


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: System-mt.1024.mcz

John Pfersich-2
In reply to this post by commits-2
Found another. 

+    b) searching again for a key made from the superclass(es) of the client - e.g. RectangleMorph->borderColor and then if required BorderedMorph->#borderColor etc.

Should be

+    b) searching again for a key made from the superclass(es) of the client - e.g. RectangleMorph->#borderColor and then if required BorderedMorph->#borderColor etc.


On May 8, 2018, at 23:36, [hidden email] wrote:

+    b) searching again for a key made from the superclass(es) of the client - e.g. RectangleMorph->borderColor and then if required BorderedMorph->#borderColor etc.