Fix thinkos in cubasish theme
[ardour.git] / gtk2_ardour / panner_ui.h
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 ignore_toggle;
93         bool in_pan_update;
94         int _current_nouts;
95         int _current_nins;
96         std::string _current_uri;
97         bool _send_mode;
98
99         Panner2d*       twod_panner; ///< 2D panner, or 0
100         Panner2dWindow* big_window;
101
102         Gtk::VBox           pan_bar_packer;
103         Gtk::VBox           pan_vbox;
104         Gtk::VBox           poswidth_box;
105         Width              _width;
106
107         StereoPanner*  _stereo_panner;
108         MonoPanner*    _mono_panner;
109
110         bool _ignore_width_change;
111         bool _ignore_position_change;
112         void width_adjusted ();
113         void show_width ();
114         void position_adjusted ();
115         void show_position ();
116
117         Gtk::Menu* pan_astate_menu;
118         Gtk::Menu* pan_astyle_menu;
119
120         Gtk::ToggleButton pan_automation_state_button;
121
122         void pan_value_changed (uint32_t which);
123         void build_astate_menu ();
124         void build_astyle_menu ();
125
126         void hide_pans ();
127
128         void panner_moved (int which);
129         void panner_bypass_toggled ();
130
131         gint start_pan_touch (GdkEventButton*);
132         gint end_pan_touch (GdkEventButton*);
133
134         bool pan_button_event (GdkEventButton*);
135
136         Gtk::Menu* pan_menu;
137         Gtk::CheckMenuItem* bypass_menu_item;
138         void build_pan_menu ();
139         void pan_reset ();
140         void pan_bypass_toggle ();
141         void pan_edit ();
142         void pan_set_custom_type (std::string type);
143
144         void pan_automation_state_changed();
145         gint pan_automation_state_button_event (GdkEventButton *);
146
147         void start_touch (boost::weak_ptr<ARDOUR::AutomationControl>);
148         void stop_touch (boost::weak_ptr<ARDOUR::AutomationControl>);
149
150         std::map<std::string,std::string> _panner_list;
151         bool _suspend_menu_callbacks;
152 };
153
154 #endif /* __ardour_gtk_panner_ui_h__ */
155