r885: Don't delete a borrowed frame.
[cinelerra_cv/ct.git] / cinelerra / new.C
blob78f64981ce3a582283958e4a63dab4a6c1d23082
1 #include "clip.h"
2 #include "cplayback.h"
3 #include "cwindow.h"
4 #include "bchash.h"
5 #include "edl.h"
6 #include "edlsession.h"
7 #include "filexml.h"
8 #include "interlacemodes.h"
9 #include "language.h"
10 #include "levelwindow.h"
11 #include "mainundo.h"
12 #include "mainmenu.h"
13 #include "mutex.h"
14 #include "mwindow.h"
15 #include "mwindowgui.h"
16 #include "new.h"
17 #include "newpresets.h"
18 #include "mainsession.h"
19 #include "patchbay.h"
20 #include "preferences.h"
21 #include "theme.h"
22 #include "transportque.h"
23 #include "videowindow.h"
24 #include "vplayback.h"
25 #include "vwindow.h"
28 #include <string.h>
31 #define WIDTH 600
32 #define HEIGHT 400
35 New::New(MWindow *mwindow)
36  : BC_MenuItem(_("New..."), "n", 'n')
38         this->mwindow = mwindow;
39         script = 0;
42 int New::create_objects()
44         thread = new NewThread(mwindow, this);
45         return 0;
48 int New::handle_event() 
50         if(thread->running())
51         {
52                 thread->window_lock->lock("New::handle_event");
53                 if(thread->nwindow)
54                 {
55                         thread->nwindow->lock_window("New::handle_event");
56                         thread->nwindow->raise_window();
57                         thread->nwindow->unlock_window();
58                 }
59                 thread->window_lock->unlock();
60                 return 1;
61         }
62         mwindow->edl->save_defaults(mwindow->defaults);
63         create_new_edl();
64         thread->start(); 
66         return 1;
69 void New::create_new_edl()
71         new_edl = new EDL;
72         new_edl->create_objects();
73         new_edl->load_defaults(mwindow->defaults);
77 int New::create_new_project()
79         mwindow->cwindow->playback_engine->que->send_command(STOP,
80                 CHANGE_NONE, 
81                 0,
82                 0);
83         mwindow->vwindow->playback_engine->que->send_command(STOP,
84                 CHANGE_NONE, 
85                 0,
86                 0);
87         mwindow->cwindow->playback_engine->interrupt_playback(0);
88         mwindow->vwindow->playback_engine->interrupt_playback(0);
90         mwindow->gui->lock_window();
91         mwindow->reset_caches();
93         memcpy(new_edl->session->achannel_positions,
94                 &mwindow->preferences->channel_positions[
95                         MAXCHANNELS * (new_edl->session->audio_channels - 1)],
96                 sizeof(int) * MAXCHANNELS);
97         new_edl->session->boundaries();
98         new_edl->create_default_tracks();
100         mwindow->set_filename("");
101         mwindow->undo->update_undo(_("New"), LOAD_ALL);
103         mwindow->hide_plugins();
104         delete mwindow->edl;
105         mwindow->edl = new_edl;
106         mwindow->save_defaults();
108 // Load file sequence
109         mwindow->update_project(LOAD_REPLACE);
110         mwindow->session->changes_made = 0;
111         mwindow->gui->unlock_window();
112         return 0;
115 NewThread::NewThread(MWindow *mwindow, New *new_project)
116  : Thread()
118         this->mwindow = mwindow;
119         this->new_project = new_project;
120         window_lock = new Mutex("NewThread::window_lock");
123 NewThread::~NewThread()
125         delete window_lock;
129 void NewThread::run()
131         int result = 0;
132         load_defaults();
134         int x = mwindow->gui->get_root_w(0, 1) / 2 - WIDTH / 2;
135         int y = mwindow->gui->get_root_h(1) / 2 - HEIGHT / 2;
137         window_lock->lock("NewThread::run 1\n");
138         nwindow = new NewWindow(mwindow, this, x, y);
139         nwindow->create_objects();
140         window_lock->unlock();
142         result = nwindow->run_window();
144         window_lock->lock("NewThread::run 2\n");
145         delete nwindow; 
146         nwindow = 0;
147         window_lock->unlock();
149         new_project->new_edl->save_defaults(mwindow->defaults);
150         mwindow->defaults->save();
152         if(result)
153         {
154 // Aborted
155                 delete new_project->new_edl;
156         }
157         else
158         {
159                 new_project->create_new_project();
160         }
163 int NewThread::load_defaults()
165         auto_aspect = mwindow->defaults->get("AUTOASPECT", 0);
166         return 0;
169 int NewThread::save_defaults()
171         mwindow->defaults->update("AUTOASPECT", auto_aspect);
172         return 0;
175 int NewThread::update_aspect()
177         if(auto_aspect)
178         {
179                 char string[BCTEXTLEN];
180                 mwindow->create_aspect_ratio(new_project->new_edl->session->aspect_w, 
181                         new_project->new_edl->session->aspect_h, 
182                         new_project->new_edl->session->output_w, 
183                         new_project->new_edl->session->output_h);
184                 sprintf(string, "%.02f", new_project->new_edl->session->aspect_w);
185                 nwindow->aspect_w_text->update(string);
186                 sprintf(string, "%.02f", new_project->new_edl->session->aspect_h);
187                 nwindow->aspect_h_text->update(string);
188         }
189         return 0;
195 #if 0
196 N_("Cinelerra: New Project");
197 #endif
199 NewWindow::NewWindow(MWindow *mwindow, NewThread *new_thread, int x, int y)
200  : BC_Window(_(PROGRAM_NAME ": New Project"), 
201                 x,
202                 y,
203                 WIDTH, 
204                 HEIGHT,
205                 -1,
206                 -1,
207                 0,
208                 0,
209                 1)
211         this->mwindow = mwindow;
212         this->new_thread = new_thread;
213         this->new_edl = new_thread->new_project->new_edl;
214         format_presets = 0;
217 NewWindow::~NewWindow()
219         if(format_presets) delete format_presets;
222 int NewWindow::create_objects()
224         int x = 10, y = 10, x1, y1;
225         BC_TextBox *textbox;
227         mwindow->theme->draw_new_bg(this);
229         add_subwindow(new BC_Title(x, y, _("Parameters for the new project:")));
230         y += 20;
232         format_presets = new NewPresets(mwindow,
233                 this, 
234                 x, 
235                 y);
236         format_presets->create_objects();
237         x = format_presets->x;
238         y = format_presets->y;
242         y += 40;
243         y1 = y;
244         add_subwindow(new BC_Title(x, y, _("Audio"), LARGEFONT));
245         y += 30;
247         x1 = x;
248         add_subwindow(new BC_Title(x1, y, _("Tracks:")));
249         x1 += 100;
250         add_subwindow(atracks = new NewATracks(this, "", x1, y));
251         x1 += atracks->get_w();
252         add_subwindow(new NewATracksTumbler(this, x1, y));
253         y += atracks->get_h() + 5;
255         x1 = x;
256         add_subwindow(new BC_Title(x1, y, _("Channels:")));
257         x1 += 100;
258         add_subwindow(achannels = new NewAChannels(this, "", x1, y));
259         x1 += achannels->get_w();
260         add_subwindow(new NewAChannelsTumbler(this, x1, y));
261         y += achannels->get_h() + 5;
263         x1 = x;
264         add_subwindow(new BC_Title(x1, y, _("Samplerate:")));
265         x1 += 100;
266         add_subwindow(sample_rate = new NewSampleRate(this, "", x1, y));
267         x1 += sample_rate->get_w();
268         add_subwindow(new SampleRatePulldown(mwindow, sample_rate, x1, y));
269         
270         x += 250;
271         y = y1;
272         add_subwindow(new BC_Title(x, y, _("Video"), LARGEFONT));
273         y += 30;
274         x1 = x;
275         add_subwindow(new BC_Title(x1, y, _("Tracks:")));
276         x1 += 100;
277         add_subwindow(vtracks = new NewVTracks(this, "", x1, y));
278         x1 += vtracks->get_w();
279         add_subwindow(new NewVTracksTumbler(this, x1, y));
280         y += vtracks->get_h() + 5;
282 //      x1 = x;
283 //      add_subwindow(new BC_Title(x1, y, _("Channels:")));
284 //      x1 += 100;
285 //      add_subwindow(vchannels = new NewVChannels(this, "", x1, y));
286 //      x1 += vchannels->get_w();
287 //      add_subwindow(new NewVChannelsTumbler(this, x1, y));
288 //      y += vchannels->get_h() + 5;
289         x1 = x;
290         add_subwindow(new BC_Title(x1, y, _("Framerate:")));
291         x1 += 100;
292         add_subwindow(frame_rate = new NewFrameRate(this, "", x1, y));
293         x1 += frame_rate->get_w();
294         add_subwindow(new FrameRatePulldown(mwindow, frame_rate, x1, y));
295         y += frame_rate->get_h() + 5;
297 //      x1 = x;
298 //      add_subwindow(new BC_Title(x1, y, _("Canvas size:")));
299 //      x1 += 100;
300 //      add_subwindow(canvas_w_text = new NewTrackW(this, x1, y));
301 //      x1 += canvas_w_text->get_w() + 2;
302 //      add_subwindow(new BC_Title(x1, y, "x"));
303 //      x1 += 10;
304 //      add_subwindow(canvas_h_text = new NewTrackH(this, x1, y));
305 //      x1 += canvas_h_text->get_w();
306 //      add_subwindow(new FrameSizePulldown(mwindow, 
307 //              canvas_w_text, 
308 //              canvas_h_text, 
309 //              x1, 
310 //              y));
311 //      x1 += 100;
312 //      add_subwindow(new NewCloneToggle(mwindow, this, x1, y));
313 //      y += canvas_h_text->get_h() + 5;
315         x1 = x;
316         add_subwindow(new BC_Title(x1, y, _("Canvas size:")));
317         x1 += 100;
318         add_subwindow(output_w_text = new NewOutputW(this, x1, y));
319         x1 += output_w_text->get_w() + 2;
320         add_subwindow(new BC_Title(x1, y, "x"));
321         x1 += 10;
322         add_subwindow(output_h_text = new NewOutputH(this, x1, y));
323         x1 += output_h_text->get_w();
324         FrameSizePulldown *pulldown;
325         add_subwindow(pulldown = new FrameSizePulldown(mwindow, 
326                 output_w_text, 
327                 output_h_text, 
328                 x1, 
329                 y));
330         x1 += pulldown->get_w() + 5;
331         add_subwindow(new NewSwapExtents(mwindow, this, x1, y));
332         y += output_h_text->get_h() + 5;
334         x1 = x;
335         add_subwindow(new BC_Title(x1, y, _("Aspect ratio:")));
336         x1 += 100;
337         add_subwindow(aspect_w_text = new NewAspectW(this, "", x1, y));
338         x1 += aspect_w_text->get_w() + 2;
339         add_subwindow(new BC_Title(x1, y, ":"));
340         x1 += 10;
341         add_subwindow(aspect_h_text = new NewAspectH(this, "", x1, y));
342         x1 += aspect_h_text->get_w();
343         add_subwindow(new AspectPulldown(mwindow, 
344                 aspect_w_text, 
345                 aspect_h_text, 
346                 x1, 
347                 y));
349         x1 = aspect_w_text->get_x();
350         y += aspect_w_text->get_h() + 5;
351         add_subwindow(new NewAspectAuto(this, x1, y));
352         y += 40;
353         add_subwindow(new BC_Title(x, y, _("Color model:")));
354         add_subwindow(textbox = new BC_TextBox(x + 100, y, 200, 1, ""));
355         add_subwindow(new ColormodelPulldown(mwindow, 
356                 textbox, 
357                 &new_edl->session->color_model,
358                 x + 100 + textbox->get_w(),
359                 y));
360         y += textbox->get_h() + 5;
362         // --------------------
363         add_subwindow(new BC_Title(x, y, _("Interlace mode:")));
364         add_subwindow(textbox = new BC_TextBox(x + 100, y, 140, 1, ""));
365         add_subwindow(new InterlacemodePulldown(mwindow, 
366                 textbox, 
367                 &new_edl->session->interlace_mode,
368                 (ArrayList<BC_ListBoxItem*>*)&mwindow->interlace_project_modes,
369                 x + 100 + textbox->get_w(), 
370                 y)); 
371         y += textbox->get_h() + 5;
373         add_subwindow(new BC_OKButton(this, 
374                 mwindow->theme->get_image_set("new_ok_images")));
375         add_subwindow(new BC_CancelButton(this, 
376                 mwindow->theme->get_image_set("new_cancel_images")));
377         flash();
378         update();
379         show_window();
380         return 0;
383 int NewWindow::update()
385         char string[BCTEXTLEN];
386         atracks->update((int64_t)new_edl->session->audio_tracks);
387         achannels->update((int64_t)new_edl->session->audio_channels);
388         sample_rate->update((int64_t)new_edl->session->sample_rate);
389         vtracks->update((int64_t)new_edl->session->video_tracks);
390         frame_rate->update((float)new_edl->session->frame_rate);
391         output_w_text->update((int64_t)new_edl->session->output_w);
392         output_h_text->update((int64_t)new_edl->session->output_h);
393         aspect_w_text->update((float)new_edl->session->aspect_w);
394         aspect_h_text->update((float)new_edl->session->aspect_h);
395         return 0;
404 NewPresets::NewPresets(MWindow *mwindow, NewWindow *gui, int x, int y)
405  : FormatPresets(mwindow, gui, 0, x, y)
409 NewPresets::~NewPresets()
413 int NewPresets::handle_event()
415         new_gui->update();
416         return 1;
419 EDL* NewPresets::get_edl()
421         return new_gui->new_edl;
426 NewATracks::NewATracks(NewWindow *nwindow, char *text, int x, int y)
427  : BC_TextBox(x, y, 90, 1, text)
429         this->nwindow = nwindow;
432 int NewATracks::handle_event()
434         nwindow->new_edl->session->audio_tracks = atol(get_text());
435         return 1;
438 NewATracksTumbler::NewATracksTumbler(NewWindow *nwindow, int x, int y)
439  : BC_Tumbler(x, y)
441         this->nwindow = nwindow;
443 int NewATracksTumbler::handle_up_event()
445         nwindow->new_edl->session->audio_tracks++;
446         nwindow->new_edl->boundaries();
447         nwindow->update();
448         return 1;
450 int NewATracksTumbler::handle_down_event()
452         nwindow->new_edl->session->audio_tracks--;
453         nwindow->new_edl->boundaries();
454         nwindow->update();
455         return 1;
458 NewAChannels::NewAChannels(NewWindow *nwindow, char *text, int x, int y)
459  : BC_TextBox(x, y, 90, 1, text)
461         this->nwindow = nwindow;
464 int NewAChannels::handle_event()
466         nwindow->new_edl->session->audio_channels = atol(get_text());
467         return 1;
470 NewAChannelsTumbler::NewAChannelsTumbler(NewWindow *nwindow, int x, int y)
471  : BC_Tumbler(x, y)
473         this->nwindow = nwindow;
475 int NewAChannelsTumbler::handle_up_event()
477         nwindow->new_edl->session->audio_channels++;
478         nwindow->new_edl->boundaries();
479         nwindow->update();
480         return 1;
482 int NewAChannelsTumbler::handle_down_event()
484         nwindow->new_edl->session->audio_channels--;
485         nwindow->new_edl->boundaries();
486         nwindow->update();
487         return 1;
491 NewSampleRate::NewSampleRate(NewWindow *nwindow, char *text, int x, int y)
492  : BC_TextBox(x, y, 90, 1, text)
494         this->nwindow = nwindow;
497 int NewSampleRate::handle_event()
499         nwindow->new_edl->session->sample_rate = atol(get_text());
500         return 1;
503 SampleRatePulldown::SampleRatePulldown(MWindow *mwindow, BC_TextBox *output, int x, int y)
504  : BC_ListBox(x,
505         y,
506         100,
507         200,
508         LISTBOX_TEXT,
509         &mwindow->theme->sample_rates,
510         0,
511         0,
512         1,
513         0,
514         1)
516         this->mwindow = mwindow;
517         this->output = output;
519 int SampleRatePulldown::handle_event()
521         char *text = get_selection(0, 0)->get_text();
522         output->update(text);
523         output->handle_event();
524         return 1;
541 NewVTracks::NewVTracks(NewWindow *nwindow, char *text, int x, int y)
542  : BC_TextBox(x, y, 90, 1, text)
544         this->nwindow = nwindow;
547 int NewVTracks::handle_event()
549         nwindow->new_edl->session->video_tracks = atol(get_text());
550         return 1;
553 NewVTracksTumbler::NewVTracksTumbler(NewWindow *nwindow, int x, int y)
554  : BC_Tumbler(x, y)
556         this->nwindow = nwindow;
558 int NewVTracksTumbler::handle_up_event()
560         nwindow->new_edl->session->video_tracks++;
561         nwindow->new_edl->boundaries();
562         nwindow->update();
563         return 1;
565 int NewVTracksTumbler::handle_down_event()
567         nwindow->new_edl->session->video_tracks--;
568         nwindow->new_edl->boundaries();
569         nwindow->update();
570         return 1;
573 NewVChannels::NewVChannels(NewWindow *nwindow, char *text, int x, int y)
574  : BC_TextBox(x, y, 90, 1, text)
576         this->nwindow = nwindow;
579 int NewVChannels::handle_event()
581         nwindow->new_edl->session->video_channels = atol(get_text());
582         return 1;
585 NewVChannelsTumbler::NewVChannelsTumbler(NewWindow *nwindow, int x, int y)
586  : BC_Tumbler(x, y)
588         this->nwindow = nwindow;
590 int NewVChannelsTumbler::handle_up_event()
592         nwindow->new_edl->session->video_channels++;
593         nwindow->new_edl->boundaries();
594         nwindow->update();
595         return 1;
597 int NewVChannelsTumbler::handle_down_event()
599         nwindow->new_edl->session->video_channels--;
600         nwindow->new_edl->boundaries();
601         nwindow->update();
602         return 1;
605 NewFrameRate::NewFrameRate(NewWindow *nwindow, char *text, int x, int y)
606  : BC_TextBox(x, y, 90, 1, text)
608         this->nwindow = nwindow;
611 int NewFrameRate::handle_event()
613         nwindow->new_edl->session->frame_rate = Units::atoframerate(get_text());
614         return 1;
617 FrameRatePulldown::FrameRatePulldown(MWindow *mwindow, 
618         BC_TextBox *output, 
619         int x, 
620         int y)
621  : BC_ListBox(x,
622         y,
623         100,
624         200,
625         LISTBOX_TEXT,
626         &mwindow->theme->frame_rates,
627         0,
628         0,
629         1,
630         0,
631         1)
633         this->mwindow = mwindow;
634         this->output = output;
636 int FrameRatePulldown::handle_event()
638         char *text = get_selection(0, 0)->get_text();
639         output->update(text);
640         output->handle_event();
641         return 1;
644 FrameSizePulldown::FrameSizePulldown(MWindow *mwindow, 
645                 BC_TextBox *output_w, 
646                 BC_TextBox *output_h, 
647                 int x, 
648                 int y)
649  : BC_ListBox(x,
650         y,
651         100,
652         200,
653         LISTBOX_TEXT,
654         &mwindow->theme->frame_sizes,
655         0,
656         0,
657         1,
658         0,
659         1)
661         this->mwindow = mwindow;
662         this->output_w = output_w;
663         this->output_h = output_h;
665 int FrameSizePulldown::handle_event()
667         char *text = get_selection(0, 0)->get_text();
668         char string[BCTEXTLEN];
669         int64_t w, h;
670         char *ptr;
671         
672         strcpy(string, text);
673         ptr = strrchr(string, 'x');
674         if(ptr)
675         {
676                 ptr++;
677                 h = atol(ptr);
678                 
679                 *--ptr = 0;
680                 w = atol(string);
681                 output_w->update(w);
682                 output_h->update(h);
683                 output_w->handle_event();
684                 output_h->handle_event();
685         }
686         return 1;
689 NewOutputW::NewOutputW(NewWindow *nwindow, int x, int y)
690  : BC_TextBox(x, y, 70, 1, nwindow->new_edl->session->output_w)
692         this->nwindow = nwindow;
694 int NewOutputW::handle_event()
696         nwindow->new_edl->session->output_w = MAX(1,atol(get_text()));
697         nwindow->new_thread->update_aspect();
698         return 1;
701 NewOutputH::NewOutputH(NewWindow *nwindow, int x, int y)
702  : BC_TextBox(x, y, 70, 1, nwindow->new_edl->session->output_h)
704         this->nwindow = nwindow;
706 int NewOutputH::handle_event()
708         nwindow->new_edl->session->output_h = MAX(1, atol(get_text()));
709         nwindow->new_thread->update_aspect();
710         return 1;
713 NewAspectW::NewAspectW(NewWindow *nwindow, char *text, int x, int y)
714  : BC_TextBox(x, y, 70, 1, text)
716         this->nwindow = nwindow;
719 int NewAspectW::handle_event()
721         nwindow->new_edl->session->aspect_w = atof(get_text());
722         return 1;
725 NewAspectH::NewAspectH(NewWindow *nwindow, char *text, int x, int y)
726  : BC_TextBox(x, y, 70, 1, text)
728         this->nwindow = nwindow;
731 int NewAspectH::handle_event()
733         nwindow->new_edl->session->aspect_h = atof(get_text());
734         return 1;
737 AspectPulldown::AspectPulldown(MWindow *mwindow, 
738                 BC_TextBox *output_w, 
739                 BC_TextBox *output_h, 
740                 int x, 
741                 int y)
742  : BC_ListBox(x,
743         y,
744         100,
745         200,
746         LISTBOX_TEXT,
747         &mwindow->theme->aspect_ratios,
748         0,
749         0,
750         1,
751         0,
752         1)
754         this->mwindow = mwindow;
755         this->output_w = output_w;
756         this->output_h = output_h;
758 int AspectPulldown::handle_event()
760         char *text = get_selection(0, 0)->get_text();
761         char string[BCTEXTLEN];
762         float w, h;
763         char *ptr;
764         
765         strcpy(string, text);
766         ptr = strrchr(string, ':');
767         if(ptr)
768         {
769                 ptr++;
770                 h = atof(ptr);
771                 
772                 *--ptr = 0;
773                 w = atof(string);
774                 output_w->update(w);
775                 output_h->update(h);
776                 output_w->handle_event();
777                 output_h->handle_event();
778         }
779         return 1;
782 ColormodelItem::ColormodelItem(char *text, int value)
783  : BC_ListBoxItem(text)
785         this->value = value;
788 ColormodelPulldown::ColormodelPulldown(MWindow *mwindow, 
789                 BC_TextBox *output_text, 
790                 int *output_value,
791                 int x, 
792                 int y)
793  : BC_ListBox(x,
794         y,
795         200,
796         150,
797         LISTBOX_TEXT,
798         (ArrayList<BC_ListBoxItem*>*)&mwindow->colormodels,
799         0,
800         0,
801         1,
802         0,
803         1)
805         this->mwindow = mwindow;
806         this->output_text = output_text;
807         this->output_value = output_value;
808         output_text->update(colormodel_to_text());
811 int ColormodelPulldown::handle_event()
813         output_text->update(get_selection(0, 0)->get_text());
814         *output_value = ((ColormodelItem*)get_selection(0, 0))->value;
815         return 1;
818 char* ColormodelPulldown::colormodel_to_text()
820         for(int i = 0; i < mwindow->colormodels.total; i++)
821                 if(mwindow->colormodels.values[i]->value == *output_value) 
822                         return mwindow->colormodels.values[i]->get_text();
823         return "Unknown";
826 InterlacemodeItem::InterlacemodeItem(char *text, int value)
827  : BC_ListBoxItem(text)
829         this->value = value;
832 InterlacemodePulldown::InterlacemodePulldown(MWindow *mwindow, 
833                 BC_TextBox *output_text,
834                 int *output_value,
835                 ArrayList<BC_ListBoxItem*> *data,
836                 int x, 
837                 int y)
838  : BC_ListBox(x,
839         y,
840         200,
841         150,
842         LISTBOX_TEXT,
843         data,
844         0,
845         0,
846         1,
847         0,
848         1)
850         char string[BCTEXTLEN];
851         this->mwindow = mwindow;
852         this->output_text = output_text;
853         this->output_value = output_value;
854         output_text->update(interlacemode_to_text());
857 int InterlacemodePulldown::handle_event()
859         output_text->update(get_selection(0, 0)->get_text());
860         *output_value = ((InterlacemodeItem*)get_selection(0, 0))->value;
861         return 1;
864 char* InterlacemodePulldown::interlacemode_to_text()
866         ilacemode_to_text(this->string,*output_value);
867         return (this->string);
870 NewAspectAuto::NewAspectAuto(NewWindow *nwindow, int x, int y)
871  : BC_CheckBox(x, y, nwindow->new_thread->auto_aspect, _("Auto aspect ratio"))
873         this->nwindow = nwindow;
875 NewAspectAuto::~NewAspectAuto()
878 int NewAspectAuto::handle_event()
880         nwindow->new_thread->auto_aspect = get_value();
881         nwindow->new_thread->update_aspect();
882         return 1;
892 NewSwapExtents::NewSwapExtents(MWindow *mwindow, NewWindow *gui, int x, int y)
893  : BC_Button(x, y, mwindow->theme->get_image_set("swap_extents"))
895         this->mwindow = mwindow;
896         this->gui = gui;
897         set_tooltip("Swap dimensions");
900 int NewSwapExtents::handle_event()
902         int w = gui->new_edl->session->output_w;
903         int h = gui->new_edl->session->output_h;
904         gui->new_edl->session->output_w = h;
905         gui->new_edl->session->output_h = w;
906         gui->output_w_text->update((int64_t)h);
907         gui->output_h_text->update((int64_t)w);
908         gui->new_thread->update_aspect();
909         return 1;