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