From cb1947d14539cf35c7854424d0dfad5ce9100e4d Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Wed, 10 Jan 2018 18:43:02 +0100 Subject: [PATCH] Add ofxPiMapper::toggleLayerPanel --- src/Application/Application.cpp | 6 ++++++ src/Application/Application.h | 1 + src/Application/Modes/ProjectionMappingMode.cpp | 6 +++++- src/Application/Modes/ProjectionMappingMode.h | 3 +++ src/ofxPiMapper.cpp | 4 ++++ src/ofxPiMapper.h | 3 +++ 6 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/Application/Application.cpp b/src/Application/Application.cpp index bdc0a77..9b4df56 100644 --- a/src/Application/Application.cpp +++ b/src/Application/Application.cpp @@ -564,5 +564,11 @@ void Application::deselect(){ } } +void Application::toggleLayerPanel(){ + if(getState() == ProjectionMappingMode::instance()){ + ProjectionMappingMode::instance()->toggleLayerPanel(); + } +} + } // namespace piMapper } // namespace ofx diff --git a/src/Application/Application.h b/src/Application/Application.h index fd89275..d1b00c5 100644 --- a/src/Application/Application.h +++ b/src/Application/Application.h @@ -139,6 +139,7 @@ class Application { // Make it so that other parts of the application react to the change. void undo(); void deselect(); + void toggleLayerPanel(); void setPreset(unsigned int i); void setNextPreset(); diff --git a/src/Application/Modes/ProjectionMappingMode.cpp b/src/Application/Modes/ProjectionMappingMode.cpp index 2ca7b8d..8293471 100644 --- a/src/Application/Modes/ProjectionMappingMode.cpp +++ b/src/Application/Modes/ProjectionMappingMode.cpp @@ -49,6 +49,10 @@ void ProjectionMappingMode::draw(Application * app){ Gui::instance()->getSurfaceHighlightWidget().draw(); } +void ProjectionMappingMode::toggleLayerPanel(){ + _bDrawLayerPanel = !_bDrawLayerPanel; +} + void ProjectionMappingMode::onKeyPressed(Application * app, ofKeyEventArgs & args){ switch(args.key){ @@ -173,7 +177,7 @@ void ProjectionMappingMode::onKeyPressed(Application * app, ofKeyEventArgs & arg break; case 'l': - _bDrawLayerPanel = !_bDrawLayerPanel; + toggleLayerPanel(); break; /* diff --git a/src/Application/Modes/ProjectionMappingMode.h b/src/Application/Modes/ProjectionMappingMode.h index 6567061..eca83a1 100644 --- a/src/Application/Modes/ProjectionMappingMode.h +++ b/src/Application/Modes/ProjectionMappingMode.h @@ -23,6 +23,9 @@ class ProjectionMappingMode : public ApplicationBaseMode { void setup(Application * app); void update(Application * app); void draw(Application * app); + + void toggleLayerPanel(); + void onKeyPressed(Application * app, ofKeyEventArgs & args); void onMousePressed(Application * app, ofMouseEventArgs & args); void onMouseReleased(Application * app, ofMouseEventArgs & args); diff --git a/src/ofxPiMapper.cpp b/src/ofxPiMapper.cpp index ab46a69..fcd0e46 100644 --- a/src/ofxPiMapper.cpp +++ b/src/ofxPiMapper.cpp @@ -260,3 +260,7 @@ ofx::piMapper::Mode ofxPiMapper::getMode(){ } return ofx::piMapper::PRESENTATION_MODE; } + +void ofxPiMapper::toggleLayerPanel(){ + _application.toggleLayerPanel(); +} diff --git a/src/ofxPiMapper.h b/src/ofxPiMapper.h index 8220989..3af7708 100644 --- a/src/ofxPiMapper.h +++ b/src/ofxPiMapper.h @@ -36,6 +36,9 @@ class ofxPiMapper { // Modes void setMode(ofx::piMapper::Mode m); ofx::piMapper::Mode getMode(); + + // Projection mapping mode only + void toggleLayerPanel(); // Project void saveProject();