Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::GUI::Choice Class Reference

#include <src/slic3r/GUI/Field.hpp>

+ Inheritance diagram for Slic3r::GUI::Choice:
+ Collaboration diagram for Slic3r::GUI::Choice:

Public Member Functions

 Choice (const ConfigOptionDef &opt, const t_config_option_key &id)
 
 Choice (wxWindow *parent, const ConfigOptionDef &opt, const t_config_option_key &id)
 
 ~Choice ()
 
void BUILD () override
 Finish constructing the Field's wxWidget-related properties, including setting its own sizer, etc.
 
void propagate_value ()
 
void set_selection ()
 
void set_value (const std::string &value, bool change_event=false)
 Redundant?
 
void set_value (const boost::any &value, bool change_event=false) override
 Sets a value for this control. subclasses should overload with a specific version Postcondition: Method does not fire the on_change event.
 
void set_values (const std::vector< std::string > &values)
 it's needed for _update_serial_ports()
 
void set_values (const wxArrayString &values)
 
boost::any & get_value () override
 Gets a boost::any representing this control. subclasses should overload with a specific version.
 
void msw_rescale () override
 
void enable () override
 
void disable () override
 
wxWindow * getWindow () override
 
void suppress_scroll ()
 
void on_back_to_initial_value ()
 Call the attached m_back_to_initial_value method.
 
void on_back_to_sys_value ()
 Call the attached m_back_to_sys_value method.
 
virtual void set_last_meaningful_value ()
 
virtual void set_na_value ()
 
void toggle (bool en)
 Fires the enable or disable function, based on the input.
 
virtual wxString get_tooltip_text (const wxString &default_string)
 
void field_changed ()
 
virtual wxSizer * getSizer ()
 If you don't know what you are getting back, check both methods for nullptr.
 
bool is_matched (const std::string &string, const std::string &pattern)
 
void get_value_by_opt_type (wxString &str, const bool check_value=true)
 
virtual void sys_color_changed ()
 
bool get_enter_pressed () const
 
void set_enter_pressed (bool pressed)
 
bool set_undo_bitmap (const ScalableBitmap *bmp)
 
bool set_undo_to_sys_bitmap (const ScalableBitmap *bmp)
 
bool set_label_colour (const wxColour *clr)
 
bool set_undo_tooltip (const wxString *tip)
 
bool set_undo_to_sys_tooltip (const wxString *tip)
 
bool has_undo_ui () const
 
const wxBitmapBundle & undo_bitmap () const
 
const wxString * undo_tooltip () const
 
const wxBitmapBundle & undo_to_sys_bitmap () const
 
const wxString * undo_to_sys_tooltip () const
 
const wxColour * label_color () const
 
const bool blink () const
 
bool * get_blink_ptr ()
 

Static Public Member Functions

template<class T >
static t_field Create (wxWindow *parent, const ConfigOptionDef &opt, const t_config_option_key &id)
 Factory method for generating new derived classes.
 
static int def_width ()
 
static int def_width_wider ()
 
static int def_width_thinner ()
 

Public Attributes

wxWindow * window { nullptr }
 
bool m_is_editable { false }
 
bool m_is_dropped { false }
 
bool m_suppress_scroll { false }
 
int m_last_selected { wxNOT_FOUND }
 
wxWindow * m_parent {nullptr}
 parent wx item, opportunity to refactor (probably not necessary - data duplication)
 
t_kill_focus m_on_kill_focus {nullptr}
 Function object to store callback passed in from owning object.
 
t_change m_on_change {nullptr}
 Function object to store callback passed in from owning object.
 
t_back_to_init m_back_to_initial_value { nullptr }
 Function object to store callback passed in from owning object.
 
t_back_to_init m_back_to_sys_value { nullptr }
 
bool m_disable_change_event {false}
 
bool m_is_modified_value {false}
 
bool m_is_nonsys_value {true}
 
const ConfigOptionDef m_opt {ConfigOptionDef()}
 Copy of ConfigOption for deduction purposes.
 
const t_config_option_key m_opt_id
 
int m_opt_idx = 0
 {""};
 
double opt_height { 0.0 }
 
bool parent_is_custom_ctrl { false }
 

Protected Member Functions

virtual void PostInitialize ()
 
void on_kill_focus ()
 Call the attached on_kill_focus method. It's important to use wxEvent instead of wxFocusEvent, in another case we can't unfocused control at all.
 
void on_change_field ()
 Call the attached on_change method.
 

Protected Attributes

boost::any m_value
 
boost::any m_last_meaningful_value
 
int m_em_unit
 
bool bEnterPressed = false
 

Private Member Functions

 Field (const ConfigOptionDef &opt, const t_config_option_key &id)
 
 Field (wxWindow *parent, const ConfigOptionDef &opt, const t_config_option_key &id)
 

Private Attributes

UndoValueUI m_undo_ui
 

Detailed Description

Constructor & Destructor Documentation

◆ Choice() [1/2]

Slic3r::GUI::Choice::Choice ( const ConfigOptionDef opt,
const t_config_option_key id 
)
inline
357: Field(opt, id) {}
Field(const ConfigOptionDef &opt, const t_config_option_key &id)
Definition Field.hpp:199

◆ Choice() [2/2]

Slic3r::GUI::Choice::Choice ( wxWindow *  parent,
const ConfigOptionDef opt,
const t_config_option_key id 
)
inline
358: Field(parent, opt, id) {}

◆ ~Choice()

Slic3r::GUI::Choice::~Choice ( )
inline
359{}

Member Function Documentation

◆ blink()

const bool Slic3r::GUI::UndoValueUIManager::blink ( ) const
inlineinherited
115{ return m_undo_ui.blink; }
UndoValueUI m_undo_ui
Definition Field.hpp:96

References Slic3r::GUI::UndoValueUIManager::UndoValueUI::blink, and Slic3r::GUI::UndoValueUIManager::m_undo_ui.

Referenced by Slic3r::GUI::OG_CustomCtrl::CtrlLine::render().

+ Here is the caller graph for this function:

◆ BUILD()

void Slic3r::GUI::Choice::BUILD ( )
overridevirtual

Finish constructing the Field's wxWidget-related properties, including setting its own sizer, etc.

Implements Slic3r::GUI::Field.

