1 /* GSequencer - Advanced GTK Sequencer
2  * Copyright (C) 2005-2020 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_AUTOMATION_EDITOR_H__
21 #define __AGS_AUTOMATION_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 #include <ags/libags-gui.h>
31 
32 #include <ags/X/ags_machine.h>
33 
34 #include <ags/X/editor/ags_automation_toolbar.h>
35 #include <ags/X/editor/ags_machine_selector.h>
36 #include <ags/X/editor/ags_scrolled_automation_edit_box.h>
37 #include <ags/X/editor/ags_automation_edit.h>
38 #include <ags/X/editor/ags_automation_meta.h>
39 
40 G_BEGIN_DECLS
41 
42 #define AGS_TYPE_AUTOMATION_EDITOR                (ags_automation_editor_get_type())
43 #define AGS_AUTOMATION_EDITOR(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_AUTOMATION_EDITOR, AgsAutomationEditor))
44 #define AGS_AUTOMATION_EDITOR_CLASS(class)        (G_TYPE_CHECK_CLASS_CAST((class), AGS_TYPE_AUTOMATION_EDITOR, AgsAutomationEditorClass))
45 #define AGS_IS_AUTOMATION_EDITOR(obj)             (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AGS_TYPE_AUTOMATION_EDITOR))
46 #define AGS_IS_AUTOMATION_EDITOR_CLASS(class)     (G_TYPE_CHECK_CLASS_TYPE ((class), AGS_TYPE_AUTOMATION_EDITOR))
47 #define AGS_AUTOMATION_EDITOR_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS (obj, AGS_TYPE_AUTOMATION_EDITOR, AgsAutomationEditorClass))
48 
49 #define AGS_AUTOMATION_EDITOR_CHILD(ptr) ((AgsAutomationEditorChild *)(ptr))
50 
51 #define AGS_AUTOMATION_EDITOR_MAX_VALUE_COUNT (64 * 16 * 16 * 1200)
52 #define AGS_AUTOMATION_EDITOR_MAX_CONTROLS (64 * 16 * 16 * 1200)
53 
54 #define AGS_AUTOMATION_EDITOR_DEFAULT_VERSION "1.3.0"
55 #define AGS_AUTOMATION_EDITOR_DEFAULT_BUILD_ID "Wed Dec 27 03:43:55 UTC 2017"
56 
57 typedef struct _AgsAutomationEditor AgsAutomationEditor;
58 typedef struct _AgsAutomationEditorClass AgsAutomationEditorClass;
59 
60 typedef enum{
61   AGS_AUTOMATION_EDITOR_CONNECTED                 = 1,
62   AGS_AUTOMATION_EDITOR_RESET_AUDIO_HSCROLLBAR    = 1 <<  1,
63   AGS_AUTOMATION_EDITOR_RESET_OUTPUT_HSCROLLBAR   = 1 <<  2,
64   AGS_AUTOMATION_EDITOR_RESET_INPUT_HSCROLLBAR    = 1 <<  3,
65   AGS_AUTOMATION_EDITOR_PASTE_MATCH_LINE          = 1 <<  4,
66   AGS_AUTOMATION_EDITOR_PASTE_NO_DUPLICATES       = 1 <<  5,
67 }AgsAutomationEditorFlags;
68 
69 struct _AgsAutomationEditor
70 {
71   GtkBox box;
72 
73   guint flags;
74 
75   gchar *version;
76   gchar *build_id;
77 
78   guint tact_counter;
79   gdouble current_tact;
80 
81   guint chunk_duration;
82 
83   GtkPaned *paned;
84 
85   AgsMachineSelector *machine_selector;
86   AgsMachine *selected_machine;
87 
88   AgsAutomationToolbar *automation_toolbar;
89 
90   GtkNotebook *notebook;
91 
92   AgsRuler *audio_ruler;
93   AgsScrolledScaleBox *audio_scrolled_scale_box;
94   AgsScrolledAutomationEditBox *audio_scrolled_automation_edit_box;
95   GtkScrollbar *audio_vscrollbar;
96   GtkScrollbar *audio_hscrollbar;
97 
98   AgsNotebook *output_notebook;
99   AgsRuler *output_ruler;
100   AgsScrolledScaleBox *output_scrolled_scale_box;
101   AgsScrolledAutomationEditBox *output_scrolled_automation_edit_box;
102   GtkScrollbar *output_vscrollbar;
103   GtkScrollbar *output_hscrollbar;
104 
105   AgsNotebook *input_notebook;
106   AgsRuler *input_ruler;
107   AgsScrolledScaleBox *input_scrolled_scale_box;
108   AgsScrolledAutomationEditBox *input_scrolled_automation_edit_box;
109   GtkScrollbar *input_vscrollbar;
110   GtkScrollbar *input_hscrollbar;
111 
112   AgsAutomationEdit *focused_automation_edit;
113 
114   AgsAutomationMeta *automation_meta;
115 };
116 
117 struct _AgsAutomationEditorClass
118 {
119   GtkBoxClass box;
120 
121   void (*machine_changed)(AgsAutomationEditor *automation_editor,
122 			  AgsMachine *machine);
123 };
124 
125 GType ags_automation_editor_get_type(void);
126 
127 void ags_automation_editor_reset_audio_scrollbar(AgsAutomationEditor *automation_editor);
128 void ags_automation_editor_reset_output_scrollbar(AgsAutomationEditor *automation_editor);
129 void ags_automation_editor_reset_input_scrollbar(AgsAutomationEditor *automation_editor);
130 
131 void ags_automation_editor_machine_changed(AgsAutomationEditor *automation_editor,
132 					   AgsMachine *machine);
133 
134 void ags_automation_editor_add_acceleration(AgsAutomationEditor *automation_editor,
135 					    AgsAcceleration *acceleration);
136 
137 void ags_automation_editor_delete_acceleration(AgsAutomationEditor *automation_editor,
138 					       guint x, gdouble y);
139 
140 void ags_automation_editor_select_region(AgsAutomationEditor *automation_editor,
141 					 guint x0, gdouble y0,
142 					 guint x1, gdouble y1);
143 
144 void ags_automation_editor_select_all(AgsAutomationEditor *automation_editor);
145 
146 void ags_automation_editor_paste(AgsAutomationEditor *automation_editor);
147 void ags_automation_editor_copy(AgsAutomationEditor *automation_editor);
148 void ags_automation_editor_cut(AgsAutomationEditor *automation_editor);
149 void ags_automation_editor_invert(AgsAutomationEditor *automation_editor);
150 
151 AgsAutomationEditor* ags_automation_editor_new();
152 
153 G_END_DECLS
154 
155 #endif /*__AGS_AUTOMATION_EDITOR_H__*/
156