Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::GUI::Field Class Referenceabstract

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

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

Classes

class  EnterPressed
 

Public Member Functions

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_value (const boost::any &value, bool change_event)=0
 Sets a value for this control. subclasses should overload with a specific version Postcondition: Method does not fire the on_change event.
 
virtual void set_last_meaningful_value ()
 
virtual void set_na_value ()
 
virtual boost::any & get_value ()=0
 Gets a boost::any representing this control. subclasses should overload with a specific version.
 
virtual void enable ()=0
 
virtual void disable ()=0
 
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 ()
 
 Field (const ConfigOptionDef &opt, const t_config_option_key &id)
 
 Field (wxWindow *parent, const ConfigOptionDef &opt, const t_config_option_key &id)
 
virtual ~Field ()
 
virtual wxSizer * getSizer ()
 If you don't know what you are getting back, check both methods for nullptr.
 
virtual wxWindow * getWindow ()
 
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 msw_rescale ()
 
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 * 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 ()
 
virtual void BUILD ()=0
 Finish constructing the Field's wxWidget-related properties, including setting its own sizer, etc.
 
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 Attributes

UndoValueUI m_undo_ui
 

Friends

class OptionsGroup
 

Detailed Description

Constructor & Destructor Documentation

◆ Field() [1/2]

Slic3r::GUI::Field::Field ( const ConfigOptionDef opt,
const t_config_option_key id 
)
inline
199: m_opt(opt), m_opt_id(id) {}
const t_config_option_key m_opt_id
Definition Field.hpp:172
const ConfigOptionDef m_opt
Copy of ConfigOption for deduction purposes.
Definition Field.hpp:171

◆ Field() [2/2]

Slic3r::GUI::Field::Field ( wxWindow *  parent,
const ConfigOptionDef opt,
const t_config_option_key id 
)
inline
200: m_parent(parent), m_opt(opt), m_opt_id(id) {}
wxWindow * m_parent
parent wx item, opportunity to refactor (probably not necessary - data duplication)
Definition Field.hpp:153

◆ ~Field()

Slic3r::GUI::Field::~Field ( )
virtual
73{
75 m_on_kill_focus = nullptr;
76 if (m_on_change)
77 m_on_change = nullptr;
81 m_back_to_sys_value = nullptr;
82 if (getWindow()) {
83 wxWindow* win = getWindow();
84 win->Destroy();
85 win = nullptr;
86 }
87}
virtual wxWindow * getWindow()
Definition Field.hpp:205
t_kill_focus m_on_kill_focus
Function object to store callback passed in from owning object.
Definition Field.hpp:156
t_back_to_init m_back_to_initial_value
Function object to store callback passed in from owning object.
Definition Field.hpp:162
t_change m_on_change
Function object to store callback passed in from owning object.
Definition Field.hpp:159
t_back_to_init m_back_to_sys_value
Definition Field.hpp:163

References getWindow(), m_back_to_initial_value, m_back_to_sys_value, m_on_change, and m_on_kill_focus.

+ Here is the call graph for this function:

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()

virtual void Slic3r::GUI::Field::BUILD ( )
protectedpure virtual

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

Implemented in Slic3r::GUI::TextCtrl, Slic3r::GUI::CheckBox, Slic3r::GUI::SpinCtrl, Slic3r::GUI::Choice, Slic3r::GUI::ColourPicker, Slic3r::GUI::PointCtrl, Slic3r::GUI::StaticText, and Slic3r::GUI::SliderCtrl.

Referenced by PostInitialize().

+ Here is the caller 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 
)
inlinestatic

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 ( )
static
146{ return 8; }

◆ def_width_thinner()

int Slic3r::GUI::Field::def_width_thinner ( )
static
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 ( )
static
147{ return 16; }

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

+ Here is the caller graph for this function:

◆ disable()

virtual void Slic3r::GUI::Field::disable ( )
pure virtual

Implemented in Slic3r::GUI::TextCtrl, Slic3r::GUI::CheckBox, Slic3r::GUI::SpinCtrl, Slic3r::GUI::Choice, Slic3r::GUI::ColourPicker, Slic3r::GUI::PointCtrl, Slic3r::GUI::StaticText, and Slic3r::GUI::SliderCtrl.

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

+ Here is the caller graph for this function:

◆ enable()

virtual void Slic3r::GUI::Field::enable ( )
pure virtual

Implemented in Slic3r::GUI::TextCtrl, Slic3r::GUI::CheckBox, Slic3r::GUI::SpinCtrl, Slic3r::GUI::Choice, Slic3r::GUI::ColourPicker, Slic3r::GUI::PointCtrl, Slic3r::GUI::StaticText, and Slic3r::GUI::SliderCtrl.

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

+ Here is the caller graph for this function:

◆ field_changed()

void Slic3r::GUI::Field::field_changed ( )
inline
197{ on_change_field(); }
void on_change_field()
Call the attached on_change method.
Definition Field.cpp:157

References 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
inline
222{ return bEnterPressed; }
bool bEnterPressed
Definition Field.hpp:238

