r956: README.BUILD - add more library recommendations
[cinelerra_cv/ct.git] / cinelerra / awindowgui.C
blobf38b256eb0a27f1fd613e329f95a8492eaedc55a
1 #include "asset.h"
2 #include "assetedit.h"
3 #include "assetpopup.h"
4 #include "assets.h"
5 #include "awindowgui.h"
6 #include "awindowgui.inc"
7 #include "awindow.h"
8 #include "awindowmenu.h"
9 #include "bcsignals.h"
10 #include "cache.h"
11 #include "colormodels.h"
12 #include "cursors.h"
13 #include "cwindowgui.h"
14 #include "cwindow.h"
15 #include "edl.h"
16 #include "edlsession.h"
17 #include "file.h"
18 #include "filesystem.h"
19 #include "language.h"
20 #include "labels.h"
21 #include "labeledit.h"
22 #include "localsession.h"
23 #include "mainmenu.h"
24 #include "mainsession.h"
25 #include "mwindowgui.h"
26 #include "mwindow.h"
27 #include "newfolder.h"
28 #include "preferences.h"
29 #include "theme.h"
30 #include "vframe.h"
31 #include "vwindowgui.h"
32 #include "vwindow.h"
37 AssetPicon::AssetPicon(MWindow *mwindow, 
38         AWindowGUI *gui, 
39         Asset *asset)
40  : BC_ListBoxItem()
42         reset();
43         this->mwindow = mwindow;
44         this->gui = gui;
45         this->asset = asset;
46         this->id = asset->id;
49 AssetPicon::AssetPicon(MWindow *mwindow, 
50         AWindowGUI *gui, 
51         EDL *edl)
52  : BC_ListBoxItem()
54         reset();
55         this->mwindow = mwindow;
56         this->gui = gui;
57         this->edl = edl;
58         this->id = edl->id;
61 AssetPicon::AssetPicon(MWindow *mwindow, 
62         AWindowGUI *gui, 
63         char *folder)
64  : BC_ListBoxItem(folder, gui->folder_icon)
66         reset();
67         this->mwindow = mwindow;
68         this->gui = gui;
71 AssetPicon::AssetPicon(MWindow *mwindow, 
72         AWindowGUI *gui, 
73         PluginServer *plugin)
74  : BC_ListBoxItem()
76         reset();
77         this->mwindow = mwindow;
78         this->gui = gui;
79         this->plugin = plugin;
80         asset = 0;
81         icon = 0;
82         id = 0;
85 AssetPicon::AssetPicon(MWindow *mwindow, 
86         AWindowGUI *gui, 
87         Label *label)
88  : BC_ListBoxItem()
90         reset();
91         this->mwindow = mwindow;
92         this->gui = gui;
93         this->label = label;
94         asset = 0;
95         icon = 0;
96         id = 0;
99 AssetPicon::~AssetPicon()
101         if(icon)
102         {
103                 if(icon != gui->file_icon &&
104                         icon != gui->audio_icon &&
105                         icon != gui->folder_icon &&
106                         icon != gui->clip_icon &&
107                         icon != gui->video_icon) 
108                 {
109                         delete icon;
110                         delete icon_vframe;
111                 }
112         }
115 void AssetPicon::reset()
117         plugin = 0;
118         label = 0;
119         asset = 0;
120         edl = 0;
121         icon = 0;
122         icon_vframe = 0;
123         in_use = 1;
124         id = 0;
125         persistent = 0;
128 void AssetPicon::create_objects()
130         FileSystem fs;
131         char name[BCTEXTLEN];
132         int pixmap_w, pixmap_h;
135         pixmap_h = 50;
137         if(asset)
138         {
139                 fs.extract_name(name, asset->path);
140                 set_text(name);
141                 if(asset->video_data)
142                 {
143                         if(mwindow->preferences->use_thumbnails)
144                         {
145                                 File *file = mwindow->video_cache->check_out(asset, mwindow->edl);
147                                 if(file)
148                                 {
149                                         pixmap_w = pixmap_h * asset->width / asset->height;
151                                         file->set_layer(0);
152                                         file->set_video_position(0, mwindow->edl->session->frame_rate);
154                                         if(gui->temp_picon && 
155                                                 (gui->temp_picon->get_w() != asset->width ||
156                                                 gui->temp_picon->get_h() != asset->height))
157                                         {
158                                                 delete gui->temp_picon;
159                                                 gui->temp_picon = 0;
160                                         }
162                                         if(!gui->temp_picon)
163                                         {
164                                                 gui->temp_picon = new VFrame(0, 
165                                                         asset->width, 
166                                                         asset->height, 
167                                                         BC_RGB888);
168                                         }
170                                         file->read_frame(gui->temp_picon);
172                                         icon = new BC_Pixmap(gui, pixmap_w, pixmap_h);
173                                         icon->draw_vframe(gui->temp_picon,
174                                                 0, 
175                                                 0, 
176                                                 pixmap_w, 
177                                                 pixmap_h,
178                                                 0,
179                                                 0);
180 //printf("%d %d\n", gui->temp_picon->get_w(), gui->temp_picon->get_h());
181                                         icon_vframe = new VFrame(0, 
182                                                 pixmap_w, 
183                                                 pixmap_h, 
184                                                 BC_RGB888);
185                                         cmodel_transfer(icon_vframe->get_rows(), /* Leave NULL if non existent */
186                                                 gui->temp_picon->get_rows(),
187                                                 0, /* Leave NULL if non existent */
188                                                 0,
189                                                 0,
190                                                 0, /* Leave NULL if non existent */
191                                                 0,
192                                                 0,
193                                                 0,        /* Dimensions to capture from input frame */
194                                                 0, 
195                                                 gui->temp_picon->get_w(), 
196                                                 gui->temp_picon->get_h(),
197                                                 0,       /* Dimensions to project on output frame */
198                                                 0, 
199                                                 pixmap_w, 
200                                                 pixmap_h,
201                                                 BC_RGB888, 
202                                                 BC_RGB888,
203                                                 0,         /* When transfering BC_RGBA8888 to non-alpha this is the background color in 0xRRGGBB hex */
204                                                 0,       /* For planar use the luma rowspan */
205                                                 0);     /* For planar use the luma rowspan */
208                                         mwindow->video_cache->check_in(asset);
209                                 }
210                                 else
211                                 {
212                                         icon = gui->video_icon;
213                                         icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
215                                 }
216                         }
217                         else
218                         {
219                                 icon = gui->video_icon;
220                                 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];                  
221                         }
222                 }
223                 else
224                 if(asset->audio_data)
225                 {
226                         icon = gui->audio_icon;
227                         icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND];
228                 }
229 //printf("AssetPicon::create_objects 2\n");
231                 set_icon(icon);
232                 set_icon_vframe(icon_vframe);
233 //printf("AssetPicon::create_objects 4\n");
234         }
235         else
236         if(edl)
237         {
238 //printf("AssetPicon::create_objects 4 %s\n", edl->local_session->clip_title);
239                 strcpy(name, edl->local_session->clip_title);
240                 set_text(name);
241                 set_icon(gui->clip_icon);
242                 set_icon_vframe(mwindow->theme->get_image("clip_icon"));
243         }
244         else
245         if(plugin)
246         {
247                 strcpy(name, _(plugin->title));
248                 set_text(name);
249                 if(plugin->picon)
250                 {
251                         if(plugin->picon->get_color_model() == BC_RGB888)
252                         {
253                                 icon = new BC_Pixmap(gui, 
254                                         plugin->picon->get_w(), 
255                                         plugin->picon->get_h());
256                                 icon->draw_vframe(plugin->picon,
257                                         0,
258                                         0,
259                                         plugin->picon->get_w(), 
260                                         plugin->picon->get_h(),
261                                         0,
262                                         0);
263                         }
264                         else
265                         {
266                                 icon = new BC_Pixmap(gui, 
267                                         plugin->picon, 
268                                         PIXMAP_ALPHA);
269                         }
270                         icon_vframe = new VFrame (*plugin->picon);
271                 }
272                 else
273                 {
274                         icon = gui->file_icon;
275                         icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN];
276                 }
277                 set_icon(icon);
278                 set_icon_vframe(icon_vframe);
279         }
280         else
281         if(label)
282         {
283                 Units::totext(name, 
284                               label->position,
285                               mwindow->edl->session->time_format,
286                               mwindow->edl->session->sample_rate,
287                               mwindow->edl->session->frame_rate,
288                               mwindow->edl->session->frames_per_foot);
289                 set_text(name);
290                 icon = gui->file_icon;
291                 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN];
292                 set_icon(icon);
293                 set_icon_vframe(icon_vframe);
294         }
303 AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow)
304  : BC_Window(PROGRAM_NAME ": Resources",
305         mwindow->session->awindow_x, 
306     mwindow->session->awindow_y, 
307     mwindow->session->awindow_w, 
308     mwindow->session->awindow_h,
309     100,
310     100,
311     1,
312     1,
313     1)
315 // printf("AWindowGUI::AWindowGUI %d %d %d %d\n",
316 // mwindow->session->awindow_x, 
317 // mwindow->session->awindow_y, 
318 // mwindow->session->awindow_w, 
319 // mwindow->session->awindow_h);
320         this->mwindow = mwindow;
321         this->awindow = awindow;
322         temp_picon = 0;
323         allow_iconlisting = 1;
326 AWindowGUI::~AWindowGUI()
328         assets.remove_all_objects();
329         folders.remove_all_objects();
330         aeffects.remove_all_objects();
331         veffects.remove_all_objects();
332         atransitions.remove_all_objects();
333         vtransitions.remove_all_objects();
334         labellist.remove_all_objects();
335         displayed_assets[1].remove_all_objects();
336         delete file_icon;
337         delete audio_icon;
338         delete folder_icon;
339         delete clip_icon;
340         delete newfolder_thread;
341         delete asset_menu;
342         delete label_menu;
343         delete assetlist_menu;
344         delete folderlist_menu;
345         if(temp_picon) delete temp_picon;
348 int AWindowGUI::create_objects()
350         int x, y;
351         AssetPicon *picon;
353 SET_TRACE
354 //printf("AWindowGUI::create_objects 1\n");
355         asset_titles[0] = _("Title");
356         asset_titles[1] = _("Comments");
358 SET_TRACE
360         set_icon(mwindow->theme->get_image("awindow_icon"));
361         file_icon = new BC_Pixmap(this, 
362                 BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN],
363                 PIXMAP_ALPHA);
365         folder_icon = new BC_Pixmap(this, 
366                 BC_WindowBase::get_resources()->type_to_icon[ICON_FOLDER],
367                 PIXMAP_ALPHA);
369         audio_icon = new BC_Pixmap(this, 
370                 BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND],
371                 PIXMAP_ALPHA);
373         video_icon = new BC_Pixmap(this, 
374                 BC_WindowBase::get_resources()->type_to_icon[ICON_FILM],
375                 PIXMAP_ALPHA);
377 SET_TRACE
379         clip_icon = new BC_Pixmap(this, 
380                 mwindow->theme->get_image("clip_icon"),
381                 PIXMAP_ALPHA);
383 SET_TRACE
385 // Mandatory folders
386         folders.append(picon = new AssetPicon(mwindow,
387                 this,
388                 AEFFECT_FOLDER));
389         picon->persistent = 1;
390         folders.append(picon = new AssetPicon(mwindow,
391                 this,
392                 VEFFECT_FOLDER));
393         picon->persistent = 1;
394         folders.append(picon = new AssetPicon(mwindow,
395                 this,
396                 ATRANSITION_FOLDER));
397         picon->persistent = 1;
398         folders.append(picon = new AssetPicon(mwindow,
399                 this,
400                 VTRANSITION_FOLDER));
401         picon->persistent = 1;
402         folders.append(picon = new AssetPicon(mwindow,
403                 this,
404                 LABEL_FOLDER));
405         picon->persistent = 1;
407         create_label_folder();
409 SET_TRACE
411         create_persistent_folder(&aeffects, 1, 0, 1, 0);
412         create_persistent_folder(&veffects, 0, 1, 1, 0);
413         create_persistent_folder(&atransitions, 1, 0, 0, 1);
414         create_persistent_folder(&vtransitions, 0, 1, 0, 1);
416 SET_TRACE
418         mwindow->theme->get_awindow_sizes(this);
420 SET_TRACE
421         add_subwindow(asset_list = new AWindowAssets(mwindow,
422                 this,
423                 mwindow->theme->alist_x, 
424         mwindow->theme->alist_y, 
425         mwindow->theme->alist_w, 
426         mwindow->theme->alist_h));
428 SET_TRACE
429         add_subwindow(divider = new AWindowDivider(mwindow,
430                 this,
431                 mwindow->theme->adivider_x,
432                 mwindow->theme->adivider_y,
433                 mwindow->theme->adivider_w,
434                 mwindow->theme->adivider_h));
436 SET_TRACE
437         divider->set_cursor(HSEPARATE_CURSOR);
439 SET_TRACE
440         add_subwindow(folder_list = new AWindowFolders(mwindow,
441                 this,
442                 mwindow->theme->afolders_x, 
443         mwindow->theme->afolders_y, 
444         mwindow->theme->afolders_w, 
445         mwindow->theme->afolders_h));
446         
447 SET_TRACE
449         x = mwindow->theme->abuttons_x;
450         y = mwindow->theme->abuttons_y;
452 SET_TRACE
454         newfolder_thread = new NewFolderThread(mwindow, this);
456         add_subwindow(asset_menu = new AssetPopup(mwindow, this));
457         asset_menu->create_objects();
459         add_subwindow(label_menu = new LabelPopup(mwindow, this));
460         label_menu->create_objects();
462 SET_TRACE
464         add_subwindow(assetlist_menu = new AssetListMenu(mwindow, this));
466 SET_TRACE
467         assetlist_menu->create_objects();
469 SET_TRACE
471         add_subwindow(folderlist_menu = new FolderListMenu(mwindow, this));
472         folderlist_menu->create_objects();
473 //printf("AWindowGUI::create_objects 2\n");
475 SET_TRACE
476         create_custom_xatoms();
478         return 0;
481 int AWindowGUI::resize_event(int w, int h)
483         mwindow->session->awindow_x = get_x();
484         mwindow->session->awindow_y = get_y();
485         mwindow->session->awindow_w = w;
486         mwindow->session->awindow_h = h;
488         mwindow->theme->get_awindow_sizes(this);
489         mwindow->theme->draw_awindow_bg(this);
491         asset_list->reposition_window(mwindow->theme->alist_x, 
492         mwindow->theme->alist_y, 
493         mwindow->theme->alist_w, 
494         mwindow->theme->alist_h);
495         divider->reposition_window(mwindow->theme->adivider_x,
496                 mwindow->theme->adivider_y,
497                 mwindow->theme->adivider_w,
498                 mwindow->theme->adivider_h);
499         folder_list->reposition_window(mwindow->theme->afolders_x, 
500         mwindow->theme->afolders_y, 
501         mwindow->theme->afolders_w, 
502         mwindow->theme->afolders_h);
503         
504         int x = mwindow->theme->abuttons_x;
505         int y = mwindow->theme->abuttons_y;
507 //      new_bin->reposition_window(x, y);
508 //      x += new_bin->get_w();
509 //      delete_bin->reposition_window(x, y);
510 //      x += delete_bin->get_w();
511 //      rename_bin->reposition_window(x, y);
512 //      x += rename_bin->get_w();
513 //      delete_disk->reposition_window(x, y);
514 //      x += delete_disk->get_w();
515 //      delete_project->reposition_window(x, y);
516 //      x += delete_project->get_w();
517 //      info->reposition_window(x, y);
518 //      x += info->get_w();
519 //      redraw_index->reposition_window(x, y);
520 //      x += redraw_index->get_w();
521 //      paste->reposition_window(x, y);
522 //      x += paste->get_w();
523 //      append->reposition_window(x, y);
524 //      x += append->get_w();
525 //      view->reposition_window(x, y);
527         BC_WindowBase::resize_event(w, h);
528         return 1;
531 int AWindowGUI::translation_event()
533         mwindow->session->awindow_x = get_x();
534         mwindow->session->awindow_y = get_y();
535         return 0;
538 void AWindowGUI::reposition_objects()
540         mwindow->theme->get_awindow_sizes(this);
541         asset_list->reposition_window(mwindow->theme->alist_x, 
542         mwindow->theme->alist_y, 
543         mwindow->theme->alist_w, 
544         mwindow->theme->alist_h);
545         divider->reposition_window(mwindow->theme->adivider_x,
546                 mwindow->theme->adivider_y,
547                 mwindow->theme->adivider_w,
548                 mwindow->theme->adivider_h);
549         folder_list->reposition_window(mwindow->theme->afolders_x, 
550         mwindow->theme->afolders_y, 
551         mwindow->theme->afolders_w, 
552         mwindow->theme->afolders_h);
553         flush();
556 int AWindowGUI::close_event()
558         hide_window();
559         mwindow->session->show_awindow = 0;
560         unlock_window();
562         mwindow->gui->lock_window("AWindowGUI::close_event");
563         mwindow->gui->mainmenu->show_awindow->set_checked(0);
564         mwindow->gui->unlock_window();
566         lock_window("AWindowGUI::close_event");
567         mwindow->save_defaults();
568         return 1;
572 int AWindowGUI::keypress_event()
574         switch(get_keypress())
575         {
576                 case 'w':
577                 case 'W':
578                         if(ctrl_down())
579                         {
580                                 close_event();
581                                 return 1;
582                         }
583                         break;
584         }
585         return 0;
590 int AWindowGUI::create_custom_xatoms()
592         UpdateAssetsXAtom = create_xatom("CWINDOWGUI_UPDATE_ASSETS");
593         return 0;
595 int AWindowGUI::recieve_custom_xatoms(xatom_event *event)
597         if (event->message_type == UpdateAssetsXAtom)
598         {
599                 update_assets();
600                 return 1;
601         } else
602         return 0;
605 void AWindowGUI::async_update_assets()
607         xatom_event event;
608         event.message_type = UpdateAssetsXAtom;
609         send_custom_xatom(&event);
618 void AWindowGUI::update_folder_list()
620 //printf("AWindowGUI::update_folder_list 1\n");
621         for(int i = 0; i < folders.total; i++)
622         {
623                 AssetPicon *picon = (AssetPicon*)folders.values[i];
624                 picon->in_use--;
625         }
626 //printf("AWindowGUI::update_folder_list 1\n");
628 // Search assets for folders
629         for(int i = 0; i < mwindow->edl->folders.total; i++)
630         {
631                 char *folder = mwindow->edl->folders.values[i];
632                 int exists = 0;
633 //printf("AWindowGUI::update_folder_list 1.1\n");
635                 for(int j = 0; j < folders.total; j++)
636                 {
637                         AssetPicon *picon = (AssetPicon*)folders.values[j];
638                         if(!strcasecmp(picon->get_text(), folder))
639                         {
640                                 exists = 1;
641                                 picon->in_use = 1;
642                                 break;
643                         }
644                 }
646                 if(!exists)
647                 {
648                         AssetPicon *picon = new AssetPicon(mwindow, this, folder);
649                         picon->create_objects();
650                         folders.append(picon);
651                 }
652 //printf("AWindowGUI::update_folder_list 1.3\n");
653         }
654 //printf("AWindowGUI::update_folder_list 1\n");
655 //for(int i = 0; i < folders.total; i++)
656 //      printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
658 // Delete excess
659         for(int i = folders.total - 1; i >= 0; i--)
660         {
661                 AssetPicon *picon = (AssetPicon*)folders.values[i];
662                 if(!picon->in_use && !picon->persistent)
663                 {
664                         delete picon;
665                         folders.remove_number(i);
666                 }
667         }
668 //for(int i = 0; i < folders.total; i++)
669 //      printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
670 //printf("AWindowGUI::update_folder_list 2\n");
673 void AWindowGUI::create_persistent_folder(ArrayList<BC_ListBoxItem*> *output, 
674         int do_audio, 
675         int do_video, 
676         int is_realtime, 
677         int is_transition)
679         ArrayList<PluginServer*> plugindb;
681 // Get pointers to plugindb entries
682         mwindow->create_plugindb(do_audio, 
683                         do_video, 
684                         is_realtime, 
685                         is_transition,
686                         0,
687                         plugindb);
689         for(int i = 0; i < plugindb.total; i++)
690         {
691                 PluginServer *server = plugindb.values[i];
692                 int exists = 0;
694 // Create new listitem
695                 if(!exists)
696                 {
697                         AssetPicon *picon = new AssetPicon(mwindow, this, server);
698                         picon->create_objects();
699                         output->append(picon);
700                 }
701         }
704 void AWindowGUI::create_label_folder()
706         Label *current;
707         for(current = mwindow->edl->labels->first; current; current = NEXT) {
708                 AssetPicon *picon = new AssetPicon(mwindow, this, current);
709                 picon->create_objects();
710                 labellist.append(picon);
711         }
715 void AWindowGUI::update_asset_list()
717 //printf("AWindowGUI::update_asset_list 1\n");
718         for(int i = 0; i < assets.total; i++)
719         {
720                 AssetPicon *picon = (AssetPicon*)assets.values[i];
721                 picon->in_use--;
722         }
728 //printf("AWindowGUI::update_asset_list 2\n");
731 // Synchronize EDL clips
732         for(int i = 0; i < mwindow->edl->clips.total; i++)
733         {
734                 int exists = 0;
735                 
736 // Look for clip in existing listitems
737                 for(int j = 0; j < assets.total && !exists; j++)
738                 {
739                         AssetPicon *picon = (AssetPicon*)assets.values[j];
740                         
741                         if(picon->id == mwindow->edl->clips.values[i]->id)
742                         {
743                                 picon->edl = mwindow->edl->clips.values[i];
744                                 picon->set_text(mwindow->edl->clips.values[i]->local_session->clip_title);
745                                 exists = 1;
746                                 picon->in_use = 1;
747                         }
748                 }
750 // Create new listitem
751                 if(!exists)
752                 {
753                         AssetPicon *picon = new AssetPicon(mwindow, 
754                                 this, 
755                                 mwindow->edl->clips.values[i]);
756                         picon->create_objects();
757                         assets.append(picon);
758                 }
759         }
767 //printf("AWindowGUI::update_asset_list 3 %d\n", assets.total);
768 // Synchronize EDL assets
769         for(Asset *current = mwindow->edl->assets->first; 
770                 current; 
771                 current = NEXT)
772         {
773                 int exists = 0;
775 //printf("AWindowGUI::update_asset_list 3 %s\n", current->path);
776 // Look for asset in existing listitems
777                 for(int j = 0; j < assets.total && !exists; j++)
778                 {
779                         AssetPicon *picon = (AssetPicon*)assets.values[j];
781                         if(picon->id == current->id)
782                         {
783 //printf("AWindowGUI::update_asset_list 4 %p %d %d\n", picon->asset, picon->get_icon_x(), picon->get_icon_y());
784                                 picon->asset = current;
785                                 exists = 1;
786                                 picon->in_use = 1;
787                                 break;
788                         }
789                 }
791 //printf("AWindowGUI::update_asset_list 5\n");
792 // Create new listitem
793                 if(!exists)
794                 {
795 //printf("AWindowGUI::update_asset_list 4.1 %s\n", current->path);
796                         AssetPicon *picon = new AssetPicon(mwindow, this, current);
797 //printf("AWindowGUI::update_asset_list 4.2 %s\n", current->path);
798                         picon->create_objects();
799 //printf("AWindowGUI::update_asset_list 4.3 %s\n", current->path);
800                         assets.append(picon);
801 //printf("AWindowGUI::update_asset_list 4.4 %s\n", current->path);
802                 }
803         }
813 //printf("AWindowGUI::update_asset_list 6\n");
814         for(int i = assets.total - 1; i >= 0; i--)
815         {
816                 AssetPicon *picon = (AssetPicon*)assets.values[i];
817 //printf("AWindowGUI::update_asset_list %s %d\n", picon->asset->path, picon->in_use);
818                 if(!picon->in_use)
819                 {
820                         delete picon;
821                         assets.remove_number(i);
822                 }
823         }
824 //printf("AWindowGUI::update_asset_list 7 %d\n", assets.total);
831 void AWindowGUI::sort_assets()
833 //printf("AWindowGUI::sort_assets 1 %s\n", mwindow->edl->session->current_folder);
834         if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
835                 sort_picons(&aeffects, 
836                         0);
837         else
838         if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
839                 sort_picons(&veffects, 
840                         0);
841         else
842         if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
843                 sort_picons(&atransitions, 
844                         0);
845         else
846         if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
847                 sort_picons(&vtransitions, 
848                         0);
849         else
850         if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
851                 ;// Labels should ALWAYS be sorted by time.
852         else
853                 sort_picons(&assets, 
854                         mwindow->edl->session->current_folder);
856         update_assets();
869 void AWindowGUI::collect_assets()
871         int i = 0;
872         mwindow->session->drag_assets->remove_all();
873         mwindow->session->drag_clips->remove_all();
874         while(1)
875         {
876                 AssetPicon *result = (AssetPicon*)asset_list->get_selection(0, i++);
877                 if(!result) break;
879                 if(result->asset) mwindow->session->drag_assets->append(result->asset);
880                 if(result->edl) mwindow->session->drag_clips->append(result->edl);
881         }
884 void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst, 
885         ArrayList<BC_ListBoxItem*> *src, 
886         char *folder)
888 // Remove current pointers
889         dst[0].remove_all();
890         dst[1].remove_all_objects();
892 // Create new pointers
893 //if(folder) printf("AWindowGUI::copy_picons 1 %s\n", folder);
894         for(int i = 0; i < src->total; i++)
895         {
896                 AssetPicon *picon = (AssetPicon*)src->values[i];
897 //printf("AWindowGUI::copy_picons 2 %s\n", picon->asset->folder);
898                 if(!folder ||
899                         (folder && picon->asset && !strcasecmp(picon->asset->folder, folder)) ||
900                         (folder && picon->edl && !strcasecmp(picon->edl->local_session->folder, folder)))
901                 {
902                         BC_ListBoxItem *item2, *item1;
903                         dst[0].append(item1 = picon);
904                         if(picon->edl)
905                                 dst[1].append(item2 = new BC_ListBoxItem(picon->edl->local_session->clip_notes));
906                         else
907                         if(picon->label && picon->label->textstr)
908                                 dst[1].append(item2 = new BC_ListBoxItem(picon->label->textstr));
909                         else
910                                 dst[1].append(item2 = new BC_ListBoxItem(""));
911                         item1->set_autoplace_text(1);
912                         item2->set_autoplace_text(1);
913 //printf("AWindowGUI::copy_picons 3 %s\n", picon->get_text());
914                 }
915         }
918 void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src, 
919                 char *folder)
921 //printf("AWindowGUI::sort_picons 1\n")
922         int done = 0;
923         while(!done)
924         {
925                 done = 1;
926                 for(int i = 0; i < src->total - 1; i++)
927                 {
928                         BC_ListBoxItem *item1 = src->values[i];
929                         BC_ListBoxItem *item2 = src->values[i + 1];
930                         item1->set_autoplace_icon(1);
931                         item2->set_autoplace_icon(1);
932                         item1->set_autoplace_text(1);
933                         item2->set_autoplace_text(1);
934                         if(strcmp(item1->get_text(), item2->get_text()) > 0)
935                         {
936                                 src->values[i + 1] = item1;
937                                 src->values[i] = item2;
938                                 done = 0;
939                         }
940                 }
941         }
945 void AWindowGUI::filter_displayed_assets()
947         allow_iconlisting = 1;
948         asset_titles[0] = _("Title");
949         asset_titles[1] = _("Comments");
950         if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
951                 copy_picons(displayed_assets, 
952                         &aeffects, 
953                         0);
954         else
955         if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
956                 copy_picons(displayed_assets, 
957                         &veffects, 
958                         0);
959         else
960         if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
961                 copy_picons(displayed_assets, 
962                         &atransitions, 
963                         0);
964         else
965         if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
966                 copy_picons(displayed_assets, 
967                         &vtransitions, 
968                         0);
969         else
970         if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER)) {
971                 copy_picons(displayed_assets, 
972                             &labellist, 
973                             0);
974                 asset_titles[0] = _("Time Stamps");
975                 asset_titles[1] = _("Title");
976                 allow_iconlisting = 0;
977         }
978         else
979                 copy_picons(displayed_assets, 
980                         &assets, 
981                         mwindow->edl->session->current_folder);
982         // Ensure the current folder icon is highlighted
983         for(int i = 0; i < folders.total; i++)
984         {
985                 if(!strcasecmp(mwindow->edl->session->current_folder, folders.values[i]->get_text()))
986                         folders.values[i]->set_selected(1);
987                 else
988                         folders.values[i]->set_selected(0);
989         }
993 void AWindowGUI::update_assets()
995 //printf("AWindowGUI::update_assets 1\n");
996         update_folder_list();
997 //printf("AWindowGUI::update_assets 2\n");
998         update_asset_list();
999         labellist.remove_all_objects();
1000         create_label_folder();
1001 //printf("AWindowGUI::update_assets 3\n");
1002         filter_displayed_assets();
1004 //for(int i = 0; i < folders.total; i++)
1005 //printf("AWindowGUI::update_assets 4\n");
1006 //      printf("AWindowGUI::update_assets %s\n", folders.values[i]->get_text());
1007         if(mwindow->edl->session->folderlist_format != folder_list->get_format())
1008                 folder_list->update_format(mwindow->edl->session->folderlist_format, 0);
1009         folder_list->update(&folders,
1010                 0,
1011                 0,
1012                 1,
1013                 folder_list->get_xposition(),
1014                 folder_list->get_yposition(),
1015                 -1);
1016 //printf("AWindowGUI::update_assets 5\n");
1018         if(mwindow->edl->session->assetlist_format != asset_list->get_format())
1019                 asset_list->update_format(mwindow->edl->session->assetlist_format, 0);
1022 //printf("AWindowGUI::update_assets 6 %d\n", displayed_assets[0].total);
1023         asset_list->update(displayed_assets,
1024                 asset_titles,
1025                 mwindow->edl->session->asset_columns,
1026                 ASSET_COLUMNS, 
1027                 asset_list->get_xposition(),
1028                 asset_list->get_yposition(),
1029                 -1,
1030                 0);
1031 //printf("AWindowGUI::update_assets 7\n");
1033         flush();
1034 //printf("AWindowGUI::update_assets 8\n");
1035         return;
1038 int AWindowGUI::current_folder_number()
1040         int result = -1;
1041         for(int i = 0; i < folders.total; i++)
1042         {
1043                 if(!strcasecmp(folders.values[i]->get_text(), mwindow->edl->session->current_folder))
1044                 {
1045                         result = i;
1046                         break;
1047                 }
1048         }
1049         return result;
1052 int AWindowGUI::drag_motion()
1054         if(get_hidden()) return 0;
1056         int result = 0;
1057         return result;
1060 int AWindowGUI::drag_stop()
1062         if(get_hidden()) return 0;
1064         return 0;
1067 Asset* AWindowGUI::selected_asset()
1069         AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1070         if(picon) return picon->asset;
1073 PluginServer* AWindowGUI::selected_plugin()
1075         AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1076         if(picon) return picon->plugin;
1079 AssetPicon* AWindowGUI::selected_folder()
1081         AssetPicon *picon = (AssetPicon*)folder_list->get_selection(0, 0);
1082     return picon;
1094 AWindowDivider::AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1095  : BC_SubWindow(x, y, w, h)
1097         this->mwindow = mwindow;
1098         this->gui = gui;
1100 AWindowDivider::~AWindowDivider()
1104 int AWindowDivider::button_press_event()
1106         if(is_event_win() && cursor_inside())
1107         {
1108                 mwindow->session->current_operation = DRAG_PARTITION;
1109                 return 1;
1110         }
1111         return 0;
1114 int AWindowDivider::cursor_motion_event()
1116         if(mwindow->session->current_operation == DRAG_PARTITION)
1117         {
1118                 mwindow->session->afolders_w = gui->get_relative_cursor_x();
1119                 gui->reposition_objects();
1120         }
1121         return 0;
1124 int AWindowDivider::button_release_event()
1126         if(mwindow->session->current_operation == DRAG_PARTITION)
1127         {
1128                 mwindow->session->current_operation = NO_OPERATION;
1129                 return 1;
1130         }
1131         return 0;
1139 AWindowFolders::AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1140  : BC_ListBox(x, 
1141                 y, 
1142                 w, 
1143                 h,
1144                 mwindow->edl->session->folderlist_format == FOLDERS_ICONS ? 
1145                         LISTBOX_ICONS : LISTBOX_TEXT, 
1146                 &gui->folders, // Each column has an ArrayList of BC_ListBoxItems.
1147                 0,             // Titles for columns.  Set to 0 for no titles
1148                 0,                // width of each column
1149                 1,                      // Total columns.
1150                 0,                    // Pixel of top of window.
1151                 0,                        // If this listbox is a popup window
1152                 LISTBOX_SINGLE,  // Select one item or multiple items
1153                 ICON_TOP,        // Position of icon relative to text of each item
1154                 1)               // Allow drags
1156         this->mwindow = mwindow;
1157         this->gui = gui;
1158         set_drag_scroll(0);
1161 AWindowFolders::~AWindowFolders()
1164         
1165 int AWindowFolders::selection_changed()
1167         AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1168         if(picon)
1169         {
1170                 strcpy(mwindow->edl->session->current_folder, picon->get_text());
1171 //printf("AWindowFolders::selection_changed 1\n");
1172                 gui->asset_list->draw_background();
1173                 gui->async_update_assets();
1174         }
1175         return 1;
1178 int AWindowFolders::button_press_event()
1180         int result = 0;
1182         result = BC_ListBox::button_press_event();
1184         if(!result)
1185         {
1186                 if(get_buttonpress() == 3 && is_event_win() && cursor_inside())
1187                 {
1188                         gui->folderlist_menu->update_titles();
1189                         gui->folderlist_menu->activate_menu();
1190                         result = 1;
1191                 }
1192         }
1195         return result;
1204 AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1205  : BC_ListBox(x, 
1206                 y, 
1207                 w, 
1208                 h,
1209                 (mwindow->edl->session->assetlist_format == ASSETS_ICONS && gui->allow_iconlisting ) ? 
1210                         LISTBOX_ICONS : LISTBOX_TEXT,
1211                 &gui->assets,     // Each column has an ArrayList of BC_ListBoxItems.
1212                 gui->asset_titles,             // Titles for columns.  Set to 0 for no titles
1213                 mwindow->edl->session->asset_columns,                // width of each column
1214                 1,                      // Total columns.
1215                 0,                    // Pixel of top of window.
1216                 0,                        // If this listbox is a popup window
1217                 LISTBOX_MULTIPLE,  // Select one item or multiple items
1218                 ICON_TOP,        // Position of icon relative to text of each item
1219                 1)               // Allow drag
1221         this->mwindow = mwindow;
1222         this->gui = gui;
1223         set_drag_scroll(0);
1226 AWindowAssets::~AWindowAssets()
1230 int AWindowAssets::button_press_event()
1232         int result = 0;
1234         result = BC_ListBox::button_press_event();
1236         if(!result && get_buttonpress() == 3 && is_event_win() && cursor_inside())
1237         {
1238                 BC_ListBox::deactivate_selection();
1239                 gui->assetlist_menu->update_titles();
1240                 gui->assetlist_menu->activate_menu();
1241                 result = 1;
1242         }
1245         return result;
1249 int AWindowAssets::handle_event()
1251 //printf("AWindowAssets::handle_event 1 %d %d\n", get_buttonpress(), get_selection(0, 0));
1252         if(get_selection(0, 0))
1253         {
1254                 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1255                 {
1256                 }
1257                 else
1258                 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1259                 {
1260                 }
1261                 else
1262                 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1263                 {
1264                 }
1265                 else
1266                 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1267                 {
1268                 }
1269                 else
1270                 {
1271 //printf("AWindowAssets::handle_event 2 %d %d\n", get_buttonpress(), get_selection(0, 0));
1272                         mwindow->vwindow->gui->lock_window("AWindowAssets::handle_event");
1273                         
1274                         if(((AssetPicon*)get_selection(0, 0))->asset)
1275                                 mwindow->vwindow->change_source(((AssetPicon*)get_selection(0, 0))->asset);
1276                         else
1277                         if(((AssetPicon*)get_selection(0, 0))->edl)
1278                                 mwindow->vwindow->change_source(((AssetPicon*)get_selection(0, 0))->edl);
1280                         mwindow->vwindow->gui->unlock_window();
1281                 }
1282                 return 1;
1283         }
1285         return 0;
1288 int AWindowAssets::selection_changed()
1290 // Show popup window
1291         if(get_button_down() && get_buttonpress() == 3 && get_selection(0, 0))
1292         {
1293                 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER) || 
1294                         !strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER) ||
1295                         !strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER) ||
1296                         !strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1297                 {
1298                         gui->assetlist_menu->update_titles();
1299                         gui->assetlist_menu->activate_menu();
1300                 }
1301                 else
1302                 if (!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER)) 
1303                 {
1304                         if(((AssetPicon*)get_selection(0, 0))->label)
1305                                 gui->label_menu->activate_menu();
1306                 }
1307                 else
1308                 {
1309                         if(((AssetPicon*)get_selection(0, 0))->asset)
1310                                 gui->asset_menu->update();
1311                         else
1312                         if(((AssetPicon*)get_selection(0, 0))->edl)
1313                                 gui->asset_menu->update();
1317                         gui->asset_menu->activate_menu();
1318                 }
1320                 BC_ListBox::deactivate_selection();
1321                 return 1;
1322         }
1323         return 0;
1326 void AWindowAssets::draw_background()
1328         BC_ListBox::draw_background();
1329         set_color(BC_WindowBase::get_resources()->audiovideo_color);
1330         set_font(LARGEFONT);
1331         draw_text(get_w() - 
1332                         get_text_width(LARGEFONT, mwindow->edl->session->current_folder) - 4, 
1333                 30, 
1334                 mwindow->edl->session->current_folder, 
1335                 -1, 
1336                 get_bg_surface());
1339 int AWindowAssets::drag_start_event()
1341         int collect_pluginservers = 0;
1342         int collect_assets = 0;
1344         if(BC_ListBox::drag_start_event())
1345         {
1346                 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1347                 {
1348                         mwindow->session->current_operation = DRAG_AEFFECT;
1349                         collect_pluginservers = 1;
1350                 }
1351                 else
1352                 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1353                 {
1354                         mwindow->session->current_operation = DRAG_VEFFECT;
1355                         collect_pluginservers = 1;
1356                 }
1357                 else
1358                 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1359                 {
1360                         mwindow->session->current_operation = DRAG_ATRANSITION;
1361                         collect_pluginservers = 1;
1362                 }
1363                 else
1364                 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1365                 {
1366                         mwindow->session->current_operation = DRAG_VTRANSITION;
1367                         collect_pluginservers = 1;
1368                 }
1369                 else
1370                 if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
1371                 {
1372                         // do nothing!
1373                 }
1374                 else
1375                 {
1376                         mwindow->session->current_operation = DRAG_ASSET;
1377                         collect_assets = 1;
1378                 }
1379                 
1380                 
1381                 if(collect_pluginservers)
1382                 {
1383                         int i = 0;
1384                         mwindow->session->drag_pluginservers->remove_all();
1385                         while(1)
1386                         {
1387                                 AssetPicon *result = (AssetPicon*)get_selection(0, i++);
1388                                 if(!result) break;
1389                                 
1390                                 mwindow->session->drag_pluginservers->append(result->plugin);
1391                         }
1392                 }
1393                 
1394                 if(collect_assets)
1395                 {
1396                         gui->collect_assets();
1397                 }
1399                 return 1;
1400         }
1401         return 0;
1404 int AWindowAssets::drag_motion_event()
1406         BC_ListBox::drag_motion_event();
1408         mwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1409         mwindow->gui->drag_motion();
1410         mwindow->gui->unlock_window();
1412         mwindow->vwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1413         mwindow->vwindow->gui->drag_motion();
1414         mwindow->vwindow->gui->unlock_window();
1416         mwindow->cwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1417         mwindow->cwindow->gui->drag_motion();
1418         mwindow->cwindow->gui->unlock_window();
1419         return 0;
1422 int AWindowAssets::drag_stop_event()
1424         int result = 0;
1426         result = gui->drag_stop();
1429         if(!result)
1430         {
1431                 mwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1432                 result = mwindow->gui->drag_stop();
1433                 mwindow->gui->unlock_window();
1434         }
1436         if(!result) 
1437         {
1438                 mwindow->vwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1439                 result = mwindow->vwindow->gui->drag_stop();
1440                 mwindow->vwindow->gui->unlock_window();
1441         }
1443         if(!result) 
1444         {
1445                 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1446                 result = mwindow->cwindow->gui->drag_stop();
1447                 mwindow->cwindow->gui->unlock_window();
1448         }
1452         if(result) get_drag_popup()->set_animation(0);
1454         BC_ListBox::drag_stop_event();
1455         mwindow->session->current_operation = ::NO_OPERATION; // since NO_OPERATION is also defined in listbox, we have to reach for global scope...
1456         return 0;
1459 int AWindowAssets::column_resize_event()
1461         mwindow->edl->session->asset_columns[0] = get_column_width(0);
1462         mwindow->edl->session->asset_columns[1] = get_column_width(1);
1463         return 1;
1477 AWindowNewFolder::AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1478  : BC_Button(x, y, mwindow->theme->newbin_data)
1480         this->mwindow = mwindow;
1481         this->gui = gui;
1482         set_tooltip(_("New bin"));
1485 int AWindowNewFolder::handle_event()
1487         gui->newfolder_thread->start_new_folder();
1488         return 1;
1491 AWindowDeleteFolder::AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1492  : BC_Button(x, y, mwindow->theme->deletebin_data)
1494         this->mwindow = mwindow;
1495         this->gui = gui;
1496         set_tooltip(_("Delete bin"));
1499 int AWindowDeleteFolder::handle_event()
1501         if(gui->folder_list->get_selection(0, 0))
1502         {
1503                 BC_ListBoxItem *folder = gui->folder_list->get_selection(0, 0);
1504                 mwindow->delete_folder(folder->get_text());
1505         }
1506         return 1;
1509 AWindowRenameFolder::AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1510  : BC_Button(x, y, mwindow->theme->renamebin_data)
1512         this->mwindow = mwindow;
1513         this->gui = gui;
1514         set_tooltip(_("Rename bin"));
1517 int AWindowRenameFolder::handle_event()
1519         return 1;
1522 AWindowDeleteDisk::AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1523  : BC_Button(x, y, mwindow->theme->deletedisk_data)
1525         this->mwindow = mwindow;
1526         this->gui = gui;
1527         set_tooltip(_("Delete asset from disk"));
1530 int AWindowDeleteDisk::handle_event()
1532         return 1;
1535 AWindowDeleteProject::AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1536  : BC_Button(x, y, mwindow->theme->deleteproject_data)
1538         this->mwindow = mwindow;
1539         this->gui = gui;
1540         set_tooltip(_("Delete asset from project"));
1543 int AWindowDeleteProject::handle_event()
1545         return 1;
1548 AWindowInfo::AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1549  : BC_Button(x, y, mwindow->theme->infoasset_data)
1551         this->mwindow = mwindow;
1552         this->gui = gui;
1553         set_tooltip(_("Edit information on asset"));
1556 int AWindowInfo::handle_event()
1558         gui->awindow->asset_edit->edit_asset(gui->selected_asset());
1559         return 1;
1562 AWindowRedrawIndex::AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1563  : BC_Button(x, y, mwindow->theme->redrawindex_data)
1565         this->mwindow = mwindow;
1566         this->gui = gui;
1567         set_tooltip(_("Redraw index"));
1570 int AWindowRedrawIndex::handle_event()
1572         return 1;
1575 AWindowPaste::AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1576  : BC_Button(x, y, mwindow->theme->pasteasset_data)
1578         this->mwindow = mwindow;
1579         this->gui = gui;
1580         set_tooltip(_("Paste asset on recordable tracks"));
1583 int AWindowPaste::handle_event()
1585         return 1;
1588 AWindowAppend::AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1589  : BC_Button(x, y, mwindow->theme->appendasset_data)
1591         this->mwindow = mwindow;
1592         this->gui = gui;
1593         set_tooltip(_("Append asset in new tracks"));
1596 int AWindowAppend::handle_event()
1598         return 1;
1601 AWindowView::AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1602  : BC_Button(x, y, mwindow->theme->viewasset_data)
1604         this->mwindow = mwindow;
1605         this->gui = gui;
1606         set_tooltip(_("View asset"));
1609 int AWindowView::handle_event()
1611         return 1;
1616 LabelPopup::LabelPopup(MWindow *mwindow, AWindowGUI *gui)
1617  : BC_PopupMenu(0, 
1618                 0, 
1619                 0, 
1620                 "", 
1621                 0)
1623         this->mwindow = mwindow;
1624         this->gui = gui;
1627 LabelPopup::~LabelPopup()
1631 void LabelPopup::create_objects()
1633         add_item(editlabel = new LabelPopupEdit(mwindow, this));
1639 LabelPopupEdit::LabelPopupEdit(MWindow *mwindow, LabelPopup *popup)
1640  : BC_MenuItem(_("Edit..."))
1642         this->mwindow = mwindow;
1643         this->popup = popup;
1646 LabelPopupEdit::~LabelPopupEdit()
1650 int LabelPopupEdit::handle_event()
1652         int i = 0;
1653         while(1)
1654         {
1655                 AssetPicon *result = (AssetPicon*)mwindow->awindow->gui->asset_list->get_selection(0, i++);
1656                 if(!result) break;
1658                 if(result->label) {
1659                         mwindow->awindow->gui->awindow->label_edit->edit_label(result->label);
1660                         break;
1661                 }
1662         }
1664         return 1;