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 reposition_objects();
493 int x = mwindow->theme->abuttons_x;
494 int y = mwindow->theme->abuttons_y;
496 // new_bin->reposition_window(x, y);
497 // x += new_bin->get_w();
498 // delete_bin->reposition_window(x, y);
499 // x += delete_bin->get_w();
500 // rename_bin->reposition_window(x, y);
501 // x += rename_bin->get_w();
502 // delete_disk->reposition_window(x, y);
503 // x += delete_disk->get_w();
504 // delete_project->reposition_window(x, y);
505 // x += delete_project->get_w();
506 // info->reposition_window(x, y);
507 // x += info->get_w();
508 // redraw_index->reposition_window(x, y);
509 // x += redraw_index->get_w();
510 // paste->reposition_window(x, y);
511 // x += paste->get_w();
512 // append->reposition_window(x, y);
513 // x += append->get_w();
514 // view->reposition_window(x, y);
516 BC_WindowBase::resize_event(w, h);
520 int AWindowGUI::translation_event()
522 mwindow->session->awindow_x = get_x();
523 mwindow->session->awindow_y = get_y();
527 void AWindowGUI::reposition_objects()
529 int wmax = mwindow->session->awindow_w-mwindow->theme->adivider_w;
530 int x = mwindow->theme->afolders_x;
531 int w = mwindow->theme->afolders_w;
536 folder_list->reposition_window(x, mwindow->theme->afolders_y,
537 w, mwindow->theme->afolders_h);
538 x = mwindow->theme->adivider_x;
543 divider->reposition_window(x,
544 mwindow->theme->adivider_y,
545 mwindow->theme->adivider_w,
546 mwindow->theme->adivider_h);
547 int x2 = mwindow->theme->alist_x;
548 if (x2 < x+mwindow->theme->adivider_w)
549 x2 = x+mwindow->theme->adivider_w;
550 w = mwindow->theme->alist_w;
555 asset_list->reposition_window(x2, mwindow->theme->alist_y,
556 w, mwindow->theme->alist_h);
560 int AWindowGUI::close_event()
563 mwindow->session->show_awindow = 0;
566 mwindow->gui->lock_window("AWindowGUI::close_event");
567 mwindow->gui->mainmenu->show_awindow->set_checked(0);
568 mwindow->gui->unlock_window();
570 lock_window("AWindowGUI::close_event");
571 mwindow->save_defaults();
576 int AWindowGUI::keypress_event()
578 switch(get_keypress())
594 int AWindowGUI::create_custom_xatoms()
596 UpdateAssetsXAtom = create_xatom("CWINDOWGUI_UPDATE_ASSETS");
599 int AWindowGUI::recieve_custom_xatoms(xatom_event *event)
601 if (event->message_type == UpdateAssetsXAtom)
609 void AWindowGUI::async_update_assets()
612 event.message_type = UpdateAssetsXAtom;
613 send_custom_xatom(&event);
622 void AWindowGUI::update_folder_list()
624 //printf("AWindowGUI::update_folder_list 1\n");
625 for(int i = 0; i < folders.total; i++)
627 AssetPicon *picon = (AssetPicon*)folders.values[i];
630 //printf("AWindowGUI::update_folder_list 1\n");
632 // Search assets for folders
633 for(int i = 0; i < mwindow->edl->folders.total; i++)
635 char *folder = mwindow->edl->folders.values[i];
637 //printf("AWindowGUI::update_folder_list 1.1\n");
639 for(int j = 0; j < folders.total; j++)
641 AssetPicon *picon = (AssetPicon*)folders.values[j];
642 if(!strcasecmp(picon->get_text(), folder))
652 AssetPicon *picon = new AssetPicon(mwindow, this, folder);
653 picon->create_objects();
654 folders.append(picon);
656 //printf("AWindowGUI::update_folder_list 1.3\n");
658 //printf("AWindowGUI::update_folder_list 1\n");
659 //for(int i = 0; i < folders.total; i++)
660 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
663 for(int i = folders.total - 1; i >= 0; i--)
665 AssetPicon *picon = (AssetPicon*)folders.values[i];
666 if(!picon->in_use && !picon->persistent)
669 folders.remove_number(i);
672 //for(int i = 0; i < folders.total; i++)
673 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
674 //printf("AWindowGUI::update_folder_list 2\n");
677 void AWindowGUI::create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
683 ArrayList<PluginServer*> plugindb;
685 // Get pointers to plugindb entries
686 mwindow->create_plugindb(do_audio,
693 for(int i = 0; i < plugindb.total; i++)
695 PluginServer *server = plugindb.values[i];
698 // Create new listitem
701 AssetPicon *picon = new AssetPicon(mwindow, this, server);
702 picon->create_objects();
703 output->append(picon);
708 void AWindowGUI::create_label_folder()
711 for(current = mwindow->edl->labels->first; current; current = NEXT) {
712 AssetPicon *picon = new AssetPicon(mwindow, this, current);
713 picon->create_objects();
714 labellist.append(picon);
719 void AWindowGUI::update_asset_list()
721 //printf("AWindowGUI::update_asset_list 1\n");
722 for(int i = 0; i < assets.total; i++)
724 AssetPicon *picon = (AssetPicon*)assets.values[i];
732 //printf("AWindowGUI::update_asset_list 2\n");
735 // Synchronize EDL clips
736 for(int i = 0; i < mwindow->edl->clips.total; i++)
740 // Look for clip in existing listitems
741 for(int j = 0; j < assets.total && !exists; j++)
743 AssetPicon *picon = (AssetPicon*)assets.values[j];
745 if(picon->id == mwindow->edl->clips.values[i]->id)
747 picon->edl = mwindow->edl->clips.values[i];
748 picon->set_text(mwindow->edl->clips.values[i]->local_session->clip_title);
754 // Create new listitem
757 AssetPicon *picon = new AssetPicon(mwindow,
759 mwindow->edl->clips.values[i]);
760 picon->create_objects();
761 assets.append(picon);
771 //printf("AWindowGUI::update_asset_list 3 %d\n", assets.total);
772 // Synchronize EDL assets
773 for(Asset *current = mwindow->edl->assets->first;
779 //printf("AWindowGUI::update_asset_list 3 %s\n", current->path);
780 // Look for asset in existing listitems
781 for(int j = 0; j < assets.total && !exists; j++)
783 AssetPicon *picon = (AssetPicon*)assets.values[j];
785 if(picon->id == current->id)
787 //printf("AWindowGUI::update_asset_list 4 %p %d %d\n", picon->asset, picon->get_icon_x(), picon->get_icon_y());
788 picon->asset = current;
795 //printf("AWindowGUI::update_asset_list 5\n");
796 // Create new listitem
799 //printf("AWindowGUI::update_asset_list 4.1 %s\n", current->path);
800 AssetPicon *picon = new AssetPicon(mwindow, this, current);
801 //printf("AWindowGUI::update_asset_list 4.2 %s\n", current->path);
802 picon->create_objects();
803 //printf("AWindowGUI::update_asset_list 4.3 %s\n", current->path);
804 assets.append(picon);
805 //printf("AWindowGUI::update_asset_list 4.4 %s\n", current->path);
817 //printf("AWindowGUI::update_asset_list 6\n");
818 for(int i = assets.total - 1; i >= 0; i--)
820 AssetPicon *picon = (AssetPicon*)assets.values[i];
821 //printf("AWindowGUI::update_asset_list %s %d\n", picon->asset->path, picon->in_use);
825 assets.remove_number(i);
828 //printf("AWindowGUI::update_asset_list 7 %d\n", assets.total);
835 void AWindowGUI::sort_assets()
837 //printf("AWindowGUI::sort_assets 1 %s\n", mwindow->edl->session->current_folder);
838 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
839 sort_picons(&aeffects,
842 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
843 sort_picons(&veffects,
846 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
847 sort_picons(&atransitions,
850 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
851 sort_picons(&vtransitions,
854 if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
855 ;// Labels should ALWAYS be sorted by time.
858 mwindow->edl->session->current_folder);
873 void AWindowGUI::collect_assets()
876 mwindow->session->drag_assets->remove_all();
877 mwindow->session->drag_clips->remove_all();
880 AssetPicon *result = (AssetPicon*)asset_list->get_selection(0, i++);
883 if(result->asset) mwindow->session->drag_assets->append(result->asset);
884 if(result->edl) mwindow->session->drag_clips->append(result->edl);
888 void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst,
889 ArrayList<BC_ListBoxItem*> *src,
892 // Remove current pointers
894 dst[1].remove_all_objects();
896 // Create new pointers
897 //if(folder) printf("AWindowGUI::copy_picons 1 %s\n", folder);
898 for(int i = 0; i < src->total; i++)
900 AssetPicon *picon = (AssetPicon*)src->values[i];
901 //printf("AWindowGUI::copy_picons 2 %s\n", picon->asset->folder);
903 (folder && picon->asset && !strcasecmp(picon->asset->folder, folder)) ||
904 (folder && picon->edl && !strcasecmp(picon->edl->local_session->folder, folder)))
906 BC_ListBoxItem *item2, *item1;
907 dst[0].append(item1 = picon);
909 dst[1].append(item2 = new BC_ListBoxItem(picon->edl->local_session->clip_notes));
911 if(picon->label && picon->label->textstr)
912 dst[1].append(item2 = new BC_ListBoxItem(picon->label->textstr));
914 dst[1].append(item2 = new BC_ListBoxItem(""));
915 item1->set_autoplace_text(1);
916 item2->set_autoplace_text(1);
917 //printf("AWindowGUI::copy_picons 3 %s\n", picon->get_text());
922 void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src,
925 //printf("AWindowGUI::sort_picons 1\n")
930 for(int i = 0; i < src->total - 1; i++)
932 BC_ListBoxItem *item1 = src->values[i];
933 BC_ListBoxItem *item2 = src->values[i + 1];
934 item1->set_autoplace_icon(1);
935 item2->set_autoplace_icon(1);
936 item1->set_autoplace_text(1);
937 item2->set_autoplace_text(1);
938 if(strcmp(item1->get_text(), item2->get_text()) > 0)
940 src->values[i + 1] = item1;
941 src->values[i] = item2;
949 void AWindowGUI::filter_displayed_assets()
951 allow_iconlisting = 1;
952 asset_titles[0] = _("Title");
953 asset_titles[1] = _("Comments");
954 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
955 copy_picons(displayed_assets,
959 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
960 copy_picons(displayed_assets,
964 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
965 copy_picons(displayed_assets,
969 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
970 copy_picons(displayed_assets,
974 if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER)) {
975 copy_picons(displayed_assets,
978 asset_titles[0] = _("Time Stamps");
979 asset_titles[1] = _("Title");
980 allow_iconlisting = 0;
983 copy_picons(displayed_assets,
985 mwindow->edl->session->current_folder);
986 // Ensure the current folder icon is highlighted
987 for(int i = 0; i < folders.total; i++)
989 if(!strcasecmp(mwindow->edl->session->current_folder, folders.values[i]->get_text()))
990 folders.values[i]->set_selected(1);
992 folders.values[i]->set_selected(0);
997 void AWindowGUI::update_assets()
999 //printf("AWindowGUI::update_assets 1\n");
1000 update_folder_list();
1001 //printf("AWindowGUI::update_assets 2\n");
1002 update_asset_list();
1003 labellist.remove_all_objects();
1004 create_label_folder();
1005 //printf("AWindowGUI::update_assets 3\n");
1006 filter_displayed_assets();
1008 //for(int i = 0; i < folders.total; i++)
1009 //printf("AWindowGUI::update_assets 4\n");
1010 // printf("AWindowGUI::update_assets %s\n", folders.values[i]->get_text());
1011 if(mwindow->edl->session->folderlist_format != folder_list->get_format())
1012 folder_list->update_format(mwindow->edl->session->folderlist_format, 0);
1013 folder_list->update(&folders,
1017 folder_list->get_xposition(),
1018 folder_list->get_yposition(),
1020 //printf("AWindowGUI::update_assets 5\n");
1022 if(mwindow->edl->session->assetlist_format != asset_list->get_format())
1023 asset_list->update_format(mwindow->edl->session->assetlist_format, 0);
1026 //printf("AWindowGUI::update_assets 6 %d\n", displayed_assets[0].total);
1027 asset_list->update(displayed_assets,
1029 mwindow->edl->session->asset_columns,
1031 asset_list->get_xposition(),
1032 asset_list->get_yposition(),
1035 //printf("AWindowGUI::update_assets 7\n");
1038 //printf("AWindowGUI::update_assets 8\n");
1042 int AWindowGUI::current_folder_number()
1045 for(int i = 0; i < folders.total; i++)
1047 if(!strcasecmp(folders.values[i]->get_text(), mwindow->edl->session->current_folder))
1056 int AWindowGUI::drag_motion()
1058 if(get_hidden()) return 0;
1064 int AWindowGUI::drag_stop()
1066 if(get_hidden()) return 0;
1071 Asset* AWindowGUI::selected_asset()
1073 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1074 if(picon) return picon->asset;
1077 PluginServer* AWindowGUI::selected_plugin()
1079 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1080 if(picon) return picon->plugin;
1083 AssetPicon* AWindowGUI::selected_folder()
1085 AssetPicon *picon = (AssetPicon*)folder_list->get_selection(0, 0);
1098 AWindowDivider::AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1099 : BC_SubWindow(x, y, w, h)
1101 this->mwindow = mwindow;
1104 AWindowDivider::~AWindowDivider()
1108 int AWindowDivider::button_press_event()
1110 if(is_event_win() && cursor_inside())
1112 mwindow->session->current_operation = DRAG_PARTITION;
1118 int AWindowDivider::cursor_motion_event()
1120 if(mwindow->session->current_operation == DRAG_PARTITION)
1122 mwindow->session->afolders_w = gui->get_relative_cursor_x();
1123 mwindow->theme->get_awindow_sizes(gui);
1124 gui->reposition_objects();
1129 int AWindowDivider::button_release_event()
1131 if(mwindow->session->current_operation == DRAG_PARTITION)
1133 mwindow->session->current_operation = NO_OPERATION;
1144 AWindowFolders::AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1149 mwindow->edl->session->folderlist_format == FOLDERS_ICONS ?
1150 LISTBOX_ICONS : LISTBOX_TEXT,
1151 &gui->folders, // Each column has an ArrayList of BC_ListBoxItems.
1152 0, // Titles for columns. Set to 0 for no titles
1153 0, // width of each column
1154 1, // Total columns.
1155 0, // Pixel of top of window.
1156 0, // If this listbox is a popup window
1157 LISTBOX_SINGLE, // Select one item or multiple items
1158 ICON_TOP, // Position of icon relative to text of each item
1161 this->mwindow = mwindow;
1166 AWindowFolders::~AWindowFolders()
1170 int AWindowFolders::selection_changed()
1172 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1175 strcpy(mwindow->edl->session->current_folder, picon->get_text());
1176 //printf("AWindowFolders::selection_changed 1\n");
1177 gui->asset_list->draw_background();
1178 gui->async_update_assets();
1183 int AWindowFolders::button_press_event()
1187 result = BC_ListBox::button_press_event();
1191 if(get_buttonpress() == 3 && is_event_win() && cursor_inside())
1193 gui->folderlist_menu->update_titles();
1194 gui->folderlist_menu->activate_menu();
1209 AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1214 (mwindow->edl->session->assetlist_format == ASSETS_ICONS && gui->allow_iconlisting ) ?
1215 LISTBOX_ICONS : LISTBOX_TEXT,
1216 &gui->assets, // Each column has an ArrayList of BC_ListBoxItems.
1217 gui->asset_titles, // Titles for columns. Set to 0 for no titles
1218 mwindow->edl->session->asset_columns, // width of each column
1219 1, // Total columns.
1220 0, // Pixel of top of window.
1221 0, // If this listbox is a popup window
1222 LISTBOX_MULTIPLE, // Select one item or multiple items
1223 ICON_TOP, // Position of icon relative to text of each item
1226 this->mwindow = mwindow;
1231 AWindowAssets::~AWindowAssets()
1235 int AWindowAssets::button_press_event()
1239 result = BC_ListBox::button_press_event();
1241 if(!result && get_buttonpress() == 3 && is_event_win() && cursor_inside())
1243 BC_ListBox::deactivate_selection();
1244 gui->assetlist_menu->update_titles();
1245 gui->assetlist_menu->activate_menu();
1254 int AWindowAssets::handle_event()
1256 //printf("AWindowAssets::handle_event 1 %d %d\n", get_buttonpress(), get_selection(0, 0));
1257 if(get_selection(0, 0))
1259 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1263 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1267 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1271 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1276 //printf("AWindowAssets::handle_event 2 %d %d\n", get_buttonpress(), get_selection(0, 0));
1277 mwindow->vwindow->gui->lock_window("AWindowAssets::handle_event");
1279 if(((AssetPicon*)get_selection(0, 0))->asset)
1280 mwindow->vwindow->change_source(((AssetPicon*)get_selection(0, 0))->asset);
1282 if(((AssetPicon*)get_selection(0, 0))->edl)
1283 mwindow->vwindow->change_source(((AssetPicon*)get_selection(0, 0))->edl);
1285 mwindow->vwindow->gui->unlock_window();
1293 int AWindowAssets::selection_changed()
1295 // Show popup window
1296 if(get_button_down() && get_buttonpress() == 3 && get_selection(0, 0))
1298 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER) ||
1299 !strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER) ||
1300 !strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER) ||
1301 !strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1303 gui->assetlist_menu->update_titles();
1304 gui->assetlist_menu->activate_menu();
1307 if (!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
1309 if(((AssetPicon*)get_selection(0, 0))->label)
1310 gui->label_menu->activate_menu();
1314 if(((AssetPicon*)get_selection(0, 0))->asset)
1315 gui->asset_menu->update();
1317 if(((AssetPicon*)get_selection(0, 0))->edl)
1318 gui->asset_menu->update();
1322 gui->asset_menu->activate_menu();
1325 BC_ListBox::deactivate_selection();
1331 void AWindowAssets::draw_background()
1333 BC_ListBox::draw_background();
1334 set_color(BC_WindowBase::get_resources()->audiovideo_color);
1335 set_font(LARGEFONT);
1337 get_text_width(LARGEFONT, mwindow->edl->session->current_folder) - 4,
1339 mwindow->edl->session->current_folder,
1344 int AWindowAssets::drag_start_event()
1346 int collect_pluginservers = 0;
1347 int collect_assets = 0;
1349 if(BC_ListBox::drag_start_event())
1351 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1353 mwindow->session->current_operation = DRAG_AEFFECT;
1354 collect_pluginservers = 1;
1357 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1359 mwindow->session->current_operation = DRAG_VEFFECT;
1360 collect_pluginservers = 1;
1363 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1365 mwindow->session->current_operation = DRAG_ATRANSITION;
1366 collect_pluginservers = 1;
1369 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1371 mwindow->session->current_operation = DRAG_VTRANSITION;
1372 collect_pluginservers = 1;
1375 if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
1381 mwindow->session->current_operation = DRAG_ASSET;
1386 if(collect_pluginservers)
1389 mwindow->session->drag_pluginservers->remove_all();
1392 AssetPicon *result = (AssetPicon*)get_selection(0, i++);
1395 mwindow->session->drag_pluginservers->append(result->plugin);
1401 gui->collect_assets();
1409 int AWindowAssets::drag_motion_event()
1411 BC_ListBox::drag_motion_event();
1413 mwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1414 mwindow->gui->drag_motion();
1415 mwindow->gui->unlock_window();
1417 mwindow->vwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1418 mwindow->vwindow->gui->drag_motion();
1419 mwindow->vwindow->gui->unlock_window();
1421 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1422 mwindow->cwindow->gui->drag_motion();
1423 mwindow->cwindow->gui->unlock_window();
1427 int AWindowAssets::drag_stop_event()
1431 result = gui->drag_stop();
1436 mwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1437 result = mwindow->gui->drag_stop();
1438 mwindow->gui->unlock_window();
1443 mwindow->vwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1444 result = mwindow->vwindow->gui->drag_stop();
1445 mwindow->vwindow->gui->unlock_window();
1450 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1451 result = mwindow->cwindow->gui->drag_stop();
1452 mwindow->cwindow->gui->unlock_window();
1457 if(result) get_drag_popup()->set_animation(0);
1459 BC_ListBox::drag_stop_event();
1460 mwindow->session->current_operation = ::NO_OPERATION; // since NO_OPERATION is also defined in listbox, we have to reach for global scope...
1464 int AWindowAssets::column_resize_event()
1466 mwindow->edl->session->asset_columns[0] = get_column_width(0);
1467 mwindow->edl->session->asset_columns[1] = get_column_width(1);
1482 AWindowNewFolder::AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1483 : BC_Button(x, y, mwindow->theme->newbin_data)
1485 this->mwindow = mwindow;
1487 set_tooltip(_("New bin"));
1490 int AWindowNewFolder::handle_event()
1492 gui->newfolder_thread->start_new_folder();
1496 AWindowDeleteFolder::AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1497 : BC_Button(x, y, mwindow->theme->deletebin_data)
1499 this->mwindow = mwindow;
1501 set_tooltip(_("Delete bin"));
1504 int AWindowDeleteFolder::handle_event()
1506 if(gui->folder_list->get_selection(0, 0))
1508 BC_ListBoxItem *folder = gui->folder_list->get_selection(0, 0);
1509 mwindow->delete_folder(folder->get_text());
1514 AWindowRenameFolder::AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1515 : BC_Button(x, y, mwindow->theme->renamebin_data)
1517 this->mwindow = mwindow;
1519 set_tooltip(_("Rename bin"));
1522 int AWindowRenameFolder::handle_event()
1527 AWindowDeleteDisk::AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1528 : BC_Button(x, y, mwindow->theme->deletedisk_data)
1530 this->mwindow = mwindow;
1532 set_tooltip(_("Delete asset from disk"));
1535 int AWindowDeleteDisk::handle_event()
1540 AWindowDeleteProject::AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1541 : BC_Button(x, y, mwindow->theme->deleteproject_data)
1543 this->mwindow = mwindow;
1545 set_tooltip(_("Delete asset from project"));
1548 int AWindowDeleteProject::handle_event()
1553 AWindowInfo::AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1554 : BC_Button(x, y, mwindow->theme->infoasset_data)
1556 this->mwindow = mwindow;
1558 set_tooltip(_("Edit information on asset"));
1561 int AWindowInfo::handle_event()
1563 gui->awindow->asset_edit->edit_asset(gui->selected_asset());
1567 AWindowRedrawIndex::AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1568 : BC_Button(x, y, mwindow->theme->redrawindex_data)
1570 this->mwindow = mwindow;
1572 set_tooltip(_("Redraw index"));
1575 int AWindowRedrawIndex::handle_event()
1580 AWindowPaste::AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1581 : BC_Button(x, y, mwindow->theme->pasteasset_data)
1583 this->mwindow = mwindow;
1585 set_tooltip(_("Paste asset on recordable tracks"));
1588 int AWindowPaste::handle_event()
1593 AWindowAppend::AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1594 : BC_Button(x, y, mwindow->theme->appendasset_data)
1596 this->mwindow = mwindow;
1598 set_tooltip(_("Append asset in new tracks"));
1601 int AWindowAppend::handle_event()
1606 AWindowView::AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1607 : BC_Button(x, y, mwindow->theme->viewasset_data)
1609 this->mwindow = mwindow;
1611 set_tooltip(_("View asset"));
1614 int AWindowView::handle_event()
1621 LabelPopup::LabelPopup(MWindow *mwindow, AWindowGUI *gui)
1628 this->mwindow = mwindow;
1632 LabelPopup::~LabelPopup()
1636 void LabelPopup::create_objects()
1638 add_item(editlabel = new LabelPopupEdit(mwindow, this));
1644 LabelPopupEdit::LabelPopupEdit(MWindow *mwindow, LabelPopup *popup)
1645 : BC_MenuItem(_("Edit..."))
1647 this->mwindow = mwindow;
1648 this->popup = popup;
1651 LabelPopupEdit::~LabelPopupEdit()
1655 int LabelPopupEdit::handle_event()
1660 AssetPicon *result = (AssetPicon*)mwindow->awindow->gui->asset_list->get_selection(0, i++);
1664 mwindow->awindow->gui->awindow->label_edit->edit_label(result->label);