r269@gandalf: fugalh | 2006-08-03 20:18:05 -0600
[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     $Id$
19 */
20
21 #ifndef __ardour_gtk_panner_ui_h__
22 #define __ardour_gtk_panner_ui_h__
23
24 #include <vector>
25
26 #include <gtkmm/box.h>
27 #include <gtkmm/adjustment.h>
28 #include <gtkmm/viewport.h>
29 #include <gtkmm/eventbox.h>
30 #include <gtkmm/arrow.h>
31 #include <gtkmm/togglebutton.h>
32 #include <gtkmm/button.h>
33
34 #include <gtkmm2ext/click_box.h>
35 #include <gtkmm2ext/slider_controller.h>
36
37 #include "enums.h"
38
39 class Panner2d;
40
41 namespace ARDOUR {
42         class IO;
43         class Session;
44 }
45 namespace Gtkmm2ext {
46         class FastMeter;
47         class BarController;
48 }
49
50 namespace Gtk {
51         class Menu;
52         class Menuitem;
53 }
54
55 class PannerUI : public Gtk::HBox
56 {
57   public:
58         PannerUI (boost::shared_ptr<ARDOUR::IO>, ARDOUR::Session&);
59         ~PannerUI ();
60
61         void pan_changed (void *);
62
63         void update_pan_sensitive ();
64         void update_gain_sensitive ();
65
66         void set_width (Width);
67         void setup_pan ();
68
69         void effective_pan_display ();
70
71         void set_meter_strip_name (string name);
72
73   private:
74         friend class MixerStrip;
75         boost::shared_ptr<ARDOUR::IO> _io;
76         ARDOUR::Session& _session;
77
78         bool ignore_toggle;
79         bool in_pan_update;
80
81         Panner2d*   panner;
82
83         Gtk::VBox           pan_bar_packer;
84         Gtk::Adjustment     hAdjustment;
85         Gtk::Adjustment     vAdjustment;
86         Gtk::Viewport       panning_viewport;
87         Gtk::EventBox       panning_up;
88         Gtk::Arrow          panning_up_arrow;
89         Gtk::EventBox       panning_down;
90         Gtk::Arrow          panning_down_arrow;
91         Gtk::VBox           pan_vbox;
92         Width              _width;
93
94         Gtk::ToggleButton   panning_link_button;
95         Gtk::Button         panning_link_direction_button;
96         Gtk::HBox           panning_link_box;
97
98         bool panning_link_button_press (GdkEventButton*);
99         bool panning_link_button_release (GdkEventButton*);
100
101         Gtk::Menu pan_astate_menu;
102         Gtk::Menu pan_astyle_menu;
103
104         Gtk::Button pan_automation_style_button;
105         Gtk::ToggleButton pan_automation_state_button;
106
107         void panning_link_direction_clicked ();
108
109         vector<Gtk::Adjustment*> pan_adjustments;
110         vector<Gtkmm2ext::BarController*> pan_bars;
111
112         void pan_adjustment_changed (uint32_t which);
113         void pan_value_changed (uint32_t which);
114         void pan_printer (char* buf, uint32_t, Gtk::Adjustment*);
115         void update_pan_bars (bool only_if_aplay);
116         void update_pan_linkage ();
117         void update_pan_state ();
118
119         void panner_changed ();
120         
121         void hide_pans ();
122
123         void panner_moved (int which);
124         void panner_bypass_toggled ();
125
126         gint start_pan_touch (GdkEventButton*);
127         gint end_pan_touch (GdkEventButton*);
128
129         bool pan_button_event (GdkEventButton*, uint32_t which);
130
131         Gtk::Menu* pan_menu;
132         Gtk::CheckMenuItem* bypass_menu_item;
133         void build_pan_menu (uint32_t which);
134         void pan_mute (uint32_t which);
135         void pan_reset ();
136         void pan_bypass_toggle ();
137
138         void pan_automation_state_changed();
139         void pan_automation_style_changed();
140         gint pan_automation_style_button_event (GdkEventButton *);
141         gint pan_automation_state_button_event (GdkEventButton *);
142         sigc::connection pan_watching;
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         std::string astyle_string (ARDOUR::AutoStyle);
149         std::string short_astyle_string (ARDOUR::AutoStyle);
150         std::string _astyle_string (ARDOUR::AutoStyle, bool);
151 };
152
153 #endif /* __ardour_gtk_panner_ui_h__ */
154