References bEnterPressed.

◆ get_tooltip_text()

wxString Slic3r::GUI::Field::get_tooltip_text ( const wxString &  default_string)
virtual
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
wxString from_u8(const std::string &str)
Definition GUI.cpp:437
#define _L(s)
Definition I18N.hpp:3

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

+ Here is the call graph for this function:

◆ get_value()

virtual boost::any & Slic3r::GUI::Field::get_value ( )
pure virtual

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

Implemented in Slic3r::GUI::TextCtrl, Slic3r::GUI::CheckBox, Slic3r::GUI::SpinCtrl, Slic3r::GUI::Choice, Slic3r::GUI::ColourPicker, Slic3r::GUI::PointCtrl, Slic3r::GUI::StaticText, and Slic3r::GUI::SliderCtrl.

◆ get_value_by_opt_type()

void Slic3r::GUI::Field::get_value_by_opt_type ( wxString &  str,
const bool  check_value = true 
)
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
ConfigOptionType type
Definition Config.hpp:1822
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
boost::any m_value
Definition Field.hpp:232
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...
#define _(msgid)
Definition getopt.c:87
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
std::string into_u8(const wxString &str)
Definition GUI.cpp:442
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
@ coInt
Definition Config.hpp:168
@ coFloat
Definition Config.hpp:164
@ coFloatOrPercent
Definition Config.hpp:180
@ coStrings
Definition Config.hpp:174
@ 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 ( )
inlinevirtual

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()

◆ 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 
)
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::Field::msw_rescale ( )
virtual

Reimplemented in Slic3r::GUI::TextCtrl, Slic3r::GUI::CheckBox, Slic3r::GUI::SpinCtrl, Slic3r::GUI::Choice, Slic3r::GUI::ColourPicker, Slic3r::GUI::PointCtrl, and Slic3r::GUI::StaticText.

415{
416 // update em_unit value
418}
int m_em_unit
Definition Field.hpp:236
int em_unit(wxWindow *win)
Definition wxExtensions.cpp:388

References em_unit().

+ Here is the call graph for this function:

◆ on_back_to_initial_value()

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

Call the attached m_back_to_initial_value method.

165{
168}
bool m_is_modified_value
Definition Field.hpp:167

◆ on_back_to_sys_value()

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

Call the attached m_back_to_sys_value method.

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

◆ on_change_field()

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

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}
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 field_changed().

+ Here is the caller graph for this function:

◆ on_kill_focus()

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

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}

◆ PostInitialize()

void Slic3r::GUI::Field::PostInitialize ( )
protectedvirtual
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,...
bool parent_is_custom_ctrl
Definition Field.hpp:176
int m_opt_idx
{""};
Definition Field.hpp:173
if(!(yy_init))
Definition lexer.c:1190
@ coBools
Definition Config.hpp:192
@ coInts
Definition Config.hpp:170

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

+ Here is the call graph for this function:

◆ set_enter_pressed()

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

References 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 ( )
inlinevirtual

◆ set_na_value()

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

◆ 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()

virtual void Slic3r::GUI::Field::set_value ( const boost::any &  value,
bool  change_event 
)
pure virtual

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

Implemented in Slic3r::GUI::TextCtrl, Slic3r::GUI::CheckBox, Slic3r::GUI::SpinCtrl, Slic3r::GUI::Choice, Slic3r::GUI::ColourPicker, Slic3r::GUI::PointCtrl, Slic3r::GUI::StaticText, and Slic3r::GUI::SliderCtrl.

Referenced by Slic3r::GUI::Tab::on_value_change().

+ Here is the caller graph for this function:

◆ sys_color_changed()

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

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)
inline

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

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

References disable(), and 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

Friends And Related Symbol Documentation

◆ OptionsGroup

friend class OptionsGroup
friend

Member Data Documentation

◆ bEnterPressed

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

◆ m_back_to_initial_value

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

Function object to store callback passed in from owning object.

Referenced by ~Field().

◆ m_back_to_sys_value

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

Referenced by ~Field().

◆ m_disable_change_event

◆ m_em_unit

int Slic3r::GUI::Field::m_em_unit
protected

Referenced by PostInitialize().

◆ m_is_modified_value

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

◆ m_is_nonsys_value

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

◆ m_last_meaningful_value

boost::any Slic3r::GUI::Field::m_last_meaningful_value
protected

◆ m_on_change

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

Function object to store callback passed in from owning object.

Referenced by ~Field().

◆ m_on_kill_focus

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

Function object to store callback passed in from owning object.

Referenced by ~Field().

◆ m_opt

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

Copy of ConfigOption for deduction purposes.

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

◆ m_opt_id

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

Referenced by PostInitialize().

◆ m_opt_idx

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

{""};

Referenced by PostInitialize().

◆ m_parent

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

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

Referenced by PostInitialize().

◆ m_undo_ui

◆ m_value

boost::any Slic3r::GUI::Field::m_value
protected

◆ opt_height

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

◆ parent_is_custom_ctrl

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

Referenced by PostInitialize().


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