Mercurial > dwindows
comparison win/dw.c @ 182:b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
making it divisible by 2.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 06 Dec 2002 23:34:49 +0000 |
parents | 978b954eb70e |
children | f55677513954 |
comparison
equal
deleted
inserted
replaced
181:978b954eb70e | 182:b8caec82a4d2 |
---|---|
1193 BOOL CALLBACK _wndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) | 1193 BOOL CALLBACK _wndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) |
1194 { | 1194 { |
1195 int result = -1; | 1195 int result = -1; |
1196 static int command_active = 0; | 1196 static int command_active = 0; |
1197 SignalHandler *tmp = Root; | 1197 SignalHandler *tmp = Root; |
1198 void (* windowfunc)(PVOID); | 1198 void (*windowfunc)(PVOID); |
1199 ULONG origmsg = msg; | 1199 ULONG origmsg = msg; |
1200 | 1200 |
1201 if(msg == WM_RBUTTONDOWN || msg == WM_MBUTTONDOWN) | 1201 if(msg == WM_RBUTTONDOWN || msg == WM_MBUTTONDOWN) |
1202 msg = WM_LBUTTONDOWN; | 1202 msg = WM_LBUTTONDOWN; |
1203 if(msg == WM_RBUTTONUP || msg == WM_MBUTTONUP) | 1203 if(msg == WM_RBUTTONUP || msg == WM_MBUTTONUP) |
2318 | 2318 |
2319 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y) | 2319 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y) |
2320 { | 2320 { |
2321 if(type == BOXHORZ) | 2321 if(type == BOXHORZ) |
2322 { | 2322 { |
2323 int newx = x - SPLITBAR_WIDTH, newy = y; | 2323 int newx = x; |
2324 float ratio = (float)percent/(float)100.0; | 2324 float ratio = (float)percent/(float)100.0; |
2325 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); | 2325 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); |
2326 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); | 2326 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); |
2327 Box *tmp = (Box *)GetWindowLong(handle1, GWL_USERDATA); | 2327 Box *tmp = (Box *)GetWindowLong(handle1, GWL_USERDATA); |
2328 | 2328 |
2329 newx = (int)((float)newx * ratio); | 2329 newx = (int)((float)newx * ratio) - (SPLITBAR_WIDTH/2); |
2330 | 2330 |
2331 ShowWindow(handle1, SW_HIDE); | 2331 ShowWindow(handle1, SW_HIDE); |
2332 ShowWindow(handle2, SW_HIDE); | 2332 ShowWindow(handle2, SW_HIDE); |
2333 | 2333 |
2334 MoveWindow(handle1, 0, 0, newx, y, FALSE); | 2334 MoveWindow(handle1, 0, 0, newx, y, FALSE); |
2335 _do_resize(tmp, newx, y); | 2335 _do_resize(tmp, newx - 1, y - 1); |
2336 | 2336 |
2337 tmp = (Box *)GetWindowLong(handle2, GWL_USERDATA); | 2337 tmp = (Box *)GetWindowLong(handle2, GWL_USERDATA); |
2338 | 2338 |
2339 newx = x - newx - SPLITBAR_WIDTH; | 2339 newx = x - newx - SPLITBAR_WIDTH; |
2340 | 2340 |
2341 MoveWindow(handle2, x - newx, 0, newx, y, FALSE); | 2341 MoveWindow(handle2, x - newx, 0, newx, y, FALSE); |
2342 _do_resize(tmp, newx, y); | 2342 _do_resize(tmp, newx - 1, y - 1); |
2343 | 2343 |
2344 ShowWindow(handle1, SW_SHOW); | 2344 ShowWindow(handle1, SW_SHOW); |
2345 ShowWindow(handle2, SW_SHOW); | 2345 ShowWindow(handle2, SW_SHOW); |
2346 | 2346 |
2347 dw_window_set_data(hwnd, "_dw_start", (void *)newx); | 2347 dw_window_set_data(hwnd, "_dw_start", (void *)newx); |
2348 } | 2348 } |
2349 else | 2349 else |
2350 { | 2350 { |
2351 int newx = x, newy = y - SPLITBAR_WIDTH; | 2351 int newy = y; |
2352 float ratio = (float)(100.0-percent)/(float)100.0; | 2352 float ratio = (float)(100.0-percent)/(float)100.0; |
2353 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); | 2353 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); |
2354 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); | 2354 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); |
2355 Box *tmp = (Box *)GetWindowLong(handle1, GWL_USERDATA); | 2355 Box *tmp = (Box *)GetWindowLong(handle1, GWL_USERDATA); |
2356 | 2356 |
2357 newy = (int)((float)newy * ratio); | 2357 newy = (int)((float)newy * ratio) - (SPLITBAR_WIDTH/2); |
2358 | 2358 |
2359 ShowWindow(handle1, SW_HIDE); | 2359 ShowWindow(handle1, SW_HIDE); |
2360 ShowWindow(handle2, SW_HIDE); | 2360 ShowWindow(handle2, SW_HIDE); |
2361 | 2361 |
2362 MoveWindow(handle1, 0, y - newy, x, newy, FALSE); | 2362 MoveWindow(handle1, 0, y - newy, x, newy, FALSE); |
2363 _do_resize(tmp, x, newy); | 2363 _do_resize(tmp, x - 1, newy - 1); |
2364 | 2364 |
2365 tmp = (Box *)GetWindowLong(handle2, GWL_USERDATA); | 2365 tmp = (Box *)GetWindowLong(handle2, GWL_USERDATA); |
2366 | 2366 |
2367 newy = y - newy - SPLITBAR_WIDTH; | 2367 newy = y - newy - SPLITBAR_WIDTH; |
2368 | 2368 |
2369 MoveWindow(handle2, 0, 0, x, newy, FALSE); | 2369 MoveWindow(handle2, 0, 0, x, newy, FALSE); |
2370 _do_resize(tmp, x, newy); | 2370 _do_resize(tmp, x - 1, newy - 1); |
2371 | 2371 |
2372 ShowWindow(handle1, SW_SHOW); | 2372 ShowWindow(handle1, SW_SHOW); |
2373 ShowWindow(handle2, SW_SHOW); | 2373 ShowWindow(handle2, SW_SHOW); |
2374 | 2374 |
2375 dw_window_set_data(hwnd, "_dw_start", (void *)newy); | 2375 dw_window_set_data(hwnd, "_dw_start", (void *)newy); |
2403 HPEN oldPen = SelectObject(hdcPaint, CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DFACE))); | 2403 HPEN oldPen = SelectObject(hdcPaint, CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DFACE))); |
2404 | 2404 |
2405 dw_window_get_pos_size(hwnd, NULL, NULL, &cx, &cy); | 2405 dw_window_get_pos_size(hwnd, NULL, NULL, &cx, &cy); |
2406 | 2406 |
2407 if(type == BOXHORZ) | 2407 if(type == BOXHORZ) |
2408 Rectangle(hdcPaint, cx - start - 3, 0, cx - start, cy); | 2408 Rectangle(hdcPaint, cx - start - SPLITBAR_WIDTH, 0, cx - start, cy); |
2409 else | 2409 else |
2410 Rectangle(hdcPaint, 0, start, cx, start + 3); | 2410 Rectangle(hdcPaint, 0, start, cx, start + SPLITBAR_WIDTH); |
2411 | 2411 |
2412 SelectObject(hdcPaint, oldBrush); | 2412 SelectObject(hdcPaint, oldBrush); |
2413 DeleteObject(SelectObject(hdcPaint, oldPen)); | 2413 DeleteObject(SelectObject(hdcPaint, oldPen)); |
2414 ReleaseDC(hwnd, hdcPaint); | 2414 ReleaseDC(hwnd, hdcPaint); |
2415 } | 2415 } |