4 * Copyright (C) 2008 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
22 #include "browsebutton.h"
24 #include "cplayback.h"
28 #include "edlsession.h"
29 #include "filesystem.h"
31 #include "interlacemodes.h"
33 #include "levelwindow.h"
34 #include "mainerror.h"
39 #include "mwindowgui.h"
41 #include "newpresets.h"
42 #include "mainsession.h"
44 #include "preferences.h"
46 #include "transportque.h"
49 #include "videowindow.h"
50 #include "vplayback.h"
59 #define HEIGHT0 yS(585)
61 #define HEIGHT1 yS(240)
62 // offset for folder panel
63 #define HEIGHT2 yS(440)
65 New::New(MWindow *mwindow)
67 this->mwindow = mwindow;
77 int New::handle_event()
79 mwindow->gui->unlock_window();
80 mwindow->edl->save_defaults(mwindow->defaults);
83 mwindow->gui->lock_window("New::handle_event");
88 void New::create_new_edl()
92 new_edl->create_objects();
93 new_edl->load_defaults(mwindow->defaults);
98 int New::create_new_project(int load_mode)
100 mwindow->stop_playback(0);
101 mwindow->gui->lock_window();
102 mwindow->reset_caches();
104 memcpy(new_edl->session->achannel_positions,
105 &mwindow->preferences->channel_positions[new_edl->session->audio_channels - 1],
106 sizeof(new_edl->session->achannel_positions));
107 new_edl->session->boundaries();
108 new_edl->create_default_tracks();
109 if( load_mode == LOADMODE_NEW_TRACKS ) {
110 Tracks *tracks = mwindow->edl->tracks;
111 int vindex = tracks->total_video_tracks();
112 int aindex = tracks->total_audio_tracks();
113 for( Track *track=new_edl->tracks->first; track; track=track->next ) {
114 switch( track->data_type ) {
116 sprintf(track->title, _("Audio %d"), ++aindex);
119 sprintf(track->title, _("Video %d"), ++vindex);
124 mwindow->undo->update_undo_before();
125 mwindow->set_filename(new_edl->path);
126 ArrayList<EDL *>new_edls;
127 new_edls.append(new_edl);
128 mwindow->paste_edls(&new_edls, load_mode, 0,0,0,0,0,0);
129 new_edl->remove_user();
132 // Load file sequence
133 mwindow->update_project(load_mode);
134 mwindow->session->changes_made = 0;
135 mwindow->undo->update_undo_after(load_mode == LOADMODE_REPLACE ?
136 _("New Project") : _("Append to Project"), LOAD_ALL);
137 mwindow->gui->unlock_window();
141 NewProject::NewProject(MWindow *mwindow)
142 : BC_MenuItem(_("New Project..."), "n", 'n'), New(mwindow)
145 NewProject::~NewProject()
149 void NewProject::create_objects()
151 thread = new NewThread(mwindow, this,
152 _(PROGRAM_NAME ": New Project"), LOADMODE_REPLACE);
155 AppendTracks::AppendTracks(MWindow *mwindow)
156 : BC_MenuItem(_("Append to Project..."), "Shift-N", 'N'), New(mwindow)
160 AppendTracks::~AppendTracks()
164 void AppendTracks::create_objects()
166 thread = new NewThread(mwindow, this,
167 _(PROGRAM_NAME ": Append to Project"), LOADMODE_NEW_TRACKS);
171 NewThread::NewThread(MWindow *mwindow, New *new_project,
172 const char *title, int load_mode)
175 this->mwindow = mwindow;
176 this->new_project = new_project;
178 this->load_mode = load_mode;
182 NewThread::~NewThread()
187 BC_Window* NewThread::new_gui()
189 mwindow->edl->save_defaults(mwindow->defaults);
190 new_project->create_new_edl();
193 mwindow->gui->lock_window("NewThread::new_gui");
194 int x = mwindow->gui->get_pop_cursor_x(0);
195 int y = mwindow->gui->get_pop_cursor_y(0);
197 nwindow = new NewWindow(mwindow, this, x, y);
198 nwindow->create_objects();
199 mwindow->gui->unlock_window();
203 void NewThread::handle_done_event(int result)
205 if( !result && nwindow->folder && nwindow->name ) {
206 const char *project_folder = nwindow->folder->get_text();
207 const char *project_name = nwindow->name->get_text();
208 if( project_folder[0] && project_name[0] ) {
209 nwindow->recent_folder->add_item("PROJECT", project_folder);
210 char project_path[BCTEXTLEN], *ep = project_path + sizeof(project_path);
211 FileSystem fs; fs.join_names(project_path, project_folder, project_name);
212 char *bp = strrchr(project_path, '/');
213 if( !bp ) bp = project_path;
214 bp = strrchr(bp, '.');
215 if( !bp ) bp = project_path + strlen(project_path);
216 if( strcasecmp(bp,".xml") ) snprintf(bp, ep-bp, ".xml");
217 fs.complete_path(project_path);
218 EDL *new_edl = new_project->new_edl;
219 bp = FileSystem::basepath(project_path);
220 strcpy(new_edl->path, bp); delete [] bp;
225 void NewThread::handle_close_event(int result)
227 if( !new_project->new_edl ) return;
230 char *path = new_project->new_edl->path;
233 while( *bp == '/' ) ++bp;
234 if( !(bp = strchr(bp, '/')) ) break;
235 char dir_path[BCTEXTLEN];
237 strncpy(dir_path, path, len);
239 if( fs.is_dir(dir_path) ) continue;
240 if( fs.create_dir(dir_path) ) {
241 eprintf(_("Cannot create and access project path:\n%s"),
248 new_project->new_edl->save_defaults(mwindow->defaults);
249 mwindow->defaults->save();
250 new_project->create_new_project(load_mode);
253 new_project->new_edl->Garbage::remove_user();
254 new_project->new_edl = 0;
258 int NewThread::load_defaults()
260 auto_aspect = mwindow->defaults->get("AUTOASPECT", 0);
264 int NewThread::save_defaults()
266 mwindow->defaults->update("AUTOASPECT", auto_aspect);
270 int NewThread::update_aspect()
273 char string[BCTEXTLEN];
274 mwindow->create_aspect_ratio(new_project->new_edl->session->aspect_w,
275 new_project->new_edl->session->aspect_h,
276 new_project->new_edl->session->output_w,
277 new_project->new_edl->session->output_h);
278 sprintf(string, "%.02f", new_project->new_edl->session->aspect_w);
279 if( nwindow->aspect_w_text ) nwindow->aspect_w_text->update(string);
280 sprintf(string, "%.02f", new_project->new_edl->session->aspect_h);
281 if( nwindow->aspect_h_text )nwindow->aspect_h_text->update(string);
287 NewWindow::NewWindow(MWindow *mwindow, NewThread *new_thread, int x, int y)
288 : BC_Window(new_thread->title, x, y,
289 WIDTH, new_thread->load_mode == LOADMODE_REPLACE ? HEIGHT0 : HEIGHT1,
292 this->mwindow = mwindow;
293 this->new_thread = new_thread;
294 this->new_edl = new_thread->new_project->new_edl;
305 interlace_pulldown = 0;
312 NewWindow::~NewWindow()
314 lock_window("NewWindow::~NewWindow");
315 delete format_presets;
319 void NewWindow::create_objects()
321 int xs10 = xS(10), xs20 = xS(20);
322 int ys5 = yS(5), ys10 = yS(10), ys20 = yS(20), ys30 = yS(30);
323 int xs2 = xS(2), xs64 = xS(64), xs115 = xS(115), xs150 = xS(150);
325 int x = xs10, y = ys10, x1, y1;
329 lock_window("NewWindow::create_objects");
330 mwindow->theme->draw_new_bg(this);
332 add_subwindow( new BC_Title(x, y, new_thread->load_mode == LOADMODE_REPLACE ?
333 _("Parameters for the new project:") :
334 _("Parameters for additional tracks:") ) );
337 format_presets = new NewPresets(mwindow, this, x, y);
338 format_presets->create_objects();
339 x = format_presets->x;
340 y = format_presets->y;
344 add_subwindow(new BC_Title(x, y, _("Audio"), LARGEFONT));
348 add_subwindow(new BC_Title(x1, y, _("Tracks:")));
351 add_subwindow(atracks = new NewATracks(this, "", x1, y));
352 x1 += atracks->get_w();
353 add_subwindow(new NewATracksTumbler(this, x1, y));
354 y += atracks->get_h() + ys5;
356 if( new_thread->load_mode == LOADMODE_REPLACE ) {
358 add_subwindow(new BC_Title(x1, y, _("Channels:")));
360 add_subwindow(achannels = new NewAChannels(this, "", x1, y));
361 x1 += achannels->get_w();
362 add_subwindow(new NewAChannelsTumbler(this, x1, y));
363 y += achannels->get_h() + ys5;
366 add_subwindow(new BC_Title(x1, y, _("Samplerate:")));
368 add_subwindow(sample_rate = new NewSampleRate(this, "", x1, y));
369 x1 += sample_rate->get_w();
370 add_subwindow(new SampleRatePulldown(mwindow, sample_rate, x1, y));
375 add_subwindow(new BC_Title(x, y, _("Video"), LARGEFONT));
378 add_subwindow(new BC_Title(x1, y, _("Tracks:")));
380 add_subwindow(vtracks = new NewVTracks(this, "", x1, y));
381 x1 += vtracks->get_w();
382 add_subwindow(new NewVTracksTumbler(this, x1, y));
383 y += vtracks->get_h() + ys5;
385 if( new_thread->load_mode == LOADMODE_REPLACE ) {
387 // add_subwindow(new BC_Title(x1, y, _("Channels:")));
389 // add_subwindow(vchannels = new NewVChannels(this, "", x1, y));
390 // x1 += vchannels->get_w();
391 // add_subwindow(new NewVChannelsTumbler(this, x1, y));
392 // y += vchannels->get_h() + ys5;
394 add_subwindow(new BC_Title(x1, y, _("Framerate:")));
396 add_subwindow(frame_rate = new NewFrameRate(this, "", x1, y));
397 x1 += frame_rate->get_w();
398 add_subwindow(new FrameRatePulldown(mwindow, frame_rate, x1, y));
399 y += frame_rate->get_h() + ys5;
402 // add_subwindow(new BC_Title(x1, y, _("Canvas size:")));
404 // add_subwindow(canvas_w_text = new NewTrackW(this, x1, y));
405 // x1 += canvas_w_text->get_w() + xs2;
406 // add_subwindow(new BC_Title(x1, y, "x"));
408 // add_subwindow(canvas_h_text = new NewTrackH(this, x1, y));
409 // x1 += canvas_h_text->get_w();
410 // add_subwindow(new FrameSizePulldown(mwindow,
411 // canvas_w_text, canvas_h_text, x1, y));
413 // add_subwindow(new NewCloneToggle(mwindow, this, x1, y));
414 // y += canvas_h_text->get_h() + ys5;
417 add_subwindow(new BC_Title(x1, y, new_thread->load_mode == LOADMODE_REPLACE ?
418 _("Canvas size:") : _("Track size:")));
420 add_subwindow(output_w_text = new NewOutputW(this, x1, y));
421 x1 += output_w_text->get_w() + xs2;
422 add_subwindow(new BC_Title(x1, y, "x"));
424 add_subwindow(output_h_text = new NewOutputH(this, x1, y));
425 x1 += output_h_text->get_w();
426 FrameSizePulldown *pulldown;
427 add_subwindow(pulldown = new FrameSizePulldown(mwindow->theme,
428 output_w_text, output_h_text, x1, y));
429 x1 += pulldown->get_w() + xs10;
430 add_subwindow(new NewSwapExtents(mwindow, this, x1, y));
431 y += output_h_text->get_h() + ys5;
433 if( new_thread->load_mode == LOADMODE_REPLACE ) {
435 add_subwindow(new BC_Title(x1, y, _("Aspect ratio:")));
437 add_subwindow(aspect_w_text = new NewAspectW(this, "", x1, y));
438 x1 += aspect_w_text->get_w() + xs2;
439 add_subwindow(new BC_Title(x1, y, ":"));
441 add_subwindow(aspect_h_text = new NewAspectH(this, "", x1, y));
442 x1 += aspect_h_text->get_w();
443 add_subwindow(new AspectPulldown(mwindow,
444 aspect_w_text, aspect_h_text, x1, y));
446 x1 = aspect_w_text->get_x();
447 y += aspect_w_text->get_h() + ys5;
448 add_subwindow(new NewAspectAuto(this, x1, y));
450 add_subwindow(title = new BC_Title(x, y, _("Color model:")));
451 x1 = x + title->get_w();
452 y1 = y; y += title->get_h() + ys10;
453 add_subwindow(title = new BC_Title(x, y, _("Interlace mode:")));
454 int x2 = x + title->get_w();
455 int y2 = y; y += title->get_h() + ys10;
456 if( x1 < x2 ) x1 = x2;
458 add_subwindow(textbox = new BC_TextBox(x1, y1, xs150, 1, ""));
459 add_subwindow(color_model = new ColormodelPulldown(mwindow,
460 textbox, &new_edl->session->color_model, x1+textbox->get_w(), y1));
461 add_subwindow(textbox = new BC_TextBox(x1, y2, xs150, 1, ""));
462 add_subwindow(interlace_pulldown = new InterlacemodePulldown(mwindow,
463 textbox, &new_edl->session->interlace_mode,
464 (ArrayList<BC_ListBoxItem*>*)&mwindow->interlace_project_modes,
465 x1+textbox->get_w(), y2));
467 x = xs20; y = HEIGHT2;
468 add_subwindow(title = new BC_Title(x, y, _("Create project folder in:")));
469 x1 = x; y += title->get_h() + ys5;
470 add_subwindow(folder = new BC_TextBox(x1, y, get_w()-x1-xs64, 1, ""));
471 x1 += folder->get_w() + xs10;
472 add_subwindow(recent_folder = new BC_RecentList("FOLDER", mwindow->defaults, folder));
473 recent_folder->load_items("PROJECT");
474 x1 = recent_folder->get_x() + recent_folder->get_w();
475 add_subwindow(new BrowseButton(mwindow->theme, this, folder, x1, y, "",
476 _("Project Directory"), _("Project Directory Path:"), 1));
477 y += folder->get_h() + ys10; x1 = x;
478 add_subwindow(title = new BC_Title(x1, y, _("Project Name:")));
479 x1 += title->get_w() + xs10;
480 add_subwindow(name = new BC_TextBox(x1, y, get_w()-x1-xs64, 1, ""));
483 add_subwindow(new BC_OKButton(this,
484 mwindow->theme->get_image_set("new_ok_images")));
485 add_subwindow(new BC_CancelButton(this,
486 mwindow->theme->get_image_set("new_cancel_images")));
493 int NewWindow::update()
495 if( atracks ) atracks->update((int64_t)new_edl->session->audio_tracks);
496 if( achannels ) achannels->update((int64_t)new_edl->session->audio_channels);
497 if( sample_rate ) sample_rate->update((int64_t)new_edl->session->sample_rate);
498 if( vtracks ) vtracks->update((int64_t)new_edl->session->video_tracks);
499 if( frame_rate ) frame_rate->update((float)new_edl->session->frame_rate);
500 if( output_w_text ) output_w_text->update((int64_t)new_edl->session->output_w);
501 if( output_h_text ) output_h_text->update((int64_t)new_edl->session->output_h);
502 if( aspect_w_text ) aspect_w_text->update((float)new_edl->session->aspect_w);
503 if( aspect_h_text ) aspect_h_text->update((float)new_edl->session->aspect_h);
504 if( interlace_pulldown ) interlace_pulldown->update(new_edl->session->interlace_mode);
505 if( color_model ) color_model->update_value(new_edl->session->color_model);
510 NewPresets::NewPresets(MWindow *mwindow, NewWindow *gui, int x, int y)
511 : FormatPresets(mwindow, gui, 0, x, y)
515 NewPresets::~NewPresets()
519 int NewPresets::handle_event()
525 EDL* NewPresets::get_edl()
527 return new_gui->new_edl;
531 NewATracks::NewATracks(NewWindow *nwindow, const char *text, int x, int y)
532 : BC_TextBox(x, y, xS(90), 1, text)
534 this->nwindow = nwindow;
537 int NewATracks::handle_event()
539 nwindow->new_edl->session->audio_tracks = atol(get_text());
543 NewATracksTumbler::NewATracksTumbler(NewWindow *nwindow, int x, int y)
546 this->nwindow = nwindow;
548 int NewATracksTumbler::handle_up_event()
550 nwindow->new_edl->session->audio_tracks++;
551 nwindow->new_edl->boundaries();
555 int NewATracksTumbler::handle_down_event()
557 nwindow->new_edl->session->audio_tracks--;
558 nwindow->new_edl->boundaries();
564 NewAChannels::NewAChannels(NewWindow *nwindow, const char *text, int x, int y)
565 : BC_TextBox(x, y, xS(90), 1, text)
567 this->nwindow = nwindow;
570 int NewAChannels::handle_event()
572 nwindow->new_edl->session->audio_channels = atol(get_text());
577 NewAChannelsTumbler::NewAChannelsTumbler(NewWindow *nwindow, int x, int y)
580 this->nwindow = nwindow;
582 int NewAChannelsTumbler::handle_up_event()
584 nwindow->new_edl->session->audio_channels++;
585 nwindow->new_edl->boundaries();
589 int NewAChannelsTumbler::handle_down_event()
591 nwindow->new_edl->session->audio_channels--;
592 nwindow->new_edl->boundaries();
598 NewSampleRate::NewSampleRate(NewWindow *nwindow, const char *text, int x, int y)
599 : BC_TextBox(x, y, xS(90), 1, text)
601 this->nwindow = nwindow;
604 int NewSampleRate::handle_event()
606 nwindow->new_edl->session->sample_rate = atol(get_text());
611 SampleRatePulldown::SampleRatePulldown(MWindow *mwindow, BC_TextBox *output, int x, int y)
612 : BC_ListBox(x, y, xS(100), xS(200), LISTBOX_TEXT,
613 &mwindow->theme->sample_rates, 0, 0, 1, 0, 1)
615 this->mwindow = mwindow;
616 this->output = output;
618 int SampleRatePulldown::handle_event()
620 char *text = get_selection(0, 0)->get_text();
621 output->update(text);
622 output->handle_event();
627 NewVTracks::NewVTracks(NewWindow *nwindow, const char *text, int x, int y)
628 : BC_TextBox(x, y, xS(90), 1, text)
630 this->nwindow = nwindow;
633 int NewVTracks::handle_event()
635 nwindow->new_edl->session->video_tracks = atol(get_text());
640 NewVTracksTumbler::NewVTracksTumbler(NewWindow *nwindow, int x, int y)
643 this->nwindow = nwindow;
645 int NewVTracksTumbler::handle_up_event()
647 nwindow->new_edl->session->video_tracks++;
648 nwindow->new_edl->boundaries();
652 int NewVTracksTumbler::handle_down_event()
654 nwindow->new_edl->session->video_tracks--;
655 nwindow->new_edl->boundaries();
661 NewVChannels::NewVChannels(NewWindow *nwindow, const char *text, int x, int y)
662 : BC_TextBox(x, y, xS(90), 1, text)
664 this->nwindow = nwindow;
667 int NewVChannels::handle_event()
669 nwindow->new_edl->session->video_channels = atol(get_text());
674 NewVChannelsTumbler::NewVChannelsTumbler(NewWindow *nwindow, int x, int y)
677 this->nwindow = nwindow;
679 int NewVChannelsTumbler::handle_up_event()
681 nwindow->new_edl->session->video_channels++;
682 nwindow->new_edl->boundaries();
686 int NewVChannelsTumbler::handle_down_event()
688 nwindow->new_edl->session->video_channels--;
689 nwindow->new_edl->boundaries();
695 NewFrameRate::NewFrameRate(NewWindow *nwindow, const char *text, int x, int y)
696 : BC_TextBox(x, y, xS(90), 1, text)
698 this->nwindow = nwindow;
701 int NewFrameRate::handle_event()
703 nwindow->new_edl->session->frame_rate = Units::atoframerate(get_text());
708 FrameRatePulldown::FrameRatePulldown(MWindow *mwindow,
709 BC_TextBox *output, int x, int y)
710 : BC_ListBox(x, y, xS(150), yS(250), LISTBOX_TEXT,
711 &mwindow->theme->frame_rates, 0, 0, 1, 0, 1)
713 this->mwindow = mwindow;
714 this->output = output;
716 int FrameRatePulldown::handle_event()
718 char *text = get_selection(0, 0)->get_text();
719 output->update(text);
720 output->handle_event();
724 FrameSizePulldown::FrameSizePulldown(Theme *theme,
725 BC_TextBox *output_w, BC_TextBox *output_h, int x, int y)
726 : BC_ListBox(x, y, xS(180), yS(250), LISTBOX_TEXT,
727 &theme->frame_sizes, 0, 0, 1, 0, 1)
730 this->output_w = output_w;
731 this->output_h = output_h;
734 int FrameSizePulldown::handle_event()
736 char *text = get_selection(0, 0)->get_text();
737 char string[BCTEXTLEN];
741 strcpy(string, text);
742 ptr = strrchr(string, 'x');
751 output_w->handle_event();
752 output_h->handle_event();
758 NewOutputW::NewOutputW(NewWindow *nwindow, int x, int y)
759 : BC_TextBox(x, y, xS(70), 1, nwindow->new_edl->session->output_w)
761 this->nwindow = nwindow;
763 int NewOutputW::handle_event()
765 nwindow->new_edl->session->output_w = MAX(1,atol(get_text()));
766 nwindow->new_thread->update_aspect();
771 NewOutputH::NewOutputH(NewWindow *nwindow, int x, int y)
772 : BC_TextBox(x, y, xS(70), 1, nwindow->new_edl->session->output_h)
774 this->nwindow = nwindow;
776 int NewOutputH::handle_event()
778 nwindow->new_edl->session->output_h = MAX(1, atol(get_text()));
779 nwindow->new_thread->update_aspect();
784 NewAspectW::NewAspectW(NewWindow *nwindow, const char *text, int x, int y)
785 : BC_TextBox(x, y, xS(70), 1, text)
787 this->nwindow = nwindow;
790 int NewAspectW::handle_event()
792 nwindow->new_edl->session->aspect_w = atof(get_text());
797 NewAspectH::NewAspectH(NewWindow *nwindow, const char *text, int x, int y)
798 : BC_TextBox(x, y, xS(70), 1, text)
800 this->nwindow = nwindow;
803 int NewAspectH::handle_event()
805 nwindow->new_edl->session->aspect_h = atof(get_text());
810 AspectPulldown::AspectPulldown(MWindow *mwindow,
811 BC_TextBox *output_w, BC_TextBox *output_h, int x, int y)
812 : BC_ListBox(x, y, xS(100), yS(200), LISTBOX_TEXT,
813 &mwindow->theme->aspect_ratios, 0, 0, 1, 0, 1)
815 this->mwindow = mwindow;
816 this->output_w = output_w;
817 this->output_h = output_h;
820 int AspectPulldown::handle_event()
822 char *text = get_selection(0, 0)->get_text();
823 char string[BCTEXTLEN];
827 strcpy(string, text);
828 ptr = strrchr(string, ':');
837 output_w->handle_event();
838 output_h->handle_event();
844 ColormodelItem::ColormodelItem(const char *text, int value)
845 : BC_ListBoxItem(text)
850 ColormodelPulldown::ColormodelPulldown(MWindow *mwindow,
851 BC_TextBox *output_text, int *output_value, int x, int y)
852 : BC_ListBox(x, y, xS(200), yS(150), LISTBOX_TEXT,
853 (ArrayList<BC_ListBoxItem*>*)&mwindow->colormodels, 0, 0, 1, 0, 1)
855 this->mwindow = mwindow;
856 this->output_text = output_text;
857 this->output_value = output_value;
858 output_text->update(colormodel_to_text());
861 int ColormodelPulldown::handle_event()
863 output_text->update(get_selection(0, 0)->get_text());
864 *output_value = ((ColormodelItem*)get_selection(0, 0))->value;
868 const char* ColormodelPulldown::colormodel_to_text()
870 for( int i=0; i<mwindow->colormodels.total; ++i )
871 if( mwindow->colormodels.values[i]->value == *output_value )
872 return mwindow->colormodels.values[i]->get_text();
876 void ColormodelPulldown::update_value(int value)
878 *output_value = value;
879 output_text->update(colormodel_to_text());
883 InterlacemodeItem::InterlacemodeItem(const char *text, int value)
884 : BC_ListBoxItem(text)
889 InterlacemodePulldown::InterlacemodePulldown(MWindow *mwindow,
890 BC_TextBox *output_text,
892 ArrayList<BC_ListBoxItem*> *data,
895 : BC_ListBox(x, y, xS(200), xS(150), LISTBOX_TEXT, data, 0, 0, 1, 0, 1)
897 this->mwindow = mwindow;
898 this->output_text = output_text;
899 this->output_value = output_value;
900 output_text->update(interlacemode_to_text());
903 int InterlacemodePulldown::handle_event()
905 output_text->update(get_selection(0, 0)->get_text());
906 *output_value = ((InterlacemodeItem*)get_selection(0, 0))->value;
910 const char* InterlacemodePulldown::interlacemode_to_text()
912 ilacemode_to_text(this->string,*output_value);
913 return (this->string);
916 int InterlacemodePulldown::update(int interlace_mode)
918 *output_value = interlace_mode;
919 output_text->update(interlacemode_to_text());
924 NewAspectAuto::NewAspectAuto(NewWindow *nwindow, int x, int y)
925 : BC_CheckBox(x, y, nwindow->new_thread->auto_aspect, _("Auto aspect ratio"))
927 this->nwindow = nwindow;
929 NewAspectAuto::~NewAspectAuto()
932 int NewAspectAuto::handle_event()
934 nwindow->new_thread->auto_aspect = get_value();
935 nwindow->new_thread->update_aspect();
940 NewSwapExtents::NewSwapExtents(MWindow *mwindow, NewWindow *gui, int x, int y)
941 : BC_Button(x, y, mwindow->theme->get_image_set("swap_extents"))
943 this->mwindow = mwindow;
945 set_tooltip(_("Swap dimensions"));
948 int NewSwapExtents::handle_event()
950 int w = gui->new_edl->session->output_w;
951 int h = gui->new_edl->session->output_h;
952 gui->new_edl->session->output_w = h;
953 gui->new_edl->session->output_h = w;
954 gui->output_w_text->update((int64_t)h);
955 gui->output_h_text->update((int64_t)w);
956 gui->new_thread->update_aspect();