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)
98 void AssetPicon::reset()
110 void AssetPicon::create_objects()
113 char name[BCTEXTLEN];
114 int pixmap_w, pixmap_h;
121 fs.extract_name(name, asset->path);
123 if(asset->video_data)
125 if(mwindow->preferences->use_thumbnails)
127 File *file = mwindow->video_cache->check_out(asset);
131 pixmap_w = pixmap_h * asset->width / asset->height;
134 file->set_video_position(0, mwindow->edl->session->frame_rate);
136 if(gui->temp_picon &&
137 (gui->temp_picon->get_w() != asset->width ||
138 gui->temp_picon->get_h() != asset->height))
140 delete gui->temp_picon;
146 gui->temp_picon = new VFrame(0,
152 file->read_frame(gui->temp_picon);
154 icon = new BC_Pixmap(gui, pixmap_w, pixmap_h);
155 icon->draw_vframe(gui->temp_picon,
162 //printf("%d %d\n", gui->temp_picon->get_w(), gui->temp_picon->get_h());
163 icon_vframe = new VFrame(0,
167 cmodel_transfer(icon_vframe->get_rows(), /* Leave NULL if non existent */
168 gui->temp_picon->get_rows(),
169 0, /* Leave NULL if non existent */
172 0, /* Leave NULL if non existent */
175 0, /* Dimensions to capture from input frame */
177 gui->temp_picon->get_w(),
178 gui->temp_picon->get_h(),
179 0, /* Dimensions to project on output frame */
185 0, /* When transfering BC_RGBA8888 to non-alpha this is the background color in 0xRRGGBB hex */
186 0, /* For planar use the luma rowspan */
187 0); /* For planar use the luma rowspan */
190 mwindow->video_cache->check_in(asset);
194 icon = gui->video_icon;
195 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
201 icon = gui->video_icon;
202 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
206 if(asset->audio_data)
208 icon = gui->audio_icon;
209 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND];
211 //printf("AssetPicon::create_objects 2\n");
214 set_icon_vframe(icon_vframe);
215 //printf("AssetPicon::create_objects 4\n");
220 //printf("AssetPicon::create_objects 4 %s\n", edl->local_session->clip_title);
221 strcpy(name, edl->local_session->clip_title);
223 set_icon(gui->clip_icon);
224 set_icon_vframe(mwindow->theme->clip_icon);
229 strcpy(name, _(plugin->title));
233 if(plugin->picon->get_color_model() == BC_RGB888)
235 icon = new BC_Pixmap(gui,
236 plugin->picon->get_w(),
237 plugin->picon->get_h());
238 icon->draw_vframe(plugin->picon,
241 plugin->picon->get_w(),
242 plugin->picon->get_h(),
248 icon = new BC_Pixmap(gui,
252 icon_vframe = new VFrame (*plugin->picon);
256 icon = gui->file_icon;
257 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN];
260 set_icon_vframe(icon_vframe);
270 AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow)
271 : BC_Window(PROGRAM_NAME ": Resources",
272 mwindow->session->awindow_x,
273 mwindow->session->awindow_y,
274 mwindow->session->awindow_w,
275 mwindow->session->awindow_h,
282 // printf("AWindowGUI::AWindowGUI %d %d %d %d\n",
283 // mwindow->session->awindow_x,
284 // mwindow->session->awindow_y,
285 // mwindow->session->awindow_w,
286 // mwindow->session->awindow_h);
287 this->mwindow = mwindow;
288 this->awindow = awindow;
292 AWindowGUI::~AWindowGUI()
294 assets.remove_all_objects();
295 folders.remove_all_objects();
296 aeffects.remove_all_objects();
297 veffects.remove_all_objects();
298 atransitions.remove_all_objects();
299 vtransitions.remove_all_objects();
300 displayed_assets[1].remove_all_objects();
305 delete newfolder_thread;
307 delete assetlist_menu;
308 delete folderlist_menu;
309 if(temp_picon) delete temp_picon;
312 int AWindowGUI::create_objects()
317 //printf("AWindowGUI::create_objects 1\n");
318 asset_titles[0] = _("Title");
319 asset_titles[1] = _("Comments");
321 set_icon(mwindow->theme->awindow_icon);
322 file_icon = new BC_Pixmap(this,
323 BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN],
326 folder_icon = new BC_Pixmap(this,
327 BC_WindowBase::get_resources()->type_to_icon[ICON_FOLDER],
330 audio_icon = new BC_Pixmap(this,
331 BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND],
334 video_icon = new BC_Pixmap(this,
335 BC_WindowBase::get_resources()->type_to_icon[ICON_FILM],
338 clip_icon = new BC_Pixmap(this,
339 mwindow->theme->clip_icon,
343 folders.append(picon = new AssetPicon(mwindow,
346 picon->persistent = 1;
347 folders.append(picon = new AssetPicon(mwindow,
350 picon->persistent = 1;
351 folders.append(picon = new AssetPicon(mwindow,
353 ATRANSITION_FOLDER));
354 picon->persistent = 1;
355 folders.append(picon = new AssetPicon(mwindow,
357 VTRANSITION_FOLDER));
358 picon->persistent = 1;
360 create_persistent_folder(&aeffects, 1, 0, 1, 0);
361 create_persistent_folder(&veffects, 0, 1, 1, 0);
362 create_persistent_folder(&atransitions, 1, 0, 0, 1);
363 create_persistent_folder(&vtransitions, 0, 1, 0, 1);
365 mwindow->theme->get_awindow_sizes(this);
366 add_subwindow(asset_list = new AWindowAssets(mwindow,
368 mwindow->theme->alist_x,
369 mwindow->theme->alist_y,
370 mwindow->theme->alist_w,
371 mwindow->theme->alist_h));
372 add_subwindow(divider = new AWindowDivider(mwindow,
374 mwindow->theme->adivider_x,
375 mwindow->theme->adivider_y,
376 mwindow->theme->adivider_w,
377 mwindow->theme->adivider_h));
378 divider->set_cursor(HSEPARATE_CURSOR);
379 add_subwindow(folder_list = new AWindowFolders(mwindow,
381 mwindow->theme->afolders_x,
382 mwindow->theme->afolders_y,
383 mwindow->theme->afolders_w,
384 mwindow->theme->afolders_h));
386 x = mwindow->theme->abuttons_x;
387 y = mwindow->theme->abuttons_y;
389 newfolder_thread = new NewFolderThread(mwindow, this);
391 add_subwindow(asset_menu = new AssetPopup(mwindow, this));
392 asset_menu->create_objects();
394 add_subwindow(assetlist_menu = new AssetListMenu(mwindow, this));
395 assetlist_menu->create_objects();
397 add_subwindow(folderlist_menu = new FolderListMenu(mwindow, this));
398 folderlist_menu->create_objects();
399 //printf("AWindowGUI::create_objects 2\n");
404 int AWindowGUI::resize_event(int w, int h)
406 mwindow->session->awindow_x = get_x();
407 mwindow->session->awindow_y = get_y();
408 mwindow->session->awindow_w = w;
409 mwindow->session->awindow_h = h;
411 mwindow->theme->get_awindow_sizes(this);
412 mwindow->theme->draw_awindow_bg(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);
427 int x = mwindow->theme->abuttons_x;
428 int y = mwindow->theme->abuttons_y;
430 // new_bin->reposition_window(x, y);
431 // x += new_bin->get_w();
432 // delete_bin->reposition_window(x, y);
433 // x += delete_bin->get_w();
434 // rename_bin->reposition_window(x, y);
435 // x += rename_bin->get_w();
436 // delete_disk->reposition_window(x, y);
437 // x += delete_disk->get_w();
438 // delete_project->reposition_window(x, y);
439 // x += delete_project->get_w();
440 // info->reposition_window(x, y);
441 // x += info->get_w();
442 // redraw_index->reposition_window(x, y);
443 // x += redraw_index->get_w();
444 // paste->reposition_window(x, y);
445 // x += paste->get_w();
446 // append->reposition_window(x, y);
447 // x += append->get_w();
448 // view->reposition_window(x, y);
450 BC_WindowBase::resize_event(w, h);
454 int AWindowGUI::translation_event()
456 mwindow->session->awindow_x = get_x();
457 mwindow->session->awindow_y = get_y();
461 void AWindowGUI::reposition_objects()
463 mwindow->theme->get_awindow_sizes(this);
464 asset_list->reposition_window(mwindow->theme->alist_x,
465 mwindow->theme->alist_y,
466 mwindow->theme->alist_w,
467 mwindow->theme->alist_h);
468 divider->reposition_window(mwindow->theme->adivider_x,
469 mwindow->theme->adivider_y,
470 mwindow->theme->adivider_w,
471 mwindow->theme->adivider_h);
472 folder_list->reposition_window(mwindow->theme->afolders_x,
473 mwindow->theme->afolders_y,
474 mwindow->theme->afolders_w,
475 mwindow->theme->afolders_h);
479 int AWindowGUI::close_event()
482 mwindow->session->show_awindow = 0;
483 mwindow->gui->lock_window("AWindowGUI::close_event");
484 mwindow->gui->mainmenu->show_awindow->set_checked(0);
485 mwindow->gui->unlock_window();
486 mwindow->save_defaults();
491 int AWindowGUI::keypress_event()
493 switch(get_keypress())
507 void AWindowGUI::update_folder_list()
509 //printf("AWindowGUI::update_folder_list 1\n");
510 for(int i = 0; i < folders.total; i++)
512 AssetPicon *picon = (AssetPicon*)folders.values[i];
515 //printf("AWindowGUI::update_folder_list 1\n");
517 // Search assets for folders
518 for(int i = 0; i < mwindow->edl->folders.total; i++)
520 char *folder = mwindow->edl->folders.values[i];
522 //printf("AWindowGUI::update_folder_list 1.1\n");
524 for(int j = 0; j < folders.total; j++)
526 AssetPicon *picon = (AssetPicon*)folders.values[j];
527 if(!strcasecmp(picon->get_text(), folder))
537 AssetPicon *picon = new AssetPicon(mwindow, this, folder);
538 picon->create_objects();
539 folders.append(picon);
541 //printf("AWindowGUI::update_folder_list 1.3\n");
543 //printf("AWindowGUI::update_folder_list 1\n");
544 //for(int i = 0; i < folders.total; i++)
545 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
548 for(int i = folders.total - 1; i >= 0; i--)
550 AssetPicon *picon = (AssetPicon*)folders.values[i];
551 if(!picon->in_use && !picon->persistent)
554 folders.remove_number(i);
557 //for(int i = 0; i < folders.total; i++)
558 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
559 //printf("AWindowGUI::update_folder_list 2\n");
562 void AWindowGUI::create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
568 ArrayList<PluginServer*> plugindb;
570 // Get pointers to plugindb entries
571 mwindow->create_plugindb(do_audio,
578 for(int i = 0; i < plugindb.total; i++)
580 PluginServer *server = plugindb.values[i];
583 // Create new listitem
586 AssetPicon *picon = new AssetPicon(mwindow, this, server);
587 picon->create_objects();
588 output->append(picon);
593 void AWindowGUI::update_asset_list()
595 //printf("AWindowGUI::update_asset_list 1\n");
596 for(int i = 0; i < assets.total; i++)
598 AssetPicon *picon = (AssetPicon*)assets.values[i];
606 //printf("AWindowGUI::update_asset_list 2\n");
609 // Synchronize EDL clips
610 for(int i = 0; i < mwindow->edl->clips.total; i++)
614 // Look for clip in existing listitems
615 for(int j = 0; j < assets.total && !exists; j++)
617 AssetPicon *picon = (AssetPicon*)assets.values[j];
619 if(picon->id == mwindow->edl->clips.values[i]->id)
621 picon->edl = mwindow->edl->clips.values[i];
622 picon->set_text(mwindow->edl->clips.values[i]->local_session->clip_title);
628 // Create new listitem
631 AssetPicon *picon = new AssetPicon(mwindow,
633 mwindow->edl->clips.values[i]);
634 picon->create_objects();
635 assets.append(picon);
645 //printf("AWindowGUI::update_asset_list 3 %d\n", assets.total);
646 // Synchronize EDL assets
647 for(Asset *current = mwindow->edl->assets->first;
653 //printf("AWindowGUI::update_asset_list 3 %s\n", current->path);
654 // Look for asset in existing listitems
655 for(int j = 0; j < assets.total && !exists; j++)
657 AssetPicon *picon = (AssetPicon*)assets.values[j];
659 if(picon->id == current->id)
661 //printf("AWindowGUI::update_asset_list 4 %p %d %d\n", picon->asset, picon->get_icon_x(), picon->get_icon_y());
662 picon->asset = current;
669 //printf("AWindowGUI::update_asset_list 5\n");
670 // Create new listitem
673 //printf("AWindowGUI::update_asset_list 4.1 %s\n", current->path);
674 AssetPicon *picon = new AssetPicon(mwindow, this, current);
675 //printf("AWindowGUI::update_asset_list 4.2 %s\n", current->path);
676 picon->create_objects();
677 //printf("AWindowGUI::update_asset_list 4.3 %s\n", current->path);
678 assets.append(picon);
679 //printf("AWindowGUI::update_asset_list 4.4 %s\n", current->path);
691 //printf("AWindowGUI::update_asset_list 6\n");
692 for(int i = assets.total - 1; i >= 0; i--)
694 AssetPicon *picon = (AssetPicon*)assets.values[i];
695 //printf("AWindowGUI::update_asset_list %s %d\n", picon->asset->path, picon->in_use);
699 assets.remove_number(i);
702 //printf("AWindowGUI::update_asset_list 7 %d\n", assets.total);
709 void AWindowGUI::sort_assets()
711 //printf("AWindowGUI::sort_assets 1 %s\n", mwindow->edl->session->current_folder);
712 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
713 sort_picons(&aeffects,
716 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
717 sort_picons(&veffects,
720 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
721 sort_picons(&atransitions,
724 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
725 sort_picons(&vtransitions,
729 mwindow->edl->session->current_folder);
744 void AWindowGUI::collect_assets()
747 mwindow->session->drag_assets->remove_all();
748 mwindow->session->drag_clips->remove_all();
751 AssetPicon *result = (AssetPicon*)asset_list->get_selection(0, i++);
754 if(result->asset) mwindow->session->drag_assets->append(result->asset);
755 if(result->edl) mwindow->session->drag_clips->append(result->edl);
759 void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst,
760 ArrayList<BC_ListBoxItem*> *src,
763 // Remove current pointers
765 dst[1].remove_all_objects();
767 // Create new pointers
768 //if(folder) printf("AWindowGUI::copy_picons 1 %s\n", folder);
769 for(int i = 0; i < src->total; i++)
771 AssetPicon *picon = (AssetPicon*)src->values[i];
772 //printf("AWindowGUI::copy_picons 2 %s\n", picon->asset->folder);
774 (folder && picon->asset && !strcasecmp(picon->asset->folder, folder)) ||
775 (folder && picon->edl && !strcasecmp(picon->edl->local_session->folder, folder)))
777 BC_ListBoxItem *item2, *item1;
778 dst[0].append(item1 = picon);
780 dst[1].append(item2 = new BC_ListBoxItem(picon->edl->local_session->clip_notes));
782 dst[1].append(item2 = new BC_ListBoxItem(""));
783 item1->set_autoplace_text(1);
784 item2->set_autoplace_text(1);
785 //printf("AWindowGUI::copy_picons 3 %s\n", picon->get_text());
790 void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src,
793 //printf("AWindowGUI::sort_picons 1\n")
798 for(int i = 0; i < src->total - 1; i++)
800 BC_ListBoxItem *item1 = src->values[i];
801 BC_ListBoxItem *item2 = src->values[i + 1];
802 item1->set_autoplace_icon(1);
803 item2->set_autoplace_icon(1);
804 item1->set_autoplace_text(1);
805 item2->set_autoplace_text(1);
806 if(strcmp(item1->get_text(), item2->get_text()) > 0)
808 src->values[i + 1] = item1;
809 src->values[i] = item2;
817 void AWindowGUI::filter_displayed_assets()
819 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
820 copy_picons(displayed_assets,
824 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
825 copy_picons(displayed_assets,
829 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
830 copy_picons(displayed_assets,
834 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
835 copy_picons(displayed_assets,
839 copy_picons(displayed_assets,
841 mwindow->edl->session->current_folder);
845 void AWindowGUI::update_assets()
847 //printf("AWindowGUI::update_assets 1\n");
848 update_folder_list();
849 //printf("AWindowGUI::update_assets 2\n");
851 //printf("AWindowGUI::update_assets 3\n");
852 filter_displayed_assets();
854 //for(int i = 0; i < folders.total; i++)
855 //printf("AWindowGUI::update_assets 4\n");
856 // printf("AWindowGUI::update_assets %s\n", folders.values[i]->get_text());
857 if(mwindow->edl->session->folderlist_format != folder_list->get_format())
858 folder_list->update_format(mwindow->edl->session->folderlist_format, 0);
859 folder_list->update(&folders,
863 folder_list->get_xposition(),
864 folder_list->get_yposition(),
866 //printf("AWindowGUI::update_assets 5\n");
868 if(mwindow->edl->session->assetlist_format != asset_list->get_format())
869 asset_list->update_format(mwindow->edl->session->assetlist_format, 0);
872 //printf("AWindowGUI::update_assets 6 %d\n", displayed_assets[0].total);
873 asset_list->update(displayed_assets,
875 mwindow->edl->session->asset_columns,
877 asset_list->get_xposition(),
878 asset_list->get_yposition(),
881 //printf("AWindowGUI::update_assets 7\n");
884 //printf("AWindowGUI::update_assets 8\n");
888 int AWindowGUI::current_folder_number()
891 for(int i = 0; i < folders.total; i++)
893 if(!strcasecmp(folders.values[i]->get_text(), mwindow->edl->session->current_folder))
902 int AWindowGUI::drag_motion()
904 if(get_hidden()) return 0;
910 int AWindowGUI::drag_stop()
912 if(get_hidden()) return 0;
917 Asset* AWindowGUI::selected_asset()
919 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
920 if(picon) return picon->asset;
923 PluginServer* AWindowGUI::selected_plugin()
925 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
926 if(picon) return picon->plugin;
929 AssetPicon* AWindowGUI::selected_folder()
931 AssetPicon *picon = (AssetPicon*)folder_list->get_selection(0, 0);
944 AWindowDivider::AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
945 : BC_SubWindow(x, y, w, h)
947 this->mwindow = mwindow;
950 AWindowDivider::~AWindowDivider()
954 int AWindowDivider::button_press_event()
956 if(is_event_win() && cursor_inside())
958 mwindow->session->current_operation = DRAG_PARTITION;
964 int AWindowDivider::cursor_motion_event()
966 if(mwindow->session->current_operation == DRAG_PARTITION)
968 mwindow->session->afolders_w = gui->get_relative_cursor_x();
969 gui->reposition_objects();
974 int AWindowDivider::button_release_event()
976 if(mwindow->session->current_operation == DRAG_PARTITION)
978 mwindow->session->current_operation = NO_OPERATION;
989 AWindowFolders::AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
994 mwindow->edl->session->folderlist_format == FOLDERS_ICONS ?
995 LISTBOX_ICONS : LISTBOX_TEXT,
996 &gui->folders, // Each column has an ArrayList of BC_ListBoxItems.
997 0, // Titles for columns. Set to 0 for no titles
998 0, // width of each column
1000 0, // Pixel of top of window.
1001 0, // If this listbox is a popup window
1002 LISTBOX_SINGLE, // Select one item or multiple items
1003 ICON_TOP, // Position of icon relative to text of each item
1006 this->mwindow = mwindow;
1011 AWindowFolders::~AWindowFolders()
1015 int AWindowFolders::selection_changed()
1017 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1020 strcpy(mwindow->edl->session->current_folder, picon->get_text());
1021 //printf("AWindowFolders::selection_changed 1\n");
1022 gui->asset_list->draw_background();
1023 gui->update_assets();
1028 int AWindowFolders::button_press_event()
1032 result = BC_ListBox::button_press_event();
1036 if(get_buttonpress() == 3 && is_event_win() && cursor_inside())
1038 gui->folderlist_menu->update_titles();
1039 gui->folderlist_menu->activate_menu();
1054 AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1059 mwindow->edl->session->assetlist_format == ASSETS_ICONS ?
1060 LISTBOX_ICONS : LISTBOX_TEXT,
1061 &gui->assets, // Each column has an ArrayList of BC_ListBoxItems.
1062 gui->asset_titles, // Titles for columns. Set to 0 for no titles
1063 mwindow->edl->session->asset_columns, // width of each column
1064 1, // Total columns.
1065 0, // Pixel of top of window.
1066 0, // If this listbox is a popup window
1067 LISTBOX_MULTIPLE, // Select one item or multiple items
1068 ICON_TOP, // Position of icon relative to text of each item
1071 this->mwindow = mwindow;
1076 AWindowAssets::~AWindowAssets()
1080 int AWindowAssets::button_press_event()
1084 result = BC_ListBox::button_press_event();
1086 if(!result && get_buttonpress() == 3 && is_event_win() && cursor_inside())
1088 BC_ListBox::deactivate_selection();
1089 gui->assetlist_menu->update_titles();
1090 gui->assetlist_menu->activate_menu();
1099 int AWindowAssets::handle_event()
1101 //printf("AWindowAssets::handle_event 1 %d %d\n", get_buttonpress(), get_selection(0, 0));
1102 if(get_selection(0, 0))
1104 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1108 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1112 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1116 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1121 //printf("AWindowAssets::handle_event 2 %d %d\n", get_buttonpress(), get_selection(0, 0));
1122 mwindow->vwindow->gui->lock_window("AWindowAssets::handle_event");
1124 if(((AssetPicon*)get_selection(0, 0))->asset)
1125 mwindow->vwindow->change_source(((AssetPicon*)get_selection(0, 0))->asset);
1127 if(((AssetPicon*)get_selection(0, 0))->edl)
1128 mwindow->vwindow->change_source(((AssetPicon*)get_selection(0, 0))->edl);
1130 mwindow->vwindow->gui->unlock_window();
1138 int AWindowAssets::selection_changed()
1140 // Show popup window
1141 if(get_button_down() && get_buttonpress() == 3 && get_selection(0, 0))
1143 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER) ||
1144 !strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER) ||
1145 !strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER) ||
1146 !strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1148 gui->assetlist_menu->update_titles();
1149 gui->assetlist_menu->activate_menu();
1153 if(((AssetPicon*)get_selection(0, 0))->asset)
1154 gui->asset_menu->update();
1156 if(((AssetPicon*)get_selection(0, 0))->edl)
1157 gui->asset_menu->update();
1161 gui->asset_menu->activate_menu();
1164 BC_ListBox::deactivate_selection();
1170 void AWindowAssets::draw_background()
1172 BC_ListBox::draw_background();
1173 set_color(BC_WindowBase::get_resources()->audiovideo_color);
1174 set_font(LARGEFONT);
1176 get_text_width(LARGEFONT, mwindow->edl->session->current_folder) - 4,
1178 mwindow->edl->session->current_folder,
1183 int AWindowAssets::drag_start_event()
1185 int collect_pluginservers = 0;
1186 int collect_assets = 0;
1188 if(BC_ListBox::drag_start_event())
1190 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1192 mwindow->session->current_operation = DRAG_AEFFECT;
1193 collect_pluginservers = 1;
1196 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1198 mwindow->session->current_operation = DRAG_VEFFECT;
1199 collect_pluginservers = 1;
1202 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1204 mwindow->session->current_operation = DRAG_ATRANSITION;
1205 collect_pluginservers = 1;
1208 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1210 mwindow->session->current_operation = DRAG_VTRANSITION;
1211 collect_pluginservers = 1;
1215 mwindow->session->current_operation = DRAG_ASSET;
1220 if(collect_pluginservers)
1223 mwindow->session->drag_pluginservers->remove_all();
1226 AssetPicon *result = (AssetPicon*)get_selection(0, i++);
1229 mwindow->session->drag_pluginservers->append(result->plugin);
1235 gui->collect_assets();
1243 int AWindowAssets::drag_motion_event()
1245 BC_ListBox::drag_motion_event();
1247 mwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1248 mwindow->gui->drag_motion();
1249 mwindow->gui->unlock_window();
1251 mwindow->vwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1252 mwindow->vwindow->gui->drag_motion();
1253 mwindow->vwindow->gui->unlock_window();
1255 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1256 mwindow->cwindow->gui->drag_motion();
1257 mwindow->cwindow->gui->unlock_window();
1261 int AWindowAssets::drag_stop_event()
1265 result = gui->drag_stop();
1270 mwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1271 result = mwindow->gui->drag_stop();
1272 mwindow->gui->unlock_window();
1277 mwindow->vwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1278 result = mwindow->vwindow->gui->drag_stop();
1279 mwindow->vwindow->gui->unlock_window();
1284 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1285 result = mwindow->cwindow->gui->drag_stop();
1286 mwindow->cwindow->gui->unlock_window();
1291 if(result) get_drag_popup()->set_animation(0);
1293 BC_ListBox::drag_stop_event();
1294 mwindow->session->current_operation = ::NO_OPERATION; // since NO_OPERATION is also defined in listbox, we have to reach for global scope...
1298 int AWindowAssets::column_resize_event()
1300 mwindow->edl->session->asset_columns[0] = get_column_width(0);
1301 mwindow->edl->session->asset_columns[1] = get_column_width(1);
1316 AWindowNewFolder::AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1317 : BC_Button(x, y, mwindow->theme->newbin_data)
1319 this->mwindow = mwindow;
1321 set_tooltip(_("New bin"));
1324 int AWindowNewFolder::handle_event()
1326 gui->newfolder_thread->start_new_folder();
1330 AWindowDeleteFolder::AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1331 : BC_Button(x, y, mwindow->theme->deletebin_data)
1333 this->mwindow = mwindow;
1335 set_tooltip(_("Delete bin"));
1338 int AWindowDeleteFolder::handle_event()
1340 if(gui->folder_list->get_selection(0, 0))
1342 BC_ListBoxItem *folder = gui->folder_list->get_selection(0, 0);
1343 mwindow->delete_folder(folder->get_text());
1348 AWindowRenameFolder::AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1349 : BC_Button(x, y, mwindow->theme->renamebin_data)
1351 this->mwindow = mwindow;
1353 set_tooltip(_("Rename bin"));
1356 int AWindowRenameFolder::handle_event()
1361 AWindowDeleteDisk::AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1362 : BC_Button(x, y, mwindow->theme->deletedisk_data)
1364 this->mwindow = mwindow;
1366 set_tooltip(_("Delete asset from disk"));
1369 int AWindowDeleteDisk::handle_event()
1374 AWindowDeleteProject::AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1375 : BC_Button(x, y, mwindow->theme->deleteproject_data)
1377 this->mwindow = mwindow;
1379 set_tooltip(_("Delete asset from project"));
1382 int AWindowDeleteProject::handle_event()
1387 AWindowInfo::AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1388 : BC_Button(x, y, mwindow->theme->infoasset_data)
1390 this->mwindow = mwindow;
1392 set_tooltip(_("Edit information on asset"));
1395 int AWindowInfo::handle_event()
1397 gui->awindow->asset_edit->edit_asset(gui->selected_asset());
1401 AWindowRedrawIndex::AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1402 : BC_Button(x, y, mwindow->theme->redrawindex_data)
1404 this->mwindow = mwindow;
1406 set_tooltip(_("Redraw index"));
1409 int AWindowRedrawIndex::handle_event()
1414 AWindowPaste::AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1415 : BC_Button(x, y, mwindow->theme->pasteasset_data)
1417 this->mwindow = mwindow;
1419 set_tooltip(_("Paste asset on recordable tracks"));
1422 int AWindowPaste::handle_event()
1427 AWindowAppend::AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1428 : BC_Button(x, y, mwindow->theme->appendasset_data)
1430 this->mwindow = mwindow;
1432 set_tooltip(_("Append asset in new tracks"));
1435 int AWindowAppend::handle_event()
1440 AWindowView::AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1441 : BC_Button(x, y, mwindow->theme->viewasset_data)
1443 this->mwindow = mwindow;
1445 set_tooltip(_("View asset"));
1448 int AWindowView::handle_event()