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 snprintf(index_path, sizeof(index_path), "%s/%s",
830 mwindow->preferences->plugin_dir, PLUGIN_FILE);
832 char png_path[BCTEXTLEN];
833 if( plugin->get_theme_png_path(png_path, mwindow->preferences->theme) )
835 if( plugin->get_theme_png_path(png_path, "picon") )
837 delete plugin; plugin = 0;
838 awindow->gui->async_update_assets();
842 AWindowRemovePlugin::
843 AWindowRemovePlugin(AWindow *awindow, PluginServer *plugin)
846 this->awindow = awindow;
847 this->plugin = plugin;
850 AWindowRemovePlugin::
851 ~AWindowRemovePlugin()
856 BC_Window* AWindowRemovePlugin::new_gui()
858 int x = awindow->gui->get_abs_cursor_x(0);
859 int y = awindow->gui->get_abs_cursor_y(0);
860 AWindowRemovePluginGUI *gui = new AWindowRemovePluginGUI(awindow, this, x, y, plugin);
861 gui->create_objects();
865 int AWindowGUI::keypress_event()
867 switch( get_keypress() ) {
876 PluginServer* plugin = selected_plugin();
878 remove_plugin = new AWindowRemovePlugin(awindow, plugin);
880 remove_plugin->start();
889 int AWindowGUI::create_custom_xatoms()
891 UpdateAssetsXAtom = create_xatom("CWINDOWGUI_UPDATE_ASSETS");
894 int AWindowGUI::recieve_custom_xatoms(xatom_event *event)
896 if( event->message_type == UpdateAssetsXAtom ) {
903 void AWindowGUI::async_update_assets()
906 event.message_type = UpdateAssetsXAtom;
907 send_custom_xatom(&event);
916 void AWindowGUI::update_folder_list()
918 stop_vicon_drawing();
919 //printf("AWindowGUI::update_folder_list 1\n");
920 for( int i = 0; i < folders.total; i++ ) {
921 AssetPicon *picon = (AssetPicon*)folders.values[i];
924 //printf("AWindowGUI::update_folder_list 1\n");
926 // Search assets for folders
927 for( int i = 0; i < mwindow->edl->folders.total; i++ ) {
928 const char *folder = mwindow->edl->folders.values[i];
930 //printf("AWindowGUI::update_folder_list 1.1\n");
932 for( int j = 0; j < folders.total; j++ ) {
933 AssetPicon *picon = (AssetPicon*)folders.values[j];
934 if( !strcasecmp(picon->get_text(), folder) ) {
942 int aw_folder = folder_number(folder);
943 AssetPicon *picon = aw_folder >= 0 ?
944 new AssetPicon(mwindow, this, aw_folder) :
945 new AssetPicon(mwindow, this, folder, AW_USER_FOLDER);
946 picon->create_objects();
947 folders.append(picon);
949 //printf("AWindowGUI::update_folder_list 1.3\n");
951 //printf("AWindowGUI::update_folder_list 1\n");
952 //for( int i = 0; i < folders.total; i++ )
953 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
956 for( int i = folders.total - 1; i >= 0; i-- ) {
957 AssetPicon *picon = (AssetPicon*)folders.values[i];
958 if( !picon->in_use && !picon->persistent ) {
960 folders.remove_number(i);
963 //for( int i = 0; i < folders.total; i++ )
964 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
965 //printf("AWindowGUI::update_folder_list 2\n");
966 start_vicon_drawing();
969 void AWindowGUI::create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
970 int do_audio, int do_video, int is_realtime, int is_transition)
972 ArrayList<PluginServer*> plugin_list;
973 // Get pointers to plugindb entries
974 mwindow->search_plugindb(do_audio, do_video, is_realtime, is_transition,
977 for( int i = 0; i < plugin_list.total; i++ ) {
978 PluginServer *server = plugin_list.values[i];
979 int visible = plugin_visibility & (1<<server->dir_idx);
980 if( !visible ) continue;
981 // Create new listitem
982 AssetPicon *picon = new AssetPicon(mwindow, this, server);
983 picon->create_objects();
984 output->append(picon);
988 void AWindowGUI::create_label_folder()
991 for( current = mwindow->edl->labels->first; current; current = NEXT ) {
992 AssetPicon *picon = new AssetPicon(mwindow, this, current);
993 picon->create_objects();
994 labellist.append(picon);
999 void AWindowGUI::update_asset_list()
1001 //printf("AWindowGUI::update_asset_list 1\n");
1002 for( int i = 0; i < assets.total; i++ ) {
1003 AssetPicon *picon = (AssetPicon*)assets.values[i];
1011 //printf("AWindowGUI::update_asset_list 2\n");
1014 // Synchronize EDL clips
1015 for( int i = 0; i < mwindow->edl->clips.total; i++ ) {
1018 // Look for clip in existing listitems
1019 for( int j = 0; j < assets.total && !exists; j++ ) {
1020 AssetPicon *picon = (AssetPicon*)assets.values[j];
1022 if( picon->id == mwindow->edl->clips.values[i]->id ) {
1023 picon->edl = mwindow->edl->clips.values[i];
1024 picon->set_text(mwindow->edl->clips.values[i]->local_session->clip_title);
1030 // Create new listitem
1032 AssetPicon *picon = new AssetPicon(mwindow,
1034 mwindow->edl->clips.values[i]);
1035 picon->create_objects();
1036 assets.append(picon);
1044 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1047 // Synchronize EDL assets
1048 for( Asset *current = mwindow->edl->assets->first;
1053 // Look for asset in existing listitems
1054 for( int j = 0; j < assets.total && !exists; j++ ) {
1055 AssetPicon *picon = (AssetPicon*)assets.values[j];
1057 if( picon->id == current->id ) {
1058 picon->indexable = current;
1065 // Create new listitem
1067 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1068 AssetPicon *picon = new AssetPicon(mwindow, this, current);
1069 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1070 picon->create_objects();
1071 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1072 assets.append(picon);
1076 mwindow->gui->lock_window("AWindowGUI::update_asset_list");
1077 mwindow->gui->default_message();
1078 mwindow->gui->unlock_window();
1080 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1083 // Synchronize nested EDLs
1084 for( int i = 0; i < mwindow->edl->nested_edls->size(); i++ ) {
1086 Indexable *indexable = mwindow->edl->nested_edls->get(i);
1088 // Look for asset in existing listitems
1089 for( int j = 0; j < assets.total && !exists; j++ ) {
1090 AssetPicon *picon = (AssetPicon*)assets.values[j];
1092 if( picon->id == indexable->id ) {
1093 picon->indexable = indexable;
1100 // Create new listitem
1102 AssetPicon *picon = new AssetPicon(mwindow,
1105 picon->create_objects();
1106 assets.append(picon);
1118 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1119 for( int i = assets.size() - 1; i >= 0; i-- ) {
1120 AssetPicon *picon = (AssetPicon*)assets.get(i);
1121 //printf("AWindowGUI::update_asset_list %s %d\n", picon->asset->path, picon->in_use);
1122 if( !picon->in_use ) {
1124 assets.remove_number(i);
1127 //printf("AWindowGUI::update_asset_list 7 %d\n", assets.total);
1130 void AWindowGUI::update_picon(Indexable *indexable)
1132 //printf("AWindowGUI::update_asset_list 1\n");
1134 for( int i = 0; i < assets.total; i++ ) {
1135 AssetPicon *picon = (AssetPicon*)assets.values[i];
1136 if( picon->indexable == indexable ||
1137 picon->edl == (EDL *)indexable ) {
1138 char name[BCTEXTLEN];
1140 fs.extract_name(name, indexable->path);
1141 picon->set_text(name);
1142 vicon = picon->vicon;
1147 stop_vicon_drawing();
1148 vicon->clear_images();
1149 vicon->reset(indexable->get_frame_rate());
1150 start_vicon_drawing();
1154 void AWindowGUI::sort_assets()
1156 //printf("AWindowGUI::sort_assets 1 %s\n", mwindow->edl->session->current_folder);
1157 switch( mwindow->edl->session->awindow_folder ) {
1158 case AW_AEFFECT_FOLDER:
1159 sort_picons(&aeffects);
1161 case AW_VEFFECT_FOLDER:
1162 sort_picons(&veffects);
1164 case AW_ATRANSITION_FOLDER:
1165 sort_picons(&atransitions);
1167 case AW_VTRANSITION_FOLDER:
1168 sort_picons(&vtransitions);
1170 case AW_LABEL_FOLDER:
1171 sort_picons(&labellist);
1174 sort_picons(&assets);
1180 void AWindowGUI::collect_assets()
1183 mwindow->session->drag_assets->remove_all();
1184 mwindow->session->drag_clips->remove_all();
1187 AssetPicon *result = (AssetPicon*)asset_list->get_selection(0, i++);
1188 if( !result ) break;
1190 if( result->indexable ) mwindow->session->drag_assets->append(result->indexable);
1191 if( result->edl ) mwindow->session->drag_clips->append(result->edl);
1195 void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst,
1196 ArrayList<BC_ListBoxItem*> *src, int folder)
1198 // Remove current pointers
1199 dst[0].remove_all();
1200 dst[1].remove_all_objects();
1202 // Create new pointers
1203 //if( folder ) printf("AWindowGUI::copy_picons 1 %s\n", folder);
1204 for( int i = 0; i < src->total; i++ ) {
1205 AssetPicon *picon = (AssetPicon*)src->values[i];
1206 //printf("AWindowGUI::copy_picons 2 %s\n", picon->asset->folder);
1208 (picon->indexable && picon->indexable->awindow_folder == folder) ||
1209 (picon->edl && picon->edl->local_session->awindow_folder == folder) ) {
1210 BC_ListBoxItem *item2, *item1;
1211 dst[0].append(item1 = picon);
1213 dst[1].append(item2 = new BC_ListBoxItem(picon->edl->local_session->clip_notes));
1215 if( picon->label && picon->label->textstr )
1216 dst[1].append(item2 = new BC_ListBoxItem(picon->label->textstr));
1218 dst[1].append(item2 = new BC_ListBoxItem(""));
1219 item1->set_autoplace_text(1);
1220 item2->set_autoplace_text(1);
1221 //printf("AWindowGUI::copy_picons 3 %s\n", picon->get_text());
1226 void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src)
1228 //printf("AWindowGUI::sort_picons 1\n")
1233 for( int i = 0; i < src->total - 1; i++ ) {
1234 BC_ListBoxItem *item1 = src->values[i];
1235 BC_ListBoxItem *item2 = src->values[i + 1];
1236 item1->set_autoplace_icon(1);
1237 item2->set_autoplace_icon(1);
1238 item1->set_autoplace_text(1);
1239 item2->set_autoplace_text(1);
1240 if( strcmp(item1->get_text(), item2->get_text()) > 0 ) {
1241 src->values[i + 1] = item1;
1242 src->values[i] = item2;
1250 void AWindowGUI::filter_displayed_assets()
1252 //allow_iconlisting = 1;
1253 asset_titles[0] = _("Title");
1254 asset_titles[1] = _("Comments");
1256 switch( mwindow->edl->session->awindow_folder ) {
1257 case AW_AEFFECT_FOLDER:
1258 copy_picons(displayed_assets, &aeffects, AW_NO_FOLDER);
1260 case AW_VEFFECT_FOLDER:
1261 copy_picons(displayed_assets, &veffects, AW_NO_FOLDER);
1263 case AW_ATRANSITION_FOLDER:
1264 copy_picons(displayed_assets, &atransitions, AW_NO_FOLDER);
1266 case AW_VTRANSITION_FOLDER:
1267 copy_picons(displayed_assets, &vtransitions, AW_NO_FOLDER);
1269 case AW_LABEL_FOLDER:
1270 copy_picons(displayed_assets, &labellist, AW_NO_FOLDER);
1271 asset_titles[0] = _("Time Stamps");
1272 asset_titles[1] = _("Title");
1273 //allow_iconlisting = 0;
1276 copy_picons(displayed_assets, &assets, mwindow->edl->session->awindow_folder);
1280 // Ensure the current folder icon is highlighted
1281 for( int i = 0; i < folders.total; i++ )
1282 folders.values[i]->set_selected(0);
1284 folders.values[mwindow->edl->session->awindow_folder]->set_selected(1);
1288 void AWindowGUI::update_assets()
1290 //printf("AWindowGUI::update_assets 1\n");
1291 update_folder_list();
1292 //printf("AWindowGUI::update_assets 2\n");
1293 update_asset_list();
1294 labellist.remove_all_objects();
1295 create_label_folder();
1296 //printf("AWindowGUI::update_assets 3\n");
1297 filter_displayed_assets();
1299 //for( int i = 0; i < folders.total; i++ )
1300 //printf("AWindowGUI::update_assets 4\n");
1301 // printf("AWindowGUI::update_assets %s\n", folders.values[i]->get_text());
1302 if( mwindow->edl->session->folderlist_format != folder_list->get_format() )
1303 folder_list->update_format(mwindow->edl->session->folderlist_format, 0);
1304 folder_list->update(&folders, 0, 0, 1,
1305 folder_list->get_xposition(),
1306 folder_list->get_yposition(),
1308 //printf("AWindowGUI::update_assets 5\n");
1310 if( mwindow->edl->session->assetlist_format != asset_list->get_format() )
1311 asset_list->update_format(mwindow->edl->session->assetlist_format, 0);
1314 //printf("AWindowGUI::update_assets 6 %d\n", displayed_assets[0].total);
1315 asset_list->update(displayed_assets, asset_titles,
1316 mwindow->edl->session->asset_columns, ASSET_COLUMNS,
1317 asset_list->get_xposition(),
1318 asset_list->get_yposition(),
1320 asset_list->center_selection();
1321 //printf("AWindowGUI::update_assets 7\n");
1324 //printf("AWindowGUI::update_assets 8\n");
1328 void AWindowGUI::update_effects()
1330 aeffects.remove_all_objects();
1331 create_persistent_folder(&aeffects, 1, 0, 1, 0);
1332 veffects.remove_all_objects();
1333 create_persistent_folder(&veffects, 0, 1, 1, 0);
1334 atransitions.remove_all_objects();
1335 create_persistent_folder(&atransitions, 1, 0, 0, 1);
1336 vtransitions.remove_all_objects();
1337 create_persistent_folder(&vtransitions, 0, 1, 0, 1);
1340 int AWindowGUI::folder_number(const char *name)
1342 for( int i = 0; i < AWINDOW_FOLDERS; i++ ) {
1343 if( !strcasecmp(name, folder_names[i]) ) return i;
1345 return AW_NO_FOLDER;
1348 int AWindowGUI::drag_motion()
1350 if( get_hidden() ) return 0;
1356 int AWindowGUI::drag_stop()
1358 if( get_hidden() ) return 0;
1363 Indexable* AWindowGUI::selected_asset()
1365 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1366 return picon ? picon->indexable : 0;
1369 PluginServer* AWindowGUI::selected_plugin()
1371 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1372 return picon ? picon->plugin : 0;
1375 AssetPicon* AWindowGUI::selected_folder()
1377 AssetPicon *picon = (AssetPicon*)folder_list->get_selection(0, 0);
1388 AWindowDivider::AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1389 : BC_SubWindow(x, y, w, h)
1391 this->mwindow = mwindow;
1394 AWindowDivider::~AWindowDivider()
1398 int AWindowDivider::button_press_event()
1400 if( is_event_win() && cursor_inside() ) {
1401 mwindow->session->current_operation = DRAG_PARTITION;
1407 int AWindowDivider::cursor_motion_event()
1409 if( mwindow->session->current_operation == DRAG_PARTITION ) {
1411 int wmax = mwindow->session->awindow_w - mwindow->theme->adivider_w - wmin;
1412 int fw = gui->get_relative_cursor_x();
1413 if( fw > wmax ) fw = wmax;
1414 if( fw < wmin ) fw = wmin;
1415 mwindow->session->afolders_w = fw;
1416 mwindow->theme->get_awindow_sizes(gui);
1417 gui->reposition_objects();
1423 int AWindowDivider::button_release_event()
1425 if( mwindow->session->current_operation == DRAG_PARTITION ) {
1426 mwindow->session->current_operation = NO_OPERATION;
1437 AWindowFolders::AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1442 mwindow->edl->session->folderlist_format == ASSETS_ICONS ?
1443 LISTBOX_ICONS : LISTBOX_TEXT,
1444 &gui->folders, // Each column has an ArrayList of BC_ListBoxItems.
1445 0, // Titles for columns. Set to 0 for no titles
1446 0, // width of each column
1447 1, // Total columns.
1448 0, // Pixel of top of window.
1449 0, // If this listbox is a popup window
1450 LISTBOX_SINGLE, // Select one item or multiple items
1451 ICON_TOP, // Position of icon relative to text of each item
1454 this->mwindow = mwindow;
1459 AWindowFolders::~AWindowFolders()
1463 int AWindowFolders::selection_changed()
1465 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1467 gui->stop_vicon_drawing();
1469 if( get_button_down() && get_buttonpress() == 3 ) {
1470 gui->folderlist_menu->update_titles();
1471 gui->folderlist_menu->activate_menu();
1474 mwindow->edl->session->awindow_folder = picon->foldernum;
1475 //printf("AWindowFolders::selection_changed 1\n");
1476 gui->asset_list->draw_background();
1477 gui->async_update_assets();
1479 gui->start_vicon_drawing();
1484 int AWindowFolders::button_press_event()
1488 result = BC_ListBox::button_press_event();
1491 if( get_buttonpress() == 3 && is_event_win() && cursor_inside() ) {
1492 gui->folderlist_menu->update_titles();
1493 gui->folderlist_menu->activate_menu();
1508 AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1509 : BC_ListBox(x, y, w, h,
1510 (mwindow->edl->session->assetlist_format == ASSETS_ICONS && gui->allow_iconlisting ) ?
1511 LISTBOX_ICONS : LISTBOX_TEXT,
1512 &gui->assets, // Each column has an ArrayList of BC_ListBoxItems.
1513 gui->asset_titles, // Titles for columns. Set to 0 for no titles
1514 mwindow->edl->session->asset_columns, // width of each column
1515 1, // Total columns.
1516 0, // Pixel of top of window.
1517 0, // If this listbox is a popup window
1518 LISTBOX_MULTIPLE, // Select one item or multiple items
1519 ICON_TOP, // Position of icon relative to text of each item
1522 this->mwindow = mwindow;
1527 AWindowAssets::~AWindowAssets()
1531 int AWindowAssets::button_press_event()
1535 result = BC_ListBox::button_press_event();
1537 if( !result && get_buttonpress() == 3 && is_event_win() && cursor_inside() ) {
1538 BC_ListBox::deactivate_selection();
1539 int folder = mwindow->edl->session->awindow_folder;
1541 case AW_LABEL_FOLDER:
1542 gui->labellist_menu->update();
1543 gui->labellist_menu->activate_menu();
1545 case AW_CLIP_FOLDER:
1546 gui->cliplist_menu->update();
1547 gui->cliplist_menu->activate_menu();
1550 gui->assetlist_menu->update_titles();
1551 gui->assetlist_menu->activate_menu();
1562 int AWindowAssets::handle_event()
1564 //printf("AWindowAssets::handle_event 1 %d %d\n", get_buttonpress(), get_selection(0, 0));
1565 AssetPicon *asset_picon = (AssetPicon *)get_selection(0, 0);
1566 if( !asset_picon ) return 0;
1567 switch( mwindow->edl->session->awindow_folder ) {
1568 case AW_AEFFECT_FOLDER:
1569 case AW_VEFFECT_FOLDER:
1570 case AW_ATRANSITION_FOLDER:
1571 case AW_VTRANSITION_FOLDER: return 1;
1573 VWindow *vwindow = mwindow->vwindows.size() > DEFAULT_VWINDOW ?
1574 mwindow->vwindows.get(DEFAULT_VWINDOW) : 0;
1575 if( !vwindow || !vwindow->is_running() ) return 1;
1576 //printf("AWindowAssets::handle_event 2 %d %d\n", get_buttonpress(), get_selection(0, 0));
1578 vwindow->gui->lock_window("AWindowAssets::handle_event");
1579 if( asset_picon->indexable )
1580 vwindow->change_source(asset_picon->indexable);
1581 else if( asset_picon->edl )
1582 vwindow->change_source(asset_picon->edl);
1583 vwindow->gui->unlock_window();
1587 int AWindowAssets::selection_changed()
1589 // Show popup window
1591 if( get_button_down() && get_buttonpress() == 3 &&
1592 (item = (AssetPicon*)get_selection(0, 0)) ) {
1593 int folder = mwindow->edl->session->awindow_folder;
1595 case AW_AEFFECT_FOLDER:
1596 case AW_VEFFECT_FOLDER:
1597 case AW_ATRANSITION_FOLDER:
1598 case AW_VTRANSITION_FOLDER:
1599 gui->assetlist_menu->update_titles();
1600 gui->assetlist_menu->activate_menu();
1602 case AW_LABEL_FOLDER:
1603 if( !item->label ) break;
1604 gui->label_menu->activate_menu();
1606 case AW_CLIP_FOLDER:
1607 if( !item->indexable && !item->edl ) break;
1608 gui->clip_menu->update();
1609 gui->clip_menu->activate_menu();
1612 if( !item->indexable && !item->edl ) break;
1613 gui->asset_menu->update();
1614 gui->asset_menu->activate_menu();
1618 BC_ListBox::deactivate_selection();
1621 else if( get_button_down() && get_buttonpress() == 1 &&
1622 (item = (AssetPicon*)get_selection(0, 0)) ) {
1624 if( !gui->vicon_thread->viewing ) {
1625 vicon = item->vicon;
1627 gui->vicon_thread->set_view_popup(vicon);
1633 void AWindowAssets::draw_background()
1635 clear_box(0,0,get_w(),get_h(),get_bg_surface());
1636 set_color(BC_WindowBase::get_resources()->audiovideo_color);
1637 set_font(LARGEFONT);
1638 int aw_folder = mwindow->edl->session->awindow_folder;
1639 if( aw_folder < 0 ) return;
1640 const char *aw_name = _(AWindowGUI::folder_names[aw_folder]);
1641 draw_text(get_w() - get_text_width(LARGEFONT, aw_name) - 4, 30,
1642 aw_name, -1, get_bg_surface());
1645 int AWindowAssets::drag_start_event()
1647 int collect_pluginservers = 0;
1648 int collect_assets = 0;
1650 if( BC_ListBox::drag_start_event() ) {
1651 switch( mwindow->edl->session->awindow_folder ) {
1652 case AW_AEFFECT_FOLDER:
1653 mwindow->session->current_operation = DRAG_AEFFECT;
1654 collect_pluginservers = 1;
1656 case AW_VEFFECT_FOLDER:
1657 mwindow->session->current_operation = DRAG_VEFFECT;
1658 collect_pluginservers = 1;
1660 case AW_ATRANSITION_FOLDER:
1661 mwindow->session->current_operation = DRAG_ATRANSITION;
1662 collect_pluginservers = 1;
1664 case AW_VTRANSITION_FOLDER:
1665 mwindow->session->current_operation = DRAG_VTRANSITION;
1666 collect_pluginservers = 1;
1668 case AW_LABEL_FOLDER:
1672 mwindow->session->current_operation = DRAG_ASSET;
1677 if( collect_pluginservers ) {
1679 mwindow->session->drag_pluginservers->remove_all();
1682 AssetPicon *result = (AssetPicon*)get_selection(0, i++);
1683 if( !result ) break;
1685 mwindow->session->drag_pluginservers->append(result->plugin);
1689 if( collect_assets ) {
1690 gui->collect_assets();
1698 int AWindowAssets::drag_motion_event()
1700 BC_ListBox::drag_motion_event();
1703 mwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1704 mwindow->gui->drag_motion();
1705 mwindow->gui->unlock_window();
1707 for( int i = 0; i < mwindow->vwindows.size(); i++ ) {
1708 VWindow *vwindow = mwindow->vwindows.get(i);
1709 if( !vwindow->is_running() ) continue;
1710 vwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1711 vwindow->gui->drag_motion();
1712 vwindow->gui->unlock_window();
1715 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1716 mwindow->cwindow->gui->drag_motion();
1717 mwindow->cwindow->gui->unlock_window();
1719 lock_window("AWindowAssets::drag_motion_event");
1723 int AWindowAssets::drag_stop_event()
1727 result = gui->drag_stop();
1732 mwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1733 result = mwindow->gui->drag_stop();
1734 mwindow->gui->unlock_window();
1738 for( int i = 0; !result && i < mwindow->vwindows.size(); i++ ) {
1739 VWindow *vwindow = mwindow->vwindows.get(i);
1740 if( !vwindow ) continue;
1741 if( !vwindow->is_running() ) continue;
1742 if( vwindow->gui->is_hidden() ) continue;
1743 vwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1744 if( vwindow->gui->cursor_above() &&
1745 vwindow->gui->get_cursor_over_window() ) {
1746 result = vwindow->gui->drag_stop();
1748 vwindow->gui->unlock_window();
1753 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1754 result = mwindow->cwindow->gui->drag_stop();
1755 mwindow->cwindow->gui->unlock_window();
1758 lock_window("AWindowAssets::drag_stop_event");
1760 if( result ) get_drag_popup()->set_animation(0);
1762 BC_ListBox::drag_stop_event();
1763 mwindow->session->current_operation = ::NO_OPERATION; // since NO_OPERATION is also defined in listbox, we have to reach for global scope...
1767 int AWindowAssets::column_resize_event()
1769 mwindow->edl->session->asset_columns[0] = get_column_width(0);
1770 mwindow->edl->session->asset_columns[1] = get_column_width(1);
1774 int AWindowAssets::focus_in_event()
1776 gui->start_vicon_drawing();
1780 int AWindowAssets::focus_out_event()
1782 gui->stop_vicon_drawing();
1783 return BC_ListBox::focus_out_event();
1797 AWindowNewFolder::AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1798 : BC_Button(x, y, mwindow->theme->newbin_data)
1800 this->mwindow = mwindow;
1802 set_tooltip(_("New bin"));
1805 int AWindowNewFolder::handle_event()
1807 gui->newfolder_thread->start_new_folder();
1811 AWindowDeleteFolder::AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1812 : BC_Button(x, y, mwindow->theme->deletebin_data)
1814 this->mwindow = mwindow;
1816 set_tooltip(_("Delete bin"));
1819 int AWindowDeleteFolder::handle_event()
1821 if( gui->folder_list->get_selection(0, 0) ) {
1822 BC_ListBoxItem *folder = gui->folder_list->get_selection(0, 0);
1823 mwindow->delete_folder(folder->get_text());
1828 AWindowRenameFolder::AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1829 : BC_Button(x, y, mwindow->theme->renamebin_data)
1831 this->mwindow = mwindow;
1833 set_tooltip(_("Rename bin"));
1836 int AWindowRenameFolder::handle_event()
1841 AWindowDeleteDisk::AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1842 : BC_Button(x, y, mwindow->theme->deletedisk_data)
1844 this->mwindow = mwindow;
1846 set_tooltip(_("Delete asset from disk"));
1849 int AWindowDeleteDisk::handle_event()
1854 AWindowDeleteProject::AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1855 : BC_Button(x, y, mwindow->theme->deleteproject_data)
1857 this->mwindow = mwindow;
1859 set_tooltip(_("Delete asset from project"));
1862 int AWindowDeleteProject::handle_event()
1867 AWindowInfo::AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1868 : BC_Button(x, y, mwindow->theme->infoasset_data)
1870 this->mwindow = mwindow;
1872 set_tooltip(_("Edit information on asset"));
1875 int AWindowInfo::handle_event()
1878 gui->get_abs_cursor_xy(cur_x, cur_y, 0);
1879 gui->awindow->asset_edit->edit_asset(gui->selected_asset(), cur_x, cur_y);
1883 AWindowRedrawIndex::AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1884 : BC_Button(x, y, mwindow->theme->redrawindex_data)
1886 this->mwindow = mwindow;
1888 set_tooltip(_("Redraw index"));
1891 int AWindowRedrawIndex::handle_event()
1896 AWindowPaste::AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1897 : BC_Button(x, y, mwindow->theme->pasteasset_data)
1899 this->mwindow = mwindow;
1901 set_tooltip(_("Paste asset on recordable tracks"));
1904 int AWindowPaste::handle_event()
1909 AWindowAppend::AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1910 : BC_Button(x, y, mwindow->theme->appendasset_data)
1912 this->mwindow = mwindow;
1914 set_tooltip(_("Append asset in new tracks"));
1917 int AWindowAppend::handle_event()
1922 AWindowView::AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1923 : BC_Button(x, y, mwindow->theme->viewasset_data)
1925 this->mwindow = mwindow;
1927 set_tooltip(_("View asset"));
1930 int AWindowView::handle_event()
1935 AddTools::AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, const char *title)
1936 : BC_PopupMenu(x, y, BC_Title::calculate_w(gui, title, MEDIUMFONT)+8, title, -1, 0, 4)
1938 this->mwindow = mwindow;
1942 void AddTools::create_objects()
1945 add_item(new AddPluginItem(this, "ladspa", PLUGIN_LADSPA_ID));
1946 vis |= 1 << PLUGIN_LADSPA_ID;
1947 add_item(new AddPluginItem(this, "ffmpeg", PLUGIN_FFMPEG_ID));
1948 vis |= 1 << PLUGIN_FFMPEG_ID;
1949 for( int i=0; i<MWindow::plugindb->size(); ++i ) {
1950 PluginServer *plugin = MWindow::plugindb->get(i);
1951 if( !plugin->audio && !plugin->video ) continue;
1952 int idx = plugin->dir_idx;
1953 uint32_t msk = 1 << idx;
1954 if( (msk & vis) != 0 ) continue;
1956 char parent[BCTEXTLEN];
1957 strcpy(parent, plugin->path);
1958 char *bp = strrchr(parent, '/');
1959 if( bp ) { *bp = 0; bp = strrchr(parent, '/'); }
1960 if( !bp ) bp = parent; else ++bp;
1961 add_item(new AddPluginItem(this, bp, idx));
1966 // plugin_dirs list from toplevel makefile include plugin_defs
1970 N_("audio_transitions")
1977 N_("video_transitions")
1980 AddPluginItem::AddPluginItem(AddTools *menu, char const *text, int idx)
1981 : BC_MenuItem(_(text))
1985 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
1986 int chk = (msk & vis) ? 1 : 0;
1990 int AddPluginItem::handle_event()
1992 int chk = get_checked() ^ 1;
1994 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
1995 menu->gui->plugin_visibility = chk ? vis | msk : vis & ~msk;
1996 menu->gui->update_effects();
1997 menu->gui->save_defaults(menu->mwindow->defaults);
1998 menu->gui->async_update_assets();
2002 AVIconDrawing::AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images)
2003 : BC_Toggle(x, y, images, agui->vicon_drawing)
2006 set_tooltip(_("draw vicons"));
2009 void AVIconDrawing::calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh)
2011 int text_line = -1, toggle_x = -1, toggle_y = -1;
2012 int text_x = -1, text_y = -1, text_w = -1, text_h = -1;
2013 BC_Toggle::calculate_extents(agui, images, 1,
2014 &text_line, ww, hh, &toggle_x, &toggle_y,
2015 &text_x, &text_y, &text_w, &text_h, "", MEDIUMFONT);
2018 AVIconDrawing::~AVIconDrawing()
2022 int AVIconDrawing::handle_event()
2024 agui->vicon_drawing = get_value();
2025 if( agui->vicon_drawing )
2026 agui->start_vicon_drawing();
2028 agui->stop_vicon_drawing();
2033 AWindowListFormat::AWindowListFormat(MWindow *mwindow, AWindowGUI *gui)
2036 this->mwindow = mwindow;
2040 int AWindowListFormat::handle_event()
2042 gui->stop_vicon_drawing();
2044 EDLSession *session = mwindow->edl->session;
2045 switch( session->assetlist_format ) {
2047 session->assetlist_format = ASSETS_ICONS;
2050 session->assetlist_format = ASSETS_TEXT;
2054 gui->asset_list->update_format(session->assetlist_format, 1);
2055 if( !mwindow->awindow->gui->allow_iconlisting ) {
2056 mwindow->edl->session->assetlist_format = ASSETS_TEXT;
2059 gui->start_vicon_drawing();
2063 void AWindowListFormat::update()
2065 set_text(mwindow->edl->session->assetlist_format == ASSETS_TEXT ?
2066 (char*)_("Display icons") : (char*)_("Display text"));
2069 AWindowListSort::AWindowListSort(MWindow *mwindow, AWindowGUI *gui)
2070 : BC_MenuItem(_("Sort items"))
2072 this->mwindow = mwindow;
2076 int AWindowListSort::handle_event()