From aa97741e536598960931fd78eec215b9720f8145 Mon Sep 17 00:00:00 2001 From: Raul Date: Thu, 1 Jan 2026 18:12:32 -0800 Subject: [PATCH] Clean compile: fix all Windows/macOS build warnings --- .gitignore | 1 + src/BambuStudio.cpp | 16 ++- src/libnest2d/include/libnest2d/optimizer.hpp | 12 +- .../libnest2d/placers/bottomleftplacer.hpp | 23 ++-- .../include/libnest2d/selections/firstfit.hpp | 4 +- .../include/libnest2d/utils/metaloop.hpp | 22 ++-- src/libslic3r/ArcFitter.cpp | 12 +- src/libslic3r/Arrange.cpp | 2 +- src/libslic3r/Brim.cpp | 7 +- src/libslic3r/Clipper2Utils.cpp | 24 ++-- src/libslic3r/ClipperUtils.cpp | 3 +- src/libslic3r/Config.cpp | 4 +- src/libslic3r/ExtrusionEntity.hpp | 2 +- src/libslic3r/FilamentGroup.cpp | 1 + src/libslic3r/Fill/Fill.cpp | 4 + src/libslic3r/Fill/FillFloatingConcentric.cpp | 2 +- src/libslic3r/Fill/FillFloatingConcentric.hpp | 4 +- src/libslic3r/Fill/FillRectilinear.cpp | 2 +- src/libslic3r/Fill/FillRectilinear.hpp | 2 +- src/libslic3r/FlushVolCalc.cpp | 4 +- src/libslic3r/FlushVolCalc.hpp | 3 +- src/libslic3r/Format/STEP.cpp | 16 ++- src/libslic3r/Format/bbs_3mf.cpp | 27 +++-- src/libslic3r/Format/svg.cpp | 2 +- src/libslic3r/GCode.cpp | 18 +-- src/libslic3r/GCode/GCodeProcessor.cpp | 22 ++-- src/libslic3r/GCode/GCodeProcessor.hpp | 3 - src/libslic3r/GCode/PostProcessor.cpp | 2 +- src/libslic3r/GCode/TimelapsePosPicker.cpp | 3 +- src/libslic3r/GCode/WipeTower.cpp | 8 +- src/libslic3r/GCodeWriter.cpp | 2 +- src/libslic3r/GCodeWriter.hpp | 1 - src/libslic3r/Geometry/MedialAxis.cpp | 2 +- src/libslic3r/Geometry/MedialAxis.hpp | 1 - .../Interlocking/InterlockingGenerator.cpp | 29 +++-- src/libslic3r/JumpPointSearch.cpp | 2 +- src/libslic3r/JumpPointSearch.hpp | 1 - src/libslic3r/Layer.cpp | 6 +- src/libslic3r/MeshBoolean.cpp | 15 ++- src/libslic3r/MeshSplitImpl.hpp | 2 +- src/libslic3r/Model.cpp | 8 +- src/libslic3r/MultiMaterialSegmentation.cpp | 17 ++- src/libslic3r/MultiNozzleUtils.cpp | 2 +- src/libslic3r/MultiPoint.hpp | 2 + src/libslic3r/PlaceholderParser.cpp | 10 +- src/libslic3r/Preset.cpp | 2 +- src/libslic3r/Preset.hpp | 2 - src/libslic3r/PresetBundle.cpp | 10 +- src/libslic3r/Print.cpp | 8 +- src/libslic3r/Print.hpp | 4 +- src/libslic3r/PrintApply.cpp | 2 +- src/libslic3r/PrintConfig.cpp | 17 ++- src/libslic3r/PrintObject.cpp | 11 +- src/libslic3r/PrintObjectSlice.cpp | 4 +- src/libslic3r/SLAPrint.cpp | 5 +- src/libslic3r/Shape/TextShape.cpp | 2 +- src/libslic3r/Support/SupportMaterial.cpp | 6 +- src/libslic3r/Support/SupportMaterial.hpp | 1 - src/libslic3r/Support/TreeSupport.cpp | 52 ++++----- src/libslic3r/Support/TreeSupport.hpp | 6 +- src/libslic3r/Support/TreeSupport3D.cpp | 2 +- src/libslic3r/Utils.hpp | 10 +- src/libslic3r/utils.cpp | 2 +- src/slic3r/GUI/3DScene.cpp | 2 +- src/slic3r/GUI/AMSMaterialsSetting.cpp | 7 +- src/slic3r/GUI/AMSMaterialsSetting.hpp | 1 - src/slic3r/GUI/AMSSetting.hpp | 2 + src/slic3r/GUI/AboutDialog.hpp | 1 - src/slic3r/GUI/AmsMappingPopup.cpp | 11 +- src/slic3r/GUI/AmsMappingPopup.hpp | 1 - src/slic3r/GUI/Auxiliary.cpp | 24 ++-- src/slic3r/GUI/AuxiliaryDataViewModel.cpp | 2 +- src/slic3r/GUI/BBLTopbar.hpp | 2 - src/slic3r/GUI/BindDialog.cpp | 8 +- src/slic3r/GUI/BindDialog.hpp | 11 -- src/slic3r/GUI/CaliHistoryDialog.cpp | 2 +- src/slic3r/GUI/Calibration.cpp | 2 +- src/slic3r/GUI/CalibrationPanel.cpp | 17 +-- src/slic3r/GUI/CalibrationPanel.hpp | 4 - src/slic3r/GUI/CalibrationWizard.cpp | 2 +- src/slic3r/GUI/CalibrationWizardCaliPage.cpp | 2 +- src/slic3r/GUI/CalibrationWizardPage.cpp | 2 +- .../GUI/CalibrationWizardPresetPage.cpp | 10 +- src/slic3r/GUI/CalibrationWizardSavePage.cpp | 6 +- src/slic3r/GUI/CalibrationWizardSavePage.hpp | 2 +- src/slic3r/GUI/CalibrationWizardStartPage.hpp | 8 +- src/slic3r/GUI/Camera.hpp | 1 - src/slic3r/GUI/CameraPopup.cpp | 2 +- src/slic3r/GUI/CameraPopup.hpp | 2 + src/slic3r/GUI/ConfigWizard.cpp | 2 +- src/slic3r/GUI/ConnectPrinter.cpp | 2 +- src/slic3r/GUI/CreatePresetsDialog.cpp | 36 +++--- src/slic3r/GUI/CreatePresetsDialog.hpp | 1 - src/slic3r/GUI/DailyTips.cpp | 1 - src/slic3r/GUI/DailyTips.hpp | 1 - src/slic3r/GUI/DeviceCore/DevConfig.h | 4 +- .../GUI/DeviceCore/DevExtensionTool.cpp | 2 +- src/slic3r/GUI/DeviceCore/DevExtensionTool.h | 2 - src/slic3r/GUI/DeviceCore/DevFilaAmsSetting.h | 4 +- src/slic3r/GUI/DeviceCore/DevFirmware.h | 3 +- src/slic3r/GUI/DeviceCore/DevHMS.h | 4 +- src/slic3r/GUI/DeviceCore/DevManager.cpp | 2 +- src/slic3r/GUI/DeviceCore/DevStorage.h | 3 +- .../GUI/DeviceTab/uiAmsHumidityPopup.cpp | 12 +- src/slic3r/GUI/DeviceTab/uiAmsHumidityPopup.h | 14 ++- .../GUI/DeviceTab/uiDeviceUpdateVersion.cpp | 12 +- .../GUI/DeviceTab/uiDeviceUpdateVersion.h | 12 +- .../GUI/DeviceTab/wgtDeviceNozzleRack.cpp | 18 +-- .../GUI/DeviceTab/wgtDeviceNozzleRack.h | 20 ++-- .../DeviceTab/wgtDeviceNozzleRackUpdate.cpp | 12 +- .../GUI/DeviceTab/wgtDeviceNozzleRackUpdate.h | 13 +-- .../GUI/DeviceTab/wgtDeviceNozzleSelect.cpp | 14 +-- .../GUI/DeviceTab/wgtDeviceNozzleSelect.h | 12 +- src/slic3r/GUI/Field.cpp | 3 + src/slic3r/GUI/FilamentMapDialog.cpp | 6 +- src/slic3r/GUI/FilamentMapPanel.cpp | 36 +++--- src/slic3r/GUI/FilamentMapPanel.hpp | 16 +-- src/slic3r/GUI/FilamentPickerDialog.cpp | 4 +- .../GUI/GCodeRenderer/AdvancedRenderer.cpp | 50 ++++++--- .../GUI/GCodeRenderer/AdvancedRenderer.hpp | 32 +++--- src/slic3r/GUI/GCodeRenderer/BaseRenderer.cpp | 14 +-- .../GUI/GCodeRenderer/LegacyRenderer.cpp | 2 +- src/slic3r/GUI/GLCanvas3D.cpp | 54 ++++----- src/slic3r/GUI/GLCanvas3D.hpp | 1 - src/slic3r/GUI/GLTexture.cpp | 6 +- src/slic3r/GUI/GLToolbar.hpp | 5 +- src/slic3r/GUI/GUI_App.cpp | 33 +++--- src/slic3r/GUI/GUI_App.hpp | 2 +- src/slic3r/GUI/GUI_AuxiliaryList.cpp | 2 +- src/slic3r/GUI/GUI_Factories.cpp | 38 +++---- src/slic3r/GUI/GUI_ObjectLayers.cpp | 4 +- src/slic3r/GUI/GUI_ObjectList.cpp | 2 +- src/slic3r/GUI/GUI_ObjectTable.cpp | 4 +- src/slic3r/GUI/GUI_ObjectTable.hpp | 7 -- src/slic3r/GUI/GUI_ObjectTableSettings.cpp | 4 +- src/slic3r/GUI/GUI_ObjectTableSettings.hpp | 2 + src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.cpp | 3 - src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.hpp | 33 ++---- src/slic3r/GUI/Gizmos/GLGizmoFaceDetector.hpp | 1 - src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.hpp | 1 - src/slic3r/GUI/Gizmos/GLGizmoFuzzySkin.hpp | 7 -- src/slic3r/GUI/Gizmos/GLGizmoMeasure.cpp | 2 +- src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.cpp | 5 +- src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.hpp | 2 +- .../GUI/Gizmos/GLGizmoMmuSegmentation.cpp | 6 +- src/slic3r/GUI/Gizmos/GLGizmoMove.hpp | 2 +- src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp | 2 +- src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp | 1 - src/slic3r/GUI/Gizmos/GLGizmoRotate.cpp | 2 +- src/slic3r/GUI/Gizmos/GLGizmoSVG.hpp | 2 +- src/slic3r/GUI/Gizmos/GLGizmoScale.hpp | 2 +- src/slic3r/GUI/Gizmos/GLGizmoSimplify.cpp | 2 +- src/slic3r/GUI/Gizmos/GLGizmoText.cpp | 1 - src/slic3r/GUI/Gizmos/GLGizmoText.hpp | 10 +- .../GUI/Gizmos/GizmoObjectManipulation.cpp | 12 +- src/slic3r/GUI/HMS.cpp | 4 +- src/slic3r/GUI/HMSPanel.hpp | 1 - src/slic3r/GUI/HelioReleaseNote.cpp | 2 +- src/slic3r/GUI/HelioReleaseNote.hpp | 4 - src/slic3r/GUI/HttpServer.cpp | 2 +- src/slic3r/GUI/IMSlider.cpp | 13 +-- src/slic3r/GUI/IMSlider.hpp | 6 - src/slic3r/GUI/ImageDPIFrame.cpp | 2 +- src/slic3r/GUI/ImageMessageDialog.cpp | 2 +- src/slic3r/GUI/ImageMessageDialog.hpp | 1 - src/slic3r/GUI/Jobs/BindJob.hpp | 1 - src/slic3r/GUI/Jobs/EmbossJob.cpp | 3 +- src/slic3r/GUI/Jobs/FillBedJob.cpp | 2 +- src/slic3r/GUI/Jobs/PrintJob.cpp | 14 +-- src/slic3r/GUI/Jobs/RotoptimizeJob.cpp | 6 +- src/slic3r/GUI/Jobs/SendJob.cpp | 10 +- src/slic3r/GUI/Jobs/UpgradeNetworkJob.hpp | 1 - src/slic3r/GUI/MainFrame.cpp | 34 +++--- src/slic3r/GUI/MainFrame.hpp | 3 +- src/slic3r/GUI/MediaFilePanel.cpp | 2 +- src/slic3r/GUI/MediaFilePanel.h | 1 - src/slic3r/GUI/MediaPlayCtrl.cpp | 65 ++++++----- src/slic3r/GUI/MediaPlayCtrl.h | 29 ++++- src/slic3r/GUI/Monitor.cpp | 8 +- src/slic3r/GUI/Monitor.hpp | 7 -- src/slic3r/GUI/Mouse3DController.cpp | 2 +- src/slic3r/GUI/MsgDialog.cpp | 4 +- src/slic3r/GUI/MsgDialog.hpp | 2 - src/slic3r/GUI/MultiMachine.cpp | 2 +- src/slic3r/GUI/MultiMachineManagerPage.cpp | 7 +- src/slic3r/GUI/MultiMachineManagerPage.hpp | 4 - src/slic3r/GUI/MultiMachinePage.cpp | 13 ++- src/slic3r/GUI/MultiMachinePage.hpp | 1 - src/slic3r/GUI/MultiTaskManagerPage.cpp | 7 +- src/slic3r/GUI/MultiTaskManagerPage.hpp | 6 - src/slic3r/GUI/NetworkTestDialog.cpp | 12 +- src/slic3r/GUI/Notebook.cpp | 2 +- src/slic3r/GUI/Notebook.hpp | 4 +- src/slic3r/GUI/OG_CustomCtrl.cpp | 2 +- src/slic3r/GUI/ObjColorDialog.cpp | 6 +- src/slic3r/GUI/ObjColorDialog.hpp | 3 - src/slic3r/GUI/OpenGLManager.cpp | 11 ++ src/slic3r/GUI/OptionsGroup.hpp | 2 +- src/slic3r/GUI/ParamsPanel.cpp | 6 +- src/slic3r/GUI/ParamsPanel.hpp | 1 - src/slic3r/GUI/PartPlate.cpp | 15 ++- src/slic3r/GUI/PartSkipDialog.hpp | 1 - src/slic3r/GUI/PhysicalPrinterDialog.hpp | 1 - src/slic3r/GUI/Plater.cpp | 104 +++++++++--------- src/slic3r/GUI/PrePrintChecker.cpp | 5 +- src/slic3r/GUI/Preferences.cpp | 12 +- src/slic3r/GUI/PresetComboBoxes.cpp | 4 +- src/slic3r/GUI/PrintOptionsDialog.cpp | 2 +- src/slic3r/GUI/Printer/PrinterFileSystem.cpp | 8 +- src/slic3r/GUI/PrivacyUpdateDialog.cpp | 2 +- src/slic3r/GUI/Project.cpp | 6 +- src/slic3r/GUI/Project.hpp | 1 - src/slic3r/GUI/RecenterDialog.hpp | 2 - src/slic3r/GUI/ReleaseNote.cpp | 8 +- src/slic3r/GUI/SafetyOptionsDialog.cpp | 2 +- src/slic3r/GUI/SavePresetDialog.cpp | 4 +- src/slic3r/GUI/Search.cpp | 10 +- src/slic3r/GUI/Search.hpp | 4 + src/slic3r/GUI/SelectMachine.cpp | 14 +-- src/slic3r/GUI/SelectMachine.hpp | 2 +- src/slic3r/GUI/SelectMachinePop.cpp | 14 +-- src/slic3r/GUI/SelectMachinePop.hpp | 6 +- src/slic3r/GUI/Selection.cpp | 32 +++--- src/slic3r/GUI/SendMultiMachinePage.cpp | 18 +-- src/slic3r/GUI/SendMultiMachinePage.hpp | 1 - src/slic3r/GUI/SendToPrinter.cpp | 28 +++-- src/slic3r/GUI/SendToPrinter.hpp | 11 +- src/slic3r/GUI/SkipPartCanvas.cpp | 18 ++- src/slic3r/GUI/SkipPartCanvas.hpp | 1 - src/slic3r/GUI/SliceInfoPanel.cpp | 2 +- src/slic3r/GUI/SliceInfoPanel.hpp | 1 - .../GUI/SlicingProgressNotification.hpp | 3 + src/slic3r/GUI/StatusPanel.cpp | 8 +- src/slic3r/GUI/StepMeshDialog.cpp | 6 +- src/slic3r/GUI/SyncAmsInfoDialog.cpp | 13 ++- src/slic3r/GUI/SyncAmsInfoDialog.hpp | 9 +- src/slic3r/GUI/Tab.cpp | 19 ++-- src/slic3r/GUI/Tab.hpp | 8 +- src/slic3r/GUI/TabButton.hpp | 2 +- src/slic3r/GUI/Tabbook.hpp | 9 +- .../GUI/ThermalPreconditioningDialog.hpp | 1 - src/slic3r/GUI/UIHelpers/MeshBooleanUI.cpp | 8 +- src/slic3r/GUI/UnsavedChangesDialog.cpp | 4 +- src/slic3r/GUI/UnsavedChangesDialog.hpp | 2 +- src/slic3r/GUI/UpdateDialogs.hpp | 2 - src/slic3r/GUI/UpgradePanel.cpp | 1 - src/slic3r/GUI/WebGuideDialog.cpp | 8 +- src/slic3r/GUI/WebGuideDialog.hpp | 1 - src/slic3r/GUI/WebUserLoginDialog.cpp | 4 +- src/slic3r/GUI/WebViewDialog.cpp | 22 ++-- src/slic3r/GUI/WebViewDialog.hpp | 2 +- src/slic3r/GUI/Widgets/AMSItem.cpp | 9 +- src/slic3r/GUI/Widgets/AMSItem.hpp | 30 +++-- src/slic3r/GUI/Widgets/AnimaController.cpp | 2 +- src/slic3r/GUI/Widgets/AnimaController.hpp | 2 +- src/slic3r/GUI/Widgets/AxisCtrlButton.cpp | 2 +- src/slic3r/GUI/Widgets/ComboBox.cpp | 8 +- src/slic3r/GUI/Widgets/ErrorMsgStaticText.hpp | 2 +- src/slic3r/GUI/Widgets/FanControl.cpp | 10 +- src/slic3r/GUI/Widgets/FanControl.hpp | 2 - src/slic3r/GUI/Widgets/MultiNozzleSync.cpp | 18 +-- src/slic3r/GUI/Widgets/MultiNozzleSync.hpp | 6 +- src/slic3r/GUI/Widgets/ProgressBar.hpp | 2 +- src/slic3r/GUI/Widgets/RadioBox.hpp | 3 + src/slic3r/GUI/Widgets/Scrollbar.cpp | 1 - src/slic3r/GUI/Widgets/ScrolledWindow.cpp | 1 - src/slic3r/GUI/Widgets/ScrolledWindow.hpp | 3 + src/slic3r/GUI/Widgets/SideButton.hpp | 4 +- src/slic3r/GUI/Widgets/SideTools.cpp | 2 +- src/slic3r/GUI/Widgets/SpinInput.cpp | 2 +- src/slic3r/GUI/Widgets/StateColor.cpp | 2 +- src/slic3r/GUI/Widgets/StateHandler.cpp | 6 +- src/slic3r/GUI/Widgets/SwitchButton.hpp | 2 + src/slic3r/GUI/Widgets/TabCtrl.hpp | 2 +- src/slic3r/GUI/Widgets/TempInput.cpp | 2 +- src/slic3r/GUI/Widgets/TempInput.hpp | 4 +- src/slic3r/GUI/Widgets/TextInput.cpp | 2 +- src/slic3r/GUI/Widgets/TextInput.hpp | 4 +- src/slic3r/GUI/calib_dlg.cpp | 4 +- src/slic3r/GUI/wxMediaCtrl2.h | 2 - src/slic3r/Utils/CalibUtils.cpp | 18 +-- src/slic3r/Utils/CertificateVerify.cpp | 2 + src/slic3r/Utils/HelioDragon.cpp | 8 +- src/slic3r/Utils/Http.cpp | 2 - src/slic3r/Utils/NetworkAgent.cpp | 6 +- src/slic3r/Utils/PresetUpdater.cpp | 2 +- src/slic3r/Utils/TCPConsole.cpp | 1 + src/slic3r/Utils/UndoRedo.cpp | 9 +- 288 files changed, 1125 insertions(+), 1117 deletions(-) diff --git a/.gitignore b/.gitignore index 52cef73065..f718d4cca7 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ doc/ test.js /.cache/ .clangd +.idea/ diff --git a/src/BambuStudio.cpp b/src/BambuStudio.cpp index af3710fb6b..3800ecb9d0 100644 --- a/src/BambuStudio.cpp +++ b/src/BambuStudio.cpp @@ -155,6 +155,11 @@ std::map cli_errors = { {CLI_GCODE_IN_WRAPPING_DETECT_AREA, "Found G-code in the wrapping detect area. Please make sure the 3mf file can be successfully sliced in the latest Bambu Studio."} }; +namespace { + // File-scope constant to avoid lambda capture issues across compilers (MSVC vs Clang) + constexpr ForwardCompatibilitySubstitutionRule config_substitution_rule = ForwardCompatibilitySubstitutionRule::Enable; +} + typedef struct _object_info{ int id{0}; std::string name; @@ -1447,9 +1452,8 @@ int CLI::run(int argc, char **argv) std::vector downward_settings = m_config.option("downward_settings", true)->values; std::vector downward_compatible_machines; std::set downward_uncompatible_machines; - //BBS: always use ForwardCompatibilitySubstitutionRule::Enable + //BBS: always use ForwardCompatibilitySubstitutionRule::Enable (now defined at file scope) //const ForwardCompatibilitySubstitutionRule config_substitution_rule = m_config.option>("config_compatibility", true)->value; - const ForwardCompatibilitySubstitutionRule config_substitution_rule = ForwardCompatibilitySubstitutionRule::Enable; const std::vector &load_filaments = m_config.option("load_filaments", true)->values; //skip model object logic const std::vector &skip_objects = m_config.option("skip_objects", true)->values; @@ -2023,7 +2027,7 @@ int CLI::run(int argc, char **argv) } } catch (std::exception& e) { - boost::nowide::cerr << construct_assemble_list << ": " << e.what() << std::endl; + boost::nowide::cerr << "construct_assemble_list: " << e.what() << std::endl; record_exit_reson(outfile_dir, CLI_DATA_FILE_ERROR, 0, cli_errors[CLI_DATA_FILE_ERROR], sliced_info); flush_and_exit(CLI_DATA_FILE_ERROR); } @@ -2087,7 +2091,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; @@ -4992,7 +4996,7 @@ int CLI::run(int argc, char **argv) } } - if (!arrange_cfg.is_seq_print && (assemble_plate.filaments_count > 1)||(enable_wrapping_detect && !current_wrapping_exclude_area.empty())) + if ((!arrange_cfg.is_seq_print && (assemble_plate.filaments_count > 1)) || (enable_wrapping_detect && !current_wrapping_exclude_area.empty())) { //prepare the wipe tower int plate_count = partplate_list.get_plate_count(); @@ -7534,7 +7538,7 @@ int CLI::run(int argc, char **argv) gcode_viewer.render_calibration_thumbnail(*calibration_data, cali_thumbnail_width, cali_thumbnail_height, calibration_params, partplate_list, opengl_mgr); //generate_calibration_thumbnail(*calibration_data, thumbnail_width, thumbnail_height, calibration_params); - //*plate_bboxes[index] = p->generate_first_layer_bbox(); + *plate_bboxes[index] = p->generate_first_layer_bbox(); calibration_thumbnails.push_back(calibration_data);*/ PlateBBoxData* plate_bbox = new PlateBBoxData(); diff --git a/src/libnest2d/include/libnest2d/optimizer.hpp b/src/libnest2d/include/libnest2d/optimizer.hpp index e4c149f228..3cdb060fa4 100644 --- a/src/libnest2d/include/libnest2d/optimizer.hpp +++ b/src/libnest2d/include/libnest2d/optimizer.hpp @@ -156,7 +156,7 @@ class Optimizer { { dir_ = OptDir::MIN; return static_cast(this)->template optimize( - forward(objectfunction), initvals, bounds... ); + std::forward(objectfunction), initvals, bounds... ); } template @@ -165,7 +165,7 @@ class Optimizer { { dir_ = OptDir::MIN; return static_cast(this)->template optimize( - forward(objectfunction), initvals, Bound()... ); + std::forward(objectfunction), initvals, Bound()... ); } template @@ -173,7 +173,7 @@ class Optimizer { { dir_ = OptDir::MIN; return static_cast(this)->template optimize( - forward(objectfunction), + std::forward(objectfunction), Input(), Bound()... ); } @@ -186,7 +186,7 @@ class Optimizer { { dir_ = OptDir::MAX; return static_cast(this)->template optimize( - forward(objectfunction), initvals, bounds... ); + std::forward(objectfunction), initvals, bounds... ); } template @@ -195,7 +195,7 @@ class Optimizer { { dir_ = OptDir::MAX; return static_cast(this)->template optimize( - forward(objectfunction), initvals, Bound()... ); + std::forward(objectfunction), initvals, Bound()... ); } template @@ -203,7 +203,7 @@ class Optimizer { { dir_ = OptDir::MAX; return static_cast(this)->template optimize( - forward(objectfunction), + std::forward(objectfunction), Input(), Bound()... ); } diff --git a/src/libnest2d/include/libnest2d/placers/bottomleftplacer.hpp b/src/libnest2d/include/libnest2d/placers/bottomleftplacer.hpp index 55f418ec2e..c7bf1cc8e3 100644 --- a/src/libnest2d/include/libnest2d/placers/bottomleftplacer.hpp +++ b/src/libnest2d/include/libnest2d/placers/bottomleftplacer.hpp @@ -378,21 +378,14 @@ class _BottomLeftPlacer: public PlacerBoilerplate< // the additional vertices for maintaning min object distance sl::reserve(rsh, finish-start+4); - auto addOthers_ = [&rsh, finish, start, &item](){ - for(size_t i = start+1; i < finish; i++) - sl::addVertex(rsh, item.vertex(i)); - }; - - auto reverseAddOthers_ = [&rsh, finish, start, &item](){ - for(auto i = finish-1; i > start; i--) - sl::addVertex(rsh, item.vertex(static_cast(i))); - }; - - auto addOthers = [&addOthers_, &reverseAddOthers_]() { - if constexpr (!is_clockwise()) - addOthers_(); - else - reverseAddOthers_(); + auto addOthers = [&rsh, finish, start, &item]() { + if constexpr (!is_clockwise()) { + for(size_t i = start+1; i < finish; i++) + sl::addVertex(rsh, item.vertex(i)); + } else { + for(auto i = finish-1; i > start; i--) + sl::addVertex(rsh, item.vertex(static_cast(i))); + } }; // Final polygon construction... diff --git a/src/libnest2d/include/libnest2d/selections/firstfit.hpp b/src/libnest2d/include/libnest2d/selections/firstfit.hpp index dcc0023e26..c01a4d4d57 100644 --- a/src/libnest2d/include/libnest2d/selections/firstfit.hpp +++ b/src/libnest2d/include/libnest2d/selections/firstfit.hpp @@ -58,13 +58,13 @@ class _FirstFitSelection: public SelectionBoilerplate { } }); - std::for_each(pconfig.m_excluded_regions.begin(), pconfig.m_excluded_regions.end(), [this, &pconfig](Item& itm) { + std::for_each(pconfig.m_excluded_regions.begin(), pconfig.m_excluded_regions.end(), [&pconfig](Item& itm) { pconfig.m_excluded_items.emplace_back(itm); }); #ifdef SVGTOOLS_HPP svg::SVGWriter svgwriter; - std::for_each(first, last, [this,&svgwriter](Item &itm) { svgwriter.writeShape(itm, "none", "blue"); }); + std::for_each(first, last, [&svgwriter](Item &itm) { svgwriter.writeShape(itm, "none", "blue"); }); svgwriter.save(boost::filesystem::path("SVG") / "all_items.svg"); #endif diff --git a/src/libnest2d/include/libnest2d/utils/metaloop.hpp b/src/libnest2d/include/libnest2d/utils/metaloop.hpp index ac099ac464..22a660f696 100644 --- a/src/libnest2d/include/libnest2d/utils/metaloop.hpp +++ b/src/libnest2d/include/libnest2d/utils/metaloop.hpp @@ -89,12 +89,12 @@ template class MapFn { // with C++14 because the second parameter's type will depend on the // type of the parameter pack element that is processed. In C++14 we can // specify this second parameter type as auto in the lambda parameter list. - inline MapFn(Fn&& fn): fn_(forward(fn)) {} + inline MapFn(Fn&& fn): fn_(std::forward(fn)) {} template void operator ()(T&& pack_element) { // We provide the index as the first parameter and the pack (or tuple) // element as the second parameter to the functor. - fn_(N, forward(pack_element)); + fn_(N, std::forward(pack_element)); } }; @@ -118,7 +118,7 @@ class _MetaLoop, Args...> { template void run( Tup&& valtup, Fn&& fn) { - MapFn {forward(fn)} (get(valtup)); + MapFn {std::forward(fn)} (get(valtup)); } }; @@ -131,11 +131,11 @@ class _MetaLoop, Args...> { template void run(Tup&& valtup, Fn&& fn) { - MapFn {forward(fn)} (std::get(valtup)); + MapFn {std::forward(fn)} (std::get(valtup)); // Recursive call to process the next element of Args - _MetaLoop, Args...> ().run(forward(valtup), - forward(fn)); + _MetaLoop, Args...> ().run(std::forward(valtup), + std::forward(fn)); } }; @@ -187,26 +187,26 @@ using MetaLoop = _MetaLoop, Args...>; */ template inline static void apply(Fn&& fn, Args&&...args) { - MetaLoop().run(tuple(forward(args)...), - forward(fn)); + MetaLoop().run(tuple(std::forward(args)...), + std::forward(fn)); } /// The version of apply with a tuple rvalue reference. template inline static void apply(Fn&& fn, tuple&& tup) { - MetaLoop().run(std::move(tup), forward(fn)); + MetaLoop().run(std::move(tup), std::forward(fn)); } /// The version of apply with a tuple lvalue reference. template inline static void apply(Fn&& fn, tuple& tup) { - MetaLoop().run(tup, forward(fn)); + MetaLoop().run(tup, std::forward(fn)); } /// The version of apply with a tuple const reference. template inline static void apply(Fn&& fn, const tuple& tup) { - MetaLoop().run(tup, forward(fn)); + MetaLoop().run(tup, std::forward(fn)); } /** diff --git a/src/libslic3r/ArcFitter.cpp b/src/libslic3r/ArcFitter.cpp index cdfd708b10..46dd12931e 100644 --- a/src/libslic3r/ArcFitter.cpp +++ b/src/libslic3r/ArcFitter.cpp @@ -57,24 +57,24 @@ void ArcFitter::do_arc_fitting(const Points& points, std::vector 2) { //BBS: althought current point_stack can't be fit as arc, //but previous must can be fit if removing the top in stack, so save last arc - result.emplace_back(std::move(PathFittingData{ front_index, + result.emplace_back(PathFittingData{ front_index, back_index - 1, last_arc.direction == ArcDirection::Arc_Dir_CCW ? EMovePathType::Arc_move_ccw : EMovePathType::Arc_move_cw, - last_arc })); + last_arc }); } else { //BBS: save the first segment as line move when 3 point-line can't be fit as arc move if (result.empty() || result.back().path_type != EMovePathType::Linear_move) - result.emplace_back(std::move(PathFittingData{front_index, front_index + 1, EMovePathType::Linear_move, ArcSegment()})); + result.emplace_back(PathFittingData{front_index, front_index + 1, EMovePathType::Linear_move, ArcSegment()}); else if(result.back().path_type == EMovePathType::Linear_move) result.back().end_point_index = front_index + 1; } @@ -87,7 +87,7 @@ void ArcFitter::do_arc_fitting(const Points& points, std::vectorextruder_id() == *iter) { - if (Model::extruderParamsMap.find(modelVolume->extruder_id()) != Model::extruderParamsMap.end()) + if (Model::extruderParamsMap.find(modelVolume->extruder_id()) != Model::extruderParamsMap.end()) { if (Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "PETG" || Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "PCTG") { adhesionCoeff = 2; @@ -598,6 +598,7 @@ double getadhesionCoeff(const PrintObject* printObject) Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "TPU-AMS") { adhesionCoeff = 0.5; } + } } } @@ -1656,7 +1657,7 @@ ExtrusionEntityCollection makeBrimInfill(const ExPolygons& singleBrimArea, const Polylines loops_pl = to_polylines(loops); loops_pl_by_levels.assign(loops_pl.size(), Polylines()); tbb::parallel_for(tbb::blocked_range(0, loops_pl.size()), - [&loops_pl_by_levels, &loops_pl, &islands_area](const tbb::blocked_range& range) { + [&loops_pl_by_levels, &loops_pl](const tbb::blocked_range& range) { for (size_t i = range.begin(); i < range.end(); ++i) { loops_pl_by_levels[i] = chain_polylines({ std::move(loops_pl[i]) }); //loops_pl_by_levels[i] = chain_polylines(intersection_pl({ std::move(loops_pl[i]) }, islands_area)); @@ -1821,7 +1822,7 @@ ExtrusionEntityCollection make_brim(const Print &print, PrintTryCancel try_cance } #endif // BRIM_DEBUG_TO_SVG - const bool could_brim_intersects_skirt = std::any_of(print.objects().begin(), print.objects().end(), [&print, &brim_width_map, brim_width_max](PrintObject *object) { + const bool could_brim_intersects_skirt = std::any_of(print.objects().begin(), print.objects().end(), [&print, &brim_width_map](PrintObject *object) { const BrimType &bt = object->config().brim_type; return (bt == btOuterOnly || bt == btOuterAndInner || bt == btAutoBrim) && print.config().skirt_distance.value < brim_width_map[object->id()]; }); diff --git a/src/libslic3r/Clipper2Utils.cpp b/src/libslic3r/Clipper2Utils.cpp index 29dc16dd65..40dd7cf323 100644 --- a/src/libslic3r/Clipper2Utils.cpp +++ b/src/libslic3r/Clipper2Utils.cpp @@ -13,9 +13,9 @@ Slic3r::Polylines Paths64_to_polylines(const Clipper2Lib::Paths64& in) Slic3r::Points points; points.reserve(path64.size()); for (const Clipper2Lib::Point64& point64 : path64) - points.emplace_back(std::move(Slic3r::Point(point64.x, point64.y))); - out.emplace_back(std::move(Slic3r::Polyline(points))); - } + points.emplace_back(Slic3r::Point(point64.x, point64.y)); + out.emplace_back(Slic3r::Polyline(points)); + } return out; } @@ -29,8 +29,8 @@ Clipper2Lib::Paths64 Slic3rPoints_to_Paths64(const std::vector& in) Clipper2Lib::Path64 path; path.reserve(item.size()); for (const Slic3r::Point& point : item.points) - path.emplace_back(std::move(Clipper2Lib::Point64(point.x(), point.y()))); - out.emplace_back(std::move(path)); + path.emplace_back(Clipper2Lib::Point64(point.x(), point.y())); + out.emplace_back(path); } return out; } @@ -39,7 +39,7 @@ Points Path64ToPoints(const Clipper2Lib::Path64& path64) { Points points; points.reserve(path64.size()); - for (const Clipper2Lib::Point64 &point64 : path64) points.emplace_back(std::move(Slic3r::Point(point64.x, point64.y))); + for (const Clipper2Lib::Point64 &point64 : path64) points.emplace_back(Slic3r::Point(point64.x, point64.y)); return points; } @@ -94,8 +94,8 @@ Clipper2Lib::Paths64 Slic3rPolygons_to_Paths64(const Polygons &in) for (const Polygon &poly : in) { Clipper2Lib::Path64 path; path.reserve(poly.points.size()); - for (const Slic3r::Point &point : poly.points) path.emplace_back(std::move(Clipper2Lib::Point64(point.x(), point.y()))); - out.emplace_back(std::move(path)); + for (const Slic3r::Point &point : poly.points) path.emplace_back(Clipper2Lib::Point64(point.x(), point.y())); + out.emplace_back(path); } return out; } @@ -109,8 +109,8 @@ Clipper2Lib::Paths64 Slic3rExPolygons_to_Paths64(const ExPolygons& in) const auto &poly = expolygon.contour_or_hole(i); Clipper2Lib::Path64 path; path.reserve(poly.points.size()); - for (const Slic3r::Point &point : poly.points) path.emplace_back(std::move(Clipper2Lib::Point64(point.x(), point.y()))); - out.emplace_back(std::move(path)); + for (const Slic3r::Point &point : poly.points) path.emplace_back(Clipper2Lib::Point64(point.x(), point.y())); + out.emplace_back(path); } } return out; @@ -129,8 +129,8 @@ Polylines _clipper2_pl_open(Clipper2Lib::ClipType clipType, const Slic3r::Polyli Slic3r::Polylines out; out.reserve(solution.size() + solution_open.size()); - polylines_append(out, std::move(Paths64_to_polylines(solution))); - polylines_append(out, std::move(Paths64_to_polylines(solution_open))); + polylines_append(out, Paths64_to_polylines(solution)); + polylines_append(out, Paths64_to_polylines(solution_open)); return out; } diff --git a/src/libslic3r/ClipperUtils.cpp b/src/libslic3r/ClipperUtils.cpp index d66abc109a..514fa31004 100644 --- a/src/libslic3r/ClipperUtils.cpp +++ b/src/libslic3r/ClipperUtils.cpp @@ -102,7 +102,7 @@ template inline void clip_clipper_polygon_with_subject_bbox_ } // Never produce just a single point output polygon. - if (!out.empty()) + if (!out.empty()) { if(get_entire_polygons){ out=src; }else{ @@ -114,6 +114,7 @@ template inline void clip_clipper_polygon_with_subject_bbox_ (sides_prev & sides_this & sides_next) == 0) out.emplace_back(src.back()); } + } } diff --git a/src/libslic3r/Config.cpp b/src/libslic3r/Config.cpp index b6300663bb..ddf801e839 100644 --- a/src/libslic3r/Config.cpp +++ b/src/libslic3r/Config.cpp @@ -1810,7 +1810,9 @@ const double& DynamicConfig::opt_float(const t_config_option_key &opt_key, unsig return opt_floats_nullable->get_at(idx); } else { assert(false); - return 0; + // return 0; // OLD: returned reference to temporary - crash! + static const double zero = 0.0; // Static lives forever + return zero; } } diff --git a/src/libslic3r/ExtrusionEntity.hpp b/src/libslic3r/ExtrusionEntity.hpp index c759d39abd..db8c75c3f2 100644 --- a/src/libslic3r/ExtrusionEntity.hpp +++ b/src/libslic3r/ExtrusionEntity.hpp @@ -699,7 +699,7 @@ inline void extrusion_entities_append_paths_with_wipe(ExtrusionEntitiesPtr &dst, multi_path->paths.back().polyline = std::move(connect_line); } else{ - multi_path->paths.back().polyline = std::move(Polyline(last_end_point, polyline.first_point())); + multi_path->paths.back().polyline = Polyline(last_end_point, polyline.first_point()); } } else { diff --git a/src/libslic3r/FilamentGroup.cpp b/src/libslic3r/FilamentGroup.cpp index f895156c2a..6d07d1a6f2 100644 --- a/src/libslic3r/FilamentGroup.cpp +++ b/src/libslic3r/FilamentGroup.cpp @@ -902,6 +902,7 @@ namespace Slic3r return calc_filament_group_for_match(cost); } catch (const FilamentGroupException& e) { + BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << ": FilamentGroupException in match mode: " << e.what(); } auto merged_map = try_merge_filaments(); diff --git a/src/libslic3r/Fill/Fill.cpp b/src/libslic3r/Fill/Fill.cpp index ab482b7a8d..af15ff4f64 100644 --- a/src/libslic3r/Fill/Fill.cpp +++ b/src/libslic3r/Fill/Fill.cpp @@ -762,6 +762,7 @@ Polylines Layer::generate_sparse_infill_polylines_for_anchoring(FillAdaptive::Oc case ipSupportCubic: case ipRectilinear: case ipMonotonic: + case ipMonotonicLine: case ipAlignedRectilinear: case ipGrid: case ipTriangles: @@ -769,14 +770,17 @@ Polylines Layer::generate_sparse_infill_polylines_for_anchoring(FillAdaptive::Oc case ipCubic: case ipLine: case ipConcentric: + case ipConcentricInternal: case ipHoneycomb: case ip3DHoneycomb: case ipGyroid: case ipHilbertCurve: case ipArchimedeanChords: case ipOctagramSpiral: + case ipCrossHatch: case ipZigZag: case ipCrossZag: + case ipFloatingConcentric: case ipLockedZag: break; } diff --git a/src/libslic3r/Fill/FillFloatingConcentric.cpp b/src/libslic3r/Fill/FillFloatingConcentric.cpp index 16875a7f11..dc6bcebdf7 100644 --- a/src/libslic3r/Fill/FillFloatingConcentric.cpp +++ b/src/libslic3r/Fill/FillFloatingConcentric.cpp @@ -75,7 +75,7 @@ static ExtrusionPaths floating_thick_polyline_to_extrusion_paths(const FloatingT path.height = new_flow.height(); }; - auto append_path_and_reset = [set_flow_for_path, role, &paths](double& length, double& sum, ExtrusionPath& path){ + auto append_path_and_reset = [role, &paths](double& length, double& sum, ExtrusionPath& path){ length = sum = 0; paths.emplace_back(std::move(path)); path = ExtrusionPath(role); diff --git a/src/libslic3r/Fill/FillFloatingConcentric.hpp b/src/libslic3r/Fill/FillFloatingConcentric.hpp index bb993ba636..b7b340f7b4 100644 --- a/src/libslic3r/Fill/FillFloatingConcentric.hpp +++ b/src/libslic3r/Fill/FillFloatingConcentric.hpp @@ -41,6 +41,8 @@ namespace Slic3r{ Polygons lower_sparse_polys; protected: + using FillConcentric::_fill_surface_single; + Fill* clone() const override { return new FillFloatingConcentric(*this); } #if 0 void _fill_surface_single( @@ -59,7 +61,7 @@ namespace Slic3r{ FloatingThickPolylines fill_surface_arachne_floating(const Surface* surface, const FillParams& params); - void fill_surface_extrusion(const Surface* surface, const FillParams& params, ExtrusionEntitiesPtr& out); + void fill_surface_extrusion(const Surface* surface, const FillParams& params, ExtrusionEntitiesPtr& out) override; FloatingThickPolylines resplit_order_loops(Point curr_point, std::vector all_extrusions, const ExPolygons& floating_areas, const Polygons& sparse_polys, const coord_t default_width); #if 0 diff --git a/src/libslic3r/Fill/FillRectilinear.cpp b/src/libslic3r/Fill/FillRectilinear.cpp index af78bf0478..e95ddae225 100644 --- a/src/libslic3r/Fill/FillRectilinear.cpp +++ b/src/libslic3r/Fill/FillRectilinear.cpp @@ -371,7 +371,7 @@ static void adjust_sort_for_segment_intersections(std::vector stack; bool has_out_low = false; - auto is_valid_type = [&stack, &has_out_low](IntersectionType type) { + auto is_valid_type = [&stack](IntersectionType type) { if (stack.empty()) { return type == IntersectionType::OUTER_LOW; } else { diff --git a/src/libslic3r/Fill/FillRectilinear.hpp b/src/libslic3r/Fill/FillRectilinear.hpp index ac877939bb..a2747e9bcf 100644 --- a/src/libslic3r/Fill/FillRectilinear.hpp +++ b/src/libslic3r/Fill/FillRectilinear.hpp @@ -179,7 +179,7 @@ class FillLockedZag : public FillRectilinear Polylines generate_skeleton_pattern(FillParams params, Surface surface, const ExPolygons &skeleton); Polylines generate_skin_pattern(FillParams params, Surface surface, const ExPolygons &skin); - void set_skin_and_skeleton_pattern(const InfillPattern &skin_pattern, const InfillPattern &skeleton_pattern){ + void set_skin_and_skeleton_pattern(const InfillPattern &skin_pattern, const InfillPattern &skeleton_pattern) override { this->skin_pattern = skin_pattern; this->skeleton_pattern = skeleton_pattern; }; diff --git a/src/libslic3r/FlushVolCalc.cpp b/src/libslic3r/FlushVolCalc.cpp index 675732d767..19bd29a2d1 100644 --- a/src/libslic3r/FlushVolCalc.cpp +++ b/src/libslic3r/FlushVolCalc.cpp @@ -39,8 +39,8 @@ static float DeltaHS_BBS(float h1, float s1, float v1, float h2, float s2, float return std::min(1.2f, dxy); } -FlushVolCalculator::FlushVolCalculator(int min, int max, int flush_dataset, float multiplier) - :m_min_flush_vol(min), m_max_flush_vol(max), m_multiplier(multiplier), m_flush_dataset(flush_dataset) +FlushVolCalculator::FlushVolCalculator(int min, int max, int flush_dataset) + :m_min_flush_vol(min), m_max_flush_vol(max), m_flush_dataset(flush_dataset) { } diff --git a/src/libslic3r/FlushVolCalc.hpp b/src/libslic3r/FlushVolCalc.hpp index 46d04d13ff..73baca5a89 100644 --- a/src/libslic3r/FlushVolCalc.hpp +++ b/src/libslic3r/FlushVolCalc.hpp @@ -15,7 +15,7 @@ extern const int g_max_flush_volume; class FlushVolCalculator { public: - FlushVolCalculator(int min, int max, int flush_dataset, float multiplier = 1.0f); + FlushVolCalculator(int min, int max, int flush_dataset); ~FlushVolCalculator() { } @@ -32,7 +32,6 @@ class FlushVolCalculator private: int m_min_flush_vol; int m_max_flush_vol; - float m_multiplier; int m_flush_dataset; }; diff --git a/src/libslic3r/Format/STEP.cpp b/src/libslic3r/Format/STEP.cpp index 4a8ed0fe53..2f74aa0ed7 100644 --- a/src/libslic3r/Format/STEP.cpp +++ b/src/libslic3r/Format/STEP.cpp @@ -136,11 +136,15 @@ bool StepPreProcessor::isGBK(const std::string str) { i++; continue; } else { - if (str[i] >= 0x81 && - str[i] <= 0xfe && - str[i + 1] >= 0x40 && - str[i + 1] <= 0xfe && - str[i + 1] != 0xf7) { + // Cast to unsigned char for proper byte value comparison (GBK encoding uses 0x81-0xFE) + // if (str[i] >= 0x81 && // OLD: signed char comparison always false/true + unsigned char byte1 = static_cast(str[i]); + unsigned char byte2 = static_cast(str[i + 1]); + if (byte1 >= 0x81 && + byte1 <= 0xfe && + byte2 >= 0x40 && + byte2 <= 0xfe && + byte2 != 0xf7) { i += 2; continue; } @@ -583,7 +587,7 @@ Step::Step_Status Step::mesh(Model* model, for (Standard_Integer aNodeIter = 1; aNodeIter <= aTriangulation->NbNodes(); ++aNodeIter) { gp_Pnt aPnt = aTriangulation->Node(aNodeIter); aPnt.Transform(aTrsf); - points.emplace_back(std::move(Vec3f(aPnt.X(), aPnt.Y(), aPnt.Z()))); + points.emplace_back(Vec3f(aPnt.X(), aPnt.Y(), aPnt.Z())); } // BBS: copy triangles const TopAbs_Orientation anOrientation = anExpSF.Current().Orientation(); diff --git a/src/libslic3r/Format/bbs_3mf.cpp b/src/libslic3r/Format/bbs_3mf.cpp index a3ddd6d47a..24eb475eac 100644 --- a/src/libslic3r/Format/bbs_3mf.cpp +++ b/src/libslic3r/Format/bbs_3mf.cpp @@ -4839,7 +4839,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) its.vertices.assign(sub_object->geometry.vertices.begin(), sub_object->geometry.vertices.end()); // BBS - for (const std::string prop_str : sub_object->geometry.face_properties) { + for (const std::string& prop_str : sub_object->geometry.face_properties) { FaceProperty face_prop; face_prop.from_string(prop_str); its.properties.push_back(face_prop); @@ -5021,7 +5021,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) its.vertices.assign(geometry.vertices.begin() + min_id, geometry.vertices.begin() + max_id + 1); // BBS - for (const std::string prop_str : geometry.face_properties) { + for (const std::string& prop_str : geometry.face_properties) { FaceProperty face_prop; face_prop.from_string(prop_str); its.properties.push_back(face_prop); @@ -8455,7 +8455,7 @@ class _BBS_Backup_Manager auto model = object.get_model(); auto o = m_temp_model.add_object(object); int backup_id = model->get_object_backup_id(object); - push_task({ AddObject, (size_t) backup_id, object.get_model()->get_backup_path(), o, 1 }); + push_task({ AddObject, (size_t) backup_id, object.get_model()->get_backup_path(), o, {1} }); } void remove_object_mesh(ModelObject& object) { @@ -8465,7 +8465,7 @@ class _BBS_Backup_Manager void backup_soon() { boost::lock_guard lock(m_mutex); m_other_changes_backup = true; - m_tasks.push_back({ Backup, 0, std::string(), nullptr, ++m_task_seq }); + m_tasks.push_back({ Backup, 0, std::string(), nullptr, {++m_task_seq} }); m_cond.notify_all(); } @@ -8482,7 +8482,7 @@ class _BBS_Backup_Manager m_ui_tasks.clear(); m_tasks.clear(); } - m_tasks.push_back({ RemoveBackup, model.id().id, model.get_backup_path(), nullptr, removeAll }); + m_tasks.push_back({ RemoveBackup, model.id().id, model.get_backup_path(), nullptr, {removeAll} }); ++m_task_seq; if (model.is_need_backup()) { m_other_changes = false; @@ -8583,7 +8583,7 @@ class _BBS_Backup_Manager BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " inital and interval = " << m_interval; m_next_backup = boost::get_system_time() + boost::posix_time::seconds(m_interval); boost::unique_lock lock(m_mutex); - m_thread = std::move(boost::thread(boost::ref(*this))); + m_thread = boost::thread(boost::ref(*this)); } ~_BBS_Backup_Manager() { @@ -8648,6 +8648,13 @@ class _BBS_Backup_Manager } } break; + case None: + case RemoveObject: + case Exit: + default: + // None/Exit should be filtered before reaching here, RemoveObject handled in worker thread + BOOST_LOG_TRIVIAL(warning) << "process_ui_task: Unexpected task type " << t.to_string(); + break; } } @@ -8684,6 +8691,12 @@ class _BBS_Backup_Manager } catch (...) {} } + case None: + case Exit: + default: + // None is no-op, Exit handled before reaching here + BOOST_LOG_TRIVIAL(warning) << "process_task: Unexpected task type " << t.to_string(); + break; } } @@ -8698,7 +8711,7 @@ class _BBS_Backup_Manager else m_cond.wait(lock); if (m_interval > 0 && boost::get_system_time() > m_next_backup) { - m_tasks.push_back({ Backup, 0, std::string(), nullptr, ++m_task_seq }); + m_tasks.push_back({ Backup, 0, std::string(), nullptr, {++m_task_seq} }); m_next_backup += boost::posix_time::seconds(m_interval); // Maybe wakeup from power sleep if (m_next_backup < boost::get_system_time()) diff --git a/src/libslic3r/Format/svg.cpp b/src/libslic3r/Format/svg.cpp index 7bfd73b987..7b720e62ef 100644 --- a/src/libslic3r/Format/svg.cpp +++ b/src/libslic3r/Format/svg.cpp @@ -352,7 +352,7 @@ bool load_svg(const char *path, Model *model, std::string &message) for (Standard_Integer aNodeIter = 1; aNodeIter <= aTriangulation->NbNodes(); ++aNodeIter) { gp_Pnt aPnt = aTriangulation->Node(aNodeIter); aPnt.Transform(aTrsf); - points.emplace_back(std::move(Vec3f(aPnt.X(), aPnt.Y(), aPnt.Z()))); + points.emplace_back(Vec3f(aPnt.X(), aPnt.Y(), aPnt.Z())); } // BBS: copy triangles const TopAbs_Orientation anOrientation = anExpSF.Current().Orientation(); diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index e111681257..48e8cdb4f8 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -3175,7 +3175,7 @@ void GCode::process_layers( print.throw_if_canceled(); GCode::LayerResult res = this->process_layer(print, layer.second, layer_tools, &layer == &layers_to_print.back(), &print_object_instances_ordering, tool_ordering.get_most_used_extruder(), size_t(-1)); res.gcode_store_pos = layer_to_print_idx - 1; - return std::move(res); + return res; } }); if (m_spiral_vase) { @@ -3196,7 +3196,7 @@ void GCode::process_layers( [&gcode_editer = *this->m_gcode_editer.get(), &layers_extruder_adjustments, object_label](GCode::LayerResult in) -> GCode::LayerResult{ //record gcode in.gcode = gcode_editer.process_layer(std::move(in.gcode), in.not_set_additional_fan, in.layer_id, layers_extruder_adjustments[in.gcode_store_pos], object_label, in.cooling_buffer_flush, false); - return std::move(in); + return in; }); //step2: cooling @@ -3207,7 +3207,7 @@ void GCode::process_layers( const auto cooling = tbb::make_filter(slic3r_tbb_filtermode::serial_in_order, [&cooling_processor, &layers_extruder_adjustments](GCode::LayerResult in) -> GCode::LayerResult { in.layer_time = cooling_processor.calculate_layer_slowdown(layers_extruder_adjustments[in.gcode_store_pos]); - return std::move(in); + return in; }); // step 4.1: record node date @@ -3314,7 +3314,7 @@ void GCode::process_layers( print.throw_if_canceled(); GCode::LayerResult res = this->process_layer(print, {std::move(layer)}, tool_ordering.tools_for_layer(layer.print_z()), &layer == &layers_to_print.back(), nullptr, tool_ordering.get_most_used_extruder(), single_object_idx, prime_extruder); res.gcode_store_pos = layer_to_print_idx - 1; - return std::move(res); + return res; } }); if (m_spiral_vase) { @@ -3339,7 +3339,7 @@ void GCode::process_layers( [&gcode_editer = *this->m_gcode_editer.get(), &layers_extruder_adjustments, object_label](GCode::LayerResult in) -> GCode::LayerResult{ //record gcode in.gcode = gcode_editer.process_layer(std::move(in.gcode), in.not_set_additional_fan, in.layer_id, layers_extruder_adjustments[in.gcode_store_pos], object_label, in.cooling_buffer_flush, false); - return std::move(in); + return in; }); // step 3: cooling @@ -3349,7 +3349,7 @@ void GCode::process_layers( const auto cooling = tbb::make_filter(slic3r_tbb_filtermode::serial_in_order, [&cooling_processor, &layers_extruder_adjustments](GCode::LayerResult in) -> GCode::LayerResult { in.layer_time = cooling_processor.calculate_layer_slowdown(layers_extruder_adjustments[in.gcode_store_pos]); - return std::move(in); + return in; }); // step 4.1: record node date @@ -5514,7 +5514,7 @@ void GCode::split_and_mapping_speed(double other_path_v, double final_v, Extrusi }; //check line length - auto length_enough = [this](double length) { + auto length_enough = [](double length) { if (length < min_step_length || length - min_step_length < min_step_length / 2) return false; @@ -5699,7 +5699,7 @@ ExtrusionPaths GCode::set_speed_transition(std::vector &paths) continue; } // get smooth length - auto get_path_length = [this](ExtrusionPaths path) { + auto get_path_length = [](ExtrusionPaths path) { return std::accumulate(path.begin(), path.end(), 0.0, [](double sum, const ExtrusionPath &p) { return sum + p.length(); }); }; @@ -6476,7 +6476,7 @@ bool GCode::needs_retraction(const Polyline &travel, ExtrusionRole role, LiftTyp continue; Polygons temp; - temp.emplace_back(std::move(instance_bbox.polygon())); + temp.emplace_back(instance_bbox.polygon()); if (intersection_pl(travel, temp).empty()) continue; diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index e4565a9fa3..b6dd2e9db9 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -785,7 +785,7 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st // 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(*this), // Caches, to be modified &g1_times_cache_it, &last_exported_main, &last_exported_stop @@ -948,8 +948,8 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st auto handle_filament_change = [&filament_blocks,&machine_start_gcode_end_line_id,&machine_end_gcode_start_line_id](int filament_id,int line_id){ // skip the filaments change in machine start/end gcode - if (machine_start_gcode_end_line_id == (unsigned int)(-1) && (unsigned int)(line_id)machine_end_gcode_start_line_id) + if ((machine_start_gcode_end_line_id == (unsigned int)(-1) && (unsigned int)(line_id)machine_end_gcode_start_line_id)) return; if (!filament_blocks.empty()) @@ -957,7 +957,7 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st filament_blocks.emplace_back(filament_id, line_id, -1); }; - auto gcode_time_handler = [&temp_construct_block,&filament_blocks, &extruder_blocks, &offsets, &handle_nozzle_change_line , & process_placeholders, &is_temporary_decoration, & process_line_move, & g1_lines_counter, & machine_start_gcode_end_line_id, & machine_end_gcode_start_line_id,handle_filament_change](std::string& gcode_line, std::string& gcode_buffer, int line_id) { + auto gcode_time_handler = [&temp_construct_block, &extruder_blocks, &offsets, &handle_nozzle_change_line , & process_placeholders, &is_temporary_decoration, & process_line_move, & g1_lines_counter, handle_filament_change](std::string& gcode_line, std::string& gcode_buffer, int line_id) { auto [processed, lines_added_count] = process_placeholders(gcode_line,line_id); if (processed && lines_added_count > 0) offsets.push_back({ line_id, lines_added_count }); @@ -1103,7 +1103,6 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st auto pre_cooling_injector = std::make_unique( moves, - context.filament_types, context.filament_maps, context.filament_nozzle_temp, context.filament_nozzle_temp, @@ -1684,7 +1683,7 @@ bool GCodeProcessor::check_multi_extruder_gcode_valid(const int std::map> gcode_path_pos; // object_id, filament_id, pos for (const GCodeProcessorResult::MoveVertex &move : m_result.moves) { // sometimes, the start line extrude was outside the edge of plate a little, this is allowed, so do not include into the gcode_path_pos - if (move.type == EMoveType::Extrude && move.extrusion_role != ExtrusionRole::erFlush /* || move.type == EMoveType::Travel*/) + if (move.type == EMoveType::Extrude && move.extrusion_role != ExtrusionRole::erFlush /* || move.type == EMoveType::Travel*/) { if (move.extrusion_role == ExtrusionRole::erCustom) { if (move.is_arc_move_with_interpolation_points()) { for (int i = 0; i < move.interpolation_points.size(); i++) { @@ -1706,6 +1705,7 @@ bool GCodeProcessor::check_multi_extruder_gcode_valid(const int gcode_path_pos[move.object_label_id][int(move.extruder_id)].max_print_z = std::max(gcode_path_pos[move.object_label_id][int(move.extruder_id)].max_print_z, move.print_z); } + } } bool valid = true; @@ -3801,7 +3801,7 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line) float filament_diameter = (static_cast(filament_id) < m_result.filament_diameters.size()) ? m_result.filament_diameters[filament_id] : m_result.filament_diameters.back(); 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); @@ -4203,7 +4203,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); @@ -4587,7 +4587,7 @@ void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line) float filament_diameter = (static_cast(filament_id) < m_result.filament_diameters.size()) ? m_result.filament_diameters[filament_id] : m_result.filament_diameters.back(); 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& lineG2_3) { + auto absolute_position = [this](Axis axis, const GCodeReader::GCodeLine& lineG2_3) { bool is_relative = (m_global_positioning_type == EPositioningType::Relative); if (axis == E) is_relative |= (m_e_local_positioning_type == EPositioningType::Relative); @@ -4612,7 +4612,7 @@ void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line) } }; - auto move_type = [this](const float& delta_E) { + auto move_type = [](const float& delta_E) { if (delta_E == 0.0f) return EMoveType::Travel; else @@ -6195,7 +6195,7 @@ int GCodeProcessor::get_config_idx_for_filament(int filament_idx) const void GCodeProcessor::PreCoolingInjector::process_pre_cooling_and_heating(TimeProcessor::InsertedLinesMap& inserted_operation_lines) { bool is_multiple_nozzle = std::any_of(extruder_max_nozzle_count.begin(), extruder_max_nozzle_count.end(), [](auto& elem) {return elem > 1; }); - auto get_nozzle_temp = [this, is_multiple_nozzle](int filament_id, bool is_first_layer, bool from_or_to, bool consider_cooling_before_tower) { + auto get_nozzle_temp = [this](int filament_id, bool is_first_layer, bool from_or_to, bool consider_cooling_before_tower) { if (filament_id == -1) return from_or_to ? 140 : 0; // default temp double temp = (is_first_layer ? filament_nozzle_temps_initial_layer[filament_id] : filament_nozzle_temps[filament_id]); diff --git a/src/libslic3r/GCode/GCodeProcessor.hpp b/src/libslic3r/GCode/GCodeProcessor.hpp index f455608ccf..b9fc5dc71b 100644 --- a/src/libslic3r/GCode/GCodeProcessor.hpp +++ b/src/libslic3r/GCode/GCodeProcessor.hpp @@ -850,7 +850,6 @@ namespace Slic3r { PreCoolingInjector( const std::vector& moves_, - const std::vector& filament_types_, const std::vector& filament_maps_, const std::vector& filament_nozzle_temps_, const std::vector& filament_nozzle_temps_initial_layer_, @@ -867,7 +866,6 @@ namespace Slic3r { unsigned int machine_end_gcode_start_id_ ) : moves(moves_), - filament_types(filament_types_), filament_maps(filament_maps_), filament_nozzle_temps(filament_nozzle_temps_), filament_nozzle_temps_initial_layer(filament_nozzle_temps_initial_layer_), @@ -888,7 +886,6 @@ namespace Slic3r { private: std::vector m_extruder_free_blocks; const std::vector& moves; - const std::vector& filament_types; const std::vector& filament_maps; const std::vector& filament_nozzle_temps; const std::vector& filament_nozzle_temps_initial_layer; diff --git a/src/libslic3r/GCode/PostProcessor.cpp b/src/libslic3r/GCode/PostProcessor.cpp index e2ed3ed04f..e55acb563f 100644 --- a/src/libslic3r/GCode/PostProcessor.cpp +++ b/src/libslic3r/GCode/PostProcessor.cpp @@ -214,7 +214,7 @@ void gcode_add_line_number(const std::string& path, const DynamicPrintConfig& co while (std::getline(fs, gcode_line)) { char num_str[128]; memset(num_str, 0, sizeof(num_str)); - snprintf(num_str, sizeof(num_str), "%d", line_number); + snprintf(num_str, sizeof(num_str), "%zu", line_number); new_gcode += std::string("N") + num_str + " " + gcode_line + "\n"; line_number++; } diff --git a/src/libslic3r/GCode/TimelapsePosPicker.cpp b/src/libslic3r/GCode/TimelapsePosPicker.cpp index 345a7edda1..a5debc4f1f 100644 --- a/src/libslic3r/GCode/TimelapsePosPicker.cpp +++ b/src/libslic3r/GCode/TimelapsePosPicker.cpp @@ -381,7 +381,8 @@ namespace Slic3r { std::priority_queue max_heap; constexpr double candidate_point_segment = scale_(5), weight_of_camera=1./3.; - auto penaltyFunc = [&weight_of_camera](const Point &curr_post, const Point &CameraPos, const Point &candidatet) -> double { + auto penaltyFunc = [](const Point &curr_post, const Point &CameraPos, const Point &candidatet) -> double { + constexpr double weight_of_camera = 1./3.; // move distance + Camera occlusion penalty function double ret_pen = (curr_post - candidatet).cwiseAbs().sum() - weight_of_camera * (CameraPos - candidatet).cwiseAbs().sum(); return ret_pen; diff --git a/src/libslic3r/GCode/WipeTower.cpp b/src/libslic3r/GCode/WipeTower.cpp index 7308e14f76..d0e55d83a8 100644 --- a/src/libslic3r/GCode/WipeTower.cpp +++ b/src/libslic3r/GCode/WipeTower.cpp @@ -3697,7 +3697,7 @@ void WipeTower::toolchange_wipe_new(WipeTowerWriter &writer, const box_coordinat bool is_from_up = (m_cur_layer_id % 2 == 1); - auto estimate_wipe_time = [&cleaning_box, &target_speed, &x_to_wipe, &xr, &xl,&dy, &WipeSpeedMap, &solid_tool_toolchange]() -> float { + auto estimate_wipe_time = [&cleaning_box, &x_to_wipe, &xr, &xl,&dy, &WipeSpeedMap, &solid_tool_toolchange]() -> 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 one_line_len = xr - xl; @@ -4448,9 +4448,7 @@ void WipeTower::generate_new(std::vector 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/GCodeWriter.cpp b/src/libslic3r/GCodeWriter.cpp index 93d8e44f96..04efcdd63f 100644 --- a/src/libslic3r/GCodeWriter.cpp +++ b/src/libslic3r/GCodeWriter.cpp @@ -835,7 +835,7 @@ std::string GCodeWriter::unretract() double GCodeWriter::get_extruder_retracted_length(const int filament_id) { double res = 0.0; - auto filament_extruder_iter = Slic3r::lower_bound_by_predicate(m_filament_extruders.begin(), m_filament_extruders.end(), [filament_id](const Extruder &e) { return e.id() < filament_id; }); + auto filament_extruder_iter = Slic3r::lower_bound_by_predicate(m_filament_extruders.begin(), m_filament_extruders.end(), [filament_id](const Extruder &e) { return static_cast(e.id()) < filament_id; }); assert(filament_extruder_iter != m_filament_extruders.end() && filament_extruder_iter->id() == filament_id); if (filament_extruder_iter->is_share_extruder()) diff --git a/src/libslic3r/GCodeWriter.hpp b/src/libslic3r/GCodeWriter.hpp index 70330e6764..29a90cf79c 100644 --- a/src/libslic3r/GCodeWriter.hpp +++ b/src/libslic3r/GCodeWriter.hpp @@ -146,7 +146,6 @@ class GCodeWriter { double m_last_jerk; double m_max_jerk; //BBS - unsigned int m_last_additional_fan_speed; int m_last_bed_temperature; bool m_last_bed_temperature_reached; double m_lifted; diff --git a/src/libslic3r/Geometry/MedialAxis.cpp b/src/libslic3r/Geometry/MedialAxis.cpp index 44eccd9851..f59d6f9b49 100644 --- a/src/libslic3r/Geometry/MedialAxis.cpp +++ b/src/libslic3r/Geometry/MedialAxis.cpp @@ -443,7 +443,7 @@ class Lines2VDSegments }; MedialAxis::MedialAxis(double min_width, double max_width, const ExPolygon &expolygon) : - m_expolygon(expolygon), m_lines(expolygon.lines()), m_min_width(min_width), m_max_width(max_width) + m_lines(expolygon.lines()), m_min_width(min_width), m_max_width(max_width) {} void MedialAxis::build(ThickPolylines* polylines) diff --git a/src/libslic3r/Geometry/MedialAxis.hpp b/src/libslic3r/Geometry/MedialAxis.hpp index b1354ddb2f..e47d36deef 100644 --- a/src/libslic3r/Geometry/MedialAxis.hpp +++ b/src/libslic3r/Geometry/MedialAxis.hpp @@ -14,7 +14,6 @@ class MedialAxis { private: // Input - const ExPolygon &m_expolygon; Lines m_lines; // for filtering of the skeleton edges double m_min_width; diff --git a/src/libslic3r/Interlocking/InterlockingGenerator.cpp b/src/libslic3r/Interlocking/InterlockingGenerator.cpp index 070701ab7e..66d8405f23 100644 --- a/src/libslic3r/Interlocking/InterlockingGenerator.cpp +++ b/src/libslic3r/Interlocking/InterlockingGenerator.cpp @@ -24,24 +24,29 @@ template<> struct hash namespace Slic3r { + +namespace { + // File-scope constants to avoid lambda capture issues across compilers (MSVC vs Clang) + constexpr int INTERFACE_DEPTH = 2; + constexpr int BOUNDARY_AVOIDANCE = 2; + constexpr coord_t DEFAULT_BEAM_WIDTH = scaled(0.2); // 例如默认2mm + constexpr coord_t BEAM_WIDTH = DEFAULT_BEAM_WIDTH; + constexpr bool AIR_FILTERING = BOUNDARY_AVOIDANCE > 0; +} + void InterlockingGenerator::generate_embedding_wall(PrintObject* print_object){ //params - const int interface_depth = 2; - const int boundary_avoidance = 2; - constexpr coord_t DEFAULT_BEAM_WIDTH = scaled(0.2); // 例如默认2mm - const coord_t beam_width = DEFAULT_BEAM_WIDTH; - - const DilationKernel interface_dilation(GridPoint3(interface_depth, interface_depth, interface_depth), DilationKernel::Type::PRISM); - const bool air_filtering = boundary_avoidance > 0; - const DilationKernel air_dilation(GridPoint3(boundary_avoidance, boundary_avoidance, boundary_avoidance), DilationKernel::Type::PRISM); + const DilationKernel interface_dilation(GridPoint3(INTERFACE_DEPTH, INTERFACE_DEPTH, INTERFACE_DEPTH), DilationKernel::Type::PRISM); + const DilationKernel air_dilation(GridPoint3(BOUNDARY_AVOIDANCE, BOUNDARY_AVOIDANCE, BOUNDARY_AVOIDANCE), DilationKernel::Type::PRISM); - const coord_t cell_width = beam_width + beam_width; + const coord_t cell_width = BEAM_WIDTH + BEAM_WIDTH; const Vec3crd cell_size(cell_width, cell_width, 2); //generator + // Note: Variables changed to constexpr to avoid lambda capture issues across compilers tbb::parallel_for( tbb::blocked_range(0, print_object->layers().size()), - [print_object, beam_width, boundary_avoidance, cell_size, interface_dilation, air_dilation, air_filtering](const tbb::blocked_range& range) { + [print_object, cell_size, interface_dilation, air_dilation](const tbb::blocked_range& range) { for (size_t i = range.begin(); i != range.end(); ++i) { Layer* layer = print_object->layers()[i]; if (layer->id() % 2 == 0) @@ -58,8 +63,8 @@ void InterlockingGenerator::generate_embedding_wall(PrintObject* print_object){ continue; } //has embedding part - InterlockingGenerator gen(*print_object, region_a_index, region_b_index, beam_width, boundary_avoidance, 0, cell_size, 1, - interface_dilation, air_dilation, air_filtering); + InterlockingGenerator gen(*print_object, region_a_index, region_b_index, BEAM_WIDTH, BOUNDARY_AVOIDANCE, 0, cell_size, 1, + interface_dilation, air_dilation, AIR_FILTERING); gen.generateInterlockingwall(layer); } } diff --git a/src/libslic3r/JumpPointSearch.cpp b/src/libslic3r/JumpPointSearch.cpp index f8ef2ff100..43391133e9 100644 --- a/src/libslic3r/JumpPointSearch.cpp +++ b/src/libslic3r/JumpPointSearch.cpp @@ -279,7 +279,7 @@ Polyline JPSPathFinder::find_path(const Point &p0, const Point &p1) return r; }; auto scaled_point = [](const Point &p) { return Point::new_scale(p.x(), p.y()); }; - ::Slic3r::SVG svg(debug_out_path(("path_jps" + std::to_string(print_z) + "_" + std::to_string(rand() % 1000)).c_str()).c_str(), + ::Slic3r::SVG svg(debug_out_path(("path_jps_" + std::to_string(rand() % 1000)).c_str()).c_str(), BoundingBox(scaled_point(search_box.min), scaled_point(search_box.max))); for (const auto &p : inpassable) { svg.draw(scaled_point(p), "black", scale_(0.4)); } for (const auto &qn : astar_cache) { svg.draw(scaled_point(qn.second.node.position), "blue", scale_(0.3)); } diff --git a/src/libslic3r/JumpPointSearch.hpp b/src/libslic3r/JumpPointSearch.hpp index 86eeb9ce6a..fdc1c6974b 100644 --- a/src/libslic3r/JumpPointSearch.hpp +++ b/src/libslic3r/JumpPointSearch.hpp @@ -17,7 +17,6 @@ class JPSPathFinder { using Pixel = Point; std::unordered_set inpassable; - coordf_t print_z; BoundingBox max_search_box; Lines bed_shape; diff --git a/src/libslic3r/Layer.cpp b/src/libslic3r/Layer.cpp index 0b304d0500..2d51ff76e8 100644 --- a/src/libslic3r/Layer.cpp +++ b/src/libslic3r/Layer.cpp @@ -9,7 +9,11 @@ #include #include "PerimeterGenerator.hpp" static const int Continuitious_length = scale_(0.01); -static const int dist_scale_threshold = 1.2; +// TODO: INVESTIGATE POTENTIAL BUG - Original value was 1.2, but declared as int (truncates to 1) +// Used at line 326: width = prev_width * dist_scale_threshold +// Should this be double with value 1.2, or int with value 1? +// static const int dist_scale_threshold = 1.2; // OLD - implicit conversion warning +static const int dist_scale_threshold = 1; namespace Slic3r { diff --git a/src/libslic3r/MeshBoolean.cpp b/src/libslic3r/MeshBoolean.cpp index a7071d6585..6f9b0dc9c1 100644 --- a/src/libslic3r/MeshBoolean.cpp +++ b/src/libslic3r/MeshBoolean.cpp @@ -352,7 +352,7 @@ void segment(CGALMesh& src, std::vector& dst, double smoothing_alpha = //} //else { - dst.emplace_back(std::move(CGALMesh(out))); + dst.emplace_back(CGALMesh(out)); } } //if (mesh_merged.is_empty() == false) { @@ -371,7 +371,7 @@ std::vector segment(const TriangleMesh& src, double smoothing_alph std::vector out_meshes; for (auto& outf_cgal_mesh: out_cgal_meshes) { - out_meshes.emplace_back(std::move(cgal_to_triangle_mesh(outf_cgal_mesh.m))); + out_meshes.emplace_back(cgal_to_triangle_mesh(outf_cgal_mesh.m)); } return out_meshes; @@ -589,6 +589,9 @@ MCAPI_ATTR void MCAPI_CALL mcDebugOutput(McDebugSource source, case MC_DEBUG_SOURCE_KERNEL: BOOST_LOG_TRIVIAL(debug)<<("Source: Kernel"); break; + default: + BOOST_LOG_TRIVIAL(debug) << "Source: Other/Unknown (" << static_cast(source) << ")"; + break; } switch (type) { @@ -601,6 +604,9 @@ MCAPI_ATTR void MCAPI_CALL mcDebugOutput(McDebugSource source, case MC_DEBUG_TYPE_OTHER: BOOST_LOG_TRIVIAL(debug)<<("Type: Other"); break; + default: + BOOST_LOG_TRIVIAL(debug) << "Type: Unknown (" << static_cast(type) << ")"; + break; } switch (severity) { @@ -616,6 +622,9 @@ MCAPI_ATTR void MCAPI_CALL mcDebugOutput(McDebugSource source, case MC_DEBUG_SEVERITY_NOTIFICATION: BOOST_LOG_TRIVIAL(debug)<<("Severity: notification"); break; + default: + BOOST_LOG_TRIVIAL(debug) << "Severity: Unknown (" << static_cast(severity) << ")"; + break; } } @@ -710,7 +719,7 @@ bool do_boolean_single(McutMesh &srcMesh, const McutMesh &cutMesh, const std::st McutMesh outMesh; int N_vertices = 0; // traversal of all connected components - for (int n = 0; n < numConnComps; ++n) { + for (uint32_t n = 0; n < numConnComps; ++n) { if (cancel_cb && cancel_cb()) { return false; } diff --git a/src/libslic3r/MeshSplitImpl.hpp b/src/libslic3r/MeshSplitImpl.hpp index ca94cd2fec..4d4c72fdf6 100644 --- a/src/libslic3r/MeshSplitImpl.hpp +++ b/src/libslic3r/MeshSplitImpl.hpp @@ -78,7 +78,7 @@ struct NeighborVisitor { // If initialized with &&neighbor_index, take the ownership of the data. const NeighborIndex m_neighbor_index_data; - std::vector m_visited; + std::vector m_visited; using stack_el = size_t; std::vector m_facestack; diff --git a/src/libslic3r/Model.cpp b/src/libslic3r/Model.cpp index 950b10578f..3411c8a834 100644 --- a/src/libslic3r/Model.cpp +++ b/src/libslic3r/Model.cpp @@ -804,7 +804,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 @@ -1186,7 +1186,8 @@ ModelObject& ModelObject::assign_copy(ModelObject &&rhs) this->sla_support_points = std::move(rhs.sla_support_points); this->sla_points_status = std::move(rhs.sla_points_status); this->sla_drain_holes = std::move(rhs.sla_drain_holes); - this->brim_points = std::move(brim_points); + // this->brim_points = std::move(brim_points); // OLD: self-move! Missing rhs. prefix + this->brim_points = std::move(rhs.brim_points); this->layer_config_ranges = std::move(rhs.layer_config_ranges); this->layer_height_profile = std::move(rhs.layer_height_profile); this->printable = std::move(rhs.printable); @@ -4031,7 +4032,7 @@ double getadhesionCoeff(const ModelVolumePtrs objectVolumes) { double adhesionCoeff = 1; for (const ModelVolume* modelVolume : objectVolumes) { - if (Model::extruderParamsMap.find(modelVolume->extruder_id()) != Model::extruderParamsMap.end()) + if (Model::extruderParamsMap.find(modelVolume->extruder_id()) != Model::extruderParamsMap.end()) { if (Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "PETG" || Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "PCTG") { adhesionCoeff = 2; @@ -4039,6 +4040,7 @@ double getadhesionCoeff(const ModelVolumePtrs objectVolumes) else if (Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "TPU" || Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "TPU-AMS") { adhesionCoeff = 0.5; } + } } return adhesionCoeff; } diff --git a/src/libslic3r/MultiMaterialSegmentation.cpp b/src/libslic3r/MultiMaterialSegmentation.cpp index 5f139819da..fc824ba0cb 100644 --- a/src/libslic3r/MultiMaterialSegmentation.cpp +++ b/src/libslic3r/MultiMaterialSegmentation.cpp @@ -34,6 +34,11 @@ namespace Slic3r { using boost::polygon::voronoi_diagram; +namespace { + // File-scope constant to avoid lambda capture issues across compilers (MSVC vs Clang) + constexpr size_t FUZZY_SKIN_NUM_EXTRUDERS = 1; +} + static inline Point mk_point(const Voronoi::VD::vertex_type *point) { return {coord_t(point->x()), coord_t(point->y())}; } static inline Point mk_point(const Voronoi::Internal::point_type &point) { return {coord_t(point.x()), coord_t(point.y())}; } @@ -2337,10 +2342,9 @@ std::vector> multi_material_segmentation_by_painting(con std::vector> fuzzy_skin_segmentation_by_painting(const PrintObject &print_object, const std::function &throw_on_cancel_callback) { - const size_t num_extruders = 1; const size_t num_layers = print_object.layers().size(); std::vector> segmented_regions(num_layers); - segmented_regions.assign(num_layers, std::vector(num_extruders + 1)); + segmented_regions.assign(num_layers, std::vector(FUZZY_SKIN_NUM_EXTRUDERS + 1)); std::vector> painted_lines(num_layers); std::array painted_lines_mutex; std::vector edge_grids(num_layers); @@ -2407,11 +2411,11 @@ std::vector> fuzzy_skin_segmentation_by_painting(const P BOOST_LOG_TRIVIAL(debug) << "MM segmentation - projection of painted triangles - begin"; for (const ModelVolume *mv : print_object.model_object()->volumes) { #ifndef MM_SEGMENTATION_DEBUG_PAINT_LINE - tbb::parallel_for(tbb::blocked_range(1, num_extruders + 1), [&mv, &print_object, &layers, &edge_grids, &painted_lines, &painted_lines_mutex, &input_expolygons, + tbb::parallel_for(tbb::blocked_range(1, FUZZY_SKIN_NUM_EXTRUDERS + 1), [&mv, &print_object, &layers, &edge_grids, &painted_lines, &painted_lines_mutex, &input_expolygons, &throw_on_cancel_callback](const tbb::blocked_range &range) { for (size_t extruder_idx = range.begin(); extruder_idx < range.end(); ++extruder_idx) { #else - for (size_t extruder_idx = 1; extruder_idx < num_extruders + 1; ++extruder_idx) { + for (size_t extruder_idx = 1; extruder_idx < FUZZY_SKIN_NUM_EXTRUDERS + 1; ++extruder_idx) { #endif throw_on_cancel_callback(); const indexed_triangle_set custom_facets = mv->fuzzy_skin_facets.get_facets(*mv, EnforcerBlockerType(extruder_idx)); @@ -2505,7 +2509,8 @@ std::vector> fuzzy_skin_segmentation_by_painting(const P << std::count_if(painted_lines.begin(), painted_lines.end(), [](const std::vector &pl) { return !pl.empty(); }); BOOST_LOG_TRIVIAL(debug) << "MM segmentation - layers segmentation in parallel - begin"; - tbb::parallel_for(tbb::blocked_range(0, num_layers), [&edge_grids, &input_expolygons, &painted_lines, &segmented_regions, &num_extruders, + // Note: FUZZY_SKIN_NUM_EXTRUDERS moved to file scope to avoid lambda capture issues across compilers + tbb::parallel_for(tbb::blocked_range(0, num_layers), [&edge_grids, &input_expolygons, &painted_lines, &segmented_regions, &throw_on_cancel_callback](const tbb::blocked_range &range) { for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++layer_idx) { throw_on_cancel_callback(); @@ -2537,7 +2542,7 @@ std::vector> fuzzy_skin_segmentation_by_painting(const P MMU_Graph graph = build_graph(layer_idx, color_poly); remove_multiple_edges_in_vertices(graph, color_poly); graph.remove_nodes_with_one_arc(); - segmented_regions[layer_idx] = extract_colored_segments(graph, num_extruders); + segmented_regions[layer_idx] = extract_colored_segments(graph, FUZZY_SKIN_NUM_EXTRUDERS); // segmented_regions[layer_idx] = extract_colored_segments(color_poly, num_extruders, layer_idx); } diff --git a/src/libslic3r/MultiNozzleUtils.cpp b/src/libslic3r/MultiNozzleUtils.cpp index 9d945cb44a..92f35171be 100644 --- a/src/libslic3r/MultiNozzleUtils.cpp +++ b/src/libslic3r/MultiNozzleUtils.cpp @@ -399,7 +399,7 @@ std::vector MultiNozzleGroupResult::get_extruder_map(bool zero_based) const return filament_map; auto new_filament_map = filament_map; - std::transform(new_filament_map.begin(), new_filament_map.end(), new_filament_map.begin(), [this](int val) { return val + 1; }); + std::transform(new_filament_map.begin(), new_filament_map.end(), new_filament_map.begin(), [](int val) { return val + 1; }); return new_filament_map; } diff --git a/src/libslic3r/MultiPoint.hpp b/src/libslic3r/MultiPoint.hpp index 26d2dcbb5f..3ab5263f1f 100644 --- a/src/libslic3r/MultiPoint.hpp +++ b/src/libslic3r/MultiPoint.hpp @@ -24,6 +24,7 @@ class MultiPoint explicit MultiPoint(const Points &_points) : points(_points) {} MultiPoint& operator=(const MultiPoint &other) { points = other.points; return *this; } MultiPoint& operator=(MultiPoint &&other) noexcept { points = std::move(other.points); return *this; } + virtual ~MultiPoint() = default; void scale(double factor); void scale(double factor_x, double factor_y); void translate(double x, double y) { this->translate(Point(coord_t(x), coord_t(y))); } @@ -113,6 +114,7 @@ class MultiPoint3 public: Points3 points; + virtual ~MultiPoint3() = default; void append(const Vec3crd& point) { this->points.push_back(point); } void translate(double x, double y); diff --git a/src/libslic3r/PlaceholderParser.cpp b/src/libslic3r/PlaceholderParser.cpp index 10dd7f6c18..66f44a87b5 100644 --- a/src/libslic3r/PlaceholderParser.cpp +++ b/src/libslic3r/PlaceholderParser.cpp @@ -40,11 +40,11 @@ #include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 7b9b9c6032..2c64eae880 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -2623,7 +2623,7 @@ bool PresetCollection::delete_preset(const std::string& name) lock(); set_printer_hold_alias(it->alias, *it, true); it = m_presets.erase(it); - if (std::distance(m_presets.begin(), it) < m_idx_selected) + if (static_cast(std::distance(m_presets.begin(), it)) < m_idx_selected) --m_idx_selected; unlock(); diff --git a/src/libslic3r/Preset.hpp b/src/libslic3r/Preset.hpp index b518467633..75b2a0df89 100644 --- a/src/libslic3r/Preset.hpp +++ b/src/libslic3r/Preset.hpp @@ -724,7 +724,6 @@ class PresetCollection PresetCollection() = default; // Copy constructor and copy operators are not to be used from outside PresetBundle, // as the Profile::vendor points to an instance of VendorProfile stored at parent PresetBundle! - PresetCollection(const PresetCollection &other) = default; //BBS: add operator= logic insteadof default PresetCollection& operator=(const PresetCollection &other); // After copying a collection with the default operators above, call this function @@ -830,7 +829,6 @@ class PrinterPresetCollection : public PresetCollection bool only_default_printers() const; private: PrinterPresetCollection() = default; - PrinterPresetCollection(const PrinterPresetCollection &other) = default; PrinterPresetCollection& operator=(const PrinterPresetCollection &other) = default; friend class PresetBundle; diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index 822d54ef09..f92db42452 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -1279,7 +1279,7 @@ std::vector>> PresetBundle::get_full_flush_matrix for(size_t extruder_id = 0; extruder_id < extruder_nums; ++ extruder_id){ std::vector flush_matrix(cast(get_flush_volumes_matrix(flush_volume_value, extruder_id, extruder_nums))); std::vector> wipe_volumes; - for (unsigned int i = 0; i < filament_nums; ++i) + for (int i = 0; i < filament_nums; ++i) wipe_volumes.push_back(std::vector(flush_matrix.begin() + i * filament_nums, flush_matrix.begin() + (i + 1) * filament_nums)); matrix.emplace_back(wipe_volumes); @@ -1378,7 +1378,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 @@ -2277,7 +2277,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; } @@ -4348,7 +4348,7 @@ std::pair PresetBundle::load_vendor_configs_ PresetCollection *presets = nullptr; size_t presets_loaded = 0; - auto parse_subfile = [this, path, vendor_name, presets_loaded, current_vendor_profile](\ + auto parse_subfile = [this, path, vendor_name, current_vendor_profile](\ ConfigSubstitutionContext& substitution_context, PresetsConfigSubstitutions& substitutions, LoadConfigBundleAttributes& flags, @@ -4433,7 +4433,7 @@ std::pair PresetBundle::load_vendor_configs_ } } } catch (const std::exception &e) { - BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": Failed to parse includes array: " << include; + BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": Failed to parse includes array: " << include << ", error: " << e.what(); } } else diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 2b12953bb8..0592f3c122 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -1788,7 +1788,7 @@ void Print::process(std::unordered_map* slice_time, bool 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(); @@ -2788,7 +2788,7 @@ std::vector Print::get_extruder_printable_polygons() const Polygons ploys = {Polygon::new_scale(e_printable_area)}; extruder_printable_polys.emplace_back(ploys); } - return std::move(extruder_printable_polys); + return extruder_printable_polys; } std::vector Print::get_extruder_unprintable_polygons() const @@ -2801,7 +2801,7 @@ std::vector Print::get_extruder_unprintable_polygons() const Polygons ploys = diff(printable_poly, Polygon::new_scale(e_printable_area)); extruder_unprintable_polys.emplace_back(ploys); } - return std::move(extruder_unprintable_polys); + return extruder_unprintable_polys; } Polygons Print::get_extruder_shared_printable_polygon() const @@ -4251,7 +4251,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/Print.hpp b/src/libslic3r/Print.hpp index b334727b58..fb3b294dd1 100644 --- a/src/libslic3r/Print.hpp +++ b/src/libslic3r/Print.hpp @@ -849,8 +849,8 @@ class Print : public PrintBaseWithState // If preview_data is not null, the preview_data is filled in for the G-code visualization (not used by the command line Slic3r). std::string export_gcode(const std::string& path_template, GCodeProcessorResult* result, ThumbnailsGeneratorCallback thumbnail_cb = nullptr); //return 0 means successful - int export_cached_data(const std::string& dir_path, int& obj_cnt_exported, bool with_space=false); - int load_cached_data(const std::string& directory); + int export_cached_data(const std::string& dir_path, int& obj_cnt_exported, bool with_space=false) override; + int load_cached_data(const std::string& directory) override; // methods for handling state bool is_step_done(PrintStep step) const { return Inherited::is_step_done(step); } diff --git a/src/libslic3r/PrintApply.cpp b/src/libslic3r/PrintApply.cpp index 2b60d90372..e388d542f0 100644 --- a/src/libslic3r/PrintApply.cpp +++ b/src/libslic3r/PrintApply.cpp @@ -315,7 +315,7 @@ static bool is_printable_filament_changed(const DynamicPrintConfig& new_full_con } std::vector split_polys; - for (const Polygon poly : extruder_polys) { + for (const Polygon& poly : extruder_polys) { Polygons res = diff(printable_poly, poly); if (!res.empty()) { split_polys.emplace_back(res[0]); } } diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 19f539722a..c3acbd39f8 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -1844,7 +1844,10 @@ void PrintConfigDef::init_fff_params() def->tooltip = L("The flow ratio set by object, the meaning is the same as flow ratio."); def->mode = comDevelop; def->max = 2; - def->min = 0.01; + // TODO: INVESTIGATE POTENTIAL BUG - Original value was 0.01, but min is int (truncates to 0) + // For ConfigOptionFloat, should min support decimal values? (Config.hpp:2386 defines min as int) + // def->min = 0.01; // OLD - implicit conversion warning + def->min = 0; def->set_default_value(new ConfigOptionFloat(1)); def = this->add("enable_pressure_advance", coBools); @@ -3252,7 +3255,10 @@ void PrintConfigDef::init_fff_params() def->label = L("Interlocking beam width"); def->tooltip = L("The width of the interlocking structure beams."); def->sidetext = L("mm"); - def->min = 0.01; + // TODO: INVESTIGATE POTENTIAL BUG - Original value was 0.01, but min is int (truncates to 0) + // For ConfigOptionFloat, should min support decimal values? (Config.hpp:2386 defines min as int) + // def->min = 0.01; // OLD - implicit conversion warning + def->min = 0; def->category = L("Advanced"); def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloat(0.8)); @@ -3683,7 +3689,7 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->readonly = true; def->nullable = true; - def->set_default_value(new ConfigOptionFloatsNullable { {0.0} }); + def->set_default_value(new ConfigOptionFloatsNullable { 0.0 }); def = this->add("start_end_points", coPoints); def->label = L("Start end points"); @@ -4309,7 +4315,10 @@ void PrintConfigDef::init_fff_params() def->category = L("Quality"); def->tooltip = L("The wipe speed is determined by the speed setting specified in this configuration." "If the value is expressed as a percentage (e.g. 80%), it will be calculated based on the travel speed setting above." "The default value for this parameter is 80%"); def->sidetext = "%"; - def->min = 0.01; + // TODO: INVESTIGATE POTENTIAL BUG - Original value was 0.01, but min is int (truncates to 0) + // For ConfigOptionPercent, should min support decimal values? (Config.hpp:2386 defines min as int) + // def->min = 0.01; // OLD - implicit conversion warning + def->min = 0; def->mode = comDevelop; def->set_default_value(new ConfigOptionPercent(80)); diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 9d4e0e1584..ecce3d1557 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -756,7 +756,7 @@ void PrintObject::detect_overhangs_for_lift() Layer &lower_layer = *layer.lower_layer; ExPolygons overhangs = diff_ex(layer.lslices, offset_ex(lower_layer.lslices, scale_(min_overlap))); - layer.loverhangs = std::move(offset2_ex(overhangs, -0.1f * scale_(m_config.line_width), 0.1f * scale_(m_config.line_width))); + layer.loverhangs = offset2_ex(overhangs, -0.1f * scale_(m_config.line_width), 0.1f * scale_(m_config.line_width)); #ifdef REGISTER_SUPPORTS_FOR_LIFT // register all supports to avoidance region for lift @@ -765,10 +765,10 @@ void PrintObject::detect_overhangs_for_lift() if (support_layer) { if (!support_layer->support_islands.empty()) { append(layer.loverhangs, - std::move(offset2_ex(support_layer->support_islands, -0.1f * scale_(m_config.line_width), 0.1f * scale_(m_config.line_width)))); + offset2_ex(support_layer->support_islands, -0.1f * scale_(m_config.line_width), 0.1f * scale_(m_config.line_width))); } else { ExPolygons support_infill_polygons = union_ex(support_layer->support_fills.polygons_covered_by_spacing(double(coord_t(SCALED_EPSILON)))); - append(layer.loverhangs, std::move(offset2_ex(support_infill_polygons, -0.1f * scale_(m_config.line_width), 0.1f * scale_(m_config.line_width)))); + append(layer.loverhangs, offset2_ex(support_infill_polygons, -0.1f * scale_(m_config.line_width), 0.1f * scale_(m_config.line_width))); } } } @@ -1328,10 +1328,11 @@ bool PrintObject::invalidate_step(PrintObjectStep step) bool PrintObject::invalidate_all_steps() { // First call the "invalidate" functions, which may cancel background processing. - bool result = Inherited::invalidate_all_steps() | m_print->invalidate_all_steps(); + bool result1 = Inherited::invalidate_all_steps(); + bool result2 = m_print->invalidate_all_steps(); // Then reset some of the depending values. m_slicing_params.valid = false; - return result; + return result1 || result2; } void PrintObject::reset_slice_surfaces(const std::vector> &slice_surfaces_cpy){ diff --git a/src/libslic3r/PrintObjectSlice.cpp b/src/libslic3r/PrintObjectSlice.cpp index c6f1cdf35a..a9b0553884 100644 --- a/src/libslic3r/PrintObjectSlice.cpp +++ b/src/libslic3r/PrintObjectSlice.cpp @@ -503,7 +503,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); @@ -511,7 +511,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/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index 293c7df1aa..8b822ec1f5 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -1007,7 +1007,10 @@ bool SLAPrintObject::invalidate_step(SLAPrintObjectStep step) bool SLAPrintObject::invalidate_all_steps() { - return Inherited::invalidate_all_steps() | m_print->invalidate_all_steps(); + // First call the "invalidate" functions, which may cancel background processing. + bool result1 = Inherited::invalidate_all_steps(); + bool result2 = m_print->invalidate_all_steps(); + return result1 || result2; } double SLAPrintObject::get_elevation() const { diff --git a/src/libslic3r/Shape/TextShape.cpp b/src/libslic3r/Shape/TextShape.cpp index d68ad577cd..227aae684e 100644 --- a/src/libslic3r/Shape/TextShape.cpp +++ b/src/libslic3r/Shape/TextShape.cpp @@ -199,7 +199,7 @@ static void MakeMesh(TopoDS_Shape& theSolid, TriangleMesh& theMesh) for (Standard_Integer aNodeIter = 1; aNodeIter <= aTriangulation->NbNodes(); ++aNodeIter) { gp_Pnt aPnt = aTriangulation->Node(aNodeIter); aPnt.Transform(aTrsf); - points.emplace_back(std::move(Vec3f(aPnt.X(), aPnt.Y(), aPnt.Z()))); + points.emplace_back(Vec3f(aPnt.X(), aPnt.Y(), aPnt.Z())); } //BBS: copy triangles const TopAbs_Orientation anOrientation = anExpSF.Current().Orientation(); diff --git a/src/libslic3r/Support/SupportMaterial.cpp b/src/libslic3r/Support/SupportMaterial.cpp index 510a3cd0e2..62e574f723 100644 --- a/src/libslic3r/Support/SupportMaterial.cpp +++ b/src/libslic3r/Support/SupportMaterial.cpp @@ -333,8 +333,7 @@ PrintObjectSupportMaterial::PrintObjectSupportMaterial(const PrintObject *object m_print_config (&object->print()->config()), m_object_config (&object->config()), m_slicing_params (slicing_params), - m_support_params (*object), - m_object (object) + m_support_params (*object) { } @@ -750,6 +749,7 @@ class SupportGridPattern assert(false); //[[fallthrough]]; return Polygons(); + case smsDefault: case smsGrid: { #ifdef SUPPORT_USE_AGG_RASTERIZER @@ -1582,7 +1582,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/SupportMaterial.hpp b/src/libslic3r/Support/SupportMaterial.hpp index af09238fda..2a865b66e2 100644 --- a/src/libslic3r/Support/SupportMaterial.hpp +++ b/src/libslic3r/Support/SupportMaterial.hpp @@ -121,7 +121,6 @@ class PrintObjectSupportMaterial */ // Following objects are not owned by SupportMaterial class. - const PrintObject *m_object; const PrintConfig *m_print_config; const PrintObjectConfig *m_object_config; // Pre-calculated parameters shared between the object slicer and the support generator, diff --git a/src/libslic3r/Support/TreeSupport.cpp b/src/libslic3r/Support/TreeSupport.cpp index e11a10b149..5b1d79f214 100644 --- a/src/libslic3r/Support/TreeSupport.cpp +++ b/src/libslic3r/Support/TreeSupport.cpp @@ -420,7 +420,7 @@ static bool move_inside_expolys(const ExPolygons& polygons, Point& from, double // because we compare with vsize2_with_unscale here (no division by zero), we also need to compare by vsize2_with_unscale inside the loop // to avoid integer rounding edge cases bool projected_p_beyond_prev_segment = dot_with_unscale(p1 - p0, from - p0) >= vsize2_with_unscale(p1 - p0); - for(const Point p2 : poly.contour.points) + for(const Point& p2 : poly.contour.points) { // X = A + Normal(B-A) * (((B-A) dot_with_unscale (P-A)) / VSize(B-A)); // = A + (B-A) * ((B-A) dot_with_unscale (P-A)) / VSize2(B-A); @@ -936,7 +936,7 @@ void TreeSupport::detect_overhangs(bool check_support_necessity/* = false*/) enforced_overhangs = intersection_ex(diff_ex(layer->lslices_extrudable, lower_layer->lslices_extrudable), enforcers[layer_nr]); if (is_auto(stype)) { // normal overhang - overhangs_all_layers[layer_nr] = std::move(diff_ex(curr_polys, lower_layer_offseted)); + overhangs_all_layers[layer_nr] = diff_ex(curr_polys, lower_layer_offseted); // if is auto, add blocker first if (layer_nr < blockers.size() && !blockers[layer_nr].empty()) { // Arthur: union_ is a must because after mirroring, the blocker polygons are in left-hand coordinates, ie clockwise, @@ -1535,15 +1535,15 @@ void TreeSupport::generate_toolpaths() if (m_object->support_layer_count() > m_raft_layers) { const SupportLayer *ts_layer = m_object->get_support_layer(m_raft_layers); - for (const ExPolygon expoly : ts_layer->floor_areas) + for (const ExPolygon& expoly : ts_layer->floor_areas) raft_areas.push_back(expoly); - for (const ExPolygon expoly : ts_layer->roof_areas) + for (const ExPolygon& expoly : ts_layer->roof_areas) raft_areas.push_back(expoly); - for (const ExPolygon expoly : ts_layer->base_areas) + for (const ExPolygon& expoly : ts_layer->base_areas) raft_areas.push_back(expoly); } - raft_areas = std::move(offset_ex(raft_areas, scale_(3.))); + raft_areas = offset_ex(raft_areas, scale_(3.)); size_t layer_nr = 0; for (; layer_nr < m_slicing_params.base_raft_layers; layer_nr++) { @@ -1662,9 +1662,9 @@ void TreeSupport::generate_toolpaths() Flow flow = m_raft_layers == 0 ? m_object->print()->brim_flow() : support_flow; make_perimeter_and_inner_brim(ts_layer->support_fills.entities, poly, wall_count, flow, area_group.type == SupportLayer::RoofType ? erSupportMaterialInterface : erSupportMaterial); - polys = std::move(offset_ex(poly, -flow.scaled_spacing())); + polys = offset_ex(poly, -flow.scaled_spacing()); } else if (area_group.type == SupportLayer::Roof1stLayer) { - polys = std::move(offset_ex(poly, 0.5*support_flow.scaled_width())); + polys = offset_ex(poly, 0.5*support_flow.scaled_width()); } else { polys.push_back(poly); @@ -1686,7 +1686,7 @@ void TreeSupport::generate_toolpaths() for (size_t region_id = 0; region_id < bridge_layer->regions().size(); ++region_id) { LayerRegion *layerm = bridge_layer->regions()[region_id]; bool bridge_found = false; - for (const auto surface : layerm->fill_surfaces.surfaces) { + for (const auto& surface : layerm->fill_surfaces.surfaces) { if (surface.surface_type == stBottomBridge && overlaps(polys, surface.expolygon)) { filler_Roof1stLayer->angle = surface.bridge_angle + (m_support_params.num_top_interface_layers - 1) * M_PI_2; bridge_found = true; @@ -1731,7 +1731,7 @@ void TreeSupport::generate_toolpaths() if (obj_layer) { for (size_t region_id = 0; region_id < obj_layer->regions().size(); ++region_id) { LayerRegion *layerm = obj_layer->regions()[region_id]; - for (const auto surface : layerm->fill_surfaces.surfaces) { + for (const Surface& surface : layerm->fill_surfaces.surfaces) { if (surface.surface_type == stBottomBridge && overlaps(polys, surface.expolygon)) { filler_interface->angle = surface.bridge_angle + (i + 1) * M_PI_2; bridge_found = true; @@ -2473,21 +2473,21 @@ void TreeSupport::draw_circles() for (size_t i = 0; i <= bottom_gap_layers && i <= obj_layer_nr_next; i++) { const Layer *below_layer = m_object->get_layer(obj_layer_nr_next - i); - ExPolygons bottom_interface = std::move(intersection_ex(base_areas, below_layer->lslices)); + ExPolygons bottom_interface = intersection_ex(base_areas, below_layer->lslices); floor_areas.insert(floor_areas.end(), bottom_interface.begin(), bottom_interface.end()); } } if (floor_areas.empty() == false) { - //floor_areas = std::move(diff_ex(floor_areas, avoid_region_interface)); + //floor_areas = diff_ex(floor_areas, avoid_region_interface)); //floor_areas = std::move(offset2_ex(floor_areas, contact_dist_scaled, -contact_dist_scaled)); - base_areas = std::move(diff_ex(base_areas, offset_ex(floor_areas, 10))); + base_areas = diff_ex(base_areas, offset_ex(floor_areas, 10)); } } if (bottom_gap_layers > 0 && m_ts_data->layer_heights[layer_nr].obj_layer_nr > bottom_gap_layers) { const Layer* below_layer = m_object->get_layer(m_ts_data->layer_heights[layer_nr].obj_layer_nr - bottom_gap_layers); - ExPolygons bottom_gap_area = std::move(intersection_ex(floor_areas, below_layer->lslices)); + ExPolygons bottom_gap_area = intersection_ex(floor_areas, below_layer->lslices); if (!bottom_gap_area.empty()) { - floor_areas = std::move(diff_ex(floor_areas, bottom_gap_area)); + floor_areas = diff_ex(floor_areas, bottom_gap_area); } } auto &area_groups = ts_layer->area_groups; @@ -2526,7 +2526,7 @@ void TreeSupport::draw_circles() ts_layer->support_islands.emplace_back(*expoly); } - ts_layer->support_islands = std::move(union_ex(ts_layer->support_islands)); + ts_layer->support_islands = union_ex(ts_layer->support_islands); //Must update bounding box which is used in avoid crossing perimeter ts_layer->lslices_bboxes.clear(); ts_layer->lslices_bboxes.reserve(ts_layer->support_islands.size()); @@ -2556,8 +2556,9 @@ void TreeSupport::draw_circles() ExPolygons& base_areas = ts_layer->base_areas; int layer_nr_lower = layer_nr - 1; - for (layer_nr_lower; layer_nr_lower >= 0; layer_nr_lower--) { + while (layer_nr_lower >= 0) { if (!m_object->get_support_layer(layer_nr_lower + m_raft_layers)->area_groups.empty()) break; + layer_nr_lower--; } if (layer_nr_lower <= 0) continue; @@ -2636,8 +2637,9 @@ void TreeSupport::draw_circles() if (ts_layer->area_groups.empty()) continue; int layer_nr_lower = layer_nr - 1; - for (layer_nr_lower; layer_nr_lower >= 0; layer_nr_lower--) { + while (layer_nr_lower >= 0) { if (!m_object->get_support_layer(layer_nr_lower + m_raft_layers)->area_groups.empty()) break; + layer_nr_lower--; } if (layer_nr_lower < 0) continue; auto& area_groups_lower = m_object->get_support_layer(layer_nr_lower + m_raft_layers)->area_groups; @@ -2798,7 +2800,7 @@ void TreeSupport::drop_nodes() const size_t top_interface_layers = config.support_interface_top_layers.value; SupportNode::diameter_angle_scale_factor = diameter_angle_scale_factor; - 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); @@ -2876,7 +2878,7 @@ void TreeSupport::drop_nodes() m_object->print()->set_status(60 + int(10 * (1 - float(layer_nr) / contact_nodes.size())), _u8L("Generating support"));// (boost::format(_u8L("Support: propagate branches at layer %d")) % layer_nr).str()); - Polygons layer_contours = std::move(m_ts_data->get_contours_with_holes(obj_layer_nr)); + Polygons layer_contours = m_ts_data->get_contours_with_holes(obj_layer_nr); //std::unordered_map& mst_line_x_layer_contour_cache = m_mst_line_x_layer_contour_caches[layer_nr]; tbb::concurrent_unordered_map mst_line_x_layer_contour_cache; auto is_line_cut_by_contour = [&mst_line_x_layer_contour_cache,&layer_contours](Point a, Point b) @@ -4121,7 +4123,7 @@ const ExPolygons& TreeSupportData::get_avoidance(coordf_t radius, size_t layer_n Polygons TreeSupportData::get_contours(size_t layer_nr) const { Polygons contours; - for (const ExPolygon expoly : m_layer_outlines[layer_nr]) { + for (const ExPolygon& expoly : m_layer_outlines[layer_nr]) { contours.push_back(expoly.contour); } @@ -4131,7 +4133,7 @@ Polygons TreeSupportData::get_contours(size_t layer_nr) const Polygons TreeSupportData::get_contours_with_holes(size_t layer_nr) const { Polygons contours; - for (const ExPolygon expoly : m_layer_outlines[layer_nr]) { + for (const ExPolygon& expoly : m_layer_outlines[layer_nr]) { for(int i=0;i>> group_me size_t num_overhang_layers = support_auto ? num_object_layers : std::min(num_object_layers, std::max(size_t(support_enforce_layers), enforcers_layers.size())); tbb::parallel_for(tbb::blocked_range(1, num_overhang_layers), - [&print_object, &config, &print_config, &enforcers_layers, &blockers_layers, + [&print_object, &enforcers_layers, &blockers_layers, support_auto, support_enforce_layers, support_threshold_auto, tan_threshold, enforcer_overhang_offset, num_raft_layers, radius_sample_resolution, &throw_on_cancel, &out] (const tbb::blocked_range &range) { for (LayerIndex layer_id = range.begin(); layer_id < range.end(); ++ layer_id) { diff --git a/src/libslic3r/Utils.hpp b/src/libslic3r/Utils.hpp index d4dc1a560f..d5d6d64182 100644 --- a/src/libslic3r/Utils.hpp +++ b/src/libslic3r/Utils.hpp @@ -257,15 +257,15 @@ class PathSanitizer } if (raw.length() < full.length() || raw.empty()) { - return std::move(file_name(raw)); + return file_name(raw); } if (raw[0] != full[0] || raw[full.length() - 1] != full[full.length() - 1]) { if (std::isupper(raw[start_pos]) && std::tolower(raw[start_pos]) == full[start_pos]) { raw.replace(start_pos, 12, std::string(12, '*')); - return std::move(file_name(raw)); + return file_name(raw); } - return std::move(file_name(raw)); + return file_name(raw); } if (raw[start_pos + name_size] == '\\' || raw[start_pos + name_size] == '/') { @@ -273,7 +273,7 @@ class PathSanitizer } else if (std::isupper(raw[start_pos]) && std::tolower(raw[start_pos]) == full[start_pos]) { raw.replace(start_pos, 12, std::string(12, '*')); } else { - return std::move(file_name(raw)); + return file_name(raw); } if (id_start_pos != std::string::npos && id_start_pos < raw.length() && (raw[id_start_pos - 1] == '\\' || raw[id_start_pos - 1] == '/') && @@ -286,7 +286,7 @@ class PathSanitizer raw.replace(id_start_pos, id_end_pos - id_start_pos, std::string(id_end_pos - id_start_pos, '*')); } - return std::move(file_name(raw)); + return file_name(raw); } }; diff --git a/src/libslic3r/utils.cpp b/src/libslic3r/utils.cpp index 05046f8d01..0f503eb612 100644 --- a/src/libslic3r/utils.cpp +++ b/src/libslic3r/utils.cpp @@ -830,7 +830,7 @@ CopyFileResult copy_file_inner(const std::string& from, const std::string& to, s // That may happen when copying on some exotic file system, for example Linux on Chrome. copy_file_linux(source, target, ec); #else // __linux__ - boost::filesystem::copy_file(source, target, boost::filesystem::copy_option::overwrite_if_exists, ec); + boost::filesystem::copy_file(source, target, boost::filesystem::copy_options::overwrite_existing, ec); #endif // __linux__ if (ec) { error_message = ec.message(); diff --git a/src/slic3r/GUI/3DScene.cpp b/src/slic3r/GUI/3DScene.cpp index 874bce5c9f..281e2bda50 100644 --- a/src/slic3r/GUI/3DScene.cpp +++ b/src/slic3r/GUI/3DScene.cpp @@ -685,7 +685,7 @@ bool GLVolume::simplify_mesh(const indexed_triangle_set &_its, std::shared_ptr its, std::unique_ptr state) { + [va](std::unique_ptr its, std::unique_ptr state) { // Checks that the UI thread did not request cancellation, throws if so. std::function throw_on_cancel = []() { }; diff --git a/src/slic3r/GUI/AMSMaterialsSetting.cpp b/src/slic3r/GUI/AMSMaterialsSetting.cpp index 67deeee6b2..43836694a4 100644 --- a/src/slic3r/GUI/AMSMaterialsSetting.cpp +++ b/src/slic3r/GUI/AMSMaterialsSetting.cpp @@ -1160,7 +1160,7 @@ void AMSMaterialsSetting::update_pa_profile_items() case NozzleDiameterType::NOZZLE_DIAMETER_0_4: nozzle_diameter = 0.4f; break; case NozzleDiameterType::NOZZLE_DIAMETER_0_6: nozzle_diameter = 0.6f; break; case NozzleDiameterType::NOZZLE_DIAMETER_0_8: nozzle_diameter = 0.8f; break; - default: nozzle_diameter = nozzle_diameter; break; + default: break; } nozzle_flow_type = sel_pair->second; } @@ -2003,11 +2003,6 @@ void ColorPickerPopup::paintEvent(wxPaintEvent& evt) void ColorPickerPopup::OnDismiss() {} -void ColorPickerPopup::Popup() -{ - PopupWindow::Popup(); -} - bool ColorPickerPopup::ProcessLeftDown(wxMouseEvent& event) { return PopupWindow::ProcessLeftDown(event); } diff --git a/src/slic3r/GUI/AMSMaterialsSetting.hpp b/src/slic3r/GUI/AMSMaterialsSetting.hpp index cd1b463c30..75f4cf1163 100644 --- a/src/slic3r/GUI/AMSMaterialsSetting.hpp +++ b/src/slic3r/GUI/AMSMaterialsSetting.hpp @@ -85,7 +85,6 @@ class ColorPickerPopup : public PopupWindow void set_ams_colours(std::vector ams); void set_def_colour(wxColour col); void paintEvent(wxPaintEvent& evt); - void Popup(); virtual void OnDismiss() wxOVERRIDE; virtual bool ProcessLeftDown(wxMouseEvent& event) wxOVERRIDE; diff --git a/src/slic3r/GUI/AMSSetting.hpp b/src/slic3r/GUI/AMSSetting.hpp index 71bbb55e0c..9aa01208d1 100644 --- a/src/slic3r/GUI/AMSSetting.hpp +++ b/src/slic3r/GUI/AMSSetting.hpp @@ -106,6 +106,8 @@ class AMSSetting : public DPIDialog class AMSSettingTypePanel : public wxPanel { public: + using wxPanel::Update; + AMSSettingTypePanel(wxWindow* parent, AMSSetting* setting_dlg); ~AMSSettingTypePanel(); diff --git a/src/slic3r/GUI/AboutDialog.hpp b/src/slic3r/GUI/AboutDialog.hpp index 8dc72d15a3..e96c74ba08 100644 --- a/src/slic3r/GUI/AboutDialog.hpp +++ b/src/slic3r/GUI/AboutDialog.hpp @@ -60,7 +60,6 @@ class AboutDialog : public DPIDialog wxHtmlWindow* m_html; wxStaticBitmap* m_logo; int m_copy_rights_btn_id { wxID_ANY }; - int m_copy_version_btn_id { wxID_ANY }; public: AboutDialog(); diff --git a/src/slic3r/GUI/AmsMappingPopup.cpp b/src/slic3r/GUI/AmsMappingPopup.cpp index dca316b340..06f40d30e2 100644 --- a/src/slic3r/GUI/AmsMappingPopup.cpp +++ b/src/slic3r/GUI/AmsMappingPopup.cpp @@ -1012,7 +1012,8 @@ void AmsMapingPopup::update_ams_data_multi_machines() int ams_type = 1; int nozzle_id = 0; - if (ams_type >= 1 || ams_type <= 3) { // 1:ams 2:ams-lite 3:n3f + // if (ams_type >= 1 || ams_type <= 3) { // OLD: used OR - always true! Should be AND for range check + if (ams_type >= 1 && ams_type <= 3) { // 1:ams 2:ams-lite 3:n3f auto sizer_mapping_list = new wxBoxSizer(wxHORIZONTAL); auto ams_mapping_item_container = new MappingContainer(nozzle_id == 0 ? m_right_marea_panel : m_left_marea_panel, "AMS-1", 4); @@ -1279,9 +1280,9 @@ void AmsMapingPopup::update(MachineObject* obj, const std::vector& { DevAmsTray *tray_data = tray_iter->second; TrayData td; - if (ams_type == AMSModel::GENERIC_AMS || ams_type == AMSModel::AMS_LITE || ams_type == AMSModel::N3F_AMS) { + if (static_cast(ams_type) == AMSModel::GENERIC_AMS || static_cast(ams_type) == AMSModel::AMS_LITE || static_cast(ams_type) == AMSModel::N3F_AMS) { td.id = ams_indx * AMS_TOTAL_COUNT + atoi(tray_data->id.c_str()); - } else if (ams_type == AMSModel::N3S_AMS) { + } else if (static_cast(ams_type) == AMSModel::N3S_AMS) { td.id = ams_indx + atoi(tray_data->id.c_str()); } td.ams_id = std::stoi(ams_iter->second->GetAmsId()); @@ -1420,7 +1421,7 @@ void AmsMapingPopup::add_ams_mapping(std::vector tray_data, bool remai // temp if (tray_data[i].type == EMPTY) { m_mapping_item->set_data(m_tag_material, wxColour(0xEE, 0xEE, 0xEE), "-", remain_detect_flag, tray_data[i]); - m_mapping_item->Bind(wxEVT_LEFT_DOWN, [this, tray_data, i, m_mapping_item](wxMouseEvent &e) { + m_mapping_item->Bind(wxEVT_LEFT_DOWN, [this, m_mapping_item](wxMouseEvent &e) { if (!m_mapping_from_multi_machines) { return; @@ -1435,7 +1436,7 @@ void AmsMapingPopup::add_ams_mapping(std::vector tray_data, bool remai // third party if (tray_data[i].type == THIRD) { m_mapping_item->set_data(m_tag_material, wxColour(0xCE, 0xCE, 0xCE), "?", remain_detect_flag, tray_data[i]); - m_mapping_item->Bind(wxEVT_LEFT_DOWN, [this, tray_data, i, m_mapping_item](wxMouseEvent &e) { + m_mapping_item->Bind(wxEVT_LEFT_DOWN, [this, m_mapping_item](wxMouseEvent &e) { m_mapping_item->send_event(m_current_filament_id); Dismiss(); }); diff --git a/src/slic3r/GUI/AmsMappingPopup.hpp b/src/slic3r/GUI/AmsMappingPopup.hpp index 926e2ea9d4..40e8395fe1 100644 --- a/src/slic3r/GUI/AmsMappingPopup.hpp +++ b/src/slic3r/GUI/AmsMappingPopup.hpp @@ -423,7 +423,6 @@ class AmsHumidityTipPopup : public PopupWindow ScalableBitmap close_img; wxStaticBitmap* curr_humidity_img; - wxStaticBitmap* m_img; Label* m_staticText;; Label* m_staticText_note; diff --git a/src/slic3r/GUI/Auxiliary.cpp b/src/slic3r/GUI/Auxiliary.cpp index 8a39764d48..b40e45e3e6 100644 --- a/src/slic3r/GUI/Auxiliary.cpp +++ b/src/slic3r/GUI/Auxiliary.cpp @@ -346,7 +346,7 @@ void AuFile::on_input_enter(wxCommandEvent &evt) } auto existing = false; - auto dir = m_file_path.branch_path(); + auto dir = m_file_path.parent_path(); auto new_fullname = new_file_name + m_file_path.extension().string(); @@ -462,8 +462,8 @@ void AuFile::on_set_cover() wxGetApp().plater()->model().model_info->cover_file = path.string(); //wxGetApp().plater()->model().model_info->cover_file = m_file_name.ToStdString(); - auto full_path = m_file_path.branch_path(); - auto full_root_path = full_path.branch_path(); + auto full_path = m_file_path.parent_path(); + auto full_root_path = full_path.parent_path(); auto full_root_path_str = encode_path(full_root_path.string().c_str()); auto dir = wxString::Format("%s/.thumbnails", full_root_path_str); @@ -507,8 +507,8 @@ void AuFile::on_set_delete() auto is_fine = fs::remove(bfs_path); if (m_cover) { - auto full_path = m_file_path.branch_path(); - auto full_root_path = full_path.branch_path(); + auto full_path = m_file_path.parent_path(); + auto full_root_path = full_path.parent_path(); auto full_root_path_str = encode_path(full_root_path.string().c_str()); auto dir = wxString::Format("%s/.thumbnails", full_root_path_str); fs::path dir_path(dir.c_str()); @@ -827,7 +827,7 @@ void AuxiliaryPanel::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_designer_panel = new DesignerPanel(m_tabpanel, AuxiliaryFolderType::DESIGNER); m_pictures_panel = new AuFolderPanel(m_tabpanel, AuxiliaryFolderType::MODEL_PICTURE); @@ -835,11 +835,11 @@ void AuxiliaryPanel::init_tabpanel() m_assembly_panel = new AuFolderPanel(m_tabpanel, AuxiliaryFolderType::ASSEMBLY_GUIDE); m_others_panel = new AuFolderPanel(m_tabpanel, AuxiliaryFolderType::OTHERS); - m_tabpanel->AddPage(m_designer_panel, _L("Basic Info"), "", true); - m_tabpanel->AddPage(m_pictures_panel, _L("Pictures"), "", false); - m_tabpanel->AddPage(m_bill_of_materials_panel, _L("Bill of Materials"), "", false); - m_tabpanel->AddPage(m_assembly_panel, _L("Assembly Guide"), "", false); - m_tabpanel->AddPage(m_others_panel, _L("Others"), "", false); + m_tabpanel->AddPage(m_designer_panel, _L("Basic Info"), std::string(""), true); + m_tabpanel->AddPage(m_pictures_panel, _L("Pictures"), std::string(""), false); + m_tabpanel->AddPage(m_bill_of_materials_panel, _L("Bill of Materials"), std::string(""), false); + m_tabpanel->AddPage(m_assembly_panel, _L("Assembly Guide"), std::string(""), false); + m_tabpanel->AddPage(m_others_panel, _L("Others"), std::string(""), false); } wxWindow *AuxiliaryPanel::create_side_tools() @@ -949,7 +949,7 @@ void AuxiliaryPanel::on_import_file(wxCommandEvent &event) boost::system::error_code ec; - if (!fs::copy_file(src_bfs_path, fs::path(dir_path.ToStdWstring()), fs::copy_option::overwrite_if_exists, ec)) continue; + if (!fs::copy_file(src_bfs_path, fs::path(dir_path.ToStdWstring()), fs::copy_options::overwrite_existing, ec)) continue; Slic3r::put_other_changes(); // add in file list diff --git a/src/slic3r/GUI/AuxiliaryDataViewModel.cpp b/src/slic3r/GUI/AuxiliaryDataViewModel.cpp index f68f73306c..9bb8835bff 100644 --- a/src/slic3r/GUI/AuxiliaryDataViewModel.cpp +++ b/src/slic3r/GUI/AuxiliaryDataViewModel.cpp @@ -336,7 +336,7 @@ wxDataViewItemArray AuxiliaryModel::ImportFile(AuxiliaryModelNode* sel, wxArrayS dir_path += "\\" + src_bfs_path.filename().generic_wstring(); boost::system::error_code ec; - if (!fs::copy_file(src_bfs_path, fs::path(dir_path.ToStdWstring()), fs::copy_option::overwrite_if_exists, ec)) + if (!fs::copy_file(src_bfs_path, fs::path(dir_path.ToStdWstring()), fs::copy_options::overwrite_existing, ec)) continue; // Update model data diff --git a/src/slic3r/GUI/BBLTopbar.hpp b/src/slic3r/GUI/BBLTopbar.hpp index 3a44db70d1..c290e95de1 100644 --- a/src/slic3r/GUI/BBLTopbar.hpp +++ b/src/slic3r/GUI/BBLTopbar.hpp @@ -69,8 +69,6 @@ class BBLTopbar : public wxAuiToolBar wxMenu* m_file_menu; wxMenu m_calib_menu; wxAuiToolBarItem* m_title_item; - wxAuiToolBarItem* m_account_item; - wxAuiToolBarItem* m_model_store_item; wxAuiToolBarItem *m_publish_item; wxAuiToolBarItem *m_save_item; diff --git a/src/slic3r/GUI/BindDialog.cpp b/src/slic3r/GUI/BindDialog.cpp index 2825732d5e..5c3ddfc3b6 100644 --- a/src/slic3r/GUI/BindDialog.cpp +++ b/src/slic3r/GUI/BindDialog.cpp @@ -502,7 +502,7 @@ PingCodeBindDialog::~PingCodeBindDialog() { m_link_privacy_title->SetMaxSize(wxSize(FromDIP(450), -1)); m_link_privacy_title->Wrap(FromDIP(450)); m_link_privacy_title->SetForegroundColour(wxColour("#00AE42")); - 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(); @@ -597,7 +597,7 @@ PingCodeBindDialog::~PingCodeBindDialog() { m_link_network_state = new wxHyperlinkCtrl(m_sw_bind_failed_info, wxID_ANY,_L("Check the status of current system services"),""); m_link_network_state->SetFont(::Label::Body_12); - m_link_network_state->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {wxGetApp().link_to_network_check(); }); + m_link_network_state->Bind(wxEVT_LEFT_DOWN, [](auto& e) {wxGetApp().link_to_network_check(); }); m_link_network_state->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {m_link_network_state->SetCursor(wxCURSOR_HAND); }); m_link_network_state->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {m_link_network_state->SetCursor(wxCURSOR_ARROW); }); @@ -949,7 +949,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(); } @@ -1173,7 +1173,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/BindDialog.hpp b/src/slic3r/GUI/BindDialog.hpp index 630516cef0..1f6298faa8 100644 --- a/src/slic3r/GUI/BindDialog.hpp +++ b/src/slic3r/GUI/BindDialog.hpp @@ -60,18 +60,8 @@ class PingCodeBindDialog : public DPIDialog wxPanel* request_bind_panel; wxPanel* binding_panel; - wxScrolledWindow* m_sw_bind_failed_info; - Label* m_bind_failed_info; - Label* m_st_txt_error_code{ nullptr }; - Label* m_st_txt_error_desc{ nullptr }; - Label* m_st_txt_extra_info{ nullptr }; - wxHyperlinkCtrl* m_link_network_state{ nullptr }; - wxString m_result_info; - wxString m_result_extra; wxString m_ping_code_wiki; - bool m_show_error_info_state = true; - int m_result_code; std::shared_ptr m_status_bar; public: @@ -105,7 +95,6 @@ class BindMachineDialog : public DPIDialog wxBitmap m_bitmap_show_error_close; wxBitmap m_bitmap_show_error_open; wxScrolledWindow* m_sw_bind_failed_info; - Label* m_bind_failed_info; Label* m_st_txt_error_code{ nullptr }; Label* m_st_txt_error_desc{ nullptr }; Label* m_st_txt_extra_info{ nullptr }; diff --git a/src/slic3r/GUI/CaliHistoryDialog.cpp b/src/slic3r/GUI/CaliHistoryDialog.cpp index 30d3187d29..f9e9e538b5 100644 --- a/src/slic3r/GUI/CaliHistoryDialog.cpp +++ b/src/slic3r/GUI/CaliHistoryDialog.cpp @@ -448,7 +448,7 @@ void HistoryWindow::sync_history_data() { edit_button->SetTextColor(wxColour("#FFFFFE")); edit_button->SetMinSize(wxSize(-1, FromDIP(24))); edit_button->SetCornerRadius(FromDIP(12)); - 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 0b00f3b7f5..157195de9c 100644 --- a/src/slic3r/GUI/Calibration.cpp +++ b/src/slic3r/GUI/Calibration.cpp @@ -211,7 +211,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/CalibrationPanel.cpp b/src/slic3r/GUI/CalibrationPanel.cpp index 540e86ce69..dcdf823f8a 100644 --- a/src/slic3r/GUI/CalibrationPanel.cpp +++ b/src/slic3r/GUI/CalibrationPanel.cpp @@ -269,7 +269,10 @@ void SelectMObjectPopup::Popup(wxWindow* WXUNUSED(focus)) } } - wxPostEvent(this, wxTimerEvent()); + // Immediate update instead of posting deprecated wxTimerEvent + wxCommandEvent user_event(EVT_UPDATE_USER_MLIST); + user_event.SetEventObject(this); + wxPostEvent(this, user_event); PopupWindow::Popup(); } @@ -487,7 +490,7 @@ void CalibrationPanel::init_tabpanel() { selected = true; m_tabpanel->AddPage(m_cali_panels[i], get_calibration_type_name(m_cali_panels[i]->get_calibration_mode()), - "", + std::string(""), selected); } @@ -505,7 +508,7 @@ void CalibrationPanel::init_timer() m_refresh_timer = new wxTimer(); m_refresh_timer->SetOwner(this); m_refresh_timer->Start(REFRESH_INTERVAL); - wxPostEvent(this, wxTimerEvent()); + update_all(); // Immediate update instead of posting deprecated wxTimerEvent } void CalibrationPanel::on_timer(wxTimerEvent& event) { @@ -598,18 +601,18 @@ void CalibrationPanel::show_status(int status) { if (!m_initialized) return; if (last_status == status)return; - if (last_status & (int)MonitorStatus::MONITOR_CONNECTING != 0) { + if ((last_status & (int)MonitorStatus::MONITOR_CONNECTING) != 0) { NetworkAgent* agent = wxGetApp().getAgent(); json j; //j["dev_id"] = obj ? obj->get_dev_id() : "obj_nullptr"; j["dev_id"] = ""; - if (status & (int)MonitorStatus::MONITOR_DISCONNECTED != 0) { + if ((status & (int)MonitorStatus::MONITOR_DISCONNECTED) != 0) { j["result"] = "failed"; if (agent) { agent->track_event("connect_dev", j.dump()); } } - else if (status & (int)MonitorStatus::MONITOR_NORMAL != 0) { + else if ((status & (int)MonitorStatus::MONITOR_NORMAL) != 0) { j["result"] = "success"; if (agent) { agent->track_event("connect_dev", j.dump()); @@ -652,7 +655,7 @@ bool CalibrationPanel::Show(bool show) { m_refresh_timer->Stop(); m_refresh_timer->SetOwner(this); m_refresh_timer->Start(REFRESH_INTERVAL); - wxPostEvent(this, wxTimerEvent()); + update_all(); // Immediate update instead of posting deprecated wxTimerEvent DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager(); if (dev) { diff --git a/src/slic3r/GUI/CalibrationPanel.hpp b/src/slic3r/GUI/CalibrationPanel.hpp index eafb380c79..1f6b097af9 100644 --- a/src/slic3r/GUI/CalibrationPanel.hpp +++ b/src/slic3r/GUI/CalibrationPanel.hpp @@ -70,11 +70,7 @@ class SelectMObjectPopup : public PopupWindow private: int m_my_devices_count{ 0 }; - int m_other_devices_count{ 0 }; bool m_dismiss{ false }; - wxWindow* m_placeholder_panel { nullptr }; - wxWindow* m_panel_body{ nullptr }; - wxBoxSizer* m_sizer_body{ nullptr }; wxBoxSizer* m_sizer_my_devices{ nullptr }; wxScrolledWindow* m_scrolledWindow{ nullptr }; wxTimer* m_refresh_timer{ nullptr }; diff --git a/src/slic3r/GUI/CalibrationWizard.cpp b/src/slic3r/GUI/CalibrationWizard.cpp index 7f55647170..67cd6350eb 100644 --- a/src/slic3r/GUI/CalibrationWizard.cpp +++ b/src/slic3r/GUI/CalibrationWizard.cpp @@ -479,7 +479,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 c4cd44919e..e41a20155e 100644 --- a/src/slic3r/GUI/CalibrationWizardCaliPage.cpp +++ b/src/slic3r/GUI/CalibrationWizardCaliPage.cpp @@ -91,7 +91,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 aa74a9a768..881fac0fff 100644 --- a/src/slic3r/GUI/CalibrationWizardPage.cpp +++ b/src/slic3r/GUI/CalibrationWizardPage.cpp @@ -829,7 +829,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/CalibrationWizardPresetPage.cpp b/src/slic3r/GUI/CalibrationWizardPresetPage.cpp index 8d0bb7240b..4aa9087f15 100644 --- a/src/slic3r/GUI/CalibrationWizardPresetPage.cpp +++ b/src/slic3r/GUI/CalibrationWizardPresetPage.cpp @@ -355,7 +355,7 @@ void CaliPresetCustomRangePanel::create_panel(wxWindow* parent) std::string decimal_point; std::string expression = "^[-+]?[0-9]+([,.][0-9]+)?$"; std::regex decimalRegex(expression); - int decimal_number; + int decimal_number = 0; if (std::regex_match(number, decimalRegex)) { std::smatch match; if (std::regex_search(number, match, decimalRegex)) { @@ -365,7 +365,7 @@ void CaliPresetCustomRangePanel::create_panel(wxWindow* parent) else decimal_number = 0; } - int max_decimal_length; + int max_decimal_length = 0; if (i <= 1) max_decimal_length = 3; else if (i >= 2) @@ -2202,7 +2202,7 @@ void CalibrationPresetPage::init_with_machine(MachineObject* obj) bool nozzle_is_set = false; for (int i = 0; i < NOZZLE_LIST_COUNT; i++) { if (abs(obj->GetExtderSystem()->GetNozzleDiameter(0) - nozzle_diameter_list[i]) < 1e-3) { - if (m_comboBox_nozzle_dia->GetCount() > i) { + if (m_comboBox_nozzle_dia->GetCount() > static_cast(i)) { m_comboBox_nozzle_dia->SetSelection(i); nozzle_is_set = true; } @@ -2225,7 +2225,7 @@ void CalibrationPresetPage::init_with_machine(MachineObject* obj) for (size_t i = 0; i < obj->GetExtderSystem()->GetTotalExtderCount(); ++i) { if (i == LEFT_EXTRUDER_ID) { int index = get_nozzle_diameter_list_index(LEFT_EXTRUDER_ID); - if ((index != -1) && m_left_comboBox_nozzle_dia->GetCount() > index) { + if ((index != -1) && m_left_comboBox_nozzle_dia->GetCount() > static_cast(index)) { m_left_comboBox_nozzle_dia->SetSelection(index); wxCommandEvent event(wxEVT_COMBOBOX); event.SetEventObject(this); @@ -2246,7 +2246,7 @@ void CalibrationPresetPage::init_with_machine(MachineObject* obj) } else if (i == RIGHT_EXTRUDER_ID) { int index = get_nozzle_diameter_list_index(RIGHT_EXTRUDER_ID); - if ((index != -1) && m_right_comboBox_nozzle_dia->GetCount() > index) { + if ((index != -1) && m_right_comboBox_nozzle_dia->GetCount() > static_cast(index)) { m_right_comboBox_nozzle_dia->SetSelection(index); wxCommandEvent event(wxEVT_COMBOBOX); event.SetEventObject(this); diff --git a/src/slic3r/GUI/CalibrationWizardSavePage.cpp b/src/slic3r/GUI/CalibrationWizardSavePage.cpp index 512aaa1188..69408805ec 100644 --- a/src/slic3r/GUI/CalibrationWizardSavePage.cpp +++ b/src/slic3r/GUI/CalibrationWizardSavePage.cpp @@ -255,7 +255,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; }); @@ -349,7 +349,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]; }); @@ -751,7 +751,7 @@ void CaliPASaveAutoPanel::sync_cali_result_for_multi_extruder(const std::vector< if (item.tray_id == name.first) { comboBox_tray_name->SetValue(from_u8(name.second)); } } - 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/CalibrationWizardSavePage.hpp b/src/slic3r/GUI/CalibrationWizardSavePage.hpp index 3233116d34..2c206cee79 100644 --- a/src/slic3r/GUI/CalibrationWizardSavePage.hpp +++ b/src/slic3r/GUI/CalibrationWizardSavePage.hpp @@ -190,7 +190,7 @@ class CalibrationPASavePage : public CalibrationCommonSavePage void show_panels(CalibrationMethod method, const PrinterSeries printer_ser); - void on_device_connected(MachineObject* obj); + void on_device_connected(MachineObject* obj) override; void update(MachineObject* obj) override; diff --git a/src/slic3r/GUI/CalibrationWizardStartPage.hpp b/src/slic3r/GUI/CalibrationWizardStartPage.hpp index 74c86ebf58..c7d917de0c 100644 --- a/src/slic3r/GUI/CalibrationWizardStartPage.hpp +++ b/src/slic3r/GUI/CalibrationWizardStartPage.hpp @@ -48,8 +48,8 @@ class CalibrationPAStartPage : public CalibrationStartPage void create_page(wxWindow* parent); - void on_reset_page(); - void on_device_connected(MachineObject* obj); + void on_reset_page() override; + void on_device_connected(MachineObject* obj) override; void msw_rescale() override; virtual void update(MachineObject *obj) override; @@ -65,8 +65,8 @@ class CalibrationFlowRateStartPage : public CalibrationStartPage long style = wxTAB_TRAVERSAL); void create_page(wxWindow* parent); - void on_reset_page(); - void on_device_connected(MachineObject* obj); + void on_reset_page() override; + void on_device_connected(MachineObject* obj) override; void msw_rescale() override; virtual void update(MachineObject *obj) override; diff --git a/src/slic3r/GUI/Camera.hpp b/src/slic3r/GUI/Camera.hpp index d8d36adcc6..a825d6e84b 100644 --- a/src/slic3r/GUI/Camera.hpp +++ b/src/slic3r/GUI/Camera.hpp @@ -72,7 +72,6 @@ struct Camera BoundingBoxf3 m_scene_box; Frustum m_frustum; Vec3f m_last_eye, m_last_center, m_last_up; - float m_last_near, m_last_far, m_last_aspect, m_last_fov,m_last_zoom; public: Camera() { set_default_orientation(); } diff --git a/src/slic3r/GUI/CameraPopup.cpp b/src/slic3r/GUI/CameraPopup.cpp index 1527e79d33..cd9f2972a7 100644 --- a/src/slic3r/GUI/CameraPopup.cpp +++ b/src/slic3r/GUI/CameraPopup.cpp @@ -110,7 +110,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/CameraPopup.hpp b/src/slic3r/GUI/CameraPopup.hpp index 31bc98f101..b60561a558 100644 --- a/src/slic3r/GUI/CameraPopup.hpp +++ b/src/slic3r/GUI/CameraPopup.hpp @@ -67,8 +67,10 @@ class CameraPopup : public PopupWindow SwitchButton* m_switch_recording; wxStaticText* m_text_vcamera; SwitchButton* m_switch_vcamera; +#if !BBL_RELEASE_TO_PUBLIC wxStaticText* m_text_liveview_retry; SwitchButton* m_switch_liveview_retry; +#endif //BBL_RELEASE_TO_PUBLIC wxStaticText* m_text_resolution; wxWindow* m_resolution_options[RESOLUTION_OPTIONS_NUM]; wxScrolledWindow *m_panel; diff --git a/src/slic3r/GUI/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp index 25f4a7b588..d601e30d2c 100644 --- a/src/slic3r/GUI/ConfigWizard.cpp +++ b/src/slic3r/GUI/ConfigWizard.cpp @@ -2771,7 +2771,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/ConnectPrinter.cpp b/src/slic3r/GUI/ConnectPrinter.cpp index e53d89e485..fa97dee7c6 100644 --- a/src/slic3r/GUI/ConnectPrinter.cpp +++ b/src/slic3r/GUI/ConnectPrinter.cpp @@ -175,7 +175,7 @@ void ConnectPrinterDialog::on_button_confirm(wxCommandEvent &event) { wxString code = m_textCtrl_code->GetTextCtrl()->GetValue(); for (char c : code) { - if (!('0' <= c && c <= '9' || 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z')) { + if (!(('0' <= c && c <= '9') || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'))) { show_error(this, _L("Invalid input.")); return; } diff --git a/src/slic3r/GUI/CreatePresetsDialog.cpp b/src/slic3r/GUI/CreatePresetsDialog.cpp index a2f584c9fd..840eb52ab1 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.cpp +++ b/src/slic3r/GUI/CreatePresetsDialog.cpp @@ -270,7 +270,7 @@ static wxArrayString get_exist_vendor_choices(VendorMap& vendors) vendors[users_models.name] = users_models; } - for (const pair &vendor : vendors) { + for (const pair &vendor : vendors) { if (vendor.second.models.empty() || vendor.second.id.empty()) continue; choices.Add(vendor.first); } @@ -668,11 +668,11 @@ void CreateFilamentPresetDialog::on_dpi_changed(const wxRect &suggested_rect) { bool CreateFilamentPresetDialog::is_check_box_selected() { - for (const std::pair<::CheckBox *, std::pair> &checkbox_preset : m_filament_preset) { + for (const std::pair<::CheckBox *const, std::pair> &checkbox_preset : m_filament_preset) { if (checkbox_preset.first->GetValue()) { return true; } } - for (const std::pair<::CheckBox *, std::pair> &checkbox_preset : m_machint_filament_preset) { + for (const std::pair<::CheckBox *const, std::pair> &checkbox_preset : m_machint_filament_preset) { if (checkbox_preset.first->GetValue()) { return true; } } @@ -703,7 +703,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_vendor_item() horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5)); wxArrayString choices; - for (const wxString &vendor : filament_vendors) { + for (const std::string &vendor : filament_vendors) { choices.push_back(vendor); } @@ -723,7 +723,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_vendor_item() m_filament_custom_vendor_input->SetSize(NAME_OPTION_COMBOBOX_SIZE); textInputSizer->Add(m_filament_custom_vendor_input, 0, wxEXPAND | wxALL, 0); m_filament_custom_vendor_input->GetTextCtrl()->SetHint(_L("Input Custom Vendor")); - m_filament_custom_vendor_input->GetTextCtrl()->Bind(wxEVT_CHAR, [this](wxKeyEvent &event) { + m_filament_custom_vendor_input->GetTextCtrl()->Bind(wxEVT_CHAR, [](wxKeyEvent &event) { int key = event.GetKeyCode(); if (cannot_input_key_for_filament.find(key) != cannot_input_key_for_filament.end()) { event.Skip(false); @@ -786,7 +786,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_type_item() horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5)); wxArrayString filament_type; - for (const wxString &filament : m_system_filament_types_set) { + for (const std::string &filament : m_system_filament_types_set) { filament_type.Add(filament); } @@ -834,7 +834,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_serial_item() m_filament_serial_input = new TextInput(this, "", "", "", wxDefaultPosition, NAME_OPTION_COMBOBOX_SIZE, wxTE_PROCESS_ENTER); m_filament_serial_input->GetTextCtrl()->SetMaxLength(50); comboBoxSizer->Add(m_filament_serial_input, 0, wxEXPAND | wxALL, 0); - m_filament_serial_input->GetTextCtrl()->Bind(wxEVT_CHAR, [this](wxKeyEvent &event) { + m_filament_serial_input->GetTextCtrl()->Bind(wxEVT_CHAR, [](wxKeyEvent &event) { int key = event.GetKeyCode(); if (cannot_input_key_for_filament.find(key) != cannot_input_key_for_filament.end()) { event.Skip(false); @@ -1060,7 +1060,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item() if (curr_create_type == m_create_type.base_filament) { BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":clone filament create type filament "; - for (const std::pair<::CheckBox *, std::pair> &checkbox_preset : m_filament_preset) { + for (const std::pair<::CheckBox *const, std::pair> &checkbox_preset : m_filament_preset) { if (checkbox_preset.first->GetValue()) { std::string compatible_printer_name = checkbox_preset.second.first; std::vector failures; @@ -1087,7 +1087,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item() } } else if (curr_create_type == m_create_type.base_filament_preset) { BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":clone filament presets create type filament preset"; - for (const std::pair<::CheckBox *, std::pair> &checkbox_preset : m_machint_filament_preset) { + for (const std::pair<::CheckBox *const, std::pair> &checkbox_preset : m_machint_filament_preset) { if (checkbox_preset.first->GetValue()) { std::string compatible_printer_name = checkbox_preset.second.first; std::vector failures; @@ -1165,7 +1165,7 @@ wxArrayString CreateFilamentPresetDialog::get_filament_preset_choices() } int suffix = 0; - for (const pair> &preset : m_filament_choice_map) { + for (const pair> &preset : m_filament_choice_map) { if (preset.second.empty()) continue; std::set preset_name_set; for (Preset* filament_preset : preset.second) { @@ -1698,7 +1698,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_printer_item(wxWindow *parent) m_custom_vendor_text_ctrl = new wxTextCtrl(parent, wxID_ANY, "", wxDefaultPosition, NAME_OPTION_COMBOBOX_SIZE); m_custom_vendor_text_ctrl->SetHint(_L("Input Custom Vendor")); - m_custom_vendor_text_ctrl->Bind(wxEVT_CHAR, [this](wxKeyEvent &event) { + m_custom_vendor_text_ctrl->Bind(wxEVT_CHAR, [](wxKeyEvent &event) { int key = event.GetKeyCode(); if (cannot_input_key.find(key) != cannot_input_key.end()) { // "@" can not be inputed event.Skip(false); @@ -1710,7 +1710,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_printer_item(wxWindow *parent) m_custom_vendor_text_ctrl->Hide(); m_custom_model_text_ctrl = new wxTextCtrl(parent, wxID_ANY, "", wxDefaultPosition, NAME_OPTION_COMBOBOX_SIZE); m_custom_model_text_ctrl->SetHint(_L("Input Custom Model")); - m_custom_model_text_ctrl->Bind(wxEVT_CHAR, [this](wxKeyEvent &event) { + m_custom_model_text_ctrl->Bind(wxEVT_CHAR, [](wxKeyEvent &event) { int key = event.GetKeyCode(); if (cannot_input_key.find(key) != cannot_input_key.end()) { // "@" can not be inputed event.Skip(false); @@ -1783,7 +1783,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_nozzle_diameter_item(wxWindow *par m_nozzle_diameter = new ComboBox(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, OPTION_SIZE, 0, nullptr, wxCB_READONLY); wxArrayString nozzle_diameters; const char dec_sep = is_decimal_separator_point() ? '.' : ','; - for (const std::string nozzle : nozzle_diameter_vec) { + for (const std::string& nozzle : nozzle_diameter_vec) { std::string display_nozzle = nozzle; size_t pos = display_nozzle.find('.'); if (pos != std::string::npos) { display_nozzle.replace(pos, 1, 1, dec_sep); } @@ -1795,7 +1795,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); @@ -3008,7 +3008,7 @@ bool CreatePrinterPresetDialog::data_init() item.first->SetValue(false); } else { - item.first->Enable(); + item.first->Enable(true); if (!has_set_value) { select_curr_radiobox(m_create_presets_btns, i); has_set_value = true; @@ -3655,6 +3655,10 @@ void ExportConfigsDialog::show_export_result(const ExportCase &export_case) case ExportCase::EXPORT_SUCCESS: msg_dlg = new MessageDialog(this, _L("Export successful"), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE); break; + case ExportCase::EXPORT_CANCEL: + case ExportCase::CASE_COUNT: + // No dialog for cancel or sentinel value + break; } if (msg_dlg) { @@ -4212,7 +4216,7 @@ ExportConfigsDialog::ExportCase ExportConfigsDialog::archive_filament_bundle_to_ BOOST_LOG_TRIVIAL(info) << "Filament preset json add successful: " << filament_preset->name; } - for (const std::pair& vendor_name_to_json : vendor_structure) { + for (const std::pair& vendor_name_to_json : vendor_structure) { json j; std::string filament_vendor = vendor_name_to_json.first; j["vendor"] = filament_vendor; diff --git a/src/slic3r/GUI/CreatePresetsDialog.hpp b/src/slic3r/GUI/CreatePresetsDialog.hpp index 118f98b9b0..d2fcc9e859 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.hpp +++ b/src/slic3r/GUI/CreatePresetsDialog.hpp @@ -79,7 +79,6 @@ class CreateFilamentPresetDialog : public DPIDialog ComboBox * m_filament_vendor_combobox = nullptr; ::CheckBox * m_can_not_find_vendor_checkbox = nullptr; ComboBox * m_filament_type_combobox = nullptr; - ComboBox * m_exist_vendor_combobox = nullptr; ComboBox * m_filament_preset_combobox = nullptr; TextInput * m_filament_custom_vendor_input = nullptr; wxGridSizer * m_filament_presets_sizer = nullptr; diff --git a/src/slic3r/GUI/DailyTips.cpp b/src/slic3r/GUI/DailyTips.cpp index 20b769cf23..9d7f22f098 100644 --- a/src/slic3r/GUI/DailyTips.cpp +++ b/src/slic3r/GUI/DailyTips.cpp @@ -245,7 +245,6 @@ DailyTipsPanel::DailyTipsPanel(bool can_expand, DailyTipsLayout layout) m_width(0), m_height(0), m_can_expand(can_expand), - m_layout(layout), m_uid(DailyTipsPanel::uid++), m_dailytips_renderer(std::make_unique(layout)) { diff --git a/src/slic3r/GUI/DailyTips.hpp b/src/slic3r/GUI/DailyTips.hpp index eb8d3495ea..4961d00460 100644 --- a/src/slic3r/GUI/DailyTips.hpp +++ b/src/slic3r/GUI/DailyTips.hpp @@ -53,7 +53,6 @@ class DailyTipsPanel { bool m_is_helio{ false }; bool m_first_enter{ false }; bool m_is_dark{ false }; - DailyTipsLayout m_layout{ DailyTipsLayout::Vertical }; float m_fade_opacity{ 1.0f }; }; diff --git a/src/slic3r/GUI/DeviceCore/DevConfig.h b/src/slic3r/GUI/DeviceCore/DevConfig.h index 449b5a7253..201e8fbe04 100644 --- a/src/slic3r/GUI/DeviceCore/DevConfig.h +++ b/src/slic3r/GUI/DeviceCore/DevConfig.h @@ -17,7 +17,7 @@ class MachineObject; class DevConfig { public: - DevConfig(MachineObject* obj) : m_obj(obj) {}; + DevConfig(MachineObject* obj) {}; ~DevConfig() = default; public: @@ -54,8 +54,6 @@ class DevConfig void ParseCalibrationConfig(const json& print_json); //cali private: - MachineObject* m_obj; - /*configure vals*/ // chamber bool m_has_chamber = false; // whether the machine has a chamber diff --git a/src/slic3r/GUI/DeviceCore/DevExtensionTool.cpp b/src/slic3r/GUI/DeviceCore/DevExtensionTool.cpp index 5426a9bba3..d9a99d41d8 100644 --- a/src/slic3r/GUI/DeviceCore/DevExtensionTool.cpp +++ b/src/slic3r/GUI/DeviceCore/DevExtensionTool.cpp @@ -8,7 +8,7 @@ using namespace nlohmann; namespace Slic3r { -DevExtensionTool::DevExtensionTool(MachineObject* obj) : m_owner(obj) +DevExtensionTool::DevExtensionTool(MachineObject* obj) { m_mount_3dp = MOUNT_NOT_MOUNTED; m_calib = CALIB_NONE; diff --git a/src/slic3r/GUI/DeviceCore/DevExtensionTool.h b/src/slic3r/GUI/DeviceCore/DevExtensionTool.h index 02f0b6a213..187cbb6a00 100644 --- a/src/slic3r/GUI/DeviceCore/DevExtensionTool.h +++ b/src/slic3r/GUI/DeviceCore/DevExtensionTool.h @@ -31,8 +31,6 @@ class DevExtensionTool DevExtensionTool(MachineObject* obj); private: - MachineObject* m_owner = nullptr; - enum MountState { MOUNT_NOT_MOUNTED = 0, diff --git a/src/slic3r/GUI/DeviceCore/DevFilaAmsSetting.h b/src/slic3r/GUI/DeviceCore/DevFilaAmsSetting.h index a60dbee81c..6a482761a4 100644 --- a/src/slic3r/GUI/DeviceCore/DevFilaAmsSetting.h +++ b/src/slic3r/GUI/DeviceCore/DevFilaAmsSetting.h @@ -10,7 +10,7 @@ class DevFilaSystem; class DevAmsSystemSetting { public: - DevAmsSystemSetting(DevFilaSystem* owner) : m_owner(owner) {}; + DevAmsSystemSetting(DevFilaSystem* owner) {}; public: // getters @@ -27,8 +27,6 @@ class DevAmsSystemSetting void SetAutoRefillEnabled(bool enable) { m_enable_auto_refill = enable; } private: - DevFilaSystem* m_owner = nullptr; - std::optional m_enable_detect_on_insert = false; bool m_enable_detect_on_powerup = false; bool m_enable_detect_remain = false; diff --git a/src/slic3r/GUI/DeviceCore/DevFirmware.h b/src/slic3r/GUI/DeviceCore/DevFirmware.h index d85fe87a62..cf72c51eda 100644 --- a/src/slic3r/GUI/DeviceCore/DevFirmware.h +++ b/src/slic3r/GUI/DeviceCore/DevFirmware.h @@ -48,10 +48,9 @@ class DevFirmwareVersionInfo class DevFirmware { public: - DevFirmware(MachineObject* obj) : m_owner(obj) {} + DevFirmware(MachineObject* obj) {} private: - MachineObject* m_owner = nullptr; }; } // namespace Slic3r \ No newline at end of file diff --git a/src/slic3r/GUI/DeviceCore/DevHMS.h b/src/slic3r/GUI/DeviceCore/DevHMS.h index 205cad77b3..57e6f4f797 100644 --- a/src/slic3r/GUI/DeviceCore/DevHMS.h +++ b/src/slic3r/GUI/DeviceCore/DevHMS.h @@ -14,15 +14,13 @@ class DevHMSItem; class DevHMS { public: - DevHMS(MachineObject* obj) : m_object(obj) {} + DevHMS(MachineObject* obj) {} public: void ParseHMSItems(const json& hms_json); const std::vector& GetHMSItems() const { return m_hms_list; }; private: - MachineObject* m_object = nullptr; - // all hms for this machine std::vector m_hms_list; }; diff --git a/src/slic3r/GUI/DeviceCore/DevManager.cpp b/src/slic3r/GUI/DeviceCore/DevManager.cpp index 147a9c22a2..4ddc7723af 100644 --- a/src/slic3r/GUI/DeviceCore/DevManager.cpp +++ b/src/slic3r/GUI/DeviceCore/DevManager.cpp @@ -699,7 +699,7 @@ namespace Slic3r obj->m_is_online = elem["dev_online"].get(); if (elem.contains("dev_model_name") && !elem["dev_model_name"].is_null()) { auto printer_type = elem["dev_model_name"].get(); - for (const std::pair> &pair : device_subseries) { + for (const std::pair> &pair : device_subseries) { auto it = std::find(pair.second.begin(), pair.second.end(), printer_type); if (it != pair.second.end()) { diff --git a/src/slic3r/GUI/DeviceCore/DevStorage.h b/src/slic3r/GUI/DeviceCore/DevStorage.h index e64be278b7..5b7a36ae35 100644 --- a/src/slic3r/GUI/DeviceCore/DevStorage.h +++ b/src/slic3r/GUI/DeviceCore/DevStorage.h @@ -10,7 +10,7 @@ class MachineObject; class DevStorage { public: - DevStorage(MachineObject *obj) : m_owner(obj){} + DevStorage(MachineObject *obj) {} public: @@ -29,7 +29,6 @@ class DevStorage static void ParseV1_0(const json &print_json, DevStorage *system); private: - MachineObject *m_owner; SdcardState m_sdcard_state { NO_SDCARD }; }; diff --git a/src/slic3r/GUI/DeviceTab/uiAmsHumidityPopup.cpp b/src/slic3r/GUI/DeviceTab/uiAmsHumidityPopup.cpp index b752d3cfec..c7539908a8 100644 --- a/src/slic3r/GUI/DeviceTab/uiAmsHumidityPopup.cpp +++ b/src/slic3r/GUI/DeviceTab/uiAmsHumidityPopup.cpp @@ -1,9 +1,9 @@ -//**********************************************************/ -/* File: uiAmsHumidityPopup.cpp -* Description: The popup with DevAms Humidity -* -* \n class uiAmsHumidityPopup -//**********************************************************/ +/********************************************************** + * File: uiAmsHumidityPopup.cpp + * Description: The popup with DevAms Humidity + * + * \n class uiAmsHumidityPopup + **********************************************************/ #include "uiAmsHumidityPopup.h" diff --git a/src/slic3r/GUI/DeviceTab/uiAmsHumidityPopup.h b/src/slic3r/GUI/DeviceTab/uiAmsHumidityPopup.h index 1c4295dc53..0b76792295 100644 --- a/src/slic3r/GUI/DeviceTab/uiAmsHumidityPopup.h +++ b/src/slic3r/GUI/DeviceTab/uiAmsHumidityPopup.h @@ -1,9 +1,9 @@ -//**********************************************************/ -/* File: uiAmsHumidityPopup.h -* Description: The popup with DevAms Humidity -* -* \n class uiAmsHumidityPopup -//**********************************************************/ +/********************************************************** + * File: uiAmsHumidityPopup.h + * Description: The popup with DevAms Humidity + * + * \n class uiAmsHumidityPopup + **********************************************************/ #pragma once #include "slic3r/GUI/Widgets/AMSItem.hpp" @@ -34,6 +34,8 @@ struct uiAmsHumidityInfo class uiAmsPercentHumidityDryPopup : public wxDialog { public: + using wxDialog::Update; + uiAmsPercentHumidityDryPopup(wxWindow *parent); ~uiAmsPercentHumidityDryPopup() = default; diff --git a/src/slic3r/GUI/DeviceTab/uiDeviceUpdateVersion.cpp b/src/slic3r/GUI/DeviceTab/uiDeviceUpdateVersion.cpp index 14066630fe..deb70aaa80 100644 --- a/src/slic3r/GUI/DeviceTab/uiDeviceUpdateVersion.cpp +++ b/src/slic3r/GUI/DeviceTab/uiDeviceUpdateVersion.cpp @@ -1,9 +1,9 @@ -//**********************************************************/ -/* File: uiDeviceUpdateVersion.cpp -* Description: The panel with firmware info -* -* \n class uiDeviceUpdateVersion -//**********************************************************/ +/********************************************************** + * File: uiDeviceUpdateVersion.cpp + * Description: The panel with firmware info + * + * \n class uiDeviceUpdateVersion + **********************************************************/ #include "uiDeviceUpdateVersion.h" diff --git a/src/slic3r/GUI/DeviceTab/uiDeviceUpdateVersion.h b/src/slic3r/GUI/DeviceTab/uiDeviceUpdateVersion.h index 100280db62..0bcffa1e7c 100644 --- a/src/slic3r/GUI/DeviceTab/uiDeviceUpdateVersion.h +++ b/src/slic3r/GUI/DeviceTab/uiDeviceUpdateVersion.h @@ -1,9 +1,9 @@ -//**********************************************************/ -/* File: uiDeviceUpdateVersion.h -* Description: The panel with firmware info -* -* \n class uiDeviceUpdateVersion -//**********************************************************/ +/********************************************************** + * File: uiDeviceUpdateVersion.h + * Description: The panel with firmware info + * + * \n class uiDeviceUpdateVersion + **********************************************************/ #pragma once #include diff --git a/src/slic3r/GUI/DeviceTab/wgtDeviceNozzleRack.cpp b/src/slic3r/GUI/DeviceTab/wgtDeviceNozzleRack.cpp index 4b96996832..4b6756eafa 100644 --- a/src/slic3r/GUI/DeviceTab/wgtDeviceNozzleRack.cpp +++ b/src/slic3r/GUI/DeviceTab/wgtDeviceNozzleRack.cpp @@ -1,12 +1,12 @@ -//**********************************************************/ -/* File: wgtDeviceNozzleRack.cpp -* Description: The panel with rack info -* -* \n class wgtDeviceNozzleRackArea; -* \n class wgtDeviceNozzleRackNozzleItem; -* \n class wgtDeviceNozzleRackToolHead; -* \n class wgtDeviceNozzleRackPos; -//**********************************************************/ +/********************************************************** + * File: wgtDeviceNozzleRack.cpp + * Description: The panel with rack info + * + * \n class wgtDeviceNozzleRackArea; + * \n class wgtDeviceNozzleRackNozzleItem; + * \n class wgtDeviceNozzleRackToolHead; + * \n class wgtDeviceNozzleRackPos; + **********************************************************/ #include "wgtDeviceNozzleRack.h" #include "wgtDeviceNozzleRackUpdate.h" diff --git a/src/slic3r/GUI/DeviceTab/wgtDeviceNozzleRack.h b/src/slic3r/GUI/DeviceTab/wgtDeviceNozzleRack.h index fe12b8bc50..4cec33d9b3 100644 --- a/src/slic3r/GUI/DeviceTab/wgtDeviceNozzleRack.h +++ b/src/slic3r/GUI/DeviceTab/wgtDeviceNozzleRack.h @@ -1,12 +1,12 @@ -//**********************************************************/ -/* File: wgtDeviceNozzleRack.h -* Description: The panel with rack and nozzles -* -* \n class wgtDeviceNozzleRackArea; -* \n class wgtDeviceNozzleRackNozzleItem; -* \n class wgtDeviceNozzleRackToolHead; -* \n class wgtDeviceNozzleRackPos; -//**********************************************************/ +/********************************************************** + * File: wgtDeviceNozzleRack.h + * Description: The panel with rack and nozzles + * + * \n class wgtDeviceNozzleRackArea; + * \n class wgtDeviceNozzleRackNozzleItem; + * \n class wgtDeviceNozzleRackToolHead; + * \n class wgtDeviceNozzleRackPos; + **********************************************************/ #pragma once #include "slic3r/GUI/DeviceCore/DevNozzleRack.h" @@ -197,6 +197,8 @@ class wgtDeviceNozzleRackNozzleItem : public StaticBox }; public: + using wxWindow::Update; + wgtDeviceNozzleRackNozzleItem(wxWindow* parent, int nozzle_id); public: diff --git a/src/slic3r/GUI/DeviceTab/wgtDeviceNozzleRackUpdate.cpp b/src/slic3r/GUI/DeviceTab/wgtDeviceNozzleRackUpdate.cpp index f65ed2c0a6..ff8f4dc59a 100644 --- a/src/slic3r/GUI/DeviceTab/wgtDeviceNozzleRackUpdate.cpp +++ b/src/slic3r/GUI/DeviceTab/wgtDeviceNozzleRackUpdate.cpp @@ -1,9 +1,9 @@ -//**********************************************************/ -/* File: wgtDeviceNozzleRackUpdate.cpp -* Description: The panel with rack updating -* -* \n class wgtDeviceNozzleRackUpdate -//**********************************************************/ +/********************************************************** + * File: wgtDeviceNozzleRackUpdate.cpp + * Description: The panel with rack updating + * + * \n class wgtDeviceNozzleRackUpdate + **********************************************************/ #include "wgtDeviceNozzleRackUpdate.h" diff --git a/src/slic3r/GUI/DeviceTab/wgtDeviceNozzleRackUpdate.h b/src/slic3r/GUI/DeviceTab/wgtDeviceNozzleRackUpdate.h index 48035ed3c5..346ddaf367 100644 --- a/src/slic3r/GUI/DeviceTab/wgtDeviceNozzleRackUpdate.h +++ b/src/slic3r/GUI/DeviceTab/wgtDeviceNozzleRackUpdate.h @@ -1,9 +1,9 @@ -//**********************************************************/ -/* File: wgtDeviceNozzleRackUpdate.h -* Description: The panel for updating hotends -* -* \n class wgtDeviceNozzleRackUpdate -//**********************************************************/ +/********************************************************** + * File: wgtDeviceNozzleRackUpdate.h + * Description: The panel for updating hotends + * + * \n class wgtDeviceNozzleRackUpdate + **********************************************************/ #pragma once #include "slic3r/GUI/DeviceCore/DevNozzleRack.h" @@ -130,7 +130,6 @@ class wgtDeviceNozzleRackHotendUpdate : public StaticBox Label* m_diameter_label; Label* m_flowtype_label; Label* m_type_label; - ScalableButton* m_error_button{ nullptr }; Label* m_sn_label; Label* m_version_label; diff --git a/src/slic3r/GUI/DeviceTab/wgtDeviceNozzleSelect.cpp b/src/slic3r/GUI/DeviceTab/wgtDeviceNozzleSelect.cpp index f2e614dd33..f1ed1f8daa 100644 --- a/src/slic3r/GUI/DeviceTab/wgtDeviceNozzleSelect.cpp +++ b/src/slic3r/GUI/DeviceTab/wgtDeviceNozzleSelect.cpp @@ -1,9 +1,9 @@ -//**********************************************************/ -/* File: wgtDeviceNozzleSelect.cpp -* Description: The panel to select nozzle -* -* \n class wgtDeviceNozzleSelect; -//**********************************************************/ +/********************************************************** + * File: wgtDeviceNozzleSelect.cpp + * Description: The panel to select nozzle + * + * \n class wgtDeviceNozzleSelect; + **********************************************************/ #include "wgtDeviceNozzleSelect.h" #include "wgtDeviceNozzleRack.h" @@ -147,7 +147,7 @@ void wgtDeviceNozzleRackSelect::SetSelectedNozzle(const DevNozzle &nozzle) void wgtDeviceNozzleRackSelect::OnNozzleItemSelected(wxCommandEvent &evt) { auto *item = dynamic_cast(evt.GetEventObject()); - if (item; auto ptr = m_nozzle_rack.lock()) { + if (auto ptr = m_nozzle_rack.lock()) { if (item == m_toolhead_nozzle) { SetSelectedNozzle(ptr->GetNozzleSystem()->GetExtNozzle(MAIN_EXTRUDER_ID)); } else { diff --git a/src/slic3r/GUI/DeviceTab/wgtDeviceNozzleSelect.h b/src/slic3r/GUI/DeviceTab/wgtDeviceNozzleSelect.h index 3b7d1ede11..2ac0bf005d 100644 --- a/src/slic3r/GUI/DeviceTab/wgtDeviceNozzleSelect.h +++ b/src/slic3r/GUI/DeviceTab/wgtDeviceNozzleSelect.h @@ -1,9 +1,9 @@ -//**********************************************************/ -/* File: wgtDeviceNozzleSelect.h -* Description: The panel to select nozzle -* -* \n class wgtDeviceNozzleSelect; -//**********************************************************/ +/********************************************************** + * File: wgtDeviceNozzleSelect.h + * Description: The panel to select nozzle + * + * \n class wgtDeviceNozzleSelect; + **********************************************************/ #pragma once diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 4f81f72b24..afdc894239 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -1063,6 +1063,9 @@ void SpinCtrl::BUILD() { // # As a workaround, we get the new value from $event->GetString and store // # here temporarily so that we can return it from get_value() +#ifdef __WXOSX__ + (void)temp; // Suppress unused warning on macOS (used on other platforms) +#endif long value; const bool parsed = e.GetString().ToLong(&value); if (!parsed || value < INT_MIN || value > INT_MAX) diff --git a/src/slic3r/GUI/FilamentMapDialog.cpp b/src/slic3r/GUI/FilamentMapDialog.cpp index c8e7a6ad6f..2490e96de3 100644 --- a/src/slic3r/GUI/FilamentMapDialog.cpp +++ b/src/slic3r/GUI/FilamentMapDialog.cpp @@ -350,16 +350,16 @@ void FilamentMapDialog::update_panel_status(PageType page) if (page == PageType::ptDefault) { if (m_default_btn && m_default_map_panel) { m_default_btn->Select(true); - m_default_map_panel->Show(); + m_default_map_panel->ShowPanel(); } } if (page == PageType::ptManual) { m_manual_btn->Select(true); - m_manual_map_panel->Show(); + m_manual_map_panel->ShowPanel(); } if (page == PageType::ptAuto) { m_auto_btn->Select(true); - m_auto_map_panel->Show(); + m_auto_map_panel->ShowPanel(); if (!m_ok_btn->IsEnabled()) { m_ok_btn->Enable(); } diff --git a/src/slic3r/GUI/FilamentMapPanel.cpp b/src/slic3r/GUI/FilamentMapPanel.cpp index c4ecdf66f2..4bd023ad61 100644 --- a/src/slic3r/GUI/FilamentMapPanel.cpp +++ b/src/slic3r/GUI/FilamentMapPanel.cpp @@ -34,8 +34,8 @@ void FilamentMapManualPanel::OnTimer(wxTimerEvent &) std::vectornozzle_count(nozzle_volume_values.size()); for (size_t eid = 0; eid < nozzle_volume_values.size(); ++eid) { NozzleVolumeType extruder_volume_type = NozzleVolumeType(nozzle_volume_values[eid]); - bool extruder_used = std::find_if(m_filament_list.begin(), m_filament_list.end(), - [this, eid, filament_map](int fid) { + bool extruder_used = std::find_if(m_filament_list.begin(), m_filament_list.end(), + [eid, filament_map](int fid) { return (filament_map[fid - 1] - 1) == eid; }) != m_filament_list.end(); @@ -49,9 +49,9 @@ void FilamentMapManualPanel::OnTimer(wxTimerEvent &) auto has_material_of_type = [this, eid, &filament_map, &filament_volume_map](NozzleVolumeType volume_type) { return std::find_if(m_filament_list.begin(), m_filament_list.end(), - [this, eid, &filament_map, &filament_volume_map, volume_type](int fid) { - return (filament_map[fid - 1] - 1) == eid && - fid - 1 < filament_volume_map.size() && + [eid, &filament_map, &filament_volume_map, volume_type](int fid) { + return (filament_map[fid - 1] - 1) == eid && + fid - 1 < filament_volume_map.size() && filament_volume_map[fid - 1] == static_cast(volume_type); }) != m_filament_list.end(); }; @@ -338,7 +338,7 @@ FilamentMapManualPanel::FilamentMapManualPanel(wxWindow *p void FilamentMapManualPanel::UpdateNozzleVolumeType() { - auto check_separation = [this]() { + auto check_separation = []() { auto preset_bundle = wxGetApp().preset_bundle; auto nozzle_volume_values = preset_bundle->project_config.option("nozzle_volume_type")->values; if (nozzle_volume_values.size() <= 1) @@ -410,7 +410,7 @@ void FilamentMapManualPanel::OnSwitchFilament(wxCommandEvent &) } } -void FilamentMapManualPanel::Hide() +void FilamentMapManualPanel::HidePanel() { m_left_panel->Hide(); m_right_panel->Hide(); @@ -419,7 +419,7 @@ void FilamentMapManualPanel::Hide() m_timer->Stop(); } -void FilamentMapManualPanel::Show() +void FilamentMapManualPanel::ShowPanel() { m_left_panel->Show(); m_right_panel->Show(); @@ -589,14 +589,14 @@ void FilamentMapBtnPanel::Select(bool selected) Refresh(); } -void GUI::FilamentMapBtnPanel::Hide() +void GUI::FilamentMapBtnPanel::HidePanel() { m_btn->Hide(); m_label->Hide(); m_detail->Hide(); wxPanel::Hide(); } -void GUI::FilamentMapBtnPanel::Show() +void GUI::FilamentMapBtnPanel::ShowPanel() { m_btn->Show(); m_label->Show(); @@ -641,17 +641,17 @@ FilamentMapAutoPanel::FilamentMapAutoPanel(wxWindow *parent, FilamentMapMode mod Layout(); GUI::wxGetApp().UpdateDarkUIWin(this); } -void FilamentMapAutoPanel::Hide() +void FilamentMapAutoPanel::HidePanel() { - m_flush_panel->Hide(); - m_match_panel->Hide(); + m_flush_panel->HidePanel(); + m_match_panel->HidePanel(); wxPanel::Hide(); } -void FilamentMapAutoPanel::Show() +void FilamentMapAutoPanel::ShowPanel() { - m_flush_panel->Show(); - m_match_panel->Show(); + m_flush_panel->ShowPanel(); + m_match_panel->ShowPanel(); wxPanel::Show(); } @@ -690,13 +690,13 @@ FilamentMapDefaultPanel::FilamentMapDefaultPanel(wxWindow *parent) : wxPanel(par GUI::wxGetApp().UpdateDarkUIWin(this); } -void FilamentMapDefaultPanel::Hide() +void FilamentMapDefaultPanel::HidePanel() { m_label->Hide(); wxPanel::Hide(); } -void FilamentMapDefaultPanel::Show() +void FilamentMapDefaultPanel::ShowPanel() { m_label->Show(); wxPanel::Show(); diff --git a/src/slic3r/GUI/FilamentMapPanel.hpp b/src/slic3r/GUI/FilamentMapPanel.hpp index eccb1e6a45..caf5ab114a 100644 --- a/src/slic3r/GUI/FilamentMapPanel.hpp +++ b/src/slic3r/GUI/FilamentMapPanel.hpp @@ -30,8 +30,8 @@ class FilamentMapManualPanel : public wxPanel void UpdateNozzleVolumeType(); void UpdateNozzleCountDisplay(); - void Hide(); - void Show(); + void HidePanel(); + void ShowPanel(); private: void OnTimer(wxTimerEvent &evt); @@ -63,8 +63,8 @@ class FilamentMapBtnPanel : public wxPanel { public: FilamentMapBtnPanel(wxWindow *parent, const wxString &label, const wxString &detail, const std::string &icon_path); - void Hide(); - void Show(); + void HidePanel(); + void ShowPanel(); void Select(bool selected); bool Enable(bool enable); bool IsEnabled() const { return m_enabled; } @@ -93,8 +93,8 @@ class FilamentMapAutoPanel : public wxPanel { public: FilamentMapAutoPanel(wxWindow *parent, FilamentMapMode mode, bool machine_synced); - void Hide(); - void Show(); + void HidePanel(); + void ShowPanel(); FilamentMapMode GetMode() const { return m_mode; } private: @@ -110,8 +110,8 @@ class FilamentMapDefaultPanel : public wxPanel { public: FilamentMapDefaultPanel(wxWindow *parent); - void Hide(); - void Show(); + void HidePanel(); + void ShowPanel(); private: Label *m_label; diff --git a/src/slic3r/GUI/FilamentPickerDialog.cpp b/src/slic3r/GUI/FilamentPickerDialog.cpp index 973f6589fa..97cbdd604e 100644 --- a/src/slic3r/GUI/FilamentPickerDialog.cpp +++ b/src/slic3r/GUI/FilamentPickerDialog.cpp @@ -423,11 +423,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/GCodeRenderer/AdvancedRenderer.cpp b/src/slic3r/GUI/GCodeRenderer/AdvancedRenderer.cpp index ae7d66e0c5..f645fb9b8e 100644 --- a/src/slic3r/GUI/GCodeRenderer/AdvancedRenderer.cpp +++ b/src/slic3r/GUI/GCodeRenderer/AdvancedRenderer.cpp @@ -153,10 +153,10 @@ namespace wxImage image(width, height); image.InitAlpha(); - for (unsigned int ih = 0; ih < height; ++ih) + for (int ih = 0; ih < height; ++ih) { - unsigned int rr = (height - 1 - ih) * width; - for (unsigned int iw = 0; iw < width; ++iw) + int rr = (height - 1 - ih) * width; + for (int iw = 0; iw < width; ++iw) { float* px = (float*)pixel_data.data() + 4 * (rr + iw); const unsigned char r = px[0] * 255.0f; @@ -181,7 +181,7 @@ namespace uint32_t prev_first_pos_index = 0; bool has_prev = false; if (flag) { - if (prev_seg_index != -1u) { + if (prev_seg_index != UINT32_MAX) { uint32_t prev_second_pos_index = segment_index_list[prev_seg_index * 4 + 1]; if (prev_second_pos_index == first_pos_index) { prev_first_pos_index = segment_index_list[prev_seg_index * 4 + 0]; @@ -347,6 +347,11 @@ namespace Slic3r export_image(m_p_tool_colors_texture, parent_path.wstring() + "/tool_colors.png"); break; } + default: + { + BOOST_LOG_TRIVIAL(warning) << "AdvancedRenderer::export_toolpaths_to_obj: Unhandled view type " << static_cast(m_view_type) << " in export switch"; + break; + } } fprintf(fp, "\nnewmtl material_2\n"); @@ -633,8 +638,8 @@ namespace Slic3r fprintf(fp, "vt %g %g \n", uv.x(), uv.y()); } - fprintf(fp, "\nusemtl material_%zu\n", 1); - fprintf(fp, "# triangles material %zu\n", 1); + fprintf(fp, "\nusemtl material_%d\n", 1); + fprintf(fp, "# triangles material %d\n", 1); if (colored_indices.size()) { for (int i = 0; i < colored_indices.size(); i += 3) { @@ -646,8 +651,8 @@ namespace Slic3r } if (other_indices.size()) { - fprintf(fp, "\nusemtl material_%zu\n", 2); - fprintf(fp, "# triangles material %zu\n", 2); + fprintf(fp, "\nusemtl material_%d\n", 2); + fprintf(fp, "# triangles material %d\n", 2); for (int i = 0; i < other_indices.size(); i += 3) { size_t v1 = other_indices[i] + 1; @@ -1231,6 +1236,11 @@ namespace Slic3r break; } // end helio + default: + { + BOOST_LOG_TRIVIAL(warning) << "AdvancedRenderer::render: Unhandled view type " << static_cast(m_view_type) << " in texture binding switch"; + break; + } } for (size_t i = 0; i < layer_index_list.size(); ++i) { @@ -1922,10 +1932,10 @@ namespace Slic3r bool Layer::is_valid() const { bool rt = false; - if (m_start_sid == -1u) { + if (m_start_sid == UINT32_MAX) { return false; } - if (m_end_sid == -1u) { + if (m_end_sid == UINT32_MAX) { return false; } if (m_start_sid > m_end_sid) { @@ -1975,7 +1985,7 @@ namespace Slic3r m_options_segment_list.reserve(seg_count); m_other_segment_list.reserve(seg_count); - uint32_t prev_seg_index = -1u; + uint32_t prev_seg_index = UINT32_MAX; uint32_t t_start_seg_index = start_seg_index == UINT32_MAX ? 0 : start_seg_index; t_start_seg_index = std::min(t_start_seg_index, seg_count - 1); @@ -1987,7 +1997,7 @@ namespace Slic3r } const auto t_view_type = t_layer_manager.get_view_type(); - for (int i_seg = t_start_seg_index; i_seg <= t_end_seg_index; ++i_seg) { + for (uint32_t i_seg = t_start_seg_index; i_seg <= t_end_seg_index; ++i_seg) { const auto& t_seg = m_segments[i_seg]; if (!t_layer_manager.is_move_type_visible(t_seg.m_type)) { continue; @@ -2004,6 +2014,10 @@ namespace Slic3r m_visible_segment_list.emplace_back(i_seg); switch (t_seg.m_type) { + case EMoveType::Noop: + case EMoveType::Count: + // No operation / sentinel value - do nothing + break; case EMoveType::Tool_change: case EMoveType::Color_change: case EMoveType::Pause_Print: @@ -2464,7 +2478,7 @@ namespace Slic3r const int t_start_count = 0; const int t_end_count = seg_count; - if (start > t_end_count) { + if (static_cast(start) > t_end_count) { return; } if (start > m_current_move_range.second) { @@ -2495,7 +2509,7 @@ namespace Slic3r } const int t_start_count = 1; const int t_end_count = seg_count; - if (end > t_end_count) { + if (static_cast(end) > t_end_count) { return; } if (end < m_current_move_range.first) { @@ -2614,7 +2628,7 @@ namespace Slic3r const auto& t_segment_vertices = t_top_layer.get_segment_vertices(); size_t t_start_seg_count = m_current_move_range.first; size_t t_end_seg_count = m_current_move_range.second; - uint32_t prev_seg_index = -1u; + uint32_t prev_seg_index = UINT32_MAX; m_options_segment_list.reserve(1000); m_other_segment_list.reserve(1000); @@ -2623,8 +2637,12 @@ namespace Slic3r continue; } const auto& t_seg = t_segments[t_segments_indices[j_seg - 1]]; - + switch (t_seg.m_type) { + case EMoveType::Noop: + case EMoveType::Count: + // No operation / sentinel value - do nothing + break; case EMoveType::Tool_change: case EMoveType::Color_change: case EMoveType::Pause_Print: diff --git a/src/slic3r/GUI/GCodeRenderer/AdvancedRenderer.hpp b/src/slic3r/GUI/GCodeRenderer/AdvancedRenderer.hpp index 0c2c2eb70b..8669d9b212 100644 --- a/src/slic3r/GUI/GCodeRenderer/AdvancedRenderer.hpp +++ b/src/slic3r/GUI/GCodeRenderer/AdvancedRenderer.hpp @@ -25,7 +25,7 @@ namespace Slic3r { { public: explicit ColorEffect(); - ~ColorEffect(); + virtual ~ColorEffect(); void set_color(float r, float g, float b, float a); @@ -64,18 +64,18 @@ namespace Slic3r { ~AdvancedRenderer(); void init(ConfigOptionMode mode, Slic3r::PresetBundle* preset_bundle) override; - void update_sequential_view_current(unsigned int first, unsigned int last); - void render_calibration_thumbnail(ThumbnailData& thumbnail_data, unsigned int w, unsigned int h, const ThumbnailsParams& thumbnail_params, PartPlateList& partplate_list, OpenGLManager& opengl_manager); - std::vector get_layers_zs() const; - unsigned int get_options_visibility_flags() const; - void set_options_visibility_from_flags(unsigned int flags); + void update_sequential_view_current(unsigned int first, unsigned int last) override; + void render_calibration_thumbnail(ThumbnailData& thumbnail_data, unsigned int w, unsigned int h, const ThumbnailsParams& thumbnail_params, PartPlateList& partplate_list, OpenGLManager& opengl_manager) override; + std::vector get_layers_zs() const override; + unsigned int get_options_visibility_flags() const override; + void set_options_visibility_from_flags(unsigned int flags) override; unsigned int get_toolpath_role_visibility_flags() const; void refresh(const GCodeProcessorResult& gcode_result, const std::vector& str_tool_colors) override; - void refresh_render_paths(); - bool can_export_toolpaths() const; - void export_toolpaths_to_obj(const char* filename) const; - void set_layers_z_range(const std::array& layers_z_range); - void render(int canvas_width, int canvas_height, int right_margin); + void refresh_render_paths() override; + bool can_export_toolpaths() const override; + void export_toolpaths_to_obj(const char* filename) const override; + void set_layers_z_range(const std::array& layers_z_range) override; + void render(int canvas_width, int canvas_height, int right_margin) override; void reset() override; bool is_move_type_visible(EMoveType type) const override; void set_move_type_visible(EMoveType type, bool visible) override; @@ -134,14 +134,14 @@ namespace Slic3r { struct SegmentVertex { - uint32_t m_move_id{ -1u }; + uint32_t m_move_id{ UINT32_MAX }; std::vector m_indices; }; struct Segment { - uint32_t m_first_mid{ -1u }; - uint32_t m_second_mid{ -1u }; + uint32_t m_first_mid{ UINT32_MAX }; + uint32_t m_second_mid{ UINT32_MAX }; EMoveType m_type{ EMoveType::Count }; ExtrusionRole m_role{ ExtrusionRole::erCount }; uint16_t m_extruder_id{ UINT16_MAX }; @@ -209,8 +209,8 @@ namespace Slic3r { private: bool m_b_valid{ true }; - uint32_t m_start_sid{ -1u }; - uint32_t m_end_sid{ -1u }; + uint32_t m_start_sid{ UINT32_MAX }; + uint32_t m_end_sid{ UINT32_MAX }; float m_zs{ 0.0f }; std::vector m_segments; std::vector m_visible_segment_list; diff --git a/src/slic3r/GUI/GCodeRenderer/BaseRenderer.cpp b/src/slic3r/GUI/GCodeRenderer/BaseRenderer.cpp index e6df7804e8..a443f41555 100644 --- a/src/slic3r/GUI/GCodeRenderer/BaseRenderer.cpp +++ b/src/slic3r/GUI/GCodeRenderer/BaseRenderer.cpp @@ -471,7 +471,7 @@ namespace Slic3r return; } if ((int)m_last_result_id != -1) { - auto it = std::find_if(m_gcode_result->moves.begin(), m_gcode_result->moves.end(), [this, &p_sequential_view](auto move) { + auto it = std::find_if(m_gcode_result->moves.begin(), m_gcode_result->moves.end(), [&p_sequential_view](auto move) { if (p_sequential_view->current.last < p_sequential_view->gcode_ids.size() && p_sequential_view->current.last >= 0) { return move.gcode_id == static_cast(p_sequential_view->gcode_ids[p_sequential_view->current.last]); } @@ -596,7 +596,7 @@ namespace Slic3r { min.x(), max.y() } }; }*/ } - else if (&wxGetApp() && wxGetApp().app_config->get_bool("show_shells_in_preview")) { // BBS: load shell at helio_gcode + else if (wxGetApp().app_config->get_bool("show_shells_in_preview")) { // BBS: load shell at helio_gcode load_shells(print, initialized,true); update_shells_color_by_extruder(m_config); } @@ -607,7 +607,7 @@ namespace Slic3r short_time(get_time_dhms(time)) == short_time(get_time_dhms(m_print_statistics.modes[static_cast(PrintEstimatedStatistics::ETimeMode::Normal)].time))) m_time_estimate_mode = PrintEstimatedStatistics::ETimeMode::Normal; } - if (&wxGetApp() && !wxGetApp().app_config->get_bool("use_last_fold_state_gcodeview_option_panel")) { + if (!wxGetApp().app_config->get_bool("use_last_fold_state_gcodeview_option_panel")) { m_fold = false; } @@ -754,7 +754,7 @@ namespace Slic3r } return ret; }; - auto append_item = [icon_size, &imgui, imperial_units, &window_padding, &draw_list, this](bool draw_icon, const Color& color, const std::vector>& columns_offsets) + auto append_item = [icon_size, &imgui, &window_padding, &draw_list, this](bool draw_icon, const Color& color, const std::vector>& columns_offsets) { // render icon ImVec2 pos = ImVec2(ImGui::GetCursorScreenPos().x + window_padding * 3, ImGui::GetCursorScreenPos().y); @@ -784,7 +784,7 @@ namespace Slic3r } ImGui::Separator(); }; - auto get_used_filament_from_volume = [this, imperial_units, &filament_diameters, &filament_densities](double volume, int extruder_id) { + auto get_used_filament_from_volume = [imperial_units, &filament_diameters, &filament_densities](double volume, int extruder_id) { double koef = imperial_units ? 1.0 / GizmoObjectManipulation::in_to_mm : 0.001; std::pair ret = { koef * volume / (PI * sqr(0.5 * filament_diameters[extruder_id])), volume * filament_densities[extruder_id] * 0.001 }; @@ -1368,7 +1368,7 @@ namespace Slic3r draw_list->AddRectFilled(ImVec2(pos_rect.x, pos_rect.y - ImGui::GetStyle().WindowPadding.y), 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, &checkbox_offset, this]( + auto append_item = [icon_size, &imgui, &window_padding, &draw_list, &checkbox_offset, this]( EItemType type, const Color& color, const std::vector>& columns_offsets, @@ -1877,7 +1877,7 @@ namespace Slic3r } auto append_option_item = [this, append_item](EMoveType type, std::vector offsets) { auto append_option_item_with_type = [this, offsets, append_item](EMoveType type, const Color& color, const std::string& label, bool visible) { - append_item(EItemType::Rect, color, { { label , offsets[0] } }, true, visible, [this, type, visible]() { + append_item(EItemType::Rect, color, { { label , offsets[0] } }, true, visible, [this, type]() { set_move_type_visible(type, !is_move_type_visible(type)); on_visibility_changed(); }); diff --git a/src/slic3r/GUI/GCodeRenderer/LegacyRenderer.cpp b/src/slic3r/GUI/GCodeRenderer/LegacyRenderer.cpp index 2350291fdf..1cf6a33c4e 100644 --- a/src/slic3r/GUI/GCodeRenderer/LegacyRenderer.cpp +++ b/src/slic3r/GUI/GCodeRenderer/LegacyRenderer.cpp @@ -1818,7 +1818,7 @@ namespace Slic3r { return in_layers_range(path.sub_paths.front().first.s_id) && in_layers_range(path.sub_paths.back().last.s_id); }; //BBS - auto is_extruder_in_layer_range = [this](const Path& path, size_t extruder_id) { + auto is_extruder_in_layer_range = [](const Path& path, size_t extruder_id) { return path.extruder_id == extruder_id; }; auto is_travel_in_layers_range = [this](size_t path_id, size_t min_id, size_t max_id) { diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 41dee989d5..270c909332 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -117,6 +117,12 @@ static constexpr const size_t VERTEX_BUFFER_RESERVE_SIZE = 131072 * 2; // 1.05MB // Reserve size in number of floats, maximum sum of all preallocated buffers. //static constexpr const size_t VERTEX_BUFFER_RESERVE_SIZE_SUM_MAX = 1024 * 1024 * 128 / 4; // 128MB +namespace { + // Constexpr constants to avoid MSVC C4756 warnings in initializer lists + constexpr float FLOAT_LOWEST = std::numeric_limits::lowest(); + constexpr float FLOAT_MAX = std::numeric_limits::max(); +} + namespace Slic3r { namespace GUI { @@ -278,7 +284,7 @@ void GLCanvas3D::LayersEditing::show_tooltip_information(const GLCanvas3D& canva if (ImGui::IsItemHovered()) { ImGui::BeginTooltip2(ImVec2(x, y)); - auto draw_text_with_caption = [this, &caption_max, &imgui](const wxString& caption, const wxString& text) { + auto draw_text_with_caption = [&caption_max, &imgui](const wxString& caption, const wxString& text) { imgui.text_colored(ImGuiWrapper::COL_ACTIVE, caption); ImGui::SameLine(caption_max); imgui.text_colored(ImGuiWrapper::COL_WINDOW_BG, text); @@ -4257,7 +4263,7 @@ void GLCanvas3D::on_key(wxKeyEvent& evt) m_dirty = true; #endif } else if ((evt.ShiftDown() && evt.ControlDown() && keyCode == WXK_RETURN) || - evt.ShiftDown() && evt.AltDown() && keyCode == WXK_RETURN) { + (evt.ShiftDown() && evt.AltDown() && keyCode == WXK_RETURN)) { wxGetApp().plater()->toggle_show_wireframe(); m_dirty = true; } else if ((evt.ShiftDown() && evt.ControlDown() && keyCode == 'T')) { @@ -6088,11 +6094,11 @@ bool GLCanvas3D::can_sequential_clearance_show_in_gizmo() { switch (m_gizmos.get_current_type()) { case GLGizmosManager::EType::Move: case GLGizmosManager::EType::Scale: - case GLGizmosManager::EType::Rotate: { + case GLGizmosManager::EType::Rotate: return true; + default: + return false; } - } - return false; } void GLCanvas3D::update_sequential_clearance() @@ -6989,7 +6995,7 @@ bool GLCanvas3D::_init_main_toolbar() return "seperator.svg"; }; sperate_item.sprite_id = sprite_id++; - sperate_item.left.action_callback = [this]() {}; + sperate_item.left.action_callback = []() {}; sperate_item.visibility_callback = []()->bool { return true; }; sperate_item.enabling_callback = []()->bool { return true; }; if (!p_main_toolbar->add_item(sperate_item, GLToolbarItem::EType::SeparatorLine)) @@ -7074,7 +7080,7 @@ bool GLCanvas3D::_init_main_toolbar() }; more_item.sprite_id = sprite_id++; more_item.visible = false; - more_item.left.action_callback = [this]()->void{}; + more_item.left.action_callback = []()->void{}; more_item.visibility_callback = [this]()->bool { if (m_main_toolbar) { return m_main_toolbar->needs_collapsed(); @@ -7095,7 +7101,7 @@ bool GLCanvas3D::_init_main_toolbar() return "seperator.svg"; }; sperate_item.sprite_id = sprite_id++; - sperate_item.left.action_callback = [this]() {}; + sperate_item.left.action_callback = []() {}; sperate_item.visibility_callback = []()->bool { return true; }; sperate_item.enabling_callback = []()->bool { return true; }; sperate_item.b_collapsible = false; @@ -7121,8 +7127,8 @@ bool GLCanvas3D::_init_main_toolbar() }; item.left.render_callback = GLToolbarItem::Default_Render_Callback; item.visible = true; - item.visibility_callback = [this]()->bool { return true; }; - item.enabling_callback = [this]()->bool { + item.visibility_callback = []()->bool { return true; }; + item.enabling_callback = []()->bool { return wxGetApp().plater()->has_assmeble_view(); }; item.b_collapsible = false; @@ -7480,10 +7486,8 @@ void GLCanvas3D::_rectangular_selection_picking_pass() const int viewport_y = static_cast(get_canvas_size().get_height() - m_rectangle_selection.get_top()); viewport_width = static_cast(m_rectangle_selection.get_width()); viewport_width = viewport_width > 1 ? viewport_width : 1; - viewport_width = viewport_width; viewport_height = static_cast(m_rectangle_selection.get_height()); viewport_height = viewport_height > 1 ? viewport_height : 1; - viewport_height = viewport_height; const auto& p_ogl_manager = wxGetApp().get_opengl_manager(); { @@ -7716,8 +7720,8 @@ void GLCanvas3D::_render_objects(GLVolumeCollection &cur_volumes, GLVolumeCollec case BuildVolume::Type::Convex: case BuildVolume::Type::Custom: { cur_volumes.set_print_volume({static_cast(type), - { -FLT_MAX, -FLT_MAX, FLT_MAX, FLT_MAX }, - { -FLT_MAX, FLT_MAX } } + { FLOAT_LOWEST, FLOAT_LOWEST, FLOAT_MAX, FLOAT_MAX }, + { FLOAT_LOWEST, FLOAT_MAX } } ); } } @@ -7730,7 +7734,7 @@ void GLCanvas3D::_render_objects(GLVolumeCollection &cur_volumes, GLVolumeCollec if (m_use_clipping_planes) cur_volumes.set_z_range(-m_clipping_planes[0].get_data()[3], m_clipping_planes[1].get_data()[3]); else - cur_volumes.set_z_range(-FLT_MAX, FLT_MAX); + cur_volumes.set_z_range(FLOAT_LOWEST, FLOAT_MAX); GLGizmosManager& gm = get_gizmos_manager(); GLGizmoBase* current_gizmo = gm.get_current(); @@ -7772,7 +7776,7 @@ void GLCanvas3D::_render_objects(GLVolumeCollection &cur_volumes, GLVolumeCollec if (in_paint_gizmo) { cur_volumes.render( render_pipeline_stage, type, m_picking_enabled, camera, colors, *m_model, - [this](const GLVolume &volume) { + [](const GLVolume &volume) { return true; }, with_outline, body_color, partly_inside_enable, nullptr); @@ -7836,14 +7840,14 @@ void GLCanvas3D::_render_objects(GLVolumeCollection &cur_volumes, GLVolumeCollec if (in_paint_gizmo) { cur_volumes.render( render_pipeline_stage, type, false, camera, colors, *m_model, - [this, canvas_type](const GLVolume &volume) { + [](const GLVolume &volume) { return true; }, with_outline, body_color, partly_inside_enable, nullptr); } else { cur_volumes.render( render_pipeline_stage, type, false, camera, colors, *m_model, - [this, canvas_type](const GLVolume &volume) { + [canvas_type](const GLVolume &volume) { if (canvas_type == ECanvasType::CanvasAssembleView) { return !volume.is_modifier; } else { @@ -7861,7 +7865,7 @@ void GLCanvas3D::_render_objects(GLVolumeCollection &cur_volumes, GLVolumeCollec if (m_canvas_type == CanvasView3D && m_gizmos.is_paint_gizmo()) { cur_volumes.only_render_sinking( render_pipeline_stage, type, false, camera, colors, *m_model, - [this, canvas_type](const GLVolume &volume) { + [canvas_type](const GLVolume &volume) { if (canvas_type == ECanvasType::CanvasAssembleView) { return !volume.is_modifier; } else { @@ -8907,18 +8911,18 @@ void GLCanvas3D::_render_paint_toolbar() const ImVec2 number_label_size = ImGui::CalcTextSize(std::to_string(i + 1).c_str()); ImGui::SetCursorPosY(cursor_y + text_offset_y); ImGui::SetCursorPosX(spacing + i * (spacing + button_size.x) + (button_size.x - number_label_size.x) / 2); - ImGui::TextColored(text_color, std::to_string(i + 1).c_str()); + ImGui::TextColored(text_color, "%s", std::to_string(i + 1).c_str()); imgui.pop_bold_font(); ImVec2 filament_first_line_label_size = ImGui::CalcTextSize(filament_text_first_line[i].c_str()); ImGui::SetCursorPosY(cursor_y + text_offset_y + number_label_size.y); ImGui::SetCursorPosX(spacing + i * (spacing + button_size.x) + (button_size.x - filament_first_line_label_size.x) / 2); - ImGui::TextColored(text_color, filament_text_first_line[i].c_str()); + ImGui::TextColored(text_color, "%s", filament_text_first_line[i].c_str()); ImVec2 filament_second_line_label_size = ImGui::CalcTextSize(filament_text_second_line[i].c_str()); ImGui::SetCursorPosY(cursor_y + text_offset_y + number_label_size.y + filament_first_line_label_size.y); ImGui::SetCursorPosX(spacing + i * (spacing + button_size.x) + (button_size.x - filament_second_line_label_size.x) / 2); - ImGui::TextColored(text_color, filament_text_second_line[i].c_str()); + ImGui::TextColored(text_color, "%s", filament_text_second_line[i].c_str()); } if (ImGui::GetWindowWidth() == constraint_window_width) { @@ -8966,7 +8970,7 @@ float GLCanvas3D::_show_assembly_tooltip_information(float caption_max, float x, if (ImGui::IsItemHovered()) { ImGui::BeginTooltip2(ImVec2(x, y)); - auto draw_text_with_caption = [this, &imgui, & caption_max](const wxString &caption, const wxString &text) { + auto draw_text_with_caption = [&imgui, & caption_max](const wxString &caption, const wxString &text) { imgui->text_colored(ImGuiWrapper::COL_ACTIVE, caption); ImGui::SameLine(caption_max); imgui->text_colored(ImGuiWrapper::COL_WINDOW_BG, text); @@ -9160,9 +9164,9 @@ void GLCanvas3D::_render_assemble_info() const double size1 = m_selection.get_bounding_box().size()(1); double size2 = m_selection.get_bounding_box().size()(2); if (!m_selection.is_empty()) { - ImGui::Text(_L("Volume:").ToUTF8()); ImGui::SameLine(caption_max); + ImGui::Text("%s", _L("Volume:").ToUTF8().data()); ImGui::SameLine(caption_max); ImGui::Text("%.2f", size0 * size1 * size2); - ImGui::Text(_L("Size:").ToUTF8()); ImGui::SameLine(caption_max); + ImGui::Text("%s", _L("Size:").ToUTF8().data()); ImGui::SameLine(caption_max); ImGui::Text("%.2f x %.2f x %.2f", size0, size1, size2); } imgui->end(); diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 59e7104ec0..6b8db8c9a7 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -520,7 +520,6 @@ class GLCanvas3D RenderPipelineStageModifier& operator=(RenderPipelineStageModifier&&) = delete; private: GLCanvas3D& m_canvas; - ERenderPipelineStage m_stage; }; public: diff --git a/src/slic3r/GUI/GLTexture.cpp b/src/slic3r/GUI/GLTexture.cpp index d482c95868..46234df2a7 100644 --- a/src/slic3r/GUI/GLTexture.cpp +++ b/src/slic3r/GUI/GLTexture.cpp @@ -487,9 +487,9 @@ void GLTexture::reset() m_original_width = m_original_height = 0; // for buffer texture - if (m_buffer_id != -1u) { + if (m_buffer_id != UINT32_MAX) { glsafe(::glDeleteBuffers(1, &m_buffer_id)); - m_buffer_id = -1u; + m_buffer_id = UINT32_MAX; } // end for buffer texture } @@ -851,7 +851,7 @@ bool GLTexture::set_buffer(const std::vector& t_buffer) glsafe(::glBindBuffer(target, 0)); } - return m_buffer_id != -1u; + return m_buffer_id != UINT32_MAX; } void GLTexture::render_texture(unsigned int tex_id, float left, float right, float bottom, float top) diff --git a/src/slic3r/GUI/GLToolbar.hpp b/src/slic3r/GUI/GLToolbar.hpp index 220d212e52..6574428158 100644 --- a/src/slic3r/GUI/GLToolbar.hpp +++ b/src/slic3r/GUI/GLToolbar.hpp @@ -501,7 +501,6 @@ class GLToolbar EToolbarRenderingMode m_rendering_mode{ EToolbarRenderingMode::Auto }; mutable GLTexture m_images_texture; - mutable bool m_images_texture_dirty; struct MouseCapture { bool left; @@ -537,7 +536,7 @@ class ToolbarAutoSizeRenderer : public ToolbarRenderer { public: explicit ToolbarAutoSizeRenderer(); - ~ToolbarAutoSizeRenderer(); + virtual ~ToolbarAutoSizeRenderer(); void render(const GLToolbar& t_toolbar, const Camera& t_camera) override; @@ -556,7 +555,7 @@ class ToolbarKeepSizeRenderer : public ToolbarRenderer { public: explicit ToolbarKeepSizeRenderer(); - ~ToolbarKeepSizeRenderer(); + virtual ~ToolbarKeepSizeRenderer(); void render(const GLToolbar& t_toolbar, const Camera& t_camera) override; diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index f7dbf2e662..bd41ffef06 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -440,11 +440,6 @@ class BBLSplashScreen : public wxSplashScreen private: - wxStaticText* m_staticText_slicer_name; - wxStaticText* m_staticText_slicer_version; - wxStaticBitmap* m_bitmap; - wxStaticText* m_staticText_loading; - wxBitmap m_main_bitmap; wxFont m_action_font; int m_action_line_y_position; @@ -2059,7 +2054,7 @@ void GUI_App::init_networking_callbacks() return; } if (return_code < 0) { //#define MQTTASYNC_SUCCESS 0 - GUI::wxGetApp().CallAfter([this] { + GUI::wxGetApp().CallAfter([] { BOOST_LOG_TRIVIAL(trace) << "static: server connection failed"; MessageDialog msg_dlg(nullptr, _L("Failed to connect to the cloud device server. Please check your network and firewall."), "", wxAPPLY | wxOK); if (msg_dlg.ShowModal() == wxOK) { return; } @@ -2555,7 +2550,7 @@ void GUI_App::update_http_extra_header() 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; @@ -3068,7 +3063,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(); @@ -4096,7 +4091,7 @@ void GUI_App::request_helio_pat(std::function func) void GUI_App::request_helio_supported_data() { - std:;string helio_api_url = Slic3r::HelioQuery::get_helio_api_url(); + std::string helio_api_url = Slic3r::HelioQuery::get_helio_api_url(); std::string helio_api_key = Slic3r::HelioQuery::get_helio_pat(); if (HelioQuery::global_supported_printers.size() <= 0 || HelioQuery::global_supported_materials.size() <= 0) { @@ -4444,12 +4439,12 @@ std::string GUI_App::handle_web_request(std::string cmd) }); } else if (command_str.compare("homepage_logout") == 0) { - CallAfter([this] { + CallAfter([] { wxGetApp().request_user_logout(); }); } else if (command_str.compare("homepage_modeldepot") == 0) { - CallAfter([this] { + CallAfter([] { wxGetApp().open_mall_page_dialog(); }); } @@ -4526,7 +4521,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) { @@ -5508,12 +5503,12 @@ void GUI_App::report_consent(std::string expand) .header("Content-Type", "application/json") .set_post_body(post_body_str) .on_complete( - [this](std::string body, unsigned status) { + [](std::string body, unsigned status) { //todo } ) .on_error( - [this](std::string body, std::string error, unsigned status) { + [](std::string body, std::string error, unsigned status) { } ) .perform(); @@ -6785,7 +6780,7 @@ bool GUI_App::check_and_keep_current_preset_changes(const wxString& caption, con UnsavedChangesDialog dlg(caption, header, "", action_buttons); - 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 @@ -6797,7 +6792,7 @@ bool GUI_App::check_and_keep_current_preset_changes(const wxString& caption, con load_current_presets(false); }; - auto handle_discard_option = [ this, reset_modifications](){ + auto handle_discard_option = [reset_modifications](){ reset_modifications(); }; @@ -6819,7 +6814,7 @@ bool GUI_App::check_and_keep_current_preset_changes(const wxString& caption, con reset_modifications(); }; - auto handle_transfer_option = [this, &dlg, is_called_from_configwizard, postponed_apply_of_keeped_changes, reset_modifications]() { + auto handle_transfer_option = [this, &dlg, is_called_from_configwizard, postponed_apply_of_keeped_changes]() { const auto& preset_names_and_types = dlg.get_names_and_types(); // execute this part of code only if not all modifications are keeping to the new project // OR this function is called when ConfigWizard is closed and "Keep modifications" is selected @@ -7570,7 +7565,9 @@ const std::shared_ptr& GUI_App::get_shader(const std::string &s return p_ogl_manager->get_shader(shader_name); } - return nullptr; + // return nullptr; // OLD: returned reference to temporary - crash! + static std::shared_ptr s_empty{nullptr}; // Static lives forever + return s_empty; } const std::shared_ptr GUI_App::get_current_shader() const diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index bf5e6f8be3..19f1f6793a 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -588,7 +588,7 @@ class GUI_App : public wxApp // Calls wxLaunchDefaultBrowser if user confirms in dialog. bool open_browser_with_warning_dialog(const wxString& url, int flags = 0); #ifdef __APPLE__ - void OSXStoreOpenFiles(const wxArrayString &files); + void OSXStoreOpenFiles(const wxArrayString &files) override; // wxWidgets override to get an event on open files. void MacOpenFiles(const wxArrayString &fileNames) override; void MacOpenURL(const wxString& url) override; 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 cea9ff5748..46a03023a8 100644 --- a/src/slic3r/GUI/GUI_Factories.cpp +++ b/src/slic3r/GUI/GUI_Factories.cpp @@ -1185,7 +1185,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) @@ -1555,7 +1555,7 @@ void MenuFactory::create_plate_menu() } if (result >= 0) { plater()->get_current_canvas3D()->post_event(SimpleEvent(EVT_GLCANVAS_MOVE_PLATE)); } }, - "", nullptr, [this]() { return plater()->get_partplate_list().get_plate_count() >= 2; }, m_parent); + "", nullptr, []() { return plater()->get_partplate_list().get_plate_count() >= 2; }, m_parent); // add shapes menu->AppendSeparator(); @@ -1861,7 +1861,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, []() { @@ -1879,7 +1879,7 @@ void MenuFactory::append_menu_item_simplify(wxMenu* menu) void MenuFactory::append_menu_item_center(wxMenu* menu) { append_menu_item(menu, wxID_ANY, _L("Center") , "", - [this](wxCommandEvent&) { + [](wxCommandEvent&) { auto canvas3d = plater()->get_view3D_canvas3D(); canvas3d->get_gizmos_manager().check_object_located_outside_plate(true); plater()->center_selection(); @@ -1909,7 +1909,7 @@ void MenuFactory::append_menu_item_align_distribute(wxMenu *menu) return; append_menu_item( align_distribute_menu, wxID_ANY, _L("Distribute left-right") + " (X)", "", - [this](wxCommandEvent &) { + [](wxCommandEvent &) { auto canvas3d = plater()->get_view3D_canvas3D(); canvas3d->get_gizmos_manager().check_object_located_outside_plate(true); plater()->distribute_selection_x(); @@ -1928,7 +1928,7 @@ void MenuFactory::append_menu_item_align_distribute(wxMenu *menu) append_menu_item( align_distribute_menu, wxID_ANY, _L("Distribute front-back") + " (Y)", "", - [this](wxCommandEvent &) { + [](wxCommandEvent &) { auto canvas3d = plater()->get_view3D_canvas3D(); canvas3d->get_gizmos_manager().check_object_located_outside_plate(true); plater()->distribute_selection_y(); @@ -1945,7 +1945,7 @@ void MenuFactory::append_menu_item_align_distribute(wxMenu *menu) append_menu_item( align_distribute_menu, wxID_ANY, _L("Distribute top-bottom") + " (Z)", "", - [this](wxCommandEvent &) { + [](wxCommandEvent &) { auto canvas3d = plater()->get_view3D_canvas3D(); canvas3d->get_gizmos_manager().check_object_located_outside_plate(true); plater()->distribute_selection_z(); @@ -1966,7 +1966,7 @@ void MenuFactory::append_menu_item_align_distribute(wxMenu *menu) append_menu_item( align_distribute_menu, wxID_ANY, _L("Align left") + " (-X)", "", - [this](wxCommandEvent &) { + [](wxCommandEvent &) { auto canvas3d = plater()->get_view3D_canvas3D(); canvas3d->get_gizmos_manager().check_object_located_outside_plate(true); plater()->align_selection_x_min(); @@ -1985,7 +1985,7 @@ void MenuFactory::append_menu_item_align_distribute(wxMenu *menu) append_menu_item( align_distribute_menu, wxID_ANY, _L("Align left-right center") + " (X)", "", - [this](wxCommandEvent &) { + [](wxCommandEvent &) { auto canvas3d = plater()->get_view3D_canvas3D(); canvas3d->get_gizmos_manager().check_object_located_outside_plate(true); plater()->align_selection_x_center(); @@ -2004,7 +2004,7 @@ void MenuFactory::append_menu_item_align_distribute(wxMenu *menu) append_menu_item( align_distribute_menu, wxID_ANY, _L("Align right") + " (+X)", "", - [this](wxCommandEvent &) { + [](wxCommandEvent &) { auto canvas3d = plater()->get_view3D_canvas3D(); canvas3d->get_gizmos_manager().check_object_located_outside_plate(true); plater()->align_selection_x_max(); @@ -2025,7 +2025,7 @@ void MenuFactory::append_menu_item_align_distribute(wxMenu *menu) append_menu_item( align_distribute_menu, wxID_ANY, _L("Align front") + " (-Y)", "", - [this](wxCommandEvent &) { + [](wxCommandEvent &) { auto canvas3d = plater()->get_view3D_canvas3D(); canvas3d->get_gizmos_manager().check_object_located_outside_plate(true); plater()->align_selection_y_min(); @@ -2043,7 +2043,7 @@ void MenuFactory::append_menu_item_align_distribute(wxMenu *menu) append_menu_item( align_distribute_menu, wxID_ANY, _L("Align front-back center") + " (Y)", "", - [this](wxCommandEvent &) { + [](wxCommandEvent &) { auto canvas3d = plater()->get_view3D_canvas3D(); canvas3d->get_gizmos_manager().check_object_located_outside_plate(true); plater()->align_selection_y_center(); @@ -2061,7 +2061,7 @@ void MenuFactory::append_menu_item_align_distribute(wxMenu *menu) append_menu_item( align_distribute_menu, wxID_ANY, _L("Align back") + " (+Y)", "", - [this](wxCommandEvent &) { + [](wxCommandEvent &) { auto canvas3d = plater()->get_view3D_canvas3D(); canvas3d->get_gizmos_manager().check_object_located_outside_plate(true); plater()->align_selection_y_max(); @@ -2082,7 +2082,7 @@ void MenuFactory::append_menu_item_align_distribute(wxMenu *menu) append_menu_item( align_distribute_menu, wxID_ANY, _L("Align bottom") + " (-Z)", "", - [this](wxCommandEvent &) { + [](wxCommandEvent &) { auto canvas3d = plater()->get_view3D_canvas3D(); canvas3d->get_gizmos_manager().check_object_located_outside_plate(true); plater()->align_selection_z_min(); @@ -2101,7 +2101,7 @@ void MenuFactory::append_menu_item_align_distribute(wxMenu *menu) append_menu_item( align_distribute_menu, wxID_ANY, _L("Align top-bottom center") + " (Z)", "", - [this](wxCommandEvent &) { + [](wxCommandEvent &) { auto canvas3d = plater()->get_view3D_canvas3D(); canvas3d->get_gizmos_manager().check_object_located_outside_plate(true); plater()->align_selection_z_center(); @@ -2120,7 +2120,7 @@ void MenuFactory::append_menu_item_align_distribute(wxMenu *menu) append_menu_item( align_distribute_menu, wxID_ANY, _L("Align top") + " (+Z)", "", - [this](wxCommandEvent &) { + [](wxCommandEvent &) { auto canvas3d = plater()->get_view3D_canvas3D(); canvas3d->get_gizmos_manager().check_object_located_outside_plate(true); plater()->align_selection_z_max(); @@ -2167,7 +2167,7 @@ void MenuFactory::append_menu_item_sub_merge(wxMenu *menu) { append_menu_item( menu, wxID_ANY, _L("Sub merge"), "", - [this](wxCommandEvent &) { + [](wxCommandEvent &) { obj_list()->add_new_model_object_from_old_object(); }, "", nullptr, @@ -2347,7 +2347,7 @@ void MenuFactory::append_menu_item_set_printable(wxMenu* menu) } wxString menu_text = _L("Printable"); - wxMenuItem* menu_item_set_printable = append_menu_check_item(menu, wxID_ANY, menu_text, "", [this, all_printable](wxCommandEvent&) { + wxMenuItem* menu_item_set_printable = append_menu_check_item(menu, wxID_ANY, menu_text, "", [all_printable](wxCommandEvent&) { Selection& selection = plater()->canvas3D()->get_selection(); selection.set_printable(!all_printable); }, menu); @@ -2406,7 +2406,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 4e62e34e42..e83247968f 100644 --- a/src/slic3r/GUI/GUI_ObjectLayers.cpp +++ b/src/slic3r/GUI/GUI_ObjectLayers.cpp @@ -42,7 +42,7 @@ void ObjectLayers::select_editor(LayerRangeEditor* editor, const bool is_last_ed * And as a result we couldn't edit this control. * */ #ifdef __WXOSX__ - wxTheApp->CallAfter([editor]() { + wxTheApp->CallAfter([]() { #endif //editor->SetFocus(); //editor->SelectAll(); @@ -219,7 +219,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]() { // Delete all controls from options group m_grid_sizer->Clear(true); diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 290b70f3ef..2aa7f774b4 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -3355,7 +3355,7 @@ void ObjectList::boolean() Plater::TakeSnapshot snapshot(wxGetApp().plater(), "boolean"); ModelObject* object = (*m_objects)[obj_idxs.front()]; - TriangleMesh mesh = Plater::combine_mesh_fff(*object, -1, [this](const std::string &msg) { return wxGetApp().notification_manager()->push_plater_warning_notification(msg); }); + TriangleMesh mesh = Plater::combine_mesh_fff(*object, -1, [](const std::string &msg) { return wxGetApp().notification_manager()->push_plater_warning_notification(msg); }); // add mesh to model as a new object, keep the original object's name and config Model* model = object->get_model(); diff --git a/src/slic3r/GUI/GUI_ObjectTable.cpp b/src/slic3r/GUI/GUI_ObjectTable.cpp index 93490d124e..72500e9193 100644 --- a/src/slic3r/GUI/GUI_ObjectTable.cpp +++ b/src/slic3r/GUI/GUI_ObjectTable.cpp @@ -3508,13 +3508,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_ObjectTable.hpp b/src/slic3r/GUI/GUI_ObjectTable.hpp index ed1d64f087..8ffde3e8ee 100644 --- a/src/slic3r/GUI/GUI_ObjectTable.hpp +++ b/src/slic3r/GUI/GUI_ObjectTable.hpp @@ -591,16 +591,11 @@ class ObjectTablePanel : public wxPanel wxColour m_hover_colour; wxBoxSizer* m_top_sizer{nullptr}; wxBoxSizer* m_page_sizer{nullptr}; - wxBoxSizer* m_page_top_sizer{nullptr}; - wxTextCtrl* m_search_line{ nullptr }; ObjectGrid* m_object_grid{nullptr}; ObjectGridTable* m_object_grid_table{nullptr}; - wxStaticText* m_page_text{nullptr}; - ScalableButton* m_global_reset{nullptr}; wxScrolledWindow* m_side_window{nullptr}; ObjectTableSettings* m_object_settings{ nullptr }; Model* m_model{nullptr}; - ModelConfig* m_config {nullptr}; Plater* m_plater{nullptr}; int m_cur_row { -1 }; @@ -625,8 +620,6 @@ class ObjectTableDialog : public GUI::DPIDialog const int POPUP_HEIGHT = FromDIP(1024); //wxPanel* m_panel{ nullptr }; - wxBoxSizer* m_top_sizer{ nullptr }; - wxStaticText* m_static_title{ nullptr }; //wxTimer* m_refresh_timer; ObjectTablePanel* m_obj_panel{ nullptr }; Model* m_model{ nullptr }; diff --git a/src/slic3r/GUI/GUI_ObjectTableSettings.cpp b/src/slic3r/GUI/GUI_ObjectTableSettings.cpp index f94aaa1506..0dbe2f344e 100644 --- a/src/slic3r/GUI/GUI_ObjectTableSettings.cpp +++ b/src/slic3r/GUI/GUI_ObjectTableSettings.cpp @@ -284,13 +284,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/GUI_ObjectTableSettings.hpp b/src/slic3r/GUI/GUI_ObjectTableSettings.hpp index 534426f554..0f2cf3bc26 100644 --- a/src/slic3r/GUI/GUI_ObjectTableSettings.hpp +++ b/src/slic3r/GUI/GUI_ObjectTableSettings.hpp @@ -56,6 +56,8 @@ class ObjectTableSettings : public OTG_Settings std::map m_different_map; public: + using OTG_Settings::UpdateAndShow; + ObjectTableSettings(wxWindow* parent, ObjectGridTable* table); ~ObjectTableSettings() { diff --git a/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.cpp b/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.cpp index ce5981a252..6d37180757 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.cpp @@ -107,9 +107,6 @@ GLGizmoAdvancedCut::GLGizmoAdvancedCut(GLCanvas3D& parent, unsigned int sprite_i , m_keep_upper(true) , m_keep_lower(true) , m_cut_to_parts(false) - , m_do_segment(false) - , m_segment_smoothing_alpha(0.5) - , m_segment_number(5) , m_connector_type(CutConnectorType::Plug) , m_connector_style(size_t(CutConnectorStyle::Prizm)) , m_connector_shape_id(size_t(CutConnectorShape::Circle)) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.hpp b/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.hpp index d70ece01dd..9983cf1d56 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.hpp @@ -72,7 +72,6 @@ class GLGizmoAdvancedCut : public GLGizmoRotate3D { private: unsigned int m_last_active_item_imgui{0}; - double m_snap_step{1.0}; // archived values Vec3d m_ar_plane_center{Vec3d::Zero()}; @@ -115,17 +114,12 @@ class GLGizmoAdvancedCut : public GLGizmoRotate3D bool m_rotate_upper{false}; bool m_rotate_lower{false}; - bool m_do_segment; - double m_segment_smoothing_alpha; - int m_segment_number; - mutable Grabber m_move_z_grabber; mutable Grabber m_move_x_grabber; bool m_connectors_editing{false}; bool m_add_connector_ok{false}; std::vector m_invalid_connectors_idxs; - bool m_show_shortcuts{false}; std::vector> m_connector_shortcuts; std::vector> m_cut_plane_shortcuts; @@ -144,7 +138,6 @@ class GLGizmoAdvancedCut : public GLGizmoRotate3D bool m_groove_editing{false}; float m_contour_width{0.4f}; float m_cut_plane_radius_koef{1.5f}; - float m_shortcut_label_width{-1.f}; bool m_is_slider_editing_done{false}; bool m_hide_cut_plane{false}; double m_radius{0.0}; @@ -153,8 +146,6 @@ class GLGizmoAdvancedCut : public GLGizmoRotate3D Vec3d m_cut_plane_start_move_pos{Vec3d::Zero()}; bool m_cut_plane_as_circle{false}; std::vector m_groove_vertices; - bool m_was_cut_plane_dragged{false}; - bool m_was_contour_selected{false}; bool m_is_dragging{false}; std::shared_ptr m_part_selection{nullptr}; // dragging angel in hovered axes @@ -224,7 +215,7 @@ class GLGizmoAdvancedCut : public GLGizmoRotate3D bool unproject_on_cut_plane(const Vec2d &mouse_pos, Vec3d &pos, Vec3d &pos_world, bool respect_contours = true); - virtual bool apply_clipping_plane() { return m_connectors_editing; } + virtual bool apply_clipping_plane() override { return m_connectors_editing; } BoundingBoxf3 get_bounding_box() const override; @@ -232,29 +223,29 @@ class GLGizmoAdvancedCut : public GLGizmoRotate3D bool wants_enter_leave_snapshots() const override { return true; } protected: - virtual bool on_init(); + virtual bool on_init() override; virtual void on_load(cereal::BinaryInputArchive &ar) override; virtual void on_save(cereal::BinaryOutputArchive &ar) const override; virtual void data_changed(bool is_serializing) override; - virtual std::string on_get_name() const; + virtual std::string on_get_name() const override; virtual std::string on_get_name_str() override { return "Cut"; } void apply_color_clip_plane_colors(); - virtual void on_set_state(); + virtual void on_set_state() override; void close(); - virtual bool on_is_activable() const; + virtual bool on_is_activable() const override; virtual CommonGizmosDataID on_get_requirements() const override; virtual void on_start_dragging() override; virtual void on_stop_dragging() override; virtual void update_plate_center(Axis axis_type, double projection, bool is_abs_move); // old name:dragging_grabber_move virtual void update_plate_normal_boundingbox_clipper(const Transform3d &rotation_tmp); // old name:dragging_grabber_rotation - virtual void on_update(const UpdateData& data); - virtual void on_render(); - virtual void on_render_for_picking(); - virtual void on_render_input_window(float x, float y, float bottom_limit); + virtual void on_update(const UpdateData& data) override; + virtual void on_render() override; + virtual void on_render_for_picking() override; + virtual void on_render_input_window(float x, float y, float bottom_limit) override; void show_tooltip_information(float x, float y); - virtual void on_enable_grabber(unsigned int id) + virtual void on_enable_grabber(unsigned int id) override { if (id < 3) m_gizmos[id].enable_grabber(0); @@ -262,7 +253,7 @@ class GLGizmoAdvancedCut : public GLGizmoRotate3D this->enable_grabber(0); } - virtual void on_disable_grabber(unsigned int id) + virtual void on_disable_grabber(unsigned int id) override { if (id < 3) m_gizmos[id].disable_grabber(0); @@ -270,7 +261,7 @@ class GLGizmoAdvancedCut : public GLGizmoRotate3D this->disable_grabber(0); } - virtual void on_set_hover_id() + virtual void on_set_hover_id() override { for (int i = 0; i < 3; ++i) m_gizmos[i].set_hover_id((m_hover_id == i) ? 0 : -1); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoFaceDetector.hpp b/src/slic3r/GUI/Gizmos/GLGizmoFaceDetector.hpp index b43b92c095..55ae055fcd 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoFaceDetector.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoFaceDetector.hpp @@ -31,7 +31,6 @@ class GLGizmoFaceDetector : public GLGizmoBase void display_exterior_face(); GUI::GLModel m_model; - double m_sample_interval = {0.5}; }; } // namespace GUI diff --git a/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.hpp b/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.hpp index 9f966c0014..689e22c463 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.hpp @@ -89,7 +89,6 @@ class GLGizmoFdmSupports : public GLGizmoPainterBase boost::thread m_thread; // Mutex and condition variable to synchronize m_thread with the UI thread. std::mutex m_mutex; - int m_generate_count; // This map holds all translated description texts, so they can be easily referenced during layout calculations // etc. When language changes, GUI is recreated and this class constructed again, so the change takes effect. diff --git a/src/slic3r/GUI/Gizmos/GLGizmoFuzzySkin.hpp b/src/slic3r/GUI/Gizmos/GLGizmoFuzzySkin.hpp index 0ac79280da..a2ba5b6ca7 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoFuzzySkin.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoFuzzySkin.hpp @@ -60,19 +60,12 @@ class GLGizmoFuzzySkin : public GLGizmoPainterBase void on_shutdown() override; PainterGizmoType get_painter_type() const override; - bool m_volume_valid = false; - - bool m_is_tree_support = false; - bool m_cancel = false; - size_t m_object_id; std::vector m_volume_timestamps; PrintInstance m_print_instance; - mutable EditState m_edit_state; //thread boost::thread m_thread; // Mutex and condition variable to synchronize m_thread with the UI thread. std::mutex m_mutex; - int m_generate_count; // This map holds all translated description texts, so they can be easily referenced during layout calculations // etc. When language changes, GUI is recreated and this class constructed again, so the change takes effect. diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMeasure.cpp b/src/slic3r/GUI/Gizmos/GLGizmoMeasure.cpp index bdf299f6c1..a055907fe6 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMeasure.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMeasure.cpp @@ -1801,7 +1801,7 @@ void GLGizmoMeasure::show_selection_ui() return text; }; - float selection_cap_length; + float selection_cap_length = 0.0f; if (m_measure_mode == EMeasureMode::ONLY_ASSEMBLY) { if (m_assembly_mode == AssemblyMode::FACE_FACE) { selection_cap_length = ImGui::CalcTextSize((_u8L("Selection") + " 1" + _u8L(" (Moving)")).c_str()).x * 1.2; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.cpp b/src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.cpp index 2171aeb708..8e4fefd937 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.cpp @@ -862,6 +862,7 @@ BooleanOperationResult BooleanOperationEngine::perform_difference(const VolumeLi b_union = execute_boolean_operation(b_union, bm, MeshBooleanConfig::OP_UNION); if (b_union.empty()) { result.error_message = MeshBooleanWarnings::MIN_VOLUMES_DIFFERENCE; return result; } } catch (const std::exception &e) { + BOOST_LOG_TRIVIAL(error) << "Boolean union operation failed: " << e.what(); result.error_message = MeshBooleanWarnings::GROUPING; return result; } @@ -885,6 +886,7 @@ BooleanOperationResult BooleanOperationEngine::perform_difference(const VolumeLi try { accumulated_result = execute_boolean_operation(accumulated_result, b_union, MeshBooleanConfig::OP_DIFFERENCE); } catch (const std::exception& e) { + BOOST_LOG_TRIVIAL(error) << "Boolean difference operation failed: " << e.what(); result.error_message = MeshBooleanWarnings::JOB_FAILED; return result; } @@ -1575,6 +1577,7 @@ BooleanOperationResult BooleanOperationEngine::part_level_sub( return result; } } catch (const std::exception& e) { + BOOST_LOG_TRIVIAL(error) << "Boolean operation failed: " << e.what(); result.error_message = MeshBooleanWarnings::JOB_FAILED; return result; } @@ -1661,7 +1664,7 @@ GLGizmoMeshBoolean::GLGizmoMeshBoolean(GLCanvas3D& parent, unsigned int sprite_i }; // Setup async callbacks - m_ui->is_async_enabled = [this]() -> bool { + m_ui->is_async_enabled = []() -> bool { return true; // Async is always enabled }; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.hpp b/src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.hpp index 8a5eec4e16..9769616dae 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.hpp @@ -393,7 +393,7 @@ class GLGizmoMeshBoolean : public GLGizmoBase virtual void on_render_for_picking() override {} virtual void on_set_state() override; virtual CommonGizmosDataID on_get_requirements() const override; - virtual void on_render_input_window(float x, float y, float bottom_limit); + virtual void on_render_input_window(float x, float y, float bottom_limit) override; virtual void on_change_color_mode(bool is_dark) override; void on_load(cereal::BinaryInputArchive &ar) override; void on_save(cereal::BinaryOutputArchive &ar) const override; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp index 02f932906a..975b1e8c20 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp @@ -658,12 +658,12 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, {10.0,15.0}); if (abs(color_vec.w - 1) < 0.01) { if (gray * 255.f < 80.f) - ImGui::TextColored(ImVec4(1.0f, 1.0f, 1.0f, 1.0f), item_text.c_str()); + ImGui::TextColored(ImVec4(1.0f, 1.0f, 1.0f, 1.0f), "%s", item_text.c_str()); else - ImGui::TextColored(ImVec4(0.0f, 0.0f, 0.0f, 1.0f), item_text.c_str()); + ImGui::TextColored(ImVec4(0.0f, 0.0f, 0.0f, 1.0f), "%s", item_text.c_str()); } else {//alpha - ImGui::TextColored(ImVec4(0.0f, 0.0f, 0.0f, 1.0f), item_text.c_str()); + ImGui::TextColored(ImVec4(0.0f, 0.0f, 0.0f, 1.0f), "%s", item_text.c_str()); } ImGui::PopStyleVar(); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMove.hpp b/src/slic3r/GUI/Gizmos/GLGizmoMove.hpp index 8395c0262a..92f1ad9335 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMove.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMove.hpp @@ -67,7 +67,7 @@ class GLGizmoMove3D : public GLGizmoBase virtual void on_render() override; virtual void on_render_for_picking() override; //BBS: GUI refactor: add object manipulation - virtual void on_render_input_window(float x, float y, float bottom_limit); + virtual void on_render_input_window(float x, float y, float bottom_limit) override; private: double calc_projection(const UpdateData& data) const; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp index 996134dc3b..6ff539b980 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp @@ -1589,7 +1589,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/GLGizmoPainterBase.hpp b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp index a372272bb1..e6cf0b858e 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp @@ -368,7 +368,6 @@ class GLGizmoPainterBase : public GLGizmoBase GLIndexedVertexArray m_vbo_sphere; - bool m_internal_stack_active = false; bool m_schedule_update = false; Vec2d m_last_mouse_click = Vec2d::Zero(); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoRotate.cpp b/src/slic3r/GUI/Gizmos/GLGizmoRotate.cpp index 060cff88cf..4ddede1549 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoRotate.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoRotate.cpp @@ -769,7 +769,7 @@ GLGizmoRotate3D::RotoptimzeWindow::RotoptimzeWindow(ImGuiWrapper * imgui, wxGetApp().app_config->set("sla_auto_rotate", "method_id", std::to_string(state.method_id)); -#endif SUPPORT_SLA_AUTO_ROTATE +#endif // SUPPORT_SLA_AUTO_ROTATE } if (ImGui::IsItemHovered()) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSVG.hpp b/src/slic3r/GUI/Gizmos/GLGizmoSVG.hpp index 2e07f5f4e3..b0537c9491 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSVG.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSVG.hpp @@ -86,7 +86,7 @@ class GLGizmoSVG : public GLGizmoBase virtual void on_update(const UpdateData& data) override; virtual void on_render() override; virtual void on_render_for_picking() override; - virtual void on_render_input_window(float x, float y, float bottom_limit); + virtual void on_render_input_window(float x, float y, float bottom_limit) override; private: void set_volume_by_selection(); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoScale.hpp b/src/slic3r/GUI/Gizmos/GLGizmoScale.hpp index 97d59a465d..b9985a58c0 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoScale.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoScale.hpp @@ -85,7 +85,7 @@ class GLGizmoScale3D : public GLGizmoBase virtual void on_render() override; virtual void on_render_for_picking() override; //BBS: GUI refactor: add object manipulation - virtual void on_render_input_window(float x, float y, float bottom_limit); + virtual void on_render_input_window(float x, float y, float bottom_limit) override; private: void render_grabbers_connection(unsigned int id_1, unsigned int id_2, const ColorRGBA& color) const; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSimplify.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSimplify.cpp index 2492c15b94..e20a4fb5d7 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSimplify.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSimplify.cpp @@ -362,7 +362,7 @@ void GLGizmoSimplify::on_render_input_window(float x, float y, float bottom_limi ImGui::BBLProgressBar2(progress / 100., progress_size); ImGui::SameLine(); ImGui::AlignTextToFramePadding(); - ImGui::TextColored(ImVec4(0.42f, 0.42f, 0.42f, 1.00f), progress_text.c_str()); + ImGui::TextColored(ImVec4(0.42f, 0.42f, 0.42f, 1.00f), "%s", progress_text.c_str()); ImGui::SameLine(bottom_left_width + slider_width + m_imgui->scaled(1.0f)); } else { ImGui::Dummy(ImVec2(bottom_left_width - space_size, -1)); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoText.cpp b/src/slic3r/GUI/Gizmos/GLGizmoText.cpp index 973a92de66..1e05e6b548 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoText.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoText.cpp @@ -408,7 +408,6 @@ class StyleNameEditDialog : public DPIDialog TextInput *m_name{nullptr}; Label * m_tip{nullptr}; bool m_add_tip{false}; - wxPanel * m_row_panel{nullptr}; Emboss::StyleManager &m_style_manager; wxFlexGridSizer * m_top_sizer{nullptr}; }; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoText.hpp b/src/slic3r/GUI/Gizmos/GLGizmoText.hpp index 155319c1d5..439e6aff8b 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoText.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoText.hpp @@ -41,8 +41,6 @@ class GLGizmoText : public GLGizmoBase std::string m_font_version = CUR_FONT_VERSION; std::string m_style_name; float m_font_size = 10.f; - const float m_font_size_min = 3.f; - const float m_font_size_max = 1000.f; bool m_warning_font = false; bool m_bold = true; float m_custom_boldness = 0.f; @@ -109,8 +107,6 @@ class GLGizmoText : public GLGizmoBase // Keep information about stored styles and loaded actual style to compare with Emboss::StyleManager m_style_manager; std::shared_ptr> m_job_cancel = nullptr; - // When open text loaded from .3mf it could be written with unknown font - bool m_is_unknown_font = false; // Is open tree with advanced options bool m_is_advanced_edit_style = false; // True when m_text contain character unknown by selected font @@ -178,8 +174,8 @@ class GLGizmoText : public GLGizmoBase void close(); std::string get_icon_filename(bool b_dark_mode) const override; - virtual std::string get_gizmo_entering_text() const{return "Enter Text gizmo";} - virtual std::string get_gizmo_leaving_text() const{return "Leave Text gizmo";} + virtual std::string get_gizmo_entering_text() const override {return "Enter Text gizmo";} + virtual std::string get_gizmo_leaving_text() const override {return "Leave Text gizmo";} bool wants_enter_leave_snapshots() const override { return true; } protected: @@ -204,7 +200,7 @@ class GLGizmoText : public GLGizmoBase bool on_mouse(const wxMouseEvent &mouse_event) override; bool on_mouse_for_rotation(const wxMouseEvent &mouse_event); virtual CommonGizmosDataID on_get_requirements() const override; - virtual void on_render_input_window(float x, float y, float bottom_limit); + virtual void on_render_input_window(float x, float y, float bottom_limit) override; void show_tooltip_information(float x, float y); diff --git a/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp b/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp index 30132fc6a6..d2992ad1b9 100644 --- a/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp +++ b/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp @@ -102,7 +102,7 @@ void GizmoObjectManipulation::update_ui_from_settings() } } void delete_negative_sign(Vec3d& value) { - for (size_t i = 0; i < value.size(); i++) { + for (int i = 0; i < value.size(); i++) { if (abs(value[i]) < 0.001) value[i] = 0.f; } @@ -241,7 +241,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); @@ -692,7 +692,7 @@ bool GizmoObjectManipulation::reset_zero_button(ImGuiWrapper *imgui_wrapper, flo for (int i = 0; i < number; i++) { - char buf[3][64] = {0}; + char buf[3][64] = {}; float buf_size[3] = {0}; for (int j = 0; j < 3; j++) { ImGui::DataTypeFormatString(buf[j], IM_ARRAYSIZE(buf[j]), ImGuiDataType_Double, (void *) &vec[i][j], "%.2f"); @@ -737,7 +737,7 @@ void GizmoObjectManipulation::show_move_tooltip_information(ImGuiWrapper *imgui_ if (ImGui::IsItemHovered()) { ImGui::BeginTooltip2(ImVec2(x, y)); - auto draw_text_with_caption = [this, &imgui_wrapper,& caption_max](const wxString &caption, const wxString &text) { + auto draw_text_with_caption = [&imgui_wrapper, &caption_max](const wxString &caption, const wxString &text) { imgui_wrapper->text_colored(ImGuiWrapper::COL_ACTIVE, caption); ImGui::SameLine(caption_max); imgui_wrapper->text_colored(ImGuiWrapper::COL_WINDOW_BG, text); @@ -776,7 +776,7 @@ void GizmoObjectManipulation::show_rotate_tooltip_information(ImGuiWrapper *imgu if (ImGui::IsItemHovered()) { ImGui::BeginTooltip2(ImVec2(x, y)); - auto draw_text_with_caption = [this, &imgui_wrapper, &caption_max](const wxString &caption, const wxString &text) { + auto draw_text_with_caption = [&imgui_wrapper, &caption_max](const wxString &caption, const wxString &text) { imgui_wrapper->text_colored(ImGuiWrapper::COL_ACTIVE, caption); ImGui::SameLine(caption_max); imgui_wrapper->text_colored(ImGuiWrapper::COL_WINDOW_BG, text); @@ -804,7 +804,7 @@ void GizmoObjectManipulation::show_scale_tooltip_information(ImGuiWrapper *imgui if (ImGui::IsItemHovered()) { ImGui::BeginTooltip2(ImVec2(x, y)); - auto draw_text_with_caption = [this, &imgui_wrapper, &caption_max](const wxString &caption, const wxString &text) { + auto draw_text_with_caption = [&imgui_wrapper, &caption_max](const wxString &caption, const wxString &text) { imgui_wrapper->text_colored(ImGuiWrapper::COL_ACTIVE, caption); ImGui::SameLine(caption_max); imgui_wrapper->text_colored(ImGuiWrapper::COL_WINDOW_BG, text); diff --git a/src/slic3r/GUI/HMS.cpp b/src/slic3r/GUI/HMS.cpp index 873a4230be..39221745d3 100644 --- a/src/slic3r/GUI/HMS.cpp +++ b/src/slic3r/GUI/HMS.cpp @@ -32,7 +32,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")) { @@ -79,7 +79,7 @@ int HMSQuery::download_hms_related(const std::string& hms_type, const std::strin json j; 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/HMSPanel.hpp b/src/slic3r/GUI/HMSPanel.hpp index 49910590b8..25ac56de96 100644 --- a/src/slic3r/GUI/HMSPanel.hpp +++ b/src/slic3r/GUI/HMSPanel.hpp @@ -25,7 +25,6 @@ class HMSNotifyItem : public wxPanel wxStaticBitmap *m_bitmap_notify; wxStaticBitmap *m_bitmap_arrow; wxStaticText * m_hms_content; - wxHtmlWindow * m_html; wxPanel * m_staticline; wxBitmap m_img_notify_lv1; diff --git a/src/slic3r/GUI/HelioReleaseNote.cpp b/src/slic3r/GUI/HelioReleaseNote.cpp index 0ca380be4f..02674c5ee2 100644 --- a/src/slic3r/GUI/HelioReleaseNote.cpp +++ b/src/slic3r/GUI/HelioReleaseNote.cpp @@ -1628,7 +1628,7 @@ HelioRatingDialog::HelioRatingDialog(wxWindow *parent, int original, int optimiz save_icon->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) { SetCursor(wxCURSOR_HAND); }); save_icon->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) { SetCursor(wxCURSOR_ARROW); }); - save_icon->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e) { + save_icon->Bind(wxEVT_LEFT_DOWN, [](wxMouseEvent& e) { wxPostEvent(wxGetApp().plater(), SimpleEvent(EVT_GLTOOLBAR_EXPORT_SLICED_FILE)); }); diff --git a/src/slic3r/GUI/HelioReleaseNote.hpp b/src/slic3r/GUI/HelioReleaseNote.hpp index f7b9a30728..d477b70609 100644 --- a/src/slic3r/GUI/HelioReleaseNote.hpp +++ b/src/slic3r/GUI/HelioReleaseNote.hpp @@ -55,7 +55,6 @@ wxDECLARE_EVENT(EVT_ERROR_DIALOG_BTN_CLICKED, wxCommandEvent); class HelioStatementDialog : public DPIDialog { private: - Label *m_title{nullptr}; Button *m_button_confirm{nullptr}; Button *m_button_cancel{nullptr}; @@ -139,15 +138,12 @@ class HelioInputDialog : public DPIDialog wxPanel* panel_optimization{nullptr}; wxPanel* panel_velocity_volumetric{nullptr}; - wxPanel* advanced_settings_link{nullptr}; LinkLabel* buy_now_link{nullptr}; LinkLabel* helio_wiki_link{nullptr}; int current_action{-1}; //0-simulation 1-optimization int support_optimization{0}; //-1-no 0-yes - int remaining_optimization_times{0}; - wxStaticBitmap* advanced_options_icon{nullptr}; wxPanel* panel_advanced_option{nullptr}; std::shared_ptr shared_ptr{nullptr}; diff --git a/src/slic3r/GUI/HttpServer.cpp b/src/slic3r/GUI/HttpServer.cpp index dafcf48948..1be3ecda98 100644 --- a/src/slic3r/GUI/HttpServer.cpp +++ b/src/slic3r/GUI/HttpServer.cpp @@ -375,7 +375,7 @@ void session::handle_login() BOOST_LOG_TRIVIAL(info) << "third_party_login: after applying the login information, the application remains unlogged, login failed"; do_write_302(*login_params, false); } - GUI::wxGetApp().CallAfter([this] { wxGetApp().ShowUserLogin(false); }); + GUI::wxGetApp().CallAfter([] { wxGetApp().ShowUserLogin(false); }); } } else { diff --git a/src/slic3r/GUI/IMSlider.cpp b/src/slic3r/GUI/IMSlider.cpp index a3b1c45dd7..3723afd215 100644 --- a/src/slic3r/GUI/IMSlider.cpp +++ b/src/slic3r/GUI/IMSlider.cpp @@ -238,9 +238,10 @@ void IMSlider::SetTicksValues(const Info &custom_gcode_per_print_z) if (tick >= 0) m_ticks.ticks.emplace(TickCode{tick, h.type, h.extruder, h.color, h.extra}); } - if (!was_empty && m_ticks.empty()) + if (!was_empty && m_ticks.empty()) { // Switch to the "Feature type"/"Tool" from the very beginning of a new object slicing after deleting of the old one - ;// post_ticks_changed_event(); + // post_ticks_changed_event(); + } if (m_ticks.has_tick_with_code(ToolChange) && !m_can_change_color) { if (!wxGetApp().plater()->only_gcode_mode() && !wxGetApp().plater()->using_exported_file()) @@ -781,7 +782,7 @@ void IMSlider::draw_tick_on_mouse_position(const ImRect& slideable_region) { void IMSlider::show_tooltip(const std::string tooltip) { ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, { 6 * m_scale, 3 * m_scale }); - ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, { 3 * m_scale }); + ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 3 * m_scale); ImGui::PushStyleColor(ImGuiCol_PopupBg, ImGuiWrapper::COL_WINDOW_BACKGROUND); ImGui::PushStyleColor(ImGuiCol_Border, { 0,0,0,0 }); ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.00f, 1.00f, 1.00f, 1.00f)); @@ -1196,7 +1197,8 @@ void IMSlider::render_input_custom_gcode(std::string custom_gcode) } void IMSlider::do_go_to_layer(size_t layer_number) { - clamp((int)layer_number, m_min_value, m_max_value); + // clamp((int)layer_number, m_min_value, m_max_value); // OLD: ignored return value - had no effect! + layer_number = clamp((int)layer_number, m_min_value, m_max_value); // Actually use the clamped value GetSelection() == ssLower ? SetLowerValue(layer_number) : SetHigherValue(layer_number); } @@ -1517,9 +1519,6 @@ std::string IMSlider::get_label(int tick, LabelType label_type) { const size_t value = tick; - if (m_label_koef == 1.0 && m_values.empty()) { - std::to_string(value); - } if (value >= m_values.size()) return "error"; auto get_layer_number = [this](int value, LabelType label_type) { diff --git a/src/slic3r/GUI/IMSlider.hpp b/src/slic3r/GUI/IMSlider.hpp index e1cdd92fcb..dfd1cc0faa 100644 --- a/src/slic3r/GUI/IMSlider.hpp +++ b/src/slic3r/GUI/IMSlider.hpp @@ -173,7 +173,6 @@ class IMSlider // Use those values to disable selection of active extruders bool m_is_dark = false; - bool is_osx{false}; int m_min_value; int m_max_value; int m_lower_value; @@ -197,10 +196,6 @@ class IMSlider void *m_one_layer_on_hover_id; void *m_one_layer_off_id; void *m_one_layer_off_hover_id; - void* m_one_layer_on_light_id; - void* m_one_layer_on_hover_light_id; - void* m_one_layer_off_light_id; - void* m_one_layer_off_hover_light_id; void* m_one_layer_on_dark_id; void* m_one_layer_on_hover_dark_id; void* m_one_layer_off_dark_id; @@ -217,7 +212,6 @@ class IMSlider long m_extra_style; float m_label_koef{1.0}; - float m_zero_layer_height = 0.0f; std::vector m_values; TickCodeInfo m_ticks; std::vector m_layers_times; diff --git a/src/slic3r/GUI/ImageDPIFrame.cpp b/src/slic3r/GUI/ImageDPIFrame.cpp index 66abfde889..cbd833fc16 100644 --- a/src/slic3r/GUI/ImageDPIFrame.cpp +++ b/src/slic3r/GUI/ImageDPIFrame.cpp @@ -57,7 +57,7 @@ bool ImageDPIFrame::Show(bool show) } void ImageDPIFrame::set_bitmap(const wxBitmap &bit_map) { - if (&bit_map && bit_map.IsOk()) { + if (bit_map.IsOk()) { m_bitmap->SetBitmap(bit_map); } } diff --git a/src/slic3r/GUI/ImageMessageDialog.cpp b/src/slic3r/GUI/ImageMessageDialog.cpp index 787c2c73e7..51850addcf 100644 --- a/src/slic3r/GUI/ImageMessageDialog.cpp +++ b/src/slic3r/GUI/ImageMessageDialog.cpp @@ -52,7 +52,7 @@ ImageMessageDialog::ImageMessageDialog(wxWindow *parent, wxWindowID id, const wx msg_button->SetMaxSize(wxSize(-1, FromDIP(30))); msg_button->SetCornerRadius(FromDIP(5)); - msg_button->Bind(wxEVT_LEFT_DOWN, [this, style](wxMouseEvent &e) { + msg_button->Bind(wxEVT_LEFT_DOWN, [](wxMouseEvent &e) { std::string language = wxGetApp().app_config->get("language"); wxString region = L"en"; if (language.find("zh") == 0) diff --git a/src/slic3r/GUI/ImageMessageDialog.hpp b/src/slic3r/GUI/ImageMessageDialog.hpp index 7b5f003648..0825d92a58 100644 --- a/src/slic3r/GUI/ImageMessageDialog.hpp +++ b/src/slic3r/GUI/ImageMessageDialog.hpp @@ -35,7 +35,6 @@ class ImageMessageDialog : public DPIDialog wxStaticBitmap* m_error_picture; Label* m_error_msg_label{ nullptr }; - Label* m_error_code_label{ nullptr }; wxBoxSizer* m_sizer_main; wxBoxSizer* m_sizer_button; wxPanel* m_scroll_area{ nullptr }; diff --git a/src/slic3r/GUI/Jobs/BindJob.hpp b/src/slic3r/GUI/Jobs/BindJob.hpp index c29fb7a0e3..124902b1d4 100644 --- a/src/slic3r/GUI/Jobs/BindJob.hpp +++ b/src/slic3r/GUI/Jobs/BindJob.hpp @@ -19,7 +19,6 @@ class BindJob : public PlaterJob std::string m_sec_link; std::string m_ssdp_version; bool m_job_finished{ false }; - int m_print_job_completed_id = 0; bool m_improved{false}; protected: diff --git a/src/slic3r/GUI/Jobs/EmbossJob.cpp b/src/slic3r/GUI/Jobs/EmbossJob.cpp index 0065d07f24..f83c9cfd52 100644 --- a/src/slic3r/GUI/Jobs/EmbossJob.cpp +++ b/src/slic3r/GUI/Jobs/EmbossJob.cpp @@ -1420,7 +1420,6 @@ void GenerateTextJob::finalize(bool canceled, std::exception_ptr &eptr) if (m_input.first_generate) { create_text_volume(m_input.mo, m_input.m_final_text_mesh, m_input.m_final_text_tran_in_object, m_input.text_info); auto model_object = m_input.mo; - m_input.m_volume_idx; auto volume_idx = model_object->volumes.size() - 1; ModelVolume * model_volume = model_object->volumes[volume_idx]; auto add_to_selection = [model_volume](const ModelVolume *vol) { return vol == model_volume; }; @@ -1544,7 +1543,7 @@ bool GenerateTextJob::generate_text_points(InputInfo &input_info) int index = 0; double min_distance = 1e12; Polygon hit_ploy; - for (const Polygon poly : polys) { + for (const Polygon& poly : polys) { if (poly.points.size() == 0) continue; Lines lines = poly.lines(); diff --git a/src/slic3r/GUI/Jobs/FillBedJob.cpp b/src/slic3r/GUI/Jobs/FillBedJob.cpp index 5a02dab408..37bbb33e46 100644 --- a/src/slic3r/GUI/Jobs/FillBedJob.cpp +++ b/src/slic3r/GUI/Jobs/FillBedJob.cpp @@ -176,7 +176,7 @@ void FillBedJob::prepare() ap.bed_idx = PartPlateList::MAX_PLATES_COUNT; ap.height = 1; ap.itemid = -1; - ap.setter = [this, mi](const ArrangePolygon &p) { + ap.setter = [this](const ArrangePolygon &p) { ModelObject *mo = m_plater->model().objects[m_object_idx]; ModelObject* newObj = m_plater->model().add_object(*mo); newObj->name = mo->name +" "+ std::to_string(p.itemid); diff --git a/src/slic3r/GUI/Jobs/PrintJob.cpp b/src/slic3r/GUI/Jobs/PrintJob.cpp index 397f9a6d06..f69838f57c 100644 --- a/src/slic3r/GUI/Jobs/PrintJob.cpp +++ b/src/slic3r/GUI/Jobs/PrintJob.cpp @@ -52,11 +52,9 @@ void PrintJob::prepare() { if (job_data.is_from_plater) m_plater->get_print_job_data(&job_data); - if (&job_data) { - std::string temp_file = Slic3r::resources_dir() + "/check_access_code.txt"; - auto check_access_code_path = temp_file.c_str(); - job_data._temp_path = fs::path(check_access_code_path); - } + std::string temp_file = Slic3r::resources_dir() + "/check_access_code.txt"; + auto check_access_code_path = temp_file.c_str(); + job_data._temp_path = fs::path(check_access_code_path); m_print_stage = BBL::SendingPrintJobStage::PrintingStageLimit; } @@ -405,9 +403,7 @@ void PrintJob::process() &is_try_lan_mode, &is_try_lan_mode_failed, &msg, - &error_str, &curr_percent, - &error_text, StagePercentPoint ](int stage, int code, std::string info) { m_print_stage = stage; @@ -493,7 +489,7 @@ void PrintJob::process() DeviceManager* dev = wxGetApp().getDeviceManager(); MachineObject* obj = dev->get_selected_machine(); - auto wait_fn = [this, curr_percent, &obj](int state, std::string job_info) { + auto wait_fn = [this, &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) { @@ -503,7 +499,7 @@ void PrintJob::process() std::string curr_job_id; json job_info_j; try { - job_info_j.parse(job_info); + [[maybe_unused]] bool parse_ok = job_info_j.parse(job_info); if (job_info_j.contains("job_id")) { curr_job_id = DevJsonValParser::get_longlong_val(job_info_j["job_id"]); } diff --git a/src/slic3r/GUI/Jobs/RotoptimizeJob.cpp b/src/slic3r/GUI/Jobs/RotoptimizeJob.cpp index edf72bfb0b..b91c18dbe2 100644 --- a/src/slic3r/GUI/Jobs/RotoptimizeJob.cpp +++ b/src/slic3r/GUI/Jobs/RotoptimizeJob.cpp @@ -52,12 +52,12 @@ void RotoptimizeJob::process() sla::RotOptimizeParams{} .accuracy(m_accuracy) .print_config(&m_default_print_cfg) - .statucb([this, &prev_status](int s) + .statucb([this](int s) { - if (s > 0 && s < 100) - ; + if (s > 0 && s < 100) { // update_status(prev_status + s / m_selected_object_ids.size(), // _(L("Searching for optimal orientation..."))); + } return !was_canceled(); }); diff --git a/src/slic3r/GUI/Jobs/SendJob.cpp b/src/slic3r/GUI/Jobs/SendJob.cpp index a8a2220895..ea07c95c8d 100644 --- a/src/slic3r/GUI/Jobs/SendJob.cpp +++ b/src/slic3r/GUI/Jobs/SendJob.cpp @@ -37,11 +37,9 @@ SendJob::SendJob(std::shared_ptr pri, Plater* plater, std::st void SendJob::prepare() { m_plater->get_print_job_data(&job_data); - if (&job_data) { - std::string temp_file = Slic3r::resources_dir() + "/check_access_code.txt"; - auto check_access_code_path = temp_file.c_str(); - job_data._temp_path = fs::path(check_access_code_path); - } + std::string temp_file = Slic3r::resources_dir() + "/check_access_code.txt"; + auto check_access_code_path = temp_file.c_str(); + job_data._temp_path = fs::path(check_access_code_path); } void SendJob::on_exception(const std::exception_ptr &eptr) @@ -238,7 +236,7 @@ void SendJob::process() 100 // PrintingStageFinished }; - auto update_fn = [this, &msg, &curr_percent, &error_text, StagePercentPoint](int stage, int code, std::string info) { + auto update_fn = [this, &msg, &curr_percent, StagePercentPoint](int stage, int code, std::string info) { if (stage == SendingPrintJobStage::PrintingStageCreate) { if (this->connection_type == "lan") { msg = _L("Sending gcode file over LAN"); diff --git a/src/slic3r/GUI/Jobs/UpgradeNetworkJob.hpp b/src/slic3r/GUI/Jobs/UpgradeNetworkJob.hpp index 18cbbda31b..2a4e7ffe11 100644 --- a/src/slic3r/GUI/Jobs/UpgradeNetworkJob.hpp +++ b/src/slic3r/GUI/Jobs/UpgradeNetworkJob.hpp @@ -26,7 +26,6 @@ class UpgradeNetworkJob : public Job wxWindow * m_event_handle{nullptr}; std::function m_success_fun{nullptr}; bool m_job_finished{ false }; - int m_print_job_completed_id = 0; InstallProgressFn pro_fn { nullptr }; diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 7cc36eaee1..48c004a702 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -178,7 +178,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_ , m_printhost_queue_dlg(new PrintHostQueueDialog(this)) // BBS , m_recent_projects(18) - , m_settings_dialog(this) + , m_settings_dialog() , diff_dialog(this) { #ifdef __WXOSX__ @@ -693,7 +693,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(); @@ -1075,7 +1075,6 @@ void MainFrame::update_title_colour_after_set_title() void MainFrame::show_option(bool show) { - if (!this) { return; } if (!show) { if (m_slice_btn->IsShown()) { m_slice_btn->Hide(); @@ -1253,7 +1252,7 @@ void MainFrame::init_tabpanel() select_tab(MainFrame::tpHome); m_webview->load_url(url); }); - m_tabpanel->AddPage(m_webview, "", "tab_home_active", "tab_home_active", false); + m_tabpanel->AddPage(m_webview, wxString(""), "tab_home_active", "tab_home_active", false); m_param_panel = new ParamsPanel(m_tabpanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL); } @@ -2678,7 +2677,7 @@ void MainFrame::init_menubar_as_editor() [this](){return can_add_models(); }, this); append_menu_item(import_menu, wxID_ANY, _L("Import Configs") + dots /*+ "\tCtrl+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"), ""); @@ -2723,7 +2722,7 @@ void MainFrame::init_menubar_as_editor() append_menu_item( fileMenu, wxID_ANY, _L("Publish to MakerWorld"), _L("Publish to MakerWorld"), [this](wxCommandEvent &) { - CallAfter([this] { + CallAfter([] { wxGetApp().open_publish_page_dialog(); if (!wxGetApp().getAgent()) { @@ -2738,7 +2737,7 @@ void MainFrame::init_menubar_as_editor() }); }, "", nullptr, - [this](){ return wxGetApp().has_model_mall(); }, this); + [](){ return wxGetApp().has_model_mall(); }, this); append_menu_item( fileMenu, wxID_ANY, _L("Batch Preset Management"), wxString::Format(_L("Batch Preset Management")), @@ -2975,13 +2974,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); @@ -2997,7 +2996,7 @@ void MainFrame::init_menubar_as_editor() m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT)); }, this, [this]() { return m_tabpanel->GetSelection() == TabPosition::tp3DEditor || m_tabpanel->GetSelection() == TabPosition::tpPreview; }, - [this]() { return wxGetApp().show_3d_navigator(); }, this); + []() { return wxGetApp().show_3d_navigator(); }, this); append_menu_item( viewMenu, wxID_ANY, _L("Reset Window Layout") + "\t" + ctrl + "W", _L("Reset to default window layout"), [this](wxCommandEvent &) { m_plater->reset_window_layout(); }, "", this, @@ -3017,7 +3016,7 @@ void MainFrame::init_menubar_as_editor() viewMenu->AppendSeparator(); append_menu_item( viewMenu, wxID_ANY, _L("Set 3DConnexion"), _L("Set 3DConnexion mouse"), - [this](wxCommandEvent &) { + [](wxCommandEvent &) { #ifdef _WIN32 if (wxGetApp().app_config->get("use_legacy_3DConnexion") == "true") { #endif //_WIN32 @@ -3026,7 +3025,7 @@ void MainFrame::init_menubar_as_editor() #ifdef _WIN32 } #endif //_WIN32 - }, "", nullptr, [this]() { + }, "", nullptr, []() { Mouse3DController &controller = wxGetApp().plater()->get_mouse3d_controller(); auto tab_index = (MainFrame::TabPosition) dynamic_cast(wxGetApp().tab_panel())->GetSelection(); auto is_3d_view = tab_index == MainFrame::TabPosition::tp3DEditor || tab_index == MainFrame::TabPosition::tpPreview; @@ -3165,7 +3164,7 @@ void MainFrame::init_menubar_as_editor() //parent_menu->Insert(0, about_item); append_menu_item( parent_menu, wxID_ANY, _L(about_title), "", - [this](wxCommandEvent &) { Slic3r::GUI::about();}, + [](wxCommandEvent &) { Slic3r::GUI::about();}, "", nullptr, []() { return true; }, this, 0); append_menu_item( parent_menu, wxID_ANY, _L("Preferences") + "\t" + ctrl + ",", "", @@ -3408,7 +3407,7 @@ void MainFrame::init_menubar_as_editor() // help append_menu_item( m_calib_menu, wxID_ANY, _L("Tutorial"), _L("Calibration help"), - [this](wxCommandEvent &) { + [](wxCommandEvent &) { try { json js; js["cali_type"] = "third_cali_tutorial"; @@ -4283,11 +4282,10 @@ std::string MainFrame::get_dir_name(const wxString &full_name) const // SettingsDialog // ---------------------------------------------------------------------------- -SettingsDialog::SettingsDialog(MainFrame* mainframe) -:DPIDialog(NULL, wxID_ANY, wxString(SLIC3R_APP_NAME) + " - " + _L("Settings"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, "settings_dialog"), +SettingsDialog::SettingsDialog() +:DPIDialog(NULL, wxID_ANY, wxString(SLIC3R_APP_NAME) + " - " + _L("Settings"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, "settings_dialog") //: DPIDialog(mainframe, wxID_ANY, wxString(SLIC3R_APP_NAME) + " - " + _L("Settings"), wxDefaultPosition, wxDefaultSize, -// wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMINIMIZE_BOX | wxMAXIMIZE_BOX, "settings_dialog"), - m_main_frame(mainframe) +// wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMINIMIZE_BOX | wxMAXIMIZE_BOX, "settings_dialog") { if (wxGetApp().is_gcode_viewer()) return; diff --git a/src/slic3r/GUI/MainFrame.hpp b/src/slic3r/GUI/MainFrame.hpp index 644aa07d10..1b07d04559 100644 --- a/src/slic3r/GUI/MainFrame.hpp +++ b/src/slic3r/GUI/MainFrame.hpp @@ -76,10 +76,9 @@ class SettingsDialog : public DPIDialog//DPIDialog { //wxNotebook* m_tabpanel { nullptr }; Notebook* m_tabpanel{ nullptr }; - MainFrame* m_main_frame { nullptr }; wxMenuBar* m_menubar{ nullptr }; public: - SettingsDialog(MainFrame* mainframe); + SettingsDialog(); ~SettingsDialog() = default; //void set_tabpanel(wxNotebook* tabpanel) { m_tabpanel = tabpanel; } void set_tabpanel(Notebook* tabpanel) { m_tabpanel = tabpanel; } diff --git a/src/slic3r/GUI/MediaFilePanel.cpp b/src/slic3r/GUI/MediaFilePanel.cpp index f0b82b80a4..2e0af93d13 100644 --- a/src/slic3r/GUI/MediaFilePanel.cpp +++ b/src/slic3r/GUI/MediaFilePanel.cpp @@ -438,7 +438,7 @@ void MediaFilePanel::SetSelecting(bool selecting) m_image_grid->SetSelecting(selecting); m_button_management->SetLabel(selecting ? _L("Cancel") : _L("Select")); auto fs = m_image_grid->GetFileSystem(); - bool download_support = fs && fs->GetFileType() < PrinterFileSystem::F_MODEL || m_model_download_support; + bool download_support = (fs && fs->GetFileType() < PrinterFileSystem::F_MODEL) || m_model_download_support; m_manage_panel->GetSizer()->Show(m_button_download, selecting && download_support); m_manage_panel->GetSizer()->Show(m_button_delete, selecting); m_manage_panel->GetSizer()->Show(m_button_refresh, !selecting); diff --git a/src/slic3r/GUI/MediaFilePanel.h b/src/slic3r/GUI/MediaFilePanel.h index 72fbc96a13..36696d2225 100644 --- a/src/slic3r/GUI/MediaFilePanel.h +++ b/src/slic3r/GUI/MediaFilePanel.h @@ -61,7 +61,6 @@ class MediaFilePanel : public wxPanel ::Button *m_button_year = nullptr; ::Button *m_button_month = nullptr; ::Button *m_button_all = nullptr; - ::Label *m_switch_label = nullptr; ::StaticBox * m_type_panel = nullptr; ::Button * m_button_video = nullptr; diff --git a/src/slic3r/GUI/MediaPlayCtrl.cpp b/src/slic3r/GUI/MediaPlayCtrl.cpp index e36f30482a..43ccc7af65 100644 --- a/src/slic3r/GUI/MediaPlayCtrl.cpp +++ b/src/slic3r/GUI/MediaPlayCtrl.cpp @@ -76,7 +76,8 @@ MediaPlayCtrl::MediaPlayCtrl(wxWindow *parent, wxMediaCtrl3 *media_ctrl, const w auto ip = str.find(' ', ik); if (ip == wxString::npos) ip = str.Length(); auto v = str.Mid(ik, ip - ik); - if (k == "T:" && v.Length() == 8) { + // if (k == "T:" && v.Length() == 8) { // OLD: pointer comparison, not string comparison! + if (strcmp(k, "T:") == 0 && v.Length() == 8) { long h = 0,m = 0,s = 0; v.Left(2).ToLong(&h); v.Mid(3, 2).ToLong(&m); @@ -94,7 +95,7 @@ MediaPlayCtrl::MediaPlayCtrl(wxWindow *parent, wxMediaCtrl3 *media_ctrl, const w m_button_play->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this](auto &e) { TogglePlay(); }); m_button_play->Bind(wxEVT_RIGHT_UP, [this](auto & e) { m_media_ctrl->Play(); }); - m_label_status->Bind(wxEVT_LEFT_UP, [this](auto &e) { + m_label_status->Bind(wxEVT_LEFT_UP, [](auto &e) { auto url = wxString::Format(L"https://wiki.bambulab.com/%s/software/bambu-studio/faq/live-view", wxGetApp().current_language_code_safe() == "zh_CN" ? "zh" : "en"); wxLaunchDefaultBrowser(url); }); @@ -179,9 +180,9 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj) } Enable(obj && obj->is_info_ready() && obj->m_push_count > 0); if (machine == m_machine) { - if (m_last_state == MEDIASTATE_IDLE && IsEnabled()) + if (m_last_state == MediaStreamState::IDLE && IsEnabled()) Play(); - if (m_last_state == wxMediaState::wxMEDIASTATE_PLAYING) { + if (m_last_state == MediaStreamState::PLAYING) { auto now = std::chrono::system_clock::now(); if (m_play_timer <= now) { m_play_timer = now + 1min; @@ -218,7 +219,7 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj) } else { m_streaming = false; } - if (m_last_state != MEDIASTATE_IDLE) + if (m_last_state != MediaStreamState::IDLE) Stop(" "); if (m_next_retry.IsValid()) // Try open 2 seconds later, to avoid state conflict m_next_retry = wxDateTime::Now() + wxTimeSpan::Seconds(2); @@ -278,7 +279,7 @@ void MediaPlayCtrl::Play() return; if (!IsShownOnScreen()) return; - if (m_last_state != MEDIASTATE_IDLE) { + if (m_last_state != MediaStreamState::IDLE) { return; } m_failed_code = 0; @@ -347,7 +348,7 @@ void MediaPlayCtrl::Play() m_disable_lan = false; m_failed_code = 0; - m_last_state = MEDIASTATE_INITIALIZING; + m_last_state = MediaStreamState::INITIALIZING; m_button_play->SetIcon("media_stop"); if (!m_remote_proto) { // not support tutk @@ -387,7 +388,7 @@ void MediaPlayCtrl::Play() BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl drop late ttcode for machine: " << BBLCrossTalk::Crosstalk_DevId(m); return; } - if (m_last_state == MEDIASTATE_INITIALIZING) { + if (m_last_state == MediaStreamState::INITIALIZING) { if (url.empty() || !boost::algorithm::starts_with(url, "bambu:///")) { m_failed_code = 3; if (boost::ends_with(url, "]")) { @@ -412,9 +413,9 @@ void start_ping_test(); void MediaPlayCtrl::Stop(wxString const &msg, wxString const &msg2) { - int last_state = m_last_state; + MediaStreamState last_state = m_last_state; - if (m_last_state != MEDIASTATE_IDLE) { + if (m_last_state != MediaStreamState::IDLE) { m_media_ctrl->InvalidateBestSize(); m_button_play->SetIcon("media_play"); boost::unique_lock lock(m_mutex); @@ -428,7 +429,7 @@ void MediaPlayCtrl::Stop(wxString const &msg, wxString const &msg2) ? _L("Please check the network and try again, You can restart or update the printer if the issue persists.") : _L(iter->second.c_str()); if (m_failed_code == 1) { - if (m_last_state == wxMEDIASTATE_PLAYING) + if (m_last_state == MediaStreamState::PLAYING) msg2 = _L("Multi-device/client simultaneous liveview is not supported. Please close the liveview on other devices/clients and try again."); } #if !BBL_RELEASE_TO_PUBLIC && defined(__WINDOWS__) @@ -440,7 +441,7 @@ void MediaPlayCtrl::Stop(wxString const &msg, wxString const &msg2) SetStatus(msg2); } else SetStatus(_L("Video Stopped."), false); - m_last_state = MEDIASTATE_IDLE; + m_last_state = MediaStreamState::IDLE; bool auto_retry = wxGetApp().app_config->get("liveview", "auto_retry") != "false"; if (!auto_retry || m_failed_code >= 100 || m_failed_code == 1 || m_failed_code == -2) // not keep retry on local error or EOS m_next_retry = wxDateTime(); @@ -455,11 +456,11 @@ void MediaPlayCtrl::Stop(wxString const &msg, wxString const &msg2) auto tunnel = m_url.empty() ? "" : into_u8(wxURI(m_url).GetPath()).substr(1); if (auto n = tunnel.find_first_of("/_"); n != std::string::npos) tunnel = tunnel.substr(0, n); - if (last_state != wxMEDIASTATE_PLAYING && m_failed_code != 0 + if (last_state != MediaStreamState::PLAYING && m_failed_code != 0 && m_last_failed_codes.find(m_failed_code) == m_last_failed_codes.end() && (m_user_triggered || m_failed_retry > 3)) { json j; - j["stage"] = last_state; + j["stage"] = static_cast(last_state); //j["dev_id"] = m_machine; j["dev_id"] = ""; j["dev_ip"] = ""; @@ -482,7 +483,7 @@ void MediaPlayCtrl::Stop(wxString const &msg, wxString const &msg2) m_last_failed_codes.insert(m_failed_code); } - if (last_state == wxMEDIASTATE_PLAYING && m_stat.size() == 4) { + if (last_state == MediaStreamState::PLAYING && m_stat.size() == 4) { json j; //j["dev_id"] = m_machine; j["dev_id"] = ""; @@ -503,7 +504,7 @@ void MediaPlayCtrl::Stop(wxString const &msg, wxString const &msg2) ++m_failed_retry; bool local = tunnel == "local" || tunnel == "rtsp" || tunnel == "rtsps"; - if (m_failed_code < 0 && last_state != wxMEDIASTATE_PLAYING && local && (m_failed_retry > 1 || m_user_triggered)) { + if (m_failed_code < 0 && last_state != MediaStreamState::PLAYING && local && (m_failed_retry > 1 || m_user_triggered)) { m_next_retry = wxDateTime(); // stop retry if (wxGetApp().show_modal_ip_address_enter_dialog(false, _L("LAN Connection Failed (Failed to start liveview)"))) { m_failed_retry = 0; @@ -524,7 +525,7 @@ void MediaPlayCtrl::Stop(wxString const &msg, wxString const &msg2) void MediaPlayCtrl::TogglePlay() { BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::TogglePlay"; - if (m_last_state != MEDIASTATE_IDLE) { + if (m_last_state != MediaStreamState::IDLE) { m_next_retry = wxDateTime(); Stop(); } else { @@ -676,7 +677,7 @@ void MediaPlayCtrl::msw_rescale() { void MediaPlayCtrl::jump_to_play() { - if (m_last_state != MEDIASTATE_IDLE) + if (m_last_state != MediaStreamState::IDLE) return; TogglePlay(); } @@ -685,7 +686,7 @@ void MediaPlayCtrl::onStateChanged(wxMediaEvent &event) { auto last_state = m_last_state; auto state = m_media_ctrl->GetState(); - BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::onStateChanged: " << state << ", last_state: " << last_state; + BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::onStateChanged: " << state << ", last_state: " << static_cast(last_state); if ((int) state < 0) return; { boost::unique_lock lock(m_mutex); @@ -694,18 +695,18 @@ void MediaPlayCtrl::onStateChanged(wxMediaEvent &event) return; } } - if ((last_state == MEDIASTATE_IDLE || last_state == MEDIASTATE_INITIALIZING) && state == wxMEDIASTATE_STOPPED) { return; } - if ((last_state == wxMEDIASTATE_PAUSED || last_state == wxMEDIASTATE_PLAYING) && state == wxMEDIASTATE_STOPPED) { + if ((last_state == MediaStreamState::IDLE || last_state == MediaStreamState::INITIALIZING) && state == wxMEDIASTATE_STOPPED) { return; } + if ((last_state == MediaStreamState::PAUSED || last_state == MediaStreamState::PLAYING) && state == wxMEDIASTATE_STOPPED) { m_failed_code = m_media_ctrl->GetLastError(); Stop(); return; } - if (last_state == MEDIASTATE_LOADING && (state == wxMEDIASTATE_STOPPED || state == wxMEDIASTATE_PAUSED)) { + if (last_state == MediaStreamState::LOADING && (state == wxMEDIASTATE_STOPPED || state == wxMEDIASTATE_PAUSED)) { wxSize size = m_media_ctrl->GetVideoSize(); BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::onStateChanged: size: " << size.x << "x" << size.y; m_failed_code = m_media_ctrl->GetLastError(); if (size.GetWidth() >= 320) { - m_last_state = state; + m_last_state = from_wxMediaState(state); m_failed_code = 0; SetStatus(_L("Playing..."), false); m_print_idle = 0; @@ -715,7 +716,7 @@ void MediaPlayCtrl::onStateChanged(wxMediaEvent &event) // track event json j; - j["stage"] = std::to_string(m_last_state); + j["stage"] = std::to_string(static_cast(m_last_state)); //j["dev_id"] = m_machine; j["dev_id"] = ""; j["dev_ip"] = ""; @@ -747,7 +748,7 @@ void MediaPlayCtrl::onStateChanged(wxMediaEvent &event) Stop(); } } else { - m_last_state = state; + m_last_state = from_wxMediaState(state); } } @@ -755,8 +756,11 @@ void MediaPlayCtrl::SetStatus(wxString const &msg2, bool hyperlink) { auto msg = msg2; if (m_failed_code != 0) { - int state2 = m_last_state >= MEDIASTATE_IDLE ? m_last_state - MEDIASTATE_IDLE : - m_last_state + MEDIASTATE_BUFFERING - MEDIASTATE_IDLE; + int state_value = static_cast(m_last_state); + constexpr int IDLE_VALUE = static_cast(MediaStreamState::IDLE); + constexpr int BUFFERING_VALUE = static_cast(MediaStreamState::BUFFERING); + int state2 = state_value >= IDLE_VALUE ? state_value - IDLE_VALUE : + state_value + BUFFERING_VALUE - IDLE_VALUE; msg += wxString::Format(" [%d:%d]", state2, m_failed_code); msg += wxDateTime::Now().Format(_T(" <%m-%d %H:%M>")); } @@ -795,7 +799,7 @@ bool MediaPlayCtrl::IsStreaming() const { return m_streaming; } void MediaPlayCtrl::load() { - m_last_state = MEDIASTATE_LOADING; + m_last_state = MediaStreamState::LOADING; SetStatus(_L("Loading...")); if (wxGetApp().app_config->get("internal_developer_mode") == "true") { std::string file_h264 = data_dir() + "/video.h264"; @@ -905,7 +909,7 @@ bool MediaPlayCtrl::start_stream_service(bool *need_install) auto file_dll = tools_dir + dll; auto file_dll2 = plugins_dir + dll; if (!boost::filesystem::exists(file_dll) || boost::filesystem::last_write_time(file_dll) != boost::filesystem::last_write_time(file_dll2)) - boost::filesystem::copy_file(file_dll2, file_dll, boost::filesystem::copy_option::overwrite_if_exists); + boost::filesystem::copy_file(file_dll2, file_dll, boost::filesystem::copy_options::overwrite_existing); } boost::process::child process_source(file_source, file_url2.ToStdWstring(), boost::process::start_dir(tools_dir), boost::process::windows::create_no_window, @@ -924,8 +928,9 @@ bool MediaPlayCtrl::start_stream_service(bool *need_install) } catch (std::exception &e) { #if !BBL_RELEASE_TO_PUBLIC BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl failed to start camera stream: " << decode_path(e.what()); +#else + (void)e; // Suppress unused variable warning in public builds #endif - return false; } return true; diff --git a/src/slic3r/GUI/MediaPlayCtrl.h b/src/slic3r/GUI/MediaPlayCtrl.h index 88832fbf28..a8174df8c9 100644 --- a/src/slic3r/GUI/MediaPlayCtrl.h +++ b/src/slic3r/GUI/MediaPlayCtrl.h @@ -18,6 +18,7 @@ #endif #include +#include #include #include @@ -35,6 +36,27 @@ class MachineObject; namespace GUI { +// Extended media state enum that includes wxMediaState values plus streaming-specific states +enum class MediaStreamState { + STOPPED = 0, // Maps to wxMEDIASTATE_STOPPED + PAUSED = 1, // Maps to wxMEDIASTATE_PAUSED + PLAYING = 2, // Maps to wxMEDIASTATE_PLAYING + IDLE = 3, // Ready to play, not streaming + INITIALIZING = 4, // Starting up the stream + LOADING = 5, // Loading video data + BUFFERING = 6 // Waiting for buffered data +}; + +// Helper function to convert wxMediaState to MediaStreamState +inline MediaStreamState from_wxMediaState(wxMediaState state) { + return static_cast(static_cast(state)); +} + +// Output stream operator for logging +inline std::ostream& operator<<(std::ostream& os, MediaStreamState state) { + return os << static_cast(state); +} + class MediaPlayCtrl : public wxPanel { public: @@ -75,16 +97,11 @@ class MediaPlayCtrl : public wxPanel static bool get_stream_url(std::string *url = nullptr); private: - static constexpr wxMediaState MEDIASTATE_IDLE = (wxMediaState) 3; - static constexpr wxMediaState MEDIASTATE_INITIALIZING = (wxMediaState) 4; - static constexpr wxMediaState MEDIASTATE_LOADING = (wxMediaState) 5; - static constexpr wxMediaState MEDIASTATE_BUFFERING = (wxMediaState) 6; - // token std::shared_ptr m_token = std::make_shared(0); wxMediaCtrl3 * m_media_ctrl; - wxMediaState m_last_state = MEDIASTATE_IDLE; + MediaStreamState m_last_state = MediaStreamState::IDLE; std::string m_machine; int m_lan_proto = 0; std::string m_lan_ip; diff --git a/src/slic3r/GUI/Monitor.cpp b/src/slic3r/GUI/Monitor.cpp index c77397d64b..7df1c5a104 100644 --- a/src/slic3r/GUI/Monitor.cpp +++ b/src/slic3r/GUI/Monitor.cpp @@ -204,17 +204,17 @@ void MonitorPanel::init_tabpanel() //m_status_add_machine_panel = new AddMachinePanel(m_tabpanel); m_status_info_panel = new StatusPanel(m_tabpanel); - m_tabpanel->AddPage(m_status_info_panel, _L("Status"), "", true); + m_tabpanel->AddPage(m_status_info_panel, _L("Status"), std::string(""), true); m_media_file_panel = new MediaFilePanel(m_tabpanel); - m_tabpanel->AddPage(m_media_file_panel, _L("Storage"), "", false); + m_tabpanel->AddPage(m_media_file_panel, _L("Storage"), std::string(""), false); //m_tabpanel->AddPage(m_media_file_panel, _L("Internal Storage"), "", false); m_upgrade_panel = new UpgradePanel(m_tabpanel); - m_tabpanel->AddPage(m_upgrade_panel, _CTX(L_CONTEXT("Update", "Firmware"), "Firmware"), "", false); + m_tabpanel->AddPage(m_upgrade_panel, _CTX(L_CONTEXT("Update", "Firmware"), "Firmware"), std::string(""), false); m_hms_panel = new HMSPanel(m_tabpanel); - m_tabpanel->AddPage(m_hms_panel, _L("Assistant(HMS)"), "", false); + m_tabpanel->AddPage(m_hms_panel, _L("Assistant(HMS)"), std::string(""), false); m_initialized = true; show_status((int)MonitorStatus::MONITOR_NO_PRINTER); diff --git a/src/slic3r/GUI/Monitor.hpp b/src/slic3r/GUI/Monitor.hpp index d3032a8563..8ea7e20c96 100644 --- a/src/slic3r/GUI/Monitor.hpp +++ b/src/slic3r/GUI/Monitor.hpp @@ -78,7 +78,6 @@ class MonitorPanel : public wxPanel Tabbook* m_tabpanel{ nullptr }; wxSizer* m_main_sizer{ nullptr }; - AddMachinePanel* m_status_add_machine_panel; StatusPanel* m_status_info_panel; MediaFilePanel* m_media_file_panel; UpgradePanel* m_upgrade_panel; @@ -86,11 +85,6 @@ class MonitorPanel : public wxPanel /* side tools */ SideTools* m_side_tools{nullptr}; - wxStaticBitmap* m_bitmap_printer_type; - wxStaticBitmap* m_bitmap_arrow; - wxStaticText* m_staticText_printer_name; - wxStaticBitmap* m_bitmap_wifi_signal; - wxBoxSizer * m_side_tools_sizer; SelectMachinePopup m_select_machine; /* images */ @@ -101,7 +95,6 @@ class MonitorPanel : public wxPanel wxBitmap m_printer_img; wxBitmap m_arrow_img; - int last_wifi_signal = -1; int last_status; bool m_initialized { false }; bool update_flag{false}; diff --git a/src/slic3r/GUI/Mouse3DController.cpp b/src/slic3r/GUI/Mouse3DController.cpp index 1ff1e79d63..19f618d4ef 100644 --- a/src/slic3r/GUI/Mouse3DController.cpp +++ b/src/slic3r/GUI/Mouse3DController.cpp @@ -468,7 +468,7 @@ void Mouse3DController::render_settings_dialog(GLCanvas3D& canvas) const ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20.0f, 20.0f)); static ImVec2 last_win_size(0.0f, 0.0f); bool shown = true; - if (imgui.begin(_L("3Dconnexion settings"), &shown, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse || ImGuiWindowFlags_NoTitleBar)) { + if (imgui.begin(_L("3Dconnexion settings"), &shown, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar)) { if (shown) { ImVec2 win_size = ImGui::GetWindowSize(); if (last_win_size.x != win_size.x || last_win_size.y != win_size.y) { diff --git a/src/slic3r/GUI/MsgDialog.cpp b/src/slic3r/GUI/MsgDialog.cpp index 376fcf1537..7c73834cdc 100644 --- a/src/slic3r/GUI/MsgDialog.cpp +++ b/src/slic3r/GUI/MsgDialog.cpp @@ -681,7 +681,7 @@ NetworkErrorDialog::NetworkErrorDialog(wxWindow* parent) m_link_server_state = new wxHyperlinkCtrl(this, wxID_ANY, _L("Check the status of current system services"), ""); m_link_server_state->SetFont(::Label::Body_13); - m_link_server_state->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {wxGetApp().link_to_network_check(); }); + m_link_server_state->Bind(wxEVT_LEFT_DOWN, [](auto& e) {wxGetApp().link_to_network_check(); }); m_link_server_state->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_HAND); }); m_link_server_state->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_ARROW); }); @@ -699,7 +699,7 @@ NetworkErrorDialog::NetworkErrorDialog(wxWindow* parent) m_text_wiki = new wxHyperlinkCtrl(this, wxID_ANY, _L("How to use LAN only mode"), ""); m_text_wiki->SetFont(::Label::Body_13); - m_text_wiki->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {wxGetApp().link_to_lan_only_wiki(); }); + m_text_wiki->Bind(wxEVT_LEFT_DOWN, [](auto& e) {wxGetApp().link_to_lan_only_wiki(); }); m_text_wiki->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_HAND); }); m_text_wiki->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_ARROW); }); diff --git a/src/slic3r/GUI/MsgDialog.hpp b/src/slic3r/GUI/MsgDialog.hpp index 86aefab116..ed1154c5c6 100644 --- a/src/slic3r/GUI/MsgDialog.hpp +++ b/src/slic3r/GUI/MsgDialog.hpp @@ -171,7 +171,6 @@ class MessageDialog : public MsgDialog // Generic rich message dialog, used intead of wxRichMessageDialog class RichMessageDialog : public MsgDialog { - wxCheckBox* m_checkBox{ nullptr }; wxString m_checkBoxText; bool m_checkBoxValue{ false }; @@ -410,7 +409,6 @@ class Newer3mfVersionDialog : public DPIDialog wxString m_new_keys; Button * m_update_btn = nullptr; Button * m_later_btn = nullptr; - wxStaticText *m_msg_text = nullptr; }; diff --git a/src/slic3r/GUI/MultiMachine.cpp b/src/slic3r/GUI/MultiMachine.cpp index 9919d05dfa..7bf83828d2 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 678644d9f5..c0e4f3302d 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(); @@ -678,7 +678,10 @@ void MultiMachineManagerPage::start_timer() m_flipping_timer->SetOwner(this); m_flipping_timer->Start(1000); - wxPostEvent(this, wxTimerEvent()); + // Immediate update instead of posting deprecated wxTimerEvent + m_flipping_timer->Stop(); + if (btn_last_page) btn_last_page->Enable(true); + if (btn_next_page) btn_next_page->Enable(true); } void MultiMachineManagerPage::update_page_number() diff --git a/src/slic3r/GUI/MultiMachineManagerPage.hpp b/src/slic3r/GUI/MultiMachineManagerPage.hpp index c1086b4721..c2f5f3e2c9 100644 --- a/src/slic3r/GUI/MultiMachineManagerPage.hpp +++ b/src/slic3r/GUI/MultiMachineManagerPage.hpp @@ -76,7 +76,6 @@ class MultiMachineManagerPage : public wxPanel wxBoxSizer* m_main_sizer{nullptr}; wxBoxSizer* m_sizer_machine_list{nullptr}; wxScrolledWindow* m_machine_list{ nullptr }; - wxStaticText* m_selected_num{ nullptr }; // table head wxPanel* m_table_head_panel{ nullptr }; @@ -85,7 +84,6 @@ class MultiMachineManagerPage : public wxPanel Button* m_task_name{ nullptr }; Button* m_status{ nullptr }; Button* m_action{ nullptr }; - Button* m_stop_all_botton{nullptr}; // tip when no device wxStaticText* m_tip_text{ nullptr }; @@ -97,8 +95,6 @@ class MultiMachineManagerPage : public wxPanel int m_total_count{ 0 }; int m_count_page_item{ 10 }; - bool prev{ false }; - bool next{ false }; Button* btn_last_page{ nullptr }; Button* btn_next_page{ nullptr }; wxStaticText* st_page_number{ nullptr }; diff --git a/src/slic3r/GUI/MultiMachinePage.cpp b/src/slic3r/GUI/MultiMachinePage.cpp index ddc3a0441f..b4bd85f5d0 100644 --- a/src/slic3r/GUI/MultiMachinePage.cpp +++ b/src/slic3r/GUI/MultiMachinePage.cpp @@ -61,7 +61,10 @@ bool MultiMachinePage::Show(bool show) m_refresh_timer->Stop(); m_refresh_timer->SetOwner(this); m_refresh_timer->Start(2000); - wxPostEvent(this, wxTimerEvent()); + // Immediate update instead of posting deprecated wxTimerEvent + m_local_task_manager->update_page(); + m_cloud_task_manager->update_page(); + m_machine_manager->update_page(); } else { m_refresh_timer->Stop(); @@ -80,15 +83,15 @@ 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); m_machine_manager = new MultiMachineManagerPage(m_tabpanel); - m_tabpanel->AddPage(m_machine_manager, _L("Device"), "", true); - m_tabpanel->AddPage(m_local_task_manager, _L("Task Sending"), "", false); - m_tabpanel->AddPage(m_cloud_task_manager, _L("Task Sent"), "", false); + m_tabpanel->AddPage(m_machine_manager, _L("Device"), std::string(""), true); + m_tabpanel->AddPage(m_local_task_manager, _L("Task Sending"), std::string(""), false); + m_tabpanel->AddPage(m_cloud_task_manager, _L("Task Sent"), std::string(""), false); } void MultiMachinePage::init_timer() diff --git a/src/slic3r/GUI/MultiMachinePage.hpp b/src/slic3r/GUI/MultiMachinePage.hpp index 0572c30d1b..724eeed2a9 100644 --- a/src/slic3r/GUI/MultiMachinePage.hpp +++ b/src/slic3r/GUI/MultiMachinePage.hpp @@ -81,7 +81,6 @@ class MultiMachinePickPage : public DPIDialog AppConfig* app_config; Label* m_label{ nullptr }; wxScrolledWindow* scroll_macine_list{ nullptr }; - wxBoxSizer* m_sizer_body{ nullptr }; wxBoxSizer* sizer_machine_list{ nullptr }; std::map m_device_items; int m_selected_count{0}; diff --git a/src/slic3r/GUI/MultiTaskManagerPage.cpp b/src/slic3r/GUI/MultiTaskManagerPage.cpp index be146c751a..c20479a4a8 100644 --- a/src/slic3r/GUI/MultiTaskManagerPage.cpp +++ b/src/slic3r/GUI/MultiTaskManagerPage.cpp @@ -784,7 +784,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) { @@ -1403,7 +1403,10 @@ void CloudTaskManagerPage::start_timer() m_flipping_timer->SetOwner(this); m_flipping_timer->Start(1000); - wxPostEvent(this, wxTimerEvent()); + // Immediate update instead of posting deprecated wxTimerEvent + m_flipping_timer->Stop(); + enable_buttons(true); + update_page_number(); } void CloudTaskManagerPage::on_timer(wxTimerEvent& event) diff --git a/src/slic3r/GUI/MultiTaskManagerPage.hpp b/src/slic3r/GUI/MultiTaskManagerPage.hpp index 0f676d06b3..f1b35ca2aa 100644 --- a/src/slic3r/GUI/MultiTaskManagerPage.hpp +++ b/src/slic3r/GUI/MultiTaskManagerPage.hpp @@ -99,7 +99,6 @@ class LocalTaskManagerPage : public wxPanel wxBoxSizer* page_sizer{ nullptr }; wxBoxSizer* m_sizer_task_list{ nullptr }; wxScrolledWindow* m_task_list{ nullptr }; - wxStaticText* m_selected_num{ nullptr }; // table head wxPanel* m_table_head_panel{ nullptr }; @@ -113,7 +112,6 @@ class LocalTaskManagerPage : public wxPanel Button* m_action{ nullptr }; // ctrl button for all - int m_sel_number{0}; wxPanel* m_ctrl_btn_panel{ nullptr }; wxBoxSizer* m_btn_sizer{ nullptr }; Button* btn_stop_all{ nullptr }; @@ -160,15 +158,12 @@ class CloudTaskManagerPage : public wxPanel wxBoxSizer* m_sizer_task_list{ nullptr }; wxBoxSizer* m_main_sizer{ nullptr }; wxScrolledWindow* m_task_list{ nullptr }; - wxStaticText* m_selected_num{ nullptr }; // Flipping pages int m_current_page{ 0 }; int m_total_page{0}; int m_total_count{ 0 }; int m_count_page_item{ 10 }; - bool prev{ false }; - bool next{ false }; Button* btn_last_page{ nullptr }; Button* btn_next_page{ nullptr }; wxStaticText* st_page_number{ nullptr }; @@ -191,7 +186,6 @@ class CloudTaskManagerPage : public wxPanel Button* m_action{ nullptr }; // ctrl button for all - int m_sel_number; wxPanel* m_ctrl_btn_panel{ nullptr }; wxBoxSizer* m_btn_sizer{ nullptr }; Button* btn_pause_all{ nullptr }; diff --git a/src/slic3r/GUI/NetworkTestDialog.cpp b/src/slic3r/GUI/NetworkTestDialog.cpp index 69fa58afbb..7c4cff8b71 100644 --- a/src/slic3r/GUI/NetworkTestDialog.cpp +++ b/src/slic3r/GUI/NetworkTestDialog.cpp @@ -583,7 +583,7 @@ void NetworkTestDialog::start_test_bing() 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; @@ -636,7 +636,7 @@ void NetworkTestDialog::start_test_bambulab() int result = -1; http.header("accept", "application/json") .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; @@ -705,7 +705,7 @@ void NetworkTestDialog::start_test_oss() int result = -1; http.timeout_max(15) - .on_complete([this, &result](std::string body, unsigned status) { + .on_complete([&result](std::string body, unsigned status) { try { if (status == 200) { result = 0; @@ -752,7 +752,7 @@ void NetworkTestDialog::start_test_oss_upgrade() int result = -1; http.timeout_max(15) - .on_complete([this, &result](std::string body, unsigned status) { + .on_complete([&result](std::string body, unsigned status) { try { if (status == 200) { result = 0; @@ -901,7 +901,7 @@ void NetworkTestDialog::start_test_oss_download() if (cancel) result = -1; }) - .on_complete([this, tmp_path, target_file_path](std::string body, unsigned status) { + .on_complete([tmp_path, target_file_path](std::string body, unsigned status) { BOOST_LOG_TRIVIAL(info) << "[test_storage_download] completed"; bool cancel = false; fs::fstream file(tmp_path, std::ios::out | std::ios::binary | std::ios::trunc); @@ -1041,7 +1041,7 @@ void NetworkTestDialog:: start_test_plugin_download(){ if (cancel) result = -1; }) - .on_complete([this, tmp_path, target_file_path](std::string body, unsigned status) { + .on_complete([tmp_path, target_file_path](std::string body, unsigned status) { BOOST_LOG_TRIVIAL(info) << "[test_plugin_download] completed"; bool cancel = false; fs::fstream file(tmp_path, std::ios::out | std::ios::binary | std::ios::trunc); diff --git a/src/slic3r/GUI/Notebook.cpp b/src/slic3r/GUI/Notebook.cpp index a6bec54bec..9fca9b10bd 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/Notebook.hpp b/src/slic3r/GUI/Notebook.hpp index 7e6e94da3a..c523401063 100644 --- a/src/slic3r/GUI/Notebook.hpp +++ b/src/slic3r/GUI/Notebook.hpp @@ -44,6 +44,8 @@ class ButtonsListCtrl : public wxControl class Notebook: public wxBookCtrlBase { public: + using wxBookCtrlBase::AddPage; + Notebook(wxWindow * parent, wxWindowID winid = wxID_ANY, const wxPoint & pos = wxDefaultPosition, @@ -102,7 +104,7 @@ class Notebook: public wxBookCtrlBase // by this control) and show it immediately. bool ShowNewPage(wxWindow * page) { - return AddPage(page, wxString(), "", ""); + return AddPage(page, wxString(), std::string(""), std::string("")); } diff --git a/src/slic3r/GUI/OG_CustomCtrl.cpp b/src/slic3r/GUI/OG_CustomCtrl.cpp index 2a623e7235..fe90e2caeb 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 f174ec1bd9..fbfe4d4b4b 100644 --- a/src/slic3r/GUI/ObjColorDialog.cpp +++ b/src/slic3r/GUI/ObjColorDialog.cpp @@ -59,7 +59,7 @@ wxBoxSizer* ObjColorDialog::create_btn_sizer(long flags,bool exist_error) font.SetUnderlined(true); tips->SetFont(font); tips->SetForegroundColour(wxColour(0, 174, 100)); - tips->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { + tips->Bind(wxEVT_LEFT_DOWN, [](wxMouseEvent &e) { bool is_zh = wxGetApp().app_config->get("language") == "zh_CN"; if (is_zh) { wxLaunchDefaultBrowser("https://wiki.bambulab.com/zh/software/bambu-studio/import_obj"); @@ -167,8 +167,6 @@ ObjColorDialog::ObjColorDialog(wxWindow *parent, Slic3r::ObjDialogInOut &in_out, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE /* | wxRESIZE_BORDER*/) - , m_filament_ids(in_out.filament_ids) - , m_first_extruder_id(in_out.first_extruder_id) { std::string icon_path = (boost::format("%1%/images/BambuStudioTitle.ico") % Slic3r::resources_dir()).str(); SetIcon(wxIcon(Slic3r::encode_path(icon_path.c_str()), wxBITMAP_TYPE_ICO)); @@ -337,7 +335,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/ObjColorDialog.hpp b/src/slic3r/GUI/ObjColorDialog.hpp index bac3a80519..fb9814801e 100644 --- a/src/slic3r/GUI/ObjColorDialog.hpp +++ b/src/slic3r/GUI/ObjColorDialog.hpp @@ -94,7 +94,6 @@ class ObjColorPanel : public wxPanel std::vector m_cluster_map_filaments;//show middle int m_max_filament_index = 0; std::vector m_cluster_colours;//from_algo and show left - bool m_can_add_filament{true}; bool m_deal_thumbnail_flag{false}; std::vector m_new_add_colors; std::vector m_new_add_final_colors; @@ -123,8 +122,6 @@ class ObjColorDialog : public Slic3r::GUI::DPIDialog wxBoxSizer * m_main_sizer = nullptr; wxBoxSizer * m_buttons_sizer = nullptr; std::unordered_map m_button_list; - std::vector& m_filament_ids; - unsigned char & m_first_extruder_id; }; #endif // _WIPE_TOWER_DIALOG_H_ \ No newline at end of file diff --git a/src/slic3r/GUI/OpenGLManager.cpp b/src/slic3r/GUI/OpenGLManager.cpp index cefef7826f..7485f72e69 100644 --- a/src/slic3r/GUI/OpenGLManager.cpp +++ b/src/slic3r/GUI/OpenGLManager.cpp @@ -53,6 +53,11 @@ static uint8_t get_msaa_samples(Slic3r::GUI::EMSAAType msaa_type) { static GLenum get_pixel_format(Slic3r::GUI::EPixelFormat type) { switch (type) { + case Slic3r::GUI::EPixelFormat::Unknow: + case Slic3r::GUI::EPixelFormat::R: + case Slic3r::GUI::EPixelFormat::RG: + case Slic3r::GUI::EPixelFormat::RGB: + return GL_INVALID_ENUM; case Slic3r::GUI::EPixelFormat::RGBA: return GL_RGBA; case Slic3r::GUI::EPixelFormat::DepthComponent: @@ -69,6 +74,8 @@ static GLenum get_pixel_format(Slic3r::GUI::EPixelFormat type) { static GLenum get_pixel_data_type(Slic3r::GUI::EPixelDataType type) { switch (type) { + case Slic3r::GUI::EPixelDataType::Unknow: + return GL_INVALID_ENUM; case Slic3r::GUI::EPixelDataType::UByte: return GL_UNSIGNED_BYTE; case Slic3r::GUI::EPixelDataType::Byte: @@ -904,6 +911,8 @@ uint32_t OpenGLManager::get_pixel_format(EPixelFormat format) { switch (format) { + case EPixelFormat::Unknow: + return GL_INVALID_ENUM; case EPixelFormat::R: return GL_RED; case EPixelFormat::RG: @@ -927,6 +936,8 @@ uint32_t OpenGLManager::get_pixel_data_type(EPixelDataType type) { switch (type) { + case EPixelDataType::Unknow: + return GL_INVALID_ENUM; case EPixelDataType::UByte: return GL_UNSIGNED_BYTE; case EPixelDataType::Byte: diff --git a/src/slic3r/GUI/OptionsGroup.hpp b/src/slic3r/GUI/OptionsGroup.hpp index 576b199207..754c949b8b 100644 --- a/src/slic3r/GUI/OptionsGroup.hpp +++ b/src/slic3r/GUI/OptionsGroup.hpp @@ -185,7 +185,7 @@ class OptionsGroup { OptionsGroup(wxWindow *_parent, const wxString &title, const wxString &icon, bool is_tab_opt = false, column_t extra_clmn = nullptr); - ~OptionsGroup() { clear(true); } + virtual ~OptionsGroup() { clear(true); } wxGridSizer* get_grid_sizer() { return m_grid_sizer; } const std::vector& get_lines() { return m_lines; } diff --git a/src/slic3r/GUI/ParamsPanel.cpp b/src/slic3r/GUI/ParamsPanel.cpp index dc210acb90..ae8fdd1277 100644 --- a/src/slic3r/GUI/ParamsPanel.cpp +++ b/src/slic3r/GUI/ParamsPanel.cpp @@ -120,7 +120,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](wxCommandEvent &e) { m_show_again = m_show_again ? false : true; e.Skip(); }); @@ -298,11 +298,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/ParamsPanel.hpp b/src/slic3r/GUI/ParamsPanel.hpp index 4e286c270b..5d87143558 100644 --- a/src/slic3r/GUI/ParamsPanel.hpp +++ b/src/slic3r/GUI/ParamsPanel.hpp @@ -67,7 +67,6 @@ class ParamsPanel : public wxPanel { #if __WXOSX__ wxWindow* m_tmp_panel; - int m_size_move = -1; #endif // __WXOSX__ private: diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index 9b55d21527..dbd9a54f5a 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -430,7 +430,7 @@ void PartPlate::calc_height_limit() { int PartPlate::get_right_icon_offset_bed(int i) { - if (&wxGetApp() && wxGetApp().plater()) { + if (wxGetApp().plater()) { auto offset = wxGetApp().plater()->get_right_icon_offset_bed(i); if (i > 0 && offset == 0) { return 0; @@ -713,7 +713,7 @@ void PartPlate::show_tooltip(const std::string tooltip) { const auto scale = m_plater->get_current_canvas3D()->get_scale(); ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, {6 * scale, 3 * scale}); - ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, {3 * scale}); + ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 3 * scale); ImGui::PushStyleColor(ImGuiCol_PopupBg, ImGuiWrapper::COL_WINDOW_BACKGROUND); ImGui::PushStyleColor(ImGuiCol_Border, {0, 0, 0, 0}); ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.00f, 1.00f, 1.00f, 1.00f)); @@ -2673,8 +2673,7 @@ void PartPlate::generate_exclude_polygon(ExPolygon &exclude_polygon) { auto compute_exclude_points = [&exclude_polygon](Vec2d& center, double radius, double start_angle, double stop_angle, int count) { - double angle, angle_steps; - angle_steps = (stop_angle - start_angle) / (count - 1); + double angle_steps = (stop_angle - start_angle) / (count - 1); for(int j = 0; j < count; j++ ) { double angle = start_angle + j * angle_steps; @@ -2692,7 +2691,7 @@ void PartPlate::generate_exclude_polygon(ExPolygon &exclude_polygon) { const Vec2d& p = m_exclude_area[i]; Vec2d center; - double start_angle, stop_angle, angle_steps, radius_x, radius_y, radius; + double start_angle, stop_angle, radius; switch (i) { case 0: radius = 8.f; @@ -3585,7 +3584,7 @@ void PartPlateList::generate_print_polygon(ExPolygon &print_polygon) } }; bool use_rect_grid = false; - if (&wxGetApp() && wxGetApp().plater()) { + if (wxGetApp().plater()) { auto pm = wxGetApp().plater()->get_curr_printer_model(); use_rect_grid = (pm && pm->use_rect_grid == "true") ? true : false; } @@ -5464,7 +5463,7 @@ void PartPlateList::postprocess_bed_index_for_selected(arrangement::ArrangePolyg else { //judge whether it is at the left side of the plate border - if (arrange_polygon.bed_idx <= i) + if (arrange_polygon.bed_idx <= static_cast(i)) { BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(":found in plate_index %1%, bed_idx %2%") % i % arrange_polygon.bed_idx; return; @@ -5509,7 +5508,7 @@ void PartPlateList::postprocess_bed_index_for_unselected(arrangement::ArrangePol else { //judge whether it is at the left side of the plate border - if (arrange_polygon.bed_idx <= i) + if (arrange_polygon.bed_idx <= static_cast(i)) { BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(":found in plate_index %1%, bed_idx %2%") % i % arrange_polygon.bed_idx; return; diff --git a/src/slic3r/GUI/PartSkipDialog.hpp b/src/slic3r/GUI/PartSkipDialog.hpp index 4f0b5bf07f..8871211b54 100644 --- a/src/slic3r/GUI/PartSkipDialog.hpp +++ b/src/slic3r/GUI/PartSkipDialog.hpp @@ -128,7 +128,6 @@ class PartSkipDialog : public DPIDialog bool is_drag_mode(); boost::shared_ptr m_file_sys; - bool m_file_sys_result{false}; std::string m_timestamp; std::string m_tmp_path; std::vector m_local_paths; diff --git a/src/slic3r/GUI/PhysicalPrinterDialog.hpp b/src/slic3r/GUI/PhysicalPrinterDialog.hpp index bb93811775..6c5960397a 100644 --- a/src/slic3r/GUI/PhysicalPrinterDialog.hpp +++ b/src/slic3r/GUI/PhysicalPrinterDialog.hpp @@ -33,7 +33,6 @@ class PhysicalPrinterDialog : public DPIDialog ScalableButton* m_printhost_browse_btn {nullptr}; ScalableButton* m_printhost_test_btn {nullptr}; ScalableButton* m_printhost_cafile_browse_btn {nullptr}; - ScalableButton* m_printhost_client_cert_browse_btn {nullptr}; ScalableButton* m_printhost_port_browse_btn {nullptr}; RoundedRectangle* m_input_area {nullptr}; diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index c2885b26ef..7e691e8f06 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -225,6 +225,15 @@ wxDEFINE_EVENT(EVT_HELIO_INPUT_DLG, SimpleEvent); #define PRINTER_PANEL_SIZE (wxSize(FromDIP(96), FromDIP(68))) #define BTN_SYNC_SIZE (wxSize(FromDIP(96), FromDIP(98))) +// File-scope constant for download retry limit +// Defined here instead of function-scope to avoid lambda capture issues: +// - MSVC requires explicit capture of const variables in lambdas (C3493 error) +// - Clang warns about unnecessary capture of const variables (unused-lambda-capture) +// File-scope constant resolves both issues without platform-specific code +namespace { + constexpr int MAX_DOWNLOAD_RETRIES = 3; +} + static string get_diameter_string(float diameter) { std::ostringstream stream; @@ -682,7 +691,7 @@ void Sidebar::priv::layout_printer(bool isBBL, bool isDual) hsizer_printer_btn->AddStretchSpacer(1); hsizer_printer_btn->Add(btn_edit_printer, 0); hsizer_printer_btn->Add(btn_connect_printer, 0, wxALIGN_CENTER | wxLEFT, FromDIP(4)); - combo_printer->SetWindowStyle(combo_printer->GetWindowStyle() & ~wxALIGN_MASK | (isBBL ? wxALIGN_CENTER_HORIZONTAL : wxALIGN_RIGHT)); + combo_printer->SetWindowStyle((combo_printer->GetWindowStyle() & ~wxALIGN_MASK) | (isBBL ? wxALIGN_CENTER_HORIZONTAL : wxALIGN_RIGHT)); if (isBBL) { wxBoxSizer *vsizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer *hsizer = new wxBoxSizer(wxHORIZONTAL); @@ -1175,7 +1184,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); @@ -1236,7 +1245,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(); @@ -1244,7 +1253,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(); @@ -1517,7 +1526,7 @@ bool Sidebar::priv::sync_extruder_list(bool &only_external_material) 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); }); @@ -1837,7 +1846,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); - 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); }); @@ -1917,14 +1926,14 @@ Sidebar::Sidebar(Plater *parent) }); PlaterPresetComboBox *combo_printer = new PlaterPresetComboBox(p->panel_printer_preset, Preset::TYPE_PRINTER); - combo_printer->SetWindowStyle(combo_printer->GetWindowStyle() & ~wxALIGN_MASK | wxALIGN_CENTER_HORIZONTAL); + combo_printer->SetWindowStyle((combo_printer->GetWindowStyle() & ~wxALIGN_MASK) | wxALIGN_CENTER_HORIZONTAL); combo_printer->SetBorderWidth(0); p->combo_printer = combo_printer; p->btn_connect_printer = new ScalableButton(p->panel_printer_preset, wxID_ANY, "monitor_signal_strong"); p->btn_connect_printer->SetBackgroundColour(wxColour(255, 255, 255)); p->btn_connect_printer->SetToolTip(_L("Connection")); - p->btn_connect_printer->Bind(wxEVT_BUTTON, [this, combo_printer](wxCommandEvent) + p->btn_connect_printer->Bind(wxEVT_BUTTON, [this](wxCommandEvent) { PhysicalPrinterDialog dlg(this->GetParent()); dlg.ShowModal(); @@ -1949,7 +1958,7 @@ Sidebar::Sidebar(Plater *parent) ScalableButton *wiki_bed = new ScalableButton(p->panel_printer_bed, wxID_ANY, "help"); wiki_bed->SetToolTip(_L("Click to view the wiki of the current plate type")); - wiki_bed->Bind(wxEVT_BUTTON, [this](wxCommandEvent) { + wiki_bed->Bind(wxEVT_BUTTON, [](wxCommandEvent) { bool is_zh = wxGetApp().app_config->get("language") == "zh_CN"; if (is_zh) { wxLaunchDefaultBrowser("https://wiki.bambulab.com/zh/filament-acc/acc/plates"); @@ -2059,11 +2068,11 @@ Sidebar::Sidebar(Plater *parent) p->right_extruder = new ExtruderGroup(p->m_panel_printer_content, 1, _L("Right Nozzle")); p->single_extruder = new ExtruderGroup(p->m_panel_printer_content, -1, _L("Nozzle")); - p->left_extruder->SetOnHoverClick([this, parent]() { + p->left_extruder->SetOnHoverClick([]() { GUI::manuallySetNozzleCount(0); wxGetApp().plater()->update(); }); - p->right_extruder->SetOnHoverClick([this, parent]() { + p->right_extruder->SetOnHoverClick([]() { GUI::manuallySetNozzleCount(1); wxGetApp().plater()->update(); }); @@ -2158,7 +2167,7 @@ Sidebar::Sidebar(Plater *parent) p->m_purge_mode_btn->SetFocus(); p->m_purge_mode_btn->Rescale(); - p->m_purge_mode_btn->Bind(wxEVT_BUTTON, ([parent, this](wxCommandEvent &e) { + p->m_purge_mode_btn->Bind(wxEVT_BUTTON, ([](wxCommandEvent &e) { auto &preset_bundle = *wxGetApp().preset_bundle; PurgeModeDialog dlg(static_cast(wxGetApp().mainframe)); @@ -2213,7 +2222,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(); }); p->m_bpButton_add_filament = add_btn; @@ -2223,7 +2232,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(); }); p->m_bpButton_del_filament = del_btn; @@ -2234,7 +2243,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, 18); 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(); }); @@ -2318,7 +2327,7 @@ Sidebar::Sidebar(Plater *parent) wxPoint pos = this->p->m_search_bar->ClientToScreen(wxPoint(0, 0)); pos.y += this->p->m_search_bar->GetRect().height; p->dia->SetPosition(pos); - p->dia->Popup(); + p->dia->Popup(wxDefaultPosition); }); p->m_search_bar->Bind(wxEVT_COMMAND_TEXT_UPDATED, [this](wxCommandEvent&) { this->p->on_search_update(); @@ -2707,7 +2716,7 @@ void Sidebar::update_presets(Preset::Type preset_type) int select = -1; for (size_t i = 0; i < nozzle_volumes_def->enum_labels.size(); ++i) { if (boost::algorithm::contains(extruder_variants->values[index], type + " " + nozzle_volumes_def->enum_labels[i]) || - extruder_max_nozzle_count->values[index] > 1 && nozzle_volumes_def->enum_keys_map->at(nozzle_volumes_def->enum_values[i]) == nvtHybrid) { + (extruder_max_nozzle_count->values[index] > 1 && nozzle_volumes_def->enum_keys_map->at(nozzle_volumes_def->enum_values[i]) == nvtHybrid)) { if (diameter == "0.2" && nozzle_volumes_def->enum_keys_map->at(nozzle_volumes_def->enum_values[i]) == NozzleVolumeType::nvtHighFlow) continue; if (nozzle_volumes->values[index] == i) @@ -2913,7 +2922,7 @@ bool Sidebar::reset_bed_type_combox_choices(bool is_sidebar_init) } } m_last_combo_bedtype_count = p->combo_printer_bed->GetCount(); - if (!is_sidebar_init && &p->plater->get_partplate_list()) { + if (!is_sidebar_init) { p->plater->get_partplate_list().check_all_plate_local_bed_type(m_cur_combox_bed_types); } return true; @@ -3569,7 +3578,7 @@ void Sidebar::sync_ams_list(bool is_from_big_sync_btn) // BBS:Record consumables information before synchronization std::vector color_before_sync; - std::vector is_support_before; + std::vector is_support_before; DynamicPrintConfig& project_config = wxGetApp().preset_bundle->project_config; ConfigOptionStrings* color_opt = project_config.option("filament_colour"); for (int i = 0; i < p->combos_filament.size(); ++i) { @@ -5018,7 +5027,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()); } e.Skip(); }); @@ -5974,7 +5983,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; @@ -6497,7 +6506,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, &makerlab_region, &makerlab_name, &makerlab_id](ObjDialogInOut &in_out) { + auto obj_color_fun = [&path, &makerlab_region, &makerlab_name, &makerlab_id](ObjDialogInOut &in_out) { makerlab_region = in_out.ml_region; makerlab_name = in_out.ml_name; @@ -6518,7 +6527,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; @@ -6533,7 +6542,7 @@ std::vector Plater::priv::load_files(const std::vector& input_ Slic3r::GUI::show_info(nullptr, _L("Name of components inside step file is not UTF8 format!") + "\n\n" + _L("The name may show garbage characters!"), _L("Attention!")); }, - [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) { @@ -6557,7 +6566,7 @@ std::vector Plater::priv::load_files(const std::vector& input_ } 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, &makerlab_region, &makerlab_name, &makerlab_id](int current, int total, bool &cancel, + [&dlg, real_filename, &progress_percent, INPUT_FILES_RATIO, total_files, i, &designer_model_id, &designer_country_code, &makerlab_region, &makerlab_name, &makerlab_id](int current, int total, bool &cancel, std::string &mode_id, std::string &code, std::string &ml_region, std::string &ml_name, std::string &ml_id) { designer_model_id = mode_id; @@ -8180,7 +8189,7 @@ bool Plater::priv::replace_volume_with_stl(int object_idx, int volume_idx, const Slic3r::GUI::show_info(nullptr, _L("Name of components inside step file is not UTF8 format!") + "\n\n" + _L("The name may show garbage characters!"), _L("Attention!")); }, - [this, &path, &linear, &angle, &split_compound](Slic3r::Step& file, double& linear_value, double& angle_value, bool& is_split)-> int { + [&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) { @@ -8507,7 +8516,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); @@ -9348,7 +9357,7 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt) for (auto const& warning : state.warnings) { if (warning.current) { NotificationManager::NotificationLevel notif_level = NotificationManager::NotificationLevel::WarningNotificationLevel; - if (evt.status.message_type == PrintStateBase::SlicingNotificationType::SlicingReplaceInitEmptyLayers | PrintStateBase::SlicingNotificationType::SlicingEmptyGcodeLayers) { + if (evt.status.message_type == (PrintStateBase::SlicingNotificationType::SlicingReplaceInitEmptyLayers | PrintStateBase::SlicingNotificationType::SlicingEmptyGcodeLayers)) { notif_level = NotificationManager::NotificationLevel::SeriousWarningNotificationLevel; } notification_manager->push_slicing_warning_notification(warning.message, false, model_object, object_id, warning_step, warning.message_id, notif_level); @@ -9890,7 +9899,7 @@ void Plater::priv::on_helio_processing_complete(HelioCompletionEvent &a) /*time improvement */ float time_origin_value; - float time_optimized_value; + float time_optimized_value = 0; auto aprint_stats = wxGetApp().plater()->get_partplate_list().get_current_fff_print().print_statistics(); PartPlate* plate = wxGetApp().plater()->get_partplate_list().get_curr_plate(); if (plate) { @@ -9918,8 +9927,8 @@ void Plater::priv::on_helio_processing_complete(HelioCompletionEvent &a) wxString time1; PartPlate* plate1 = wxGetApp().plater()->get_partplate_list().get_curr_plate(); if (plate1) { - if (plate->get_slice_result()) { - time_optimized_value = plate->get_slice_result()->print_statistics.modes[0].time; + if (plate1->get_slice_result()) { + time_optimized_value = plate1->get_slice_result()->print_statistics.modes[0].time; //time_optimized = wxString::Format("%s", short_time(get_time_dhms(plate->get_slice_result()->print_statistics.modes[0].time))); } } @@ -9966,7 +9975,7 @@ void Plater::priv::on_helio_process() if (!valid) { continue; } helio_background_process.set_simulation_input_data(data); - helio_background_process.init(helio_api_key, helio_api_url, printer_id, material_id, g_result, preview, [this]() {}); + helio_background_process.init(helio_api_key, helio_api_url, printer_id, material_id, g_result, preview, []() {}); helio_background_process.helio_thread_start(background_process.m_mutex, background_process.m_condition, background_process.m_state, notification_manager); BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << ":helio simulation process called"; @@ -9984,7 +9993,7 @@ void Plater::priv::on_helio_process() if (!valid) { continue; } helio_background_process.set_optimization_input_data(data); - helio_background_process.init(helio_api_key, helio_api_url, printer_id, material_id, g_result, preview, [this]() {}); + helio_background_process.init(helio_api_key, helio_api_url, printer_id, material_id, g_result, preview, []() {}); helio_background_process.helio_thread_start(background_process.m_mutex, background_process.m_condition, background_process.m_state, notification_manager); BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << ":helio optimization process called"; @@ -10011,7 +10020,7 @@ void Plater::priv::on_helio_input_dlg(SimpleEvent &a) dlg.SetButtonLabel(wxID_YES, _L("Regenerate PAT")); auto result = dlg.ShowModal(); if (result == wxID_YES) { - wxGetApp().request_helio_pat([this](std::string pat) { + wxGetApp().request_helio_pat([](std::string pat) { wxTheApp->CallAfter([=]() { if (pat == "not_enough") { HelioPatNotEnoughDialog dlg; @@ -12601,7 +12610,7 @@ int Plater::load_project(wxString const &filename2, // if res is empty no data has been loaded if (!res.empty() && (load_restore || !(strategy & LoadStrategy::Silence))) { - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " call set_project_filename: " << load_restore ? originfile : filename; + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " call set_project_filename: " << (load_restore ? originfile : filename); p->set_project_filename(load_restore ? originfile : filename); if (load_restore && originfile.IsEmpty()) { p->set_project_name(_L("Untitled")); @@ -12745,7 +12754,6 @@ void Plater::import_model_id(wxString download_info) bool download_ok = false; int retry_count = 0; - const int max_retries = 3; /* jump to 3D eidtor */ wxGetApp().mainframe->select_tab((size_t)MainFrame::TabPosition::tp3DEditor); @@ -12773,7 +12781,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] { NetworkAgent* m_agent = Slic3r::GUI::wxGetApp().getAgent(); if (!m_agent) return; @@ -12853,7 +12861,7 @@ void Plater::import_model_id(wxString download_info) bool size_limit = false; auto http = Http::get(download_url.ToStdString()); - while (cont && retry_count < max_retries) { + while (cont && retry_count < MAX_DOWNLOAD_RETRIES) { retry_count++; http.on_progress([&percent, &cont, &msg, &filesize, &size_limit](Http::Progress progress, bool& cancel) { @@ -12879,14 +12887,14 @@ 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, http_status, error); - if (retry_count == max_retries) { + if (retry_count == MAX_DOWNLOAD_RETRIES) { msg = _L("Importing to Bambu Studio failed. Please download the file and manually import it."); cont = false; } @@ -13114,20 +13122,20 @@ void Plater::_calib_pa_pattern(const Calib_Params ¶ms) DynamicPrintConfig & print_config = wxGetApp().preset_bundle->prints.get_edited_preset().config; float nozzle_diameter = printer_config.option("nozzle_diameter")->get_at(0); - for (const auto opt : SuggestedConfigCalibPAPattern().float_pairs) { + for (const auto& opt : SuggestedConfigCalibPAPattern().float_pairs) { print_config.set_key_value(opt.first, new ConfigOptionFloat(opt.second)); } - for (const auto opt : SuggestedConfigCalibPAPattern().floats_pairs) { + for (const auto& opt : SuggestedConfigCalibPAPattern().floats_pairs) { set_config_values(&print_config, opt.first, opt.second[0]); } update_speed_parameter("outer_wall_speed"); - for (const auto opt : SuggestedConfigCalibPAPattern().nozzle_ratio_pairs) { + for (const auto& opt : SuggestedConfigCalibPAPattern().nozzle_ratio_pairs) { print_config.set_key_value(opt.first, new ConfigOptionFloat(nozzle_diameter * opt.second / 100)); } - for (const auto opt : SuggestedConfigCalibPAPattern().int_pairs) { + for (const auto& opt : SuggestedConfigCalibPAPattern().int_pairs) { print_config.set_key_value(opt.first, new ConfigOptionInt(opt.second)); } @@ -14083,7 +14091,7 @@ wxBoxSizer *ProjectDropDialog::create_item_checkbox(wxString title, wxWindow *pa m_show_again = wxGetApp().app_config->get(param) == "true" ? true : false; checkbox->SetValue(m_show_again); - checkbox->Bind(wxEVT_TOGGLEBUTTON, [this, checkbox, param](wxCommandEvent &e) { + checkbox->Bind(wxEVT_TOGGLEBUTTON, [this](wxCommandEvent &e) { m_show_again = m_show_again ? false : true; e.Skip(); }); @@ -15333,7 +15341,7 @@ bool Plater::check_printer_initialized(MachineObject *obj, bool only_warning, bo break; } } - if (extruder.GetNozzleFlowType() == NozzleType::ntUndefine) { + if (static_cast(extruder.GetNozzleFlowType()) == NozzleType::ntUndefine) { has_been_initialized = false; break; } @@ -18549,9 +18557,7 @@ void Plater::show_object_info() t = model_object->instances[inst_idx]->get_matrix() * vol->get_matrix(); info_text += (boost::format(_utf8(L("Part name: %1%\n"))) % vol->name).str(); face_count = static_cast(vol->mesh().facets_count()); - if (&vol->get_convex_hull()) { - size = vol->get_convex_hull().transformed_bounding_box(t).size(); - } + size = vol->get_convex_hull().transformed_bounding_box(t).size(); } else { //int obj_idx, vol_idx; diff --git a/src/slic3r/GUI/PrePrintChecker.cpp b/src/slic3r/GUI/PrePrintChecker.cpp index c957ab0de9..06567652db 100644 --- a/src/slic3r/GUI/PrePrintChecker.cpp +++ b/src/slic3r/GUI/PrePrintChecker.cpp @@ -108,8 +108,9 @@ wxString PrePrintChecker::get_pre_state_msg(PrintDialogStatus status) case PrintStatusColorQuantityExceed: return _L("The current firmware supports a maximum of 16 materials. You can either reduce the number of materials to 16 or fewer on the Preparation Page, or try updating the firmware. If you are still restricted after the update, please wait for subsequent firmware support."); case PrintStatusFilamentWarningHighChamberTempCloseDoor: return _L("High chamber temperature is required. Please close the door."); case PrintStatusHasUnreliableNozzleWarning: return _L("Please check if the required nozzle diameter and flow rate match the current display."); + default: + return wxEmptyString; } - return wxEmptyString; } void PrePrintChecker::clear() @@ -333,7 +334,7 @@ void PrinterMsgPanel::AppendStyles(const prePrintInfo& info) if (info.testStyle(prePrintInfoStyle::BtnInstallFanF000)) { auto btn = s_create_btn_label(this, _L("How to install")); - btn->Bind(wxEVT_LEFT_DOWN, [this, info](auto& e) { + btn->Bind(wxEVT_LEFT_DOWN, [](auto& e) { wxLaunchDefaultBrowser("https://e.bambulab.com/t?c=l3T7caKGeNt3omA9"); }); diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index e845d8f923..8e2bde1e3c 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -249,7 +249,7 @@ wxBoxSizer *PreferencesDialog::create_item_language_combobox( } } - auto check = [this](bool yes_or_no) { + auto check = [](bool yes_or_no) { // if (yes_or_no) // return true; int act_btns = UnsavedChangesDialog::ActionButtons::SAVE; @@ -532,13 +532,13 @@ wxBoxSizer *PreferencesDialog::create_item_range_input( } input->GetTextCtrl()->SetValue(str); }; - input->GetTextCtrl()->Bind(wxEVT_TEXT_ENTER, [this, set_value_to_app, input](wxCommandEvent &e) { + input->GetTextCtrl()->Bind(wxEVT_TEXT_ENTER, [set_value_to_app, input](wxCommandEvent &e) { auto value = std::atof(input->GetTextCtrl()->GetValue().c_str()); set_value_to_app(value,true); e.Skip(); }); - input->GetTextCtrl()->Bind(wxEVT_KILL_FOCUS, [this, set_value_to_app, input](wxFocusEvent &e) { + input->GetTextCtrl()->Bind(wxEVT_KILL_FOCUS, [set_value_to_app, input](wxFocusEvent &e) { auto value = std::atof(input->GetTextCtrl()->GetValue().c_str()); set_value_to_app(value, true); e.Skip(); @@ -634,7 +634,7 @@ wxBoxSizer *PreferencesDialog::create_item_switch(wxString title, wxWindow *pare m_sizer_switch->Add( 0, 0, 0, wxEXPAND|wxLEFT, 40 ); //// save config - switchbox->Bind(wxEVT_TOGGLEBUTTON, [this, param](wxCommandEvent &e) { + switchbox->Bind(wxEVT_TOGGLEBUTTON, [](wxCommandEvent &e) { /* app_config->set(param, std::to_string(e.GetSelection())); app_config->save();*/ e.Skip(); @@ -942,7 +942,7 @@ wxBoxSizer *PreferencesDialog::create_item_button(wxString title, wxString title temp_button->SetToolTip(tooltip); - temp_button->Bind(wxEVT_BUTTON, [this, onclick](auto &e) { onclick(); }); + temp_button->Bind(wxEVT_BUTTON, [onclick](auto &e) { onclick(); }); m_sizer_checkbox->Add(m_staticTextPath, 0, wxALIGN_CENTER_VERTICAL | wxALL, FromDIP(5)); m_sizer_checkbox->Add(temp_button, 0, wxALL, FromDIP(5)); @@ -1032,7 +1032,7 @@ PreferencesDialog::PreferencesDialog(wxWindow *parent, wxWindowID id, const wxSt SetBackgroundColour(*wxWHITE); create(); wxGetApp().UpdateDlgDarkUI(this); - Bind(wxEVT_CLOSE_WINDOW, [this](wxCloseEvent& event) { + Bind(wxEVT_CLOSE_WINDOW, [](wxCloseEvent& event) { try { NetworkAgent* agent = GUI::wxGetApp().getAgent(); if (agent) { diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp index 91b303bcba..01fecc21ef 100644 --- a/src/slic3r/GUI/PresetComboBoxes.cpp +++ b/src/slic3r/GUI/PresetComboBoxes.cpp @@ -1503,7 +1503,7 @@ void TabPresetComboBox::OnSelect(wxCommandEvent &evt) default: break; } if (sp != ConfigWizard::SP_WELCOME) { - wxTheApp->CallAfter([this, sp]() { + wxTheApp->CallAfter([sp]() { run_wizard(sp); }); } @@ -1749,7 +1749,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/PrintOptionsDialog.cpp b/src/slic3r/GUI/PrintOptionsDialog.cpp index 3da19ae861..9e82592785 100644 --- a/src/slic3r/GUI/PrintOptionsDialog.cpp +++ b/src/slic3r/GUI/PrintOptionsDialog.cpp @@ -596,7 +596,7 @@ void PrintOptionsDialog::UpdateOptionOpenDoorCheck(MachineObject *obj) if (obj->get_door_open_check_state() != MachineObject::DOOR_OPEN_CHECK_DISABLE) { m_cb_open_door->SetValue(true); - open_door_switch_board->Enable(); + open_door_switch_board->Enable(true); if (obj->get_door_open_check_state() == MachineObject::DOOR_OPEN_CHECK_ENABLE_WARNING) { open_door_switch_board->updateState("left"); diff --git a/src/slic3r/GUI/Printer/PrinterFileSystem.cpp b/src/slic3r/GUI/Printer/PrinterFileSystem.cpp index 1b1ccf87c4..23b1a00618 100644 --- a/src/slic3r/GUI/Printer/PrinterFileSystem.cpp +++ b/src/slic3r/GUI/Printer/PrinterFileSystem.cpp @@ -168,7 +168,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"]; @@ -664,10 +664,10 @@ PrinterFileSystem::File const &PrinterFileSystem::GetFile(size_t index, bool &se void PrinterFileSystem::Attached() { boost::unique_lock lock(m_mutex); - m_recv_thread = std::move(boost::thread([w = weak_from_this()] { + m_recv_thread = boost::thread([w = weak_from_this()] { boost::shared_ptr s = w.lock(); if (s) s->RecvMessageThread(); - })); + }); } void PrinterFileSystem::Start() @@ -1233,7 +1233,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 c04896236d..b251fe2029 100644 --- a/src/slic3r/GUI/PrivacyUpdateDialog.cpp +++ b/src/slic3r/GUI/PrivacyUpdateDialog.cpp @@ -116,7 +116,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/Project.cpp b/src/slic3r/GUI/Project.cpp index c743c94768..89a5f9c5a0 100644 --- a/src/slic3r/GUI/Project.cpp +++ b/src/slic3r/GUI/Project.cpp @@ -255,7 +255,7 @@ std::string ProjectPanel::get_model_id(std::string desgin_id) Http http = Http::get(host); http.header("accept", "application/json") //.header("Authorization") - .on_complete([this, &model_id](std::string body, unsigned status) { + .on_complete([&model_id](std::string body, unsigned status) { try { json j = json::parse(body); if (j.contains("id")) { @@ -269,7 +269,7 @@ std::string ProjectPanel::get_model_id(std::string desgin_id) ; } }) - .on_error([this](std::string body, std::string error, unsigned status) { + .on_error([](std::string body, std::string error, unsigned status) { }) .perform_sync(); @@ -639,7 +639,7 @@ void ProjectPanel::OnScriptMessage(wxWebViewEvent& evt) if (!fs::exists(src_path)) throw std::runtime_error("attachment not found: " + decoded_filepath); boost::system::error_code ec; - fs::copy_file(src_path, dest_file, fs::copy_option::overwrite_if_exists, ec); + fs::copy_file(src_path, dest_file, fs::copy_options::overwrite_existing, ec); if (ec) throw std::runtime_error("copy attachment failed: " + ec.message()); } diff --git a/src/slic3r/GUI/Project.hpp b/src/slic3r/GUI/Project.hpp index 5dda8e6915..bb6a2b20ed 100644 --- a/src/slic3r/GUI/Project.hpp +++ b/src/slic3r/GUI/Project.hpp @@ -60,7 +60,6 @@ class ProjectPanel : public wxPanel { private: bool m_web_init_completed = {false}; - bool m_reload_already = {false}; wxWebView* m_browser = {nullptr}; wxString m_project_home_url; diff --git a/src/slic3r/GUI/RecenterDialog.hpp b/src/slic3r/GUI/RecenterDialog.hpp index 9351682704..6063e47da9 100644 --- a/src/slic3r/GUI/RecenterDialog.hpp +++ b/src/slic3r/GUI/RecenterDialog.hpp @@ -10,10 +10,8 @@ namespace Slic3r { namespace GUI { class RecenterDialog : public DPIDialog { private: - wxStaticText* m_staticText_hint; Button* m_button_confirm; Button* m_button_close; - wxStaticBitmap* m_bitmap_home; ScalableBitmap m_home_bmp; wxString hint1; wxString hint2; diff --git a/src/slic3r/GUI/ReleaseNote.cpp b/src/slic3r/GUI/ReleaseNote.cpp index d5cce903c1..624e5bf948 100644 --- a/src/slic3r/GUI/ReleaseNote.cpp +++ b/src/slic3r/GUI/ReleaseNote.cpp @@ -234,7 +234,7 @@ void UpdatePluginDialog::update_info(std::string json_path) description_str = j["description"]; } catch (nlohmann::detail::parse_error& err) { - //BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": parse " << json_path << " got a nlohmann::detail::parse_error, reason = " << err.what(); + BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": parse " << json_path << " got a nlohmann::detail::parse_error, reason = " << err.what(); return; } @@ -1331,7 +1331,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); }); } @@ -1495,7 +1495,7 @@ InputIpAddressDialog::InputIpAddressDialog(wxWindow *parent) wiki->SetForegroundColour(wxColour(0, 174, 66)); wiki->Bind(wxEVT_ENTER_WINDOW, [this](auto &e) {SetCursor(wxCURSOR_HAND);}); wiki->Bind(wxEVT_LEAVE_WINDOW, [this](auto &e) {SetCursor(wxCURSOR_ARROW);}); - wiki->Bind(wxEVT_LEFT_DOWN, [this](auto &e) { + wiki->Bind(wxEVT_LEFT_DOWN, [](auto &e) { wxString url; if (wxGetApp().app_config->get("region") =="China") { url = "https://wiki.bambulab.com/zh/software/bambu-studio/failed-to-send-print-files"; @@ -2160,7 +2160,7 @@ void InputIpAddressDialog::on_text(wxCommandEvent &evt) bool invalid_access_code = true; for (char c : str_access_code) { - if (!('0' <= c && c <= '9' || 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z')) { + if (!(('0' <= c && c <= '9') || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'))) { invalid_access_code = false; return; } diff --git a/src/slic3r/GUI/SafetyOptionsDialog.cpp b/src/slic3r/GUI/SafetyOptionsDialog.cpp index ab204bea8e..d891cb54a1 100644 --- a/src/slic3r/GUI/SafetyOptionsDialog.cpp +++ b/src/slic3r/GUI/SafetyOptionsDialog.cpp @@ -135,7 +135,7 @@ void SafetyOptionsDialog::updateOpenDoorCheck(MachineObject *obj) { if (obj->get_door_open_check_state() != MachineObject::DOOR_OPEN_CHECK_DISABLE) { m_cb_open_door->SetValue(true); - m_open_door_switch_board->Enable(); + m_open_door_switch_board->Enable(true); if (obj->get_door_open_check_state() == MachineObject::DOOR_OPEN_CHECK_ENABLE_WARNING) { m_open_door_switch_board->updateState("left"); diff --git a/src/slic3r/GUI/SavePresetDialog.cpp b/src/slic3r/GUI/SavePresetDialog.cpp index 26310e3c78..83bd370202 100644 --- a/src/slic3r/GUI/SavePresetDialog.cpp +++ b/src/slic3r/GUI/SavePresetDialog.cpp @@ -255,8 +255,8 @@ void SavePresetDialog::Item::update() m_radio_project->Disable(); } else { if (m_valid_type != NoValid) { - m_radio_user->Enable(); - m_radio_project->Enable(); + m_radio_user->Enable(true); + m_radio_project->Enable(true); } else { m_radio_user->Disable(); m_radio_project->Disable(); diff --git a/src/slic3r/GUI/Search.cpp b/src/slic3r/GUI/Search.cpp index 751244b93a..98fce50ae5 100644 --- a/src/slic3r/GUI/Search.cpp +++ b/src/slic3r/GUI/Search.cpp @@ -408,7 +408,7 @@ void OptionsSearcher::show_dialog(Preset::Type type, wxWindow *parent, TextInput input->GetParent()->Hide(); #endif search_dialog->SetPosition(pos); - search_dialog->Popup(); + search_dialog->Popup(wxDefaultPosition); } void OptionsSearcher::dlg_sys_color_changed() @@ -628,7 +628,7 @@ SearchDialog::SearchDialog(OptionsSearcher *searcher, Preset::Type type, wxWindo m_scrolledWindow = new ScrolledWindow(m_client_panel, wxID_ANY, wxDefaultPosition, wxSize(m_pop_width - (em + em / 2), POPUP_HEIGHT * em), wxVSCROLL, 6, 6); m_scrolledWindow->SetMarginColor(m_bg_colour); m_scrolledWindow->SetScrollbarColor(m_thumb_color); - m_scrolledWindow->SetBackgroundColour(m_bg_colour); + m_scrolledWindow->wxScrolled::SetBackgroundColour(m_bg_colour); auto m_listsizer = new wxBoxSizer(wxVERTICAL); auto m_listPanel = new wxWindow(m_scrolledWindow->GetPanel(), -1); @@ -797,7 +797,7 @@ void SearchDialog::update_list() m_scrolledWindow = new ScrolledWindow(m_client_panel, wxID_ANY, wxDefaultPosition, wxSize(m_pop_width - (em + em / 2), POPUP_HEIGHT * em - em), wxVSCROLL, 6, 6); m_scrolledWindow->SetMarginColor(StateColor::darkModeColorFor(m_bg_colour)); m_scrolledWindow->SetScrollbarColor(StateColor::darkModeColorFor(m_thumb_color)); - m_scrolledWindow->SetBackgroundColour(StateColor::darkModeColorFor(m_bg_colour)); + m_scrolledWindow->wxScrolled::SetBackgroundColour(StateColor::darkModeColorFor(m_bg_colour)); auto m_listsizer = new wxBoxSizer(wxVERTICAL); auto m_listPanel = new wxWindow(m_scrolledWindow->GetPanel(), -1); @@ -974,7 +974,7 @@ SearchObjectDialog::SearchObjectDialog(GUI::ObjectList* object_list, wxWindow* p m_scrolledWindow = new ScrolledWindow(m_client_panel, wxID_ANY, wxDefaultPosition, wxSize(POPUP_WIDTH * em - (em + em / 2), POPUP_HEIGHT * em), wxVSCROLL, 6, 6); m_scrolledWindow->SetMarginColor(m_bg_color); m_scrolledWindow->SetScrollbarColor(m_thumb_color); - m_scrolledWindow->SetBackgroundColour(m_bg_color); + m_scrolledWindow->wxScrolled::SetBackgroundColour(m_bg_color); auto m_listsizer = new wxBoxSizer(wxVERTICAL); auto m_listPanel = new wxWindow(m_scrolledWindow->GetPanel(), -1); m_listPanel->SetBackgroundColour(m_bg_color); @@ -1028,7 +1028,7 @@ void SearchObjectDialog::update_list() m_scrolledWindow = new ScrolledWindow(m_client_panel, wxID_ANY, wxDefaultPosition, wxSize(POPUP_WIDTH * em - (em + em / 2), POPUP_HEIGHT * em - em), wxVSCROLL, 6, 6); m_scrolledWindow->SetMarginColor(StateColor::darkModeColorFor(m_bg_color)); m_scrolledWindow->SetScrollbarColor(StateColor::darkModeColorFor(m_thumb_color)); - m_scrolledWindow->SetBackgroundColour(StateColor::darkModeColorFor(m_bg_color)); + m_scrolledWindow->wxScrolled::SetBackgroundColour(StateColor::darkModeColorFor(m_bg_color)); auto m_listsizer = new wxBoxSizer(wxVERTICAL); auto m_listPanel = new wxWindow(m_scrolledWindow->GetPanel(), -1); diff --git a/src/slic3r/GUI/Search.hpp b/src/slic3r/GUI/Search.hpp index 44f7224780..f5e98d66a4 100644 --- a/src/slic3r/GUI/Search.hpp +++ b/src/slic3r/GUI/Search.hpp @@ -234,6 +234,8 @@ class SearchDialog : public PopupWindow void update_list(); public: + using PopupWindow::Popup; + SearchDialog(OptionsSearcher *searcher, Preset::Type type, wxWindow *parent, TextInput *input, wxWindow *search_btn); ~SearchDialog(); @@ -282,6 +284,8 @@ class SearchListModel : public wxDataViewVirtualListModel class SearchObjectDialog : public PopupWindow { public: + using PopupWindow::Popup; + SearchObjectDialog(GUI::ObjectList* object_list, wxWindow* parent); ~SearchObjectDialog(); diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index adfe66d675..9a9409b6cd 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -484,7 +484,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater) m_link_edit_nozzle->Bind(wxEVT_LEFT_DOWN, [this](auto &e) { - if (this && this->m_is_in_sending_mode) { + if (m_is_in_sending_mode) { return; } @@ -590,7 +590,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater) m_pa_value_tips = new ScalableButton(m_pa_value_panel, wxID_ANY, "icon_qusetion", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, true); m_pa_value_tips->SetBackgroundColour(*wxWHITE); - m_pa_value_tips->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e){ + m_pa_value_tips->Bind(wxEVT_BUTTON, [](wxCommandEvent &e){ std::string language = wxGetApp().app_config->get("language"); wxString region = "en"; if (language.find("zh") == 0) { @@ -773,7 +773,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater) m_link_network_state = new wxHyperlinkCtrl(m_sw_print_failed_info, wxID_ANY,_L("Check the status of current system services"),""); m_link_network_state->SetFont(::Label::Body_12); - m_link_network_state->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {wxGetApp().link_to_network_check();}); + m_link_network_state->Bind(wxEVT_LEFT_DOWN, [](auto& e) {wxGetApp().link_to_network_check();}); m_link_network_state->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {m_link_network_state->SetCursor(wxCURSOR_HAND);}); m_link_network_state->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {m_link_network_state->SetCursor(wxCURSOR_ARROW);}); @@ -2021,7 +2021,7 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) }); // STUDIO-9580 - /* use warning color if there are warning and normal messages* / + /* use warning color if there are warning and normal messages*/ /* use indexes if there are several messages*/ /* add header and ending if there are several messages or has none block warnings*/ if (confirm_text.size() > 1 || !is_printing_block) @@ -2224,7 +2224,7 @@ static bool _HasExt(const std::vector &ams_mapping_result) { }; for (const auto &info : ams_mapping_result) { - if (info.ams_id == VIRTUAL_AMS_MAIN_ID_STR || info.ams_id == VIRTUAL_AMS_DEPUTY_ID_STR && !info.ams_id.empty()) { + if (info.ams_id == VIRTUAL_AMS_MAIN_ID_STR || (info.ams_id == VIRTUAL_AMS_DEPUTY_ID_STR && !info.ams_id.empty())) { return true; } } @@ -3841,7 +3841,7 @@ void SelectMachineDialog::reset_and_sync_ams_list() m_sizer_ams_mapping->Add(item, 0, wxALL, FromDIP(5)); } item->SetToolTip(m_ams_tooltip); - item->Bind(wxEVT_LEFT_UP, [this, item, materials, extruder](wxMouseEvent &e) {}); + item->Bind(wxEVT_LEFT_UP, [](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*/ @@ -4354,7 +4354,7 @@ void SelectMachineDialog::set_default_from_sdcard() m_sizer_ams_mapping->Add(item, 0, wxALL, FromDIP(5)); } - item->Bind(wxEVT_LEFT_UP, [this, item, materials](wxMouseEvent& e) {}); + item->Bind(wxEVT_LEFT_UP, [](wxMouseEvent& e) {}); item->Bind(wxEVT_LEFT_DOWN, [this, obj_, item, materials, diameters_count, 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/SelectMachine.hpp b/src/slic3r/GUI/SelectMachine.hpp index e1276b15fb..2918f53a0d 100644 --- a/src/slic3r/GUI/SelectMachine.hpp +++ b/src/slic3r/GUI/SelectMachine.hpp @@ -508,7 +508,7 @@ class SelectMachineDialog : public DPIDialog bool is_timeout(); int update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name, std::string file_path); void set_print_type(PrintFromType type) {m_print_type = type;}; - bool Show(bool show); + bool Show(bool show) override; void show_init(); bool do_ams_mapping(MachineObject *obj_,bool use_ams); bool get_ams_mapping_result(std::string& mapping_array_str, std::string& mapping_array_str2, std::string& ams_mapping_info); diff --git a/src/slic3r/GUI/SelectMachinePop.cpp b/src/slic3r/GUI/SelectMachinePop.cpp index cee23e3223..ebeba68d75 100644 --- a/src/slic3r/GUI/SelectMachinePop.cpp +++ b/src/slic3r/GUI/SelectMachinePop.cpp @@ -562,7 +562,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")); @@ -574,7 +574,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; @@ -693,7 +693,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) { mobj->set_access_code(""); @@ -709,7 +709,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); @@ -736,7 +736,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")); @@ -748,7 +748,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(); @@ -1076,7 +1076,7 @@ PinCodePanel::PinCodePanel(wxWindow* parent, int type, wxWindowID winid /*= wxID m_confirm_login_dlg->SetSize(wxSize(FromDIP(270), FromDIP(158))); m_confirm_login_dlg->update_text(_L("Please log in before binding your device with a PIN code.\nAlternatively, you can use LAN mode to bind your device. Learn about LAN mode.")); m_confirm_login_dlg->update_btn_label(_L("Go to Login"), _L("")); - m_confirm_login_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this](wxCommandEvent& e) { + m_confirm_login_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [](wxCommandEvent& e) { //m_confirm_login_dlg->on_hide(); wxGetApp().request_login(); return; diff --git a/src/slic3r/GUI/SelectMachinePop.hpp b/src/slic3r/GUI/SelectMachinePop.hpp index 854c408347..a99c536b18 100644 --- a/src/slic3r/GUI/SelectMachinePop.hpp +++ b/src/slic3r/GUI/SelectMachinePop.hpp @@ -181,15 +181,13 @@ class SelectMachinePopup : public PopupWindow PinCodePanel* m_panel_direct_connection{nullptr}; wxWindow* m_placeholder_panel{nullptr}; wxHyperlinkCtrl* m_hyperlink{nullptr}; - Label* m_ping_code_text{nullptr}; - wxStaticBitmap* m_img_ping_code{nullptr}; - wxBoxSizer * m_sizer_body{nullptr}; wxBoxSizer * m_sizer_my_devices{nullptr}; wxBoxSizer * m_sizer_other_devices{nullptr}; +#if defined(__WINDOWS__) wxBoxSizer * m_sizer_search_bar{nullptr}; +#endif wxSearchCtrl* m_search_bar{nullptr}; wxScrolledWindow * m_scrolledWindow{nullptr}; - wxWindow * m_panel_body{nullptr}; wxTimer * m_refresh_timer{nullptr}; std::vector m_user_list_machine_panel; std::vector m_other_list_machine_panel; diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index 870c473ccd..8532d1b382 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -3055,19 +3055,25 @@ void Selection::synchronize_unselected_instances(SyncRotationType sync_rotation_ assert(is_rotation_xy_synchronized(m_cache.volumes_data[i].get_instance_rotation(), m_cache.volumes_data[j].get_instance_rotation())); switch (sync_rotation_type) { - case SyncRotationType::NONE: { - // z only rotation -> synch instance z - // The X,Y rotations should be synchronized from start to end of the rotation. - assert(is_rotation_xy_synchronized(rotation, v->get_instance_rotation())); - if (wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() != ptSLA) - v->set_instance_offset(Z, volume->get_instance_offset().z()); - break; - } - case SyncRotationType::GENERAL: - // generic rotation -> update instance z with the delta of the rotation. - const double z_diff = Geometry::rotation_diff_z(m_cache.volumes_data[i].get_instance_rotation(), m_cache.volumes_data[j].get_instance_rotation()); - v->set_instance_rotation({ rotation.x(), rotation.y(), rotation.z() + z_diff }); - break; + case SyncRotationType::NONE: { + // z only rotation -> synch instance z + // The X,Y rotations should be synchronized from start to end of the rotation. + assert(is_rotation_xy_synchronized(rotation, v->get_instance_rotation())); + if (wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() != ptSLA) + v->set_instance_offset(Z, volume->get_instance_offset().z()); + break; + } + case SyncRotationType::GENERAL: { + // generic rotation -> update instance z with the delta of the rotation. + const double z_diff = Geometry::rotation_diff_z(m_cache.volumes_data[i].get_instance_rotation(), m_cache.volumes_data[j].get_instance_rotation()); + v->set_instance_rotation({ rotation.x(), rotation.y(), rotation.z() + z_diff }); + break; + } + case SyncRotationType::RESET: { + // rotation reset -> copy rotation directly without delta + v->set_instance_rotation(rotation); + break; + } } v->set_instance_scaling_factor(scaling_factor); diff --git a/src/slic3r/GUI/SendMultiMachinePage.cpp b/src/slic3r/GUI/SendMultiMachinePage.cpp index 5c402abb44..7cea16facd 100644 --- a/src/slic3r/GUI/SendMultiMachinePage.cpp +++ b/src/slic3r/GUI/SendMultiMachinePage.cpp @@ -479,12 +479,10 @@ BBL::PrintParams SendMultiMachinePage::request_params(MachineObject* obj) PrintPrepareData job_data; m_plater->get_print_job_data(&job_data); - if (&job_data) { - std::string temp_file = Slic3r::resources_dir() + "/check_access_code.txt"; - auto check_access_code_path = temp_file.c_str(); - //BOOST_LOG_TRIVIAL(trace) << "sned_job: check_access_code_path = " << check_access_code_path; - job_data._temp_path = fs::path(check_access_code_path); - } + std::string temp_file = Slic3r::resources_dir() + "/check_access_code.txt"; + auto check_access_code_path = temp_file.c_str(); + //BOOST_LOG_TRIVIAL(trace) << "sned_job: check_access_code_path = " << check_access_code_path; + job_data._temp_path = fs::path(check_access_code_path); int curr_plate_idx; if (job_data.plate_idx >= 0) @@ -810,7 +808,11 @@ bool SendMultiMachinePage::Show(bool show) m_refresh_timer->Stop(); m_refresh_timer->SetOwner(this); m_refresh_timer->Start(4000); - wxPostEvent(this, wxTimerEvent()); + // Immediate update instead of posting deprecated wxTimerEvent + for (auto it = m_device_items.begin(); it != m_device_items.end(); it++) { + it->second->sync_state(); + it->second->Refresh(); + } } else { m_refresh_timer->Stop(); @@ -1503,7 +1505,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, [](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/SendMultiMachinePage.hpp b/src/slic3r/GUI/SendMultiMachinePage.hpp index e07b37f22c..ed104f95eb 100644 --- a/src/slic3r/GUI/SendMultiMachinePage.hpp +++ b/src/slic3r/GUI/SendMultiMachinePage.hpp @@ -149,7 +149,6 @@ class SendMultiMachinePage : public DPIDialog ScalableBitmap* print_time{ nullptr }; wxStaticBitmap* weightimg{ nullptr }; ScalableBitmap* print_weight{ nullptr }; - wxBoxSizer* m_thumbnail_sizer{ nullptr }; ThumbnailPanel* m_thumbnail_panel{nullptr}; wxPanel* m_panel_image{ nullptr }; wxBoxSizer* m_image_sizer{ nullptr }; diff --git a/src/slic3r/GUI/SendToPrinter.cpp b/src/slic3r/GUI/SendToPrinter.cpp index 9c7f8d1dfc..f5abbe926b 100644 --- a/src/slic3r/GUI/SendToPrinter.cpp +++ b/src/slic3r/GUI/SendToPrinter.cpp @@ -461,7 +461,7 @@ SendToPrinterDialog::SendToPrinterDialog(Plater *plater) m_link_network_state = new wxHyperlinkCtrl(m_sw_print_failed_info, wxID_ANY,_L("Check the status of current system services"),""); m_link_network_state->SetFont(::Label::Body_12); - m_link_network_state->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {wxGetApp().link_to_network_check(); }); + m_link_network_state->Bind(wxEVT_LEFT_DOWN, [](auto& e) {wxGetApp().link_to_network_check(); }); m_link_network_state->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {m_link_network_state->SetCursor(wxCURSOR_HAND); }); m_link_network_state->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {m_link_network_state->SetCursor(wxCURSOR_ARROW); }); @@ -650,7 +650,7 @@ void SendToPrinterDialog::update_storage_list(const std::vector &st } else { - radiobox->Enable(); + radiobox->Enable(true); } radiobox->Bind(wxEVT_LEFT_DOWN, [this, radiobox, selectd_storage = storages[i]](auto& e) { for (const auto& radio : m_storage_radioBox) { @@ -1002,18 +1002,16 @@ void SendToPrinterDialog::on_ok(wxCommandEvent &event) m_send_job->on_check_ip_address_fail([this, token = std::weak_ptr(m_token)](int result) { CallAfter([token, this] { if (token.expired()) { return; } - if (this) { - SendFailedConfirm sfcDlg; - auto res = sfcDlg.ShowModal(); - m_status_bar->cancel(); - - if (res == wxYES) { - wxQueueEvent(m_button_ensure, new wxCommandEvent(wxEVT_BUTTON)); - } else if (res == wxAPPLY) { - wxCommandEvent *evt = new wxCommandEvent(EVT_CLEAR_IPADDRESS); - wxQueueEvent(this, evt); - wxGetApp().show_ip_address_enter_dialog(); - } + SendFailedConfirm sfcDlg; + auto res = sfcDlg.ShowModal(); + m_status_bar->cancel(); + + if (res == wxYES) { + wxQueueEvent(m_button_ensure, new wxCommandEvent(wxEVT_BUTTON)); + } else if (res == wxAPPLY) { + wxCommandEvent *evt = new wxCommandEvent(EVT_CLEAR_IPADDRESS); + wxQueueEvent(this, evt); + wxGetApp().show_ip_address_enter_dialog(); } }); }); @@ -1417,7 +1415,7 @@ void SendToPrinterDialog::show_status(PrintDialogStatus status, std::vectorShow(); m_animaicon->Stop(); - m_animaicon->Enable(); + m_animaicon->ShowEnableIcon(); Layout(); Enable_Send_Button(false); diff --git a/src/slic3r/GUI/SendToPrinter.hpp b/src/slic3r/GUI/SendToPrinter.hpp index ce9ea28e91..61cb6adc4d 100644 --- a/src/slic3r/GUI/SendToPrinter.hpp +++ b/src/slic3r/GUI/SendToPrinter.hpp @@ -54,14 +54,12 @@ class SendToPrinterDialog : public DPIDialog void init_timer(); int m_print_plate_idx; - int m_current_filament_id; int m_print_error_code = 0; int timeout_count = 0; int m_connect_try_times = 0; bool m_is_in_sending_mode{ false }; bool m_is_rename_mode{ false }; bool enable_prepare_mode{ true }; - bool m_need_adaptation_screen{ false }; bool m_export_3mf_cancel{ false }; bool m_is_canceled{ false }; bool m_tcp_try_connect{true}; @@ -77,10 +75,8 @@ class SendToPrinterDialog : public DPIDialog TextInput* m_rename_input{ nullptr }; wxSimplebook* m_rename_switch_panel{ nullptr }; Plater* m_plater{ nullptr }; - wxStaticBitmap* m_staticbitmap{ nullptr }; ThumbnailPanel* m_thumbnailPanel{ nullptr }; ComboBox* m_comboBox_printer{ nullptr }; - ComboBox* m_comboBox_bed{ nullptr }; Button* m_rename_button{ nullptr }; Button* m_button_refresh{ nullptr }; Button* m_button_ensure{ nullptr }; @@ -98,8 +94,6 @@ class SendToPrinterDialog : public DPIDialog wxPanel * m_connecting_panel{nullptr}; wxSimplebook* m_simplebook{ nullptr }; wxStaticText* m_statictext_finish{ nullptr }; - wxStaticText* m_stext_sending{ nullptr }; - wxStaticText* m_staticText_bed_title{ nullptr }; wxStaticText* m_statictext_printer_msg{ nullptr }; wxStaticText * m_connecting_printer_msg{nullptr}; wxStaticText* m_stext_printer_title{ nullptr }; @@ -116,7 +110,6 @@ class SendToPrinterDialog : public DPIDialog wxBoxSizer* sizer_thumbnail; wxBoxSizer* m_sizer_scrollable_region; wxBoxSizer* m_sizer_main; - wxStaticText* m_file_name; PrintDialogStatus m_print_status{ PrintStatusInit }; AnimaIcon * m_animaicon{nullptr}; @@ -135,8 +128,6 @@ class SendToPrinterDialog : public DPIDialog std::vector m_storage_radioBox; std::string m_selected_storage; bool m_if_has_sdcard; - bool m_waiting_support{ false }; - bool m_waiting_enable{ false }; std::vector m_ability_list; public: @@ -179,7 +170,7 @@ class SendToPrinterDialog : public DPIDialog SendToPrinterDialog(Plater *plater = nullptr); ~SendToPrinterDialog(); - bool Show(bool show); + bool Show(bool show) override; bool is_timeout(); void on_rename_click(wxCommandEvent& event); void on_rename_enter(); diff --git a/src/slic3r/GUI/SkipPartCanvas.cpp b/src/slic3r/GUI/SkipPartCanvas.cpp index 98bc3bdbe4..454a61d3f1 100644 --- a/src/slic3r/GUI/SkipPartCanvas.cpp +++ b/src/slic3r/GUI/SkipPartCanvas.cpp @@ -19,6 +19,15 @@ wxDEFINE_EVENT(EVT_CANVAS_PART, wxCommandEvent); namespace Slic3r { namespace GUI { +// File-scope constant for border width used in rendering +// Defined here instead of function-scope to avoid lambda capture issues: +// - MSVC requires explicit capture of constexpr variables in lambdas (C3493 error) +// - Clang warns about unnecessary capture of constexpr variables (unused-lambda-capture) +// File-scope constant resolves both issues without platform-specific code +namespace { + constexpr float BORDER_WIDTH = 3.f; +} + SkipPartCanvas::SkipPartCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs) : wxGLCanvas(parent, dispAttrs) { context_ = new wxGLContext(this); @@ -245,7 +254,6 @@ void DrawRoundedRect(float x, float y, float width, float height, float radius, void SkipPartCanvas::Render() { - constexpr float border_w = 3.f; constexpr int uncheckd_stencil =1; constexpr int checkd_stencil = 2; constexpr int skipped_stencil = 3; @@ -287,7 +295,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); @@ -315,7 +323,7 @@ void SkipPartCanvas::Render() continue; glColor3f(rgb.r(), rgb.g(), rgb.b()); - glLineWidth(border_w); + glLineWidth(BORDER_WIDTH); for (const auto &contour_item : contour.second) { glBegin(GL_LINE_LOOP); for (const auto &pt : contour_item) { glVertex2f(pt.x, pt.y); } @@ -335,7 +343,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); @@ -355,7 +363,7 @@ void SkipPartCanvas::Render() if (part_info == parts_state_.end() || part_info->second != part_type) continue; glColor3f(bound.r(), bound.g(), bound.b()); - glLineWidth(border_w); + glLineWidth(BORDER_WIDTH); for (const auto &contour_item : contour.second) { glBegin(GL_LINE_LOOP); for (const auto &pt : contour_item) { glVertex2f(pt.x, pt.y); } diff --git a/src/slic3r/GUI/SkipPartCanvas.hpp b/src/slic3r/GUI/SkipPartCanvas.hpp index a9c8f1fec7..d70ad3718f 100644 --- a/src/slic3r/GUI/SkipPartCanvas.hpp +++ b/src/slic3r/GUI/SkipPartCanvas.hpp @@ -87,7 +87,6 @@ class SkipPartCanvas : public wxGLCanvas std::unordered_map < uint32_t, std::vector>> parts_triangles_; std::unordered_map < uint32_t, std::vector>> pick_parts_; std::unordered_map parts_state_; - bool gl_inited_{false}; int zoom_percent_{100}; wxPoint offset_{0,0}; wxPoint drag_start_offset_{0,0}; diff --git a/src/slic3r/GUI/SliceInfoPanel.cpp b/src/slic3r/GUI/SliceInfoPanel.cpp index 570be3b8d5..48bbacd122 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/SliceInfoPanel.hpp b/src/slic3r/GUI/SliceInfoPanel.hpp index 8f1710022b..09708d68e4 100644 --- a/src/slic3r/GUI/SliceInfoPanel.hpp +++ b/src/slic3r/GUI/SliceInfoPanel.hpp @@ -28,7 +28,6 @@ class SliceInfoPopup : public PopupWindow private: wxScrolledWindow *m_panel; - BBLSliceInfo *m_info { nullptr }; void OnMouse(wxMouseEvent &event); void OnSize(wxSizeEvent &event); diff --git a/src/slic3r/GUI/SlicingProgressNotification.hpp b/src/slic3r/GUI/SlicingProgressNotification.hpp index b9751bc50b..2403c31ab6 100644 --- a/src/slic3r/GUI/SlicingProgressNotification.hpp +++ b/src/slic3r/GUI/SlicingProgressNotification.hpp @@ -50,6 +50,9 @@ class NotificationManager::SlicingProgressNotification : public NotificationMana void set_export_possible(bool b) { m_export_possible = b; } void on_change_color_mode(bool is_dark) override; protected: + using PopNotification::render_text; + using PopNotification::render_close_button; + void init() override; void render(GLCanvas3D& canvas, float initial_y, bool move_from_overlay, float overlay_width, float right_margin) override; /* PARAMS: pos is relative to screen */ diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp index 2482da3e28..4050678087 100644 --- a/src/slic3r/GUI/StatusPanel.cpp +++ b/src/slic3r/GUI/StatusPanel.cpp @@ -3097,7 +3097,7 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj) obj->targ_nozzle_id_from_pc != INVALID_EXTRUDER_ID) { m_nozzle_btn_panel->Disable(); } else { - m_nozzle_btn_panel->Enable(); + m_nozzle_btn_panel->Enable(true); } } else { m_nozzle_btn_panel->Hide(); @@ -3141,7 +3141,7 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj) /*other*/ bool light_on = obj->GetLamp()->IsChamberLightOn(); - BOOST_LOG_TRIVIAL(trace) << "light: " << light_on ? "on" : "off"; + BOOST_LOG_TRIVIAL(trace) << "light: " << (light_on ? "on" : "off"); if (m_switch_lamp_timeout > 0) m_switch_lamp_timeout--; else { @@ -4735,7 +4735,7 @@ void StatusPanel::on_nozzle_selected(wxCommandEvent &event) if (obj->GetCtrl()->command_select_extruder(nozzle_id) == 0) { return; } } - m_nozzle_btn_panel->Enable(); + m_nozzle_btn_panel->Enable(true); } void StatusPanel::on_show_print_options(wxCommandEvent &event) @@ -5534,7 +5534,7 @@ wxBoxSizer *ScoreDialog::get_photo_btn_sizer() it = m_selected_image_list.erase(it); } m_image_url_paths.clear(); - for (const std::pair &bitmap : m_image) { + for (const std::pair &bitmap : m_image) { if (bitmap.second.is_uploaded) { if (!bitmap.second.img_url_paths.empty()) { m_image_url_paths.push_back(bitmap.second.img_url_paths); } } diff --git a/src/slic3r/GUI/StepMeshDialog.cpp b/src/slic3r/GUI/StepMeshDialog.cpp index 41f24608e3..80817392cf 100644 --- a/src/slic3r/GUI/StepMeshDialog.cpp +++ b/src/slic3r/GUI/StepMeshDialog.cpp @@ -125,7 +125,7 @@ StepMeshDialog::StepMeshDialog(wxWindow* parent, Slic3r::Step& file, double line font.SetUnderlined(true); tips->SetForegroundColour(StateColor::darkModeColorFor(wxColour(0, 174, 66))); tips->SetFont(font); - tips->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e) { + tips->Bind(wxEVT_LEFT_DOWN, [](wxMouseEvent& e) { wxLaunchDefaultBrowser("https://wiki.bambulab.com/en/software/bambu-studio/step"); }); info->Wrap(FromDIP(400)); @@ -164,7 +164,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(); @@ -217,7 +217,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 c591413192..806d573d95 100644 --- a/src/slic3r/GUI/SyncAmsInfoDialog.cpp +++ b/src/slic3r/GUI/SyncAmsInfoDialog.cpp @@ -604,7 +604,6 @@ void SyncAmsInfoDialog::updata_ui_when_priner_not_same() { SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) : DPIDialog(static_cast(wxGetApp().mainframe), wxID_ANY, _L("Synchronize AMS Filament Information"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX) , m_input_info(info) - , m_export_3mf_cancel(false) , m_mapping_popup(AmsMapingPopup(this,true)) , m_mapping_tip_popup(AmsMapingTipPopup(this)) , m_mapping_tutorial_popup(AmsTutorialPopup(this)) @@ -656,8 +655,9 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) : wxBoxSizer *loading_Sizer = new wxBoxSizer(wxHORIZONTAL); m_gif_ctrl = new wxAnimationCtrl(m_loading_page, wxID_ANY, wxNullAnimation, wxDefaultPosition, wxDefaultSize, wxAC_DEFAULT_STYLE); - auto gif_path = Slic3r::var("loading.gif").c_str(); - if (m_gif_ctrl->LoadFile(gif_path)){ + // auto gif_path = Slic3r::var("loading.gif").c_str(); // OLD: dangling pointer! Temporary destroyed after statement + auto gif_path = Slic3r::var("loading.gif"); // Keep string alive + if (m_gif_ctrl->LoadFile(gif_path.c_str())){ m_gif_ctrl->SetSize(m_gif_ctrl->GetAnimation().GetSize()); m_gif_ctrl->Play(); @@ -1107,7 +1107,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; @@ -1552,7 +1552,7 @@ bool SyncAmsInfoDialog::is_nozzle_type_match(DevExtderSystem data, wxString &err wxString pos; if (target_machine_nozzle_id == DEPUTY_EXTRUDER_ID) { pos = _L("left nozzle"); - } else if ((target_machine_nozzle_id == MAIN_EXTRUDER_ID)) { + } else if (target_machine_nozzle_id == MAIN_EXTRUDER_ID) { pos = _L("right nozzle"); } @@ -1924,6 +1924,7 @@ bool SyncAmsInfoDialog::is_same_nozzle_diameters(NozzleType &tag_nozzle_type, fl // TODO [tao wang] : add idx mapping tag_nozzle_type = obj_->GetExtderSystem()->GetNozzleType(0); + preset_nozzle_diameters = 0.0f; if (opt_nozzle_diameters != nullptr) { for (auto i = 0; i < used_extruders.size(); i++) { @@ -2678,7 +2679,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, [](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/SyncAmsInfoDialog.hpp b/src/slic3r/GUI/SyncAmsInfoDialog.hpp index 3d4bcda175..40d5bc4260 100644 --- a/src/slic3r/GUI/SyncAmsInfoDialog.hpp +++ b/src/slic3r/GUI/SyncAmsInfoDialog.hpp @@ -21,15 +21,11 @@ class SyncAmsInfoDialog : public DPIDialog bool m_only_exist_ext_spool_flag{false}; int m_current_filament_id{0}; int m_print_plate_idx{0}; - int m_print_plate_total{0}; int m_timeout_count{0}; int m_print_error_code{0}; bool m_is_in_sending_mode{false}; bool m_ams_mapping_res{false}; bool m_ams_mapping_valid{false}; - bool m_export_3mf_cancel{false}; - bool m_is_canceled{false}; - bool m_is_rename_mode{false}; bool m_check_flag{false}; PrintPageMode m_print_page_mode{PrintPageMode::PrintPageModePrepare}; std::string m_print_error_msg; @@ -307,8 +303,6 @@ class SyncAmsInfoDialog : public DPIDialog // wxBoxSizer * m_plate_combox_sizer = nullptr; wxBoxSizer * m_mode_combox_sizer = nullptr; //wxStaticText * m_printer_title = nullptr; - wxStaticText * m_printer_device_name = nullptr; - wxStaticText * m_printer_is_map_title = nullptr; CapsuleButton * m_colormap_btn = nullptr; CapsuleButton * m_override_btn = nullptr; @@ -326,7 +320,6 @@ class SyncAmsInfoDialog : public DPIDialog bool m_check_dirty_fialment = true; bool m_expand_more_settings = true; - bool m_image_is_top = false; const int LEFT_THUMBNAIL_SIZE_WIDTH = 100; const int RIGHT_THUMBNAIL_SIZE_WIDTH = 300; @@ -368,7 +361,7 @@ class FinishSyncAmsDialog : public Slic3r::GUI::BaseTransparentDPIFrame }; FinishSyncAmsDialog(InputInfo &input_info); ~FinishSyncAmsDialog() override; - void deal_ok(); + void deal_ok() override; void update_info(InputInfo &info); private: diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index c405dbc460..7024212a1c 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -451,7 +451,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); @@ -4764,7 +4764,7 @@ void TabPrinter::build_unregular_pages(bool from_initial_build/* = false*/) option.opt.full_width = true; optgroup->append_single_option_line(option); - optgroup->m_on_change = [this, extruder_idx](const t_config_option_key& opt_key, boost::any value) + optgroup->m_on_change = [this](const t_config_option_key& opt_key, boost::any value) { //if (m_config->opt_bool("single_extruder_multi_material") && m_extruders_count > 1 && opt_key.find("nozzle_diameter") != std::string::npos) //{ @@ -5039,7 +5039,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); }; @@ -5435,7 +5435,8 @@ void Tab::rebuild_page_tree() if (sel_item == m_last_select_item) m_last_select_item = item; else - m_last_select_item = NULL; + // m_last_select_item = NULL; // OLD - implicit conversion warning (NULL to int) + m_last_select_item = -1; // No selection // allow activate page before selection of a page_tree item m_disable_tree_sel_changed_event = false; @@ -6421,7 +6422,7 @@ void Tab::delete_preset() //wxID_YES != wxMessageDialog(parent(), msg, title, wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION).ShowModal()) wxID_YES == MessageDialog(parent(), msg, title, wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION).ShowModal())) return; - auto delete_cur_bed_type_to_config = [this]() { + auto delete_cur_bed_type_to_config = []() { PresetBundle &preset_bundle = *wxGetApp().preset_bundle; auto cur_preset_name = preset_bundle.printers.get_edited_preset().name; if (cur_preset_name.size() > 0 && wxGetApp().app_config->has_section("user_bed_type_list")) { @@ -6807,7 +6808,7 @@ void Tab::update_extruder_variants(int extruder_id, bool reload) int n = m_variant_combo->GetSelection(); auto options = generate_extruder_options(); m_variant_combo->SetOptions(options); - for (int i = 0; i < m_variant_combo->GetCount(); ++i) { + for (unsigned int i = 0; i < m_variant_combo->GetCount(); ++i) { auto flow_type = get_actual_nozzle_flow_type(i); auto ext_type = get_actual_extruder_type(i); bool connected = false; @@ -6991,7 +6992,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); }; @@ -7048,7 +7049,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); }; @@ -7216,7 +7217,7 @@ void Tab::update_nozzle_status_display() m_nozzle_status_sizer->Add(line, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5); } if (!r_nozzles.empty()) { - for (const auto nozzle : r_nozzles) { + for (const auto& nozzle : r_nozzles) { wxString name = nozzle.IsOnRack() ? "R" + std::to_string(nozzle.GetNozzleId() + 1) : "R"; create_nozzle_button(name); } diff --git a/src/slic3r/GUI/Tab.hpp b/src/slic3r/GUI/Tab.hpp index d2849b504c..e863f3e26e 100644 --- a/src/slic3r/GUI/Tab.hpp +++ b/src/slic3r/GUI/Tab.hpp @@ -509,13 +509,13 @@ class TabPrintModel : public TabPrint bool has_key(std::string const &key); protected: - virtual void activate_selected_page(std::function throw_if_canceled); + virtual void activate_selected_page(std::function throw_if_canceled) override; virtual void on_value_change(const std::string& opt_key, const boost::any& value) override; virtual void notify_changed(ObjectBase * object) = 0; - virtual void reload_config(); + virtual void reload_config() override; virtual void update_custom_dirty(std::vector &dirty_options, std::vector &nonsys_options) override; @@ -608,14 +608,10 @@ class TabFilament : public Tab class TabPrinter : public Tab { private: - bool m_has_single_extruder_MM_page = false; bool m_use_silent_mode = false; void append_option_line(ConfigOptionsGroupShp optgroup, const std::string opt_key); bool m_rebuild_kinematics_page = false; - ogStaticText* m_fff_print_host_upload_description_line {nullptr}; - ogStaticText* m_sla_print_host_upload_description_line {nullptr}; - std::vector m_pages_fff; std::vector m_pages_sla; diff --git a/src/slic3r/GUI/TabButton.hpp b/src/slic3r/GUI/TabButton.hpp index 7accf248c4..05ce1c6bd3 100644 --- a/src/slic3r/GUI/TabButton.hpp +++ b/src/slic3r/GUI/TabButton.hpp @@ -40,7 +40,7 @@ class TabButton : public StaticBox void SetBitmap(ScalableBitmap &bitmap); - bool Enable(bool enable = true); + bool Enable(bool enable = true) override; void Rescale(); diff --git a/src/slic3r/GUI/Tabbook.hpp b/src/slic3r/GUI/Tabbook.hpp index 7dd19389de..243a79d4c8 100644 --- a/src/slic3r/GUI/Tabbook.hpp +++ b/src/slic3r/GUI/Tabbook.hpp @@ -35,7 +35,6 @@ class TabButtonsListCtrl : public wxControl TabButton* pageButton; private: - wxWindow* m_parent; wxFlexGridSizer* m_buttons_sizer; wxBoxSizer* m_sizer; ScalableBitmap m_arrow_img; @@ -48,6 +47,8 @@ class TabButtonsListCtrl : public wxControl class Tabbook: public wxBookCtrlBase { public: + using wxBookCtrlBase::AddPage; + Tabbook(wxWindow * parent, wxWindowID winid = wxID_ANY, const wxPoint & pos = wxDefaultPosition, @@ -106,7 +107,7 @@ class Tabbook: public wxBookCtrlBase // by this control) and show it immediately. bool ShowNewPage(wxWindow * page) { - return AddPage(page, wxString(), ""/*true *//* select it */); + return AddPage(page, wxString(), std::string("")/*true *//* select it */); } // Set effect to use for showing/hiding pages. @@ -182,7 +183,7 @@ class Tabbook: public wxBookCtrlBase return true; } - bool RemovePage(size_t n) + bool RemovePage(size_t n) override { if (!wxBookCtrlBase::RemovePage(n)) return false; @@ -411,8 +412,6 @@ class Tabbook: public wxBookCtrlBase unsigned m_showTimeout, m_hideTimeout; - TabButtonsListCtrl *m_ctrl{nullptr}; - }; //#endif // _WIN32 #endif // slic3r_Tabbook_hpp_ diff --git a/src/slic3r/GUI/ThermalPreconditioningDialog.hpp b/src/slic3r/GUI/ThermalPreconditioningDialog.hpp index b2d46bf03b..bf07ad8080 100644 --- a/src/slic3r/GUI/ThermalPreconditioningDialog.hpp +++ b/src/slic3r/GUI/ThermalPreconditioningDialog.hpp @@ -31,7 +31,6 @@ class ThermalPreconditioningDialog : public wxDialog wxStaticText *m_remaining_time_label; wxStaticText *m_explanation_label; wxButton *m_ok_button; - wxStaticBitmap *m_title_bitmap; DECLARE_EVENT_TABLE() }; diff --git a/src/slic3r/GUI/UIHelpers/MeshBooleanUI.cpp b/src/slic3r/GUI/UIHelpers/MeshBooleanUI.cpp index 2e3b1e1488..7929dd4e2e 100644 --- a/src/slic3r/GUI/UIHelpers/MeshBooleanUI.cpp +++ b/src/slic3r/GUI/UIHelpers/MeshBooleanUI.cpp @@ -629,7 +629,7 @@ bool MeshBooleanUI::load_icons() {"bool_check_list.svg", &m_check_list_icon_id, true} }; - auto load_icons_helper = [this, &resources_path](const std::vector& icons) -> bool { + auto load_icons_helper = [&resources_path](const std::vector& icons) -> bool { bool all_loaded = true; for (const auto& icon : icons) { const int size = 64.0f; @@ -855,7 +855,7 @@ void MeshBooleanUI::draw_object_list(const std::string& table_name, ImVec2 size, ImGui::SetCursorPos(ImVec2(start_pos.x - ImGui::GetWindowPos().x, start_pos.y - ImGui::GetWindowPos().y)); ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(0, 0, 0, 255)); - ImGui::Text(title.c_str()); + ImGui::Text("%s", title.c_str()); // Draw count text (smaller size) with some spacing ImGui::SameLine(0, MeshBooleanConfig::SPACING_LIST_TITLE); // Add 4 pixels spacing between title and count @@ -1280,7 +1280,7 @@ void MeshBooleanUI::draw_progress_bar() // Draw percentage text on the same line ImGui::SameLine(0, text_padding); ImGui::AlignTextToFramePadding(); - ImGui::TextColored(ImVec4(0.42f, 0.42f, 0.42f, 1.00f), progress_text.c_str()); + ImGui::TextColored(ImVec4(0.42f, 0.42f, 0.42f, 1.00f), "%s", progress_text.c_str()); ImGui::EndGroup(); @@ -1299,7 +1299,7 @@ void MeshBooleanUI::draw_progress_bar() status_text = _u8L("Applying result.."); } - ImGui::TextColored(text_color, status_text.c_str()); + ImGui::TextColored(text_color, "%s", status_text.c_str()); ImGui::Spacing(); } diff --git a/src/slic3r/GUI/UnsavedChangesDialog.cpp b/src/slic3r/GUI/UnsavedChangesDialog.cpp index 37be6cb2db..f8c50e7b1a 100644 --- a/src/slic3r/GUI/UnsavedChangesDialog.cpp +++ b/src/slic3r/GUI/UnsavedChangesDialog.cpp @@ -1277,8 +1277,8 @@ static wxString get_string_value(std::string opt_key, const DynamicPrintConfig& } auto opt_vector = dynamic_cast(option); - if (option->is_scalar() && config.option(opt_key)->is_nil() || - option->is_vector() && opt_vector && opt_idx >= 0 && opt_idx < opt_vector->size() && opt_vector->is_nil(opt_idx)) + if ((option->is_scalar() && config.option(opt_key)->is_nil()) || + (option->is_vector() && opt_vector && opt_idx >= 0 && opt_idx < opt_vector->size() && opt_vector->is_nil(opt_idx))) return _L("N/A"); wxString out; diff --git a/src/slic3r/GUI/UnsavedChangesDialog.hpp b/src/slic3r/GUI/UnsavedChangesDialog.hpp index dc5462506b..f80b0a9e14 100644 --- a/src/slic3r/GUI/UnsavedChangesDialog.hpp +++ b/src/slic3r/GUI/UnsavedChangesDialog.hpp @@ -345,7 +345,7 @@ class UnsavedChangesDialog : public DPIDialog UnsavedChangesDialog(const wxString &caption, const wxString &header, DynamicConfig *config, int from, int to, bool left_to_right, NozzleVolumeType nozzle); ~UnsavedChangesDialog(){}; - int ShowModal(); + int ShowModal() override; void build(Preset::Type type, PresetCollection *dependent_presets, const std::string &new_selected_preset, const wxString &header = ""); void update(Preset::Type type, PresetCollection* dependent_presets, const std::string& new_selected_preset, const wxString& header); diff --git a/src/slic3r/GUI/UpdateDialogs.hpp b/src/slic3r/GUI/UpdateDialogs.hpp index 04eb4ffb3c..051a33e85b 100644 --- a/src/slic3r/GUI/UpdateDialogs.hpp +++ b/src/slic3r/GUI/UpdateDialogs.hpp @@ -32,8 +32,6 @@ class MsgUpdateSlic3r : public MsgDialog bool disable_version_check() const; void on_hyperlink(wxHyperlinkEvent& evt); -private: - wxCheckBox *cbox; }; diff --git a/src/slic3r/GUI/UpgradePanel.cpp b/src/slic3r/GUI/UpgradePanel.cpp index 737aa06784..fc114d0a32 100644 --- a/src/slic3r/GUI/UpgradePanel.cpp +++ b/src/slic3r/GUI/UpgradePanel.cpp @@ -866,7 +866,6 @@ void MachineInfoPanel::update_ams_ext(MachineObject *obj) if (new_extra_ams_ver != new_version_list.end()) has_new_version = true; - extra_ams_it->second.sw_new_ver; if (has_new_version) { m_extra_ams_panel->m_ams_new_version_img->Show(); ver_text = new_extra_ams_ver->second.sw_ver; diff --git a/src/slic3r/GUI/WebGuideDialog.cpp b/src/slic3r/GUI/WebGuideDialog.cpp index 5108a15a10..f170726432 100644 --- a/src/slic3r/GUI/WebGuideDialog.cpp +++ b/src/slic3r/GUI/WebGuideDialog.cpp @@ -487,10 +487,10 @@ void GuideFrame::OnScriptMessage(wxWebViewEvent &evt) this->EndModal(wxID_OK); if (InstallNetplugin) - GUI::wxGetApp().CallAfter([this] { GUI::wxGetApp().ShowDownNetPluginDlg(); }); + GUI::wxGetApp().CallAfter([] { GUI::wxGetApp().ShowDownNetPluginDlg(); }); if (bLogin) - GUI::wxGetApp().CallAfter([this] { login(); }); + GUI::wxGetApp().CallAfter([] { login(); }); } 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(); @@ -879,7 +879,7 @@ bool GuideFrame::apply_config(AppConfig *app_config, PresetBundle *preset_bundle const VendorProfile & printer_profile = preset_bundle->vendors[bundle_name]; const std::map>& model_maps = config->second; //for (const auto& vendor_profile : preset_bundle->vendors) { - for (const auto model_it: model_maps) { + for (const auto& model_it: model_maps) { if (model_it.second.size() > 0) { variant = *model_it.second.begin(); if (model_it.second.size() > 1) { diff --git a/src/slic3r/GUI/WebGuideDialog.hpp b/src/slic3r/GUI/WebGuideDialog.hpp index af4a746af3..e255548122 100644 --- a/src/slic3r/GUI/WebGuideDialog.hpp +++ b/src/slic3r/GUI/WebGuideDialog.hpp @@ -100,7 +100,6 @@ class GuideFrame : public DPIDialog AppConfig m_appconfig_new; wxWebView *m_browser; - wxButton * m_TestBtn; wxString m_SectionName; diff --git a/src/slic3r/GUI/WebUserLoginDialog.cpp b/src/slic3r/GUI/WebUserLoginDialog.cpp index 34bb90974f..914e68c2e5 100644 --- a/src/slic3r/GUI/WebUserLoginDialog.cpp +++ b/src/slic3r/GUI/WebUserLoginDialog.cpp @@ -301,7 +301,7 @@ void ZUserLogin::OnScriptMessage(wxWebViewEvent &evt) BOOST_LOG_TRIVIAL(info) << "thirdparty_login: thirdparty_login"; 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); }); @@ -310,7 +310,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/GUI/WebViewDialog.cpp b/src/slic3r/GUI/WebViewDialog.cpp index c559e1d1ff..428a0f551b 100644 --- a/src/slic3r/GUI/WebViewDialog.cpp +++ b/src/slic3r/GUI/WebViewDialog.cpp @@ -757,7 +757,7 @@ void WebViewPanel::get_wiki_search_result(std::string keyword) return; } }); - }).on_error([this](std::string body, std::string error, unsigned int status) { + }).on_error([](std::string body, std::string error, unsigned int status) { BOOST_LOG_TRIVIAL(error) << "get wiki search result error" << body; }).perform(); } @@ -884,8 +884,8 @@ void WebViewPanel::get_design_staffpick(int offset, int limit, std::function callback) Http http = Http::get(url); http.header("accept", "application/json") .header("Content-Type", "application/json") - .on_complete([this, callback](std::string body, unsigned status) { callback(body); }) - .on_error([this, callback](std::string body, std::string error, unsigned status) { callback(body + error); }) + .on_complete([callback](std::string body, unsigned status) { callback(body); }) + .on_error([callback](std::string body, std::string error, unsigned status) { callback(body + error); }) .perform(); } @@ -975,18 +975,18 @@ bool WebViewPanel::SaveBase64ToLocal(std::string Base64Buf, std::string FileName std::ofstream outFile(download_file.ToStdString(), std::ios::binary); if (!outFile) { - delete DstBuf; + delete[] DstBuf; std::cerr << "Error opening file for writing." << std::endl; return false; } outFile.write(DstBuf, nWrite); if (!outFile) { - delete DstBuf; + delete[] DstBuf; std::cerr << "Error writing to file." << std::endl; return false; } - delete DstBuf; + delete[] DstBuf; outFile.close(); std::cout << "Data written to file successfully." << std::endl; wxLogMessage("Makerlab Binary Write to %s", download_file.ToStdString()); @@ -1059,7 +1059,7 @@ void WebViewPanel::UpdateMakerlabStatus( ) int ret = agent->request_bind_ticket(&newticket); if (ret == 0) { - GetJumpUrl(login, newticket, ml_currenturl, ml_currenturl); + GetJumpUrl(true, newticket, ml_currenturl, ml_currenturl); m_browserML->LoadURL(ml_currenturl); m_MakerLab_LastUrl = ""; } @@ -1080,7 +1080,7 @@ unsigned char ToHex(unsigned char x) { return x > 9 ? x + 55 : x + 48; } unsigned char FromHex(unsigned char x) { - unsigned char y; + unsigned char y = 0; if (x >= 'A' && x <= 'Z') y = x - 'A' + 10; else if (x >= 'a' && x <= 'z') @@ -1892,7 +1892,7 @@ void WebViewPanel::SwitchWebContent(std::string modelname, int refresh) std::regex pattern("&keyword=[^&]*"); TmpNowUrl = std::regex_replace(TmpNowUrl, pattern, ""); if(TmpNowUrl != m_browserMW->GetCurrentURL().ToStdString()) { - m_browserMW->LoadURL(TmpNowUrl); + m_browserMW->LoadURL(TmpNowUrl); } } } diff --git a/src/slic3r/GUI/WebViewDialog.hpp b/src/slic3r/GUI/WebViewDialog.hpp index 5fd69775f5..9b05c6b2c4 100644 --- a/src/slic3r/GUI/WebViewDialog.hpp +++ b/src/slic3r/GUI/WebViewDialog.hpp @@ -104,7 +104,7 @@ class WebViewPanel : public wxPanel void SetMakerworldModelID(std::string ModelID); void OpenMakerworldSearchPage(std::string KeyWord); void SetPrintHistoryTaskID(int TaskID); - + //DisconnectPage wxString MakeDisconnectUrl(std::string MenuName); diff --git a/src/slic3r/GUI/Widgets/AMSItem.cpp b/src/slic3r/GUI/Widgets/AMSItem.cpp index d546ec2670..6a8e4dc650 100644 --- a/src/slic3r/GUI/Widgets/AMSItem.cpp +++ b/src/slic3r/GUI/Widgets/AMSItem.cpp @@ -2024,12 +2024,9 @@ void AMSRoad::OnPassRoad(std::vector prord_list) } } -/* - - -/************************************************* -Description:AMSRoadUpPart -**************************************************/ +/************************************************** + * Description:AMSRoadUpPart + **************************************************/ AMSRoadUpPart::AMSRoadUpPart() : m_road_def_color(AMS_CONTROL_GRAY500), m_road_color(AMS_CONTROL_GRAY500) {} AMSRoadUpPart::AMSRoadUpPart(wxWindow* parent, wxWindowID id, AMSinfo info, AMSModel model, const wxPoint& pos, const wxSize& size) : AMSRoadUpPart() diff --git a/src/slic3r/GUI/Widgets/AMSItem.hpp b/src/slic3r/GUI/Widgets/AMSItem.hpp index 3fe7476861..59b9d935a3 100644 --- a/src/slic3r/GUI/Widgets/AMSItem.hpp +++ b/src/slic3r/GUI/Widgets/AMSItem.hpp @@ -291,6 +291,8 @@ Description:AMSrefresh class AMSrefresh : public wxWindow { public: + using wxWindow::Update; + AMSrefresh(); AMSrefresh(wxWindow *parent, std::string ams_id, wxString can_id, Caninfo info, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize); AMSrefresh(wxWindow *parent, std::string ams_id, int can_id, Caninfo info, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize); @@ -441,6 +443,8 @@ Description:AMSLib class AMSLib : public wxWindow { public: + using wxWindow::Update; + AMSLib(wxWindow *parent, std::string ams_idx, Caninfo info, AMSModelOriginType ext_type = AMSModelOriginType::GENERIC_EXT); ~AMSLib(); void create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); @@ -527,6 +531,8 @@ Description:AMSRoad class AMSRoad : public wxWindow { public: + using wxWindow::Update; + AMSRoad(); AMSRoad(wxWindow *parent, wxWindowID id, Caninfo info, int canindex, int maxcan, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize); void create(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize); @@ -570,6 +576,8 @@ Description:AMSRoadUpPart class AMSRoadUpPart : public wxWindow { public: + using wxWindow::Update; + AMSRoadUpPart(); AMSRoadUpPart(wxWindow* parent, wxWindowID id, AMSinfo info, AMSModel mode, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); void create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); @@ -602,17 +610,11 @@ class AMSRoadUpPart : public wxWindow AMSRoadShowMode m_road_mode = {AMSRoadShowMode::AMS_ROAD_MODE_FOUR}; AMSPassRoadSTEP m_load_step = {AMSPassRoadSTEP::AMS_ROAD_STEP_NONE}; - bool m_selected = {false}; - int m_passroad_width = {6}; - double m_radius = {4}; wxColour m_road_def_color; wxColour m_road_color; std::vector ams_humidity_img; - int m_humidity = {0}; - bool m_show_humidity = {false}; - bool m_vams_loading{false}; AMSModel m_ams_model; }; @@ -645,22 +647,16 @@ class AMSRoadDownPart : public wxWindow private: int m_nozzle_num = {1}; - AMSRoadShowMode m_single_ext_rode_mode = {AMSRoadShowMode::AMS_ROAD_MODE_FOUR}; AMSRoadShowMode m_left_rode_mode = {AMSRoadShowMode::AMS_ROAD_MODE_FOUR}; AMSRoadShowMode m_right_rode_mode = {AMSRoadShowMode::AMS_ROAD_MODE_FOUR}; bool m_selected = {false}; int m_left_road_length = {-1}; int m_right_road_length = {-1}; - int m_passroad_width = {6}; - double m_radius = {4}; - AMSPassRoadType m_pass_road_type = {AMSPassRoadType::AMS_ROAD_TYPE_NONE}; AMSPassRoadSTEP m_pass_road_left_step = {AMSPassRoadSTEP::AMS_ROAD_STEP_NONE}; AMSPassRoadSTEP m_pass_road_right_step = {AMSPassRoadSTEP::AMS_ROAD_STEP_NONE}; std::map m_road_color; - bool m_vams_loading{false}; - AMSModel m_ams_model; }; /************************************************* @@ -669,6 +665,8 @@ Description:AMSPreview class AMSPreview : public wxWindow { public: + using wxWindow::Update; + AMSPreview(); AMSPreview(wxWindow *parent, wxWindowID id, AMSinfo amsinfo, AMSModel itemType = AMSModel::GENERIC_AMS, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); @@ -720,6 +718,8 @@ Description:AMSHumidity class AMSHumidity : public wxWindow { public: + using wxWindow::Update; + AMSHumidity(); AMSHumidity(wxWindow* parent, wxWindowID id, AMSinfo info, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); void create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); @@ -759,6 +759,8 @@ Description:AmsItem class AmsItem : public wxWindow { public: + using wxWindow::Update; + AmsItem(wxWindow *parent, AMSinfo info, AMSModel model, AMSPanelPos pos); ~AmsItem(); @@ -822,11 +824,7 @@ class AmsItem : public wxWindow AMSinfo m_info; wxBoxSizer * sizer_can = {nullptr}; wxGridSizer* sizer_can_extra = { nullptr }; - wxBoxSizer * sizer_humidity = { nullptr }; wxBoxSizer * sizer_item = { nullptr }; - wxBoxSizer * sizer_can_middle = {nullptr}; - wxBoxSizer * sizer_can_left = {nullptr}; - wxBoxSizer * sizer_can_right = {nullptr}; AMSExtImage* m_ext_image = { nullptr }; //the ext image upon the ext ams AMSExtText* m_ext_text = { nullptr }; //the ext text upon the ext ams }; diff --git a/src/slic3r/GUI/Widgets/AnimaController.cpp b/src/slic3r/GUI/Widgets/AnimaController.cpp index b64d5a5777..16e133e778 100644 --- a/src/slic3r/GUI/Widgets/AnimaController.cpp +++ b/src/slic3r/GUI/Widgets/AnimaController.cpp @@ -83,7 +83,7 @@ bool AnimaIcon::IsPlaying() return m_timer->IsRunning(); } -void AnimaIcon::Enable() +void AnimaIcon::ShowEnableIcon() { if (m_bitmap) { m_bitmap->SetBitmap(m_image_enable); } } diff --git a/src/slic3r/GUI/Widgets/AnimaController.hpp b/src/slic3r/GUI/Widgets/AnimaController.hpp index 70c157729e..52192df5f4 100644 --- a/src/slic3r/GUI/Widgets/AnimaController.hpp +++ b/src/slic3r/GUI/Widgets/AnimaController.hpp @@ -13,7 +13,7 @@ class AnimaIcon : public wxPanel void Play(); void Stop(); - void Enable(); + void ShowEnableIcon(); bool IsPlaying(); bool IsRunning() const; diff --git a/src/slic3r/GUI/Widgets/AxisCtrlButton.cpp b/src/slic3r/GUI/Widgets/AxisCtrlButton.cpp index c8fc6d5875..fdcf753866 100644 --- a/src/slic3r/GUI/Widgets/AxisCtrlButton.cpp +++ b/src/slic3r/GUI/Widgets/AxisCtrlButton.cpp @@ -124,7 +124,7 @@ void AxisCtrlButton::SetInnerBackgroundColor(StateColor const& color) void AxisCtrlButton::SetBitmap(ScalableBitmap &bmp) { - if (&bmp && (& bmp.bmp()) && (bmp.bmp().IsOk())) { + if (bmp.bmp().IsOk()) { m_icon = bmp; } } diff --git a/src/slic3r/GUI/Widgets/ComboBox.cpp b/src/slic3r/GUI/Widgets/ComboBox.cpp index 5039dc10c3..5ad456e960 100644 --- a/src/slic3r/GUI/Widgets/ComboBox.cpp +++ b/src/slic3r/GUI/Widgets/ComboBox.cpp @@ -190,7 +190,7 @@ bool ComboBox::SetFont(wxFont const& font) int ComboBox::Append(const wxString &item, const wxBitmap &bitmap, int style) { - if (&bitmap && bitmap.IsOk()) { + if (bitmap.IsOk()) { return Append(item, bitmap, nullptr, style); } return Append(item, wxNullBitmap, nullptr, style); @@ -201,7 +201,7 @@ int ComboBox::Append(const wxString &text, void * clientData, int style) { - if (&bitmap && bitmap.IsOk()) { + if (bitmap.IsOk()) { return Append(text, bitmap, wxString{}, clientData, style); } return Append(text, wxNullBitmap, wxString{}, clientData, style); @@ -209,7 +209,7 @@ int ComboBox::Append(const wxString &text, int ComboBox::Append(const wxString &text, const wxBitmap &bitmap, const wxString &group, void *clientData, int style) { - auto valid_bit_map = (&bitmap && bitmap.IsOk()) ? bitmap : wxNullBitmap; + auto valid_bit_map = bitmap.IsOk() ? bitmap : wxNullBitmap; Item item{text, wxEmptyString, valid_bit_map, valid_bit_map, clientData, group}; item.style = style; items.push_back(item); @@ -276,7 +276,7 @@ wxBitmap ComboBox::GetItemBitmap(unsigned int n) { return items[n].icon; } void ComboBox::SetItemBitmap(unsigned int n, wxBitmap const &bitmap) { if (n >= items.size()) return; - items[n].icon = (&bitmap && bitmap.IsOk()) ? bitmap : wxNullBitmap; + items[n].icon = bitmap.IsOk() ? bitmap : wxNullBitmap; drop.Invalidate(); } diff --git a/src/slic3r/GUI/Widgets/ErrorMsgStaticText.hpp b/src/slic3r/GUI/Widgets/ErrorMsgStaticText.hpp index 9c2e11ff25..05771b0ae7 100644 --- a/src/slic3r/GUI/Widgets/ErrorMsgStaticText.hpp +++ b/src/slic3r/GUI/Widgets/ErrorMsgStaticText.hpp @@ -17,7 +17,7 @@ class WXDLLIMPEXP_CORE ErrorMsgStaticText : public wxPanel void paintEvent(wxPaintEvent &evt); - void SetLabel(wxString msg){m_msg = msg;}; + void SetLabel(const wxString& label) override { m_msg = label; } }; #endif \ No newline at end of file diff --git a/src/slic3r/GUI/Widgets/FanControl.cpp b/src/slic3r/GUI/Widgets/FanControl.cpp index 33047cb184..fec0c50535 100644 --- a/src/slic3r/GUI/Widgets/FanControl.cpp +++ b/src/slic3r/GUI/Widgets/FanControl.cpp @@ -1014,8 +1014,8 @@ void FanControlPopupNew::init_names(MachineObject* obj) { if (obj) { const std::string& special_cooling_text = DevPrinterConfigUtil::get_fan_text(obj->printer_type, "special_cooling_text"); if (!special_cooling_text.empty()) { - L("Cooling mode is suitable for printing PLA/PETG/TPU materials."); //some potential text, add i18n flags - L("Cooling mode is suitable for printing PLA/PETG/TPU materials and filters the chamber air."); + (void)L("Cooling mode is suitable for printing PLA/PETG/TPU materials."); //some potential text, add i18n flags + (void)L("Cooling mode is suitable for printing PLA/PETG/TPU materials and filters the chamber air."); label_text[AIR_DUCT::AIR_DUCT_COOLING_FILT] = _L(special_cooling_text); } } @@ -1028,9 +1028,9 @@ wxString FanControlPopupNew::get_fan_func_name(int mode, int submode, AIR_FUN fu const std::string& func_text = DevPrinterConfigUtil::get_fan_text(m_obj->printer_type, mode, (int)func, submode); if (!func_text.empty()) { - L_CONTEXT("Right(Aux)", "air_duct"); - L_CONTEXT("Right(Filter)", "air_duct"); - L_CONTEXT("Left(Aux)", "air_duct"); + (void)L_CONTEXT("Right(Aux)", "air_duct"); + (void)L_CONTEXT("Right(Filter)", "air_duct"); + (void)L_CONTEXT("Left(Aux)", "air_duct"); return _CTX(func_text, "air_duct"); } } diff --git a/src/slic3r/GUI/Widgets/FanControl.hpp b/src/slic3r/GUI/Widgets/FanControl.hpp index fc29d22000..2badbf8594 100644 --- a/src/slic3r/GUI/Widgets/FanControl.hpp +++ b/src/slic3r/GUI/Widgets/FanControl.hpp @@ -109,7 +109,6 @@ class FanOperate : public wxWindow void decrease_fan_speeds(); private: int m_current_speeds; - int m_target_speed; int m_min_speeds; int m_max_speeds; ScalableBitmap m_bitmap_add; @@ -213,7 +212,6 @@ class FanControlPopupNew : public wxDialog wxGridSizer* m_sizer_fanControl { nullptr }; wxBoxSizer *m_mode_sizer{ nullptr }; - wxBoxSizer *m_bottom_sizer{ nullptr }; // mode switch buttons std::unordered_map m_mode_switch_btns; // diff --git a/src/slic3r/GUI/Widgets/MultiNozzleSync.cpp b/src/slic3r/GUI/Widgets/MultiNozzleSync.cpp index 200fe92e6d..e5391a1a84 100644 --- a/src/slic3r/GUI/Widgets/MultiNozzleSync.cpp +++ b/src/slic3r/GUI/Widgets/MultiNozzleSync.cpp @@ -13,7 +13,7 @@ static const int LeftExtruderIdx = 0; static const int RightExtruderIdx = 1; ManualNozzleCountDialog::ManualNozzleCountDialog(wxWindow *parent, NozzleVolumeType volume_type, int standard_count, int highflow_count, int max_nozzle_count, bool force_no_zero) - : GUI::DPIDialog(parent, wxID_ANY, "Set nozzle count", wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX), m_volume_type(volume_type) + : GUI::DPIDialog(parent, wxID_ANY, "Set nozzle count", wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX) { this->SetBackgroundColour(*wxWHITE); std::string icon_path = (boost::format("%1%/images/BambuStudioTitle.ico") % resources_dir()).str(); @@ -75,7 +75,7 @@ ManualNozzleCountDialog::ManualNozzleCountDialog(wxWindow *parent, NozzleVolumeT this->Layout(); this->Fit(); content->Thaw(); - } else if (total_count == 0 && force_no_zero || total_count > max_nozzle_count) { + } else if ((total_count == 0 && force_no_zero) || total_count > max_nozzle_count) { wxString error_tip; if (total_count == 0) error_tip = _L("Error: Can not set both nozzle count to zero."); @@ -499,7 +499,7 @@ NozzleListTable::NozzleListTable(wxWindow* parent) : wxPanel(parent,wxID_ANY,wxD SetSizer(sizer); Layout(); - m_web_view->Bind(wxEVT_WEBVIEW_SCRIPT_MESSAGE_RECEIVED, [this,sizer](wxWebViewEvent& evt) { + m_web_view->Bind(wxEVT_WEBVIEW_SCRIPT_MESSAGE_RECEIVED, [this](wxWebViewEvent& evt) { std::string message = evt.GetString().ToStdString(); BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << "Received message: " << message; try { @@ -1039,8 +1039,8 @@ void MultiNozzleSyncDialog::UpdateButton(std::weak_ptr rack, bool m_cancel_btn->SetLabel(_L("Ignore")); m_confirm_btn->SetLabel(_L("Refresh")); - m_cancel_btn->Bind(wxEVT_LEFT_DOWN, [this, rack, ignore_opt](auto& e) {ignore_opt(); }); - m_confirm_btn->Bind(wxEVT_LEFT_DOWN, [this, rack, refresh_cmd](auto& e) {refresh_cmd(); }); + m_cancel_btn->Bind(wxEVT_LEFT_DOWN, [ignore_opt](auto& e) {ignore_opt(); }); + m_confirm_btn->Bind(wxEVT_LEFT_DOWN, [refresh_cmd](auto& e) {refresh_cmd(); }); } else if (has_unknown) { m_cancel_btn->Show(); @@ -1049,8 +1049,8 @@ void MultiNozzleSyncDialog::UpdateButton(std::weak_ptr rack, bool m_cancel_btn->SetLabel(_L("Ignore")); m_confirm_btn->SetLabel(_L("Refresh")); - m_cancel_btn->Bind(wxEVT_LEFT_DOWN, [this, rack, ignore_opt](auto& e) {ignore_opt(); }); - m_confirm_btn->Bind(wxEVT_LEFT_DOWN, [this, rack, refresh_cmd](auto& e) {refresh_cmd(); }); + m_cancel_btn->Bind(wxEVT_LEFT_DOWN, [ignore_opt](auto& e) {ignore_opt(); }); + m_confirm_btn->Bind(wxEVT_LEFT_DOWN, [refresh_cmd](auto& e) {refresh_cmd(); }); } else if (has_unreliable) { m_cancel_btn->Show(); @@ -1059,8 +1059,8 @@ void MultiNozzleSyncDialog::UpdateButton(std::weak_ptr rack, bool m_cancel_btn->SetLabel(_L("Refresh")); m_confirm_btn->SetLabel(_L("Confirm")); - m_cancel_btn->Bind(wxEVT_LEFT_DOWN, [this, rack, refresh_cmd](auto& e) {refresh_cmd(); }); - m_confirm_btn->Bind(wxEVT_LEFT_DOWN, [this, rack, trust_cmd](auto& e) {trust_cmd(); }); + m_cancel_btn->Bind(wxEVT_LEFT_DOWN, [refresh_cmd](auto& e) {refresh_cmd(); }); + m_confirm_btn->Bind(wxEVT_LEFT_DOWN, [trust_cmd](auto& e) {trust_cmd(); }); } else { diff --git a/src/slic3r/GUI/Widgets/MultiNozzleSync.hpp b/src/slic3r/GUI/Widgets/MultiNozzleSync.hpp index 9f883d1758..522d3e8a93 100644 --- a/src/slic3r/GUI/Widgets/MultiNozzleSync.hpp +++ b/src/slic3r/GUI/Widgets/MultiNozzleSync.hpp @@ -44,7 +44,6 @@ class ManualNozzleCountDialog : public DPIDialog wxChoice* m_highflow_choice { nullptr }; Button* m_confirm_btn{ nullptr }; Label* m_error_label{ nullptr }; - NozzleVolumeType m_volume_type; }; @@ -61,8 +60,6 @@ class ExtruderBadge :public wxPanel bool m_right_on{ true }; wxStaticBitmap* badget; - Label* left; - Label* right; Label* left_diameter_desp; Label* right_diameter_desp; Label* left_flow_desp; @@ -139,7 +136,7 @@ class MultiNozzleSyncDialog : public DPIDialog { public: MultiNozzleSyncDialog(wxWindow* parent, std::weak_ptr rack); - virtual void on_dpi_changed(const wxRect& suggested_rect) {}; + virtual void on_dpi_changed(const wxRect& suggested_rect) override {}; std::vector GetNozzleOptions(const std::vector& group_infos); std::optional GetSelectedOption() { @@ -176,7 +173,6 @@ class MultiNozzleSyncDialog : public DPIDialog Label* m_caution; wxTimer* m_refresh_timer {nullptr}; - size_t m_rack_event_token; Button* m_cancel_btn; Button* m_confirm_btn; }; diff --git a/src/slic3r/GUI/Widgets/ProgressBar.hpp b/src/slic3r/GUI/Widgets/ProgressBar.hpp index f6121708d1..f80ef7ee31 100644 --- a/src/slic3r/GUI/Widgets/ProgressBar.hpp +++ b/src/slic3r/GUI/Widgets/ProgressBar.hpp @@ -56,7 +56,7 @@ class ProgressBar : public wxWindow void paintEvent(wxPaintEvent &evt); void render(wxDC &dc); void doRender(wxDC &dc); - virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); + virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO) override; diff --git a/src/slic3r/GUI/Widgets/RadioBox.hpp b/src/slic3r/GUI/Widgets/RadioBox.hpp index b2c03aae15..1f99ec4c30 100644 --- a/src/slic3r/GUI/Widgets/RadioBox.hpp +++ b/src/slic3r/GUI/Widgets/RadioBox.hpp @@ -14,6 +14,9 @@ class RadioBox : public wxBitmapToggleButton RadioBox(wxWindow *parent); public: + using wxBitmapToggleButton::GetValue; + using wxBitmapToggleButton::Enable; + void SetValue(bool value) override; bool GetValue(); void Rescale(); diff --git a/src/slic3r/GUI/Widgets/Scrollbar.cpp b/src/slic3r/GUI/Widgets/Scrollbar.cpp index b71390b833..7497f19f4d 100644 --- a/src/slic3r/GUI/Widgets/Scrollbar.cpp +++ b/src/slic3r/GUI/Widgets/Scrollbar.cpp @@ -1,4 +1,3 @@ -#pragma once #include #ifndef WX_PRECOMP #include diff --git a/src/slic3r/GUI/Widgets/ScrolledWindow.cpp b/src/slic3r/GUI/Widgets/ScrolledWindow.cpp index 5d3a43507a..d570b9f764 100644 --- a/src/slic3r/GUI/Widgets/ScrolledWindow.cpp +++ b/src/slic3r/GUI/Widgets/ScrolledWindow.cpp @@ -1,5 +1,4 @@ // for scroll -#pragma once #include #ifndef WX_PRECOMP #include diff --git a/src/slic3r/GUI/Widgets/ScrolledWindow.hpp b/src/slic3r/GUI/Widgets/ScrolledWindow.hpp index 56d54aade3..d922c7eb5b 100644 --- a/src/slic3r/GUI/Widgets/ScrolledWindow.hpp +++ b/src/slic3r/GUI/Widgets/ScrolledWindow.hpp @@ -12,6 +12,9 @@ class MyScrollbar; class ScrolledWindow : public wxScrolled { public: + using wxScrolled::Refresh; + using wxScrolled::SetBackgroundColour; + ScrolledWindow(wxWindow *parent, wxWindowID id, wxPoint position, wxSize size, long style, int marginWidth = 0, int scrollbarWidth = 4, int tipLength = 0); void OnMouseWheel(wxMouseEvent &event); void SetTipColor(wxColour color); diff --git a/src/slic3r/GUI/Widgets/SideButton.hpp b/src/slic3r/GUI/Widgets/SideButton.hpp index 4f8d893f93..894a7d8727 100644 --- a/src/slic3r/GUI/Widgets/SideButton.hpp +++ b/src/slic3r/GUI/Widgets/SideButton.hpp @@ -31,7 +31,7 @@ class SideButton : public wxWindow void SetLayoutStyle(int style); - void SetLabel(const wxString& label); + void SetLabel(const wxString& label) override; bool SetForegroundColour(wxColour const & colour) override; @@ -47,7 +47,7 @@ class SideButton : public wxWindow void SetBackgroundColor(StateColor const &color); - bool Enable(bool enable = true); + bool Enable(bool enable = true) override; void Rescale(); diff --git a/src/slic3r/GUI/Widgets/SideTools.cpp b/src/slic3r/GUI/Widgets/SideTools.cpp index 2ae5e7b8b7..4f1f22c115 100644 --- a/src/slic3r/GUI/Widgets/SideTools.cpp +++ b/src/slic3r/GUI/Widgets/SideTools.cpp @@ -338,7 +338,7 @@ SideTools::SideTools(wxWindow *parent, wxWindowID id, const wxPoint &pos, const m_link_network_state->SetMinSize(wxSize(FromDIP(220), -1)); m_link_network_state->SetMaxSize(wxSize(FromDIP(220), -1)); m_link_network_state->SetFont(::Label::Body_12); - m_link_network_state->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {wxGetApp().link_to_network_check(); }); + m_link_network_state->Bind(wxEVT_LEFT_DOWN, [](auto& e) {wxGetApp().link_to_network_check(); }); m_link_network_state->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {m_link_network_state->SetCursor(wxCURSOR_HAND); }); m_link_network_state->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {m_link_network_state->SetCursor(wxCURSOR_ARROW); }); diff --git a/src/slic3r/GUI/Widgets/SpinInput.cpp b/src/slic3r/GUI/Widgets/SpinInput.cpp index 3f089953fe..aa28beaaf2 100644 --- a/src/slic3r/GUI/Widgets/SpinInput.cpp +++ b/src/slic3r/GUI/Widgets/SpinInput.cpp @@ -66,7 +66,7 @@ void SpinInput::Create(wxWindow *parent, text_ctrl->Bind(wxEVT_KILL_FOCUS, &SpinInput::onTextLostFocus, this); text_ctrl->Bind(wxEVT_TEXT_ENTER, &SpinInput::onTextEnter, this); text_ctrl->Bind(wxEVT_KEY_DOWN, &SpinInput::keyPressed, this); - text_ctrl->Bind(wxEVT_RIGHT_DOWN, [this](auto &e) {}); // disable context menu + text_ctrl->Bind(wxEVT_RIGHT_DOWN, [](auto &e) {}); // disable context menu button_inc = createButton(true); button_dec = createButton(false); delta = 0; diff --git a/src/slic3r/GUI/Widgets/StateColor.cpp b/src/slic3r/GUI/Widgets/StateColor.cpp index 184c79f726..fe652cec8b 100644 --- a/src/slic3r/GUI/Widgets/StateColor.cpp +++ b/src/slic3r/GUI/Widgets/StateColor.cpp @@ -100,7 +100,7 @@ void StateColor::append(unsigned long color, int states) { if ((color & 0xff000000) == 0) color |= 0xff000000; - wxColour cl; cl.SetRGBA(color & 0xff00ff00 | ((color & 0xff) << 16) | ((color >> 16) & 0xff)); + wxColour cl; cl.SetRGBA((color & 0xff00ff00) | ((color & 0xff) << 16) | ((color >> 16) & 0xff)); append(cl, states); } diff --git a/src/slic3r/GUI/Widgets/StateHandler.cpp b/src/slic3r/GUI/Widgets/StateHandler.cpp index de9ced6e14..2d27a96d3f 100644 --- a/src/slic3r/GUI/Widgets/StateHandler.cpp +++ b/src/slic3r/GUI/Widgets/StateHandler.cpp @@ -51,7 +51,7 @@ void StateHandler::update_binds() int diff = bind_states ^ bind_states_; State states[] = {Enabled, Checked, Focused, Hovered, Pressed}; wxEventType events[] = {EVT_ENABLE_CHANGED, wxEVT_CHECKBOX, wxEVT_SET_FOCUS, wxEVT_ENTER_WINDOW, wxEVT_LEFT_DOWN}; - wxEventType events2[] = {{0}, {0}, wxEVT_KILL_FOCUS, wxEVT_LEAVE_WINDOW, wxEVT_LEFT_UP}; + wxEventType events2[] = {0, 0, wxEVT_KILL_FOCUS, wxEVT_LEAVE_WINDOW, wxEVT_LEFT_UP}; for (int i = 0; i < 5; ++i) { int s = states[i]; if (diff & s) { @@ -74,7 +74,7 @@ void StateHandler::set_state(int state, int mask) { if ((states_ & mask) == (state & mask)) return; int old = states_; - states_ = states_ & ~mask | state & mask; + states_ = (states_ & ~mask) | (state & mask); if (old != states_ && (old | states2_) != (states_ | states2_)) { if (parent_) parent_->changed(states_ | states2_); @@ -94,7 +94,7 @@ void StateHandler::changed(wxEvent &event) { event.Skip(); wxEventType events[] = {EVT_ENABLE_CHANGED, wxEVT_CHECKBOX, wxEVT_SET_FOCUS, wxEVT_ENTER_WINDOW, wxEVT_LEFT_DOWN}; - wxEventType events2[] = {{0}, {0}, wxEVT_KILL_FOCUS, wxEVT_LEAVE_WINDOW, wxEVT_LEFT_UP}; + wxEventType events2[] = {0, 0, wxEVT_KILL_FOCUS, wxEVT_LEAVE_WINDOW, wxEVT_LEFT_UP}; int old = states_; // some events are from another window (ex: text_ctrl of TextInput), save state in states2_ to avoid conflicts for (int i = 0; i < 5; ++i) { diff --git a/src/slic3r/GUI/Widgets/SwitchButton.hpp b/src/slic3r/GUI/Widgets/SwitchButton.hpp index 348ff22034..51c4e5e364 100644 --- a/src/slic3r/GUI/Widgets/SwitchButton.hpp +++ b/src/slic3r/GUI/Widgets/SwitchButton.hpp @@ -62,6 +62,8 @@ class SwitchBoard : public wxWindow void* client_data = nullptr;/*MachineObject* in StatusPanel*/ public: + using wxWindow::Enable; + void Enable(); void Disable(); bool IsEnabled(){return is_enable;}; diff --git a/src/slic3r/GUI/Widgets/TabCtrl.hpp b/src/slic3r/GUI/Widgets/TabCtrl.hpp index 0fe73e1762..7e863d258b 100644 --- a/src/slic3r/GUI/Widgets/TabCtrl.hpp +++ b/src/slic3r/GUI/Widgets/TabCtrl.hpp @@ -65,7 +65,7 @@ class TabCtrl : public StaticBox bool IsVisible(unsigned int item) const; private: - virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); + virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO) override; #ifdef __WIN32__ WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) override; diff --git a/src/slic3r/GUI/Widgets/TempInput.cpp b/src/slic3r/GUI/Widgets/TempInput.cpp index d0e1af23c2..47011fec42 100644 --- a/src/slic3r/GUI/Widgets/TempInput.cpp +++ b/src/slic3r/GUI/Widgets/TempInput.cpp @@ -134,7 +134,7 @@ void TempInput::Create(wxWindow *parent, wxString text, wxString label, wxString } } }); - text_ctrl->Bind(wxEVT_RIGHT_DOWN, [this](auto &e) {}); // disable context menu + text_ctrl->Bind(wxEVT_RIGHT_DOWN, [](auto &e) {}); // disable context menu text_ctrl->Bind(wxEVT_LEFT_DOWN, [this](auto &e) { if (m_read_only) { return; diff --git a/src/slic3r/GUI/Widgets/TempInput.hpp b/src/slic3r/GUI/Widgets/TempInput.hpp index 555fbb9ef5..9ddb72e1fa 100644 --- a/src/slic3r/GUI/Widgets/TempInput.hpp +++ b/src/slic3r/GUI/Widgets/TempInput.hpp @@ -106,7 +106,7 @@ class TempInput : public wxNavigationEnabled wxString GetTagTemp() { return text_ctrl->GetValue(); } wxString GetCurrTemp() { return GetLabel(); } int get_max_temp() { return max_temp; } - void SetLabel(const wxString &label); + void SetLabel(const wxString &label) override; void SetTextColor(StateColor const &color); @@ -127,7 +127,7 @@ class TempInput : public wxNavigationEnabled void ReSetOnChanging() { m_on_changing = false; } protected: - virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); + virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO) override; void DoSetToolTipText(wxString const &tip) override; diff --git a/src/slic3r/GUI/Widgets/TextInput.cpp b/src/slic3r/GUI/Widgets/TextInput.cpp index 38146c4722..72f5e82d94 100644 --- a/src/slic3r/GUI/Widgets/TextInput.cpp +++ b/src/slic3r/GUI/Widgets/TextInput.cpp @@ -81,7 +81,7 @@ void TextInput::Create(wxWindow * parent, e.SetId(GetId()); ProcessEventLocally(e); }); - text_ctrl->Bind(wxEVT_RIGHT_DOWN, [this](auto &e) {}); // disable context menu + text_ctrl->Bind(wxEVT_RIGHT_DOWN, [](auto &e) {}); // disable context menu text_ctrl->Bind(wxEVT_TEXT, [this](auto &e) { diff --git a/src/slic3r/GUI/Widgets/TextInput.hpp b/src/slic3r/GUI/Widgets/TextInput.hpp index d132da42aa..fd6a621e2a 100644 --- a/src/slic3r/GUI/Widgets/TextInput.hpp +++ b/src/slic3r/GUI/Widgets/TextInput.hpp @@ -50,7 +50,7 @@ class TextInput : public wxNavigationEnabled void SetCornerRadius(double radius); - void SetLabel(const wxString& label); + void SetLabel(const wxString& label) override; void SetStaticTips(const wxString& tips, const wxBitmap& bitmap); @@ -80,7 +80,7 @@ class TextInput : public wxNavigationEnabled virtual void OnEdit() {} virtual void DoSetSize( - int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); + int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO) override; void DoSetToolTipText(wxString const &tip) override; diff --git a/src/slic3r/GUI/calib_dlg.cpp b/src/slic3r/GUI/calib_dlg.cpp index 45e84e8d76..c65cbdb798 100644 --- a/src/slic3r/GUI/calib_dlg.cpp +++ b/src/slic3r/GUI/calib_dlg.cpp @@ -28,7 +28,7 @@ wxBoxSizer* create_item_checkbox(wxString title, wxWindow* parent, bool* value, checkbox->SetValue(true); - checkbox->Bind(wxEVT_TOGGLEBUTTON, [parent, checkbox, value](wxCommandEvent& e) { + checkbox->Bind(wxEVT_TOGGLEBUTTON, [value](wxCommandEvent& e) { (*value) = (*value) ? false : true; e.Skip(); }); @@ -337,7 +337,7 @@ Temp_Calibration_Dlg::Temp_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plat Layout(); Fit(); - auto validate_text = [this](TextInput* ti){ + auto validate_text = [](TextInput* ti){ unsigned long t = 0; if(!ti->GetTextCtrl()->GetValue().ToULong(&t)) return; diff --git a/src/slic3r/GUI/wxMediaCtrl2.h b/src/slic3r/GUI/wxMediaCtrl2.h index 09e721bda9..21953ed76b 100644 --- a/src/slic3r/GUI/wxMediaCtrl2.h +++ b/src/slic3r/GUI/wxMediaCtrl2.h @@ -38,8 +38,6 @@ class wxMediaCtrl2 : public wxWindow int GetLastError() const { return m_error; } - static constexpr wxMediaState MEDIASTATE_BUFFERING = (wxMediaState) 6; - protected: void DoSetSize(int x, int y, int width, int height, int sizeFlags) override; diff --git a/src/slic3r/Utils/CalibUtils.cpp b/src/slic3r/Utils/CalibUtils.cpp index c33b7b4775..d96e9137e4 100644 --- a/src/slic3r/Utils/CalibUtils.cpp +++ b/src/slic3r/Utils/CalibUtils.cpp @@ -905,10 +905,10 @@ void CalibUtils::calib_pa_pattern(const CalibInfo &calib_info, Model& model) float nozzle_diameter = printer_config.option("nozzle_diameter")->get_at(0); - for (const auto opt : SuggestedConfigCalibPAPattern().float_pairs) { + for (const auto& opt : SuggestedConfigCalibPAPattern().float_pairs) { print_config.set_key_value(opt.first, new ConfigOptionFloat(opt.second)); } - for (const auto opt : SuggestedConfigCalibPAPattern().floats_pairs) { + for (const auto& opt : SuggestedConfigCalibPAPattern().floats_pairs) { print_config.set_key_value(opt.first, new ConfigOptionFloatsNullable(opt.second)); } @@ -917,11 +917,11 @@ void CalibUtils::calib_pa_pattern(const CalibInfo &calib_info, Model& model) ConfigOptionFloatsNullable *wall_speed_speed_opt = print_config.option("outer_wall_speed"); wall_speed_speed_opt->values[index] = wall_speed; - for (const auto opt : SuggestedConfigCalibPAPattern().nozzle_ratio_pairs) { + for (const auto& opt : SuggestedConfigCalibPAPattern().nozzle_ratio_pairs) { print_config.set_key_value(opt.first, new ConfigOptionFloat(nozzle_diameter * opt.second / 100)); } - for (const auto opt : SuggestedConfigCalibPAPattern().int_pairs) { + for (const auto& opt : SuggestedConfigCalibPAPattern().int_pairs) { print_config.set_key_value(opt.first, new ConfigOptionInt(opt.second)); } @@ -955,8 +955,8 @@ void CalibUtils::set_for_auto_pa_model_and_config(const std::vector & float nozzle_diameter = full_config.option("nozzle_diameter")->get_at(0); int extruder_count = full_config.option("nozzle_diameter")->values.size(); - for (const auto opt : SuggestedConfigCalibPAPattern().float_pairs) { print_config.set_key_value(opt.first, new ConfigOptionFloat(opt.second)); } - for (const auto opt : SuggestedConfigCalibPAPattern().floats_pairs) { print_config.set_key_value(opt.first, new ConfigOptionFloatsNullable(opt.second)); } + for (const auto& opt : SuggestedConfigCalibPAPattern().float_pairs) { print_config.set_key_value(opt.first, new ConfigOptionFloat(opt.second)); } + for (const auto& opt : SuggestedConfigCalibPAPattern().floats_pairs) { print_config.set_key_value(opt.first, new ConfigOptionFloatsNullable(opt.second)); } std::vector sorted_calib_infos = calib_infos; std::sort(sorted_calib_infos.begin(), sorted_calib_infos.end(), [](const CalibInfo &left_item, const CalibInfo &right_item) { @@ -975,11 +975,11 @@ void CalibUtils::set_for_auto_pa_model_and_config(const std::vector & object->config.set_key_value("outer_wall_speed", new ConfigOptionFloatsNullable(new_speeds)); } - for (const auto opt : SuggestedConfigCalibPAPattern().nozzle_ratio_pairs) { + for (const auto& opt : SuggestedConfigCalibPAPattern().nozzle_ratio_pairs) { print_config.set_key_value(opt.first, new ConfigOptionFloat(nozzle_diameter * opt.second / 100)); } - for (const auto opt : SuggestedConfigCalibPAPattern().int_pairs) { print_config.set_key_value(opt.first, new ConfigOptionInt(opt.second)); } + for (const auto& opt : SuggestedConfigCalibPAPattern().int_pairs) { print_config.set_key_value(opt.first, new ConfigOptionInt(opt.second)); } print_config.set_key_value(SuggestedConfigCalibPAPattern().brim_pair.first, new ConfigOptionEnum(SuggestedConfigCalibPAPattern().brim_pair.second)); @@ -1180,7 +1180,7 @@ bool CalibUtils::calib_generic_auto_pa_cali(const std::vector &calib_ js["nozzle_diameter"] = nozzle_diameter; std::string filament_ids; - for (const auto calib_info : calib_infos) { + for (const auto& calib_info : calib_infos) { filament_ids += calib_info.filament_prest->filament_id; filament_ids += " "; } diff --git a/src/slic3r/Utils/CertificateVerify.cpp b/src/slic3r/Utils/CertificateVerify.cpp index 4ef95159f0..f4a7ea6d11 100644 --- a/src/slic3r/Utils/CertificateVerify.cpp +++ b/src/slic3r/Utils/CertificateVerify.cpp @@ -12,7 +12,9 @@ namespace Slic3r { #if defined(_WIN32) +#ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0601 +#endif #include #include diff --git a/src/slic3r/Utils/HelioDragon.cpp b/src/slic3r/Utils/HelioDragon.cpp index 60b86e38c1..6349e0ea87 100644 --- a/src/slic3r/Utils/HelioDragon.cpp +++ b/src/slic3r/Utils/HelioDragon.cpp @@ -525,7 +525,7 @@ HelioQuery::PollResult HelioQuery::poll_gcode_status(const std::string& helio_ap //tudo } }) - .on_error([&result](std::string /*poll_body*/, std::string /*poll_error*/, unsigned /*poll_status*/) { + .on_error([](std::string /*poll_body*/, std::string /*poll_error*/, unsigned /*poll_status*/) { // Optionally handle polling error }) .perform_sync(); @@ -795,10 +795,10 @@ std::string HelioQuery::create_optimization_default_get(const std::string helio_ .on_header_callback([&response_headers](std::string headers) { response_headers += headers; }) - .on_complete([&res](std::string body, unsigned status) { + .on_complete([](std::string body, unsigned status) { nlohmann::json parsed_obj = nlohmann::json::parse(body); }) - .on_error([&res, &response_headers](std::string body, std::string error, unsigned status) { + .on_error([&response_headers](std::string body, std::string error, unsigned status) { auto err = error; auto c =response_headers; }) @@ -1276,7 +1276,7 @@ void HelioBackgroundProcess::helio_threaded_process_start(std::mutex& set_state(STATE_RUNNING); std::unique_lock slicing_lck(slicing_mutex); - slicing_condition.wait(slicing_lck, [this, &slicing_state]() { + slicing_condition.wait(slicing_lck, [&slicing_state]() { return slicing_state == BackgroundSlicingProcess::STATE_FINISHED || slicing_state == BackgroundSlicingProcess::STATE_CANCELED || slicing_state == BackgroundSlicingProcess::STATE_IDLE; }); diff --git a/src/slic3r/Utils/Http.cpp b/src/slic3r/Utils/Http.cpp index 0d404d52f2..8704e1cf6c 100644 --- a/src/slic3r/Utils/Http.cpp +++ b/src/slic3r/Utils/Http.cpp @@ -234,8 +234,6 @@ int Http::priv::xfercb(void *userp, curl_off_t dltotal, curl_off_t dlnow, curl_o if (self->progressfn) { double speed; curl_easy_getinfo(self->curl, CURLINFO_SPEED_UPLOAD, &speed); - if (speed > 0.01) - speed = speed; Progress progress(dltotal, dlnow, ultotal, ulnow, speed); self->progressfn(progress, cb_cancel); } diff --git a/src/slic3r/Utils/NetworkAgent.cpp b/src/slic3r/Utils/NetworkAgent.cpp index 61861062b3..d0060ab84a 100644 --- a/src/slic3r/Utils/NetworkAgent.cpp +++ b/src/slic3r/Utils/NetworkAgent.cpp @@ -1209,7 +1209,7 @@ std::string NetworkAgent::request_setting_id(std::string name, std::map* values_map, unsigned int* http_code) { - int ret; + int ret = 0; if (network_agent && put_setting_ptr) { ret = put_setting_ptr(network_agent, setting_id, name, values_map, http_code); BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" : network_agent=%1%, setting_id=%2%, name=%3%, http_code=%4%, ret=%5%") @@ -1368,7 +1368,7 @@ int NetworkAgent::get_subtask_info(std::string subtask_id, std::string* task_jso int NetworkAgent::get_slice_info(std::string project_id, std::string profile_id, int plate_index, std::string* slice_json) { - int ret; + int ret = 0; if (network_agent && get_slice_info_ptr) { ret = get_slice_info_ptr(network_agent, project_id, profile_id, plate_index, slice_json); BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(" : network_agent=%1%, project_id=%2%, profile_id=%3%, plate_index=%4%, slice_json=%5%") @@ -1379,7 +1379,7 @@ int NetworkAgent::get_slice_info(std::string project_id, std::string profile_id, int NetworkAgent::query_bind_status(std::vector query_list, unsigned int* http_code, std::string* http_body) { - int ret; + int ret = 0; if (network_agent && query_bind_status_ptr) { ret = query_bind_status_ptr(network_agent, query_list, http_code, http_body); if (ret) diff --git a/src/slic3r/Utils/PresetUpdater.cpp b/src/slic3r/Utils/PresetUpdater.cpp index 09792e6f9f..e80320992c 100644 --- a/src/slic3r/Utils/PresetUpdater.cpp +++ b/src/slic3r/Utils/PresetUpdater.cpp @@ -549,7 +549,7 @@ bool PresetUpdater::priv::sync_resources(std::string http_url, std::map it_time) { - for (it_time; it_time < it_active; ++it_time) { + while (it_time < it_active) { if (snapshot_modifies_project(*it_time)) return true; + ++it_time; } } else { - for (it_active; it_active < it_time; ++it_active) { + while (it_active < it_time) { if (snapshot_modifies_project(*it_active)) return true; + ++it_active; } } return false;