Merge remote-tracking branch 'origin/stable'

This commit is contained in:
Vojtech Bubnik 2022-02-04 17:01:18 +01:00
commit 6ed037ab7b
5 changed files with 34 additions and 31 deletions

View file

@ -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<float>(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<float>(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<PrintEstimatedStatistics::ETimeMode>(i), static_cast<Axis>(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<float>(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<float>(m_end_position[E] - m_start_position[E]),
m_feedrate,
m_width,
m_height,

View file

@ -178,7 +178,7 @@ namespace Slic3r {
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
private:
using AxisCoords = std::array<float, 4>;
using AxisCoords = std::array<double, 4>;
using ExtruderColors = std::vector<unsigned char>;
using ExtruderTemps = std::vector<float>;

View file

@ -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;

View file

@ -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();
});

View file

@ -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();