mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
Implemented the "Support for support enforcers only" quick selection.
Reduced some memory leaks due to the ConfigDef::default_value pointer.
This commit is contained in:
parent
1c6006f657
commit
a61e833536
14 changed files with 559 additions and 388 deletions
|
@ -203,7 +203,7 @@ void TextCtrl::BUILD() {
|
|||
case coFloatOrPercent:
|
||||
{
|
||||
text_value = double_to_string(m_opt.default_value->getFloat());
|
||||
if (static_cast<const ConfigOptionFloatOrPercent*>(m_opt.default_value)->percent)
|
||||
if (static_cast<const ConfigOptionFloatOrPercent*>(m_opt.default_value.get())->percent)
|
||||
text_value += "%";
|
||||
break;
|
||||
}
|
||||
|
@ -218,19 +218,19 @@ void TextCtrl::BUILD() {
|
|||
case coFloat:
|
||||
{
|
||||
double val = m_opt.type == coFloats ?
|
||||
static_cast<const ConfigOptionFloats*>(m_opt.default_value)->get_at(m_opt_idx) :
|
||||
static_cast<const ConfigOptionFloats*>(m_opt.default_value.get())->get_at(m_opt_idx) :
|
||||
m_opt.type == coFloat ?
|
||||
m_opt.default_value->getFloat() :
|
||||
static_cast<const ConfigOptionPercents*>(m_opt.default_value)->get_at(m_opt_idx);
|
||||
static_cast<const ConfigOptionPercents*>(m_opt.default_value.get())->get_at(m_opt_idx);
|
||||
text_value = double_to_string(val);
|
||||
break;
|
||||
}
|
||||
case coString:
|
||||
text_value = static_cast<const ConfigOptionString*>(m_opt.default_value)->value;
|
||||
text_value = static_cast<const ConfigOptionString*>(m_opt.default_value.get())->value;
|
||||
break;
|
||||
case coStrings:
|
||||
{
|
||||
const ConfigOptionStrings *vec = static_cast<const ConfigOptionStrings*>(m_opt.default_value);
|
||||
const ConfigOptionStrings *vec = static_cast<const ConfigOptionStrings*>(m_opt.default_value.get());
|
||||
if (vec == nullptr || vec->empty()) break; //for the case of empty default value
|
||||
text_value = vec->get_at(m_opt_idx);
|
||||
break;
|
||||
|
@ -373,7 +373,7 @@ void CheckBox::BUILD() {
|
|||
|
||||
bool check_value = m_opt.type == coBool ?
|
||||
m_opt.default_value->getBool() : m_opt.type == coBools ?
|
||||
static_cast<const ConfigOptionBools*>(m_opt.default_value)->get_at(m_opt_idx) :
|
||||
static_cast<const ConfigOptionBools*>(m_opt.default_value.get())->get_at(m_opt_idx) :
|
||||
false;
|
||||
|
||||
// Set Label as a string of at least one space simbol to correct system scaling of a CheckBox
|
||||
|
@ -427,7 +427,7 @@ void SpinCtrl::BUILD() {
|
|||
break;
|
||||
case coInts:
|
||||
{
|
||||
const ConfigOptionInts *vec = static_cast<const ConfigOptionInts*>(m_opt.default_value);
|
||||
const ConfigOptionInts *vec = static_cast<const ConfigOptionInts*>(m_opt.default_value.get());
|
||||
if (vec == nullptr || vec->empty()) break;
|
||||
for (size_t id = 0; id < vec->size(); ++id)
|
||||
{
|
||||
|
@ -629,7 +629,7 @@ void Choice::set_selection()
|
|||
break;
|
||||
}
|
||||
case coEnum:{
|
||||
int id_value = static_cast<const ConfigOptionEnum<SeamPosition>*>(m_opt.default_value)->value; //!!
|
||||
int id_value = static_cast<const ConfigOptionEnum<SeamPosition>*>(m_opt.default_value.get())->value; //!!
|
||||
field->SetSelection(id_value);
|
||||
break;
|
||||
}
|
||||
|
@ -649,7 +649,7 @@ void Choice::set_selection()
|
|||
break;
|
||||
}
|
||||
case coStrings:{
|
||||
text_value = static_cast<const ConfigOptionStrings*>(m_opt.default_value)->get_at(m_opt_idx);
|
||||
text_value = static_cast<const ConfigOptionStrings*>(m_opt.default_value.get())->get_at(m_opt_idx);
|
||||
|
||||
size_t idx = 0;
|
||||
for (auto el : m_opt.enum_values)
|
||||
|
@ -886,7 +886,7 @@ void ColourPicker::BUILD()
|
|||
if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit);
|
||||
|
||||
// Validate the color
|
||||
wxString clr_str(static_cast<const ConfigOptionStrings*>(m_opt.default_value)->get_at(m_opt_idx));
|
||||
wxString clr_str(static_cast<const ConfigOptionStrings*>(m_opt.default_value.get())->get_at(m_opt_idx));
|
||||
wxColour clr(clr_str);
|
||||
if (! clr.IsOk()) {
|
||||
clr = wxTransparentColour;
|
||||
|
@ -920,7 +920,7 @@ void PointCtrl::BUILD()
|
|||
|
||||
const wxSize field_size(4 * m_em_unit, -1);
|
||||
|
||||
auto default_pt = static_cast<const ConfigOptionPoints*>(m_opt.default_value)->values.at(0);
|
||||
auto default_pt = static_cast<const ConfigOptionPoints*>(m_opt.default_value.get())->values.at(0);
|
||||
double val = default_pt(0);
|
||||
wxString X = val - int(val) == 0 ? wxString::Format(_T("%i"), int(val)) : wxNumberFormatter::ToString(val, 2, wxNumberFormatter::Style_None);
|
||||
val = default_pt(1);
|
||||
|
@ -1019,7 +1019,7 @@ void StaticText::BUILD()
|
|||
if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit);
|
||||
if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit);
|
||||
|
||||
const wxString legend(static_cast<const ConfigOptionString*>(m_opt.default_value)->value);
|
||||
const wxString legend(static_cast<const ConfigOptionString*>(m_opt.default_value.get())->value);
|
||||
auto temp = new wxStaticText(m_parent, wxID_ANY, legend, wxDefaultPosition, size, wxST_ELLIPSIZE_MIDDLE);
|
||||
temp->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||
temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
|
@ -1054,7 +1054,7 @@ void SliderCtrl::BUILD()
|
|||
|
||||
auto temp = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
auto def_val = static_cast<const ConfigOptionInt*>(m_opt.default_value)->value;
|
||||
auto def_val = static_cast<const ConfigOptionInt*>(m_opt.default_value.get())->value;
|
||||
auto min = m_opt.min == INT_MIN ? 0 : m_opt.min;
|
||||
auto max = m_opt.max == INT_MAX ? 100 : m_opt.max;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue