/*
- Copyright (C) 2012 Paul Davis
+ Copyright (C) 2012 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
MouseButton::MouseButton (uint32_t state, uint32_t keycode)
{
uint32_t ignore = Bindings::ignored_state();
-
+
if (gdk_keyval_is_upper (keycode) && gdk_keyval_is_lower (keycode)) {
/* key is not subject to case, so ignore SHIFT
*/
string::size_type lastmod = str.find_last_of ('-');
uint32_t button_number;
-
+
if (lastmod == string::npos) {
button_number = PBD::atoi (str);
} else {
MouseButton::name () const
{
int s = state();
-
+
string str;
if (s & Keyboard::PrimaryModifier) {
str += "Primary";
- }
+ }
if (s & Keyboard::SecondaryModifier) {
if (!str.empty()) {
str += '-';
str += '-';
}
str += "Tertiary";
- }
+ }
if (s & Keyboard::Level4Modifier) {
if (!str.empty()) {
str += '-';
}
str += "Level4";
}
-
+
if (!str.empty()) {
str += '-';
}
KeyboardKey::KeyboardKey (uint32_t state, uint32_t keycode)
{
uint32_t ignore = Bindings::ignored_state();
-
+
if (gdk_keyval_is_upper (keycode) && gdk_keyval_is_lower (keycode)) {
/* key is not subject to case, so ignore SHIFT
*/
KeyboardKey::name () const
{
int s = state();
-
+
string str;
if (s & Keyboard::PrimaryModifier) {
str += "Primary";
- }
+ }
if (s & Keyboard::SecondaryModifier) {
if (!str.empty()) {
str += '-';
str += '-';
}
str += "Tertiary";
- }
+ }
if (s & Keyboard::Level4Modifier) {
if (!str.empty()) {
str += '-';
}
str += "Level4";
}
-
+
if (!str.empty()) {
str += '-';
}
}
MouseButtonBindingMap::iterator b = bbm->find (bb);
-
+
if (b == bbm->end()) {
/* no entry for this key in the state map */
return false;
bbm = &button_release_bindings;
break;
}
-
+
MouseButtonBindingMap::iterator b = bbm->find (bb);
if (b != bbm->end()) {
XMLTree tree;
XMLNode* root = new XMLNode (X_("Bindings"));
tree.set_root (root);
-
+
save (*root);
if (!tree.write (path)) {
if (!tree.read (path)) {
return false;
}
-
+
press_bindings.clear ();
release_bindings.clear ();
Bindings::load (const XMLNode& node)
{
if (node.name() == X_("Press") || node.name() == X_("Release")) {
-
+
Operation op;
-
+
if (node.name() == X_("Press")) {
op = Press;
} else {
op = Release;
}
-
+
const XMLNodeList& children (node.children());
-
+
for (XMLNodeList::const_iterator p = children.begin(); p != children.end(); ++p) {
-
+
XMLProperty* ap;
XMLProperty* kp;
XMLProperty* bp;
-
+
ap = (*p)->property ("action");
kp = (*p)->property ("key");
bp = (*p)->property ("button");
-
+
if (!ap || (!kp && !bp)) {
continue;
}
if (action_map) {
act = action_map->find_action (ap->value());
- }
+ }
if (!act) {
string::size_type slash = ap->value().find ('/');
act = ActionManager::get_action (group.c_str(), action.c_str());
}
}
-
+
if (!act) {
continue;
}
-
+
if (kp) {
KeyboardKey k;
if (!KeyboardKey::make_key (kp->value(), k)) {
}
}
}
-}
+}
RefPtr<Action>
ActionMap::find_action (const string& name)
return RefPtr<Action>();
}
-RefPtr<Action>
+RefPtr<Action>
ActionMap::register_action (const char* path,
const char* name, const char* label, sigc::slot<void> sl)
{
return act;
}
-RefPtr<Action>
+RefPtr<Action>
ActionMap::register_radio_action (const char* path, Gtk::RadioAction::Group& rgroup,
- const char* name, const char* label,
+ const char* name, const char* label,
sigc::slot<void,GtkAction*> sl,
int value)
{
return act;
}
-RefPtr<Action>
+RefPtr<Action>
ActionMap::register_toggle_action (const char* path,
const char* name, const char* label, sigc::slot<void> sl)
{