From d414c6e11814c01d28bbd353384ce92a55009acc Mon Sep 17 00:00:00 2001 From: YuSanka Date: Thu, 1 Feb 2018 09:29:07 +0100 Subject: [PATCH] Fix compilation on OSX & Linux --- xs/src/slic3r/GUI/Field.cpp | 12 +++++++----- xs/src/slic3r/GUI/Tab.cpp | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/xs/src/slic3r/GUI/Field.cpp b/xs/src/slic3r/GUI/Field.cpp index cc86a3648..96350fcb4 100644 --- a/xs/src/slic3r/GUI/Field.cpp +++ b/xs/src/slic3r/GUI/Field.cpp @@ -4,6 +4,7 @@ //#include #include #include +#include #include "PrintConfig.hpp" #include @@ -295,7 +296,7 @@ void Choice::set_selection() case coPercent: { double val = m_opt.default_value->getFloat(); text_value = val - int(val) == 0 ? wxString::Format(_T("%i"), int(val)) : wxNumberFormatter::ToString(val, 1); - auto idx = 0; + size_t idx = 0; for (auto el : m_opt.enum_values) { if (el.compare(text_value) == 0) @@ -316,7 +317,7 @@ void Choice::set_selection() case coInt:{ int val = m_opt.default_value->getInt(); //!! text_value = wxString::Format(_T("%i"), int(val)); - auto idx = 0; + size_t idx = 0; for (auto el : m_opt.enum_values) { if (el.compare(text_value) == 0) @@ -331,7 +332,7 @@ void Choice::set_selection() case coStrings:{ text_value = static_cast(m_opt.default_value)->values.at(0); - auto idx = 0; + size_t idx = 0; for (auto el : m_opt.enum_values) { if (el.compare(text_value) == 0) @@ -350,7 +351,7 @@ void Choice::set_value(const std::string value) //! Redundant? { m_disable_change_event = true; - auto idx=0; + size_t idx=0; for (auto el : m_opt.enum_values) { if (el.compare(value) == 0) @@ -535,7 +536,8 @@ void PointCtrl::set_value(boost::any value) } catch (const std::exception &e) { - int i=0; + std::cerr << "Error! Can't cast PointCtrl value" << m_opt_id << "\n"; + return; } } set_value(pt); diff --git a/xs/src/slic3r/GUI/Tab.cpp b/xs/src/slic3r/GUI/Tab.cpp index 1f2b014c6..2dd6df35b 100644 --- a/xs/src/slic3r/GUI/Tab.cpp +++ b/xs/src/slic3r/GUI/Tab.cpp @@ -87,7 +87,7 @@ void Tab::create_preset_tab(PresetBundle *preset_bundle) m_treectrl->Bind(wxEVT_COMBOBOX, &Tab::OnComboBox, this); m_presets_choice->Bind(wxEVT_COMBOBOX, ([this](wxCommandEvent e){ - select_preset(static_cast(m_presets_choice)->GetStringSelection().ToStdString()); + select_preset(static_cast(m_presets_choice)->GetStringSelection().ToStdString()); })); m_btn_save_preset->Bind(wxEVT_BUTTON, ([this](wxCommandEvent e){ save_preset(); }));