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

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

Inheritance diagram for Slic3r::GUI::EditFilamentPresetDialog:
Collaboration diagram for Slic3r::GUI::EditFilamentPresetDialog:

Public Member Functions

 EditFilamentPresetDialog (wxWindow *parent, Filamentinformation *filament_info)
 ~EditFilamentPresetDialog ()
wxPanel * get_preset_tree_panel ()
std::shared_ptr< Preset > get_need_edit_preset ()
void set_printer_name (const std::string &printer_name)
void set_need_delete_preset_index (int need_delete_preset_index)
void set_need_edit_preset_index (int need_edit_preset_index)
void delete_preset ()
void edit_preset ()
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 ()

Protected Member Functions

virtual void on_sys_color_changed ()

Private Member Functions

void on_dpi_changed (const wxRect &suggested_rect) override
bool get_same_filament_id_presets (std::string filament_id)
void update_preset_tree ()
wxBoxSizer * create_filament_basic_info ()
wxBoxSizer * create_add_filament_btn ()
wxBoxSizer * create_preset_tree_sizer ()
wxWindow * create_dialog_buttons ()
void update_em_unit ()
bool is_new_scale_factor () const
void rescale (const wxRect &suggested_rect)

Private Attributes

PresetTree * m_preset_tree_creater = nullptr
std::string m_filament_id
std::string m_filament_name
std::string m_vendor_name
std::string m_filament_type
std::string m_filament_serial
Button * m_add_filament_btn = nullptr
wxBoxSizer * m_preset_tree_sizer = nullptr
wxPanel * m_preset_tree_panel = nullptr
wxScrolledWindow * m_preset_tree_window = nullptr
wxBoxSizer * m_main_sizer = nullptr
wxStaticText * m_note_text = nullptr
int m_need_delete_preset_index = -1
int m_need_edit_preset_index = -1
std::shared_ptr< Preset > m_need_edit_preset
std::string m_selected_printer = ""
std::unordered_map< std::string, std::vector< std::shared_ptr< Preset > > > m_printer_compatible_presets
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

Detailed Description

Constructor & Destructor Documentation

◆ EditFilamentPresetDialog()

