From 104c13f9791f1c22888d8b9bd1a23983a9b35546 Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Sat, 6 Feb 2016 14:47:59 +0100 Subject: [PATCH] Add `MvSelectionCmd` --- src/Commands/MvSelectionCmd.cpp | 23 +++++++++++++++++++++++ src/Commands/MvSelectionCmd.h | 24 ++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 src/Commands/MvSelectionCmd.cpp create mode 100644 src/Commands/MvSelectionCmd.h diff --git a/src/Commands/MvSelectionCmd.cpp b/src/Commands/MvSelectionCmd.cpp new file mode 100644 index 0000000..c9624a1 --- /dev/null +++ b/src/Commands/MvSelectionCmd.cpp @@ -0,0 +1,23 @@ +#include "MvSelectionCmd.h" + +namespace ofx { +namespace piMapper { + +MvSelectionCmd::MvSelectionCmd(SurfaceManager * sm, ofVec2f moveBy){ + _surfaceManager = sm; + _movedBy = moveBy; +} + +void MvSelectionCmd::exec(){ + ofLogNotice("MvSelectionCmd", "exec"); + _surfaceManager->moveSelectionBy(_movedBy); +} + +void MvSelectionCmd::undo(){ + ofLogNotice("MvSelectionCmd", "undo"); + _surfaceManager->moveSelectionBy(-_movedBy); +} + +} // namespace piMapper +} // namespace ofx + diff --git a/src/Commands/MvSelectionCmd.h b/src/Commands/MvSelectionCmd.h new file mode 100644 index 0000000..8772d58 --- /dev/null +++ b/src/Commands/MvSelectionCmd.h @@ -0,0 +1,24 @@ +#pragma once + +#include "BaseCmd.h" +#include "SurfaceManager.h" + +namespace ofx { +namespace piMapper { + +class MvSelectionCmd : public BaseUndoCmd { + + public: + MvSelectionCmd(SurfaceManager * sm, ofVec2f moveBy); + void exec(); + void undo(); + + private: + SurfaceManager * _surfaceManager; + ofVec2f _movedBy; + +}; + +} // namespace piMapper +} // namespace ofx +