985 {
986 wxSize size(def_width_wider() * m_em_unit, wxDefaultCoord);
987 if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit);
988 if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit);
989
990 choice_ctrl* temp;
993 m_is_editable = true;
994 temp = new choice_ctrl(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr, wxTE_PROCESS_ENTER);
995 }
996 else {
997#ifdef __WXOSX__
998 /* wxBitmapComboBox with wxCB_READONLY style return NULL for GetTextCtrl(),
999 * so ToolTip doesn't shown.
1000 * Next workaround helps to solve this problem
1001 */
1002 temp = new choice_ctrl();
1003 temp->SetTextCtrlStyle(wxTE_READONLY);
1004 temp->Create(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr);
1005#else
1006 temp = new choice_ctrl(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr, wxCB_READONLY);
1007#endif //__WXOSX__
1008 }
1009
1010#ifdef __WXGTK3__
1011 wxSize best_sz = temp->GetBestSize();
1012 if (best_sz.x > size.x)
1013 temp->SetSize(best_sz);
1014#endif //__WXGTK3__
1015
1016 temp->SetFont(Slic3r::GUI::wxGetApp().normal_font());
1017 if (!wxOSX) temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
1018
1019 // recast as a wxWindow to fit the calling convention
1020 window = dynamic_cast<wxWindow*>(temp);
1021
1022 if (m_opt.enum_def) {
1023 if (auto& labels = m_opt.enum_def->labels(); !labels.empty()) {
1024 bool localized = m_opt.enum_def->has_labels();
1025 for (const std::string& el : labels)
1026 temp->Append(localized ? _(from_u8(el)) : from_u8(el));
1027 set_selection();
1028 }
1029 }
1030
1031 temp->Bind(wxEVT_MOUSEWHEEL, [this](wxMouseEvent& e) {
1033 e.StopPropagation();
1034 else
1035 e.Skip();
1036 });
1037 temp->Bind(wxEVT_COMBOBOX_DROPDOWN, [this](wxCommandEvent&) { m_is_dropped = true; });
1038 temp->Bind(wxEVT_COMBOBOX_CLOSEUP, [this](wxCommandEvent&) { m_is_dropped = false; });
1039
1040 temp->Bind(wxEVT_COMBOBOX, [this](wxCommandEvent&) { on_change_field(); }, temp->GetId());
1041
1042 if (m_is_editable) {
1043 temp->Bind(wxEVT_KILL_FOCUS, [this](wxEvent& e) {
1044 e.Skip();
1045 if (!bEnterPressed)
1047 } );
1048
1049 temp->Bind(wxEVT_TEXT_ENTER, [this](wxEvent& e) {
1050 EnterPressed enter(this);
1052 } );
1053 }
1054
1055 temp->SetToolTip(get_tooltip_text(temp->GetValue()));
1056}
#define wxOSX
Definition Field.cpp:26
Slic3r::clonable_ptr< ConfigOptionEnumDef > enum_def
Definition Config.hpp:1959
int width
Definition Config.hpp:1943
GUIType gui_type
Definition Config.hpp:1904
int height
Definition Config.hpp:1941
wxWindow * window
Definition Field.hpp:361
bool m_is_editable
Definition Field.hpp:369
bool m_suppress_scroll
Definition Field.hpp:371
void propagate_value()
Definition Field.cpp:1058
void set_selection()
Definition Field.cpp:1099
bool m_is_dropped
Definition Field.hpp:370
static int def_width_wider()
Definition Field.cpp:147
virtual wxString get_tooltip_text(const wxString &default_string)
Definition Field.cpp:176
void on_change_field()
Call the attached on_change method.
Definition Field.cpp:157
bool bEnterPressed
Definition Field.hpp:238
int m_em_unit
Definition Field.hpp:236
wxWindow * m_parent
parent wx item, opportunity to refactor (probably not necessary - data duplication)
Definition Field.hpp:153
const ConfigOptionDef m_opt
Copy of ConfigOption for deduction purposes.
Definition Field.hpp:171
#define _(msgid)
Definition getopt.c:87
wxComboBox choice_ctrl
Definition Field.cpp:981
wxString from_u8(const std::string &str)
Definition GUI.cpp:437
constexpr auto size(const C &c) -> decltype(c.size())
Definition span.hpp:183

References _, Slic3r::GUI::from_u8(), and wxOSX.

+ Here is the call graph for this function:

◆ Create()

template<class T >
static t_field Slic3r::GUI::Field::Create ( wxWindow *  parent,
const ConfigOptionDef opt,
const t_config_option_key id 
)
inlinestaticinherited

Factory method for generating new derived classes.

p;

213 {
214 auto p = Slic3r::make_unique<T>(parent, opt, id);
215 p->PostInitialize();
216 return std::move(p);
217 }

◆ def_width()

int Slic3r::GUI::Field::def_width ( )
staticinherited
146{ return 8; }

◆ def_width_thinner()

int Slic3r::GUI::Field::def_width_thinner ( )
staticinherited
148{ return 4; }

Referenced by Slic3r::GUI::DiamTextCtrl::DiamTextCtrl(), and Slic3r::GUI::OptionsGroup::activate_line().

+ Here is the caller graph for this function:

◆ def_width_wider()

int Slic3r::GUI::Field::def_width_wider ( )
staticinherited
147{ return 16; }

Referenced by Slic3r::GUI::PhysicalPrinterDialog::build_printhost_settings().

+ Here is the caller graph for this function:

◆ disable()

void Slic3r::GUI::Choice::disable ( )
overridevirtual

Implements Slic3r::GUI::Field.

1291{ dynamic_cast<choice_ctrl*>(window)->Disable(); }
@ Disable
Definition Config.hpp:219

References Slic3r::Disable.

◆ enable()

void Slic3r::GUI::Choice::enable ( )
overridevirtual

Implements Slic3r::GUI::Field.

1290{ dynamic_cast<choice_ctrl*>(window)->Enable(); }
@ Enable
Definition Config.hpp:221

References Slic3r::Enable.

◆ Field() [1/2]

Slic3r::GUI::Field::Field ( const ConfigOptionDef opt,
const t_config_option_key id 
)
inlineprivate
199: m_opt(opt), m_opt_id(id) {}
const t_config_option_key m_opt_id
Definition Field.hpp:172

◆ Field() [2/2]

Slic3r::GUI::Field::Field ( wxWindow *  parent,
const ConfigOptionDef opt,
const t_config_option_key id 
)
inlineprivate
200: m_parent(parent), m_opt(opt), m_opt_id(id) {}

◆ field_changed()

void Slic3r::GUI::Field::field_changed ( )
inlineinherited
197{ on_change_field(); }

References Slic3r::GUI::Field::on_change_field().

Referenced by Slic3r::GUI::PhysicalPrinterDialog::build_printhost_settings().

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

◆ get_blink_ptr()

bool * Slic3r::GUI::UndoValueUIManager::get_blink_ptr ( )
inlineinherited
116{ return &m_undo_ui.blink; }

References Slic3r::GUI::UndoValueUIManager::UndoValueUI::blink, and Slic3r::GUI::UndoValueUIManager::m_undo_ui.

Referenced by Slic3r::GUI::ConfigOptionsGroup::get_custom_ctrl_with_blinking_ptr().

+ Here is the caller graph for this function:

◆ get_enter_pressed()

bool Slic3r::GUI::Field::get_enter_pressed ( ) const
inlineinherited

◆ get_tooltip_text()

wxString Slic3r::GUI::Field::get_tooltip_text ( const wxString &  default_string)
virtualinherited
177{
178 if (m_opt.tooltip.empty())
179 return "";
180
181 std::string opt_id = m_opt_id;
182 auto hash_pos = opt_id.find('#');
183 if (hash_pos != std::string::npos) {
184 opt_id.replace(hash_pos, 1,"[");
185 opt_id += "]";
186 }
187
188 return from_u8(m_opt.tooltip) + "\n" + _L("default value") + "\t: " +
189 (boost::iends_with(opt_id, "_gcode") ? "\n" : "") + default_string +
190 (boost::iends_with(opt_id, "_gcode") ? "" : "\n") +
191 _L("parameter name") + "\t: " + opt_id;
192}
std::string tooltip
Definition Config.hpp:1922
#define _L(s)
Definition I18N.hpp:3

References _L, and Slic3r::GUI::from_u8().

+ Here is the call graph for this function:

◆ get_value()

boost::any & Slic3r::GUI::Choice::get_value ( )
overridevirtual

Gets a boost::any representing this control. subclasses should overload with a specific version.

Implements Slic3r::GUI::Field.

1255{
1256 choice_ctrl* field = dynamic_cast<choice_ctrl*>(window);
1257
1258 wxString ret_str = field->GetValue();
1259
1260 // options from right panel
1261 std::vector <std::string> right_panel_options{ "support", "pad", "scale_unit" };
1262 for (auto rp_option: right_panel_options)
1263 if (m_opt_id == rp_option)
1264 return m_value = boost::any(ret_str);
1265
1266 if (m_opt.type == coEnum)
1267 // Closed enum: The combo box item index returned by the field must be convertible to an enum value.
1268 m_value = m_opt.enum_def->index_to_enum(field->GetSelection());
1270 // Open enum: The combo box item index returned by the field
1271 const int ret_enum = field->GetSelection();
1272 if (ret_enum < 0 || ! m_opt.enum_def->has_values() || m_opt.type == coStrings ||
1273 (into_u8(ret_str) != m_opt.enum_def->value(ret_enum) && ret_str != _(m_opt.enum_def->label(ret_enum))))
1274 // modifies ret_string!
1275 get_value_by_opt_type(ret_str);
1276 else if (m_opt.type == coFloatOrPercent)
1277 m_value = m_opt.enum_def->value(ret_enum);
1278 else if (m_opt.type == coInt)
1279 m_value = atoi(m_opt.enum_def->value(ret_enum).c_str());
1280 else
1282 }
1283 else
1284 // modifies ret_string!
1285 get_value_by_opt_type(ret_str);
1286
1287 return m_value;
1288}
ConfigOptionType type
Definition Config.hpp:1822
boost::any m_value
Definition Field.hpp:232
void get_value_by_opt_type(wxString &str, const bool check_value=true)
Definition Field.cpp:209
if(!(yy_init))
Definition lexer.c:1190
std::string into_u8(const wxString &str)
Definition GUI.cpp:442
@ coEnum
Definition Config.hpp:194
@ coInt
Definition Config.hpp:168
@ coFloatOrPercent
Definition Config.hpp:180
@ coStrings
Definition Config.hpp:174
double string_to_double_decimal_point(const std::string_view str, size_t *pos)
Definition LocalesUtils.cpp:64
Definition args.hpp:18
IGL_INLINE void any(const Eigen::SparseMatrix< AType > &A, const int dim, Eigen::PlainObjectBase< DerivedB > &B)
Definition any.cpp:13

References _, Slic3r::coEnum, Slic3r::coFloatOrPercent, Slic3r::coInt, Slic3r::coStrings, Slic3r::GUI::into_u8(), and Slic3r::string_to_double_decimal_point().

+ Here is the call graph for this function:

◆ get_value_by_opt_type()

