r917: Implement Asynchronous updates for awinodw, thus removing the reason for the...
[cinelerra_cv/mob.git] / cinelerra / awindowgui.h
blobbb9d25689fdf69cc2b99a2c547a4069d11de99a5
1 #ifndef AWINDOWGUI_H
2 #define AWINDOWGUI_H
4 #include "arraylist.h"
5 #include "assetpopup.inc"
6 #include "asset.inc"
7 #include "assets.inc"
8 #include "awindow.inc"
9 #include "awindowmenu.inc"
10 #include "edl.inc"
11 #include "guicast.h"
12 #include "labels.h"
13 #include "mwindow.inc"
14 #include "newfolder.inc"
15 #include "pluginserver.inc"
17 class AWindowAssets;
18 class AWindowFolders;
19 class AWindowNewFolder;
20 class AWindowDeleteFolder;
21 class AWindowRenameFolder;
22 class AWindowDeleteDisk;
23 class AWindowDeleteProject;
24 class AWindowDivider;
25 class AWindowInfo;
26 class AWindowRedrawIndex;
27 class AWindowPaste;
28 class AWindowAppend;
29 class AWindowView;
31 class LabelPopup;
32 class LabelPopupEdit;
34 class AWindowGUI;
36 class AssetPicon : public BC_ListBoxItem
38 public:
39 AssetPicon(MWindow *mwindow, AWindowGUI *gui, Asset *asset);
40 AssetPicon(MWindow *mwindow, AWindowGUI *gui, EDL *edl);
41 AssetPicon(MWindow *mwindow, AWindowGUI *gui, PluginServer *plugin);
42 AssetPicon(MWindow *mwindow, AWindowGUI *gui, Label *plugin);
43 AssetPicon(MWindow *mwindow, AWindowGUI *gui, char *folder);
44 virtual ~AssetPicon();
46 void create_objects();
47 void reset();
49 MWindow *mwindow;
50 AWindowGUI *gui;
51 BC_Pixmap *icon;
52 VFrame *icon_vframe;
53 // ID of thing pointed to
54 int id;
56 // Check ID first. Update these next before dereferencing
57 // Asset if asset
58 Asset *asset;
59 // EDL if clip
60 EDL *edl;
62 int in_use;
65 int persistent;
66 PluginServer *plugin;
67 Label *label;
71 class AWindowGUI : public BC_Window
73 public:
74 AWindowGUI(MWindow *mwindow, AWindow *awindow);
75 ~AWindowGUI();
77 int create_objects();
78 int resize_event(int w, int h);
79 int translation_event();
80 int close_event();
81 int keypress_event();
82 void async_update_assets(); // Sends update asset event
83 void sort_assets();
84 void reposition_objects();
85 int current_folder_number();
86 // Call back for MWindow entry point
87 int drag_motion();
88 int drag_stop();
89 // Collect items into the drag vectors of MainSession
90 void collect_assets();
91 void create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
92 int do_audio,
93 int do_video,
94 int is_realtime,
95 int is_transition);
96 void create_label_folder();
97 void copy_picons(ArrayList<BC_ListBoxItem*> *dst,
98 ArrayList<BC_ListBoxItem*> *src,
99 char *folder);
100 void sort_picons(ArrayList<BC_ListBoxItem*> *src,
101 char *folder);
102 // Return the selected asset in asset_list
103 Asset* selected_asset();
104 PluginServer* selected_plugin();
105 AssetPicon* selected_folder();
107 MWindow *mwindow;
108 AWindow *awindow;
110 AWindowAssets *asset_list;
111 AWindowFolders *folder_list;
112 AWindowDivider *divider;
114 // Store data to speed up responses
115 // Persistant data for listboxes
116 // All assets in current EDL
117 ArrayList<BC_ListBoxItem*> assets;
118 ArrayList<BC_ListBoxItem*> folders;
119 ArrayList<BC_ListBoxItem*> aeffects;
120 ArrayList<BC_ListBoxItem*> veffects;
121 ArrayList<BC_ListBoxItem*> atransitions;
122 ArrayList<BC_ListBoxItem*> vtransitions;
123 ArrayList<BC_ListBoxItem*> labellist;
125 // Currently displayed data for listboxes
126 // Currently displayed assets + comments
127 ArrayList<BC_ListBoxItem*> displayed_assets[2];
129 char *asset_titles[ASSET_COLUMNS];
131 // Persistent icons
132 BC_Pixmap *folder_icon;
133 BC_Pixmap *file_icon;
134 BC_Pixmap *audio_icon;
135 BC_Pixmap *video_icon;
136 BC_Pixmap *clip_icon;
137 NewFolderThread *newfolder_thread;
139 // Popup menus
140 AssetPopup *asset_menu;
141 LabelPopup *label_menu;
142 AssetListMenu *assetlist_menu;
143 FolderListMenu *folderlist_menu;
144 // Temporary for reading picons from files
145 VFrame *temp_picon;
147 int allow_iconlisting;
149 // Create custom atoms to be used for async messages between windows
150 virtual int create_custom_xatoms();
151 // Function to overload to recieve customly defined atoms
152 virtual int recieve_custom_xatoms(xatom_event *event);
156 private:
157 void update_folder_list();
158 void update_asset_list();
159 void filter_displayed_assets();
160 Atom UpdateAssetsXAtom;
161 void update_assets();
165 class AWindowAssets : public BC_ListBox
167 public:
168 AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
169 ~AWindowAssets();
171 int handle_event();
172 int selection_changed();
173 void draw_background();
174 int drag_start_event();
175 int drag_motion_event();
176 int drag_stop_event();
177 int button_press_event();
178 int column_resize_event();
180 MWindow *mwindow;
181 AWindowGUI *gui;
184 class AWindowDivider : public BC_SubWindow
186 public:
187 AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
188 ~AWindowDivider();
190 int button_press_event();
191 int cursor_motion_event();
192 int button_release_event();
194 MWindow *mwindow;
195 AWindowGUI *gui;
198 class AWindowFolders : public BC_ListBox
200 public:
201 AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h);
202 ~AWindowFolders();
204 int selection_changed();
205 int button_press_event();
207 MWindow *mwindow;
208 AWindowGUI *gui;
211 class AWindowNewFolder : public BC_Button
213 public:
214 AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
215 int handle_event();
216 MWindow *mwindow;
217 AWindowGUI *gui;
218 int x, y;
221 class AWindowDeleteFolder : public BC_Button
223 public:
224 AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
225 int handle_event();
226 MWindow *mwindow;
227 AWindowGUI *gui;
228 int x, y;
231 class AWindowRenameFolder : public BC_Button
233 public:
234 AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y);
235 int handle_event();
236 MWindow *mwindow;
237 AWindowGUI *gui;
238 int x, y;
241 class AWindowDeleteDisk : public BC_Button
243 public:
244 AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y);
245 int handle_event();
246 MWindow *mwindow;
247 AWindowGUI *gui;
248 int x, y;
251 class AWindowDeleteProject : public BC_Button
253 public:
254 AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y);
255 int handle_event();
256 MWindow *mwindow;
257 AWindowGUI *gui;
258 int x, y;
261 class AWindowInfo : public BC_Button
263 public:
264 AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y);
265 int handle_event();
266 MWindow *mwindow;
267 AWindowGUI *gui;
268 int x, y;
271 class AWindowRedrawIndex : public BC_Button
273 public:
274 AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y);
275 int handle_event();
276 MWindow *mwindow;
277 AWindowGUI *gui;
278 int x, y;
281 class AWindowPaste : public BC_Button
283 public:
284 AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y);
285 int handle_event();
286 MWindow *mwindow;
287 AWindowGUI *gui;
288 int x, y;
291 class AWindowAppend : public BC_Button
293 public:
294 AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y);
295 int handle_event();
296 MWindow *mwindow;
297 AWindowGUI *gui;
298 int x, y;
301 class AWindowView : public BC_Button
303 public:
304 AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y);
305 int handle_event();
306 MWindow *mwindow;
307 AWindowGUI *gui;
308 int x, y;
311 class LabelPopup : public BC_PopupMenu
313 public:
314 LabelPopup(MWindow *mwindow, AWindowGUI *gui);
315 ~LabelPopup();
317 void create_objects();
318 // Set mainsession with the current selections
319 int update();
321 MWindow *mwindow;
322 AWindowGUI *gui;
324 LabelPopupEdit *editlabel;
327 class LabelPopupEdit : public BC_MenuItem
329 public:
330 LabelPopupEdit(MWindow *mwindow, LabelPopup *popup);
331 ~LabelPopupEdit();
333 int handle_event();
335 MWindow *mwindow;
336 LabelPopup *popup;
339 #endif