Merge remote-tracking branch 'origin/master' into ys_unsaved_changes

This commit is contained in:
YuSanka 2020-08-07 10:04:55 +02:00
commit e709c49e17
3 changed files with 33 additions and 12 deletions

View file

@ -1878,10 +1878,11 @@ namespace Slic3r {
volume->calculate_convex_hull();
// recreate custom supports from previously loaded attribute
assert(geometry.custom_supports.size() == triangles_count);
for (unsigned i=0; i<triangles_count; ++i) {
if (! geometry.custom_supports[i].empty())
volume->m_supported_facets.set_triangle_from_string(i, geometry.custom_supports[i]);
size_t index = src_start_id/3 + i;
assert(index < geometry.custom_supports.size());
if (! geometry.custom_supports[index].empty())
volume->m_supported_facets.set_triangle_from_string(i, geometry.custom_supports[index]);
}
// apply the remaining volume's metadata

View file

@ -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<wxButton*>(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;

View file

@ -179,7 +179,9 @@ void PresetComboBox::update(std::string select_preset_name)
const std::deque<Preset>& presets = m_collection->get_presets();
std::map<wxString, std::pair<wxBitmap*, bool>> nonsys_presets;
std::map<wxString, std::pair<wxBitmap*, bool>> nonsys_presets;
std::map<wxString, wxBitmap*> incomp_presets;
wxString selected = "";
if (!presets.front().is_visible)
set_label_marker(Append(separator(L("System presets")), wxNullBitmap));
@ -206,15 +208,15 @@ void PresetComboBox::update(std::string select_preset_name)
wxBitmap* bmp = get_bmp(bitmap_key, main_icon_name, "lock_closed", is_enabled, preset.is_compatible, preset.is_system || preset.is_default);
assert(bmp);
if (preset.is_default || preset.is_system) {
int item_id = Append(wxString::FromUTF8((preset.name + (preset.is_dirty ? Preset::suffix_modified() : "")).c_str()), *bmp);
if (!is_enabled)
set_label_marker(item_id, LABEL_ITEM_DISABLED);
if (!is_enabled)
incomp_presets.emplace(wxString::FromUTF8((preset.name + (preset.is_dirty ? Preset::suffix_modified() : "")).c_str()), bmp);
else if (preset.is_default || preset.is_system)
{
Append(wxString::FromUTF8((preset.name + (preset.is_dirty ? Preset::suffix_modified() : "")).c_str()), *bmp);
validate_selection(preset.name == select_preset_name);
}
else
{
std::pair<wxBitmap*, bool> pair(bmp, is_enabled);
nonsys_presets.emplace(wxString::FromUTF8((preset.name + (preset.is_dirty ? Preset::suffix_modified() : "")).c_str()), std::pair<wxBitmap*, bool>(bmp, is_enabled));
if (preset.name == select_preset_name || (select_preset_name.empty() && is_enabled))
selected = wxString::FromUTF8((preset.name + (preset.is_dirty ? Preset::suffix_modified() : "")).c_str());
@ -233,6 +235,13 @@ void PresetComboBox::update(std::string select_preset_name)
validate_selection(it->first == selected);
}
}
if (!incomp_presets.empty())
{
set_label_marker(Append(separator(L("Incompatible presets")), wxNullBitmap));
for (std::map<wxString, wxBitmap*>::iterator it = incomp_presets.begin(); it != incomp_presets.end(); ++it) {
set_label_marker(Append(it->first, *it->second), LABEL_ITEM_DISABLED);
}
}
update_selection();
Thaw();
@ -1054,6 +1063,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());