Beast - Music Synthesizer and Composer  0.11.1+10.g2da35
bstpianoroll.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_PIANO_ROLL_H__
3 #define __BST_PIANO_ROLL_H__
4 
5 #include "bstutils.hh"
6 
7 /* --- type macros --- */
8 #define BST_TYPE_PIANO_ROLL (bst_piano_roll_get_type ())
9 #define BST_PIANO_ROLL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), BST_TYPE_PIANO_ROLL, BstPianoRoll))
10 #define BST_PIANO_ROLL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BST_TYPE_PIANO_ROLL, BstPianoRollClass))
11 #define BST_IS_PIANO_ROLL(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BST_TYPE_PIANO_ROLL))
12 #define BST_IS_PIANO_ROLL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BST_TYPE_PIANO_ROLL))
13 #define BST_PIANO_ROLL_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BST_TYPE_PIANO_ROLL, BstPianoRollClass))
14 
15 
16 /* --- typedefs & enums --- */
17 typedef struct _BstPianoRoll BstPianoRoll;
18 typedef struct _BstPianoRollClass BstPianoRollClass;
19 typedef enum /*< skip >*/
20 {
21  BST_PIANO_ROLL_MARKER_NONE,
22  BST_PIANO_ROLL_MARKER_POINTER,
23  BST_PIANO_ROLL_MARKER_SELECT
24 } BstPianoRollMarkerType;
25 
26 
27 /* --- structures & typedefs --- */
28 typedef struct {
29  GXK_SCROLL_CANVAS_DRAG_FIELDS;
30  guint start_tick;
31  gint start_note;
32  guint start_valid : 1; /* note out of range or non-existant black key */
33  guint current_tick;
34  gint current_note;
35  guint current_valid : 1; /* note out of range or non-existant black key */
36  /* convenience: */
37  BstPianoRoll *proll;
40 {
41  GxkScrollCanvas parent_instance;
42 
43  Bse::PartH part;
44  SfiProxy song;
45  Bse::PartLinkSeq plinks;
46  gint min_note;
47  gint max_note;
48  guint vzoom;
49 
50  /* horizontal layout */
51  guint ppqn; /* parts per quarter note */
52  guint qnpt; /* quarter notes per tact */
53  guint max_ticks; /* in ticks */
54  gfloat hzoom;
55 
56  /* last drag state */
57  guint start_tick;
58  gint start_note;
59  guint start_valid : 1;
60 
61  guint draw_qn_grid : 1;
62  guint draw_qqn_grid : 1;
63 
64  /* slight hack */
65  guint release_closes_toplevel : 1;
66 
67  /* selection rectangle */
68  int selection_tick;
69  int selection_duration;
70  int selection_min_note;
71  int selection_max_note;
72 };
74 {
75  GxkScrollCanvasClass parent_class;
76 
77  void (*canvas_drag) (BstPianoRoll *self,
78  BstPianoRollDrag *drag);
79  void (*canvas_clicked) (BstPianoRoll *proll,
80  guint button,
81  guint tick_position,
82  gint note,
83  GdkEvent *event);
84  void (*piano_drag) (BstPianoRoll *self,
85  BstPianoRollDrag *drag);
86  void (*piano_clicked) (BstPianoRoll *proll,
87  guint button,
88  gint note,
89  GdkEvent *event);
90 };
91 
92 
93 /* --- prototypes --- */
94 GType bst_piano_roll_get_type (void);
95 void bst_piano_roll_set_part (BstPianoRoll *self, Bse::PartH part = Bse::PartH());
96 gfloat bst_piano_roll_set_hzoom (BstPianoRoll *self,
97  gfloat hzoom);
98 gfloat bst_piano_roll_set_vzoom (BstPianoRoll *self,
99  gfloat vzoom);
100 void bst_piano_roll_set_view_selection (BstPianoRoll *self, int tick, int duration, int min_note, int max_note);
101 gint bst_piano_roll_get_vpanel_width (BstPianoRoll *self);
102 void bst_piano_roll_get_paste_pos (BstPianoRoll *self,
103  guint *tick_p,
104  gint *note_p);
105 void bst_piano_roll_set_marker (BstPianoRoll *self,
106  guint mark_index,
107  guint position,
108  BstPianoRollMarkerType mtype);
109 
110 
111 #endif /* __BST_PIANO_ROLL_H__ */
Definition: bstpianoroll.hh:39
Definition: bstpianoroll.hh:28
Definition: gxkscrollcanvas.hh:108
Sequence of PartLink records.
Definition: bseapi.idl:710
Definition: bstpianoroll.hh:73