diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp index 7c94033822..4b3d33a549 100644 --- a/src/libslic3r/AppConfig.cpp +++ b/src/libslic3r/AppConfig.cpp @@ -266,14 +266,14 @@ void AppConfig::save() else c << "# " << Slic3r::header_gcodeviewer_generated() << std::endl; // Make sure the "no" category is written first. - for (const std::pair &kvp : m_storage[""]) + for (const auto& kvp : m_storage[""]) c << kvp.first << " = " << kvp.second << std::endl; // Write the other categories. - for (const auto category : m_storage) { + for (const auto& category : m_storage) { if (category.first.empty()) continue; c << std::endl << "[" << category.first << "]" << std::endl; - for (const std::pair &kvp : category.second) + for (const auto& kvp : category.second) c << kvp.first << " = " << kvp.second << std::endl; } // Write vendor sections diff --git a/src/libslic3r/Config.hpp b/src/libslic3r/Config.hpp index 0b91648da2..4b726bea9e 100644 --- a/src/libslic3r/Config.hpp +++ b/src/libslic3r/Config.hpp @@ -1344,7 +1344,7 @@ public: static bool has(T value) { - for (const std::pair &kvp : ConfigOptionEnum::get_enum_values()) + for (const auto &kvp : ConfigOptionEnum::get_enum_values()) if (kvp.second == value) return true; return false; diff --git a/src/libslic3r/GCode/WipeTower.cpp b/src/libslic3r/GCode/WipeTower.cpp index 0f72dc415d..e39b819191 100644 --- a/src/libslic3r/GCode/WipeTower.cpp +++ b/src/libslic3r/GCode/WipeTower.cpp @@ -405,7 +405,7 @@ public: WipeTowerWriter& append(const std::string& text) { m_gcode += text; return *this; } - std::vector wipe_path() const + const std::vector& wipe_path() const { return m_wipe_path; } diff --git a/src/libslic3r/LayerRegion.cpp b/src/libslic3r/LayerRegion.cpp index b3383fcc5a..3763f2498b 100644 --- a/src/libslic3r/LayerRegion.cpp +++ b/src/libslic3r/LayerRegion.cpp @@ -290,7 +290,7 @@ void LayerRegion::process_external_surfaces(const Layer *lower_layer, const Poly surfaces_append(bottom, union_ex(grown, true), bridges[idx_last]); } - fill_boundaries = std::move(to_polygons(fill_boundaries_ex)); + fill_boundaries = to_polygons(fill_boundaries_ex); BOOST_LOG_TRIVIAL(trace) << "Processing external surface, detecting bridges - done"; } @@ -327,7 +327,7 @@ void LayerRegion::process_external_surfaces(const Layer *lower_layer, const Poly surfaces_append( new_surfaces, // Don't use a safety offset as fill_boundaries were already united using the safety offset. - std::move(intersection_ex(polys, fill_boundaries, false)), + intersection_ex(polys, fill_boundaries, false), s1); } } @@ -424,7 +424,7 @@ void LayerRegion::elephant_foot_compensation_step(const float elephant_foot_comp Polygons slices_polygons = to_polygons(slices_expolygons); Polygons tmp = intersection(slices_polygons, trimming_polygons, false); append(tmp, diff(slices_polygons, offset(offset_ex(slices_expolygons, -elephant_foot_compensation_perimeter_step), elephant_foot_compensation_perimeter_step))); - this->slices.set(std::move(union_ex(tmp)), stInternal); + this->slices.set(union_ex(tmp), stInternal); } void LayerRegion::export_region_slices_to_svg(const char *path) const diff --git a/src/libslic3r/TriangleMesh.hpp b/src/libslic3r/TriangleMesh.hpp index 71cd231c3f..9625298f4e 100644 --- a/src/libslic3r/TriangleMesh.hpp +++ b/src/libslic3r/TriangleMesh.hpp @@ -103,7 +103,7 @@ enum FacetEdgeType { class IntersectionReference { public: - IntersectionReference() : point_id(-1), edge_id(-1) {}; + IntersectionReference() : point_id(-1), edge_id(-1) {} IntersectionReference(int point_id, int edge_id) : point_id(point_id), edge_id(edge_id) {} // Where is this intersection point located? On mesh vertex or mesh edge? // Only one of the following will be set, the other will remain set to -1. @@ -116,7 +116,7 @@ public: class IntersectionPoint : public Point, public IntersectionReference { public: - IntersectionPoint() {}; + IntersectionPoint() {} IntersectionPoint(int point_id, int edge_id, const Point &pt) : IntersectionReference(point_id, edge_id), Point(pt) {} IntersectionPoint(const IntersectionReference &ir, const Point &pt) : IntersectionReference(ir), Point(pt) {} // Inherits coord_t x, y diff --git a/src/slic3r/Config/Snapshot.cpp b/src/slic3r/Config/Snapshot.cpp index 900172d3eb..ecfc32b58f 100644 --- a/src/slic3r/Config/Snapshot.cpp +++ b/src/slic3r/Config/Snapshot.cpp @@ -251,7 +251,7 @@ bool Snapshot::equal_to_active(const AppConfig &app_config) const return false; matched.insert(vc.name); } - for (const std::pair>> &v : app_config.vendors()) + for (const auto &v : app_config.vendors()) if (matched.find(v.first) == matched.end() && ! v.second.empty()) // There are more vendors currently installed than enabled in the snapshot. return false; @@ -402,7 +402,7 @@ const Snapshot& SnapshotDB::take_snapshot(const AppConfig &app_config, Snapshot: snapshot.filaments.emplace_back(app_config.get("presets", name)); } // Vendor specific config bundles and installed printers. - for (const std::pair>> &vendor : app_config.vendors()) { + for (const auto &vendor : app_config.vendors()) { Snapshot::VendorConfig cfg; cfg.name = vendor.first; cfg.models_variants_installed = vendor.second; diff --git a/src/slic3r/GUI/BonjourDialog.cpp b/src/slic3r/GUI/BonjourDialog.cpp index 51f18dce72..65d5524c2d 100644 --- a/src/slic3r/GUI/BonjourDialog.cpp +++ b/src/slic3r/GUI/BonjourDialog.cpp @@ -119,7 +119,7 @@ bool BonjourDialog::show_and_lookup() // Note: More can be done here when we support discovery of hosts other than Octoprint and SL1 Bonjour::TxtKeys txt_keys { "version", "model" }; - bonjour = std::move(Bonjour("octoprint") + bonjour = Bonjour("octoprint") .set_txt_keys(std::move(txt_keys)) .set_retries(3) .set_timeout(4) @@ -139,8 +139,7 @@ bool BonjourDialog::show_and_lookup() wxQueueEvent(dialog, evt); } }) - .lookup() - ); + .lookup(); bool res = ShowModal() == wxID_OK && list->GetFirstSelected() >= 0; { diff --git a/src/slic3r/GUI/ConfigSnapshotDialog.cpp b/src/slic3r/GUI/ConfigSnapshotDialog.cpp index 487604b1c0..9f996d378b 100644 --- a/src/slic3r/GUI/ConfigSnapshotDialog.cpp +++ b/src/slic3r/GUI/ConfigSnapshotDialog.cpp @@ -68,7 +68,7 @@ static wxString generate_html_row(const Config::Snapshot &snapshot, bool row_eve if (vc.version.max_slic3r_version != Semver::inf()) text += ", " + _(L("max PrusaSlicer version")) + ": " + vc.version.max_slic3r_version.to_string(); text += "
"; - for (const std::pair> &model : vc.models_variants_installed) { + for (const auto& model : vc.models_variants_installed) { text += _(L("model")) + ": " + model.first + ", " + _(L("variants")) + ": "; for (const std::string &variant : model.second) { if (&variant != &*model.second.begin()) diff --git a/src/slic3r/GUI/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp index 568c15a165..047a0046f4 100644 --- a/src/slic3r/GUI/ConfigWizard.cpp +++ b/src/slic3r/GUI/ConfigWizard.cpp @@ -1872,7 +1872,7 @@ void ConfigWizard::priv::load_vendors() std::map section_new; if (app_config->has_section(section_name)) { const std::map §ion_old = app_config->get_section(section_name); - for (const std::pair &material_name_and_installed : section_old) + for (const auto& material_name_and_installed : section_old) if (material_name_and_installed.second == "1") { // Material is installed. Resolve it in bundles. size_t num_found = 0; @@ -2248,7 +2248,7 @@ bool ConfigWizard::priv::check_and_install_missing_materials(Technology technolo if ((only_for_model_id.empty() || only_for_model_id == printer_model->id) && printer_models_without_material.find(printer_model) == printer_models_without_material.end()) { bool has_material = false; - for (const std::pair &preset : appconfig_presets) { + for (const auto& preset : appconfig_presets) { if (preset.second == "1") { const Preset *material = materials.find_preset(preset.first, false); if (material != nullptr && is_compatible_with_printer(PresetWithVendorProfile(*material, nullptr), PresetWithVendorProfile(printer, nullptr))) { diff --git a/src/slic3r/GUI/FirmwareDialog.cpp b/src/slic3r/GUI/FirmwareDialog.cpp index 879e7fe34e..046d9d1386 100644 --- a/src/slic3r/GUI/FirmwareDialog.cpp +++ b/src/slic3r/GUI/FirmwareDialog.cpp @@ -648,7 +648,7 @@ void FirmwareDialog::priv::perform_upload() } } }) - .on_message(std::move([q, extra_verbose](const char *msg, unsigned /* size */) { + .on_message([q, extra_verbose](const char *msg, unsigned /* size */) { if (extra_verbose) { BOOST_LOG_TRIVIAL(debug) << "avrdude: " << msg; } @@ -665,19 +665,19 @@ void FirmwareDialog::priv::perform_upload() evt->SetExtraLong(AE_MESSAGE); evt->SetString(std::move(wxmsg)); wxQueueEvent(q, evt); - })) - .on_progress(std::move([q](const char * /* task */, unsigned progress) { + }) + .on_progress([q](const char * /* task */, unsigned progress) { auto evt = new wxCommandEvent(EVT_AVRDUDE, q->GetId()); evt->SetExtraLong(AE_PROGRESS); evt->SetInt(progress); wxQueueEvent(q, evt); - })) - .on_complete(std::move([this]() { + }) + .on_complete([this]() { auto evt = new wxCommandEvent(EVT_AVRDUDE, this->q->GetId()); evt->SetExtraLong(AE_EXIT); evt->SetInt(this->avrdude->exit_code()); wxQueueEvent(this->q, evt); - })) + }) .run(); } diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 94e55ce5c4..87bc1090fc 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -117,7 +117,9 @@ ObjectList::ObjectList(wxWindow* parent) : // detect the current mouse position here, to pass it to list_manipulation() method // if we detect it later, the user may have moved the mouse pointer while calculations are performed, and this would mess-up the HitTest() call performed into list_manipulation() // see: https://github.com/prusa3d/PrusaSlicer/issues/3802 +#ifndef __WXOSX__ const wxPoint mouse_pos = this->get_mouse_position_in_control(); +#endif #ifndef __APPLE__ // On Windows and Linux, forces a kill focus emulation on the object manipulator fields because this event handler is called @@ -752,7 +754,7 @@ void ObjectList::copy_layers_to_clipboard() return; } - for (const auto layer_item : sel_layers) + for (const auto& layer_item : sel_layers) if (m_objects_model->GetItemType(layer_item) & itLayer) { auto range = m_objects_model->GetLayerRangeByItem(layer_item); auto it = ranges.find(range); @@ -778,7 +780,7 @@ void ObjectList::paste_layers_into_list() t_layer_config_ranges& ranges = object(obj_idx)->layer_config_ranges; // and create Layer item(s) according to the layer_config_ranges - for (const auto range : cache_ranges) + for (const auto& range : cache_ranges) ranges.emplace(range); layers_item = add_layer_root_item(object_item); @@ -1842,7 +1844,7 @@ void ObjectList::append_menu_item_export_stl(wxMenu* menu) const void ObjectList::append_menu_item_reload_from_disk(wxMenu* menu) const { append_menu_item(menu, wxID_ANY, _(L("Reload from disk")), _(L("Reload the selected volumes from disk")), - [this](wxCommandEvent&) { wxGetApp().plater()->reload_from_disk(); }, "", menu, + [](wxCommandEvent&) { wxGetApp().plater()->reload_from_disk(); }, "", menu, []() { return wxGetApp().plater()->can_reload_from_disk(); }, wxGetApp().plater()); } @@ -2063,9 +2065,9 @@ wxMenu* ObjectList::create_settings_popupmenu(wxMenu *parent_menu) for (auto cat : settings_menu) { append_menu_item(menu, wxID_ANY, _(cat.first), "", - [menu, this](wxCommandEvent& event) { get_settings_choice(menu->GetLabel(event.GetId())); }, + [this, menu](wxCommandEvent& event) { get_settings_choice(menu->GetLabel(event.GetId())); }, CATEGORY_ICON.find(cat.first) == CATEGORY_ICON.end() ? wxNullBitmap : CATEGORY_ICON.at(cat.first), parent_menu, - [this]() { return true; }, wxGetApp().plater()); + []() { return true; }, wxGetApp().plater()); } return menu; @@ -2084,9 +2086,9 @@ void ObjectList::create_freq_settings_popupmenu(wxMenu *menu, const bool is_obje continue; append_menu_item(menu, wxID_ANY, _(it.first), "", - [menu, this](wxCommandEvent& event) { get_freq_settings_choice(menu->GetLabel(event.GetId())); }, + [this, menu](wxCommandEvent& event) { get_freq_settings_choice(menu->GetLabel(event.GetId())); }, CATEGORY_ICON.find(it.first) == CATEGORY_ICON.end() ? wxNullBitmap : CATEGORY_ICON.at(it.first), menu, - [this]() { return true; }, wxGetApp().plater()); + []() { return true; }, wxGetApp().plater()); } #if 0 // Add "Quick" settings bundles @@ -4600,7 +4602,7 @@ void ObjectList::show_multi_selection_menu() append_menu_item_change_extruder(menu); append_menu_item(menu, wxID_ANY, _(L("Reload from disk")), _(L("Reload the selected volumes from disk")), - [this](wxCommandEvent&) { wxGetApp().plater()->reload_from_disk(); }, "", menu, []() { + [](wxCommandEvent&) { wxGetApp().plater()->reload_from_disk(); }, "", menu, []() { return wxGetApp().plater()->can_reload_from_disk(); }, wxGetApp().plater()); diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 9c30ac330c..3fccb7f843 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -64,10 +64,10 @@ public: // Only allow opening a new PrusaSlicer instance on OSX if "single_instance" is disabled, // as starting new instances would interfere with the locking mechanism of "single_instance" support. append_menu_item(menu, wxID_ANY, _L("Open new instance"), _L("Open a new PrusaSlicer instance"), - [this](wxCommandEvent&) { start_new_slicer(); }, "", nullptr); + [](wxCommandEvent&) { start_new_slicer(); }, "", nullptr); } append_menu_item(menu, wxID_ANY, _L("G-code preview") + dots, _L("Open G-code viewer"), - [this](wxCommandEvent&) { start_new_gcodeviewer_open_file(); }, "", nullptr); + [](wxCommandEvent&) { start_new_gcodeviewer_open_file(); }, "", nullptr); return menu; } }; @@ -78,9 +78,9 @@ public: wxMenu *CreatePopupMenu() override { wxMenu *menu = new wxMenu; append_menu_item(menu, wxID_ANY, _L("Open PrusaSlicer"), _L("Open a new PrusaSlicer instance"), - [this](wxCommandEvent&) { start_new_slicer(nullptr, true); }, "", nullptr); + [](wxCommandEvent&) { start_new_slicer(nullptr, true); }, "", nullptr); append_menu_item(menu, wxID_ANY, _L("G-code preview") + dots, _L("Open new G-code viewer"), - [this](wxCommandEvent&) { start_new_gcodeviewer_open_file(); }, "", nullptr); + [](wxCommandEvent&) { start_new_gcodeviewer_open_file(); }, "", nullptr); return menu; } }; @@ -231,7 +231,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S // So, redraw explicitly canvas, when application is moved //FIXME maybe this is useful for __WXGTK3__ as well? #if __APPLE__ - Bind(wxEVT_MOVE, [this](wxMoveEvent& event) { + Bind(wxEVT_MOVE, [](wxMoveEvent& event) { wxGetApp().plater()->get_current_canvas3D()->set_as_dirty(); wxGetApp().plater()->get_current_canvas3D()->request_extra_frame(); event.Skip(); @@ -1190,7 +1190,7 @@ void MainFrame::init_menubar_as_editor() windowMenu->AppendSeparator(); append_menu_item(windowMenu, wxID_ANY, _L("Open new instance") + "\tCtrl+Shift+I", _L("Open a new PrusaSlicer instance"), - [this](wxCommandEvent&) { start_new_slicer(); }, "", nullptr, [this]() {return m_plater != nullptr && wxGetApp().app_config->get("single_instance") != "1"; }, this); + [](wxCommandEvent&) { start_new_slicer(); }, "", nullptr, [this]() {return m_plater != nullptr && wxGetApp().app_config->get("single_instance") != "1"; }, this); windowMenu->AppendSeparator(); append_menu_item(windowMenu, wxID_ANY, _L("Compare presets")/* + "\tCtrl+F"*/, _L("Compare presets"), @@ -1263,8 +1263,8 @@ void MainFrame::init_menubar_as_gcodeviewer() [this](wxCommandEvent&) { if (m_plater != nullptr) m_plater->export_toolpaths_to_obj(); }, "export_plater", nullptr, [this]() {return can_export_toolpaths(); }, this); append_menu_item(fileMenu, wxID_ANY, _L("Open &PrusaSlicer") + dots, _L("Open PrusaSlicer"), - [this](wxCommandEvent&) { start_new_slicer(); }, "", nullptr, - [this]() {return true; }, this); + [](wxCommandEvent&) { start_new_slicer(); }, "", nullptr, + []() {return true; }, this); fileMenu->AppendSeparator(); append_menu_item(fileMenu, wxID_EXIT, _L("&Quit"), wxString::Format(_L("Quit %s"), SLIC3R_APP_NAME), [this](wxCommandEvent&) { Close(false); }); diff --git a/src/slic3r/GUI/Mouse3DController.cpp b/src/slic3r/GUI/Mouse3DController.cpp index 692ae7f1ba..9ff5688be2 100644 --- a/src/slic3r/GUI/Mouse3DController.cpp +++ b/src/slic3r/GUI/Mouse3DController.cpp @@ -397,7 +397,7 @@ void Mouse3DController::save_config(AppConfig &appconfig) const // We do not synchronize m_params_by_device with the background thread explicitely // as there should be a full memory barrier executed once the background thread is stopped. - for (const std::pair &key_value_pair : m_params_by_device) { + for (const auto &key_value_pair : m_params_by_device) { const std::string &device_name = key_value_pair.first; const Params ¶ms = key_value_pair.second; // Store current device parameters into the config diff --git a/src/slic3r/GUI/ObjectDataViewModel.cpp b/src/slic3r/GUI/ObjectDataViewModel.cpp index ef65f59748..d69f2d0773 100644 --- a/src/slic3r/GUI/ObjectDataViewModel.cpp +++ b/src/slic3r/GUI/ObjectDataViewModel.cpp @@ -1362,7 +1362,7 @@ void ObjectDataViewModel::GetAllChildren(const wxDataViewItem &parent, wxDataVie } wxDataViewItemArray new_array = array; - for (const auto item : new_array) + for (const auto& item : new_array) { wxDataViewItemArray children; GetAllChildren(item, children); diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp index dafce5efc6..953275be7e 100644 --- a/src/slic3r/GUI/OptionsGroup.cpp +++ b/src/slic3r/GUI/OptionsGroup.cpp @@ -27,20 +27,20 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co // is the normal type. if (opt.gui_type == "select") { } else if (opt.gui_type == "select_open") { - m_fields.emplace(id, std::move(Choice::Create(this->ctrl_parent(), opt, id))); + m_fields.emplace(id, Choice::Create(this->ctrl_parent(), opt, id)); } else if (opt.gui_type == "color") { - m_fields.emplace(id, std::move(ColourPicker::Create(this->ctrl_parent(), opt, id))); + m_fields.emplace(id, ColourPicker::Create(this->ctrl_parent(), opt, id)); } else if (opt.gui_type == "f_enum_open" || opt.gui_type == "i_enum_open" || opt.gui_type == "i_enum_closed") { - m_fields.emplace(id, std::move(Choice::Create(this->ctrl_parent(), opt, id))); + m_fields.emplace(id, Choice::Create(this->ctrl_parent(), opt, id)); } else if (opt.gui_type == "slider") { - m_fields.emplace(id, std::move(SliderCtrl::Create(this->ctrl_parent(), opt, id))); + m_fields.emplace(id, SliderCtrl::Create(this->ctrl_parent(), opt, id)); } else if (opt.gui_type == "i_spin") { // Spinctrl } else if (opt.gui_type == "legend") { // StaticText - m_fields.emplace(id, std::move(StaticText::Create(this->ctrl_parent(), opt, id))); + m_fields.emplace(id, StaticText::Create(this->ctrl_parent(), opt, id)); } else if (opt.gui_type == "one_string") { - m_fields.emplace(id, std::move(TextCtrl::Create(this->ctrl_parent(), opt, id))); + m_fields.emplace(id, TextCtrl::Create(this->ctrl_parent(), opt, id)); } else { switch (opt.type) { case coFloatOrPercent: @@ -50,18 +50,18 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co case coPercents: case coString: case coStrings: - m_fields.emplace(id, std::move(TextCtrl::Create(this->ctrl_parent(), opt, id))); + m_fields.emplace(id, TextCtrl::Create(this->ctrl_parent(), opt, id)); break; case coBool: case coBools: - m_fields.emplace(id, std::move(CheckBox::Create(this->ctrl_parent(), opt, id))); + m_fields.emplace(id, CheckBox::Create(this->ctrl_parent(), opt, id)); break; case coInt: case coInts: - m_fields.emplace(id, std::move(SpinCtrl::Create(this->ctrl_parent(), opt, id))); + m_fields.emplace(id, SpinCtrl::Create(this->ctrl_parent(), opt, id)); break; case coEnum: - m_fields.emplace(id, std::move(Choice::Create(this->ctrl_parent(), opt, id))); + m_fields.emplace(id, Choice::Create(this->ctrl_parent(), opt, id)); break; case coPoints: m_fields.emplace(id, std::move(PointCtrl::Create(this->ctrl_parent(), opt, id))); diff --git a/src/slic3r/GUI/PhysicalPrinterDialog.cpp b/src/slic3r/GUI/PhysicalPrinterDialog.cpp index b80d8514ff..8b16575ba8 100644 --- a/src/slic3r/GUI/PhysicalPrinterDialog.cpp +++ b/src/slic3r/GUI/PhysicalPrinterDialog.cpp @@ -275,7 +275,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr m_optgroup->append_single_option_line("host_type"); - auto create_sizer_with_btn = [this](wxWindow* parent, ScalableButton** btn, const std::string& icon_name, const wxString& label) { + auto create_sizer_with_btn = [](wxWindow* parent, ScalableButton** btn, const std::string& icon_name, const wxString& label) { *btn = new ScalableButton(parent, wxID_ANY, icon_name, label, wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT); (*btn)->SetFont(wxGetApp().normal_font()); @@ -290,7 +290,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr m_printhost_browse_btn->Bind(wxEVT_BUTTON, [=](wxCommandEvent& e) { BonjourDialog dialog(this, Preset::printer_technology(m_printer.config)); if (dialog.show_and_lookup()) { - m_optgroup->set_value("print_host", std::move(dialog.get_selected()), true); + m_optgroup->set_value("print_host", dialog.get_selected(), true); m_optgroup->get_field("print_host")->field_changed(); } }); @@ -366,7 +366,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr static const auto filemasks = _L("Certificate files (*.crt, *.pem)|*.crt;*.pem|All files|*.*"); wxFileDialog openFileDialog(this, _L("Open CA certificate file"), "", "", filemasks, wxFD_OPEN | wxFD_FILE_MUST_EXIST); if (openFileDialog.ShowModal() != wxID_CANCEL) { - m_optgroup->set_value("printhost_cafile", std::move(openFileDialog.GetPath()), true); + m_optgroup->set_value("printhost_cafile", openFileDialog.GetPath(), true); m_optgroup->get_field("printhost_cafile")->field_changed(); } }); @@ -379,7 +379,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr Line cafile_hint{ "", "" }; cafile_hint.full_width = 1; - cafile_hint.widget = [this, ca_file_hint](wxWindow* parent) { + cafile_hint.widget = [ca_file_hint](wxWindow* parent) { auto txt = new wxStaticText(parent, wxID_ANY, ca_file_hint); auto sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(txt); @@ -420,7 +420,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr { wxTextCtrl* temp = dynamic_cast(printhost_field->getWindow()); if (temp) - temp->Bind(wxEVT_TEXT, ([this, printhost_field, temp](wxEvent& e) + temp->Bind(wxEVT_TEXT, ([printhost_field, temp](wxEvent& e) { #ifndef __WXGTK__ e.Skip(); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 3722c55455..8ca335fa86 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -274,7 +274,7 @@ public: wxButton* get_wiping_dialog_button() { return m_wiping_dialog_button; } wxSizer* get_sizer() override; ConfigOptionsGroup* get_og(const bool is_fff); - void Show(const bool is_fff); + void Show(const bool is_fff) override; void msw_rescale(); }; @@ -2065,7 +2065,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) view3D_canvas->Bind(EVT_GLCANVAS_UPDATE_BED_SHAPE, [q](SimpleEvent&) { q->set_bed_shape(); }); // Preview events: - preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_QUESTION_MARK, [this](SimpleEvent&) { wxGetApp().keyboard_shortcuts(); }); + preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_QUESTION_MARK, [](SimpleEvent&) { wxGetApp().keyboard_shortcuts(); }); preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_UPDATE_BED_SHAPE, [q](SimpleEvent&) { q->set_bed_shape(); }); if (wxGetApp().is_editor()) { preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_TAB, [this](SimpleEvent&) { select_next_view_3D(); }); @@ -2127,8 +2127,8 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) if (wxGetApp().is_editor()) { this->q->Bind(EVT_EJECT_DRIVE_NOTIFICAION_CLICKED, [this](EjectDriveNotificationClickedEvent&) { this->q->eject_drive(); }); this->q->Bind(EVT_EXPORT_GCODE_NOTIFICAION_CLICKED, [this](ExportGcodeNotificationClickedEvent&) { this->q->export_gcode(true); }); - this->q->Bind(EVT_PRESET_UPDATE_AVAILABLE_CLICKED, [this](PresetUpdateAvailableClickedEvent&) { wxGetApp().get_preset_updater()->on_update_notification_confirm(); }); - this->q->Bind(EVT_REMOVABLE_DRIVE_EJECTED, [this, q](RemovableDriveEjectEvent &evt) { + this->q->Bind(EVT_PRESET_UPDATE_AVAILABLE_CLICKED, [](PresetUpdateAvailableClickedEvent&) { wxGetApp().get_preset_updater()->on_update_notification_confirm(); }); + this->q->Bind(EVT_REMOVABLE_DRIVE_EJECTED, [this](RemovableDriveEjectEvent &evt) { if (evt.data.second) { this->show_action_buttons(this->ready_to_slice); notification_manager->close_notification_of_type(NotificationType::ExportFinished); @@ -2143,7 +2143,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) ); } }); - this->q->Bind(EVT_REMOVABLE_DRIVES_CHANGED, [this, q](RemovableDrivesChangedEvent &) { + this->q->Bind(EVT_REMOVABLE_DRIVES_CHANGED, [this](RemovableDrivesChangedEvent &) { this->show_action_buttons(this->ready_to_slice); // Close notification ExportingFinished but only if last export was to removable notification_manager->device_ejected(); @@ -4963,7 +4963,7 @@ ProjectDropDialog::ProjectDropDialog(const std::string& filename) wxBoxSizer* bottom_sizer = new wxBoxSizer(wxHORIZONTAL); wxCheckBox* check = new wxCheckBox(this, wxID_ANY, _L("Don't show again")); - check->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent& evt) { + check->Bind(wxEVT_CHECKBOX, [](wxCommandEvent& evt) { wxGetApp().app_config->set("show_drop_project_dialog", evt.IsChecked() ? "0" : "1"); }); diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp index 86c643c049..569cb9a293 100644 --- a/src/slic3r/GUI/PresetComboBoxes.cpp +++ b/src/slic3r/GUI/PresetComboBoxes.cpp @@ -738,7 +738,7 @@ void PlaterPresetComboBox::show_add_menu() wxMenu* menu = new wxMenu(); append_menu_item(menu, wxID_ANY, _L("Add/Remove presets"), "", - [this](wxCommandEvent&) { + [](wxCommandEvent&) { wxTheApp->CallAfter([]() { wxGetApp().run_wizard(ConfigWizard::RR_USER, ConfigWizard::SP_PRINTERS); }); }, "edit_uni", menu, []() { return true; }, wxGetApp().plater()); @@ -768,7 +768,7 @@ void PlaterPresetComboBox::show_edit_menu() } else append_menu_item(menu, wxID_ANY, _L("Add/Remove presets"), "", - [this](wxCommandEvent&) { + [](wxCommandEvent&) { wxTheApp->CallAfter([]() { wxGetApp().run_wizard(ConfigWizard::RR_USER, ConfigWizard::SP_PRINTERS); }); }, "edit_uni", menu, []() { return true; }, wxGetApp().plater()); @@ -893,7 +893,7 @@ void PlaterPresetComboBox::update() const PhysicalPrinterCollection& ph_printers = m_preset_bundle->physical_printers; for (PhysicalPrinterCollection::ConstIterator it = ph_printers.begin(); it != ph_printers.end(); ++it) { - for (const std::string preset_name : it->get_preset_names()) { + for (const std::string& preset_name : it->get_preset_names()) { Preset* preset = m_collection->find_preset(preset_name); if (!preset) continue; @@ -1078,7 +1078,7 @@ void TabPresetComboBox::update() const PhysicalPrinterCollection& ph_printers = m_preset_bundle->physical_printers; for (PhysicalPrinterCollection::ConstIterator it = ph_printers.begin(); it != ph_printers.end(); ++it) { - for (const std::string preset_name : it->get_preset_names()) { + for (const std::string& preset_name : it->get_preset_names()) { Preset* preset = m_collection->find_preset(preset_name); if (!preset) continue; diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 00e386c1d0..6f371d1752 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -121,7 +121,7 @@ Tab::Tab(wxNotebook* parent, const wxString& title, Preset::Type type) : m_config_manipulation = get_config_manipulation(); - Bind(wxEVT_SIZE, ([this](wxSizeEvent &evt) { + Bind(wxEVT_SIZE, ([](wxSizeEvent &evt) { //for (auto page : m_pages) // if (! page.get()->IsShown()) // page->layout_valid = false; @@ -242,7 +242,7 @@ void Tab::create_preset_tab() if (dlg.ShowModal() == wxID_OK) wxGetApp().update_label_colours(); }); - m_search_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent) { wxGetApp().plater()->search(false); }); + m_search_btn->Bind(wxEVT_BUTTON, [](wxCommandEvent) { wxGetApp().plater()->search(false); }); // Colors for ui "decoration" m_sys_label_clr = wxGetApp().get_label_clr_sys(); @@ -491,7 +491,7 @@ void Tab::update_label_colours() m_modified_label_clr = wxGetApp().get_label_clr_modified(); //update options "decoration" - for (const auto opt : m_options_list) + for (const auto& opt : m_options_list) { const wxColour *color = &m_sys_label_clr; @@ -541,7 +541,7 @@ void Tab::update_label_colours() void Tab::decorate() { - for (const auto opt : m_options_list) + for (const auto& opt : m_options_list) { Field* field = nullptr; wxColour* colored_label_clr = nullptr; @@ -639,7 +639,7 @@ void Tab::init_options_list() if (!m_options_list.empty()) m_options_list.clear(); - for (const auto opt_key : m_config->keys()) + for (const std::string& opt_key : m_config->keys()) m_options_list.emplace(opt_key, m_opt_status_value); } @@ -656,7 +656,7 @@ void TabPrinter::init_options_list() if (!m_options_list.empty()) m_options_list.clear(); - for (const auto opt_key : m_config->keys()) + for (const std::string& opt_key : m_config->keys()) { if (opt_key == "bed_shape" || opt_key == "thumbnails") { m_options_list.emplace(opt_key, m_opt_status_value); @@ -709,7 +709,7 @@ void TabSLAMaterial::init_options_list() if (!m_options_list.empty()) m_options_list.clear(); - for (const auto opt_key : m_config->keys()) + for (const std::string& opt_key : m_config->keys()) { if (opt_key == "compatible_prints" || opt_key == "compatible_printers") { m_options_list.emplace(opt_key, m_opt_status_value); @@ -1728,7 +1728,7 @@ void TabFilament::add_filament_overrides_page() line.near_label_widget = [this, optgroup, opt_key, opt_index](wxWindow* parent) { wxCheckBox* check_box = new wxCheckBox(parent, wxID_ANY, ""); - check_box->Bind(wxEVT_CHECKBOX, [this, optgroup, opt_key, opt_index](wxCommandEvent& evt) { + check_box->Bind(wxEVT_CHECKBOX, [optgroup, opt_key, opt_index](wxCommandEvent& evt) { const bool is_checked = evt.IsChecked(); Field* field = optgroup->get_fieldc(opt_key, opt_index); if (field != nullptr) { @@ -3352,7 +3352,9 @@ bool Tab::tree_sel_change_delayed() wxCheckForInterrupt(m_treectrl); if (m_page_switch_planned) throw UIBuildCanceled(); -#endif // WIN32 +#else // WIN32 + (void)this; // silence warning +#endif }); try { @@ -3924,7 +3926,7 @@ ConfigOptionsGroupShp Page::new_optgroup(const wxString& title, int noncommon_la #else auto tab = parent()->GetParent();// GetParent(); #endif - optgroup->m_on_change = [this, tab](t_config_option_key opt_key, boost::any value) { + optgroup->m_on_change = [tab](t_config_option_key opt_key, boost::any value) { //! This function will be called from OptionGroup. //! Using of CallAfter is redundant. //! And in some cases it causes update() function to be recalled again @@ -3934,21 +3936,21 @@ ConfigOptionsGroupShp Page::new_optgroup(const wxString& title, int noncommon_la //! }); }; - optgroup->m_get_initial_config = [this, tab]() { + optgroup->m_get_initial_config = [tab]() { DynamicPrintConfig config = static_cast(tab)->m_presets->get_selected_preset().config; return config; }; - optgroup->m_get_sys_config = [this, tab]() { + optgroup->m_get_sys_config = [tab]() { DynamicPrintConfig config = static_cast(tab)->m_presets->get_selected_preset_parent()->config; return config; }; - optgroup->have_sys_config = [this, tab]() { + optgroup->have_sys_config = [tab]() { return static_cast(tab)->m_presets->get_selected_preset_parent() != nullptr; }; - optgroup->rescale_extra_column_item = [this](wxWindow* win) { + optgroup->rescale_extra_column_item = [](wxWindow* win) { auto *ctrl = dynamic_cast(win); if (ctrl == nullptr) return; diff --git a/src/slic3r/GUI/Tab.hpp b/src/slic3r/GUI/Tab.hpp index 0358fd3150..d341b7360c 100644 --- a/src/slic3r/GUI/Tab.hpp +++ b/src/slic3r/GUI/Tab.hpp @@ -383,7 +383,6 @@ public: private: ogStaticText* m_recommended_thin_wall_thickness_description_line = nullptr; ogStaticText* m_top_bottom_shell_thickness_explanation = nullptr; - bool m_support_material_overhangs_queried = false; }; class TabFilament : public Tab diff --git a/src/slic3r/Utils/Bonjour.cpp b/src/slic3r/Utils/Bonjour.cpp index 28b3b2228a..f121e6e87a 100644 --- a/src/slic3r/Utils/Bonjour.cpp +++ b/src/slic3r/Utils/Bonjour.cpp @@ -226,7 +226,7 @@ struct DnsResource } dataoffset = offset; - res.data = std::move(std::vector(buffer.begin() + offset, buffer.begin() + offset + rdlength)); + res.data = std::vector(buffer.begin() + offset, buffer.begin() + offset + rdlength); offset += rdlength; return std::move(res); diff --git a/src/slic3r/Utils/Http.cpp b/src/slic3r/Utils/Http.cpp index 94a8c9a56d..2afb7ed504 100644 --- a/src/slic3r/Utils/Http.cpp +++ b/src/slic3r/Utils/Http.cpp @@ -553,7 +553,7 @@ void Http::cancel() Http Http::get(std::string url) { - return std::move(Http{std::move(url)}); + return Http{std::move(url)}; } Http Http::post(std::string url) diff --git a/src/slic3r/Utils/PresetUpdater.cpp b/src/slic3r/Utils/PresetUpdater.cpp index 60dfe05c78..f0310073fd 100644 --- a/src/slic3r/Utils/PresetUpdater.cpp +++ b/src/slic3r/Utils/PresetUpdater.cpp @@ -206,7 +206,7 @@ bool PresetUpdater::priv::get_file(const std::string &url, const fs::path &targe tmp_path.string()); Http::get(url) - .on_progress([this](Http::Progress, bool &cancel) { + .on_progress([](Http::Progress, bool &cancel) { if (cancel) { cancel = true; } }) .on_error([&](std::string body, std::string error, unsigned http_status) { @@ -406,7 +406,7 @@ Updates PresetUpdater::priv::get_config_updates(const Semver &old_slic3r_version BOOST_LOG_TRIVIAL(info) << "Checking for cached configuration updates..."; // Over all indices from the cache directory: - for (const auto idx : index_db) { + for (const Index& idx : index_db) { auto bundle_path = vendor_path / (idx.vendor() + ".ini"); auto bundle_path_idx = vendor_path / idx.path().filename(); @@ -679,11 +679,11 @@ void PresetUpdater::sync(PresetBundle *preset_bundle) // into the closure (but perhaps the compiler can elide this). VendorMap vendors = preset_bundle->vendors; - p->thread = std::move(std::thread([this, vendors]() { + p->thread = std::thread([this, vendors]() { this->p->prune_tmps(); this->p->sync_version(); this->p->sync_config(std::move(vendors)); - })); + }); } void PresetUpdater::slic3r_update_notify()