X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fsurfaces%2Fmackie%2Fgui.h;h=15d266634cc3dcdc56e99c7eef875911ca04b3ac;hb=cf52d6e4b40111eb04b244ec054055a4ec15dbe0;hp=b82825348391d26e5ed61f08a0cc8e3429ee3dbe;hpb=565be46ea11fed1aa49a10aafca260f7f09a630c;p=ardour.git diff --git a/libs/surfaces/mackie/gui.h b/libs/surfaces/mackie/gui.h index b828253483..15d266634c 100644 --- a/libs/surfaces/mackie/gui.h +++ b/libs/surfaces/mackie/gui.h @@ -1,22 +1,24 @@ /* - Copyright (C) 2010 Paul Davis + Copyright (C) 2010-2012 Paul Davis - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include +#include + +#include #include #include #include @@ -25,60 +27,133 @@ #include #include +namespace Gtk { + class CellRendererCombo; +} + +#include "button.h" + +#include "pbd/i18n.h" + +namespace ArdourSurface { + class MackieControlProtocol; -#include "i18n.h" +namespace Mackie { + class Surface; +} class MackieControlProtocolGUI : public Gtk::Notebook { - public: - MackieControlProtocolGUI (MackieControlProtocol &); - - private: - void surface_combo_changed (); - - MackieControlProtocol& _cp; - Gtk::ComboBoxText _surface_combo; - - struct AvailableActionColumns : public Gtk::TreeModel::ColumnRecord { - AvailableActionColumns() { - add (name); - add (path); - } - Gtk::TreeModelColumn name; - Gtk::TreeModelColumn path; - }; - - struct FunctionKeyColumns : public Gtk::TreeModel::ColumnRecord { - FunctionKeyColumns() { - add (name); - add (number); - add (plain); - add (shift); - add (control); - add (option); - add (cmdalt); - add (shiftcontrol); + public: + MackieControlProtocolGUI (MackieControlProtocol &); + + private: + MackieControlProtocol& _cp; + Gtk::Table table; + Gtk::ComboBoxText _surface_combo; + Gtk::ComboBoxText _profile_combo; + + typedef std::vector PortCombos; + PortCombos input_combos; + PortCombos output_combos; + + struct MidiPortColumns : public Gtk::TreeModel::ColumnRecord { + MidiPortColumns() { + add (short_name); + add (full_name); + } + Gtk::TreeModelColumn short_name; + Gtk::TreeModelColumn full_name; + }; + + struct AvailableActionColumns : public Gtk::TreeModel::ColumnRecord { + AvailableActionColumns() { + add (name); + add (path); + } + Gtk::TreeModelColumn name; + Gtk::TreeModelColumn path; }; - Gtk::TreeModelColumn name; - Gtk::TreeModelColumn number; - Gtk::TreeModelColumn plain; - Gtk::TreeModelColumn shift; - Gtk::TreeModelColumn control; - Gtk::TreeModelColumn option; - Gtk::TreeModelColumn cmdalt; - Gtk::TreeModelColumn shiftcontrol; - }; - - AvailableActionColumns available_action_columns; - FunctionKeyColumns function_key_columns; - - Gtk::ScrolledWindow function_key_scroller; - Gtk::TreeView function_key_editor; - Glib::RefPtr function_key_model; - Glib::RefPtr available_action_model; - - void rebuild_function_key_editor (); - void action_changed (const Glib::ustring &sPath, const Glib::ustring &text); + + struct FunctionKeyColumns : public Gtk::TreeModel::ColumnRecord { + FunctionKeyColumns() { + add (name); + add (id); + add (plain); + add (shift); + add (control); + add (option); + add (cmdalt); + add (shiftcontrol); + }; + Gtk::TreeModelColumn name; + Gtk::TreeModelColumn id; + Gtk::TreeModelColumn plain; + Gtk::TreeModelColumn shift; + Gtk::TreeModelColumn control; + Gtk::TreeModelColumn option; + Gtk::TreeModelColumn cmdalt; + Gtk::TreeModelColumn shiftcontrol; + }; + + AvailableActionColumns available_action_columns; + FunctionKeyColumns function_key_columns; + MidiPortColumns midi_port_columns; + + Gtk::ScrolledWindow function_key_scroller; + Gtk::TreeView function_key_editor; + Glib::RefPtr function_key_model; + Glib::RefPtr available_action_model; + + Glib::RefPtr build_midi_port_list (bool for_input); + + void build_available_action_menu (); + void refresh_function_key_editor (); + void build_function_key_editor (); + void action_changed (const Glib::ustring &sPath, const Glib::ustring &text, Gtk::TreeModelColumnBase); + Gtk::CellRendererCombo* make_action_renderer (Glib::RefPtr model, Gtk::TreeModelColumnBase); + + void surface_combo_changed (); + void profile_combo_changed (); + void ipmidi_spinner_changed (); + + std::map action_map; // map from action names to paths + + Gtk::CheckButton relay_click_button; + Gtk::CheckButton backlight_button; + Gtk::RadioButton absolute_touch_mode_button; + Gtk::RadioButton touch_move_mode_button; + Gtk::Adjustment touch_sensitivity_adjustment; + Gtk::HScale touch_sensitivity_scale; + Gtk::Button recalibrate_fader_button; + Gtk::Adjustment ipmidi_base_port_adjustment; + Gtk::Button discover_button; + + void discover_clicked (); + void recalibrate_faders (); + void toggle_backlight (); + void touch_sensitive_change (); + + Gtk::Widget* device_dependent_widget (); + Gtk::Widget* _device_dependent_widget; + int device_dependent_row; + + PBD::ScopedConnection device_change_connection; + void device_changed (); + + void update_port_combos (std::vector const&, std::vector const&, + Gtk::ComboBox* input_combo, + Gtk::ComboBox* output_combo, + boost::shared_ptr surface); + + PBD::ScopedConnection connection_change_connection; + void connection_handler (); + + Glib::RefPtr build_midi_port_list (std::vector const & ports, bool for_input); + bool ignore_active_change; + void active_port_changed (Gtk::ComboBox* combo, boost::weak_ptr ws, bool for_input); }; +} +