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_WINDOW_H__
21 #define __AGS_WINDOW_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_context_menu.h>
33 #include <ags/X/ags_menu_bar.h>
34 #include <ags/X/ags_machine.h>
35 #include <ags/X/ags_notation_editor.h>
36 #include <ags/X/ags_navigation.h>
37 #include <ags/X/ags_export_window.h>
38 #include <ags/X/ags_automation_window.h>
39 #include <ags/X/ags_wave_window.h>
40 #include <ags/X/ags_preferences.h>
41 
42 
43 G_BEGIN_DECLS
44 
45 #define AGS_TYPE_WINDOW                (ags_window_get_type())
46 #define AGS_WINDOW(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_WINDOW, AgsWindow))
47 #define AGS_WINDOW_CLASS(class)        (G_TYPE_CHECK_CLASS_CAST((class), AGS_TYPE_WINDOW, AgsWindowClass))
48 #define AGS_IS_WINDOW(obj)             (G_TYPE_CHECK_INSTANCE_TYPE((obj), AGS_TYPE_WINDOW))
49 #define AGS_IS_WINDOW_CLASS(class)     (G_TYPE_CHECK_CLASS_TYPE((class), AGS_TYPE_WINDOW))
50 #define AGS_WINDOW_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS((obj), AGS_TYPE_WINDOW, AgsWindowClass))
51 
52 #define AGS_MACHINE_COUNTER(ptr) ((AgsMachineCounter *)(ptr))
53 
54 typedef struct _AgsWindow AgsWindow;
55 typedef struct _AgsWindowClass AgsWindowClass;
56 typedef struct _AgsMachineCounter AgsMachineCounter;
57 
58 typedef enum{
59   AGS_WINDOW_CONNECTED    = 1,
60   AGS_WINDOW_READY        = 1 << 1,
61   AGS_WINDOW_LOADING      = 1 << 2,
62   AGS_WINDOW_SAVING       = 1 << 3,
63   AGS_WINDOW_TERMINATING  = 1 << 4,
64 }AgsWindowFlags;
65 
66 struct _AgsWindow
67 {
68   GtkWindow window;
69 
70   guint flags;
71 
72   gchar *filename;
73 
74   char *name;
75 
76   AgsMenuBar *menu_bar;
77   AgsContextMenu *context_menu;
78 
79   GtkPaned *paned;
80 
81   GtkBox *machines;
82   GList *machine_counter;
83   AgsMachine *selected;
84 
85   AgsNotationEditor *notation_editor;
86   AgsNavigation *navigation;
87 
88   GList *dialog;
89 
90   AgsAutomationWindow *automation_window;
91   AgsWaveWindow *wave_window;
92 
93   AgsExportWindow *export_window;
94 
95   GtkWidget *midi_import_wizard;
96   GtkWidget *midi_export_wizard;
97   GtkWidget *midi_file_chooser;
98 
99   AgsPreferences *preferences;
100 };
101 
102 struct _AgsWindowClass
103 {
104   GtkWindowClass window;
105 };
106 
107 struct _AgsMachineCounter
108 {
109   gchar *version;
110   gchar *build_id;
111 
112   GType machine_type;
113   gchar *filename;
114   gchar *effect;
115 
116   guint counter;
117 };
118 
119 GType ags_window_get_type(void);
120 
121 GList* ags_window_standard_machine_counter_alloc();
122 AgsMachineCounter* ags_window_find_machine_counter(AgsWindow *window,
123 						   GType machine_type);
124 
125 void ags_window_increment_machine_counter(AgsWindow *window,
126 					  GType machine_type);
127 void ags_window_decrement_machine_counter(AgsWindow *window,
128 					  GType machine_type);
129 
130 AgsMachineCounter* ags_machine_counter_alloc(gchar *version, gchar *build_id,
131 					     GType machine_type, guint initial_value);
132 
133 void ags_window_show_error(AgsWindow *window,
134 			   gchar *message);
135 
136 gboolean ags_window_load_file_timeout(AgsWindow *window);
137 
138 AgsWindow* ags_window_new();
139 
140 G_END_DECLS
141 
142 #endif /*__AGS_WINDOW_H__*/
143