From 2227c97a579d50903ea5c8a877b1ff5ea04872fa Mon Sep 17 00:00:00 2001 From: brunoherbelin Date: Wed, 17 Mar 2021 22:50:21 +0100 Subject: [PATCH] New action when clic on source symbol in Mixing or Layer views: open editor in UI --- LayerView.cpp | 7 ++++++- MixingView.cpp | 4 ++++ UserInterfaceManager.cpp | 22 ++++++++++++++++++++++ UserInterfaceManager.h | 1 + 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/LayerView.cpp b/LayerView.cpp index 56f7081..35c8c42 100644 --- a/LayerView.cpp +++ b/LayerView.cpp @@ -231,8 +231,13 @@ std::pair LayerView::pick(glm::vec2 P) pick = { nullptr, glm::vec2(0.f) }; } // pick a locked source; cancel pick - else if ( s->locked() ) + else if ( s->locked() ) { pick = { nullptr, glm::vec2(0.f) }; + } + // pick the symbol: ask to show editor + else if ( pick.first == s->symbol_ ) { + UserInterface::manager().showSourceEditor(s); + } } else pick = { nullptr, glm::vec2(0.f) }; diff --git a/MixingView.cpp b/MixingView.cpp index 9e5574d..7b45227 100644 --- a/MixingView.cpp +++ b/MixingView.cpp @@ -349,6 +349,10 @@ std::pair MixingView::pick(glm::vec2 P) else if ( s->locked() ) { pick = { nullptr, glm::vec2(0.f) }; } + // pick the symbol: ask to show editor + else if ( pick.first == s->symbol_ ) { + UserInterface::manager().showSourceEditor(s); + } // pick on the mixing group rotation icon else if ( pick.first == s->rotation_mixingroup_ ) { s->mixinggroup_->setAction( MixingGroup::ACTION_ROTATE_ALL ); diff --git a/UserInterfaceManager.cpp b/UserInterfaceManager.cpp index ba12376..65cd78a 100644 --- a/UserInterfaceManager.cpp +++ b/UserInterfaceManager.cpp @@ -57,6 +57,7 @@ using namespace std; #include "FrameBuffer.h" #include "MediaPlayer.h" #include "MediaSource.h" +#include "SessionSource.h" #include "PatternSource.h" #include "DeviceSource.h" #include "NetworkSource.h" @@ -1521,6 +1522,27 @@ int UserInterface::RenderViewNavigator(int *shift) return target_index; } + +void UserInterface::showSourceEditor(Source *s) +{ + MediaSource *ms = dynamic_cast(s); + if (ms != nullptr) { + showMediaPlayer(ms->mediaplayer()); + return; + } + CloneSource *cs = dynamic_cast(s); + if (cs != nullptr) { + Mixer::manager().setCurrentSource( cs->origin() ); + return; + } + RenderSource *rs = dynamic_cast(s); + if (rs != nullptr) { + Settings::application.widget.preview = true; + return; + } + navigator.showPannelSource( Mixer::manager().indexCurrentSource() ); +} + void UserInterface::showMediaPlayer(MediaPlayer *mp) { Settings::application.widget.media_player = true; diff --git a/UserInterfaceManager.h b/UserInterfaceManager.h index 4e11080..9a67723 100644 --- a/UserInterfaceManager.h +++ b/UserInterfaceManager.h @@ -152,6 +152,7 @@ public: void StartScreenshot(); void showPannel(int id = 0); + void showSourceEditor(Source *s); void showMediaPlayer(MediaPlayer *mp); // TODO implement the shader editor