Slic3r::GUI::EditFilamentPresetDialog::EditFilamentPresetDialog ( wxWindow * parent,
Filamentinformation * filament_info )
4505 : DPIDialog(parent ? parent : nullptr, wxID_ANY, _L("Edit Filament"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
4506 , m_filament_id("")
4507 , m_filament_name("")
4508 , m_vendor_name("")
4509 , m_filament_type("")
4510 , m_filament_serial("")
4511{
4512 m_preset_tree_creater = new PresetTree(this);
4513
4514 this->SetBackgroundColour(*wxWHITE);
4515 this->SetMinSize(wxSize(FromDIP(600), -1));
4516
4517 m_main_sizer = new wxBoxSizer(wxVERTICAL);
4518 // top line
4519 auto m_line_top = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL);
4520 m_line_top->SetBackgroundColour(wxColour(0xA6, 0xa9, 0xAA));
4521 m_main_sizer->Add(m_line_top, 0, wxEXPAND, 0);
4522 m_main_sizer->Add(0, 0, 0, wxTOP, FromDIP(5));
4523
4524 wxStaticText* basic_information = new wxStaticText(this, wxID_ANY, _L("Basic Information"));
4525 basic_information->SetFont(Label::Head_16);
4526
4527 m_main_sizer->Add(basic_information, 0, wxALL, FromDIP(10));
4528 m_filament_id = filament_info->filament_id;
4529 //std::string filament_name = filament_info->filament_name;
4530 bool get_filament_presets = get_same_filament_id_presets(m_filament_id);
4531 // get filament vendor, type, serial, and name
4532 if (get_filament_presets && !m_printer_compatible_presets.empty()) {
4533 std::shared_ptr<Preset> preset;
4534 for (std::pair<std::string, std::vector<std::shared_ptr<Preset>>> pair : m_printer_compatible_presets) {
4535 for (std::shared_ptr<Preset> fialment_preset : pair.second) {
4536 if (fialment_preset->inherits().empty()) {
4537 preset = fialment_preset;
4538 break;
4539 }
4540 }
4541 }
4542 if (!preset.get()) preset = m_printer_compatible_presets.begin()->second[0];
4543 m_filament_name = get_filament_name(preset->name);
4544 auto vendor_names = dynamic_cast<ConfigOptionStrings *>(preset->config.option("filament_vendor"));
4545 if (vendor_names && !vendor_names->values.empty()) m_vendor_name = vendor_names->values[0];
4546 auto filament_types = dynamic_cast<ConfigOptionStrings *>(preset->config.option("filament_type"));
4547 if (filament_types && !filament_types->values.empty()) m_filament_type = filament_types->values[0];
4548 std::string filament_type = m_filament_type == "PLA-AERO" ? "PLA Aero" : m_filament_type;
4549 size_t index = m_filament_name.find(filament_type);
4550 if (std::string::npos != index && index + filament_type.size() < m_filament_name.size()) {
4551 m_filament_serial = m_filament_name.substr(index + filament_type.size());
4552 if (m_filament_serial.size() > 2 && m_filament_serial[0] == ' ') {
4554 }
4555 }
4556 }
4557
4558 m_main_sizer->Add(create_filament_basic_info(), 0, wxEXPAND | wxALL, 0);
4559
4560 // divider line
4561 auto line_divider = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL);
4562 line_divider->SetBackgroundColour(wxColour(0xA6, 0xa9, 0xAA));
4563 m_main_sizer->Add(line_divider, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(10));
4564 m_main_sizer->Add(0, 0, 0, wxTOP, FromDIP(5));
4565
4566 wxStaticText *presets_information = new wxStaticText(this, wxID_ANY, _L("Filament presets under this filament"));
4567 presets_information->SetFont(Label::Head_16);
4568 m_main_sizer->Add(presets_information, 0, wxLEFT | wxRIGHT, FromDIP(10));
4569
4570 m_main_sizer->Add(create_add_filament_btn(), 0, wxEXPAND | wxALL, 0);
4571 m_main_sizer->Add(create_preset_tree_sizer(), 0, wxEXPAND | wxALL, 0);
4572 m_note_text = new wxStaticText(this, wxID_ANY, _L("Note: If the only preset under this filament is deleted, the filament will be deleted after exiting the dialog."));
4573 m_main_sizer->Add(m_note_text, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(10));
4574 m_note_text->Hide();
4575 m_main_sizer->Add(create_dialog_buttons(), 0, wxEXPAND);
4576
4578
4579 this->SetSizer(m_main_sizer);
4580 this->Layout();
4581 this->Fit();
4582 wxGetApp().UpdateDlgDarkUI(this);
4583}
#define _L(s)
Definition OBJ.cpp:34
class WXDLLIMPEXP_FWD_CORE wxStaticText
Definition ProgressDialog.hpp:30
static wxFont Head_16
Definition Label.hpp:43
std::string m_filament_id
Definition CreatePresetsDialog.hpp:386
wxBoxSizer * m_main_sizer
Definition CreatePresetsDialog.hpp:395
PresetTree * m_preset_tree_creater
Definition CreatePresetsDialog.hpp:385
bool get_same_filament_id_presets(std::string filament_id)
Definition CreatePresetsDialog.cpp:4590
std::string m_filament_serial
Definition CreatePresetsDialog.hpp:390
std::string m_filament_name
Definition CreatePresetsDialog.hpp:387
wxWindow * create_dialog_buttons()
Definition CreatePresetsDialog.cpp:4863
wxBoxSizer * create_add_filament_btn()
Definition CreatePresetsDialog.cpp:4820
std::string m_filament_type
Definition CreatePresetsDialog.hpp:389
std::unordered_map< std::string, std::vector< std::shared_ptr< Preset > > > m_printer_compatible_presets
Definition CreatePresetsDialog.hpp:401
wxBoxSizer * create_filament_basic_info()
Definition CreatePresetsDialog.cpp:4762
wxBoxSizer * create_preset_tree_sizer()
Definition CreatePresetsDialog.cpp:4841
std::string m_vendor_name
Definition CreatePresetsDialog.hpp:388
void update_preset_tree()
Definition CreatePresetsDialog.cpp:4613
wxStaticText * m_note_text
Definition CreatePresetsDialog.hpp:396
static const std::vector< std::string > filament_types
Definition CreatePresetsDialog.cpp:123
static std::string get_filament_name(std::string &preset_name)
Definition CreatePresetsDialog.cpp:427
zaa_minimize_perimeter_height filament_type((ConfigOptionBools, filament_soluble))((ConfigOptionStrings

References _L, create_add_filament_btn(), create_dialog_buttons(), create_filament_basic_info(), create_preset_tree_sizer(), Slic3r::GUI::Filamentinformation::filament_id, Slic3r::filament_type(), Slic3r::GUI::filament_types, Slic3r::GUI::get_filament_name(), get_same_filament_id_presets(), Label::Head_16, m_filament_id, m_filament_name, m_filament_serial, m_filament_type, m_main_sizer, m_note_text, m_preset_tree_creater, m_printer_compatible_presets, m_vendor_name, update_preset_tree(), and wxStaticText.

Here is the call graph for this function:

◆ ~EditFilamentPresetDialog()

Slic3r::GUI::EditFilamentPresetDialog::~EditFilamentPresetDialog ( )
4584{}

Member Function Documentation

◆ create_add_filament_btn()

wxBoxSizer * Slic3r::GUI::EditFilamentPresetDialog::create_add_filament_btn ( )
private
4821{
4822 wxBoxSizer *add_filament_btn_sizer = new wxBoxSizer(wxHORIZONTAL);
4823 m_add_filament_btn = new Button(this, _L("+ Add Preset"));
4825
4826 add_filament_btn_sizer->Add(m_add_filament_btn, 0, wxEXPAND | wxALL, FromDIP(10));
4827
4828 m_add_filament_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
4829 CreatePresetForPrinterDialog dlg(nullptr, m_filament_type, m_filament_id, m_vendor_name, m_filament_name);
4830 int res = dlg.ShowModal();
4831 if (res == wxID_OK) {
4834 }
4835 }
4836 });
4837
4838 return add_filament_btn_sizer;
4839}
@ Regular
Definition Button.hpp:24
@ Window
Definition Button.hpp:32
Button * m_add_filament_btn
Definition CreatePresetsDialog.hpp:391

