QoL: Port profile value transfer on profile diff dialog from PrusaSlicer (#3737)

* DiffDialog: Implemented a transfer of options from one preset to another
Related to [Feature Request] #5384 - Copy values in Profile comparaison dialog

Cherry-picked from prusa3d/PrusaSlicer@0b8d7380ff

Co-authored-by: YuSanka <yusanka@gmail.com>

* Remove save button

* Sync with latest PS

* Use Orca button style

* Show tips about trasnfer disabled

---------

Co-authored-by: YuSanka <yusanka@gmail.com>
This commit is contained in:
Noisyfox 2024-01-24 23:18:52 +08:00 committed by GitHub
parent 48541be681
commit 55b6f2a588
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 422 additions and 108 deletions

View file

@ -611,8 +611,41 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_
wxGetApp().persist_window_geometry(this, true);
wxGetApp().persist_window_geometry(&m_settings_dialog, true);
// bind events from DiffDlg
bind_diff_dialog();
}
void MainFrame::bind_diff_dialog()
{
auto get_tab = [](Preset::Type type) {
Tab* null_tab = nullptr;
for (Tab* tab : wxGetApp().tabs_list)
if (tab->type() == type)
return tab;
return null_tab;
};
auto transfer = [this, get_tab](Preset::Type type) {
get_tab(type)->transfer_options(diff_dialog.get_left_preset_name(type),
diff_dialog.get_right_preset_name(type),
diff_dialog.get_selected_options(type));
};
auto process_options = [this](std::function<void(Preset::Type)> process) {
const Preset::Type diff_dlg_type = diff_dialog.view_type();
if (diff_dlg_type == Preset::TYPE_INVALID) {
for (const Preset::Type& type : diff_dialog.types_list() )
process(type);
}
else
process(diff_dlg_type);
};
diff_dialog.Bind(EVT_DIFF_DIALOG_TRANSFER, [process_options, transfer](SimpleEvent&) { process_options(transfer); });
}
#ifdef __WIN32__
WXLRESULT MainFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
@ -3599,9 +3632,6 @@ void MainFrame::RunScript(wxString js)
void MainFrame::technology_changed()
{
// upadte DiffDlg
diff_dialog.update_presets();
// update menu titles
PrinterTechnology pt = plater()->printer_technology();
if (int id = m_menubar->FindMenu(pt == ptFFF ? _omitL("Material Settings") : _L("Filament Settings")); id != wxNOT_FOUND)