Beast - Music Synthesizer and Composer  0.11.1+10.g2da35
bstpatterncolumns.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_PATTERN_COLUMNS_H__
3 #define __BST_PATTERN_COLUMNS_H__
4 
5 #include "bstutils.hh"
6 
7 /* --- enums --- */
8 typedef enum /*< skip >*/
9 {
10  BST_PATTERN_NONE = 0,
11  /* events */
12  BST_PATTERN_REMOVE_EVENTS,
13  BST_PATTERN_SET_NOTE, /* #note */
14  BST_PATTERN_SET_OCTAVE, /* #octave */
15  BST_PATTERN_NUMERIC_CHANGE, /* -32 .. +32 */
16  BST_PATTERN_SET_DIGIT, /* 0 .. +32 */
17  BST_PATTERN_MASK_ACTION = 0x000000ff,
18  /* base octave */
19  BST_PATTERN_SET_BASE_OCTAVE = 0x1 << 8,
20  BST_PATTERN_CHANGE_BASE_OCTAVE = 0x2 << 8,
21  BST_PATTERN_MASK_CONTROLS = 0x0000ff00,
22  /* focus movement */
23  BST_PATTERN_MOVE_LEFT = 0x1 << 16,
24  BST_PATTERN_MOVE_RIGHT = 0x2 << 16,
25  BST_PATTERN_MOVE_UP = 0x3 << 16,
26  BST_PATTERN_MOVE_DOWN = 0x4 << 16,
27  BST_PATTERN_PAGE_LEFT = 0x5 << 16,
28  BST_PATTERN_PAGE_RIGHT = 0x6 << 16,
29  BST_PATTERN_PAGE_UP = 0x7 << 16,
30  BST_PATTERN_PAGE_DOWN = 0x8 << 16,
31  BST_PATTERN_JUMP_LEFT = 0x9 << 16,
32  BST_PATTERN_JUMP_RIGHT = 0xa << 16,
33  BST_PATTERN_JUMP_TOP = 0xb << 16,
34  BST_PATTERN_JUMP_BOTTOM = 0xc << 16,
35  BST_PATTERN_MOVE_NEXT = 0xd << 16,
36  BST_PATTERN_SET_STEP_WIDTH = 0xe << 16,
37  BST_PATTERN_MASK_MOVEMENT = 0x00ff0000,
38 } BstPatternFunction;
39 typedef enum /*< skip >*/
40 {
41  BST_PATTERN_COLUMN_GC_TEXT0,
42  BST_PATTERN_COLUMN_GC_TEXT1,
43  BST_PATTERN_COLUMN_GC_VBAR,
44  BST_PATTERN_COLUMN_GC_LAST
45 } BstPatternColumnCellGcType;
46 typedef enum {
47  BST_PATTERN_LTYPE_SPACE,
48  BST_PATTERN_LTYPE_NOTE, /* plus #channel */
49  BST_PATTERN_LTYPE_OFFSET, /* plus #channel */
50  BST_PATTERN_LTYPE_LENGTH, /* plus #channel */
51  BST_PATTERN_LTYPE_VELOCITY, /* plus #channel */
52  BST_PATTERN_LTYPE_FINE_TUNE, /* plus #channel */
53  BST_PATTERN_LTYPE_CONTROL, /* plus #control */
54  BST_PATTERN_LTYPE_BAR,
55  BST_PATTERN_LTYPE_DBAR,
56 } BstPatternLType;
57 typedef enum {
58  BST_PATTERN_LFLAG_DIGIT_1 = 0 << 0,
59  BST_PATTERN_LFLAG_DIGIT_2 = 1 << 0,
60  BST_PATTERN_LFLAG_DIGIT_3 = 2 << 0,
61  BST_PATTERN_LFLAG_DIGIT_4 = 3 << 0,
62  BST_PATTERN_LFLAG_DIGIT_MASK = (3 << 0),
63  BST_PATTERN_LFLAG_DEC = 0 << 2,
64  BST_PATTERN_LFLAG_HEX = 1 << 2,
65  BST_PATTERN_LFLAG_NUM_MASK = (1 << 2),
66  BST_PATTERN_LFLAG_SIGNED = 1 << 5,
67  BST_PATTERN_LFLAG_LFOLD = 1 << 6,
68  BST_PATTERN_LFLAG_RFOLD = 1 << 7,
69  BST_PATTERN_LFLAG_COL1 = 0 << 8,
70  BST_PATTERN_LFLAG_COL2 = 1 << 8,
71  BST_PATTERN_LFLAG_COL3 = 2 << 8,
72  BST_PATTERN_LFLAG_COL4 = 3 << 8,
73  BST_PATTERN_LFLAG_COL_MASK = (3 << 8),
74 } BstPatternLFlags;
75 
76 /* --- typedefs & structures --- */
77 typedef struct _BstPatternView BstPatternView;
78 typedef struct _BstPatternColumn BstPatternColumn;
79 typedef struct _BstPatternColumnClass BstPatternColumnClass;
81 {
82  BstPatternColumnClass *klass;
83  gint num;
84  BstPatternLType ltype;
85  BstPatternLFlags lflags;
86  int n_focus_positions;
87  /* fields private to BstPatternView */
88  int x;
89  int width;
90  int focus_base;
91 };
93 {
94  int n_focus_positions;
95  guint instance_size;
96  void (*init) (BstPatternColumn *self);
97  PangoFontDescription* (*create_font_desc) (BstPatternColumn *self);
98  guint (*width_request) (BstPatternColumn *self,
99  BstPatternView *pview,
100  GdkWindow *drawable,
101  PangoLayout *pango_layout,
102  guint duration);
103  void (*draw_cell) (BstPatternColumn *self,
104  BstPatternView *pview,
105  GdkWindow *drawable,
106  PangoLayout *pango_layout,
107  guint tick,
108  guint duration,
109  GdkRectangle *cell_rect,
110  GdkRectangle *expose_area,
111  GdkGC *gcs[BST_PATTERN_COLUMN_GC_LAST]);
112  void (*get_focus_pos) (BstPatternColumn *self,
113  BstPatternView *pview,
114  GdkWindow *drawable,
115  PangoLayout *pango_layout,
116  guint tick,
117  guint duration,
118  GdkRectangle *cell_rect,
119  gint focus_pos,
120  gint *pos_x,
121  gint *pos_width);
122  guint collision_group;
123  gboolean (*key_event) (BstPatternColumn *self,
124  BstPatternView *pview,
125  GdkWindow *drawable,
126  PangoLayout *pango_layout,
127  guint tick,
128  guint duration,
129  GdkRectangle *cell_rect,
130  gint focus_pos,
131  guint keyval,
132  GdkModifierType modifier,
133  BstPatternFunction action,
134  gdouble param,
135  BstPatternFunction *movement);
136  void (*finalize) (BstPatternColumn *self);
137 };
138 
139 void bst_pattern_column_layouter_popup (BstPatternView *pview);
140 const gchar* bst_pattern_layout_parse_column (const gchar *string,
141  BstPatternLType *ltype,
142  gint *num,
143  BstPatternLFlags *flags);
144 BstPatternColumn* bst_pattern_column_create (BstPatternLType ltype,
145  gint num,
146  BstPatternLFlags lflags);
147 gboolean bst_pattern_column_has_notes (BstPatternColumn *column);
148 
149 // == Flags Enumeration Operators in C++ ==
150 #ifdef __cplusplus
151 constexpr BstPatternLFlags operator& (BstPatternLFlags s1, BstPatternLFlags s2) { return BstPatternLFlags (s1 & (long long unsigned) s2); }
152 inline BstPatternLFlags& operator&= (BstPatternLFlags &s1, BstPatternLFlags s2) { s1 = s1 & s2; return s1; }
153 constexpr BstPatternLFlags operator| (BstPatternLFlags s1, BstPatternLFlags s2) { return BstPatternLFlags (s1 | (long long unsigned) s2); }
154 inline BstPatternLFlags& operator|= (BstPatternLFlags &s1, BstPatternLFlags s2) { s1 = s1 | s2; return s1; }
155 constexpr BstPatternLFlags operator~ (BstPatternLFlags s1) { return BstPatternLFlags (~(long long unsigned) s1); }
156 constexpr BstPatternFunction operator& (BstPatternFunction s1, BstPatternFunction s2) { return BstPatternFunction (s1 & (long long unsigned) s2); }
157 inline BstPatternFunction& operator&= (BstPatternFunction &s1, BstPatternFunction s2) { s1 = s1 & s2; return s1; }
158 constexpr BstPatternFunction operator| (BstPatternFunction s1, BstPatternFunction s2) { return BstPatternFunction (s1 | (long long unsigned) s2); }
159 inline BstPatternFunction& operator|= (BstPatternFunction &s1, BstPatternFunction s2) { s1 = s1 | s2; return s1; }
160 constexpr BstPatternFunction operator~ (BstPatternFunction s1) { return BstPatternFunction (~(long long unsigned) s1); }
161 #endif // __cplusplus
162 #endif /* __BST_PATTERN_COLUMNS_H__ */
Definition: bstpatterncolumns.hh:92
Definition: bstpatternview.hh:42
Definition: bstpatterncolumns.hh:80