using namespace ArdourSurface;
using namespace Mackie;
-#define SHIFT_IS_THE_ONLY_MODIFIER
-
void*
MackieControlProtocol::get_gui () const
{
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));
rowp = available_action_model->append();
parent = *(rowp);
parent[available_action_columns.name] = _("Shift");
-#ifndef SHIFT_IS_THE_ONLY_MODIFIER
rowp = available_action_model->append();
parent = *(rowp);
parent[available_action_columns.name] = _("Control");
rowp = available_action_model->append();
parent = *(rowp);
parent[available_action_columns.name] = _("CmdAlt");
-#endif
for (l = labels.begin(), k = keys.begin(), p = paths.begin(), t = tooltips.begin(); l != labels.end(); ++k, ++p, ++t, ++l) {
CellRendererCombo* renderer;
renderer = make_action_renderer (available_action_model, function_key_columns.plain);
- col = manage (new TreeViewColumn (_("Normal Action"), *renderer));
+ col = manage (new TreeViewColumn (_("Plain"), *renderer));
col->add_attribute (renderer->property_text(), function_key_columns.plain);
function_key_editor.append_column (*col);
renderer = make_action_renderer (available_action_model, function_key_columns.shift);
- col = manage (new TreeViewColumn (_("Action with Shift"), *renderer));
+ col = manage (new TreeViewColumn (_("Shift"), *renderer));
col->add_attribute (renderer->property_text(), function_key_columns.shift);
function_key_editor.append_column (*col);
-#ifndef SHIFT_IS_THE_ONLY_MODIFIER
renderer = make_action_renderer (available_action_model, function_key_columns.control);
col = manage (new TreeViewColumn (_("Control"), *renderer));
col->add_attribute (renderer->property_text(), function_key_columns.control);
col = manage (new TreeViewColumn (_("Shift+Control"), *renderer));
col->add_attribute (renderer->property_text(), function_key_columns.shiftcontrol);
function_key_editor.append_column (*col);
-#endif
function_key_model = ListStore::create (function_key_columns);
function_key_editor.set_model (function_key_model);
DeviceProfile dp (_cp.device_profile());
DeviceInfo di;
- vector<Mackie::Button::ID> Fn_buttons;
- Fn_buttons.push_back (Mackie::Button::F1);
- Fn_buttons.push_back (Mackie::Button::F2);
- Fn_buttons.push_back (Mackie::Button::F3);
- Fn_buttons.push_back (Mackie::Button::F4);
- Fn_buttons.push_back (Mackie::Button::F5);
- Fn_buttons.push_back (Mackie::Button::F6);
- Fn_buttons.push_back (Mackie::Button::F7);
- Fn_buttons.push_back (Mackie::Button::F8);
-
- for (vector<Mackie::Button::ID>::iterator i = Fn_buttons.begin(); i != Fn_buttons.end(); ++i) {
+ for (int n = 0; n < Mackie::Button::FinalGlobalButton; ++n) {
- Mackie::Button::ID bid = *i;
+ Mackie::Button::ID bid = (Mackie::Button::ID) n;
row = *(function_key_model->append());
if (di.global_buttons().find (bid) == di.global_buttons().end()) {
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_SHIFT);
- if (action.empty()) {
- row[function_key_columns.shift] = defstring;
- } else {
- if (action.find ('/') == string::npos) {
- /* Probably a key alias */
- row[function_key_columns.shift] = 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.shift] = act->get_label();
+ if (action.find ('/') == string::npos) {
+ /* Probably a key alias */
+ row[function_key_columns.shift] = action;
} else {
- row[function_key_columns.shift] = 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;
+ }
}
}
}
-#ifndef SHIFT_IS_THE_ONLY_MODIFIER
action = dp.get_button_action (bid, MackieControlProtocol::MODIFIER_CONTROL);
if (action.empty()) {
row[function_key_columns.control] = defstring;
row[function_key_columns.shiftcontrol] = defstring;
}
}
-#endif
}
function_key_editor.set_model (function_key_model);
case 3:
modifier = MackieControlProtocol::MODIFIER_SHIFT;
break;
-#ifndef SHIFT_IS_THE_ONLY_MODIFIER
case 4:
modifier = MackieControlProtocol::MODIFIER_CONTROL;
break;
case 7:
modifier = (MackieControlProtocol::MODIFIER_SHIFT|MackieControlProtocol::MODIFIER_CONTROL);
break;
-#endif
default:
modifier = 0;
}