MCP: make v-pot press work; work ongoing on general keybindings
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 16 Apr 2012 13:06:39 +0000 (13:06 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 16 Apr 2012 13:06:39 +0000 (13:06 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@11985 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/surfaces/mackie/device_info.h
libs/surfaces/mackie/gui.cc
libs/surfaces/mackie/mackie_control_protocol.cc
libs/surfaces/mackie/mackie_control_protocol.h
libs/surfaces/mackie/mcp_buttons.cc
libs/surfaces/mackie/strip.cc

index e7f0bc71666307d6344404507ea52cb960e101a7..287bed5c0e0cc9ba9f2d5c79b8cffd68dfcb4785 100644 (file)
@@ -104,6 +104,18 @@ class DeviceProfile
 
        const std::string& get_f_action (uint32_t fn, int modifier_state);
        void set_f_action (uint32_t fn, int modifier_state, const std::string&);
+
+  private:
+    struct KeyActions {
+        std::string plain;
+        std::string control;
+        std::string shift;
+        std::string option;
+        std::string cmdalt;
+        std::string shiftcontrol;
+    };
+
+    typedef std::map<Button::ID,KeyActions> KeyActionMap;
 };
 
 }
index 6ca76d4c0e1c847ee08a0f41037ea710dff7be16..1086e44bfbe507bb18f0d82c400c719febdb6cd2 100644 (file)
@@ -240,7 +240,7 @@ MackieControlProtocolGUI::rebuild_function_key_editor ()
                row = *(function_key_model->append());
                row[function_key_columns.name] = string_compose ("F%1", n+1);
                row[function_key_columns.number] = n;
-               row[function_key_columns.plain] = _cp.f_action (n, 0);
+               row[function_key_columns.plain] = ""; // _cp.f_action (n, 0);
                row[function_key_columns.control] = "c";
                row[function_key_columns.option] = "o";
                row[function_key_columns.shift] = "s";
index c0ad5fde1f6428398e9ea83bcca572a7e98c8625..c681d5ac897f55b2dc0782fd97c6d7f4540476d7 100644 (file)
@@ -615,12 +615,6 @@ MackieControlProtocol::get_state()
        os << _current_initial_bank;
        node->add_property (X_("bank"), os.str());
 
-       for (uint32_t n = 0; n < 16; ++n) {
-               ostringstream s;
-               s << string_compose ("f%1-action", n+1);
-               node->add_property (s.str().c_str(), f_action (n));
-       }
-
        return *node;
 }
 
@@ -642,23 +636,6 @@ MackieControlProtocol::set_state (const XMLNode & node, int /*version*/)
                }
        }
 
-       _f_actions.clear ();
-       _f_actions.resize (16);
-
-       for (uint32_t n = 0; n < 16; ++n) {
-               string action;
-               if ((prop = node.property (string_compose ("f%1-action", n+1))) != 0) {
-                       action = prop->value();
-               }
-
-               if (action.empty()) {
-                       /* default action if nothing is specified */
-                       action = string_compose ("Editor/goto-visual-state-%1", n+1);
-               }
-
-               _f_actions[n] = action;
-       }
-
        return retval;
 }
 
@@ -1140,25 +1117,6 @@ MackieControlProtocol::clear_ports ()
        port_sources.clear ();
 }
 
-string
-MackieControlProtocol::f_action (uint32_t fn, uint32_t /* modifier */)
-{
-       if (fn >= _f_actions.size()) {
-               return string();
-       }
-
-       return _f_actions[fn];
-}
-
-void
-MackieControlProtocol::f_press (uint32_t fn)
-{
-       string action = f_action (0);
-       if (!action.empty()) {
-               access_action (action);
-       }
-}
-
 void
 MackieControlProtocol::set_view_mode (ViewMode m)
 {
index cab0521a54eed19266bc07754eb3653d9d9d84e9..ea3e69d9a7aea614bbf57f7ad69dbdb62d1df111 100644 (file)
@@ -191,8 +191,6 @@ class MackieControlProtocol
        void remove_down_select_button (int surface, int strip);
        void select_range ();
        
-       std::string f_action (uint32_t fn, uint32_t modifier = 0);
-
   protected:
        // shut down the surface
        void close();
@@ -279,7 +277,6 @@ class MackieControlProtocol
        int                      _current_selected_track;
        int                      _modifier_state;
        PortSources               port_sources;
-       std::vector<std::string> _f_actions;
        ButtonMap                 button_map;
 
        void create_surfaces ();
index 5999220c5250c111eb7c318f8dd6a1bda20a5172..4032785a3be480bf8b2aec7ca3ad209f61f8e291 100644 (file)
@@ -663,6 +663,17 @@ MackieControlProtocol::enter_release (Button &)
 { 
        return off;
 }
+
+void
+MackieControlProtocol::f_press (uint32_t fn)
+{
+#if 0
+       string action = f_action (0);
+       if (!action.empty()) {
+               access_action (action);
+       }
+#endif
+}
 LedState
 MackieControlProtocol::F1_press (Button &) 
 { 
index a00a75dffd519433047af6ade3daa4a3c7903111..e8a2415cfe77fb565ea4d0dd98a27abf80388201 100644 (file)
@@ -399,7 +399,19 @@ Strip::handle_button (Button& button, ButtonState bs)
 
                return;
        }
-       
+
+       if (button.bid() == Button::VSelect) {
+               if (bs == press) {
+                       /* swap controls on the vpot */
+                       boost::shared_ptr<AutomationControl> ac = button.control (true);
+                       button.set_modified_control (button.control (false));
+                       button.set_normal_control (ac);
+                       _surface->write (display (1, static_display_string ()));
+               }
+
+               return;
+       }
+
        if (button.bid() == Button::FaderTouch) {
 
                DEBUG_TRACE (DEBUG::MackieControl, string_compose ("fader touch, press ? %1\n", (bs == press)));
@@ -663,11 +675,42 @@ Strip::gui_selection_changed (ARDOUR::RouteNotificationListPtr rl)
 string
 Strip::static_display_string () const
 {
-       if (_surface->mcp().flip_mode()) {
+       if (!_vpot) {
+               return string();
+       }
+
+       boost::shared_ptr<AutomationControl> ac = _vpot->control (false);
+
+       if (!ac) {
+               return string();
+       }
+       
+       /* don't use canonical controllable names here because we're
+        * limited by space concerns
+        */
+       
+       switch((AutomationType)ac->parameter().type()) {
+       case GainAutomation:
                return "Fader";
-       } else {
+               break;
+       case PanAzimuthAutomation:
                return "Pan";
+               break;
+       case PanWidthAutomation:
+               return "Width";
+               break;
+       case PanElevationAutomation:
+       case PanFrontBackAutomation:
+       case PanLFEAutomation:
+               break;
+       case PluginAutomation:
+               return string_compose ("Param %d", ac->parameter().id());
+               break;
+       default:
+               break;
        }
+
+       return "???";
 }
 
 void