void Slic3r::GUI::Field::get_value_by_opt_type ( wxString &  str,
const bool  check_value = true 
)
inherited
210{
211 switch (m_opt.type) {
212 case coInt:
213 m_value = wxAtoi(str);
214 break;
215 case coPercent:
216 case coPercents:
217 case coFloats:
218 case coFloat:{
219 if (m_opt.type == coPercent && !str.IsEmpty() && str.Last() == '%')
220 str.RemoveLast();
221 else if (!str.IsEmpty() && str.Last() == '%')
222 {
223 if (!check_value) {
224 m_value.clear();
225 break;
226 }
227
228 wxString label = m_opt.full_label.empty() ? _(m_opt.label) : _(m_opt.full_label);
229 show_error(m_parent, format_wxstr(_L("%s doesn't support percentage"), label));
231 m_value = double(m_opt.min);
232 break;
233 }
234 double val;
235
236 bool is_na_value = m_opt.nullable && str == na_value();
237
238 const char dec_sep = is_decimal_separator_point() ? '.' : ',';
239 const char dec_sep_alt = dec_sep == '.' ? ',' : '.';
240 // Replace the first incorrect separator in decimal number,
241 // if this value doesn't "N/A" value in some language
242 // see https://github.com/prusa3d/PrusaSlicer/issues/6921
243 if (!is_na_value && str.Replace(dec_sep_alt, dec_sep, false) != 0)
244 set_value(str, false);
245
246 if (str == dec_sep)
247 val = 0.0;
248 else
249 {
250 if (is_na_value)
252 else if (!str.ToDouble(&val))
253 {
254 if (!check_value) {
255 m_value.clear();
256 break;
257 }
258 show_error(m_parent, _(L("Invalid numeric input.")));
259 set_value(double_to_string(val), true);
260 }
261 if (m_opt.min > val || val > m_opt.max)
262 {
263 if (!check_value) {
264 m_value.clear();
265 break;
266 }
267 if (m_opt_id == "extrusion_multiplier") {
268 if (m_value.empty() || boost::any_cast<double>(m_value) != val) {
269 wxString msg_text = format_wxstr(_L("Input value is out of range\n"
270 "Are you sure that %s is a correct value and that you want to continue?"), str);
271// wxMessageDialog dialog(m_parent, msg_text, _L("Parameter validation") + ": " + m_opt_id, wxICON_WARNING | wxYES | wxNO);
272 WarningDialog dialog(m_parent, msg_text, _L("Parameter validation") + ": " + m_opt_id, wxYES | wxNO);
273 if (dialog.ShowModal() == wxID_NO) {
274 if (m_value.empty()) {
275 if (m_opt.min > val) val = m_opt.min;
276 if (val > m_opt.max) val = m_opt.max;
277 }
278 else
279 val = boost::any_cast<double>(m_value);
280 set_value(double_to_string(val), true);
281 }
282 }
283 }
284 else {
285 show_error(m_parent, _L("Input value is out of range"));
286 if (m_opt.min > val) val = m_opt.min;
287 if (val > m_opt.max) val = m_opt.max;
288 set_value(double_to_string(val), true);
289 }
290 }
291 }
292 m_value = val;
293 break; }
294 case coString:
295 case coStrings:
297 case coFloatOrPercent: {
298 if (m_opt.type == coFloatOrPercent && m_opt.opt_key == "first_layer_height" && !str.IsEmpty() && str.Last() == '%') {
299 // Workaroud to avoid of using of the % for first layer height
300 // see https://github.com/prusa3d/PrusaSlicer/issues/7418
301 wxString label = m_opt.full_label.empty() ? _(m_opt.label) : _(m_opt.full_label);
302 show_error(m_parent, format_wxstr(_L("%s doesn't support percentage"), label));
303 const wxString stVal = double_to_string(0.01, 2);
304 set_value(stVal, true);
305 m_value = into_u8(stVal);;
306 break;
307 }
308 if ((m_opt.type == coFloatOrPercent || m_opt.type == coFloatsOrPercents) && !str.IsEmpty() && str.Last() != '%')
309 {
310 double val = 0.;
311 const char dec_sep = is_decimal_separator_point() ? '.' : ',';
312 const char dec_sep_alt = dec_sep == '.' ? ',' : '.';
313 // Replace the first incorrect separator in decimal number.
314 if (str.Replace(dec_sep_alt, dec_sep, false) != 0)
315 set_value(str, false);
316
317
318 // remove space and "mm" substring, if any exists
319 str.Replace(" ", "", true);
320 str.Replace("m", "", true);
321
322 if (!str.ToDouble(&val))
323 {
324 if (!check_value) {
325 m_value.clear();
326 break;
327 }
328 show_error(m_parent, _(L("Invalid numeric input.")));
329 set_value(double_to_string(val), true);
330 }
331 else if (((m_opt.sidetext.rfind("mm/s") != std::string::npos && val > m_opt.max) ||
332 (m_opt.sidetext.rfind("mm ") != std::string::npos && val > /*1*/m_opt.max_literal)) &&
333 (m_value.empty() || into_u8(str) != boost::any_cast<std::string>(m_value)))
334 {
335 if (!check_value) {
336 m_value.clear();
337 break;
338 }
339
340 bool infill_anchors = m_opt.opt_key == "infill_anchor" || m_opt.opt_key == "infill_anchor_max";
341
342 const std::string sidetext = m_opt.sidetext.rfind("mm/s") != std::string::npos ? "mm/s" : "mm";
343 const wxString stVal = double_to_string(val, 2);
344 // TRN %1% = Value, %2% = units
345 const wxString msg_text = format_wxstr(_L("Do you mean %1%%% instead of %1% %2%?\n"
346 "Select YES if you want to change this value to %1%%%, \n"
347 "or NO if you are sure that %1% %2% is a correct value."), stVal, sidetext);
348 WarningDialog dialog(m_parent, msg_text, _L("Parameter validation") + ": " + m_opt_id, wxYES | wxNO);
349 if ((!infill_anchors || val > 100) && dialog.ShowModal() == wxID_YES) {
350 set_value(from_u8((boost::format("%s%%") % stVal).str()), false/*true*/);
351 str += "%%";
352 }
353 else
354 set_value(stVal, false); // it's no needed but can be helpful, when inputted value contained "," instead of "."
355 }
356 }
357
358 m_value = into_u8(str);
359 break; }
360
361 case coPoints: {
362 std::vector<Vec2d> out_values;
363 str.Replace(" ", wxEmptyString, true);
364 if (!str.IsEmpty()) {
365 bool invalid_val = false;
366 bool out_of_range_val = false;
367 wxStringTokenizer thumbnails(str, ",");
368 while (thumbnails.HasMoreTokens()) {
369 wxString token = thumbnails.GetNextToken();
370 double x, y;
371 wxStringTokenizer thumbnail(token, "x");
372 if (thumbnail.HasMoreTokens()) {
373 wxString x_str = thumbnail.GetNextToken();
374 if (x_str.ToDouble(&x) && thumbnail.HasMoreTokens()) {
375 wxString y_str = thumbnail.GetNextToken();
376 if (y_str.ToDouble(&y) && !thumbnail.HasMoreTokens()) {
377 if (0 < x && x < 1000 && 0 < y && y < 1000) {
378 out_values.push_back(Vec2d(x, y));
379 continue;
380 }
381 out_of_range_val = true;
382 break;
383 }
384 }
385 }
386 invalid_val = true;
387 break;
388 }
389
390 if (out_of_range_val) {
391 wxString text_value;
392 if (!m_value.empty())
393 text_value = get_thumbnails_string(boost::any_cast<std::vector<Vec2d>>(m_value));
394 set_value(text_value, true);
395 show_error(m_parent, _L("Input value is out of range"));
396 }
397 else if (invalid_val) {
398 wxString text_value;
399 if (!m_value.empty())
400 text_value = get_thumbnails_string(boost::any_cast<std::vector<Vec2d>>(m_value));
401 set_value(text_value, true);
402 show_error(m_parent, format_wxstr(_L("Invalid input format. Expected vector of dimensions in the following format: \"%1%\""),"XxY, XxY, ..." ));
403 }
404 }
405
406 m_value = out_values;
407 break; }
408
409 default:
410 break;
411 }
412}
std::string full_label
Definition Config.hpp:1915
double max_literal
Definition Config.hpp:1950
std::string sidetext
Definition Config.hpp:1924
t_config_option_key opt_key
Definition Config.hpp:1820
float min
Definition Config.hpp:1947
std::string label
Definition Config.hpp:1914
bool nullable
Definition Config.hpp:1824
float max
Definition Config.hpp:1948
static double nil_value()
Definition Config.hpp:617
virtual void set_value(const boost::any &value, bool change_event)=0
Sets a value for this control. subclasses should overload with a specific version Postcondition: Meth...
const Scalar & y
Definition MathFunctions.h:552
wxString double_to_string(double const value, const int max_precision)
Definition Field.cpp:31
void show_error(wxWindow *parent, const wxString &message, bool monospaced_font)
Definition GUI.cpp:224
wxString format_wxstr(const char *fmt, TArgs &&... args)
Definition format.hpp:42
static wxString na_value(bool for_spin_ctrl=false)
Definition Field.cpp:200
wxString get_thumbnails_string(const std::vector< Vec2d > &values)
Definition Field.cpp:61
Eigen::Matrix< double, 2, 1, Eigen::DontAlign > Vec2d
Definition Point.hpp:51
bool is_decimal_separator_point()
Definition LocalesUtils.cpp:47
@ coFloatsOrPercents
Definition Config.hpp:182
@ coString
Definition Config.hpp:172
@ coPercents
Definition Config.hpp:178
@ coPoints
Definition Config.hpp:186
@ coFloat
Definition Config.hpp:164
@ coFloats
Definition Config.hpp:166
@ coPercent
Definition Config.hpp:176
TCoord< P > x(const P &p)
Definition geometry_traits.hpp:297
#define L(s)
Definition I18N.hpp:18

References _, _L, Slic3r::coFloat, Slic3r::coFloatOrPercent, Slic3r::coFloats, Slic3r::coFloatsOrPercents, Slic3r::coInt, Slic3r::coPercent, Slic3r::coPercents, Slic3r::coPoints, Slic3r::coString, Slic3r::coStrings, Slic3r::GUI::double_to_string(), Slic3r::GUI::format_wxstr(), Slic3r::GUI::from_u8(), Slic3r::GUI::get_thumbnails_string(), Slic3r::GUI::into_u8(), Slic3r::is_decimal_separator_point(), L, Slic3r::GUI::na_value(), Slic3r::ConfigOptionFloatsTempl< NULLABLE >::nil_value(), and Slic3r::GUI::show_error().

