Fixed initialisation of tf in file_open(). Without setting the memory to 0,
[cinelerra_cv/mob.git] / plugins / timeavg / timeavgwindow.C
blob8bcb889084db2dce2ab03ed2da38187382d29092
1 #include "bcdisplayinfo.h"
2 #include "language.h"
3 #include "timeavgwindow.h"
5 PLUGIN_THREAD_OBJECT(TimeAvgMain, TimeAvgThread, TimeAvgWindow)
8 #define MAX_FRAMES 1024
11 TimeAvgWindow::TimeAvgWindow(TimeAvgMain *client, int x, int y)
12  : BC_Window(client->gui_string, 
13         x, 
14         y, 
15         210, 
16         210, 
17         200, 
18         210, 
19         0, 
20         0,
21         1)
22
23         this->client = client; 
26 TimeAvgWindow::~TimeAvgWindow()
30 int TimeAvgWindow::create_objects()
32         int x = 10, y = 10;
33         add_tool(new BC_Title(x, y, _("Frames to average")));
34         y += 20;
35         add_tool(total_frames = new TimeAvgSlider(client, x, y));
36         y += 30;
37         add_tool(accum = new TimeAvgAccum(client, this, x, y));
38         y += 30;
39         add_tool(avg = new TimeAvgAvg(client, this, x, y));
40         y += 30;
41         add_tool(inclusive_or = new TimeAvgOr(client, this, x, y));
42         y += 30;
43         add_tool(paranoid = new TimeAvgParanoid(client, x, y));
44         y += 30;
45         add_tool(no_subtract = new TimeAvgNoSubtract(client, x, y));
46         show_window();
47         flush();
48         return 0;
51 WINDOW_CLOSE_EVENT(TimeAvgWindow)
53 TimeAvgSlider::TimeAvgSlider(TimeAvgMain *client, int x, int y)
54  : BC_ISlider(x, 
55         y, 
56         0,
57         190, 
58         200, 
59         1, 
60         MAX_FRAMES, 
61         client->config.frames)
63         this->client = client;
65 TimeAvgSlider::~TimeAvgSlider()
68 int TimeAvgSlider::handle_event()
70         int result = get_value();
71         if(result < 1) result = 1;
72         client->config.frames = result;
73         client->send_configure_change();
74         return 1;
89 TimeAvgAccum::TimeAvgAccum(TimeAvgMain *client, TimeAvgWindow *gui, int x, int y)
90  : BC_Radial(x, 
91         y, 
92         client->config.mode == TimeAvgConfig::ACCUMULATE,
93         _("Accumulate"))
95         this->client = client;
96         this->gui = gui;
98 int TimeAvgAccum::handle_event()
100         int result = get_value();
101         client->config.mode = TimeAvgConfig::ACCUMULATE;
102         gui->avg->update(0);
103         gui->inclusive_or->update(0);
104         client->send_configure_change();
105         return 1;
112 TimeAvgAvg::TimeAvgAvg(TimeAvgMain *client, TimeAvgWindow *gui, int x, int y)
113  : BC_Radial(x, 
114         y, 
115         client->config.mode == TimeAvgConfig::AVERAGE,
116         _("Average"))
118         this->client = client;
119         this->gui = gui;
121 int TimeAvgAvg::handle_event()
123         int result = get_value();
124         client->config.mode = TimeAvgConfig::AVERAGE;
125         gui->accum->update(0);
126         gui->inclusive_or->update(0);
127         client->send_configure_change();
128         return 1;
133 TimeAvgOr::TimeAvgOr(TimeAvgMain *client, TimeAvgWindow *gui, int x, int y)
134  : BC_Radial(x, 
135         y, 
136         client->config.mode == TimeAvgConfig::OR,
137         _("Inclusive Or"))
139         this->client = client;
140         this->gui = gui;
142 int TimeAvgOr::handle_event()
144         int result = get_value();
145         client->config.mode = TimeAvgConfig::OR;
146         gui->accum->update(0);
147         gui->avg->update(0);
148         client->send_configure_change();
149         return 1;
154 TimeAvgParanoid::TimeAvgParanoid(TimeAvgMain *client, int x, int y)
155  : BC_CheckBox(x, 
156         y, 
157         client->config.paranoid,
158         _("Reprocess frame again"))
160         this->client = client;
162 int TimeAvgParanoid::handle_event()
164         int result = get_value();
165         client->config.paranoid = result;
166         client->send_configure_change();
167         return 1;
174 TimeAvgNoSubtract::TimeAvgNoSubtract(TimeAvgMain *client, int x, int y)
175  : BC_CheckBox(x, 
176         y, 
177         client->config.nosubtract,
178         _("Disable subtraction"))
180         this->client = client;
182 int TimeAvgNoSubtract::handle_event()
184         int result = get_value();
185         client->config.nosubtract = result;
186         client->send_configure_change();
187         return 1;