diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index c75450080..b72dbd32c 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -41,10 +41,6 @@ //==================== #define ENABLE_2_4_0_BETA2 1 -// Enable modified ImGuiWrapper::slider_float() to create a compound widget where -// an additional button can be used to set the keyboard focus into the slider -// to allow the user to type in the desired value -#define ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT (1 && ENABLE_2_4_0_BETA2) // Enable fit print volume command for circular printbeds #define ENABLE_ENHANCED_PRINT_VOLUME_FIT (1 && ENABLE_2_4_0_BETA2) diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 52c1bf929..151e66d4d 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -284,12 +284,7 @@ void GCodeViewer::SequentialView::Marker::render() const if (width != last_window_width || length != last_text_length) { last_window_width = width; last_text_length = length; -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT imgui.set_requires_extra_frame(); -#else - wxGetApp().plater()->get_current_canvas3D()->set_as_dirty(); - wxGetApp().plater()->get_current_canvas3D()->request_extra_frame(); -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT } imgui.end(); @@ -3056,12 +3051,7 @@ void GCodeViewer::render_legend(float& legend_height) ImGui::PushStyleVar(ImGuiStyleVar_Alpha, 0.3333f); // to avoid the tooltip to change size when moving the mouse -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT imgui.set_requires_extra_frame(); -#else - wxGetApp().plater()->get_current_canvas3D()->set_as_dirty(); - wxGetApp().plater()->get_current_canvas3D()->request_extra_frame(); -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT } } @@ -3792,12 +3782,7 @@ void GCodeViewer::render_legend(float& legend_height) if (can_show_mode_button(mode)) { if (imgui.button(label)) { m_time_estimate_mode = mode; -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT imgui.set_requires_extra_frame(); -#else - wxGetApp().plater()->get_current_canvas3D()->set_as_dirty(); - wxGetApp().plater()->get_current_canvas3D()->request_extra_frame(); -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT } } }; diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 98dd241e4..9fc170ce8 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -731,13 +731,8 @@ void GLCanvas3D::Labels::render(const std::vector& sorted_ } // force re-render while the windows gets to its final size (it takes several frames) -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT if (ImGui::GetWindowContentRegionWidth() + 2.0f * ImGui::GetStyle().WindowPadding.x != ImGui::CalcWindowNextAutoFitSize(ImGui::GetCurrentWindow()).x) imgui.set_requires_extra_frame(); -#else - if (ImGui::GetWindowContentRegionWidth() + 2.0f * ImGui::GetStyle().WindowPadding.x != ImGui::CalcWindowNextAutoFitSize(ImGui::GetCurrentWindow()).x) - m_canvas.request_extra_frame(); -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT imgui.end(); ImGui::PopStyleColor(); @@ -783,13 +778,8 @@ void GLCanvas3D::Tooltip::render(const Vec2d& mouse_position, GLCanvas3D& canvas ImGui::TextUnformatted(m_text.c_str()); // force re-render while the windows gets to its final size (it may take several frames) or while hidden -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT if (alpha < 1.0f || ImGui::GetWindowContentRegionWidth() + 2.0f * ImGui::GetStyle().WindowPadding.x != ImGui::CalcWindowNextAutoFitSize(ImGui::GetCurrentWindow()).x) imgui.set_requires_extra_frame(); -#else - if (alpha < 1.0f || ImGui::GetWindowContentRegionWidth() + 2.0f * ImGui::GetStyle().WindowPadding.x != ImGui::CalcWindowNextAutoFitSize(ImGui::GetCurrentWindow()).x) - canvas.request_extra_frame(); -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT size = ImGui::GetWindowSize(); @@ -2244,29 +2234,20 @@ void GLCanvas3D::on_idle(wxIdleEvent& evt) m_dirty |= wxGetApp().plater()->get_notification_manager()->update_notifications(*this); auto gizmo = wxGetApp().plater()->canvas3D()->get_gizmos_manager().get_current(); if (gizmo != nullptr) m_dirty |= gizmo->update_items_state(); -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT // ImGuiWrapper::m_requires_extra_frame may have been set by a render made outside of the OnIdle mechanism bool imgui_requires_extra_frame = wxGetApp().imgui()->requires_extra_frame(); m_dirty |= imgui_requires_extra_frame; -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT if (!m_dirty) return; -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT // this needs to be done here. // during the render launched by the refresh the value may be set again wxGetApp().imgui()->reset_requires_extra_frame(); -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT _refresh_if_shown_on_screen(); -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT if (m_extra_frame_requested || mouse3d_controller_applied || imgui_requires_extra_frame || wxGetApp().imgui()->requires_extra_frame()) { -#else - if (m_extra_frame_requested || mouse3d_controller_applied) { - m_dirty = true; -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT m_extra_frame_requested = false; evt.RequestMore(); } diff --git a/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp b/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp index d2c32d488..b884d154d 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp @@ -167,11 +167,7 @@ void GLGizmoCut::on_render_input_window(float x, float y, float bottom_limit) ImGui::SetWindowPos(ImVec2(x, y), ImGuiCond_Always); if (last_h != win_h || last_y != y) { // ask canvas for another frame to render the window in the correct position -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT m_imgui->set_requires_extra_frame(); -#else - m_parent.request_extra_frame(); -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT if (last_h != win_h) last_h = win_h; if (last_y != y) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp index cb8ccf282..d79d193d9 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp @@ -134,12 +134,8 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l caption_max += m_imgui->scaled(1.f); const float sliders_left_width = std::max(std::max(autoset_slider_left, smart_fill_slider_left), std::max(cursor_slider_left, clipping_slider_left)); -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT const float slider_icon_width = m_imgui->get_slider_icon_size().x; float window_width = minimal_slider_width + sliders_left_width + slider_icon_width; -#else - float window_width = minimal_slider_width + sliders_left_width; -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT window_width = std::max(window_width, total_text_max); window_width = std::max(window_width, button_width); window_width = std::max(window_width, split_triangles_checkbox_width); @@ -174,15 +170,10 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l float slider_start_position_y = std::max(position_before_text_y, position_after_text_y - slider_height); ImGui::SetCursorPosY(slider_start_position_y); -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT ImGui::PushItemWidth(window_width - sliders_left_width - slider_icon_width); wxString tooltip = format_wxstr(_L("Preselects faces by overhang angle. It is possible to restrict paintable facets to only preselected faces when " "the option \"%1%\" is enabled."), m_desc["on_overhangs_only"]); if (m_imgui->slider_float("##angle_threshold_deg", &m_highlight_by_angle_threshold_deg, 0.f, 90.f, format_str.data(), 1.0f, true, tooltip)) { -#else - ImGui::PushItemWidth(window_width - sliders_left_width); - if (m_imgui->slider_float("##angle_threshold_deg", &m_highlight_by_angle_threshold_deg, 0.f, 90.f, format_str.data())) { -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT m_parent.set_slope_normal_angle(90.f - m_highlight_by_angle_threshold_deg); if (! m_parent.is_using_slope()) { m_parent.use_slope(true); @@ -194,11 +185,6 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l ImGui::SetCursorPosY(std::max(position_before_text_y + slider_height, position_after_text_y)); const float max_tooltip_width = ImGui::GetFontSize() * 20.0f; -#if !ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT - if (ImGui::IsItemHovered()) - m_imgui->tooltip(format_wxstr(_L("Preselects faces by overhang angle. It is possible to restrict paintable facets to only preselected faces when " - "the option \"%1%\" is enabled."), m_desc["on_overhangs_only"]), max_tooltip_width); -#endif // !ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT m_imgui->disabled_begin(m_highlight_by_angle_threshold_deg == 0.f); ImGui::NewLine(); @@ -280,15 +266,8 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l ImGui::AlignTextToFramePadding(); m_imgui->text(m_desc.at("cursor_size")); ImGui::SameLine(sliders_left_width); -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT ImGui::PushItemWidth(window_width - sliders_left_width - slider_icon_width); m_imgui->slider_float("##cursor_radius", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f", 1.0f, true, _L("Alt + Mouse wheel")); -#else - ImGui::PushItemWidth(window_width - sliders_left_width); - m_imgui->slider_float("##cursor_radius", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f"); - if (ImGui::IsItemHovered()) - m_imgui->tooltip(_L("Alt + Mouse wheel"), max_tooltip_width); -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT m_imgui->checkbox(m_desc["split_triangles"], m_triangle_splitting_enabled); @@ -302,22 +281,12 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l m_imgui->text(m_desc["smart_fill_angle"] + ":"); ImGui::SameLine(sliders_left_width); -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT ImGui::PushItemWidth(window_width - sliders_left_width - slider_icon_width); if (m_imgui->slider_float("##smart_fill_angle", &m_smart_fill_angle, SmartFillAngleMin, SmartFillAngleMax, format_str.data(), 1.0f, true, _L("Alt + Mouse wheel"))) -#else - ImGui::PushItemWidth(window_width - sliders_left_width); - if (m_imgui->slider_float("##smart_fill_angle", &m_smart_fill_angle, SmartFillAngleMin, SmartFillAngleMax, format_str.data())) -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT for (auto &triangle_selector : m_triangle_selectors) { triangle_selector->seed_fill_unselect_all_triangles(); triangle_selector->request_update_render_data(); } - -#if !ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT - if (ImGui::IsItemHovered()) - m_imgui->tooltip(_L("Alt + Mouse wheel"), max_tooltip_width); -#endif // !ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT } ImGui::Separator(); @@ -335,18 +304,9 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l auto clp_dist = float(m_c->object_clipper()->get_position()); ImGui::SameLine(sliders_left_width); -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT ImGui::PushItemWidth(window_width - sliders_left_width - slider_icon_width); if (m_imgui->slider_float("##clp_dist", &clp_dist, 0.f, 1.f, "%.2f", 1.0f, true, _L("Ctrl + Mouse wheel"))) m_c->object_clipper()->set_position(clp_dist, true); -#else - ImGui::PushItemWidth(window_width - sliders_left_width); - if (m_imgui->slider_float("##clp_dist", &clp_dist, 0.f, 1.f, "%.2f")) - m_c->object_clipper()->set_position(clp_dist, true); - - if (ImGui::IsItemHovered()) - m_imgui->tooltip(_L("Ctrl + Mouse wheel"), max_tooltip_width); -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT ImGui::Separator(); if (m_imgui->button(m_desc.at("remove_all"))) { diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp index 285089357..69d5ff9ed 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp @@ -312,12 +312,8 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott caption_max += m_imgui->scaled(1.f); const float sliders_left_width = std::max(smart_fill_slider_left, std::max(cursor_slider_left, clipping_slider_left)); -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT const float slider_icon_width = m_imgui->get_slider_icon_size().x; float window_width = minimal_slider_width + sliders_left_width + slider_icon_width; -#else - float window_width = minimal_slider_width + sliders_left_width; -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT window_width = std::max(window_width, total_text_max); window_width = std::max(window_width, button_width); window_width = std::max(window_width, split_triangles_checkbox_width); @@ -445,15 +441,8 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott ImGui::AlignTextToFramePadding(); m_imgui->text(m_desc.at("cursor_size")); ImGui::SameLine(sliders_left_width); -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT ImGui::PushItemWidth(window_width - sliders_left_width - slider_icon_width); m_imgui->slider_float("##cursor_radius", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f", 1.0f, true, _L("Alt + Mouse wheel")); -#else - ImGui::PushItemWidth(window_width - sliders_left_width); - m_imgui->slider_float("##cursor_radius", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f"); - if (ImGui::IsItemHovered()) - m_imgui->tooltip(_L("Alt + Mouse wheel"), max_tooltip_width); -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT m_imgui->checkbox(m_desc["split_triangles"], m_triangle_splitting_enabled); @@ -469,23 +458,13 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott std::string format_str = std::string("%.f") + I18N::translate_utf8("°", "Degree sign to use in the respective slider in MMU gizmo," "placed after the number with no whitespace in between."); ImGui::SameLine(sliders_left_width); -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT ImGui::PushItemWidth(window_width - sliders_left_width - slider_icon_width); if (m_imgui->slider_float("##smart_fill_angle", &m_smart_fill_angle, SmartFillAngleMin, SmartFillAngleMax, format_str.data(), 1.0f, true, _L("Alt + Mouse wheel"))) -#else - ImGui::PushItemWidth(window_width - sliders_left_width); - if(m_imgui->slider_float("##smart_fill_angle", &m_smart_fill_angle, SmartFillAngleMin, SmartFillAngleMax, format_str.data())) -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT for (auto &triangle_selector : m_triangle_selectors) { triangle_selector->seed_fill_unselect_all_triangles(); triangle_selector->request_update_render_data(); } -#if !ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT - if (ImGui::IsItemHovered()) - m_imgui->tooltip(_L("Alt + Mouse wheel"), max_tooltip_width); -#endif // !ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT - ImGui::Separator(); } @@ -500,18 +479,9 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott auto clp_dist = float(m_c->object_clipper()->get_position()); ImGui::SameLine(sliders_left_width); -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT ImGui::PushItemWidth(window_width - sliders_left_width - slider_icon_width); if (m_imgui->slider_float("##clp_dist", &clp_dist, 0.f, 1.f, "%.2f", 1.0f, true, _L("Ctrl + Mouse wheel"))) m_c->object_clipper()->set_position(clp_dist, true); -#else - ImGui::PushItemWidth(window_width - sliders_left_width); - if (m_imgui->slider_float("##clp_dist", &clp_dist, 0.f, 1.f, "%.2f")) - m_c->object_clipper()->set_position(clp_dist, true); - - if (ImGui::IsItemHovered()) - m_imgui->tooltip(_L("Ctrl + Mouse wheel"), max_tooltip_width); -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT ImGui::Separator(); if (m_imgui->button(m_desc.at("remove_all"))) { diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSeam.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSeam.cpp index b11a8bffd..00921aa9c 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSeam.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSeam.cpp @@ -105,12 +105,8 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit) caption_max += m_imgui->scaled(1.f); const float sliders_left_width = std::max(cursor_size_slider_left, clipping_slider_left); -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT const float slider_icon_width = m_imgui->get_slider_icon_size().x; float window_width = minimal_slider_width + sliders_left_width + slider_icon_width; -#else - float window_width = minimal_slider_width + sliders_left_width; -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT window_width = std::max(window_width, total_text_max); window_width = std::max(window_width, button_width); window_width = std::max(window_width, cursor_type_radio_left + cursor_type_radio_sphere + cursor_type_radio_circle); @@ -132,15 +128,8 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit) ImGui::AlignTextToFramePadding(); m_imgui->text(m_desc.at("cursor_size")); ImGui::SameLine(sliders_left_width); -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT ImGui::PushItemWidth(window_width - sliders_left_width - slider_icon_width); m_imgui->slider_float("##cursor_radius", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f", 1.0f, true, _L("Alt + Mouse wheel")); -#else - ImGui::PushItemWidth(window_width - sliders_left_width); - m_imgui->slider_float("##cursor_radius", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f"); - if (ImGui::IsItemHovered()) - m_imgui->tooltip(_L("Alt + Mouse wheel"), max_tooltip_width); -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT ImGui::AlignTextToFramePadding(); m_imgui->text(m_desc.at("cursor_type")); @@ -177,18 +166,9 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit) auto clp_dist = float(m_c->object_clipper()->get_position()); ImGui::SameLine(sliders_left_width); -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT ImGui::PushItemWidth(window_width - sliders_left_width - slider_icon_width); if (m_imgui->slider_float("##clp_dist", &clp_dist, 0.f, 1.f, "%.2f", 1.0f, true, _L("Ctrl + Mouse wheel"))) m_c->object_clipper()->set_position(clp_dist, true); -#else - ImGui::PushItemWidth(window_width - sliders_left_width); - if (m_imgui->slider_float("##clp_dist", &clp_dist, 0.f, 1.f, "%.2f")) - m_c->object_clipper()->set_position(clp_dist, true); - - if (ImGui::IsItemHovered()) - m_imgui->tooltip(_L("Ctrl + Mouse wheel"), max_tooltip_width); -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT ImGui::Separator(); if (m_imgui->button(m_desc.at("remove_all"))) { diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp index 29e1fd2f3..ab35cec9b 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp @@ -644,11 +644,7 @@ RENDER_AGAIN: if ((last_h != win_h) || (last_y != y)) { // ask canvas for another frame to render the window in the correct position -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT m_imgui->set_requires_extra_frame(); -#else - m_parent.request_extra_frame(); -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT if (last_h != win_h) last_h = win_h; if (last_y != y) diff --git a/src/slic3r/GUI/ImGuiWrapper.cpp b/src/slic3r/GUI/ImGuiWrapper.cpp index a01e2ed69..e1563156b 100644 --- a/src/slic3r/GUI/ImGuiWrapper.cpp +++ b/src/slic3r/GUI/ImGuiWrapper.cpp @@ -8,10 +8,8 @@ #include #include #include -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT #include #include -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT #include #include @@ -51,11 +49,9 @@ static const std::map font_icons = { {ImGui::MinimalizeHoverButton , "notification_minimalize_hover" }, {ImGui::RightArrowButton , "notification_right" }, {ImGui::RightArrowHoverButton , "notification_right_hover" }, - {ImGui::PreferencesButton , "notification_preferences" }, - {ImGui::PreferencesHoverButton , "notification_preferences_hover"}, -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT - {ImGui::SliderFloatEditBtnIcon, "edit_button" }, -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT + {ImGui::PreferencesButton , "notification_preferences" }, + {ImGui::PreferencesHoverButton, "notification_preferences_hover"}, + {ImGui::SliderFloatEditBtnIcon, "edit_button" }, }; static const std::map font_icons_large = { {ImGui::CloseNotifButton , "notification_close" }, @@ -483,7 +479,6 @@ void ImGuiWrapper::tooltip(const wxString &label, float wrap_width) ImGui::EndTooltip(); } -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT ImVec2 ImGuiWrapper::get_slider_icon_size() const { return this->calc_button_size(std::wstring(&ImGui::SliderFloatEditBtnIcon, 1)); @@ -560,26 +555,6 @@ bool ImGuiWrapper::slider_float(const wxString& label, float* v, float v_min, fl auto label_utf8 = into_u8(label); return this->slider_float(label_utf8.c_str(), v, v_min, v_max, format, power, clamp, tooltip, show_edit_btn); } -#else -bool ImGuiWrapper::slider_float(const char* label, float* v, float v_min, float v_max, const char* format/* = "%.3f"*/, float power/* = 1.0f*/, bool clamp /*= true*/) -{ - bool ret = ImGui::SliderFloat(label, v, v_min, v_max, format, power); - if (clamp) - *v = std::clamp(*v, v_min, v_max); - return ret; -} - -bool ImGuiWrapper::slider_float(const std::string& label, float* v, float v_min, float v_max, const char* format/* = "%.3f"*/, float power/* = 1.0f*/, bool clamp /*= true*/) -{ - return this->slider_float(label.c_str(), v, v_min, v_max, format, power, clamp); -} - -bool ImGuiWrapper::slider_float(const wxString& label, float* v, float v_min, float v_max, const char* format/* = "%.3f"*/, float power/* = 1.0f*/, bool clamp /*= true*/) -{ - auto label_utf8 = into_u8(label); - return this->slider_float(label_utf8.c_str(), v, v_min, v_max, format, power, clamp); -} -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT bool ImGuiWrapper::combo(const wxString& label, const std::vector& options, int& selection) { diff --git a/src/slic3r/GUI/ImGuiWrapper.hpp b/src/slic3r/GUI/ImGuiWrapper.hpp index 255c4171b..d75d6529a 100644 --- a/src/slic3r/GUI/ImGuiWrapper.hpp +++ b/src/slic3r/GUI/ImGuiWrapper.hpp @@ -33,9 +33,7 @@ class ImGuiWrapper unsigned m_mouse_buttons{ 0 }; bool m_disabled{ false }; bool m_new_frame_open{ false }; -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT bool m_requires_extra_frame{ false }; -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT std::string m_clipboard_text; public: @@ -103,16 +101,10 @@ public: void tooltip(const wxString &label, float wrap_width); // Float sliders: Manually inserted values aren't clamped by ImGui.Using this wrapper function does (when clamp==true). -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT ImVec2 get_slider_icon_size() const; bool slider_float(const char* label, float* v, float v_min, float v_max, const char* format = "%.3f", float power = 1.0f, bool clamp = true, const wxString& tooltip = {}, bool show_edit_btn = true); bool slider_float(const std::string& label, float* v, float v_min, float v_max, const char* format = "%.3f", float power = 1.0f, bool clamp = true, const wxString& tooltip = {}, bool show_edit_btn = true); bool slider_float(const wxString& label, float* v, float v_min, float v_max, const char* format = "%.3f", float power = 1.0f, bool clamp = true, const wxString& tooltip = {}, bool show_edit_btn = true); -#else - bool slider_float(const char* label, float* v, float v_min, float v_max, const char* format = "%.3f", float power = 1.0f, bool clamp = true); - bool slider_float(const std::string& label, float* v, float v_min, float v_max, const char* format = "%.3f", float power = 1.0f, bool clamp = true); - bool slider_float(const wxString& label, float* v, float v_min, float v_max, const char* format = "%.3f", float power = 1.0f, bool clamp = true); -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT bool combo(const wxString& label, const std::vector& options, int& selection); // Use -1 to not mark any option as selected bool undo_redo_list(const ImVec2& size, const bool is_undo, bool (*items_getter)(const bool, int, const char**), int& hovered, int& selected, int& mouse_wheel); @@ -128,11 +120,9 @@ public: bool want_text_input() const; bool want_any_input() const; -#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT bool requires_extra_frame() const { return m_requires_extra_frame; } void set_requires_extra_frame() { m_requires_extra_frame = true; } void reset_requires_extra_frame() { m_requires_extra_frame = false; } -#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT static const ImVec4 COL_GREY_DARK; static const ImVec4 COL_GREY_LIGHT;