OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::DiffPresetDialog Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/UnsavedChangesDialog.hpp>

Inheritance diagram for Slic3r::GUI::DiffPresetDialog:
Collaboration diagram for Slic3r::GUI::DiffPresetDialog:

Classes

struct  DiffPresets

Public Member Functions

 DiffPresetDialog (MainFrame *mainframe)
 ~DiffPresetDialog () override=default
void show (Preset::Type type=Preset::TYPE_INVALID)
void update_presets (Preset::Type type=Preset::TYPE_INVALID)
Preset::Type view_type () const
PrinterTechnology printer_technology () const
std::string get_left_preset_name (Preset::Type type)
std::string get_right_preset_name (Preset::Type type)
std::vector< std::string > get_selected_options (Preset::Type type) const
std::array< Preset::Type, 3 > types_list () const
void on_dpi_changed (const wxRect &suggested_rect) override
void on_sys_color_changed () override
void EndModal (int retCode) override
float scale_factor () const
float prev_scale_factor () const
void set_scale_factor (float v)
void set_prev_scale_factor (float v)
void set_em_unit (int v)
bool force_rescale () const
int em_unit () const
const wxFont & normal_font () const
void enable_force_rescale ()
int ShowModal ()

Static Public Member Functions

static DiffPresetDialog * if_built ()
static DiffPresetDialog * ensure ()
static void when_built (std::function< void(DiffPresetDialog &)> fn)

Private Member Functions

void create_buttons ()
void create_edit_sizer ()
void complete_dialog_creation ()
void create_presets_sizer ()
void create_info_lines ()
void create_tree ()
void create_show_all_presets_chb ()
void update_bottom_info (wxString bottom_info="")
void update_tree ()
void update_bundles_from_app ()
void update_controls_visibility (Preset::Type type=Preset::TYPE_INVALID)
void update_compatibility (const std::string &preset_name, Preset::Type type, PresetBundle *preset_bundle)
void button_event (Action act)
void update_em_unit ()
bool is_new_scale_factor () const
void rescale (const wxRect &suggested_rect)

Private Attributes

DiffViewCtrl * m_tree { nullptr }
wxBoxSizer * m_presets_sizer { nullptr }
wxStaticText * m_top_info_line { nullptr }
wxStaticText * m_bottom_info_line { nullptr }
wxCheckBox * m_show_all_presets { nullptr }
wxCheckBox * m_use_for_transfer { nullptr }
wxBoxSizer * m_buttons { nullptr }
wxBoxSizer * m_edit_sizer { nullptr }
Preset::Type m_view_type { Preset::TYPE_INVALID }
PrinterTechnology m_pr_technology
std::unique_ptr< PresetBundle > m_preset_bundle_left
std::unique_ptr< PresetBundle > m_preset_bundle_right
std::vector< DiffPresets > m_preset_combos
float m_scale_factor
int m_em_unit
wxFont m_normal_font
float m_prev_scale_factor
bool m_can_rescale
bool m_force_rescale
int m_new_font_point_size

Static Private Attributes

static Lazy< DiffPresetDialog > * s_lazy

Detailed Description


Class Documentation

◆ Slic3r::GUI::DiffPresetDialog::DiffPresets

struct Slic3r::GUI::DiffPresetDialog::DiffPresets
Collaboration diagram for Slic3r::GUI::DiffPresetDialog::DiffPresets:
Class Members
ScalableButton * equal_bmp { nullptr }
PresetComboBox * presets_left { nullptr }
PresetComboBox * presets_right { nullptr }

Constructor & Destructor Documentation

◆ DiffPresetDialog()

Slic3r::GUI::DiffPresetDialog::DiffPresetDialog ( MainFrame * mainframe)
1990 : DPIDialog(mainframe, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
1991 m_pr_technology(wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology())
1992{
1993#if defined(__WXMSW__)
1994 // ys_FIXME! temporary workaround for correct font scaling
1995 // Because of from wxWidgets 3.1.3 auto rescaling is implemented for the Fonts,
1996 // From the very beginning set dialog font to the wxSYS_DEFAULT_GUI_FONT
1997 this->SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
1998#endif // __WXMSW__
1999
2000 // Init bundles
2001
2002 assert(wxGetApp().preset_bundle);
2003
2004 // show() copies the app's bundle into both before anything is displayed.
2005 m_preset_bundle_left = std::make_unique<PresetBundle>();
2006 m_preset_bundle_right = std::make_unique<PresetBundle>();
2007
2008 // Create UI items
2009
2010 SetBackgroundColour(*wxWHITE);
2011
2013
2015
2017
2018 create_tree();
2019
2021
2023}
void create_presets_sizer()
Definition UnsavedChangesDialog.cpp:1793
std::unique_ptr< PresetBundle > m_preset_bundle_left
Definition UnsavedChangesDialog.hpp:448
void create_show_all_presets_chb()
Definition UnsavedChangesDialog.cpp:1839
PrinterTechnology m_pr_technology
Definition UnsavedChangesDialog.hpp:447
std::unique_ptr< PresetBundle > m_preset_bundle_right
Definition UnsavedChangesDialog.hpp:449
void create_tree()
Definition UnsavedChangesDialog.cpp:1866
void create_edit_sizer()
Definition UnsavedChangesDialog.cpp:1943
void create_info_lines()
Definition UnsavedChangesDialog.cpp:1855
void complete_dialog_creation()
Definition UnsavedChangesDialog.cpp:1971

References complete_dialog_creation(), create_edit_sizer(), create_info_lines(), create_presets_sizer(), create_show_all_presets_chb(), create_tree(), m_pr_technology, m_preset_bundle_left, m_preset_bundle_right, and printer_technology().

Here is the call graph for this function:

◆ ~DiffPresetDialog()

Slic3r::GUI::DiffPresetDialog::~DiffPresetDialog ( )
overridedefault

Member Function Documentation

◆ button_event()

void Slic3r::GUI::DiffPresetDialog::button_event ( Action act)
private
2322{
2323 Hide();
2324 if (act == Action::Transfer)
2325 wxPostEvent(this, SimpleEvent(EVT_DIFF_DIALOG_TRANSFER));
2326}
@ Transfer
Definition UnsavedChangesDialog.hpp:260

References Slic3r::GUI::Transfer.

Referenced by create_buttons().

Here is the caller graph for this function:

◆ complete_dialog_creation()

void Slic3r::GUI::DiffPresetDialog::complete_dialog_creation ( )
private
1972{
1973 wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
1974
1975 int border = 10;
1976 topSizer->Add(m_top_info_line, 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, 2 * border);
1977 topSizer->Add(m_presets_sizer, 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border);
1978 topSizer->Add(m_show_all_presets, 0, wxEXPAND | wxALL, border);
1979 topSizer->Add(m_tree, 1, wxEXPAND | wxALL, border);
1980 topSizer->Add(m_bottom_info_line, 0, wxEXPAND | wxALL, 2 * border);
1981 topSizer->Add(m_edit_sizer, 0, wxEXPAND);
1982
1983 this->SetMinSize(wxSize(80 * em_unit(), 30 * em_unit()));
1984 this->SetSizer(topSizer);
1985 topSizer->SetSizeHints(this);
1986 wxGetApp().UpdateDlgDarkUI(this);
1987}
int em_unit() const
Definition GUI_Utils.hpp:203
DiffViewCtrl * m_tree
Definition UnsavedChangesDialog.hpp:437
wxCheckBox * m_show_all_presets
Definition UnsavedChangesDialog.hpp:441
wxBoxSizer * m_edit_sizer
Definition UnsavedChangesDialog.hpp:444
wxBoxSizer * m_presets_sizer
Definition UnsavedChangesDialog.hpp:438
wxStaticText * m_top_info_line
Definition UnsavedChangesDialog.hpp:439
wxStaticText * m_bottom_info_line
Definition UnsavedChangesDialog.hpp:440

References Slic3r::GUI::DPIAware< wxDialog >::em_unit(), m_bottom_info_line, m_edit_sizer, m_presets_sizer, m_show_all_presets, m_top_info_line, and m_tree.

Referenced by DiffPresetDialog().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_buttons()

void Slic3r::GUI::DiffPresetDialog::create_buttons ( )
private
1883{
1884 m_buttons = new wxBoxSizer(wxHORIZONTAL);
1885
1886 auto show_in_bottom_info = [this](const wxString& ext_line, wxEvent* e = nullptr) {
1887 m_bottom_info_line->SetLabel(ext_line);
1888 m_bottom_info_line->Show(true);
1889 Layout();
1890 if (e) e->Skip();
1891 };
1892
1893 auto dlg_btns = new DialogButtons(this, {"OK", "Cancel"});
1894
1895 // Transfer
1896 auto transfer_btn = dlg_btns->GetOK();
1897 transfer_btn->SetLabel(L("Transfer"));
1898 transfer_btn->Bind(wxEVT_BUTTON, [this](wxEvent&) { button_event(Action::Transfer);});
1899
1900
1901 auto enable_transfer = [this](const Preset::Type& type) {
1902 const Preset& main_edited_preset = get_preset_collection(type, wxGetApp().preset_bundle)->get_edited_preset();
1903 if (main_edited_preset.is_dirty)
1904 return main_edited_preset.name == get_right_preset_name(type);
1905 return true;
1906 };
1907 transfer_btn->Bind(wxEVT_UPDATE_UI, [this, enable_transfer, show_in_bottom_info, transfer_btn](wxUpdateUIEvent& evt) {
1908 bool enable = m_tree->has_selection();
1909 if (enable) {
1911 for (const Preset::Type& type : types_list())
1912 if (!enable_transfer(type)) {
1913 enable = false;
1914 break;
1915 }
1916 }
1917 else
1918 enable = enable_transfer(m_view_type);
1919
1920 if (!enable && transfer_btn->IsShown()) {
1921 show_in_bottom_info(_L("You can only transfer to current active profile because it has been modified."));
1922 }
1923 }
1924 evt.Enable(enable);
1925 });
1926 transfer_btn->Bind(wxEVT_ENTER_WINDOW, [show_in_bottom_info](wxMouseEvent& e) {
1927 show_in_bottom_info(_L("Transfer the selected options from left preset to the right.\n"
1928 "Note: New modified presets will be selected in settings tabs after close this dialog."), &e); });
1929
1930 // Cancel
1931 auto cancel_btn = dlg_btns->GetCANCEL();
1932 cancel_btn->Bind(wxEVT_BUTTON, [this](wxEvent&) { button_event(Action::Discard);});
1933
1934 for (Button* btn : { transfer_btn, cancel_btn }) {
1935 btn->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent& e) { update_bottom_info(); Layout(); e.Skip(); });
1936 }
1937
1938 m_buttons->Add(dlg_btns, 1, wxEXPAND);
1939
1940 m_buttons->Show(false);
1941}
#define L(s)
Definition ExtrusionEntity.cpp:25
#define _L(s)
Definition OBJ.cpp:34
void update_bottom_info(wxString bottom_info="")
Definition UnsavedChangesDialog.cpp:2098
std::string get_right_preset_name(Preset::Type type)
Definition UnsavedChangesDialog.cpp:2336
wxBoxSizer * m_buttons
Definition UnsavedChangesDialog.hpp:443
std::array< Preset::Type, 3 > types_list() const
Definition UnsavedChangesDialog.cpp:1877
Preset::Type m_view_type
Definition UnsavedChangesDialog.hpp:446
void button_event(Action act)
Definition UnsavedChangesDialog.cpp:2321
Preset & get_edited_preset()
Definition Preset.hpp:756
std::string name
Definition Preset.hpp:288
Type
Definition Preset.hpp:244
@ TYPE_INVALID
Definition Preset.hpp:245
wxMouseEvent
Definition CameraPopup.cpp:47
@ Discard
Definition UnsavedChangesDialog.hpp:261
static PresetCollection * get_preset_collection(Preset::Type type, PresetBundle *preset_bundle=nullptr)
Definition UnsavedChangesDialog.cpp:1774
@ Preset
Definition calib.hpp:39

