Update comments & icon of rubberband example Lua script
[ardour.git] / gtk2_ardour / keyboard.cc
index 2d96aceafffe730c51c0e868aeb4cfa8dcb356e7..6eeea976bde7895456683d12020603c3f1189338 100644 (file)
@@ -1,21 +1,27 @@
 /*
-    Copyright (C) 2001 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
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
+ * Copyright (C) 2005-2016 Paul Davis <paul@linuxaudiosystems.com>
+ * Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
+ * Copyright (C) 2008-2010 David Robillard <d@drobilla.net>
+ * Copyright (C) 2009-2011 Carl Hetherington <carl@carlh.net>
+ * Copyright (C) 2012-2016 Tim Mayberry <mojofunk@gmail.com>
+ * Copyright (C) 2014-2018 Ben Loftis <ben@harrisonconsoles.com>
+ * Copyright (C) 2015-2016 Nick Mainsbridge <mainsbridge@gmail.com>
+ * Copyright (C) 2015-2017 Robin Gareus <robin@gareus.org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
 
 #include "pbd/convert.h"
 #include "pbd/error.h"
@@ -104,7 +110,6 @@ ArdourKeyboard::setup_keybindings ()
 
        string lowercase_program_name = downcase (string(PROGRAM_NAME));
 
-#ifndef MIXBUS // not for v4.0 just yet
        /* extract and append minor vesion */
        std::string rev (revision);
        std::size_t pos = rev.find_first_of("-");
@@ -112,7 +117,6 @@ ArdourKeyboard::setup_keybindings ()
                lowercase_program_name += "-";
                lowercase_program_name += rev.substr (0, pos);
        }
-#endif
 
        user_keybindings_path = Glib::build_filename (user_config_directory(), lowercase_program_name + binding_filename_suffix);
 
@@ -170,8 +174,6 @@ ArdourKeyboard::setup_keybindings ()
                keybindings_path = default_bindings;
        }
 
-       cerr << "KP is " << keybindings_path << endl;
-
        while (true) {
 
                if (!Glib::path_is_absolute (keybindings_path)) {
@@ -218,8 +220,6 @@ ArdourKeyboard::setup_keybindings ()
                }
        }
 
-       info << string_compose (_("Loading keybindings from %1"), keybindings_path) << endmsg;
-
        load_keybindings (keybindings_path);
 
        /* catch changes made via some GTK mechanism */
@@ -232,22 +232,14 @@ XMLNode&
 ArdourKeyboard::get_state (void)
 {
        XMLNode* node = &Keyboard::get_state ();
-       char buf[32];
-
-       snprintf (buf, sizeof (buf), "%d", constraint_mod);
-       node->add_property ("constraint-modifier", buf);
-       snprintf (buf, sizeof (buf), "%d", trim_contents_mod);
-       node->add_property ("trim-contents-modifier", buf);
-       snprintf (buf, sizeof (buf), "%d", trim_overlap_mod);
-       node->add_property ("trim-overlap-modifier", buf);
-       snprintf (buf, sizeof (buf), "%d", trim_anchored_mod);
-       node->add_property ("trim-anchored-modifier", buf);
-       snprintf (buf, sizeof (buf), "%d", fine_adjust_mod);
-       node->add_property ("fine-adjust-modifier", buf);
-       snprintf (buf, sizeof (buf), "%d", push_points_mod);
-       node->add_property ("push-points-modifier", buf);
-       snprintf (buf, sizeof (buf), "%d", note_size_relative_mod);
-       node->add_property ("note-size-relative-modifier", buf);
+
+       node->set_property ("constraint-modifier", constraint_mod);
+       node->set_property ("trim-contents-modifier", trim_contents_mod);
+       node->set_property ("trim-overlap-modifier", trim_overlap_mod);
+       node->set_property ("trim-anchored-modifier", trim_anchored_mod);
+       node->set_property ("fine-adjust-modifier", fine_adjust_mod);
+       node->set_property ("push-points-modifier", push_points_mod);
+       node->set_property ("note-size-relative-modifier", note_size_relative_mod);
 
        return *node;
 }
@@ -255,35 +247,13 @@ ArdourKeyboard::get_state (void)
 int
 ArdourKeyboard::set_state (const XMLNode& node, int version)
 {
-       XMLProperty const * prop;
-
-       if ((prop = node.property ("constraint-modifier")) != 0) {
-               sscanf (prop->value().c_str(), "%d", &constraint_mod);
-       }
-
-       if ((prop = node.property ("trim-contents-modifier")) != 0) {
-               sscanf (prop->value().c_str(), "%d", &trim_contents_mod);
-       }
-
-       if ((prop = node.property ("trim-overlap-modifier")) != 0) {
-               sscanf (prop->value().c_str(), "%d", &trim_overlap_mod);
-       }
-
-       if ((prop = node.property ("trim-anchored-modifier")) != 0) {
-               sscanf (prop->value().c_str(), "%d", &trim_anchored_mod);
-       }
-
-       if ((prop = node.property ("fine-adjust-modifier")) != 0) {
-               sscanf (prop->value().c_str(), "%d", &fine_adjust_mod);
-       }
-
-       if ((prop = node.property ("push-points-modifier")) != 0) {
-               sscanf (prop->value().c_str(), "%d", &push_points_mod);
-       }
-
-       if ((prop = node.property ("note-size-relative-modifier")) != 0) {
-               sscanf (prop->value().c_str(), "%d", &note_size_relative_mod);
-       }
+       node.get_property ("constraint-modifier", constraint_mod);
+       node.get_property ("trim-contents-modifier", trim_contents_mod);
+       node.get_property ("trim-overlap-modifier", trim_overlap_mod);
+       node.get_property ("trim-anchored-modifier", trim_anchored_mod);
+       node.get_property ("fine-adjust-modifier", fine_adjust_mod);
+       node.get_property ("push-points-modifier", push_points_mod);
+       node.get_property ("note-size-relative-modifier", note_size_relative_mod);
 
        return Keyboard::set_state (node, version);
 }