ConfigOptions: GUI type as enum, not string.

Fixing compilation error in the new Platform code.
Fixing one issue in FDM support after splitting the top/bottom
interface layers.
This commit is contained in:
Vojtech Bubnik 2021-03-11 15:01:24 +01:00
parent 051ba0e6f4
commit a9c3d270e6
10 changed files with 66 additions and 55 deletions

View file

@ -1441,6 +1441,24 @@ private:
class ConfigOptionDef
{
public:
enum class GUIType {
undefined,
// Open enums, integer value could be one of the enumerated values or something else.
i_enum_open,
// Open enums, float value could be one of the enumerated values or something else.
f_enum_open,
// Color picker, string value.
color,
// ???
select_open,
// Currently unused.
slider,
// Static text
legend,
// Vector value, but edited as a single string.
one_string,
};
// Identifier of this option. It is stored here so that it is accessible through the by_serialization_key_ordinal map.
t_config_option_key opt_key;
// What type? bool, int, string etc.
@ -1524,7 +1542,7 @@ public:
// Usually empty.
// Special values - "i_enum_open", "f_enum_open" to provide combo box for int or float selection,
// "select_open" - to open a selection dialog (currently only a serial port selection).
std::string gui_type;
GUIType gui_type { GUIType::undefined };
// Usually empty. Otherwise "serialized" or "show_value"
// The flags may be combined.
// "serialized" - vector valued option is entered in a single edit field. Values are separated by a semicolon.

View file

@ -66,7 +66,7 @@ void PrintConfigDef::init_common_params()
def->label = L("G-code thumbnails");
def->tooltip = L("Picture sizes to be stored into a .gcode and .sl1 files, in the following format: \"XxY, XxY, ...\"");
def->mode = comExpert;
def->gui_type = "one_string";
def->gui_type = ConfigOptionDef::GUIType::one_string;
def->set_default_value(new ConfigOptionPoints());
def = this->add("layer_height", coFloat);
@ -116,7 +116,7 @@ void PrintConfigDef::init_common_params()
def = this->add("printhost_port", coString);
def->label = L("Printer");
def->tooltip = L("Name of the printer");
def->gui_type = "select_open";
def->gui_type = ConfigOptionDef::GUIType::select_open;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionString(""));
@ -568,7 +568,7 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionBool(true));
def = this->add("extruder", coInt);
def->gui_type = "i_enum_open";
def->gui_type = ConfigOptionDef::GUIType::i_enum_open;
def->label = L("Extruder");
def->category = L("Extruders");
def->tooltip = L("The extruder to use (unless more specific extruder settings are specified). "
@ -606,7 +606,7 @@ void PrintConfigDef::init_fff_params()
def = this->add("extruder_colour", coStrings);
def->label = L("Extruder Color");
def->tooltip = L("This is only used in the Slic3r interface as a visual help.");
def->gui_type = "color";
def->gui_type = ConfigOptionDef::GUIType::color;
// Empty string means no color assigned yet.
def->set_default_value(new ConfigOptionStrings { "" });
@ -668,7 +668,7 @@ void PrintConfigDef::init_fff_params()
def = this->add("filament_colour", coStrings);
def->label = L("Color");
def->tooltip = L("This is only used in the Slic3r interface as a visual help.");
def->gui_type = "color";
def->gui_type = ConfigOptionDef::GUIType::color;
def->set_default_value(new ConfigOptionStrings { "#29B2B2" });
def = this->add("filament_notes", coStrings);
@ -812,7 +812,7 @@ void PrintConfigDef::init_fff_params()
def = this->add("filament_type", coStrings);
def->label = L("Filament type");
def->tooltip = L("The filament material type for use in custom G-codes.");
def->gui_type = "f_enum_open";
def->gui_type = ConfigOptionDef::GUIType::f_enum_open;
def->gui_flags = "show_value";
def->enum_values.push_back("PLA");
def->enum_values.push_back("PET");
@ -881,7 +881,7 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionFloat(45));
def = this->add("fill_density", coPercent);
def->gui_type = "f_enum_open";
def->gui_type = ConfigOptionDef::GUIType::f_enum_open;
def->gui_flags = "show_value";
def->label = L("Fill density");
def->category = L("Infill");
@ -1168,7 +1168,7 @@ void PrintConfigDef::init_fff_params()
"Set this parameter to zero to disable anchoring perimeters connected to a single infill line.");
def->sidetext = L("mm or %");
def->ratio_over = "infill_extrusion_width";
def->gui_type = "f_enum_open";
def->gui_type = ConfigOptionDef::GUIType::f_enum_open;
def->enum_values.push_back("0");
def->enum_values.push_back("1");
def->enum_values.push_back("2");
@ -1950,7 +1950,7 @@ void PrintConfigDef::init_fff_params()
#if 0
def = this->add("seam_preferred_direction", coFloat);
// def->gui_type = "slider";
// def->gui_type = ConfigOptionDef::GUIType::slider;
def->label = L("Direction");
def->sidetext = L("°");
def->full_label = L("Preferred direction of the seam");
@ -1960,7 +1960,7 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionFloat(0));
def = this->add("seam_preferred_direction_jitter", coFloat);
// def->gui_type = "slider";
// def->gui_type = ConfigOptionDef::GUIType::slider;
def->label = L("Jitter");
def->sidetext = L("°");
def->full_label = L("Seam preferred direction jitter");
@ -2234,7 +2234,7 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionBool(false));
def = this->add("support_material_contact_distance", coFloat);
def->gui_type = "f_enum_open";
def->gui_type = ConfigOptionDef::GUIType::f_enum_open;
def->label = L("Top contact Z distance");
def->category = L("Support material");
def->tooltip = L("The vertical distance between object and support material interface. "
@ -2252,7 +2252,7 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionFloat(0.2));
def = this->add("support_material_bottom_contact_distance", coFloat);
def->gui_type = "f_enum_open";
def->gui_type = ConfigOptionDef::GUIType::f_enum_open;
def->label = L("Bottom contact Z distance");
def->category = L("Support material");
def->tooltip = L("The vertical distance between the object top surface and the support material interface. "
@ -2318,7 +2318,7 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionInt(1));
auto support_material_interface_layers = def = this->add("support_material_interface_layers", coInt);
def->gui_type = "i_enum_open";
def->gui_type = ConfigOptionDef::GUIType::i_enum_open;
def->label = L("Top interface layers");
def->category = L("Support material");
def->tooltip = L("Number of interface layers to insert between the object(s) and support material.");
@ -2336,7 +2336,7 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionInt(3));
def = this->add("support_material_bottom_interface_layers", coInt);
def->gui_type = "i_enum_open";
def->gui_type = ConfigOptionDef::GUIType::i_enum_open;
def->label = L("Bottom interface layers");
def->category = L("Support material");
def->tooltip = L("Number of interface layers to insert between the object(s) and support material. "
@ -2873,7 +2873,7 @@ void PrintConfigDef::init_sla_params()
def = this->add("material_type", coString);
def->label = L("SLA material type");
def->tooltip = L("SLA material type");
def->gui_type = "f_enum_open"; // TODO: ???
def->gui_type = ConfigOptionDef::GUIType::f_enum_open; // TODO: ???
def->gui_flags = "show_value";
def->enum_values.push_back("Tough");
def->enum_values.push_back("Flexible");

View file

@ -2760,7 +2760,7 @@ std::pair<PrintObjectSupportMaterial::MyLayersPtr, PrintObjectSupportMaterial::M
Polygons polygons_top_contact_projected_base;
Polygons polygons_bottom_contact_projected_interface;
Polygons polygons_bottom_contact_projected_base;
if (num_interface_layers_top > -1) {
if (num_interface_layers_top > 0) {
// Top Z coordinate of a slab, over which we are collecting the top / bottom contact surfaces
coordf_t top_z = intermediate_layers[std::min(num_intermediate - 1, idx_intermediate_layer + num_interface_layers_top - 1)]->print_z;
coordf_t top_inteface_z = std::numeric_limits<coordf_t>::max();
@ -2781,7 +2781,7 @@ std::pair<PrintObjectSupportMaterial::MyLayersPtr, PrintObjectSupportMaterial::M
polygons_append(top_contact_layer.bottom_z - EPSILON > top_inteface_z ? polygons_top_contact_projected_base : polygons_top_contact_projected_interface, top_contact_layer.polygons);
}
}
if (num_interface_layers_bottom > -1) {
if (num_interface_layers_bottom > 0) {
// Bottom Z coordinate of a slab, over which we are collecting the top / bottom contact surfaces
coordf_t bottom_z = intermediate_layers[std::max(0, idx_intermediate_layer - num_interface_layers_bottom + 1)]->bottom_z;
coordf_t bottom_interface_z = - std::numeric_limits<coordf_t>::max();