From 1749c293a6ed71172959d6e16d9e98759aab8fcb Mon Sep 17 00:00:00 2001 From: Kris Austin Date: Wed, 2 Sep 2026 05:38:05 -0500 Subject: [PATCH] build: clear 237 warnings - unused lambda captures (#15417) * build: enable /Zc:lambda for MSVC MSVC keeps its legacy lambda processor under /std:c++17, which rejects reading a constexpr constant inside a lambda that does not capture it (C3493). No other compiler requires that capture, and clang reports it as an unused one, so the two cannot both be satisfied without the flag. /Zc:lambda selects the conforming lambda parser that clang and GCC already use. It is implied by /std:c++20 and /permissive-, so it is only needed while we are on C++17. clang-cl is conforming already and does not take the flag. It requires VS2019 16.8, so build_release_vs.bat now says 16.8+. * build: clear 237 unused lambda capture warnings 236 captures across 81 files, 142 of them `this`. Removing an unused capture changes no behavior; clang does not report a capture whose type has a non-trivial destructor, so nothing held only to extend an object's lifetime is in this set. Nine of them are the second half of the warning, "is not required to be captured for this use", where the capture is a const or constexpr value the body does read. Those depend on the /Zc:lambda change in the previous commit. One of them, in FillRectilinear.cpp, had been worked around with an #ifndef __APPLE__ guard around the capture list, which is now gone. GUI_ObjectTableSettings.cpp captured its reset button only to read it inside #ifdef __WXOSX_MAC__. That branch now takes the button from the event it is already handling. * build: fail configure on MSVC older than 19.28 instead of dropping /Zc:lambda cl.exe answers an unrecognized /Zc: sub-option with warning D9002 and keeps going, so on VS2019 before 16.8 the flag is silently ignored and the build instead dies with C3493 in FillRectilinear.cpp, nowhere near the cause. * fix: delete three locals that are now unused Their only remaining use was the lambda capture this branch removed. The Clang builds set -Wno-unused-variable, so the build never flagged them. --------- Co-authored-by: Rodrigo Faselli <162915171+RF47@users.noreply.github.com> --- CMakeLists.txt | 16 ++++++ build_release_vs.bat | 2 +- src/OrcaSlicer.cpp | 2 +- src/libslic3r/Arrange.cpp | 2 +- src/libslic3r/Fill/FillRectilinear.cpp | 7 +-- src/libslic3r/GCode/GCodeProcessor.cpp | 8 +-- src/libslic3r/GCode/WipeTower.cpp | 4 +- src/libslic3r/Model.cpp | 2 +- src/libslic3r/PresetBundle.cpp | 4 +- src/libslic3r/Print.cpp | 4 +- src/libslic3r/PrintObject.cpp | 2 +- src/libslic3r/PrintObjectSlice.cpp | 4 +- src/libslic3r/Support/SupportCommon.cpp | 2 +- src/libslic3r/Support/SupportMaterial.cpp | 2 +- src/libslic3r/Support/TreeSupport.cpp | 2 +- src/slic3r/GUI/AMSDryControl.cpp | 6 +- src/slic3r/GUI/BindDialog.cpp | 6 +- src/slic3r/GUI/CaliHistoryDialog.cpp | 2 +- src/slic3r/GUI/Calibration.cpp | 2 +- src/slic3r/GUI/CalibrationWizard.cpp | 2 +- src/slic3r/GUI/CalibrationWizardCaliPage.cpp | 2 +- src/slic3r/GUI/CalibrationWizardPage.cpp | 2 +- src/slic3r/GUI/CalibrationWizardSavePage.cpp | 6 +- src/slic3r/GUI/CameraPopup.cpp | 2 +- src/slic3r/GUI/ConfigWizard.cpp | 2 +- src/slic3r/GUI/CreatePresetsDialog.cpp | 2 +- src/slic3r/GUI/Field.cpp | 2 +- src/slic3r/GUI/FilamentPickerDialog.cpp | 4 +- src/slic3r/GUI/GCodeViewer.cpp | 24 ++++---- src/slic3r/GUI/GLCanvas3D.cpp | 20 +++---- src/slic3r/GUI/GUI_App.cpp | 10 ++-- src/slic3r/GUI/GUI_AuxiliaryList.cpp | 2 +- src/slic3r/GUI/GUI_Factories.cpp | 14 ++--- src/slic3r/GUI/GUI_ObjectLayers.cpp | 2 +- src/slic3r/GUI/GUI_ObjectList.cpp | 8 +-- src/slic3r/GUI/GUI_ObjectTable.cpp | 4 +- src/slic3r/GUI/GUI_ObjectTableSettings.cpp | 17 +++--- src/slic3r/GUI/Gizmos/GLGizmoCut.cpp | 2 +- src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.cpp | 2 +- src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp | 2 +- src/slic3r/GUI/Gizmos/GLGizmosManager.cpp | 2 +- .../GUI/Gizmos/GizmoObjectManipulation.cpp | 2 +- src/slic3r/GUI/HMS.cpp | 4 +- src/slic3r/GUI/Jobs/FillBedJob.cpp | 2 +- src/slic3r/GUI/Jobs/PrintJob.cpp | 5 +- src/slic3r/GUI/Jobs/RotoptimizeJob.cpp | 2 +- src/slic3r/GUI/Jobs/SendJob.cpp | 3 +- src/slic3r/GUI/MainFrame.cpp | 28 ++++----- src/slic3r/GUI/MultiMachine.cpp | 2 +- src/slic3r/GUI/MultiMachineManagerPage.cpp | 2 +- src/slic3r/GUI/MultiMachinePage.cpp | 2 +- src/slic3r/GUI/MultiTaskManagerPage.cpp | 2 +- src/slic3r/GUI/NetworkPluginDialog.cpp | 4 +- src/slic3r/GUI/NetworkTestDialog.cpp | 2 +- src/slic3r/GUI/Notebook.cpp | 2 +- src/slic3r/GUI/OG_CustomCtrl.cpp | 2 +- src/slic3r/GUI/ObjColorDialog.cpp | 2 +- src/slic3r/GUI/ParamsPanel.cpp | 6 +- src/slic3r/GUI/Plater.cpp | 57 +++++++++---------- src/slic3r/GUI/Preferences.cpp | 6 +- src/slic3r/GUI/PresetComboBoxes.cpp | 4 +- src/slic3r/GUI/PrintHostDialogs.cpp | 2 +- src/slic3r/GUI/Printer/PrinterFileSystem.cpp | 4 +- src/slic3r/GUI/PrivacyUpdateDialog.cpp | 2 +- src/slic3r/GUI/ReleaseNote.cpp | 2 +- src/slic3r/GUI/SavePresetDialog.cpp | 2 +- src/slic3r/GUI/SelectMachine.cpp | 8 +-- src/slic3r/GUI/SelectMachinePop.cpp | 12 ++-- src/slic3r/GUI/SendMultiMachinePage.cpp | 2 +- src/slic3r/GUI/SkipPartCanvas.cpp | 4 +- src/slic3r/GUI/SliceInfoPanel.cpp | 2 +- src/slic3r/GUI/StepMeshDialog.cpp | 4 +- src/slic3r/GUI/SyncAmsInfoDialog.cpp | 4 +- src/slic3r/GUI/Tab.cpp | 14 ++--- src/slic3r/GUI/TroubleshootDialog.cpp | 4 +- src/slic3r/GUI/WebGuideDialog.cpp | 4 +- src/slic3r/GUI/WebUserLoginDialog.cpp | 4 +- src/slic3r/Utils/3DPrinterOS.cpp | 2 +- src/slic3r/Utils/Moonraker.cpp | 4 +- src/slic3r/Utils/Obico.cpp | 2 +- src/slic3r/Utils/PresetUpdater.cpp | 2 +- src/slic3r/Utils/Repetier.cpp | 2 +- src/slic3r/Utils/SimplyPrint.cpp | 6 +- 83 files changed, 226 insertions(+), 217 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f5ccbeb44..972627d0c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -362,6 +362,22 @@ if (MSVC) if (SLIC3R_MSVC_COMPILE_PARALLEL AND CMAKE_GENERATOR MATCHES "Visual Studio") add_compile_options(/MP) endif () + + # Parse lambdas the way the standard says, as clang and GCC already do. Without it + # MSVC keeps its legacy lambda processor under /std:c++17 and rejects reading a + # constexpr constant inside a lambda that does not capture it (C3493), which no + # other compiler requires. Implied by /std:c++20 and /permissive-, so it is only + # needed while we are on C++17. clang-cl is conforming already and does not take + # the flag. Requires VS2019 16.8 or newer. + if (NOT IS_CLANG_CL) + # cl.exe only warns (D9002) about an unknown /Zc: option, so without this the + # flag would be dropped and the first lambda reading a constexpr constant would + # fail with C3493 far from the cause. + if (MSVC_VERSION LESS 1928) + message(FATAL_ERROR "Visual Studio 2019 16.8 (MSVC 19.28) or newer is required; detected MSVC ${MSVC_VERSION}.") + endif () + add_compile_options(/Zc:lambda) + endif () # /bigobj (Increase Number of Sections in .Obj file) # error C3859: virtual memory range for PCH exceeded; please recompile with a command line option of '-Zm90' or greater # Generate symbols at every build target, even for the release. diff --git a/build_release_vs.bat b/build_release_vs.bat index a52d940455..3842f1d198 100644 --- a/build_release_vs.bat +++ b/build_release_vs.bat @@ -86,7 +86,7 @@ if "%VS_MAJOR%"=="16" ( set CMAKE_GENERATOR="Visual Studio 18 2026" ) else ( echo Error: Unsupported Visual Studio version: %VS_MAJOR% - echo Supported versions: VS2019 (16.x^), VS2022 (17.x^), VS2026 (18.x^) + echo Supported versions: VS2019 (16.8+^), VS2022 (17.x^), VS2026 (18.x^) exit /b 1 ) diff --git a/src/OrcaSlicer.cpp b/src/OrcaSlicer.cpp index 8176e9f444..33669abcf2 100644 --- a/src/OrcaSlicer.cpp +++ b/src/OrcaSlicer.cpp @@ -1969,7 +1969,7 @@ int CLI::run(int argc, char **argv) } } - auto load_config_file = [config_substitution_rule](const std::string& file, DynamicPrintConfig& config, std::string& config_type, + auto load_config_file = [](const std::string& file, DynamicPrintConfig& config, std::string& config_type, std::string& config_name, std::string& filament_id, std::string& config_from) { if (! boost::filesystem::exists(file)) { boost::nowide::cerr << __FUNCTION__<< ": can not find setting file: " << file << std::endl; diff --git a/src/libslic3r/Arrange.cpp b/src/libslic3r/Arrange.cpp index 48e6950a82..fd496537f4 100644 --- a/src/libslic3r/Arrange.cpp +++ b/src/libslic3r/Arrange.cpp @@ -797,7 +797,7 @@ public: } }); - m_pck.unfitIndicator([this](std::string name) { + m_pck.unfitIndicator([](std::string name) { BOOST_LOG_TRIVIAL(debug) << "arrange progress: " + name; }); diff --git a/src/libslic3r/Fill/FillRectilinear.cpp b/src/libslic3r/Fill/FillRectilinear.cpp index 0c82354b38..db340748ab 100644 --- a/src/libslic3r/Fill/FillRectilinear.cpp +++ b/src/libslic3r/Fill/FillRectilinear.cpp @@ -2395,12 +2395,7 @@ static std::vector chain_monotonic_regions( } // Probability (unnormalized) of traversing a link between two monotonic regions. - auto path_probability = [ -#ifndef __APPLE__ - // clang complains when capturing constexpr constants. - pheromone_alpha, pheromone_beta -#endif // __APPLE__ - ](AntPath &path) { + auto path_probability = [](AntPath &path) { return pow(path.pheromone, pheromone_alpha) * pow(path.visibility, pheromone_beta); }; diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 2ac8bd45a6..cd6c494f33 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -1273,7 +1273,7 @@ void GCodeProcessor::run_post_process() // add lines M73 to exported gcode auto process_line_move = [ // Lambdas, mostly for string formatting, all with an empty capture block. - time_in_minutes, format_time_float, format_line_M73_main, format_line_M73_stop_int, format_line_M73_stop_float, time_in_last_minute,format_line_exhaust_fan_control, + time_in_minutes, format_time_float, format_line_M73_main, format_line_M73_stop_int, format_line_M73_stop_float, time_in_last_minute, &self = std::as_const(m_time_processor), // Caches, to be modified &g1_times_cache_it, &last_exported_main, &last_exported_stop, @@ -5304,7 +5304,7 @@ void GCodeProcessor::process_VG1(const GCodeReader::GCodeLine& line) float filament_radius = 0.5f * filament_diameter; float area_filament_cross_section = static_cast(M_PI) * sqr(filament_radius); - auto absolute_position = [this, area_filament_cross_section](Axis axis, const GCodeReader::GCodeLine& lineG1) { + auto absolute_position = [this](Axis axis, const GCodeReader::GCodeLine& lineG1) { bool is_relative = (m_global_positioning_type == EPositioningType::Relative); if (axis == E) is_relative |= (m_e_local_positioning_type == EPositioningType::Relative); @@ -5755,7 +5755,7 @@ void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line, bool cloc if (travel_length < 0.001) return; - auto adjust_target = [this, area_filament_cross_section](const AxisCoords& target, const AxisCoords& prev_position) { + auto adjust_target = [this](const AxisCoords& target, const AxisCoords& prev_position) { AxisCoords ret = target; if (m_global_positioning_type == EPositioningType::Relative) { for (unsigned char a = X; a <= E; ++a) { @@ -7006,7 +7006,7 @@ void GCodeProcessor::store_move_vertex(EMoveType type, EMovePathType path_type, get_acceleration(normal_mode)); const float junction_deviation = get_option_value(m_time_processor.machine_limits.machine_max_junction_deviation, normal_mode_id); const bool use_jd_jerk = (m_flavor == gcfMarlinFirmware && junction_deviation > 0.0f); - const auto axis_jerk_for_preview = [this, normal_mode, use_jd_jerk, move_acceleration](Axis axis) { + const auto axis_jerk_for_preview = [this, use_jd_jerk, move_acceleration](Axis axis) { return use_jd_jerk ? get_axis_max_jerk_with_jd(normal_mode, axis, move_acceleration) : get_axis_max_jerk(normal_mode, axis); }; const float jerk_x = axis_jerk_for_preview(X); diff --git a/src/libslic3r/GCode/WipeTower.cpp b/src/libslic3r/GCode/WipeTower.cpp index 5834937169..8aff5f4a3f 100644 --- a/src/libslic3r/GCode/WipeTower.cpp +++ b/src/libslic3r/GCode/WipeTower.cpp @@ -4083,7 +4083,7 @@ void WipeTower::toolchange_wipe_new(WipeTowerWriter &writer, const box_coordinat } return time * 60.f; }; - auto estimate_wipe_time = [&estimate_time_kernel, & cleaning_box, &target_speed, &x_to_wipe, &xr, &xl, &dy, &WipeSpeedMap, &solid_tool_toolchange](int begin_line) -> float { + auto estimate_wipe_time = [&estimate_time_kernel, & cleaning_box, &x_to_wipe, &xr, &xl, &dy, &solid_tool_toolchange](int begin_line) -> float { int n = std::ceil(x_to_wipe / (xr - xl)); if (solid_tool_toolchange) n = (cleaning_box.lu[1] - cleaning_box.ld[1]) / dy; float total_time = estimate_time_kernel(n); @@ -5111,7 +5111,7 @@ Polygon WipeTower::generate_rib_polygon(const box_coordinates &wt_box) Polygon WipeTower::generate_support_wall_new(WipeTowerWriter &writer, const box_coordinates &wt_box, double feedrate, bool first_layer,bool rib_wall, bool extrude_perimeter, bool skip_points) { - auto get_closet_idx = [this, &writer](Polylines &pls) -> std::pair { + auto get_closet_idx = [&writer](Polylines &pls) -> std::pair { Vec2f anchor{writer.x(), writer.y()}; int closestIndex = -1; int closestPl = -1; diff --git a/src/libslic3r/Model.cpp b/src/libslic3r/Model.cpp index bbc3aa80f3..8f1dd8926c 100644 --- a/src/libslic3r/Model.cpp +++ b/src/libslic3r/Model.cpp @@ -877,7 +877,7 @@ void Model::convert_multipart_object(unsigned int max_extruders) // Revert the centering operation. trafo_volume.set_offset(trafo_volume.get_offset() - o->origin_translation); int counter = 1; - auto copy_volume = [o, v, max_extruders, &counter, &extruder_counter](ModelVolume *new_v) { + auto copy_volume = [o, v, &counter](ModelVolume *new_v) { assert(new_v != nullptr); new_v->name = (counter > 1) ? o->name + "_" + std::to_string(counter++) : o->name; //BBS: Use extruder priority: volumn > object > default diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index 53524887a9..8e5d565c55 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -2157,7 +2157,7 @@ int PresetBundle::validate_presets(const std::string &file_name, DynamicPrintCon void PresetBundle::remove_users_preset(AppConfig &config, std::map> *my_presets) { - auto check_removed = [my_presets, this](Preset &preset) -> bool { + auto check_removed = [my_presets](Preset &preset) -> bool { if (my_presets == nullptr) return true; if (my_presets->find(preset.name) != my_presets->end()) return false; if (!preset.sync_info.empty()) return false; // syncing, not remove @@ -3412,7 +3412,7 @@ void PresetBundle::get_ams_cobox_infos(AMSComboInfo& combox_info) combox_info.ams_names.push_back(ams_name); continue; } - iter = std::find_if(filaments.begin(), filaments.end(), [&filament_type](auto &f) { return f.is_compatible && f.is_system; }); + iter = std::find_if(filaments.begin(), filaments.end(), [](auto &f) { return f.is_compatible && f.is_system; }); if (iter == filaments.end()) continue; } diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 40764342fb..e96304e874 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -2288,7 +2288,7 @@ void Print::process(long long *time_cost_with_cache, bool use_cache) obj->clear_shared_object(); //add the print_object share check logic - auto is_print_object_the_same = [this](const PrintObject* object1, const PrintObject* object2) -> bool{ + auto is_print_object_the_same = [](const PrintObject* object1, const PrintObject* object2) -> bool{ if (object1->trafo().matrix() != object2->trafo().matrix()) return false; const ModelObject* model_obj1 = object1->model_object(); @@ -5699,7 +5699,7 @@ int Print::load_cached_data(const std::string& directory) return CLI_IMPORT_CACHE_NOT_FOUND; } - auto find_region = [this](PrintObject* object, size_t config_hash) -> const PrintRegion* { + auto find_region = [](PrintObject* object, size_t config_hash) -> const PrintRegion* { int regions_count = object->num_printing_regions(); for (int index = 0; index < regions_count; index++ ) { diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 7bc18f6b86..a228bb7436 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -2666,7 +2666,7 @@ void PrintObject::bridge_over_infill() // SECTION to gather and filter surfaces for expanding, and then cluster them by layer { tbb::concurrent_vector candidate_surfaces; - tbb::parallel_for(tbb::blocked_range(0, this->layers().size()), [po = static_cast(this), &candidate_surfaces, has_lightning_infill](tbb::blocked_range r) { + tbb::parallel_for(tbb::blocked_range(0, this->layers().size()), [po = static_cast(this), &candidate_surfaces](tbb::blocked_range r) { PRINT_OBJECT_TIME_LIMIT_MILLIS(PRINT_OBJECT_TIME_LIMIT_DEFAULT); for (size_t lidx = r.begin(); lidx < r.end(); lidx++) { const Layer *layer = po->get_layer(lidx); diff --git a/src/libslic3r/PrintObjectSlice.cpp b/src/libslic3r/PrintObjectSlice.cpp index 07eb885eda..f6a6b43e09 100644 --- a/src/libslic3r/PrintObjectSlice.cpp +++ b/src/libslic3r/PrintObjectSlice.cpp @@ -527,7 +527,7 @@ bool groupingVolumes(std::vector objSliceByVolume, std::vector(0, osvIndex.size()), - [&osvIndex, &objSliceByVolume, &offsetValue, &resolution](const tbb::blocked_range& range) { + [&osvIndex, &objSliceByVolume, &resolution](const tbb::blocked_range& range) { for (auto k = range.begin(); k != range.end(); ++k) { for (ExPolygon& poly_ex : objSliceByVolume[osvIndex[k][0]].slices[osvIndex[k][1]]) poly_ex.douglas_peucker(resolution); @@ -535,7 +535,7 @@ bool groupingVolumes(std::vector objSliceByVolume, std::vector(0, osvIndex.size()), - [&osvIndex, &objSliceByVolume,&offsetValue, &resolution](const tbb::blocked_range& range) { + [&osvIndex, &objSliceByVolume,&offsetValue](const tbb::blocked_range& range) { for (auto k = range.begin(); k != range.end(); ++k) { objSliceByVolume[osvIndex[k][0]].slices[osvIndex[k][1]] = offset_ex(objSliceByVolume[osvIndex[k][0]].slices[osvIndex[k][1]], offsetValue); } diff --git a/src/libslic3r/Support/SupportCommon.cpp b/src/libslic3r/Support/SupportCommon.cpp index 15640cb0f2..0c7a4b832e 100644 --- a/src/libslic3r/Support/SupportCommon.cpp +++ b/src/libslic3r/Support/SupportCommon.cpp @@ -132,7 +132,7 @@ std::pair generate_interfa return nullptr; }; tbb::parallel_for(tbb::blocked_range(0, int(intermediate_layers.size())), - [&bottom_contacts, &top_contacts, &top_interface_layers, &top_base_interface_layers, &intermediate_layers, &insert_layer, &support_params, + [&bottom_contacts, &top_contacts, &top_interface_layers, &top_base_interface_layers, &intermediate_layers, &insert_layer, num_top_interface_layers, num_bottom_interface_layers, num_top_base_interface_layers, num_bottom_base_interface_layers, num_top_interface_layers_only, num_bottom_interface_layers_only, snug_supports, &interface_layers, &base_interface_layers](const tbb::blocked_range& range) { diff --git a/src/libslic3r/Support/SupportMaterial.cpp b/src/libslic3r/Support/SupportMaterial.cpp index cd60489e75..12ac275592 100644 --- a/src/libslic3r/Support/SupportMaterial.cpp +++ b/src/libslic3r/Support/SupportMaterial.cpp @@ -1588,7 +1588,7 @@ static inline std::tuple detect_contacts( // Cache support trimming polygons derived from lower layer polygons, possible merged with "on build plate only" trimming polygons. auto slices_margin_update = - [&slices_margin, &layer, &lower_layer, &lower_layer_polygons, buildplate_only, has_enforcer, &annotations, layer_id] + [&slices_margin, &lower_layer, &lower_layer_polygons, buildplate_only, has_enforcer, &annotations, layer_id] (float slices_margin_offset, float no_interface_offset) { if (slices_margin.offset != slices_margin_offset) { slices_margin.offset = slices_margin_offset; diff --git a/src/libslic3r/Support/TreeSupport.cpp b/src/libslic3r/Support/TreeSupport.cpp index de08870216..2b06f11244 100644 --- a/src/libslic3r/Support/TreeSupport.cpp +++ b/src/libslic3r/Support/TreeSupport.cpp @@ -2667,7 +2667,7 @@ void TreeSupport::drop_nodes() SupportNode::diameter_angle_scale_factor = diameter_angle_scale_factor; float DO_NOT_MOVER_UNDER_MM = is_slim ? 0 : 5; // do not move contact points under 5mm - auto get_max_move_dist = [this, &config, tan_angle, wall_count, support_extrusion_width](const SupportNode *node, int power = 1) { + auto get_max_move_dist = [this, tan_angle, support_extrusion_width](const SupportNode *node, int power = 1) { if (node->max_move_dist == 0) { node->radius = get_radius(node); node->max_move_dist = std::min(tan_angle * node->height, support_extrusion_width); diff --git a/src/slic3r/GUI/AMSDryControl.cpp b/src/slic3r/GUI/AMSDryControl.cpp index ddd3380975..f83eed30db 100644 --- a/src/slic3r/GUI/AMSDryControl.cpp +++ b/src/slic3r/GUI/AMSDryControl.cpp @@ -437,7 +437,7 @@ wxBoxSizer* AMSDryCtrWin::create_normal_state_panel(wxPanel* parent) m_temperature_input = new wxTextCtrl(parent, wxID_ANY, "", wxDefaultPosition, wxSize(FromDIP(80), -1)); m_temperature_input->SetMaxLength(3); // Limit to 3 digits - m_temperature_input->Bind(wxEVT_CHAR, [this](wxKeyEvent& event) { + m_temperature_input->Bind(wxEVT_CHAR, [](wxKeyEvent& event) { int keycode = event.GetKeyCode(); if (keycode >= '0' && keycode <= '9') { event.Skip(); @@ -464,7 +464,7 @@ wxBoxSizer* AMSDryCtrWin::create_normal_state_panel(wxPanel* parent) m_time_input = new wxTextCtrl(parent, wxID_ANY, "", wxDefaultPosition, wxSize(FromDIP(100), -1)); m_time_input->SetMaxLength(3); // Limit to 3 digits - m_time_input->Bind(wxEVT_CHAR, [this](wxKeyEvent& event) { + m_time_input->Bind(wxEVT_CHAR, [](wxKeyEvent& event) { int keycode = event.GetKeyCode(); if (keycode >= '0' && keycode <= '9') { event.Skip(); @@ -698,7 +698,7 @@ wxBoxSizer* AMSDryCtrWin::create_guide_info_section(wxPanel* parent) m_rotate_spool_toggle = new wxCheckBox(parent, wxID_ANY, ""); m_rotate_spool_toggle->SetValue(false); - m_rotate_spool_toggle->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent& event) { + m_rotate_spool_toggle->Bind(wxEVT_CHECKBOX, [](wxCommandEvent& event) { bool is_checked = event.IsChecked(); // Add toggle behavior logic here }); diff --git a/src/slic3r/GUI/BindDialog.cpp b/src/slic3r/GUI/BindDialog.cpp index a4b568e82d..4c6d3c249d 100644 --- a/src/slic3r/GUI/BindDialog.cpp +++ b/src/slic3r/GUI/BindDialog.cpp @@ -468,7 +468,7 @@ PingCodeBindDialog::~PingCodeBindDialog() { m_link_privacy_title->SetFont(Label::Head_13); m_link_privacy_title->SetMaxSize(wxSize(FromDIP(450), -1)); m_link_privacy_title->Wrap(FromDIP(450)); - m_link_privacy_title->Bind(wxEVT_LEFT_DOWN, [this](auto& e) { + m_link_privacy_title->Bind(wxEVT_LEFT_DOWN, [](auto& e) { std::string url; std::string country_code = Slic3r::GUI::wxGetApp().app_config->get_country_code(); @@ -893,7 +893,7 @@ void BindMachineDialog::on_show(wxShowEvent &event) } } }) - .on_error([this](std::string body, std::string error, unsigned status) { + .on_error([](std::string body, std::string error, unsigned status) { //BOOST_LOG_TRIVIAL(info) << "load oss picture failed, oss path: " << oss_path << " status:" << status << " error:" << error; }).perform(); } @@ -1099,7 +1099,7 @@ void UnBindMachineDialog::on_show(wxShowEvent &event) } } }) - .on_error([this](std::string body, std::string error, unsigned status) { + .on_error([](std::string body, std::string error, unsigned status) { //BOOST_LOG_TRIVIAL(info) << "load oss picture failed, oss path: " << oss_path << " status:" << status << " error:" << error; }).perform(); diff --git a/src/slic3r/GUI/CaliHistoryDialog.cpp b/src/slic3r/GUI/CaliHistoryDialog.cpp index 4de90d8b8f..6c1e612864 100644 --- a/src/slic3r/GUI/CaliHistoryDialog.cpp +++ b/src/slic3r/GUI/CaliHistoryDialog.cpp @@ -443,7 +443,7 @@ void HistoryWindow::sync_history_data() { auto edit_button = new Button(m_history_data_panel, _L("Edit")); edit_button->SetStyle(ButtonStyle::Confirm, ButtonType::Window); - edit_button->Bind(wxEVT_BUTTON, [this, result, k_value, name_value, edit_button](auto& e) { + edit_button->Bind(wxEVT_BUTTON, [this, result, k_value, name_value](auto& e) { if (m_ui_op_lock) return; PACalibResult result_buffer = result; diff --git a/src/slic3r/GUI/Calibration.cpp b/src/slic3r/GUI/Calibration.cpp index 0c2b4f1659..f3351fdb6b 100644 --- a/src/slic3r/GUI/Calibration.cpp +++ b/src/slic3r/GUI/Calibration.cpp @@ -201,7 +201,7 @@ wxWindow* CalibrationDialog::create_check_option(wxString title, wxWindow* paren checkbox->SetToolTip(tooltip); text->SetToolTip(tooltip); - text->Bind(wxEVT_LEFT_DOWN, [this, check](wxMouseEvent&) { check->SetValue(check->GetValue() ? false : true); }); + text->Bind(wxEVT_LEFT_DOWN, [check](wxMouseEvent&) { check->SetValue(check->GetValue() ? false : true); }); m_checkbox_list[param] = check; m_checkbox_list[param]->SetValue(true); return checkbox; diff --git a/src/slic3r/GUI/CalibrationWizard.cpp b/src/slic3r/GUI/CalibrationWizard.cpp index b1f5c206c6..7496d59a51 100644 --- a/src/slic3r/GUI/CalibrationWizard.cpp +++ b/src/slic3r/GUI/CalibrationWizard.cpp @@ -477,7 +477,7 @@ void CalibrationWizard::on_cali_go_home() if (go_home_dialog == nullptr) go_home_dialog = new SecondaryCheckDialog(this, wxID_ANY, _L("Confirm")); - go_home_dialog->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this, method](wxCommandEvent &e) { + go_home_dialog->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this](wxCommandEvent &e) { if (curr_obj) { curr_obj->command_task_abort(); } else { diff --git a/src/slic3r/GUI/CalibrationWizardCaliPage.cpp b/src/slic3r/GUI/CalibrationWizardCaliPage.cpp index d9604da84a..152f46f37c 100644 --- a/src/slic3r/GUI/CalibrationWizardCaliPage.cpp +++ b/src/slic3r/GUI/CalibrationWizardCaliPage.cpp @@ -90,7 +90,7 @@ void CalibrationCaliPage::on_subtask_abort(wxCommandEvent& event) if (abort_dlg == nullptr) { abort_dlg = new SecondaryCheckDialog(this->GetParent(), wxID_ANY, _L("Cancel print")); - abort_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this, obj](wxCommandEvent& e) { + abort_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [obj](wxCommandEvent& e) { if (obj) obj->command_task_abort(); }); } diff --git a/src/slic3r/GUI/CalibrationWizardPage.cpp b/src/slic3r/GUI/CalibrationWizardPage.cpp index ef17da9081..c117ec8857 100644 --- a/src/slic3r/GUI/CalibrationWizardPage.cpp +++ b/src/slic3r/GUI/CalibrationWizardPage.cpp @@ -762,7 +762,7 @@ void CaliPageActionPanel::bind_button(CaliPageActionType action_type, bool is_bl if (is_block) { m_action_btns[i]->Bind(wxEVT_BUTTON, - [this](wxCommandEvent& evt) { + [](wxCommandEvent& evt) { MessageDialog msg(nullptr, _L("The current firmware version of the printer does not support calibration.\nPlease upgrade the printer firmware."), _L("Calibration not supported"), wxOK | wxICON_WARNING); msg.ShowModal(); }); diff --git a/src/slic3r/GUI/CalibrationWizardSavePage.cpp b/src/slic3r/GUI/CalibrationWizardSavePage.cpp index 78bc4bb77f..f7699cfab0 100644 --- a/src/slic3r/GUI/CalibrationWizardSavePage.cpp +++ b/src/slic3r/GUI/CalibrationWizardSavePage.cpp @@ -272,7 +272,7 @@ void CaliPASaveAutoPanel::sync_cali_result(const std::vector& cal preset_names = default_naming(preset_names); std::vector sorted_cali_result = cali_result; - std::sort(sorted_cali_result.begin(), sorted_cali_result.end(), [this](const PACalibResult &left, const PACalibResult& right) { + std::sort(sorted_cali_result.begin(), sorted_cali_result.end(), [](const PACalibResult &left, const PACalibResult& right) { return left.tray_id < right.tray_id; }); @@ -366,7 +366,7 @@ void CaliPASaveAutoPanel::sync_cali_result(const std::vector& cal } } - comboBox_tray_name->Bind(wxEVT_COMBOBOX, [this, comboBox_tray_name, k_value, n_value](auto& e) { + comboBox_tray_name->Bind(wxEVT_COMBOBOX, [comboBox_tray_name](auto& e) { int selection = comboBox_tray_name->GetSelection(); auto history = filtered_results[selection]; }); @@ -744,7 +744,7 @@ void CaliPASaveAutoPanel::sync_cali_result_for_multi_extruder(const std::vector< } } - comboBox_tray_name->Bind(wxEVT_COMBOBOX, [this, comboBox_tray_name, k_value, n_value](auto &e) { + comboBox_tray_name->Bind(wxEVT_COMBOBOX, [comboBox_tray_name](auto &e) { int selection = comboBox_tray_name->GetSelection(); auto history = filtered_results[selection]; }); diff --git a/src/slic3r/GUI/CameraPopup.cpp b/src/slic3r/GUI/CameraPopup.cpp index 0ee5694a34..cc7e00eec6 100644 --- a/src/slic3r/GUI/CameraPopup.cpp +++ b/src/slic3r/GUI/CameraPopup.cpp @@ -140,7 +140,7 @@ CameraPopup::CameraPopup(wxWindow *parent) vcamera_guide_link->Wrap(-1); vcamera_guide_link->SetForegroundColour(wxColour(0x1F, 0x8E, 0xEA)); auto text_size = vcamera_guide_link->GetTextExtent(text); - vcamera_guide_link->Bind(wxEVT_LEFT_DOWN, [this, url](wxMouseEvent& e) {wxLaunchDefaultBrowser(url); }); + vcamera_guide_link->Bind(wxEVT_LEFT_DOWN, [url](wxMouseEvent& e) {wxLaunchDefaultBrowser(url); }); link_underline = new wxPanel(m_panel, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL); link_underline->SetBackgroundColour(wxColour(0x1F, 0x8E, 0xEA)); diff --git a/src/slic3r/GUI/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp index dba8699105..412df19091 100644 --- a/src/slic3r/GUI/ConfigWizard.cpp +++ b/src/slic3r/GUI/ConfigWizard.cpp @@ -2752,7 +2752,7 @@ ConfigWizard::ConfigWizard(wxWindow *parent) }); if (wxLinux_gtk3) - this->Bind(wxEVT_SHOW, [this, vsizer](const wxShowEvent& e) { + this->Bind(wxEVT_SHOW, [](const wxShowEvent& e) { ; }); diff --git a/src/slic3r/GUI/CreatePresetsDialog.cpp b/src/slic3r/GUI/CreatePresetsDialog.cpp index 33f49c2a38..063d1ce628 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.cpp +++ b/src/slic3r/GUI/CreatePresetsDialog.cpp @@ -1885,7 +1885,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_nozzle_diameter_item(wxWindow *par m_custom_nozzle_diameter_ctrl = new wxTextCtrl(parent, wxID_ANY, "", wxDefaultPosition, NAME_OPTION_COMBOBOX_SIZE); m_custom_nozzle_diameter_ctrl->SetHint(_L("Input Custom Nozzle Diameter")); - m_custom_nozzle_diameter_ctrl->Bind(wxEVT_CHAR, [this](wxKeyEvent &event) { + m_custom_nozzle_diameter_ctrl->Bind(wxEVT_CHAR, [](wxKeyEvent &event) { int key = event.GetKeyCode(); if (key != 44 && key != 46 && cannot_input_key.find(key) != cannot_input_key.end()) { // "@" can not be inputed event.Skip(false); diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index dbbf5ec5e2..b0302f2cf8 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -1324,7 +1324,7 @@ void SpinCtrl::BUILD() { bEnterPressed = true; }), temp->GetId()); - temp->GetTextCtrl()->Bind(wxEVT_TEXT, ([this, temp](wxCommandEvent e) + temp->GetTextCtrl()->Bind(wxEVT_TEXT, ([this](wxCommandEvent e) { // # On OSX / Cocoa, SpinInput::GetValue() doesn't return the new value // # when it was changed from the text control, so the on_change callback diff --git a/src/slic3r/GUI/FilamentPickerDialog.cpp b/src/slic3r/GUI/FilamentPickerDialog.cpp index 98c955fb76..5b5af59501 100644 --- a/src/slic3r/GUI/FilamentPickerDialog.cpp +++ b/src/slic3r/GUI/FilamentPickerDialog.cpp @@ -426,11 +426,11 @@ wxScrolledWindow* FilamentPickerDialog::CreateColorGrid() }); // Hover highlight - btn->Bind(wxEVT_ENTER_WINDOW, [btn](wxMouseEvent& evt) { + btn->Bind(wxEVT_ENTER_WINDOW, [](wxMouseEvent& evt) { evt.Skip(); }); - btn->Bind(wxEVT_LEAVE_WINDOW, [btn](wxMouseEvent& evt) { + btn->Bind(wxEVT_LEAVE_WINDOW, [](wxMouseEvent& evt) { evt.Skip(); }); diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 15085c3cc4..e5a88e4ea4 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -2613,7 +2613,7 @@ void GCodeViewer::render_all_plates_stats(const std::vector>& columns_offsets) + auto append_item = [icon_size, &imgui, &window_padding, &draw_list, this](const ColorRGBA& color, const std::vector>& columns_offsets) { // render icon ImVec2 pos = ImVec2(ImGui::GetCursorScreenPos().x + window_padding * 3, ImGui::GetCursorScreenPos().y); @@ -2648,7 +2648,7 @@ void GCodeViewer::render_all_plates_stats(const std::vector ret = { koef * volume / (PI * sqr(0.5 * filament_diameters[extruder_id])), volume * filament_densities[extruder_id] * 0.001 }; @@ -3233,7 +3233,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv //ImVec2(pos_rect.x + ImGui::GetWindowWidth() + ImGui::GetFrameHeight(),pos_rect.y + ImGui::GetFrameHeight() + window_padding * 2.5), //ImGui::GetColorU32(ImVec4(0,0,0,0.3))); - auto append_item = [icon_size, &imgui, imperial_units, &window_padding, &draw_list, this]( + auto append_item = [icon_size, &imgui, &window_padding, &draw_list, this]( EItemType type, const ColorRGBA& color, const std::vector>& columns_offsets, @@ -3368,7 +3368,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv return ret; }; - auto calculate_offsets = [&imgui, max_width, window_padding, this](const std::vector>>& title_columns, float extra_size = 0.0f) { + auto calculate_offsets = [max_width, this](const std::vector>>& title_columns, float extra_size = 0.0f) { const ImGuiStyle& style = ImGui::GetStyle(); std::vector offsets; // ORCA increase spacing for more readable format. Using direct number requires much less code change in here. GetTextLineHeight for additional spacing for icon_size @@ -3856,7 +3856,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv columns_offsets.push_back({ distance_text, offsets[3] }); if (full_layout && !count_text.empty()) columns_offsets.push_back({ count_text, distance_text.empty() ? offsets[3] : offsets[4] }); - append_item(EItemType::Rect, color, columns_offsets, true, offsets.back()/*ORCA checkbox_pos*/, visible, [this, type, visible]() { + append_item(EItemType::Rect, color, columns_offsets, true, offsets.back()/*ORCA checkbox_pos*/, visible, [this, type]() { m_viewer.toggle_option_visibility(type); update_moves_slider(); }); @@ -3913,7 +3913,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv columns_offsets.push_back({used_filaments_length[i], offsets[3]}); columns_offsets.push_back({used_filaments_weight[i], offsets[4]}); append_item(EItemType::Rect, libvgcode::convert(m_viewer.get_extrusion_role_color(role)), columns_offsets, - true, offsets.back(), visible, [this, role, visible]() { + true, offsets.back(), visible, [this, role]() { m_viewer.toggle_extrusion_role_visibility(role); update_moves_slider(); }); @@ -3932,7 +3932,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv columns_offsets.push_back({ travel_percent, offsets[2] }); columns_offsets.push_back({ travel_distance, offsets[3] }); // Usage column columns_offsets.push_back({ travel_moves, offsets[4] }); // Usage column - append_item(EItemType::Rect, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), columns_offsets, true, offsets.back()/*ORCA checkbox_pos*/, visible, [this, item, visible]() { + append_item(EItemType::Rect, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), columns_offsets, true, offsets.back()/*ORCA checkbox_pos*/, visible, [this, item]() { m_viewer.toggle_option_visibility(item); update_moves_slider(); }); @@ -3951,7 +3951,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv append_headers({ {_u8L("Options"), offsets[0] }, { _u8L("Display"), offsets[1]} }); const bool travel_visible = m_viewer.is_option_visible(libvgcode::EOptionType::Travels); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 3.0f)); - append_item(EItemType::None, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), { {_u8L("Travel"), offsets[0] }}, true, predictable_icon_pos/*ORCA checkbox_pos*/, travel_visible, [this, travel_visible]() { + append_item(EItemType::None, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), { {_u8L("Travel"), offsets[0] }}, true, predictable_icon_pos/*ORCA checkbox_pos*/, travel_visible, [this]() { m_viewer.toggle_option_visibility(libvgcode::EOptionType::Travels); // refresh(*m_gcode_result, wxGetApp().plater()->get_extruder_colors_from_plater_config(m_gcode_result)); update_moves_slider(); @@ -3968,7 +3968,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv append_headers({ {_u8L("Options"), offsets[0] }, { _u8L("Display"), offsets[1]} }); const bool travel_visible = m_viewer.is_option_visible(libvgcode::EOptionType::Travels); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 3.0f)); - append_item(EItemType::None, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), { {_u8L("Travel"), offsets[0] }}, true, predictable_icon_pos/*ORCA checkbox_pos*/, travel_visible, [this, travel_visible]() { + append_item(EItemType::None, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), { {_u8L("Travel"), offsets[0] }}, true, predictable_icon_pos/*ORCA checkbox_pos*/, travel_visible, [this]() { m_viewer.toggle_option_visibility(libvgcode::EOptionType::Travels); // refresh(*m_gcode_result, wxGetApp().plater()->get_extruder_colors_from_plater_config(m_gcode_result)); update_moves_slider(); @@ -3985,7 +3985,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv append_headers({ {_u8L("Options"), offsets[0] }, { _u8L("Display"), offsets[1]} }); const bool travel_visible = m_viewer.is_option_visible(libvgcode::EOptionType::Travels); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 3.0f)); - append_item(EItemType::None, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), { {_u8L("Travel"), offsets[0] }}, true, predictable_icon_pos/*ORCA checkbox_pos*/, travel_visible, [this, travel_visible]() { + append_item(EItemType::None, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), { {_u8L("Travel"), offsets[0] }}, true, predictable_icon_pos/*ORCA checkbox_pos*/, travel_visible, [this]() { m_viewer.toggle_option_visibility(libvgcode::EOptionType::Travels); update_moves_slider(); }); @@ -4001,7 +4001,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv append_headers({ {_u8L("Options"), offsets[0] }, { _u8L("Display"), offsets[1]} }); const bool travel_visible = m_viewer.is_option_visible(libvgcode::EOptionType::Travels); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 3.0f)); - append_item(EItemType::None, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), { {_u8L("Travel"), offsets[0] }}, true, predictable_icon_pos/*ORCA checkbox_pos*/, travel_visible, [this, travel_visible]() { + append_item(EItemType::None, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), { {_u8L("Travel"), offsets[0] }}, true, predictable_icon_pos/*ORCA checkbox_pos*/, travel_visible, [this]() { m_viewer.toggle_option_visibility(libvgcode::EOptionType::Travels); update_moves_slider(); }); @@ -4121,7 +4121,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv } float checkbox_pos = std::max(predictable_icon_pos, color_print_offsets[_u8L("Display")]); // ORCA prefer predictable_icon_pos when header not reacing end - append_item(EItemType::Rect, libvgcode::convert(tool_colors[extruder_idx]), columns_offsets, false, checkbox_pos/*ORCA*/, true, [this, extruder_idx]() {}); + append_item(EItemType::Rect, libvgcode::convert(tool_colors[extruder_idx]), columns_offsets, false, checkbox_pos/*ORCA*/, true, []() {}); } i++; } diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 34279369a1..7db7e01e9c 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -9236,7 +9236,7 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar() ImVec2 size = ImVec2(button_width, button_height); ImVec2 end_pos = ImVec2(start_pos.x + size.x, start_pos.y + size.y); // ORCA show additional information depends on state - auto draw_info_btn = [end_pos, f_scale, margin, window_bg](std::string str, ImVec4 bg_color, ImVec4 fg_color){ + auto draw_info_btn = [end_pos, f_scale, margin](std::string str, ImVec4 bg_color, ImVec4 fg_color){ GImGui->FontSize = 15.0f * f_scale; ImVec2 txt_slice_sz = ImGui::CalcTextSize(str.c_str()); ImVec2 btn_pad = ImVec2(8.f, 1.f) * f_scale; @@ -9492,7 +9492,7 @@ void GLCanvas3D::_render_canvas_toolbar() Plater* p = wxGetApp().plater(); AppConfig* cfg = wxGetApp().app_config; - auto create_menu_item = [this, sc]( + auto create_menu_item = [sc]( const std::string& name, bool enable, bool condition, @@ -9509,7 +9509,7 @@ void GLCanvas3D::_render_canvas_toolbar() create_menu_item( _utf8(L("3D Navigator")), m_canvas_type != ECanvasType::CanvasAssembleView, // not work on assembly wxGetApp().show_3d_navigator(), - [this]{ + []{ wxGetApp().toggle_show_3d_navigator(); ImGui::CloseCurrentPopup(); // Close popup to show changes on UI } @@ -9518,7 +9518,7 @@ void GLCanvas3D::_render_canvas_toolbar() create_menu_item( _utf8(L("Zoom button")), true, // work on all wxGetApp().show_canvas_zoom_button(), - [this]{ + []{ wxGetApp().toggle_canvas_zoom_button(); ImGui::CloseCurrentPopup(); // Close popup to show changes on UI } @@ -9529,13 +9529,13 @@ void GLCanvas3D::_render_canvas_toolbar() create_menu_item( _utf8(L("Overhangs")), m_canvas_type == ECanvasType::CanvasView3D, // work only on prepare p->is_view3D_overhang_shown(), - [this, p]{p->show_view3D_overhang(!p->is_view3D_overhang_shown());} + [p]{p->show_view3D_overhang(!p->is_view3D_overhang_shown());} ); create_menu_item( _utf8(L("Outline")), m_canvas_type != ECanvasType::CanvasPreview, // not work on preview wxGetApp().show_outline(), - [this]{wxGetApp().toggle_show_outline();} + []{wxGetApp().toggle_show_outline();} ); create_menu_item( _utf8(L("Wireframe")), @@ -9547,7 +9547,7 @@ void GLCanvas3D::_render_canvas_toolbar() create_menu_item( _utf8(L("Realistic View")), m_canvas_type != ECanvasType::CanvasPreview, // not work on preview cfg->get_bool(SETTING_OPENGL_REALISTIC_MODE), - [this, &cfg]{ + [&cfg]{ cfg->set_bool(SETTING_OPENGL_REALISTIC_MODE, !cfg->get_bool(SETTING_OPENGL_REALISTIC_MODE)); cfg->save(); } @@ -9558,7 +9558,7 @@ void GLCanvas3D::_render_canvas_toolbar() create_menu_item( _utf8(L("Perspective")), true, // work on all cfg->get_bool("use_perspective_camera"), - [this, &cfg]{ + [&cfg]{ cfg->set_bool("use_perspective_camera", !(cfg->get_bool("use_perspective_camera"))); wxGetApp().update_ui_from_settings(); } @@ -9575,7 +9575,7 @@ void GLCanvas3D::_render_canvas_toolbar() create_menu_item( _utf8(L("Gridlines")), m_canvas_type != ECanvasType::CanvasAssembleView, // not work on assembly wxGetApp().show_plate_gridlines(), - [this]{wxGetApp().toggle_show_plate_gridlines();} + []{wxGetApp().toggle_show_plate_gridlines();} ); ImGui::Separator(); @@ -9583,7 +9583,7 @@ void GLCanvas3D::_render_canvas_toolbar() create_menu_item( _utf8(L("Labels")), m_canvas_type == ECanvasType::CanvasView3D, // work only on prepare p->are_view3D_labels_shown(), - [this, p]{p->show_view3D_labels(!p->are_view3D_labels_shown());} + [p]{p->show_view3D_labels(!p->are_view3D_labels_shown());} ); ImGui::PopItemFlag(); diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 223829f435..d661b012a3 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -2641,7 +2641,7 @@ std::string GUI_App::get_bbl_client_version() void GUI_App::on_start_subscribe_again(std::string dev_id) { auto start_subscribe_timer = new wxTimer(this, wxID_ANY); - Bind(wxEVT_TIMER, [this, start_subscribe_timer, dev_id](auto& e) { + Bind(wxEVT_TIMER, [start_subscribe_timer, dev_id](auto& e) { start_subscribe_timer->Stop(); Slic3r::DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager(); if (!dev) return; @@ -3231,7 +3231,7 @@ bool GUI_App::on_init_inner() } }); - Bind(EVT_SHOW_NO_NEW_VERSION, [this](const wxCommandEvent& evt) { + Bind(EVT_SHOW_NO_NEW_VERSION, [](const wxCommandEvent& evt) { wxString msg = _L("This is the newest version."); InfoDialog dlg(nullptr, _L("Info"), msg); dlg.ShowModal(); @@ -5256,7 +5256,7 @@ std::string GUI_App::handle_web_request(std::string cmd) } } else if (command_str.compare("begin_network_plugin_download") == 0) { - CallAfter([this] { wxGetApp().ShowDownNetPluginDlg(); }); + CallAfter([] { wxGetApp().ShowDownNetPluginDlg(); }); } else if (command_str.compare("get_web_shortcut") == 0) { if (root.get_child_optional("key_event") != boost::none) { @@ -8297,7 +8297,7 @@ bool GUI_App::show_modal_ip_address_enter_dialog(bool input_sn, wxString title) dlg.set_machine_obj(obj); if (!title.empty()) dlg.update_title(title); - dlg.Bind(EVT_ENTER_IP_ADDRESS, [this, obj](wxCommandEvent& e) { + dlg.Bind(EVT_ENTER_IP_ADDRESS, [obj](wxCommandEvent& e) { auto selection_data_arr = wxSplit(e.GetString().ToStdString(), '|'); if (selection_data_arr.size() == 2) { @@ -8777,7 +8777,7 @@ bool GUI_App::check_and_keep_current_preset_changes(const wxString& caption, con if (!no_need_change && dlg.ShowModal() == wxID_CANCEL) return false; - auto reset_modifications = [this, is_called_from_configwizard]() { + auto reset_modifications = [this]() { //if (is_called_from_configwizard) // return; // no need to discared changes. It will be done fromConfigWizard closing diff --git a/src/slic3r/GUI/GUI_AuxiliaryList.cpp b/src/slic3r/GUI/GUI_AuxiliaryList.cpp index 1fa5b194ec..be9f99a76a 100644 --- a/src/slic3r/GUI/GUI_AuxiliaryList.cpp +++ b/src/slic3r/GUI/GUI_AuxiliaryList.cpp @@ -217,7 +217,7 @@ void AuxiliaryList::on_context_menu(wxDataViewEvent& evt) } else { append_menu_item(menu, wxID_ANY, _L("Open"), wxEmptyString, - [this, node](wxCommandEvent&) + [node](wxCommandEvent&) { wxLaunchDefaultApplication(node->path, 0); }); diff --git a/src/slic3r/GUI/GUI_Factories.cpp b/src/slic3r/GUI/GUI_Factories.cpp index be407a270f..d8e54978fa 100644 --- a/src/slic3r/GUI/GUI_Factories.cpp +++ b/src/slic3r/GUI/GUI_Factories.cpp @@ -1414,7 +1414,7 @@ void MenuFactory::create_default_menu() append_menu_check_item(&m_default_menu, wxID_ANY, _L("Show Labels"), "", [](wxCommandEvent&) { plater()->show_view3D_labels(!plater()->are_view3D_labels_shown()); plater()->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT)); }, &m_default_menu, - []() { return plater()->is_view3D_shown(); }, [this]() { return plater()->are_view3D_labels_shown(); }, m_parent); + []() { return plater()->is_view3D_shown(); }, []() { return plater()->are_view3D_labels_shown(); }, m_parent); } void MenuFactory::create_common_object_menu(wxMenu* menu) @@ -2090,7 +2090,7 @@ void MenuFactory::append_menu_item_clone(wxMenu* menu) static const wxString ctrl = _L("Ctrl+"); #endif append_menu_item(menu, wxID_ANY, _L("Clone") + "\t" + ctrl + "K", "", - [this](wxCommandEvent&) { + [](wxCommandEvent&) { plater()->clone_selection(); }, "", nullptr, []() { @@ -2115,7 +2115,7 @@ void MenuFactory::append_menu_item_smooth_mesh(wxMenu *menu) void MenuFactory::append_menu_item_center(wxMenu* menu) { append_menu_item(menu, wxID_ANY, _L("Center") , "", - [this](wxCommandEvent&) { + [](wxCommandEvent&) { plater()->center_selection(); }, "", nullptr, []() { @@ -2134,7 +2134,7 @@ void MenuFactory::append_menu_item_center(wxMenu* menu) void MenuFactory::append_menu_item_drop(wxMenu* menu) { append_menu_item(menu, wxID_ANY, _L("Drop") , "", - [this](wxCommandEvent&) { + [](wxCommandEvent&) { plater()->drop_selection(); }, "", nullptr, []() { @@ -2309,7 +2309,7 @@ void MenuFactory::append_menu_item_set_printable(wxMenu* menu) } } - wxMenuItem* menu_item_set_printable = append_menu_check_item(menu, wxID_ANY, _L("Printable") + "\t" + "V", "", [this, all_printable](wxCommandEvent&) { + wxMenuItem* menu_item_set_printable = append_menu_check_item(menu, wxID_ANY, _L("Printable") + "\t" + "V", "", [all_printable](wxCommandEvent&) { Selection& selection = plater()->canvas3D()->get_selection(); selection.set_printable(!all_printable); }, menu); @@ -2329,7 +2329,7 @@ void MenuFactory::append_menu_item_set_auto_drop(wxMenu* menu) wxString menu_tooltip = _L("Automatically snaps the selected object to the build plate."); wxMenuItem* menu_item_set_auto_drop = append_menu_check_item( menu, wxID_ANY, menu_text, menu_tooltip, - [this, current_auto_drop](wxCommandEvent&) { + [current_auto_drop](wxCommandEvent&) { Selection& selection = plater()->canvas3D()->get_selection(); selection.set_auto_drop(!current_auto_drop); }, @@ -2384,7 +2384,7 @@ void MenuFactory::append_menu_item_plate_name(wxMenu *menu) auto item = append_menu_item( menu, wxID_ANY, name, "", - [plate](wxCommandEvent &e) { + [](wxCommandEvent &e) { int hover_idx =plater()->canvas3D()->GetHoverId(); if (hover_idx == -1) { int plate_idx=plater()->GetPlateIndexByRightMenuInLeftUI(); diff --git a/src/slic3r/GUI/GUI_ObjectLayers.cpp b/src/slic3r/GUI/GUI_ObjectLayers.cpp index 3b36158bd1..bbd7294ae5 100644 --- a/src/slic3r/GUI/GUI_ObjectLayers.cpp +++ b/src/slic3r/GUI/GUI_ObjectLayers.cpp @@ -223,7 +223,7 @@ void ObjectLayers::update_layers_list() // only call sizer->Clear(true) via CallAfter, otherwise crash happens in Linux when press enter in Height Range // because an element cannot be destroyed while there are pending events for this element.(https://github.com/wxWidgets/Phoenix/issues/1854) - wxGetApp().CallAfter([this, type, objects_ctrl, range]() { + wxGetApp().CallAfter([this, type, range]() { m_og->ctrl_parent()->Freeze(); // Delete all controls from options group diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index b33cc82abc..8067afd8df 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -2324,7 +2324,7 @@ void ObjectList::load_modifier(const wxArrayString& input_files, ModelObject& mo bool split_compound = wxGetApp().app_config->get_bool("is_split_compound"); model = Model::read_from_step( input_file, LoadStrategy::LoadModel, nullptr, nullptr, - [this, &is_user_cancel, &linear, &angle, &split_compound](Slic3r::Step& file, double& linear_value, + [&is_user_cancel, &linear, &angle, &split_compound](Slic3r::Step& file, double& linear_value, double& angle_value, bool& is_split) -> int { if (wxGetApp().app_config->get_bool("enable_step_mesh_setting")) { StepMeshDialog mesh_dlg(nullptr, file, linear, angle); @@ -3317,7 +3317,7 @@ void ObjectList::boolean() } } - TriangleMesh mesh = Plater::combine_mesh_fff(*object, -1, [this](const std::string& msg) {return wxGetApp().notification_manager()->push_plater_error_notification(msg); }); + TriangleMesh mesh = Plater::combine_mesh_fff(*object, -1, [](const std::string& msg) {return wxGetApp().notification_manager()->push_plater_error_notification(msg); }); // add mesh to model as a new object, keep the original object's name and config Model* model = object->get_model(); @@ -6267,7 +6267,7 @@ void GUI::ObjectList::smooth_mesh() get_selection_indexes(obj_idxs, vol_idxs); auto object_idx = obj_idxs.front(); ModelObject *obj{nullptr}; - auto show_warning_dlg = [this](int cur_face_count,std::string name,bool is_part) { + auto show_warning_dlg = [](int cur_face_count,std::string name,bool is_part) { int limit_face_count = 1000000; if (cur_face_count > limit_face_count) { auto name_str = wxString::FromUTF8(name); @@ -6280,7 +6280,7 @@ void GUI::ObjectList::smooth_mesh() } return false; }; - auto show_smooth_mesh_error_dlg = [this](std::string name) { + auto show_smooth_mesh_error_dlg = [](std::string name) { auto name_str = wxString::FromUTF8(name); auto content = wxString::Format(_L("\"%s\" part's mesh contains errors. Please repair it first."), name_str); WarningDialog dlg(static_cast(wxGetApp().mainframe), content, wxEmptyString, wxOK); diff --git a/src/slic3r/GUI/GUI_ObjectTable.cpp b/src/slic3r/GUI/GUI_ObjectTable.cpp index 1fc07bf5a2..35508c6113 100644 --- a/src/slic3r/GUI/GUI_ObjectTable.cpp +++ b/src/slic3r/GUI/GUI_ObjectTable.cpp @@ -3520,13 +3520,13 @@ void GridCellTextEditor::BeginEdit(int row, int col, wxGrid *grid) Text()->GetTextCtrl()->SetInsertionPointEnd(); - m_control->Bind(wxEVT_TEXT_ENTER, [this, row, col, grid](wxCommandEvent &e) { + m_control->Bind(wxEVT_TEXT_ENTER, [grid](wxCommandEvent &e) { grid->HideCellEditControl(); grid->SaveEditControlValue(); e.Skip(); }); - m_control->Bind(wxEVT_CHAR_HOOK, [this, row, col, grid](wxKeyEvent &e) { + m_control->Bind(wxEVT_CHAR_HOOK, [grid](wxKeyEvent &e) { if (e.GetKeyCode() == WXK_ESCAPE) { grid->HideCellEditControl(); grid->SaveEditControlValue(); diff --git a/src/slic3r/GUI/GUI_ObjectTableSettings.cpp b/src/slic3r/GUI/GUI_ObjectTableSettings.cpp index e72c421a08..2290018419 100644 --- a/src/slic3r/GUI/GUI_ObjectTableSettings.cpp +++ b/src/slic3r/GUI/GUI_ObjectTableSettings.cpp @@ -184,7 +184,7 @@ bool ObjectTableSettings::update_settings_list(bool is_object, bool is_multiple_ btn->Bind(EVT_LOCK_ENABLE, [this, btn](auto &e) { btn->SetBitmap(m_bmp_reset_focus.bmp()); }); #endif - btn->Bind(wxEVT_BUTTON, [btn, opt_key, this, is_object, object, config, group_category](wxEvent &event) { + btn->Bind(wxEVT_BUTTON, [opt_key, this, is_object, object, config, group_category](wxEvent &event) { //wxGetApp().plater()->take_snapshot(from_u8((boost::format(_utf8(L("Reset Option %s"))) % opt_key).str())); config->erase(opt_key); //btn->Hide(); @@ -204,10 +204,13 @@ bool ObjectTableSettings::update_settings_list(bool is_object, bool is_multiple_ this->m_parent->Thaw(); #ifdef __WXOSX_MAC__ - if (!btn->IsEnabled()) { - btn->SetBitmap(m_bmp_reset_disable.bmp()); - } else { - btn->SetBitmap(m_bmp_reset_focus.bmp()); + // The handler is bound on the button, so the event source is that button. + if (auto *btn = dynamic_cast(event.GetEventObject())) { + if (!btn->IsEnabled()) { + btn->SetBitmap(m_bmp_reset_disable.bmp()); + } else { + btn->SetBitmap(m_bmp_reset_focus.bmp()); + } } #endif }); @@ -284,13 +287,13 @@ bool ObjectTableSettings::update_settings_list(bool is_object, bool is_multiple_ m_settings_list_sizer->Add(optgroup->sizer, 0, wxEXPAND | wxALL, 0); m_og_settings.push_back(optgroup); - auto toggle_field = [this, optgroup](const t_config_option_key & opt_key, bool toggle, int opt_index) + auto toggle_field = [optgroup](const t_config_option_key & opt_key, bool toggle, int opt_index) { Field* field = optgroup->get_fieldc(opt_key, opt_index);; if (field) field->toggle(toggle); }; - auto toggle_line = [this, optgroup](const t_config_option_key &opt_key, bool toggle, int opt_index) + auto toggle_line = [optgroup](const t_config_option_key &opt_key, bool toggle, int opt_index) { Line* line = optgroup->get_line(opt_key); if (line) line->toggle_visible = toggle; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp b/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp index b5273e3024..273bb94b90 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp @@ -3596,7 +3596,7 @@ void GLGizmoCut3D::perform_cut(const Selection& selection) // model_name failing reason std::vector> failed_models; auto plater = wxGetApp().plater(); - auto fix_and_update_progress = [this, plater, keep_painting](ModelObject *model_object, const int vol_idx, const string &model_name, ProgressDialog &progress_dlg, + auto fix_and_update_progress = [keep_painting](ModelObject *model_object, const int vol_idx, const string &model_name, ProgressDialog &progress_dlg, std::vector &succes_models, std::vector> &failed_models) { wxString msg = _L("Repairing model object"); msg += ": " + from_u8(model_name) + "\n"; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.cpp b/src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.cpp index c7186e5d80..8b12da14f9 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.cpp @@ -223,7 +223,7 @@ void GLGizmoMeshBoolean::on_render_input_window(float x, float y, float bottom_l const int select_btn_length = 2 * ImGui::GetStyle().FramePadding.x + std::max(ImGui::CalcTextSize(("1 " + _u8L("selected")).c_str()).x, ImGui::CalcTextSize(_u8L("Select").c_str()).x); - auto selectable = [this](const std::string& label, bool selected, const ImVec2& size_arg) { + auto selectable = [](const std::string& label, bool selected, const ImVec2& size_arg) { ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, { 0,0 }); ImGuiWindow* window = ImGui::GetCurrentWindow(); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp index 8f0cd9a43d..3dcf51cbb5 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp @@ -1456,7 +1456,7 @@ void TriangleSelectorPatch::update_triangles_per_patch() return touching_triangles; }; - auto calc_fragment_area = [this](const TrianglePatch& patch, float max_limit_area, int stride) { + auto calc_fragment_area = [](const TrianglePatch& patch, float max_limit_area, int stride) { double total_area = 0.f; const std::vector& ti = patch.triangle_indices; /*for (int i = 0; i < ti.size() / 3; i++) { diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index 7882cf2269..9cff834346 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -1003,7 +1003,7 @@ bool GLGizmosManager::on_key(wxKeyEvent& evt) // number waits briefly for a second one. const int digit = keyCode - '0'; const int shortcut_max = int(GLGizmoMmuSegmentation::EXTRUDERS_LIMIT); - auto can_start_two_digit = [shortcut_max](int d) { return d > 0 && d * 10 <= shortcut_max; }; + auto can_start_two_digit = [](int d) { return d > 0 && d * 10 <= shortcut_max; }; auto select = [mmu_seg](int number) { return number > 0 && mmu_seg->on_number_key_down(number); }; if (m_timer_set_color.IsRunning() && m_pending_color_shortcut_tens > 0) { diff --git a/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp b/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp index d7b082426c..7c4a2afd38 100644 --- a/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp +++ b/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp @@ -239,7 +239,7 @@ void GizmoObjectManipulation::update_if_dirty() }; for (int i = 0; i < 3; ++ i) { - auto update = [this, i](Vec3d &cached, Vec3d &cached_rounded, const Vec3d &new_value) { + auto update = [i](Vec3d &cached, Vec3d &cached_rounded, const Vec3d &new_value) { //wxString new_text = double_to_string(new_value(i), 2); double new_rounded = round(new_value(i)*100)/100.0; //new_text.ToDouble(&new_rounded); diff --git a/src/slic3r/GUI/HMS.cpp b/src/slic3r/GUI/HMS.cpp index 5471c16064..f00e661df2 100644 --- a/src/slic3r/GUI/HMS.cpp +++ b/src/slic3r/GUI/HMS.cpp @@ -46,7 +46,7 @@ int get_hms_info_version(std::string& version) std::string url = (boost::format("https://%1%/GetVersion.php?%2%") % hms_host % query_params).str(); Slic3r::Http http = Slic3r::Http::get(url); http.timeout_max(10) - .on_complete([&result, &version](std::string body, unsigned status){ + .on_complete([&version](std::string body, unsigned status){ try { json j = json::parse(body); if (j.contains("ver")) { @@ -95,7 +95,7 @@ int HMSQuery::download_hms_related(const std::string& hms_type, const std::strin BOOST_LOG_TRIVIAL(info) << "hms: download url = " << url; Slic3r::Http http = Slic3r::Http::get(url); - http.on_complete([this, receive_json, hms_type, &to_save_local, &j, & local_version](std::string body, unsigned status) { + http.on_complete([receive_json, hms_type, &to_save_local, &j, & local_version](std::string body, unsigned status) { try { j = json::parse(body); if (j.contains("result")) { diff --git a/src/slic3r/GUI/Jobs/FillBedJob.cpp b/src/slic3r/GUI/Jobs/FillBedJob.cpp index a9a66cb96f..5364cb5648 100644 --- a/src/slic3r/GUI/Jobs/FillBedJob.cpp +++ b/src/slic3r/GUI/Jobs/FillBedJob.cpp @@ -184,7 +184,7 @@ void FillBedJob::prepare() ap.poly = m_selected.front().poly; ap.bed_idx = PartPlateList::MAX_PLATES_COUNT; ap.itemid = -1; - ap.setter = [this, mi, offset](const ArrangePolygon &p) { + ap.setter = [this, offset](const ArrangePolygon &p) { ModelObject *mo = m_plater->model().objects[m_object_idx]; ModelObject *obj; if (m_instances) { diff --git a/src/slic3r/GUI/Jobs/PrintJob.cpp b/src/slic3r/GUI/Jobs/PrintJob.cpp index d79deb955b..dae05494e3 100644 --- a/src/slic3r/GUI/Jobs/PrintJob.cpp +++ b/src/slic3r/GUI/Jobs/PrintJob.cpp @@ -135,7 +135,6 @@ void PrintJob::process(Ctl &ctl) { /* display info */ std::string msg; - wxString error_str; int curr_percent = 10; NetworkAgent* m_agent = wxGetApp().getAgent(); AppConfig* config = wxGetApp().app_config; @@ -402,9 +401,7 @@ void PrintJob::process(Ctl &ctl) &is_try_lan_mode, &is_try_lan_mode_failed, &msg, - &error_str, &curr_percent, - &error_text, StagePercentPoint ](int stage, int code, std::string info) { @@ -491,7 +488,7 @@ void PrintJob::process(Ctl &ctl) DeviceManager* dev = wxGetApp().getDeviceManager(); MachineObject* obj = dev->get_selected_machine(); - auto wait_fn = [this, &ctl, curr_percent, &obj](int state, std::string job_info) { + auto wait_fn = [&ctl, &obj](int state, std::string job_info) { BOOST_LOG_TRIVIAL(info) << "print_job: get_job_info = " << job_info; if (!obj->is_support_wait_sending_finish) { diff --git a/src/slic3r/GUI/Jobs/RotoptimizeJob.cpp b/src/slic3r/GUI/Jobs/RotoptimizeJob.cpp index f97b03bf62..7f8219008f 100644 --- a/src/slic3r/GUI/Jobs/RotoptimizeJob.cpp +++ b/src/slic3r/GUI/Jobs/RotoptimizeJob.cpp @@ -55,7 +55,7 @@ void RotoptimizeJob::process(Ctl &ctl) sla::RotOptimizeParams{} .accuracy(m_accuracy) .print_config(&m_default_print_cfg) - .statucb([this, &prev_status, &ctl/*, &statustxt*/](int s) + .statucb([&ctl/*, &statustxt*/](int s) { return !ctl.was_canceled(); }); diff --git a/src/slic3r/GUI/Jobs/SendJob.cpp b/src/slic3r/GUI/Jobs/SendJob.cpp index bb52367188..67ce02b476 100644 --- a/src/slic3r/GUI/Jobs/SendJob.cpp +++ b/src/slic3r/GUI/Jobs/SendJob.cpp @@ -213,7 +213,6 @@ void SendJob::process(Ctl &ctl) params.password = m_access_code; params.use_ssl_for_ftp = m_local_use_ssl_for_ftp; params.use_ssl_for_mqtt = m_local_use_ssl; - wxString error_text; std::string msg_text; const int StagePercentPoint[(int)PrintingStageFinished + 1] = { @@ -227,7 +226,7 @@ void SendJob::process(Ctl &ctl) }; auto update_fn = [this, &ctl, - &msg, &curr_percent, &error_text, StagePercentPoint](int stage, int code, std::string info) { + &msg, &curr_percent, StagePercentPoint](int stage, int code, std::string info) { if (stage == SendingPrintJobStage::PrintingStageCreate) { if (this->connection_type == "lan") { msg = _u8L("Sending G-code file over LAN"); diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 5f7d69244e..a81cb72ab9 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -746,7 +746,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_ evt.Skip(); }); - Bind(wxEVT_SHOW, [this](wxShowEvent &evt) { + Bind(wxEVT_SHOW, [](wxShowEvent &evt) { DeviceManager *manger = wxGetApp().getDeviceManager(); if (manger) { evt.IsShown() ? manger->start_refresher() : manger->stop_refresher(); @@ -2855,7 +2855,7 @@ void MainFrame::init_menubar_as_editor() [this]() { return can_add_models(); }); append_menu_item(import_menu, wxID_ANY, _L("Import Configs") + dots /*+ "\t" + ctrl + "I"*/, _L("Load configs"), [this](wxCommandEvent&) { load_config_file(); }, "menu_import", nullptr, - [this](){return true; }, this); + [](){return true; }, this); append_submenu(fileMenu, import_menu, wxID_ANY, _L("Import"), ""); @@ -2968,7 +2968,7 @@ void MainFrame::init_menubar_as_editor() _L("Duplicate the current plate"),[this](wxCommandEvent&) { m_plater->duplicate_plate(); }, - "menu_remove", nullptr, [this](){return true;}, this); + "menu_remove", nullptr, [](){return true;}, this); editMenu->AppendSeparator(); #else // BBS undo @@ -3135,13 +3135,13 @@ void MainFrame::init_menubar_as_editor() //BBS perspective view wxWindowID camera_id_base = wxWindow::NewControlId(int(wxID_CAMERA_COUNT)); auto perspective_item = append_menu_radio_item(viewMenu, wxID_CAMERA_PERSPECTIVE + camera_id_base, _L("Use Perspective View"), _L("Use Perspective View"), - [this](wxCommandEvent&) { + [](wxCommandEvent&) { wxGetApp().app_config->set_bool("use_perspective_camera", true); wxGetApp().update_ui_from_settings(); }, nullptr); //BBS orthogonal view auto orthogonal_item = append_menu_radio_item(viewMenu, wxID_CAMERA_ORTHOGONAL + camera_id_base, _L("Use Orthogonal View"), _L("Use Orthogonal View"), - [this](wxCommandEvent&) { + [](wxCommandEvent&) { wxGetApp().app_config->set_bool("use_perspective_camera", false); wxGetApp().update_ui_from_settings(); }, nullptr); @@ -3157,7 +3157,7 @@ void MainFrame::init_menubar_as_editor() m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT)); }, this, [this]() { return is_prepare_or_preview_tab(); }, - [this]() { return wxGetApp().app_config->get_bool("auto_perspective"); }, this); + []() { return wxGetApp().app_config->get_bool("auto_perspective"); }, this); viewMenu->AppendSeparator(); append_menu_check_item(viewMenu, wxID_ANY, _L("Show &G-code Window") + sep + "C", _L("Show G-code window in Preview scene."), @@ -3166,7 +3166,7 @@ void MainFrame::init_menubar_as_editor() m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT)); }, this, [this]() { return m_tabpanel->GetSelectedPageName() == TAB_ID_PREVIEW; }, - [this]() { return wxGetApp().show_gcode_window(); }, this); + []() { return wxGetApp().show_gcode_window(); }, this); append_menu_check_item( viewMenu, wxID_ANY, _L("Show 3D Navigator"), _L("Show 3D navigator in Prepare and Preview scene."), @@ -3175,7 +3175,7 @@ void MainFrame::init_menubar_as_editor() m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT)); }, this, [this]() { return is_prepare_or_preview_tab(); }, - [this]() { return wxGetApp().show_3d_navigator(); }, this); + []() { return wxGetApp().show_3d_navigator(); }, this); append_menu_check_item(viewMenu, wxID_ANY, _L("Show Gridlines"), _L("Show Gridlines on plate"), [this](wxCommandEvent&) { @@ -3183,7 +3183,7 @@ void MainFrame::init_menubar_as_editor() m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT)); }, this, [this]() { return is_prepare_or_preview_tab(); }, - [this]() { return wxGetApp().show_plate_gridlines(); }, this); + []() { return wxGetApp().show_plate_gridlines(); }, this); append_menu_item( viewMenu, wxID_ANY, _L("Reset Window Layout"), _L("Reset to default window layout"), @@ -3212,7 +3212,7 @@ void MainFrame::init_menubar_as_editor() m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT)); }, this, [this]() { return m_tabpanel->GetSelectedPageName() == TAB_ID_PREPARE; }, - [this]() { return wxGetApp().show_outline(); }, this); + []() { return wxGetApp().show_outline(); }, this); /*viewMenu->AppendSeparator(); append_menu_check_item(viewMenu, wxID_ANY, _L("Show &Wireframe") + "\t" + ctrl + shift + _L("Enter"), _L("Show wireframes in 3D scene."), @@ -3361,7 +3361,7 @@ void MainFrame::init_menubar_as_editor() append_menu_item( m_topbar->GetTopMenu(), wxID_ANY, _L("Preferences") + "\t" + ctrl + "P", "", - [this](wxCommandEvent &) { + [](wxCommandEvent &) { // Orca: Use GUI_App::open_preferences instead of direct call so windows associations are updated on exit wxGetApp().open_preferences(); }, @@ -3393,14 +3393,14 @@ void MainFrame::init_menubar_as_editor() into_u8(_L("Syncing presets from cloud\u2026"))); wxGetApp().restart_sync_user_preset(); }, "", nullptr, - [this]() { + []() { return wxGetApp().is_user_login() && !wxGetApp().app_config->get_stealth_mode(); }, this); top_menu->AppendSeparator(); append_menu_item( top_menu, wxID_ANY, _L("Plugins") + "\t", "", - [this](wxCommandEvent &) { + [](wxCommandEvent &) { wxGetApp().open_plugins_dialog(); }, "", nullptr, []() { return true; }, this); @@ -3501,7 +3501,7 @@ void MainFrame::init_menubar_as_editor() [this]() {return m_plater->is_view3D_shown();; }, this); // help - append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Calibration Guide"), _L("Calibration Guide"), [this](wxCommandEvent &) + append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Calibration Guide"), _L("Calibration Guide"), [](wxCommandEvent &) { wxLaunchDefaultBrowser("https://www.orcaslicer.com/wiki/calibration_guide", wxBROWSER_NEW_WINDOW); }, "", nullptr, [this]() {return m_plater->is_view3D_shown();; }, this); diff --git a/src/slic3r/GUI/MultiMachine.cpp b/src/slic3r/GUI/MultiMachine.cpp index f5ffd1319f..c0e84f40e9 100644 --- a/src/slic3r/GUI/MultiMachine.cpp +++ b/src/slic3r/GUI/MultiMachine.cpp @@ -217,7 +217,7 @@ std::vector selected_machines(const std::vector& dev_i SortItem::SortItem() { - sort_map.emplace(std::make_pair(SortRule::SR_None, [this](const DeviceItem* d1, const DeviceItem* d2) { + sort_map.emplace(std::make_pair(SortRule::SR_None, [](const DeviceItem* d1, const DeviceItem* d2) { return d1->state_dev_name > d2->state_dev_name; })); sort_map.emplace(std::make_pair(SortRule::SR_DEV_NAME, [this](const DeviceItem* d1, const DeviceItem* d2) { diff --git a/src/slic3r/GUI/MultiMachineManagerPage.cpp b/src/slic3r/GUI/MultiMachineManagerPage.cpp index d6531cc8d4..792c23fb13 100644 --- a/src/slic3r/GUI/MultiMachineManagerPage.cpp +++ b/src/slic3r/GUI/MultiMachineManagerPage.cpp @@ -19,7 +19,7 @@ MultiMachineItem::MultiMachineItem(wxWindow* parent, MachineObject* obj) Bind(wxEVT_LEAVE_WINDOW, &MultiMachineItem::OnLeaveWindow, this); Bind(wxEVT_LEFT_DOWN, &MultiMachineItem::OnLeftDown, this); Bind(wxEVT_MOTION, &MultiMachineItem::OnMove, this); - Bind(EVT_MULTI_DEVICE_VIEW, [this, obj](auto& e) { + Bind(EVT_MULTI_DEVICE_VIEW, [obj](auto& e) { wxGetApp().mainframe->jump_to_monitor(obj->get_dev_id()); if (wxGetApp().mainframe->m_monitor->get_status_panel()->get_media_play_ctrl()) { wxGetApp().mainframe->m_monitor->get_status_panel()->get_media_play_ctrl()->jump_to_play(); diff --git a/src/slic3r/GUI/MultiMachinePage.cpp b/src/slic3r/GUI/MultiMachinePage.cpp index 88d03007b9..dd67e099a0 100644 --- a/src/slic3r/GUI/MultiMachinePage.cpp +++ b/src/slic3r/GUI/MultiMachinePage.cpp @@ -80,7 +80,7 @@ void MultiMachinePage::init_tabpanel() sizer_side_tools->Add(m_side_tools, 1, wxEXPAND, 0); m_tabpanel = new Tabbook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, sizer_side_tools, wxNB_LEFT | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME); m_tabpanel->SetBackgroundColour(wxColour("#FEFFFF")); - m_tabpanel->Bind(wxEVT_BOOKCTRL_PAGE_CHANGED, [this](wxBookCtrlEvent& e) {; }); + m_tabpanel->Bind(wxEVT_BOOKCTRL_PAGE_CHANGED, [](wxBookCtrlEvent& e) {; }); m_local_task_manager = new LocalTaskManagerPage(m_tabpanel); m_cloud_task_manager = new CloudTaskManagerPage(m_tabpanel); diff --git a/src/slic3r/GUI/MultiTaskManagerPage.cpp b/src/slic3r/GUI/MultiTaskManagerPage.cpp index bca2de8761..48a7fbe43e 100644 --- a/src/slic3r/GUI/MultiTaskManagerPage.cpp +++ b/src/slic3r/GUI/MultiTaskManagerPage.cpp @@ -783,7 +783,7 @@ void LocalTaskManagerPage::refresh_user_device(bool clear) mtitem->m_send_time = task_state_info->get_sent_time(); mtitem->state_local_task = task_state_info->state(); - task_state_info->set_state_changed_fn([this, mtitem](TaskState state, int percent) { + task_state_info->set_state_changed_fn([mtitem](TaskState state, int percent) { mtitem->state_local_task = state; if (state == TaskState::TS_SEND_COMPLETED) { diff --git a/src/slic3r/GUI/NetworkPluginDialog.cpp b/src/slic3r/GUI/NetworkPluginDialog.cpp index bc898d0d24..42e1fc5fc5 100644 --- a/src/slic3r/GUI/NetworkPluginDialog.cpp +++ b/src/slic3r/GUI/NetworkPluginDialog.cpp @@ -156,14 +156,14 @@ void NetworkPluginDownloadDialog::create_update_available_ui(const std::string& auto daa_chk = new CheckBox(this); daa_chk->SetValue(cfg->is_network_update_prompt_disabled()); - daa_chk->Bind(wxEVT_TOGGLEBUTTON, [this](wxCommandEvent& e){ + daa_chk->Bind(wxEVT_TOGGLEBUTTON, [](wxCommandEvent& e){ auto cfg = wxGetApp().app_config; cfg->set_network_update_prompt_disabled(e.IsChecked()); cfg->save(); }); auto daa_str = new Label(this, _L("Don't Ask Again")); - auto on_toggle = [this, daa_chk]() { + auto on_toggle = [daa_chk]() { daa_chk->SetValue(!daa_chk->GetValue()); wxCommandEvent evt(wxEVT_TOGGLEBUTTON, daa_chk->GetId()); evt.SetEventObject(daa_chk); diff --git a/src/slic3r/GUI/NetworkTestDialog.cpp b/src/slic3r/GUI/NetworkTestDialog.cpp index 78f395febc..53876d9f97 100644 --- a/src/slic3r/GUI/NetworkTestDialog.cpp +++ b/src/slic3r/GUI/NetworkTestDialog.cpp @@ -268,7 +268,7 @@ void NetworkTestDialog::start_test_url(TestJob job, wxString name, wxString url) int result = -1; http.timeout_max(10) - .on_complete([this, &result](std::string body, unsigned status) { + .on_complete([&result](std::string body, unsigned status) { try { if (status == 200) { result = 0; diff --git a/src/slic3r/GUI/Notebook.cpp b/src/slic3r/GUI/Notebook.cpp index 673508454a..67c1831e4d 100644 --- a/src/slic3r/GUI/Notebook.cpp +++ b/src/slic3r/GUI/Notebook.cpp @@ -56,7 +56,7 @@ ButtonsListCtrl::ButtonsListCtrl(wxWindow *parent, wxBoxSizer* side_tools) : // BBS: disable custom paint //this->Bind(wxEVT_PAINT, &ButtonsListCtrl::OnPaint, this); - Bind(wxEVT_SYS_COLOUR_CHANGED, [this](auto& e){ + Bind(wxEVT_SYS_COLOUR_CHANGED, [](auto& e){ }); } diff --git a/src/slic3r/GUI/OG_CustomCtrl.cpp b/src/slic3r/GUI/OG_CustomCtrl.cpp index 2ee94dbeeb..4fce046162 100644 --- a/src/slic3r/GUI/OG_CustomCtrl.cpp +++ b/src/slic3r/GUI/OG_CustomCtrl.cpp @@ -158,7 +158,7 @@ wxPoint OG_CustomCtrl::get_pos(const Line& line, Field* field_in/* = nullptr*/) ctrl_line.height = size.y; }; - auto add_buttons_width = [&h_pos, this] (int blinking_button_width) { + auto add_buttons_width = [&h_pos] (int blinking_button_width) { #ifndef DISABLE_BLINKING # ifndef DISABLE_UNDO_SYS h_pos += 3 * blinking_button_width; diff --git a/src/slic3r/GUI/ObjColorDialog.cpp b/src/slic3r/GUI/ObjColorDialog.cpp index 47f62aa168..d5a37fc9a7 100644 --- a/src/slic3r/GUI/ObjColorDialog.cpp +++ b/src/slic3r/GUI/ObjColorDialog.cpp @@ -254,7 +254,7 @@ ObjColorPanel::ObjColorPanel(wxWindow *parent, Slic3r::ObjDialogInOut &in_out, c m_color_cluster_num_by_user_ebox->Bind(wxEVT_TEXT_ENTER, on_apply_color_cluster_text_modify); m_color_cluster_num_by_user_ebox->Bind(wxEVT_SPINCTRL, on_apply_color_cluster_text_modify); - m_color_cluster_num_by_user_ebox->Bind(wxEVT_CHAR, [this](wxKeyEvent &e) { + m_color_cluster_num_by_user_ebox->Bind(wxEVT_CHAR, [](wxKeyEvent &e) { int keycode = e.GetKeyCode(); wxString input_char = wxString::Format("%c", keycode); long value; diff --git a/src/slic3r/GUI/ParamsPanel.cpp b/src/slic3r/GUI/ParamsPanel.cpp index 7d054d8a1b..a0834666ad 100644 --- a/src/slic3r/GUI/ParamsPanel.cpp +++ b/src/slic3r/GUI/ParamsPanel.cpp @@ -128,7 +128,7 @@ wxBoxSizer *TipsDialog::create_item_checkbox(wxString title, wxWindow *parent, w m_show_again = wxGetApp().app_config->has(param); checkbox->SetValue(m_show_again); - checkbox->Bind(wxEVT_TOGGLEBUTTON, [this, checkbox, param](wxCommandEvent &e) { + checkbox->Bind(wxEVT_TOGGLEBUTTON, [this, param](wxCommandEvent &e) { m_show_again = m_show_again ? false : true; e.Skip(); }); @@ -290,11 +290,11 @@ ParamsPanel::ParamsPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, c m_compare_btn = new ScalableButton(m_top_panel, wxID_ANY, "compare", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, true); m_compare_btn->SetToolTip(_L("Compare presets")); - m_compare_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent e) { wxGetApp().mainframe->diff_dialog.show(); })); + m_compare_btn->Bind(wxEVT_BUTTON, ([](wxCommandEvent e) { wxGetApp().mainframe->diff_dialog.show(); })); m_setting_btn = new ScalableButton(m_top_panel, wxID_ANY, "table", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, true); m_setting_btn->SetToolTip(_L("View all object's settings")); - m_setting_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &) { wxGetApp().plater()->PopupObjectTable(-1, -1, {0, 0}); }); + m_setting_btn->Bind(wxEVT_BUTTON, [](wxCommandEvent &) { wxGetApp().plater()->PopupObjectTable(-1, -1, {0, 0}); }); m_highlighter.set_timer_owner(this, 0); this->Bind(wxEVT_TIMER, [this](wxTimerEvent &) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 2b1a558fe9..067b1fcd04 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1340,7 +1340,7 @@ ExtruderGroup::ExtruderGroup(wxWindow * parent, int index, wxString const &title if (index >= 0) label_flow->SetMinSize({FromDIP(80), -1}); auto combo_flow = new ComboBox(this, wxID_ANY, wxString(""), wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY); combo_flow->GetDropDown().SetUseContentWidth(true); - combo_flow->Bind(wxEVT_COMBOBOX, [this, index, combo_flow](wxCommandEvent &evt) { + combo_flow->Bind(wxEVT_COMBOBOX, [index, combo_flow](wxCommandEvent &evt) { auto printer_tab = dynamic_cast(wxGetApp().get_tab(Preset::TYPE_PRINTER)); NozzleVolumeType volume_type = NozzleVolumeType(intptr_t(combo_flow->GetClientData(evt.GetInt()))); printer_tab->set_extruder_volume_type(index, volume_type); @@ -1400,7 +1400,7 @@ ExtruderGroup::ExtruderGroup(wxWindow * parent, int index, wxString const &title btn_up = new ScalableButton(this, wxID_ANY, "page_up", "", {FromDIP(14), FromDIP(14)}, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, false, 14); btn_up->SetBackgroundColour(*wxWHITE); - btn_up->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this, index](auto &evt) { + btn_up->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this](auto &evt) { if (page_cur > 0) --page_cur; update_ams(); @@ -1408,7 +1408,7 @@ ExtruderGroup::ExtruderGroup(wxWindow * parent, int index, wxString const &title btn_up->Hide(); btn_down = new ScalableButton(this, wxID_ANY, "page_down", "", {FromDIP(14), FromDIP(14)}, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, false, 14); btn_down->SetBackgroundColour(*wxWHITE); - btn_down->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this, index](auto &evt) { + btn_down->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this](auto &evt) { if (page_cur + 1 < page_num) ++page_cur; update_ams(); @@ -2025,7 +2025,7 @@ bool Sidebar::priv::sync_extruder_list(bool &only_external_material, bool is_man if (!this->plater) return false; - this->plater->update_objects_position_when_select_preset([&obj, machine_preset]() { + this->plater->update_objects_position_when_select_preset([machine_preset]() { Tab *printer_tab = GUI::wxGetApp().get_tab(Preset::Type::TYPE_PRINTER); printer_tab->select_preset(machine_preset->name); }); @@ -2170,7 +2170,7 @@ bool Sidebar::priv::sync_extruder_list(bool &only_external_material, bool is_man void Sidebar::priv::update_sync_status(const MachineObject *obj) { StateColor not_synced_colour(std::pair(wxColour("#009688"), StateColor::Normal)); - auto clear_all_sync_status = [this, ¬_synced_colour]() { + auto clear_all_sync_status = [this]() { panel_printer_preset->ShowBadge(false); panel_printer_bed->ShowBadge(false); panel_nozzle_dia->ShowBadge(false); // ORCA add support for nozzle sync @@ -2474,7 +2474,7 @@ Sidebar::Sidebar(Plater *parent) p->m_printer_icon = new ScalableButton(p->m_panel_printer_title, wxID_ANY, "printer"); p->m_text_printer_settings = new Label(p->m_panel_printer_title, _L("Printer"), LB_PROPAGATE_MOUSE_EVENT | wxST_ELLIPSIZE_END); - p->m_printer_icon->Bind(wxEVT_BUTTON, [this](wxCommandEvent& e) { + p->m_printer_icon->Bind(wxEVT_BUTTON, [](wxCommandEvent& e) { //auto wizard_t = new ConfigWizard(wxGetApp().mainframe); //wizard_t->run(ConfigWizard::RR_USER, ConfigWizard::SP_CUSTOM); }); @@ -2495,7 +2495,7 @@ Sidebar::Sidebar(Plater *parent) }); p->m_printer_setting = new ScalableButton(p->m_panel_printer_title, wxID_ANY, "settings"); - p->m_printer_setting->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { + p->m_printer_setting->Bind(wxEVT_BUTTON, [](wxCommandEvent &e) { // p->editing_filament = -1; // wxGetApp().params_dialog()->Popup(); // wxGetApp().get_tab(Preset::TYPE_FILAMENT)->restore_last_select_item(); @@ -2610,8 +2610,8 @@ Sidebar::Sidebar(Plater *parent) p->image_printer->SetBackgroundColour(bg_color); p->combo_printer->SetBackgroundColour(bg_color); // paints margins instead combo background }; - p->combo_printer->Bind(wxEVT_SET_FOCUS, [this, printer_focus_bg](auto& e) {printer_focus_bg(true ); e.Skip();}); - p->combo_printer->Bind(wxEVT_KILL_FOCUS, [this, printer_focus_bg](auto& e) {printer_focus_bg(false); e.Skip();}); + p->combo_printer->Bind(wxEVT_SET_FOCUS, [printer_focus_bg](auto& e) {printer_focus_bg(true ); e.Skip();}); + p->combo_printer->Bind(wxEVT_KILL_FOCUS, [printer_focus_bg](auto& e) {printer_focus_bg(false); e.Skip();}); /* ORCA This part moved to titlebar p->btn_connect_printer = new ScalableButton(p->panel_printer_preset, wxID_ANY, "monitor_signal_strong"); @@ -2688,8 +2688,8 @@ Sidebar::Sidebar(Plater *parent) p->label_nozzle_type->SetBackgroundColour(bg_color); p->combo_nozzle_dia->SetBackgroundColour(bg_color); // paints margins instead combo background }; - p->combo_nozzle_dia->Bind(wxEVT_SET_FOCUS, [this, nozzle_focus_bg](auto& e) {nozzle_focus_bg(true ); e.Skip();}); - p->combo_nozzle_dia->Bind(wxEVT_KILL_FOCUS, [this, nozzle_focus_bg](auto& e) {nozzle_focus_bg(false); e.Skip();}); + p->combo_nozzle_dia->Bind(wxEVT_SET_FOCUS, [nozzle_focus_bg](auto& e) {nozzle_focus_bg(true ); e.Skip();}); + p->combo_nozzle_dia->Bind(wxEVT_KILL_FOCUS, [nozzle_focus_bg](auto& e) {nozzle_focus_bg(false); e.Skip();}); p->label_nozzle_type = new Label(p->panel_nozzle_dia, "Brass", LB_PROPAGATE_MOUSE_EVENT | wxST_ELLIPSIZE_END | wxALIGN_CENTRE_HORIZONTAL); p->label_nozzle_type->SetFont(Label::Body_10); @@ -2763,8 +2763,8 @@ Sidebar::Sidebar(Plater *parent) p->image_printer_bed->SetBackgroundColour(bg_color); p->combo_printer_bed->SetBackgroundColour(bg_color); // paints margins instead combo background }; - p->combo_printer_bed->Bind(wxEVT_SET_FOCUS, [this, bed_focus_bg](auto& e) {bed_focus_bg(true ); e.Skip();}); - p->combo_printer_bed->Bind(wxEVT_KILL_FOCUS, [this, bed_focus_bg](auto& e) {bed_focus_bg(false); e.Skip();}); + p->combo_printer_bed->Bind(wxEVT_SET_FOCUS, [bed_focus_bg](auto& e) {bed_focus_bg(true ); e.Skip();}); + p->combo_printer_bed->Bind(wxEVT_KILL_FOCUS, [bed_focus_bg](auto& e) {bed_focus_bg(false); e.Skip();}); // highlight border on hover auto printer_bed_hovered = std::make_shared>(); @@ -2978,7 +2978,7 @@ Sidebar::Sidebar(Plater *parent) ScalableButton* add_btn = new ScalableButton(p->m_panel_filament_title, wxID_ANY, "add_filament"); add_btn->SetToolTip(_L("Add one filament")); - add_btn->Bind(wxEVT_BUTTON, [this, scrolled_sizer](wxCommandEvent& e){ + add_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& e){ add_filament(); update_filaments_counter(); }); @@ -2988,7 +2988,7 @@ Sidebar::Sidebar(Plater *parent) ScalableButton* del_btn = new ScalableButton(p->m_panel_filament_title, wxID_ANY, "delete_filament"); del_btn->SetToolTip(_L("Remove last filament")); - del_btn->Bind(wxEVT_BUTTON, [this, scrolled_sizer](wxCommandEvent &e) { + del_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { delete_filament(); update_filaments_counter(); }); @@ -3002,7 +3002,7 @@ Sidebar::Sidebar(Plater *parent) ams_btn = new ScalableButton(p->m_panel_filament_title, wxID_ANY, "ams_fila_sync", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, false, 16); // ORCA match icon size with other icons as 16x16 ams_btn->SetToolTip(_L("Synchronize filament list from AMS")); - ams_btn->Bind(wxEVT_BUTTON, [this, scrolled_sizer](wxCommandEvent &e) { + ams_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { sync_ams_list(); }); @@ -3682,7 +3682,7 @@ void Sidebar::update_presets(Preset::Type preset_type) extruder.combo_flow->SetSelection(select); }; - auto update_extruder_diameter = [&diameters, &diameter, &nozzle_diameter](int extruder_index,ExtruderGroup & extruder) { + auto update_extruder_diameter = [&diameters, &nozzle_diameter](int extruder_index,ExtruderGroup & extruder) { extruder.combo_diameter->Clear(); int select = -1; // ORCA get the actual nozzle diameter from printer config @@ -7497,7 +7497,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) // Keep tracking the current sidebar size, by storing it using `best_size`, which will be stored // in the config and re-applied when the app is opened again. - this->sidebar->Bind(wxEVT_IDLE, [&sidebar, this](wxIdleEvent& e) { + this->sidebar->Bind(wxEVT_IDLE, [&sidebar](wxIdleEvent& e) { if (sidebar.IsShown() && sidebar.IsDocked() && sidebar.rect.GetWidth() > 0) { sidebar.BestSize(sidebar.rect.GetWidth(), sidebar.best_size.GetHeight()); } @@ -7796,8 +7796,8 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) wxGetApp().removable_drive_manager()->init(this->q); #ifdef _WIN32 //Trigger enumeration of removable media on Win32 notification. - this->q->Bind(EVT_VOLUME_ATTACHED, [this](VolumeAttachedEvent &evt) { wxGetApp().removable_drive_manager()->volumes_changed(); }); - this->q->Bind(EVT_VOLUME_DETACHED, [this](VolumeDetachedEvent &evt) { wxGetApp().removable_drive_manager()->volumes_changed(); }); + this->q->Bind(EVT_VOLUME_ATTACHED, [](VolumeAttachedEvent &evt) { wxGetApp().removable_drive_manager()->volumes_changed(); }); + this->q->Bind(EVT_VOLUME_DETACHED, [](VolumeDetachedEvent &evt) { wxGetApp().removable_drive_manager()->volumes_changed(); }); #endif /* _WIN32 */ } @@ -8354,7 +8354,6 @@ std::vector Plater::priv::load_files(const std::vector& input_ const float LOAD_MODEL_RATIO = 0.9; for (size_t i = 0; i < input_files.size(); ++i) { - int file_percent = 0; #ifdef _WIN32 auto path = input_files[i]; @@ -8403,7 +8402,7 @@ std::vector Plater::priv::load_files(const std::vector& input_ q->skip_thumbnail_invalid = true; model = Slic3r::Model::read_from_archive(path.string(), &config_loaded, &config_substitutions, en_3mf_file_type, strategy, &plate_data, &project_presets, &file_version, - [this, &dlg, real_filename, &progress_percent, &file_percent, stage_percent, INPUT_FILES_RATIO, total_files, i, + [&dlg, real_filename, &progress_percent, stage_percent, INPUT_FILES_RATIO, total_files, i, &is_user_cancel](int import_stage, int current, int total, bool &cancel) { bool cont = true; float percent_float = (100.0f * (float)i / (float)total_files) + INPUT_FILES_RATIO * ((float)stage_percent[import_stage] + (float)current * (float)(stage_percent[import_stage + 1] - stage_percent[import_stage]) /(float) total) / (float)total_files; @@ -8986,7 +8985,7 @@ std::vector Plater::priv::load_files(const std::vector& input_ Semver file_version; //ObjImportColorFn obj_color_fun=nullptr; - auto obj_color_fun = [this, &path](ObjDialogInOut &in_out) { + auto obj_color_fun = [&path](ObjDialogInOut &in_out) { if (!boost::iends_with(path.string(), ".obj")) { return; } const std::vector extruder_colours = wxGetApp().plater()->get_extruder_colors_from_plater_config(); @@ -9003,7 +9002,7 @@ std::vector Plater::priv::load_files(const std::vector& input_ if (angle <= 0) angle = 0.5; bool split_compound = wxGetApp().app_config->get_bool("is_split_compound"); model = Slic3r::Model:: read_from_step(path.string(), strategy, - [this, &dlg, real_filename, &progress_percent, &file_percent, step_percent, INPUT_FILES_RATIO, total_files, i](int load_stage, int current, int total, bool &cancel) + [&dlg, real_filename, &progress_percent, step_percent, INPUT_FILES_RATIO, total_files, i](int load_stage, int current, int total, bool &cancel) { bool cont = true; float percent_float = (100.0f * (float)i / (float)total_files) + INPUT_FILES_RATIO * ((float)step_percent[load_stage] + (float)current * (float)(step_percent[load_stage + 1] - step_percent[load_stage]) / (float)total) / (float)total_files; @@ -9027,7 +9026,7 @@ std::vector Plater::priv::load_files(const std::vector& input_ } } }, - [this, &path, &is_user_cancel, &linear, &angle, &split_compound](Slic3r::Step& file, double& linear_value, double& angle_value, bool& is_split)-> int { + [&is_user_cancel, &linear, &angle, &split_compound](Slic3r::Step& file, double& linear_value, double& angle_value, bool& is_split)-> int { if (wxGetApp().app_config->get_bool("enable_step_mesh_setting")) { StepMeshDialog mesh_dlg(nullptr, file, linear, angle); if (mesh_dlg.ShowModal() == wxID_OK) { @@ -9048,7 +9047,7 @@ std::vector Plater::priv::load_files(const std::vector& input_ }else { model = Slic3r::Model:: read_from_file( path.string(), nullptr, nullptr, strategy, &plate_data, &project_presets, &is_xxx, &file_version, nullptr, - [this, &dlg, real_filename, &progress_percent, &file_percent, INPUT_FILES_RATIO, total_files, i, &designer_model_id, &designer_country_code](int current, int total, bool &cancel, std::string &mode_id, std::string &code) + [&dlg, real_filename, &progress_percent, INPUT_FILES_RATIO, total_files, i, &designer_model_id, &designer_country_code](int current, int total, bool &cancel, std::string &mode_id, std::string &code) { designer_model_id = mode_id; designer_country_code = code; @@ -11294,7 +11293,7 @@ void Plater::priv::reload_from_disk() // load one file at a time for (size_t i = 0; i < input_paths.size(); ++i) { const auto& path = input_paths[i].string(); - auto obj_color_fun = [this, &path](ObjDialogInOut &in_out) { + auto obj_color_fun = [&path](ObjDialogInOut &in_out) { if (!boost::iends_with(path, ".obj")) { return; } const std::vector extruder_colours = wxGetApp().plater()->get_extruder_colors_from_plater_config(); ObjColorDialog color_dlg(nullptr, in_out, extruder_colours, Sidebar::should_show_SEMM_buttons()); @@ -15265,7 +15264,7 @@ void Plater::import_model_id(wxString download_info) p->project.reset(); /* prepare project and profile */ - boost::thread import_thread = Slic3r::create_thread([&percent, &cont, &cancel, &retry_count, max_retries, &msg, &target_path, &download_ok, download_url, &filename] { + boost::thread import_thread = Slic3r::create_thread([&percent, &cont, &retry_count, &msg, &target_path, &download_ok, download_url, &filename] { // Orca: NetworkAgent is not needed and only prevents this from running // NetworkAgent* m_agent = Slic3r::GUI::wxGetApp().getAgent(); @@ -15372,7 +15371,7 @@ void Plater::import_model_id(wxString download_info) msg = wxString::Format(_L("Project downloaded %d%%"), percent); } }) - .on_error([&msg, &cont, &retry_count, max_retries](std::string body, std::string error, unsigned http_status) { + .on_error([&msg, &cont, &retry_count](std::string body, std::string error, unsigned http_status) { (void)body; BOOST_LOG_TRIVIAL(error) << format("Error getting: `%1%`: HTTP %2%, %3%", body, diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index 8f3ac17f7c..355c4a26a8 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -519,7 +519,7 @@ wxBoxSizer *PreferencesDialog::create_item_language_combobox(wxString title, wxS } } - auto check = [this](bool yes_or_no) { + auto check = [](bool yes_or_no) { // if (yes_or_no) // return true; int act_btns = ActionButtons::SAVE; @@ -1200,7 +1200,7 @@ wxBoxSizer* PreferencesDialog::create_item_button(wxString title, wxString title m_button_download->SetStyle(title2 == _L("Clear") ? ButtonStyle::Alert : ButtonStyle::Regular, ButtonType::Parameter); m_button_download->SetToolTip(tooltip2.IsEmpty() ? tooltip : tooltip2); // use label tooltip if button tooltip empty - m_button_download->Bind(wxEVT_BUTTON, [this, onclick](auto &e) { onclick(); }); + m_button_download->Bind(wxEVT_BUTTON, [onclick](auto &e) { onclick(); }); m_sizer->Add(m_button_download, 0, wxALIGN_CENTER_VERTICAL); @@ -1490,7 +1490,7 @@ void PreferencesDialog::create() m_sizer_body = new wxBoxSizer(wxVERTICAL); m_pref_tabs = new TabCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_NO_BUTTONS | wxTR_HIDE_ROOT | wxTR_SINGLE | wxTR_NO_LINES | wxBORDER_NONE | wxWANTS_CHARS | wxTR_FULL_ROW_HIGHLIGHT); - m_pref_tabs->Bind(wxEVT_RIGHT_DOWN, [this](auto &e) {}); // disable right select + m_pref_tabs->Bind(wxEVT_RIGHT_DOWN, [](auto &e) {}); // disable right select m_pref_tabs->SetFont(Label::Body_14); create_items(); diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp index f78af21a99..837f4ebe0c 100644 --- a/src/slic3r/GUI/PresetComboBoxes.cpp +++ b/src/slic3r/GUI/PresetComboBoxes.cpp @@ -1653,7 +1653,7 @@ void TabPresetComboBox::OnSelect(wxCommandEvent &evt) default: break; } if (sp != ConfigWizard::SP_WELCOME) { - wxTheApp->CallAfter([this, sp]() { + wxTheApp->CallAfter([sp]() { run_wizard(sp); }); } @@ -1949,7 +1949,7 @@ GUI::CalibrateFilamentComboBox::CalibrateFilamentComboBox(wxWindow *parent) { clr_picker->SetBackgroundColour(StateColor::darkModeColorFor(*wxWHITE)); clr_picker->SetToolTip(""); - clr_picker->Bind(wxEVT_BUTTON, [this](wxCommandEvent& e) {}); + clr_picker->Bind(wxEVT_BUTTON, [](wxCommandEvent& e) {}); } GUI::CalibrateFilamentComboBox::~CalibrateFilamentComboBox() diff --git a/src/slic3r/GUI/PrintHostDialogs.cpp b/src/slic3r/GUI/PrintHostDialogs.cpp index 669468d852..2b4d212d0f 100644 --- a/src/slic3r/GUI/PrintHostDialogs.cpp +++ b/src/slic3r/GUI/PrintHostDialogs.cpp @@ -2062,7 +2062,7 @@ void CrealityPrintHostSendDialog::init() } for (auto* c : m_slot_combos) { - c->Bind(wxEVT_COMBOBOX, [this, ext_slot_idx](wxCommandEvent& e) { + c->Bind(wxEVT_COMBOBOX, [this](wxCommandEvent& e) { int sel = e.GetSelection(); if (sel >= 0 && sel < (int)m_printer_slots.size() && m_printer_slots[sel].box_id == 0) { diff --git a/src/slic3r/GUI/Printer/PrinterFileSystem.cpp b/src/slic3r/GUI/Printer/PrinterFileSystem.cpp index 0b280fe923..8ec6909c8c 100644 --- a/src/slic3r/GUI/Printer/PrinterFileSystem.cpp +++ b/src/slic3r/GUI/Printer/PrinterFileSystem.cpp @@ -164,7 +164,7 @@ void PrinterFileSystem::ListAllFiles() req["storage"] = m_file_storage; req["api_version"] = 2; req["notify"] = "DETAIL"; - SendRequest(LIST_INFO, req, [this, type = m_file_type](json const& resp, FileList & list, auto) -> int { + SendRequest(LIST_INFO, req, [type = m_file_type](json const& resp, FileList & list, auto) -> int { json files = resp["file_lists"]; for (auto& f : files) { std::string name = f["name"]; @@ -1230,7 +1230,7 @@ boost::uint32_t PrinterFileSystem::RequestMediaAbility(int api_version) req["api_version"] = api_version; return SendRequest( - REQUEST_MEDIA_ABILITY, req, [this](const json &resp, MediaAbilityList &list, auto) -> int { + REQUEST_MEDIA_ABILITY, req, [](const json &resp, MediaAbilityList &list, auto) -> int { json abliity_list = resp["storage"]; list = abliity_list.get(); return 0; diff --git a/src/slic3r/GUI/PrivacyUpdateDialog.cpp b/src/slic3r/GUI/PrivacyUpdateDialog.cpp index ef4dac9b13..92d6d6c8c7 100644 --- a/src/slic3r/GUI/PrivacyUpdateDialog.cpp +++ b/src/slic3r/GUI/PrivacyUpdateDialog.cpp @@ -97,7 +97,7 @@ PrivacyUpdateDialog::PrivacyUpdateDialog(wxWindow* parent, wxWindowID id, const this->on_hide(); }); - Bind(wxEVT_CLOSE_WINDOW, [this](wxCloseEvent& e) {e.Veto(); }); + Bind(wxEVT_CLOSE_WINDOW, [](wxCloseEvent& e) {e.Veto(); }); if (btn_style != CONFIRM_AND_CANCEL) m_button_cancel->Hide(); diff --git a/src/slic3r/GUI/ReleaseNote.cpp b/src/slic3r/GUI/ReleaseNote.cpp index 7b2d091176..029310faf9 100644 --- a/src/slic3r/GUI/ReleaseNote.cpp +++ b/src/slic3r/GUI/ReleaseNote.cpp @@ -1250,7 +1250,7 @@ void ConfirmBeforeSendDialog::update_text(std::vector tex else { label_item = new Label(m_vebview_release_note, text.text + " " + _L("Please refer to Wiki before use->"), LB_AUTO_WRAP); - label_item->Bind(wxEVT_LEFT_DOWN, [this, text](wxMouseEvent& e) { wxLaunchDefaultBrowser(text.wiki_url);}); + label_item->Bind(wxEVT_LEFT_DOWN, [text](wxMouseEvent& e) { wxLaunchDefaultBrowser(text.wiki_url);}); label_item->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) { SetCursor(wxCURSOR_HAND); }); label_item->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) { SetCursor(wxCURSOR_ARROW); }); } diff --git a/src/slic3r/GUI/SavePresetDialog.cpp b/src/slic3r/GUI/SavePresetDialog.cpp index 0b33e48ec4..b3f34a8cb9 100644 --- a/src/slic3r/GUI/SavePresetDialog.cpp +++ b/src/slic3r/GUI/SavePresetDialog.cpp @@ -153,7 +153,7 @@ SavePresetDialog::Item::Item(Preset::Type type, const std::string &suffix, wxBox detach_label->SetForegroundColour(wxColour("#363636")); - auto on_toggle = [this, detach_checkbox]() { + auto on_toggle = [detach_checkbox]() { detach_checkbox->SetValue(!detach_checkbox->GetValue()); wxCommandEvent ev(wxEVT_TOGGLEBUTTON, detach_checkbox->GetId()); ev.SetEventObject(detach_checkbox); diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index ac56e35ac3..199de9236e 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -3428,7 +3428,7 @@ void SelectMachineDialog::show_timelapse_storage_dialog(MachineObject* obj) if (show_cleanup_btn) { auto* btn_cleanup = new Button(&dlg, _L("Clean Up")); - btn_cleanup->Bind(wxEVT_BUTTON, [&dlg, ID_CLEANUP](wxCommandEvent&) { dlg.EndModal(ID_CLEANUP); }); + btn_cleanup->Bind(wxEVT_BUTTON, [&dlg](wxCommandEvent&) { dlg.EndModal(ID_CLEANUP); }); btn_sizer->Add(btn_cleanup, 0, wxEXPAND); } @@ -5497,7 +5497,7 @@ void SelectMachineDialog::reset_and_sync_ams_list() first_enabled_id = extruder; } - item->Bind(wxEVT_LEFT_UP, [this, item, materials, extruder](wxMouseEvent &e) {}); + item->Bind(wxEVT_LEFT_UP, [materials](wxMouseEvent &e) {}); item->Bind(wxEVT_LEFT_DOWN, [this, item, materials, extruder](wxMouseEvent &e) { if (!item->m_enable) {return;} if (!m_check_flag || m_print_status == PrintDialogStatus::PrintStatusUnsupportedPrinter) { return; } /*STUDIO-11301*/ @@ -6128,8 +6128,8 @@ void SelectMachineDialog::set_default_from_sdcard() first_enabled_id = fo.id; } - item->Bind(wxEVT_LEFT_UP, [this, item, materials](wxMouseEvent& e) {}); - item->Bind(wxEVT_LEFT_DOWN, [this, obj_, item, materials, diameters_count, fo](wxMouseEvent& e) { + item->Bind(wxEVT_LEFT_UP, [materials](wxMouseEvent& e) {}); + item->Bind(wxEVT_LEFT_DOWN, [this, obj_, item, materials, fo](wxMouseEvent& e) { if (!item->m_enable) {return;} if (!m_check_flag || m_print_status == PrintDialogStatus::PrintStatusUnsupportedPrinter) { return; } /*STUDIO-11301*/ diff --git a/src/slic3r/GUI/SelectMachinePop.cpp b/src/slic3r/GUI/SelectMachinePop.cpp index df0a566917..9b34e74f23 100644 --- a/src/slic3r/GUI/SelectMachinePop.cpp +++ b/src/slic3r/GUI/SelectMachinePop.cpp @@ -567,7 +567,7 @@ void SelectMachinePopup::update_other_devices() } } - op->Bind(EVT_CONNECT_LAN_PRINT, [this, mobj](wxCommandEvent &e) { + op->Bind(EVT_CONNECT_LAN_PRINT, [mobj](wxCommandEvent &e) { if (mobj) { if (mobj->is_lan_mode_printer()) { ConnectPrinterDialog dlg(wxGetApp().mainframe, wxID_ANY, _L("Input access code")); @@ -579,7 +579,7 @@ void SelectMachinePopup::update_other_devices() } }); - op->Bind(EVT_BIND_MACHINE, [this, mobj](wxCommandEvent &e) { + op->Bind(EVT_BIND_MACHINE, [mobj](wxCommandEvent &e) { BindMachineDialog dlg; dlg.update_machine_info(mobj); int dlg_result = wxID_CANCEL; @@ -700,7 +700,7 @@ void SelectMachinePopup::update_user_devices() op->set_printer_state(PrinterState::LOCK); } } - op->Bind(EVT_UNBIND_MACHINE, [this, dev, mobj](wxCommandEvent& e) { + op->Bind(EVT_UNBIND_MACHINE, [dev, mobj](wxCommandEvent& e) { dev->set_selected_machine(""); if (mobj) { AppConfig* config = wxGetApp().app_config; @@ -720,7 +720,7 @@ void SelectMachinePopup::update_user_devices() } else { op->show_printer_bind(true, PrinterBindState::ALLOW_UNBIND); - op->Bind(EVT_UNBIND_MACHINE, [this, mobj, dev](wxCommandEvent& e) { + op->Bind(EVT_UNBIND_MACHINE, [mobj, dev](wxCommandEvent& e) { // show_unbind_dialog UnBindMachineDialog dlg; dlg.update_machine_info(mobj); @@ -747,7 +747,7 @@ void SelectMachinePopup::update_user_devices() } } - op->Bind(EVT_CONNECT_LAN_PRINT, [this, mobj](wxCommandEvent &e) { + op->Bind(EVT_CONNECT_LAN_PRINT, [mobj](wxCommandEvent &e) { if (mobj) { if (mobj->is_lan_mode_printer()) { ConnectPrinterDialog dlg(wxGetApp().mainframe, wxID_ANY, _L("Input access code")); @@ -759,7 +759,7 @@ void SelectMachinePopup::update_user_devices() } }); - op->Bind(EVT_EDIT_PRINT_NAME, [this, mobj](wxCommandEvent &e) { + op->Bind(EVT_EDIT_PRINT_NAME, [mobj](wxCommandEvent &e) { EditDevNameDialog dlg; dlg.set_machine_obj(mobj); dlg.ShowModal(); diff --git a/src/slic3r/GUI/SendMultiMachinePage.cpp b/src/slic3r/GUI/SendMultiMachinePage.cpp index 7b7c42922f..3a52caec3f 100644 --- a/src/slic3r/GUI/SendMultiMachinePage.cpp +++ b/src/slic3r/GUI/SendMultiMachinePage.cpp @@ -1468,7 +1468,7 @@ void SendMultiMachinePage::sync_ams_list() item->set_ams_info(wxColour("#CECECE"), "Ext", 0, std::vector()); m_ams_list_sizer->Add(item, 0, wxALL, FromDIP(4)); - item->Bind(wxEVT_LEFT_UP, [this, item, materials, extruder](wxMouseEvent& e) {}); + item->Bind(wxEVT_LEFT_UP, [materials](wxMouseEvent& e) {}); item->Bind(wxEVT_LEFT_DOWN, [this, item, materials, extruder](wxMouseEvent& e) { MaterialHash::iterator iter = m_material_list.begin(); while (iter != m_material_list.end()) { diff --git a/src/slic3r/GUI/SkipPartCanvas.cpp b/src/slic3r/GUI/SkipPartCanvas.cpp index 5e01b8140f..7b7db213b1 100644 --- a/src/slic3r/GUI/SkipPartCanvas.cpp +++ b/src/slic3r/GUI/SkipPartCanvas.cpp @@ -287,7 +287,7 @@ void SkipPartCanvas::Render() glDisable(GL_CULL_FACE); glEnable(GL_STENCIL_TEST); - auto draw_shape = [this, border_w](const int stencil, const PartState part_type, const ColorRGB& rgb) { + auto draw_shape = [this](const int stencil, const PartState part_type, const ColorRGB& rgb) { glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glStencilFunc(GL_ALWAYS, stencil, 0xFF); glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); @@ -335,7 +335,7 @@ void SkipPartCanvas::Render() // stencil3 => skipped draw_shape(skipped_stencil, psSkipped, ColorRGB{95 / 255.f, 95 / 255.f, 95 / 255.f}); - auto draw_mask = [this, view_rect, border_w, w, h](const int stencil, const PartState part_type, + auto draw_mask = [this, view_rect](const int stencil, const PartState part_type, const ColorRGB& background, const ColorRGB& line, const ColorRGB& bound) { glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glStencilFunc(GL_EQUAL, stencil, 0xFF); diff --git a/src/slic3r/GUI/SliceInfoPanel.cpp b/src/slic3r/GUI/SliceInfoPanel.cpp index 37a3ba698d..a7e436c0ff 100644 --- a/src/slic3r/GUI/SliceInfoPanel.cpp +++ b/src/slic3r/GUI/SliceInfoPanel.cpp @@ -115,7 +115,7 @@ SliceInfoPopup::SliceInfoPopup(wxWindow *parent, wxBitmap bmp, BBLSliceInfo *inf f_sizer->Add(f_type, 0, wxEXPAND | wxALL, FromDIP(5)); f_sizer->Add(f_used_g, 0, wxEXPAND | wxALL, FromDIP(5)); grid_sizer->Add(f_sizer, 0, wxEXPAND, 0); - f_type->Bind(wxEVT_LEFT_DOWN, [this](auto &e) {}); + f_type->Bind(wxEVT_LEFT_DOWN, [](auto &e) {}); } } topSizer->Add(grid_sizer, 0, wxALL, FromDIP(5)); diff --git a/src/slic3r/GUI/StepMeshDialog.cpp b/src/slic3r/GUI/StepMeshDialog.cpp index b1a8e2319a..c6131b7bfa 100644 --- a/src/slic3r/GUI/StepMeshDialog.cpp +++ b/src/slic3r/GUI/StepMeshDialog.cpp @@ -167,7 +167,7 @@ StepMeshDialog::StepMeshDialog(wxWindow* parent, Slic3r::Step& file, double line e.Skip(); })); // textctrl bind slider - linear_input->Bind(wxEVT_TEXT, ([this, linear_slider, linear_input](wxCommandEvent& e) { + linear_input->Bind(wxEVT_TEXT, ([linear_slider, linear_input](wxCommandEvent& e) { double slider_value_long; int slider_value; wxString value = linear_input->GetTextCtrl()->GetValue(); @@ -222,7 +222,7 @@ StepMeshDialog::StepMeshDialog(wxWindow* parent, Slic3r::Step& file, double line e.Skip(); })); // textctrl bind slider - angle_input->Bind(wxEVT_TEXT, ([this, angle_slider, angle_input](wxCommandEvent& e) { + angle_input->Bind(wxEVT_TEXT, ([angle_slider, angle_input](wxCommandEvent& e) { double slider_value_long; int slider_value; wxString value = angle_input->GetTextCtrl()->GetValue(); diff --git a/src/slic3r/GUI/SyncAmsInfoDialog.cpp b/src/slic3r/GUI/SyncAmsInfoDialog.cpp index 9515ecc116..7ae48008c8 100644 --- a/src/slic3r/GUI/SyncAmsInfoDialog.cpp +++ b/src/slic3r/GUI/SyncAmsInfoDialog.cpp @@ -1113,7 +1113,7 @@ void SyncAmsInfoDialog::init_bind() e.Skip(); }); - Bind(EVT_CONNECT_LAN_MODE_PRINT, [this](wxCommandEvent &e) { + Bind(EVT_CONNECT_LAN_MODE_PRINT, [](wxCommandEvent &e) { if (e.GetInt() == 0) { DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager(); if (!dev) return; @@ -2644,7 +2644,7 @@ void SyncAmsInfoDialog::reset_and_sync_ams_list() item_index++; contronal_index++; - item->Bind(wxEVT_LEFT_UP, [this, item, materials, extruder](wxMouseEvent &e) {}); + item->Bind(wxEVT_LEFT_UP, [materials](wxMouseEvent &e) {}); item->Bind(wxEVT_LEFT_DOWN, [this, item, materials, extruder, item_index_str](wxMouseEvent &e) { MaterialHash::iterator iter = m_materialList.begin(); while (iter != m_materialList.end()) { diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 0eb5c9281d..d65d7f68bd 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -459,7 +459,7 @@ void Tab::create_preset_tab() // tree m_tabctrl = new TabCtrl(panel, wxID_ANY, wxDefaultPosition, wxSize(20 * m_em_unit, -1), wxTR_NO_BUTTONS | wxTR_HIDE_ROOT | wxTR_SINGLE | wxTR_NO_LINES | wxBORDER_NONE | wxWANTS_CHARS | wxTR_FULL_ROW_HIGHLIGHT); - m_tabctrl->Bind(wxEVT_RIGHT_DOWN, [this](auto &e) {}); // disable right select + m_tabctrl->Bind(wxEVT_RIGHT_DOWN, [](auto &e) {}); // disable right select m_tabctrl->SetFont(Label::Body_14); //m_left_sizer->Add(m_tabctrl, 1, wxEXPAND); const int img_sz = int(32 * scale_factor + 0.5f); @@ -6075,7 +6075,7 @@ void TabPrinter::toggle_options() auto nozzle_volumes = m_preset_bundle->project_config.option("nozzle_volume_type"); auto extruders = m_config->option("extruder_type"); auto get_index_for_extruder = - [this, &extruders, &nozzle_volumes](int extruder_id, int stride = 1) { + [this, &extruders](int extruder_id, int stride = 1) { return m_config->get_index_for_extruder(extruder_id + 1, "printer_extruder_id", ExtruderType(extruders->values[extruder_id]), get_actual_nozzle_volume_type(extruder_id), "printer_extruder_variant", stride); }; @@ -7713,18 +7713,18 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep this->update_changed_ui(); }; - deps.checkbox_title->Bind(wxEVT_LEFT_DOWN,([this, &deps, on_toggle](wxMouseEvent& e) { + deps.checkbox_title->Bind(wxEVT_LEFT_DOWN,([&deps, on_toggle](wxMouseEvent& e) { if (e.GetEventType() == wxEVT_LEFT_DCLICK) return; on_toggle(!deps.checkbox->GetValue()); e.Skip(); })); - deps.checkbox_title->Bind(wxEVT_LEFT_DCLICK,([this, &deps, on_toggle](wxMouseEvent& e) { + deps.checkbox_title->Bind(wxEVT_LEFT_DCLICK,([&deps, on_toggle](wxMouseEvent& e) { on_toggle(!deps.checkbox->GetValue()); e.Skip(); })); - deps.checkbox->Bind(wxEVT_TOGGLEBUTTON, ([this, on_toggle](wxCommandEvent& e) { + deps.checkbox->Bind(wxEVT_TOGGLEBUTTON, ([on_toggle](wxCommandEvent& e) { on_toggle(e.IsChecked()); e.Skip(); }), deps.checkbox->GetId()); @@ -8306,7 +8306,7 @@ void Tab::switch_excluder(int extruder_id, bool reload) return; } auto get_index_for_extruder = - [this, &extruders, &nozzle_volumes, variant_keys = extruder_variant_keys[m_type >= Preset::TYPE_COUNT ? Preset::TYPE_PRINT : m_type]](int extruder_id, int stride = 1) { + [this, &extruders, variant_keys = extruder_variant_keys[m_type >= Preset::TYPE_COUNT ? Preset::TYPE_PRINT : m_type]](int extruder_id, int stride = 1) { return m_config->get_index_for_extruder(extruder_id + 1, variant_keys.first, ExtruderType(extruders->values[extruder_id]), get_actual_nozzle_volume_type(extruder_id), variant_keys.second, stride); }; @@ -8363,7 +8363,7 @@ void Tab::sync_excluder() auto nozzle_volumes = m_preset_bundle->project_config.option("nozzle_volume_type"); auto extruders = printer_preset.config.option("extruder_type"); auto get_index_for_extruder = - [this, &extruders, &nozzle_volumes, variant_keys = extruder_variant_keys[m_type >= Preset::TYPE_COUNT ? Preset::TYPE_PRINT : m_type]](int extruder_id, NozzleVolumeType nozzle_type) { + [this, &extruders, variant_keys = extruder_variant_keys[m_type >= Preset::TYPE_COUNT ? Preset::TYPE_PRINT : m_type]](int extruder_id, NozzleVolumeType nozzle_type) { return m_config->get_index_for_extruder(extruder_id + 1, variant_keys.first, ExtruderType(extruders->values[extruder_id]), nozzle_type, variant_keys.second); }; diff --git a/src/slic3r/GUI/TroubleshootDialog.cpp b/src/slic3r/GUI/TroubleshootDialog.cpp index b0a8f71930..c1dee7ca5c 100644 --- a/src/slic3r/GUI/TroubleshootDialog.cpp +++ b/src/slic3r/GUI/TroubleshootDialog.cpp @@ -71,7 +71,7 @@ wxFlexGridSizer* TroubleshootDialog::create_item_loaded_profiles() auto gen_stats = GetProfilesOverview(); gen_stats = ""; // clear mem. not needed after generating m_..._act, m_..._usr variables - auto add_sizer = [this, g_sizer, create_label](PresetCollection* col, wxString label, int in_use, int user) { + auto add_sizer = [g_sizer, create_label](PresetCollection* col, wxString label, int in_use, int user) { int sys = 0; for (auto it = col->begin(); it != col->end(); it++) { if (it->is_system) @@ -178,7 +178,7 @@ TroubleshootDialog::TroubleshootDialog() return wxTheClipboard->SetData(new wxTextDataObject(GetSysInfoAll())); }); - sys_less_btn->Bind(wxEVT_BUTTON, [this, sys_panel, sys_less_btn, sys_info_lines, sys_copy_btn](wxCommandEvent &e) { + sys_less_btn->Bind(wxEVT_BUTTON, [this, sys_panel, sys_less_btn, sys_info_lines](wxCommandEvent &e) { m_sys_panel_mode = !m_sys_panel_mode; sys_panel->SetText(sys_info_lines(m_sys_panel_mode)); sys_less_btn->SetLabel(m_sys_panel_mode ? _L("Hide") : _L("Show")); diff --git a/src/slic3r/GUI/WebGuideDialog.cpp b/src/slic3r/GUI/WebGuideDialog.cpp index 6b58fffead..ae259f23d1 100644 --- a/src/slic3r/GUI/WebGuideDialog.cpp +++ b/src/slic3r/GUI/WebGuideDialog.cpp @@ -588,7 +588,7 @@ void GuideFrame::OnScriptMessage(wxWebViewEvent &evt) else if (strCmd == "user_guide_create_printer") { this->EndModal(wxID_CANCEL); this->Close(); - GUI::wxGetApp().CallAfter([this] {GUI::wxGetApp().sidebar().create_printer_preset();}); + GUI::wxGetApp().CallAfter([] {GUI::wxGetApp().sidebar().create_printer_preset();}); } else if (strCmd == "user_guide_cancel") { this->EndModal(wxID_CANCEL); @@ -871,7 +871,7 @@ bool GuideFrame::apply_config(AppConfig *app_config, PresetBundle *preset_bundle std::string preferred_model; std::string preferred_variant; PrinterTechnology preferred_pt = ptFFF; - auto get_preferred_printer_model = [preset_bundle, enabled_vendors, old_enabled_vendors, preferred_pt](const std::string& bundle_name, std::string& variant) { + auto get_preferred_printer_model = [preset_bundle, enabled_vendors, old_enabled_vendors](const std::string& bundle_name, std::string& variant) { const auto config = enabled_vendors.find(bundle_name); if (config == enabled_vendors.end()) return std::string(); diff --git a/src/slic3r/GUI/WebUserLoginDialog.cpp b/src/slic3r/GUI/WebUserLoginDialog.cpp index 4222ce745b..829e7ef106 100644 --- a/src/slic3r/GUI/WebUserLoginDialog.cpp +++ b/src/slic3r/GUI/WebUserLoginDialog.cpp @@ -489,7 +489,7 @@ void ZUserLogin::OnScriptMessage(wxWebViewEvent &evt) std::string jump_url = j["data"]["url"].get(); int loopback_port = ensure_loopback_port(); jump_url = rewrite_loopback_url(jump_url, loopback_port); - CallAfter([this, jump_url] { + CallAfter([jump_url] { wxString url = wxString::FromUTF8(jump_url); wxLaunchDefaultBrowser(url); }); @@ -498,7 +498,7 @@ void ZUserLogin::OnScriptMessage(wxWebViewEvent &evt) else if (strCmd == "new_webpage") { if (j["data"].contains("url")) { std::string jump_url = j["data"]["url"].get(); - CallAfter([this, jump_url] { + CallAfter([jump_url] { wxString url = wxString::FromUTF8(jump_url); wxLaunchDefaultBrowser(url); }); diff --git a/src/slic3r/Utils/3DPrinterOS.cpp b/src/slic3r/Utils/3DPrinterOS.cpp index 79c8a62700..b177e37e38 100755 --- a/src/slic3r/Utils/3DPrinterOS.cpp +++ b/src/slic3r/Utils/3DPrinterOS.cpp @@ -627,7 +627,7 @@ void C3DPrinterOS::send_form( responseTree.put("result", false); responseTree.put("message", error); }) - .on_complete([&, this](std::string body, unsigned) { + .on_complete([&](std::string body, unsigned) { std::stringstream ss(body); try { pt::read_json(ss, responseTree); diff --git a/src/slic3r/Utils/Moonraker.cpp b/src/slic3r/Utils/Moonraker.cpp index f1ca432390..73fdb8486a 100644 --- a/src/slic3r/Utils/Moonraker.cpp +++ b/src/slic3r/Utils/Moonraker.cpp @@ -80,7 +80,7 @@ bool Moonraker::test(wxString &msg) const res = false; msg = format_error(body, error, status); }) - .on_complete([&, this](std::string body, unsigned) { + .on_complete([&](std::string body, unsigned) { BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: /server/info body: %2%") % name % body; try { std::stringstream ss(body); @@ -141,7 +141,7 @@ bool Moonraker::get_storage(wxArrayString &storage_path, wxArrayString &storage_ % name % error % status % body; } }) - .on_complete([&, this](std::string body, unsigned) { + .on_complete([&](std::string body, unsigned) { BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: /server/files/roots body: %2%") % name % body; try { std::stringstream ss(body); diff --git a/src/slic3r/Utils/Obico.cpp b/src/slic3r/Utils/Obico.cpp index 5541d1c683..92d748b496 100644 --- a/src/slic3r/Utils/Obico.cpp +++ b/src/slic3r/Utils/Obico.cpp @@ -86,7 +86,7 @@ bool Obico::test(wxString& msg) const res = false; msg = format_error(body, error, status); }) - .on_complete([&, this](std::string body, unsigned) { + .on_complete([&](std::string body, unsigned) { BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Got version: %2%") % name % body; }) #ifdef WIN32 diff --git a/src/slic3r/Utils/PresetUpdater.cpp b/src/slic3r/Utils/PresetUpdater.cpp index 56a2b66b49..663a4ce8c3 100644 --- a/src/slic3r/Utils/PresetUpdater.cpp +++ b/src/slic3r/Utils/PresetUpdater.cpp @@ -513,7 +513,7 @@ void PresetUpdater::priv::sync_resources(std::string http_url, std::map bool res = true; - const auto create_request = [this, &build_request, &res, &on_complete](const std::string& access_token, bool is_retry) { + const auto create_request = [&build_request, &res, &on_complete](const std::string& access_token, bool is_retry) { auto http = build_request(is_retry); set_auth(http, access_token); http.header("User-Agent", "SimplyPrint Orca Plugin") @@ -300,7 +300,7 @@ bool SimplyPrint::do_temp_upload(const boost::filesystem::path& file_path, return http; }, - [&error_fn, &filename, this](std::string body, unsigned status) { + [&error_fn, &filename](std::string body, unsigned status) { BOOST_LOG_TRIVIAL(info) << boost::format("SimplyPrint: File uploaded: HTTP %1%: %2%") % status % body; // Get file UUID @@ -423,7 +423,7 @@ bool SimplyPrint::do_chunk_upload(const boost::filesystem::path& file_path, cons return http; }, - [&error_fn, i, chunk_amount, this, &chunk_id, &delete_token](std::string body, unsigned status) { + [&error_fn, i, chunk_amount, &chunk_id, &delete_token](std::string body, unsigned status) { BOOST_LOG_TRIVIAL(info) << boost::format("SimplyPrint: File chunk [%1%/%2%] uploaded: HTTP %3%: %4%") % (i + 1) % chunk_amount % status % body; if (i == 0) { // First chunk, parse chunk id