Merge branch 'main' into dev/bbl-network-upd

# Conflicts:
#	src/slic3r/GUI/SelectMachine.cpp
This commit is contained in:
Noisyfox 2025-06-15 15:28:10 +08:00
commit c72e8a24f1
94 changed files with 3475 additions and 753 deletions

View file

@ -123,7 +123,7 @@ if (NOT WIN32 AND NOT APPLE)
# Binary name on unix like systems (Linux, Unix)
set_target_properties(OrcaSlicer PROPERTIES OUTPUT_NAME "orca-slicer")
set(SLIC3R_APP_CMD "orca-slicer")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/platform/unix/BuildLinuxImage.sh.in ${CMAKE_CURRENT_BINARY_DIR}/BuildLinuxImage.sh @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/platform/unix/build_linux_image.sh.in ${CMAKE_CURRENT_BINARY_DIR}/build_linux_image.sh USE_SOURCE_PERMISSIONS @ONLY)
endif ()
target_link_libraries(OrcaSlicer libslic3r cereal::cereal)

View file

@ -115,7 +115,6 @@ static FILE *stl_open_count_facets(stl_file *stl, const char *file, unsigned int
// do another null check to be safe
if (fp == nullptr) {
BOOST_LOG_TRIVIAL(error) << "stl_open_count_facets: Couldn't open " << file << " for reading";
fclose(fp);
return nullptr;
}
@ -228,8 +227,8 @@ static bool stl_read(stl_file *stl, FILE *fp, int first_facet, bool first, Impor
// Read a single facet from an ASCII .STL file
// skip solid/endsolid
// (in this order, otherwise it won't work when they are paired in the middle of a file)
fscanf(fp, " endsolid%*[^\n]\n");
fscanf(fp, " solid%*[^\n]\n"); // name might contain spaces so %*s doesn't work and it also can be empty (just "solid")
[[maybe_unused]] auto unused_result = fscanf(fp, " endsolid%*[^\n]\n");
unused_result = fscanf(fp, " solid%*[^\n]\n"); // name might contain spaces so %*s doesn't work and it also can be empty (just "solid")
// Leading space in the fscanf format skips all leading white spaces including numerous new lines and tabs.
int res_normal = fscanf(fp, " facet normal %31s %31s %31s", normal_buf[0], normal_buf[1], normal_buf[2]);
assert(res_normal == 3);
@ -244,12 +243,12 @@ static bool stl_read(stl_file *stl, FILE *fp, int first_facet, bool first, Impor
assert(res_vertex3 == 3);
// Some G-code generators tend to produce text after "endloop" and "endfacet". Just ignore it.
char buf[2048];
fgets(buf, 2047, fp);
[[maybe_unused]] auto unused_result2 = fgets(buf, 2047, fp);
bool endloop_ok = strncmp(buf, "endloop", 7) == 0 && (buf[7] == '\r' || buf[7] == '\n' || buf[7] == ' ' || buf[7] == '\t');
assert(endloop_ok);
// Skip the trailing whitespaces and empty lines.
fscanf(fp, " ");
fgets(buf, 2047, fp);
unused_result = fscanf(fp, " ");
unused_result2 = fgets(buf, 2047, fp);
bool endfacet_ok = strncmp(buf, "endfacet", 8) == 0 && (buf[8] == '\r' || buf[8] == '\n' || buf[8] == ' ' || buf[8] == '\t');
assert(endfacet_ok);
if (res_normal != 3 || res_outer_loop != 0 || res_vertex1 != 3 || res_vertex2 != 3 || res_vertex3 != 3 || ! endloop_ok || ! endfacet_ok) {

View file

@ -114,7 +114,7 @@ struct Point {
Point(const T2 x_, const T2 y_) { Init(x_, y_); }
template <typename T2>
explicit Point<T>(const Point<T2>& p) { Init(p.x, p.y); }
explicit Point(const Point<T2>& p) { Init(p.x, p.y); }
Point operator * (const double scale) const
{

View file

@ -43,7 +43,6 @@ Index of this file:
#include <locale.h>
#include <algorithm>
// System includes
#include <ctype.h> // toupper
#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
#include <stddef.h> // intptr_t
#else
@ -6298,9 +6297,9 @@ bool ImGui::ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFl
RenderFrameBorder(bb.Min, bb.Max, rounding);
else
#ifdef __APPLE__
window->DrawList->AddRect(bb.Min - ImVec2(3, 3), bb.Max + ImVec2(3, 3), GetColorU32(ImGuiCol_FrameBg), rounding * 2,NULL,4.0f);; // Color button are often in need of some sort of border
window->DrawList->AddRect(bb.Min - ImVec2(3, 3), bb.Max + ImVec2(3, 3), GetColorU32(ImGuiCol_FrameBg), rounding * 2, 0, 4.0f); // Color button are often in need of some sort of border
#else
window->DrawList->AddRect(bb.Min - ImVec2(2, 2), bb.Max + ImVec2(2, 2), GetColorU32(ImGuiCol_FrameBg), rounding * 2,NULL,3.0f); // Color button are often in need of some sort of border
window->DrawList->AddRect(bb.Min - ImVec2(2, 2), bb.Max + ImVec2(2, 2), GetColorU32(ImGuiCol_FrameBg), rounding * 2, 0, 3.0f); // Color button are often in need of some sort of border
#endif
}

View file

@ -200,7 +200,7 @@ SplittedLine do_split_line(const ClipperZUtils::ZPath& path, const ExPolygons& c
// Chain segment back to the original path
ClipperZUtils::ZPoint& front = segment.front();
const ClipperZUtils::ZPoint* previous_src_point;
const ClipperZUtils::ZPoint* previous_src_point = nullptr;
if (is_src(front)) {
// The segment starts with a point from src path, which means apart from the last point,
// all other points on this segment should come from the src path or the clip polygon

View file

@ -587,9 +587,9 @@ double getadhesionCoeff(const PrintObject* printObject)
}
double adhesionCoeff = 1;
for (const ModelVolume* modelVolume : objectVolumes) {
for (auto iter = extrudersFirstLayer.begin(); iter != extrudersFirstLayer.end(); iter++)
for (auto iter = extrudersFirstLayer.begin(); iter != extrudersFirstLayer.end(); iter++) {
if (modelVolume->extruder_id() == *iter) {
if (Model::extruderParamsMap.find(modelVolume->extruder_id()) != Model::extruderParamsMap.end())
if (Model::extruderParamsMap.find(modelVolume->extruder_id()) != Model::extruderParamsMap.end()) {
if (Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "PETG" ||
Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "PCTG") {
adhesionCoeff = 2;
@ -597,11 +597,13 @@ double getadhesionCoeff(const PrintObject* printObject)
else if (Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "TPU") {
adhesionCoeff = 0.5;
}
}
}
}
}
return adhesionCoeff;
/*
/*
def->enum_values.push_back("PLA");
def->enum_values.push_back("PET");
def->enum_values.push_back("ABS");
@ -1653,7 +1655,7 @@ ExtrusionEntityCollection makeBrimInfill(const ExPolygons& singleBrimArea, const
Polylines loops_pl = to_polylines(loops);
loops_pl_by_levels.assign(loops_pl.size(), Polylines());
tbb::parallel_for(tbb::blocked_range<size_t>(0, loops_pl.size()),
[&loops_pl_by_levels, &loops_pl, &islands_area](const tbb::blocked_range<size_t>& range) {
[&loops_pl_by_levels, &loops_pl /*, &islands_area*/](const tbb::blocked_range<size_t>& range) {
for (size_t i = range.begin(); i < range.end(); ++i) {
loops_pl_by_levels[i] = chain_polylines({ std::move(loops_pl[i]) });
//loops_pl_by_levels[i] = chain_polylines(intersection_pl({ std::move(loops_pl[i]) }, islands_area));

View file

@ -513,7 +513,7 @@ encoding_check(libslic3r)
target_compile_definitions(libslic3r PUBLIC -DUSE_TBB -DTBB_USE_CAPTURED_EXCEPTION=0)
target_include_directories(libslic3r PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(libslic3r PUBLIC ${EXPAT_INCLUDE_DIRS})
target_include_directories(libslic3r SYSTEM PUBLIC ${EXPAT_INCLUDE_DIRS})
# Find the OCCT and related libraries
set(OpenCASCADE_DIR "${CMAKE_PREFIX_PATH}/lib/cmake/occt")

View file

@ -94,10 +94,10 @@ template<typename PointType> inline void clip_clipper_polygon_with_subject_bbox_
}
// Never produce just a single point output polygon.
if (!out.empty())
if(get_entire_polygons){
if (!out.empty()) {
if (get_entire_polygons) {
out=src;
}else{
} else {
if (int sides_next = sides(out.front());
// The last point is inside. Take it.
sides_this == 0 ||
@ -106,7 +106,7 @@ template<typename PointType> inline void clip_clipper_polygon_with_subject_bbox_
(sides_prev & sides_this & sides_next) == 0)
out.emplace_back(src.back());
}
}
}
void clip_clipper_polygon_with_subject_bbox(const Points &src, const BoundingBox &bbox, Points &out, const bool get_entire_polygons) { clip_clipper_polygon_with_subject_bbox_templ(src, bbox, out, get_entire_polygons); }

View file

@ -257,7 +257,7 @@ ColorRGBA complementary(const ColorRGBA& color)
ColorRGB saturate(const ColorRGB& color, float factor)
{
float h, s, v;
float h = 0.0, s = 0.0, v = 0.0;
RGBtoHSV(color.r(), color.g(), color.b(), h, s, v);
s = std::clamp(s * factor, 0.0f, 1.0f);
float r, g, b;
@ -272,7 +272,7 @@ ColorRGBA saturate(const ColorRGBA& color, float factor)
ColorRGB opposite(const ColorRGB& color)
{
float h, s, v;
float h = 0.0, s = 0.0, v = 0.0;
RGBtoHSV(color.r(), color.g(), color.b(), h, s, v);
h += 65.0f; // 65 instead 60 to avoid circle values

View file

@ -61,8 +61,8 @@ void FillConcentric::_fill_surface_single(
size_t iPathFirst = polylines_out.size();
Point last_pos(0, 0);
double min_nozzle_diameter;
bool dir;
double min_nozzle_diameter = 0.0;
bool dir = false;
if (this->print_config != nullptr && params.density >= STAGGER_SEAM_THRESHOLD) {
min_nozzle_diameter = *std::min_element(print_config->nozzle_diameter.values.begin(), print_config->nozzle_diameter.values.end());
dir = rand() % 2;

View file

@ -845,9 +845,10 @@ static std::vector<Vec2d> get_path_of_change_filament(const Print& print)
// All G1 commands should be translated and rotated. X and Y coords are
// only pushed to the output when they differ from last time.
// WT generator can override this by appending the never_skip_tag
if (line.find("G1 ") == 0) {
bool never_skip = false;
auto it = line.find(WipeTower::never_skip_tag());
if (line.find("G1 ") == 0 || line.find("G2 ") == 0 || line.find("G3 ") == 0) {
std::string cur_gcode_start = line.find("G1 ") == 0 ? "G1 " : (line.find("G2 ") == 0 ? "G2 " : "G3 ");
bool never_skip = false;
auto it = line.find(WipeTower::never_skip_tag());
if (it != std::string::npos) {
// remove the tag and remember we saw it
never_skip = true;
@ -855,7 +856,7 @@ static std::vector<Vec2d> get_path_of_change_filament(const Print& print)
}
std::ostringstream line_out;
std::istringstream line_str(line);
line_str >> std::noskipws; // don't skip whitespace
line_str >> std::noskipws; // don't skip whitespace
char ch = 0;
while (line_str >> ch) {
if (ch == 'X' || ch == 'Y')
@ -869,13 +870,13 @@ static std::vector<Vec2d> get_path_of_change_filament(const Print& print)
if (transformed_pos != old_pos || never_skip) {
line = line_out.str();
std::ostringstream oss;
oss << std::fixed << std::setprecision(3) << "G1 ";
oss << std::fixed << std::setprecision(3) << cur_gcode_start;
if (transformed_pos.x() != old_pos.x() || never_skip)
oss << " X" << transformed_pos.x() - extruder_offset.x();
if (transformed_pos.y() != old_pos.y() || never_skip)
oss << " Y" << transformed_pos.y() - extruder_offset.y();
oss << " ";
line.replace(line.find("G1 "), 3, oss.str());
line.replace(line.find(cur_gcode_start), 3, oss.str());
old_pos = transformed_pos;
}
}

View file

@ -421,11 +421,12 @@ void FanMover::_process_gcode_line(GCodeReader& reader, const GCodeReader::GCode
current_role = ExtrusionEntity::string_to_role(extrusion_string);
}
if (line.raw().size() > 16) {
if (line.raw().rfind("; custom gcode", 0) != std::string::npos)
if (line.raw().rfind("; custom gcode", 0) != std::string::npos) {
if (line.raw().rfind("; custom gcode end", 0) != std::string::npos)
m_is_custom_gcode = false;
else
m_is_custom_gcode = true;
}
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -10,6 +10,7 @@
#include <algorithm>
#include "libslic3r/Point.hpp"
#include "libslic3r/Polygon.hpp"
#include "WipeTower.hpp"
namespace Slic3r
{
@ -85,7 +86,8 @@ public:
while (!m_plan.empty() && m_layer_info->z < print_z - WT_EPSILON && m_layer_info+1 != m_plan.end())
++m_layer_info;
m_current_shape = (! this->is_first_layer() && m_current_shape == SHAPE_NORMAL) ? SHAPE_REVERSED : SHAPE_NORMAL;
//m_current_shape = (! this->is_first_layer() && m_current_shape == SHAPE_NORMAL) ? SHAPE_REVERSED : SHAPE_NORMAL;
m_current_shape = SHAPE_NORMAL;
if (this->is_first_layer()) {
m_num_layer_changes = 0;
m_num_tool_changes = 0;
@ -156,6 +158,8 @@ public:
bool multitool_ramming;
float multitool_ramming_time = 0.f;
float filament_minimal_purge_on_wipe_tower = 0.f;
float retract_length;
float retract_speed;
};
private:
@ -196,6 +200,14 @@ private:
float m_first_layer_speed = 0.f;
size_t m_first_layer_idx = size_t(-1);
int m_wall_type;
bool m_used_fillet = true;
float m_rib_width = 10;
float m_extra_rib_length = 0;
float m_rib_length = 0;
bool m_enable_arc_fitting = false;
// G-code generator parameters.
float m_cooling_tube_retraction = 0.f;
float m_cooling_tube_length = 0.f;
@ -315,6 +327,24 @@ private:
WipeTowerWriter2 &writer,
const WipeTower::box_coordinates &cleaning_box,
float wipe_volume);
Polygon generate_support_rib_wall(WipeTowerWriter2& writer,
const WipeTower::box_coordinates& wt_box,
double feedrate,
bool first_layer,
bool rib_wall,
bool extrude_perimeter,
bool skip_points);
Polygon generate_support_cone_wall(
WipeTowerWriter2& writer,
const WipeTower::box_coordinates& wt_box,
double feedrate,
bool infill_cone,
float spacing);
Polygon generate_rib_polygon(const WipeTower::box_coordinates& wt_box);
};

View file

@ -3200,7 +3200,7 @@ double getadhesionCoeff(const ModelVolumePtrs objectVolumes)
{
double adhesionCoeff = 1;
for (const ModelVolume* modelVolume : objectVolumes) {
if (Model::extruderParamsMap.find(modelVolume->extruder_id()) != Model::extruderParamsMap.end())
if (Model::extruderParamsMap.find(modelVolume->extruder_id()) != Model::extruderParamsMap.end()) {
if (Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "PETG" ||
Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "PCTG") {
adhesionCoeff = 2;
@ -3208,6 +3208,7 @@ double getadhesionCoeff(const ModelVolumePtrs objectVolumes)
else if (Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "TPU") {
adhesionCoeff = 0.5;
}
}
}
return adhesionCoeff;
}

View file

@ -830,7 +830,9 @@ static std::vector<std::string> s_Preset_print_options {
"tree_support_brim_width", "gcode_comments", "gcode_label_objects",
"initial_layer_travel_speed", "exclude_object", "slow_down_layers", "infill_anchor", "infill_anchor_max","initial_layer_min_bead_width",
"make_overhang_printable", "make_overhang_printable_angle", "make_overhang_printable_hole_size" ,"notes",
"wipe_tower_cone_angle", "wipe_tower_extra_spacing","wipe_tower_max_purge_speed", "wipe_tower_filament", "wiping_volumes_extruders","wipe_tower_bridging", "wipe_tower_extra_flow","single_extruder_multi_material_priming",
"wipe_tower_cone_angle", "wipe_tower_extra_spacing","wipe_tower_max_purge_speed",
"wipe_tower_wall_type", "wipe_tower_extra_rib_length", "wipe_tower_rib_width", "wipe_tower_fillet_wall",
"wipe_tower_filament", "wiping_volumes_extruders","wipe_tower_bridging", "wipe_tower_extra_flow","single_extruder_multi_material_priming",
"wipe_tower_rotation_angle", "tree_support_branch_distance_organic", "tree_support_branch_diameter_organic", "tree_support_branch_angle_organic",
"hole_to_polyhole", "hole_to_polyhole_threshold", "hole_to_polyhole_twisted", "mmu_segmented_region_max_width", "mmu_segmented_region_interlocking_depth",
"small_area_infill_flow_compensation", "small_area_infill_flow_compensation_model",

View file

@ -304,6 +304,10 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|| opt_key == "wipe_tower_cone_angle"
|| opt_key == "wipe_tower_extra_spacing"
|| opt_key == "wipe_tower_max_purge_speed"
|| opt_key == "wipe_tower_wall_type"
|| opt_key == "wipe_tower_extra_rib_length"
|| opt_key == "wipe_tower_rib_width"
|| opt_key == "wipe_tower_fillet_wall"
|| opt_key == "wipe_tower_filament"
|| opt_key == "wiping_volumes_extruders"
|| opt_key == "enable_filament_ramming"

View file

@ -445,6 +445,13 @@ static const t_config_enum_values s_keys_map_CounterboreHoleBridgingOption{
};
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(CounterboreHoleBridgingOption)
static const t_config_enum_values s_keys_map_WipeTowerWallType{
{"rectangle", wtwRectangle},
{"cone", wtwCone},
{"rib", wtwRib},
};
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(WipeTowerWallType)
static void assign_printer_technology_to_unknown(t_optiondef_map &options, PrinterTechnology printer_technology)
{
for (std::pair<const t_config_option_key, ConfigOptionDef> &kvp : options)
@ -5394,7 +5401,7 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->min = 0.;
def->max = 90.;
def->set_default_value(new ConfigOptionFloat(0.));
def->set_default_value(new ConfigOptionFloat(30.0));
def = this->add("wipe_tower_max_purge_speed", coFloat);
def->label = L("Maximum wipe tower print speed");
@ -5409,6 +5416,46 @@ void PrintConfigDef::init_fff_params()
def->min = 10;
def->set_default_value(new ConfigOptionFloat(90.));
def = this->add("wipe_tower_wall_type", coEnum);
def->label = L("Wall type");
def->tooltip = L("Wipe tower outer wall type.\n"
"1. Rectangle: The default wall type, a rectangle with fixed width and height.\n"
"2. Cone: A cone with a fillet at the bottom to help stabilize the wipe tower.\n"
"3. Rib: Adds four ribs to the tower wall for enhanced stability.");
def->enum_keys_map = &ConfigOptionEnum<WipeTowerWallType>::get_enum_values();
def->enum_values.emplace_back("rectangle");
def->enum_values.emplace_back("cone");
def->enum_values.emplace_back("rib");
def->enum_labels.emplace_back("Rectangle");
def->enum_labels.emplace_back("Cone");
def->enum_labels.emplace_back("Rib");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnum<WipeTowerWallType>(wtwRectangle));
def = this->add("wipe_tower_extra_rib_length", coFloat);
def->label = L("Extra rib length");
def->tooltip = L("Positive values can increase the size of the rib wall, while negative values can reduce the size."
"However, the size of the rib wall can not be smaller than that determined by the cleaning volume.");
def->sidetext = L("mm");
def->max = 300;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(0));
def = this->add("wipe_tower_rib_width", coFloat);
def->label = L("Rib width");
def->tooltip = L("Rib width");
def->sidetext = L("mm");
def->mode = comAdvanced;
def->min = 0;
def->set_default_value(new ConfigOptionFloat(8));
def = this->add("wipe_tower_fillet_wall", coBool);
def->label = L("Fillet wall");
def->tooltip = L("The wall of prime tower will fillet.");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(true));
def = this->add("wipe_tower_filament", coInt);
def->gui_type = ConfigOptionDef::GUIType::i_enum_open;
def->label = L("Wipe tower");

View file

@ -345,6 +345,12 @@ enum CounterboreHoleBridgingOption {
chbNone, chbBridges, chbFilled
};
enum WipeTowerWallType {
wtwRectangle = 0,
wtwCone,
wtwRib
};
static std::string bed_type_to_gcode_string(const BedType type)
{
std::string type_str;
@ -452,7 +458,9 @@ CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(GCodeThumbnailsFormat)
CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(CounterboreHoleBridgingOption)
CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(PrintHostType)
CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(AuthorizationType)
CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(WipeTowerWallType)
CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(PerimeterGeneratorType)
#undef CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS
class DynamicPrintConfig;
@ -1340,6 +1348,10 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
((ConfigOptionFloat, wipe_tower_cone_angle))
((ConfigOptionPercent, wipe_tower_extra_spacing))
((ConfigOptionFloat, wipe_tower_max_purge_speed))
((ConfigOptionEnum<WipeTowerWallType>, wipe_tower_wall_type))
((ConfigOptionFloat, wipe_tower_extra_rib_length))
((ConfigOptionFloat, wipe_tower_rib_width))
((ConfigOptionBool, wipe_tower_fillet_wall))
((ConfigOptionInt, wipe_tower_filament))
((ConfigOptionFloats, wiping_volumes_extruders))
((ConfigOptionInts, idle_temperature))

View file

@ -2474,7 +2474,7 @@ void cut_mesh(const indexed_triangle_set& mesh, float z, indexed_triangle_set* u
// intersect v0-v1 and v2-v0 with cutting plane and make new vertices
auto new_vertex = [upper, lower, &upper_slice_vertices, &lower_slice_vertices](const Vec3f &a, const int ia, const Vec3f &b, const int ib, const Vec3f &c,
const int ic, const Vec3f &new_pt, bool &is_new_vertex) {
int iupper, ilower;
int iupper = 0, ilower = 0;
is_new_vertex = false;
if (is_equal(new_pt, a))
iupper = ilower = ia;

View file

@ -2770,7 +2770,7 @@ REAL permanent;
REAL cxtaa[8], cxtbb[8], cytaa[8], cytbb[8];
int cxtaalen, cxtbblen, cytaalen, cytbblen;
REAL axtbc[8], aytbc[8], bxtca[8], bytca[8], cxtab[8], cytab[8];
int axtbclen, aytbclen, bxtcalen, bytcalen, cxtablen, cytablen;
int axtbclen = 0, aytbclen = 0, bxtcalen = 0, bytcalen = 0, cxtablen = 0, cytablen = 0;
REAL axtbct[16], aytbct[16], bxtcat[16], bytcat[16], cxtabt[16], cytabt[16];
int axtbctlen, aytbctlen, bxtcatlen, bytcatlen, cxtabtlen, cytabtlen;
REAL axtbctt[8], aytbctt[8], bxtcatt[8];
@ -8679,4 +8679,4 @@ REAL* pe;
}
#endif
#endif
#endif

View file

@ -1661,8 +1661,8 @@ static int nsvg__parseRotate(float* xform, const char* str)
static void nsvg__parseTransform(float* xform, const char* str)
{
float t[6];
int len;
float t[6] = {0.0};
int len;
nsvg__xformIdentity(xform);
while (*str)
{

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
export ROOT=$(echo $ROOT | grep . || pwd)
export NCORES=`nproc --all`
@ -8,7 +8,7 @@ while getopts ":ih" opt; do
i )
export BUILD_IMAGE="1"
;;
h ) echo "Usage: ./BuildLinuxImage.sh [-i]"
h ) echo "Usage: ./build_linux_image.sh [-i]"
echo " -i: Generate Appimage (optional)"
exit 0
;;
@ -67,9 +67,9 @@ EOF
chmod ug+x @SLIC3R_APP_CMD@
cp -f @SLIC3R_APP_CMD@ package/@SLIC3R_APP_CMD@
pushd package
pushd package > /dev/null
tar -cvf ../@SLIC3R_APP_KEY@.tar . &>/dev/null
popd
popd > /dev/null
#} &> $ROOT/Build.log # Capture all command output
echo "done"
@ -77,10 +77,10 @@ if [[ -n "$BUILD_IMAGE" ]]
then
echo -n "Creating Appimage for distribution..."
#{
pushd package
pushd package > /dev/null
chmod +x ../build_appimage.sh
../build_appimage.sh
popd
popd > /dev/null
mv package/"@SLIC3R_APP_KEY@_Linux_V@SoftFever_VERSION@.AppImage" "@SLIC3R_APP_KEY@_Linux_V@SoftFever_VERSION@.AppImage"
#} &> $ROOT/Build.log # Capture all command output
echo "done"

View file

@ -145,7 +145,7 @@ endif(UNIX)
##################################################
# LIBDIR is defined in the main xs CMake file:
target_include_directories(${qhull_STATIC} BEFORE PUBLIC ${LIBDIR}/qhull/src)
target_include_directories(${qhull_STATIC} SYSTEM BEFORE PUBLIC ${LIBDIR}/qhull/src)
target_link_libraries(qhull INTERFACE ${qhull_STATIC})
endif()

View file

@ -630,7 +630,7 @@ add_library(libslic3r_gui STATIC ${SLIC3R_GUI_SOURCES})
target_include_directories(libslic3r_gui PRIVATE Utils)
if (WIN32)
target_include_directories(libslic3r_gui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../deps/WebView2/include)
target_include_directories(libslic3r_gui SYSTEM PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../deps/WebView2/include)
endif()
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SLIC3R_GUI_SOURCES})
@ -647,9 +647,9 @@ elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
FIND_LIBRARY(WAYLAND_EGL_LIBRARIES NAMES wayland-egl)
FIND_LIBRARY(WAYLAND_CLIENT_LIBRARIES NAMES wayland-client)
find_package(CURL REQUIRED)
target_link_libraries(libslic3r_gui ${DBUS_LIBRARIES} OSMesa)
target_link_libraries(libslic3r_gui
OpenGL::EGL
${DBUS_LIBRARIES}
${WAYLAND_SERVER_LIBRARIES}
${WAYLAND_EGL_LIBRARIES}
${WAYLAND_CLIENT_LIBRARIES}

View file

@ -320,7 +320,7 @@ void CaliPresetCustomRangePanel::create_panel(wxWindow* parent)
std::string decimal_point;
std::string expression = "^[-+]?[0-9]+([,.][0-9]+)?$";
std::regex decimalRegex(expression);
int decimal_number;
int decimal_number = 0;
if (std::regex_match(number, decimalRegex)) {
std::smatch match;
if (std::regex_search(number, match, decimalRegex)) {

View file

@ -686,10 +686,19 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
for (auto el : {"wipe_tower_rotation_angle", "wipe_tower_cone_angle",
"wipe_tower_extra_spacing", "wipe_tower_max_purge_speed",
"wipe_tower_wall_type",
"wipe_tower_extra_rib_length","wipe_tower_rib_width","wipe_tower_fillet_wall",
"wipe_tower_bridging", "wipe_tower_extra_flow",
"wipe_tower_no_sparse_layers"})
toggle_line(el, have_prime_tower && !is_BBL_Printer);
WipeTowerWallType wipe_tower_wall_type = config->opt_enum<WipeTowerWallType>("wipe_tower_wall_type");
toggle_line("wipe_tower_cone_angle", have_prime_tower && !is_BBL_Printer && wipe_tower_wall_type == WipeTowerWallType::wtwCone);
toggle_line("wipe_tower_extra_rib_length", have_prime_tower && !is_BBL_Printer && wipe_tower_wall_type == WipeTowerWallType::wtwRib);
toggle_line("wipe_tower_rib_width", have_prime_tower && !is_BBL_Printer && wipe_tower_wall_type == WipeTowerWallType::wtwRib);
toggle_line("wipe_tower_fillet_wall", have_prime_tower && !is_BBL_Printer && wipe_tower_wall_type == WipeTowerWallType::wtwRib);
toggle_line("single_extruder_multi_material_priming", !bSEMM && have_prime_tower && !is_BBL_Printer);
toggle_line("prime_volume",have_prime_tower && (!purge_in_primetower || !bSEMM));

View file

@ -160,7 +160,7 @@ void ConnectPrinterDialog::on_button_confirm(wxCommandEvent &event)
{
wxString code = m_textCtrl_code->GetTextCtrl()->GetValue();
for (char c : code) {
if (!('0' <= c && c <= '9' || 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z')) {
if (!(('0' <= c && c <= '9') || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'))) {
show_error(this, _L("Invalid input."));
return;
}
@ -187,4 +187,4 @@ void ConnectPrinterDialog::on_dpi_changed(const wxRect &suggested_rect)
Layout();
this->Refresh();
}
}} // namespace Slic3r::GUI
}} // namespace Slic3r::GUI

View file

@ -778,7 +778,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_vendor_item()
m_filament_custom_vendor_input->SetSize(NAME_OPTION_COMBOBOX_SIZE);
textInputSizer->Add(m_filament_custom_vendor_input, 0, wxEXPAND | wxALL, 0);
m_filament_custom_vendor_input->GetTextCtrl()->SetHint(_L("Input Custom Vendor"));
m_filament_custom_vendor_input->GetTextCtrl()->Bind(wxEVT_CHAR, [this](wxKeyEvent &event) {
m_filament_custom_vendor_input->GetTextCtrl()->Bind(wxEVT_CHAR, [](wxKeyEvent &event) {
int key = event.GetKeyCode();
if (cannot_input_key.find(key) != cannot_input_key.end()) {
event.Skip(false);
@ -888,7 +888,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_serial_item()
m_filament_serial_input = new TextInput(this, "", "", "", wxDefaultPosition, NAME_OPTION_COMBOBOX_SIZE, wxTE_PROCESS_ENTER);
m_filament_serial_input->GetTextCtrl()->SetMaxLength(50);
comboBoxSizer->Add(m_filament_serial_input, 0, wxEXPAND | wxALL, 0);
m_filament_serial_input->GetTextCtrl()->Bind(wxEVT_CHAR, [this](wxKeyEvent &event) {
m_filament_serial_input->GetTextCtrl()->Bind(wxEVT_CHAR, [](wxKeyEvent &event) {
int key = event.GetKeyCode();
if (cannot_input_key.find(key) != cannot_input_key.end()) {
event.Skip(false);
@ -1750,7 +1750,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_printer_item(wxWindow *parent)
m_custom_vendor_text_ctrl = new wxTextCtrl(parent, wxID_ANY, "", wxDefaultPosition, NAME_OPTION_COMBOBOX_SIZE);
m_custom_vendor_text_ctrl->SetHint(_L("Input Custom Vendor"));
m_custom_vendor_text_ctrl->Bind(wxEVT_CHAR, [this](wxKeyEvent &event) {
m_custom_vendor_text_ctrl->Bind(wxEVT_CHAR, [](wxKeyEvent &event) {
int key = event.GetKeyCode();
if (cannot_input_key.find(key) != cannot_input_key.end()) { // "@" can not be inputed
event.Skip(false);
@ -1762,7 +1762,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_printer_item(wxWindow *parent)
m_custom_vendor_text_ctrl->Hide();
m_custom_model_text_ctrl = new wxTextCtrl(parent, wxID_ANY, "", wxDefaultPosition, NAME_OPTION_COMBOBOX_SIZE);
m_custom_model_text_ctrl->SetHint(_L("Input Custom Model"));
m_custom_model_text_ctrl->Bind(wxEVT_CHAR, [this](wxKeyEvent &event) {
m_custom_model_text_ctrl->Bind(wxEVT_CHAR, [](wxKeyEvent &event) {
int key = event.GetKeyCode();
if (cannot_input_key.find(key) != cannot_input_key.end()) { // "@" can not be inputed
event.Skip(false);
@ -3242,8 +3242,8 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con
horizontal_sizer->Add(success_bitmap_sizer, 0, wxEXPAND | wxALL, FromDIP(5));
wxBoxSizer *success_text_sizer = new wxBoxSizer(wxVERTICAL);
wxStaticText *success_text;
wxStaticText *next_step_text;
wxStaticText *success_text = nullptr;
wxStaticText *next_step_text = nullptr;
bool sync_user_preset_need_enabled = wxGetApp().getAgent() && wxGetApp().app_config->get("sync_user_preset") == "false";
switch (create_success_type) {
case PRINTER:

View file

@ -15,16 +15,13 @@
#include "format.hpp"
#include "Tab.hpp"
#include "wxExtensions.hpp"
#include "BitmapCache.hpp"
#include "ExtraRenderers.hpp"
#include "MsgDialog.hpp"
#include "Plater.hpp"
#include "Widgets/DialogButtons.hpp"
#include "libslic3r/PlaceholderParser.hpp"
#include "libslic3r/Preset.hpp"
#include "libslic3r/Print.hpp"
#define BTN_GAP FromDIP(20)
#define BTN_SIZE wxSize(FromDIP(58), FromDIP(24))
@ -61,7 +58,7 @@ EditGCodeDialog::EditGCodeDialog(wxWindow* parent, const std::string& key, const
m_search_bar->SetForegroundColour(*wxBLACK);
wxGetApp().UpdateDarkUI(m_search_bar);
m_search_bar->Bind(wxEVT_SET_FOCUS, [this](wxFocusEvent&) {
m_search_bar->Bind(wxEVT_SET_FOCUS, [](wxFocusEvent&) {
// this->on_search_update();
});
m_search_bar->Bind(wxEVT_COMMAND_TEXT_UPDATED, [this](wxCommandEvent&) {
@ -256,9 +253,9 @@ wxDataViewItem EditGCodeDialog::add_presets_placeholders()
const auto& full_config = wxGetApp().preset_bundle->full_config();
const auto& tab_list = wxGetApp().tabs_list;
Tab* tab_print;
Tab* tab_filament;
Tab* tab_printer;
Tab* tab_print = nullptr;
Tab* tab_filament = nullptr;
Tab* tab_printer = nullptr;
for (const auto tab : tab_list) {
if (tab->m_type == Preset::TYPE_PRINT)
tab_print = tab;

View file

@ -3511,7 +3511,7 @@ void GLCanvas3D::on_key(wxKeyEvent& evt)
m_dirty = true;
#endif
} else if ((evt.ShiftDown() && evt.ControlDown() && keyCode == WXK_RETURN) ||
evt.ShiftDown() && evt.AltDown() && keyCode == WXK_RETURN) {
(evt.ShiftDown() && evt.AltDown() && keyCode == WXK_RETURN)) {
wxGetApp().plater()->toggle_show_wireframe();
m_dirty = true;
}
@ -6640,8 +6640,8 @@ bool GLCanvas3D::_init_assemble_view_toolbar()
item.left.action_callback = [this]() { if (m_canvas != nullptr) wxPostEvent(m_canvas, SimpleEvent(EVT_GLVIEWTOOLBAR_ASSEMBLE)); };
item.left.render_callback = GLToolbarItem::Default_Render_Callback;
item.visible = true;
item.visibility_callback = [this]()->bool { return true; };
item.enabling_callback = [this]()->bool {
item.visibility_callback = []()->bool { return true; };
item.enabling_callback = []()->bool {
return wxGetApp().plater()->has_assmeble_view();
};
if (!m_assemble_view_toolbar.add_item(item))
@ -6690,7 +6690,7 @@ bool GLCanvas3D::_init_separator_toolbar()
sperate_item.name = "start_seperator";
sperate_item.icon_filename = "seperator.svg";
sperate_item.sprite_id = 0;
sperate_item.left.action_callback = [this]() {};
sperate_item.left.action_callback = []() {};
sperate_item.visibility_callback = []()->bool { return true; };
sperate_item.enabling_callback = []()->bool { return false; };
if (!m_separator_toolbar.add_item(sperate_item))
@ -7407,7 +7407,7 @@ void GLCanvas3D::_render_objects(GLVolumeCollection::ERenderType type, bool with
}*/
const Camera& camera = wxGetApp().plater()->get_camera();
//BBS:add assemble view related logic
m_volumes.render(type, false, camera.get_view_matrix(), camera.get_projection_matrix(), cvn_size, [this, canvas_type](const GLVolume& volume) {
m_volumes.render(type, false, camera.get_view_matrix(), camera.get_projection_matrix(), cvn_size, [canvas_type](const GLVolume& volume) {
if (canvas_type == ECanvasType::CanvasAssembleView) {
return !volume.is_modifier;
}
@ -7783,7 +7783,7 @@ void GLCanvas3D::_render_gizmos_overlay()
// m_gizmos.set_overlay_scale(wxGetApp().em_unit()*0.1f);
const float size = int(GLGizmosManager::Default_Icons_Size * wxGetApp().toolbar_icon_scale());
m_gizmos.set_overlay_icon_size(size); //! #ys_FIXME_experiment
#endif /* __WXMSW__ */
#endif */ /* __WXMSW__ */
m_gizmos.render_overlay();
if (m_gizmo_highlighter.m_render_arrow)
@ -8474,7 +8474,7 @@ float GLCanvas3D::_show_assembly_tooltip_information(float caption_max, float x,
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip2(ImVec2(x, y));
auto draw_text_with_caption = [this, &imgui, & caption_max](const wxString &caption, const wxString &text) {
auto draw_text_with_caption = [&imgui, & caption_max](const wxString &caption, const wxString &text) {
imgui->text_colored(ImGuiWrapper::COL_ACTIVE, caption);
ImGui::SameLine(caption_max);
imgui->text_colored(ImGuiWrapper::COL_WINDOW_BG, text);

View file

@ -2007,7 +2007,7 @@ void GUI_App::init_app_config()
}
// Change current dirtory of application
chdir(encode_path((Slic3r::data_dir() + "/log").c_str()).c_str());
[[maybe_unused]] auto unused_result = chdir(encode_path((Slic3r::data_dir() + "/log").c_str()).c_str());
} else {
m_datadir_redefined = true;
}

View file

@ -204,8 +204,8 @@ bool GLGizmoBrimEars::unproject_on_mesh2(const Vec2d &mouse_pos, std::pair<Vec3f
double clp_dist = m_c->object_clipper()->get_position();
const ClippingPlane *clp = m_c->object_clipper()->get_clipping_plane();
bool mouse_on_object = false;
Vec3f position_on_model;
Vec3f normal_on_model;
Vec3f position_on_model {};
Vec3f normal_on_model {};
double closest_hit_distance = std::numeric_limits<double>::max();
for (auto item : m_mesh_raycaster_map) {

View file

@ -1817,7 +1817,7 @@ void GLGizmoMeasure::show_selection_ui()
return text;
};
float selection_cap_length;
float selection_cap_length = 0;
if (m_measure_mode == EMeasureMode::ONLY_ASSEMBLY) {
if (m_assembly_mode == AssemblyMode::FACE_FACE) {
selection_cap_length = ImGui::CalcTextSize((_u8L("Selection") + " 1" + _u8L(" (Moving)")).c_str()).x * 1.2;

View file

@ -395,7 +395,7 @@ void MediaFilePanel::SetSelecting(bool selecting)
m_image_grid->SetSelecting(selecting);
m_button_management->SetLabel(selecting ? _L("Cancel") : _L("Select"));
auto fs = m_image_grid->GetFileSystem();
bool download_support = fs && fs->GetFileType() < PrinterFileSystem::F_MODEL || m_model_download_support;
bool download_support = (fs && fs->GetFileType() < PrinterFileSystem::F_MODEL) || m_model_download_support;
m_manage_panel->GetSizer()->Show(m_button_download, selecting && download_support);
m_manage_panel->GetSizer()->Show(m_button_delete, selecting);
m_manage_panel->GetSizer()->Show(m_button_refresh, !selecting);

View file

@ -640,7 +640,7 @@ void ObjColorPanel::draw_table()
m_color_cluster_icon_list.clear();
m_extruder_icon_list.clear();
float row_height ;
float row_height = 0;
for (size_t ii = 0; ii < row; ii++) {
wxPanel *row_panel = new wxPanel(m_scrolledWindow);
row_panel->SetBackgroundColour(ii % 2 == 0 ? *wxWHITE : wxColour(238, 238, 238));

View file

@ -576,7 +576,7 @@ void PartPlate::calc_vertex_for_plate_name_edit_icon(GLTexture *texture, int ind
float height = icon_sz;
float offset_y = factor * PARTPLATE_TEXT_OFFSET_Y;
float name_width;
float name_width = 0.0;
if (texture && texture->get_width() > 0 && texture->get_height())
// original width give correct ratio in here since rendering width can be much higher because of next_highest_power_of_2 for rendering
name_width = icon_sz * texture->m_original_width / texture->get_height();

View file

@ -55,8 +55,8 @@ LayerNumberTextInput::LayerNumberTextInput(wxWindow* parent, int layer_number, w
// value should not be less than MIN_LAYER_VALUE, and should not be greater than MAX_LAYER_VALUE
gui_value = std::clamp(gui_value, MIN_LAYER_VALUE, MAX_LAYER_VALUE);
int begin_value;
int end_value;
int begin_value = 0;
int end_value = 0;
LayerNumberTextInput* end_layer_input = nullptr;
if (this->m_type == Type::Begin) {
begin_value = gui_value;
@ -688,4 +688,4 @@ void PlateNameEditDialog::set_plate_name(const wxString &name) {
}
} // namespace Slic3r::GUI
} // namespace Slic3r::GUI

View file

@ -2827,7 +2827,9 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
"brim_width", "wall_loops", "wall_filament", "sparse_infill_density", "sparse_infill_filament", "top_shell_layers",
"enable_support", "support_filament", "support_interface_filament",
"support_top_z_distance", "support_bottom_z_distance", "raft_layers",
"wipe_tower_rotation_angle", "wipe_tower_cone_angle", "wipe_tower_extra_spacing", "wipe_tower_extra_flow", "wipe_tower_max_purge_speed", "wipe_tower_filament",
"wipe_tower_rotation_angle", "wipe_tower_cone_angle", "wipe_tower_extra_spacing", "wipe_tower_extra_flow", "wipe_tower_max_purge_speed",
"wipe_tower_wall_type", "wipe_tower_extra_rib_length","wipe_tower_rib_width","wipe_tower_fillet_wall",
"wipe_tower_filament",
"best_object_pos"
}))
, sidebar(new Sidebar(q))
@ -3667,7 +3669,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
bool dlg_cont = true;
bool is_user_cancel = false;
bool translate_old = false;
int current_width, current_depth, current_height;
int current_width = 0, current_depth = 0, current_height = 0;
if (input_files.empty()) { return std::vector<size_t>(); }
@ -9080,7 +9082,7 @@ void Plater::load_project(wxString const& filename2,
// if res is empty no data has been loaded
if (!res.empty() && (load_restore || !(strategy & LoadStrategy::Silence))) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " call set_project_filename: " << load_restore ? originfile : filename;
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " call set_project_filename: " << (load_restore ? originfile : filename);
p->set_project_filename(load_restore ? originfile : filename);
if (load_restore && originfile.IsEmpty()) {
p->set_project_name(_L("Untitled"));

View file

@ -14,20 +14,22 @@ wxDEFINE_EVENT(EVT_WIPE_TOWER_CHART_CHANGED, wxCommandEvent);
void Chart::draw() {
wxAutoBufferedPaintDC dc(this); // unbuffered DC caused flickering on win
// scaling button and tick line from text size gives better result compared to dc.GetContentScale
int text_width, text_height;
dc.GetTextExtent("m",&text_width,&text_height);
side = text_width;
int tick_w = text_width / 2;
dc.SetBrush(GetBackgroundColour());
dc.SetPen(GetBackgroundColour());
dc.DrawRectangle(GetClientRect()); // otherwise the background would end up black on windows
#ifdef _WIN32
dc.SetPen(wxPen(GetForegroundColour()));
dc.SetBrush(wxBrush(Slic3r::GUI::wxGetApp().get_highlight_default_clr()));
#else
dc.SetPen(*wxBLACK_PEN);
dc.SetBrush(*wxWHITE_BRUSH);
#endif
dc.SetPen( wxPen(StateColor::darkModeColorFor(wxColour("#DBDBDB")), 1)); // input box border color
dc.SetBrush(wxBrush(StateColor::darkModeColorFor(wxColour("#F1F1F1")))); // sidebar titlebar bg color
dc.DrawRectangle(m_rect);
if (visible_area.m_width < 0.499) {
dc.SetTextForeground(StateColor::darkModeColorFor(wxColour("#FF6F00"))); // Use orange color for warning
dc.DrawText(_(L("NO RAMMING AT ALL")),wxPoint(m_rect.GetLeft()+m_rect.GetWidth()/2-legend_side,m_rect.GetBottom()-m_rect.GetHeight()/2));
return;
}
@ -35,15 +37,11 @@ void Chart::draw() {
if (!m_line_to_draw.empty()) {
for (unsigned int i=0;i<m_line_to_draw.size()-2;++i) {
int color = 510*((m_rect.GetBottom()-(m_line_to_draw)[i])/double(m_rect.GetHeight()));
dc.SetPen( wxPen( wxColor(std::min(255,color),255-std::max(color-255,0),0), 1 ) );
int color = 444*((m_rect.GetBottom()-(m_line_to_draw)[i])/double(m_rect.GetHeight()));
dc.SetPen( wxPen( wxColor(std::min(222,color), 222-std::max(color-222,0), 60), 1) ); // adding blue color sligtly gives a bit more modern look instead using raw red & green
dc.DrawLine(m_rect.GetLeft()+1+i,(m_line_to_draw)[i],m_rect.GetLeft()+1+i,m_rect.GetBottom());
}
#ifdef _WIN32
dc.SetPen(wxPen(GetForegroundColour()));
#else
dc.SetPen( wxPen( wxColor(0,0,0), 1 ) );
#endif
dc.SetPen(wxPen(StateColor::darkModeColorFor(wxColour("#363636")), 1));
for (unsigned int i=0;i<m_line_to_draw.size()-2;++i) {
if (splines)
dc.DrawLine(m_rect.GetLeft()+i,(m_line_to_draw)[i],m_rect.GetLeft()+i+1,(m_line_to_draw)[i+1]);
@ -55,25 +53,25 @@ void Chart::draw() {
}
// draw draggable buttons
dc.SetBrush(*wxBLUE_BRUSH);
#ifdef _WIN32
dc.SetPen(wxPen(GetForegroundColour()));
#else
dc.SetPen( wxPen( wxColor(0,0,0), 1 ) );
#endif
dc.SetBrush(StateColor::darkModeColorFor(wxColour("#009688"))); // orca color for draggable circles
dc.SetPen(wxPen(StateColor::darkModeColorFor(wxColour("#363636")), 1));
for (auto& button : m_buttons)
//dc.DrawRectangle(math_to_screen(button.get_pos())-wxPoint(side/2.,side/2.), wxSize(side,side));
dc.DrawCircle(math_to_screen(button.get_pos()),side/2.);
//dc.DrawRectangle(math_to_screen(button.get_pos()-wxPoint2DDouble(0.125,0))-wxPoint(0,5),wxSize(50,10));
dc.SetTextForeground(StateColor::darkModeColorFor(wxColour("#363636"))); // Label color
// draw x-axis:
float last_mark = -10000;
for (float math_x=int(visible_area.m_x*10)/10 ; math_x < (visible_area.m_x+visible_area.m_width) ; math_x+=0.1f) {
int x = math_to_screen(wxPoint2DDouble(math_x,visible_area.m_y)).x;
int y = m_rect.GetBottom();
if (x-last_mark < legend_side) continue;
dc.DrawLine(x,y+3,x,y-3);
dc.DrawText(wxString().Format(wxT("%.1f"), math_x),wxPoint(x-scale_unit,y+0.5*scale_unit));
dc.DrawLine(x,y+tick_w+1,x,y-tick_w); // +1 for border; make sure drawn on both size
auto label = math_x == 0 ? "0" : wxString().Format(wxT("%.1f") , math_x); // prefer "0" to match text with Y "0"
dc.GetTextExtent(label,&text_width,&text_height);// center text with lines
dc.DrawText(label ,wxPoint(x - text_width * .5, y + .8 * scale_unit));
last_mark = x;
}
@ -83,17 +81,17 @@ void Chart::draw() {
int y = math_to_screen(wxPoint2DDouble(visible_area.m_x,math_y)).y;
int x = m_rect.GetLeft();
if (last_mark-y < legend_side) continue;
dc.DrawLine(x-3,y,x+3,y);
dc.DrawText(wxString()<<math_y,wxPoint(x-2*scale_unit,y-0.5*scale_unit));
dc.DrawLine(x-tick_w,y,x+tick_w+1,y); // +1 for border; make sure drawn on both size
auto label = wxString()<<math_y;
dc.GetTextExtent(label,&text_width,&text_height);// center text with lines & make it right aligned
dc.DrawText(label ,wxPoint(x - scale_unit - text_width, y - .5 * text_height + 1));
last_mark = y;
}
// axis labels:
wxString label = _(L("Time")) + " ("+_(L("s"))+")";
int text_width = 0;
int text_height = 0;
dc.GetTextExtent(label,&text_width,&text_height);
dc.DrawText(label,wxPoint(0.5*(m_rect.GetRight()+m_rect.GetLeft())-text_width/2.f, m_rect.GetBottom()+0.5*legend_side));
dc.DrawText(label,wxPoint(0.5*(m_rect.GetRight()+m_rect.GetLeft())-text_width/2.f, m_rect.GetBottom()+0.6*legend_side));
label = _(L("Volumetric speed")) + " (" + _(L("mm³/s")) + ")";
dc.GetTextExtent(label,&text_width,&text_height);
dc.DrawRotatedText(label,wxPoint(0,0.5*(m_rect.GetBottom()+m_rect.GetTop())+text_width/2.f),90);
@ -124,9 +122,13 @@ void Chart::mouse_clicked(wxMouseEvent& event) {
void Chart::mouse_moved(wxMouseEvent& event) {
if (!event.Dragging() || !m_dragged) return;
wxPoint pos = event.GetPosition();
wxRect rect = m_rect;
if (!event.Dragging() || !m_dragged){
// change cursor while button hovered && drag
SetCursor((which_button_is_clicked(pos) != -1) ? wxCursor(wxCURSOR_SIZENS) : wxNullCursor);
return;
}
rect.Deflate(side/2.);
if (!(rect.Contains(pos))) { // the mouse left chart area
mouse_left_window(event);

View file

@ -19,6 +19,7 @@ public:
wxWindow(parent,wxID_ANY,rect.GetTopLeft(),rect.GetSize()),
scale_unit(scale_unit), legend_side(5*scale_unit)
{
SetBackgroundColour(*wxWHITE);
SetBackgroundStyle(wxBG_STYLE_PAINT);
m_rect = wxRect(wxPoint(legend_side,0),rect.GetSize()-wxSize(legend_side,legend_side));
visible_area = wxRect2DDouble(0.0, 0.0, sampling*ramming_speed_size, 20.);
@ -46,8 +47,8 @@ public:
void mouse_right_button_clicked(wxMouseEvent& event);
void mouse_moved(wxMouseEvent& event);
void mouse_double_clicked(wxMouseEvent& event);
void mouse_left_window(wxMouseEvent&) { m_dragged = nullptr; }
void mouse_released(wxMouseEvent&) { m_dragged = nullptr; }
void mouse_left_window(wxMouseEvent&) { m_dragged = nullptr; SetCursor(wxNullCursor);}
void mouse_released(wxMouseEvent&) { m_dragged = nullptr; SetCursor(wxNullCursor);}
void paint_event(wxPaintEvent&) { draw(); }
DECLARE_EVENT_TABLE()
@ -58,7 +59,7 @@ private:
static const bool fixed_x = true;
static const bool splines = true;
static const bool manual_points_manipulation = false;
static const int side = 10; // side of draggable button
int side = 10; // side of draggable button
const int scale_unit;
int legend_side;

View file

@ -2091,7 +2091,7 @@ void InputIpAddressDialog::on_text(wxCommandEvent &evt)
bool invalid_access_code = true;
for (char c : str_access_code) {
if (!('0' <= c && c <= '9' || 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z')) {
if (!(('0' <= c && c <= '9') || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'))) {
invalid_access_code = false;
return;
}

View file

@ -2526,7 +2526,7 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj)
}
bool light_on = obj->chamber_light != MachineObject::LIGHT_EFFECT::LIGHT_EFFECT_OFF;
BOOST_LOG_TRIVIAL(trace) << "light: " << light_on ? "on" : "off";
BOOST_LOG_TRIVIAL(trace) << "light: " << (light_on ? "on" : "off");
if (m_switch_lamp_timeout > 0)
m_switch_lamp_timeout--;
else {

View file

@ -2323,10 +2323,14 @@ void TabPrint::build()
optgroup->append_single_option_line("prime_tower_brim_width");
optgroup->append_single_option_line("wipe_tower_rotation_angle");
optgroup->append_single_option_line("wipe_tower_bridging");
optgroup->append_single_option_line("wipe_tower_cone_angle");
optgroup->append_single_option_line("wipe_tower_extra_spacing");
optgroup->append_single_option_line("wipe_tower_extra_flow");
optgroup->append_single_option_line("wipe_tower_max_purge_speed");
optgroup->append_single_option_line("wipe_tower_wall_type");
optgroup->append_single_option_line("wipe_tower_cone_angle");
optgroup->append_single_option_line("wipe_tower_extra_rib_length");
optgroup->append_single_option_line("wipe_tower_rib_width");
optgroup->append_single_option_line("wipe_tower_fillet_wall");
optgroup->append_single_option_line("wipe_tower_no_sparse_layers");
optgroup->append_single_option_line("single_extruder_multi_material_priming");

View file

@ -1,4 +1,3 @@
#pragma once
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
@ -311,4 +310,4 @@ void MyScrollbar::OnMouseWheel(wxMouseEvent &event)
}
Refresh();
Update();
}
}

View file

@ -38,10 +38,10 @@ SpinInput::SpinInput(wxWindow *parent,
const wxPoint &pos,
const wxSize & size,
long style,
int min, int max, int initial)
int min, int max, int initial, const int& step)
: SpinInput()
{
Create(parent, text, label, pos, size, style, min, max, initial);
Create(parent, text, label, pos, size, style, min, max, initial, step);
}
void SpinInput::Create(wxWindow *parent,
@ -50,7 +50,7 @@ void SpinInput::Create(wxWindow *parent,
const wxPoint &pos,
const wxSize & size,
long style,
int min, int max, int initial)
int min, int max, int initial, int step)
{
StaticBox::Create(parent, wxID_ANY, pos, size);
SetFont(Label::Body_12);
@ -76,6 +76,7 @@ void SpinInput::Create(wxWindow *parent,
if (text.ToLong(&initialFromText)) initial = initialFromText;
SetRange(min, max);
SetValue(initial);
SetStep(step);
messureSize();
}
@ -229,7 +230,7 @@ Button *SpinInput::createButton(bool inc)
btn->DisableFocusFromKeyboard();
btn->Bind(wxEVT_LEFT_DOWN, [=](auto &e) {
delta = inc ? 1 : -1;
SetValue(val + delta);
SetValue(val + delta * step);
text_ctrl->SetFocus();
if (!btn->HasCapture())
btn->CaptureMouse();
@ -241,7 +242,7 @@ Button *SpinInput::createButton(bool inc)
delta = inc ? 1 : -1;
if (!btn->HasCapture())
btn->CaptureMouse();
SetValue(val + delta);
SetValue(val + delta * step);
sendSpinEvent();
});
btn->Bind(wxEVT_LEFT_UP, [=](auto &e) {
@ -259,7 +260,7 @@ void SpinInput::onTimer(wxTimerEvent &evnet) {
delta /= 2;
return;
}
SetValue(val + delta);
SetValue(val + delta * step);
sendSpinEvent();
}
@ -293,7 +294,7 @@ void SpinInput::onTextEnter(wxCommandEvent &event)
void SpinInput::mouseWheelMoved(wxMouseEvent &event)
{
auto delta = event.GetWheelRotation() < 0 ? 1 : -1;
SetValue(val + delta);
SetValue(val + delta * step);
sendSpinEvent();
text_ctrl->SetFocus();
}
@ -305,10 +306,10 @@ void SpinInput::keyPressed(wxKeyEvent &event)
case WXK_DOWN:
long value;
if (!text_ctrl->GetValue().ToLong(&value)) { value = val; }
if (event.GetKeyCode() == WXK_DOWN && value > min) {
--value;
} else if (event.GetKeyCode() == WXK_UP && value + 1 < max) {
++value;
if (event.GetKeyCode() == WXK_DOWN && value - step >= min) {
value = value - step;
} else if (event.GetKeyCode() == WXK_UP && value + step <= max) {
value = value + step;
}
if (value != val) {
SetValue(value);

View file

@ -23,6 +23,7 @@ class SpinInput : public wxNavigationEnabled<StaticBox>
int min;
int max;
int delta;
int step;
static const int SpinInputWidth = 200;
static const int SpinInputHeight = 50;
@ -36,7 +37,7 @@ public:
const wxPoint &pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = 0,
int min = 0, int max = 100, int initial = 0);
int min = 0, int max = 100, int initial = 0, const int& step = 1);
void Create(wxWindow * parent,
wxString text,
@ -46,7 +47,8 @@ public:
long style = 0,
int min = 0,
int max = 100,
int initial = 0);
int initial = 0,
int step = 1);
void SetCornerRadius(double radius);
@ -70,6 +72,10 @@ public:
int GetValue () const;
void SetStep(int value) { step = value; };
int GetStep() { return step; };
void SetRange(int min, int max);
protected:

View file

@ -234,7 +234,7 @@ void StateColor::append(unsigned long color, int states)
{
if ((color & 0xff000000) == 0)
color |= 0xff000000;
wxColour cl; cl.SetRGBA(color & 0xff00ff00 | ((color & 0xff) << 16) | ((color >> 16) & 0xff));
wxColour cl; cl.SetRGBA((color & 0xff00ff00) | ((color & 0xff) << 16) | ((color >> 16) & 0xff));
append(cl, states);
}

View file

@ -51,7 +51,7 @@ void StateHandler::update_binds()
int diff = bind_states ^ bind_states_;
State states[] = {Enabled, Checked, Focused, Hovered, Pressed};
wxEventType events[] = {EVT_ENABLE_CHANGED, wxEVT_CHECKBOX, wxEVT_SET_FOCUS, wxEVT_ENTER_WINDOW, wxEVT_LEFT_DOWN};
wxEventType events2[] = {{0}, {0}, wxEVT_KILL_FOCUS, wxEVT_LEAVE_WINDOW, wxEVT_LEFT_UP};
wxEventType events2[] = {0, 0, wxEVT_KILL_FOCUS, wxEVT_LEAVE_WINDOW, wxEVT_LEFT_UP};
for (int i = 0; i < 5; ++i) {
int s = states[i];
if (diff & s) {
@ -74,7 +74,7 @@ void StateHandler::set_state(int state, int mask)
{
if ((states_ & mask) == (state & mask)) return;
int old = states_;
states_ = states_ & ~mask | state & mask;
states_ = (states_ & ~mask) | (state & mask);
if (old != states_ && (old | states2_) != (states_ | states2_)) {
if (parent_)
parent_->changed(states_ | states2_);
@ -94,7 +94,7 @@ void StateHandler::changed(wxEvent &event)
{
event.Skip();
wxEventType events[] = {EVT_ENABLE_CHANGED, wxEVT_CHECKBOX, wxEVT_SET_FOCUS, wxEVT_ENTER_WINDOW, wxEVT_LEFT_DOWN};
wxEventType events2[] = {{0}, {0}, wxEVT_KILL_FOCUS, wxEVT_LEAVE_WINDOW, wxEVT_LEFT_UP};
wxEventType events2[] = {0, 0, wxEVT_KILL_FOCUS, wxEVT_LEAVE_WINDOW, wxEVT_LEFT_UP};
int old = states_;
// some events are from another window (ex: text_ctrl of TextInput), save state in states2_ to avoid conflicts
for (int i = 0; i < 5; ++i) {

View file

@ -9,6 +9,7 @@
#include "MsgDialog.hpp"
#include "libslic3r/Color.hpp"
#include "Widgets/Button.hpp"
#include "Widgets/StaticLine.hpp"
#include "Widgets/DialogButtons.hpp"
#include "slic3r/Utils/ColorSpaceConvert.hpp"
#include "MainFrame.hpp"
@ -49,37 +50,27 @@ static void update_ui(wxWindow* window)
RammingDialog::RammingDialog(wxWindow* parent,const std::string& parameters)
: wxDialog(parent, wxID_ANY, _(L("Ramming customization")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE/* | wxRESIZE_BORDER*/)
{
update_ui(this);
SetBackgroundColour(*wxWHITE);
m_panel_ramming = new RammingPanel(this,parameters);
// Not found another way of getting the background colours of RammingDialog, RammingPanel and Chart correct than setting
// them all explicitely. Reading the parent colour yielded colour that didn't really match it, no wxSYS_COLOUR_... matched
// colour used for the dialog. Same issue (and "solution") here : https://forums.wxwidgets.org/viewtopic.php?f=1&t=39608
// Whoever can fix this, feel free to do so.
#ifndef _WIN32
this-> SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_FRAMEBK));
m_panel_ramming->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_FRAMEBK));
#endif
m_panel_ramming->Show(true);
this->Show();
auto main_sizer = new wxBoxSizer(wxVERTICAL);
main_sizer->Add(m_panel_ramming, 1, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 5);
main_sizer->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxALIGN_CENTER_HORIZONTAL | wxTOP | wxBOTTOM, 10);
auto dlg_btns = new DialogButtons(this, {"OK", "Cancel"});
main_sizer->Add(dlg_btns, 0, wxEXPAND);
SetSizer(main_sizer);
main_sizer->SetSizeHints(this);
update_ui(static_cast<wxButton*>(this->FindWindowById(wxID_OK, this)));
update_ui(static_cast<wxButton*>(this->FindWindowById(wxID_CANCEL, this)));
this->Bind(wxEVT_CLOSE_WINDOW, [this](wxCloseEvent& e) { EndModal(wxCANCEL); });
this->Bind(wxEVT_BUTTON,[this](wxCommandEvent&) {
m_output_data = m_panel_ramming->get_parameters();
EndModal(wxID_OK);
},wxID_OK);
wxGetApp().UpdateDlgDarkUI(this);
this->Show();
// wxMessageDialog dlg(this, _(L("Ramming denotes the rapid extrusion just before a tool change in a single-extruder MM printer. Its purpose is to "
Slic3r::GUI::MessageDialog dlg(this, _(L("Ramming denotes the rapid extrusion just before a tool change in a single-extruder MM printer. Its purpose is to "
"properly shape the end of the unloaded filament so it does not prevent insertion of the new filament and can itself "
"be reinserted later. This phase is important and different materials can require different extrusion speeds to get "
@ -100,6 +91,7 @@ RammingDialog::RammingDialog(wxWindow* parent,const std::string& parameters)
RammingPanel::RammingPanel(wxWindow* parent, const std::string& parameters)
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize/*,wxPoint(50,50), wxSize(800,350),wxBORDER_RAISED*/)
{
SetBackgroundColour(*wxWHITE);
update_ui(this);
auto sizer_chart = new wxBoxSizer(wxVERTICAL);
auto sizer_param = new wxBoxSizer(wxVERTICAL);
@ -120,48 +112,59 @@ RammingPanel::RammingPanel(wxWindow* parent, const std::string& parameters)
buttons.push_back(std::make_pair(x, y));
m_chart = new Chart(this, wxRect(scale(10),scale(10),scale(480),scale(360)), buttons, ramming_speed_size, 0.25f, scale(10));
#ifdef _WIN32
update_ui(m_chart);
#else
m_chart->SetBackgroundColour(parent->GetBackgroundColour()); // see comment in RammingDialog constructor
#endif
sizer_chart->Add(m_chart, 0, wxALL, 5);
m_widget_time = new wxSpinCtrlDouble(this,wxID_ANY,wxEmptyString,wxDefaultPosition,wxSize(ITEM_WIDTH()*2.5, -1),style,0.,5.0,3.,0.5);
m_widget_volume = new wxSpinCtrl(this,wxID_ANY,wxEmptyString,wxDefaultPosition,wxSize(ITEM_WIDTH()*2.5, -1),style,0,10000,0);
m_widget_ramming_line_width_multiplicator = new wxSpinCtrl(this,wxID_ANY,wxEmptyString,wxDefaultPosition,wxSize(ITEM_WIDTH()*2.5, -1),style,10,200,100);
m_widget_ramming_step_multiplicator = new wxSpinCtrl(this,wxID_ANY,wxEmptyString,wxDefaultPosition,wxSize(ITEM_WIDTH()*2.5, -1),style,10,200,100);
m_widget_time = new SpinInput(this, wxEmptyString, _L("ms") , wxDefaultPosition, wxSize(scale(120), -1), wxSP_ARROW_KEYS, 0 , 5000 , 3000, 500);
m_widget_volume = new SpinInput(this, wxEmptyString, _L("mm³"), wxDefaultPosition, wxSize(scale(120), -1), wxSP_ARROW_KEYS, 0 , 10000, 0 );
m_widget_ramming_line_width_multiplicator = new SpinInput(this, wxEmptyString, _L("%") , wxDefaultPosition, wxSize(scale(120), -1), wxSP_ARROW_KEYS, 10, 200 , 100 );
m_widget_ramming_step_multiplicator = new SpinInput(this, wxEmptyString, _L("%") , wxDefaultPosition, wxSize(scale(120), -1), wxSP_ARROW_KEYS, 10, 200 , 100 );
#ifdef _WIN32
update_ui(m_widget_time->GetText());
update_ui(m_widget_volume);
update_ui(m_widget_ramming_line_width_multiplicator);
update_ui(m_widget_ramming_step_multiplicator);
#endif
auto add_title = [this, sizer_param](wxString label){
auto title = new StaticLine(this, 0, label);
title->SetFont(Label::Head_14);
title->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#363636")));
sizer_param->Add(title, 0, wxEXPAND | wxBOTTOM, scale(8));
};
auto gsizer_param = new wxFlexGridSizer(2, 5, 15);
gsizer_param->Add(new wxStaticText(this, wxID_ANY, wxString(_(L("Total ramming time")) + " (" + _(L("s")) + "):")), 0, wxALIGN_CENTER_VERTICAL);
gsizer_param->Add(m_widget_time);
gsizer_param->Add(new wxStaticText(this, wxID_ANY, wxString(_(L("Total rammed volume")) + " (" + _(L("mm")) + wxString("³):", wxConvUTF8))), 0, wxALIGN_CENTER_VERTICAL);
gsizer_param->Add(m_widget_volume);
gsizer_param->AddSpacer(20);
gsizer_param->AddSpacer(20);
gsizer_param->Add(new wxStaticText(this, wxID_ANY, wxString(_(L("Ramming line width")) + " (%):")), 0, wxALIGN_CENTER_VERTICAL);
gsizer_param->Add(m_widget_ramming_line_width_multiplicator);
gsizer_param->Add(new wxStaticText(this, wxID_ANY, wxString(_(L("Ramming line spacing")) + " (%):")), 0, wxALIGN_CENTER_VERTICAL);
gsizer_param->Add(m_widget_ramming_step_multiplicator);
SetFont(Label::Body_14);
wxSize col_size;
for(auto label : {"Time", "Volume", "Width", "Spacing"})
col_size.IncTo(GetTextExtent(_L(label)));
col_size = wxSize(col_size.x + scale(30) ,-1);
sizer_param->Add(gsizer_param, 0, wxTOP, scale(10));
auto add_spin = [this, sizer_param, col_size](wxString label, SpinInput* spin){
spin->Bind(wxEVT_KILL_FOCUS, [this](auto &e) {
e.SetId(GetId());
ProcessEventLocally(e);
e.Skip();
});
auto h_sizer = new wxBoxSizer(wxHORIZONTAL);
auto text = new wxStaticText(this, wxID_ANY, label, wxDefaultPosition, col_size);
text->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#363636")));
h_sizer->Add(text, 0, wxALIGN_CENTER_VERTICAL);
h_sizer->Add(spin);
sizer_param->Add(h_sizer, 0, wxEXPAND | wxBOTTOM, scale(2));
};
m_widget_time->SetValue(m_chart->get_time());
m_widget_time->SetDigits(2);
add_title(_L("Total ramming"));
add_spin( _L("Time") , m_widget_time );
add_spin( _L("Volume"), m_widget_volume);
sizer_param->AddSpacer(10);
add_title(_L("Ramming line"));
add_spin( _L("Width") , m_widget_ramming_line_width_multiplicator);
add_spin( _L("Spacing"), m_widget_ramming_step_multiplicator );
m_widget_time->SetValue(int(m_chart->get_time() * 1000));
m_widget_volume->SetValue(m_chart->get_volume());
m_widget_volume->Disable();
m_widget_ramming_line_width_multiplicator->SetValue(m_ramming_line_width_multiplicator);
m_widget_ramming_step_multiplicator->SetValue(m_ramming_step_multiplicator);
m_widget_ramming_step_multiplicator->Bind(wxEVT_TEXT,[this](wxCommandEvent&) { line_parameters_changed(); });
m_widget_ramming_line_width_multiplicator->Bind(wxEVT_TEXT,[this](wxCommandEvent&) { line_parameters_changed(); });
m_widget_ramming_step_multiplicator->SetValue(m_ramming_step_multiplicator);
m_widget_ramming_step_multiplicator->Bind(wxEVT_SPINCTRL,[this](wxCommandEvent&) { line_parameters_changed(); });
m_widget_ramming_line_width_multiplicator->Bind(wxEVT_SPINCTRL,[this](wxCommandEvent&) { line_parameters_changed(); });
auto sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(sizer_chart, 0, wxALL, 5);
@ -170,10 +173,15 @@ RammingPanel::RammingPanel(wxWindow* parent, const std::string& parameters)
sizer->SetSizeHints(this);
SetSizer(sizer);
m_widget_time->Bind(wxEVT_TEXT,[this](wxCommandEvent&) {m_chart->set_xy_range(m_widget_time->GetValue(),-1);});
m_widget_time->Bind(wxEVT_SPINCTRL,[this](wxCommandEvent&) {
m_chart->set_xy_range(m_widget_time->GetValue() * 0.001,-1);
});
m_widget_time->Bind(wxEVT_CHAR,[](wxKeyEvent&){}); // do nothing - prevents the user to change the value
m_widget_volume->Bind(wxEVT_CHAR,[](wxKeyEvent&){}); // do nothing - prevents the user to change the value
Bind(EVT_WIPE_TOWER_CHART_CHANGED,[this](wxCommandEvent&) {m_widget_volume->SetValue(m_chart->get_volume()); m_widget_time->SetValue(m_chart->get_time());} );
Bind(EVT_WIPE_TOWER_CHART_CHANGED,[this](wxCommandEvent&) {
m_widget_volume->SetValue(m_chart->get_volume());
m_widget_time->SetValue(m_chart->get_time() * 1000);
});
Refresh(true); // erase background
}
@ -340,7 +348,7 @@ void WipingDialog::on_dpi_changed(const wxRect &suggested_rect)
// Parent dialog for purging volume adjustments - it fathers WipingPanel widget (that contains all controls) and a button to toggle simple/advanced mode:
WipingDialog::WipingDialog(wxWindow* parent, const std::vector<float>& matrix, const std::vector<float>& extruders, const std::vector<std::string>& extruder_colours,
const std::vector<int>&extra_flush_volume, float flush_multiplier)
: DPIDialog(parent ? parent : static_cast<wxWindow *>(wxGetApp().mainframe),
: GUI::DPIDialog(parent ? parent : static_cast<wxWindow *>(wxGetApp().mainframe),
wxID_ANY,
_(L("Flushing volumes for filament change")),
wxDefaultPosition,

View file

@ -10,6 +10,8 @@
#include <wx/checkbox.h>
#include <wx/msgdlg.h>
#include "Widgets/SpinInput.hpp"
#include "RammingChart.hpp"
class Button;
class Label;
@ -23,10 +25,10 @@ public:
private:
Chart* m_chart = nullptr;
wxSpinCtrl* m_widget_volume = nullptr;
wxSpinCtrl* m_widget_ramming_line_width_multiplicator = nullptr;
wxSpinCtrl* m_widget_ramming_step_multiplicator = nullptr;
wxSpinCtrlDouble* m_widget_time = nullptr;
SpinInput* m_widget_volume = nullptr;
SpinInput* m_widget_ramming_line_width_multiplicator = nullptr;
SpinInput* m_widget_ramming_step_multiplicator = nullptr;
SpinInput* m_widget_time = nullptr;
int m_ramming_step_multiplicator;
int m_ramming_line_width_multiplicator;

View file

@ -348,7 +348,7 @@ Temp_Calibration_Dlg::Temp_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plat
Layout();
Fit();
auto validate_text = [this](TextInput* ti){
auto validate_text = [](TextInput* ti){
unsigned long t = 0;
if(!ti->GetTextCtrl()->GetValue().ToULong(&t))
return;
@ -395,7 +395,7 @@ void Temp_Calibration_Dlg::on_start(wxCommandEvent& event) {
}
m_params.start = start;
m_params.end = end;
m_params.mode =CalibMode::Calib_Temp_Tower;
m_params.mode = CalibMode::Calib_Temp_Tower;
m_plater->calib_temp(m_params);
EndModal(wxID_OK);
@ -403,7 +403,7 @@ void Temp_Calibration_Dlg::on_start(wxCommandEvent& event) {
void Temp_Calibration_Dlg::on_filament_type_changed(wxCommandEvent& event) {
int selection = event.GetSelection();
unsigned long start,end;
unsigned long start = 0, end = 0;
switch(selection)
{
case tABS_ASA:
@ -1112,4 +1112,4 @@ void Junction_Deviation_Test_Dlg::on_dpi_changed(const wxRect& suggested_rect) {
Fit();
}
}} // namespace Slic3r::GUI
}} // namespace Slic3r::GUI

View file

@ -1264,7 +1264,7 @@ std::string NetworkAgent::request_setting_id(std::string name, std::map<std::str
int NetworkAgent::put_setting(std::string setting_id, std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code)
{
int ret;
int ret = 0;
if (network_agent && put_setting_ptr) {
ret = put_setting_ptr(network_agent, setting_id, name, values_map, http_code);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" : network_agent=%1%, setting_id=%2%, name=%3%, http_code=%4%, ret=%5%")
@ -1424,7 +1424,7 @@ int NetworkAgent::get_subtask_info(std::string subtask_id, std::string* task_jso
int NetworkAgent::get_slice_info(std::string project_id, std::string profile_id, int plate_index, std::string* slice_json)
{
int ret;
int ret = 0;
if (network_agent && get_slice_info_ptr) {
ret = get_slice_info_ptr(network_agent, project_id, profile_id, plate_index, slice_json);
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(" : network_agent=%1%, project_id=%2%, profile_id=%3%, plate_index=%4%, slice_json=%5%")
@ -1435,7 +1435,7 @@ int NetworkAgent::get_slice_info(std::string project_id, std::string profile_id,
int NetworkAgent::query_bind_status(std::vector<std::string> query_list, unsigned int* http_code, std::string* http_body)
{
int ret;
int ret = 0;
if (network_agent && query_bind_status_ptr) {
ret = query_bind_status_ptr(network_agent, query_list, http_code, http_body);
if (ret)