#include "pbd/stacktrace.h"
#include "gtkmm2ext/actions.h"
+#include "gtkmm2ext/bindings.h"
#include "gtkmm2ext/gui_thread.h"
#include "gtkmm2ext/utils.h"
#include "surface.h"
#include "surface_port.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
using namespace std;
using namespace Gtk;
vector<string> profiles;
for (std::map<std::string,DeviceProfile>::iterator i = DeviceProfile::device_profiles.begin(); i != DeviceProfile::device_profiles.end(); ++i) {
+ cerr << "add discovered profile " << i->first << endl;
profiles.push_back (i->first);
}
Gtkmm2ext::set_popdown_strings (_profile_combo, profiles);
+ cerr << "set active profile from " << p.device_profile().name() << endl;
_profile_combo.set_active_text (p.device_profile().name());
_profile_combo.signal_changed().connect (sigc::mem_fun (*this, &MackieControlProtocolGUI::profile_combo_changed));
vector<string> labels;
vector<string> tooltips;
vector<string> keys;
- vector<AccelKey> bindings;
+ vector<Glib::RefPtr<Gtk::Action> > actions;
+
typedef std::map<string,TreeIter> NodeMap;
NodeMap nodes;
NodeMap::iterator r;
- ActionManager::get_all_actions (labels, paths, tooltips, keys, bindings);
+ Gtkmm2ext::ActionMap::get_all_actions (paths, labels, tooltips, keys, actions);
vector<string>::iterator k;
vector<string>::iterator p;
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. */
+ in the key binding map, there needs to be a way to undo
+ a profile edit.
+ */
TreeIter rowp;
TreeModel::Row parent;
rowp = available_action_model->append();
parent = *(rowp);
parent[available_action_columns.name] = _("CmdAlt");
-
for (l = labels.begin(), k = keys.begin(), p = paths.begin(), t = tooltips.begin(); l != labels.end(); ++k, ++p, ++t, ++l) {
TreeModel::Row row;
string action;
const string defstring = "\u2022";
- action = dp.get_button_action (bid, 0);
- if (action.empty()) {
- row[function_key_columns.plain] = defstring;
- } else {
- if (action.find ('/') == string::npos) {
- /* Probably a key alias */
- row[function_key_columns.plain] = action;
- } else {
+ /* We only allow plain bindings for Fn keys. All others are
+ * reserved for hard-coded actions.
+ */
- act = ActionManager::get_action (action.c_str());
- if (act) {
- row[function_key_columns.plain] = act->get_label();
+ if (bid >= Mackie::Button::F1 && bid <= Mackie::Button::F8) {
+
+ action = dp.get_button_action (bid, 0);
+ if (action.empty()) {
+ row[function_key_columns.plain] = defstring;
+ } else {
+ if (action.find ('/') == string::npos) {
+ /* Probably a key alias */
+ row[function_key_columns.plain] = action;
} else {
- row[function_key_columns.plain] = defstring;
+
+ act = ActionManager::get_action (action.c_str());
+ if (act) {
+ row[function_key_columns.plain] = act->get_label();
+ } else {
+ row[function_key_columns.plain] = defstring;
+ }
}
}
}
- action = dp.get_button_action (bid, MackieControlProtocol::MODIFIER_CONTROL);
- if (action.empty()) {
- row[function_key_columns.control] = defstring;
- } else {
- if (action.find ('/') == string::npos) {
- /* Probably a key alias */
- row[function_key_columns.control] = action;
+ /* We only allow plain bindings for Fn keys. All others are
+ * reserved for hard-coded actions.
+ */
+
+ if (bid >= Mackie::Button::F1 && bid <= Mackie::Button::F8) {
+
+ action = dp.get_button_action (bid, MackieControlProtocol::MODIFIER_SHIFT);
+ if (action.empty()) {
+ row[function_key_columns.shift] = defstring;
} else {
- act = ActionManager::get_action (action.c_str());
- if (act) {
- row[function_key_columns.control] = act->get_label();
+ if (action.find ('/') == string::npos) {
+ /* Probably a key alias */
+ row[function_key_columns.shift] = action;
} else {
- row[function_key_columns.control] = defstring;
+ act = ActionManager::get_action (action.c_str());
+ if (act) {
+ row[function_key_columns.shift] = act->get_label();
+ } else {
+ row[function_key_columns.shift] = defstring;
+ }
}
}
}
- action = dp.get_button_action (bid, MackieControlProtocol::MODIFIER_SHIFT);
+ action = dp.get_button_action (bid, MackieControlProtocol::MODIFIER_CONTROL);
if (action.empty()) {
- row[function_key_columns.shift] = defstring;
+ row[function_key_columns.control] = defstring;
} else {
if (action.find ('/') == string::npos) {
/* Probably a key alias */
- row[function_key_columns.shift] = action;
+ row[function_key_columns.control] = action;
} else {
act = ActionManager::get_action (action.c_str());
if (act) {
- row[function_key_columns.shift] = act->get_label();
+ row[function_key_columns.control] = act->get_label();
} else {
- row[function_key_columns.shift] = defstring;
+ row[function_key_columns.control] = defstring;
}
}
}