fix merge errors with master
[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/eventbox.h>
28 #include <gtkmm/arrow.h>
29 #include <gtkmm/togglebutton.h>
30 #include <gtkmm/button.h>
31
32 #include <gtkmm2ext/click_box.h>
33 #include <gtkmm2ext/slider_controller.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 Gtkmm2ext {
53         class FastMeter;
54 }
55
56 namespace Gtk {
57         class Menu;
58         class Menuitem;
59 }
60
61 class PannerUI : public Gtk::HBox, public ARDOUR::SessionHandlePtr
62 {
63   public:
64         PannerUI (ARDOUR::Session*);
65         ~PannerUI ();
66
67         virtual void set_panner (boost::shared_ptr<ARDOUR::PannerShell>, boost::shared_ptr<ARDOUR::Panner>);
68
69         void panshell_changed ();
70
71         void update_pan_sensitive ();
72         void update_gain_sensitive ();
73
74         void set_width (Width);
75         void setup_pan ();
76         void set_available_panners(boost::shared_ptr<ARDOUR::Route>, std::map<std::string,std::string>);
77
78         void effective_pan_display ();
79
80         void set_meter_strip_name (std::string name);
81
82         void on_size_allocate (Gtk::Allocation &);
83
84         static void setup_slider_pix ();
85
86   private:
87         friend class MixerStrip;
88
89         boost::shared_ptr<ARDOUR::PannerShell> _panshell;
90         boost::shared_ptr<ARDOUR::Panner> _panner;
91         PBD::ScopedConnectionList connections;
92         PBD::ScopedConnectionList _pan_control_connections;
93
94         bool ignore_toggle;
95         bool in_pan_update;
96         int _current_nouts;
97         int _current_nins;
98
99         static const int pan_bar_height;
100
101         Panner2d*       twod_panner; ///< 2D panner, or 0
102         Panner2dWindow* big_window;
103
104         Gtk::VBox           pan_bar_packer;
105         Gtk::VBox           pan_vbox;
106         Gtk::VBox           poswidth_box;
107         Width              _width;
108
109         StereoPanner*  _stereo_panner;
110         MonoPanner*    _mono_panner;
111
112         bool _ignore_width_change;
113         bool _ignore_position_change;
114         void width_adjusted ();
115         void show_width ();
116         void position_adjusted ();
117         void show_position ();
118
119         Gtk::Menu* pan_astate_menu;
120         Gtk::Menu* pan_astyle_menu;
121
122         Gtk::Button pan_automation_style_button;
123         Gtk::ToggleButton pan_automation_state_button;
124
125         void pan_value_changed (uint32_t which);
126         void build_astate_menu ();
127         void build_astyle_menu ();
128
129         void hide_pans ();
130
131         void panner_moved (int which);
132         void panner_bypass_toggled ();
133
134         gint start_pan_touch (GdkEventButton*);
135         gint end_pan_touch (GdkEventButton*);
136
137         bool pan_button_event (GdkEventButton*);
138
139         Gtk::Menu* pan_menu;
140         Gtk::CheckMenuItem* bypass_menu_item;
141         void build_pan_menu ();
142         void pan_reset ();
143         void pan_bypass_toggle ();
144         void pan_edit ();
145         void pan_set_custom_type (std::string type);
146
147         void pan_automation_state_changed();
148         void pan_automation_style_changed();
149         gint pan_automation_style_button_event (GdkEventButton *);
150         gint pan_automation_state_button_event (GdkEventButton *);
151         sigc::connection pan_watching;
152
153         std::string astate_string (ARDOUR::AutoState);
154         std::string short_astate_string (ARDOUR::AutoState);
155         std::string _astate_string (ARDOUR::AutoState, bool);
156
157         std::string astyle_string (ARDOUR::AutoStyle);
158         std::string short_astyle_string (ARDOUR::AutoStyle);
159         std::string _astyle_string (ARDOUR::AutoStyle, bool);
160
161         void start_touch (boost::weak_ptr<ARDOUR::AutomationControl>);
162         void stop_touch (boost::weak_ptr<ARDOUR::AutomationControl>);
163
164         boost::shared_ptr<ARDOUR::Route> _route;
165         std::map<std::string,std::string> _panner_list;
166         bool _suspend_menu_callbacks;
167 };
168
169 #endif /* __ardour_gtk_panner_ui_h__ */
170