References _L, get_same_filament_id_presets(), m_add_filament_btn, m_filament_id, m_filament_name, m_filament_type, m_vendor_name, Regular, Slic3r::GUI::DPIAware< P >::ShowModal(), update_preset_tree(), and Window.

Referenced by EditFilamentPresetDialog().

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

◆ create_dialog_buttons()

wxWindow * Slic3r::GUI::EditFilamentPresetDialog::create_dialog_buttons ( )
private
4864{
4865 auto dlg_btns = new DialogButtons(this, {"Delete", "OK"}, "", 1 /*left_aligned*/);
4866
4867 dlg_btns->GetFIRST()->Bind(wxEVT_BUTTON, ([this](wxCommandEvent &e) {
4868 WarningDialog dlg(this, _L("All the filament presets belong to this filament would be deleted.\n"
4869 "If you are using this filament on your printer, please reset the filament information for that slot."),
4870 _L("Delete filament"), wxYES | wxCANCEL | wxCANCEL_DEFAULT | wxCENTRE);
4871 int res = dlg.ShowModal();
4872 if (wxID_YES == res) {
4873 PresetBundle *preset_bundle = wxGetApp().preset_bundle;
4874 std::set<std::shared_ptr<Preset>> inherit_preset_names;
4875 std::set<std::shared_ptr<Preset>> root_preset_names;
4876 for (std::pair<std::string, std::vector<std::shared_ptr<Preset>>> printer_and_preset : m_printer_compatible_presets) {
4877 for (std::shared_ptr<Preset> preset : printer_and_preset.second) {
4878 if (preset->inherits().empty()) {
4879 root_preset_names.insert(preset);
4880 } else {
4881 inherit_preset_names.insert(preset);
4882 }
4883 }
4884 }
4885 // delete inherit preset first
4886 std::string next_selected_preset_name = wxGetApp().preset_bundle->filaments.get_selected_preset().name;
4887 for (std::shared_ptr<Preset> preset : inherit_preset_names) {
4888 bool delete_result = delete_filament_preset_by_name(preset->name, next_selected_preset_name);
4889 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " inherit filament name: " << preset->name << (delete_result ? " delete successful" : " delete failed");
4890 }
4891 for (std::shared_ptr<Preset> preset : root_preset_names) {
4892 bool delete_result = delete_filament_preset_by_name(preset->name, next_selected_preset_name);
4893 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " root filament name: " << preset->name << (delete_result ? " delete successful" : " delete failed");
4894 }
4896 wxGetApp().preset_bundle->filaments.select_preset_by_name(next_selected_preset_name,true);
4897
4898 for (size_t i = 0; i < wxGetApp().preset_bundle->filament_presets.size(); ++i) {
4899 auto preset = wxGetApp().preset_bundle->filaments.find_preset(wxGetApp().preset_bundle->filament_presets[i]);
4900 if (preset == nullptr) wxGetApp().preset_bundle->filament_presets[i] = wxGetApp().preset_bundle->filaments.get_selected_preset_name();
4901 }
4902 EndModal(wxID_OK);
4903 }
4904 e.Skip();
4905 }));
4906
4907 dlg_btns->GetOK()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { EndModal(wxID_OK); });
4908
4909 return dlg_btns;
4910}
void EndModal(int retCode) override
Definition GUI_Utils.hpp:305
static bool delete_filament_preset_by_name(std::string delete_preset_name, std::string &selected_preset_name)
Definition CreatePresetsDialog.cpp:277

