
The panel
The panel at the top of the document window displays a different set of fields and controls for each tool.
* Alt+x jump to the first editable field in the secondary toolbar * Enter set the current field's new value (if changed) and leave the secondary toolbar * Esc cancel any changes in the current field and leave the secondary toolbar * Ctrl+z cancel any changes in the current field * Tab, Shift+Tab jump between fields in the secondary toolbar (the value in the field you leave, if changed, is set) * Up/Down arrows change the current value by 0.1 * PgUp/PgDn change the current value by 5.0
This is the basic set of keybindings that makes the panel (aka secondary toolbar, but I like the "panel" term better) usable. Some of this functionality was provided by GTK but had to be cleaned up, some was implemented from scratch. Not to start a flamewar, but my impression of GTK so far is not too favorable: messy, underdocumented, somewhat similar to GIMP itself in its "interface" (I mean the programmer's interface, not only GUI). I don't know if other toolkits are much better, though.
Questions for everyone:
- alt-x: I like this shortcut, but if anyone will propose a better one I will be glad to hear.
- Is alt-x plus tab/shift-tab enough for navigating the toolbar, or do we want each widget to have its own shortcut? Or will this be too much, with potentially tens of widgets in all tools? Of course such shortcuts would use consistent modifiers and would correspond to the widget labels, e.g. for the selector toolbar: ctrl-alt-x, ctrl-alt-y, ctrl-alt-w, ctrl-alt-h.
- Now alt-x is implemented very stupidly, through grab_focus of a specific widget. I tried to use GTK "accelerators" but was unable to make them work. Does anyone know if Inkscape uses GTK accelerators? If not, how are the global verbs implemented? If I manage to add an accelerator group to the top-level document window, will it conflict with verbs? Can one point me to a not-too-complex GTK app that uses accelerators so I could figure it out? (The documentation is very scarce.)
P.S. I've tried to send this message several times. Guess what, sourceforge was rejecting it as spam because in the phrase "through grab_focus" I had "via" instead of "through" - which matched the regexp for some well-known substance name! Oh my. Hope it will pass through this time.
_________________________________________________________________ Check out the new MSN 9 Dial-up � fast & reliable Internet access with prime features! http://join.msn.com/?pgmarket=en-us&page=dialup/home&ST=1

On Sat, 2004-01-10 at 11:00, bulia byak wrote:
- Is alt-x plus tab/shift-tab enough for navigating the toolbar, or
do we want each widget to have its own shortcut? Or will this be too much, with potentially tens of widgets in all tools? Of course such shortcuts would use consistent modifiers and would correspond to the widget labels, e.g. for the selector toolbar: ctrl-alt-x, ctrl-alt-y, ctrl-alt-w, ctrl-alt-h.
Save those combinations for other things, I think. Tab should be enough.
- Now alt-x is implemented very stupidly, through grab_focus of a
specific widget. I tried to use GTK "accelerators" but was unable to make them work. Does anyone know if Inkscape uses GTK accelerators? If not, how are the global verbs implemented? If I manage to add an accelerator group to the top-level document window, will it conflict with verbs? Can one point me to a not-too-complex GTK app that uses accelerators so I could figure it out? (The documentation is very scarce.)
Inkscape does not currently use GTK accelerators.
Here's a readers' digest summary of how Inkscape accelerators work:
A global mapping between key combinations and integer verb IDs (sp_verb_t) is maintained in shortcuts.cpp; these are registered using sp_shortcut_set().
Given an sp_verb_t and an SPView, you can get an SPAction which represents that action in that view. These mappings are currently hard-coded in verbs.cpp.
SPActions derive from NRActiveObject, which putatively provides a "lightweight" method of doing callbacks, versus GObject signals. I don't completely understand how it works.
[ SPActions also contain the label, image, etc, used for buttons and menuitems. ]
sp_shortcut_invoke() looks up the SPAction for a keypress and SPView and invokes it automatically. SPEventContexts call it for keypresses that they do not handle themselves.
Here's a readers' digest summary of how Gtk accelerators work:
A GtkAccelGroup object maintains a (non-global) mapping between key combinations and specific GClosures. These are registered via gtk_accel_group_connect()
A GClosure is an object containing a callback function pointer and some data (which is passed to the function whenever the closure is 'invoked'). From C/C++, you would create these using g_cclosure_new() [ note the double c ].
A mapping from a key combination to a GClosure may be added using gtk_accel_group_connect().
A GtkWindow may have one or more GtkAccelGroups attached to it by gtk_window_add_accel_group().
Calling gtk_accel_groups_activate(window, key, modifiers) invokes the first matching GClosure in any of the accel groups attached to a window. It returns TRUE if a match was found.
IIRC, GtkWindows call it in their default key press handler.
-mental
participants (2)
-
bulia byak
-
MenTaLguY