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_SHEET_EDITOR_H__
21 #define __AGS_SHEET_EDITOR_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 #include <ags/X/ags_machine.h>
34 
35 #include <ags/X/editor/ags_sheet_toolbar.h>
36 #include <ags/X/editor/ags_machine_selector.h>
37 #include <ags/X/editor/ags_sheet_edit.h>
38 
39 G_BEGIN_DECLS
40 
41 #define AGS_TYPE_SHEET_EDITOR                (ags_sheet_editor_get_type ())
42 #define AGS_SHEET_EDITOR(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_SHEET_EDITOR, AgsSheetEditor))
43 #define AGS_SHEET_EDITOR_CLASS(class)        (G_TYPE_CHECK_CLASS_CAST((class), AGS_TYPE_SHEET_EDITOR, AgsSheetEditorClass))
44 #define AGS_IS_SHEET_EDITOR(obj)             (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AGS_TYPE_SHEET_EDITOR))
45 #define AGS_IS_SHEET_EDITOR_CLASS(class)     (G_TYPE_CHECK_CLASS_TYPE ((class), AGS_TYPE_SHEET_EDITOR))
46 #define AGS_SHEET_EDITOR_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS ((obj), AGS_TYPE_SHEET_EDITOR, AgsSheetEditorClass))
47 
48 #define AGS_SHEET_EDITOR_DEFAULT_VERSION "2.0.0"
49 #define AGS_SHEET_EDITOR_DEFAULT_BUILD_ID "Sat Feb  3 16:15:50 UTC 2018"
50 
51 #define AGS_SHEET_EDITOR_MAX_CONTROLS (16 * 16 * 1200)
52 
53 typedef struct _AgsSheetEditor AgsSheetEditor;
54 typedef struct _AgsSheetEditorClass AgsSheetEditorClass;
55 
56 typedef enum{
57   AGS_SHEET_EDITOR_CONNECTED                    = 1,
58   AGS_SHEET_EDITOR_PATTERN_MODE                 = 1 <<  1,
59   AGS_SHEET_EDITOR_PASTE_MATCH_AUDIO_CHANNEL    = 1 <<  2,
60   AGS_SHEET_EDITOR_PASTE_NO_DUPLICATES          = 1 <<  3,
61 }AgsSheetEditorFlags;
62 
63 struct _AgsSheetEditor
64 {
65   GtkBox box;
66 
67   guint flags;
68 
69   gchar *version;
70   gchar *build_id;
71 
72   guint tact_counter;
73   gdouble current_tact;
74 
75   guint chunk_duration;
76 
77   GObject *soundcard;
78 
79   GtkHPaned *paned;
80 
81   AgsSheetToolbar *sheet_toolbar;
82 
83   AgsMachineSelector *machine_selector;
84   AgsMachine *selected_machine;
85 
86   AgsNotebook *notebook;
87 
88   AgsSheetEdit *sheet_edit;
89 };
90 
91 struct _AgsSheetEditorClass
92 {
93   GtkBoxClass box;
94 
95   void (*machine_changed)(AgsSheetEditor *sheet_editor, AgsMachine *machine);
96 };
97 
98 GType ags_sheet_editor_get_type(void);
99 
100 void ags_sheet_editor_machine_changed(AgsSheetEditor *sheet_editor,
101 					AgsMachine *machine);
102 
103 void ags_sheet_editor_add_note(AgsSheetEditor *sheet_editor,
104 			       AgsNote *note);
105 
106 void ags_sheet_editor_delete_note(AgsSheetEditor *sheet_editor,
107 				  guint x, guint y);
108 
109 void ags_sheet_editor_select_region(AgsSheetEditor *sheet_editor,
110 				    guint x0, guint y0,
111 				    guint x1, guint y1);
112 
113 void ags_sheet_editor_do_feedback(AgsSheetEditor *sheet_editor);
114 
115 void ags_sheet_editor_select_all(AgsSheetEditor *sheet_editor);
116 
117 void ags_sheet_editor_paste(AgsSheetEditor *sheet_editor);
118 void ags_sheet_editor_copy(AgsSheetEditor *sheet_editor);
119 void ags_sheet_editor_cut(AgsSheetEditor *sheet_editor);
120 
121 AgsSheetEditor* ags_sheet_editor_new();
122 
123 G_END_DECLS
124 
125 #endif /*__AGS_SHEET_EDITOR_H__*/
126