Ardour  9.0-pre0-384-ga76afae0e9
ui_menu.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
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_maschine2_menu_h_
20 #define _ardour_maschine2_menu_h_
21 
22 #include <vector>
23 #include <cairomm/refptr.h>
24 
25 #include "pbd/signals.h"
26 #include "canvas/container.h"
27 #include "canvas/rectangle.h"
28 
29 namespace ArdourCanvas {
30  class Text;
31 }
32 
33 namespace ARDOUR {
34  class AutomationControl;
35 }
36 
37 namespace Cairo {
38  class Context;
39 }
40 
41 namespace ArdourSurface {
42 
43 class Maschine2;
44 class M2EncoderInterface;
45 
47 {
48  public:
49  Maschine2Menu (PBD::EventLoop*, ArdourCanvas::Item*, const std::vector<std::string>&, double width = 64);
50  virtual ~Maschine2Menu ();
51 
53  void set_active (uint32_t index);
54  void set_wrap (bool);
55 
56  uint32_t active () const { return _active; }
57  uint32_t items() const { return _displays.size(); }
58 
60 
61  void render (ArdourCanvas::Rect const &, Cairo::RefPtr<Cairo::Context>) const;
62 
63  private:
64  void rearrange (uint32_t);
65  void encoder_changed (int);
66 
70 
71  std::vector<ArdourCanvas::Text*> _displays;
73 
74  double _baseline;
75  double _height;
76  double _width;
77  uint32_t _active;
78  bool _wrap;
79 
80  uint32_t _first;
81  uint32_t _last;
82  double _rotary;
83 };
84 
85 } // namespace
86 
87 #endif
Coord width() const
Maschine2Menu(PBD::EventLoop *, ArdourCanvas::Item *, const std::vector< std::string > &, double width=64)
PBD::ScopedConnection encoder_connection
Definition: ui_menu.h:69
uint32_t active() const
Definition: ui_menu.h:56
PBD::Signal< void()> ActiveChanged
Definition: ui_menu.h:59
ArdourCanvas::Rectangle * _active_bg
Definition: ui_menu.h:72
void set_control(M2EncoderInterface *)
PBD::EventLoop * _eventloop
Definition: ui_menu.h:68
M2EncoderInterface * _ctrl
Definition: ui_menu.h:67
uint32_t items() const
Definition: ui_menu.h:57
std::vector< ArdourCanvas::Text * > _displays
Definition: ui_menu.h:71
void set_active(uint32_t index)
void render(ArdourCanvas::Rect const &, Cairo::RefPtr< Cairo::Context >) const