From c67e4e73fbeac1c27922d2f96a9073aa8a29526a Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Fri, 10 Jun 2016 16:47:56 +0200 Subject: [PATCH] Add `ToggleAnimatedSourceCmd` for toggling video source pause --- src/Commands/ToggleAnimatedSourceCmd.cpp | 22 ++++++++++++++++++ src/Commands/ToggleAnimatedSourceCmd.h | 29 ++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 src/Commands/ToggleAnimatedSourceCmd.cpp create mode 100644 src/Commands/ToggleAnimatedSourceCmd.h diff --git a/src/Commands/ToggleAnimatedSourceCmd.cpp b/src/Commands/ToggleAnimatedSourceCmd.cpp new file mode 100644 index 0000000..b096a3e --- /dev/null +++ b/src/Commands/ToggleAnimatedSourceCmd.cpp @@ -0,0 +1,22 @@ +#include "ToggleAnimatedSourceCmd.h" + +namespace ofx { +namespace piMapper { + +ToggleAnimatedSourceCmd::ToggleAnimatedSourceCmd(BaseSurface * surface){ + _surface = surface; +} + +void ToggleAnimatedSourceCmd::exec(){ + ofLogNotice("ToggleAnimatedSourceCmd", "exec"); + _surface->getSource()->togglePause(); +} + +void ToggleAnimatedSourceCmd::undo(){ + ofLogNotice("ToggleAnimatedSourceCmd", "undo"); + _surface->getSource()->togglePause(); +} + +} // namespace piMapper +} // namespace ofx + diff --git a/src/Commands/ToggleAnimatedSourceCmd.h b/src/Commands/ToggleAnimatedSourceCmd.h new file mode 100644 index 0000000..09d35e9 --- /dev/null +++ b/src/Commands/ToggleAnimatedSourceCmd.h @@ -0,0 +1,29 @@ +// ToggleAnimatedSourceCmd +// Toggles playing of animated (video, gif) sources +// Created by Krisjanis Rijnieks 2016-06-10 + +#pragma once + +#include "BaseCmd.h" +#include "BaseSurface.h" +#include "SourceType.h" +#include "VideoSource.h" + +namespace ofx { +namespace piMapper { + +class ToggleAnimatedSourceCmd : public BaseUndoCmd { + + public: + ToggleAnimatedSourceCmd(BaseSurface * surface); + void exec(); + void undo(); + + private: + BaseSurface * _surface; + +}; + +} // namespace piMapper +} // namespace ofx +