+ Here is the call graph for this function:

◆ getSizer()

virtual wxSizer * Slic3r::GUI::Field::getSizer ( )
inlinevirtualinherited

If you don't know what you are getting back, check both methods for nullptr.

Reimplemented in Slic3r::GUI::PointCtrl, and Slic3r::GUI::SliderCtrl.

204{ return nullptr; }

Referenced by Slic3r::GUI::OG_CustomCtrl::CtrlLine::correct_items_positions(), Slic3r::GUI::OG_CustomCtrl::CtrlLine::render(), and Slic3r::GUI::OG_CustomCtrl::CtrlLine::update_visibility().

+ Here is the caller graph for this function:

◆ getWindow()

wxWindow * Slic3r::GUI::Choice::getWindow ( )
inlineoverridevirtual

Reimplemented from Slic3r::GUI::Field.

385{ return window; }

References window.

◆ has_undo_ui()

bool Slic3r::GUI::UndoValueUIManager::has_undo_ui ( ) const
inlineinherited
109{ return m_undo_ui.undo_bitmap != nullptr; }
const ScalableBitmap * undo_bitmap
Definition Field.hpp:46

References Slic3r::GUI::UndoValueUIManager::m_undo_ui, and Slic3r::GUI::UndoValueUIManager::UndoValueUI::undo_bitmap.

Referenced by Slic3r::GUI::OG_CustomCtrl::get_pos(), and Slic3r::GUI::OG_CustomCtrl::CtrlLine::render().

+ Here is the caller graph for this function:

◆ is_matched()

bool Slic3r::GUI::Field::is_matched ( const std::string &  string,
const std::string &  pattern 
)
inherited
195{
196 std::regex regex_pattern(pattern, std::regex_constants::icase); // use ::icase to make the matching case insensitive like /i in perl
197 return std::regex_match(string, regex_pattern);
198}

◆ label_color()

const wxColour * Slic3r::GUI::UndoValueUIManager::label_color ( ) const
inlineinherited
114{ return m_undo_ui.label_color; }
const wxColour * label_color
Definition Field.hpp:52

References Slic3r::GUI::UndoValueUIManager::UndoValueUI::label_color, and Slic3r::GUI::UndoValueUIManager::m_undo_ui.

Referenced by Slic3r::GUI::OG_CustomCtrl::CtrlLine::render().

+ Here is the caller graph for this function:

◆ msw_rescale()

void Slic3r::GUI::Choice::msw_rescale ( )
overridevirtual

Reimplemented from Slic3r::GUI::Field.

1294{
1296
1297 choice_ctrl* field = dynamic_cast<choice_ctrl*>(window);
1298#ifdef __WXOSX__
1299 const wxString selection = field->GetValue();// field->GetString(index);
1300
1301 /* To correct scaling (set new controll size) of a wxBitmapCombobox
1302 * we need to refill control with new bitmaps. So, in our case :
1303 * 1. clear control
1304 * 2. add content
1305 * 3. add scaled "empty" bitmap to the at least one item
1306 */
1307 field->Clear();
1308 wxSize size(wxDefaultSize);
1309 size.SetWidth((m_opt.width > 0 ? m_opt.width : def_width_wider()) * m_em_unit);
1310
1311 // Set rescaled min height to correct layout
1312 field->SetMinSize(wxSize(-1, int(1.5f*field->GetFont().GetPixelSize().y + 0.5f)));
1313 // Set rescaled size
1314 field->SetSize(size);
1315
1316 if (m_opt.enum_def) {
1317 if (auto& labels = m_opt.enum_def->labels(); !labels.empty()) {
1318 const bool localized = m_opt.enum_def->has_labels();
1319 for (const std::string& el : labels)
1320 field->Append(localized ? _(from_u8(el)) : from_u8(el));
1321
1322 if (auto opt = m_opt.enum_def->label_to_index(into_u8(selection)); opt.has_value())
1323 // This enum has a value field of the same content as text_value. Select it.
1324 field->SetSelection(*opt);
1325 else
1326 field->SetValue(selection);
1327 }
1328 }
1329#else
1330#ifdef _WIN32
1331 field->Rescale();
1332#endif
1333 auto size = wxSize(def_width_wider() * m_em_unit, wxDefaultCoord);
1334 if (m_opt.height >= 0) size.SetHeight(m_opt.height * m_em_unit);
1335 if (m_opt.width >= 0) size.SetWidth(m_opt.width * m_em_unit);
1336
1338 field->SetSize(size);
1339 else
1340 field->SetMinSize(size);
1341#endif
1342}
bool parent_is_custom_ctrl
Definition Field.hpp:176
virtual void msw_rescale()
Definition Field.cpp:414

References _, Slic3r::GUI::from_u8(), and Slic3r::GUI::into_u8().

+ Here is the call graph for this function:

◆ on_back_to_initial_value()

void Slic3r::GUI::Field::on_back_to_initial_value ( )
inherited

Call the attached m_back_to_initial_value method.

165{
168}
t_back_to_init m_back_to_initial_value
Function object to store callback passed in from owning object.
Definition Field.hpp:162
bool m_is_modified_value
Definition Field.hpp:167

◆ on_back_to_sys_value()

void Slic3r::GUI::Field::on_back_to_sys_value ( )
inherited

Call the attached m_back_to_sys_value method.

171{
172 if (m_back_to_sys_value != nullptr && m_is_nonsys_value)
174}
t_back_to_init m_back_to_sys_value
Definition Field.hpp:163
bool m_is_nonsys_value
Definition Field.hpp:168

◆ on_change_field()

void Slic3r::GUI::Field::on_change_field ( )
protectedinherited

Call the attached on_change method.

158{
159// std::cerr << "calling Field::_on_change \n";
160 if (m_on_change != nullptr && !m_disable_change_event)
162}
t_change m_on_change
Function object to store callback passed in from owning object.
Definition Field.hpp:159
bool m_disable_change_event
Definition Field.hpp:166
virtual boost::any & get_value()=0
Gets a boost::any representing this control. subclasses should overload with a specific version.

Referenced by Slic3r::GUI::Field::field_changed().

+ Here is the caller graph for this function:

◆ on_kill_focus()

void Slic3r::GUI::Field::on_kill_focus ( )
protectedinherited

Call the attached on_kill_focus method. It's important to use wxEvent instead of wxFocusEvent, in another case we can't unfocused control at all.

151{
152 // call the registered function if it is available
153 if (m_on_kill_focus!=nullptr)
155}
t_kill_focus m_on_kill_focus
Function object to store callback passed in from owning object.
Definition Field.hpp:156

◆ PostInitialize()

void Slic3r::GUI::Field::PostInitialize ( )
protectedvirtualinherited
90{
91 auto color = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
92
93 switch (m_opt.type)
94 {
95 case coPercents:
96 case coFloats:
97 case coStrings:
98 case coBools:
99 case coInts: {
100 auto tag_pos = m_opt_id.find("#");
101 if (tag_pos != std::string::npos)
102 m_opt_idx = stoi(m_opt_id.substr(tag_pos + 1, m_opt_id.size()));
103 break;
104 }
105 default:
106 break;
107 }
108
109 // initialize m_unit_value
111 parent_is_custom_ctrl = dynamic_cast<OG_CustomCtrl*>(m_parent) != nullptr;
112
113 BUILD();
114
115 // For the mode, when settings are in non-modal dialog, neither dialog nor tabpanel doesn't receive wxEVT_KEY_UP event, when some field is selected.
116 // So, like a workaround check wxEVT_KEY_UP event for the Filed and switch between tabs if Ctrl+(1-4) was pressed
117 if (getWindow())
118 getWindow()->Bind(wxEVT_KEY_UP, [](wxKeyEvent& evt) {
119 if ((evt.GetModifiers() & wxMOD_CONTROL) != 0) {
120 int tab_id = -1;
121 switch (evt.GetKeyCode()) {
122 case '1': { tab_id = 0; break; }
123 case '2': { tab_id = 1; break; }
124 case '3': { tab_id = 2; break; }
125 case '4': { tab_id = 3; break; }
126#ifdef __APPLE__
127 case 'f':
128#else /* __APPLE__ */
129 case WXK_CONTROL_F:
130#endif /* __APPLE__ */
131 case 'F': { wxGetApp().plater()->search(false); break; }
132 default: break;
133 }
134 if (tab_id >= 0)
135 wxGetApp().mainframe->select_tab(tab_id);
136 if (tab_id > 0)
137 // tab panel should be focused for correct navigation between tabs
138 wxGetApp().tab_panel()->SetFocus();
139 }
140
141 evt.Skip();
142 });
143}
virtual void BUILD()=0
Finish constructing the Field's wxWidget-related properties, including setting its own sizer,...
virtual wxWindow * getWindow()
Definition Field.hpp:205
int m_opt_idx
{""};
Definition Field.hpp:173
@ coBools
Definition Config.hpp:192
@ coInts
Definition Config.hpp:170
int em_unit(wxWindow *win)
Definition wxExtensions.cpp:388

References Slic3r::GUI::Field::BUILD(), Slic3r::coBools, Slic3r::coFloats, Slic3r::coInts, Slic3r::coPercents, Slic3r::coStrings, em_unit(), Slic3r::GUI::Field::getWindow(), if(), Slic3r::GUI::Field::m_em_unit, Slic3r::GUI::Field::m_opt, Slic3r::GUI::Field::m_opt_id, Slic3r::GUI::Field::m_opt_idx, Slic3r::GUI::Field::m_parent, Slic3r::GUI::Field::parent_is_custom_ctrl, and Slic3r::ConfigOptionDef::type.

+ Here is the call graph for this function:

◆ propagate_value()

void Slic3r::GUI::Choice::propagate_value ( )
1059{
1060 if (m_opt.type == coStrings) {
1062 return;
1063 }
1064
1065 if (is_defined_input_value<choice_ctrl>(window, m_opt.type)) {
1066 switch (m_opt.type) {
1067 case coFloatOrPercent:
1068 {
1069 std::string old_val = !m_value.empty() ? boost::any_cast<std::string>(m_value) : "";
1070 if (old_val == boost::any_cast<std::string>(get_value()))
1071 return;
1072 break;
1073 }
1074 case coInt:
1075 {
1076 int old_val = !m_value.empty() ? boost::any_cast<int>(m_value) : 0;
1077 if (old_val == boost::any_cast<int>(get_value()))
1078 return;
1079 break;
1080 }
1081 default:
1082 {
1083 double old_val = !m_value.empty() ? boost::any_cast<double>(m_value) : -99999;
1084 if (fabs(old_val - boost::any_cast<double>(get_value())) <= 0.0001)
1085 return;
1086 }
1087 }
1089 }
1090 else
1091 on_kill_focus();
1092}
boost::any & get_value() override
Gets a boost::any representing this control. subclasses should overload with a specific version.
Definition Field.cpp:1254
void on_kill_focus()
Call the attached on_kill_focus method. It's important to use wxEvent instead of wxFocusEvent,...
Definition Field.cpp:150

References Slic3r::coFloatOrPercent, Slic3r::coInt, and Slic3r::coStrings.

◆ set_enter_pressed()

void Slic3r::GUI::Field::set_enter_pressed ( bool  pressed)
inlineinherited
223{ bEnterPressed = pressed; }

References Slic3r::GUI::Field::bEnterPressed.

Referenced by Slic3r::GUI::Field::EnterPressed::EnterPressed(), and Slic3r::GUI::Field::EnterPressed::~EnterPressed().

+ Here is the caller graph for this function:

◆ set_label_colour()

bool Slic3r::GUI::UndoValueUIManager::set_label_colour ( const wxColour *  clr)
inlineinherited
104{ return m_undo_ui.set_label_colour(clr); }
bool set_label_colour(const wxColour *clr)
Definition Field.hpp:72

References Slic3r::GUI::UndoValueUIManager::m_undo_ui, and Slic3r::GUI::UndoValueUIManager::UndoValueUI::set_label_colour().

Referenced by Slic3r::GUI::Tab::create_line_with_widget(), Slic3r::GUI::Tab::decorate(), and Slic3r::GUI::Tab::update_label_colours().

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

◆ set_last_meaningful_value()

virtual void Slic3r::GUI::Field::set_last_meaningful_value ( )
inlinevirtualinherited

◆ set_na_value()

virtual void Slic3r::GUI::Field::set_na_value ( )
inlinevirtualinherited

◆ set_selection()

void Slic3r::GUI::Choice::set_selection ( )
1100{
1101 /* To prevent earlier control updating under OSX set m_disable_change_event to true
1102 * (under OSX wxBitmapComboBox send wxEVT_COMBOBOX even after SetSelection())
1103 */
1105
1106 wxString text_value = wxString("");
1107
1108 choice_ctrl* field = dynamic_cast<choice_ctrl*>(window);
1109 switch (m_opt.type) {
1110 case coEnum:{
1111 field->SetSelection(m_opt.default_value->getInt());
1112 break;
1113 }
1114 case coFloat:
1115 case coPercent: {
1116 double val = m_opt.default_value->getFloat();
1117 text_value = val - int(val) == 0 ? wxString::Format(_T("%i"), int(val)) : wxNumberFormatter::ToString(val, 1);
1118 break;
1119 }
1120 case coInt:{
1121 text_value = wxString::Format(_T("%i"), int(m_opt.default_value->getInt()));
1122 break;
1123 }
1124 case coStrings:{
1125 text_value = m_opt.get_default_value<ConfigOptionStrings>()->get_at(m_opt_idx);
1126 break;
1127 }
1128 case coFloatOrPercent: {
1129 text_value = double_to_string(m_opt.default_value->getFloat());
1130 if (m_opt.get_default_value<ConfigOptionFloatOrPercent>()->percent)
1131 text_value += "%";
1132 break;
1133 }
1134 default: break;
1135 }
1136
1137 if (!text_value.IsEmpty()) {
1138 if (auto opt = m_opt.enum_def->value_to_index(into_u8(text_value)); opt.has_value())
1139 // This enum has a value field of the same content as text_value. Select it.
1140 field->SetSelection(*opt);
1141 else
1142 field->SetValue(text_value);
1143 }
1144}
const T * get_default_value() const
Definition Config.hpp:1828
Slic3r::clonable_ptr< const ConfigOption > default_value
Definition Config.hpp:1826

