Beast - Music Synthesizer and Composer  0.11.1+10.g2da35
bsttrackroll.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_TRACK_ROLL_H__
3 #define __BST_TRACK_ROLL_H__
4 
5 #include "bstutils.hh"
6 
7 /* --- type macros --- */
8 #define BST_TYPE_TRACK_ROLL (bst_track_roll_get_type ())
9 #define BST_TRACK_ROLL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), BST_TYPE_TRACK_ROLL, BstTrackRoll))
10 #define BST_TRACK_ROLL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BST_TYPE_TRACK_ROLL, BstTrackRollClass))
11 #define BST_IS_TRACK_ROLL(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BST_TYPE_TRACK_ROLL))
12 #define BST_IS_TRACK_ROLL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BST_TYPE_TRACK_ROLL))
13 #define BST_TRACK_ROLL_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BST_TYPE_TRACK_ROLL, BstTrackRollClass))
14 
15 
16 /* --- typedefs & enums --- */
17 typedef struct _BstTrackRoll BstTrackRoll;
18 typedef struct _BstTrackRollClass BstTrackRollClass;
19 typedef Bse::TrackH (*BstTrackRollTrackFunc) (void *proxy_data, int row);
20 
21 
22 /* --- structures & typedefs --- */
23 typedef enum /*< skip >*/
24 {
25  BST_TRACK_ROLL_MARKER_NONE,
26  BST_TRACK_ROLL_MARKER_POS,
27  BST_TRACK_ROLL_MARKER_LOOP,
28  BST_TRACK_ROLL_MARKER_SELECT
29 } BstTrackRollMarkerType;
31  GXK_SCROLL_CANVAS_DRAG_FIELDS;
32  uint start_row;
33  Bse::TrackH start_track;
34  uint start_tick;
35  bool start_valid;
36  uint current_row;
37  Bse::TrackH current_track;
38  uint current_tick;
39  bool current_valid;
40  // convenience:
41  BstTrackRoll *troll;
42  BstTrackRollDrag() : start_row (~uint (0)), start_tick (0), start_valid (0),
43  current_row (~uint (0)), current_tick (0), current_valid (0), troll (NULL) {}
44 };
46 {
47  GxkScrollCanvas parent_instance;
48 
49  SfiProxy proxy;
50  GtkTreeView *tree;
51  guint n_scopes; /* does not always reflect number of rows */
52  GtkWidget **scopes;
53  guint scope_update;
54 
55  /* horizontal layout */
56  guint tpt; /* ticks (parts) per tact */
57  guint max_ticks;
58  gdouble hzoom;
59  guint draw_tact_grid : 1;
60 
61  guint prelight_row;
62  guint hpanel_height;
63 
64  /* editable popup */
65  GtkCellEditable *ecell;
66  guint ecell_row;
67  guint ecell_tick;
68  guint ecell_duration;
69 
70  /* size queries */
71  gint area_offset;
72 
73  /* BseTrack retrieval */
74  gpointer proxy_data;
75  BstTrackRollTrackFunc get_track;
76 
77  /* last drag state */
78  uint start_row;
79  Bse::TrackH start_track;
80  uint start_tick;
81  bool start_valid;
82 };
84 {
85  GxkScrollCanvasClass parent_class;
86 
87  void (*select_row) (BstTrackRoll *troll,
88  gint row);
89  void (*drag) (BstTrackRoll *self,
90  BstTrackRollDrag *drag);
91  void (*clicked) (BstTrackRoll *troll,
92  guint button,
93  guint row,
94  guint tick_position,
95  GdkEvent *event);
96  void (*stop_edit) (BstTrackRoll *self,
97  gboolean canceled,
98  GtkCellEditable *ecell);
99 };
100 
101 
102 /* --- prototypes --- */
103 GType bst_track_roll_get_type (void);
104 void bst_track_roll_setup (BstTrackRoll *troll,
105  GtkTreeView *tree,
106  SfiProxy song);
107 gdouble bst_track_roll_set_hzoom (BstTrackRoll *troll,
108  gdouble hzoom);
109 void bst_track_roll_set_track_callback (BstTrackRoll *self,
110  gpointer data,
111  BstTrackRollTrackFunc get_track);
112 void bst_track_roll_check_update_scopes (BstTrackRoll *self);
113 void bst_track_roll_reselect (BstTrackRoll *self);
114 void bst_track_roll_queue_row_change (BstTrackRoll *self, int row);
115 void bst_track_roll_set_prelight_row (BstTrackRoll *self,
116  guint row);
117 void bst_track_roll_start_edit (BstTrackRoll *self,
118  guint row,
119  guint tick,
120  guint duration,
121  GtkCellEditable *ecell);
122 void bst_track_roll_stop_edit (BstTrackRoll *self);
123 void bst_track_roll_abort_edit (BstTrackRoll *self);
124 void bst_track_roll_set_marker (BstTrackRoll *self,
125  guint mark_index,
126  guint position,
127  BstTrackRollMarkerType mtype);
128 
129 
130 #endif /* __BST_TRACK_ROLL_H__ */
Definition: bsttrackroll.hh:45
Definition: bsttrackroll.hh:83
uint32_t * row(uint y)
Definition: bsttrackroll.hh:30
Definition: gxkscrollcanvas.hh:108