label edit deadlock, build openexr cfg option, code cleanup
[goodguy/history.git] / cinelerra-5.1 / cinelerra / awindowgui.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 AWINDOWGUI_H
23 #define AWINDOWGUI_H
24
25 #include "arraylist.h"
26 #include "bcdialog.h"
27 #include "assetpopup.inc"
28 #include "asset.inc"
29 #include "assets.inc"
30 #include "awindow.inc"
31 #include "awindowgui.inc"
32 #include "clippopup.inc"
33 #include "edl.inc"
34 #include "folderlistmenu.inc"
35 #include "guicast.h"
36 #include "labeledit.inc"
37 #include "labelpopup.inc"
38 #include "labels.h"
39 #include "indexable.inc"
40 #include "mwindow.inc"
41 #include "newfolder.inc"
42 #include "pluginserver.inc"
43 #include "vicon.h"
44
45 class AssetPicon : public BC_ListBoxItem
46 {
47 public:
48         AssetPicon(MWindow *mwindow, AWindowGUI *gui, Indexable *indexable);
49         AssetPicon(MWindow *mwindow, AWindowGUI *gui, EDL *edl);
50         AssetPicon(MWindow *mwindow, AWindowGUI *gui, PluginServer *plugin);
51         AssetPicon(MWindow *mwindow, AWindowGUI *gui, Label *plugin);
52         AssetPicon(MWindow *mwindow, AWindowGUI *gui, int folder);
53         AssetPicon(MWindow *mwindow, AWindowGUI *gui, const char *folder_name, int folder_num);
54         virtual ~AssetPicon();
55
56         void create_objects();
57         void reset();
58
59         MWindow *mwindow;
60         AWindowGUI *gui;
61         BC_Pixmap *icon;
62         VFrame *icon_vframe;
63         int foldernum;
64 // ID of thing pointed to
65         int id;
66
67 // Check ID first.  Update these next before dereferencing
68 // Asset if asset
69         Indexable *indexable;
70 // EDL if clip
71         EDL *edl;
72
73         int in_use;
74
75
76         int persistent;
77         PluginServer *plugin;
78         Label *label;
79         VIcon *vicon;
80 };
81
82 class AssetVIcon : public VIcon {
83 public:
84         AssetPicon *picon;
85         VFrame *temp;
86         int64_t length;
87
88         VFrame *frame();
89         int64_t set_seq_no(int64_t no);
90         int get_vx();
91         int get_vy();
92
93         AssetVIcon(AssetPicon *picon, int w, int h, double framerate, int64_t length);
94         ~AssetVIcon();
95 };
96
97 class AWindowRemovePlugin;
98
99 class AWindowRemovePluginGUI : public BC_Window {
100 public:
101         AWindow *awindow;
102         AWindowRemovePlugin *thread;
103         PluginServer *plugin;
104         ArrayList<BC_ListBoxItem*> plugin_list;
105         BC_Pixmap *icon;
106         VFrame *icon_vframe;
107         BC_ListBox *list;
108
109         void create_objects();
110
111         AWindowRemovePluginGUI(AWindow *awindow, AWindowRemovePlugin *thread,
112                  int x, int y, PluginServer *plugin);
113         ~AWindowRemovePluginGUI();
114 };
115
116 class AWindowRemovePlugin : public BC_DialogThread {
117 public:
118         AWindow *awindow;
119         PluginServer *plugin;
120         BC_Window* new_gui();
121         void handle_close_event(int result);
122         int remove_plugin(PluginServer *plugin, ArrayList<BC_ListBoxItem*> &folder);
123
124         AWindowRemovePlugin(AWindow *awindow, PluginServer *plugin);
125         ~AWindowRemovePlugin();
126 };
127
128 class AWindowGUI : public BC_Window
129 {
130 public:
131         AWindowGUI(MWindow *mwindow, AWindow *awindow);
132         ~AWindowGUI();
133
134         void create_objects();
135         int resize_event(int w, int h);
136         int translation_event();
137         int close_event();
138         int keypress_event();
139         void async_update_assets();     // Sends update asset event
140         void update_effects();
141         void sort_assets();
142         void reposition_objects();
143         static int folder_number(const char *name);
144 // Call back for MWindow entry point
145         int drag_motion();
146         int drag_stop();
147 // Collect items into the drag vectors of MainSession
148         void collect_assets();
149         void create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
150                 int do_audio,
151                 int do_video,
152                 int is_realtime,
153                 int is_transition);
154         void create_label_folder();
155         void copy_picons(ArrayList<BC_ListBoxItem*> *dst,
156                 ArrayList<BC_ListBoxItem*> *src, int folder);
157         void sort_picons(ArrayList<BC_ListBoxItem*> *src);
158 // Return the selected asset in asset_list
159         Indexable* selected_asset();
160         PluginServer* selected_plugin();
161         AssetPicon* selected_folder();
162         bool protected_pixmap(BC_Pixmap *pixmap);
163         int save_defaults(BC_Hash *defaults);
164         int load_defaults(BC_Hash *defaults);
165         void start_vicon_drawing();
166         void stop_vicon_drawing();
167         void update_picon(Indexable *indexable);
168
169         MWindow *mwindow;
170         AWindow *awindow;
171
172         AWindowAssets *asset_list;
173         AWindowFolders *folder_list;
174         AWindowDivider *divider;
175
176 // Store data to speed up responses
177 // Persistant data for listboxes
178 // All assets in current EDL
179         ArrayList<BC_ListBoxItem*> assets;
180         ArrayList<BC_ListBoxItem*> folders;
181         ArrayList<BC_ListBoxItem*> aeffects;
182         ArrayList<BC_ListBoxItem*> veffects;
183         ArrayList<BC_ListBoxItem*> atransitions;
184         ArrayList<BC_ListBoxItem*> vtransitions;
185         ArrayList<BC_ListBoxItem*> labellist;
186
187 // Currently displayed data for listboxes
188 // Currently displayed assets + comments
189         ArrayList<BC_ListBoxItem*> displayed_assets[2];
190
191         const char *asset_titles[ASSET_COLUMNS];
192
193         BC_Hash *defaults;
194 // Persistent icons
195         BC_Pixmap *folder_icon;
196         BC_Pixmap *file_icon;
197         BC_Pixmap *audio_icon;
198         BC_Pixmap *video_icon;
199         BC_Pixmap *label_icon;
200         BC_Pixmap *clip_icon;         VFrame *clip_vframe;
201         BC_Pixmap *atransition_icon;  VFrame *atransition_vframe;
202         BC_Pixmap *vtransition_icon;  VFrame *vtransition_vframe;
203         BC_Pixmap *aeffect_icon;      VFrame *aeffect_vframe;
204         BC_Pixmap *ladspa_icon;       VFrame *ladspa_vframe;
205         BC_Pixmap *ff_aud_icon;       VFrame *ff_aud_vframe;
206         BC_Pixmap *ff_vid_icon;       VFrame *ff_vid_vframe;
207         BC_Pixmap *veffect_icon;      VFrame *veffect_vframe;
208         NewFolderThread *newfolder_thread;
209
210 // Popup menus
211         AssetPopup *asset_menu;
212         ClipPopup *clip_menu;
213         LabelPopup *label_menu;
214         AssetListMenu *assetlist_menu;
215         ClipListMenu *cliplist_menu;
216         LabelListMenu *labellist_menu;
217         FolderListMenu *folderlist_menu;
218         AddTools *add_tools;
219 // Temporary for reading picons from files
220         VFrame *temp_picon;
221         VIconThread *vicon_thread;
222
223         int64_t plugin_visibility;
224         AWindowRemovePlugin *remove_plugin;
225
226         AVIconDrawing *avicon_drawing;
227         int avicon_w, avicon_h, vicon_drawing;
228         int allow_iconlisting;
229
230 // Create custom atoms to be used for async messages between windows
231         int create_custom_xatoms();
232 // Function to overload to recieve customly defined atoms
233         virtual int recieve_custom_xatoms(xatom_event *event);
234         static const char *folder_names[];
235
236 private:
237         void update_folder_list();
238         void update_asset_list();
239         void filter_displayed_assets();
240         Atom UpdateAssetsXAtom;
241         void update_assets();
242
243 };
244
245 class AWindowAssets : public BC_ListBox
246 {
247 public:
248         AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
249         ~AWindowAssets();
250
251         int handle_event();
252         int selection_changed();
253         void draw_background();
254         int drag_start_event();
255         int drag_motion_event();
256         int drag_stop_event();
257         int button_press_event();
258         int column_resize_event();
259         int focus_in_event();
260         int focus_out_event();
261
262         MWindow *mwindow;
263         AWindowGUI *gui;
264 };
265
266 class AWindowDivider : public BC_SubWindow
267 {
268 public:
269         AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
270         ~AWindowDivider();
271
272         int button_press_event();
273         int cursor_motion_event();
274         int button_release_event();
275
276         MWindow *mwindow;
277         AWindowGUI *gui;
278 };
279
280 class AWindowFolders : public BC_ListBox
281 {
282 public:
283         AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
284         ~AWindowFolders();
285
286         int selection_changed();
287         int button_press_event();
288
289         MWindow *mwindow;
290         AWindowGUI *gui;
291 };
292
293 class AWindowNewFolder : public BC_Button
294 {
295 public:
296         AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
297         int handle_event();
298         MWindow *mwindow;
299         AWindowGUI *gui;
300         int x, y;
301 };
302
303 class AWindowDeleteFolder : public BC_Button
304 {
305 public:
306         AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
307         int handle_event();
308         MWindow *mwindow;
309         AWindowGUI *gui;
310         int x, y;
311 };
312
313 class AWindowRenameFolder : public BC_Button
314 {
315 public:
316         AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
317         int handle_event();
318         MWindow *mwindow;
319         AWindowGUI *gui;
320         int x, y;
321 };
322
323 class AWindowDeleteDisk : public BC_Button
324 {
325 public:
326         AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y);
327         int handle_event();
328         MWindow *mwindow;
329         AWindowGUI *gui;
330         int x, y;
331 };
332
333 class AWindowDeleteProject : public BC_Button
334 {
335 public:
336         AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y);
337         int handle_event();
338         MWindow *mwindow;
339         AWindowGUI *gui;
340         int x, y;
341 };
342
343 class AWindowInfo : public BC_Button
344 {
345 public:
346         AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y);
347         int handle_event();
348         MWindow *mwindow;
349         AWindowGUI *gui;
350         int x, y;
351 };
352
353 class AWindowRedrawIndex : public BC_Button
354 {
355 public:
356         AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y);
357         int handle_event();
358         MWindow *mwindow;
359         AWindowGUI *gui;
360         int x, y;
361 };
362
363 class AWindowPaste : public BC_Button
364 {
365 public:
366         AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y);
367         int handle_event();
368         MWindow *mwindow;
369         AWindowGUI *gui;
370         int x, y;
371 };
372
373 class AWindowAppend : public BC_Button
374 {
375 public:
376         AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y);
377         int handle_event();
378         MWindow *mwindow;
379         AWindowGUI *gui;
380         int x, y;
381 };
382
383 class AWindowView : public BC_Button
384 {
385 public:
386         AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y);
387         int handle_event();
388         MWindow *mwindow;
389         AWindowGUI *gui;
390         int x, y;
391 };
392
393 class AddTools : public BC_PopupMenu
394 {
395 public:
396         AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, const char *title);
397         void create_objects();
398
399         MWindow *mwindow;
400         AWindowGUI *gui;
401 };
402
403 class AddPluginItem : public BC_MenuItem
404 {
405 public:
406         AddPluginItem(AddTools *menu, const char *text, int idx);
407         int handle_event();
408
409         AddTools *menu;
410         int idx;
411 };
412
413 class AVIconDrawing : public BC_Toggle
414 {
415 public:
416         AWindowGUI *agui;
417
418         int handle_event();
419         static void calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh);
420
421         AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images);
422         ~AVIconDrawing();
423 };
424
425
426 class AWindowListFormat : public BC_MenuItem
427 {
428 public:
429         AWindowListFormat(MWindow *mwindow, AWindowGUI *gui);
430
431         void update();
432         int handle_event();
433         MWindow *mwindow;
434         AWindowGUI *gui;
435 };
436
437
438 class AWindowListSort : public BC_MenuItem
439 {
440 public:
441         AWindowListSort(MWindow *mwindow, AWindowGUI *gui);
442
443         void update();
444         int handle_event();
445         MWindow *mwindow;
446         AWindowGUI *gui;
447 };
448
449 #endif