[Pharo-project] Settings + Menu

Alain Plantec alain.plantec at free.fr
Thu Mar 26 05:01:17 EDT 2009


Stéphane Ducasse a écrit :
> thanks alain
>
> I was a bit on vacation because we have some troubles with our house.
Hi Stephane,

I think the setting should be ok for integration.
Can I upload it to Inbox ?
I would like to start changing preference declarations.

About menus, it seems ok.
The main problem is the ordering of menu items.
My solution is, for a menu item, to declare its previous item (see 
worldmenu example in SettingSandBox1)
maybe  people here have  other solutions ?
If the menu feature is not desired, it is quite easy to remove it.
anyway, I've improved it a little bit.
I've attached the new packages.

test setting and menu features with:

SystemSettingTree new open "browse/change setting values"
SystemMenuTree new open "browse/test world menu items (see item menu)"
WorldMenuAssembler new doPopUpMenu "popup the world menu test 
(TheWorldMenu replacement)"


Cheers
alain
>
> Stef
> On Mar 26, 2009, at 12:28 AM, 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
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> <SettingSandBox1-alain_plantec.4.mcz><SettingSandBox2-alain_plantec.2.mcz><System-Settings-alain_plantec.22.mcz><Tests-System-Settings-alain_plantec.4.mcz><Menu.gif>_______________________________________________ 
>>
>> Pharo-project mailing list
>> Pharo-project at lists.gforge.inria.fr
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: SettingSandBox1-alain_plantec.5.mcz
Type: application/octet-stream
Size: 6708 bytes
Desc: not available
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20090326/3525c0d3/attachment.mcz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SettingSandBox2-alain_plantec.2.mcz
Type: application/octet-stream
Size: 2674 bytes
Desc: not available
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20090326/3525c0d3/attachment-0001.mcz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Tests-System-Settings-alain_plantec.4.mcz
Type: application/octet-stream
Size: 3341 bytes
Desc: not available
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20090326/3525c0d3/attachment-0002.mcz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Menu.gif
Type: image/gif
Size: 8829 bytes
Desc: not available
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20090326/3525c0d3/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: System-Settings-alain_plantec.25.mcz
Type: application/octet-stream
Size: 50714 bytes
Desc: not available
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20090326/3525c0d3/attachment-0003.mcz>


More information about the Pharo-dev mailing list