b028510de34e7f0613f3260c534bff1458561ff4
[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 #include <gtkmm.h>
26 #include <gtkmm2ext/slider_controller.h>
27 #include <gtkmm2ext/click_box.h>
28
29 #include "enums.h"
30
31 class Panner2d;
32
33 namespace ARDOUR {
34         class IO;
35         class Session;
36 }
37 namespace Gtkmm2ext {
38         class FastMeter;
39         class BarController;
40 }
41
42 class PannerUI : public Gtk::HBox
43 {
44   public:
45         PannerUI (ARDOUR::IO&, ARDOUR::Session&);
46         ~PannerUI ();
47
48         void pan_changed (void *);
49
50         void update_pan_sensitive ();
51         void update_gain_sensitive ();
52
53         void set_width (Width);
54         void setup_pan ();
55
56         void effective_pan_display ();
57
58         void set_meter_strip_name (string name);
59
60   private:
61         ARDOUR::IO& _io;
62         ARDOUR::Session& _session;
63
64         bool ignore_toggle;
65         bool in_pan_update;
66
67         Panner2d*   panner;
68
69         Gtk::VBox           pan_bar_packer;
70         Gtk::Adjustment     hAdjustment;
71         Gtk::Adjustment     vAdjustment;
72         Gtk::Viewport       panning_viewport;
73         Gtk::EventBox       panning_up;
74         Gtk::Arrow          panning_up_arrow;
75         Gtk::EventBox       panning_down;
76         Gtk::Arrow          panning_down_arrow;
77         Gtk::VBox           pan_vbox;
78         Width              _width;
79
80         gint panning_scroll_button_press_event (GdkEventButton*, int32_t dir);
81         gint panning_scroll_button_release_event (GdkEventButton*, int32_t dir);
82         
83         Gtk::ToggleButton   panning_link_button;
84         Gtk::Button         panning_link_direction_button;
85         Gtk::HBox           panning_link_box;
86
87         gint panning_link_button_press (GdkEventButton*);
88         gint panning_link_button_release (GdkEventButton*);
89         void panning_link_direction_clicked ();
90
91         vector<Gtk::Adjustment*> pan_adjustments;
92         vector<Gtkmm2ext::BarController*> pan_bars;
93
94         void pan_adjustment_changed (uint32_t which);
95         void pan_value_changed (uint32_t which);
96         void pan_printer (char* buf, uint32_t, Gtk::Adjustment*);
97         void update_pan_bars (bool only_if_aplay);
98         void update_pan_linkage ();
99         void update_pan_state ();
100
101         void panner_changed ();
102         
103         void hide_pans ();
104
105         void panner_moved (int which);
106         void panner_bypass_toggled ();
107
108         gint start_pan_touch (GdkEventButton*);
109         gint end_pan_touch (GdkEventButton*);
110
111         gint pan_button_event (GdkEventButton*, uint32_t which);
112         Gtk::Menu* pan_menu;
113         Gtk::CheckMenuItem* bypass_menu_item;
114         void build_pan_menu (uint32_t which);
115         void pan_mute (uint32_t which);
116         void pan_reset ();
117         void pan_bypass_toggle ();
118 };
119
120 #endif /* __ardour_gtk_panner_ui_h__ */
121