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 "ivtcwindow.h"
27 static const char *pattern_text[] =
43 IVTCWindow::IVTCWindow(IVTCMain *client)
44 : PluginClientWindow(client,
51 this->client = client;
54 IVTCWindow::~IVTCWindow()
58 void IVTCWindow::create_objects()
61 int ys10 = yS(10), ys20 = yS(20), ys30 = yS(30), ys40 = yS(40);
62 int x = xs10, y = ys10;
64 add_tool(new BC_Title(x, y, _("Pattern offset:")));
66 add_tool(frame_offset = new IVTCOffset(client, x, y));
68 add_tool(first_field = new IVTCFieldOrder(client, x, y));
70 // add_tool(automatic = new IVTCAuto(client, x, y));
72 add_subwindow(new BC_Title(x, y, _("Pattern:")));
74 for(int i = 0; i < TOTAL_PATTERNS; i++)
76 add_subwindow(pattern[i] = new IVTCPattern(client,
85 if(client->config.pattern == IVTCConfig::AUTOMATIC)
87 frame_offset->disable();
88 first_field->disable();
91 // add_tool(new BC_Title(x, y, _("Field threshold:")));
93 // add_tool(threshold = new IVTCAutoThreshold(client, x, y));
100 IVTCOffset::IVTCOffset(IVTCMain *client, int x, int y)
105 client->config.frame_offset)
107 this->client = client;
109 IVTCOffset::~IVTCOffset()
112 int IVTCOffset::handle_event()
114 client->config.frame_offset = atol(get_text());
115 client->send_configure_change();
122 IVTCFieldOrder::IVTCFieldOrder(IVTCMain *client, int x, int y)
123 : BC_CheckBox(x, y, client->config.first_field, _("Odd field first"))
125 this->client = client;
127 IVTCFieldOrder::~IVTCFieldOrder()
130 int IVTCFieldOrder::handle_event()
132 client->config.first_field = get_value();
133 client->send_configure_change();
138 IVTCAuto::IVTCAuto(IVTCMain *client, int x, int y)
139 : BC_CheckBox(x, y, client->config.automatic, _("Automatic IVTC"))
141 this->client = client;
143 IVTCAuto::~IVTCAuto()
146 int IVTCAuto::handle_event()
148 client->config.automatic = get_value();
149 client->send_configure_change();
153 IVTCPattern::IVTCPattern(IVTCMain *client,
159 : BC_Radial(x, y, client->config.pattern == number, text)
161 this->window = window;
162 this->client = client;
163 this->number = number;
165 IVTCPattern::~IVTCPattern()
168 int IVTCPattern::handle_event()
170 client->config.pattern = number;
171 if(number == IVTCConfig::AUTOMATIC)
173 window->frame_offset->disable();
174 window->first_field->disable();
178 window->frame_offset->enable();
179 window->first_field->enable();
182 for(int i = 0; i < TOTAL_PATTERNS; i++)
184 if(i != number) window->pattern[i]->update(0);
187 client->send_configure_change();
193 IVTCAutoThreshold::IVTCAutoThreshold(IVTCMain *client, int x, int y)
194 : BC_TextBox(x, y, xS(190), 1, client->config.auto_threshold)
196 this->client = client;
198 IVTCAutoThreshold::~IVTCAutoThreshold()
201 int IVTCAutoThreshold::handle_event()
203 client->config.auto_threshold = atof(get_text());
204 client->send_configure_change();