1 /* 2 * Copyright (C) 2005-2011 Paul Davis <paul@linuxaudiosystems.com> 3 * Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com> 4 * Copyright (C) 2009-2011 David Robillard <d@drobilla.net> 5 * Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net> 6 * Copyright (C) 2014-2017 Robin Gareus <robin@gareus.org> 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License along 19 * with this program; if not, write to the Free Software Foundation, Inc., 20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 21 */ 22 23 #ifndef __ardour_gtk_panner_ui_h__ 24 #define __ardour_gtk_panner_ui_h__ 25 26 #include <vector> 27 28 #include <gtkmm/box.h> 29 #include <gtkmm/adjustment.h> 30 #include <gtkmm/eventbox.h> 31 #include <gtkmm/arrow.h> 32 #include <gtkmm/togglebutton.h> 33 #include <gtkmm/button.h> 34 35 #include "ardour/session_handle.h" 36 37 #include "enums.h" 38 39 class Panner2d; 40 class Panner2dWindow; 41 class StereoPanner; 42 class MonoPanner; 43 44 namespace ARDOUR { 45 class Session; 46 class Panner; 47 class PannerShell; 48 class Delivery; 49 class AutomationControl; 50 } 51 52 namespace Gtk { 53 class Menu; 54 class Menuitem; 55 } 56 57 class PannerUI : public Gtk::HBox, public ARDOUR::SessionHandlePtr 58 { 59 public: 60 PannerUI (ARDOUR::Session*); 61 ~PannerUI (); 62 63 virtual void set_panner (boost::shared_ptr<ARDOUR::PannerShell>, boost::shared_ptr<ARDOUR::Panner>); 64 65 void panshell_changed (); 66 67 void update_pan_sensitive (); 68 void update_gain_sensitive (); 69 70 void set_width (Width); 71 void setup_pan (); 72 void set_available_panners(std::map<std::string,std::string>); 73 void set_send_drawing_mode (bool); 74 75 void effective_pan_display (); 76 77 void set_meter_strip_name (std::string name); 78 79 void on_size_allocate (Gtk::Allocation &); 80 81 static void setup_slider_pix (); 82 83 private: 84 friend class MixerStrip; 85 friend class SendUI; 86 87 boost::shared_ptr<ARDOUR::PannerShell> _panshell; 88 boost::shared_ptr<ARDOUR::Panner> _panner; 89 PBD::ScopedConnectionList connections; 90 PBD::ScopedConnectionList _pan_control_connections; 91 92 bool in_pan_update; 93 int _current_nouts; 94 int _current_nins; 95 std::string _current_uri; 96 bool _send_mode; 97 98 Panner2d* twod_panner; ///< 2D panner, or 0 99 Panner2dWindow* big_window; 100 101 Gtk::VBox pan_bar_packer; 102 Gtk::VBox pan_vbox; 103 Gtk::VBox poswidth_box; 104 Width _width; 105 106 StereoPanner* _stereo_panner; 107 MonoPanner* _mono_panner; 108 109 bool _ignore_width_change; 110 bool _ignore_position_change; 111 void width_adjusted (); 112 void show_width (); 113 void position_adjusted (); 114 void show_position (); 115 116 Gtk::Menu* pan_astate_menu; 117 Gtk::Menu* pan_astyle_menu; 118 119 Gtk::ToggleButton pan_automation_state_button; 120 121 void pan_value_changed (uint32_t which); 122 void build_astate_menu (); 123 void build_astyle_menu (); 124 125 void hide_pans (); 126 127 void panner_moved (int which); 128 void panner_bypass_toggled (); 129 130 gint start_pan_touch (GdkEventButton*); 131 gint end_pan_touch (GdkEventButton*); 132 133 bool pan_button_event (GdkEventButton*); 134 135 Gtk::Menu* pan_menu; 136 Gtk::CheckMenuItem* bypass_menu_item; 137 Gtk::CheckMenuItem* send_link_menu_item; 138 void build_pan_menu (); 139 void pan_reset (); 140 void pan_bypass_toggle (); 141 void pan_link_toggle (); 142 void pan_edit (); 143 void pan_set_custom_type (std::string type); 144 145 void pan_automation_state_changed(); 146 gint pan_automation_state_button_event (GdkEventButton *); 147 148 void start_touch (boost::weak_ptr<ARDOUR::AutomationControl>); 149 void stop_touch (boost::weak_ptr<ARDOUR::AutomationControl>); 150 151 std::map<std::string,std::string> _panner_list; 152 bool _suspend_menu_callbacks; 153 }; 154 155 #endif /* __ardour_gtk_panner_ui_h__ */ 156 157