Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some utf-8 related issues in Cut gizmo #6050

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/slic3r/GUI/Gizmos/GLGizmoCut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ bool GLGizmoCut3D::render_slider_double_input(const std::string& label, float& v
float min_tolerance = tolerance_in < 0.f ? UndefMinVal : 0.f;
const float max_tolerance_v = max_tolerance > 0.f ? std::min(max_tolerance, 0.5f * mean_size) : 0.5f * mean_size;

m_imgui->bbl_slider_float_style(("##tolerance_" + label).c_str(), &tolerance, min_tolerance, max_tolerance_v, format.c_str(), 1.f, true,
m_imgui->bbl_slider_float_style("##tolerance_" + label, &tolerance, min_tolerance, max_tolerance_v, format.c_str(), 1.f, true,
_L("Tolerance"));

left_width += (slider_with + item_in_gap);
Expand Down Expand Up @@ -699,7 +699,7 @@ bool GLGizmoCut3D::render_reset_button(const std::string& label_id, const std::s
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, {0.4f, 0.4f, 0.4f, 1.0f});
ImGui::PushStyleColor(ImGuiCol_ButtonActive, {0.4f, 0.4f, 0.4f, 1.0f});

const bool revert = m_imgui->button(wxString(ImGui::RevertBtn) + "##" + label_id);
const bool revert = m_imgui->button(wxString(ImGui::RevertBtn) + "##" + wxString::FromUTF8(label_id));

ImGui::PopStyleColor(3);

Expand Down Expand Up @@ -2534,7 +2534,7 @@ void GLGizmoCut3D::render_groove_float_input(const std::string& label, float& in

m_imgui->disabled_begin(is_approx(in_val, init_val) && is_approx(in_tolerance, 0.1f));
const std::string act_name = _u8L("Reset");
if (render_reset_button(("##groove_" + label + act_name).c_str(), act_name)) {
if (render_reset_button("##groove_" + label + act_name, act_name)) {
Plater::TakeSnapshot snapshot(wxGetApp().plater(), GUI::format("%1%: %2%", act_name, label), UndoRedo::SnapshotType::GizmoAction);
in_val = init_val;
in_tolerance = 0.1f;
Expand Down Expand Up @@ -2574,7 +2574,7 @@ bool GLGizmoCut3D::render_angle_input(const std::string& label, float& in_val, c
const float old_val = val;

const std::string format = "%.0f " + _u8L("°");
m_imgui->bbl_slider_float_style(("##angle_" + label).c_str(), &val, min_val, max_val, format.c_str(), 1.f, true, from_u8(label));
m_imgui->bbl_slider_float_style("##angle_" + label, &val, min_val, max_val, format.c_str(), 1.f, true, from_u8(label));

ImGui::SameLine(left_width);
ImGui::PushItemWidth(input_width);
Expand All @@ -2597,7 +2597,7 @@ bool GLGizmoCut3D::render_angle_input(const std::string& label, float& in_val, c

m_imgui->disabled_begin(is_approx(in_val, init_val));
const std::string act_name = _u8L("Reset");
if (render_reset_button(("##angle_" + label + act_name).c_str(), act_name)) {
if (render_reset_button("##angle_" + label + act_name, act_name)) {
Plater::TakeSnapshot snapshot(wxGetApp().plater(), GUI::format("%1%: %2%", act_name, label), UndoRedo::SnapshotType::GizmoAction);
in_val = init_val;
is_changed = true;
Expand Down Expand Up @@ -2640,7 +2640,7 @@ void GLGizmoCut3D::render_snap_specific_input(const std::string& label, const wx

float val = in_val * 100.f;
const float old_val = val;
m_imgui->bbl_slider_float_style(("##snap_" + label).c_str(), &val, min_val, max_val, format.c_str(), 1.f, true, tooltip);
m_imgui->bbl_slider_float_style("##snap_" + label, &val, min_val, max_val, format.c_str(), 1.f, true, tooltip);

ImGui::SameLine(left_width);
ImGui::PushItemWidth(input_width);
Expand All @@ -2655,7 +2655,7 @@ void GLGizmoCut3D::render_snap_specific_input(const std::string& label, const wx

m_imgui->disabled_begin(is_approx(in_val, init_val));
const std::string act_name = _u8L("Reset");
if (render_reset_button(("##snap_" + label + act_name).c_str(), act_name)) {
if (render_reset_button("##snap_" + label + act_name, act_name)) {
in_val = init_val;
is_changed = true;
}
Expand Down Expand Up @@ -2690,7 +2690,7 @@ void GLGizmoCut3D::render_cut_plane_input_window(CutConnectors &connectors, floa
const bool is_cut_plane_init = m_rotation_m.isApprox(Transform3d::Identity()) && m_bb_center.isApprox(m_plane_center);
m_imgui->disabled_begin(is_cut_plane_init);
std::string act_name = _u8L("Reset cutting plane");
if (render_reset_button("cut_plane", into_u8(act_name))) {
if (render_reset_button("cut_plane", act_name)) {
Plater::TakeSnapshot snapshot(wxGetApp().plater(), act_name, UndoRedo::SnapshotType::GizmoAction);
reset_cut_plane();
}
Expand All @@ -2710,7 +2710,7 @@ void GLGizmoCut3D::render_cut_plane_input_window(CutConnectors &connectors, floa

m_imgui->disabled_begin(is_cut_plane_init && !has_connectors);
act_name = _u8L("Reset cut");
if (m_imgui->button(act_name, _u8L("Reset cutting plane and remove connectors"))) {
if (m_imgui->button(wxString::FromUTF8(act_name), _L("Reset cutting plane and remove connectors"))) {
Plater::TakeSnapshot snapshot(wxGetApp().plater(), act_name, UndoRedo::SnapshotType::GizmoAction);
reset_cut_plane();
reset_connectors();
Expand Down
Loading