modify clr btn 16 plugins, add regdmp for sigtraps, rework mask_engine, mask rotate...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / presets.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  * 
6  * This program 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 2 of the License, or
9  * (at your option) any later version.
10  * 
11  * This program 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 this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  * 
20  */
21
22 #ifndef PRESETS_H
23 #define PRESETS_H
24
25
26 #include "arraylist.h"
27 #include "filexml.inc"
28 #include "keyframe.inc"
29
30
31 // Front end for a DB of presets for all plugins
32
33 // A single preset
34 class PresetsDBKeyframe
35 {
36 public:
37         PresetsDBKeyframe(const char *title, int is_factory);
38         ~PresetsDBKeyframe();
39
40         void set_data(char *data);
41
42         char *title;
43         char *data;
44 // is a factory preset
45         int is_factory;
46 };
47
48 // Presets for a single plugin
49 class PresetsDBPlugin
50 {
51 public:
52         PresetsDBPlugin(const char *title);
53         ~PresetsDBPlugin();
54         
55         
56         void load(FileXML *file, int is_factory);
57         void save(FileXML *file);
58
59 // Get a preset by name
60         PresetsDBKeyframe* get_keyframe(const char *title, int is_factory);
61 // Create a new keyframe
62         PresetsDBKeyframe* new_keyframe(const char *title);
63         void delete_keyframe(const char *title);
64 // Load a preset into the keyframe
65         void load_preset(const char *preset_title, 
66                 KeyFrame *keyframe,
67                 int is_factory);
68         int preset_exists(const char *preset_title, int is_factory);
69         int get_total_presets(int user_only);
70
71         ArrayList<PresetsDBKeyframe*> keyframes;
72         char *title;
73 };
74
75 class PresetsDB
76 {
77 public:
78         PresetsDB();
79
80 // Load the database from the file.
81         void load_from_file(char *path, int is_factory, int clear_it);
82 // load the database from a string
83         void load_from_string(char *string, int is_factory, int clear_it);
84         void load_common(FileXML *file, int is_factory);
85         
86 // Save the database to the file.
87         void save();
88         void sort(char *plugin_title);
89
90 // Get the total number of presets for a plugin
91         int get_total_presets(char *plugin_title, int user_only);
92 // Get the title of a preset
93         char* get_preset_title(char *plugin_title, int number);
94         int get_is_factory(char *plugin_title, int number);
95 // Get the data for a preset
96         char* get_preset_data(char *plugin_title, int number);
97 // Get a pluginDB by name
98         PresetsDBPlugin* get_plugin(const char *plugin_title);
99 // Create a pluginDB
100         PresetsDBPlugin* new_plugin(const char *plugin_title);
101         void save_preset(const char *plugin_title, 
102                 const char *preset_title, 
103                 char *data);
104         void delete_preset(const char *plugin_title, 
105                 const char *preset_title,
106                 int is_factory);
107 // Load a preset into the keyframe
108         void load_preset(const char *plugin_title, 
109                 const char *preset_title, 
110                 KeyFrame *keyframe,
111                 int is_factory);
112         int preset_exists(const char *plugin_title, 
113                 const char *preset_title,
114                 int is_factory);
115
116 private:
117 // Remove all plugin data
118         void clear();
119
120         ArrayList<PresetsDBPlugin*> plugins;
121 };
122
123
124
125 #endif
126
127
128