diff --git a/src/Application/Application.cpp b/src/Application/Application.cpp index 71a1e4c..a24c973 100644 --- a/src/Application/Application.cpp +++ b/src/Application/Application.cpp @@ -72,7 +72,7 @@ void Application::onKeyPressed(ofKeyEventArgs & args){ break; case 's': - _ofxPiMapper->getSurfaceManager().saveXmlSettings( + _ofxPiMapper->getSurfaceManager()->saveXmlSettings( PIMAPPER_USER_SURFACES_XML_FILE); break; diff --git a/src/Commands/AddSurfaceCmd.cpp b/src/Commands/AddSurfaceCmd.cpp index bbff713..d9085e8 100644 --- a/src/Commands/AddSurfaceCmd.cpp +++ b/src/Commands/AddSurfaceCmd.cpp @@ -18,7 +18,7 @@ void AddSurfaceCmd::exec(){ void AddSurfaceCmd::undo(){ ofLogNotice("AddSurfaceCmd", "undo"); - _app->getSurfaceManager().removeSurface(); + _app->getSurfaceManager()->removeSurface(); } void AddSurfaceCmd::addTriangleSurface(){ @@ -34,7 +34,7 @@ void AddSurfaceCmd::addTriangleSurface(){ texCoords.push_back(ofVec2f(0.5f, 0.0f)); texCoords.push_back(ofVec2f(1.0f, 1.0f)); texCoords.push_back(ofVec2f(0.0f, 1.0f)); - _app->getSurfaceManager().createSurface(surfaceType, vertices, texCoords); + _app->getSurfaceManager()->createSurface(surfaceType, vertices, texCoords); } void AddSurfaceCmd::addQuadSurface(){ @@ -53,7 +53,7 @@ void AddSurfaceCmd::addQuadSurface(){ texCoords.push_back(ofVec2f(ofVec2f(1.0f, 1.0f))); texCoords.push_back(ofVec2f(ofVec2f(0.0f, 1.0f))); - _app->getSurfaceManager().createSurface(surfaceType, vertices, texCoords); + _app->getSurfaceManager()->createSurface(surfaceType, vertices, texCoords); } } // namespace piMapper diff --git a/src/Commands/RmSurfaceCmd.cpp b/src/Commands/RmSurfaceCmd.cpp index 173f652..41ce11d 100644 --- a/src/Commands/RmSurfaceCmd.cpp +++ b/src/Commands/RmSurfaceCmd.cpp @@ -11,8 +11,8 @@ RmSurfaceCmd::RmSurfaceCmd(ofxPiMapper * app){ void RmSurfaceCmd::exec(){ // Store the surface, this implies that the surfaceManager's // removeSelectedSurface does not destroy the surface. - _surface = _app->surfaceManager.getSelectedSurface(); - _app->surfaceManager.removeSelectedSurface(); + _surface = _app->getSurfaceManager()->getSelectedSurface(); + _app->getSurfaceManager()->removeSelectedSurface(); } void RmSurfaceCmd::undo(){ @@ -20,8 +20,8 @@ void RmSurfaceCmd::undo(){ if(_surface == 0){ ofLogError("RmSurfaceCmd", "No surface stored"); } - _app->surfaceManager.addSurface(_surface); - _app->surfaceManager.selectSurface(_surface); + _app->getSurfaceManager()->addSurface(_surface); + _app->getSurfaceManager()->selectSurface(_surface); _surface = 0; } diff --git a/src/ofxPiMapper.cpp b/src/ofxPiMapper.cpp index b79dfd5..2200581 100644 --- a/src/ofxPiMapper.cpp +++ b/src/ofxPiMapper.cpp @@ -6,13 +6,14 @@ ofxPiMapper::ofxPiMapper(){ _gui = new ofx::piMapper::SurfaceManagerGui(); _cmdManager = new ofx::piMapper::CmdManager(); _mediaServer = new ofx::piMapper::MediaServer(); + _surfaceManager = new ofx::piMapper::SurfaceManager(); _info = new ofx::piMapper::Info(); } void ofxPiMapper::setup(){ ofLogNotice("ofxPiMapper") << "Setting up..."; - surfaceManager.setMediaServer(_mediaServer); + _surfaceManager->setMediaServer(_mediaServer); _gui->setMediaServer(_mediaServer); _gui->setCmdManager(_cmdManager); @@ -24,7 +25,7 @@ void ofxPiMapper::setup(){ } } - _gui->setSurfaceManager(&surfaceManager); + _gui->setSurfaceManager(_surfaceManager); isSetUp = true; ofLogNotice("ofxPiMapper") << "Done setting up"; _application = new ofx::piMapper::Application(this); @@ -48,7 +49,7 @@ bool ofxPiMapper::loadXmlSettings(string fileName){ ofLogError("ofxPiMapper::loadXmlSettings()") << fileName << " does not exist"; return false; } - if(!surfaceManager.loadXmlSettings(fileName)){ + if(!_surfaceManager->loadXmlSettings(fileName)){ ofLogError("ofxPiMapper::loadXmlSettings()") << "Failed to load " << fileName << endl; return false; } @@ -63,8 +64,8 @@ ofx::piMapper::SurfaceManagerGui * ofxPiMapper::getGui(){ return _gui; } -ofx::piMapper::SurfaceManager & ofxPiMapper::getSurfaceManager(){ - return surfaceManager; +ofx::piMapper::SurfaceManager * ofxPiMapper::getSurfaceManager(){ + return _surfaceManager; } ofx::piMapper::Info * ofxPiMapper::getInfo(){ diff --git a/src/ofxPiMapper.h b/src/ofxPiMapper.h index 2e798a9..d97e054 100644 --- a/src/ofxPiMapper.h +++ b/src/ofxPiMapper.h @@ -32,8 +32,7 @@ class ofxPiMapper { ofx::piMapper::CmdManager * getCmdManager(); ofx::piMapper::SurfaceManagerGui * getGui(); - ofx::piMapper::SurfaceManager & getSurfaceManager(); - ofx::piMapper::SurfaceManager surfaceManager; + ofx::piMapper::SurfaceManager * getSurfaceManager(); ofx::piMapper::Info * getInfo(); private: @@ -41,6 +40,7 @@ class ofxPiMapper { bool bShowInfo; ofx::piMapper::CmdManager * _cmdManager; ofx::piMapper::MediaServer * _mediaServer; + ofx::piMapper::SurfaceManager * _surfaceManager; ofx::piMapper::SurfaceManagerGui * _gui; ofx::piMapper::Application * _application; ofx::piMapper::Info * _info;