• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files

hvirtual/cinelerra/awindowgui.C

Go to the documentation of this file.
00001 #include "asset.h"
00002 #include "assetedit.h"
00003 #include "assetpopup.h"
00004 #include "assets.h"
00005 #include "awindowgui.h"
00006 #include "awindowgui.inc"
00007 #include "awindow.h"
00008 #include "awindowmenu.h"
00009 #include "bcsignals.h"
00010 #include "cache.h"
00011 #include "colormodels.h"
00012 #include "cursors.h"
00013 #include "cwindowgui.h"
00014 #include "cwindow.h"
00015 #include "edl.h"
00016 #include "edlsession.h"
00017 #include "file.h"
00018 #include "filesystem.h"
00019 #include "language.h"
00020 #include "labels.h"
00021 #include "labeledit.h"
00022 #include "localsession.h"
00023 #include "mainmenu.h"
00024 #include "mainsession.h"
00025 #include "mwindowgui.h"
00026 #include "mwindow.h"
00027 #include "newfolder.h"
00028 #include "preferences.h"
00029 #include "theme.h"
00030 #include "vframe.h"
00031 #include "vwindowgui.h"
00032 #include "vwindow.h"
00033 
00034 
00035 
00036 
00037 AssetPicon::AssetPicon(MWindow *mwindow, 
00038         AWindowGUI *gui, 
00039         Asset *asset)
00040  : BC_ListBoxItem()
00041 {
00042         reset();
00043         this->mwindow = mwindow;
00044         this->gui = gui;
00045         this->asset = asset;
00046         this->id = asset->id;
00047 }
00048 
00049 AssetPicon::AssetPicon(MWindow *mwindow, 
00050         AWindowGUI *gui, 
00051         EDL *edl)
00052  : BC_ListBoxItem()
00053 {
00054         reset();
00055         this->mwindow = mwindow;
00056         this->gui = gui;
00057         this->edl = edl;
00058         this->id = edl->id;
00059 }
00060 
00061 AssetPicon::AssetPicon(MWindow *mwindow, 
00062         AWindowGUI *gui, 
00063         char *folder)
00064  : BC_ListBoxItem(folder, gui->folder_icon)
00065 {
00066         reset();
00067         this->mwindow = mwindow;
00068         this->gui = gui;
00069 }
00070 
00071 AssetPicon::AssetPicon(MWindow *mwindow, 
00072         AWindowGUI *gui, 
00073         PluginServer *plugin)
00074  : BC_ListBoxItem()
00075 {
00076         reset();
00077         this->mwindow = mwindow;
00078         this->gui = gui;
00079         this->plugin = plugin;
00080         asset = 0;
00081         icon = 0;
00082         id = 0;
00083 }
00084 
00085 AssetPicon::AssetPicon(MWindow *mwindow, 
00086         AWindowGUI *gui, 
00087         Label *label)
00088  : BC_ListBoxItem()
00089 {
00090         reset();
00091         this->mwindow = mwindow;
00092         this->gui = gui;
00093         this->label = label;
00094         asset = 0;
00095         icon = 0;
00096         id = 0;
00097 }
00098 
00099 AssetPicon::~AssetPicon()
00100 {
00101         if(icon)
00102         {
00103                 if(icon != gui->file_icon &&
00104                         icon != gui->audio_icon &&
00105                         icon != gui->folder_icon &&
00106                         icon != gui->clip_icon &&
00107                         icon != gui->video_icon) 
00108                 {
00109                         delete icon;
00110                         delete icon_vframe;
00111                 }
00112         }
00113 }
00114 
00115 void AssetPicon::reset()
00116 {
00117         plugin = 0;
00118         label = 0;
00119         asset = 0;
00120         edl = 0;
00121         icon = 0;
00122         icon_vframe = 0;
00123         in_use = 1;
00124         id = 0;
00125         persistent = 0;
00126 }
00127 
00128 void AssetPicon::create_objects()
00129 {
00130         FileSystem fs;
00131         char name[BCTEXTLEN];
00132         int pixmap_w, pixmap_h;
00133 
00134 
00135         pixmap_h = 50;
00136 
00137         if(asset)
00138         {
00139                 fs.extract_name(name, asset->path);
00140                 set_text(name);
00141                 if(asset->video_data)
00142                 {
00143                         if(mwindow->preferences->use_thumbnails)
00144                         {
00145                                 File *file = mwindow->video_cache->check_out(asset, mwindow->edl);
00146 
00147                                 if(file)
00148                                 {
00149                                         pixmap_w = pixmap_h * asset->width / asset->height;
00150 
00151                                         file->set_layer(0);
00152                                         file->set_video_position(0, mwindow->edl->session->frame_rate);
00153 
00154                                         if(gui->temp_picon && 
00155                                                 (gui->temp_picon->get_w() != asset->width ||
00156                                                 gui->temp_picon->get_h() != asset->height))
00157                                         {
00158                                                 delete gui->temp_picon;
00159                                                 gui->temp_picon = 0;
00160                                         }
00161 
00162                                         if(!gui->temp_picon)
00163                                         {
00164                                                 gui->temp_picon = new VFrame(0, 
00165                                                         asset->width, 
00166                                                         asset->height, 
00167                                                         BC_RGB888);
00168                                         }
00169 
00170                                         file->read_frame(gui->temp_picon);
00171 
00172                                         icon = new BC_Pixmap(gui, pixmap_w, pixmap_h);
00173                                         icon->draw_vframe(gui->temp_picon,
00174                                                 0, 
00175                                                 0, 
00176                                                 pixmap_w, 
00177                                                 pixmap_h,
00178                                                 0,
00179                                                 0);
00180 //printf("%d %d\n", gui->temp_picon->get_w(), gui->temp_picon->get_h());
00181                                         icon_vframe = new VFrame(0, 
00182                                                 pixmap_w, 
00183                                                 pixmap_h, 
00184                                                 BC_RGB888);
00185                                         cmodel_transfer(icon_vframe->get_rows(), /* Leave NULL if non existent */
00186                                                 gui->temp_picon->get_rows(),
00187                                                 0, /* Leave NULL if non existent */
00188                                                 0,
00189                                                 0,
00190                                                 0, /* Leave NULL if non existent */
00191                                                 0,
00192                                                 0,
00193                                                 0,        /* Dimensions to capture from input frame */
00194                                                 0, 
00195                                                 gui->temp_picon->get_w(), 
00196                                                 gui->temp_picon->get_h(),
00197                                                 0,       /* Dimensions to project on output frame */
00198                                                 0, 
00199                                                 pixmap_w, 
00200                                                 pixmap_h,
00201                                                 BC_RGB888, 
00202                                                 BC_RGB888,
00203                                                 0,         /* When transfering BC_RGBA8888 to non-alpha this is the background color in 0xRRGGBB hex */
00204                                                 0,       /* For planar use the luma rowspan */
00205                                                 0);     /* For planar use the luma rowspan */
00206 
00207 
00208                                         mwindow->video_cache->check_in(asset);
00209                                 }
00210                                 else
00211                                 {
00212                                         icon = gui->video_icon;
00213                                         icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
00214 
00215                                 }
00216                         }
00217                         else
00218                         {
00219                                 icon = gui->video_icon;
00220                                 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];                  
00221                         }
00222                 }
00223                 else
00224                 if(asset->audio_data)
00225                 {
00226                         icon = gui->audio_icon;
00227                         icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND];
00228                 }
00229 //printf("AssetPicon::create_objects 2\n");
00230 
00231                 set_icon(icon);
00232                 set_icon_vframe(icon_vframe);
00233 //printf("AssetPicon::create_objects 4\n");
00234         }
00235         else
00236         if(edl)
00237         {
00238 //printf("AssetPicon::create_objects 4 %s\n", edl->local_session->clip_title);
00239                 strcpy(name, edl->local_session->clip_title);
00240                 set_text(name);
00241                 set_icon(gui->clip_icon);
00242                 set_icon_vframe(mwindow->theme->get_image("clip_icon"));
00243         }
00244         else
00245         if(plugin)
00246         {
00247                 strcpy(name, _(plugin->title));
00248                 set_text(name);
00249                 if(plugin->picon)
00250                 {
00251                         if(plugin->picon->get_color_model() == BC_RGB888)
00252                         {
00253                                 icon = new BC_Pixmap(gui, 
00254                                         plugin->picon->get_w(), 
00255                                         plugin->picon->get_h());
00256                                 icon->draw_vframe(plugin->picon,
00257                                         0,
00258                                         0,
00259                                         plugin->picon->get_w(), 
00260                                         plugin->picon->get_h(),
00261                                         0,
00262                                         0);
00263                         }
00264                         else
00265                         {
00266                                 icon = new BC_Pixmap(gui, 
00267                                         plugin->picon, 
00268                                         PIXMAP_ALPHA);
00269                         }
00270                         icon_vframe = new VFrame (*plugin->picon);
00271                 }
00272                 else
00273                 {
00274                         icon = gui->file_icon;
00275                         icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN];
00276                 }
00277                 set_icon(icon);
00278                 set_icon_vframe(icon_vframe);
00279         }
00280         else
00281         if(label)
00282         {
00283                 Units::totext(name, 
00284                               label->position,
00285                               mwindow->edl->session->time_format,
00286                               mwindow->edl->session->sample_rate,
00287                               mwindow->edl->session->frame_rate,
00288                               mwindow->edl->session->frames_per_foot);
00289                 set_text(name);
00290                 icon = gui->file_icon;
00291                 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN];
00292                 set_icon(icon);
00293                 set_icon_vframe(icon_vframe);
00294         }
00295 
00296 }
00297 
00298 
00299 
00300 
00301 
00302 
00303 AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow)
00304  : BC_Window(PROGRAM_NAME ": Resources",
00305         mwindow->session->awindow_x, 
00306     mwindow->session->awindow_y, 
00307     mwindow->session->awindow_w, 
00308     mwindow->session->awindow_h,
00309     100,
00310     100,
00311     1,
00312     1,
00313     1)
00314 {
00315 // printf("AWindowGUI::AWindowGUI %d %d %d %d\n",
00316 // mwindow->session->awindow_x, 
00317 // mwindow->session->awindow_y, 
00318 // mwindow->session->awindow_w, 
00319 // mwindow->session->awindow_h);
00320         this->mwindow = mwindow;
00321         this->awindow = awindow;
00322         temp_picon = 0;
00323         allow_iconlisting = 1;
00324 }
00325 
00326 AWindowGUI::~AWindowGUI()
00327 {
00328         assets.remove_all_objects();
00329         folders.remove_all_objects();
00330         aeffects.remove_all_objects();
00331         veffects.remove_all_objects();
00332         atransitions.remove_all_objects();
00333         vtransitions.remove_all_objects();
00334         labellist.remove_all_objects();
00335         displayed_assets[1].remove_all_objects();
00336         delete file_icon;
00337         delete audio_icon;
00338         delete folder_icon;
00339         delete clip_icon;
00340         delete newfolder_thread;
00341         delete asset_menu;
00342         delete label_menu;
00343         delete assetlist_menu;
00344         delete folderlist_menu;
00345         if(temp_picon) delete temp_picon;
00346 }
00347 
00348 int AWindowGUI::create_objects()
00349 {
00350         int x, y;
00351         AssetPicon *picon;
00352 
00353 SET_TRACE
00354 //printf("AWindowGUI::create_objects 1\n");
00355         asset_titles[0] = _("Title");
00356         asset_titles[1] = _("Comments");
00357 
00358 SET_TRACE
00359 
00360         set_icon(mwindow->theme->get_image("awindow_icon"));
00361         file_icon = new BC_Pixmap(this, 
00362                 BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN],
00363                 PIXMAP_ALPHA);
00364 
00365         folder_icon = new BC_Pixmap(this, 
00366                 BC_WindowBase::get_resources()->type_to_icon[ICON_FOLDER],
00367                 PIXMAP_ALPHA);
00368 
00369         audio_icon = new BC_Pixmap(this, 
00370                 BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND],
00371                 PIXMAP_ALPHA);
00372 
00373         video_icon = new BC_Pixmap(this, 
00374                 BC_WindowBase::get_resources()->type_to_icon[ICON_FILM],
00375                 PIXMAP_ALPHA);
00376 
00377 SET_TRACE
00378 
00379         clip_icon = new BC_Pixmap(this, 
00380                 mwindow->theme->get_image("clip_icon"),
00381                 PIXMAP_ALPHA);
00382 
00383 SET_TRACE
00384 
00385 // Mandatory folders
00386         folders.append(picon = new AssetPicon(mwindow,
00387                 this,
00388                 AEFFECT_FOLDER));
00389         picon->persistent = 1;
00390         folders.append(picon = new AssetPicon(mwindow,
00391                 this,
00392                 VEFFECT_FOLDER));
00393         picon->persistent = 1;
00394         folders.append(picon = new AssetPicon(mwindow,
00395                 this,
00396                 ATRANSITION_FOLDER));
00397         picon->persistent = 1;
00398         folders.append(picon = new AssetPicon(mwindow,
00399                 this,
00400                 VTRANSITION_FOLDER));
00401         picon->persistent = 1;
00402         folders.append(picon = new AssetPicon(mwindow,
00403                 this,
00404                 LABEL_FOLDER));
00405         picon->persistent = 1;
00406 
00407         create_label_folder();
00408 
00409 SET_TRACE
00410 
00411         create_persistent_folder(&aeffects, 1, 0, 1, 0);
00412         create_persistent_folder(&veffects, 0, 1, 1, 0);
00413         create_persistent_folder(&atransitions, 1, 0, 0, 1);
00414         create_persistent_folder(&vtransitions, 0, 1, 0, 1);
00415 
00416 SET_TRACE
00417 
00418         mwindow->theme->get_awindow_sizes(this);
00419 
00420 SET_TRACE
00421         add_subwindow(asset_list = new AWindowAssets(mwindow,
00422                 this,
00423                 mwindow->theme->alist_x, 
00424         mwindow->theme->alist_y, 
00425         mwindow->theme->alist_w, 
00426         mwindow->theme->alist_h));
00427 
00428 SET_TRACE
00429         add_subwindow(divider = new AWindowDivider(mwindow,
00430                 this,
00431                 mwindow->theme->adivider_x,
00432                 mwindow->theme->adivider_y,
00433                 mwindow->theme->adivider_w,
00434                 mwindow->theme->adivider_h));
00435 
00436 SET_TRACE
00437         divider->set_cursor(HSEPARATE_CURSOR);
00438 
00439 SET_TRACE
00440         add_subwindow(folder_list = new AWindowFolders(mwindow,
00441                 this,
00442                 mwindow->theme->afolders_x, 
00443         mwindow->theme->afolders_y, 
00444         mwindow->theme->afolders_w, 
00445         mwindow->theme->afolders_h));
00446         
00447 SET_TRACE
00448 
00449         x = mwindow->theme->abuttons_x;
00450         y = mwindow->theme->abuttons_y;
00451 
00452 SET_TRACE
00453 
00454         newfolder_thread = new NewFolderThread(mwindow, this);
00455 
00456         add_subwindow(asset_menu = new AssetPopup(mwindow, this));
00457         asset_menu->create_objects();
00458 
00459         add_subwindow(label_menu = new LabelPopup(mwindow, this));
00460         label_menu->create_objects();
00461 
00462 SET_TRACE
00463 
00464         add_subwindow(assetlist_menu = new AssetListMenu(mwindow, this));
00465 
00466 SET_TRACE
00467         assetlist_menu->create_objects();
00468 
00469 SET_TRACE
00470 
00471         add_subwindow(folderlist_menu = new FolderListMenu(mwindow, this));
00472         folderlist_menu->create_objects();
00473 //printf("AWindowGUI::create_objects 2\n");
00474 
00475 SET_TRACE
00476         create_custom_xatoms();
00477 
00478         return 0;
00479 }
00480 
00481 int AWindowGUI::resize_event(int w, int h)
00482 {
00483         mwindow->session->awindow_x = get_x();
00484         mwindow->session->awindow_y = get_y();
00485         mwindow->session->awindow_w = w;
00486         mwindow->session->awindow_h = h;
00487 
00488         mwindow->theme->get_awindow_sizes(this);
00489         mwindow->theme->draw_awindow_bg(this);
00490 
00491         reposition_objects();
00492 
00493         int x = mwindow->theme->abuttons_x;
00494         int y = mwindow->theme->abuttons_y;
00495 
00496 //      new_bin->reposition_window(x, y);
00497 //      x += new_bin->get_w();
00498 //      delete_bin->reposition_window(x, y);
00499 //      x += delete_bin->get_w();
00500 //      rename_bin->reposition_window(x, y);
00501 //      x += rename_bin->get_w();
00502 //      delete_disk->reposition_window(x, y);
00503 //      x += delete_disk->get_w();
00504 //      delete_project->reposition_window(x, y);
00505 //      x += delete_project->get_w();
00506 //      info->reposition_window(x, y);
00507 //      x += info->get_w();
00508 //      redraw_index->reposition_window(x, y);
00509 //      x += redraw_index->get_w();
00510 //      paste->reposition_window(x, y);
00511 //      x += paste->get_w();
00512 //      append->reposition_window(x, y);
00513 //      x += append->get_w();
00514 //      view->reposition_window(x, y);
00515 
00516         BC_WindowBase::resize_event(w, h);
00517         return 1;
00518 }
00519 
00520 int AWindowGUI::translation_event()
00521 {
00522         mwindow->session->awindow_x = get_x();
00523         mwindow->session->awindow_y = get_y();
00524         return 0;
00525 }
00526 
00527 void AWindowGUI::reposition_objects()
00528 {
00529         int wmax = mwindow->session->awindow_w-mwindow->theme->adivider_w;
00530         int x = mwindow->theme->afolders_x;
00531         int w = mwindow->theme->afolders_w;
00532         if (w > wmax)
00533                 w = wmax;
00534         if (w <= 0)
00535                 w = 1;
00536         folder_list->reposition_window(x, mwindow->theme->afolders_y,
00537                 w, mwindow->theme->afolders_h);
00538         x = mwindow->theme->adivider_x;
00539         if (x > wmax)
00540                 x = wmax;
00541         if (x < 0)
00542                 x = 0;
00543         divider->reposition_window(x,
00544                 mwindow->theme->adivider_y,
00545                 mwindow->theme->adivider_w,
00546                 mwindow->theme->adivider_h);
00547         int x2 = mwindow->theme->alist_x;
00548         if (x2 < x+mwindow->theme->adivider_w)
00549                 x2 = x+mwindow->theme->adivider_w;
00550         w = mwindow->theme->alist_w;
00551         if (w > wmax)
00552                 w = wmax;
00553         if (w <= 0)
00554                 w = 1;
00555         asset_list->reposition_window(x2, mwindow->theme->alist_y,
00556                 w, mwindow->theme->alist_h);
00557         flush();
00558 }
00559 
00560 int AWindowGUI::close_event()
00561 {
00562         hide_window();
00563         mwindow->session->show_awindow = 0;
00564         unlock_window();
00565 
00566         mwindow->gui->lock_window("AWindowGUI::close_event");
00567         mwindow->gui->mainmenu->show_awindow->set_checked(0);
00568         mwindow->gui->unlock_window();
00569 
00570         lock_window("AWindowGUI::close_event");
00571         mwindow->save_defaults();
00572         return 1;
00573 }
00574 
00575 
00576 int AWindowGUI::keypress_event()
00577 {
00578         switch(get_keypress())
00579         {
00580                 case 'w':
00581                 case 'W':
00582                         if(ctrl_down())
00583                         {
00584                                 close_event();
00585                                 return 1;
00586                         }
00587                         break;
00588         }
00589         return 0;
00590 }
00591 
00592 
00593 
00594 int AWindowGUI::create_custom_xatoms()
00595 {
00596         UpdateAssetsXAtom = create_xatom("CWINDOWGUI_UPDATE_ASSETS");
00597         return 0;
00598 }
00599 int AWindowGUI::recieve_custom_xatoms(xatom_event *event)
00600 {
00601         if (event->message_type == UpdateAssetsXAtom)
00602         {
00603                 update_assets();
00604                 return 1;
00605         } else
00606         return 0;
00607 }
00608 
00609 void AWindowGUI::async_update_assets()
00610 {
00611         xatom_event event;
00612         event.message_type = UpdateAssetsXAtom;
00613         send_custom_xatom(&event);
00614 }
00615 
00616 
00617 
00618 
00619 
00620 
00621 
00622 void AWindowGUI::update_folder_list()
00623 {
00624 //printf("AWindowGUI::update_folder_list 1\n");
00625         for(int i = 0; i < folders.total; i++)
00626         {
00627                 AssetPicon *picon = (AssetPicon*)folders.values[i];
00628                 picon->in_use--;
00629         }
00630 //printf("AWindowGUI::update_folder_list 1\n");
00631 
00632 // Search assets for folders
00633         for(int i = 0; i < mwindow->edl->folders.total; i++)
00634         {
00635                 char *folder = mwindow->edl->folders.values[i];
00636                 int exists = 0;
00637 //printf("AWindowGUI::update_folder_list 1.1\n");
00638 
00639                 for(int j = 0; j < folders.total; j++)
00640                 {
00641                         AssetPicon *picon = (AssetPicon*)folders.values[j];
00642                         if(!strcasecmp(picon->get_text(), folder))
00643                         {
00644                                 exists = 1;
00645                                 picon->in_use = 1;
00646                                 break;
00647                         }
00648                 }
00649 
00650                 if(!exists)
00651                 {
00652                         AssetPicon *picon = new AssetPicon(mwindow, this, folder);
00653                         picon->create_objects();
00654                         folders.append(picon);
00655                 }
00656 //printf("AWindowGUI::update_folder_list 1.3\n");
00657         }
00658 //printf("AWindowGUI::update_folder_list 1\n");
00659 //for(int i = 0; i < folders.total; i++)
00660 //      printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
00661 
00662 // Delete excess
00663         for(int i = folders.total - 1; i >= 0; i--)
00664         {
00665                 AssetPicon *picon = (AssetPicon*)folders.values[i];
00666                 if(!picon->in_use && !picon->persistent)
00667                 {
00668                         delete picon;
00669                         folders.remove_number(i);
00670                 }
00671         }
00672 //for(int i = 0; i < folders.total; i++)
00673 //      printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
00674 //printf("AWindowGUI::update_folder_list 2\n");
00675 }
00676 
00677 void AWindowGUI::create_persistent_folder(ArrayList<BC_ListBoxItem*> *output, 
00678         int do_audio, 
00679         int do_video, 
00680         int is_realtime, 
00681         int is_transition)
00682 {
00683         ArrayList<PluginServer*> plugindb;
00684 
00685 // Get pointers to plugindb entries
00686         mwindow->create_plugindb(do_audio, 
00687                         do_video, 
00688                         is_realtime, 
00689                         is_transition,
00690                         0,
00691                         plugindb);
00692 
00693         for(int i = 0; i < plugindb.total; i++)
00694         {
00695                 PluginServer *server = plugindb.values[i];
00696                 int exists = 0;
00697 
00698 // Create new listitem
00699                 if(!exists)
00700                 {
00701                         AssetPicon *picon = new AssetPicon(mwindow, this, server);
00702                         picon->create_objects();
00703                         output->append(picon);
00704                 }
00705         }
00706 }
00707 
00708 void AWindowGUI::create_label_folder()
00709 {
00710         Label *current;
00711         for(current = mwindow->edl->labels->first; current; current = NEXT) {
00712                 AssetPicon *picon = new AssetPicon(mwindow, this, current);
00713                 picon->create_objects();
00714                 labellist.append(picon);
00715         }
00716 }
00717 
00718 
00719 void AWindowGUI::update_asset_list()
00720 {
00721 //printf("AWindowGUI::update_asset_list 1\n");
00722         for(int i = 0; i < assets.total; i++)
00723         {
00724                 AssetPicon *picon = (AssetPicon*)assets.values[i];
00725                 picon->in_use--;
00726         }
00727 
00728 
00729 
00730 
00731 
00732 //printf("AWindowGUI::update_asset_list 2\n");
00733 
00734 
00735 // Synchronize EDL clips
00736         for(int i = 0; i < mwindow->edl->clips.total; i++)
00737         {
00738                 int exists = 0;
00739                 
00740 // Look for clip in existing listitems
00741                 for(int j = 0; j < assets.total && !exists; j++)
00742                 {
00743                         AssetPicon *picon = (AssetPicon*)assets.values[j];
00744                         
00745                         if(picon->id == mwindow->edl->clips.values[i]->id)
00746                         {
00747                                 picon->edl = mwindow->edl->clips.values[i];
00748                                 picon->set_text(mwindow->edl->clips.values[i]->local_session->clip_title);
00749                                 exists = 1;
00750                                 picon->in_use = 1;
00751                         }
00752                 }
00753 
00754 // Create new listitem
00755                 if(!exists)
00756                 {
00757                         AssetPicon *picon = new AssetPicon(mwindow, 
00758                                 this, 
00759                                 mwindow->edl->clips.values[i]);
00760                         picon->create_objects();
00761                         assets.append(picon);
00762                 }
00763         }
00764 
00765 
00766 
00767 
00768 
00769 
00770 
00771 //printf("AWindowGUI::update_asset_list 3 %d\n", assets.total);
00772 // Synchronize EDL assets
00773         for(Asset *current = mwindow->edl->assets->first; 
00774                 current; 
00775                 current = NEXT)
00776         {
00777                 int exists = 0;
00778 
00779 //printf("AWindowGUI::update_asset_list 3 %s\n", current->path);
00780 // Look for asset in existing listitems
00781                 for(int j = 0; j < assets.total && !exists; j++)
00782                 {
00783                         AssetPicon *picon = (AssetPicon*)assets.values[j];
00784 
00785                         if(picon->id == current->id)
00786                         {
00787 //printf("AWindowGUI::update_asset_list 4 %p %d %d\n", picon->asset, picon->get_icon_x(), picon->get_icon_y());
00788                                 picon->asset = current;
00789                                 exists = 1;
00790                                 picon->in_use = 1;
00791                                 break;
00792                         }
00793                 }
00794 
00795 //printf("AWindowGUI::update_asset_list 5\n");
00796 // Create new listitem
00797                 if(!exists)
00798                 {
00799 //printf("AWindowGUI::update_asset_list 4.1 %s\n", current->path);
00800                         AssetPicon *picon = new AssetPicon(mwindow, this, current);
00801 //printf("AWindowGUI::update_asset_list 4.2 %s\n", current->path);
00802                         picon->create_objects();
00803 //printf("AWindowGUI::update_asset_list 4.3 %s\n", current->path);
00804                         assets.append(picon);
00805 //printf("AWindowGUI::update_asset_list 4.4 %s\n", current->path);
00806                 }
00807         }
00808 
00809 
00810 
00811 
00812 
00813 
00814 
00815 
00816 
00817 //printf("AWindowGUI::update_asset_list 6\n");
00818         for(int i = assets.total - 1; i >= 0; i--)
00819         {
00820                 AssetPicon *picon = (AssetPicon*)assets.values[i];
00821 //printf("AWindowGUI::update_asset_list %s %d\n", picon->asset->path, picon->in_use);
00822                 if(!picon->in_use)
00823                 {
00824                         delete picon;
00825                         assets.remove_number(i);
00826                 }
00827         }
00828 //printf("AWindowGUI::update_asset_list 7 %d\n", assets.total);
00829 }
00830 
00831 
00832 
00833 
00834 
00835 void AWindowGUI::sort_assets()
00836 {
00837 //printf("AWindowGUI::sort_assets 1 %s\n", mwindow->edl->session->current_folder);
00838         if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
00839                 sort_picons(&aeffects, 
00840                         0);
00841         else
00842         if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
00843                 sort_picons(&veffects, 
00844                         0);
00845         else
00846         if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
00847                 sort_picons(&atransitions, 
00848                         0);
00849         else
00850         if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
00851                 sort_picons(&vtransitions, 
00852                         0);
00853         else
00854         if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
00855                 ;// Labels should ALWAYS be sorted by time.
00856         else
00857                 sort_picons(&assets, 
00858                         mwindow->edl->session->current_folder);
00859 
00860         update_assets();
00861 }
00862 
00863 
00864 
00865 
00866 
00867 
00868 
00869 
00870 
00871 
00872 
00873 void AWindowGUI::collect_assets()
00874 {
00875         int i = 0;
00876         mwindow->session->drag_assets->remove_all();
00877         mwindow->session->drag_clips->remove_all();
00878         while(1)
00879         {
00880                 AssetPicon *result = (AssetPicon*)asset_list->get_selection(0, i++);
00881                 if(!result) break;
00882 
00883                 if(result->asset) mwindow->session->drag_assets->append(result->asset);
00884                 if(result->edl) mwindow->session->drag_clips->append(result->edl);
00885         }
00886 }
00887 
00888 void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst, 
00889