4 * Copyright (C) 1997-2012 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "assetedit.h"
24 #include "assetpopup.h"
26 #include "awindowgui.h"
27 #include "awindowgui.inc"
29 #include "awindowmenu.h"
30 #include "bcsignals.h"
33 #include "bccmodels.h"
35 #include "cwindowgui.h"
38 #include "edlsession.h"
40 #include "filesystem.h"
41 #include "indexable.h"
45 #include "labeledit.h"
46 #include "localsession.h"
48 #include "mainsession.h"
49 #include "mwindowgui.h"
51 #include "nestededls.h"
52 #include "newfolder.h"
53 #include "preferences.h"
57 #include "vwindowgui.h"
60 #include "data/lad_picon_png.h"
61 #include "data/ff_audio_png.h"
62 #include "data/ff_video_png.h"
69 const char *AWindowGUI::folder_names[] =
73 N_("Audio Transitions"),
74 N_("Video Transitions"),
82 AssetVIcon::AssetVIcon(AssetPicon *picon, int w, int h, double framerate, int64_t length)
83 : VIcon(w, h, framerate)
86 this->length = length;
90 AssetVIcon::~AssetVIcon()
95 VFrame *AssetVIcon::frame()
97 if( seq_no >= images.size() ) {
98 MWindow *mwindow = picon->mwindow;
99 Asset *asset = (Asset *)picon->indexable;
100 File *file = mwindow->video_cache->check_out(asset, mwindow->edl, 1);
101 if( !file ) return 0;
102 if( temp && (temp->get_w() != asset->width || temp->get_h() != asset->height) ) {
103 delete temp; temp = 0;
106 temp = new VFrame(asset->width, asset->height, BC_RGB888);
107 int ww = picon->gui->vicon_thread->view_w;
108 int hh = picon->gui->vicon_thread->view_h;
109 while( seq_no >= images.size() ) {
111 int64_t pos = images.size() / picon->gui->vicon_thread->refresh_rate * frame_rate;
112 file->set_video_position(pos,0);
113 file->read_frame(temp);
114 add_image(temp, ww, hh, BC_RGB8);
116 mwindow->video_cache->check_in(asset);
118 return *images[seq_no];
121 int64_t AssetVIcon::set_seq_no(int64_t no)
123 if( no >= length ) no = 0;
127 int AssetVIcon::get_vx()
129 BC_ListBox *lbox = picon->gui->asset_list;
130 return lbox->get_item_x(picon);
132 int AssetVIcon::get_vy()
134 BC_ListBox *lbox = picon->gui->asset_list;
135 return lbox->get_item_y(picon) + lbox->get_title_h();
138 AssetPicon::AssetPicon(MWindow *mwindow,
140 Indexable *indexable)
144 this->mwindow = mwindow;
146 this->indexable = indexable;
147 indexable->add_user();
148 this->id = indexable->id;
151 AssetPicon::AssetPicon(MWindow *mwindow,
157 this->mwindow = mwindow;
164 AssetPicon::AssetPicon(MWindow *mwindow,
165 AWindowGUI *gui, int folder)
166 : BC_ListBoxItem(_(AWindowGUI::folder_names[folder]), gui->folder_icon)
170 this->mwindow = mwindow;
174 AssetPicon::AssetPicon(MWindow *mwindow,
175 AWindowGUI *gui, const char *folder_name, int folder_num)
176 : BC_ListBoxItem(folder_name, gui->folder_icon)
179 foldernum = folder_num;
180 this->mwindow = mwindow;
184 AssetPicon::AssetPicon(MWindow *mwindow,
186 PluginServer *plugin)
190 this->mwindow = mwindow;
192 this->plugin = plugin;
196 AssetPicon::AssetPicon(MWindow *mwindow,
202 this->mwindow = mwindow;
210 AssetPicon::~AssetPicon()
213 gui->vicon_thread->del_vicon(vicon);
214 if(indexable) indexable->remove_user();
215 if(edl) edl->remove_user();
216 if( icon && !gui->protected_pixmap(icon) ) {
218 if( !plugin ) delete icon_vframe;
222 void AssetPicon::reset()
236 void AssetPicon::create_objects()
239 char name[BCTEXTLEN];
240 int pixmap_w, pixmap_h;
243 pixmap_h = 50 * BC_WindowBase::get_resources()->icon_scale;
245 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
248 fs.extract_name(name, indexable->path);
252 if(indexable && indexable->is_asset)
254 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
255 Asset *asset = (Asset*)indexable;
256 if(asset->video_data)
258 if(mwindow->preferences->use_thumbnails)
260 gui->unlock_window();
261 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
262 File *file = mwindow->video_cache->check_out(asset,
265 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
269 int height = asset->height > 0 ? asset->height : 1;
270 pixmap_w = pixmap_h * asset->width / height;
273 file->set_video_position(0, 0);
275 if(gui->temp_picon &&
276 (gui->temp_picon->get_w() != asset->width ||
277 gui->temp_picon->get_h() != asset->height))
279 delete gui->temp_picon;
285 gui->temp_picon = new VFrame(0, -1,
286 asset->width, asset->height,
290 file->read_frame(gui->temp_picon);
291 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
292 mwindow->video_cache->check_in(asset);
294 gui->lock_window("AssetPicon::create_objects 1");
295 icon = new BC_Pixmap(gui, pixmap_w, pixmap_h);
296 icon->draw_vframe(gui->temp_picon,
297 0, 0, pixmap_w, pixmap_h, 0, 0);
298 //printf("%d %d\n", gui->temp_picon->get_w(), gui->temp_picon->get_h());
299 icon_vframe = new VFrame(0,
300 -1, pixmap_w, pixmap_h, BC_RGB888, -1);
301 icon_vframe->transfer_from(gui->temp_picon);
303 double framerate = asset->get_frame_rate();
304 if( !framerate ) framerate = VICON_RATE;
305 int64_t frames = asset->get_video_frames();
306 double secs = frames / framerate;
307 if( secs > 5 ) secs = 5;
308 int64_t length = secs * gui->vicon_thread->refresh_rate;
309 vicon = new AssetVIcon(this, pixmap_w, pixmap_h, framerate, length);
310 gui->vicon_thread->add_vicon(vicon);
311 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
316 gui->lock_window("AssetPicon::create_objects 2");
317 icon = gui->video_icon;
318 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
323 icon = gui->video_icon;
324 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
328 if(asset->audio_data)
330 icon = gui->audio_icon;
331 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND];
333 //printf("AssetPicon::create_objects 2\n");
335 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
338 if(indexable && !indexable->is_asset)
340 icon = gui->video_icon;
341 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
346 //printf("AssetPicon::create_objects 4 %s\n", edl->local_session->clip_title);
347 set_text(strcpy(name, edl->local_session->clip_title));
348 icon = gui->clip_icon;
349 icon_vframe = mwindow->theme->get_image("clip_icon");
354 strcpy(name, _(plugin->title));
356 icon_vframe = plugin->get_picon();
358 icon = gui->create_pixmap(icon_vframe);
359 else if( plugin->audio ) {
360 if( plugin->transition ) {
361 icon = gui->atransition_icon;
362 icon_vframe = gui->atransition_vframe;
364 else if( plugin->is_ffmpeg() ) {
365 icon = gui->ff_aud_icon;
366 icon_vframe = gui->ff_aud_vframe;
368 else if( plugin->is_ladspa() ) {
369 icon = gui->ladspa_icon;
370 icon_vframe = gui->ladspa_vframe;
373 icon = gui->aeffect_icon;
374 icon_vframe = gui->aeffect_vframe;
377 else if( plugin->video ) {
378 if( plugin->transition ) {
379 icon = gui->vtransition_icon;
380 icon_vframe = gui->vtransition_vframe;
382 else if( plugin->is_ffmpeg() ) {
383 icon = gui->ff_vid_icon;
384 icon_vframe = gui->ff_vid_vframe;
387 icon = gui->veffect_icon;
388 icon_vframe = gui->veffect_vframe;
396 mwindow->edl->session->time_format,
397 mwindow->edl->session->sample_rate,
398 mwindow->edl->session->frame_rate,
399 mwindow->edl->session->frames_per_foot);
401 icon = gui->file_icon;
402 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN];
404 set_icon_vframe(icon_vframe);
407 icon = gui->file_icon;
408 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN];
411 set_icon_vframe(icon_vframe);
413 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
421 AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow)
422 : BC_Window(_(PROGRAM_NAME ": Resources"),
423 mwindow->session->awindow_x, mwindow->session->awindow_y,
424 mwindow->session->awindow_w, mwindow->session->awindow_h,
427 // printf("AWindowGUI::AWindowGUI %d %d %d %d\n",
428 // mwindow->session->awindow_x,
429 // mwindow->session->awindow_y,
430 // mwindow->session->awindow_w,
431 // mwindow->session->awindow_h);
432 this->mwindow = mwindow;
433 this->awindow = awindow;
439 atransition_icon = 0; atransition_vframe = 0;
440 vtransition_icon = 0; vtransition_vframe = 0;
441 aeffect_icon = 0; aeffect_vframe = 0;
442 ladspa_icon = 0; ladspa_vframe = 0;
443 veffect_icon = 0; veffect_vframe = 0;
444 ff_aud_icon = 0; ff_aud_vframe = 0;
445 ff_vid_icon = 0; ff_vid_vframe = 0;
446 plugin_visibility = ((uint64_t)1<<(8*sizeof(uint64_t)-1))-1;
447 newfolder_thread = 0;
452 allow_iconlisting = 1;
458 AWindowGUI::~AWindowGUI()
460 assets.remove_all_objects();
461 folders.remove_all_objects();
462 aeffects.remove_all_objects();
463 veffects.remove_all_objects();
464 atransitions.remove_all_objects();
465 vtransitions.remove_all_objects();
466 labellist.remove_all_objects();
467 displayed_assets[1].remove_all_objects();
475 delete atransition_icon;
476 delete vtransition_icon;
479 delete ladspa_vframe;
481 delete ff_aud_vframe;
483 delete ff_vid_vframe;
485 delete newfolder_thread;
488 delete assetlist_menu;
489 delete folderlist_menu;
490 if(temp_picon) delete temp_picon;
491 delete remove_plugin;
494 bool AWindowGUI::protected_pixmap(BC_Pixmap *icon)
496 return icon == file_icon ||
497 icon == folder_icon ||
498 icon == audio_icon ||
499 icon == video_icon ||
501 icon == vtransition_icon ||
502 icon == atransition_icon ||
503 icon == veffect_icon ||
504 icon == aeffect_icon ||
505 icon == ladspa_icon ||
506 icon == ff_aud_icon ||
510 void AWindowGUI::create_objects()
514 lock_window("AWindowGUI::create_objects");
516 //printf("AWindowGUI::create_objects 1\n");
517 asset_titles[0] = _("Title");
518 asset_titles[1] = _("Comments");
522 set_icon(mwindow->theme->get_image("awindow_icon"));
523 file_icon = new BC_Pixmap(this,
524 BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN],
527 folder_icon = new BC_Pixmap(this,
528 BC_WindowBase::get_resources()->type_to_icon[ICON_FOLDER],
531 audio_icon = new BC_Pixmap(this,
532 BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND],
535 video_icon = new BC_Pixmap(this,
536 BC_WindowBase::get_resources()->type_to_icon[ICON_FILM],
541 clip_vframe = mwindow->theme->get_image("clip_icon");
542 clip_icon = new BC_Pixmap(this, clip_vframe, PIXMAP_ALPHA);
543 atransition_vframe = mwindow->theme->get_image("atransition_icon");
544 atransition_icon = new BC_Pixmap(this, atransition_vframe, PIXMAP_ALPHA);
545 vtransition_vframe = mwindow->theme->get_image("vtransition_icon");
546 vtransition_icon = new BC_Pixmap(this, vtransition_vframe, PIXMAP_ALPHA);
547 aeffect_vframe = mwindow->theme->get_image("aeffect_icon");
548 aeffect_icon = new BC_Pixmap(this, aeffect_vframe, PIXMAP_ALPHA);
549 ladspa_vframe = new VFramePng(lad_picon_png);
550 ladspa_icon = new BC_Pixmap(this, ladspa_vframe, PIXMAP_ALPHA);
551 ff_aud_vframe = new VFramePng(ff_audio_png);
552 ff_aud_icon = new BC_Pixmap(this, ff_aud_vframe, PIXMAP_ALPHA);
553 ff_vid_vframe = new VFramePng(ff_video_png);
554 ff_vid_icon = new BC_Pixmap(this, ff_vid_vframe, PIXMAP_ALPHA);
555 veffect_vframe = mwindow->theme->get_image("veffect_icon");
556 veffect_icon = new BC_Pixmap(this, veffect_vframe, PIXMAP_ALPHA);
561 folders.append(picon = new AssetPicon(mwindow, this, AW_AEFFECT_FOLDER));
562 picon->persistent = 1;
563 folders.append(picon = new AssetPicon(mwindow, this, AW_VEFFECT_FOLDER));
564 picon->persistent = 1;
565 folders.append(picon = new AssetPicon(mwindow, this, AW_ATRANSITION_FOLDER));
566 picon->persistent = 1;
567 folders.append(picon = new AssetPicon(mwindow, this, AW_VTRANSITION_FOLDER));
568 picon->persistent = 1;
569 folders.append(picon = new AssetPicon(mwindow, this, AW_LABEL_FOLDER));
570 picon->persistent = 1;
571 folders.append(picon = new AssetPicon(mwindow, this, AW_CLIP_FOLDER));
572 picon->persistent = 1;
573 folders.append(picon = new AssetPicon(mwindow, this, AW_MEDIA_FOLDER));
574 picon->persistent = 1;
576 create_label_folder();
579 mwindow->theme->get_awindow_sizes(this);
580 load_defaults(mwindow->defaults);
583 add_subwindow(asset_list = new AWindowAssets(mwindow,
585 mwindow->theme->alist_x,
586 mwindow->theme->alist_y,
587 mwindow->theme->alist_w,
588 mwindow->theme->alist_h));
590 vicon_thread = new VIconThread(asset_list);
591 vicon_thread->start();
594 add_subwindow(divider = new AWindowDivider(mwindow,
596 mwindow->theme->adivider_x,
597 mwindow->theme->adivider_y,
598 mwindow->theme->adivider_w,
599 mwindow->theme->adivider_h));
602 divider->set_cursor(HSEPARATE_CURSOR, 0, 0);
605 int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y;
606 int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h;
607 VFrame **images = mwindow->theme->get_image_set("playpatch_data");
608 AVIconDrawing::calculate_geometry(this, images, &avicon_w, &avicon_h);
609 add_subwindow(avicon_drawing = new AVIconDrawing(this, fw-avicon_w, fy, images));
610 add_subwindow(add_tools = new AddTools(mwindow, this, fx, fy, _("Visibility")));
611 add_tools->create_objects();
612 fy += add_tools->get_h(); fh -= add_tools->get_h();
614 add_subwindow(folder_list = new AWindowFolders(mwindow,
615 this, fx, fy, fw, fh));
620 //int x = mwindow->theme->abuttons_x;
621 //int y = mwindow->theme->abuttons_y;
625 newfolder_thread = new NewFolderThread(mwindow, this);
627 add_subwindow(asset_menu = new AssetPopup(mwindow, this));
628 asset_menu->create_objects();
630 add_subwindow(label_menu = new LabelPopup(mwindow, this));
631 label_menu->create_objects();
635 add_subwindow(assetlist_menu = new AssetListMenu(mwindow, this));
638 assetlist_menu->create_objects();
642 add_subwindow(folderlist_menu = new FolderListMenu(mwindow, this));
643 folderlist_menu->create_objects();
644 //printf("AWindowGUI::create_objects 2\n");
647 create_custom_xatoms();
651 int AWindowGUI::resize_event(int w, int h)
653 mwindow->session->awindow_x = get_x();
654 mwindow->session->awindow_y = get_y();
655 mwindow->session->awindow_w = w;
656 mwindow->session->awindow_h = h;
658 mwindow->theme->get_awindow_sizes(this);
659 mwindow->theme->draw_awindow_bg(this);
660 reposition_objects();
662 // int x = mwindow->theme->abuttons_x;
663 // int y = mwindow->theme->abuttons_y;
664 // new_bin->reposition_window(x, y);
665 // x += new_bin->get_w();
666 // delete_bin->reposition_window(x, y);
667 // x += delete_bin->get_w();
668 // rename_bin->reposition_window(x, y);
669 // x += rename_bin->get_w();
670 // delete_disk->reposition_window(x, y);
671 // x += delete_disk->get_w();
672 // delete_project->reposition_window(x, y);
673 // x += delete_project->get_w();
674 // info->reposition_window(x, y);
675 // x += info->get_w();
676 // redraw_index->reposition_window(x, y);
677 // x += redraw_index->get_w();
678 // paste->reposition_window(x, y);
679 // x += paste->get_w();
680 // append->reposition_window(x, y);
681 // x += append->get_w();
682 // view->reposition_window(x, y);
684 BC_WindowBase::resize_event(w, h);
688 int AWindowGUI::translation_event()
690 mwindow->session->awindow_x = get_x();
691 mwindow->session->awindow_y = get_y();
695 void AWindowGUI::reposition_objects()
697 asset_list->reposition_window(
698 mwindow->theme->alist_x, mwindow->theme->alist_y,
699 mwindow->theme->alist_w, mwindow->theme->alist_h);
700 divider->reposition_window(
701 mwindow->theme->adivider_x, mwindow->theme->adivider_y,
702 mwindow->theme->adivider_w, mwindow->theme->adivider_h);
703 int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y;
704 int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h;
705 add_tools->resize_event(fw-avicon_w, add_tools->get_h());
706 avicon_drawing->reposition_window(fw-avicon_w, fy);
707 fy += add_tools->get_h(); fh -= add_tools->get_h();
708 folder_list->reposition_window(fx, fy, fw, fh);
711 int AWindowGUI::save_defaults(BC_Hash *defaults)
713 defaults->update("PLUGIN_VISIBILTY", plugin_visibility);
714 defaults->update("VICON_DRAWING", vicon_drawing);
718 int AWindowGUI::load_defaults(BC_Hash *defaults)
720 plugin_visibility = defaults->get("PLUGIN_VISIBILTY", plugin_visibility);
721 vicon_drawing = defaults->get("VICON_DRAWING", vicon_drawing);
725 int AWindowGUI::close_event()
728 mwindow->session->show_awindow = 0;
731 mwindow->gui->lock_window("AWindowGUI::close_event");
732 mwindow->gui->mainmenu->show_awindow->set_checked(0);
733 mwindow->gui->unlock_window();
735 lock_window("AWindowGUI::close_event");
736 save_defaults(mwindow->defaults);
737 mwindow->save_defaults();
741 void AWindowGUI::start_vicon_drawing()
743 if( !vicon_drawing ) return;
744 if( mwindow->edl->session->awindow_folder != AW_MEDIA_FOLDER ) return;
745 if( mwindow->edl->session->assetlist_format != ASSETS_ICONS ) return;
746 vicon_thread->start_drawing();
749 void AWindowGUI::stop_vicon_drawing()
751 vicon_thread->stop_drawing();
754 AWindowRemovePluginGUI::
755 AWindowRemovePluginGUI(AWindow *awindow, AWindowRemovePlugin *thread,
756 int x, int y, PluginServer *plugin)
757 : BC_Window(_(PROGRAM_NAME ": Remove plugin"), x,y, 500,200, 50, 50, 1, 0, 1, -1, "", 1)
759 this->awindow = awindow;
760 this->thread = thread;
761 this->plugin = plugin;
762 VFrame *vframe = plugin->get_picon();
763 icon = vframe ? create_pixmap(vframe) : 0;
764 plugin_list.append(new BC_ListBoxItem(plugin->title, icon));
767 AWindowRemovePluginGUI::
768 ~AWindowRemovePluginGUI()
770 if( !awindow->gui->protected_pixmap(icon) )
772 plugin_list.remove_all();
775 void AWindowRemovePluginGUI::create_objects()
777 BC_Button *ok_button = new BC_OKButton(this);
778 add_subwindow(ok_button);
779 BC_Button *cancel_button = new BC_CancelButton(this);
780 add_subwindow(cancel_button);
782 BC_Title *title = new BC_Title(x, y, _("remove plugin?"));
783 add_subwindow(title);
784 y += title->get_h() + 5;
785 list = new BC_ListBox(x, y,
786 get_w() - 20, ok_button->get_y() - y - 5, LISTBOX_TEXT, &plugin_list,
787 0, 0, 1, 0, 0, LISTBOX_SINGLE, ICON_LEFT, 0);
792 int AWindowRemovePlugin::remove_plugin(PluginServer *plugin, ArrayList<BC_ListBoxItem*> &folder)
795 for( int i=0; i<folder.size(); ) {
796 AssetPicon *picon = (AssetPicon *)folder[i];
797 if( picon->plugin == plugin ) {
798 folder.remove_object_number(i);
807 void AWindowRemovePlugin::handle_close_event(int result)
810 printf(_("remove %s\n"), plugin->path);
811 ArrayList<BC_ListBoxItem*> *folder =
812 plugin->audio ? plugin->transition ?
813 &awindow->gui->atransitions :
814 &awindow->gui->aeffects :
815 plugin->video ? plugin->transition ?
816 &awindow->gui->vtransitions :
817 &awindow->gui->veffects :
819 if( folder ) remove_plugin(plugin, *folder);
820 char plugin_path[BCTEXTLEN];
821 strcpy(plugin_path, plugin->path);
822 MWindow *mwindow = awindow->mwindow;
823 mwindow->plugindb->remove(plugin);
825 char index_path[BCTEXTLEN];
826 sprintf(index_path, "%s/%s", mwindow->preferences->plugin_dir, PLUGIN_FILE);
828 char png_path[BCTEXTLEN];
829 if( plugin->get_theme_png_path(png_path, mwindow->preferences->theme) )
831 if( plugin->get_theme_png_path(png_path, "picon") )
833 delete plugin; plugin = 0;
834 awindow->gui->async_update_assets();
838 AWindowRemovePlugin::
839 AWindowRemovePlugin(AWindow *awindow, PluginServer *plugin)
842 this->awindow = awindow;
843 this->plugin = plugin;
846 AWindowRemovePlugin::
847 ~AWindowRemovePlugin()
852 BC_Window* AWindowRemovePlugin::new_gui()
854 int x = awindow->gui->get_abs_cursor_x(0);
855 int y = awindow->gui->get_abs_cursor_y(0);
856 AWindowRemovePluginGUI *gui = new AWindowRemovePluginGUI(awindow, this, x, y, plugin);
857 gui->create_objects();
861 int AWindowGUI::keypress_event()
863 switch(get_keypress()) {
872 PluginServer* plugin = selected_plugin();
874 remove_plugin = new AWindowRemovePlugin(awindow, plugin);
876 remove_plugin->start();
885 int AWindowGUI::create_custom_xatoms()
887 UpdateAssetsXAtom = create_xatom("CWINDOWGUI_UPDATE_ASSETS");
890 int AWindowGUI::recieve_custom_xatoms(xatom_event *event)
892 if( event->message_type == UpdateAssetsXAtom ) {
899 void AWindowGUI::async_update_assets()
902 event.message_type = UpdateAssetsXAtom;
903 send_custom_xatom(&event);
912 void AWindowGUI::update_folder_list()
914 stop_vicon_drawing();
915 //printf("AWindowGUI::update_folder_list 1\n");
916 for(int i = 0; i < folders.total; i++)
918 AssetPicon *picon = (AssetPicon*)folders.values[i];
921 //printf("AWindowGUI::update_folder_list 1\n");
923 // Search assets for folders
924 for(int i = 0; i < mwindow->edl->folders.total; i++)
926 const char *folder = mwindow->edl->folders.values[i];
928 //printf("AWindowGUI::update_folder_list 1.1\n");
930 for(int j = 0; j < folders.total; j++)
932 AssetPicon *picon = (AssetPicon*)folders.values[j];
933 if(!strcasecmp(picon->get_text(), folder))
943 int aw_folder = folder_number(folder);
944 AssetPicon *picon = aw_folder >= 0 ?
945 new AssetPicon(mwindow, this, aw_folder) :
946 new AssetPicon(mwindow, this, folder, AW_USER_FOLDER);
947 picon->create_objects();
948 folders.append(picon);
950 //printf("AWindowGUI::update_folder_list 1.3\n");
952 //printf("AWindowGUI::update_folder_list 1\n");
953 //for(int i = 0; i < folders.total; i++)
954 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
957 for(int i = folders.total - 1; i >= 0; i--)
959 AssetPicon *picon = (AssetPicon*)folders.values[i];
960 if(!picon->in_use && !picon->persistent)
963 folders.remove_number(i);
966 //for(int i = 0; i < folders.total; i++)
967 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
968 //printf("AWindowGUI::update_folder_list 2\n");
969 start_vicon_drawing();
972 void AWindowGUI::create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
973 int do_audio, int do_video, int is_realtime, int is_transition)
975 ArrayList<PluginServer*> plugin_list;
976 // Get pointers to plugindb entries
977 mwindow->search_plugindb(do_audio, do_video, is_realtime, is_transition,
980 for(int i = 0; i < plugin_list.total; i++) {
981 PluginServer *server = plugin_list.values[i];
982 int visible = plugin_visibility & (1<<server->dir_idx);
983 if(!visible) continue;
984 // Create new listitem
985 AssetPicon *picon = new AssetPicon(mwindow, this, server);
986 picon->create_objects();
987 output->append(picon);
991 void AWindowGUI::create_label_folder()
994 for(current = mwindow->edl->labels->first; current; current = NEXT) {
995 AssetPicon *picon = new AssetPicon(mwindow, this, current);
996 picon->create_objects();
997 labellist.append(picon);
1002 void AWindowGUI::update_asset_list()
1004 //printf("AWindowGUI::update_asset_list 1\n");
1005 for(int i = 0; i < assets.total; i++)
1007 AssetPicon *picon = (AssetPicon*)assets.values[i];
1015 //printf("AWindowGUI::update_asset_list 2\n");
1018 // Synchronize EDL clips
1019 for(int i = 0; i < mwindow->edl->clips.total; i++)
1023 // Look for clip in existing listitems
1024 for(int j = 0; j < assets.total && !exists; j++)
1026 AssetPicon *picon = (AssetPicon*)assets.values[j];
1028 if(picon->id == mwindow->edl->clips.values[i]->id)
1030 picon->edl = mwindow->edl->clips.values[i];
1031 picon->set_text(mwindow->edl->clips.values[i]->local_session->clip_title);
1037 // Create new listitem
1040 AssetPicon *picon = new AssetPicon(mwindow,
1042 mwindow->edl->clips.values[i]);
1043 picon->create_objects();
1044 assets.append(picon);
1052 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1055 // Synchronize EDL assets
1056 for(Asset *current = mwindow->edl->assets->first;
1062 // Look for asset in existing listitems
1063 for(int j = 0; j < assets.total && !exists; j++)
1065 AssetPicon *picon = (AssetPicon*)assets.values[j];
1067 if(picon->id == current->id)
1069 picon->indexable = current;
1076 // Create new listitem
1079 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1080 AssetPicon *picon = new AssetPicon(mwindow, this, current);
1081 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1082 picon->create_objects();
1083 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1084 assets.append(picon);
1090 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1093 // Synchronize nested EDLs
1094 for(int i = 0; i < mwindow->edl->nested_edls->size(); i++)
1097 Indexable *indexable = mwindow->edl->nested_edls->get(i);
1099 // Look for asset in existing listitems
1100 for(int j = 0; j < assets.total && !exists; j++)
1102 AssetPicon *picon = (AssetPicon*)assets.values[j];
1104 if(picon->id == indexable->id)
1106 picon->indexable = indexable;
1113 // Create new listitem
1116 AssetPicon *picon = new AssetPicon(mwindow,
1119 picon->create_objects();
1120 assets.append(picon);
1132 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1133 for(int i = assets.size() - 1; i >= 0; i--)
1135 AssetPicon *picon = (AssetPicon*)assets.get(i);
1136 //printf("AWindowGUI::update_asset_list %s %d\n", picon->asset->path, picon->in_use);
1140 assets.remove_number(i);
1143 //printf("AWindowGUI::update_asset_list 7 %d\n", assets.total);
1146 void AWindowGUI::update_picon(Indexable *indexable)
1148 //printf("AWindowGUI::update_asset_list 1\n");
1150 for(int i = 0; i < assets.total; i++) {
1151 AssetPicon *picon = (AssetPicon*)assets.values[i];
1152 if( picon->indexable == indexable ||
1153 picon->edl == (EDL *)indexable ) {
1154 char name[BCTEXTLEN];
1156 fs.extract_name(name, indexable->path);
1157 picon->set_text(name);
1158 vicon = picon->vicon;
1163 stop_vicon_drawing();
1164 vicon->clear_images();
1165 vicon->reset(indexable->get_frame_rate());
1166 start_vicon_drawing();
1170 void AWindowGUI::sort_assets()
1172 //printf("AWindowGUI::sort_assets 1 %s\n", mwindow->edl->session->current_folder);
1173 switch( mwindow->edl->session->awindow_folder ) {
1174 case AW_AEFFECT_FOLDER:
1175 sort_picons(&aeffects);
1177 case AW_VEFFECT_FOLDER:
1178 sort_picons(&veffects);
1180 case AW_ATRANSITION_FOLDER:
1181 sort_picons(&atransitions);
1183 case AW_VTRANSITION_FOLDER:
1184 sort_picons(&vtransitions);
1186 case AW_LABEL_FOLDER:
1187 // Labels should ALWAYS be sorted by time
1190 sort_picons(&assets);
1196 void AWindowGUI::collect_assets()
1199 mwindow->session->drag_assets->remove_all();
1200 mwindow->session->drag_clips->remove_all();
1203 AssetPicon *result = (AssetPicon*)asset_list->get_selection(0, i++);
1206 if(result->indexable) mwindow->session->drag_assets->append(result->indexable);
1207 if(result->edl) mwindow->session->drag_clips->append(result->edl);
1211 void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst,
1212 ArrayList<BC_ListBoxItem*> *src, int folder)
1214 // Remove current pointers
1215 dst[0].remove_all();
1216 dst[1].remove_all_objects();
1218 // Create new pointers
1219 //if(folder) printf("AWindowGUI::copy_picons 1 %s\n", folder);
1220 for(int i = 0; i < src->total; i++)
1222 AssetPicon *picon = (AssetPicon*)src->values[i];
1223 //printf("AWindowGUI::copy_picons 2 %s\n", picon->asset->folder);
1225 (picon->indexable && picon->indexable->awindow_folder == folder) ||
1226 (picon->edl && picon->edl->local_session->awindow_folder == folder) ) {
1227 BC_ListBoxItem *item2, *item1;
1228 dst[0].append(item1 = picon);
1230 dst[1].append(item2 = new BC_ListBoxItem(picon->edl->local_session->clip_notes));
1232 if(picon->label && picon->label->textstr)
1233 dst[1].append(item2 = new BC_ListBoxItem(picon->label->textstr));
1235 dst[1].append(item2 = new BC_ListBoxItem(""));
1236 item1->set_autoplace_text(1);
1237 item2->set_autoplace_text(1);
1238 //printf("AWindowGUI::copy_picons 3 %s\n", picon->get_text());
1243 void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src)
1245 //printf("AWindowGUI::sort_picons 1\n")
1250 for(int i = 0; i < src->total - 1; i++)
1252 BC_ListBoxItem *item1 = src->values[i];
1253 BC_ListBoxItem *item2 = src->values[i + 1];
1254 item1->set_autoplace_icon(1);
1255 item2->set_autoplace_icon(1);
1256 item1->set_autoplace_text(1);
1257 item2->set_autoplace_text(1);
1258 if(strcmp(item1->get_text(), item2->get_text()) > 0)
1260 src->values[i + 1] = item1;
1261 src->values[i] = item2;
1269 void AWindowGUI::filter_displayed_assets()
1271 allow_iconlisting = 1;
1272 asset_titles[0] = _("Title");
1273 asset_titles[1] = _("Comments");
1275 switch( mwindow->edl->session->awindow_folder ) {
1276 case AW_AEFFECT_FOLDER:
1277 copy_picons(displayed_assets, &aeffects, AW_NO_FOLDER);
1279 case AW_VEFFECT_FOLDER:
1280 copy_picons(displayed_assets, &veffects, AW_NO_FOLDER);
1282 case AW_ATRANSITION_FOLDER:
1283 copy_picons(displayed_assets, &atransitions, AW_NO_FOLDER);
1285 case AW_VTRANSITION_FOLDER:
1286 copy_picons(displayed_assets, &vtransitions, AW_NO_FOLDER);
1288 case AW_LABEL_FOLDER:
1289 copy_picons(displayed_assets, &labellist, AW_NO_FOLDER);
1290 asset_titles[0] = _("Time Stamps");
1291 asset_titles[1] = _("Title");
1292 allow_iconlisting = 0;
1295 copy_picons(displayed_assets, &assets, mwindow->edl->session->awindow_folder);
1299 // Ensure the current folder icon is highlighted
1300 for(int i = 0; i < folders.total; i++)
1301 folders.values[i]->set_selected(0);
1303 folders.values[mwindow->edl->session->awindow_folder]->set_selected(1);
1307 void AWindowGUI::update_assets()
1309 //printf("AWindowGUI::update_assets 1\n");
1310 update_folder_list();
1311 //printf("AWindowGUI::update_assets 2\n");
1312 update_asset_list();
1313 labellist.remove_all_objects();
1314 create_label_folder();
1315 //printf("AWindowGUI::update_assets 3\n");
1316 filter_displayed_assets();
1318 //for(int i = 0; i < folders.total; i++)
1319 //printf("AWindowGUI::update_assets 4\n");
1320 // printf("AWindowGUI::update_assets %s\n", folders.values[i]->get_text());
1321 if(mwindow->edl->session->folderlist_format != folder_list->get_format())
1322 folder_list->update_format(mwindow->edl->session->folderlist_format, 0);
1323 folder_list->update(&folders,
1327 folder_list->get_xposition(),
1328 folder_list->get_yposition(),
1330 //printf("AWindowGUI::update_assets 5\n");
1332 if(mwindow->edl->session->assetlist_format != asset_list->get_format())
1333 asset_list->update_format(mwindow->edl->session->assetlist_format, 0);
1336 //printf("AWindowGUI::update_assets 6 %d\n", displayed_assets[0].total);
1337 asset_list->update(displayed_assets,
1339 mwindow->edl->session->asset_columns,
1341 asset_list->get_xposition(),
1342 asset_list->get_yposition(),
1345 asset_list->center_selection();
1346 //printf("AWindowGUI::update_assets 7\n");
1349 //printf("AWindowGUI::update_assets 8\n");
1353 void AWindowGUI::update_effects()
1355 aeffects.remove_all_objects();
1356 create_persistent_folder(&aeffects, 1, 0, 1, 0);
1357 veffects.remove_all_objects();
1358 create_persistent_folder(&veffects, 0, 1, 1, 0);
1359 atransitions.remove_all_objects();
1360 create_persistent_folder(&atransitions, 1, 0, 0, 1);
1361 vtransitions.remove_all_objects();
1362 create_persistent_folder(&vtransitions, 0, 1, 0, 1);
1365 int AWindowGUI::folder_number(const char *name)
1367 for(int i = 0; i < AWINDOW_FOLDERS; i++) {
1368 if( !strcasecmp(name, folder_names[i]) ) return i;
1370 return AW_NO_FOLDER;
1373 int AWindowGUI::drag_motion()
1375 if(get_hidden()) return 0;
1381 int AWindowGUI::drag_stop()
1383 if(get_hidden()) return 0;
1388 Indexable* AWindowGUI::selected_asset()
1390 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1391 return picon ? picon->indexable : 0;
1394 PluginServer* AWindowGUI::selected_plugin()
1396 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1397 return picon ? picon->plugin : 0;
1400 AssetPicon* AWindowGUI::selected_folder()
1402 AssetPicon *picon = (AssetPicon*)folder_list->get_selection(0, 0);
1413 AWindowDivider::AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1414 : BC_SubWindow(x, y, w, h)
1416 this->mwindow = mwindow;
1419 AWindowDivider::~AWindowDivider()
1423 int AWindowDivider::button_press_event()
1425 if(is_event_win() && cursor_inside())
1427 mwindow->session->current_operation = DRAG_PARTITION;
1433 int AWindowDivider::cursor_motion_event()
1435 if(mwindow->session->current_operation == DRAG_PARTITION)
1438 int wmax = mwindow->session->awindow_w - mwindow->theme->adivider_w - wmin;
1439 int fw = gui->get_relative_cursor_x();
1440 if( fw > wmax ) fw = wmax;
1441 if( fw < wmin ) fw = wmin;
1442 mwindow->session->afolders_w = fw;
1443 mwindow->theme->get_awindow_sizes(gui);
1444 gui->reposition_objects();
1450 int AWindowDivider::button_release_event()
1452 if(mwindow->session->current_operation == DRAG_PARTITION)
1454 mwindow->session->current_operation = NO_OPERATION;
1465 AWindowFolders::AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1470 mwindow->edl->session->folderlist_format == ASSETS_ICONS ?
1471 LISTBOX_ICONS : LISTBOX_TEXT,
1472 &gui->folders, // Each column has an ArrayList of BC_ListBoxItems.
1473 0, // Titles for columns. Set to 0 for no titles
1474 0, // width of each column
1475 1, // Total columns.
1476 0, // Pixel of top of window.
1477 0, // If this listbox is a popup window
1478 LISTBOX_SINGLE, // Select one item or multiple items
1479 ICON_TOP, // Position of icon relative to text of each item
1482 this->mwindow = mwindow;
1487 AWindowFolders::~AWindowFolders()
1491 int AWindowFolders::selection_changed()
1493 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1496 gui->stop_vicon_drawing();
1498 if(get_button_down() && get_buttonpress() == 3)
1500 gui->folderlist_menu->update_titles();
1501 gui->folderlist_menu->activate_menu();
1504 mwindow->edl->session->awindow_folder = picon->foldernum;
1505 //printf("AWindowFolders::selection_changed 1\n");
1506 gui->asset_list->draw_background();
1507 gui->async_update_assets();
1509 gui->start_vicon_drawing();
1514 int AWindowFolders::button_press_event()
1518 result = BC_ListBox::button_press_event();
1522 if(get_buttonpress() == 3 && is_event_win() && cursor_inside())
1524 gui->folderlist_menu->update_titles();
1525 gui->folderlist_menu->activate_menu();
1540 AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1545 (mwindow->edl->session->assetlist_format == ASSETS_ICONS && gui->allow_iconlisting ) ?
1546 LISTBOX_ICONS : LISTBOX_TEXT,
1547 &gui->assets, // Each column has an ArrayList of BC_ListBoxItems.
1548 gui->asset_titles, // Titles for columns. Set to 0 for no titles
1549 mwindow->edl->session->asset_columns, // width of each column
1550 1, // Total columns.
1551 0, // Pixel of top of window.
1552 0, // If this listbox is a popup window
1553 LISTBOX_MULTIPLE, // Select one item or multiple items
1554 ICON_TOP, // Position of icon relative to text of each item
1557 this->mwindow = mwindow;
1562 AWindowAssets::~AWindowAssets()
1566 int AWindowAssets::button_press_event()
1570 result = BC_ListBox::button_press_event();
1572 if(!result && get_buttonpress() == 3 && is_event_win() && cursor_inside())
1574 BC_ListBox::deactivate_selection();
1575 gui->assetlist_menu->update_titles();
1576 gui->assetlist_menu->activate_menu();
1585 int AWindowAssets::handle_event()
1587 //printf("AWindowAssets::handle_event 1 %d %d\n", get_buttonpress(), get_selection(0, 0));
1588 AssetPicon *asset_picon = (AssetPicon *)get_selection(0, 0);
1589 if( !asset_picon ) return 0;
1590 switch( mwindow->edl->session->awindow_folder ) {
1591 case AW_AEFFECT_FOLDER:
1592 case AW_VEFFECT_FOLDER:
1593 case AW_ATRANSITION_FOLDER:
1594 case AW_VTRANSITION_FOLDER: return 1;
1596 VWindow *vwindow = mwindow->vwindows.size() > DEFAULT_VWINDOW ?
1597 mwindow->vwindows.get(DEFAULT_VWINDOW) : 0;
1598 if( !vwindow || !vwindow->is_running() ) return 1;
1599 //printf("AWindowAssets::handle_event 2 %d %d\n", get_buttonpress(), get_selection(0, 0));
1601 vwindow->gui->lock_window("AWindowAssets::handle_event");
1602 if( asset_picon->indexable )
1603 vwindow->change_source(asset_picon->indexable);
1604 else if( asset_picon->edl )
1605 vwindow->change_source(asset_picon->edl);
1606 vwindow->gui->unlock_window();
1610 int AWindowAssets::selection_changed()
1612 // Show popup window
1613 if( get_button_down() && get_buttonpress() == 3 && get_selection(0, 0) ) {
1614 switch( mwindow->edl->session->awindow_folder ) {
1615 case AW_AEFFECT_FOLDER:
1616 case AW_VEFFECT_FOLDER:
1617 case AW_ATRANSITION_FOLDER:
1618 case AW_VTRANSITION_FOLDER:
1619 gui->assetlist_menu->update_titles();
1620 gui->assetlist_menu->activate_menu();
1622 case AW_LABEL_FOLDER:
1623 if(((AssetPicon*)get_selection(0, 0))->label)
1624 gui->label_menu->activate_menu();
1627 if(((AssetPicon*)get_selection(0, 0))->indexable)
1628 gui->asset_menu->update();
1630 if(((AssetPicon*)get_selection(0, 0))->edl)
1631 gui->asset_menu->update();
1633 gui->asset_menu->activate_menu();
1636 BC_ListBox::deactivate_selection();
1639 else if( get_button_down() && get_buttonpress() == 1 && get_selection(0, 0) ) {
1641 if( !gui->vicon_thread->viewing ) {
1642 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1643 vicon = picon->vicon;
1645 gui->vicon_thread->set_view_popup(vicon);
1651 void AWindowAssets::draw_background()
1653 clear_box(0,0,get_w(),get_h(),get_bg_surface());
1654 set_color(BC_WindowBase::get_resources()->audiovideo_color);
1655 set_font(LARGEFONT);
1656 int aw_folder = mwindow->edl->session->awindow_folder;
1657 if( aw_folder < 0 ) return;
1658 const char *aw_name = _(AWindowGUI::folder_names[aw_folder]);
1659 draw_text(get_w() - get_text_width(LARGEFONT, aw_name) - 4, 30,
1660 aw_name, -1, get_bg_surface());
1663 int AWindowAssets::drag_start_event()
1665 int collect_pluginservers = 0;
1666 int collect_assets = 0;
1668 if( BC_ListBox::drag_start_event() ) {
1669 switch( mwindow->edl->session->awindow_folder ) {
1670 case AW_AEFFECT_FOLDER:
1671 mwindow->session->current_operation = DRAG_AEFFECT;
1672 collect_pluginservers = 1;
1674 case AW_VEFFECT_FOLDER:
1675 mwindow->session->current_operation = DRAG_VEFFECT;
1676 collect_pluginservers = 1;
1678 case AW_ATRANSITION_FOLDER:
1679 mwindow->session->current_operation = DRAG_ATRANSITION;
1680 collect_pluginservers = 1;
1682 case AW_VTRANSITION_FOLDER:
1683 mwindow->session->current_operation = DRAG_VTRANSITION;
1684 collect_pluginservers = 1;
1686 case AW_LABEL_FOLDER:
1690 mwindow->session->current_operation = DRAG_ASSET;
1695 if(collect_pluginservers)
1698 mwindow->session->drag_pluginservers->remove_all();
1701 AssetPicon *result = (AssetPicon*)get_selection(0, i++);
1704 mwindow->session->drag_pluginservers->append(result->plugin);
1710 gui->collect_assets();
1718 int AWindowAssets::drag_motion_event()
1720 BC_ListBox::drag_motion_event();
1723 mwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1724 mwindow->gui->drag_motion();
1725 mwindow->gui->unlock_window();
1727 for(int i = 0; i < mwindow->vwindows.size(); i++)
1729 VWindow *vwindow = mwindow->vwindows.get(i);
1730 if( !vwindow->is_running() ) continue;
1731 vwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1732 vwindow->gui->drag_motion();
1733 vwindow->gui->unlock_window();
1736 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1737 mwindow->cwindow->gui->drag_motion();
1738 mwindow->cwindow->gui->unlock_window();
1740 lock_window("AWindowAssets::drag_motion_event");
1744 int AWindowAssets::drag_stop_event()
1748 result = gui->drag_stop();
1754 mwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1755 result = mwindow->gui->drag_stop();
1756 mwindow->gui->unlock_window();
1761 for(int i = 0; i < mwindow->vwindows.size(); i++)
1763 VWindow *vwindow = mwindow->vwindows.get(i);
1764 if( !vwindow->is_running() ) continue;
1765 vwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1766 result = vwindow->gui->drag_stop();
1767 vwindow->gui->unlock_window();
1773 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1774 result = mwindow->cwindow->gui->drag_stop();
1775 mwindow->cwindow->gui->unlock_window();
1778 lock_window("AWindowAssets::drag_stop_event");
1780 if(result) get_drag_popup()->set_animation(0);
1782 BC_ListBox::drag_stop_event();
1783 mwindow->session->current_operation = ::NO_OPERATION; // since NO_OPERATION is also defined in listbox, we have to reach for global scope...
1787 int AWindowAssets::column_resize_event()
1789 mwindow->edl->session->asset_columns[0] = get_column_width(0);
1790 mwindow->edl->session->asset_columns[1] = get_column_width(1);
1794 int AWindowAssets::focus_in_event()
1796 gui->start_vicon_drawing();
1800 int AWindowAssets::focus_out_event()
1802 gui->stop_vicon_drawing();
1803 return BC_ListBox::focus_out_event();
1817 AWindowNewFolder::AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1818 : BC_Button(x, y, mwindow->theme->newbin_data)
1820 this->mwindow = mwindow;
1822 set_tooltip(_("New bin"));
1825 int AWindowNewFolder::handle_event()
1827 gui->newfolder_thread->start_new_folder();
1831 AWindowDeleteFolder::AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1832 : BC_Button(x, y, mwindow->theme->deletebin_data)
1834 this->mwindow = mwindow;
1836 set_tooltip(_("Delete bin"));
1839 int AWindowDeleteFolder::handle_event()
1841 if(gui->folder_list->get_selection(0, 0))
1843 BC_ListBoxItem *folder = gui->folder_list->get_selection(0, 0);
1844 mwindow->delete_folder(folder->get_text());
1849 AWindowRenameFolder::AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1850 : BC_Button(x, y, mwindow->theme->renamebin_data)
1852 this->mwindow = mwindow;
1854 set_tooltip(_("Rename bin"));
1857 int AWindowRenameFolder::handle_event()
1862 AWindowDeleteDisk::AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1863 : BC_Button(x, y, mwindow->theme->deletedisk_data)
1865 this->mwindow = mwindow;
1867 set_tooltip(_("Delete asset from disk"));
1870 int AWindowDeleteDisk::handle_event()
1875 AWindowDeleteProject::AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1876 : BC_Button(x, y, mwindow->theme->deleteproject_data)
1878 this->mwindow = mwindow;
1880 set_tooltip(_("Delete asset from project"));
1883 int AWindowDeleteProject::handle_event()
1888 AWindowInfo::AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1889 : BC_Button(x, y, mwindow->theme->infoasset_data)
1891 this->mwindow = mwindow;
1893 set_tooltip(_("Edit information on asset"));
1896 int AWindowInfo::handle_event()
1898 gui->awindow->asset_edit->edit_asset(gui->selected_asset());
1902 AWindowRedrawIndex::AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1903 : BC_Button(x, y, mwindow->theme->redrawindex_data)
1905 this->mwindow = mwindow;
1907 set_tooltip(_("Redraw index"));
1910 int AWindowRedrawIndex::handle_event()
1915 AWindowPaste::AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1916 : BC_Button(x, y, mwindow->theme->pasteasset_data)
1918 this->mwindow = mwindow;
1920 set_tooltip(_("Paste asset on recordable tracks"));
1923 int AWindowPaste::handle_event()
1928 AWindowAppend::AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1929 : BC_Button(x, y, mwindow->theme->appendasset_data)
1931 this->mwindow = mwindow;
1933 set_tooltip(_("Append asset in new tracks"));
1936 int AWindowAppend::handle_event()
1941 AWindowView::AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1942 : BC_Button(x, y, mwindow->theme->viewasset_data)
1944 this->mwindow = mwindow;
1946 set_tooltip(_("View asset"));
1949 int AWindowView::handle_event()
1955 LabelPopup::LabelPopup(MWindow *mwindow, AWindowGUI *gui)
1962 this->mwindow = mwindow;
1966 LabelPopup::~LabelPopup()
1970 void LabelPopup::create_objects()
1972 add_item(editlabel = new LabelPopupEdit(mwindow, this));
1975 int LabelPopup::update()
1977 gui->collect_assets();
1983 LabelPopupEdit::LabelPopupEdit(MWindow *mwindow, LabelPopup *popup)
1984 : BC_MenuItem(_("Edit..."))
1986 this->mwindow = mwindow;
1987 this->popup = popup;
1990 LabelPopupEdit::~LabelPopupEdit()
1994 int LabelPopupEdit::handle_event()
1999 AssetPicon *result = (AssetPicon*)mwindow->awindow->gui->asset_list->get_selection(0, i++);
2003 mwindow->awindow->gui->awindow->label_edit->edit_label(result->label);
2011 AddTools::AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, const char *title)
2012 : BC_PopupMenu(x, y, BC_Title::calculate_w(gui, title, MEDIUMFONT)+8, title, -1, 0, 4)
2014 this->mwindow = mwindow;
2018 void AddTools::create_objects()
2021 add_item(new AddPluginItem(this, "ladspa", PLUGIN_LADSPA_ID));
2022 vis |= 1 << PLUGIN_LADSPA_ID;
2023 add_item(new AddPluginItem(this, "ffmpeg", PLUGIN_FFMPEG_ID));
2024 vis |= 1 << PLUGIN_FFMPEG_ID;
2025 for( int i=0; i<MWindow::plugindb->size(); ++i ) {
2026 PluginServer *plugin = MWindow::plugindb->get(i);
2027 if( !plugin->audio && !plugin->video ) continue;
2028 int idx = plugin->dir_idx;
2029 uint32_t msk = 1 << idx;
2030 if( (msk & vis) != 0 ) continue;
2032 char parent[BCTEXTLEN];
2033 strcpy(parent, plugin->path);
2034 char *bp = strrchr(parent, '/');
2035 if( bp ) { *bp = 0; bp = strrchr(parent, '/'); }
2036 if( !bp ) bp = parent; else ++bp;
2037 add_item(new AddPluginItem(this, bp, idx));
2042 // plugin_dirs list from toplevel makefile include plugin_defs
2046 N_("audio_transitions")
2053 N_("video_transitions")
2056 AddPluginItem::AddPluginItem(AddTools *menu, char const *text, int idx)
2057 : BC_MenuItem(_(text))
2061 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
2062 int chk = (msk & vis) ? 1 : 0;
2066 int AddPluginItem::handle_event()
2068 int chk = get_checked() ^ 1;
2070 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
2071 menu->gui->plugin_visibility = chk ? vis | msk : vis & ~msk;
2072 menu->gui->update_effects();
2073 menu->gui->save_defaults(menu->mwindow->defaults);
2074 menu->gui->async_update_assets();
2078 AVIconDrawing::AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images)
2079 : BC_Toggle(x, y, images, agui->vicon_drawing)
2082 set_tooltip(_("draw vicons"));
2085 void AVIconDrawing::calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh)
2087 int text_line = -1, toggle_x = -1, toggle_y = -1;
2088 int text_x = -1, text_y = -1, text_w = -1, text_h = -1;
2089 BC_Toggle::calculate_extents(agui, images, 1,
2090 &text_line, ww, hh, &toggle_x, &toggle_y,
2091 &text_x, &text_y, &text_w, &text_h, "", MEDIUMFONT);
2094 AVIconDrawing::~AVIconDrawing()
2098 int AVIconDrawing::handle_event()
2100 agui->vicon_drawing = get_value();
2101 if( agui->vicon_drawing )
2102 agui->start_vicon_drawing();
2104 agui->stop_vicon_drawing();