allow ffmpeg video to resample curr_pos, add bluray format
[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
158         MWindow *mwindow;
159         AWindow *awindow;
160
161         AWindowAssets *asset_list;
162         AWindowFolders *folder_list;
163         AWindowDivider *divider;
164         uint32_t plugin_visibility;
165
166 // Store data to speed up responses
167 // Persistant data for listboxes
168 // All assets in current EDL
169         ArrayList<BC_ListBoxItem*> assets;
170         ArrayList<BC_ListBoxItem*> folders;
171         ArrayList<BC_ListBoxItem*> aeffects;
172         ArrayList<BC_ListBoxItem*> veffects;
173         ArrayList<BC_ListBoxItem*> atransitions;
174         ArrayList<BC_ListBoxItem*> vtransitions;
175
176 // Currently displayed data for listboxes
177 // Currently displayed assets + comments
178         ArrayList<BC_ListBoxItem*> displayed_assets[2];
179
180         const char *asset_titles[ASSET_COLUMNS];
181
182 // Persistent icons
183         BC_Pixmap *folder_icon;
184         BC_Pixmap *file_icon;
185         BC_Pixmap *audio_icon;
186         BC_Pixmap *video_icon;
187         BC_Pixmap *clip_icon;         VFrame *clip_vframe;
188         BC_Pixmap *atransition_icon;  VFrame *atransition_vframe;
189         BC_Pixmap *vtransition_icon;  VFrame *vtransition_vframe;
190         BC_Pixmap *aeffect_icon;      VFrame *aeffect_vframe;
191         BC_Pixmap *ladspa_icon;       VFrame *ladspa_vframe;
192         BC_Pixmap *veffect_icon;      VFrame *veffect_vframe;
193         NewFolderThread *newfolder_thread;
194
195 // Popup menus
196         AssetPopup *asset_menu;
197         AssetListMenu *assetlist_menu;
198         FolderListMenu *folderlist_menu;
199         AddTools *add_tools;
200 // Temporary for reading picons from files
201         VFrame *temp_picon;
202
203         AWindowRemovePlugin *remove_plugin;
204 private:
205         void update_folder_list();
206         void update_asset_list();
207         void filter_displayed_assets();
208 };
209
210 class AWindowAssets : public BC_ListBox
211 {
212 public:
213         AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
214         ~AWindowAssets();
215         
216         int handle_event();
217         int selection_changed();
218         void draw_background();
219         int drag_start_event();
220         int drag_motion_event();
221         int drag_stop_event();
222         int button_press_event();
223         int column_resize_event();
224
225         MWindow *mwindow;
226         AWindowGUI *gui;
227 };
228
229 class AWindowDivider : public BC_SubWindow
230 {
231 public:
232         AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
233         ~AWindowDivider();
234
235         int button_press_event();
236         int cursor_motion_event();
237         int button_release_event();
238
239         MWindow *mwindow;
240         AWindowGUI *gui;
241 };
242
243 class AWindowFolders : public BC_ListBox
244 {
245 public:
246         AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
247         ~AWindowFolders();
248         
249         int selection_changed();
250         int button_press_event();
251
252         MWindow *mwindow;
253         AWindowGUI *gui;
254 };
255
256 class AWindowNewFolder : public BC_Button
257 {
258 public:
259         AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
260         int handle_event();
261         MWindow *mwindow;
262         AWindowGUI *gui;
263         int x, y;
264 };
265
266 class AWindowDeleteFolder : public BC_Button
267 {
268 public:
269         AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
270         int handle_event();
271         MWindow *mwindow;
272         AWindowGUI *gui;
273         int x, y;
274 };
275
276 class AWindowRenameFolder : public BC_Button
277 {
278 public:
279         AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
280         int handle_event();
281         MWindow *mwindow;
282         AWindowGUI *gui;
283         int x, y;
284 };
285
286 class AWindowDeleteDisk : public BC_Button
287 {
288 public:
289         AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y);
290         int handle_event();
291         MWindow *mwindow;
292         AWindowGUI *gui;
293         int x, y;
294 };
295
296 class AWindowDeleteProject : public BC_Button
297 {
298 public:
299         AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y);
300         int handle_event();
301         MWindow *mwindow;
302         AWindowGUI *gui;
303         int x, y;
304 };
305
306 class AWindowInfo : public BC_Button
307 {
308 public:
309         AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y);
310         int handle_event();
311         MWindow *mwindow;
312         AWindowGUI *gui;
313         int x, y;
314 };
315
316 class AWindowRedrawIndex : public BC_Button
317 {
318 public:
319         AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y);
320         int handle_event();
321         MWindow *mwindow;
322         AWindowGUI *gui;
323         int x, y;
324 };
325
326 class AWindowPaste : public BC_Button
327 {
328 public:
329         AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y);
330         int handle_event();
331         MWindow *mwindow;
332         AWindowGUI *gui;
333         int x, y;
334 };
335
336 class AWindowAppend : public BC_Button
337 {
338 public:
339         AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y);
340         int handle_event();
341         MWindow *mwindow;
342         AWindowGUI *gui;
343         int x, y;
344 };
345
346 class AWindowView : public BC_Button
347 {
348 public:
349         AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y);
350         int handle_event();
351         MWindow *mwindow;
352         AWindowGUI *gui;
353         int x, y;
354 };
355
356 class AddTools : public BC_MenuBar
357 {
358 public:
359         AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w);
360         void create_objects();
361
362         MWindow *mwindow;
363         AWindowGUI *gui;
364         AddPluginsMenu *add_plugins;
365 };
366
367 class AddPluginsMenu : public BC_Menu
368 {
369 public:
370         AddPluginsMenu(MWindow *mwindow, AWindowGUI *gui);
371         void create_objects();
372
373         MWindow *mwindow;
374         AWindowGUI *gui;
375 };
376
377 class AddPluginItem : public BC_MenuItem
378 {
379 public:
380         AddPluginItem(AddPluginsMenu *menu, const char *text, int idx);
381         int handle_event();
382
383         AddPluginsMenu *menu;
384         int idx;
385 };
386
387 #endif