diff --git a/src/Commands/ClearSurfacesCmd.cpp b/src/Commands/ClearSurfacesCmd.cpp new file mode 100644 index 0000000..96246b4 --- /dev/null +++ b/src/Commands/ClearSurfacesCmd.cpp @@ -0,0 +1,23 @@ +#include "ClearSurfacesCmd.h" + +namespace ofx { +namespace piMapper { + +ClearSurfacesCmd::ClearSurfacesCmd(){ + _surfaces = SurfaceStack::instance()->getSurfaces(); +} + +void ClearSurfacesCmd::exec(){ + SurfaceStack::instance()->clear(); +} + +void ClearSurfacesCmd::undo(){ + ofLogNotice("ClearSurfacesCmd", "undo"); + for(unsigned int i = 0; i < _surfaces.size(); ++i){ + SurfaceStack::instance()->push_back(_surfaces[i]); + } +} + +} // namespace piMapper +} // namespace ofx + diff --git a/src/Commands/ClearSurfacesCmd.h b/src/Commands/ClearSurfacesCmd.h new file mode 100644 index 0000000..458539e --- /dev/null +++ b/src/Commands/ClearSurfacesCmd.h @@ -0,0 +1,30 @@ +// SelSurfaceCmd +// Provides with option to undo select surface operation. +// Created by Krisjanis Rijnieks 2015-05-14 + +#pragma once + +#include "BaseCmd.h" +#include "BaseSurface.h" +#include "SurfaceStack.h" +#include "Gui.h" + +namespace ofx { +namespace piMapper { + +class ClearSurfacesCmd : public BaseUndoCmd { + + public: + ClearSurfacesCmd(); + void exec(); + void undo(); + + private: + // Here it would make sense to have another instance of SurfaceStack + vector _surfaces; + +}; + +} // namespace piMapper +} // namespace ofx +