From 8455ac9a1768c48d4759ff6fd00df91b8fad821d Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Sat, 15 Oct 2016 12:43:16 +0200 Subject: [PATCH] Move Application mode switching to methods This gives the possibility to call CommandManager managed calls from the ofxPiMapper class. --- src/Application/Application.cpp | 40 +++++++++++++++++++++++---------- src/Application/Application.h | 5 +++++ 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/src/Application/Application.cpp b/src/Application/Application.cpp index e811d2f..b8bcf32 100644 --- a/src/Application/Application.cpp +++ b/src/Application/Application.cpp @@ -98,27 +98,19 @@ void Application::onKeyPressed(ofKeyEventArgs & args){ break; case '1': - _cmdManager.exec( - new ofx::piMapper::SetApplicationModeCmd( - this, PresentationMode::instance())); + setProjectionMode(); break; case '2': - _cmdManager.exec( - new ofx::piMapper::SetApplicationModeCmd( - this, TextureMappingMode::instance())); + setTextureMode(); break; case '3': - _cmdManager.exec( - new ofx::piMapper::SetApplicationModeCmd( - this, ProjectionMappingMode::instance())); + setProjectionMode(); break; case '4': - _cmdManager.exec( - new ofx::piMapper::SetApplicationModeCmd( - this, SourceSelectionMode::instance())); + setSourceMode(); break; case 'f': @@ -260,5 +252,29 @@ bool Application::loadXmlSettings(string fileName){ return true; } +void Application::setPresentationMode(){ + _cmdManager.exec( + new ofx::piMapper::SetApplicationModeCmd( + this, PresentationMode::instance())); +} + +void Application::setTextureMode(){ + _cmdManager.exec( + new ofx::piMapper::SetApplicationModeCmd( + this, TextureMappingMode::instance())); +} + +void Application::setProjectionMode(){ + _cmdManager.exec( + new ofx::piMapper::SetApplicationModeCmd( + this, ProjectionMappingMode::instance())); +} + +void Application::setSourceMode(){ + _cmdManager.exec( + new ofx::piMapper::SetApplicationModeCmd( + this, SourceSelectionMode::instance())); +} + } // namespace piMapper } // namespace ofx diff --git a/src/Application/Application.h b/src/Application/Application.h index f65d646..be57a21 100644 --- a/src/Application/Application.h +++ b/src/Application/Application.h @@ -70,6 +70,11 @@ class Application : public KeyListener { TerminalListener consoleListener; // Command executors + void setPresentationMode(); + void setTextureMode(); + void setProjectionMode(); + void setSourceMode(); + void setActivePreset(unsigned int i); void setNextPreset();