#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;
, ipmidi_base_port_adjustment (_cp.ipmidi_base(), 0, 32767, 1, 1000)
, discover_button (_("Discover Mackie Devices"))
, _device_dependent_widget (0)
+ , _ignore_profile_changed (false)
, ignore_active_change (false)
{
Gtk::Label* l;
table.attach (*l, 0, 1, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions (0));
touch_sensitivity_scale.property_digits() = 0;
touch_sensitivity_scale.property_draw_value() = false;
- table.attach (touch_sensitivity_scale, 1, 2, 5, 6, AttachOptions(FILL|EXPAND), AttachOptions (0));
+ table.attach (touch_sensitivity_scale, 1, 2, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions (0));
row++;
- table.attach (recalibrate_fader_button, row, row+1, 6, 7, AttachOptions(FILL|EXPAND), AttachOptions (0));
+ table.attach (recalibrate_fader_button, 1, 2, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions (0));
row++;
vector<string> profiles;
- profiles.push_back ("default");
-
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));
int row = 0;
uint32_t n_surfaces = 1 + _cp.device_info().extenders();
+ uint32_t main_pos = _cp.device_info().master_position();
if (!_cp.device_info().uses_ipmidi()) {
dd_table = Gtk::manage (new Gtk::Table (n_surfaces, 2));
string receive_string;
if (n_surfaces > 1) {
- if (n == 0) {
- send_string = _("Main surface sends via:");
- receive_string = _("Main surface receives via:");
+ if (n == main_pos) {
+ send_string = string_compose(_("Main surface at position %1 sends via:"), n + 1);
+ receive_string = string_compose(_("Main surface at position %1 receives via:"), n + 1);
} else {
- send_string = string_compose (_("Extender %1 sends via:"), n);
- receive_string = string_compose (_("Extender %1 receives via:"), n);
+ send_string = string_compose (_("Extender at position %1 sends via:"), n + 1);
+ receive_string = string_compose (_("Extender at position %1 receives via:"), n + 1);
}
} else {
send_string = _("Surface sends via:");
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);
+ ActionManager::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;
}
}
}
_cp.device_profile().set_button_action ((*row)[function_key_columns.id], modifier, i->second);
}
+ _ignore_profile_changed = true;
+ _profile_combo.set_active_text ( _cp.device_profile().name() );
+ _ignore_profile_changed = false;
+
} else {
std::cerr << "no such action\n";
}
void
MackieControlProtocolGUI::surface_combo_changed ()
{
- _cp.not_session_load();
_cp.set_device (_surface_combo.get_active_text(), false);
}
void
MackieControlProtocolGUI::profile_combo_changed ()
{
- string profile = _profile_combo.get_active_text();
+ if (!_ignore_profile_changed) {
+ string profile = _profile_combo.get_active_text();
- _cp.set_profile (profile);
+ _cp.set_profile (profile);
- refresh_function_key_editor ();
+ refresh_function_key_editor ();
+ }
}
void
for (vector<string>::const_iterator p = ports.begin(); p != ports.end(); ++p) {
row = *store->append ();
row[midi_port_columns.full_name] = *p;
- row[midi_port_columns.short_name] = (*p).substr ((*p).find (':') + 1);
+ std::string pn = ARDOUR::AudioEngine::instance()->get_pretty_name_by_name (*p);
+ if (pn.empty ()) {
+ pn = (*p).substr ((*p).find (':') + 1);
+ }
+ row[midi_port_columns.short_name] = pn;
}
return store;