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()
62 add_tool(new BC_Title(x, y, _("Pattern offset:")));
64 add_tool(frame_offset = new IVTCOffset(client, x, y));
66 add_tool(first_field = new IVTCFieldOrder(client, x, y));
68 // add_tool(automatic = new IVTCAuto(client, x, y));
70 add_subwindow(new BC_Title(x, y, _("Pattern:")));
72 for(int i = 0; i < TOTAL_PATTERNS; i++)
74 add_subwindow(pattern[i] = new IVTCPattern(client,
83 if(client->config.pattern == IVTCConfig::AUTOMATIC)
85 frame_offset->disable();
86 first_field->disable();
89 // add_tool(new BC_Title(x, y, _("Field threshold:")));
91 // add_tool(threshold = new IVTCAutoThreshold(client, x, y));
98 IVTCOffset::IVTCOffset(IVTCMain *client, int x, int y)
103 client->config.frame_offset)
105 this->client = client;
107 IVTCOffset::~IVTCOffset()
110 int IVTCOffset::handle_event()
112 client->config.frame_offset = atol(get_text());
113 client->send_configure_change();
120 IVTCFieldOrder::IVTCFieldOrder(IVTCMain *client, int x, int y)
121 : BC_CheckBox(x, y, client->config.first_field, _("Odd field first"))
123 this->client = client;
125 IVTCFieldOrder::~IVTCFieldOrder()
128 int IVTCFieldOrder::handle_event()
130 client->config.first_field = get_value();
131 client->send_configure_change();
136 IVTCAuto::IVTCAuto(IVTCMain *client, int x, int y)
137 : BC_CheckBox(x, y, client->config.automatic, _("Automatic IVTC"))
139 this->client = client;
141 IVTCAuto::~IVTCAuto()
144 int IVTCAuto::handle_event()
146 client->config.automatic = get_value();
147 client->send_configure_change();
151 IVTCPattern::IVTCPattern(IVTCMain *client,
157 : BC_Radial(x, y, client->config.pattern == number, text)
159 this->window = window;
160 this->client = client;
161 this->number = number;
163 IVTCPattern::~IVTCPattern()
166 int IVTCPattern::handle_event()
168 client->config.pattern = number;
169 if(number == IVTCConfig::AUTOMATIC)
171 window->frame_offset->disable();
172 window->first_field->disable();
176 window->frame_offset->enable();
177 window->first_field->enable();
180 for(int i = 0; i < TOTAL_PATTERNS; i++)
182 if(i != number) window->pattern[i]->update(0);
185 client->send_configure_change();
191 IVTCAutoThreshold::IVTCAutoThreshold(IVTCMain *client, int x, int y)
192 : BC_TextBox(x, y, 190, 1, client->config.auto_threshold)
194 this->client = client;
196 IVTCAutoThreshold::~IVTCAutoThreshold()
199 int IVTCAutoThreshold::handle_event()
201 client->config.auto_threshold = atof(get_text());
202 client->send_configure_change();