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 piMapper
} // namespace ofx } // namespace ofx

4
src/Application/Application.h

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

48
src/Application/Modes/ProjectionMappingMode.cpp

@ -77,59 +77,19 @@ void ProjectionMappingMode::onKeyPressed(Application * app, ofKeyEventArgs & arg
break; break;
case '}': case '}':
if(app->getSurfaceManager()->getSelectedSurface() != 0){ app->addGridRow();
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() ));
}
}
break; break;
case '{': case '{':
if(app->getSurfaceManager()->getSelectedSurface() != 0){ app->removeGridRow();
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() ));
}
}
}
break; break;
case ']': case ']':
if(app->getSurfaceManager()->getSelectedSurface() != 0){ app->addGridColumn();
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() ));
}
}
break; break;
case '[': case '[':
if(app->getSurfaceManager()->getSelectedSurface() != 0){ app->removeGridColumn();
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() ));
}
}
}
break; break;
case '.': case '.':

Loading…
Cancel
Save