References _L, button_event(), Slic3r::GUI::Discard, Slic3r::PresetCollection::get_edited_preset(), Slic3r::GUI::get_preset_collection(), get_right_preset_name(), Slic3r::GUI::DialogButtons::GetCANCEL(), Slic3r::GUI::DialogButtons::GetOK(), Slic3r::Preset::is_dirty, L, m_bottom_info_line, m_buttons, m_tree, m_view_type, Slic3r::Preset::name, Slic3r::GUI::Transfer, Slic3r::Preset::TYPE_INVALID, types_list(), update_bottom_info(), and Slic3r::GUI::wxMouseEvent.

Referenced by create_edit_sizer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_edit_sizer()

void Slic3r::GUI::DiffPresetDialog::create_edit_sizer ( )
private
1944{
1945 // Add check box for the edit mode
1946 m_use_for_transfer = new wxCheckBox(this, wxID_ANY, _L("Transfer values from left to right"));
1947 m_use_for_transfer->SetToolTip(_L("If enabled, this dialog can be used for transfer selected values from left to right preset."));
1948 m_use_for_transfer->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent&) {
1949 bool use = m_use_for_transfer->GetValue();
1950 m_tree->GetColumn(DiffModel::colToggle)->SetHidden(!use);
1951 if (m_tree->IsShown()) {
1952 m_buttons->Show(use);
1953 Fit();
1954 Refresh();
1955 }
1956 else
1957 this->Layout();
1958 });
1959
1960 // Add Buttons
1962
1963 // Create and fill edit sizer
1964 m_edit_sizer = new wxBoxSizer(wxHORIZONTAL);
1965 m_edit_sizer->Add(m_use_for_transfer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 10);
1966 m_edit_sizer->AddSpacer(em_unit() * 10);
1967 m_edit_sizer->Add(m_buttons, 1, wxLEFT, 5);
1968 m_edit_sizer->Show(false);
1969}
@ colToggle
Definition UnsavedChangesDialog.hpp:161
wxCheckBox * m_use_for_transfer
Definition UnsavedChangesDialog.hpp:442
void create_buttons()
Definition UnsavedChangesDialog.cpp:1882

References _L, Slic3r::GUI::DiffModel::colToggle, create_buttons(), Slic3r::GUI::DPIAware< wxDialog >::em_unit(), m_buttons, m_edit_sizer, m_tree, and m_use_for_transfer.

Referenced by DiffPresetDialog().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_info_lines()

void Slic3r::GUI::DiffPresetDialog::create_info_lines ( )
private
1856{
1857 const wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Bold();
1858
1859 m_top_info_line = new wxStaticText(this, wxID_ANY, _L("Select presets to compare"));
1860 m_top_info_line->SetFont(font);
1861
1862 m_bottom_info_line = new wxStaticText(this, wxID_ANY, "");
1863 m_bottom_info_line->SetFont(font);
1864}
class WXDLLIMPEXP_FWD_CORE wxStaticText
Definition ProgressDialog.hpp:30

References _L, m_bottom_info_line, m_top_info_line, and wxStaticText.

Referenced by DiffPresetDialog().

Here is the caller graph for this function:

◆ create_presets_sizer()

void Slic3r::GUI::DiffPresetDialog::create_presets_sizer ( )
private
1794{
1795 m_presets_sizer = new wxBoxSizer(wxVERTICAL);
1796
1798 {
1799 const PresetCollection* collection = get_preset_collection(new_type);
1800 wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
1801 PresetComboBox* presets_left;
1802 PresetComboBox* presets_right;
1803 ScalableButton* equal_bmp = new ScalableButton(this, wxID_ANY, "equal");
1804
1805 auto add_preset_combobox = [collection, sizer, new_type, this](PresetComboBox** cb_, PresetBundle* preset_bundle) {
1806 *cb_ = new PresetComboBox(this, new_type, wxSize(em_unit() * 35, -1), preset_bundle);
1807 PresetComboBox* cb = (*cb_);
1808 cb->set_selection_changed_function([this, new_type, preset_bundle, cb](int selection) {
1810 std::string preset_name = Preset::remove_suffix_modified(cb->GetString(selection).ToUTF8().data());
1811 update_compatibility(preset_name, new_type, preset_bundle);
1812 }
1813 update_tree();
1814 });
1815 if (collection->get_selected_idx() != (size_t)-1)
1816 cb->update(collection->get_selected_preset().name);
1817
1818 sizer->Add(cb, 1);
1819 cb->Show(new_type == Preset::TYPE_PRINTER);
1820 };
1821 add_preset_combobox(&presets_left, m_preset_bundle_left.get());
1822 sizer->Add(equal_bmp, 0, wxRIGHT | wxLEFT | wxALIGN_CENTER_VERTICAL, 5);
1823 add_preset_combobox(&presets_right, m_preset_bundle_right.get());
1824 m_presets_sizer->Add(sizer, 1, wxTOP, 5);
1825 equal_bmp->Show(new_type == Preset::TYPE_PRINTER);
1826
1827 m_preset_combos.push_back({ presets_left, equal_bmp, presets_right });
1828
1829 equal_bmp->Bind(wxEVT_BUTTON, [presets_left, presets_right, this](wxEvent&) {
1830 std::string preset_name = get_selection(presets_left);
1831 presets_right->update(preset_name);
1833 update_compatibility(Preset::remove_suffix_modified(preset_name), presets_right->get_type(), m_preset_bundle_right.get());
1834 update_tree();
1835 });
1836 }
1837}
std::vector< DiffPresets > m_preset_combos
Definition UnsavedChangesDialog.hpp:474
void update_compatibility(const std::string &preset_name, Preset::Type type, PresetBundle *preset_bundle)
Definition UnsavedChangesDialog.cpp:2263
void update_tree()
Definition UnsavedChangesDialog.cpp:2106
static std::string remove_suffix_modified(const std::string &name)
Definition Preset.cpp:516
@ TYPE_SLA_PRINT
Definition Preset.hpp:247
@ TYPE_PRINTER
Definition Preset.hpp:250
@ TYPE_PRINT
Definition Preset.hpp:246
@ TYPE_SLA_MATERIAL
Definition Preset.hpp:249
@ TYPE_FILAMENT
Definition Preset.hpp:248
static const Selection & get_selection()
Definition GUI_Factories.cpp:415

References Slic3r::GUI::DPIAware< wxDialog >::em_unit(), Slic3r::GUI::get_preset_collection(), Slic3r::PresetCollection::get_selected_idx(), Slic3r::PresetCollection::get_selected_preset(), Slic3r::GUI::get_selection(), Slic3r::GUI::PresetComboBox::get_type(), ComboBox::GetString(), m_preset_bundle_left, m_preset_bundle_right, m_preset_combos, m_presets_sizer, m_view_type, Slic3r::Preset::name, Slic3r::Preset::remove_suffix_modified(), Slic3r::GUI::PresetComboBox::set_selection_changed_function(), Slic3r::Preset::TYPE_FILAMENT, Slic3r::Preset::TYPE_INVALID, Slic3r::Preset::TYPE_PRINT, Slic3r::Preset::TYPE_PRINTER, Slic3r::Preset::TYPE_SLA_MATERIAL, Slic3r::Preset::TYPE_SLA_PRINT, Slic3r::GUI::PresetComboBox::update(), update_compatibility(), and update_tree().

Referenced by DiffPresetDialog().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_show_all_presets_chb()

void Slic3r::GUI::DiffPresetDialog::create_show_all_presets_chb ( )
private
1840{
1841 m_show_all_presets = new wxCheckBox(this, wxID_ANY, _L("Show all presets (including incompatible)"));
1842 m_show_all_presets->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent&) {
1843 bool show_all = m_show_all_presets->GetValue();
1844 for (auto preset_combos : m_preset_combos) {
1845 if (preset_combos.presets_left->get_type() == Preset::TYPE_PRINTER)
1846 continue;
1847 preset_combos.presets_left->show_all(show_all);
1848 preset_combos.presets_right->show_all(show_all);
1849 }
1851 update_tree();
1852 });
1853}

References _L, m_preset_combos, m_show_all_presets, m_view_type, Slic3r::Preset::TYPE_INVALID, Slic3r::Preset::TYPE_PRINTER, and update_tree().

Referenced by DiffPresetDialog().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_tree()

void Slic3r::GUI::DiffPresetDialog::create_tree ( )
private
1867{
1868 m_tree = new DiffViewCtrl(this, wxSize(em_unit() * 65, em_unit() * 40));
1869 m_tree->AppendToggleColumn_(L"\u2714", DiffModel::colToggle, wxLinux ? 9 : 6);
1870 m_tree->AppendBmpTextColumn("", DiffModel::colIconText, 35);
1871 m_tree->AppendBmpTextColumn(_L("Left Preset Value"), DiffModel::colOldValue, 15);
1872 m_tree->AppendBmpTextColumn(_L("Right Preset Value"),DiffModel::colNewValue, 15);
1873 m_tree->Hide();
1874 m_tree->GetColumn(DiffModel::colToggle)->SetHidden(true);
1875}
#define wxLinux
Definition UnsavedChangesDialog.cpp:71
@ colOldValue
Definition UnsavedChangesDialog.hpp:163
@ colIconText
Definition UnsavedChangesDialog.hpp:162
@ colNewValue
Definition UnsavedChangesDialog.hpp:164

References _L, Slic3r::GUI::DiffModel::colIconText, Slic3r::GUI::DiffModel::colNewValue, Slic3r::GUI::DiffModel::colOldValue, Slic3r::GUI::DiffModel::colToggle, Slic3r::GUI::DPIAware< wxDialog >::em_unit(), L, m_tree, and wxLinux.

Referenced by DiffPresetDialog().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ em_unit()

int Slic3r::GUI::DPIAware< wxDialog >::em_unit ( ) const
inlineinherited
203{ return m_em_unit; }
Definition GUI_Utils.hpp:107

Referenced by Slic3r::GUI::AuxiliaryDialog::AuxiliaryDialog(), Slic3r::GUI::CopyrightsDialog::CopyrightsDialog(), Slic3r::GUI::DesignTextDialog::DesignTextDialog(), Slic3r::GUI::EditGCodeDialog::EditGCodeDialog(), Slic3r::GUI::FileArchiveDialog::FileArchiveDialog(), Slic3r::GUI::MsgNoUpdates::MsgNoUpdates(), Slic3r::GUI::MsgUpdateForced::MsgUpdateForced(), Slic3r::GUI::OAuthDialog::OAuthDialog(), Slic3r::GUI::ParamsDialog::ParamsDialog(), Slic3r::GUI::PhysicalPrinterDialog::PhysicalPrinterDialog(), Slic3r::GUI::SettingsDialog::SettingsDialog(), anonymous_namespace{3DPrinterOS.cpp}::TokenAuthDialog::TokenAuthDialog(), anonymous_namespace{3DPrinterOS.cpp}::UploadOptionsDialog::UploadOptionsDialog(), Slic3r::GUI::PublishSettingsDialog::add_row_ui(), Slic3r::GUI::DiffPresetDialog::complete_dialog_creation(), Slic3r::GUI::DiffPresetDialog::create_edit_sizer(), Slic3r::GUI::DiffPresetDialog::create_presets_sizer(), Slic3r::GUI::DiffPresetDialog::create_tree(), Slic3r::GUI::ElegooPrintHostSendDialog::init(), Slic3r::GUI::FlashforgePrintHostSendDialog::init(), Slic3r::GUI::PrintHostSendDialog::init(), Slic3r::GUI::AboutDialog::on_dpi_changed(), Slic3r::GUI::AuxiliaryDialog::on_dpi_changed(), Slic3r::GUI::BedShapeDialog::on_dpi_changed(), Slic3r::GUI::ConfigWizard::on_dpi_changed(), Slic3r::GUI::CopyrightsDialog::on_dpi_changed(), Slic3r::GUI::DiffPresetDialog::on_dpi_changed(), Slic3r::GUI::EditGCodeDialog::on_dpi_changed(), Slic3r::GUI::FileArchiveDialog::on_dpi_changed(), Slic3r::GUI::OAuthDialog::on_dpi_changed(), Slic3r::GUI::ObjectTableDialog::on_dpi_changed(), Slic3r::GUI::ParamsDialog::on_dpi_changed(), Slic3r::GUI::PhysicalPrinterDialog::on_dpi_changed(), Slic3r::GUI::PrintHostQueueDialog::on_dpi_changed(), Slic3r::GUI::PurgeModeDialog::on_dpi_changed(), Slic3r::GUI::SavePresetDialog::on_dpi_changed(), Slic3r::GUI::SendSystemInfoDialog::on_dpi_changed(), Slic3r::GUI::SettingsDialog::on_dpi_changed(), and Slic3r::GUI::UnsavedChangesDialog::on_dpi_changed().

Here is the caller graph for this function:

◆ enable_force_rescale()

void Slic3r::GUI::DPIAware< wxDialog >::enable_force_rescale ( )
inlineinherited
206{ m_force_rescale = true; }

◆ EndModal()

void Slic3r::GUI::DPIDialog::EndModal ( int retCode)
inlineoverrideinherited
306 {
307 if (!dialogStack.empty() && dialogStack.front() != this) {
308 // This is a bug in wxWidgets
309 // when the dialog is not top modal dialog, EndModal() just hide dialog without quit
310 // the modal event loop. And the modal event loop blocks us from bottom widgets.
311 // Solution: let user click it manually or close outside. FIXME
312 BOOST_LOG_TRIVIAL(warning) << "DPIAware::EndModal Error: dialogStack is not empty, but top dialog is not this one. retCode=" << retCode;
313 return;
314 }
315
316 return wxDialog::EndModal(retCode);
317 }
std::deque< wxDialog * > dialogStack
Definition GUI_Utils.cpp:549

References Slic3r::GUI::dialogStack.

Referenced by Slic3r::GUI::CloneDialog::CloneDialog(), Slic3r::GUI::ConfigWizard::ConfigWizard(), Slic3r::GUI::CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(), Slic3r::GUI::DeleteConfirmDialog::DeleteConfirmDialog(), Slic3r::GUI::DesignVariableDialog::DesignVariableDialog(), Slic3r::GUI::anonymous_namespace{PrintHostDialogs.cpp}::FlashforgeSlotDialog::FlashforgeSlotDialog(), Slic3r::GUI::GuideFrame::GuideFrame(), Slic3r::GUI::InputIpAddressDialog::InputIpAddressDialog(), Slic3r::GUI::ManualNozzleCountDialog::ManualNozzleCountDialog(), Slic3r::GUI::MsgUpdateConfig::MsgUpdateConfig(), Slic3r::GUI::MsgUpdateForced::MsgUpdateForced(), Slic3r::GUI::MultiChoiceDialog::MultiChoiceDialog(), Slic3r::GUI::NetworkErrorDialog::NetworkErrorDialog(), Slic3r::GUI::NetworkPluginRestartDialog::NetworkPluginRestartDialog(), Slic3r::GUI::PartSkipConfirmDialog::PartSkipConfirmDialog(), Slic3r::GUI::PhysicalPrinterDialog::PhysicalPrinterDialog(), Slic3r::GUI::PlateNameEditDialog::PlateNameEditDialog(), Slic3r::GUI::PlateSettingsDialog::PlateSettingsDialog(), Slic3r::GUI::PublishSettingsDialog::PublishSettingsDialog(), Slic3r::GUI::SelectMachineDialog::SelectMachineDialog(), Slic3r::GUI::SendFailedConfirm::SendFailedConfirm(), Slic3r::GUI::SendSystemInfoDialog::SendSystemInfoDialog(), Slic3r::GUI::ShortcutCaptureDialog::ShortcutCaptureDialog(), Slic3r::GUI::SingleChoiceDialog::SingleChoiceDialog(), StepMeshDialog::StepMeshDialog(), Slic3r::GUI::SyncAmsInfoDialog::SyncAmsInfoDialog(), anonymous_namespace{3DPrinterOS.cpp}::TokenAuthDialog::TokenAuthDialog(), Slic3r::GUI::UpdatePluginDialog::UpdatePluginDialog(), Slic3r::GUI::UpdateVersionDialog::UpdateVersionDialog(), Slic3r::GUI::wgtDeviceNozzleRackUpgradeDlg::wgtDeviceNozzleRackUpgradeDlg(), Slic3r::GUI::SavePresetDialog::accept(), Slic3r::GUI::MsgDialog::add_button(), Slic3r::GUI::TipsDialog::add_button(), Slic3r::GUI::FilamentPickerDialog::BindEvents(), Slic3r::GUI::PluginPickerDialog::build_capability_ui(), Slic3r::GUI::BedShapeDialog::build_dialog(), Slic3r::GUI::PluginPickerDialog::build_ui(), Slic3r::GUI::UnsavedChangesDialog::close(), Slic3r::GUI::FileArchiveDialog::create_btn_sizer(), Slic3r::GUI::ColorDecomposeDialog::create_button_panel(), Slic3r::GUI::MixedFilamentDialog::create_button_panel(), Slic3r::GUI::CreateFilamentPresetDialog::create_dialog_buttons(), Slic3r::GUI::CreatePresetForPrinterDialog::create_dialog_buttons(), Slic3r::GUI::EditFilamentPresetDialog::create_dialog_buttons(), Slic3r::GUI::ExportConfigsDialog::create_dialog_buttons(), Slic3r::GUI::PreferencesDialog::create_item_language_combobox(), Slic3r::GUI::PreferencesDialog::create_item_region_combobox(), Slic3r::GUI::PreferencesDialog::create_items(), Slic3r::GUI::CreatePrinterPresetDialog::create_page1_dialog_buttons(), Slic3r::GUI::CreatePrinterPresetDialog::create_page2_dialog_buttons(), Slic3r::GUI::ExportConfigsDialog::data_init(), Slic3r::GUI::WebDialog::destroy_silently(), Slic3r::GUI::EditFilamentPresetDialog::edit_preset(), Slic3r::GUI::ConnectPrinterDialog::end_modal(), Slic3r::GUI::PrintHostSendDialog::EndModal(), Slic3r::GUI::ColorPickerDialog::finish(), Slic3r::GUI::WebDialog::finish(), Slic3r::GUI::Newer3mfVersionDialog::get_btn_sizer(), Slic3r::GUI::ScoreDialog::get_button_sizer(), Slic3r::GUI::WebViewHostDialog::handle_common_script_command(), Slic3r::GUI::ExportPresetBundleDialog::InitExportData(), Slic3r::GUI::SelectMachineDialog::navigate_to_timelapse_page(), Slic3r::GUI::BindMachineDialog::on_bind_success(), Slic3r::GUI::ConnectPrinterDialog::on_button_confirm(), Slic3r::GUI::RecenterDialog::on_button_confirm(), Slic3r::GUI::BindMachineDialog::on_cancel(), Slic3r::GUI::EditCalibrationHistoryDialog::on_cancel(), Slic3r::GUI::InputIpAddressDialog::on_cancel(), Slic3r::GUI::NewCalibrationHistoryDialog::on_cancel(), Slic3r::GUI::OAuthDialog::on_cancel(), Slic3r::GUI::PingCodeBindDialog::on_cancel(), Slic3r::GUI::SelectMachineDialog::on_cancel(), Slic3r::GUI::SendToPrinterDialog::on_cancel(), Slic3r::GUI::SyncAmsInfoDialog::on_cancel(), Slic3r::GUI::UnBindMachineDialog::on_cancel(), Slic3r::GUI::WebDialog::on_close_window(), Slic3r::GUI::NetworkPluginDownloadDialog::on_dont_ask(), Slic3r::GUI::NetworkPluginDownloadDialog::on_download(), Slic3r::GUI::EditDevNameDialog::on_edit_name(), Slic3r::GUI::ConfirmBeforeSendDialog::on_hide(), Slic3r::GUI::PrivacyUpdateDialog::on_hide(), Slic3r::GUI::ShortcutCaptureDialog::on_key(), Slic3r::GUI::TextureImportDialog::on_ok_clicked(), Slic3r::GUI::FileArchiveDialog::on_open_button(), Slic3r::GUI::NetworkPluginDownloadDialog::on_remind_later(), Slic3r::GUI::ProjectDropDialog::on_select_cancel(), Slic3r::GUI::SavePresetDialog::on_select_cancel(), Slic3r::GUI::ProjectDropDialog::on_select_ok(), Slic3r::GUI::SendMultiMachinePage::on_send(), Slic3r::GUI::NetworkPluginDownloadDialog::on_skip(), Slic3r::GUI::TextureImportDialog::on_skip_clicked(), Slic3r::GUI::NetworkPluginDownloadDialog::on_skip_version(), Slic3r::GUI::Cornering_Test_Dlg::on_start(), Slic3r::GUI::FlowRateCalibrationDialog::on_start(), Slic3r::GUI::Input_Shaping_Damp_Test_Dlg::on_start(), Slic3r::GUI::Input_Shaping_Freq_Test_Dlg::on_start(), Slic3r::GUI::MaxVolumetricSpeed_Test_Dlg::on_start(), Slic3r::GUI::PA_Calibration_Dlg::on_start(), Slic3r::GUI::Retraction_Test_Dlg::on_start(), Slic3r::GUI::Temp_Calibration_Dlg::on_start(), Slic3r::GUI::VFA_Test_Dlg::on_start(), Slic3r::GUI::CalibrationDialog::on_start_calibration(), Slic3r::GUI::UnBindMachineDialog::on_unbind_printer(), Slic3r::GUI::PartSkipDialog::OnApplyDialog(), anonymous_namespace{3DPrinterOS.cpp}::TokenAuthDialog::OnCancel(), Slic3r::GUI::AboutDialog::onCloseDialog(), Slic3r::GUI::CopyrightsDialog::onCloseDialog(), Slic3r::GUI::MultiNozzleSyncDialog::OnRackStatusReadingFinished(), Slic3r::GUI::GuideFrame::OnScriptMessage(), Slic3r::GUI::InputIpAddressDialog::OnTimer(), Slic3r::GUI::KBShortcutsDialog::open_mouse_preferences(), Slic3r::GUI::TroubleshootDialog::PackAll(), Slic3r::GUI::TroubleshootDialog::RebuildSystemProfiles(), Slic3r::GUI::SpeedDialWebDialog::run_action(), Slic3r::GUI::OAuthDialog::Show(), Slic3r::GUI::MultiNozzleSyncDialog::UpdateButton(), and Slic3r::GUI::CreatePrinterPresetDialog::validate_input_valid().

◆ ensure()

DiffPresetDialog * Slic3r::GUI::LazyInstance< DiffPresetDialog >::ensure ( )
inlinestaticinherited
186{ return s_lazy ? s_lazy->ensure() : nullptr; }
Definition Lazy.hpp:180
static Self * ensure()
Definition Lazy.hpp:186

Referenced by Slic3r::GUI::ParamsPanel::ParamsPanel(), and Slic3r::GUI::Tab::compare_preset().

Here is the caller graph for this function:

◆ force_rescale()

bool Slic3r::GUI::DPIAware< wxDialog >::force_rescale ( ) const
inlineinherited
201{ return m_force_rescale; }

◆ get_left_preset_name()

std::string Slic3r::GUI::DiffPresetDialog::get_left_preset_name ( Preset::Type type)
2329{
2330 PresetComboBox* cb = std::find_if(m_preset_combos.begin(), m_preset_combos.end(), [type](const DiffPresets& p) {
2331 return p.presets_left->get_type() == type;
2332 })->presets_left;
2334}
Definition UnsavedChangesDialog.hpp:468

References Slic3r::GUI::get_selection(), m_preset_combos, and Slic3r::Preset::remove_suffix_modified().

Referenced by update_tree().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_right_preset_name()

std::string Slic3r::GUI::DiffPresetDialog::get_right_preset_name ( Preset::Type type)
2337{
2338 PresetComboBox* cb = std::find_if(m_preset_combos.begin(), m_preset_combos.end(), [type](const DiffPresets& p) {
2339 return p.presets_right->get_type() == type;
2340 })->presets_right;
2342}

References Slic3r::GUI::get_selection(), m_preset_combos, and Slic3r::Preset::remove_suffix_modified().

Referenced by create_buttons(), and update_tree().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_selected_options()

std::vector< std::string > Slic3r::GUI::DiffPresetDialog::get_selected_options ( Preset::Type type) const
inline
489{ return m_tree->options(type, true); }

References m_tree.

◆ if_built()

DiffPresetDialog * Slic3r::GUI::LazyInstance< DiffPresetDialog >::if_built ( )
inlinestaticinherited
183{ return s_lazy ? s_lazy->get() : nullptr; }

Referenced by Slic3r::GUI::MainFrame::on_sys_color_changed(), and Slic3r::GUI::Tab::save_preset().

Here is the caller graph for this function:

◆ is_new_scale_factor()

bool Slic3r::GUI::DPIAware< wxDialog >::is_new_scale_factor ( ) const
inlineprivateinherited
262{ return fabs(m_scale_factor - m_prev_scale_factor) > 0.001; }

◆ normal_font()

◆ on_dpi_changed()

void Slic3r::GUI::DiffPresetDialog::on_dpi_changed ( const wxRect & suggested_rect)
overridevirtual

Implements Slic3r::GUI::DPIAware< wxDialog >.

2226{
2227 int em = em_unit();
2228
2229 const wxSize& size = wxSize(80 * em, 30 * em);
2230 SetMinSize(size);
2231
2232 for (auto preset_combos : m_preset_combos) {
2233 preset_combos.presets_left->msw_rescale();
2234 preset_combos.equal_bmp->msw_rescale();
2235 preset_combos.presets_right->msw_rescale();
2236 }
2237
2238 m_tree->Rescale(em);
2239
2240 Fit();
2241 Refresh();
2242}

References Slic3r::GUI::DPIAware< wxDialog >::em_unit(), m_preset_combos, and m_tree.

Here is the call graph for this function:

◆ on_sys_color_changed()

void Slic3r::GUI::DiffPresetDialog::on_sys_color_changed ( )
overridevirtual

Reimplemented from Slic3r::GUI::DPIAware< wxDialog >.

2245{
2246#ifdef _WIN32
2247 wxGetApp().UpdateAllStaticTextDarkUI(this);
2248 wxGetApp().UpdateDarkUI(m_show_all_presets);
2249 wxGetApp().UpdateDVCDarkUI(m_tree);
2250#endif
2251
2252 for (auto preset_combos : m_preset_combos) {
2253 preset_combos.presets_left->msw_rescale();
2254 preset_combos.equal_bmp->msw_rescale();
2255 preset_combos.presets_right->msw_rescale();
2256 }
2257
2258 // msw_rescale updates just icons, so use it
2259 m_tree->Rescale();
2260 Refresh();
2261}

References m_preset_combos, m_show_all_presets, and m_tree.

◆ prev_scale_factor()

float Slic3r::GUI::DPIAware< wxDialog >::prev_scale_factor ( ) const
inlineinherited
196{ return m_prev_scale_factor; }

◆ printer_technology()

PrinterTechnology Slic3r::GUI::DiffPresetDialog::printer_technology ( ) const
inline
484{ return m_pr_technology; }

References m_pr_technology.

Referenced by DiffPresetDialog().

Here is the caller graph for this function:

◆ rescale()

void Slic3r::GUI::DPIAware< wxDialog >::rescale ( const wxRect & suggested_rect)
inlineprivateinherited
265 {
266 this->Freeze();
267
268 m_force_rescale = false;
269
270 // set normal application font as a current window font
271 m_normal_font = this->GetFont();
272
274
275 // rescale missed controls sizes and images
277
278 this->Layout();
279 this->Thaw();
280
281 // reset previous scale factor from current scale factor value
283 }
virtual void on_dpi_changed(const wxRect &suggested_rect)=0
void update_em_unit()
Definition GUI_Utils.hpp:249

◆ scale_factor()

float Slic3r::GUI::DPIAware< wxDialog >::scale_factor ( ) const
inlineinherited
195{ return m_scale_factor; }

◆ set_em_unit()

void Slic3r::GUI::DPIAware< wxDialog >::set_em_unit ( int v)
inlineinherited
200{ m_em_unit = v; }

◆ set_prev_scale_factor()

void Slic3r::GUI::DPIAware< wxDialog >::set_prev_scale_factor ( float v)
inlineinherited

◆ set_scale_factor()

void Slic3r::GUI::DPIAware< wxDialog >::set_scale_factor ( float v)
inlineinherited
198{ m_scale_factor = v; }

◆ show()

void Slic3r::GUI::DiffPresetDialog::show ( Preset::Type type = Preset::TYPE_INVALID)
2055{
2056 this->SetTitle(_L("Compare presets"));
2057 m_view_type = type;
2058
2061 if (type == Preset::TYPE_INVALID)
2062 Fit();
2063
2064 update_tree();
2065 wxGetApp().UpdateDlgDarkUI(this);
2066
2067 // if this dialog is shown it have to be Hide and show again to be placed on the very Top of windows
2068 if (IsShown())
2069 Hide();
2070 Show();
2071}
void update_controls_visibility(Preset::Type type=Preset::TYPE_INVALID)
Definition UnsavedChangesDialog.cpp:2025
void update_bundles_from_app()
Definition UnsavedChangesDialog.cpp:2046

References _L, m_view_type, Slic3r::Preset::TYPE_INVALID, update_bundles_from_app(), update_controls_visibility(), and update_tree().

Referenced by Slic3r::GUI::ParamsPanel::ParamsPanel(), and update_controls_visibility().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ShowModal()

◆ types_list()

std::array< Preset::Type, 3 > Slic3r::GUI::DiffPresetDialog::types_list ( ) const
1878{
1880}
static std::array< Preset::Type, 3 > types_list(PrinterTechnology pt)
Definition PresetBundle.hpp:694

References m_pr_technology, and Slic3r::PresetBundle::types_list().

Referenced by create_buttons().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_bottom_info()

void Slic3r::GUI::DiffPresetDialog::update_bottom_info ( wxString bottom_info = "")
private
2099{
2100 const bool show_bottom_info = !m_tree->IsShown();
2101 if (show_bottom_info)
2102 m_bottom_info_line->SetLabel(bottom_info);
2103 m_bottom_info_line->Show(show_bottom_info);
2104}

References m_bottom_info_line, and m_tree.

Referenced by create_buttons(), and update_tree().

Here is the caller graph for this function:

◆ update_bundles_from_app()

void Slic3r::GUI::DiffPresetDialog::update_bundles_from_app ( )
private
2047{
2048 *m_preset_bundle_left = *wxGetApp().preset_bundle;
2049 *m_preset_bundle_right = *wxGetApp().preset_bundle;
2050
2051 m_pr_technology = m_preset_bundle_left.get()->printers.get_edited_preset().printer_technology();
2052}

References m_pr_technology, m_preset_bundle_left, and m_preset_bundle_right.

Referenced by show(), and update_presets().

Here is the caller graph for this function:

◆ update_compatibility()

void Slic3r::GUI::DiffPresetDialog::update_compatibility ( const std::string & preset_name,
Preset::Type type,
PresetBundle * preset_bundle )
private
2264{
2265 PresetCollection* presets = get_preset_collection(type, preset_bundle);
2266
2267 bool print_tab = type == Preset::TYPE_PRINT || type == Preset::TYPE_SLA_PRINT;
2268 bool printer_tab = type == Preset::TYPE_PRINTER;
2269 bool technology_changed = false;
2270
2271 if (printer_tab) {
2272 const Preset& new_printer_preset = *presets->find_preset(preset_name, true);
2273 PrinterTechnology old_printer_technology = presets->get_selected_preset().printer_technology();
2274 PrinterTechnology new_printer_technology = new_printer_preset.printer_technology();
2275
2276 technology_changed = old_printer_technology != new_printer_technology;
2277 }
2278
2279 // select preset
2280 presets->select_preset_by_name(preset_name, false);
2281
2282 // Mark the print & filament enabled if they are compatible with the currently selected preset.
2283 // The following method should not discard changes of current print or filament presets on change of a printer profile,
2284 // if they are compatible with the current printer.
2285 auto update_compatible_type = [](bool technology_changed, bool on_page, bool show_incompatible_presets) {
2286 return technology_changed ? PresetSelectCompatibleType::Always :
2289 };
2290 if (print_tab || printer_tab)
2291 preset_bundle->update_compatible(
2292 update_compatible_type(technology_changed, print_tab, true),
2293 update_compatible_type(technology_changed, false, true));
2294
2295 bool is_left_presets = preset_bundle == m_preset_bundle_left.get();
2296 PrinterTechnology pr_tech = preset_bundle->printers.get_selected_preset().printer_technology();
2297
2298 // update preset comboboxes
2299 for (auto preset_combos : m_preset_combos)
2300 {
2301 PresetComboBox* cb = is_left_presets ? preset_combos.presets_left : preset_combos.presets_right;
2302 Preset::Type presets_type = cb->get_type();
2303 if ((print_tab && (
2304 (pr_tech == ptFFF && presets_type == Preset::TYPE_FILAMENT) ||
2305 (pr_tech == ptSLA && presets_type == Preset::TYPE_SLA_MATERIAL) )) ||
2306 (printer_tab && (
2307 (pr_tech == ptFFF && (presets_type == Preset::TYPE_PRINT || presets_type == Preset::TYPE_FILAMENT) ) ||
2308 (pr_tech == ptSLA && (presets_type == Preset::TYPE_SLA_PRINT || presets_type == Preset::TYPE_SLA_MATERIAL) )) ))
2309 cb->update();
2310 }
2311
2312 if (technology_changed &&
2313 m_preset_bundle_left.get()->printers.get_selected_preset().printer_technology() ==
2314 m_preset_bundle_right.get()->printers.get_selected_preset().printer_technology())
2315 {
2316 m_pr_technology = m_preset_bundle_left.get()->printers.get_edited_preset().printer_technology();
2318 }
2319}
PrinterTechnology
Definition Config.hpp:229
@ ptSLA
Definition Config.hpp:233
@ ptFFF
Definition Config.hpp:231
@ OnlyIfWasCompatible
Definition Preset.hpp:525
@ Always
Definition Preset.hpp:527
@ Never
Definition Preset.hpp:523

References Slic3r::Always, Slic3r::PresetCollection::find_preset(), Slic3r::GUI::get_preset_collection(), Slic3r::PresetCollection::get_selected_preset(), Slic3r::GUI::PresetComboBox::get_type(), m_pr_technology, m_preset_bundle_left, m_preset_bundle_right, m_preset_combos, Slic3r::Never, Slic3r::OnlyIfWasCompatible, Slic3r::Preset::printer_technology(), Slic3r::PresetBundle::printers, Slic3r::ptFFF, Slic3r::ptSLA, Slic3r::PresetCollection::select_preset_by_name(), Slic3r::Preset::TYPE_FILAMENT, Slic3r::Preset::TYPE_PRINT, Slic3r::Preset::TYPE_PRINTER, Slic3r::Preset::TYPE_SLA_MATERIAL, Slic3r::Preset::TYPE_SLA_PRINT, Slic3r::GUI::PresetComboBox::update(), Slic3r::PresetBundle::update_compatible(), and update_controls_visibility().

Referenced by create_presets_sizer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_controls_visibility()

void Slic3r::GUI::DiffPresetDialog::update_controls_visibility ( Preset::Type type = Preset::TYPE_INVALID)
private
2026{
2027 for (auto preset_combos : m_preset_combos) {
2028 Preset::Type cb_type = preset_combos.presets_left->get_type();
2029 bool show = type != Preset::TYPE_INVALID ? type == cb_type :
2030 cb_type == Preset::TYPE_PRINTER ? true :
2031 m_pr_technology == ptFFF ? cb_type == Preset::TYPE_PRINT || cb_type == Preset::TYPE_FILAMENT :
2032 cb_type == Preset::TYPE_SLA_PRINT || cb_type == Preset::TYPE_SLA_MATERIAL;
2033 preset_combos.presets_left->Show(show);
2034 preset_combos.equal_bmp->Show(show);
2035 preset_combos.presets_right->Show(show);
2036
2037 if (show) {
2038 preset_combos.presets_left->update_from_bundle();
2039 preset_combos.presets_right->update_from_bundle();
2040 }
2041 }
2042
2044}
void show(Preset::Type type=Preset::TYPE_INVALID)
Definition UnsavedChangesDialog.cpp:2054

References m_pr_technology, m_preset_combos, m_show_all_presets, Slic3r::ptFFF, show(), Slic3r::Preset::TYPE_FILAMENT, Slic3r::Preset::TYPE_INVALID, Slic3r::Preset::TYPE_PRINT, Slic3r::Preset::TYPE_PRINTER, Slic3r::Preset::TYPE_SLA_MATERIAL, and Slic3r::Preset::TYPE_SLA_PRINT.

Referenced by show(), update_compatibility(), and update_presets().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_em_unit()

void Slic3r::GUI::DPIAware< wxDialog >::update_em_unit ( )
inlineprivateinherited
250 {
251 // Linux specific issue : get_dpi_for_window(this) still doesn't responce to the Display's scale in new wxWidgets(3.1.3).
252 // So, calculate the m_em_unit value from the font size, as before
253#if !defined(__WXGTK__)
255#else
256 // initialize default width_unit according to the width of the one symbol ("m") of the currently active font of this window.
257 m_em_unit = std::max<size_t>(10, this->GetTextExtent("m").x - 1);
258#endif // __WXGTK__
259 }

◆ update_presets()

void Slic3r::GUI::DiffPresetDialog::update_presets ( Preset::Type type = Preset::TYPE_INVALID)
2074{
2077
2078 if (type == Preset::TYPE_INVALID)
2079 for (auto preset_combos : m_preset_combos) {
2080 if (preset_combos.presets_left->get_type() == Preset::TYPE_PRINTER) {
2081 preset_combos.presets_left->update_from_bundle ();
2082 preset_combos.presets_right->update_from_bundle();
2083 break;
2084 }
2085 }
2086 else
2087 for (auto preset_combos : m_preset_combos) {
2088 if (preset_combos.presets_left->get_type() == type) {
2089 preset_combos.presets_left->update();
2090 preset_combos.presets_right->update();
2091 break;
2092 }
2093 }
2094
2095 update_tree();
2096}

References m_preset_combos, Slic3r::Preset::TYPE_INVALID, Slic3r::Preset::TYPE_PRINTER, update_bundles_from_app(), update_controls_visibility(), and update_tree().

Referenced by Slic3r::GUI::Tab::save_preset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_tree()

