add bluray support, add dialog close fixes, scale fix
[goodguy/history.git] / cinelerra-5.0 / cinelerra / new.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  * 
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.
10  * 
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.
15  * 
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
19  * 
20  */
21
22 #include "clip.h"
23 #include "cplayback.h"
24 #include "cwindow.h"
25 #include "bchash.h"
26 #include "edl.h"
27 #include "edlsession.h"
28 #include "filexml.h"
29 #include "language.h"
30 #include "levelwindow.h"
31 #include "mainundo.h"
32 #include "mainmenu.h"
33 #include "mutex.h"
34 #include "mwindow.h"
35 #include "mwindowgui.h"
36 #include "new.h"
37 #include "newpresets.h"
38 #include "mainsession.h"
39 #include "patchbay.h"
40 #include "preferences.h"
41 #include "theme.h"
42 #include "transportque.h"
43 #include "videowindow.h"
44 #include "vplayback.h"
45 #include "vwindow.h"
46
47
48 #include <string.h>
49
50
51 #define WIDTH 600
52 #define HEIGHT 400
53
54
55 New::New(MWindow *mwindow)
56  : BC_MenuItem(_("New..."), "n", 'n')
57 {
58         this->mwindow = mwindow;
59         script = 0;
60         new_edl = 0;
61         thread = 0;
62 }
63
64 New::~New()
65 {
66         delete thread;
67 }
68
69 void New::create_objects()
70 {
71         thread = new NewThread(mwindow, this);
72 }
73
74 int New::handle_event() 
75 {
76         mwindow->gui->unlock_window();
77         thread->start();
78         mwindow->gui->lock_window("New::handle_event");
79
80         return 1;
81 }
82
83 void New::create_new_edl()
84 {
85         if(!new_edl)
86         {
87                 new_edl = new EDL;
88                 new_edl->create_objects();
89                 new_edl->load_defaults(mwindow->defaults);
90         }
91 }
92
93
94 int New::create_new_project()
95 {
96         mwindow->cwindow->playback_engine->que->send_command(STOP,
97                 CHANGE_NONE, 
98                 0,
99                 0);
100
101         for(int i = 0; i < mwindow->vwindows.size(); i++)
102         {
103                 mwindow->vwindows.get(i)->playback_engine->que->send_command(STOP,
104                         CHANGE_NONE, 
105                         0,
106                         0);
107                 mwindow->vwindows.get(i)->playback_engine->interrupt_playback(0);
108         }
109
110         mwindow->cwindow->playback_engine->interrupt_playback(0);
111
112         mwindow->gui->lock_window();
113         mwindow->reset_caches();
114
115
116
117         memcpy(new_edl->session->achannel_positions,
118                 &mwindow->preferences->channel_positions[
119                         MAXCHANNELS * (new_edl->session->audio_channels - 1)],
120                 sizeof(int) * MAXCHANNELS);
121         new_edl->session->boundaries();
122         new_edl->create_default_tracks();
123
124         mwindow->undo->update_undo_before();
125         mwindow->set_filename("");
126
127         mwindow->hide_plugins();
128         mwindow->edl->Garbage::remove_user();
129         mwindow->edl = new_edl;
130         new_edl = 0;
131         mwindow->save_defaults();
132
133 // Load file sequence
134         mwindow->update_project(LOADMODE_REPLACE);
135         mwindow->session->changes_made = 0;
136         mwindow->undo->update_undo_after(_("New"), LOAD_ALL);
137         mwindow->gui->unlock_window();
138         return 0;
139 }
140
141 NewThread::NewThread(MWindow *mwindow, New *new_project)
142  : BC_DialogThread()
143 {
144         this->mwindow = mwindow;
145         this->new_project = new_project;
146 }
147
148 NewThread::~NewThread()
149 {
150         close_window();
151 }
152
153
154
155 BC_Window* NewThread::new_gui()
156 {
157         mwindow->edl->save_defaults(mwindow->defaults);
158         new_project->create_new_edl();
159         load_defaults();
160
161         mwindow->gui->lock_window("NewThread::new_gui");
162         int x = mwindow->gui->get_abs_cursor_x(0) - WIDTH / 2;
163         int y = mwindow->gui->get_abs_cursor_y(0) - HEIGHT / 2;
164
165         nwindow = new NewWindow(mwindow, this, x, y);
166         nwindow->create_objects();
167         mwindow->gui->unlock_window();
168         return nwindow;
169 }
170
171
172
173 void NewThread::handle_close_event(int result)
174 {
175
176         new_project->new_edl->save_defaults(mwindow->defaults);
177         mwindow->defaults->save();
178
179         if(result)
180         {
181 // Aborted
182                 if( !new_project->new_edl->Garbage::remove_user() )
183                         new_project->new_edl = 0;
184         }
185         else
186         {
187                 new_project->create_new_project();
188         }
189 }
190
191
192
193 int NewThread::load_defaults()
194 {
195         auto_aspect = mwindow->defaults->get("AUTOASPECT", 0);
196         return 0;
197 }
198
199 int NewThread::save_defaults()
200 {
201         mwindow->defaults->update("AUTOASPECT", auto_aspect);
202         return 0;
203 }
204
205 int NewThread::update_aspect()
206 {
207         if(auto_aspect)
208         {
209                 char string[BCTEXTLEN];
210                 mwindow->create_aspect_ratio(new_project->new_edl->session->aspect_w, 
211                         new_project->new_edl->session->aspect_h, 
212                         new_project->new_edl->session->output_w, 
213                         new_project->new_edl->session->output_h);
214                 sprintf(string, "%.02f", new_project->new_edl->session->aspect_w);
215                 nwindow->aspect_w_text->update(string);
216                 sprintf(string, "%.02f", new_project->new_edl->session->aspect_h);
217                 nwindow->aspect_h_text->update(string);
218         }
219         return 0;
220 }
221
222
223
224
225 #if 0
226 N_("Cinelerra: New Project");
227 #endif
228
229 NewWindow::NewWindow(MWindow *mwindow, NewThread *new_thread, int x, int y)
230  : BC_Window(_(_(PROGRAM_NAME ": New Project")), 
231                 x,
232                 y,
233                 WIDTH, 
234                 HEIGHT,
235                 -1,
236                 -1,
237                 0,
238                 0,
239                 1)
240 {
241         this->mwindow = mwindow;
242         this->new_thread = new_thread;
243         this->new_edl = new_thread->new_project->new_edl;
244         format_presets = 0;
245 }
246
247 NewWindow::~NewWindow()
248 {
249         lock_window("NewWindow::~NewWindow");
250         if(format_presets) delete format_presets;
251         unlock_window();
252 }
253
254 void NewWindow::create_objects()
255 {
256         int x = 10, y = 10, x1, y1;
257         BC_TextBox *textbox;
258
259         lock_window("NewWindow::create_objects");
260         mwindow->theme->draw_new_bg(this);
261
262         add_subwindow(new BC_Title(x, y, _("Parameters for the new project:")));
263         y += 20;
264
265         format_presets = new NewPresets(mwindow,
266                 this, 
267                 x, 
268                 y);
269         format_presets->create_objects();
270         x = format_presets->x;
271         y = format_presets->y;
272
273
274
275         y += 40;
276         y1 = y;
277         add_subwindow(new BC_Title(x, y, _("Audio"), LARGEFONT));
278         y += 30;
279
280         x1 = x;
281         add_subwindow(new BC_Title(x1, y, _("Tracks:")));
282         x1 += 100;
283         add_subwindow(atracks = new NewATracks(this, "", x1, y));
284         x1 += atracks->get_w();
285         add_subwindow(new NewATracksTumbler(this, x1, y));
286         y += atracks->get_h() + 5;
287
288         x1 = x;
289         add_subwindow(new BC_Title(x1, y, _("Channels:")));
290         x1 += 100;
291         add_subwindow(achannels = new NewAChannels(this, "", x1, y));
292         x1 += achannels->get_w();
293         add_subwindow(new NewAChannelsTumbler(this, x1, y));
294         y += achannels->get_h() + 5;
295
296         x1 = x;
297         add_subwindow(new BC_Title(x1, y, _("Samplerate:")));
298         x1 += 100;
299         add_subwindow(sample_rate = new NewSampleRate(this, "", x1, y));
300         x1 += sample_rate->get_w();
301         add_subwindow(new SampleRatePulldown(mwindow, sample_rate, x1, y));
302         
303         x += 250;
304         y = y1;
305         add_subwindow(new BC_Title(x, y, _("Video"), LARGEFONT));
306         y += 30;
307         x1 = x;
308         add_subwindow(new BC_Title(x1, y, _("Tracks:")));
309         x1 += 100;
310         add_subwindow(vtracks = new NewVTracks(this, "", x1, y));
311         x1 += vtracks->get_w();
312         add_subwindow(new NewVTracksTumbler(this, x1, y));
313         y += vtracks->get_h() + 5;
314
315 //      x1 = x;
316 //      add_subwindow(new BC_Title(x1, y, _("Channels:")));
317 //      x1 += 100;
318 //      add_subwindow(vchannels = new NewVChannels(this, "", x1, y));
319 //      x1 += vchannels->get_w();
320 //      add_subwindow(new NewVChannelsTumbler(this, x1, y));
321 //      y += vchannels->get_h() + 5;
322         x1 = x;
323         add_subwindow(new BC_Title(x1, y, _("Framerate:")));
324         x1 += 100;
325         add_subwindow(frame_rate = new NewFrameRate(this, "", x1, y));
326         x1 += frame_rate->get_w();
327         add_subwindow(new FrameRatePulldown(mwindow, frame_rate, x1, y));
328         y += frame_rate->get_h() + 5;
329
330 //      x1 = x;
331 //      add_subwindow(new BC_Title(x1, y, _("Canvas size:")));
332 //      x1 += 100;
333 //      add_subwindow(canvas_w_text = new NewTrackW(this, x1, y));
334 //      x1 += canvas_w_text->get_w() + 2;
335 //      add_subwindow(new BC_Title(x1, y, "x"));
336 //      x1 += 10;
337 //      add_subwindow(canvas_h_text = new NewTrackH(this, x1, y));
338 //      x1 += canvas_h_text->get_w();
339 //      add_subwindow(new FrameSizePulldown(mwindow, 
340 //              canvas_w_text, 
341 //              canvas_h_text, 
342 //              x1, 
343 //              y));
344 //      x1 += 100;
345 //      add_subwindow(new NewCloneToggle(mwindow, this, x1, y));
346 //      y += canvas_h_text->get_h() + 5;
347
348         x1 = x;
349         add_subwindow(new BC_Title(x1, y, _("Canvas size:")));
350         x1 += 100;
351         add_subwindow(output_w_text = new NewOutputW(this, x1, y));
352         x1 += output_w_text->get_w() + 2;
353         add_subwindow(new BC_Title(x1, y, "x"));
354         x1 += 10;
355         add_subwindow(output_h_text = new NewOutputH(this, x1, y));
356         x1 += output_h_text->get_w();
357         FrameSizePulldown *pulldown;
358         add_subwindow(pulldown = new FrameSizePulldown(mwindow->theme, 
359                 output_w_text, 
360                 output_h_text, 
361                 x1, 
362                 y));
363         x1 += pulldown->get_w() + 5;
364         add_subwindow(new NewSwapExtents(mwindow, this, x1, y));
365         y += output_h_text->get_h() + 5;
366
367         x1 = x;
368         add_subwindow(new BC_Title(x1, y, _("Aspect ratio:")));
369         x1 += 100;
370         add_subwindow(aspect_w_text = new NewAspectW(this, "", x1, y));
371         x1 += aspect_w_text->get_w() + 2;
372         add_subwindow(new BC_Title(x1, y, ":"));
373         x1 += 10;
374         add_subwindow(aspect_h_text = new NewAspectH(this, "", x1, y));
375         x1 += aspect_h_text->get_w();
376         add_subwindow(new AspectPulldown(mwindow, 
377                 aspect_w_text, 
378                 aspect_h_text, 
379                 x1, 
380                 y));
381
382         x1 = aspect_w_text->get_x();
383         y += aspect_w_text->get_h() + 5;
384         add_subwindow(new NewAspectAuto(this, x1, y));
385         y += 40;
386         add_subwindow(new BC_Title(x, y, _("Color model:")));
387         x += 100;
388         add_subwindow(textbox = new BC_TextBox(x, y, 200, 1, ""));
389         x += textbox->get_w();
390         add_subwindow(new ColormodelPulldown(mwindow, 
391                 textbox, 
392                 &new_edl->session->color_model,
393                 x, 
394                 y));
395
396         add_subwindow(new BC_OKButton(this, 
397                 mwindow->theme->get_image_set("new_ok_images")));
398         add_subwindow(new BC_CancelButton(this, 
399                 mwindow->theme->get_image_set("new_cancel_images")));
400         flash();
401         update();
402         show_window();
403         unlock_window();
404 }
405
406 int NewWindow::update()
407 {
408         atracks->update((int64_t)new_edl->session->audio_tracks);
409         achannels->update((int64_t)new_edl->session->audio_channels);
410         sample_rate->update((int64_t)new_edl->session->sample_rate);
411         vtracks->update((int64_t)new_edl->session->video_tracks);
412         frame_rate->update((float)new_edl->session->frame_rate);
413         output_w_text->update((int64_t)new_edl->session->output_w);
414         output_h_text->update((int64_t)new_edl->session->output_h);
415         aspect_w_text->update((float)new_edl->session->aspect_w);
416         aspect_h_text->update((float)new_edl->session->aspect_h);
417         return 0;
418 }
419
420
421
422
423
424
425
426 NewPresets::NewPresets(MWindow *mwindow, NewWindow *gui, int x, int y)
427  : FormatPresets(mwindow, gui, 0, x, y)
428 {
429 }
430
431 NewPresets::~NewPresets()
432 {
433 }
434
435 int NewPresets::handle_event()
436 {
437         new_gui->update();
438         return 1;
439 }
440
441 EDL* NewPresets::get_edl()
442 {
443         return new_gui->new_edl;
444 }
445
446
447
448 NewATracks::NewATracks(NewWindow *nwindow, const char *text, int x, int y)
449  : BC_TextBox(x, y, 90, 1, text)
450 {
451         this->nwindow = nwindow;
452 }
453
454 int NewATracks::handle_event()
455 {
456         nwindow->new_edl->session->audio_tracks = atol(get_text());
457         return 1;
458 }
459
460 NewATracksTumbler::NewATracksTumbler(NewWindow *nwindow, int x, int y)
461  : BC_Tumbler(x, y)
462 {
463         this->nwindow = nwindow;
464 }
465 int NewATracksTumbler::handle_up_event()
466 {
467         nwindow->new_edl->session->audio_tracks++;
468         nwindow->new_edl->boundaries();
469         nwindow->update();
470         return 1;
471 }
472 int NewATracksTumbler::handle_down_event()
473 {
474         nwindow->new_edl->session->audio_tracks--;
475         nwindow->new_edl->boundaries();
476         nwindow->update();
477         return 1;
478 }
479
480 NewAChannels::NewAChannels(NewWindow *nwindow, const char *text, int x, int y)
481  : BC_TextBox(x, y, 90, 1, text)
482 {
483         this->nwindow = nwindow;
484
485
486 int NewAChannels::handle_event()
487 {
488         nwindow->new_edl->session->audio_channels = atol(get_text());
489         return 1;
490 }
491
492 NewAChannelsTumbler::NewAChannelsTumbler(NewWindow *nwindow, int x, int y)
493  : BC_Tumbler(x, y)
494 {
495         this->nwindow = nwindow;
496 }
497 int NewAChannelsTumbler::handle_up_event()
498 {
499         nwindow->new_edl->session->audio_channels++;
500         nwindow->new_edl->boundaries();
501         nwindow->update();
502         return 1;
503 }
504 int NewAChannelsTumbler::handle_down_event()
505 {
506         nwindow->new_edl->session->audio_channels--;
507         nwindow->new_edl->boundaries();
508         nwindow->update();
509         return 1;
510 }
511
512
513 NewSampleRate::NewSampleRate(NewWindow *nwindow, const char *text, int x, int y)
514  : BC_TextBox(x, y, 90, 1, text)
515 {
516         this->nwindow = nwindow;
517 }
518
519 int NewSampleRate::handle_event()
520 {
521         nwindow->new_edl->session->sample_rate = atol(get_text());
522         return 1;
523 }
524
525 SampleRatePulldown::SampleRatePulldown(MWindow *mwindow, BC_TextBox *output, int x, int y)
526  : BC_ListBox(x,
527         y,
528         100,
529         200,
530         LISTBOX_TEXT,
531         &mwindow->theme->sample_rates,
532         0,
533         0,
534         1,
535         0,
536         1)
537 {
538         this->mwindow = mwindow;
539         this->output = output;
540 }
541 int SampleRatePulldown::handle_event()
542 {
543         char *text = get_selection(0, 0)->get_text();
544         output->update(text);
545         output->handle_event();
546         return 1;
547 }
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563 NewVTracks::NewVTracks(NewWindow *nwindow, const char *text, int x, int y)
564  : BC_TextBox(x, y, 90, 1, text)
565 {
566         this->nwindow = nwindow;
567 }
568
569 int NewVTracks::handle_event()
570 {
571         nwindow->new_edl->session->video_tracks = atol(get_text());
572         return 1;
573 }
574
575 NewVTracksTumbler::NewVTracksTumbler(NewWindow *nwindow, int x, int y)
576  : BC_Tumbler(x, y)
577 {
578         this->nwindow = nwindow;
579 }
580 int NewVTracksTumbler::handle_up_event()
581 {
582         nwindow->new_edl->session->video_tracks++;
583         nwindow->new_edl->boundaries();
584         nwindow->update();
585         return 1;
586 }
587 int NewVTracksTumbler::handle_down_event()
588 {
589         nwindow->new_edl->session->video_tracks--;
590         nwindow->new_edl->boundaries();
591         nwindow->update();
592         return 1;
593 }
594
595 NewVChannels::NewVChannels(NewWindow *nwindow, const char *text, int x, int y)
596  : BC_TextBox(x, y, 90, 1, text)
597 {
598         this->nwindow = nwindow;
599 }
600
601 int NewVChannels::handle_event()
602 {
603         nwindow->new_edl->session->video_channels = atol(get_text());
604         return 1;
605 }
606
607 NewVChannelsTumbler::NewVChannelsTumbler(NewWindow *nwindow, int x, int y)
608  : BC_Tumbler(x, y)
609 {
610         this->nwindow = nwindow;
611 }
612 int NewVChannelsTumbler::handle_up_event()
613 {
614         nwindow->new_edl->session->video_channels++;
615         nwindow->new_edl->boundaries();
616         nwindow->update();
617         return 1;
618 }
619 int NewVChannelsTumbler::handle_down_event()
620 {
621         nwindow->new_edl->session->video_channels--;
622         nwindow->new_edl->boundaries();
623         nwindow->update();
624         return 1;
625 }
626
627 NewFrameRate::NewFrameRate(NewWindow *nwindow, const char *text, int x, int y)
628  : BC_TextBox(x, y, 90, 1, text)
629 {
630         this->nwindow = nwindow;
631 }
632
633 int NewFrameRate::handle_event()
634 {
635         nwindow->new_edl->session->frame_rate = Units::atoframerate(get_text());
636         return 1;
637 }
638
639 FrameRatePulldown::FrameRatePulldown(MWindow *mwindow, 
640         BC_TextBox *output, 
641         int x, 
642         int y)
643  : BC_ListBox(x,
644         y,
645         100,
646         200,
647         LISTBOX_TEXT,
648         &mwindow->theme->frame_rates,
649         0,
650         0,
651         1,
652         0,
653         1)
654 {
655         this->mwindow = mwindow;
656         this->output = output;
657 }
658 int FrameRatePulldown::handle_event()
659 {
660         char *text = get_selection(0, 0)->get_text();
661         output->update(text);
662         output->handle_event();
663         return 1;
664 }
665
666 FrameSizePulldown::FrameSizePulldown(Theme *theme, 
667                 BC_TextBox *output_w, 
668                 BC_TextBox *output_h, 
669                 int x, 
670                 int y)
671  : BC_ListBox(x,
672         y,
673         100,
674         250,
675         LISTBOX_TEXT,
676         &theme->frame_sizes,
677         0,
678         0,
679         1,
680         0,
681         1)
682 {
683         this->theme = theme;
684         this->output_w = output_w;
685         this->output_h = output_h;
686 }
687 int FrameSizePulldown::handle_event()
688 {
689         char *text = get_selection(0, 0)->get_text();
690         char string[BCTEXTLEN];
691         int64_t w, h;
692         char *ptr;
693         
694         strcpy(string, text);
695         ptr = strrchr(string, 'x');
696         if(ptr)
697         {
698                 ptr++;
699                 h = atol(ptr);
700                 
701                 *--ptr = 0;
702                 w = atol(string);
703                 output_w->update(w);
704                 output_h->update(h);
705                 output_w->handle_event();
706                 output_h->handle_event();
707         }
708         return 1;
709 }
710
711 NewOutputW::NewOutputW(NewWindow *nwindow, int x, int y)
712  : BC_TextBox(x, y, 70, 1, nwindow->new_edl->session->output_w)
713 {
714         this->nwindow = nwindow;
715 }
716 int NewOutputW::handle_event()
717 {
718         nwindow->new_edl->session->output_w = MAX(1,atol(get_text()));
719         nwindow->new_thread->update_aspect();
720         return 1;
721 }
722
723 NewOutputH::NewOutputH(NewWindow *nwindow, int x, int y)
724  : BC_TextBox(x, y, 70, 1, nwindow->new_edl->session->output_h)
725 {
726         this->nwindow = nwindow;
727 }
728 int NewOutputH::handle_event()
729 {
730         nwindow->new_edl->session->output_h = MAX(1, atol(get_text()));
731         nwindow->new_thread->update_aspect();
732         return 1;
733 }
734
735 NewAspectW::NewAspectW(NewWindow *nwindow, const char *text, int x, int y)
736  : BC_TextBox(x, y, 70, 1, text)
737 {
738         this->nwindow = nwindow;
739 }
740
741 int NewAspectW::handle_event()
742 {
743         nwindow->new_edl->session->aspect_w = atof(get_text());
744         return 1;
745 }
746
747 NewAspectH::NewAspectH(NewWindow *nwindow, const char *text, int x, int y)
748  : BC_TextBox(x, y, 70, 1, text)
749 {
750         this->nwindow = nwindow;
751 }
752
753 int NewAspectH::handle_event()
754 {
755         nwindow->new_edl->session->aspect_h = atof(get_text());
756         return 1;
757 }
758
759 AspectPulldown::AspectPulldown(MWindow *mwindow, 
760                 BC_TextBox *output_w, 
761                 BC_TextBox *output_h, 
762                 int x, 
763                 int y)
764  : BC_ListBox(x,
765         y,
766         100,
767         200,
768         LISTBOX_TEXT,
769         &mwindow->theme->aspect_ratios,
770         0,
771         0,
772         1,
773         0,
774         1)
775 {
776         this->mwindow = mwindow;
777         this->output_w = output_w;
778         this->output_h = output_h;
779 }
780 int AspectPulldown::handle_event()
781 {
782         char *text = get_selection(0, 0)->get_text();
783         char string[BCTEXTLEN];
784         float w, h;
785         char *ptr;
786         
787         strcpy(string, text);
788         ptr = strrchr(string, ':');
789         if(ptr)
790         {
791                 ptr++;
792                 h = atof(ptr);
793                 
794                 *--ptr = 0;
795                 w = atof(string);
796                 output_w->update(w);
797                 output_h->update(h);
798                 output_w->handle_event();
799                 output_h->handle_event();
800         }
801         return 1;
802 }
803
804 ColormodelItem::ColormodelItem(const char *text, int value)
805  : BC_ListBoxItem(text)
806 {
807         this->value = value;
808 }
809
810 ColormodelPulldown::ColormodelPulldown(MWindow *mwindow, 
811                 BC_TextBox *output_text, 
812                 int *output_value,
813                 int x, 
814                 int y)
815  : BC_ListBox(x,
816         y,
817         200,
818         150,
819         LISTBOX_TEXT,
820         (ArrayList<BC_ListBoxItem*>*)&mwindow->colormodels,
821         0,
822         0,
823         1,
824         0,
825         1)
826 {
827         this->mwindow = mwindow;
828         this->output_text = output_text;
829         this->output_value = output_value;
830         output_text->update(colormodel_to_text());
831 }
832
833 int ColormodelPulldown::handle_event()
834 {
835         output_text->update(get_selection(0, 0)->get_text());
836         *output_value = ((ColormodelItem*)get_selection(0, 0))->value;
837         return 1;
838 }
839
840 const char* ColormodelPulldown::colormodel_to_text()
841 {
842         for(int i = 0; i < mwindow->colormodels.total; i++)
843                 if(mwindow->colormodels.values[i]->value == *output_value) 
844                         return mwindow->colormodels.values[i]->get_text();
845         return _("Unknown");
846 }
847
848
849
850
851
852
853
854
855
856
857 NewAspectAuto::NewAspectAuto(NewWindow *nwindow, int x, int y)
858  : BC_CheckBox(x, y, nwindow->new_thread->auto_aspect, _("Auto aspect ratio"))
859 {
860         this->nwindow = nwindow;
861 }
862 NewAspectAuto::~NewAspectAuto()
863 {
864 }
865 int NewAspectAuto::handle_event()
866 {
867         nwindow->new_thread->auto_aspect = get_value();
868         nwindow->new_thread->update_aspect();
869         return 1;
870 }
871
872
873
874
875
876
877
878
879 NewSwapExtents::NewSwapExtents(MWindow *mwindow, NewWindow *gui, int x, int y)
880  : BC_Button(x, y, mwindow->theme->get_image_set("swap_extents"))
881 {
882         this->mwindow = mwindow;
883         this->gui = gui;
884         set_tooltip(_("Swap dimensions"));
885 }
886
887 int NewSwapExtents::handle_event()
888 {
889         int w = gui->new_edl->session->output_w;
890         int h = gui->new_edl->session->output_h;
891         gui->new_edl->session->output_w = h;
892         gui->new_edl->session->output_h = w;
893         gui->output_w_text->update((int64_t)h);
894         gui->output_h_text->update((int64_t)w);
895         gui->new_thread->update_aspect();
896         return 1;
897 }
898
899
900
901