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"
70 AssetVIcon::AssetVIcon(AssetPicon *picon, int w, int h, double framerate, int64_t length)
71 : VIcon(w, h, framerate)
74 this->length = length;
78 AssetVIcon::~AssetVIcon()
83 VFrame *AssetVIcon::frame()
85 if( seq_no >= images.size() ) {
86 MWindow *mwindow = picon->mwindow;
87 Asset *asset = (Asset *)picon->indexable;
88 File *file = mwindow->video_cache->check_out(asset, mwindow->edl, 1);
90 if( temp && (temp->get_w() != asset->width || temp->get_h() != asset->height) ) {
91 delete temp; temp = 0;
94 temp = new VFrame(asset->width, asset->height, BC_RGB888);
95 int ww = picon->gui->vicon_thread->view_w;
96 int hh = picon->gui->vicon_thread->view_h;
97 while( seq_no >= images.size() ) {
99 int64_t pos = images.size() / picon->gui->vicon_thread->refresh_rate * frame_rate;
100 file->set_video_position(pos,0);
101 file->read_frame(temp);
102 add_image(temp, ww, hh, BC_RGB8);
104 mwindow->video_cache->check_in(asset);
106 return *images[seq_no];
109 int64_t AssetVIcon::set_seq_no(int64_t no)
111 if( no >= length ) no = 0;
115 int AssetVIcon::get_vx()
117 BC_ListBox *lbox = picon->gui->asset_list;
118 return lbox->get_item_x(picon);
120 int AssetVIcon::get_vy()
122 BC_ListBox *lbox = picon->gui->asset_list;
123 return lbox->get_item_y(picon) + lbox->get_title_h();
126 AssetPicon::AssetPicon(MWindow *mwindow,
128 Indexable *indexable)
132 this->mwindow = mwindow;
134 this->indexable = indexable;
135 indexable->add_user();
136 this->id = indexable->id;
139 AssetPicon::AssetPicon(MWindow *mwindow,
145 this->mwindow = mwindow;
152 AssetPicon::AssetPicon(MWindow *mwindow,
155 : BC_ListBoxItem(folder, gui->folder_icon)
158 this->mwindow = mwindow;
162 AssetPicon::AssetPicon(MWindow *mwindow,
164 PluginServer *plugin)
168 this->mwindow = mwindow;
170 this->plugin = plugin;
174 AssetPicon::AssetPicon(MWindow *mwindow,
180 this->mwindow = mwindow;
188 AssetPicon::~AssetPicon()
191 gui->vicon_thread->del_vicon(vicon);
192 if(indexable) indexable->remove_user();
193 if(edl) edl->remove_user();
194 if( icon && !gui->protected_pixmap(icon) ) {
196 if( !plugin ) delete icon_vframe;
200 void AssetPicon::reset()
214 void AssetPicon::create_objects()
217 char name[BCTEXTLEN];
218 int pixmap_w, pixmap_h;
221 pixmap_h = 50 * BC_WindowBase::get_resources()->icon_scale;
223 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
226 fs.extract_name(name, indexable->path);
230 if(indexable && indexable->is_asset)
232 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
233 Asset *asset = (Asset*)indexable;
234 if(asset->video_data)
236 if(mwindow->preferences->use_thumbnails)
238 gui->unlock_window();
239 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
240 File *file = mwindow->video_cache->check_out(asset,
243 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
247 int height = asset->height > 0 ? asset->height : 1;
248 pixmap_w = pixmap_h * asset->width / height;
251 file->set_video_position(0, 0);
253 if(gui->temp_picon &&
254 (gui->temp_picon->get_w() != asset->width ||
255 gui->temp_picon->get_h() != asset->height))
257 delete gui->temp_picon;
263 gui->temp_picon = new VFrame(0, -1,
264 asset->width, asset->height,
268 file->read_frame(gui->temp_picon);
269 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
270 mwindow->video_cache->check_in(asset);
272 gui->lock_window("AssetPicon::create_objects 1");
273 icon = new BC_Pixmap(gui, pixmap_w, pixmap_h);
274 icon->draw_vframe(gui->temp_picon,
275 0, 0, pixmap_w, pixmap_h, 0, 0);
276 //printf("%d %d\n", gui->temp_picon->get_w(), gui->temp_picon->get_h());
277 icon_vframe = new VFrame(0,
278 -1, pixmap_w, pixmap_h, BC_RGB888, -1);
279 icon_vframe->transfer_from(gui->temp_picon);
281 double framerate = asset->get_frame_rate();
282 if( !framerate ) framerate = VICON_RATE;
283 int64_t frames = asset->get_video_frames();
284 double secs = frames / framerate;
285 if( secs > 5 ) secs = 5;
286 int64_t length = secs * gui->vicon_thread->refresh_rate;
287 vicon = new AssetVIcon(this, pixmap_w, pixmap_h, framerate, length);
288 gui->vicon_thread->add_vicon(vicon);
289 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
294 gui->lock_window("AssetPicon::create_objects 2");
295 icon = gui->video_icon;
296 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
301 icon = gui->video_icon;
302 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
306 if(asset->audio_data)
308 icon = gui->audio_icon;
309 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND];
311 //printf("AssetPicon::create_objects 2\n");
313 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
316 if(indexable && !indexable->is_asset)
318 icon = gui->video_icon;
319 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
324 //printf("AssetPicon::create_objects 4 %s\n", edl->local_session->clip_title);
325 set_text(strcpy(name, edl->local_session->clip_title));
326 icon = gui->clip_icon;
327 icon_vframe = mwindow->theme->get_image("clip_icon");
332 strcpy(name, _(plugin->title));
334 icon_vframe = plugin->get_picon();
336 icon = gui->create_pixmap(icon_vframe);
337 else if( plugin->audio ) {
338 if( plugin->transition ) {
339 icon = gui->atransition_icon;
340 icon_vframe = gui->atransition_vframe;
342 else if( plugin->is_ffmpeg() ) {
343 icon = gui->ff_aud_icon;
344 icon_vframe = gui->ff_aud_vframe;
346 else if( plugin->is_ladspa() ) {
347 icon = gui->ladspa_icon;
348 icon_vframe = gui->ladspa_vframe;
351 icon = gui->aeffect_icon;
352 icon_vframe = gui->aeffect_vframe;
355 else if( plugin->video ) {
356 if( plugin->transition ) {
357 icon = gui->vtransition_icon;
358 icon_vframe = gui->vtransition_vframe;
360 else if( plugin->is_ffmpeg() ) {
361 icon = gui->ff_vid_icon;
362 icon_vframe = gui->ff_vid_vframe;
365 icon = gui->veffect_icon;
366 icon_vframe = gui->veffect_vframe;
374 mwindow->edl->session->time_format,
375 mwindow->edl->session->sample_rate,
376 mwindow->edl->session->frame_rate,
377 mwindow->edl->session->frames_per_foot);
379 icon = gui->file_icon;
380 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN];
382 set_icon_vframe(icon_vframe);
385 icon = gui->file_icon;
386 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN];
389 set_icon_vframe(icon_vframe);
391 if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
399 AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow)
400 : BC_Window(PROGRAM_NAME ": Resources",
401 mwindow->session->awindow_x,
402 mwindow->session->awindow_y,
403 mwindow->session->awindow_w,
404 mwindow->session->awindow_h,
411 // printf("AWindowGUI::AWindowGUI %d %d %d %d\n",
412 // mwindow->session->awindow_x,
413 // mwindow->session->awindow_y,
414 // mwindow->session->awindow_w,
415 // mwindow->session->awindow_h);
416 this->mwindow = mwindow;
417 this->awindow = awindow;
423 atransition_icon = 0; atransition_vframe = 0;
424 vtransition_icon = 0; vtransition_vframe = 0;
425 aeffect_icon = 0; aeffect_vframe = 0;
426 ladspa_icon = 0; ladspa_vframe = 0;
427 veffect_icon = 0; veffect_vframe = 0;
428 ff_aud_icon = 0; ff_aud_vframe = 0;
429 ff_vid_icon = 0; ff_vid_vframe = 0;
430 plugin_visibility = ((uint64_t)1<<(8*sizeof(uint64_t)-1))-1;
431 newfolder_thread = 0;
436 allow_iconlisting = 1;
442 AWindowGUI::~AWindowGUI()
444 assets.remove_all_objects();
445 folders.remove_all_objects();
446 aeffects.remove_all_objects();
447 veffects.remove_all_objects();
448 atransitions.remove_all_objects();
449 vtransitions.remove_all_objects();
450 labellist.remove_all_objects();
451 displayed_assets[1].remove_all_objects();
459 delete atransition_icon;
460 delete vtransition_icon;
463 delete ladspa_vframe;
465 delete ff_aud_vframe;
467 delete ff_vid_vframe;
469 delete newfolder_thread;
472 delete assetlist_menu;
473 delete folderlist_menu;
474 if(temp_picon) delete temp_picon;
475 delete remove_plugin;
478 bool AWindowGUI::protected_pixmap(BC_Pixmap *icon)
480 return icon == file_icon ||
481 icon == folder_icon ||
482 icon == audio_icon ||
483 icon == video_icon ||
485 icon == vtransition_icon ||
486 icon == atransition_icon ||
487 icon == veffect_icon ||
488 icon == aeffect_icon ||
489 icon == ladspa_icon ||
490 icon == ff_aud_icon ||
494 void AWindowGUI::create_objects()
498 lock_window("AWindowGUI::create_objects");
500 //printf("AWindowGUI::create_objects 1\n");
501 asset_titles[0] = _("Title");
502 asset_titles[1] = _("Comments");
506 set_icon(mwindow->theme->get_image("awindow_icon"));
507 file_icon = new BC_Pixmap(this,
508 BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN],
511 folder_icon = new BC_Pixmap(this,
512 BC_WindowBase::get_resources()->type_to_icon[ICON_FOLDER],
515 audio_icon = new BC_Pixmap(this,
516 BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND],
519 video_icon = new BC_Pixmap(this,
520 BC_WindowBase::get_resources()->type_to_icon[ICON_FILM],
525 clip_vframe = mwindow->theme->get_image("clip_icon");
526 clip_icon = new BC_Pixmap(this, clip_vframe, PIXMAP_ALPHA);
527 atransition_vframe = mwindow->theme->get_image("atransition_icon");
528 atransition_icon = new BC_Pixmap(this, atransition_vframe, PIXMAP_ALPHA);
529 vtransition_vframe = mwindow->theme->get_image("vtransition_icon");
530 vtransition_icon = new BC_Pixmap(this, vtransition_vframe, PIXMAP_ALPHA);
531 aeffect_vframe = mwindow->theme->get_image("aeffect_icon");
532 aeffect_icon = new BC_Pixmap(this, aeffect_vframe, PIXMAP_ALPHA);
533 ladspa_vframe = new VFramePng(lad_picon_png);
534 ladspa_icon = new BC_Pixmap(this, ladspa_vframe, PIXMAP_ALPHA);
535 ff_aud_vframe = new VFramePng(ff_audio_png);
536 ff_aud_icon = new BC_Pixmap(this, ff_aud_vframe, PIXMAP_ALPHA);
537 ff_vid_vframe = new VFramePng(ff_video_png);
538 ff_vid_icon = new BC_Pixmap(this, ff_vid_vframe, PIXMAP_ALPHA);
539 veffect_vframe = mwindow->theme->get_image("veffect_icon");
540 veffect_icon = new BC_Pixmap(this, veffect_vframe, PIXMAP_ALPHA);
545 folders.append(picon = new AssetPicon(mwindow,
548 picon->persistent = 1;
549 folders.append(picon = new AssetPicon(mwindow,
552 picon->persistent = 1;
553 folders.append(picon = new AssetPicon(mwindow,
555 ATRANSITION_FOLDER));
556 picon->persistent = 1;
557 folders.append(picon = new AssetPicon(mwindow,
559 VTRANSITION_FOLDER));
560 picon->persistent = 1;
561 folders.append(picon = new AssetPicon(mwindow,
564 picon->persistent = 1;
566 create_label_folder();
569 mwindow->theme->get_awindow_sizes(this);
570 load_defaults(mwindow->defaults);
573 add_subwindow(asset_list = new AWindowAssets(mwindow,
575 mwindow->theme->alist_x,
576 mwindow->theme->alist_y,
577 mwindow->theme->alist_w,
578 mwindow->theme->alist_h));
580 vicon_thread = new VIconThread(asset_list);
581 vicon_thread->start();
584 add_subwindow(divider = new AWindowDivider(mwindow,
586 mwindow->theme->adivider_x,
587 mwindow->theme->adivider_y,
588 mwindow->theme->adivider_w,
589 mwindow->theme->adivider_h));
592 divider->set_cursor(HSEPARATE_CURSOR, 0, 0);
595 int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y;
596 int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h;
597 VFrame **images = mwindow->theme->get_image_set("playpatch_data");
598 AVIconDrawing::calculate_geometry(this, images, &avicon_w, &avicon_h);
599 add_subwindow(avicon_drawing = new AVIconDrawing(this, fw-avicon_w, fy, images));
600 add_subwindow(add_tools = new AddTools(mwindow, this, fx, fy, "Visibility"));
601 add_tools->create_objects();
602 fy += add_tools->get_h(); fh -= add_tools->get_h();
604 add_subwindow(folder_list = new AWindowFolders(mwindow,
605 this, fx, fy, fw, fh));
610 //int x = mwindow->theme->abuttons_x;
611 //int y = mwindow->theme->abuttons_y;
615 newfolder_thread = new NewFolderThread(mwindow, this);
617 add_subwindow(asset_menu = new AssetPopup(mwindow, this));
618 asset_menu->create_objects();
620 add_subwindow(label_menu = new LabelPopup(mwindow, this));
621 label_menu->create_objects();
625 add_subwindow(assetlist_menu = new AssetListMenu(mwindow, this));
628 assetlist_menu->create_objects();
632 add_subwindow(folderlist_menu = new FolderListMenu(mwindow, this));
633 folderlist_menu->create_objects();
634 //printf("AWindowGUI::create_objects 2\n");
637 create_custom_xatoms();
641 int AWindowGUI::resize_event(int w, int h)
643 mwindow->session->awindow_x = get_x();
644 mwindow->session->awindow_y = get_y();
645 mwindow->session->awindow_w = w;
646 mwindow->session->awindow_h = h;
648 mwindow->theme->get_awindow_sizes(this);
649 mwindow->theme->draw_awindow_bg(this);
650 reposition_objects();
652 // int x = mwindow->theme->abuttons_x;
653 // int y = mwindow->theme->abuttons_y;
654 // new_bin->reposition_window(x, y);
655 // x += new_bin->get_w();
656 // delete_bin->reposition_window(x, y);
657 // x += delete_bin->get_w();
658 // rename_bin->reposition_window(x, y);
659 // x += rename_bin->get_w();
660 // delete_disk->reposition_window(x, y);
661 // x += delete_disk->get_w();
662 // delete_project->reposition_window(x, y);
663 // x += delete_project->get_w();
664 // info->reposition_window(x, y);
665 // x += info->get_w();
666 // redraw_index->reposition_window(x, y);
667 // x += redraw_index->get_w();
668 // paste->reposition_window(x, y);
669 // x += paste->get_w();
670 // append->reposition_window(x, y);
671 // x += append->get_w();
672 // view->reposition_window(x, y);
674 BC_WindowBase::resize_event(w, h);
678 int AWindowGUI::translation_event()
680 mwindow->session->awindow_x = get_x();
681 mwindow->session->awindow_y = get_y();
685 void AWindowGUI::reposition_objects()
687 int wmax = mwindow->session->awindow_w-mwindow->theme->adivider_w;
688 int x = mwindow->theme->afolders_x;
689 int w = mwindow->theme->afolders_w;
694 folder_list->reposition_window(x, mwindow->theme->afolders_y,
695 w, mwindow->theme->afolders_h);
696 x = mwindow->theme->adivider_x;
701 divider->reposition_window(x,
702 mwindow->theme->adivider_y,
703 mwindow->theme->adivider_w,
704 mwindow->theme->adivider_h);
705 int x2 = mwindow->theme->alist_x;
706 if (x2 < x+mwindow->theme->adivider_w)
707 x2 = x+mwindow->theme->adivider_w;
708 w = mwindow->theme->alist_w;
713 asset_list->reposition_window(x2, mwindow->theme->alist_y,
714 w, mwindow->theme->alist_h);
715 mwindow->theme->get_awindow_sizes(this);
716 asset_list->reposition_window(
717 mwindow->theme->alist_x, mwindow->theme->alist_y,
718 mwindow->theme->alist_w, mwindow->theme->alist_h);
719 divider->reposition_window(
720 mwindow->theme->adivider_x, mwindow->theme->adivider_y,
721 mwindow->theme->adivider_w, mwindow->theme->adivider_h);
722 int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y;
723 int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h;
724 add_tools->resize_event(fw-avicon_w, add_tools->get_h());
725 avicon_drawing->reposition_window(fw-avicon_w, fy);
726 fy += add_tools->get_h(); fh -= add_tools->get_h();
727 folder_list->reposition_window(fx, fy, fw, fh);
730 int AWindowGUI::save_defaults(BC_Hash *defaults)
732 defaults->update("PLUGIN_VISIBILTY", plugin_visibility);
733 defaults->update("VICON_DRAWING", vicon_drawing);
737 int AWindowGUI::load_defaults(BC_Hash *defaults)
739 plugin_visibility = defaults->get("PLUGIN_VISIBILTY", plugin_visibility);
740 vicon_drawing = defaults->get("VICON_DRAWING", vicon_drawing);
744 int AWindowGUI::close_event()
747 mwindow->session->show_awindow = 0;
750 mwindow->gui->lock_window("AWindowGUI::close_event");
751 mwindow->gui->mainmenu->show_awindow->set_checked(0);
752 mwindow->gui->unlock_window();
754 lock_window("AWindowGUI::close_event");
755 save_defaults(mwindow->defaults);
756 mwindow->save_defaults();
760 void AWindowGUI::start_vicon_drawing()
762 if( !vicon_drawing ) return;
763 if( strcmp(mwindow->edl->session->current_folder, MEDIA_FOLDER) ) return;
764 if( mwindow->edl->session->assetlist_format != ASSETS_ICONS ) return;
765 vicon_thread->start_drawing();
768 void AWindowGUI::stop_vicon_drawing()
770 vicon_thread->stop_drawing();
773 AWindowRemovePluginGUI::
774 AWindowRemovePluginGUI(AWindow *awindow, AWindowRemovePlugin *thread,
775 int x, int y, PluginServer *plugin)
776 : BC_Window(PROGRAM_NAME ": Remove plugin", x,y, 500,200, 50, 50, 1, 0, 1, -1, "", 1)
778 this->awindow = awindow;
779 this->thread = thread;
780 this->plugin = plugin;
781 VFrame *vframe = plugin->get_picon();
782 icon = vframe ? create_pixmap(vframe) : 0;
783 plugin_list.append(new BC_ListBoxItem(plugin->title, icon));
786 AWindowRemovePluginGUI::
787 ~AWindowRemovePluginGUI()
789 if( !awindow->gui->protected_pixmap(icon) )
791 plugin_list.remove_all();
794 void AWindowRemovePluginGUI::create_objects()
796 BC_Button *ok_button = new BC_OKButton(this);
797 add_subwindow(ok_button);
798 BC_Button *cancel_button = new BC_CancelButton(this);
799 add_subwindow(cancel_button);
801 BC_Title *title = new BC_Title(x, y, _("remove plugin?"));
802 add_subwindow(title);
803 y += title->get_h() + 5;
804 list = new BC_ListBox(x, y,
805 get_w() - 20, ok_button->get_y() - y - 5, LISTBOX_TEXT, &plugin_list,
806 0, 0, 1, 0, 0, LISTBOX_SINGLE, ICON_LEFT, 0);
811 int AWindowRemovePlugin::remove_plugin(PluginServer *plugin, ArrayList<BC_ListBoxItem*> &folder)
814 for( int i=0; i<folder.size(); ) {
815 AssetPicon *picon = (AssetPicon *)folder[i];
816 if( picon->plugin == plugin ) {
817 folder.remove_object_number(i);
826 void AWindowRemovePlugin::handle_close_event(int result)
829 printf("remove %s\n", plugin->path);
830 ArrayList<BC_ListBoxItem*> *folder =
831 plugin->audio ? plugin->transition ?
832 &awindow->gui->atransitions :
833 &awindow->gui->aeffects :
834 plugin->video ? plugin->transition ?
835 &awindow->gui->vtransitions :
836 &awindow->gui->veffects :
838 if( folder ) remove_plugin(plugin, *folder);
839 char plugin_path[BCTEXTLEN];
840 strcpy(plugin_path, plugin->path);
841 MWindow *mwindow = awindow->mwindow;
842 mwindow->plugindb->remove(plugin);
843 delete plugin; plugin = 0;
845 char index_path[BCTEXTLEN];
846 sprintf(index_path, "%s/%s", mwindow->preferences->plugin_dir, PLUGIN_FILE);
848 char png_path[BCTEXTLEN];
849 if( plugin->get_theme_png_path(png_path, mwindow->preferences->theme) )
851 if( plugin->get_theme_png_path(png_path, "picon") )
853 awindow->gui->async_update_assets();
857 AWindowRemovePlugin::
858 AWindowRemovePlugin(AWindow *awindow, PluginServer *plugin)
861 this->awindow = awindow;
862 this->plugin = plugin;
865 AWindowRemovePlugin::
866 ~AWindowRemovePlugin()
871 BC_Window* AWindowRemovePlugin::new_gui()
873 int x = awindow->gui->get_abs_cursor_x(0);
874 int y = awindow->gui->get_abs_cursor_y(0);
875 AWindowRemovePluginGUI *gui = new AWindowRemovePluginGUI(awindow, this, x, y, plugin);
876 gui->create_objects();
880 int AWindowGUI::keypress_event()
882 switch(get_keypress()) {
891 PluginServer* plugin = selected_plugin();
893 remove_plugin = new AWindowRemovePlugin(awindow, plugin);
895 remove_plugin->start();
904 int AWindowGUI::create_custom_xatoms()
906 UpdateAssetsXAtom = create_xatom("CWINDOWGUI_UPDATE_ASSETS");
909 int AWindowGUI::recieve_custom_xatoms(xatom_event *event)
911 if (event->message_type == UpdateAssetsXAtom)
919 void AWindowGUI::async_update_assets()
922 event.message_type = UpdateAssetsXAtom;
923 send_custom_xatom(&event);
932 void AWindowGUI::update_folder_list()
934 stop_vicon_drawing();
935 //printf("AWindowGUI::update_folder_list 1\n");
936 for(int i = 0; i < folders.total; i++)
938 AssetPicon *picon = (AssetPicon*)folders.values[i];
941 //printf("AWindowGUI::update_folder_list 1\n");
943 // Search assets for folders
944 for(int i = 0; i < mwindow->edl->folders.total; i++)
946 char *folder = mwindow->edl->folders.values[i];
948 //printf("AWindowGUI::update_folder_list 1.1\n");
950 for(int j = 0; j < folders.total; j++)
952 AssetPicon *picon = (AssetPicon*)folders.values[j];
953 if(!strcasecmp(picon->get_text(), folder))
963 AssetPicon *picon = new AssetPicon(mwindow, this, folder);
964 picon->create_objects();
965 folders.append(picon);
967 //printf("AWindowGUI::update_folder_list 1.3\n");
969 //printf("AWindowGUI::update_folder_list 1\n");
970 //for(int i = 0; i < folders.total; i++)
971 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
974 for(int i = folders.total - 1; i >= 0; i--)
976 AssetPicon *picon = (AssetPicon*)folders.values[i];
977 if(!picon->in_use && !picon->persistent)
980 folders.remove_number(i);
983 //for(int i = 0; i < folders.total; i++)
984 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
985 //printf("AWindowGUI::update_folder_list 2\n");
986 start_vicon_drawing();
989 void AWindowGUI::create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
990 int do_audio, int do_video, int is_realtime, int is_transition)
992 ArrayList<PluginServer*> plugin_list;
993 // Get pointers to plugindb entries
994 mwindow->search_plugindb(do_audio, do_video, is_realtime, is_transition,
997 for(int i = 0; i < plugin_list.total; i++) {
998 PluginServer *server = plugin_list.values[i];
999 int visible = plugin_visibility & (1<<server->dir_idx);
1000 if(!visible) continue;
1001 // Create new listitem
1002 AssetPicon *picon = new AssetPicon(mwindow, this, server);
1003 picon->create_objects();
1004 output->append(picon);
1008 void AWindowGUI::create_label_folder()
1011 for(current = mwindow->edl->labels->first; current; current = NEXT) {
1012 AssetPicon *picon = new AssetPicon(mwindow, this, current);
1013 picon->create_objects();
1014 labellist.append(picon);
1019 void AWindowGUI::update_asset_list()
1021 //printf("AWindowGUI::update_asset_list 1\n");
1022 for(int i = 0; i < assets.total; i++)
1024 AssetPicon *picon = (AssetPicon*)assets.values[i];
1032 //printf("AWindowGUI::update_asset_list 2\n");
1035 // Synchronize EDL clips
1036 for(int i = 0; i < mwindow->edl->clips.total; i++)
1040 // Look for clip in existing listitems
1041 for(int j = 0; j < assets.total && !exists; j++)
1043 AssetPicon *picon = (AssetPicon*)assets.values[j];
1045 if(picon->id == mwindow->edl->clips.values[i]->id)
1047 picon->edl = mwindow->edl->clips.values[i];
1048 picon->set_text(mwindow->edl->clips.values[i]->local_session->clip_title);
1054 // Create new listitem
1057 AssetPicon *picon = new AssetPicon(mwindow,
1059 mwindow->edl->clips.values[i]);
1060 picon->create_objects();
1061 assets.append(picon);
1069 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1072 // Synchronize EDL assets
1073 for(Asset *current = mwindow->edl->assets->first;
1079 // Look for asset in existing listitems
1080 for(int j = 0; j < assets.total && !exists; j++)
1082 AssetPicon *picon = (AssetPicon*)assets.values[j];
1084 if(picon->id == current->id)
1086 picon->indexable = current;
1093 // Create new listitem
1096 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1097 AssetPicon *picon = new AssetPicon(mwindow, this, current);
1098 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1099 picon->create_objects();
1100 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1101 assets.append(picon);
1107 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1110 // Synchronize nested EDLs
1111 for(int i = 0; i < mwindow->edl->nested_edls->size(); i++)
1114 Indexable *indexable = mwindow->edl->nested_edls->get(i);
1116 // Look for asset in existing listitems
1117 for(int j = 0; j < assets.total && !exists; j++)
1119 AssetPicon *picon = (AssetPicon*)assets.values[j];
1121 if(picon->id == indexable->id)
1123 picon->indexable = indexable;
1130 // Create new listitem
1133 AssetPicon *picon = new AssetPicon(mwindow,
1136 picon->create_objects();
1137 assets.append(picon);
1149 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1150 for(int i = assets.size() - 1; i >= 0; i--)
1152 AssetPicon *picon = (AssetPicon*)assets.get(i);
1153 //printf("AWindowGUI::update_asset_list %s %d\n", picon->asset->path, picon->in_use);
1157 assets.remove_number(i);
1160 //printf("AWindowGUI::update_asset_list 7 %d\n", assets.total);
1167 void AWindowGUI::sort_assets()
1169 //printf("AWindowGUI::sort_assets 1 %s\n", mwindow->edl->session->current_folder);
1170 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1171 sort_picons(&aeffects,
1174 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1175 sort_picons(&veffects,
1178 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1179 sort_picons(&atransitions,
1182 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1183 sort_picons(&vtransitions,
1186 if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
1187 ;// Labels should ALWAYS be sorted by time.
1189 sort_picons(&assets,
1190 mwindow->edl->session->current_folder);
1205 void AWindowGUI::collect_assets()
1208 mwindow->session->drag_assets->remove_all();
1209 mwindow->session->drag_clips->remove_all();
1212 AssetPicon *result = (AssetPicon*)asset_list->get_selection(0, i++);
1215 if(result->indexable) mwindow->session->drag_assets->append(result->indexable);
1216 if(result->edl) mwindow->session->drag_clips->append(result->edl);
1220 void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst,
1221 ArrayList<BC_ListBoxItem*> *src,
1224 // Remove current pointers
1225 dst[0].remove_all();
1226 dst[1].remove_all_objects();
1228 // Create new pointers
1229 //if(folder) printf("AWindowGUI::copy_picons 1 %s\n", folder);
1230 for(int i = 0; i < src->total; i++)
1232 AssetPicon *picon = (AssetPicon*)src->values[i];
1233 //printf("AWindowGUI::copy_picons 2 %s\n", picon->asset->folder);
1235 (folder && picon->indexable && !strcasecmp(picon->indexable->folder, folder)) ||
1236 (folder && picon->edl && !strcasecmp(picon->edl->local_session->folder, folder)))
1238 BC_ListBoxItem *item2, *item1;
1239 dst[0].append(item1 = picon);
1241 dst[1].append(item2 = new BC_ListBoxItem(picon->edl->local_session->clip_notes));
1243 if(picon->label && picon->label->textstr)
1244 dst[1].append(item2 = new BC_ListBoxItem(picon->label->textstr));
1246 dst[1].append(item2 = new BC_ListBoxItem(""));
1247 item1->set_autoplace_text(1);
1248 item2->set_autoplace_text(1);
1249 //printf("AWindowGUI::copy_picons 3 %s\n", picon->get_text());
1254 void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src,
1257 //printf("AWindowGUI::sort_picons 1\n")
1262 for(int i = 0; i < src->total - 1; i++)
1264 BC_ListBoxItem *item1 = src->values[i];
1265 BC_ListBoxItem *item2 = src->values[i + 1];
1266 item1->set_autoplace_icon(1);
1267 item2->set_autoplace_icon(1);
1268 item1->set_autoplace_text(1);
1269 item2->set_autoplace_text(1);
1270 if(strcmp(item1->get_text(), item2->get_text()) > 0)
1272 src->values[i + 1] = item1;
1273 src->values[i] = item2;
1281 void AWindowGUI::filter_displayed_assets()
1283 allow_iconlisting = 1;
1284 asset_titles[0] = _("Title");
1285 asset_titles[1] = _("Comments");
1286 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1287 copy_picons(displayed_assets,
1291 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1292 copy_picons(displayed_assets,
1296 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1297 copy_picons(displayed_assets,
1301 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1302 copy_picons(displayed_assets,
1306 if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER)) {
1307 copy_picons(displayed_assets,
1310 asset_titles[0] = _("Time Stamps");
1311 asset_titles[1] = _("Title");
1312 allow_iconlisting = 0;
1315 copy_picons(displayed_assets,
1317 mwindow->edl->session->current_folder);
1318 // Ensure the current folder icon is highlighted
1319 for(int i = 0; i < folders.total; i++)
1321 if(!strcasecmp(mwindow->edl->session->current_folder, folders.values[i]->get_text()))
1322 folders.values[i]->set_selected(1);
1324 folders.values[i]->set_selected(0);
1329 void AWindowGUI::update_assets()
1331 //printf("AWindowGUI::update_assets 1\n");
1332 update_folder_list();
1333 //printf("AWindowGUI::update_assets 2\n");
1334 update_asset_list();
1335 labellist.remove_all_objects();
1336 create_label_folder();
1337 //printf("AWindowGUI::update_assets 3\n");
1338 filter_displayed_assets();
1340 //for(int i = 0; i < folders.total; i++)
1341 //printf("AWindowGUI::update_assets 4\n");
1342 // printf("AWindowGUI::update_assets %s\n", folders.values[i]->get_text());
1343 if(mwindow->edl->session->folderlist_format != folder_list->get_format())
1344 folder_list->update_format(mwindow->edl->session->folderlist_format, 0);
1345 folder_list->update(&folders,
1349 folder_list->get_xposition(),
1350 folder_list->get_yposition(),
1352 //printf("AWindowGUI::update_assets 5\n");
1354 if(mwindow->edl->session->assetlist_format != asset_list->get_format())
1355 asset_list->update_format(mwindow->edl->session->assetlist_format, 0);
1358 //printf("AWindowGUI::update_assets 6 %d\n", displayed_assets[0].total);
1359 asset_list->update(displayed_assets,
1361 mwindow->edl->session->asset_columns,
1363 asset_list->get_xposition(),
1364 asset_list->get_yposition(),
1367 //printf("AWindowGUI::update_assets 7\n");
1370 //printf("AWindowGUI::update_assets 8\n");
1374 void AWindowGUI::update_effects()
1376 aeffects.remove_all_objects();
1377 create_persistent_folder(&aeffects, 1, 0, 1, 0);
1378 veffects.remove_all_objects();
1379 create_persistent_folder(&veffects, 0, 1, 1, 0);
1380 atransitions.remove_all_objects();
1381 create_persistent_folder(&atransitions, 1, 0, 0, 1);
1382 vtransitions.remove_all_objects();
1383 create_persistent_folder(&vtransitions, 0, 1, 0, 1);
1386 int AWindowGUI::current_folder_number()
1389 for(int i = 0; i < folders.total; i++)
1391 if(!strcasecmp(folders.values[i]->get_text(), mwindow->edl->session->current_folder))
1400 int AWindowGUI::drag_motion()
1402 if(get_hidden()) return 0;
1408 int AWindowGUI::drag_stop()
1410 if(get_hidden()) return 0;
1415 Indexable* AWindowGUI::selected_asset()
1417 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1418 return picon ? picon->indexable : 0;
1421 PluginServer* AWindowGUI::selected_plugin()
1423 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1424 return picon ? picon->plugin : 0;
1427 AssetPicon* AWindowGUI::selected_folder()
1429 AssetPicon *picon = (AssetPicon*)folder_list->get_selection(0, 0);
1440 AWindowDivider::AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1441 : BC_SubWindow(x, y, w, h)
1443 this->mwindow = mwindow;
1446 AWindowDivider::~AWindowDivider()
1450 int AWindowDivider::button_press_event()
1452 if(is_event_win() && cursor_inside())
1454 mwindow->session->current_operation = DRAG_PARTITION;
1460 int AWindowDivider::cursor_motion_event()
1462 if(mwindow->session->current_operation == DRAG_PARTITION)
1464 mwindow->session->afolders_w = gui->get_relative_cursor_x();
1465 mwindow->theme->get_awindow_sizes(gui);
1466 gui->reposition_objects();
1472 int AWindowDivider::button_release_event()
1474 if(mwindow->session->current_operation == DRAG_PARTITION)
1476 mwindow->session->current_operation = NO_OPERATION;
1487 AWindowFolders::AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1492 mwindow->edl->session->folderlist_format == ASSETS_ICONS ?
1493 LISTBOX_ICONS : LISTBOX_TEXT,
1494 &gui->folders, // Each column has an ArrayList of BC_ListBoxItems.
1495 0, // Titles for columns. Set to 0 for no titles
1496 0, // width of each column
1497 1, // Total columns.
1498 0, // Pixel of top of window.
1499 0, // If this listbox is a popup window
1500 LISTBOX_SINGLE, // Select one item or multiple items
1501 ICON_TOP, // Position of icon relative to text of each item
1504 this->mwindow = mwindow;
1509 AWindowFolders::~AWindowFolders()
1513 int AWindowFolders::selection_changed()
1515 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1518 gui->stop_vicon_drawing();
1520 if(get_button_down() && get_buttonpress() == 3)
1522 gui->folderlist_menu->update_titles();
1523 gui->folderlist_menu->activate_menu();
1526 strcpy(mwindow->edl->session->current_folder, picon->get_text());
1527 //printf("AWindowFolders::selection_changed 1\n");
1528 gui->asset_list->draw_background();
1529 gui->async_update_assets();
1531 gui->start_vicon_drawing();
1536 int AWindowFolders::button_press_event()
1540 result = BC_ListBox::button_press_event();
1544 if(get_buttonpress() == 3 && is_event_win() && cursor_inside())
1546 gui->folderlist_menu->update_titles();
1547 gui->folderlist_menu->activate_menu();
1562 AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1567 (mwindow->edl->session->assetlist_format == ASSETS_ICONS && gui->allow_iconlisting ) ?
1568 LISTBOX_ICONS : LISTBOX_TEXT,
1569 &gui->assets, // Each column has an ArrayList of BC_ListBoxItems.
1570 gui->asset_titles, // Titles for columns. Set to 0 for no titles
1571 mwindow->edl->session->asset_columns, // width of each column
1572 1, // Total columns.
1573 0, // Pixel of top of window.
1574 0, // If this listbox is a popup window
1575 LISTBOX_MULTIPLE, // Select one item or multiple items
1576 ICON_TOP, // Position of icon relative to text of each item
1579 this->mwindow = mwindow;
1584 AWindowAssets::~AWindowAssets()
1588 int AWindowAssets::button_press_event()
1592 result = BC_ListBox::button_press_event();
1594 if(!result && get_buttonpress() == 3 && is_event_win() && cursor_inside())
1596 BC_ListBox::deactivate_selection();
1597 gui->assetlist_menu->update_titles();
1598 gui->assetlist_menu->activate_menu();
1607 int AWindowAssets::handle_event()
1609 //printf("AWindowAssets::handle_event 1 %d %d\n", get_buttonpress(), get_selection(0, 0));
1610 if(get_selection(0, 0))
1612 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1616 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1620 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1624 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1628 if(mwindow->vwindows.size())
1630 //printf("AWindowAssets::handle_event 2 %d %d\n", get_buttonpress(), get_selection(0, 0));
1631 mwindow->vwindows.get(DEFAULT_VWINDOW)->gui->lock_window("AWindowAssets::handle_event");
1633 if(((AssetPicon*)get_selection(0, 0))->indexable)
1634 mwindow->vwindows.get(DEFAULT_VWINDOW)->change_source(((AssetPicon*)get_selection(0, 0))->indexable);
1636 if(((AssetPicon*)get_selection(0, 0))->edl)
1637 mwindow->vwindows.get(DEFAULT_VWINDOW)->change_source(((AssetPicon*)get_selection(0, 0))->edl);
1639 mwindow->vwindows.get(DEFAULT_VWINDOW)->gui->unlock_window();
1647 int AWindowAssets::selection_changed()
1649 // Show popup window
1650 if(get_button_down() && get_buttonpress() == 3 && get_selection(0, 0))
1652 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER) ||
1653 !strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER) ||
1654 !strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER) ||
1655 !strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1657 gui->assetlist_menu->update_titles();
1658 gui->assetlist_menu->activate_menu();
1661 if (!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
1663 if(((AssetPicon*)get_selection(0, 0))->label)
1664 gui->label_menu->activate_menu();
1668 if(((AssetPicon*)get_selection(0, 0))->indexable)
1669 gui->asset_menu->update();
1671 if(((AssetPicon*)get_selection(0, 0))->edl)
1672 gui->asset_menu->update();
1676 gui->asset_menu->activate_menu();
1679 BC_ListBox::deactivate_selection();
1682 else if( get_button_down() && get_buttonpress() == 1 && get_selection(0, 0) ) {
1684 if( !gui->vicon_thread->viewing ) {
1685 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1686 vicon = picon->vicon;
1688 gui->vicon_thread->set_view_popup(vicon);
1694 void AWindowAssets::draw_background()
1696 clear_box(0,0,get_w(),get_h(),get_bg_surface());
1697 set_color(BC_WindowBase::get_resources()->audiovideo_color);
1698 set_font(LARGEFONT);
1700 get_text_width(LARGEFONT, mwindow->edl->session->current_folder) - 4,
1702 mwindow->edl->session->current_folder,
1707 int AWindowAssets::drag_start_event()
1709 int collect_pluginservers = 0;
1710 int collect_assets = 0;
1712 if(BC_ListBox::drag_start_event())
1714 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1716 mwindow->session->current_operation = DRAG_AEFFECT;
1717 collect_pluginservers = 1;
1720 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1722 mwindow->session->current_operation = DRAG_VEFFECT;
1723 collect_pluginservers = 1;
1726 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1728 mwindow->session->current_operation = DRAG_ATRANSITION;
1729 collect_pluginservers = 1;
1732 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1734 mwindow->session->current_operation = DRAG_VTRANSITION;
1735 collect_pluginservers = 1;
1738 if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
1744 mwindow->session->current_operation = DRAG_ASSET;
1749 if(collect_pluginservers)
1752 mwindow->session->drag_pluginservers->remove_all();
1755 AssetPicon *result = (AssetPicon*)get_selection(0, i++);
1758 mwindow->session->drag_pluginservers->append(result->plugin);
1764 gui->collect_assets();
1772 int AWindowAssets::drag_motion_event()
1774 BC_ListBox::drag_motion_event();
1777 mwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1778 mwindow->gui->drag_motion();
1779 mwindow->gui->unlock_window();
1781 for(int i = 0; i < mwindow->vwindows.size(); i++)
1783 VWindow *vwindow = mwindow->vwindows.get(i);
1784 vwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1785 vwindow->gui->drag_motion();
1786 vwindow->gui->unlock_window();
1789 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1790 mwindow->cwindow->gui->drag_motion();
1791 mwindow->cwindow->gui->unlock_window();
1793 lock_window("AWindowAssets::drag_motion_event");
1797 int AWindowAssets::drag_stop_event()
1801 result = gui->drag_stop();
1807 mwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1808 result = mwindow->gui->drag_stop();
1809 mwindow->gui->unlock_window();
1814 for(int i = 0; i < mwindow->vwindows.size(); i++)
1816 VWindow *vwindow = mwindow->vwindows.get(i);
1817 vwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1818 result = vwindow->gui->drag_stop();
1819 vwindow->gui->unlock_window();
1825 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1826 result = mwindow->cwindow->gui->drag_stop();
1827 mwindow->cwindow->gui->unlock_window();
1830 lock_window("AWindowAssets::drag_stop_event");
1832 if(result) get_drag_popup()->set_animation(0);
1834 BC_ListBox::drag_stop_event();
1835 mwindow->session->current_operation = ::NO_OPERATION; // since NO_OPERATION is also defined in listbox, we have to reach for global scope...
1839 int AWindowAssets::column_resize_event()
1841 mwindow->edl->session->asset_columns[0] = get_column_width(0);
1842 mwindow->edl->session->asset_columns[1] = get_column_width(1);
1846 int AWindowAssets::cursor_enter_event()
1848 int ret = BC_ListBox::cursor_enter_event();
1849 gui->start_vicon_drawing();
1853 int AWindowAssets::cursor_leave_event()
1855 gui->stop_vicon_drawing();
1856 return BC_ListBox::cursor_leave_event();
1870 AWindowNewFolder::AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1871 : BC_Button(x, y, mwindow->theme->newbin_data)
1873 this->mwindow = mwindow;
1875 set_tooltip(_("New bin"));
1878 int AWindowNewFolder::handle_event()
1880 gui->newfolder_thread->start_new_folder();
1884 AWindowDeleteFolder::AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1885 : BC_Button(x, y, mwindow->theme->deletebin_data)
1887 this->mwindow = mwindow;
1889 set_tooltip(_("Delete bin"));
1892 int AWindowDeleteFolder::handle_event()
1894 if(gui->folder_list->get_selection(0, 0))
1896 BC_ListBoxItem *folder = gui->folder_list->get_selection(0, 0);
1897 mwindow->delete_folder(folder->get_text());
1902 AWindowRenameFolder::AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1903 : BC_Button(x, y, mwindow->theme->renamebin_data)
1905 this->mwindow = mwindow;
1907 set_tooltip(_("Rename bin"));
1910 int AWindowRenameFolder::handle_event()
1915 AWindowDeleteDisk::AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1916 : BC_Button(x, y, mwindow->theme->deletedisk_data)
1918 this->mwindow = mwindow;
1920 set_tooltip(_("Delete asset from disk"));
1923 int AWindowDeleteDisk::handle_event()
1928 AWindowDeleteProject::AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1929 : BC_Button(x, y, mwindow->theme->deleteproject_data)
1931 this->mwindow = mwindow;
1933 set_tooltip(_("Delete asset from project"));
1936 int AWindowDeleteProject::handle_event()
1941 AWindowInfo::AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1942 : BC_Button(x, y, mwindow->theme->infoasset_data)
1944 this->mwindow = mwindow;
1946 set_tooltip(_("Edit information on asset"));
1949 int AWindowInfo::handle_event()
1951 gui->awindow->asset_edit->edit_asset(gui->selected_asset());
1955 AWindowRedrawIndex::AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1956 : BC_Button(x, y, mwindow->theme->redrawindex_data)
1958 this->mwindow = mwindow;
1960 set_tooltip(_("Redraw index"));
1963 int AWindowRedrawIndex::handle_event()
1968 AWindowPaste::AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1969 : BC_Button(x, y, mwindow->theme->pasteasset_data)
1971 this->mwindow = mwindow;
1973 set_tooltip(_("Paste asset on recordable tracks"));
1976 int AWindowPaste::handle_event()
1981 AWindowAppend::AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1982 : BC_Button(x, y, mwindow->theme->appendasset_data)
1984 this->mwindow = mwindow;
1986 set_tooltip(_("Append asset in new tracks"));
1989 int AWindowAppend::handle_event()
1994 AWindowView::AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1995 : BC_Button(x, y, mwindow->theme->viewasset_data)
1997 this->mwindow = mwindow;
1999 set_tooltip(_("View asset"));
2002 int AWindowView::handle_event()
2008 LabelPopup::LabelPopup(MWindow *mwindow, AWindowGUI *gui)
2015 this->mwindow = mwindow;
2019 LabelPopup::~LabelPopup()
2023 void LabelPopup::create_objects()
2025 add_item(editlabel = new LabelPopupEdit(mwindow, this));
2031 LabelPopupEdit::LabelPopupEdit(MWindow *mwindow, LabelPopup *popup)
2032 : BC_MenuItem(_("Edit..."))
2034 this->mwindow = mwindow;
2035 this->popup = popup;
2038 LabelPopupEdit::~LabelPopupEdit()
2042 int LabelPopupEdit::handle_event()
2047 AssetPicon *result = (AssetPicon*)mwindow->awindow->gui->asset_list->get_selection(0, i++);
2051 mwindow->awindow->gui->awindow->label_edit->edit_label(result->label);
2059 AddTools::AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, const char *title)
2060 : BC_PopupMenu(x, y, BC_Title::calculate_w(gui, title, MEDIUMFONT)+8, title, -1, 0, 4)
2062 this->mwindow = mwindow;
2066 void AddTools::create_objects()
2069 add_item(new AddPluginItem(this, "ladspa", PLUGIN_LADSPA_ID));
2070 vis |= 1 << PLUGIN_LADSPA_ID;
2071 add_item(new AddPluginItem(this, "ffmpeg", PLUGIN_FFMPEG_ID));
2072 vis |= 1 << PLUGIN_FFMPEG_ID;
2073 for( int i=0; i<MWindow::plugindb->size(); ++i ) {
2074 PluginServer *plugin = MWindow::plugindb->get(i);
2075 if( !plugin->audio && !plugin->video ) continue;
2076 int idx = plugin->dir_idx;
2077 uint32_t msk = 1 << idx;
2078 if( (msk & vis) != 0 ) continue;
2080 char parent[BCTEXTLEN];
2081 strcpy(parent, plugin->path);
2082 char *bp = strrchr(parent, '/');
2083 if( bp ) { *bp = 0; bp = strrchr(parent, '/'); }
2084 if( !bp ) bp = parent; else ++bp;
2085 add_item(new AddPluginItem(this, bp, idx));
2089 AddPluginItem::AddPluginItem(AddTools *menu, char const *text, int idx)
2094 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
2095 int chk = (msk & vis) ? 1 : 0;
2099 int AddPluginItem::handle_event()
2101 int chk = get_checked() ^ 1;
2103 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
2104 menu->gui->plugin_visibility = chk ? vis | msk : vis & ~msk;
2105 menu->gui->update_effects();
2106 menu->gui->save_defaults(menu->mwindow->defaults);
2107 menu->gui->async_update_assets();
2111 AVIconDrawing::AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images)
2112 : BC_Toggle(x, y, images, agui->vicon_drawing)
2115 set_tooltip(_("draw vicons"));
2118 void AVIconDrawing::calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh)
2120 int text_line = -1, toggle_x = -1, toggle_y = -1;
2121 int text_x = -1, text_y = -1, text_w = -1, text_h = -1;
2122 BC_Toggle::calculate_extents(agui, images, 1,
2123 &text_line, ww, hh, &toggle_x, &toggle_y,
2124 &text_x, &text_y, &text_w, &text_h, "", MEDIUMFONT);
2127 AVIconDrawing::~AVIconDrawing()
2131 int AVIconDrawing::handle_event()
2133 agui->vicon_drawing = get_value();
2134 if( agui->vicon_drawing )
2135 agui->start_vicon_drawing();
2137 agui->stop_vicon_drawing();