[Cuis-dev] Preferennce save/load and actionMap

Hilaire Fernandes hilaire at drgeo.eu
Fri May 6 02:05:21 PDT 2022


This is the expected scenario, a Tool register with #when:send:to: 
message: aPreference when: #preferenceChanged send: #notifyMe: to: aTool.

The only exception is with system preferences, two events are listened 
by the PreferenceNG class:

To listen to change font:

installFontPreferences
     | myPref |
     myPref _ PreferenceNG
         name: #guiElementsSize
         description: 'Size of the graphic intereface element'
         category: #gui
         type: #(tinyFonts verySmallFonts smallFonts standardFonts 
largeFonts veryLargeFonts hugeFonts)
         value: #standardFonts.
     myPref when: #preferenceChanged send: #defaultFontSize: to: 
PreferenceNG.
     "Trigger manually, the preference was instantiated with value, so 
no setter message sent"
     myPref triggerEvent: #preferenceChanged with: myPref.

and for Shout assignment character (not sure why I need to implement it, 
but it was implemented with side effect on the legacy Preference system:

     " Shout assignment character "
     myPref _ PreferenceNG name: #assignmentGlyphSelector description: 
'How should look like the assignment character?' category: #programming  
type: #(useLeftArrow useAlwaysLeftArrow) value: #useLeftArrow.
     myPref when: #preferenceChanged send: #assignmentGlyph: to: 
PreferenceNG.


I will do as your suggested, it will cover the current needs. We will 
see if future evolution is necessary.

My idea was to save along the preferences, the registered action map, 
but it is likely overkill.

Thanks for the tips

Hilaire

Le 06/05/2022 à 10:38, Luciano Notarfrancesco a écrit :
> Hm. I think the tools should be responsible of registering events for 
> preference change notification, not the other way around. If the 
> preference doesn’t exist in the image, maybe we should assume the tool 
> that was originally notified when the preference changed is not 
> installed in the image.
>
-- 
GNU Dr. Geo
http://drgeo.eu
http://blog.drgeo.eu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20220506/bbe44a57/attachment.htm>


More information about the Cuis-dev mailing list