build: clear 237 warnings - unused lambda captures (#15417)

* build: enable /Zc:lambda for MSVC

MSVC keeps its legacy lambda processor under /std:c++17, which rejects
reading a constexpr constant inside a lambda that does not capture it
(C3493). No other compiler requires that capture, and clang reports it as
an unused one, so the two cannot both be satisfied without the flag.

/Zc:lambda selects the conforming lambda parser that clang and GCC
already use. It is implied by /std:c++20 and /permissive-, so it is only
needed while we are on C++17. clang-cl is conforming already and does not
take the flag.

It requires VS2019 16.8, so build_release_vs.bat now says 16.8+.

* build: clear 237 unused lambda capture warnings

236 captures across 81 files, 142 of them `this`. Removing an unused
capture changes no behavior; clang does not report a capture whose type
has a non-trivial destructor, so nothing held only to extend an object's
lifetime is in this set.

Nine of them are the second half of the warning, "is not required to be
captured for this use", where the capture is a const or constexpr value
the body does read. Those depend on the /Zc:lambda change in the previous
commit. One of them, in FillRectilinear.cpp, had been worked around with
an #ifndef __APPLE__ guard around the capture list, which is now gone.

GUI_ObjectTableSettings.cpp captured its reset button only to read it
inside #ifdef __WXOSX_MAC__. That branch now takes the button from the
event it is already handling.

* build: fail configure on MSVC older than 19.28 instead of dropping /Zc:lambda

cl.exe answers an unrecognized /Zc: sub-option with warning D9002 and keeps
going, so on VS2019 before 16.8 the flag is silently ignored and the build
instead dies with C3493 in FillRectilinear.cpp, nowhere near the cause.

* fix: delete three locals that are now unused

Their only remaining use was the lambda capture this branch removed. The
Clang builds set -Wno-unused-variable, so the build never flagged them.

---------

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