Changeset 12841
- Timestamp:
- Dec 29, 1999, 11:54:04 PM (25 years ago)
- Location:
- tags/trunk/src/user32
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified tags/trunk/src/user32/caret.cpp ¶
r12530 r12841 1 /* $Id: caret.cpp,v 1. 8 1999-12-02 16:34:43cbratschi Exp $ */1 /* $Id: caret.cpp,v 1.9 1999-12-29 22:53:59 cbratschi Exp $ */ 2 2 3 3 /* … … 148 148 else 149 149 { 150 long height = wnd->get WindowHeight();150 long height = wnd->getClientHeight(); 151 151 caretPos.y = height - caretPos.y - 1; 152 152 xNew = caretPos.x; … … 197 197 cursorInfo.y = caretPos.y; 198 198 } else { 199 long height = wnd->get WindowHeight();199 long height = wnd->getClientHeight(); 200 200 caretPos.y += cursorInfo.cy; 201 201 cursorInfo.y = height - caretPos.y - 1; -
TabularUnified tags/trunk/src/user32/dc.cpp ¶
r12786 r12841 1 /* $Id: dc.cpp,v 1.3 0 1999-12-24 21:44:03 sandervlExp $ */1 /* $Id: dc.cpp,v 1.31 1999-12-29 22:53:59 cbratschi Exp $ */ 2 2 3 3 /* … … 302 302 { 303 303 if (wnd) 304 return (wnd->get WindowHeight());304 return (wnd->getClientHeight()); 305 305 else 306 306 return OSLibQueryScreenHeight(); … … 437 437 438 438 if(hWnd == 0x6800003a) { 439 hwnd = 0x6800003a; 439 hwnd = 0x6800003a; 440 440 } 441 441 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); … … 443 443 if ((hwnd != HWND_DESKTOP) && wnd->isOwnDC()) 444 444 { 445 446 447 448 449 450 451 452 453 454 445 hPS_ownDC = wnd->getOwnDC(); 446 //SvL: Hack for memory.exe (doesn't get repainted properly otherwise) 447 if(hPS_ownDC) { 448 pHps = (pDCData)GpiQueryDCData(hPS_ownDC); 449 if (!pHps) 450 { 451 O32_SetLastError (ERROR_INVALID_PARAMETER); 452 return (HDC)NULLHANDLE; 453 } 454 } 455 455 } 456 456 … … 473 473 474 474 if(!wnd->isSuppressErase()) { 475 475 wnd->setSuppressErase(TRUE); 476 476 wnd->setEraseBkgnd (FALSE, !wnd->MsgEraseBackGround(lpps->hdc)); 477 477 } … … 480 480 if (!hPS_ownDC) 481 481 { 482 long height = wnd->get WindowHeight();482 long height = wnd->getClientHeight(); 483 483 rect.yTop = height - rect.yTop; 484 484 rect.yBottom = height - rect.yBottom; … … 531 531 BOOL WIN32API GetUpdateRect (HWND hwnd, LPRECT pRect, BOOL erase) 532 532 { 533 if ( hwnd)533 if (!hwnd) 534 534 { 535 535 O32_SetLastError (ERROR_INVALID_HANDLE); … … 540 540 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 541 541 542 BOOL updateRegionExists = WinQueryUpdateRect (hwnd, pRect ? &rectl : NULL); 542 if (!wnd) 543 { 544 O32_SetLastError (ERROR_INVALID_HANDLE); 545 return FALSE; 546 } 547 548 BOOL updateRegionExists = WinQueryUpdateRect (wnd->getOS2WindowHandle(), pRect ? &rectl : NULL); 543 549 if (!pRect) { 544 550 return (updateRegionExists); … … 562 568 else 563 569 { 564 long height = wnd->get WindowHeight();570 long height = wnd->getClientHeight(); 565 571 rectl.yTop = height - rectl.yTop; 566 572 rectl.yBottom = height - rectl.yBottom; … … 586 592 LONG Complexity; 587 593 588 Complexity = O32_GetUpdateRgn (hwnd, hrgn, FALSE); 589 if (erase && (Complexity > NULLREGION_W)) { 590 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 591 sendEraseBkgnd (wnd); 592 } 594 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 595 596 if (!wnd) 597 { 598 O32_SetLastError (ERROR_INVALID_HANDLE); 599 return ERROR_W; 600 } 601 602 Complexity = O32_GetUpdateRgn (wnd->getOS2WindowHandle(), hrgn, FALSE); 603 if (erase && (Complexity > NULLREGION_W)) sendEraseBkgnd (wnd); 593 604 594 605 return Complexity; … … 615 626 if (hwnd) 616 627 { 617 618 619 620 621 622 628 wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 629 if(wnd == NULL) { 630 dprintf (("ERROR: User32: GetDCEx bad window handle %X!!!!!", hwnd)); 631 O32_SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 632 return 0; 633 } 623 634 //SvL: Experimental change (doesn't work right) 624 635 #if 0 625 626 627 636 if(wnd->fHasParentDC() && wnd->getParent()) { 637 wnd = wnd->getParent(); 638 } 628 639 #endif 629 630 631 632 640 if (flags & DCX_WINDOW_W) 641 hWindow = wnd->getOS2FrameWindowHandle(); 642 else 643 hWindow = wnd->getOS2WindowHandle(); 633 644 } 634 645 else … … 906 917 PRECTL pr; 907 918 int i; 908 LONG height = wnd ? wnd->get WindowHeight() : OSLibQueryScreenHeight();919 LONG height = wnd ? wnd->getClientHeight() : OSLibQueryScreenHeight(); 909 920 910 921 if (!hrgn) … … 930 941 else if (pRect) 931 942 { 932 LONG height = wnd ? wnd->get WindowHeight() : OSLibQueryScreenHeight();943 LONG height = wnd ? wnd->getClientHeight() : OSLibQueryScreenHeight(); 933 944 934 945 PMRECT_FROM_WINRECT (rectl, *pRect); … … 1197 1208 1198 1209 RECT winRectUpdate; 1199 LONG height = wnd->get WindowHeight();1210 LONG height = wnd->getClientHeight(); 1200 1211 1201 1212 winRectUpdate.left = rectlUpdate.xLeft; … … 1232 1243 } 1233 1244 dprintf(("ScrollWindow %x %d %d %x %x", hwnd, dx, dy, pScroll, pClip)); 1234 MapWin32ToOS2Rectl(window->getOS2WindowHandle(),window->getClientRect(), (PRECTLOS2)&clientRect);1245 mapWin32ToOS2Rect(window,window->getClientRect(), (PRECTLOS2)&clientRect); 1235 1246 //Rectangle could be relative to parent window, so fix this 1236 1247 if(clientRect.yBottom != 0) { … … 1243 1254 } 1244 1255 if(pScroll) { 1245 MapWin32ToOS2Rectl(window->getOS2WindowHandle(),(RECT *)pScroll, (PRECTLOS2)&scrollRect);1256 mapWin32ToOS2Rect(window,(RECT *)pScroll, (PRECTLOS2)&scrollRect); 1246 1257 pScrollRect = &scrollRect; 1247 1258 … … 1256 1267 1257 1268 if(pClip) { 1258 MapWin32ToOS2Rectl(window->getOS2WindowHandle(),(RECT *)pClip, (PRECTLOS2)&clipRect);1269 mapWin32ToOS2Rect(window,(RECT *)pClip, (PRECTLOS2)&clipRect); 1259 1270 pClipRect = &clipRect; 1260 1271 … … 1300 1311 if (scrollFlag & SW_SCROLLCHILDREN_W) scrollFlags |= SW_SCROLLCHILDREN; 1301 1312 1302 if(pScroll) MapWin32ToOS2Rectl(window->getOS2WindowHandle(),(RECT *)pScroll, (PRECTLOS2)&scrollRect);1303 if(pClip) MapWin32ToOS2Rectl(window->getOS2WindowHandle(),(RECT *)pClip, (PRECTLOS2)&clipRect);1313 if(pScroll) mapWin32ToOS2Rect(window,(RECT *)pScroll, (PRECTLOS2)&scrollRect); 1314 if(pClip) mapWin32ToOS2Rect(window,(RECT *)pClip, (PRECTLOS2)&clipRect); 1304 1315 1305 1316 RECTL rectlUpdate; … … 1324 1335 1325 1336 RECT winRectUpdate; 1326 LONG height = window->get WindowHeight();1337 LONG height = window->getClientHeight(); 1327 1338 1328 1339 winRectUpdate.left = rectlUpdate.xLeft; … … 1391 1402 { 1392 1403 if(lprc) { 1393 1394 } 1395 else dprintf(("USER32: ValidateRect %x", hwnd)); 1396 1404 dprintf(("USER32: ValidateRect %x (%d,%d)(%d,%d)", hwnd, lprc->left, lprc->top, lprc->right, lprc->bottom)); 1405 } 1406 else dprintf(("USER32: ValidateRect %x", hwnd)); 1407 1397 1408 return RedrawWindow( hwnd, lprc, 0, RDW_VALIDATE_W | RDW_NOCHILDREN_W | (hwnd==0 ? RDW_UPDATENOW_W : 0)); 1398 1409 } -
TabularUnified tags/trunk/src/user32/edit.cpp ¶
r12812 r12841 1 /* $Id: edit.cpp,v 1.2 8 1999-12-28 17:04:22cbratschi Exp $ */1 /* $Id: edit.cpp,v 1.29 1999-12-29 22:53:59 cbratschi Exp $ */ 2 2 /* 3 3 * Edit control … … 20 20 new in Win98, Win2k: for single line too 21 21 - WinNT/Win2k: higher size limits (single: 0x7FFFFFFE, multi: none) 22 - too many GetDC/ReleaseDC calls -> GetDC is very slow! 23 EM_REPLACESEL: calls more than 10 times GetDC/ReleaseDC! 24 add HDC parameter 22 - too many redraws and recalculations! 25 23 */ 26 24 … … 154 152 * Helper functions only valid for one type of control 155 153 */ 156 static void EDIT_BuildLineDefs_ML(HWND hwnd, 154 static void EDIT_BuildLineDefs_ML(HWND hwnd,EDITSTATE *es); 157 155 static LPSTR EDIT_GetPasswordPointer_SL(HWND hwnd, EDITSTATE *es); 158 156 static void EDIT_MoveDown_ML(HWND hwnd, EDITSTATE *es, BOOL extend); … … 167 165 static INT EDIT_CharFromPos(HWND hwnd, EDITSTATE *es, INT x, INT y, LPBOOL after_wrap); 168 166 static void EDIT_ConfinePoint(HWND hwnd, EDITSTATE *es, LPINT x, LPINT y); 169 static void EDIT_GetLineRect(HWND hwnd, 167 static void EDIT_GetLineRect(HWND hwnd,HDC dc,EDITSTATE *es, INT line, INT scol, INT ecol, LPRECT rc); 170 168 static void EDIT_InvalidateText(HWND hwnd, EDITSTATE *es, INT start, INT end); 171 169 static void EDIT_LockBuffer(HWND hwnd, EDITSTATE *es); … … 208 206 static INT EDIT_EM_LineLength(HWND hwnd, EDITSTATE *es, INT index); 209 207 static BOOL EDIT_EM_LineScroll(HWND hwnd, EDITSTATE *es, INT dx, INT dy); 210 static LRESULT EDIT_EM_PosFromChar(HWND hwnd, EDITSTATE *es, INT index, BOOL after_wrap);208 static LRESULT EDIT_EM_PosFromChar(HWND hwnd,HDC dc, EDITSTATE *es, INT index, BOOL after_wrap); 211 209 static void EDIT_EM_ReplaceSel(HWND hwnd, EDITSTATE *es, BOOL can_undo, LPCSTR lpsz_replace); 212 210 static LRESULT EDIT_EM_Scroll(HWND hwnd, EDITSTATE *es, INT action); … … 565 563 case EM_POSFROMCHAR: 566 564 //DPRINTF_EDIT_MSG32("EM_POSFROMCHAR"); 567 result = EDIT_EM_PosFromChar(hwnd, es, (INT)wParam, FALSE);565 result = EDIT_EM_PosFromChar(hwnd,0, es, (INT)wParam, FALSE); 568 566 break; 569 567 … … 768 766 * 769 767 */ 770 static void EDIT_BuildLineDefs_ML(HWND hwnd, 771 { 772 HDC dc = 0;768 static void EDIT_BuildLineDefs_ML(HWND hwnd,EDITSTATE *es) 769 { 770 HDC hdc = 0; 773 771 HFONT old_font = 0; 774 772 LPSTR start, cp; … … 809 807 } 810 808 811 if (! dc)809 if (!hdc) 812 810 { 813 dc = GetDC(hwnd);811 hdc = GetDC(hwnd); 814 812 if (es->font) 815 old_font = SelectObject( dc, es->font);813 old_font = SelectObject(hdc, es->font); 816 814 } 817 815 818 current_def->width = (INT)LOWORD(GetTabbedTextExtentA( dc,816 current_def->width = (INT)LOWORD(GetTabbedTextExtentA(hdc, 819 817 start, current_def->net_length, 820 818 es->tabs_count, es->tabs)); … … 827 825 next = EDIT_CallWordBreakProc(hwnd, es, start - es->text, 828 826 prev + 1, current_def->net_length, WB_RIGHT); 829 current_def->width = (INT)LOWORD(GetTabbedTextExtentA( dc,827 current_def->width = (INT)LOWORD(GetTabbedTextExtentA(hdc, 830 828 start, next, es->tabs_count, es->tabs)); 831 829 } while (current_def->width <= fw); … … 835 833 prev = next; 836 834 next++; 837 current_def->width = (INT)LOWORD(GetTabbedTextExtentA( dc,835 current_def->width = (INT)LOWORD(GetTabbedTextExtentA(hdc, 838 836 start, next, es->tabs_count, es->tabs)); 839 837 } while (current_def->width <= fw); … … 843 841 current_def->net_length = prev; 844 842 current_def->ending = END_WRAP; 845 current_def->width = (INT)LOWORD(GetTabbedTextExtentA( dc, start,843 current_def->width = (INT)LOWORD(GetTabbedTextExtentA(hdc, start, 846 844 current_def->net_length, es->tabs_count, es->tabs)); 847 845 } … … 864 862 es->line_count++; 865 863 } while (current_def->ending != END_0); 866 if ( dc)864 if (hdc) 867 865 { 868 866 if (es->font) 869 SelectObject( dc, old_font);870 ReleaseDC(hwnd, dc);867 SelectObject(hdc, old_font); 868 ReleaseDC(hwnd, hdc); 871 869 } 872 870 EDIT_UpdateScrollBars(hwnd,es,TRUE,TRUE); … … 1058 1056 * 1059 1057 */ 1060 static void EDIT_GetLineRect(HWND hwnd, 1058 static void EDIT_GetLineRect(HWND hwnd,HDC dc,EDITSTATE *es, INT line, INT scol, INT ecol, LPRECT rc) 1061 1059 { 1062 1060 INT line_index = EDIT_EM_LineIndex(hwnd, es, line); … … 1068 1066 rc->bottom = rc->top + es->line_height; 1069 1067 1070 rc->left = (scol == 0) ? es->format_rect.left : SLOWORD(EDIT_EM_PosFromChar(hwnd, es, line_index + scol, TRUE));1071 rc->right = (ecol == -1) ? es->format_rect.right : SLOWORD(EDIT_EM_PosFromChar(hwnd, es, line_index + ecol, TRUE))+1;1068 rc->left = (scol == 0) ? es->format_rect.left : SLOWORD(EDIT_EM_PosFromChar(hwnd,dc, es, line_index + scol, TRUE)); 1069 rc->right = (ecol == -1) ? es->format_rect.right : SLOWORD(EDIT_EM_PosFromChar(hwnd,dc, es, line_index + ecol, TRUE))+1; 1072 1070 } 1073 1071 … … 1134 1132 RECT rc; 1135 1133 1136 EDIT_GetLineRect(hwnd, es, 0, start, end, &line_rect);1134 EDIT_GetLineRect(hwnd,0, es, 0, start, end, &line_rect); 1137 1135 1138 1136 if (IntersectRect(&rc, &line_rect, &es->format_rect)) … … 1183 1181 HideCaret(hwnd); 1184 1182 if (sl == el) { 1185 EDIT_GetLineRect(hwnd, es, sl, sc, ec, &rcLine);1183 EDIT_GetLineRect(hwnd,0, es, sl, sc, ec, &rcLine); 1186 1184 1187 1185 if (IntersectRect(&rcUpdate, &rcWnd, &rcLine)) 1188 1186 InvalidateRect(hwnd, &rcUpdate, TRUE); 1189 1187 } else { 1190 EDIT_GetLineRect(hwnd, es, sl, sc,1188 EDIT_GetLineRect(hwnd,0, es, sl, sc, 1191 1189 EDIT_EM_LineLength(hwnd, es, 1192 1190 EDIT_EM_LineIndex(hwnd, es, sl)), … … 1195 1193 InvalidateRect(hwnd, &rcUpdate, TRUE); 1196 1194 for (l = sl + 1 ; l < el ; l++) { 1197 EDIT_GetLineRect(hwnd, es, l, 0,1195 EDIT_GetLineRect(hwnd,0, es, l, 0, 1198 1196 EDIT_EM_LineLength(hwnd, es, 1199 1197 EDIT_EM_LineIndex(hwnd, es, l)), … … 1202 1200 InvalidateRect(hwnd, &rcUpdate, TRUE); 1203 1201 } 1204 EDIT_GetLineRect(hwnd, es, el, 0, ec, &rcLine);1202 EDIT_GetLineRect(hwnd,0, es, el, 0, ec, &rcLine); 1205 1203 if (IntersectRect(&rcUpdate, &rcWnd, &rcLine)) 1206 1204 InvalidateRect(hwnd, &rcUpdate, TRUE); … … 1353 1351 INT e = es->selection_end; 1354 1352 BOOL after_wrap = (es->flags & EF_AFTER_WRAP); 1355 LRESULT pos = EDIT_EM_PosFromChar(hwnd, es, e, after_wrap);1353 LRESULT pos = EDIT_EM_PosFromChar(hwnd,0, es, e, after_wrap); 1356 1354 INT x = SLOWORD(pos); 1357 1355 INT y = SHIWORD(pos); … … 1378 1376 if (es->style & ES_MULTILINE) 1379 1377 e = EDIT_CharFromPos(hwnd, es, 0x3fffffff, 1380 HIWORD(EDIT_EM_PosFromChar(hwnd, es, es->selection_end, es->flags & EF_AFTER_WRAP)), &after_wrap);1378 HIWORD(EDIT_EM_PosFromChar(hwnd,0, es, es->selection_end, es->flags & EF_AFTER_WRAP)), &after_wrap); 1381 1379 else 1382 1380 e = lstrlenA(es->text); … … 1423 1421 if (es->style & ES_MULTILINE) 1424 1422 e = EDIT_CharFromPos(hwnd, es, -es->x_offset, 1425 HIWORD(EDIT_EM_PosFromChar(hwnd, es, es->selection_end, es->flags & EF_AFTER_WRAP)), NULL);1423 HIWORD(EDIT_EM_PosFromChar(hwnd,0, es, es->selection_end, es->flags & EF_AFTER_WRAP)), NULL); 1426 1424 else 1427 1425 e = 0; … … 1445 1443 INT e = es->selection_end; 1446 1444 BOOL after_wrap = (es->flags & EF_AFTER_WRAP); 1447 LRESULT pos = EDIT_EM_PosFromChar(hwnd, es, e, after_wrap);1445 LRESULT pos = EDIT_EM_PosFromChar(hwnd,0, es, e, after_wrap); 1448 1446 INT x = SLOWORD(pos); 1449 1447 INT y = SHIWORD(pos); … … 1473 1471 INT e = es->selection_end; 1474 1472 BOOL after_wrap = (es->flags & EF_AFTER_WRAP); 1475 LRESULT pos = EDIT_EM_PosFromChar(hwnd, es, e, after_wrap);1473 LRESULT pos = EDIT_EM_PosFromChar(hwnd,0, es, e, after_wrap); 1476 1474 INT x = SLOWORD(pos); 1477 1475 INT y = SHIWORD(pos); … … 1501 1499 INT e = es->selection_end; 1502 1500 BOOL after_wrap = (es->flags & EF_AFTER_WRAP); 1503 LRESULT pos = EDIT_EM_PosFromChar(hwnd, es, e, after_wrap);1501 LRESULT pos = EDIT_EM_PosFromChar(hwnd,0, es, e, after_wrap); 1504 1502 INT x = SLOWORD(pos); 1505 1503 INT y = SHIWORD(pos); … … 1599 1597 //TRACE_(edit)("line=%d\n", line); 1600 1598 1601 pos = EDIT_EM_PosFromChar(hwnd, es, EDIT_EM_LineIndex(hwnd, es, line), FALSE);1599 pos = EDIT_EM_PosFromChar(hwnd,dc, es, EDIT_EM_LineIndex(hwnd, es, line), FALSE); 1602 1600 x = SLOWORD(pos); 1603 1601 y = SHIWORD(pos); … … 1718 1716 BOOL after_wrap) 1719 1717 { 1720 LRESULT res = EDIT_EM_PosFromChar(hwnd, es, pos, after_wrap);1718 LRESULT res = EDIT_EM_PosFromChar(hwnd,0, es, pos, after_wrap); 1721 1719 INT x = SLOWORD(res); 1722 1720 INT y = SHIWORD(res); … … 1764 1762 es->format_rect.bottom = es->format_rect.top + es->line_height; 1765 1763 if ((es->style & ES_MULTILINE) && !(es->style & ES_AUTOHSCROLL)) 1766 EDIT_BuildLineDefs_ML(hwnd, 1764 EDIT_BuildLineDefs_ML(hwnd,es); 1767 1765 EDIT_UpdateScrollBars(hwnd,es,TRUE,TRUE); 1768 1766 } … … 2226 2224 IntersectRect(&rc, &rc1, &es->format_rect); 2227 2225 2228 ScrollWindowEx(hwnd, -dx, dy, 2229 NULL, &rc, (HRGN)NULL, NULL, SW_INVALIDATE); 2226 ScrollWindowEx(hwnd,-dx,dy,NULL,&rc,(HRGN)NULL,NULL,SW_INVALIDATE); 2230 2227 es->y_offset = nyoff; 2231 2228 es->x_offset += dx; … … 2242 2239 * 2243 2240 */ 2244 static LRESULT EDIT_EM_PosFromChar(HWND hwnd, EDITSTATE *es, INT index, BOOL after_wrap)2241 static LRESULT EDIT_EM_PosFromChar(HWND hwnd,HDC dc, EDITSTATE *es, INT index, BOOL after_wrap) 2245 2242 { 2246 2243 INT len = lstrlenA(es->text); … … 2249 2246 INT x; 2250 2247 INT y = 0; 2251 HDC dc = 0;2248 BOOL createdDC = FALSE; 2252 2249 HFONT old_font = 0; 2253 2250 SIZE size; … … 2259 2256 if (es->font) 2260 2257 old_font = SelectObject(dc, es->font); 2258 createdDC = TRUE; 2261 2259 } 2262 2260 if (es->style & ES_MULTILINE) { … … 2296 2294 x += es->format_rect.left; 2297 2295 y += es->format_rect.top; 2298 if (es->font) 2299 SelectObject(dc, old_font); 2300 ReleaseDC(hwnd, dc); 2296 if (createdDC) 2297 { 2298 if (es->font) 2299 SelectObject(dc, old_font); 2300 ReleaseDC(hwnd, dc); 2301 } 2301 2302 return MAKELONG((INT16)x, (INT16)y); 2302 2303 } … … 2424 2425 /* FIXME: really inefficient */ 2425 2426 if (es->style & ES_MULTILINE) 2426 EDIT_BuildLineDefs_ML(hwnd, 2427 EDIT_BuildLineDefs_ML(hwnd,es); 2427 2428 2428 2429 EDIT_EM_SetSel(hwnd, es, s, s, FALSE); … … 2498 2499 l = EDIT_EM_LineFromChar(hwnd, es, es->selection_end); 2499 2500 li = EDIT_EM_LineIndex(hwnd, es, l); 2500 x = SLOWORD(EDIT_EM_PosFromChar(hwnd, es, es->selection_end, es->flags & EF_AFTER_WRAP));2501 x = SLOWORD(EDIT_EM_PosFromChar(hwnd,0, es, es->selection_end, es->flags & EF_AFTER_WRAP)); 2501 2502 vlc = (es->format_rect.bottom - es->format_rect.top) / es->line_height; 2502 2503 if (l >= es->y_offset + vlc) … … 2519 2520 return; 2520 2521 2521 x = SLOWORD(EDIT_EM_PosFromChar(hwnd, es, es->selection_end, FALSE));2522 x = SLOWORD(EDIT_EM_PosFromChar(hwnd,0, es, es->selection_end, FALSE)); 2522 2523 format_width = es->format_rect.right - es->format_rect.left; 2523 2524 if (x < es->format_rect.left) … … 2526 2527 do { 2527 2528 es->x_offset--; 2528 x = SLOWORD(EDIT_EM_PosFromChar(hwnd, es, es->selection_end, FALSE));2529 x = SLOWORD(EDIT_EM_PosFromChar(hwnd,0, es, es->selection_end, FALSE)); 2529 2530 } while ((x < goal) && es->x_offset); 2530 2531 /* FIXME: use ScrollWindow() somehow to improve performance */ … … 2538 2539 do { 2539 2540 es->x_offset++; 2540 x = SLOWORD(EDIT_EM_PosFromChar(hwnd, es, es->selection_end, FALSE));2541 x_last = SLOWORD(EDIT_EM_PosFromChar(hwnd, es, len, FALSE));2541 x = SLOWORD(EDIT_EM_PosFromChar(hwnd,0, es, es->selection_end, FALSE)); 2542 x_last = SLOWORD(EDIT_EM_PosFromChar(hwnd,0, es, len, FALSE)); 2542 2543 } while ((x > goal) && (x_last > es->format_rect.right)); 2543 2544 /* FIXME: use ScrollWindow() somehow to improve performance */ … … 2606 2607 es->flags &= ~EF_MODIFIED; 2607 2608 es->flags &= ~EF_UPDATE; 2608 EDIT_BuildLineDefs_ML(hwnd, 2609 EDIT_BuildLineDefs_ML(hwnd,es); 2609 2610 EDIT_Refresh(hwnd,es,FALSE); 2610 2611 EDIT_EM_ScrollCaret(hwnd, es); … … 2671 2672 EDIT_SetRectNP(hwnd, es, &r); 2672 2673 if (es->style & ES_MULTILINE) 2673 EDIT_BuildLineDefs_ML(hwnd, 2674 EDIT_BuildLineDefs_ML(hwnd,es); 2674 2675 2675 2676 EDIT_Refresh(hwnd,es,FALSE); … … 2840 2841 es->word_break_procA = wbp; 2841 2842 if ((es->style & ES_MULTILINE) && !(es->style & ES_AUTOHSCROLL)) { 2842 EDIT_BuildLineDefs_ML(hwnd, 2843 EDIT_BuildLineDefs_ML(hwnd,es); 2843 2844 EDIT_Refresh(hwnd,es,FALSE); 2844 2845 } … … 3739 3740 for (i = es->y_offset ; i <= MIN(es->y_offset + vlc, es->y_offset + es->line_count - 1) ; i++) 3740 3741 { 3741 EDIT_GetLineRect(hwnd, es, i, 0, -1, &rcLine);3742 EDIT_GetLineRect(hwnd,hdc, es, i, 0, -1, &rcLine); 3742 3743 if (IntersectRect(&rc, &rcRgn, &rcLine)) 3743 3744 EDIT_PaintLine(hwnd, es, hdc, i, rev); … … 3745 3746 } else 3746 3747 { 3747 EDIT_GetLineRect(hwnd, es, 0, 0, -1, &rcLine);3748 EDIT_GetLineRect(hwnd,hdc, es, 0, 0, -1, &rcLine); 3748 3749 if (IntersectRect(&rc, &rcRgn, &rcLine)) 3749 3750 EDIT_PaintLine(hwnd, es, hdc, 0, rev); … … 3890 3891 EDIT_SetRectNP(hwnd, es, &r); 3891 3892 if (es->style & ES_MULTILINE) 3892 EDIT_BuildLineDefs_ML(hwnd, 3893 EDIT_BuildLineDefs_ML(hwnd,es); 3893 3894 3894 3895 if (redraw) -
TabularUnified tags/trunk/src/user32/oslibgdi.cpp ¶
r12812 r12841 1 /* $Id: oslibgdi.cpp,v 1. 6 1999-12-28 17:04:23cbratschi Exp $ */1 /* $Id: oslibgdi.cpp,v 1.7 1999-12-29 22:54:00 cbratschi Exp $ */ 2 2 /* 3 3 * Window GDI wrapper functions for OS/2 … … 5 5 * 6 6 * Copyright 1999 Sander van Leeuwen (sandervl@xs4all.nl) 7 * 7 * Copyright 1999 Christoph Bratschi (cbratschi@datacomm.ch) 8 8 * 9 9 * Project Odin Software License can be found in LICENSE.TXT … … 21 21 #include "win32wbase.h" 22 22 23 //CB: new mapping infrastructure to avoid transformation bugs -> available soon24 25 23 /* 26 All mapScreen/Window can be used to transform from Win32 to OS/2 and vice versa27 24 First letter is lower case to avoid conflicts with Win32 API names 25 All transformations are for screen or client windows, for frame windows use OS/2 API's 28 26 29 27 Single y mapping: 30 28 mapScreenY() 31 mapClientY() 32 mapChildY() 29 mapY() 30 mapOS2ToWin32Y() 31 mapWin32ToOS2Y() 32 mapWin32Y() 33 33 34 34 Single point mapping: 35 35 mapScreenPoint() 36 mapClientPoint() 37 mapChildPoint() 36 mapPoint() 37 mapOS2ToWin32Point() 38 mapWin32ToOS2Point() 39 mapWin32Point() 38 40 39 41 Single rect mapping: 40 mapScreenRect() 41 mapClientRect() 42 mapOS2ToWin32ScreenRect() 43 mapWin32ToOS2ScreenRect() 44 mapOS2ToWin32Rect() 45 mapWin32ToOS2Rect() 46 mapWin32Rect() 42 47 43 48 Rect transformation: 44 copyOS2Rect() 45 copyWin32Rect() 49 copyOS2ToWin32Rect() 50 copyWin32ToOS2Rect() 51 52 Child origin: 53 mapOS2ToWin32ChildOrigin() 46 54 */ 47 55 56 //****************************************************************************** 57 // To translation between OS/2 <-> Win32 58 //****************************************************************************** 48 59 INT mapScreenY(INT screenPosY) 49 60 { 50 return WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN)-1-screenPosY; 51 } 52 //****************************************************************************** 61 return ScreenHeight-1-screenPosY; 62 } 63 //****************************************************************************** 64 // To translation between OS/2 <-> Win32 53 65 //****************************************************************************** 54 66 INT mapScreenY(INT screenH,INT screenPosY) … … 57 69 } 58 70 //****************************************************************************** 59 //****************************************************************************** 60 INT mapClientY(INT clientH,INT clientPosY) 61 { 62 return clientH-1-clientPosY; 63 } 64 //****************************************************************************** 65 //****************************************************************************** 66 INT mapClientY(HWND os2Client,INT clientPosY) 71 // To translation between OS/2 <-> Win32 72 //****************************************************************************** 73 INT mapY(HWND os2Client,INT clientPosY) 67 74 { 68 75 RECTL rect; … … 70 77 if (os2Client == OSLIB_HWND_DESKTOP) os2Client = HWND_DESKTOP; //client shouldn't be desktop 71 78 if (!WinQueryWindowRect(os2Client,&rect)) return 0; 79 72 80 return rect.yTop-1-clientPosY; 73 81 } 74 82 //****************************************************************************** 75 //****************************************************************************** 76 INT mapClientY(Win32BaseWindow *win32wnd,INT clientPosY) 77 { 78 return win32wnd->getWindowHeight()-1-clientPosY; 79 } 80 //****************************************************************************** 81 //****************************************************************************** 82 INT mapChildY(INT parentH,INT childY,INT childPosY) 83 { 84 return parentH-1-childY-childPosY; 85 } 86 //****************************************************************************** 87 //****************************************************************************** 88 INT mapChildY(HWND os2Parent,INT childY,INT childPosY) 89 { 90 RECTL rect; 91 92 if (os2Parent == OSLIB_HWND_DESKTOP) os2Parent = HWND_DESKTOP; 93 if (!WinQueryWindowRect(os2Parent,&rect)) return 0; 94 return rect.yTop-1-childY-childPosY; 95 } 96 //****************************************************************************** 97 //****************************************************************************** 98 INT mapChildY(HWND os2Parent,HWND os2Child,INT childPosY) 99 { 100 RECTL rect; 101 SWP swp; 102 103 if (os2Parent == OSLIB_HWND_DESKTOP) os2Parent = HWND_DESKTOP; 104 if (!WinQueryWindowRect(os2Parent,&rect)) return 0; 105 if (!WinQueryWindowPos(os2Child,&swp)) return 0; 106 return rect.yTop-1-swp.y-childPosY; 107 } 108 //****************************************************************************** 83 // To translation between OS/2 <-> Win32 84 //****************************************************************************** 85 INT mapY(Win32BaseWindow *win32wnd,INT clientPosY) 86 { 87 if (!win32wnd) return 0; 88 89 return win32wnd->getClientHeight()-1-clientPosY; 90 } 91 //****************************************************************************** 92 //****************************************************************************** 93 INT mapOS2ToWin32Y(HWND os2From,HWND os2To,INT fromPosY) 94 { 95 POINTL pt; 96 RECTL rect; 97 98 if (os2From == OSLIB_HWND_DESKTOP) os2From = HWND_DESKTOP; 99 if (os2To == OSLIB_HWND_DESKTOP) os2To = HWND_DESKTOP; 100 if (os2From != os2To) 101 { 102 pt.x = 0; 103 pt.y = fromPosY; 104 if (!WinMapWindowPoints(os2From,os2To,&pt,1)) return 0; 105 } else pt.y = fromPosY; 106 if (!WinQueryWindowRect(os2To,&rect)) return 0; 107 108 return rect.yTop-1-pt.y; 109 } 110 //****************************************************************************** 111 //****************************************************************************** 112 INT mapOS2ToWin32Y(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,INT fromPosY) 113 { 114 POINTL pt; 115 116 if (!wndFrom || !wndTo) return 0; 117 if (wndFrom != wndTo) 118 { 119 pt.x = 0; 120 pt.y = fromPosY; 121 if (!WinMapWindowPoints(wndFrom->getOS2WindowHandle(),wndTo->getOS2WindowHandle(),&pt,1)) return 0; 122 } else pt.y = fromPosY; 123 124 return wndTo->getClientHeight()-1-pt.y; 125 } 126 //****************************************************************************** 127 //****************************************************************************** 128 INT mapWin32Y(HWND os2From,HWND os2To,INT fromPosY) 129 { 130 POINTL pt; 131 RECTL rect; 132 133 if (os2From == OSLIB_HWND_DESKTOP) os2From = HWND_DESKTOP; 134 if (os2To == OSLIB_HWND_DESKTOP) os2To = HWND_DESKTOP; 135 if (os2From == os2To) return fromPosY; 136 if (!WinQueryWindowRect(os2From,&rect)) return 0; 137 pt.y = rect.yTop-1-fromPosY; 138 pt.x = 0; 139 if (!WinMapWindowPoints(os2From,os2To,&pt,1)) return 0; 140 if (!WinQueryWindowRect(os2To,&rect)) return 0; 141 142 return rect.yTop-1-pt.y; 143 } 144 //****************************************************************************** 145 //****************************************************************************** 146 INT mapWin32Y(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,INT fromPosY) 147 { 148 POINTL pt; 149 150 if (!wndFrom || !wndTo) return 0; 151 if (wndFrom == wndTo) return fromPosY; 152 pt.y = wndFrom->getClientHeight()-1-fromPosY; 153 pt.x = 0; 154 if (!WinMapWindowPoints(wndFrom->getOS2WindowHandle(),wndTo->getOS2WindowHandle(),&pt,1)) return 0; 155 156 return wndTo->getClientHeight()-1-pt.y; 157 } 158 //****************************************************************************** 159 // To translation between OS/2 <-> Win32 109 160 //****************************************************************************** 110 161 BOOL mapScreenPoint(OSLIBPOINT *screenPt) 111 162 { 112 163 if(!screenPt) return FALSE; 113 screenPt->y = WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN)-1-screenPt->y; 114 return TRUE; 115 } 116 //****************************************************************************** 117 //****************************************************************************** 118 INT mapScreenY(INT screenH,OSLIBPOINT *screenPt) 164 screenPt->y = ScreenHeight-1-screenPt->y; 165 166 return TRUE; 167 } 168 //****************************************************************************** 169 // To translation between OS/2 <-> Win32 170 //****************************************************************************** 171 BOOL mapScreenPoint(INT screenH,OSLIBPOINT *screenPt) 119 172 { 120 173 if (!screenPt) return FALSE; 121 174 screenPt->y = screenH-1-screenPt->y; 122 return TRUE; 123 } 124 125 //old mapping functions 126 127 //****************************************************************************** 128 //****************************************************************************** 129 inline ULONG MAPWIN32POINT(RECTLOS2 *parent, ULONG cy, ULONG y) 130 { 131 return (parent->yTop - parent->yBottom - cy - y); 132 } 133 //****************************************************************************** 134 //Map win32 y coordinate (in parent window coordinates) to OS/2 y coord. (in parent window coordinates) 135 //****************************************************************************** 136 ULONG MapOS2ToWin32Y(HWND hwndParent, ULONG cy, ULONG y) 137 { 138 RECTLOS2 rectParent = {0}; 139 140 if(hwndParent == OSLIB_HWND_DESKTOP) { 141 hwndParent = HWND_DESKTOP; 142 } 143 WinQueryWindowRect(hwndParent, (PRECTL)&rectParent); 144 return MAPWIN32POINT(&rectParent, cy, y); 145 } 146 //****************************************************************************** 147 //****************************************************************************** 148 BOOL MapOS2ToWin32Point(HWND hwndParent, HWND hwndChild, OSLIBPOINT *point) 149 { 150 RECTLOS2 rectParent = {0}; 151 152 if(hwndParent == OSLIB_HWND_DESKTOP) { 153 hwndParent = HWND_DESKTOP; 154 } 155 if(WinMapWindowPoints(hwndChild, hwndParent, (POINTL *)point, 1) != TRUE) { 156 dprintf(("MapOS2ToWin32Point:WinMapWindowPoint %x %x returned false", hwndParent, hwndChild)); 157 return FALSE; 158 } 159 WinQueryWindowRect(hwndParent, (PRECTL)&rectParent); 160 point->y = rectParent.yTop - point->y - 1; 161 return TRUE; 162 } 163 //****************************************************************************** 164 // MapOS2ToWin32Rect 165 // Map os/2 rectangle to screen coordinates and convert to win32 rect 166 // 167 // Parameters: 168 // hwndParent: Parent window handle 169 // hwndChild: Child window handle 170 // rectOS2: OS/2 child window RECTL 171 // rectWin32: Win32 Child window RECT (IN) 172 // 173 // Returns: 174 // TRUE: Success 175 // FALSE: Failures 176 //****************************************************************************** 177 BOOL MapOS2ToWin32Rectl(HWND hwndParent, HWND hwndChild, PRECTLOS2 rectOS2, PRECT rectWin32) 178 { 179 RECTLOS2 rectParent = {0}; 180 Win32BaseWindow *window; 181 LONG height; 182 183 if(hwndParent == OSLIB_HWND_DESKTOP) { 184 hwndParent = HWND_DESKTOP; 185 } 186 if(WinMapWindowPoints(hwndChild, hwndParent, (PPOINTL)rectOS2, 2) != TRUE) { 187 dprintf(("MapOS2ToWin32Rect:WinMapWindowPoint %x %x returned false", hwndParent, hwndChild)); 188 return FALSE; 189 } 190 191 if(hwndParent != HWND_DESKTOP) 192 { 193 window = Win32BaseWindow::GetWindowFromOS2FrameHandle(hwndParent); 194 if(window == NULL) 195 return FALSE; 196 height = window->getWindowHeight(); 197 } 198 else height = OSLibQueryScreenHeight(); 199 200 rectWin32->bottom = height - rectOS2->yBottom; 201 rectWin32->top = height - rectOS2->yTop; 202 rectWin32->left = rectOS2->xLeft; 203 rectWin32->right = rectOS2->xRight; 204 205 return TRUE; 206 } 207 //****************************************************************************** 208 // MapOS2ToWin32Rectl 209 // Convert OS/2 to Win32 RECTL structure 210 // 211 // Parameters: 212 // hwnd: OS/2 window handle 213 // rectOS2: OS/2 child window RECTL 214 // rectWin32: Win32 Child window RECT (IN) 215 // 216 // Returns: 217 // TRUE: Success 218 // FALSE: Failures 219 //****************************************************************************** 220 BOOL MapOS2ToWin32Rectl(HWND hwnd,PRECTLOS2 rectOS2, PRECT rectWin32) 221 { 222 RECTL rect; 223 224 if (!WinQueryWindowRect(hwnd,&rect)) return FALSE; 225 226 rectWin32->bottom = rect.yTop-rectOS2->yBottom; 227 rectWin32->top = rect.yTop-rectOS2->yTop; 228 rectWin32->left = rectOS2->xLeft; 229 rectWin32->right = rectOS2->xRight; 230 231 return TRUE; 232 } 233 //****************************************************************************** 234 // MapWin32ToOS2Rectl 235 // Convert Win32 to OS/2 RECTL structure 236 // 237 // Parameters: 238 // hwnd: OS/2 window handle 239 // rectWin32: Win32 Child window RECT (IN) 240 // rectOS2: OS/2 Child window RECTL (OUT) 241 // Returns: 242 // TRUE: Success 243 // FALSE: Failures 244 //****************************************************************************** 245 BOOL MapWin32ToOS2Rectl(HWND hwnd,PRECT rectWin32, PRECTLOS2 rectOS2) 246 { 247 RECTL rect; 248 249 if (!WinQueryWindowRect(hwnd,&rect)) return FALSE; 250 251 rectOS2->yBottom = rect.yTop-rectWin32->bottom; 252 rectOS2->yTop = rect.yTop-rectWin32->top; 253 rectOS2->xLeft = rectWin32->left; 254 rectOS2->xRight = rectWin32->right; 255 256 return TRUE; 257 } 258 //****************************************************************************** 259 //****************************************************************************** 260 BOOL MapOS2ToWin32WindowRect(PRECTLOS2 rectOS2,PRECT rectWin32) 261 { 262 rectWin32->bottom = rectOS2->yTop; 263 rectWin32->top = rectOS2->yBottom; 175 176 return TRUE; 177 } 178 //****************************************************************************** 179 // To translation between OS/2 <-> Win32 180 //****************************************************************************** 181 BOOL mapPoint(HWND os2Client,OSLIBPOINT *clientPt) 182 { 183 RECTL rect; 184 185 if (!clientPt) return FALSE; 186 if (os2Client == OSLIB_HWND_DESKTOP) os2Client = HWND_DESKTOP; //client shouldn't be desktop 187 if (!WinQueryWindowRect(os2Client,&rect)) return 0; 188 clientPt->y = rect.yTop-1-clientPt->y; 189 190 return TRUE; 191 } 192 //****************************************************************************** 193 // To translation between OS/2 <-> Win32 194 //****************************************************************************** 195 BOOL mapPoint(Win32BaseWindow *win32wnd,OSLIBPOINT *clientPt) 196 { 197 if (!win32wnd || !clientPt) return FALSE; 198 clientPt->y = win32wnd->getClientHeight()-1-clientPt->y; 199 200 return TRUE; 201 } 202 //****************************************************************************** 203 //****************************************************************************** 204 BOOL mapOS2ToWin32Point(HWND os2From,HWND os2To,OSLIBPOINT *fromPt) 205 { 206 RECTL rect; 207 208 if (os2From == OSLIB_HWND_DESKTOP) os2From = HWND_DESKTOP; 209 if (os2To == OSLIB_HWND_DESKTOP) os2To = HWND_DESKTOP; 210 if (os2From != os2To) 211 { 212 if (!WinMapWindowPoints(os2From,os2To,(PPOINTL)fromPt,1)) return FALSE; 213 } 214 if (!WinQueryWindowRect(os2To,&rect)) return FALSE; 215 fromPt->y = rect.yTop-1-fromPt->y; 216 217 return TRUE; 218 } 219 //****************************************************************************** 220 //****************************************************************************** 221 BOOL mapOS2ToWin32Point(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,OSLIBPOINT *fromPt) 222 { 223 if (!wndFrom || !wndTo) return 0; 224 if (wndFrom != wndTo) 225 { 226 if (!WinMapWindowPoints(wndFrom->getOS2WindowHandle(),wndTo->getOS2WindowHandle(),(PPOINTL)fromPt,1)) return FALSE; 227 } 228 fromPt->y = wndTo->getClientHeight()-1-fromPt->y; 229 230 return TRUE; 231 } 232 //****************************************************************************** 233 //****************************************************************************** 234 BOOL mapWin32Point(HWND os2From,HWND os2To,OSLIBPOINT *fromPt) 235 { 236 RECTL rect; 237 238 if (os2From == OSLIB_HWND_DESKTOP) os2From = HWND_DESKTOP; 239 if (os2To == OSLIB_HWND_DESKTOP) os2To = HWND_DESKTOP; 240 if (os2From == os2To) return TRUE; 241 if (!WinQueryWindowRect(os2From,&rect)) return 0; 242 fromPt->y = rect.yTop-1-fromPt->y; 243 if (!WinMapWindowPoints(os2From,os2To,(PPOINTL)fromPt,1)) return 0; 244 if (!WinQueryWindowRect(os2To,&rect)) return 0; 245 fromPt->y = rect.yTop-1-fromPt->y; 246 247 return TRUE; 248 } 249 //****************************************************************************** 250 //****************************************************************************** 251 BOOL mapWin32Point(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,OSLIBPOINT *fromPt) 252 { 253 if (!wndFrom || !wndTo) return FALSE; 254 if (wndFrom == wndTo) return TRUE; 255 fromPt->y = wndFrom->getClientHeight()-1-fromPt->y; 256 if (!WinMapWindowPoints(wndFrom->getOS2WindowHandle(),wndTo->getOS2WindowHandle(),(PPOINTL)fromPt,1)) return 0; 257 fromPt->y = wndTo->getClientHeight()-1-fromPt->y; 258 259 return TRUE; 260 } 261 //****************************************************************************** 262 //****************************************************************************** 263 BOOL mapOS2ToWin32ScreenRect(PRECTLOS2 rectOS2,PRECT rectWin32) 264 { 265 if (!rectOS2 || !rectWin32) return FALSE; 266 rectWin32->bottom = ScreenHeight-rectOS2->yBottom; 267 rectWin32->top = ScreenHeight-rectOS2->yTop; 264 268 rectWin32->left = rectOS2->xLeft; 265 269 rectWin32->right = rectOS2->xRight; … … 269 273 //****************************************************************************** 270 274 //****************************************************************************** 271 BOOL MapWin32ToOS2WindowRect(PRECT rectWin32,PRECTLOS2 rectOS2) 272 { 273 rectOS2->yBottom = rectWin32->top; 274 rectOS2->yTop = rectWin32->bottom; 275 BOOL mapWin32ToOS2ScreenRect(PRECT rectWin32,PRECTLOS2 rectOS2) 276 { 277 if (!rectOS2 || !rectWin32) return FALSE; 278 rectOS2->yBottom = ScreenHeight-rectWin32->bottom; 279 rectOS2->yTop = ScreenHeight-rectWin32->top; 275 280 rectOS2->xLeft = rectWin32->left; 276 281 rectOS2->xRight = rectWin32->right; 277 282 278 283 return TRUE; 284 } 285 //****************************************************************************** 286 //****************************************************************************** 287 BOOL mapOS2ToWin32Rect(HWND os2Client,PRECTLOS2 rectOS2,PRECT rectWin32) 288 { 289 RECTL rect; 290 291 if (!rectOS2 || !rectWin32) return FALSE; 292 if (os2Client == OSLIB_HWND_DESKTOP) os2Client = HWND_DESKTOP; //shouldn't be the case 293 if (!WinQueryWindowRect(os2Client,&rect)) return FALSE; 294 rectWin32->bottom = rect.yTop-rectOS2->yBottom; 295 rectWin32->top = rect.yTop-rectOS2->yTop; 296 rectWin32->left = rectOS2->xLeft; 297 rectWin32->right = rectOS2->xRight; 298 299 return TRUE; 300 } 301 //****************************************************************************** 302 //****************************************************************************** 303 BOOL mapOS2ToWin32Rect(Win32BaseWindow *win32wnd,PRECTLOS2 rectOS2,PRECT rectWin32) 304 { 305 INT windowH; 306 307 if (!win32wnd || !rectOS2 || !rectWin32) return FALSE; 308 windowH = win32wnd->getClientHeight(); 309 rectWin32->bottom = windowH-rectOS2->yBottom; 310 rectWin32->top = windowH-rectOS2->yTop; 311 rectWin32->left = rectOS2->xLeft; 312 rectWin32->right = rectOS2->xRight; 313 314 return TRUE; 315 } 316 //****************************************************************************** 317 //****************************************************************************** 318 BOOL mapOS2ToWin32Rect(HWND os2From,HWND os2To,PRECTLOS2 rectOS2,PRECT rectWin32) 319 { 320 RECTL rect,temp; 321 322 if (!rectOS2 || !rectWin32) return FALSE; 323 if (os2From == OSLIB_HWND_DESKTOP) os2From = HWND_DESKTOP; 324 if (os2To == OSLIB_HWND_DESKTOP) os2To = HWND_DESKTOP; 325 temp = *((PRECTL)rectOS2); 326 if (os2From != os2To) 327 { 328 if (!WinMapWindowPoints(os2From,os2To,(PPOINTL)&temp,2)) return FALSE; 329 } 330 if (!WinQueryWindowRect(os2To,&rect)) return FALSE; 331 rectWin32->bottom = rect.yTop-temp.yBottom; 332 rectWin32->top = rect.yTop-temp.yTop; 333 rectWin32->left = temp.xLeft; 334 rectWin32->right = temp.xRight; 335 336 return TRUE; 337 } 338 //****************************************************************************** 339 //****************************************************************************** 340 BOOL mapOS2ToWin32Rect(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,PRECTLOS2 rectOS2,PRECT rectWin32) 341 { 342 RECTL temp; 343 INT windowH; 344 345 if (!wndFrom || !wndTo || !rectOS2 || !rectWin32) return FALSE; 346 temp = *((PRECTL)rectOS2); 347 if (wndFrom != wndTo) 348 { 349 if (!WinMapWindowPoints(wndFrom->getOS2WindowHandle(),wndTo->getOS2WindowHandle(),(PPOINTL)&temp,2)) return FALSE; 350 } 351 windowH = wndTo->getClientHeight(); 352 rectWin32->bottom = windowH-temp.yBottom; 353 rectWin32->top = windowH-temp.yTop; 354 rectWin32->left = temp.xLeft; 355 rectWin32->right = temp.xRight; 356 357 return TRUE; 358 } 359 //****************************************************************************** 360 //****************************************************************************** 361 BOOL mapWin32ToOS2Rect(HWND os2Client,PRECT rectWin32,PRECTLOS2 rectOS2) 362 { 363 RECTL rect; 364 365 if (!rectOS2 || !rectWin32) return FALSE; 366 if (os2Client == OSLIB_HWND_DESKTOP) os2Client = HWND_DESKTOP; //shouldn't be the case 367 if (!WinQueryWindowRect(os2Client,&rect)) return FALSE; 368 rectOS2->yBottom = rect.yTop-rectWin32->bottom; 369 rectOS2->yTop = rect.yTop-rectWin32->top; 370 rectOS2->xLeft = rectWin32->left; 371 rectOS2->xRight = rectWin32->right; 372 373 return TRUE; 374 } 375 //****************************************************************************** 376 //****************************************************************************** 377 BOOL mapWin32ToOS2Rect(Win32BaseWindow *win32wnd,PRECT rectWin32,PRECTLOS2 rectOS2) 378 { 379 INT windowH; 380 381 if (!win32wnd || !rectOS2 || !rectWin32) return FALSE; 382 windowH = win32wnd->getClientHeight(); 383 rectOS2->yBottom = windowH-rectWin32->bottom; 384 rectOS2->yTop = windowH-rectWin32->top; 385 rectOS2->xLeft = rectWin32->left; 386 rectOS2->xRight = rectWin32->right; 387 388 return TRUE; 389 } 390 //****************************************************************************** 391 //****************************************************************************** 392 BOOL mapWin32ToOS2Rect(HWND os2From,HWND os2To,PRECT rectWin32,PRECTLOS2 rectOS2) 393 { 394 RECTL rect; 395 396 if (!rectOS2 || !rectWin32) return FALSE; 397 if (os2From == OSLIB_HWND_DESKTOP) os2From = HWND_DESKTOP; 398 if (os2To == OSLIB_HWND_DESKTOP) os2To = HWND_DESKTOP; 399 if (!WinQueryWindowRect(os2From,&rect)) return FALSE; 400 rectOS2->yBottom = rect.yTop-rectWin32->bottom; 401 rectOS2->yTop = rect.yTop-rectWin32->top; 402 rectOS2->xLeft = rectWin32->left; 403 rectOS2->xRight = rectWin32->right; 404 if (os2From != os2To) 405 { 406 if (!WinMapWindowPoints(os2From,os2To,(PPOINTL)rectOS2,2)) return FALSE; 407 } 408 409 return TRUE; 410 } 411 //****************************************************************************** 412 //****************************************************************************** 413 BOOL mapWin32ToOS2Rect(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,PRECT rectWin32,PRECTLOS2 rectOS2) 414 { 415 INT windowH; 416 417 if (!wndFrom || !wndTo || !rectOS2 || !rectWin32) return FALSE; 418 windowH = wndFrom->getClientHeight(); 419 rectOS2->yBottom = windowH-rectWin32->bottom; 420 rectOS2->yTop = windowH-rectWin32->top; 421 rectOS2->xLeft = rectWin32->left; 422 rectOS2->xRight = rectWin32->right; 423 if (wndFrom != wndTo) 424 { 425 if (!WinMapWindowPoints(wndFrom->getOS2WindowHandle(),wndTo->getOS2WindowHandle(),(PPOINTL)rectOS2,2)) return FALSE; 426 } 427 428 return TRUE; 429 } 430 //****************************************************************************** 431 //****************************************************************************** 432 BOOL copyOS2ToWin32Rect(PRECTLOS2 rectOS2,PRECT rectWin32) 433 { 434 rectWin32->bottom = rectOS2->yBottom; 435 rectWin32->top = rectOS2->yTop; 436 rectWin32->left = rectOS2->xLeft; 437 rectWin32->right = rectOS2->xRight; 438 439 return TRUE; 440 } 441 //****************************************************************************** 442 //****************************************************************************** 443 BOOL copyWin32ToOS2WindowRect(PRECT rectWin32,PRECTLOS2 rectOS2) 444 { 445 rectOS2->yBottom = rectWin32->bottom; 446 rectOS2->yTop = rectWin32->top; 447 rectOS2->xLeft = rectWin32->left; 448 rectOS2->xRight = rectWin32->right; 449 450 return TRUE; 451 } 452 //****************************************************************************** 453 //****************************************************************************** 454 INT mapOS2ToWin32ChildOrigin(INT parentH,INT parentPosY,INT childH) 455 { 456 return parentH-parentPosY-childH;//Does: parentH-1-parentPosY-(childH-1) 279 457 } 280 458 //****************************************************************************** … … 289 467 return 0; 290 468 } 291 MapOS2ToWin32Rectl(hwnd,(RECTLOS2 *)&rectl, rectWin32);469 mapOS2ToWin32Rect(hwnd,(RECTLOS2 *)&rectl, rectWin32); 292 470 return WinBeginPaint(hwnd, NULLHANDLE, &rectl); 293 471 } … … 320 498 321 499 if(pRect) { 322 MapWin32ToOS2Rectl(hwnd,pRect, &rectl);500 mapWin32ToOS2Rect(hwnd,pRect, &rectl); 323 501 return WinInvalidateRect(hwnd, (PRECTL)&rectl, fIncludeChildren); 324 502 } … … 335 513 rc = WinQueryUpdateRect(hwnd, (PRECTL)&rectl); 336 514 if(rc) { 337 MapOS2ToWin32Rectl(hwnd,&rectl, pRect);515 mapOS2ToWin32Rect(hwnd,&rectl, pRect); 338 516 } 339 517 else memset(pRect, 0, sizeof(RECT)); -
TabularUnified tags/trunk/src/user32/oslibgdi.h ¶
r12435 r12841 1 /* $Id: oslibgdi.h,v 1. 2 1999-11-26 17:06:07cbratschi Exp $ */1 /* $Id: oslibgdi.h,v 1.3 1999-12-29 22:54:00 cbratschi Exp $ */ 2 2 /* 3 3 * Window GDI wrapper functions for OS/2 … … 41 41 BOOL OSLibWinQueryUpdateRect(HWND hwnd, PRECT pRect); 42 42 43 //****************************************************************************** 44 //Map win32 y coordinate (in window coordinates) to OS/2 y coord. (in window coordinates) 45 //****************************************************************************** 46 inline ULONG MapOS2ToWin32Y(Win32BaseWindow *window, ULONG y) 47 { 48 return window->getWindowHeight() - y - 1; 49 } 43 //Mapping functions 50 44 51 ULONG MapOS2ToWin32Y(HWND hwndParent, ULONG cy, ULONG y); 52 BOOL MapOS2ToWin32Point(HWND hwndParent, HWND hwndChild, OSLIBPOINT *point); 53 54 //map os/2 rectangle to screen coordinates and convert to win32 rect 55 BOOL MapOS2ToWin32Rectl(HWND hwndParent, HWND hwndChild, PRECTLOS2 rectOS2, PRECT rectWin32); 56 57 BOOL MapOS2ToWin32Rectl(HWND hwnd,PRECTLOS2 rectOS2, PRECT rectWin32); 58 BOOL MapWin32ToOS2Rectl(HWND hwnd,PRECT rectWin32, PRECTLOS2 rectOS2); 59 60 BOOL MapOS2ToWin32WindowRect(PRECTLOS2 rectOS2,PRECT rectWin32); 61 BOOL MapWin32ToOS2WindowRect(PRECT rectWin32,PRECTLOS2 rectOS2); 45 INT mapScreenY(INT screenPosY); 46 INT mapScreenY(INT screenH,INT screenPosY); 47 INT mapY(HWND os2Client,INT clientPosY); 48 INT mapY(Win32BaseWindow *win32wnd,INT clientPosY); 49 INT mapOS2ToWin32Y(HWND os2From,HWND os2To,INT fromPosY); 50 INT mapOS2ToWin32Y(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,INT fromPosY); 51 INT mapWin32Y(HWND os2From,HWND os2To,INT fromPosY); 52 INT mapWin32Y(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,INT fromPosY); 53 BOOL mapScreenPoint(OSLIBPOINT *screenPt); 54 BOOL mapScreenPoint(INT screenH,OSLIBPOINT *screenPt); 55 BOOL mapPoint(HWND os2Client,OSLIBPOINT *clientPt); 56 BOOL mapPoint(Win32BaseWindow *win32wnd,OSLIBPOINT *clientPt); 57 BOOL mapOS2ToWin32Point(HWND os2From,HWND os2To,OSLIBPOINT *fromPt); 58 BOOL mapOS2ToWin32Point(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,OSLIBPOINT *fromPt); 59 BOOL mapWin32Point(HWND os2From,HWND os2To,OSLIBPOINT *fromPt); 60 BOOL mapWin32Point(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,OSLIBPOINT *fromPt); 61 BOOL mapOS2ToWin32ScreenRect(PRECTLOS2 rectOS2,PRECT rectWin32); 62 BOOL mapWin32ToOS2ScreenRect(PRECT rectWin32,PRECTLOS2 rectOS2); 63 BOOL mapOS2ToWin32Rect(HWND os2Client,PRECTLOS2 rectOS2,PRECT rectWin32); 64 BOOL mapOS2ToWin32Rect(Win32BaseWindow *win32wnd,PRECTLOS2 rectOS2,PRECT rectWin32); 65 BOOL mapOS2ToWin32Rect(HWND os2From,HWND os2To,PRECTLOS2 rectOS2,PRECT rectWin32); 66 BOOL mapOS2ToWin32Rect(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,PRECTLOS2 rectOS2,PRECT rectWin32); 67 BOOL mapWin32ToOS2Rect(HWND os2Client,PRECT rectWin32,PRECTLOS2 rectOS2); 68 BOOL mapWin32ToOS2Rect(Win32BaseWindow *win32wnd,PRECT rectWin32,PRECTLOS2 rectOS2); 69 BOOL mapWin32ToOS2Rect(HWND os2From,HWND os2To,PRECT rectWin32,PRECTLOS2 rectOS2); 70 BOOL mapWin32ToOS2Rect(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,PRECT rectWin32,PRECTLOS2 rectOS2); 71 BOOL copyOS2ToWin32Rect(PRECTLOS2 rectOS2,PRECT rectWin32); 72 BOOL copyWin32ToOS2WindowRect(PRECT rectWin32,PRECTLOS2 rectOS2); 73 INT mapOS2ToWin32ChildOrigin(INT parentH,INT parentPosY,INT childH); 62 74 63 75 #endif //__OSLIBGDI_H__ -
TabularUnified tags/trunk/src/user32/oslibmsg.cpp ¶
r12834 r12841 1 /* $Id: oslibmsg.cpp,v 1.1 8 1999-12-29 14:37:16 sandervlExp $ */1 /* $Id: oslibmsg.cpp,v 1.19 1999-12-29 22:54:00 cbratschi Exp $ */ 2 2 /* 3 3 * Window message translation functions for OS/2 … … 348 348 } 349 349 //convert to windows coordinates 350 return MAKEULONG(ptl.x, ScreenHeight - ptl.y - 1);350 return MAKEULONG(ptl.x,mapScreenY(ptl.y)); 351 351 } 352 352 //****************************************************************************** -
TabularUnified tags/trunk/src/user32/oslibmsgtranslate.cpp ¶
r12834 r12841 1 /* $Id: oslibmsgtranslate.cpp,v 1. 5 1999-12-29 14:37:16 sandervlExp $ */1 /* $Id: oslibmsgtranslate.cpp,v 1.6 1999-12-29 22:54:01 cbratschi Exp $ */ 2 2 /* 3 3 * Window message translation functions for OS/2 … … 119 119 winMsg->time = os2Msg->time; 120 120 winMsg->pt.x = os2Msg->ptl.x; 121 winMsg->pt.y = ScreenHeight - os2Msg->ptl.y - 1;121 winMsg->pt.y = mapScreenY(os2Msg->ptl.y); 122 122 if(win32wnd) //==0 for WM_CREATE 123 123 winMsg->hwnd = win32wnd->getWindowHandle(); … … 292 292 point.y = (*(POINTS *)&os2Msg->mp1).y; 293 293 ClientPoint.x = point.x; 294 ClientPoint.y = MapOS2ToWin32Y(os2Msg->hwnd, 1,point.y);294 ClientPoint.y = mapY(os2Msg->hwnd,point.y); 295 295 296 296 winMsg->message = WINWM_LBUTTONDOWN + (os2Msg->msg - WM_BUTTON1DOWN); … … 335 335 { 336 336 winMsg->wParam = (WPARAM)keystate; 337 winMsg->lParam = MAKELONG(SHORT1FROMMP(os2Msg->mp1), MapOS2ToWin32Y(win32wnd,SHORT2FROMMP(os2Msg->mp1)));337 winMsg->lParam = MAKELONG(SHORT1FROMMP(os2Msg->mp1),mapY(win32wnd,SHORT2FROMMP(os2Msg->mp1))); 338 338 } 339 339 //OS/2 Window coordinates -> Win32 Window coordinates … … 363 363 WinQueryPointerPos(HWND_DESKTOP, &pointl); 364 364 x = pointl.x; 365 y = ScreenHeight - y;365 y = mapScreenY(y); 366 366 } 367 367 switch(SHORT1FROMMP(os2Msg->mp1)) { … … 571 571 pt.y = (*(POINTS *)&os2Msg->mp1).y; 572 572 573 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP,os2Msg->hwnd,&pt);573 mapOS2ToWin32Point(os2Msg->hwnd,OSLIB_HWND_DESKTOP,&pt); 574 574 winMsg->message = WINWM_NCHITTEST; 575 575 winMsg->wParam = 0; … … 580 580 case WM_CONTEXTMENU: 581 581 { 582 POINTLpt;582 OSLIBPOINT pt; 583 583 584 584 pt.x = (*(POINTS *)&os2Msg->mp1).x; 585 585 pt.y = (*(POINTS *)&os2Msg->mp1).y; 586 WinMapWindowPoints(os2Msg->hwnd,HWND_DESKTOP,&pt,1); 587 pt.y = WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN) - pt.y -1; 586 mapOS2ToWin32Point(os2Msg->hwnd,OSLIB_HWND_DESKTOP,&pt); 588 587 winMsg->message = WINWM_CONTEXTMENU; 589 588 winMsg->wParam = (WPARAM)win32wnd->getWindowHandle(); -
TabularUnified tags/trunk/src/user32/oslibwin.cpp ¶
r12830 r12841 1 /* $Id: oslibwin.cpp,v 1.5 5 1999-12-29 12:39:44 sandervlExp $ */1 /* $Id: oslibwin.cpp,v 1.56 1999-12-29 22:54:01 cbratschi Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 325 325 //****************************************************************************** 326 326 //****************************************************************************** 327 BOOL OSLibWinSetWindowPos(HWND hwnd, HWND hwndInsertBehind, LONG x, LONG y, LONG cx,328 LONG cy, ULONG fl)329 {330 HWND hwndParent = hwndInsertBehind;331 BOOL rc;332 333 if(fl & SWP_MOVE) {334 switch(hwndParent)335 {336 case HWNDOS_TOP:337 case HWNDOS_BOTTOM:338 hwndParent = HWND_DESKTOP;339 break;340 }341 y = MapOS2ToWin32Y(hwndParent, cy, y);342 }343 rc = WinSetWindowPos(hwnd, hwndInsertBehind, x, y, cx, cy, fl);344 dprintf(("WinSetWindowPos %x %x %d %d %d %d %x returned %d (%x)", hwnd, hwndInsertBehind, x, y, cx, cy, fl, rc, WinGetLastError(GetThreadHAB())));345 return rc;346 }347 //******************************************************************************348 //******************************************************************************349 327 BOOL OSLibWinSetMultWindowPos(PSWP pswp, ULONG num) 350 328 { … … 383 361 if(rc) { 384 362 if(RelativeTo == RELATIVE_TO_SCREEN) { 385 MapOS2ToWin32Rectl(OSLIB_HWND_DESKTOP, hwnd, &rectl,pRect);363 mapOS2ToWin32Rect(hwnd,OSLIB_HWND_DESKTOP,&rectl,pRect); 386 364 } 387 else MapOS2ToWin32WindowRect(&rectl,pRect);365 else mapOS2ToWin32Rect(hwnd,&rectl,pRect); 388 366 } 389 367 else memset(pRect, 0, sizeof(RECT)); … … 556 534 WinMapWindowPoints(hParent, HWND_DESKTOP, &point, 1); 557 535 } 558 point.y = OSLibQueryScreenHeight() - point.y -swpFrame.cy;536 point.y = ScreenHeight-point.y-swpFrame.cy; 559 537 560 538 cy = swpFrame.cy; … … 579 557 580 558 pswpOld->x = pswp->x; 581 pswpOld->y = swpFrame.cy - pswp->y -pswp->cy;559 pswpOld->y = swpFrame.cy-pswp->y-pswp->cy; 582 560 pswpOld->cx = pswp->cx; 583 561 pswpOld->cy = pswp->cy; … … 643 621 WinMapWindowPoints(hParent, HWND_DESKTOP, &point, 1); 644 622 } 645 point.y = OSLibQueryScreenHeight() - point.y -cy;623 point.y = ScreenHeight-point.y-cy; 646 624 647 625 x = point.x; … … 664 642 665 643 pswpOld->x = swpClient.x; 666 pswpOld->y = pswp->cy - swpClient.y -swpClient.cy;644 pswpOld->y = pswp->cy-swpClient.y-swpClient.cy; 667 645 pswpOld->cx = swpClient.cx; 668 646 pswpOld->cy = swpClient.cy; … … 734 712 if (!((y == 0) && (pswpOld->cy == 0))) 735 713 { 736 y = parentHeight - y -pswpOld->cy;714 y = parentHeight-y-pswpOld->cy; 737 715 } 738 716 } … … 748 726 cy = pswpOld->cy; 749 727 } 750 y = parentHeight - y -cy;728 y = parentHeight-y-cy; 751 729 752 730 … … 819 797 parentHeight = OSLibGetWindowHeight(hParent); 820 798 821 point.y = ScreenHeight - point.y -cy;799 point.y = ScreenHeight-point.y-cy; 822 800 WinMapWindowPoints(HWND_DESKTOP, hParent, &point, 1); 823 point.y = parentHeight - point.y -cy;801 point.y = parentHeight-point.y-cy; 824 802 } 825 803 else parentHeight = ScreenHeight; … … 838 816 cy = pswpOld->cy; 839 817 } 840 y = parentHeight - y -cy;818 y = parentHeight-y-cy; 841 819 842 820 -
TabularUnified tags/trunk/src/user32/oslibwin.h ¶
r12830 r12841 1 /* $Id: oslibwin.h,v 1.3 0 1999-12-29 12:39:44 sandervlExp $ */1 /* $Id: oslibwin.h,v 1.31 1999-12-29 22:54:01 cbratschi Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 201 201 #define HWNDOS_BOTTOM (HWND)4 202 202 203 BOOL OSLibWinSetWindowPos(HWND hwnd, HWND hwndInsertBehind, LONG x, LONG y, LONG cx, LONG cy, ULONG fl);204 203 BOOL OSLibWinSetMultWindowPos(struct _SWP *pswp, ULONG num); 205 204 BOOL OSLibWinShowWindow(HWND hwnd, ULONG fl); -
TabularUnified tags/trunk/src/user32/pmframe.cpp ¶
r12788 r12841 1 /* $Id: pmframe.cpp,v 1.3 0 1999-12-26 17:30:16cbratschi Exp $ */1 /* $Id: pmframe.cpp,v 1.31 1999-12-29 22:54:01 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Frame Managment Code for OS/2 … … 103 103 BOOL CanDrawSizeBox(Win32BaseWindow *win32wnd) 104 104 { 105 return ( win32wnd->getStyle() & WS_SIZEBOX_W && WinQueryWindowULong(win32wnd->getOS2FrameWindowHandle(),QWL_STYLE) & FS_SIZEBORDER105 return ((win32wnd->getStyle() & WS_SIZEBOX_W) && (WinQueryWindowULong(win32wnd->getOS2FrameWindowHandle(),QWL_STYLE) & FS_SIZEBORDER) 106 106 && win32wnd->getVertScrollHandle() && WinQueryWindow(win32wnd->getVertScrollHandle(),QW_PARENT) == win32wnd->getOS2FrameWindowHandle() 107 107 && win32wnd->getHorzScrollHandle() && WinQueryWindow(win32wnd->getHorzScrollHandle(),QW_PARENT) == win32wnd->getOS2FrameWindowHandle()); … … 347 347 DWORD dwStyle = win32wnd->getWindowClass()->getClassLongA(GCL_STYLE_W); 348 348 349 if ( dwStyle & CS_HREDRAW_W && newRect->xRight-newRect->xLeft != oldRect->xRight-oldRect->xLeft)349 if ((dwStyle & CS_HREDRAW_W) && (newRect->xRight-newRect->xLeft != oldRect->xRight-oldRect->xLeft)) 350 350 res |= CVR_REDRAW; 351 else if ( dwStyle & CS_VREDRAW_W && newRect->yTop-newRect->yBottom != oldRect->yTop-oldRect->yBottom)351 else if ((dwStyle & CS_VREDRAW_W) && (newRect->yTop-newRect->yBottom != oldRect->yTop-oldRect->yBottom)) 352 352 res |= CVR_REDRAW; 353 353 } else res |= CVR_REDRAW; … … 514 514 FrameGetBorderSize(win32wnd,&point); 515 515 WinSendMsg(win32wnd->getOS2FrameWindowHandle(),WM_SETBORDERSIZE,(MPARAM)win32wnd->getBorderWidth(),(MPARAM)win32wnd->getBorderHeight()); 516 if ( point.x != win32wnd->getBorderWidth() || point.y != win32wnd->getBorderHeight())516 if ((point.x != win32wnd->getBorderWidth()) || (point.y != win32wnd->getBorderHeight())) 517 517 { 518 518 INT xDiff = win32wnd->getBorderWidth()-point.x; … … 582 582 HWND hwndCurPar = WinQueryWindow(win32wnd->getHorzScrollHandle(),QW_PARENT); 583 583 584 if ((fShow && hwndCurPar == hwndObj) || (!fShow && hwndCurPar != hwndObj))584 if ((fShow && (hwndCurPar == hwndObj)) || (!fShow && (hwndCurPar != hwndObj))) 585 585 { 586 586 WinSetParent(win32wnd->getHorzScrollHandle(),fShow ? win32wnd->getOS2FrameWindowHandle():HWND_OBJECT,FALSE); … … 593 593 HWND hwndCurPar = WinQueryWindow(win32wnd->getVertScrollHandle(),QW_PARENT); 594 594 595 if ((fShow && hwndCurPar == hwndObj) || (!fShow && hwndCurPar != hwndObj))595 if ((fShow && (hwndCurPar == hwndObj)) || (!fShow && (hwndCurPar != hwndObj))) 596 596 { 597 597 WinSetParent(win32wnd->getVertScrollHandle(),fShow ? win32wnd->getOS2FrameWindowHandle():HWND_OBJECT,FALSE); … … 619 619 if (win32wnd->getOS2WindowHandle() == WinQueryCapture(HWND_DESKTOP)) return HTCLIENT_W; 620 620 point.x = x; 621 point.y = WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN)-y-1;621 point.y = mapScreenY(y); 622 622 WinMapWindowPoints(HWND_DESKTOP,hwnd,&point,1); 623 623 child = WinWindowFromPoint(hwnd,&point,FALSE); -
TabularUnified tags/trunk/src/user32/pmwindow.cpp ¶
r12834 r12841 1 /* $Id: pmwindow.cpp,v 1.7 3 1999-12-29 14:37:16 sandervlExp $ */1 /* $Id: pmwindow.cpp,v 1.74 1999-12-29 22:54:02 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Window Managment Code for OS/2 … … 65 65 //CB: only fail on real error 66 66 error = WinGetLastError(hab) & 0xFFFF; //error code 67 if (!hab || error != PMERR_MSG_QUEUE_ALREADY_EXISTS)67 if (!hab || (error != PMERR_MSG_QUEUE_ALREADY_EXISTS)) 68 68 { 69 69 dprintf(("WinInitialize or WinCreateMsgQueue failed %x %x", hab, hmq)); -
TabularUnified tags/trunk/src/user32/win32wbase.cpp ¶
r12834 r12841 1 /* $Id: win32wbase.cpp,v 1.12 4 1999-12-29 14:37:17 sandervlExp $ */1 /* $Id: win32wbase.cpp,v 1.125 1999-12-29 22:54:02 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 118 118 } 119 119 120 OSLibWinQueryWindowRect(OS2Hwnd,&rectWindow); 121 rectClient = rectWindow; 122 rectClient.bottom -= rectClient.top; 123 rectClient.top = 0; 124 rectClient.right -= rectClient.left; 125 rectClient.left = 0; 120 OSLibWinQueryWindowRect(OS2Hwnd,&rectClient,RELATIVE_TO_WINDOW); 121 OSLibWinQueryWindowRect(OS2Hwnd,&rectWindow,RELATIVE_TO_SCREEN); 126 122 127 123 setOldWndProc(SubclassWithDefHandler(OS2Hwnd)); -
TabularUnified tags/trunk/src/user32/win32wbase.h ¶
r12834 r12841 1 /* $Id: win32wbase.h,v 1. 59 1999-12-29 14:37:18 sandervlExp $ */1 /* $Id: win32wbase.h,v 1.60 1999-12-29 22:54:03 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 80 80 ULONG MsgPaint(ULONG tmp1, BOOL select = TRUE); 81 81 ULONG MsgEraseBackGround(HDC hdc); 82 83 82 ULONG MsgInitMenu(MSG *msg); 83 ULONG MsgHitTest(MSG *msg); 84 84 ULONG MsgNCPaint(); 85 86 85 ULONG DispatchMsgA(MSG *msg); 86 ULONG DispatchMsgW(MSG *msg); 87 87 88 88 ULONG MsgSetText(LPSTR lpsz, LONG cch); … … 124 124 DWORD getWindowId() { return windowId; }; 125 125 void setWindowId(DWORD id); 126 ULONG getWindowHeight() { return rectClient.bottom - rectClient.top; }; 127 ULONG getWindowWidth() { return rectClient.right - rectClient.left; }; 126 ULONG getWindowHeight() { return rectWindow.bottom - rectWindow.top; }; 127 ULONG getWindowWidth() { return rectWindow.right - rectWindow.left; }; 128 ULONG getClientHeight() { return rectClient.bottom - rectClient.top; }; 129 ULONG getClientWidth() { return rectClient.right - rectClient.left; }; 128 130 BOOL isChild(); 129 131 PRECT getClientRect() { return &rectClient; }; -
TabularUnified tags/trunk/src/user32/win32wmdiclient.cpp ¶
r12834 r12841 1 /* $Id: win32wmdiclient.cpp,v 1. 19 1999-12-29 14:37:18 sandervlExp $ */1 /* $Id: win32wmdiclient.cpp,v 1.20 1999-12-29 22:54:03 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 MDI Client Window Class for OS/2 … … 1034 1034 GetScrollRange(hWnd,SB_HORZ,&minPos,&maxPos); 1035 1035 curPos = GetScrollPos(hWnd,SB_HORZ); 1036 length = win32wnd->get WindowWidth()/2;1036 length = win32wnd->getClientWidth()/2; 1037 1037 shift = GetSystemMetrics(SM_CYHSCROLL); 1038 1038 } else if (uMsg == WM_VSCROLL) … … 1040 1040 GetScrollRange(hWnd,SB_VERT,&minPos,&maxPos); 1041 1041 curPos = GetScrollPos(hWnd,SB_VERT); 1042 length = win32wnd->get WindowHeight()/2;1042 length = win32wnd->getClientHeight()/2; 1043 1043 shift = GetSystemMetrics(SM_CXVSCROLL); 1044 1044 } else return; -
TabularUnified tags/trunk/src/user32/window.cpp ¶
r12795 r12841 1 /* $Id: window.cpp,v 1.4 5 1999-12-27 17:08:09cbratschi Exp $ */1 /* $Id: window.cpp,v 1.46 1999-12-29 22:54:04 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 window apis for OS/2 … … 847 847 dprintf(("USER32: MapWindowPoints %x to %x (%d,%d) (%d)", hwndFrom, hwndTo, lpPoints->x, lpPoints->y, cPoints)); 848 848 point.x = lpPoints->x; 849 point.y = wndfrom->getWindowHeight()-1-lpPoints->y; 850 851 OSLibWinMapWindowPoints(wndfrom->getOS2WindowHandle(), wndto->getOS2WindowHandle(), &point, 1); 852 point.y = wndto->getWindowHeight()-1-point.y; 849 point.y = lpPoints->y; 850 if (!mapWin32Point(wndfrom,wndto,&point)) 851 { 852 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 853 return 0; 854 } 853 855 854 856 short int xinc = point.x - lpPoints->x; … … 875 877 wnd = Win32BaseWindow::GetWindowFromHandle (hwnd); 876 878 if (!wnd) return (TRUE); 877 878 rcl = wnd->getClientRect(); 879 pt->y = ScreenHeight - pt->y; 880 OSLibWinMapWindowPoints (OSLIB_HWND_DESKTOP, wnd->getOS2WindowHandle(), (OSLIBPOINT *)pt, 1); 881 pt->y = (rcl->bottom - rcl->top) - pt->y; 882 dprintf(("ScreenToClient %x returned (%d,%d)\n", hwnd, pt->x, pt->y)); 883 return (TRUE); 879 return mapWin32Point(OSLIB_HWND_DESKTOP,wnd->getOS2WindowHandle(),(OSLIBPOINT*)pt); 884 880 } 885 881 //****************************************************************************** … … 1004 1000 return (FALSE); 1005 1001 } 1006 1007 rcl = wnd->getClientRect(); 1008 pt->y = (rcl->bottom - rcl->top) - pt->y; 1009 OSLibWinMapWindowPoints (wnd->getOS2WindowHandle(), OSLIB_HWND_DESKTOP, (OSLIBPOINT *)pt, 1); 1010 pt->y = ScreenHeight - pt->y; 1011 dprintf(("ClientToScreen returned (%d,%d)\n", pt->x, pt->y)); 1012 return (TRUE); 1002 return mapWin32Point(wnd->getOS2WindowHandle(),OSLIB_HWND_DESKTOP,(OSLIBPOINT*)pt); 1013 1003 } 1014 1004 //****************************************************************************** … … 1263 1253 1264 1254 wPoint.x = point.x; 1265 wPoint.y = windowDesktop->getWindowHeight() - point.y;1255 wPoint.y = mapScreenY(point.y); 1266 1256 1267 1257 hwndOS2 = OSLibWinWindowFromPoint(OSLIB_HWND_DESKTOP, (PVOID)&wPoint);
Note:
See TracChangeset
for help on using the changeset viewer.