- Timestamp:
- Nov 9, 1999, 6:07:23 PM (26 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/loadres.cpp
r1612 r1667 1 /* $Id: loadres.cpp,v 1.1 4 1999-11-05 12:54:10 sandervlExp $ */1 /* $Id: loadres.cpp,v 1.15 1999-11-09 17:07:21 cbratschi Exp $ */ 2 2 3 3 /* … … 23 23 #include <win\virtual.h> 24 24 #include "dib.h" 25 #include "initterm.h" 25 26 26 27 //****************************************************************************** … … 33 34 34 35 if (buffer && buflen) 35 36 buffer2 = (LPWSTR)HeapAlloc( GetProcessHeap(), 0, buflen * 2 ); 36 37 37 38 retval = LoadStringW(instance,resource_id,buffer2,buflen); … … 39 40 if (buffer2) 40 41 { 41 42 43 44 45 46 47 42 if (retval) { 43 lstrcpynWtoA( buffer, buffer2, buflen ); 44 retval = lstrlenA( buffer ); 45 } 46 else 47 *buffer = 0; 48 HeapFree( GetProcessHeap(), 0, buffer2 ); 48 49 } 49 50 return retval; … … 58 59 int i = 0; 59 60 60 /* Use bits 4 - 19 (incremented by 1) as resourceid, mask out 61 /* Use bits 4 - 19 (incremented by 1) as resourceid, mask out 61 62 * 20 - 31. */ 62 63 winres = (Win32Resource *)FindResourceW(hinst, (LPWSTR)(((wID>>4)&0xffff)+1), RT_STRINGW); … … 69 70 p = (LPWSTR)winres->lockResource(); 70 71 if(p) { 71 72 73 74 75 76 77 78 79 80 }81 82 83 84 85 86 72 string_num = wID & 0x000f; 73 for (i = 0; i < string_num; i++) 74 p += *p + 1; 75 76 if (lpBuffer == NULL) return *p; 77 i = min(cchBuffer - 1, *p); 78 if (i > 0) { 79 memcpy(lpBuffer, p + 1, i * sizeof (WCHAR)); 80 lpBuffer[i] = (WCHAR) 0; 81 } 82 else { 83 if (cchBuffer > 1) { 84 lpBuffer[0] = (WCHAR) 0; 85 return 0; 86 } 87 } 87 88 } 88 89 delete winres; … … 98 99 HICON hIcon; 99 100 100 hIcon = OSLibWinQuerySysIcon((ULONG)lpszIcon); 101 if(hIcon == 0) {//not a system icon 101 if (!hinst) 102 { 103 winres = (Win32Resource*)FindResourceA(hInstanceUser32,lpszIcon,RT_ICONA); 104 if (!winres) winres = (Win32Resource*)FindResourceA(hInstanceUser32,lpszIcon,RT_GROUP_ICONA); 105 if (winres) 106 { 107 hIcon = OSLibWinCreateIcon(winres->lockOS2Resource()); 108 delete winres; 109 } else hIcon = OSLibWinQuerySysIcon((ULONG)lpszIcon,GetSystemMetrics(SM_CXICON),GetSystemMetrics(SM_CYICON)); 110 } else 111 { //not a system icon 102 112 winres = (Win32Resource *)FindResourceA(hinst, lpszIcon, RT_ICONA); 103 113 if(winres == 0) { … … 107 117 hIcon = OSLibWinCreateIcon(winres->lockOS2Resource()); 108 118 delete winres; 109 } 119 } else hIcon = 0; 110 120 } 111 121 dprintf(("LoadIconA (%X) returned %x\n", hinst, hIcon)); … … 120 130 HICON hIcon; 121 131 122 hIcon = OSLibWinQuerySysIcon((ULONG)lpszIcon); 123 if(hIcon == 0) {//not a system icon 132 if (!hinst) 133 { 134 winres = (Win32Resource*)FindResourceW(hInstanceUser32,lpszIcon,RT_ICONW); 135 if (!winres) winres = (Win32Resource*)FindResourceW(hInstanceUser32,lpszIcon,RT_GROUP_ICONW); 136 if (winres) 137 { 138 hIcon = OSLibWinCreateIcon(winres->lockOS2Resource()); 139 delete winres; 140 } else hIcon = OSLibWinQuerySysIcon((ULONG)lpszIcon,GetSystemMetrics(SM_CXICON),GetSystemMetrics(SM_CYICON)); 141 } else 142 {//not a system icon 124 143 winres = (Win32Resource *)FindResourceW(hinst, lpszIcon, RT_ICONW); 125 144 if(winres == 0) { … … 129 148 hIcon = OSLibWinCreateIcon(winres->lockOS2Resource()); 130 149 delete winres; 131 } 150 } else hIcon = 0; 132 151 } 133 152 dprintf(("LoadIconW (%X) returned %x\n", hinst, hIcon)); … … 142 161 HCURSOR hCursor; 143 162 144 hCursor = OSLibWinQuerySysPointer((ULONG)lpszCursor); 145 if(hCursor == 0) {//not a system pointer 163 if (!hinst) 164 { 165 winres = (Win32Resource*)FindResourceA(hInstanceUser32,lpszCursor,RT_CURSORA); 166 if (!winres) winres = (Win32Resource*)FindResourceA(hInstanceUser32,lpszCursor,RT_GROUP_CURSORA); 167 if (winres) 168 { 169 hCursor = OSLibWinCreatePointer(winres->lockOS2Resource()); 170 delete winres; 171 } else hCursor = OSLibWinQuerySysPointer((ULONG)lpszCursor,GetSystemMetrics(SM_CXCURSOR),GetSystemMetrics(SM_CYCURSOR)); 172 } else 173 {//not a system pointer 146 174 winres = (Win32Resource *)FindResourceA(hinst, lpszCursor, RT_CURSORA); 147 175 if(winres == 0) { … … 151 179 hCursor = OSLibWinCreatePointer(winres->lockOS2Resource()); 152 180 delete winres; 153 } 181 } else hCursor = 0; 154 182 } 155 183 if(HIWORD(lpszCursor)) { … … 167 195 HCURSOR hCursor; 168 196 169 hCursor = OSLibWinQuerySysPointer((ULONG)lpszCursor); 170 if(hCursor == 0) {//not a system pointer 197 if (!hinst) 198 { 199 winres = (Win32Resource*)FindResourceW(hInstanceUser32,lpszCursor,RT_CURSORW); 200 if (!winres) winres = (Win32Resource*)FindResourceW(hInstanceUser32,lpszCursor,RT_GROUP_CURSORW); 201 if (winres) 202 { 203 hCursor = OSLibWinCreatePointer(winres->lockOS2Resource()); 204 delete winres; 205 } else hCursor = OSLibWinQuerySysPointer((ULONG)lpszCursor,GetSystemMetrics(SM_CXCURSOR),GetSystemMetrics(SM_CYCURSOR)); 206 } else 207 {//not a system pointer 171 208 winres = (Win32Resource *)FindResourceW(hinst, lpszCursor, RT_CURSORW); 172 209 if(winres == 0) { … … 176 213 hCursor = OSLibWinCreatePointer(winres->lockOS2Resource()); 177 214 delete winres; 178 } 215 } else hCursor = 0; 179 216 } 180 217 dprintf(("LoadCursorW (%X) returned %x\n", hinst, hCursor)); … … 341 378 HBITMAP hBitmap = 0; 342 379 343 if(IsSystemBitmap((ULONG *)&lpszBitmap)) { 344 hBitmap = O32_LoadBitmap(hinst, lpszBitmap); 380 if (!hinst) 381 { 382 if(IsSystemBitmap((ULONG *)&lpszBitmap)) 383 { 384 hBitmap = O32_LoadBitmap(hInstanceUser32,lpszBitmap); 385 if (!hBitmap) hBitmap = O32_LoadBitmap(hinst,lpszBitmap); 386 } else hBitmap = 0; 387 } else hBitmap = LoadBitmapA(hinst, lpszBitmap, 0, 0, 0); 388 dprintf(("LoadBitmapA returned %08xh\n", hBitmap)); 389 390 return(hBitmap); 391 } 392 //****************************************************************************** 393 //TODO: No support for RT_NEWBITMAP 394 //****************************************************************************** 395 HBITMAP WIN32API LoadBitmapW(HINSTANCE hinst, LPCWSTR lpszBitmap) 396 { 397 HBITMAP hBitmap = 0; 398 399 if (!hinst) 400 { 401 if(IsSystemBitmap((ULONG *)&lpszBitmap)) 402 { 403 hBitmap = O32_LoadBitmap(hInstanceUser32,(LPCSTR)lpszBitmap); 404 if (!hBitmap) hBitmap = O32_LoadBitmap(hinst,(LPCSTR)lpszBitmap); 405 } else hBitmap = 0; 406 } else 407 { 408 if(HIWORD(lpszBitmap) != 0) 409 lpszBitmap = (LPWSTR)UnicodeToAsciiString((LPWSTR)lpszBitmap); 410 411 hBitmap = LoadBitmapA(hinst, (LPSTR)lpszBitmap, 0, 0, 0); 412 413 if(HIWORD(lpszBitmap) != 0) 414 FreeAsciiString((LPSTR)lpszBitmap); 345 415 } 346 if(!hBitmap) {347 hBitmap = LoadBitmapA(hinst, lpszBitmap, 0, 0, 0);348 }349 dprintf(("LoadBitmapA returned %08xh\n", hBitmap));350 351 return(hBitmap);352 }353 //******************************************************************************354 //TODO: No support for RT_NEWBITMAP355 //******************************************************************************356 HBITMAP WIN32API LoadBitmapW(HINSTANCE hinst, LPCWSTR lpszBitmap)357 {358 HBITMAP hBitmap = 0;359 360 if(IsSystemBitmap((ULONG *)&lpszBitmap)) {361 hBitmap = O32_LoadBitmap(hinst, (LPCSTR)lpszBitmap);362 }363 if(!hBitmap) {364 if(HIWORD(lpszBitmap) != 0) {365 lpszBitmap = (LPWSTR)UnicodeToAsciiString((LPWSTR)lpszBitmap);366 }367 hBitmap = LoadBitmapA(hinst, (LPSTR)lpszBitmap, 0, 0, 0);368 }369 370 if(HIWORD(lpszBitmap) != 0)371 FreeAsciiString((LPSTR)lpszBitmap);372 416 373 417 dprintf(("LoadBitmapW returned %08xh\n", hBitmap)); … … 385 429 386 430 if(HIWORD(lpszName)) { 387 431 dprintf(("LoadImageA NOT COMPLETE %x %s %d (%d,%d)\n", hinst, lpszName, uType, cxDesired, cyDesired)); 388 432 } 389 else 433 else dprintf(("LoadImageA NOT COMPLETE %x %x %d (%d,%d)\n", hinst, lpszName, uType, cxDesired, cyDesired)); 390 434 391 435 if (fuLoad & LR_DEFAULTSIZE) { … … 482 526 switch (type) 483 527 { 484 // 485 // 486 487 488 489 490 491 528 // case IMAGE_BITMAP: 529 // return BITMAP_CopyBitmap(hnd); 530 case IMAGE_ICON: 531 return CopyIcon(hnd); 532 case IMAGE_CURSOR: 533 return CopyCursor(hnd); 534 default: 535 dprintf(("CopyImage: Unsupported type")); 492 536 } 493 537 return 0; -
trunk/src/user32/oslibres.cpp
r1474 r1667 1 /* $Id: oslibres.cpp,v 1. 5 1999-10-27 10:35:05 sandervlExp $ */1 /* $Id: oslibres.cpp,v 1.6 1999-11-09 17:07:21 cbratschi Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 155 155 bfh = (BITMAPFILEHEADER2 *)cursorbitmap; 156 156 bfhColor = (BITMAPFILEHEADER2 *)((char *)bfh + sizeof(RGB2)*2 + sizeof(BITMAPFILEHEADER2)); 157 157 bafh = (BITMAPARRAYFILEHEADER2 *)bfh; //for calculation bitmap offset 158 158 } 159 159 //skip xor/and mask … … 168 168 } 169 169 170 if((ULONG)((char *)bafh+bfh->offBits) != (ULONG)bfhColor) 170 if((ULONG)((char *)bafh+bfh->offBits) != (ULONG)bfhColor) 171 171 {//color bitmap present 172 172 hbmColor = GpiCreateBitmap(hps, &bfhColor->bmp2, CBM_INIT, 173 173 (char *)bafh + bfhColor->offBits, 174 174 (BITMAPINFO2 *)&bfhColor->bmp2); 175 176 177 178 179 180 175 if(hbmColor == GPI_ERROR) { 176 dprintf(("OSLibWinCreateIcon: GpiCreateBitmap failed!")); 177 GpiDeleteBitmap(hbmMask); 178 WinReleasePS(hps); 179 return 0; 180 } 181 181 } 182 182 … … 198 198 //****************************************************************************** 199 199 //****************************************************************************** 200 HANDLE OSLibWinQuerySysIcon(ULONG type )200 HANDLE OSLibWinQuerySysIcon(ULONG type,INT w,INT h) 201 201 { 202 202 ULONG os2type = 0; 203 HPOINTER hPointer; 203 204 204 205 switch(type) { … … 222 223 } 223 224 224 return WinQuerySysPointer(HWND_DESKTOP, os2type, TRUE); 225 } 226 //****************************************************************************** 227 //****************************************************************************** 228 HANDLE OSLibWinQuerySysPointer(ULONG type) 225 hPointer = WinQuerySysPointer(HWND_DESKTOP, os2type, TRUE); 226 227 if (hPointer) 228 { 229 INT sysW = WinQuerySysValue(HWND_DESKTOP,SV_CXICON),sysH = WinQuerySysValue(HWND_DESKTOP,SV_CYICON); 230 231 if (sysW != w || sysH != h) 232 { 233 POINTERINFO pi; 234 235 WinQueryPointerInfo(hPointer,&pi); 236 //CB: todo: change icon size 237 238 } 239 } 240 241 return hPointer; 242 } 243 //****************************************************************************** 244 //****************************************************************************** 245 HANDLE OSLibWinQuerySysPointer(ULONG type,INT w,INT h) 229 246 { 230 247 ULONG os2type = 0; -
trunk/src/user32/oslibres.h
r949 r1667 1 /* $Id: oslibres.h,v 1. 1 1999-09-15 23:18:54 sandervlExp $ */1 /* $Id: oslibres.h,v 1.2 1999-11-09 17:07:21 cbratschi Exp $ */ 2 2 /* 3 3 * Window GUI resource wrapper functions for OS/2 … … 16 16 #include "win32type.h" 17 17 #endif 18 18 19 19 HANDLE OSLibWinSetAccelTable(HWND hwnd, HANDLE hAccel, PVOID acceltemplate); 20 20 HANDLE OSLibWinCreateIcon(PVOID iconbitmap); 21 21 HANDLE OSLibWinCreatePointer(PVOID cursorbitmap); 22 HANDLE OSLibWinQuerySysPointer(ULONG type );23 HANDLE OSLibWinQuerySysIcon(ULONG type );22 HANDLE OSLibWinQuerySysPointer(ULONG type,INT w,INT h); 23 HANDLE OSLibWinQuerySysIcon(ULONG type,INT w,INT h); 24 24 25 25 #endif //__OSLIBGDI_H__ -
trunk/src/user32/pmframe.cpp
r1583 r1667 1 /* $Id: pmframe.cpp,v 1.2 0 1999-11-03 22:04:22 cbratschi Exp $ */1 /* $Id: pmframe.cpp,v 1.21 1999-11-09 17:07:22 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Frame Managment Code for OS/2 … … 51 51 //****************************************************************************** 52 52 //****************************************************************************** 53 VOID DeflateRect(RECTL *rect)53 inline VOID DeflateRect(RECTL *rect) 54 54 { 55 55 rect->xLeft++; -
trunk/src/user32/scroll.cpp
r1530 r1667 1 /* $Id: scroll.cpp,v 1.1 8 1999-10-31 17:53:53cbratschi Exp $ */1 /* $Id: scroll.cpp,v 1.19 1999-11-09 17:07:22 cbratschi Exp $ */ 2 2 /* 3 3 * Scrollbar control … … 531 531 INT x; 532 532 533 p1.x = rect.right- 2;533 p1.x = rect.right-1; 534 534 p1.y = rect.bottom; 535 p2.x = rect.right -1;535 p2.x = rect.right; 536 536 p2.y = rect.bottom-1; 537 537 for (x = 0;x < 3;x++) -
trunk/src/user32/uitools.cpp
r1513 r1667 1 /* $Id: uitools.cpp,v 1.1 5 1999-10-30 09:19:44 sandervlExp $ */1 /* $Id: uitools.cpp,v 1.16 1999-11-09 17:07:23 cbratschi Exp $ */ 2 2 /* 3 3 * User Interface Functions … … 191 191 epy = rc->bottom; 192 192 spy = epy - SmallDiam; 193 epx++;194 epy--;195 193 break; 196 194 … … 202 200 epy = rc->top-1; 203 201 spy = epy + SmallDiam; 204 epx++;205 epy++;206 202 break; 207 203 … … 221 217 spy = rc->bottom-1; 222 218 epy = spy - SmallDiam; 223 epx--;224 epy++;225 219 break; 226 220 } … … 358 352 * 359 353 * 23-Nov-1997: Changed by Bertho Stultiens 360 * 25-June-1999: Changed by Christoph Bratschi361 *362 * Attention: only draw in the rect's range!363 * left to right-1364 * top to bottom-1365 354 * 366 355 * Well, I started testing this and found out that there are a few things … … 508 497 { 509 498 MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL); 510 LineTo(hdc, InnerRect.right -1, InnerRect.top);499 LineTo(hdc, InnerRect.right, InnerRect.top); 511 500 } 512 501 if(uFlags & BF_LEFT) 513 502 { 514 503 MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL); 515 LineTo(hdc, InnerRect.left, InnerRect.bottom -1);504 LineTo(hdc, InnerRect.left, InnerRect.bottom); 516 505 } 517 506 … … 520 509 { 521 510 MoveToEx(hdc, InnerRect.right-1, InnerRect.bottom-1, NULL); 522 LineTo(hdc, InnerRect.left , InnerRect.bottom-1);511 LineTo(hdc, InnerRect.left-1, InnerRect.bottom-1); 523 512 } 524 513 if(uFlags & BF_RIGHT) 525 514 { 526 515 MoveToEx(hdc, InnerRect.right-1, InnerRect.bottom-1, NULL); 527 LineTo(hdc, InnerRect.right-1, InnerRect.top );516 LineTo(hdc, InnerRect.right-1, InnerRect.top-1); 528 517 } 529 518 … … 533 522 { 534 523 MoveToEx(hdc, InnerRect.left+LTpenplus, InnerRect.top+1, NULL); 535 LineTo(hdc, InnerRect.right-RTpenplus -1, InnerRect.top+1);524 LineTo(hdc, InnerRect.right-RTpenplus, InnerRect.top+1); 536 525 } 537 526 if(uFlags & BF_LEFT) 538 527 { 539 528 MoveToEx(hdc, InnerRect.left+1, InnerRect.top+LTpenplus, NULL); 540 LineTo(hdc, InnerRect.left+1, InnerRect.bottom-LBpenplus -1);529 LineTo(hdc, InnerRect.left+1, InnerRect.bottom-LBpenplus); 541 530 } 542 531 SelectObject(hdc, RBInnerPen); … … 544 533 { 545 534 MoveToEx(hdc, InnerRect.right-1-RBpenplus, InnerRect.bottom-2, NULL); 546 LineTo(hdc, InnerRect.left +LBpenplus, InnerRect.bottom-2);535 LineTo(hdc, InnerRect.left-1+LBpenplus, InnerRect.bottom-2); 547 536 } 548 537 if(uFlags & BF_RIGHT) 549 538 { 550 539 MoveToEx(hdc, InnerRect.right-2, InnerRect.bottom-1-RBpenplus, NULL); 551 LineTo(hdc, InnerRect.right-2, InnerRect.top +RTpenplus);540 LineTo(hdc, InnerRect.right-2, InnerRect.top-1+RTpenplus); 552 541 } 553 542
Note:
See TracChangeset
for help on using the changeset viewer.