00001 #include "bcdisplayinfo.h"
00002 #include "language.h"
00003 #include "timeavgwindow.h"
00004
00005 PLUGIN_THREAD_OBJECT(TimeAvgMain, TimeAvgThread, TimeAvgWindow)
00006
00007
00008 #define MAX_FRAMES 1024
00009
00010
00011 TimeAvgWindow::TimeAvgWindow(TimeAvgMain *client, int x, int y)
00012 : BC_Window(client->gui_string,
00013 x,
00014 y,
00015 210,
00016 210,
00017 200,
00018 210,
00019 0,
00020 0,
00021 1)
00022 {
00023 this->client = client;
00024 }
00025
00026 TimeAvgWindow::~TimeAvgWindow()
00027 {
00028 }
00029
00030 int TimeAvgWindow::create_objects()
00031 {
00032 int x = 10, y = 10;
00033 add_tool(new BC_Title(x, y, _("Frames to average")));
00034 y += 20;
00035 add_tool(total_frames = new TimeAvgSlider(client, x, y));
00036 y += 30;
00037 add_tool(accum = new TimeAvgAccum(client, this, x, y));
00038 y += 30;
00039 add_tool(avg = new TimeAvgAvg(client, this, x, y));
00040 y += 30;
00041 add_tool(inclusive_or = new TimeAvgOr(client, this, x, y));
00042 y += 30;
00043 add_tool(paranoid = new TimeAvgParanoid(client, x, y));
00044 y += 30;
00045 add_tool(no_subtract = new TimeAvgNoSubtract(client, x, y));
00046 show_window();
00047 flush();
00048 return 0;
00049 }
00050
00051 WINDOW_CLOSE_EVENT(TimeAvgWindow)
00052
00053 TimeAvgSlider::TimeAvgSlider(TimeAvgMain *client, int x, int y)
00054 : BC_ISlider(x,
00055 y,
00056 0,
00057 190,
00058 200,
00059 1,
00060 MAX_FRAMES,
00061 client->config.frames)
00062 {
00063 this->client = client;
00064 }
00065 TimeAvgSlider::~TimeAvgSlider()
00066 {
00067 }
00068 int TimeAvgSlider::handle_event()
00069 {
00070 int result = get_value();
00071 if(result < 1) result = 1;
00072 client->config.frames = result;
00073 client->send_configure_change();
00074 return 1;
00075 }
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089 TimeAvgAccum::TimeAvgAccum(TimeAvgMain *client, TimeAvgWindow *gui, int x, int y)
00090 : BC_Radial(x,
00091 y,
00092 client->config.mode == TimeAvgConfig::ACCUMULATE,
00093 _("Accumulate"))
00094 {
00095 this->client = client;
00096 this->gui = gui;
00097 }
00098 int TimeAvgAccum::handle_event()
00099 {
00100 int result = get_value();
00101 client->config.mode = TimeAvgConfig::ACCUMULATE;
00102 gui->avg->update(0);
00103 gui->inclusive_or->update(0);
00104 client->send_configure_change();
00105 return 1;
00106 }
00107
00108
00109
00110
00111
00112 TimeAvgAvg::TimeAvgAvg(TimeAvgMain *client, TimeAvgWindow *gui, int x, int y)
00113 : BC_Radial(x,
00114 y,
00115 client->config.mode == TimeAvgConfig::AVERAGE,
00116 _("Average"))
00117 {
00118 this->client = client;
00119 this->gui = gui;
00120 }
00121 int TimeAvgAvg::handle_event()
00122 {
00123 int result = get_value();
00124 client->config.mode = TimeAvgConfig::AVERAGE;
00125 gui->accum->update(0);
00126 gui->inclusive_or->update(0);
00127 client->send_configure_change();
00128 return 1;
00129 }
00130
00131
00132
00133 TimeAvgOr::TimeAvgOr(TimeAvgMain *client, TimeAvgWindow *gui, int x, int y)
00134 : BC_Radial(x,
00135 y,
00136 client->config.mode == TimeAvgConfig::OR,
00137 _("Inclusive Or"))
00138 {
00139 this->client = client;
00140 this->gui = gui;
00141 }
00142 int TimeAvgOr::handle_event()
00143 {
00144 int result = get_value();
00145 client->config.mode = TimeAvgConfig::OR;
00146 gui->accum->update(0);
00147 gui->avg->update(0);
00148 client->send_configure_change();
00149 return 1;
00150 }
00151
00152
00153
00154 TimeAvgParanoid::TimeAvgParanoid(TimeAvgMain *client, int x, int y)
00155 : BC_CheckBox(x,
00156 y,
00157 client->config.paranoid,
00158 _("Reprocess frame again"))
00159 {
00160 this->client = client;
00161 }
00162 int TimeAvgParanoid::handle_event()
00163 {
00164 int result = get_value();
00165 client->config.paranoid = result;
00166 client->send_configure_change();
00167 return 1;
00168 }
00169
00170
00171
00172
00173
00174 TimeAvgNoSubtract::TimeAvgNoSubtract(TimeAvgMain *client, int x, int y)
00175 : BC_CheckBox(x,
00176 y,
00177 client->config.nosubtract,
00178 _("Disable subtraction"))
00179 {
00180 this->client = client;
00181 }
00182 int TimeAvgNoSubtract::handle_event()
00183 {
00184 int result = get_value();
00185 client->config.nosubtract = result;
00186 client->send_configure_change();
00187 return 1;
00188 }
00189
00190
00191
00192
00193
00194
00195
00196