3 #include "assetpopup.h"
5 #include "awindowgui.h"
6 #include "awindowgui.inc"
8 #include "awindowmenu.h"
10 #include "colormodels.h"
12 #include "cwindowgui.h"
15 #include "edlsession.h"
17 #include "filesystem.h"
19 #include "localsession.h"
21 #include "mainsession.h"
22 #include "mwindowgui.h"
24 #include "newfolder.h"
25 #include "preferences.h"
28 #include "vwindowgui.h"
34 AssetPicon::AssetPicon(MWindow *mwindow,
40 this->mwindow = mwindow;
46 AssetPicon::AssetPicon(MWindow *mwindow,
52 this->mwindow = mwindow;
58 AssetPicon::AssetPicon(MWindow *mwindow,
61 : BC_ListBoxItem(folder, gui->folder_icon)
64 this->mwindow = mwindow;
68 AssetPicon::AssetPicon(MWindow *mwindow,
74 this->mwindow = mwindow;
76 this->plugin = plugin;
82 AssetPicon::~AssetPicon()
86 if(icon != gui->file_icon &&
87 icon != gui->audio_icon &&
88 icon != gui->folder_icon &&
89 icon != gui->clip_icon &&
90 icon != gui->video_icon) delete icon;
94 void AssetPicon::reset()
105 void AssetPicon::create_objects()
108 char name[BCTEXTLEN];
110 int pixmap_w, pixmap_h;
117 fs.extract_name(name, asset->path);
119 if(asset->video_data)
121 if(mwindow->preferences->use_thumbnails)
123 //printf("AssetPicon::create_objects 1\n");
124 File *file = mwindow->video_cache->check_out(asset);
125 //printf("AssetPicon::create_objects 2\n");
129 pixmap_w = pixmap_h * asset->width / asset->height;
131 //printf("AssetPicon::create_objects 3\n");
133 file->set_video_position(0, mwindow->edl->session->frame_rate);
134 frame = file->read_frame(BC_RGB888);
135 //printf("AssetPicon::create_objects 4\n");
139 icon = new BC_Pixmap(gui, pixmap_w, pixmap_h);
140 icon->draw_vframe(frame,
148 //printf("AssetPicon::create_objects 5\n");
150 mwindow->video_cache->check_in(asset);
151 //printf("AssetPicon::create_objects 6\n");
155 icon = gui->video_icon;
160 icon = gui->video_icon;
164 if(asset->audio_data)
166 icon = gui->audio_icon;
168 //printf("AssetPicon::create_objects 2\n");
171 //printf("AssetPicon::create_objects 4\n");
176 //printf("AssetPicon::create_objects 4 %s\n", edl->local_session->clip_title);
177 strcpy(name, edl->local_session->clip_title);
179 set_icon(gui->clip_icon);
184 strcpy(name, plugin->title);
188 if(plugin->picon->get_color_model() == BC_RGB888)
190 icon = new BC_Pixmap(gui,
191 plugin->picon->get_w(),
192 plugin->picon->get_h());
193 icon->draw_vframe(plugin->picon,
196 plugin->picon->get_w(),
197 plugin->picon->get_h(),
203 icon = new BC_Pixmap(gui,
210 icon = gui->file_icon;
222 AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow)
223 : BC_Window(PROGRAM_NAME ": Resources",
224 mwindow->session->awindow_x,
225 mwindow->session->awindow_y,
226 mwindow->session->awindow_w,
227 mwindow->session->awindow_h,
234 // printf("AWindowGUI::AWindowGUI %d %d %d %d\n",
235 // mwindow->session->awindow_x,
236 // mwindow->session->awindow_y,
237 // mwindow->session->awindow_w,
238 // mwindow->session->awindow_h);
239 this->mwindow = mwindow;
240 this->awindow = awindow;
243 AWindowGUI::~AWindowGUI()
245 assets.remove_all_objects();
246 folders.remove_all_objects();
247 aeffects.remove_all_objects();
248 veffects.remove_all_objects();
249 atransitions.remove_all_objects();
250 vtransitions.remove_all_objects();
251 displayed_assets[1].remove_all_objects();
256 delete newfolder_thread;
258 delete assetlist_menu;
259 delete folderlist_menu;
262 int AWindowGUI::create_objects()
267 //printf("AWindowGUI::create_objects 1\n");
268 asset_titles[0] = _("Title");
269 asset_titles[1] = _("Comments");
271 set_icon(mwindow->theme->awindow_icon);
272 file_icon = new BC_Pixmap(this,
273 BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN],
276 folder_icon = new BC_Pixmap(this,
277 BC_WindowBase::get_resources()->type_to_icon[ICON_FOLDER],
280 audio_icon = new BC_Pixmap(this,
281 BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND],
284 video_icon = new BC_Pixmap(this,
285 BC_WindowBase::get_resources()->type_to_icon[ICON_FILM],
288 clip_icon = new BC_Pixmap(this,
289 mwindow->theme->clip_icon,
293 folders.append(picon = new AssetPicon(mwindow,
296 picon->persistent = 1;
297 folders.append(picon = new AssetPicon(mwindow,
300 picon->persistent = 1;
301 folders.append(picon = new AssetPicon(mwindow,
303 ATRANSITION_FOLDER));
304 picon->persistent = 1;
305 folders.append(picon = new AssetPicon(mwindow,
307 VTRANSITION_FOLDER));
308 picon->persistent = 1;
310 create_persistent_folder(&aeffects, 1, 0, 1, 0);
311 create_persistent_folder(&veffects, 0, 1, 1, 0);
312 create_persistent_folder(&atransitions, 1, 0, 0, 1);
313 create_persistent_folder(&vtransitions, 0, 1, 0, 1);
315 mwindow->theme->get_awindow_sizes(this);
316 add_subwindow(asset_list = new AWindowAssets(mwindow,
318 mwindow->theme->alist_x,
319 mwindow->theme->alist_y,
320 mwindow->theme->alist_w,
321 mwindow->theme->alist_h));
322 add_subwindow(divider = new AWindowDivider(mwindow,
324 mwindow->theme->adivider_x,
325 mwindow->theme->adivider_y,
326 mwindow->theme->adivider_w,
327 mwindow->theme->adivider_h));
328 divider->set_cursor(HSEPARATE_CURSOR);
329 add_subwindow(folder_list = new AWindowFolders(mwindow,
331 mwindow->theme->afolders_x,
332 mwindow->theme->afolders_y,
333 mwindow->theme->afolders_w,
334 mwindow->theme->afolders_h));
336 x = mwindow->theme->abuttons_x;
337 y = mwindow->theme->abuttons_y;
339 newfolder_thread = new NewFolderThread(mwindow, this);
341 add_subwindow(asset_menu = new AssetPopup(mwindow, this));
342 asset_menu->create_objects();
344 add_subwindow(assetlist_menu = new AssetListMenu(mwindow, this));
345 assetlist_menu->create_objects();
347 add_subwindow(folderlist_menu = new FolderListMenu(mwindow, this));
348 folderlist_menu->create_objects();
349 //printf("AWindowGUI::create_objects 2\n");
354 int AWindowGUI::resize_event(int w, int h)
356 mwindow->session->awindow_x = get_x();
357 mwindow->session->awindow_y = get_y();
358 mwindow->session->awindow_w = w;
359 mwindow->session->awindow_h = h;
361 mwindow->theme->get_awindow_sizes(this);
362 mwindow->theme->draw_awindow_bg(this);
364 asset_list->reposition_window(mwindow->theme->alist_x,
365 mwindow->theme->alist_y,
366 mwindow->theme->alist_w,
367 mwindow->theme->alist_h);
368 divider->reposition_window(mwindow->theme->adivider_x,
369 mwindow->theme->adivider_y,
370 mwindow->theme->adivider_w,
371 mwindow->theme->adivider_h);
372 folder_list->reposition_window(mwindow->theme->afolders_x,
373 mwindow->theme->afolders_y,
374 mwindow->theme->afolders_w,
375 mwindow->theme->afolders_h);
377 int x = mwindow->theme->abuttons_x;
378 int y = mwindow->theme->abuttons_y;
380 // new_bin->reposition_window(x, y);
381 // x += new_bin->get_w();
382 // delete_bin->reposition_window(x, y);
383 // x += delete_bin->get_w();
384 // rename_bin->reposition_window(x, y);
385 // x += rename_bin->get_w();
386 // delete_disk->reposition_window(x, y);
387 // x += delete_disk->get_w();
388 // delete_project->reposition_window(x, y);
389 // x += delete_project->get_w();
390 // info->reposition_window(x, y);
391 // x += info->get_w();
392 // redraw_index->reposition_window(x, y);
393 // x += redraw_index->get_w();
394 // paste->reposition_window(x, y);
395 // x += paste->get_w();
396 // append->reposition_window(x, y);
397 // x += append->get_w();
398 // view->reposition_window(x, y);
400 BC_WindowBase::resize_event(w, h);
404 int AWindowGUI::translation_event()
406 mwindow->session->awindow_x = get_x();
407 mwindow->session->awindow_y = get_y();
411 void AWindowGUI::reposition_objects()
413 mwindow->theme->get_awindow_sizes(this);
414 asset_list->reposition_window(mwindow->theme->alist_x,
415 mwindow->theme->alist_y,
416 mwindow->theme->alist_w,
417 mwindow->theme->alist_h);
418 divider->reposition_window(mwindow->theme->adivider_x,
419 mwindow->theme->adivider_y,
420 mwindow->theme->adivider_w,
421 mwindow->theme->adivider_h);
422 folder_list->reposition_window(mwindow->theme->afolders_x,
423 mwindow->theme->afolders_y,
424 mwindow->theme->afolders_w,
425 mwindow->theme->afolders_h);
429 int AWindowGUI::close_event()
432 mwindow->session->show_awindow = 0;
433 mwindow->gui->lock_window("AWindowGUI::close_event");
434 mwindow->gui->mainmenu->show_awindow->set_checked(0);
435 mwindow->gui->unlock_window();
436 mwindow->save_defaults();
441 int AWindowGUI::keypress_event()
443 switch(get_keypress())
457 void AWindowGUI::update_folder_list()
459 //printf("AWindowGUI::update_folder_list 1\n");
460 for(int i = 0; i < folders.total; i++)
462 AssetPicon *picon = (AssetPicon*)folders.values[i];
465 //printf("AWindowGUI::update_folder_list 1\n");
467 // Search assets for folders
468 for(int i = 0; i < mwindow->edl->folders.total; i++)
470 char *folder = mwindow->edl->folders.values[i];
472 //printf("AWindowGUI::update_folder_list 1.1\n");
474 for(int j = 0; j < folders.total; j++)
476 AssetPicon *picon = (AssetPicon*)folders.values[j];
477 if(!strcasecmp(picon->get_text(), folder))
487 AssetPicon *picon = new AssetPicon(mwindow, this, folder);
488 picon->create_objects();
489 folders.append(picon);
491 //printf("AWindowGUI::update_folder_list 1.3\n");
493 //printf("AWindowGUI::update_folder_list 1\n");
494 //for(int i = 0; i < folders.total; i++)
495 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
498 for(int i = folders.total - 1; i >= 0; i--)
500 AssetPicon *picon = (AssetPicon*)folders.values[i];
501 if(!picon->in_use && !picon->persistent)
504 folders.remove_number(i);
507 //for(int i = 0; i < folders.total; i++)
508 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
509 //printf("AWindowGUI::update_folder_list 2\n");
512 void AWindowGUI::create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
518 ArrayList<PluginServer*> plugindb;
520 // Get pointers to plugindb entries
521 mwindow->create_plugindb(do_audio,
528 for(int i = 0; i < plugindb.total; i++)
530 PluginServer *server = plugindb.values[i];
533 // Create new listitem
536 AssetPicon *picon = new AssetPicon(mwindow, this, server);
537 picon->create_objects();
538 output->append(picon);
543 void AWindowGUI::update_asset_list()
545 //printf("AWindowGUI::update_asset_list 1\n");
546 for(int i = 0; i < assets.total; i++)
548 AssetPicon *picon = (AssetPicon*)assets.values[i];
556 //printf("AWindowGUI::update_asset_list 1\n");
559 // Synchronize EDL clips
560 for(int i = 0; i < mwindow->edl->clips.total; i++)
564 // Look for clip in existing listitems
565 for(int j = 0; j < assets.total && !exists; j++)
567 AssetPicon *picon = (AssetPicon*)assets.values[j];
569 if(picon->id == mwindow->edl->clips.values[i]->id)
571 picon->edl = mwindow->edl->clips.values[i];
572 picon->set_text(mwindow->edl->clips.values[i]->local_session->clip_title);
578 // Create new listitem
581 AssetPicon *picon = new AssetPicon(mwindow,
583 mwindow->edl->clips.values[i]);
584 picon->create_objects();
585 assets.append(picon);
595 //printf("AWindowGUI::update_asset_list 2 %d\n", assets.total);
596 // Synchronize EDL assets
597 for(Asset *current = mwindow->edl->assets->first;
603 //printf("AWindowGUI::update_asset_list 3 %s\n", current->path);
604 // Look for asset in existing listitems
605 for(int j = 0; j < assets.total && !exists; j++)
607 AssetPicon *picon = (AssetPicon*)assets.values[j];
609 if(picon->id == current->id)
611 //printf("AWindowGUI::update_asset_list 4 %p %d %d\n", picon->asset, picon->get_icon_x(), picon->get_icon_y());
612 picon->asset = current;
619 //printf("AWindowGUI::update_asset_list 5\n");
620 // Create new listitem
623 //printf("AWindowGUI::update_asset_list 4.1 %s\n", current->path);
624 AssetPicon *picon = new AssetPicon(mwindow, this, current);
625 //printf("AWindowGUI::update_asset_list 4.2 %s\n", current->path);
626 picon->create_objects();
627 //printf("AWindowGUI::update_asset_list 4.3 %s\n", current->path);
628 assets.append(picon);
629 //printf("AWindowGUI::update_asset_list 4.4 %s\n", current->path);
641 //printf("AWindowGUI::update_asset_list 6\n");
642 for(int i = assets.total - 1; i >= 0; i--)
644 AssetPicon *picon = (AssetPicon*)assets.values[i];
645 //printf("AWindowGUI::update_asset_list %s %d\n", picon->asset->path, picon->in_use);
649 assets.remove_number(i);
652 //printf("AWindowGUI::update_asset_list 7 %d\n", assets.total);
659 void AWindowGUI::sort_assets()
661 //printf("AWindowGUI::sort_assets 1 %s\n", mwindow->edl->session->current_folder);
662 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
663 sort_picons(&aeffects,
666 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
667 sort_picons(&veffects,
670 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
671 sort_picons(&atransitions,
674 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
675 sort_picons(&vtransitions,
679 mwindow->edl->session->current_folder);
694 void AWindowGUI::collect_assets()
697 mwindow->session->drag_assets->remove_all();
698 mwindow->session->drag_clips->remove_all();
701 AssetPicon *result = (AssetPicon*)asset_list->get_selection(0, i++);
704 if(result->asset) mwindow->session->drag_assets->append(result->asset);
705 if(result->edl) mwindow->session->drag_clips->append(result->edl);
709 void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst,
710 ArrayList<BC_ListBoxItem*> *src,
713 // Remove current pointers
715 dst[1].remove_all_objects();
717 // Create new pointers
718 //if(folder) printf("AWindowGUI::copy_picons 1 %s\n", folder);
719 for(int i = 0; i < src->total; i++)
721 AssetPicon *picon = (AssetPicon*)src->values[i];
722 //printf("AWindowGUI::copy_picons 2 %s\n", picon->asset->folder);
724 (folder && picon->asset && !strcasecmp(picon->asset->folder, folder)) ||
725 (folder && picon->edl && !strcasecmp(picon->edl->local_session->folder, folder)))
727 BC_ListBoxItem *item2, *item1;
728 dst[0].append(item1 = picon);
730 dst[1].append(item2 = new BC_ListBoxItem(picon->edl->local_session->clip_notes));
732 dst[1].append(item2 = new BC_ListBoxItem(""));
733 item1->set_autoplace_text(1);
734 item2->set_autoplace_text(1);
735 //printf("AWindowGUI::copy_picons 3 %s\n", picon->get_text());
740 void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src,
743 //printf("AWindowGUI::sort_picons 1\n")
748 for(int i = 0; i < src->total - 1; i++)
750 BC_ListBoxItem *item1 = src->values[i];
751 BC_ListBoxItem *item2 = src->values[i + 1];
752 item1->set_autoplace_icon(1);
753 item2->set_autoplace_icon(1);
754 item1->set_autoplace_text(1);
755 item2->set_autoplace_text(1);
756 if(strcmp(item1->get_text(), item2->get_text()) > 0)
758 src->values[i + 1] = item1;
759 src->values[i] = item2;
767 void AWindowGUI::filter_displayed_assets()
769 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
770 copy_picons(displayed_assets,
774 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
775 copy_picons(displayed_assets,
779 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
780 copy_picons(displayed_assets,
784 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
785 copy_picons(displayed_assets,
789 copy_picons(displayed_assets,
791 mwindow->edl->session->current_folder);
795 void AWindowGUI::update_assets()
797 //printf("AWindowGUI::update_assets 1\n");
798 update_folder_list();
799 //printf("AWindowGUI::update_assets 2\n");
801 //printf("AWindowGUI::update_assets 3\n");
802 filter_displayed_assets();
804 //for(int i = 0; i < folders.total; i++)
805 //printf("AWindowGUI::update_assets 4\n");
806 // printf("AWindowGUI::update_assets %s\n", folders.values[i]->get_text());
807 if(mwindow->edl->session->folderlist_format != folder_list->get_format())
808 folder_list->update_format(mwindow->edl->session->folderlist_format, 0);
809 folder_list->update(&folders,
813 folder_list->get_xposition(),
814 folder_list->get_yposition(),
816 //printf("AWindowGUI::update_assets 5\n");
818 if(mwindow->edl->session->assetlist_format != asset_list->get_format())
819 asset_list->update_format(mwindow->edl->session->assetlist_format, 0);
822 //printf("AWindowGUI::update_assets 6 %d\n", displayed_assets[0].total);
823 asset_list->update(displayed_assets,
825 mwindow->edl->session->asset_columns,
827 asset_list->get_xposition(),
828 asset_list->get_yposition(),
831 //printf("AWindowGUI::update_assets 7\n");
834 //printf("AWindowGUI::update_assets 8\n");
838 int AWindowGUI::current_folder_number()
841 for(int i = 0; i < folders.total; i++)
843 if(!strcasecmp(folders.values[i]->get_text(), mwindow->edl->session->current_folder))
852 int AWindowGUI::drag_motion()
854 if(get_hidden()) return 0;
860 int AWindowGUI::drag_stop()
862 if(get_hidden()) return 0;
867 Asset* AWindowGUI::selected_asset()
869 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
870 if(picon) return picon->asset;
873 PluginServer* AWindowGUI::selected_plugin()
875 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
876 if(picon) return picon->plugin;
879 AssetPicon* AWindowGUI::selected_folder()
881 AssetPicon *picon = (AssetPicon*)folder_list->get_selection(0, 0);
894 AWindowDivider::AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
895 : BC_SubWindow(x, y, w, h)
897 this->mwindow = mwindow;
900 AWindowDivider::~AWindowDivider()
904 int AWindowDivider::button_press_event()
906 if(is_event_win() && cursor_inside())
908 mwindow->session->current_operation = DRAG_PARTITION;
914 int AWindowDivider::cursor_motion_event()
916 if(mwindow->session->current_operation == DRAG_PARTITION)
918 mwindow->session->afolders_w = gui->get_relative_cursor_x();
919 gui->reposition_objects();
924 int AWindowDivider::button_release_event()
926 if(mwindow->session->current_operation == DRAG_PARTITION)
928 mwindow->session->current_operation = NO_OPERATION;
939 AWindowFolders::AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
944 mwindow->edl->session->folderlist_format == FOLDERS_ICONS ?
945 LISTBOX_ICONS : LISTBOX_TEXT,
946 &gui->folders, // Each column has an ArrayList of BC_ListBoxItems.
947 0, // Titles for columns. Set to 0 for no titles
948 0, // width of each column
950 0, // Pixel of top of window.
951 0, // If this listbox is a popup window
952 LISTBOX_SINGLE, // Select one item or multiple items
953 ICON_TOP, // Position of icon relative to text of each item
956 this->mwindow = mwindow;
961 AWindowFolders::~AWindowFolders()
965 int AWindowFolders::selection_changed()
967 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
970 strcpy(mwindow->edl->session->current_folder, picon->get_text());
971 //printf("AWindowFolders::selection_changed 1\n");
972 gui->asset_list->draw_background();
973 gui->update_assets();
978 int AWindowFolders::button_press_event()
982 result = BC_ListBox::button_press_event();
986 if(get_buttonpress() == 3 && is_event_win() && cursor_inside())
988 gui->folderlist_menu->update_titles();
989 gui->folderlist_menu->activate_menu();
1004 AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1009 mwindow->edl->session->assetlist_format == ASSETS_ICONS ?
1010 LISTBOX_ICONS : LISTBOX_TEXT,
1011 &gui->assets, // Each column has an ArrayList of BC_ListBoxItems.
1012 gui->asset_titles, // Titles for columns. Set to 0 for no titles
1013 mwindow->edl->session->asset_columns, // width of each column
1014 1, // Total columns.
1015 0, // Pixel of top of window.
1016 0, // If this listbox is a popup window
1017 LISTBOX_MULTIPLE, // Select one item or multiple items
1018 ICON_TOP, // Position of icon relative to text of each item
1021 this->mwindow = mwindow;
1026 AWindowAssets::~AWindowAssets()
1030 int AWindowAssets::button_press_event()
1034 result = BC_ListBox::button_press_event();
1036 if(!result && get_buttonpress() == 3 && is_event_win() && cursor_inside())
1038 BC_ListBox::deactivate_selection();
1039 gui->assetlist_menu->update_titles();
1040 gui->assetlist_menu->activate_menu();
1049 int AWindowAssets::handle_event()
1051 //printf("AWindowAssets::handle_event 1 %d %d\n", get_buttonpress(), get_selection(0, 0));
1052 if(get_selection(0, 0))
1054 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1058 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1062 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1066 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1071 //printf("AWindowAssets::handle_event 2 %d %d\n", get_buttonpress(), get_selection(0, 0));
1072 mwindow->vwindow->gui->lock_window("AWindowAssets::handle_event");
1074 if(((AssetPicon*)get_selection(0, 0))->asset)
1075 mwindow->vwindow->change_source(((AssetPicon*)get_selection(0, 0))->asset);
1077 if(((AssetPicon*)get_selection(0, 0))->edl)
1078 mwindow->vwindow->change_source(((AssetPicon*)get_selection(0, 0))->edl);
1080 mwindow->vwindow->gui->unlock_window();
1088 int AWindowAssets::selection_changed()
1090 // Show popup window
1091 if(get_button_down() && get_buttonpress() == 3 && get_selection(0, 0))
1093 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER) ||
1094 !strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER) ||
1095 !strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER) ||
1096 !strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1098 gui->assetlist_menu->update_titles();
1099 gui->assetlist_menu->activate_menu();
1103 if(((AssetPicon*)get_selection(0, 0))->asset)
1104 gui->asset_menu->update();
1106 if(((AssetPicon*)get_selection(0, 0))->edl)
1107 gui->asset_menu->update();
1111 gui->asset_menu->activate_menu();
1114 BC_ListBox::deactivate_selection();
1120 void AWindowAssets::draw_background()
1122 //printf("AWindowAssets::draw_background %s\n", mwindow->edl->session->current_folder);
1123 BC_ListBox::draw_background();
1125 set_font(LARGEFONT);
1127 get_text_width(LARGEFONT, mwindow->edl->session->current_folder) - 4,
1129 mwindow->edl->session->current_folder,
1134 int AWindowAssets::drag_start_event()
1136 int collect_pluginservers = 0;
1137 int collect_assets = 0;
1139 if(BC_ListBox::drag_start_event())
1141 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1143 mwindow->session->current_operation = DRAG_AEFFECT;
1144 collect_pluginservers = 1;
1147 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1149 mwindow->session->current_operation = DRAG_VEFFECT;
1150 collect_pluginservers = 1;
1153 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1155 mwindow->session->current_operation = DRAG_ATRANSITION;
1156 collect_pluginservers = 1;
1159 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1161 mwindow->session->current_operation = DRAG_VTRANSITION;
1162 collect_pluginservers = 1;
1166 mwindow->session->current_operation = DRAG_ASSET;
1171 if(collect_pluginservers)
1174 mwindow->session->drag_pluginservers->remove_all();
1177 AssetPicon *result = (AssetPicon*)get_selection(0, i++);
1180 mwindow->session->drag_pluginservers->append(result->plugin);
1186 gui->collect_assets();
1194 int AWindowAssets::drag_motion_event()
1196 BC_ListBox::drag_motion_event();
1198 mwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1199 mwindow->gui->drag_motion();
1200 mwindow->gui->unlock_window();
1202 mwindow->vwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1203 mwindow->vwindow->gui->drag_motion();
1204 mwindow->vwindow->gui->unlock_window();
1206 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1207 mwindow->cwindow->gui->drag_motion();
1208 mwindow->cwindow->gui->unlock_window();
1212 int AWindowAssets::drag_stop_event()
1216 result = gui->drag_stop();
1221 mwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1222 result = mwindow->gui->drag_stop();
1223 mwindow->gui->unlock_window();
1228 mwindow->vwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1229 result = mwindow->vwindow->gui->drag_stop();
1230 mwindow->vwindow->gui->unlock_window();
1235 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1236 result = mwindow->cwindow->gui->drag_stop();
1237 mwindow->cwindow->gui->unlock_window();
1242 if(result) get_drag_popup()->set_animation(0);
1244 BC_ListBox::drag_stop_event();
1248 int AWindowAssets::column_resize_event()
1250 mwindow->edl->session->asset_columns[0] = get_column_width(0);
1251 mwindow->edl->session->asset_columns[1] = get_column_width(1);
1266 AWindowNewFolder::AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1267 : BC_Button(x, y, mwindow->theme->newbin_data)
1269 this->mwindow = mwindow;
1271 set_tooltip(_("New bin"));
1274 int AWindowNewFolder::handle_event()
1276 gui->newfolder_thread->start_new_folder();
1280 AWindowDeleteFolder::AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1281 : BC_Button(x, y, mwindow->theme->deletebin_data)
1283 this->mwindow = mwindow;
1285 set_tooltip(_("Delete bin"));
1288 int AWindowDeleteFolder::handle_event()
1290 if(gui->folder_list->get_selection(0, 0))
1292 BC_ListBoxItem *folder = gui->folder_list->get_selection(0, 0);
1293 mwindow->delete_folder(folder->get_text());
1298 AWindowRenameFolder::AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1299 : BC_Button(x, y, mwindow->theme->renamebin_data)
1301 this->mwindow = mwindow;
1303 set_tooltip(_("Rename bin"));
1306 int AWindowRenameFolder::handle_event()
1311 AWindowDeleteDisk::AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1312 : BC_Button(x, y, mwindow->theme->deletedisk_data)
1314 this->mwindow = mwindow;
1316 set_tooltip(_("Delete asset from disk"));
1319 int AWindowDeleteDisk::handle_event()
1324 AWindowDeleteProject::AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1325 : BC_Button(x, y, mwindow->theme->deleteproject_data)
1327 this->mwindow = mwindow;
1329 set_tooltip(_("Delete asset from project"));
1332 int AWindowDeleteProject::handle_event()
1337 AWindowInfo::AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1338 : BC_Button(x, y, mwindow->theme->infoasset_data)
1340 this->mwindow = mwindow;
1342 set_tooltip(_("Edit information on asset"));
1345 int AWindowInfo::handle_event()
1347 gui->awindow->asset_edit->edit_asset(gui->selected_asset());
1351 AWindowRedrawIndex::AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1352 : BC_Button(x, y, mwindow->theme->redrawindex_data)
1354 this->mwindow = mwindow;
1356 set_tooltip(_("Redraw index"));
1359 int AWindowRedrawIndex::handle_event()
1364 AWindowPaste::AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1365 : BC_Button(x, y, mwindow->theme->pasteasset_data)
1367 this->mwindow = mwindow;
1369 set_tooltip(_("Paste asset on recordable tracks"));
1372 int AWindowPaste::handle_event()
1377 AWindowAppend::AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1378 : BC_Button(x, y, mwindow->theme->appendasset_data)
1380 this->mwindow = mwindow;
1382 set_tooltip(_("Append asset in new tracks"));
1385 int AWindowAppend::handle_event()
1390 AWindowView::AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1391 : BC_Button(x, y, mwindow->theme->viewasset_data)
1393 this->mwindow = mwindow;
1395 set_tooltip(_("View asset"));
1398 int AWindowView::handle_event()