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 "effectlist.inc"
35 #include "folderlistmenu.inc"
37 #include "labeledit.inc"
38 #include "labelpopup.inc"
40 #include "indexable.inc"
41 #include "mwindow.inc"
42 #include "newfolder.inc"
43 #include "pluginserver.inc"
46 class AssetPicon : public BC_ListBoxItem
49 AssetPicon(MWindow *mwindow, AWindowGUI *gui, Indexable *indexable);
50 AssetPicon(MWindow *mwindow, AWindowGUI *gui, EDL *edl);
51 AssetPicon(MWindow *mwindow, AWindowGUI *gui, PluginServer *plugin);
52 AssetPicon(MWindow *mwindow, AWindowGUI *gui, Label *plugin);
53 AssetPicon(MWindow *mwindow, AWindowGUI *gui, int folder, int persist);
54 AssetPicon(MWindow *mwindow, AWindowGUI *gui, const char *folder_name, int folder_num);
55 virtual ~AssetPicon();
57 void create_objects();
65 // ID of thing pointed to
68 // Check ID first. Update these next before dereferencing
83 class AssetVIcon : public VIcon {
90 int64_t set_seq_no(int64_t no);
94 AssetVIcon(AssetPicon *picon, int w, int h, double framerate, int64_t length);
98 class AWindowRemovePlugin;
100 class AWindowRemovePluginGUI : public BC_Window {
103 AWindowRemovePlugin *thread;
104 PluginServer *plugin;
105 ArrayList<BC_ListBoxItem*> plugin_list;
110 void create_objects();
112 AWindowRemovePluginGUI(AWindow *awindow, AWindowRemovePlugin *thread,
113 int x, int y, PluginServer *plugin);
114 ~AWindowRemovePluginGUI();
117 class AWindowRemovePlugin : public BC_DialogThread {
120 PluginServer *plugin;
121 BC_Window* new_gui();
122 void handle_close_event(int result);
123 int remove_plugin(PluginServer *plugin, ArrayList<BC_ListBoxItem*> &folder);
125 AWindowRemovePlugin(AWindow *awindow, PluginServer *plugin);
126 ~AWindowRemovePlugin();
129 class AWindowGUI : public BC_Window
132 AWindowGUI(MWindow *mwindow, AWindow *awindow);
135 void create_objects();
136 int resize_event(int w, int h);
137 int translation_event();
139 int keypress_event();
140 void async_update_assets(); // Sends update asset event
141 void update_effects();
143 void reposition_objects();
144 static int folder_number(const char *name);
145 // Call back for MWindow entry point
148 // Collect items into the drag vectors of MainSession
149 void collect_assets();
150 void create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
155 void create_label_folder();
156 void copy_picons(ArrayList<BC_ListBoxItem*> *dst,
157 ArrayList<BC_ListBoxItem*> *src, int folder);
158 void sort_picons(ArrayList<BC_ListBoxItem*> *src);
159 // Return the selected asset in asset_list
160 Indexable* selected_asset();
161 PluginServer* selected_plugin();
162 AssetPicon* selected_folder();
163 bool protected_pixmap(BC_Pixmap *pixmap);
164 int save_defaults(BC_Hash *defaults);
165 int load_defaults(BC_Hash *defaults);
166 void start_vicon_drawing();
167 void stop_vicon_drawing();
168 void update_picon(Indexable *indexable);
170 VFrame *get_picon(const char *name, const char *plugin_icons);
171 VFrame *get_picon(const char *name);
172 VFrame *resource_icon(VFrame *&vfrm, BC_Pixmap *&icon, const char *fn, int idx);
173 VFrame *theme_icon(VFrame *&vfrm, BC_Pixmap *&icon, const char *fn);
174 VFrame *plugin_icon(VFrame *&vfrm, BC_Pixmap *&icon, const char *fn, unsigned char *png);
179 AWindowAssets *asset_list;
180 AWindowFolders *folder_list;
181 AWindowDivider *divider;
183 // Store data to speed up responses
184 // Persistant data for listboxes
185 // All assets in current EDL
186 ArrayList<BC_ListBoxItem*> assets;
187 ArrayList<BC_ListBoxItem*> folders;
188 ArrayList<BC_ListBoxItem*> aeffects;
189 ArrayList<BC_ListBoxItem*> veffects;
190 ArrayList<BC_ListBoxItem*> atransitions;
191 ArrayList<BC_ListBoxItem*> vtransitions;
192 ArrayList<BC_ListBoxItem*> labellist;
194 // Currently displayed data for listboxes
195 // Currently displayed assets + comments
196 ArrayList<BC_ListBoxItem*> displayed_assets[2];
197 const char *asset_titles[ASSET_COLUMNS];
198 int displayed_folder;
202 BC_Pixmap *folder_icon; VFrame *folder_res, *folder_vframe;
203 BC_Pixmap *file_icon; VFrame *file_res, *file_vframe;
204 BC_Pixmap *audio_icon; VFrame *audio_res, *audio_vframe;
205 BC_Pixmap *video_icon; VFrame *video_res, *video_vframe;
206 BC_Pixmap *label_icon; VFrame *label_res, *label_vframe;
207 BC_Pixmap *clip_icon; VFrame *clip_res, *clip_vframe;
208 BC_Pixmap *atransition_icon; VFrame *atrans_res, *atransition_vframe;
209 BC_Pixmap *vtransition_icon; VFrame *vtrans_res, *vtransition_vframe;
210 BC_Pixmap *aeffect_icon; VFrame *aeffect_res, *aeffect_vframe;
211 BC_Pixmap *veffect_icon; VFrame *veffect_res, *veffect_vframe;
212 BC_Pixmap *ladspa_icon; VFrame *ladspa_res, *ladspa_vframe;
213 BC_Pixmap *ff_aud_icon; VFrame *ff_aud_res, *ff_aud_vframe;
214 BC_Pixmap *ff_vid_icon; VFrame *ff_vid_res, *ff_vid_vframe;
215 NewFolderThread *newfolder_thread;
218 AssetPopup *asset_menu;
219 ClipPopup *clip_menu;
220 LabelPopup *label_menu;
221 EffectListMenu *effectlist_menu;
222 AssetListMenu *assetlist_menu;
223 ClipListMenu *cliplist_menu;
224 LabelListMenu *labellist_menu;
225 FolderListMenu *folderlist_menu;
227 // Temporary for reading picons from files
229 VIconThread *vicon_thread;
231 int64_t plugin_visibility;
232 AWindowRemovePlugin *remove_plugin;
234 AVIconDrawing *avicon_drawing;
235 int avicon_w, avicon_h, vicon_drawing;
236 int allow_iconlisting;
238 // Create custom atoms to be used for async messages between windows
239 int create_custom_xatoms();
240 // Function to overload to recieve customly defined atoms
241 virtual int recieve_custom_xatoms(xatom_event *event);
242 static const char *folder_names[];
245 void update_folder_list();
246 void update_asset_list();
247 void filter_displayed_assets();
248 Atom UpdateAssetsXAtom;
249 void update_assets();
253 class AWindowAssets : public BC_ListBox
256 AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
260 int selection_changed();
261 void draw_background();
262 int drag_start_event();
263 int drag_motion_event();
264 int drag_stop_event();
265 int button_press_event();
266 int column_resize_event();
267 int focus_in_event();
268 int focus_out_event();
274 class AWindowDivider : public BC_SubWindow
277 AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
280 int button_press_event();
281 int cursor_motion_event();
282 int button_release_event();
288 class AWindowFolders : public BC_ListBox
291 AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
294 int selection_changed();
295 int button_press_event();
301 class AWindowNewFolder : public BC_Button
304 AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
311 class AWindowDeleteFolder : public BC_Button
314 AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
321 class AWindowRenameFolder : public BC_Button
324 AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
331 class AWindowDeleteDisk : public BC_Button
334 AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y);
341 class AWindowDeleteProject : public BC_Button
344 AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y);
351 class AWindowInfo : public BC_Button
354 AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y);
361 class AWindowRedrawIndex : public BC_Button
364 AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y);
371 class AWindowPaste : public BC_Button
374 AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y);
381 class AWindowAppend : public BC_Button
384 AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y);
391 class AWindowView : public BC_Button
394 AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y);
401 class AddTools : public BC_PopupMenu
404 AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, const char *title);
405 void create_objects();
411 class AddPluginItem : public BC_MenuItem
414 AddPluginItem(AddTools *menu, const char *text, int idx);
421 class AVIconDrawing : public BC_Toggle
427 static void calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh);
429 AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images);
434 class AWindowListFormat : public BC_MenuItem
437 AWindowListFormat(MWindow *mwindow, AWindowGUI *gui);
446 class AWindowListSort : public BC_MenuItem
449 AWindowListSort(MWindow *mwindow, AWindowGUI *gui);