The Inbox: System-eem.746.mcz

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

The Inbox: System-eem.746.mcz

commits-2
Eliot Miranda uploaded a new version of System to project The Inbox:
http://source.squeak.org/inbox/System-eem.746.mcz

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

Name: System-eem.746
Author: eem
Time: 30 June 2015, 3:17:33.999 pm
UUID: e08cd059-dc73-408a-b819-e40b840dda43
Ancestors: System-eem.745

First part of Preferences putsch to move preferences dictionary from class var to inst var.  Also update class comment to describe preference pragmas.

=============== Diff against System-eem.745 ===============

Item was changed:
  Object subclass: #Preferences
  instanceVariableNames: ''
  classVariableNames: 'DesktopColor DictionaryOfPreferences Parameters'
  poolDictionaries: ''
  category: 'System-Preferences'!
+ Preferences class
+ instanceVariableNames: 'preferencesDictionary'!
 
+ !Preferences commentStamp: 'eem 6/30/2015 15:10' prior: 0!
+ A general mechanism to store preference choices.  The default setup treats any symbol as a potential boolean flag; flags unknown to the preference dictionary are always answered as false.  
- !Preferences commentStamp: '<historical>' prior: 0!
- A general mechanism to store preference choices.  The default setup treats any symbol as a potential boolean flag; flags unknown to the preference dictionary are always returned as false.  
 
+ To open the control panel:
+ PreferenceBrowser open
- To open the control panel: Preferences openFactoredPanel
  To read how to use the panel (and how to make a preference be per-project):
  Preferences giveHelpWithPreferences
 
+ All messages are on the class side.  There are two kinds of preference definition, preference pragmas (which are preferred) and  preferences local to Preferences.
- All messages are on the class side.
 
+ Preference Pragmas
+ Preferences can be local to a class or system of classes using preference pragmas.  Look at senders of #preference:category:description:type: and #preference:categoryList:description:type: for examples:
+ (self systemNavigation browseAllSelect:
+ [:m|
+ #(preference:category:description:type: preference:categoryList:description:type:) anySatisfy:
+ [:s| (m pragmaAt: s) notNil]])
+ With a preference pragma, the preference is typically kept in a class variable, local to the class whose method(s) contain(s) the pragma.  Good style is to put the preference pragma in the accessor for the variable; see for example BitBlt class>>#subPixelRenderColorFonts. The pragma serves to declare the preference to Preferences.
+
+
+ Preference-local Preferences
  To query a a preference:
  Preferences logDebuggerStackToFile
  or some people prefer the more verbose
  Preferences valueOfFlag: #logDebuggerStackToFile
 
+ You can make up a new preference any time.  Do not define a new message in Preferences class. Accessor methods are compiled automatically when you add a preference, either as as illustrated below, or by using
- You can make up a new preference any time.  Do not define a new message in Preferences class. Accessor methods are compiled automatically when you add a preference as illustrated below:
 
+ To add a non-pragma preference (e.g. in the Postscript of a fileout):
+ Preferences
+ addPreference: #samplePreference
+ categories: #(general browsing)
+ default: true
+ balloonHelp: 'This is an example of a preference added by a do-it'
+ projectLocal: false
+ changeInformee: nil
+ changeSelector: nil.
- To add a preference (e.g. in the Postscript of a fileout):
- Preferences addPreference: #samplePreference categories: #(general browsing)
- default: true balloonHelp: 'This is an example of a preference added by a do-it'
- projectLocal: false changeInformee: nil changeSelector: nil.
 
  To change a preference programatically:
  Preferences disable: #logDebuggerStackToFile.
  Or to turn it on,
  Preferences enable: #logDebuggerStackToFile.
  !
+ Preferences class
+ instanceVariableNames: 'preferencesDictionary'!

Item was changed:
  (PackageInfo named: 'System') postscript: '" Convert SoundService registeredClasses to classes if necessary "
  [ | currentSoundSystem |
  currentSoundSystem := SoundService defaultOrNil.
  (SoundService registeredClasses copy collect: [:ss |
  SoundService unregister: ss.
  ss isBehavior
  ifTrue: [ss]
  ifFalse: [ss class]]
  ) do: [:ssClass |
  SoundService register: ssClass].
  SoundService default: (currentSoundSystem
  ifNotNil: [:css| css isBehavior ifTrue: [css] ifFalse: [css class]]).
+ ] value.
+
+ "Convert preferences dictionary from class var to inst var if necessary."
+ (Preferences instVarNamed: ''preferencesDictionary'') ifNil:
+ [(Preferences classPool at: #DictionaryOfPreferences) ifNotNil:
+ [:dictionary|
+ Preferences
+ instVarNamed: ''preferencesDictionary''
+ put: dictionary]]'!
- ] value'!