OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
anonymous_namespace{DPIAwarePlugin.cpp} Namespace Reference

Functions

template<typename T>
void addDPIProps (T *dpi, wxVector< wxInspector::PropertyDef > &props)

Function Documentation

◆ addDPIProps()

template<typename T>
void anonymous_namespace{DPIAwarePlugin.cpp}::addDPIProps ( T * dpi,
wxVector< wxInspector::PropertyDef > & props )
19{
20 using namespace wxInspector;
21
22 props.push_back({"Scale Factor", "DPI Scaling", PropertyType::String,
23 wxString::Format("%.2f", dpi->scale_factor()), false, {},
24 [dpi]() { return wxString::Format("%.2f", dpi->scale_factor()); },
25 [dpi](const wxString& v) {
26 double val;
27 if (wxSscanf(v, "%lf", &val) != 1) return false;
28 dpi->set_scale_factor((float) val);
29 return true;
30 }});
31
32 props.push_back({"Prev Scale Factor", "DPI Scaling", PropertyType::String,
33 wxString::Format("%.2f", dpi->prev_scale_factor()), false, {},
34 [dpi]() { return wxString::Format("%.2f", dpi->prev_scale_factor()); },
35 [dpi](const wxString& v) {
36 double val;
37 if (wxSscanf(v, "%lf", &val) != 1) return false;
38 dpi->set_prev_scale_factor((float) val);
39 return true;
40 }});
41
42 props.push_back({"EM Unit", "DPI Scaling", PropertyType::Integer,
43 wxString::Format("%d", dpi->em_unit()), false, {},
44 [dpi]() { return wxString::Format("%d", dpi->em_unit()); },
45 [dpi](const wxString& v) {
46 long val;
47 if (!v.ToLong(&val)) return false;
48 dpi->set_em_unit((int) val);
49 return true;
50 }});
51
52 props.push_back({"Normal Font", "DPI Scaling", PropertyType::ReadOnly,
53 dpi->normal_font().GetNativeFontInfoDesc(), true, {},
54 [dpi]() { return dpi->normal_font().GetNativeFontInfoDesc(); },
55 nullptr});
56
57 props.push_back({"Force Rescale", "DPI Scaling", PropertyType::Boolean,
58 dpi->force_rescale() ? "true" : "false", true, {},
59 [dpi]() { return dpi->force_rescale() ? "true" : "false"; },
60 nullptr});
61}
Definition CustomWidgetsPlugin.hpp:10