Add pattern in infill checkbox

This commit is contained in:
QIDI TECH
2023-08-19 13:55:15 +08:00
parent 42a146b5af
commit b33907514e
2 changed files with 34 additions and 19 deletions

View File

@@ -1948,7 +1948,7 @@ void PrintConfigDef::init_fff_params()
//B25 //B25
def = this->add("enable_volume_fan", coInts); def = this->add("enable_volume_fan", coInts);
def->label = L("Volume Fan Speed"); def->label = L("Chamber Fan Speed");
def->tooltip = L("This setting represents the PWM your volume fan needs to work."); def->tooltip = L("This setting represents the PWM your volume fan needs to work.");
def->sidetext = L("%"); def->sidetext = L("%");
def->min = 0; def->min = 0;
@@ -2893,9 +2893,9 @@ void PrintConfigDef::init_fff_params()
"will create more stable supports, while snug support towers will save material and reduce " "will create more stable supports, while snug support towers will save material and reduce "
"object scarring."); "object scarring.");
def->set_enum<SupportMaterialStyle>({ def->set_enum<SupportMaterialStyle>({
{ "grid", L("Grid ") }, { "grid", L("Grid") },
{ "snug", L("Snug ") }, { "snug", L("Snug") },
{ "organic", L("Organic ") } { "organic", L("Organic") }
}); });
def->mode = comAdvanced; def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnum<SupportMaterialStyle>(smsGrid)); def->set_default_value(new ConfigOptionEnum<SupportMaterialStyle>(smsGrid));

View File

@@ -1018,7 +1018,7 @@ void Choice::BUILD() {
// recast as a wxWindow to fit the calling convention // recast as a wxWindow to fit the calling convention
window = dynamic_cast<wxWindow*>(temp); window = dynamic_cast<wxWindow*>(temp);
//Y10
/*if (m_opt.enum_def) { /*if (m_opt.enum_def) {
if (auto& labels = m_opt.enum_def->labels(); !labels.empty()) { if (auto& labels = m_opt.enum_def->labels(); !labels.empty()) {
bool localized = m_opt.enum_def->has_labels(); bool localized = m_opt.enum_def->has_labels();
@@ -1026,23 +1026,38 @@ void Choice::BUILD() {
temp->Append(localized ? _(from_u8(el)) : from_u8(el)); temp->Append(localized ? _(from_u8(el)) : from_u8(el));
set_selection(); set_selection();
} }
}*/ }*/
if (m_opt.enum_def) { if (m_opt.enum_def) {
// Append localized enum_labels if (auto& labels = m_opt.enum_def->labels(); !labels.empty())
int i = 0; {
boost::filesystem::path image_path(Slic3r::resources_dir()); bool localized = m_opt.enum_def->has_labels();
image_path /= "icons"; boost::filesystem::path image_path(Slic3r::resources_dir());
for (auto el : m_opt.enum_def->labels()) { image_path /= "icons";
auto icon_name = "param_" + m_opt.enum_def->labels()[i]; for (const std::string& el : labels)
if (boost::filesystem::exists(image_path / (icon_name + ".svg"))) { {
ScalableBitmap bm(temp, icon_name, 24); std::vector <std::string> show_pattern_options{ "fill_pattern", "top_fill_pattern", "bottom_fill_pattern", "support_material_pattern","support_material_interface_pattern" };
temp->Append(_(el), bm.bmp()); bool show_pattern = false;
} else { for (auto sp_option : show_pattern_options)
temp->Append(_(el)); if (m_opt.opt_key == sp_option)
{
show_pattern = true;
break;
}
if (show_pattern)
{
auto icon_name = "param_" + el;
transform(icon_name.begin(), icon_name.end(), icon_name.begin(), ::tolower);
if (boost::filesystem::exists(image_path / (icon_name + ".svg")))
{
ScalableBitmap bm(temp, icon_name);
temp->Append(localized ? _(from_u8(el)) : from_u8(el), bm.bmp());
}
}
else
temp->Append(localized ? _(from_u8(el)) : from_u8(el));
} }
++i; set_selection();
} }
set_selection();
} }
temp->Bind(wxEVT_MOUSEWHEEL, [this](wxMouseEvent& e) { temp->Bind(wxEVT_MOUSEWHEEL, [this](wxMouseEvent& e) {