r1053: Add Russian translation.
[cinelerra_cv.git] / cinelerra / awindowgui.C
blobf9eb10750b514c68b7093afd54eaedd998f9a6fe
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         reposition_objects();
493         int x = mwindow->theme->abuttons_x;
494         int y = mwindow->theme->abuttons_y;
496 //      new_bin->reposition_window(x, y);
497 //      x += new_bin->get_w();
498 //      delete_bin->reposition_window(x, y);
499 //      x += delete_bin->get_w();
500 //      rename_bin->reposition_window(x, y);
501 //      x += rename_bin->get_w();
502 //      delete_disk->reposition_window(x, y);
503 //      x += delete_disk->get_w();
504 //      delete_project->reposition_window(x, y);
505 //      x += delete_project->get_w();
506 //      info->reposition_window(x, y);
507 //      x += info->get_w();
508 //      redraw_index->reposition_window(x, y);
509 //      x += redraw_index->get_w();
510 //      paste->reposition_window(x, y);
511 //      x += paste->get_w();
512 //      append->reposition_window(x, y);
513 //      x += append->get_w();
514 //      view->reposition_window(x, y);
516         BC_WindowBase::resize_event(w, h);
517         return 1;
520 int AWindowGUI::translation_event()
522         mwindow->session->awindow_x = get_x();
523         mwindow->session->awindow_y = get_y();
524         return 0;
527 void AWindowGUI::reposition_objects()
529         int wmax = mwindow->session->awindow_w-mwindow->theme->adivider_w;
530         int x = mwindow->theme->afolders_x;
531         int w = mwindow->theme->afolders_w;
532         if (w > wmax)
533                 w = wmax;
534         if (w <= 0)
535                 w = 1;
536         folder_list->reposition_window(x, mwindow->theme->afolders_y,
537                 w, mwindow->theme->afolders_h);
538         x = mwindow->theme->adivider_x;
539         if (x > wmax)
540                 x = wmax;
541         if (x < 0)
542                 x = 0;
543         divider->reposition_window(x,
544                 mwindow->theme->adivider_y,
545                 mwindow->theme->adivider_w,
546                 mwindow->theme->adivider_h);
547         int x2 = mwindow->theme->alist_x;
548         if (x2 < x+mwindow->theme->adivider_w)
549                 x2 = x+mwindow->theme->adivider_w;
550         w = mwindow->theme->alist_w;
551         if (w > wmax)
552                 w = wmax;
553         if (w <= 0)
554                 w = 1;
555         asset_list->reposition_window(x2, mwindow->theme->alist_y,
556                 w, mwindow->theme->alist_h);
557         flush();
560 int AWindowGUI::close_event()
562         hide_window();
563         mwindow->session->show_awindow = 0;
564         unlock_window();
566         mwindow->gui->lock_window("AWindowGUI::close_event");
567         mwindow->gui->mainmenu->show_awindow->set_checked(0);
568         mwindow->gui->unlock_window();
570         lock_window("AWindowGUI::close_event");
571         mwindow->save_defaults();
572         return 1;
576 int AWindowGUI::keypress_event()
578         switch(get_keypress())
579         {
580                 case 'w':
581                 case 'W':
582                         if(ctrl_down())
583                         {
584                                 close_event();
585                                 return 1;
586                         }
587                         break;
588         }
589         return 0;
594 int AWindowGUI::create_custom_xatoms()
596         UpdateAssetsXAtom = create_xatom("CWINDOWGUI_UPDATE_ASSETS");
597         return 0;
599 int AWindowGUI::recieve_custom_xatoms(xatom_event *event)
601         if (event->message_type == UpdateAssetsXAtom)
602         {
603                 update_assets();
604                 return 1;
605         } else
606         return 0;
609 void AWindowGUI::async_update_assets()
611         xatom_event event;
612         event.message_type = UpdateAssetsXAtom;
613         send_custom_xatom(&event);
622 void AWindowGUI::update_folder_list()
624 //printf("AWindowGUI::update_folder_list 1\n");
625         for(int i = 0; i < folders.total; i++)
626         {
627                 AssetPicon *picon = (AssetPicon*)folders.values[i];
628                 picon->in_use--;
629         }
630 //printf("AWindowGUI::update_folder_list 1\n");
632 // Search assets for folders
633         for(int i = 0; i < mwindow->edl->folders.total; i++)
634         {
635                 char *folder = mwindow->edl->folders.values[i];
636                 int exists = 0;
637 //printf("AWindowGUI::update_folder_list 1.1\n");
639                 for(int j = 0; j < folders.total; j++)
640                 {
641                         AssetPicon *picon = (AssetPicon*)folders.values[j];
642                         if(!strcasecmp(picon->get_text(), folder))
643                         {
644                                 exists = 1;
645                                 picon->in_use = 1;
646                                 break;
647                         }
648                 }
650                 if(!exists)
651                 {
652                         AssetPicon *picon = new AssetPicon(mwindow, this, folder);
653                         picon->create_objects();
654                         folders.append(picon);
655                 }
656 //printf("AWindowGUI::update_folder_list 1.3\n");
657         }
658 //printf("AWindowGUI::update_folder_list 1\n");
659 //for(int i = 0; i < folders.total; i++)
660 //      printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
662 // Delete excess
663         for(int i = folders.total - 1; i >= 0; i--)
664         {
665                 AssetPicon *picon = (AssetPicon*)folders.values[i];
666                 if(!picon->in_use && !picon->persistent)
667                 {
668                         delete picon;
669                         folders.remove_number(i);
670                 }
671         }
672 //for(int i = 0; i < folders.total; i++)
673 //      printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
674 //printf("AWindowGUI::update_folder_list 2\n");
677 void AWindowGUI::create_persistent_folder(ArrayList<BC_ListBoxItem*> *output, 
678         int do_audio, 
679         int do_video, 
680         int is_realtime, 
681         int is_transition)
683         ArrayList<PluginServer*> plugindb;
685 // Get pointers to plugindb entries
686         mwindow->create_plugindb(do_audio, 
687                         do_video, 
688                         is_realtime, 
689                         is_transition,
690                         0,
691                         plugindb);
693         for(int i = 0; i < plugindb.total; i++)
694         {
695                 PluginServer *server = plugindb.values[i];
696                 int exists = 0;
698 // Create new listitem
699                 if(!exists)
700                 {
701                         AssetPicon *picon = new AssetPicon(mwindow, this, server);
702                         picon->create_objects();
703                         output->append(picon);
704                 }
705         }
708 void AWindowGUI::create_label_folder()
710         Label *current;
711         for(current = mwindow->edl->labels->first; current; current = NEXT) {
712                 AssetPicon *picon = new AssetPicon(mwindow, this, current);
713                 picon->create_objects();
714                 labellist.append(picon);
715         }
719 void AWindowGUI::update_asset_list()
721 //printf("AWindowGUI::update_asset_list 1\n");
722         for(int i = 0; i < assets.total; i++)
723         {
724                 AssetPicon *picon = (AssetPicon*)assets.values[i];
725                 picon->in_use--;
726         }
732 //printf("AWindowGUI::update_asset_list 2\n");
735 // Synchronize EDL clips
736         for(int i = 0; i < mwindow->edl->clips.total; i++)
737         {
738                 int exists = 0;
739                 
740 // Look for clip in existing listitems
741                 for(int j = 0; j < assets.total && !exists; j++)
742                 {
743                         AssetPicon *picon = (AssetPicon*)assets.values[j];
744                         
745                         if(picon->id == mwindow->edl->clips.values[i]->id)
746                         {
747                                 picon->edl = mwindow->edl->clips.values[i];
748                                 picon->set_text(mwindow->edl->clips.values[i]->local_session->clip_title);
749                                 exists = 1;
750                                 picon->in_use = 1;
751                         }
752                 }
754 // Create new listitem
755                 if(!exists)
756                 {
757                         AssetPicon *picon = new AssetPicon(mwindow, 
758                                 this, 
759                                 mwindow->edl->clips.values[i]);
760                         picon->create_objects();
761                         assets.append(picon);
762                 }
763         }
771 //printf("AWindowGUI::update_asset_list 3 %d\n", assets.total);
772 // Synchronize EDL assets
773         for(Asset *current = mwindow->edl->assets->first; 
774                 current; 
775                 current = NEXT)
776         {
777                 int exists = 0;
779 //printf("AWindowGUI::update_asset_list 3 %s\n", current->path);
780 // Look for asset in existing listitems
781                 for(int j = 0; j < assets.total && !exists; j++)
782                 {
783                         AssetPicon *picon = (AssetPicon*)assets.values[j];
785                         if(picon->id == current->id)
786                         {
787 //printf("AWindowGUI::update_asset_list 4 %p %d %d\n", picon->asset, picon->get_icon_x(), picon->get_icon_y());
788                                 picon->asset = current;
789                                 exists = 1;
790                                 picon->in_use = 1;
791                                 break;
792                         }
793                 }
795 //printf("AWindowGUI::update_asset_list 5\n");
796 // Create new listitem
797                 if(!exists)
798                 {
799 //printf("AWindowGUI::update_asset_list 4.1 %s\n", current->path);
800                         AssetPicon *picon = new AssetPicon(mwindow, this, current);
801 //printf("AWindowGUI::update_asset_list 4.2 %s\n", current->path);
802                         picon->create_objects();
803 //printf("AWindowGUI::update_asset_list 4.3 %s\n", current->path);
804                         assets.append(picon);
805 //printf("AWindowGUI::update_asset_list 4.4 %s\n", current->path);
806                 }
807         }
817 //printf("AWindowGUI::update_asset_list 6\n");
818         for(int i = assets.total - 1; i >= 0; i--)
819         {
820                 AssetPicon *picon = (AssetPicon*)assets.values[i];
821 //printf("AWindowGUI::update_asset_list %s %d\n", picon->asset->path, picon->in_use);
822                 if(!picon->in_use)
823                 {
824                         delete picon;
825                         assets.remove_number(i);
826                 }
827         }
828 //printf("AWindowGUI::update_asset_list 7 %d\n", assets.total);
835 void AWindowGUI::sort_assets()
837 //printf("AWindowGUI::sort_assets 1 %s\n", mwindow->edl->session->current_folder);
838         if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
839                 sort_picons(&aeffects, 
840                         0);
841         else
842         if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
843                 sort_picons(&veffects, 
844                         0);
845         else
846         if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
847                 sort_picons(&atransitions, 
848                         0);
849         else
850         if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
851                 sort_picons(&vtransitions, 
852                         0);
853         else
854         if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
855                 ;// Labels should ALWAYS be sorted by time.
856         else
857                 sort_picons(&assets, 
858                         mwindow->edl->session->current_folder);
860         update_assets();
873 void AWindowGUI::collect_assets()
875         int i = 0;
876         mwindow->session->drag_assets->remove_all();
877         mwindow->session->drag_clips->remove_all();
878         while(1)
879         {
880                 AssetPicon *result = (AssetPicon*)asset_list->get_selection(0, i++);
881                 if(!result) break;
883                 if(result->asset) mwindow->session->drag_assets->append(result->asset);
884                 if(result->edl) mwindow->session->drag_clips->append(result->edl);
885         }
888 void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst, 
889         ArrayList<BC_ListBoxItem*> *src, 
890         char *folder)
892 // Remove current pointers
893         dst[0].remove_all();
894         dst[1].remove_all_objects();
896 // Create new pointers
897 //if(folder) printf("AWindowGUI::copy_picons 1 %s\n", folder);
898         for(int i = 0; i < src->total; i++)
899         {
900                 AssetPicon *picon = (AssetPicon*)src->values[i];
901 //printf("AWindowGUI::copy_picons 2 %s\n", picon->asset->folder);
902                 if(!folder ||
903                         (folder && picon->asset && !strcasecmp(picon->asset->folder, folder)) ||
904                         (folder && picon->edl && !strcasecmp(picon->edl->local_session->folder, folder)))
905                 {
906                         BC_ListBoxItem *item2, *item1;
907                         dst[0].append(item1 = picon);
908                         if(picon->edl)
909                                 dst[1].append(item2 = new BC_ListBoxItem(picon->edl->local_session->clip_notes));
910                         else
911                         if(picon->label && picon->label->textstr)
912                                 dst[1].append(item2 = new BC_ListBoxItem(picon->label->textstr));
913                         else
914                                 dst[1].append(item2 = new BC_ListBoxItem(""));
915                         item1->set_autoplace_text(1);
916                         item2->set_autoplace_text(1);
917 //printf("AWindowGUI::copy_picons 3 %s\n", picon->get_text());
918                 }
919         }
922 void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src, 
923                 char *folder)
925 //printf("AWindowGUI::sort_picons 1\n")
926         int done = 0;
927         while(!done)
928         {
929                 done = 1;
930                 for(int i = 0; i < src->total - 1; i++)
931                 {
932                         BC_ListBoxItem *item1 = src->values[i];
933                         BC_ListBoxItem *item2 = src->values[i + 1];
934                         item1->set_autoplace_icon(1);
935                         item2->set_autoplace_icon(1);
936                         item1->set_autoplace_text(1);
937                         item2->set_autoplace_text(1);
938                         if(strcmp(item1->get_text(), item2->get_text()) > 0)
939                         {
940                                 src->values[i + 1] = item1;
941                                 src->values[i] = item2;
942                                 done = 0;
943                         }
944                 }
945         }
949 void AWindowGUI::filter_displayed_assets()
951         allow_iconlisting = 1;
952         asset_titles[0] = _("Title");
953         asset_titles[1] = _("Comments");
954         if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
955                 copy_picons(displayed_assets, 
956                         &aeffects, 
957                         0);
958         else
959         if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
960                 copy_picons(displayed_assets, 
961                         &veffects, 
962                         0);
963         else
964         if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
965                 copy_picons(displayed_assets, 
966                         &atransitions, 
967                         0);
968         else
969         if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
970                 copy_picons(displayed_assets, 
971                         &vtransitions, 
972                         0);
973         else
974         if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER)) {
975                 copy_picons(displayed_assets, 
976                             &labellist, 
977                             0);
978                 asset_titles[0] = _("Time Stamps");
979                 asset_titles[1] = _("Title");
980                 allow_iconlisting = 0;
981         }
982         else
983                 copy_picons(displayed_assets, 
984                         &assets, 
985                         mwindow->edl->session->current_folder);
986         // Ensure the current folder icon is highlighted
987         for(int i = 0; i < folders.total; i++)
988         {
989                 if(!strcasecmp(mwindow->edl->session->current_folder, folders.values[i]->get_text()))
990                         folders.values[i]->set_selected(1);
991                 else
992                         folders.values[i]->set_selected(0);
993         }
997 void AWindowGUI::update_assets()
999 //printf("AWindowGUI::update_assets 1\n");
1000         update_folder_list();
1001 //printf("AWindowGUI::update_assets 2\n");
1002         update_asset_list();
1003         labellist.remove_all_objects();
1004         create_label_folder();
1005 //printf("AWindowGUI::update_assets 3\n");
1006         filter_displayed_assets();
1008 //for(int i = 0; i < folders.total; i++)
1009 //printf("AWindowGUI::update_assets 4\n");
1010 //      printf("AWindowGUI::update_assets %s\n", folders.values[i]->get_text());
1011         if(mwindow->edl->session->folderlist_format != folder_list->get_format())
1012                 folder_list->update_format(mwindow->edl->session->folderlist_format, 0);
1013         folder_list->update(&folders,
1014                 0,
1015                 0,
1016                 1,
1017                 folder_list->get_xposition(),
1018                 folder_list->get_yposition(),
1019                 -1);
1020 //printf("AWindowGUI::update_assets 5\n");
1022         if(mwindow->edl->session->assetlist_format != asset_list->get_format())
1023                 asset_list->update_format(mwindow->edl->session->assetlist_format, 0);
1026 //printf("AWindowGUI::update_assets 6 %d\n", displayed_assets[0].total);
1027         asset_list->update(displayed_assets,
1028                 asset_titles,
1029                 mwindow->edl->session->asset_columns,
1030                 ASSET_COLUMNS, 
1031                 asset_list->get_xposition(),
1032                 asset_list->get_yposition(),
1033                 -1,
1034                 0);
1035 //printf("AWindowGUI::update_assets 7\n");
1037         flush();
1038 //printf("AWindowGUI::update_assets 8\n");
1039         return;
1042 int AWindowGUI::current_folder_number()
1044         int result = -1;
1045         for(int i = 0; i < folders.total; i++)
1046         {
1047                 if(!strcasecmp(folders.values[i]->get_text(), mwindow->edl->session->current_folder))
1048                 {
1049                         result = i;
1050                         break;
1051                 }
1052         }
1053         return result;
1056 int AWindowGUI::drag_motion()
1058         if(get_hidden()) return 0;
1060         int result = 0;
1061         return result;
1064 int AWindowGUI::drag_stop()
1066         if(get_hidden()) return 0;
1068         return 0;
1071 Asset* AWindowGUI::selected_asset()
1073         AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1074         if(picon) return picon->asset;
1077 PluginServer* AWindowGUI::selected_plugin()
1079         AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1080         if(picon) return picon->plugin;
1083 AssetPicon* AWindowGUI::selected_folder()
1085         AssetPicon *picon = (AssetPicon*)folder_list->get_selection(0, 0);
1086     return picon;
1098 AWindowDivider::AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1099  : BC_SubWindow(x, y, w, h)
1101         this->mwindow = mwindow;
1102         this->gui = gui;
1104 AWindowDivider::~AWindowDivider()
1108 int AWindowDivider::button_press_event()
1110         if(is_event_win() && cursor_inside())
1111         {
1112                 mwindow->session->current_operation = DRAG_PARTITION;
1113                 return 1;
1114         }
1115         return 0;
1118 int AWindowDivider::cursor_motion_event()
1120         if(mwindow->session->current_operation == DRAG_PARTITION)
1121         {
1122                 mwindow->session->afolders_w = gui->get_relative_cursor_x();
1123                 mwindow->theme->get_awindow_sizes(gui);
1124                 gui->reposition_objects();
1125         }
1126         return 0;
1129 int AWindowDivider::button_release_event()
1131         if(mwindow->session->current_operation == DRAG_PARTITION)
1132         {
1133                 mwindow->session->current_operation = NO_OPERATION;
1134                 return 1;
1135         }
1136         return 0;
1144 AWindowFolders::AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1145  : BC_ListBox(x, 
1146                 y, 
1147                 w, 
1148                 h,
1149                 mwindow->edl->session->folderlist_format == FOLDERS_ICONS ? 
1150                         LISTBOX_ICONS : LISTBOX_TEXT, 
1151                 &gui->folders, // Each column has an ArrayList of BC_ListBoxItems.
1152                 0,             // Titles for columns.  Set to 0 for no titles
1153                 0,                // width of each column
1154                 1,                      // Total columns.
1155                 0,                    // Pixel of top of window.
1156                 0,                        // If this listbox is a popup window
1157                 LISTBOX_SINGLE,  // Select one item or multiple items
1158                 ICON_TOP,        // Position of icon relative to text of each item
1159                 1)               // Allow drags
1161         this->mwindow = mwindow;
1162         this->gui = gui;
1163         set_drag_scroll(0);
1166 AWindowFolders::~AWindowFolders()
1169         
1170 int AWindowFolders::selection_changed()
1172         AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1173         if(picon)
1174         {
1175                 strcpy(mwindow->edl->session->current_folder, picon->get_text());
1176 //printf("AWindowFolders::selection_changed 1\n");
1177                 gui->asset_list->draw_background();
1178                 gui->async_update_assets();
1179         }
1180         return 1;
1183 int AWindowFolders::button_press_event()
1185         int result = 0;
1187         result = BC_ListBox::button_press_event();
1189         if(!result)
1190         {
1191                 if(get_buttonpress() == 3 && is_event_win() && cursor_inside())
1192                 {
1193                         gui->folderlist_menu->update_titles();
1194                         gui->folderlist_menu->activate_menu();
1195                         result = 1;
1196                 }
1197         }
1200         return result;
1209 AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1210  : BC_ListBox(x, 
1211                 y, 
1212                 w, 
1213                 h,
1214                 (mwindow->edl->session->assetlist_format == ASSETS_ICONS && gui->allow_iconlisting ) ? 
1215                         LISTBOX_ICONS : LISTBOX_TEXT,
1216                 &gui->assets,     // Each column has an ArrayList of BC_ListBoxItems.
1217                 gui->asset_titles,             // Titles for columns.  Set to 0 for no titles
1218                 mwindow->edl->session->asset_columns,                // width of each column
1219                 1,                      // Total columns.
1220                 0,                    // Pixel of top of window.
1221                 0,                        // If this listbox is a popup window
1222                 LISTBOX_MULTIPLE,  // Select one item or multiple items
1223                 ICON_TOP,        // Position of icon relative to text of each item
1224                 1)               // Allow drag
1226         this->mwindow = mwindow;
1227         this->gui = gui;
1228         set_drag_scroll(0);
1231 AWindowAssets::~AWindowAssets()
1235 int AWindowAssets::button_press_event()
1237         int result = 0;
1239         result = BC_ListBox::button_press_event();
1241         if(!result && get_buttonpress() == 3 && is_event_win() && cursor_inside())
1242         {
1243                 BC_ListBox::deactivate_selection();
1244                 gui->assetlist_menu->update_titles();
1245                 gui->assetlist_menu->activate_menu();
1246                 result = 1;
1247         }
1250         return result;
1254 int AWindowAssets::handle_event()
1256 //printf("AWindowAssets::handle_event 1 %d %d\n", get_buttonpress(), get_selection(0, 0));
1257         if(get_selection(0, 0))
1258         {
1259                 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1260                 {
1261                 }
1262                 else
1263                 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1264                 {
1265                 }
1266                 else
1267                 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1268                 {
1269                 }
1270                 else
1271                 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1272                 {
1273                 }
1274                 else
1275                 {
1276 //printf("AWindowAssets::handle_event 2 %d %d\n", get_buttonpress(), get_selection(0, 0));
1277                         mwindow->vwindow->gui->lock_window("AWindowAssets::handle_event");
1278                         
1279                         if(((AssetPicon*)get_selection(0, 0))->asset)
1280                                 mwindow->vwindow->change_source(((AssetPicon*)get_selection(0, 0))->asset);
1281                         else
1282                         if(((AssetPicon*)get_selection(0, 0))->edl)
1283                                 mwindow->vwindow->change_source(((AssetPicon*)get_selection(0, 0))->edl);
1285                         mwindow->vwindow->gui->unlock_window();
1286                 }
1287                 return 1;
1288         }
1290         return 0;
1293 int AWindowAssets::selection_changed()
1295 // Show popup window
1296         if(get_button_down() && get_buttonpress() == 3 && get_selection(0, 0))
1297         {
1298                 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER) || 
1299                         !strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER) ||
1300                         !strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER) ||
1301                         !strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1302                 {
1303                         gui->assetlist_menu->update_titles();
1304                         gui->assetlist_menu->activate_menu();
1305                 }
1306                 else
1307                 if (!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER)) 
1308                 {
1309                         if(((AssetPicon*)get_selection(0, 0))->label)
1310                                 gui->label_menu->activate_menu();
1311                 }
1312                 else
1313                 {
1314                         if(((AssetPicon*)get_selection(0, 0))->asset)
1315                                 gui->asset_menu->update();
1316                         else
1317                         if(((AssetPicon*)get_selection(0, 0))->edl)
1318                                 gui->asset_menu->update();
1322                         gui->asset_menu->activate_menu();
1323                 }
1325                 BC_ListBox::deactivate_selection();
1326                 return 1;
1327         }
1328         return 0;
1331 void AWindowAssets::draw_background()
1333         BC_ListBox::draw_background();
1334         set_color(BC_WindowBase::get_resources()->audiovideo_color);
1335         set_font(LARGEFONT);
1336         draw_text(get_w() - 
1337                         get_text_width(LARGEFONT, mwindow->edl->session->current_folder) - 4, 
1338                 30, 
1339                 mwindow->edl->session->current_folder, 
1340                 -1, 
1341                 get_bg_surface());
1344 int AWindowAssets::drag_start_event()
1346         int collect_pluginservers = 0;
1347         int collect_assets = 0;
1349         if(BC_ListBox::drag_start_event())
1350         {
1351                 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1352                 {
1353                         mwindow->session->current_operation = DRAG_AEFFECT;
1354                         collect_pluginservers = 1;
1355                 }
1356                 else
1357                 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1358                 {
1359                         mwindow->session->current_operation = DRAG_VEFFECT;
1360                         collect_pluginservers = 1;
1361                 }
1362                 else
1363                 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1364                 {
1365                         mwindow->session->current_operation = DRAG_ATRANSITION;
1366                         collect_pluginservers = 1;
1367                 }
1368                 else
1369                 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1370                 {
1371                         mwindow->session->current_operation = DRAG_VTRANSITION;
1372                         collect_pluginservers = 1;
1373                 }
1374                 else
1375                 if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
1376                 {
1377                         // do nothing!
1378                 }
1379                 else
1380                 {
1381                         mwindow->session->current_operation = DRAG_ASSET;
1382                         collect_assets = 1;
1383                 }
1384                 
1385                 
1386                 if(collect_pluginservers)
1387                 {
1388                         int i = 0;
1389                         mwindow->session->drag_pluginservers->remove_all();
1390                         while(1)
1391                         {
1392                                 AssetPicon *result = (AssetPicon*)get_selection(0, i++);
1393                                 if(!result) break;
1394                                 
1395                                 mwindow->session->drag_pluginservers->append(result->plugin);
1396                         }
1397                 }
1398                 
1399                 if(collect_assets)
1400                 {
1401                         gui->collect_assets();
1402                 }
1404                 return 1;
1405         }
1406         return 0;
1409 int AWindowAssets::drag_motion_event()
1411         BC_ListBox::drag_motion_event();
1413         mwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1414         mwindow->gui->drag_motion();
1415         mwindow->gui->unlock_window();
1417         mwindow->vwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1418         mwindow->vwindow->gui->drag_motion();
1419         mwindow->vwindow->gui->unlock_window();
1421         mwindow->cwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1422         mwindow->cwindow->gui->drag_motion();
1423         mwindow->cwindow->gui->unlock_window();
1424         return 0;
1427 int AWindowAssets::drag_stop_event()
1429         int result = 0;
1431         result = gui->drag_stop();
1434         if(!result)
1435         {
1436                 mwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1437                 result = mwindow->gui->drag_stop();
1438                 mwindow->gui->unlock_window();
1439         }
1441         if(!result) 
1442         {
1443                 mwindow->vwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1444                 result = mwindow->vwindow->gui->drag_stop();
1445                 mwindow->vwindow->gui->unlock_window();
1446         }
1448         if(!result) 
1449         {
1450                 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1451                 result = mwindow->cwindow->gui->drag_stop();
1452                 mwindow->cwindow->gui->unlock_window();
1453         }
1457         if(result) get_drag_popup()->set_animation(0);
1459         BC_ListBox::drag_stop_event();
1460         mwindow->session->current_operation = ::NO_OPERATION; // since NO_OPERATION is also defined in listbox, we have to reach for global scope...
1461         return 0;
1464 int AWindowAssets::column_resize_event()
1466         mwindow->edl->session->asset_columns[0] = get_column_width(0);
1467         mwindow->edl->session->asset_columns[1] = get_column_width(1);
1468         return 1;
1482 AWindowNewFolder::AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1483  : BC_Button(x, y, mwindow->theme->newbin_data)
1485         this->mwindow = mwindow;
1486         this->gui = gui;
1487         set_tooltip(_("New bin"));
1490 int AWindowNewFolder::handle_event()
1492         gui->newfolder_thread->start_new_folder();
1493         return 1;
1496 AWindowDeleteFolder::AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1497  : BC_Button(x, y, mwindow->theme->deletebin_data)
1499         this->mwindow = mwindow;
1500         this->gui = gui;
1501         set_tooltip(_("Delete bin"));
1504 int AWindowDeleteFolder::handle_event()
1506         if(gui->folder_list->get_selection(0, 0))
1507         {
1508                 BC_ListBoxItem *folder = gui->folder_list->get_selection(0, 0);
1509                 mwindow->delete_folder(folder->get_text());
1510         }
1511         return 1;
1514 AWindowRenameFolder::AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1515  : BC_Button(x, y, mwindow->theme->renamebin_data)
1517         this->mwindow = mwindow;
1518         this->gui = gui;
1519         set_tooltip(_("Rename bin"));
1522 int AWindowRenameFolder::handle_event()
1524         return 1;
1527 AWindowDeleteDisk::AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1528  : BC_Button(x, y, mwindow->theme->deletedisk_data)
1530         this->mwindow = mwindow;
1531         this->gui = gui;
1532         set_tooltip(_("Delete asset from disk"));
1535 int AWindowDeleteDisk::handle_event()
1537         return 1;
1540 AWindowDeleteProject::AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1541  : BC_Button(x, y, mwindow->theme->deleteproject_data)
1543         this->mwindow = mwindow;
1544         this->gui = gui;
1545         set_tooltip(_("Delete asset from project"));
1548 int AWindowDeleteProject::handle_event()
1550         return 1;
1553 AWindowInfo::AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1554  : BC_Button(x, y, mwindow->theme->infoasset_data)
1556         this->mwindow = mwindow;
1557         this->gui = gui;
1558         set_tooltip(_("Edit information on asset"));
1561 int AWindowInfo::handle_event()
1563         gui->awindow->asset_edit->edit_asset(gui->selected_asset());
1564         return 1;
1567 AWindowRedrawIndex::AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1568  : BC_Button(x, y, mwindow->theme->redrawindex_data)
1570         this->mwindow = mwindow;
1571         this->gui = gui;
1572         set_tooltip(_("Redraw index"));
1575 int AWindowRedrawIndex::handle_event()
1577         return 1;
1580 AWindowPaste::AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1581  : BC_Button(x, y, mwindow->theme->pasteasset_data)
1583         this->mwindow = mwindow;
1584         this->gui = gui;
1585         set_tooltip(_("Paste asset on recordable tracks"));
1588 int AWindowPaste::handle_event()
1590         return 1;
1593 AWindowAppend::AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1594  : BC_Button(x, y, mwindow->theme->appendasset_data)
1596         this->mwindow = mwindow;
1597         this->gui = gui;
1598         set_tooltip(_("Append asset in new tracks"));
1601 int AWindowAppend::handle_event()
1603         return 1;
1606 AWindowView::AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1607  : BC_Button(x, y, mwindow->theme->viewasset_data)
1609         this->mwindow = mwindow;
1610         this->gui = gui;
1611         set_tooltip(_("View asset"));
1614 int AWindowView::handle_event()
1616         return 1;
1621 LabelPopup::LabelPopup(MWindow *mwindow, AWindowGUI *gui)
1622  : BC_PopupMenu(0, 
1623                 0, 
1624                 0, 
1625                 "", 
1626                 0)
1628         this->mwindow = mwindow;
1629         this->gui = gui;
1632 LabelPopup::~LabelPopup()
1636 void LabelPopup::create_objects()
1638         add_item(editlabel = new LabelPopupEdit(mwindow, this));
1644 LabelPopupEdit::LabelPopupEdit(MWindow *mwindow, LabelPopup *popup)
1645  : BC_MenuItem(_("Edit..."))
1647         this->mwindow = mwindow;
1648         this->popup = popup;
1651 LabelPopupEdit::~LabelPopupEdit()
1655 int LabelPopupEdit::handle_event()
1657         int i = 0;
1658         while(1)
1659         {
1660                 AssetPicon *result = (AssetPicon*)mwindow->awindow->gui->asset_list->get_selection(0, i++);
1661                 if(!result) break;
1663                 if(result->label) {
1664                         mwindow->awindow->gui->awindow->label_edit->edit_label(result->label);
1665                         break;
1666                 }
1667         }
1669         return 1;