[Cuis-dev] Decentralized menu definition
Gerald Klix
cuis.01 at klix.ch
Thu Jul 21 04:31:40 PDT 2022
Let me point out that Haver already has an
ActionBuilder package that provides some means
to define menus and LayoutMorphs with
buttons -- sort of a toolbar -- in one place.
It is probably hard to port, because it depends on
Haver's button implementation, but it may server
as an inspiration.
The modules code:
https://hg.sr.ht/~cy-de-fect/HaverOnCuis/browse/haver/actions/ActionBuilder.pck.st?rev=tip
An example on how to use it is attached.
Also an JPEG showing the system window with it's
toolbar and a popup menu.
HTH,
Gerald
On 7/21/22 8:42 AM, Luciano Notarfrancesco via Cuis-dev wrote:
> Yes, it would be great to address those issues, and also unify different
> ways to define commands/actions/services on models that can be triggered
> by buttons, menues and keyboard shortcuts, and do it in a way that can
> be easily extended by packages. Currently we have SimpleServiceEntry for
> FileList, I think these could eventually be reimplemented in terms of a
> new (more general and simpler) commands/actions/services thing.
>
> On Tue, 19 Jul 2022 at 21:22 Juan Vuletich via Cuis-dev
> <cuis-dev at lists.cuis.st <mailto:cuis-dev at lists.cuis.st>> wrote:
>
> __
> On 7/15/2022 12:53 PM, Hilaire Fernandes via Cuis-dev wrote:
>>
>> Hi,
>>
>> Here is a first iteration for decentralized menu definitions .
>>
>> Check the comment of the MenuBuilder class and its example to
>> execute.
>>
>> Then check its example class methods to read how write definition
>> of the menu.
>>
>> In theory, this should let third party package smoothly adds
>> entries in Cuis menus.
>>
>> There is place for improvements and to make menu definition more
>> compact, but its already gives a general idea.
>>
>> Thanks
>>
>> Hilaire
>>
>> --
>> GNU Dr. Geo
>> http://drgeo.eu <http://drgeo.eu>
>> http://blog.drgeo.eu <http://blog.drgeo.eu>
>
> Hi Hilaire,
>
> This is interesting. But if we are to change how menus are built in
> the base image, adding a mechanism that packages will depend on, I'd
> like it to also address these:
> - Keyboard shortcuts. Today, these are even in a worse shape than
> menus. There's no way to tweak them, and we already ran out of them.
> - Context. Different gui controls in different apps will need
> different menus / shortcuts. Even depending on state or mode.
> - Scope of context. Some menus / shortcuts may apply to a leaf
> morph, like a text editor or list. Others apply to a window or other
> composite morph. Others are global.
>
> Actually, we are talking about user commands and how to issue them.
> So, some questions are:
> - which user commands are available on a certain morph in a certain
> moment
> - how do we group them in menus
> - how (if) we assign them a keyboard shortcut
>
> Everyone, please chime in and share your ideas or possible
> approaches. It would be great if we can find a general solution.
>
> Thanks!
>
> --
> Juan Vuletich
> www.cuis-smalltalk.org <http://www.cuis-smalltalk.org>
> https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev <https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev>
> https://github.com/jvuletich <https://github.com/jvuletich>
> https://www.linkedin.com/in/juan-vuletich-75611b3 <https://www.linkedin.com/in/juan-vuletich-75611b3>
> https://independent.academia.edu/JuanVuletich <https://independent.academia.edu/JuanVuletich>
> https://www.researchgate.net/profile/Juan-Vuletich <https://www.researchgate.net/profile/Juan-Vuletich>
> https://patents.justia.com/inventor/juan-manuel-vuletich <https://patents.justia.com/inventor/juan-manuel-vuletich>
> https://twitter.com/JuanVuletich <https://twitter.com/JuanVuletich>
>
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st <mailto:Cuis-dev at lists.cuis.st>
> https://lists.cuis.st/mailman/listinfo/cuis-dev
> <https://lists.cuis.st/mailman/listinfo/cuis-dev>
>
>
-------------- next part --------------
'From Haver 6.0 [latest update: #5392] on 21 July 2022 at 1:27:20 pm'!
!(Modules>>#ModulesTools>>#ModulesListMorph) methodsFor: 'GUI building' stamp: 'KLG 2/19/2022 18:28:31'!
buildActions
"Build all my actions."
| builder |
(builder _ ActionBuilder new)
newRootActionGroup: #modulesListAction forModel: self model buildDoing: [ :root |
root
target: self;
isHorizontal: model horizonalButtons;
heading: self model actionsHeading.
builder
newActionGroup: #changeModule buildDoing: [ :change |
change buttonHeading: self model modulesButtonsHeading.
builder
newAction: #newModule buildDoing: [ :newModule |
newModule
text: 'New module ...';
buttonText: 'New ...';
icon: #newIcon;
balloonText: 'Create a new module' ];
newAction: #removeModule buildDoing: [ :deleteModule |
deleteModule
text: 'Remove module ...';
buttonText: 'Remove ...';
icon: #deleteIcon;
balloonText: 'Remove the selected module';
enabledSelector: #hasChangeableModuleSelection ];
newAction: #renameModule buildDoing: [ :renameModule |
renameModule
text: 'Rename module ...';
buttonText: 'Rename ...';
icon: #textEditorIcon;
balloonText: 'Rename the selected module';
enabledSelector: #hasChangeableModuleSelection ] ];
newActionGroup: #genericEdit buildDoing: [ :edit |
edit
target: self model;
buttonHeading: self model editButtonsHeading.
self
buildSetPackageNameActionWith: builder
action: #setPackageName
enabledSelector: #hasChangeableModuleSelection.
builder
newAction: #browseSelection buildDoing: [ :browseSelection |
browseSelection
text: 'Browse it';
icon: #editFindReplaceIcon;
balloonText: 'Browse the selected item or its class';
enabledSelector: #hasSelection ];
newAction: #inspectSelection buildDoing: [ :inspectSelection |
inspectSelection
text: 'Inspect it';
icon: #inspectIcon;
balloonText: 'Inspect the selected item or its class';
enabledSelector: #hasSelection ];
newAction: #exploreSelection buildDoing: [ :exploreSelection |
exploreSelection
text: 'Explore it';
icon: #exploreIcon;
balloonText: 'Explore the selected item or its class';
enabledSelector: #hasSelection ] ] ].
^ builder! !
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ModulesMenu.jpeg
Type: image/jpeg
Size: 9567 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20220721/62968523/attachment-0002.jpeg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Modules.jpeg
Type: image/jpeg
Size: 50207 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20220721/62968523/attachment-0003.jpeg>
More information about the Cuis-dev
mailing list