Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuSanka <yusanka@gmail.com>2020-06-26 10:58:39 +0300
committerYuSanka <yusanka@gmail.com>2020-06-26 11:00:03 +0300
commitd96b5f360661feaa2f964d9f4b18d1e586d2607b (patch)
tree64e9ca2ec266811d3dd30cac7a6bb8a47f5a330f /src/slic3r
parent1a2926050fee0b5ab118054aaa4ccb65614d2063 (diff)
PhysicalPrinter : Next improvements:
* Create full printer name as a PrinterName + RelatedPresetName * Added printer model to the PhysicalPrinter.config => Enable to select just between presets with same printer model * When physical printer is selected and create new preset ask if should we use this preset for selected ph_printer or just to switch for it
Diffstat (limited to 'src/slic3r')
-rw-r--r--src/slic3r/GUI/PresetComboBoxes.cpp175
-rw-r--r--src/slic3r/GUI/PresetComboBoxes.hpp9
-rw-r--r--src/slic3r/GUI/Tab.cpp33
-rw-r--r--src/slic3r/GUI/Tab.hpp1
-rw-r--r--src/slic3r/GUI/wxExtensions.cpp7
-rw-r--r--src/slic3r/GUI/wxExtensions.hpp4
6 files changed, 175 insertions, 54 deletions
diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp
index b39582ee0..88dd4b739 100644
--- a/src/slic3r/GUI/PresetComboBoxes.cpp
+++ b/src/slic3r/GUI/PresetComboBoxes.cpp
@@ -104,6 +104,7 @@ PresetComboBox::PresetComboBox(wxWindow* parent, Preset::Type preset_type, const
m_bitmapCompatible = ScalableBitmap(this, "flag_green");
m_bitmapIncompatible = ScalableBitmap(this, "flag_red");
m_bitmapLock = ScalableBitmap(this, "lock_closed");
+ m_bitmapLockDisabled = ScalableBitmap(this, "lock_closed", 16, true);
// parameters for an icon's drawing
fill_width_height();
@@ -125,6 +126,7 @@ void PresetComboBox::msw_rescale()
m_em_unit = em_unit(this);
m_bitmapLock.msw_rescale();
+ m_bitmapLockDisabled.msw_rescale();
m_bitmapIncompatible.msw_rescale();
m_bitmapCompatible.msw_rescale();
@@ -241,6 +243,7 @@ PlaterPresetComboBox::PlaterPresetComboBox(wxWindow *parent, Preset::Type preset
if (marker >= LABEL_ITEM_MARKER && marker < LABEL_ITEM_MAX) {
this->SetSelection(this->m_last_selected);
evt.StopPropagation();
+ /*
if (marker == LABEL_ITEM_PHYSICAL_PRINTERS)
{
PhysicalPrinterDialog dlg(wxEmptyString);
@@ -258,6 +261,19 @@ PlaterPresetComboBox::PlaterPresetComboBox(wxWindow *parent, Preset::Type preset
}
wxTheApp->CallAfter([sp]() { wxGetApp().run_wizard(ConfigWizard::RR_USER, sp); });
}
+ */
+ if (marker == LABEL_ITEM_WIZARD_PRINTERS)
+ show_add_menu();
+ else
+ {
+ ConfigWizard::StartPage sp = ConfigWizard::SP_WELCOME;
+ switch (marker) {
+ case LABEL_ITEM_WIZARD_FILAMENTS: sp = ConfigWizard::SP_FILAMENTS; break;
+ case LABEL_ITEM_WIZARD_MATERIALS: sp = ConfigWizard::SP_MATERIALS; break;
+ default: break;
+ }
+ wxTheApp->CallAfter([sp]() { wxGetApp().run_wizard(ConfigWizard::RR_USER, sp); });
+ }
} else if (marker == LABEL_ITEM_PHYSICAL_PRINTER || this->m_last_selected != selected_item || m_collection->current_is_dirty() ) {
this->m_last_selected = selected_item;
evt.SetInt(this->m_type);
@@ -377,6 +393,25 @@ bool PlaterPresetComboBox::switch_to_tab()
return true;
}
+void PlaterPresetComboBox::show_add_menu()
+{
+ wxMenu* menu = new wxMenu();
+
+ append_menu_item(menu, wxID_ANY, _L("Add/Remove logical printers"), "",
+ [this](wxCommandEvent&) {
+ wxTheApp->CallAfter([]() { wxGetApp().run_wizard(ConfigWizard::RR_USER, ConfigWizard::SP_PRINTERS); });
+ }, "edit_uni", menu, []() { return true; }, wxGetApp().plater());
+
+ append_menu_item(menu, wxID_ANY, _L("Add physical printer"), "",
+ [this](wxCommandEvent&) {
+ PhysicalPrinterDialog dlg(wxEmptyString);
+ if (dlg.ShowModal() == wxID_OK)
+ update();
+ }, "edit_uni", menu, []() { return true; }, wxGetApp().plater());
+
+ wxGetApp().plater()->PopupMenu(menu);
+}
+
void PlaterPresetComboBox::show_edit_menu()
{
wxMenu* menu = new wxMenu();
@@ -393,7 +428,7 @@ void PlaterPresetComboBox::show_edit_menu()
append_menu_item(menu, wxID_ANY, _L("Delete physical printer"), "",
[this](wxCommandEvent&) {
- const std::string& printer_name = m_preset_bundle->physical_printers.get_selected_printer_name();
+ const std::string& printer_name = m_preset_bundle->physical_printers.get_selected_full_printer_name();
if (printer_name.empty())
return;
@@ -550,36 +585,6 @@ void PlaterPresetComboBox::update()
}
}
- if (m_type == Preset::TYPE_PRINTER || m_type == Preset::TYPE_SLA_MATERIAL) {
- std::string bitmap_key = "";
- // If the filament preset is not compatible and there is a "red flag" icon loaded, show it left
- // to the filament color image.
- if (wide_icons)
- bitmap_key += "wide,";
- bitmap_key += "edit_preset_list";
- bitmap_key += "-h" + std::to_string(icon_height);
-
- wxBitmap* bmp = m_bitmap_cache->find(bitmap_key);
- if (bmp == nullptr) {
- // Create the bitmap with color bars.update_plater_ui
- std::vector<wxBitmap> bmps;
- if (wide_icons)
- // Paint a red flag for incompatible presets.
- bmps.emplace_back(m_bitmap_cache->mkclear(norm_icon_width, icon_height));
- // Paint the color bars.
- bmps.emplace_back(m_bitmap_cache->mkclear(thin_space_icon_width, icon_height));
- bmps.emplace_back(create_scaled_bitmap(m_main_bitmap_name));
- // Paint a lock at the system presets.
- bmps.emplace_back(m_bitmap_cache->mkclear(wide_space_icon_width, icon_height));
- bmps.emplace_back(create_scaled_bitmap("edit_uni"));
- bmp = m_bitmap_cache->insert(bitmap_key, bmps);
- }
- if (m_type == Preset::TYPE_SLA_MATERIAL)
- set_label_marker(Append(separator(L("Add/Remove materials")), *bmp), LABEL_ITEM_WIZARD_MATERIALS);
- else
- set_label_marker(Append(separator(L("Add/Remove printers")), *bmp), LABEL_ITEM_WIZARD_PRINTERS);
- }
-
if (m_type == Preset::TYPE_PRINTER)
{
// add Physical printers, if any exists
@@ -608,7 +613,7 @@ void PlaterPresetComboBox::update()
bmp = m_bitmap_cache->insert(bitmap_key, bmps);
}
- set_label_marker(Append(wxString::FromUTF8((it->name).c_str()), *bmp), LABEL_ITEM_PHYSICAL_PRINTER);
+ set_label_marker(Append(wxString::FromUTF8((it->full_name).c_str()), *bmp), LABEL_ITEM_PHYSICAL_PRINTER);
if (ph_printers.has_selection() && it->name == ph_printers.get_selected_printer_name() ||
// just in case: mark selected_preset_item as a first added element
selected_preset_item == INT_MAX)
@@ -616,6 +621,7 @@ void PlaterPresetComboBox::update()
}
}
+/*
// add LABEL_ITEM_PHYSICAL_PRINTERS
std::string bitmap_key;
if (wide_icons)
@@ -639,6 +645,37 @@ void PlaterPresetComboBox::update()
bmp = m_bitmap_cache->insert(bitmap_key, bmps);
}
set_label_marker(Append(separator(L("Add physical printer")), *bmp), LABEL_ITEM_PHYSICAL_PRINTERS);
+*/
+ }
+
+ if (m_type == Preset::TYPE_PRINTER || m_type == Preset::TYPE_SLA_MATERIAL) {
+ std::string bitmap_key = "";
+ // If the filament preset is not compatible and there is a "red flag" icon loaded, show it left
+ // to the filament color image.
+ if (wide_icons)
+ bitmap_key += "wide,";
+ bitmap_key += "edit_preset_list";
+ bitmap_key += "-h" + std::to_string(icon_height);
+
+ wxBitmap* bmp = m_bitmap_cache->find(bitmap_key);
+ if (bmp == nullptr) {
+ // Create the bitmap with color bars.update_plater_ui
+ std::vector<wxBitmap> bmps;
+ if (wide_icons)
+ // Paint a red flag for incompatible presets.
+ bmps.emplace_back(m_bitmap_cache->mkclear(norm_icon_width, icon_height));
+ // Paint the color bars.
+ bmps.emplace_back(m_bitmap_cache->mkclear(thin_space_icon_width, icon_height));
+ bmps.emplace_back(create_scaled_bitmap(m_main_bitmap_name));
+ // Paint a lock at the system presets.
+ bmps.emplace_back(m_bitmap_cache->mkclear(wide_space_icon_width, icon_height));
+ bmps.emplace_back(create_scaled_bitmap("edit_uni"));
+ bmp = m_bitmap_cache->insert(bitmap_key, bmps);
+ }
+ if (m_type == Preset::TYPE_SLA_MATERIAL)
+ set_label_marker(Append(separator(L("Add/Remove materials")), *bmp), LABEL_ITEM_WIZARD_MATERIALS);
+ else
+ set_label_marker(Append(separator(L("Add/Remove printers")), *bmp), LABEL_ITEM_WIZARD_PRINTERS);
}
/* But, if selected_preset_item is still equal to INT_MAX, it means that
@@ -680,7 +717,7 @@ TabPresetComboBox::TabPresetComboBox(wxWindow* parent, Preset::Type preset_type)
auto selected_item = evt.GetSelection();
auto marker = reinterpret_cast<Marker>(this->GetClientData(selected_item));
- if (marker >= LABEL_ITEM_MARKER && marker < LABEL_ITEM_MAX) {
+ if (marker >= LABEL_ITEM_DISABLED && marker < LABEL_ITEM_MAX) {
this->SetSelection(this->m_last_selected);
if (marker == LABEL_ITEM_WIZARD_PRINTERS)
wxTheApp->CallAfter([this]() {
@@ -710,7 +747,7 @@ void TabPresetComboBox::update()
const std::deque<Preset>& presets = m_collection->get_presets();
- std::map<wxString, wxBitmap*> nonsys_presets;
+ std::map<wxString, std::pair<wxBitmap*, bool>> nonsys_presets;
wxString selected = "";
if (!presets.front().is_visible)
set_label_marker(Append(separator(L("System presets")), wxNullBitmap));
@@ -719,13 +756,24 @@ void TabPresetComboBox::update()
const Preset& preset = presets[i];
if (!preset.is_visible || (!show_incompatible && !preset.is_compatible && i != idx_selected))
continue;
+
+ // marker used for disable incompatible printer models for the selected physical printer
+ bool is_enabled = true;
+ // check this value just for printer presets, when physical printer is selected
+ if (m_type == Preset::TYPE_PRINTER && m_preset_bundle->physical_printers.has_selection()) {
+ is_enabled = m_enable_all ? true :
+ preset.name == m_preset_bundle->physical_printers.get_selected_printer_preset_name() ||
+ preset.config.opt_string("printer_model") == m_preset_bundle->physical_printers.get_selected_printer_model();
+ }
std::string bitmap_key = "tab";
- wxBitmap main_bmp = create_scaled_bitmap(m_type == Preset::TYPE_PRINTER && preset.printer_technology() == ptSLA ? "sla_printer" : m_main_bitmap_name, this);
+ wxBitmap main_bmp = create_scaled_bitmap(m_type == Preset::TYPE_PRINTER && preset.printer_technology() == ptSLA ? "sla_printer" : m_main_bitmap_name, this, 16, !is_enabled);
if (m_type == Preset::TYPE_PRINTER) {
bitmap_key += "_printer";
if (preset.printer_technology() == ptSLA)
bitmap_key += "_sla";
+ if (!is_enabled)
+ bitmap_key += "_disabled";
}
bitmap_key += preset.is_compatible ? ",cmpt" : ",ncmpt";
bitmap_key += (preset.is_system || preset.is_default) ? ",syst" : ",nsyst";
@@ -737,13 +785,14 @@ void TabPresetComboBox::update()
std::vector<wxBitmap> bmps;
bmps.emplace_back(m_type == Preset::TYPE_PRINTER ? main_bmp : preset.is_compatible ? m_bitmapCompatible.bmp() : m_bitmapIncompatible.bmp());
// Paint a lock at the system presets.
- bmps.emplace_back((preset.is_system || preset.is_default) ? m_bitmapLock.bmp() : m_bitmap_cache->mkclear(norm_icon_width, icon_height));
+ bmps.emplace_back((preset.is_system || preset.is_default) ? (is_enabled ? m_bitmapLock.bmp() : m_bitmapLockDisabled.bmp()) : m_bitmap_cache->mkclear(norm_icon_width, icon_height));
bmp = m_bitmap_cache->insert(bitmap_key, bmps);
}
if (preset.is_default || preset.is_system) {
- Append(wxString::FromUTF8((preset.name + (preset.is_dirty ? Preset::suffix_modified() : "")).c_str()),
- (bmp == 0) ? main_bmp : *bmp);
+ int item_id = Append(wxString::FromUTF8((preset.name + (preset.is_dirty ? Preset::suffix_modified() : "")).c_str()), !bmp ? main_bmp : *bmp);
+ if (!is_enabled)
+ set_label_marker(item_id, LABEL_ITEM_DISABLED);
if (i == idx_selected ||
// just in case: mark selected_preset_item as a first added element
selected_preset_item == INT_MAX)
@@ -751,7 +800,8 @@ void TabPresetComboBox::update()
}
else
{
- nonsys_presets.emplace(wxString::FromUTF8((preset.name + (preset.is_dirty ? Preset::suffix_modified() : "")).c_str()), bmp);
+ 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 (i == idx_selected)
selected = wxString::FromUTF8((preset.name + (preset.is_dirty ? Preset::suffix_modified() : "")).c_str());
}
@@ -761,8 +811,11 @@ void TabPresetComboBox::update()
if (!nonsys_presets.empty())
{
set_label_marker(Append(separator(L("User presets")), wxNullBitmap));
- for (std::map<wxString, wxBitmap*>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
- Append(it->first, *it->second);
+ for (std::map<wxString, std::pair<wxBitmap*, bool>>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
+ int item_id = Append(it->first, *it->second.first);
+ bool is_enabled = it->second.second;
+ if (!is_enabled)
+ set_label_marker(item_id, LABEL_ITEM_DISABLED);
if (it->first == selected ||
// just in case: mark selected_preset_item as a first added element
selected_preset_item == INT_MAX)
@@ -845,6 +898,17 @@ PhysicalPrinterDialog::PhysicalPrinterDialog(wxString printer_name)
int border = 10;
m_printer_presets = new TabPresetComboBox(this, Preset::TYPE_PRINTER);
+
+ if (printer_name.IsEmpty()) {
+ // if printer_name is empty it means that new printer is created, so enable all items in the preset list
+ m_printer_presets->set_enable_all();
+ printer_name = _L("My Printer Device");
+ }
+ else {
+ std::string full_name = into_u8(printer_name);
+ printer_name = from_u8(PhysicalPrinter::get_short_name(full_name));
+ }
+
m_printer_presets->set_selection_changed_function([this](int selection) {
std::string selected_string = Preset::remove_suffix_modified(m_printer_presets->GetString(selection).ToUTF8().data());
Preset* preset = wxGetApp().preset_bundle->printers.find_preset(selected_string);
@@ -854,17 +918,22 @@ PhysicalPrinterDialog::PhysicalPrinterDialog(wxString printer_name)
preset = &edited_preset;
m_printer.update_from_preset(*preset);
+ update_printer_name();
+
// update values
m_optgroup->reload_config();
update();
});
m_printer_presets->update();
- wxString preset_name = m_printer_presets->GetString(m_printer_presets->GetSelection());
+ wxStaticText* label_top = new wxStaticText(this, wxID_ANY, _("Descriptive name for the printer device") + ":");
+ m_printer_name = new wxTextCtrl(this, wxID_ANY, printer_name, wxDefaultPosition, wxDefaultSize);
+ m_printer_name->Bind(wxEVT_TEXT, [this](wxEvent&) { this->update_printer_name(); });
+
+ wxStaticText* label_bottom = new wxStaticText(this, wxID_ANY, _("This printer name will be shown in the presets list") + ":");
+ m_full_printer_name = new wxStaticText(this, wxID_ANY, "");
- if (printer_name.IsEmpty())
- printer_name = preset_name + " - "+_L("Physical Printer");
- m_printer_name = new wxTextCtrl(this, wxID_ANY, printer_name, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER);
+ update_printer_name();
PhysicalPrinterCollection& printers = wxGetApp().preset_bundle->physical_printers;
PhysicalPrinter* printer = printers.find_printer(into_u8(printer_name));
@@ -887,8 +956,11 @@ PhysicalPrinterDialog::PhysicalPrinterDialog(wxString printer_name)
wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
+ topSizer->Add(label_top , 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border);
topSizer->Add(m_printer_name , 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border);
topSizer->Add(m_printer_presets , 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border);
+ topSizer->Add(label_bottom , 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border);
+ topSizer->Add(m_full_printer_name , 0, wxEXPAND | wxLEFT | wxRIGHT, border);
topSizer->Add(m_optgroup->sizer , 1, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border);
topSizer->Add(btns , 0, wxEXPAND | wxALL, border);
@@ -1053,6 +1125,15 @@ void PhysicalPrinterDialog::update()
this->Layout();
}
+void PhysicalPrinterDialog::update_printer_name()
+{
+ wxString printer_name = m_printer_name->GetValue();
+ wxString preset_name = m_printer_presets->GetString(m_printer_presets->GetSelection());
+
+ m_full_printer_name->SetLabelText("\t" + printer_name + " * " + preset_name);
+ this->Layout();
+}
+
void PhysicalPrinterDialog::on_dpi_changed(const wxRect& suggested_rect)
{
const int& em = em_unit();
@@ -1096,8 +1177,8 @@ void PhysicalPrinterDialog::OnOK(wxEvent& event)
printers.delete_printer(into_u8(printer_name));
}
- //upadte printer name, if it was changed
- m_printer.name = into_u8(printer_name);
+ //update printer name, if it was changed
+ m_printer.set_name(into_u8(printer_name));
// save new physical printer
printers.save_printer(m_printer);
diff --git a/src/slic3r/GUI/PresetComboBoxes.hpp b/src/slic3r/GUI/PresetComboBoxes.hpp
index 196c4368e..653c0e540 100644
--- a/src/slic3r/GUI/PresetComboBoxes.hpp
+++ b/src/slic3r/GUI/PresetComboBoxes.hpp
@@ -13,6 +13,7 @@
class wxString;
class wxTextCtrl;
+class wxStatictext;
class ScalableButton;
namespace Slic3r {
@@ -35,6 +36,7 @@ public:
enum LabelItemType {
LABEL_ITEM_PHYSICAL_PRINTER = 0xffffff01,
+ LABEL_ITEM_DISABLED,
LABEL_ITEM_MARKER,
LABEL_ITEM_PHYSICAL_PRINTERS,
LABEL_ITEM_WIZARD_PRINTERS,
@@ -66,6 +68,8 @@ protected:
ScalableBitmap m_bitmapIncompatible;
// Indicator, that the preset is system and not modified.
ScalableBitmap m_bitmapLock;
+ // Disabled analogue of the m_bitmapLock .
+ ScalableBitmap m_bitmapLockDisabled;
int m_last_selected;
int m_em_unit;
@@ -125,6 +129,7 @@ public:
bool is_selected_physical_printer();
bool switch_to_tab();
+ void show_add_menu();
void show_edit_menu();
void update() override;
@@ -142,6 +147,7 @@ private:
class TabPresetComboBox : public PresetComboBox
{
bool show_incompatible {false};
+ bool m_enable_all {false};
std::function<void(int)> on_selection_changed { nullptr };
public:
@@ -156,6 +162,7 @@ public:
void msw_rescale() override;
void set_selection_changed_function(std::function<void(int)> sel_changed) { on_selection_changed = sel_changed; }
+ void set_enable_all(bool enable=true) { m_enable_all = enable; }
};
@@ -169,6 +176,7 @@ class PhysicalPrinterDialog : public DPIDialog
DynamicPrintConfig* m_config { nullptr };
wxTextCtrl* m_printer_name { nullptr };
+ wxStaticText* m_full_printer_name { nullptr };
TabPresetComboBox* m_printer_presets { nullptr };
ConfigOptionsGroup* m_optgroup { nullptr };
@@ -178,6 +186,7 @@ class PhysicalPrinterDialog : public DPIDialog
void build_printhost_settings(ConfigOptionsGroup* optgroup);
void update();
+ void update_printer_name();
void OnOK(wxEvent& event);
public:
diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp
index da5d51dc5..595283e98 100644
--- a/src/slic3r/GUI/Tab.cpp
+++ b/src/slic3r/GUI/Tab.cpp
@@ -162,10 +162,9 @@ void Tab::create_preset_tab()
// preset chooser
m_presets_choice = new TabPresetComboBox(panel, m_type);
m_presets_choice->set_selection_changed_function([this](int selection) {
- // unselect pthysical printer, if it was selected
- m_preset_bundle->physical_printers.unselect_printer();
- // select preset
std::string selected_string = m_presets_choice->GetString(selection).ToUTF8().data();
+ update_physical_printers(selected_string);
+ // select preset
select_preset(selected_string);
});
@@ -763,6 +762,32 @@ void Tab::update_tab_ui()
m_presets_choice->update();
}
+void Tab::update_physical_printers(std::string preset_name)
+{
+ if (m_type == Preset::TYPE_PRINTER && m_preset_bundle->physical_printers.has_selection())
+ {
+ std::string printer_name = m_preset_bundle->physical_printers.get_selected_full_printer_name();
+ wxString msg_text = from_u8((boost::format(_u8L("You have selected physical printer \"%1%\".")) % printer_name).str());
+ msg_text += "\n\n" + _L("Would you like to change related preset for this printer?") + "\n\n" +
+ _L("Select YES if you want to change related preset for this printer \n"
+ "or NO to switch to the another preset (logical printer).");
+ wxMessageDialog dialog(nullptr, msg_text, _L("Warning"), wxICON_WARNING | wxYES | wxNO);
+
+ if (dialog.ShowModal() == wxID_YES) {
+ preset_name = Preset::remove_suffix_modified(preset_name);
+ Preset* preset = m_presets->find_preset(preset_name);
+ assert(preset);
+ Preset& edited_preset = m_presets->get_edited_preset();
+ if (preset->name == edited_preset.name)
+ preset = &edited_preset;
+ m_preset_bundle->physical_printers.get_selected_printer().update_from_preset(*preset);
+ }
+ else
+ // unselect physical printer, if it was selected
+ m_preset_bundle->physical_printers.unselect_printer();
+ }
+}
+
// Load a provied DynamicConfig into the tab, modifying the active preset.
// This could be used for example by setting a Wipe Tower position by interactive manipulation in the 3D view.
void Tab::load_config(const DynamicPrintConfig& config)
@@ -3269,6 +3294,8 @@ void Tab::save_preset(std::string name /*= ""*/, bool detach)
// Mark the print & filament enabled if they are compatible with the currently selected preset.
// If saving the preset changes compatibility with other presets, keep the now incompatible dependent presets selected, however with a "red flag" icon showing that they are no more compatible.
m_preset_bundle->update_compatible(PresetSelectCompatibleType::Never);
+ //update physical printer's related printer preset if it's needed
+ update_physical_printers(name);
// Add the new item into the UI component, remove dirty flags and activate the saved item.
update_tab_ui();
// Update the selection boxes at the plater.
diff --git a/src/slic3r/GUI/Tab.hpp b/src/slic3r/GUI/Tab.hpp
index bc15efa35..69720ff65 100644
--- a/src/slic3r/GUI/Tab.hpp
+++ b/src/slic3r/GUI/Tab.hpp
@@ -306,6 +306,7 @@ public:
void load_initial_data();
void update_dirty();
void update_tab_ui();
+ void update_physical_printers(std::string preset_name);
void load_config(const DynamicPrintConfig& config);
virtual void reload_config();
void update_mode();
diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp
index 39b3e154b..67b5a18f7 100644
--- a/src/slic3r/GUI/wxExtensions.cpp
+++ b/src/slic3r/GUI/wxExtensions.cpp
@@ -731,11 +731,12 @@ void MenuWithSeparators::SetSecondSeparator()
// ----------------------------------------------------------------------------
ScalableBitmap::ScalableBitmap( wxWindow *parent,
const std::string& icon_name/* = ""*/,
- const int px_cnt/* = 16*/):
+ const int px_cnt/* = 16*/,
+ const bool grayscale/* = false*/):
m_parent(parent), m_icon_name(icon_name),
m_px_cnt(px_cnt)
{
- m_bmp = create_scaled_bitmap(icon_name, parent, px_cnt);
+ m_bmp = create_scaled_bitmap(icon_name, parent, px_cnt, grayscale);
}
wxSize ScalableBitmap::GetBmpSize() const
@@ -768,7 +769,7 @@ int ScalableBitmap::GetBmpHeight() const
void ScalableBitmap::msw_rescale()
{
- m_bmp = create_scaled_bitmap(m_icon_name, m_parent, m_px_cnt);
+ m_bmp = create_scaled_bitmap(m_icon_name, m_parent, m_px_cnt, m_grayscale);
}
// ----------------------------------------------------------------------------
diff --git a/src/slic3r/GUI/wxExtensions.hpp b/src/slic3r/GUI/wxExtensions.hpp
index 17fe8992c..9be3361bd 100644
--- a/src/slic3r/GUI/wxExtensions.hpp
+++ b/src/slic3r/GUI/wxExtensions.hpp
@@ -130,7 +130,8 @@ public:
ScalableBitmap() {};
ScalableBitmap( wxWindow *parent,
const std::string& icon_name = "",
- const int px_cnt = 16);
+ const int px_cnt = 16,
+ const bool grayscale = false);
~ScalableBitmap() {}
@@ -151,6 +152,7 @@ private:
wxBitmap m_bmp = wxBitmap();
std::string m_icon_name = "";
int m_px_cnt {16};
+ bool m_grayscale {false};
};