00001 #include "clip.h"
00002 #include "cwindow.h"
00003 #include "cwindowgui.h"
00004 #include "datatype.h"
00005 #include "defaults.h"
00006 #include "edl.h"
00007 #include "edlsession.h"
00008 #include "formatpresets.h"
00009 #include "language.h"
00010 #include "levelwindow.h"
00011 #include "levelwindowgui.h"
00012 #include "mainundo.h"
00013 #include "mutex.h"
00014 #include "mwindow.h"
00015 #include "mwindowgui.h"
00016 #include "new.h"
00017 #include "preferences.h"
00018 #include "rotateframe.h"
00019 #include "setformat.h"
00020 #include "theme.h"
00021 #include "vframe.h"
00022 #include "vwindow.h"
00023 #include "vwindowgui.h"
00024
00025
00026
00027 SetFormat::SetFormat(MWindow *mwindow)
00028 : BC_MenuItem(_("Format..."), "Shift-F", 'F')
00029 {
00030 set_shift(1);
00031 this->mwindow = mwindow;
00032 thread = new SetFormatThread(mwindow);
00033 }
00034
00035 int SetFormat::handle_event()
00036 {
00037 if(!thread->running())
00038 {
00039 thread->start();
00040 }
00041 else
00042 {
00043
00044
00045 if(thread->window)
00046 {
00047 thread->window_lock->lock("SetFormat::handle_event");
00048 thread->window->lock_window("SetFormat::handle_event");
00049 thread->window->raise_window();
00050 thread->window->unlock_window();
00051 thread->window_lock->unlock();
00052 }
00053 }
00054 return 1;
00055 }
00056
00057 SetFormatThread::SetFormatThread(MWindow *mwindow)
00058 : Thread()
00059 {
00060 this->mwindow = mwindow;
00061 window_lock = new Mutex("SetFormatThread::window_lock");
00062 window = 0;
00063 }
00064
00065 void SetFormatThread::run()
00066 {
00067 orig_dimension[0] = dimension[0] = mwindow->edl->session->output_w;
00068 orig_dimension[1] = dimension[1] = mwindow->edl->session->output_h;
00069 auto_aspect = mwindow->defaults->get("AUTOASPECT", 0);
00070 constrain_ratio = 0;
00071 ratio[0] = ratio[1] = 1;
00072
00073 new_settings = new EDL;
00074 new_settings->create_objects();
00075 new_settings->copy_session(mwindow->edl);
00076
00077
00078 int x = mwindow->gui->get_abs_cursor_x(1) - mwindow->theme->setformat_w / 2;
00079 int y = mwindow->gui->get_abs_cursor_y(1) - mwindow->theme->setformat_h / 2;
00080
00081 window_lock->lock("SetFormatThread::run 1");
00082 window = new SetFormatWindow(mwindow, this, x, y);
00083 window->create_objects();
00084 window_lock->unlock();
00085
00086 int result = window->run_window();
00087
00088
00089 window_lock->lock("SetFormatThread::run 2");
00090 delete window;
00091 window = 0;
00092 window_lock->unlock();
00093
00094
00095 if(!result)
00096 {
00097 apply_changes();
00098 }
00099
00100 mwindow->defaults->update("AUTOASPECT", auto_aspect);
00101 delete new_settings;
00102 }
00103
00104 void SetFormatThread::apply_changes()
00105 {
00106 double new_samplerate = new_settings->session->sample_rate;
00107 double old_samplerate = mwindow->edl->session->sample_rate;
00108 double new_framerate = new_settings->session->frame_rate;
00109 double old_framerate = mwindow->edl->session->frame_rate;
00110 int new_channels = new_settings->session->audio_channels;
00111
00112
00113 mwindow->edl->copy_session(new_settings);
00114 mwindow->edl->session->output_w = dimension[0];
00115 mwindow->edl->session->output_h = dimension[1];
00116 mwindow->edl->rechannel();
00117 mwindow->edl->resample(old_samplerate, new_samplerate, TRACK_AUDIO);
00118 mwindow->edl->resample(old_framerate, new_framerate, TRACK_VIDEO);
00119 mwindow->save_backup();
00120 mwindow->undo->update_undo(_("set format"), LOAD_ALL);
00121
00122
00123 mwindow->restart_brender();
00124 mwindow->gui->lock_window("SetFormatThread::apply_changes");
00125 mwindow->gui->update(1,
00126 1,
00127 1,
00128 1,
00129 1,
00130 1,
00131 0);
00132 mwindow->gui->unlock_window();
00133
00134 mwindow->cwindow->gui->lock_window("SetFormatThread::apply_changes");
00135 mwindow->cwindow->gui->resize_event(mwindow->cwindow->gui->get_w(),
00136 mwindow->cwindow->gui->get_h());
00137 mwindow->cwindow->gui->meters->set_meters(new_channels, 1);
00138 mwindow->cwindow->gui->slider->set_position();
00139 mwindow->cwindow->gui->flush();
00140 mwindow->cwindow->gui->unlock_window();
00141
00142 mwindow->vwindow->gui->lock_window("SetFormatThread::apply_changes");
00143 mwindow->vwindow->gui->resize_event(mwindow->vwindow->gui->get_w(),
00144 mwindow->vwindow->gui->get_h());
00145 mwindow->vwindow->gui->meters->set_meters(new_channels, 1);
00146 mwindow->vwindow->gui->flush();
00147 mwindow->vwindow->gui->unlock_window();
00148
00149 mwindow->lwindow->gui->lock_window("SetFormatThread::apply_changes");
00150 mwindow->lwindow->gui->panel->set_meters(new_channels, 1);
00151 mwindow->lwindow->gui->flush();
00152 mwindow->lwindow->gui->unlock_window();
00153
00154
00155 mwindow->sync_parameters(CHANGE_ALL);
00156 }
00157
00158 void SetFormatThread::update()
00159 {
00160 window->sample_rate->update(new_settings->session->sample_rate);
00161 window->channels->update((int64_t)new_settings->session->audio_channels);
00162 window->frame_rate->update((float)new_settings->session->frame_rate);
00163
00164 auto_aspect = 0;
00165 window->auto_aspect->update(0);
00166
00167 constrain_ratio = 0;
00168 dimension[0] = new_settings->session->output_w;
00169 window->dimension[0]->update((int64_t)dimension[0]);
00170 dimension[1] = new_settings->session->output_h;
00171 window->dimension[1]->update((int64_t)dimension[1]);
00172
00173 ratio[0] = (float)dimension[0] / orig_dimension[0];
00174 window->ratio[0]->update(ratio[0]);
00175 ratio[1] = (float)dimension[1] / orig_dimension[1];
00176 window->ratio[1]->update(ratio[1]);
00177
00178 window->aspect_w->update(new_settings->session->aspect_w);
00179 window->aspect_h->update(new_settings->session->aspect_h);
00180
00181 window->canvas->draw();
00182 }
00183
00184 void SetFormatThread::update_window()
00185 {
00186 int i, result, modified_item, dimension_modified = 0, ratio_modified = 0;
00187
00188 for(i = 0, result = 0; i < 2 && !result; i++)
00189 {
00190 if(dimension[i] < 0)
00191 {
00192 dimension[i] *= -1;
00193 result = 1;
00194 modified_item = i;
00195 dimension_modified = 1;
00196 }
00197 if(ratio[i] < 0)
00198 {
00199 ratio[i] *= -1;
00200 result = 1;
00201 modified_item = i;
00202 ratio_modified = 1;
00203 }
00204 }
00205
00206 if(result)
00207 {
00208 if(dimension_modified)
00209 ratio[modified_item] = (float)dimension[modified_item] / orig_dimension[modified_item];
00210
00211 if(ratio_modified && !constrain_ratio)
00212 {
00213 dimension[modified_item] = (int)(orig_dimension[modified_item] * ratio[modified_item]);
00214 window->dimension[modified_item]->update((int64_t)dimension[modified_item]);
00215 }
00216
00217 for(i = 0; i < 2; i++)
00218 {
00219 if(dimension_modified ||
00220 (i != modified_item && ratio_modified))
00221 {
00222 if(constrain_ratio) ratio[i] = ratio[modified_item];
00223 window->ratio[i]->update(ratio[i]);
00224 }
00225
00226 if(ratio_modified ||
00227 (i != modified_item && dimension_modified))
00228 {
00229 if(constrain_ratio)
00230 {
00231 dimension[i] = (int)(orig_dimension[i] * ratio[modified_item]);
00232 window->dimension[i]->update((int64_t)dimension[i]);
00233 }
00234 }
00235 }
00236 }
00237
00238 update_aspect();
00239 }
00240
00241 void SetFormatThread::update_aspect()
00242 {
00243 if(auto_aspect)
00244 {
00245 char string[BCTEXTLEN];
00246 MWindow::create_aspect_ratio(new_settings->session->aspect_w,
00247 new_settings->session->aspect_h,
00248 dimension[0],
00249 dimension[1]);
00250 sprintf(string, "%.02f", new_settings->session->aspect_w);
00251 window->aspect_w->update(string);
00252 sprintf(string, "%.02f", new_settings->session->aspect_h);
00253 window->aspect_h->update(string);
00254 }
00255 }
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265 SetFormatWindow::SetFormatWindow(MWindow *mwindow,
00266 SetFormatThread *thread,
00267 int x,
00268 int y)
00269 : BC_Window(PROGRAM_NAME ": Set Format",
00270 x,
00271 y,
00272 mwindow->theme->setformat_w,
00273 mwindow->theme->setformat_h,
00274 -1,
00275 -1,
00276 0,
00277 0,
00278 1)
00279 {
00280 this->mwindow = mwindow;
00281 this->thread = thread;
00282 }
00283
00284 void SetFormatWindow::create_objects()
00285 {
00286 int x = 10, y = mwindow->theme->setformat_y1;
00287 BC_TextBox *textbox;
00288 BC_Title *titlew;
00289
00290 mwindow->theme->draw_setformat_bg(this);
00291
00292
00293
00294 presets = new SetFormatPresets(mwindow,
00295 this,
00296 x,
00297 y);
00298 presets->create_objects();
00299 x = presets->x;
00300 y = presets->y;
00301
00302 y = mwindow->theme->setformat_y2;
00303
00304 add_subwindow(new BC_Title(mwindow->theme->setformat_x1,
00305 y,
00306 _("Audio"),
00307 LARGEFONT));
00308 y = mwindow->theme->setformat_y3;
00309 add_subwindow(new BC_Title(mwindow->theme->setformat_x1,
00310 y,
00311 _("Samplerate:")));
00312
00313 y += mwindow->theme->setformat_margin;
00314 add_subwindow(new BC_Title(mwindow->theme->setformat_x1,
00315 y,
00316 _("Samplerate:")));
00317 add_subwindow(sample_rate = new SetSampleRateTextBox(thread,
00318 mwindow->theme->setformat_x2,
00319 y));
00320 add_subwindow(new SampleRatePulldown(mwindow,
00321 sample_rate,
00322 mwindow->theme->setformat_x2 + sample_rate->get_w(),
00323 y));
00324
00325 y += mwindow->theme->setformat_margin;
00326 add_subwindow(new BC_Title(mwindow->theme->setformat_x1,
00327 y,
00328 _("Channels:")));
00329 add_subwindow(channels = new SetChannelsTextBox(thread,
00330 mwindow->theme->setformat_x2,
00331 y));
00332 add_subwindow(new BC_ITumbler(channels,
00333 1,
00334 MAXCHANNELS,
00335 mwindow->theme->setformat_x2 + channels->get_w(),
00336 y));
00337
00338 y += mwindow->theme->setformat_margin;
00339 add_subwindow(new BC_Title(mwindow->theme->setformat_x1,
00340 y,
00341 _("Channel positions:")));
00342 y += mwindow->theme->setformat_margin;
00343 add_subwindow(canvas = new SetChannelsCanvas(mwindow,
00344 thread,
00345 mwindow->theme->setformat_channels_x,
00346 mwindow->theme->setformat_channels_y,
00347 mwindow->theme->setformat_channels_w,
00348 mwindow->theme->setformat_channels_h));
00349 canvas->draw();
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359 y = mwindow->theme->setformat_y2;
00360 add_subwindow(new BC_Title(mwindow->theme->setformat_x3,
00361 y,
00362 _("Video"),
00363 LARGEFONT));
00364
00365 y = mwindow->theme->setformat_y3;
00366 add_subwindow(new BC_Title(mwindow->theme->setformat_x3,
00367 y,
00368 _("Frame rate:")));
00369 add_subwindow(frame_rate = new SetFrameRateTextBox(thread,
00370 mwindow->theme->setformat_x4,
00371 y));
00372 add_subwindow(new FrameRatePulldown(mwindow,
00373 frame_rate,
00374 mwindow->theme->setformat_x4 + frame_rate->get_w(),
00375 y));
00376
00377 y += mwindow->theme->setformat_margin;
00378 add_subwindow(new BC_Title(mwindow->theme->setformat_x3,
00379 y,
00380 _("Canvas size:")));
00381
00382 y += mwindow->theme->setformat_margin;
00383 add_subwindow(new BC_Title(mwindow->theme->setformat_x3, y, _("Width:")));
00384 add_subwindow(dimension[0] = new ScaleSizeText(mwindow->theme->setformat_x4,
00385 y,
00386 thread,
00387 &(thread->dimension[0])));
00388
00389 y += mwindow->theme->setformat_margin;
00390 add_subwindow(new BC_Title(mwindow->theme->setformat_x3, y, _("Height:")));
00391 add_subwindow(dimension[1] = new ScaleSizeText(mwindow->theme->setformat_x4,
00392 y,
00393 thread,
00394 &(thread->dimension[1])));
00395 add_subwindow(new FrameSizePulldown(mwindow,
00396 dimension[0],
00397 dimension[1],
00398 mwindow->theme->setformat_x4 + dimension[0]->get_w(),
00399 y - mwindow->theme->setformat_margin));
00400
00401 y += mwindow->theme->setformat_margin;
00402 add_subwindow(new BC_Title(mwindow->theme->setformat_x3,
00403 y,
00404 _("W Ratio:")));
00405 add_subwindow(ratio[0] = new ScaleRatioText(mwindow->theme->setformat_x4,
00406 y,
00407 thread,
00408 &(thread->ratio[0])));
00409
00410 y += mwindow->theme->setformat_margin;
00411 add_subwindow(new BC_Title(mwindow->theme->setformat_x3,
00412 y,
00413 _("H Ratio:")));
00414 add_subwindow(ratio[1] = new ScaleRatioText(mwindow->theme->setformat_x4,
00415 y,
00416 thread,
00417 &(thread->ratio[1])));
00418
00419 y += mwindow->theme->setformat_margin;
00420 add_subwindow(new BC_Title(mwindow->theme->setformat_x3,
00421 y,
00422 _("Color model:")));
00423 x = mwindow->theme->setformat_x4;
00424 add_subwindow(color_model = new BC_TextBox(x,
00425 y,
00426 100,
00427 1,
00428 ""));
00429 x += color_model->get_w();
00430 add_subwindow(new ColormodelPulldown(mwindow,
00431 color_model,
00432 &thread->new_settings->session->color_model,
00433 x,
00434 y));
00435
00436 y += mwindow->theme->setformat_margin;
00437 add_subwindow(new BC_Title(mwindow->theme->setformat_x3,
00438 y,
00439 _("Aspect ratio:")));
00440 y += mwindow->theme->setformat_margin;
00441 x = mwindow->theme->setformat_x3;
00442 add_subwindow(aspect_w = new ScaleAspectText(x,
00443 y,
00444 thread,
00445 &(thread->new_settings->session->aspect_w)));
00446 x += aspect_w->get_w() + 5;
00447 add_subwindow(new BC_Title(x, y, _(":")));
00448 x += 10;
00449 add_subwindow(aspect_h = new ScaleAspectText(x,
00450 y,
00451 thread,
00452 &(thread->new_settings->session->aspect_h)));
00453 x += aspect_h->get_w();
00454 add_subwindow(new AspectPulldown(mwindow,
00455 aspect_w,
00456 aspect_h,
00457 x,
00458 y));
00459 x += 30;
00460 add_subwindow(auto_aspect = new ScaleAspectAuto(x, y, thread));
00461 y += mwindow->theme->setformat_margin;
00462
00463
00464 add_subwindow(new BC_Title(mwindow->theme->setformat_x3,
00465 y,
00466 _("Interlace mode:")));
00467 add_subwindow(textbox = new BC_TextBox(mwindow->theme->setformat_x4,
00468 y,
00469 140,
00470 1,
00471 ""));
00472 add_subwindow(new InterlacemodePulldown(mwindow,
00473 textbox,
00474 &(thread->new_settings->session->interlace_mode),
00475 (ArrayList<BC_ListBoxItem*>*)&mwindow->interlace_project_modes,
00476 mwindow->theme->setformat_x4 + textbox->get_w(),
00477 y));
00478 y += mwindow->theme->setformat_margin;
00479
00480
00481 BC_OKTextButton *ok;
00482 BC_CancelTextButton *cancel;
00483 add_subwindow(ok = new BC_OKTextButton(this));
00484 add_subwindow(cancel = new BC_CancelTextButton(this));
00485 add_subwindow(new SetFormatApply((ok->get_x() + cancel->get_x()) / 2,
00486 ok->get_y(),
00487 thread));
00488 flash();
00489 show_window();
00490 }
00491
00492 char* SetFormatWindow::get_preset_text()
00493 {
00494 return "";
00495 }
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511 SetFormatPresets::SetFormatPresets(MWindow *mwindow,
00512 SetFormatWindow *gui,
00513 int x,
00514 int y)
00515 : FormatPresets(mwindow, 0, gui, x, y)
00516 {
00517
00518 }
00519
00520 SetFormatPresets::~SetFormatPresets()
00521 {
00522 }
00523
00524 int SetFormatPresets::handle_event()
00525 {
00526 format_gui->thread->update();
00527 return 1;
00528 }
00529
00530 EDL* SetFormatPresets::get_edl()
00531 {
00532 return format_gui->thread->new_settings;
00533 }
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549 SetSampleRateTextBox::SetSampleRateTextBox(SetFormatThread *thread, int x, int y)
00550 : BC_TextBox(x, y, 100, 1, (int64_t)thread->new_settings->session->sample_rate)
00551 {
00552 this->thread = thread;
00553 }
00554 int SetSampleRateTextBox::handle_event()
00555 {
00556 thread->new_settings->session->sample_rate = CLIP(atol(get_text()), 1, 1000000);
00557 return 1;
00558 }
00559
00560 SetChannelsTextBox::SetChannelsTextBox(SetFormatThread *thread, int x, int y)
00561 : BC_TextBox(x, y, 100, 1, thread->new_settings->session->audio_channels)
00562 {
00563 this->thread = thread;
00564 }
00565 int SetChannelsTextBox::handle_event()
00566 {
00567 thread->new_settings->session->audio_channels = CLIP(atol(get_text()), 1, MAXCHANNELS - 1);
00568 thread->window->canvas->draw();
00569 return 1;
00570 }
00571
00572
00573 SetChannelsCanvas::SetChannelsCanvas(MWindow *mwindow,
00574 SetFormatThread *thread,
00575 int x,
00576 int y,
00577 int w,
00578 int h)
00579 : BC_SubWindow(x,
00580 y,
00581 w,
00582 h)
00583 {
00584 this->thread = thread;
00585 this->mwindow = mwindow;
00586 active_channel = -1;
00587 box_r = mwindow->theme->channel_position_data->get_w() / 2;
00588 temp_picon = new VFrame(0,
00589 mwindow->theme->channel_position_data->get_w(),
00590 mwindow->theme->channel_position_data->get_h(),
00591 mwindow->theme->channel_position_data->get_color_model());
00592 rotater = new RotateFrame(mwindow->preferences->processors,
00593 mwindow->theme->channel_position_data->get_w(),
00594 mwindow->theme->channel_position_data->get_h());
00595 }
00596 SetChannelsCanvas::~SetChannelsCanvas()
00597 {
00598 delete temp_picon;
00599 delete rotater;
00600 }
00601
00602 int SetChannelsCanvas::draw(int angle)
00603 {
00604 set_color(RED);
00605 int real_w = get_w() - box_r * 2;
00606 int real_h = get_h() - box_r * 2;
00607 int real_x = box_r;
00608 int real_y = box_r;
00609
00610 draw_top_background(get_top_level(), 0, 0, get_w(), get_h());
00611
00612
00613
00614
00615
00616 int x, y, w, h;
00617 char string[32];
00618 set_color(mwindow->theme->channel_position_color);
00619 for(int i = 0; i < thread->new_settings->session->audio_channels; i++)
00620 {
00621 get_dimensions(thread->new_settings->session->achannel_positions[i],
00622 x,
00623 y,
00624 w,
00625 h);
00626 double rotate_angle = thread->new_settings->session->achannel_positions[i];
00627 rotate_angle = -rotate_angle;
00628 while(rotate_angle < 0) rotate_angle += 360;
00629 rotater->rotate(temp_picon,
00630 mwindow->theme->channel_position_data,
00631 rotate_angle,
00632 0);
00633
00634 BC_Pixmap temp_pixmap(this,
00635 temp_picon,
00636 PIXMAP_ALPHA,
00637 0);
00638 draw_pixmap(&temp_pixmap, x, y);
00639 sprintf(string, "%d", i + 1);
00640 draw_text(x + 2, y + box_r * 2 - 2, string);
00641 }
00642
00643 if(angle > -1)
00644 {
00645 sprintf(string, _("%d degrees"), angle);
00646 draw_text(this->get_w() / 2 - 40, this->get_h() / 2, string);
00647 }
00648
00649 flash();
00650 return 0;
00651 }
00652
00653 int SetChannelsCanvas::get_dimensions(int channel_position,
00654 int &x,
00655 int &y,
00656 int &w,
00657 int &h)
00658 {
00659 #define MARGIN 10
00660 int real_w = this->get_w() - box_r * 2 - MARGIN;
00661 int real_h = this->get_h() - box_r * 2 - MARGIN;
00662 float corrected_position = channel_position;
00663 if(corrected_position < 0) corrected_position += 360;
00664 Units::polar_to_xy((float)corrected_position, real_w / 2, x, y);
00665 x += real_w / 2 + MARGIN / 2;
00666 y += real_h / 2 + MARGIN / 2;
00667 w = box_r * 2;
00668 h = box_r * 2;
00669 return 0;
00670 }
00671
00672 int SetChannelsCanvas::button_press_event()
00673 {
00674 if(!cursor_inside()) return 0;
00675
00676 for(int i = 0;
00677 i < thread->new_settings->session->audio_channels;
00678 i++)
00679 {
00680 int x, y, w, h;
00681 get_dimensions(thread->new_settings->session->achannel_positions[i],
00682 x,
00683 y,
00684 w,
00685 h);
00686 if(get_cursor_x() > x && get_cursor_y() > y &&
00687 get_cursor_x() < x + w && get_cursor_y() < y + h)
00688 {
00689 active_channel = i;
00690 degree_offset = (int)Units::xy_to_polar(get_cursor_x() - this->get_w() / 2, get_cursor_y() - this->get_h() / 2);
00691 degree_offset += 90;
00692 if(degree_offset >= 360) degree_offset -= 360;
00693 degree_offset -= thread->new_settings->session->achannel_positions[i];
00694 draw(thread->new_settings->session->achannel_positions[i]);
00695 return 1;
00696 }
00697 }
00698 return 0;
00699 }
00700
00701 int SetChannelsCanvas::button_release_event()
00702 {
00703 if(active_channel >= 0)
00704 {
00705 active_channel = -1;
00706 draw(-1);
00707 return 1;
00708 }
00709 return 0;
00710 }
00711
00712 int SetChannelsCanvas::cursor_motion_event()
00713 {
00714 if(active_channel >= 0)
00715 {
00716
00717 int new_d;
00718 new_d = (int)Units::xy_to_polar(get_cursor_x() - this->get_w() / 2, get_cursor_y() - this->get_h() / 2);
00719 new_d += 90;
00720 new_d -= degree_offset;
00721
00722 while(new_d >= 360) new_d -= 360;
00723 while(new_d < 0) new_d += 360;
00724
00725 if(thread->new_settings->session->achannel_positions[active_channel] != new_d)
00726 {
00727 thread->new_settings->session->achannel_positions[active_channel] = new_d;
00728 draw(thread->new_settings->session->achannel_positions[active_channel]);
00729 }
00730 return 1;
00731 }
00732 return 0;
00733 }
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743 SetFrameRateTextBox::SetFrameRateTextBox(SetFormatThread *thread, int x, int y)
00744 : BC_TextBox(x, y, 100, 1, (float)thread->new_settings->session->frame_rate)
00745 {
00746 this->thread = thread;
00747 }
00748
00749 int SetFrameRateTextBox::handle_event()
00750 {
00751 thread->new_settings->session->frame_rate = Units::atoframerate(get_text());
00752 return 1;
00753 }
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771 ScaleSizeText::ScaleSizeText(int x, int y, SetFormatThread *thread, int *output)
00772 : BC_TextBox(x, y, 100, 1, *output)
00773 {
00774 this->thread = thread;
00775 this->output = output;
00776 }
00777 ScaleSizeText::~ScaleSizeText()
00778 {
00779 }
00780 int ScaleSizeText::handle_event()
00781 {
00782 *output = atol(get_text());
00783 *output /= 2;
00784 *output *= 2;
00785 if(*output <= 0) *output = 2;
00786 if(*output > 10000) *output = 10000;
00787 *output *= -1;
00788 thread->update_window();
00789 }
00790
00791
00792
00793 ScaleRatioText::ScaleRatioText(int x,
00794 int y,
00795 SetFormatThread *thread,
00796 float *output)
00797 : BC_TextBox(x, y, 100, 1, *output)
00798 {
00799 this->thread = thread;
00800 this->output = output;
00801 }
00802 ScaleRatioText::~ScaleRatioText()
00803 {
00804 }
00805 int ScaleRatioText::handle_event()
00806 {
00807 *output = atof(get_text());
00808
00809 if(*output > 10000) *output = 10000;
00810 if(*output < -10000) *output = -10000;
00811 *output *= -1;
00812 thread->update_window();
00813 return 1;
00814 }
00815
00816
00817
00818 ScaleAspectAuto::ScaleAspectAuto(int x, int y, SetFormatThread *thread)
00819 : BC_CheckBox(x, y, thread->auto_aspect, _("Auto"))
00820 {
00821 this->thread = thread;
00822 }
00823
00824 ScaleAspectAuto::~ScaleAspectAuto()
00825 {
00826 }
00827
00828 int ScaleAspectAuto::handle_event()
00829 {
00830 thread->auto_aspect = get_value();
00831 thread->update_aspect();
00832 }
00833
00834 ScaleAspectText::ScaleAspectText(int x, int y, SetFormatThread *thread, float *output)
00835 : BC_TextBox(x, y, 70, 1, *output)
00836 {
00837 this->output = output;
00838 this->thread = thread;
00839 }
00840 ScaleAspectText::~ScaleAspectText()
00841 {
00842 }
00843
00844 int ScaleAspectText::handle_event()
00845 {
00846 *output = atof(get_text());
00847 return 1;
00848 }
00849
00850
00851
00852
00853 SetFormatApply::SetFormatApply(int x, int y, SetFormatThread *thread)
00854 : BC_GenericButton(x, y, _("Apply"))
00855 {
00856 this->thread = thread;
00857 }
00858
00859 int SetFormatApply::handle_event()
00860 {
00861 thread->apply_changes();
00862 return 1;
00863 }