References _L, Slic3r::GUI::delete_filament_preset_by_name(), Slic3r::GUI::DPIDialog::EndModal(), Slic3r::PresetBundle::filament_presets, Slic3r::PresetBundle::filaments, Slic3r::PresetCollection::get_selected_preset(), Slic3r::GUI::DialogButtons::GetFIRST(), m_printer_compatible_presets, Slic3r::Preset::name, and Slic3r::GUI::DPIAware< P >::ShowModal().

Referenced by EditFilamentPresetDialog().

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

◆ create_filament_basic_info()

wxBoxSizer * Slic3r::GUI::EditFilamentPresetDialog::create_filament_basic_info ( )
private
4763{
4764 wxBoxSizer *basic_info_sizer = new wxBoxSizer(wxVERTICAL);
4765
4766 wxBoxSizer *vendor_sizer = new wxBoxSizer(wxHORIZONTAL);
4767 wxBoxSizer *type_sizer = new wxBoxSizer(wxHORIZONTAL);
4768 wxBoxSizer *serial_sizer = new wxBoxSizer(wxHORIZONTAL);
4769
4770 //vendor
4771 wxBoxSizer * vendor_key_sizer = new wxBoxSizer(wxVERTICAL);
4772 wxStaticText *static_vendor_text = new wxStaticText(this, wxID_ANY, _L("Vendor"), wxDefaultPosition, wxDefaultSize);
4773 vendor_key_sizer->Add(static_vendor_text, 0, wxEXPAND | wxALL, 0);
4774 vendor_key_sizer->SetMinSize(OPTION_SIZE);
4775 vendor_sizer->Add(vendor_key_sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM, FromDIP(10));
4776
4777 wxBoxSizer *vendor_value_sizer = new wxBoxSizer(wxVERTICAL);
4778 wxStaticText *vendor_text = new wxStaticText(this, wxID_ANY, from_u8(m_vendor_name), wxDefaultPosition, wxDefaultSize);
4779 vendor_value_sizer->Add(vendor_text, 0, wxEXPAND | wxALL, 0);
4780 vendor_sizer->Add(vendor_value_sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM, FromDIP(10));
4781
4782 //type
4783 wxBoxSizer * type_key_sizer = new wxBoxSizer(wxVERTICAL);
4784 wxStaticText *static_type_text = new wxStaticText(this, wxID_ANY, _L("Type"), wxDefaultPosition, wxDefaultSize);
4785 type_key_sizer->Add(static_type_text, 0, wxEXPAND | wxALL, 0);
4786 type_key_sizer->SetMinSize(OPTION_SIZE);
4787 type_sizer->Add(type_key_sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM, FromDIP(10));
4788
4789 wxBoxSizer * type_value_sizer = new wxBoxSizer(wxVERTICAL);
4790 wxStaticText *type_text = new wxStaticText(this, wxID_ANY, from_u8(m_filament_type), wxDefaultPosition, wxDefaultSize);
4791 type_value_sizer->Add(type_text, 0, wxEXPAND | wxALL, 0);
4792 type_sizer->Add(type_value_sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM, FromDIP(10));
4793
4794 //serial
4795 wxBoxSizer * serial_key_sizer = new wxBoxSizer(wxVERTICAL);
4796 wxStaticText *static_serial_text = new wxStaticText(this, wxID_ANY, _L("Serial"), wxDefaultPosition, wxDefaultSize);
4797 serial_key_sizer->Add(static_serial_text, 0, wxEXPAND | wxALL, 0);
4798 serial_key_sizer->SetMinSize(OPTION_SIZE);
4799 serial_sizer->Add(serial_key_sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM, FromDIP(10));
4800
4801 wxBoxSizer * serial_value_sizer = new wxBoxSizer(wxVERTICAL);
4802 wxString full_filamnet_serial = from_u8(m_filament_serial);
4803 wxString show_filament_serial = full_filamnet_serial;
4804 if (m_filament_serial.size() > 40) {
4805 show_filament_serial = from_u8(m_filament_serial.substr(0, 20)) + "...";
4806 }
4807 wxStaticText *serial_text = new wxStaticText(this, wxID_ANY, show_filament_serial, wxDefaultPosition, wxDefaultSize);
4808 wxToolTip * toolTip = new wxToolTip(full_filamnet_serial);
4809 serial_text->SetToolTip(toolTip);
4810 serial_value_sizer->Add(serial_text, 0, wxEXPAND | wxALL, 0);
4811 serial_sizer->Add(serial_value_sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM, FromDIP(10));
4812
4813 basic_info_sizer->Add(vendor_sizer, 0, wxEXPAND | wxALL, 0);
4814 basic_info_sizer->Add(type_sizer, 0, wxEXPAND | wxALL, 0);
4815 basic_info_sizer->Add(serial_sizer, 0, wxEXPAND | wxALL, 0);
4816
4817 return basic_info_sizer;
4818}
#define OPTION_SIZE
Definition CreatePresetsDialog.cpp:80
wxString from_u8(const std::string &str)
Definition GUI.cpp:544

