4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "bcdisplayinfo.h"
23 #include "brightnesswindow.h"
34 BrightnessWindow::BrightnessWindow(BrightnessMain *client)
35 : PluginClientWindow(client,
42 this->client = client;
45 BrightnessWindow::~BrightnessWindow()
49 void BrightnessWindow::create_objects()
52 add_tool(new BC_Title(x, y, _("Brightness/Contrast")));
54 add_tool(new BC_Title(x, y,_("Brightness:")));
55 add_tool(brightness = new BrightnessSlider(client,
56 &(client->config.brightness),
61 add_tool(new BC_Title(x, y, _("Contrast:")));
62 add_tool(contrast = new BrightnessSlider(client,
63 &(client->config.contrast),
68 add_tool(luma = new BrightnessLuma(client,
76 BrightnessSlider::BrightnessSlider(BrightnessMain *client,
90 this->client = client;
91 this->output = output;
92 this->is_brightness = is_brightness;
94 BrightnessSlider::~BrightnessSlider()
97 int BrightnessSlider::handle_event()
99 *output = get_value();
100 client->send_configure_change();
104 char* BrightnessSlider::get_caption()
109 fraction = *output / 100;
113 fraction = (*output < 0) ?
114 (*output + 100) / 100 :
117 sprintf(string, "%0.4f", fraction);
122 BrightnessLuma::BrightnessLuma(BrightnessMain *client,
128 _("Boost luminance only"))
130 this->client = client;
132 BrightnessLuma::~BrightnessLuma()
135 int BrightnessLuma::handle_event()
137 client->config.luma = get_value();
138 client->send_configure_change();