shortcuts.cpp revision 8645b77467bb88ce94f5b1221f1e4860216da6cb
#define __SP_SHORTCUTS_C__
/** \file
* Keyboard shortcut processing.
*/
/*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* MenTaLguY <mental@rydia.net>
* bulia byak <buliabyak@users.sf.net>
* Peter Moulder <pmoulder@mail.csse.monash.edu.au>
*
* Copyright (C) 2005 Monash University
* Copyright (C) 2005 MenTaLguY <mental@rydia.net>
*
* as published by the Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vector>
#include <cstring>
#include <string>
#include <map>
#include <gdk/gdkkeysyms.h>
#include "io/resource.h"
#include "shortcuts.h"
#include "verbs.h"
#include "xml/node-iterators.h"
using namespace Inkscape;
static void sp_shortcut_set(unsigned int const shortcut, Inkscape::Verb *const verb, bool const is_primary);
static void try_shortcuts_file(char const *filename);
static void read_shortcuts_file(char const *filename);
/* Returns true if action was performed */
bool
{
if (verb) {
if (action) {
return true;
}
}
return false;
}
static void
{
}
static void try_shortcuts_file(char const *filename) {
/* ah, if only we had an exception to catch... (permission, forgiveness) */
}
}
static void read_shortcuts_file(char const *filename) {
if (!doc) {
return;
}
bool is_primary;
is_primary = iter->attribute("display") && strcmp(iter->attribute("display"), "false") && strcmp(iter->attribute("display"), "0");
} else {
// some unknown element, do not complain
continue;
}
if (!verb_name) {
g_warning("Missing verb name (action= attribute) for shortcut");
continue;
}
if (!verb) {
continue;
}
if (!keyval_name || !*keyval_name) {
// that's ok, it's just listed for reference without assignment, skip it
continue;
}
continue;
}
if (modifiers_string) {
while (*iter) {
} else {
}
}
}
}
}
/**
* 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.)
*
* \param is_primary True iff this is the shortcut to be written in menu items or buttons.
*
* \post sp_shortcut_get_verb(shortcut) == verb.
* \post !is_primary or sp_shortcut_get_primary(verb) == shortcut.
*/
static void
{
if (!verbs) sp_shortcut_init();
/* Maintain the invariant that sp_shortcut_get_primary(v) returns either 0 or a valid shortcut for v. */
if (old_primary == shortcut) {
(*primary_shortcuts)[old_verb] = 0;
}
}
if (is_primary) {
}
}
sp_shortcut_get_verb(unsigned int shortcut)
{
if (!verbs) sp_shortcut_init();
}
{
unsigned int result = GDK_VoidSymbol;
if (!primary_shortcuts) {
}
}
return result;
}
{
// The comment below was copied from the function sp_ui_shortcut_string in interface.cpp (which was subsequently removed)
/* TODO: This function shouldn't exist. Our callers should use GtkAccelLabel instead of
* a generic GtkLabel containing this string, and should call gtk_widget_add_accelerator.
* Will probably need to change sp_shortcut_invoke callers.
*
* The existing gtk_label_new_with_mnemonic call can be replaced with
* g_object_new(GTK_TYPE_ACCEL_LABEL, NULL) followed by
* gtk_label_set_text_with_mnemonic(lbl, str).
*/
if (shortcut != GDK_VoidSymbol) {
));
}
return result;
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :