BEAST/BSE - Better Audio System and Sound Engine
0.8.2
|
00001 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html 00002 #ifndef __BST_PIANO_ROLL_H__ 00003 #define __BST_PIANO_ROLL_H__ 00004 00005 #include "bstutils.hh" 00006 00007 G_BEGIN_DECLS 00008 00009 /* --- type macros --- */ 00010 #define BST_TYPE_PIANO_ROLL (bst_piano_roll_get_type ()) 00011 #define BST_PIANO_ROLL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), BST_TYPE_PIANO_ROLL, BstPianoRoll)) 00012 #define BST_PIANO_ROLL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BST_TYPE_PIANO_ROLL, BstPianoRollClass)) 00013 #define BST_IS_PIANO_ROLL(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BST_TYPE_PIANO_ROLL)) 00014 #define BST_IS_PIANO_ROLL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BST_TYPE_PIANO_ROLL)) 00015 #define BST_PIANO_ROLL_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BST_TYPE_PIANO_ROLL, BstPianoRollClass)) 00016 00017 00018 /* --- typedefs & enums --- */ 00019 typedef struct _BstPianoRoll BstPianoRoll; 00020 typedef struct _BstPianoRollClass BstPianoRollClass; 00021 typedef enum /*< skip >*/ 00022 { 00023 BST_PIANO_ROLL_MARKER_NONE, 00024 BST_PIANO_ROLL_MARKER_POINTER, 00025 BST_PIANO_ROLL_MARKER_SELECT 00026 } BstPianoRollMarkerType; 00027 00028 00029 /* --- structures & typedefs --- */ 00030 typedef struct { 00031 GXK_SCROLL_CANVAS_DRAG_FIELDS; 00032 guint start_tick; 00033 gint start_note; 00034 guint start_valid : 1; /* note out of range or non-existant black key */ 00035 guint current_tick; 00036 gint current_note; 00037 guint current_valid : 1; /* note out of range or non-existant black key */ 00038 /* convenience: */ 00039 BstPianoRoll *proll; 00040 } BstPianoRollDrag; 00041 struct _BstPianoRoll 00042 { 00043 GxkScrollCanvas parent_instance; 00044 00045 SfiProxy proxy; 00046 SfiProxy song; 00047 BsePartLinkSeq*plinks; 00048 gint min_note; 00049 gint max_note; 00050 guint vzoom; 00051 00052 /* horizontal layout */ 00053 guint ppqn; /* parts per quarter note */ 00054 guint qnpt; /* quarter notes per tact */ 00055 guint max_ticks; /* in ticks */ 00056 gfloat hzoom; 00057 00058 /* last drag state */ 00059 guint start_tick; 00060 gint start_note; 00061 guint start_valid : 1; 00062 00063 guint draw_qn_grid : 1; 00064 guint draw_qqn_grid : 1; 00065 00066 /* slight hack */ 00067 guint release_closes_toplevel : 1; 00068 00069 /* selection rectangle */ 00070 int selection_tick; 00071 int selection_duration; 00072 int selection_min_note; 00073 int selection_max_note; 00074 }; 00075 struct _BstPianoRollClass 00076 { 00077 GxkScrollCanvasClass parent_class; 00078 00079 void (*canvas_drag) (BstPianoRoll *self, 00080 BstPianoRollDrag *drag); 00081 void (*canvas_clicked) (BstPianoRoll *proll, 00082 guint button, 00083 guint tick_position, 00084 gint note, 00085 GdkEvent *event); 00086 void (*piano_drag) (BstPianoRoll *self, 00087 BstPianoRollDrag *drag); 00088 void (*piano_clicked) (BstPianoRoll *proll, 00089 guint button, 00090 gint note, 00091 GdkEvent *event); 00092 }; 00093 00094 00095 /* --- prototypes --- */ 00096 GType bst_piano_roll_get_type (void); 00097 void bst_piano_roll_set_proxy (BstPianoRoll *self, 00098 SfiProxy proxy); 00099 gfloat bst_piano_roll_set_hzoom (BstPianoRoll *self, 00100 gfloat hzoom); 00101 gfloat bst_piano_roll_set_vzoom (BstPianoRoll *self, 00102 gfloat vzoom); 00103 void bst_piano_roll_set_view_selection (BstPianoRoll *self, 00104 guint tick, 00105 guint duration, 00106 gint min_note, 00107 gint max_note); 00108 gint bst_piano_roll_get_vpanel_width (BstPianoRoll *self); 00109 void bst_piano_roll_get_paste_pos (BstPianoRoll *self, 00110 guint *tick_p, 00111 gint *note_p); 00112 void bst_piano_roll_set_marker (BstPianoRoll *self, 00113 guint mark_index, 00114 guint position, 00115 BstPianoRollMarkerType mtype); 00116 00117 00118 G_END_DECLS 00119 00120 #endif /* __BST_PIANO_ROLL_H__ */