X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fplugins%2Fshiftinterlace%2Fshiftinterlace.C;h=c7b4e0ba7c94e099871320b8b4b73483402e4f7f;hb=1529091cdf16df199a901aabe6e8fa1813a933af;hp=e4cf3c4af49df0774ac34d0ac99efbecfa7031e7;hpb=7fd85fb66168f6b518c5f2d73e04036e87faa0e1;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/plugins/shiftinterlace/shiftinterlace.C b/cinelerra-5.1/plugins/shiftinterlace/shiftinterlace.C index e4cf3c4a..c7b4e0ba 100644 --- a/cinelerra-5.1/plugins/shiftinterlace/shiftinterlace.C +++ b/cinelerra-5.1/plugins/shiftinterlace/shiftinterlace.C @@ -19,105 +19,10 @@ * */ -#include "bcdisplayinfo.h" -#include "clip.h" -#include "bchash.h" -#include "filexml.h" -#include "guicast.h" -#include "language.h" -#include "pluginvclient.h" -#include "vframe.h" +#include "shiftinterlace.h" -#include -#include - - - - - - - -class ShiftInterlaceWindow; -class ShiftInterlaceMain; - -class ShiftInterlaceConfig -{ -public: - ShiftInterlaceConfig(); - - int equivalent(ShiftInterlaceConfig &that); - void copy_from(ShiftInterlaceConfig &that); - void interpolate(ShiftInterlaceConfig &prev, - ShiftInterlaceConfig &next, - long prev_frame, - long next_frame, - long current_frame); - - - int odd_offset; - int even_offset; -}; - - -class ShiftInterlaceOdd : public BC_ISlider -{ -public: - ShiftInterlaceOdd(ShiftInterlaceMain *plugin, int x, int y); - int handle_event(); - ShiftInterlaceMain *plugin; -}; - -class ShiftInterlaceEven : public BC_ISlider -{ -public: - ShiftInterlaceEven(ShiftInterlaceMain *plugin, int x, int y); - int handle_event(); - ShiftInterlaceMain *plugin; -}; - -class ShiftInterlaceWindow : public PluginClientWindow -{ -public: - ShiftInterlaceWindow(ShiftInterlaceMain *plugin); - - void create_objects(); - - ShiftInterlaceOdd *odd_offset; - ShiftInterlaceEven *even_offset; - ShiftInterlaceMain *plugin; -}; - - - - - - -class ShiftInterlaceMain : public PluginVClient -{ -public: - ShiftInterlaceMain(PluginServer *server); - ~ShiftInterlaceMain(); - -// required for all realtime plugins - PLUGIN_CLASS_MEMBERS(ShiftInterlaceConfig) - int process_realtime(VFrame *input_ptr, VFrame *output_ptr); - int is_realtime(); - void update_gui(); - void save_data(KeyFrame *keyframe); - void read_data(KeyFrame *keyframe); - - - void shift_row(VFrame *input_frame, - VFrame *output_frame, - int offset, - int row); - - -}; - - PluginClient* new_plugin(PluginServer *server) @@ -130,8 +35,22 @@ PluginClient* new_plugin(PluginServer *server) ShiftInterlaceConfig::ShiftInterlaceConfig() { - odd_offset = 0; - even_offset = 0; + reset(RESET_ALL); +} + +void ShiftInterlaceConfig::reset(int clear) +{ + switch(clear) { + case RESET_ODD_OFFSET : odd_offset = 0; + break; + case RESET_EVEN_OFFSET : even_offset = 0; + break; + case RESET_ALL : + default: + odd_offset = 0; + even_offset = 0; + break; + } } @@ -167,10 +86,10 @@ void ShiftInterlaceConfig::interpolate(ShiftInterlaceConfig &prev, ShiftInterlaceWindow::ShiftInterlaceWindow(ShiftInterlaceMain *plugin) : PluginClientWindow(plugin, - 310, - 100, - 310, - 100, + xS(370), + yS(110), + xS(370), + yS(110), 0) { this->plugin = plugin; @@ -179,27 +98,52 @@ ShiftInterlaceWindow::ShiftInterlaceWindow(ShiftInterlaceMain *plugin) void ShiftInterlaceWindow::create_objects() { - int x = 10, y = 10; - int margin = 30; + int xs10 = xS(10), xs30 = xS(30), xs50 = xS(50), xs90 = xS(90); + int ys10 = yS(10), ys40 = yS(40); + int x = xs10, y = ys10; + int margin = xs30; + int x1 = 0; int clrBtn_w = xs50; add_subwindow(new BC_Title(x, y, _("Odd offset:"))); - add_subwindow(odd_offset = new ShiftInterlaceOdd(plugin, x + 90, y)); + add_subwindow(odd_offset = new ShiftInterlaceOdd(plugin, x + xs90, y)); + x1 = x + xs90 + odd_offset->get_w() + xs10; + add_subwindow(odd_offsetClr = new ShiftInterlaceSliderClr(plugin, this, x1, y, clrBtn_w, RESET_ODD_OFFSET)); + y += margin; add_subwindow(new BC_Title(x, y, _("Even offset:"))); - add_subwindow(even_offset = new ShiftInterlaceEven(plugin, x + 90, y)); + add_subwindow(even_offset = new ShiftInterlaceEven(plugin, x + xs90, y)); + add_subwindow(even_offsetClr = new ShiftInterlaceSliderClr(plugin, this, x1, y, clrBtn_w, RESET_EVEN_OFFSET)); + y += ys40; + add_subwindow(reset = new ShiftInterlaceReset(plugin, this, x, y)); show_window(); flush(); } +// for Reset button +void ShiftInterlaceWindow::update_gui(int clear) +{ + switch(clear) { + case RESET_ODD_OFFSET : odd_offset->update(plugin->config.odd_offset); + break; + case RESET_EVEN_OFFSET : even_offset->update(plugin->config.even_offset); + break; + case RESET_ALL : + default: + odd_offset->update(plugin->config.odd_offset); + even_offset->update(plugin->config.even_offset); + break; + } +} + ShiftInterlaceOdd::ShiftInterlaceOdd(ShiftInterlaceMain *plugin, int x, int y) : BC_ISlider(x, y, 0, - 200, - 200, + xS(200), + yS(200), -100, 100, plugin->config.odd_offset) @@ -220,8 +164,8 @@ ShiftInterlaceEven::ShiftInterlaceEven(ShiftInterlaceMain *plugin, int x, int y) : BC_ISlider(x, y, 0, - 200, - 200, + xS(200), + yS(200), -100, 100, plugin->config.even_offset) @@ -240,6 +184,45 @@ int ShiftInterlaceEven::handle_event() +ShiftInterlaceReset::ShiftInterlaceReset(ShiftInterlaceMain *plugin, ShiftInterlaceWindow *gui, int x, int y) + : BC_GenericButton(x, y, _("Reset")) +{ + this->plugin = plugin; + this->gui = gui; +} +ShiftInterlaceReset::~ShiftInterlaceReset() +{ +} +int ShiftInterlaceReset::handle_event() +{ + plugin->config.reset(RESET_ALL); + gui->update_gui(RESET_ALL); + plugin->send_configure_change(); + return 1; +} + + +ShiftInterlaceSliderClr::ShiftInterlaceSliderClr(ShiftInterlaceMain *plugin, ShiftInterlaceWindow *gui, 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->gui = gui; + this->clear = clear; +} +ShiftInterlaceSliderClr::~ShiftInterlaceSliderClr() +{ +} +int ShiftInterlaceSliderClr::handle_event() +{ + // clear==1 ==> Odd slider + // clear==2 ==> Even slider + plugin->config.reset(clear); + gui->update_gui(clear); + plugin->send_configure_change(); + return 1; +} + +