Ardour  8.7-15-gadf511264b
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 "fitted_canvas_widget.h"
32 
33 #include "trigger_ui.h"
34 
35 namespace Temporal
36 {
37  struct BBT_Offset;
38 }
39 
40 namespace ArdourCanvas
41 {
42  class Text;
43  class Polygon;
44 }
45 
47 {
48 public:
51 
56 
57  void draw_launch_icon (Cairo::RefPtr<Cairo::Context> context, float size, float scale) const;
58  void draw_follow_icon (Cairo::RefPtr<Cairo::Context> context, ARDOUR::FollowAction const & icon, float size, float scale) const;
59 
60  void render (ArdourCanvas::Rect const& area, Cairo::RefPtr<Cairo::Context> context) const;
61 
63 
65 
67 
68  enum EnteredState {
73  };
74 
76 
78 
79 private:
80  bool _grabbed;
81  double _poly_size;
82  double _poly_margin;
83 
87 
88  bool event (GdkEvent*);
89  void drag_begin (Glib::RefPtr<Gdk::DragContext> const&);
90  void drag_end (Glib::RefPtr<Gdk::DragContext> const&);
91  void drag_data_get (Glib::RefPtr<Gdk::DragContext> const&, Gtk::SelectionData&, guint, guint);
92 
93  void ui_parameter_changed (std::string const& p);
94 
97 
100 
102 };
103 
105 {
106 public:
109 
111 
112  static Glib::RefPtr<Gtk::TargetList> dnd_src ()
113  {
114  return _dnd_src;
115  }
116 
117 private:
118  typedef std::vector<TriggerEntry*> Slots;
119 
122 
123  static Glib::RefPtr<Gtk::TargetList> _dnd_src;
124 
125  void build ();
126 
128 
129  bool drag_motion (Glib::RefPtr<Gdk::DragContext> const&, int, int, guint);
130  void drag_leave (Glib::RefPtr<Gdk::DragContext> const&, guint);
131  void drag_data_received (Glib::RefPtr<Gdk::DragContext> const&, int, int, Gtk::SelectionData const&, guint, guint);
132 
134 
135  uint64_t slot_at_y (int) const;
136 
137  sigc::connection _selection_connection;
138 };
139 
141 {
142 public:
143  TriggerBoxWidget (float w, float h);
144 
146 
147 private:
149 };
150 
151 #endif
Declaration of the main canvas classes.
TriggerBoxUI(ArdourCanvas::Item *parent, ARDOUR::TriggerBox &)
bool drag_motion(Glib::RefPtr< Gdk::DragContext > const &, int, int, guint)
sigc::connection _selection_connection
void selection_changed()
bool triggerbox_event(GdkEvent *)
static Glib::RefPtr< Gtk::TargetList > dnd_src()
static Glib::RefPtr< Gtk::TargetList > _dnd_src
ARDOUR::TriggerBox & _triggerbox
void _size_allocate(ArdourCanvas::Rect 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)
void set_triggerbox(ARDOUR::TriggerBox *tb)
TriggerBoxWidget(float w, float h)
TriggerBoxUI * ui
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()
ArdourCanvas::Rectangle * play_button
Definition: triggerbox_ui.h:52
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:53
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 &)
TriggerEntry(ArdourCanvas::Item *item, ARDOUR::TriggerReference rf)
double _poly_size
Definition: triggerbox_ui.h:81
ArdourCanvas::Text * name_text
Definition: triggerbox_ui.h:55
void set_widget_colors(TriggerEntry::EnteredState es=NoneEntered)
ArdourCanvas::Rectangle * follow_button
Definition: triggerbox_ui.h:54
double _poly_margin
Definition: triggerbox_ui.h:82
bool event(GdkEvent *)
bool name_button_event(GdkEvent *)
void draw_launch_icon(Cairo::RefPtr< Cairo::Context > context, float size, float scale) const