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, mwindow->session->awindow_y,
402 mwindow->session->awindow_w, mwindow->session->awindow_h,
405 // printf("AWindowGUI::AWindowGUI %d %d %d %d\n",
406 // mwindow->session->awindow_x,
407 // mwindow->session->awindow_y,
408 // mwindow->session->awindow_w,
409 // mwindow->session->awindow_h);
410 this->mwindow = mwindow;
411 this->awindow = awindow;
417 atransition_icon = 0; atransition_vframe = 0;
418 vtransition_icon = 0; vtransition_vframe = 0;
419 aeffect_icon = 0; aeffect_vframe = 0;
420 ladspa_icon = 0; ladspa_vframe = 0;
421 veffect_icon = 0; veffect_vframe = 0;
422 ff_aud_icon = 0; ff_aud_vframe = 0;
423 ff_vid_icon = 0; ff_vid_vframe = 0;
424 plugin_visibility = ((uint64_t)1<<(8*sizeof(uint64_t)-1))-1;
425 newfolder_thread = 0;
430 allow_iconlisting = 1;
436 AWindowGUI::~AWindowGUI()
438 assets.remove_all_objects();
439 folders.remove_all_objects();
440 aeffects.remove_all_objects();
441 veffects.remove_all_objects();
442 atransitions.remove_all_objects();
443 vtransitions.remove_all_objects();
444 labellist.remove_all_objects();
445 displayed_assets[1].remove_all_objects();
453 delete atransition_icon;
454 delete vtransition_icon;
457 delete ladspa_vframe;
459 delete ff_aud_vframe;
461 delete ff_vid_vframe;
463 delete newfolder_thread;
466 delete assetlist_menu;
467 delete folderlist_menu;
468 if(temp_picon) delete temp_picon;
469 delete remove_plugin;
472 bool AWindowGUI::protected_pixmap(BC_Pixmap *icon)
474 return icon == file_icon ||
475 icon == folder_icon ||
476 icon == audio_icon ||
477 icon == video_icon ||
479 icon == vtransition_icon ||
480 icon == atransition_icon ||
481 icon == veffect_icon ||
482 icon == aeffect_icon ||
483 icon == ladspa_icon ||
484 icon == ff_aud_icon ||
488 void AWindowGUI::create_objects()
492 lock_window("AWindowGUI::create_objects");
494 //printf("AWindowGUI::create_objects 1\n");
495 asset_titles[0] = _("Title");
496 asset_titles[1] = _("Comments");
500 set_icon(mwindow->theme->get_image("awindow_icon"));
501 file_icon = new BC_Pixmap(this,
502 BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN],
505 folder_icon = new BC_Pixmap(this,
506 BC_WindowBase::get_resources()->type_to_icon[ICON_FOLDER],
509 audio_icon = new BC_Pixmap(this,
510 BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND],
513 video_icon = new BC_Pixmap(this,
514 BC_WindowBase::get_resources()->type_to_icon[ICON_FILM],
519 clip_vframe = mwindow->theme->get_image("clip_icon");
520 clip_icon = new BC_Pixmap(this, clip_vframe, PIXMAP_ALPHA);
521 atransition_vframe = mwindow->theme->get_image("atransition_icon");
522 atransition_icon = new BC_Pixmap(this, atransition_vframe, PIXMAP_ALPHA);
523 vtransition_vframe = mwindow->theme->get_image("vtransition_icon");
524 vtransition_icon = new BC_Pixmap(this, vtransition_vframe, PIXMAP_ALPHA);
525 aeffect_vframe = mwindow->theme->get_image("aeffect_icon");
526 aeffect_icon = new BC_Pixmap(this, aeffect_vframe, PIXMAP_ALPHA);
527 ladspa_vframe = new VFramePng(lad_picon_png);
528 ladspa_icon = new BC_Pixmap(this, ladspa_vframe, PIXMAP_ALPHA);
529 ff_aud_vframe = new VFramePng(ff_audio_png);
530 ff_aud_icon = new BC_Pixmap(this, ff_aud_vframe, PIXMAP_ALPHA);
531 ff_vid_vframe = new VFramePng(ff_video_png);
532 ff_vid_icon = new BC_Pixmap(this, ff_vid_vframe, PIXMAP_ALPHA);
533 veffect_vframe = mwindow->theme->get_image("veffect_icon");
534 veffect_icon = new BC_Pixmap(this, veffect_vframe, PIXMAP_ALPHA);
539 folders.append(picon = new AssetPicon(mwindow,
542 picon->persistent = 1;
543 folders.append(picon = new AssetPicon(mwindow,
546 picon->persistent = 1;
547 folders.append(picon = new AssetPicon(mwindow,
549 ATRANSITION_FOLDER));
550 picon->persistent = 1;
551 folders.append(picon = new AssetPicon(mwindow,
553 VTRANSITION_FOLDER));
554 picon->persistent = 1;
555 folders.append(picon = new AssetPicon(mwindow,
558 picon->persistent = 1;
560 create_label_folder();
563 mwindow->theme->get_awindow_sizes(this);
564 load_defaults(mwindow->defaults);
567 add_subwindow(asset_list = new AWindowAssets(mwindow,
569 mwindow->theme->alist_x,
570 mwindow->theme->alist_y,
571 mwindow->theme->alist_w,
572 mwindow->theme->alist_h));
574 vicon_thread = new VIconThread(asset_list);
575 vicon_thread->start();
578 add_subwindow(divider = new AWindowDivider(mwindow,
580 mwindow->theme->adivider_x,
581 mwindow->theme->adivider_y,
582 mwindow->theme->adivider_w,
583 mwindow->theme->adivider_h));
586 divider->set_cursor(HSEPARATE_CURSOR, 0, 0);
589 int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y;
590 int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h;
591 VFrame **images = mwindow->theme->get_image_set("playpatch_data");
592 AVIconDrawing::calculate_geometry(this, images, &avicon_w, &avicon_h);
593 add_subwindow(avicon_drawing = new AVIconDrawing(this, fw-avicon_w, fy, images));
594 add_subwindow(add_tools = new AddTools(mwindow, this, fx, fy, _("Visibility")));
595 add_tools->create_objects();
596 fy += add_tools->get_h(); fh -= add_tools->get_h();
598 add_subwindow(folder_list = new AWindowFolders(mwindow,
599 this, fx, fy, fw, fh));
604 //int x = mwindow->theme->abuttons_x;
605 //int y = mwindow->theme->abuttons_y;
609 newfolder_thread = new NewFolderThread(mwindow, this);
611 add_subwindow(asset_menu = new AssetPopup(mwindow, this));
612 asset_menu->create_objects();
614 add_subwindow(label_menu = new LabelPopup(mwindow, this));
615 label_menu->create_objects();
619 add_subwindow(assetlist_menu = new AssetListMenu(mwindow, this));
622 assetlist_menu->create_objects();
626 add_subwindow(folderlist_menu = new FolderListMenu(mwindow, this));
627 folderlist_menu->create_objects();
628 //printf("AWindowGUI::create_objects 2\n");
631 create_custom_xatoms();
635 int AWindowGUI::resize_event(int w, int h)
637 mwindow->session->awindow_x = get_x();
638 mwindow->session->awindow_y = get_y();
639 mwindow->session->awindow_w = w;
640 mwindow->session->awindow_h = h;
642 mwindow->theme->get_awindow_sizes(this);
643 mwindow->theme->draw_awindow_bg(this);
644 reposition_objects();
646 // int x = mwindow->theme->abuttons_x;
647 // int y = mwindow->theme->abuttons_y;
648 // new_bin->reposition_window(x, y);
649 // x += new_bin->get_w();
650 // delete_bin->reposition_window(x, y);
651 // x += delete_bin->get_w();
652 // rename_bin->reposition_window(x, y);
653 // x += rename_bin->get_w();
654 // delete_disk->reposition_window(x, y);
655 // x += delete_disk->get_w();
656 // delete_project->reposition_window(x, y);
657 // x += delete_project->get_w();
658 // info->reposition_window(x, y);
659 // x += info->get_w();
660 // redraw_index->reposition_window(x, y);
661 // x += redraw_index->get_w();
662 // paste->reposition_window(x, y);
663 // x += paste->get_w();
664 // append->reposition_window(x, y);
665 // x += append->get_w();
666 // view->reposition_window(x, y);
668 BC_WindowBase::resize_event(w, h);
672 int AWindowGUI::translation_event()
674 mwindow->session->awindow_x = get_x();
675 mwindow->session->awindow_y = get_y();
679 void AWindowGUI::reposition_objects()
681 divider->reposition_window(
682 mwindow->theme->adivider_x, mwindow->theme->adivider_y,
683 mwindow->theme->adivider_w, mwindow->theme->adivider_h);
684 asset_list->reposition_window(
685 mwindow->theme->alist_x, mwindow->theme->alist_y,
686 mwindow->theme->alist_w, mwindow->theme->alist_h);
687 divider->reposition_window(
688 mwindow->theme->adivider_x, mwindow->theme->adivider_y,
689 mwindow->theme->adivider_w, mwindow->theme->adivider_h);
690 int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y;
691 int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h;
692 add_tools->resize_event(fw-avicon_w, add_tools->get_h());
693 avicon_drawing->reposition_window(fw-avicon_w, fy);
694 fy += add_tools->get_h(); fh -= add_tools->get_h();
695 folder_list->reposition_window(fx, fy, fw, fh);
698 int AWindowGUI::save_defaults(BC_Hash *defaults)
700 defaults->update("PLUGIN_VISIBILTY", plugin_visibility);
701 defaults->update("VICON_DRAWING", vicon_drawing);
705 int AWindowGUI::load_defaults(BC_Hash *defaults)
707 plugin_visibility = defaults->get("PLUGIN_VISIBILTY", plugin_visibility);
708 vicon_drawing = defaults->get("VICON_DRAWING", vicon_drawing);
712 int AWindowGUI::close_event()
715 mwindow->session->show_awindow = 0;
718 mwindow->gui->lock_window("AWindowGUI::close_event");
719 mwindow->gui->mainmenu->show_awindow->set_checked(0);
720 mwindow->gui->unlock_window();
722 lock_window("AWindowGUI::close_event");
723 save_defaults(mwindow->defaults);
724 mwindow->save_defaults();
728 void AWindowGUI::start_vicon_drawing()
730 if( !vicon_drawing ) return;
731 if( strcmp(mwindow->edl->session->current_folder, MEDIA_FOLDER) ) return;
732 if( mwindow->edl->session->assetlist_format != ASSETS_ICONS ) return;
733 vicon_thread->start_drawing();
736 void AWindowGUI::stop_vicon_drawing()
738 vicon_thread->stop_drawing();
741 AWindowRemovePluginGUI::
742 AWindowRemovePluginGUI(AWindow *awindow, AWindowRemovePlugin *thread,
743 int x, int y, PluginServer *plugin)
744 : BC_Window(_(PROGRAM_NAME ": Remove plugin"), x,y, 500,200, 50, 50, 1, 0, 1, -1, "", 1)
746 this->awindow = awindow;
747 this->thread = thread;
748 this->plugin = plugin;
749 VFrame *vframe = plugin->get_picon();
750 icon = vframe ? create_pixmap(vframe) : 0;
751 plugin_list.append(new BC_ListBoxItem(plugin->title, icon));
754 AWindowRemovePluginGUI::
755 ~AWindowRemovePluginGUI()
757 if( !awindow->gui->protected_pixmap(icon) )
759 plugin_list.remove_all();
762 void AWindowRemovePluginGUI::create_objects()
764 BC_Button *ok_button = new BC_OKButton(this);
765 add_subwindow(ok_button);
766 BC_Button *cancel_button = new BC_CancelButton(this);
767 add_subwindow(cancel_button);
769 BC_Title *title = new BC_Title(x, y, _("remove plugin?"));
770 add_subwindow(title);
771 y += title->get_h() + 5;
772 list = new BC_ListBox(x, y,
773 get_w() - 20, ok_button->get_y() - y - 5, LISTBOX_TEXT, &plugin_list,
774 0, 0, 1, 0, 0, LISTBOX_SINGLE, ICON_LEFT, 0);
779 int AWindowRemovePlugin::remove_plugin(PluginServer *plugin, ArrayList<BC_ListBoxItem*> &folder)
782 for( int i=0; i<folder.size(); ) {
783 AssetPicon *picon = (AssetPicon *)folder[i];
784 if( picon->plugin == plugin ) {
785 folder.remove_object_number(i);
794 void AWindowRemovePlugin::handle_close_event(int result)
797 printf(_("remove %s\n"), plugin->path);
798 ArrayList<BC_ListBoxItem*> *folder =
799 plugin->audio ? plugin->transition ?
800 &awindow->gui->atransitions :
801 &awindow->gui->aeffects :
802 plugin->video ? plugin->transition ?
803 &awindow->gui->vtransitions :
804 &awindow->gui->veffects :
806 if( folder ) remove_plugin(plugin, *folder);
807 char plugin_path[BCTEXTLEN];
808 strcpy(plugin_path, plugin->path);
809 MWindow *mwindow = awindow->mwindow;
810 mwindow->plugindb->remove(plugin);
812 char index_path[BCTEXTLEN];
813 sprintf(index_path, "%s/%s", mwindow->preferences->plugin_dir, PLUGIN_FILE);
815 char png_path[BCTEXTLEN];
816 if( plugin->get_theme_png_path(png_path, mwindow->preferences->theme) )
818 if( plugin->get_theme_png_path(png_path, "picon") )
820 delete plugin; plugin = 0;
821 awindow->gui->async_update_assets();
825 AWindowRemovePlugin::
826 AWindowRemovePlugin(AWindow *awindow, PluginServer *plugin)
829 this->awindow = awindow;
830 this->plugin = plugin;
833 AWindowRemovePlugin::
834 ~AWindowRemovePlugin()
839 BC_Window* AWindowRemovePlugin::new_gui()
841 int x = awindow->gui->get_abs_cursor_x(0);
842 int y = awindow->gui->get_abs_cursor_y(0);
843 AWindowRemovePluginGUI *gui = new AWindowRemovePluginGUI(awindow, this, x, y, plugin);
844 gui->create_objects();
848 int AWindowGUI::keypress_event()
850 switch(get_keypress()) {
859 PluginServer* plugin = selected_plugin();
861 remove_plugin = new AWindowRemovePlugin(awindow, plugin);
863 remove_plugin->start();
872 int AWindowGUI::create_custom_xatoms()
874 UpdateAssetsXAtom = create_xatom("CWINDOWGUI_UPDATE_ASSETS");
877 int AWindowGUI::recieve_custom_xatoms(xatom_event *event)
879 if( event->message_type == UpdateAssetsXAtom ) {
886 void AWindowGUI::async_update_assets()
889 event.message_type = UpdateAssetsXAtom;
890 send_custom_xatom(&event);
899 void AWindowGUI::update_folder_list()
901 stop_vicon_drawing();
902 //printf("AWindowGUI::update_folder_list 1\n");
903 for(int i = 0; i < folders.total; i++)
905 AssetPicon *picon = (AssetPicon*)folders.values[i];
908 //printf("AWindowGUI::update_folder_list 1\n");
910 // Search assets for folders
911 for(int i = 0; i < mwindow->edl->folders.total; i++)
913 char *folder = mwindow->edl->folders.values[i];
915 //printf("AWindowGUI::update_folder_list 1.1\n");
917 for(int j = 0; j < folders.total; j++)
919 AssetPicon *picon = (AssetPicon*)folders.values[j];
920 if(!strcasecmp(picon->get_text(), folder))
930 AssetPicon *picon = new AssetPicon(mwindow, this, folder);
931 picon->create_objects();
932 folders.append(picon);
934 //printf("AWindowGUI::update_folder_list 1.3\n");
936 //printf("AWindowGUI::update_folder_list 1\n");
937 //for(int i = 0; i < folders.total; i++)
938 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
941 for(int i = folders.total - 1; i >= 0; i--)
943 AssetPicon *picon = (AssetPicon*)folders.values[i];
944 if(!picon->in_use && !picon->persistent)
947 folders.remove_number(i);
950 //for(int i = 0; i < folders.total; i++)
951 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
952 //printf("AWindowGUI::update_folder_list 2\n");
953 start_vicon_drawing();
956 void AWindowGUI::create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
957 int do_audio, int do_video, int is_realtime, int is_transition)
959 ArrayList<PluginServer*> plugin_list;
960 // Get pointers to plugindb entries
961 mwindow->search_plugindb(do_audio, do_video, is_realtime, is_transition,
964 for(int i = 0; i < plugin_list.total; i++) {
965 PluginServer *server = plugin_list.values[i];
966 int visible = plugin_visibility & (1<<server->dir_idx);
967 if(!visible) continue;
968 // Create new listitem
969 AssetPicon *picon = new AssetPicon(mwindow, this, server);
970 picon->create_objects();
971 output->append(picon);
975 void AWindowGUI::create_label_folder()
978 for(current = mwindow->edl->labels->first; current; current = NEXT) {
979 AssetPicon *picon = new AssetPicon(mwindow, this, current);
980 picon->create_objects();
981 labellist.append(picon);
986 void AWindowGUI::update_asset_list()
988 //printf("AWindowGUI::update_asset_list 1\n");
989 for(int i = 0; i < assets.total; i++)
991 AssetPicon *picon = (AssetPicon*)assets.values[i];
999 //printf("AWindowGUI::update_asset_list 2\n");
1002 // Synchronize EDL clips
1003 for(int i = 0; i < mwindow->edl->clips.total; i++)
1007 // Look for clip in existing listitems
1008 for(int j = 0; j < assets.total && !exists; j++)
1010 AssetPicon *picon = (AssetPicon*)assets.values[j];
1012 if(picon->id == mwindow->edl->clips.values[i]->id)
1014 picon->edl = mwindow->edl->clips.values[i];
1015 picon->set_text(mwindow->edl->clips.values[i]->local_session->clip_title);
1021 // Create new listitem
1024 AssetPicon *picon = new AssetPicon(mwindow,
1026 mwindow->edl->clips.values[i]);
1027 picon->create_objects();
1028 assets.append(picon);
1036 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1039 // Synchronize EDL assets
1040 for(Asset *current = mwindow->edl->assets->first;
1046 // Look for asset in existing listitems
1047 for(int j = 0; j < assets.total && !exists; j++)
1049 AssetPicon *picon = (AssetPicon*)assets.values[j];
1051 if(picon->id == current->id)
1053 picon->indexable = current;
1060 // Create new listitem
1063 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1064 AssetPicon *picon = new AssetPicon(mwindow, this, current);
1065 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1066 picon->create_objects();
1067 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1068 assets.append(picon);
1074 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1077 // Synchronize nested EDLs
1078 for(int i = 0; i < mwindow->edl->nested_edls->size(); i++)
1081 Indexable *indexable = mwindow->edl->nested_edls->get(i);
1083 // Look for asset in existing listitems
1084 for(int j = 0; j < assets.total && !exists; j++)
1086 AssetPicon *picon = (AssetPicon*)assets.values[j];
1088 if(picon->id == indexable->id)
1090 picon->indexable = indexable;
1097 // Create new listitem
1100 AssetPicon *picon = new AssetPicon(mwindow,
1103 picon->create_objects();
1104 assets.append(picon);
1116 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1117 for(int i = assets.size() - 1; i >= 0; i--)
1119 AssetPicon *picon = (AssetPicon*)assets.get(i);
1120 //printf("AWindowGUI::update_asset_list %s %d\n", picon->asset->path, picon->in_use);
1124 assets.remove_number(i);
1127 //printf("AWindowGUI::update_asset_list 7 %d\n", assets.total);
1134 void AWindowGUI::sort_assets()
1136 //printf("AWindowGUI::sort_assets 1 %s\n", mwindow->edl->session->current_folder);
1137 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1138 sort_picons(&aeffects,
1141 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1142 sort_picons(&veffects,
1145 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1146 sort_picons(&atransitions,
1149 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1150 sort_picons(&vtransitions,
1153 if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
1154 ;// Labels should ALWAYS be sorted by time.
1156 sort_picons(&assets,
1157 mwindow->edl->session->current_folder);
1172 void AWindowGUI::collect_assets()
1175 mwindow->session->drag_assets->remove_all();
1176 mwindow->session->drag_clips->remove_all();
1179 AssetPicon *result = (AssetPicon*)asset_list->get_selection(0, i++);
1182 if(result->indexable) mwindow->session->drag_assets->append(result->indexable);
1183 if(result->edl) mwindow->session->drag_clips->append(result->edl);
1187 void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst,
1188 ArrayList<BC_ListBoxItem*> *src,
1191 // Remove current pointers
1192 dst[0].remove_all();
1193 dst[1].remove_all_objects();
1195 // Create new pointers
1196 //if(folder) printf("AWindowGUI::copy_picons 1 %s\n", folder);
1197 for(int i = 0; i < src->total; i++)
1199 AssetPicon *picon = (AssetPicon*)src->values[i];
1200 //printf("AWindowGUI::copy_picons 2 %s\n", picon->asset->folder);
1202 (folder && picon->indexable && !strcasecmp(picon->indexable->folder, folder)) ||
1203 (folder && picon->edl && !strcasecmp(picon->edl->local_session->folder, folder)))
1205 BC_ListBoxItem *item2, *item1;
1206 dst[0].append(item1 = picon);
1208 dst[1].append(item2 = new BC_ListBoxItem(picon->edl->local_session->clip_notes));
1210 if(picon->label && picon->label->textstr)
1211 dst[1].append(item2 = new BC_ListBoxItem(picon->label->textstr));
1213 dst[1].append(item2 = new BC_ListBoxItem(""));
1214 item1->set_autoplace_text(1);
1215 item2->set_autoplace_text(1);
1216 //printf("AWindowGUI::copy_picons 3 %s\n", picon->get_text());
1221 void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src,
1224 //printf("AWindowGUI::sort_picons 1\n")
1229 for(int i = 0; i < src->total - 1; i++)
1231 BC_ListBoxItem *item1 = src->values[i];
1232 BC_ListBoxItem *item2 = src->values[i + 1];
1233 item1->set_autoplace_icon(1);
1234 item2->set_autoplace_icon(1);
1235 item1->set_autoplace_text(1);
1236 item2->set_autoplace_text(1);
1237 if(strcmp(item1->get_text(), item2->get_text()) > 0)
1239 src->values[i + 1] = item1;
1240 src->values[i] = item2;
1248 void AWindowGUI::filter_displayed_assets()
1250 allow_iconlisting = 1;
1251 asset_titles[0] = _("Title");
1252 asset_titles[1] = _("Comments");
1253 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1254 copy_picons(displayed_assets,
1258 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1259 copy_picons(displayed_assets,
1263 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1264 copy_picons(displayed_assets,
1268 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1269 copy_picons(displayed_assets,
1273 if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER)) {
1274 copy_picons(displayed_assets,
1277 asset_titles[0] = _("Time Stamps");
1278 asset_titles[1] = _("Title");
1279 allow_iconlisting = 0;
1282 copy_picons(displayed_assets,
1284 mwindow->edl->session->current_folder);
1285 // Ensure the current folder icon is highlighted
1286 for(int i = 0; i < folders.total; i++)
1288 if(!strcasecmp(mwindow->edl->session->current_folder, folders.values[i]->get_text()))
1289 folders.values[i]->set_selected(1);
1291 folders.values[i]->set_selected(0);
1296 void AWindowGUI::update_assets()
1298 //printf("AWindowGUI::update_assets 1\n");
1299 update_folder_list();
1300 //printf("AWindowGUI::update_assets 2\n");
1301 update_asset_list();
1302 labellist.remove_all_objects();
1303 create_label_folder();
1304 //printf("AWindowGUI::update_assets 3\n");
1305 filter_displayed_assets();
1307 //for(int i = 0; i < folders.total; i++)
1308 //printf("AWindowGUI::update_assets 4\n");
1309 // printf("AWindowGUI::update_assets %s\n", folders.values[i]->get_text());
1310 if(mwindow->edl->session->folderlist_format != folder_list->get_format())
1311 folder_list->update_format(mwindow->edl->session->folderlist_format, 0);
1312 folder_list->update(&folders,
1316 folder_list->get_xposition(),
1317 folder_list->get_yposition(),
1319 //printf("AWindowGUI::update_assets 5\n");
1321 if(mwindow->edl->session->assetlist_format != asset_list->get_format())
1322 asset_list->update_format(mwindow->edl->session->assetlist_format, 0);
1325 //printf("AWindowGUI::update_assets 6 %d\n", displayed_assets[0].total);
1326 asset_list->update(displayed_assets,
1328 mwindow->edl->session->asset_columns,
1330 asset_list->get_xposition(),
1331 asset_list->get_yposition(),
1334 asset_list->center_selection();
1335 //printf("AWindowGUI::update_assets 7\n");
1338 //printf("AWindowGUI::update_assets 8\n");
1342 void AWindowGUI::update_effects()
1344 aeffects.remove_all_objects();
1345 create_persistent_folder(&aeffects, 1, 0, 1, 0);
1346 veffects.remove_all_objects();
1347 create_persistent_folder(&veffects, 0, 1, 1, 0);
1348 atransitions.remove_all_objects();
1349 create_persistent_folder(&atransitions, 1, 0, 0, 1);
1350 vtransitions.remove_all_objects();
1351 create_persistent_folder(&vtransitions, 0, 1, 0, 1);
1354 int AWindowGUI::current_folder_number()
1357 for(int i = 0; i < folders.total; i++)
1359 if(!strcasecmp(folders.values[i]->get_text(), mwindow->edl->session->current_folder))
1368 int AWindowGUI::drag_motion()
1370 if(get_hidden()) return 0;
1376 int AWindowGUI::drag_stop()
1378 if(get_hidden()) return 0;
1383 Indexable* AWindowGUI::selected_asset()
1385 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1386 return picon ? picon->indexable : 0;
1389 PluginServer* AWindowGUI::selected_plugin()
1391 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1392 return picon ? picon->plugin : 0;
1395 AssetPicon* AWindowGUI::selected_folder()
1397 AssetPicon *picon = (AssetPicon*)folder_list->get_selection(0, 0);
1408 AWindowDivider::AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1409 : BC_SubWindow(x, y, w, h)
1411 this->mwindow = mwindow;
1414 AWindowDivider::~AWindowDivider()
1418 int AWindowDivider::button_press_event()
1420 if(is_event_win() && cursor_inside())
1422 mwindow->session->current_operation = DRAG_PARTITION;
1428 int AWindowDivider::cursor_motion_event()
1430 if(mwindow->session->current_operation == DRAG_PARTITION)
1433 int wmax = mwindow->session->awindow_w - mwindow->theme->adivider_w - wmin;
1434 int fw = gui->get_relative_cursor_x();
1435 if( fw > wmax ) fw = wmax;
1436 if( fw < wmin ) fw = wmin;
1437 mwindow->session->afolders_w = fw;
1438 mwindow->theme->get_awindow_sizes(gui);
1439 gui->reposition_objects();
1445 int AWindowDivider::button_release_event()
1447 if(mwindow->session->current_operation == DRAG_PARTITION)
1449 mwindow->session->current_operation = NO_OPERATION;
1460 AWindowFolders::AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1465 mwindow->edl->session->folderlist_format == ASSETS_ICONS ?
1466 LISTBOX_ICONS : LISTBOX_TEXT,
1467 &gui->folders, // Each column has an ArrayList of BC_ListBoxItems.
1468 0, // Titles for columns. Set to 0 for no titles
1469 0, // width of each column
1470 1, // Total columns.
1471 0, // Pixel of top of window.
1472 0, // If this listbox is a popup window
1473 LISTBOX_SINGLE, // Select one item or multiple items
1474 ICON_TOP, // Position of icon relative to text of each item
1477 this->mwindow = mwindow;
1482 AWindowFolders::~AWindowFolders()
1486 int AWindowFolders::selection_changed()
1488 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1491 gui->stop_vicon_drawing();
1493 strcpy(mwindow->edl->session->current_folder, picon->get_text());
1494 //printf("AWindowFolders::selection_changed 1\n");
1495 gui->asset_list->draw_background();
1496 gui->async_update_assets();
1498 gui->start_vicon_drawing();
1503 int AWindowFolders::button_press_event()
1505 return BC_ListBox::button_press_event();
1508 int AWindowFolders::button_release_event()
1511 if(get_buttonpress() == 3 && is_event_win() && cursor_inside())
1513 gui->folderlist_menu->update_titles();
1514 gui->folderlist_menu->activate_menu();
1518 result = BC_ListBox::button_release_event();
1527 AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1532 (mwindow->edl->session->assetlist_format == ASSETS_ICONS && gui->allow_iconlisting ) ?
1533 LISTBOX_ICONS : LISTBOX_TEXT,
1534 &gui->assets, // Each column has an ArrayList of BC_ListBoxItems.
1535 gui->asset_titles, // Titles for columns. Set to 0 for no titles
1536 mwindow->edl->session->asset_columns, // width of each column
1537 1, // Total columns.
1538 0, // Pixel of top of window.
1539 0, // If this listbox is a popup window
1540 LISTBOX_MULTIPLE, // Select one item or multiple items
1541 ICON_TOP, // Position of icon relative to text of each item
1544 this->mwindow = mwindow;
1549 AWindowAssets::~AWindowAssets()
1553 int AWindowAssets::button_press_event()
1555 return BC_ListBox::button_press_event();
1558 int AWindowAssets::button_release_event()
1561 if(get_buttonpress() == 3 && is_event_win() && cursor_inside()) {
1562 if( !strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER) ||
1563 !strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER) ||
1564 !strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER) ||
1565 !strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER)) {
1566 BC_ListBox::deactivate_selection();
1567 gui->assetlist_menu->update_titles();
1568 gui->assetlist_menu->activate_menu();
1570 else if (!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER)) {
1571 gui->label_menu->update();
1572 gui->label_menu->activate_menu();
1575 gui->asset_menu->update();
1576 gui->asset_menu->activate_menu();
1581 result = BC_ListBox::button_release_event();
1586 int AWindowAssets::handle_event()
1588 //printf("AWindowAssets::handle_event 1 %d %d\n", get_buttonpress(), get_selection(0, 0));
1589 if(get_selection(0, 0))
1591 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER)) {}
1592 else if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER)) {}
1593 else if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER)) {}
1594 else if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER)) {}
1595 else if(mwindow->vwindows.size()) {
1596 //printf("AWindowAssets::handle_event 2 %d %d\n", get_buttonpress(), get_selection(0, 0));
1597 mwindow->vwindows.get(DEFAULT_VWINDOW)->gui->lock_window("AWindowAssets::handle_event");
1599 if(((AssetPicon*)get_selection(0, 0))->indexable)
1600 mwindow->vwindows.get(DEFAULT_VWINDOW)->change_source(((AssetPicon*)get_selection(0, 0))->indexable);
1602 if(((AssetPicon*)get_selection(0, 0))->edl)
1603 mwindow->vwindows.get(DEFAULT_VWINDOW)->change_source(((AssetPicon*)get_selection(0, 0))->edl);
1605 mwindow->vwindows.get(DEFAULT_VWINDOW)->gui->unlock_window();
1613 int AWindowAssets::selection_changed()
1615 // Show popup window
1616 if(get_button_down() && get_buttonpress() == 3 && get_selection(0, 0))
1618 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER) ||
1619 !strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER) ||
1620 !strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER) ||
1621 !strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1623 gui->assetlist_menu->update_titles();
1624 gui->assetlist_menu->activate_menu();
1627 if (!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
1629 if(((AssetPicon*)get_selection(0, 0))->label)
1630 gui->label_menu->activate_menu();
1633 BC_ListBox::deactivate_selection();
1636 else if( get_button_down() && get_buttonpress() == 1 && get_selection(0, 0) ) {
1638 if( !gui->vicon_thread->viewing ) {
1639 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1640 vicon = picon->vicon;
1642 gui->vicon_thread->set_view_popup(vicon);
1648 void AWindowAssets::draw_background()
1650 clear_box(0,0,get_w(),get_h(),get_bg_surface());
1651 set_color(BC_WindowBase::get_resources()->audiovideo_color);
1652 set_font(LARGEFONT);
1654 get_text_width(LARGEFONT, mwindow->edl->session->current_folder) - 4,
1656 mwindow->edl->session->current_folder,
1661 int AWindowAssets::drag_start_event()
1663 int collect_pluginservers = 0;
1664 int collect_assets = 0;
1666 if(BC_ListBox::drag_start_event())
1668 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1670 mwindow->session->current_operation = DRAG_AEFFECT;
1671 collect_pluginservers = 1;
1674 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1676 mwindow->session->current_operation = DRAG_VEFFECT;
1677 collect_pluginservers = 1;
1680 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1682 mwindow->session->current_operation = DRAG_ATRANSITION;
1683 collect_pluginservers = 1;
1686 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1688 mwindow->session->current_operation = DRAG_VTRANSITION;
1689 collect_pluginservers = 1;
1692 if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
1698 mwindow->session->current_operation = DRAG_ASSET;
1703 if(collect_pluginservers)
1706 mwindow->session->drag_pluginservers->remove_all();
1709 AssetPicon *result = (AssetPicon*)get_selection(0, i++);
1712 mwindow->session->drag_pluginservers->append(result->plugin);
1718 gui->collect_assets();
1726 int AWindowAssets::drag_motion_event()
1728 BC_ListBox::drag_motion_event();
1731 mwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1732 mwindow->gui->drag_motion();
1733 mwindow->gui->unlock_window();
1735 for(int i = 0; i < mwindow->vwindows.size(); i++)
1737 VWindow *vwindow = mwindow->vwindows.get(i);
1738 vwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1739 vwindow->gui->drag_motion();
1740 vwindow->gui->unlock_window();
1743 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1744 mwindow->cwindow->gui->drag_motion();
1745 mwindow->cwindow->gui->unlock_window();
1747 lock_window("AWindowAssets::drag_motion_event");
1751 int AWindowAssets::drag_stop_event()
1755 result = gui->drag_stop();
1761 mwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1762 result = mwindow->gui->drag_stop();
1763 mwindow->gui->unlock_window();
1768 for(int i = 0; i < mwindow->vwindows.size(); i++)
1770 VWindow *vwindow = mwindow->vwindows.get(i);
1771 vwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1772 result = vwindow->gui->drag_stop();
1773 vwindow->gui->unlock_window();
1779 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1780 result = mwindow->cwindow->gui->drag_stop();
1781 mwindow->cwindow->gui->unlock_window();
1784 lock_window("AWindowAssets::drag_stop_event");
1786 if(result) get_drag_popup()->set_animation(0);
1788 BC_ListBox::drag_stop_event();
1789 mwindow->session->current_operation = ::NO_OPERATION; // since NO_OPERATION is also defined in listbox, we have to reach for global scope...
1793 int AWindowAssets::column_resize_event()
1795 mwindow->edl->session->asset_columns[0] = get_column_width(0);
1796 mwindow->edl->session->asset_columns[1] = get_column_width(1);
1800 int AWindowAssets::focus_in_event()
1802 gui->start_vicon_drawing();
1806 int AWindowAssets::focus_out_event()
1808 gui->stop_vicon_drawing();
1809 return BC_ListBox::focus_out_event();
1823 AWindowNewFolder::AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1824 : BC_Button(x, y, mwindow->theme->newbin_data)
1826 this->mwindow = mwindow;
1828 set_tooltip(_("New bin"));
1831 int AWindowNewFolder::handle_event()
1833 gui->newfolder_thread->start_new_folder();
1837 AWindowDeleteFolder::AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1838 : BC_Button(x, y, mwindow->theme->deletebin_data)
1840 this->mwindow = mwindow;
1842 set_tooltip(_("Delete bin"));
1845 int AWindowDeleteFolder::handle_event()
1847 if(gui->folder_list->get_selection(0, 0))
1849 BC_ListBoxItem *folder = gui->folder_list->get_selection(0, 0);
1850 mwindow->delete_folder(folder->get_text());
1855 AWindowRenameFolder::AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1856 : BC_Button(x, y, mwindow->theme->renamebin_data)
1858 this->mwindow = mwindow;
1860 set_tooltip(_("Rename bin"));
1863 int AWindowRenameFolder::handle_event()
1868 AWindowDeleteDisk::AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1869 : BC_Button(x, y, mwindow->theme->deletedisk_data)
1871 this->mwindow = mwindow;
1873 set_tooltip(_("Delete asset from disk"));
1876 int AWindowDeleteDisk::handle_event()
1881 AWindowDeleteProject::AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1882 : BC_Button(x, y, mwindow->theme->deleteproject_data)
1884 this->mwindow = mwindow;
1886 set_tooltip(_("Delete asset from project"));
1889 int AWindowDeleteProject::handle_event()
1894 AWindowInfo::AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1895 : BC_Button(x, y, mwindow->theme->infoasset_data)
1897 this->mwindow = mwindow;
1899 set_tooltip(_("Edit information on asset"));
1902 int AWindowInfo::handle_event()
1904 gui->awindow->asset_edit->edit_asset(gui->selected_asset());
1908 AWindowRedrawIndex::AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1909 : BC_Button(x, y, mwindow->theme->redrawindex_data)
1911 this->mwindow = mwindow;
1913 set_tooltip(_("Redraw index"));
1916 int AWindowRedrawIndex::handle_event()
1921 AWindowPaste::AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1922 : BC_Button(x, y, mwindow->theme->pasteasset_data)
1924 this->mwindow = mwindow;
1926 set_tooltip(_("Paste asset on recordable tracks"));
1929 int AWindowPaste::handle_event()
1934 AWindowAppend::AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1935 : BC_Button(x, y, mwindow->theme->appendasset_data)
1937 this->mwindow = mwindow;
1939 set_tooltip(_("Append asset in new tracks"));
1942 int AWindowAppend::handle_event()
1947 AWindowView::AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1948 : BC_Button(x, y, mwindow->theme->viewasset_data)
1950 this->mwindow = mwindow;
1952 set_tooltip(_("View asset"));
1955 int AWindowView::handle_event()
1961 LabelPopup::LabelPopup(MWindow *mwindow, AWindowGUI *gui)
1968 this->mwindow = mwindow;
1972 LabelPopup::~LabelPopup()
1976 void LabelPopup::create_objects()
1978 add_item(editlabel = new LabelPopupEdit(mwindow, this));
1981 int LabelPopup::update()
1983 gui->collect_assets();
1989 LabelPopupEdit::LabelPopupEdit(MWindow *mwindow, LabelPopup *popup)
1990 : BC_MenuItem(_("Edit..."))
1992 this->mwindow = mwindow;
1993 this->popup = popup;
1996 LabelPopupEdit::~LabelPopupEdit()
2000 int LabelPopupEdit::handle_event()
2005 AssetPicon *result = (AssetPicon*)mwindow->awindow->gui->asset_list->get_selection(0, i++);
2009 mwindow->awindow->gui->awindow->label_edit->edit_label(result->label);
2017 AddTools::AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, const char *title)
2018 : BC_PopupMenu(x, y, BC_Title::calculate_w(gui, title, MEDIUMFONT)+8, title, -1, 0, 4)
2020 this->mwindow = mwindow;
2024 void AddTools::create_objects()
2027 add_item(new AddPluginItem(this, "ladspa", PLUGIN_LADSPA_ID));
2028 vis |= 1 << PLUGIN_LADSPA_ID;
2029 add_item(new AddPluginItem(this, "ffmpeg", PLUGIN_FFMPEG_ID));
2030 vis |= 1 << PLUGIN_FFMPEG_ID;
2031 for( int i=0; i<MWindow::plugindb->size(); ++i ) {
2032 PluginServer *plugin = MWindow::plugindb->get(i);
2033 if( !plugin->audio && !plugin->video ) continue;
2034 int idx = plugin->dir_idx;
2035 uint32_t msk = 1 << idx;
2036 if( (msk & vis) != 0 ) continue;
2038 char parent[BCTEXTLEN];
2039 strcpy(parent, plugin->path);
2040 char *bp = strrchr(parent, '/');
2041 if( bp ) { *bp = 0; bp = strrchr(parent, '/'); }
2042 if( !bp ) bp = parent; else ++bp;
2043 add_item(new AddPluginItem(this, bp, idx));
2047 AddPluginItem::AddPluginItem(AddTools *menu, char const *text, int idx)
2052 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
2053 int chk = (msk & vis) ? 1 : 0;
2057 int AddPluginItem::handle_event()
2059 int chk = get_checked() ^ 1;
2061 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
2062 menu->gui->plugin_visibility = chk ? vis | msk : vis & ~msk;
2063 menu->gui->update_effects();
2064 menu->gui->save_defaults(menu->mwindow->defaults);
2065 menu->gui->async_update_assets();
2069 AVIconDrawing::AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images)
2070 : BC_Toggle(x, y, images, agui->vicon_drawing)
2073 set_tooltip(_("draw vicons"));
2076 void AVIconDrawing::calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh)
2078 int text_line = -1, toggle_x = -1, toggle_y = -1;
2079 int text_x = -1, text_y = -1, text_w = -1, text_h = -1;
2080 BC_Toggle::calculate_extents(agui, images, 1,
2081 &text_line, ww, hh, &toggle_x, &toggle_y,
2082 &text_x, &text_y, &text_w, &text_h, "", MEDIUMFONT);
2085 AVIconDrawing::~AVIconDrawing()
2089 int AVIconDrawing::handle_event()
2091 agui->vicon_drawing = get_value();
2092 if( agui->vicon_drawing )
2093 agui->start_vicon_drawing();
2095 agui->stop_vicon_drawing();