Merge branch 'lm_warnings': Fixes lots of Clang warnings

This commit is contained in:
Lukas Matena 2021-02-08 18:04:36 +01:00
commit 8fbafbea87
63 changed files with 192 additions and 224 deletions

View file

@ -202,6 +202,13 @@ if (NOT MSVC AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMP
add_compile_options(-Wno-ignored-attributes) # Tamas: Eigen include dirs are marked as SYSTEM
endif()
# Clang reports legacy OpenGL calls as deprecated. Turn off the warning for now
# to reduce the clutter, we know about this one. It should be reenabled after
# we finally get rid of the deprecated code.
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
add_compile_options(-Wno-deprecated-declarations)
endif()
#GCC generates loads of -Wunknown-pragmas when compiling igl. The fix is not easy due to a bug in gcc, see
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66943 or
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431

View file

@ -653,7 +653,7 @@ inline bool intersect_ray_all_hits(
std::vector<igl::Hit> &hits)
{
auto ray_intersector = detail::RayIntersectorHits<VertexType, IndexedFaceType, TreeType, VectorType> {
vertices, faces, tree,
vertices, faces, {tree},
origin, dir, VectorType(dir.cwiseInverse())
};
if (! tree.empty()) {

View file

@ -266,14 +266,14 @@ void AppConfig::save()
else
c << "# " << Slic3r::header_gcodeviewer_generated() << std::endl;
// Make sure the "no" category is written first.
for (const std::pair<std::string, std::string> &kvp : m_storage[""])
for (const auto& kvp : m_storage[""])
c << kvp.first << " = " << kvp.second << std::endl;
// Write the other categories.
for (const auto category : m_storage) {
for (const auto& category : m_storage) {
if (category.first.empty())
continue;
c << std::endl << "[" << category.first << "]" << std::endl;
for (const std::pair<std::string, std::string> &kvp : category.second)
for (const auto& kvp : category.second)
c << kvp.first << " = " << kvp.second << std::endl;
}
// Write vendor sections
@ -395,7 +395,7 @@ std::vector<std::string> AppConfig::get_mouse_device_names() const
static constexpr const char *prefix = "mouse_device:";
static const size_t prefix_len = strlen(prefix);
std::vector<std::string> out;
for (const std::pair<std::string, std::map<std::string, std::string>>& key_value_pair : m_storage)
for (const auto& key_value_pair : m_storage)
if (boost::starts_with(key_value_pair.first, prefix) && key_value_pair.first.size() > prefix_len)
out.emplace_back(key_value_pair.first.substr(prefix_len));
return out;

View file

@ -1344,7 +1344,7 @@ public:
static bool has(T value)
{
for (const std::pair<std::string, int> &kvp : ConfigOptionEnum<T>::get_enum_values())
for (const auto &kvp : ConfigOptionEnum<T>::get_enum_values())
if (kvp.second == value)
return true;
return false;
@ -1358,11 +1358,11 @@ public:
// Initialize the map.
const t_config_enum_values &enum_keys_map = ConfigOptionEnum<T>::get_enum_values();
int cnt = 0;
for (const std::pair<std::string, int> &kvp : enum_keys_map)
for (const auto& kvp : enum_keys_map)
cnt = std::max(cnt, kvp.second);
cnt += 1;
names.assign(cnt, "");
for (const std::pair<std::string, int> &kvp : enum_keys_map)
for (const auto& kvp : enum_keys_map)
names[kvp.second] = kvp.first;
}
return names;

View file

@ -12,7 +12,7 @@ class Surface;
class FillRectilinear : public Fill
{
public:
Fill* clone() const override { return new FillRectilinear(*this); };
Fill* clone() const override { return new FillRectilinear(*this); }
~FillRectilinear() override = default;
Polylines fill_surface(const Surface *surface, const FillParams &params) override;
@ -32,18 +32,18 @@ protected:
class FillAlignedRectilinear : public FillRectilinear
{
public:
Fill* clone() const override { return new FillAlignedRectilinear(*this); };
Fill* clone() const override { return new FillAlignedRectilinear(*this); }
~FillAlignedRectilinear() override = default;
protected:
// Always generate infill at the same angle.
virtual float _layer_angle(size_t idx) const { return 0.f; }
virtual float _layer_angle(size_t idx) const override { return 0.f; }
};
class FillMonotonic : public FillRectilinear
{
public:
Fill* clone() const override { return new FillMonotonic(*this); };
Fill* clone() const override { return new FillMonotonic(*this); }
~FillMonotonic() override = default;
Polylines fill_surface(const Surface *surface, const FillParams &params) override;
bool no_sort() const override { return true; }
@ -52,7 +52,7 @@ public:
class FillGrid : public FillRectilinear
{
public:
Fill* clone() const override { return new FillGrid(*this); };
Fill* clone() const override { return new FillGrid(*this); }
~FillGrid() override = default;
Polylines fill_surface(const Surface *surface, const FillParams &params) override;
@ -64,7 +64,7 @@ protected:
class FillTriangles : public FillRectilinear
{
public:
Fill* clone() const override { return new FillTriangles(*this); };
Fill* clone() const override { return new FillTriangles(*this); }
~FillTriangles() override = default;
Polylines fill_surface(const Surface *surface, const FillParams &params) override;
@ -76,7 +76,7 @@ protected:
class FillStars : public FillRectilinear
{
public:
Fill* clone() const override { return new FillStars(*this); };
Fill* clone() const override { return new FillStars(*this); }
~FillStars() override = default;
Polylines fill_surface(const Surface *surface, const FillParams &params) override;
@ -88,7 +88,7 @@ protected:
class FillCubic : public FillRectilinear
{
public:
Fill* clone() const override { return new FillCubic(*this); };
Fill* clone() const override { return new FillCubic(*this); }
~FillCubic() override = default;
Polylines fill_surface(const Surface *surface, const FillParams &params) override;
@ -98,6 +98,6 @@ protected:
};
}; // namespace Slic3r
} // namespace Slic3r
#endif // slic3r_FillRectilinear_hpp_

View file

@ -124,7 +124,6 @@ const char* VALID_OBJECT_TYPES[] =
"model"
};
const unsigned int INVALID_OBJECT_TYPES_COUNT = 4;
const char* INVALID_OBJECT_TYPES[] =
{
"solidsupport",

View file

@ -851,7 +851,7 @@ namespace DoExport {
double extruded_volume = extruder.extruded_volume() + (has_wipe_tower ? wipe_tower_data.used_filament[extruder.id()] * 2.4052f : 0.f); // assumes 1.75mm filament diameter
double filament_weight = extruded_volume * extruder.filament_density() * 0.001;
double filament_cost = filament_weight * extruder.filament_cost() * 0.001;
auto append = [&extruder, &extruders](std::pair<std::string, unsigned int> &dst, const char *tmpl, double value) {
auto append = [&extruder](std::pair<std::string, unsigned int> &dst, const char *tmpl, double value) {
while (dst.second < extruder.id()) {
// Fill in the non-printing extruders with zeros.
dst.first += (dst.second > 0) ? ", 0" : "0";

View file

@ -664,7 +664,7 @@ static std::vector<size_t> find_enforcer_centers(const Polygon& polygon,
if (polygon.size() < 2 || enforcers_idxs.empty())
return out;
auto get_center_idx = [&polygon, &lengths](size_t start_idx, size_t end_idx) -> size_t {
auto get_center_idx = [&lengths](size_t start_idx, size_t end_idx) -> size_t {
assert(end_idx >= start_idx);
if (start_idx == end_idx)
return start_idx;

View file

@ -405,7 +405,7 @@ public:
WipeTowerWriter& append(const std::string& text) { m_gcode += text; return *this; }
std::vector<Vec2f> wipe_path() const
const std::vector<Vec2f>& wipe_path() const
{
return m_wipe_path;
}

View file

@ -213,7 +213,7 @@ inline bool liang_barsky_line_clipping_interval(
double t0 = 0.0;
double t1 = 1.0;
// Traverse through left, right, bottom, top edges.
auto clip_side = [&x0, &v, &bbox, &t0, &t1](double p, double q) -> bool {
auto clip_side = [&t0, &t1](double p, double q) -> bool {
if (p == 0) {
if (q < 0)
// Line parallel to the bounding box edge is fully outside of the bounding box.

View file

@ -290,7 +290,7 @@ void LayerRegion::process_external_surfaces(const Layer *lower_layer, const Poly
surfaces_append(bottom, union_ex(grown, true), bridges[idx_last]);
}
fill_boundaries = std::move(to_polygons(fill_boundaries_ex));
fill_boundaries = to_polygons(fill_boundaries_ex);
BOOST_LOG_TRIVIAL(trace) << "Processing external surface, detecting bridges - done";
}
@ -327,7 +327,7 @@ void LayerRegion::process_external_surfaces(const Layer *lower_layer, const Poly
surfaces_append(
new_surfaces,
// Don't use a safety offset as fill_boundaries were already united using the safety offset.
std::move(intersection_ex(polys, fill_boundaries, false)),
intersection_ex(polys, fill_boundaries, false),
s1);
}
}
@ -424,7 +424,7 @@ void LayerRegion::elephant_foot_compensation_step(const float elephant_foot_comp
Polygons slices_polygons = to_polygons(slices_expolygons);
Polygons tmp = intersection(slices_polygons, trimming_polygons, false);
append(tmp, diff(slices_polygons, offset(offset_ex(slices_expolygons, -elephant_foot_compensation_perimeter_step), elephant_foot_compensation_perimeter_step)));
this->slices.set(std::move(union_ex(tmp)), stInternal);
this->slices.set(union_ex(tmp), stInternal);
}
void LayerRegion::export_region_slices_to_svg(const char *path) const

View file

@ -297,7 +297,7 @@ template<class Rst> class Grid {
case SquareTag::full:
case SquareTag::none: {
Coord crd{tl(cell) + Coord{m_cellsize.r / 2, m_cellsize.c / 2}};
return {{crd, Dir::none, m_rst}, crd};
return {{crd, Dir::none, m_rst}, {crd}};
}
}

View file

@ -915,7 +915,7 @@ void PresetBundle::load_config_file_config_bundle(const std::string &path, const
std::string bundle_name = std::string(" - ") + boost::filesystem::path(path).filename().string();
// 2) Extract active configs from the config bundle, copy them and activate them in this bundle.
auto load_one = [this, &path, &bundle_name](PresetCollection &collection_dst, PresetCollection &collection_src, const std::string &preset_name_src, bool activate) -> std::string {
auto load_one = [&path, &bundle_name](PresetCollection &collection_dst, PresetCollection &collection_src, const std::string &preset_name_src, bool activate) -> std::string {
Preset *preset_src = collection_src.find_preset(preset_name_src, false);
Preset *preset_dst = collection_dst.find_preset(preset_name_src, false);
assert(preset_src != nullptr);

View file

@ -1405,7 +1405,7 @@ std::string Print::validate() const
return L("One or more object were assigned an extruder that the printer does not have.");
#endif
auto validate_extrusion_width = [min_nozzle_diameter, max_nozzle_diameter](const ConfigBase &config, const char *opt_key, double layer_height, std::string &err_msg) -> bool {
auto validate_extrusion_width = [/*min_nozzle_diameter,*/ max_nozzle_diameter](const ConfigBase &config, const char *opt_key, double layer_height, std::string &err_msg) -> bool {
// This may change in the future, if we switch to "extrusion width wrt. nozzle diameter"
// instead of currently used logic "extrusion width wrt. layer height", see GH issues #1923 #2829.
// double extrusion_width_min = config.get_abs_value(opt_key, min_nozzle_diameter);

View file

@ -908,7 +908,7 @@ void PrintObject::detect_surfaces_type()
// Fill in layerm->fill_surfaces by trimming the layerm->slices by the cummulative layerm->fill_surfaces.
tbb::parallel_for(
tbb::blocked_range<size_t>(0, m_layers.size()),
[this, idx_region, interface_shells](const tbb::blocked_range<size_t>& range) {
[this, idx_region](const tbb::blocked_range<size_t>& range) {
for (size_t idx_layer = range.begin(); idx_layer < range.end(); ++ idx_layer) {
m_print->throw_if_canceled();
LayerRegion *layerm = m_layers[idx_layer]->m_regions[idx_region];

View file

@ -41,7 +41,7 @@ template<> struct _ccr<true>
static void for_each(It from, It to, Fn &&fn, size_t granularity = 1)
{
tbb::parallel_for(tbb::blocked_range{from, to, granularity},
[&fn, from](const auto &range) {
[&fn](const auto &range) {
loop_(range, std::forward<Fn>(fn));
});
}

View file

@ -55,8 +55,6 @@ public:
}
};
static const constexpr double MESH_EPS = 1e-6;
IndexedMesh::IndexedMesh(const TriangleMesh& tmesh)
: m_aabb(new AABBImpl()), m_tm(&tmesh)
{

View file

@ -165,7 +165,7 @@ XYRotation from_transform3d(const Transform3d &tr)
template<size_t N, class Fn, class It, class StopCond>
std::array<double, N> find_min_score(Fn &&fn, It from, It to, StopCond &&stopfn)
{
std::array<double, N> ret;
std::array<double, N> ret = {};
double score = std::numeric_limits<double>::max();

View file

@ -424,7 +424,7 @@ public:
void clear() override;
bool empty() const override { return m_objects.empty(); }
// List of existing PrintObject IDs, to remove notifications for non-existent IDs.
std::vector<ObjectID> print_object_ids() const;
std::vector<ObjectID> print_object_ids() const override;
ApplyStatus apply(const Model &model, DynamicPrintConfig config) override;
void set_task(const TaskParams &params) override;
void process() override;

View file

@ -1423,7 +1423,7 @@ static inline void do_crossover(const std::vector<FlipEdge> &edges_in, std::vect
const std::pair<size_t, size_t> &span2, bool reversed2, bool flipped2,
const std::pair<size_t, size_t> &span3, bool reversed3, bool flipped3) {
auto it_edges_out = edges_out.begin();
auto copy_span = [&edges_in, &edges_out, &it_edges_out](std::pair<size_t, size_t> span, bool reversed, bool flipped) {
auto copy_span = [&edges_in, &it_edges_out](std::pair<size_t, size_t> span, bool reversed, bool flipped) {
assert(span.first < span.second);
auto it = it_edges_out;
if (reversed)
@ -1466,7 +1466,7 @@ static inline void do_crossover(const std::vector<FlipEdge> &edges_in, std::vect
const std::pair<size_t, size_t> &span3, bool reversed3, bool flipped3,
const std::pair<size_t, size_t> &span4, bool reversed4, bool flipped4) {
auto it_edges_out = edges_out.begin();
auto copy_span = [&edges_in, &edges_out, &it_edges_out](std::pair<size_t, size_t> span, bool reversed, bool flipped) {
auto copy_span = [&edges_in, &it_edges_out](std::pair<size_t, size_t> span, bool reversed, bool flipped) {
assert(span.first < span.second);
auto it = it_edges_out;
if (reversed)

View file

@ -1582,7 +1582,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::bottom_conta
});
Polygons &layer_support_area = layer_support_areas[layer_id];
task_group.run([this, &projection, &projection_raw, &layer, &layer_support_area, layer_id] {
task_group.run([this, &projection, &projection_raw, &layer, &layer_support_area] {
// Remove the areas that touched from the projection that will continue on next, lower, top surfaces.
// Polygons trimming = union_(to_polygons(layer.slices), touching, true);
Polygons trimming = offset(layer.lslices, float(SCALED_EPSILON));
@ -1736,7 +1736,7 @@ void PrintObjectSupportMaterial::trim_top_contacts_by_bottom_contacts(
const PrintObject &object, const MyLayersPtr &bottom_contacts, MyLayersPtr &top_contacts) const
{
tbb::parallel_for(tbb::blocked_range<int>(0, int(top_contacts.size())),
[this, &object, &bottom_contacts, &top_contacts](const tbb::blocked_range<int>& range) {
[&bottom_contacts, &top_contacts](const tbb::blocked_range<int>& range) {
int idx_bottom_overlapping_first = -2;
// For all top contact layers, counting downwards due to the way idx_higher_or_equal caches the last index to avoid repeated binary search.
for (int idx_top = range.end() - 1; idx_top >= range.begin(); -- idx_top) {
@ -1965,7 +1965,7 @@ void PrintObjectSupportMaterial::generate_base_layers(
BOOST_LOG_TRIVIAL(debug) << "PrintObjectSupportMaterial::generate_base_layers() in parallel - start";
tbb::parallel_for(
tbb::blocked_range<size_t>(0, intermediate_layers.size()),
[this, &object, &bottom_contacts, &top_contacts, &intermediate_layers, &layer_support_areas](const tbb::blocked_range<size_t>& range) {
[&object, &bottom_contacts, &top_contacts, &intermediate_layers, &layer_support_areas](const tbb::blocked_range<size_t>& range) {
// index -2 means not initialized yet, -1 means intialized and decremented to 0 and then -1.
int idx_top_contact_above = -2;
int idx_bottom_contact_overlapping = -2;
@ -2328,32 +2328,6 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::generate_int
return interface_layers;
}
static inline void fill_expolygons_generate_paths(
ExtrusionEntitiesPtr &dst,
const ExPolygons &expolygons,
Fill *filler,
float density,
ExtrusionRole role,
const Flow &flow)
{
FillParams fill_params;
fill_params.density = density;
fill_params.dont_adjust = true;
for (const ExPolygon &expoly : expolygons) {
Surface surface(stInternal, expoly);
Polylines polylines;
try {
polylines = filler->fill_surface(&surface, fill_params);
} catch (InfillFailedException &) {
}
extrusion_entities_append_paths(
dst,
std::move(polylines),
role,
flow.mm3_per_mm(), flow.width, flow.height);
}
}
static inline void fill_expolygons_generate_paths(
ExtrusionEntitiesPtr &dst,
ExPolygons &&expolygons,

View file

@ -246,7 +246,7 @@ private:
bool m_can_merge_support_regions;
coordf_t m_support_layer_height_min;
coordf_t m_support_layer_height_max;
// coordf_t m_support_layer_height_max;
coordf_t m_gap_xy;
};

View file

@ -103,7 +103,7 @@ enum FacetEdgeType {
class IntersectionReference
{
public:
IntersectionReference() : point_id(-1), edge_id(-1) {};
IntersectionReference() : point_id(-1), edge_id(-1) {}
IntersectionReference(int point_id, int edge_id) : point_id(point_id), edge_id(edge_id) {}
// Where is this intersection point located? On mesh vertex or mesh edge?
// Only one of the following will be set, the other will remain set to -1.
@ -116,7 +116,7 @@ public:
class IntersectionPoint : public Point, public IntersectionReference
{
public:
IntersectionPoint() {};
IntersectionPoint() {}
IntersectionPoint(int point_id, int edge_id, const Point &pt) : IntersectionReference(point_id, edge_id), Point(pt) {}
IntersectionPoint(const IntersectionReference &ir, const Point &pt) : IntersectionReference(ir), Point(pt) {}
// Inherits coord_t x, y

View file

@ -251,7 +251,7 @@ bool Snapshot::equal_to_active(const AppConfig &app_config) const
return false;
matched.insert(vc.name);
}
for (const std::pair<std::string, std::map<std::string, std::set<std::string>>> &v : app_config.vendors())
for (const auto &v : app_config.vendors())
if (matched.find(v.first) == matched.end() && ! v.second.empty())
// There are more vendors currently installed than enabled in the snapshot.
return false;
@ -402,7 +402,7 @@ const Snapshot& SnapshotDB::take_snapshot(const AppConfig &app_config, Snapshot:
snapshot.filaments.emplace_back(app_config.get("presets", name));
}
// Vendor specific config bundles and installed printers.
for (const std::pair<std::string, std::map<std::string, std::set<std::string>>> &vendor : app_config.vendors()) {
for (const auto &vendor : app_config.vendors()) {
Snapshot::VendorConfig cfg;
cfg.name = vendor.first;
cfg.models_variants_installed = vendor.second;

View file

@ -119,7 +119,7 @@ bool BonjourDialog::show_and_lookup()
// Note: More can be done here when we support discovery of hosts other than Octoprint and SL1
Bonjour::TxtKeys txt_keys { "version", "model" };
bonjour = std::move(Bonjour("octoprint")
bonjour = Bonjour("octoprint")
.set_txt_keys(std::move(txt_keys))
.set_retries(3)
.set_timeout(4)
@ -139,8 +139,7 @@ bool BonjourDialog::show_and_lookup()
wxQueueEvent(dialog, evt);
}
})
.lookup()
);
.lookup();
bool res = ShowModal() == wxID_OK && list->GetFirstSelected() >= 0;
{

View file

@ -10,15 +10,6 @@
#include <GL/glew.h>
// phi / theta angles to orient the camera.
static const float VIEW_DEFAULT[2] = { 45.0f, 45.0f };
static const float VIEW_LEFT[2] = { 90.0f, 90.0f };
static const float VIEW_RIGHT[2] = { -90.0f, 90.0f };
static const float VIEW_TOP[2] = { 0.0f, 0.0f };
static const float VIEW_BOTTOM[2] = { 0.0f, 180.0f };
static const float VIEW_FRONT[2] = { 0.0f, 90.0f };
static const float VIEW_REAR[2] = { 180.0f, 90.0f };
namespace Slic3r {
namespace GUI {

View file

@ -68,7 +68,7 @@ static wxString generate_html_row(const Config::Snapshot &snapshot, bool row_eve
if (vc.version.max_slic3r_version != Semver::inf())
text += ", " + _(L("max PrusaSlicer version")) + ": " + vc.version.max_slic3r_version.to_string();
text += "<br>";
for (const std::pair<std::string, std::set<std::string>> &model : vc.models_variants_installed) {
for (const auto& model : vc.models_variants_installed) {
text += _(L("model")) + ": " + model.first + ", " + _(L("variants")) + ": ";
for (const std::string &variant : model.second) {
if (&variant != &*model.second.begin())

View file

@ -1872,7 +1872,7 @@ void ConfigWizard::priv::load_vendors()
std::map<std::string, std::string> section_new;
if (app_config->has_section(section_name)) {
const std::map<std::string, std::string> &section_old = app_config->get_section(section_name);
for (const std::pair<std::string, std::string> &material_name_and_installed : section_old)
for (const auto& material_name_and_installed : section_old)
if (material_name_and_installed.second == "1") {
// Material is installed. Resolve it in bundles.
size_t num_found = 0;
@ -2248,7 +2248,7 @@ bool ConfigWizard::priv::check_and_install_missing_materials(Technology technolo
if ((only_for_model_id.empty() || only_for_model_id == printer_model->id) &&
printer_models_without_material.find(printer_model) == printer_models_without_material.end()) {
bool has_material = false;
for (const std::pair<std::string, std::string> &preset : appconfig_presets) {
for (const auto& preset : appconfig_presets) {
if (preset.second == "1") {
const Preset *material = materials.find_preset(preset.first, false);
if (material != nullptr && is_compatible_with_printer(PresetWithVendorProfile(*material, nullptr), PresetWithVendorProfile(printer, nullptr))) {

View file

@ -1889,7 +1889,7 @@ void Control::show_cog_icon_context_menu()
[]() { return true; }, [this]() { return m_extra_style & wxSL_VALUE_LABEL; }, GUI::wxGetApp().plater());
append_submenu(&menu, ruler_mode_menu, wxID_ANY, _L("Ruler mode"), _L("Set ruler mode"), "",
[this]() { return true; }, this);
[]() { return true; }, this);
}
if (m_mode == MultiAsSingle && m_draw_mode == dmRegular)

View file

@ -113,8 +113,8 @@ public:
void field_changed() { on_change_field(); }
Field(const ConfigOptionDef& opt, const t_config_option_key& id) : m_opt(opt), m_opt_id(id) {};
Field(wxWindow* parent, const ConfigOptionDef& opt, const t_config_option_key& id) : m_parent(parent), m_opt(opt), m_opt_id(id) {};
Field(const ConfigOptionDef& opt, const t_config_option_key& id) : m_opt(opt), m_opt_id(id) {}
Field(wxWindow* parent, const ConfigOptionDef& opt, const t_config_option_key& id) : m_parent(parent), m_opt(opt), m_opt_id(id) {}
virtual ~Field();
/// If you don't know what you are getting back, check both methods for nullptr.
@ -315,12 +315,12 @@ public:
/// Propagate value from field to the OptionGroupe and Config after kill_focus/ENTER
void propagate_value() ;
void set_value(const std::string& value, bool change_event = false) {
void set_value(const std::string& value, bool change_event = false) {
m_disable_change_event = !change_event;
dynamic_cast<wxSpinCtrl*>(window)->SetValue(value);
m_disable_change_event = false;
}
void set_value(const boost::any& value, bool change_event = false) {
}
void set_value(const boost::any& value, bool change_event = false) override {
m_disable_change_event = !change_event;
tmp_value = boost::any_cast<int>(value);
m_value = value;
@ -395,8 +395,8 @@ public:
boost::any& get_value() override;
void msw_rescale() override;
void enable() override { dynamic_cast<wxColourPickerCtrl*>(window)->Enable(); };
void disable() override{ dynamic_cast<wxColourPickerCtrl*>(window)->Disable(); };
void enable() override { dynamic_cast<wxColourPickerCtrl*>(window)->Enable(); }
void disable() override{ dynamic_cast<wxColourPickerCtrl*>(window)->Disable(); }
wxWindow* getWindow() override { return window; }
};
@ -456,8 +456,8 @@ public:
void msw_rescale() override;
void enable() override { dynamic_cast<wxStaticText*>(window)->Enable(); };
void disable() override{ dynamic_cast<wxStaticText*>(window)->Disable(); };
void enable() override { dynamic_cast<wxStaticText*>(window)->Enable(); }
void disable() override{ dynamic_cast<wxStaticText*>(window)->Disable(); }
wxWindow* getWindow() override { return window; }
};

View file

@ -648,7 +648,7 @@ void FirmwareDialog::priv::perform_upload()
}
}
})
.on_message(std::move([q, extra_verbose](const char *msg, unsigned /* size */) {
.on_message([q](const char *msg, unsigned /* size */) {
if (extra_verbose) {
BOOST_LOG_TRIVIAL(debug) << "avrdude: " << msg;
}
@ -665,19 +665,19 @@ void FirmwareDialog::priv::perform_upload()
evt->SetExtraLong(AE_MESSAGE);
evt->SetString(std::move(wxmsg));
wxQueueEvent(q, evt);
}))
.on_progress(std::move([q](const char * /* task */, unsigned progress) {
})
.on_progress([q](const char * /* task */, unsigned progress) {
auto evt = new wxCommandEvent(EVT_AVRDUDE, q->GetId());
evt->SetExtraLong(AE_PROGRESS);
evt->SetInt(progress);
wxQueueEvent(q, evt);
}))
.on_complete(std::move([this]() {
})
.on_complete([this]() {
auto evt = new wxCommandEvent(EVT_AVRDUDE, this->q->GetId());
evt->SetExtraLong(AE_EXIT);
evt->SetInt(this->avrdude->exit_code());
wxQueueEvent(this->q, evt);
}))
})
.run();
}

View file

@ -2771,7 +2771,7 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool
return color;
};
auto travel_color = [this](const Path& path) {
auto travel_color = [](const Path& path) {
return (path.delta_extruder < 0.0f) ? Travel_Colors[2] /* Retract */ :
((path.delta_extruder > 0.0f) ? Travel_Colors[1] /* Extrude */ :
Travel_Colors[0] /* Move */);
@ -3436,7 +3436,7 @@ void GCodeViewer::render_toolpaths() const
shader.set_uniform("uniform_color", color4);
};
auto render_as_points = [this, zoom, point_size, near_plane_height, set_uniform_color]
auto render_as_points = [zoom, point_size, near_plane_height, set_uniform_color]
(const TBuffer& buffer, unsigned int ibuffer_id, GLShaderProgram& shader) {
#if ENABLE_FIXED_SCREEN_SIZE_POINT_MARKERS
shader.set_uniform("use_fixed_screen_size", 1);
@ -3466,7 +3466,7 @@ void GCodeViewer::render_toolpaths() const
glsafe(::glDisable(GL_VERTEX_PROGRAM_POINT_SIZE));
};
auto render_as_lines = [this, light_intensity, set_uniform_color](const TBuffer& buffer, unsigned int ibuffer_id, GLShaderProgram& shader) {
auto render_as_lines = [light_intensity, set_uniform_color](const TBuffer& buffer, unsigned int ibuffer_id, GLShaderProgram& shader) {
shader.set_uniform("light_intensity", light_intensity);
for (const RenderPath& path : buffer.render_paths) {
if (path.index_buffer_id == ibuffer_id) {
@ -3479,7 +3479,7 @@ void GCodeViewer::render_toolpaths() const
}
};
auto render_as_triangles = [this, set_uniform_color](const TBuffer& buffer, unsigned int ibuffer_id, GLShaderProgram& shader) {
auto render_as_triangles = [set_uniform_color](const TBuffer& buffer, unsigned int ibuffer_id, GLShaderProgram& shader) {
for (const RenderPath& path : buffer.render_paths) {
if (path.index_buffer_id == ibuffer_id) {
set_uniform_color(path.color, shader);
@ -3874,8 +3874,8 @@ void GCodeViewer::render_legend() const
ImGui::PopStyleVar();
};
auto append_range = [this, draw_list, &imgui, append_item](const Extrusions::Range& range, unsigned int decimals) {
auto append_range_item = [this, draw_list, &imgui, append_item](int i, float value, unsigned int decimals) {
auto append_range = [append_item](const Extrusions::Range& range, unsigned int decimals) {
auto append_range_item = [append_item](int i, float value, unsigned int decimals) {
char buf[1024];
::sprintf(buf, "%.*f", decimals, value);
append_item(EItemType::Rect, Range_Colors[i], buf);
@ -3969,7 +3969,7 @@ void GCodeViewer::render_legend() const
return _u8L("from") + " " + std::string(buf1) + " " + _u8L("to") + " " + std::string(buf2) + " " + _u8L("mm");
};
auto role_time_and_percent = [this, time_mode](ExtrusionRole role) {
auto role_time_and_percent = [ time_mode](ExtrusionRole role) {
auto it = std::find_if(time_mode.roles_times.begin(), time_mode.roles_times.end(), [role](const std::pair<ExtrusionRole, float>& item) { return role == item.first; });
return (it != time_mode.roles_times.end()) ? std::make_pair(it->second, it->second / time_mode.time) : std::make_pair(0.0f, 0.0f);
};
@ -4177,7 +4177,7 @@ void GCodeViewer::render_legend() const
return items;
};
auto append_color_change = [this, &imgui](const Color& color1, const Color& color2, const std::array<float, 2>& offsets, const Times& times) {
auto append_color_change = [&imgui](const Color& color1, const Color& color2, const std::array<float, 2>& offsets, const Times& times) {
imgui.text(_u8L("Color change"));
ImGui::SameLine();
@ -4196,7 +4196,7 @@ void GCodeViewer::render_legend() const
imgui.text(short_time(get_time_dhms(times.second - times.first)));
};
auto append_print = [this, &imgui](const Color& color, const std::array<float, 2>& offsets, const Times& times) {
auto append_print = [&imgui](const Color& color, const std::array<float, 2>& offsets, const Times& times) {
imgui.text(_u8L("Print"));
ImGui::SameLine();

View file

@ -4582,9 +4582,9 @@ bool GLCanvas3D::_init_main_toolbar()
"\n" + "[" + GUI::shortkey_ctrl_prefix() + "4] - " + _u8L("Printer Settings Tab") ;
item.sprite_id = 10;
item.enabling_callback = GLToolbarItem::Default_Enabling_Callback;
item.visibility_callback = [this]() { return (wxGetApp().app_config->get("new_settings_layout_mode") == "1" ||
wxGetApp().app_config->get("dlg_settings_layout_mode") == "1"); };
item.left.action_callback = [this]() { wxGetApp().mainframe->select_tab(); };
item.visibility_callback = []() { return (wxGetApp().app_config->get("new_settings_layout_mode") == "1" ||
wxGetApp().app_config->get("dlg_settings_layout_mode") == "1"); };
item.left.action_callback = []() { wxGetApp().mainframe->select_tab(); };
if (!m_main_toolbar.add_item(item))
return false;
@ -5910,8 +5910,7 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c
tbb::blocked_range<size_t>(0, ctxt.layers.size(), grain_size),
[&ctxt, &new_volume, is_selected_separate_extruder, this](const tbb::blocked_range<size_t>& range) {
GLVolumePtrs vols;
std::vector<size_t> color_print_layer_to_glvolume;
auto volume = [&ctxt, &vols, &color_print_layer_to_glvolume, &range](size_t layer_idx, int extruder, int feature) -> GLVolume& {
auto volume = [&ctxt, &vols](size_t layer_idx, int extruder, int feature) -> GLVolume& {
return *vols[ctxt.color_by_color_print()?
ctxt.color_print_color_idx_by_layer_idx_and_extruder(layer_idx, extruder) :
ctxt.color_by_tool() ?

View file

@ -394,7 +394,6 @@ class GLCanvas3D
class Slope
{
bool m_enabled{ false };
bool m_dialog_shown{ false };
GLCanvas3D& m_canvas;
GLVolumeCollection& m_volumes;
static float s_window_width;

View file

@ -35,7 +35,7 @@ void disable_screensaver()
{
#if __APPLE__
CFStringRef reasonForActivity = CFSTR("Slic3r");
IOReturn success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep,
[[maybe_unused]]IOReturn success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep,
kIOPMAssertionLevelOn, reasonForActivity, &assertionID);
// ignore result: success == kIOReturnSuccess
#elif _WIN32
@ -46,7 +46,7 @@ void disable_screensaver()
void enable_screensaver()
{
#if __APPLE__
IOReturn success = IOPMAssertionRelease(assertionID);
IOPMAssertionRelease(assertionID);
#elif _WIN32
SetThreadExecutionState(ES_CONTINUOUS);
#endif

View file

@ -132,7 +132,7 @@ wxSizer* ObjectLayers::create_layer(const t_layer_height_range& range, PlusMinus
// Add control for the "Layer height"
editor = new LayerRangeEditor(this, double_to_string(m_object->layer_config_ranges[range].option("layer_height")->getFloat()), etLayerHeight, set_focus_data,
[range, this](coordf_t layer_height, bool, bool)
[range](coordf_t layer_height, bool, bool)
{
return wxGetApp().obj_list()->edit_layer_range(range, layer_height);
});

View file

@ -117,7 +117,9 @@ ObjectList::ObjectList(wxWindow* parent) :
// detect the current mouse position here, to pass it to list_manipulation() method
// if we detect it later, the user may have moved the mouse pointer while calculations are performed, and this would mess-up the HitTest() call performed into list_manipulation()
// see: https://github.com/prusa3d/PrusaSlicer/issues/3802
#ifndef __WXOSX__
const wxPoint mouse_pos = this->get_mouse_position_in_control();
#endif
#ifndef __APPLE__
// On Windows and Linux, forces a kill focus emulation on the object manipulator fields because this event handler is called
@ -752,7 +754,7 @@ void ObjectList::copy_layers_to_clipboard()
return;
}
for (const auto layer_item : sel_layers)
for (const auto& layer_item : sel_layers)
if (m_objects_model->GetItemType(layer_item) & itLayer) {
auto range = m_objects_model->GetLayerRangeByItem(layer_item);
auto it = ranges.find(range);
@ -778,7 +780,7 @@ void ObjectList::paste_layers_into_list()
t_layer_config_ranges& ranges = object(obj_idx)->layer_config_ranges;
// and create Layer item(s) according to the layer_config_ranges
for (const auto range : cache_ranges)
for (const auto& range : cache_ranges)
ranges.emplace(range);
layers_item = add_layer_root_item(object_item);
@ -1842,7 +1844,7 @@ void ObjectList::append_menu_item_export_stl(wxMenu* menu) const
void ObjectList::append_menu_item_reload_from_disk(wxMenu* menu) const
{
append_menu_item(menu, wxID_ANY, _(L("Reload from disk")), _(L("Reload the selected volumes from disk")),
[this](wxCommandEvent&) { wxGetApp().plater()->reload_from_disk(); }, "", menu,
[](wxCommandEvent&) { wxGetApp().plater()->reload_from_disk(); }, "", menu,
[]() { return wxGetApp().plater()->can_reload_from_disk(); }, wxGetApp().plater());
}
@ -2063,9 +2065,9 @@ wxMenu* ObjectList::create_settings_popupmenu(wxMenu *parent_menu)
for (auto cat : settings_menu) {
append_menu_item(menu, wxID_ANY, _(cat.first), "",
[menu, this](wxCommandEvent& event) { get_settings_choice(menu->GetLabel(event.GetId())); },
[this, menu](wxCommandEvent& event) { get_settings_choice(menu->GetLabel(event.GetId())); },
CATEGORY_ICON.find(cat.first) == CATEGORY_ICON.end() ? wxNullBitmap : CATEGORY_ICON.at(cat.first), parent_menu,
[this]() { return true; }, wxGetApp().plater());
[]() { return true; }, wxGetApp().plater());
}
return menu;
@ -2084,9 +2086,9 @@ void ObjectList::create_freq_settings_popupmenu(wxMenu *menu, const bool is_obje
continue;
append_menu_item(menu, wxID_ANY, _(it.first), "",
[menu, this](wxCommandEvent& event) { get_freq_settings_choice(menu->GetLabel(event.GetId())); },
[this, menu](wxCommandEvent& event) { get_freq_settings_choice(menu->GetLabel(event.GetId())); },
CATEGORY_ICON.find(it.first) == CATEGORY_ICON.end() ? wxNullBitmap : CATEGORY_ICON.at(it.first), menu,
[this]() { return true; }, wxGetApp().plater());
[]() { return true; }, wxGetApp().plater());
}
#if 0
// Add "Quick" settings bundles
@ -4600,7 +4602,7 @@ void ObjectList::show_multi_selection_menu()
append_menu_item_change_extruder(menu);
append_menu_item(menu, wxID_ANY, _(L("Reload from disk")), _(L("Reload the selected volumes from disk")),
[this](wxCommandEvent&) { wxGetApp().plater()->reload_from_disk(); }, "", menu, []() {
[](wxCommandEvent&) { wxGetApp().plater()->reload_from_disk(); }, "", menu, []() {
return wxGetApp().plater()->can_reload_from_disk();
}, wxGetApp().plater());

View file

@ -31,17 +31,17 @@ public:
std::string get_tooltip() const override;
protected:
virtual bool on_init();
virtual void on_load(cereal::BinaryInputArchive& ar) { ar(m_cut_z, m_keep_upper, m_keep_lower, m_rotate_lower); }
virtual void on_save(cereal::BinaryOutputArchive& ar) const { ar(m_cut_z, m_keep_upper, m_keep_lower, m_rotate_lower); }
virtual std::string on_get_name() const;
virtual void on_set_state();
virtual bool on_is_activable() const;
virtual void on_start_dragging();
virtual void on_update(const UpdateData& data);
virtual void on_render() const;
virtual void on_render_for_picking() const;
virtual void on_render_input_window(float x, float y, float bottom_limit);
virtual bool on_init() override;
virtual void on_load(cereal::BinaryInputArchive& ar) override{ ar(m_cut_z, m_keep_upper, m_keep_lower, m_rotate_lower); }
virtual void on_save(cereal::BinaryOutputArchive& ar) const override { ar(m_cut_z, m_keep_upper, m_keep_lower, m_rotate_lower); }
virtual std::string on_get_name() const override;
virtual void on_set_state() override;
virtual bool on_is_activable() const override;
virtual void on_start_dragging() override;
virtual void on_update(const UpdateData& data) override;
virtual void on_render() const override;
virtual void on_render_for_picking() const override;
virtual void on_render_input_window(float x, float y, float bottom_limit) override;
private:
void update_max_z(const Selection& selection) const;

View file

@ -33,14 +33,14 @@ public:
std::string get_tooltip() const override;
protected:
virtual bool on_init();
virtual std::string on_get_name() const;
virtual bool on_is_activable() const;
virtual void on_start_dragging();
virtual void on_stop_dragging();
virtual void on_update(const UpdateData& data);
virtual void on_render() const;
virtual void on_render_for_picking() const;
virtual bool on_init() override;
virtual std::string on_get_name() const override;
virtual bool on_is_activable() const override;
virtual void on_start_dragging() override;
virtual void on_stop_dragging() override;
virtual void on_update(const UpdateData& data) override;
virtual void on_render() const override;
virtual void on_render_for_picking() const override;
private:
double calc_projection(const UpdateData& data) const;

View file

@ -59,8 +59,8 @@ class GLGizmoPainterBase : public GLGizmoBase
private:
ObjectID m_old_mo_id;
size_t m_old_volumes_size = 0;
virtual void on_render() const {}
virtual void on_render_for_picking() const {}
virtual void on_render() const override {}
virtual void on_render_for_picking() const override {}
public:
GLGizmoPainterBase(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id);

View file

@ -47,13 +47,13 @@ public:
std::string get_tooltip() const override;
protected:
virtual bool on_init();
virtual std::string on_get_name() const;
virtual bool on_is_activable() const;
virtual void on_start_dragging();
virtual void on_update(const UpdateData& data);
virtual void on_render() const;
virtual void on_render_for_picking() const;
virtual bool on_init() override;
virtual std::string on_get_name() const override;
virtual bool on_is_activable() const override;
virtual void on_start_dragging() override;
virtual void on_update(const UpdateData& data) override;
virtual void on_render() const override;
virtual void on_render_for_picking() const override;
private:
void render_grabbers_connection(unsigned int id_1, unsigned int id_2) const;

View file

@ -893,7 +893,7 @@ void GLGizmoSlaSupports::on_set_state()
// Only take the snapshot when the USER opens the gizmo. Common gizmos
// data are not yet available, the CallAfter will postpone taking the
// snapshot until they are. No, it does not feel right.
wxGetApp().CallAfter([this]() {
wxGetApp().CallAfter([]() {
Plater::TakeSnapshot snapshot(wxGetApp().plater(), _(L("SLA gizmo turned on")));
});
}

View file

@ -161,7 +161,7 @@ protected:
private:
ModelObject* m_model_object = nullptr;
int m_active_inst = -1;
// int m_active_inst = -1;
float m_z_shift = 0.f;
};

View file

@ -940,7 +940,7 @@ void ImGuiWrapper::init_font(bool compress)
config.MergeMode = true;
if (! m_font_cjk) {
// Apple keyboard shortcuts are only contained in the CJK fonts.
ImFont *font_cjk = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/NotoSansCJK-Regular.ttc").c_str(), m_font_size, &config, ranges_keyboard_shortcuts);
[[maybe_unused]]ImFont *font_cjk = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/NotoSansCJK-Regular.ttc").c_str(), m_font_size, &config, ranges_keyboard_shortcuts);
assert(font_cjk != nullptr);
}
#endif

View file

@ -64,10 +64,10 @@ public:
// Only allow opening a new PrusaSlicer instance on OSX if "single_instance" is disabled,
// as starting new instances would interfere with the locking mechanism of "single_instance" support.
append_menu_item(menu, wxID_ANY, _L("Open new instance"), _L("Open a new PrusaSlicer instance"),
[this](wxCommandEvent&) { start_new_slicer(); }, "", nullptr);
[](wxCommandEvent&) { start_new_slicer(); }, "", nullptr);
}
append_menu_item(menu, wxID_ANY, _L("G-code preview") + dots, _L("Open G-code viewer"),
[this](wxCommandEvent&) { start_new_gcodeviewer_open_file(); }, "", nullptr);
[](wxCommandEvent&) { start_new_gcodeviewer_open_file(); }, "", nullptr);
return menu;
}
};
@ -78,9 +78,9 @@ public:
wxMenu *CreatePopupMenu() override {
wxMenu *menu = new wxMenu;
append_menu_item(menu, wxID_ANY, _L("Open PrusaSlicer"), _L("Open a new PrusaSlicer instance"),
[this](wxCommandEvent&) { start_new_slicer(nullptr, true); }, "", nullptr);
[](wxCommandEvent&) { start_new_slicer(nullptr, true); }, "", nullptr);
append_menu_item(menu, wxID_ANY, _L("G-code preview") + dots, _L("Open new G-code viewer"),
[this](wxCommandEvent&) { start_new_gcodeviewer_open_file(); }, "", nullptr);
[](wxCommandEvent&) { start_new_gcodeviewer_open_file(); }, "", nullptr);
return menu;
}
};
@ -231,7 +231,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
// So, redraw explicitly canvas, when application is moved
//FIXME maybe this is useful for __WXGTK3__ as well?
#if __APPLE__
Bind(wxEVT_MOVE, [this](wxMoveEvent& event) {
Bind(wxEVT_MOVE, [](wxMoveEvent& event) {
wxGetApp().plater()->get_current_canvas3D()->set_as_dirty();
wxGetApp().plater()->get_current_canvas3D()->request_extra_frame();
event.Skip();
@ -1190,7 +1190,7 @@ void MainFrame::init_menubar_as_editor()
windowMenu->AppendSeparator();
append_menu_item(windowMenu, wxID_ANY, _L("Open new instance") + "\tCtrl+Shift+I", _L("Open a new PrusaSlicer instance"),
[this](wxCommandEvent&) { start_new_slicer(); }, "", nullptr, [this]() {return m_plater != nullptr && wxGetApp().app_config->get("single_instance") != "1"; }, this);
[](wxCommandEvent&) { start_new_slicer(); }, "", nullptr, [this]() {return m_plater != nullptr && wxGetApp().app_config->get("single_instance") != "1"; }, this);
windowMenu->AppendSeparator();
append_menu_item(windowMenu, wxID_ANY, _L("Compare presets")/* + "\tCtrl+F"*/, _L("Compare presets"),
@ -1263,8 +1263,8 @@ void MainFrame::init_menubar_as_gcodeviewer()
[this](wxCommandEvent&) { if (m_plater != nullptr) m_plater->export_toolpaths_to_obj(); }, "export_plater", nullptr,
[this]() {return can_export_toolpaths(); }, this);
append_menu_item(fileMenu, wxID_ANY, _L("Open &PrusaSlicer") + dots, _L("Open PrusaSlicer"),
[this](wxCommandEvent&) { start_new_slicer(); }, "", nullptr,
[this]() {return true; }, this);
[](wxCommandEvent&) { start_new_slicer(); }, "", nullptr,
[]() {return true; }, this);
fileMenu->AppendSeparator();
append_menu_item(fileMenu, wxID_EXIT, _L("&Quit"), wxString::Format(_L("Quit %s"), SLIC3R_APP_NAME),
[this](wxCommandEvent&) { Close(false); });

View file

@ -133,7 +133,7 @@ class MainFrame : public DPIFrame
ESettingsLayout m_layout{ ESettingsLayout::Unknown };
protected:
virtual void on_dpi_changed(const wxRect &suggested_rect);
virtual void on_dpi_changed(const wxRect &suggested_rect) override;
virtual void on_sys_color_changed() override;
public:

View file

@ -397,7 +397,7 @@ void Mouse3DController::save_config(AppConfig &appconfig) const
// We do not synchronize m_params_by_device with the background thread explicitely
// as there should be a full memory barrier executed once the background thread is stopped.
for (const std::pair<std::string, Params> &key_value_pair : m_params_by_device) {
for (const auto &key_value_pair : m_params_by_device) {
const std::string &device_name = key_value_pair.first;
const Params &params = key_value_pair.second;
// Store current device parameters into the config

View file

@ -1208,7 +1208,7 @@ void ObjectDataViewModel::AddAllChildren(const wxDataViewItem& parent)
ItemAdded(parent, wxDataViewItem((void*)child));
}
for (const auto item : array)
for (const auto& item : array)
AddAllChildren(item);
m_ctrl->Expand(parent);
@ -1362,7 +1362,7 @@ void ObjectDataViewModel::GetAllChildren(const wxDataViewItem &parent, wxDataVie
}
wxDataViewItemArray new_array = array;
for (const auto item : new_array)
for (const auto& item : new_array)
{
wxDataViewItemArray children;
GetAllChildren(item, children);

View file

@ -27,20 +27,20 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co
// is the normal type.
if (opt.gui_type == "select") {
} else if (opt.gui_type == "select_open") {
m_fields.emplace(id, std::move(Choice::Create<Choice>(this->ctrl_parent(), opt, id)));
m_fields.emplace(id, Choice::Create<Choice>(this->ctrl_parent(), opt, id));
} else if (opt.gui_type == "color") {
m_fields.emplace(id, std::move(ColourPicker::Create<ColourPicker>(this->ctrl_parent(), opt, id)));
m_fields.emplace(id, ColourPicker::Create<ColourPicker>(this->ctrl_parent(), opt, id));
} else if (opt.gui_type == "f_enum_open" ||
opt.gui_type == "i_enum_open" ||
opt.gui_type == "i_enum_closed") {
m_fields.emplace(id, std::move(Choice::Create<Choice>(this->ctrl_parent(), opt, id)));
m_fields.emplace(id, Choice::Create<Choice>(this->ctrl_parent(), opt, id));
} else if (opt.gui_type == "slider") {
m_fields.emplace(id, std::move(SliderCtrl::Create<SliderCtrl>(this->ctrl_parent(), opt, id)));
m_fields.emplace(id, SliderCtrl::Create<SliderCtrl>(this->ctrl_parent(), opt, id));
} else if (opt.gui_type == "i_spin") { // Spinctrl
} else if (opt.gui_type == "legend") { // StaticText
m_fields.emplace(id, std::move(StaticText::Create<StaticText>(this->ctrl_parent(), opt, id)));
m_fields.emplace(id, StaticText::Create<StaticText>(this->ctrl_parent(), opt, id));
} else if (opt.gui_type == "one_string") {
m_fields.emplace(id, std::move(TextCtrl::Create<TextCtrl>(this->ctrl_parent(), opt, id)));
m_fields.emplace(id, TextCtrl::Create<TextCtrl>(this->ctrl_parent(), opt, id));
} else {
switch (opt.type) {
case coFloatOrPercent:
@ -50,21 +50,21 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co
case coPercents:
case coString:
case coStrings:
m_fields.emplace(id, std::move(TextCtrl::Create<TextCtrl>(this->ctrl_parent(), opt, id)));
m_fields.emplace(id, TextCtrl::Create<TextCtrl>(this->ctrl_parent(), opt, id));
break;
case coBool:
case coBools:
m_fields.emplace(id, std::move(CheckBox::Create<CheckBox>(this->ctrl_parent(), opt, id)));
m_fields.emplace(id, CheckBox::Create<CheckBox>(this->ctrl_parent(), opt, id));
break;
case coInt:
case coInts:
m_fields.emplace(id, std::move(SpinCtrl::Create<SpinCtrl>(this->ctrl_parent(), opt, id)));
m_fields.emplace(id, SpinCtrl::Create<SpinCtrl>(this->ctrl_parent(), opt, id));
break;
case coEnum:
m_fields.emplace(id, std::move(Choice::Create<Choice>(this->ctrl_parent(), opt, id)));
m_fields.emplace(id, Choice::Create<Choice>(this->ctrl_parent(), opt, id));
break;
case coPoints:
m_fields.emplace(id, std::move(PointCtrl::Create<PointCtrl>(this->ctrl_parent(), opt, id)));
m_fields.emplace(id, PointCtrl::Create<PointCtrl>(this->ctrl_parent(), opt, id));
break;
case coNone: break;
default:

View file

@ -273,7 +273,6 @@ private:
const DynamicPrintConfig* m_config {nullptr};
// If the config is modelconfig, then ModelConfig::touch() has to be called after value change.
ModelConfig* m_modelconfig { nullptr };
bool m_full_labels{ 0 };
t_opt_map m_opt_map;
std::string m_config_category;

View file

@ -275,7 +275,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
m_optgroup->append_single_option_line("host_type");
auto create_sizer_with_btn = [this](wxWindow* parent, ScalableButton** btn, const std::string& icon_name, const wxString& label) {
auto create_sizer_with_btn = [](wxWindow* parent, ScalableButton** btn, const std::string& icon_name, const wxString& label) {
*btn = new ScalableButton(parent, wxID_ANY, icon_name, label, wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT);
(*btn)->SetFont(wxGetApp().normal_font());
@ -290,7 +290,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
m_printhost_browse_btn->Bind(wxEVT_BUTTON, [=](wxCommandEvent& e) {
BonjourDialog dialog(this, Preset::printer_technology(m_printer.config));
if (dialog.show_and_lookup()) {
m_optgroup->set_value("print_host", std::move(dialog.get_selected()), true);
m_optgroup->set_value("print_host", dialog.get_selected(), true);
m_optgroup->get_field("print_host")->field_changed();
}
});
@ -366,7 +366,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
static const auto filemasks = _L("Certificate files (*.crt, *.pem)|*.crt;*.pem|All files|*.*");
wxFileDialog openFileDialog(this, _L("Open CA certificate file"), "", "", filemasks, wxFD_OPEN | wxFD_FILE_MUST_EXIST);
if (openFileDialog.ShowModal() != wxID_CANCEL) {
m_optgroup->set_value("printhost_cafile", std::move(openFileDialog.GetPath()), true);
m_optgroup->set_value("printhost_cafile", openFileDialog.GetPath(), true);
m_optgroup->get_field("printhost_cafile")->field_changed();
}
});
@ -379,7 +379,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
Line cafile_hint{ "", "" };
cafile_hint.full_width = 1;
cafile_hint.widget = [this, ca_file_hint](wxWindow* parent) {
cafile_hint.widget = [ca_file_hint](wxWindow* parent) {
auto txt = new wxStaticText(parent, wxID_ANY, ca_file_hint);
auto sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(txt);
@ -420,7 +420,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
{
wxTextCtrl* temp = dynamic_cast<wxTextCtrl*>(printhost_field->getWindow());
if (temp)
temp->Bind(wxEVT_TEXT, ([this, printhost_field, temp](wxEvent& e)
temp->Bind(wxEVT_TEXT, ([printhost_field, temp](wxEvent& e)
{
#ifndef __WXGTK__
e.Skip();

View file

@ -274,7 +274,7 @@ public:
wxButton* get_wiping_dialog_button() { return m_wiping_dialog_button; }
wxSizer* get_sizer() override;
ConfigOptionsGroup* get_og(const bool is_fff);
void Show(const bool is_fff);
void Show(const bool is_fff) override;
void msw_rescale();
};
@ -2065,7 +2065,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
view3D_canvas->Bind(EVT_GLCANVAS_UPDATE_BED_SHAPE, [q](SimpleEvent&) { q->set_bed_shape(); });
// Preview events:
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_QUESTION_MARK, [this](SimpleEvent&) { wxGetApp().keyboard_shortcuts(); });
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_QUESTION_MARK, [](SimpleEvent&) { wxGetApp().keyboard_shortcuts(); });
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_UPDATE_BED_SHAPE, [q](SimpleEvent&) { q->set_bed_shape(); });
if (wxGetApp().is_editor()) {
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_TAB, [this](SimpleEvent&) { select_next_view_3D(); });
@ -2127,8 +2127,8 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
if (wxGetApp().is_editor()) {
this->q->Bind(EVT_EJECT_DRIVE_NOTIFICAION_CLICKED, [this](EjectDriveNotificationClickedEvent&) { this->q->eject_drive(); });
this->q->Bind(EVT_EXPORT_GCODE_NOTIFICAION_CLICKED, [this](ExportGcodeNotificationClickedEvent&) { this->q->export_gcode(true); });
this->q->Bind(EVT_PRESET_UPDATE_AVAILABLE_CLICKED, [this](PresetUpdateAvailableClickedEvent&) { wxGetApp().get_preset_updater()->on_update_notification_confirm(); });
this->q->Bind(EVT_REMOVABLE_DRIVE_EJECTED, [this, q](RemovableDriveEjectEvent &evt) {
this->q->Bind(EVT_PRESET_UPDATE_AVAILABLE_CLICKED, [](PresetUpdateAvailableClickedEvent&) { wxGetApp().get_preset_updater()->on_update_notification_confirm(); });
this->q->Bind(EVT_REMOVABLE_DRIVE_EJECTED, [this](RemovableDriveEjectEvent &evt) {
if (evt.data.second) {
this->show_action_buttons(this->ready_to_slice);
notification_manager->close_notification_of_type(NotificationType::ExportFinished);
@ -2143,7 +2143,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
);
}
});
this->q->Bind(EVT_REMOVABLE_DRIVES_CHANGED, [this, q](RemovableDrivesChangedEvent &) {
this->q->Bind(EVT_REMOVABLE_DRIVES_CHANGED, [this](RemovableDrivesChangedEvent &) {
this->show_action_buttons(this->ready_to_slice);
// Close notification ExportingFinished but only if last export was to removable
notification_manager->device_ejected();
@ -4963,7 +4963,7 @@ ProjectDropDialog::ProjectDropDialog(const std::string& filename)
wxBoxSizer* bottom_sizer = new wxBoxSizer(wxHORIZONTAL);
wxCheckBox* check = new wxCheckBox(this, wxID_ANY, _L("Don't show again"));
check->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent& evt) {
check->Bind(wxEVT_CHECKBOX, [](wxCommandEvent& evt) {
wxGetApp().app_config->set("show_drop_project_dialog", evt.IsChecked() ? "0" : "1");
});

View file

@ -738,7 +738,7 @@ void PlaterPresetComboBox::show_add_menu()
wxMenu* menu = new wxMenu();
append_menu_item(menu, wxID_ANY, _L("Add/Remove presets"), "",
[this](wxCommandEvent&) {
[](wxCommandEvent&) {
wxTheApp->CallAfter([]() { wxGetApp().run_wizard(ConfigWizard::RR_USER, ConfigWizard::SP_PRINTERS); });
}, "edit_uni", menu, []() { return true; }, wxGetApp().plater());
@ -768,7 +768,7 @@ void PlaterPresetComboBox::show_edit_menu()
}
else
append_menu_item(menu, wxID_ANY, _L("Add/Remove presets"), "",
[this](wxCommandEvent&) {
[](wxCommandEvent&) {
wxTheApp->CallAfter([]() { wxGetApp().run_wizard(ConfigWizard::RR_USER, ConfigWizard::SP_PRINTERS); });
}, "edit_uni", menu, []() { return true; }, wxGetApp().plater());
@ -893,7 +893,7 @@ void PlaterPresetComboBox::update()
const PhysicalPrinterCollection& ph_printers = m_preset_bundle->physical_printers;
for (PhysicalPrinterCollection::ConstIterator it = ph_printers.begin(); it != ph_printers.end(); ++it) {
for (const std::string preset_name : it->get_preset_names()) {
for (const std::string& preset_name : it->get_preset_names()) {
Preset* preset = m_collection->find_preset(preset_name);
if (!preset)
continue;
@ -1078,7 +1078,7 @@ void TabPresetComboBox::update()
const PhysicalPrinterCollection& ph_printers = m_preset_bundle->physical_printers;
for (PhysicalPrinterCollection::ConstIterator it = ph_printers.begin(); it != ph_printers.end(); ++it) {
for (const std::string preset_name : it->get_preset_names()) {
for (const std::string& preset_name : it->get_preset_names()) {
Preset* preset = m_collection->find_preset(preset_name);
if (!preset)
continue;

View file

@ -121,7 +121,7 @@ Tab::Tab(wxNotebook* parent, const wxString& title, Preset::Type type) :
m_config_manipulation = get_config_manipulation();
Bind(wxEVT_SIZE, ([this](wxSizeEvent &evt) {
Bind(wxEVT_SIZE, ([](wxSizeEvent &evt) {
//for (auto page : m_pages)
// if (! page.get()->IsShown())
// page->layout_valid = false;
@ -242,7 +242,7 @@ void Tab::create_preset_tab()
if (dlg.ShowModal() == wxID_OK)
wxGetApp().update_label_colours();
});
m_search_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent) { wxGetApp().plater()->search(false); });
m_search_btn->Bind(wxEVT_BUTTON, [](wxCommandEvent) { wxGetApp().plater()->search(false); });
// Colors for ui "decoration"
m_sys_label_clr = wxGetApp().get_label_clr_sys();
@ -491,7 +491,7 @@ void Tab::update_label_colours()
m_modified_label_clr = wxGetApp().get_label_clr_modified();
//update options "decoration"
for (const auto opt : m_options_list)
for (const auto& opt : m_options_list)
{
const wxColour *color = &m_sys_label_clr;
@ -541,7 +541,7 @@ void Tab::update_label_colours()
void Tab::decorate()
{
for (const auto opt : m_options_list)
for (const auto& opt : m_options_list)
{
Field* field = nullptr;
wxColour* colored_label_clr = nullptr;
@ -639,7 +639,7 @@ void Tab::init_options_list()
if (!m_options_list.empty())
m_options_list.clear();
for (const auto opt_key : m_config->keys())
for (const std::string& opt_key : m_config->keys())
m_options_list.emplace(opt_key, m_opt_status_value);
}
@ -656,7 +656,7 @@ void TabPrinter::init_options_list()
if (!m_options_list.empty())
m_options_list.clear();
for (const auto opt_key : m_config->keys())
for (const std::string& opt_key : m_config->keys())
{
if (opt_key == "bed_shape" || opt_key == "thumbnails") {
m_options_list.emplace(opt_key, m_opt_status_value);
@ -709,7 +709,7 @@ void TabSLAMaterial::init_options_list()
if (!m_options_list.empty())
m_options_list.clear();
for (const auto opt_key : m_config->keys())
for (const std::string& opt_key : m_config->keys())
{
if (opt_key == "compatible_prints" || opt_key == "compatible_printers") {
m_options_list.emplace(opt_key, m_opt_status_value);
@ -1728,7 +1728,7 @@ void TabFilament::add_filament_overrides_page()
line.near_label_widget = [this, optgroup, opt_key, opt_index](wxWindow* parent) {
wxCheckBox* check_box = new wxCheckBox(parent, wxID_ANY, "");
check_box->Bind(wxEVT_CHECKBOX, [this, optgroup, opt_key, opt_index](wxCommandEvent& evt) {
check_box->Bind(wxEVT_CHECKBOX, [optgroup, opt_key, opt_index](wxCommandEvent& evt) {
const bool is_checked = evt.IsChecked();
Field* field = optgroup->get_fieldc(opt_key, opt_index);
if (field != nullptr) {
@ -3352,7 +3352,9 @@ bool Tab::tree_sel_change_delayed()
wxCheckForInterrupt(m_treectrl);
if (m_page_switch_planned)
throw UIBuildCanceled();
#endif // WIN32
#else // WIN32
(void)this; // silence warning
#endif
});
try {
@ -3924,7 +3926,7 @@ ConfigOptionsGroupShp Page::new_optgroup(const wxString& title, int noncommon_la
#else
auto tab = parent()->GetParent();// GetParent();
#endif
optgroup->m_on_change = [this, tab](t_config_option_key opt_key, boost::any value) {
optgroup->m_on_change = [tab](t_config_option_key opt_key, boost::any value) {
//! This function will be called from OptionGroup.
//! Using of CallAfter is redundant.
//! And in some cases it causes update() function to be recalled again
@ -3934,21 +3936,21 @@ ConfigOptionsGroupShp Page::new_optgroup(const wxString& title, int noncommon_la
//! });
};
optgroup->m_get_initial_config = [this, tab]() {
optgroup->m_get_initial_config = [tab]() {
DynamicPrintConfig config = static_cast<Tab*>(tab)->m_presets->get_selected_preset().config;
return config;
};
optgroup->m_get_sys_config = [this, tab]() {
optgroup->m_get_sys_config = [tab]() {
DynamicPrintConfig config = static_cast<Tab*>(tab)->m_presets->get_selected_preset_parent()->config;
return config;
};
optgroup->have_sys_config = [this, tab]() {
optgroup->have_sys_config = [tab]() {
return static_cast<Tab*>(tab)->m_presets->get_selected_preset_parent() != nullptr;
};
optgroup->rescale_extra_column_item = [this](wxWindow* win) {
optgroup->rescale_extra_column_item = [](wxWindow* win) {
auto *ctrl = dynamic_cast<wxStaticBitmap*>(win);
if (ctrl == nullptr)
return;

View file

@ -383,7 +383,6 @@ public:
private:
ogStaticText* m_recommended_thin_wall_thickness_description_line = nullptr;
ogStaticText* m_top_bottom_shell_thickness_explanation = nullptr;
bool m_support_material_overhangs_queried = false;
};
class TabFilament : public Tab

View file

@ -226,7 +226,7 @@ struct DnsResource
}
dataoffset = offset;
res.data = std::move(std::vector<char>(buffer.begin() + offset, buffer.begin() + offset + rdlength));
res.data = std::vector<char>(buffer.begin() + offset, buffer.begin() + offset + rdlength);
offset += rdlength;
return std::move(res);

View file

@ -50,7 +50,7 @@ bool FlashAir::test(wxString &msg) const
res = false;
msg = format_error(body, error, status);
})
.on_complete([&, this](std::string body, unsigned) {
.on_complete([&](std::string body, unsigned) {
BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Got upload enabled: %2%") % name % body;
res = boost::starts_with(body, "1");

View file

@ -553,7 +553,7 @@ void Http::cancel()
Http Http::get(std::string url)
{
return std::move(Http{std::move(url)});
return Http{std::move(url)};
}
Http Http::post(std::string url)

View file

@ -20,7 +20,7 @@ public:
OctoPrint(DynamicPrintConfig *config);
~OctoPrint() override = default;
const char* get_name() const;
const char* get_name() const override;
bool test(wxString &curl_msg) const override;
wxString get_test_ok_msg () const override;

View file

@ -206,7 +206,7 @@ bool PresetUpdater::priv::get_file(const std::string &url, const fs::path &targe
tmp_path.string());
Http::get(url)
.on_progress([this](Http::Progress, bool &cancel) {
.on_progress([](Http::Progress, bool &cancel) {
if (cancel) { cancel = true; }
})
.on_error([&](std::string body, std::string error, unsigned http_status) {
@ -406,7 +406,7 @@ Updates PresetUpdater::priv::get_config_updates(const Semver &old_slic3r_version
BOOST_LOG_TRIVIAL(info) << "Checking for cached configuration updates...";
// Over all indices from the cache directory:
for (const auto idx : index_db) {
for (const Index& idx : index_db) {
auto bundle_path = vendor_path / (idx.vendor() + ".ini");
auto bundle_path_idx = vendor_path / idx.path().filename();
@ -679,11 +679,11 @@ void PresetUpdater::sync(PresetBundle *preset_bundle)
// into the closure (but perhaps the compiler can elide this).
VendorMap vendors = preset_bundle->vendors;
p->thread = std::move(std::thread([this, vendors]() {
p->thread = std::thread([this, vendors]() {
this->p->prune_tmps();
this->p->sync_version();
this->p->sync_config(std::move(vendors));
}));
});
}
void PresetUpdater::slic3r_update_notify()

View file

@ -190,7 +190,7 @@ bool Repetier::get_groups(wxArrayString& groups) const
http.on_error([&](std::string body, std::string error, unsigned status) {
BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Error getting version: %2%, HTTP %3%, body: `%4%`") % name % error % status % body;
})
.on_complete([&, this](std::string body, unsigned) {
.on_complete([&](std::string body, unsigned) {
BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Got groups: %2%") % name % body;
try {
@ -233,7 +233,7 @@ bool Repetier::get_printers(wxArrayString& printers) const
BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Error listing printers: %2%, HTTP %3%, body: `%4%`") % name % error % status % body;
res = false;
})
.on_complete([&, this](std::string body, unsigned http_status) {
.on_complete([&](std::string body, unsigned http_status) {
BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Got printers: %2%, HTTP status: %3%") % name % body % http_status;
if (http_status != 200)

View file

@ -19,7 +19,7 @@ public:
Repetier(DynamicPrintConfig *config);
~Repetier() override = default;
const char* get_name() const;
const char* get_name() const override;
bool test(wxString &curl_msg) const override;
wxString get_test_ok_msg () const override;

View file

@ -209,7 +209,7 @@ public:
bool is_immutable() const override { return true; }
bool is_optional() const override { return m_optional; }
// If it is an immutable object, return its pointer. There is a map assigning a temporary ObjectID to the immutable object pointer.
const void* immutable_object_ptr() const { return (const void*)m_shared_object.get(); }
const void* immutable_object_ptr() const override { return (const void*)m_shared_object.get(); }
// Estimated size in memory, to be used to drop least recently used snapshots.
size_t memsize() const override {