diff --git a/src/Application/Application.cpp b/src/Application/Application.cpp index c4aeb4c..578ad7e 100644 --- a/src/Application/Application.cpp +++ b/src/Application/Application.cpp @@ -98,29 +98,25 @@ void Application::onKeyPressed(ofKeyEventArgs & args){ case '1': _cmdManager.exec( new ofx::piMapper::SetApplicationStateCmd( - this, PresentationState::instance(), - &_gui, GuiMode::NONE)); + this, PresentationState::instance())); break; case '2': _cmdManager.exec( new ofx::piMapper::SetApplicationStateCmd( - this, TextureMappingState::instance(), - &_gui, GuiMode::TEXTURE_MAPPING)); + this, TextureMappingState::instance())); break; case '3': _cmdManager.exec( new ofx::piMapper::SetApplicationStateCmd( - this, ProjectionMappingState::instance(), - &_gui, GuiMode::PROJECTION_MAPPING)); + this, ProjectionMappingState::instance())); break; case '4': _cmdManager.exec( new ofx::piMapper::SetApplicationStateCmd( - this, SourceSelectionState::instance(), - &_gui, GuiMode::SOURCE_SELECTION)); + this, SourceSelectionState::instance())); break; case 'f': diff --git a/src/Application/States/PresentationState.cpp b/src/Application/States/PresentationState.cpp index aee780c..21c38d2 100644 --- a/src/Application/States/PresentationState.cpp +++ b/src/Application/States/PresentationState.cpp @@ -22,8 +22,7 @@ void PresentationState::draw(Application * app){ void PresentationState::onMousePressed(Application * app, ofMouseEventArgs & args){ app->getCmdManager()->exec( new ofx::piMapper::SetApplicationStateCmd( - app, ProjectionMappingState::instance(), - app->getGui(), GuiMode::PROJECTION_MAPPING)); + app, ProjectionMappingState::instance())); } } // namespace piMapper diff --git a/src/Commands/SetApplicationStateCmd.cpp b/src/Commands/SetApplicationStateCmd.cpp index f9a2f8e..d355c32 100644 --- a/src/Commands/SetApplicationStateCmd.cpp +++ b/src/Commands/SetApplicationStateCmd.cpp @@ -4,18 +4,11 @@ namespace ofx { namespace piMapper { SetApplicationStateCmd::SetApplicationStateCmd(Application * app, - ApplicationBaseState * st, - SurfaceManagerGui * gui, - int mode){ + ApplicationBaseState * st){ _application = app; _prevApplicationState = 0; _applicationState = st; - - // TODO: To be removed - _gui = gui; - _prevGuiMode = -1; - _mode = mode; } void SetApplicationStateCmd::exec(){ @@ -26,19 +19,27 @@ void SetApplicationStateCmd::exec(){ Gui::instance()->getTextureEditorWidget().setSurface( _application->getSurfaceManager()->getSelectedSurface()); - - // TODO: To be removed. - _prevGuiMode = _gui->getMode(); - _gui->setMode(_mode); + + if(_applicationState != PresentationState::instance()){ + ofShowCursor(); + }else{ + ofHideCursor(); + } } void SetApplicationStateCmd::undo(){ ofLogNotice("SetApplicationStateCmd", "undo"); _application->setState(_prevApplicationState); _application->getState()->setTranslation(_translation); - - // TODO: To be removed. - _gui->setMode(_prevGuiMode); + + Gui::instance()->getTextureEditorWidget().setSurface( + _application->getSurfaceManager()->getSelectedSurface()); + + if(_prevApplicationState != PresentationState::instance()){ + ofShowCursor(); + }else{ + ofHideCursor(); + } } } // namespace piMapper diff --git a/src/Commands/SetApplicationStateCmd.h b/src/Commands/SetApplicationStateCmd.h index cf386f3..39fe520 100644 --- a/src/Commands/SetApplicationStateCmd.h +++ b/src/Commands/SetApplicationStateCmd.h @@ -2,8 +2,6 @@ #include "BaseCmd.h" #include "Application.h" -#include "SurfaceManagerGui.h" -#include "Gui.h" namespace ofx { namespace piMapper { @@ -15,9 +13,7 @@ class SetApplicationStateCmd : public BaseUndoCmd { public: SetApplicationStateCmd(Application * app, - ApplicationBaseState * st, - SurfaceManagerGui * gui, - int mode); + ApplicationBaseState * st); void exec(); void undo(); @@ -26,14 +22,9 @@ class SetApplicationStateCmd : public BaseUndoCmd { Application * _application; ApplicationBaseState * _prevApplicationState; ApplicationBaseState * _applicationState; - + ofPoint _translation; - // TODO: Remove these after porting to app state system is done - SurfaceManagerGui * _gui; - int _prevGuiMode; - int _mode; - }; } // namespace piMapper