1 /*
2  * Copyright (C) 2020 Alexandros Theodotou <alex at zrythm dot org>
3  *
4  * This file is part of Zrythm
5  *
6  * Zrythm is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Affero 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  * Zrythm 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 Affero General Public License for more details.
15  *
16  * You should have received a copy of the GNU Affero General Public License
17  * along with Zrythm.  If not, see <https://www.gnu.org/licenses/>.
18  */
19 
20 /**
21  * \file
22  *
23  * Timeline backend.
24  */
25 
26 #ifndef __GUI_BACKEND_TIMELINE_H__
27 #define __GUI_BACKEND_TIMELINE_H__
28 
29 #include "gui/backend/editor_settings.h"
30 #include "utils/yaml.h"
31 
32 /**
33  * @addtogroup gui_backend
34  *
35  * @{
36  */
37 
38 #define TIMELINE_SCHEMA_VERSION 1
39 
40 #define PRJ_TIMELINE (PROJECT->timeline)
41 
42 /**
43  * Clip editor serializable backend.
44  *
45  * The actual widgets should reflect the
46  * information here.
47  */
48 typedef struct Timeline
49 {
50   int            schema_version;
51 
52   /** Settings for the timeline. */
53   EditorSettings editor_settings;
54 } Timeline;
55 
56 static const cyaml_schema_field_t
57 timeline_fields_schema[] =
58 {
59   YAML_FIELD_INT (
60     Timeline, schema_version),
61   YAML_FIELD_MAPPING_EMBEDDED (
62     Timeline, editor_settings,
63     editor_settings_fields_schema),
64 
65   CYAML_FIELD_END
66 };
67 
68 static const cyaml_schema_value_t
69 timeline_schema =
70 {
71   CYAML_VALUE_MAPPING (
72     CYAML_FLAG_POINTER,
73     Timeline, timeline_fields_schema),
74 };
75 
76 /**
77  * Inits the Timeline after a Project is loaded.
78  */
79 void
80 timeline_init_loaded (
81   Timeline * self);
82 
83 /**
84  * Inits the Timeline instance.
85  */
86 void
87 timeline_init (
88   Timeline * self);
89 
90 Timeline *
91 timeline_clone (
92   Timeline * src);
93 
94 /**
95  * Creates a new Timeline instance.
96  */
97 Timeline *
98 timeline_new (void);
99 
100 void
101 timeline_free (
102   Timeline * self);
103 
104 /**
105  * @}
106  */
107 
108 #endif
109