References _L, Slic3r::GUI::from_u8(), m_filament_serial, m_filament_type, m_vendor_name, OPTION_SIZE, and wxStaticText.

Referenced by EditFilamentPresetDialog().

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

◆ create_preset_tree_sizer()

wxBoxSizer * Slic3r::GUI::EditFilamentPresetDialog::create_preset_tree_sizer ( )
private
4842{
4843 wxBoxSizer *filament_preset_tree_sizer = new wxBoxSizer(wxHORIZONTAL);
4844 m_preset_tree_window = new wxScrolledWindow(this);
4845 m_preset_tree_window->SetScrollRate(5, FromDIP(20));
4846 m_preset_tree_window->SetBackgroundColour(PRINTER_LIST_COLOUR);
4847 m_preset_tree_window->SetMinSize(wxSize(-1, FromDIP(400)));
4848 m_preset_tree_window->SetMaxSize(wxSize(-1, FromDIP(300)));
4849 m_preset_tree_window->SetSize(wxSize(-1, FromDIP(300)));
4851 m_preset_tree_sizer = new wxBoxSizer(wxVERTICAL);
4853 m_preset_tree_panel->SetMinSize(wxSize(580, -1));
4854 m_preset_tree_panel->SetBackgroundColour(PRINTER_LIST_COLOUR);
4855 wxBoxSizer* m_preset_tree_window_sizer = new wxBoxSizer(wxVERTICAL);
4856 m_preset_tree_window_sizer->Add(m_preset_tree_panel, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(10));
4857 m_preset_tree_window->SetSizerAndFit(m_preset_tree_window_sizer);
4858 filament_preset_tree_sizer->Add(m_preset_tree_window, 0, wxEXPAND | wxALL, FromDIP(10));
4859
4860 return filament_preset_tree_sizer;
4861}
#define PRINTER_LIST_COLOUR
Definition CreatePresetsDialog.cpp:90
wxScrolledWindow * m_preset_tree_window
Definition CreatePresetsDialog.hpp:394
wxPanel * m_preset_tree_panel
Definition CreatePresetsDialog.hpp:393
wxBoxSizer * m_preset_tree_sizer
Definition CreatePresetsDialog.hpp:392

References m_preset_tree_panel, m_preset_tree_sizer, m_preset_tree_window, and PRINTER_LIST_COLOUR.

Referenced by EditFilamentPresetDialog().

Here is the caller graph for this function:

◆ delete_preset()

