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"
45 #include "labeledit.h"
46 #include "localsession.h"
48 #include "mainsession.h"
49 #include "mwindowgui.h"
51 #include "nestededls.h"
52 #include "newfolder.h"
53 #include "preferences.h"
57 #include "vwindowgui.h"
60 #include "data/lad_picon_png.h"
61 #include "data/ff_audio_png.h"
62 #include "data/ff_video_png.h"
69 const char *AWindowGUI::folder_names[] =
73 N_("Audio Transitions"),
74 N_("Video Transitions"),
82 AssetVIcon::AssetVIcon(AssetPicon *picon, int w, int h, double framerate, int64_t length)
83 : VIcon(w, h, framerate)
86 this->length = length;
90 AssetVIcon::~AssetVIcon()
95 VFrame *AssetVIcon::frame()
97 if( seq_no >= images.size() ) {
98 MWindow *mwindow = picon->mwindow;
99 Asset *asset = (Asset *)picon->indexable;
100 File *file = mwindow->video_cache->check_out(asset, mwindow->edl, 1);
101 if( !file ) return 0;
102 if( temp && (temp->get_w() != asset->width || temp->get_h() != asset->height) ) {
103 delete temp; temp = 0;
106 temp = new VFrame(asset->width, asset->height, BC_RGB888);
107 int ww = picon->gui->vicon_thread->view_w;
108 int hh = picon->gui->vicon_thread->view_h;
109 while( seq_no >= images.size() ) {
111 int64_t pos = images.size() / picon->gui->vicon_thread->refresh_rate * frame_rate;
112 file->set_video_position(pos,0);
113 file->read_frame(temp);
114 add_image(temp, ww, hh, BC_RGB8);
116 mwindow->video_cache->check_in(asset);
118 return *images[seq_no];
121 int64_t AssetVIcon::set_seq_no(int64_t no)
123 if( no >= length ) no = 0;
127 int AssetVIcon::get_vx()
129 BC_ListBox *lbox = picon->gui->asset_list;
130 return lbox->get_item_x(picon);
132 int AssetVIcon::get_vy()
134 BC_ListBox *lbox = picon->gui->asset_list;
135 return lbox->get_item_y(picon) + lbox->get_title_h();
138 AssetPicon::AssetPicon(MWindow *mwindow,
140 Indexable *indexable)
144 this->mwindow = mwindow;
146 this->indexable = indexable;
147 indexable->add_user();
148 this->id = indexable->id;
151 AssetPicon::AssetPicon(MWindow *mwindow,
157 this->mwindow = mwindow;
164 AssetPicon::AssetPicon(MWindow *mwindow,
165 AWindowGUI *gui, int folder)
166 : BC_ListBoxItem(_(AWindowGUI::folder_names[folder]), gui->folder_icon)
170 this->mwindow = mwindow;
174 AssetPicon::AssetPicon(MWindow *mwindow,
175 AWindowGUI *gui, const char *folder_name, int folder_num)
176 : BC_ListBoxItem(folder_name, gui->folder_icon)
179 foldernum = folder_num;
180 this->mwindow = mwindow;
184 AssetPicon::AssetPicon(MWindow *mwindow,
186 PluginServer *plugin)
190 this->mwindow = mwindow;
192 this->plugin = plugin;
196 AssetPicon::AssetPicon(MWindow *mwindow,
202 this->mwindow = mwindow;
210 AssetPicon::~AssetPicon()
213 gui->vicon_thread->del_vicon(vicon);
214 if(indexable) indexable->remove_user();
215 if(edl) edl->remove_user();
216 if( icon && !gui->protected_pixmap(icon) ) {
218 if( !plugin ) delete icon_vframe;
222 void AssetPicon::reset()
236 void AssetPicon::create_objects()
239 char name[BCTEXTLEN];
240 int pixmap_w, pixmap_h;
243 pixmap_h = 50 * BC_WindowBase::get_resources()->icon_scale;
245 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
248 fs.extract_name(name, indexable->path);
252 if(indexable && indexable->is_asset)
254 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
255 Asset *asset = (Asset*)indexable;
256 if(asset->video_data)
258 if(mwindow->preferences->use_thumbnails)
260 gui->unlock_window();
261 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
262 File *file = mwindow->video_cache->check_out(asset,
265 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
269 int height = asset->height > 0 ? asset->height : 1;
270 pixmap_w = pixmap_h * asset->width / height;
273 file->set_video_position(0, 0);
275 if(gui->temp_picon &&
276 (gui->temp_picon->get_w() != asset->width ||
277 gui->temp_picon->get_h() != asset->height))
279 delete gui->temp_picon;
285 gui->temp_picon = new VFrame(0, -1,
286 asset->width, asset->height,
290 file->read_frame(gui->temp_picon);
291 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
292 mwindow->video_cache->check_in(asset);
294 gui->lock_window("AssetPicon::create_objects 1");
295 icon = new BC_Pixmap(gui, pixmap_w, pixmap_h);
296 icon->draw_vframe(gui->temp_picon,
297 0, 0, pixmap_w, pixmap_h, 0, 0);
298 //printf("%d %d\n", gui->temp_picon->get_w(), gui->temp_picon->get_h());
299 icon_vframe = new VFrame(0,
300 -1, pixmap_w, pixmap_h, BC_RGB888, -1);
301 icon_vframe->transfer_from(gui->temp_picon);
303 double framerate = asset->get_frame_rate();
304 if( !framerate ) framerate = VICON_RATE;
305 int64_t frames = asset->get_video_frames();
306 double secs = frames / framerate;
307 if( secs > 5 ) secs = 5;
308 int64_t length = secs * gui->vicon_thread->refresh_rate;
309 vicon = new AssetVIcon(this, pixmap_w, pixmap_h, framerate, length);
310 gui->vicon_thread->add_vicon(vicon);
311 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
316 gui->lock_window("AssetPicon::create_objects 2");
317 icon = gui->video_icon;
318 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
323 icon = gui->video_icon;
324 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
328 if(asset->audio_data)
330 icon = gui->audio_icon;
331 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND];
333 //printf("AssetPicon::create_objects 2\n");
335 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
338 if(indexable && !indexable->is_asset)
340 icon = gui->video_icon;
341 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
346 //printf("AssetPicon::create_objects 4 %s\n", edl->local_session->clip_title);
347 set_text(strcpy(name, edl->local_session->clip_title));
348 icon = gui->clip_icon;
349 icon_vframe = mwindow->theme->get_image("clip_icon");
354 strcpy(name, _(plugin->title));
356 icon_vframe = plugin->get_picon();
358 icon = gui->create_pixmap(icon_vframe);
359 else if( plugin->audio ) {
360 if( plugin->transition ) {
361 icon = gui->atransition_icon;
362 icon_vframe = gui->atransition_vframe;
364 else if( plugin->is_ffmpeg() ) {
365 icon = gui->ff_aud_icon;
366 icon_vframe = gui->ff_aud_vframe;
368 else if( plugin->is_ladspa() ) {
369 icon = gui->ladspa_icon;
370 icon_vframe = gui->ladspa_vframe;
373 icon = gui->aeffect_icon;
374 icon_vframe = gui->aeffect_vframe;
377 else if( plugin->video ) {
378 if( plugin->transition ) {
379 icon = gui->vtransition_icon;
380 icon_vframe = gui->vtransition_vframe;
382 else if( plugin->is_ffmpeg() ) {
383 icon = gui->ff_vid_icon;
384 icon_vframe = gui->ff_vid_vframe;
387 icon = gui->veffect_icon;
388 icon_vframe = gui->veffect_vframe;
396 mwindow->edl->session->time_format,
397 mwindow->edl->session->sample_rate,
398 mwindow->edl->session->frame_rate,
399 mwindow->edl->session->frames_per_foot);
401 icon = gui->file_icon;
402 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN];
404 set_icon_vframe(icon_vframe);
407 icon = gui->file_icon;
408 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN];
411 set_icon_vframe(icon_vframe);
413 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
421 AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow)
422 : BC_Window(_(PROGRAM_NAME ": Resources"),
423 mwindow->session->awindow_x, mwindow->session->awindow_y,
424 mwindow->session->awindow_w, mwindow->session->awindow_h,
427 // printf("AWindowGUI::AWindowGUI %d %d %d %d\n",
428 // mwindow->session->awindow_x,
429 // mwindow->session->awindow_y,
430 // mwindow->session->awindow_w,
431 // mwindow->session->awindow_h);
432 this->mwindow = mwindow;
433 this->awindow = awindow;
439 atransition_icon = 0; atransition_vframe = 0;
440 vtransition_icon = 0; vtransition_vframe = 0;
441 aeffect_icon = 0; aeffect_vframe = 0;
442 ladspa_icon = 0; ladspa_vframe = 0;
443 veffect_icon = 0; veffect_vframe = 0;
444 ff_aud_icon = 0; ff_aud_vframe = 0;
445 ff_vid_icon = 0; ff_vid_vframe = 0;
446 plugin_visibility = ((uint64_t)1<<(8*sizeof(uint64_t)-1))-1;
447 newfolder_thread = 0;
452 allow_iconlisting = 1;
458 AWindowGUI::~AWindowGUI()
460 assets.remove_all_objects();
461 folders.remove_all_objects();
462 aeffects.remove_all_objects();
463 veffects.remove_all_objects();
464 atransitions.remove_all_objects();
465 vtransitions.remove_all_objects();
466 labellist.remove_all_objects();
467 displayed_assets[1].remove_all_objects();
475 delete atransition_icon;
476 delete vtransition_icon;
479 delete ladspa_vframe;
481 delete ff_aud_vframe;
483 delete ff_vid_vframe;
485 delete newfolder_thread;
488 delete assetlist_menu;
489 delete folderlist_menu;
490 if(temp_picon) delete temp_picon;
491 delete remove_plugin;
494 bool AWindowGUI::protected_pixmap(BC_Pixmap *icon)
496 return icon == file_icon ||
497 icon == folder_icon ||
498 icon == audio_icon ||
499 icon == video_icon ||
501 icon == vtransition_icon ||
502 icon == atransition_icon ||
503 icon == veffect_icon ||
504 icon == aeffect_icon ||
505 icon == ladspa_icon ||
506 icon == ff_aud_icon ||
510 void AWindowGUI::create_objects()
514 lock_window("AWindowGUI::create_objects");
516 //printf("AWindowGUI::create_objects 1\n");
517 asset_titles[0] = _("Title");
518 asset_titles[1] = _("Comments");
522 set_icon(mwindow->theme->get_image("awindow_icon"));
523 file_icon = new BC_Pixmap(this,
524 BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN],
527 folder_icon = new BC_Pixmap(this,
528 BC_WindowBase::get_resources()->type_to_icon[ICON_FOLDER],
531 audio_icon = new BC_Pixmap(this,
532 BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND],
535 video_icon = new BC_Pixmap(this,
536 BC_WindowBase::get_resources()->type_to_icon[ICON_FILM],
541 clip_vframe = mwindow->theme->get_image("clip_icon");
542 clip_icon = new BC_Pixmap(this, clip_vframe, PIXMAP_ALPHA);
543 atransition_vframe = mwindow->theme->get_image("atransition_icon");
544 atransition_icon = new BC_Pixmap(this, atransition_vframe, PIXMAP_ALPHA);
545 vtransition_vframe = mwindow->theme->get_image("vtransition_icon");
546 vtransition_icon = new BC_Pixmap(this, vtransition_vframe, PIXMAP_ALPHA);
547 aeffect_vframe = mwindow->theme->get_image("aeffect_icon");
548 aeffect_icon = new BC_Pixmap(this, aeffect_vframe, PIXMAP_ALPHA);
549 ladspa_vframe = new VFramePng(lad_picon_png);
550 ladspa_icon = new BC_Pixmap(this, ladspa_vframe, PIXMAP_ALPHA);
551 ff_aud_vframe = new VFramePng(ff_audio_png);
552 ff_aud_icon = new BC_Pixmap(this, ff_aud_vframe, PIXMAP_ALPHA);
553 ff_vid_vframe = new VFramePng(ff_video_png);
554 ff_vid_icon = new BC_Pixmap(this, ff_vid_vframe, PIXMAP_ALPHA);
555 veffect_vframe = mwindow->theme->get_image("veffect_icon");
556 veffect_icon = new BC_Pixmap(this, veffect_vframe, PIXMAP_ALPHA);
561 folders.append(picon = new AssetPicon(mwindow, this, AW_AEFFECT_FOLDER));
562 picon->persistent = 1;
563 folders.append(picon = new AssetPicon(mwindow, this, AW_VEFFECT_FOLDER));
564 picon->persistent = 1;
565 folders.append(picon = new AssetPicon(mwindow, this, AW_ATRANSITION_FOLDER));
566 picon->persistent = 1;
567 folders.append(picon = new AssetPicon(mwindow, this, AW_VTRANSITION_FOLDER));
568 picon->persistent = 1;
569 folders.append(picon = new AssetPicon(mwindow, this, AW_LABEL_FOLDER));
570 picon->persistent = 1;
571 folders.append(picon = new AssetPicon(mwindow, this, AW_CLIP_FOLDER));
572 picon->persistent = 1;
573 folders.append(picon = new AssetPicon(mwindow, this, AW_MEDIA_FOLDER));
574 picon->persistent = 1;
576 create_label_folder();
579 mwindow->theme->get_awindow_sizes(this);
580 load_defaults(mwindow->defaults);
583 add_subwindow(asset_list = new AWindowAssets(mwindow,
585 mwindow->theme->alist_x,
586 mwindow->theme->alist_y,
587 mwindow->theme->alist_w,
588 mwindow->theme->alist_h));
590 vicon_thread = new VIconThread(asset_list);
591 vicon_thread->start();
594 add_subwindow(divider = new AWindowDivider(mwindow,
596 mwindow->theme->adivider_x,
597 mwindow->theme->adivider_y,
598 mwindow->theme->adivider_w,
599 mwindow->theme->adivider_h));
602 divider->set_cursor(HSEPARATE_CURSOR, 0, 0);
605 int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y;
606 int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h;
607 VFrame **images = mwindow->theme->get_image_set("playpatch_data");
608 AVIconDrawing::calculate_geometry(this, images, &avicon_w, &avicon_h);
609 add_subwindow(avicon_drawing = new AVIconDrawing(this, fw-avicon_w, fy, images));
610 add_subwindow(add_tools = new AddTools(mwindow, this, fx, fy, _("Visibility")));
611 add_tools->create_objects();
612 fy += add_tools->get_h(); fh -= add_tools->get_h();
614 add_subwindow(folder_list = new AWindowFolders(mwindow,
615 this, fx, fy, fw, fh));
620 //int x = mwindow->theme->abuttons_x;
621 //int y = mwindow->theme->abuttons_y;
625 newfolder_thread = new NewFolderThread(mwindow, this);
627 add_subwindow(asset_menu = new AssetPopup(mwindow, this));
628 asset_menu->create_objects();
630 add_subwindow(label_menu = new LabelPopup(mwindow, this));
631 label_menu->create_objects();
635 add_subwindow(assetlist_menu = new AssetListMenu(mwindow, this));
638 assetlist_menu->create_objects();
642 add_subwindow(folderlist_menu = new FolderListMenu(mwindow, this));
643 folderlist_menu->create_objects();
644 //printf("AWindowGUI::create_objects 2\n");
647 create_custom_xatoms();
651 int AWindowGUI::resize_event(int w, int h)
653 mwindow->session->awindow_x = get_x();
654 mwindow->session->awindow_y = get_y();
655 mwindow->session->awindow_w = w;
656 mwindow->session->awindow_h = h;
658 mwindow->theme->get_awindow_sizes(this);
659 mwindow->theme->draw_awindow_bg(this);
660 reposition_objects();
662 // int x = mwindow->theme->abuttons_x;
663 // int y = mwindow->theme->abuttons_y;
664 // new_bin->reposition_window(x, y);
665 // x += new_bin->get_w();
666 // delete_bin->reposition_window(x, y);
667 // x += delete_bin->get_w();
668 // rename_bin->reposition_window(x, y);
669 // x += rename_bin->get_w();
670 // delete_disk->reposition_window(x, y);
671 // x += delete_disk->get_w();
672 // delete_project->reposition_window(x, y);
673 // x += delete_project->get_w();
674 // info->reposition_window(x, y);
675 // x += info->get_w();
676 // redraw_index->reposition_window(x, y);
677 // x += redraw_index->get_w();
678 // paste->reposition_window(x, y);
679 // x += paste->get_w();
680 // append->reposition_window(x, y);
681 // x += append->get_w();
682 // view->reposition_window(x, y);
684 BC_WindowBase::resize_event(w, h);
688 int AWindowGUI::translation_event()
690 mwindow->session->awindow_x = get_x();
691 mwindow->session->awindow_y = get_y();
695 void AWindowGUI::reposition_objects()
697 asset_list->reposition_window(
698 mwindow->theme->alist_x, mwindow->theme->alist_y,
699 mwindow->theme->alist_w, mwindow->theme->alist_h);
700 divider->reposition_window(
701 mwindow->theme->adivider_x, mwindow->theme->adivider_y,
702 mwindow->theme->adivider_w, mwindow->theme->adivider_h);
703 int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y;
704 int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h;
705 add_tools->resize_event(fw-avicon_w, add_tools->get_h());
706 avicon_drawing->reposition_window(fw-avicon_w, fy);
707 fy += add_tools->get_h(); fh -= add_tools->get_h();
708 folder_list->reposition_window(fx, fy, fw, fh);
711 int AWindowGUI::save_defaults(BC_Hash *defaults)
713 defaults->update("PLUGIN_VISIBILTY", plugin_visibility);
714 defaults->update("VICON_DRAWING", vicon_drawing);
718 int AWindowGUI::load_defaults(BC_Hash *defaults)
720 plugin_visibility = defaults->get("PLUGIN_VISIBILTY", plugin_visibility);
721 vicon_drawing = defaults->get("VICON_DRAWING", vicon_drawing);
725 int AWindowGUI::close_event()
728 mwindow->session->show_awindow = 0;
731 mwindow->gui->lock_window("AWindowGUI::close_event");
732 mwindow->gui->mainmenu->show_awindow->set_checked(0);
733 mwindow->gui->unlock_window();
735 lock_window("AWindowGUI::close_event");
736 save_defaults(mwindow->defaults);
737 mwindow->save_defaults();
741 void AWindowGUI::start_vicon_drawing()
743 if( !vicon_drawing ) return;
744 if( mwindow->edl->session->awindow_folder != AW_MEDIA_FOLDER ) return;
745 if( mwindow->edl->session->assetlist_format != ASSETS_ICONS ) return;
746 vicon_thread->start_drawing();
749 void AWindowGUI::stop_vicon_drawing()
751 vicon_thread->stop_drawing();
754 AWindowRemovePluginGUI::
755 AWindowRemovePluginGUI(AWindow *awindow, AWindowRemovePlugin *thread,
756 int x, int y, PluginServer *plugin)
757 : BC_Window(_(PROGRAM_NAME ": Remove plugin"), x,y, 500,200, 50, 50, 1, 0, 1, -1, "", 1)
759 this->awindow = awindow;
760 this->thread = thread;
761 this->plugin = plugin;
762 VFrame *vframe = plugin->get_picon();
763 icon = vframe ? create_pixmap(vframe) : 0;
764 plugin_list.append(new BC_ListBoxItem(plugin->title, icon));
767 AWindowRemovePluginGUI::
768 ~AWindowRemovePluginGUI()
770 if( !awindow->gui->protected_pixmap(icon) )
772 plugin_list.remove_all();
775 void AWindowRemovePluginGUI::create_objects()
777 BC_Button *ok_button = new BC_OKButton(this);
778 add_subwindow(ok_button);
779 BC_Button *cancel_button = new BC_CancelButton(this);
780 add_subwindow(cancel_button);
782 BC_Title *title = new BC_Title(x, y, _("remove plugin?"));
783 add_subwindow(title);
784 y += title->get_h() + 5;
785 list = new BC_ListBox(x, y,
786 get_w() - 20, ok_button->get_y() - y - 5, LISTBOX_TEXT, &plugin_list,
787 0, 0, 1, 0, 0, LISTBOX_SINGLE, ICON_LEFT, 0);
792 int AWindowRemovePlugin::remove_plugin(PluginServer *plugin, ArrayList<BC_ListBoxItem*> &folder)
795 for( int i=0; i<folder.size(); ) {
796 AssetPicon *picon = (AssetPicon *)folder[i];
797 if( picon->plugin == plugin ) {
798 folder.remove_object_number(i);
807 void AWindowRemovePlugin::handle_close_event(int result)
810 printf(_("remove %s\n"), plugin->path);
811 ArrayList<BC_ListBoxItem*> *folder =
812 plugin->audio ? plugin->transition ?
813 &awindow->gui->atransitions :
814 &awindow->gui->aeffects :
815 plugin->video ? plugin->transition ?
816 &awindow->gui->vtransitions :
817 &awindow->gui->veffects :
819 if( folder ) remove_plugin(plugin, *folder);
820 char plugin_path[BCTEXTLEN];
821 strcpy(plugin_path, plugin->path);
822 MWindow *mwindow = awindow->mwindow;
823 mwindow->plugindb->remove(plugin);
825 char index_path[BCTEXTLEN];
826 sprintf(index_path, "%s/%s", mwindow->preferences->plugin_dir, PLUGIN_FILE);
828 char png_path[BCTEXTLEN];
829 if( plugin->get_theme_png_path(png_path, mwindow->preferences->theme) )
831 if( plugin->get_theme_png_path(png_path, "picon") )
833 delete plugin; plugin = 0;
834 awindow->gui->async_update_assets();
838 AWindowRemovePlugin::
839 AWindowRemovePlugin(AWindow *awindow, PluginServer *plugin)
842 this->awindow = awindow;
843 this->plugin = plugin;
846 AWindowRemovePlugin::
847 ~AWindowRemovePlugin()
852 BC_Window* AWindowRemovePlugin::new_gui()
854 int x = awindow->gui->get_abs_cursor_x(0);
855 int y = awindow->gui->get_abs_cursor_y(0);
856 AWindowRemovePluginGUI *gui = new AWindowRemovePluginGUI(awindow, this, x, y, plugin);
857 gui->create_objects();
861 int AWindowGUI::keypress_event()
863 switch(get_keypress()) {
872 PluginServer* plugin = selected_plugin();
874 remove_plugin = new AWindowRemovePlugin(awindow, plugin);
876 remove_plugin->start();
885 int AWindowGUI::create_custom_xatoms()
887 UpdateAssetsXAtom = create_xatom("CWINDOWGUI_UPDATE_ASSETS");
890 int AWindowGUI::recieve_custom_xatoms(xatom_event *event)
892 if( event->message_type == UpdateAssetsXAtom ) {
899 void AWindowGUI::async_update_assets()
902 event.message_type = UpdateAssetsXAtom;
903 send_custom_xatom(&event);
912 void AWindowGUI::update_folder_list()
914 stop_vicon_drawing();
915 //printf("AWindowGUI::update_folder_list 1\n");
916 for(int i = 0; i < folders.total; i++)
918 AssetPicon *picon = (AssetPicon*)folders.values[i];
921 //printf("AWindowGUI::update_folder_list 1\n");
923 // Search assets for folders
924 for(int i = 0; i < mwindow->edl->folders.total; i++)
926 const char *folder = mwindow->edl->folders.values[i];
928 //printf("AWindowGUI::update_folder_list 1.1\n");
930 for(int j = 0; j < folders.total; j++)
932 AssetPicon *picon = (AssetPicon*)folders.values[j];
933 if(!strcasecmp(picon->get_text(), folder))
943 int aw_folder = folder_number(folder);
944 AssetPicon *picon = aw_folder >= 0 ?
945 new AssetPicon(mwindow, this, aw_folder) :
946 new AssetPicon(mwindow, this, folder, AW_USER_FOLDER);
947 picon->create_objects();
948 folders.append(picon);
950 //printf("AWindowGUI::update_folder_list 1.3\n");
952 //printf("AWindowGUI::update_folder_list 1\n");
953 //for(int i = 0; i < folders.total; i++)
954 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
957 for(int i = folders.total - 1; i >= 0; i--)
959 AssetPicon *picon = (AssetPicon*)folders.values[i];
960 if(!picon->in_use && !picon->persistent)
963 folders.remove_number(i);
966 //for(int i = 0; i < folders.total; i++)
967 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
968 //printf("AWindowGUI::update_folder_list 2\n");
969 start_vicon_drawing();
972 void AWindowGUI::create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
973 int do_audio, int do_video, int is_realtime, int is_transition)
975 ArrayList<PluginServer*> plugin_list;
976 // Get pointers to plugindb entries
977 mwindow->search_plugindb(do_audio, do_video, is_realtime, is_transition,
980 for(int i = 0; i < plugin_list.total; i++) {
981 PluginServer *server = plugin_list.values[i];
982 int visible = plugin_visibility & (1<<server->dir_idx);
983 if(!visible) continue;
984 // Create new listitem
985 AssetPicon *picon = new AssetPicon(mwindow, this, server);
986 picon->create_objects();
987 output->append(picon);
991 void AWindowGUI::create_label_folder()
994 for(current = mwindow->edl->labels->first; current; current = NEXT) {
995 AssetPicon *picon = new AssetPicon(mwindow, this, current);
996 picon->create_objects();
997 labellist.append(picon);
1002 void AWindowGUI::update_asset_list()
1004 //printf("AWindowGUI::update_asset_list 1\n");
1005 for(int i = 0; i < assets.total; i++)
1007 AssetPicon *picon = (AssetPicon*)assets.values[i];
1015 //printf("AWindowGUI::update_asset_list 2\n");
1018 // Synchronize EDL clips
1019 for(int i = 0; i < mwindow->edl->clips.total; i++)
1023 // Look for clip in existing listitems
1024 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)
1030 picon->edl = mwindow->edl->clips.values[i];
1031 picon->set_text(mwindow->edl->clips.values[i]->local_session->clip_title);
1037 // Create new listitem
1040 AssetPicon *picon = new AssetPicon(mwindow,
1042 mwindow->edl->clips.values[i]);
1043 picon->create_objects();
1044 assets.append(picon);
1052 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1055 // Synchronize EDL assets
1056 for(Asset *current = mwindow->edl->assets->first;
1062 // Look for asset in existing listitems
1063 for(int j = 0; j < assets.total && !exists; j++)
1065 AssetPicon *picon = (AssetPicon*)assets.values[j];
1067 if(picon->id == current->id)
1069 picon->indexable = current;
1076 // Create new listitem
1079 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1080 AssetPicon *picon = new AssetPicon(mwindow, this, current);
1081 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1082 picon->create_objects();
1083 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1084 assets.append(picon);
1090 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1093 // Synchronize nested EDLs
1094 for(int i = 0; i < mwindow->edl->nested_edls->size(); i++)
1097 Indexable *indexable = mwindow->edl->nested_edls->get(i);
1099 // Look for asset in existing listitems
1100 for(int j = 0; j < assets.total && !exists; j++)
1102 AssetPicon *picon = (AssetPicon*)assets.values[j];
1104 if(picon->id == indexable->id)
1106 picon->indexable = indexable;
1113 // Create new listitem
1116 AssetPicon *picon = new AssetPicon(mwindow,
1119 picon->create_objects();
1120 assets.append(picon);
1132 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1133 for(int i = assets.size() - 1; i >= 0; i--)
1135 AssetPicon *picon = (AssetPicon*)assets.get(i);
1136 //printf("AWindowGUI::update_asset_list %s %d\n", picon->asset->path, picon->in_use);
1140 assets.remove_number(i);
1143 //printf("AWindowGUI::update_asset_list 7 %d\n", assets.total);
1146 void AWindowGUI::sort_assets()
1148 //printf("AWindowGUI::sort_assets 1 %s\n", mwindow->edl->session->current_folder);
1149 switch( mwindow->edl->session->awindow_folder ) {
1150 case AW_AEFFECT_FOLDER:
1151 sort_picons(&aeffects);
1153 case AW_VEFFECT_FOLDER:
1154 sort_picons(&veffects);
1156 case AW_ATRANSITION_FOLDER:
1157 sort_picons(&atransitions);
1159 case AW_VTRANSITION_FOLDER:
1160 sort_picons(&vtransitions);
1162 case AW_LABEL_FOLDER:
1163 // Labels should ALWAYS be sorted by time
1166 sort_picons(&assets);
1172 void AWindowGUI::collect_assets()
1175 mwindow->session->drag_assets->remove_all();
1176 mwindow->session->drag_clips->remove_all();
1179 AssetPicon *result = (AssetPicon*)asset_list->get_selection(0, i++);
1182 if(result->indexable) mwindow->session->drag_assets->append(result->indexable);
1183 if(result->edl) mwindow->session->drag_clips->append(result->edl);
1187 void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst,
1188 ArrayList<BC_ListBoxItem*> *src, int folder)
1190 // Remove current pointers
1191 dst[0].remove_all();
1192 dst[1].remove_all_objects();
1194 // Create new pointers
1195 //if(folder) printf("AWindowGUI::copy_picons 1 %s\n", folder);
1196 for(int i = 0; i < src->total; i++)
1198 AssetPicon *picon = (AssetPicon*)src->values[i];
1199 //printf("AWindowGUI::copy_picons 2 %s\n", picon->asset->folder);
1201 (picon->indexable && picon->indexable->awindow_folder == folder) ||
1202 (picon->edl && picon->edl->local_session->awindow_folder == folder) ) {
1203 BC_ListBoxItem *item2, *item1;
1204 dst[0].append(item1 = picon);
1206 dst[1].append(item2 = new BC_ListBoxItem(picon->edl->local_session->clip_notes));
1208 if(picon->label && picon->label->textstr)
1209 dst[1].append(item2 = new BC_ListBoxItem(picon->label->textstr));
1211 dst[1].append(item2 = new BC_ListBoxItem(""));
1212 item1->set_autoplace_text(1);
1213 item2->set_autoplace_text(1);
1214 //printf("AWindowGUI::copy_picons 3 %s\n", picon->get_text());
1219 void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src)
1221 //printf("AWindowGUI::sort_picons 1\n")
1226 for(int i = 0; i < src->total - 1; i++)
1228 BC_ListBoxItem *item1 = src->values[i];
1229 BC_ListBoxItem *item2 = src->values[i + 1];
1230 item1->set_autoplace_icon(1);
1231 item2->set_autoplace_icon(1);
1232 item1->set_autoplace_text(1);
1233 item2->set_autoplace_text(1);
1234 if(strcmp(item1->get_text(), item2->get_text()) > 0)
1236 src->values[i + 1] = item1;
1237 src->values[i] = item2;
1245 void AWindowGUI::filter_displayed_assets()
1247 allow_iconlisting = 1;
1248 asset_titles[0] = _("Title");
1249 asset_titles[1] = _("Comments");
1251 switch( mwindow->edl->session->awindow_folder ) {
1252 case AW_AEFFECT_FOLDER:
1253 copy_picons(displayed_assets, &aeffects, AW_NO_FOLDER);
1255 case AW_VEFFECT_FOLDER:
1256 copy_picons(displayed_assets, &veffects, AW_NO_FOLDER);
1258 case AW_ATRANSITION_FOLDER:
1259 copy_picons(displayed_assets, &atransitions, AW_NO_FOLDER);
1261 case AW_VTRANSITION_FOLDER:
1262 copy_picons(displayed_assets, &vtransitions, AW_NO_FOLDER);
1264 case AW_LABEL_FOLDER:
1265 copy_picons(displayed_assets, &labellist, AW_NO_FOLDER);
1266 asset_titles[0] = _("Time Stamps");
1267 asset_titles[1] = _("Title");
1268 allow_iconlisting = 0;
1271 copy_picons(displayed_assets, &assets, mwindow->edl->session->awindow_folder);
1275 // Ensure the current folder icon is highlighted
1276 for(int i = 0; i < folders.total; i++)
1277 folders.values[i]->set_selected(0);
1279 folders.values[mwindow->edl->session->awindow_folder]->set_selected(1);
1283 void AWindowGUI::update_assets()
1285 //printf("AWindowGUI::update_assets 1\n");
1286 update_folder_list();
1287 //printf("AWindowGUI::update_assets 2\n");
1288 update_asset_list();
1289 labellist.remove_all_objects();
1290 create_label_folder();
1291 //printf("AWindowGUI::update_assets 3\n");
1292 filter_displayed_assets();
1294 //for(int i = 0; i < folders.total; i++)
1295 //printf("AWindowGUI::update_assets 4\n");
1296 // printf("AWindowGUI::update_assets %s\n", folders.values[i]->get_text());
1297 if(mwindow->edl->session->folderlist_format != folder_list->get_format())
1298 folder_list->update_format(mwindow->edl->session->folderlist_format, 0);
1299 folder_list->update(&folders,
1303 folder_list->get_xposition(),
1304 folder_list->get_yposition(),
1306 //printf("AWindowGUI::update_assets 5\n");
1308 if(mwindow->edl->session->assetlist_format != asset_list->get_format())
1309 asset_list->update_format(mwindow->edl->session->assetlist_format, 0);
1312 //printf("AWindowGUI::update_assets 6 %d\n", displayed_assets[0].total);
1313 asset_list->update(displayed_assets,
1315 mwindow->edl->session->asset_columns,
1317 asset_list->get_xposition(),
1318 asset_list->get_yposition(),
1321 asset_list->center_selection();
1322 //printf("AWindowGUI::update_assets 7\n");
1325 //printf("AWindowGUI::update_assets 8\n");
1329 void AWindowGUI::update_effects()
1331 aeffects.remove_all_objects();
1332 create_persistent_folder(&aeffects, 1, 0, 1, 0);
1333 veffects.remove_all_objects();
1334 create_persistent_folder(&veffects, 0, 1, 1, 0);
1335 atransitions.remove_all_objects();
1336 create_persistent_folder(&atransitions, 1, 0, 0, 1);
1337 vtransitions.remove_all_objects();
1338 create_persistent_folder(&vtransitions, 0, 1, 0, 1);
1341 int AWindowGUI::folder_number(const char *name)
1343 for(int i = 0; i < AWINDOW_FOLDERS; i++) {
1344 if( !strcasecmp(name, folder_names[i]) ) return i;
1346 return AW_NO_FOLDER;
1349 int AWindowGUI::drag_motion()
1351 if(get_hidden()) return 0;
1357 int AWindowGUI::drag_stop()
1359 if(get_hidden()) return 0;
1364 Indexable* AWindowGUI::selected_asset()
1366 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1367 return picon ? picon->indexable : 0;
1370 PluginServer* AWindowGUI::selected_plugin()
1372 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1373 return picon ? picon->plugin : 0;
1376 AssetPicon* AWindowGUI::selected_folder()
1378 AssetPicon *picon = (AssetPicon*)folder_list->get_selection(0, 0);
1389 AWindowDivider::AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1390 : BC_SubWindow(x, y, w, h)
1392 this->mwindow = mwindow;
1395 AWindowDivider::~AWindowDivider()
1399 int AWindowDivider::button_press_event()
1401 if(is_event_win() && cursor_inside())
1403 mwindow->session->current_operation = DRAG_PARTITION;
1409 int AWindowDivider::cursor_motion_event()
1411 if(mwindow->session->current_operation == DRAG_PARTITION)
1414 int wmax = mwindow->session->awindow_w - mwindow->theme->adivider_w - wmin;
1415 int fw = gui->get_relative_cursor_x();
1416 if( fw > wmax ) fw = wmax;
1417 if( fw < wmin ) fw = wmin;
1418 mwindow->session->afolders_w = fw;
1419 mwindow->theme->get_awindow_sizes(gui);
1420 gui->reposition_objects();
1426 int AWindowDivider::button_release_event()
1428 if(mwindow->session->current_operation == DRAG_PARTITION)
1430 mwindow->session->current_operation = NO_OPERATION;
1441 AWindowFolders::AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1446 mwindow->edl->session->folderlist_format == ASSETS_ICONS ?
1447 LISTBOX_ICONS : LISTBOX_TEXT,
1448 &gui->folders, // Each column has an ArrayList of BC_ListBoxItems.
1449 0, // Titles for columns. Set to 0 for no titles
1450 0, // width of each column
1451 1, // Total columns.
1452 0, // Pixel of top of window.
1453 0, // If this listbox is a popup window
1454 LISTBOX_SINGLE, // Select one item or multiple items
1455 ICON_TOP, // Position of icon relative to text of each item
1458 this->mwindow = mwindow;
1463 AWindowFolders::~AWindowFolders()
1467 int AWindowFolders::selection_changed()
1469 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1472 gui->stop_vicon_drawing();
1474 if(get_button_down() && get_buttonpress() == 3)
1476 gui->folderlist_menu->update_titles();
1477 gui->folderlist_menu->activate_menu();
1480 mwindow->edl->session->awindow_folder = picon->foldernum;
1481 //printf("AWindowFolders::selection_changed 1\n");
1482 gui->asset_list->draw_background();
1483 gui->async_update_assets();
1485 gui->start_vicon_drawing();
1490 int AWindowFolders::button_press_event()
1494 result = BC_ListBox::button_press_event();
1498 if(get_buttonpress() == 3 && is_event_win() && cursor_inside())
1500 gui->folderlist_menu->update_titles();
1501 gui->folderlist_menu->activate_menu();
1516 AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1521 (mwindow->edl->session->assetlist_format == ASSETS_ICONS && gui->allow_iconlisting ) ?
1522 LISTBOX_ICONS : LISTBOX_TEXT,
1523 &gui->assets, // Each column has an ArrayList of BC_ListBoxItems.
1524 gui->asset_titles, // Titles for columns. Set to 0 for no titles
1525 mwindow->edl->session->asset_columns, // width of each column
1526 1, // Total columns.
1527 0, // Pixel of top of window.
1528 0, // If this listbox is a popup window
1529 LISTBOX_MULTIPLE, // Select one item or multiple items
1530 ICON_TOP, // Position of icon relative to text of each item
1533 this->mwindow = mwindow;
1538 AWindowAssets::~AWindowAssets()
1542 int AWindowAssets::button_press_event()
1546 result = BC_ListBox::button_press_event();
1548 if(!result && get_buttonpress() == 3 && is_event_win() && cursor_inside())
1550 BC_ListBox::deactivate_selection();
1551 gui->assetlist_menu->update_titles();
1552 gui->assetlist_menu->activate_menu();
1561 int AWindowAssets::handle_event()
1563 //printf("AWindowAssets::handle_event 1 %d %d\n", get_buttonpress(), get_selection(0, 0));
1564 AssetPicon *asset_picon = (AssetPicon *)get_selection(0, 0);
1565 if( !asset_picon ) return 0;
1566 switch( mwindow->edl->session->awindow_folder ) {
1567 case AW_AEFFECT_FOLDER:
1568 case AW_VEFFECT_FOLDER:
1569 case AW_ATRANSITION_FOLDER:
1570 case AW_VTRANSITION_FOLDER: return 1;
1572 VWindow *vwindow = mwindow->vwindows.size() > DEFAULT_VWINDOW ?
1573 mwindow->vwindows.get(DEFAULT_VWINDOW) : 0;
1574 if( !vwindow || !vwindow->is_running() ) return 1;
1575 //printf("AWindowAssets::handle_event 2 %d %d\n", get_buttonpress(), get_selection(0, 0));
1577 vwindow->gui->lock_window("AWindowAssets::handle_event");
1578 if( asset_picon->indexable )
1579 vwindow->change_source(asset_picon->indexable);
1580 else if( asset_picon->edl )
1581 vwindow->change_source(asset_picon->edl);
1582 vwindow->gui->unlock_window();
1586 int AWindowAssets::selection_changed()
1588 // Show popup window
1589 if( get_button_down() && get_buttonpress() == 3 && get_selection(0, 0) ) {
1590 switch( mwindow->edl->session->awindow_folder ) {
1591 case AW_AEFFECT_FOLDER:
1592 case AW_VEFFECT_FOLDER:
1593 case AW_ATRANSITION_FOLDER:
1594 case AW_VTRANSITION_FOLDER:
1595 gui->assetlist_menu->update_titles();
1596 gui->assetlist_menu->activate_menu();
1598 case AW_LABEL_FOLDER:
1599 if(((AssetPicon*)get_selection(0, 0))->label)
1600 gui->label_menu->activate_menu();
1603 if(((AssetPicon*)get_selection(0, 0))->indexable)
1604 gui->asset_menu->update();
1606 if(((AssetPicon*)get_selection(0, 0))->edl)
1607 gui->asset_menu->update();
1609 gui->asset_menu->activate_menu();
1612 BC_ListBox::deactivate_selection();
1615 else if( get_button_down() && get_buttonpress() == 1 && get_selection(0, 0) ) {
1617 if( !gui->vicon_thread->viewing ) {
1618 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1619 vicon = picon->vicon;
1621 gui->vicon_thread->set_view_popup(vicon);
1627 void AWindowAssets::draw_background()
1629 clear_box(0,0,get_w(),get_h(),get_bg_surface());
1630 set_color(BC_WindowBase::get_resources()->audiovideo_color);
1631 set_font(LARGEFONT);
1632 int aw_folder = mwindow->edl->session->awindow_folder;
1633 if( aw_folder < 0 ) return;
1634 const char *aw_name = _(AWindowGUI::folder_names[aw_folder]);
1635 draw_text(get_w() - get_text_width(LARGEFONT, aw_name) - 4, 30,
1636 aw_name, -1, get_bg_surface());
1639 int AWindowAssets::drag_start_event()
1641 int collect_pluginservers = 0;
1642 int collect_assets = 0;
1644 if( BC_ListBox::drag_start_event() ) {
1645 switch( mwindow->edl->session->awindow_folder ) {
1646 case AW_AEFFECT_FOLDER:
1647 mwindow->session->current_operation = DRAG_AEFFECT;
1648 collect_pluginservers = 1;
1650 case AW_VEFFECT_FOLDER:
1651 mwindow->session->current_operation = DRAG_VEFFECT;
1652 collect_pluginservers = 1;
1654 case AW_ATRANSITION_FOLDER:
1655 mwindow->session->current_operation = DRAG_ATRANSITION;
1656 collect_pluginservers = 1;
1658 case AW_VTRANSITION_FOLDER:
1659 mwindow->session->current_operation = DRAG_VTRANSITION;
1660 collect_pluginservers = 1;
1662 case AW_LABEL_FOLDER:
1666 mwindow->session->current_operation = DRAG_ASSET;
1671 if(collect_pluginservers)
1674 mwindow->session->drag_pluginservers->remove_all();
1677 AssetPicon *result = (AssetPicon*)get_selection(0, i++);
1680 mwindow->session->drag_pluginservers->append(result->plugin);
1686 gui->collect_assets();
1694 int AWindowAssets::drag_motion_event()
1696 BC_ListBox::drag_motion_event();
1699 mwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1700 mwindow->gui->drag_motion();
1701 mwindow->gui->unlock_window();
1703 for(int i = 0; i < mwindow->vwindows.size(); i++)
1705 VWindow *vwindow = mwindow->vwindows.get(i);
1706 if( !vwindow->is_running() ) continue;
1707 vwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1708 vwindow->gui->drag_motion();
1709 vwindow->gui->unlock_window();
1712 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1713 mwindow->cwindow->gui->drag_motion();
1714 mwindow->cwindow->gui->unlock_window();
1716 lock_window("AWindowAssets::drag_motion_event");
1720 int AWindowAssets::drag_stop_event()
1724 result = gui->drag_stop();
1730 mwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1731 result = mwindow->gui->drag_stop();
1732 mwindow->gui->unlock_window();
1737 for(int i = 0; i < mwindow->vwindows.size(); i++)
1739 VWindow *vwindow = mwindow->vwindows.get(i);
1740 if( !vwindow->is_running() ) continue;
1741 vwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1742 result = vwindow->gui->drag_stop();
1743 vwindow->gui->unlock_window();
1749 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1750 result = mwindow->cwindow->gui->drag_stop();
1751 mwindow->cwindow->gui->unlock_window();
1754 lock_window("AWindowAssets::drag_stop_event");
1756 if(result) get_drag_popup()->set_animation(0);
1758 BC_ListBox::drag_stop_event();
1759 mwindow->session->current_operation = ::NO_OPERATION; // since NO_OPERATION is also defined in listbox, we have to reach for global scope...
1763 int AWindowAssets::column_resize_event()
1765 mwindow->edl->session->asset_columns[0] = get_column_width(0);
1766 mwindow->edl->session->asset_columns[1] = get_column_width(1);
1770 int AWindowAssets::focus_in_event()
1772 gui->start_vicon_drawing();
1776 int AWindowAssets::focus_out_event()
1778 gui->stop_vicon_drawing();
1779 return BC_ListBox::focus_out_event();
1793 AWindowNewFolder::AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1794 : BC_Button(x, y, mwindow->theme->newbin_data)
1796 this->mwindow = mwindow;
1798 set_tooltip(_("New bin"));
1801 int AWindowNewFolder::handle_event()
1803 gui->newfolder_thread->start_new_folder();
1807 AWindowDeleteFolder::AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1808 : BC_Button(x, y, mwindow->theme->deletebin_data)
1810 this->mwindow = mwindow;
1812 set_tooltip(_("Delete bin"));
1815 int AWindowDeleteFolder::handle_event()
1817 if(gui->folder_list->get_selection(0, 0))
1819 BC_ListBoxItem *folder = gui->folder_list->get_selection(0, 0);
1820 mwindow->delete_folder(folder->get_text());
1825 AWindowRenameFolder::AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1826 : BC_Button(x, y, mwindow->theme->renamebin_data)
1828 this->mwindow = mwindow;
1830 set_tooltip(_("Rename bin"));
1833 int AWindowRenameFolder::handle_event()
1838 AWindowDeleteDisk::AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1839 : BC_Button(x, y, mwindow->theme->deletedisk_data)
1841 this->mwindow = mwindow;
1843 set_tooltip(_("Delete asset from disk"));
1846 int AWindowDeleteDisk::handle_event()
1851 AWindowDeleteProject::AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1852 : BC_Button(x, y, mwindow->theme->deleteproject_data)
1854 this->mwindow = mwindow;
1856 set_tooltip(_("Delete asset from project"));
1859 int AWindowDeleteProject::handle_event()
1864 AWindowInfo::AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1865 : BC_Button(x, y, mwindow->theme->infoasset_data)
1867 this->mwindow = mwindow;
1869 set_tooltip(_("Edit information on asset"));
1872 int AWindowInfo::handle_event()
1874 gui->awindow->asset_edit->edit_asset(gui->selected_asset());
1878 AWindowRedrawIndex::AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1879 : BC_Button(x, y, mwindow->theme->redrawindex_data)
1881 this->mwindow = mwindow;
1883 set_tooltip(_("Redraw index"));
1886 int AWindowRedrawIndex::handle_event()
1891 AWindowPaste::AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1892 : BC_Button(x, y, mwindow->theme->pasteasset_data)
1894 this->mwindow = mwindow;
1896 set_tooltip(_("Paste asset on recordable tracks"));
1899 int AWindowPaste::handle_event()
1904 AWindowAppend::AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1905 : BC_Button(x, y, mwindow->theme->appendasset_data)
1907 this->mwindow = mwindow;
1909 set_tooltip(_("Append asset in new tracks"));
1912 int AWindowAppend::handle_event()
1917 AWindowView::AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1918 : BC_Button(x, y, mwindow->theme->viewasset_data)
1920 this->mwindow = mwindow;
1922 set_tooltip(_("View asset"));
1925 int AWindowView::handle_event()
1931 LabelPopup::LabelPopup(MWindow *mwindow, AWindowGUI *gui)
1938 this->mwindow = mwindow;
1942 LabelPopup::~LabelPopup()
1946 void LabelPopup::create_objects()
1948 add_item(editlabel = new LabelPopupEdit(mwindow, this));
1951 int LabelPopup::update()
1953 gui->collect_assets();
1959 LabelPopupEdit::LabelPopupEdit(MWindow *mwindow, LabelPopup *popup)
1960 : BC_MenuItem(_("Edit..."))
1962 this->mwindow = mwindow;
1963 this->popup = popup;
1966 LabelPopupEdit::~LabelPopupEdit()
1970 int LabelPopupEdit::handle_event()
1975 AssetPicon *result = (AssetPicon*)mwindow->awindow->gui->asset_list->get_selection(0, i++);
1979 mwindow->awindow->gui->awindow->label_edit->edit_label(result->label);
1987 AddTools::AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, const char *title)
1988 : BC_PopupMenu(x, y, BC_Title::calculate_w(gui, title, MEDIUMFONT)+8, title, -1, 0, 4)
1990 this->mwindow = mwindow;
1994 void AddTools::create_objects()
1997 add_item(new AddPluginItem(this, "ladspa", PLUGIN_LADSPA_ID));
1998 vis |= 1 << PLUGIN_LADSPA_ID;
1999 add_item(new AddPluginItem(this, "ffmpeg", PLUGIN_FFMPEG_ID));
2000 vis |= 1 << PLUGIN_FFMPEG_ID;
2001 for( int i=0; i<MWindow::plugindb->size(); ++i ) {
2002 PluginServer *plugin = MWindow::plugindb->get(i);
2003 if( !plugin->audio && !plugin->video ) continue;
2004 int idx = plugin->dir_idx;
2005 uint32_t msk = 1 << idx;
2006 if( (msk & vis) != 0 ) continue;
2008 char parent[BCTEXTLEN];
2009 strcpy(parent, plugin->path);
2010 char *bp = strrchr(parent, '/');
2011 if( bp ) { *bp = 0; bp = strrchr(parent, '/'); }
2012 if( !bp ) bp = parent; else ++bp;
2013 add_item(new AddPluginItem(this, bp, idx));
2018 // plugin_dirs list from toplevel makefile include plugin_defs
2022 N_("audio_transitions")
2029 N_("video_transitions")
2032 AddPluginItem::AddPluginItem(AddTools *menu, char const *text, int idx)
2033 : BC_MenuItem(_(text))
2037 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
2038 int chk = (msk & vis) ? 1 : 0;
2042 int AddPluginItem::handle_event()
2044 int chk = get_checked() ^ 1;
2046 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
2047 menu->gui->plugin_visibility = chk ? vis | msk : vis & ~msk;
2048 menu->gui->update_effects();
2049 menu->gui->save_defaults(menu->mwindow->defaults);
2050 menu->gui->async_update_assets();
2054 AVIconDrawing::AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images)
2055 : BC_Toggle(x, y, images, agui->vicon_drawing)
2058 set_tooltip(_("draw vicons"));
2061 void AVIconDrawing::calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh)
2063 int text_line = -1, toggle_x = -1, toggle_y = -1;
2064 int text_x = -1, text_y = -1, text_w = -1, text_h = -1;
2065 BC_Toggle::calculate_extents(agui, images, 1,
2066 &text_line, ww, hh, &toggle_x, &toggle_y,
2067 &text_x, &text_y, &text_w, &text_h, "", MEDIUMFONT);
2070 AVIconDrawing::~AVIconDrawing()
2074 int AVIconDrawing::handle_event()
2076 agui->vicon_drawing = get_value();
2077 if( agui->vicon_drawing )
2078 agui->start_vicon_drawing();
2080 agui->stop_vicon_drawing();