UnsavedChangesDialog: Code refactoring to get types list in respect to the printer technology.
Note: using of the initializer_list without a container definition causes a crash under GTK
This commit is contained in:
parent
d39768fc9c
commit
8c36ea00f4
@ -1571,6 +1571,13 @@ void DiffPresetDialog::create_tree()
|
|||||||
m_tree->GetColumn(DiffModel::colToggle)->SetHidden(true);
|
m_tree->GetColumn(DiffModel::colToggle)->SetHidden(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::array<Preset::Type, 3> types_list(PrinterTechnology pt)
|
||||||
|
{
|
||||||
|
if (pt == ptFFF)
|
||||||
|
return { Preset::TYPE_PRINTER, Preset::TYPE_PRINT, Preset::TYPE_FILAMENT };
|
||||||
|
return { Preset::TYPE_PRINTER, Preset::TYPE_SLA_PRINT, Preset::TYPE_SLA_MATERIAL };
|
||||||
|
}
|
||||||
|
|
||||||
void DiffPresetDialog::create_buttons()
|
void DiffPresetDialog::create_buttons()
|
||||||
{
|
{
|
||||||
wxFont font = this->GetFont().Scaled(1.4f);
|
wxFont font = this->GetFont().Scaled(1.4f);
|
||||||
@ -1598,8 +1605,7 @@ void DiffPresetDialog::create_buttons()
|
|||||||
bool enable = m_tree->has_selection();
|
bool enable = m_tree->has_selection();
|
||||||
if (enable) {
|
if (enable) {
|
||||||
if (m_view_type == Preset::TYPE_INVALID) {
|
if (m_view_type == Preset::TYPE_INVALID) {
|
||||||
for (const Preset::Type& type : (m_pr_technology == ptFFF ? std::initializer_list<Preset::Type>{Preset::TYPE_PRINTER, Preset::TYPE_PRINT, Preset::TYPE_FILAMENT} :
|
for (const Preset::Type& type : types_list(m_pr_technology))
|
||||||
std::initializer_list<Preset::Type>{ Preset::TYPE_PRINTER, Preset::TYPE_SLA_PRINT, Preset::TYPE_SLA_MATERIAL }))
|
|
||||||
if (!enable_transfer(type)) {
|
if (!enable_transfer(type)) {
|
||||||
enable = false;
|
enable = false;
|
||||||
break;
|
break;
|
||||||
@ -2024,10 +2030,7 @@ bool DiffPresetDialog::is_save_confirmed()
|
|||||||
|
|
||||||
std::vector<Preset::Type> types_for_save;
|
std::vector<Preset::Type> types_for_save;
|
||||||
|
|
||||||
const auto list = m_pr_technology == ptFFF ? std::initializer_list<Preset::Type>{Preset::TYPE_PRINTER, Preset::TYPE_PRINT, Preset::TYPE_FILAMENT} :
|
for (const Preset::Type& type : types_list(m_pr_technology)) {
|
||||||
std::initializer_list<Preset::Type>{ Preset::TYPE_PRINTER, Preset::TYPE_SLA_PRINT, Preset::TYPE_SLA_MATERIAL };
|
|
||||||
|
|
||||||
for (const Preset::Type& type : list) {
|
|
||||||
if (!m_tree->options(type, true).empty()) {
|
if (!m_tree->options(type, true).empty()) {
|
||||||
types_for_save.emplace_back(type);
|
types_for_save.emplace_back(type);
|
||||||
presets_to_save.emplace_back(PresetToSave{ type, get_left_preset_name(type), get_right_preset_name(type), get_right_preset_name(type) });
|
presets_to_save.emplace_back(PresetToSave{ type, get_left_preset_name(type), get_right_preset_name(type), get_right_preset_name(type) });
|
||||||
|
Loading…
Reference in New Issue
Block a user