void Slic3r::GUI::EditFilamentPresetDialog::delete_preset ( )
4651{
4652 if (m_selected_printer.empty()) return;
4653 if (m_need_delete_preset_index < 0) return;
4654 std::unordered_map<std::string, std::vector<std::shared_ptr<Preset>>>::iterator iter = m_printer_compatible_presets.find(m_selected_printer);
4655 if (m_printer_compatible_presets.end() == iter) {
4656 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " can not find printer and printer name is: " << m_selected_printer;
4657 return;
4658 }
4659 std::vector<std::shared_ptr<Preset>>& filament_presets = iter->second;
4660 if (m_need_delete_preset_index >= filament_presets.size()) {
4661 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " index error and selected printer is: " << m_selected_printer << " and index: " << m_need_delete_preset_index;
4662 return;
4663 }
4664 std::shared_ptr<Preset> need_delete_preset = filament_presets[m_need_delete_preset_index];
4665 // is selecetd filament preset
4666 if (need_delete_preset->name == wxGetApp().preset_bundle->filaments.get_selected_preset_name()) {
4667 wxGetApp().get_tab(need_delete_preset->type)->delete_preset();
4668 // is preset exist? exist: not delete
4669 Preset *delete_preset = wxGetApp().preset_bundle->filaments.find_preset(need_delete_preset->name, false);
4670 if (delete_preset) {
4671 m_selected_printer.clear();
4673 return;
4674 }
4675 } else {
4676 Preset *filament_preset = wxGetApp().preset_bundle->filaments.find_preset(need_delete_preset->name);
4677
4678 // is root preset ?
4679 bool is_base_preset = false;
4680 if (filament_preset && wxGetApp().preset_bundle->filaments.get_preset_base(*filament_preset) == filament_preset) {
4681 is_base_preset = true;
4682 int count = 0;
4683 wxString presets;
4684 for (auto &preset2 : wxGetApp().preset_bundle->filaments)
4685 if (preset2.inherits() == filament_preset->name) {
4686 ++count;
4687 presets += "\n - " + from_u8(preset2.name);
4688 }
4689 wxString msg;
4690 if (count > 0) {
4691 msg = _L("Presets inherited by other presets cannot be deleted");
4692 msg += "\n";
4693 msg += _L_PLURAL("The following preset inherits this preset.", "The following presets inherit this preset.", count);
4694 wxString title = _L("Delete Preset");
4695 MessageDialog(this, msg + presets, title, wxOK | wxICON_ERROR).ShowModal();
4696 m_selected_printer.clear();
4698 return;
4699 }
4700 }
4701 wxString msg;
4702 if (is_base_preset) {
4703 msg = _L("Are you sure to delete the selected preset?\n"
4704 "If the preset corresponds to a filament currently in use on your printer, please reset the filament information for that slot.");
4705 } else {
4706 msg = _L("Are you sure to delete the selected preset?");
4707 }
4708 if (wxID_YES != MessageDialog(this, msg, _L("Delete preset"), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION).ShowModal()) {
4709 m_selected_printer.clear();
4711 return;
4712 }
4713
4714 // delete preset
4715 std::string next_selected_preset_name = wxGetApp().preset_bundle->filaments.get_selected_preset().name;
4716 bool delete_result = delete_filament_preset_by_name(need_delete_preset->name, next_selected_preset_name);
4717 BOOST_LOG_TRIVIAL(info) << __LINE__ << " filament preset name: " << need_delete_preset->name << (delete_result ? " delete successful" : " delete failed");
4718
4719 wxGetApp().preset_bundle->filaments.select_preset_by_name(next_selected_preset_name, true);
4720 for (size_t i = 0; i < wxGetApp().preset_bundle->filament_presets.size(); ++i) {
4721 auto preset = wxGetApp().preset_bundle->filaments.find_preset(wxGetApp().preset_bundle->filament_presets[i]);
4722 if (preset == nullptr) wxGetApp().preset_bundle->filament_presets[i] = wxGetApp().preset_bundle->filaments.get_selected_preset_name();
4723 }
4724 }
4725
4726 // remove preset shared_ptr from m_printer_compatible_presets
4727 int last_index = filament_presets.size() - 1;
4728 if (m_need_delete_preset_index != last_index) {
4729 std::swap(filament_presets[m_need_delete_preset_index], filament_presets[last_index]);
4730 }
4731 filament_presets.pop_back();
4732 if (filament_presets.empty()) m_printer_compatible_presets.erase(iter);
4733
4735
4736 m_selected_printer.clear();
4738}
static unsigned int count
Definition AuxiliaryDataViewModel.cpp:246
int ShowModal()
Definition GUI_Utils.hpp:216
int m_need_delete_preset_index
Definition CreatePresetsDialog.hpp:397
void delete_preset()
Definition CreatePresetsDialog.cpp:4650
std::string m_selected_printer
Definition CreatePresetsDialog.hpp:400
@ Preset
Definition calib.hpp:39
#define _L_PLURAL(s, plural, n)
Definition I18N.hpp:96

References _L, _L_PLURAL, count, Slic3r::GUI::delete_filament_preset_by_name(), delete_preset(), Slic3r::GUI::from_u8(), m_need_delete_preset_index, m_printer_compatible_presets, m_selected_printer, Slic3r::Preset::name, Slic3r::GUI::DPIAware< P >::ShowModal(), Slic3r::GUI::DPIAware< wxDialog >::ShowModal(), and update_preset_tree().

Referenced by delete_preset().

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

◆ edit_preset()

