X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fplugins%2Fthreshold%2Fthresholdwindow.C;h=7a22ba33668e91756c5bc0acad48de68de90fe7c;hb=08284a3a20b2cc8606dd90c3c147e2c31d301a61;hp=4fb3bb21265e0855ed85ee0f0e2bcbe712cb80a7;hpb=30bdb85eb33a8ee7ba675038a86c6be59c43d7bd;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/plugins/threshold/thresholdwindow.C b/cinelerra-5.1/plugins/threshold/thresholdwindow.C index 4fb3bb21..7a22ba33 100644 --- a/cinelerra-5.1/plugins/threshold/thresholdwindow.C +++ b/cinelerra-5.1/plugins/threshold/thresholdwindow.C @@ -2,21 +2,21 @@ /* * CINELERRA * Copyright (C) 2008 Adam Williams - * + * * 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 "bcdisplayinfo.h" @@ -36,12 +36,12 @@ ThresholdMin::ThresholdMin(ThresholdMain *plugin, int x, int y, int w) - : BC_TumbleTextBox(gui, + : BC_TumbleTextBox(gui, plugin->config.min, HISTOGRAM_MIN, HISTOGRAM_MAX, - x, - y, + x, + y, w) { this->plugin = plugin; @@ -70,12 +70,12 @@ ThresholdMax::ThresholdMax(ThresholdMain *plugin, int x, int y, int w) - : BC_TumbleTextBox(gui, + : BC_TumbleTextBox(gui, plugin->config.max, HISTOGRAM_MIN, HISTOGRAM_MAX, - x, - y, + x, + y, w) { this->plugin = plugin; @@ -107,7 +107,7 @@ ThresholdPlot::ThresholdPlot(ThresholdMain *plugin, int ThresholdPlot::handle_event() { plugin->config.plot = get_value(); - + plugin->send_configure_change(); return 1; } @@ -138,8 +138,8 @@ int ThresholdCanvas::button_press_event() state = DRAG_SELECTION; if(shift_down()) { - x1 = (int)((plugin->config.min - HISTOGRAM_MIN) / - (HISTOGRAM_MAX - HISTOGRAM_MIN) * + x1 = (int)((plugin->config.min - HISTOGRAM_MIN) / + (HISTOGRAM_MAX - HISTOGRAM_MIN) * get_w()); x2 = (int)((plugin->config.max - HISTOGRAM_MIN) / (HISTOGRAM_MAX - HISTOGRAM_MIN) * @@ -161,13 +161,13 @@ int ThresholdCanvas::button_press_event() x1 = x2 = center_x = get_cursor_x(); } - plugin->config.min = x1 * - (HISTOGRAM_MAX - HISTOGRAM_MIN) / - get_w() + + plugin->config.min = x1 * + (HISTOGRAM_MAX - HISTOGRAM_MIN) / + get_w() + HISTOGRAM_MIN; - plugin->config.max = x2 * - (HISTOGRAM_MAX - HISTOGRAM_MIN) / - get_w() + + plugin->config.max = x2 * + (HISTOGRAM_MAX - HISTOGRAM_MIN) / + get_w() + HISTOGRAM_MIN; draw(); @@ -201,14 +201,14 @@ int ThresholdCanvas::cursor_motion_event() x2 = center_x; } - plugin->config.min = x1 * - (HISTOGRAM_MAX - HISTOGRAM_MIN) / - get_w() + + plugin->config.min = x1 * + (HISTOGRAM_MAX - HISTOGRAM_MIN) / + get_w() + HISTOGRAM_MIN; - plugin->config.max = x2 * - (HISTOGRAM_MAX - HISTOGRAM_MIN) / - get_w() + + plugin->config.max = x2 * + (HISTOGRAM_MAX - HISTOGRAM_MIN) / + get_w() + HISTOGRAM_MIN; gui->min->update(plugin->config.min); @@ -225,15 +225,15 @@ void ThresholdCanvas::draw() int max = 0; set_color(WHITE); draw_box(0, 0, get_w(), get_h()); - int border_x1 = (int)((0 - HISTOGRAM_MIN) / + int border_x1 = (int)((0 - HISTOGRAM_MIN) / (HISTOGRAM_MAX - HISTOGRAM_MIN) * get_w()); - int border_x2 = (int)((1.0 - HISTOGRAM_MIN) / + int border_x2 = (int)((1.0 - HISTOGRAM_MIN) / (HISTOGRAM_MAX - HISTOGRAM_MIN) * get_w()); - int x1 = (int)((plugin->config.min - HISTOGRAM_MIN) / - (HISTOGRAM_MAX - HISTOGRAM_MIN) * + int x1 = (int)((plugin->config.min - HISTOGRAM_MIN) / + (HISTOGRAM_MAX - HISTOGRAM_MIN) * get_w()); int x2 = (int)((plugin->config.max - HISTOGRAM_MIN) / (HISTOGRAM_MAX - HISTOGRAM_MIN) * @@ -367,7 +367,7 @@ int ThresholdHighColorButton::handle_event() ThresholdLowColorThread::ThresholdLowColorThread(ThresholdMain *plugin, ThresholdWindow *window) - : ColorThread(1, _("Low color")) + : ColorPicker(1, _("Low color")) { this->plugin = plugin; this->window = window; @@ -387,7 +387,7 @@ int ThresholdLowColorThread::handle_new_color(int output, int alpha) ThresholdMidColorThread::ThresholdMidColorThread(ThresholdMain *plugin, ThresholdWindow *window) - : ColorThread(1, _("Mid color")) + : ColorPicker(1, _("Mid color")) { this->plugin = plugin; this->window = window; @@ -407,7 +407,7 @@ int ThresholdMidColorThread::handle_new_color(int output, int alpha) ThresholdHighColorThread::ThresholdHighColorThread(ThresholdMain *plugin, ThresholdWindow *window) - : ColorThread(1, _("High color")) + : ColorPicker(1, _("High color")) { this->plugin = plugin; this->window = window; @@ -537,5 +537,12 @@ void ThresholdWindow::update_high_color() flash(high_color_x, high_color_y, COLOR_W, COLOR_H); } +void ThresholdWindow::done_event(int result) +{ + low_color_thread->close_window(); + mid_color_thread->close_window(); + high_color_thread->close_window(); +} +