2 changed files with 56 additions and 0 deletions
@ -0,0 +1,24 @@ |
|||
#include "SetActivePresetCmd.h" |
|||
|
|||
namespace ofx { |
|||
namespace piMapper { |
|||
|
|||
SetActivePresetCmd::SetActivePresetCmd(Application * app, unsigned int pi){ |
|||
_app = app; |
|||
_newPresetIndex = pi; |
|||
} |
|||
|
|||
void SetActivePresetCmd::exec(){ |
|||
ofLogNotice("SetActivePresetCmd", "exec"); |
|||
_prevPresetIndex = _app->getSurfaceManager()->getActivePresetIndex(); |
|||
_app->getSurfaceManager()->setActivePreset(_newPresetIndex); |
|||
} |
|||
|
|||
void SetActivePresetCmd::undo(){ |
|||
ofLogNotice("SetActivePresetCmd", "undo"); |
|||
_app->getSurfaceManager()->setActivePreset(_prevPresetIndex); |
|||
} |
|||
|
|||
} // namespace piMapper
|
|||
} // namespace ofx
|
|||
|
@ -0,0 +1,32 @@ |
|||
// SetActivePresetCmd
|
|||
// Sets active preset, stores previous preset index and restores it on undo.
|
|||
// Created by Krisjanis Rijnieks 2016-10-07
|
|||
// At the ORA bar in Berlin. Waiting for Park to celebrate his birthday.
|
|||
|
|||
#pragma once |
|||
|
|||
#include "BaseCmd.h" |
|||
#include "BaseSurface.h" |
|||
#include "Application.h" |
|||
|
|||
namespace ofx { |
|||
namespace piMapper { |
|||
|
|||
class Application; |
|||
|
|||
class SetActivePresetCmd : public BaseUndoCmd { |
|||
|
|||
public: |
|||
SetActivePresetCmd(Application * app, unsigned int pi); |
|||
void exec(); |
|||
void undo(); |
|||
|
|||
private: |
|||
Application * _app; |
|||
unsigned int _newPresetIndex; |
|||
unsigned int _prevPresetIndex; |
|||
}; |
|||
|
|||
} // namespace piMapper
|
|||
} // namespace ofx
|
|||
|
Loading…
Reference in new issue