r860: Merge 2.1:
[cinelerra_cv.git] / cinelerra / new.C
blob9b65de991411617c3ff4b7e320bf0b111da832a3
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();
92         memcpy(new_edl->session->achannel_positions,
93                 &mwindow->preferences->channel_positions[
94                         MAXCHANNELS * (new_edl->session->audio_channels - 1)],
95                 sizeof(int) * MAXCHANNELS);
96         new_edl->session->boundaries();
97         new_edl->create_default_tracks();
99         mwindow->set_filename("");
100         mwindow->undo->update_undo(_("New"), LOAD_ALL);
102         mwindow->hide_plugins();
103         delete mwindow->edl;
104         mwindow->edl = new_edl;
105         mwindow->save_defaults();
107 // Load file sequence
108         mwindow->update_project(LOAD_REPLACE);
109         mwindow->session->changes_made = 0;
110         mwindow->gui->unlock_window();
111         return 0;
114 NewThread::NewThread(MWindow *mwindow, New *new_project)
115  : Thread()
117         this->mwindow = mwindow;
118         this->new_project = new_project;
119         window_lock = new Mutex("NewThread::window_lock");
122 NewThread::~NewThread()
124         delete window_lock;
128 void NewThread::run()
130         int result = 0;
131         load_defaults();
133         int x = mwindow->gui->get_root_w(0, 1) / 2 - WIDTH / 2;
134         int y = mwindow->gui->get_root_h(1) / 2 - HEIGHT / 2;
136         window_lock->lock("NewThread::run 1\n");
137         nwindow = new NewWindow(mwindow, this, x, y);
138         nwindow->create_objects();
139         window_lock->unlock();
141         result = nwindow->run_window();
143         window_lock->lock("NewThread::run 2\n");
144         delete nwindow; 
145         nwindow = 0;
146         window_lock->unlock();
148         new_project->new_edl->save_defaults(mwindow->defaults);
149         mwindow->defaults->save();
151         if(result)
152         {
153 // Aborted
154                 delete new_project->new_edl;
155         }
156         else
157         {
158                 new_project->create_new_project();
159         }
162 int NewThread::load_defaults()
164         auto_aspect = mwindow->defaults->get("AUTOASPECT", 0);
165         return 0;
168 int NewThread::save_defaults()
170         mwindow->defaults->update("AUTOASPECT", auto_aspect);
171         return 0;
174 int NewThread::update_aspect()
176         if(auto_aspect)
177         {
178                 char string[BCTEXTLEN];
179                 mwindow->create_aspect_ratio(new_project->new_edl->session->aspect_w, 
180                         new_project->new_edl->session->aspect_h, 
181                         new_project->new_edl->session->output_w, 
182                         new_project->new_edl->session->output_h);
183                 sprintf(string, "%.02f", new_project->new_edl->session->aspect_w);
184                 nwindow->aspect_w_text->update(string);
185                 sprintf(string, "%.02f", new_project->new_edl->session->aspect_h);
186                 nwindow->aspect_h_text->update(string);
187         }
188         return 0;
194 #if 0
195 N_("Cinelerra: New Project");
196 #endif
198 NewWindow::NewWindow(MWindow *mwindow, NewThread *new_thread, int x, int y)
199  : BC_Window(_(PROGRAM_NAME ": New Project"), 
200                 x,
201                 y,
202                 WIDTH, 
203                 HEIGHT,
204                 -1,
205                 -1,
206                 0,
207                 0,
208                 1)
210         this->mwindow = mwindow;
211         this->new_thread = new_thread;
212         this->new_edl = new_thread->new_project->new_edl;
213         format_presets = 0;
216 NewWindow::~NewWindow()
218         if(format_presets) delete format_presets;
221 int NewWindow::create_objects()
223         int x = 10, y = 10, x1, y1;
224         BC_TextBox *textbox;
226         mwindow->theme->draw_new_bg(this);
228         add_subwindow(new BC_Title(x, y, _("Parameters for the new project:")));
229         y += 20;
231         format_presets = new NewPresets(mwindow,
232                 this, 
233                 x, 
234                 y);
235         format_presets->create_objects();
236         x = format_presets->x;
237         y = format_presets->y;
241         y += 40;
242         y1 = y;
243         add_subwindow(new BC_Title(x, y, _("Audio"), LARGEFONT));
244         y += 30;
246         x1 = x;
247         add_subwindow(new BC_Title(x1, y, _("Tracks:")));
248         x1 += 100;
249         add_subwindow(atracks = new NewATracks(this, "", x1, y));
250         x1 += atracks->get_w();
251         add_subwindow(new NewATracksTumbler(this, x1, y));
252         y += atracks->get_h() + 5;
254         x1 = x;
255         add_subwindow(new BC_Title(x1, y, _("Channels:")));
256         x1 += 100;
257         add_subwindow(achannels = new NewAChannels(this, "", x1, y));
258         x1 += achannels->get_w();
259         add_subwindow(new NewAChannelsTumbler(this, x1, y));
260         y += achannels->get_h() + 5;
262         x1 = x;
263         add_subwindow(new BC_Title(x1, y, _("Samplerate:")));
264         x1 += 100;
265         add_subwindow(sample_rate = new NewSampleRate(this, "", x1, y));
266         x1 += sample_rate->get_w();
267         add_subwindow(new SampleRatePulldown(mwindow, sample_rate, x1, y));
268         
269         x += 250;
270         y = y1;
271         add_subwindow(new BC_Title(x, y, _("Video"), LARGEFONT));
272         y += 30;
273         x1 = x;
274         add_subwindow(new BC_Title(x1, y, _("Tracks:")));
275         x1 += 100;
276         add_subwindow(vtracks = new NewVTracks(this, "", x1, y));
277         x1 += vtracks->get_w();
278         add_subwindow(new NewVTracksTumbler(this, x1, y));
279         y += vtracks->get_h() + 5;
281 //      x1 = x;
282 //      add_subwindow(new BC_Title(x1, y, _("Channels:")));
283 //      x1 += 100;
284 //      add_subwindow(vchannels = new NewVChannels(this, "", x1, y));
285 //      x1 += vchannels->get_w();
286 //      add_subwindow(new NewVChannelsTumbler(this, x1, y));
287 //      y += vchannels->get_h() + 5;
288         x1 = x;
289         add_subwindow(new BC_Title(x1, y, _("Framerate:")));
290         x1 += 100;
291         add_subwindow(frame_rate = new NewFrameRate(this, "", x1, y));
292         x1 += frame_rate->get_w();
293         add_subwindow(new FrameRatePulldown(mwindow, frame_rate, x1, y));
294         y += frame_rate->get_h() + 5;
296 //      x1 = x;
297 //      add_subwindow(new BC_Title(x1, y, _("Canvas size:")));
298 //      x1 += 100;
299 //      add_subwindow(canvas_w_text = new NewTrackW(this, x1, y));
300 //      x1 += canvas_w_text->get_w() + 2;
301 //      add_subwindow(new BC_Title(x1, y, "x"));
302 //      x1 += 10;
303 //      add_subwindow(canvas_h_text = new NewTrackH(this, x1, y));
304 //      x1 += canvas_h_text->get_w();
305 //      add_subwindow(new FrameSizePulldown(mwindow, 
306 //              canvas_w_text, 
307 //              canvas_h_text, 
308 //              x1, 
309 //              y));
310 //      x1 += 100;
311 //      add_subwindow(new NewCloneToggle(mwindow, this, x1, y));
312 //      y += canvas_h_text->get_h() + 5;
314         x1 = x;
315         add_subwindow(new BC_Title(x1, y, _("Canvas size:")));
316         x1 += 100;
317         add_subwindow(output_w_text = new NewOutputW(this, x1, y));
318         x1 += output_w_text->get_w() + 2;
319         add_subwindow(new BC_Title(x1, y, "x"));
320         x1 += 10;
321         add_subwindow(output_h_text = new NewOutputH(this, x1, y));
322         x1 += output_h_text->get_w();
323         FrameSizePulldown *pulldown;
324         add_subwindow(pulldown = new FrameSizePulldown(mwindow, 
325                 output_w_text, 
326                 output_h_text, 
327                 x1, 
328                 y));
329         x1 += pulldown->get_w() + 5;
330         add_subwindow(new NewSwapExtents(mwindow, this, x1, y));
331         y += output_h_text->get_h() + 5;
333         x1 = x;
334         add_subwindow(new BC_Title(x1, y, _("Aspect ratio:")));
335         x1 += 100;
336         add_subwindow(aspect_w_text = new NewAspectW(this, "", x1, y));
337         x1 += aspect_w_text->get_w() + 2;
338         add_subwindow(new BC_Title(x1, y, ":"));
339         x1 += 10;
340         add_subwindow(aspect_h_text = new NewAspectH(this, "", x1, y));
341         x1 += aspect_h_text->get_w();
342         add_subwindow(new AspectPulldown(mwindow, 
343                 aspect_w_text, 
344                 aspect_h_text, 
345                 x1, 
346                 y));
348         x1 = aspect_w_text->get_x();
349         y += aspect_w_text->get_h() + 5;
350         add_subwindow(new NewAspectAuto(this, x1, y));
351         y += 40;
352         add_subwindow(new BC_Title(x, y, _("Color model:")));
353         add_subwindow(textbox = new BC_TextBox(x + 100, y, 200, 1, ""));
354         add_subwindow(new ColormodelPulldown(mwindow, 
355                 textbox, 
356                 &new_edl->session->color_model,
357                 x + 100 + textbox->get_w(),
358                 y));
359         y += textbox->get_h() + 5;
361         // --------------------
362         add_subwindow(new BC_Title(x, y, _("Interlace mode:")));
363         add_subwindow(textbox = new BC_TextBox(x + 100, y, 140, 1, ""));
364         add_subwindow(new InterlacemodePulldown(mwindow, 
365                 textbox, 
366                 &new_edl->session->interlace_mode,
367                 (ArrayList<BC_ListBoxItem*>*)&mwindow->interlace_project_modes,
368                 x + 100 + textbox->get_w(), 
369                 y)); 
370         y += textbox->get_h() + 5;
372         add_subwindow(new BC_OKButton(this, 
373                 mwindow->theme->get_image_set("new_ok_images")));
374         add_subwindow(new BC_CancelButton(this, 
375                 mwindow->theme->get_image_set("new_cancel_images")));
376         flash();
377         update();
378         show_window();
379         return 0;
382 int NewWindow::update()
384         char string[BCTEXTLEN];
385         atracks->update((int64_t)new_edl->session->audio_tracks);
386         achannels->update((int64_t)new_edl->session->audio_channels);
387         sample_rate->update((int64_t)new_edl->session->sample_rate);
388         vtracks->update((int64_t)new_edl->session->video_tracks);
389         frame_rate->update((float)new_edl->session->frame_rate);
390         output_w_text->update((int64_t)new_edl->session->output_w);
391         output_h_text->update((int64_t)new_edl->session->output_h);
392         aspect_w_text->update((float)new_edl->session->aspect_w);
393         aspect_h_text->update((float)new_edl->session->aspect_h);
394         return 0;
403 NewPresets::NewPresets(MWindow *mwindow, NewWindow *gui, int x, int y)
404  : FormatPresets(mwindow, gui, 0, x, y)
408 NewPresets::~NewPresets()
412 int NewPresets::handle_event()
414         new_gui->update();
415         return 1;
418 EDL* NewPresets::get_edl()
420         return new_gui->new_edl;
425 NewATracks::NewATracks(NewWindow *nwindow, char *text, int x, int y)
426  : BC_TextBox(x, y, 90, 1, text)
428         this->nwindow = nwindow;
431 int NewATracks::handle_event()
433         nwindow->new_edl->session->audio_tracks = atol(get_text());
434         return 1;
437 NewATracksTumbler::NewATracksTumbler(NewWindow *nwindow, int x, int y)
438  : BC_Tumbler(x, y)
440         this->nwindow = nwindow;
442 int NewATracksTumbler::handle_up_event()
444         nwindow->new_edl->session->audio_tracks++;
445         nwindow->new_edl->boundaries();
446         nwindow->update();
447         return 1;
449 int NewATracksTumbler::handle_down_event()
451         nwindow->new_edl->session->audio_tracks--;
452         nwindow->new_edl->boundaries();
453         nwindow->update();
454         return 1;
457 NewAChannels::NewAChannels(NewWindow *nwindow, char *text, int x, int y)
458  : BC_TextBox(x, y, 90, 1, text)
460         this->nwindow = nwindow;
463 int NewAChannels::handle_event()
465         nwindow->new_edl->session->audio_channels = atol(get_text());
466         return 1;
469 NewAChannelsTumbler::NewAChannelsTumbler(NewWindow *nwindow, int x, int y)
470  : BC_Tumbler(x, y)
472         this->nwindow = nwindow;
474 int NewAChannelsTumbler::handle_up_event()
476         nwindow->new_edl->session->audio_channels++;
477         nwindow->new_edl->boundaries();
478         nwindow->update();
479         return 1;
481 int NewAChannelsTumbler::handle_down_event()
483         nwindow->new_edl->session->audio_channels--;
484         nwindow->new_edl->boundaries();
485         nwindow->update();
486         return 1;
490 NewSampleRate::NewSampleRate(NewWindow *nwindow, char *text, int x, int y)
491  : BC_TextBox(x, y, 90, 1, text)
493         this->nwindow = nwindow;
496 int NewSampleRate::handle_event()
498         nwindow->new_edl->session->sample_rate = atol(get_text());
499         return 1;
502 SampleRatePulldown::SampleRatePulldown(MWindow *mwindow, BC_TextBox *output, int x, int y)
503  : BC_ListBox(x,
504         y,
505         100,
506         200,
507         LISTBOX_TEXT,
508         &mwindow->theme->sample_rates,
509         0,
510         0,
511         1,
512         0,
513         1)
515         this->mwindow = mwindow;
516         this->output = output;
518 int SampleRatePulldown::handle_event()
520         char *text = get_selection(0, 0)->get_text();
521         output->update(text);
522         output->handle_event();
523         return 1;
540 NewVTracks::NewVTracks(NewWindow *nwindow, char *text, int x, int y)
541  : BC_TextBox(x, y, 90, 1, text)
543         this->nwindow = nwindow;
546 int NewVTracks::handle_event()
548         nwindow->new_edl->session->video_tracks = atol(get_text());
549         return 1;
552 NewVTracksTumbler::NewVTracksTumbler(NewWindow *nwindow, int x, int y)
553  : BC_Tumbler(x, y)
555         this->nwindow = nwindow;
557 int NewVTracksTumbler::handle_up_event()
559         nwindow->new_edl->session->video_tracks++;
560         nwindow->new_edl->boundaries();
561         nwindow->update();
562         return 1;
564 int NewVTracksTumbler::handle_down_event()
566         nwindow->new_edl->session->video_tracks--;
567         nwindow->new_edl->boundaries();
568         nwindow->update();
569         return 1;
572 NewVChannels::NewVChannels(NewWindow *nwindow, char *text, int x, int y)
573  : BC_TextBox(x, y, 90, 1, text)
575         this->nwindow = nwindow;
578 int NewVChannels::handle_event()
580         nwindow->new_edl->session->video_channels = atol(get_text());
581         return 1;
584 NewVChannelsTumbler::NewVChannelsTumbler(NewWindow *nwindow, int x, int y)
585  : BC_Tumbler(x, y)
587         this->nwindow = nwindow;
589 int NewVChannelsTumbler::handle_up_event()
591         nwindow->new_edl->session->video_channels++;
592         nwindow->new_edl->boundaries();
593         nwindow->update();
594         return 1;
596 int NewVChannelsTumbler::handle_down_event()
598         nwindow->new_edl->session->video_channels--;
599         nwindow->new_edl->boundaries();
600         nwindow->update();
601         return 1;
604 NewFrameRate::NewFrameRate(NewWindow *nwindow, char *text, int x, int y)
605  : BC_TextBox(x, y, 90, 1, text)
607         this->nwindow = nwindow;
610 int NewFrameRate::handle_event()
612         nwindow->new_edl->session->frame_rate = Units::atoframerate(get_text());
613         return 1;
616 FrameRatePulldown::FrameRatePulldown(MWindow *mwindow, 
617         BC_TextBox *output, 
618         int x, 
619         int y)
620  : BC_ListBox(x,
621         y,
622         100,
623         200,
624         LISTBOX_TEXT,
625         &mwindow->theme->frame_rates,
626         0,
627         0,
628         1,
629         0,
630         1)
632         this->mwindow = mwindow;
633         this->output = output;
635 int FrameRatePulldown::handle_event()
637         char *text = get_selection(0, 0)->get_text();
638         output->update(text);
639         output->handle_event();
640         return 1;
643 FrameSizePulldown::FrameSizePulldown(MWindow *mwindow, 
644                 BC_TextBox *output_w, 
645                 BC_TextBox *output_h, 
646                 int x, 
647                 int y)
648  : BC_ListBox(x,
649         y,
650         100,
651         200,
652         LISTBOX_TEXT,
653         &mwindow->theme->frame_sizes,
654         0,
655         0,
656         1,
657         0,
658         1)
660         this->mwindow = mwindow;
661         this->output_w = output_w;
662         this->output_h = output_h;
664 int FrameSizePulldown::handle_event()
666         char *text = get_selection(0, 0)->get_text();
667         char string[BCTEXTLEN];
668         int64_t w, h;
669         char *ptr;
670         
671         strcpy(string, text);
672         ptr = strrchr(string, 'x');
673         if(ptr)
674         {
675                 ptr++;
676                 h = atol(ptr);
677                 
678                 *--ptr = 0;
679                 w = atol(string);
680                 output_w->update(w);
681                 output_h->update(h);
682                 output_w->handle_event();
683                 output_h->handle_event();
684         }
685         return 1;
688 NewOutputW::NewOutputW(NewWindow *nwindow, int x, int y)
689  : BC_TextBox(x, y, 70, 1, nwindow->new_edl->session->output_w)
691         this->nwindow = nwindow;
693 int NewOutputW::handle_event()
695         nwindow->new_edl->session->output_w = MAX(1,atol(get_text()));
696         nwindow->new_thread->update_aspect();
697         return 1;
700 NewOutputH::NewOutputH(NewWindow *nwindow, int x, int y)
701  : BC_TextBox(x, y, 70, 1, nwindow->new_edl->session->output_h)
703         this->nwindow = nwindow;
705 int NewOutputH::handle_event()
707         nwindow->new_edl->session->output_h = MAX(1, atol(get_text()));
708         nwindow->new_thread->update_aspect();
709         return 1;
712 NewAspectW::NewAspectW(NewWindow *nwindow, char *text, int x, int y)
713  : BC_TextBox(x, y, 70, 1, text)
715         this->nwindow = nwindow;
718 int NewAspectW::handle_event()
720         nwindow->new_edl->session->aspect_w = atof(get_text());
721         return 1;
724 NewAspectH::NewAspectH(NewWindow *nwindow, char *text, int x, int y)
725  : BC_TextBox(x, y, 70, 1, text)
727         this->nwindow = nwindow;
730 int NewAspectH::handle_event()
732         nwindow->new_edl->session->aspect_h = atof(get_text());
733         return 1;
736 AspectPulldown::AspectPulldown(MWindow *mwindow, 
737                 BC_TextBox *output_w, 
738                 BC_TextBox *output_h, 
739                 int x, 
740                 int y)
741  : BC_ListBox(x,
742         y,
743         100,
744         200,
745         LISTBOX_TEXT,
746         &mwindow->theme->aspect_ratios,
747         0,
748         0,
749         1,
750         0,
751         1)
753         this->mwindow = mwindow;
754         this->output_w = output_w;
755         this->output_h = output_h;
757 int AspectPulldown::handle_event()
759         char *text = get_selection(0, 0)->get_text();
760         char string[BCTEXTLEN];
761         float w, h;
762         char *ptr;
763         
764         strcpy(string, text);
765         ptr = strrchr(string, ':');
766         if(ptr)
767         {
768                 ptr++;
769                 h = atof(ptr);
770                 
771                 *--ptr = 0;
772                 w = atof(string);
773                 output_w->update(w);
774                 output_h->update(h);
775                 output_w->handle_event();
776                 output_h->handle_event();
777         }
778         return 1;
781 ColormodelItem::ColormodelItem(char *text, int value)
782  : BC_ListBoxItem(text)
784         this->value = value;
787 ColormodelPulldown::ColormodelPulldown(MWindow *mwindow, 
788                 BC_TextBox *output_text, 
789                 int *output_value,
790                 int x, 
791                 int y)
792  : BC_ListBox(x,
793         y,
794         200,
795         150,
796         LISTBOX_TEXT,
797         (ArrayList<BC_ListBoxItem*>*)&mwindow->colormodels,
798         0,
799         0,
800         1,
801         0,
802         1)
804         this->mwindow = mwindow;
805         this->output_text = output_text;
806         this->output_value = output_value;
807         output_text->update(colormodel_to_text());
810 int ColormodelPulldown::handle_event()
812         output_text->update(get_selection(0, 0)->get_text());
813         *output_value = ((ColormodelItem*)get_selection(0, 0))->value;
814         return 1;
817 char* ColormodelPulldown::colormodel_to_text()
819         for(int i = 0; i < mwindow->colormodels.total; i++)
820                 if(mwindow->colormodels.values[i]->value == *output_value) 
821                         return mwindow->colormodels.values[i]->get_text();
822         return "Unknown";
825 InterlacemodeItem::InterlacemodeItem(char *text, int value)
826  : BC_ListBoxItem(text)
828         this->value = value;
831 InterlacemodePulldown::InterlacemodePulldown(MWindow *mwindow, 
832                 BC_TextBox *output_text,
833                 int *output_value,
834                 ArrayList<BC_ListBoxItem*> *data,
835                 int x, 
836                 int y)
837  : BC_ListBox(x,
838         y,
839         200,
840         150,
841         LISTBOX_TEXT,
842         data,
843         0,
844         0,
845         1,
846         0,
847         1)
849         char string[BCTEXTLEN];
850         this->mwindow = mwindow;
851         this->output_text = output_text;
852         this->output_value = output_value;
853         output_text->update(interlacemode_to_text());
856 int InterlacemodePulldown::handle_event()
858         output_text->update(get_selection(0, 0)->get_text());
859         *output_value = ((InterlacemodeItem*)get_selection(0, 0))->value;
860         return 1;
863 char* InterlacemodePulldown::interlacemode_to_text()
865         ilacemode_to_text(this->string,*output_value);
866         return (this->string);
869 NewAspectAuto::NewAspectAuto(NewWindow *nwindow, int x, int y)
870  : BC_CheckBox(x, y, nwindow->new_thread->auto_aspect, _("Auto aspect ratio"))
872         this->nwindow = nwindow;
874 NewAspectAuto::~NewAspectAuto()
877 int NewAspectAuto::handle_event()
879         nwindow->new_thread->auto_aspect = get_value();
880         nwindow->new_thread->update_aspect();
881         return 1;
891 NewSwapExtents::NewSwapExtents(MWindow *mwindow, NewWindow *gui, int x, int y)
892  : BC_Button(x, y, mwindow->theme->get_image_set("swap_extents"))
894         this->mwindow = mwindow;
895         this->gui = gui;
896         set_tooltip("Swap dimensions");
899 int NewSwapExtents::handle_event()
901         int w = gui->new_edl->session->output_w;
902         int h = gui->new_edl->session->output_h;
903         gui->new_edl->session->output_w = h;
904         gui->new_edl->session->output_h = w;
905         gui->output_w_text->update((int64_t)h);
906         gui->output_h_text->update((int64_t)w);
907         gui->new_thread->update_aspect();
908         return 1;