mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 08:47:52 -06:00
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
This commit is contained in:
parent
1a2926050f
commit
d96b5f3606
8 changed files with 225 additions and 61 deletions
|
@ -26,6 +26,7 @@
|
||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/filesystem/fstream.hpp>
|
#include <boost/filesystem/fstream.hpp>
|
||||||
|
#include <boost/algorithm/string.hpp>
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
|
|
||||||
#include <boost/nowide/cenv.hpp>
|
#include <boost/nowide/cenv.hpp>
|
||||||
|
@ -1351,6 +1352,7 @@ const std::vector<std::string>& PhysicalPrinter::printer_options()
|
||||||
s_opts = {
|
s_opts = {
|
||||||
"preset_name",
|
"preset_name",
|
||||||
"printer_technology",
|
"printer_technology",
|
||||||
|
"printer_model",
|
||||||
"host_type",
|
"host_type",
|
||||||
"print_host",
|
"print_host",
|
||||||
"printhost_apikey",
|
"printhost_apikey",
|
||||||
|
@ -1363,21 +1365,28 @@ const std::vector<std::string>& PhysicalPrinter::printer_options()
|
||||||
return s_opts;
|
return s_opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& PhysicalPrinter::get_preset_name()
|
const std::string& PhysicalPrinter::get_preset_name() const
|
||||||
{
|
{
|
||||||
return config.opt_string("preset_name");
|
return config.opt_string("preset_name");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string& PhysicalPrinter::get_printer_model() const
|
||||||
|
{
|
||||||
|
return config.opt_string("printer_model");
|
||||||
|
}
|
||||||
|
|
||||||
void PhysicalPrinter::update_from_preset(const Preset& preset)
|
void PhysicalPrinter::update_from_preset(const Preset& preset)
|
||||||
{
|
{
|
||||||
config.apply_only(preset.config, printer_options(), false);
|
config.apply_only(preset.config, printer_options(), false);
|
||||||
// add preset name to the options list
|
// add preset name to the options list
|
||||||
config.set_key_value("preset_name", new ConfigOptionString(preset.name));
|
config.set_key_value("preset_name", new ConfigOptionString(preset.name));
|
||||||
|
update_full_name();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicalPrinter::update_from_config(const DynamicPrintConfig& new_config)
|
void PhysicalPrinter::update_from_config(const DynamicPrintConfig& new_config)
|
||||||
{
|
{
|
||||||
config.apply_only(new_config, printer_options(), false);
|
config.apply_only(new_config, printer_options(), false);
|
||||||
|
update_full_name();
|
||||||
}
|
}
|
||||||
|
|
||||||
PhysicalPrinter::PhysicalPrinter(const std::string& name, const Preset& preset) :
|
PhysicalPrinter::PhysicalPrinter(const std::string& name, const Preset& preset) :
|
||||||
|
@ -1386,6 +1395,24 @@ PhysicalPrinter::PhysicalPrinter(const std::string& name, const Preset& preset)
|
||||||
update_from_preset(preset);
|
update_from_preset(preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PhysicalPrinter::set_name(const std::string& name)
|
||||||
|
{
|
||||||
|
this->name = name;
|
||||||
|
update_full_name();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhysicalPrinter::update_full_name()
|
||||||
|
{
|
||||||
|
full_name = name + " * " + get_preset_name();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string PhysicalPrinter::get_short_name(std::string full_name)
|
||||||
|
{
|
||||||
|
int pos = full_name.find_first_of(" * ");
|
||||||
|
boost::erase_tail(full_name, full_name.length() - pos);
|
||||||
|
return full_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
// *** PhysicalPrinterCollection ***
|
// *** PhysicalPrinterCollection ***
|
||||||
|
@ -1470,6 +1497,7 @@ void PhysicalPrinterCollection::save_printer(const PhysicalPrinter& edited_print
|
||||||
// Printer with the same name found.
|
// Printer with the same name found.
|
||||||
// Overwriting an existing preset.
|
// Overwriting an existing preset.
|
||||||
it->config = std::move(edited_printer.config);
|
it->config = std::move(edited_printer.config);
|
||||||
|
it->full_name = edited_printer.full_name;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Creating a new printer.
|
// Creating a new printer.
|
||||||
|
@ -1516,8 +1544,9 @@ bool PhysicalPrinterCollection::delete_selected_printer()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
PhysicalPrinter& PhysicalPrinterCollection::select_printer_by_name(const std::string& name)
|
PhysicalPrinter& PhysicalPrinterCollection::select_printer_by_name(std::string name)
|
||||||
{
|
{
|
||||||
|
name = PhysicalPrinter::get_short_name(name);
|
||||||
auto it = this->find_printer_internal(name);
|
auto it = this->find_printer_internal(name);
|
||||||
assert(it != m_printers.end());
|
assert(it != m_printers.end());
|
||||||
|
|
||||||
|
|
|
@ -538,20 +538,24 @@ public:
|
||||||
PhysicalPrinter() {}
|
PhysicalPrinter() {}
|
||||||
PhysicalPrinter(const std::string& name) : name(name){}
|
PhysicalPrinter(const std::string& name) : name(name){}
|
||||||
PhysicalPrinter(const std::string& name, const Preset& preset);
|
PhysicalPrinter(const std::string& name, const Preset& preset);
|
||||||
|
void set_name(const std::string &name);
|
||||||
|
void update_full_name();
|
||||||
|
|
||||||
// Name of the Physical Printer, usually derived form the file name.
|
// Name of the Physical Printer, usually derived form the file name.
|
||||||
std::string name;
|
std::string name;
|
||||||
|
// Full name of the Physical Printer, included related preset name
|
||||||
|
std::string full_name;
|
||||||
// File name of the Physical Printer.
|
// File name of the Physical Printer.
|
||||||
std::string file;
|
std::string file;
|
||||||
|
// Configuration data, loaded from a file, or set from the defaults.
|
||||||
|
DynamicPrintConfig config;
|
||||||
|
|
||||||
// Has this profile been loaded?
|
// Has this profile been loaded?
|
||||||
bool loaded = false;
|
bool loaded = false;
|
||||||
|
|
||||||
// Configuration data, loaded from a file, or set from the defaults.
|
|
||||||
DynamicPrintConfig config;
|
|
||||||
|
|
||||||
static const std::vector<std::string>& printer_options();
|
static const std::vector<std::string>& printer_options();
|
||||||
const std::string& get_preset_name();
|
const std::string& get_preset_name() const;
|
||||||
|
const std::string& get_printer_model() const;
|
||||||
|
|
||||||
void save() { this->config.save(this->file); }
|
void save() { this->config.save(this->file); }
|
||||||
void save_to(const std::string& file_name) const { this->config.save(file_name); }
|
void save_to(const std::string& file_name) const { this->config.save(file_name); }
|
||||||
|
@ -570,6 +574,9 @@ public:
|
||||||
// Sort lexicographically by a preset name. The preset name shall be unique across a single PresetCollection.
|
// Sort lexicographically by a preset name. The preset name shall be unique across a single PresetCollection.
|
||||||
bool operator<(const PhysicalPrinter& other) const { return this->name < other.name; }
|
bool operator<(const PhysicalPrinter& other) const { return this->name < other.name; }
|
||||||
|
|
||||||
|
// get printer name from the full name uncluded preset name
|
||||||
|
static std::string get_short_name(std::string full_name);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class PhysicalPrinterCollection;
|
friend class PhysicalPrinterCollection;
|
||||||
};
|
};
|
||||||
|
@ -622,10 +629,17 @@ public:
|
||||||
size_t get_selected_idx() const { return m_idx_selected; }
|
size_t get_selected_idx() const { return m_idx_selected; }
|
||||||
// Returns the name of the selected preset, or an empty string if no preset is selected.
|
// Returns the name of the selected preset, or an empty string if no preset is selected.
|
||||||
std::string get_selected_printer_name() const { return (m_idx_selected == size_t(-1)) ? std::string() : this->get_selected_printer().name; }
|
std::string get_selected_printer_name() const { return (m_idx_selected == size_t(-1)) ? std::string() : this->get_selected_printer().name; }
|
||||||
|
// Returns the full name of the selected preset, or an empty string if no preset is selected.
|
||||||
|
std::string get_selected_full_printer_name() const { return (m_idx_selected == size_t(-1)) ? std::string() : this->get_selected_printer().full_name; }
|
||||||
|
// Returns the printer model of the selected preset, or an empty string if no preset is selected.
|
||||||
|
std::string get_selected_printer_model() const { return (m_idx_selected == size_t(-1)) ? std::string() : this->get_selected_printer().get_printer_model(); }
|
||||||
|
// Returns the printer model of the selected preset, or an empty string if no preset is selected.
|
||||||
|
std::string get_selected_printer_preset_name() const { return (m_idx_selected == size_t(-1)) ? std::string() : this->get_selected_printer().get_preset_name(); }
|
||||||
|
// Returns the config of the selected preset, or nullptr if no preset is selected.
|
||||||
DynamicPrintConfig* get_selected_printer_config() { return (m_idx_selected == size_t(-1)) ? nullptr : &(this->get_selected_printer().config); }
|
DynamicPrintConfig* get_selected_printer_config() { return (m_idx_selected == size_t(-1)) ? nullptr : &(this->get_selected_printer().config); }
|
||||||
|
|
||||||
// select printer with name and return reference on it
|
// select printer with name and return reference on it
|
||||||
PhysicalPrinter& select_printer_by_name(const std::string& name);
|
PhysicalPrinter& select_printer_by_name(std::string name);
|
||||||
bool has_selection() const { return m_idx_selected != size_t(-1); }
|
bool has_selection() const { return m_idx_selected != size_t(-1); }
|
||||||
void unselect_printer() { m_idx_selected = size_t(-1); }
|
void unselect_printer() { m_idx_selected = size_t(-1); }
|
||||||
|
|
||||||
|
|
|
@ -104,6 +104,7 @@ PresetComboBox::PresetComboBox(wxWindow* parent, Preset::Type preset_type, const
|
||||||
m_bitmapCompatible = ScalableBitmap(this, "flag_green");
|
m_bitmapCompatible = ScalableBitmap(this, "flag_green");
|
||||||
m_bitmapIncompatible = ScalableBitmap(this, "flag_red");
|
m_bitmapIncompatible = ScalableBitmap(this, "flag_red");
|
||||||
m_bitmapLock = ScalableBitmap(this, "lock_closed");
|
m_bitmapLock = ScalableBitmap(this, "lock_closed");
|
||||||
|
m_bitmapLockDisabled = ScalableBitmap(this, "lock_closed", 16, true);
|
||||||
|
|
||||||
// parameters for an icon's drawing
|
// parameters for an icon's drawing
|
||||||
fill_width_height();
|
fill_width_height();
|
||||||
|
@ -125,6 +126,7 @@ void PresetComboBox::msw_rescale()
|
||||||
m_em_unit = em_unit(this);
|
m_em_unit = em_unit(this);
|
||||||
|
|
||||||
m_bitmapLock.msw_rescale();
|
m_bitmapLock.msw_rescale();
|
||||||
|
m_bitmapLockDisabled.msw_rescale();
|
||||||
m_bitmapIncompatible.msw_rescale();
|
m_bitmapIncompatible.msw_rescale();
|
||||||
m_bitmapCompatible.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) {
|
if (marker >= LABEL_ITEM_MARKER && marker < LABEL_ITEM_MAX) {
|
||||||
this->SetSelection(this->m_last_selected);
|
this->SetSelection(this->m_last_selected);
|
||||||
evt.StopPropagation();
|
evt.StopPropagation();
|
||||||
|
/*
|
||||||
if (marker == LABEL_ITEM_PHYSICAL_PRINTERS)
|
if (marker == LABEL_ITEM_PHYSICAL_PRINTERS)
|
||||||
{
|
{
|
||||||
PhysicalPrinterDialog dlg(wxEmptyString);
|
PhysicalPrinterDialog dlg(wxEmptyString);
|
||||||
|
@ -258,6 +261,19 @@ PlaterPresetComboBox::PlaterPresetComboBox(wxWindow *parent, Preset::Type preset
|
||||||
}
|
}
|
||||||
wxTheApp->CallAfter([sp]() { wxGetApp().run_wizard(ConfigWizard::RR_USER, sp); });
|
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() ) {
|
} else if (marker == LABEL_ITEM_PHYSICAL_PRINTER || this->m_last_selected != selected_item || m_collection->current_is_dirty() ) {
|
||||||
this->m_last_selected = selected_item;
|
this->m_last_selected = selected_item;
|
||||||
evt.SetInt(this->m_type);
|
evt.SetInt(this->m_type);
|
||||||
|
@ -377,6 +393,25 @@ bool PlaterPresetComboBox::switch_to_tab()
|
||||||
return true;
|
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()
|
void PlaterPresetComboBox::show_edit_menu()
|
||||||
{
|
{
|
||||||
wxMenu* menu = new wxMenu();
|
wxMenu* menu = new wxMenu();
|
||||||
|
@ -393,7 +428,7 @@ void PlaterPresetComboBox::show_edit_menu()
|
||||||
|
|
||||||
append_menu_item(menu, wxID_ANY, _L("Delete physical printer"), "",
|
append_menu_item(menu, wxID_ANY, _L("Delete physical printer"), "",
|
||||||
[this](wxCommandEvent&) {
|
[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())
|
if (printer_name.empty())
|
||||||
return;
|
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)
|
if (m_type == Preset::TYPE_PRINTER)
|
||||||
{
|
{
|
||||||
// add Physical printers, if any exists
|
// add Physical printers, if any exists
|
||||||
|
@ -608,7 +613,7 @@ void PlaterPresetComboBox::update()
|
||||||
bmp = m_bitmap_cache->insert(bitmap_key, bmps);
|
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() ||
|
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
|
// just in case: mark selected_preset_item as a first added element
|
||||||
selected_preset_item == INT_MAX)
|
selected_preset_item == INT_MAX)
|
||||||
|
@ -616,6 +621,7 @@ void PlaterPresetComboBox::update()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
// add LABEL_ITEM_PHYSICAL_PRINTERS
|
// add LABEL_ITEM_PHYSICAL_PRINTERS
|
||||||
std::string bitmap_key;
|
std::string bitmap_key;
|
||||||
if (wide_icons)
|
if (wide_icons)
|
||||||
|
@ -639,6 +645,37 @@ void PlaterPresetComboBox::update()
|
||||||
bmp = m_bitmap_cache->insert(bitmap_key, bmps);
|
bmp = m_bitmap_cache->insert(bitmap_key, bmps);
|
||||||
}
|
}
|
||||||
set_label_marker(Append(separator(L("Add physical printer")), *bmp), LABEL_ITEM_PHYSICAL_PRINTERS);
|
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
|
/* 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 selected_item = evt.GetSelection();
|
||||||
|
|
||||||
auto marker = reinterpret_cast<Marker>(this->GetClientData(selected_item));
|
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);
|
this->SetSelection(this->m_last_selected);
|
||||||
if (marker == LABEL_ITEM_WIZARD_PRINTERS)
|
if (marker == LABEL_ITEM_WIZARD_PRINTERS)
|
||||||
wxTheApp->CallAfter([this]() {
|
wxTheApp->CallAfter([this]() {
|
||||||
|
@ -710,7 +747,7 @@ void TabPresetComboBox::update()
|
||||||
|
|
||||||
const std::deque<Preset>& presets = m_collection->get_presets();
|
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 = "";
|
wxString selected = "";
|
||||||
if (!presets.front().is_visible)
|
if (!presets.front().is_visible)
|
||||||
set_label_marker(Append(separator(L("System presets")), wxNullBitmap));
|
set_label_marker(Append(separator(L("System presets")), wxNullBitmap));
|
||||||
|
@ -720,12 +757,23 @@ void TabPresetComboBox::update()
|
||||||
if (!preset.is_visible || (!show_incompatible && !preset.is_compatible && i != idx_selected))
|
if (!preset.is_visible || (!show_incompatible && !preset.is_compatible && i != idx_selected))
|
||||||
continue;
|
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";
|
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) {
|
if (m_type == Preset::TYPE_PRINTER) {
|
||||||
bitmap_key += "_printer";
|
bitmap_key += "_printer";
|
||||||
if (preset.printer_technology() == ptSLA)
|
if (preset.printer_technology() == ptSLA)
|
||||||
bitmap_key += "_sla";
|
bitmap_key += "_sla";
|
||||||
|
if (!is_enabled)
|
||||||
|
bitmap_key += "_disabled";
|
||||||
}
|
}
|
||||||
bitmap_key += preset.is_compatible ? ",cmpt" : ",ncmpt";
|
bitmap_key += preset.is_compatible ? ",cmpt" : ",ncmpt";
|
||||||
bitmap_key += (preset.is_system || preset.is_default) ? ",syst" : ",nsyst";
|
bitmap_key += (preset.is_system || preset.is_default) ? ",syst" : ",nsyst";
|
||||||
|
@ -737,13 +785,14 @@ void TabPresetComboBox::update()
|
||||||
std::vector<wxBitmap> bmps;
|
std::vector<wxBitmap> bmps;
|
||||||
bmps.emplace_back(m_type == Preset::TYPE_PRINTER ? main_bmp : preset.is_compatible ? m_bitmapCompatible.bmp() : m_bitmapIncompatible.bmp());
|
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.
|
// 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);
|
bmp = m_bitmap_cache->insert(bitmap_key, bmps);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preset.is_default || preset.is_system) {
|
if (preset.is_default || preset.is_system) {
|
||||||
Append(wxString::FromUTF8((preset.name + (preset.is_dirty ? Preset::suffix_modified() : "")).c_str()),
|
int item_id = Append(wxString::FromUTF8((preset.name + (preset.is_dirty ? Preset::suffix_modified() : "")).c_str()), !bmp ? main_bmp : *bmp);
|
||||||
(bmp == 0) ? main_bmp : *bmp);
|
if (!is_enabled)
|
||||||
|
set_label_marker(item_id, LABEL_ITEM_DISABLED);
|
||||||
if (i == idx_selected ||
|
if (i == idx_selected ||
|
||||||
// just in case: mark selected_preset_item as a first added element
|
// just in case: mark selected_preset_item as a first added element
|
||||||
selected_preset_item == INT_MAX)
|
selected_preset_item == INT_MAX)
|
||||||
|
@ -751,7 +800,8 @@ void TabPresetComboBox::update()
|
||||||
}
|
}
|
||||||
else
|
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)
|
if (i == idx_selected)
|
||||||
selected = wxString::FromUTF8((preset.name + (preset.is_dirty ? Preset::suffix_modified() : "")).c_str());
|
selected = wxString::FromUTF8((preset.name + (preset.is_dirty ? Preset::suffix_modified() : "")).c_str());
|
||||||
}
|
}
|
||||||
|
@ -761,8 +811,11 @@ void TabPresetComboBox::update()
|
||||||
if (!nonsys_presets.empty())
|
if (!nonsys_presets.empty())
|
||||||
{
|
{
|
||||||
set_label_marker(Append(separator(L("User presets")), wxNullBitmap));
|
set_label_marker(Append(separator(L("User presets")), wxNullBitmap));
|
||||||
for (std::map<wxString, wxBitmap*>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
|
for (std::map<wxString, std::pair<wxBitmap*, bool>>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
|
||||||
Append(it->first, *it->second);
|
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 ||
|
if (it->first == selected ||
|
||||||
// just in case: mark selected_preset_item as a first added element
|
// just in case: mark selected_preset_item as a first added element
|
||||||
selected_preset_item == INT_MAX)
|
selected_preset_item == INT_MAX)
|
||||||
|
@ -845,6 +898,17 @@ PhysicalPrinterDialog::PhysicalPrinterDialog(wxString printer_name)
|
||||||
int border = 10;
|
int border = 10;
|
||||||
|
|
||||||
m_printer_presets = new TabPresetComboBox(this, Preset::TYPE_PRINTER);
|
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) {
|
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());
|
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);
|
Preset* preset = wxGetApp().preset_bundle->printers.find_preset(selected_string);
|
||||||
|
@ -854,17 +918,22 @@ PhysicalPrinterDialog::PhysicalPrinterDialog(wxString printer_name)
|
||||||
preset = &edited_preset;
|
preset = &edited_preset;
|
||||||
m_printer.update_from_preset(*preset);
|
m_printer.update_from_preset(*preset);
|
||||||
|
|
||||||
|
update_printer_name();
|
||||||
|
|
||||||
// update values
|
// update values
|
||||||
m_optgroup->reload_config();
|
m_optgroup->reload_config();
|
||||||
update();
|
update();
|
||||||
});
|
});
|
||||||
m_printer_presets->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(); });
|
||||||
|
|
||||||
if (printer_name.IsEmpty())
|
wxStaticText* label_bottom = new wxStaticText(this, wxID_ANY, _("This printer name will be shown in the presets list") + ":");
|
||||||
printer_name = preset_name + " - "+_L("Physical Printer");
|
m_full_printer_name = new wxStaticText(this, wxID_ANY, "");
|
||||||
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;
|
PhysicalPrinterCollection& printers = wxGetApp().preset_bundle->physical_printers;
|
||||||
PhysicalPrinter* printer = printers.find_printer(into_u8(printer_name));
|
PhysicalPrinter* printer = printers.find_printer(into_u8(printer_name));
|
||||||
|
@ -887,8 +956,11 @@ PhysicalPrinterDialog::PhysicalPrinterDialog(wxString printer_name)
|
||||||
|
|
||||||
wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
|
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_name , 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border);
|
||||||
topSizer->Add(m_printer_presets , 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(m_optgroup->sizer , 1, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border);
|
||||||
topSizer->Add(btns , 0, wxEXPAND | wxALL, border);
|
topSizer->Add(btns , 0, wxEXPAND | wxALL, border);
|
||||||
|
|
||||||
|
@ -1053,6 +1125,15 @@ void PhysicalPrinterDialog::update()
|
||||||
this->Layout();
|
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)
|
void PhysicalPrinterDialog::on_dpi_changed(const wxRect& suggested_rect)
|
||||||
{
|
{
|
||||||
const int& em = em_unit();
|
const int& em = em_unit();
|
||||||
|
@ -1096,8 +1177,8 @@ void PhysicalPrinterDialog::OnOK(wxEvent& event)
|
||||||
printers.delete_printer(into_u8(printer_name));
|
printers.delete_printer(into_u8(printer_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
//upadte printer name, if it was changed
|
//update printer name, if it was changed
|
||||||
m_printer.name = into_u8(printer_name);
|
m_printer.set_name(into_u8(printer_name));
|
||||||
|
|
||||||
// save new physical printer
|
// save new physical printer
|
||||||
printers.save_printer(m_printer);
|
printers.save_printer(m_printer);
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
class wxString;
|
class wxString;
|
||||||
class wxTextCtrl;
|
class wxTextCtrl;
|
||||||
|
class wxStatictext;
|
||||||
class ScalableButton;
|
class ScalableButton;
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
@ -35,6 +36,7 @@ public:
|
||||||
|
|
||||||
enum LabelItemType {
|
enum LabelItemType {
|
||||||
LABEL_ITEM_PHYSICAL_PRINTER = 0xffffff01,
|
LABEL_ITEM_PHYSICAL_PRINTER = 0xffffff01,
|
||||||
|
LABEL_ITEM_DISABLED,
|
||||||
LABEL_ITEM_MARKER,
|
LABEL_ITEM_MARKER,
|
||||||
LABEL_ITEM_PHYSICAL_PRINTERS,
|
LABEL_ITEM_PHYSICAL_PRINTERS,
|
||||||
LABEL_ITEM_WIZARD_PRINTERS,
|
LABEL_ITEM_WIZARD_PRINTERS,
|
||||||
|
@ -66,6 +68,8 @@ protected:
|
||||||
ScalableBitmap m_bitmapIncompatible;
|
ScalableBitmap m_bitmapIncompatible;
|
||||||
// Indicator, that the preset is system and not modified.
|
// Indicator, that the preset is system and not modified.
|
||||||
ScalableBitmap m_bitmapLock;
|
ScalableBitmap m_bitmapLock;
|
||||||
|
// Disabled analogue of the m_bitmapLock .
|
||||||
|
ScalableBitmap m_bitmapLockDisabled;
|
||||||
|
|
||||||
int m_last_selected;
|
int m_last_selected;
|
||||||
int m_em_unit;
|
int m_em_unit;
|
||||||
|
@ -125,6 +129,7 @@ public:
|
||||||
|
|
||||||
bool is_selected_physical_printer();
|
bool is_selected_physical_printer();
|
||||||
bool switch_to_tab();
|
bool switch_to_tab();
|
||||||
|
void show_add_menu();
|
||||||
void show_edit_menu();
|
void show_edit_menu();
|
||||||
|
|
||||||
void update() override;
|
void update() override;
|
||||||
|
@ -142,6 +147,7 @@ private:
|
||||||
class TabPresetComboBox : public PresetComboBox
|
class TabPresetComboBox : public PresetComboBox
|
||||||
{
|
{
|
||||||
bool show_incompatible {false};
|
bool show_incompatible {false};
|
||||||
|
bool m_enable_all {false};
|
||||||
std::function<void(int)> on_selection_changed { nullptr };
|
std::function<void(int)> on_selection_changed { nullptr };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -156,6 +162,7 @@ public:
|
||||||
void msw_rescale() override;
|
void msw_rescale() override;
|
||||||
|
|
||||||
void set_selection_changed_function(std::function<void(int)> sel_changed) { on_selection_changed = sel_changed; }
|
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 };
|
DynamicPrintConfig* m_config { nullptr };
|
||||||
|
|
||||||
wxTextCtrl* m_printer_name { nullptr };
|
wxTextCtrl* m_printer_name { nullptr };
|
||||||
|
wxStaticText* m_full_printer_name { nullptr };
|
||||||
TabPresetComboBox* m_printer_presets { nullptr };
|
TabPresetComboBox* m_printer_presets { nullptr };
|
||||||
ConfigOptionsGroup* m_optgroup { nullptr };
|
ConfigOptionsGroup* m_optgroup { nullptr };
|
||||||
|
|
||||||
|
@ -178,6 +186,7 @@ class PhysicalPrinterDialog : public DPIDialog
|
||||||
|
|
||||||
void build_printhost_settings(ConfigOptionsGroup* optgroup);
|
void build_printhost_settings(ConfigOptionsGroup* optgroup);
|
||||||
void update();
|
void update();
|
||||||
|
void update_printer_name();
|
||||||
void OnOK(wxEvent& event);
|
void OnOK(wxEvent& event);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -162,10 +162,9 @@ void Tab::create_preset_tab()
|
||||||
// preset chooser
|
// preset chooser
|
||||||
m_presets_choice = new TabPresetComboBox(panel, m_type);
|
m_presets_choice = new TabPresetComboBox(panel, m_type);
|
||||||
m_presets_choice->set_selection_changed_function([this](int selection) {
|
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();
|
std::string selected_string = m_presets_choice->GetString(selection).ToUTF8().data();
|
||||||
|
update_physical_printers(selected_string);
|
||||||
|
// select preset
|
||||||
select_preset(selected_string);
|
select_preset(selected_string);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -763,6 +762,32 @@ void Tab::update_tab_ui()
|
||||||
m_presets_choice->update();
|
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.
|
// 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.
|
// 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)
|
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.
|
// 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.
|
// 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);
|
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.
|
// Add the new item into the UI component, remove dirty flags and activate the saved item.
|
||||||
update_tab_ui();
|
update_tab_ui();
|
||||||
// Update the selection boxes at the plater.
|
// Update the selection boxes at the plater.
|
||||||
|
|
|
@ -306,6 +306,7 @@ public:
|
||||||
void load_initial_data();
|
void load_initial_data();
|
||||||
void update_dirty();
|
void update_dirty();
|
||||||
void update_tab_ui();
|
void update_tab_ui();
|
||||||
|
void update_physical_printers(std::string preset_name);
|
||||||
void load_config(const DynamicPrintConfig& config);
|
void load_config(const DynamicPrintConfig& config);
|
||||||
virtual void reload_config();
|
virtual void reload_config();
|
||||||
void update_mode();
|
void update_mode();
|
||||||
|
|
|
@ -731,11 +731,12 @@ void MenuWithSeparators::SetSecondSeparator()
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
ScalableBitmap::ScalableBitmap( wxWindow *parent,
|
ScalableBitmap::ScalableBitmap( wxWindow *parent,
|
||||||
const std::string& icon_name/* = ""*/,
|
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_parent(parent), m_icon_name(icon_name),
|
||||||
m_px_cnt(px_cnt)
|
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
|
wxSize ScalableBitmap::GetBmpSize() const
|
||||||
|
@ -768,7 +769,7 @@ int ScalableBitmap::GetBmpHeight() const
|
||||||
|
|
||||||
void ScalableBitmap::msw_rescale()
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
|
@ -130,7 +130,8 @@ public:
|
||||||
ScalableBitmap() {};
|
ScalableBitmap() {};
|
||||||
ScalableBitmap( wxWindow *parent,
|
ScalableBitmap( wxWindow *parent,
|
||||||
const std::string& icon_name = "",
|
const std::string& icon_name = "",
|
||||||
const int px_cnt = 16);
|
const int px_cnt = 16,
|
||||||
|
const bool grayscale = false);
|
||||||
|
|
||||||
~ScalableBitmap() {}
|
~ScalableBitmap() {}
|
||||||
|
|
||||||
|
@ -151,6 +152,7 @@ private:
|
||||||
wxBitmap m_bmp = wxBitmap();
|
wxBitmap m_bmp = wxBitmap();
|
||||||
std::string m_icon_name = "";
|
std::string m_icon_name = "";
|
||||||
int m_px_cnt {16};
|
int m_px_cnt {16};
|
||||||
|
bool m_grayscale {false};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue