diff --git a/src/Application/Application.cpp b/src/Application/Application.cpp index 5526c38..e099fe1 100644 --- a/src/Application/Application.cpp +++ b/src/Application/Application.cpp @@ -224,7 +224,11 @@ void Application::onCharacterReceived(KeyListenerEventData & e){ cout << "TermListener: " << e.character << endl; onKeyPressed(args); -}; +} + +void Application::setActivePreset(unsigned int i){ + _cmdManager.exec(new SetActivePresetCmd(this, i)); +} bool Application::loadXmlSettings(string fileName){ if(!ofFile::doesFileExist(fileName)){ diff --git a/src/Application/Application.h b/src/Application/Application.h index 7516948..e9099dc 100644 --- a/src/Application/Application.h +++ b/src/Application/Application.h @@ -5,6 +5,7 @@ #include "SetApplicationModeCmd.h" #include "ClearSurfacesCmd.h" +#include "SetActivePresetCmd.h" #include "ApplicationBaseMode.h" #include "PresentationMode.h" @@ -68,6 +69,9 @@ class Application : public KeyListener { void onCharacterReceived(KeyListenerEventData & e); TerminalListener consoleListener; + // Command executors + void setActivePreset(unsigned int i); + protected: void setState(ApplicationBaseMode * st); diff --git a/src/ofxPiMapper.cpp b/src/ofxPiMapper.cpp index 638a39a..af37d6f 100644 --- a/src/ofxPiMapper.cpp +++ b/src/ofxPiMapper.cpp @@ -23,7 +23,7 @@ void ofxPiMapper::registerFboSource(ofx::piMapper::FboSource * fboSource){ } void ofxPiMapper::setActivePreset(unsigned int i){ - _application.getSurfaceManager()->setActivePreset(i); + _application.setActivePreset(i); } void ofxPiMapper::setNextPreset(){ diff --git a/src/ofxPiMapper.h b/src/ofxPiMapper.h index 6ede09d..682ecd5 100644 --- a/src/ofxPiMapper.h +++ b/src/ofxPiMapper.h @@ -38,6 +38,7 @@ class ofxPiMapper { void registerFboSource(ofx::piMapper::FboSource & fboSource); void registerFboSource(ofx::piMapper::FboSource * fboSource); + void setActivePreset(unsigned int i); void setNextPreset(); void cloneActivePreset();