13
0

MCP: make v-pot press work; work ongoing on general keybindings

git-svn-id: svn://localhost/ardour2/branches/3.0@11985 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-04-16 13:06:39 +00:00
parent 8367cacf15
commit 02c498a8fa
6 changed files with 72 additions and 51 deletions

View 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;
};
}

View 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";

View 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)
{

View 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 ();

View 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 &)
{

View 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()) {
return "Fader";
} else {
return "Pan";
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";
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