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"
39 #include "filesystem.h"
40 #include "folderlistmenu.h"
41 #include "indexable.h"
45 #include "labelpopup.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__);
247 fs.extract_name(name, indexable->path);
251 if( indexable && indexable->is_asset ) {
252 if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__);
253 Asset *asset = (Asset*)indexable;
254 if( asset->video_data ) {
255 if( mwindow->preferences->use_thumbnails ) {
256 gui->unlock_window();
257 if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__);
258 File *file = mwindow->video_cache->check_out(asset,
261 if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__);
264 int height = asset->height > 0 ? asset->height : 1;
265 pixmap_w = pixmap_h * asset->width / height;
268 file->set_video_position(0, 0);
270 if( gui->temp_picon &&
271 (gui->temp_picon->get_w() != asset->width ||
272 gui->temp_picon->get_h() != asset->height) ) {
273 delete gui->temp_picon;
277 if( !gui->temp_picon ) {
278 gui->temp_picon = new VFrame(0, -1,
279 asset->width, asset->height,
282 { char string[BCTEXTLEN];
283 sprintf(string, _("Reading %s"), name);
284 mwindow->gui->lock_window("AssetPicon::create_objects");
285 mwindow->gui->show_message(string);
286 mwindow->gui->unlock_window(); }
287 file->read_frame(gui->temp_picon);
288 if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__);
289 mwindow->video_cache->check_in(asset);
291 gui->lock_window("AssetPicon::create_objects 1");
292 icon = new BC_Pixmap(gui, pixmap_w, pixmap_h);
293 icon->draw_vframe(gui->temp_picon,
294 0, 0, pixmap_w, pixmap_h, 0, 0);
295 //printf("%d %d\n", gui->temp_picon->get_w(), gui->temp_picon->get_h());
296 icon_vframe = new VFrame(0,
297 -1, pixmap_w, pixmap_h, BC_RGB888, -1);
298 icon_vframe->transfer_from(gui->temp_picon);
300 double framerate = asset->get_frame_rate();
301 if( !framerate ) framerate = VICON_RATE;
302 int64_t frames = asset->get_video_frames();
303 double secs = frames / framerate;
304 if( secs > 5 ) secs = 5;
305 int64_t length = secs * gui->vicon_thread->refresh_rate;
306 vicon = new AssetVIcon(this, pixmap_w, pixmap_h, framerate, length);
307 gui->vicon_thread->add_vicon(vicon);
308 if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__);
312 gui->lock_window("AssetPicon::create_objects 2");
313 icon = gui->video_icon;
314 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
318 icon = gui->video_icon;
319 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
323 if( asset->audio_data ) {
324 icon = gui->audio_icon;
325 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND];
327 //printf("AssetPicon::create_objects 2\n");
329 if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__);
332 if( indexable && !indexable->is_asset ) {
333 icon = gui->video_icon;
334 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
338 //printf("AssetPicon::create_objects 4 %s\n", edl->local_session->clip_title);
339 set_text(strcpy(name, edl->local_session->clip_title));
340 icon = gui->clip_icon;
341 icon_vframe = mwindow->theme->get_image("clip_icon");
345 strcpy(name, _(plugin->title));
347 icon_vframe = plugin->get_picon();
349 icon = gui->create_pixmap(icon_vframe);
350 else if( plugin->audio ) {
351 if( plugin->transition ) {
352 icon = gui->atransition_icon;
353 icon_vframe = gui->atransition_vframe;
355 else if( plugin->is_ffmpeg() ) {
356 icon = gui->ff_aud_icon;
357 icon_vframe = gui->ff_aud_vframe;
359 else if( plugin->is_ladspa() ) {
360 icon = gui->ladspa_icon;
361 icon_vframe = gui->ladspa_vframe;
364 icon = gui->aeffect_icon;
365 icon_vframe = gui->aeffect_vframe;
368 else if( plugin->video ) {
369 if( plugin->transition ) {
370 icon = gui->vtransition_icon;
371 icon_vframe = gui->vtransition_vframe;
373 else if( plugin->is_ffmpeg() ) {
374 icon = gui->ff_vid_icon;
375 icon_vframe = gui->ff_vid_vframe;
378 icon = gui->veffect_icon;
379 icon_vframe = gui->veffect_vframe;
387 mwindow->edl->session->time_format,
388 mwindow->edl->session->sample_rate,
389 mwindow->edl->session->frame_rate,
390 mwindow->edl->session->frames_per_foot);
392 icon = gui->label_icon;
393 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_LABEL];
395 set_icon_vframe(icon_vframe);
398 icon = gui->file_icon;
399 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN];
402 set_icon_vframe(icon_vframe);
404 if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__);
412 AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow)
413 : BC_Window(_(PROGRAM_NAME ": Resources"),
414 mwindow->session->awindow_x, mwindow->session->awindow_y,
415 mwindow->session->awindow_w, mwindow->session->awindow_h,
418 // printf("AWindowGUI::AWindowGUI %d %d %d %d\n",
419 // mwindow->session->awindow_x,
420 // mwindow->session->awindow_y,
421 // mwindow->session->awindow_w,
422 // mwindow->session->awindow_h);
423 this->mwindow = mwindow;
424 this->awindow = awindow;
431 atransition_icon = 0; atransition_vframe = 0;
432 vtransition_icon = 0; vtransition_vframe = 0;
433 aeffect_icon = 0; aeffect_vframe = 0;
434 ladspa_icon = 0; ladspa_vframe = 0;
435 veffect_icon = 0; veffect_vframe = 0;
436 ff_aud_icon = 0; ff_aud_vframe = 0;
437 ff_vid_icon = 0; ff_vid_vframe = 0;
438 plugin_visibility = ((uint64_t)1<<(8*sizeof(uint64_t)-1))-1;
439 newfolder_thread = 0;
446 allow_iconlisting = 1;
452 AWindowGUI::~AWindowGUI()
454 assets.remove_all_objects();
455 folders.remove_all_objects();
456 aeffects.remove_all_objects();
457 veffects.remove_all_objects();
458 atransitions.remove_all_objects();
459 vtransitions.remove_all_objects();
460 labellist.remove_all_objects();
461 displayed_assets[1].remove_all_objects();
470 delete atransition_icon;
471 delete vtransition_icon;
474 delete ladspa_vframe;
476 delete ff_aud_vframe;
478 delete ff_vid_vframe;
480 delete newfolder_thread;
484 delete assetlist_menu;
485 delete cliplist_menu;
486 delete labellist_menu;
487 delete folderlist_menu;
488 if( temp_picon ) delete temp_picon;
489 delete remove_plugin;
492 bool AWindowGUI::protected_pixmap(BC_Pixmap *icon)
494 return icon == file_icon ||
495 icon == folder_icon ||
496 icon == audio_icon ||
497 icon == video_icon ||
499 icon == label_icon ||
500 icon == vtransition_icon ||
501 icon == atransition_icon ||
502 icon == veffect_icon ||
503 icon == aeffect_icon ||
504 icon == ladspa_icon ||
505 icon == ff_aud_icon ||
509 void AWindowGUI::create_objects()
513 lock_window("AWindowGUI::create_objects");
515 //printf("AWindowGUI::create_objects 1\n");
516 asset_titles[0] = _("Title");
517 asset_titles[1] = _("Comments");
521 set_icon(mwindow->theme->get_image("awindow_icon"));
522 file_icon = new BC_Pixmap(this,
523 BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN],
526 folder_icon = new BC_Pixmap(this,
527 BC_WindowBase::get_resources()->type_to_icon[ICON_FOLDER],
530 audio_icon = new BC_Pixmap(this,
531 BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND],
534 video_icon = new BC_Pixmap(this,
535 BC_WindowBase::get_resources()->type_to_icon[ICON_FILM],
538 label_icon = new BC_Pixmap(this,
539 BC_WindowBase::get_resources()->type_to_icon[ICON_LABEL],
544 clip_vframe = mwindow->theme->get_image("clip_icon");
545 clip_icon = new BC_Pixmap(this, clip_vframe, PIXMAP_ALPHA);
546 atransition_vframe = mwindow->theme->get_image("atransition_icon");
547 atransition_icon = new BC_Pixmap(this, atransition_vframe, PIXMAP_ALPHA);
548 vtransition_vframe = mwindow->theme->get_image("vtransition_icon");
549 vtransition_icon = new BC_Pixmap(this, vtransition_vframe, PIXMAP_ALPHA);
550 aeffect_vframe = mwindow->theme->get_image("aeffect_icon");
551 aeffect_icon = new BC_Pixmap(this, aeffect_vframe, PIXMAP_ALPHA);
552 ladspa_vframe = new VFramePng(lad_picon_png);
553 ladspa_icon = new BC_Pixmap(this, ladspa_vframe, PIXMAP_ALPHA);
554 ff_aud_vframe = new VFramePng(ff_audio_png);
555 ff_aud_icon = new BC_Pixmap(this, ff_aud_vframe, PIXMAP_ALPHA);
556 ff_vid_vframe = new VFramePng(ff_video_png);
557 ff_vid_icon = new BC_Pixmap(this, ff_vid_vframe, PIXMAP_ALPHA);
558 veffect_vframe = mwindow->theme->get_image("veffect_icon");
559 veffect_icon = new BC_Pixmap(this, veffect_vframe, PIXMAP_ALPHA);
564 folders.append(picon = new AssetPicon(mwindow, this, AW_AEFFECT_FOLDER));
565 picon->persistent = 1;
566 folders.append(picon = new AssetPicon(mwindow, this, AW_VEFFECT_FOLDER));
567 picon->persistent = 1;
568 folders.append(picon = new AssetPicon(mwindow, this, AW_ATRANSITION_FOLDER));
569 picon->persistent = 1;
570 folders.append(picon = new AssetPicon(mwindow, this, AW_VTRANSITION_FOLDER));
571 picon->persistent = 1;
572 folders.append(picon = new AssetPicon(mwindow, this, AW_LABEL_FOLDER));
573 picon->persistent = 1;
574 folders.append(picon = new AssetPicon(mwindow, this, AW_CLIP_FOLDER));
575 picon->persistent = 1;
576 folders.append(picon = new AssetPicon(mwindow, this, AW_MEDIA_FOLDER));
577 picon->persistent = 1;
579 create_label_folder();
582 mwindow->theme->get_awindow_sizes(this);
583 load_defaults(mwindow->defaults);
586 add_subwindow(asset_list = new AWindowAssets(mwindow,
588 mwindow->theme->alist_x,
589 mwindow->theme->alist_y,
590 mwindow->theme->alist_w,
591 mwindow->theme->alist_h));
593 vicon_thread = new VIconThread(asset_list);
594 vicon_thread->start();
597 add_subwindow(divider = new AWindowDivider(mwindow,
599 mwindow->theme->adivider_x,
600 mwindow->theme->adivider_y,
601 mwindow->theme->adivider_w,
602 mwindow->theme->adivider_h));
605 divider->set_cursor(HSEPARATE_CURSOR, 0, 0);
608 int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y;
609 int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h;
610 VFrame **images = mwindow->theme->get_image_set("playpatch_data");
611 AVIconDrawing::calculate_geometry(this, images, &avicon_w, &avicon_h);
612 add_subwindow(avicon_drawing = new AVIconDrawing(this, fw-avicon_w, fy, images));
613 add_subwindow(add_tools = new AddTools(mwindow, this, fx, fy, _("Visibility")));
614 add_tools->create_objects();
615 fy += add_tools->get_h(); fh -= add_tools->get_h();
617 add_subwindow(folder_list = new AWindowFolders(mwindow,
618 this, fx, fy, fw, fh));
623 //int x = mwindow->theme->abuttons_x;
624 //int y = mwindow->theme->abuttons_y;
628 newfolder_thread = new NewFolderThread(mwindow, this);
630 add_subwindow(asset_menu = new AssetPopup(mwindow, this));
631 asset_menu->create_objects();
632 add_subwindow(clip_menu = new ClipPopup(mwindow, this));
633 clip_menu->create_objects();
634 add_subwindow(label_menu = new LabelPopup(mwindow, this));
635 label_menu->create_objects();
637 add_subwindow(assetlist_menu = new AssetListMenu(mwindow, this));
638 assetlist_menu->create_objects();
639 add_subwindow(cliplist_menu = new ClipListMenu(mwindow, this));
640 cliplist_menu->create_objects();
641 add_subwindow(labellist_menu = new LabelListMenu(mwindow, this));
642 labellist_menu->create_objects();
645 add_subwindow(folderlist_menu = new FolderListMenu(mwindow, this));
646 folderlist_menu->create_objects();
648 //printf("AWindowGUI::create_objects 2\n");
650 create_custom_xatoms();
654 int AWindowGUI::resize_event(int w, int h)
656 mwindow->session->awindow_x = get_x();
657 mwindow->session->awindow_y = get_y();
658 mwindow->session->awindow_w = w;
659 mwindow->session->awindow_h = h;
661 mwindow->theme->get_awindow_sizes(this);
662 mwindow->theme->draw_awindow_bg(this);
663 reposition_objects();
665 // int x = mwindow->theme->abuttons_x;
666 // int y = mwindow->theme->abuttons_y;
667 // new_bin->reposition_window(x, y);
668 // x += new_bin->get_w();
669 // delete_bin->reposition_window(x, y);
670 // x += delete_bin->get_w();
671 // rename_bin->reposition_window(x, y);
672 // x += rename_bin->get_w();
673 // delete_disk->reposition_window(x, y);
674 // x += delete_disk->get_w();
675 // delete_project->reposition_window(x, y);
676 // x += delete_project->get_w();
677 // info->reposition_window(x, y);
678 // x += info->get_w();
679 // redraw_index->reposition_window(x, y);
680 // x += redraw_index->get_w();
681 // paste->reposition_window(x, y);
682 // x += paste->get_w();
683 // append->reposition_window(x, y);
684 // x += append->get_w();
685 // view->reposition_window(x, y);
687 BC_WindowBase::resize_event(w, h);
691 int AWindowGUI::translation_event()
693 mwindow->session->awindow_x = get_x();
694 mwindow->session->awindow_y = get_y();
698 void AWindowGUI::reposition_objects()
700 asset_list->reposition_window(
701 mwindow->theme->alist_x, mwindow->theme->alist_y,
702 mwindow->theme->alist_w, mwindow->theme->alist_h);
703 divider->reposition_window(
704 mwindow->theme->adivider_x, mwindow->theme->adivider_y,
705 mwindow->theme->adivider_w, mwindow->theme->adivider_h);
706 int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y;
707 int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h;
708 add_tools->resize_event(fw-avicon_w, add_tools->get_h());
709 avicon_drawing->reposition_window(fw-avicon_w, fy);
710 fy += add_tools->get_h(); fh -= add_tools->get_h();
711 folder_list->reposition_window(fx, fy, fw, fh);
714 int AWindowGUI::save_defaults(BC_Hash *defaults)
716 defaults->update("PLUGIN_VISIBILTY", plugin_visibility);
717 defaults->update("VICON_DRAWING", vicon_drawing);
721 int AWindowGUI::load_defaults(BC_Hash *defaults)
723 plugin_visibility = defaults->get("PLUGIN_VISIBILTY", plugin_visibility);
724 vicon_drawing = defaults->get("VICON_DRAWING", vicon_drawing);
728 int AWindowGUI::close_event()
731 mwindow->session->show_awindow = 0;
734 mwindow->gui->lock_window("AWindowGUI::close_event");
735 mwindow->gui->mainmenu->show_awindow->set_checked(0);
736 mwindow->gui->unlock_window();
738 lock_window("AWindowGUI::close_event");
739 save_defaults(mwindow->defaults);
740 mwindow->save_defaults();
744 void AWindowGUI::start_vicon_drawing()
746 if( !vicon_drawing ) return;
747 if( mwindow->edl->session->awindow_folder != AW_MEDIA_FOLDER ) return;
748 if( mwindow->edl->session->assetlist_format != ASSETS_ICONS ) return;
749 vicon_thread->start_drawing();
752 void AWindowGUI::stop_vicon_drawing()
754 vicon_thread->stop_drawing();
757 AWindowRemovePluginGUI::
758 AWindowRemovePluginGUI(AWindow *awindow, AWindowRemovePlugin *thread,
759 int x, int y, PluginServer *plugin)
760 : BC_Window(_(PROGRAM_NAME ": Remove plugin"), x,y, 500,200, 50, 50, 1, 0, 1, -1, "", 1)
762 this->awindow = awindow;
763 this->thread = thread;
764 this->plugin = plugin;
765 VFrame *vframe = plugin->get_picon();
766 icon = vframe ? create_pixmap(vframe) : 0;
767 plugin_list.append(new BC_ListBoxItem(plugin->title, icon));
770 AWindowRemovePluginGUI::
771 ~AWindowRemovePluginGUI()
773 if( !awindow->gui->protected_pixmap(icon) )
775 plugin_list.remove_all();
778 void AWindowRemovePluginGUI::create_objects()
780 BC_Button *ok_button = new BC_OKButton(this);
781 add_subwindow(ok_button);
782 BC_Button *cancel_button = new BC_CancelButton(this);
783 add_subwindow(cancel_button);
785 BC_Title *title = new BC_Title(x, y, _("remove plugin?"));
786 add_subwindow(title);
787 y += title->get_h() + 5;
788 list = new BC_ListBox(x, y,
789 get_w() - 20, ok_button->get_y() - y - 5, LISTBOX_TEXT, &plugin_list,
790 0, 0, 1, 0, 0, LISTBOX_SINGLE, ICON_LEFT, 0);
795 int AWindowRemovePlugin::remove_plugin(PluginServer *plugin, ArrayList<BC_ListBoxItem*> &folder)
798 for( int i=0; i<folder.size(); ) {
799 AssetPicon *picon = (AssetPicon *)folder[i];
800 if( picon->plugin == plugin ) {
801 folder.remove_object_number(i);
810 void AWindowRemovePlugin::handle_close_event(int result)
813 printf(_("remove %s\n"), plugin->path);
814 ArrayList<BC_ListBoxItem*> *folder =
815 plugin->audio ? plugin->transition ?
816 &awindow->gui->atransitions :
817 &awindow->gui->aeffects :
818 plugin->video ? plugin->transition ?
819 &awindow->gui->vtransitions :
820 &awindow->gui->veffects :
822 if( folder ) remove_plugin(plugin, *folder);
823 char plugin_path[BCTEXTLEN];
824 strcpy(plugin_path, plugin->path);
825 MWindow *mwindow = awindow->mwindow;
826 mwindow->plugindb->remove(plugin);
828 char index_path[BCTEXTLEN];
829 sprintf(index_path, "%s/%s", mwindow->preferences->plugin_dir, PLUGIN_FILE);
831 char png_path[BCTEXTLEN];
832 if( plugin->get_theme_png_path(png_path, mwindow->preferences->theme) )
834 if( plugin->get_theme_png_path(png_path, "picon") )
836 delete plugin; plugin = 0;
837 awindow->gui->async_update_assets();
841 AWindowRemovePlugin::
842 AWindowRemovePlugin(AWindow *awindow, PluginServer *plugin)
845 this->awindow = awindow;
846 this->plugin = plugin;
849 AWindowRemovePlugin::
850 ~AWindowRemovePlugin()
855 BC_Window* AWindowRemovePlugin::new_gui()
857 int x = awindow->gui->get_abs_cursor_x(0);
858 int y = awindow->gui->get_abs_cursor_y(0);
859 AWindowRemovePluginGUI *gui = new AWindowRemovePluginGUI(awindow, this, x, y, plugin);
860 gui->create_objects();
864 int AWindowGUI::keypress_event()
866 switch( get_keypress() ) {
875 PluginServer* plugin = selected_plugin();
877 remove_plugin = new AWindowRemovePlugin(awindow, plugin);
879 remove_plugin->start();
888 int AWindowGUI::create_custom_xatoms()
890 UpdateAssetsXAtom = create_xatom("CWINDOWGUI_UPDATE_ASSETS");
893 int AWindowGUI::recieve_custom_xatoms(xatom_event *event)
895 if( event->message_type == UpdateAssetsXAtom ) {
902 void AWindowGUI::async_update_assets()
905 event.message_type = UpdateAssetsXAtom;
906 send_custom_xatom(&event);
915 void AWindowGUI::update_folder_list()
917 stop_vicon_drawing();
918 //printf("AWindowGUI::update_folder_list 1\n");
919 for( int i = 0; i < folders.total; i++ ) {
920 AssetPicon *picon = (AssetPicon*)folders.values[i];
923 //printf("AWindowGUI::update_folder_list 1\n");
925 // Search assets for folders
926 for( int i = 0; i < mwindow->edl->folders.total; i++ ) {
927 const char *folder = mwindow->edl->folders.values[i];
929 //printf("AWindowGUI::update_folder_list 1.1\n");
931 for( int j = 0; j < folders.total; j++ ) {
932 AssetPicon *picon = (AssetPicon*)folders.values[j];
933 if( !strcasecmp(picon->get_text(), folder) ) {
941 int aw_folder = folder_number(folder);
942 AssetPicon *picon = aw_folder >= 0 ?
943 new AssetPicon(mwindow, this, aw_folder) :
944 new AssetPicon(mwindow, this, folder, AW_USER_FOLDER);
945 picon->create_objects();
946 folders.append(picon);
948 //printf("AWindowGUI::update_folder_list 1.3\n");
950 //printf("AWindowGUI::update_folder_list 1\n");
951 //for( int i = 0; i < folders.total; i++ )
952 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
955 for( int i = folders.total - 1; i >= 0; i-- ) {
956 AssetPicon *picon = (AssetPicon*)folders.values[i];
957 if( !picon->in_use && !picon->persistent ) {
959 folders.remove_number(i);
962 //for( int i = 0; i < folders.total; i++ )
963 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
964 //printf("AWindowGUI::update_folder_list 2\n");
965 start_vicon_drawing();
968 void AWindowGUI::create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
969 int do_audio, int do_video, int is_realtime, int is_transition)
971 ArrayList<PluginServer*> plugin_list;
972 // Get pointers to plugindb entries
973 mwindow->search_plugindb(do_audio, do_video, is_realtime, is_transition,
976 for( int i = 0; i < plugin_list.total; i++ ) {
977 PluginServer *server = plugin_list.values[i];
978 int visible = plugin_visibility & (1<<server->dir_idx);
979 if( !visible ) continue;
980 // Create new listitem
981 AssetPicon *picon = new AssetPicon(mwindow, this, server);
982 picon->create_objects();
983 output->append(picon);
987 void AWindowGUI::create_label_folder()
990 for( current = mwindow->edl->labels->first; current; current = NEXT ) {
991 AssetPicon *picon = new AssetPicon(mwindow, this, current);
992 picon->create_objects();
993 labellist.append(picon);
998 void AWindowGUI::update_asset_list()
1000 //printf("AWindowGUI::update_asset_list 1\n");
1001 for( int i = 0; i < assets.total; i++ ) {
1002 AssetPicon *picon = (AssetPicon*)assets.values[i];
1010 //printf("AWindowGUI::update_asset_list 2\n");
1013 // Synchronize EDL clips
1014 for( int i = 0; i < mwindow->edl->clips.total; i++ ) {
1017 // Look for clip in existing listitems
1018 for( int j = 0; j < assets.total && !exists; j++ ) {
1019 AssetPicon *picon = (AssetPicon*)assets.values[j];
1021 if( picon->id == mwindow->edl->clips.values[i]->id ) {
1022 picon->edl = mwindow->edl->clips.values[i];
1023 picon->set_text(mwindow->edl->clips.values[i]->local_session->clip_title);
1029 // Create new listitem
1031 AssetPicon *picon = new AssetPicon(mwindow,
1033 mwindow->edl->clips.values[i]);
1034 picon->create_objects();
1035 assets.append(picon);
1043 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1046 // Synchronize EDL assets
1047 for( Asset *current = mwindow->edl->assets->first;
1052 // Look for asset in existing listitems
1053 for( int j = 0; j < assets.total && !exists; j++ ) {
1054 AssetPicon *picon = (AssetPicon*)assets.values[j];
1056 if( picon->id == current->id ) {
1057 picon->indexable = current;
1064 // Create new listitem
1066 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1067 AssetPicon *picon = new AssetPicon(mwindow, this, current);
1068 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1069 picon->create_objects();
1070 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1071 assets.append(picon);
1075 mwindow->gui->lock_window("AWindowGUI::update_asset_list");
1076 mwindow->gui->default_message();
1077 mwindow->gui->unlock_window();
1079 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1082 // Synchronize nested EDLs
1083 for( int i = 0; i < mwindow->edl->nested_edls->size(); i++ ) {
1085 Indexable *indexable = mwindow->edl->nested_edls->get(i);
1087 // Look for asset in existing listitems
1088 for( int j = 0; j < assets.total && !exists; j++ ) {
1089 AssetPicon *picon = (AssetPicon*)assets.values[j];
1091 if( picon->id == indexable->id ) {
1092 picon->indexable = indexable;
1099 // Create new listitem
1101 AssetPicon *picon = new AssetPicon(mwindow,
1104 picon->create_objects();
1105 assets.append(picon);
1117 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1118 for( int i = assets.size() - 1; i >= 0; i-- ) {
1119 AssetPicon *picon = (AssetPicon*)assets.get(i);
1120 //printf("AWindowGUI::update_asset_list %s %d\n", picon->asset->path, picon->in_use);
1121 if( !picon->in_use ) {
1123 assets.remove_number(i);
1126 //printf("AWindowGUI::update_asset_list 7 %d\n", assets.total);
1129 void AWindowGUI::update_picon(Indexable *indexable)
1131 //printf("AWindowGUI::update_asset_list 1\n");
1133 for( int i = 0; i < assets.total; i++ ) {
1134 AssetPicon *picon = (AssetPicon*)assets.values[i];
1135 if( picon->indexable == indexable ||
1136 picon->edl == (EDL *)indexable ) {
1137 char name[BCTEXTLEN];
1139 fs.extract_name(name, indexable->path);
1140 picon->set_text(name);
1141 vicon = picon->vicon;
1146 stop_vicon_drawing();
1147 vicon->clear_images();
1148 vicon->reset(indexable->get_frame_rate());
1149 start_vicon_drawing();
1153 void AWindowGUI::sort_assets()
1155 //printf("AWindowGUI::sort_assets 1 %s\n", mwindow->edl->session->current_folder);
1156 switch( mwindow->edl->session->awindow_folder ) {
1157 case AW_AEFFECT_FOLDER:
1158 sort_picons(&aeffects);
1160 case AW_VEFFECT_FOLDER:
1161 sort_picons(&veffects);
1163 case AW_ATRANSITION_FOLDER:
1164 sort_picons(&atransitions);
1166 case AW_VTRANSITION_FOLDER:
1167 sort_picons(&vtransitions);
1169 case AW_LABEL_FOLDER:
1170 sort_picons(&labellist);
1173 sort_picons(&assets);
1179 void AWindowGUI::collect_assets()
1182 mwindow->session->drag_assets->remove_all();
1183 mwindow->session->drag_clips->remove_all();
1186 AssetPicon *result = (AssetPicon*)asset_list->get_selection(0, i++);
1187 if( !result ) break;
1189 if( result->indexable ) mwindow->session->drag_assets->append(result->indexable);
1190 if( result->edl ) mwindow->session->drag_clips->append(result->edl);
1194 void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst,
1195 ArrayList<BC_ListBoxItem*> *src, int folder)
1197 // Remove current pointers
1198 dst[0].remove_all();
1199 dst[1].remove_all_objects();
1201 // Create new pointers
1202 //if( folder ) printf("AWindowGUI::copy_picons 1 %s\n", folder);
1203 for( int i = 0; i < src->total; i++ ) {
1204 AssetPicon *picon = (AssetPicon*)src->values[i];
1205 //printf("AWindowGUI::copy_picons 2 %s\n", picon->asset->folder);
1207 (picon->indexable && picon->indexable->awindow_folder == folder) ||
1208 (picon->edl && picon->edl->local_session->awindow_folder == folder) ) {
1209 BC_ListBoxItem *item2, *item1;
1210 dst[0].append(item1 = picon);
1212 dst[1].append(item2 = new BC_ListBoxItem(picon->edl->local_session->clip_notes));
1214 if( picon->label && picon->label->textstr )
1215 dst[1].append(item2 = new BC_ListBoxItem(picon->label->textstr));
1217 dst[1].append(item2 = new BC_ListBoxItem(""));
1218 item1->set_autoplace_text(1);
1219 item2->set_autoplace_text(1);
1220 //printf("AWindowGUI::copy_picons 3 %s\n", picon->get_text());
1225 void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src)
1227 //printf("AWindowGUI::sort_picons 1\n")
1232 for( int i = 0; i < src->total - 1; i++ ) {
1233 BC_ListBoxItem *item1 = src->values[i];
1234 BC_ListBoxItem *item2 = src->values[i + 1];
1235 item1->set_autoplace_icon(1);
1236 item2->set_autoplace_icon(1);
1237 item1->set_autoplace_text(1);
1238 item2->set_autoplace_text(1);
1239 if( strcmp(item1->get_text(), item2->get_text()) > 0 ) {
1240 src->values[i + 1] = item1;
1241 src->values[i] = item2;
1249 void AWindowGUI::filter_displayed_assets()
1251 //allow_iconlisting = 1;
1252 asset_titles[0] = _("Title");
1253 asset_titles[1] = _("Comments");
1255 switch( mwindow->edl->session->awindow_folder ) {
1256 case AW_AEFFECT_FOLDER:
1257 copy_picons(displayed_assets, &aeffects, AW_NO_FOLDER);
1259 case AW_VEFFECT_FOLDER:
1260 copy_picons(displayed_assets, &veffects, AW_NO_FOLDER);
1262 case AW_ATRANSITION_FOLDER:
1263 copy_picons(displayed_assets, &atransitions, AW_NO_FOLDER);
1265 case AW_VTRANSITION_FOLDER:
1266 copy_picons(displayed_assets, &vtransitions, AW_NO_FOLDER);
1268 case AW_LABEL_FOLDER:
1269 copy_picons(displayed_assets, &labellist, AW_NO_FOLDER);
1270 asset_titles[0] = _("Time Stamps");
1271 asset_titles[1] = _("Title");
1272 //allow_iconlisting = 0;
1275 copy_picons(displayed_assets, &assets, mwindow->edl->session->awindow_folder);
1279 // Ensure the current folder icon is highlighted
1280 for( int i = 0; i < folders.total; i++ )
1281 folders.values[i]->set_selected(0);
1283 folders.values[mwindow->edl->session->awindow_folder]->set_selected(1);
1287 void AWindowGUI::update_assets()
1289 //printf("AWindowGUI::update_assets 1\n");
1290 update_folder_list();
1291 //printf("AWindowGUI::update_assets 2\n");
1292 update_asset_list();
1293 labellist.remove_all_objects();
1294 create_label_folder();
1295 //printf("AWindowGUI::update_assets 3\n");
1296 filter_displayed_assets();
1298 //for( int i = 0; i < folders.total; i++ )
1299 //printf("AWindowGUI::update_assets 4\n");
1300 // printf("AWindowGUI::update_assets %s\n", folders.values[i]->get_text());
1301 if( mwindow->edl->session->folderlist_format != folder_list->get_format() )
1302 folder_list->update_format(mwindow->edl->session->folderlist_format, 0);
1303 folder_list->update(&folders, 0, 0, 1,
1304 folder_list->get_xposition(),
1305 folder_list->get_yposition(),
1307 //printf("AWindowGUI::update_assets 5\n");
1309 if( mwindow->edl->session->assetlist_format != asset_list->get_format() )
1310 asset_list->update_format(mwindow->edl->session->assetlist_format, 0);
1313 //printf("AWindowGUI::update_assets 6 %d\n", displayed_assets[0].total);
1314 asset_list->update(displayed_assets, asset_titles,
1315 mwindow->edl->session->asset_columns, ASSET_COLUMNS,
1316 asset_list->get_xposition(),
1317 asset_list->get_yposition(),
1319 asset_list->center_selection();
1320 //printf("AWindowGUI::update_assets 7\n");
1323 //printf("AWindowGUI::update_assets 8\n");
1327 void AWindowGUI::update_effects()
1329 aeffects.remove_all_objects();
1330 create_persistent_folder(&aeffects, 1, 0, 1, 0);
1331 veffects.remove_all_objects();
1332 create_persistent_folder(&veffects, 0, 1, 1, 0);
1333 atransitions.remove_all_objects();
1334 create_persistent_folder(&atransitions, 1, 0, 0, 1);
1335 vtransitions.remove_all_objects();
1336 create_persistent_folder(&vtransitions, 0, 1, 0, 1);
1339 int AWindowGUI::folder_number(const char *name)
1341 for( int i = 0; i < AWINDOW_FOLDERS; i++ ) {
1342 if( !strcasecmp(name, folder_names[i]) ) return i;
1344 return AW_NO_FOLDER;
1347 int AWindowGUI::drag_motion()
1349 if( get_hidden() ) return 0;
1355 int AWindowGUI::drag_stop()
1357 if( get_hidden() ) return 0;
1362 Indexable* AWindowGUI::selected_asset()
1364 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1365 return picon ? picon->indexable : 0;
1368 PluginServer* AWindowGUI::selected_plugin()
1370 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1371 return picon ? picon->plugin : 0;
1374 AssetPicon* AWindowGUI::selected_folder()
1376 AssetPicon *picon = (AssetPicon*)folder_list->get_selection(0, 0);
1387 AWindowDivider::AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1388 : BC_SubWindow(x, y, w, h)
1390 this->mwindow = mwindow;
1393 AWindowDivider::~AWindowDivider()
1397 int AWindowDivider::button_press_event()
1399 if( is_event_win() && cursor_inside() ) {
1400 mwindow->session->current_operation = DRAG_PARTITION;
1406 int AWindowDivider::cursor_motion_event()
1408 if( mwindow->session->current_operation == DRAG_PARTITION ) {
1410 int wmax = mwindow->session->awindow_w - mwindow->theme->adivider_w - wmin;
1411 int fw = gui->get_relative_cursor_x();
1412 if( fw > wmax ) fw = wmax;
1413 if( fw < wmin ) fw = wmin;
1414 mwindow->session->afolders_w = fw;
1415 mwindow->theme->get_awindow_sizes(gui);
1416 gui->reposition_objects();
1422 int AWindowDivider::button_release_event()
1424 if( mwindow->session->current_operation == DRAG_PARTITION ) {
1425 mwindow->session->current_operation = NO_OPERATION;
1436 AWindowFolders::AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1441 mwindow->edl->session->folderlist_format == ASSETS_ICONS ?
1442 LISTBOX_ICONS : LISTBOX_TEXT,
1443 &gui->folders, // Each column has an ArrayList of BC_ListBoxItems.
1444 0, // Titles for columns. Set to 0 for no titles
1445 0, // width of each column
1446 1, // Total columns.
1447 0, // Pixel of top of window.
1448 0, // If this listbox is a popup window
1449 LISTBOX_SINGLE, // Select one item or multiple items
1450 ICON_TOP, // Position of icon relative to text of each item
1453 this->mwindow = mwindow;
1458 AWindowFolders::~AWindowFolders()
1462 int AWindowFolders::selection_changed()
1464 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1466 gui->stop_vicon_drawing();
1468 if( get_button_down() && get_buttonpress() == 3 ) {
1469 gui->folderlist_menu->update_titles();
1470 gui->folderlist_menu->activate_menu();
1473 mwindow->edl->session->awindow_folder = picon->foldernum;
1474 //printf("AWindowFolders::selection_changed 1\n");
1475 gui->asset_list->draw_background();
1476 gui->async_update_assets();
1478 gui->start_vicon_drawing();
1483 int AWindowFolders::button_press_event()
1487 result = BC_ListBox::button_press_event();
1490 if( get_buttonpress() == 3 && is_event_win() && cursor_inside() ) {
1491 gui->folderlist_menu->update_titles();
1492 gui->folderlist_menu->activate_menu();
1507 AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1508 : BC_ListBox(x, y, w, h,
1509 (mwindow->edl->session->assetlist_format == ASSETS_ICONS && gui->allow_iconlisting ) ?
1510 LISTBOX_ICONS : LISTBOX_TEXT,
1511 &gui->assets, // Each column has an ArrayList of BC_ListBoxItems.
1512 gui->asset_titles, // Titles for columns. Set to 0 for no titles
1513 mwindow->edl->session->asset_columns, // width of each column
1514 1, // Total columns.
1515 0, // Pixel of top of window.
1516 0, // If this listbox is a popup window
1517 LISTBOX_MULTIPLE, // Select one item or multiple items
1518 ICON_TOP, // Position of icon relative to text of each item
1521 this->mwindow = mwindow;
1526 AWindowAssets::~AWindowAssets()
1530 int AWindowAssets::button_press_event()
1534 result = BC_ListBox::button_press_event();
1536 if( !result && get_buttonpress() == 3 && is_event_win() && cursor_inside() ) {
1537 BC_ListBox::deactivate_selection();
1538 int folder = mwindow->edl->session->awindow_folder;
1540 case AW_LABEL_FOLDER:
1541 gui->labellist_menu->update();
1542 gui->labellist_menu->activate_menu();
1544 case AW_CLIP_FOLDER:
1545 gui->cliplist_menu->update();
1546 gui->cliplist_menu->activate_menu();
1549 gui->assetlist_menu->update_titles();
1550 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
1590 if( get_button_down() && get_buttonpress() == 3 &&
1591 (item = (AssetPicon*)get_selection(0, 0)) ) {
1592 int folder = mwindow->edl->session->awindow_folder;
1594 case AW_AEFFECT_FOLDER:
1595 case AW_VEFFECT_FOLDER:
1596 case AW_ATRANSITION_FOLDER:
1597 case AW_VTRANSITION_FOLDER:
1598 gui->assetlist_menu->update_titles();
1599 gui->assetlist_menu->activate_menu();
1601 case AW_LABEL_FOLDER:
1602 if( !item->label ) break;
1603 gui->label_menu->activate_menu();
1605 case AW_CLIP_FOLDER:
1606 if( !item->indexable && !item->edl ) break;
1607 gui->clip_menu->update();
1608 gui->clip_menu->activate_menu();
1611 if( !item->indexable && !item->edl ) break;
1612 gui->asset_menu->update();
1613 gui->asset_menu->activate_menu();
1617 BC_ListBox::deactivate_selection();
1620 else if( get_button_down() && get_buttonpress() == 1 &&
1621 (item = (AssetPicon*)get_selection(0, 0)) ) {
1623 if( !gui->vicon_thread->viewing ) {
1624 vicon = item->vicon;
1626 gui->vicon_thread->set_view_popup(vicon);
1632 void AWindowAssets::draw_background()
1634 clear_box(0,0,get_w(),get_h(),get_bg_surface());
1635 set_color(BC_WindowBase::get_resources()->audiovideo_color);
1636 set_font(LARGEFONT);
1637 int aw_folder = mwindow->edl->session->awindow_folder;
1638 if( aw_folder < 0 ) return;
1639 const char *aw_name = _(AWindowGUI::folder_names[aw_folder]);
1640 draw_text(get_w() - get_text_width(LARGEFONT, aw_name) - 4, 30,
1641 aw_name, -1, get_bg_surface());
1644 int AWindowAssets::drag_start_event()
1646 int collect_pluginservers = 0;
1647 int collect_assets = 0;
1649 if( BC_ListBox::drag_start_event() ) {
1650 switch( mwindow->edl->session->awindow_folder ) {
1651 case AW_AEFFECT_FOLDER:
1652 mwindow->session->current_operation = DRAG_AEFFECT;
1653 collect_pluginservers = 1;
1655 case AW_VEFFECT_FOLDER:
1656 mwindow->session->current_operation = DRAG_VEFFECT;
1657 collect_pluginservers = 1;
1659 case AW_ATRANSITION_FOLDER:
1660 mwindow->session->current_operation = DRAG_ATRANSITION;
1661 collect_pluginservers = 1;
1663 case AW_VTRANSITION_FOLDER:
1664 mwindow->session->current_operation = DRAG_VTRANSITION;
1665 collect_pluginservers = 1;
1667 case AW_LABEL_FOLDER:
1671 mwindow->session->current_operation = DRAG_ASSET;
1676 if( collect_pluginservers ) {
1678 mwindow->session->drag_pluginservers->remove_all();
1681 AssetPicon *result = (AssetPicon*)get_selection(0, i++);
1682 if( !result ) break;
1684 mwindow->session->drag_pluginservers->append(result->plugin);
1688 if( collect_assets ) {
1689 gui->collect_assets();
1697 int AWindowAssets::drag_motion_event()
1699 BC_ListBox::drag_motion_event();
1702 mwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1703 mwindow->gui->drag_motion();
1704 mwindow->gui->unlock_window();
1706 for( int i = 0; i < mwindow->vwindows.size(); i++ ) {
1707 VWindow *vwindow = mwindow->vwindows.get(i);
1708 if( !vwindow->is_running() ) continue;
1709 vwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1710 vwindow->gui->drag_motion();
1711 vwindow->gui->unlock_window();
1714 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1715 mwindow->cwindow->gui->drag_motion();
1716 mwindow->cwindow->gui->unlock_window();
1718 lock_window("AWindowAssets::drag_motion_event");
1722 int AWindowAssets::drag_stop_event()
1726 result = gui->drag_stop();
1731 mwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1732 result = mwindow->gui->drag_stop();
1733 mwindow->gui->unlock_window();
1737 for( int i = 0; !result && i < mwindow->vwindows.size(); i++ ) {
1738 VWindow *vwindow = mwindow->vwindows.get(i);
1739 if( !vwindow ) continue;
1740 if( !vwindow->is_running() ) continue;
1741 if( vwindow->gui->is_hidden() ) continue;
1742 vwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1743 if( vwindow->gui->cursor_above() &&
1744 vwindow->gui->get_cursor_over_window() ) {
1745 result = vwindow->gui->drag_stop();
1747 vwindow->gui->unlock_window();
1752 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1753 result = mwindow->cwindow->gui->drag_stop();
1754 mwindow->cwindow->gui->unlock_window();
1757 lock_window("AWindowAssets::drag_stop_event");
1759 if( result ) get_drag_popup()->set_animation(0);
1761 BC_ListBox::drag_stop_event();
1762 mwindow->session->current_operation = ::NO_OPERATION; // since NO_OPERATION is also defined in listbox, we have to reach for global scope...
1766 int AWindowAssets::column_resize_event()
1768 mwindow->edl->session->asset_columns[0] = get_column_width(0);
1769 mwindow->edl->session->asset_columns[1] = get_column_width(1);
1773 int AWindowAssets::focus_in_event()
1775 gui->start_vicon_drawing();
1779 int AWindowAssets::focus_out_event()
1781 gui->stop_vicon_drawing();
1782 return BC_ListBox::focus_out_event();
1796 AWindowNewFolder::AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1797 : BC_Button(x, y, mwindow->theme->newbin_data)
1799 this->mwindow = mwindow;
1801 set_tooltip(_("New bin"));
1804 int AWindowNewFolder::handle_event()
1806 gui->newfolder_thread->start_new_folder();
1810 AWindowDeleteFolder::AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1811 : BC_Button(x, y, mwindow->theme->deletebin_data)
1813 this->mwindow = mwindow;
1815 set_tooltip(_("Delete bin"));
1818 int AWindowDeleteFolder::handle_event()
1820 if( gui->folder_list->get_selection(0, 0) ) {
1821 BC_ListBoxItem *folder = gui->folder_list->get_selection(0, 0);
1822 mwindow->delete_folder(folder->get_text());
1827 AWindowRenameFolder::AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1828 : BC_Button(x, y, mwindow->theme->renamebin_data)
1830 this->mwindow = mwindow;
1832 set_tooltip(_("Rename bin"));
1835 int AWindowRenameFolder::handle_event()
1840 AWindowDeleteDisk::AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1841 : BC_Button(x, y, mwindow->theme->deletedisk_data)
1843 this->mwindow = mwindow;
1845 set_tooltip(_("Delete asset from disk"));
1848 int AWindowDeleteDisk::handle_event()
1853 AWindowDeleteProject::AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1854 : BC_Button(x, y, mwindow->theme->deleteproject_data)
1856 this->mwindow = mwindow;
1858 set_tooltip(_("Delete asset from project"));
1861 int AWindowDeleteProject::handle_event()
1866 AWindowInfo::AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1867 : BC_Button(x, y, mwindow->theme->infoasset_data)
1869 this->mwindow = mwindow;
1871 set_tooltip(_("Edit information on asset"));
1874 int AWindowInfo::handle_event()
1876 gui->awindow->asset_edit->edit_asset(gui->selected_asset());
1880 AWindowRedrawIndex::AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1881 : BC_Button(x, y, mwindow->theme->redrawindex_data)
1883 this->mwindow = mwindow;
1885 set_tooltip(_("Redraw index"));
1888 int AWindowRedrawIndex::handle_event()
1893 AWindowPaste::AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1894 : BC_Button(x, y, mwindow->theme->pasteasset_data)
1896 this->mwindow = mwindow;
1898 set_tooltip(_("Paste asset on recordable tracks"));
1901 int AWindowPaste::handle_event()
1906 AWindowAppend::AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1907 : BC_Button(x, y, mwindow->theme->appendasset_data)
1909 this->mwindow = mwindow;
1911 set_tooltip(_("Append asset in new tracks"));
1914 int AWindowAppend::handle_event()
1919 AWindowView::AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1920 : BC_Button(x, y, mwindow->theme->viewasset_data)
1922 this->mwindow = mwindow;
1924 set_tooltip(_("View asset"));
1927 int AWindowView::handle_event()
1932 AddTools::AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, const char *title)
1933 : BC_PopupMenu(x, y, BC_Title::calculate_w(gui, title, MEDIUMFONT)+8, title, -1, 0, 4)
1935 this->mwindow = mwindow;
1939 void AddTools::create_objects()
1942 add_item(new AddPluginItem(this, "ladspa", PLUGIN_LADSPA_ID));
1943 vis |= 1 << PLUGIN_LADSPA_ID;
1944 add_item(new AddPluginItem(this, "ffmpeg", PLUGIN_FFMPEG_ID));
1945 vis |= 1 << PLUGIN_FFMPEG_ID;
1946 for( int i=0; i<MWindow::plugindb->size(); ++i ) {
1947 PluginServer *plugin = MWindow::plugindb->get(i);
1948 if( !plugin->audio && !plugin->video ) continue;
1949 int idx = plugin->dir_idx;
1950 uint32_t msk = 1 << idx;
1951 if( (msk & vis) != 0 ) continue;
1953 char parent[BCTEXTLEN];
1954 strcpy(parent, plugin->path);
1955 char *bp = strrchr(parent, '/');
1956 if( bp ) { *bp = 0; bp = strrchr(parent, '/'); }
1957 if( !bp ) bp = parent; else ++bp;
1958 add_item(new AddPluginItem(this, bp, idx));
1963 // plugin_dirs list from toplevel makefile include plugin_defs
1967 N_("audio_transitions")
1974 N_("video_transitions")
1977 AddPluginItem::AddPluginItem(AddTools *menu, char const *text, int idx)
1978 : BC_MenuItem(_(text))
1982 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
1983 int chk = (msk & vis) ? 1 : 0;
1987 int AddPluginItem::handle_event()
1989 int chk = get_checked() ^ 1;
1991 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
1992 menu->gui->plugin_visibility = chk ? vis | msk : vis & ~msk;
1993 menu->gui->update_effects();
1994 menu->gui->save_defaults(menu->mwindow->defaults);
1995 menu->gui->async_update_assets();
1999 AVIconDrawing::AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images)
2000 : BC_Toggle(x, y, images, agui->vicon_drawing)
2003 set_tooltip(_("draw vicons"));
2006 void AVIconDrawing::calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh)
2008 int text_line = -1, toggle_x = -1, toggle_y = -1;
2009 int text_x = -1, text_y = -1, text_w = -1, text_h = -1;
2010 BC_Toggle::calculate_extents(agui, images, 1,
2011 &text_line, ww, hh, &toggle_x, &toggle_y,
2012 &text_x, &text_y, &text_w, &text_h, "", MEDIUMFONT);
2015 AVIconDrawing::~AVIconDrawing()
2019 int AVIconDrawing::handle_event()
2021 agui->vicon_drawing = get_value();
2022 if( agui->vicon_drawing )
2023 agui->start_vicon_drawing();
2025 agui->stop_vicon_drawing();
2030 AWindowListFormat::AWindowListFormat(MWindow *mwindow)
2033 this->mwindow = mwindow;
2036 int AWindowListFormat::handle_event()
2038 AWindowGUI *gui = mwindow->awindow->gui;
2039 gui->stop_vicon_drawing();
2041 EDLSession *session = mwindow->edl->session;
2042 switch( session->assetlist_format ) {
2044 session->assetlist_format = ASSETS_ICONS;
2047 session->assetlist_format = ASSETS_TEXT;
2051 gui->asset_list->update_format(session->assetlist_format, 1);
2052 if( !mwindow->awindow->gui->allow_iconlisting ) {
2053 mwindow->edl->session->assetlist_format = ASSETS_TEXT;
2056 gui->start_vicon_drawing();
2060 void AWindowListFormat::update()
2062 set_text(mwindow->edl->session->assetlist_format == ASSETS_TEXT ?
2063 (char*)_("Display icons") : (char*)_("Display text"));
2066 AWindowListSort::AWindowListSort(MWindow *mwindow)
2067 : BC_MenuItem(_("Sort items"))
2069 this->mwindow = mwindow;
2072 int AWindowListSort::handle_event()
2074 AWindowGUI *gui = mwindow->awindow->gui;