13
0

faderport: allow User button to be bound to ANY possible action.

This does involve nagivating some really gnarly menus, which is unfortunate, but we don't have a good general
solution for this yet (it is fundamentally the same problem that affects the key binding editor and Mackie support
This commit is contained in:
Paul Davis 2015-12-01 11:20:09 -05:00
parent 0e629cd162
commit 03a4926790
3 changed files with 42 additions and 1 deletions

View File

@ -715,6 +715,8 @@ FaderPort::connected ()
void
FaderPort::Button::invoke (FaderPort::ButtonState bs, bool press)
{
DEBUG_TRACE (DEBUG::FaderPort, string_compose ("invoke button %1 for %2 state %3%4%5\n", id, (press ? "press":"release"), hex, bs, dec));
if (!press) {
if (long_press) {
bs = FaderPort::ButtonState (bs | LongPress);

View File

@ -136,6 +136,12 @@ FPGUI::FPGUI (FaderPort& p)
build_trns_action_combo (trns_combo[1], FaderPort::ShiftDown);
build_trns_action_combo (trns_combo[2], FaderPort::LongPress);
build_available_action_menu ();
build_user_action_combo (user_combo[0], FaderPort::ButtonState(0));
build_user_action_combo (user_combo[1], FaderPort::ShiftDown);
build_user_action_combo (user_combo[2], FaderPort::LongPress);
action_table.set_row_spacings (4);
action_table.set_col_spacings (6);
action_table.set_border_width (12);
@ -211,6 +217,24 @@ FPGUI::FPGUI (FaderPort& p)
action_table.attach (*align, 3, 4, action_row, action_row+1, AttachOptions(FILL|EXPAND), AttachOptions (0));
action_row++;
l = manage (new Gtk::Label);
l->set_markup (string_compose ("<span weight=\"bold\">%1</span>", _("User")));
l->set_alignment (1.0, 0.5);
action_table.attach (*l, 0, 1, action_row, action_row+1, AttachOptions(FILL|EXPAND), AttachOptions (0));
align = manage (new Alignment);
align->set (0.0, 0.5);
align->add (user_combo[0]);
action_table.attach (*align, 1, 2, action_row, action_row+1, AttachOptions(FILL|EXPAND), AttachOptions (0));
align = manage (new Alignment);
align->set (0.0, 0.5);
align->add (user_combo[1]);
action_table.attach (*align, 2, 3, action_row, action_row+1, AttachOptions(FILL|EXPAND), AttachOptions (0));
align = manage (new Alignment);
align->set (0.0, 0.5);
align->add (user_combo[2]);
action_table.attach (*align, 3, 4, action_row, action_row+1, AttachOptions(FILL|EXPAND), AttachOptions (0));
action_row++;
table.attach (action_table, 0, 5, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions (0));
row++;
@ -406,7 +430,13 @@ FPGUI::build_available_action_menu ()
action_map[*l] = *p;
}
row[action_columns.path] = (*p);
string path = (*p);
/* ControlProtocol::access_action() is not interested in the
legacy "<Actions>/" prefix part of a path.
*/
path = path.substr (strlen ("<Actions>/"));
row[action_columns.path] = path;
}
}
@ -499,6 +529,14 @@ FPGUI::build_trns_action_combo (Gtk::ComboBox& cb, FaderPort::ButtonState bs)
build_action_combo (cb, actions, FaderPort::Trns, bs);
}
void
FPGUI::build_user_action_combo (Gtk::ComboBox& cb, FaderPort::ButtonState bs)
{
cb.set_model (available_action_model);
cb.pack_start (action_columns.name);
cb.signal_changed().connect (sigc::bind (sigc::mem_fun (*this, &FPGUI::action_changed), &cb, FaderPort::User, bs));
}
Glib::RefPtr<Gtk::ListStore>
FPGUI::build_midi_port_list (vector<string> const & ports, bool for_input)
{

View File

@ -99,6 +99,7 @@ private:
void build_mix_action_combo (Gtk::ComboBox&, FaderPort::ButtonState);
void build_proj_action_combo (Gtk::ComboBox&, FaderPort::ButtonState);
void build_trns_action_combo (Gtk::ComboBox&, FaderPort::ButtonState);
void build_user_action_combo (Gtk::ComboBox&, FaderPort::ButtonState);
void build_available_action_menu ();
void action_changed (Gtk::ComboBox*, FaderPort::ButtonID, FaderPort::ButtonState);