/*
* CINELERRA
* Copyright (C) 1997-2012 Adam Williams <broadcast at earthling dot net>
+ * Copyright (C) 2003-2016 Cinelerra CV contributors
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
}
-
-
-
-
-
-
-
SetFormatWindow::SetFormatWindow(MWindow *mwindow,
SetFormatThread *thread, int x, int y)
: BC_Window(_(PROGRAM_NAME ": Set Format"), x, y,
this->mwindow = mwindow;
this->thread = thread;
presets = 0;
+// *** CONTEXT_HELP ***
+ context_help_set_keyword("Project and Media Attributes");
}
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);
_("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;
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,
_("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,
aspect_h,
x,
y));
- x += 30;
+ x += xS(30);
add_subwindow(auto_aspect = new ScaleAspectAuto(x, y, thread));
y += mwindow->theme->setformat_margin;
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<BC_ListBoxItem*>*)&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();
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;
}
}
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;
}
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;
}
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;
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;
}
//
// 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;
// }
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;
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;
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;
}
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;