bool TableofcontentsNoteAddin::on_key_pressed(GdkEventKey *ev)
//return true if signal handled, false otherwise
//NOTE: if a menu item has an accelerator,
//      its entry is needed until the toc menu is built a first time,
//      then the menu item accelerator takes the signals.
{
    switch(ev->keyval) {

    case GDK_KEY_1:
        if (ev->state & Gdk::CONTROL_MASK
                && ev->state & Gdk::MOD1_MASK    ) {// Ctrl-Alt-1
            on_toc_popup_activated();
            return true;
        }
        else if (ev->state & Gdk::CONTROL_MASK) { // Ctrl-1
            on_level_1_activated ();
            return true;
        }
        else {
            return false;
        }
        break;

    case GDK_KEY_2:
        if (ev->state & Gdk::CONTROL_MASK) { // Ctrl-2
            on_level_2_activated ();
            return true;
        }
        else {
            return false;
        }
        break;

    default:
        return false;
    }

    return false;
}
Beispiel #2
0
void TableofcontentsNoteAddin::on_level_2_action(const Glib::VariantBase&)
{
  on_level_2_activated();
  on_note_changed();
}