Okay, last Call for Volunteers today, I promise!
This one will be quite tricky and requires good knowledge of C++, Gtkmm, and the Inkscape codebase. The menu needs to be very dynamic and well tied in with Inkscape's internals, so if you don't already know Inkscape code thoroughly, you'll need to be prepared for a lot of digging and learning. Fortunately, you can start simple and build up as you go. :-)
7. Context Menu ================ The current context menu in Inkscape is not very powerful. We can do better.
First skim through the tutorial on context menus on the gtkmm.org site: http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch10s03.html
In the Gtk+ codebase, the context menu is implemented in the function sp_ui_context_menu, in the file interface.cpp. Review that function to see how the context menu works currently.
As a general rule, there should be no more than about ten items total on the context menu.
The context menu, by definition, should customize the set of items it displays to the user based on what the user has right clicked on. It should tie in with the Actions system, and should display appropriate menu items for the selected context.
The context menu must check the context item against the current selection. The context item is the thing directly under the mouse cursor when the right-click action occurs. The current selection is the item or items selected by the left-click menu. Note that it's definitely possible for these to be different - the user may left click to select a circle, then right click over a rectangle to change its properties. It is also possible to have no selection, or to select multiple items. Each of these implies a different type of context, and would be handled differently.
If the context item is completely different from the selection, then display only actions which don't require the object to be selected. For instance, do not display the 'Delete' action, since that will cause the _selected_ item to be deleted rather than the context item. Same thing for cut, copy, etc. Note that context commands should *not* change the selection to get around this.
If the context item is the same as the selected item, then detailed operations should be shown for that item, including actions that can be performed on selections. In this case, you'd display Delete, Cut, Paste, etc.
If multiple items are selected, and the context item is one of the items in the selection, then present actions that can be performed on multiple selected items. Delete, cut, copy, duplicate should act on all selected items, for instance, and commands for group, Text-on-path, booleans (Union, Difference, etc.) should be presented.
If the context item is part of the chrome (i.e., a toolbar button, the status bar, etc.) then display a context menu appropriate to that item, plus some commands specific to the inkscape application itself. For instance, it should allow all of the actions available through doubleclick, shift-click, alt-click, etc. with the button, and inkscape preferences, view/hide the chrome item, etc.
Think about the context menu in three sections. The top third and bottom third should have the most commonly expected commands, and the middle should have the less common commands. The top (and sometimes the bottom) will be the closest to the mouse cursor when popped up so it will be most convenient for common actions to be located there. The middle is less accessible so rarer functions should be placed there.
Strive to always place the same command in the same location in the context menu.
The top portion of the menu should have actions which are common, frequently used commands needed for any shape or context.
The bottom portion should consist of the commands that are common for the specific shape or context selected.
The middle portion should consist of commands specific to the shape or context, but less commonly used.
Any action available in the context menu should also be available through other means, but you can include actions that otherwise require several clicks. For instance, in the context of a font item, you could include actions for changing the font size; this is normally available only by first opening the text and font dialog, then selecting the font size from the font size widget.
To get the Gtkmm codebase:
$ cvs -d:pserver:anonymous@...54...:/cvsroot/inkscape login (hit enter for password) $ cvs -z3 -d:pserver:anonymous@...54...:/cvsroot/inkscape co experimental/bryce/inkscape_gtkmm $ cd experimental/bryce/inkscape_gtkmm $ make $ ./inkscape
Bryce