1 /* GSequencer - Advanced GTK Sequencer
2  * Copyright (C) 2005-2021 Joël Krähemann
3  *
4  * This file is part of GSequencer.
5  *
6  * GSequencer is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * GSequencer is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with GSequencer.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef __AGS_PATTERN_BOX_H__
21 #define __AGS_PATTERN_BOX_H__
22 
23 #include <glib.h>
24 #include <glib-object.h>
25 
26 #include <gtk/gtk.h>
27 
28 #include <ags/libags.h>
29 #include <ags/libags-audio.h>
30 
31 #include <ags/libags-gui.h>
32 
33 G_BEGIN_DECLS
34 
35 #define AGS_TYPE_PATTERN_BOX                (ags_pattern_box_get_type())
36 #define AGS_PATTERN_BOX(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_PATTERN_BOX, AgsPatternBox))
37 #define AGS_PATTERN_BOX_CLASS(class)        (G_TYPE_CHECK_CLASS_CAST((class), AGS_TYPE_PATTERN_BOX, AgsPatternBoxClass))
38 #define AGS_IS_PATTERN_BOX(obj)             (G_TYPE_CHECK_INSTANCE_TYPE((obj), AGS_TYPE_PATTERN_BOX))
39 #define AGS_IS_PATTERN_BOX_CLASS(class)     (G_TYPE_CHECK_CLASS_TYPE((class), AGS_TYPE_PATTERN_BOX))
40 #define AGS_PATTERN_BOX_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS((obj), AGS_TYPE_PATTERN_BOX, AgsPatternBoxClass))
41 
42 #define AGS_PATTERN_BOX_DEFAULT_PAD_WIDTH   (24)
43 #define AGS_PATTERN_BOX_DEFAULT_PAD_HEIGHT  (24)
44 
45 #define AGS_PATTERN_BOX_LED_DEFAULT_WIDTH (10)
46 #define AGS_PATTERN_BOX_LED_DEFAULT_HEIGHT (10)
47 
48 #define AGS_PATTERN_BOX_N_CONTROLS (16)
49 #define AGS_PATTERN_BOX_N_INDICES (4)
50 
51 typedef struct _AgsPatternBox AgsPatternBox;
52 typedef struct _AgsPatternBoxClass AgsPatternBoxClass;
53 
54 typedef enum{
55   AGS_PATTERN_BOX_BLOCK_PATTERN    = 1,
56   AGS_PATTERN_BOX_CONNECTED        = 1 <<  1,
57 }AgsPatternBoxFlags;
58 
59 typedef enum{
60   AGS_PATTERN_BOX_KEY_L_CONTROL       = 1,
61   AGS_PATTERN_BOX_KEY_R_CONTROL       = 1 <<  1,
62 }AgsPatternBoxKeyMask;
63 
64 typedef enum{
65   AGS_PATTERN_BOX_MOVE_LEFT,
66   AGS_PATTERN_BOX_MOVE_RIGHT,
67   AGS_PATTERN_BOX_INDEX_DECREMENT,
68   AGS_PATTERN_BOX_INDEX_INCREMENT,
69   AGS_PATTERN_BOX_TOGGLE_PAD,
70   AGS_PATTERN_BOX_COPY_PATTERN,
71 }AgsPatternBoxAction;
72 
73 struct _AgsPatternBox
74 {
75   GtkGrid grid;
76 
77   guint flags;
78 
79   guint key_mask;
80 
81   guint n_controls;
82   guint n_indices;
83 
84   guint cursor_x;
85   guint cursor_y;
86 
87   guint active_led;
88   AgsHLedArray *hled_array;
89 
90   GtkBox *pattern;
91 
92   GtkBox *offset;
93 };
94 
95 struct _AgsPatternBoxClass
96 {
97   GtkGridClass grid;
98 };
99 
100 GType ags_pattern_box_get_type(void);
101 
102 gboolean ags_pattern_box_led_queue_draw_timeout(AgsPatternBox *pattern_box);
103 
104 void ags_pattern_box_set_pattern(AgsPatternBox *pattern_box);
105 
106 AgsPatternBox* ags_pattern_box_new();
107 
108 G_END_DECLS
109 
110 #endif /*__AGS_PATTERN_BOX_H__*/
111