OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::PageFirmware Struct Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/ConfigWizard_private.hpp>

Inheritance diagram for Slic3r::GUI::PageFirmware:
Collaboration diagram for Slic3r::GUI::PageFirmware:

Public Member Functions

 PageFirmware (ConfigWizard *parent)
virtual void apply_custom_config (DynamicPrintConfig &config)
template<class T>
T * append (T *thing, int proportion=0, int flag=wxEXPAND|wxTOP|wxBOTTOM, int border=10)
wxStaticText * append_text (wxString text)
void append_spacer (int space)
ConfigWizard::priv * wizard_p () const
virtual void set_run_reason (ConfigWizard::RunReason run_reason)
virtual void on_activate ()

Public Attributes

const ConfigOptionDef & gcode_opt
wxChoice * gcode_picker
ConfigWizard * parent
const wxString shortname
wxBoxSizer * content
const unsigned indent

Detailed Description

Constructor & Destructor Documentation

◆ PageFirmware()

Slic3r::GUI::PageFirmware::PageFirmware ( ConfigWizard * parent)
1248 : ConfigWizardPage(parent, _L("Firmware Type"), _L("Firmware"), 1)
1249 , gcode_opt(*print_config_def.get("gcode_flavor"))
1250 , gcode_picker(nullptr)
1251{
1252 append_text(_L("Choose the type of firmware used by your printer."));
1253 append_text(_(gcode_opt.tooltip));
1254
1255 wxArrayString choices;
1256 choices.Alloc(gcode_opt.enum_labels.size());
1257 for (const auto &label : gcode_opt.enum_labels) {
1258 choices.Add(label);
1259 }
1260
1261 gcode_picker = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, choices);
1262 wxGetApp().UpdateDarkUI(gcode_picker);
1263 const auto &enum_values = gcode_opt.enum_values;
1264 auto needle = enum_values.cend();
1265 if (gcode_opt.default_value) {
1266 needle = std::find(enum_values.cbegin(), enum_values.cend(), gcode_opt.default_value->serialize());
1267 }
1268 if (needle != enum_values.cend()) {
1269 gcode_picker->SetSelection(needle - enum_values.cbegin());
1270 } else {
1271 gcode_picker->SetSelection(0);
1272 }
1273
1275}
#define _(s)
Definition 3mf.cpp:306
#define _L(s)
Definition OBJ.cpp:34
const ConfigOptionDef * get(const t_config_option_key &opt_key) const
Definition Config.hpp:2662
const PrintConfigDef print_config_def
Definition PrintConfig.cpp:10099
T * append(T *thing, int proportion=0, int flag=wxEXPAND|wxTOP|wxBOTTOM, int border=10)
Definition ConfigWizard_private.hpp:227
ConfigWizard * parent
Definition ConfigWizard_private.hpp:218
ConfigWizardPage(ConfigWizard *parent, wxString title, wxString shortname, unsigned indent=0)
Definition ConfigWizard.cpp:477
wxStaticText * append_text(wxString text)
Definition ConfigWizard.cpp:512
wxChoice * gcode_picker
Definition ConfigWizard_private.hpp:443
const ConfigOptionDef & gcode_opt
Definition ConfigWizard_private.hpp:442

References Slic3r::GUI::ConfigWizardPage::ConfigWizardPage(), _, _L, Slic3r::GUI::ConfigWizardPage::append(), Slic3r::GUI::ConfigWizardPage::append_text(), gcode_opt, gcode_picker, Slic3r::GUI::ConfigWizardPage::parent, and Slic3r::print_config_def.

Here is the call graph for this function:

Member Function Documentation

◆ append()

template<class T>
T * Slic3r::GUI::ConfigWizardPage::append ( T * thing,
int proportion = 0,
int flag = wxEXPAND|wxTOP|wxBOTTOM,
int border = 10 )
inlineinherited
228 {
229 content->Add(thing, proportion, flag, border);
230 return thing;
231 }
wxBoxSizer * content
Definition ConfigWizard_private.hpp:220

References content.

Referenced by Slic3r::GUI::PageBedShape::PageBedShape(), Slic3r::GUI::PageCustom::PageCustom(), Slic3r::GUI::PageDiameters::PageDiameters(), Slic3r::GUI::PageFirmware::PageFirmware(), Slic3r::GUI::PageMaterials::PageMaterials(), Slic3r::GUI::PagePrinters::PagePrinters(), Slic3r::GUI::PageTemperatures::PageTemperatures(), Slic3r::GUI::PageWelcome::PageWelcome(), and append_text().

