Browse Source

Update RmSurfaceCmd

Instead of removing selected surface, let user remove specific surface without selecting it.
master
Krisjanis Rijnieks 8 years ago
parent
commit
fa4e263321
  1. 4
      src/Application/Modes/ProjectionMappingMode.cpp
  2. 6
      src/Commands/RmSurfaceCmd.cpp
  3. 3
      src/Commands/RmSurfaceCmd.h

4
src/Application/Modes/ProjectionMappingMode.cpp

@ -73,7 +73,9 @@ void ProjectionMappingMode::onKeyPressed(Application * app, ofKeyEventArgs & arg
break;
}
app->getCmdManager()->exec(
new RmSurfaceCmd(app->getSurfaceManager()));
new RmSurfaceCmd(
app->getSurfaceManager(),
app->getSurfaceManager()->getSelectedSurfaceIndex()));
break;
case 'p':

6
src/Commands/RmSurfaceCmd.cpp

@ -3,15 +3,17 @@
namespace ofx {
namespace piMapper {
RmSurfaceCmd::RmSurfaceCmd(SurfaceManager * sm){
RmSurfaceCmd::RmSurfaceCmd(SurfaceManager * sm, int i){
_surfaceManager = sm;
_surface = 0;
_surfaceIndex = i;
}
void RmSurfaceCmd::exec(){
// Store the surface, this implies that the surfaceManager's
// removeSelectedSurface does not destroy the surface.
_surface = _surfaceManager->getSelectedSurface();
// The owner is being changed.
_surface = _surfaceManager->getSurface(_surfaceIndex);
_surfaceManager->removeSelectedSurface();
}

3
src/Commands/RmSurfaceCmd.h

@ -16,13 +16,14 @@ namespace piMapper {
class RmSurfaceCmd : public BaseUndoCmd {
public:
RmSurfaceCmd(SurfaceManager * sm);
RmSurfaceCmd(SurfaceManager * sm, int i);
void exec();
void undo();
private:
SurfaceManager * _surfaceManager;
BaseSurface * _surface;
int _surfaceIndex;
};

Loading…
Cancel
Save