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 divider->reposition_window(
688 mwindow->theme->adivider_x, mwindow->theme->adivider_y,
689 mwindow->theme->adivider_w, mwindow->theme->adivider_h);
690 asset_list->reposition_window(
691 mwindow->theme->alist_x, mwindow->theme->alist_y,
692 mwindow->theme->alist_w, mwindow->theme->alist_h);
693 divider->reposition_window(
694 mwindow->theme->adivider_x, mwindow->theme->adivider_y,
695 mwindow->theme->adivider_w, mwindow->theme->adivider_h);
696 int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y;
697 int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h;
698 add_tools->resize_event(fw-avicon_w, add_tools->get_h());
699 avicon_drawing->reposition_window(fw-avicon_w, fy);
700 fy += add_tools->get_h(); fh -= add_tools->get_h();
701 folder_list->reposition_window(fx, fy, fw, fh);
704 int AWindowGUI::save_defaults(BC_Hash *defaults)
706 defaults->update("PLUGIN_VISIBILTY", plugin_visibility);
707 defaults->update("VICON_DRAWING", vicon_drawing);
711 int AWindowGUI::load_defaults(BC_Hash *defaults)
713 plugin_visibility = defaults->get("PLUGIN_VISIBILTY", plugin_visibility);
714 vicon_drawing = defaults->get("VICON_DRAWING", vicon_drawing);
718 int AWindowGUI::close_event()
721 mwindow->session->show_awindow = 0;
724 mwindow->gui->lock_window("AWindowGUI::close_event");
725 mwindow->gui->mainmenu->show_awindow->set_checked(0);
726 mwindow->gui->unlock_window();
728 lock_window("AWindowGUI::close_event");
729 save_defaults(mwindow->defaults);
730 mwindow->save_defaults();
734 void AWindowGUI::start_vicon_drawing()
736 if( !vicon_drawing ) return;
737 if( strcmp(mwindow->edl->session->current_folder, MEDIA_FOLDER) ) return;
738 if( mwindow->edl->session->assetlist_format != ASSETS_ICONS ) return;
739 vicon_thread->start_drawing();
742 void AWindowGUI::stop_vicon_drawing()
744 vicon_thread->stop_drawing();
747 AWindowRemovePluginGUI::
748 AWindowRemovePluginGUI(AWindow *awindow, AWindowRemovePlugin *thread,
749 int x, int y, PluginServer *plugin)
750 : BC_Window(PROGRAM_NAME ": Remove plugin", x,y, 500,200, 50, 50, 1, 0, 1, -1, "", 1)
752 this->awindow = awindow;
753 this->thread = thread;
754 this->plugin = plugin;
755 VFrame *vframe = plugin->get_picon();
756 icon = vframe ? create_pixmap(vframe) : 0;
757 plugin_list.append(new BC_ListBoxItem(plugin->title, icon));
760 AWindowRemovePluginGUI::
761 ~AWindowRemovePluginGUI()
763 if( !awindow->gui->protected_pixmap(icon) )
765 plugin_list.remove_all();
768 void AWindowRemovePluginGUI::create_objects()
770 BC_Button *ok_button = new BC_OKButton(this);
771 add_subwindow(ok_button);
772 BC_Button *cancel_button = new BC_CancelButton(this);
773 add_subwindow(cancel_button);
775 BC_Title *title = new BC_Title(x, y, _("remove plugin?"));
776 add_subwindow(title);
777 y += title->get_h() + 5;
778 list = new BC_ListBox(x, y,
779 get_w() - 20, ok_button->get_y() - y - 5, LISTBOX_TEXT, &plugin_list,
780 0, 0, 1, 0, 0, LISTBOX_SINGLE, ICON_LEFT, 0);
785 int AWindowRemovePlugin::remove_plugin(PluginServer *plugin, ArrayList<BC_ListBoxItem*> &folder)
788 for( int i=0; i<folder.size(); ) {
789 AssetPicon *picon = (AssetPicon *)folder[i];
790 if( picon->plugin == plugin ) {
791 folder.remove_object_number(i);
800 void AWindowRemovePlugin::handle_close_event(int result)
803 printf("remove %s\n", plugin->path);
804 ArrayList<BC_ListBoxItem*> *folder =
805 plugin->audio ? plugin->transition ?
806 &awindow->gui->atransitions :
807 &awindow->gui->aeffects :
808 plugin->video ? plugin->transition ?
809 &awindow->gui->vtransitions :
810 &awindow->gui->veffects :
812 if( folder ) remove_plugin(plugin, *folder);
813 char plugin_path[BCTEXTLEN];
814 strcpy(plugin_path, plugin->path);
815 MWindow *mwindow = awindow->mwindow;
816 mwindow->plugindb->remove(plugin);
818 char index_path[BCTEXTLEN];
819 sprintf(index_path, "%s/%s", mwindow->preferences->plugin_dir, PLUGIN_FILE);
821 char png_path[BCTEXTLEN];
822 if( plugin->get_theme_png_path(png_path, mwindow->preferences->theme) )
824 if( plugin->get_theme_png_path(png_path, "picon") )
826 delete plugin; plugin = 0;
827 awindow->gui->async_update_assets();
831 AWindowRemovePlugin::
832 AWindowRemovePlugin(AWindow *awindow, PluginServer *plugin)
835 this->awindow = awindow;
836 this->plugin = plugin;
839 AWindowRemovePlugin::
840 ~AWindowRemovePlugin()
845 BC_Window* AWindowRemovePlugin::new_gui()
847 int x = awindow->gui->get_abs_cursor_x(0);
848 int y = awindow->gui->get_abs_cursor_y(0);
849 AWindowRemovePluginGUI *gui = new AWindowRemovePluginGUI(awindow, this, x, y, plugin);
850 gui->create_objects();
854 int AWindowGUI::keypress_event()
856 switch(get_keypress()) {
865 PluginServer* plugin = selected_plugin();
867 remove_plugin = new AWindowRemovePlugin(awindow, plugin);
869 remove_plugin->start();
878 int AWindowGUI::create_custom_xatoms()
880 UpdateAssetsXAtom = create_xatom("CWINDOWGUI_UPDATE_ASSETS");
883 int AWindowGUI::recieve_custom_xatoms(xatom_event *event)
885 if( event->message_type == UpdateAssetsXAtom ) {
892 void AWindowGUI::async_update_assets()
895 event.message_type = UpdateAssetsXAtom;
896 send_custom_xatom(&event);
905 void AWindowGUI::update_folder_list()
907 stop_vicon_drawing();
908 //printf("AWindowGUI::update_folder_list 1\n");
909 for(int i = 0; i < folders.total; i++)
911 AssetPicon *picon = (AssetPicon*)folders.values[i];
914 //printf("AWindowGUI::update_folder_list 1\n");
916 // Search assets for folders
917 for(int i = 0; i < mwindow->edl->folders.total; i++)
919 char *folder = mwindow->edl->folders.values[i];
921 //printf("AWindowGUI::update_folder_list 1.1\n");
923 for(int j = 0; j < folders.total; j++)
925 AssetPicon *picon = (AssetPicon*)folders.values[j];
926 if(!strcasecmp(picon->get_text(), folder))
936 AssetPicon *picon = new AssetPicon(mwindow, this, folder);
937 picon->create_objects();
938 folders.append(picon);
940 //printf("AWindowGUI::update_folder_list 1.3\n");
942 //printf("AWindowGUI::update_folder_list 1\n");
943 //for(int i = 0; i < folders.total; i++)
944 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
947 for(int i = folders.total - 1; i >= 0; i--)
949 AssetPicon *picon = (AssetPicon*)folders.values[i];
950 if(!picon->in_use && !picon->persistent)
953 folders.remove_number(i);
956 //for(int i = 0; i < folders.total; i++)
957 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
958 //printf("AWindowGUI::update_folder_list 2\n");
959 start_vicon_drawing();
962 void AWindowGUI::create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
963 int do_audio, int do_video, int is_realtime, int is_transition)
965 ArrayList<PluginServer*> plugin_list;
966 // Get pointers to plugindb entries
967 mwindow->search_plugindb(do_audio, do_video, is_realtime, is_transition,
970 for(int i = 0; i < plugin_list.total; i++) {
971 PluginServer *server = plugin_list.values[i];
972 int visible = plugin_visibility & (1<<server->dir_idx);
973 if(!visible) continue;
974 // Create new listitem
975 AssetPicon *picon = new AssetPicon(mwindow, this, server);
976 picon->create_objects();
977 output->append(picon);
981 void AWindowGUI::create_label_folder()
984 for(current = mwindow->edl->labels->first; current; current = NEXT) {
985 AssetPicon *picon = new AssetPicon(mwindow, this, current);
986 picon->create_objects();
987 labellist.append(picon);
992 void AWindowGUI::update_asset_list()
994 //printf("AWindowGUI::update_asset_list 1\n");
995 for(int i = 0; i < assets.total; i++)
997 AssetPicon *picon = (AssetPicon*)assets.values[i];
1005 //printf("AWindowGUI::update_asset_list 2\n");
1008 // Synchronize EDL clips
1009 for(int i = 0; i < mwindow->edl->clips.total; i++)
1013 // Look for clip in existing listitems
1014 for(int j = 0; j < assets.total && !exists; j++)
1016 AssetPicon *picon = (AssetPicon*)assets.values[j];
1018 if(picon->id == mwindow->edl->clips.values[i]->id)
1020 picon->edl = mwindow->edl->clips.values[i];
1021 picon->set_text(mwindow->edl->clips.values[i]->local_session->clip_title);
1027 // Create new listitem
1030 AssetPicon *picon = new AssetPicon(mwindow,
1032 mwindow->edl->clips.values[i]);
1033 picon->create_objects();
1034 assets.append(picon);
1042 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1045 // Synchronize EDL assets
1046 for(Asset *current = mwindow->edl->assets->first;
1052 // Look for asset in existing listitems
1053 for(int j = 0; j < assets.total && !exists; j++)
1055 AssetPicon *picon = (AssetPicon*)assets.values[j];
1057 if(picon->id == current->id)
1059 picon->indexable = current;
1066 // Create new listitem
1069 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1070 AssetPicon *picon = new AssetPicon(mwindow, this, current);
1071 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1072 picon->create_objects();
1073 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1074 assets.append(picon);
1080 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1083 // Synchronize nested EDLs
1084 for(int i = 0; i < mwindow->edl->nested_edls->size(); i++)
1087 Indexable *indexable = mwindow->edl->nested_edls->get(i);
1089 // Look for asset in existing listitems
1090 for(int j = 0; j < assets.total && !exists; j++)
1092 AssetPicon *picon = (AssetPicon*)assets.values[j];
1094 if(picon->id == indexable->id)
1096 picon->indexable = indexable;
1103 // Create new listitem
1106 AssetPicon *picon = new AssetPicon(mwindow,
1109 picon->create_objects();
1110 assets.append(picon);
1122 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1123 for(int i = assets.size() - 1; i >= 0; i--)
1125 AssetPicon *picon = (AssetPicon*)assets.get(i);
1126 //printf("AWindowGUI::update_asset_list %s %d\n", picon->asset->path, picon->in_use);
1130 assets.remove_number(i);
1133 //printf("AWindowGUI::update_asset_list 7 %d\n", assets.total);
1140 void AWindowGUI::sort_assets()
1142 //printf("AWindowGUI::sort_assets 1 %s\n", mwindow->edl->session->current_folder);
1143 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1144 sort_picons(&aeffects,
1147 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1148 sort_picons(&veffects,
1151 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1152 sort_picons(&atransitions,
1155 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1156 sort_picons(&vtransitions,
1159 if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
1160 ;// Labels should ALWAYS be sorted by time.
1162 sort_picons(&assets,
1163 mwindow->edl->session->current_folder);
1178 void AWindowGUI::collect_assets()
1181 mwindow->session->drag_assets->remove_all();
1182 mwindow->session->drag_clips->remove_all();
1185 AssetPicon *result = (AssetPicon*)asset_list->get_selection(0, i++);
1188 if(result->indexable) mwindow->session->drag_assets->append(result->indexable);
1189 if(result->edl) mwindow->session->drag_clips->append(result->edl);
1193 void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst,
1194 ArrayList<BC_ListBoxItem*> *src,
1197 // Remove current pointers
1198 dst[0].remove_all();
1199 dst[1].remove_all_objects();
1201 // Create new pointers
1202 //if(folder) printf("AWindowGUI::copy_picons 1 %s\n", folder);
1203 for(int i = 0; i < src->total; i++)
1205 AssetPicon *picon = (AssetPicon*)src->values[i];
1206 //printf("AWindowGUI::copy_picons 2 %s\n", picon->asset->folder);
1208 (folder && picon->indexable && !strcasecmp(picon->indexable->folder, folder)) ||
1209 (folder && picon->edl && !strcasecmp(picon->edl->local_session->folder, folder)))
1211 BC_ListBoxItem *item2, *item1;
1212 dst[0].append(item1 = picon);
1214 dst[1].append(item2 = new BC_ListBoxItem(picon->edl->local_session->clip_notes));
1216 if(picon->label && picon->label->textstr)
1217 dst[1].append(item2 = new BC_ListBoxItem(picon->label->textstr));
1219 dst[1].append(item2 = new BC_ListBoxItem(""));
1220 item1->set_autoplace_text(1);
1221 item2->set_autoplace_text(1);
1222 //printf("AWindowGUI::copy_picons 3 %s\n", picon->get_text());
1227 void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src,
1230 //printf("AWindowGUI::sort_picons 1\n")
1235 for(int i = 0; i < src->total - 1; i++)
1237 BC_ListBoxItem *item1 = src->values[i];
1238 BC_ListBoxItem *item2 = src->values[i + 1];
1239 item1->set_autoplace_icon(1);
1240 item2->set_autoplace_icon(1);
1241 item1->set_autoplace_text(1);
1242 item2->set_autoplace_text(1);
1243 if(strcmp(item1->get_text(), item2->get_text()) > 0)
1245 src->values[i + 1] = item1;
1246 src->values[i] = item2;
1254 void AWindowGUI::filter_displayed_assets()
1256 allow_iconlisting = 1;
1257 asset_titles[0] = _("Title");
1258 asset_titles[1] = _("Comments");
1259 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1260 copy_picons(displayed_assets,
1264 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1265 copy_picons(displayed_assets,
1269 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1270 copy_picons(displayed_assets,
1274 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1275 copy_picons(displayed_assets,
1279 if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER)) {
1280 copy_picons(displayed_assets,
1283 asset_titles[0] = _("Time Stamps");
1284 asset_titles[1] = _("Title");
1285 allow_iconlisting = 0;
1288 copy_picons(displayed_assets,
1290 mwindow->edl->session->current_folder);
1291 // Ensure the current folder icon is highlighted
1292 for(int i = 0; i < folders.total; i++)
1294 if(!strcasecmp(mwindow->edl->session->current_folder, folders.values[i]->get_text()))
1295 folders.values[i]->set_selected(1);
1297 folders.values[i]->set_selected(0);
1302 void AWindowGUI::update_assets()
1304 //printf("AWindowGUI::update_assets 1\n");
1305 update_folder_list();
1306 //printf("AWindowGUI::update_assets 2\n");
1307 update_asset_list();
1308 labellist.remove_all_objects();
1309 create_label_folder();
1310 //printf("AWindowGUI::update_assets 3\n");
1311 filter_displayed_assets();
1313 //for(int i = 0; i < folders.total; i++)
1314 //printf("AWindowGUI::update_assets 4\n");
1315 // printf("AWindowGUI::update_assets %s\n", folders.values[i]->get_text());
1316 if(mwindow->edl->session->folderlist_format != folder_list->get_format())
1317 folder_list->update_format(mwindow->edl->session->folderlist_format, 0);
1318 folder_list->update(&folders,
1322 folder_list->get_xposition(),
1323 folder_list->get_yposition(),
1325 //printf("AWindowGUI::update_assets 5\n");
1327 if(mwindow->edl->session->assetlist_format != asset_list->get_format())
1328 asset_list->update_format(mwindow->edl->session->assetlist_format, 0);
1331 //printf("AWindowGUI::update_assets 6 %d\n", displayed_assets[0].total);
1332 asset_list->update(displayed_assets,
1334 mwindow->edl->session->asset_columns,
1336 asset_list->get_xposition(),
1337 asset_list->get_yposition(),
1340 asset_list->center_selection();
1341 //printf("AWindowGUI::update_assets 7\n");
1344 //printf("AWindowGUI::update_assets 8\n");
1348 void AWindowGUI::update_effects()
1350 aeffects.remove_all_objects();
1351 create_persistent_folder(&aeffects, 1, 0, 1, 0);
1352 veffects.remove_all_objects();
1353 create_persistent_folder(&veffects, 0, 1, 1, 0);
1354 atransitions.remove_all_objects();
1355 create_persistent_folder(&atransitions, 1, 0, 0, 1);
1356 vtransitions.remove_all_objects();
1357 create_persistent_folder(&vtransitions, 0, 1, 0, 1);
1360 int AWindowGUI::current_folder_number()
1363 for(int i = 0; i < folders.total; i++)
1365 if(!strcasecmp(folders.values[i]->get_text(), mwindow->edl->session->current_folder))
1374 int AWindowGUI::drag_motion()
1376 if(get_hidden()) return 0;
1382 int AWindowGUI::drag_stop()
1384 if(get_hidden()) return 0;
1389 Indexable* AWindowGUI::selected_asset()
1391 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1392 return picon ? picon->indexable : 0;
1395 PluginServer* AWindowGUI::selected_plugin()
1397 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1398 return picon ? picon->plugin : 0;
1401 AssetPicon* AWindowGUI::selected_folder()
1403 AssetPicon *picon = (AssetPicon*)folder_list->get_selection(0, 0);
1414 AWindowDivider::AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1415 : BC_SubWindow(x, y, w, h)
1417 this->mwindow = mwindow;
1420 AWindowDivider::~AWindowDivider()
1424 int AWindowDivider::button_press_event()
1426 if(is_event_win() && cursor_inside())
1428 mwindow->session->current_operation = DRAG_PARTITION;
1434 int AWindowDivider::cursor_motion_event()
1436 if(mwindow->session->current_operation == DRAG_PARTITION)
1439 int wmax = mwindow->session->awindow_w - mwindow->theme->adivider_w - wmin;
1440 int fw = gui->get_relative_cursor_x();
1441 if( fw > wmax ) fw = wmax;
1442 if( fw < wmin ) fw = wmin;
1443 mwindow->session->afolders_w = fw;
1444 mwindow->theme->get_awindow_sizes(gui);
1445 gui->reposition_objects();
1451 int AWindowDivider::button_release_event()
1453 if(mwindow->session->current_operation == DRAG_PARTITION)
1455 mwindow->session->current_operation = NO_OPERATION;
1466 AWindowFolders::AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1471 mwindow->edl->session->folderlist_format == ASSETS_ICONS ?
1472 LISTBOX_ICONS : LISTBOX_TEXT,
1473 &gui->folders, // Each column has an ArrayList of BC_ListBoxItems.
1474 0, // Titles for columns. Set to 0 for no titles
1475 0, // width of each column
1476 1, // Total columns.
1477 0, // Pixel of top of window.
1478 0, // If this listbox is a popup window
1479 LISTBOX_SINGLE, // Select one item or multiple items
1480 ICON_TOP, // Position of icon relative to text of each item
1483 this->mwindow = mwindow;
1488 AWindowFolders::~AWindowFolders()
1492 int AWindowFolders::selection_changed()
1494 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1497 gui->stop_vicon_drawing();
1499 strcpy(mwindow->edl->session->current_folder, picon->get_text());
1500 //printf("AWindowFolders::selection_changed 1\n");
1501 gui->asset_list->draw_background();
1502 gui->async_update_assets();
1504 gui->start_vicon_drawing();
1509 int AWindowFolders::button_press_event()
1511 return BC_ListBox::button_press_event();
1514 int AWindowFolders::button_release_event()
1517 if(get_buttonpress() == 3 && is_event_win() && cursor_inside())
1519 gui->folderlist_menu->update_titles();
1520 gui->folderlist_menu->activate_menu();
1524 result = BC_ListBox::button_release_event();
1533 AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1538 (mwindow->edl->session->assetlist_format == ASSETS_ICONS && gui->allow_iconlisting ) ?
1539 LISTBOX_ICONS : LISTBOX_TEXT,
1540 &gui->assets, // Each column has an ArrayList of BC_ListBoxItems.
1541 gui->asset_titles, // Titles for columns. Set to 0 for no titles
1542 mwindow->edl->session->asset_columns, // width of each column
1543 1, // Total columns.
1544 0, // Pixel of top of window.
1545 0, // If this listbox is a popup window
1546 LISTBOX_MULTIPLE, // Select one item or multiple items
1547 ICON_TOP, // Position of icon relative to text of each item
1550 this->mwindow = mwindow;
1555 AWindowAssets::~AWindowAssets()
1559 int AWindowAssets::button_press_event()
1561 return BC_ListBox::button_press_event();
1564 int AWindowAssets::button_release_event()
1567 if(get_buttonpress() == 3 && is_event_win() && cursor_inside()) {
1568 if( !strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER) ||
1569 !strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER) ||
1570 !strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER) ||
1571 !strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER)) {
1572 BC_ListBox::deactivate_selection();
1573 gui->assetlist_menu->update_titles();
1574 gui->assetlist_menu->activate_menu();
1576 else if (!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER)) {
1577 gui->label_menu->update();
1578 gui->label_menu->activate_menu();
1581 gui->asset_menu->update();
1582 gui->asset_menu->activate_menu();
1587 result = BC_ListBox::button_release_event();
1592 int AWindowAssets::handle_event()
1594 //printf("AWindowAssets::handle_event 1 %d %d\n", get_buttonpress(), get_selection(0, 0));
1595 if(get_selection(0, 0))
1597 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER)) {}
1598 else if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER)) {}
1599 else if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER)) {}
1600 else if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER)) {}
1601 else if(mwindow->vwindows.size()) {
1602 //printf("AWindowAssets::handle_event 2 %d %d\n", get_buttonpress(), get_selection(0, 0));
1603 mwindow->vwindows.get(DEFAULT_VWINDOW)->gui->lock_window("AWindowAssets::handle_event");
1605 if(((AssetPicon*)get_selection(0, 0))->indexable)
1606 mwindow->vwindows.get(DEFAULT_VWINDOW)->change_source(((AssetPicon*)get_selection(0, 0))->indexable);
1608 if(((AssetPicon*)get_selection(0, 0))->edl)
1609 mwindow->vwindows.get(DEFAULT_VWINDOW)->change_source(((AssetPicon*)get_selection(0, 0))->edl);
1611 mwindow->vwindows.get(DEFAULT_VWINDOW)->gui->unlock_window();
1619 int AWindowAssets::selection_changed()
1621 // Show popup window
1622 if(get_button_down() && get_buttonpress() == 3 && get_selection(0, 0))
1624 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER) ||
1625 !strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER) ||
1626 !strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER) ||
1627 !strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1629 gui->assetlist_menu->update_titles();
1630 gui->assetlist_menu->activate_menu();
1633 if (!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
1635 if(((AssetPicon*)get_selection(0, 0))->label)
1636 gui->label_menu->activate_menu();
1639 BC_ListBox::deactivate_selection();
1642 else if( get_button_down() && get_buttonpress() == 1 && get_selection(0, 0) ) {
1644 if( !gui->vicon_thread->viewing ) {
1645 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1646 vicon = picon->vicon;
1648 gui->vicon_thread->set_view_popup(vicon);
1654 void AWindowAssets::draw_background()
1656 clear_box(0,0,get_w(),get_h(),get_bg_surface());
1657 set_color(BC_WindowBase::get_resources()->audiovideo_color);
1658 set_font(LARGEFONT);
1660 get_text_width(LARGEFONT, mwindow->edl->session->current_folder) - 4,
1662 mwindow->edl->session->current_folder,
1667 int AWindowAssets::drag_start_event()
1669 int collect_pluginservers = 0;
1670 int collect_assets = 0;
1672 if(BC_ListBox::drag_start_event())
1674 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1676 mwindow->session->current_operation = DRAG_AEFFECT;
1677 collect_pluginservers = 1;
1680 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1682 mwindow->session->current_operation = DRAG_VEFFECT;
1683 collect_pluginservers = 1;
1686 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1688 mwindow->session->current_operation = DRAG_ATRANSITION;
1689 collect_pluginservers = 1;
1692 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1694 mwindow->session->current_operation = DRAG_VTRANSITION;
1695 collect_pluginservers = 1;
1698 if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
1704 mwindow->session->current_operation = DRAG_ASSET;
1709 if(collect_pluginservers)
1712 mwindow->session->drag_pluginservers->remove_all();
1715 AssetPicon *result = (AssetPicon*)get_selection(0, i++);
1718 mwindow->session->drag_pluginservers->append(result->plugin);
1724 gui->collect_assets();
1732 int AWindowAssets::drag_motion_event()
1734 BC_ListBox::drag_motion_event();
1737 mwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1738 mwindow->gui->drag_motion();
1739 mwindow->gui->unlock_window();
1741 for(int i = 0; i < mwindow->vwindows.size(); i++)
1743 VWindow *vwindow = mwindow->vwindows.get(i);
1744 vwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1745 vwindow->gui->drag_motion();
1746 vwindow->gui->unlock_window();
1749 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1750 mwindow->cwindow->gui->drag_motion();
1751 mwindow->cwindow->gui->unlock_window();
1753 lock_window("AWindowAssets::drag_motion_event");
1757 int AWindowAssets::drag_stop_event()
1761 result = gui->drag_stop();
1767 mwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1768 result = mwindow->gui->drag_stop();
1769 mwindow->gui->unlock_window();
1774 for(int i = 0; i < mwindow->vwindows.size(); i++)
1776 VWindow *vwindow = mwindow->vwindows.get(i);
1777 vwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1778 result = vwindow->gui->drag_stop();
1779 vwindow->gui->unlock_window();
1785 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1786 result = mwindow->cwindow->gui->drag_stop();
1787 mwindow->cwindow->gui->unlock_window();
1790 lock_window("AWindowAssets::drag_stop_event");
1792 if(result) get_drag_popup()->set_animation(0);
1794 BC_ListBox::drag_stop_event();
1795 mwindow->session->current_operation = ::NO_OPERATION; // since NO_OPERATION is also defined in listbox, we have to reach for global scope...
1799 int AWindowAssets::column_resize_event()
1801 mwindow->edl->session->asset_columns[0] = get_column_width(0);
1802 mwindow->edl->session->asset_columns[1] = get_column_width(1);
1806 int AWindowAssets::focus_in_event()
1808 gui->start_vicon_drawing();
1812 int AWindowAssets::focus_out_event()
1814 gui->stop_vicon_drawing();
1815 return BC_ListBox::focus_out_event();
1829 AWindowNewFolder::AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1830 : BC_Button(x, y, mwindow->theme->newbin_data)
1832 this->mwindow = mwindow;
1834 set_tooltip(_("New bin"));
1837 int AWindowNewFolder::handle_event()
1839 gui->newfolder_thread->start_new_folder();
1843 AWindowDeleteFolder::AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1844 : BC_Button(x, y, mwindow->theme->deletebin_data)
1846 this->mwindow = mwindow;
1848 set_tooltip(_("Delete bin"));
1851 int AWindowDeleteFolder::handle_event()
1853 if(gui->folder_list->get_selection(0, 0))
1855 BC_ListBoxItem *folder = gui->folder_list->get_selection(0, 0);
1856 mwindow->delete_folder(folder->get_text());
1861 AWindowRenameFolder::AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1862 : BC_Button(x, y, mwindow->theme->renamebin_data)
1864 this->mwindow = mwindow;
1866 set_tooltip(_("Rename bin"));
1869 int AWindowRenameFolder::handle_event()
1874 AWindowDeleteDisk::AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1875 : BC_Button(x, y, mwindow->theme->deletedisk_data)
1877 this->mwindow = mwindow;
1879 set_tooltip(_("Delete asset from disk"));
1882 int AWindowDeleteDisk::handle_event()
1887 AWindowDeleteProject::AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1888 : BC_Button(x, y, mwindow->theme->deleteproject_data)
1890 this->mwindow = mwindow;
1892 set_tooltip(_("Delete asset from project"));
1895 int AWindowDeleteProject::handle_event()
1900 AWindowInfo::AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1901 : BC_Button(x, y, mwindow->theme->infoasset_data)
1903 this->mwindow = mwindow;
1905 set_tooltip(_("Edit information on asset"));
1908 int AWindowInfo::handle_event()
1910 gui->awindow->asset_edit->edit_asset(gui->selected_asset());
1914 AWindowRedrawIndex::AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1915 : BC_Button(x, y, mwindow->theme->redrawindex_data)
1917 this->mwindow = mwindow;
1919 set_tooltip(_("Redraw index"));
1922 int AWindowRedrawIndex::handle_event()
1927 AWindowPaste::AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1928 : BC_Button(x, y, mwindow->theme->pasteasset_data)
1930 this->mwindow = mwindow;
1932 set_tooltip(_("Paste asset on recordable tracks"));
1935 int AWindowPaste::handle_event()
1940 AWindowAppend::AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1941 : BC_Button(x, y, mwindow->theme->appendasset_data)
1943 this->mwindow = mwindow;
1945 set_tooltip(_("Append asset in new tracks"));
1948 int AWindowAppend::handle_event()
1953 AWindowView::AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1954 : BC_Button(x, y, mwindow->theme->viewasset_data)
1956 this->mwindow = mwindow;
1958 set_tooltip(_("View asset"));
1961 int AWindowView::handle_event()
1967 LabelPopup::LabelPopup(MWindow *mwindow, AWindowGUI *gui)
1974 this->mwindow = mwindow;
1978 LabelPopup::~LabelPopup()
1982 void LabelPopup::create_objects()
1984 add_item(editlabel = new LabelPopupEdit(mwindow, this));
1987 int LabelPopup::update()
1989 gui->collect_assets();
1995 LabelPopupEdit::LabelPopupEdit(MWindow *mwindow, LabelPopup *popup)
1996 : BC_MenuItem(_("Edit..."))
1998 this->mwindow = mwindow;
1999 this->popup = popup;
2002 LabelPopupEdit::~LabelPopupEdit()
2006 int LabelPopupEdit::handle_event()
2011 AssetPicon *result = (AssetPicon*)mwindow->awindow->gui->asset_list->get_selection(0, i++);
2015 mwindow->awindow->gui->awindow->label_edit->edit_label(result->label);
2023 AddTools::AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, const char *title)
2024 : BC_PopupMenu(x, y, BC_Title::calculate_w(gui, title, MEDIUMFONT)+8, title, -1, 0, 4)
2026 this->mwindow = mwindow;
2030 void AddTools::create_objects()
2033 add_item(new AddPluginItem(this, "ladspa", PLUGIN_LADSPA_ID));
2034 vis |= 1 << PLUGIN_LADSPA_ID;
2035 add_item(new AddPluginItem(this, "ffmpeg", PLUGIN_FFMPEG_ID));
2036 vis |= 1 << PLUGIN_FFMPEG_ID;
2037 for( int i=0; i<MWindow::plugindb->size(); ++i ) {
2038 PluginServer *plugin = MWindow::plugindb->get(i);
2039 if( !plugin->audio && !plugin->video ) continue;
2040 int idx = plugin->dir_idx;
2041 uint32_t msk = 1 << idx;
2042 if( (msk & vis) != 0 ) continue;
2044 char parent[BCTEXTLEN];
2045 strcpy(parent, plugin->path);
2046 char *bp = strrchr(parent, '/');
2047 if( bp ) { *bp = 0; bp = strrchr(parent, '/'); }
2048 if( !bp ) bp = parent; else ++bp;
2049 add_item(new AddPluginItem(this, bp, idx));
2053 AddPluginItem::AddPluginItem(AddTools *menu, char const *text, int idx)
2058 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
2059 int chk = (msk & vis) ? 1 : 0;
2063 int AddPluginItem::handle_event()
2065 int chk = get_checked() ^ 1;
2067 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
2068 menu->gui->plugin_visibility = chk ? vis | msk : vis & ~msk;
2069 menu->gui->update_effects();
2070 menu->gui->save_defaults(menu->mwindow->defaults);
2071 menu->gui->async_update_assets();
2075 AVIconDrawing::AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images)
2076 : BC_Toggle(x, y, images, agui->vicon_drawing)
2079 set_tooltip(_("draw vicons"));
2082 void AVIconDrawing::calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh)
2084 int text_line = -1, toggle_x = -1, toggle_y = -1;
2085 int text_x = -1, text_y = -1, text_w = -1, text_h = -1;
2086 BC_Toggle::calculate_extents(agui, images, 1,
2087 &text_line, ww, hh, &toggle_x, &toggle_y,
2088 &text_x, &text_y, &text_w, &text_h, "", MEDIUMFONT);
2091 AVIconDrawing::~AVIconDrawing()
2095 int AVIconDrawing::handle_event()
2097 agui->vicon_drawing = get_value();
2098 if( agui->vicon_drawing )
2099 agui->start_vicon_drawing();
2101 agui->stop_vicon_drawing();