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