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;
84 AssetPicon::AssetPicon(MWindow *mwindow,
90 this->mwindow = mwindow;
97 AssetPicon::~AssetPicon()
101 if(icon != gui->file_icon &&
102 icon != gui->audio_icon &&
103 icon != gui->folder_icon &&
104 icon != gui->clip_icon &&
105 icon != gui->video_icon)
113 void AssetPicon::reset()
126 void AssetPicon::create_objects()
129 char name[BCTEXTLEN];
130 int pixmap_w, pixmap_h;
137 fs.extract_name(name, asset->path);
139 if(asset->video_data)
141 if(mwindow->preferences->use_thumbnails)
143 File *file = mwindow->video_cache->check_out(asset, mwindow->edl);
147 pixmap_w = pixmap_h * asset->width / asset->height;
150 file->set_video_position(0, mwindow->edl->session->frame_rate);
152 if(gui->temp_picon &&
153 (gui->temp_picon->get_w() != asset->width ||
154 gui->temp_picon->get_h() != asset->height))
156 delete gui->temp_picon;
162 gui->temp_picon = new VFrame(0,
168 file->read_frame(gui->temp_picon);
170 icon = new BC_Pixmap(gui, pixmap_w, pixmap_h);
171 icon->draw_vframe(gui->temp_picon,
178 //printf("%d %d\n", gui->temp_picon->get_w(), gui->temp_picon->get_h());
179 icon_vframe = new VFrame(0,
183 cmodel_transfer(icon_vframe->get_rows(), /* Leave NULL if non existent */
184 gui->temp_picon->get_rows(),
185 0, /* Leave NULL if non existent */
188 0, /* Leave NULL if non existent */
191 0, /* Dimensions to capture from input frame */
193 gui->temp_picon->get_w(),
194 gui->temp_picon->get_h(),
195 0, /* Dimensions to project on output frame */
201 0, /* When transfering BC_RGBA8888 to non-alpha this is the background color in 0xRRGGBB hex */
202 0, /* For planar use the luma rowspan */
203 0); /* For planar use the luma rowspan */
206 mwindow->video_cache->check_in(asset);
210 icon = gui->video_icon;
211 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
217 icon = gui->video_icon;
218 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
222 if(asset->audio_data)
224 icon = gui->audio_icon;
225 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND];
227 //printf("AssetPicon::create_objects 2\n");
230 set_icon_vframe(icon_vframe);
231 //printf("AssetPicon::create_objects 4\n");
236 //printf("AssetPicon::create_objects 4 %s\n", edl->local_session->clip_title);
237 strcpy(name, edl->local_session->clip_title);
239 set_icon(gui->clip_icon);
240 set_icon_vframe(mwindow->theme->get_image("clip_icon"));
245 strcpy(name, _(plugin->title));
249 if(plugin->picon->get_color_model() == BC_RGB888)
251 icon = new BC_Pixmap(gui,
252 plugin->picon->get_w(),
253 plugin->picon->get_h());
254 icon->draw_vframe(plugin->picon,
257 plugin->picon->get_w(),
258 plugin->picon->get_h(),
264 icon = new BC_Pixmap(gui,
268 icon_vframe = new VFrame (*plugin->picon);
272 icon = gui->file_icon;
273 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN];
276 set_icon_vframe(icon_vframe);
283 mwindow->edl->session->time_format,
284 mwindow->edl->session->sample_rate,
285 mwindow->edl->session->frame_rate,
286 mwindow->edl->session->frames_per_foot);
288 icon = gui->file_icon;
289 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN];
291 set_icon_vframe(icon_vframe);
301 AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow)
302 : BC_Window(PROGRAM_NAME ": Resources",
303 mwindow->session->awindow_x,
304 mwindow->session->awindow_y,
305 mwindow->session->awindow_w,
306 mwindow->session->awindow_h,
313 // printf("AWindowGUI::AWindowGUI %d %d %d %d\n",
314 // mwindow->session->awindow_x,
315 // mwindow->session->awindow_y,
316 // mwindow->session->awindow_w,
317 // mwindow->session->awindow_h);
318 this->mwindow = mwindow;
319 this->awindow = awindow;
321 allow_iconlisting = 1;
324 AWindowGUI::~AWindowGUI()
326 assets.remove_all_objects();
327 folders.remove_all_objects();
328 aeffects.remove_all_objects();
329 veffects.remove_all_objects();
330 atransitions.remove_all_objects();
331 vtransitions.remove_all_objects();
332 labellist.remove_all_objects();
333 displayed_assets[1].remove_all_objects();
338 delete newfolder_thread;
341 delete assetlist_menu;
342 delete folderlist_menu;
343 if(temp_picon) delete temp_picon;
346 int AWindowGUI::create_objects()
352 //printf("AWindowGUI::create_objects 1\n");
353 asset_titles[0] = _("Title");
354 asset_titles[1] = _("Comments");
358 set_icon(mwindow->theme->get_image("awindow_icon"));
359 file_icon = new BC_Pixmap(this,
360 BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN],
363 folder_icon = new BC_Pixmap(this,
364 BC_WindowBase::get_resources()->type_to_icon[ICON_FOLDER],
367 audio_icon = new BC_Pixmap(this,
368 BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND],
371 video_icon = new BC_Pixmap(this,
372 BC_WindowBase::get_resources()->type_to_icon[ICON_FILM],
377 clip_icon = new BC_Pixmap(this,
378 mwindow->theme->get_image("clip_icon"),
384 folders.append(picon = new AssetPicon(mwindow,
387 picon->persistent = 1;
388 folders.append(picon = new AssetPicon(mwindow,
391 picon->persistent = 1;
392 folders.append(picon = new AssetPicon(mwindow,
394 ATRANSITION_FOLDER));
395 picon->persistent = 1;
396 folders.append(picon = new AssetPicon(mwindow,
398 VTRANSITION_FOLDER));
399 picon->persistent = 1;
400 folders.append(picon = new AssetPicon(mwindow,
403 picon->persistent = 1;
405 create_label_folder();
409 create_persistent_folder(&aeffects, 1, 0, 1, 0);
410 create_persistent_folder(&veffects, 0, 1, 1, 0);
411 create_persistent_folder(&atransitions, 1, 0, 0, 1);
412 create_persistent_folder(&vtransitions, 0, 1, 0, 1);
416 mwindow->theme->get_awindow_sizes(this);
419 add_subwindow(asset_list = new AWindowAssets(mwindow,
421 mwindow->theme->alist_x,
422 mwindow->theme->alist_y,
423 mwindow->theme->alist_w,
424 mwindow->theme->alist_h));
427 add_subwindow(divider = new AWindowDivider(mwindow,
429 mwindow->theme->adivider_x,
430 mwindow->theme->adivider_y,
431 mwindow->theme->adivider_w,
432 mwindow->theme->adivider_h));
435 divider->set_cursor(HSEPARATE_CURSOR);
438 add_subwindow(folder_list = new AWindowFolders(mwindow,
440 mwindow->theme->afolders_x,
441 mwindow->theme->afolders_y,
442 mwindow->theme->afolders_w,
443 mwindow->theme->afolders_h));
447 x = mwindow->theme->abuttons_x;
448 y = mwindow->theme->abuttons_y;
452 newfolder_thread = new NewFolderThread(mwindow, this);
454 add_subwindow(asset_menu = new AssetPopup(mwindow, this));
455 asset_menu->create_objects();
457 add_subwindow(label_menu = new LabelPopup(mwindow, this));
458 label_menu->create_objects();
462 add_subwindow(assetlist_menu = new AssetListMenu(mwindow, this));
465 assetlist_menu->create_objects();
469 add_subwindow(folderlist_menu = new FolderListMenu(mwindow, this));
470 folderlist_menu->create_objects();
471 //printf("AWindowGUI::create_objects 2\n");
474 create_custom_xatoms();
479 int AWindowGUI::resize_event(int w, int h)
481 mwindow->session->awindow_x = get_x();
482 mwindow->session->awindow_y = get_y();
483 mwindow->session->awindow_w = w;
484 mwindow->session->awindow_h = h;
486 mwindow->theme->get_awindow_sizes(this);
487 mwindow->theme->draw_awindow_bg(this);
489 asset_list->reposition_window(mwindow->theme->alist_x,
490 mwindow->theme->alist_y,
491 mwindow->theme->alist_w,
492 mwindow->theme->alist_h);
493 divider->reposition_window(mwindow->theme->adivider_x,
494 mwindow->theme->adivider_y,
495 mwindow->theme->adivider_w,
496 mwindow->theme->adivider_h);
497 folder_list->reposition_window(mwindow->theme->afolders_x,
498 mwindow->theme->afolders_y,
499 mwindow->theme->afolders_w,
500 mwindow->theme->afolders_h);
502 int x = mwindow->theme->abuttons_x;
503 int y = mwindow->theme->abuttons_y;
505 // new_bin->reposition_window(x, y);
506 // x += new_bin->get_w();
507 // delete_bin->reposition_window(x, y);
508 // x += delete_bin->get_w();
509 // rename_bin->reposition_window(x, y);
510 // x += rename_bin->get_w();
511 // delete_disk->reposition_window(x, y);
512 // x += delete_disk->get_w();
513 // delete_project->reposition_window(x, y);
514 // x += delete_project->get_w();
515 // info->reposition_window(x, y);
516 // x += info->get_w();
517 // redraw_index->reposition_window(x, y);
518 // x += redraw_index->get_w();
519 // paste->reposition_window(x, y);
520 // x += paste->get_w();
521 // append->reposition_window(x, y);
522 // x += append->get_w();
523 // view->reposition_window(x, y);
525 BC_WindowBase::resize_event(w, h);
529 int AWindowGUI::translation_event()
531 mwindow->session->awindow_x = get_x();
532 mwindow->session->awindow_y = get_y();
536 void AWindowGUI::reposition_objects()
538 mwindow->theme->get_awindow_sizes(this);
539 asset_list->reposition_window(mwindow->theme->alist_x,
540 mwindow->theme->alist_y,
541 mwindow->theme->alist_w,
542 mwindow->theme->alist_h);
543 divider->reposition_window(mwindow->theme->adivider_x,
544 mwindow->theme->adivider_y,
545 mwindow->theme->adivider_w,
546 mwindow->theme->adivider_h);
547 folder_list->reposition_window(mwindow->theme->afolders_x,
548 mwindow->theme->afolders_y,
549 mwindow->theme->afolders_w,
550 mwindow->theme->afolders_h);
554 int AWindowGUI::close_event()
557 mwindow->session->show_awindow = 0;
560 mwindow->gui->lock_window("AWindowGUI::close_event");
561 mwindow->gui->mainmenu->show_awindow->set_checked(0);
562 mwindow->gui->unlock_window();
564 lock_window("AWindowGUI::close_event");
565 mwindow->save_defaults();
570 int AWindowGUI::keypress_event()
572 switch(get_keypress())
588 int AWindowGUI::create_custom_xatoms()
590 UpdateAssetsXAtom = create_xatom("CWINDOWGUI_UPDATE_ASSETS");
593 int AWindowGUI::recieve_custom_xatoms(xatom_event *event)
595 if (event->message_type == UpdateAssetsXAtom)
603 void AWindowGUI::async_update_assets()
606 event.message_type = UpdateAssetsXAtom;
607 send_custom_xatom(&event);
616 void AWindowGUI::update_folder_list()
618 //printf("AWindowGUI::update_folder_list 1\n");
619 for(int i = 0; i < folders.total; i++)
621 AssetPicon *picon = (AssetPicon*)folders.values[i];
624 //printf("AWindowGUI::update_folder_list 1\n");
626 // Search assets for folders
627 for(int i = 0; i < mwindow->edl->folders.total; i++)
629 char *folder = mwindow->edl->folders.values[i];
631 //printf("AWindowGUI::update_folder_list 1.1\n");
633 for(int j = 0; j < folders.total; j++)
635 AssetPicon *picon = (AssetPicon*)folders.values[j];
636 if(!strcasecmp(picon->get_text(), folder))
646 AssetPicon *picon = new AssetPicon(mwindow, this, folder);
647 picon->create_objects();
648 folders.append(picon);
650 //printf("AWindowGUI::update_folder_list 1.3\n");
652 //printf("AWindowGUI::update_folder_list 1\n");
653 //for(int i = 0; i < folders.total; i++)
654 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
657 for(int i = folders.total - 1; i >= 0; i--)
659 AssetPicon *picon = (AssetPicon*)folders.values[i];
660 if(!picon->in_use && !picon->persistent)
663 folders.remove_number(i);
666 //for(int i = 0; i < folders.total; i++)
667 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
668 //printf("AWindowGUI::update_folder_list 2\n");
671 void AWindowGUI::create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
677 ArrayList<PluginServer*> plugindb;
679 // Get pointers to plugindb entries
680 mwindow->create_plugindb(do_audio,
687 for(int i = 0; i < plugindb.total; i++)
689 PluginServer *server = plugindb.values[i];
692 // Create new listitem
695 AssetPicon *picon = new AssetPicon(mwindow, this, server);
696 picon->create_objects();
697 output->append(picon);
702 void AWindowGUI::create_label_folder()
705 for(current = mwindow->edl->labels->first; current; current = NEXT) {
706 AssetPicon *picon = new AssetPicon(mwindow, this, current);
707 picon->create_objects();
708 labellist.append(picon);
713 void AWindowGUI::update_asset_list()
715 //printf("AWindowGUI::update_asset_list 1\n");
716 for(int i = 0; i < assets.total; i++)
718 AssetPicon *picon = (AssetPicon*)assets.values[i];
726 //printf("AWindowGUI::update_asset_list 2\n");
729 // Synchronize EDL clips
730 for(int i = 0; i < mwindow->edl->clips.total; i++)
734 // Look for clip in existing listitems
735 for(int j = 0; j < assets.total && !exists; j++)
737 AssetPicon *picon = (AssetPicon*)assets.values[j];
739 if(picon->id == mwindow->edl->clips.values[i]->id)
741 picon->edl = mwindow->edl->clips.values[i];
742 picon->set_text(mwindow->edl->clips.values[i]->local_session->clip_title);
748 // Create new listitem
751 AssetPicon *picon = new AssetPicon(mwindow,
753 mwindow->edl->clips.values[i]);
754 picon->create_objects();
755 assets.append(picon);
765 //printf("AWindowGUI::update_asset_list 3 %d\n", assets.total);
766 // Synchronize EDL assets
767 for(Assets_list::iterator current = mwindow->edl->assets->begin();
768 current != mwindow->edl->assets->end();
773 //printf("AWindowGUI::update_asset_list 3 %s\n", current->path);
774 // Look for asset in existing listitems
775 for(int j = 0; j < assets.total && !exists; j++)
777 //AssetPicon *picon = (AssetPicon*)assets.values[j];
778 AssetPicon *picon = (AssetPicon*)assets.values[j];
780 if(picon->id == (*current)->id)
782 //printf("AWindowGUI::update_asset_list 4 %p %d %d\n", picon->asset, picon->get_icon_x(), picon->get_icon_y());
783 picon->asset = *current;
790 //printf("AWindowGUI::update_asset_list 5\n");
791 // Create new listitem
794 //printf("AWindowGUI::update_asset_list 4.1 %s\n", current->path);
795 AssetPicon *picon = new AssetPicon(mwindow, this, *current);
796 //printf("AWindowGUI::update_asset_list 4.2 %s\n", current->path);
797 picon->create_objects();
798 //printf("AWindowGUI::update_asset_list 4.3 %s\n", current->path);
799 assets.append(picon);
800 //printf("AWindowGUI::update_asset_list 4.4 %s\n", current->path);
812 //printf("AWindowGUI::update_asset_list 6\n");
813 for(int i = assets.total - 1; i >= 0; i--)
815 AssetPicon *picon = (AssetPicon*)assets.values[i];
816 //printf("AWindowGUI::update_asset_list %s %d\n", picon->asset->path, picon->in_use);
820 assets.remove_number(i);
823 //printf("AWindowGUI::update_asset_list 7 %d\n", assets.total);
830 void AWindowGUI::sort_assets()
832 //printf("AWindowGUI::sort_assets 1 %s\n", mwindow->edl->session->current_folder);
833 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
834 sort_picons(&aeffects,
837 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
838 sort_picons(&veffects,
841 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
842 sort_picons(&atransitions,
845 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
846 sort_picons(&vtransitions,
849 if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
850 ;// Labels should ALWAYS be sorted by time.
853 mwindow->edl->session->current_folder);
868 void AWindowGUI::collect_assets()
871 mwindow->session->drag_assets.clear();
872 mwindow->session->drag_clips->remove_all();
875 AssetPicon *result = (AssetPicon*)asset_list->get_selection(0, i++);
878 if(result->asset) mwindow->session->drag_assets.push_back(result->asset);
879 if(result->edl) mwindow->session->drag_clips->append(result->edl);
883 void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst,
884 ArrayList<BC_ListBoxItem*> *src,
887 // Remove current pointers
889 dst[1].remove_all_objects();
891 // Create new pointers
892 //if(folder) printf("AWindowGUI::copy_picons 1 %s\n", folder);
893 for(int i = 0; i < src->total; i++)
895 AssetPicon *picon = (AssetPicon*)src->values[i];
896 //printf("AWindowGUI::copy_picons 2 %s\n", picon->asset->folder);
898 (folder && picon->asset && !strcasecmp(picon->asset->folder, folder)) ||
899 (folder && picon->edl && !strcasecmp(picon->edl->local_session->folder, folder)))
901 BC_ListBoxItem *item2, *item1;
902 dst[0].append(item1 = picon);
904 dst[1].append(item2 = new BC_ListBoxItem(picon->edl->local_session->clip_notes));
906 if(picon->label && picon->label->textstr)
907 dst[1].append(item2 = new BC_ListBoxItem(picon->label->textstr));
909 dst[1].append(item2 = new BC_ListBoxItem(""));
910 item1->set_autoplace_text(1);
911 item2->set_autoplace_text(1);
912 //printf("AWindowGUI::copy_picons 3 %s\n", picon->get_text());
917 void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src,
920 //printf("AWindowGUI::sort_picons 1\n")
925 for(int i = 0; i < src->total - 1; i++)
927 BC_ListBoxItem *item1 = src->values[i];
928 BC_ListBoxItem *item2 = src->values[i + 1];
929 item1->set_autoplace_icon(1);
930 item2->set_autoplace_icon(1);
931 item1->set_autoplace_text(1);
932 item2->set_autoplace_text(1);
933 if(strcmp(item1->get_text(), item2->get_text()) > 0)
935 src->values[i + 1] = item1;
936 src->values[i] = item2;
944 void AWindowGUI::filter_displayed_assets()
946 allow_iconlisting = 1;
947 asset_titles[0] = _("Title");
948 asset_titles[1] = _("Comments");
949 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
950 copy_picons(displayed_assets,
954 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
955 copy_picons(displayed_assets,
959 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
960 copy_picons(displayed_assets,
964 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
965 copy_picons(displayed_assets,
969 if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER)) {
970 copy_picons(displayed_assets,
973 asset_titles[0] = _("Time Stamps");
974 asset_titles[1] = _("Title");
975 allow_iconlisting = 0;
978 copy_picons(displayed_assets,
980 mwindow->edl->session->current_folder);
981 // Ensure the current folder icon is highlighted
982 for(int i = 0; i < folders.total; i++)
984 if(!strcasecmp(mwindow->edl->session->current_folder, folders.values[i]->get_text()))
985 folders.values[i]->set_selected(1);
987 folders.values[i]->set_selected(0);
992 void AWindowGUI::update_assets()
994 //printf("AWindowGUI::update_assets 1\n");
995 update_folder_list();
996 //printf("AWindowGUI::update_assets 2\n");
998 labellist.remove_all_objects();
999 create_label_folder();
1000 //printf("AWindowGUI::update_assets 3\n");
1001 filter_displayed_assets();
1003 //for(int i = 0; i < folders.total; i++)
1004 //printf("AWindowGUI::update_assets 4\n");
1005 // printf("AWindowGUI::update_assets %s\n", folders.values[i]->get_text());
1006 if(mwindow->edl->session->folderlist_format != folder_list->get_format())
1007 folder_list->update_format(mwindow->edl->session->folderlist_format, 0);
1008 folder_list->update(&folders,
1012 folder_list->get_xposition(),
1013 folder_list->get_yposition(),
1015 //printf("AWindowGUI::update_assets 5\n");
1017 if(mwindow->edl->session->assetlist_format != asset_list->get_format())
1018 asset_list->update_format(mwindow->edl->session->assetlist_format, 0);
1021 //printf("AWindowGUI::update_assets 6 %d\n", displayed_assets[0].total);
1022 asset_list->update(displayed_assets,
1024 mwindow->edl->session->asset_columns,
1026 asset_list->get_xposition(),
1027 asset_list->get_yposition(),
1030 //printf("AWindowGUI::update_assets 7\n");
1033 //printf("AWindowGUI::update_assets 8\n");
1037 int AWindowGUI::current_folder_number()
1040 for(int i = 0; i < folders.total; i++)
1042 if(!strcasecmp(folders.values[i]->get_text(), mwindow->edl->session->current_folder))
1051 int AWindowGUI::drag_motion()
1053 if(get_hidden()) return 0;
1059 int AWindowGUI::drag_stop()
1061 if(get_hidden()) return 0;
1066 Asset_GC AWindowGUI::selected_asset()
1068 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1069 if(picon) return picon->asset;
1072 PluginServer* AWindowGUI::selected_plugin()
1074 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1075 if(picon) return picon->plugin;
1078 AssetPicon* AWindowGUI::selected_folder()
1080 AssetPicon *picon = (AssetPicon*)folder_list->get_selection(0, 0);
1093 AWindowDivider::AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1094 : BC_SubWindow(x, y, w, h)
1096 this->mwindow = mwindow;
1099 AWindowDivider::~AWindowDivider()
1103 int AWindowDivider::button_press_event()
1105 if(is_event_win() && cursor_inside())
1107 mwindow->session->current_operation = DRAG_PARTITION;
1113 int AWindowDivider::cursor_motion_event()
1115 if(mwindow->session->current_operation == DRAG_PARTITION)
1117 mwindow->session->afolders_w = gui->get_relative_cursor_x();
1118 gui->reposition_objects();
1123 int AWindowDivider::button_release_event()
1125 if(mwindow->session->current_operation == DRAG_PARTITION)
1127 mwindow->session->current_operation = NO_OPERATION;
1138 AWindowFolders::AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1143 mwindow->edl->session->folderlist_format == FOLDERS_ICONS ?
1144 LISTBOX_ICONS : LISTBOX_TEXT,
1145 &gui->folders, // Each column has an ArrayList of BC_ListBoxItems.
1146 0, // Titles for columns. Set to 0 for no titles
1147 0, // width of each column
1148 1, // Total columns.
1149 0, // Pixel of top of window.
1150 0, // If this listbox is a popup window
1151 LISTBOX_SINGLE, // Select one item or multiple items
1152 ICON_TOP, // Position of icon relative to text of each item
1155 this->mwindow = mwindow;
1160 AWindowFolders::~AWindowFolders()
1164 int AWindowFolders::selection_changed()
1166 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1169 strcpy(mwindow->edl->session->current_folder, picon->get_text());
1170 //printf("AWindowFolders::selection_changed 1\n");
1171 gui->asset_list->draw_background();
1172 gui->async_update_assets();
1177 int AWindowFolders::button_press_event()
1181 result = BC_ListBox::button_press_event();
1185 if(get_buttonpress() == 3 && is_event_win() && cursor_inside())
1187 gui->folderlist_menu->update_titles();
1188 gui->folderlist_menu->activate_menu();
1203 AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1208 (mwindow->edl->session->assetlist_format == ASSETS_ICONS && gui->allow_iconlisting ) ?
1209 LISTBOX_ICONS : LISTBOX_TEXT,
1210 &gui->assets, // Each column has an ArrayList of BC_ListBoxItems.
1211 gui->asset_titles, // Titles for columns. Set to 0 for no titles
1212 mwindow->edl->session->asset_columns, // width of each column
1213 1, // Total columns.
1214 0, // Pixel of top of window.
1215 0, // If this listbox is a popup window
1216 LISTBOX_MULTIPLE, // Select one item or multiple items
1217 ICON_TOP, // Position of icon relative to text of each item
1220 this->mwindow = mwindow;
1225 AWindowAssets::~AWindowAssets()
1229 int AWindowAssets::button_press_event()
1233 result = BC_ListBox::button_press_event();
1235 if(!result && get_buttonpress() == 3 && is_event_win() && cursor_inside())
1237 BC_ListBox::deactivate_selection();
1238 gui->assetlist_menu->update_titles();
1239 gui->assetlist_menu->activate_menu();
1248 int AWindowAssets::handle_event()
1250 //printf("AWindowAssets::handle_event 1 %d %d\n", get_buttonpress(), get_selection(0, 0));
1251 if(get_selection(0, 0))
1253 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1257 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1261 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1265 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1270 //printf("AWindowAssets::handle_event 2 %d %d\n", get_buttonpress(), get_selection(0, 0));
1271 mwindow->vwindow->gui->lock_window("AWindowAssets::handle_event");
1273 if(((AssetPicon*)get_selection(0, 0))->asset)
1274 mwindow->vwindow->change_source(((AssetPicon*)get_selection(0, 0))->asset);
1276 if(((AssetPicon*)get_selection(0, 0))->edl)
1277 mwindow->vwindow->change_source(((AssetPicon*)get_selection(0, 0))->edl);
1279 mwindow->vwindow->gui->unlock_window();
1287 int AWindowAssets::selection_changed()
1289 // Show popup window
1290 if(get_button_down() && get_buttonpress() == 3 && get_selection(0, 0))
1292 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER) ||
1293 !strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER) ||
1294 !strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER) ||
1295 !strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1297 gui->assetlist_menu->update_titles();
1298 gui->assetlist_menu->activate_menu();
1301 if (!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
1303 if(((AssetPicon*)get_selection(0, 0))->label)
1304 gui->label_menu->activate_menu();
1308 if(((AssetPicon*)get_selection(0, 0))->asset)
1309 gui->asset_menu->update();
1311 if(((AssetPicon*)get_selection(0, 0))->edl)
1312 gui->asset_menu->update();
1316 gui->asset_menu->activate_menu();
1319 BC_ListBox::deactivate_selection();
1325 void AWindowAssets::draw_background()
1327 BC_ListBox::draw_background();
1328 set_color(BC_WindowBase::get_resources()->audiovideo_color);
1329 set_font(LARGEFONT);
1331 get_text_width(LARGEFONT, mwindow->edl->session->current_folder) - 4,
1333 mwindow->edl->session->current_folder,
1338 int AWindowAssets::drag_start_event()
1340 int collect_pluginservers = 0;
1341 int collect_assets = 0;
1343 if(BC_ListBox::drag_start_event())
1345 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1347 mwindow->session->current_operation = DRAG_AEFFECT;
1348 collect_pluginservers = 1;
1351 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1353 mwindow->session->current_operation = DRAG_VEFFECT;
1354 collect_pluginservers = 1;
1357 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1359 mwindow->session->current_operation = DRAG_ATRANSITION;
1360 collect_pluginservers = 1;
1363 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1365 mwindow->session->current_operation = DRAG_VTRANSITION;
1366 collect_pluginservers = 1;
1369 if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
1375 mwindow->session->current_operation = DRAG_ASSET;
1380 if(collect_pluginservers)
1383 mwindow->session->drag_pluginservers->remove_all();
1386 AssetPicon *result = (AssetPicon*)get_selection(0, i++);
1389 mwindow->session->drag_pluginservers->append(result->plugin);
1395 gui->collect_assets();
1403 int AWindowAssets::drag_motion_event()
1405 BC_ListBox::drag_motion_event();
1407 mwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1408 mwindow->gui->drag_motion();
1409 mwindow->gui->unlock_window();
1411 mwindow->vwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1412 mwindow->vwindow->gui->drag_motion();
1413 mwindow->vwindow->gui->unlock_window();
1415 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1416 mwindow->cwindow->gui->drag_motion();
1417 mwindow->cwindow->gui->unlock_window();
1421 int AWindowAssets::drag_stop_event()
1425 result = gui->drag_stop();
1430 mwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1431 result = mwindow->gui->drag_stop();
1432 mwindow->gui->unlock_window();
1437 mwindow->vwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1438 result = mwindow->vwindow->gui->drag_stop();
1439 mwindow->vwindow->gui->unlock_window();
1444 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1445 result = mwindow->cwindow->gui->drag_stop();
1446 mwindow->cwindow->gui->unlock_window();
1451 if(result) get_drag_popup()->set_animation(0);
1453 BC_ListBox::drag_stop_event();
1454 mwindow->session->current_operation = ::NO_OPERATION; // since NO_OPERATION is also defined in listbox, we have to reach for global scope...
1458 int AWindowAssets::column_resize_event()
1460 mwindow->edl->session->asset_columns[0] = get_column_width(0);
1461 mwindow->edl->session->asset_columns[1] = get_column_width(1);
1476 AWindowNewFolder::AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1477 : BC_Button(x, y, mwindow->theme->newbin_data)
1479 this->mwindow = mwindow;
1481 set_tooltip(_("New bin"));
1484 int AWindowNewFolder::handle_event()
1486 gui->newfolder_thread->start_new_folder();
1490 AWindowDeleteFolder::AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1491 : BC_Button(x, y, mwindow->theme->deletebin_data)
1493 this->mwindow = mwindow;
1495 set_tooltip(_("Delete bin"));
1498 int AWindowDeleteFolder::handle_event()
1500 if(gui->folder_list->get_selection(0, 0))
1502 BC_ListBoxItem *folder = gui->folder_list->get_selection(0, 0);
1503 mwindow->delete_folder(folder->get_text());
1508 AWindowRenameFolder::AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1509 : BC_Button(x, y, mwindow->theme->renamebin_data)
1511 this->mwindow = mwindow;
1513 set_tooltip(_("Rename bin"));
1516 int AWindowRenameFolder::handle_event()
1521 AWindowDeleteDisk::AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1522 : BC_Button(x, y, mwindow->theme->deletedisk_data)
1524 this->mwindow = mwindow;
1526 set_tooltip(_("Delete asset from disk"));
1529 int AWindowDeleteDisk::handle_event()
1534 AWindowDeleteProject::AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1535 : BC_Button(x, y, mwindow->theme->deleteproject_data)
1537 this->mwindow = mwindow;
1539 set_tooltip(_("Delete asset from project"));
1542 int AWindowDeleteProject::handle_event()
1547 AWindowInfo::AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1548 : BC_Button(x, y, mwindow->theme->infoasset_data)
1550 this->mwindow = mwindow;
1552 set_tooltip(_("Edit information on asset"));
1555 int AWindowInfo::handle_event()
1557 gui->awindow->asset_edit->edit_asset(gui->selected_asset());
1561 AWindowRedrawIndex::AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1562 : BC_Button(x, y, mwindow->theme->redrawindex_data)
1564 this->mwindow = mwindow;
1566 set_tooltip(_("Redraw index"));
1569 int AWindowRedrawIndex::handle_event()
1574 AWindowPaste::AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1575 : BC_Button(x, y, mwindow->theme->pasteasset_data)
1577 this->mwindow = mwindow;
1579 set_tooltip(_("Paste asset on recordable tracks"));
1582 int AWindowPaste::handle_event()
1587 AWindowAppend::AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1588 : BC_Button(x, y, mwindow->theme->appendasset_data)
1590 this->mwindow = mwindow;
1592 set_tooltip(_("Append asset in new tracks"));
1595 int AWindowAppend::handle_event()
1600 AWindowView::AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1601 : BC_Button(x, y, mwindow->theme->viewasset_data)
1603 this->mwindow = mwindow;
1605 set_tooltip(_("View asset"));
1608 int AWindowView::handle_event()
1615 LabelPopup::LabelPopup(MWindow *mwindow, AWindowGUI *gui)
1622 this->mwindow = mwindow;
1626 LabelPopup::~LabelPopup()
1630 void LabelPopup::create_objects()
1632 add_item(editlabel = new LabelPopupEdit(mwindow, this));
1638 LabelPopupEdit::LabelPopupEdit(MWindow *mwindow, LabelPopup *popup)
1639 : BC_MenuItem(_("Edit..."))
1641 this->mwindow = mwindow;
1642 this->popup = popup;
1645 LabelPopupEdit::~LabelPopupEdit()
1649 int LabelPopupEdit::handle_event()
1654 AssetPicon *result = (AssetPicon*)mwindow->awindow->gui->asset_list->get_selection(0, i++);
1658 mwindow->awindow->gui->awindow->label_edit->edit_label(result->label);
1668 // c-file-style: "linux"