comparison os2/dw.c @ 1567:91d3586cf2a4

Fix issues with resizing scrollboxes on OS/2 that are not in their initial position. Also some source code formatting cleanups.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 21 Jan 2012 01:06:09 +0000
parents 035bc006afbe
children 625c4d1555fe
comparison
equal deleted inserted replaced
1566:035bc006afbe 1567:91d3586cf2a4
1331 hpos = contentbox->minwidth; 1331 hpos = contentbox->minwidth;
1332 WinSendMsg(hscroll, SBM_SETPOS, (MPARAM)hpos, 0); 1332 WinSendMsg(hscroll, SBM_SETPOS, (MPARAM)hpos, 0);
1333 } 1333 }
1334 1334
1335 /* Position the scrolled box */ 1335 /* Position the scrolled box */
1336 WinSetWindowPos(box, HWND_TOP, 0, -(cy - origy), cx, cy, SWP_MOVE | SWP_SIZE | SWP_ZORDER); 1336 WinSetWindowPos(box, HWND_TOP, -hpos, -(cy - origy - vpos), cx, cy, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
1337 1337
1338 dw_window_set_data(handle, "_dw_cy", (void *)(cy - origy)); 1338 dw_window_set_data(handle, "_dw_cy", (void *)(cy - origy));
1339 1339
1340 /* Layout the content of the scrollbox */ 1340 /* Layout the content of the scrollbox */
1341 _do_resize(contentbox, cx, cy); 1341 _do_resize(contentbox, cx, cy);
2062 int *pos, min, max, page, which = SHORT2FROMMP(mp2); 2062 int *pos, min, max, page, which = SHORT2FROMMP(mp2);
2063 HWND handle, client = WinWindowFromID(hWnd, FID_CLIENT); 2063 HWND handle, client = WinWindowFromID(hWnd, FID_CLIENT);
2064 HWND box = (HWND)dw_window_get_data(hWnd, "_dw_resizebox"); 2064 HWND box = (HWND)dw_window_get_data(hWnd, "_dw_resizebox");
2065 HWND hscroll = WinWindowFromID(hWnd, FID_HORZSCROLL); 2065 HWND hscroll = WinWindowFromID(hWnd, FID_HORZSCROLL);
2066 HWND vscroll = WinWindowFromID(hWnd, FID_VERTSCROLL); 2066 HWND vscroll = WinWindowFromID(hWnd, FID_VERTSCROLL);
2067 int hpos = dw_scrollbar_get_pos(hscroll); 2067 int hpos = dw_scrollbar_get_pos(hscroll);
2068 int vpos = dw_scrollbar_get_pos(vscroll); 2068 int vpos = dw_scrollbar_get_pos(vscroll);
2069 int cy = (int)dw_window_get_data(hWnd, "_dw_cy"); 2069 int cy = (int)dw_window_get_data(hWnd, "_dw_cy");
2070 RECTL rect; 2070 RECTL rect;
2071 2071
2072 WinQueryWindowRect(client, &rect); 2072 WinQueryWindowRect(client, &rect);
2073 2073
2074 if(msg == WM_VSCROLL) 2074 if(msg == WM_VSCROLL)
2075 { 2075 {
2076 page = rect.yTop - rect.yBottom; 2076 page = rect.yTop - rect.yBottom;
2077 handle = vscroll; 2077 handle = vscroll;
2078 pos = &vpos; 2078 pos = &vpos;
2079 } 2079 }
2080 else 2080 else
2081 { 2081 {
2082 page = rect.xRight - rect.xLeft; 2082 page = rect.xRight - rect.xLeft;
2083 handle = hscroll; 2083 handle = hscroll;
2084 pos = &hpos; 2084 pos = &hpos;
2085 } 2085 }
2086 2086
2087 res = WinSendMsg(handle, SBM_QUERYRANGE, 0, 0); 2087 res = WinSendMsg(handle, SBM_QUERYRANGE, 0, 0);
2088 min = SHORT1FROMMP(res); 2088 min = SHORT1FROMMP(res);
2089 max = SHORT2FROMMP(res); 2089 max = SHORT2FROMMP(res);
2112 (*pos) += page; 2112 (*pos) += page;
2113 if(*pos > max) 2113 if(*pos > max)
2114 *pos = max; 2114 *pos = max;
2115 break; 2115 break;
2116 } 2116 }
2117 WinSendMsg(handle, SBM_SETPOS, (MPARAM)*pos, 0); 2117 WinSendMsg(handle, SBM_SETPOS, (MPARAM)*pos, 0);
2118 /* Position the scrolled box */ 2118 /* Position the scrolled box */
2119 WinSetWindowPos(box, HWND_TOP, -hpos, -(cy - vpos), 0, 0, SWP_MOVE); 2119 WinSetWindowPos(box, HWND_TOP, -hpos, -(cy - vpos), 0, 0, SWP_MOVE);
2120 break; 2120 break;
2121 } 2121 }
2122 } 2122 }
2123 return WinDefWindowProc(hWnd, msg, mp1, mp2); 2123 return WinDefWindowProc(hWnd, msg, mp1, mp2);
2124 } 2124 }