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