From d20c0f48ca843d841a9675d04ef75a9939b366d9 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Mon, 21 May 2018 22:01:35 -0500 Subject: [PATCH] workaround: avoid requiring c++14 just yet. --- src/CMakeLists.txt | 4 +- src/GUI/PresetEditor.hpp | 131 +++++++++++++++++++++++---------------- 2 files changed, 80 insertions(+), 55 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f7edd8b93..9b096683b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -31,7 +31,7 @@ endif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.7.0) set(CMAKE_INCLUDE_CURRENT_DIR ON) IF(CMAKE_HOST_APPLE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -stdlib=libc++ -DBOOST_THREAD_DONT_USE_CHRONO -DBOOST_NO_CXX11_RVALUE_REFERENCES -DBOOST_THREAD_USES_MOVE") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++ -DBOOST_THREAD_DONT_USE_CHRONO -DBOOST_NO_CXX11_RVALUE_REFERENCES -DBOOST_THREAD_USES_MOVE") set(CMAKE_EXE_LINKER_FLAGS "-framework IOKit -framework CoreFoundation -lc++") ELSE(CMAKE_HOST_APPLE) # set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -L.") @@ -216,7 +216,7 @@ IF(wxWidgets_FOUND) ${GUI_LIBDIR}/Settings.cpp ${GUI_LIBDIR}/misc_ui.cpp ) - target_compile_features(slic3r_gui PUBLIC cxx_std_14) + target_compile_features(slic3r_gui PUBLIC cxx_std_11) #only build GUI lib if building with wx target_link_libraries (slic3r slic3r_gui ${wxWidgets_LIBRARIES}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_WX") diff --git a/src/GUI/PresetEditor.hpp b/src/GUI/PresetEditor.hpp index 6f7bfcc4d..03cb86d6d 100644 --- a/src/GUI/PresetEditor.hpp +++ b/src/GUI/PresetEditor.hpp @@ -2,10 +2,17 @@ #define PRESETEDITOR_HPP #include +#include "libslic3r.h" +#if SLIC3R_CPPVER==11 + #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 { -using namespace std::string_literals; class PresetEditor : public wxPanel { @@ -23,69 +30,87 @@ public: static t_config_option_keys options() { return t_config_option_keys { - "layer_height"s, "first_layer_height"s, - "adaptive_slicing"s, "adaptive_slicing_quality"s, "match_horizontal_surfaces"s, - "perimeters"s, "spiral_vase"s, - "top_solid_layers"s, "bottom_solid_layers"s, - "extra_perimeters"s, "avoid_crossing_perimeters"s, "thin_walls"s, "overhangs"s, - "seam_position"s, "external_perimeters_first"s, - "fill_density"s, "fill_pattern"s, "top_infill_pattern"s, "bottom_infill_pattern"s, "fill_gaps"s, - "infill_every_layers"s, "infill_only_where_needed"s, - "solid_infill_every_layers"s, "fill_angle"s, "solid_infill_below_area"s, ""s, - "only_retract_when_crossing_perimeters"s, "infill_first"s, - "max_print_speed"s, "max_volumetric_speed"s, - "perimeter_speed"s, "small_perimeter_speed"s, "external_perimeter_speed"s, "infill_speed"s, ""s, - "solid_infill_speed"s, "top_solid_infill_speed"s, "support_material_speed"s, ""s, - "support_material_interface_speed"s, "bridge_speed"s, "gap_fill_speed"s, - "travel_speed"s, - "first_layer_speed"s, - "perimeter_acceleration"s, "infill_acceleration"s, "bridge_acceleration"s, ""s, - "first_layer_acceleration"s, "default_acceleration"s, - "skirts"s, "skirt_distance"s, "skirt_height"s, "min_skirt_length"s, - "brim_connections_width"s, "brim_width"s, "interior_brim_width"s, - "support_material"s, "support_material_threshold"s, "support_material_max_layers"s, "support_material_enforce_layers"s, - "raft_layers"s, - "support_material_pattern"s, "support_material_spacing"s, "support_material_angle"s, ""s, - "support_material_interface_layers"s, "support_material_interface_spacing"s, - "support_material_contact_distance"s, "support_material_buildplate_only"s, "dont_support_bridges"s, - "notes"s, - "complete_objects"s, "extruder_clearance_radius"s, "extruder_clearance_height"s, - "gcode_comments"s, "output_filename_format"s, - "post_process"s, - "perimeter_extruder"s, "infill_extruder"s, "solid_infill_extruder"s, - "support_material_extruder"s, "support_material_interface_extruder"s, - "ooze_prevention"s, "standby_temperature_delta"s, - "interface_shells"s, "regions_overlap"s, - "extrusion_width"s, "first_layer_extrusion_width"s, "perimeter_extrusion_width"s, ""s, - "external_perimeter_extrusion_width"s, "infill_extrusion_width"s, "solid_infill_extrusion_width"s, - "top_infill_extrusion_width"s, "support_material_extrusion_width"s, - "support_material_interface_extrusion_width"s, "infill_overlap"s, "bridge_flow_ratio"s, - "xy_size_compensation"s, "resolution"s, "shortcuts"s, "compatible_printers"s, - "print_settings_id"s + st(layer_height), st(first_layer_height), + st(adaptive_slicing), st(adaptive_slicing_quality), st(match_horizontal_surfaces), + st(perimeters), st(spiral_vase), + st(top_solid_layers), st(bottom_solid_layers), + st(extra_perimeters), st(avoid_crossing_perimeters), st(thin_walls), st(overhangs), + st(seam_position), st(external_perimeters_first), + st(fill_density), st(fill_pattern), st(top_infill_pattern), st(bottom_infill_pattern), st(fill_gaps), + st(infill_every_layers), st(infill_only_where_needed), + st(solid_infill_every_layers), st(fill_angle), st(solid_infill_below_area), st(), + st(only_retract_when_crossing_perimeters), st(infill_first), + st(max_print_speed), st(max_volumetric_speed), + st(perimeter_speed), st(small_perimeter_speed), st(external_perimeter_speed), st(infill_speed), st(), + st(solid_infill_speed), st(top_solid_infill_speed), st(support_material_speed), + st(support_material_interface_speed), st(bridge_speed), st(gap_fill_speed), + st(travel_speed), + st(first_layer_speed), + st(perimeter_acceleration), st(infill_acceleration), st(bridge_acceleration), + st(first_layer_acceleration), st(default_acceleration), + st(skirts), st(skirt_distance), st(skirt_height), st(min_skirt_length), + st(brim_connections_width), st(brim_width), st(interior_brim_width), + st(support_material), st(support_material_threshold), st(support_material_max_layers), st(support_material_enforce_layers), + st(raft_layers), + st(support_material_pattern), st(support_material_spacing), st(support_material_angle), st(), + st(support_material_interface_layers), st(support_material_interface_spacing), + st(support_material_contact_distance), st(support_material_buildplate_only), st(dont_support_bridges), + st(notes), + st(complete_objects), st(extruder_clearance_radius), st(extruder_clearance_height), + st(gcode_comments), st(output_filename_format), + st(post_process), + st(perimeter_extruder), st(infill_extruder), st(solid_infill_extruder), + st(support_material_extruder), st(support_material_interface_extruder), + st(ooze_prevention), st(standby_temperature_delta), + st(interface_shells), st(regions_overlap), + st(extrusion_width), st(first_layer_extrusion_width), st(perimeter_extrusion_width), st(), + st(external_perimeter_extrusion_width), st(infill_extrusion_width), st(solid_infill_extrusion_width), + st(top_infill_extrusion_width), st(support_material_extrusion_width), + st(support_material_interface_extrusion_width), st(infill_overlap), st(bridge_flow_ratio), + st(xy_size_compensation), st(resolution), st(shortcuts), st(compatible_printers), + st(print_settings_id) }; } t_config_option_keys my_options() override { return PrintEditor::options(); } }; +class MaterialEditor : public PresetEditor { + + 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(); } +}; + class PrinterEditor : public PresetEditor { static t_config_option_keys options() { return t_config_option_keys { - "bed_shape"s, "z_offset"s, "z_steps_per_mm"s, "has_heatbed"s, - "gcode_flavor"s, "use_relative_e_distances"s, - "serial_port"s, "serial_speed"s, - "host_type"s, "print_host"s, "octoprint_apikey"s, - "use_firmware_retraction"s, "pressure_advance"s, "vibration_limit"s, - "use_volumetric_e"s, - "start_gcode"s, "end_gcode"s, "before_layer_gcode"s, "layer_gcode"s, "toolchange_gcode"s, "between_objects_gcode"s, - "nozzle_diameter"s, "extruder_offset"s, "min_layer_height"s, "max_layer_height"s, - "retract_length"s, "retract_lift"s, "retract_speed"s, "retract_restart_extra"s, "retract_before_travel"s, "retract_layer_change"s, "wipe"s, - "retract_length_toolchange"s, "retract_restart_extra_toolchange"s, "retract_lift_above"s, "retract_lift_below"s, - "printer_settings_id"s, - "printer_notes"s, - "use_set_and_wait_bed"s, "use_set_and_wait_extruder"s + st(bed_shape), st(z_offset), st(z_steps_per_mm), st(has_heatbed), + st(gcode_flavor), st(use_relative_e_distances), + st(serial_port), st(serial_speed), + st(host_type), st(print_host), st(octoprint_apikey), + st(use_firmware_retraction), st(pressure_advance), st(vibration_limit), + st(use_volumetric_e), + st(start_gcode), st(end_gcode), st(before_layer_gcode), st(layer_gcode), st(toolchange_gcode), st(between_objects_gcode), + st(nozzle_diameter), st(extruder_offset), st(min_layer_height), st(max_layer_height), + st(retract_length), st(retract_lift), st(retract_speed), st(retract_restart_extra), st(retract_before_travel), st(retract_layer_change), st(wipe), + st(retract_length_toolchange), st(retract_restart_extra_toolchange), st(retract_lift_above), st(retract_lift_below), + st(printer_settings_id), + st(printer_notes), + st(use_set_and_wait_bed), st(use_set_and_wait_extruder) }; }