Here is the caller graph for this function:

◆ append_spacer()

void Slic3r::GUI::ConfigWizardPage::append_spacer ( int space)
inherited
522{
523 // FIXME: scaling
524 content->AddSpacer(space);
525}

References content.

Referenced by Slic3r::GUI::PageDiameters::PageDiameters(), Slic3r::GUI::PageMaterials::PageMaterials(), and Slic3r::GUI::PageTemperatures::PageTemperatures().

Here is the caller graph for this function:

◆ append_text()

wxStaticText * Slic3r::GUI::ConfigWizardPage::append_text ( wxString text)
inherited
513{
514 auto *widget = new wxStaticText(this, wxID_ANY, text, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
515 widget->Wrap(WRAP_WIDTH);
516 widget->SetMinSize(wxSize(WRAP_WIDTH, -1));
517 append(widget);
518 return widget;
519}
class WXDLLIMPEXP_FWD_CORE wxStaticText
Definition ProgressDialog.hpp:30
@ WRAP_WIDTH
Definition ConfigWizard_private.hpp:50

References append(), Slic3r::GUI::WRAP_WIDTH, and wxStaticText.

Referenced by Slic3r::GUI::PageBedShape::PageBedShape(), Slic3r::GUI::PageDiameters::PageDiameters(), Slic3r::GUI::PageFirmware::PageFirmware(), Slic3r::GUI::PageTemperatures::PageTemperatures(), and Slic3r::GUI::PageWelcome::PageWelcome().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ apply_custom_config()

void Slic3r::GUI::PageFirmware::apply_custom_config ( DynamicPrintConfig & config)
virtual

Reimplemented from Slic3r::GUI::ConfigWizardPage.

1278{
1279 auto sel = gcode_picker->GetSelection();
1280
1281 // Safety check: ensure selection index is within bounds
1282 if (sel >= 0 && (size_t) sel < gcode_opt.enum_values.size()) {
1283 std::string selected_flavor_str = gcode_opt.enum_values[sel];
1284 // Ensure the default value exists to prevent null pointer crashes
1285 if (gcode_opt.default_value) {
1286 //Clone the fully initialized option (preserves the dictionary map)
1287 ConfigOption* opt = gcode_opt.default_value->clone();
1288 // Deserialize the string safely
1289 opt->deserialize(selected_flavor_str);
1290 // Save it to the printer configuration
1291 config.set_key_value("gcode_flavor", opt);
1292 }
1293 }
1294}

References gcode_opt, gcode_picker, and Slic3r::DynamicConfig::set_key_value().

Here is the call graph for this function:

◆ on_activate()

virtual void Slic3r::GUI::ConfigWizardPage::on_activate ( )
inlinevirtualinherited

Reimplemented in Slic3r::GUI::PageMaterials.

240{}

◆ set_run_reason()

virtual void Slic3r::GUI::ConfigWizardPage::set_run_reason ( ConfigWizard::RunReason run_reason)
inlinevirtualinherited

◆ wizard_p()

ConfigWizard::priv * Slic3r::GUI::ConfigWizardPage::wizard_p ( ) const
inlineinherited
236{ return parent->p.get(); }

References parent.

Referenced by Slic3r::GUI::PageBedShape::PageBedShape(), Slic3r::GUI::PageCustom::PageCustom(), Slic3r::GUI::PagePrinters::PagePrinters(), Slic3r::GUI::PageMaterials::on_activate(), Slic3r::GUI::PageMaterials::select_material(), and Slic3r::GUI::PageMaterials::update_lists().

Here is the caller graph for this function:

Member Data Documentation

◆ content

wxBoxSizer* Slic3r::GUI::ConfigWizardPage::content
inherited

◆ gcode_opt

const ConfigOptionDef& Slic3r::GUI::PageFirmware::gcode_opt

◆ gcode_picker

wxChoice* Slic3r::GUI::PageFirmware::gcode_picker

◆ indent

const unsigned Slic3r::GUI::ConfigWizardPage::indent
inherited

◆ parent

◆ shortname


The documentation for this struct was generated from the following files: