[Cuis-dev] WorldMenu

Hernan Wilkinson hernan.wilkinson at 10pines.com
Fri May 27 10:17:58 PDT 2022


I like the idea of building the menu and its submenus.
I don't like pragmas that much... I think that having just a selector as
the DynamicMenuBuilder does is enough.

On Fri, May 27, 2022 at 1:37 PM Hilaire Fernandes via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:

> Hi Hernan, Luciano.
>
> Le 27/05/2022 à 16:52, Hernan Wilkinson via Cuis-dev a écrit :
> > Hi Luciano,
> >  adding options to menus based on packages is already solved. Look at
> > the class DynamicMenuBuilder.
> >  In fact, it is used to create the world menu beside other menues like
> > the editor menu.
> >  Hilaire, does the DynamicMenuBuilder satisfy your needs?
> Which needs? To define a completely different World Menu?
>
> In Cuis, AFAIK, the world menu hierarchy is both defined with a mix of
> data declaration (see #worldMenuOptions) and code to build the menu by
> invoking data declaration (see #openMenu), mostly to establish the
> informal parent-child menus relationship.
>
> A formal menu declaration decoupled of menu build up will make menu
> understanding and extension easier.
>
> I will use a builder instance passed along the methods defining the
> menus. The menu data and relationship will be defined in these methods,
> then the menu build up done by the builder object. Changing/subclassing
> the builder will make possible to have different way to represent menu.
>
> The methods used to defined the whole menu hierarchy will be identified
> with a dedicated pragma.
>
> This is more less as implemented in Pharo, it is pretty neat and make
> the menu hierarchy easy to understand, you just need to search the
> method with a given pragma. In Cuis you have to search for all the
> methods defining the menu and submenu (different method names)
>
> In DrGeo for example. The names of the method do not mater, only the
> pragma:
>
> Main menu, is a regular menu without parent:
>
> DrGeo>>worldMenu: aBuilder
>      <drgeoMenu>
>      (aBuilder item: 'New' translated)
>          action: [ DrGeo newFullScreen ];
>          icon: (self iconNamed: #smallNewIcon);
>          order: 0.
> ../..
>      (aBuilder item: #Tools translated)
>          icon:    (self iconNamed: #tools);
>          order: 5.
>
> And submenu are identified by parent argument:
>
> DrGeo>>toolsMenuOn: aBuilder
>      <drgeoMenu>
>      (aBuilder item: #'System Browser' translated)
>          parent: #Tools translated;
>          action: [ Smalltalk tools browser openOnClass: DrGeoSketch ];
>          icon:    (self iconNamed: #smallObjects);
>          help:'A source code browser to view, edit and save Dr. Geo
> code. I open the browser on the DrGeoCanvas class you can study to
> design your own Smalltalk sketch.'    translated.
>      (aBuilder item: #'Workspace' translated)
>          parent: #Tools translated;
>          action: [Smalltalk tools openWorkspace bounds: RealEstateAgent
> leftMaximumUsableArea];
>          icon:    (self iconNamed: #workspace);
>          help: 'A window used as a scratchpad area where fragments of
> Pharo code can be entered, stored, edited, and evaluated.'    translated.
>
> I wonder if pragma parameter parent: will make the menu hierarchy more
> explicit and the method a bit less verbose.
>
> Then you can change your world menu with a simple WorldMorph
> desktopMenuPragma: #drgeoMenu
>
> Just some food for thought
>
> Hilaire
>
> >
> > Cheers!
> > Hernan.
>
> --
> GNU Dr. Geo
> http://drgeo.eu
> http://blog.drgeo.eu
>
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>


-- 
<https://10pines.com/>Hernán WilkinsonSoftware Developer & Coach

Alem 896, Floor 6, Buenos Aires, Argentina

+54 11 6091 3125

@HernanWilkinson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20220527/c9e98cde/attachment.htm>


More information about the Cuis-dev mailing list