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"
27 #include "awindowgui.inc"
29 #include "awindowmenu.h"
30 #include "bcsignals.h"
33 #include "bccmodels.h"
35 #include "cwindowgui.h"
38 #include "edlsession.h"
40 #include "filesystem.h"
41 #include "indexable.h"
44 #include "localsession.h"
46 #include "mainsession.h"
47 #include "mwindowgui.h"
49 #include "nestededls.h"
50 #include "newfolder.h"
51 #include "preferences.h"
55 #include "vwindowgui.h"
58 #include "data/lad_picon_png.h"
59 #include "data/ff_audio_png.h"
60 #include "data/ff_video_png.h"
68 AssetVIcon::AssetVIcon(AssetPicon *picon, int w, int h, double framerate, int64_t length)
69 : VIcon(w, h, framerate)
72 this->length = length;
76 AssetVIcon::~AssetVIcon()
81 VFrame *AssetVIcon::frame()
83 if( seq_no >= images.size() ) {
84 MWindow *mwindow = picon->mwindow;
85 Asset *asset = (Asset *)picon->indexable;
86 File *file = mwindow->video_cache->check_out(asset, mwindow->edl, 1);
88 if( temp && (temp->get_w() != asset->width || temp->get_h() != asset->height) ) {
89 delete temp; temp = 0;
92 temp = new VFrame(asset->width, asset->height, BC_RGB888);
94 file->set_video_position(images.size(),0);
95 int ww = picon->gui->vicon_thread->view_w;
96 int hh = picon->gui->vicon_thread->view_h;
97 while( seq_no >= images.size() ) {
98 file->read_frame(temp);
99 add_image(temp, ww, hh, BC_RGB8);
101 mwindow->video_cache->check_in(asset);
103 return *images[seq_no];
106 int64_t AssetVIcon::next_frame(int n)
109 if( (seq_no+=n) >= length ) seq_no = 0;
113 int AssetVIcon::get_vx()
115 BC_ListBox *lbox = picon->gui->asset_list;
116 return lbox->get_item_x(picon);
118 int AssetVIcon::get_vy()
120 BC_ListBox *lbox = picon->gui->asset_list;
121 return lbox->get_item_y(picon) + lbox->get_title_h();
124 AssetPicon::AssetPicon(MWindow *mwindow,
126 Indexable *indexable)
130 this->mwindow = mwindow;
132 this->indexable = indexable;
133 indexable->add_user();
134 this->id = indexable->id;
137 AssetPicon::AssetPicon(MWindow *mwindow,
143 this->mwindow = mwindow;
150 AssetPicon::AssetPicon(MWindow *mwindow,
153 : BC_ListBoxItem(folder, gui->folder_icon)
156 this->mwindow = mwindow;
160 AssetPicon::AssetPicon(MWindow *mwindow,
162 PluginServer *plugin)
166 this->mwindow = mwindow;
168 this->plugin = plugin;
172 AssetPicon::~AssetPicon()
175 gui->vicon_thread->del_vicon(vicon);
176 if(indexable) indexable->remove_user();
177 if(edl) edl->remove_user();
178 if( icon && !gui->protected_pixmap(icon) ) {
180 if( !plugin ) delete icon_vframe;
184 void AssetPicon::reset()
197 void AssetPicon::create_objects()
200 char name[BCTEXTLEN];
201 int pixmap_w, pixmap_h;
206 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
209 fs.extract_name(name, indexable->path);
213 if(indexable && indexable->is_asset)
215 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
216 Asset *asset = (Asset*)indexable;
217 if(asset->video_data)
219 if(mwindow->preferences->use_thumbnails)
221 gui->unlock_window();
222 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
223 File *file = mwindow->video_cache->check_out(asset,
226 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
230 int height = asset->height > 0 ? asset->height : 1;
231 pixmap_w = pixmap_h * asset->width / height;
234 file->set_video_position(0, 0);
236 if(gui->temp_picon &&
237 (gui->temp_picon->get_w() != asset->width ||
238 gui->temp_picon->get_h() != asset->height))
240 delete gui->temp_picon;
246 gui->temp_picon = new VFrame(0, -1,
247 asset->width, asset->height,
251 file->read_frame(gui->temp_picon);
252 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
253 mwindow->video_cache->check_in(asset);
255 gui->lock_window("AssetPicon::create_objects 1");
256 icon = new BC_Pixmap(gui, pixmap_w, pixmap_h);
257 icon->draw_vframe(gui->temp_picon,
258 0, 0, pixmap_w, pixmap_h, 0, 0);
259 //printf("%d %d\n", gui->temp_picon->get_w(), gui->temp_picon->get_h());
260 icon_vframe = new VFrame(0,
261 -1, pixmap_w, pixmap_h, BC_RGB888, -1);
262 icon_vframe->transfer_from(gui->temp_picon);
264 double framerate = asset->get_frame_rate();
265 if( !framerate ) framerate = 24;
266 int64_t length = framerate * 5;
267 int64_t vframes = asset->get_video_frames();
268 if( length > vframes ) length = vframes;
269 vicon = new AssetVIcon(this, pixmap_w, pixmap_h, framerate, length);
270 gui->vicon_thread->add_vicon(vicon);
271 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
276 gui->lock_window("AssetPicon::create_objects 2");
277 icon = gui->video_icon;
278 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
283 icon = gui->video_icon;
284 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
288 if(asset->audio_data)
290 icon = gui->audio_icon;
291 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND];
293 //printf("AssetPicon::create_objects 2\n");
295 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
298 if(indexable && !indexable->is_asset)
300 icon = gui->video_icon;
301 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
306 //printf("AssetPicon::create_objects 4 %s\n", edl->local_session->clip_title);
307 set_text(strcpy(name, edl->local_session->clip_title));
308 icon = gui->clip_icon;
309 icon_vframe = mwindow->theme->get_image("clip_icon");
314 strcpy(name, _(plugin->title));
316 icon_vframe = plugin->get_picon();
318 icon = gui->create_pixmap(icon_vframe);
319 else if( plugin->audio ) {
320 if( plugin->transition ) {
321 icon = gui->atransition_icon;
322 icon_vframe = gui->atransition_vframe;
324 else if( plugin->is_ffmpeg() ) {
325 icon = gui->ff_aud_icon;
326 icon_vframe = gui->ff_aud_vframe;
328 else if( plugin->is_ladspa() ) {
329 icon = gui->ladspa_icon;
330 icon_vframe = gui->ladspa_vframe;
333 icon = gui->aeffect_icon;
334 icon_vframe = gui->aeffect_vframe;
337 else if( plugin->video ) {
338 if( plugin->transition ) {
339 icon = gui->vtransition_icon;
340 icon_vframe = gui->vtransition_vframe;
342 else if( plugin->is_ffmpeg() ) {
343 icon = gui->ff_vid_icon;
344 icon_vframe = gui->ff_vid_vframe;
347 icon = gui->veffect_icon;
348 icon_vframe = gui->veffect_vframe;
353 icon = gui->file_icon;
354 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN];
357 set_icon_vframe(icon_vframe);
359 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
367 AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow)
368 : BC_Window(PROGRAM_NAME ": Resources",
369 mwindow->session->awindow_x,
370 mwindow->session->awindow_y,
371 mwindow->session->awindow_w,
372 mwindow->session->awindow_h,
379 // printf("AWindowGUI::AWindowGUI %d %d %d %d\n",
380 // mwindow->session->awindow_x,
381 // mwindow->session->awindow_y,
382 // mwindow->session->awindow_w,
383 // mwindow->session->awindow_h);
384 this->mwindow = mwindow;
385 this->awindow = awindow;
391 atransition_icon = 0; atransition_vframe = 0;
392 vtransition_icon = 0; vtransition_vframe = 0;
393 aeffect_icon = 0; aeffect_vframe = 0;
394 ladspa_icon = 0; ladspa_vframe = 0;
395 veffect_icon = 0; veffect_vframe = 0;
396 ff_aud_icon = 0; ff_aud_vframe = 0;
397 ff_vid_icon = 0; ff_vid_vframe = 0;
398 plugin_visibility = ((uint64_t)1<<(8*sizeof(uint64_t)-1))-1;
399 newfolder_thread = 0;
409 AWindowGUI::~AWindowGUI()
411 assets.remove_all_objects();
412 folders.remove_all_objects();
413 aeffects.remove_all_objects();
414 veffects.remove_all_objects();
415 atransitions.remove_all_objects();
416 vtransitions.remove_all_objects();
417 displayed_assets[1].remove_all_objects();
425 delete atransition_icon;
426 delete vtransition_icon;
429 delete ladspa_vframe;
431 delete ff_aud_vframe;
433 delete ff_vid_vframe;
435 delete newfolder_thread;
437 delete assetlist_menu;
438 delete folderlist_menu;
439 if(temp_picon) delete temp_picon;
440 delete remove_plugin;
443 bool AWindowGUI::protected_pixmap(BC_Pixmap *icon)
445 return icon == file_icon ||
446 icon == folder_icon ||
447 icon == audio_icon ||
448 icon == video_icon ||
450 icon == vtransition_icon ||
451 icon == atransition_icon ||
452 icon == veffect_icon ||
453 icon == aeffect_icon ||
454 icon == ladspa_icon ||
455 icon == ff_aud_icon ||
459 void AWindowGUI::create_objects()
463 lock_window("AWindowGUI::create_objects");
465 //printf("AWindowGUI::create_objects 1\n");
466 asset_titles[0] = _("Title");
467 asset_titles[1] = _("Comments");
471 set_icon(mwindow->theme->get_image("awindow_icon"));
472 file_icon = new BC_Pixmap(this,
473 BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN],
476 folder_icon = new BC_Pixmap(this,
477 BC_WindowBase::get_resources()->type_to_icon[ICON_FOLDER],
480 audio_icon = new BC_Pixmap(this,
481 BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND],
484 video_icon = new BC_Pixmap(this,
485 BC_WindowBase::get_resources()->type_to_icon[ICON_FILM],
490 clip_vframe = mwindow->theme->get_image("clip_icon");
491 clip_icon = new BC_Pixmap(this, clip_vframe, PIXMAP_ALPHA);
492 atransition_vframe = mwindow->theme->get_image("atransition_icon");
493 atransition_icon = new BC_Pixmap(this, atransition_vframe, PIXMAP_ALPHA);
494 vtransition_vframe = mwindow->theme->get_image("vtransition_icon");
495 vtransition_icon = new BC_Pixmap(this, vtransition_vframe, PIXMAP_ALPHA);
496 aeffect_vframe = mwindow->theme->get_image("aeffect_icon");
497 aeffect_icon = new BC_Pixmap(this, aeffect_vframe, PIXMAP_ALPHA);
498 ladspa_vframe = new VFrame(lad_picon_png);
499 ladspa_icon = new BC_Pixmap(this, ladspa_vframe, PIXMAP_ALPHA);
500 ff_aud_vframe = new VFrame(ff_audio_png);
501 ff_aud_icon = new BC_Pixmap(this, ff_aud_vframe, PIXMAP_ALPHA);
502 ff_vid_vframe = new VFrame(ff_video_png);
503 ff_vid_icon = new BC_Pixmap(this, ff_vid_vframe, PIXMAP_ALPHA);
504 veffect_vframe = mwindow->theme->get_image("veffect_icon");
505 veffect_icon = new BC_Pixmap(this, veffect_vframe, PIXMAP_ALPHA);
510 folders.append(picon = new AssetPicon(mwindow,
513 picon->persistent = 1;
514 folders.append(picon = new AssetPicon(mwindow,
517 picon->persistent = 1;
518 folders.append(picon = new AssetPicon(mwindow,
520 ATRANSITION_FOLDER));
521 picon->persistent = 1;
522 folders.append(picon = new AssetPicon(mwindow,
524 VTRANSITION_FOLDER));
525 picon->persistent = 1;
528 mwindow->theme->get_awindow_sizes(this);
529 load_defaults(mwindow->defaults);
532 add_subwindow(asset_list = new AWindowAssets(mwindow,
534 mwindow->theme->alist_x,
535 mwindow->theme->alist_y,
536 mwindow->theme->alist_w,
537 mwindow->theme->alist_h));
539 vicon_thread = new VIconThread(asset_list);
540 vicon_thread->start();
543 add_subwindow(divider = new AWindowDivider(mwindow,
545 mwindow->theme->adivider_x,
546 mwindow->theme->adivider_y,
547 mwindow->theme->adivider_w,
548 mwindow->theme->adivider_h));
551 divider->set_cursor(HSEPARATE_CURSOR, 0, 0);
554 int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y;
555 int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h;
556 VFrame **images = mwindow->theme->get_image_set("playpatch_data");
557 AVIconDrawing::calculate_geometry(this, images, &avicon_w, &avicon_h);
558 add_subwindow(avicon_drawing = new AVIconDrawing(this, fw-avicon_w, fy, images));
559 add_subwindow(add_tools = new AddTools(mwindow, this, fx, fy, fw-avicon_w));
560 add_tools->create_objects();
561 fy += add_tools->get_h(); fh -= add_tools->get_h();
563 add_subwindow(folder_list = new AWindowFolders(mwindow,
564 this, fx, fy, fw, fh));
569 //int x = mwindow->theme->abuttons_x;
570 //int y = mwindow->theme->abuttons_y;
574 newfolder_thread = new NewFolderThread(mwindow, this);
576 add_subwindow(asset_menu = new AssetPopup(mwindow, this));
577 asset_menu->create_objects();
581 add_subwindow(assetlist_menu = new AssetListMenu(mwindow, this));
584 assetlist_menu->create_objects();
588 add_subwindow(folderlist_menu = new FolderListMenu(mwindow, this));
589 folderlist_menu->create_objects();
590 //printf("AWindowGUI::create_objects 2\n");
596 int AWindowGUI::resize_event(int w, int h)
598 mwindow->session->awindow_x = get_x();
599 mwindow->session->awindow_y = get_y();
600 mwindow->session->awindow_w = w;
601 mwindow->session->awindow_h = h;
603 mwindow->theme->get_awindow_sizes(this);
604 mwindow->theme->draw_awindow_bg(this);
605 reposition_objects();
607 // int x = mwindow->theme->abuttons_x;
608 // int y = mwindow->theme->abuttons_y;
609 // new_bin->reposition_window(x, y);
610 // x += new_bin->get_w();
611 // delete_bin->reposition_window(x, y);
612 // x += delete_bin->get_w();
613 // rename_bin->reposition_window(x, y);
614 // x += rename_bin->get_w();
615 // delete_disk->reposition_window(x, y);
616 // x += delete_disk->get_w();
617 // delete_project->reposition_window(x, y);
618 // x += delete_project->get_w();
619 // info->reposition_window(x, y);
620 // x += info->get_w();
621 // redraw_index->reposition_window(x, y);
622 // x += redraw_index->get_w();
623 // paste->reposition_window(x, y);
624 // x += paste->get_w();
625 // append->reposition_window(x, y);
626 // x += append->get_w();
627 // view->reposition_window(x, y);
629 BC_WindowBase::resize_event(w, h);
633 int AWindowGUI::translation_event()
635 mwindow->session->awindow_x = get_x();
636 mwindow->session->awindow_y = get_y();
640 void AWindowGUI::reposition_objects()
642 mwindow->theme->get_awindow_sizes(this);
643 asset_list->reposition_window(
644 mwindow->theme->alist_x, mwindow->theme->alist_y,
645 mwindow->theme->alist_w, mwindow->theme->alist_h);
646 divider->reposition_window(
647 mwindow->theme->adivider_x, mwindow->theme->adivider_y,
648 mwindow->theme->adivider_w, mwindow->theme->adivider_h);
649 int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y;
650 int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h;
651 add_tools->resize_event(fw-avicon_w, add_tools->get_h());
652 avicon_drawing->reposition_window(fw-avicon_w, fy);
653 fy += add_tools->get_h(); fh -= add_tools->get_h();
654 folder_list->reposition_window(fx, fy, fw, fh);
657 int AWindowGUI::save_defaults(BC_Hash *defaults)
659 defaults->update("PLUGIN_VISIBILTY", plugin_visibility);
660 defaults->update("VICON_DRAWING", vicon_drawing);
664 int AWindowGUI::load_defaults(BC_Hash *defaults)
666 plugin_visibility = defaults->get("PLUGIN_VISIBILTY", plugin_visibility);
667 vicon_drawing = defaults->get("VICON_DRAWING", vicon_drawing);
672 int AWindowGUI::close_event()
675 mwindow->session->show_awindow = 0;
678 mwindow->gui->lock_window("AWindowGUI::close_event");
679 mwindow->gui->mainmenu->show_awindow->set_checked(0);
680 mwindow->gui->unlock_window();
682 lock_window("AWindowGUI::close_event");
683 save_defaults(mwindow->defaults);
684 mwindow->save_defaults();
688 void AWindowGUI::start_vicon_drawing()
690 if( !vicon_drawing ) return;
691 if( strcmp(mwindow->edl->session->current_folder, MEDIA_FOLDER) ) return;
692 if( mwindow->edl->session->assetlist_format != ASSETS_ICONS ) return;
693 vicon_thread->start_drawing();
696 void AWindowGUI::stop_vicon_drawing()
698 vicon_thread->stop_drawing();
701 AWindowRemovePluginGUI::
702 AWindowRemovePluginGUI(AWindow *awindow, AWindowRemovePlugin *thread,
703 int x, int y, PluginServer *plugin)
704 : BC_Window(PROGRAM_NAME ": Remove plugin", x,y, 500,200, 50, 50, 1, 0, 1, -1, "", 1)
706 this->awindow = awindow;
707 this->thread = thread;
708 this->plugin = plugin;
709 VFrame *vframe = plugin->get_picon();
710 icon = vframe ? create_pixmap(vframe) : 0;
711 plugin_list.append(new BC_ListBoxItem(plugin->title, icon));
714 AWindowRemovePluginGUI::
715 ~AWindowRemovePluginGUI()
717 if( !awindow->gui->protected_pixmap(icon) )
719 plugin_list.remove_all();
722 void AWindowRemovePluginGUI::create_objects()
724 BC_Button *ok_button = new BC_OKButton(this);
725 add_subwindow(ok_button);
726 BC_Button *cancel_button = new BC_CancelButton(this);
727 add_subwindow(cancel_button);
729 BC_Title *title = new BC_Title(x, y, _("remove plugin?"));
730 add_subwindow(title);
731 y += title->get_h() + 5;
732 list = new BC_ListBox(x, y,
733 get_w() - 20, ok_button->get_y() - y - 5, LISTBOX_TEXT, &plugin_list,
734 0, 0, 1, 0, 0, LISTBOX_SINGLE, ICON_LEFT, 0);
739 int AWindowRemovePlugin::remove_plugin(PluginServer *plugin, ArrayList<BC_ListBoxItem*> &folder)
742 for( int i=0; i<folder.size(); ) {
743 AssetPicon *picon = (AssetPicon *)folder[i];
744 if( picon->plugin == plugin ) {
745 folder.remove_object_number(i);
754 void AWindowRemovePlugin::handle_close_event(int result)
757 printf("remove %s\n", plugin->path);
758 ArrayList<BC_ListBoxItem*> *folder =
759 plugin->audio ? plugin->transition ?
760 &awindow->gui->atransitions :
761 &awindow->gui->aeffects :
762 plugin->video ? plugin->transition ?
763 &awindow->gui->vtransitions :
764 &awindow->gui->veffects :
766 if( folder ) remove_plugin(plugin, *folder);
767 awindow->gui->update_assets();
768 char png_path[BCTEXTLEN], plugin_path[BCTEXTLEN], index_path[BCTEXTLEN];
769 strcpy(plugin_path, plugin->path);
770 if( !plugin->get_plugin_png_path(png_path) ) png_path[0] = 0;
771 MWindow *mwindow = awindow->mwindow;
772 sprintf(index_path, "%s/%s", mwindow->preferences->plugin_dir, PLUGIN_FILE);
773 mwindow->plugindb->remove(plugin);
774 plugin->delete_this();
776 if( png_path[0] ) remove(png_path);
781 AWindowRemovePlugin::
782 AWindowRemovePlugin(AWindow *awindow, PluginServer *plugin)
785 this->awindow = awindow;
786 this->plugin = plugin;
789 AWindowRemovePlugin::
790 ~AWindowRemovePlugin()
795 BC_Window* AWindowRemovePlugin::new_gui()
797 int x = awindow->gui->get_abs_cursor_x(0);
798 int y = awindow->gui->get_abs_cursor_y(0);
799 AWindowRemovePluginGUI *gui = new AWindowRemovePluginGUI(awindow, this, x, y, plugin);
800 gui->create_objects();
804 int AWindowGUI::keypress_event()
806 switch(get_keypress()) {
815 PluginServer* plugin = selected_plugin();
817 remove_plugin = new AWindowRemovePlugin(awindow, plugin);
819 remove_plugin->start();
826 void AWindowGUI::update_folder_list()
828 stop_vicon_drawing();
829 //printf("AWindowGUI::update_folder_list 1\n");
830 for(int i = 0; i < folders.total; i++)
832 AssetPicon *picon = (AssetPicon*)folders.values[i];
835 //printf("AWindowGUI::update_folder_list 1\n");
837 // Search assets for folders
838 for(int i = 0; i < mwindow->edl->folders.total; i++)
840 char *folder = mwindow->edl->folders.values[i];
842 //printf("AWindowGUI::update_folder_list 1.1\n");
844 for(int j = 0; j < folders.total; j++)
846 AssetPicon *picon = (AssetPicon*)folders.values[j];
847 if(!strcasecmp(picon->get_text(), folder))
857 AssetPicon *picon = new AssetPicon(mwindow, this, folder);
858 picon->create_objects();
859 folders.append(picon);
861 //printf("AWindowGUI::update_folder_list 1.3\n");
863 //printf("AWindowGUI::update_folder_list 1\n");
864 //for(int i = 0; i < folders.total; i++)
865 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
868 for(int i = folders.total - 1; i >= 0; i--)
870 AssetPicon *picon = (AssetPicon*)folders.values[i];
871 if(!picon->in_use && !picon->persistent)
874 folders.remove_number(i);
877 //for(int i = 0; i < folders.total; i++)
878 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
879 //printf("AWindowGUI::update_folder_list 2\n");
880 start_vicon_drawing();
883 void AWindowGUI::create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
884 int do_audio, int do_video, int is_realtime, int is_transition)
886 ArrayList<PluginServer*> plugin_list;
887 // Get pointers to plugindb entries
888 mwindow->search_plugindb(do_audio, do_video, is_realtime, is_transition,
891 for(int i = 0; i < plugin_list.total; i++) {
892 PluginServer *server = plugin_list.values[i];
893 int visible = plugin_visibility & (1<<server->dir_idx);
894 if(!visible) continue;
895 // Create new listitem
896 AssetPicon *picon = new AssetPicon(mwindow, this, server);
897 picon->create_objects();
898 output->append(picon);
902 void AWindowGUI::update_asset_list()
904 //printf("AWindowGUI::update_asset_list 1\n");
905 for(int i = 0; i < assets.total; i++)
907 AssetPicon *picon = (AssetPicon*)assets.values[i];
915 //printf("AWindowGUI::update_asset_list 2\n");
918 // Synchronize EDL clips
919 for(int i = 0; i < mwindow->edl->clips.total; i++)
923 // Look for clip in existing listitems
924 for(int j = 0; j < assets.total && !exists; j++)
926 AssetPicon *picon = (AssetPicon*)assets.values[j];
928 if(picon->id == mwindow->edl->clips.values[i]->id)
930 picon->edl = mwindow->edl->clips.values[i];
931 picon->set_text(mwindow->edl->clips.values[i]->local_session->clip_title);
937 // Create new listitem
940 AssetPicon *picon = new AssetPicon(mwindow,
942 mwindow->edl->clips.values[i]);
943 picon->create_objects();
944 assets.append(picon);
952 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
955 // Synchronize EDL assets
956 for(Asset *current = mwindow->edl->assets->first;
962 // Look for asset in existing listitems
963 for(int j = 0; j < assets.total && !exists; j++)
965 AssetPicon *picon = (AssetPicon*)assets.values[j];
967 if(picon->id == current->id)
969 picon->indexable = current;
976 // Create new listitem
979 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
980 AssetPicon *picon = new AssetPicon(mwindow, this, current);
981 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
982 picon->create_objects();
983 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
984 assets.append(picon);
990 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
993 // Synchronize nested EDLs
994 for(int i = 0; i < mwindow->edl->nested_edls->size(); i++)
997 Indexable *indexable = mwindow->edl->nested_edls->get(i);
999 // Look for asset in existing listitems
1000 for(int j = 0; j < assets.total && !exists; j++)
1002 AssetPicon *picon = (AssetPicon*)assets.values[j];
1004 if(picon->id == indexable->id)
1006 picon->indexable = indexable;
1013 // Create new listitem
1016 AssetPicon *picon = new AssetPicon(mwindow,
1019 picon->create_objects();
1020 assets.append(picon);
1032 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1033 for(int i = assets.size() - 1; i >= 0; i--)
1035 AssetPicon *picon = (AssetPicon*)assets.get(i);
1036 //printf("AWindowGUI::update_asset_list %s %d\n", picon->asset->path, picon->in_use);
1040 assets.remove_number(i);
1043 //printf("AWindowGUI::update_asset_list 7 %d\n", assets.total);
1050 void AWindowGUI::sort_assets()
1052 //printf("AWindowGUI::sort_assets 1 %s\n", mwindow->edl->session->current_folder);
1053 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1054 sort_picons(&aeffects,
1057 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1058 sort_picons(&veffects,
1061 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1062 sort_picons(&atransitions,
1065 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1066 sort_picons(&vtransitions,
1069 sort_picons(&assets,
1070 mwindow->edl->session->current_folder);
1085 void AWindowGUI::collect_assets()
1088 mwindow->session->drag_assets->remove_all();
1089 mwindow->session->drag_clips->remove_all();
1092 AssetPicon *result = (AssetPicon*)asset_list->get_selection(0, i++);
1095 if(result->indexable) mwindow->session->drag_assets->append(result->indexable);
1096 if(result->edl) mwindow->session->drag_clips->append(result->edl);
1100 void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst,
1101 ArrayList<BC_ListBoxItem*> *src,
1104 // Remove current pointers
1105 dst[0].remove_all();
1106 dst[1].remove_all_objects();
1108 // Create new pointers
1109 //if(folder) printf("AWindowGUI::copy_picons 1 %s\n", folder);
1110 for(int i = 0; i < src->total; i++)
1112 AssetPicon *picon = (AssetPicon*)src->values[i];
1113 //printf("AWindowGUI::copy_picons 2 %s\n", picon->asset->folder);
1115 (folder && picon->indexable && !strcasecmp(picon->indexable->folder, folder)) ||
1116 (folder && picon->edl && !strcasecmp(picon->edl->local_session->folder, folder)))
1118 BC_ListBoxItem *item2, *item1;
1119 dst[0].append(item1 = picon);
1121 dst[1].append(item2 = new BC_ListBoxItem(picon->edl->local_session->clip_notes));
1123 dst[1].append(item2 = new BC_ListBoxItem(""));
1124 item1->set_autoplace_text(1);
1125 item2->set_autoplace_text(1);
1126 //printf("AWindowGUI::copy_picons 3 %s\n", picon->get_text());
1131 void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src,
1134 //printf("AWindowGUI::sort_picons 1\n")
1139 for(int i = 0; i < src->total - 1; i++)
1141 BC_ListBoxItem *item1 = src->values[i];
1142 BC_ListBoxItem *item2 = src->values[i + 1];
1143 item1->set_autoplace_icon(1);
1144 item2->set_autoplace_icon(1);
1145 item1->set_autoplace_text(1);
1146 item2->set_autoplace_text(1);
1147 if(strcmp(item1->get_text(), item2->get_text()) > 0)
1149 src->values[i + 1] = item1;
1150 src->values[i] = item2;
1158 void AWindowGUI::filter_displayed_assets()
1160 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1161 copy_picons(displayed_assets,
1165 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1166 copy_picons(displayed_assets,
1170 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1171 copy_picons(displayed_assets,
1175 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1176 copy_picons(displayed_assets,
1180 copy_picons(displayed_assets,
1182 mwindow->edl->session->current_folder);
1186 void AWindowGUI::update_assets()
1188 //printf("AWindowGUI::update_assets 1\n");
1189 update_folder_list();
1190 //printf("AWindowGUI::update_assets 2\n");
1191 update_asset_list();
1192 //printf("AWindowGUI::update_assets 3\n");
1193 filter_displayed_assets();
1195 //for(int i = 0; i < folders.total; i++)
1196 //printf("AWindowGUI::update_assets 4\n");
1197 // printf("AWindowGUI::update_assets %s\n", folders.values[i]->get_text());
1198 if(mwindow->edl->session->folderlist_format != folder_list->get_format())
1199 folder_list->update_format(mwindow->edl->session->folderlist_format, 0);
1200 folder_list->update(&folders,
1204 folder_list->get_xposition(),
1205 folder_list->get_yposition(),
1207 //printf("AWindowGUI::update_assets 5\n");
1209 if(mwindow->edl->session->assetlist_format != asset_list->get_format())
1210 asset_list->update_format(mwindow->edl->session->assetlist_format, 0);
1213 //printf("AWindowGUI::update_assets 6 %d\n", displayed_assets[0].total);
1214 asset_list->update(displayed_assets,
1216 mwindow->edl->session->asset_columns,
1218 asset_list->get_xposition(),
1219 asset_list->get_yposition(),
1222 //printf("AWindowGUI::update_assets 7\n");
1225 //printf("AWindowGUI::update_assets 8\n");
1229 void AWindowGUI::update_effects()
1231 aeffects.remove_all_objects();
1232 create_persistent_folder(&aeffects, 1, 0, 1, 0);
1233 veffects.remove_all_objects();
1234 create_persistent_folder(&veffects, 0, 1, 1, 0);
1235 atransitions.remove_all_objects();
1236 create_persistent_folder(&atransitions, 1, 0, 0, 1);
1237 vtransitions.remove_all_objects();
1238 create_persistent_folder(&vtransitions, 0, 1, 0, 1);
1241 int AWindowGUI::current_folder_number()
1244 for(int i = 0; i < folders.total; i++)
1246 if(!strcasecmp(folders.values[i]->get_text(), mwindow->edl->session->current_folder))
1255 int AWindowGUI::drag_motion()
1257 if(get_hidden()) return 0;
1263 int AWindowGUI::drag_stop()
1265 if(get_hidden()) return 0;
1270 Indexable* AWindowGUI::selected_asset()
1272 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1273 return picon ? picon->indexable : 0;
1276 PluginServer* AWindowGUI::selected_plugin()
1278 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1279 return picon ? picon->plugin : 0;
1282 AssetPicon* AWindowGUI::selected_folder()
1284 AssetPicon *picon = (AssetPicon*)folder_list->get_selection(0, 0);
1295 AWindowDivider::AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1296 : BC_SubWindow(x, y, w, h)
1298 this->mwindow = mwindow;
1301 AWindowDivider::~AWindowDivider()
1305 int AWindowDivider::button_press_event()
1307 if(is_event_win() && cursor_inside())
1309 mwindow->session->current_operation = DRAG_PARTITION;
1315 int AWindowDivider::cursor_motion_event()
1317 if(mwindow->session->current_operation == DRAG_PARTITION)
1319 mwindow->session->afolders_w = gui->get_relative_cursor_x();
1320 gui->reposition_objects();
1326 int AWindowDivider::button_release_event()
1328 if(mwindow->session->current_operation == DRAG_PARTITION)
1330 mwindow->session->current_operation = NO_OPERATION;
1341 AWindowFolders::AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1346 mwindow->edl->session->folderlist_format == FOLDERS_ICONS ?
1347 LISTBOX_ICONS : LISTBOX_TEXT,
1348 &gui->folders, // Each column has an ArrayList of BC_ListBoxItems.
1349 0, // Titles for columns. Set to 0 for no titles
1350 0, // width of each column
1351 1, // Total columns.
1352 0, // Pixel of top of window.
1353 0, // If this listbox is a popup window
1354 LISTBOX_SINGLE, // Select one item or multiple items
1355 ICON_TOP, // Position of icon relative to text of each item
1358 this->mwindow = mwindow;
1363 AWindowFolders::~AWindowFolders()
1367 int AWindowFolders::selection_changed()
1369 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1372 gui->stop_vicon_drawing();
1374 if(get_button_down() && get_buttonpress() == 3)
1376 gui->folderlist_menu->update_titles();
1377 gui->folderlist_menu->activate_menu();
1380 strcpy(mwindow->edl->session->current_folder, picon->get_text());
1381 //printf("AWindowFolders::selection_changed 1\n");
1382 gui->asset_list->draw_background();
1383 gui->update_assets();
1385 gui->start_vicon_drawing();
1390 int AWindowFolders::button_press_event()
1394 result = BC_ListBox::button_press_event();
1398 if(get_buttonpress() == 3 && is_event_win() && cursor_inside())
1400 gui->folderlist_menu->update_titles();
1401 gui->folderlist_menu->activate_menu();
1416 AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1421 mwindow->edl->session->assetlist_format == ASSETS_ICONS ?
1422 LISTBOX_ICONS : LISTBOX_TEXT,
1423 &gui->assets, // Each column has an ArrayList of BC_ListBoxItems.
1424 gui->asset_titles, // Titles for columns. Set to 0 for no titles
1425 mwindow->edl->session->asset_columns, // width of each column
1426 1, // Total columns.
1427 0, // Pixel of top of window.
1428 0, // If this listbox is a popup window
1429 LISTBOX_MULTIPLE, // Select one item or multiple items
1430 ICON_TOP, // Position of icon relative to text of each item
1433 this->mwindow = mwindow;
1438 AWindowAssets::~AWindowAssets()
1442 int AWindowAssets::button_press_event()
1446 result = BC_ListBox::button_press_event();
1448 if(!result && get_buttonpress() == 3 && is_event_win() && cursor_inside())
1450 BC_ListBox::deactivate_selection();
1451 gui->assetlist_menu->update_titles();
1452 gui->assetlist_menu->activate_menu();
1461 int AWindowAssets::handle_event()
1463 //printf("AWindowAssets::handle_event 1 %d %d\n", get_buttonpress(), get_selection(0, 0));
1464 if(get_selection(0, 0))
1466 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1470 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1474 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1478 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1482 if(mwindow->vwindows.size())
1484 //printf("AWindowAssets::handle_event 2 %d %d\n", get_buttonpress(), get_selection(0, 0));
1485 mwindow->vwindows.get(DEFAULT_VWINDOW)->gui->lock_window("AWindowAssets::handle_event");
1487 if(((AssetPicon*)get_selection(0, 0))->indexable)
1488 mwindow->vwindows.get(DEFAULT_VWINDOW)->change_source(((AssetPicon*)get_selection(0, 0))->indexable);
1490 if(((AssetPicon*)get_selection(0, 0))->edl)
1491 mwindow->vwindows.get(DEFAULT_VWINDOW)->change_source(((AssetPicon*)get_selection(0, 0))->edl);
1493 mwindow->vwindows.get(DEFAULT_VWINDOW)->gui->unlock_window();
1501 int AWindowAssets::selection_changed()
1503 // Show popup window
1504 if(get_button_down() && get_buttonpress() == 3 && get_selection(0, 0))
1506 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER) ||
1507 !strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER) ||
1508 !strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER) ||
1509 !strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1511 gui->assetlist_menu->update_titles();
1512 gui->assetlist_menu->activate_menu();
1516 if(((AssetPicon*)get_selection(0, 0))->indexable)
1517 gui->asset_menu->update();
1519 if(((AssetPicon*)get_selection(0, 0))->edl)
1520 gui->asset_menu->update();
1524 gui->asset_menu->activate_menu();
1527 BC_ListBox::deactivate_selection();
1530 else if( get_button_down() && get_buttonpress() == 1 && get_selection(0, 0) ) {
1532 if( !gui->vicon_thread->viewing ) {
1533 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1534 vicon = picon->vicon;
1536 gui->vicon_thread->set_view_popup(vicon);
1542 void AWindowAssets::draw_background()
1544 clear_box(0,0,get_w(),get_h(),get_bg_surface());
1546 set_font(LARGEFONT);
1548 get_text_width(LARGEFONT, mwindow->edl->session->current_folder) - 4,
1550 mwindow->edl->session->current_folder,
1555 int AWindowAssets::drag_start_event()
1557 int collect_pluginservers = 0;
1558 int collect_assets = 0;
1560 if(BC_ListBox::drag_start_event())
1562 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1564 mwindow->session->current_operation = DRAG_AEFFECT;
1565 collect_pluginservers = 1;
1568 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1570 mwindow->session->current_operation = DRAG_VEFFECT;
1571 collect_pluginservers = 1;
1574 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1576 mwindow->session->current_operation = DRAG_ATRANSITION;
1577 collect_pluginservers = 1;
1580 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1582 mwindow->session->current_operation = DRAG_VTRANSITION;
1583 collect_pluginservers = 1;
1587 mwindow->session->current_operation = DRAG_ASSET;
1592 if(collect_pluginservers)
1595 mwindow->session->drag_pluginservers->remove_all();
1598 AssetPicon *result = (AssetPicon*)get_selection(0, i++);
1601 mwindow->session->drag_pluginservers->append(result->plugin);
1607 gui->collect_assets();
1615 int AWindowAssets::drag_motion_event()
1617 BC_ListBox::drag_motion_event();
1620 mwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1621 mwindow->gui->drag_motion();
1622 mwindow->gui->unlock_window();
1624 for(int i = 0; i < mwindow->vwindows.size(); i++)
1626 VWindow *vwindow = mwindow->vwindows.get(i);
1627 vwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1628 vwindow->gui->drag_motion();
1629 vwindow->gui->unlock_window();
1632 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1633 mwindow->cwindow->gui->drag_motion();
1634 mwindow->cwindow->gui->unlock_window();
1636 lock_window("AWindowAssets::drag_motion_event");
1640 int AWindowAssets::drag_stop_event()
1644 result = gui->drag_stop();
1650 mwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1651 result = mwindow->gui->drag_stop();
1652 mwindow->gui->unlock_window();
1657 for(int i = 0; i < mwindow->vwindows.size(); i++)
1659 VWindow *vwindow = mwindow->vwindows.get(i);
1660 vwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1661 result = vwindow->gui->drag_stop();
1662 vwindow->gui->unlock_window();
1668 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1669 result = mwindow->cwindow->gui->drag_stop();
1670 mwindow->cwindow->gui->unlock_window();
1673 lock_window("AWindowAssets::drag_stop_event");
1675 if(result) get_drag_popup()->set_animation(0);
1677 BC_ListBox::drag_stop_event();
1678 mwindow->session->current_operation = ::NO_OPERATION; // since NO_OPERATION is also defined in listbox, we have to reach for global scope...
1682 int AWindowAssets::column_resize_event()
1684 mwindow->edl->session->asset_columns[0] = get_column_width(0);
1685 mwindow->edl->session->asset_columns[1] = get_column_width(1);
1689 int AWindowAssets::cursor_enter_event()
1691 int ret = BC_ListBox::cursor_enter_event();
1692 gui->start_vicon_drawing();
1696 int AWindowAssets::cursor_leave_event()
1698 gui->stop_vicon_drawing();
1699 return BC_ListBox::cursor_leave_event();
1713 AWindowNewFolder::AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1714 : BC_Button(x, y, mwindow->theme->newbin_data)
1716 this->mwindow = mwindow;
1718 set_tooltip(_("New bin"));
1721 int AWindowNewFolder::handle_event()
1723 gui->newfolder_thread->start_new_folder();
1727 AWindowDeleteFolder::AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1728 : BC_Button(x, y, mwindow->theme->deletebin_data)
1730 this->mwindow = mwindow;
1732 set_tooltip(_("Delete bin"));
1735 int AWindowDeleteFolder::handle_event()
1737 if(gui->folder_list->get_selection(0, 0))
1739 BC_ListBoxItem *folder = gui->folder_list->get_selection(0, 0);
1740 mwindow->delete_folder(folder->get_text());
1745 AWindowRenameFolder::AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1746 : BC_Button(x, y, mwindow->theme->renamebin_data)
1748 this->mwindow = mwindow;
1750 set_tooltip(_("Rename bin"));
1753 int AWindowRenameFolder::handle_event()
1758 AWindowDeleteDisk::AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1759 : BC_Button(x, y, mwindow->theme->deletedisk_data)
1761 this->mwindow = mwindow;
1763 set_tooltip(_("Delete asset from disk"));
1766 int AWindowDeleteDisk::handle_event()
1771 AWindowDeleteProject::AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1772 : BC_Button(x, y, mwindow->theme->deleteproject_data)
1774 this->mwindow = mwindow;
1776 set_tooltip(_("Delete asset from project"));
1779 int AWindowDeleteProject::handle_event()
1784 AWindowInfo::AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1785 : BC_Button(x, y, mwindow->theme->infoasset_data)
1787 this->mwindow = mwindow;
1789 set_tooltip(_("Edit information on asset"));
1792 int AWindowInfo::handle_event()
1794 gui->awindow->asset_edit->edit_asset(gui->selected_asset());
1798 AWindowRedrawIndex::AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1799 : BC_Button(x, y, mwindow->theme->redrawindex_data)
1801 this->mwindow = mwindow;
1803 set_tooltip(_("Redraw index"));
1806 int AWindowRedrawIndex::handle_event()
1811 AWindowPaste::AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1812 : BC_Button(x, y, mwindow->theme->pasteasset_data)
1814 this->mwindow = mwindow;
1816 set_tooltip(_("Paste asset on recordable tracks"));
1819 int AWindowPaste::handle_event()
1824 AWindowAppend::AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1825 : BC_Button(x, y, mwindow->theme->appendasset_data)
1827 this->mwindow = mwindow;
1829 set_tooltip(_("Append asset in new tracks"));
1832 int AWindowAppend::handle_event()
1837 AWindowView::AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1838 : BC_Button(x, y, mwindow->theme->viewasset_data)
1840 this->mwindow = mwindow;
1842 set_tooltip(_("View asset"));
1845 int AWindowView::handle_event()
1850 AddTools::AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w)
1851 : BC_MenuBar(x, y, w)
1853 this->mwindow = mwindow;
1857 void AddTools::create_objects()
1859 add_menu(add_plugins = new AddPluginsMenu(mwindow, gui));
1860 add_plugins->create_objects();
1863 AddPluginsMenu::AddPluginsMenu(MWindow *mwindow, AWindowGUI *gui)
1864 : BC_Menu("Add Tools")
1866 this->mwindow = mwindow;
1870 void AddPluginsMenu::create_objects()
1873 add_item(new AddPluginItem(this, "ladspa", PLUGIN_LADSPA_ID));
1874 vis |= 1 << PLUGIN_LADSPA_ID;
1875 add_item(new AddPluginItem(this, "ffmpeg", PLUGIN_FFMPEG_ID));
1876 vis |= 1 << PLUGIN_FFMPEG_ID;
1877 for( int i=0; i<MWindow::plugindb->size(); ++i ) {
1878 PluginServer *plugin = MWindow::plugindb->get(i);
1879 if( !plugin->audio && !plugin->video ) continue;
1880 int idx = plugin->dir_idx;
1881 uint32_t msk = 1 << idx;
1882 if( (msk & vis) != 0 ) continue;
1884 char parent[BCTEXTLEN];
1885 strcpy(parent, plugin->path);
1886 char *bp = strrchr(parent, '/');
1887 if( bp ) { *bp = 0; bp = strrchr(parent, '/'); }
1888 if( !bp ) bp = parent; else ++bp;
1889 add_item(new AddPluginItem(this, bp, idx));
1893 AddPluginItem::AddPluginItem(AddPluginsMenu *menu, char const *text, int idx)
1898 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
1899 int chk = (msk & vis) ? 1 : 0;
1903 int AddPluginItem::handle_event()
1905 int chk = get_checked() ^ 1;
1907 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
1908 menu->gui->plugin_visibility = chk ? vis | msk : vis & ~msk;
1909 menu->gui->update_effects();
1910 menu->gui->update_assets();
1911 menu->gui->save_defaults(menu->mwindow->defaults);
1915 AVIconDrawing::AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images)
1916 : BC_Toggle(x, y, images, agui->vicon_drawing)
1919 set_tooltip(_("draw vicons"));
1922 void AVIconDrawing::calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh)
1924 int text_line = -1, toggle_x = -1, toggle_y = -1;
1925 int text_x = -1, text_y = -1, text_w = -1, text_h = -1;
1926 BC_Toggle::calculate_extents(agui, images, 1,
1927 &text_line, ww, hh, &toggle_x, &toggle_y,
1928 &text_x, &text_y, &text_w, &text_h, "", MEDIUMFONT);
1931 AVIconDrawing::~AVIconDrawing()
1935 int AVIconDrawing::handle_event()
1937 agui->vicon_drawing = get_value();
1938 if( agui->vicon_drawing )
1939 agui->start_vicon_drawing();
1941 agui->stop_vicon_drawing();