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"
34 #include "indexable.inc"
35 #include "mwindow.inc"
36 #include "newfolder.inc"
37 #include "pluginserver.inc"
42 class AWindowNewFolder;
43 class AWindowDeleteFolder;
44 class AWindowRenameFolder;
45 class AWindowDeleteDisk;
46 class AWindowDeleteProject;
49 class AWindowRedrawIndex;
62 class AssetPicon : public BC_ListBoxItem
65 AssetPicon(MWindow *mwindow, AWindowGUI *gui, Indexable *indexable);
66 AssetPicon(MWindow *mwindow, AWindowGUI *gui, EDL *edl);
67 AssetPicon(MWindow *mwindow, AWindowGUI *gui, PluginServer *plugin);
68 AssetPicon(MWindow *mwindow, AWindowGUI *gui, const char *folder);
69 virtual ~AssetPicon();
71 void create_objects();
78 // ID of thing pointed to
81 // Check ID first. Update these next before dereferencing
95 class AssetVIcon : public VIcon {
101 int64_t next_frame(int n);
105 AssetVIcon(AssetPicon *picon, int w, int h, double framerate, int64_t length);
109 class AWindowRemovePlugin;
111 class AWindowRemovePluginGUI : public BC_Window {
114 AWindowRemovePlugin *thread;
115 PluginServer *plugin;
116 ArrayList<BC_ListBoxItem*> plugin_list;
121 void create_objects();
123 AWindowRemovePluginGUI(AWindow *awindow, AWindowRemovePlugin *thread,
124 int x, int y, PluginServer *plugin);
125 ~AWindowRemovePluginGUI();
128 class AWindowRemovePlugin : public BC_DialogThread {
131 PluginServer *plugin;
132 BC_Window* new_gui();
133 void handle_close_event(int result);
134 int remove_plugin(PluginServer *plugin, ArrayList<BC_ListBoxItem*> &folder);
136 AWindowRemovePlugin(AWindow *awindow, PluginServer *plugin);
137 ~AWindowRemovePlugin();
140 class AWindowGUI : public BC_Window
143 AWindowGUI(MWindow *mwindow, AWindow *awindow);
146 void create_objects();
147 int resize_event(int w, int h);
148 int translation_event();
150 int keypress_event();
151 void update_assets();
152 void update_effects();
154 void reposition_objects();
155 int current_folder_number();
156 // Call back for MWindow entry point
159 // Collect items into the drag vectors of MainSession
160 void collect_assets();
161 void create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
166 void copy_picons(ArrayList<BC_ListBoxItem*> *dst,
167 ArrayList<BC_ListBoxItem*> *src,
169 void sort_picons(ArrayList<BC_ListBoxItem*> *src,
171 // Return the selected asset in asset_list
172 Indexable* selected_asset();
173 PluginServer* selected_plugin();
174 AssetPicon* selected_folder();
175 bool protected_pixmap(BC_Pixmap *pixmap);
176 int save_defaults(BC_Hash *defaults);
177 int load_defaults(BC_Hash *defaults);
178 void start_vicon_drawing();
179 void stop_vicon_drawing();
184 AWindowAssets *asset_list;
185 AWindowFolders *folder_list;
186 AWindowDivider *divider;
188 // Store data to speed up responses
189 // Persistant data for listboxes
190 // All assets in current EDL
191 ArrayList<BC_ListBoxItem*> assets;
192 ArrayList<BC_ListBoxItem*> folders;
193 ArrayList<BC_ListBoxItem*> aeffects;
194 ArrayList<BC_ListBoxItem*> veffects;
195 ArrayList<BC_ListBoxItem*> atransitions;
196 ArrayList<BC_ListBoxItem*> vtransitions;
198 // Currently displayed data for listboxes
199 // Currently displayed assets + comments
200 ArrayList<BC_ListBoxItem*> displayed_assets[2];
202 const char *asset_titles[ASSET_COLUMNS];
206 BC_Pixmap *folder_icon;
207 BC_Pixmap *file_icon;
208 BC_Pixmap *audio_icon;
209 BC_Pixmap *video_icon;
210 BC_Pixmap *clip_icon; VFrame *clip_vframe;
211 BC_Pixmap *atransition_icon; VFrame *atransition_vframe;
212 BC_Pixmap *vtransition_icon; VFrame *vtransition_vframe;
213 BC_Pixmap *aeffect_icon; VFrame *aeffect_vframe;
214 BC_Pixmap *ladspa_icon; VFrame *ladspa_vframe;
215 BC_Pixmap *ff_aud_icon; VFrame *ff_aud_vframe;
216 BC_Pixmap *ff_vid_icon; VFrame *ff_vid_vframe;
217 BC_Pixmap *veffect_icon; VFrame *veffect_vframe;
218 NewFolderThread *newfolder_thread;
221 AssetPopup *asset_menu;
222 AssetListMenu *assetlist_menu;
223 FolderListMenu *folderlist_menu;
225 // Temporary for reading picons from files
227 VIconThread *vicon_thread;
229 int64_t plugin_visibility;
230 AWindowRemovePlugin *remove_plugin;
232 AVIconDrawing *avicon_drawing;
233 int avicon_w, avicon_h, vicon_drawing;
235 void update_folder_list();
236 void update_asset_list();
237 void filter_displayed_assets();
240 class AWindowAssets : public BC_ListBox
243 AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
247 int selection_changed();
248 void draw_background();
249 int drag_start_event();
250 int drag_motion_event();
251 int drag_stop_event();
252 int button_press_event();
253 int column_resize_event();
254 int cursor_enter_event();
255 int cursor_leave_event();
261 class AWindowDivider : public BC_SubWindow
264 AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
267 int button_press_event();
268 int cursor_motion_event();
269 int button_release_event();
275 class AWindowFolders : public BC_ListBox
278 AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
281 int selection_changed();
282 int button_press_event();
288 class AWindowNewFolder : public BC_Button
291 AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
298 class AWindowDeleteFolder : public BC_Button
301 AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
308 class AWindowRenameFolder : public BC_Button
311 AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
318 class AWindowDeleteDisk : public BC_Button
321 AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y);
328 class AWindowDeleteProject : public BC_Button
331 AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y);
338 class AWindowInfo : public BC_Button
341 AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y);
348 class AWindowRedrawIndex : public BC_Button
351 AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y);
358 class AWindowPaste : public BC_Button
361 AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y);
368 class AWindowAppend : public BC_Button
371 AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y);
378 class AWindowView : public BC_Button
381 AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y);
388 class AddTools : public BC_MenuBar
391 AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w);
392 void create_objects();
396 AddPluginsMenu *add_plugins;
399 class AddPluginsMenu : public BC_Menu
402 AddPluginsMenu(MWindow *mwindow, AWindowGUI *gui);
403 void create_objects();
409 class AddPluginItem : public BC_MenuItem
412 AddPluginItem(AddPluginsMenu *menu, const char *text, int idx);
415 AddPluginsMenu *menu;
419 class AVIconDrawing : public BC_Toggle
425 static void calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh);
427 AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images);