8958fbf7dd19698fd7ad84836415f4bd5bf088d2
[goodguy/history.git] / cinelerra-5.0 / 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 "indexable.inc"
35 #include "mwindow.inc"
36 #include "newfolder.inc"
37 #include "pluginserver.inc"
38
39 class AWindowAssets;
40 class AWindowFolders;
41 class AWindowNewFolder;
42 class AWindowDeleteFolder;
43 class AWindowRenameFolder;
44 class AWindowDeleteDisk;
45 class AWindowDeleteProject;
46 class AWindowDivider;
47 class AWindowInfo;
48 class AWindowRedrawIndex;
49 class AWindowPaste;
50 class AWindowAppend;
51 class AWindowView;
52 class AddTools;
53 class AddPluginsMenu;
54 class AddPluginItem;
55
56 class AWindowGUI;
57
58 class AssetPicon : public BC_ListBoxItem
59 {
60 public:
61         AssetPicon(MWindow *mwindow, AWindowGUI *gui, Indexable *indexable);
62         AssetPicon(MWindow *mwindow, AWindowGUI *gui, EDL *edl);
63         AssetPicon(MWindow *mwindow, AWindowGUI *gui, PluginServer *plugin);
64         AssetPicon(MWindow *mwindow, AWindowGUI *gui, const char *folder);
65         virtual ~AssetPicon();
66
67         void create_objects();
68         void reset();
69
70         MWindow *mwindow;
71         AWindowGUI *gui;
72         BC_Pixmap *icon;
73         VFrame *icon_vframe;
74 // ID of thing pointed to
75         int id;
76
77 // Check ID first.  Update these next before dereferencing
78 // Asset if asset
79         Indexable *indexable;
80 // EDL if clip
81         EDL *edl;
82
83         int in_use;
84
85
86         int persistent;
87         PluginServer *plugin;
88 };
89
90 class AWindowRemovePlugin;
91
92 class AWindowRemovePluginGUI : public BC_Window {
93 public:
94         AWindow *awindow;
95         AWindowRemovePlugin *thread;
96         PluginServer *plugin;
97         ArrayList<BC_ListBoxItem*> plugin_list;
98         BC_Pixmap *icon;
99         VFrame *icon_vframe;
100         BC_ListBox *list;
101
102         void create_objects();
103
104         AWindowRemovePluginGUI(AWindow *awindow, AWindowRemovePlugin *thread,
105                  int x, int y, PluginServer *plugin);
106         ~AWindowRemovePluginGUI();
107 };
108
109 class AWindowRemovePlugin : public BC_DialogThread {
110 public:
111         AWindow *awindow;
112         PluginServer *plugin;
113         BC_Window* new_gui();
114         void handle_close_event(int result);
115         int remove_plugin(PluginServer *plugin, ArrayList<BC_ListBoxItem*> &folder);
116
117         AWindowRemovePlugin(AWindow *awindow, PluginServer *plugin);
118         ~AWindowRemovePlugin();
119 };
120
121 class AWindowGUI : public BC_Window
122 {
123 public:
124         AWindowGUI(MWindow *mwindow, AWindow *awindow);
125         ~AWindowGUI();
126
127         void create_objects();
128         int resize_event(int w, int h);
129         int translation_event();
130         int close_event();
131         int keypress_event();
132         void update_assets();
133         void update_effects();
134         void sort_assets();
135         void reposition_objects();
136         int current_folder_number();
137 // Call back for MWindow entry point
138         int drag_motion();
139         int drag_stop();
140 // Collect items into the drag vectors of MainSession
141         void collect_assets();
142         void create_persistent_folder(ArrayList<BC_ListBoxItem*> *output, 
143                 int do_audio, 
144                 int do_video, 
145                 int is_realtime, 
146                 int is_transition);
147         void copy_picons(ArrayList<BC_ListBoxItem*> *dst, 
148                 ArrayList<BC_ListBoxItem*> *src, 
149                 char *folder);
150         void sort_picons(ArrayList<BC_ListBoxItem*> *src, 
151                 char *folder);
152 // Return the selected asset in asset_list
153         Indexable* selected_asset();
154         PluginServer* selected_plugin();
155         AssetPicon* selected_folder();
156         bool protected_pixmap(BC_Pixmap *pixmap);
157         int save_defaults(BC_Hash *defaults);
158         int load_defaults(BC_Hash *defaults);
159
160         MWindow *mwindow;
161         AWindow *awindow;
162
163         AWindowAssets *asset_list;
164         AWindowFolders *folder_list;
165         AWindowDivider *divider;
166
167 // Store data to speed up responses
168 // Persistant data for listboxes
169 // All assets in current EDL
170         ArrayList<BC_ListBoxItem*> assets;
171         ArrayList<BC_ListBoxItem*> folders;
172         ArrayList<BC_ListBoxItem*> aeffects;
173         ArrayList<BC_ListBoxItem*> veffects;
174         ArrayList<BC_ListBoxItem*> atransitions;
175         ArrayList<BC_ListBoxItem*> vtransitions;
176
177 // Currently displayed data for listboxes
178 // Currently displayed assets + comments
179         ArrayList<BC_ListBoxItem*> displayed_assets[2];
180
181         const char *asset_titles[ASSET_COLUMNS];
182
183         BC_Hash *defaults;
184 // Persistent icons
185         BC_Pixmap *folder_icon;
186         BC_Pixmap *file_icon;
187         BC_Pixmap *audio_icon;
188         BC_Pixmap *video_icon;
189         BC_Pixmap *clip_icon;         VFrame *clip_vframe;
190         BC_Pixmap *atransition_icon;  VFrame *atransition_vframe;
191         BC_Pixmap *vtransition_icon;  VFrame *vtransition_vframe;
192         BC_Pixmap *aeffect_icon;      VFrame *aeffect_vframe;
193         BC_Pixmap *ladspa_icon;       VFrame *ladspa_vframe;
194         BC_Pixmap *ff_aud_icon;       VFrame *ff_aud_vframe;
195         BC_Pixmap *ff_vid_icon;       VFrame *ff_vid_vframe;
196         BC_Pixmap *veffect_icon;      VFrame *veffect_vframe;
197         NewFolderThread *newfolder_thread;
198
199 // Popup menus
200         AssetPopup *asset_menu;
201         AssetListMenu *assetlist_menu;
202         FolderListMenu *folderlist_menu;
203         AddTools *add_tools;
204 // Temporary for reading picons from files
205         VFrame *temp_picon;
206
207         int64_t plugin_visibility;
208         AWindowRemovePlugin *remove_plugin;
209 private:
210         void update_folder_list();
211         void update_asset_list();
212         void filter_displayed_assets();
213 };
214
215 class AWindowAssets : public BC_ListBox
216 {
217 public:
218         AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
219         ~AWindowAssets();
220         
221         int handle_event();
222         int selection_changed();
223         void draw_background();
224         int drag_start_event();
225         int drag_motion_event();
226         int drag_stop_event();
227         int button_press_event();
228         int column_resize_event();
229
230         MWindow *mwindow;
231         AWindowGUI *gui;
232 };
233
234 class AWindowDivider : public BC_SubWindow
235 {
236 public:
237         AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
238         ~AWindowDivider();
239
240         int button_press_event();
241         int cursor_motion_event();
242         int button_release_event();
243
244         MWindow *mwindow;
245         AWindowGUI *gui;
246 };
247
248 class AWindowFolders : public BC_ListBox
249 {
250 public:
251         AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
252         ~AWindowFolders();
253         
254         int selection_changed();
255         int button_press_event();
256
257         MWindow *mwindow;
258         AWindowGUI *gui;
259 };
260
261 class AWindowNewFolder : public BC_Button
262 {
263 public:
264         AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
265         int handle_event();
266         MWindow *mwindow;
267         AWindowGUI *gui;
268         int x, y;
269 };
270
271 class AWindowDeleteFolder : public BC_Button
272 {
273 public:
274         AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
275         int handle_event();
276         MWindow *mwindow;
277         AWindowGUI *gui;
278         int x, y;
279 };
280
281 class AWindowRenameFolder : public BC_Button
282 {
283 public:
284         AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
285         int handle_event();
286         MWindow *mwindow;
287         AWindowGUI *gui;
288         int x, y;
289 };
290
291 class AWindowDeleteDisk : public BC_Button
292 {
293 public:
294         AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y);
295         int handle_event();
296         MWindow *mwindow;
297         AWindowGUI *gui;
298         int x, y;
299 };
300
301 class AWindowDeleteProject : public BC_Button
302 {
303 public:
304         AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y);
305         int handle_event();
306         MWindow *mwindow;
307         AWindowGUI *gui;
308         int x, y;
309 };
310
311 class AWindowInfo : public BC_Button
312 {
313 public:
314         AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y);
315         int handle_event();
316         MWindow *mwindow;
317         AWindowGUI *gui;
318         int x, y;
319 };
320
321 class AWindowRedrawIndex : public BC_Button
322 {
323 public:
324         AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y);
325         int handle_event();
326         MWindow *mwindow;
327         AWindowGUI *gui;
328         int x, y;
329 };
330
331 class AWindowPaste : public BC_Button
332 {
333 public:
334         AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y);
335         int handle_event();
336         MWindow *mwindow;
337         AWindowGUI *gui;
338         int x, y;
339 };
340
341 class AWindowAppend : public BC_Button
342 {
343 public:
344         AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y);
345         int handle_event();
346         MWindow *mwindow;
347         AWindowGUI *gui;
348         int x, y;
349 };
350
351 class AWindowView : public BC_Button
352 {
353 public:
354         AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y);
355         int handle_event();
356         MWindow *mwindow;
357         AWindowGUI *gui;
358         int x, y;
359 };
360
361 class AddTools : public BC_MenuBar
362 {
363 public:
364         AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w);
365         void create_objects();
366
367         MWindow *mwindow;
368         AWindowGUI *gui;
369         AddPluginsMenu *add_plugins;
370 };
371
372 class AddPluginsMenu : public BC_Menu
373 {
374 public:
375         AddPluginsMenu(MWindow *mwindow, AWindowGUI *gui);
376         void create_objects();
377
378         MWindow *mwindow;
379         AWindowGUI *gui;
380 };
381
382 class AddPluginItem : public BC_MenuItem
383 {
384 public:
385         AddPluginItem(AddPluginsMenu *menu, const char *text, int idx);
386         int handle_event();
387
388         AddPluginsMenu *menu;
389         int idx;
390 };
391
392 #endif