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_PATTERN_VIEW_H__ 00003 #define __BST_PATTERN_VIEW_H__ 00004 00005 #include "bstpatterncolumns.hh" 00006 00007 G_BEGIN_DECLS 00008 00009 /* --- type macros --- */ 00010 #define BST_TYPE_PATTERN_VIEW (bst_pattern_view_get_type ()) 00011 #define BST_PATTERN_VIEW(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), BST_TYPE_PATTERN_VIEW, BstPatternView)) 00012 #define BST_PATTERN_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BST_TYPE_PATTERN_VIEW, BstPatternViewClass)) 00013 #define BST_IS_PATTERN_VIEW(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BST_TYPE_PATTERN_VIEW)) 00014 #define BST_IS_PATTERN_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BST_TYPE_PATTERN_VIEW)) 00015 #define BST_PATTERN_VIEW_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BST_TYPE_PATTERN_VIEW, BstPatternViewClass)) 00016 00017 00018 /* --- typedefs & enums --- */ 00019 /* bstpatterncolumns.hh: typedef struct _BstPatternView BstPatternView; */ 00020 typedef struct _BstPatternViewClass BstPatternViewClass; 00021 00022 00023 /* --- structures & typedefs --- */ 00024 typedef enum /*< skip >*/ 00025 { 00026 BST_PATTERN_VIEW_MARKER_NONE, 00027 BST_PATTERN_VIEW_MARKER_FOCUS, 00028 } BstPatternViewMarkerType; 00029 typedef struct { 00030 GXK_SCROLL_CANVAS_DRAG_FIELDS; 00031 guint start_col; 00032 guint start_row; 00033 guint start_tick; 00034 guint start_duration; 00035 gboolean start_valid; 00036 guint current_col; 00037 guint current_row; 00038 int current_tick; 00039 int current_duration; 00040 bool current_valid; 00041 /* convenience: */ 00042 BstPatternView *pview; 00043 } BstPatternViewDrag; 00044 struct _BstPatternView 00045 { 00046 GxkScrollCanvas parent_instance; 00047 00048 SfiProxy proxy; 00049 00050 /* vertical layout */ 00051 guint row_height; 00052 guint tpqn; /* ticks per quarter note */ 00053 guint tpt; /* ticks per tact */ 00054 gint vticks; /* ticks per row */ 00055 guint max_ticks; 00056 00057 /* horizontal layout */ 00058 guint n_cols; 00059 BstPatternColumn **cols; 00060 gchar *layout_string; 00061 00062 /* focus cell */ 00063 guint focus_col; 00064 guint focus_row; 00065 int n_focus_cols; 00066 BstPatternColumn **focus_cols; 00067 00068 /* shading */ 00069 guint16 srow1, srow2; 00070 00071 /* last drag state */ 00072 guint start_col; 00073 guint start_row; 00074 guint start_tick; 00075 guint start_duration; 00076 gboolean start_valid; 00077 }; 00078 struct _BstPatternViewClass 00079 { 00080 GxkScrollCanvasClass parent_class; 00081 00082 void (*drag) (BstPatternView *self, 00083 BstPatternViewDrag *drag); 00084 void (*clicked) (BstPatternView *tview, 00085 guint button, 00086 guint row, 00087 guint tick_position, 00088 GdkEvent *event); 00089 }; 00090 00091 00092 /* --- prototypes --- */ 00093 GType bst_pattern_view_get_type (void); 00094 void bst_pattern_view_set_proxy (BstPatternView *self, 00095 SfiProxy part); 00096 void bst_pattern_view_vsetup (BstPatternView *self, 00097 guint tpqn, 00098 guint qnpt, 00099 guint max_ticks, 00100 guint vticks); 00101 void bst_pattern_view_set_shading (BstPatternView *self, 00102 guint row1, 00103 guint row2, 00104 guint row3, 00105 guint row4); 00106 void bst_pattern_view_set_marker (BstPatternView *self, 00107 guint mark_index, 00108 guint position, 00109 BstPatternViewMarkerType mtype); 00110 void bst_pattern_view_set_pixmarker (BstPatternView *self, 00111 guint mark_index, 00112 BstPatternViewMarkerType mtype, 00113 gint x, 00114 gint y, 00115 gint width, 00116 gint height); 00117 void bst_pattern_view_add_column (BstPatternView *self, 00118 BstPatternLType ltype, 00119 gint num, 00120 BstPatternLFlags lflags); 00121 void bst_pattern_view_set_focus (BstPatternView *self, int focus_col, int focus_row); 00122 gint bst_pattern_view_get_focus_width (BstPatternView *self); 00123 BstPatternColumn* bst_pattern_view_get_focus_cell (BstPatternView *self, int *tick, int *duration); 00124 gboolean bst_pattern_view_dispatch_key (BstPatternView *self, 00125 guint keyval, 00126 GdkModifierType modifier, 00127 BstPatternFunction action, 00128 gdouble param, 00129 BstPatternFunction *movement); 00130 gint bst_pattern_view_get_last_row (BstPatternView *self); 00131 const gchar* bst_pattern_view_get_layout (BstPatternView *self); 00132 guint bst_pattern_view_set_layout (BstPatternView *self, 00133 const gchar *layout); 00134 00135 00136 G_END_DECLS 00137 00138 #endif /* __BST_PATTERN_VIEW_H__ */