Ardour  9.0-pre0-582-g084a23a80d
triggerbox_ui.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 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 _gtk_ardour_triggerbox_ui_h_
20 #define _gtk_ardour_triggerbox_ui_h_
21 
22 #include <gtkmm/colorselection.h>
23 
24 #include "pbd/properties.h"
25 
26 #include "ardour/triggerbox.h"
27 
28 #include "canvas/canvas.h"
29 #include "canvas/rectangle.h"
30 
31 #include "gtkmm2ext/colors.h"
32 
33 #include "fitted_canvas_widget.h"
34 
35 #include "trigger_ui.h"
36 
37 namespace Temporal
38 {
39  struct BBT_Offset;
40 }
41 
42 namespace ArdourCanvas
43 {
44  class Text;
45  class Polygon;
46 }
47 
48 class TriggerStrip;
49 
51 {
52 public:
55 
60 
62 
63  void draw_launch_icon (Cairo::RefPtr<Cairo::Context> context, float size, float scale) const;
64  void draw_follow_icon (Cairo::RefPtr<Cairo::Context> context, ARDOUR::FollowAction const & icon, float size, float scale) const;
65 
66  void render (ArdourCanvas::Rect const& area, Cairo::RefPtr<Cairo::Context> context) const;
67 
69 
71 
73 
74  enum EnteredState {
79  };
80 
82 
84 
85  TriggerStrip& strip() const { return _strip; }
86 
87 private:
89  bool _grabbed;
90 
95 
96  bool event (GdkEvent*);
97  void drag_begin (Glib::RefPtr<Gdk::DragContext> const&);
98  void drag_end (Glib::RefPtr<Gdk::DragContext> const&);
99  void drag_data_get (Glib::RefPtr<Gdk::DragContext> const&, Gtk::SelectionData&, guint, guint);
100 
101  void ui_parameter_changed (std::string const& p);
102 
105 
111  void blink_rec_enable (bool);
112  sigc::connection rec_blink_connection;
113 
116 };
117 
119 {
120 public:
123 
125 
126  TriggerStrip& strip() const { return _strip; }
127 
128  static Glib::RefPtr<Gtk::TargetList> dnd_src ()
129  {
130  return _dnd_src;
131  }
132 
133 private:
134  typedef std::vector<TriggerEntry*> Slots;
135 
139 
140  static Glib::RefPtr<Gtk::TargetList> _dnd_src;
141 
142  void build ();
143 
145 
146  bool drag_motion (Glib::RefPtr<Gdk::DragContext> const&, int, int, guint);
147  void drag_leave (Glib::RefPtr<Gdk::DragContext> const&, guint);
148  void drag_data_received (Glib::RefPtr<Gdk::DragContext> const&, int, int, Gtk::SelectionData const&, guint, guint);
149 
151 
152  uint64_t slot_at_y (int) const;
153 
154  sigc::connection _selection_connection;
155 };
156 
158 {
159 public:
160  TriggerBoxWidget (TriggerStrip&, float w, float h);
161 
163  TriggerStrip& strip() const { return _strip; }
164 
165 private:
168 };
169 
170 #endif
Declaration of the main canvas classes.
bool drag_motion(Glib::RefPtr< Gdk::DragContext > const &, int, int, guint)
sigc::connection _selection_connection
void selection_changed()
TriggerStrip & _strip
bool triggerbox_event(GdkEvent *)
static Glib::RefPtr< Gtk::TargetList > dnd_src()
static Glib::RefPtr< Gtk::TargetList > _dnd_src
TriggerBoxUI(ArdourCanvas::Item *parent, TriggerStrip &, ARDOUR::TriggerBox &)
ARDOUR::TriggerBox & _triggerbox
void _size_allocate(ArdourCanvas::Rect const &)
TriggerStrip & strip() const
std::vector< TriggerEntry * > Slots
uint64_t slot_at_y(int) const
void drag_data_received(Glib::RefPtr< Gdk::DragContext > const &, int, int, Gtk::SelectionData const &, guint, guint)
void drag_leave(Glib::RefPtr< Gdk::DragContext > const &, guint)
TriggerStrip & _strip
void set_triggerbox(ARDOUR::TriggerBox *tb)
TriggerBoxUI * ui
TriggerBoxWidget(TriggerStrip &, float w, float h)
TriggerStrip & strip() const
void box_rec_enable_changed()
void rec_enable_change()
void drag_data_get(Glib::RefPtr< Gdk::DragContext > const &, Gtk::SelectionData &, guint, guint)
void selection_change()
void _size_allocate(ArdourCanvas::Rect const &)
void drag_end(Glib::RefPtr< Gdk::DragContext > const &)
void owner_color_changed()
PBD::ScopedConnectionList _rec_enable_connections
ArdourCanvas::Rectangle * play_button
Definition: triggerbox_ui.h:56
bool play_button_event(GdkEvent *)
void on_trigger_changed(PBD::PropertyChange const &change)
void render(ArdourCanvas::Rect const &area, Cairo::RefPtr< Cairo::Context > context) const
bool follow_button_event(GdkEvent *)
void ui_parameter_changed(std::string const &p)
ArdourCanvas::Rectangle * name_button
Definition: triggerbox_ui.h:57
void draw_follow_icon(Cairo::RefPtr< Cairo::Context > context, ARDOUR::FollowAction const &icon, float size, float scale) const
PBD::ScopedConnection _owner_prop_connection
void owner_prop_change(PBD::PropertyChange const &)
void drag_begin(Glib::RefPtr< Gdk::DragContext > const &)
sigc::connection rec_blink_connection
Gtkmm2ext::Color bg_color() const
void set_play_button_tooltip()
void blink_rec_enable(bool)
ArdourCanvas::Text * name_text
Definition: triggerbox_ui.h:59
void set_widget_colors(TriggerEntry::EnteredState es=NoneEntered)
ArdourCanvas::Rectangle * follow_button
Definition: triggerbox_ui.h:58
TriggerStrip & _strip
Definition: triggerbox_ui.h:88
TriggerStrip & strip() const
Definition: triggerbox_ui.h:85
bool event(GdkEvent *)
TriggerEntry(ArdourCanvas::Item *item, TriggerStrip &, ARDOUR::TriggerReference rf)
bool name_button_event(GdkEvent *)
void draw_launch_icon(Cairo::RefPtr< Cairo::Context > context, float size, float scale) const
uint32_t Color
Definition: colors.h:33