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 +