Add mono switch to mixer strips (mantis 1068)
[ardour.git] / gtk2_ardour / panner_ui.h
1 /*
2     Copyright (C) 2004 Paul Davis
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #ifndef __ardour_gtk_panner_ui_h__
21 #define __ardour_gtk_panner_ui_h__
22
23 #include <vector>
24
25 #include <gtkmm/box.h>
26 #include <gtkmm/adjustment.h>
27 #include <gtkmm/viewport.h>
28 #include <gtkmm/eventbox.h>
29 #include <gtkmm/arrow.h>
30 #include <gtkmm/togglebutton.h>
31 #include <gtkmm/button.h>
32
33 #include <gtkmm2ext/click_box.h>
34 #include <gtkmm2ext/slider_controller.h>
35
36 #include "enums.h"
37
38 class Panner2d;
39 class PannerBar;
40 class Panner2dWindow;
41
42 namespace ARDOUR {
43         class Session;
44         class Panner;
45         class Delivery;
46 }
47 namespace Gtkmm2ext {
48         class FastMeter;
49 }
50
51 namespace Gtk {
52         class Menu;
53         class Menuitem;
54 }
55
56 class PannerUI : public Gtk::HBox
57 {
58   public:
59         PannerUI (ARDOUR::Session&);
60         ~PannerUI ();
61
62         virtual void set_panner (boost::shared_ptr<ARDOUR::Panner>);
63
64         void pan_changed (void *);
65
66         void update_pan_sensitive ();
67         void update_gain_sensitive ();
68
69         void set_width (Width);
70         void setup_pan ();
71
72         void effective_pan_display ();
73
74         void set_meter_strip_name (std::string name);
75         boost::shared_ptr<PBD::Controllable> get_controllable();
76
77         void set_mono (bool);
78
79   private:
80         friend class MixerStrip;
81
82         boost::shared_ptr<ARDOUR::Panner> _panner;
83         ARDOUR::Session& _session;
84         std::vector<sigc::connection> connections;
85
86         bool ignore_toggle;
87         bool in_pan_update;
88         int _current_nouts;
89         int _current_npans;
90
91         static const int pan_bar_height;
92
93         Panner2d*       panner;
94         Panner2dWindow* big_window;
95
96         Gtk::VBox           pan_bar_packer;
97         Gtk::Adjustment     hAdjustment;
98         Gtk::Adjustment     vAdjustment;
99         Gtk::Viewport       panning_viewport;
100         Gtk::EventBox       panning_up;
101         Gtk::Arrow          panning_up_arrow;
102         Gtk::EventBox       panning_down;
103         Gtk::Arrow          panning_down_arrow;
104         Gtk::VBox           pan_vbox;
105         Width              _width;
106
107         Gtk::ToggleButton   panning_link_button;
108         Gtk::Button         panning_link_direction_button;
109         Gtk::HBox           panning_link_box;
110
111         bool panning_link_button_press (GdkEventButton*);
112         bool panning_link_button_release (GdkEventButton*);
113
114         Gtk::Menu* pan_astate_menu;
115         Gtk::Menu* pan_astyle_menu;
116
117         Gtk::Button pan_automation_style_button;
118         Gtk::ToggleButton pan_automation_state_button;
119
120         void panning_link_direction_clicked ();
121
122         std::vector<Gtk::Adjustment*> pan_adjustments;
123         std::vector<PannerBar*> pan_bars;
124
125         void pan_adjustment_changed (uint32_t which);
126         void pan_value_changed (uint32_t which);
127         void update_pan_bars (bool only_if_aplay);
128         void update_pan_linkage ();
129         void update_pan_state ();
130         void build_astate_menu ();
131         void build_astyle_menu ();
132
133         void panner_changed ();
134
135         void hide_pans ();
136
137         void panner_moved (int which);
138         void panner_bypass_toggled ();
139
140         gint start_pan_touch (GdkEventButton*);
141         gint end_pan_touch (GdkEventButton*);
142
143         bool pan_button_event (GdkEventButton*, uint32_t which);
144
145         Gtk::Menu* pan_menu;
146         Gtk::CheckMenuItem* bypass_menu_item;
147         void build_pan_menu (uint32_t which);
148         void pan_mute (uint32_t which);
149         void pan_reset (uint32_t);
150         void pan_reset_all ();
151         void pan_bypass_toggle ();
152
153         void pan_automation_state_changed();
154         void pan_automation_style_changed();
155         gint pan_automation_style_button_event (GdkEventButton *);
156         gint pan_automation_state_button_event (GdkEventButton *);
157         sigc::connection pan_watching;
158
159         std::string astate_string (ARDOUR::AutoState);
160         std::string short_astate_string (ARDOUR::AutoState);
161         std::string _astate_string (ARDOUR::AutoState, bool);
162
163         std::string astyle_string (ARDOUR::AutoStyle);
164         std::string short_astyle_string (ARDOUR::AutoStyle);
165         std::string _astyle_string (ARDOUR::AutoStyle, bool);
166 };
167
168 #endif /* __ardour_gtk_panner_ui_h__ */
169