Browse Source

Add moveLayerUp and ..Down methods to ofxPiMapper

master
Krisjanis Rijnieks 8 years ago
parent
commit
ce81e9e15d
  1. 29
      src/Application/Application.cpp
  2. 4
      src/Application/Application.h
  3. 27
      src/Application/Modes/ProjectionMappingMode.cpp
  4. 2
      src/Application/Modes/ProjectionMappingMode.h
  5. 8
      src/ofxPiMapper.cpp
  6. 2
      src/ofxPiMapper.h

29
src/Application/Application.cpp

@ -316,5 +316,34 @@ void Application::setSourceMode(){
this, SourceSelectionMode::instance()));
}
void Application::moveLayerUp(){
if(getSurfaceManager()->getSelectedSurface() != 0){
if(getSurfaceManager()->getSelectedSurface() ==
getSurfaceManager()->getActivePreset()->at(
getSurfaceManager()->getActivePreset()->size() - 1)){
return;
}
getCmdManager()->exec(
new MvLayerUpCmd(
getSurfaceManager()->getActivePreset(),
getSurfaceManager()->getSelectedSurface()));
}
}
void Application::moveLayerDown(){
if(getSurfaceManager()->getSelectedSurface() != 0){
if(getSurfaceManager()->getSelectedSurface() ==
getSurfaceManager()->getActivePreset()->at(0)){
return;
}
getCmdManager()->exec(
new MvLayerDnCmd(
getSurfaceManager()->getActivePreset(),
getSurfaceManager()->getSelectedSurface()));
}
}
} // namespace piMapper
} // namespace ofx

4
src/Application/Application.h

@ -7,6 +7,8 @@
#include "SetPresetCmd.h"
#include "AddSurfaceCmd.h"
#include "RmSurfaceCmd.h"
#include "MvLayerUpCmd.h"
#include "MvLayerDnCmd.h"
#include "ApplicationBaseMode.h"
#include "PresentationMode.h"
#include "ProjectionMappingMode.h"
@ -73,6 +75,8 @@ class Application : public KeyListener {
void setTextureMode();
void setProjectionMode();
void setSourceMode();
void moveLayerUp();
void moveLayerDown();
void setPreset(unsigned int i);
void setNextPreset();

27
src/Application/Modes/ProjectionMappingMode.cpp

@ -230,34 +230,11 @@ void ProjectionMappingMode::onKeyPressed(Application * app, ofKeyEventArgs & arg
break;
case '0': // Move selected surface up the layer stack
if(app->getSurfaceManager()->getSelectedSurface() != 0){
if(app->getSurfaceManager()->getSelectedSurface() ==
app->getSurfaceManager()->getActivePreset()->at(
app->getSurfaceManager()->getActivePreset()->size() - 1)){
return;
}
app->getCmdManager()->exec(
new MvLayerUpCmd(
app->getSurfaceManager()->getActivePreset(),
app->getSurfaceManager()->getSelectedSurface())
);
}
app->moveLayerUp();
break;
case '9': // Move selected surface down the layer stack
if(app->getSurfaceManager()->getSelectedSurface() != 0){
if(app->getSurfaceManager()->getSelectedSurface() ==
app->getSurfaceManager()->getActivePreset()->at(0)){
return;
}
app->getCmdManager()->exec(
new MvLayerDnCmd(
app->getSurfaceManager()->getActivePreset(),
app->getSurfaceManager()->getSelectedSurface())
);
}
app->moveLayerDown();
break;
case '+': // Scale surface up

2
src/Application/Modes/ProjectionMappingMode.h

@ -23,8 +23,6 @@
#include "SetNextSourceCmd.h"
#include "DuplicateSurfaceCmd.h"
#include "ToggleAnimatedSourceCmd.h"
#include "MvLayerUpCmd.h"
#include "MvLayerDnCmd.h"
#include "ScaleSurfaceFromToCmd.h"
#include "MvSurfaceVertCmd.h"
#include "SurfaceType.h"

8
src/ofxPiMapper.cpp

@ -99,6 +99,14 @@ void ofxPiMapper::selectPrevVertex(){
_application.getState()->selectPrevVertex(&_application);
}
void ofxPiMapper::moveLayerUp(){
_application.moveLayerUp();
}
void ofxPiMapper::moveLayerDown(){
_application.moveLayerDown();
}
void ofxPiMapper::togglePauseForSurface(unsigned int i){
ofx::piMapper::BaseSource * s =
_application.getSurfaceManager()->getActivePreset()->getSurfaces().at(i)->getSource();

2
src/ofxPiMapper.h

@ -51,6 +51,8 @@ class ofxPiMapper {
void selectPrevSurface();
void selectNextVertex();
void selectPrevVertex();
void moveLayerUp();
void moveLayerDown();
void togglePauseForSurface(unsigned int i);
void moveSelection(ofVec2f by);
void createSurface(ofx::piMapper::SurfaceType type);

Loading…
Cancel
Save