From 1079d4644c04d075e783d3fb3ad59f13077fae32 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Thu, 6 Aug 2020 10:40:04 +0200 Subject: [PATCH] PhysicalPrinterDialog improvements : Printer device default name is changed to force the user to change it SavePresetDialog : Fixed OSX bug, when wxEVT_TEXT wasn't invoked after change selection in ComboBox --- src/slic3r/GUI/PhysicalPrinterDialog.cpp | 12 +++++++++--- src/slic3r/GUI/PresetComboBoxes.cpp | 5 +++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/PhysicalPrinterDialog.cpp b/src/slic3r/GUI/PhysicalPrinterDialog.cpp index f14f49801..12d1cd287 100644 --- a/src/slic3r/GUI/PhysicalPrinterDialog.cpp +++ b/src/slic3r/GUI/PhysicalPrinterDialog.cpp @@ -161,13 +161,15 @@ PhysicalPrinterDialog::PhysicalPrinterDialog(wxString printer_name) SetFont(wxGetApp().normal_font()); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); - m_default_name = _L("My Printer Device"); + m_default_name = _L("Type here the name of your printer device"); + bool new_printer = true; if (printer_name.IsEmpty()) printer_name = m_default_name; else { std::string full_name = into_u8(printer_name); printer_name = from_u8(PhysicalPrinter::get_short_name(full_name)); + new_printer = false; } wxStaticText* label_top = new wxStaticText(this, wxID_ANY, _L("Descriptive name for the printer device") + ":"); @@ -206,7 +208,6 @@ PhysicalPrinterDialog::PhysicalPrinterDialog(wxString printer_name) m_optgroup = new ConfigOptionsGroup(this, _L("Print Host upload"), m_config); build_printhost_settings(m_optgroup); - //m_optgroup->reload_config(); wxStdDialogButtonSizer* btns = this->CreateStdDialogButtonSizer(wxOK | wxCANCEL); wxButton* btnOK = static_cast(this->FindWindowById(wxID_OK, this)); @@ -230,6 +231,11 @@ PhysicalPrinterDialog::PhysicalPrinterDialog(wxString printer_name) SetSizer(topSizer); topSizer->SetSizeHints(this); + + if (new_printer) { + m_printer_name->SetFocus(); + m_printer_name->SelectAll(); + } } PhysicalPrinterDialog::~PhysicalPrinterDialog() @@ -494,7 +500,7 @@ void PhysicalPrinterDialog::OnOK(wxEvent& event) std::string renamed_from; // temporary save previous printer name if it was edited - if (m_printer.name != _u8L("My Printer Device") && + if (m_printer.name != into_u8(m_default_name) && m_printer.name != into_u8(printer_name)) renamed_from = m_printer.name; diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp index 77bdb3812..da33ee51a 100644 --- a/src/slic3r/GUI/PresetComboBoxes.cpp +++ b/src/slic3r/GUI/PresetComboBoxes.cpp @@ -1054,6 +1054,11 @@ SavePresetDialog::Item::Item(Preset::Type type, const std::string& suffix, wxBox m_combo->Append(from_u8(value)); m_combo->Bind(wxEVT_TEXT, [this](wxCommandEvent&) { update(); }); +#ifdef __WXOSX__ + // Under OSX wxEVT_TEXT wasn't invoked after change selection in combobox, + // So process wxEVT_COMBOBOX too + m_combo->Bind(wxEVT_COMBOBOX, [this](wxCommandEvent&) { update(); }); +#endif //__WXOSX__ m_valid_label = new wxStaticText(m_parent, wxID_ANY, ""); m_valid_label->SetFont(wxGetApp().bold_font());