mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-11 00:56:33 +01:00
faderport: show current User button bindings in GUI
This commit is contained in:
parent
a9ce37b7ac
commit
e82cc88c6f
2 changed files with 41 additions and 4 deletions
|
|
@ -349,14 +349,14 @@ FPGUI::build_available_action_menu ()
|
||||||
|
|
||||||
available_action_model->clear ();
|
available_action_model->clear ();
|
||||||
|
|
||||||
/* Because there are button bindings built in that are not
|
|
||||||
in the key binding map, there needs to be a way to undo
|
|
||||||
a profile edit. */
|
|
||||||
TreeIter rowp;
|
TreeIter rowp;
|
||||||
TreeModel::Row parent;
|
TreeModel::Row parent;
|
||||||
|
|
||||||
|
/* Disabled item (row 0) */
|
||||||
|
|
||||||
rowp = available_action_model->append();
|
rowp = available_action_model->append();
|
||||||
parent = *(rowp);
|
parent = *(rowp);
|
||||||
parent[action_columns.name] = _("Remove Binding");
|
parent[action_columns.name] = _("Disabled");
|
||||||
|
|
||||||
/* Key aliasing */
|
/* Key aliasing */
|
||||||
|
|
||||||
|
|
@ -529,12 +529,46 @@ FPGUI::build_trns_action_combo (Gtk::ComboBox& cb, FaderPort::ButtonState bs)
|
||||||
build_action_combo (cb, actions, FaderPort::Trns, bs);
|
build_action_combo (cb, actions, FaderPort::Trns, bs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
FPGUI::find_action_in_model (const TreeModel::iterator& iter, std::string const & action_path, TreeModel::iterator* found)
|
||||||
|
{
|
||||||
|
TreeModel::Row row = *iter;
|
||||||
|
string path = row[action_columns.path];
|
||||||
|
|
||||||
|
if (path == action_path) {
|
||||||
|
*found = iter;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FPGUI::build_user_action_combo (Gtk::ComboBox& cb, FaderPort::ButtonState bs)
|
FPGUI::build_user_action_combo (Gtk::ComboBox& cb, FaderPort::ButtonState bs)
|
||||||
{
|
{
|
||||||
cb.set_model (available_action_model);
|
cb.set_model (available_action_model);
|
||||||
cb.pack_start (action_columns.name);
|
cb.pack_start (action_columns.name);
|
||||||
cb.signal_changed().connect (sigc::bind (sigc::mem_fun (*this, &FPGUI::action_changed), &cb, FaderPort::User, bs));
|
cb.signal_changed().connect (sigc::bind (sigc::mem_fun (*this, &FPGUI::action_changed), &cb, FaderPort::User, bs));
|
||||||
|
|
||||||
|
/* set the active "row" to the right value for the current button binding */
|
||||||
|
|
||||||
|
string current_action = fp.get_action (FaderPort::User, false, bs); /* lookup release action */
|
||||||
|
|
||||||
|
if (current_action.empty()) {
|
||||||
|
cb.set_active (0); /* "disabled" */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TreeModel::iterator iter = available_action_model->children().end();
|
||||||
|
|
||||||
|
available_action_model->foreach_iter (sigc::bind (sigc::mem_fun (*this, &FPGUI::find_action_in_model), current_action, &iter));
|
||||||
|
|
||||||
|
if (iter != available_action_model->children().end()) {
|
||||||
|
cb.set_active (iter);
|
||||||
|
} else {
|
||||||
|
cb.set_active (0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Glib::RefPtr<Gtk::ListStore>
|
Glib::RefPtr<Gtk::ListStore>
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,9 @@ private:
|
||||||
|
|
||||||
void build_available_action_menu ();
|
void build_available_action_menu ();
|
||||||
void action_changed (Gtk::ComboBox*, FaderPort::ButtonID, FaderPort::ButtonState);
|
void action_changed (Gtk::ComboBox*, FaderPort::ButtonID, FaderPort::ButtonState);
|
||||||
|
|
||||||
|
bool find_action_in_model (const Gtk::TreeModel::iterator& iter, std::string const & action_path, Gtk::TreeModel::iterator* found);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue