Skip to content

Commit 6f19fba

Browse files
Phase 3 rework: Compare pre-selects checked presets
- DiffPresetDialog::show() overload takes left/right preset names - Batch management Compare button passes first two checked presets - Compare dialog opens on top without closing batch management - Existing show() behavior unchanged for other callers
1 parent 18d91f1 commit 6f19fba

3 files changed

Lines changed: 22 additions & 2 deletions

File tree

src/slic3r/GUI/UnsavedChangesDialog.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,6 +2098,23 @@ void DiffPresetDialog::show(Preset::Type type /* = Preset::TYPE_INVALID*/)
20982098
Show();
20992099
}
21002100

2101+
void DiffPresetDialog::show(Preset::Type type, const std::string &left, const std::string &right)
2102+
{
2103+
show(type);
2104+
2105+
// Pre-select the requested presets in the combo boxes
2106+
for (auto &preset_combos : m_preset_combos) {
2107+
if (preset_combos.presets_left->get_type() != type)
2108+
continue;
2109+
if (!left.empty())
2110+
preset_combos.presets_left->update(left);
2111+
if (!right.empty())
2112+
preset_combos.presets_right->update(right);
2113+
break;
2114+
}
2115+
update_tree();
2116+
}
2117+
21012118
void DiffPresetDialog::update_presets(Preset::Type type)
21022119
{
21032120
m_pr_technology = m_preset_bundle_left.get()->printers.get_edited_preset().printer_technology();

src/slic3r/GUI/UnsavedChangesDialog.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ class DiffPresetDialog : public DPIDialog
449449
~DiffPresetDialog(){};
450450

451451
void show(Preset::Type type = Preset::TYPE_INVALID);
452+
void show(Preset::Type type, const std::string &left, const std::string &right);
452453
void update_presets(Preset::Type type = Preset::TYPE_INVALID);
453454

454455
protected:

src/slic3r/GUI/UserPresetsDialog.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,10 @@ UserPresetsDialog::UserPresetsDialog(wxWindow *parent)
9797
m_button_compare->SetTextColorNormal(wxColor("#00AE42"));
9898
m_button_compare->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this](auto &) {
9999
Preset::Type types[] = {Preset::TYPE_PRINTER, Preset::TYPE_FILAMENT, Preset::TYPE_PRINT};
100-
this->EndModal(wxID_OK);
101-
wxGetApp().mainframe->diff_dialog.show(types[m_collection]);
100+
std::string left, right;
101+
if (m_checked_presets.size() >= 1) left = m_checked_presets[0];
102+
if (m_checked_presets.size() >= 2) right = m_checked_presets[1];
103+
wxGetApp().mainframe->diff_dialog.show(types[m_collection], left, right);
102104
});
103105

104106
wxSizer *sizer_bottom = new wxBoxSizer(wxHORIZONTAL);

0 commit comments

Comments
 (0)