mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-12 04:41:48 +08:00
Config Wizard: Added check of the profile name for the custom printer.
#SPE-1344
This commit is contained in:
parent
dffca9c54a
commit
82b720eba1
@ -18,7 +18,7 @@ namespace GUI {
|
|||||||
//static ModePaletteComboBox::PalettesMap MODE_PALETTES =
|
//static ModePaletteComboBox::PalettesMap MODE_PALETTES =
|
||||||
static std::vector<std::pair<std::string, std::vector<std::string>>> MODE_PALETTES =
|
static std::vector<std::pair<std::string, std::vector<std::string>>> MODE_PALETTES =
|
||||||
{
|
{
|
||||||
{ L("Palette 1 (default)"), { "#7DF028", "#FFDC00", "#E70000" } },
|
{ L("Palette 1 (default)"), { "#00B000", "#FFDC00", "#E70000" } },
|
||||||
{ L("Palette 2"), { "#FC766A", "#B0B8B4", "#184A45" } },
|
{ L("Palette 2"), { "#FC766A", "#B0B8B4", "#184A45" } },
|
||||||
{ L("Palette 3"), { "#567572", "#964F4C", "#696667" } },
|
{ L("Palette 3"), { "#567572", "#964F4C", "#696667" } },
|
||||||
{ L("Palette 4"), { "#DA291C", "#56A8CB", "#53A567" } },
|
{ L("Palette 4"), { "#DA291C", "#56A8CB", "#53A567" } },
|
||||||
|
@ -1176,31 +1176,20 @@ PageCustom::PageCustom(ConfigWizard *parent)
|
|||||||
: ConfigWizardPage(parent, _L("Custom Printer Setup"), _L("Custom Printer"))
|
: ConfigWizardPage(parent, _L("Custom Printer Setup"), _L("Custom Printer"))
|
||||||
{
|
{
|
||||||
cb_custom = new wxCheckBox(this, wxID_ANY, _L("Define a custom printer profile"));
|
cb_custom = new wxCheckBox(this, wxID_ANY, _L("Define a custom printer profile"));
|
||||||
tc_profile_name = new wxTextCtrl(this, wxID_ANY, default_profile_name);
|
|
||||||
auto *label = new wxStaticText(this, wxID_ANY, _L("Custom profile name:"));
|
auto *label = new wxStaticText(this, wxID_ANY, _L("Custom profile name:"));
|
||||||
|
|
||||||
wxGetApp().UpdateDarkUI(tc_profile_name);
|
wxBoxSizer* profile_name_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
profile_name_editor = new SavePresetDialog::Item{ this, profile_name_sizer, default_profile_name };
|
||||||
|
profile_name_editor->Enable(false);
|
||||||
|
|
||||||
tc_profile_name->Enable(false);
|
cb_custom->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent &) {
|
||||||
tc_profile_name->Bind(wxEVT_KILL_FOCUS, [this](wxFocusEvent &evt) {
|
profile_name_editor->Enable(custom_wanted());
|
||||||
if (tc_profile_name->GetValue().IsEmpty()) {
|
|
||||||
if (profile_name_prev.IsEmpty()) { tc_profile_name->SetValue(default_profile_name); }
|
|
||||||
else { tc_profile_name->SetValue(profile_name_prev); }
|
|
||||||
} else {
|
|
||||||
profile_name_prev = tc_profile_name->GetValue();
|
|
||||||
}
|
|
||||||
evt.Skip();
|
|
||||||
});
|
|
||||||
|
|
||||||
cb_custom->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent &event) {
|
|
||||||
tc_profile_name->Enable(custom_wanted());
|
|
||||||
wizard_p()->on_custom_setup(custom_wanted());
|
wizard_p()->on_custom_setup(custom_wanted());
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
append(cb_custom);
|
append(cb_custom);
|
||||||
append(label);
|
append(label);
|
||||||
append(tc_profile_name);
|
append(profile_name_sizer);
|
||||||
}
|
}
|
||||||
|
|
||||||
PageUpdate::PageUpdate(ConfigWizard *parent)
|
PageUpdate::PageUpdate(ConfigWizard *parent)
|
||||||
@ -2825,7 +2814,7 @@ bool ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
|
|||||||
preset_bundle->load_presets(*app_config, ForwardCompatibilitySubstitutionRule::EnableSilentDisableSystem,
|
preset_bundle->load_presets(*app_config, ForwardCompatibilitySubstitutionRule::EnableSilentDisableSystem,
|
||||||
{preferred_model, preferred_variant, first_added_filament, first_added_sla_material});
|
{preferred_model, preferred_variant, first_added_filament, first_added_sla_material});
|
||||||
|
|
||||||
if (!only_sla_mode && page_custom->custom_wanted()) {
|
if (!only_sla_mode && page_custom->custom_wanted() && page_custom->is_valid_profile_name()) {
|
||||||
// if unsaved changes was not cheched till this moment
|
// if unsaved changes was not cheched till this moment
|
||||||
if (!check_unsaved_preset_changes &&
|
if (!check_unsaved_preset_changes &&
|
||||||
!wxGetApp().check_and_keep_current_preset_changes(caption, _L("Custom printer was installed and it will be activated."), act_btns, &apply_keeped_changes))
|
!wxGetApp().check_and_keep_current_preset_changes(caption, _L("Custom printer was installed and it will be activated."), act_btns, &apply_keeped_changes))
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "slic3r/Utils/PresetUpdater.hpp"
|
#include "slic3r/Utils/PresetUpdater.hpp"
|
||||||
#include "BedShapeDialog.hpp"
|
#include "BedShapeDialog.hpp"
|
||||||
#include "GUI.hpp"
|
#include "GUI.hpp"
|
||||||
|
#include "SavePresetDialog.hpp"
|
||||||
#include "wxExtensions.hpp"
|
#include "wxExtensions.hpp"
|
||||||
|
|
||||||
|
|
||||||
@ -370,16 +371,20 @@ struct PageMaterials: ConfigWizardPage
|
|||||||
struct PageCustom: ConfigWizardPage
|
struct PageCustom: ConfigWizardPage
|
||||||
{
|
{
|
||||||
PageCustom(ConfigWizard *parent);
|
PageCustom(ConfigWizard *parent);
|
||||||
|
~PageCustom() {
|
||||||
|
if (profile_name_editor)
|
||||||
|
delete profile_name_editor;
|
||||||
|
}
|
||||||
|
|
||||||
bool custom_wanted() const { return cb_custom->GetValue(); }
|
bool custom_wanted() const { return cb_custom->GetValue(); }
|
||||||
std::string profile_name() const { return into_u8(tc_profile_name->GetValue()); }
|
bool is_valid_profile_name() const { return profile_name_editor->is_valid();}
|
||||||
|
std::string profile_name() const { return profile_name_editor->preset_name(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const char* default_profile_name;
|
static const char* default_profile_name;
|
||||||
|
|
||||||
wxCheckBox *cb_custom;
|
wxCheckBox *cb_custom {nullptr};
|
||||||
wxTextCtrl *tc_profile_name;
|
SavePresetDialog::Item *profile_name_editor {nullptr};
|
||||||
wxString profile_name_prev;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ constexpr auto BORDER_W = 10;
|
|||||||
|
|
||||||
std::string SavePresetDialog::Item::get_init_preset_name(const std::string &suffix)
|
std::string SavePresetDialog::Item::get_init_preset_name(const std::string &suffix)
|
||||||
{
|
{
|
||||||
PresetBundle* preset_bundle = m_parent->get_preset_bundle();
|
PresetBundle* preset_bundle = dynamic_cast<SavePresetDialog*>(m_parent)->get_preset_bundle();
|
||||||
if (!preset_bundle)
|
if (!preset_bundle)
|
||||||
preset_bundle = wxGetApp().preset_bundle;
|
preset_bundle = wxGetApp().preset_bundle;
|
||||||
m_presets = &preset_bundle->get_presets(m_type);
|
m_presets = &preset_bundle->get_presets(m_type);
|
||||||
@ -50,13 +50,14 @@ std::string SavePresetDialog::Item::get_init_preset_name(const std::string &suff
|
|||||||
|
|
||||||
void SavePresetDialog::Item::init_input_name_ctrl(wxBoxSizer *input_name_sizer, const std::string preset_name)
|
void SavePresetDialog::Item::init_input_name_ctrl(wxBoxSizer *input_name_sizer, const std::string preset_name)
|
||||||
{
|
{
|
||||||
if (m_parent->is_for_rename()) {
|
if (m_use_text_ctrl) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
long style = wxBORDER_SIMPLE;
|
long style = wxBORDER_SIMPLE;
|
||||||
#else
|
#else
|
||||||
long style = 0L;
|
long style = 0L;
|
||||||
#endif
|
#endif
|
||||||
m_text_ctrl = new wxTextCtrl(m_parent, wxID_ANY, from_u8(preset_name), wxDefaultPosition, wxSize(35 * wxGetApp().em_unit(), -1), style);
|
m_text_ctrl = new wxTextCtrl(m_parent, wxID_ANY, from_u8(preset_name), wxDefaultPosition, wxSize(35 * wxGetApp().em_unit(), -1), style);
|
||||||
|
wxGetApp().UpdateDarkUI(m_text_ctrl);
|
||||||
m_text_ctrl->Bind(wxEVT_TEXT, [this](wxCommandEvent&) { update(); });
|
m_text_ctrl->Bind(wxEVT_TEXT, [this](wxCommandEvent&) { update(); });
|
||||||
|
|
||||||
input_name_sizer->Add(m_text_ctrl,1, wxEXPAND, BORDER_W);
|
input_name_sizer->Add(m_text_ctrl,1, wxEXPAND, BORDER_W);
|
||||||
@ -86,13 +87,14 @@ void SavePresetDialog::Item::init_input_name_ctrl(wxBoxSizer *input_name_sizer,
|
|||||||
|
|
||||||
wxString SavePresetDialog::Item::get_top_label_text() const
|
wxString SavePresetDialog::Item::get_top_label_text() const
|
||||||
{
|
{
|
||||||
const std::string label_str = m_parent->is_for_rename() ?_u8L("Rename %s to:") : _u8L("Save %s as:");
|
const std::string label_str = m_use_text_ctrl ?_u8L("Rename %s to:") : _u8L("Save %s as:");
|
||||||
Tab* tab = wxGetApp().get_tab(m_type);
|
Tab* tab = wxGetApp().get_tab(m_type);
|
||||||
return from_u8((boost::format(label_str) % into_u8(tab->title())).str());
|
return from_u8((boost::format(label_str) % into_u8(tab->title())).str());
|
||||||
}
|
}
|
||||||
|
|
||||||
SavePresetDialog::Item::Item(Preset::Type type, const std::string& suffix, wxBoxSizer* sizer, SavePresetDialog* parent):
|
SavePresetDialog::Item::Item(Preset::Type type, const std::string& suffix, wxBoxSizer* sizer, SavePresetDialog* parent):
|
||||||
m_type(type),
|
m_type(type),
|
||||||
|
m_use_text_ctrl(parent->is_for_rename()),
|
||||||
m_parent(parent),
|
m_parent(parent),
|
||||||
m_valid_bmp(new wxStaticBitmap(m_parent, wxID_ANY, *get_bmp_bundle("tick_mark"))),
|
m_valid_bmp(new wxStaticBitmap(m_parent, wxID_ANY, *get_bmp_bundle("tick_mark"))),
|
||||||
m_valid_label(new wxStaticText(m_parent, wxID_ANY, ""))
|
m_valid_label(new wxStaticText(m_parent, wxID_ANY, ""))
|
||||||
@ -110,15 +112,51 @@ SavePresetDialog::Item::Item(Preset::Type type, const std::string& suffix, wxBox
|
|||||||
sizer->Add(m_valid_label, 0, wxEXPAND | wxLEFT, 3*BORDER_W);
|
sizer->Add(m_valid_label, 0, wxEXPAND | wxLEFT, 3*BORDER_W);
|
||||||
|
|
||||||
if (m_type == Preset::TYPE_PRINTER)
|
if (m_type == Preset::TYPE_PRINTER)
|
||||||
m_parent->add_info_for_edit_ph_printer(sizer);
|
parent->add_info_for_edit_ph_printer(sizer);
|
||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SavePresetDialog::Item::Item(wxWindow* parent, wxBoxSizer* sizer, const std::string& def_name, PrinterTechnology pt /*= ptFFF*/):
|
||||||
|
m_preset_name(def_name),
|
||||||
|
m_printer_technology(pt),
|
||||||
|
m_parent(parent),
|
||||||
|
m_valid_bmp(new wxStaticBitmap(m_parent, wxID_ANY, *get_bmp_bundle("tick_mark"))),
|
||||||
|
m_valid_label(new wxStaticText(m_parent, wxID_ANY, ""))
|
||||||
|
{
|
||||||
|
m_valid_label->SetFont(wxGetApp().bold_font());
|
||||||
|
|
||||||
|
wxBoxSizer* input_name_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
input_name_sizer->Add(m_valid_bmp, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, BORDER_W);
|
||||||
|
init_input_name_ctrl(input_name_sizer, m_preset_name);
|
||||||
|
|
||||||
|
sizer->Add(input_name_sizer,0, wxEXPAND | wxBOTTOM, BORDER_W);
|
||||||
|
sizer->Add(m_valid_label, 0, wxEXPAND | wxLEFT, 3*BORDER_W);
|
||||||
|
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
const Preset* SavePresetDialog::Item::get_existing_preset() const
|
||||||
|
{
|
||||||
|
if (m_presets)
|
||||||
|
return m_presets->find_preset(m_preset_name, false);
|
||||||
|
|
||||||
|
const std::vector<Preset::Type> types = m_printer_technology == ptFFF ?
|
||||||
|
std::initializer_list{Preset::TYPE_PRINTER, Preset::TYPE_PRINT, Preset::TYPE_FILAMENT } :
|
||||||
|
std::initializer_list{Preset::TYPE_PRINTER, Preset::TYPE_SLA_PRINT, Preset::TYPE_SLA_MATERIAL };
|
||||||
|
|
||||||
|
for (auto type : types) {
|
||||||
|
const PresetCollection& presets = wxGetApp().preset_bundle->get_presets(type);
|
||||||
|
if (const Preset* preset = presets.find_preset(m_preset_name, false))
|
||||||
|
return preset;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void SavePresetDialog::Item::update()
|
void SavePresetDialog::Item::update()
|
||||||
{
|
{
|
||||||
bool rename = m_parent->is_for_rename();
|
m_preset_name = into_u8(m_use_text_ctrl ? m_text_ctrl->GetValue() : m_combo->GetValue());
|
||||||
m_preset_name = into_u8(rename ? m_text_ctrl->GetValue() : m_combo->GetValue());
|
|
||||||
|
|
||||||
m_valid_type = ValidationType::Valid;
|
m_valid_type = ValidationType::Valid;
|
||||||
wxString info_line;
|
wxString info_line;
|
||||||
@ -138,7 +176,7 @@ void SavePresetDialog::Item::update()
|
|||||||
if (m_valid_type == ValidationType::Valid && m_preset_name.find(unusable_suffix) != std::string::npos) {
|
if (m_valid_type == ValidationType::Valid && m_preset_name.find(unusable_suffix) != std::string::npos) {
|
||||||
info_line = _L("The supplied name is not valid;") + "\n" +
|
info_line = _L("The supplied name is not valid;") + "\n" +
|
||||||
_L("the following suffix is not allowed:") + "\n\t" +
|
_L("the following suffix is not allowed:") + "\n\t" +
|
||||||
from_u8(PresetCollection::get_suffix_modified());
|
from_u8(unusable_suffix);
|
||||||
m_valid_type = ValidationType::NoValid;
|
m_valid_type = ValidationType::NoValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,24 +185,25 @@ void SavePresetDialog::Item::update()
|
|||||||
m_valid_type = ValidationType::NoValid;
|
m_valid_type = ValidationType::NoValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Preset* existing = m_presets->find_preset(m_preset_name, false);
|
const Preset* existing = get_existing_preset();
|
||||||
if (m_valid_type == ValidationType::Valid && existing && (existing->is_default || existing->is_system)) {
|
if (m_valid_type == ValidationType::Valid && existing && (existing->is_default || existing->is_system)) {
|
||||||
info_line = rename ? _L("The supplied name is used for a system profile.") :
|
info_line = m_use_text_ctrl ? _L("The supplied name is used for a system profile.") :
|
||||||
_L("Cannot overwrite a system profile.");
|
_L("Cannot overwrite a system profile.");
|
||||||
m_valid_type = ValidationType::NoValid;
|
m_valid_type = ValidationType::NoValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_valid_type == ValidationType::Valid && existing && (existing->is_external)) {
|
if (m_valid_type == ValidationType::Valid && existing && (existing->is_external)) {
|
||||||
info_line = rename ? _L("The supplied name is used for a external profile.") :
|
info_line = m_use_text_ctrl ? _L("The supplied name is used for a external profile.") :
|
||||||
_L("Cannot overwrite an external profile.");
|
_L("Cannot overwrite an external profile.");
|
||||||
m_valid_type = ValidationType::NoValid;
|
m_valid_type = ValidationType::NoValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SavePresetDialog* dlg = dynamic_cast<SavePresetDialog*>(m_parent);
|
||||||
if (m_valid_type == ValidationType::Valid && existing)
|
if (m_valid_type == ValidationType::Valid && existing)
|
||||||
{
|
{
|
||||||
if (m_preset_name == m_presets->get_selected_preset_name()) {
|
if (m_presets && m_preset_name == m_presets->get_selected_preset_name()) {
|
||||||
if ((!rename && m_presets->get_edited_preset().is_dirty) ||
|
if ((!m_use_text_ctrl && m_presets->get_edited_preset().is_dirty) ||
|
||||||
m_parent->get_preset_bundle()) // means that we save modifications from the DiffDialog
|
(dlg && dlg->get_preset_bundle())) // means that we save modifications from the DiffDialog
|
||||||
info_line = _L("Save preset modifications to existing user profile");
|
info_line = _L("Save preset modifications to existing user profile");
|
||||||
else
|
else
|
||||||
info_line = _L("Nothing changed");
|
info_line = _L("Nothing changed");
|
||||||
@ -191,7 +230,7 @@ void SavePresetDialog::Item::update()
|
|||||||
const int max_path_length = 255;
|
const int max_path_length = 255;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (m_valid_type == ValidationType::Valid && m_presets->path_from_name(m_preset_name).length() >= max_path_length) {
|
if (m_valid_type == ValidationType::Valid && m_presets && m_presets->path_from_name(m_preset_name).length() >= max_path_length) {
|
||||||
info_line = _L("The name is too long.");
|
info_line = _L("The name is too long.");
|
||||||
m_valid_type = ValidationType::NoValid;
|
m_valid_type = ValidationType::NoValid;
|
||||||
}
|
}
|
||||||
@ -206,23 +245,23 @@ void SavePresetDialog::Item::update()
|
|||||||
m_valid_type = ValidationType::NoValid;
|
m_valid_type = ValidationType::NoValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_valid_type == ValidationType::Valid && m_presets->get_preset_name_by_alias(m_preset_name) != m_preset_name) {
|
if (m_valid_type == ValidationType::Valid && m_presets && m_presets->get_preset_name_by_alias(m_preset_name) != m_preset_name) {
|
||||||
info_line = _L("The name cannot be the same as a preset alias name.");
|
info_line = _L("The name cannot be the same as a preset alias name.");
|
||||||
m_valid_type = ValidationType::NoValid;
|
m_valid_type = ValidationType::NoValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_parent->get_info_line_extention().IsEmpty() && m_valid_type != ValidationType::NoValid)
|
if ((dlg && !dlg->get_info_line_extention().IsEmpty()) && m_valid_type != ValidationType::NoValid)
|
||||||
info_line += "\n\n" + m_parent->get_info_line_extention();
|
info_line += "\n\n" + dlg->get_info_line_extention();
|
||||||
|
|
||||||
m_valid_label->SetLabel(info_line);
|
m_valid_label->SetLabel(info_line);
|
||||||
m_valid_label->Show(!info_line.IsEmpty());
|
m_valid_label->Show(!info_line.IsEmpty());
|
||||||
|
|
||||||
update_valid_bmp();
|
update_valid_bmp();
|
||||||
|
|
||||||
if (m_type == Preset::TYPE_PRINTER)
|
if (dlg && m_type == Preset::TYPE_PRINTER)
|
||||||
m_parent->update_info_for_edit_ph_printer(m_preset_name);
|
dlg->update_info_for_edit_ph_printer(m_preset_name);
|
||||||
|
|
||||||
m_parent->layout();
|
m_parent->Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SavePresetDialog::Item::update_valid_bmp()
|
void SavePresetDialog::Item::update_valid_bmp()
|
||||||
@ -238,6 +277,13 @@ void SavePresetDialog::Item::accept()
|
|||||||
m_presets->delete_preset(m_preset_name);
|
m_presets->delete_preset(m_preset_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SavePresetDialog::Item::Enable(bool enable /*= true*/)
|
||||||
|
{
|
||||||
|
m_valid_label->Enable(enable);
|
||||||
|
m_valid_bmp->Enable(enable);
|
||||||
|
m_use_text_ctrl ? m_text_ctrl->Enable(enable) : m_combo->Enable(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
// SavePresetDialog
|
// SavePresetDialog
|
||||||
@ -398,10 +444,11 @@ void SavePresetDialog::update_info_for_edit_ph_printer(const std::string& preset
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SavePresetDialog::layout()
|
bool SavePresetDialog::Layout()
|
||||||
{
|
{
|
||||||
this->Layout();
|
const bool ret = DPIDialog::Layout();
|
||||||
this->Fit();
|
this->Fit();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SavePresetDialog::on_dpi_changed(const wxRect& suggested_rect)
|
void SavePresetDialog::on_dpi_changed(const wxRect& suggested_rect)
|
||||||
|
@ -26,7 +26,7 @@ class SavePresetDialog : public DPIDialog
|
|||||||
Switch,
|
Switch,
|
||||||
UndefAction
|
UndefAction
|
||||||
};
|
};
|
||||||
|
public:
|
||||||
struct Item
|
struct Item
|
||||||
{
|
{
|
||||||
enum class ValidationType
|
enum class ValidationType
|
||||||
@ -37,20 +37,24 @@ class SavePresetDialog : public DPIDialog
|
|||||||
};
|
};
|
||||||
|
|
||||||
Item(Preset::Type type, const std::string& suffix, wxBoxSizer* sizer, SavePresetDialog* parent);
|
Item(Preset::Type type, const std::string& suffix, wxBoxSizer* sizer, SavePresetDialog* parent);
|
||||||
|
Item(wxWindow* parent, wxBoxSizer* sizer, const std::string& def_name, PrinterTechnology pt = ptFFF);
|
||||||
|
|
||||||
void update_valid_bmp();
|
void update_valid_bmp();
|
||||||
void accept();
|
void accept();
|
||||||
|
void Enable(bool enable = true);
|
||||||
|
|
||||||
bool is_valid() const { return m_valid_type != ValidationType::NoValid; }
|
bool is_valid() const { return m_valid_type != ValidationType::NoValid; }
|
||||||
Preset::Type type() const { return m_type; }
|
Preset::Type type() const { return m_type; }
|
||||||
std::string preset_name() const { return m_preset_name; }
|
std::string preset_name() const { return m_preset_name; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Preset::Type m_type;
|
Preset::Type m_type {Preset::TYPE_INVALID};
|
||||||
std::string m_preset_name;
|
std::string m_preset_name;
|
||||||
|
bool m_use_text_ctrl {true};
|
||||||
|
|
||||||
|
PrinterTechnology m_printer_technology {ptAny};
|
||||||
ValidationType m_valid_type {ValidationType::NoValid};
|
ValidationType m_valid_type {ValidationType::NoValid};
|
||||||
SavePresetDialog* m_parent {nullptr};
|
wxWindow* m_parent {nullptr};
|
||||||
wxStaticBitmap* m_valid_bmp {nullptr};
|
wxStaticBitmap* m_valid_bmp {nullptr};
|
||||||
wxComboBox* m_combo {nullptr};
|
wxComboBox* m_combo {nullptr};
|
||||||
wxTextCtrl* m_text_ctrl {nullptr};
|
wxTextCtrl* m_text_ctrl {nullptr};
|
||||||
@ -60,11 +64,12 @@ class SavePresetDialog : public DPIDialog
|
|||||||
|
|
||||||
std::string get_init_preset_name(const std::string &suffix);
|
std::string get_init_preset_name(const std::string &suffix);
|
||||||
void init_input_name_ctrl(wxBoxSizer *input_name_sizer, std::string preset_name);
|
void init_input_name_ctrl(wxBoxSizer *input_name_sizer, std::string preset_name);
|
||||||
wxString get_top_label_text() const ;
|
const Preset* get_existing_preset() const ;
|
||||||
|
wxString get_top_label_text() const ;
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
};
|
};
|
||||||
|
private:
|
||||||
std::vector<Item*> m_items;
|
std::vector<Item*> m_items;
|
||||||
|
|
||||||
wxBoxSizer* m_presets_sizer {nullptr};
|
wxBoxSizer* m_presets_sizer {nullptr};
|
||||||
@ -97,7 +102,7 @@ public:
|
|||||||
bool enable_ok_btn() const;
|
bool enable_ok_btn() const;
|
||||||
void add_info_for_edit_ph_printer(wxBoxSizer *sizer);
|
void add_info_for_edit_ph_printer(wxBoxSizer *sizer);
|
||||||
void update_info_for_edit_ph_printer(const std::string &preset_name);
|
void update_info_for_edit_ph_printer(const std::string &preset_name);
|
||||||
void layout();
|
bool Layout() override;
|
||||||
bool is_for_rename() { return m_use_for_rename; }
|
bool is_for_rename() { return m_use_for_rename; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user