diff --git a/src/Commands/SelNextSurfaceCmd.cpp b/src/Commands/SelNextSurfaceCmd.cpp new file mode 100644 index 0000000..bc18cb5 --- /dev/null +++ b/src/Commands/SelNextSurfaceCmd.cpp @@ -0,0 +1,23 @@ +#include "SelNextSurfaceCmd.h" + +namespace ofx { +namespace piMapper { + +SelNextSurfaceCmd::SelNextSurfaceCmd(SurfaceManager * surfaceManager){ + _surfaceManager = surfaceManager; +} + +void SelNextSurfaceCmd::exec(){ + _prevSelectedSurface = _surfaceManager->getSelectedSurface(); + _surfaceManager->selectNextSurface(); +} + +void SelNextSurfaceCmd::undo(){ + ofLogNotice("SelNextSurfaceCmd", "undo"); + _surfaceManager->selectSurface(_prevSelectedSurface); + _prevSelectedSurface = 0; +} + +} // namespace piMapper +} // namespace ofx + diff --git a/src/Commands/SelNextSurfaceCmd.h b/src/Commands/SelNextSurfaceCmd.h new file mode 100644 index 0000000..ca196e2 --- /dev/null +++ b/src/Commands/SelNextSurfaceCmd.h @@ -0,0 +1,29 @@ +// SelNextSurfaceCmd +// Selects next surface in the projection mapping mode +// Created by Krisjanis Rijnieks 2016-02-03 + +#pragma once + +#include "BaseCmd.h" +#include "BaseSurface.h" +#include "SurfaceManager.h" + +namespace ofx { +namespace piMapper { + +class SelNextSurfaceCmd : public BaseUndoCmd { + + public: + SelNextSurfaceCmd(SurfaceManager * surfaceManager); + void exec(); + void undo(); + + private: + SurfaceManager * _surfaceManager; + BaseSurface * _prevSelectedSurface; + +}; + +} // namespace piMapper +} // namespace ofx +