X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fsetformat.C;h=cfd43685fd5b470b949c8bbef7a38b1689ba6f9e;hp=67366aa160789da444e7b130ead35d766c480e96;hb=7ffa6954689f14a41a3bae7a0fdb3f2abeaa9679;hpb=a0ed17a5d6ecf2b010d977bc1f9b7226f24c20f6 diff --git a/cinelerra-5.1/cinelerra/setformat.C b/cinelerra-5.1/cinelerra/setformat.C index 67366aa1..cfd43685 100644 --- a/cinelerra-5.1/cinelerra/setformat.C +++ b/cinelerra-5.1/cinelerra/setformat.C @@ -271,13 +271,6 @@ void SetFormatThread::update_aspect() } - - - - - - - SetFormatWindow::SetFormatWindow(MWindow *mwindow, SetFormatThread *thread, int x, int y) : BC_Window(_(PROGRAM_NAME ": Set Format"), x, y, @@ -296,7 +289,7 @@ SetFormatWindow::~SetFormatWindow() void SetFormatWindow::create_objects() { lock_window("SetFormatWindow::create_objects"); - int x = 10, y = mwindow->theme->setformat_y1; + int x = xS(10), y = mwindow->theme->setformat_y1; BC_TextBox *textbox; BC_Title *title; mwindow->theme->draw_setformat_bg(this); @@ -323,7 +316,7 @@ void SetFormatWindow::create_objects() _("Channels:"))); add_subwindow(channels = new SetChannelsTextBox(thread, mwindow->theme->setformat_x2, y)); - add_subwindow(new BC_ITumbler(channels, 1, MAXCHANNELS, + add_subwindow(new BC_ITumbler(channels, 0, MAXCHANNELS, mwindow->theme->setformat_x2 + channels->get_w(), y)); y += mwindow->theme->setformat_margin; @@ -417,17 +410,10 @@ void SetFormatWindow::create_objects() y, _("Color model:"))); x = mwindow->theme->setformat_x4; - add_subwindow(textbox = new BC_TextBox(x, - y, - 100, - 1, - "")); + add_subwindow(textbox = new BC_TextBox(x, y, xS(100), 1, "")); x += textbox->get_w(); - add_subwindow(color_model = new ColormodelPulldown(mwindow, - textbox, - &thread->new_settings->session->color_model, - x, - y)); + add_subwindow(color_model = new ColormodelPulldown(mwindow, textbox, + &thread->new_settings->session->color_model, x, y)); y += mwindow->theme->setformat_margin; add_subwindow(new BC_Title(mwindow->theme->setformat_x3, @@ -435,13 +421,11 @@ void SetFormatWindow::create_objects() _("Aspect ratio:"))); y += mwindow->theme->setformat_margin; x = mwindow->theme->setformat_x3; - add_subwindow(aspect_w = new ScaleAspectText(x, - y, - thread, + add_subwindow(aspect_w = new ScaleAspectText(x, y, thread, &(thread->new_settings->session->aspect_w))); - x += aspect_w->get_w() + 5; + x += aspect_w->get_w() + xS(5); add_subwindow(new BC_Title(x, y, ":")); - x += 10; + x += xS(10); add_subwindow(aspect_h = new ScaleAspectText(x, y, thread, @@ -452,7 +436,7 @@ void SetFormatWindow::create_objects() aspect_h, x, y)); - x += 30; + x += xS(30); add_subwindow(auto_aspect = new ScaleAspectAuto(x, y, thread)); y += mwindow->theme->setformat_margin; @@ -460,27 +444,20 @@ void SetFormatWindow::create_objects() add_subwindow(new BC_Title(mwindow->theme->setformat_x3, y, _("Interlace mode:"))); - add_subwindow(textbox = new BC_TextBox(mwindow->theme->setformat_x4, - y, - 140, - 1, - "")); + add_subwindow(textbox = new BC_TextBox(mwindow->theme->setformat_x4, y, + xS(140), 1, "")); add_subwindow(interlace_pulldown = new InterlacemodePulldown(mwindow, - textbox, - &(thread->new_settings->session->interlace_mode), + textbox, &(thread->new_settings->session->interlace_mode), (ArrayList*)&mwindow->interlace_project_modes, - mwindow->theme->setformat_x4 + textbox->get_w(), - y)); + mwindow->theme->setformat_x4 + textbox->get_w(), y)); y += mwindow->theme->setformat_margin; - BC_OKTextButton *ok; BC_CancelTextButton *cancel; add_subwindow(ok = new BC_OKTextButton(this)); add_subwindow(cancel = new BC_CancelTextButton(this)); add_subwindow(new SetFormatApply((ok->get_x() + cancel->get_x()) / 2, - ok->get_y(), - thread)); + ok->get_y(), thread)); flash(); show_window(); unlock_window(); @@ -519,7 +496,7 @@ EDL* SetFormatPresets::get_edl() SetSampleRateTextBox::SetSampleRateTextBox(SetFormatThread *thread, int x, int y) - : BC_TextBox(x, y, 100, 1, (int64_t)thread->new_settings->session->sample_rate) + : BC_TextBox(x, y, xS(100), 1, (int64_t)thread->new_settings->session->sample_rate) { this->thread = thread; } @@ -530,25 +507,20 @@ int SetSampleRateTextBox::handle_event() } SetChannelsTextBox::SetChannelsTextBox(SetFormatThread *thread, int x, int y) - : BC_TextBox(x, y, 100, 1, thread->new_settings->session->audio_channels) + : BC_TextBox(x, y, xS(100), 1, thread->new_settings->session->audio_channels) { this->thread = thread; } int SetChannelsTextBox::handle_event() { - int new_channels = CLIP(atoi(get_text()), 1, MAXCHANNELS); - + int new_channels = CLIP(atoi(get_text()), 0, MAXCHANNELS); thread->new_settings->session->audio_channels = new_channels; - - - if(new_channels > 0) - { + if(new_channels > 0) { memcpy(thread->new_settings->session->achannel_positions, &thread->mwindow->preferences->channel_positions[new_channels - 1], sizeof(thread->new_settings->session->achannel_positions)); } - thread->window->canvas->draw(); return 1; } @@ -612,10 +584,7 @@ int SetChannelsCanvas::draw(int angle) for(int i = 0; i < thread->new_settings->session->audio_channels; i++) { get_dimensions(thread->new_settings->session->achannel_positions[i], - x, - y, - w, - h); + x, y, w, h); double rotate_angle = thread->new_settings->session->achannel_positions[i]; rotate_angle = -rotate_angle; while(rotate_angle < 0) rotate_angle += 360; @@ -644,19 +613,16 @@ int SetChannelsCanvas::draw(int angle) } int SetChannelsCanvas::get_dimensions(int channel_position, - int &x, - int &y, - int &w, - int &h) -{ -#define MARGIN 10 - int real_w = this->get_w() - box_r * 2 - MARGIN; - int real_h = this->get_h() - box_r * 2 - MARGIN; + int &x, int &y, int &w, int &h) +{ + int xs10 = xS(10), ys10 = yS(10); + int real_w = this->get_w() - box_r * 2 - xs10; + int real_h = this->get_h() - box_r * 2 - ys10; float corrected_position = channel_position; if(corrected_position < 0) corrected_position += 360; Units::polar_to_xy((float)corrected_position, real_w / 2, x, y); - x += real_w / 2 + MARGIN / 2; - y += real_h / 2 + MARGIN / 2; + x += real_w / 2 + xs10 / 2; + y += real_h / 2 + ys10 / 2; w = box_r * 2; h = box_r * 2; return 0; @@ -723,7 +689,7 @@ int SetChannelsCanvas::cursor_motion_event() SetFrameRateTextBox::SetFrameRateTextBox(SetFormatThread *thread, int x, int y) - : BC_TextBox(x, y, 100, 1, (float)thread->new_settings->session->frame_rate) + : BC_TextBox(x, y, xS(100), 1, (float)thread->new_settings->session->frame_rate) { this->thread = thread; } @@ -737,7 +703,7 @@ int SetFrameRateTextBox::handle_event() // // SetVChannels::SetVChannels(SetFormatThread *thread, int x, int y) -// : BC_TextBox(x, y, 100, 1, thread->channels) +// : BC_TextBox(x, y, xS(100), 1, thread->channels) // { // this->thread = thread; // } @@ -751,7 +717,7 @@ int SetFrameRateTextBox::handle_event() ScaleSizeText::ScaleSizeText(int x, int y, SetFormatThread *thread, int *output) - : BC_TextBox(x, y, 100, 1, *output) + : BC_TextBox(x, y, xS(100), 1, *output) { this->thread = thread; this->output = output; @@ -762,8 +728,7 @@ ScaleSizeText::~ScaleSizeText() int ScaleSizeText::handle_event() { *output = atol(get_text()); - *output /= 2; - *output *= 2; + *output /= 2; *output *= 2; if(*output <= 0) *output = 2; if(*output > 10000) *output = 10000; *output *= -1; @@ -777,7 +742,7 @@ ScaleRatioText::ScaleRatioText(int x, int y, SetFormatThread *thread, float *output) - : BC_TextBox(x, y, 100, 1, *output) + : BC_TextBox(x, y, xS(100), 1, *output) { this->thread = thread; this->output = output; @@ -815,7 +780,7 @@ int ScaleAspectAuto::handle_event() } ScaleAspectText::ScaleAspectText(int x, int y, SetFormatThread *thread, float *output) - : BC_TextBox(x, y, 70, 1, *output) + : BC_TextBox(x, y, xS(70), 1, *output) { this->output = output; this->thread = thread;