Browse Source

Add Application::setNextPreset on <n> keypress

master
Krisjanis Rijnieks 9 years ago
parent
commit
16e2473835
  1. 18
      src/Application/Application.cpp
  2. 1
      src/Application/Application.h

18
src/Application/Application.cpp

@ -136,6 +136,10 @@ void Application::onKeyPressed(ofKeyEventArgs & args){
case 'z':
_cmdManager.undo();
break;
case 'n':
setNextPreset();
break;
default:
// All the other keypresses are handled by the application state onKeyPressed
@ -230,6 +234,20 @@ void Application::setActivePreset(unsigned int i){
_cmdManager.exec(new SetActivePresetCmd(this, i));
}
void Application::setNextPreset(){
unsigned int numPresets = _surfaceManager.getNumPresets();
if(numPresets <= 1){
return;
}
int activePreset = _surfaceManager.getActivePresetIndex();
if(activePreset >= numPresets - 1){
activePreset = 0;
}else{
activePreset += 1;
}
setActivePreset(activePreset);
}
bool Application::loadXmlSettings(string fileName){
if(!ofFile::doesFileExist(fileName)){
ofLogError("Application::loadXmlSettings()") << fileName << " does not exist";

1
src/Application/Application.h

@ -71,6 +71,7 @@ class Application : public KeyListener {
// Command executors
void setActivePreset(unsigned int i);
void setNextPreset();
protected:
void setState(ApplicationBaseMode * st);

Loading…
Cancel
Save