#include "gtkmm2ext/utils.h"
#include "gtkmm2ext/actions.h"
+#include "ardour/rc_configuration.h"
+
#include "mackie_control_protocol.h"
#include "device_info.h"
#include "gui.h"
, touch_sensitivity_adjustment (0, 0, 9, 1, 4)
, touch_sensitivity_scale (touch_sensitivity_adjustment)
, recalibrate_fader_button (_("Recalibrate Faders"))
+ , ipmidi_base_port_adjustment (_cp.ipmidi_base(), 0, 32767, 1, 1000)
+ , ipmidi_base_port_spinner (ipmidi_base_port_adjustment)
+ , discover_button (_("Discover Mackie Devices"))
{
Gtk::Label* l;
Gtk::Alignment* align;
set_border_width (12);
- Gtk::Table* table = Gtk::manage (new Gtk::Table (2, 7));
+ Gtk::Table* table = Gtk::manage (new Gtk::Table (2, 9));
table->set_row_spacings (4);
table->set_col_spacings (6);
+ table->set_border_width (12);
l = manage (new Gtk::Label (_("Device Type:")));
+ l->set_alignment (1.0, 0.5);
table->attach (*l, 0, 1, 0, 1, AttachOptions(FILL|EXPAND), AttachOptions(0));
table->attach (_surface_combo, 1, 2, 0, 1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 20);
table->attach (touch_sensitivity_scale, 1, 2, 5, 6, AttachOptions(FILL|EXPAND), AttachOptions (0));
table->attach (recalibrate_fader_button, 1, 2, 6, 7, AttachOptions(FILL|EXPAND), AttachOptions (0));
+ l = manage (new Gtk::Label (_("ipMIDI Port (lowest)")));
+ l->set_alignment (1.0, 0.5);
+ table->attach (*l, 0, 1, 7, 8, AttachOptions(FILL|EXPAND), AttachOptions (0));
+ table->attach (ipmidi_base_port_spinner, 1, 2, 7, 8, AttachOptions(FILL|EXPAND), AttachOptions (0));
+
+ ipmidi_base_port_spinner.set_sensitive (_cp.device_info().uses_ipmidi());
+ ipmidi_base_port_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &MackieControlProtocolGUI::ipmidi_spinner_changed));
+
+
+ table->attach (discover_button, 1, 2, 8, 9, AttachOptions(FILL|EXPAND), AttachOptions (0));
+ discover_button.signal_clicked().connect (sigc::mem_fun (*this, &MackieControlProtocolGUI::discover_clicked));
+
vector<string> profiles;
profiles.push_back ("default");
VBox* fkey_packer = manage (new VBox);
HBox* profile_packer = manage (new HBox);
-
+ HBox* observation_packer = manage (new HBox);
+
l = manage (new Gtk::Label (_("Profile/Settings:")));
profile_packer->pack_start (*l, false, false);
profile_packer->pack_start (_profile_combo, true, true);
profile_packer->set_spacing (12);
profile_packer->set_border_width (12);
+
+ l = manage (new Gtk::Label (_("* Button available at the original Mackie MCU PRO or current device if enabled (NOT implemented yet). Device specific name presented.")));
+ observation_packer->pack_start (*l, false, false);
fkey_packer->pack_start (*profile_packer, false, false);
fkey_packer->pack_start (function_key_scroller, true, true);
+ fkey_packer->pack_start (*observation_packer, false, false);
fkey_packer->set_spacing (12);
- function_key_scroller.set_size_request (700,700);
function_key_scroller.property_shadow_type() = Gtk::SHADOW_NONE;
function_key_scroller.add (function_key_editor);
append_page (*fkey_packer, _("Function Keys"));
-
+
build_available_action_menu ();
build_function_key_editor ();
refresh_function_key_editor ();
TreeModel::Row row;
DeviceProfile dp (_cp.device_profile());
+ DeviceInfo di;
for (int n = 0; n < Mackie::Button::FinalGlobalButton; ++n) {
Mackie::Button::ID bid = (Mackie::Button::ID) n;
row = *(function_key_model->append());
- row[function_key_columns.name] = Mackie::Button::id_to_name (bid);
+ if (di.global_buttons().find (bid) == di.global_buttons().end()) {
+ row[function_key_columns.name] = Mackie::Button::id_to_name (bid);
+ } else {
+ row[function_key_columns.name] = di.get_global_button_name (bid) + "*";
+ }
row[function_key_columns.id] = bid;
Glib::RefPtr<Gtk::Action> act;
string action;
- const string defstring = "def";
+ const string defstring = "\u2022";
action = dp.get_button_action (bid, 0);
if (action.empty()) {
std::map<std::string,std::string>::iterator i = action_map.find (text);
- cerr << "Changed to " << text << endl;
-
if (i == action_map.end()) {
return;
}
}
_cp.device_profile().set_button_action ((*row)[function_key_columns.id], modifier, i->second);
+ } else {
+ std::cerr << "no such action\n";
}
-
}
}
MackieControlProtocolGUI::surface_combo_changed ()
{
_cp.set_device (_surface_combo.get_active_text());
+
+ /* update ipMIDI field */
+
+ ipmidi_base_port_spinner.set_sensitive (_cp.device_info().uses_ipmidi());
}
void
MackieControlProtocolGUI::profile_combo_changed ()
{
- _cp.set_profile (_profile_combo.get_active_text());
+ string profile = _profile_combo.get_active_text();
+
+ _cp.set_profile (profile);
+
refresh_function_key_editor ();
}
+void
+MackieControlProtocolGUI::ipmidi_spinner_changed ()
+{
+ _cp.set_ipmidi_base ((int16_t) lrintf (ipmidi_base_port_spinner.get_value()));
+}
+void
+MackieControlProtocolGUI::discover_clicked ()
+{
+ /* this should help to get things started */
+ _cp.midi_connectivity_established ();
+}