From ce3db3247e8e1ed73f655214ee478b1a1a58444d Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Sun, 7 Feb 2016 13:29:36 +0100 Subject: [PATCH] Add `SelVertexCmd` files --- src/Commands/SelVertexCmd.cpp | 23 +++++++++++++++++++++++ src/Commands/SelVertexCmd.h | 27 +++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 src/Commands/SelVertexCmd.cpp create mode 100644 src/Commands/SelVertexCmd.h diff --git a/src/Commands/SelVertexCmd.cpp b/src/Commands/SelVertexCmd.cpp new file mode 100644 index 0000000..d5d2b11 --- /dev/null +++ b/src/Commands/SelVertexCmd.cpp @@ -0,0 +1,23 @@ +#include "SelVertexCmd.h" + +namespace ofx { +namespace piMapper { + +SelVertexCmd::SelVertexCmd(SurfaceManager * sm, int i){ + _surfaceManager = sm; + _newVertexIndex = i; +} + +void SelVertexCmd::exec(){ + _prevVertexIndex = _surfaceManager->getSelectedVertexIndex(); + _surfaceManager->selectVertex(_newVertexIndex); +} + +void SelVertexCmd::undo(){ + ofLogNotice("SelVertexCmd", "undo"); + _surfaceManager->selectVertex(_prevVertexIndex); +} + +} // namespace piMapper +} // namespace ofx + diff --git a/src/Commands/SelVertexCmd.h b/src/Commands/SelVertexCmd.h new file mode 100644 index 0000000..1c6acd3 --- /dev/null +++ b/src/Commands/SelVertexCmd.h @@ -0,0 +1,27 @@ +#pragma once + +#include "BaseCmd.h" +#include "SurfaceManager.h" + +class ofxPiMapper; + +namespace ofx { +namespace piMapper { + +class SelVertexCmd : public BaseUndoCmd { + + public: + SelVertexCmd(SurfaceManager * sm, int i); + void exec(); + void undo(); + + private: + SurfaceManager * _surfaceManager; + int _newVertexIndex; + int _prevVertexIndex; + +}; + +} // namespace piMapper +} // namespace ofx +