From 83c22707a40f2b96601748bddbce4d927ab3c084 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 6 Jun 2001 16:27:45 +0000 Subject: [PATCH] fixed slider value rounding once again git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10441 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/slider.cpp | 4 ++-- src/gtk1/slider.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gtk/slider.cpp b/src/gtk/slider.cpp index 6ad996cbfc..00a061af9e 100644 --- a/src/gtk/slider.cpp +++ b/src/gtk/slider.cpp @@ -62,7 +62,7 @@ static void gtk_slider_callback( GtkAdjustment *adjust, wxSlider *win ) else if (range->scroll_type == GTK_SCROLL_PAGE_FORWARD) command = wxEVT_SCROLL_PAGEDOWN; double dvalue = adjust->value; - int value = (int)(dvalue >= 0 ? dvalue - 0.5 : dvalue + 0.5); + int value = (int)(dvalue < 0 ? dvalue - 0.5 : dvalue + 0.5); int orient = wxHORIZONTAL; if ( (win->GetWindowStyleFlag() & wxSB_VERTICAL) == wxSB_VERTICAL) @@ -161,7 +161,7 @@ int wxSlider::GetValue() const // we want to round to the nearest integer, i.e. 0.9 is rounded to 1 and // -0.9 is rounded to -1 double val = m_adjust->value; - return (int)(val >= 0 ? val - 0.5 : val + 0.5); + return (int)(val < 0 ? val - 0.5 : val + 0.5); } void wxSlider::SetValue( int value ) diff --git a/src/gtk1/slider.cpp b/src/gtk1/slider.cpp index 6ad996cbfc..00a061af9e 100644 --- a/src/gtk1/slider.cpp +++ b/src/gtk1/slider.cpp @@ -62,7 +62,7 @@ static void gtk_slider_callback( GtkAdjustment *adjust, wxSlider *win ) else if (range->scroll_type == GTK_SCROLL_PAGE_FORWARD) command = wxEVT_SCROLL_PAGEDOWN; double dvalue = adjust->value; - int value = (int)(dvalue >= 0 ? dvalue - 0.5 : dvalue + 0.5); + int value = (int)(dvalue < 0 ? dvalue - 0.5 : dvalue + 0.5); int orient = wxHORIZONTAL; if ( (win->GetWindowStyleFlag() & wxSB_VERTICAL) == wxSB_VERTICAL) @@ -161,7 +161,7 @@ int wxSlider::GetValue() const // we want to round to the nearest integer, i.e. 0.9 is rounded to 1 and // -0.9 is rounded to -1 double val = m_adjust->value; - return (int)(val >= 0 ? val - 0.5 : val + 0.5); + return (int)(val < 0 ? val - 0.5 : val + 0.5); } void wxSlider::SetValue( int value ) -- 2.45.2