7 changed files with 91 additions and 12 deletions
@ -0,0 +1,28 @@ |
|||
#include "RemoveSurfaceCommand.h" |
|||
|
|||
namespace ofx{ |
|||
namespace piMapper{ |
|||
|
|||
RemoveSurfaceCommand::RemoveSurfaceCommand(ofxPiMapper * app){ |
|||
_app = app; |
|||
_surface = 0; |
|||
} |
|||
|
|||
void RemoveSurfaceCommand::exec(){ |
|||
// Store the surface, this implies that the surfaceManager's
|
|||
// removeSelectedSurface does not destroy the surface.
|
|||
_surface = _app->surfaceManager.getSelectedSurface(); |
|||
_app->surfaceManager.removeSelectedSurface(); |
|||
} |
|||
|
|||
void RemoveSurfaceCommand::undo(){ |
|||
if (_surface == 0) { |
|||
ofLogError("RemoveSurfaceCommand", "No surface stored"); |
|||
} |
|||
_app->surfaceManager.addSurface(_surface); |
|||
_surface = 0; |
|||
} |
|||
|
|||
} // namespace piMapper
|
|||
} // namespace ofx
|
|||
|
@ -0,0 +1,30 @@ |
|||
// RemoveSurfaceCommand
|
|||
// Provides with option to undo remove surface operation.
|
|||
// Created by Krisjanis Rijnieks 2015-05-14
|
|||
|
|||
#pragma once |
|||
|
|||
#include "ofxPiMapper.h" |
|||
#include "BaseCommand.h" |
|||
#include "BaseSurface.h" |
|||
|
|||
class ofxPiMapper; |
|||
|
|||
namespace ofx{ |
|||
namespace piMapper{ |
|||
|
|||
class RemoveSurfaceCommand : public BaseUndoableCommand{ |
|||
|
|||
public: |
|||
RemoveSurfaceCommand(ofxPiMapper * app); |
|||
void exec(); |
|||
void undo(); |
|||
|
|||
private: |
|||
ofxPiMapper * _app; |
|||
BaseSurface * _surface; |
|||
}; |
|||
|
|||
} // namespace piMapper
|
|||
} // namespace ofx
|
|||
|
Loading…
Reference in new issue