void Slic3r::GUI::EditFilamentPresetDialog::edit_preset ( )
4741{
4742 if (m_selected_printer.empty()) return;
4743 if (m_need_edit_preset_index < 0) return;
4744 std::unordered_map<std::string, std::vector<std::shared_ptr<Preset>>>::iterator iter = m_printer_compatible_presets.find(m_selected_printer);
4745 if (m_printer_compatible_presets.end() == iter) {
4746 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " can not find printer and printer name is: " << m_selected_printer;
4747 return;
4748 }
4749 std::vector<std::shared_ptr<Preset>> &filament_presets = iter->second;
4750 if (m_need_edit_preset_index >= filament_presets.size()) {
4751 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " index error and selected printer is: " << m_selected_printer << " and index: " << m_need_edit_preset_index;
4752 return;
4753 }
4754
4755 // edit preset
4756 m_need_edit_preset = filament_presets[m_need_edit_preset_index];
4757 wxGetApp().params_dialog()->set_editing_filament_id(m_filament_id);
4758
4759 EndModal(wxID_EDIT);
4760}
int m_need_edit_preset_index
Definition CreatePresetsDialog.hpp:398
std::shared_ptr< Preset > m_need_edit_preset
Definition CreatePresetsDialog.hpp:399

References Slic3r::GUI::DPIDialog::EndModal(), m_filament_id, m_need_edit_preset, m_need_edit_preset_index, m_printer_compatible_presets, and m_selected_printer.

Here is the call 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().

◆ force_rescale()

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

◆ get_need_edit_preset()

std::shared_ptr< Preset > Slic3r::GUI::EditFilamentPresetDialog::get_need_edit_preset ( )
inline
368{ return m_need_edit_preset; }

References m_need_edit_preset.

Referenced by Slic3r::GUI::Plater::priv::on_modify_filament().

Here is the caller graph for this function:

◆ get_preset_tree_panel()

wxPanel * Slic3r::GUI::EditFilamentPresetDialog::get_preset_tree_panel ( )
inline
367{ return m_preset_tree_panel; }

References m_preset_tree_panel.

◆ get_same_filament_id_presets()

bool Slic3r::GUI::EditFilamentPresetDialog::get_same_filament_id_presets ( std::string filament_id)
private
4591{
4592 PresetBundle *preset_bundle = wxGetApp().preset_bundle;
4593 const std::deque<Preset> &filament_presets = preset_bundle->filaments.get_presets();
4594
4596 for (Preset const &preset : filament_presets) {
4597 if (preset.is_system || preset.filament_id != filament_id) continue;
4598 std::shared_ptr<Preset> new_preset = std::make_shared<Preset>(preset);
4599 std::vector<std::string> printers;
4600 get_filament_compatible_printer(new_preset.get(), printers);
4601 for (const std::string &printer_name : printers) {
4602 m_printer_compatible_presets[printer_name].push_back(new_preset);
4603 }
4604 }
4605 if (m_printer_compatible_presets.empty()) {
4606 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " no filament presets ";
4607 return false;
4608 }
4609
4610 return true;
4611}
static void get_filament_compatible_printer(Preset *preset, std::vector< std::string > &printers)
Definition CreatePresetsDialog.cpp:351

References Slic3r::PresetBundle::filaments, Slic3r::GUI::get_filament_compatible_printer(), Slic3r::PresetCollection::get_presets(), and m_printer_compatible_presets.

Referenced by EditFilamentPresetDialog(), and create_add_filament_btn().

Here is the call graph for this function:
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::EditFilamentPresetDialog::on_dpi_changed ( const wxRect & suggested_rect)
overrideprivatevirtual

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

4586 {
4587 Layout();
4588}

◆ on_sys_color_changed()

◆ prev_scale_factor()

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

◆ 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_need_delete_preset_index()

void Slic3r::GUI::EditFilamentPresetDialog::set_need_delete_preset_index ( int need_delete_preset_index)
inline
370{ m_need_delete_preset_index = need_delete_preset_index; }

References m_need_delete_preset_index.

◆ set_need_edit_preset_index()

void Slic3r::GUI::EditFilamentPresetDialog::set_need_edit_preset_index ( int need_edit_preset_index)
inline
371{ m_need_edit_preset_index = need_edit_preset_index; }

References m_need_edit_preset_index.

◆ set_prev_scale_factor()

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

◆ set_printer_name()

void Slic3r::GUI::EditFilamentPresetDialog::set_printer_name ( const std::string & printer_name)
inline
369{ m_selected_printer = printer_name; }

References m_selected_printer.

◆ set_scale_factor()

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

◆ ShowModal()

◆ 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_preset_tree()

