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 "folderlistmenu.inc"
36 #include "labeledit.inc"
37 #include "labelpopup.inc"
39 #include "indexable.inc"
40 #include "mwindow.inc"
41 #include "newfolder.inc"
42 #include "pluginserver.inc"
45 class AssetPicon : public BC_ListBoxItem
48 AssetPicon(MWindow *mwindow, AWindowGUI *gui, Indexable *indexable);
49 AssetPicon(MWindow *mwindow, AWindowGUI *gui, EDL *edl);
50 AssetPicon(MWindow *mwindow, AWindowGUI *gui, PluginServer *plugin);
51 AssetPicon(MWindow *mwindow, AWindowGUI *gui, Label *plugin);
52 AssetPicon(MWindow *mwindow, AWindowGUI *gui, int folder);
53 AssetPicon(MWindow *mwindow, AWindowGUI *gui, const char *folder_name, int folder_num);
54 virtual ~AssetPicon();
56 void create_objects();
64 // ID of thing pointed to
67 // Check ID first. Update these next before dereferencing
82 class AssetVIcon : public VIcon {
89 int64_t set_seq_no(int64_t no);
93 AssetVIcon(AssetPicon *picon, int w, int h, double framerate, int64_t length);
97 class AWindowRemovePlugin;
99 class AWindowRemovePluginGUI : public BC_Window {
102 AWindowRemovePlugin *thread;
103 PluginServer *plugin;
104 ArrayList<BC_ListBoxItem*> plugin_list;
109 void create_objects();
111 AWindowRemovePluginGUI(AWindow *awindow, AWindowRemovePlugin *thread,
112 int x, int y, PluginServer *plugin);
113 ~AWindowRemovePluginGUI();
116 class AWindowRemovePlugin : public BC_DialogThread {
119 PluginServer *plugin;
120 BC_Window* new_gui();
121 void handle_close_event(int result);
122 int remove_plugin(PluginServer *plugin, ArrayList<BC_ListBoxItem*> &folder);
124 AWindowRemovePlugin(AWindow *awindow, PluginServer *plugin);
125 ~AWindowRemovePlugin();
128 class AWindowGUI : public BC_Window
131 AWindowGUI(MWindow *mwindow, AWindow *awindow);
134 void create_objects();
135 int resize_event(int w, int h);
136 int translation_event();
138 int keypress_event();
139 void async_update_assets(); // Sends update asset event
140 void update_effects();
142 void reposition_objects();
143 static int folder_number(const char *name);
144 // Call back for MWindow entry point
147 // Collect items into the drag vectors of MainSession
148 void collect_assets();
149 void create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
154 void create_label_folder();
155 void copy_picons(ArrayList<BC_ListBoxItem*> *dst,
156 ArrayList<BC_ListBoxItem*> *src, int folder);
157 void sort_picons(ArrayList<BC_ListBoxItem*> *src);
158 // Return the selected asset in asset_list
159 Indexable* selected_asset();
160 PluginServer* selected_plugin();
161 AssetPicon* selected_folder();
162 bool protected_pixmap(BC_Pixmap *pixmap);
163 int save_defaults(BC_Hash *defaults);
164 int load_defaults(BC_Hash *defaults);
165 void start_vicon_drawing();
166 void stop_vicon_drawing();
167 void update_picon(Indexable *indexable);
172 AWindowAssets *asset_list;
173 AWindowFolders *folder_list;
174 AWindowDivider *divider;
176 // Store data to speed up responses
177 // Persistant data for listboxes
178 // All assets in current EDL
179 ArrayList<BC_ListBoxItem*> assets;
180 ArrayList<BC_ListBoxItem*> folders;
181 ArrayList<BC_ListBoxItem*> aeffects;
182 ArrayList<BC_ListBoxItem*> veffects;
183 ArrayList<BC_ListBoxItem*> atransitions;
184 ArrayList<BC_ListBoxItem*> vtransitions;
185 ArrayList<BC_ListBoxItem*> labellist;
187 // Currently displayed data for listboxes
188 // Currently displayed assets + comments
189 ArrayList<BC_ListBoxItem*> displayed_assets[2];
191 const char *asset_titles[ASSET_COLUMNS];
195 BC_Pixmap *folder_icon;
196 BC_Pixmap *file_icon;
197 BC_Pixmap *audio_icon;
198 BC_Pixmap *video_icon;
199 BC_Pixmap *label_icon;
200 BC_Pixmap *clip_icon; VFrame *clip_vframe;
201 BC_Pixmap *atransition_icon; VFrame *atransition_vframe;
202 BC_Pixmap *vtransition_icon; VFrame *vtransition_vframe;
203 BC_Pixmap *aeffect_icon; VFrame *aeffect_vframe;
204 BC_Pixmap *ladspa_icon; VFrame *ladspa_vframe;
205 BC_Pixmap *ff_aud_icon; VFrame *ff_aud_vframe;
206 BC_Pixmap *ff_vid_icon; VFrame *ff_vid_vframe;
207 BC_Pixmap *veffect_icon; VFrame *veffect_vframe;
208 NewFolderThread *newfolder_thread;
211 AssetPopup *asset_menu;
212 ClipPopup *clip_menu;
213 LabelPopup *label_menu;
214 AssetListMenu *assetlist_menu;
215 ClipListMenu *cliplist_menu;
216 LabelListMenu *labellist_menu;
217 FolderListMenu *folderlist_menu;
219 // Temporary for reading picons from files
221 VIconThread *vicon_thread;
223 int64_t plugin_visibility;
224 AWindowRemovePlugin *remove_plugin;
226 AVIconDrawing *avicon_drawing;
227 int avicon_w, avicon_h, vicon_drawing;
228 int allow_iconlisting;
230 // Create custom atoms to be used for async messages between windows
231 int create_custom_xatoms();
232 // Function to overload to recieve customly defined atoms
233 virtual int recieve_custom_xatoms(xatom_event *event);
234 static const char *folder_names[];
237 void update_folder_list();
238 void update_asset_list();
239 void filter_displayed_assets();
240 Atom UpdateAssetsXAtom;
241 void update_assets();
245 class AWindowAssets : public BC_ListBox
248 AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
252 int selection_changed();
253 void draw_background();
254 int drag_start_event();
255 int drag_motion_event();
256 int drag_stop_event();
257 int button_press_event();
258 int column_resize_event();
259 int focus_in_event();
260 int focus_out_event();
266 class AWindowDivider : public BC_SubWindow
269 AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
272 int button_press_event();
273 int cursor_motion_event();
274 int button_release_event();
280 class AWindowFolders : public BC_ListBox
283 AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
286 int selection_changed();
287 int button_press_event();
293 class AWindowNewFolder : public BC_Button
296 AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
303 class AWindowDeleteFolder : public BC_Button
306 AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
313 class AWindowRenameFolder : public BC_Button
316 AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
323 class AWindowDeleteDisk : public BC_Button
326 AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y);
333 class AWindowDeleteProject : public BC_Button
336 AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y);
343 class AWindowInfo : public BC_Button
346 AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y);
353 class AWindowRedrawIndex : public BC_Button
356 AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y);
363 class AWindowPaste : public BC_Button
366 AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y);
373 class AWindowAppend : public BC_Button
376 AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y);
383 class AWindowView : public BC_Button
386 AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y);
393 class AddTools : public BC_PopupMenu
396 AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, const char *title);
397 void create_objects();
403 class AddPluginItem : public BC_MenuItem
406 AddPluginItem(AddTools *menu, const char *text, int idx);
413 class AVIconDrawing : public BC_Toggle
419 static void calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh);
421 AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images);
426 class AWindowListFormat : public BC_MenuItem
429 AWindowListFormat(MWindow *mwindow);
437 class AWindowListSort : public BC_MenuItem
440 AWindowListSort(MWindow *mwindow);