Merge branch 'ct' of git.pipapo.org:cinelerra-ct into ct
[cinelerra_cv/ct.git] / cinelerra / awindowgui.C
blob782be150a993a3d0272f605817f207dec25fdade
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_GC 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         icon = 0;
81         id = 0;
84 AssetPicon::AssetPicon(MWindow *mwindow, 
85         AWindowGUI *gui, 
86         Label *label)
87  : BC_ListBoxItem()
89         reset();
90         this->mwindow = mwindow;
91         this->gui = gui;
92         this->label = label;
93         icon = 0;
94         id = 0;
97 AssetPicon::~AssetPicon()
99         if(icon)
100         {
101                 if(icon != gui->file_icon &&
102                         icon != gui->audio_icon &&
103                         icon != gui->folder_icon &&
104                         icon != gui->clip_icon &&
105                         icon != gui->video_icon) 
106                 {
107                         delete icon;
108                         delete icon_vframe;
109                 }
110         }
113 void AssetPicon::reset()
115         plugin = 0;
116         label = 0;
117         asset.reset();
118         edl = 0;
119         icon = 0;
120         icon_vframe = 0;
121         in_use = 1;
122         id = 0;
123         persistent = 0;
126 void AssetPicon::create_objects()
128         FileSystem fs;
129         char name[BCTEXTLEN];
130         int pixmap_w, pixmap_h;
133         pixmap_h = 50;
135         if(asset)
136         {
137                 fs.extract_name(name, asset->path);
138                 set_text(name);
139                 if(asset->video_data)
140                 {
141                         if(mwindow->preferences->use_thumbnails)
142                         {
143                                 File *file = mwindow->video_cache->check_out(asset, mwindow->edl);
145                                 if(file)
146                                 {
147                                         pixmap_w = pixmap_h * asset->width / asset->height;
149                                         file->set_layer(0);
150                                         file->set_video_position(0, mwindow->edl->session->frame_rate);
152                                         if(gui->temp_picon && 
153                                                 (gui->temp_picon->get_w() != asset->width ||
154                                                 gui->temp_picon->get_h() != asset->height))
155                                         {
156                                                 delete gui->temp_picon;
157                                                 gui->temp_picon = 0;
158                                         }
160                                         if(!gui->temp_picon)
161                                         {
162                                                 gui->temp_picon = new VFrame(0, 
163                                                         asset->width, 
164                                                         asset->height, 
165                                                         BC_RGB888);
166                                         }
168                                         file->read_frame(gui->temp_picon);
170                                         icon = new BC_Pixmap(gui, pixmap_w, pixmap_h);
171                                         icon->draw_vframe(gui->temp_picon,
172                                                 0, 
173                                                 0, 
174                                                 pixmap_w, 
175                                                 pixmap_h,
176                                                 0,
177                                                 0);
178 //printf("%d %d\n", gui->temp_picon->get_w(), gui->temp_picon->get_h());
179                                         icon_vframe = new VFrame(0, 
180                                                 pixmap_w, 
181                                                 pixmap_h, 
182                                                 BC_RGB888);
183                                         cmodel_transfer(icon_vframe->get_rows(), /* Leave NULL if non existent */
184                                                 gui->temp_picon->get_rows(),
185                                                 0, /* Leave NULL if non existent */
186                                                 0,
187                                                 0,
188                                                 0, /* Leave NULL if non existent */
189                                                 0,
190                                                 0,
191                                                 0,        /* Dimensions to capture from input frame */
192                                                 0, 
193                                                 gui->temp_picon->get_w(), 
194                                                 gui->temp_picon->get_h(),
195                                                 0,       /* Dimensions to project on output frame */
196                                                 0, 
197                                                 pixmap_w, 
198                                                 pixmap_h,
199                                                 BC_RGB888, 
200                                                 BC_RGB888,
201                                                 0,         /* When transfering BC_RGBA8888 to non-alpha this is the background color in 0xRRGGBB hex */
202                                                 0,       /* For planar use the luma rowspan */
203                                                 0);     /* For planar use the luma rowspan */
206                                         mwindow->video_cache->check_in(asset);
207                                 }
208                                 else
209                                 {
210                                         icon = gui->video_icon;
211                                         icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
213                                 }
214                         }
215                         else
216                         {
217                                 icon = gui->video_icon;
218                                 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];                  
219                         }
220                 }
221                 else
222                 if(asset->audio_data)
223                 {
224                         icon = gui->audio_icon;
225                         icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND];
226                 }
227 //printf("AssetPicon::create_objects 2\n");
229                 set_icon(icon);
230                 set_icon_vframe(icon_vframe);
231 //printf("AssetPicon::create_objects 4\n");
232         }
233         else
234         if(edl)
235         {
236 //printf("AssetPicon::create_objects 4 %s\n", edl->local_session->clip_title);
237                 strcpy(name, edl->local_session->clip_title);
238                 set_text(name);
239                 set_icon(gui->clip_icon);
240                 set_icon_vframe(mwindow->theme->get_image("clip_icon"));
241         }
242         else
243         if(plugin)
244         {
245                 strcpy(name, _(plugin->title));
246                 set_text(name);
247                 if(plugin->picon)
248                 {
249                         if(plugin->picon->get_color_model() == BC_RGB888)
250                         {
251                                 icon = new BC_Pixmap(gui, 
252                                         plugin->picon->get_w(), 
253                                         plugin->picon->get_h());
254                                 icon->draw_vframe(plugin->picon,
255                                         0,
256                                         0,
257                                         plugin->picon->get_w(), 
258                                         plugin->picon->get_h(),
259                                         0,
260                                         0);
261                         }
262                         else
263                         {
264                                 icon = new BC_Pixmap(gui, 
265                                         plugin->picon, 
266                                         PIXMAP_ALPHA);
267                         }
268                         icon_vframe = new VFrame (*plugin->picon);
269                 }
270                 else
271                 {
272                         icon = gui->file_icon;
273                         icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN];
274                 }
275                 set_icon(icon);
276                 set_icon_vframe(icon_vframe);
277         }
278         else
279         if(label)
280         {
281                 Units::totext(name, 
282                               label->position,
283                               mwindow->edl->session->time_format,
284                               mwindow->edl->session->sample_rate,
285                               mwindow->edl->session->frame_rate,
286                               mwindow->edl->session->frames_per_foot);
287                 set_text(name);
288                 icon = gui->file_icon;
289                 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN];
290                 set_icon(icon);
291                 set_icon_vframe(icon_vframe);
292         }
301 AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow)
302  : BC_Window(PROGRAM_NAME ": Resources",
303         mwindow->session->awindow_x, 
304     mwindow->session->awindow_y, 
305     mwindow->session->awindow_w, 
306     mwindow->session->awindow_h,
307     100,
308     100,
309     1,
310     1,
311     1)
313 // printf("AWindowGUI::AWindowGUI %d %d %d %d\n",
314 // mwindow->session->awindow_x, 
315 // mwindow->session->awindow_y, 
316 // mwindow->session->awindow_w, 
317 // mwindow->session->awindow_h);
318         this->mwindow = mwindow;
319         this->awindow = awindow;
320         temp_picon = 0;
321         allow_iconlisting = 1;
324 AWindowGUI::~AWindowGUI()
326         assets.remove_all_objects();
327         folders.remove_all_objects();
328         aeffects.remove_all_objects();
329         veffects.remove_all_objects();
330         atransitions.remove_all_objects();
331         vtransitions.remove_all_objects();
332         labellist.remove_all_objects();
333         displayed_assets[1].remove_all_objects();
334         delete file_icon;
335         delete audio_icon;
336         delete folder_icon;
337         delete clip_icon;
338         delete newfolder_thread;
339         delete asset_menu;
340         delete label_menu;
341         delete assetlist_menu;
342         delete folderlist_menu;
343         if(temp_picon) delete temp_picon;
346 int AWindowGUI::create_objects()
348         int x, y;
349         AssetPicon *picon;
351 SET_TRACE
352 //printf("AWindowGUI::create_objects 1\n");
353         asset_titles[0] = _("Title");
354         asset_titles[1] = _("Comments");
356 SET_TRACE
358         set_icon(mwindow->theme->get_image("awindow_icon"));
359         file_icon = new BC_Pixmap(this, 
360                 BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN],
361                 PIXMAP_ALPHA);
363         folder_icon = new BC_Pixmap(this, 
364                 BC_WindowBase::get_resources()->type_to_icon[ICON_FOLDER],
365                 PIXMAP_ALPHA);
367         audio_icon = new BC_Pixmap(this, 
368                 BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND],
369                 PIXMAP_ALPHA);
371         video_icon = new BC_Pixmap(this, 
372                 BC_WindowBase::get_resources()->type_to_icon[ICON_FILM],
373                 PIXMAP_ALPHA);
375 SET_TRACE
377         clip_icon = new BC_Pixmap(this, 
378                 mwindow->theme->get_image("clip_icon"),
379                 PIXMAP_ALPHA);
381 SET_TRACE
383 // Mandatory folders
384         folders.append(picon = new AssetPicon(mwindow,
385                 this,
386                 AEFFECT_FOLDER));
387         picon->persistent = 1;
388         folders.append(picon = new AssetPicon(mwindow,
389                 this,
390                 VEFFECT_FOLDER));
391         picon->persistent = 1;
392         folders.append(picon = new AssetPicon(mwindow,
393                 this,
394                 ATRANSITION_FOLDER));
395         picon->persistent = 1;
396         folders.append(picon = new AssetPicon(mwindow,
397                 this,
398                 VTRANSITION_FOLDER));
399         picon->persistent = 1;
400         folders.append(picon = new AssetPicon(mwindow,
401                 this,
402                 LABEL_FOLDER));
403         picon->persistent = 1;
405         create_label_folder();
407 SET_TRACE
409         create_persistent_folder(&aeffects, 1, 0, 1, 0);
410         create_persistent_folder(&veffects, 0, 1, 1, 0);
411         create_persistent_folder(&atransitions, 1, 0, 0, 1);
412         create_persistent_folder(&vtransitions, 0, 1, 0, 1);
414 SET_TRACE
416         mwindow->theme->get_awindow_sizes(this);
418 SET_TRACE
419         add_subwindow(asset_list = new AWindowAssets(mwindow,
420                 this,
421                 mwindow->theme->alist_x, 
422         mwindow->theme->alist_y, 
423         mwindow->theme->alist_w, 
424         mwindow->theme->alist_h));
426 SET_TRACE
427         add_subwindow(divider = new AWindowDivider(mwindow,
428                 this,
429                 mwindow->theme->adivider_x,
430                 mwindow->theme->adivider_y,
431                 mwindow->theme->adivider_w,
432                 mwindow->theme->adivider_h));
434 SET_TRACE
435         divider->set_cursor(HSEPARATE_CURSOR);
437 SET_TRACE
438         add_subwindow(folder_list = new AWindowFolders(mwindow,
439                 this,
440                 mwindow->theme->afolders_x, 
441         mwindow->theme->afolders_y, 
442         mwindow->theme->afolders_w, 
443         mwindow->theme->afolders_h));
444         
445 SET_TRACE
447         x = mwindow->theme->abuttons_x;
448         y = mwindow->theme->abuttons_y;
450 SET_TRACE
452         newfolder_thread = new NewFolderThread(mwindow, this);
454         add_subwindow(asset_menu = new AssetPopup(mwindow, this));
455         asset_menu->create_objects();
457         add_subwindow(label_menu = new LabelPopup(mwindow, this));
458         label_menu->create_objects();
460 SET_TRACE
462         add_subwindow(assetlist_menu = new AssetListMenu(mwindow, this));
464 SET_TRACE
465         assetlist_menu->create_objects();
467 SET_TRACE
469         add_subwindow(folderlist_menu = new FolderListMenu(mwindow, this));
470         folderlist_menu->create_objects();
471 //printf("AWindowGUI::create_objects 2\n");
473 SET_TRACE
474         create_custom_xatoms();
476         return 0;
479 int AWindowGUI::resize_event(int w, int h)
481         mwindow->session->awindow_x = get_x();
482         mwindow->session->awindow_y = get_y();
483         mwindow->session->awindow_w = w;
484         mwindow->session->awindow_h = h;
486         mwindow->theme->get_awindow_sizes(this);
487         mwindow->theme->draw_awindow_bg(this);
489         asset_list->reposition_window(mwindow->theme->alist_x, 
490         mwindow->theme->alist_y, 
491         mwindow->theme->alist_w, 
492         mwindow->theme->alist_h);
493         divider->reposition_window(mwindow->theme->adivider_x,
494                 mwindow->theme->adivider_y,
495                 mwindow->theme->adivider_w,
496                 mwindow->theme->adivider_h);
497         folder_list->reposition_window(mwindow->theme->afolders_x, 
498         mwindow->theme->afolders_y, 
499         mwindow->theme->afolders_w, 
500         mwindow->theme->afolders_h);
501         
502         int x = mwindow->theme->abuttons_x;
503         int y = mwindow->theme->abuttons_y;
505 //      new_bin->reposition_window(x, y);
506 //      x += new_bin->get_w();
507 //      delete_bin->reposition_window(x, y);
508 //      x += delete_bin->get_w();
509 //      rename_bin->reposition_window(x, y);
510 //      x += rename_bin->get_w();
511 //      delete_disk->reposition_window(x, y);
512 //      x += delete_disk->get_w();
513 //      delete_project->reposition_window(x, y);
514 //      x += delete_project->get_w();
515 //      info->reposition_window(x, y);
516 //      x += info->get_w();
517 //      redraw_index->reposition_window(x, y);
518 //      x += redraw_index->get_w();
519 //      paste->reposition_window(x, y);
520 //      x += paste->get_w();
521 //      append->reposition_window(x, y);
522 //      x += append->get_w();
523 //      view->reposition_window(x, y);
525         BC_WindowBase::resize_event(w, h);
526         return 1;
529 int AWindowGUI::translation_event()
531         mwindow->session->awindow_x = get_x();
532         mwindow->session->awindow_y = get_y();
533         return 0;
536 void AWindowGUI::reposition_objects()
538         mwindow->theme->get_awindow_sizes(this);
539         asset_list->reposition_window(mwindow->theme->alist_x, 
540         mwindow->theme->alist_y, 
541         mwindow->theme->alist_w, 
542         mwindow->theme->alist_h);
543         divider->reposition_window(mwindow->theme->adivider_x,
544                 mwindow->theme->adivider_y,
545                 mwindow->theme->adivider_w,
546                 mwindow->theme->adivider_h);
547         folder_list->reposition_window(mwindow->theme->afolders_x, 
548         mwindow->theme->afolders_y, 
549         mwindow->theme->afolders_w, 
550         mwindow->theme->afolders_h);
551         flush();
554 int AWindowGUI::close_event()
556         hide_window();
557         mwindow->session->show_awindow = 0;
558         unlock_window();
560         mwindow->gui->lock_window("AWindowGUI::close_event");
561         mwindow->gui->mainmenu->show_awindow->set_checked(0);
562         mwindow->gui->unlock_window();
564         lock_window("AWindowGUI::close_event");
565         mwindow->save_defaults();
566         return 1;
570 int AWindowGUI::keypress_event()
572         switch(get_keypress())
573         {
574                 case 'w':
575                 case 'W':
576                         if(ctrl_down())
577                         {
578                                 close_event();
579                                 return 1;
580                         }
581                         break;
582         }
583         return 0;
588 int AWindowGUI::create_custom_xatoms()
590         UpdateAssetsXAtom = create_xatom("CWINDOWGUI_UPDATE_ASSETS");
591         return 0;
593 int AWindowGUI::recieve_custom_xatoms(xatom_event *event)
595         if (event->message_type == UpdateAssetsXAtom)
596         {
597                 update_assets();
598                 return 1;
599         } else
600         return 0;
603 void AWindowGUI::async_update_assets()
605         xatom_event event;
606         event.message_type = UpdateAssetsXAtom;
607         send_custom_xatom(&event);
616 void AWindowGUI::update_folder_list()
618 //printf("AWindowGUI::update_folder_list 1\n");
619         for(int i = 0; i < folders.total; i++)
620         {
621                 AssetPicon *picon = (AssetPicon*)folders.values[i];
622                 picon->in_use--;
623         }
624 //printf("AWindowGUI::update_folder_list 1\n");
626 // Search assets for folders
627         for(int i = 0; i < mwindow->edl->folders.total; i++)
628         {
629                 char *folder = mwindow->edl->folders.values[i];
630                 int exists = 0;
631 //printf("AWindowGUI::update_folder_list 1.1\n");
633                 for(int j = 0; j < folders.total; j++)
634                 {
635                         AssetPicon *picon = (AssetPicon*)folders.values[j];
636                         if(!strcasecmp(picon->get_text(), folder))
637                         {
638                                 exists = 1;
639                                 picon->in_use = 1;
640                                 break;
641                         }
642                 }
644                 if(!exists)
645                 {
646                         AssetPicon *picon = new AssetPicon(mwindow, this, folder);
647                         picon->create_objects();
648                         folders.append(picon);
649                 }
650 //printf("AWindowGUI::update_folder_list 1.3\n");
651         }
652 //printf("AWindowGUI::update_folder_list 1\n");
653 //for(int i = 0; i < folders.total; i++)
654 //      printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
656 // Delete excess
657         for(int i = folders.total - 1; i >= 0; i--)
658         {
659                 AssetPicon *picon = (AssetPicon*)folders.values[i];
660                 if(!picon->in_use && !picon->persistent)
661                 {
662                         delete picon;
663                         folders.remove_number(i);
664                 }
665         }
666 //for(int i = 0; i < folders.total; i++)
667 //      printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
668 //printf("AWindowGUI::update_folder_list 2\n");
671 void AWindowGUI::create_persistent_folder(ArrayList<BC_ListBoxItem*> *output, 
672         int do_audio, 
673         int do_video, 
674         int is_realtime, 
675         int is_transition)
677         ArrayList<PluginServer*> plugindb;
679 // Get pointers to plugindb entries
680         mwindow->create_plugindb(do_audio, 
681                         do_video, 
682                         is_realtime, 
683                         is_transition,
684                         0,
685                         plugindb);
687         for(int i = 0; i < plugindb.total; i++)
688         {
689                 PluginServer *server = plugindb.values[i];
690                 int exists = 0;
692 // Create new listitem
693                 if(!exists)
694                 {
695                         AssetPicon *picon = new AssetPicon(mwindow, this, server);
696                         picon->create_objects();
697                         output->append(picon);
698                 }
699         }
702 void AWindowGUI::create_label_folder()
704         Label *current;
705         for(current = mwindow->edl->labels->first; current; current = NEXT) {
706                 AssetPicon *picon = new AssetPicon(mwindow, this, current);
707                 picon->create_objects();
708                 labellist.append(picon);
709         }
713 void AWindowGUI::update_asset_list()
715 //printf("AWindowGUI::update_asset_list 1\n");
716         for(int i = 0; i < assets.total; i++)
717         {
718                 AssetPicon *picon = (AssetPicon*)assets.values[i];
719                 picon->in_use--;
720         }
726 //printf("AWindowGUI::update_asset_list 2\n");
729 // Synchronize EDL clips
730         for(int i = 0; i < mwindow->edl->clips.total; i++)
731         {
732                 int exists = 0;
733                 
734 // Look for clip in existing listitems
735                 for(int j = 0; j < assets.total && !exists; j++)
736                 {
737                         AssetPicon *picon = (AssetPicon*)assets.values[j];
738                         
739                         if(picon->id == mwindow->edl->clips.values[i]->id)
740                         {
741                                 picon->edl = mwindow->edl->clips.values[i];
742                                 picon->set_text(mwindow->edl->clips.values[i]->local_session->clip_title);
743                                 exists = 1;
744                                 picon->in_use = 1;
745                         }
746                 }
748 // Create new listitem
749                 if(!exists)
750                 {
751                         AssetPicon *picon = new AssetPicon(mwindow, 
752                                 this, 
753                                 mwindow->edl->clips.values[i]);
754                         picon->create_objects();
755                         assets.append(picon);
756                 }
757         }
765 //printf("AWindowGUI::update_asset_list 3 %d\n", assets.total);
766 // Synchronize EDL assets
767         for(Assets_list::iterator current = mwindow->edl->assets->begin(); 
768                 current != mwindow->edl->assets->end(); 
769                 ++current)
770         {
771                 int exists = 0;
773 //printf("AWindowGUI::update_asset_list 3 %s\n", current->path);
774 // Look for asset in existing listitems
775                 for(int j = 0; j < assets.total && !exists; j++)
776                 {
777                         //AssetPicon *picon = (AssetPicon*)assets.values[j];
778                         AssetPicon *picon = (AssetPicon*)assets.values[j];
780                         if(picon->id == (*current)->id)
781                         {
782 //printf("AWindowGUI::update_asset_list 4 %p %d %d\n", picon->asset, picon->get_icon_x(), picon->get_icon_y());
783                                 picon->asset = *current;
784                                 exists = 1;
785                                 picon->in_use = 1;
786                                 break;
787                         }
788                 }
790 //printf("AWindowGUI::update_asset_list 5\n");
791 // Create new listitem
792                 if(!exists)
793                 {
794 //printf("AWindowGUI::update_asset_list 4.1 %s\n", current->path);
795                         AssetPicon *picon = new AssetPicon(mwindow, this, *current);
796 //printf("AWindowGUI::update_asset_list 4.2 %s\n", current->path);
797                         picon->create_objects();
798 //printf("AWindowGUI::update_asset_list 4.3 %s\n", current->path);
799                         assets.append(picon);
800 //printf("AWindowGUI::update_asset_list 4.4 %s\n", current->path);
801                 }
802         }
812 //printf("AWindowGUI::update_asset_list 6\n");
813         for(int i = assets.total - 1; i >= 0; i--)
814         {
815                 AssetPicon *picon = (AssetPicon*)assets.values[i];
816 //printf("AWindowGUI::update_asset_list %s %d\n", picon->asset->path, picon->in_use);
817                 if(!picon->in_use)
818                 {
819                         delete picon;
820                         assets.remove_number(i);
821                 }
822         }
823 //printf("AWindowGUI::update_asset_list 7 %d\n", assets.total);
830 void AWindowGUI::sort_assets()
832 //printf("AWindowGUI::sort_assets 1 %s\n", mwindow->edl->session->current_folder);
833         if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
834                 sort_picons(&aeffects, 
835                         0);
836         else
837         if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
838                 sort_picons(&veffects, 
839                         0);
840         else
841         if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
842                 sort_picons(&atransitions, 
843                         0);
844         else
845         if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
846                 sort_picons(&vtransitions, 
847                         0);
848         else
849         if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
850                 ;// Labels should ALWAYS be sorted by time.
851         else
852                 sort_picons(&assets, 
853                         mwindow->edl->session->current_folder);
855         update_assets();
868 void AWindowGUI::collect_assets()
870         int i = 0;
871         mwindow->session->drag_assets.clear();
872         mwindow->session->drag_clips->remove_all();
873         while(1)
874         {
875                 AssetPicon *result = (AssetPicon*)asset_list->get_selection(0, i++);
876                 if(!result) break;
878                 if(result->asset) mwindow->session->drag_assets.push_back(result->asset);
879                 if(result->edl) mwindow->session->drag_clips->append(result->edl);
880         }
883 void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst, 
884         ArrayList<BC_ListBoxItem*> *src, 
885         char *folder)
887 // Remove current pointers
888         dst[0].remove_all();
889         dst[1].remove_all_objects();
891 // Create new pointers
892 //if(folder) printf("AWindowGUI::copy_picons 1 %s\n", folder);
893         for(int i = 0; i < src->total; i++)
894         {
895                 AssetPicon *picon = (AssetPicon*)src->values[i];
896 //printf("AWindowGUI::copy_picons 2 %s\n", picon->asset->folder);
897                 if(!folder ||
898                         (folder && picon->asset && !strcasecmp(picon->asset->folder, folder)) ||
899                         (folder && picon->edl && !strcasecmp(picon->edl->local_session->folder, folder)))
900                 {
901                         BC_ListBoxItem *item2, *item1;
902                         dst[0].append(item1 = picon);
903                         if(picon->edl)
904                                 dst[1].append(item2 = new BC_ListBoxItem(picon->edl->local_session->clip_notes));
905                         else
906                         if(picon->label && picon->label->textstr)
907                                 dst[1].append(item2 = new BC_ListBoxItem(picon->label->textstr));
908                         else
909                                 dst[1].append(item2 = new BC_ListBoxItem(""));
910                         item1->set_autoplace_text(1);
911                         item2->set_autoplace_text(1);
912 //printf("AWindowGUI::copy_picons 3 %s\n", picon->get_text());
913                 }
914         }
917 void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src, 
918                 char *folder)
920 //printf("AWindowGUI::sort_picons 1\n")
921         int done = 0;
922         while(!done)
923         {
924                 done = 1;
925                 for(int i = 0; i < src->total - 1; i++)
926                 {
927                         BC_ListBoxItem *item1 = src->values[i];
928                         BC_ListBoxItem *item2 = src->values[i + 1];
929                         item1->set_autoplace_icon(1);
930                         item2->set_autoplace_icon(1);
931                         item1->set_autoplace_text(1);
932                         item2->set_autoplace_text(1);
933                         if(strcmp(item1->get_text(), item2->get_text()) > 0)
934                         {
935                                 src->values[i + 1] = item1;
936                                 src->values[i] = item2;
937                                 done = 0;
938                         }
939                 }
940         }
944 void AWindowGUI::filter_displayed_assets()
946         allow_iconlisting = 1;
947         asset_titles[0] = _("Title");
948         asset_titles[1] = _("Comments");
949         if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
950                 copy_picons(displayed_assets, 
951                         &aeffects, 
952                         0);
953         else
954         if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
955                 copy_picons(displayed_assets, 
956                         &veffects, 
957                         0);
958         else
959         if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
960                 copy_picons(displayed_assets, 
961                         &atransitions, 
962                         0);
963         else
964         if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
965                 copy_picons(displayed_assets, 
966                         &vtransitions, 
967                         0);
968         else
969         if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER)) {
970                 copy_picons(displayed_assets, 
971                             &labellist, 
972                             0);
973                 asset_titles[0] = _("Time Stamps");
974                 asset_titles[1] = _("Title");
975                 allow_iconlisting = 0;
976         }
977         else
978                 copy_picons(displayed_assets, 
979                         &assets, 
980                         mwindow->edl->session->current_folder);
981         // Ensure the current folder icon is highlighted
982         for(int i = 0; i < folders.total; i++)
983         {
984                 if(!strcasecmp(mwindow->edl->session->current_folder, folders.values[i]->get_text()))
985                         folders.values[i]->set_selected(1);
986                 else
987                         folders.values[i]->set_selected(0);
988         }
992 void AWindowGUI::update_assets()
994 //printf("AWindowGUI::update_assets 1\n");
995         update_folder_list();
996 //printf("AWindowGUI::update_assets 2\n");
997         update_asset_list();
998         labellist.remove_all_objects();
999         create_label_folder();
1000 //printf("AWindowGUI::update_assets 3\n");
1001         filter_displayed_assets();
1003 //for(int i = 0; i < folders.total; i++)
1004 //printf("AWindowGUI::update_assets 4\n");
1005 //      printf("AWindowGUI::update_assets %s\n", folders.values[i]->get_text());
1006         if(mwindow->edl->session->folderlist_format != folder_list->get_format())
1007                 folder_list->update_format(mwindow->edl->session->folderlist_format, 0);
1008         folder_list->update(&folders,
1009                 0,
1010                 0,
1011                 1,
1012                 folder_list->get_xposition(),
1013                 folder_list->get_yposition(),
1014                 -1);
1015 //printf("AWindowGUI::update_assets 5\n");
1017         if(mwindow->edl->session->assetlist_format != asset_list->get_format())
1018                 asset_list->update_format(mwindow->edl->session->assetlist_format, 0);
1021 //printf("AWindowGUI::update_assets 6 %d\n", displayed_assets[0].total);
1022         asset_list->update(displayed_assets,
1023                 asset_titles,
1024                 mwindow->edl->session->asset_columns,
1025                 ASSET_COLUMNS, 
1026                 asset_list->get_xposition(),
1027                 asset_list->get_yposition(),
1028                 -1,
1029                 0);
1030 //printf("AWindowGUI::update_assets 7\n");
1032         flush();
1033 //printf("AWindowGUI::update_assets 8\n");
1034         return;
1037 int AWindowGUI::current_folder_number()
1039         int result = -1;
1040         for(int i = 0; i < folders.total; i++)
1041         {
1042                 if(!strcasecmp(folders.values[i]->get_text(), mwindow->edl->session->current_folder))
1043                 {
1044                         result = i;
1045                         break;
1046                 }
1047         }
1048         return result;
1051 int AWindowGUI::drag_motion()
1053         if(get_hidden()) return 0;
1055         int result = 0;
1056         return result;
1059 int AWindowGUI::drag_stop()
1061         if(get_hidden()) return 0;
1063         return 0;
1066 Asset_GC AWindowGUI::selected_asset()
1068         AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1069         if(picon) return picon->asset;
1072 PluginServer* AWindowGUI::selected_plugin()
1074         AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1075         if(picon) return picon->plugin;
1078 AssetPicon* AWindowGUI::selected_folder()
1080         AssetPicon *picon = (AssetPicon*)folder_list->get_selection(0, 0);
1081     return picon;
1093 AWindowDivider::AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1094  : BC_SubWindow(x, y, w, h)
1096         this->mwindow = mwindow;
1097         this->gui = gui;
1099 AWindowDivider::~AWindowDivider()
1103 int AWindowDivider::button_press_event()
1105         if(is_event_win() && cursor_inside())
1106         {
1107                 mwindow->session->current_operation = DRAG_PARTITION;
1108                 return 1;
1109         }
1110         return 0;
1113 int AWindowDivider::cursor_motion_event()
1115         if(mwindow->session->current_operation == DRAG_PARTITION)
1116         {
1117                 mwindow->session->afolders_w = gui->get_relative_cursor_x();
1118                 gui->reposition_objects();
1119         }
1120         return 0;
1123 int AWindowDivider::button_release_event()
1125         if(mwindow->session->current_operation == DRAG_PARTITION)
1126         {
1127                 mwindow->session->current_operation = NO_OPERATION;
1128                 return 1;
1129         }
1130         return 0;
1138 AWindowFolders::AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1139  : BC_ListBox(x, 
1140                 y, 
1141                 w, 
1142                 h,
1143                 mwindow->edl->session->folderlist_format == FOLDERS_ICONS ? 
1144                         LISTBOX_ICONS : LISTBOX_TEXT, 
1145                 &gui->folders, // Each column has an ArrayList of BC_ListBoxItems.
1146                 0,             // Titles for columns.  Set to 0 for no titles
1147                 0,                // width of each column
1148                 1,                      // Total columns.
1149                 0,                    // Pixel of top of window.
1150                 0,                        // If this listbox is a popup window
1151                 LISTBOX_SINGLE,  // Select one item or multiple items
1152                 ICON_TOP,        // Position of icon relative to text of each item
1153                 1)               // Allow drags
1155         this->mwindow = mwindow;
1156         this->gui = gui;
1157         set_drag_scroll(0);
1160 AWindowFolders::~AWindowFolders()
1163         
1164 int AWindowFolders::selection_changed()
1166         AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1167         if(picon)
1168         {
1169                 strcpy(mwindow->edl->session->current_folder, picon->get_text());
1170 //printf("AWindowFolders::selection_changed 1\n");
1171                 gui->asset_list->draw_background();
1172                 gui->async_update_assets();
1173         }
1174         return 1;
1177 int AWindowFolders::button_press_event()
1179         int result = 0;
1181         result = BC_ListBox::button_press_event();
1183         if(!result)
1184         {
1185                 if(get_buttonpress() == 3 && is_event_win() && cursor_inside())
1186                 {
1187                         gui->folderlist_menu->update_titles();
1188                         gui->folderlist_menu->activate_menu();
1189                         result = 1;
1190                 }
1191         }
1194         return result;
1203 AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1204  : BC_ListBox(x, 
1205                 y, 
1206                 w, 
1207                 h,
1208                 (mwindow->edl->session->assetlist_format == ASSETS_ICONS && gui->allow_iconlisting ) ? 
1209                         LISTBOX_ICONS : LISTBOX_TEXT,
1210                 &gui->assets,     // Each column has an ArrayList of BC_ListBoxItems.
1211                 gui->asset_titles,             // Titles for columns.  Set to 0 for no titles
1212                 mwindow->edl->session->asset_columns,                // width of each column
1213                 1,                      // Total columns.
1214                 0,                    // Pixel of top of window.
1215                 0,                        // If this listbox is a popup window
1216                 LISTBOX_MULTIPLE,  // Select one item or multiple items
1217                 ICON_TOP,        // Position of icon relative to text of each item
1218                 1)               // Allow drag
1220         this->mwindow = mwindow;
1221         this->gui = gui;
1222         set_drag_scroll(0);
1225 AWindowAssets::~AWindowAssets()
1229 int AWindowAssets::button_press_event()
1231         int result = 0;
1233         result = BC_ListBox::button_press_event();
1235         if(!result && get_buttonpress() == 3 && is_event_win() && cursor_inside())
1236         {
1237                 BC_ListBox::deactivate_selection();
1238                 gui->assetlist_menu->update_titles();
1239                 gui->assetlist_menu->activate_menu();
1240                 result = 1;
1241         }
1244         return result;
1248 int AWindowAssets::handle_event()
1250 //printf("AWindowAssets::handle_event 1 %d %d\n", get_buttonpress(), get_selection(0, 0));
1251         if(get_selection(0, 0))
1252         {
1253                 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1254                 {
1255                 }
1256                 else
1257                 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1258                 {
1259                 }
1260                 else
1261                 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1262                 {
1263                 }
1264                 else
1265                 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1266                 {
1267                 }
1268                 else
1269                 {
1270 //printf("AWindowAssets::handle_event 2 %d %d\n", get_buttonpress(), get_selection(0, 0));
1271                         mwindow->vwindow->gui->lock_window("AWindowAssets::handle_event");
1272                         
1273                         if(((AssetPicon*)get_selection(0, 0))->asset)
1274                                 mwindow->vwindow->change_source(((AssetPicon*)get_selection(0, 0))->asset);
1275                         else
1276                         if(((AssetPicon*)get_selection(0, 0))->edl)
1277                                 mwindow->vwindow->change_source(((AssetPicon*)get_selection(0, 0))->edl);
1279                         mwindow->vwindow->gui->unlock_window();
1280                 }
1281                 return 1;
1282         }
1284         return 0;
1287 int AWindowAssets::selection_changed()
1289 // Show popup window
1290         if(get_button_down() && get_buttonpress() == 3 && get_selection(0, 0))
1291         {
1292                 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER) || 
1293                         !strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER) ||
1294                         !strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER) ||
1295                         !strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1296                 {
1297                         gui->assetlist_menu->update_titles();
1298                         gui->assetlist_menu->activate_menu();
1299                 }
1300                 else
1301                 if (!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER)) 
1302                 {
1303                         if(((AssetPicon*)get_selection(0, 0))->label)
1304                                 gui->label_menu->activate_menu();
1305                 }
1306                 else
1307                 {
1308                         if(((AssetPicon*)get_selection(0, 0))->asset)
1309                                 gui->asset_menu->update();
1310                         else
1311                         if(((AssetPicon*)get_selection(0, 0))->edl)
1312                                 gui->asset_menu->update();
1316                         gui->asset_menu->activate_menu();
1317                 }
1319                 BC_ListBox::deactivate_selection();
1320                 return 1;
1321         }
1322         return 0;
1325 void AWindowAssets::draw_background()
1327         BC_ListBox::draw_background();
1328         set_color(BC_WindowBase::get_resources()->audiovideo_color);
1329         set_font(LARGEFONT);
1330         draw_text(get_w() - 
1331                         get_text_width(LARGEFONT, mwindow->edl->session->current_folder) - 4, 
1332                 30, 
1333                 mwindow->edl->session->current_folder, 
1334                 -1, 
1335                 get_bg_surface());
1338 int AWindowAssets::drag_start_event()
1340         int collect_pluginservers = 0;
1341         int collect_assets = 0;
1343         if(BC_ListBox::drag_start_event())
1344         {
1345                 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1346                 {
1347                         mwindow->session->current_operation = DRAG_AEFFECT;
1348                         collect_pluginservers = 1;
1349                 }
1350                 else
1351                 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1352                 {
1353                         mwindow->session->current_operation = DRAG_VEFFECT;
1354                         collect_pluginservers = 1;
1355                 }
1356                 else
1357                 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1358                 {
1359                         mwindow->session->current_operation = DRAG_ATRANSITION;
1360                         collect_pluginservers = 1;
1361                 }
1362                 else
1363                 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1364                 {
1365                         mwindow->session->current_operation = DRAG_VTRANSITION;
1366                         collect_pluginservers = 1;
1367                 }
1368                 else
1369                 if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
1370                 {
1371                         // do nothing!
1372                 }
1373                 else
1374                 {
1375                         mwindow->session->current_operation = DRAG_ASSET;
1376                         collect_assets = 1;
1377                 }
1378                 
1379                 
1380                 if(collect_pluginservers)
1381                 {
1382                         int i = 0;
1383                         mwindow->session->drag_pluginservers->remove_all();
1384                         while(1)
1385                         {
1386                                 AssetPicon *result = (AssetPicon*)get_selection(0, i++);
1387                                 if(!result) break;
1388                                 
1389                                 mwindow->session->drag_pluginservers->append(result->plugin);
1390                         }
1391                 }
1392                 
1393                 if(collect_assets)
1394                 {
1395                         gui->collect_assets();
1396                 }
1398                 return 1;
1399         }
1400         return 0;
1403 int AWindowAssets::drag_motion_event()
1405         BC_ListBox::drag_motion_event();
1407         mwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1408         mwindow->gui->drag_motion();
1409         mwindow->gui->unlock_window();
1411         mwindow->vwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1412         mwindow->vwindow->gui->drag_motion();
1413         mwindow->vwindow->gui->unlock_window();
1415         mwindow->cwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1416         mwindow->cwindow->gui->drag_motion();
1417         mwindow->cwindow->gui->unlock_window();
1418         return 0;
1421 int AWindowAssets::drag_stop_event()
1423         int result = 0;
1425         result = gui->drag_stop();
1428         if(!result)
1429         {
1430                 mwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1431                 result = mwindow->gui->drag_stop();
1432                 mwindow->gui->unlock_window();
1433         }
1435         if(!result) 
1436         {
1437                 mwindow->vwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1438                 result = mwindow->vwindow->gui->drag_stop();
1439                 mwindow->vwindow->gui->unlock_window();
1440         }
1442         if(!result) 
1443         {
1444                 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1445                 result = mwindow->cwindow->gui->drag_stop();
1446                 mwindow->cwindow->gui->unlock_window();
1447         }
1451         if(result) get_drag_popup()->set_animation(0);
1453         BC_ListBox::drag_stop_event();
1454         mwindow->session->current_operation = ::NO_OPERATION; // since NO_OPERATION is also defined in listbox, we have to reach for global scope...
1455         return 0;
1458 int AWindowAssets::column_resize_event()
1460         mwindow->edl->session->asset_columns[0] = get_column_width(0);
1461         mwindow->edl->session->asset_columns[1] = get_column_width(1);
1462         return 1;
1476 AWindowNewFolder::AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1477  : BC_Button(x, y, mwindow->theme->newbin_data)
1479         this->mwindow = mwindow;
1480         this->gui = gui;
1481         set_tooltip(_("New bin"));
1484 int AWindowNewFolder::handle_event()
1486         gui->newfolder_thread->start_new_folder();
1487         return 1;
1490 AWindowDeleteFolder::AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1491  : BC_Button(x, y, mwindow->theme->deletebin_data)
1493         this->mwindow = mwindow;
1494         this->gui = gui;
1495         set_tooltip(_("Delete bin"));
1498 int AWindowDeleteFolder::handle_event()
1500         if(gui->folder_list->get_selection(0, 0))
1501         {
1502                 BC_ListBoxItem *folder = gui->folder_list->get_selection(0, 0);
1503                 mwindow->delete_folder(folder->get_text());
1504         }
1505         return 1;
1508 AWindowRenameFolder::AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1509  : BC_Button(x, y, mwindow->theme->renamebin_data)
1511         this->mwindow = mwindow;
1512         this->gui = gui;
1513         set_tooltip(_("Rename bin"));
1516 int AWindowRenameFolder::handle_event()
1518         return 1;
1521 AWindowDeleteDisk::AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1522  : BC_Button(x, y, mwindow->theme->deletedisk_data)
1524         this->mwindow = mwindow;
1525         this->gui = gui;
1526         set_tooltip(_("Delete asset from disk"));
1529 int AWindowDeleteDisk::handle_event()
1531         return 1;
1534 AWindowDeleteProject::AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1535  : BC_Button(x, y, mwindow->theme->deleteproject_data)
1537         this->mwindow = mwindow;
1538         this->gui = gui;
1539         set_tooltip(_("Delete asset from project"));
1542 int AWindowDeleteProject::handle_event()
1544         return 1;
1547 AWindowInfo::AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1548  : BC_Button(x, y, mwindow->theme->infoasset_data)
1550         this->mwindow = mwindow;
1551         this->gui = gui;
1552         set_tooltip(_("Edit information on asset"));
1555 int AWindowInfo::handle_event()
1557         gui->awindow->asset_edit->edit_asset(gui->selected_asset());
1558         return 1;
1561 AWindowRedrawIndex::AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1562  : BC_Button(x, y, mwindow->theme->redrawindex_data)
1564         this->mwindow = mwindow;
1565         this->gui = gui;
1566         set_tooltip(_("Redraw index"));
1569 int AWindowRedrawIndex::handle_event()
1571         return 1;
1574 AWindowPaste::AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1575  : BC_Button(x, y, mwindow->theme->pasteasset_data)
1577         this->mwindow = mwindow;
1578         this->gui = gui;
1579         set_tooltip(_("Paste asset on recordable tracks"));
1582 int AWindowPaste::handle_event()
1584         return 1;
1587 AWindowAppend::AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1588  : BC_Button(x, y, mwindow->theme->appendasset_data)
1590         this->mwindow = mwindow;
1591         this->gui = gui;
1592         set_tooltip(_("Append asset in new tracks"));
1595 int AWindowAppend::handle_event()
1597         return 1;
1600 AWindowView::AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1601  : BC_Button(x, y, mwindow->theme->viewasset_data)
1603         this->mwindow = mwindow;
1604         this->gui = gui;
1605         set_tooltip(_("View asset"));
1608 int AWindowView::handle_event()
1610         return 1;
1615 LabelPopup::LabelPopup(MWindow *mwindow, AWindowGUI *gui)
1616  : BC_PopupMenu(0, 
1617                 0, 
1618                 0, 
1619                 "", 
1620                 0)
1622         this->mwindow = mwindow;
1623         this->gui = gui;
1626 LabelPopup::~LabelPopup()
1630 void LabelPopup::create_objects()
1632         add_item(editlabel = new LabelPopupEdit(mwindow, this));
1638 LabelPopupEdit::LabelPopupEdit(MWindow *mwindow, LabelPopup *popup)
1639  : BC_MenuItem(_("Edit..."))
1641         this->mwindow = mwindow;
1642         this->popup = popup;
1645 LabelPopupEdit::~LabelPopupEdit()
1649 int LabelPopupEdit::handle_event()
1651         int i = 0;
1652         while(1)
1653         {
1654                 AssetPicon *result = (AssetPicon*)mwindow->awindow->gui->asset_list->get_selection(0, i++);
1655                 if(!result) break;
1657                 if(result->label) {
1658                         mwindow->awindow->gui->awindow->label_edit->edit_label(result->label);
1659                         break;
1660                 }
1661         }
1663         return 1;
1666 //      Local Variables:
1667 //      mode: C++
1668 //      c-file-style: "linux"
1669 //      End: