fix for filebox apply btn on resize
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / keyframegui.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2017 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 KEYFRAMEGUI_H
23 #define KEYFRAMEGUI_H
24
25
26 #include "bcdialog.h"
27 #include "guicast.h"
28 #include "presets.inc"
29
30 class KeyFrameWindow;
31
32
33
34
35 #define KEYFRAME_COLUMNS 2
36 // Enable editing of detailed keyframe parameters.
37 #define EDIT_KEYFRAME
38
39 class KeyFrameThread : public BC_DialogThread
40 {
41 public:
42         KeyFrameThread(MWindow *mwindow);
43         ~KeyFrameThread();
44
45
46         BC_Window* new_gui();
47         void start_window(Plugin *plugin, KeyFrame *keyframe);
48         void handle_done_event(int result);
49         void handle_close_event(int result);
50         void update_values();
51         void save_value(char *value);
52         void save_preset(const char *title, int is_factory);
53         void delete_preset(const char *title, int is_factory);
54         void apply_preset(const char *title, int is_factory);
55         void apply_value();
56         void calculate_preset_list();
57         void update_gui(int update_value_text = 1);
58         void close_window();
59
60         ArrayList<BC_ListBoxItem*> *keyframe_data;
61         Plugin *plugin;
62         KeyFrame *keyframe;
63         MWindow *mwindow;
64         char window_title[BCTEXTLEN];
65         char plugin_title[BCTEXTLEN];
66
67 // the currently selected preset is a factory preset
68         int is_factory;
69 // title of the currently selected preset from the DB
70         char preset_text[BCTEXTLEN];
71         
72         const char *column_titles[KEYFRAME_COLUMNS];
73         int column_width[KEYFRAME_COLUMNS];
74 // list of preset text to display
75         ArrayList<BC_ListBoxItem*> *presets_data;
76 // flag for each preset shown
77         ArrayList<int> is_factories;
78 // title of each preset shown
79         ArrayList<char*> preset_titles;
80         PresetsDB *presets_db;
81 };
82
83 #ifdef EDIT_KEYFRAME
84
85
86 class KeyFrameList : public BC_ListBox
87 {
88 public:
89         KeyFrameList(KeyFrameThread *thread,
90                 KeyFrameWindow *window,
91                 int x,
92                 int y,
93                 int w, 
94                 int h);
95         int selection_changed();
96         int handle_event();
97         int column_resize_event();
98         KeyFrameThread *thread;
99         KeyFrameWindow *window;
100 };
101 #endif
102
103 class KeyFramePresetsList : public BC_ListBox
104 {
105 public:
106         KeyFramePresetsList(KeyFrameThread *thread,
107                 KeyFrameWindow *window,
108                 int x,
109                 int y,
110                 int w, 
111                 int h);
112         int selection_changed();
113         int handle_event();
114         KeyFrameThread *thread;
115         KeyFrameWindow *window;
116 };
117
118 class KeyFramePresetsText : public BC_TextBox
119 {
120 public:
121         KeyFramePresetsText(KeyFrameThread *thread,
122                 KeyFrameWindow *window,
123                 int x,
124                 int y,
125                 int w);
126         int handle_event();
127         KeyFrameThread *thread;
128         KeyFrameWindow *window;
129 };
130
131
132 class KeyFramePresetsDelete : public BC_GenericButton
133 {
134 public:
135         KeyFramePresetsDelete(KeyFrameThread *thread,
136                 KeyFrameWindow *window,
137                 int x,
138                 int y);
139         int handle_event();
140         KeyFrameThread *thread;
141         KeyFrameWindow *window;
142 };
143
144 class KeyFramePresetsSave : public BC_GenericButton
145 {
146 public:
147         KeyFramePresetsSave(KeyFrameThread *thread,
148                 KeyFrameWindow *window,
149                 int x,
150                 int y);
151         int handle_event();
152         KeyFrameThread *thread;
153         KeyFrameWindow *window;
154 };
155
156 class KeyFramePresetsApply : public BC_GenericButton
157 {
158 public:
159         KeyFramePresetsApply(KeyFrameThread *thread,
160                 KeyFrameWindow *window,
161                 int x,
162                 int y);
163         int handle_event();
164         KeyFrameThread *thread;
165         KeyFrameWindow *window;
166 };
167
168 /*
169  * class KeyFrameText : public BC_TextBox
170  * {
171  * public:
172  *      KeyFrameText(KeyFrameThread *thread,
173  *              KeyFrameWindow *window,
174  *              int x,
175  *              int y,
176  *              int w);
177  *      int handle_event();
178  *      KeyFrameThread *thread;
179  *      KeyFrameWindow *window;
180  * };
181  */
182
183 #ifdef EDIT_KEYFRAME
184
185
186 class KeyFrameValue : public BC_TextBox
187 {
188 public:
189         KeyFrameValue(KeyFrameThread *thread,
190                 KeyFrameWindow *window,
191                 int x,
192                 int y,
193                 int w);
194         int handle_event();
195         KeyFrameThread *thread;
196         KeyFrameWindow *window;
197 };
198
199 class KeyFrameAll : public BC_CheckBox
200 {
201 public:
202         KeyFrameAll(KeyFrameThread *thread,
203                 KeyFrameWindow *window,
204                 int x,
205                 int y);
206         int handle_event();
207         KeyFrameThread *thread;
208         KeyFrameWindow *window;
209 };
210
211 #endif
212
213
214 class KeyFramePresetsOK : public BC_OKButton
215 {
216 public:
217         KeyFramePresetsOK(KeyFrameThread *thread,
218                 KeyFrameWindow *window);
219         int keypress_event();
220         KeyFrameThread *thread;
221         KeyFrameWindow *window;
222 };
223
224
225
226 class KeyFrameWindow : public BC_Window
227 {
228 public:
229         KeyFrameWindow(MWindow *mwindow,
230                 KeyFrameThread *thread,
231                 int x,
232                 int y,
233                 char *title);
234         void create_objects();
235         int resize_event(int w, int h);
236         void update_editing();
237
238 #ifdef EDIT_KEYFRAME
239
240 // List of parameters, values, & whether the parameter is defined by the current keyframe.
241         KeyFrameList *keyframe_list;
242 // The text area of the plugin
243 //      KeyFrameText *keyframe_text;
244 // Value text of the current parameter
245         KeyFrameValue *value_text;
246         KeyFrameAll *all_toggle;
247 #endif
248         
249         KeyFramePresetsList *preset_list;
250         KeyFramePresetsText *preset_text;
251         KeyFramePresetsDelete *delete_preset;
252         KeyFramePresetsSave *save_preset;
253         KeyFramePresetsApply *apply_preset;
254
255 #ifdef EDIT_KEYFRAME
256
257         BC_Title *title1;
258 //      BC_Title *title2;
259         BC_Title *title3;
260 #endif
261
262         BC_Title *title4;
263         BC_Title *title5;
264
265         MWindow *mwindow;
266         KeyFrameThread *thread;
267 };
268
269
270
271
272 #endif
273
274
275
276
277