Actions and menus

Boudewijn Rempt boud at valdyas.org
Thu Jan 8 10:08:11 UTC 2015


Hi,

So, last weekend I post the first part of the action reform. Here are some 
notes on what's up and what needs to be done in the future:

* there is only one xmlgui client: KisMainWindow

* there are now two action collections: one generated from *.action files 
that contain the default shortcuts for all actions in krita, including the 
ones added by tools, and one owned by KisMainWindow, which is used to 
build the xmlgui.

* KisActionManager is responsible for enabling/disabling actions based on 
activation conditions. This means we should port all actions to KisAction, 
and quite possibly, create a KisToggleAction as well.

* Actions that are not added to the actionmanager/mainwindow's action 
collection before the xmlgui is constructed aren't shown in the menus or 
toolbars. This used to work in KisView or docker plugins because those 
plugins were xmlgui clients. The reason they aren't is that creating these 
plugins causes a complete reconstruction of the gui, so a lot of flicker

* This means that our usual slap-dash way of creating actions any old time 
doens't work. If your docker needs to create actions, make it a 
KisMainWindoObserver and set the actions in setMainWindow (which should be 
renamed to setViewManager)

* If you create a new action, create it in the relevant *.action file as 
well (you can create one for every plugin). Otherwise the action's 
shortcut is _NOT_ configurable.

* I've got a patch pending that disabled conflicting mainwindow actions if 
a tool action is activated.

Future:

In the future, KisActionManager should read the krita.rc file and 
construct the menu from there. It should also create all actions from the 
*.action file and in C++, we should _fetch_ the action where we need it, 
not create it and add to KisActionManager.


Boudewijn


More information about the kimageshop mailing list