diff --git a/src/Application/Application.cpp b/src/Application/Application.cpp index 31710f9..6c44d57 100644 --- a/src/Application/Application.cpp +++ b/src/Application/Application.cpp @@ -36,28 +36,28 @@ void Application::onKeyPressed(ofKeyEventArgs & args){ switch(args.key){ case '1': - _ofxPiMapper->getCmdManager().exec( + _ofxPiMapper->getCmdManager()->exec( new ofx::piMapper::SetApplicationStateCmd( this, PresentationState::instance(), &_ofxPiMapper->getGui(), GuiMode::NONE)); break; case '2': - _ofxPiMapper->getCmdManager().exec( + _ofxPiMapper->getCmdManager()->exec( new ofx::piMapper::SetApplicationStateCmd( this, TextureMappingState::instance(), &_ofxPiMapper->getGui(), GuiMode::TEXTURE_MAPPING)); break; case '3': - _ofxPiMapper->getCmdManager().exec( + _ofxPiMapper->getCmdManager()->exec( new ofx::piMapper::SetApplicationStateCmd( this, ProjectionMappingState::instance(), &_ofxPiMapper->getGui(), GuiMode::PROJECTION_MAPPING)); break; case '4': - _ofxPiMapper->getCmdManager().exec( + _ofxPiMapper->getCmdManager()->exec( new ofx::piMapper::SetApplicationStateCmd( this, SourceSelectionState::instance(), &_ofxPiMapper->getGui(), GuiMode::SOURCE_SELECTION)); @@ -77,7 +77,7 @@ void Application::onKeyPressed(ofKeyEventArgs & args){ break; case 'z': - _ofxPiMapper->getCmdManager().undo(); + _ofxPiMapper->getCmdManager()->undo(); break; default: diff --git a/src/Application/ProjectionMappingState.cpp b/src/Application/ProjectionMappingState.cpp index c417878..eda917b 100644 --- a/src/Application/ProjectionMappingState.cpp +++ b/src/Application/ProjectionMappingState.cpp @@ -18,7 +18,7 @@ void ProjectionMappingState::onKeyPressed(Application * app, ofKeyEventArgs & ar switch(args.key){ case 't': - app->getOfxPiMapper()->getCmdManager().exec( + app->getOfxPiMapper()->getCmdManager()->exec( new AddSurfaceCmd( app->getOfxPiMapper(), SurfaceType::TRIANGLE_SURFACE) @@ -26,7 +26,7 @@ void ProjectionMappingState::onKeyPressed(Application * app, ofKeyEventArgs & ar break; case 'q': - app->getOfxPiMapper()->getCmdManager().exec( + app->getOfxPiMapper()->getCmdManager()->exec( new AddSurfaceCmd( app->getOfxPiMapper(), SurfaceType::QUAD_SURFACE) @@ -34,7 +34,7 @@ void ProjectionMappingState::onKeyPressed(Application * app, ofKeyEventArgs & ar break; case OF_KEY_BACKSPACE: - app->getOfxPiMapper()->getCmdManager().exec( + app->getOfxPiMapper()->getCmdManager()->exec( new RmSurfaceCmd(app->getOfxPiMapper())); break; diff --git a/src/ofxPiMapper.cpp b/src/ofxPiMapper.cpp index b54a50d..35adeba 100644 --- a/src/ofxPiMapper.cpp +++ b/src/ofxPiMapper.cpp @@ -3,6 +3,7 @@ ofxPiMapper::ofxPiMapper(){ bShowInfo = false; isSetUp = false; + _cmdManager = new ofx::piMapper::CmdManager(); _mediaServer = new ofx::piMapper::MediaServer(); _info = new ofx::piMapper::Info(); } @@ -12,7 +13,7 @@ void ofxPiMapper::setup(){ surfaceManager.setMediaServer(_mediaServer); gui.setMediaServer(_mediaServer); - gui.setCmdManager(&cmdManager); + gui.setCmdManager(_cmdManager); if(!loadXmlSettings(PIMAPPER_USER_SURFACES_XML_FILE)){ ofLogWarning("ofxPiMapper::setup()") << "Failed to load user settings, go with default" << endl; @@ -53,8 +54,8 @@ bool ofxPiMapper::loadXmlSettings(string fileName){ return true; } -ofx::piMapper::CmdManager & ofxPiMapper::getCmdManager(){ - return cmdManager; +ofx::piMapper::CmdManager * ofxPiMapper::getCmdManager(){ + return _cmdManager; } ofx::piMapper::SurfaceManagerGui & ofxPiMapper::getGui(){ diff --git a/src/ofxPiMapper.h b/src/ofxPiMapper.h index aafcd00..e68159d 100644 --- a/src/ofxPiMapper.h +++ b/src/ofxPiMapper.h @@ -30,16 +30,16 @@ class ofxPiMapper { void registerFboSource(ofx::piMapper::FboSource & fboSource); bool loadXmlSettings(string fileName); - ofx::piMapper::CmdManager & getCmdManager(); + ofx::piMapper::CmdManager * getCmdManager(); ofx::piMapper::SurfaceManagerGui & getGui(); ofx::piMapper::SurfaceManager & getSurfaceManager(); - ofx::piMapper::CmdManager cmdManager; ofx::piMapper::SurfaceManager surfaceManager; ofx::piMapper::Info * getInfo(); private: bool isSetUp; bool bShowInfo; + ofx::piMapper::CmdManager * _cmdManager; ofx::piMapper::MediaServer * _mediaServer; ofx::piMapper::SurfaceManagerGui gui; ofx::piMapper::Application * _application;