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 "audiodevice.h"
27 #include "awindowgui.h"
29 #include "bccmodels.h"
30 #include "bcsignals.h"
35 #include "clippopup.h"
37 #include "cwindowgui.h"
40 #include "edlsession.h"
41 #include "effectlist.h"
43 #include "filesystem.h"
44 #include "folderlistmenu.h"
45 #include "indexable.h"
49 #include "labelpopup.h"
50 #include "localsession.h"
52 #include "mainsession.h"
53 #include "mwindowgui.h"
55 #include "nestededls.h"
56 #include "newfolder.h"
57 #include "preferences.h"
62 #include "vwindowgui.h"
65 #include "data/lad_picon_png.h"
66 #include "data/ff_audio_png.h"
67 #include "data/ff_video_png.h"
74 const char *AWindowGUI::folder_names[] =
78 N_("Audio Transitions"),
79 N_("Video Transitions"),
87 AssetVIcon::AssetVIcon(AssetPicon *picon, int w, int h, double framerate, int64_t length)
88 : VIcon(w, h, framerate)
91 this->length = length;
95 AssetVIcon::~AssetVIcon()
100 VFrame *AssetVIcon::frame()
102 Asset *asset = (Asset *)picon->indexable;
103 if( !asset->video_data && audio_data && audio_size && length > 0 ) {
104 if( !temp ) temp = new VFrame(0, -1, vw, vh, BC_RGB888, -1);
106 int sample_rate = asset->get_sample_rate();
107 int64_t audio_samples = asset->get_audio_samples();
108 double duration = (double)audio_samples / sample_rate;
109 picon->draw_hue_bar(temp, duration);
110 int secs = length / frame_rate + 0.5;
111 if( !secs ) secs = 1;
112 int bfrsz = VICON_SAMPLE_RATE;
113 int samples = audio_size/sizeof(vicon_audio_t);
114 double line_pos = (double)seq_no/(length-1);
115 int audio_pos = samples * line_pos * (secs-1)/secs;
116 vicon_audio_t *audio_data = ((vicon_audio_t *)this->audio_data) + audio_pos;
117 static const int mx = (1<<(8*sizeof(*audio_data)-1)) - 1;
118 double data[bfrsz], sample_scale = 1./mx;
119 int len = samples - audio_pos;
120 if( len > bfrsz ) len = bfrsz;
122 while( i < len ) data[i++] = *audio_data++ * sample_scale;
123 while( i < bfrsz ) data[i++] = 0;
124 picon->draw_wave(temp, data, bfrsz, RED, GREEN);
125 int x = (vw-1) * line_pos;
126 temp->pixel_rgb = RED;
127 temp->draw_line(x,0, x,vh);
130 if( seq_no >= images.size() ) {
131 MWindow *mwindow = picon->mwindow;
132 File *file = mwindow->video_cache->check_out(asset, mwindow->edl, 1);
133 if( !file ) return 0;
134 if( temp && (temp->get_w() != asset->width || temp->get_h() != asset->height) ) {
135 delete temp; temp = 0;
138 temp = new VFrame(0, -1, asset->width, asset->height, BC_RGB888, -1);
139 int ww = picon->gui->vicon_thread->view_w;
140 int hh = picon->gui->vicon_thread->view_h;
141 while( seq_no >= images.size() ) {
143 int64_t pos = images.size() / picon->gui->vicon_thread->refresh_rate * frame_rate;
144 file->set_video_position(pos,0);
145 if( file->read_frame(temp) ) temp->clear_frame();
146 add_image(temp, ww, hh, BC_RGB8);
148 mwindow->video_cache->check_in(asset);
150 return *images[seq_no];
153 int64_t AssetVIcon::set_seq_no(int64_t no)
155 if( no >= length ) no = 0;
159 int AssetVIcon::get_vx()
161 BC_ListBox *lbox = picon->gui->asset_list;
162 return lbox->get_item_x(picon);
164 int AssetVIcon::get_vy()
166 BC_ListBox *lbox = picon->gui->asset_list;
167 return lbox->get_item_y(picon) + lbox->get_title_h();
170 void AssetVIcon::load_audio()
172 MWindow *mwindow = picon->mwindow;
173 Asset *asset = (Asset *)picon->indexable;
174 File *file = mwindow->audio_cache->check_out(asset, mwindow->edl, 1);
175 int channels = asset->get_audio_channels();
176 if( channels > 2 ) channels = 2;
177 int sample_rate = asset->get_sample_rate();
178 int bfrsz = sample_rate;
179 Samples samples(bfrsz);
180 double time_scale = (double)sample_rate / VICON_SAMPLE_RATE;
181 vicon_audio_t *audio_data = (vicon_audio_t *)this->audio_data;
182 static const int mx = (1<<(8*sizeof(*audio_data)-1)) - 1;
183 double sample_scale = (double)mx / channels;
184 int audio_pos = 0, audio_len = audio_size/sizeof(vicon_audio_t);
185 while( audio_pos < audio_len ) {
186 int64_t pos = audio_pos * time_scale;
187 for( int ch=0; ch<channels; ++ch ) {
188 file->set_channel(ch);
189 file->set_audio_position(pos);
190 file->read_samples(&samples, bfrsz);
191 double *data = samples.get_data();
192 for( int64_t k=audio_pos; k<audio_len; ++k ) {
193 int i = k * time_scale - pos;
194 if( i >= bfrsz ) break;
195 int v = audio_data[k] + data[i] * sample_scale;
196 audio_data[k] = CLIP(v, -mx,mx);
199 audio_pos = (pos + bfrsz) / time_scale;
201 mwindow->audio_cache->check_in(asset);
205 AssetVIconAudio::AssetVIconAudio(AWindowGUI *gui)
209 audio = new AudioDevice(gui->mwindow);
213 AssetVIconAudio::~AssetVIconAudio()
218 void AssetVIconAudio::run()
221 int64_t bfrsz = VICON_SAMPLE_RATE;
222 MWindow *mwindow = gui->mwindow;
223 EDL *edl = mwindow->edl;
224 EDLSession *session = edl->session;
225 AudioOutConfig *aconfig = session->playback_config->aconfig;
226 audio->open_output(aconfig, VICON_SAMPLE_RATE, bfrsz, channels, 0);
227 audio->start_playback();
228 double out0[bfrsz], out1[bfrsz], *out[2] = { out0, out1 };
229 vicon_audio_t *audio_data = (vicon_audio_t *)vicon->audio_data;
230 static const int mx = (1<<(8*sizeof(*audio_data)-1)) - 1;
232 int audio_len = vicon->audio_size/sizeof(vicon_audio_t);
233 while( !interrupted ) {
234 int len = audio_len - audio_pos;
235 if( len <= 0 ) break;
236 if( len > bfrsz ) len = bfrsz;
238 for( int i=0; i<len; ++i,++k )
239 out0[i] = out1[i] = (double)audio_data[k] / mx;
241 audio->write_buffer(out, channels, len);
245 audio->set_last_buffer();
246 audio->stop_audio(interrupted ? 0 : 1);
250 void AssetVIconAudio::start(AssetVIcon *vicon)
252 if( running() ) return;
259 void AssetVIconAudio::stop(int wait)
261 if( running() && !interrupted ) {
263 audio->stop_audio(wait);
267 vicon->playing_audio = 0;
272 void AssetVIcon::start_audio()
274 picon->gui->vicon_audio->stop(0);
276 picon->gui->vicon_audio->start(this);
279 void AssetVIcon::stop_audio()
281 picon->gui->vicon_audio->stop(0);
285 AssetPicon::AssetPicon(MWindow *mwindow,
286 AWindowGUI *gui, Indexable *indexable)
290 this->mwindow = mwindow;
292 this->indexable = indexable;
293 indexable->add_user();
294 this->id = indexable->id;
297 AssetPicon::AssetPicon(MWindow *mwindow,
298 AWindowGUI *gui, EDL *edl)
302 this->mwindow = mwindow;
309 AssetPicon::AssetPicon(MWindow *mwindow,
310 AWindowGUI *gui, int folder, int persist)
311 : BC_ListBoxItem(_(AWindowGUI::folder_names[folder]),
312 folder>=0 && folder<AWINDOW_FOLDERS ?
313 gui->folder_icons[folder]: gui->folder_icon)
317 this->mwindow = mwindow;
319 persistent = persist;
322 AssetPicon::AssetPicon(MWindow *mwindow,
323 AWindowGUI *gui, PluginServer *plugin)
327 this->mwindow = mwindow;
329 this->plugin = plugin;
332 AssetPicon::AssetPicon(MWindow *mwindow,
333 AWindowGUI *gui, Label *label)
337 this->mwindow = mwindow;
345 AssetPicon::~AssetPicon()
348 gui->vicon_thread->del_vicon(vicon);
349 if( indexable ) indexable->remove_user();
350 if( edl ) edl->remove_user();
351 if( icon && !gui->protected_pixmap(icon) ) {
353 if( !plugin ) delete icon_vframe;
357 void AssetPicon::draw_hue_bar(VFrame *frame, double duration)
359 float t = duration > 1 ? (log(duration) / log(3600.f)) : 0;
361 float h = 300 * t, s = 1., v = 1.;
362 float r, g, b; // duration, 0..1hr == hue red..magenta
363 HSV::hsv_to_rgb(r,g,b, h,s,v);
364 int ih = frame->get_h()/8, iw = frame->get_w();
365 int ir = r * 256; CLAMP(ir, 0,255);
366 int ig = g * 256; CLAMP(ig, 0,255);
367 int ib = b * 256; CLAMP(ib, 0,255);
368 unsigned char **rows = frame->get_rows();
369 for( int y=0; y<ih; ++y ) {
370 unsigned char *rp = rows[y];
371 for( int x=0; x<iw; rp+=3,++x ) {
372 rp[0] = ir; rp[1] = ig; rp[2] = ib;
377 void AssetPicon::draw_wave(VFrame *frame, double *dp, int len, int base_color, int line_color)
379 int w = frame->get_w(), h = frame->get_h();
380 int h1 = h-1, h2 = h/2, y = h2;
381 int rgb_color = frame->pixel_rgb;
382 for( int x=0,x1=0,x2=0; x<w; ++x,x1=x2 ) {
383 double min = *dp, max = min;
384 x2 = (len * (x+1))/w;
385 for( int i=x1; i<x2; ++i ) {
386 double value = *dp++;
387 if( value < min ) min = value;
388 if( value > max ) max = value;
390 int ctr = (min + max) / 2;
391 int y0 = (int)(h2 - ctr*h2); CLAMP(y0, 0,h1);
392 int y1 = (int)(h2 - min*h2); CLAMP(y1, 0,h1);
393 int y2 = (int)(h2 - max*h2); CLAMP(y2, 0,h1);
394 frame->pixel_rgb = line_color;
395 frame->draw_line(x,y1, x,y2);
396 frame->pixel_rgb = base_color;
397 frame->draw_line(x,y, x,y0);
400 frame->pixel_rgb = rgb_color;
403 void AssetPicon::reset()
409 foldernum = AW_NO_FOLDER;
419 void AssetPicon::create_objects()
422 char name[BCTEXTLEN];
423 int pixmap_w, pixmap_h;
425 pixmap_h = 50 * BC_WindowBase::get_resources()->icon_scale;
428 fs.extract_name(name, indexable->path);
432 if( indexable && indexable->is_asset ) {
433 Asset *asset = (Asset*)indexable;
434 if( asset->video_data ) {
435 if( mwindow->preferences->use_thumbnails ) {
436 gui->unlock_window();
437 File *file = mwindow->video_cache->check_out(asset,
442 int height = asset->height > 0 ? asset->height : 1;
443 pixmap_w = pixmap_h * asset->width / height;
446 file->set_video_position(0, 0);
448 if( gui->temp_picon &&
449 (gui->temp_picon->get_w() != asset->width ||
450 gui->temp_picon->get_h() != asset->height) ) {
451 delete gui->temp_picon;
455 if( !gui->temp_picon ) {
456 gui->temp_picon = new VFrame(0, -1,
457 asset->width, asset->height,
460 { char string[BCTEXTLEN];
461 sprintf(string, _("Reading %s"), name);
462 mwindow->gui->lock_window("AssetPicon::create_objects");
463 mwindow->gui->show_message(string);
464 mwindow->gui->unlock_window(); }
465 file->read_frame(gui->temp_picon);
466 mwindow->video_cache->check_in(asset);
468 gui->lock_window("AssetPicon::create_objects 0");
469 icon = new BC_Pixmap(gui, pixmap_w, pixmap_h);
470 icon->draw_vframe(gui->temp_picon,
471 0, 0, pixmap_w, pixmap_h, 0, 0);
472 icon_vframe = new VFrame(0,
473 -1, pixmap_w, pixmap_h, BC_RGB888, -1);
474 icon_vframe->transfer_from(gui->temp_picon);
475 if( asset->awindow_folder == AW_MEDIA_FOLDER ) {
477 double framerate = asset->get_frame_rate();
478 if( !framerate ) framerate = VICON_RATE;
479 int64_t frames = asset->get_video_frames();
480 double secs = frames / framerate;
481 if( secs > 5 ) secs = 5;
482 int64_t length = secs * gui->vicon_thread->refresh_rate;
483 vicon = new AssetVIcon(this, pixmap_w, pixmap_h, framerate, length);
484 if( asset->audio_data && secs > 0 ) {
485 gui->unlock_window();
486 int audio_len = VICON_SAMPLE_RATE*secs+0.5;
487 vicon->init_audio(audio_len*sizeof(vicon_audio_t));
489 gui->lock_window("AssetPicon::create_objects 1");
491 gui->vicon_thread->add_vicon(vicon);
496 gui->lock_window("AssetPicon::create_objects 2");
497 icon = gui->video_icon;
498 icon_vframe = gui->video_vframe;
502 icon = gui->video_icon;
503 icon_vframe = gui->video_vframe;
507 if( asset->audio_data ) {
508 if( mwindow->preferences->use_thumbnails ) {
509 gui->unlock_window();
510 File *file = mwindow->audio_cache->check_out(asset,
514 pixmap_w = pixmap_h * 16/9;
515 icon_vframe = new VFrame(0,
516 -1, pixmap_w, pixmap_h, BC_RGB888, -1);
517 { char string[BCTEXTLEN];
518 sprintf(string, _("Reading %s"), name);
519 mwindow->gui->lock_window("AssetPicon::create_objects 3");
520 mwindow->gui->show_message(string);
521 mwindow->gui->unlock_window(); }
522 int sample_rate = asset->get_sample_rate();
523 int channels = asset->get_audio_channels();
524 if( channels > 2 ) channels = 2;
525 int64_t audio_samples = asset->get_audio_samples();
526 double duration = (double)audio_samples / sample_rate;
527 draw_hue_bar(icon_vframe, duration);
528 int bfrsz = sample_rate;
529 Samples samples(bfrsz);
530 static int line_colors[2] = { GREEN, YELLOW };
531 static int base_colors[2] = { RED, PINK };
532 for( int i=channels; --i>=0; ) {
533 file->set_channel(i);
534 file->set_audio_position(0);
535 file->read_samples(&samples, bfrsz);
536 draw_wave(icon_vframe, samples.get_data(), bfrsz,
537 base_colors[i], line_colors[i]);
539 mwindow->audio_cache->check_in(asset);
540 if( asset->awindow_folder == AW_MEDIA_FOLDER ) {
541 double secs = duration;
542 if( secs > 5 ) secs = 5;
543 double refresh_rate = gui->vicon_thread->refresh_rate;
544 int64_t length = secs * refresh_rate;
545 vicon = new AssetVIcon(this, pixmap_w, pixmap_h, refresh_rate, length);
546 int audio_len = VICON_SAMPLE_RATE*secs+0.5;
547 vicon->init_audio(audio_len*sizeof(vicon_audio_t));
549 gui->vicon_thread->add_vicon(vicon);
551 gui->lock_window("AssetPicon::create_objects 4");
552 icon = new BC_Pixmap(gui, pixmap_w, pixmap_h);
553 icon->draw_vframe(icon_vframe,
554 0, 0, pixmap_w, pixmap_h, 0, 0);
557 gui->lock_window("AssetPicon::create_objects 5");
558 icon = gui->audio_icon;
559 icon_vframe = gui->audio_vframe;
563 icon = gui->audio_icon;
564 icon_vframe = gui->audio_vframe;
569 mtime = !stat(asset->path, &st) ? st.st_mtime : 0;
572 if( indexable && !indexable->is_asset ) {
573 icon = gui->video_icon;
574 icon_vframe = gui->video_vframe;
578 set_text(strcpy(name, edl->local_session->clip_title));
579 icon = gui->clip_icon;
580 icon_vframe = gui->clip_vframe;
584 strcpy(name, _(plugin->title));
586 icon_vframe = plugin->get_picon();
588 icon = gui->create_pixmap(icon_vframe);
589 else if( plugin->audio ) {
590 if( plugin->transition ) {
591 icon = gui->atransition_icon;
592 icon_vframe = gui->atransition_vframe;
594 else if( plugin->is_ffmpeg() ) {
595 icon = gui->ff_aud_icon;
596 icon_vframe = gui->ff_aud_vframe;
598 else if( plugin->is_ladspa() ) {
599 icon = gui->ladspa_icon;
600 icon_vframe = gui->ladspa_vframe;
603 icon = gui->aeffect_icon;
604 icon_vframe = gui->aeffect_vframe;
607 else if( plugin->video ) {
608 if( plugin->transition ) {
609 icon = gui->vtransition_icon;
610 icon_vframe = gui->vtransition_vframe;
612 else if( plugin->is_ffmpeg() ) {
613 icon = gui->ff_vid_icon;
614 icon_vframe = gui->ff_vid_vframe;
617 icon = gui->veffect_icon;
618 icon_vframe = gui->veffect_vframe;
626 mwindow->edl->session->time_format,
627 mwindow->edl->session->sample_rate,
628 mwindow->edl->session->frame_rate,
629 mwindow->edl->session->frames_per_foot);
631 icon = gui->label_icon;
632 icon_vframe = gui->label_vframe;
635 icon = gui->file_icon;
636 icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN];
639 set_icon_vframe(icon_vframe);
642 AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow)
643 : BC_Window(_(PROGRAM_NAME ": Resources"),
644 mwindow->session->awindow_x, mwindow->session->awindow_y,
645 mwindow->session->awindow_w, mwindow->session->awindow_h,
648 this->mwindow = mwindow;
649 this->awindow = awindow;
651 file_vframe = 0; file_icon = 0;
652 folder_vframe = 0; folder_icon = 0;
653 audio_vframe = 0; audio_icon = 0;
654 video_vframe = 0; video_icon = 0;
655 label_vframe = 0; label_icon = 0;
657 atransition_vframe = 0; atransition_icon = 0;
658 vtransition_vframe = 0; vtransition_icon = 0;
659 aeffect_vframe = 0; aeffect_icon = 0;
660 ladspa_vframe = 0; ladspa_icon = 0;
661 veffect_vframe = 0; veffect_icon = 0;
662 ff_aud_vframe = 0; ff_aud_icon = 0;
663 ff_vid_vframe = 0; ff_vid_icon = 0;
665 aeffect_folder_vframe = 0; aeffect_folder_icon = 0;
666 atransition_folder_vframe = 0; atransition_folder_icon = 0;
667 clip_folder_vframe = 0; clip_folder_icon = 0;
668 label_folder_vframe = 0; label_folder_icon = 0;
669 media_folder_vframe = 0; media_folder_icon = 0;
670 proxy_folder_vframe = 0; proxy_folder_icon = 0;
671 veffect_folder_vframe = 0; veffect_folder_icon = 0;
672 vtransition_folder_vframe = 0; vtransition_folder_icon = 0;
674 ladspa_vframe = 0; ladspa_icon = 0;
675 ff_aud_vframe = 0; ff_aud_icon = 0;
676 ff_vid_vframe = 0; ff_vid_icon = 0;
678 clip_vframe = 0; clip_icon = 0;
679 atransition_vframe = 0; atransition_icon = 0;
680 vtransition_vframe = 0; vtransition_icon = 0;
681 aeffect_vframe = 0; aeffect_icon = 0;
682 veffect_vframe = 0; veffect_icon = 0;
684 plugin_visibility = ((uint64_t)1<<(8*sizeof(uint64_t)-1))-1;
685 newfolder_thread = 0;
694 allow_iconlisting = 1;
699 displayed_folder = AW_NO_FOLDER;
702 AWindowGUI::~AWindowGUI()
704 assets.remove_all_objects();
705 folders.remove_all_objects();
706 aeffects.remove_all_objects();
707 veffects.remove_all_objects();
708 atransitions.remove_all_objects();
709 vtransitions.remove_all_objects();
710 labellist.remove_all_objects();
711 displayed_assets[1].remove_all_objects();
715 delete newfolder_thread;
720 delete effectlist_menu;
721 delete assetlist_menu;
722 delete cliplist_menu;
723 delete labellist_menu;
724 delete folderlist_menu;
727 delete remove_plugin;
729 delete file_vframe; delete file_icon;
730 delete folder_vframe; delete folder_icon;
731 delete audio_vframe; delete audio_icon;
732 delete video_vframe; delete video_icon;
733 delete label_vframe; delete label_icon;
734 delete clip_vframe; delete clip_icon;
735 delete aeffect_folder_vframe; delete aeffect_folder_icon;
736 delete atransition_folder_vframe; delete atransition_folder_icon;
737 delete veffect_folder_vframe; delete veffect_folder_icon;
738 delete vtransition_folder_vframe; delete vtransition_folder_icon;
739 delete clip_folder_vframe; delete clip_folder_icon;
740 delete label_folder_vframe; delete label_folder_icon;
741 delete media_folder_vframe; delete media_folder_icon;
742 delete proxy_folder_vframe; delete proxy_folder_icon;
743 delete ladspa_vframe; delete ladspa_icon;
744 delete ff_aud_vframe; delete ff_aud_icon;
745 delete ff_vid_vframe; delete ff_vid_icon;
746 delete atransition_vframe; delete atransition_icon;
747 delete vtransition_vframe; delete vtransition_icon;
748 delete aeffect_vframe; delete aeffect_icon;
749 delete veffect_vframe; delete veffect_icon;
752 bool AWindowGUI::protected_pixmap(BC_Pixmap *icon)
754 return icon == file_icon ||
755 icon == folder_icon ||
756 icon == audio_icon ||
757 icon == video_icon ||
759 icon == label_icon ||
760 icon == vtransition_icon ||
761 icon == atransition_icon ||
762 icon == veffect_icon ||
763 icon == aeffect_icon ||
764 icon == ladspa_icon ||
765 icon == ff_aud_icon ||
766 icon == ff_vid_icon ||
767 icon == aeffect_folder_icon ||
768 icon == veffect_folder_icon ||
769 icon == atransition_folder_icon ||
770 icon == vtransition_folder_icon ||
771 icon == label_folder_icon ||
772 icon == clip_folder_icon ||
773 icon == media_folder_icon ||
774 icon == proxy_folder_icon;
777 VFrame *AWindowGUI::get_picon(const char *name, const char *plugin_icons)
779 char png_path[BCTEXTLEN];
780 char *pp = png_path, *ep = pp + sizeof(png_path)-1;
781 snprintf(pp, ep-pp, "%s/picon/%s/%s.png",
782 File::get_plugin_path(), plugin_icons, name);
783 if( access(png_path, R_OK) ) return 0;
784 return VFramePng::vframe_png(png_path,0,0);
787 VFrame *AWindowGUI::get_picon(const char *name)
789 VFrame *vframe = get_picon(name, mwindow->preferences->plugin_icons);
791 char png_name[BCSTRLEN], *pp = png_name, *ep = pp + sizeof(png_name)-1;
792 snprintf(pp, ep-pp, "%s.png", name);
793 unsigned char *data = mwindow->theme->get_image_data(png_name);
794 if( data ) vframe = new VFramePng(data, 0.);
799 void AWindowGUI::resource_icon(VFrame *&vfrm, BC_Pixmap *&icon, const char *fn, int idx)
801 vfrm = get_picon(fn);
802 if( !vfrm ) vfrm = BC_WindowBase::get_resources()->type_to_icon[idx];
803 icon = new BC_Pixmap(this, vfrm, PIXMAP_ALPHA);
805 void AWindowGUI::theme_icon(VFrame *&vfrm, BC_Pixmap *&icon, const char *fn)
807 vfrm = get_picon(fn);
808 if( !vfrm ) vfrm = mwindow->theme->get_image(fn);
809 icon = new BC_Pixmap(this, vfrm, PIXMAP_ALPHA);
811 void AWindowGUI::plugin_icon(VFrame *&vfrm, BC_Pixmap *&icon, const char *fn, unsigned char *png)
813 vfrm = get_picon(fn);
814 if( !vfrm ) vfrm = new VFramePng(png);
815 icon = new BC_Pixmap(this, vfrm, PIXMAP_ALPHA);
818 void AWindowGUI::create_objects()
820 lock_window("AWindowGUI::create_objects");
821 asset_titles[0] = C_("Title");
822 asset_titles[1] = _("Comments");
824 set_icon(mwindow->theme->get_image("awindow_icon"));
826 resource_icon(file_vframe, file_icon, "film_icon", ICON_UNKNOWN);
827 resource_icon(folder_vframe, folder_icon, "folder_icon", ICON_FOLDER);
828 resource_icon(audio_vframe, audio_icon, "audio_icon", ICON_SOUND);
829 resource_icon(video_vframe, video_icon, "video_icon", ICON_FILM);
830 resource_icon(label_vframe, label_icon, "label_icon", ICON_LABEL);
832 theme_icon(aeffect_folder_vframe, aeffect_folder_icon, "aeffect_folder");
833 theme_icon(atransition_folder_vframe, atransition_folder_icon, "atransition_folder");
834 theme_icon(clip_folder_vframe, clip_folder_icon, "clip_folder");
835 theme_icon(label_folder_vframe, label_folder_icon, "label_folder");
836 theme_icon(media_folder_vframe, media_folder_icon, "media_folder");
837 theme_icon(proxy_folder_vframe, proxy_folder_icon, "proxy_folder");
838 theme_icon(veffect_folder_vframe, veffect_folder_icon, "veffect_folder");
839 theme_icon(vtransition_folder_vframe, vtransition_folder_icon, "vtransition_folder");
841 folder_icons[AW_AEFFECT_FOLDER] = aeffect_folder_icon;
842 folder_icons[AW_VEFFECT_FOLDER] = veffect_folder_icon;
843 folder_icons[AW_ATRANSITION_FOLDER] = atransition_folder_icon;
844 folder_icons[AW_VTRANSITION_FOLDER] = vtransition_folder_icon;
845 folder_icons[AW_LABEL_FOLDER] = label_folder_icon;
846 folder_icons[AW_CLIP_FOLDER] = clip_folder_icon;
847 folder_icons[AW_MEDIA_FOLDER] = media_folder_icon;
848 folder_icons[AW_PROXY_FOLDER] = proxy_folder_icon;
850 theme_icon(clip_vframe, clip_icon, "clip_icon");
851 theme_icon(atransition_vframe, atransition_icon, "atransition_icon");
852 theme_icon(vtransition_vframe, vtransition_icon, "vtransition_icon");
853 theme_icon(aeffect_vframe, aeffect_icon, "aeffect_icon");
854 theme_icon(veffect_vframe, veffect_icon, "veffect_icon");
856 plugin_icon(ladspa_vframe, ladspa_icon, "lad_picon", lad_picon_png);
857 plugin_icon(ff_aud_vframe, ff_aud_icon, "ff_audio", ff_audio_png);
858 plugin_icon(ff_vid_vframe, ff_vid_icon, "ff_video", ff_video_png);
861 folders.append(new AssetPicon(mwindow, this, AW_AEFFECT_FOLDER, 1));
862 folders.append(new AssetPicon(mwindow, this, AW_VEFFECT_FOLDER, 1));
863 folders.append(new AssetPicon(mwindow, this, AW_ATRANSITION_FOLDER, 1));
864 folders.append(new AssetPicon(mwindow, this, AW_VTRANSITION_FOLDER, 1));
865 folders.append(new AssetPicon(mwindow, this, AW_LABEL_FOLDER, 1));
866 folders.append(new AssetPicon(mwindow, this, AW_CLIP_FOLDER, 1));
867 folders.append(new AssetPicon(mwindow, this, AW_PROXY_FOLDER, 1));
868 folders.append(new AssetPicon(mwindow, this, AW_MEDIA_FOLDER, 1));
870 create_label_folder();
872 mwindow->theme->get_awindow_sizes(this);
873 load_defaults(mwindow->defaults);
875 int x1 = mwindow->theme->alist_x, y1 = mwindow->theme->alist_y;
876 int w1 = mwindow->theme->alist_w, h1 = mwindow->theme->alist_h;
877 search_text = new AWindowSearchText(mwindow, this, x1, y1+5);
878 search_text->create_objects();
879 int dy = search_text->get_h() + 10;
881 add_subwindow(asset_list = new AWindowAssets(mwindow, this, x1, y1, w1, h1));
883 vicon_thread = new VIconThread(asset_list);
884 vicon_thread->start();
885 vicon_audio = new AssetVIconAudio(this);
887 add_subwindow(divider = new AWindowDivider(mwindow, this,
888 mwindow->theme->adivider_x, mwindow->theme->adivider_y,
889 mwindow->theme->adivider_w, mwindow->theme->adivider_h));
891 divider->set_cursor(HSEPARATE_CURSOR, 0, 0);
893 int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y;
894 int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h;
895 VFrame **images = mwindow->theme->get_image_set("playpatch_data");
896 AVIconDrawing::calculate_geometry(this, images, &avicon_w, &avicon_h);
897 add_subwindow(avicon_drawing = new AVIconDrawing(this, fw-avicon_w, fy, images));
898 add_subwindow(add_tools = new AddTools(mwindow, this, fx, fy, _("Visibility")));
899 add_tools->create_objects();
900 fy += add_tools->get_h(); fh -= add_tools->get_h();
901 add_subwindow(folder_list = new AWindowFolders(mwindow,
902 this, fx, fy, fw, fh));
905 //int x = mwindow->theme->abuttons_x;
906 //int y = mwindow->theme->abuttons_y;
909 newfolder_thread = new NewFolderThread(mwindow, this);
911 add_subwindow(asset_menu = new AssetPopup(mwindow, this));
912 asset_menu->create_objects();
913 add_subwindow(clip_menu = new ClipPopup(mwindow, this));
914 clip_menu->create_objects();
915 add_subwindow(label_menu = new LabelPopup(mwindow, this));
916 label_menu->create_objects();
918 add_subwindow(effectlist_menu = new EffectListMenu(mwindow, this));
919 effectlist_menu->create_objects();
920 add_subwindow(assetlist_menu = new AssetListMenu(mwindow, this));
921 assetlist_menu->create_objects();
922 add_subwindow(cliplist_menu = new ClipListMenu(mwindow, this));
923 cliplist_menu->create_objects();
924 add_subwindow(labellist_menu = new LabelListMenu(mwindow, this));
925 labellist_menu->create_objects();
927 add_subwindow(folderlist_menu = new FolderListMenu(mwindow, this));
928 folderlist_menu->create_objects();
930 create_custom_xatoms();
934 int AWindowGUI::resize_event(int w, int h)
936 mwindow->session->awindow_x = get_x();
937 mwindow->session->awindow_y = get_y();
938 mwindow->session->awindow_w = w;
939 mwindow->session->awindow_h = h;
941 mwindow->theme->get_awindow_sizes(this);
942 mwindow->theme->draw_awindow_bg(this);
943 reposition_objects();
945 // int x = mwindow->theme->abuttons_x;
946 // int y = mwindow->theme->abuttons_y;
947 // new_bin->reposition_window(x, y);
948 // x += new_bin->get_w();
949 // delete_bin->reposition_window(x, y);
950 // x += delete_bin->get_w();
951 // rename_bin->reposition_window(x, y);
952 // x += rename_bin->get_w();
953 // delete_disk->reposition_window(x, y);
954 // x += delete_disk->get_w();
955 // delete_project->reposition_window(x, y);
956 // x += delete_project->get_w();
957 // info->reposition_window(x, y);
958 // x += info->get_w();
959 // redraw_index->reposition_window(x, y);
960 // x += redraw_index->get_w();
961 // paste->reposition_window(x, y);
962 // x += paste->get_w();
963 // append->reposition_window(x, y);
964 // x += append->get_w();
965 // view->reposition_window(x, y);
967 BC_WindowBase::resize_event(w, h);
971 int AWindowGUI::translation_event()
973 mwindow->session->awindow_x = get_x();
974 mwindow->session->awindow_y = get_y();
978 void AWindowGUI::reposition_objects()
980 int x1 = mwindow->theme->alist_x, y1 = mwindow->theme->alist_y;
981 int w1 = mwindow->theme->alist_w, h1 = mwindow->theme->alist_h;
982 search_text->reposition_window(x1, y1+5, w1);
983 int dy = search_text->get_h() + 10;
985 asset_list->reposition_window(x1, y1, w1, h1);
986 divider->reposition_window(
987 mwindow->theme->adivider_x, mwindow->theme->adivider_y,
988 mwindow->theme->adivider_w, mwindow->theme->adivider_h);
989 int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y;
990 int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h;
991 add_tools->resize_event(fw-avicon_w, add_tools->get_h());
992 avicon_drawing->reposition_window(fw-avicon_w, fy);
993 fy += add_tools->get_h(); fh -= add_tools->get_h();
994 folder_list->reposition_window(fx, fy, fw, fh);
997 int AWindowGUI::save_defaults(BC_Hash *defaults)
999 defaults->update("PLUGIN_VISIBILTY", plugin_visibility);
1000 defaults->update("VICON_DRAWING", vicon_drawing);
1004 int AWindowGUI::load_defaults(BC_Hash *defaults)
1006 plugin_visibility = defaults->get("PLUGIN_VISIBILTY", plugin_visibility);
1007 vicon_drawing = defaults->get("VICON_DRAWING", vicon_drawing);
1011 int AWindowGUI::close_event()
1014 mwindow->session->show_awindow = 0;
1017 mwindow->gui->lock_window("AWindowGUI::close_event");
1018 mwindow->gui->mainmenu->show_awindow->set_checked(0);
1019 mwindow->gui->unlock_window();
1021 lock_window("AWindowGUI::close_event");
1022 save_defaults(mwindow->defaults);
1023 mwindow->save_defaults();
1027 void AWindowGUI::start_vicon_drawing()
1029 if( !vicon_drawing ) return;
1030 if( mwindow->edl->session->awindow_folder != AW_MEDIA_FOLDER ) return;
1031 if( mwindow->edl->session->assetlist_format != ASSETS_ICONS ) return;
1032 vicon_thread->start_drawing();
1035 void AWindowGUI::stop_vicon_drawing()
1037 vicon_thread->stop_drawing();
1040 AWindowRemovePluginGUI::
1041 AWindowRemovePluginGUI(AWindow *awindow, AWindowRemovePlugin *thread,
1042 int x, int y, PluginServer *plugin)
1043 : BC_Window(_(PROGRAM_NAME ": Remove plugin"), x,y, 500,200, 50, 50, 1, 0, 1, -1, "", 1)
1045 this->awindow = awindow;
1046 this->thread = thread;
1047 this->plugin = plugin;
1048 VFrame *vframe = plugin->get_picon();
1049 icon = vframe ? create_pixmap(vframe) : 0;
1050 plugin_list.append(new BC_ListBoxItem(plugin->title, icon));
1053 AWindowRemovePluginGUI::
1054 ~AWindowRemovePluginGUI()
1056 if( !awindow->gui->protected_pixmap(icon) )
1058 plugin_list.remove_all();
1061 void AWindowRemovePluginGUI::create_objects()
1063 BC_Button *ok_button = new BC_OKButton(this);
1064 add_subwindow(ok_button);
1065 BC_Button *cancel_button = new BC_CancelButton(this);
1066 add_subwindow(cancel_button);
1068 BC_Title *title = new BC_Title(x, y, _("remove plugin?"));
1069 add_subwindow(title);
1070 y += title->get_h() + 5;
1071 list = new BC_ListBox(x, y,
1072 get_w() - 20, ok_button->get_y() - y - 5, LISTBOX_TEXT, &plugin_list,
1073 0, 0, 1, 0, 0, LISTBOX_SINGLE, ICON_LEFT, 0);
1074 add_subwindow(list);
1078 int AWindowRemovePlugin::remove_plugin(PluginServer *plugin, ArrayList<BC_ListBoxItem*> &folder)
1081 for( int i=0; i<folder.size(); ) {
1082 AssetPicon *picon = (AssetPicon *)folder[i];
1083 if( picon->plugin == plugin ) {
1084 folder.remove_object_number(i);
1093 void AWindowRemovePlugin::handle_close_event(int result)
1096 printf(_("remove %s\n"), plugin->path);
1097 awindow->gui->lock_window("AWindowRemovePlugin::handle_close_event");
1098 ArrayList<BC_ListBoxItem*> *folder =
1099 plugin->audio ? plugin->transition ?
1100 &awindow->gui->atransitions :
1101 &awindow->gui->aeffects :
1102 plugin->video ? plugin->transition ?
1103 &awindow->gui->vtransitions :
1104 &awindow->gui->veffects :
1106 if( folder ) remove_plugin(plugin, *folder);
1107 MWindow *mwindow = awindow->mwindow;
1108 awindow->gui->unlock_window();
1109 char plugin_path[BCTEXTLEN];
1110 strcpy(plugin_path, plugin->path);
1111 mwindow->plugindb->remove(plugin);
1112 remove(plugin_path);
1113 char index_path[BCTEXTLEN];
1114 mwindow->create_defaults_path(index_path, PLUGIN_FILE);
1116 char picon_path[BCTEXTLEN];
1118 snprintf(picon_path, sizeof(picon_path), "%s/picon",
1119 File::get_plugin_path());
1120 char png_name[BCSTRLEN], png_path[BCTEXTLEN];
1121 plugin->get_plugin_png_name(png_name);
1122 fs.update(picon_path);
1123 for( int i=0; i<fs.dir_list.total; ++i ) {
1124 char *fs_path = fs.dir_list[i]->path;
1125 if( !fs.is_dir(fs_path) ) continue;
1126 snprintf(png_path, sizeof(picon_path), "%s/%s",
1130 delete plugin; plugin = 0;
1131 awindow->gui->async_update_assets();
1135 AWindowRemovePlugin::
1136 AWindowRemovePlugin(AWindow *awindow, PluginServer *plugin)
1139 this->awindow = awindow;
1140 this->plugin = plugin;
1143 AWindowRemovePlugin::
1144 ~AWindowRemovePlugin()
1149 BC_Window* AWindowRemovePlugin::new_gui()
1151 int x = awindow->gui->get_abs_cursor_x(0);
1152 int y = awindow->gui->get_abs_cursor_y(0);
1153 AWindowRemovePluginGUI *gui = new AWindowRemovePluginGUI(awindow, this, x, y, plugin);
1154 gui->create_objects();
1158 int AWindowGUI::keypress_event()
1160 switch( get_keypress() ) {
1168 if( shift_down() ) {
1169 PluginServer* plugin = selected_plugin();
1170 if( !plugin ) break;
1171 remove_plugin = new AWindowRemovePlugin(awindow, plugin);
1173 remove_plugin->start();
1182 int AWindowGUI::create_custom_xatoms()
1184 UpdateAssetsXAtom = create_xatom("CWINDOWGUI_UPDATE_ASSETS");
1187 int AWindowGUI::recieve_custom_xatoms(xatom_event *event)
1189 if( event->message_type == UpdateAssetsXAtom ) {
1196 void AWindowGUI::async_update_assets()
1199 event.message_type = UpdateAssetsXAtom;
1200 send_custom_xatom(&event);
1204 void AWindowGUI::update_folder_list()
1206 for( int i = 0; i < folders.total; i++ ) {
1207 AssetPicon *picon = (AssetPicon*)folders.values[i];
1211 // Search assets for folders
1212 for( int i = 0; i < mwindow->edl->folders.total; i++ ) {
1213 const char *folder = mwindow->edl->folders.values[i];
1216 for( int j = 0; j < folders.total; j++ ) {
1217 AssetPicon *picon = (AssetPicon*)folders.values[j];
1218 if( !strcasecmp(picon->get_text(), folder) ) {
1226 int aw_folder = folder_number(folder);
1227 if( aw_folder >= 0 ) {
1228 AssetPicon *picon = new AssetPicon(mwindow, this, aw_folder, 1);
1229 picon->create_objects();
1230 folders.append(picon);
1235 // Delete unused non-persistent folders
1236 for( int i=folders.total; --i>=0; ) {
1237 AssetPicon *picon = (AssetPicon*)folders.values[i];
1238 if( !picon->in_use && !picon->persistent ) {
1240 folders.remove_number(i);
1245 void AWindowGUI::create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
1246 int do_audio, int do_video, int is_realtime, int is_transition)
1248 ArrayList<PluginServer*> plugin_list;
1249 // Get pointers to plugindb entries
1250 mwindow->search_plugindb(do_audio, do_video, is_realtime, is_transition,
1253 for( int i = 0; i < plugin_list.total; i++ ) {
1254 PluginServer *server = plugin_list.values[i];
1255 int visible = plugin_visibility & (1<<server->dir_idx);
1256 if( !visible ) continue;
1257 // Create new listitem
1258 AssetPicon *picon = new AssetPicon(mwindow, this, server);
1259 picon->create_objects();
1260 output->append(picon);
1264 void AWindowGUI::create_label_folder()
1267 for( current = mwindow->edl->labels->first; current; current = NEXT ) {
1268 AssetPicon *picon = new AssetPicon(mwindow, this, current);
1269 picon->create_objects();
1270 labellist.append(picon);
1275 void AWindowGUI::update_asset_list()
1277 for( int i = 0; i < assets.total; i++ ) {
1278 AssetPicon *picon = (AssetPicon*)assets.values[i];
1282 // Synchronize EDL clips
1283 for( int i = 0; i < mwindow->edl->clips.total; i++ ) {
1286 // Look for clip in existing listitems
1287 for( int j = 0; j < assets.total && !exists; j++ ) {
1288 AssetPicon *picon = (AssetPicon*)assets.values[j];
1290 if( picon->id == mwindow->edl->clips.values[i]->id ) {
1291 picon->edl = mwindow->edl->clips.values[i];
1292 picon->set_text(mwindow->edl->clips.values[i]->local_session->clip_title);
1298 // Create new listitem
1300 AssetPicon *picon = new AssetPicon(mwindow,
1301 this, mwindow->edl->clips.values[i]);
1302 picon->create_objects();
1303 assets.append(picon);
1307 // Synchronize EDL assets
1308 for( Asset *current = mwindow->edl->assets->first;
1313 // Look for asset in existing listitems
1314 for( int j = 0; j < assets.total && !exists; j++ ) {
1315 AssetPicon *picon = (AssetPicon*)assets.values[j];
1317 if( picon->id == current->id ) {
1318 picon->indexable = current;
1325 // Create new listitem
1327 AssetPicon *picon = new AssetPicon(mwindow,
1329 picon->create_objects();
1330 assets.append(picon);
1334 mwindow->gui->lock_window("AWindowGUI::update_asset_list");
1335 mwindow->gui->default_message();
1336 mwindow->gui->unlock_window();
1338 // Synchronize nested EDLs
1339 for( int i = 0; i < mwindow->edl->nested_edls->size(); i++ ) {
1341 Indexable *indexable = mwindow->edl->nested_edls->get(i);
1343 // Look for asset in existing listitems
1344 for( int j = 0; j < assets.total && !exists; j++ ) {
1345 AssetPicon *picon = (AssetPicon*)assets.values[j];
1347 if( picon->id == indexable->id ) {
1348 picon->indexable = indexable;
1355 // Create new listitem
1357 AssetPicon *picon = new AssetPicon(mwindow,
1359 picon->create_objects();
1360 assets.append(picon);
1364 for( int i = assets.size() - 1; i >= 0; i-- ) {
1365 AssetPicon *picon = (AssetPicon*)assets.get(i);
1366 if( !picon->in_use ) {
1368 assets.remove_number(i);
1371 if( !picon->indexable || !picon->indexable->is_asset ) continue;
1373 picon->mtime = !stat(picon->indexable->path, &st) ? st.st_mtime : 0;
1377 void AWindowGUI::update_picon(Indexable *indexable)
1380 for( int i = 0; i < assets.total; i++ ) {
1381 AssetPicon *picon = (AssetPicon*)assets.values[i];
1382 if( picon->indexable == indexable ||
1383 picon->edl == (EDL *)indexable ) {
1384 char name[BCTEXTLEN];
1386 fs.extract_name(name, indexable->path);
1387 picon->set_text(name);
1388 vicon = picon->vicon;
1393 stop_vicon_drawing();
1394 vicon->clear_images();
1395 vicon->reset(indexable->get_frame_rate());
1396 start_vicon_drawing();
1400 void AWindowGUI::sort_assets(int use_mtime)
1402 switch( mwindow->edl->session->awindow_folder ) {
1403 case AW_AEFFECT_FOLDER:
1404 sort_picons(&aeffects);
1406 case AW_VEFFECT_FOLDER:
1407 sort_picons(&veffects);
1409 case AW_ATRANSITION_FOLDER:
1410 sort_picons(&atransitions);
1412 case AW_VTRANSITION_FOLDER:
1413 sort_picons(&vtransitions);
1415 case AW_LABEL_FOLDER:
1416 sort_picons(&labellist);
1419 sort_picons(&assets, use_mtime);
1422 asset_list->update_format(asset_list->get_format(), 0);
1426 void AWindowGUI::sort_folders()
1428 sort_picons(&folders);
1429 folder_list->update_format(folder_list->get_format(), 0);
1433 void AWindowGUI::collect_assets()
1436 mwindow->session->drag_assets->remove_all();
1437 mwindow->session->drag_clips->remove_all();
1440 AssetPicon *result = (AssetPicon*)asset_list->get_selection(0, i++);
1441 if( !result ) break;
1443 if( result->indexable ) mwindow->session->drag_assets->append(result->indexable);
1444 if( result->edl ) mwindow->session->drag_clips->append(result->edl);
1448 void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst,
1449 ArrayList<BC_ListBoxItem*> *src, int folder)
1451 // Remove current pointers
1452 dst[0].remove_all();
1453 dst[1].remove_all_objects();
1455 // Create new pointers
1456 for( int i = 0; i < src->total; i++ ) {
1457 AssetPicon *picon = (AssetPicon*)src->values[i];
1459 (picon->indexable && picon->indexable->awindow_folder == folder) ||
1460 (picon->edl && picon->edl->local_session->awindow_folder == folder) ) {
1461 const char *text = search_text->get_text();
1462 int hidden = text && text[0] && !bstrcasestr(picon->get_text(), text);
1463 if( picon->vicon ) picon->vicon->hidden = hidden;
1464 if( hidden ) continue;
1465 BC_ListBoxItem *item2, *item1;
1466 dst[0].append(item1 = picon);
1468 dst[1].append(item2 = new BC_ListBoxItem(picon->edl->local_session->clip_notes));
1470 if( picon->label && picon->label->textstr )
1471 dst[1].append(item2 = new BC_ListBoxItem(picon->label->textstr));
1472 else if( picon->mtime ) {
1473 char date_time[BCSTRLEN];
1474 struct tm stm; localtime_r(&picon->mtime, &stm);
1475 sprintf(date_time,"%04d.%02d.%02d %02d:%02d:%02d",
1476 stm.tm_year+1900, stm.tm_mon+1, stm.tm_mday,
1477 stm.tm_hour, stm.tm_min, stm.tm_sec);
1478 dst[1].append(item2 = new BC_ListBoxItem(date_time));
1481 dst[1].append(item2 = new BC_ListBoxItem(""));
1482 item1->set_autoplace_text(1); item1->set_autoplace_icon(1);
1483 item2->set_autoplace_text(1); item2->set_autoplace_icon(1);
1488 void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src, int use_mtime)
1490 int done = 0, changed = 0;
1493 for( int i=0; i<src->total-1; ++i ) {
1494 AssetPicon *item1 = (AssetPicon *)src->values[i];
1495 AssetPicon *item2 = (AssetPicon *)src->values[i + 1];
1496 if( use_mtime ? item1->mtime > item2->mtime :
1497 strcmp(item1->get_text(), item2->get_text()) > 0 ) {
1498 src->values[i + 1] = item1;
1499 src->values[i] = item2;
1500 done = 0; changed = 1;
1505 for( int i=0; i<src->total; ++i ) {
1506 AssetPicon *item = (AssetPicon *)src->values[i];
1507 item->set_autoplace_icon(1);
1508 item->set_autoplace_text(1);
1514 void AWindowGUI::filter_displayed_assets()
1516 //allow_iconlisting = 1;
1517 asset_titles[0] = C_("Title");
1518 asset_titles[1] = _("Comments");
1520 switch( mwindow->edl->session->awindow_folder ) {
1521 case AW_AEFFECT_FOLDER:
1522 copy_picons(displayed_assets, &aeffects, AW_NO_FOLDER);
1524 case AW_VEFFECT_FOLDER:
1525 copy_picons(displayed_assets, &veffects, AW_NO_FOLDER);
1527 case AW_ATRANSITION_FOLDER:
1528 copy_picons(displayed_assets, &atransitions, AW_NO_FOLDER);
1530 case AW_VTRANSITION_FOLDER:
1531 copy_picons(displayed_assets, &vtransitions, AW_NO_FOLDER);
1533 case AW_LABEL_FOLDER:
1534 copy_picons(displayed_assets, &labellist, AW_NO_FOLDER);
1535 asset_titles[0] = _("Time Stamps");
1536 asset_titles[1] = C_("Title");
1537 //allow_iconlisting = 0;
1540 copy_picons(displayed_assets, &assets, mwindow->edl->session->awindow_folder);
1544 // Ensure the current folder icon is highlighted
1545 int selected_folder = mwindow->edl->session->awindow_folder;
1546 for( int i = 0; i < folders.total; i++ ) {
1547 AssetPicon *folder_item = (AssetPicon *)folders.values[i];
1548 int selected = folder_item->foldernum == selected_folder ? 1 : 0;
1549 folder_item->set_selected(selected);
1554 void AWindowGUI::update_assets()
1556 stop_vicon_drawing();
1557 update_folder_list();
1558 update_asset_list();
1559 labellist.remove_all_objects();
1560 create_label_folder();
1562 if( displayed_folder != mwindow->edl->session->awindow_folder )
1563 search_text->clear();
1564 filter_displayed_assets();
1566 if( mwindow->edl->session->folderlist_format != folder_list->get_format() ) {
1567 folder_list->update_format(mwindow->edl->session->folderlist_format, 0);
1569 int folder_xposition = folder_list->get_xposition();
1570 int folder_yposition = folder_list->get_yposition();
1571 folder_list->update(&folders, 0, 0, 1, folder_xposition, folder_yposition, -1);
1573 if( mwindow->edl->session->assetlist_format != asset_list->get_format() ) {
1574 asset_list->update_format(mwindow->edl->session->assetlist_format, 0);
1576 int asset_xposition = asset_list->get_xposition();
1577 int asset_yposition = asset_list->get_yposition();
1578 if( displayed_folder != mwindow->edl->session->awindow_folder ) {
1579 displayed_folder = mwindow->edl->session->awindow_folder;
1580 asset_xposition = asset_yposition = 0;
1582 asset_list->update(displayed_assets, asset_titles,
1583 mwindow->edl->session->asset_columns, ASSET_COLUMNS,
1584 asset_xposition, asset_yposition, -1, 0);
1585 asset_list->center_selection();
1588 start_vicon_drawing();
1592 void AWindowGUI::update_effects()
1594 aeffects.remove_all_objects();
1595 create_persistent_folder(&aeffects, 1, 0, 1, 0);
1596 veffects.remove_all_objects();
1597 create_persistent_folder(&veffects, 0, 1, 1, 0);
1598 atransitions.remove_all_objects();
1599 create_persistent_folder(&atransitions, 1, 0, 0, 1);
1600 vtransitions.remove_all_objects();
1601 create_persistent_folder(&vtransitions, 0, 1, 0, 1);
1604 int AWindowGUI::folder_number(const char *name)
1606 for( int i = 0; i < AWINDOW_FOLDERS; i++ ) {
1607 if( !strcasecmp(name, folder_names[i]) ) return i;
1609 return AW_NO_FOLDER;
1612 int AWindowGUI::drag_motion()
1614 if( get_hidden() ) return 0;
1620 int AWindowGUI::drag_stop()
1622 if( get_hidden() ) return 0;
1627 Indexable* AWindowGUI::selected_asset()
1629 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1630 return picon ? picon->indexable : 0;
1633 PluginServer* AWindowGUI::selected_plugin()
1635 AssetPicon *picon = (AssetPicon*)asset_list->get_selection(0, 0);
1636 return picon ? picon->plugin : 0;
1639 AssetPicon* AWindowGUI::selected_folder()
1641 AssetPicon *picon = (AssetPicon*)folder_list->get_selection(0, 0);
1652 AWindowDivider::AWindowDivider(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1653 : BC_SubWindow(x, y, w, h)
1655 this->mwindow = mwindow;
1658 AWindowDivider::~AWindowDivider()
1662 int AWindowDivider::button_press_event()
1664 if( is_event_win() && cursor_inside() ) {
1665 mwindow->session->current_operation = DRAG_PARTITION;
1671 int AWindowDivider::cursor_motion_event()
1673 if( mwindow->session->current_operation == DRAG_PARTITION ) {
1675 int wmax = mwindow->session->awindow_w - mwindow->theme->adivider_w - wmin;
1676 int fw = gui->get_relative_cursor_x();
1677 if( fw > wmax ) fw = wmax;
1678 if( fw < wmin ) fw = wmin;
1679 mwindow->session->afolders_w = fw;
1680 mwindow->theme->get_awindow_sizes(gui);
1681 gui->reposition_objects();
1687 int AWindowDivider::button_release_event()
1689 if( mwindow->session->current_operation == DRAG_PARTITION ) {
1690 mwindow->session->current_operation = NO_OPERATION;
1701 AWindowFolders::AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1702 : BC_ListBox(x, y, w, h,
1703 mwindow->edl->session->folderlist_format == ASSETS_ICONS ?
1704 LISTBOX_ICONS : LISTBOX_TEXT,
1705 &gui->folders, // Each column has an ArrayList of BC_ListBoxItems.
1706 0, // Titles for columns. Set to 0 for no titles
1707 0, // width of each column
1708 1, // Total columns.
1709 0, // Pixel of top of window.
1710 0, // If this listbox is a popup window
1711 LISTBOX_SINGLE, // Select one item or multiple items
1712 ICON_TOP, // Position of icon relative to text of each item
1715 this->mwindow = mwindow;
1720 AWindowFolders::~AWindowFolders()
1724 int AWindowFolders::selection_changed()
1726 AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
1728 gui->stop_vicon_drawing();
1730 if( get_button_down() && get_buttonpress() == 3 ) {
1731 gui->folderlist_menu->update_titles();
1732 gui->folderlist_menu->activate_menu();
1735 mwindow->edl->session->awindow_folder = picon->foldernum;
1736 gui->asset_list->draw_background();
1737 gui->async_update_assets();
1739 gui->start_vicon_drawing();
1744 int AWindowFolders::button_press_event()
1748 result = BC_ListBox::button_press_event();
1751 if( get_buttonpress() == 3 && is_event_win() && cursor_inside() ) {
1752 gui->folderlist_menu->update_titles();
1753 gui->folderlist_menu->activate_menu();
1768 AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
1769 : BC_ListBox(x, y, w, h,
1770 (mwindow->edl->session->assetlist_format == ASSETS_ICONS && gui->allow_iconlisting ) ?
1771 LISTBOX_ICONS : LISTBOX_TEXT,
1772 &gui->assets, // Each column has an ArrayList of BC_ListBoxItems.
1773 gui->asset_titles,// Titles for columns. Set to 0 for no titles
1774 mwindow->edl->session->asset_columns, // width of each column
1775 1, // Total columns.
1776 0, // Pixel of top of window.
1777 0, // If this listbox is a popup window
1778 LISTBOX_MULTIPLE, // Select one item or multiple items
1779 ICON_TOP, // Position of icon relative to text of each item
1780 -1) // Allow drags, require shift for scrolling
1782 this->mwindow = mwindow;
1785 set_scroll_stretch(1, 1);
1788 AWindowAssets::~AWindowAssets()
1792 int AWindowAssets::button_press_event()
1796 result = BC_ListBox::button_press_event();
1798 if( !result && get_buttonpress() == 3 && is_event_win() && cursor_inside() ) {
1799 BC_ListBox::deactivate_selection();
1800 int folder = mwindow->edl->session->awindow_folder;
1802 case AW_AEFFECT_FOLDER:
1803 case AW_VEFFECT_FOLDER:
1804 case AW_ATRANSITION_FOLDER:
1805 case AW_VTRANSITION_FOLDER:
1806 gui->effectlist_menu->update();
1807 gui->effectlist_menu->activate_menu();
1809 case AW_LABEL_FOLDER:
1810 gui->labellist_menu->update();
1811 gui->labellist_menu->activate_menu();
1813 case AW_CLIP_FOLDER:
1814 gui->cliplist_menu->update();
1815 gui->cliplist_menu->activate_menu();
1817 case AW_MEDIA_FOLDER:
1818 case AW_PROXY_FOLDER:
1819 gui->assetlist_menu->update_titles(folder==AW_MEDIA_FOLDER);
1820 gui->assetlist_menu->activate_menu();
1830 int AWindowAssets::handle_event()
1832 AssetPicon *asset_picon = (AssetPicon *)get_selection(0, 0);
1833 if( !asset_picon ) return 0;
1834 switch( mwindow->edl->session->awindow_folder ) {
1835 case AW_AEFFECT_FOLDER:
1836 case AW_VEFFECT_FOLDER:
1837 case AW_ATRANSITION_FOLDER:
1838 case AW_VTRANSITION_FOLDER: return 1;
1840 VWindow *vwindow = mwindow->vwindows.size() > DEFAULT_VWINDOW ?
1841 mwindow->vwindows.get(DEFAULT_VWINDOW) : 0;
1842 if( !vwindow || !vwindow->is_running() ) return 1;
1844 if( asset_picon->indexable )
1845 vwindow->change_source(asset_picon->indexable);
1846 else if( asset_picon->edl )
1847 vwindow->change_source(asset_picon->edl);
1851 int AWindowAssets::selection_changed()
1853 // Show popup window
1855 if( get_button_down() && get_buttonpress() == 3 &&
1856 (item = (AssetPicon*)get_selection(0, 0)) ) {
1857 int folder = mwindow->edl->session->awindow_folder;
1859 case AW_AEFFECT_FOLDER:
1860 case AW_VEFFECT_FOLDER:
1861 case AW_ATRANSITION_FOLDER:
1862 case AW_VTRANSITION_FOLDER:
1863 gui->effectlist_menu->update();
1864 gui->effectlist_menu->activate_menu();
1866 case AW_LABEL_FOLDER:
1867 if( !item->label ) break;
1868 gui->label_menu->activate_menu();
1870 case AW_CLIP_FOLDER:
1871 if( !item->indexable && !item->edl ) break;
1872 gui->clip_menu->update();
1873 gui->clip_menu->activate_menu();
1876 if( !item->indexable && !item->edl ) break;
1877 gui->asset_menu->update();
1878 gui->asset_menu->activate_menu();
1882 BC_ListBox::deactivate_selection();
1885 else if( gui->vicon_drawing &&
1886 get_button_down() && get_buttonpress() == 1 &&
1887 (item = (AssetPicon*)get_selection(0, 0)) ) {
1889 if( !gui->vicon_thread->viewing ) {
1890 vicon = item->vicon;
1892 gui->vicon_thread->set_view_popup(vicon);
1898 void AWindowAssets::draw_background()
1900 clear_box(0,0,get_w(),get_h(),get_bg_surface());
1901 set_color(BC_WindowBase::get_resources()->audiovideo_color);
1902 set_font(LARGEFONT);
1903 int aw_folder = mwindow->edl->session->awindow_folder;
1904 if( aw_folder < 0 ) return;
1905 const char *aw_name = _(AWindowGUI::folder_names[aw_folder]);
1906 draw_text(get_w() - get_text_width(LARGEFONT, aw_name) - 4, 30,
1907 aw_name, -1, get_bg_surface());
1910 int AWindowAssets::drag_start_event()
1912 int collect_pluginservers = 0;
1913 int collect_assets = 0;
1915 if( BC_ListBox::drag_start_event() ) {
1916 switch( mwindow->edl->session->awindow_folder ) {
1917 case AW_AEFFECT_FOLDER:
1918 mwindow->session->current_operation = DRAG_AEFFECT;
1919 collect_pluginservers = 1;
1921 case AW_VEFFECT_FOLDER:
1922 mwindow->session->current_operation = DRAG_VEFFECT;
1923 collect_pluginservers = 1;
1925 case AW_ATRANSITION_FOLDER:
1926 mwindow->session->current_operation = DRAG_ATRANSITION;
1927 collect_pluginservers = 1;
1929 case AW_VTRANSITION_FOLDER:
1930 mwindow->session->current_operation = DRAG_VTRANSITION;
1931 collect_pluginservers = 1;
1933 case AW_LABEL_FOLDER:
1937 mwindow->session->current_operation = DRAG_ASSET;
1942 if( collect_pluginservers ) {
1944 mwindow->session->drag_pluginservers->remove_all();
1947 AssetPicon *result = (AssetPicon*)get_selection(0, i++);
1948 if( !result ) break;
1950 mwindow->session->drag_pluginservers->append(result->plugin);
1954 if( collect_assets ) {
1955 gui->collect_assets();
1963 int AWindowAssets::drag_motion_event()
1965 BC_ListBox::drag_motion_event();
1968 mwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1969 mwindow->gui->drag_motion();
1970 mwindow->gui->unlock_window();
1972 for( int i = 0; i < mwindow->vwindows.size(); i++ ) {
1973 VWindow *vwindow = mwindow->vwindows.get(i);
1974 if( !vwindow->is_running() ) continue;
1975 vwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1976 vwindow->gui->drag_motion();
1977 vwindow->gui->unlock_window();
1980 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_motion_event");
1981 mwindow->cwindow->gui->drag_motion();
1982 mwindow->cwindow->gui->unlock_window();
1984 lock_window("AWindowAssets::drag_motion_event");
1988 int AWindowAssets::drag_stop_event()
1992 result = gui->drag_stop();
1997 mwindow->gui->lock_window("AWindowAssets::drag_stop_event");
1998 result = mwindow->gui->drag_stop();
1999 mwindow->gui->unlock_window();
2003 for( int i = 0; !result && i < mwindow->vwindows.size(); i++ ) {
2004 VWindow *vwindow = mwindow->vwindows.get(i);
2005 if( !vwindow ) continue;
2006 if( !vwindow->is_running() ) continue;
2007 if( vwindow->gui->is_hidden() ) continue;
2008 vwindow->gui->lock_window("AWindowAssets::drag_stop_event");
2009 if( vwindow->gui->cursor_above() &&
2010 vwindow->gui->get_cursor_over_window() ) {
2011 result = vwindow->gui->drag_stop();
2013 vwindow->gui->unlock_window();
2018 mwindow->cwindow->gui->lock_window("AWindowAssets::drag_stop_event");
2019 result = mwindow->cwindow->gui->drag_stop();
2020 mwindow->cwindow->gui->unlock_window();
2023 lock_window("AWindowAssets::drag_stop_event");
2026 get_drag_popup()->set_animation(0);
2028 BC_ListBox::drag_stop_event();
2029 // since NO_OPERATION is also defined in listbox, we have to reach for global scope...
2030 mwindow->session->current_operation = ::NO_OPERATION;
2034 int AWindowAssets::column_resize_event()
2036 mwindow->edl->session->asset_columns[0] = get_column_width(0);
2037 mwindow->edl->session->asset_columns[1] = get_column_width(1);
2041 int AWindowAssets::focus_in_event()
2043 gui->start_vicon_drawing();
2047 int AWindowAssets::focus_out_event()
2049 gui->stop_vicon_drawing();
2050 return BC_ListBox::focus_out_event();
2053 AWindowSearchTextBox::AWindowSearchTextBox(AWindowSearchText *search_text, int x, int y, int w)
2054 : BC_TextBox(x, y, w, 1, "")
2056 this->search_text = search_text;
2059 int AWindowSearchTextBox::handle_event()
2061 return search_text->handle_event();
2064 AWindowSearchText::AWindowSearchText(MWindow *mwindow, AWindowGUI *gui, int x, int y)
2066 this->mwindow = mwindow;
2072 void AWindowSearchText::create_objects()
2074 int x1 = x, y1 = y, margin = 10;
2075 gui->add_subwindow(text_title = new BC_Title(x1, y1, _("Search:")));
2076 x1 += text_title->get_w() + margin;
2077 int w1 = gui->get_w() - x1 - 2*margin;
2078 gui->add_subwindow(text_box = new AWindowSearchTextBox(this, x1, y1, w1));
2081 int AWindowSearchText::handle_event()
2083 gui->async_update_assets();
2087 int AWindowSearchText::get_w()
2089 return text_box->get_w() + text_title->get_w() + 10;
2092 int AWindowSearchText::get_h()
2094 return bmax(text_box->get_h(),text_title->get_h());
2097 void AWindowSearchText::reposition_window(int x, int y, int w)
2099 int x1 = x, y1 = y, margin = 10;
2100 text_title->reposition_window(x1, y1);
2101 x1 += text_title->get_w() + margin;
2102 int w1 = gui->get_w() - x1 - 2*margin;
2103 text_box->reposition_window(x1, y1, w1);
2106 const char *AWindowSearchText::get_text()
2108 return text_box->get_text();
2111 void AWindowSearchText::clear()
2113 text_box->update("");
2116 AWindowNewFolder::AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
2117 : BC_Button(x, y, mwindow->theme->newbin_data)
2119 this->mwindow = mwindow;
2121 set_tooltip(_("New bin"));
2124 int AWindowNewFolder::handle_event()
2126 gui->newfolder_thread->start_new_folder();
2130 AWindowDeleteFolder::AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
2131 : BC_Button(x, y, mwindow->theme->deletebin_data)
2133 this->mwindow = mwindow;
2135 set_tooltip(_("Delete bin"));
2138 int AWindowDeleteFolder::handle_event()
2140 if( gui->folder_list->get_selection(0, 0) ) {
2141 BC_ListBoxItem *folder = gui->folder_list->get_selection(0, 0);
2142 mwindow->delete_folder(folder->get_text());
2147 AWindowRenameFolder::AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
2148 : BC_Button(x, y, mwindow->theme->renamebin_data)
2150 this->mwindow = mwindow;
2152 set_tooltip(_("Rename bin"));
2155 int AWindowRenameFolder::handle_event()
2160 AWindowDeleteDisk::AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y)
2161 : BC_Button(x, y, mwindow->theme->deletedisk_data)
2163 this->mwindow = mwindow;
2165 set_tooltip(_("Delete asset from disk"));
2168 int AWindowDeleteDisk::handle_event()
2173 AWindowDeleteProject::AWindowDeleteProject(MWindow *mwindow, AWindowGUI *gui, int x, int y)
2174 : BC_Button(x, y, mwindow->theme->deleteproject_data)
2176 this->mwindow = mwindow;
2178 set_tooltip(_("Delete asset from project"));
2181 int AWindowDeleteProject::handle_event()
2186 // AWindowInfo::AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y)
2187 // : BC_Button(x, y, mwindow->theme->infoasset_data)
2189 // this->mwindow = mwindow;
2191 // set_tooltip(_("Edit information on asset"));
2194 // int AWindowInfo::handle_event()
2196 // int cur_x, cur_y;
2197 // gui->get_abs_cursor(cur_x, cur_y, 0);
2198 // gui->awindow->asset_edit->edit_asset(gui->selected_asset(), cur_x, cur_y);
2202 AWindowRedrawIndex::AWindowRedrawIndex(MWindow *mwindow, AWindowGUI *gui, int x, int y)
2203 : BC_Button(x, y, mwindow->theme->redrawindex_data)
2205 this->mwindow = mwindow;
2207 set_tooltip(_("Redraw index"));
2210 int AWindowRedrawIndex::handle_event()
2215 AWindowPaste::AWindowPaste(MWindow *mwindow, AWindowGUI *gui, int x, int y)
2216 : BC_Button(x, y, mwindow->theme->pasteasset_data)
2218 this->mwindow = mwindow;
2220 set_tooltip(_("Paste asset on recordable tracks"));
2223 int AWindowPaste::handle_event()
2228 AWindowAppend::AWindowAppend(MWindow *mwindow, AWindowGUI *gui, int x, int y)
2229 : BC_Button(x, y, mwindow->theme->appendasset_data)
2231 this->mwindow = mwindow;
2233 set_tooltip(_("Append asset in new tracks"));
2236 int AWindowAppend::handle_event()
2241 AWindowView::AWindowView(MWindow *mwindow, AWindowGUI *gui, int x, int y)
2242 : BC_Button(x, y, mwindow->theme->viewasset_data)
2244 this->mwindow = mwindow;
2246 set_tooltip(_("View asset"));
2249 int AWindowView::handle_event()
2254 AddTools::AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, const char *title)
2255 : BC_PopupMenu(x, y, BC_Title::calculate_w(gui, title, MEDIUMFONT)+8, title, -1, 0, 4)
2257 this->mwindow = mwindow;
2261 void AddTools::create_objects()
2264 add_item(new AddPluginItem(this, "ladspa", PLUGIN_LADSPA_ID));
2265 vis |= 1 << PLUGIN_LADSPA_ID;
2266 add_item(new AddPluginItem(this, "ffmpeg", PLUGIN_FFMPEG_ID));
2267 vis |= 1 << PLUGIN_FFMPEG_ID;
2268 for( int i=0; i<MWindow::plugindb->size(); ++i ) {
2269 PluginServer *plugin = MWindow::plugindb->get(i);
2270 if( !plugin->audio && !plugin->video ) continue;
2271 int idx = plugin->dir_idx;
2272 uint32_t msk = 1 << idx;
2273 if( (msk & vis) != 0 ) continue;
2275 char parent[BCTEXTLEN];
2276 strcpy(parent, plugin->path);
2277 char *bp = strrchr(parent, '/');
2278 if( bp ) { *bp = 0; bp = strrchr(parent, '/'); }
2279 if( !bp ) bp = parent; else ++bp;
2280 add_item(new AddPluginItem(this, bp, idx));
2285 // plugin_dirs list from toplevel makefile include plugin_defs
2289 N_("audio_transitions")
2296 N_("video_transitions")
2299 AddPluginItem::AddPluginItem(AddTools *menu, char const *text, int idx)
2300 : BC_MenuItem(_(text))
2304 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
2305 int chk = (msk & vis) ? 1 : 0;
2309 int AddPluginItem::handle_event()
2311 int chk = get_checked() ^ 1;
2313 uint64_t msk = (uint64_t)1 << idx, vis = menu->gui->plugin_visibility;
2314 menu->gui->plugin_visibility = chk ? vis | msk : vis & ~msk;
2315 menu->gui->update_effects();
2316 menu->gui->save_defaults(menu->mwindow->defaults);
2317 menu->gui->async_update_assets();
2321 AVIconDrawing::AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images)
2322 : BC_Toggle(x, y, images, agui->vicon_drawing)
2325 set_tooltip(_("draw vicons"));
2328 void AVIconDrawing::calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh)
2330 int text_line = -1, toggle_x = -1, toggle_y = -1;
2331 int text_x = -1, text_y = -1, text_w = -1, text_h = -1;
2332 BC_Toggle::calculate_extents(agui, images, 1,
2333 &text_line, ww, hh, &toggle_x, &toggle_y,
2334 &text_x, &text_y, &text_w, &text_h, "", MEDIUMFONT);
2337 AVIconDrawing::~AVIconDrawing()
2341 int AVIconDrawing::handle_event()
2343 agui->vicon_drawing = get_value();
2344 if( agui->vicon_drawing )
2345 agui->start_vicon_drawing();
2347 agui->stop_vicon_drawing();
2352 AWindowListFormat::AWindowListFormat(MWindow *mwindow, AWindowGUI *gui)
2355 this->mwindow = mwindow;
2359 int AWindowListFormat::handle_event()
2361 gui->stop_vicon_drawing();
2363 EDLSession *session = mwindow->edl->session;
2364 switch( session->assetlist_format ) {
2366 session->assetlist_format = ASSETS_ICONS;
2369 session->assetlist_format = ASSETS_TEXT;
2373 gui->asset_list->update_format(session->assetlist_format, 1);
2374 if( !mwindow->awindow->gui->allow_iconlisting ) {
2375 mwindow->edl->session->assetlist_format = ASSETS_TEXT;
2378 gui->start_vicon_drawing();
2382 void AWindowListFormat::update()
2384 set_text(mwindow->edl->session->assetlist_format == ASSETS_TEXT ?
2385 (char*)_("Display icons") : (char*)_("Display text"));
2388 AWindowListSort::AWindowListSort(MWindow *mwindow, AWindowGUI *gui)
2389 : BC_MenuItem(_("Sort items"))
2391 this->mwindow = mwindow;
2395 int AWindowListSort::handle_event()
2397 gui->sort_assets(0);