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, const char *folder);
73 virtual ~AssetPicon();
75 void create_objects();
82 // ID of thing pointed to
85 // Check ID first. Update these next before dereferencing
100 class AssetVIcon : public VIcon {
107 int64_t set_seq_no(int64_t no);
111 AssetVIcon(AssetPicon *picon, int w, int h, double framerate, int64_t length);
115 class AWindowRemovePlugin;
117 class AWindowRemovePluginGUI : public BC_Window {
120 AWindowRemovePlugin *thread;
121 PluginServer *plugin;
122 ArrayList<BC_ListBoxItem*> plugin_list;
127 void create_objects();
129 AWindowRemovePluginGUI(AWindow *awindow, AWindowRemovePlugin *thread,
130 int x, int y, PluginServer *plugin);
131 ~AWindowRemovePluginGUI();
134 class AWindowRemovePlugin : public BC_DialogThread {
137 PluginServer *plugin;
138 BC_Window* new_gui();
139 void handle_close_event(int result);
140 int remove_plugin(PluginServer *plugin, ArrayList<BC_ListBoxItem*> &folder);
142 AWindowRemovePlugin(AWindow *awindow, PluginServer *plugin);
143 ~AWindowRemovePlugin();
146 class AWindowGUI : public BC_Window
149 AWindowGUI(MWindow *mwindow, AWindow *awindow);
152 void create_objects();
153 int resize_event(int w, int h);
154 int translation_event();
156 int keypress_event();
157 void async_update_assets(); // Sends update asset event
158 void update_effects();
160 void reposition_objects();
161 int current_folder_number();
162 // Call back for MWindow entry point
165 // Collect items into the drag vectors of MainSession
166 void collect_assets();
167 void create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
172 void create_label_folder();
173 void copy_picons(ArrayList<BC_ListBoxItem*> *dst,
174 ArrayList<BC_ListBoxItem*> *src,
176 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();
191 AWindowAssets *asset_list;
192 AWindowFolders *folder_list;
193 AWindowDivider *divider;
195 // Store data to speed up responses
196 // Persistant data for listboxes
197 // All assets in current EDL
198 ArrayList<BC_ListBoxItem*> assets;
199 ArrayList<BC_ListBoxItem*> folders;
200 ArrayList<BC_ListBoxItem*> aeffects;
201 ArrayList<BC_ListBoxItem*> veffects;
202 ArrayList<BC_ListBoxItem*> atransitions;
203 ArrayList<BC_ListBoxItem*> vtransitions;
204 ArrayList<BC_ListBoxItem*> labellist;
206 // Currently displayed data for listboxes
207 // Currently displayed assets + comments
208 ArrayList<BC_ListBoxItem*> displayed_assets[2];
210 const char *asset_titles[ASSET_COLUMNS];
214 BC_Pixmap *folder_icon;
215 BC_Pixmap *file_icon;
216 BC_Pixmap *audio_icon;
217 BC_Pixmap *video_icon;
218 BC_Pixmap *clip_icon; VFrame *clip_vframe;
219 BC_Pixmap *atransition_icon; VFrame *atransition_vframe;
220 BC_Pixmap *vtransition_icon; VFrame *vtransition_vframe;
221 BC_Pixmap *aeffect_icon; VFrame *aeffect_vframe;
222 BC_Pixmap *ladspa_icon; VFrame *ladspa_vframe;
223 BC_Pixmap *ff_aud_icon; VFrame *ff_aud_vframe;
224 BC_Pixmap *ff_vid_icon; VFrame *ff_vid_vframe;
225 BC_Pixmap *veffect_icon; VFrame *veffect_vframe;
226 NewFolderThread *newfolder_thread;
229 AssetPopup *asset_menu;
230 LabelPopup *label_menu;
231 AssetListMenu *assetlist_menu;
232 FolderListMenu *folderlist_menu;
234 // Temporary for reading picons from files
236 VIconThread *vicon_thread;
238 int64_t plugin_visibility;
239 AWindowRemovePlugin *remove_plugin;
241 AVIconDrawing *avicon_drawing;
242 int avicon_w, avicon_h, vicon_drawing;
243 int allow_iconlisting;
245 // Create custom atoms to be used for async messages between windows
246 int create_custom_xatoms();
247 // Function to overload to recieve customly defined atoms
248 virtual int recieve_custom_xatoms(xatom_event *event);
251 void update_folder_list();
252 void update_asset_list();
253 void filter_displayed_assets();
254 Atom UpdateAssetsXAtom;
255 void update_assets();
259 class AWindowAssets : public BC_ListBox
262 AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
266 int selection_changed();
267 void draw_background();
268 int drag_start_event();
269 int drag_motion_event();
270 int drag_stop_event();
271 int button_press_event();
272 int column_resize_event();
273 int cursor_enter_event();
274 int cursor_leave_event();
280 class AWindowDivider : public BC_SubWindow
283 AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
286 int button_press_event();
287 int cursor_motion_event();
288 int button_release_event();
294 class AWindowFolders : public BC_ListBox
297 AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
300 int selection_changed();
301 int button_press_event();
307 class AWindowNewFolder : public BC_Button
310 AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
317 class AWindowDeleteFolder : public BC_Button
320 AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
327 class AWindowRenameFolder : public BC_Button
330 AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
337 class AWindowDeleteDisk : public BC_Button
340 AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y);
347 class AWindowDeleteProject : public BC_Button
350 AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y);
357 class AWindowInfo : public BC_Button
360 AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y);
367 class AWindowRedrawIndex : public BC_Button
370 AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y);
377 class AWindowPaste : public BC_Button
380 AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y);
387 class AWindowAppend : public BC_Button
390 AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y);
397 class AWindowView : public BC_Button
400 AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y);
407 class LabelPopup : public BC_PopupMenu
410 LabelPopup(MWindow *mwindow, AWindowGUI *gui);
413 void create_objects();
414 // Set mainsession with the current selections
420 LabelPopupEdit *editlabel;
423 class LabelPopupEdit : public BC_MenuItem
426 LabelPopupEdit(MWindow *mwindow, LabelPopup *popup);
435 class AddTools : public BC_PopupMenu
438 AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, const char *title);
439 void create_objects();
443 AddPluginsMenu *add_plugins;
446 class AddPluginItem : public BC_MenuItem
449 AddPluginItem(AddTools *menu, const char *text, int idx);
456 class AVIconDrawing : public BC_Toggle
462 static void calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh);
464 AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images);