mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-04 00:10:40 +08:00
Moved to C++14 syntax with string literals.
This commit is contained in:
parent
650bcc8c4c
commit
f13fbf3cee
@ -18,14 +18,7 @@
|
|||||||
#include <wx/imaglist.h>
|
#include <wx/imaglist.h>
|
||||||
#include <wx/panel.h>
|
#include <wx/panel.h>
|
||||||
|
|
||||||
#if SLIC3R_CPPVER==11
|
using namespace std::string_literals;
|
||||||
#define st(A) (std::string(#A))
|
|
||||||
#elif SLIC3R_CPPVER==14
|
|
||||||
#define st(A) ((#A)s)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// TODO for C++14 find/replace st([A-z_]*) with "\1"s
|
|
||||||
|
|
||||||
namespace Slic3r { namespace GUI {
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
||||||
class PresetEditor : public wxPanel {
|
class PresetEditor : public wxPanel {
|
||||||
@ -88,51 +81,51 @@ public:
|
|||||||
PrintEditor() : PrintEditor(nullptr, {}) {};
|
PrintEditor() : PrintEditor(nullptr, {}) {};
|
||||||
|
|
||||||
wxString title() override { return _("Print Settings"); }
|
wxString title() override { return _("Print Settings"); }
|
||||||
std::string name() override { return st("print"); }
|
std::string name() override { return "print"s; }
|
||||||
|
|
||||||
/// Static method to retrieve list of options that this preset governs.
|
/// Static method to retrieve list of options that this preset governs.
|
||||||
static t_config_option_keys options() {
|
static t_config_option_keys options() {
|
||||||
return t_config_option_keys
|
return t_config_option_keys
|
||||||
{
|
{
|
||||||
st(layer_height), st(first_layer_height),
|
"layer_height"s, "first_layer_height"s,
|
||||||
st(adaptive_slicing), st(adaptive_slicing_quality), st(match_horizontal_surfaces),
|
"adaptive_slicing"s, "adaptive_slicing_quality"s, "match_horizontal_surfaces"s,
|
||||||
st(perimeters), st(spiral_vase),
|
"perimeters"s, "spiral_vase"s,
|
||||||
st(top_solid_layers), st(bottom_solid_layers),
|
"top_solid_layers"s, "bottom_solid_layers"s,
|
||||||
st(extra_perimeters), st(avoid_crossing_perimeters), st(thin_walls), st(overhangs),
|
"extra_perimeters"s, "avoid_crossing_perimeters"s, "thin_walls"s, "overhangs"s,
|
||||||
st(seam_position), st(external_perimeters_first),
|
"seam_position"s, "external_perimeters_first"s,
|
||||||
st(fill_density), st(fill_pattern), st(top_infill_pattern), st(bottom_infill_pattern), st(fill_gaps),
|
"fill_density"s, "fill_pattern"s, "top_infill_pattern"s, "bottom_infill_pattern"s, "fill_gaps"s,
|
||||||
st(infill_every_layers), st(infill_only_where_needed),
|
"infill_every_layers"s, "infill_only_where_needed"s,
|
||||||
st(solid_infill_every_layers), st(fill_angle), st(solid_infill_below_area), st(),
|
"solid_infill_every_layers"s, "fill_angle"s, "solid_infill_below_area"s, ""s,
|
||||||
st(only_retract_when_crossing_perimeters), st(infill_first),
|
"only_retract_when_crossing_perimeters"s, "infill_first"s,
|
||||||
st(max_print_speed), st(max_volumetric_speed),
|
"max_print_speed"s, "max_volumetric_speed"s,
|
||||||
st(perimeter_speed), st(small_perimeter_speed), st(external_perimeter_speed), st(infill_speed), st(),
|
"perimeter_speed"s, "small_perimeter_speed"s, "external_perimeter_speed"s, "infill_speed"s, ""s,
|
||||||
st(solid_infill_speed), st(top_solid_infill_speed), st(support_material_speed),
|
"solid_infill_speed"s, "top_solid_infill_speed"s, "support_material_speed"s,
|
||||||
st(support_material_interface_speed), st(bridge_speed), st(gap_fill_speed),
|
"support_material_interface_speed"s, "bridge_speed"s, "gap_fill_speed"s,
|
||||||
st(travel_speed),
|
"travel_speed"s,
|
||||||
st(first_layer_speed),
|
"first_layer_speed"s,
|
||||||
st(perimeter_acceleration), st(infill_acceleration), st(bridge_acceleration),
|
"perimeter_acceleration"s, "infill_acceleration"s, "bridge_acceleration"s,
|
||||||
st(first_layer_acceleration), st(default_acceleration),
|
"first_layer_acceleration"s, "default_acceleration"s,
|
||||||
st(skirts), st(skirt_distance), st(skirt_height), st(min_skirt_length),
|
"skirts"s, "skirt_distance"s, "skirt_height"s, "min_skirt_length"s,
|
||||||
st(brim_connections_width), st(brim_width), st(interior_brim_width),
|
"brim_connections_width"s, "brim_width"s, "interior_brim_width"s,
|
||||||
st(support_material), st(support_material_threshold), st(support_material_max_layers), st(support_material_enforce_layers),
|
"support_material"s, "support_material_threshold"s, "support_material_max_layers"s, "support_material_enforce_layers"s,
|
||||||
st(raft_layers),
|
"raft_layers"s,
|
||||||
st(support_material_pattern), st(support_material_spacing), st(support_material_angle), st(),
|
"support_material_pattern"s, "support_material_spacing"s, "support_material_angle"s, ""s,
|
||||||
st(support_material_interface_layers), st(support_material_interface_spacing),
|
"support_material_interface_layers"s, "support_material_interface_spacing"s,
|
||||||
st(support_material_contact_distance), st(support_material_buildplate_only), st(dont_support_bridges),
|
"support_material_contact_distance"s, "support_material_buildplate_only"s, "dont_support_bridges"s,
|
||||||
st(notes),
|
"notes"s,
|
||||||
st(complete_objects), st(extruder_clearance_radius), st(extruder_clearance_height),
|
"complete_objects"s, "extruder_clearance_radius"s, "extruder_clearance_height"s,
|
||||||
st(gcode_comments), st(output_filename_format),
|
"gcode_comments"s, "output_filename_format"s,
|
||||||
st(post_process),
|
"post_process"s,
|
||||||
st(perimeter_extruder), st(infill_extruder), st(solid_infill_extruder),
|
"perimeter_extruder"s, "infill_extruder"s, "solid_infill_extruder"s,
|
||||||
st(support_material_extruder), st(support_material_interface_extruder),
|
"support_material_extruder"s, "support_material_interface_extruder"s,
|
||||||
st(ooze_prevention), st(standby_temperature_delta),
|
"ooze_prevention"s, "standby_temperature_delta"s,
|
||||||
st(interface_shells), st(regions_overlap),
|
"interface_shells"s, "regions_overlap"s,
|
||||||
st(extrusion_width), st(first_layer_extrusion_width), st(perimeter_extrusion_width), st(),
|
"extrusion_width"s, "first_layer_extrusion_width"s, "perimeter_extrusion_width"s, ""s,
|
||||||
st(external_perimeter_extrusion_width), st(infill_extrusion_width), st(solid_infill_extrusion_width),
|
"external_perimeter_extrusion_width"s, "infill_extrusion_width"s, "solid_infill_extrusion_width"s,
|
||||||
st(top_infill_extrusion_width), st(support_material_extrusion_width),
|
"top_infill_extrusion_width"s, "support_material_extrusion_width"s,
|
||||||
st(support_material_interface_extrusion_width), st(infill_overlap), st(bridge_flow_ratio),
|
"support_material_interface_extrusion_width"s, "infill_overlap"s, "bridge_flow_ratio"s,
|
||||||
st(xy_size_compensation), st(resolution), st(shortcuts), st(compatible_printers),
|
"xy_size_compensation"s, "resolution"s, "shortcuts"s, "compatible_printers"s,
|
||||||
st(print_settings_id)
|
"print_settings_id"s
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,57 +136,36 @@ protected:
|
|||||||
void _build() override;
|
void _build() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MaterialEditor : public PresetEditor {
|
|
||||||
public:
|
|
||||||
|
|
||||||
wxString title() override { return _("Material Settings"); }
|
|
||||||
std::string name() override { return st("material"); }
|
|
||||||
MaterialEditor(wxWindow* parent, t_config_option_keys options = {});
|
|
||||||
MaterialEditor() : MaterialEditor(nullptr, {}) {};
|
|
||||||
|
|
||||||
static t_config_option_keys options() {
|
|
||||||
return t_config_option_keys
|
|
||||||
{
|
|
||||||
st(filament_colour), st(filament_diameter), st(filament_notes), st(filament_max_volumetric_speed), st(extrusion_multiplier), st(filament_density), st(filament_cost),
|
|
||||||
st(temperature), st(first_layer_temperature), st(bed_temperature), st(first_layer_bed_temperature),
|
|
||||||
st(fan_always_on), st(cooling), st(compatible_printers),
|
|
||||||
st(min_fan_speed), st(max_fan_speed), st(bridge_fan_speed), st(disable_fan_first_layers),
|
|
||||||
st(fan_below_layer_time), st(slowdown_below_layer_time), st(min_print_speed),
|
|
||||||
st(start_filament_gcode), st(end_filament_gcode),
|
|
||||||
st(filament_settings_id)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
t_config_option_keys my_options() override { return MaterialEditor::options(); }
|
|
||||||
protected:
|
|
||||||
void _update() override;
|
|
||||||
void _build() override;
|
|
||||||
};
|
|
||||||
|
|
||||||
class PrinterEditor : public PresetEditor {
|
class PrinterEditor : public PresetEditor {
|
||||||
public:
|
public:
|
||||||
PrinterEditor(wxWindow* parent, t_config_option_keys options = {});
|
PrinterEditor(wxWindow* parent, t_config_option_keys options = {});
|
||||||
PrinterEditor() : PrinterEditor(nullptr, {}) {};
|
PrinterEditor() : PrinterEditor(nullptr, {}) {};
|
||||||
|
|
||||||
wxString title() override { return _("Printer Settings"); }
|
wxString title() override { return _("Printer Settings"); }
|
||||||
std::string name() override { return st("printer"); }
|
std::string name() override { return "printer"s; }
|
||||||
|
static t_config_option_keys overridable_options() { return t_config_option_keys
|
||||||
|
{
|
||||||
|
"pressure_advance"s,
|
||||||
|
"retract_length"s, "retract_lift"s, "retract_speed"s, "retract_restart_extra"s,
|
||||||
|
"retract_before_travel"s, "retract_layer_change"s, "wipe"s
|
||||||
|
}; };
|
||||||
|
|
||||||
static t_config_option_keys options() {
|
static t_config_option_keys options() {
|
||||||
return t_config_option_keys
|
return t_config_option_keys
|
||||||
{
|
{
|
||||||
st(bed_shape), st(z_offset), st(z_steps_per_mm), st(has_heatbed),
|
"bed_shape"s, "z_offset"s, "z_steps_per_mm"s, "has_heatbed"s,
|
||||||
st(gcode_flavor), st(use_relative_e_distances),
|
"gcode_flavor"s, "use_relative_e_distances"s,
|
||||||
st(serial_port), st(serial_speed),
|
"serial_port"s, "serial_speed"s,
|
||||||
st(host_type), st(print_host), st(octoprint_apikey),
|
"host_type"s, "print_host"s, "octoprint_apikey"s,
|
||||||
st(use_firmware_retraction), st(pressure_advance), st(vibration_limit),
|
"use_firmware_retraction"s, "pressure_advance"s, "vibration_limit"s,
|
||||||
st(use_volumetric_e),
|
"use_volumetric_e"s,
|
||||||
st(start_gcode), st(end_gcode), st(before_layer_gcode), st(layer_gcode), st(toolchange_gcode), st(between_objects_gcode),
|
"start_gcode"s, "end_gcode"s, "before_layer_gcode"s, "layer_gcode"s, "toolchange_gcode"s, "between_objects_gcode"s,
|
||||||
st(nozzle_diameter), st(extruder_offset), st(min_layer_height), st(max_layer_height),
|
"nozzle_diameter"s, "extruder_offset"s, "min_layer_height"s, "max_layer_height"s,
|
||||||
st(retract_length), st(retract_lift), st(retract_speed), st(retract_restart_extra), st(retract_before_travel), st(retract_layer_change), st(wipe),
|
"retract_length"s, "retract_lift"s, "retract_speed"s, "retract_restart_extra"s, "retract_before_travel"s, "retract_layer_change"s, "wipe"s,
|
||||||
st(retract_length_toolchange), st(retract_restart_extra_toolchange), st(retract_lift_above), st(retract_lift_below),
|
"retract_length_toolchange"s, "retract_restart_extra_toolchange"s, "retract_lift_above"s, "retract_lift_below"s,
|
||||||
st(printer_settings_id),
|
"printer_settings_id"s,
|
||||||
st(printer_notes),
|
"printer_notes"s,
|
||||||
st(use_set_and_wait_bed), st(use_set_and_wait_extruder)
|
"use_set_and_wait_bed"s, "use_set_and_wait_extruder"s
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,6 +173,37 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void _update() override;
|
void _update() override;
|
||||||
void _build() override;
|
void _build() override;
|
||||||
|
const std::string LogChannel() override {return "PrinterEditor"s;} //< Which log these messages should go to.
|
||||||
|
};
|
||||||
|
|
||||||
|
class MaterialEditor : public PresetEditor {
|
||||||
|
public:
|
||||||
|
|
||||||
|
wxString title() override { return _("Material Settings"); }
|
||||||
|
std::string name() override { return "material"s; }
|
||||||
|
preset_t type() override { return preset_t::Material; };
|
||||||
|
int typeId() override { return static_cast<int>(preset_t::Material); };
|
||||||
|
MaterialEditor(wxWindow* parent, t_config_option_keys options = {});
|
||||||
|
MaterialEditor() : MaterialEditor(nullptr, {}) {};
|
||||||
|
|
||||||
|
static t_config_option_keys options() {
|
||||||
|
return t_config_option_keys
|
||||||
|
{
|
||||||
|
"filament_colour"s, "filament_diameter"s, "filament_notes"s, "filament_max_volumetric_speed"s, "extrusion_multiplier"s, "filament_density"s, "filament_cost"s,
|
||||||
|
"temperature"s, "first_layer_temperature"s, "bed_temperature"s, "first_layer_bed_temperature"s,
|
||||||
|
"fan_always_on"s, "cooling"s, "compatible_printers"s,
|
||||||
|
"min_fan_speed"s, "max_fan_speed"s, "bridge_fan_speed"s, "disable_fan_first_layers"s,
|
||||||
|
"fan_below_layer_time"s, "slowdown_below_layer_time"s, "min_print_speed"s,
|
||||||
|
"start_filament_gcode"s, "end_filament_gcode"s,
|
||||||
|
"filament_settings_id"s
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
t_config_option_keys my_options() override { return MaterialEditor::options(); }
|
||||||
|
protected:
|
||||||
|
void _update() override;
|
||||||
|
void _build() override;
|
||||||
|
const std::string LogChannel() override {return "MaterialEditor"s;} //< Which log these messages should go to.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user