Browse Source

Add `SurfaceManagerGui` as pointer in `ofxPiMapper` class

Update the rest of the code to treat it as a pointer.
master
Krisjanis Rijnieks 10 years ago
parent
commit
873edcfa60
  1. 8
      src/Application/Application.cpp
  2. 13
      src/ofxPiMapper.cpp
  3. 4
      src/ofxPiMapper.h

8
src/Application/Application.cpp

@ -39,28 +39,28 @@ void Application::onKeyPressed(ofKeyEventArgs & args){
_ofxPiMapper->getCmdManager()->exec(
new ofx::piMapper::SetApplicationStateCmd(
this, PresentationState::instance(),
&_ofxPiMapper->getGui(), GuiMode::NONE));
_ofxPiMapper->getGui(), GuiMode::NONE));
break;
case '2':
_ofxPiMapper->getCmdManager()->exec(
new ofx::piMapper::SetApplicationStateCmd(
this, TextureMappingState::instance(),
&_ofxPiMapper->getGui(), GuiMode::TEXTURE_MAPPING));
_ofxPiMapper->getGui(), GuiMode::TEXTURE_MAPPING));
break;
case '3':
_ofxPiMapper->getCmdManager()->exec(
new ofx::piMapper::SetApplicationStateCmd(
this, ProjectionMappingState::instance(),
&_ofxPiMapper->getGui(), GuiMode::PROJECTION_MAPPING));
_ofxPiMapper->getGui(), GuiMode::PROJECTION_MAPPING));
break;
case '4':
_ofxPiMapper->getCmdManager()->exec(
new ofx::piMapper::SetApplicationStateCmd(
this, SourceSelectionState::instance(),
&_ofxPiMapper->getGui(), GuiMode::SOURCE_SELECTION));
_ofxPiMapper->getGui(), GuiMode::SOURCE_SELECTION));
break;
case 'f':

13
src/ofxPiMapper.cpp

@ -3,6 +3,7 @@
ofxPiMapper::ofxPiMapper(){
bShowInfo = false;
isSetUp = false;
_gui = new ofx::piMapper::SurfaceManagerGui();
_cmdManager = new ofx::piMapper::CmdManager();
_mediaServer = new ofx::piMapper::MediaServer();
_info = new ofx::piMapper::Info();
@ -12,8 +13,8 @@ void ofxPiMapper::setup(){
ofLogNotice("ofxPiMapper") << "Setting up...";
surfaceManager.setMediaServer(_mediaServer);
gui.setMediaServer(_mediaServer);
gui.setCmdManager(_cmdManager);
_gui->setMediaServer(_mediaServer);
_gui->setCmdManager(_cmdManager);
if(!loadXmlSettings(PIMAPPER_USER_SURFACES_XML_FILE)){
ofLogWarning("ofxPiMapper::setup()") << "Failed to load user settings, go with default" << endl;
@ -23,7 +24,7 @@ void ofxPiMapper::setup(){
}
}
gui.setSurfaceManager(&surfaceManager);
_gui->setSurfaceManager(&surfaceManager);
isSetUp = true;
ofLogNotice("ofxPiMapper") << "Done setting up";
_application = new ofx::piMapper::Application(this);
@ -33,7 +34,7 @@ void ofxPiMapper::draw(){
if(!isSetUp){
return;
}
gui.draw();
_gui->draw();
_application->draw();
_info->draw();
}
@ -58,8 +59,8 @@ ofx::piMapper::CmdManager * ofxPiMapper::getCmdManager(){
return _cmdManager;
}
ofx::piMapper::SurfaceManagerGui & ofxPiMapper::getGui(){
return gui;
ofx::piMapper::SurfaceManagerGui * ofxPiMapper::getGui(){
return _gui;
}
ofx::piMapper::SurfaceManager & ofxPiMapper::getSurfaceManager(){

4
src/ofxPiMapper.h

@ -31,7 +31,7 @@ class ofxPiMapper {
bool loadXmlSettings(string fileName);
ofx::piMapper::CmdManager * getCmdManager();
ofx::piMapper::SurfaceManagerGui & getGui();
ofx::piMapper::SurfaceManagerGui * getGui();
ofx::piMapper::SurfaceManager & getSurfaceManager();
ofx::piMapper::SurfaceManager surfaceManager;
ofx::piMapper::Info * getInfo();
@ -41,7 +41,7 @@ class ofxPiMapper {
bool bShowInfo;
ofx::piMapper::CmdManager * _cmdManager;
ofx::piMapper::MediaServer * _mediaServer;
ofx::piMapper::SurfaceManagerGui gui;
ofx::piMapper::SurfaceManagerGui * _gui;
ofx::piMapper::Application * _application;
ofx::piMapper::Info * _info;
};
Loading…
Cancel
Save