void Slic3r::GUI::DiffPresetDialog::update_tree ( )
private
2107{
2108 Search::SettingsIndex& index = wxGetApp().sidebar().settings_index();
2109 index.sort_options_by_key();
2110
2111 m_tree->Clear();
2112 wxString bottom_info = "";
2113 bool show_tree = false;
2114
2115 for (auto preset_combos : m_preset_combos)
2116 {
2117 if (!preset_combos.presets_left->IsShown())
2118 continue;
2119 Preset::Type type = preset_combos.presets_left->get_type();
2120
2121 const PresetCollection* presets = get_preset_collection(type);
2122 const Preset* left_preset = presets->find_preset(get_selection(preset_combos.presets_left));
2123 const Preset* right_preset = presets->find_preset(get_selection(preset_combos.presets_right));
2124 if (!left_preset || !right_preset) {
2125 bottom_info = _L("One of the presets does not exist");
2126 preset_combos.equal_bmp->SetBitmap_(ScalableBitmap(this, "question"));
2127 preset_combos.equal_bmp->SetToolTip(bottom_info);
2128 continue;
2129 }
2130
2131 const DynamicPrintConfig& left_config = left_preset->config;
2132 const PrinterTechnology& left_pt = left_preset->printer_technology();
2133 const DynamicPrintConfig& right_congig = right_preset->config;
2134
2135 if (left_pt != right_preset->printer_technology()) {
2136 bottom_info = _L("Compared presets has different printer technology");
2137 preset_combos.equal_bmp->SetBitmap_(ScalableBitmap(this, "question"));
2138 preset_combos.equal_bmp->SetToolTip(bottom_info);
2139 continue;
2140 }
2141
2142 // Collect dirty options.
2143 const bool deep_compare = (type == Preset::TYPE_PRINTER ||
2145 auto dirty_options = type == Preset::TYPE_PRINTER && left_pt == ptFFF &&
2146 left_config.opt<ConfigOptionStrings>("extruder_colour")->values.size() < right_congig.opt<ConfigOptionStrings>("extruder_colour")->values.size() ?
2147 presets->dirty_options(right_preset, left_preset, deep_compare) :
2148 presets->dirty_options(left_preset, right_preset, deep_compare);
2149
2150 if (dirty_options.empty()) {
2151 //bottom_info = _L("Presets are the same");
2152 bottom_info = wxEmptyString;
2153 preset_combos.equal_bmp->SetBitmap_(ScalableBitmap(this, "equal"));
2154 preset_combos.equal_bmp->SetToolTip(bottom_info);
2155 continue;
2156 }
2157
2158 show_tree = true;
2159 preset_combos.equal_bmp->SetBitmap_(ScalableBitmap(this, "not_equal"));
2160 /*preset_combos.equal_bmp->SetToolTip(_L("Presets are different.\n"
2161 "Click this button to select the same preset for the right and left preset."));*/
2162
2163 preset_combos.equal_bmp->SetToolTip(wxEmptyString);
2164
2165 // TRN Header of a preset comparison: the two preset names.
2166 m_tree->model->AddPreset(type, format_wxstr(_L("\"%1%\" vs \"%2%\""), left_preset->name, right_preset->name), left_pt);
2167
2168 const std::map<wxString, std::string>& category_icon_map = wxGetApp().get_tab(type)->get_category_icon_map();
2169 auto get_category_icon = [&category_icon_map](const wxString& key) {
2170 auto it = category_icon_map.find(key);
2171 return it != category_icon_map.end() ? it->second : std::string();
2172 };
2173
2174 // process changes of extruders count
2175 if (type == Preset::TYPE_PRINTER && left_pt == ptFFF &&
2176 left_config.opt<ConfigOptionStrings>("extruder_colour")->values.size() != right_congig.opt<ConfigOptionStrings>("extruder_colour")->values.size()) {
2177 wxString local_label = _L("Extruder count");
2178 wxString left_val = from_u8((boost::format("%1%") % left_config.opt<ConfigOptionStrings>("extruder_colour")->values.size()).str());
2179 wxString right_val = from_u8((boost::format("%1%") % right_congig.opt<ConfigOptionStrings>("extruder_colour")->values.size()).str());
2180
2181 m_tree->Append("extruders_count", type, _L("General"), _L("Capabilities"), local_label, left_val, right_val,
2182 get_category_icon("Basic information"));
2183 }
2184
2185 for (const std::string& opt_key : dirty_options) {
2186 wxString left_val = get_string_value(opt_key, left_config);
2187 wxString right_val = get_string_value(opt_key, right_congig);
2188
2189 const std::string lookup_key = get_pure_opt_key(opt_key);
2190 Search::Option option = index.get_option(lookup_key, get_full_label(lookup_key, left_config), type);
2191 if (get_pure_opt_key(option.opt_key()) != lookup_key)
2192 option = index.get_option(opt_key, get_full_label(opt_key, left_config), type);
2193 if (get_pure_opt_key(option.opt_key()) != lookup_key) {
2194 // When the found option is not the requested one.
2195 // This can happen for dirty_options such as:
2196 // "default_print_profile", "printer_model", "printer_settings_id",
2197 // because they do not exist in the index.
2198 continue;
2199 }
2200 m_tree->Append(opt_key, type, option.category_local, option.group_local, option.label_local,
2201 left_val, right_val, get_category_icon(option.category));
2202 }
2203 }
2204
2205 bool tree_was_shown = m_tree->IsShown();
2206 m_tree->Show(show_tree);
2207
2209 m_edit_sizer->Show(show_tree && can_transfer_options);
2210 m_buttons->Show(m_edit_sizer->IsShown(size_t(0)) && m_use_for_transfer->GetValue());
2211
2212 update_bottom_info(bottom_info);
2213
2214 if (tree_was_shown == m_tree->IsShown())
2215 Layout();
2216 else {
2217 Fit();
2218 Refresh();
2219 }
2220
2221 // Revert sort of index back
2222 index.sort_options_by_label();
2223}
std::string get_left_preset_name(Preset::Type type)
Definition UnsavedChangesDialog.cpp:2328
wxString format_wxstr(const char *fmt, TArgs &&... args)
Definition format.hpp:22
wxString get_string_value(const std::string &opt_key, const DynamicPrintConfig &config)
Definition ConfigValueFormatter.cpp:73
std::string get_pure_opt_key(const std::string &opt_key)
Definition ConfigValueFormatter.cpp:24
wxString from_u8(const std::string &str)
Definition GUI.cpp:544
wxString get_full_label(const std::string &opt_key, const DynamicPrintConfig &config)
Definition ConfigValueFormatter.cpp:61

References _L, Slic3r::Search::Option::category, Slic3r::Search::Option::category_local, Slic3r::Preset::config, Slic3r::PresetCollection::dirty_options(), Slic3r::PresetCollection::find_preset(), Slic3r::GUI::format_wxstr(), Slic3r::GUI::from_u8(), Slic3r::GUI::get_full_label(), get_left_preset_name(), Slic3r::Search::SettingsIndex::get_option(), Slic3r::GUI::get_preset_collection(), Slic3r::GUI::get_pure_opt_key(), get_right_preset_name(), Slic3r::GUI::get_selection(), Slic3r::GUI::get_string_value(), Slic3r::Search::Option::group_local, Slic3r::Search::Option::label_local, m_buttons, m_edit_sizer, m_preset_combos, m_tree, m_use_for_transfer, m_view_type, Slic3r::Preset::name, Slic3r::DynamicConfig::opt(), Slic3r::Search::Option::opt_key(), Slic3r::Preset::printer_technology(), Slic3r::ptFFF, Slic3r::ConfigOptionVector< T >::size(), Slic3r::Search::SettingsIndex::sort_options_by_key(), Slic3r::Search::SettingsIndex::sort_options_by_label(), Slic3r::Preset::TYPE_FILAMENT, Slic3r::Preset::TYPE_INVALID, Slic3r::Preset::TYPE_PRINTER, Slic3r::Preset::TYPE_SLA_MATERIAL, update_bottom_info(), and Slic3r::ConfigOptionVector< T >::values.

Referenced by create_presets_sizer(), create_show_all_presets_chb(), show(), and update_presets().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ view_type()

Preset::Type Slic3r::GUI::DiffPresetDialog::view_type ( ) const
inline
483{ return m_view_type; }

References m_view_type.

◆ when_built()

void Slic3r::GUI::LazyInstance< DiffPresetDialog >::when_built ( std::function< void(DiffPresetDialog &)> fn)
inlinestaticinherited
189 {
190 if (s_lazy)
192 }
static void when_built(std::function< void(Self &)> fn)
Definition Lazy.hpp:188

Member Data Documentation

◆ m_bottom_info_line

wxStaticText* Slic3r::GUI::DiffPresetDialog::m_bottom_info_line { nullptr }
private

◆ m_buttons

wxBoxSizer* Slic3r::GUI::DiffPresetDialog::m_buttons { nullptr }
private
443{ nullptr };

Referenced by create_buttons(), create_edit_sizer(), and update_tree().

◆ m_can_rescale

bool Slic3r::GUI::DPIAware< wxDialog >::m_can_rescale
privateinherited
235{ true };

◆ m_edit_sizer

wxBoxSizer* Slic3r::GUI::DiffPresetDialog::m_edit_sizer { nullptr }
private
444{ nullptr };

Referenced by complete_dialog_creation(), create_edit_sizer(), and update_tree().

◆ m_em_unit

int Slic3r::GUI::DPIAware< wxDialog >::m_em_unit
privateinherited

◆ m_force_rescale

bool Slic3r::GUI::DPIAware< wxDialog >::m_force_rescale
privateinherited
236{ false };

◆ m_new_font_point_size

int Slic3r::GUI::DPIAware< wxDialog >::m_new_font_point_size
privateinherited

◆ m_normal_font

wxFont Slic3r::GUI::DPIAware< wxDialog >::m_normal_font
privateinherited

◆ m_pr_technology

◆ m_preset_bundle_left

std::unique_ptr<PresetBundle> Slic3r::GUI::DiffPresetDialog::m_preset_bundle_left
private

◆ m_preset_bundle_right

std::unique_ptr<PresetBundle> Slic3r::GUI::DiffPresetDialog::m_preset_bundle_right
private

◆ m_preset_combos

◆ m_presets_sizer

wxBoxSizer* Slic3r::GUI::DiffPresetDialog::m_presets_sizer { nullptr }
private
438{ nullptr };

Referenced by complete_dialog_creation(), and create_presets_sizer().

◆ m_prev_scale_factor

float Slic3r::GUI::DPIAware< wxDialog >::m_prev_scale_factor
privateinherited

◆ m_scale_factor

float Slic3r::GUI::DPIAware< wxDialog >::m_scale_factor
privateinherited

◆ m_show_all_presets

wxCheckBox* Slic3r::GUI::DiffPresetDialog::m_show_all_presets { nullptr }
private

◆ m_top_info_line

wxStaticText* Slic3r::GUI::DiffPresetDialog::m_top_info_line { nullptr }
private
439{ nullptr };

Referenced by complete_dialog_creation(), and create_info_lines().

◆ m_tree

◆ m_use_for_transfer

wxCheckBox* Slic3r::GUI::DiffPresetDialog::m_use_for_transfer { nullptr }
private
442{ nullptr };

Referenced by create_edit_sizer(), and update_tree().

◆ m_view_type

◆ s_lazy

Lazy<DiffPresetDialog>* Slic3r::GUI::LazyInstance< DiffPresetDialog >::s_lazy
inlinestaticprivateinherited
196{ nullptr };

The documentation for this class was generated from the following files: