4 * Copyright (C) 1997-2012 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "assetedit.h"
24 #include "assetpopup.h"
26 #include "awindowgui.h"
28 #include "bcsignals.h"
31 #include "bccmodels.h"
32 #include "clippopup.h"
34 #include "cwindowgui.h"
37 #include "edlsession.h"
38 #include "effectlist.h"
40 #include "filesystem.h"
41 #include "folderlistmenu.h"
42 #include "indexable.h"
46 #include "labelpopup.h"
47 #include "localsession.h"
49 #include "mainsession.h"
50 #include "mwindowgui.h"
52 #include "nestededls.h"
53 #include "newfolder.h"
54 #include "preferences.h"
58 #include "vwindowgui.h"
61 #include "data/lad_picon_png.h"
62 #include "data/ff_audio_png.h"
63 #include "data/ff_video_png.h"
70 const char *AWindowGUI::folder_names[] =
74 N_("Audio Transitions"),
75 N_("Video Transitions"),
83 AssetVIcon::AssetVIcon(AssetPicon *picon, int w, int h, double framerate, int64_t length)
84 : VIcon(w, h, framerate)
87 this->length = length;
91 AssetVIcon::~AssetVIcon()
96 VFrame *AssetVIcon::frame()
98 if( seq_no >= images.size() ) {
99 MWindow *mwindow = picon->mwindow;
100 Asset *asset = (Asset *)picon->indexable;
101 File *file = mwindow->video_cache->check_out(asset, mwindow->edl, 1);
102 if( !file ) return 0;
103 if( temp && (temp->get_w() != asset->width || temp->get_h() != asset->height) ) {
104 delete temp; temp = 0;
107 temp = new VFrame(asset->width, asset->height, BC_RGB888);
108 int ww = picon->gui->vicon_thread->view_w;
109 int hh = picon->gui->vicon_thread->view_h;
110 while( seq_no >= images.size() ) {
112 int64_t pos = images.size() / picon->gui->vicon_thread->refresh_rate * frame_rate;
113 file->set_video_position(pos,0);
114 file->read_frame(temp);
115 add_image(temp, ww, hh, BC_RGB8);
117 mwindow->video_cache->check_in(asset);
119 return *images[seq_no];
122 int64_t AssetVIcon::set_seq_no(int64_t no)
124 if( no >= length ) no = 0;
128 int AssetVIcon::get_vx()
130 BC_ListBox *lbox = picon->gui->asset_list;
131 return lbox->get_item_x(picon);
133 int AssetVIcon::get_vy()
135 BC_ListBox *lbox = picon->gui->asset_list;
136 return lbox->get_item_y(picon) + lbox->get_title_h();
139 AssetPicon::AssetPicon(MWindow *mwindow,
141 Indexable *indexable)
145 this->mwindow = mwindow;
147 this->indexable = indexable;
148 indexable->add_user();
149 this->id = indexable->id;
152 AssetPicon::AssetPicon(MWindow *mwindow,
158 this->mwindow = mwindow;
165 AssetPicon::AssetPicon(MWindow *mwindow,
166 AWindowGUI *gui, int folder)
167 : BC_ListBoxItem(_(AWindowGUI::folder_names[folder]), gui->folder_icon)
171 this->mwindow = mwindow;
175 AssetPicon::AssetPicon(MWindow *mwindow,
176 AWindowGUI *gui, const char *folder_name, int folder_num)
177 : BC_ListBoxItem(folder_name, gui->folder_icon)
180 foldernum = folder_num;
181 this->mwindow = mwindow;
185 AssetPicon::AssetPicon(MWindow *mwindow,
187 PluginServer *plugin)
191 this->mwindow = mwindow;
193 this->plugin = plugin;
197 AssetPicon::AssetPicon(MWindow *mwindow,
203 this->mwindow = mwindow;
211 AssetPicon::~AssetPicon()
214 gui->vicon_thread->del_vicon(vicon);
215 if( indexable ) indexable->remove_user();
216 if( edl ) edl->remove_user();
217 if( icon && !gui->protected_pixmap(icon) ) {
219 if( !plugin ) delete icon_vframe;
223 void AssetPicon::reset()
237 void AssetPicon::create_objects()
240 char name[BCTEXTLEN];
241 int pixmap_w, pixmap_h;
244 pixmap_h = 50 * BC_WindowBase::get_resources()->icon_scale;
246 if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__);
248 fs.extract_name(name, indexable->path);
252 if( indexable && indexable->is_asset ) {
253 if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__);
254 Asset *asset = (Asset*)indexable;
255 if( asset->video_data ) {
256 if( mwindow->preferences->use_thumbnails ) {
257 gui->unlock_window();
258 if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__);
259 File *file = mwindow->video_cache->check_out(asset,
262 if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__);
265 int height = asset->height > 0 ? asset->height : 1;
266 pixmap_w = pixmap_h * asset->width / height;
269 file->set_video_position(0, 0);
271 if( gui->temp_picon &&
272 (gui->temp_picon->get_w() != asset->width ||
273 gui->temp_picon->get_h() != asset->height) ) {
274 delete gui->temp_picon;
278 if( !gui->temp_picon ) {
279 gui->temp_picon = new VFrame(0, -1,
280 asset->width, asset->height,
283 { char string[BCTEXTLEN];
284 sprintf(string, _("Reading %s"), name);
285 mwindow->gui->lock_window("AssetPicon::create_objects");
286 mwindow->gui->show_message(string);
287 mwindow->gui->unlock_window(); }
288 file->read_frame(gui->temp_picon);
289 if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__);
290 mwindow->video_cache->check_in(asset);
292 gui->lock_window("AssetPicon::create_objects 1");
293 icon = new BC_Pixmap(gui, pixmap_w, pixmap_h);
294 icon->draw_vframe(gui->temp_picon,
295 0, 0, pixmap_w, pixmap_h, 0, 0);
296 //printf("%d %d\n", gui->temp_picon->get_w(), gui->temp_picon->get_h());
297 icon_vframe = new VFrame(0,
298 -1, pixmap_w, pixmap_h, BC_RGB888, -1);
299 icon_vframe->transfer_from(gui->temp_picon);
301 double framerate = asset->get_frame_rate();
302 if( !framerate ) framerate = VICON_RATE;
303 int64_t frames = asset->get_video_frames();
304 double secs = frames / framerate;
305 if( secs > 5 ) secs = 5;
306 int64_t length = secs * gui->vicon_thread->refresh_rate;
307 vicon = new AssetVIcon(this, pixmap_w, pixmap_h, framerate, length);
308 gui->vicon_thread->add_vicon(vicon);
309 if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__);
313 gui->lock_window("AssetPicon::create_objects 2");
314 icon = gui->video_icon;
315 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
319 icon = gui->video_icon;
320 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
324 if( asset->audio_data ) {
325 icon = gui->audio_icon;
326 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND];
328 //printf("AssetPicon::create_objects 2\n");
330 if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__);
333 if( indexable && !indexable->is_asset ) {
334 icon = gui->video_icon;
335 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
339 //printf("AssetPicon::create_objects 4 %s\n", edl->local_session->clip_title);
340 set_text(strcpy(name, edl->local_session->clip_title));
341 icon = gui->clip_icon;
342 icon_vframe = mwindow->theme->get_image("clip_icon");
346 strcpy(name, plugin->title);
348 icon_vframe = plugin->get_picon();
350 icon = gui->create_pixmap(icon_vframe);
351 else if( plugin->audio ) {
352 if( plugin->transition ) {
353 icon = gui->atransition_icon;
354 icon_vframe = gui->atransition_vframe;
356 else if( plugin->is_ffmpeg() ) {
357 icon = gui->ff_aud_icon;
358 icon_vframe = gui->ff_aud_vframe;
360 else if( plugin->is_ladspa() ) {
361 icon = gui->ladspa_icon;
362 icon_vframe = gui->ladspa_vframe;
365 icon = gui->aeffect_icon;
366 icon_vframe = gui->aeffect_vframe;
369 else if( plugin->video ) {
370 if( plugin->transition ) {
371 icon = gui->vtransition_icon;
372 icon_vframe = gui->vtransition_vframe;
374 else if( plugin->is_ffmpeg() ) {
375 icon = gui->ff_vid_icon;
376 icon_vframe = gui->ff_vid_vframe;
379 icon = gui->veffect_icon;
380 icon_vframe = gui->veffect_vframe;
388 mwindow->edl->session->time_format,
389 mwindow->edl->session->sample_rate,
390 mwindow->edl->session->frame_rate,
391 mwindow->edl->session->frames_per_foot);
393 icon = gui->label_icon;
394 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_LABEL];
396 set_icon_vframe(icon_vframe);
399 icon = gui->file_icon;
400 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN];
403 set_icon_vframe(icon_vframe);
405 if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__);
413 AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow)
414 : BC_Window(_(PROGRAM_NAME ": Resources"),
415 mwindow->session->awindow_x, mwindow->session->awindow_y,
416 mwindow->session->awindow_w, mwindow->session->awindow_h,
419 // printf("AWindowGUI::AWindowGUI %d %d %d %d\n",
420 // mwindow->session->awindow_x,
421 // mwindow->session->awindow_y,
422 // mwindow->session->awindow_w,
423 // mwindow->session->awindow_h);
424 this->mwindow = mwindow;
425 this->awindow = awindow;
432 atransition_icon = 0; atransition_vframe = 0;
433 vtransition_icon = 0; vtransition_vframe = 0;
434 aeffect_icon = 0; aeffect_vframe = 0;
435 ladspa_icon = 0; ladspa_vframe = 0;
436 veffect_icon = 0; veffect_vframe = 0;
437 ff_aud_icon = 0; ff_aud_vframe = 0;
438 ff_vid_icon = 0; ff_vid_vframe = 0;
439 plugin_visibility = ((uint64_t)1<<(8*sizeof(uint64_t)-1))-1;
440 newfolder_thread = 0;
448 allow_iconlisting = 1;
454 AWindowGUI::~AWindowGUI()
456 assets.remove_all_objects();
457 folders.remove_all_objects();
458 aeffects.remove_all_objects();
459 veffects.remove_all_objects();
460 atransitions.remove_all_objects();
461 vtransitions.remove_all_objects();
462 labellist.remove_all_objects();
463 displayed_assets[1].remove_all_objects();
472 delete atransition_icon;
473 delete vtransition_icon;
476 delete ladspa_vframe;
478 delete ff_aud_vframe;
480 delete ff_vid_vframe;
482 delete newfolder_thread;
486 delete effectlist_menu;
487 delete assetlist_menu;
488 delete cliplist_menu;
489 delete labellist_menu;
490 delete folderlist_menu;
491 if( temp_picon ) delete temp_picon;
492 delete remove_plugin;
495 bool AWindowGUI::protected_pixmap(BC_Pixmap *icon)
497 return icon == file_icon ||
498 icon == folder_icon ||
499 icon == audio_icon ||
500 icon == video_icon ||
502 icon == label_icon ||
503 icon == vtransition_icon ||
504 icon == atransition_icon ||
505 icon == veffect_icon ||
506 icon == aeffect_icon ||
507 icon == ladspa_icon ||
508 icon == ff_aud_icon ||
512 void AWindowGUI::create_objects()
516 lock_window("AWindowGUI::create_objects");
518 //printf("AWindowGUI::create_objects 1\n");
519 asset_titles[0] = _("Title");
520 asset_titles[1] = _("Comments");
524 set_icon(mwindow->theme->get_image("awindow_icon"));
525 file_icon = new BC_Pixmap(this,
526 BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN],
529 folder_icon = new BC_Pixmap(this,
530 BC_WindowBase::get_resources()->type_to_icon[ICON_FOLDER],
533 audio_icon = new BC_Pixmap(this,
534 BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND],
537 video_icon = new BC_Pixmap(this,
538 BC_WindowBase::get_resources()->type_to_icon[ICON_FILM],
541 label_icon = new BC_Pixmap(this,
542 BC_WindowBase::get_resources()->type_to_icon[ICON_LABEL],
547 clip_vframe = mwindow->theme->get_image("clip_icon");
548 clip_icon = new BC_Pixmap(this, clip_vframe, PIXMAP_ALPHA);
549 atransition_vframe = mwindow->theme->get_image("atransition_icon");
550 atransition_icon = new BC_Pixmap(this, atransition_vframe, PIXMAP_ALPHA);
551 vtransition_vframe = mwindow->theme->get_image("vtransition_icon");
552 vtransition_icon = new BC_Pixmap(this, vtransition_vframe, PIXMAP_ALPHA);
553 aeffect_vframe = mwindow->theme->get_image("aeffect_icon");
554 aeffect_icon = new BC_Pixmap(this, aeffect_vframe, PIXMAP_ALPHA);
555 ladspa_vframe = new VFramePng(lad_picon_png);
556 ladspa_icon = new BC_Pixmap(this, ladspa_vframe, PIXMAP_ALPHA);
557 ff_aud_vframe = new VFramePng(ff_audio_png);
558 ff_aud_icon = new BC_Pixmap(this, ff_aud_vframe, PIXMAP_ALPHA);
559 ff_vid_vframe = new VFramePng(ff_video_png);
560 ff_vid_icon = new BC_Pixmap(this, ff_vid_vframe, PIXMAP_ALPHA);
561 veffect_vframe = mwindow->theme->get_image("veffect_icon");
562 veffect_icon = new BC_Pixmap(this, veffect_vframe, PIXMAP_ALPHA);
567 folders.append(picon = new AssetPicon(mwindow, this, AW_AEFFECT_FOLDER));
568 picon->persistent = 1;
569 folders.append(picon = new AssetPicon(mwindow, this, AW_VEFFECT_FOLDER));
570 picon->persistent = 1;
571 folders.append(picon = new AssetPicon(mwindow, this, AW_ATRANSITION_FOLDER));
572 picon->persistent = 1;
573 folders.append(picon = new AssetPicon(mwindow, this, AW_VTRANSITION_FOLDER));
574 picon->persistent = 1;
575 folders.append(picon = new AssetPicon(mwindow, this, AW_LABEL_FOLDER));
576 picon->persistent = 1;
577 folders.append(picon = new AssetPicon(mwindow, this, AW_CLIP_FOLDER));
578 picon->persistent = 1;
579 folders.append(picon = new AssetPicon(mwindow, this, AW_MEDIA_FOLDER));
580 picon->persistent = 1;
582 create_label_folder();
585 mwindow->theme->get_awindow_sizes(this);
586 load_defaults(mwindow->defaults);
589 add_subwindow(asset_list = new AWindowAssets(mwindow,
591 mwindow->theme->alist_x,
592 mwindow->theme->alist_y,
593 mwindow->theme->alist_w,
594 mwindow->theme->alist_h));
596 vicon_thread = new VIconThread(asset_list);
597 vicon_thread->start();
600 add_subwindow(divider = new AWindowDivider(mwindow,
602 mwindow->theme->adivider_x,
603 mwindow->theme->adivider_y,
604 mwindow->theme->adivider_w,
605 mwindow->theme->adivider_h));
608 divider->set_cursor(HSEPARATE_CURSOR, 0, 0);
611 int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y;
612 int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h;
613 VFrame **images = mwindow->theme->get_image_set("playpatch_data");
614 AVIconDrawing::calculate_geometry(this, images, &avicon_w, &avicon_h);
615 add_subwindow(avicon_drawing = new AVIconDrawing(this, fw-avicon_w, fy, images));
616 add_subwindow(add_tools = new AddTools(mwindow, this, fx, fy, _("Visibility")));
617 add_tools->create_objects();
618 fy += add_tools->get_h(); fh -= add_tools->get_h();
620 add_subwindow(folder_list = new AWindowFolders(mwindow,
621 this, fx, fy, fw, fh));
626 //int x = mwindow->theme->abuttons_x;
627 //int y = mwindow->theme->abuttons_y;
631 newfolder_thread = new NewFolderThread(mwindow, this);
633 add_subwindow(asset_menu = new AssetPopup(mwindow, this));
634 asset_menu->create_objects();
635 add_subwindow(clip_menu = new ClipPopup(mwindow, this));
636 clip_menu->create_objects();
637 add_subwindow(label_menu = new LabelPopup(mwindow, this));
638 label_menu->create_objects();
640 add_subwindow(effectlist_menu = new EffectListMenu(mwindow, this));
641 effectlist_menu->create_objects();
642 add_subwindow(assetlist_menu = new AssetListMenu(mwindow, this));
643 assetlist_menu->create_objects();
644 add_subwindow(cliplist_menu = new ClipListMenu(mwindow, this));
645 cliplist_menu->create_objects();
646 add_subwindow(labellist_menu = new LabelListMenu(mwindow, this));
647 labellist_menu->create_objects();
650 add_subwindow(folderlist_menu = new FolderListMenu(mwindow, this));
651 folderlist_menu->create_objects();
653 //printf("AWindowGUI::create_objects 2\n");
655 create_custom_xatoms();
659 int AWindowGUI::resize_event(int w, int h)
661 mwindow->session->awindow_x = get_x();
662 mwindow->session->awindow_y = get_y();
663 mwindow->session->awindow_w = w;
664 mwindow->session->awindow_h = h;
666 mwindow->theme->get_awindow_sizes(this);
667 mwindow->theme->draw_awindow_bg(this);
668 reposition_objects();
670 // int x = mwindow->theme->abuttons_x;
671 // int y = mwindow->theme->abuttons_y;
672 // new_bin->reposition_window(x, y);
673 // x += new_bin->get_w();
674 // delete_bin->reposition_window(x, y);
675 // x += delete_bin->get_w();
676 // rename_bin->reposition_window(x, y);
677 // x += rename_bin->get_w();
678 // delete_disk->reposition_window(x, y);
679 // x += delete_disk->get_w();
680 // delete_project->reposition_window(x, y);
681 // x += delete_project->get_w();
682 // info->reposition_window(x, y);
683 // x += info->get_w();
684 // redraw_index->reposition_window(x, y);
685 // x += redraw_index->get_w();
686 // paste->reposition_window(x, y);
687 // x += paste->get_w();
688 // append->reposition_window(x, y);
689 // x += append->get_w();
690 // view->reposition_window(x, y);
692 BC_WindowBase::resize_event(w, h);
696 int AWindowGUI::translation_event()
698 mwindow->session->awindow_x = get_x();
699 mwindow->session->awindow_y = get_y();
703 void AWindowGUI::reposition_objects()
705 asset_list->reposition_window(
706 mwindow->theme->alist_x, mwindow->theme->alist_y,
707 mwindow->theme->alist_w, mwindow->theme->alist_h);
708 divider->reposition_window(
709 mwindow->theme->adivider_x, mwindow->theme->adivider_y,
710 mwindow->theme->adivider_w, mwindow->theme->adivider_h);
711 int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y;
712 int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h;
713 add_tools->resize_event(fw-avicon_w, add_tools->get_h());
714 avicon_drawing->reposition_window(fw-avicon_w, fy);
715 fy += add_tools->get_h(); fh -= add_tools->get_h();
716 folder_list->reposition_window(fx, fy, fw, fh);
719 int AWindowGUI::save_defaults(BC_Hash *defaults)
721 defaults->update("PLUGIN_VISIBILTY", plugin_visibility);
722 defaults->update("VICON_DRAWING", vicon_drawing);
726 int AWindowGUI::load_defaults(BC_Hash *defaults)
728 plugin_visibility = defaults->get("PLUGIN_VISIBILTY", plugin_visibility);
729 vicon_drawing = defaults->get("VICON_DRAWING", vicon_drawing);
733 int AWindowGUI::close_event()
736 mwindow->session->show_awindow = 0;
739 mwindow->gui->lock_window("AWindowGUI::close_event");
740 mwindow->gui->mainmenu->show_awindow->set_checked(0);
741 mwindow->gui->unlock_window();
743 lock_window("AWindowGUI::close_event");
744 save_defaults(mwindow->defaults);
745 mwindow->save_defaults();
749 void AWindowGUI::start_vicon_drawing()
751 if( !vicon_drawing ) return;
752 if( mwindow->edl->session->awindow_folder != AW_MEDIA_FOLDER ) return;
753 if( mwindow->edl->session->assetlist_format != ASSETS_ICONS ) return;
754 vicon_thread->start_drawing();
757 void AWindowGUI::stop_vicon_drawing()
759 vicon_thread->stop_drawing();
762 AWindowRemovePluginGUI::
763 AWindowRemovePluginGUI(AWindow *awindow, AWindowRemovePlugin *thread,
764 int x, int y, PluginServer *plugin)
765 : BC_Window(_(PROGRAM_NAME ": Remove plugin"), x,y, 500,200, 50, 50, 1, 0, 1, -1, "", 1)
767 this->awindow = awindow;
768 this->thread = thread;
769 this->plugin = plugin;
770 VFrame *vframe = plugin->get_picon();
771 icon = vframe ? create_pixmap(vframe) : 0;
772 plugin_list.append(new BC_ListBoxItem(plugin->title, icon));
775 AWindowRemovePluginGUI::
776 ~AWindowRemovePluginGUI()
778 if( !awindow->gui->protected_pixmap(icon) )
780 plugin_list.remove_all();
783 void AWindowRemovePluginGUI::create_objects()
785 BC_Button *ok_button = new BC_OKButton(this);
786 add_subwindow(ok_button);
787 BC_Button *cancel_button = new BC_CancelButton(this);
788 add_subwindow(cancel_button);
790 BC_Title *title = new BC_Title(x, y, _("remove plugin?"));
791 add_subwindow(title);
792 y += title->get_h() + 5;
793 list = new BC_ListBox(x, y,
794 get_w() - 20, ok_button->get_y() - y - 5, LISTBOX_TEXT, &plugin_list,
795 0, 0, 1, 0, 0, LISTBOX_SINGLE, ICON_LEFT, 0);
800 int AWindowRemovePlugin::remove_plugin(PluginServer *plugin, ArrayList<BC_ListBoxItem*> &folder)
803 for( int i=0; i<folder.size(); ) {
804 AssetPicon *picon = (AssetPicon *)folder[i];
805 if( picon->plugin == plugin ) {
806 folder.remove_object_number(i);
815 void AWindowRemovePlugin::handle_close_event(int result)
818 printf(_("remove %s\n"), plugin->path);
819 ArrayList<BC_ListBoxItem*> *folder =
820 plugin->audio ? plugin->transition ?
821 &awindow->gui->atransitions :
822 &awindow->gui->aeffects :
823 plugin->video ? plugin->transition ?
824 &awindow->gui->vtransitions :
825 &awindow->gui->veffects :
827 if( folder ) remove_plugin(plugin, *folder);
828 char plugin_path[BCTEXTLEN];
829 strcpy(plugin_path, plugin->path);
830 MWindow *mwindow = awindow->mwindow;
831 mwindow->plugindb->remove(plugin);
833 char index_path[BCTEXTLEN];
834 snprintf(index_path, sizeof(index_path), "%s/%s",
835 mwindow->preferences->plugin_dir, PLUGIN_FILE);
837 char png_path[BCTEXTLEN];
838 if( plugin->get_plugin_png_path(png_path, mwindow->preferences->plugin_icons) )
840 if( plugin->get_plugin_png_path(png_path, DEFAULT_PICON) )
842 delete plugin; plugin = 0;
843 awindow->gui->async_update_assets();
847 AWindowRemovePlugin::
848 AWindowRemovePlugin(AWindow *awindow, PluginServer *plugin)
851 this->awindow = awindow;
852 this->plugin = plugin;
855 AWindowRemovePlugin::
856 ~AWindowRemovePlugin()
861 BC_Window* AWindowRemovePlugin::new_gui()
863 int x = awindow->gui->get_abs_cursor_x(0);
864 int y = awindow->gui->get_abs_cursor_y(0);
865 AWindowRemovePluginGUI *gui = new AWindowRemovePluginGUI(awindow, this, x, y, plugin);
866 gui->create_objects();
870 int AWindowGUI::keypress_event()
872 switch( get_keypress() ) {
881 PluginServer* plugin = selected_plugin();
883 remove_plugin = new AWindowRemovePlugin(awindow, plugin);
885 remove_plugin->start();
894 int AWindowGUI::create_custom_xatoms()
896 UpdateAssetsXAtom = create_xatom("CWINDOWGUI_UPDATE_ASSETS");
899 int AWindowGUI::recieve_custom_xatoms(xatom_event *event)
901 if( event->message_type == UpdateAssetsXAtom ) {
908 void AWindowGUI::async_update_assets()
911 event.message_type = UpdateAssetsXAtom;
912 send_custom_xatom(&event);
921 void AWindowGUI::update_folder_list()
923 stop_vicon_drawing();
924 //printf("AWindowGUI::update_folder_list 1\n");
925 for( int i = 0; i < folders.total; i++ ) {
926 AssetPicon *picon = (AssetPicon*)folders.values[i];
929 //printf("AWindowGUI::update_folder_list 1\n");
931 // Search assets for folders
932 for( int i = 0; i < mwindow->edl->folders.total; i++ ) {
933 const char *folder = mwindow->edl->folders.values[i];
935 //printf("AWindowGUI::update_folder_list 1.1\n");
937 for( int j = 0; j < folders.total; j++ ) {
938 AssetPicon *picon = (AssetPicon*)folders.values[j];
939 if( !strcasecmp(picon->get_text(), folder) ) {
947 int aw_folder = folder_number(folder);
948 AssetPicon *picon = aw_folder >= 0 ?
949 new AssetPicon(mwindow, this, aw_folder) :
950 new AssetPicon(mwindow, this, folder, AW_USER_FOLDER);
951 picon->create_objects();
952 folders.append(picon);
954 //printf("AWindowGUI::update_folder_list 1.3\n");
956 //printf("AWindowGUI::update_folder_list 1\n");
957 //for( int i = 0; i < folders.total; i++ )
958 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
961 for( int i = folders.total - 1; i >= 0; i-- ) {
962 AssetPicon *picon = (AssetPicon*)folders.values[i];
963 if( !picon->in_use && !picon->persistent ) {
965 folders.remove_number(i);
968 //for( int i = 0; i < folders.total; i++ )
969 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
970 //printf("AWindowGUI::update_folder_list 2\n");
971 start_vicon_drawing();
974 void AWindowGUI::create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
975 int do_audio, int do_video, int is_realtime, int is_transition)
977 ArrayList<PluginServer*> plugin_list;
978 // Get pointers to plugindb entries
979 mwindow->search_plugindb(do_audio, do_video, is_realtime, is_transition,
982 for( int i = 0; i < plugin_list.total; i++ ) {
983 PluginServer *server = plugin_list.values[i];
984 int visible = plugin_visibility & (1<<server->dir_idx);
985 if( !visible ) continue;
986 // Create new listitem
987 AssetPicon *picon = new AssetPicon(mwindow, this, server);
988 picon->create_objects();
989 output->append(picon);
993 void AWindowGUI::create_label_folder()
996 for( current = mwindow->edl->labels->first; current; current = NEXT ) {
997 AssetPicon *picon = new AssetPicon(mwindow, this, current);
998 picon->create_objects();
999 labellist.append(picon);
1004 void AWindowGUI::update_asset_list()
1006 //printf("AWindowGUI::update_asset_list 1\n");
1007 for( int i = 0; i < assets.total; i++ ) {
1008 AssetPicon *picon = (AssetPicon*)assets.values[i];
1016 //printf("AWindowGUI::update_asset_list 2\n");
1019 // Synchronize EDL clips
1020 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++ ) {
1025 AssetPicon *picon = (AssetPicon*)assets.values[j];
1027 if( picon->id == mwindow->edl->clips.values[i]->id ) {
1028 picon->edl = mwindow->edl->clips.values[i];
1029 picon->set_text(mwindow->edl->clips.values[i]->local_session->clip_title);
1035 // Create new listitem
1037 AssetPicon *picon = new AssetPicon(mwindow,
1039 mwindow->edl->clips.values[i]);
1040 picon->create_objects();
1041 assets.append(picon);
1049 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1052 // Synchronize EDL assets
1053 for( Asset *current = mwindow->edl->assets->first;
1058 // Look for asset in existing listitems
1059 for( int j = 0; j < assets.total && !exists; j++ ) {
1060 AssetPicon *picon = (AssetPicon*)assets.values[j];
1062 if( picon->id == current->id ) {
1063 picon->indexable = current;
1070 // Create new listitem
1072 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1073 AssetPicon *picon = new AssetPicon(mwindow, this, current);
1074 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1075 picon->create_objects();
1076 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1077 assets.append(picon);
1081 mwindow->gui->lock_window("AWindowGUI::update_asset_list");
1082 mwindow->gui->default_message();
1083 mwindow->gui->unlock_window();
1085 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1088 // Synchronize nested EDLs
1089 for( int i = 0; i < mwindow->edl->nested_edls->size(); i++ ) {
1091 Indexable *indexable = mwindow->edl->nested_edls->get(i);
1093 // Look for asset in existing listitems
1094 for( int j = 0; j < assets.total && !exists; j++ ) {
1095 AssetPicon *picon = (AssetPicon*)assets.values[j];
1097 if( picon->id == indexable->id ) {
1098 picon->indexable = indexable;
1105 // Create new listitem
1107 AssetPicon *picon = new AssetPicon(mwindow,
1110 picon->create_objects();
1111 assets.append(picon);
1123 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1124 for( int i = assets.size() - 1; i >= 0; i-- ) {
1125 AssetPicon *picon = (AssetPicon*)assets.get(i);
1126 //printf("AWindowGUI::update_asset_list %s %d\n", picon->asset->path, picon->in_use);
1127 if( !picon->in_use ) {
1129 assets.remove_number(i);
1132 //printf("AWindowGUI::update_asset_list 7 %d\n", assets.total);
1135 void AWindowGUI::update_picon(Indexable *indexable)
1137 //printf("AWindowGUI::update_asset_list 1\n");
1139 for( int i = 0; i < assets.total; i++ ) {
1140 AssetPicon *picon = (AssetPicon*)assets.values[i];
1141 if( picon->indexable == indexable ||
1142 picon->edl == (EDL *)indexable ) {
1143 char name[BCTEXTLEN];
1145 fs.extract_name(name, indexable->path);
1146 picon->set_text(name);
1147 vicon = picon->vicon;
1152 stop_vicon_drawing();
1153 vicon->clear_images();
1154 vicon->reset(indexable->get_frame_rate());
1155 start_vicon_drawing();
1159 void AWindowGUI::sort_assets()
1161 //printf("AWindowGUI::sort_assets 1 %s\n", mwindow->edl->session->current_folder);
1162 switch( mwindow->edl->session->awindow_folder ) {
1163 case AW_AEFFECT_FOLDER:
1164 sort_picons(&aeffects);
1166 case AW_VEFFECT_FOLDER:
1167 sort_picons(&veffects);
1169 case AW_ATRANSITION_FOLDER:
1170 sort_picons(&atransitions);
1172 case AW_VTRANSITION_FOLDER:
1173 sort_picons(&vtransitions);
1175 case AW_LABEL_FOLDER:
1176 sort_picons(&labellist);
1179 sort_picons(&assets);
1185 void AWindowGUI::collect_assets()
1188 mwindow->session->drag_assets->remove_all();
1189 mwindow->session->drag_clips->remove_all();
1192 AssetPicon *result = (AssetPicon*)asset_list->get_selection(0, i++);
1193 if( !result ) break;
1195 if( result->indexable ) mwindow->session->drag_assets->append(result->indexable);
1196 if( result->edl ) mwindow->session->drag_clips->append(result->edl);
1200 void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst,
1201 ArrayList<BC_ListBoxItem*> *src, int folder)
1203 // Remove current pointers
1204 dst[0].remove_all();
1205 dst[1].remove_all_objects();
1207 // Create new pointers
1208 //if( folder ) printf("AWindowGUI::copy_picons 1 %s\n", folder);
1209 for( int i = 0; i < src->total; i++ ) {
1210 AssetPicon *picon = (AssetPicon*)src->values[i];
1211 //printf("AWindowGUI::copy_picons 2 %s\n", picon->asset->folder);
1213 (picon->indexable && picon->indexable->awindow_folder == folder) ||
1214 (picon->edl && picon->edl->local_session->awindow_folder == folder) ) {
1215 BC_ListBoxItem *item2, *item1;
1216 dst[0].append(item1 = picon);
1218 dst[1].append(item2 = new BC_ListBoxItem(picon->edl->local_session->clip_notes));
1220 if( picon->label && picon->label->textstr )
1221 dst[1].append(item2 = new BC_ListBoxItem(picon->label->textstr));
1223 dst[1].append(item2 = new BC_ListBoxItem(""));
1224 item1->set_autoplace_text(1);
1225 item2->set_autoplace_text(1);
1226 //printf("AWindowGUI::copy_picons 3 %s\n", picon->get_text());
1231 void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src)
1233 //printf("AWindowGUI::sort_picons 1\n")
1238 for( int i = 0; i < src->total - 1; i++ ) {
1239 BC_ListBoxItem *item1 = src->values[i];
1240 BC_ListBoxItem *item2 = src->values[i + 1];
1241 item1->set_autoplace_icon(1);
1242 item2->set_autoplace_icon(1);
1243 item1->set_autoplace_text(1);
1244 item2->set_autoplace_text(1);
1245 if( strcmp(item1->get_text(), item2->get_text()) > 0 ) {
1246 src->values[i + 1] = item1;
1247 src->values[i] = item2;
1255 void AWindowGUI::filter_displayed_assets()
1257 //allow_iconlisting = 1;
1258 asset_titles[0] = _("Title");
1259 asset_titles[1] = _("Comments");
1261 switch( mwindow->edl->session->awindow_folder ) {
1262 case AW_AEFFECT_FOLDER:
1263 copy_picons(displayed_assets, &aeffects, AW_NO_FOLDER);
1265 case AW_VEFFECT_FOLDER:
1266 copy_picons(displayed_assets, &veffects, AW_NO_FOLDER);
1268 case AW_ATRANSITION_FOLDER:
1269 copy_picons(displayed_assets, &atransitions, AW_NO_FOLDER);
1271 case AW_VTRANSITION_FOLDER:
1272 copy_picons(displayed_assets, &vtransitions, AW_NO_FOLDER);
1274 case AW_LABEL_FOLDER:
1275 copy_picons(displayed_assets, &labellist, AW_NO_FOLDER);
1276 asset_titles[0] = _("Time Stamps");
1277 asset_titles[1] = _("Title");
1278 //allow_iconlisting = 0;
1281 copy_picons(displayed_assets, &assets, mwindow->edl->session->awindow_folder);
1285 // Ensure the current folder icon is highlighted
1286 for( int i = 0; i < folders.total; i++ )
1287 folders.values[i]->set_selected(0);
1289 folders.values[mwindow->edl->session->awindow_folder]->set_selected(1);
1293 void AWindowGUI::update_assets()
1295 //printf("AWindowGUI::update_assets 1\n");
1296 update_folder_list();
1297 //printf("AWindowGUI::update_assets 2\n");
1298 update_asset_list();
1299 labellist.remove_all_objects();
1300 create_label_folder();
1301 //printf("AWindowGUI::update_assets 3\n");
1302 filter_displayed_assets();
1304 //for( int i = 0; i < folders.total; i++ )
1305 //printf("AWindowGUI::update_assets 4\n");
1306 // printf("AWindowGUI::update_assets %s\n", folders.values[i]->get_text());
1307 if( mwindow->edl->session->folderlist_format != folder_list->get_format() )
1308 folder_list->update_format(mwindow->edl->session->folderlist_format, 0);
1309 folder_list->update(&folders, 0, 0, 1,
1310 folder_list->get_xposition(),
1311 folder_list->get_yposition(),
1313 //printf("AWindowGUI::update_assets 5\n");
1315 if( mwindow->edl->session->assetlist_format != asset_list->get_format() )
1316 asset_list->update_format(mwindow->edl->session->assetlist_format, 0);
1319 //printf("AWindowGUI::update_assets 6 %d\n", displayed_assets[0].total);
1320 asset_list->update(displayed_assets, asset_titles,
1321 mwindow->edl->session->asset_columns, ASSET_COLUMNS,
1322 asset_list->get_xposition(),
1323 asset_list->get_yposition(),
1325 asset_list->center_selection();
1326 //printf("AWindowGUI::update_assets 7\n");
1329 //printf("AWindowGUI::update_assets 8\n");
1333 void AWindowGUI::update_effects()
1335 aeffects.remove_all_objects();
1336 create_persistent_folder(&aeffects, 1, 0, 1, 0);
1337 veffects.remove_all_objects();
1338 create_persistent_folder(&veffects, 0, 1, 1, 0);
1339 atransitions.remove_all_objects();
1340 create_persistent_folder(&atransitions, 1, 0, 0, 1);
1341 vtransitions.remove_all_objects();
1342 create_persistent_folder(&vtransitions, 0, 1, 0, 1);
1345 int AWindowGUI::folder_number(const char *name)
1347 for( int i = 0; i < AWINDOW_FOLDERS; i++ ) {
1348 if( !strcasecmp(name, folder_names[i]) ) return i;
1350 return AW_NO_FOLDER;
1353 int AWindowGUI::drag_motion()
1355 if( get_hidden() ) return 0;
1361 int AWindowGUI::drag_stop()
1363 if( get_hidden() ) return 0;
1368 Indexable* AWindowGUI::selected_asset()
1370 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1371 return picon ? picon->indexable : 0;
1374 PluginServer* AWindowGUI::selected_plugin()
1376 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1377 return picon ? picon->plugin : 0;
1380 AssetPicon* AWindowGUI::selected_folder()
1382 AssetPicon *picon = (AssetPicon*)folder_list->get_selection(0, 0);
1393 AWindowDivider::AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1394 : BC_SubWindow(x, y, w, h)
1396 this->mwindow = mwindow;
1399 AWindowDivider::~AWindowDivider()
1403 int AWindowDivider::button_press_event()
1405 if( is_event_win() && cursor_inside() ) {
1406 mwindow->session->current_operation = DRAG_PARTITION;
1412 int AWindowDivider::cursor_motion_event()
1414 if( mwindow->session->current_operation == DRAG_PARTITION ) {
1416 int wmax = mwindow->session->awindow_w - mwindow->theme->adivider_w - wmin;
1417 int fw = gui->get_relative_cursor_x();
1418 if( fw > wmax ) fw = wmax;
1419 if( fw < wmin ) fw = wmin;
1420 mwindow->session->afolders_w = fw;
1421 mwindow->theme->get_awindow_sizes(gui);
1422 gui->reposition_objects();
1428 int AWindowDivider::button_release_event()
1430 if( mwindow->session->current_operation == DRAG_PARTITION ) {
1431 mwindow->session->current_operation = NO_OPERATION;
1442 AWindowFolders::AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1443 : BC_ListBox(x, y, w, h,
1444 mwindow->edl->session->folderlist_format == ASSETS_ICONS ?
1445 LISTBOX_ICONS : LISTBOX_TEXT,
1446 &gui->folders, // Each column has an ArrayList of BC_ListBoxItems.
1447 0, // Titles for columns. Set to 0 for no titles
1448 0, // width of each column
1449 1, // Total columns.
1450 0, // Pixel of top of window.
1451 0, // If this listbox is a popup window
1452 LISTBOX_SINGLE, // Select one item or multiple items
1453 ICON_TOP, // Position of icon relative to text of each item
1456 this->mwindow = mwindow;
1461 AWindowFolders::~AWindowFolders()
1465 int AWindowFolders::selection_changed()
1467 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1469 gui->stop_vicon_drawing();
1471 if( get_button_down() && get_buttonpress() == 3 ) {
1472 gui->folderlist_menu->update_titles();
1473 gui->folderlist_menu->activate_menu();
1476 mwindow->edl->session->awindow_folder = picon->foldernum;
1477 //printf("AWindowFolders::selection_changed 1\n");
1478 gui->asset_list->draw_background();
1479 gui->async_update_assets();
1481 gui->start_vicon_drawing();
1486 int AWindowFolders::button_press_event()
1490 result = BC_ListBox::button_press_event();
1493 if( get_buttonpress() == 3 && is_event_win() && cursor_inside() ) {
1494 gui->folderlist_menu->update_titles();
1495 gui->folderlist_menu->activate_menu();
1510 AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1511 : BC_ListBox(x, y, w, h,
1512 (mwindow->edl->session->assetlist_format == ASSETS_ICONS && gui->allow_iconlisting ) ?
1513 LISTBOX_ICONS : LISTBOX_TEXT,
1514 &gui->assets, // Each column has an ArrayList of BC_ListBoxItems.
1515 gui->asset_titles,// Titles for columns. Set to 0 for no titles
1516 mwindow->edl->session->asset_columns, // width of each column
1517 1, // Total columns.
1518 0, // Pixel of top of window.
1519 0, // If this listbox is a popup window
1520 LISTBOX_MULTIPLE, // Select one item or multiple items
1521 ICON_TOP, // Position of icon relative to text of each item
1524 this->mwindow = mwindow;
1527 set_scroll_stretch(1, 1);
1530 AWindowAssets::~AWindowAssets()
1534 int AWindowAssets::button_press_event()
1538 result = BC_ListBox::button_press_event();
1540 if( !result && get_buttonpress() == 3 && is_event_win() && cursor_inside() ) {
1541 BC_ListBox::deactivate_selection();
1542 int folder = mwindow->edl->session->awindow_folder;
1544 case AW_AEFFECT_FOLDER:
1545 case AW_VEFFECT_FOLDER:
1546 case AW_ATRANSITION_FOLDER:
1547 case AW_VTRANSITION_FOLDER:
1548 gui->effectlist_menu->update();
1549 gui->effectlist_menu->activate_menu();
1551 case AW_LABEL_FOLDER:
1552 gui->labellist_menu->update();
1553 gui->labellist_menu->activate_menu();
1555 case AW_CLIP_FOLDER:
1556 gui->cliplist_menu->update();
1557 gui->cliplist_menu->activate_menu();
1559 case AW_MEDIA_FOLDER:
1560 gui->assetlist_menu->update_titles();
1561 gui->assetlist_menu->activate_menu();
1572 int AWindowAssets::handle_event()
1574 //printf("AWindowAssets::handle_event 1 %d %d\n", get_buttonpress(), get_selection(0, 0));
1575 AssetPicon *asset_picon = (AssetPicon *)get_selection(0, 0);
1576 if( !asset_picon ) return 0;
1577 switch( mwindow->edl->session->awindow_folder ) {
1578 case AW_AEFFECT_FOLDER:
1579 case AW_VEFFECT_FOLDER:
1580 case AW_ATRANSITION_FOLDER:
1581 case AW_VTRANSITION_FOLDER: return 1;
1583 VWindow *vwindow = mwindow->vwindows.size() > DEFAULT_VWINDOW ?
1584 mwindow->vwindows.get(DEFAULT_VWINDOW) : 0;
1585 if( !vwindow || !vwindow->is_running() ) return 1;
1586 //printf("AWindowAssets::handle_event 2 %d %d\n", get_buttonpress(), get_selection(0, 0));
1588 vwindow->gui->lock_window("AWindowAssets::handle_event");
1589 if( asset_picon->indexable )
1590 vwindow->change_source(asset_picon->indexable);
1591 else if( asset_picon->edl )
1592 vwindow->change_source(asset_picon->edl);
1593 vwindow->gui->unlock_window();
1597 int AWindowAssets::selection_changed()
1599 // Show popup window
1601 if( get_button_down() && get_buttonpress() == 3 &&
1602 (item = (AssetPicon*)get_selection(0, 0)) ) {
1603 int folder = mwindow->edl->session->awindow_folder;
1605 case AW_AEFFECT_FOLDER:
1606 case AW_VEFFECT_FOLDER:
1607 case AW_ATRANSITION_FOLDER:
1608 case AW_VTRANSITION_FOLDER:
1609 gui->effectlist_menu->update();
1610 gui->effectlist_menu->activate_menu();
1612 case AW_LABEL_FOLDER:
1613 if( !item->label ) break;
1614 gui->label_menu->activate_menu();
1616 case AW_CLIP_FOLDER:
1617 if( !item->indexable && !item->edl ) break;
1618 gui->clip_menu->update();
1619 gui->clip_menu->activate_menu();
1622 if( !item->indexable && !item->edl ) break;
1623 gui->asset_menu->update();
1624 gui->asset_menu->activate_menu();
1628 BC_ListBox::deactivate_selection();
1631 else if( get_button_down() && get_buttonpress() == 1 &&
1632 (item = (AssetPicon*)get_selection(0, 0)) ) {
1634 if( !gui->vicon_thread->viewing ) {
1635 vicon = item->vicon;
1637 gui->vicon_thread->set_view_popup(vicon);
1643 void AWindowAssets::draw_background()
1645 clear_box(0,0,get_w(),get_h(),get_bg_surface());
1646 set_color(BC_WindowBase::get_resources()->audiovideo_color);
1647 set_font(LARGEFONT);
1648 int aw_folder = mwindow->edl->session->awindow_folder;
1649 if( aw_folder < 0 ) return;
1650 const char *aw_name = _(AWindowGUI::folder_names[aw_folder]);
1651 draw_text(get_w() - get_text_width(LARGEFONT, aw_name) - 4, 30,
1652 aw_name, -1, get_bg_surface());
1655 int AWindowAssets::drag_start_event()
1657 int collect_pluginservers = 0;
1658 int collect_assets = 0;
1660 if( BC_ListBox::drag_start_event() ) {
1661 switch( mwindow->edl->session->awindow_folder ) {
1662 case AW_AEFFECT_FOLDER:
1663 mwindow->session->current_operation = DRAG_AEFFECT;
1664 collect_pluginservers = 1;
1666 case AW_VEFFECT_FOLDER:
1667 mwindow->session->current_operation = DRAG_VEFFECT;
1668 collect_pluginservers = 1;
1670 case AW_ATRANSITION_FOLDER:
1671 mwindow->session->current_operation = DRAG_ATRANSITION;
1672 collect_pluginservers = 1;
1674 case AW_VTRANSITION_FOLDER:
1675 mwindow->session->current_operation = DRAG_VTRANSITION;
1676 collect_pluginservers = 1;
1678 case AW_LABEL_FOLDER:
1682 mwindow->session->current_operation = DRAG_ASSET;
1687 if( collect_pluginservers ) {
1689 mwindow->session->drag_pluginservers->remove_all();
1692 AssetPicon *result = (AssetPicon*)get_selection(0, i++);
1693 if( !result ) break;
1695 mwindow->session->drag_pluginservers->append(result->plugin);
1699 if( collect_assets ) {
1700 gui->collect_assets();
1708 int AWindowAssets::drag_motion_event()
1710 BC_ListBox::drag_motion_event();
1713 mwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1714 mwindow->gui->drag_motion();
1715 mwindow->gui->unlock_window();
1717 for( int i = 0; i < mwindow->vwindows.size(); i++ ) {
1718 VWindow *vwindow = mwindow->vwindows.get(i);
1719 if( !vwindow->is_running() ) continue;
1720 vwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1721 vwindow->gui->drag_motion();
1722 vwindow->gui->unlock_window();
1725 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1726 mwindow->cwindow->gui->drag_motion();
1727 mwindow->cwindow->gui->unlock_window();
1729 lock_window("AWindowAssets::drag_motion_event");
1733 int AWindowAssets::drag_stop_event()
1737 result = gui->drag_stop();
1742 mwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1743 result = mwindow->gui->drag_stop();
1744 mwindow->gui->unlock_window();
1748 for( int i = 0; !result && i < mwindow->vwindows.size(); i++ ) {
1749 VWindow *vwindow = mwindow->vwindows.get(i);
1750 if( !vwindow ) continue;
1751 if( !vwindow->is_running() ) continue;
1752 if( vwindow->gui->is_hidden() ) continue;
1753 vwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1754 if( vwindow->gui->cursor_above() &&
1755 vwindow->gui->get_cursor_over_window() ) {
1756 result = vwindow->gui->drag_stop();
1758 vwindow->gui->unlock_window();
1763 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1764 result = mwindow->cwindow->gui->drag_stop();
1765 mwindow->cwindow->gui->unlock_window();
1768 lock_window("AWindowAssets::drag_stop_event");
1770 if( result ) get_drag_popup()->set_animation(0);
1772 BC_ListBox::drag_stop_event();
1773 mwindow->session->current_operation = ::NO_OPERATION; // since NO_OPERATION is also defined in listbox, we have to reach for global scope...
1777 int AWindowAssets::column_resize_event()
1779 mwindow->edl->session->asset_columns[0] = get_column_width(0);
1780 mwindow->edl->session->asset_columns[1] = get_column_width(1);
1784 int AWindowAssets::focus_in_event()
1786 gui->start_vicon_drawing();
1790 int AWindowAssets::focus_out_event()
1792 gui->stop_vicon_drawing();
1793 return BC_ListBox::focus_out_event();
1807 AWindowNewFolder::AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1808 : BC_Button(x, y, mwindow->theme->newbin_data)
1810 this->mwindow = mwindow;
1812 set_tooltip(_("New bin"));
1815 int AWindowNewFolder::handle_event()
1817 gui->newfolder_thread->start_new_folder();
1821 AWindowDeleteFolder::AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1822 : BC_Button(x, y, mwindow->theme->deletebin_data)
1824 this->mwindow = mwindow;
1826 set_tooltip(_("Delete bin"));
1829 int AWindowDeleteFolder::handle_event()
1831 if( gui->folder_list->get_selection(0, 0) ) {
1832 BC_ListBoxItem *folder = gui->folder_list->get_selection(0, 0);
1833 mwindow->delete_folder(folder->get_text());
1838 AWindowRenameFolder::AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1839 : BC_Button(x, y, mwindow->theme->renamebin_data)
1841 this->mwindow = mwindow;
1843 set_tooltip(_("Rename bin"));
1846 int AWindowRenameFolder::handle_event()
1851 AWindowDeleteDisk::AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1852 : BC_Button(x, y, mwindow->theme->deletedisk_data)
1854 this->mwindow = mwindow;
1856 set_tooltip(_("Delete asset from disk"));
1859 int AWindowDeleteDisk::handle_event()
1864 AWindowDeleteProject::AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1865 : BC_Button(x, y, mwindow->theme->deleteproject_data)
1867 this->mwindow = mwindow;
1869 set_tooltip(_("Delete asset from project"));
1872 int AWindowDeleteProject::handle_event()
1877 AWindowInfo::AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1878 : BC_Button(x, y, mwindow->theme->infoasset_data)
1880 this->mwindow = mwindow;
1882 set_tooltip(_("Edit information on asset"));
1885 int AWindowInfo::handle_event()
1888 gui->get_abs_cursor_xy(cur_x, cur_y, 0);
1889 gui->awindow->asset_edit->edit_asset(gui->selected_asset(), cur_x, cur_y);
1893 AWindowRedrawIndex::AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1894 : BC_Button(x, y, mwindow->theme->redrawindex_data)
1896 this->mwindow = mwindow;
1898 set_tooltip(_("Redraw index"));
1901 int AWindowRedrawIndex::handle_event()
1906 AWindowPaste::AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1907 : BC_Button(x, y, mwindow->theme->pasteasset_data)
1909 this->mwindow = mwindow;
1911 set_tooltip(_("Paste asset on recordable tracks"));
1914 int AWindowPaste::handle_event()
1919 AWindowAppend::AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1920 : BC_Button(x, y, mwindow->theme->appendasset_data)
1922 this->mwindow = mwindow;
1924 set_tooltip(_("Append asset in new tracks"));
1927 int AWindowAppend::handle_event()
1932 AWindowView::AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1933 : BC_Button(x, y, mwindow->theme->viewasset_data)
1935 this->mwindow = mwindow;
1937 set_tooltip(_("View asset"));
1940 int AWindowView::handle_event()
1945 AddTools::AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, const char *title)
1946 : BC_PopupMenu(x, y, BC_Title::calculate_w(gui, title, MEDIUMFONT)+8, title, -1, 0, 4)
1948 this->mwindow = mwindow;
1952 void AddTools::create_objects()
1955 add_item(new AddPluginItem(this, "ladspa", PLUGIN_LADSPA_ID));
1956 vis |= 1 << PLUGIN_LADSPA_ID;
1957 add_item(new AddPluginItem(this, "ffmpeg", PLUGIN_FFMPEG_ID));
1958 vis |= 1 << PLUGIN_FFMPEG_ID;
1959 for( int i=0; i<MWindow::plugindb->size(); ++i ) {
1960 PluginServer *plugin = MWindow::plugindb->get(i);
1961 if( !plugin->audio && !plugin->video ) continue;
1962 int idx = plugin->dir_idx;
1963 uint32_t msk = 1 << idx;
1964 if( (msk & vis) != 0 ) continue;
1966 char parent[BCTEXTLEN];
1967 strcpy(parent, plugin->path);
1968 char *bp = strrchr(parent, '/');
1969 if( bp ) { *bp = 0; bp = strrchr(parent, '/'); }
1970 if( !bp ) bp = parent; else ++bp;
1971 add_item(new AddPluginItem(this, bp, idx));
1976 // plugin_dirs list from toplevel makefile include plugin_defs
1980 N_("audio_transitions")
1987 N_("video_transitions")
1990 AddPluginItem::AddPluginItem(AddTools *menu, char const *text, int idx)
1991 : BC_MenuItem(_(text))
1995 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
1996 int chk = (msk & vis) ? 1 : 0;
2000 int AddPluginItem::handle_event()
2002 int chk = get_checked() ^ 1;
2004 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
2005 menu->gui->plugin_visibility = chk ? vis | msk : vis & ~msk;
2006 menu->gui->update_effects();
2007 menu->gui->save_defaults(menu->mwindow->defaults);
2008 menu->gui->async_update_assets();
2012 AVIconDrawing::AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images)
2013 : BC_Toggle(x, y, images, agui->vicon_drawing)
2016 set_tooltip(_("draw vicons"));
2019 void AVIconDrawing::calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh)
2021 int text_line = -1, toggle_x = -1, toggle_y = -1;
2022 int text_x = -1, text_y = -1, text_w = -1, text_h = -1;
2023 BC_Toggle::calculate_extents(agui, images, 1,
2024 &text_line, ww, hh, &toggle_x, &toggle_y,
2025 &text_x, &text_y, &text_w, &text_h, "", MEDIUMFONT);
2028 AVIconDrawing::~AVIconDrawing()
2032 int AVIconDrawing::handle_event()
2034 agui->vicon_drawing = get_value();
2035 if( agui->vicon_drawing )
2036 agui->start_vicon_drawing();
2038 agui->stop_vicon_drawing();
2043 AWindowListFormat::AWindowListFormat(MWindow *mwindow, AWindowGUI *gui)
2046 this->mwindow = mwindow;
2050 int AWindowListFormat::handle_event()
2052 gui->stop_vicon_drawing();
2054 EDLSession *session = mwindow->edl->session;
2055 switch( session->assetlist_format ) {
2057 session->assetlist_format = ASSETS_ICONS;
2060 session->assetlist_format = ASSETS_TEXT;
2064 gui->asset_list->update_format(session->assetlist_format, 1);
2065 if( !mwindow->awindow->gui->allow_iconlisting ) {
2066 mwindow->edl->session->assetlist_format = ASSETS_TEXT;
2069 gui->start_vicon_drawing();
2073 void AWindowListFormat::update()
2075 set_text(mwindow->edl->session->assetlist_format == ASSETS_TEXT ?
2076 (char*)_("Display icons") : (char*)_("Display text"));
2079 AWindowListSort::AWindowListSort(MWindow *mwindow, AWindowGUI *gui)
2080 : BC_MenuItem(_("Sort items"))
2082 this->mwindow = mwindow;
2086 int AWindowListSort::handle_event()