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

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2019-05-20 13:21:05 +0300
committerbubnikv <bubnikv@gmail.com>2019-05-20 13:21:05 +0300
commitf6de7a629b9c8acfa9e81a04dddde67692bc3e74 (patch)
treea9d01c89a561f175a452f4974e2e8534222aec21 /src/slic3r/GUI/Field.cpp
parent9fca67d2812090befec5a159facc16b22c1d5b85 (diff)
Hopefully a fix of support_material_contact_distance: numeric input not valid (#2278)
Fixed an issue where one was comparing non-localized label with a localized one.
Diffstat (limited to 'src/slic3r/GUI/Field.cpp')
-rw-r--r--src/slic3r/GUI/Field.cpp34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp
index e7bdd1e6b..1d76924c9 100644
--- a/src/slic3r/GUI/Field.cpp
+++ b/src/slic3r/GUI/Field.cpp
@@ -583,12 +583,15 @@ void Choice::BUILD() {
// recast as a wxWindow to fit the calling convention
window = dynamic_cast<wxWindow*>(temp);
- if (m_opt.enum_labels.empty() && m_opt.enum_values.empty()) {
- }
- else{
- for (auto el : m_opt.enum_labels.empty() ? m_opt.enum_values : m_opt.enum_labels) {
- const wxString& str = _(el);//m_opt_id == "support" ? _(el) : el;
- temp->Append(str);
+ if (! m_opt.enum_labels.empty() || ! m_opt.enum_values.empty()) {
+ if (m_opt.enum_labels.empty()) {
+ // Append non-localized enum_values
+ for (auto el : m_opt.enum_values)
+ temp->Append(el);
+ } else {
+ // Append localized enum_labels
+ for (auto el : m_opt.enum_labels)
+ temp->Append(_(el));
}
set_selection();
}
@@ -856,7 +859,7 @@ boost::any& Choice::get_value()
else if (m_opt.gui_type == "f_enum_open") {
const int ret_enum = field->GetSelection();
if (ret_enum < 0 || m_opt.enum_values.empty() || m_opt.type == coStrings ||
- ret_str != m_opt.enum_values[ret_enum] && ret_str != m_opt.enum_labels[ret_enum] )
+ (ret_str != m_opt.enum_values[ret_enum] && ret_str != _(m_opt.enum_labels[ret_enum])))
// modifies ret_string!
get_value_by_opt_type(ret_str);
else
@@ -892,15 +895,16 @@ void Choice::msw_rescale()
// Set rescaled size
field->SetSize(size);
- size_t idx, counter = idx = 0;
- if (m_opt.enum_labels.empty() && m_opt.enum_values.empty()) {}
- else{
- for (auto el : m_opt.enum_labels.empty() ? m_opt.enum_values : m_opt.enum_labels) {
- const wxString& str = _(el);
- field->Append(str);
- if (el.compare(selection) == 0)
+ size_t idx = 0;
+ if (! m_opt.enum_labels.empty() || ! m_opt.enum_values.empty()) {
+ size_t counter = 0;
+ bool labels = ! m_opt.enum_labels.empty();
+ for (const std::string &el : labels ? m_opt.enum_labels : m_opt.enum_values) {
+ wxString text = labels ? _(el) : wxString::ToUTF8(el.c_str());
+ field->Append(text);
+ if (text == selection)
idx = counter;
- ++counter;
+ ++ counter;
}
}