r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / new.C
blob8640fa1db694aaf12a40238e4f1cdfa9069651d1
1 #include "cplayback.h"
2 #include "cwindow.h"
3 #include "defaults.h"
4 #include "edl.h"
5 #include "edlsession.h"
6 #include "filexml.h"
7 #include "levelwindow.h"
8 #include "mainundo.h"
9 #include "mainmenu.h"
10 #include "mwindow.h"
11 #include "mwindowgui.h"
12 #include "new.h"
13 #include "mainsession.h"
14 #include "patchbay.h"
15 #include "theme.h"
16 #include "transportque.h"
17 #include "videowindow.h"
18 #include "vplayback.h"
19 #include "vwindow.h"
21 #include <string.h>
23 #include <libintl.h>
24 #define _(String) gettext(String)
25 #define gettext_noop(String) String
26 #define N_(String) gettext_noop (String)
28 New::New(MWindow *mwindow)
29  : BC_MenuItem(_("New..."), "n", 'n')
31         this->mwindow = mwindow;
32         script = 0;
35 int New::create_objects()
37         thread = new NewThread(mwindow, this);
38         return 0;
41 int New::handle_event() 
43         if(thread->running())
44         {
45                 thread->nwindow->raise_window();
46                 return 1;
47         }
48         mwindow->edl->save_defaults(mwindow->defaults);
49         create_new_edl();
50         thread->start(); 
52         return 1;
55 void New::create_new_edl()
57         new_edl = new EDL;
58         new_edl->create_objects();
59         new_edl->load_defaults(mwindow->defaults);
63 int New::create_new_project()
65         mwindow->cwindow->playback_engine->que->send_command(STOP,
66                 CHANGE_NONE, 
67                 0,
68                 0);
69         mwindow->vwindow->playback_engine->que->send_command(STOP,
70                 CHANGE_NONE, 
71                 0,
72                 0);
73         mwindow->cwindow->playback_engine->interrupt_playback(0);
74         mwindow->vwindow->playback_engine->interrupt_playback(0);
76         mwindow->gui->lock_window();
77         mwindow->undo->update_undo_before(_("New"), LOAD_ALL);
79         new_edl->session->boundaries();
80         new_edl->create_default_tracks();
82         mwindow->set_filename("");
83         mwindow->undo->update_undo_after();
85         mwindow->hide_plugins();
86         delete mwindow->edl;
87 // Delete patches which are pointing to tracks which have been just deleted.
88         mwindow->patches->delete_all_patches();
89         mwindow->edl = new_edl;
90         mwindow->save_defaults();
92 // Load file sequence
93         mwindow->update_project(LOAD_REPLACE);
94         mwindow->session->changes_made = 0;
95         mwindow->gui->unlock_window();
96         return 0;
99 NewThread::NewThread(MWindow *mwindow, New *new_project)
100  : Thread()
102         this->mwindow = mwindow;
103         this->new_project = new_project;
106 NewThread::~NewThread()
111 void NewThread::run()
113         int result = 0;
114         load_defaults();
116         {
117                 nwindow = new NewWindow(mwindow, this);
118                 nwindow->create_objects();
119                 result = nwindow->run_window();
120                 delete nwindow; 
121 //printf("NewThread::run 1\n");
122                 new_project->new_edl->save_defaults(mwindow->defaults);
123 //printf("NewThread::run 2\n");
124                 mwindow->defaults->save();
125 //printf("NewThread::run 3\n");
126         }
128         if(result)
129         {
130 // Aborted
131                 delete new_project->new_edl;
132         }
133         else
134         {
135 //printf("NewThread::run 4\n");
136                 new_project->create_new_project();
137 //printf("NewThread::run 5\n");
138         }
141 int NewThread::load_defaults()
143         auto_aspect = mwindow->defaults->get("AUTOASPECT", 0);
144         return 0;
147 int NewThread::save_defaults()
149         mwindow->defaults->update("AUTOASPECT", auto_aspect);
150         return 0;
153 int NewThread::update_aspect()
155         if(auto_aspect)
156         {
157                 char string[1024];
158                 mwindow->create_aspect_ratio(new_project->new_edl->session->aspect_w, 
159                         new_project->new_edl->session->aspect_h, 
160                         new_project->new_edl->session->output_w, 
161                         new_project->new_edl->session->output_h);
162                 sprintf(string, "%.02f", new_project->new_edl->session->aspect_w);
163                 nwindow->aspect_w_text->update(string);
164                 sprintf(string, "%.02f", new_project->new_edl->session->aspect_h);
165                 nwindow->aspect_h_text->update(string);
166         }
167         return 0;
170 #define WIDTH 600
171 #define HEIGHT 400
173 #if 0
174 N_("Cinelerra: New Project");
175 #endif
177 NewWindow::NewWindow(MWindow *mwindow, NewThread *new_thread)
178  : BC_Window(_(PROGRAM_NAME ": New Project"), 
179                 mwindow->gui->get_root_w() / 2 - WIDTH / 2,
180                 mwindow->gui->get_root_h() / 2 - HEIGHT / 2,
181                 WIDTH, 
182                 HEIGHT,
183                 -1,
184                 -1,
185                 0,
186                 0,
187                 1)
189         this->mwindow = mwindow;
190         this->new_thread = new_thread;
191         this->new_edl = new_thread->new_project->new_edl;
194 NewWindow::~NewWindow()
196         for(int i = 0; i < preset_items.total; i++)
197                 delete preset_items.values[i];
200 void NewWindow::create_presets(int &x, int &y)
202         NewPresetItem *item;
203         add_subwindow(new BC_Title(x, y, _("Presets:")));
204         int x1 = x;
205         y += 20;
207         item = new NewPresetItem(mwindow, this, _("User Defined"));
208         preset_items.append(item);
210         item = new NewPresetItem(mwindow, this, _("1080 Progressive"));
211         item->edl->session->audio_channels = 2;
212         item->edl->session->audio_tracks = 2;
213         item->edl->session->sample_rate = 48000;
214         item->edl->session->video_channels = 1;
215         item->edl->session->video_tracks = 1;
216         item->edl->session->frame_rate = (double)30000.0 / 1001;
217 //      item->edl->session->track_w = 1920;
218 //      item->edl->session->track_h = 1080;
219         item->edl->session->output_w = 1920;
220         item->edl->session->output_h = 1080;
221         item->edl->session->aspect_w = 16;
222         item->edl->session->aspect_h = 9;
223         preset_items.append(item);
225         item = new NewPresetItem(mwindow, this, _("1080 Interlaced"));
226         item->edl->session->audio_channels = 2;
227         item->edl->session->audio_tracks = 2;
228         item->edl->session->sample_rate = 48000;
229         item->edl->session->video_channels = 1;
230         item->edl->session->video_tracks = 1;
231         item->edl->session->frame_rate = (double)60000.0 / 1001;
232 //      item->edl->session->track_w = 1920;
233 //      item->edl->session->track_h = 1080;
234         item->edl->session->output_w = 1920;
235         item->edl->session->output_h = 1080;
236         item->edl->session->aspect_w = 16;
237         item->edl->session->aspect_h = 9;
238         preset_items.append(item);
240         item = new NewPresetItem(mwindow, this, _("720 Progressive"));
241         item->edl->session->audio_channels = 2;
242         item->edl->session->audio_tracks = 2;
243         item->edl->session->sample_rate = 48000;
244         item->edl->session->video_channels = 1;
245         item->edl->session->video_tracks = 1;
246         item->edl->session->frame_rate = (double)30000.0 / 1001;
247 //      item->edl->session->track_w = 1280;
248 //      item->edl->session->track_h = 720;
249         item->edl->session->output_w = 1280;
250         item->edl->session->output_h = 720;
251         item->edl->session->aspect_w = 16;
252         item->edl->session->aspect_h = 9;
253         preset_items.append(item);
255         item = new NewPresetItem(mwindow, this, _("480 Progressive"));
256         item->edl->session->audio_channels = 2;
257         item->edl->session->audio_tracks = 2;
258         item->edl->session->sample_rate = 48000;
259         item->edl->session->video_channels = 1;
260         item->edl->session->video_tracks = 1;
261         item->edl->session->frame_rate = (double)30000.0 / 1001;
262 //      item->edl->session->track_w = 720;
263 //      item->edl->session->track_h = 480;
264         item->edl->session->output_w = 720;
265         item->edl->session->output_h = 480;
266         item->edl->session->aspect_w = 4;
267         item->edl->session->aspect_h = 3;
268         preset_items.append(item);
270         item = new NewPresetItem(mwindow, this, _("480 Interlaced"));
271         item->edl->session->audio_channels = 2;
272         item->edl->session->audio_tracks = 2;
273         item->edl->session->sample_rate = 48000;
274         item->edl->session->video_channels = 1;
275         item->edl->session->video_tracks = 1;
276         item->edl->session->frame_rate = (double)60000.0 / 1001;
277 //      item->edl->session->track_w = 720;
278 //      item->edl->session->track_h = 480;
279         item->edl->session->output_w = 720;
280         item->edl->session->output_h = 480;
281         item->edl->session->aspect_w = 4;
282         item->edl->session->aspect_h = 3;
283         preset_items.append(item);
285         item = new NewPresetItem(mwindow, this, _("Half D-1 NTSC"));
286         item->edl->session->audio_channels = 2;
287         item->edl->session->audio_tracks = 2;
288         item->edl->session->sample_rate = 48000;
289         item->edl->session->video_channels = 1;
290         item->edl->session->video_tracks = 1;
291         item->edl->session->frame_rate = (double)30000.0 / 1001;
292 //      item->edl->session->track_w = 360;
293 //      item->edl->session->track_h = 240;
294         item->edl->session->output_w = 360;
295         item->edl->session->output_h = 240;
296         item->edl->session->aspect_w = 4;
297         item->edl->session->aspect_h = 3;
298         preset_items.append(item);
300         item = new NewPresetItem(mwindow, this, _("Internet"));
301         item->edl->session->audio_channels = 1;
302         item->edl->session->audio_tracks = 1;
303         item->edl->session->sample_rate = 22050;
304         item->edl->session->video_channels = 1;
305         item->edl->session->video_tracks = 1;
306         item->edl->session->frame_rate = 15;
307 //      item->edl->session->track_w = 320;
308 //      item->edl->session->track_h = 240;
309         item->edl->session->output_w = 320;
310         item->edl->session->output_h = 240;
311         item->edl->session->aspect_w = 4;
312         item->edl->session->aspect_h = 3;
313         preset_items.append(item);
315         item = new NewPresetItem(mwindow, this, _("CD Audio"));
316         item->edl->session->audio_channels = 2;
317         item->edl->session->audio_tracks = 2;
318         item->edl->session->sample_rate = 44100;
319         item->edl->session->video_channels = 1;
320         item->edl->session->video_tracks = 0;
321         item->edl->session->frame_rate = (double)30000.0 / 1001;
322 //      item->edl->session->track_w = 720;
323 //      item->edl->session->track_h = 480;
324         item->edl->session->output_w = 720;
325         item->edl->session->output_h = 480;
326         item->edl->session->aspect_w = 4;
327         item->edl->session->aspect_h = 3;
328         preset_items.append(item);
330         item = new NewPresetItem(mwindow, this, _("DAT Audio"));
331         item->edl->session->audio_channels = 2;
332         item->edl->session->audio_tracks = 2;
333         item->edl->session->sample_rate = 48000;
334         item->edl->session->video_channels = 1;
335         item->edl->session->video_tracks = 0;
336         item->edl->session->frame_rate = (double)30000.0 / 1001;
337 //      item->edl->session->track_w = 720;
338 //      item->edl->session->track_h = 480;
339         item->edl->session->output_w = 720;
340         item->edl->session->output_h = 480;
341         item->edl->session->aspect_w = 4;
342         item->edl->session->aspect_h = 3;
343         preset_items.append(item);
345         add_subwindow(presets_text = new NewPresetsText(mwindow, this, x, y));
346         x += presets_text->get_w();
347         add_subwindow(presets = new NewPresetsPulldown(mwindow, this, x, y));
348         x = x1;
351 int NewWindow::create_objects()
353         int x = 10, y = 10, x1, y1;
354         BC_TextBox *textbox;
356         mwindow->theme->draw_new_bg(this);
358         add_subwindow(new BC_Title(x, y, _("Parameters for the new project:")));
359         y += 20;
360         create_presets(x, y);
361         y += 40;
362         y1 = y;
363         add_subwindow(new BC_Title(x, y, _("Audio"), LARGEFONT));
364         y += 30;
366         x1 = x;
367         add_subwindow(new BC_Title(x1, y, _("Tracks:")));
368         x1 += 100;
369         add_subwindow(atracks = new NewATracks(this, "", x1, y));
370         x1 += atracks->get_w();
371         add_subwindow(new NewATracksTumbler(this, x1, y));
372         y += atracks->get_h() + 5;
374         x1 = x;
375         add_subwindow(new BC_Title(x1, y, _("Channels:")));
376         x1 += 100;
377         add_subwindow(achannels = new NewAChannels(this, "", x1, y));
378         x1 += achannels->get_w();
379         add_subwindow(new NewAChannelsTumbler(this, x1, y));
380         y += achannels->get_h() + 5;
382         x1 = x;
383         add_subwindow(new BC_Title(x1, y, _("Samplerate:")));
384         x1 += 100;
385         add_subwindow(sample_rate = new NewSampleRate(this, "", x1, y));
386         x1 += sample_rate->get_w();
387         add_subwindow(new SampleRatePulldown(mwindow, sample_rate, x1, y));
388         
389         x += 250;
390         y = y1;
391         add_subwindow(new BC_Title(x, y, _("Video"), LARGEFONT));
392         y += 30;
393         x1 = x;
394         add_subwindow(new BC_Title(x1, y, _("Tracks:")));
395         x1 += 100;
396         add_subwindow(vtracks = new NewVTracks(this, "", x1, y));
397         x1 += vtracks->get_w();
398         add_subwindow(new NewVTracksTumbler(this, x1, y));
399         y += vtracks->get_h() + 5;
401 //      x1 = x;
402 //      add_subwindow(new BC_Title(x1, y, _("Channels:")));
403 //      x1 += 100;
404 //      add_subwindow(vchannels = new NewVChannels(this, "", x1, y));
405 //      x1 += vchannels->get_w();
406 //      add_subwindow(new NewVChannelsTumbler(this, x1, y));
407 //      y += vchannels->get_h() + 5;
408         x1 = x;
409         add_subwindow(new BC_Title(x1, y, _("Framerate:")));
410         x1 += 100;
411         add_subwindow(frame_rate = new NewFrameRate(this, "", x1, y));
412         x1 += frame_rate->get_w();
413         add_subwindow(new FrameRatePulldown(mwindow, frame_rate, x1, y));
414         y += frame_rate->get_h() + 5;
416 //      x1 = x;
417 //      add_subwindow(new BC_Title(x1, y, _("Canvas size:")));
418 //      x1 += 100;
419 //      add_subwindow(canvas_w_text = new NewTrackW(this, x1, y));
420 //      x1 += canvas_w_text->get_w() + 2;
421 //      add_subwindow(new BC_Title(x1, y, "x"));
422 //      x1 += 10;
423 //      add_subwindow(canvas_h_text = new NewTrackH(this, x1, y));
424 //      x1 += canvas_h_text->get_w();
425 //      add_subwindow(new FrameSizePulldown(mwindow, 
426 //              canvas_w_text, 
427 //              canvas_h_text, 
428 //              x1, 
429 //              y));
430 //      x1 += 100;
431 //      add_subwindow(new NewCloneToggle(mwindow, this, x1, y));
432 //      y += canvas_h_text->get_h() + 5;
434         x1 = x;
435         add_subwindow(new BC_Title(x1, y, _("Canvas size:")));
436         x1 += 100;
437         add_subwindow(output_w_text = new NewOutputW(this, x1, y));
438         x1 += output_w_text->get_w() + 2;
439         add_subwindow(new BC_Title(x1, y, "x"));
440         x1 += 10;
441         add_subwindow(output_h_text = new NewOutputH(this, x1, y));
442         x1 += output_h_text->get_w();
443         add_subwindow(new FrameSizePulldown(mwindow, 
444                 output_w_text, 
445                 output_h_text, 
446                 x1, 
447                 y));
448         y += output_h_text->get_h() + 5;
450         x1 = x;
451         add_subwindow(new BC_Title(x1, y, _("Aspect ratio:")));
452         x1 += 100;
453         add_subwindow(aspect_w_text = new NewAspectW(this, "", x1, y));
454         x1 += aspect_w_text->get_w() + 2;
455         add_subwindow(new BC_Title(x1, y, ":"));
456         x1 += 10;
457         add_subwindow(aspect_h_text = new NewAspectH(this, "", x1, y));
458         x1 += aspect_h_text->get_w();
459         add_subwindow(new AspectPulldown(mwindow, 
460                 aspect_w_text, 
461                 aspect_h_text, 
462                 x1, 
463                 y));
465         x1 = aspect_w_text->get_x();
466         y += aspect_w_text->get_h() + 5;
467         add_subwindow(new NewAspectAuto(this, x1, y));
468         y += 40;
469         add_subwindow(new BC_Title(x, y, _("Color model:")));
470         x += 100;
471         add_subwindow(textbox = new BC_TextBox(x, y, 200, 1, ""));
472         x += textbox->get_w();
473         add_subwindow(new ColormodelPulldown(mwindow, 
474                 textbox, 
475                 &new_edl->session->color_model,
476                 x, 
477                 y));
479         add_subwindow(new BC_OKButton(this));
480         add_subwindow(new BC_CancelButton(this));
481         flash();
482         update();
483         show_window();
484         return 0;
487 int NewWindow::update()
489         char string[BCTEXTLEN];
490         atracks->update((int64_t)new_edl->session->audio_tracks);
491         achannels->update((int64_t)new_edl->session->audio_channels);
492         sample_rate->update((int64_t)new_edl->session->sample_rate);
493         vtracks->update((int64_t)new_edl->session->video_tracks);
494 //      vchannels->update((int64_t)new_edl->session->video_channels);
495         frame_rate->update((float)new_edl->session->frame_rate);
496 //      canvas_w_text->update((int64_t)new_edl->session->track_w);
497 //      canvas_h_text->update((int64_t)new_edl->session->track_h);
498         output_w_text->update((int64_t)new_edl->session->output_w);
499         output_h_text->update((int64_t)new_edl->session->output_h);
500         aspect_w_text->update((float)new_edl->session->aspect_w);
501         aspect_h_text->update((float)new_edl->session->aspect_h);
502         return 0;
505 NewPresetsText::NewPresetsText(MWindow *mwindow, NewWindow *window, int x, int y)
506  : BC_TextBox(x, y, 200, 1, window->preset_items.values[0]->get_text())
508         this->mwindow = mwindow;
509         this->window = window;
512 int NewPresetsText::handle_event()
514         return 1;
521 NewPresetsPulldown::NewPresetsPulldown(MWindow *mwindow, NewWindow *window, int x, int y)
522  : BC_ListBox(x, 
523                 y, 
524                 200, 
525                 200,
526                 LISTBOX_TEXT,                   // Display text list or icons
527                 (ArrayList<BC_ListBoxItem*>*)&window->preset_items, // Each column has an ArrayList of BC_ListBoxItems.
528                 0,             // Titles for columns.  Set to 0 for no titles
529                 0,                // width of each column
530                 1,                      // Total columns.
531                 0,                    // Pixel of top of window.
532                 1)
534         this->mwindow = mwindow;
535         this->window = window;
537 int NewPresetsPulldown::handle_event()
539         NewPresetItem *preset = ((NewPresetItem*)get_selection(0, 0));
540         window->new_edl->copy_all(preset->edl);
541         window->update();
542         window->presets_text->update(preset->get_text());
543         return 1;
546 NewPresetItem::NewPresetItem(MWindow *mwindow, NewWindow *window, char *text)
547  : BC_ListBoxItem(text)
549         this->mwindow = mwindow;
550         this->window = window;
551         edl = new EDL;
552         edl->create_objects();
553         edl->copy_all(window->new_edl);
556 NewPresetItem::~NewPresetItem()
558         delete edl;
565 NewATracks::NewATracks(NewWindow *nwindow, char *text, int x, int y)
566  : BC_TextBox(x, y, 90, 1, text)
568         this->nwindow = nwindow;
571 int NewATracks::handle_event()
573         nwindow->new_edl->session->audio_tracks = atol(get_text());
574         return 1;
577 NewATracksTumbler::NewATracksTumbler(NewWindow *nwindow, int x, int y)
578  : BC_Tumbler(x, y)
580         this->nwindow = nwindow;
582 int NewATracksTumbler::handle_up_event()
584         nwindow->new_edl->session->audio_tracks++;
585         nwindow->new_edl->boundaries();
586         nwindow->update();
587         return 1;
589 int NewATracksTumbler::handle_down_event()
591         nwindow->new_edl->session->audio_tracks--;
592         nwindow->new_edl->boundaries();
593         nwindow->update();
594         return 1;
597 NewAChannels::NewAChannels(NewWindow *nwindow, char *text, int x, int y)
598  : BC_TextBox(x, y, 90, 1, text)
600         this->nwindow = nwindow;
603 int NewAChannels::handle_event()
605         nwindow->new_edl->session->audio_channels = atol(get_text());
606         return 1;
609 NewAChannelsTumbler::NewAChannelsTumbler(NewWindow *nwindow, int x, int y)
610  : BC_Tumbler(x, y)
612         this->nwindow = nwindow;
614 int NewAChannelsTumbler::handle_up_event()
616         nwindow->new_edl->session->audio_channels++;
617         nwindow->new_edl->boundaries();
618         nwindow->update();
619         return 1;
621 int NewAChannelsTumbler::handle_down_event()
623         nwindow->new_edl->session->audio_channels--;
624         nwindow->new_edl->boundaries();
625         nwindow->update();
626         return 1;
630 NewSampleRate::NewSampleRate(NewWindow *nwindow, char *text, int x, int y)
631  : BC_TextBox(x, y, 90, 1, text)
633         this->nwindow = nwindow;
636 int NewSampleRate::handle_event()
638         nwindow->new_edl->session->sample_rate = atol(get_text());
639         return 1;
642 SampleRatePulldown::SampleRatePulldown(MWindow *mwindow, BC_TextBox *output, int x, int y)
643  : BC_ListBox(x,
644         y,
645         100,
646         200,
647         LISTBOX_TEXT,
648         &mwindow->theme->sample_rates,
649         0,
650         0,
651         1,
652         0,
653         1)
655         this->mwindow = mwindow;
656         this->output = output;
658 int SampleRatePulldown::handle_event()
660         char *text = get_selection(0, 0)->get_text();
661         output->update(text);
662         output->handle_event();
663         return 1;
680 NewVTracks::NewVTracks(NewWindow *nwindow, char *text, int x, int y)
681  : BC_TextBox(x, y, 90, 1, text)
683         this->nwindow = nwindow;
686 int NewVTracks::handle_event()
688         nwindow->new_edl->session->video_tracks = atol(get_text());
689         return 1;
692 NewVTracksTumbler::NewVTracksTumbler(NewWindow *nwindow, int x, int y)
693  : BC_Tumbler(x, y)
695         this->nwindow = nwindow;
697 int NewVTracksTumbler::handle_up_event()
699 printf("NewVTracks::handle_event 1 %f\n", nwindow->new_edl->session->frame_rate);
700         nwindow->new_edl->session->video_tracks++;
701 printf("NewVTracks::handle_event 2 %d %f\n", nwindow->new_edl->session->video_tracks, nwindow->new_edl->session->frame_rate);
702         nwindow->new_edl->boundaries();
703 printf("NewVTracks::handle_event 3 %d %f\n", nwindow->new_edl->session->video_tracks, nwindow->new_edl->session->frame_rate);
704         nwindow->update();
705 printf("NewVTracks::handle_event 4 %d %f\n", nwindow->new_edl->session->video_tracks, nwindow->new_edl->session->frame_rate);
706         return 1;
708 int NewVTracksTumbler::handle_down_event()
710         nwindow->new_edl->session->video_tracks--;
711         nwindow->new_edl->boundaries();
712         nwindow->update();
713         return 1;
716 NewVChannels::NewVChannels(NewWindow *nwindow, char *text, int x, int y)
717  : BC_TextBox(x, y, 90, 1, text)
719         this->nwindow = nwindow;
722 int NewVChannels::handle_event()
724         nwindow->new_edl->session->video_channels = atol(get_text());
725         return 1;
728 NewVChannelsTumbler::NewVChannelsTumbler(NewWindow *nwindow, int x, int y)
729  : BC_Tumbler(x, y)
731         this->nwindow = nwindow;
733 int NewVChannelsTumbler::handle_up_event()
735         nwindow->new_edl->session->video_channels++;
736         nwindow->new_edl->boundaries();
737         nwindow->update();
738         return 1;
740 int NewVChannelsTumbler::handle_down_event()
742         nwindow->new_edl->session->video_channels--;
743         nwindow->new_edl->boundaries();
744         nwindow->update();
745         return 1;
748 NewFrameRate::NewFrameRate(NewWindow *nwindow, char *text, int x, int y)
749  : BC_TextBox(x, y, 90, 1, text)
751         this->nwindow = nwindow;
754 int NewFrameRate::handle_event()
756         nwindow->new_edl->session->frame_rate = Units::atoframerate(get_text());
757         return 1;
760 FrameRatePulldown::FrameRatePulldown(MWindow *mwindow, 
761         BC_TextBox *output, 
762         int x, 
763         int y)
764  : BC_ListBox(x,
765         y,
766         100,
767         200,
768         LISTBOX_TEXT,
769         &mwindow->theme->frame_rates,
770         0,
771         0,
772         1,
773         0,
774         1)
776         this->mwindow = mwindow;
777         this->output = output;
779 int FrameRatePulldown::handle_event()
781         char *text = get_selection(0, 0)->get_text();
782         output->update(text);
783         output->handle_event();
784         return 1;
787 // NewTrackW::NewTrackW(NewWindow *nwindow, int x, int y)
788 //  : BC_TextBox(x, y, 70, 1, nwindow->new_edl->session->track_w)
789 // {
790 //      this->nwindow = nwindow;
791 // }
792 // int NewTrackW::handle_event()
793 // {
794 //      nwindow->new_edl->session->track_w = atol(get_text());
795 //      return 1;
796 // }
797 // 
798 // NewTrackH::NewTrackH(NewWindow *nwindow, int x, int y)
799 //  : BC_TextBox(x, y, 70, 1, nwindow->new_edl->session->track_h)
800 // {
801 //      this->nwindow = nwindow;
802 // }
803 // 
804 // int NewTrackH::handle_event()
805 // {
806 //      nwindow->new_edl->session->track_h = atol(get_text());
807 //      return 1;
808 // }
810 FrameSizePulldown::FrameSizePulldown(MWindow *mwindow, 
811                 BC_TextBox *output_w, 
812                 BC_TextBox *output_h, 
813                 int x, 
814                 int y)
815  : BC_ListBox(x,
816         y,
817         100,
818         200,
819         LISTBOX_TEXT,
820         &mwindow->theme->frame_sizes,
821         0,
822         0,
823         1,
824         0,
825         1)
827         this->mwindow = mwindow;
828         this->output_w = output_w;
829         this->output_h = output_h;
831 int FrameSizePulldown::handle_event()
833         char *text = get_selection(0, 0)->get_text();
834         char string[BCTEXTLEN];
835         int64_t w, h;
836         char *ptr;
837         
838         strcpy(string, text);
839         ptr = strrchr(string, 'x');
840         if(ptr)
841         {
842                 ptr++;
843                 h = atol(ptr);
844                 
845                 *--ptr = 0;
846                 w = atol(string);
847                 output_w->update(w);
848                 output_h->update(h);
849                 output_w->handle_event();
850                 output_h->handle_event();
851         }
852         return 1;
855 NewOutputW::NewOutputW(NewWindow *nwindow, int x, int y)
856  : BC_TextBox(x, y, 70, 1, nwindow->new_edl->session->output_w)
858         this->nwindow = nwindow;
860 int NewOutputW::handle_event()
862         nwindow->new_edl->session->output_w = atol(get_text());
863         nwindow->new_thread->update_aspect();
864         return 1;
867 NewOutputH::NewOutputH(NewWindow *nwindow, int x, int y)
868  : BC_TextBox(x, y, 70, 1, nwindow->new_edl->session->output_h)
870         this->nwindow = nwindow;
872 int NewOutputH::handle_event()
874         nwindow->new_edl->session->output_h = atol(get_text());
875         nwindow->new_thread->update_aspect();
876         return 1;
879 NewAspectW::NewAspectW(NewWindow *nwindow, char *text, int x, int y)
880  : BC_TextBox(x, y, 70, 1, text)
882         this->nwindow = nwindow;
885 int NewAspectW::handle_event()
887         nwindow->new_edl->session->aspect_w = atof(get_text());
888         return 1;
891 NewAspectH::NewAspectH(NewWindow *nwindow, char *text, int x, int y)
892  : BC_TextBox(x, y, 70, 1, text)
894         this->nwindow = nwindow;
897 int NewAspectH::handle_event()
899         nwindow->new_edl->session->aspect_h = atof(get_text());
900         return 1;
903 AspectPulldown::AspectPulldown(MWindow *mwindow, 
904                 BC_TextBox *output_w, 
905                 BC_TextBox *output_h, 
906                 int x, 
907                 int y)
908  : BC_ListBox(x,
909         y,
910         100,
911         200,
912         LISTBOX_TEXT,
913         &mwindow->theme->aspect_ratios,
914         0,
915         0,
916         1,
917         0,
918         1)
920         this->mwindow = mwindow;
921         this->output_w = output_w;
922         this->output_h = output_h;
924 int AspectPulldown::handle_event()
926         char *text = get_selection(0, 0)->get_text();
927         char string[BCTEXTLEN];
928         float w, h;
929         char *ptr;
930         
931         strcpy(string, text);
932         ptr = strrchr(string, ':');
933         if(ptr)
934         {
935                 ptr++;
936                 h = atof(ptr);
937                 
938                 *--ptr = 0;
939                 w = atof(string);
940                 output_w->update(w);
941                 output_h->update(h);
942                 output_w->handle_event();
943                 output_h->handle_event();
944         }
945         return 1;
948 ColormodelItem::ColormodelItem(char *text, int value)
949  : BC_ListBoxItem(text)
951         this->value = value;
954 ColormodelPulldown::ColormodelPulldown(MWindow *mwindow, 
955                 BC_TextBox *output_text, 
956                 int *output_value,
957                 int x, 
958                 int y)
959  : BC_ListBox(x,
960         y,
961         200,
962         150,
963         LISTBOX_TEXT,
964         (ArrayList<BC_ListBoxItem*>*)&mwindow->colormodels,
965         0,
966         0,
967         1,
968         0,
969         1)
971         this->mwindow = mwindow;
972         this->output_text = output_text;
973         this->output_value = output_value;
974         output_text->update(colormodel_to_text());
977 int ColormodelPulldown::handle_event()
979         output_text->update(get_selection(0, 0)->get_text());
980         *output_value = ((ColormodelItem*)get_selection(0, 0))->value;
981         return 1;
984 char* ColormodelPulldown::colormodel_to_text()
986         for(int i = 0; i < mwindow->colormodels.total; i++)
987                 if(mwindow->colormodels.values[i]->value == *output_value) 
988                         return mwindow->colormodels.values[i]->get_text();
989         return "Unknown";
1001 NewAspectAuto::NewAspectAuto(NewWindow *nwindow, int x, int y)
1002  : BC_CheckBox(x, y, nwindow->new_thread->auto_aspect, _("Auto aspect ratio"))
1004         this->nwindow = nwindow;
1006 NewAspectAuto::~NewAspectAuto()
1009 int NewAspectAuto::handle_event()
1011         nwindow->new_thread->auto_aspect = get_value();
1012         nwindow->new_thread->update_aspect();
1013         return 1;
1017 #if 0
1019 NewCloneToggle::NewCloneToggle(MWindow *mwindow, NewWindow *nwindow, int x, int y)
1020  : BC_Toggle(x, 
1021         y, 
1022         mwindow->theme->chain_data, 
1023         nwindow->new_thread->auto_sizes,
1024         "",
1025         0, 
1026         0, 
1027         0)
1029         this->mwindow = mwindow;
1030         this->nwindow = nwindow;
1033 int NewCloneToggle::handle_event()
1035         nwindow->canvas_w_text->update((int64_t)nwindow->new_edl->session->track_w);
1036         nwindow->canvas_h_text->update((int64_t)nwindow->new_edl->session->track_h);
1037         nwindow->new_edl->session->output_w = nwindow->new_edl->session->track_w;
1038         nwindow->new_edl->session->output_h = nwindow->new_edl->session->track_h;
1039         nwindow->new_thread->update_aspect();
1040         return 1;
1043 #endif