4 * Copyright (C) 1997-2012 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "assetedit.h"
24 #include "assetpopup.h"
26 #include "awindowgui.h"
28 #include "bcsignals.h"
31 #include "bccmodels.h"
32 #include "clippopup.h"
34 #include "cwindowgui.h"
37 #include "edlsession.h"
38 #include "effectlist.h"
40 #include "filesystem.h"
41 #include "folderlistmenu.h"
42 #include "indexable.h"
46 #include "labelpopup.h"
47 #include "localsession.h"
49 #include "mainsession.h"
50 #include "mwindowgui.h"
52 #include "nestededls.h"
53 #include "newfolder.h"
54 #include "preferences.h"
58 #include "vwindowgui.h"
61 #include "data/lad_picon_png.h"
62 #include "data/ff_audio_png.h"
63 #include "data/ff_video_png.h"
70 const char *AWindowGUI::folder_names[] =
74 N_("Audio Transitions"),
75 N_("Video Transitions"),
83 AssetVIcon::AssetVIcon(AssetPicon *picon, int w, int h, double framerate, int64_t length)
84 : VIcon(w, h, framerate)
87 this->length = length;
91 AssetVIcon::~AssetVIcon()
96 VFrame *AssetVIcon::frame()
98 if( seq_no >= images.size() ) {
99 MWindow *mwindow = picon->mwindow;
100 Asset *asset = (Asset *)picon->indexable;
101 File *file = mwindow->video_cache->check_out(asset, mwindow->edl, 1);
102 if( !file ) return 0;
103 if( temp && (temp->get_w() != asset->width || temp->get_h() != asset->height) ) {
104 delete temp; temp = 0;
107 temp = new VFrame(asset->width, asset->height, BC_RGB888);
108 int ww = picon->gui->vicon_thread->view_w;
109 int hh = picon->gui->vicon_thread->view_h;
110 while( seq_no >= images.size() ) {
112 int64_t pos = images.size() / picon->gui->vicon_thread->refresh_rate * frame_rate;
113 file->set_video_position(pos,0);
114 file->read_frame(temp);
115 add_image(temp, ww, hh, BC_RGB8);
117 mwindow->video_cache->check_in(asset);
119 return *images[seq_no];
122 int64_t AssetVIcon::set_seq_no(int64_t no)
124 if( no >= length ) no = 0;
128 int AssetVIcon::get_vx()
130 BC_ListBox *lbox = picon->gui->asset_list;
131 return lbox->get_item_x(picon);
133 int AssetVIcon::get_vy()
135 BC_ListBox *lbox = picon->gui->asset_list;
136 return lbox->get_item_y(picon) + lbox->get_title_h();
139 AssetPicon::AssetPicon(MWindow *mwindow,
141 Indexable *indexable)
145 this->mwindow = mwindow;
147 this->indexable = indexable;
148 indexable->add_user();
149 this->id = indexable->id;
152 AssetPicon::AssetPicon(MWindow *mwindow,
158 this->mwindow = mwindow;
165 AssetPicon::AssetPicon(MWindow *mwindow,
166 AWindowGUI *gui, int folder)
167 : BC_ListBoxItem(_(AWindowGUI::folder_names[folder]), gui->folder_icon)
171 this->mwindow = mwindow;
175 AssetPicon::AssetPicon(MWindow *mwindow,
176 AWindowGUI *gui, const char *folder_name, int folder_num)
177 : BC_ListBoxItem(folder_name, gui->folder_icon)
180 foldernum = folder_num;
181 this->mwindow = mwindow;
185 AssetPicon::AssetPicon(MWindow *mwindow,
187 PluginServer *plugin)
191 this->mwindow = mwindow;
193 this->plugin = plugin;
197 AssetPicon::AssetPicon(MWindow *mwindow,
203 this->mwindow = mwindow;
211 AssetPicon::~AssetPicon()
214 gui->vicon_thread->del_vicon(vicon);
215 if( indexable ) indexable->remove_user();
216 if( edl ) edl->remove_user();
217 if( icon && !gui->protected_pixmap(icon) ) {
219 if( !plugin ) delete icon_vframe;
223 void AssetPicon::reset()
237 void AssetPicon::create_objects()
240 char name[BCTEXTLEN];
241 int pixmap_w, pixmap_h;
244 pixmap_h = 50 * BC_WindowBase::get_resources()->icon_scale;
246 if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__);
248 fs.extract_name(name, indexable->path);
252 if( indexable && indexable->is_asset ) {
253 if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__);
254 Asset *asset = (Asset*)indexable;
255 if( asset->video_data ) {
256 if( mwindow->preferences->use_thumbnails ) {
257 gui->unlock_window();
258 if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__);
259 File *file = mwindow->video_cache->check_out(asset,
262 if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__);
265 int height = asset->height > 0 ? asset->height : 1;
266 pixmap_w = pixmap_h * asset->width / height;
269 file->set_video_position(0, 0);
271 if( gui->temp_picon &&
272 (gui->temp_picon->get_w() != asset->width ||
273 gui->temp_picon->get_h() != asset->height) ) {
274 delete gui->temp_picon;
278 if( !gui->temp_picon ) {
279 gui->temp_picon = new VFrame(0, -1,
280 asset->width, asset->height,
283 { char string[BCTEXTLEN];
284 sprintf(string, _("Reading %s"), name);
285 mwindow->gui->lock_window("AssetPicon::create_objects");
286 mwindow->gui->show_message(string);
287 mwindow->gui->unlock_window(); }
288 file->read_frame(gui->temp_picon);
289 if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__);
290 mwindow->video_cache->check_in(asset);
292 gui->lock_window("AssetPicon::create_objects 1");
293 icon = new BC_Pixmap(gui, pixmap_w, pixmap_h);
294 icon->draw_vframe(gui->temp_picon,
295 0, 0, pixmap_w, pixmap_h, 0, 0);
296 //printf("%d %d\n", gui->temp_picon->get_w(), gui->temp_picon->get_h());
297 icon_vframe = new VFrame(0,
298 -1, pixmap_w, pixmap_h, BC_RGB888, -1);
299 icon_vframe->transfer_from(gui->temp_picon);
301 double framerate = asset->get_frame_rate();
302 if( !framerate ) framerate = VICON_RATE;
303 int64_t frames = asset->get_video_frames();
304 double secs = frames / framerate;
305 if( secs > 5 ) secs = 5;
306 int64_t length = secs * gui->vicon_thread->refresh_rate;
307 vicon = new AssetVIcon(this, pixmap_w, pixmap_h, framerate, length);
308 gui->vicon_thread->add_vicon(vicon);
309 if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__);
313 gui->lock_window("AssetPicon::create_objects 2");
314 icon = gui->video_icon;
315 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
319 icon = gui->video_icon;
320 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
324 if( asset->audio_data ) {
325 icon = gui->audio_icon;
326 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND];
328 //printf("AssetPicon::create_objects 2\n");
330 if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__);
333 if( indexable && !indexable->is_asset ) {
334 icon = gui->video_icon;
335 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
339 //printf("AssetPicon::create_objects 4 %s\n", edl->local_session->clip_title);
340 set_text(strcpy(name, edl->local_session->clip_title));
341 icon = gui->clip_icon;
342 icon_vframe = mwindow->theme->get_image("clip_icon");
346 strcpy(name, plugin->title);
348 icon_vframe = plugin->get_picon();
350 icon = gui->create_pixmap(icon_vframe);
351 else if( plugin->audio ) {
352 if( plugin->transition ) {
353 icon = gui->atransition_icon;
354 icon_vframe = gui->atransition_vframe;
356 else if( plugin->is_ffmpeg() ) {
357 icon = gui->ff_aud_icon;
358 icon_vframe = gui->ff_aud_vframe;
360 else if( plugin->is_ladspa() ) {
361 icon = gui->ladspa_icon;
362 icon_vframe = gui->ladspa_vframe;
365 icon = gui->aeffect_icon;
366 icon_vframe = gui->aeffect_vframe;
369 else if( plugin->video ) {
370 if( plugin->transition ) {
371 icon = gui->vtransition_icon;
372 icon_vframe = gui->vtransition_vframe;
374 else if( plugin->is_ffmpeg() ) {
375 icon = gui->ff_vid_icon;
376 icon_vframe = gui->ff_vid_vframe;
379 icon = gui->veffect_icon;
380 icon_vframe = gui->veffect_vframe;
388 mwindow->edl->session->time_format,
389 mwindow->edl->session->sample_rate,
390 mwindow->edl->session->frame_rate,
391 mwindow->edl->session->frames_per_foot);
393 icon = gui->label_icon;
394 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_LABEL];
396 set_icon_vframe(icon_vframe);
399 icon = gui->file_icon;
400 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN];
403 set_icon_vframe(icon_vframe);
405 if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__);
413 AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow)
414 : BC_Window(_(PROGRAM_NAME ": Resources"),
415 mwindow->session->awindow_x, mwindow->session->awindow_y,
416 mwindow->session->awindow_w, mwindow->session->awindow_h,
419 // printf("AWindowGUI::AWindowGUI %d %d %d %d\n",
420 // mwindow->session->awindow_x,
421 // mwindow->session->awindow_y,
422 // mwindow->session->awindow_w,
423 // mwindow->session->awindow_h);
424 this->mwindow = mwindow;
425 this->awindow = awindow;
432 atransition_icon = 0; atransition_vframe = 0;
433 vtransition_icon = 0; vtransition_vframe = 0;
434 aeffect_icon = 0; aeffect_vframe = 0;
435 ladspa_icon = 0; ladspa_vframe = 0;
436 veffect_icon = 0; veffect_vframe = 0;
437 ff_aud_icon = 0; ff_aud_vframe = 0;
438 ff_vid_icon = 0; ff_vid_vframe = 0;
439 plugin_visibility = ((uint64_t)1<<(8*sizeof(uint64_t)-1))-1;
440 newfolder_thread = 0;
448 allow_iconlisting = 1;
452 displayed_folder = AW_NO_FOLDER;
455 AWindowGUI::~AWindowGUI()
457 assets.remove_all_objects();
458 folders.remove_all_objects();
459 aeffects.remove_all_objects();
460 veffects.remove_all_objects();
461 atransitions.remove_all_objects();
462 vtransitions.remove_all_objects();
463 labellist.remove_all_objects();
464 displayed_assets[1].remove_all_objects();
473 delete atransition_icon;
474 delete vtransition_icon;
477 delete ladspa_vframe;
479 delete ff_aud_vframe;
481 delete ff_vid_vframe;
483 delete newfolder_thread;
487 delete effectlist_menu;
488 delete assetlist_menu;
489 delete cliplist_menu;
490 delete labellist_menu;
491 delete folderlist_menu;
492 if( temp_picon ) delete temp_picon;
493 delete remove_plugin;
496 bool AWindowGUI::protected_pixmap(BC_Pixmap *icon)
498 return icon == file_icon ||
499 icon == folder_icon ||
500 icon == audio_icon ||
501 icon == video_icon ||
503 icon == label_icon ||
504 icon == vtransition_icon ||
505 icon == atransition_icon ||
506 icon == veffect_icon ||
507 icon == aeffect_icon ||
508 icon == ladspa_icon ||
509 icon == ff_aud_icon ||
513 void AWindowGUI::create_objects()
517 lock_window("AWindowGUI::create_objects");
519 //printf("AWindowGUI::create_objects 1\n");
520 asset_titles[0] = _("Title");
521 asset_titles[1] = _("Comments");
525 set_icon(mwindow->theme->get_image("awindow_icon"));
526 file_icon = new BC_Pixmap(this,
527 BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN],
530 folder_icon = new BC_Pixmap(this,
531 BC_WindowBase::get_resources()->type_to_icon[ICON_FOLDER],
534 audio_icon = new BC_Pixmap(this,
535 BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND],
538 video_icon = new BC_Pixmap(this,
539 BC_WindowBase::get_resources()->type_to_icon[ICON_FILM],
542 label_icon = new BC_Pixmap(this,
543 BC_WindowBase::get_resources()->type_to_icon[ICON_LABEL],
548 clip_vframe = mwindow->theme->get_image("clip_icon");
549 clip_icon = new BC_Pixmap(this, clip_vframe, PIXMAP_ALPHA);
550 atransition_vframe = mwindow->theme->get_image("atransition_icon");
551 atransition_icon = new BC_Pixmap(this, atransition_vframe, PIXMAP_ALPHA);
552 vtransition_vframe = mwindow->theme->get_image("vtransition_icon");
553 vtransition_icon = new BC_Pixmap(this, vtransition_vframe, PIXMAP_ALPHA);
554 aeffect_vframe = mwindow->theme->get_image("aeffect_icon");
555 aeffect_icon = new BC_Pixmap(this, aeffect_vframe, PIXMAP_ALPHA);
556 ladspa_vframe = new VFramePng(lad_picon_png);
557 ladspa_icon = new BC_Pixmap(this, ladspa_vframe, PIXMAP_ALPHA);
558 ff_aud_vframe = new VFramePng(ff_audio_png);
559 ff_aud_icon = new BC_Pixmap(this, ff_aud_vframe, PIXMAP_ALPHA);
560 ff_vid_vframe = new VFramePng(ff_video_png);
561 ff_vid_icon = new BC_Pixmap(this, ff_vid_vframe, PIXMAP_ALPHA);
562 veffect_vframe = mwindow->theme->get_image("veffect_icon");
563 veffect_icon = new BC_Pixmap(this, veffect_vframe, PIXMAP_ALPHA);
568 folders.append(picon = new AssetPicon(mwindow, this, AW_AEFFECT_FOLDER));
569 picon->persistent = 1;
570 folders.append(picon = new AssetPicon(mwindow, this, AW_VEFFECT_FOLDER));
571 picon->persistent = 1;
572 folders.append(picon = new AssetPicon(mwindow, this, AW_ATRANSITION_FOLDER));
573 picon->persistent = 1;
574 folders.append(picon = new AssetPicon(mwindow, this, AW_VTRANSITION_FOLDER));
575 picon->persistent = 1;
576 folders.append(picon = new AssetPicon(mwindow, this, AW_LABEL_FOLDER));
577 picon->persistent = 1;
578 folders.append(picon = new AssetPicon(mwindow, this, AW_CLIP_FOLDER));
579 picon->persistent = 1;
580 folders.append(picon = new AssetPicon(mwindow, this, AW_MEDIA_FOLDER));
581 picon->persistent = 1;
583 create_label_folder();
586 mwindow->theme->get_awindow_sizes(this);
587 load_defaults(mwindow->defaults);
590 add_subwindow(asset_list = new AWindowAssets(mwindow,
592 mwindow->theme->alist_x,
593 mwindow->theme->alist_y,
594 mwindow->theme->alist_w,
595 mwindow->theme->alist_h));
597 vicon_thread = new VIconThread(asset_list);
598 vicon_thread->start();
601 add_subwindow(divider = new AWindowDivider(mwindow,
603 mwindow->theme->adivider_x,
604 mwindow->theme->adivider_y,
605 mwindow->theme->adivider_w,
606 mwindow->theme->adivider_h));
609 divider->set_cursor(HSEPARATE_CURSOR, 0, 0);
612 int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y;
613 int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h;
614 VFrame **images = mwindow->theme->get_image_set("playpatch_data");
615 AVIconDrawing::calculate_geometry(this, images, &avicon_w, &avicon_h);
616 add_subwindow(avicon_drawing = new AVIconDrawing(this, fw-avicon_w, fy, images));
617 add_subwindow(add_tools = new AddTools(mwindow, this, fx, fy, _("Visibility")));
618 add_tools->create_objects();
619 fy += add_tools->get_h(); fh -= add_tools->get_h();
621 add_subwindow(folder_list = new AWindowFolders(mwindow,
622 this, fx, fy, fw, fh));
627 //int x = mwindow->theme->abuttons_x;
628 //int y = mwindow->theme->abuttons_y;
632 newfolder_thread = new NewFolderThread(mwindow, this);
634 add_subwindow(asset_menu = new AssetPopup(mwindow, this));
635 asset_menu->create_objects();
636 add_subwindow(clip_menu = new ClipPopup(mwindow, this));
637 clip_menu->create_objects();
638 add_subwindow(label_menu = new LabelPopup(mwindow, this));
639 label_menu->create_objects();
641 add_subwindow(effectlist_menu = new EffectListMenu(mwindow, this));
642 effectlist_menu->create_objects();
643 add_subwindow(assetlist_menu = new AssetListMenu(mwindow, this));
644 assetlist_menu->create_objects();
645 add_subwindow(cliplist_menu = new ClipListMenu(mwindow, this));
646 cliplist_menu->create_objects();
647 add_subwindow(labellist_menu = new LabelListMenu(mwindow, this));
648 labellist_menu->create_objects();
651 add_subwindow(folderlist_menu = new FolderListMenu(mwindow, this));
652 folderlist_menu->create_objects();
654 //printf("AWindowGUI::create_objects 2\n");
656 create_custom_xatoms();
660 int AWindowGUI::resize_event(int w, int h)
662 mwindow->session->awindow_x = get_x();
663 mwindow->session->awindow_y = get_y();
664 mwindow->session->awindow_w = w;
665 mwindow->session->awindow_h = h;
667 mwindow->theme->get_awindow_sizes(this);
668 mwindow->theme->draw_awindow_bg(this);
669 reposition_objects();
671 // int x = mwindow->theme->abuttons_x;
672 // int y = mwindow->theme->abuttons_y;
673 // new_bin->reposition_window(x, y);
674 // x += new_bin->get_w();
675 // delete_bin->reposition_window(x, y);
676 // x += delete_bin->get_w();
677 // rename_bin->reposition_window(x, y);
678 // x += rename_bin->get_w();
679 // delete_disk->reposition_window(x, y);
680 // x += delete_disk->get_w();
681 // delete_project->reposition_window(x, y);
682 // x += delete_project->get_w();
683 // info->reposition_window(x, y);
684 // x += info->get_w();
685 // redraw_index->reposition_window(x, y);
686 // x += redraw_index->get_w();
687 // paste->reposition_window(x, y);
688 // x += paste->get_w();
689 // append->reposition_window(x, y);
690 // x += append->get_w();
691 // view->reposition_window(x, y);
693 BC_WindowBase::resize_event(w, h);
697 int AWindowGUI::translation_event()
699 mwindow->session->awindow_x = get_x();
700 mwindow->session->awindow_y = get_y();
704 void AWindowGUI::reposition_objects()
706 asset_list->reposition_window(
707 mwindow->theme->alist_x, mwindow->theme->alist_y,
708 mwindow->theme->alist_w, mwindow->theme->alist_h);
709 divider->reposition_window(
710 mwindow->theme->adivider_x, mwindow->theme->adivider_y,
711 mwindow->theme->adivider_w, mwindow->theme->adivider_h);
712 int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y;
713 int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h;
714 add_tools->resize_event(fw-avicon_w, add_tools->get_h());
715 avicon_drawing->reposition_window(fw-avicon_w, fy);
716 fy += add_tools->get_h(); fh -= add_tools->get_h();
717 folder_list->reposition_window(fx, fy, fw, fh);
720 int AWindowGUI::save_defaults(BC_Hash *defaults)
722 defaults->update("PLUGIN_VISIBILTY", plugin_visibility);
723 defaults->update("VICON_DRAWING", vicon_drawing);
727 int AWindowGUI::load_defaults(BC_Hash *defaults)
729 plugin_visibility = defaults->get("PLUGIN_VISIBILTY", plugin_visibility);
730 vicon_drawing = defaults->get("VICON_DRAWING", vicon_drawing);
734 int AWindowGUI::close_event()
737 mwindow->session->show_awindow = 0;
740 mwindow->gui->lock_window("AWindowGUI::close_event");
741 mwindow->gui->mainmenu->show_awindow->set_checked(0);
742 mwindow->gui->unlock_window();
744 lock_window("AWindowGUI::close_event");
745 save_defaults(mwindow->defaults);
746 mwindow->save_defaults();
750 void AWindowGUI::start_vicon_drawing()
752 if( !vicon_drawing ) return;
753 if( mwindow->edl->session->awindow_folder != AW_MEDIA_FOLDER ) return;
754 if( mwindow->edl->session->assetlist_format != ASSETS_ICONS ) return;
755 vicon_thread->start_drawing();
758 void AWindowGUI::stop_vicon_drawing()
760 vicon_thread->stop_drawing();
763 AWindowRemovePluginGUI::
764 AWindowRemovePluginGUI(AWindow *awindow, AWindowRemovePlugin *thread,
765 int x, int y, PluginServer *plugin)
766 : BC_Window(_(PROGRAM_NAME ": Remove plugin"), x,y, 500,200, 50, 50, 1, 0, 1, -1, "", 1)
768 this->awindow = awindow;
769 this->thread = thread;
770 this->plugin = plugin;
771 VFrame *vframe = plugin->get_picon();
772 icon = vframe ? create_pixmap(vframe) : 0;
773 plugin_list.append(new BC_ListBoxItem(plugin->title, icon));
776 AWindowRemovePluginGUI::
777 ~AWindowRemovePluginGUI()
779 if( !awindow->gui->protected_pixmap(icon) )
781 plugin_list.remove_all();
784 void AWindowRemovePluginGUI::create_objects()
786 BC_Button *ok_button = new BC_OKButton(this);
787 add_subwindow(ok_button);
788 BC_Button *cancel_button = new BC_CancelButton(this);
789 add_subwindow(cancel_button);
791 BC_Title *title = new BC_Title(x, y, _("remove plugin?"));
792 add_subwindow(title);
793 y += title->get_h() + 5;
794 list = new BC_ListBox(x, y,
795 get_w() - 20, ok_button->get_y() - y - 5, LISTBOX_TEXT, &plugin_list,
796 0, 0, 1, 0, 0, LISTBOX_SINGLE, ICON_LEFT, 0);
801 int AWindowRemovePlugin::remove_plugin(PluginServer *plugin, ArrayList<BC_ListBoxItem*> &folder)
804 for( int i=0; i<folder.size(); ) {
805 AssetPicon *picon = (AssetPicon *)folder[i];
806 if( picon->plugin == plugin ) {
807 folder.remove_object_number(i);
816 void AWindowRemovePlugin::handle_close_event(int result)
819 printf(_("remove %s\n"), plugin->path);
820 ArrayList<BC_ListBoxItem*> *folder =
821 plugin->audio ? plugin->transition ?
822 &awindow->gui->atransitions :
823 &awindow->gui->aeffects :
824 plugin->video ? plugin->transition ?
825 &awindow->gui->vtransitions :
826 &awindow->gui->veffects :
828 if( folder ) remove_plugin(plugin, *folder);
829 char plugin_path[BCTEXTLEN];
830 strcpy(plugin_path, plugin->path);
831 MWindow *mwindow = awindow->mwindow;
832 mwindow->plugindb->remove(plugin);
834 char index_path[BCTEXTLEN];
835 snprintf(index_path, sizeof(index_path), "%s/%s",
836 mwindow->preferences->plugin_dir, PLUGIN_FILE);
838 char png_path[BCTEXTLEN];
839 if( plugin->get_plugin_png_path(png_path, mwindow->preferences->plugin_icons) )
841 if( plugin->get_plugin_png_path(png_path, DEFAULT_PICON) )
843 delete plugin; plugin = 0;
844 awindow->gui->async_update_assets();
848 AWindowRemovePlugin::
849 AWindowRemovePlugin(AWindow *awindow, PluginServer *plugin)
852 this->awindow = awindow;
853 this->plugin = plugin;
856 AWindowRemovePlugin::
857 ~AWindowRemovePlugin()
862 BC_Window* AWindowRemovePlugin::new_gui()
864 int x = awindow->gui->get_abs_cursor_x(0);
865 int y = awindow->gui->get_abs_cursor_y(0);
866 AWindowRemovePluginGUI *gui = new AWindowRemovePluginGUI(awindow, this, x, y, plugin);
867 gui->create_objects();
871 int AWindowGUI::keypress_event()
873 switch( get_keypress() ) {
882 PluginServer* plugin = selected_plugin();
884 remove_plugin = new AWindowRemovePlugin(awindow, plugin);
886 remove_plugin->start();
895 int AWindowGUI::create_custom_xatoms()
897 UpdateAssetsXAtom = create_xatom("CWINDOWGUI_UPDATE_ASSETS");
900 int AWindowGUI::recieve_custom_xatoms(xatom_event *event)
902 if( event->message_type == UpdateAssetsXAtom ) {
909 void AWindowGUI::async_update_assets()
912 event.message_type = UpdateAssetsXAtom;
913 send_custom_xatom(&event);
922 void AWindowGUI::update_folder_list()
924 stop_vicon_drawing();
925 //printf("AWindowGUI::update_folder_list 1\n");
926 for( int i = 0; i < folders.total; i++ ) {
927 AssetPicon *picon = (AssetPicon*)folders.values[i];
930 //printf("AWindowGUI::update_folder_list 1\n");
932 // Search assets for folders
933 for( int i = 0; i < mwindow->edl->folders.total; i++ ) {
934 const char *folder = mwindow->edl->folders.values[i];
936 //printf("AWindowGUI::update_folder_list 1.1\n");
938 for( int j = 0; j < folders.total; j++ ) {
939 AssetPicon *picon = (AssetPicon*)folders.values[j];
940 if( !strcasecmp(picon->get_text(), folder) ) {
948 int aw_folder = folder_number(folder);
949 AssetPicon *picon = aw_folder >= 0 ?
950 new AssetPicon(mwindow, this, aw_folder) :
951 new AssetPicon(mwindow, this, folder, AW_USER_FOLDER);
952 picon->create_objects();
953 folders.append(picon);
955 //printf("AWindowGUI::update_folder_list 1.3\n");
957 //printf("AWindowGUI::update_folder_list 1\n");
958 //for( int i = 0; i < folders.total; i++ )
959 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
962 for( int i = folders.total - 1; i >= 0; i-- ) {
963 AssetPicon *picon = (AssetPicon*)folders.values[i];
964 if( !picon->in_use && !picon->persistent ) {
966 folders.remove_number(i);
969 //for( int i = 0; i < folders.total; i++ )
970 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
971 //printf("AWindowGUI::update_folder_list 2\n");
972 start_vicon_drawing();
975 void AWindowGUI::create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
976 int do_audio, int do_video, int is_realtime, int is_transition)
978 ArrayList<PluginServer*> plugin_list;
979 // Get pointers to plugindb entries
980 mwindow->search_plugindb(do_audio, do_video, is_realtime, is_transition,
983 for( int i = 0; i < plugin_list.total; i++ ) {
984 PluginServer *server = plugin_list.values[i];
985 int visible = plugin_visibility & (1<<server->dir_idx);
986 if( !visible ) continue;
987 // Create new listitem
988 AssetPicon *picon = new AssetPicon(mwindow, this, server);
989 picon->create_objects();
990 output->append(picon);
994 void AWindowGUI::create_label_folder()
997 for( current = mwindow->edl->labels->first; current; current = NEXT ) {
998 AssetPicon *picon = new AssetPicon(mwindow, this, current);
999 picon->create_objects();
1000 labellist.append(picon);
1005 void AWindowGUI::update_asset_list()
1007 //printf("AWindowGUI::update_asset_list 1\n");
1008 for( int i = 0; i < assets.total; i++ ) {
1009 AssetPicon *picon = (AssetPicon*)assets.values[i];
1017 //printf("AWindowGUI::update_asset_list 2\n");
1020 // Synchronize EDL clips
1021 for( int i = 0; i < mwindow->edl->clips.total; i++ ) {
1024 // Look for clip in existing listitems
1025 for( int j = 0; j < assets.total && !exists; j++ ) {
1026 AssetPicon *picon = (AssetPicon*)assets.values[j];
1028 if( picon->id == mwindow->edl->clips.values[i]->id ) {
1029 picon->edl = mwindow->edl->clips.values[i];
1030 picon->set_text(mwindow->edl->clips.values[i]->local_session->clip_title);
1036 // Create new listitem
1038 AssetPicon *picon = new AssetPicon(mwindow,
1040 mwindow->edl->clips.values[i]);
1041 picon->create_objects();
1042 assets.append(picon);
1050 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1053 // Synchronize EDL assets
1054 for( Asset *current = mwindow->edl->assets->first;
1059 // Look for asset in existing listitems
1060 for( int j = 0; j < assets.total && !exists; j++ ) {
1061 AssetPicon *picon = (AssetPicon*)assets.values[j];
1063 if( picon->id == current->id ) {
1064 picon->indexable = current;
1071 // Create new listitem
1073 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1074 AssetPicon *picon = new AssetPicon(mwindow, this, current);
1075 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1076 picon->create_objects();
1077 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1078 assets.append(picon);
1082 mwindow->gui->lock_window("AWindowGUI::update_asset_list");
1083 mwindow->gui->default_message();
1084 mwindow->gui->unlock_window();
1086 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1089 // Synchronize nested EDLs
1090 for( int i = 0; i < mwindow->edl->nested_edls->size(); i++ ) {
1092 Indexable *indexable = mwindow->edl->nested_edls->get(i);
1094 // Look for asset in existing listitems
1095 for( int j = 0; j < assets.total && !exists; j++ ) {
1096 AssetPicon *picon = (AssetPicon*)assets.values[j];
1098 if( picon->id == indexable->id ) {
1099 picon->indexable = indexable;
1106 // Create new listitem
1108 AssetPicon *picon = new AssetPicon(mwindow,
1111 picon->create_objects();
1112 assets.append(picon);
1124 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1125 for( int i = assets.size() - 1; i >= 0; i-- ) {
1126 AssetPicon *picon = (AssetPicon*)assets.get(i);
1127 //printf("AWindowGUI::update_asset_list %s %d\n", picon->asset->path, picon->in_use);
1128 if( !picon->in_use ) {
1130 assets.remove_number(i);
1133 //printf("AWindowGUI::update_asset_list 7 %d\n", assets.total);
1136 void AWindowGUI::update_picon(Indexable *indexable)
1138 //printf("AWindowGUI::update_asset_list 1\n");
1140 for( int i = 0; i < assets.total; i++ ) {
1141 AssetPicon *picon = (AssetPicon*)assets.values[i];
1142 if( picon->indexable == indexable ||
1143 picon->edl == (EDL *)indexable ) {
1144 char name[BCTEXTLEN];
1146 fs.extract_name(name, indexable->path);
1147 picon->set_text(name);
1148 vicon = picon->vicon;
1153 stop_vicon_drawing();
1154 vicon->clear_images();
1155 vicon->reset(indexable->get_frame_rate());
1156 start_vicon_drawing();
1160 void AWindowGUI::sort_assets()
1162 //printf("AWindowGUI::sort_assets 1 %s\n", mwindow->edl->session->current_folder);
1163 switch( mwindow->edl->session->awindow_folder ) {
1164 case AW_AEFFECT_FOLDER:
1165 sort_picons(&aeffects);
1167 case AW_VEFFECT_FOLDER:
1168 sort_picons(&veffects);
1170 case AW_ATRANSITION_FOLDER:
1171 sort_picons(&atransitions);
1173 case AW_VTRANSITION_FOLDER:
1174 sort_picons(&vtransitions);
1176 case AW_LABEL_FOLDER:
1177 sort_picons(&labellist);
1180 sort_picons(&assets);
1186 void AWindowGUI::collect_assets()
1189 mwindow->session->drag_assets->remove_all();
1190 mwindow->session->drag_clips->remove_all();
1193 AssetPicon *result = (AssetPicon*)asset_list->get_selection(0, i++);
1194 if( !result ) break;
1196 if( result->indexable ) mwindow->session->drag_assets->append(result->indexable);
1197 if( result->edl ) mwindow->session->drag_clips->append(result->edl);
1201 void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst,
1202 ArrayList<BC_ListBoxItem*> *src, int folder)
1204 // Remove current pointers
1205 dst[0].remove_all();
1206 dst[1].remove_all_objects();
1208 // Create new pointers
1209 //if( folder ) printf("AWindowGUI::copy_picons 1 %s\n", folder);
1210 for( int i = 0; i < src->total; i++ ) {
1211 AssetPicon *picon = (AssetPicon*)src->values[i];
1212 //printf("AWindowGUI::copy_picons 2 %s\n", picon->asset->folder);
1214 (picon->indexable && picon->indexable->awindow_folder == folder) ||
1215 (picon->edl && picon->edl->local_session->awindow_folder == folder) ) {
1216 BC_ListBoxItem *item2, *item1;
1217 dst[0].append(item1 = picon);
1219 dst[1].append(item2 = new BC_ListBoxItem(picon->edl->local_session->clip_notes));
1221 if( picon->label && picon->label->textstr )
1222 dst[1].append(item2 = new BC_ListBoxItem(picon->label->textstr));
1224 dst[1].append(item2 = new BC_ListBoxItem(""));
1225 item1->set_autoplace_text(1);
1226 item2->set_autoplace_text(1);
1227 //printf("AWindowGUI::copy_picons 3 %s\n", picon->get_text());
1232 void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src)
1234 //printf("AWindowGUI::sort_picons 1\n")
1239 for( int i = 0; i < src->total - 1; i++ ) {
1240 BC_ListBoxItem *item1 = src->values[i];
1241 BC_ListBoxItem *item2 = src->values[i + 1];
1242 item1->set_autoplace_icon(1);
1243 item2->set_autoplace_icon(1);
1244 item1->set_autoplace_text(1);
1245 item2->set_autoplace_text(1);
1246 if( strcmp(item1->get_text(), item2->get_text()) > 0 ) {
1247 src->values[i + 1] = item1;
1248 src->values[i] = item2;
1256 void AWindowGUI::filter_displayed_assets()
1258 //allow_iconlisting = 1;
1259 asset_titles[0] = _("Title");
1260 asset_titles[1] = _("Comments");
1262 switch( mwindow->edl->session->awindow_folder ) {
1263 case AW_AEFFECT_FOLDER:
1264 copy_picons(displayed_assets, &aeffects, AW_NO_FOLDER);
1266 case AW_VEFFECT_FOLDER:
1267 copy_picons(displayed_assets, &veffects, AW_NO_FOLDER);
1269 case AW_ATRANSITION_FOLDER:
1270 copy_picons(displayed_assets, &atransitions, AW_NO_FOLDER);
1272 case AW_VTRANSITION_FOLDER:
1273 copy_picons(displayed_assets, &vtransitions, AW_NO_FOLDER);
1275 case AW_LABEL_FOLDER:
1276 copy_picons(displayed_assets, &labellist, AW_NO_FOLDER);
1277 asset_titles[0] = _("Time Stamps");
1278 asset_titles[1] = _("Title");
1279 //allow_iconlisting = 0;
1282 copy_picons(displayed_assets, &assets, mwindow->edl->session->awindow_folder);
1286 // Ensure the current folder icon is highlighted
1287 for( int i = 0; i < folders.total; i++ )
1288 folders.values[i]->set_selected(0);
1290 folders.values[mwindow->edl->session->awindow_folder]->set_selected(1);
1294 void AWindowGUI::update_assets()
1296 //printf("AWindowGUI::update_assets 1\n");
1297 update_folder_list();
1298 //printf("AWindowGUI::update_assets 2\n");
1299 update_asset_list();
1300 labellist.remove_all_objects();
1301 create_label_folder();
1302 //printf("AWindowGUI::update_assets 3\n");
1303 filter_displayed_assets();
1305 //printf("AWindowGUI::update_assets 4\n");
1306 if( mwindow->edl->session->folderlist_format != folder_list->get_format() ) {
1307 folder_list->update_format(mwindow->edl->session->folderlist_format, 0);
1309 int folder_xposition = folder_list->get_xposition();
1310 int folder_yposition = folder_list->get_yposition();
1311 folder_list->update(&folders, 0, 0, 1, folder_xposition, folder_yposition, -1);
1313 //printf("AWindowGUI::update_assets 5\n");
1314 if( mwindow->edl->session->assetlist_format != asset_list->get_format() ) {
1315 asset_list->update_format(mwindow->edl->session->assetlist_format, 0);
1317 int asset_xposition = asset_list->get_xposition();
1318 int asset_yposition = asset_list->get_yposition();
1319 if( displayed_folder != mwindow->edl->session->awindow_folder ) {
1320 displayed_folder = mwindow->edl->session->awindow_folder;
1321 asset_xposition = asset_yposition = 0;
1323 asset_list->update(displayed_assets, asset_titles,
1324 mwindow->edl->session->asset_columns, ASSET_COLUMNS,
1325 asset_xposition, asset_yposition, -1, 0);
1326 asset_list->center_selection();
1327 //printf("AWindowGUI::update_assets 7\n");
1330 //printf("AWindowGUI::update_assets 8\n");
1334 void AWindowGUI::update_effects()
1336 aeffects.remove_all_objects();
1337 create_persistent_folder(&aeffects, 1, 0, 1, 0);
1338 veffects.remove_all_objects();
1339 create_persistent_folder(&veffects, 0, 1, 1, 0);
1340 atransitions.remove_all_objects();
1341 create_persistent_folder(&atransitions, 1, 0, 0, 1);
1342 vtransitions.remove_all_objects();
1343 create_persistent_folder(&vtransitions, 0, 1, 0, 1);
1346 int AWindowGUI::folder_number(const char *name)
1348 for( int i = 0; i < AWINDOW_FOLDERS; i++ ) {
1349 if( !strcasecmp(name, folder_names[i]) ) return i;
1351 return AW_NO_FOLDER;
1354 int AWindowGUI::drag_motion()
1356 if( get_hidden() ) return 0;
1362 int AWindowGUI::drag_stop()
1364 if( get_hidden() ) return 0;
1369 Indexable* AWindowGUI::selected_asset()
1371 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1372 return picon ? picon->indexable : 0;
1375 PluginServer* AWindowGUI::selected_plugin()
1377 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1378 return picon ? picon->plugin : 0;
1381 AssetPicon* AWindowGUI::selected_folder()
1383 AssetPicon *picon = (AssetPicon*)folder_list->get_selection(0, 0);
1394 AWindowDivider::AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1395 : BC_SubWindow(x, y, w, h)
1397 this->mwindow = mwindow;
1400 AWindowDivider::~AWindowDivider()
1404 int AWindowDivider::button_press_event()
1406 if( is_event_win() && cursor_inside() ) {
1407 mwindow->session->current_operation = DRAG_PARTITION;
1413 int AWindowDivider::cursor_motion_event()
1415 if( mwindow->session->current_operation == DRAG_PARTITION ) {
1417 int wmax = mwindow->session->awindow_w - mwindow->theme->adivider_w - wmin;
1418 int fw = gui->get_relative_cursor_x();
1419 if( fw > wmax ) fw = wmax;
1420 if( fw < wmin ) fw = wmin;
1421 mwindow->session->afolders_w = fw;
1422 mwindow->theme->get_awindow_sizes(gui);
1423 gui->reposition_objects();
1429 int AWindowDivider::button_release_event()
1431 if( mwindow->session->current_operation == DRAG_PARTITION ) {
1432 mwindow->session->current_operation = NO_OPERATION;
1443 AWindowFolders::AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1444 : BC_ListBox(x, y, w, h,
1445 mwindow->edl->session->folderlist_format == ASSETS_ICONS ?
1446 LISTBOX_ICONS : LISTBOX_TEXT,
1447 &gui->folders, // Each column has an ArrayList of BC_ListBoxItems.
1448 0, // Titles for columns. Set to 0 for no titles
1449 0, // width of each column
1450 1, // Total columns.
1451 0, // Pixel of top of window.
1452 0, // If this listbox is a popup window
1453 LISTBOX_SINGLE, // Select one item or multiple items
1454 ICON_TOP, // Position of icon relative to text of each item
1457 this->mwindow = mwindow;
1462 AWindowFolders::~AWindowFolders()
1466 int AWindowFolders::selection_changed()
1468 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1470 gui->stop_vicon_drawing();
1472 if( get_button_down() && get_buttonpress() == 3 ) {
1473 gui->folderlist_menu->update_titles();
1474 gui->folderlist_menu->activate_menu();
1477 mwindow->edl->session->awindow_folder = picon->foldernum;
1478 //printf("AWindowFolders::selection_changed 1\n");
1479 gui->asset_list->draw_background();
1480 gui->async_update_assets();
1482 gui->start_vicon_drawing();
1487 int AWindowFolders::button_press_event()
1491 result = BC_ListBox::button_press_event();
1494 if( get_buttonpress() == 3 && is_event_win() && cursor_inside() ) {
1495 gui->folderlist_menu->update_titles();
1496 gui->folderlist_menu->activate_menu();
1511 AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1512 : BC_ListBox(x, y, w, h,
1513 (mwindow->edl->session->assetlist_format == ASSETS_ICONS && gui->allow_iconlisting ) ?
1514 LISTBOX_ICONS : LISTBOX_TEXT,
1515 &gui->assets, // Each column has an ArrayList of BC_ListBoxItems.
1516 gui->asset_titles,// Titles for columns. Set to 0 for no titles
1517 mwindow->edl->session->asset_columns, // width of each column
1518 1, // Total columns.
1519 0, // Pixel of top of window.
1520 0, // If this listbox is a popup window
1521 LISTBOX_MULTIPLE, // Select one item or multiple items
1522 ICON_TOP, // Position of icon relative to text of each item
1525 this->mwindow = mwindow;
1528 set_scroll_stretch(1, 1);
1531 AWindowAssets::~AWindowAssets()
1535 int AWindowAssets::button_press_event()
1539 result = BC_ListBox::button_press_event();
1541 if( !result && get_buttonpress() == 3 && is_event_win() && cursor_inside() ) {
1542 BC_ListBox::deactivate_selection();
1543 int folder = mwindow->edl->session->awindow_folder;
1545 case AW_AEFFECT_FOLDER:
1546 case AW_VEFFECT_FOLDER:
1547 case AW_ATRANSITION_FOLDER:
1548 case AW_VTRANSITION_FOLDER:
1549 gui->effectlist_menu->update();
1550 gui->effectlist_menu->activate_menu();
1552 case AW_LABEL_FOLDER:
1553 gui->labellist_menu->update();
1554 gui->labellist_menu->activate_menu();
1556 case AW_CLIP_FOLDER:
1557 gui->cliplist_menu->update();
1558 gui->cliplist_menu->activate_menu();
1560 case AW_MEDIA_FOLDER:
1561 gui->assetlist_menu->update_titles();
1562 gui->assetlist_menu->activate_menu();
1572 int AWindowAssets::handle_event()
1574 //printf("AWindowAssets::handle_event 1 %d %d\n", get_buttonpress(), get_selection(0, 0));
1575 AssetPicon *asset_picon = (AssetPicon *)get_selection(0, 0);
1576 if( !asset_picon ) return 0;
1577 switch( mwindow->edl->session->awindow_folder ) {
1578 case AW_AEFFECT_FOLDER:
1579 case AW_VEFFECT_FOLDER:
1580 case AW_ATRANSITION_FOLDER:
1581 case AW_VTRANSITION_FOLDER: return 1;
1583 VWindow *vwindow = mwindow->vwindows.size() > DEFAULT_VWINDOW ?
1584 mwindow->vwindows.get(DEFAULT_VWINDOW) : 0;
1585 if( !vwindow || !vwindow->is_running() ) return 1;
1586 //printf("AWindowAssets::handle_event 2 %d %d\n", get_buttonpress(), get_selection(0, 0));
1588 vwindow->gui->lock_window("AWindowAssets::handle_event");
1589 if( asset_picon->indexable )
1590 vwindow->change_source(asset_picon->indexable);
1591 else if( asset_picon->edl )
1592 vwindow->change_source(asset_picon->edl);
1593 vwindow->gui->unlock_window();
1597 int AWindowAssets::selection_changed()
1599 // Show popup window
1601 if( get_button_down() && get_buttonpress() == 3 &&
1602 (item = (AssetPicon*)get_selection(0, 0)) ) {
1603 int folder = mwindow->edl->session->awindow_folder;
1605 case AW_AEFFECT_FOLDER:
1606 case AW_VEFFECT_FOLDER:
1607 case AW_ATRANSITION_FOLDER:
1608 case AW_VTRANSITION_FOLDER:
1609 gui->effectlist_menu->update();
1610 gui->effectlist_menu->activate_menu();
1612 case AW_LABEL_FOLDER:
1613 if( !item->label ) break;
1614 gui->label_menu->activate_menu();
1616 case AW_CLIP_FOLDER:
1617 if( !item->indexable && !item->edl ) break;
1618 gui->clip_menu->update();
1619 gui->clip_menu->activate_menu();
1622 if( !item->indexable && !item->edl ) break;
1623 gui->asset_menu->update();
1624 gui->asset_menu->activate_menu();
1628 BC_ListBox::deactivate_selection();
1631 else if( get_button_down() && get_buttonpress() == 1 &&
1632 (item = (AssetPicon*)get_selection(0, 0)) ) {
1634 if( !gui->vicon_thread->viewing ) {
1635 vicon = item->vicon;
1637 gui->vicon_thread->set_view_popup(vicon);
1643 void AWindowAssets::draw_background()
1645 clear_box(0,0,get_w(),get_h(),get_bg_surface());
1646 set_color(BC_WindowBase::get_resources()->audiovideo_color);
1647 set_font(LARGEFONT);
1648 int aw_folder = mwindow->edl->session->awindow_folder;
1649 if( aw_folder < 0 ) return;
1650 const char *aw_name = _(AWindowGUI::folder_names[aw_folder]);
1651 draw_text(get_w() - get_text_width(LARGEFONT, aw_name) - 4, 30,
1652 aw_name, -1, get_bg_surface());
1655 int AWindowAssets::drag_start_event()
1657 int collect_pluginservers = 0;
1658 int collect_assets = 0;
1660 if( BC_ListBox::drag_start_event() ) {
1661 switch( mwindow->edl->session->awindow_folder ) {
1662 case AW_AEFFECT_FOLDER:
1663 mwindow->session->current_operation = DRAG_AEFFECT;
1664 collect_pluginservers = 1;
1666 case AW_VEFFECT_FOLDER:
1667 mwindow->session->current_operation = DRAG_VEFFECT;
1668 collect_pluginservers = 1;
1670 case AW_ATRANSITION_FOLDER:
1671 mwindow->session->current_operation = DRAG_ATRANSITION;
1672 collect_pluginservers = 1;
1674 case AW_VTRANSITION_FOLDER:
1675 mwindow->session->current_operation = DRAG_VTRANSITION;
1676 collect_pluginservers = 1;
1678 case AW_LABEL_FOLDER:
1682 mwindow->session->current_operation = DRAG_ASSET;
1687 if( collect_pluginservers ) {
1689 mwindow->session->drag_pluginservers->remove_all();
1692 AssetPicon *result = (AssetPicon*)get_selection(0, i++);
1693 if( !result ) break;
1695 mwindow->session->drag_pluginservers->append(result->plugin);
1699 if( collect_assets ) {
1700 gui->collect_assets();
1708 int AWindowAssets::drag_motion_event()
1710 BC_ListBox::drag_motion_event();
1713 mwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1714 mwindow->gui->drag_motion();
1715 mwindow->gui->unlock_window();
1717 for( int i = 0; i < mwindow->vwindows.size(); i++ ) {
1718 VWindow *vwindow = mwindow->vwindows.get(i);
1719 if( !vwindow->is_running() ) continue;
1720 vwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1721 vwindow->gui->drag_motion();
1722 vwindow->gui->unlock_window();
1725 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1726 mwindow->cwindow->gui->drag_motion();
1727 mwindow->cwindow->gui->unlock_window();
1729 lock_window("AWindowAssets::drag_motion_event");
1733 int AWindowAssets::drag_stop_event()
1737 result = gui->drag_stop();
1742 mwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1743 result = mwindow->gui->drag_stop();
1744 mwindow->gui->unlock_window();
1748 for( int i = 0; !result && i < mwindow->vwindows.size(); i++ ) {
1749 VWindow *vwindow = mwindow->vwindows.get(i);
1750 if( !vwindow ) continue;
1751 if( !vwindow->is_running() ) continue;
1752 if( vwindow->gui->is_hidden() ) continue;
1753 vwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1754 if( vwindow->gui->cursor_above() &&
1755 vwindow->gui->get_cursor_over_window() ) {
1756 result = vwindow->gui->drag_stop();
1758 vwindow->gui->unlock_window();
1763 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1764 result = mwindow->cwindow->gui->drag_stop();
1765 mwindow->cwindow->gui->unlock_window();
1768 lock_window("AWindowAssets::drag_stop_event");
1770 if( result ) get_drag_popup()->set_animation(0);
1772 BC_ListBox::drag_stop_event();
1773 mwindow->session->current_operation = ::NO_OPERATION; // since NO_OPERATION is also defined in listbox, we have to reach for global scope...
1777 int AWindowAssets::column_resize_event()
1779 mwindow->edl->session->asset_columns[0] = get_column_width(0);
1780 mwindow->edl->session->asset_columns[1] = get_column_width(1);
1784 int AWindowAssets::focus_in_event()
1786 gui->start_vicon_drawing();
1790 int AWindowAssets::focus_out_event()
1792 gui->stop_vicon_drawing();
1793 return BC_ListBox::focus_out_event();
1807 AWindowNewFolder::AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1808 : BC_Button(x, y, mwindow->theme->newbin_data)
1810 this->mwindow = mwindow;
1812 set_tooltip(_("New bin"));
1815 int AWindowNewFolder::handle_event()
1817 gui->newfolder_thread->start_new_folder();
1821 AWindowDeleteFolder::AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1822 : BC_Button(x, y, mwindow->theme->deletebin_data)
1824 this->mwindow = mwindow;
1826 set_tooltip(_("Delete bin"));
1829 int AWindowDeleteFolder::handle_event()
1831 if( gui->folder_list->get_selection(0, 0) ) {
1832 BC_ListBoxItem *folder = gui->folder_list->get_selection(0, 0);
1833 mwindow->delete_folder(folder->get_text());
1838 AWindowRenameFolder::AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1839 : BC_Button(x, y, mwindow->theme->renamebin_data)
1841 this->mwindow = mwindow;
1843 set_tooltip(_("Rename bin"));
1846 int AWindowRenameFolder::handle_event()
1851 AWindowDeleteDisk::AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1852 : BC_Button(x, y, mwindow->theme->deletedisk_data)
1854 this->mwindow = mwindow;
1856 set_tooltip(_("Delete asset from disk"));
1859 int AWindowDeleteDisk::handle_event()
1864 AWindowDeleteProject::AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1865 : BC_Button(x, y, mwindow->theme->deleteproject_data)
1867 this->mwindow = mwindow;
1869 set_tooltip(_("Delete asset from project"));
1872 int AWindowDeleteProject::handle_event()
1877 AWindowInfo::AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1878 : BC_Button(x, y, mwindow->theme->infoasset_data)
1880 this->mwindow = mwindow;
1882 set_tooltip(_("Edit information on asset"));
1885 int AWindowInfo::handle_event()
1888 gui->get_abs_cursor_xy(cur_x, cur_y, 0);
1889 gui->awindow->asset_edit->edit_asset(gui->selected_asset(), cur_x, cur_y);
1893 AWindowRedrawIndex::AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1894 : BC_Button(x, y, mwindow->theme->redrawindex_data)
1896 this->mwindow = mwindow;
1898 set_tooltip(_("Redraw index"));
1901 int AWindowRedrawIndex::handle_event()
1906 AWindowPaste::AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1907 : BC_Button(x, y, mwindow->theme->pasteasset_data)
1909 this->mwindow = mwindow;
1911 set_tooltip(_("Paste asset on recordable tracks"));
1914 int AWindowPaste::handle_event()
1919 AWindowAppend::AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1920 : BC_Button(x, y, mwindow->theme->appendasset_data)
1922 this->mwindow = mwindow;
1924 set_tooltip(_("Append asset in new tracks"));
1927 int AWindowAppend::handle_event()
1932 AWindowView::AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1933 : BC_Button(x, y, mwindow->theme->viewasset_data)
1935 this->mwindow = mwindow;
1937 set_tooltip(_("View asset"));
1940 int AWindowView::handle_event()
1945 AddTools::AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, const char *title)
1946 : BC_PopupMenu(x, y, BC_Title::calculate_w(gui, title, MEDIUMFONT)+8, title, -1, 0, 4)
1948 this->mwindow = mwindow;
1952 void AddTools::create_objects()
1955 add_item(new AddPluginItem(this, "ladspa", PLUGIN_LADSPA_ID));
1956 vis |= 1 << PLUGIN_LADSPA_ID;
1957 add_item(new AddPluginItem(this, "ffmpeg", PLUGIN_FFMPEG_ID));
1958 vis |= 1 << PLUGIN_FFMPEG_ID;
1959 for( int i=0; i<MWindow::plugindb->size(); ++i ) {
1960 PluginServer *plugin = MWindow::plugindb->get(i);
1961 if( !plugin->audio && !plugin->video ) continue;
1962 int idx = plugin->dir_idx;
1963 uint32_t msk = 1 << idx;
1964 if( (msk & vis) != 0 ) continue;
1966 char parent[BCTEXTLEN];
1967 strcpy(parent, plugin->path);
1968 char *bp = strrchr(parent, '/');
1969 if( bp ) { *bp = 0; bp = strrchr(parent, '/'); }
1970 if( !bp ) bp = parent; else ++bp;
1971 add_item(new AddPluginItem(this, bp, idx));
1976 // plugin_dirs list from toplevel makefile include plugin_defs
1980 N_("audio_transitions")
1987 N_("video_transitions")
1990 AddPluginItem::AddPluginItem(AddTools *menu, char const *text, int idx)
1991 : BC_MenuItem(_(text))
1995 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
1996 int chk = (msk & vis) ? 1 : 0;
2000 int AddPluginItem::handle_event()
2002 int chk = get_checked() ^ 1;
2004 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
2005 menu->gui->plugin_visibility = chk ? vis | msk : vis & ~msk;
2006 menu->gui->update_effects();
2007 menu->gui->save_defaults(menu->mwindow->defaults);
2008 menu->gui->async_update_assets();
2012 AVIconDrawing::AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images)
2013 : BC_Toggle(x, y, images, agui->vicon_drawing)
2016 set_tooltip(_("draw vicons"));
2019 void AVIconDrawing::calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh)
2021 int text_line = -1, toggle_x = -1, toggle_y = -1;
2022 int text_x = -1, text_y = -1, text_w = -1, text_h = -1;
2023 BC_Toggle::calculate_extents(agui, images, 1,
2024 &text_line, ww, hh, &toggle_x, &toggle_y,
2025 &text_x, &text_y, &text_w, &text_h, "", MEDIUMFONT);
2028 AVIconDrawing::~AVIconDrawing()
2032 int AVIconDrawing::handle_event()
2034 agui->vicon_drawing = get_value();
2035 if( agui->vicon_drawing )
2036 agui->start_vicon_drawing();
2038 agui->stop_vicon_drawing();
2043 AWindowListFormat::AWindowListFormat(MWindow *mwindow, AWindowGUI *gui)
2046 this->mwindow = mwindow;
2050 int AWindowListFormat::handle_event()
2052 gui->stop_vicon_drawing();
2054 EDLSession *session = mwindow->edl->session;
2055 switch( session->assetlist_format ) {
2057 session->assetlist_format = ASSETS_ICONS;
2060 session->assetlist_format = ASSETS_TEXT;
2064 gui->asset_list->update_format(session->assetlist_format, 1);
2065 if( !mwindow->awindow->gui->allow_iconlisting ) {
2066 mwindow->edl->session->assetlist_format = ASSETS_TEXT;
2069 gui->start_vicon_drawing();
2073 void AWindowListFormat::update()
2075 set_text(mwindow->edl->session->assetlist_format == ASSETS_TEXT ?
2076 (char*)_("Display icons") : (char*)_("Display text"));
2079 AWindowListSort::AWindowListSort(MWindow *mwindow, AWindowGUI *gui)
2080 : BC_MenuItem(_("Sort items"))
2082 this->mwindow = mwindow;
2086 int AWindowListSort::handle_event()