r858: Merge 2.1:
[cinelerra_cv.git] / cinelerra / awindowgui.C
blob2c6a3c815ae060d92cd5e6c8cb15e93d374cca11
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
477         return 0;
480 int AWindowGUI::resize_event(int w, int h)
482         mwindow->session->awindow_x = get_x();
483         mwindow->session->awindow_y = get_y();
484         mwindow->session->awindow_w = w;
485         mwindow->session->awindow_h = h;
487         mwindow->theme->get_awindow_sizes(this);
488         mwindow->theme->draw_awindow_bg(this);
490         asset_list->reposition_window(mwindow->theme->alist_x, 
491         mwindow->theme->alist_y, 
492         mwindow->theme->alist_w, 
493         mwindow->theme->alist_h);
494         divider->reposition_window(mwindow->theme->adivider_x,
495                 mwindow->theme->adivider_y,
496                 mwindow->theme->adivider_w,
497                 mwindow->theme->adivider_h);
498         folder_list->reposition_window(mwindow->theme->afolders_x, 
499         mwindow->theme->afolders_y, 
500         mwindow->theme->afolders_w, 
501         mwindow->theme->afolders_h);
502         
503         int x = mwindow->theme->abuttons_x;
504         int y = mwindow->theme->abuttons_y;
506 //      new_bin->reposition_window(x, y);
507 //      x += new_bin->get_w();
508 //      delete_bin->reposition_window(x, y);
509 //      x += delete_bin->get_w();
510 //      rename_bin->reposition_window(x, y);
511 //      x += rename_bin->get_w();
512 //      delete_disk->reposition_window(x, y);
513 //      x += delete_disk->get_w();
514 //      delete_project->reposition_window(x, y);
515 //      x += delete_project->get_w();
516 //      info->reposition_window(x, y);
517 //      x += info->get_w();
518 //      redraw_index->reposition_window(x, y);
519 //      x += redraw_index->get_w();
520 //      paste->reposition_window(x, y);
521 //      x += paste->get_w();
522 //      append->reposition_window(x, y);
523 //      x += append->get_w();
524 //      view->reposition_window(x, y);
526         BC_WindowBase::resize_event(w, h);
527         return 1;
530 int AWindowGUI::translation_event()
532         mwindow->session->awindow_x = get_x();
533         mwindow->session->awindow_y = get_y();
534         return 0;
537 void AWindowGUI::reposition_objects()
539         mwindow->theme->get_awindow_sizes(this);
540         asset_list->reposition_window(mwindow->theme->alist_x, 
541         mwindow->theme->alist_y, 
542         mwindow->theme->alist_w, 
543         mwindow->theme->alist_h);
544         divider->reposition_window(mwindow->theme->adivider_x,
545                 mwindow->theme->adivider_y,
546                 mwindow->theme->adivider_w,
547                 mwindow->theme->adivider_h);
548         folder_list->reposition_window(mwindow->theme->afolders_x, 
549         mwindow->theme->afolders_y, 
550         mwindow->theme->afolders_w, 
551         mwindow->theme->afolders_h);
552         flush();
555 int AWindowGUI::close_event()
557         hide_window();
558         mwindow->session->show_awindow = 0;
559         unlock_window();
561         mwindow->gui->lock_window("AWindowGUI::close_event");
562         mwindow->gui->mainmenu->show_awindow->set_checked(0);
563         mwindow->gui->unlock_window();
565         lock_window("AWindowGUI::close_event");
566         mwindow->save_defaults();
567         return 1;
571 int AWindowGUI::keypress_event()
573         switch(get_keypress())
574         {
575                 case 'w':
576                 case 'W':
577                         if(ctrl_down())
578                         {
579                                 close_event();
580                                 return 1;
581                         }
582                         break;
583         }
584         return 0;
587 void AWindowGUI::update_folder_list()
589 //printf("AWindowGUI::update_folder_list 1\n");
590         for(int i = 0; i < folders.total; i++)
591         {
592                 AssetPicon *picon = (AssetPicon*)folders.values[i];
593                 picon->in_use--;
594         }
595 //printf("AWindowGUI::update_folder_list 1\n");
597 // Search assets for folders
598         for(int i = 0; i < mwindow->edl->folders.total; i++)
599         {
600                 char *folder = mwindow->edl->folders.values[i];
601                 int exists = 0;
602 //printf("AWindowGUI::update_folder_list 1.1\n");
604                 for(int j = 0; j < folders.total; j++)
605                 {
606                         AssetPicon *picon = (AssetPicon*)folders.values[j];
607                         if(!strcasecmp(picon->get_text(), folder))
608                         {
609                                 exists = 1;
610                                 picon->in_use = 1;
611                                 break;
612                         }
613                 }
615                 if(!exists)
616                 {
617                         AssetPicon *picon = new AssetPicon(mwindow, this, folder);
618                         picon->create_objects();
619                         folders.append(picon);
620                 }
621 //printf("AWindowGUI::update_folder_list 1.3\n");
622         }
623 //printf("AWindowGUI::update_folder_list 1\n");
624 //for(int i = 0; i < folders.total; i++)
625 //      printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
627 // Delete excess
628         for(int i = folders.total - 1; i >= 0; i--)
629         {
630                 AssetPicon *picon = (AssetPicon*)folders.values[i];
631                 if(!picon->in_use && !picon->persistent)
632                 {
633                         delete picon;
634                         folders.remove_number(i);
635                 }
636         }
637 //for(int i = 0; i < folders.total; i++)
638 //      printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
639 //printf("AWindowGUI::update_folder_list 2\n");
642 void AWindowGUI::create_persistent_folder(ArrayList<BC_ListBoxItem*> *output, 
643         int do_audio, 
644         int do_video, 
645         int is_realtime, 
646         int is_transition)
648         ArrayList<PluginServer*> plugindb;
650 // Get pointers to plugindb entries
651         mwindow->create_plugindb(do_audio, 
652                         do_video, 
653                         is_realtime, 
654                         is_transition,
655                         0,
656                         plugindb);
658         for(int i = 0; i < plugindb.total; i++)
659         {
660                 PluginServer *server = plugindb.values[i];
661                 int exists = 0;
663 // Create new listitem
664                 if(!exists)
665                 {
666                         AssetPicon *picon = new AssetPicon(mwindow, this, server);
667                         picon->create_objects();
668                         output->append(picon);
669                 }
670         }
673 void AWindowGUI::create_label_folder()
675         Label *current;
676         for(current = mwindow->edl->labels->first; current; current = NEXT) {
677                 AssetPicon *picon = new AssetPicon(mwindow, this, current);
678                 picon->create_objects();
679                 labellist.append(picon);
680         }
684 void AWindowGUI::update_asset_list()
686 //printf("AWindowGUI::update_asset_list 1\n");
687         for(int i = 0; i < assets.total; i++)
688         {
689                 AssetPicon *picon = (AssetPicon*)assets.values[i];
690                 picon->in_use--;
691         }
697 //printf("AWindowGUI::update_asset_list 2\n");
700 // Synchronize EDL clips
701         for(int i = 0; i < mwindow->edl->clips.total; i++)
702         {
703                 int exists = 0;
704                 
705 // Look for clip in existing listitems
706                 for(int j = 0; j < assets.total && !exists; j++)
707                 {
708                         AssetPicon *picon = (AssetPicon*)assets.values[j];
709                         
710                         if(picon->id == mwindow->edl->clips.values[i]->id)
711                         {
712                                 picon->edl = mwindow->edl->clips.values[i];
713                                 picon->set_text(mwindow->edl->clips.values[i]->local_session->clip_title);
714                                 exists = 1;
715                                 picon->in_use = 1;
716                         }
717                 }
719 // Create new listitem
720                 if(!exists)
721                 {
722                         AssetPicon *picon = new AssetPicon(mwindow, 
723                                 this, 
724                                 mwindow->edl->clips.values[i]);
725                         picon->create_objects();
726                         assets.append(picon);
727                 }
728         }
736 //printf("AWindowGUI::update_asset_list 3 %d\n", assets.total);
737 // Synchronize EDL assets
738         for(Asset *current = mwindow->edl->assets->first; 
739                 current; 
740                 current = NEXT)
741         {
742                 int exists = 0;
744 //printf("AWindowGUI::update_asset_list 3 %s\n", current->path);
745 // Look for asset in existing listitems
746                 for(int j = 0; j < assets.total && !exists; j++)
747                 {
748                         AssetPicon *picon = (AssetPicon*)assets.values[j];
750                         if(picon->id == current->id)
751                         {
752 //printf("AWindowGUI::update_asset_list 4 %p %d %d\n", picon->asset, picon->get_icon_x(), picon->get_icon_y());
753                                 picon->asset = current;
754                                 exists = 1;
755                                 picon->in_use = 1;
756                                 break;
757                         }
758                 }
760 //printf("AWindowGUI::update_asset_list 5\n");
761 // Create new listitem
762                 if(!exists)
763                 {
764 //printf("AWindowGUI::update_asset_list 4.1 %s\n", current->path);
765                         AssetPicon *picon = new AssetPicon(mwindow, this, current);
766 //printf("AWindowGUI::update_asset_list 4.2 %s\n", current->path);
767                         picon->create_objects();
768 //printf("AWindowGUI::update_asset_list 4.3 %s\n", current->path);
769                         assets.append(picon);
770 //printf("AWindowGUI::update_asset_list 4.4 %s\n", current->path);
771                 }
772         }
782 //printf("AWindowGUI::update_asset_list 6\n");
783         for(int i = assets.total - 1; i >= 0; i--)
784         {
785                 AssetPicon *picon = (AssetPicon*)assets.values[i];
786 //printf("AWindowGUI::update_asset_list %s %d\n", picon->asset->path, picon->in_use);
787                 if(!picon->in_use)
788                 {
789                         delete picon;
790                         assets.remove_number(i);
791                 }
792         }
793 //printf("AWindowGUI::update_asset_list 7 %d\n", assets.total);
800 void AWindowGUI::sort_assets()
802 //printf("AWindowGUI::sort_assets 1 %s\n", mwindow->edl->session->current_folder);
803         if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
804                 sort_picons(&aeffects, 
805                         0);
806         else
807         if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
808                 sort_picons(&veffects, 
809                         0);
810         else
811         if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
812                 sort_picons(&atransitions, 
813                         0);
814         else
815         if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
816                 sort_picons(&vtransitions, 
817                         0);
818         else
819         if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
820                 ;// Labels should ALWAYS be sorted by time.
821         else
822                 sort_picons(&assets, 
823                         mwindow->edl->session->current_folder);
825         update_assets();
838 void AWindowGUI::collect_assets()
840         int i = 0;
841         mwindow->session->drag_assets->remove_all();
842         mwindow->session->drag_clips->remove_all();
843         while(1)
844         {
845                 AssetPicon *result = (AssetPicon*)asset_list->get_selection(0, i++);
846                 if(!result) break;
848                 if(result->asset) mwindow->session->drag_assets->append(result->asset);
849                 if(result->edl) mwindow->session->drag_clips->append(result->edl);
850         }
853 void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst, 
854         ArrayList<BC_ListBoxItem*> *src, 
855         char *folder)
857 // Remove current pointers
858         dst[0].remove_all();
859         dst[1].remove_all_objects();
861 // Create new pointers
862 //if(folder) printf("AWindowGUI::copy_picons 1 %s\n", folder);
863         for(int i = 0; i < src->total; i++)
864         {
865                 AssetPicon *picon = (AssetPicon*)src->values[i];
866 //printf("AWindowGUI::copy_picons 2 %s\n", picon->asset->folder);
867                 if(!folder ||
868                         (folder && picon->asset && !strcasecmp(picon->asset->folder, folder)) ||
869                         (folder && picon->edl && !strcasecmp(picon->edl->local_session->folder, folder)))
870                 {
871                         BC_ListBoxItem *item2, *item1;
872                         dst[0].append(item1 = picon);
873                         if(picon->edl)
874                                 dst[1].append(item2 = new BC_ListBoxItem(picon->edl->local_session->clip_notes));
875                         else
876                         if(picon->label && picon->label->textstr)
877                                 dst[1].append(item2 = new BC_ListBoxItem(picon->label->textstr));
878                         else
879                                 dst[1].append(item2 = new BC_ListBoxItem(""));
880                         item1->set_autoplace_text(1);
881                         item2->set_autoplace_text(1);
882 //printf("AWindowGUI::copy_picons 3 %s\n", picon->get_text());
883                 }
884         }
887 void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src, 
888                 char *folder)
890 //printf("AWindowGUI::sort_picons 1\n")
891         int done = 0;
892         while(!done)
893         {
894                 done = 1;
895                 for(int i = 0; i < src->total - 1; i++)
896                 {
897                         BC_ListBoxItem *item1 = src->values[i];
898                         BC_ListBoxItem *item2 = src->values[i + 1];
899                         item1->set_autoplace_icon(1);
900                         item2->set_autoplace_icon(1);
901                         item1->set_autoplace_text(1);
902                         item2->set_autoplace_text(1);
903                         if(strcmp(item1->get_text(), item2->get_text()) > 0)
904                         {
905                                 src->values[i + 1] = item1;
906                                 src->values[i] = item2;
907                                 done = 0;
908                         }
909                 }
910         }
914 void AWindowGUI::filter_displayed_assets()
916         allow_iconlisting = 1;
917         asset_titles[0] = _("Title");
918         asset_titles[1] = _("Comments");
919         if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
920                 copy_picons(displayed_assets, 
921                         &aeffects, 
922                         0);
923         else
924         if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
925                 copy_picons(displayed_assets, 
926                         &veffects, 
927                         0);
928         else
929         if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
930                 copy_picons(displayed_assets, 
931                         &atransitions, 
932                         0);
933         else
934         if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
935                 copy_picons(displayed_assets, 
936                         &vtransitions, 
937                         0);
938         else
939         if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER)) {
940                 copy_picons(displayed_assets, 
941                             &labellist, 
942                             0);
943                 asset_titles[0] = _("Time Stamps");
944                 asset_titles[1] = _("Title");
945                 allow_iconlisting = 0;
946         }
947         else
948                 copy_picons(displayed_assets, 
949                         &assets, 
950                         mwindow->edl->session->current_folder);
951         // Ensure the current folder icon is highlighted
952         for(int i = 0; i < folders.total; i++)
953         {
954                 if(!strcasecmp(mwindow->edl->session->current_folder, folders.values[i]->get_text()))
955                         folders.values[i]->set_selected(1);
956                 else
957                         folders.values[i]->set_selected(0);
958         }
962 void AWindowGUI::update_assets()
964 //printf("AWindowGUI::update_assets 1\n");
965         update_folder_list();
966 //printf("AWindowGUI::update_assets 2\n");
967         update_asset_list();
968         labellist.remove_all_objects();
969         create_label_folder();
970 //printf("AWindowGUI::update_assets 3\n");
971         filter_displayed_assets();
973 //for(int i = 0; i < folders.total; i++)
974 //printf("AWindowGUI::update_assets 4\n");
975 //      printf("AWindowGUI::update_assets %s\n", folders.values[i]->get_text());
976         if(mwindow->edl->session->folderlist_format != folder_list->get_format())
977                 folder_list->update_format(mwindow->edl->session->folderlist_format, 0);
978         folder_list->update(&folders,
979                 0,
980                 0,
981                 1,
982                 folder_list->get_xposition(),
983                 folder_list->get_yposition(),
984                 -1);
985 //printf("AWindowGUI::update_assets 5\n");
987         if(mwindow->edl->session->assetlist_format != asset_list->get_format())
988                 asset_list->update_format(mwindow->edl->session->assetlist_format, 0);
991 //printf("AWindowGUI::update_assets 6 %d\n", displayed_assets[0].total);
992         asset_list->update(displayed_assets,
993                 asset_titles,
994                 mwindow->edl->session->asset_columns,
995                 ASSET_COLUMNS, 
996                 asset_list->get_xposition(),
997                 asset_list->get_yposition(),
998                 -1,
999                 0);
1000 //printf("AWindowGUI::update_assets 7\n");
1002         flush();
1003 //printf("AWindowGUI::update_assets 8\n");
1004         return;
1007 int AWindowGUI::current_folder_number()
1009         int result = -1;
1010         for(int i = 0; i < folders.total; i++)
1011         {
1012                 if(!strcasecmp(folders.values[i]->get_text(), mwindow->edl->session->current_folder))
1013                 {
1014                         result = i;
1015                         break;
1016                 }
1017         }
1018         return result;
1021 int AWindowGUI::drag_motion()
1023         if(get_hidden()) return 0;
1025         int result = 0;
1026         return result;
1029 int AWindowGUI::drag_stop()
1031         if(get_hidden()) return 0;
1033         return 0;
1036 Asset* AWindowGUI::selected_asset()
1038         AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1039         if(picon) return picon->asset;
1042 PluginServer* AWindowGUI::selected_plugin()
1044         AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1045         if(picon) return picon->plugin;
1048 AssetPicon* AWindowGUI::selected_folder()
1050         AssetPicon *picon = (AssetPicon*)folder_list->get_selection(0, 0);
1051     return picon;
1063 AWindowDivider::AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1064  : BC_SubWindow(x, y, w, h)
1066         this->mwindow = mwindow;
1067         this->gui = gui;
1069 AWindowDivider::~AWindowDivider()
1073 int AWindowDivider::button_press_event()
1075         if(is_event_win() && cursor_inside())
1076         {
1077                 mwindow->session->current_operation = DRAG_PARTITION;
1078                 return 1;
1079         }
1080         return 0;
1083 int AWindowDivider::cursor_motion_event()
1085         if(mwindow->session->current_operation == DRAG_PARTITION)
1086         {
1087                 mwindow->session->afolders_w = gui->get_relative_cursor_x();
1088                 gui->reposition_objects();
1089         }
1090         return 0;
1093 int AWindowDivider::button_release_event()
1095         if(mwindow->session->current_operation == DRAG_PARTITION)
1096         {
1097                 mwindow->session->current_operation = NO_OPERATION;
1098                 return 1;
1099         }
1100         return 0;
1108 AWindowFolders::AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1109  : BC_ListBox(x, 
1110                 y, 
1111                 w, 
1112                 h,
1113                 mwindow->edl->session->folderlist_format == FOLDERS_ICONS ? 
1114                         LISTBOX_ICONS : LISTBOX_TEXT, 
1115                 &gui->folders, // Each column has an ArrayList of BC_ListBoxItems.
1116                 0,             // Titles for columns.  Set to 0 for no titles
1117                 0,                // width of each column
1118                 1,                      // Total columns.
1119                 0,                    // Pixel of top of window.
1120                 0,                        // If this listbox is a popup window
1121                 LISTBOX_SINGLE,  // Select one item or multiple items
1122                 ICON_TOP,        // Position of icon relative to text of each item
1123                 1)               // Allow drags
1125         this->mwindow = mwindow;
1126         this->gui = gui;
1127         set_drag_scroll(0);
1130 AWindowFolders::~AWindowFolders()
1133         
1134 int AWindowFolders::selection_changed()
1136         AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1137         if(picon)
1138         {
1139                 strcpy(mwindow->edl->session->current_folder, picon->get_text());
1140 //printf("AWindowFolders::selection_changed 1\n");
1141                 gui->asset_list->draw_background();
1142                 gui->update_assets();
1143         }
1144         return 1;
1147 int AWindowFolders::button_press_event()
1149         int result = 0;
1151         result = BC_ListBox::button_press_event();
1153         if(!result)
1154         {
1155                 if(get_buttonpress() == 3 && is_event_win() && cursor_inside())
1156                 {
1157                         gui->folderlist_menu->update_titles();
1158                         gui->folderlist_menu->activate_menu();
1159                         result = 1;
1160                 }
1161         }
1164         return result;
1173 AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1174  : BC_ListBox(x, 
1175                 y, 
1176                 w, 
1177                 h,
1178                 (mwindow->edl->session->assetlist_format == ASSETS_ICONS && gui->allow_iconlisting ) ? 
1179                         LISTBOX_ICONS : LISTBOX_TEXT,
1180                 &gui->assets,     // Each column has an ArrayList of BC_ListBoxItems.
1181                 gui->asset_titles,             // Titles for columns.  Set to 0 for no titles
1182                 mwindow->edl->session->asset_columns,                // width of each column
1183                 1,                      // Total columns.
1184                 0,                    // Pixel of top of window.
1185                 0,                        // If this listbox is a popup window
1186                 LISTBOX_MULTIPLE,  // Select one item or multiple items
1187                 ICON_TOP,        // Position of icon relative to text of each item
1188                 1)               // Allow drag
1190         this->mwindow = mwindow;
1191         this->gui = gui;
1192         set_drag_scroll(0);
1195 AWindowAssets::~AWindowAssets()
1199 int AWindowAssets::button_press_event()
1201         int result = 0;
1203         result = BC_ListBox::button_press_event();
1205         if(!result && get_buttonpress() == 3 && is_event_win() && cursor_inside())
1206         {
1207                 BC_ListBox::deactivate_selection();
1208                 gui->assetlist_menu->update_titles();
1209                 gui->assetlist_menu->activate_menu();
1210                 result = 1;
1211         }
1214         return result;
1218 int AWindowAssets::handle_event()
1220 //printf("AWindowAssets::handle_event 1 %d %d\n", get_buttonpress(), get_selection(0, 0));
1221         if(get_selection(0, 0))
1222         {
1223                 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1224                 {
1225                 }
1226                 else
1227                 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1228                 {
1229                 }
1230                 else
1231                 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1232                 {
1233                 }
1234                 else
1235                 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1236                 {
1237                 }
1238                 else
1239                 {
1240 //printf("AWindowAssets::handle_event 2 %d %d\n", get_buttonpress(), get_selection(0, 0));
1241                         mwindow->vwindow->gui->lock_window("AWindowAssets::handle_event");
1242                         
1243                         if(((AssetPicon*)get_selection(0, 0))->asset)
1244                                 mwindow->vwindow->change_source(((AssetPicon*)get_selection(0, 0))->asset);
1245                         else
1246                         if(((AssetPicon*)get_selection(0, 0))->edl)
1247                                 mwindow->vwindow->change_source(((AssetPicon*)get_selection(0, 0))->edl);
1249                         mwindow->vwindow->gui->unlock_window();
1250                 }
1251                 return 1;
1252         }
1254         return 0;
1257 int AWindowAssets::selection_changed()
1259 // Show popup window
1260         if(get_button_down() && get_buttonpress() == 3 && get_selection(0, 0))
1261         {
1262                 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER) || 
1263                         !strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER) ||
1264                         !strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER) ||
1265                         !strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1266                 {
1267                         gui->assetlist_menu->update_titles();
1268                         gui->assetlist_menu->activate_menu();
1269                 }
1270                 else
1271                 if (!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER)) 
1272                 {
1273                         if(((AssetPicon*)get_selection(0, 0))->label)
1274                                 gui->label_menu->activate_menu();
1275                 }
1276                 else
1277                 {
1278                         if(((AssetPicon*)get_selection(0, 0))->asset)
1279                                 gui->asset_menu->update();
1280                         else
1281                         if(((AssetPicon*)get_selection(0, 0))->edl)
1282                                 gui->asset_menu->update();
1286                         gui->asset_menu->activate_menu();
1287                 }
1289                 BC_ListBox::deactivate_selection();
1290                 return 1;
1291         }
1292         return 0;
1295 void AWindowAssets::draw_background()
1297         BC_ListBox::draw_background();
1298         set_color(BC_WindowBase::get_resources()->audiovideo_color);
1299         set_font(LARGEFONT);
1300         draw_text(get_w() - 
1301                         get_text_width(LARGEFONT, mwindow->edl->session->current_folder) - 4, 
1302                 30, 
1303                 mwindow->edl->session->current_folder, 
1304                 -1, 
1305                 get_bg_surface());
1308 int AWindowAssets::drag_start_event()
1310         int collect_pluginservers = 0;
1311         int collect_assets = 0;
1313         if(BC_ListBox::drag_start_event())
1314         {
1315                 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1316                 {
1317                         mwindow->session->current_operation = DRAG_AEFFECT;
1318                         collect_pluginservers = 1;
1319                 }
1320                 else
1321                 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1322                 {
1323                         mwindow->session->current_operation = DRAG_VEFFECT;
1324                         collect_pluginservers = 1;
1325                 }
1326                 else
1327                 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1328                 {
1329                         mwindow->session->current_operation = DRAG_ATRANSITION;
1330                         collect_pluginservers = 1;
1331                 }
1332                 else
1333                 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1334                 {
1335                         mwindow->session->current_operation = DRAG_VTRANSITION;
1336                         collect_pluginservers = 1;
1337                 }
1338                 else
1339                 if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
1340                 {
1341                         // do nothing!
1342                 }
1343                 else
1344                 {
1345                         mwindow->session->current_operation = DRAG_ASSET;
1346                         collect_assets = 1;
1347                 }
1348                 
1349                 
1350                 if(collect_pluginservers)
1351                 {
1352                         int i = 0;
1353                         mwindow->session->drag_pluginservers->remove_all();
1354                         while(1)
1355                         {
1356                                 AssetPicon *result = (AssetPicon*)get_selection(0, i++);
1357                                 if(!result) break;
1358                                 
1359                                 mwindow->session->drag_pluginservers->append(result->plugin);
1360                         }
1361                 }
1362                 
1363                 if(collect_assets)
1364                 {
1365                         gui->collect_assets();
1366                 }
1368                 return 1;
1369         }
1370         return 0;
1373 int AWindowAssets::drag_motion_event()
1375         BC_ListBox::drag_motion_event();
1377         mwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1378         mwindow->gui->drag_motion();
1379         mwindow->gui->unlock_window();
1381         mwindow->vwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1382         mwindow->vwindow->gui->drag_motion();
1383         mwindow->vwindow->gui->unlock_window();
1385         mwindow->cwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1386         mwindow->cwindow->gui->drag_motion();
1387         mwindow->cwindow->gui->unlock_window();
1388         return 0;
1391 int AWindowAssets::drag_stop_event()
1393         int result = 0;
1395         result = gui->drag_stop();
1398         if(!result)
1399         {
1400                 mwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1401                 result = mwindow->gui->drag_stop();
1402                 mwindow->gui->unlock_window();
1403         }
1405         if(!result) 
1406         {
1407                 mwindow->vwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1408                 result = mwindow->vwindow->gui->drag_stop();
1409                 mwindow->vwindow->gui->unlock_window();
1410         }
1412         if(!result) 
1413         {
1414                 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1415                 result = mwindow->cwindow->gui->drag_stop();
1416                 mwindow->cwindow->gui->unlock_window();
1417         }
1421         if(result) get_drag_popup()->set_animation(0);
1423         BC_ListBox::drag_stop_event();
1424         mwindow->session->current_operation = ::NO_OPERATION; // since NO_OPERATION is also defined in listbox, we have to reach for global scope...
1425         return 0;
1428 int AWindowAssets::column_resize_event()
1430         mwindow->edl->session->asset_columns[0] = get_column_width(0);
1431         mwindow->edl->session->asset_columns[1] = get_column_width(1);
1432         return 1;
1446 AWindowNewFolder::AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1447  : BC_Button(x, y, mwindow->theme->newbin_data)
1449         this->mwindow = mwindow;
1450         this->gui = gui;
1451         set_tooltip(_("New bin"));
1454 int AWindowNewFolder::handle_event()
1456         gui->newfolder_thread->start_new_folder();
1457         return 1;
1460 AWindowDeleteFolder::AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1461  : BC_Button(x, y, mwindow->theme->deletebin_data)
1463         this->mwindow = mwindow;
1464         this->gui = gui;
1465         set_tooltip(_("Delete bin"));
1468 int AWindowDeleteFolder::handle_event()
1470         if(gui->folder_list->get_selection(0, 0))
1471         {
1472                 BC_ListBoxItem *folder = gui->folder_list->get_selection(0, 0);
1473                 mwindow->delete_folder(folder->get_text());
1474         }
1475         return 1;
1478 AWindowRenameFolder::AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1479  : BC_Button(x, y, mwindow->theme->renamebin_data)
1481         this->mwindow = mwindow;
1482         this->gui = gui;
1483         set_tooltip(_("Rename bin"));
1486 int AWindowRenameFolder::handle_event()
1488         return 1;
1491 AWindowDeleteDisk::AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1492  : BC_Button(x, y, mwindow->theme->deletedisk_data)
1494         this->mwindow = mwindow;
1495         this->gui = gui;
1496         set_tooltip(_("Delete asset from disk"));
1499 int AWindowDeleteDisk::handle_event()
1501         return 1;
1504 AWindowDeleteProject::AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1505  : BC_Button(x, y, mwindow->theme->deleteproject_data)
1507         this->mwindow = mwindow;
1508         this->gui = gui;
1509         set_tooltip(_("Delete asset from project"));
1512 int AWindowDeleteProject::handle_event()
1514         return 1;
1517 AWindowInfo::AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1518  : BC_Button(x, y, mwindow->theme->infoasset_data)
1520         this->mwindow = mwindow;
1521         this->gui = gui;
1522         set_tooltip(_("Edit information on asset"));
1525 int AWindowInfo::handle_event()
1527         gui->awindow->asset_edit->edit_asset(gui->selected_asset());
1528         return 1;
1531 AWindowRedrawIndex::AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1532  : BC_Button(x, y, mwindow->theme->redrawindex_data)
1534         this->mwindow = mwindow;
1535         this->gui = gui;
1536         set_tooltip(_("Redraw index"));
1539 int AWindowRedrawIndex::handle_event()
1541         return 1;
1544 AWindowPaste::AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1545  : BC_Button(x, y, mwindow->theme->pasteasset_data)
1547         this->mwindow = mwindow;
1548         this->gui = gui;
1549         set_tooltip(_("Paste asset on recordable tracks"));
1552 int AWindowPaste::handle_event()
1554         return 1;
1557 AWindowAppend::AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1558  : BC_Button(x, y, mwindow->theme->appendasset_data)
1560         this->mwindow = mwindow;
1561         this->gui = gui;
1562         set_tooltip(_("Append asset in new tracks"));
1565 int AWindowAppend::handle_event()
1567         return 1;
1570 AWindowView::AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1571  : BC_Button(x, y, mwindow->theme->viewasset_data)
1573         this->mwindow = mwindow;
1574         this->gui = gui;
1575         set_tooltip(_("View asset"));
1578 int AWindowView::handle_event()
1580         return 1;
1585 LabelPopup::LabelPopup(MWindow *mwindow, AWindowGUI *gui)
1586  : BC_PopupMenu(0, 
1587                 0, 
1588                 0, 
1589                 "", 
1590                 0)
1592         this->mwindow = mwindow;
1593         this->gui = gui;
1596 LabelPopup::~LabelPopup()
1600 void LabelPopup::create_objects()
1602         add_item(editlabel = new LabelPopupEdit(mwindow, this));
1608 LabelPopupEdit::LabelPopupEdit(MWindow *mwindow, LabelPopup *popup)
1609  : BC_MenuItem(_("Edit..."))
1611         this->mwindow = mwindow;
1612         this->popup = popup;
1615 LabelPopupEdit::~LabelPopupEdit()
1619 int LabelPopupEdit::handle_event()
1621         int i = 0;
1622         while(1)
1623         {
1624                 AssetPicon *result = (AssetPicon*)mwindow->awindow->gui->asset_list->get_selection(0, i++);
1625                 if(!result) break;
1627                 if(result->label) {
1628                         mwindow->awindow->gui->awindow->label_edit->edit_label(result->label);
1629                         break;
1630                 }
1631         }
1633         return 1;