void Slic3r::GUI::EditFilamentPresetDialog::update_preset_tree ( )
private
4614{
4615 this->Freeze();
4616 m_preset_tree_sizer->Clear(true);
4617 for (std::pair<std::string, std::vector<std::shared_ptr<Preset>>> printer_and_presets : m_printer_compatible_presets) {
4618 m_preset_tree_sizer->Add(m_preset_tree_creater->get_preset_tree(printer_and_presets), 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, 5);
4619 }
4620 if (m_printer_compatible_presets.size() == 1 && m_printer_compatible_presets.begin()->second.size() == 1) {
4621 m_note_text->Show();
4622 } else {
4623 m_note_text->Hide();
4624 }
4625
4627 int width = m_preset_tree_panel->GetSize().GetWidth();
4628 int height = m_preset_tree_panel->GetSize().GetHeight();
4629 if (width < m_note_text->GetSize().GetWidth()) {
4630 width = m_note_text->GetSize().GetWidth();
4631 m_preset_tree_panel->SetMinSize(wxSize(width, -1));
4632 }
4633 int width_extend = 0;
4634 int height_extend = 0;
4635 if (width > 1000) height_extend = 22;
4636 if (height > 400) width_extend = 22;
4637 m_preset_tree_window->SetMinSize(wxSize(std::min(1000, width + width_extend), std::min(400, height + height_extend)));
4638 m_preset_tree_window->SetMaxSize(wxSize(std::min(1000, width + width_extend), std::min(400, height + height_extend)));
4639 m_preset_tree_window->SetSize(wxSize(std::min(1000, width + width_extend), std::min(400, height + height_extend)));
4640 this->SetSizerAndFit(m_main_sizer);
4641
4642 this->Layout();
4643 this->Fit();
4644 this->Refresh();
4645 wxGetApp().UpdateDlgDarkUI(this);
4647 this->Thaw();
4648}
static void adjust_dialog_in_screen(DPIDialog *dialog)
Definition CreatePresetsDialog.cpp:698
coord_t width(const BoundingBox &box)
Definition Arrange.cpp:1184
coord_t height(const BoundingBox &box)
Definition Arrange.cpp:1185

References Slic3r::GUI::adjust_dialog_in_screen(), m_main_sizer, m_note_text, m_preset_tree_creater, m_preset_tree_panel, m_preset_tree_sizer, m_preset_tree_window, and m_printer_compatible_presets.

Referenced by EditFilamentPresetDialog(), create_add_filament_btn(), and delete_preset().

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

Member Data Documentation

◆ m_add_filament_btn

Button* Slic3r::GUI::EditFilamentPresetDialog::m_add_filament_btn = nullptr
private

Referenced by create_add_filament_btn().

◆ m_can_rescale

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

◆ m_em_unit

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

◆ m_filament_id

std::string Slic3r::GUI::EditFilamentPresetDialog::m_filament_id
private

◆ m_filament_name

std::string Slic3r::GUI::EditFilamentPresetDialog::m_filament_name
private

◆ m_filament_serial

std::string Slic3r::GUI::EditFilamentPresetDialog::m_filament_serial
private

◆ m_filament_type

std::string Slic3r::GUI::EditFilamentPresetDialog::m_filament_type
private

◆ m_force_rescale

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

◆ m_main_sizer

wxBoxSizer* Slic3r::GUI::EditFilamentPresetDialog::m_main_sizer = nullptr
private

◆ m_need_delete_preset_index

int Slic3r::GUI::EditFilamentPresetDialog::m_need_delete_preset_index = -1
private

◆ m_need_edit_preset

std::shared_ptr<Preset> Slic3r::GUI::EditFilamentPresetDialog::m_need_edit_preset
private

◆ m_need_edit_preset_index

int Slic3r::GUI::EditFilamentPresetDialog::m_need_edit_preset_index = -1
private

◆ 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_note_text

wxStaticText* Slic3r::GUI::EditFilamentPresetDialog::m_note_text = nullptr
private

◆ m_preset_tree_creater

PresetTree* Slic3r::GUI::EditFilamentPresetDialog::m_preset_tree_creater = nullptr
private

◆ m_preset_tree_panel

wxPanel* Slic3r::GUI::EditFilamentPresetDialog::m_preset_tree_panel = nullptr
private

◆ m_preset_tree_sizer

wxBoxSizer* Slic3r::GUI::EditFilamentPresetDialog::m_preset_tree_sizer = nullptr
private

◆ m_preset_tree_window

wxScrolledWindow* Slic3r::GUI::EditFilamentPresetDialog::m_preset_tree_window = nullptr
private

◆ m_prev_scale_factor

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

◆ m_printer_compatible_presets

std::unordered_map<std::string, std::vector<std::shared_ptr<Preset> > > Slic3r::GUI::EditFilamentPresetDialog::m_printer_compatible_presets
private

◆ m_scale_factor

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

◆ m_selected_printer

std::string Slic3r::GUI::EditFilamentPresetDialog::m_selected_printer = ""
private

◆ m_vendor_name

std::string Slic3r::GUI::EditFilamentPresetDialog::m_vendor_name
private

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