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 "awindow.inc"
31 #include "awindowgui.inc"
32 #include "clippopup.inc"
34 #include "effectlist.inc"
35 #include "folderlistmenu.inc"
37 #include "labeledit.inc"
38 #include "labelpopup.inc"
40 #include "indexable.inc"
41 #include "mwindow.inc"
42 #include "newfolder.inc"
43 #include "pluginserver.inc"
46 class AssetPicon : public BC_ListBoxItem
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, int persist);
54 virtual ~AssetPicon();
56 void create_objects();
58 void draw_wave(VFrame *frame, double *dp, int len,
59 int base_color, int line_color);
66 // ID of thing pointed to
69 // Check ID first. Update these next before dereferencing
84 class AssetVIcon : public VIcon {
91 int64_t set_seq_no(int64_t no);
95 AssetVIcon(AssetPicon *picon, int w, int h, double framerate, int64_t length);
99 class AWindowRemovePlugin;
101 class AWindowRemovePluginGUI : public BC_Window {
104 AWindowRemovePlugin *thread;
105 PluginServer *plugin;
106 ArrayList<BC_ListBoxItem*> plugin_list;
111 void create_objects();
113 AWindowRemovePluginGUI(AWindow *awindow, AWindowRemovePlugin *thread,
114 int x, int y, PluginServer *plugin);
115 ~AWindowRemovePluginGUI();
118 class AWindowRemovePlugin : public BC_DialogThread {
121 PluginServer *plugin;
122 BC_Window* new_gui();
123 void handle_close_event(int result);
124 int remove_plugin(PluginServer *plugin, ArrayList<BC_ListBoxItem*> &folder);
126 AWindowRemovePlugin(AWindow *awindow, PluginServer *plugin);
127 ~AWindowRemovePlugin();
130 class AWindowGUI : public BC_Window
133 AWindowGUI(MWindow *mwindow, AWindow *awindow);
136 void create_objects();
137 int resize_event(int w, int h);
138 int translation_event();
140 int keypress_event();
141 void async_update_assets(); // Sends update asset event
142 void update_effects();
143 void sort_assets(int use_mtime);
145 void reposition_objects();
146 static int folder_number(const char *name);
147 // Call back for MWindow entry point
150 // Collect items into the drag vectors of MainSession
151 void collect_assets();
152 void create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
157 void create_label_folder();
158 void copy_picons(ArrayList<BC_ListBoxItem*> *dst,
159 ArrayList<BC_ListBoxItem*> *src, int folder);
160 void sort_picons(ArrayList<BC_ListBoxItem*> *src, int use_mtime=0);
161 // Return the selected asset in asset_list
162 Indexable* selected_asset();
163 PluginServer* selected_plugin();
164 AssetPicon* selected_folder();
165 bool protected_pixmap(BC_Pixmap *pixmap);
166 int save_defaults(BC_Hash *defaults);
167 int load_defaults(BC_Hash *defaults);
168 void start_vicon_drawing();
169 void stop_vicon_drawing();
170 void update_picon(Indexable *indexable);
172 VFrame *get_picon(const char *name, const char *plugin_icons);
173 VFrame *get_picon(const char *name);
174 void resource_icon(VFrame *&vfrm, BC_Pixmap *&icon, const char *fn, int idx);
175 void theme_icon(VFrame *&vfrm, BC_Pixmap *&icon, const char *fn);
176 void plugin_icon(VFrame *&vfrm, BC_Pixmap *&icon, const char *fn, unsigned char *png);
181 AWindowAssets *asset_list;
182 AWindowFolders *folder_list;
183 AWindowDivider *divider;
184 AWindowSearchText *search_text;
186 // Store data to speed up responses
187 // Persistant data for listboxes
188 // All assets in current EDL
189 ArrayList<BC_ListBoxItem*> assets;
190 ArrayList<BC_ListBoxItem*> folders;
191 ArrayList<BC_ListBoxItem*> aeffects;
192 ArrayList<BC_ListBoxItem*> veffects;
193 ArrayList<BC_ListBoxItem*> atransitions;
194 ArrayList<BC_ListBoxItem*> vtransitions;
195 ArrayList<BC_ListBoxItem*> labellist;
197 // Currently displayed data for listboxes
198 // Currently displayed assets + comments
199 ArrayList<BC_ListBoxItem*> displayed_assets[2];
200 const char *asset_titles[ASSET_COLUMNS];
201 int displayed_folder;
205 BC_Pixmap *aeffect_folder_icon; VFrame *aeffect_folder_vframe;
206 BC_Pixmap *atransition_folder_icon; VFrame *atransition_folder_vframe;
207 BC_Pixmap *clip_folder_icon; VFrame *clip_folder_vframe;
208 BC_Pixmap *label_folder_icon; VFrame *label_folder_vframe;
209 BC_Pixmap *media_folder_icon; VFrame *media_folder_vframe;
210 BC_Pixmap *proxy_folder_icon; VFrame *proxy_folder_vframe;
211 BC_Pixmap *veffect_folder_icon; VFrame *veffect_folder_vframe;
212 BC_Pixmap *vtransition_folder_icon; VFrame *vtransition_folder_vframe;
213 BC_Pixmap *folder_icons[AWINDOW_FOLDERS];
215 BC_Pixmap *folder_icon; VFrame *folder_vframe;
216 BC_Pixmap *file_icon; VFrame *file_vframe;
217 BC_Pixmap *audio_icon; VFrame *audio_vframe;
218 BC_Pixmap *video_icon; VFrame *video_vframe;
219 BC_Pixmap *label_icon; VFrame *label_vframe;
220 BC_Pixmap *clip_icon; VFrame *clip_vframe;
221 BC_Pixmap *atransition_icon; VFrame *atransition_vframe;
222 BC_Pixmap *vtransition_icon; VFrame *vtransition_vframe;
223 BC_Pixmap *aeffect_icon; VFrame *aeffect_vframe;
224 BC_Pixmap *veffect_icon; VFrame *veffect_vframe;
225 BC_Pixmap *ladspa_icon; VFrame *ladspa_vframe;
226 BC_Pixmap *ff_aud_icon; VFrame *ff_aud_vframe;
227 BC_Pixmap *ff_vid_icon; VFrame *ff_vid_vframe;
229 NewFolderThread *newfolder_thread;
232 AssetPopup *asset_menu;
233 ClipPopup *clip_menu;
234 LabelPopup *label_menu;
235 EffectListMenu *effectlist_menu;
236 AssetListMenu *assetlist_menu;
237 ClipListMenu *cliplist_menu;
238 LabelListMenu *labellist_menu;
239 FolderListMenu *folderlist_menu;
241 // Temporary for reading picons from files
243 VIconThread *vicon_thread;
245 int64_t plugin_visibility;
246 AWindowRemovePlugin *remove_plugin;
248 AVIconDrawing *avicon_drawing;
249 int avicon_w, avicon_h, vicon_drawing;
250 int allow_iconlisting;
252 // Create custom atoms to be used for async messages between windows
253 int create_custom_xatoms();
254 // Function to overload to recieve customly defined atoms
255 virtual int recieve_custom_xatoms(xatom_event *event);
256 static const char *folder_names[];
259 void update_folder_list();
260 void update_asset_list();
261 void filter_displayed_assets();
262 Atom UpdateAssetsXAtom;
263 void update_assets();
267 class AWindowAssets : public BC_ListBox
270 AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
274 int selection_changed();
275 void draw_background();
276 int drag_start_event();
277 int drag_motion_event();
278 int drag_stop_event();
279 int button_press_event();
280 int column_resize_event();
281 int focus_in_event();
282 int focus_out_event();
288 class AWindowDivider : public BC_SubWindow
291 AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
294 int button_press_event();
295 int cursor_motion_event();
296 int button_release_event();
302 class AWindowFolders : public BC_ListBox
305 AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
308 int selection_changed();
309 int button_press_event();
315 class AWindowSearchTextBox : public BC_TextBox
318 AWindowSearchTextBox(AWindowSearchText *search_text, int x, int y, int w);
321 AWindowSearchText *search_text;
324 class AWindowSearchText
327 AWindowSearchText(MWindow *mwindow, AWindowGUI *gui, int x, int y);
330 void create_objects();
333 void reposition_window(int x, int y, int w);
334 const char *get_text();
340 BC_Title *text_title;
341 BC_TextBox *text_box;
344 class AWindowNewFolder : public BC_Button
347 AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
354 class AWindowDeleteFolder : public BC_Button
357 AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
364 class AWindowRenameFolder : public BC_Button
367 AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
374 class AWindowDeleteDisk : public BC_Button
377 AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y);
384 class AWindowDeleteProject : public BC_Button
387 AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y);
394 class AWindowInfo : public BC_Button
397 AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y);
404 class AWindowRedrawIndex : public BC_Button
407 AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y);
414 class AWindowPaste : public BC_Button
417 AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y);
424 class AWindowAppend : public BC_Button
427 AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y);
434 class AWindowView : public BC_Button
437 AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y);
444 class AddTools : public BC_PopupMenu
447 AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, const char *title);
448 void create_objects();
454 class AddPluginItem : public BC_MenuItem
457 AddPluginItem(AddTools *menu, const char *text, int idx);
464 class AVIconDrawing : public BC_Toggle
470 static void calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh);
472 AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images);
477 class AWindowListFormat : public BC_MenuItem
480 AWindowListFormat(MWindow *mwindow, AWindowGUI *gui);
489 class AWindowListSort : public BC_MenuItem
492 AWindowListSort(MWindow *mwindow, AWindowGUI *gui);