References Slic3r::coEnum, Slic3r::coFloat, Slic3r::coFloatOrPercent, Slic3r::coInt, Slic3r::coPercent, Slic3r::coStrings, Slic3r::GUI::double_to_string(), Slic3r::GUI::into_u8(), and Slic3r::ConfigOptionFloatOrPercent::percent.

Referenced by Slic3r::GUI::PhysicalPrinterDialog::build_printhost_settings().

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

◆ set_undo_bitmap()

bool Slic3r::GUI::UndoValueUIManager::set_undo_bitmap ( const ScalableBitmap bmp)
inlineinherited
102{ return m_undo_ui.set_undo_bitmap(bmp); }
bool set_undo_bitmap(const ScalableBitmap *bmp)
Definition Field.hpp:56

References Slic3r::GUI::UndoValueUIManager::m_undo_ui, and Slic3r::GUI::UndoValueUIManager::UndoValueUI::set_undo_bitmap().

Referenced by Slic3r::GUI::Tab::create_line_with_widget(), and Slic3r::GUI::Tab::decorate().

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

◆ set_undo_to_sys_bitmap()

bool Slic3r::GUI::UndoValueUIManager::set_undo_to_sys_bitmap ( const ScalableBitmap bmp)
inlineinherited
103{ return m_undo_ui.set_undo_to_sys_bitmap(bmp); }
bool set_undo_to_sys_bitmap(const ScalableBitmap *bmp)
Definition Field.hpp:64

References Slic3r::GUI::UndoValueUIManager::m_undo_ui, and Slic3r::GUI::UndoValueUIManager::UndoValueUI::set_undo_to_sys_bitmap().

Referenced by Slic3r::GUI::Tab::create_line_with_widget(), and Slic3r::GUI::Tab::decorate().

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

◆ set_undo_to_sys_tooltip()

bool Slic3r::GUI::UndoValueUIManager::set_undo_to_sys_tooltip ( const wxString *  tip)
inlineinherited
106{ return m_undo_ui.set_undo_to_sys_tooltip(tip); }
bool set_undo_to_sys_tooltip(const wxString *tip)
Definition Field.hpp:87

References Slic3r::GUI::UndoValueUIManager::m_undo_ui, and Slic3r::GUI::UndoValueUIManager::UndoValueUI::set_undo_to_sys_tooltip().

Referenced by Slic3r::GUI::Tab::create_line_with_widget(), and Slic3r::GUI::Tab::decorate().

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

◆ set_undo_tooltip()

bool Slic3r::GUI::UndoValueUIManager::set_undo_tooltip ( const wxString *  tip)
inlineinherited
105{ return m_undo_ui.set_undo_tooltip(tip); }
bool set_undo_tooltip(const wxString *tip)
Definition Field.hpp:79

References Slic3r::GUI::UndoValueUIManager::m_undo_ui, and Slic3r::GUI::UndoValueUIManager::UndoValueUI::set_undo_tooltip().

Referenced by Slic3r::GUI::Tab::create_line_with_widget(), and Slic3r::GUI::Tab::decorate().

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

◆ set_value() [1/2]

void Slic3r::GUI::Choice::set_value ( const boost::any &  value,
bool  change_event = false 
)
overridevirtual

Sets a value for this control. subclasses should overload with a specific version Postcondition: Method does not fire the on_change event.

Implements Slic3r::GUI::Field.

1159{
1160 m_disable_change_event = !change_event;
1161
1162 choice_ctrl* field = dynamic_cast<choice_ctrl*>(window);
1163
1164 switch (m_opt.type) {
1165 case coInt:
1166 case coFloat:
1167 case coPercent:
1168 case coFloatOrPercent:
1169 case coString:
1170 case coStrings: {
1171 wxString text_value = m_opt.type == coInt ?
1172 wxString::Format(_T("%i"), int(boost::any_cast<int>(value))) :
1173 boost::any_cast<wxString>(value);
1174 int sel_idx = -1;
1175 if (m_opt.enum_def) {
1176 if (auto idx = m_opt.enum_def->label_to_index(into_u8(text_value)); idx.has_value())
1177 sel_idx = *idx;
1178 else if (idx = m_opt.enum_def->value_to_index(into_u8(text_value)); idx.has_value())
1179 sel_idx = *idx;
1180 }
1181
1182 if (sel_idx >= 0 )
1183 field->SetSelection(sel_idx);
1184 else {
1185 // For editable Combobox under OSX is needed to set selection to -1 explicitly,
1186 // otherwise selection doesn't be changed
1187 field->SetSelection(-1);
1188 field->SetValue(text_value);
1189 }
1190
1191 if (!m_value.empty() && m_opt.opt_key == "fill_density") {
1192 // If m_value was changed before, then update m_value here too to avoid case
1193 // when control's value is already changed from the ConfigManipulation::update_print_fff_config(),
1194 // but m_value doesn't respect it.
1195 if (double val; text_value.ToDouble(&val))
1196 m_value = val;
1197 }
1198
1199 break;
1200 }
1201 case coEnum: {
1202 auto val = m_opt.enum_def->enum_to_index(boost::any_cast<int>(value));
1203 assert(val.has_value());
1204 field->SetSelection(val.has_value() ? *val : 0);
1205 break;
1206 }
1207 default:
1208 break;
1209 }
1210
1211 m_disable_change_event = false;
1212}

References Slic3r::coEnum, Slic3r::coFloat, Slic3r::coFloatOrPercent, Slic3r::coInt, Slic3r::coPercent, Slic3r::coString, Slic3r::coStrings, and Slic3r::GUI::into_u8().

+ Here is the call graph for this function:

◆ set_value() [2/2]

void Slic3r::GUI::Choice::set_value ( const std::string &  value,
bool  change_event = false 
)

Redundant?

1147{
1148 m_disable_change_event = !change_event;
1149 choice_ctrl* field = dynamic_cast<choice_ctrl*>(window);
1150 if (auto opt = m_opt.enum_def->value_to_index(value); opt.has_value())
1151 // This enum has a value field of the same content as text_value. Select it.
1152 field->SetSelection(*opt);
1153 else
1154 field->SetValue(value);
1155 m_disable_change_event = false;
1156}

Referenced by Slic3r::GUI::PhysicalPrinterDialog::update_host_type().

+ Here is the caller graph for this function:

◆ set_values() [1/2]

void Slic3r::GUI::Choice::set_values ( const std::vector< std::string > &  values)

it's needed for _update_serial_ports()

