# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1082525631 0 # Node ID c0a708e2cba37fc706a52e1ad532411103c3df08 # Parent 7ca86c417a584a8fa65b02c693838259832c8177 Removed dw_percent_get_range() to simplify coding. The range is now always 0 to 100 no matter what platform or widget size. diff -r 7ca86c417a58 -r c0a708e2cba3 dw.def --- a/dw.def Wed Apr 21 04:56:34 2004 +0000 +++ b/dw.def Wed Apr 21 05:33:51 2004 +0000 @@ -90,7 +90,6 @@ dw_listbox_selected_multi @150 dw_percent_new @160 - dw_percent_get_range @161 dw_percent_set_pos @162 dw_mle_new @170 diff -r 7ca86c417a58 -r c0a708e2cba3 dw.h --- a/dw.h Wed Apr 21 04:56:34 2004 +0000 +++ b/dw.h Wed Apr 21 05:33:51 2004 +0000 @@ -952,7 +952,6 @@ void API dw_listbox_set_text(HWND handle, unsigned int index, char *buffer); unsigned int API dw_listbox_selected(HWND handle); int API dw_listbox_selected_multi(HWND handle, int where); -unsigned int API dw_percent_get_range(HWND handle); void API dw_percent_set_pos(HWND handle, unsigned int position); unsigned int API dw_slider_get_pos(HWND handle); void API dw_slider_set_pos(HWND handle, unsigned int position); diff -r 7ca86c417a58 -r c0a708e2cba3 dww.def --- a/dww.def Wed Apr 21 04:56:34 2004 +0000 +++ b/dww.def Wed Apr 21 05:33:51 2004 +0000 @@ -87,7 +87,6 @@ dw_listbox_selected_multi @150 dw_percent_new @160 - dw_percent_get_range @161 dw_percent_set_pos @162 dw_mle_new @170 diff -r 7ca86c417a58 -r c0a708e2cba3 gtk/dw.c --- a/gtk/dw.c Wed Apr 21 04:56:34 2004 +0000 +++ b/gtk/dw.c Wed Apr 21 05:33:51 2004 +0000 @@ -4630,16 +4630,6 @@ } /* - * Returns the range of the percent bar. - * Parameters: - * handle: Handle to the percent bar to be queried. - */ -unsigned int dw_percent_get_range(HWND handle) -{ - return 100; -} - -/* * Sets the percent bar position. * Parameters: * handle: Handle to the percent bar to be set. diff -r 7ca86c417a58 -r c0a708e2cba3 os2/dw.c --- a/os2/dw.c Wed Apr 21 04:56:34 2004 +0000 +++ b/os2/dw.c Wed Apr 21 05:33:51 2004 +0000 @@ -252,6 +252,12 @@ return res; } +/* Used in the slider and percent classes internally */ +unsigned int _dw_percent_get_range(HWND handle) +{ + return SHORT2FROMMP(WinSendMsg(handle, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), 0)); +} + /* Return the entryfield child of a window */ HWND _find_entryfield(HWND handle) { @@ -1812,7 +1818,7 @@ int _dw_int_pos(HWND hwnd) { int pos = (int)dw_window_get_data(hwnd, "_dw_percent_value"); - int range = dw_percent_get_range(hwnd); + int range = _dw_percent_get_range(hwnd); float fpos = (float)pos; float frange = (float)range; float fnew = (fpos/1000.0)*frange; @@ -1821,7 +1827,7 @@ void _dw_int_set(HWND hwnd, int pos) { - int inew, range = dw_percent_get_range(hwnd); + int inew, range = _dw_percent_get_range(hwnd); if(range) { float fpos = (float)pos; @@ -5948,16 +5954,6 @@ } /* - * Returns the range of the percent bar. - * Parameters: - * handle: Handle to the percent bar to be queried. - */ -unsigned int API dw_percent_get_range(HWND handle) -{ - return SHORT2FROMMP(WinSendMsg(handle, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), 0)); -} - -/* * Sets the percent bar position. * Parameters: * handle: Handle to the percent bar to be set. @@ -5965,8 +5961,14 @@ */ void API dw_percent_set_pos(HWND handle, unsigned int position) { - _dw_int_set(handle, position); - WinSendMsg(handle, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)position); + int range = _dw_percent_get_range(handle); + int mypos = ((float)position/100)*range; + + if(range) + { + _dw_int_set(handle, mypos); + WinSendMsg(handle, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)mypos); + } } /* diff -r 7ca86c417a58 -r c0a708e2cba3 win/dw.c --- a/win/dw.c Wed Apr 21 04:56:34 2004 +0000 +++ b/win/dw.c Wed Apr 21 05:33:51 2004 +0000 @@ -5972,16 +5972,6 @@ } /* - * Returns the range of the percent bar. - * Parameters: - * handle: Handle to the percent bar to be queried. - */ -unsigned int API dw_percent_get_range(HWND handle) -{ - return (unsigned int)SendMessage(handle, PBM_GETRANGE, (WPARAM)FALSE, 0); -} - -/* * Sets the percent bar position. * Parameters: * handle: Handle to the percent bar to be set.