X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=blobdiff_plain;f=cinelerra-5.1%2Fplugins%2Frgbshift%2Frgbshift.C;h=f05cb3a0b28f01523c1818a78a8206c9508747d8;hp=d558687b106ad68c2b30e0929fc1d0252ba47f10;hb=c857b2fb7965d27d86d5785fb9f1b8957a871a1a;hpb=7fd85fb66168f6b518c5f2d73e04036e87faa0e1 diff --git a/cinelerra-5.1/plugins/rgbshift/rgbshift.C b/cinelerra-5.1/plugins/rgbshift/rgbshift.C index d558687b..f05cb3a0 100644 --- a/cinelerra-5.1/plugins/rgbshift/rgbshift.C +++ b/cinelerra-5.1/plugins/rgbshift/rgbshift.C @@ -19,76 +19,7 @@ * */ -#include "bcdisplayinfo.h" -#include "clip.h" -#include "bchash.h" -#include "filexml.h" -#include "guicast.h" -#include "language.h" -#include "bccolors.h" -#include "pluginvclient.h" -#include "vframe.h" - -#include -#include - - -class RGBShiftEffect; - - -class RGBShiftConfig -{ -public: - RGBShiftConfig(); - - void copy_from(RGBShiftConfig &src); - int equivalent(RGBShiftConfig &src); - void interpolate(RGBShiftConfig &prev, - RGBShiftConfig &next, - long prev_frame, - long next_frame, - long current_frame); - - int r_dx, r_dy, g_dx, g_dy, b_dx, b_dy; -}; - -class RGBShiftLevel : public BC_ISlider -{ -public: - RGBShiftLevel(RGBShiftEffect *plugin, int *output, int x, int y); - int handle_event(); - RGBShiftEffect *plugin; - int *output; -}; - -class RGBShiftWindow : public PluginClientWindow -{ -public: - RGBShiftWindow(RGBShiftEffect *plugin); - void create_objects(); - RGBShiftLevel *r_dx, *r_dy, *g_dx, *g_dy, *b_dx, *b_dy; - RGBShiftEffect *plugin; -}; - - - -class RGBShiftEffect : public PluginVClient -{ - VFrame *temp_frame; -public: - RGBShiftEffect(PluginServer *server); - ~RGBShiftEffect(); - - - PLUGIN_CLASS_MEMBERS(RGBShiftConfig) - int process_realtime(VFrame *input, VFrame *output); - int is_realtime(); - void save_data(KeyFrame *keyframe); - void read_data(KeyFrame *keyframe); - void update_gui(); -}; - - +#include "rgbshift.h" @@ -99,12 +30,33 @@ REGISTER_PLUGIN(RGBShiftEffect) - RGBShiftConfig::RGBShiftConfig() { - r_dx = r_dy = 0; - g_dx = g_dy = 0; - b_dx = b_dy = 0; + reset(RESET_ALL); +} + +void RGBShiftConfig::reset(int clear) +{ + switch(clear) { + case RESET_R_DX : r_dx = 0; + break; + case RESET_R_DY : r_dy = 0; + break; + case RESET_G_DX : g_dx = 0; + break; + case RESET_G_DY : g_dy = 0; + break; + case RESET_B_DX : b_dx = 0; + break; + case RESET_B_DY : b_dy = 0; + break; + case RESET_ALL : + default: + r_dx = r_dy = 0; + g_dx = g_dy = 0; + b_dx = b_dy = 0; + break; + } } void RGBShiftConfig::copy_from(RGBShiftConfig &src) @@ -159,8 +111,48 @@ int RGBShiftLevel::handle_event() } +RGBShiftReset::RGBShiftReset(RGBShiftEffect *plugin, RGBShiftWindow *window, int x, int y) + : BC_GenericButton(x, y, _("Reset")) +{ + this->plugin = plugin; + this->window = window; +} +RGBShiftReset::~RGBShiftReset() +{ +} +int RGBShiftReset::handle_event() +{ + plugin->config.reset(RESET_ALL); + window->update_gui(RESET_ALL); + plugin->send_configure_change(); + return 1; +} + + +RGBShiftSliderClr::RGBShiftSliderClr(RGBShiftEffect *plugin, RGBShiftWindow *window, int x, int y, int w, int clear) + : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button")) +{ + this->plugin = plugin; + this->window = window; + this->clear = clear; +} +RGBShiftSliderClr::~RGBShiftSliderClr() +{ +} +int RGBShiftSliderClr::handle_event() +{ + // clear==1 ==> r_dx slider --- clear==2 ==> r_dy slider + // clear==3 ==> g_dx slider --- clear==4 ==> g_dy slider + // clear==5 ==> b_dx slider --- clear==6 ==> b_dy slider + plugin->config.reset(clear); + window->update_gui(clear); + plugin->send_configure_change(); + return 1; +} + + RGBShiftWindow::RGBShiftWindow(RGBShiftEffect *plugin) - : PluginClientWindow(plugin, 300, 200, 300, 200, 0) + : PluginClientWindow(plugin, 320, 230, 320, 230, 0) { this->plugin = plugin; } @@ -168,30 +160,73 @@ RGBShiftWindow::RGBShiftWindow(RGBShiftEffect *plugin) void RGBShiftWindow::create_objects() { int x = 10, y = 10, x1 = 50; + int x2 = 0; int clrBtn_w = 50; + add_subwindow(new BC_Title(x, y, _("R_dx:"))); add_subwindow(r_dx = new RGBShiftLevel(plugin, &plugin->config.r_dx, x1, y)); + x2 = x1 + r_dx->get_w() + 10; + add_subwindow(r_dxClr = new RGBShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_R_DX)); + y += 30; add_subwindow(new BC_Title(x, y, _("R_dy:"))); add_subwindow(r_dy = new RGBShiftLevel(plugin, &plugin->config.r_dy, x1, y)); + add_subwindow(r_dyClr = new RGBShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_R_DY)); + y += 30; add_subwindow(new BC_Title(x, y, _("G_dx:"))); add_subwindow(g_dx = new RGBShiftLevel(plugin, &plugin->config.g_dx, x1, y)); + add_subwindow(g_dxClr = new RGBShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_G_DX)); + y += 30; add_subwindow(new BC_Title(x, y, _("G_dy:"))); add_subwindow(g_dy = new RGBShiftLevel(plugin, &plugin->config.g_dy, x1, y)); + add_subwindow(g_dyClr = new RGBShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_G_DY)); + y += 30; add_subwindow(new BC_Title(x, y, _("B_dx:"))); add_subwindow(b_dx = new RGBShiftLevel(plugin, &plugin->config.b_dx, x1, y)); + add_subwindow(b_dxClr = new RGBShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_B_DX)); + y += 30; add_subwindow(new BC_Title(x, y, _("B_dy:"))); add_subwindow(b_dy = new RGBShiftLevel(plugin, &plugin->config.b_dy, x1, y)); + add_subwindow(b_dyClr = new RGBShiftSliderClr(plugin, this, x2, y, clrBtn_w, RESET_B_DY)); + + y += 40; + add_subwindow(reset = new RGBShiftReset(plugin, this, x, y)); show_window(); flush(); } - +// for Reset button +void RGBShiftWindow::update_gui(int clear) +{ + switch(clear) { + case RESET_R_DX : r_dx->update(plugin->config.r_dx); + break; + case RESET_R_DY : r_dy->update(plugin->config.r_dy); + break; + case RESET_G_DX : g_dx->update(plugin->config.g_dx); + break; + case RESET_G_DY : g_dy->update(plugin->config.g_dy); + break; + case RESET_B_DX : b_dx->update(plugin->config.b_dx); + break; + case RESET_B_DY : b_dy->update(plugin->config.b_dy); + break; + case RESET_ALL : + default: + r_dx->update(plugin->config.r_dx); + r_dy->update(plugin->config.r_dy); + g_dx->update(plugin->config.g_dx); + g_dy->update(plugin->config.g_dy); + b_dx->update(plugin->config.b_dx); + b_dy->update(plugin->config.b_dy); + break; + } +}