3 #include "assetpopup.h"
5 #include "awindowgui.h"
6 #include "awindowgui.inc"
8 #include "awindowmenu.h"
11 #include "colormodels.h"
13 #include "cwindowgui.h"
16 #include "edlsession.h"
18 #include "filesystem.h"
21 #include "labeledit.h"
22 #include "localsession.h"
24 #include "mainsession.h"
25 #include "mwindowgui.h"
27 #include "newfolder.h"
28 #include "preferences.h"
31 #include "vwindowgui.h"
37 AssetPicon::AssetPicon(MWindow *mwindow,
43 this->mwindow = mwindow;
49 AssetPicon::AssetPicon(MWindow *mwindow,
55 this->mwindow = mwindow;
61 AssetPicon::AssetPicon(MWindow *mwindow,
64 : BC_ListBoxItem(folder, gui->folder_icon)
67 this->mwindow = mwindow;
71 AssetPicon::AssetPicon(MWindow *mwindow,
77 this->mwindow = mwindow;
79 this->plugin = plugin;
85 AssetPicon::AssetPicon(MWindow *mwindow,
91 this->mwindow = mwindow;
99 AssetPicon::~AssetPicon()
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)
115 void AssetPicon::reset()
128 void AssetPicon::create_objects()
131 char name[BCTEXTLEN];
132 int pixmap_w, pixmap_h;
139 fs.extract_name(name, asset->path);
141 if(asset->video_data)
143 if(mwindow->preferences->use_thumbnails)
145 File *file = mwindow->video_cache->check_out(asset, mwindow->edl);
149 pixmap_w = pixmap_h * asset->width / asset->height;
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))
158 delete gui->temp_picon;
164 gui->temp_picon = new VFrame(0,
170 file->read_frame(gui->temp_picon);
172 icon = new BC_Pixmap(gui, pixmap_w, pixmap_h);
173 icon->draw_vframe(gui->temp_picon,
180 //printf("%d %d\n", gui->temp_picon->get_w(), gui->temp_picon->get_h());
181 icon_vframe = new VFrame(0,
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 */
190 0, /* Leave NULL if non existent */
193 0, /* Dimensions to capture from input frame */
195 gui->temp_picon->get_w(),
196 gui->temp_picon->get_h(),
197 0, /* Dimensions to project on output frame */
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);
212 icon = gui->video_icon;
213 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
219 icon = gui->video_icon;
220 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
224 if(asset->audio_data)
226 icon = gui->audio_icon;
227 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND];
229 //printf("AssetPicon::create_objects 2\n");
232 set_icon_vframe(icon_vframe);
233 //printf("AssetPicon::create_objects 4\n");
238 //printf("AssetPicon::create_objects 4 %s\n", edl->local_session->clip_title);
239 strcpy(name, edl->local_session->clip_title);
241 set_icon(gui->clip_icon);
242 set_icon_vframe(mwindow->theme->get_image("clip_icon"));
247 strcpy(name, _(plugin->title));
251 if(plugin->picon->get_color_model() == BC_RGB888)
253 icon = new BC_Pixmap(gui,
254 plugin->picon->get_w(),
255 plugin->picon->get_h());
256 icon->draw_vframe(plugin->picon,
259 plugin->picon->get_w(),
260 plugin->picon->get_h(),
266 icon = new BC_Pixmap(gui,
270 icon_vframe = new VFrame (*plugin->picon);
274 icon = gui->file_icon;
275 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN];
278 set_icon_vframe(icon_vframe);
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);
290 icon = gui->file_icon;
291 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN];
293 set_icon_vframe(icon_vframe);
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,
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;
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();
340 delete newfolder_thread;
343 delete assetlist_menu;
344 delete folderlist_menu;
345 if(temp_picon) delete temp_picon;
348 int AWindowGUI::create_objects()
354 //printf("AWindowGUI::create_objects 1\n");
355 asset_titles[0] = _("Title");
356 asset_titles[1] = _("Comments");
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],
365 folder_icon = new BC_Pixmap(this,
366 BC_WindowBase::get_resources()->type_to_icon[ICON_FOLDER],
369 audio_icon = new BC_Pixmap(this,
370 BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND],
373 video_icon = new BC_Pixmap(this,
374 BC_WindowBase::get_resources()->type_to_icon[ICON_FILM],
379 clip_icon = new BC_Pixmap(this,
380 mwindow->theme->get_image("clip_icon"),
386 folders.append(picon = new AssetPicon(mwindow,
389 picon->persistent = 1;
390 folders.append(picon = new AssetPicon(mwindow,
393 picon->persistent = 1;
394 folders.append(picon = new AssetPicon(mwindow,
396 ATRANSITION_FOLDER));
397 picon->persistent = 1;
398 folders.append(picon = new AssetPicon(mwindow,
400 VTRANSITION_FOLDER));
401 picon->persistent = 1;
402 folders.append(picon = new AssetPicon(mwindow,
405 picon->persistent = 1;
407 create_label_folder();
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);
418 mwindow->theme->get_awindow_sizes(this);
421 add_subwindow(asset_list = new AWindowAssets(mwindow,
423 mwindow->theme->alist_x,
424 mwindow->theme->alist_y,
425 mwindow->theme->alist_w,
426 mwindow->theme->alist_h));
429 add_subwindow(divider = new AWindowDivider(mwindow,
431 mwindow->theme->adivider_x,
432 mwindow->theme->adivider_y,
433 mwindow->theme->adivider_w,
434 mwindow->theme->adivider_h));
437 divider->set_cursor(HSEPARATE_CURSOR);
440 add_subwindow(folder_list = new AWindowFolders(mwindow,
442 mwindow->theme->afolders_x,
443 mwindow->theme->afolders_y,
444 mwindow->theme->afolders_w,
445 mwindow->theme->afolders_h));
449 x = mwindow->theme->abuttons_x;
450 y = mwindow->theme->abuttons_y;
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();
464 add_subwindow(assetlist_menu = new AssetListMenu(mwindow, this));
467 assetlist_menu->create_objects();
471 add_subwindow(folderlist_menu = new FolderListMenu(mwindow, this));
472 folderlist_menu->create_objects();
473 //printf("AWindowGUI::create_objects 2\n");
476 create_custom_xatoms();
481 int AWindowGUI::resize_event(int w, int h)
483 mwindow->session->awindow_x = get_x();
484 mwindow->session->awindow_y = get_y();
485 mwindow->session->awindow_w = w;
486 mwindow->session->awindow_h = h;
488 mwindow->theme->get_awindow_sizes(this);
489 mwindow->theme->draw_awindow_bg(this);
491 asset_list->reposition_window(mwindow->theme->alist_x,
492 mwindow->theme->alist_y,
493 mwindow->theme->alist_w,
494 mwindow->theme->alist_h);
495 divider->reposition_window(mwindow->theme->adivider_x,
496 mwindow->theme->adivider_y,
497 mwindow->theme->adivider_w,
498 mwindow->theme->adivider_h);
499 folder_list->reposition_window(mwindow->theme->afolders_x,
500 mwindow->theme->afolders_y,
501 mwindow->theme->afolders_w,
502 mwindow->theme->afolders_h);
504 int x = mwindow->theme->abuttons_x;
505 int y = mwindow->theme->abuttons_y;
507 // new_bin->reposition_window(x, y);
508 // x += new_bin->get_w();
509 // delete_bin->reposition_window(x, y);
510 // x += delete_bin->get_w();
511 // rename_bin->reposition_window(x, y);
512 // x += rename_bin->get_w();
513 // delete_disk->reposition_window(x, y);
514 // x += delete_disk->get_w();
515 // delete_project->reposition_window(x, y);
516 // x += delete_project->get_w();
517 // info->reposition_window(x, y);
518 // x += info->get_w();
519 // redraw_index->reposition_window(x, y);
520 // x += redraw_index->get_w();
521 // paste->reposition_window(x, y);
522 // x += paste->get_w();
523 // append->reposition_window(x, y);
524 // x += append->get_w();
525 // view->reposition_window(x, y);
527 BC_WindowBase::resize_event(w, h);
531 int AWindowGUI::translation_event()
533 mwindow->session->awindow_x = get_x();
534 mwindow->session->awindow_y = get_y();
538 void AWindowGUI::reposition_objects()
540 mwindow->theme->get_awindow_sizes(this);
541 asset_list->reposition_window(mwindow->theme->alist_x,
542 mwindow->theme->alist_y,
543 mwindow->theme->alist_w,
544 mwindow->theme->alist_h);
545 divider->reposition_window(mwindow->theme->adivider_x,
546 mwindow->theme->adivider_y,
547 mwindow->theme->adivider_w,
548 mwindow->theme->adivider_h);
549 folder_list->reposition_window(mwindow->theme->afolders_x,
550 mwindow->theme->afolders_y,
551 mwindow->theme->afolders_w,
552 mwindow->theme->afolders_h);
556 int AWindowGUI::close_event()
559 mwindow->session->show_awindow = 0;
562 mwindow->gui->lock_window("AWindowGUI::close_event");
563 mwindow->gui->mainmenu->show_awindow->set_checked(0);
564 mwindow->gui->unlock_window();
566 lock_window("AWindowGUI::close_event");
567 mwindow->save_defaults();
572 int AWindowGUI::keypress_event()
574 switch(get_keypress())
590 int AWindowGUI::create_custom_xatoms()
592 UpdateAssetsXAtom = create_xatom("CWINDOWGUI_UPDATE_ASSETS");
595 int AWindowGUI::recieve_custom_xatoms(xatom_event *event)
597 if (event->message_type == UpdateAssetsXAtom)
605 void AWindowGUI::async_update_assets()
608 event.message_type = UpdateAssetsXAtom;
609 send_custom_xatom(&event);
618 void AWindowGUI::update_folder_list()
620 //printf("AWindowGUI::update_folder_list 1\n");
621 for(int i = 0; i < folders.total; i++)
623 AssetPicon *picon = (AssetPicon*)folders.values[i];
626 //printf("AWindowGUI::update_folder_list 1\n");
628 // Search assets for folders
629 for(int i = 0; i < mwindow->edl->folders.total; i++)
631 char *folder = mwindow->edl->folders.values[i];
633 //printf("AWindowGUI::update_folder_list 1.1\n");
635 for(int j = 0; j < folders.total; j++)
637 AssetPicon *picon = (AssetPicon*)folders.values[j];
638 if(!strcasecmp(picon->get_text(), folder))
648 AssetPicon *picon = new AssetPicon(mwindow, this, folder);
649 picon->create_objects();
650 folders.append(picon);
652 //printf("AWindowGUI::update_folder_list 1.3\n");
654 //printf("AWindowGUI::update_folder_list 1\n");
655 //for(int i = 0; i < folders.total; i++)
656 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
659 for(int i = folders.total - 1; i >= 0; i--)
661 AssetPicon *picon = (AssetPicon*)folders.values[i];
662 if(!picon->in_use && !picon->persistent)
665 folders.remove_number(i);
668 //for(int i = 0; i < folders.total; i++)
669 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
670 //printf("AWindowGUI::update_folder_list 2\n");
673 void AWindowGUI::create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
679 ArrayList<PluginServer*> plugindb;
681 // Get pointers to plugindb entries
682 mwindow->create_plugindb(do_audio,
689 for(int i = 0; i < plugindb.total; i++)
691 PluginServer *server = plugindb.values[i];
694 // Create new listitem
697 AssetPicon *picon = new AssetPicon(mwindow, this, server);
698 picon->create_objects();
699 output->append(picon);
704 void AWindowGUI::create_label_folder()
707 for(current = mwindow->edl->labels->first; current; current = NEXT) {
708 AssetPicon *picon = new AssetPicon(mwindow, this, current);
709 picon->create_objects();
710 labellist.append(picon);
715 void AWindowGUI::update_asset_list()
717 //printf("AWindowGUI::update_asset_list 1\n");
718 for(int i = 0; i < assets.total; i++)
720 AssetPicon *picon = (AssetPicon*)assets.values[i];
728 //printf("AWindowGUI::update_asset_list 2\n");
731 // Synchronize EDL clips
732 for(int i = 0; i < mwindow->edl->clips.total; i++)
736 // Look for clip in existing listitems
737 for(int j = 0; j < assets.total && !exists; j++)
739 AssetPicon *picon = (AssetPicon*)assets.values[j];
741 if(picon->id == mwindow->edl->clips.values[i]->id)
743 picon->edl = mwindow->edl->clips.values[i];
744 picon->set_text(mwindow->edl->clips.values[i]->local_session->clip_title);
750 // Create new listitem
753 AssetPicon *picon = new AssetPicon(mwindow,
755 mwindow->edl->clips.values[i]);
756 picon->create_objects();
757 assets.append(picon);
767 //printf("AWindowGUI::update_asset_list 3 %d\n", assets.total);
768 // Synchronize EDL assets
769 for(Asset *current = mwindow->edl->assets->first;
775 //printf("AWindowGUI::update_asset_list 3 %s\n", current->path);
776 // Look for asset in existing listitems
777 for(int j = 0; j < assets.total && !exists; j++)
779 AssetPicon *picon = (AssetPicon*)assets.values[j];
781 if(picon->id == current->id)
783 //printf("AWindowGUI::update_asset_list 4 %p %d %d\n", picon->asset, picon->get_icon_x(), picon->get_icon_y());
784 picon->asset = current;
791 //printf("AWindowGUI::update_asset_list 5\n");
792 // Create new listitem
795 //printf("AWindowGUI::update_asset_list 4.1 %s\n", current->path);
796 AssetPicon *picon = new AssetPicon(mwindow, this, current);
797 //printf("AWindowGUI::update_asset_list 4.2 %s\n", current->path);
798 picon->create_objects();
799 //printf("AWindowGUI::update_asset_list 4.3 %s\n", current->path);
800 assets.append(picon);
801 //printf("AWindowGUI::update_asset_list 4.4 %s\n", current->path);
813 //printf("AWindowGUI::update_asset_list 6\n");
814 for(int i = assets.total - 1; i >= 0; i--)
816 AssetPicon *picon = (AssetPicon*)assets.values[i];
817 //printf("AWindowGUI::update_asset_list %s %d\n", picon->asset->path, picon->in_use);
821 assets.remove_number(i);
824 //printf("AWindowGUI::update_asset_list 7 %d\n", assets.total);
831 void AWindowGUI::sort_assets()
833 //printf("AWindowGUI::sort_assets 1 %s\n", mwindow->edl->session->current_folder);
834 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
835 sort_picons(&aeffects,
838 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
839 sort_picons(&veffects,
842 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
843 sort_picons(&atransitions,
846 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
847 sort_picons(&vtransitions,
850 if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
851 ;// Labels should ALWAYS be sorted by time.
854 mwindow->edl->session->current_folder);
869 void AWindowGUI::collect_assets()
872 mwindow->session->drag_assets->remove_all();
873 mwindow->session->drag_clips->remove_all();
876 AssetPicon *result = (AssetPicon*)asset_list->get_selection(0, i++);
879 if(result->asset) mwindow->session->drag_assets->append(result->asset);
880 if(result->edl) mwindow->session->drag_clips->append(result->edl);
884 void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst,
885 ArrayList<BC_ListBoxItem*> *src,
888 // Remove current pointers
890 dst[1].remove_all_objects();
892 // Create new pointers
893 //if(folder) printf("AWindowGUI::copy_picons 1 %s\n", folder);
894 for(int i = 0; i < src->total; i++)
896 AssetPicon *picon = (AssetPicon*)src->values[i];
897 //printf("AWindowGUI::copy_picons 2 %s\n", picon->asset->folder);
899 (folder && picon->asset && !strcasecmp(picon->asset->folder, folder)) ||
900 (folder && picon->edl && !strcasecmp(picon->edl->local_session->folder, folder)))
902 BC_ListBoxItem *item2, *item1;
903 dst[0].append(item1 = picon);
905 dst[1].append(item2 = new BC_ListBoxItem(picon->edl->local_session->clip_notes));
907 if(picon->label && picon->label->textstr)
908 dst[1].append(item2 = new BC_ListBoxItem(picon->label->textstr));
910 dst[1].append(item2 = new BC_ListBoxItem(""));
911 item1->set_autoplace_text(1);
912 item2->set_autoplace_text(1);
913 //printf("AWindowGUI::copy_picons 3 %s\n", picon->get_text());
918 void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src,
921 //printf("AWindowGUI::sort_picons 1\n")
926 for(int i = 0; i < src->total - 1; i++)
928 BC_ListBoxItem *item1 = src->values[i];
929 BC_ListBoxItem *item2 = src->values[i + 1];
930 item1->set_autoplace_icon(1);
931 item2->set_autoplace_icon(1);
932 item1->set_autoplace_text(1);
933 item2->set_autoplace_text(1);
934 if(strcmp(item1->get_text(), item2->get_text()) > 0)
936 src->values[i + 1] = item1;
937 src->values[i] = item2;
945 void AWindowGUI::filter_displayed_assets()
947 allow_iconlisting = 1;
948 asset_titles[0] = _("Title");
949 asset_titles[1] = _("Comments");
950 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
951 copy_picons(displayed_assets,
955 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
956 copy_picons(displayed_assets,
960 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
961 copy_picons(displayed_assets,
965 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
966 copy_picons(displayed_assets,
970 if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER)) {
971 copy_picons(displayed_assets,
974 asset_titles[0] = _("Time Stamps");
975 asset_titles[1] = _("Title");
976 allow_iconlisting = 0;
979 copy_picons(displayed_assets,
981 mwindow->edl->session->current_folder);
982 // Ensure the current folder icon is highlighted
983 for(int i = 0; i < folders.total; i++)
985 if(!strcasecmp(mwindow->edl->session->current_folder, folders.values[i]->get_text()))
986 folders.values[i]->set_selected(1);
988 folders.values[i]->set_selected(0);
993 void AWindowGUI::update_assets()
995 //printf("AWindowGUI::update_assets 1\n");
996 update_folder_list();
997 //printf("AWindowGUI::update_assets 2\n");
999 labellist.remove_all_objects();
1000 create_label_folder();
1001 //printf("AWindowGUI::update_assets 3\n");
1002 filter_displayed_assets();
1004 //for(int i = 0; i < folders.total; i++)
1005 //printf("AWindowGUI::update_assets 4\n");
1006 // printf("AWindowGUI::update_assets %s\n", folders.values[i]->get_text());
1007 if(mwindow->edl->session->folderlist_format != folder_list->get_format())
1008 folder_list->update_format(mwindow->edl->session->folderlist_format, 0);
1009 folder_list->update(&folders,
1013 folder_list->get_xposition(),
1014 folder_list->get_yposition(),
1016 //printf("AWindowGUI::update_assets 5\n");
1018 if(mwindow->edl->session->assetlist_format != asset_list->get_format())
1019 asset_list->update_format(mwindow->edl->session->assetlist_format, 0);
1022 //printf("AWindowGUI::update_assets 6 %d\n", displayed_assets[0].total);
1023 asset_list->update(displayed_assets,
1025 mwindow->edl->session->asset_columns,
1027 asset_list->get_xposition(),
1028 asset_list->get_yposition(),
1031 //printf("AWindowGUI::update_assets 7\n");
1034 //printf("AWindowGUI::update_assets 8\n");
1038 int AWindowGUI::current_folder_number()
1041 for(int i = 0; i < folders.total; i++)
1043 if(!strcasecmp(folders.values[i]->get_text(), mwindow->edl->session->current_folder))
1052 int AWindowGUI::drag_motion()
1054 if(get_hidden()) return 0;
1060 int AWindowGUI::drag_stop()
1062 if(get_hidden()) return 0;
1067 Asset* AWindowGUI::selected_asset()
1069 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1070 if(picon) return picon->asset;
1073 PluginServer* AWindowGUI::selected_plugin()
1075 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1076 if(picon) return picon->plugin;
1079 AssetPicon* AWindowGUI::selected_folder()
1081 AssetPicon *picon = (AssetPicon*)folder_list->get_selection(0, 0);
1094 AWindowDivider::AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1095 : BC_SubWindow(x, y, w, h)
1097 this->mwindow = mwindow;
1100 AWindowDivider::~AWindowDivider()
1104 int AWindowDivider::button_press_event()
1106 if(is_event_win() && cursor_inside())
1108 mwindow->session->current_operation = DRAG_PARTITION;
1114 int AWindowDivider::cursor_motion_event()
1116 if(mwindow->session->current_operation == DRAG_PARTITION)
1118 mwindow->session->afolders_w = gui->get_relative_cursor_x();
1119 gui->reposition_objects();
1124 int AWindowDivider::button_release_event()
1126 if(mwindow->session->current_operation == DRAG_PARTITION)
1128 mwindow->session->current_operation = NO_OPERATION;
1139 AWindowFolders::AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1144 mwindow->edl->session->folderlist_format == FOLDERS_ICONS ?
1145 LISTBOX_ICONS : LISTBOX_TEXT,
1146 &gui->folders, // Each column has an ArrayList of BC_ListBoxItems.
1147 0, // Titles for columns. Set to 0 for no titles
1148 0, // width of each column
1149 1, // Total columns.
1150 0, // Pixel of top of window.
1151 0, // If this listbox is a popup window
1152 LISTBOX_SINGLE, // Select one item or multiple items
1153 ICON_TOP, // Position of icon relative to text of each item
1156 this->mwindow = mwindow;
1161 AWindowFolders::~AWindowFolders()
1165 int AWindowFolders::selection_changed()
1167 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1170 strcpy(mwindow->edl->session->current_folder, picon->get_text());
1171 //printf("AWindowFolders::selection_changed 1\n");
1172 gui->asset_list->draw_background();
1173 gui->async_update_assets();
1178 int AWindowFolders::button_press_event()
1182 result = BC_ListBox::button_press_event();
1186 if(get_buttonpress() == 3 && is_event_win() && cursor_inside())
1188 gui->folderlist_menu->update_titles();
1189 gui->folderlist_menu->activate_menu();
1204 AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1209 (mwindow->edl->session->assetlist_format == ASSETS_ICONS && gui->allow_iconlisting ) ?
1210 LISTBOX_ICONS : LISTBOX_TEXT,
1211 &gui->assets, // Each column has an ArrayList of BC_ListBoxItems.
1212 gui->asset_titles, // Titles for columns. Set to 0 for no titles
1213 mwindow->edl->session->asset_columns, // width of each column
1214 1, // Total columns.
1215 0, // Pixel of top of window.
1216 0, // If this listbox is a popup window
1217 LISTBOX_MULTIPLE, // Select one item or multiple items
1218 ICON_TOP, // Position of icon relative to text of each item
1221 this->mwindow = mwindow;
1226 AWindowAssets::~AWindowAssets()
1230 int AWindowAssets::button_press_event()
1234 result = BC_ListBox::button_press_event();
1236 if(!result && get_buttonpress() == 3 && is_event_win() && cursor_inside())
1238 BC_ListBox::deactivate_selection();
1239 gui->assetlist_menu->update_titles();
1240 gui->assetlist_menu->activate_menu();
1249 int AWindowAssets::handle_event()
1251 //printf("AWindowAssets::handle_event 1 %d %d\n", get_buttonpress(), get_selection(0, 0));
1252 if(get_selection(0, 0))
1254 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1258 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1262 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1266 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1271 //printf("AWindowAssets::handle_event 2 %d %d\n", get_buttonpress(), get_selection(0, 0));
1272 mwindow->vwindow->gui->lock_window("AWindowAssets::handle_event");
1274 if(((AssetPicon*)get_selection(0, 0))->asset)
1275 mwindow->vwindow->change_source(((AssetPicon*)get_selection(0, 0))->asset);
1277 if(((AssetPicon*)get_selection(0, 0))->edl)
1278 mwindow->vwindow->change_source(((AssetPicon*)get_selection(0, 0))->edl);
1280 mwindow->vwindow->gui->unlock_window();
1288 int AWindowAssets::selection_changed()
1290 // Show popup window
1291 if(get_button_down() && get_buttonpress() == 3 && get_selection(0, 0))
1293 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER) ||
1294 !strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER) ||
1295 !strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER) ||
1296 !strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1298 gui->assetlist_menu->update_titles();
1299 gui->assetlist_menu->activate_menu();
1302 if (!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
1304 if(((AssetPicon*)get_selection(0, 0))->label)
1305 gui->label_menu->activate_menu();
1309 if(((AssetPicon*)get_selection(0, 0))->asset)
1310 gui->asset_menu->update();
1312 if(((AssetPicon*)get_selection(0, 0))->edl)
1313 gui->asset_menu->update();
1317 gui->asset_menu->activate_menu();
1320 BC_ListBox::deactivate_selection();
1326 void AWindowAssets::draw_background()
1328 BC_ListBox::draw_background();
1329 set_color(BC_WindowBase::get_resources()->audiovideo_color);
1330 set_font(LARGEFONT);
1332 get_text_width(LARGEFONT, mwindow->edl->session->current_folder) - 4,
1334 mwindow->edl->session->current_folder,
1339 int AWindowAssets::drag_start_event()
1341 int collect_pluginservers = 0;
1342 int collect_assets = 0;
1344 if(BC_ListBox::drag_start_event())
1346 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1348 mwindow->session->current_operation = DRAG_AEFFECT;
1349 collect_pluginservers = 1;
1352 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1354 mwindow->session->current_operation = DRAG_VEFFECT;
1355 collect_pluginservers = 1;
1358 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1360 mwindow->session->current_operation = DRAG_ATRANSITION;
1361 collect_pluginservers = 1;
1364 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1366 mwindow->session->current_operation = DRAG_VTRANSITION;
1367 collect_pluginservers = 1;
1370 if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
1376 mwindow->session->current_operation = DRAG_ASSET;
1381 if(collect_pluginservers)
1384 mwindow->session->drag_pluginservers->remove_all();
1387 AssetPicon *result = (AssetPicon*)get_selection(0, i++);
1390 mwindow->session->drag_pluginservers->append(result->plugin);
1396 gui->collect_assets();
1404 int AWindowAssets::drag_motion_event()
1406 BC_ListBox::drag_motion_event();
1408 mwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1409 mwindow->gui->drag_motion();
1410 mwindow->gui->unlock_window();
1412 mwindow->vwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1413 mwindow->vwindow->gui->drag_motion();
1414 mwindow->vwindow->gui->unlock_window();
1416 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1417 mwindow->cwindow->gui->drag_motion();
1418 mwindow->cwindow->gui->unlock_window();
1422 int AWindowAssets::drag_stop_event()
1426 result = gui->drag_stop();
1431 mwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1432 result = mwindow->gui->drag_stop();
1433 mwindow->gui->unlock_window();
1438 mwindow->vwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1439 result = mwindow->vwindow->gui->drag_stop();
1440 mwindow->vwindow->gui->unlock_window();
1445 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1446 result = mwindow->cwindow->gui->drag_stop();
1447 mwindow->cwindow->gui->unlock_window();
1452 if(result) get_drag_popup()->set_animation(0);
1454 BC_ListBox::drag_stop_event();
1455 mwindow->session->current_operation = ::NO_OPERATION; // since NO_OPERATION is also defined in listbox, we have to reach for global scope...
1459 int AWindowAssets::column_resize_event()
1461 mwindow->edl->session->asset_columns[0] = get_column_width(0);
1462 mwindow->edl->session->asset_columns[1] = get_column_width(1);
1477 AWindowNewFolder::AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1478 : BC_Button(x, y, mwindow->theme->newbin_data)
1480 this->mwindow = mwindow;
1482 set_tooltip(_("New bin"));
1485 int AWindowNewFolder::handle_event()
1487 gui->newfolder_thread->start_new_folder();
1491 AWindowDeleteFolder::AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1492 : BC_Button(x, y, mwindow->theme->deletebin_data)
1494 this->mwindow = mwindow;
1496 set_tooltip(_("Delete bin"));
1499 int AWindowDeleteFolder::handle_event()
1501 if(gui->folder_list->get_selection(0, 0))
1503 BC_ListBoxItem *folder = gui->folder_list->get_selection(0, 0);
1504 mwindow->delete_folder(folder->get_text());
1509 AWindowRenameFolder::AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1510 : BC_Button(x, y, mwindow->theme->renamebin_data)
1512 this->mwindow = mwindow;
1514 set_tooltip(_("Rename bin"));
1517 int AWindowRenameFolder::handle_event()
1522 AWindowDeleteDisk::AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1523 : BC_Button(x, y, mwindow->theme->deletedisk_data)
1525 this->mwindow = mwindow;
1527 set_tooltip(_("Delete asset from disk"));
1530 int AWindowDeleteDisk::handle_event()
1535 AWindowDeleteProject::AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1536 : BC_Button(x, y, mwindow->theme->deleteproject_data)
1538 this->mwindow = mwindow;
1540 set_tooltip(_("Delete asset from project"));
1543 int AWindowDeleteProject::handle_event()
1548 AWindowInfo::AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1549 : BC_Button(x, y, mwindow->theme->infoasset_data)
1551 this->mwindow = mwindow;
1553 set_tooltip(_("Edit information on asset"));
1556 int AWindowInfo::handle_event()
1558 gui->awindow->asset_edit->edit_asset(gui->selected_asset());
1562 AWindowRedrawIndex::AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1563 : BC_Button(x, y, mwindow->theme->redrawindex_data)
1565 this->mwindow = mwindow;
1567 set_tooltip(_("Redraw index"));
1570 int AWindowRedrawIndex::handle_event()
1575 AWindowPaste::AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1576 : BC_Button(x, y, mwindow->theme->pasteasset_data)
1578 this->mwindow = mwindow;
1580 set_tooltip(_("Paste asset on recordable tracks"));
1583 int AWindowPaste::handle_event()
1588 AWindowAppend::AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1589 : BC_Button(x, y, mwindow->theme->appendasset_data)
1591 this->mwindow = mwindow;
1593 set_tooltip(_("Append asset in new tracks"));
1596 int AWindowAppend::handle_event()
1601 AWindowView::AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1602 : BC_Button(x, y, mwindow->theme->viewasset_data)
1604 this->mwindow = mwindow;
1606 set_tooltip(_("View asset"));
1609 int AWindowView::handle_event()
1616 LabelPopup::LabelPopup(MWindow *mwindow, AWindowGUI *gui)
1623 this->mwindow = mwindow;
1627 LabelPopup::~LabelPopup()
1631 void LabelPopup::create_objects()
1633 add_item(editlabel = new LabelPopupEdit(mwindow, this));
1639 LabelPopupEdit::LabelPopupEdit(MWindow *mwindow, LabelPopup *popup)
1640 : BC_MenuItem(_("Edit..."))
1642 this->mwindow = mwindow;
1643 this->popup = popup;
1646 LabelPopupEdit::~LabelPopupEdit()
1650 int LabelPopupEdit::handle_event()
1655 AssetPicon *result = (AssetPicon*)mwindow->awindow->gui->asset_list->get_selection(0, i++);
1659 mwindow->awindow->gui->awindow->label_edit->edit_label(result->label);