Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Matena <lukasmatena@seznam.cz>2021-05-24 13:22:46 +0300
committerLukas Matena <lukasmatena@seznam.cz>2021-05-24 13:23:39 +0300
commit4960b125c54ca4ae59b9143116c6eaed884cca26 (patch)
treebd328f4b4fd653ab24aea6f43e1125d2c861fb7e /src/slic3r/GUI/ConfigWizard.cpp
parentc05b8210f24c6d127778a8762ba1d5af1411e7fd (diff)
Fixed incorrect locales handling in the UI (Field, ObjectManipulation, etc)
Diffstat (limited to 'src/slic3r/GUI/ConfigWizard.cpp')
-rw-r--r--src/slic3r/GUI/ConfigWizard.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/slic3r/GUI/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp
index c35172752..f7d16d843 100644
--- a/src/slic3r/GUI/ConfigWizard.cpp
+++ b/src/slic3r/GUI/ConfigWizard.cpp
@@ -1388,17 +1388,21 @@ static void focus_event(wxFocusEvent& e, wxTextCtrl* ctrl, double def_value)
{
e.Skip();
wxString str = ctrl->GetValue();
- // Replace the first occurence of comma in decimal number.
- bool was_replace = str.Replace(",", ".", false) > 0;
+
+ const char dec_sep = is_decimal_separator_point() ? '.' : ',';
+ const char dec_sep_alt = dec_sep == '.' ? ',' : '.';
+ // Replace the first incorrect separator in decimal number.
+ bool was_replaced = str.Replace(dec_sep_alt, dec_sep, false) != 0;
+
double val = 0.0;
- if (!str.ToCDouble(&val)) {
+ if (!str.ToDouble(&val)) {
if (val == 0.0)
val = def_value;
ctrl->SetValue(double_to_string(val));
show_error(nullptr, _L("Invalid numeric input."));
ctrl->SetFocus();
}
- else if (was_replace)
+ else if (was_replaced)
ctrl->SetValue(double_to_string(val));
}
@@ -1447,12 +1451,12 @@ PageDiameters::PageDiameters(ConfigWizard *parent)
void PageDiameters::apply_custom_config(DynamicPrintConfig &config)
{
double val = 0.0;
- diam_nozzle->GetValue().ToCDouble(&val);
+ diam_nozzle->GetValue().ToDouble(&val);
auto *opt_nozzle = new ConfigOptionFloats(1, val);
config.set_key_value("nozzle_diameter", opt_nozzle);
val = 0.0;
- diam_filam->GetValue().ToCDouble(&val);
+ diam_filam->GetValue().ToDouble(&val);
auto * opt_filam = new ConfigOptionFloats(1, val);
config.set_key_value("filament_diameter", opt_filam);