00001 #include "clip.h"
00002 #include "cplayback.h"
00003 #include "cwindow.h"
00004 #include "bchash.h"
00005 #include "edl.h"
00006 #include "edlsession.h"
00007 #include "filexml.h"
00008 #include "interlacemodes.h"
00009 #include "language.h"
00010 #include "levelwindow.h"
00011 #include "mainundo.h"
00012 #include "mainmenu.h"
00013 #include "mutex.h"
00014 #include "mwindow.h"
00015 #include "mwindowgui.h"
00016 #include "new.h"
00017 #include "newpresets.h"
00018 #include "mainsession.h"
00019 #include "patchbay.h"
00020 #include "preferences.h"
00021 #include "theme.h"
00022 #include "transportque.h"
00023 #include "videowindow.h"
00024 #include "vplayback.h"
00025 #include "vwindow.h"
00026
00027
00028 #include <string.h>
00029
00030
00031 #define WIDTH 600
00032 #define HEIGHT 400
00033
00034
00035 New::New(MWindow *mwindow)
00036 : BC_MenuItem(_("New..."), "n", 'n')
00037 {
00038 this->mwindow = mwindow;
00039 script = 0;
00040 }
00041
00042 int New::create_objects()
00043 {
00044 thread = new NewThread(mwindow, this);
00045 return 0;
00046 }
00047
00048 int New::handle_event()
00049 {
00050 if(thread->running())
00051 {
00052 thread->window_lock->lock("New::handle_event");
00053 if(thread->nwindow)
00054 {
00055 thread->nwindow->lock_window("New::handle_event");
00056 thread->nwindow->raise_window();
00057 thread->nwindow->unlock_window();
00058 }
00059 thread->window_lock->unlock();
00060 return 1;
00061 }
00062 mwindow->edl->save_defaults(mwindow->defaults);
00063 create_new_edl();
00064 thread->start();
00065
00066 return 1;
00067 }
00068
00069 void New::create_new_edl()
00070 {
00071 new_edl = new EDL;
00072 new_edl->create_objects();
00073 new_edl->load_defaults(mwindow->defaults);
00074 }
00075
00076
00077 int New::create_new_project()
00078 {
00079 mwindow->cwindow->playback_engine->que->send_command(STOP,
00080 CHANGE_NONE,
00081 0,
00082 0);
00083 mwindow->vwindow->playback_engine->que->send_command(STOP,
00084 CHANGE_NONE,
00085 0,
00086 0);
00087 mwindow->cwindow->playback_engine->interrupt_playback(0);
00088 mwindow->vwindow->playback_engine->interrupt_playback(0);
00089
00090 mwindow->gui->lock_window();
00091 mwindow->reset_caches();
00092
00093 memcpy(new_edl->session->achannel_positions,
00094 &mwindow->preferences->channel_positions[
00095 MAXCHANNELS * (new_edl->session->audio_channels - 1)],
00096 sizeof(int) * MAXCHANNELS);
00097 new_edl->session->boundaries();
00098 new_edl->create_default_tracks();
00099
00100 mwindow->set_filename("");
00101 mwindow->undo->update_undo(_("New"), LOAD_ALL);
00102
00103 mwindow->hide_plugins();
00104 delete mwindow->edl;
00105 mwindow->edl = new_edl;
00106 mwindow->save_defaults();
00107
00108
00109 mwindow->update_project(LOAD_REPLACE);
00110 mwindow->session->changes_made = 0;
00111 mwindow->gui->unlock_window();
00112 return 0;
00113 }
00114
00115 NewThread::NewThread(MWindow *mwindow, New *new_project)
00116 : Thread()
00117 {
00118 this->mwindow = mwindow;
00119 this->new_project = new_project;
00120 window_lock = new Mutex("NewThread::window_lock");
00121 }
00122
00123 NewThread::~NewThread()
00124 {
00125 delete window_lock;
00126 }
00127
00128
00129 void NewThread::run()
00130 {
00131 int result = 0;
00132 load_defaults();
00133
00134 int x = mwindow->gui->get_root_w(0, 1) / 2 - WIDTH / 2;
00135 int y = mwindow->gui->get_root_h(1) / 2 - HEIGHT / 2;
00136
00137 window_lock->lock("NewThread::run 1\n");
00138 nwindow = new NewWindow(mwindow, this, x, y);
00139 nwindow->create_objects();
00140 window_lock->unlock();
00141
00142 result = nwindow->run_window();
00143
00144 window_lock->lock("NewThread::run 2\n");
00145 delete nwindow;
00146 nwindow = 0;
00147 window_lock->unlock();
00148
00149 new_project->new_edl->save_defaults(mwindow->defaults);
00150 mwindow->defaults->save();
00151
00152 if(result)
00153 {
00154
00155 delete new_project->new_edl;
00156 }
00157 else
00158 {
00159 new_project->create_new_project();
00160 }
00161 }
00162
00163 int NewThread::load_defaults()
00164 {
00165 auto_aspect = mwindow->defaults->get("AUTOASPECT", 0);
00166 return 0;
00167 }
00168
00169 int NewThread::save_defaults()
00170 {
00171 mwindow->defaults->update("AUTOASPECT", auto_aspect);
00172 return 0;
00173 }
00174
00175 int NewThread::update_aspect()
00176 {
00177 if(auto_aspect)
00178 {
00179 char string[BCTEXTLEN];
00180 mwindow->create_aspect_ratio(new_project->new_edl->session->aspect_w,
00181 new_project->new_edl->session->aspect_h,
00182 new_project->new_edl->session->output_w,
00183 new_project->new_edl->session->output_h);
00184 sprintf(string, "%.02f", new_project->new_edl->session->aspect_w);
00185 nwindow->aspect_w_text->update(string);
00186 sprintf(string, "%.02f", new_project->new_edl->session->aspect_h);
00187 nwindow->aspect_h_text->update(string);
00188 }
00189 return 0;
00190 }
00191
00192
00193
00194
00195 #if 0
00196 N_("Cinelerra: New Project");
00197 #endif
00198
00199 NewWindow::NewWindow(MWindow *mwindow, NewThread *new_thread, int x, int y)
00200 : BC_Window(_(PROGRAM_NAME ": New Project"),
00201 x,
00202 y,
00203 WIDTH,
00204 HEIGHT,
00205 -1,
00206 -1,
00207 0,
00208 0,
00209 1)
00210 {
00211 this->mwindow = mwindow;
00212 this->new_thread = new_thread;
00213 this->new_edl = new_thread->new_project->new_edl;
00214 format_presets = 0;
00215 }
00216
00217 NewWindow::~NewWindow()
00218 {
00219 if(format_presets) delete format_presets;
00220 }
00221
00222 int NewWindow::create_objects()
00223 {
00224 int x = 10, y = 10, x1, y1;
00225 BC_TextBox *textbox;
00226
00227 mwindow->theme->draw_new_bg(this);
00228
00229 add_subwindow(new BC_Title(x, y, _("Parameters for the new project:")));
00230 y += 20;
00231
00232 format_presets = new NewPresets(mwindow,
00233 this,
00234 x,
00235 y);
00236 format_presets->create_objects();
00237 x = format_presets->x;
00238 y = format_presets->y;
00239
00240
00241
00242 y += 40;
00243 y1 = y;
00244 add_subwindow(new BC_Title(x, y, _("Audio"), LARGEFONT));
00245 y += 30;
00246
00247 x1 = x;
00248 add_subwindow(new BC_Title(x1, y, _("Tracks:")));
00249 x1 += 100;
00250 add_subwindow(atracks = new NewATracks(this, "", x1, y));
00251 x1 += atracks->get_w();
00252 add_subwindow(new NewATracksTumbler(this, x1, y));
00253 y += atracks->get_h() + 5;
00254
00255 x1 = x;
00256 add_subwindow(new BC_Title(x1, y, _("Channels:")));
00257 x1 += 100;
00258 add_subwindow(achannels = new NewAChannels(this, "", x1, y));
00259 x1 += achannels->get_w();
00260 add_subwindow(new NewAChannelsTumbler(this, x1, y));
00261 y += achannels->get_h() + 5;
00262
00263 x1 = x;
00264 add_subwindow(new BC_Title(x1, y, _("Samplerate:")));
00265 x1 += 100;
00266 add_subwindow(sample_rate = new NewSampleRate(this, "", x1, y));
00267 x1 += sample_rate->get_w();
00268 add_subwindow(new SampleRatePulldown(mwindow, sample_rate, x1, y));
00269
00270 x += 250;
00271 y = y1;
00272 add_subwindow(new BC_Title(x, y, _("Video"), LARGEFONT));
00273 y += 30;
00274 x1 = x;
00275 add_subwindow(new BC_Title(x1, y, _("Tracks:")));
00276 x1 += 100;
00277 add_subwindow(vtracks = new NewVTracks(this, "", x1, y));
00278 x1 += vtracks->get_w();
00279 add_subwindow(new NewVTracksTumbler(this, x1, y));
00280 y += vtracks->get_h() + 5;
00281
00282
00283
00284
00285
00286
00287
00288
00289 x1 = x;
00290 add_subwindow(new BC_Title(x1, y, _("Framerate:")));
00291 x1 += 100;
00292 add_subwindow(frame_rate = new NewFrameRate(this, "", x1, y));
00293 x1 += frame_rate->get_w();
00294 add_subwindow(new FrameRatePulldown(mwindow, frame_rate, x1, y));
00295 y += frame_rate->get_h() + 5;
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315 x1 = x;
00316 add_subwindow(new BC_Title(x1, y, _("Canvas size:")));
00317 x1 += 100;
00318 add_subwindow(output_w_text = new NewOutputW(this, x1, y));
00319 x1 += output_w_text->get_w() + 2;
00320 add_subwindow(new BC_Title(x1, y, "x"));
00321 x1 += 10;
00322 add_subwindow(output_h_text = new NewOutputH(this, x1, y));
00323 x1 += output_h_text->get_w();
00324 FrameSizePulldown *pulldown;
00325 add_subwindow(pulldown = new FrameSizePulldown(mwindow,
00326 output_w_text,
00327 output_h_text,
00328 x1,
00329 y));
00330 x1 += pulldown->get_w() + 5;
00331 add_subwindow(new NewSwapExtents(mwindow, this, x1, y));
00332 y += output_h_text->get_h() + 5;
00333
00334 x1 = x;
00335 add_subwindow(new BC_Title(x1, y, _("Aspect ratio:")));
00336 x1 += 100;
00337 add_subwindow(aspect_w_text = new NewAspectW(this, "", x1, y));
00338 x1 += aspect_w_text->get_w() + 2;
00339 add_subwindow(new BC_Title(x1, y, ":"));
00340 x1 += 10;
00341 add_subwindow(aspect_h_text = new NewAspectH(this, "", x1, y));
00342 x1 += aspect_h_text->get_w();
00343 add_subwindow(new AspectPulldown(mwindow,
00344 aspect_w_text,
00345 aspect_h_text,
00346 x1,
00347 y));
00348
00349 x1 = aspect_w_text->get_x();
00350 y += aspect_w_text->get_h() + 5;
00351 add_subwindow(new NewAspectAuto(this, x1, y));
00352 y += 40;
00353 add_subwindow(new BC_Title(x, y, _("Color model:")));
00354 add_subwindow(textbox = new BC_TextBox(x + 100, y, 200, 1, ""));
00355 add_subwindow(new ColormodelPulldown(mwindow,
00356 textbox,
00357 &new_edl->session->color_model,
00358 x + 100 + textbox->get_w(),
00359 y));
00360 y += textbox->get_h() + 5;
00361
00362
00363 add_subwindow(new BC_Title(x, y, _("Interlace mode:")));
00364 add_subwindow(textbox = new BC_TextBox(x + 100, y, 140, 1, ""));
00365 add_subwindow(interlace_pulldown = new InterlacemodePulldown(mwindow,
00366 textbox,
00367 &new_edl->session->interlace_mode,
00368 (ArrayList<BC_ListBoxItem*>*)&mwindow->interlace_project_modes,
00369 x + 100 + textbox->get_w(),
00370 y));
00371 y += textbox->get_h() + 5;
00372
00373 add_subwindow(new BC_OKButton(this,
00374 mwindow->theme->get_image_set("new_ok_images")));
00375 add_subwindow(new BC_CancelButton(this,
00376 mwindow->theme->get_image_set("new_cancel_images")));
00377 flash();
00378 update();
00379 show_window();
00380 return 0;
00381 }
00382
00383 int NewWindow::update()
00384 {
00385 char string[BCTEXTLEN];
00386 atracks->update((int64_t)new_edl->session->audio_tracks);
00387 achannels->update((int64_t)new_edl->session->audio_channels);
00388 sample_rate->update((int64_t)new_edl->session->sample_rate);
00389 vtracks->update((int64_t)new_edl->session->video_tracks);
00390 frame_rate->update((float)new_edl->session->frame_rate);
00391 output_w_text->update((int64_t)new_edl->session->output_w);
00392 output_h_text->update((int64_t)new_edl->session->output_h);
00393 aspect_w_text->update((float)new_edl->session->aspect_w);
00394 aspect_h_text->update((float)new_edl->session->aspect_h);
00395 interlace_pulldown->update(new_edl->session->interlace_mode);
00396 return 0;
00397 }
00398
00399
00400
00401
00402
00403
00404
00405 NewPresets::NewPresets(MWindow *mwindow, NewWindow *gui, int x, int y)
00406 : FormatPresets(mwindow, gui, 0, x, y)
00407 {
00408 }
00409
00410 NewPresets::~NewPresets()
00411 {
00412 }
00413
00414 int NewPresets::handle_event()
00415 {
00416 new_gui->update();
00417 return 1;
00418 }
00419
00420 EDL* NewPresets::get_edl()
00421 {
00422 return new_gui->new_edl;
00423 }
00424
00425
00426
00427 NewATracks::NewATracks(NewWindow *nwindow, char *text, int x, int y)
00428 : BC_TextBox(x, y, 90, 1, text)
00429 {
00430 this->nwindow = nwindow;
00431 }
00432
00433 int NewATracks::handle_event()
00434 {
00435 nwindow->new_edl->session->audio_tracks = atol(get_text());
00436 return 1;
00437 }
00438
00439 NewATracksTumbler::NewATracksTumbler(NewWindow *nwindow, int x, int y)
00440 : BC_Tumbler(x, y)
00441 {
00442 this->nwindow = nwindow;
00443 }
00444 int NewATracksTumbler::handle_up_event()
00445 {
00446 nwindow->new_edl->session->audio_tracks++;
00447 nwindow->new_edl->boundaries();
00448 nwindow->update();
00449 return 1;
00450 }
00451 int NewATracksTumbler::handle_down_event()
00452 {
00453 nwindow->new_edl->session->audio_tracks--;
00454 nwindow->new_edl->boundaries();
00455 nwindow->update();
00456 return 1;
00457 }
00458
00459 NewAChannels::NewAChannels(NewWindow *nwindow, char *text, int x, int y)
00460 : BC_TextBox(x, y, 90, 1, text)
00461 {
00462 this->nwindow = nwindow;
00463 }
00464
00465 int NewAChannels::handle_event()
00466 {
00467 nwindow->new_edl->session->audio_channels = atol(get_text());
00468 return 1;
00469 }
00470
00471 NewAChannelsTumbler::NewAChannelsTumbler(NewWindow *nwindow, int x, int y)
00472 : BC_Tumbler(x, y)
00473 {
00474 this->nwindow = nwindow;
00475 }
00476 int NewAChannelsTumbler::handle_up_event()
00477 {
00478 nwindow->new_edl->session->audio_channels++;
00479 nwindow->new_edl->boundaries();
00480 nwindow->update();
00481 return 1;
00482 }
00483 int NewAChannelsTumbler::handle_down_event()
00484 {
00485 nwindow->new_edl->session->audio_channels--;
00486 nwindow->new_edl->boundaries();
00487 nwindow->update();
00488 return 1;
00489 }
00490
00491
00492 NewSampleRate::NewSampleRate(NewWindow *nwindow, char *text, int x, int y)
00493 : BC_TextBox(x, y, 90, 1, text)
00494 {
00495 this->nwindow = nwindow;
00496 }
00497
00498 int NewSampleRate::handle_event()
00499 {
00500 nwindow->new_edl->session->sample_rate = atol(get_text());
00501 return 1;
00502 }
00503
00504 SampleRatePulldown::SampleRatePulldown(MWindow *mwindow, BC_TextBox *output, int x, int y)
00505 : BC_ListBox(x,
00506 y,
00507 100,
00508 200,
00509 LISTBOX_TEXT,
00510 &mwindow->theme->sample_rates,
00511 0,
00512 0,
00513 1,
00514 0,
00515 1)
00516 {
00517 this->mwindow = mwindow;
00518 this->output = output;
00519 }
00520 int SampleRatePulldown::handle_event()
00521 {
00522 char *text = get_selection(0, 0)->get_text();
00523 output->update(text);
00524 output->handle_event();
00525 return 1;
00526 }
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542 NewVTracks::NewVTracks(NewWindow *nwindow, char *text, int x, int y)
00543 : BC_TextBox(x, y, 90, 1, text)
00544 {
00545 this->nwindow = nwindow;
00546 }
00547
00548 int NewVTracks::handle_event()
00549 {
00550 nwindow->new_edl->session->video_tracks = atol(get_text());
00551 return 1;
00552 }
00553
00554 NewVTracksTumbler::NewVTracksTumbler(NewWindow *nwindow, int x, int y)
00555 : BC_Tumbler(x, y)
00556 {
00557 this->nwindow = nwindow;
00558 }
00559 int NewVTracksTumbler::handle_up_event()
00560 {
00561 nwindow->new_edl->session->video_tracks++;
00562 nwindow->new_edl->boundaries();
00563 nwindow->update();
00564 return 1;
00565 }
00566 int NewVTracksTumbler::handle_down_event()
00567 {
00568 nwindow->new_edl->session->video_tracks--;
00569 nwindow->new_edl->boundaries();
00570 nwindow->update();
00571 return 1;
00572 }
00573
00574 NewVChannels::NewVChannels(NewWindow *nwindow, char *text, int x, int y)
00575 : BC_TextBox(x, y, 90, 1, text)
00576 {
00577 this->nwindow = nwindow;
00578 }
00579
00580 int NewVChannels::handle_event()
00581 {
00582 nwindow->new_edl->session->video_channels = atol(get_text());
00583 return 1;
00584 }
00585
00586 NewVChannelsTumbler::NewVChannelsTumbler(NewWindow *nwindow, int x, int y)
00587 : BC_Tumbler(x, y)
00588 {
00589 this->nwindow = nwindow;
00590 }
00591 int NewVChannelsTumbler::handle_up_event()
00592 {
00593 nwindow->new_edl->session->video_channels++;
00594 nwindow->new_edl->boundaries();
00595 nwindow->update();
00596 return 1;
00597 }
00598 int NewVChannelsTumbler::handle_down_event()
00599 {
00600 nwindow->new_edl->session->video_channels--;
00601 nwindow->new_edl->boundaries();
00602 nwindow->update();
00603 return 1;
00604 }
00605
00606 NewFrameRate::NewFrameRate(NewWindow *nwindow, char *text, int x, int y)
00607 : BC_TextBox(x, y, 90, 1, text)
00608 {
00609 this->nwindow = nwindow;
00610 }
00611
00612 int NewFrameRate::handle_event()
00613 {
00614 nwindow->new_edl->session->frame_rate = Units::atoframerate(get_text());
00615 return 1;
00616 }
00617
00618 FrameRatePulldown::FrameRatePulldown(MWindow *mwindow,
00619 BC_TextBox *output,
00620 int x,
00621 int y)
00622 : BC_ListBox(x,
00623 y,
00624 100,
00625 200,
00626 LISTBOX_TEXT,
00627 &mwindow->theme->frame_rates,
00628 0,
00629 0,
00630 1,
00631 0,
00632 1)
00633 {
00634 this->mwindow = mwindow;
00635 this->output = output;
00636 }
00637 int FrameRatePulldown::handle_event()
00638 {
00639 char *text = get_selection(0, 0)->get_text();
00640 output->update(text);
00641 output->handle_event();
00642 return 1;
00643 }
00644
00645 FrameSizePulldown::FrameSizePulldown(MWindow *mwindow,
00646 BC_TextBox *output_w,
00647 BC_TextBox *output_h,
00648 int x,
00649 int y)
00650 : BC_ListBox(x,
00651 y,
00652 100,
00653 200,
00654 LISTBOX_TEXT,
00655 &mwindow->theme->frame_sizes,
00656 0,
00657 0,
00658 1,
00659 0,
00660 1)
00661 {
00662 this->mwindow = mwindow;
00663 this->output_w = output_w;
00664 this->output_h = output_h;
00665 }
00666 int FrameSizePulldown::handle_event()
00667 {
00668 char *text = get_selection(0, 0)->get_text();
00669 char string[BCTEXTLEN];
00670 int64_t w, h;
00671 char *ptr;
00672
00673 strcpy(string, text);
00674 ptr = strrchr(string, 'x');
00675 if(ptr)
00676 {
00677 ptr++;
00678 h = atol(ptr);
00679
00680 *--ptr = 0;
00681 w = atol(string);
00682 output_w->update(w);
00683 output_h->update(h);
00684 output_w->handle_event();
00685 output_h->handle_event();
00686 }
00687 return 1;
00688 }
00689
00690 NewOutputW::NewOutputW(NewWindow *nwindow, int x, int y)
00691 : BC_TextBox(x, y, 70, 1, nwindow->new_edl->session->output_w)
00692 {
00693 this->nwindow = nwindow;
00694 }
00695 int NewOutputW::handle_event()
00696 {
00697 nwindow->new_edl->session->output_w = MAX(1,atol(get_text()));
00698 nwindow->new_thread->update_aspect();
00699 return 1;
00700 }
00701
00702 NewOutputH::NewOutputH(NewWindow *nwindow, int x, int y)
00703 : BC_TextBox(x, y, 70, 1, nwindow->new_edl->session->output_h)
00704 {
00705 this->nwindow = nwindow;
00706 }
00707 int NewOutputH::handle_event()
00708 {
00709 nwindow->new_edl->session->output_h = MAX(1, atol(get_text()));
00710 nwindow->new_thread->update_aspect();
00711 return 1;
00712 }
00713
00714 NewAspectW::NewAspectW(NewWindow *nwindow, char *text, int x, int y)
00715 : BC_TextBox(x, y, 70, 1, text)
00716 {
00717 this->nwindow = nwindow;
00718 }
00719
00720 int NewAspectW::handle_event()
00721 {
00722 nwindow->new_edl->session->aspect_w = atof(get_text());
00723 return 1;
00724 }
00725
00726 NewAspectH::NewAspectH(NewWindow *nwindow, char *text, int x, int y)
00727 : BC_TextBox(x, y, 70, 1, text)
00728 {
00729 this->nwindow = nwindow;
00730 }
00731
00732 int NewAspectH::handle_event()
00733 {
00734 nwindow->new_edl->session->aspect_h = atof(get_text());
00735 return 1;
00736 }
00737
00738 AspectPulldown::AspectPulldown(MWindow *mwindow,
00739 BC_TextBox *output_w,
00740 BC_TextBox *output_h,
00741 int x,
00742 int y)
00743 : BC_ListBox(x,
00744 y,
00745 100,
00746 200,
00747 LISTBOX_TEXT,
00748 &mwindow->theme->aspect_ratios,
00749 0,
00750 0,
00751 1,
00752 0,
00753 1)
00754 {
00755 this->mwindow = mwindow;
00756 this->output_w = output_w;
00757 this->output_h = output_h;
00758 }
00759 int AspectPulldown::handle_event()
00760 {
00761 char *text = get_selection(0, 0)->get_text();
00762 char string[BCTEXTLEN];
00763 float w, h;
00764 char *ptr;
00765
00766 strcpy(string, text);
00767 ptr = strrchr(string, ':');
00768 if(ptr)
00769 {
00770 ptr++;
00771 h = atof(ptr);
00772
00773 *--ptr = 0;
00774 w = atof(string);
00775 output_w->update(w);
00776 output_h->update(h);
00777 output_w->handle_event();
00778 output_h->handle_event();
00779 }
00780 return 1;
00781 }
00782
00783 ColormodelItem::ColormodelItem(char *text, int value)
00784 : BC_ListBoxItem(text)
00785 {
00786 this->value = value;
00787 }
00788
00789 ColormodelPulldown::ColormodelPulldown(MWindow *mwindow,
00790 BC_TextBox *output_text,
00791 int *output_value,
00792 int x,
00793 int y)
00794 : BC_ListBox(x,
00795 y,
00796 200,
00797 150,
00798 LISTBOX_TEXT,
00799 (ArrayList<BC_ListBoxItem*>*)&mwindow->colormodels,
00800 0,
00801 0,
00802 1,
00803 0,
00804 1)
00805 {
00806 this->mwindow = mwindow;
00807 this->output_text = output_text;
00808 this->output_value = output_value;
00809 output_text->update(colormodel_to_text());
00810 }
00811
00812 int ColormodelPulldown::handle_event()
00813 {
00814 output_text->update(get_selection(0, 0)->get_text());
00815 *output_value = ((ColormodelItem*)get_selection(0, 0))->value;
00816 return 1;
00817 }
00818
00819 char* ColormodelPulldown::colormodel_to_text()
00820 {
00821 for(int i = 0; i < mwindow->colormodels.total; i++)
00822 if(mwindow->colormodels.values[i]->value == *output_value)
00823 return mwindow->colormodels.values[i]->get_text();
00824 return "Unknown";
00825 }
00826
00827 InterlacemodeItem::InterlacemodeItem(char *text, int value)
00828 : BC_ListBoxItem(text)
00829 {
00830 this->value = value;
00831 }
00832
00833 InterlacemodePulldown::InterlacemodePulldown(MWindow *mwindow,
00834 BC_TextBox *output_text,
00835 int *output_value,
00836 ArrayList<BC_ListBoxItem*> *data,
00837 int x,
00838 int y)
00839 : BC_ListBox(x,
00840 y,
00841 200,
00842 150,
00843 LISTBOX_TEXT,
00844 data,
00845 0,
00846 0,
00847 1,
00848 0,
00849 1)
00850 {
00851 char string[BCTEXTLEN];
00852 this->mwindow = mwindow;
00853 this->output_text = output_text;
00854 this->output_value = output_value;
00855 output_text->update(interlacemode_to_text());
00856 }
00857
00858 int InterlacemodePulldown::handle_event()
00859 {
00860 output_text->update(get_selection(0, 0)->get_text());
00861 *output_value = ((InterlacemodeItem*)get_selection(0, 0))->value;
00862 return 1;
00863 }
00864
00865 char* InterlacemodePulldown::interlacemode_to_text()
00866 {
00867 ilacemode_to_text(this->string,*output_value);
00868 return (this->string);
00869 }
00870
00871 int InterlacemodePulldown::update(int interlace_mode)
00872 {
00873 *output_value = interlace_mode;
00874 output_text->update(interlacemode_to_text());
00875 return 1;
00876 }
00877
00878
00879 NewAspectAuto::NewAspectAuto(NewWindow *nwindow, int x, int y)
00880 : BC_CheckBox(x, y, nwindow->new_thread->auto_aspect, _("Auto aspect ratio"))
00881 {
00882 this->nwindow = nwindow;
00883 }
00884 NewAspectAuto::~NewAspectAuto()
00885 {
00886 }
00887 int NewAspectAuto::handle_event()
00888 {
00889 nwindow->new_thread->auto_aspect = get_value();
00890 nwindow->new_thread->update_aspect();
00891 return 1;
00892 }
00893
00894
00895
00896
00897
00898
00899
00900
00901 NewSwapExtents::NewSwapExtents(MWindow *mwindow, NewWindow *gui, int x, int y)
00902 : BC_Button(x, y, mwindow->theme->get_image_set("swap_extents"))
00903 {
00904 this->mwindow = mwindow;
00905 this->gui = gui;
00906 set_tooltip("Swap dimensions");
00907 }
00908
00909 int NewSwapExtents::handle_event()
00910 {
00911 int w = gui->new_edl->session->output_w;
00912 int h = gui->new_edl->session->output_h;
00913 gui->new_edl->session->output_w = h;
00914 gui->new_edl->session->output_h = w;
00915 gui->output_w_text->update((int64_t)h);
00916 gui->output_h_text->update((int64_t)w);
00917 gui->new_thread->update_aspect();
00918 return 1;
00919 }
00920
00921
00922
00923