diff --git a/common/device-model.cpp b/common/device-model.cpp index 6136689dec0..d05cf22c771 100644 --- a/common/device-model.cpp +++ b/common/device-model.cpp @@ -922,8 +922,8 @@ namespace rs2 } if (ImGui::IsItemHovered()) { - ImGui::PushStyleColor(ImGuiCol_PopupBg, black); ImGui::PushStyleColor(ImGuiCol_Text, white); + ImGui::PushStyleColor(ImGuiCol_PopupBg, dark_window_background); ImGui::SetTooltip("%s", show_device_info ? "Hide Device Details" : "Show Device Details"); window.link_hovered(); ImGui::PopStyleColor(2); @@ -1261,8 +1261,8 @@ namespace rs2 } if (ImGui::IsItemHovered()) { - ImGui::PushStyleColor(ImGuiCol_PopupBg, black); ImGui::PushStyleColor(ImGuiCol_Text, white); + ImGui::PushStyleColor(ImGuiCol_PopupBg, dark_window_background); std::string record_button_hover_text = get_record_button_hover_text(is_streaming); ImGui::SetTooltip("%s", record_button_hover_text.c_str()); if (is_streaming) window.link_hovered(); @@ -1281,16 +1281,15 @@ namespace rs2 auto sync_button_color = is_sync_enabled ? light_blue : light_grey; ImGui::PushStyleColor(ImGuiCol_Text, sync_button_color); ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, sync_button_color); - ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.5f, 0.5f, 0.5f, 1.f)); if (ImGui::ButtonEx(sync_button_name.c_str(), device_panel_icons_size, ImGuiItemFlags_Disabled)) { is_sync_enabled = !is_sync_enabled; } - ImGui::PopStyleColor(3); + ImGui::PopStyleColor(2); if (ImGui::IsItemHovered()) { - ImGui::PushStyleColor(ImGuiCol_PopupBg, black); ImGui::PushStyleColor(ImGuiCol_Text, white); + ImGui::PushStyleColor(ImGuiCol_PopupBg, dark_window_background); ImGui::SetTooltip("%s", is_sync_enabled ? "Disable streams synchronization" : "Enable streams synchronization"); ImGui::PopStyleColor(2); } @@ -1312,8 +1311,8 @@ namespace rs2 } if (ImGui::IsItemHovered()) { - ImGui::PushStyleColor(ImGuiCol_PopupBg, black); ImGui::PushStyleColor(ImGuiCol_Text, white); + ImGui::PushStyleColor(ImGuiCol_PopupBg, dark_window_background); ImGui::SetTooltip("%s", "Click for more"); window.link_hovered(); ImGui::PopStyleColor(2); @@ -1372,8 +1371,8 @@ namespace rs2 } if (ImGui::IsItemHovered()) { - ImGui::PushStyleColor(ImGuiCol_PopupBg, black); ImGui::PushStyleColor(ImGuiCol_Text, white); + ImGui::PushStyleColor(ImGuiCol_PopupBg, dark_window_background); std::string tooltip = rsutils::string::from() << "Install official signed firmware from file to the device" << ( is_streaming ? " (Disabled while streaming)" : "" ); @@ -1401,8 +1400,8 @@ namespace rs2 if (ImGui::IsItemHovered()) { - ImGui::PushStyleColor(ImGuiCol_PopupBg, black); ImGui::PushStyleColor(ImGuiCol_Text, white); + ImGui::PushStyleColor(ImGuiCol_PopupBg, dark_window_background); std::string tooltip = rsutils::string::from() << "Check for SW / FW updates"; ImGui::SetTooltip("%s", tooltip.c_str()); ImGui::PopStyleColor(2); @@ -1426,8 +1425,8 @@ namespace rs2 } if (ImGui::IsItemHovered()) { - ImGui::PushStyleColor(ImGuiCol_PopupBg, black); ImGui::PushStyleColor(ImGuiCol_Text, white); + ImGui::PushStyleColor(ImGuiCol_PopupBg, dark_window_background); std::string tooltip = rsutils::string::from() << "Install non official unsigned firmware from file to the device" << ( is_streaming ? " (Disabled while streaming)" : "" ); @@ -2318,7 +2317,7 @@ namespace rs2 if (ImGui::IsItemHovered()) { - ImGui::PushStyleColor(ImGuiCol_PopupBg, black); + ImGui::PushStyleColor(ImGuiCol_PopupBg, dark_window_background); ImGui::PushStyleColor(ImGuiCol_Text, white); ImGui::SetTooltip("Remove selected device from current view\n(can be restored by clicking Add Source)"); window.link_hovered(); @@ -2439,7 +2438,7 @@ namespace rs2 ImGui::PopStyleColor(2); auto sensor_top_y = ImGui::GetCursorPosY(); - ImGui::SetNextWindowContentSize(ImVec2(ImGui::GetWindowWidth() - 36, ImGui::GetWindowHeight())); + ImGui::SetWindowSize(ImVec2(windows_width -36, 0.0f)); ImGui::PushStyleColor(ImGuiCol_HeaderHovered, sensor_bg); ImGui::PushStyleColor(ImGuiCol_Text, light_grey); @@ -2467,7 +2466,7 @@ namespace rs2 ImGui_ScopePushStyleColor(ImGuiCol_Button, sensor_bg); ImGui_ScopePushStyleColor(ImGuiCol_ButtonHovered, sensor_bg); ImGui_ScopePushStyleColor(ImGuiCol_ButtonActive, sensor_bg); - + ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(5, 5)); int font_size = window.get_font_size(); ImVec2 button_size = { font_size * 3.0f, font_size * 1.0f }; @@ -2498,15 +2497,21 @@ namespace rs2 { if (ImGui::IsItemHovered()) { + ImGui::PushStyleColor(ImGuiCol_Text, white); + ImGui::PushStyleColor(ImGuiCol_PopupBg, dark_window_background); // ImGui::SetTooltip("Selected configuration (FPS, Resolution) is not supported"); ImGui::SetTooltip("Selected value is not supported"); + ImGui::PopStyleColor(2); } } else { if (ImGui::IsItemHovered()) { + ImGui::PushStyleColor(ImGuiCol_Text, white); + ImGui::PushStyleColor(ImGuiCol_PopupBg, dark_window_background); ImGui::SetTooltip("No stream selected"); + ImGui::PopStyleColor(2); } } } @@ -2548,8 +2553,11 @@ namespace rs2 } if (ImGui::IsItemHovered()) { + ImGui::PushStyleColor(ImGuiCol_Text, white); + ImGui::PushStyleColor(ImGuiCol_PopupBg, dark_window_background); window.link_hovered(); - ImGui::SizedToolTip("Start streaming data from this sensor"); + ImGui::SetTooltip("Start streaming data from this sensor"); + ImGui::PopStyleColor(2); } } } @@ -2583,8 +2591,11 @@ namespace rs2 } if (ImGui::IsItemHovered()) { + ImGui::PushStyleColor(ImGuiCol_Text, white); + ImGui::PushStyleColor(ImGuiCol_PopupBg, dark_window_background); window.link_hovered(); - ImGui::SizedToolTip("Stop streaming data from selected sub-device");; + ImGui::SetTooltip("Stop streaming data from selected sub-device"); + ImGui::PopStyleColor(2); } } @@ -2604,6 +2615,7 @@ namespace rs2 } } } + ImGui::PopStyleVar(); }); } @@ -2618,7 +2630,7 @@ namespace rs2 ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, { 10, 10 }); ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, { 0, 0 }); ImGuiTreeNodeFlags flags{}; - ImGui::AlignTextToFramePadding(); + ImGui::AlignTextToFramePadding();//Ensures that text aligns visually with UI elements that have padding (for the TreeNode visual alignment) if (show_depth_only) flags = ImGuiTreeNodeFlags_DefaultOpen; if (ImGui::TreeNodeEx(label.c_str(), flags)) { @@ -2767,8 +2779,11 @@ namespace rs2 } if (ImGui::IsItemHovered()) { - ImGui::SizedToolTip("Enable post-processing filters"); + ImGui::PushStyleColor(ImGuiCol_Text, white); + ImGui::PushStyleColor(ImGuiCol_PopupBg, dark_window_background); + ImGui::SetTooltip("Enable post-processing filters"); window.link_hovered(); + ImGui::PopStyleColor(2); } } else @@ -2794,8 +2809,11 @@ namespace rs2 } if (ImGui::IsItemHovered()) { - ImGui::SizedToolTip("Disable post-processing filters"); + ImGui::PushStyleColor(ImGuiCol_Text, white); + ImGui::PushStyleColor(ImGuiCol_PopupBg, dark_window_background); + ImGui::SetTooltip("Disable post-processing filters"); window.link_hovered(); + ImGui::PopStyleColor(2); } } ImGui::PopStyleColor(5); @@ -2876,9 +2894,12 @@ namespace rs2 } if (ImGui::IsItemHovered()) { + ImGui::PushStyleColor(ImGuiCol_Text, white); + ImGui::PushStyleColor(ImGuiCol_PopupBg, dark_window_background); label = rsutils::string::from() << "Enable " << pb->get_name() << " post-processing filter"; - ImGui::SizedToolTip(label.c_str()); + ImGui::SetTooltip(label.c_str()); window.link_hovered(); + ImGui::PopStyleColor(2); } } else @@ -2897,10 +2918,13 @@ namespace rs2 } if (ImGui::IsItemHovered()) { + ImGui::PushStyleColor(ImGuiCol_Text, white); + ImGui::PushStyleColor(ImGuiCol_PopupBg, dark_window_background); label = rsutils::string::from() << "Disable " << pb->get_name() << " post-processing filter"; - ImGui::SizedToolTip(label.c_str()); + ImGui::SetTooltip(label.c_str()); window.link_hovered(); + ImGui::PopStyleColor(2); } } } diff --git a/common/option-model.cpp b/common/option-model.cpp index 52bf7a2e3a8..6a3b6ee9ed6 100644 --- a/common/option-model.cpp +++ b/common/option-model.cpp @@ -266,7 +266,6 @@ bool option_model::draw_combobox( notifications_model & model, try { - ImGui::PushItemWidth(combo_width); // Set the width for the combo box itself if( ImGui::CustomComboBox( id.c_str(), &selected, labels.data(), static_cast< int >( labels.size() ) ) ) { float tmp_value = range.min + range.step * selected; @@ -277,7 +276,6 @@ bool option_model::draw_combobox( notifications_model & model, *invalidate_flag = true; item_clicked = true; } - ImGui::PopItemWidth(); } catch( const error & e ) { diff --git a/common/stream-model.cpp b/common/stream-model.cpp index 09e31f8573b..4281bfe3d4a 100644 --- a/common/stream-model.cpp +++ b/common/stream-model.cpp @@ -367,7 +367,7 @@ namespace rs2 bool draw_combo_box(const std::string& id, const std::vector& device_names, int& new_index) { std::vector device_names_chars = get_string_pointers(device_names); - return ImGui::Combo(id.c_str(), &new_index, device_names_chars.data(), static_cast(device_names.size())); + return ImGui::CustomComboBox(id.c_str(), &new_index, device_names_chars.data(), static_cast(device_names.size())); } void stream_model::show_stream_header(ImFont* font, const rect &stream_rect, viewer_model& viewer) diff --git a/common/updates-model.cpp b/common/updates-model.cpp index 340bfcb41b1..c8b94b40986 100644 --- a/common/updates-model.cpp +++ b/common/updates-model.cpp @@ -41,7 +41,7 @@ void updates_model::draw(std::shared_ptr not_model, ux_wind ImGui::SetNextWindowSize({ positions.w, positions.h }); auto flags = ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | - ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings ; + ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoScrollbar; ImGui::PushStyleColor(ImGuiCol_PopupBg, sensor_bg); ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, white); @@ -144,6 +144,8 @@ void updates_model::draw(std::shared_ptr not_model, ux_wind ImGui::SetCursorPos({ positions.w - 145, positions.h - 25 }); auto enabled = ignore || no_update_needed; + ImGui::PushStyleColor(ImGuiCol_Border, black); + ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.5f); if (enabled) { if (_fw_update_state != fw_update_states::started) @@ -180,12 +182,16 @@ void updates_model::draw(std::shared_ptr not_model, ux_wind } if (ImGui::IsItemHovered()) { + ImGui::PushStyleColor(ImGuiCol_Text, white); + ImGui::PushStyleColor(ImGuiCol_PopupBg, dark_window_background); ImGui::SetTooltip("To close this window you must install all essential update\n" "or agree to the warning of closing without it"); - + ImGui::PopStyleColor(2); } ImGui::PopStyleColor(2); } + ImGui::PopStyleVar(); + ImGui::PopStyleColor(); ImGui::EndPopup(); } ImGui::PopStyleColor(3); @@ -438,9 +444,11 @@ bool updates_model::draw_software_section(const char * window_name, update_profi if (ImGui::IsItemHovered()) { + ImGui::PushStyleColor(ImGuiCol_PopupBg, dark_window_background); std::string tooltip = "This will redirect you to download the selected software from:\n" + selected_software_update.download_link; ImGui::SetTooltip("%s", tooltip.c_str()); window.link_hovered(); + ImGui::PopStyleColor(); } ImGui::PopStyleColor(3); diff --git a/common/ux-window.cpp b/common/ux-window.cpp index 9de8956f57f..538dae69f26 100644 --- a/common/ux-window.cpp +++ b/common/ux-window.cpp @@ -380,7 +380,7 @@ namespace rs2 ImGuiIO& io = ImGui::GetIO(); io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange; // added in order to prevents cursor chang when interacting with other element (when nedded remove the flag accordingly) - ImGui_ImplGlfw_InitForOpenGL(_win, false); + ImGui_ImplGlfw_InitForOpenGL(_win, true); ImGui_ImplOpenGL3_Init(); if (_use_glsl_render) @@ -395,19 +395,21 @@ namespace rs2 glfwSetCursorPosCallback(_win, [](GLFWwindow* w, double cx, double cy) { + ImGui_ImplGlfw_CursorPosCallback(w, cx, cy); // Forward the cursor position to ImGui auto data = reinterpret_cast(glfwGetWindowUserPointer(w)); data->_mouse.cursor = { (float)cx / data->_scale_factor, (float)cy / data->_scale_factor }; }); glfwSetMouseButtonCallback(_win, [](GLFWwindow* w, int button, int action, int mods) { - ImGui_ImplGlfw_MouseButtonCallback(w, button, action, mods); + ImGui_ImplGlfw_MouseButtonCallback(w, button, action, mods);// Forward the event to ImGui's GLFW implementation auto data = reinterpret_cast(glfwGetWindowUserPointer(w)); data->_mouse.mouse_down[0] = (button == GLFW_MOUSE_BUTTON_1) && (action != GLFW_RELEASE); data->_mouse.mouse_down[1] = (button == GLFW_MOUSE_BUTTON_2) && (action != GLFW_RELEASE); }); glfwSetScrollCallback(_win, [](GLFWwindow * w, double xoffset, double yoffset) { + ImGui_ImplGlfw_ScrollCallback(w, xoffset, yoffset); // Forwards scroll events to ImGui auto data = reinterpret_cast(glfwGetWindowUserPointer(w)); data->_mouse.mouse_wheel = static_cast(yoffset); data->_mouse.ui_wheel += static_cast(yoffset); @@ -425,6 +427,8 @@ namespace rs2 } }); + glfwSetKeyCallback(_win, ImGui_ImplGlfw_KeyCallback); + rs2::gl::init_rendering(_use_glsl_render); if (_use_glsl_proc) rs2::gl::init_processing(_win, _use_glsl_proc); diff --git a/common/viewer.cpp b/common/viewer.cpp index f8c98fcc402..f8fb2c1070e 100644 --- a/common/viewer.cpp +++ b/common/viewer.cpp @@ -304,11 +304,14 @@ namespace rs2 ImGui::PopFont(); hovered = hovered || ImGui::IsItemHovered(); + ImGui::PushStyleColor(ImGuiCol_Text,white); + ImGui::PushStyleColor(ImGuiCol_PopupBg, dark_window_background); if (hovered) { win.link_hovered(); ImGui::SetTooltip("%s", description); } + ImGui::PopStyleColor(2); if (clicked && !disabled) { @@ -2406,7 +2409,7 @@ namespace rs2 ImGui::SetNextWindowSize({ w, h }); flags = ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | - ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings; + ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoScrollbar; ImGui_ScopePushFont(window.get_font()); ImGui::PushStyleColor(ImGuiCol_PopupBg, sensor_bg); @@ -2473,7 +2476,9 @@ namespace rs2 ImGui::SetCursorScreenPos({ (float)(x0 + 15), (float)(y0 + 65) }); ImGui::Separator(); - + ImGui::PushStyleColor(ImGuiCol_Text, white); + ImGui::PushStyleColor(ImGuiCol_PopupBg, dark_window_background); + ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(5, 5)); if (tab == 0) { int recording_setting = temp_cfg.get(configurations::record::file_save_mode); @@ -2929,7 +2934,8 @@ namespace rs2 { ImGui::SetTooltip("%s", "Close window without saving any changes to the settings"); } - + ImGui::PopStyleColor(2); + ImGui::PopStyleVar(); ImGui::EndPopup(); } @@ -2952,7 +2958,7 @@ namespace rs2 ImGui::SetNextWindowSize({ w, h }); flags = ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | - ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings; + ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoScrollbar; ImGui_ScopePushFont(window.get_font()); ImGui::PushStyleColor(ImGuiCol_PopupBg, sensor_bg); diff --git a/examples/align-advanced/rs-align-advanced.cpp b/examples/align-advanced/rs-align-advanced.cpp index 7e577a0598c..ba2765ecc60 100644 --- a/examples/align-advanced/rs-align-advanced.cpp +++ b/examples/align-advanced/rs-align-advanced.cpp @@ -30,7 +30,7 @@ int main(int argc, char * argv[]) try // Setup Dear ImGui context ImGui::CreateContext(); // Setup Platform/Renderer backends - ImGui_ImplGlfw_InitForOpenGL(app, true); + ImGui_ImplGlfw_InitForOpenGL(app, false); ImGui_ImplOpenGL3_Init(); rs2::colorizer c; // Helper to colorize depth images texture renderer; // Helper for renderig images @@ -175,11 +175,12 @@ void render_slider(rect location, float& clipping_dist) ImGui::PushStyleColor(ImGuiCol_FrameBg, { 0.2f / 255, 0.3f / 255, 0.7f / 255 ,1}); ImGui::PushStyleColor(ImGuiCol_SliderGrab, { 215.f / 255, 215.0f / 255, 215.0f / 255,1 }); ImGui::PushStyleColor(ImGuiCol_SliderGrabActive, { 215.f / 255, 215.0f / 255, 215.0f / 255,1 }); + ImGui::PushStyleColor(ImGuiCol_FrameBg, { 1.0f, 1.0f, 1.0f, 1.0f }); // White slider bar (background) auto slider_size = ImVec2(slider_window_width / 2, location.h - (pixels_to_buttom_of_stream_text * 2) - 20); - ImGui::VSliderFloat("##vslider", slider_size, &clipping_dist, 0.0f, 6.0f," % .2f"); + ImGui::VSliderFloat("##vslider", slider_size, &clipping_dist, 0.0f, 6.0f, "", 1.0f, true); if (ImGui::IsItemHovered()) ImGui::SetTooltip("Depth Clipping Distance: %.3f", clipping_dist); - ImGui::PopStyleColor(3); + ImGui::PopStyleColor(4); //Display bars next to slider float bars_dist = (slider_size.y / 6.0f); diff --git a/examples/align-gl/rs-align-gl.cpp b/examples/align-gl/rs-align-gl.cpp index 9e033076f0f..dc6acb9146a 100644 --- a/examples/align-gl/rs-align-gl.cpp +++ b/examples/align-gl/rs-align-gl.cpp @@ -55,7 +55,7 @@ int main(int argc, char * argv[]) try // Setup Dear ImGui context ImGui::CreateContext(); // Setup Platform/Renderer backends - ImGui_ImplGlfw_InitForOpenGL(app, true); + ImGui_ImplGlfw_InitForOpenGL(app, false); ImGui_ImplOpenGL3_Init(); // Once we have a window, initialize GL module @@ -165,7 +165,21 @@ void render_slider(rect location, float* alpha, direction* dir) ImGui::SetNextWindowPos({ location.x, location.y }); ImGui::SetNextWindowSize({ location.w, location.h }); + ImGui::SetNextWindowBgAlpha(0.5f); // Set the background alpha to 50% transparency + ImGui::GetStyle().WindowRounding = 10.0f; // Set the window rounding to 10.0f + ImGuiStyle& style = ImGui::GetStyle(); + ImVec4* colors = style.Colors; + colors[ImGuiCol_WindowBg] = ImVec4(0.1f, 0.1f, 0.1f, 1.0f); // Set the main background color to dark gray + + // Set frame and button colors to gray + colors[ImGuiCol_FrameBg] = ImVec4(0.2f, 0.2f, 0.2f, 1.0f); + colors[ImGuiCol_FrameBgHovered] = ImVec4(0.3f, 0.3f, 0.3f, 1.0f); + colors[ImGuiCol_FrameBgActive] = ImVec4(0.35f, 0.35f, 0.35f, 1.0f); + + colors[ImGuiCol_CheckMark] = ImVec4(0.5f, 0.5f, 0.5f, 1.0f); // Change the color of the checkmark to gray + + colors[ImGuiCol_SliderGrab] = ImVec4(0.4f, 0.4f, 0.4f, 1.0f); // Change the color of the slider grab to gray // Render transparency slider: ImGui::Begin("slider", nullptr, flags); ImGui::PushItemWidth(-1); diff --git a/examples/align/rs-align.cpp b/examples/align/rs-align.cpp index f35b9b45088..e0bba7d63ac 100644 --- a/examples/align/rs-align.cpp +++ b/examples/align/rs-align.cpp @@ -51,7 +51,7 @@ int main(int argc, char * argv[]) try // Setup Dear ImGui context ImGui::CreateContext(); // Setup Platform/Renderer backends - ImGui_ImplGlfw_InitForOpenGL(app, true); + ImGui_ImplGlfw_InitForOpenGL(app, false); ImGui_ImplOpenGL3_Init(); rs2::colorizer c; // Helper to colorize depth images texture depth_image, color_image; // Helpers for renderig images @@ -154,6 +154,21 @@ void render_slider(rect location, float* alpha, direction* dir) ImGui::SetNextWindowPos({ location.x, location.y }); ImGui::SetNextWindowSize({ location.w, location.h }); + ImGui::SetNextWindowBgAlpha(0.5f); // Set the background alpha to 50% transparency + ImGui::GetStyle().WindowRounding = 10.0f; // Set the window rounding to 10.0f + + ImGuiStyle& style = ImGui::GetStyle(); + ImVec4* colors = style.Colors; + colors[ImGuiCol_WindowBg] = ImVec4(0.1f, 0.1f, 0.1f, 1.0f); // Set the main background color to dark gray + + // Set frame and button colors to gray + colors[ImGuiCol_FrameBg] = ImVec4(0.2f, 0.2f, 0.2f, 1.0f); + colors[ImGuiCol_FrameBgHovered] = ImVec4(0.3f, 0.3f, 0.3f, 1.0f); + colors[ImGuiCol_FrameBgActive] = ImVec4(0.35f, 0.35f, 0.35f, 1.0f); + + colors[ImGuiCol_CheckMark] = ImVec4(0.5f, 0.5f, 0.5f, 1.0f); // Change the color of the checkmark to gray + + colors[ImGuiCol_SliderGrab] = ImVec4(0.4f, 0.4f, 0.4f, 1.0f); // Change the color of the slider grab to gray // Render transparency slider: ImGui::Begin("slider", nullptr, flags); diff --git a/examples/example-imgui.hpp b/examples/example-imgui.hpp index ce41ff4c82f..862a00792ff 100644 --- a/examples/example-imgui.hpp +++ b/examples/example-imgui.hpp @@ -47,10 +47,28 @@ class hdr_slider : public slider { ImGui::SetNextWindowPos(_position); //concate the name given with seq_id in order to make a unique name (uniqeness is needed for Begin()) std::string name_id = std::string(_name) + std::to_string(_seq_id); + ImGuiStyle& style = ImGui::GetStyle(); + ImVec4* colors = style.Colors; + colors[ImGuiCol_WindowBg] = ImVec4(0.0f, 0.0f, 0.0f, 1.0f); // Set the main background color to black + style.WindowRounding = 10.0f; // Set the window rounding + style.WindowBorderSize = 0.0f; + + // Set other window-related colors + colors[ImGuiCol_TitleBg] = ImVec4(0.286f, 0.298f, 0.549f, 1.0f); + colors[ImGuiCol_TitleBgActive] = ImVec4(0.286f, 0.298f, 0.549f, 1.0f); + + // Set frame and button colors to gray + colors[ImGuiCol_FrameBg] = ImVec4(0.2f, 0.2f, 0.2f, 1.0f); + colors[ImGuiCol_FrameBgHovered] = ImVec4(0.3f, 0.3f, 0.3f, 1.0f); + colors[ImGuiCol_FrameBgActive] = ImVec4(0.35f, 0.35f, 0.35f, 1.0f); + + colors[ImGuiCol_CheckMark] = ImVec4(0.5f, 0.5f, 0.5f, 1.0f); // Change the color of the checkmark to gray + + colors[ImGuiCol_SliderGrab] = ImVec4(0.4f, 0.4f, 0.4f, 1.0f); // Change the color of the slider grab to gray ImGui::Begin(name_id.c_str(), nullptr, _sliders_flags); ImGui::Text("%s",_name); bool is_changed = - ImGui::SliderFloat("Slider Label", &_value, _min_value, _max_value, "%.3f", ImGuiSliderFlags_Logarithmic); //5.0f for logarithmic scale + ImGui::SliderFloat("##HDRSlider", &_value, _min_value, _max_value, "%.3f", ImGuiSliderFlags_Logarithmic); if (is_changed) { _sensor.set_option(RS2_OPTION_SEQUENCE_ID, float(_seq_id)); _sensor.set_option(_option, _value); @@ -123,7 +141,7 @@ class hdr_widgets { _text_box_hdr_explain("HDR Tutorial", { 120, 20 }, { 1000, 140 }), _text_box_first_frame("frame 1", { 200, 150 }, { 170, 40 }), _text_box_second_frame("frame 2", { 460, 150 }, { 170, 40 }), - _text_box_hdr_frame("hdr", { 850, 280 }, { 170, 40 }) + _text_box_hdr_frame("hdr", { 850, 280 }, { 170, 20 }) { // init frames map //for initilize only - an empty frame with its properties diff --git a/examples/example.hpp b/examples/example.hpp index d7f4a564e9a..5677f87cd33 100644 --- a/examples/example.hpp +++ b/examples/example.hpp @@ -8,6 +8,7 @@ #define GL_SILENCE_DEPRECATION #define GLFW_INCLUDE_GLU #include +#include #include #include @@ -530,24 +531,28 @@ class window glfwSetWindowUserPointer(win, this); glfwSetMouseButtonCallback(win, [](GLFWwindow* w, int button, int action, int mods) { + ImGui_ImplGlfw_MouseButtonCallback(w, button, action, mods);// Forward the event to ImGui's GLFW implementation auto s = (window*)glfwGetWindowUserPointer(w); if (button == 0) s->on_left_mouse(action == GLFW_PRESS); }); glfwSetScrollCallback(win, [](GLFWwindow* w, double xoffset, double yoffset) { + ImGui_ImplGlfw_ScrollCallback(w, xoffset, yoffset); // Forwards scroll events to ImGui auto s = (window*)glfwGetWindowUserPointer(w); s->on_mouse_scroll(xoffset, yoffset); }); glfwSetCursorPosCallback(win, [](GLFWwindow* w, double x, double y) { + ImGui_ImplGlfw_CursorPosCallback(w, x, y); // Forward the cursor position to ImGui auto s = (window*)glfwGetWindowUserPointer(w); s->on_mouse_move(x, y); }); glfwSetKeyCallback(win, [](GLFWwindow* w, int key, int scancode, int action, int mods) { + ImGui_ImplGlfw_KeyCallback(w, key, scancode, action, mods); auto s = (window*)glfwGetWindowUserPointer(w); if (0 == action) // on key release { diff --git a/examples/post-processing/rs-post-processing.cpp b/examples/post-processing/rs-post-processing.cpp index da66acb50e3..4a7651129f7 100644 --- a/examples/post-processing/rs-post-processing.cpp +++ b/examples/post-processing/rs-post-processing.cpp @@ -57,7 +57,7 @@ int main(int argc, char * argv[]) try // Setup Dear ImGui context ImGui::CreateContext(); // Setup Platform/Renderer backends - ImGui_ImplGlfw_InitForOpenGL(app, true); + ImGui_ImplGlfw_InitForOpenGL(app, false); ImGui_ImplOpenGL3_Init(); // Construct objects to manage view state @@ -265,6 +265,9 @@ void render_ui(float w, float h, std::vector& filters) ImGui_ImplGlfw_NewFrame(); ImGui::NewFrame(); ImGui::SetNextWindowSize({ w, h }); + ImGui::GetStyle().Colors[ImGuiCol_FrameBg] = ImVec4(0.2f, 0.2f, 0.2f, 1.0f); + ImGui::GetStyle().Colors[ImGuiCol_FrameBgHovered] = ImVec4(0.3f, 0.3f, 0.3f, 1.0f); + ImGui::GetStyle().Colors[ImGuiCol_FrameBgActive] = ImVec4(0.35f, 0.35f, 0.35f, 1.0f); ImGui::Begin("app", nullptr, flags); // Using ImGui library to provide slide controllers for adjusting the filter options @@ -328,7 +331,7 @@ bool filter_slider_ui::render(const float3& location, bool enabled) if (is_int) { int value_as_int = static_cast(value); - value_changed = ImGui::SliderInt(("##" + name).c_str(), &value_as_int, static_cast(range.min), static_cast(range.max), "%.0f"); + value_changed = ImGui::SliderInt(("##" + name).c_str(), &value_as_int, static_cast(range.min), static_cast(range.max), "%d"); value = static_cast(value_as_int); } else diff --git a/examples/record-playback/rs-record-playback.cpp b/examples/record-playback/rs-record-playback.cpp index 314de96e18c..be20799fbf3 100644 --- a/examples/record-playback/rs-record-playback.cpp +++ b/examples/record-playback/rs-record-playback.cpp @@ -29,7 +29,7 @@ int main(int argc, char * argv[]) try // Setup Dear ImGui context ImGui::CreateContext(); // Setup Platform/Renderer backends - ImGui_ImplGlfw_InitForOpenGL(app, true); + ImGui_ImplGlfw_InitForOpenGL(app, false); ImGui_ImplOpenGL3_Init(); // Create booleans to control GUI (recorded - allow play button, recording - show 'recording to file' text) @@ -71,6 +71,7 @@ int main(int argc, char * argv[]) try ImGui_ImplOpenGL3_NewFrame(); ImGui_ImplGlfw_NewFrame(); ImGui::NewFrame(); + ImGui::SetNextWindowPos(ImVec2(0, 0)); ImGui::SetNextWindowSize({ app.width(), app.height() }); ImGui::Begin("app", nullptr, flags); diff --git a/third-party/imgui/realsense_imgui.cpp b/third-party/imgui/realsense_imgui.cpp index 02bbe66a7d0..b1edec22791 100644 --- a/third-party/imgui/realsense_imgui.cpp +++ b/third-party/imgui/realsense_imgui.cpp @@ -198,13 +198,289 @@ IMGUI_API bool ImGui::CustomComboBox(const char* label, int* current_item, const return value_changed; } -IMGUI_API void ImGui::SizedToolTip(const char* text) +IMGUI_API bool ImGui::SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_min, float v_max, float power, int decimal_precision, ImGuiSliderFlags flags, bool render_bg) { - ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(5, 5)); - const ImVec2 text_size = ImGui::CalcTextSize(text); - ImGui::SetNextWindowSize(ImVec2(text_size.x + 10 , text_size.y + 10)); - ImGui::BeginTooltipEx(ImGuiTooltipFlags_None, ImGuiWindowFlags_NoScrollbar); - ImGui::TextUnformatted(text); - ImGui::EndTooltip(); - ImGui::PopStyleVar(1); + ImGuiContext& g = *GImGui; + ImGuiWindow* window = GetCurrentWindow(); + const ImGuiStyle& style = g.Style; + + const bool is_non_linear = fabsf(power - 1.0f) > 0.0001f; + const bool is_horizontal = (flags & ImGuiSliderFlags_Vertical) == 0; + + + if (!render_bg) + { + // Draw frame + RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding); + } + + + const float grab_padding = 2.0f; + const float slider_sz = is_horizontal ? (frame_bb.GetWidth() - grab_padding * 2.0f) : (frame_bb.GetHeight() - grab_padding * 2.0f); + float grab_sz; + if (decimal_precision > 0) + grab_sz = ImMin(style.GrabMinSize, slider_sz); + else + grab_sz = ImMin(ImMax(1.0f * (slider_sz / (v_max - v_min + 1.0f)), style.GrabMinSize), slider_sz); // Integer sliders, if possible have the grab size represent 1 unit + const float slider_usable_sz = slider_sz - grab_sz; + const float slider_usable_pos_min = (is_horizontal ? frame_bb.Min.x : frame_bb.Min.y) + grab_padding + grab_sz * 0.5f; + const float slider_usable_pos_max = (is_horizontal ? frame_bb.Max.x : frame_bb.Max.y) - grab_padding - grab_sz * 0.5f; + + // For logarithmic sliders that cross over sign boundary we want the exponential increase to be symmetric around 0.0f + float linear_zero_pos = 0.0f; // 0.0->1.0f + if (v_min * v_max < 0.0f) + { + // Different sign + const float linear_dist_min_to_0 = powf(fabsf(0.0f - v_min), 1.0f / power); + const float linear_dist_max_to_0 = powf(fabsf(v_max - 0.0f), 1.0f / power); + linear_zero_pos = linear_dist_min_to_0 / (linear_dist_min_to_0 + linear_dist_max_to_0); + } + else + { + // Same sign + linear_zero_pos = v_min < 0.0f ? 1.0f : 0.0f; + } + + // Process clicking on the slider + bool value_changed = false; + if (g.ActiveId == id) + { + if (g.IO.MouseDown[0]) + { + const float mouse_abs_pos = is_horizontal ? g.IO.MousePos.x : g.IO.MousePos.y; + float normalized_pos = ImClamp((mouse_abs_pos - slider_usable_pos_min) / slider_usable_sz, 0.0f, 1.0f); + if (!is_horizontal) + normalized_pos = 1.0f - normalized_pos; + + float new_value; + if (is_non_linear) + { + // Account for logarithmic scale on both sides of the zero + if (normalized_pos < linear_zero_pos) + { + // Negative: rescale to the negative range before powering + float a = 1.0f - (normalized_pos / linear_zero_pos); + a = powf(a, power); + new_value = ImLerp(ImMin(v_max, 0.0f), v_min, a); + } + else + { + // Positive: rescale to the positive range before powering + float a; + if (fabsf(linear_zero_pos - 1.0f) > 1.e-6f) + a = (normalized_pos - linear_zero_pos) / (1.0f - linear_zero_pos); + else + a = normalized_pos; + a = powf(a, power); + new_value = ImLerp(ImMax(v_min, 0.0f), v_max, a); + } + } + else + { + // Linear slider + new_value = ImLerp(v_min, v_max, normalized_pos); + } + + // Round past decimal precision, verify that it remains within min/max range + new_value = RoundScalar(new_value, decimal_precision); + if (new_value > v_max) new_value = v_max; + if (new_value < v_min) new_value = v_min; + + if (*v != new_value) + { + *v = new_value; + value_changed = true; + } + } + else + { + ClearActiveID(); + } + } + + // Calculate slider grab positioning + float grab_t; + if (is_non_linear) + { + float v_clamped = ImClamp(*v, v_min, v_max); + if (v_clamped < 0.0f) + { + const float f = 1.0f - (v_clamped - v_min) / (ImMin(0.0f, v_max) - v_min); + grab_t = (1.0f - powf(f, 1.0f / power)) * linear_zero_pos; + } + else + { + const float f = (v_clamped - ImMax(0.0f, v_min)) / (v_max - ImMax(0.0f, v_min)); + grab_t = linear_zero_pos + powf(f, 1.0f / power) * (1.0f - linear_zero_pos); + } + } + else + { + // Linear slider + grab_t = (ImClamp(*v, v_min, v_max) - v_min) / (v_max - v_min); + } + + // Draw + if (!is_horizontal) + grab_t = 1.0f - grab_t; + const float grab_pos = ImLerp(slider_usable_pos_min, slider_usable_pos_max, grab_t); + ImRect grab_bb; + if (is_horizontal) + grab_bb = ImRect(ImVec2(grab_pos - grab_sz * 0.5f, frame_bb.Min.y + grab_padding), ImVec2(grab_pos + grab_sz * 0.5f, frame_bb.Max.y - grab_padding)); + else + grab_bb = ImRect(ImVec2(frame_bb.Min.x + grab_padding, grab_pos - grab_sz * 0.5f), ImVec2(frame_bb.Max.x - grab_padding, grab_pos + grab_sz * 0.5f)); + + if (render_bg) + { + auto bb = frame_bb; + ImRect fill_br = frame_bb; + auto slider_height = bb.Max.y - bb.Min.y; + auto slider_width = bb.Max.x - bb.Min.x; + ImVec2 graber_size = {}; + float width = (grab_bb.Max.x - grab_bb.Min.x); + float height = (grab_bb.Max.y - grab_bb.Min.y); + float radius = 1.0; + if (is_horizontal) + { + bb.Min.y = bb.Min.y + (slider_height / 3); + bb.Max.y = bb.Max.y - (slider_height / 3); + if (bb.Max.y - bb.Min.y < 1.0f) + { + bb.Min.y -= 0.5; + bb.Max.y += 0.5; + } + float grab_paddingl = 2.0f; + //Horizontal fills from left to right + fill_br.Min = bb.Min; + fill_br.Max = ImVec2(ImLerp(bb.Min.x, bb.Max.x - grab_paddingl, *v / 100), bb.Max.y); + graber_size = { grab_bb.Max.x - (width / 2.0f) , grab_bb.Max.y - (height / 2.0f) }; + radius = height / 2.5f; + } + else + { + bb.Min.x = bb.Min.x + (slider_width / 3); + bb.Max.x = bb.Max.x - (slider_width / 3); + if (bb.Max.x - bb.Min.x < 1.0f) + { + bb.Min.x -= 0.5; + bb.Max.x += 0.5; + } + //Vertical fills from down upwards + fill_br.Min = bb.Min; + fill_br.Min.y = grab_bb.Min.y; + fill_br.Max = bb.Max; + graber_size = { grab_bb.Max.x - (width / 2.0f) , grab_bb.Max.y - (height / 2.0f) }; + radius = width;// / 2.5; + } + // Draw frame + RenderFrame(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), false, 10.0f); + RenderFrame(fill_br.Min, fill_br.Max, ImGui::ColorConvertFloat4ToU32({ 0, 112.f / 255, 197.f / 255, 1 }), false, 10.0f); + window->DrawList->AddCircleFilled(graber_size, radius, GetColorU32(g.ActiveId == id ? ImGuiCol_SliderGrabActive : ImGuiCol_SliderGrab), 16); + } + else + { + window->DrawList->AddRectFilled(grab_bb.Min, grab_bb.Max, GetColorU32(g.ActiveId == id ? ImGuiCol_SliderGrabActive : ImGuiCol_SliderGrab), style.GrabRounding); + } + + return value_changed; +} + +// Create text input in place of a slider (when CTRL+Clicking on slider) +IMGUI_API bool ImGui::InputScalarAsWidgetReplacement(const ImRect& aabb, const char* label, ImGuiDataType data_type, void* data_ptr, ImGuiID id, int decimal_precision) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = GetCurrentWindow(); + + // Track whether the item is being used for text input + bool start_text_input = false; + + // First, determine if we should start text input (e.g., CTRL+Click on the slider) + if (ImGui::IsItemFocused() || (ImGui::IsItemHovered() && g.IO.MouseClicked[0])) + { + SetActiveID(id, window); + FocusWindow(window); + + if (ImGui::IsItemFocused() || g.IO.KeyCtrl) + { + start_text_input = true; + } + } + + // If we are in text input mode or if the item is actively being edited, use InputText + if (start_text_input || (g.ActiveId == id && g.ActiveIdSource == ImGuiInputSource_Keyboard)) + { + bool text_value_changed = false; + + // Use InputScalar to handle scalar input (e.g., float, int) + switch (data_type) + { + case ImGuiDataType_Float: + text_value_changed = ImGui::InputScalar(label, data_type, data_ptr, NULL, NULL, ".3f"); + break; + case ImGuiDataType_S32: + text_value_changed = ImGui::InputScalar(label, data_type, data_ptr, NULL, NULL, 0); + break; + // Add other cases if you need support for other scalar types + default: + break; + } + + if (text_value_changed) + { + return true; // If the value changed, return true + } + } + else + { + // If not in text input mode, render the slider as usual + ImGui::SliderFloat(label, (float*)data_ptr, 0.0f, 6.0f); + } + + return false; +} + +bool ImGui::VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* display_format, float power, bool render_bg) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + ImGuiContext& g = *GImGui; + const ImGuiStyle& style = g.Style; + const ImGuiID id = window->GetID(label); + + const ImVec2 label_size = CalcTextSize(label, NULL, true); + const ImRect frame_bb(window->DC.CursorPos, ImVec2(window->DC.CursorPos.x + size.x, window->DC.CursorPos.y + size.y)); + const ImRect bb(frame_bb.Min,ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x + frame_bb.Max .x: frame_bb.Max.x, frame_bb.Max.y)); + + ItemSize(bb, style.FramePadding.y); + if (!ItemAdd(frame_bb, id)) + return false; + + const bool hovered = IsHovered(frame_bb, id); + if (hovered) + SetHoveredID(id); + + if (!display_format) + display_format = "%.3f"; + int decimal_precision = ParseFormatPrecision(display_format, 3); + + if (hovered && g.IO.MouseClicked[0]) + { + SetActiveID(id, window); + FocusWindow(window); + } + + // Actual slider behavior + render grab + bool value_changed = SliderBehavior(frame_bb, id, v, v_min, v_max, power, decimal_precision, ImGuiSliderFlags_Vertical, render_bg); + + // Display value using user-provided display format so user can add prefix/suffix/decorations to the value. + // For the vertical slider we allow centered text to overlap the frame padding + char value_buf[64]; + char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v); + RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, value_buf, value_buf_end, NULL); + if (label_size.x > 0.0f) + RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label); + + return value_changed; } diff --git a/third-party/imgui/realsense_imgui.h b/third-party/imgui/realsense_imgui.h index 688a201b7ef..256e8fb89bc 100644 --- a/third-party/imgui/realsense_imgui.h +++ b/third-party/imgui/realsense_imgui.h @@ -28,16 +28,16 @@ namespace ImGui }; IMGUI_API void RenderCollapseTriangle(ImVec2 p_min, bool is_open, float scale = 1.0f, bool shadow = false); IMGUI_API bool SeekSlider(const char* label, int* v, const char* display_format = "%.0f%%"); - /* Implement slider with increments other than 1. The implementation is a variation on https://github.com/ocornut/imgui/issues/1183 */ IMGUI_API bool SliderIntWithSteps(const char* label, int* v, int v_min, int v_max, int v_step = 1, const char* display_format = "%.3f"); IMGUI_API bool IsHovered(const ImRect& bb, ImGuiID id, bool flatten_childs = false); IMGUI_API void SetScrollHere(float center_y_ratio = 0.5f); IMGUI_API int ParseFormatPrecision(const char* fmt, int default_precision); - //IMGUI_API bool VSliderFloatadd(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* display_format, float power, bool render_bg); - //IMGUI_API bool SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_min, float v_max, float power, int decimal_precision, ImGuiSliderFlags flags, bool render_bg); IMGUI_API float RoundScalar(float value, int decimal_precision); IMGUI_API bool CustomComboBox(const char* label, int* current_item, const char* const items[], int items_count); - IMGUI_API void SizedToolTip(const char* text); + IMGUI_API bool VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* display_format, float power, bool render_bg); + IMGUI_API bool InputScalarAsWidgetReplacement(const ImRect& aabb, const char* label, ImGuiDataType data_type, void* data_ptr, ImGuiID id, int decimal_precision); + IMGUI_API bool SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_min, float v_max, float power, int decimal_precision, ImGuiSliderFlags flags, bool render_bg); + } #define CONCAT_(x,y) x##y #define CONCAT(x,y) CONCAT_(x,y) diff --git a/tools/depth-quality/depth-quality-model.cpp b/tools/depth-quality/depth-quality-model.cpp index cbb46ee730c..ac0143de1dd 100644 --- a/tools/depth-quality/depth-quality-model.cpp +++ b/tools/depth-quality/depth-quality-model.cpp @@ -476,8 +476,8 @@ namespace rs2 // ********************* // Creating window menus // ********************* + ImGui::SetNextWindowContentSize(ImVec2(_viewer_model.panel_width - 26 , 0.0f)); ImGui::Begin("Control Panel", nullptr, viewer_ui_traits::imgui_flags | ImGuiWindowFlags_AlwaysVerticalScrollbar); - ImGui::SetNextWindowSize({ _viewer_model.panel_width - 26,_viewer_model.panel_y }); if (_device_model.get()) { @@ -512,7 +512,6 @@ namespace rs2 { update_configuration(); } - ImGui::SetNextWindowSize(ImVec2(windows_width, ImGui::GetContentRegionMax().y)); auto pos = ImGui::GetCursorScreenPos(); for (auto&& lambda : draw_later) diff --git a/tools/realsense-viewer/realsense-viewer.cpp b/tools/realsense-viewer/realsense-viewer.cpp index da498c41fb9..e3abfbafe49 100644 --- a/tools/realsense-viewer/realsense-viewer.cpp +++ b/tools/realsense-viewer/realsense-viewer.cpp @@ -662,7 +662,7 @@ int main(int argc, const char** argv) try } } - ImGui::SetNextWindowContentSize(ImVec2(ImGui::GetWindowWidth(), ImGui::GetWindowHeight())); + ImGui::SetNextWindowContentSize(ImVec2(windows_width, 0.0f)); auto pos = ImGui::GetCursorScreenPos(); auto h = ImGui::GetWindowHeight(); diff --git a/tools/rosbag-inspector/rs-rosbag-inspector.cpp b/tools/rosbag-inspector/rs-rosbag-inspector.cpp index 0550ebbe789..2558f8b781d 100644 --- a/tools/rosbag-inspector/rs-rosbag-inspector.cpp +++ b/tools/rosbag-inspector/rs-rosbag-inspector.cpp @@ -414,13 +414,16 @@ int main(int argc, const char** argv) try ImGui::PushStyleColor(ImGuiCol_HeaderActive, from_rgba(0, 115, 210, 255)); ImGui::PushStyleColor(ImGuiCol_WindowBg, from_rgba(37, 40, 48, 255)); ImGui::PushStyleColor(ImGuiCol_PopupBg, almost_white_bg); + ImGui::PushStyleColor(ImGuiCol_MenuBarBg, ImVec4(0.286f, 0.298f, 0.549f, 1.0f)); ImGuiStyle& style = ImGui::GetStyle(); style.FramePadding.x = 10; style.FramePadding.y = 5; int flags = ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings; static bool open = true; + ImGui::SetNextWindowPos(ImVec2(0, 0)); ImGui::SetNextWindowSize({ float(window.width()), float(window.height()) }, ImGuiCond_FirstUseEver); + style.WindowRounding = 10.0f; // Set the window rounding if (ImGui::Begin("Rosbag Inspector", nullptr, flags | ImGuiWindowFlags_MenuBar)) { draw_menu_bar(); @@ -435,7 +438,7 @@ int main(int argc, const char** argv) try draw_error_modal(); } ImGui::End(); - ImGui::PopStyleColor(10); + ImGui::PopStyleColor(11); std::this_thread::sleep_for(std::chrono::milliseconds(10)); } // Cleanup