VKeybd: Pass on primary (Ctrl/Cmd) shortcuts
[ardour.git] / gtk2_ardour / mono_panner.h
1 /*
2  * Copyright (C) 2011-2012 Carl Hetherington <carl@carlh.net>
3  * Copyright (C) 2011 Paul Davis <paul@linuxaudiosystems.com>
4  * Copyright (C) 2014-2017 Robin Gareus <robin@gareus.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20
21 #ifndef __gtk_ardour_mono_panner_h__
22 #define __gtk_ardour_mono_panner_h__
23
24 #include "pbd/signals.h"
25
26 #include <boost/shared_ptr.hpp>
27
28 #include "widgets/binding_proxy.h"
29
30 #include "panner_interface.h"
31
32 namespace ARDOUR {
33         class PannerShell;
34 }
35
36 namespace PBD {
37         class Controllable;
38 }
39
40 class MonoPanner : public PannerInterface
41 {
42 public:
43         MonoPanner (boost::shared_ptr<ARDOUR::PannerShell>);
44         ~MonoPanner ();
45
46         boost::shared_ptr<PBD::Controllable> get_controllable() const { return position_control; }
47
48         sigc::signal<void> StartGesture;
49         sigc::signal<void> StopGesture;
50
51 protected:
52         bool on_expose_event (GdkEventExpose*);
53         bool on_button_press_event (GdkEventButton*);
54         bool on_button_release_event (GdkEventButton*);
55         bool on_motion_notify_event (GdkEventMotion*);
56         bool on_scroll_event (GdkEventScroll*);
57         bool on_key_press_event (GdkEventKey*);
58
59         boost::weak_ptr<PBD::Controllable> proxy_controllable () const
60         {
61                 return boost::weak_ptr<PBD::Controllable> (position_binder.get_controllable());
62         }
63
64 private:
65         PannerEditor* editor ();
66         boost::shared_ptr<ARDOUR::PannerShell> _panner_shell;
67
68         boost::shared_ptr<PBD::Controllable> position_control;
69         PBD::ScopedConnectionList panvalue_connections;
70         PBD::ScopedConnectionList panshell_connections;
71         int drag_start_x;
72         int last_drag_x;
73         double accumulated_delta;
74         bool detented;
75
76         ArdourWidgets::BindingProxy position_binder;
77
78         void set_tooltip ();
79
80         struct ColorScheme {
81                 uint32_t outline;
82                 uint32_t fill;
83                 uint32_t text;
84                 uint32_t background;
85                 uint32_t pos_outline;
86                 uint32_t pos_fill;
87         };
88
89         bool _dragging;
90
91         static Pango::AttrList panner_font_attributes;
92         static bool have_font;
93
94         static ColorScheme colors;
95         static void set_colors ();
96         static bool have_colors;
97         void color_handler ();
98         void bypass_handler ();
99         void pannable_handler ();
100 };
101
102 #endif /* __gtk_ardour_mono_panner_h__ */