diff --git a/src/OrcaSlicer.cpp b/src/OrcaSlicer.cpp index 71d6ffde80..8176e9f444 100644 --- a/src/OrcaSlicer.cpp +++ b/src/OrcaSlicer.cpp @@ -3,7 +3,9 @@ #define _WIN32_WINNT 0x0502 // The standard Windows includes. #define WIN32_LEAN_AND_MEAN + #ifndef NOMINMAX #define NOMINMAX + #endif #include #include #include diff --git a/src/OrcaSlicer_app_msvc.cpp b/src/OrcaSlicer_app_msvc.cpp index b1e498f4e4..35568a9cfa 100644 --- a/src/OrcaSlicer_app_msvc.cpp +++ b/src/OrcaSlicer_app_msvc.cpp @@ -2,7 +2,9 @@ #define _WIN32_WINNT 0x0502 // The standard Windows includes. #define WIN32_LEAN_AND_MEAN +#ifndef NOMINMAX #define NOMINMAX +#endif #include #include #include diff --git a/src/libslic3r/Config.cpp b/src/libslic3r/Config.cpp index a43f659be6..242e4bb146 100644 --- a/src/libslic3r/Config.cpp +++ b/src/libslic3r/Config.cpp @@ -2031,7 +2031,8 @@ 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; + static const double zero = 0.0; + return zero; } } diff --git a/src/libslic3r/FilamentGroup.cpp b/src/libslic3r/FilamentGroup.cpp index 97da94652c..07a4cc2449 100644 --- a/src/libslic3r/FilamentGroup.cpp +++ b/src/libslic3r/FilamentGroup.cpp @@ -1021,7 +1021,7 @@ namespace Slic3r if (FGMode::MatchMode == ctx.group_info.mode) return calc_filament_group_for_match(cost); } - catch (const FilamentGroupException& e) { + catch (const FilamentGroupException&) { } return calc_filament_group_for_flush(cost); diff --git a/src/libslic3r/Format/STEP.cpp b/src/libslic3r/Format/STEP.cpp index f82ced7d86..a5c3bb49a2 100644 --- a/src/libslic3r/Format/STEP.cpp +++ b/src/libslic3r/Format/STEP.cpp @@ -712,7 +712,7 @@ unsigned int Step::get_triangle_num(double linear_deflection, double angle_defle return 0; } } - } catch(const Exception &e) { + } catch(const Exception &) { return 0; } diff --git a/src/libslic3r/OpenVDBUtils.cpp b/src/libslic3r/OpenVDBUtils.cpp index 72c7668a45..c72607f14f 100644 --- a/src/libslic3r/OpenVDBUtils.cpp +++ b/src/libslic3r/OpenVDBUtils.cpp @@ -1,4 +1,6 @@ +#ifndef NOMINMAX #define NOMINMAX +#endif #include "OpenVDBUtils.hpp" #ifdef _MSC_VER diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 1334bd4e7a..f48f151357 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -8,7 +8,9 @@ #ifdef _MSC_VER #define WIN32_LEAN_AND_MEAN + #ifndef NOMINMAX #define NOMINMAX + #endif #include #endif /* _MSC_VER */ diff --git a/src/libslic3r/SLA/SupportTreeBuilder.cpp b/src/libslic3r/SLA/SupportTreeBuilder.cpp index 86339d2acf..4080c4fc3f 100644 --- a/src/libslic3r/SLA/SupportTreeBuilder.cpp +++ b/src/libslic3r/SLA/SupportTreeBuilder.cpp @@ -1,4 +1,6 @@ +#ifndef NOMINMAX #define NOMINMAX +#endif #include #include diff --git a/src/slic3r/GUI/DeviceCore/DevStatus.cpp b/src/slic3r/GUI/DeviceCore/DevStatus.cpp index 26d2bc4ceb..e37a0f9abc 100644 --- a/src/slic3r/GUI/DeviceCore/DevStatus.cpp +++ b/src/slic3r/GUI/DeviceCore/DevStatus.cpp @@ -27,6 +27,7 @@ void DevStatus::ParseStatus(const nlohmann::json& print_jj) #else BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": get exception=" << e.what(); #endif + (void)e; // suppress C4101 when BBL_RELEASE_TO_PUBLIC } } diff --git a/src/slic3r/GUI/DownloadProgressDialog.cpp b/src/slic3r/GUI/DownloadProgressDialog.cpp index 9bc0d90e5e..1c5ff4c3d7 100644 --- a/src/slic3r/GUI/DownloadProgressDialog.cpp +++ b/src/slic3r/GUI/DownloadProgressDialog.cpp @@ -26,8 +26,6 @@ #include "Widgets/HyperLink.hpp" // ORCA -#define DESIGN_INPUT_SIZE wxSize(FromDIP(100), -1) - namespace Slic3r { namespace GUI { diff --git a/src/slic3r/GUI/GUI.cpp b/src/slic3r/GUI/GUI.cpp index 29f8fc9749..78a511c90c 100644 --- a/src/slic3r/GUI/GUI.cpp +++ b/src/slic3r/GUI/GUI.cpp @@ -18,7 +18,9 @@ #import #elif _WIN32 #define WIN32_LEAN_AND_MEAN +#ifndef NOMINMAX #define NOMINMAX +#endif #include #include "boost/nowide/convert.hpp" #endif diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMeasure.cpp b/src/slic3r/GUI/Gizmos/GLGizmoMeasure.cpp index 0a3936a81b..e21498163a 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMeasure.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMeasure.cpp @@ -597,7 +597,6 @@ void GLGizmoMeasure::on_render() } } Vec3d position_on_model; - Vec3d direction_on_model; size_t model_facet_idx = -1; double closest_hit_distance = std::numeric_limits::max(); { diff --git a/src/slic3r/GUI/ImGuiWrapper.cpp b/src/slic3r/GUI/ImGuiWrapper.cpp index d46e8ed31b..0d127f524b 100644 --- a/src/slic3r/GUI/ImGuiWrapper.cpp +++ b/src/slic3r/GUI/ImGuiWrapper.cpp @@ -3332,8 +3332,9 @@ const char* ImGuiWrapper::clipboard_get(void* user_data) wxTextDataObject data; wxTheClipboard->GetData(data); - if (data.GetTextLength() > 0) { - self->m_clipboard_text = into_u8(data.GetText()); + const wxString text = data.GetText(); + if (text.Length() > 0) { + self->m_clipboard_text = into_u8(text); res = self->m_clipboard_text.c_str(); } } diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index 910c761c06..5e8ee31363 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -4445,8 +4445,6 @@ void PartPlateList::set_default_wipe_tower_pos_for_plate(int plate_idx, bool ini //this may be happened after machine changed void PartPlateList::reset_size(int width, int depth, int height, bool reload_objects, bool update_shapes) { - Vec3d origin1, origin2; - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(":before size: plate_width %1%, plate_depth %2%, plate_height %3%") % m_plate_width % m_plate_depth % m_plate_height; BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(":after size: plate_width %1%, plate_depth %2%, plate_height %3%") % width % depth % height; if ((m_plate_width != width) || (m_plate_depth != depth) || (m_plate_height != height)) diff --git a/src/slic3r/GUI/SysInfoDialog.cpp b/src/slic3r/GUI/SysInfoDialog.cpp index 933cfb4d7c..585767d318 100644 --- a/src/slic3r/GUI/SysInfoDialog.cpp +++ b/src/slic3r/GUI/SysInfoDialog.cpp @@ -21,7 +21,9 @@ #ifdef _WIN32 // The standard Windows includes. #define WIN32_LEAN_AND_MEAN + #ifndef NOMINMAX #define NOMINMAX + #endif #include #include #endif /* _WIN32 */ diff --git a/src/slic3r/GUI/Widgets/Button.cpp b/src/slic3r/GUI/Widgets/Button.cpp index 74ed2cbadd..5a5bd89403 100644 --- a/src/slic3r/GUI/Widgets/Button.cpp +++ b/src/slic3r/GUI/Widgets/Button.cpp @@ -503,8 +503,8 @@ void Button::OnParentMotion(wxMouseEvent& event) { if (!tipWindow) { - tipWindow = new wxTipWindow(this, tip); - tipWindow->Bind(wxEVT_DESTROY, [this](wxEvent& event) { this->tipWindow = nullptr;}); + tipWindow = wxTipWindow::New(this, tip); + if (!tipWindow) return event.Skip(); tipWindow->Enable(false); } @@ -522,7 +522,8 @@ void Button::OnParentMotion(wxMouseEvent& event) { if (tipWindow) { - delete tipWindow; + tipWindow->Dismiss(); + tipWindow->Destroy(); tipWindow = nullptr; } } @@ -543,7 +544,7 @@ void Button::OnParentLeave(wxMouseEvent& event) if (!screen_rect.Contains(pos)) { tipWindow->Dismiss(); - delete tipWindow; + tipWindow->Destroy(); tipWindow = nullptr; } } diff --git a/src/slic3r/GUI/Widgets/Button.hpp b/src/slic3r/GUI/Widgets/Button.hpp index c98d583c34..2991edd425 100644 --- a/src/slic3r/GUI/Widgets/Button.hpp +++ b/src/slic3r/GUI/Widgets/Button.hpp @@ -3,6 +3,7 @@ #include "../wxExtensions.hpp" #include "StaticBox.hpp" +#include class ButtonProps { @@ -27,9 +28,9 @@ enum class ButtonType{ Expanded , // Font14 Semi-Rounded For full length buttons. ex. buttons in static box }; -class wxTipWindow; class Button : public StaticBox { + wxTipWindow::Ref tipWindow; wxRect textSize; wxSize minSize; // set by outer wxSize paddingSize; @@ -43,8 +44,6 @@ class Button : public StaticBox bool isCenter = true; bool vertical = false; - wxTipWindow* tipWindow = nullptr; - static const int buttonWidth = 200; static const int buttonHeight = 50; diff --git a/src/slic3r/Utils/ASCIIFolding.cpp b/src/slic3r/Utils/ASCIIFolding.cpp index 0eb02a5f8c..016c30fcde 100644 --- a/src/slic3r/Utils/ASCIIFolding.cpp +++ b/src/slic3r/Utils/ASCIIFolding.cpp @@ -4,7 +4,6 @@ #include #include #include -#include #include namespace Slic3r { @@ -1953,8 +1952,7 @@ std::string fold_utf8_to_ascii(const std::string &src, bool is_convert_for_filen for (wchar_t c : wstr) fold_to_ascii(c, out); if (is_convert_for_filename) { - std::wstring_convert> converter; - auto dstStr = converter.to_bytes(dst); + auto dstStr = boost::locale::conv::utf_to_utf(dst.c_str(), dst.c_str() + dst.size()); std::size_t found = dstStr.find_last_of("/\\"); if (found != std::string::npos) { @@ -1964,7 +1962,7 @@ std::string fold_utf8_to_ascii(const std::string &src, bool is_convert_for_filen std::string newFileName = regex_replace(filename, reg, ""); dstStr = dir + "\\" + newFileName; } - dst = converter.from_bytes(dstStr); + dst = boost::locale::conv::utf_to_utf(dstStr.c_str(), dstStr.c_str() + dstStr.size()); } return boost::locale::conv::utf_to_utf(dst.c_str(), dst.c_str() + dst.size()); diff --git a/src/slic3r/Utils/OrcaCloudServiceAgent.cpp b/src/slic3r/Utils/OrcaCloudServiceAgent.cpp index a372ab5b7c..4419395b4d 100644 --- a/src/slic3r/Utils/OrcaCloudServiceAgent.cpp +++ b/src/slic3r/Utils/OrcaCloudServiceAgent.cpp @@ -572,7 +572,7 @@ int OrcaCloudServiceAgent::set_config_dir(std::string cfg_dir) { config_dir = cfg_dir; wxFileName fallback(wxString::FromUTF8(cfg_dir.c_str()), secret_constants::USER_SECRET_FILENAME); - fallback.Normalize(); + fallback.MakeAbsolute(); secret_fallback_path = fallback.GetFullPath().ToStdString(); return BAMBU_NETWORK_SUCCESS; } @@ -1564,7 +1564,7 @@ void OrcaCloudServiceAgent::persist_user_secret(const std::string& secret) return; } wxFileName path(wxString::FromUTF8(secret_fallback_path.c_str())); - path.Normalize(); + path.MakeAbsolute(); if (!wxFileName::DirExists(path.GetPath())) { wxFileName::Mkdir(path.GetPath(), wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL); } @@ -2487,7 +2487,7 @@ void OrcaCloudServiceAgent::compute_fallback_path() if (wxTheApp == nullptr) return; wxFileName fallback(wxStandardPaths::Get().GetUserDataDir(), "orca_refresh_token.sec"); - fallback.Normalize(); + fallback.MakeAbsolute(); secret_fallback_path = fallback.GetFullPath().ToStdString(); } @@ -3581,7 +3581,7 @@ std::string OrcaCloudServiceAgent::token_lock_path() const if (config_dir.empty()) return {}; wxFileName lock(wxString::FromUTF8(config_dir.c_str()), "orca_refresh_token.lock"); - lock.Normalize(); + lock.MakeAbsolute(); return lock.GetFullPath().ToStdString(); }