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);
93 int ww = picon->gui->vicon_thread->view_w;
94 int hh = picon->gui->vicon_thread->view_h;
95 while( seq_no >= images.size() ) {
97 int64_t pos = images.size() / picon->gui->vicon_thread->refresh_rate * frame_rate;
98 file->set_video_position(pos,0);
99 file->read_frame(temp);
100 add_image(temp, ww, hh, BC_RGB8);
102 mwindow->video_cache->check_in(asset);
104 return *images[seq_no];
107 int64_t AssetVIcon::set_seq_no(int64_t no)
109 if( no >= length ) 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;
204 pixmap_h = 50 * BC_WindowBase::get_resources()->icon_scale;
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 = VICON_RATE;
266 int64_t frames = asset->get_video_frames();
267 double secs = frames / framerate;
268 if( secs > 5 ) secs = 5;
269 int64_t length = secs * gui->vicon_thread->refresh_rate;
270 vicon = new AssetVIcon(this, pixmap_w, pixmap_h, framerate, length);
271 gui->vicon_thread->add_vicon(vicon);
272 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
277 gui->lock_window("AssetPicon::create_objects 2");
278 icon = gui->video_icon;
279 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
284 icon = gui->video_icon;
285 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
289 if(asset->audio_data)
291 icon = gui->audio_icon;
292 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND];
294 //printf("AssetPicon::create_objects 2\n");
296 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
299 if(indexable && !indexable->is_asset)
301 icon = gui->video_icon;
302 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
307 //printf("AssetPicon::create_objects 4 %s\n", edl->local_session->clip_title);
308 set_text(strcpy(name, edl->local_session->clip_title));
309 icon = gui->clip_icon;
310 icon_vframe = mwindow->theme->get_image("clip_icon");
315 strcpy(name, _(plugin->title));
317 icon_vframe = plugin->get_picon();
319 icon = gui->create_pixmap(icon_vframe);
320 else if( plugin->audio ) {
321 if( plugin->transition ) {
322 icon = gui->atransition_icon;
323 icon_vframe = gui->atransition_vframe;
325 else if( plugin->is_ffmpeg() ) {
326 icon = gui->ff_aud_icon;
327 icon_vframe = gui->ff_aud_vframe;
329 else if( plugin->is_ladspa() ) {
330 icon = gui->ladspa_icon;
331 icon_vframe = gui->ladspa_vframe;
334 icon = gui->aeffect_icon;
335 icon_vframe = gui->aeffect_vframe;
338 else if( plugin->video ) {
339 if( plugin->transition ) {
340 icon = gui->vtransition_icon;
341 icon_vframe = gui->vtransition_vframe;
343 else if( plugin->is_ffmpeg() ) {
344 icon = gui->ff_vid_icon;
345 icon_vframe = gui->ff_vid_vframe;
348 icon = gui->veffect_icon;
349 icon_vframe = gui->veffect_vframe;
354 icon = gui->file_icon;
355 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN];
358 set_icon_vframe(icon_vframe);
360 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
368 AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow)
369 : BC_Window(PROGRAM_NAME ": Resources",
370 mwindow->session->awindow_x,
371 mwindow->session->awindow_y,
372 mwindow->session->awindow_w,
373 mwindow->session->awindow_h,
380 // printf("AWindowGUI::AWindowGUI %d %d %d %d\n",
381 // mwindow->session->awindow_x,
382 // mwindow->session->awindow_y,
383 // mwindow->session->awindow_w,
384 // mwindow->session->awindow_h);
385 this->mwindow = mwindow;
386 this->awindow = awindow;
392 atransition_icon = 0; atransition_vframe = 0;
393 vtransition_icon = 0; vtransition_vframe = 0;
394 aeffect_icon = 0; aeffect_vframe = 0;
395 ladspa_icon = 0; ladspa_vframe = 0;
396 veffect_icon = 0; veffect_vframe = 0;
397 ff_aud_icon = 0; ff_aud_vframe = 0;
398 ff_vid_icon = 0; ff_vid_vframe = 0;
399 plugin_visibility = ((uint64_t)1<<(8*sizeof(uint64_t)-1))-1;
400 newfolder_thread = 0;
410 AWindowGUI::~AWindowGUI()
412 assets.remove_all_objects();
413 folders.remove_all_objects();
414 aeffects.remove_all_objects();
415 veffects.remove_all_objects();
416 atransitions.remove_all_objects();
417 vtransitions.remove_all_objects();
418 displayed_assets[1].remove_all_objects();
426 delete atransition_icon;
427 delete vtransition_icon;
430 delete ladspa_vframe;
432 delete ff_aud_vframe;
434 delete ff_vid_vframe;
436 delete newfolder_thread;
438 delete assetlist_menu;
439 delete folderlist_menu;
440 if(temp_picon) delete temp_picon;
441 delete remove_plugin;
444 bool AWindowGUI::protected_pixmap(BC_Pixmap *icon)
446 return icon == file_icon ||
447 icon == folder_icon ||
448 icon == audio_icon ||
449 icon == video_icon ||
451 icon == vtransition_icon ||
452 icon == atransition_icon ||
453 icon == veffect_icon ||
454 icon == aeffect_icon ||
455 icon == ladspa_icon ||
456 icon == ff_aud_icon ||
460 void AWindowGUI::create_objects()
464 lock_window("AWindowGUI::create_objects");
466 //printf("AWindowGUI::create_objects 1\n");
467 asset_titles[0] = _("Title");
468 asset_titles[1] = _("Comments");
472 set_icon(mwindow->theme->get_image("awindow_icon"));
473 file_icon = new BC_Pixmap(this,
474 BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN],
477 folder_icon = new BC_Pixmap(this,
478 BC_WindowBase::get_resources()->type_to_icon[ICON_FOLDER],
481 audio_icon = new BC_Pixmap(this,
482 BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND],
485 video_icon = new BC_Pixmap(this,
486 BC_WindowBase::get_resources()->type_to_icon[ICON_FILM],
491 clip_vframe = mwindow->theme->get_image("clip_icon");
492 clip_icon = new BC_Pixmap(this, clip_vframe, PIXMAP_ALPHA);
493 atransition_vframe = mwindow->theme->get_image("atransition_icon");
494 atransition_icon = new BC_Pixmap(this, atransition_vframe, PIXMAP_ALPHA);
495 vtransition_vframe = mwindow->theme->get_image("vtransition_icon");
496 vtransition_icon = new BC_Pixmap(this, vtransition_vframe, PIXMAP_ALPHA);
497 aeffect_vframe = mwindow->theme->get_image("aeffect_icon");
498 aeffect_icon = new BC_Pixmap(this, aeffect_vframe, PIXMAP_ALPHA);
499 ladspa_vframe = new VFramePng(lad_picon_png);
500 ladspa_icon = new BC_Pixmap(this, ladspa_vframe, PIXMAP_ALPHA);
501 ff_aud_vframe = new VFramePng(ff_audio_png);
502 ff_aud_icon = new BC_Pixmap(this, ff_aud_vframe, PIXMAP_ALPHA);
503 ff_vid_vframe = new VFramePng(ff_video_png);
504 ff_vid_icon = new BC_Pixmap(this, ff_vid_vframe, PIXMAP_ALPHA);
505 veffect_vframe = mwindow->theme->get_image("veffect_icon");
506 veffect_icon = new BC_Pixmap(this, veffect_vframe, PIXMAP_ALPHA);
511 folders.append(picon = new AssetPicon(mwindow,
514 picon->persistent = 1;
515 folders.append(picon = new AssetPicon(mwindow,
518 picon->persistent = 1;
519 folders.append(picon = new AssetPicon(mwindow,
521 ATRANSITION_FOLDER));
522 picon->persistent = 1;
523 folders.append(picon = new AssetPicon(mwindow,
525 VTRANSITION_FOLDER));
526 picon->persistent = 1;
529 mwindow->theme->get_awindow_sizes(this);
530 load_defaults(mwindow->defaults);
533 add_subwindow(asset_list = new AWindowAssets(mwindow,
535 mwindow->theme->alist_x,
536 mwindow->theme->alist_y,
537 mwindow->theme->alist_w,
538 mwindow->theme->alist_h));
540 vicon_thread = new VIconThread(asset_list);
541 vicon_thread->start();
544 add_subwindow(divider = new AWindowDivider(mwindow,
546 mwindow->theme->adivider_x,
547 mwindow->theme->adivider_y,
548 mwindow->theme->adivider_w,
549 mwindow->theme->adivider_h));
552 divider->set_cursor(HSEPARATE_CURSOR, 0, 0);
555 int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y;
556 int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h;
557 VFrame **images = mwindow->theme->get_image_set("playpatch_data");
558 AVIconDrawing::calculate_geometry(this, images, &avicon_w, &avicon_h);
559 add_subwindow(avicon_drawing = new AVIconDrawing(this, fw-avicon_w, fy, images));
560 add_subwindow(add_tools = new AddTools(mwindow, this, fx, fy, "Visibility"));
561 add_tools->create_objects();
562 fy += add_tools->get_h(); fh -= add_tools->get_h();
564 add_subwindow(folder_list = new AWindowFolders(mwindow,
565 this, fx, fy, fw, fh));
570 //int x = mwindow->theme->abuttons_x;
571 //int y = mwindow->theme->abuttons_y;
575 newfolder_thread = new NewFolderThread(mwindow, this);
577 add_subwindow(asset_menu = new AssetPopup(mwindow, this));
578 asset_menu->create_objects();
582 add_subwindow(assetlist_menu = new AssetListMenu(mwindow, this));
585 assetlist_menu->create_objects();
589 add_subwindow(folderlist_menu = new FolderListMenu(mwindow, this));
590 folderlist_menu->create_objects();
591 //printf("AWindowGUI::create_objects 2\n");
597 int AWindowGUI::resize_event(int w, int h)
599 mwindow->session->awindow_x = get_x();
600 mwindow->session->awindow_y = get_y();
601 mwindow->session->awindow_w = w;
602 mwindow->session->awindow_h = h;
604 mwindow->theme->get_awindow_sizes(this);
605 mwindow->theme->draw_awindow_bg(this);
606 reposition_objects();
608 // int x = mwindow->theme->abuttons_x;
609 // int y = mwindow->theme->abuttons_y;
610 // new_bin->reposition_window(x, y);
611 // x += new_bin->get_w();
612 // delete_bin->reposition_window(x, y);
613 // x += delete_bin->get_w();
614 // rename_bin->reposition_window(x, y);
615 // x += rename_bin->get_w();
616 // delete_disk->reposition_window(x, y);
617 // x += delete_disk->get_w();
618 // delete_project->reposition_window(x, y);
619 // x += delete_project->get_w();
620 // info->reposition_window(x, y);
621 // x += info->get_w();
622 // redraw_index->reposition_window(x, y);
623 // x += redraw_index->get_w();
624 // paste->reposition_window(x, y);
625 // x += paste->get_w();
626 // append->reposition_window(x, y);
627 // x += append->get_w();
628 // view->reposition_window(x, y);
630 BC_WindowBase::resize_event(w, h);
634 int AWindowGUI::translation_event()
636 mwindow->session->awindow_x = get_x();
637 mwindow->session->awindow_y = get_y();
641 void AWindowGUI::reposition_objects()
643 mwindow->theme->get_awindow_sizes(this);
644 asset_list->reposition_window(
645 mwindow->theme->alist_x, mwindow->theme->alist_y,
646 mwindow->theme->alist_w, mwindow->theme->alist_h);
647 divider->reposition_window(
648 mwindow->theme->adivider_x, mwindow->theme->adivider_y,
649 mwindow->theme->adivider_w, mwindow->theme->adivider_h);
650 int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y;
651 int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h;
652 add_tools->resize_event(fw-avicon_w, add_tools->get_h());
653 avicon_drawing->reposition_window(fw-avicon_w, fy);
654 fy += add_tools->get_h(); fh -= add_tools->get_h();
655 folder_list->reposition_window(fx, fy, fw, fh);
658 int AWindowGUI::save_defaults(BC_Hash *defaults)
660 defaults->update("PLUGIN_VISIBILTY", plugin_visibility);
661 defaults->update("VICON_DRAWING", vicon_drawing);
665 int AWindowGUI::load_defaults(BC_Hash *defaults)
667 plugin_visibility = defaults->get("PLUGIN_VISIBILTY", plugin_visibility);
668 vicon_drawing = defaults->get("VICON_DRAWING", vicon_drawing);
673 int AWindowGUI::close_event()
676 mwindow->session->show_awindow = 0;
679 mwindow->gui->lock_window("AWindowGUI::close_event");
680 mwindow->gui->mainmenu->show_awindow->set_checked(0);
681 mwindow->gui->unlock_window();
683 lock_window("AWindowGUI::close_event");
684 save_defaults(mwindow->defaults);
685 mwindow->save_defaults();
689 void AWindowGUI::start_vicon_drawing()
691 if( !vicon_drawing ) return;
692 if( strcmp(mwindow->edl->session->current_folder, MEDIA_FOLDER) ) return;
693 if( mwindow->edl->session->assetlist_format != ASSETS_ICONS ) return;
694 vicon_thread->start_drawing();
697 void AWindowGUI::stop_vicon_drawing()
699 vicon_thread->stop_drawing();
702 AWindowRemovePluginGUI::
703 AWindowRemovePluginGUI(AWindow *awindow, AWindowRemovePlugin *thread,
704 int x, int y, PluginServer *plugin)
705 : BC_Window(PROGRAM_NAME ": Remove plugin", x,y, 500,200, 50, 50, 1, 0, 1, -1, "", 1)
707 this->awindow = awindow;
708 this->thread = thread;
709 this->plugin = plugin;
710 VFrame *vframe = plugin->get_picon();
711 icon = vframe ? create_pixmap(vframe) : 0;
712 plugin_list.append(new BC_ListBoxItem(plugin->title, icon));
715 AWindowRemovePluginGUI::
716 ~AWindowRemovePluginGUI()
718 if( !awindow->gui->protected_pixmap(icon) )
720 plugin_list.remove_all();
723 void AWindowRemovePluginGUI::create_objects()
725 BC_Button *ok_button = new BC_OKButton(this);
726 add_subwindow(ok_button);
727 BC_Button *cancel_button = new BC_CancelButton(this);
728 add_subwindow(cancel_button);
730 BC_Title *title = new BC_Title(x, y, _("remove plugin?"));
731 add_subwindow(title);
732 y += title->get_h() + 5;
733 list = new BC_ListBox(x, y,
734 get_w() - 20, ok_button->get_y() - y - 5, LISTBOX_TEXT, &plugin_list,
735 0, 0, 1, 0, 0, LISTBOX_SINGLE, ICON_LEFT, 0);
740 int AWindowRemovePlugin::remove_plugin(PluginServer *plugin, ArrayList<BC_ListBoxItem*> &folder)
743 for( int i=0; i<folder.size(); ) {
744 AssetPicon *picon = (AssetPicon *)folder[i];
745 if( picon->plugin == plugin ) {
746 folder.remove_object_number(i);
755 void AWindowRemovePlugin::handle_close_event(int result)
758 printf("remove %s\n", plugin->path);
759 ArrayList<BC_ListBoxItem*> *folder =
760 plugin->audio ? plugin->transition ?
761 &awindow->gui->atransitions :
762 &awindow->gui->aeffects :
763 plugin->video ? plugin->transition ?
764 &awindow->gui->vtransitions :
765 &awindow->gui->veffects :
767 if( folder ) remove_plugin(plugin, *folder);
768 awindow->gui->update_assets();
769 char plugin_path[BCTEXTLEN];
770 strcpy(plugin_path, plugin->path);
771 MWindow *mwindow = awindow->mwindow;
772 mwindow->plugindb->remove(plugin);
773 delete plugin; plugin = 0;
775 char index_path[BCTEXTLEN];
776 sprintf(index_path, "%s/%s", mwindow->preferences->plugin_dir, PLUGIN_FILE);
778 char png_path[BCTEXTLEN];
779 if( plugin->get_theme_png_path(png_path, mwindow->preferences->theme) )
781 if( plugin->get_theme_png_path(png_path, "picon") )
786 AWindowRemovePlugin::
787 AWindowRemovePlugin(AWindow *awindow, PluginServer *plugin)
790 this->awindow = awindow;
791 this->plugin = plugin;
794 AWindowRemovePlugin::
795 ~AWindowRemovePlugin()
800 BC_Window* AWindowRemovePlugin::new_gui()
802 int x = awindow->gui->get_abs_cursor_x(0);
803 int y = awindow->gui->get_abs_cursor_y(0);
804 AWindowRemovePluginGUI *gui = new AWindowRemovePluginGUI(awindow, this, x, y, plugin);
805 gui->create_objects();
809 int AWindowGUI::keypress_event()
811 switch(get_keypress()) {
820 PluginServer* plugin = selected_plugin();
822 remove_plugin = new AWindowRemovePlugin(awindow, plugin);
824 remove_plugin->start();
831 void AWindowGUI::update_folder_list()
833 stop_vicon_drawing();
834 //printf("AWindowGUI::update_folder_list 1\n");
835 for(int i = 0; i < folders.total; i++)
837 AssetPicon *picon = (AssetPicon*)folders.values[i];
840 //printf("AWindowGUI::update_folder_list 1\n");
842 // Search assets for folders
843 for(int i = 0; i < mwindow->edl->folders.total; i++)
845 char *folder = mwindow->edl->folders.values[i];
847 //printf("AWindowGUI::update_folder_list 1.1\n");
849 for(int j = 0; j < folders.total; j++)
851 AssetPicon *picon = (AssetPicon*)folders.values[j];
852 if(!strcasecmp(picon->get_text(), folder))
862 AssetPicon *picon = new AssetPicon(mwindow, this, folder);
863 picon->create_objects();
864 folders.append(picon);
866 //printf("AWindowGUI::update_folder_list 1.3\n");
868 //printf("AWindowGUI::update_folder_list 1\n");
869 //for(int i = 0; i < folders.total; i++)
870 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
873 for(int i = folders.total - 1; i >= 0; i--)
875 AssetPicon *picon = (AssetPicon*)folders.values[i];
876 if(!picon->in_use && !picon->persistent)
879 folders.remove_number(i);
882 //for(int i = 0; i < folders.total; i++)
883 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
884 //printf("AWindowGUI::update_folder_list 2\n");
885 start_vicon_drawing();
888 void AWindowGUI::create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
889 int do_audio, int do_video, int is_realtime, int is_transition)
891 ArrayList<PluginServer*> plugin_list;
892 // Get pointers to plugindb entries
893 mwindow->search_plugindb(do_audio, do_video, is_realtime, is_transition,
896 for(int i = 0; i < plugin_list.total; i++) {
897 PluginServer *server = plugin_list.values[i];
898 int visible = plugin_visibility & (1<<server->dir_idx);
899 if(!visible) continue;
900 // Create new listitem
901 AssetPicon *picon = new AssetPicon(mwindow, this, server);
902 picon->create_objects();
903 output->append(picon);
907 void AWindowGUI::update_asset_list()
909 //printf("AWindowGUI::update_asset_list 1\n");
910 for(int i = 0; i < assets.total; i++)
912 AssetPicon *picon = (AssetPicon*)assets.values[i];
920 //printf("AWindowGUI::update_asset_list 2\n");
923 // Synchronize EDL clips
924 for(int i = 0; i < mwindow->edl->clips.total; i++)
928 // Look for clip in existing listitems
929 for(int j = 0; j < assets.total && !exists; j++)
931 AssetPicon *picon = (AssetPicon*)assets.values[j];
933 if(picon->id == mwindow->edl->clips.values[i]->id)
935 picon->edl = mwindow->edl->clips.values[i];
936 picon->set_text(mwindow->edl->clips.values[i]->local_session->clip_title);
942 // Create new listitem
945 AssetPicon *picon = new AssetPicon(mwindow,
947 mwindow->edl->clips.values[i]);
948 picon->create_objects();
949 assets.append(picon);
957 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
960 // Synchronize EDL assets
961 for(Asset *current = mwindow->edl->assets->first;
967 // Look for asset in existing listitems
968 for(int j = 0; j < assets.total && !exists; j++)
970 AssetPicon *picon = (AssetPicon*)assets.values[j];
972 if(picon->id == current->id)
974 picon->indexable = current;
981 // Create new listitem
984 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
985 AssetPicon *picon = new AssetPicon(mwindow, this, current);
986 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
987 picon->create_objects();
988 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
989 assets.append(picon);
995 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
998 // Synchronize nested EDLs
999 for(int i = 0; i < mwindow->edl->nested_edls->size(); i++)
1002 Indexable *indexable = mwindow->edl->nested_edls->get(i);
1004 // Look for asset in existing listitems
1005 for(int j = 0; j < assets.total && !exists; j++)
1007 AssetPicon *picon = (AssetPicon*)assets.values[j];
1009 if(picon->id == indexable->id)
1011 picon->indexable = indexable;
1018 // Create new listitem
1021 AssetPicon *picon = new AssetPicon(mwindow,
1024 picon->create_objects();
1025 assets.append(picon);
1037 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1038 for(int i = assets.size() - 1; i >= 0; i--)
1040 AssetPicon *picon = (AssetPicon*)assets.get(i);
1041 //printf("AWindowGUI::update_asset_list %s %d\n", picon->asset->path, picon->in_use);
1045 assets.remove_number(i);
1048 //printf("AWindowGUI::update_asset_list 7 %d\n", assets.total);
1055 void AWindowGUI::sort_assets()
1057 //printf("AWindowGUI::sort_assets 1 %s\n", mwindow->edl->session->current_folder);
1058 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1059 sort_picons(&aeffects,
1062 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1063 sort_picons(&veffects,
1066 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1067 sort_picons(&atransitions,
1070 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1071 sort_picons(&vtransitions,
1074 sort_picons(&assets,
1075 mwindow->edl->session->current_folder);
1090 void AWindowGUI::collect_assets()
1093 mwindow->session->drag_assets->remove_all();
1094 mwindow->session->drag_clips->remove_all();
1097 AssetPicon *result = (AssetPicon*)asset_list->get_selection(0, i++);
1100 if(result->indexable) mwindow->session->drag_assets->append(result->indexable);
1101 if(result->edl) mwindow->session->drag_clips->append(result->edl);
1105 void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst,
1106 ArrayList<BC_ListBoxItem*> *src,
1109 // Remove current pointers
1110 dst[0].remove_all();
1111 dst[1].remove_all_objects();
1113 // Create new pointers
1114 //if(folder) printf("AWindowGUI::copy_picons 1 %s\n", folder);
1115 for(int i = 0; i < src->total; i++)
1117 AssetPicon *picon = (AssetPicon*)src->values[i];
1118 //printf("AWindowGUI::copy_picons 2 %s\n", picon->asset->folder);
1120 (folder && picon->indexable && !strcasecmp(picon->indexable->folder, folder)) ||
1121 (folder && picon->edl && !strcasecmp(picon->edl->local_session->folder, folder)))
1123 BC_ListBoxItem *item2, *item1;
1124 dst[0].append(item1 = picon);
1126 dst[1].append(item2 = new BC_ListBoxItem(picon->edl->local_session->clip_notes));
1128 dst[1].append(item2 = new BC_ListBoxItem(""));
1129 item1->set_autoplace_text(1);
1130 item2->set_autoplace_text(1);
1131 //printf("AWindowGUI::copy_picons 3 %s\n", picon->get_text());
1136 void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src,
1139 //printf("AWindowGUI::sort_picons 1\n")
1144 for(int i = 0; i < src->total - 1; i++)
1146 BC_ListBoxItem *item1 = src->values[i];
1147 BC_ListBoxItem *item2 = src->values[i + 1];
1148 item1->set_autoplace_icon(1);
1149 item2->set_autoplace_icon(1);
1150 item1->set_autoplace_text(1);
1151 item2->set_autoplace_text(1);
1152 if(strcmp(item1->get_text(), item2->get_text()) > 0)
1154 src->values[i + 1] = item1;
1155 src->values[i] = item2;
1163 void AWindowGUI::filter_displayed_assets()
1165 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1166 copy_picons(displayed_assets,
1170 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1171 copy_picons(displayed_assets,
1175 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1176 copy_picons(displayed_assets,
1180 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1181 copy_picons(displayed_assets,
1185 copy_picons(displayed_assets,
1187 mwindow->edl->session->current_folder);
1191 void AWindowGUI::update_assets()
1193 //printf("AWindowGUI::update_assets 1\n");
1194 update_folder_list();
1195 //printf("AWindowGUI::update_assets 2\n");
1196 update_asset_list();
1197 //printf("AWindowGUI::update_assets 3\n");
1198 filter_displayed_assets();
1200 //for(int i = 0; i < folders.total; i++)
1201 //printf("AWindowGUI::update_assets 4\n");
1202 // printf("AWindowGUI::update_assets %s\n", folders.values[i]->get_text());
1203 if(mwindow->edl->session->folderlist_format != folder_list->get_format())
1204 folder_list->update_format(mwindow->edl->session->folderlist_format, 0);
1205 folder_list->update(&folders,
1209 folder_list->get_xposition(),
1210 folder_list->get_yposition(),
1212 //printf("AWindowGUI::update_assets 5\n");
1214 if(mwindow->edl->session->assetlist_format != asset_list->get_format())
1215 asset_list->update_format(mwindow->edl->session->assetlist_format, 0);
1218 //printf("AWindowGUI::update_assets 6 %d\n", displayed_assets[0].total);
1219 asset_list->update(displayed_assets,
1221 mwindow->edl->session->asset_columns,
1223 asset_list->get_xposition(),
1224 asset_list->get_yposition(),
1227 //printf("AWindowGUI::update_assets 7\n");
1230 //printf("AWindowGUI::update_assets 8\n");
1234 void AWindowGUI::update_effects()
1236 aeffects.remove_all_objects();
1237 create_persistent_folder(&aeffects, 1, 0, 1, 0);
1238 veffects.remove_all_objects();
1239 create_persistent_folder(&veffects, 0, 1, 1, 0);
1240 atransitions.remove_all_objects();
1241 create_persistent_folder(&atransitions, 1, 0, 0, 1);
1242 vtransitions.remove_all_objects();
1243 create_persistent_folder(&vtransitions, 0, 1, 0, 1);
1246 int AWindowGUI::current_folder_number()
1249 for(int i = 0; i < folders.total; i++)
1251 if(!strcasecmp(folders.values[i]->get_text(), mwindow->edl->session->current_folder))
1260 int AWindowGUI::drag_motion()
1262 if(get_hidden()) return 0;
1268 int AWindowGUI::drag_stop()
1270 if(get_hidden()) return 0;
1275 Indexable* AWindowGUI::selected_asset()
1277 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1278 return picon ? picon->indexable : 0;
1281 PluginServer* AWindowGUI::selected_plugin()
1283 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1284 return picon ? picon->plugin : 0;
1287 AssetPicon* AWindowGUI::selected_folder()
1289 AssetPicon *picon = (AssetPicon*)folder_list->get_selection(0, 0);
1300 AWindowDivider::AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1301 : BC_SubWindow(x, y, w, h)
1303 this->mwindow = mwindow;
1306 AWindowDivider::~AWindowDivider()
1310 int AWindowDivider::button_press_event()
1312 if(is_event_win() && cursor_inside())
1314 mwindow->session->current_operation = DRAG_PARTITION;
1320 int AWindowDivider::cursor_motion_event()
1322 if(mwindow->session->current_operation == DRAG_PARTITION)
1324 mwindow->session->afolders_w = gui->get_relative_cursor_x();
1325 gui->reposition_objects();
1331 int AWindowDivider::button_release_event()
1333 if(mwindow->session->current_operation == DRAG_PARTITION)
1335 mwindow->session->current_operation = NO_OPERATION;
1346 AWindowFolders::AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1351 mwindow->edl->session->folderlist_format == FOLDERS_ICONS ?
1352 LISTBOX_ICONS : LISTBOX_TEXT,
1353 &gui->folders, // Each column has an ArrayList of BC_ListBoxItems.
1354 0, // Titles for columns. Set to 0 for no titles
1355 0, // width of each column
1356 1, // Total columns.
1357 0, // Pixel of top of window.
1358 0, // If this listbox is a popup window
1359 LISTBOX_SINGLE, // Select one item or multiple items
1360 ICON_TOP, // Position of icon relative to text of each item
1363 this->mwindow = mwindow;
1368 AWindowFolders::~AWindowFolders()
1372 int AWindowFolders::selection_changed()
1374 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1377 gui->stop_vicon_drawing();
1379 if(get_button_down() && get_buttonpress() == 3)
1381 gui->folderlist_menu->update_titles();
1382 gui->folderlist_menu->activate_menu();
1385 strcpy(mwindow->edl->session->current_folder, picon->get_text());
1386 //printf("AWindowFolders::selection_changed 1\n");
1387 gui->asset_list->draw_background();
1388 gui->update_assets();
1390 gui->start_vicon_drawing();
1395 int AWindowFolders::button_press_event()
1399 result = BC_ListBox::button_press_event();
1403 if(get_buttonpress() == 3 && is_event_win() && cursor_inside())
1405 gui->folderlist_menu->update_titles();
1406 gui->folderlist_menu->activate_menu();
1421 AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1426 mwindow->edl->session->assetlist_format == ASSETS_ICONS ?
1427 LISTBOX_ICONS : LISTBOX_TEXT,
1428 &gui->assets, // Each column has an ArrayList of BC_ListBoxItems.
1429 gui->asset_titles, // Titles for columns. Set to 0 for no titles
1430 mwindow->edl->session->asset_columns, // width of each column
1431 1, // Total columns.
1432 0, // Pixel of top of window.
1433 0, // If this listbox is a popup window
1434 LISTBOX_MULTIPLE, // Select one item or multiple items
1435 ICON_TOP, // Position of icon relative to text of each item
1438 this->mwindow = mwindow;
1443 AWindowAssets::~AWindowAssets()
1447 int AWindowAssets::button_press_event()
1451 result = BC_ListBox::button_press_event();
1453 if(!result && get_buttonpress() == 3 && is_event_win() && cursor_inside())
1455 BC_ListBox::deactivate_selection();
1456 gui->assetlist_menu->update_titles();
1457 gui->assetlist_menu->activate_menu();
1466 int AWindowAssets::handle_event()
1468 //printf("AWindowAssets::handle_event 1 %d %d\n", get_buttonpress(), get_selection(0, 0));
1469 if(get_selection(0, 0))
1471 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1475 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1479 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1483 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1487 if(mwindow->vwindows.size())
1489 //printf("AWindowAssets::handle_event 2 %d %d\n", get_buttonpress(), get_selection(0, 0));
1490 mwindow->vwindows.get(DEFAULT_VWINDOW)->gui->lock_window("AWindowAssets::handle_event");
1492 if(((AssetPicon*)get_selection(0, 0))->indexable)
1493 mwindow->vwindows.get(DEFAULT_VWINDOW)->change_source(((AssetPicon*)get_selection(0, 0))->indexable);
1495 if(((AssetPicon*)get_selection(0, 0))->edl)
1496 mwindow->vwindows.get(DEFAULT_VWINDOW)->change_source(((AssetPicon*)get_selection(0, 0))->edl);
1498 mwindow->vwindows.get(DEFAULT_VWINDOW)->gui->unlock_window();
1506 int AWindowAssets::selection_changed()
1508 // Show popup window
1509 if(get_button_down() && get_buttonpress() == 3 && get_selection(0, 0))
1511 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER) ||
1512 !strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER) ||
1513 !strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER) ||
1514 !strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1516 gui->assetlist_menu->update_titles();
1517 gui->assetlist_menu->activate_menu();
1521 if(((AssetPicon*)get_selection(0, 0))->indexable)
1522 gui->asset_menu->update();
1524 if(((AssetPicon*)get_selection(0, 0))->edl)
1525 gui->asset_menu->update();
1529 gui->asset_menu->activate_menu();
1532 BC_ListBox::deactivate_selection();
1535 else if( get_button_down() && get_buttonpress() == 1 && get_selection(0, 0) ) {
1537 if( !gui->vicon_thread->viewing ) {
1538 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1539 vicon = picon->vicon;
1541 gui->vicon_thread->set_view_popup(vicon);
1547 void AWindowAssets::draw_background()
1549 clear_box(0,0,get_w(),get_h(),get_bg_surface());
1551 set_font(LARGEFONT);
1553 get_text_width(LARGEFONT, mwindow->edl->session->current_folder) - 4,
1555 mwindow->edl->session->current_folder,
1560 int AWindowAssets::drag_start_event()
1562 int collect_pluginservers = 0;
1563 int collect_assets = 0;
1565 if(BC_ListBox::drag_start_event())
1567 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1569 mwindow->session->current_operation = DRAG_AEFFECT;
1570 collect_pluginservers = 1;
1573 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1575 mwindow->session->current_operation = DRAG_VEFFECT;
1576 collect_pluginservers = 1;
1579 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1581 mwindow->session->current_operation = DRAG_ATRANSITION;
1582 collect_pluginservers = 1;
1585 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1587 mwindow->session->current_operation = DRAG_VTRANSITION;
1588 collect_pluginservers = 1;
1592 mwindow->session->current_operation = DRAG_ASSET;
1597 if(collect_pluginservers)
1600 mwindow->session->drag_pluginservers->remove_all();
1603 AssetPicon *result = (AssetPicon*)get_selection(0, i++);
1606 mwindow->session->drag_pluginservers->append(result->plugin);
1612 gui->collect_assets();
1620 int AWindowAssets::drag_motion_event()
1622 BC_ListBox::drag_motion_event();
1625 mwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1626 mwindow->gui->drag_motion();
1627 mwindow->gui->unlock_window();
1629 for(int i = 0; i < mwindow->vwindows.size(); i++)
1631 VWindow *vwindow = mwindow->vwindows.get(i);
1632 vwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1633 vwindow->gui->drag_motion();
1634 vwindow->gui->unlock_window();
1637 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1638 mwindow->cwindow->gui->drag_motion();
1639 mwindow->cwindow->gui->unlock_window();
1641 lock_window("AWindowAssets::drag_motion_event");
1645 int AWindowAssets::drag_stop_event()
1649 result = gui->drag_stop();
1655 mwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1656 result = mwindow->gui->drag_stop();
1657 mwindow->gui->unlock_window();
1662 for(int i = 0; i < mwindow->vwindows.size(); i++)
1664 VWindow *vwindow = mwindow->vwindows.get(i);
1665 vwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1666 result = vwindow->gui->drag_stop();
1667 vwindow->gui->unlock_window();
1673 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1674 result = mwindow->cwindow->gui->drag_stop();
1675 mwindow->cwindow->gui->unlock_window();
1678 lock_window("AWindowAssets::drag_stop_event");
1680 if(result) get_drag_popup()->set_animation(0);
1682 BC_ListBox::drag_stop_event();
1683 mwindow->session->current_operation = ::NO_OPERATION; // since NO_OPERATION is also defined in listbox, we have to reach for global scope...
1687 int AWindowAssets::column_resize_event()
1689 mwindow->edl->session->asset_columns[0] = get_column_width(0);
1690 mwindow->edl->session->asset_columns[1] = get_column_width(1);
1694 int AWindowAssets::cursor_enter_event()
1696 int ret = BC_ListBox::cursor_enter_event();
1697 gui->start_vicon_drawing();
1701 int AWindowAssets::cursor_leave_event()
1703 gui->stop_vicon_drawing();
1704 return BC_ListBox::cursor_leave_event();
1718 AWindowNewFolder::AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1719 : BC_Button(x, y, mwindow->theme->newbin_data)
1721 this->mwindow = mwindow;
1723 set_tooltip(_("New bin"));
1726 int AWindowNewFolder::handle_event()
1728 gui->newfolder_thread->start_new_folder();
1732 AWindowDeleteFolder::AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1733 : BC_Button(x, y, mwindow->theme->deletebin_data)
1735 this->mwindow = mwindow;
1737 set_tooltip(_("Delete bin"));
1740 int AWindowDeleteFolder::handle_event()
1742 if(gui->folder_list->get_selection(0, 0))
1744 BC_ListBoxItem *folder = gui->folder_list->get_selection(0, 0);
1745 mwindow->delete_folder(folder->get_text());
1750 AWindowRenameFolder::AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1751 : BC_Button(x, y, mwindow->theme->renamebin_data)
1753 this->mwindow = mwindow;
1755 set_tooltip(_("Rename bin"));
1758 int AWindowRenameFolder::handle_event()
1763 AWindowDeleteDisk::AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1764 : BC_Button(x, y, mwindow->theme->deletedisk_data)
1766 this->mwindow = mwindow;
1768 set_tooltip(_("Delete asset from disk"));
1771 int AWindowDeleteDisk::handle_event()
1776 AWindowDeleteProject::AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1777 : BC_Button(x, y, mwindow->theme->deleteproject_data)
1779 this->mwindow = mwindow;
1781 set_tooltip(_("Delete asset from project"));
1784 int AWindowDeleteProject::handle_event()
1789 AWindowInfo::AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1790 : BC_Button(x, y, mwindow->theme->infoasset_data)
1792 this->mwindow = mwindow;
1794 set_tooltip(_("Edit information on asset"));
1797 int AWindowInfo::handle_event()
1799 gui->awindow->asset_edit->edit_asset(gui->selected_asset());
1803 AWindowRedrawIndex::AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1804 : BC_Button(x, y, mwindow->theme->redrawindex_data)
1806 this->mwindow = mwindow;
1808 set_tooltip(_("Redraw index"));
1811 int AWindowRedrawIndex::handle_event()
1816 AWindowPaste::AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1817 : BC_Button(x, y, mwindow->theme->pasteasset_data)
1819 this->mwindow = mwindow;
1821 set_tooltip(_("Paste asset on recordable tracks"));
1824 int AWindowPaste::handle_event()
1829 AWindowAppend::AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1830 : BC_Button(x, y, mwindow->theme->appendasset_data)
1832 this->mwindow = mwindow;
1834 set_tooltip(_("Append asset in new tracks"));
1837 int AWindowAppend::handle_event()
1842 AWindowView::AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1843 : BC_Button(x, y, mwindow->theme->viewasset_data)
1845 this->mwindow = mwindow;
1847 set_tooltip(_("View asset"));
1850 int AWindowView::handle_event()
1855 AddTools::AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, const char *title)
1856 : BC_PopupMenu(x, y, BC_Title::calculate_w(gui, title, MEDIUMFONT)+8, title, -1, 0, 4)
1858 this->mwindow = mwindow;
1862 void AddTools::create_objects()
1865 add_item(new AddPluginItem(this, "ladspa", PLUGIN_LADSPA_ID));
1866 vis |= 1 << PLUGIN_LADSPA_ID;
1867 add_item(new AddPluginItem(this, "ffmpeg", PLUGIN_FFMPEG_ID));
1868 vis |= 1 << PLUGIN_FFMPEG_ID;
1869 for( int i=0; i<MWindow::plugindb->size(); ++i ) {
1870 PluginServer *plugin = MWindow::plugindb->get(i);
1871 if( !plugin->audio && !plugin->video ) continue;
1872 int idx = plugin->dir_idx;
1873 uint32_t msk = 1 << idx;
1874 if( (msk & vis) != 0 ) continue;
1876 char parent[BCTEXTLEN];
1877 strcpy(parent, plugin->path);
1878 char *bp = strrchr(parent, '/');
1879 if( bp ) { *bp = 0; bp = strrchr(parent, '/'); }
1880 if( !bp ) bp = parent; else ++bp;
1881 add_item(new AddPluginItem(this, bp, idx));
1885 AddPluginItem::AddPluginItem(AddTools *menu, char const *text, int idx)
1890 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
1891 int chk = (msk & vis) ? 1 : 0;
1895 int AddPluginItem::handle_event()
1897 int chk = get_checked() ^ 1;
1899 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
1900 menu->gui->plugin_visibility = chk ? vis | msk : vis & ~msk;
1901 menu->gui->update_effects();
1902 menu->gui->update_assets();
1903 menu->gui->save_defaults(menu->mwindow->defaults);
1907 AVIconDrawing::AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images)
1908 : BC_Toggle(x, y, images, agui->vicon_drawing)
1911 set_tooltip(_("draw vicons"));
1914 void AVIconDrawing::calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh)
1916 int text_line = -1, toggle_x = -1, toggle_y = -1;
1917 int text_x = -1, text_y = -1, text_w = -1, text_h = -1;
1918 BC_Toggle::calculate_extents(agui, images, 1,
1919 &text_line, ww, hh, &toggle_x, &toggle_y,
1920 &text_x, &text_y, &text_w, &text_h, "", MEDIUMFONT);
1923 AVIconDrawing::~AVIconDrawing()
1927 int AVIconDrawing::handle_event()
1929 agui->vicon_drawing = get_value();
1930 if( agui->vicon_drawing )
1931 agui->start_vicon_drawing();
1933 agui->stop_vicon_drawing();