mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-14 19:59:59 +01:00
New Preview of source for Player
F6 and F7 (new) keys trigger preview of output display and current source in player, respectively.
This commit is contained in:
@@ -224,8 +224,8 @@ void OutputPreviewWindow::Render()
|
|||||||
if (ImGui::BeginMenu(IMGUI_TITLE_PREVIEW))
|
if (ImGui::BeginMenu(IMGUI_TITLE_PREVIEW))
|
||||||
{
|
{
|
||||||
// Preview and output menu
|
// Preview and output menu
|
||||||
if (ImGuiToolkit::MenuItemIcon(ICON_PREVIEW, MENU_PREVIEW, SHORTCUT_PREVIEW) )
|
if (ImGuiToolkit::MenuItemIcon(ICON_PREVIEW, MENU_PREVIEW, SHORTCUT_PREVIEW_OUT) )
|
||||||
UserInterface::manager().show_output_fullview = true;
|
UserInterface::manager().show_preview = UserInterface::PREVIEW_OUTPUT;
|
||||||
ImGui::MenuItem( MENU_OUTPUTDISABLE, SHORTCUT_OUTPUTDISABLE, &Settings::application.render.disabled);
|
ImGui::MenuItem( MENU_OUTPUTDISABLE, SHORTCUT_OUTPUTDISABLE, &Settings::application.render.disabled);
|
||||||
|
|
||||||
// Display window manager menu
|
// Display window manager menu
|
||||||
|
|||||||
@@ -200,6 +200,14 @@ void SourceControlWindow::Update()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FrameBuffer *SourceControlWindow::renderedFramebuffer() const
|
||||||
|
{
|
||||||
|
if (selection_.size() == 1)
|
||||||
|
return selection_.front()->frame();
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void SourceControlWindow::Render()
|
void SourceControlWindow::Render()
|
||||||
{
|
{
|
||||||
// estimate window size
|
// estimate window size
|
||||||
@@ -235,6 +243,9 @@ void SourceControlWindow::Render()
|
|||||||
}
|
}
|
||||||
if (ImGui::BeginMenu(IMGUI_TITLE_MEDIAPLAYER))
|
if (ImGui::BeginMenu(IMGUI_TITLE_MEDIAPLAYER))
|
||||||
{
|
{
|
||||||
|
// Preview and output menu
|
||||||
|
if (ImGuiToolkit::MenuItemIcon(ICON_PREVIEW, MENU_PREVIEW, SHORTCUT_PREVIEW_SRC, false, renderedFramebuffer()!=nullptr) )
|
||||||
|
UserInterface::manager().show_preview = UserInterface::PREVIEW_SOURCE;
|
||||||
//
|
//
|
||||||
// Menu section for play control
|
// Menu section for play control
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ public:
|
|||||||
|
|
||||||
void setVisible(bool on);
|
void setVisible(bool on);
|
||||||
void Render();
|
void Render();
|
||||||
|
FrameBuffer *renderedFramebuffer() const;
|
||||||
|
|
||||||
// from WorkspaceWindow
|
// from WorkspaceWindow
|
||||||
void Update() override;
|
void Update() override;
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ UserInterface::UserInterface()
|
|||||||
target_view_navigator = 1;
|
target_view_navigator = 1;
|
||||||
screenshot_step = 0;
|
screenshot_step = 0;
|
||||||
pending_save_on_exit = false;
|
pending_save_on_exit = false;
|
||||||
show_output_fullview = false;
|
show_preview = UserInterface::PREVIEW_NONE;
|
||||||
|
|
||||||
sessionopendialog = nullptr;
|
sessionopendialog = nullptr;
|
||||||
sessionimportdialog = nullptr;
|
sessionimportdialog = nullptr;
|
||||||
@@ -386,7 +386,9 @@ void UserInterface::handleKeyboard()
|
|||||||
else if (ImGui::IsKeyPressed( GLFW_KEY_F5, false ))
|
else if (ImGui::IsKeyPressed( GLFW_KEY_F5, false ))
|
||||||
setView(View::DISPLAYS);
|
setView(View::DISPLAYS);
|
||||||
else if (ImGui::IsKeyPressed( GLFW_KEY_F6, false ))
|
else if (ImGui::IsKeyPressed( GLFW_KEY_F6, false ))
|
||||||
show_output_fullview = true;
|
show_preview = PREVIEW_OUTPUT;
|
||||||
|
else if (ImGui::IsKeyPressed( GLFW_KEY_F7, false ))
|
||||||
|
show_preview = PREVIEW_SOURCE;
|
||||||
else if (ImGui::IsKeyPressed( GLFW_KEY_F9, false ))
|
else if (ImGui::IsKeyPressed( GLFW_KEY_F9, false ))
|
||||||
StartScreenshot();
|
StartScreenshot();
|
||||||
else if (ImGui::IsKeyPressed( GLFW_KEY_F10, false ))
|
else if (ImGui::IsKeyPressed( GLFW_KEY_F10, false ))
|
||||||
@@ -966,7 +968,7 @@ void UserInterface::Render()
|
|||||||
target_view_navigator = RenderViewNavigator( &show_view_navigator );
|
target_view_navigator = RenderViewNavigator( &show_view_navigator );
|
||||||
|
|
||||||
//
|
//
|
||||||
RenderOutputView();
|
RenderPreview();
|
||||||
|
|
||||||
// handle keyboard input after all IMGUI widgets have potentially captured keyboard
|
// handle keyboard input after all IMGUI widgets have potentially captured keyboard
|
||||||
handleKeyboard();
|
handleKeyboard();
|
||||||
@@ -1302,25 +1304,40 @@ void UserInterface::showSourceEditor(Source *s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserInterface::RenderOutputView()
|
void UserInterface::RenderPreview()
|
||||||
{
|
{
|
||||||
static bool _inspector = false;
|
static bool _inspector = false;
|
||||||
static bool _sustain = false;
|
static bool _sustain = false;
|
||||||
|
static FrameBuffer *_framebuffer = nullptr;
|
||||||
|
|
||||||
if ( show_output_fullview && !ImGui::IsPopupOpen("##OUTPUTVIEW")) {
|
if (show_preview != PREVIEW_NONE && !ImGui::IsPopupOpen("##RENDERPREVIEW")) {
|
||||||
ImGui::OpenPopup("##OUTPUTVIEW");
|
// select which framebuffer to display depending on input
|
||||||
|
if (show_preview == PREVIEW_OUTPUT)
|
||||||
|
_framebuffer = Mixer::manager().session()->frame();
|
||||||
|
else if (show_preview == PREVIEW_SOURCE) {
|
||||||
|
_framebuffer = sourcecontrol.renderedFramebuffer();
|
||||||
|
if ( _framebuffer == nullptr && Mixer::manager().currentSource() != nullptr) {
|
||||||
|
_framebuffer = Mixer::manager().currentSource()->frame();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if a famebuffer is valid, open preview
|
||||||
|
if (_framebuffer != nullptr) {
|
||||||
|
ImGui::OpenPopup("##RENDERPREVIEW");
|
||||||
_inspector = false;
|
_inspector = false;
|
||||||
_sustain = false;
|
_sustain = false;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
show_preview = PREVIEW_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
if (ImGui::BeginPopupModal("##OUTPUTVIEW", NULL, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove |
|
if (ImGui::BeginPopupModal("##RENDERPREVIEW", NULL, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove |
|
||||||
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoNav)) {
|
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoNav)) {
|
||||||
|
// making sure the pointer is still valid
|
||||||
FrameBuffer *output = Mixer::manager().session()->frame();
|
if (_framebuffer != nullptr)
|
||||||
if (output)
|
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
float ar = output->aspectRatio();
|
float ar = _framebuffer->aspectRatio();
|
||||||
// image takes the available window area
|
// image takes the available window area
|
||||||
ImVec2 imagesize = io.DisplaySize;
|
ImVec2 imagesize = io.DisplaySize;
|
||||||
// image height respects original aspect ratio but is at most the available window height
|
// image height respects original aspect ratio but is at most the available window height
|
||||||
@@ -1331,7 +1348,7 @@ void UserInterface::RenderOutputView()
|
|||||||
// 100% opacity for the image (ensures true colors)
|
// 100% opacity for the image (ensures true colors)
|
||||||
ImVec2 draw_pos = ImGui::GetCursorScreenPos();
|
ImVec2 draw_pos = ImGui::GetCursorScreenPos();
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, 1.f);
|
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, 1.f);
|
||||||
ImGui::Image((void*)(intptr_t)output->texture(), imagesize);
|
ImGui::Image((void*)(intptr_t)_framebuffer->texture(), imagesize);
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
|
|
||||||
if ( ImGui::IsMouseClicked(ImGuiMouseButton_Left) ) {
|
if ( ImGui::IsMouseClicked(ImGuiMouseButton_Left) ) {
|
||||||
@@ -1340,34 +1357,50 @@ void UserInterface::RenderOutputView()
|
|||||||
_inspector = !_inspector;
|
_inspector = !_inspector;
|
||||||
// close view on mouse clic outside
|
// close view on mouse clic outside
|
||||||
else if (!_sustain)
|
else if (!_sustain)
|
||||||
show_output_fullview = false;
|
show_preview = PREVIEW_NONE;
|
||||||
}
|
}
|
||||||
// draw inspector (magnifying glass)
|
// draw inspector (magnifying glass)
|
||||||
if ( _inspector && ImGui::IsItemHovered() )
|
if ( _inspector && ImGui::IsItemHovered() )
|
||||||
DrawInspector(output->texture(), imagesize, imagesize, draw_pos);
|
DrawInspector(_framebuffer->texture(), imagesize, imagesize, draw_pos);
|
||||||
|
|
||||||
// closing icon
|
// closing icon
|
||||||
ImGui::SetCursorScreenPos(draw_pos + ImVec2(IMGUI_SAME_LINE, IMGUI_SAME_LINE));
|
ImGui::SetCursorScreenPos(draw_pos + ImVec2(IMGUI_SAME_LINE, IMGUI_SAME_LINE));
|
||||||
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE);
|
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE);
|
||||||
if ( ImGuiToolkit::IconButton(ICON_FA_TIMES, "Close preview") )
|
if ( ImGuiToolkit::IconButton(ICON_FA_TIMES, "Close preview") )
|
||||||
show_output_fullview = false;
|
show_preview = PREVIEW_NONE;
|
||||||
if ( ImGui::IsItemHovered() )
|
if ( ImGui::IsItemHovered() )
|
||||||
_inspector = false;
|
_inspector = false;
|
||||||
ImGui::PopFont();
|
ImGui::PopFont();
|
||||||
}
|
}
|
||||||
|
|
||||||
// local keyboard handler (because focus is captured by modal dialog)
|
// local keyboard handler (because focus is captured by modal dialog)
|
||||||
if ( ImGui::IsKeyPressed( GLFW_KEY_ESCAPE, false ) ||
|
if (ImGui::IsKeyPressed( GLFW_KEY_ESCAPE, false ) ||
|
||||||
ImGui::IsKeyPressed( GLFW_KEY_F6, false ) )
|
(show_preview == PREVIEW_OUTPUT && ImGui::IsKeyPressed( GLFW_KEY_F6, false )) ||
|
||||||
show_output_fullview = false;
|
(show_preview == PREVIEW_SOURCE && ImGui::IsKeyPressed( GLFW_KEY_F7, false )) )
|
||||||
else if (ImGui::IsKeyPressed( GLFW_KEY_F6, true ))
|
show_preview = PREVIEW_NONE;
|
||||||
|
else if ((show_preview == PREVIEW_OUTPUT && ImGui::IsKeyPressed( GLFW_KEY_F6, true )) ||
|
||||||
|
(show_preview == PREVIEW_SOURCE && ImGui::IsKeyPressed( GLFW_KEY_F7, true )) )
|
||||||
_sustain = true;
|
_sustain = true;
|
||||||
else if (_sustain && ImGui::IsKeyReleased( GLFW_KEY_F6 ))
|
else if ((show_preview == PREVIEW_OUTPUT && _sustain && ImGui::IsKeyReleased( GLFW_KEY_F6 )) ||
|
||||||
show_output_fullview = false;
|
(show_preview == PREVIEW_SOURCE && _sustain && ImGui::IsKeyReleased( GLFW_KEY_F7 )) )
|
||||||
|
show_preview = PREVIEW_NONE;
|
||||||
|
|
||||||
|
if ( !alt_modifier_active && ImGui::IsKeyPressed( GLFW_KEY_TAB )) {
|
||||||
|
if (shift_modifier_active)
|
||||||
|
Mixer::manager().setCurrentPrevious();
|
||||||
|
else
|
||||||
|
Mixer::manager().setCurrentNext();
|
||||||
|
if (navigator.pannelVisible())
|
||||||
|
navigator.showPannelSource( Mixer::manager().indexCurrentSource() );
|
||||||
|
// re-open after change source
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
}
|
||||||
|
|
||||||
// close
|
// close
|
||||||
if (!show_output_fullview)
|
if (show_preview == PREVIEW_NONE) {
|
||||||
|
_framebuffer = nullptr;
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
@@ -2610,8 +2643,13 @@ void UserInterface::RenderHelp()
|
|||||||
ImGui::Text(ICON_FA_CHESS_BOARD " Texturing view"); ImGui::NextColumn();
|
ImGui::Text(ICON_FA_CHESS_BOARD " Texturing view"); ImGui::NextColumn();
|
||||||
ImGui::Text("F5"); ImGui::NextColumn();
|
ImGui::Text("F5"); ImGui::NextColumn();
|
||||||
ImGui::Text(ICON_FA_TV " Displays view"); ImGui::NextColumn();
|
ImGui::Text(ICON_FA_TV " Displays view"); ImGui::NextColumn();
|
||||||
ImGui::Text(SHORTCUT_PREVIEW); ImGui::NextColumn();
|
ImGui::Text(SHORTCUT_PREVIEW_OUT); ImGui::NextColumn();
|
||||||
ImGuiToolkit::Icon(ICON_PREVIEW); ImGui::SameLine(0, IMGUI_SAME_LINE); ImGui::Text("Preview output (toggle or long press)"); ImGui::NextColumn();
|
ImGuiToolkit::Icon(ICON_PREVIEW); ImGui::SameLine(0, IMGUI_SAME_LINE); ImGui::Text("Preview Output"); ImGui::NextColumn();
|
||||||
|
ImGui::Text(SHORTCUT_PREVIEW_SRC); ImGui::NextColumn();
|
||||||
|
ImGuiToolkit::Icon(ICON_PREVIEW); ImGui::SameLine(0, IMGUI_SAME_LINE); ImGui::Text("Preview Source"); ImGui::NextColumn();
|
||||||
|
ImGui::NextColumn();
|
||||||
|
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_ITALIC); ImGui::Text("Press & hold key for temporary preview"); ImGui::PopFont();
|
||||||
|
ImGui::NextColumn();
|
||||||
ImGui::Text(CTRL_MOD "TAB"); ImGui::NextColumn();
|
ImGui::Text(CTRL_MOD "TAB"); ImGui::NextColumn();
|
||||||
ImGui::Text("Switch view"); ImGui::NextColumn();
|
ImGui::Text("Switch view"); ImGui::NextColumn();
|
||||||
ImGui::Text(SHORTCUT_FULLSCREEN); ImGui::NextColumn();
|
ImGui::Text(SHORTCUT_FULLSCREEN); ImGui::NextColumn();
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ class UserInterface
|
|||||||
friend class ImGuiVisitor;
|
friend class ImGuiVisitor;
|
||||||
friend class Navigator;
|
friend class Navigator;
|
||||||
friend class OutputPreviewWindow;
|
friend class OutputPreviewWindow;
|
||||||
|
friend class SourceControlWindow;
|
||||||
|
|
||||||
// Private Constructor
|
// Private Constructor
|
||||||
UserInterface();
|
UserInterface();
|
||||||
@@ -194,7 +195,8 @@ protected:
|
|||||||
int target_view_navigator;
|
int target_view_navigator;
|
||||||
unsigned int screenshot_step;
|
unsigned int screenshot_step;
|
||||||
bool pending_save_on_exit;
|
bool pending_save_on_exit;
|
||||||
bool show_output_fullview;
|
typedef enum { PREVIEW_NONE = 0, PREVIEW_OUTPUT, PREVIEW_SOURCE } PreviewMode;
|
||||||
|
PreviewMode show_preview;
|
||||||
|
|
||||||
// Dialogs
|
// Dialogs
|
||||||
DialogToolkit::OpenSessionDialog *sessionopendialog;
|
DialogToolkit::OpenSessionDialog *sessionopendialog;
|
||||||
@@ -224,7 +226,7 @@ protected:
|
|||||||
void RenderMetrics (bool* p_open, int* p_corner, int *p_mode);
|
void RenderMetrics (bool* p_open, int* p_corner, int *p_mode);
|
||||||
void RenderSourceToolbar(bool *p_open, int* p_border, int *p_mode);
|
void RenderSourceToolbar(bool *p_open, int* p_border, int *p_mode);
|
||||||
int RenderViewNavigator(int* shift);
|
int RenderViewNavigator(int* shift);
|
||||||
void RenderOutputView();
|
void RenderPreview();
|
||||||
void RenderAbout(bool* p_open);
|
void RenderAbout(bool* p_open);
|
||||||
void RenderNotes();
|
void RenderNotes();
|
||||||
void RenderHelp();
|
void RenderHelp();
|
||||||
|
|||||||
@@ -185,7 +185,8 @@
|
|||||||
#define SHORTCUT_OUTPUTDISABLE "F12"
|
#define SHORTCUT_OUTPUTDISABLE "F12"
|
||||||
#define ICON_PREVIEW 4, 15
|
#define ICON_PREVIEW 4, 15
|
||||||
#define MENU_PREVIEW "Preview"
|
#define MENU_PREVIEW "Preview"
|
||||||
#define SHORTCUT_PREVIEW "F6"
|
#define SHORTCUT_PREVIEW_OUT "F6"
|
||||||
|
#define SHORTCUT_PREVIEW_SRC "F7"
|
||||||
#define MENU_CLOSE ICON_FA_TIMES " Close"
|
#define MENU_CLOSE ICON_FA_TIMES " Close"
|
||||||
#define DIALOG_FAILED_SOURCE ICON_FA_EXCLAMATION_TRIANGLE " Source failure"
|
#define DIALOG_FAILED_SOURCE ICON_FA_EXCLAMATION_TRIANGLE " Source failure"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user