shortcuts.cpp revision 560a131fd676a3d5926ebbf12e4aa7a91ad38e90
#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 <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();
Inkscape::Verb *old_verb = (Inkscape::Verb *)(g_hash_table_lookup(verbs, GINT_TO_POINTER(shortcut)));
/* Maintain the invariant that sp_shortcut_get_primary(v) returns either 0 or a valid shortcut for v. */
unsigned int const old_primary = (unsigned int)GPOINTER_TO_INT(g_hash_table_lookup(primary_shortcuts, (gpointer)old_verb));
if (old_primary == shortcut) {
}
}
if (is_primary) {
}
}
sp_shortcut_get_verb(unsigned int shortcut)
{
if (!verbs) sp_shortcut_init();
}
unsigned int
{
if (!primary_shortcuts) sp_shortcut_init();
return (unsigned int)GPOINTER_TO_INT(value);
} else {
return GDK_VoidSymbol;
}
}
{
// 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 0;
return gtk_accelerator_get_label(
));
}
/*
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:encoding=utf-8:textwidth=99 :