4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
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.
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.
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
25 #include "arraylist.h"
27 #include "assetpopup.inc"
30 #include "audiodevice.inc"
31 #include "awindow.inc"
32 #include "awindowgui.inc"
33 #include "clippopup.inc"
35 #include "effectlist.inc"
36 #include "folderlistmenu.inc"
38 #include "labeledit.inc"
39 #include "labelpopup.inc"
41 #include "indexable.inc"
42 #include "mwindow.inc"
43 #include "newfolder.inc"
44 #include "pluginserver.inc"
47 class AssetPicon : public BC_ListBoxItem
50 AssetPicon(MWindow *mwindow, AWindowGUI *gui, Indexable *indexable);
51 AssetPicon(MWindow *mwindow, AWindowGUI *gui, EDL *edl);
52 AssetPicon(MWindow *mwindow, AWindowGUI *gui, PluginServer *plugin);
53 AssetPicon(MWindow *mwindow, AWindowGUI *gui, Label *plugin);
54 AssetPicon(MWindow *mwindow, AWindowGUI *gui, int folder, int persist);
55 virtual ~AssetPicon();
57 void create_objects();
59 static void draw_hue_bar(VFrame *frame, double t);
60 static void draw_wave(VFrame *frame, double *dp, int len,
61 int base_color, int line_color);
68 // ID of thing pointed to
71 // Check ID first. Update these next before dereferencing
86 typedef int16_t vicon_audio_t;
88 class AssetVIconAudio : public Thread
91 AssetVIconAudio(AWindowGUI *gui);
95 void start(AssetVIcon *vicon);
105 class AssetVIcon : public VIcon {
112 int64_t set_seq_no(int64_t no);
119 AssetVIcon(AssetPicon *picon, int w, int h, double framerate, int64_t length);
123 class AWindowRemovePlugin;
125 class AWindowRemovePluginGUI : public BC_Window {
128 AWindowRemovePlugin *thread;
129 PluginServer *plugin;
130 ArrayList<BC_ListBoxItem*> plugin_list;
135 void create_objects();
137 AWindowRemovePluginGUI(AWindow *awindow, AWindowRemovePlugin *thread,
138 int x, int y, PluginServer *plugin);
139 ~AWindowRemovePluginGUI();
142 class AWindowRemovePlugin : public BC_DialogThread {
145 PluginServer *plugin;
146 BC_Window* new_gui();
147 void handle_close_event(int result);
148 int remove_plugin(PluginServer *plugin, ArrayList<BC_ListBoxItem*> &folder);
150 AWindowRemovePlugin(AWindow *awindow, PluginServer *plugin);
151 ~AWindowRemovePlugin();
154 class AWindowGUI : public BC_Window
157 AWindowGUI(MWindow *mwindow, AWindow *awindow);
160 void create_objects();
161 int resize_event(int w, int h);
162 int translation_event();
164 int keypress_event();
165 void async_update_assets(); // Sends update asset event
166 void update_effects();
167 void sort_assets(int use_mtime);
169 void reposition_objects();
170 static int folder_number(const char *name);
171 // Call back for MWindow entry point
174 // Collect items into the drag vectors of MainSession
175 void collect_assets();
176 void create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
181 void create_label_folder();
182 void copy_picons(ArrayList<BC_ListBoxItem*> *dst,
183 ArrayList<BC_ListBoxItem*> *src, int folder);
184 void sort_picons(ArrayList<BC_ListBoxItem*> *src, int use_mtime=0);
185 // Return the selected asset in asset_list
186 Indexable* selected_asset();
187 PluginServer* selected_plugin();
188 AssetPicon* selected_folder();
189 bool protected_pixmap(BC_Pixmap *pixmap);
190 int save_defaults(BC_Hash *defaults);
191 int load_defaults(BC_Hash *defaults);
192 void start_vicon_drawing();
193 void stop_vicon_drawing();
194 void update_picon(Indexable *indexable);
196 VFrame *get_picon(const char *name, const char *plugin_icons);
197 VFrame *get_picon(const char *name);
198 void resource_icon(VFrame *&vfrm, BC_Pixmap *&icon, const char *fn, int idx);
199 void theme_icon(VFrame *&vfrm, BC_Pixmap *&icon, const char *fn);
200 void plugin_icon(VFrame *&vfrm, BC_Pixmap *&icon, const char *fn, unsigned char *png);
205 AWindowAssets *asset_list;
206 AWindowFolders *folder_list;
207 AWindowDivider *divider;
208 AWindowSearchText *search_text;
210 // Store data to speed up responses
211 // Persistant data for listboxes
212 // All assets in current EDL
213 ArrayList<BC_ListBoxItem*> assets;
214 ArrayList<BC_ListBoxItem*> folders;
215 ArrayList<BC_ListBoxItem*> aeffects;
216 ArrayList<BC_ListBoxItem*> veffects;
217 ArrayList<BC_ListBoxItem*> atransitions;
218 ArrayList<BC_ListBoxItem*> vtransitions;
219 ArrayList<BC_ListBoxItem*> labellist;
221 // Currently displayed data for listboxes
222 // Currently displayed assets + comments
223 ArrayList<BC_ListBoxItem*> displayed_assets[2];
224 const char *asset_titles[ASSET_COLUMNS];
225 int displayed_folder;
229 BC_Pixmap *aeffect_folder_icon; VFrame *aeffect_folder_vframe;
230 BC_Pixmap *atransition_folder_icon; VFrame *atransition_folder_vframe;
231 BC_Pixmap *clip_folder_icon; VFrame *clip_folder_vframe;
232 BC_Pixmap *label_folder_icon; VFrame *label_folder_vframe;
233 BC_Pixmap *media_folder_icon; VFrame *media_folder_vframe;
234 BC_Pixmap *proxy_folder_icon; VFrame *proxy_folder_vframe;
235 BC_Pixmap *veffect_folder_icon; VFrame *veffect_folder_vframe;
236 BC_Pixmap *vtransition_folder_icon; VFrame *vtransition_folder_vframe;
237 BC_Pixmap *folder_icons[AWINDOW_FOLDERS];
239 BC_Pixmap *folder_icon; VFrame *folder_vframe;
240 BC_Pixmap *file_icon; VFrame *file_vframe;
241 BC_Pixmap *audio_icon; VFrame *audio_vframe;
242 BC_Pixmap *video_icon; VFrame *video_vframe;
243 BC_Pixmap *label_icon; VFrame *label_vframe;
244 BC_Pixmap *clip_icon; VFrame *clip_vframe;
245 BC_Pixmap *atransition_icon; VFrame *atransition_vframe;
246 BC_Pixmap *vtransition_icon; VFrame *vtransition_vframe;
247 BC_Pixmap *aeffect_icon; VFrame *aeffect_vframe;
248 BC_Pixmap *veffect_icon; VFrame *veffect_vframe;
249 BC_Pixmap *ladspa_icon; VFrame *ladspa_vframe;
250 BC_Pixmap *ff_aud_icon; VFrame *ff_aud_vframe;
251 BC_Pixmap *ff_vid_icon; VFrame *ff_vid_vframe;
253 NewFolderThread *newfolder_thread;
256 AssetPopup *asset_menu;
257 ClipPopup *clip_menu;
258 LabelPopup *label_menu;
259 EffectListMenu *effectlist_menu;
260 AssetListMenu *assetlist_menu;
261 ClipListMenu *cliplist_menu;
262 LabelListMenu *labellist_menu;
263 FolderListMenu *folderlist_menu;
265 // Temporary for reading picons from files
267 VIconThread *vicon_thread;
268 AssetVIconAudio *vicon_audio;
270 int64_t plugin_visibility;
271 AWindowRemovePlugin *remove_plugin;
273 AVIconDrawing *avicon_drawing;
274 int avicon_w, avicon_h, vicon_drawing;
275 int allow_iconlisting;
277 // Create custom atoms to be used for async messages between windows
278 int create_custom_xatoms();
279 // Function to overload to recieve customly defined atoms
280 virtual int recieve_custom_xatoms(xatom_event *event);
281 static const char *folder_names[];
284 void update_folder_list();
285 void update_asset_list();
286 void filter_displayed_assets();
287 Atom UpdateAssetsXAtom;
288 void update_assets();
292 class AWindowAssets : public BC_ListBox
295 AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
299 int selection_changed();
300 void draw_background();
301 int drag_start_event();
302 int drag_motion_event();
303 int drag_stop_event();
304 int button_press_event();
305 int column_resize_event();
306 int focus_in_event();
307 int focus_out_event();
313 class AWindowDivider : public BC_SubWindow
316 AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
319 int button_press_event();
320 int cursor_motion_event();
321 int button_release_event();
327 class AWindowFolders : public BC_ListBox
330 AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
333 int selection_changed();
334 int button_press_event();
340 class AWindowSearchTextBox : public BC_TextBox
343 AWindowSearchTextBox(AWindowSearchText *search_text, int x, int y, int w);
346 AWindowSearchText *search_text;
349 class AWindowSearchText
352 AWindowSearchText(MWindow *mwindow, AWindowGUI *gui, int x, int y);
355 void create_objects();
358 void reposition_window(int x, int y, int w);
359 const char *get_text();
365 BC_Title *text_title;
366 BC_TextBox *text_box;
369 class AWindowNewFolder : public BC_Button
372 AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
379 class AWindowDeleteFolder : public BC_Button
382 AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
389 class AWindowRenameFolder : public BC_Button
392 AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
399 class AWindowDeleteDisk : public BC_Button
402 AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y);
409 class AWindowDeleteProject : public BC_Button
412 AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y);
419 class AWindowInfo : public BC_Button
422 AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y);
429 class AWindowRedrawIndex : public BC_Button
432 AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y);
439 class AWindowPaste : public BC_Button
442 AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y);
449 class AWindowAppend : public BC_Button
452 AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y);
459 class AWindowView : public BC_Button
462 AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y);
469 class AddTools : public BC_PopupMenu
472 AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, const char *title);
473 void create_objects();
479 class AddPluginItem : public BC_MenuItem
482 AddPluginItem(AddTools *menu, const char *text, int idx);
489 class AVIconDrawing : public BC_Toggle
495 static void calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh);
497 AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images);
502 class AWindowListFormat : public BC_MenuItem
505 AWindowListFormat(MWindow *mwindow, AWindowGUI *gui);
514 class AWindowListSort : public BC_MenuItem
517 AWindowListSort(MWindow *mwindow, AWindowGUI *gui);