Logo Search packages:      
Sourcecode: inkscape version File versions

static void sp_shortcut_set ( unsigned int const   shortcut,
Inkscape::Verb *const   verb,
bool const   is_primary 
) [static]

Adds a keyboard shortcut for the given verb. (Removes any existing binding for the given shortcut, including appropriately adjusting sp_shortcut_get_primary if necessary.)

is_primary True iff this is the shortcut to be written in menu items or buttons.
sp_shortcut_get_verb(shortcut) == verb.

!is_primary or sp_shortcut_get_primary(verb) == shortcut.

Definition at line 173 of file shortcuts.cpp.

    if (!verbs) sp_shortcut_init();

    Inkscape::Verb *old_verb = (Inkscape::Verb *)(g_hash_table_lookup(verbs, GINT_TO_POINTER(shortcut)));
    g_hash_table_insert(verbs, GINT_TO_POINTER(shortcut), (gpointer)(verb));

    /* Maintain the invariant that sp_shortcut_get_primary(v) returns either 0 or a valid shortcut for v. */
    if (old_verb && old_verb != verb) {
        unsigned int const old_primary = (unsigned int)GPOINTER_TO_INT(g_hash_table_lookup(primary_shortcuts, (gpointer)old_verb));

        if (old_primary == shortcut) {
            g_hash_table_insert(primary_shortcuts, (gpointer)old_verb, GINT_TO_POINTER(0));

    if (is_primary) {
        g_hash_table_insert(primary_shortcuts, (gpointer)(verb), GINT_TO_POINTER(shortcut));

Generated by  Doxygen 1.6.0   Back to index