PhysicalPrinterDialog : Update of the HostType in respect to the selected printers

This commit is contained in:
YuSanka 2021-06-04 08:42:04 +02:00 committed by David Kocik
parent 725e60d006
commit 80f4571cd7
3 changed files with 54 additions and 2 deletions

View file

@ -1111,6 +1111,10 @@ void Choice::set_value(const boost::any& value, bool change_event)
}
case coEnum: {
int val = boost::any_cast<int>(value);
if (m_opt_id.compare("host_type") == 0 && val != 0 &&
m_opt.enum_values.size() > field->GetCount()) // for case, when PrusaLink isn't used as a HostType
val--;
if (m_opt_id == "top_fill_pattern" || m_opt_id == "bottom_fill_pattern" || m_opt_id == "fill_pattern")
{
if (!m_opt.enum_values.empty()) {
@ -1178,7 +1182,7 @@ void Choice::set_values(const wxArrayString &values)
auto ww = dynamic_cast<choice_ctrl*>(window);
auto value = ww->GetValue();
ww->Clear();
ww->Append("");
// ww->Append("");
for (const auto &el : values)
ww->Append(el);
ww->SetValue(value);
@ -1201,6 +1205,10 @@ boost::any& Choice::get_value()
if (m_opt.type == coEnum)
{
int ret_enum = field->GetSelection();
if (m_opt_id.compare("host_type") == 0 &&
m_opt.enum_values.size() > field->GetCount()) // for case, when PrusaLink isn't used as a HostType
ret_enum++;
if (m_opt_id == "top_fill_pattern" || m_opt_id == "bottom_fill_pattern" || m_opt_id == "fill_pattern")
{
if (!m_opt.enum_values.empty()) {