Browse Source

Move AddGridRow.. and ..Column methods to Application

master
Krisjanis Rijnieks 8 years ago
parent
commit
1269e5661e
  1. 57
      src/Application/Application.cpp
  2. 4
      src/Application/Application.h
  3. 48
      src/Application/Modes/ProjectionMappingMode.cpp

57
src/Application/Application.cpp

@ -404,5 +404,62 @@ void Application::setNextSource(){
}
}
void Application::addGridRow(){
if(getSurfaceManager()->getSelectedSurface() != 0){
if(getSurfaceManager()->getSelectedSurface()->getType() ==
SurfaceType::GRID_WARP_SURFACE){
// TODO: The command should not require projection editor pointer
getCmdManager()->exec(
new AddGridRowCmd(
(GridWarpSurface *)getSurfaceManager()->getSelectedSurface() ));
}
}
}
void Application::addGridColumn(){
if(getSurfaceManager()->getSelectedSurface() != 0){
if(getSurfaceManager()->getSelectedSurface()->getType() ==
SurfaceType::GRID_WARP_SURFACE){
// TODO: The command should not require projection editor pointer
getCmdManager()->exec(
new AddGridColCmd(
(GridWarpSurface *)getSurfaceManager()->getSelectedSurface() ));
}
}
}
void Application::removeGridRow(){
if(getSurfaceManager()->getSelectedSurface() != 0){
if(getSurfaceManager()->getSelectedSurface()->getType() ==
SurfaceType::GRID_WARP_SURFACE){
if(((GridWarpSurface *)getSurfaceManager()->getSelectedSurface())->getGridRows() > 1){
// TODO: The command should not require projection editor pointer
getCmdManager()->exec(
new RmGridRowCmd(
(GridWarpSurface *)getSurfaceManager()->getSelectedSurface() ));
}
}
}
}
void Application::removeGridColumn(){
if(getSurfaceManager()->getSelectedSurface() != 0){
if(getSurfaceManager()->getSelectedSurface()->getType() ==
SurfaceType::GRID_WARP_SURFACE){
if(((GridWarpSurface *)getSurfaceManager()->getSelectedSurface())->getGridCols() > 1){
// TODO: The command should not require projection editor pointer
getCmdManager()->exec(
new RmGridColCmd(
(GridWarpSurface *)getSurfaceManager()->getSelectedSurface() ));
}
}
}
}
} // namespace piMapper
} // namespace ofx

4
src/Application/Application.h

@ -98,6 +98,10 @@ class Application : public KeyListener {
void scaleDown();
void duplicateSurface();
void setNextSource();
void addGridRow();
void addGridColumn();
void removeGridRow();
void removeGridColumn();
void setPreset(unsigned int i);
void setNextPreset();

48
src/Application/Modes/ProjectionMappingMode.cpp

@ -77,59 +77,19 @@ void ProjectionMappingMode::onKeyPressed(Application * app, ofKeyEventArgs & arg
break;
case '}':
if(app->getSurfaceManager()->getSelectedSurface() != 0){
if(app->getSurfaceManager()->getSelectedSurface()->getType() ==
SurfaceType::GRID_WARP_SURFACE){
// TODO: The command should not require projection editor pointer
app->getCmdManager()->exec(
new AddGridRowCmd(
(GridWarpSurface *)app->getSurfaceManager()->getSelectedSurface() ));
}
}
app->addGridRow();
break;
case '{':
if(app->getSurfaceManager()->getSelectedSurface() != 0){
if(app->getSurfaceManager()->getSelectedSurface()->getType() ==
SurfaceType::GRID_WARP_SURFACE){
if(((GridWarpSurface *)app->getSurfaceManager()->getSelectedSurface())->getGridRows() > 1){
// TODO: The command should not require projection editor pointer
app->getCmdManager()->exec(
new RmGridRowCmd(
(GridWarpSurface *)app->getSurfaceManager()->getSelectedSurface() ));
}
}
}
app->removeGridRow();
break;
case ']':
if(app->getSurfaceManager()->getSelectedSurface() != 0){
if(app->getSurfaceManager()->getSelectedSurface()->getType() ==
SurfaceType::GRID_WARP_SURFACE){
// TODO: The command should not require projection editor pointer
app->getCmdManager()->exec(
new AddGridColCmd(
(GridWarpSurface *)app->getSurfaceManager()->getSelectedSurface() ));
}
}
app->addGridColumn();
break;
case '[':
if(app->getSurfaceManager()->getSelectedSurface() != 0){
if(app->getSurfaceManager()->getSelectedSurface()->getType() ==
SurfaceType::GRID_WARP_SURFACE){
if(((GridWarpSurface *)app->getSurfaceManager()->getSelectedSurface())->getGridCols() > 1){
// TODO: The command should not require projection editor pointer
app->getCmdManager()->exec(
new RmGridColCmd(
(GridWarpSurface *)app->getSurfaceManager()->getSelectedSurface() ));
}
}
}
app->removeGridColumn();
break;
case '.':

Loading…
Cancel
Save