diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 995964eb5f..58e8ed787a 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -1955,7 +1955,7 @@ void GCodeProcessor::process_tags(const std::string_view comment, bool producers if (!m_result.spiral_vase_layers.empty() && m_end_position[Z] == m_result.spiral_vase_layers.back().first) m_result.spiral_vase_layers.back().second.second = move_id; else - m_result.spiral_vase_layers.push_back({ m_end_position[Z], { move_id, move_id } }); + m_result.spiral_vase_layers.push_back({ static_cast(m_end_position[Z]), { move_id, move_id } }); } #endif // ENABLE_SPIRAL_VASE_LAYERS return; @@ -2505,7 +2505,7 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line) AxisCoords delta_pos; for (unsigned char a = X; a <= E; ++a) { delta_pos[a] = m_end_position[a] - m_start_position[a]; - max_abs_delta = std::max(max_abs_delta, std::abs(delta_pos[a])); + max_abs_delta = std::max(max_abs_delta, std::abs(delta_pos[a])); } // no displacement, return @@ -2615,7 +2615,7 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line) if (curr.abs_axis_feedrate[a] != 0.0f) { float axis_max_feedrate = get_axis_max_feedrate(static_cast(i), static_cast(a)); if (axis_max_feedrate != 0.0f) - min_feedrate_factor = std::min(min_feedrate_factor, axis_max_feedrate / curr.abs_axis_feedrate[a]); + min_feedrate_factor = std::min(min_feedrate_factor, axis_max_feedrate / curr.abs_axis_feedrate[a]); } } @@ -3279,7 +3279,7 @@ void GCodeProcessor::store_move_vertex(EMoveType type) #else Vec3f(m_end_position[X], m_end_position[Y], m_processing_start_custom_gcode ? m_first_layer_height : m_end_position[Z]) + m_extruder_offsets[m_extruder_id], #endif // ENABLE_Z_OFFSET_CORRECTION - m_end_position[E] - m_start_position[E], + static_cast(m_end_position[E] - m_start_position[E]), m_feedrate, m_width, m_height, diff --git a/src/libslic3r/GCode/GCodeProcessor.hpp b/src/libslic3r/GCode/GCodeProcessor.hpp index 153f4a9c5c..7e4bb831d8 100644 --- a/src/libslic3r/GCode/GCodeProcessor.hpp +++ b/src/libslic3r/GCode/GCodeProcessor.hpp @@ -178,7 +178,7 @@ namespace Slic3r { #endif // ENABLE_GCODE_VIEWER_DATA_CHECKING private: - using AxisCoords = std::array; + using AxisCoords = std::array; using ExtruderColors = std::vector; using ExtruderTemps = std::vector; diff --git a/src/slic3r/GUI/MsgDialog.cpp b/src/slic3r/GUI/MsgDialog.cpp index acdbd249c4..35d68e52e5 100644 --- a/src/slic3r/GUI/MsgDialog.cpp +++ b/src/slic3r/GUI/MsgDialog.cpp @@ -95,9 +95,9 @@ wxButton* MsgDialog::get_button(wxWindowID btn_id){ void MsgDialog::apply_style(long style) { if (style & wxOK) add_button(wxID_OK, true); - if (style & wxYES) add_button(wxID_YES, true); - if (style & wxNO) add_button(wxID_NO); - if (style & wxCANCEL) add_button(wxID_CANCEL); + if (style & wxYES) add_button(wxID_YES, !(style & wxNO_DEFAULT)); + if (style & wxNO) add_button(wxID_NO, (style & wxNO_DEFAULT)); + if (style & wxCANCEL) add_button(wxID_CANCEL, (style & wxCANCEL_DEFAULT)); logo->SetBitmap( create_scaled_bitmap(style & wxICON_WARNING ? "exclamation" : style & wxICON_INFORMATION ? "info" : @@ -299,25 +299,12 @@ wxString get_wraped_wxString(const wxString& in, size_t line_len /*=80*/) for (size_t i = 0; i < in.size();) { // Overwrite the character (space or newline) starting at ibreak? bool overwrite = false; -#if wxUSE_UNICODE_WCHAR - // On Windows, most likely the internal representation of wxString is wide char. - size_t end = std::min(in.size(), i + line_len); - size_t ibreak = end; - for (size_t j = i; j < end; ++ j) { - if (bool newline = in[j] == '\n'; in[j] == ' ' || in[j] == '\t' || newline) { - ibreak = j; - overwrite = true; - if (newline) - break; - } else if (in[j] == '/' || in[j] == '\\') - ibreak = j + 1; - } -#else // UTF8 representation of wxString. // Where to break the line, index of character at the start of a UTF-8 sequence. size_t ibreak = size_t(-1); // Overwrite the character at ibreak (it is a whitespace) or not? - for (size_t cnt = 0, j = i; j < in.size();) { + size_t j = i; + for (size_t cnt = 0; j < in.size();) { if (bool newline = in[j] == '\n'; in[j] == ' ' || in[j] == '\t' || newline) { // Overwrite the whitespace. ibreak = j ++; @@ -326,16 +313,23 @@ wxString get_wraped_wxString(const wxString& in, size_t line_len /*=80*/) break; } else if (in[j] == '/') { // Insert after the slash. - ibreak = ++ j; + ibreak = ++ j; + overwrite = false; } else j += get_utf8_sequence_length(in.c_str() + j, in.size() - j); if (++ cnt == line_len) { - if (ibreak == size_t(-1)) - ibreak = j; + if (ibreak == size_t(-1)) { + ibreak = j; + overwrite = false; + } break; } } -#endif + if (j == in.size()) { + out.append(in.begin() + i, in.end()); + break; + } + assert(ibreak != size_t(-1)); out.append(in.begin() + i, in.begin() + ibreak); out.append('\n'); i = ibreak; diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index a20bdb8310..b97b6cc39c 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -4112,7 +4112,10 @@ wxSizer* TabPrint::create_manage_substitution_widget(wxWindow* parent) }); create_btn(&m_del_all_substitutions_btn, _L("Delete all"), "cross"); - m_del_all_substitutions_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent e) { + m_del_all_substitutions_btn->Bind(wxEVT_BUTTON, [this, parent](wxCommandEvent e) { + if (MessageDialog(parent, _L("Are you sure you want to delete all substitutions?"), SLIC3R_APP_NAME, wxYES_NO | wxICON_QUESTION). + ShowModal() != wxID_YES) + return; m_subst_manager.delete_all(); m_del_all_substitutions_btn->Hide(); }); diff --git a/src/slic3r/GUI/UnsavedChangesDialog.cpp b/src/slic3r/GUI/UnsavedChangesDialog.cpp index c62977bbaf..b3b0c15b49 100644 --- a/src/slic3r/GUI/UnsavedChangesDialog.cpp +++ b/src/slic3r/GUI/UnsavedChangesDialog.cpp @@ -656,6 +656,7 @@ void DiffViewCtrl::Clear() { model->Clear(); m_items_map.clear(); + m_has_long_strings = false; } wxString DiffViewCtrl::get_short_string(wxString full_string) @@ -1523,8 +1524,8 @@ DiffPresetDialog::DiffPresetDialog(MainFrame* mainframe) topSizer->Add(m_top_info_line, 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, 2 * border); topSizer->Add(presets_sizer, 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border); topSizer->Add(m_show_all_presets, 0, wxEXPAND | wxALL, border); - topSizer->Add(m_bottom_info_line, 0, wxEXPAND | wxALL, 2 * border); topSizer->Add(m_tree, 1, wxEXPAND | wxALL, border); + topSizer->Add(m_bottom_info_line, 0, wxEXPAND | wxALL, 2 * border); this->SetMinSize(wxSize(80 * em, 30 * em)); this->SetSizer(topSizer); @@ -1689,12 +1690,17 @@ void DiffPresetDialog::update_tree() left_val, right_val, category_icon_map.at(option.category)); } } + + if (m_tree->has_long_strings()) + bottom_info = _L("Some fields are too long to fit. Right mouse click reveals the full text."); bool tree_was_shown = m_tree->IsShown(); m_tree->Show(show_tree); - if (!show_tree) + + bool show_bottom_info = !show_tree || m_tree->has_long_strings(); + if (show_bottom_info) m_bottom_info_line->SetLabel(bottom_info); - m_bottom_info_line->Show(!show_tree); + m_bottom_info_line->Show(show_bottom_info); if (tree_was_shown == m_tree->IsShown()) Layout();