fix keyboard event handling for host-provided plugin GUIs
[ardour2.git] / gtk2_ardour / panner_ui.h
bloba566e0f9aed3511401b28efe48ac4415c87c6a93
1 /*
2 Copyright (C) 2004 Paul Davis
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.
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.
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.
20 #ifndef __ardour_gtk_panner_ui_h__
21 #define __ardour_gtk_panner_ui_h__
23 #include <vector>
25 #include <gtkmm/box.h>
26 #include <gtkmm/adjustment.h>
27 #include <gtkmm/viewport.h>
28 #include <gtkmm/eventbox.h>
29 #include <gtkmm/arrow.h>
30 #include <gtkmm/togglebutton.h>
31 #include <gtkmm/button.h>
33 #include <gtkmm2ext/click_box.h>
34 #include <gtkmm2ext/slider_controller.h>
36 #include "enums.h"
38 class Panner2d;
39 class PannerBar;
41 namespace ARDOUR {
42 class IO;
43 class Session;
45 namespace Gtkmm2ext {
46 class FastMeter;
49 namespace Gtk {
50 class Menu;
51 class Menuitem;
54 class PannerUI : public Gtk::HBox
56 public:
57 PannerUI (ARDOUR::Session&);
58 ~PannerUI ();
60 virtual void set_io (boost::shared_ptr<ARDOUR::IO>);
62 void pan_changed (void *);
64 void update_pan_sensitive ();
65 void update_gain_sensitive ();
67 void set_width (Width);
68 void setup_pan ();
70 void effective_pan_display ();
72 void set_meter_strip_name (string name);
73 PBD::Controllable* get_controllable();
75 private:
76 friend class MixerStrip;
78 boost::shared_ptr<ARDOUR::IO> _io;
79 ARDOUR::Session& _session;
80 std::vector<sigc::connection> connections;
82 bool ignore_toggle;
83 bool in_pan_update;
85 static const int pan_bar_height;
87 Panner2d* panner;
89 Gtk::VBox pan_bar_packer;
90 Gtk::Adjustment hAdjustment;
91 Gtk::Adjustment vAdjustment;
92 Gtk::Viewport panning_viewport;
93 Gtk::EventBox panning_up;
94 Gtk::Arrow panning_up_arrow;
95 Gtk::EventBox panning_down;
96 Gtk::Arrow panning_down_arrow;
97 Gtk::VBox pan_vbox;
98 Width _width;
100 Gtk::ToggleButton panning_link_button;
101 Gtk::Button panning_link_direction_button;
102 Gtk::HBox panning_link_box;
104 bool panning_link_button_press (GdkEventButton*);
105 bool panning_link_button_release (GdkEventButton*);
107 Gtk::Menu* pan_astate_menu;
108 Gtk::Menu* pan_astyle_menu;
110 Gtk::Button pan_automation_style_button;
111 Gtk::ToggleButton pan_automation_state_button;
113 void panning_link_direction_clicked ();
115 vector<Gtk::Adjustment*> pan_adjustments;
116 vector<PannerBar*> pan_bars;
118 void pan_adjustment_changed (uint32_t which);
119 void pan_value_changed (uint32_t which);
120 void pan_printer (char* buf, uint32_t, Gtk::Adjustment*);
121 void update_pan_bars (bool only_if_aplay);
122 void update_pan_linkage ();
123 void update_pan_state ();
124 void build_astate_menu ();
125 void build_astyle_menu ();
127 void panner_changed ();
129 void hide_pans ();
131 void panner_moved (int which);
132 void panner_bypass_toggled ();
134 gint start_pan_touch (GdkEventButton*);
135 gint end_pan_touch (GdkEventButton*);
137 bool pan_button_event (GdkEventButton*, uint32_t which);
139 Gtk::Menu* pan_menu;
140 Gtk::CheckMenuItem* bypass_menu_item;
141 void build_pan_menu (uint32_t which);
142 void pan_mute (uint32_t which);
143 void pan_reset (uint32_t which);
144 void pan_reset_all ();
145 void pan_bypass_toggle ();
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;
153 std::string astate_string (ARDOUR::AutoState);
154 std::string short_astate_string (ARDOUR::AutoState);
155 std::string _astate_string (ARDOUR::AutoState, bool);
157 std::string astyle_string (ARDOUR::AutoStyle);
158 std::string short_astyle_string (ARDOUR::AutoStyle);
159 std::string _astyle_string (ARDOUR::AutoStyle, bool);
162 #endif /* __ardour_gtk_panner_ui_h__ */