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();
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);
249 static const char *folder_names[];
252 void update_folder_list();
253 void update_asset_list();
254 void filter_displayed_assets();
255 Atom UpdateAssetsXAtom;
256 void update_assets();
260 class AWindowAssets : public BC_ListBox
263 AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
267 int selection_changed();
268 void draw_background();
269 int drag_start_event();
270 int drag_motion_event();
271 int drag_stop_event();
272 int button_press_event();
273 int column_resize_event();
274 int focus_in_event();
275 int focus_out_event();
281 class AWindowDivider : public BC_SubWindow
284 AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
287 int button_press_event();
288 int cursor_motion_event();
289 int button_release_event();
295 class AWindowFolders : public BC_ListBox
298 AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
301 int selection_changed();
302 int button_press_event();
308 class AWindowNewFolder : public BC_Button
311 AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
318 class AWindowDeleteFolder : public BC_Button
321 AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
328 class AWindowRenameFolder : public BC_Button
331 AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
338 class AWindowDeleteDisk : public BC_Button
341 AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y);
348 class AWindowDeleteProject : public BC_Button
351 AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y);
358 class AWindowInfo : public BC_Button
361 AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y);
368 class AWindowRedrawIndex : public BC_Button
371 AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y);
378 class AWindowPaste : public BC_Button
381 AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y);
388 class AWindowAppend : public BC_Button
391 AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y);
398 class AWindowView : public BC_Button
401 AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y);
408 class LabelPopup : public BC_PopupMenu
411 LabelPopup(MWindow *mwindow, AWindowGUI *gui);
414 void create_objects();
415 // Set mainsession with the current selections
421 LabelPopupEdit *editlabel;
424 class LabelPopupEdit : public BC_MenuItem
427 LabelPopupEdit(MWindow *mwindow, LabelPopup *popup);
436 class AddTools : public BC_PopupMenu
439 AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, const char *title);
440 void create_objects();
444 AddPluginsMenu *add_plugins;
447 class AddPluginItem : public BC_MenuItem
450 AddPluginItem(AddTools *menu, const char *text, int idx);
457 class AVIconDrawing : public BC_Toggle
463 static void calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh);
465 AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images);