Fixed couple of warnings in Field.cpp, GUI_App.cpp and OptionsGroup.cpp

This commit is contained in:
YuSanka 2019-09-03 10:59:04 +02:00
parent f73976ec8f
commit 6befe7099b
3 changed files with 20 additions and 16 deletions

View file

@ -197,7 +197,7 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
show_error(m_parent, _(L("Invalid numeric input.")));
set_value(double_to_string(val), true);
}
else if (check_value && (m_opt.sidetext.rfind("mm/s") != std::string::npos && val > m_opt.max ||
else if (check_value && ((m_opt.sidetext.rfind("mm/s") != std::string::npos && val > m_opt.max) ||
m_opt.sidetext.rfind("mm ") != std::string::npos && val > 1) &&
(m_value.empty() || std::string(str.ToUTF8().data()) != boost::any_cast<std::string>(m_value)))
{
@ -444,7 +444,7 @@ void TextCtrl::disable() { dynamic_cast<wxTextCtrl*>(window)->Disable(); dynamic
#ifdef __WXGTK__
void TextCtrl::change_field_value(wxEvent& event)
{
if (bChangedValueEvent = event.GetEventType()==wxEVT_KEY_UP)
if (bChangedValueEvent = (event.GetEventType()==wxEVT_KEY_UP))
on_change_field();
event.Skip();
};
@ -768,7 +768,7 @@ void Choice::set_selection()
size_t idx = 0;
for (auto el : m_opt.enum_values)
{
if (el.compare(text_value) == 0)
if (el == text_value)
break;
++idx;
}
@ -789,7 +789,7 @@ void Choice::set_selection()
size_t idx = 0;
for (auto el : m_opt.enum_values)
{
if (el.compare(text_value) == 0)
if (el == text_value)
break;
++idx;
}
@ -804,7 +804,7 @@ void Choice::set_selection()
size_t idx = 0;
for (auto el : m_opt.enum_values)
{
if (el.compare(text_value) == 0)
if (el == text_value)
break;
++idx;
}
@ -813,6 +813,7 @@ void Choice::set_selection()
field->SetSelection(idx);
break;
}
default: break;
}
}
@ -823,7 +824,7 @@ void Choice::set_value(const std::string& value, bool change_event) //! Redunda
size_t idx=0;
for (auto el : m_opt.enum_values)
{
if (el.compare(value) == 0)
if (el == value)
break;
++idx;
}
@ -856,7 +857,7 @@ void Choice::set_value(const boost::any& value, bool change_event)
auto idx = 0;
for (auto el : m_opt.enum_values)
{
if (el.compare(text_value) == 0)
if (el == text_value)
break;
++idx;
}
@ -887,7 +888,7 @@ void Choice::set_value(const boost::any& value, bool change_event)
size_t idx = 0;
for (auto el : m_opt.enum_values)
{
if (el.compare(key) == 0)
if (el == key)
break;
++idx;
}

View file

@ -303,8 +303,9 @@ bool GUI_App::on_init_inner()
* change min hight of object list to the normal min value (15 * wxGetApp().em_unit())
* after first whole Mainframe updating/layouting
*/
if (obj_list()->GetMinSize().GetY() > 15 * em_unit())
obj_list()->SetMinSize(wxSize(-1, 15 * em_unit()));
const int list_min_height = 15 * em_unit();
if (obj_list()->GetMinSize().GetY() > list_min_height)
obj_list()->SetMinSize(wxSize(-1, list_min_height));
update_mode(); // update view mode after fix of the object_list size
@ -475,8 +476,9 @@ void GUI_App::recreate_GUI()
* change min hight of object list to the normal min value (15 * wxGetApp().em_unit())
* after first whole Mainframe updating/layouting
*/
if (obj_list()->GetMinSize().GetY() > 15 * em_unit())
obj_list()->SetMinSize(wxSize(-1, 15 * em_unit()));
const int list_min_height = 15 * em_unit();
if (obj_list()->GetMinSize().GetY() > list_min_height)
obj_list()->SetMinSize(wxSize(-1, list_min_height));
update_mode();
@ -1088,7 +1090,7 @@ void GUI_App::window_pos_restore(wxTopLevelWindow* window, const std::string &na
void GUI_App::window_pos_sanitize(wxTopLevelWindow* window)
{
unsigned display_idx = wxDisplay::GetFromWindow(window);
/*unsigned*/int display_idx = wxDisplay::GetFromWindow(window);
wxRect display;
if (display_idx == wxNOT_FOUND) {
display = wxDisplay(0u).GetClientArea();

View file

@ -457,8 +457,9 @@ void ConfigOptionsGroup::Show(const bool show)
bool ConfigOptionsGroup::update_visibility(ConfigOptionMode mode) {
if (m_options_mode.empty())
return true;
if (m_grid_sizer->GetEffectiveRowsCount() != m_options_mode.size() &&
m_options_mode.size() == 1)
int opt_mode_size = m_options_mode.size();
if (m_grid_sizer->GetEffectiveRowsCount() != opt_mode_size &&
opt_mode_size == 1)
return m_options_mode[0] <= mode;
Show(true);
@ -476,7 +477,7 @@ bool ConfigOptionsGroup::update_visibility(ConfigOptionMode mode) {
coef+= cols;
}
if (hidden_row_cnt == m_options_mode.size()) {
if (hidden_row_cnt == opt_mode_size) {
sizer->ShowItems(false);
return false;
}