From 25ca1fcf77e3356e187a8dd63893f67d7843a0f0 Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Sat, 21 Nov 2020 13:16:03 +0100 Subject: [PATCH] Some minor refactoring / polishing. --- src/libslic3r/GCode/GCodeProcessor.cpp | 10 ++++------ src/libslic3r/PrintConfig.cpp | 5 ++++- src/slic3r/GUI/GLCanvas3D.cpp | 2 +- src/slic3r/GUI/GUI_Preview.cpp | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 4785c08984..1b8985d065 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -390,13 +390,11 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename) }; // check for temporary lines - auto is_temporary_decoration = [](const std::string& gcode_line) { + auto is_temporary_decoration = [](const std::string_view gcode_line) { // remove trailing '\n' - std::string line = gcode_line.substr(0, gcode_line.length() - 1); - if (line == ";" + Layer_Change_Tag) - return true; - else - return false; + assert(! gcode_line.empty()); + assert(gcode_line.back() == '\n'); + return gcode_line.substr(0, gcode_line.length() - 1) == ";" + Layer_Change_Tag; }; // Iterators for the normal and silent cached time estimate entry recently processed, used by process_line_G1. diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index f61d2ed9c9..0ad48e6ddf 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -808,7 +808,10 @@ void PrintConfigDef::init_fff_params() def = this->add("filament_spool_weight", coFloats); def->label = L("Spool weight"); - def->tooltip = L("Enter weight of the spool without filament. This is only for statistical information."); + def->tooltip = L("Enter weight of the empty filament spool. " + "One may weigh a partially consumed filament spool before printing and one may compare the measured weight " + "with the calculated weight of the filament with the spool to find out whether the amount " + "of filament on the spool is sufficient to finish the print."); def->sidetext = L("g"); def->min = 0; def->set_default_value(new ConfigOptionFloats { 0. }); diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 34278377b1..b8e3799657 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1091,7 +1091,7 @@ wxDEFINE_EVENT(EVT_GLCANVAS_RELOAD_FROM_DISK, SimpleEvent); const double GLCanvas3D::DefaultCameraZoomToBoxMarginFactor = 1.25; -GLCanvas3D::ArrangeSettings load_arrange_settings() +static GLCanvas3D::ArrangeSettings load_arrange_settings() { GLCanvas3D::ArrangeSettings settings; diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index a3b25fba7b..000e7ab9c6 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -689,7 +689,7 @@ void Preview::update_layers_slider(const std::vector& layers_z, bool kee if (sla_print_technology) m_layers_slider->SetLayersTimes(plater->sla_print().print_statistics().layers_times); else - m_layers_slider->SetLayersTimes(m_gcode_result->time_statistics.modes[0].layers_times); + m_layers_slider->SetLayersTimes(m_gcode_result->time_statistics.modes.front().layers_times); m_layers_slider_sizer->Show((size_t)0); Layout();