From 48f92bc52ba8bece8754310f51f5ad32e5960ca9 Mon Sep 17 00:00:00 2001 From: Bruno Date: Sun, 1 Aug 2021 12:13:38 +0200 Subject: [PATCH] Cleanup session properties panel --- UserInterfaceManager.cpp | 87 +++++++++++++++++++++++----------------- 1 file changed, 51 insertions(+), 36 deletions(-) diff --git a/UserInterfaceManager.cpp b/UserInterfaceManager.cpp index effdbb1..f15d2c3 100644 --- a/UserInterfaceManager.cpp +++ b/UserInterfaceManager.cpp @@ -1081,21 +1081,6 @@ void UserInterface::RenderPreview() Settings::application.widget.preview = false; if (ImGui::BeginMenu(IMGUI_TITLE_PREVIEW)) { -// glm::ivec2 p = FrameBuffer::getParametersFromResolution(output->resolution()); -// std::ostringstream info; -// info << "Resolution " << output->width() << "x" << output->height(); -// if (p.x > -1) -// info << " " << FrameBuffer::aspect_ratio_name[p.x] ; -// ImGui::MenuItem(info.str().c_str(), nullptr, false, false); -// // cannot change resolution when recording -// if (video_recorder_ == nullptr && p.y > -1) { -// ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); -// if (ImGui::Combo("Height", &p.y, FrameBuffer::resolution_name, IM_ARRAYSIZE(FrameBuffer::resolution_name) ) ) -// { -// glm::vec3 res = FrameBuffer::getResolutionFromParameters(p.x, p.y); -// Mixer::manager().session()->setResolution(res); -// } -// } if ( ImGui::MenuItem( ICON_FA_PLUS " Insert Rendering Source") ) Mixer::manager().addSource( Mixer::manager().createSourceRender() ); @@ -4184,40 +4169,67 @@ void Navigator::RenderMainPannelVimix() // ImGui::Spacing(); ImGui::Text("Current"); - ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::Combo("##SelectHistory", &Settings::application.pannel_history_mode, ICON_FA_STAR " Snapshots\0" ICON_FA_HISTORY " Undo history\0" ICON_FA_FILE_ALT " Properties\0"); + // + // Current 2. PROPERTIES + // if (Settings::application.pannel_history_mode > 1) { std::string sessionfilename = Mixer::manager().session()->filename(); // Information and resolution - FrameBuffer *output = Mixer::manager().session()->frame(); + const FrameBuffer *output = Mixer::manager().session()->frame(); if (output) { - // fill information buffer - ImGuiTextBuffer info; - if (!sessionfilename.empty()) - info.appendf("%s\n", SystemToolkit::filename(sessionfilename).c_str()); - else - info.append("\n"); - info.appendf("Sources: %d\n", Mixer::manager().session()->numSource()); - + // get parameters to edit resolution glm::ivec2 p = FrameBuffer::getParametersFromResolution(output->resolution()); - if (p.x > -1) - info.appendf("Ratio: %s\n", FrameBuffer::aspect_ratio_name[p.x]); - info.appendf("Resolution: %dx%d", output->width(), output->height()); - // Show info text bloc (multi line, dark background) + // Basic information on session ImGuiToolkit::PushFont( ImGuiToolkit::FONT_MONO ); - ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.14f, 0.14f, 0.14f, 0.9f)); - ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); - ImGui::InputTextMultiline("##Info", (char *)info.c_str(), info.size(), ImVec2(IMGUI_RIGHT_ALIGN, 4*ImGui::GetTextLineHeightWithSpacing()), ImGuiInputTextFlags_ReadOnly); - ImGui::PopStyleColor(1); + ImGui::PushStyleVar(ImGuiStyleVar_Alpha, 0.75); + if (sessionfilename.empty()) + ImGui::Text(" "); + else + ImGui::Text(" %s", SystemToolkit::filename(sessionfilename).c_str()); + if (p.x > -1) + ImGui::Text(" %dx%dpx, %s", output->width(), output->height(), FrameBuffer::aspect_ratio_name[p.x]); + else + ImGui::Text(" %dx%dpx", output->width(), output->height()); + ImGui::PopStyleVar(); ImGui::PopFont(); +// Kept for later? Larger info box with more details on the session file... +// ImGuiTextBuffer info; +// if (!sessionfilename.empty()) +// info.appendf("%s\n", SystemToolkit::filename(sessionfilename).c_str()); +// else +// info.append("\n"); +// info.appendf("%dx%dpx", output->width(), output->height()); +// if (p.x > -1) +// info.appendf(", %s", FrameBuffer::aspect_ratio_name[p.x]); +// // content info +// const uint N = Mixer::manager().session()->numSource(); +// if (N > 1) +// info.appendf("\n%d sources", N); +// else if (N > 0) +// info.append("\n1 source"); +// const size_t M = MediaPlayer::registered().size(); +// if (M > 0) { +// info.appendf("\n%d media files:", M); +// for (auto mit = MediaPlayer::begin(); mit != MediaPlayer::end(); ++mit) +// info.appendf("\n- %s", SystemToolkit::filename((*mit)->filename()).c_str()); +// } +// // Show info text bloc (multi line, dark background) +// ImGuiToolkit::PushFont( ImGuiToolkit::FONT_MONO ); +// ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.14f, 0.14f, 0.14f, 0.9f)); +// ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); +// ImGui::InputTextMultiline("##Info", (char *)info.c_str(), info.size(), ImVec2(IMGUI_RIGHT_ALIGN, 2*ImGui::GetTextLineHeightWithSpacing()), ImGuiInputTextFlags_ReadOnly); +// ImGui::PopStyleColor(1); +// ImGui::PopFont(); + // change resolution (height only) if (p.y > -1) { ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); @@ -4247,7 +4259,7 @@ void Navigator::RenderMainPannelVimix() // Thumbnail static Thumbnail _file_thumbnail; static FrameBufferImage *thumbnail = nullptr; - if ( ImGui::Button( ICON_FA_TAGS " Capture thumbnail", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) { + if ( ImGui::Button( ICON_FA_TAG " Capture thumbnail", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) { Mixer::manager().session()->setThumbnail(); thumbnail = nullptr; } @@ -4263,6 +4275,7 @@ void Navigator::RenderMainPannelVimix() if (_file_thumbnail.filled()) { ImGui::BeginTooltip(); _file_thumbnail.Render(230); + ImGui::Text("This thumbnail will be used\nin the sessions list above."); ImGui::EndTooltip(); } } @@ -4287,7 +4300,8 @@ void Navigator::RenderMainPannelVimix() } // - // UNDO History + // Current 1. UNDO History + // else if (Settings::application.pannel_history_mode > 0) { static uint _over = 0; @@ -4374,7 +4388,8 @@ void Navigator::RenderMainPannelVimix() ImGuiToolkit::ToolTip("Show in view"); } // - // SNAPSHOTS + // Current 0. SNAPSHOTS + // else { static uint64_t _over = 0; static bool _tooltip = 0;