Browse Source

Add ClearSurfaceCmd command

master
Krisjanis Rijnieks 9 years ago
parent
commit
73e68cc89d
  1. 23
      src/Commands/ClearSurfacesCmd.cpp
  2. 30
      src/Commands/ClearSurfacesCmd.h

23
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

30
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<BaseSurface *> _surfaces;
};
} // namespace piMapper
} // namespace ofx
Loading…
Cancel
Save