diff --git a/src/shortcuts.cpp b/src/shortcuts.cpp
index 7061df77a4d5ec241b9a7fec1467f37682d96f1c..cf7f485c6d9197bb94c51942b286f00dce1eb642 100644 (file)
--- a/src/shortcuts.cpp
+++ b/src/shortcuts.cpp
}
XML::Node const *root=doc->root();
- g_return_if_fail(!strcmp(root->name(), "keybindings"));
+ g_return_if_fail(!strcmp(root->name(), "keys"));
XML::NodeConstSiblingIterator iter=root->firstChild();
for ( ; iter ; ++iter ) {
bool is_primary;
- if (!strcmp(iter->name(), "primary")) {
- is_primary = true;
- } else if (!strcmp(iter->name(), "secondary")) {
- is_primary = false;
+ if (!strcmp(iter->name(), "bind")) {
+ is_primary = iter->attribute("display") && strcmp(iter->attribute("display"), "false") && strcmp(iter->attribute("display"), "0");
} else {
- g_warning("Unknown key binding type %s", iter->name());
+ // some unknown element, do not complain
continue;
}
- gchar const *verb_name=iter->attribute("verb");
+ gchar const *verb_name=iter->attribute("action");
if (!verb_name) {
- g_warning("Missing verb name for shortcut");
+ g_warning("Missing verb name (action= attribute) for shortcut");
continue;
}
- gchar const *keyval_name=iter->attribute("keyval");
+ Inkscape::Verb *verb=Inkscape::Verb::getbyid(verb_name);
+ if (!verb) {
+ g_warning("Unknown verb name: %s", verb_name);
+ continue;
+ }
+
+ gchar const *keyval_name=iter->attribute("key");
if (!keyval_name) {
- g_warning("Missing keyval for %s", verb_name);
+ // that's ok, it's just listed for reference without assignment, skip it
continue;
}
+
guint keyval=gdk_keyval_from_name(keyval_name);
if (keyval == GDK_VoidSymbol) {
g_warning("Unknown keyval %s for %s", keyval_name, verb_name);
while (*iter) {
size_t length=strcspn(iter, ",");
gchar *mod=g_strndup(iter, length);
- if (!strcmp(mod, "control")) {
+ if (!strcmp(mod, "Control") || !strcmp(mod, "Ctrl")) {
modifiers |= SP_SHORTCUT_CONTROL_MASK;
- } else if (!strcmp(mod, "shift")) {
+ } else if (!strcmp(mod, "Shift")) {
modifiers |= SP_SHORTCUT_SHIFT_MASK;
- } else if (!strcmp(mod, "alt")) {
+ } else if (!strcmp(mod, "Alt")) {
modifiers |= SP_SHORTCUT_ALT_MASK;
} else {
g_warning("Unknown modifier %s for %s", mod, verb_name);
}
}
- sp_shortcut_set(keyval | modifiers,
- Inkscape::Verb::getbyid(verb_name),
- is_primary);
+ sp_shortcut_set(keyval | modifiers, verb, is_primary);
}
GC::release(doc);