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