1216{
1217 if (values.empty())
1218 return;
1220
1221// # it looks that Clear() also clears the text field in recent wxWidgets versions,
1222// # but we want to preserve it
1223 auto ww = dynamic_cast<choice_ctrl*>(window);
1224 auto value = ww->GetValue();
1225 ww->Clear();
1226 ww->Append("");
1227 for (const auto &el : values)
1228 ww->Append(wxString(el));
1229 ww->SetValue(value);
1230
1231 m_disable_change_event = false;
1232}

Referenced by Slic3r::GUI::PhysicalPrinterDialog::build_printhost_settings(), Slic3r::GUI::PhysicalPrinterDialog::update_host_type(), and Slic3r::GUI::PhysicalPrinterDialog::update_printers().

+ Here is the caller graph for this function:

◆ set_values() [2/2]

void Slic3r::GUI::Choice::set_values ( const wxArrayString &  values)
1235{
1236 if (values.empty())
1237 return;
1238
1240
1241 // # it looks that Clear() also clears the text field in recent wxWidgets versions,
1242 // # but we want to preserve it
1243 auto ww = dynamic_cast<choice_ctrl*>(window);
1244 auto value = ww->GetValue();
1245 ww->Clear();
1246// ww->Append("");
1247 for (const auto &el : values)
1248 ww->Append(el);
1249 ww->SetValue(value);
1250
1251 m_disable_change_event = false;
1252}

◆ suppress_scroll()

void Slic3r::GUI::Choice::suppress_scroll ( )
1095{
1096 m_suppress_scroll = true;
1097}

Referenced by Slic3r::GUI::FreqChangedParams::FreqChangedParams().

+ Here is the caller graph for this function:

◆ sys_color_changed()

void Slic3r::GUI::Field::sys_color_changed ( )
virtualinherited

Reimplemented in Slic3r::GUI::ColourPicker, and Slic3r::GUI::PointCtrl.

421{
422#ifdef _WIN32
423 if (wxWindow* win = this->getWindow())
424 wxGetApp().UpdateDarkUI(win);
425#endif
426}

◆ toggle()

void Slic3r::GUI::Field::toggle ( bool  en)
inlineinherited

Fires the enable or disable function, based on the input.

193{ en ? enable() : disable(); }
virtual void disable()=0
virtual void enable()=0

References Slic3r::GUI::Field::disable(), and Slic3r::GUI::Field::enable().

Referenced by Slic3r::GUI::Tab::compatible_widget_reload(), Slic3r::GUI::Tab::toggle_option(), Slic3r::GUI::ObjectSettings::update_config_values(), and Slic3r::GUI::TabFilament::update_line_with_near_label_widget().

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

◆ undo_bitmap()

const wxBitmapBundle & Slic3r::GUI::UndoValueUIManager::undo_bitmap ( ) const
inlineinherited
110{ return m_undo_ui.undo_bitmap->bmp(); }
const wxBitmapBundle & bmp() const
Definition wxExtensions.hpp:148

References ScalableBitmap::bmp(), Slic3r::GUI::UndoValueUIManager::m_undo_ui, and Slic3r::GUI::UndoValueUIManager::UndoValueUI::undo_bitmap.

Referenced by Slic3r::GUI::OG_CustomCtrl::CtrlLine::render().

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

◆ undo_to_sys_bitmap()

const wxBitmapBundle & Slic3r::GUI::UndoValueUIManager::undo_to_sys_bitmap ( ) const
inlineinherited
112{ return m_undo_ui.undo_to_sys_bitmap->bmp(); }
const ScalableBitmap * undo_to_sys_bitmap
Definition Field.hpp:49

References ScalableBitmap::bmp(), Slic3r::GUI::UndoValueUIManager::m_undo_ui, and Slic3r::GUI::UndoValueUIManager::UndoValueUI::undo_to_sys_bitmap.

Referenced by Slic3r::GUI::OG_CustomCtrl::CtrlLine::render().

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

◆ undo_to_sys_tooltip()

const wxString * Slic3r::GUI::UndoValueUIManager::undo_to_sys_tooltip ( ) const
inlineinherited

◆ undo_tooltip()

const wxString * Slic3r::GUI::UndoValueUIManager::undo_tooltip ( ) const
inlineinherited

Member Data Documentation

◆ bEnterPressed

bool Slic3r::GUI::Field::bEnterPressed = false
protectedinherited

◆ m_back_to_initial_value

t_back_to_init Slic3r::GUI::Field::m_back_to_initial_value { nullptr }
inherited

Function object to store callback passed in from owning object.

Referenced by Slic3r::GUI::Field::~Field().

◆ m_back_to_sys_value

t_back_to_init Slic3r::GUI::Field::m_back_to_sys_value { nullptr }
inherited

◆ m_disable_change_event

◆ m_em_unit

int Slic3r::GUI::Field::m_em_unit
protectedinherited

◆ m_is_dropped

bool Slic3r::GUI::Choice::m_is_dropped { false }

◆ m_is_editable

bool Slic3r::GUI::Choice::m_is_editable { false }

◆ m_is_modified_value

bool Slic3r::GUI::Field::m_is_modified_value {false}
inherited

◆ m_is_nonsys_value

bool Slic3r::GUI::Field::m_is_nonsys_value {true}
inherited

◆ m_last_meaningful_value

boost::any Slic3r::GUI::Field::m_last_meaningful_value
protectedinherited

◆ m_last_selected

int Slic3r::GUI::Choice::m_last_selected { wxNOT_FOUND }

◆ m_on_change

t_change Slic3r::GUI::Field::m_on_change {nullptr}
inherited

Function object to store callback passed in from owning object.

Referenced by Slic3r::GUI::Field::~Field().

◆ m_on_kill_focus

t_kill_focus Slic3r::GUI::Field::m_on_kill_focus {nullptr}
inherited

Function object to store callback passed in from owning object.

Referenced by Slic3r::GUI::Field::~Field().

◆ m_opt

const ConfigOptionDef Slic3r::GUI::Field::m_opt {ConfigOptionDef()}
inherited

◆ m_opt_id

const t_config_option_key Slic3r::GUI::Field::m_opt_id
inherited

◆ m_opt_idx

int Slic3r::GUI::Field::m_opt_idx = 0
inherited

◆ m_parent

wxWindow* Slic3r::GUI::Field::m_parent {nullptr}
inherited

parent wx item, opportunity to refactor (probably not necessary - data duplication)

Referenced by Slic3r::GUI::Field::PostInitialize().

◆ m_suppress_scroll

bool Slic3r::GUI::Choice::m_suppress_scroll { false }

◆ m_undo_ui

◆ m_value

boost::any Slic3r::GUI::Field::m_value
protectedinherited

◆ opt_height

double Slic3r::GUI::Field::opt_height { 0.0 }
inherited

◆ parent_is_custom_ctrl

bool Slic3r::GUI::Field::parent_is_custom_ctrl { false }
inherited

◆ window

wxWindow* Slic3r::GUI::Choice::window { nullptr }

Referenced by getWindow().


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