comparison os2/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 4207e64d4689
children b5a92b04b298
comparison
equal deleted inserted replaced
181:978b954eb70e 182:b8caec82a4d2
2256 /* The main window procedure for Dynamic Windows, all the resizing code is done here. */ 2256 /* The main window procedure for Dynamic Windows, all the resizing code is done here. */
2257 MRESULT EXPENTRY _wndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) 2257 MRESULT EXPENTRY _wndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
2258 { 2258 {
2259 int result = -1; 2259 int result = -1;
2260 static int command_active = 0; 2260 static int command_active = 0;
2261 void (* windowfunc)(PVOID) = 0L; 2261 void (* API windowfunc)(PVOID) = 0L;
2262 2262
2263 if(!command_active) 2263 if(!command_active)
2264 { 2264 {
2265 /* Make sure we don't end up in infinite recursion */ 2265 /* Make sure we don't end up in infinite recursion */
2266 command_active = 1; 2266 command_active = 1;
2387 dw_window_destroy(WinQueryWindow(hWnd, QW_PARENT)); 2387 dw_window_destroy(WinQueryWindow(hWnd, QW_PARENT));
2388 return (MRESULT)TRUE; 2388 return (MRESULT)TRUE;
2389 } 2389 }
2390 break; 2390 break;
2391 case WM_USER: 2391 case WM_USER:
2392 windowfunc = (void (*)(void *))mp1; 2392 windowfunc = (void (* API)(void *))mp1;
2393 2393
2394 if(windowfunc) 2394 if(windowfunc)
2395 windowfunc((void *)mp2); 2395 windowfunc((void *)mp2);
2396 break; 2396 break;
2397 case WM_CHAR: 2397 case WM_CHAR:
2445 2445
2446 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y) 2446 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y)
2447 { 2447 {
2448 if(type == BOXHORZ) 2448 if(type == BOXHORZ)
2449 { 2449 {
2450 int newx = x - SPLITBAR_WIDTH; 2450 int newx = x;
2451 float ratio = (float)percent/(float)100.0; 2451 float ratio = (float)percent/(float)100.0;
2452 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); 2452 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft");
2453 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); 2453 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright");
2454 Box *tmp = WinQueryWindowPtr(handle1, QWP_USER); 2454 Box *tmp = WinQueryWindowPtr(handle1, QWP_USER);
2455 2455
2456 WinShowWindow(handle1, FALSE); 2456 WinShowWindow(handle1, FALSE);
2457 WinShowWindow(handle2, FALSE); 2457 WinShowWindow(handle2, FALSE);
2458 2458
2459 newx = (int)((float)newx * ratio); 2459 newx = (int)((float)newx * ratio) - (SPLITBAR_WIDTH/2);
2460 2460
2461 WinSetWindowPos(handle1, NULLHANDLE, 0, 0, newx, y, SWP_MOVE | SWP_SIZE); 2461 WinSetWindowPos(handle1, NULLHANDLE, 0, 0, newx, y, SWP_MOVE | SWP_SIZE);
2462 _do_resize(tmp, newx, y); 2462 _do_resize(tmp, newx - 1, y - 1);
2463 2463
2464 dw_window_set_data(hwnd, "_dw_start", (void *)newx); 2464 dw_window_set_data(hwnd, "_dw_start", (void *)newx);
2465 2465
2466 tmp = WinQueryWindowPtr(handle2, QWP_USER); 2466 tmp = WinQueryWindowPtr(handle2, QWP_USER);
2467 2467
2468 newx = x - newx - SPLITBAR_WIDTH; 2468 newx = x - newx - SPLITBAR_WIDTH;
2469 2469
2470 WinSetWindowPos(handle2, NULLHANDLE, x - newx, 0, newx, y, SWP_MOVE | SWP_SIZE); 2470 WinSetWindowPos(handle2, NULLHANDLE, x - newx, 0, newx, y, SWP_MOVE | SWP_SIZE);
2471 _do_resize(tmp, newx, y); 2471 _do_resize(tmp, newx - 1, y - 1);
2472 2472
2473 WinShowWindow(handle1, TRUE); 2473 WinShowWindow(handle1, TRUE);
2474 WinShowWindow(handle2, TRUE); 2474 WinShowWindow(handle2, TRUE);
2475 } 2475 }
2476 else 2476 else
2477 { 2477 {
2478 int newy = y - SPLITBAR_WIDTH; 2478 int newy = y;
2479 float ratio = (float)percent/(float)100.0; 2479 float ratio = (float)percent/(float)100.0;
2480 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); 2480 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft");
2481 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); 2481 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright");
2482 Box *tmp = WinQueryWindowPtr(handle1, QWP_USER); 2482 Box *tmp = WinQueryWindowPtr(handle1, QWP_USER);
2483 2483
2484 WinShowWindow(handle1, FALSE); 2484 WinShowWindow(handle1, FALSE);
2485 WinShowWindow(handle2, FALSE); 2485 WinShowWindow(handle2, FALSE);
2486 2486
2487 newy = (int)((float)newy * ratio); 2487 newy = (int)((float)newy * ratio) - (SPLITBAR_WIDTH/2);
2488 2488
2489 WinSetWindowPos(handle1, NULLHANDLE, 0, y - newy, x, newy, SWP_MOVE | SWP_SIZE); 2489 WinSetWindowPos(handle1, NULLHANDLE, 0, y - newy, x, newy, SWP_MOVE | SWP_SIZE);
2490 _do_resize(tmp, x, newy); 2490 _do_resize(tmp, x - 1, newy - 1);
2491 2491
2492 tmp = WinQueryWindowPtr(handle2, QWP_USER); 2492 tmp = WinQueryWindowPtr(handle2, QWP_USER);
2493 2493
2494 newy = y - newy - SPLITBAR_WIDTH; 2494 newy = y - newy - SPLITBAR_WIDTH;
2495 2495
2496 WinSetWindowPos(handle2, NULLHANDLE, 0, 0, x, newy, SWP_MOVE | SWP_SIZE); 2496 WinSetWindowPos(handle2, NULLHANDLE, 0, 0, x, newy, SWP_MOVE | SWP_SIZE);
2497 _do_resize(tmp, x, newy); 2497 _do_resize(tmp, x - 1, newy - 1);
2498 2498
2499 WinShowWindow(handle1, TRUE); 2499 WinShowWindow(handle1, TRUE);
2500 WinShowWindow(handle2, TRUE); 2500 WinShowWindow(handle2, TRUE);
2501 2501
2502 dw_window_set_data(hwnd, "_dw_start", (void *)newy); 2502 dw_window_set_data(hwnd, "_dw_start", (void *)newy);