00001 #include "bcdisplayinfo.h"
00002 #include "ivtcwindow.h"
00003 #include "language.h"
00004
00005
00006 static char *pattern_text[] =
00007 {
00008 "A B BC CD D",
00009 "AB BC CD DE EF",
00010 "Automatic",
00011 N_("A B BC CD D"),
00012 N_("AB BC CD DE EF"),
00013 N_("Automatic")
00014 };
00015
00016
00017 PLUGIN_THREAD_OBJECT(IVTCMain, IVTCThread, IVTCWindow)
00018
00019
00020
00021
00022
00023
00024 IVTCWindow::IVTCWindow(IVTCMain *client, int x, int y)
00025 : BC_Window(client->gui_string,
00026 x,
00027 y,
00028 210,
00029 230,
00030 210,
00031 230,
00032 0,
00033 0,
00034 1)
00035 {
00036 this->client = client;
00037 }
00038
00039 IVTCWindow::~IVTCWindow()
00040 {
00041 }
00042
00043 int IVTCWindow::create_objects()
00044 {
00045 int x = 10, y = 10;
00046
00047 add_tool(new BC_Title(x, y, _("Pattern offset:")));
00048 y += 20;
00049 add_tool(frame_offset = new IVTCOffset(client, x, y));
00050 y += 30;
00051 add_tool(first_field = new IVTCFieldOrder(client, x, y));
00052
00053
00054 y += 40;
00055 add_subwindow(new BC_Title(x, y, _("Pattern:")));
00056 y += 20;
00057 for(int i = 0; i < TOTAL_PATTERNS; i++)
00058 {
00059 add_subwindow(pattern[i] = new IVTCPattern(client,
00060 this,
00061 i,
00062 _(pattern_text[i]),
00063 x,
00064 y));
00065 y += 20;
00066 }
00067
00068 if(client->config.pattern == IVTCConfig::AUTOMATIC)
00069 {
00070 frame_offset->disable();
00071 first_field->disable();
00072 }
00073
00074
00075
00076
00077 show_window();
00078 flush();
00079 return 0;
00080 }
00081
00082 WINDOW_CLOSE_EVENT(IVTCWindow)
00083
00084 IVTCOffset::IVTCOffset(IVTCMain *client, int x, int y)
00085 : BC_TextBox(x,
00086 y,
00087 190,
00088 1,
00089 client->config.frame_offset)
00090 {
00091 this->client = client;
00092 }
00093 IVTCOffset::~IVTCOffset()
00094 {
00095 }
00096 int IVTCOffset::handle_event()
00097 {
00098 client->config.frame_offset = atol(get_text());
00099 client->send_configure_change();
00100 return 1;
00101 }
00102
00103
00104
00105
00106 IVTCFieldOrder::IVTCFieldOrder(IVTCMain *client, int x, int y)
00107 : BC_CheckBox(x, y, client->config.first_field, _("Odd field first"))
00108 {
00109 this->client = client;
00110 }
00111 IVTCFieldOrder::~IVTCFieldOrder()
00112 {
00113 }
00114 int IVTCFieldOrder::handle_event()
00115 {
00116 client->config.first_field = get_value();
00117 client->send_configure_change();
00118 return 1;
00119 }
00120
00121
00122 IVTCAuto::IVTCAuto(IVTCMain *client, int x, int y)
00123 : BC_CheckBox(x, y, client->config.automatic, _("Automatic IVTC"))
00124 {
00125 this->client = client;
00126 }
00127 IVTCAuto::~IVTCAuto()
00128 {
00129 }
00130 int IVTCAuto::handle_event()
00131 {
00132 client->config.automatic = get_value();
00133 client->send_configure_change();
00134 return 1;
00135 }
00136
00137 IVTCPattern::IVTCPattern(IVTCMain *client,
00138 IVTCWindow *window,
00139 int number,
00140 char *text,
00141 int x,
00142 int y)
00143 : BC_Radial(x, y, client->config.pattern == number, text)
00144 {
00145 this->window = window;
00146 this->client = client;
00147 this->number = number;
00148 }
00149 IVTCPattern::~IVTCPattern()
00150 {
00151 }
00152 int IVTCPattern::handle_event()
00153 {
00154 client->config.pattern = number;
00155 if(number == IVTCConfig::AUTOMATIC)
00156 {
00157 window->frame_offset->disable();
00158 window->first_field->disable();
00159 }
00160 else
00161 {
00162 window->frame_offset->enable();
00163 window->first_field->enable();
00164 }
00165
00166 for(int i = 0; i < TOTAL_PATTERNS; i++)
00167 {
00168 if(i != number) window->pattern[i]->update(0);
00169 }
00170 update(1);
00171 client->send_configure_change();
00172 return 1;
00173 }
00174
00175
00176
00177 IVTCAutoThreshold::IVTCAutoThreshold(IVTCMain *client, int x, int y)
00178 : BC_TextBox(x, y, 190, 1, client->config.auto_threshold)
00179 {
00180 this->client = client;
00181 }
00182 IVTCAutoThreshold::~IVTCAutoThreshold()
00183 {
00184 }
00185 int IVTCAutoThreshold::handle_event()
00186 {
00187 client->config.auto_threshold = atof(get_text());
00188 client->send_configure_change();
00189 return 1;
00190 }
00191