Beast - Music Synthesizer and Composer  0.11.1+10.g2da35
bsteventroll.hh
Go to the documentation of this file.
1  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
2 #ifndef __BST_EVENT_ROLL_H__
3 #define __BST_EVENT_ROLL_H__
4 
5 #include "bstsegment.hh"
6 
7 /* --- type macros --- */
8 #define BST_TYPE_EVENT_ROLL (bst_event_roll_get_type ())
9 #define BST_EVENT_ROLL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), BST_TYPE_EVENT_ROLL, BstEventRoll))
10 #define BST_EVENT_ROLL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BST_TYPE_EVENT_ROLL, BstEventRollClass))
11 #define BST_IS_EVENT_ROLL(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BST_TYPE_EVENT_ROLL))
12 #define BST_IS_EVENT_ROLL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BST_TYPE_EVENT_ROLL))
13 #define BST_EVENT_ROLL_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BST_TYPE_EVENT_ROLL, BstEventRollClass))
14 
15 
16 /* --- typedefs & enums --- */
17 typedef struct _BstEventRoll BstEventRoll;
18 typedef struct _BstEventRollClass BstEventRollClass;
19 
20 
21 /* --- structures & typedefs --- */
22 typedef struct {
23  GXK_SCROLL_CANVAS_DRAG_FIELDS;
24  gint tick_width;
25  guint start_tick;
26  gfloat start_value;
27  guint start_valid : 1;
28  guint current_tick;
29  gfloat current_value; /* between -1 and +1 if valid */
30  gfloat current_value_raw;
31  guint current_valid : 1; /* value out of range */
32  /* convenience: */
33  BstEventRoll *eroll;
36 {
37  GxkScrollCanvas parent_instance;
38 
39  Bse::PartH part;
40  Bse::MidiSignal control_type;
41  GtkWidget *child;
42 
43  /* horizontal layout */
44  guint ppqn; /* parts per quarter note */
45  guint qnpt; /* quarter notes per tact */
46  guint max_ticks; /* in ticks */
47  gfloat hzoom;
48  guint draw_qn_grid : 1;
49  guint draw_qqn_grid : 1;
50 
51  /* drag data */
52  guint start_valid : 1;
53  guint start_tick;
54  gfloat start_value;
55 
56  /* vpanel width sync */
57  gint (*fetch_vpanel_width) (gpointer data);
58  gpointer fetch_vpanel_width_data;
59 
60  /* line drawing */
61  BstSegment segment;
62 
63  /* selection rectangle */
64  guint selection_tick;
65  guint selection_duration;
66  gint selection_min_note;
67  gint selection_max_note;
68 };
70 {
71  GxkScrollCanvasClass parent_class;
72 
73  void (*canvas_drag) (BstEventRoll *self,
74  BstEventRollDrag *drag);
75  void (*canvas_clicked) (BstEventRoll *eroll,
76  guint button,
77  guint tick_position,
78  gfloat value,
79  GdkEvent *event);
80  void (*vpanel_drag) (BstEventRoll *self,
81  BstEventRollDrag *drag);
82  void (*vpanel_clicked) (BstEventRoll *eroll,
83  guint button,
84  gfloat value,
85  GdkEvent *event);
86 };
87 
88 
89 /* --- prototypes --- */
90 GType bst_event_roll_get_type (void);
91 void bst_event_roll_set_part (BstEventRoll *self, Bse::PartH part = Bse::PartH());
92 gfloat bst_event_roll_set_hzoom (BstEventRoll *self,
93  gfloat hzoom);
94 void bst_event_roll_set_view_selection (BstEventRoll *self,
95  guint tick,
96  guint duration);
97 void bst_event_roll_set_vpanel_width_hook (BstEventRoll *self,
98  gint (*fetch_vpanel_width) (gpointer data),
99  gpointer data);
100 void bst_event_roll_set_control_type (BstEventRoll *self, Bse::MidiSignal control_type);
101 void bst_event_roll_init_segment (BstEventRoll *self,
102  BstSegmentType type);
103 void bst_event_roll_segment_start (BstEventRoll *self,
104  guint tick,
105  gfloat value);
106 void bst_event_roll_segment_move_to (BstEventRoll *self,
107  guint tick,
108  gfloat value);
109 void bst_event_roll_segment_tick_range (BstEventRoll *self,
110  guint *tick,
111  guint *duration);
112 gdouble bst_event_roll_segment_value (BstEventRoll *self,
113  guint tick);
114 void bst_event_roll_clear_segment (BstEventRoll *self);
115 
116 #endif /* __BST_EVENT_ROLL_H__ */
Definition: bstsegment.hh:23
Definition: bsteventroll.hh:69
Definition: bsteventroll.hh:35
Definition: gxkscrollcanvas.hh:108
Definition: bsteventroll.hh:22