[Pharo-project] Settings + Menu

Stéphane Ducasse stephane.ducasse at inria.fr
Thu Mar 26 08:52:08 EDT 2009


On Mar 26, 2009, at 1:15 PM, Henrik Johansen wrote:

> Nice!
> Haven't had time to delve deep in the code, but installing went fine.
> One thing I feel would be useful is some more class-comments,
> for example in the core-package explaining each setting type, when to
> use it over another (FixedSetting vs Setting), etc.


YES YES
This is really important that we increase the level of comments in the  
system

> One thing I was wondering after reading the declaration parts in
> previous mails was how to add an item to an existing setting's list  
> (alá
> SettingSandBox1>> themeSetting) in a separate package (and remove it  
> if
> package is unloaded), the pragmas make this doable I guess?
>
> Cheers,
> Henry
>
> Alain Plantec wrote:
>> Hi all,
>>
>> Here my last setting package version
>> with a test package (Tests-System-Settings) :)
>>
>> I've also added a Menu part which allows the using of
>> pragma for menu discovering and assembling on the fly.
>> This addon fully reuse what is done for settings.
>> The idea is the same: use pragma within particular methods
>> which are defining menu items (thanks to Lukas again for the  
>> idea  ;-) )
>> The menu assembler is able to collect them and to popup the menu
>> dynamically.
>>
>> The consequences are
>> - no need for TheWorldMenu class and
>> - this would be the end of #registerOpenCommand: and
>> #unregisterOpenCommand:.
>>
>> As for settings, the main benefit is that menu items are brought by
>> packages.
>> An application specific menu can be added anywhere in the world menu.
>> One could also use this feature in order to allow user-defined menu
>> entries.
>>
>> As an example, I've re-defined a part of the world menu.
>> it is implemented in MenuSettings class (package SettingSandBox1).
>> Such a menu is dynamically assembled and is popup very quickly.
>> So I think that there would be no more need for a world menu instance
>> kept alive in the system.
>>
>> you can try it with:
>>
>> WorldMenuAssembler new doPopUpMenu
>>
>> You can also use
>>
>> SystemMenuTree new open
>>
>> in order to browse all menu entries.
>> It is only a very simple version.
>> Maybe it could be used in order to implement a 'menu editor' tool:
>> define your menus and generate corresponding code.
>>
>>
>> Here are two examples of methods with menu pragma from MenuSettings
>> class.
>>
>> - the Save item : a simple item with one target and one selector
>> wmSave
>>   <worldMenu>
>>   ^ (SettingManager newMenu: 'Save') target: SmalltalkImage current;
>>        selector: #saveSession;
>>        previous: #wmSystemSettings;
>>        description: 'save the current version of the image on disk'
>>
>> - the ToolsSet item set : a multi node with a collection of menu  
>> items
>> wmToolSet
>>   <worldMenu>
>>   ^ (SettingManager newMenuSiblings name: 'Toolset')
>>       line: true;
>>       menus: (ToolSet default mainMenuItems
>>               collect: [:item | (SettingManager newMenu: item first)
>>                       target: ToolSet default;
>>                       selector: item second])
>>
>> Cheers
>>
>> alain
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Pharo-project mailing list
>> Pharo-project at lists.gforge.inria.fr
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> Pharo-project at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>





More information about the Pharo-dev mailing list