sams last ladspa icons, libopus/vp9, mixer fixer, plugin resets, fmt frmsz, shm fixes
[goodguy/history.git] / cinelerra-5.1 / plugins / chromakeyhsv / chromakey.C
index 5558606b34953619fba1bb568ff7dd13bd24814c..b0a09757891033a0f96476aedc2b26accc8ff602 100644 (file)
 
 
 ChromaKeyConfig::ChromaKeyConfig ()
+{
+       reset();
+}
+
+void ChromaKeyConfig::reset()
+
 {
   red = 0.0;
   green = 1.0;
@@ -187,6 +193,8 @@ ChromaKeyWindow::create_objects ()
   add_subwindow (use_colorpicker =
                 new ChromaKeyUseColorPicker (plugin, this, x, y));
   y += use_colorpicker->get_h() + 10;
+
+  add_subwindow (new ChromaKeyReset (plugin, this, x2+240, y));
   add_subwindow (show_mask = new ChromaKeyShowMask (plugin, x2, y));
        y += show_mask->get_h() + 5;
 
@@ -465,6 +473,21 @@ ChromaKeyShowMask::handle_event ()
   return 1;
 }
 
+ChromaKeyReset::ChromaKeyReset (ChromaKeyHSV *plugin, ChromaKeyWindow *gui, int x, int y)
+ :BC_GenericButton(x, y, _("Reset"))
+{
+  this->plugin = plugin;
+  this->gui = gui;
+}
+
+int ChromaKeyReset::handle_event ()
+{
+  plugin->config.reset();
+  gui->update_gui();
+  plugin->send_configure_change();
+  return 1;
+}
+
 ChromaKeyUseColorPicker::ChromaKeyUseColorPicker (ChromaKeyHSV * plugin, ChromaKeyWindow * gui, int x, int y)
  : BC_GenericButton (x, y,
                  _
@@ -1003,22 +1026,27 @@ void ChromaKeyHSV::update_gui()
                load_configuration();
                ChromaKeyWindow *window = (ChromaKeyWindow*)thread->window;
                window->lock_window();
-               window->min_brightness->update(config.min_brightness);
-               window->max_brightness->update(config.max_brightness);
-               window->saturation->update(config.saturation);
-               window->min_saturation->update(config.min_saturation);
-               window->tolerance->update(config.tolerance);
-               window->in_slope->update(config.in_slope);
-               window->out_slope->update(config.out_slope);
-               window->alpha_offset->update(config.alpha_offset);
-               window->spill_threshold->update(config.spill_threshold);
-               window->spill_amount->update(config.spill_amount);
-               window->show_mask->update(config.show_mask);
-               window->update_sample();
+               window->update_gui();
                window->unlock_window();
        }
 }
 
+void ChromaKeyWindow::update_gui()
+{
+       ChromaKeyConfig &config = plugin->config;
+       min_brightness->update(config.min_brightness);
+       max_brightness->update(config.max_brightness);
+       saturation->update(config.saturation);
+       min_saturation->update(config.min_saturation);
+       tolerance->update(config.tolerance);
+       in_slope->update(config.in_slope);
+       out_slope->update(config.out_slope);
+       alpha_offset->update(config.alpha_offset);
+       spill_threshold->update(config.spill_threshold);
+       spill_amount->update(config.spill_amount);
+       show_mask->update(config.show_mask);
+       update_sample();
+}