+ gui->toggle_event();
+ gui->update_toggles();
+ gui->create_panels();
+ gui->update_scope();
+ gui->show_window();
+ return 1;
+}
+
+ScopeMenu::ScopeMenu(ScopeGUI *gui, int x, int y)
+ : BC_PopupMenu(x, y, xS(100), _("Scopes"))
+{
+ this->gui = gui;
+}
+
+void ScopeMenu::create_objects()
+{
+ add_item(hist_on =
+ new ScopeScopesOn(this, _("Histogram"), SCOPE_HISTOGRAM));
+ add_item(hist_rgb_on =
+ new ScopeScopesOn(this, _("Histogram RGB"), SCOPE_HISTOGRAM_RGB));
+ add_item(new BC_MenuItem("-"));
+ add_item(wave_on =
+ new ScopeScopesOn(this, _("Waveform"), SCOPE_WAVEFORM));
+ add_item(wave_rgb_on =
+ new ScopeScopesOn(this, _("Waveform RGB"), SCOPE_WAVEFORM_RGB));
+ add_item(wave_ply_on =
+ new ScopeScopesOn(this, _("Waveform ply"), SCOPE_WAVEFORM_PLY));
+ add_item(new BC_MenuItem("-"));
+ add_item(vect_on =
+ new ScopeScopesOn(this, _("Vectorscope"), SCOPE_VECTORSCOPE));
+}
+
+void ScopeMenu::update_toggles()
+{
+ hist_on->set_checked(gui->use_hist);
+ hist_rgb_on->set_checked(gui->use_hist_parade);
+ wave_on->set_checked(gui->use_wave);
+ wave_rgb_on->set_checked(gui->use_wave_parade>0);
+ wave_ply_on->set_checked(gui->use_wave_parade<0);
+ vect_on->set_checked(gui->use_vector);
+}
+
+ScopeWaveSlider::ScopeWaveSlider(ScopeGUI *gui, int x, int y, int w)
+ : BC_ISlider(x, y, 0, w, w, 1, 9, gui->use_wave_gain)
+{
+ this->gui = gui;
+}
+int ScopeWaveSlider::handle_event()
+{
+ gui->use_wave_gain = get_value();
+ gui->update_scope();
+ gui->toggle_event();
+ return 1;
+}
+
+ScopeVectSlider::ScopeVectSlider(ScopeGUI *gui, int x, int y, int w)
+ : BC_ISlider(x, y, 0, w, w, 1, 9, gui->use_vect_gain)
+{
+ this->gui = gui;
+}
+int ScopeVectSlider::handle_event()
+{
+ gui->use_vect_gain = get_value();
+ gui->update_scope();
+ gui->toggle_event();
+ return 1;
+}
+
+ScopeSmooth::ScopeSmooth(ScopeGUI *gui, int x, int y)
+ : BC_CheckBox(x, y, gui->use_smooth, _("Smooth"))
+{
+ this->gui = gui;
+}
+
+int ScopeSmooth::handle_event()
+{
+ gui->use_smooth = get_value();
+ gui->update_scope();
+ gui->toggle_event();
+ return 1;
+}
+
+// from ffmpeg vf_boxblur
+template<class dst_t, class src_t> static inline
+void blurt(dst_t *dst, int dst_step, src_t *src, int src_step, int len, int radius)
+{
+ const int length = radius*2 + 1;
+ const int inv = ((1<<16) + length/2)/length;
+ int x, n, sum = src[radius*src_step];
+
+ for( x=0; x<radius; ++x )
+ sum += src[x*src_step]<<1;
+ sum = sum*inv + (1<<15);
+
+ for( x=0; x<=radius; ++x ) {
+ sum += (src[(radius+x)*src_step] - src[(radius-x)*src_step])*inv;
+ dst[x*dst_step] = sum>>16;