@@ -2056,50 +2056,84 @@ DiffPresetDialog::DiffPresetDialog(wxWindow* parent, Preset::Type type, const st
20562056 : DPIDialog(parent, wxID_ANY, _L(" Compare presets" ), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
20572057 m_pr_technology(wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology())
20582058{
2059- m_preset_bundle_left = std::make_unique<PresetBundle>(* wxGetApp (). preset_bundle );
2060- m_preset_bundle_right = std::make_unique<PresetBundle>(* wxGetApp (). preset_bundle );
2061-
2059+ # if defined(__WXMSW__)
2060+ this -> SetFont ( wxSystemSettings::GetFont (wxSYS_DEFAULT_GUI_FONT) );
2061+ # endif
20622062 int border = 10 ;
20632063 int em = em_unit ();
2064+ SetBackgroundColour (*wxWHITE);
2065+
2066+ m_preset_bundle_left = std::make_unique<PresetBundle>(*wxGetApp ().preset_bundle );
2067+ m_preset_bundle_right = std::make_unique<PresetBundle>(*wxGetApp ().preset_bundle );
20642068
2065- m_top_info_line = new wxStaticText (this , wxID_ANY, " " );
2069+ m_top_info_line = new wxStaticText (this , wxID_ANY, _L (" Select presets to compare" ));
2070+ m_top_info_line->SetFont (wxSystemSettings::GetFont (wxSYS_DEFAULT_GUI_FONT).Bold ());
20662071 m_bottom_info_line = new wxStaticText (this , wxID_ANY, " " );
2072+ m_bottom_info_line->SetFont (wxSystemSettings::GetFont (wxSYS_DEFAULT_GUI_FONT).Bold ());
20672073
2068- m_tree = new DiffViewCtrl (this , wxSize (em * 65 , em * 40 ));
2069- m_tree->AppendBmpTextColumn (" " , DiffModel::colIconText, 35 );
2070- m_tree->AppendBmpTextColumn (" Left Preset Value" , DiffModel::colOldValue, 15 );
2071- m_tree->AppendBmpTextColumn (" Right Preset Value" ,DiffModel::colNewValue, 15 );
2074+ wxBoxSizer* presets_sizer = new wxBoxSizer (wxVERTICAL);
20722075
2073- // Create combo boxes for the target type only
2074- wxFlexGridSizer *presets_sizer = new wxFlexGridSizer (3 , 2 , border, border);
2075- presets_sizer->AddGrowableCol (0 , 1 );
2076- presets_sizer->AddGrowableCol (2 , 1 );
2076+ // Create combo rows for all types (same as original), hide non-matching ones
2077+ for (auto new_type : { Preset::TYPE_PRINT, Preset::TYPE_FILAMENT, Preset::TYPE_SLA_PRINT, Preset::TYPE_SLA_MATERIAL, Preset::TYPE_PRINTER })
2078+ {
2079+ const PresetCollection* collection = get_preset_collection (new_type);
2080+ wxBoxSizer* sizer = new wxBoxSizer (wxHORIZONTAL);
2081+ PresetComboBox* presets_left;
2082+ PresetComboBox* presets_right;
2083+ ScalableButton* equal_bmp = new ScalableButton (this , wxID_ANY, " equal" );
20772084
2078- auto add_preset_combobox = [this , presets_sizer, type](PresetComboBox** cb, PresetBundle* bundle) {
2079- *cb = new PresetComboBox (this , type);
2080- (*cb)->set_selection_changed_function ([this ](int ) { update_tree (); });
2081- (*cb)->SetFont (Label::Body_13);
2082- presets_sizer->Add (*cb, 1 , wxEXPAND);
2083- };
2085+ auto add_preset_combobox = [collection, sizer, new_type, em, this ](PresetComboBox** cb_, PresetBundle* preset_bundle) {
2086+ *cb_ = new PresetComboBox (this , new_type, wxSize (em * 35 , -1 ), preset_bundle);
2087+ PresetComboBox* cb = (*cb_);
2088+ cb->set_selection_changed_function ([this , new_type, preset_bundle, cb](int selection) {
2089+ if (m_view_type == Preset::TYPE_INVALID) {
2090+ std::string preset_name = cb->GetString (selection).ToUTF8 ().data ();
2091+ update_compatibility (Preset::remove_suffix_modified (preset_name), new_type, preset_bundle);
2092+ }
2093+ update_tree ();
2094+ });
2095+ if (collection->get_selected_idx () != (size_t )-1 )
2096+ cb->update (collection->get_selected_preset ().name );
2097+ sizer->Add (cb, 1 );
2098+ cb->Show (new_type == Preset::TYPE_PRINTER);
2099+ };
2100+ add_preset_combobox (&presets_left, m_preset_bundle_left.get ());
2101+ sizer->Add (equal_bmp, 0 , wxRIGHT | wxLEFT | wxALIGN_CENTER_VERTICAL, 5 );
2102+ add_preset_combobox (&presets_right, m_preset_bundle_right.get ());
2103+ presets_sizer->Add (sizer, 1 , wxTOP, 5 );
2104+ equal_bmp->Show (new_type == Preset::TYPE_PRINTER);
20842105
2085- PresetComboBox *presets_left, *presets_right;
2086- add_preset_combobox (&presets_left, m_preset_bundle_left.get ());
2087- auto equal_bmp = new ScalableButton (this , wxID_ANY, " equal" );
2088- presets_sizer->Add (equal_bmp, 0 , wxALIGN_CENTER);
2089- add_preset_combobox (&presets_right, m_preset_bundle_right.get ());
2090- m_preset_combos.push_back ({presets_left, equal_bmp, presets_right});
2106+ m_preset_combos.push_back ({ presets_left, equal_bmp, presets_right });
2107+
2108+ equal_bmp->Bind (wxEVT_BUTTON, [presets_left, presets_right, this ](wxEvent&) {
2109+ std::string preset_name = get_selection (presets_left);
2110+ presets_right->update (preset_name);
2111+ if (m_view_type == Preset::TYPE_INVALID)
2112+ update_compatibility (Preset::remove_suffix_modified (preset_name), presets_right->get_type (), m_preset_bundle_right.get ());
2113+ update_tree ();
2114+ });
2115+ }
20912116
20922117 m_show_all_presets = new wxCheckBox (this , wxID_ANY, _L (" Show all presets (including incompatible)" ));
20932118 m_show_all_presets->Bind (wxEVT_CHECKBOX, [this ](wxCommandEvent&) {
20942119 bool show_all = m_show_all_presets->GetValue ();
2095- for (auto &pc : m_preset_combos) {
2096- pc.presets_left ->show_all (show_all);
2097- pc.presets_right ->show_all (show_all);
2120+ for (auto preset_combos : m_preset_combos) {
2121+ if (preset_combos.presets_left ->get_type () == Preset::TYPE_PRINTER)
2122+ continue ;
2123+ preset_combos.presets_left ->show_all (show_all);
2124+ preset_combos.presets_right ->show_all (show_all);
20982125 }
2099- update_tree ();
2126+ if (m_view_type == Preset::TYPE_INVALID)
2127+ update_tree ();
21002128 });
21012129
2102- wxBoxSizer *topSizer = new wxBoxSizer (wxVERTICAL);
2130+ m_tree = new DiffViewCtrl (this , wxSize (em * 65 , em * 40 ));
2131+ m_tree->AppendBmpTextColumn (" " , DiffModel::colIconText, 35 );
2132+ m_tree->AppendBmpTextColumn (" Left Preset Value" , DiffModel::colOldValue, 15 );
2133+ m_tree->AppendBmpTextColumn (" Right Preset Value" ,DiffModel::colNewValue, 15 );
2134+ m_tree->Hide ();
2135+
2136+ wxBoxSizer* topSizer = new wxBoxSizer (wxVERTICAL);
21032137 topSizer->Add (m_top_info_line, 0 , wxEXPAND | wxLEFT | wxTOP | wxRIGHT, 2 * border);
21042138 topSizer->Add (presets_sizer, 0 , wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border);
21052139 topSizer->Add (m_show_all_presets, 0 , wxEXPAND | wxALL, border);
@@ -2110,11 +2144,17 @@ DiffPresetDialog::DiffPresetDialog(wxWindow* parent, Preset::Type type, const st
21102144 this ->SetSizer (topSizer);
21112145 topSizer->SetSizeHints (this );
21122146
2147+ // Show only the requested type and pre-select presets
21132148 m_view_type = type;
21142149 update_controls_visibility (type);
21152150
2116- if (!left.empty ()) presets_left->update (left);
2117- if (!right.empty ()) presets_right->update (right);
2151+ for (auto &pc : m_preset_combos) {
2152+ if (pc.presets_left ->get_type () != type)
2153+ continue ;
2154+ if (!left.empty ()) pc.presets_left ->update (left);
2155+ if (!right.empty ()) pc.presets_right ->update (right);
2156+ break ;
2157+ }
21182158 update_tree ();
21192159
21202160 wxGetApp ().UpdateDlgDarkUI (this );
0 commit comments