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, this, AEFFECT_FOLDER));
540 picon->persistent = 1;
541 folders.append(picon = new AssetPicon(mwindow, this, VEFFECT_FOLDER));
542 picon->persistent = 1;
543 folders.append(picon = new AssetPicon(mwindow, this, ATRANSITION_FOLDER));
544 picon->persistent = 1;
545 folders.append(picon = new AssetPicon(mwindow, this, VTRANSITION_FOLDER));
546 picon->persistent = 1;
547 folders.append(picon = new AssetPicon(mwindow, this, LABEL_FOLDER));
548 picon->persistent = 1;
549 folders.append(picon = new AssetPicon(mwindow, this, CLIP_FOLDER));
550 picon->persistent = 1;
551 folders.append(picon = new AssetPicon(mwindow, this, MEDIA_FOLDER));
552 picon->persistent = 1;
554 create_label_folder();
557 mwindow->theme->get_awindow_sizes(this);
558 load_defaults(mwindow->defaults);
561 add_subwindow(asset_list = new AWindowAssets(mwindow,
563 mwindow->theme->alist_x,
564 mwindow->theme->alist_y,
565 mwindow->theme->alist_w,
566 mwindow->theme->alist_h));
568 vicon_thread = new VIconThread(asset_list);
569 vicon_thread->start();
572 add_subwindow(divider = new AWindowDivider(mwindow,
574 mwindow->theme->adivider_x,
575 mwindow->theme->adivider_y,
576 mwindow->theme->adivider_w,
577 mwindow->theme->adivider_h));
580 divider->set_cursor(HSEPARATE_CURSOR, 0, 0);
583 int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y;
584 int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h;
585 VFrame **images = mwindow->theme->get_image_set("playpatch_data");
586 AVIconDrawing::calculate_geometry(this, images, &avicon_w, &avicon_h);
587 add_subwindow(avicon_drawing = new AVIconDrawing(this, fw-avicon_w, fy, images));
588 add_subwindow(add_tools = new AddTools(mwindow, this, fx, fy, _("Visibility")));
589 add_tools->create_objects();
590 fy += add_tools->get_h(); fh -= add_tools->get_h();
592 add_subwindow(folder_list = new AWindowFolders(mwindow,
593 this, fx, fy, fw, fh));
598 //int x = mwindow->theme->abuttons_x;
599 //int y = mwindow->theme->abuttons_y;
603 newfolder_thread = new NewFolderThread(mwindow, this);
605 add_subwindow(asset_menu = new AssetPopup(mwindow, this));
606 asset_menu->create_objects();
608 add_subwindow(label_menu = new LabelPopup(mwindow, this));
609 label_menu->create_objects();
613 add_subwindow(assetlist_menu = new AssetListMenu(mwindow, this));
616 assetlist_menu->create_objects();
620 add_subwindow(folderlist_menu = new FolderListMenu(mwindow, this));
621 folderlist_menu->create_objects();
622 //printf("AWindowGUI::create_objects 2\n");
625 create_custom_xatoms();
629 int AWindowGUI::resize_event(int w, int h)
631 mwindow->session->awindow_x = get_x();
632 mwindow->session->awindow_y = get_y();
633 mwindow->session->awindow_w = w;
634 mwindow->session->awindow_h = h;
636 mwindow->theme->get_awindow_sizes(this);
637 mwindow->theme->draw_awindow_bg(this);
638 reposition_objects();
640 // int x = mwindow->theme->abuttons_x;
641 // int y = mwindow->theme->abuttons_y;
642 // new_bin->reposition_window(x, y);
643 // x += new_bin->get_w();
644 // delete_bin->reposition_window(x, y);
645 // x += delete_bin->get_w();
646 // rename_bin->reposition_window(x, y);
647 // x += rename_bin->get_w();
648 // delete_disk->reposition_window(x, y);
649 // x += delete_disk->get_w();
650 // delete_project->reposition_window(x, y);
651 // x += delete_project->get_w();
652 // info->reposition_window(x, y);
653 // x += info->get_w();
654 // redraw_index->reposition_window(x, y);
655 // x += redraw_index->get_w();
656 // paste->reposition_window(x, y);
657 // x += paste->get_w();
658 // append->reposition_window(x, y);
659 // x += append->get_w();
660 // view->reposition_window(x, y);
662 BC_WindowBase::resize_event(w, h);
666 int AWindowGUI::translation_event()
668 mwindow->session->awindow_x = get_x();
669 mwindow->session->awindow_y = get_y();
673 void AWindowGUI::reposition_objects()
675 asset_list->reposition_window(
676 mwindow->theme->alist_x, mwindow->theme->alist_y,
677 mwindow->theme->alist_w, mwindow->theme->alist_h);
678 divider->reposition_window(
679 mwindow->theme->adivider_x, mwindow->theme->adivider_y,
680 mwindow->theme->adivider_w, mwindow->theme->adivider_h);
681 int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y;
682 int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h;
683 add_tools->resize_event(fw-avicon_w, add_tools->get_h());
684 avicon_drawing->reposition_window(fw-avicon_w, fy);
685 fy += add_tools->get_h(); fh -= add_tools->get_h();
686 folder_list->reposition_window(fx, fy, fw, fh);
689 int AWindowGUI::save_defaults(BC_Hash *defaults)
691 defaults->update("PLUGIN_VISIBILTY", plugin_visibility);
692 defaults->update("VICON_DRAWING", vicon_drawing);
696 int AWindowGUI::load_defaults(BC_Hash *defaults)
698 plugin_visibility = defaults->get("PLUGIN_VISIBILTY", plugin_visibility);
699 vicon_drawing = defaults->get("VICON_DRAWING", vicon_drawing);
703 int AWindowGUI::close_event()
706 mwindow->session->show_awindow = 0;
709 mwindow->gui->lock_window("AWindowGUI::close_event");
710 mwindow->gui->mainmenu->show_awindow->set_checked(0);
711 mwindow->gui->unlock_window();
713 lock_window("AWindowGUI::close_event");
714 save_defaults(mwindow->defaults);
715 mwindow->save_defaults();
719 void AWindowGUI::start_vicon_drawing()
721 if( !vicon_drawing ) return;
722 if( strcmp(mwindow->edl->session->current_folder, MEDIA_FOLDER) ) return;
723 if( mwindow->edl->session->assetlist_format != ASSETS_ICONS ) return;
724 vicon_thread->start_drawing();
727 void AWindowGUI::stop_vicon_drawing()
729 vicon_thread->stop_drawing();
732 AWindowRemovePluginGUI::
733 AWindowRemovePluginGUI(AWindow *awindow, AWindowRemovePlugin *thread,
734 int x, int y, PluginServer *plugin)
735 : BC_Window(_(PROGRAM_NAME ": Remove plugin"), x,y, 500,200, 50, 50, 1, 0, 1, -1, "", 1)
737 this->awindow = awindow;
738 this->thread = thread;
739 this->plugin = plugin;
740 VFrame *vframe = plugin->get_picon();
741 icon = vframe ? create_pixmap(vframe) : 0;
742 plugin_list.append(new BC_ListBoxItem(plugin->title, icon));
745 AWindowRemovePluginGUI::
746 ~AWindowRemovePluginGUI()
748 if( !awindow->gui->protected_pixmap(icon) )
750 plugin_list.remove_all();
753 void AWindowRemovePluginGUI::create_objects()
755 BC_Button *ok_button = new BC_OKButton(this);
756 add_subwindow(ok_button);
757 BC_Button *cancel_button = new BC_CancelButton(this);
758 add_subwindow(cancel_button);
760 BC_Title *title = new BC_Title(x, y, _("remove plugin?"));
761 add_subwindow(title);
762 y += title->get_h() + 5;
763 list = new BC_ListBox(x, y,
764 get_w() - 20, ok_button->get_y() - y - 5, LISTBOX_TEXT, &plugin_list,
765 0, 0, 1, 0, 0, LISTBOX_SINGLE, ICON_LEFT, 0);
770 int AWindowRemovePlugin::remove_plugin(PluginServer *plugin, ArrayList<BC_ListBoxItem*> &folder)
773 for( int i=0; i<folder.size(); ) {
774 AssetPicon *picon = (AssetPicon *)folder[i];
775 if( picon->plugin == plugin ) {
776 folder.remove_object_number(i);
785 void AWindowRemovePlugin::handle_close_event(int result)
788 printf(_("remove %s\n"), plugin->path);
789 ArrayList<BC_ListBoxItem*> *folder =
790 plugin->audio ? plugin->transition ?
791 &awindow->gui->atransitions :
792 &awindow->gui->aeffects :
793 plugin->video ? plugin->transition ?
794 &awindow->gui->vtransitions :
795 &awindow->gui->veffects :
797 if( folder ) remove_plugin(plugin, *folder);
798 char plugin_path[BCTEXTLEN];
799 strcpy(plugin_path, plugin->path);
800 MWindow *mwindow = awindow->mwindow;
801 mwindow->plugindb->remove(plugin);
803 char index_path[BCTEXTLEN];
804 sprintf(index_path, "%s/%s", mwindow->preferences->plugin_dir, PLUGIN_FILE);
806 char png_path[BCTEXTLEN];
807 if( plugin->get_theme_png_path(png_path, mwindow->preferences->theme) )
809 if( plugin->get_theme_png_path(png_path, "picon") )
811 delete plugin; plugin = 0;
812 awindow->gui->async_update_assets();
816 AWindowRemovePlugin::
817 AWindowRemovePlugin(AWindow *awindow, PluginServer *plugin)
820 this->awindow = awindow;
821 this->plugin = plugin;
824 AWindowRemovePlugin::
825 ~AWindowRemovePlugin()
830 BC_Window* AWindowRemovePlugin::new_gui()
832 int x = awindow->gui->get_abs_cursor_x(0);
833 int y = awindow->gui->get_abs_cursor_y(0);
834 AWindowRemovePluginGUI *gui = new AWindowRemovePluginGUI(awindow, this, x, y, plugin);
835 gui->create_objects();
839 int AWindowGUI::keypress_event()
841 switch(get_keypress()) {
850 PluginServer* plugin = selected_plugin();
852 remove_plugin = new AWindowRemovePlugin(awindow, plugin);
854 remove_plugin->start();
863 int AWindowGUI::create_custom_xatoms()
865 UpdateAssetsXAtom = create_xatom("CWINDOWGUI_UPDATE_ASSETS");
868 int AWindowGUI::recieve_custom_xatoms(xatom_event *event)
870 if( event->message_type == UpdateAssetsXAtom ) {
877 void AWindowGUI::async_update_assets()
880 event.message_type = UpdateAssetsXAtom;
881 send_custom_xatom(&event);
890 void AWindowGUI::update_folder_list()
892 stop_vicon_drawing();
893 //printf("AWindowGUI::update_folder_list 1\n");
894 for(int i = 0; i < folders.total; i++)
896 AssetPicon *picon = (AssetPicon*)folders.values[i];
899 //printf("AWindowGUI::update_folder_list 1\n");
901 // Search assets for folders
902 for(int i = 0; i < mwindow->edl->folders.total; i++)
904 char *folder = mwindow->edl->folders.values[i];
906 //printf("AWindowGUI::update_folder_list 1.1\n");
908 for(int j = 0; j < folders.total; j++)
910 AssetPicon *picon = (AssetPicon*)folders.values[j];
911 if(!strcasecmp(picon->get_text(), folder))
921 AssetPicon *picon = new AssetPicon(mwindow, this, folder);
922 picon->create_objects();
923 folders.append(picon);
925 //printf("AWindowGUI::update_folder_list 1.3\n");
927 //printf("AWindowGUI::update_folder_list 1\n");
928 //for(int i = 0; i < folders.total; i++)
929 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
932 for(int i = folders.total - 1; i >= 0; i--)
934 AssetPicon *picon = (AssetPicon*)folders.values[i];
935 if(!picon->in_use && !picon->persistent)
938 folders.remove_number(i);
941 //for(int i = 0; i < folders.total; i++)
942 // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text());
943 //printf("AWindowGUI::update_folder_list 2\n");
944 start_vicon_drawing();
947 void AWindowGUI::create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
948 int do_audio, int do_video, int is_realtime, int is_transition)
950 ArrayList<PluginServer*> plugin_list;
951 // Get pointers to plugindb entries
952 mwindow->search_plugindb(do_audio, do_video, is_realtime, is_transition,
955 for(int i = 0; i < plugin_list.total; i++) {
956 PluginServer *server = plugin_list.values[i];
957 int visible = plugin_visibility & (1<<server->dir_idx);
958 if(!visible) continue;
959 // Create new listitem
960 AssetPicon *picon = new AssetPicon(mwindow, this, server);
961 picon->create_objects();
962 output->append(picon);
966 void AWindowGUI::create_label_folder()
969 for(current = mwindow->edl->labels->first; current; current = NEXT) {
970 AssetPicon *picon = new AssetPicon(mwindow, this, current);
971 picon->create_objects();
972 labellist.append(picon);
977 void AWindowGUI::update_asset_list()
979 //printf("AWindowGUI::update_asset_list 1\n");
980 for(int i = 0; i < assets.total; i++)
982 AssetPicon *picon = (AssetPicon*)assets.values[i];
990 //printf("AWindowGUI::update_asset_list 2\n");
993 // Synchronize EDL clips
994 for(int i = 0; i < mwindow->edl->clips.total; i++)
998 // Look for clip in existing listitems
999 for(int j = 0; j < assets.total && !exists; j++)
1001 AssetPicon *picon = (AssetPicon*)assets.values[j];
1003 if(picon->id == mwindow->edl->clips.values[i]->id)
1005 picon->edl = mwindow->edl->clips.values[i];
1006 picon->set_text(mwindow->edl->clips.values[i]->local_session->clip_title);
1012 // Create new listitem
1015 AssetPicon *picon = new AssetPicon(mwindow,
1017 mwindow->edl->clips.values[i]);
1018 picon->create_objects();
1019 assets.append(picon);
1027 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1030 // Synchronize EDL assets
1031 for(Asset *current = mwindow->edl->assets->first;
1037 // Look for asset in existing listitems
1038 for(int j = 0; j < assets.total && !exists; j++)
1040 AssetPicon *picon = (AssetPicon*)assets.values[j];
1042 if(picon->id == current->id)
1044 picon->indexable = current;
1051 // Create new listitem
1054 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1055 AssetPicon *picon = new AssetPicon(mwindow, this, current);
1056 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1057 picon->create_objects();
1058 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1059 assets.append(picon);
1065 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1068 // Synchronize nested EDLs
1069 for(int i = 0; i < mwindow->edl->nested_edls->size(); i++)
1072 Indexable *indexable = mwindow->edl->nested_edls->get(i);
1074 // Look for asset in existing listitems
1075 for(int j = 0; j < assets.total && !exists; j++)
1077 AssetPicon *picon = (AssetPicon*)assets.values[j];
1079 if(picon->id == indexable->id)
1081 picon->indexable = indexable;
1088 // Create new listitem
1091 AssetPicon *picon = new AssetPicon(mwindow,
1094 picon->create_objects();
1095 assets.append(picon);
1107 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
1108 for(int i = assets.size() - 1; i >= 0; i--)
1110 AssetPicon *picon = (AssetPicon*)assets.get(i);
1111 //printf("AWindowGUI::update_asset_list %s %d\n", picon->asset->path, picon->in_use);
1115 assets.remove_number(i);
1118 //printf("AWindowGUI::update_asset_list 7 %d\n", assets.total);
1125 void AWindowGUI::sort_assets()
1127 //printf("AWindowGUI::sort_assets 1 %s\n", mwindow->edl->session->current_folder);
1128 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1129 sort_picons(&aeffects,
1132 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1133 sort_picons(&veffects,
1136 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1137 sort_picons(&atransitions,
1140 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1141 sort_picons(&vtransitions,
1144 if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
1145 ;// Labels should ALWAYS be sorted by time.
1147 sort_picons(&assets,
1148 mwindow->edl->session->current_folder);
1163 void AWindowGUI::collect_assets()
1166 mwindow->session->drag_assets->remove_all();
1167 mwindow->session->drag_clips->remove_all();
1170 AssetPicon *result = (AssetPicon*)asset_list->get_selection(0, i++);
1173 if(result->indexable) mwindow->session->drag_assets->append(result->indexable);
1174 if(result->edl) mwindow->session->drag_clips->append(result->edl);
1178 void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst,
1179 ArrayList<BC_ListBoxItem*> *src,
1182 // Remove current pointers
1183 dst[0].remove_all();
1184 dst[1].remove_all_objects();
1186 // Create new pointers
1187 //if(folder) printf("AWindowGUI::copy_picons 1 %s\n", folder);
1188 for(int i = 0; i < src->total; i++)
1190 AssetPicon *picon = (AssetPicon*)src->values[i];
1191 //printf("AWindowGUI::copy_picons 2 %s\n", picon->asset->folder);
1193 (folder && picon->indexable && !strcasecmp(picon->indexable->folder, folder)) ||
1194 (folder && picon->edl && !strcasecmp(picon->edl->local_session->folder, folder)))
1196 BC_ListBoxItem *item2, *item1;
1197 dst[0].append(item1 = picon);
1199 dst[1].append(item2 = new BC_ListBoxItem(picon->edl->local_session->clip_notes));
1201 if(picon->label && picon->label->textstr)
1202 dst[1].append(item2 = new BC_ListBoxItem(picon->label->textstr));
1204 dst[1].append(item2 = new BC_ListBoxItem(""));
1205 item1->set_autoplace_text(1);
1206 item2->set_autoplace_text(1);
1207 //printf("AWindowGUI::copy_picons 3 %s\n", picon->get_text());
1212 void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src,
1215 //printf("AWindowGUI::sort_picons 1\n")
1220 for(int i = 0; i < src->total - 1; i++)
1222 BC_ListBoxItem *item1 = src->values[i];
1223 BC_ListBoxItem *item2 = src->values[i + 1];
1224 item1->set_autoplace_icon(1);
1225 item2->set_autoplace_icon(1);
1226 item1->set_autoplace_text(1);
1227 item2->set_autoplace_text(1);
1228 if(strcmp(item1->get_text(), item2->get_text()) > 0)
1230 src->values[i + 1] = item1;
1231 src->values[i] = item2;
1239 void AWindowGUI::filter_displayed_assets()
1241 allow_iconlisting = 1;
1242 asset_titles[0] = _("Title");
1243 asset_titles[1] = _("Comments");
1244 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1245 copy_picons(displayed_assets,
1249 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1250 copy_picons(displayed_assets,
1254 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1255 copy_picons(displayed_assets,
1259 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1260 copy_picons(displayed_assets,
1264 if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER)) {
1265 copy_picons(displayed_assets,
1268 asset_titles[0] = _("Time Stamps");
1269 asset_titles[1] = _("Title");
1270 allow_iconlisting = 0;
1273 copy_picons(displayed_assets,
1275 mwindow->edl->session->current_folder);
1276 // Ensure the current folder icon is highlighted
1277 for(int i = 0; i < folders.total; i++)
1279 if(!strcasecmp(mwindow->edl->session->current_folder, folders.values[i]->get_text()))
1280 folders.values[i]->set_selected(1);
1282 folders.values[i]->set_selected(0);
1287 void AWindowGUI::update_assets()
1289 //printf("AWindowGUI::update_assets 1\n");
1290 update_folder_list();
1291 //printf("AWindowGUI::update_assets 2\n");
1292 update_asset_list();
1293 labellist.remove_all_objects();
1294 create_label_folder();
1295 //printf("AWindowGUI::update_assets 3\n");
1296 filter_displayed_assets();
1298 //for(int i = 0; i < folders.total; i++)
1299 //printf("AWindowGUI::update_assets 4\n");
1300 // printf("AWindowGUI::update_assets %s\n", folders.values[i]->get_text());
1301 if(mwindow->edl->session->folderlist_format != folder_list->get_format())
1302 folder_list->update_format(mwindow->edl->session->folderlist_format, 0);
1303 folder_list->update(&folders,
1307 folder_list->get_xposition(),
1308 folder_list->get_yposition(),
1310 //printf("AWindowGUI::update_assets 5\n");
1312 if(mwindow->edl->session->assetlist_format != asset_list->get_format())
1313 asset_list->update_format(mwindow->edl->session->assetlist_format, 0);
1316 //printf("AWindowGUI::update_assets 6 %d\n", displayed_assets[0].total);
1317 asset_list->update(displayed_assets,
1319 mwindow->edl->session->asset_columns,
1321 asset_list->get_xposition(),
1322 asset_list->get_yposition(),
1325 asset_list->center_selection();
1326 //printf("AWindowGUI::update_assets 7\n");
1329 //printf("AWindowGUI::update_assets 8\n");
1333 void AWindowGUI::update_effects()
1335 aeffects.remove_all_objects();
1336 create_persistent_folder(&aeffects, 1, 0, 1, 0);
1337 veffects.remove_all_objects();
1338 create_persistent_folder(&veffects, 0, 1, 1, 0);
1339 atransitions.remove_all_objects();
1340 create_persistent_folder(&atransitions, 1, 0, 0, 1);
1341 vtransitions.remove_all_objects();
1342 create_persistent_folder(&vtransitions, 0, 1, 0, 1);
1345 int AWindowGUI::current_folder_number()
1348 for(int i = 0; i < folders.total; i++)
1350 if(!strcasecmp(folders.values[i]->get_text(), mwindow->edl->session->current_folder))
1359 int AWindowGUI::drag_motion()
1361 if(get_hidden()) return 0;
1367 int AWindowGUI::drag_stop()
1369 if(get_hidden()) return 0;
1374 Indexable* AWindowGUI::selected_asset()
1376 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1377 return picon ? picon->indexable : 0;
1380 PluginServer* AWindowGUI::selected_plugin()
1382 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1383 return picon ? picon->plugin : 0;
1386 AssetPicon* AWindowGUI::selected_folder()
1388 AssetPicon *picon = (AssetPicon*)folder_list->get_selection(0, 0);
1399 AWindowDivider::AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1400 : BC_SubWindow(x, y, w, h)
1402 this->mwindow = mwindow;
1405 AWindowDivider::~AWindowDivider()
1409 int AWindowDivider::button_press_event()
1411 if(is_event_win() && cursor_inside())
1413 mwindow->session->current_operation = DRAG_PARTITION;
1419 int AWindowDivider::cursor_motion_event()
1421 if(mwindow->session->current_operation == DRAG_PARTITION)
1424 int wmax = mwindow->session->awindow_w - mwindow->theme->adivider_w - wmin;
1425 int fw = gui->get_relative_cursor_x();
1426 if( fw > wmax ) fw = wmax;
1427 if( fw < wmin ) fw = wmin;
1428 mwindow->session->afolders_w = fw;
1429 mwindow->theme->get_awindow_sizes(gui);
1430 gui->reposition_objects();
1436 int AWindowDivider::button_release_event()
1438 if(mwindow->session->current_operation == DRAG_PARTITION)
1440 mwindow->session->current_operation = NO_OPERATION;
1451 AWindowFolders::AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1456 mwindow->edl->session->folderlist_format == ASSETS_ICONS ?
1457 LISTBOX_ICONS : LISTBOX_TEXT,
1458 &gui->folders, // Each column has an ArrayList of BC_ListBoxItems.
1459 0, // Titles for columns. Set to 0 for no titles
1460 0, // width of each column
1461 1, // Total columns.
1462 0, // Pixel of top of window.
1463 0, // If this listbox is a popup window
1464 LISTBOX_SINGLE, // Select one item or multiple items
1465 ICON_TOP, // Position of icon relative to text of each item
1468 this->mwindow = mwindow;
1473 AWindowFolders::~AWindowFolders()
1477 int AWindowFolders::selection_changed()
1479 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1482 gui->stop_vicon_drawing();
1484 if(get_button_down() && get_buttonpress() == 3)
1486 gui->folderlist_menu->update_titles();
1487 gui->folderlist_menu->activate_menu();
1490 strcpy(mwindow->edl->session->current_folder, picon->get_text());
1491 //printf("AWindowFolders::selection_changed 1\n");
1492 gui->asset_list->draw_background();
1493 gui->async_update_assets();
1495 gui->start_vicon_drawing();
1500 int AWindowFolders::button_press_event()
1504 result = BC_ListBox::button_press_event();
1508 if(get_buttonpress() == 3 && is_event_win() && cursor_inside())
1510 gui->folderlist_menu->update_titles();
1511 gui->folderlist_menu->activate_menu();
1526 AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1531 (mwindow->edl->session->assetlist_format == ASSETS_ICONS && gui->allow_iconlisting ) ?
1532 LISTBOX_ICONS : LISTBOX_TEXT,
1533 &gui->assets, // Each column has an ArrayList of BC_ListBoxItems.
1534 gui->asset_titles, // Titles for columns. Set to 0 for no titles
1535 mwindow->edl->session->asset_columns, // width of each column
1536 1, // Total columns.
1537 0, // Pixel of top of window.
1538 0, // If this listbox is a popup window
1539 LISTBOX_MULTIPLE, // Select one item or multiple items
1540 ICON_TOP, // Position of icon relative to text of each item
1543 this->mwindow = mwindow;
1548 AWindowAssets::~AWindowAssets()
1552 int AWindowAssets::button_press_event()
1556 result = BC_ListBox::button_press_event();
1558 if(!result && get_buttonpress() == 3 && is_event_win() && cursor_inside())
1560 BC_ListBox::deactivate_selection();
1561 gui->assetlist_menu->update_titles();
1562 gui->assetlist_menu->activate_menu();
1571 int AWindowAssets::handle_event()
1573 //printf("AWindowAssets::handle_event 1 %d %d\n", get_buttonpress(), get_selection(0, 0));
1574 AssetPicon *asset_picon = (AssetPicon *)get_selection(0, 0);
1575 if( !asset_picon ) return 0;
1576 const char *folder = mwindow->edl->session->current_folder;
1577 if( !strcasecmp(folder, AEFFECT_FOLDER) ) return 1;
1578 if( !strcasecmp(folder, VEFFECT_FOLDER) ) return 1;
1579 if( !strcasecmp(folder, ATRANSITION_FOLDER) ) return 1;
1580 if( !strcasecmp(folder, VTRANSITION_FOLDER) ) return 1;
1581 VWindow *vwindow = mwindow->vwindows.size() > DEFAULT_VWINDOW ?
1582 mwindow->vwindows.get(DEFAULT_VWINDOW) : 0;
1583 if( !vwindow || !vwindow->is_running() ) return 1;
1584 //printf("AWindowAssets::handle_event 2 %d %d\n", get_buttonpress(), get_selection(0, 0));
1586 vwindow->gui->lock_window("AWindowAssets::handle_event");
1587 if( asset_picon->indexable )
1588 vwindow->change_source(asset_picon->indexable);
1589 else if( asset_picon->edl )
1590 vwindow->change_source(asset_picon->edl);
1591 vwindow->gui->unlock_window();
1595 int AWindowAssets::selection_changed()
1597 // Show popup window
1598 if(get_button_down() && get_buttonpress() == 3 && get_selection(0, 0))
1600 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER) ||
1601 !strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER) ||
1602 !strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER) ||
1603 !strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1605 gui->assetlist_menu->update_titles();
1606 gui->assetlist_menu->activate_menu();
1609 if (!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
1611 if(((AssetPicon*)get_selection(0, 0))->label)
1612 gui->label_menu->activate_menu();
1616 if(((AssetPicon*)get_selection(0, 0))->indexable)
1617 gui->asset_menu->update();
1619 if(((AssetPicon*)get_selection(0, 0))->edl)
1620 gui->asset_menu->update();
1624 gui->asset_menu->activate_menu();
1627 BC_ListBox::deactivate_selection();
1630 else if( get_button_down() && get_buttonpress() == 1 && get_selection(0, 0) ) {
1632 if( !gui->vicon_thread->viewing ) {
1633 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1634 vicon = picon->vicon;
1636 gui->vicon_thread->set_view_popup(vicon);
1642 void AWindowAssets::draw_background()
1644 clear_box(0,0,get_w(),get_h(),get_bg_surface());
1645 set_color(BC_WindowBase::get_resources()->audiovideo_color);
1646 set_font(LARGEFONT);
1648 get_text_width(LARGEFONT, mwindow->edl->session->current_folder) - 4,
1650 mwindow->edl->session->current_folder,
1655 int AWindowAssets::drag_start_event()
1657 int collect_pluginservers = 0;
1658 int collect_assets = 0;
1660 if(BC_ListBox::drag_start_event())
1662 if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER))
1664 mwindow->session->current_operation = DRAG_AEFFECT;
1665 collect_pluginservers = 1;
1668 if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER))
1670 mwindow->session->current_operation = DRAG_VEFFECT;
1671 collect_pluginservers = 1;
1674 if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER))
1676 mwindow->session->current_operation = DRAG_ATRANSITION;
1677 collect_pluginservers = 1;
1680 if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
1682 mwindow->session->current_operation = DRAG_VTRANSITION;
1683 collect_pluginservers = 1;
1686 if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
1692 mwindow->session->current_operation = DRAG_ASSET;
1697 if(collect_pluginservers)
1700 mwindow->session->drag_pluginservers->remove_all();
1703 AssetPicon *result = (AssetPicon*)get_selection(0, i++);
1706 mwindow->session->drag_pluginservers->append(result->plugin);
1712 gui->collect_assets();
1720 int AWindowAssets::drag_motion_event()
1722 BC_ListBox::drag_motion_event();
1725 mwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1726 mwindow->gui->drag_motion();
1727 mwindow->gui->unlock_window();
1729 for(int i = 0; i < mwindow->vwindows.size(); i++)
1731 VWindow *vwindow = mwindow->vwindows.get(i);
1732 if( !vwindow->is_running() ) continue;
1733 vwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1734 vwindow->gui->drag_motion();
1735 vwindow->gui->unlock_window();
1738 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1739 mwindow->cwindow->gui->drag_motion();
1740 mwindow->cwindow->gui->unlock_window();
1742 lock_window("AWindowAssets::drag_motion_event");
1746 int AWindowAssets::drag_stop_event()
1750 result = gui->drag_stop();
1756 mwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1757 result = mwindow->gui->drag_stop();
1758 mwindow->gui->unlock_window();
1763 for(int i = 0; i < mwindow->vwindows.size(); i++)
1765 VWindow *vwindow = mwindow->vwindows.get(i);
1766 if( !vwindow->is_running() ) continue;
1767 vwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1768 result = vwindow->gui->drag_stop();
1769 vwindow->gui->unlock_window();
1775 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1776 result = mwindow->cwindow->gui->drag_stop();
1777 mwindow->cwindow->gui->unlock_window();
1780 lock_window("AWindowAssets::drag_stop_event");
1782 if(result) get_drag_popup()->set_animation(0);
1784 BC_ListBox::drag_stop_event();
1785 mwindow->session->current_operation = ::NO_OPERATION; // since NO_OPERATION is also defined in listbox, we have to reach for global scope...
1789 int AWindowAssets::column_resize_event()
1791 mwindow->edl->session->asset_columns[0] = get_column_width(0);
1792 mwindow->edl->session->asset_columns[1] = get_column_width(1);
1796 int AWindowAssets::focus_in_event()
1798 gui->start_vicon_drawing();
1802 int AWindowAssets::focus_out_event()
1804 gui->stop_vicon_drawing();
1805 return BC_ListBox::focus_out_event();
1819 AWindowNewFolder::AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1820 : BC_Button(x, y, mwindow->theme->newbin_data)
1822 this->mwindow = mwindow;
1824 set_tooltip(_("New bin"));
1827 int AWindowNewFolder::handle_event()
1829 gui->newfolder_thread->start_new_folder();
1833 AWindowDeleteFolder::AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1834 : BC_Button(x, y, mwindow->theme->deletebin_data)
1836 this->mwindow = mwindow;
1838 set_tooltip(_("Delete bin"));
1841 int AWindowDeleteFolder::handle_event()
1843 if(gui->folder_list->get_selection(0, 0))
1845 BC_ListBoxItem *folder = gui->folder_list->get_selection(0, 0);
1846 mwindow->delete_folder(folder->get_text());
1851 AWindowRenameFolder::AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1852 : BC_Button(x, y, mwindow->theme->renamebin_data)
1854 this->mwindow = mwindow;
1856 set_tooltip(_("Rename bin"));
1859 int AWindowRenameFolder::handle_event()
1864 AWindowDeleteDisk::AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1865 : BC_Button(x, y, mwindow->theme->deletedisk_data)
1867 this->mwindow = mwindow;
1869 set_tooltip(_("Delete asset from disk"));
1872 int AWindowDeleteDisk::handle_event()
1877 AWindowDeleteProject::AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1878 : BC_Button(x, y, mwindow->theme->deleteproject_data)
1880 this->mwindow = mwindow;
1882 set_tooltip(_("Delete asset from project"));
1885 int AWindowDeleteProject::handle_event()
1890 AWindowInfo::AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1891 : BC_Button(x, y, mwindow->theme->infoasset_data)
1893 this->mwindow = mwindow;
1895 set_tooltip(_("Edit information on asset"));
1898 int AWindowInfo::handle_event()
1900 gui->awindow->asset_edit->edit_asset(gui->selected_asset());
1904 AWindowRedrawIndex::AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1905 : BC_Button(x, y, mwindow->theme->redrawindex_data)
1907 this->mwindow = mwindow;
1909 set_tooltip(_("Redraw index"));
1912 int AWindowRedrawIndex::handle_event()
1917 AWindowPaste::AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1918 : BC_Button(x, y, mwindow->theme->pasteasset_data)
1920 this->mwindow = mwindow;
1922 set_tooltip(_("Paste asset on recordable tracks"));
1925 int AWindowPaste::handle_event()
1930 AWindowAppend::AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1931 : BC_Button(x, y, mwindow->theme->appendasset_data)
1933 this->mwindow = mwindow;
1935 set_tooltip(_("Append asset in new tracks"));
1938 int AWindowAppend::handle_event()
1943 AWindowView::AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y)
1944 : BC_Button(x, y, mwindow->theme->viewasset_data)
1946 this->mwindow = mwindow;
1948 set_tooltip(_("View asset"));
1951 int AWindowView::handle_event()
1957 LabelPopup::LabelPopup(MWindow *mwindow, AWindowGUI *gui)
1964 this->mwindow = mwindow;
1968 LabelPopup::~LabelPopup()
1972 void LabelPopup::create_objects()
1974 add_item(editlabel = new LabelPopupEdit(mwindow, this));
1977 int LabelPopup::update()
1979 gui->collect_assets();
1985 LabelPopupEdit::LabelPopupEdit(MWindow *mwindow, LabelPopup *popup)
1986 : BC_MenuItem(_("Edit..."))
1988 this->mwindow = mwindow;
1989 this->popup = popup;
1992 LabelPopupEdit::~LabelPopupEdit()
1996 int LabelPopupEdit::handle_event()
2001 AssetPicon *result = (AssetPicon*)mwindow->awindow->gui->asset_list->get_selection(0, i++);
2005 mwindow->awindow->gui->awindow->label_edit->edit_label(result->label);
2013 AddTools::AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, const char *title)
2014 : BC_PopupMenu(x, y, BC_Title::calculate_w(gui, title, MEDIUMFONT)+8, title, -1, 0, 4)
2016 this->mwindow = mwindow;
2020 void AddTools::create_objects()
2023 add_item(new AddPluginItem(this, "ladspa", PLUGIN_LADSPA_ID));
2024 vis |= 1 << PLUGIN_LADSPA_ID;
2025 add_item(new AddPluginItem(this, "ffmpeg", PLUGIN_FFMPEG_ID));
2026 vis |= 1 << PLUGIN_FFMPEG_ID;
2027 for( int i=0; i<MWindow::plugindb->size(); ++i ) {
2028 PluginServer *plugin = MWindow::plugindb->get(i);
2029 if( !plugin->audio && !plugin->video ) continue;
2030 int idx = plugin->dir_idx;
2031 uint32_t msk = 1 << idx;
2032 if( (msk & vis) != 0 ) continue;
2034 char parent[BCTEXTLEN];
2035 strcpy(parent, plugin->path);
2036 char *bp = strrchr(parent, '/');
2037 if( bp ) { *bp = 0; bp = strrchr(parent, '/'); }
2038 if( !bp ) bp = parent; else ++bp;
2039 add_item(new AddPluginItem(this, bp, idx));
2043 AddPluginItem::AddPluginItem(AddTools *menu, char const *text, int idx)
2048 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
2049 int chk = (msk & vis) ? 1 : 0;
2053 int AddPluginItem::handle_event()
2055 int chk = get_checked() ^ 1;
2057 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
2058 menu->gui->plugin_visibility = chk ? vis | msk : vis & ~msk;
2059 menu->gui->update_effects();
2060 menu->gui->save_defaults(menu->mwindow->defaults);
2061 menu->gui->async_update_assets();
2065 AVIconDrawing::AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images)
2066 : BC_Toggle(x, y, images, agui->vicon_drawing)
2069 set_tooltip(_("draw vicons"));
2072 void AVIconDrawing::calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh)
2074 int text_line = -1, toggle_x = -1, toggle_y = -1;
2075 int text_x = -1, text_y = -1, text_w = -1, text_h = -1;
2076 BC_Toggle::calculate_extents(agui, images, 1,
2077 &text_line, ww, hh, &toggle_x, &toggle_y,
2078 &text_x, &text_y, &text_w, &text_h, "", MEDIUMFONT);
2081 AVIconDrawing::~AVIconDrawing()
2085 int AVIconDrawing::handle_event()
2087 agui->vicon_drawing = get_value();
2088 if( agui->vicon_drawing )
2089 agui->start_vicon_drawing();
2091 agui->stop_vicon_drawing();