Hi alain
I guessed right :)
So this is good to me.
Stef
On Mar 4, 2009, at 5:54 PM, Alain Plantec wrote:
>
> Argh, I forgot to say that, for one preference, only one method must
> be written. example for gradientButtonLook:
> UIPreferences>>gradientButtonLook
> <preference>
> ^ GradientButtonLook
> ifNil: [GradientButtonLook := PreferenceValue
> name: 'Gradient look for buttons'
> description: 'Gradient look for buttons'
> parent: #uiPreferenceNode
> type: #Boolean
> default: false]
>
> You can note the use of a minimal pragma form.
> We finally prefered objects over flat pragma declaration.
> This allow the use of a composite pattern for the tree and for one-
> to-many preference declaration.
> As an example:
> UIPreferences>>themePreference
> <preference>
> ^ ThemePreference
> ifNil: [ThemePreference := MultiplePreferenceValue
> name: 'UITheme'
> description: 'The theme to use for UI look and
> feel'
> parent:
> #uiPreferenceNode type:
> #UITheme default: UIThemeWatery2
> values: {
> FixedPreferenceValue
> name: 'Standard Squeak'
> description: 'Standard Squeak style'
> type:
> #UITheme
> value: UIThemeStandardSqueak.
> FixedPreferenceValue
> name: 'Watery 2'
> description: 'Similar to a nice OS'
> type: #UITheme
> value: UIThemeWatery2}]
>
> You can also have range:
> FreeTypePreferences>>glyphContrast
> <preference>
> ^ GlyphContrast
> ifNil: [GlyphContrast := RangePreferenceValue
> name: 'Glyph contrast'
> description: 'Change the contrast level for
> glyphs. This is an integer between 1 and 100. (the default value is
> 50)'
> parent: #freeTypePreferenceNode
> type: #Integer
> default: 50
> range: (1 to: 100)]
>
> Multiple and range preference value are not so easy to describe well
> if we only make use of literals (pragma constraint).
>
> Other point, how to use preferences.
> Example of a preference reading and changing:
> gradientLook := UIPreferences gradientButtonLook value.
> UIPreferences gradientButtonLook value: true.
>
> Last but not least point is that it provides system level preference
> change notification.
> to see it in action, load PrefListener2 package (the version I have
> attached to this mail, previous version was not ok)
>
> Cheers
> alain
>
> Alain Plantec a écrit :
>> Hi all,
>> Here is a Preference engine based on pragma.
>> please, check it and tell me if it is ok or not.
>> If you prefer squeak version, no problem but tell me
>> that I stop working on this.
>>
>> The set of system preferences constitutes a tree of preferences.
>> The model for the tree is implemented by the PreferenceNode
>> hierarchy.
>> (see PrefCore2). This is the only mandatory part.
>> The tree can be visualized with a PreferenceTree UI built on top of
>> PrefCore2 (see PrefTool2 and snapshot).
>> Examples of preference declaration are given in PrefProvider2.
>> in order to open the tree:
>> PreferenceTree open.
>> Thank to Gary for its help.
>>
>> cheers
>> alain
>>
>>>
>>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [email protected]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> <PrefListener2-alain_plantec.
> 5.mcz>_______________________________________________
> Pharo-project mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project