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