replace ::cast_dynamic() with relevant ActionManager::get_*_action() calls
[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 "ardour/session_handle.h"
33
34 #include "enums.h"
35
36 class Panner2d;
37 class Panner2dWindow;
38 class StereoPanner;
39 class MonoPanner;
40
41 namespace ARDOUR {
42         class Session;
43         class Panner;
44         class PannerShell;
45         class Delivery;
46         class AutomationControl;
47 }
48
49 namespace Gtk {
50         class Menu;
51         class Menuitem;
52 }
53
54 class PannerUI : public Gtk::HBox, public ARDOUR::SessionHandlePtr
55 {
56 public:
57         PannerUI (ARDOUR::Session*);
58         ~PannerUI ();
59
60         virtual void set_panner (boost::shared_ptr<ARDOUR::PannerShell>, boost::shared_ptr<ARDOUR::Panner>);
61
62         void panshell_changed ();
63
64         void update_pan_sensitive ();
65         void update_gain_sensitive ();
66
67         void set_width (Width);
68         void setup_pan ();
69         void set_available_panners(std::map<std::string,std::string>);
70         void set_send_drawing_mode (bool);
71
72         void effective_pan_display ();
73
74         void set_meter_strip_name (std::string name);
75
76         void on_size_allocate (Gtk::Allocation &);
77
78         static void setup_slider_pix ();
79
80 private:
81         friend class MixerStrip;
82         friend class SendUI;
83
84         boost::shared_ptr<ARDOUR::PannerShell> _panshell;
85         boost::shared_ptr<ARDOUR::Panner> _panner;
86         PBD::ScopedConnectionList connections;
87         PBD::ScopedConnectionList _pan_control_connections;
88
89         bool ignore_toggle;
90         bool in_pan_update;
91         int _current_nouts;
92         int _current_nins;
93         std::string _current_uri;
94         bool _send_mode;
95
96         Panner2d*       twod_panner; ///< 2D panner, or 0
97         Panner2dWindow* big_window;
98
99         Gtk::VBox           pan_bar_packer;
100         Gtk::VBox           pan_vbox;
101         Gtk::VBox           poswidth_box;
102         Width              _width;
103
104         StereoPanner*  _stereo_panner;
105         MonoPanner*    _mono_panner;
106
107         bool _ignore_width_change;
108         bool _ignore_position_change;
109         void width_adjusted ();
110         void show_width ();
111         void position_adjusted ();
112         void show_position ();
113
114         Gtk::Menu* pan_astate_menu;
115         Gtk::Menu* pan_astyle_menu;
116
117         Gtk::ToggleButton pan_automation_state_button;
118
119         void pan_value_changed (uint32_t which);
120         void build_astate_menu ();
121         void build_astyle_menu ();
122
123         void hide_pans ();
124
125         void panner_moved (int which);
126         void panner_bypass_toggled ();
127
128         gint start_pan_touch (GdkEventButton*);
129         gint end_pan_touch (GdkEventButton*);
130
131         bool pan_button_event (GdkEventButton*);
132
133         Gtk::Menu* pan_menu;
134         Gtk::CheckMenuItem* bypass_menu_item;
135         void build_pan_menu ();
136         void pan_reset ();
137         void pan_bypass_toggle ();
138         void pan_edit ();
139         void pan_set_custom_type (std::string type);
140
141         void pan_automation_state_changed();
142         gint pan_automation_state_button_event (GdkEventButton *);
143
144         std::string astate_string (ARDOUR::AutoState);
145         std::string short_astate_string (ARDOUR::AutoState);
146         std::string _astate_string (ARDOUR::AutoState, bool);
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