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 "awindowmenu.inc"
35 #include "indexable.inc"
36 #include "mwindow.inc"
37 #include "newfolder.inc"
38 #include "pluginserver.inc"
43 class AWindowNewFolder;
44 class AWindowDeleteFolder;
45 class AWindowRenameFolder;
46 class AWindowDeleteDisk;
47 class AWindowDeleteProject;
50 class AWindowRedrawIndex;
65 class AssetPicon : public BC_ListBoxItem
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();
76 void create_objects();
84 // ID of thing pointed to
87 // Check ID first. Update these next before dereferencing
102 class AssetVIcon : public VIcon {
109 int64_t set_seq_no(int64_t no);
113 AssetVIcon(AssetPicon *picon, int w, int h, double framerate, int64_t length);
117 class AWindowRemovePlugin;
119 class AWindowRemovePluginGUI : public BC_Window {
122 AWindowRemovePlugin *thread;
123 PluginServer *plugin;
124 ArrayList<BC_ListBoxItem*> plugin_list;
129 void create_objects();
131 AWindowRemovePluginGUI(AWindow *awindow, AWindowRemovePlugin *thread,
132 int x, int y, PluginServer *plugin);
133 ~AWindowRemovePluginGUI();
136 class AWindowRemovePlugin : public BC_DialogThread {
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);
144 AWindowRemovePlugin(AWindow *awindow, PluginServer *plugin);
145 ~AWindowRemovePlugin();
148 class AWindowGUI : public BC_Window
151 AWindowGUI(MWindow *mwindow, AWindow *awindow);
154 void create_objects();
155 int resize_event(int w, int h);
156 int translation_event();
158 int keypress_event();
159 void async_update_assets(); // Sends update asset event
160 void update_effects();
162 void reposition_objects();
163 static int folder_number(const char *name);
164 // Call back for MWindow entry point
167 // Collect items into the drag vectors of MainSession
168 void collect_assets();
169 void create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
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 void update_picon(Indexable *indexable);
192 AWindowAssets *asset_list;
193 AWindowFolders *folder_list;
194 AWindowDivider *divider;
196 // Store data to speed up responses
197 // Persistant data for listboxes
198 // All assets in current EDL
199 ArrayList<BC_ListBoxItem*> assets;
200 ArrayList<BC_ListBoxItem*> folders;
201 ArrayList<BC_ListBoxItem*> aeffects;
202 ArrayList<BC_ListBoxItem*> veffects;
203 ArrayList<BC_ListBoxItem*> atransitions;
204 ArrayList<BC_ListBoxItem*> vtransitions;
205 ArrayList<BC_ListBoxItem*> labellist;
207 // Currently displayed data for listboxes
208 // Currently displayed assets + comments
209 ArrayList<BC_ListBoxItem*> displayed_assets[2];
211 const char *asset_titles[ASSET_COLUMNS];
215 BC_Pixmap *folder_icon;
216 BC_Pixmap *file_icon;
217 BC_Pixmap *audio_icon;
218 BC_Pixmap *video_icon;
219 BC_Pixmap *clip_icon; VFrame *clip_vframe;
220 BC_Pixmap *atransition_icon; VFrame *atransition_vframe;
221 BC_Pixmap *vtransition_icon; VFrame *vtransition_vframe;
222 BC_Pixmap *aeffect_icon; VFrame *aeffect_vframe;
223 BC_Pixmap *ladspa_icon; VFrame *ladspa_vframe;
224 BC_Pixmap *ff_aud_icon; VFrame *ff_aud_vframe;
225 BC_Pixmap *ff_vid_icon; VFrame *ff_vid_vframe;
226 BC_Pixmap *veffect_icon; VFrame *veffect_vframe;
227 NewFolderThread *newfolder_thread;
230 AssetPopup *asset_menu;
231 LabelPopup *label_menu;
232 AssetListMenu *assetlist_menu;
233 FolderListMenu *folderlist_menu;
235 // Temporary for reading picons from files
237 VIconThread *vicon_thread;
239 int64_t plugin_visibility;
240 AWindowRemovePlugin *remove_plugin;
242 AVIconDrawing *avicon_drawing;
243 int avicon_w, avicon_h, vicon_drawing;
244 int allow_iconlisting;
246 // Create custom atoms to be used for async messages between windows
247 int create_custom_xatoms();
248 // Function to overload to recieve customly defined atoms
249 virtual int recieve_custom_xatoms(xatom_event *event);
250 static const char *folder_names[];
253 void update_folder_list();
254 void update_asset_list();
255 void filter_displayed_assets();
256 Atom UpdateAssetsXAtom;
257 void update_assets();
261 class AWindowAssets : public BC_ListBox
264 AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
268 int selection_changed();
269 void draw_background();
270 int drag_start_event();
271 int drag_motion_event();
272 int drag_stop_event();
273 int button_press_event();
274 int column_resize_event();
275 int focus_in_event();
276 int focus_out_event();
282 class AWindowDivider : public BC_SubWindow
285 AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
288 int button_press_event();
289 int cursor_motion_event();
290 int button_release_event();
296 class AWindowFolders : public BC_ListBox
299 AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
302 int selection_changed();
303 int button_press_event();
309 class AWindowNewFolder : public BC_Button
312 AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
319 class AWindowDeleteFolder : public BC_Button
322 AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
329 class AWindowRenameFolder : public BC_Button
332 AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
339 class AWindowDeleteDisk : public BC_Button
342 AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y);
349 class AWindowDeleteProject : public BC_Button
352 AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y);
359 class AWindowInfo : public BC_Button
362 AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y);
369 class AWindowRedrawIndex : public BC_Button
372 AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y);
379 class AWindowPaste : public BC_Button
382 AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y);
389 class AWindowAppend : public BC_Button
392 AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y);
399 class AWindowView : public BC_Button
402 AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y);
409 class LabelPopup : public BC_PopupMenu
412 LabelPopup(MWindow *mwindow, AWindowGUI *gui);
415 void create_objects();
416 // Set mainsession with the current selections
422 LabelPopupEdit *editlabel;
425 class LabelPopupEdit : public BC_MenuItem
428 LabelPopupEdit(MWindow *mwindow, LabelPopup *popup);
437 class AddTools : public BC_PopupMenu
440 AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, const char *title);
441 void create_objects();
445 AddPluginsMenu *add_plugins;
448 class AddPluginItem : public BC_MenuItem
451 AddPluginItem(AddTools *menu, const char *text, int idx);
458 class AVIconDrawing : public BC_Toggle
464 static void calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh);
466 AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images);