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