/*
* CINELERRA
* Copyright (C) 1997-2011 Adam Williams <broadcast at earthling dot net>
- *
+ *
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ *
*/
#include "bcsignals.h"
-#include "cicolors.h"
+#include "bccolors.h"
#include "clip.h"
#include "cursors.h"
#include "language.h"
-ScopeUnit::ScopeUnit(ScopeGUI *gui,
+ScopeUnit::ScopeUnit(ScopeGUI *gui,
ScopeEngine *server)
: LoadClient(server)
{
-void ScopeUnit::draw_point(unsigned char **rows,
- int x,
- int y,
- int r,
- int g,
+void ScopeUnit::draw_point(unsigned char **rows,
+ int x,
+ int y,
+ int r,
+ int g,
int b)
{
unsigned char *pixel = rows[y] + x * 4;
}
}
break;
-
+
case BC_RGB_FLOAT:
for(int i = pkg->row1; i < pkg->row2; i++)
{
}
}
break;
-
+
case BC_YUV420P:
for(int i = pkg->row1; i < pkg->row2; i++)
void ScopeEngine::process()
{
process_packages();
-
+
for(int i = 0; i < HIST_SECTIONS; i++)
bzero(gui->bins[i], sizeof(int) * TOTAL_BINS);
int w,
int h,
int cpus)
- : PluginClientWindow(PROGRAM_NAME ": Scopes",
- x,
- y,
- w,
- h,
- MIN_SCOPE_W,
+ : PluginClientWindow(_(PROGRAM_NAME ": Scopes"),
+ x,
+ y,
+ w,
+ h,
+ MIN_SCOPE_W,
MIN_SCOPE_H,
1)
{
reset();
}
-ScopeGUI::ScopeGUI(PluginClient *plugin,
+ScopeGUI::ScopeGUI(PluginClient *plugin,
int w,
int h)
: PluginClientWindow(plugin,
- w,
- h,
- MIN_SCOPE_W,
+ w,
+ h,
+ MIN_SCOPE_W,
MIN_SCOPE_H,
1)
{
{
use_hist = 0;
}
-
+
if(use_wave && use_wave_parade)
{
use_wave = 0;
}
- if(!engine) engine = new ScopeEngine(this,
+ if(!engine) engine = new ScopeEngine(this,
cpus);
lock_window("ScopeGUI::create_objects");
-
-
+
+
int x = theme->widget_border;
int y = theme->widget_border;
- add_subwindow(hist_on = new ScopeToggle(this,
- x,
+ add_subwindow(hist_on = new ScopeToggle(this,
+ x,
y,
&use_hist));
x += hist_on->get_w() + theme->widget_border;
- add_subwindow(hist_parade_on = new ScopeToggle(this,
- x,
+ add_subwindow(hist_parade_on = new ScopeToggle(this,
+ x,
y,
&use_hist_parade));
x += hist_parade_on->get_w() + theme->widget_border;
- add_subwindow(waveform_on = new ScopeToggle(this,
- x,
+ add_subwindow(waveform_on = new ScopeToggle(this,
+ x,
y,
&use_wave));
x += waveform_on->get_w() + theme->widget_border;
- add_subwindow(waveform_parade_on = new ScopeToggle(this,
- x,
+ add_subwindow(waveform_parade_on = new ScopeToggle(this,
+ x,
y,
&use_wave_parade));
x += waveform_parade_on->get_w() + theme->widget_border;
- add_subwindow(vector_on = new ScopeToggle(this,
- x,
+ add_subwindow(vector_on = new ScopeToggle(this,
+ x,
y,
&use_vector));
x += vector_on->get_w() + theme->widget_border;
if(!waveform)
{
add_subwindow(waveform = new ScopeWaveform(this,
- wave_x,
- wave_y,
- wave_w,
+ wave_x,
+ wave_y,
+ wave_w,
wave_h));
waveform->create_objects();
}
else
{
- waveform->reposition_window(wave_x,
- wave_y,
- wave_w,
+ waveform->reposition_window(wave_x,
+ wave_y,
+ wave_w,
wave_h);
waveform->clear_box(0, 0, wave_w, wave_h);
}
delete waveform;
waveform = 0;
}
-
+
if(use_vector)
{
if(!vectorscope)
{
add_subwindow(vectorscope = new ScopeVectorscope(this,
- vector_x,
- vector_y,
- vector_w,
+ vector_x,
+ vector_y,
+ vector_w,
vector_h));
vectorscope->create_objects();
}
else
{
- vectorscope->reposition_window(vector_x,
- vector_y,
- vector_w,
+ vectorscope->reposition_window(vector_x,
+ vector_y,
+ vector_w,
vector_h);
vectorscope->clear_box(0, 0, vector_w, vector_h);
}
delete vectorscope;
vectorscope = 0;
}
-
+
if((use_hist || use_hist_parade))
{
if(!histogram)
{
-// printf("ScopeGUI::create_panels %d %d %d %d %d\n", __LINE__, hist_x,
-// hist_y,
-// hist_w,
+// printf("ScopeGUI::create_panels %d %d %d %d %d\n", __LINE__, hist_x,
+// hist_y,
+// hist_w,
// hist_h);
add_subwindow(histogram = new ScopeHistogram(this,
- hist_x,
- hist_y,
- hist_w,
+ hist_x,
+ hist_y,
+ hist_w,
hist_h));
histogram->create_objects();
}
else
{
- histogram->reposition_window(hist_x,
- hist_y,
- hist_w,
+ histogram->reposition_window(hist_x,
+ hist_y,
+ hist_w,
hist_h);
histogram->clear_box(0, 0, hist_w, hist_h);
}
delete histogram;
histogram = 0;
}
-
-
+
+
allocate_bitmaps();
clear_points(0);
void ScopeGUI::toggle_event()
{
-
+
}
void ScopeGUI::calculate_sizes(int w, int h)
vector_w = w - margin - vector_x;
vector_y = vector_on->get_h() + margin * 2;
vector_h = h - vector_y - margin;
-
- if(vector_w > vector_h)
+
+ if(vector_w > vector_h)
{
vector_w = vector_h;
vector_x = w - theme->widget_border - vector_w;
hist_y = vector_on->get_h() + margin * 2;
hist_w = panel_w - margin;
hist_h = h - hist_y - margin;
-
+
total_panels--;
x += panel_w;
}
this->w = w;
this->h = h;
calculate_sizes(w, h);
-
+
if(waveform)
{
waveform->reposition_window(wave_x, wave_y, wave_w, wave_h);
waveform->clear_box(0, 0, wave_w, wave_h);
}
-
+
if(histogram)
{
histogram->reposition_window(hist_x, hist_y, hist_w, hist_h);
histogram->clear_box(0, 0, hist_w, hist_h);
}
-
+
if(vectorscope)
{
vectorscope->reposition_window(vector_x, vector_y, vector_w, vector_h);
{
x = get_x();
y = get_y();
-
+
PluginClientWindow::translation_event();
return 0;
}
{
text_color = BLACK;
}
-
+
if(overlays && borders)
{
clear_box(0, 0, get_w(), get_h());
if(histogram && (use_hist || use_hist_parade))
{
- histogram->draw_line(hist_w * -FLOAT_MIN / (FLOAT_MAX - FLOAT_MIN),
- 0,
- hist_w * -FLOAT_MIN / (FLOAT_MAX - FLOAT_MIN),
+ histogram->draw_line(hist_w * -FLOAT_MIN / (FLOAT_MAX - FLOAT_MIN),
+ 0,
+ hist_w * -FLOAT_MIN / (FLOAT_MAX - FLOAT_MIN),
hist_h);
- histogram->draw_line(hist_w * (1.0 - FLOAT_MIN) / (FLOAT_MAX - FLOAT_MIN),
- 0,
- hist_w * (1.0 - FLOAT_MIN) / (FLOAT_MAX - FLOAT_MIN),
+ histogram->draw_line(hist_w * (1.0 - FLOAT_MIN) / (FLOAT_MAX - FLOAT_MIN),
+ 0,
+ hist_w * (1.0 - FLOAT_MIN) / (FLOAT_MAX - FLOAT_MIN),
hist_h);
set_line_dashes(0);
histogram->draw_point();
int text_y = y + wave_y + get_text_ascent(SMALLFONT) / 2;
CLAMP(text_y, waveform->get_y() + get_text_ascent(SMALLFONT), waveform->get_y() + waveform->get_h() - 1);
char string[BCTEXTLEN];
- sprintf(string, "%d",
- (int)((FLOAT_MAX -
+ sprintf(string, "%d",
+ (int)((FLOAT_MAX -
i * (FLOAT_MAX - FLOAT_MIN) / WAVEFORM_DIVISIONS) * 100));
int text_x = wave_x - get_text_width(SMALLFONT, string) - theme->widget_border;
draw_text(text_x, text_y, string);
int h = radius * i / VECTORSCOPE_DIVISIONS * 2;
char string[BCTEXTLEN];
- sprintf(string, "%d",
+ sprintf(string, "%d",
(int)((FLOAT_MAX / VECTORSCOPE_DIVISIONS * i) * 100));
int text_x = vector_x - get_text_width(SMALLFONT, string) - theme->widget_border;
draw_text(text_x, text_y, string);
//printf("ScopeGUI::draw_overlays %d %d %d %s\n", __LINE__, text_x, text_y, string);
-
+
vectorscope->draw_circle(x, y, w, h);
//vectorscope->draw_rectangle(0, 0, vector_w, vector_h);
}
- // vectorscope->draw_circle(vector_w / 2 - radius,
- // vector_h / 2 - radius,
- // radius * 2,
+ // vectorscope->draw_circle(vector_w / 2 - radius,
+ // vector_h / 2 - radius,
+ // radius * 2,
// radius * 2);
set_line_dashes(0);
{
if(use_hist || use_hist_parade)
{
- draw_3d_border(hist_x - 2,
- hist_y - 2,
- hist_w + 4,
- hist_h + 4,
+ draw_3d_border(hist_x - 2,
+ hist_y - 2,
+ hist_w + 4,
+ hist_h + 4,
get_bg_color(),
BLACK,
- MDGREY,
+ MDGREY,
get_bg_color());
}
if(use_wave || use_wave_parade)
{
- draw_3d_border(wave_x - 2,
- wave_y - 2,
- wave_w + 4,
- wave_h + 4,
+ draw_3d_border(wave_x - 2,
+ wave_y - 2,
+ wave_w + 4,
+ wave_h + 4,
get_bg_color(),
BLACK,
- MDGREY,
+ MDGREY,
get_bg_color());
}
if(use_vector)
{
- draw_3d_border(vector_x - 2,
- vector_y - 2,
- vector_w + 4,
- vector_h + 4,
+ draw_3d_border(vector_x - 2,
+ vector_y - 2,
+ vector_w + 4,
+ vector_h + 4,
get_bg_color(),
BLACK,
- MDGREY,
+ MDGREY,
get_bg_color());
}
}
if(waveform)
{
- waveform->draw_bitmap(waveform_bitmap,
+ waveform->draw_bitmap(waveform_bitmap,
1,
0,
0);
if(vectorscope)
{
- vectorscope->draw_bitmap(vector_bitmap,
+ vectorscope->draw_bitmap(vector_bitmap,
1,
0,
0);
-ScopePanel::ScopePanel(ScopeGUI *gui,
- int x,
+ScopePanel::ScopePanel(ScopeGUI *gui,
+ int x,
int y,
int w,
int h)
if(is_event_win() && cursor_inside())
{
gui->clear_points(1);
-
+
is_dragging = 1;
int x = get_cursor_x();
int y = get_cursor_y();
-ScopeWaveform::ScopeWaveform(ScopeGUI *gui,
- int x,
+ScopeWaveform::ScopeWaveform(ScopeGUI *gui,
+ int x,
int y,
int w,
int h)
-ScopeVectorscope::ScopeVectorscope(ScopeGUI *gui,
- int x,
+ScopeVectorscope::ScopeVectorscope(ScopeGUI *gui,
+ int x,
int y,
int w,
int h)
set_inverse();
set_color(0xff0000);
set_line_width(2);
- draw_circle(get_w() / 2 - drag_radius,
- get_h() / 2 - drag_radius,
- drag_radius * 2,
+ draw_circle(get_w() / 2 - drag_radius,
+ get_h() / 2 - drag_radius,
+ drag_radius * 2,
drag_radius * 2);
-
- draw_line(get_w() / 2,
- get_h() / 2,
+
+ draw_line(get_w() / 2,
+ get_h() / 2,
get_w() / 2 + radius * cos(drag_angle),
get_h() / 2 + radius * sin(drag_angle));
set_line_width(1);
-ScopeHistogram::ScopeHistogram(ScopeGUI *gui,
- int x,
+ScopeHistogram::ScopeHistogram(ScopeGUI *gui,
+ int x,
int y,
int w,
int h)
draw_point();
drag_x = x;
float value = (float)x / get_w() * (FLOAT_MAX - FLOAT_MIN) + FLOAT_MIN;
-
+
char string[BCTEXTLEN];
sprintf(string, "Value: %.3f", value);
gui->value_text->update(string, 0);
{
draw_mode(3, LTGREY, 0, get_h());
}
-
+
if(flash) this->flash(0);
if(flush) this->flush();
}
-ScopeToggle::ScopeToggle(ScopeGUI *gui,
- int x,
+ScopeToggle::ScopeToggle(ScopeGUI *gui,
+ int x,
int y,
int *value)
- : BC_Toggle(x,
- y,
+ : BC_Toggle(x,
+ y,
get_image_set(gui, value),
*value)
{
this->value = value;
if(value == &gui->use_hist_parade)
{
- set_tooltip("Histogram Parade");
+ set_tooltip(_("Histogram Parade"));
}
else
if(value == &gui->use_hist)
{
- set_tooltip("Histogram");
+ set_tooltip(_("Histogram"));
}
else
if(value == &gui->use_wave_parade)
{
- set_tooltip("Waveform Parade");
+ set_tooltip(_("Waveform Parade"));
}
else
if(value == &gui->use_wave)
{
- set_tooltip("Waveform");
+ set_tooltip(_("Waveform"));
}
else
{
- set_tooltip("Vectorscope");
+ set_tooltip(_("Vectorscope"));
}
}