From b599fbf88db24f54a576c2912e8090934d454dbd Mon Sep 17 00:00:00 2001 From: Bruno Herbelin Date: Mon, 1 Jan 2024 17:54:27 +0100 Subject: [PATCH] BugFix Minor UI corrections and bugs fixed --- src/DisplaysView.cpp | 16 ++--- src/GeometryView.cpp | 2 +- src/GstToolkit.cpp | 28 ++++---- src/GstToolkit.h | 6 +- src/ImGuiToolkit.cpp | 2 +- src/LayerView.cpp | 2 +- src/Settings.h | 6 +- src/TextureView.cpp | 7 +- src/UserInterfaceManager.cpp | 122 ++++++++++++++++++++++++----------- src/UserInterfaceManager.h | 2 +- 10 files changed, 120 insertions(+), 73 deletions(-) diff --git a/src/DisplaysView.cpp b/src/DisplaysView.cpp index 32af62a..0186674 100644 --- a/src/DisplaysView.cpp +++ b/src/DisplaysView.cpp @@ -546,7 +546,7 @@ void DisplaysView::draw() // display interface // Locate window at upper left corner - glm::vec2 P = glm::vec2(0.01f, 0.01 ); + glm::vec2 P(0.0f, 0.01f); P = Rendering::manager().project(glm::vec3(P, 0.f), scene.root()->transform_, false); // Set window position depending on icons size ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE); @@ -559,11 +559,11 @@ void DisplaysView::draw() ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 1.0f)); ImGui::PushStyleColor(ImGuiCol_PopupBg, ImVec4(0.14f, 0.14f, 0.14f, 0.9f)); ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.14f, 0.14f, 0.14f, 0.f)); - ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(0.24f, 0.24f, 0.24f, 0.46f)); + ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(0.15f, 0.15f, 0.15f, 0.99f)); ImGui::PushStyleColor(ImGuiCol_SliderGrab, ImVec4(0.85f, 0.85f, 0.85f, 0.86f)); ImGui::PushStyleColor(ImGuiCol_SliderGrabActive, ImVec4(0.95f, 0.95f, 0.95f, 1.00f)); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.00f, 0.00f, 0.00f, 0.00f)); - ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.4f, 0.4f, 0.4f, 0.56f)); + ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.15f, 0.15f, 0.15f, 0.99f)); // // Buttons on top @@ -760,21 +760,23 @@ void DisplaysView::draw() } ImGui::Separator(); - if ( ImGui::MenuItem( ICON_FA_REPLY " Reset") ) { + if ( ImGui::MenuItem( ICON_FA_WINDOW_RESTORE " Reset shape") ) { glm::ivec4 rect (0, 0, 800, 600); rect.p = Mixer::manager().session()->frame()->width(); rect.q = Mixer::manager().session()->frame()->height(); Rendering::manager().outputWindow(current_window_).setDecoration(true); Settings::application.windows[1+current_window_].show_pattern = false; Settings::application.windows[1+current_window_].custom = false; - Settings::application.windows[1+current_window_].whitebalance = glm::vec4(1.f, 1.f, 1.f, 0.5f); if (Settings::application.windows[current_window_+1].fullscreen) Rendering::manager().outputWindow(current_window_).exitFullscreen(); else Rendering::manager().outputWindow(current_window_).setCoordinates( rect ); windows_[current_window_].need_update_ += 2; } - + if ( ImGui::MenuItem( ICON_FA_TEMPERATURE_LOW " Reset white balance") ) { + Settings::application.windows[1+current_window_].whitebalance = glm::vec4(1.f, 1.f, 1.f, 0.5f); + windows_[current_window_].need_update_ += 2; + } if ( Settings::application.windows[current_window_+1].custom ) { ImGui::PopStyleColor(1); ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(COLOR_FRAME, 1.f)); @@ -872,8 +874,6 @@ void DisplaysView::select(glm::vec2 A, glm::vec2 B) } } -int _prev_mouse_pointer = 0; - void DisplaysView::initiate() { // initiate pending action diff --git a/src/GeometryView.cpp b/src/GeometryView.cpp index 81d85fc..8a7e76c 100644 --- a/src/GeometryView.cpp +++ b/src/GeometryView.cpp @@ -292,7 +292,7 @@ void GeometryView::draw() // display interface // Locate window at upper right corner - glm::vec2 P = glm::vec2(-output_surface_->scale_.x - 0.02f, output_surface_->scale_.y + 0.01); + glm::vec2 P(-output_surface_->scale_.x, output_surface_->scale_.y + 0.01f); P = Rendering::manager().project(glm::vec3(P, 0.f), scene.root()->transform_, false); // Set window position depending on icons size ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE); diff --git a/src/GstToolkit.cpp b/src/GstToolkit.cpp index 9f1f096..72c9637 100644 --- a/src/GstToolkit.cpp +++ b/src/GstToolkit.cpp @@ -137,7 +137,7 @@ list GstToolkit::all_plugins() } -list GstToolkit::all_plugin_features(string pluginname) +list GstToolkit::all_plugin_features(const std::string &pluginname) { list featurelist; GList *l, *g; @@ -154,13 +154,16 @@ list GstToolkit::all_plugin_features(string pluginname) return featurelist; } -bool GstToolkit::enable_feature (string name, bool enable) { - GstRegistry *registry = NULL; +bool GstToolkit::enable_feature (const std::string &name, bool enable) +{ + if (name.empty()) + return false; + + static GstRegistry *registry = NULL; + if (!registry) + registry = gst_registry_get(); + GstElementFactory *factory = NULL; - - registry = gst_registry_get(); - if (!registry) return false; - factory = gst_element_factory_find (name.c_str()); if (!factory) return false; @@ -177,17 +180,16 @@ bool GstToolkit::enable_feature (string name, bool enable) { return true; } -bool GstToolkit::has_feature (string name) +bool GstToolkit::has_feature (const string &name) { if (name.empty()) return false; - GstRegistry *registry = NULL; + static GstRegistry *registry = NULL; + if (!registry) + registry = gst_registry_get(); + GstElementFactory *factory = NULL; - - registry = gst_registry_get(); - if (!registry) return false; - factory = gst_element_factory_find (name.c_str()); if (!factory) return false; diff --git a/src/GstToolkit.h b/src/GstToolkit.h index e4a7273..a771f40 100644 --- a/src/GstToolkit.h +++ b/src/GstToolkit.h @@ -27,9 +27,9 @@ std::list enable_gpu_decoding_plugins(bool enable = true); std::string used_gpu_decoding_plugins(GstElement *gstbin); std::string used_decoding_plugins(GstElement *gstbin); -std::list all_plugin_features(std::string pluginname); -bool has_feature (std::string name); -bool enable_feature (std::string name, bool enable); +std::list all_plugin_features(const std::string &pluginname); +bool has_feature (const std::string &name); +bool enable_feature (const std::string &name, bool enable); struct PipelineConfig { diff --git a/src/ImGuiToolkit.cpp b/src/ImGuiToolkit.cpp index 35d452d..01a0d4f 100644 --- a/src/ImGuiToolkit.cpp +++ b/src/ImGuiToolkit.cpp @@ -113,7 +113,7 @@ bool ImGuiToolkit::ButtonSwitch(const char* label, bool* toggle, const char* too // layout float frame_height = ImGui::GetFrameHeight(); - float frame_width = ImGui::GetContentRegionAvail().x; + float frame_width = MAX(ImGui::GetContentRegionAvail().x, 2); float height = ImGui::GetFrameHeight() * 0.75f; float width = height * 1.6f; float radius = height * 0.50f; diff --git a/src/LayerView.cpp b/src/LayerView.cpp index 5f780fd..7a9c151 100644 --- a/src/LayerView.cpp +++ b/src/LayerView.cpp @@ -52,7 +52,7 @@ LayerView::LayerView() : View(LAYER), aspect_ratio(1.f) saveSettings(); else restoreSettings(); - Settings::application.views[mode_].name = "Layer"; + Settings::application.views[mode_].name = "Layers"; // Geometry Scene background frame_ = new Group; diff --git a/src/Settings.h b/src/Settings.h index daf7d24..f80da6d 100644 --- a/src/Settings.h +++ b/src/Settings.h @@ -350,7 +350,7 @@ struct Application Application() : fresh_start(false), instance_id(0), name(APP_NAME), executable(APP_NAME) { scale = 1.f; accent_color = 0; - smooth_transition = false; + smooth_transition = true; save_version_snapshot = false; proportional_grid = true; mouse_pointer = 1; @@ -375,8 +375,8 @@ struct Application num_output_windows = 1; windows = std::vector(1+MAX_OUTPUT_WINDOW); windows[0].w = 1600; - windows[0].h = 900; - accept_audio = true; + windows[0].h = 930; + accept_audio = false; } }; diff --git a/src/TextureView.cpp b/src/TextureView.cpp index d460bee..fe8de9b 100644 --- a/src/TextureView.cpp +++ b/src/TextureView.cpp @@ -636,7 +636,7 @@ void TextureView::draw() // display interface // Locate window at upper left corner - glm::vec2 P = glm::vec2(-background_frame_->scale_.x - 0.02f, background_frame_->scale_.y + 0.01 ); + glm::vec2 P(-background_frame_->scale_.x, background_frame_->scale_.y + 0.01f); P = Rendering::manager().project(glm::vec3(P, 0.f), scene.root()->transform_, false); // Set window position depending on icons size ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE); @@ -1008,7 +1008,7 @@ void TextureView::draw() ImGui::OpenPopup( "AppearanceSourceContextMenu" ); show_context_menu_ = MENU_NONE; } - if (ImGui::BeginPopup("AppearanceSourceContextMenu")) { + if (ImGui::BeginPopup("AppearanceSourceContextMenu", ImGuiWindowFlags_NoMove)) { ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(COLOR_APPEARANCE_SOURCE, 1.f)); ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImVec4(COLOR_MENU_HOVERED, 0.5f)); Source *s = Mixer::manager().currentSource(); @@ -1030,7 +1030,6 @@ void TextureView::draw() if (ImGui::Selectable( ICON_FA_VECTOR_SQUARE " Reset" )){ s->group(mode_)->scale_ = glm::vec3(1.f); s->group(mode_)->rotation_.z = 0; -// s->group(mode_)->crop_ = glm::vec3(1.f); s->group(mode_)->translation_ = glm::vec3(0.f); s->touch(); Action::manager().store(s->name() + std::string(": Texture Reset")); @@ -1040,7 +1039,7 @@ void TextureView::draw() s->touch(); Action::manager().store(s->name() + std::string(": Texture Reset position")); } - if (ImGui::Selectable( ICON_FA_COMPASS " Reset rotation" )){ + if (ImGui::Selectable( ICON_FA_CIRCLE_NOTCH " Reset rotation" )){ s->group(mode_)->rotation_.z = 0; s->touch(); Action::manager().store(s->name() + std::string(": Texture Reset rotation")); diff --git a/src/UserInterfaceManager.cpp b/src/UserInterfaceManager.cpp index 59ab7a1..d01d3b1 100644 --- a/src/UserInterfaceManager.cpp +++ b/src/UserInterfaceManager.cpp @@ -998,9 +998,9 @@ void UserInterface::showMenuEdit() bool has_clipboard = (clipboard != nullptr && strlen(clipboard) > 0 && SessionLoader::isClipboard(clipboard)); // UNDO - if ( ImGui::MenuItem( MENU_UNDO, SHORTCUT_UNDO) ) + if ( ImGui::MenuItem( MENU_UNDO, SHORTCUT_UNDO, false, Action::manager().current() > 1) ) Action::manager().undo(); - if ( ImGui::MenuItem( MENU_REDO, SHORTCUT_REDO) ) + if ( ImGui::MenuItem( MENU_REDO, SHORTCUT_REDO, false, Action::manager().current() < Action::manager().max()) ) Action::manager().redo(); // EDIT @@ -1024,7 +1024,7 @@ void UserInterface::showMenuEdit() Mixer::manager().paste(clipboard); navigator.discardPannel(); } - if (ImGui::MenuItem( MENU_SELECTALL, SHORTCUT_SELECTALL)) { + if (ImGui::MenuItem( MENU_SELECTALL, SHORTCUT_SELECTALL, false, Mixer::manager().numSource() > 0)) { Mixer::manager().view()->selectAll(); navigator.discardPannel(); } @@ -1217,7 +1217,7 @@ int UserInterface::RenderViewNavigator(int *shift) *shift = 0; } ImGui::NextColumn(); - if (ImGui::Selectable( ICON_FA_LAYER_GROUP, &selected_view[3], 0, iconsize)) + if (ImGuiToolkit::SelectableIcon(ICON_WORKSPACE, "", selected_view[3], iconsize)) { setView(View::LAYER); *shift = 0; @@ -1230,7 +1230,7 @@ int UserInterface::RenderViewNavigator(int *shift) } // skip TRANSITION view ImGui::NextColumn(); - if (ImGui::Selectable( ICON_FA_TV, &selected_view[6], 0, iconsize)) + if (ImGuiToolkit::SelectableIcon(10, 7, "", selected_view[6], iconsize)) { setView(View::DISPLAYS); *shift = 0; @@ -2700,10 +2700,10 @@ std::vector< std::string > Navigator::tooltips_ordering_files = { "Alphabetical" Navigator::Navigator() { // default geometry - width_ = 100; + width_ = 100.f; pannel_width_ = 5.f * width_; - height_ = 100; - padding_width_ = 100; + height_ = 100.f; + padding_width_ = 100.f; // clean start pannel_main_mode_ = Settings::application.pannel_main_mode; @@ -2713,13 +2713,13 @@ Navigator::Navigator() clearButtonSelection(); // restore media mode as saved - if (Settings::application.recentImportFolders.path.compare(IMGUI_LABEL_RECENT_FILES) == 0) - new_media_mode = MEDIA_RECENT; + if (Settings::application.recentImportFolders.path.empty() || + Settings::application.recentImportFolders.path.compare(IMGUI_LABEL_RECENT_FILES) == 0) + setNewMedia(MEDIA_RECENT); else if (Settings::application.recentImportFolders.path.compare(IMGUI_LABEL_RECENT_RECORDS) == 0) - new_media_mode = MEDIA_RECORDING; + setNewMedia(MEDIA_RECORDING); else - new_media_mode = MEDIA_FOLDER; - new_media_mode_changed = true; + setNewMedia(MEDIA_FOLDER, Settings::application.recentImportFolders.path); source_to_replace = nullptr; } @@ -3025,7 +3025,7 @@ void Navigator::Render() ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoScrollWithMouse)) { // Mouse pointer selector - RenderMousePointerSelector(iconsize); + tooltip = RenderMousePointerSelector(iconsize); // List of icons for View selection static uint view_options_timeout = 0; @@ -3044,7 +3044,7 @@ void Navigator::Render() } } if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) { - tooltip = {"Mixing ", "F1"}; + tooltip = {Settings::application.views[View::MIXING].name, "F1"}; view_options_timeout = 0; } @@ -3057,7 +3057,7 @@ void Navigator::Render() } } if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) { - tooltip = {"Geometry ", "F2"}; + tooltip = {Settings::application.views[View::GEOMETRY].name, "F2"}; view_options_timeout = 0; } @@ -3071,7 +3071,7 @@ void Navigator::Render() } } if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) { - tooltip = {"Layers ", "F3"}; + tooltip = {Settings::application.views[View::LAYER].name, "F3"}; view_options_timeout = 0; } @@ -3084,13 +3084,12 @@ void Navigator::Render() } } if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) { - tooltip = {"Texturing ", "F4"}; + tooltip = {Settings::application.views[View::TEXTURE].name, "F4"}; view_options_timeout = 0; } int j = Settings::application.render.disabled ? 8 : 7; if (ImGuiToolkit::SelectableIcon(10, j, "", selected_view[View::DISPLAYS], iconsize)) -// if (ImGui::Selectable( ICON_FA_TV, &selected_view[View::DISPLAYS], 0, iconsize)) { UserInterface::manager().setView(View::DISPLAYS); Settings::application.current_view = View::DISPLAYS; @@ -3100,7 +3099,7 @@ void Navigator::Render() } } if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) { - tooltip = {"Displays ", "F5"}; + tooltip = {Settings::application.views[View::DISPLAYS].name, "F5"}; view_options_timeout = 0; } @@ -4162,11 +4161,12 @@ void Navigator::RenderNewPannel(const ImVec2 &iconsize) } } -void Navigator::RenderMousePointerSelector(const ImVec2 &size) +std::pair Navigator::RenderMousePointerSelector(const ImVec2 &size) { ImGuiContext& g = *GImGui; ImVec2 top = ImGui::GetCursorPos(); bool enabled = Settings::application.current_view != View::TRANSITION; + std::pair tooltip = {"", ""}; /// /// interactive button of the given size: show menu if clic or mouse over /// @@ -4179,7 +4179,7 @@ void Navigator::RenderMousePointerSelector(const ImVec2 &size) ImVec2 bottom = ImGui::GetCursorScreenPos(); if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) { - ImGuiToolkit::ToolTip("Snap cursor", ALT_MOD); + tooltip = {"Snap cursor", ALT_MOD}; counter_menu_timeout=0; } @@ -4289,6 +4289,7 @@ void Navigator::RenderMousePointerSelector(const ImVec2 &size) ImGui::EndPopup(); } + return tooltip; } void Navigator::RenderMainPannelSession() @@ -5181,11 +5182,12 @@ void Navigator::RenderMainPannelPlaylist() // // Popup window to create playlist // + ImGui::SetNextWindowSize(ImVec2(0.8f * pannel_width_, 2.2f*ImGui::GetFrameHeightWithSpacing()), ImGuiCond_Always ); if (ImGui::BeginPopup("new_playlist_popup", ImGuiWindowFlags_NoMove)) { static bool withcopy = false; char text_buf[64] = ""; - ImGui::SetNextItemWidth(200); + ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); if ( ImGui::InputTextWithHint("Name", "[Enter] to validate", text_buf, 64, ImGuiInputTextFlags_EnterReturnsTrue) ) { std::string filename = std::string(text_buf); @@ -5216,7 +5218,7 @@ void Navigator::RenderMainPannelPlaylist() } ImGuiToolkit::PushFont(ImGuiToolkit::FONT_ITALIC); - ImGuiToolkit::ButtonSwitch("Copy content", &withcopy, NULL, true ); + ImGuiToolkit::ButtonSwitch("Duplicate current", &withcopy); ImGui::PopFont(); ImGui::EndPopup(); @@ -5271,31 +5273,50 @@ void Navigator::RenderMainPannelSettings() ImGui::SameLine(); ImGui::SetCursorPosX(width_); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); - if ( ImGui::InputFloat("Scale", &Settings::application.scale, 0.1f, 0.1f, "%.1f")) { + if ( ImGui::InputFloat("##Scale", &Settings::application.scale, 0.1f, 0.1f, "%.1f")) { Settings::application.scale = CLAMP(Settings::application.scale, 0.5f, 2.f); ImGui::GetIO().FontGlobalScale = Settings::application.scale; } + ImGui::SameLine(0, IMGUI_SAME_LINE); + if (ImGuiToolkit::TextButton("Scale")) { + Settings::application.scale = 1.f; + ImGui::GetIO().FontGlobalScale = Settings::application.scale; + } // // Recording preferences // + ImGuiToolkit::Spacing(); ImGui::TextDisabled("Recording"); // select CODEC and FPS ImGui::SetCursorPosX(width_); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); - ImGui::Combo("Codec", &Settings::application.record.profile, VideoRecorder::profile_name, IM_ARRAYSIZE(VideoRecorder::profile_name) ); + ImGui::Combo("##Codec", + &Settings::application.record.profile, + VideoRecorder::profile_name, + IM_ARRAYSIZE(VideoRecorder::profile_name)); + ImGui::SameLine(0, IMGUI_SAME_LINE); + if (ImGuiToolkit::TextButton("Codec")) + Settings::application.record.profile = 0; ImGui::SetCursorPosX(width_); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); - ImGui::Combo("Framerate", &Settings::application.record.framerate_mode, VideoRecorder::framerate_preset_name, IM_ARRAYSIZE(VideoRecorder::framerate_preset_name) ); + ImGui::Combo("##Framerate", + &Settings::application.record.framerate_mode, + VideoRecorder::framerate_preset_name, + IM_ARRAYSIZE(VideoRecorder::framerate_preset_name)); + ImGui::SameLine(0, IMGUI_SAME_LINE); + if (ImGuiToolkit::TextButton("Framerate")) + Settings::application.record.framerate_mode = 1; // compute number of frames in buffer and show warning sign if too low const FrameBuffer *output = Mixer::manager().session()->frame(); if (output) { guint64 nb = 0; nb = VideoRecorder::buffering_preset_value[Settings::application.record.buffering_mode] / (output->width() * output->height() * 4); - char buf[512]; snprintf(buf, 512, "Buffer at %s can contain %ld frames (%dx%d), i.e. %.1f sec", VideoRecorder::buffering_preset_name[Settings::application.record.buffering_mode], + char buf[512]; snprintf(buf, 512, "Buffer of %s can contain %ld frames (%dx%d), i.e. %.1f sec", + VideoRecorder::buffering_preset_name[Settings::application.record.buffering_mode], (unsigned long)nb, output->width(), output->height(), (float)nb / (float) VideoRecorder::framerate_preset_value[Settings::application.record.framerate_mode] ); ImGuiToolkit::Indication(buf, 4, 6); @@ -5304,17 +5325,24 @@ void Navigator::RenderMainPannelSettings() ImGui::SetCursorPosX(width_); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); - ImGui::SliderInt("Buffer", &Settings::application.record.buffering_mode, 0, IM_ARRAYSIZE(VideoRecorder::buffering_preset_name)-1, + ImGui::SliderInt("##Buffer", &Settings::application.record.buffering_mode, 0, + IM_ARRAYSIZE(VideoRecorder::buffering_preset_name)-1, VideoRecorder::buffering_preset_name[Settings::application.record.buffering_mode]); + ImGui::SameLine(0, IMGUI_SAME_LINE); + if (ImGuiToolkit::TextButton("Buffer")) + Settings::application.record.buffering_mode = 2; ImGuiToolkit::Indication("Priority when buffer is full and recorder has to skip frames;\n" - ICON_FA_CARET_RIGHT " Duration:\n Variable framerate, correct duration.\n" - ICON_FA_CARET_RIGHT " Framerate:\n Correct framerate, shorter duration.", + ICON_FA_CARET_RIGHT " Duration: Correct duration, variable framerate." + ICON_FA_CARET_RIGHT " Framerate: Correct framerate, shorter duration.\n", ICON_FA_CHECK_DOUBLE); ImGui::SameLine(0); ImGui::SetCursorPosX(width_); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); - ImGui::Combo("Priority", &Settings::application.record.priority_mode, "Duration\0Framerate\0"); + ImGui::Combo("##Priority", &Settings::application.record.priority_mode, "Duration\0Framerate\0"); + ImGui::SameLine(0, IMGUI_SAME_LINE); + if (ImGuiToolkit::TextButton("Priority")) + Settings::application.record.priority_mode = 1; // // AUDIO @@ -5341,7 +5369,7 @@ void Navigator::RenderMainPannelSettings() // Combo selector of audio device ImGui::SetCursorPosX(width_); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); - if (ImGui::BeginCombo("Audio", current_audio.c_str())) { + if (ImGui::BeginCombo("##Audio", current_audio.c_str())) { // No audio selection if (ImGui::Selectable(ICON_FA_MICROPHONE_ALT_SLASH " None")) Settings::application.record.audio_device = ""; @@ -5359,6 +5387,9 @@ void Navigator::RenderMainPannelSettings() } if (!Settings::application.record.audio_device.empty() && ImGui::IsItemHovered()) ImGuiToolkit::ToolTip(current_audio.c_str()); + ImGui::SameLine(0, IMGUI_SAME_LINE); + if (ImGuiToolkit::TextButton("Audio")) + Settings::application.record.audio_device = ""; } @@ -5373,7 +5404,10 @@ void Navigator::RenderMainPannelSettings() ImGui::SameLine(0); ImGui::SetCursorPosX(width_); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); - ImGui::Combo("P2P codec", &Settings::application.stream_protocol, "JPEG\0H264\0"); + ImGui::Combo("##P2P codec", &Settings::application.stream_protocol, "JPEG\0H264\0"); + ImGui::SameLine(0, IMGUI_SAME_LINE); + if (ImGuiToolkit::TextButton("P2P codec")) + Settings::application.stream_protocol = 0; if (VideoBroadcast::available()) { char msg[256]; @@ -5392,11 +5426,14 @@ void Navigator::RenderMainPannelSettings() ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); char bufport[7] = ""; snprintf(bufport, 7, "%d", Settings::application.broadcast_port); - ImGui::InputTextWithHint("SRT Port", "7070", bufport, 6, ImGuiInputTextFlags_CharsDecimal); + ImGui::InputTextWithHint("##SRT Port", "7070", bufport, 6, ImGuiInputTextFlags_CharsDecimal); if (ImGui::IsItemDeactivatedAfterEdit()){ if ( BaseToolkit::is_a_number(bufport, &Settings::application.broadcast_port)) Settings::application.broadcast_port = CLAMP(Settings::application.broadcast_port, 1029, 49150); } + ImGui::SameLine(0, IMGUI_SAME_LINE); + if (ImGuiToolkit::TextButton("SRT Port")) + Settings::application.broadcast_port = 7070; } if (ShmdataBroadcast::available()) { @@ -5427,10 +5464,13 @@ void Navigator::RenderMainPannelSettings() ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); char bufsocket[64] = ""; snprintf(bufsocket, 64, "%s", Settings::application.shm_socket_path.c_str()); - ImGui::InputTextWithHint("SHM path", SystemToolkit::home_path().c_str(), bufsocket, 64); + ImGui::InputTextWithHint("##SHM path", SystemToolkit::home_path().c_str(), bufsocket, 64); if (ImGui::IsItemDeactivatedAfterEdit()) { Settings::application.shm_socket_path = bufsocket; } + ImGui::SameLine(0, IMGUI_SAME_LINE); + if (ImGuiToolkit::TextButton("SHM path")) + Settings::application.shm_socket_path = ""; if (ShmdataBroadcast::available(ShmdataBroadcast::SHM_SHMDATASINK)) { ImGui::SetCursorPosX(width_); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); @@ -5461,25 +5501,31 @@ void Navigator::RenderMainPannelSettings() ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); char bufreceive[7] = ""; snprintf(bufreceive, 7, "%d", Settings::application.control.osc_port_receive); - ImGui::InputTextWithHint("Port in", "7000", bufreceive, 7, ImGuiInputTextFlags_CharsDecimal); + ImGui::InputTextWithHint("##Port in", "7000", bufreceive, 7, ImGuiInputTextFlags_CharsDecimal); if (ImGui::IsItemDeactivatedAfterEdit()){ if ( BaseToolkit::is_a_number(bufreceive, &Settings::application.control.osc_port_receive)){ Settings::application.control.osc_port_receive = CLAMP(Settings::application.control.osc_port_receive, 1029, 49150); Control::manager().init(); } } + ImGui::SameLine(0, IMGUI_SAME_LINE); + if (ImGuiToolkit::TextButton("Port in")) + Settings::application.control.osc_port_receive = OSC_PORT_RECV_DEFAULT; ImGui::SetCursorPosX(width_); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); char bufsend[7] = ""; snprintf(bufsend, 7, "%d", Settings::application.control.osc_port_send); - ImGui::InputTextWithHint("Port out", "7001", bufsend, 7, ImGuiInputTextFlags_CharsDecimal); + ImGui::InputTextWithHint("##Port out", "7001", bufsend, 7, ImGuiInputTextFlags_CharsDecimal); if (ImGui::IsItemDeactivatedAfterEdit()){ if ( BaseToolkit::is_a_number(bufsend, &Settings::application.control.osc_port_send)){ Settings::application.control.osc_port_send = CLAMP(Settings::application.control.osc_port_send, 1029, 49150); Control::manager().init(); } } + ImGui::SameLine(0, IMGUI_SAME_LINE); + if (ImGuiToolkit::TextButton("Port out")) + Settings::application.control.osc_port_send = OSC_PORT_SEND_DEFAULT; ImGui::SetCursorPosX(width_); const float w = IMGUI_RIGHT_ALIGN - ImGui::GetFrameHeightWithSpacing(); diff --git a/src/UserInterfaceManager.h b/src/UserInterfaceManager.h index 1851d9c..5b4271b 100644 --- a/src/UserInterfaceManager.h +++ b/src/UserInterfaceManager.h @@ -72,7 +72,7 @@ class Navigator void RenderTransitionPannel(const ImVec2 &iconsize); void RenderNewPannel(const ImVec2 &iconsize); void RenderViewOptions(uint *timeout, const ImVec2 &pos, const ImVec2 &size); - void RenderMousePointerSelector(const ImVec2 &size); + std::pair RenderMousePointerSelector(const ImVec2 &size); public: