Ardour  9.0-pre0-582-g084a23a80d
knob.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Paul Davis <paul@linuxaudiosystems.com>
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 along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef __ardour_push2_knob_h__
20 #define __ardour_push2_knob_h__
21 
22 #include <memory>
23 
24 #include <sigc++/trackable.h>
25 
26 #include <cairomm/refptr.h>
27 
28 #include "pbd/signals.h"
29 
30 #include "canvas/container.h"
31 
32 namespace ArdourCanvas {
33  class Text;
34 }
35 
36 namespace ARDOUR {
37  class AutomationControl;
38 }
39 
40 namespace Cairo {
41  class Context;
42 }
43 
44 namespace ArdourSurface {
45 
46 class Push2;
47 
48 class Push2Knob : public sigc::trackable, public ArdourCanvas::Container
49 {
50 public:
51  enum Element {
52  Arc = 0x1,
53  Bevel = 0x2,
54  unused2 = 0x4,
55  unused3 = 0x8,
56  unused4 = 0x10,
57  unused5 = 0x20,
58  };
59 
60  enum Flags {
61  NoFlags = 0,
62  Detent = 0x1,
63  ArcToZero = 0x2,
64  };
65 
67  virtual ~Push2Knob ();
68 
70 
71  void add_flag (Flags);
73 
74  void set_controllable (std::shared_ptr<ARDOUR::AutomationControl> c);
75  std::shared_ptr<ARDOUR::AutomationControl> controllable() const { return _controllable; }
76 
80  void set_radius (double r);
81 
82  void render (ArdourCanvas::Rect const &, Cairo::RefPtr<Cairo::Context>) const;
83  void compute_bounding_box() const;
84 
85  protected:
88  std::shared_ptr<ARDOUR::AutomationControl> _controllable;
89 
90  private:
94  double _r;
95  float _val; // current value [0..1]
96  float _normal; // default value, arc
97 
102 
103  void set_pan_azimuth_text (double);
104  void set_pan_width_text (double);
105  void set_gain_text (double);
106 };
107 
108 } // namespace
109 
110 #endif /* __ardour_push2_knob_h__ */
Push2Knob(Push2 &p, ArdourCanvas::Item *, Element e=default_elements, Flags flags=NoFlags)
PBD::ScopedConnection watch_connection
Definition: knob.h:87
void compute_bounding_box() const
ArdourCanvas::Text * _text
Definition: knob.h:101
Gtkmm2ext::Color _arc_end_color
Definition: knob.h:100
void set_radius(double r)
void render(ArdourCanvas::Rect const &, Cairo::RefPtr< Cairo::Context >) const
static Element default_elements
Definition: knob.h:69
void set_arc_start_color(Gtkmm2ext::Color)
void set_pan_width_text(double)
std::shared_ptr< ARDOUR::AutomationControl > _controllable
Definition: knob.h:88
Gtkmm2ext::Color _arc_start_color
Definition: knob.h:99
void set_gain_text(double)
void set_pan_azimuth_text(double)
void set_text_color(Gtkmm2ext::Color)
void set_arc_end_color(Gtkmm2ext::Color)
void set_controllable(std::shared_ptr< ARDOUR::AutomationControl > c)
std::shared_ptr< ARDOUR::AutomationControl > controllable() const
Definition: knob.h:75
Gtkmm2ext::Color _text_color
Definition: knob.h:98
uint32_t Color
Definition: colors.h:33
DebugBits Push2