source: trunk/src/user32/dc.cpp@ 4463

Last change on this file since 4463 was 4463, checked in by sandervl, 25 years ago

mdi fix + ShowOwnedPopups implemented

File size: 55.2 KB
Line 
1/* $Id: dc.cpp,v 1.74 2000-10-09 17:26:47 sandervl Exp $ */
2
3/*
4 * DC functions for USER32
5 *
6 * Project Odin Software License can be found in LICENSE.TXT
7 *
8 */
9
10/*****************************************************************************
11 * Includes *
12 *****************************************************************************/
13
14#include <odin.h>
15
16#define INCL_WIN
17#define INCL_GPI
18#define INCL_GREALL
19#define INCL_DEV
20#include <os2wrap.h>
21//#include <pmddi.h>
22#include <stdlib.h>
23
24#include <string.h>
25#include <win32type.h>
26#include <win32api.h>
27#include <winconst.h>
28#include <misc.h>
29#include <win32wbase.h>
30#include <math.h>
31#include <limits.h>
32#include "oslibwin.h"
33#include "oslibmsg.h"
34#include <dcdata.h>
35
36#define INCLUDED_BY_DC
37#include "dc.h"
38
39#define DBG_LOCALLOG DBG_dc
40#include "dbglocal.h"
41
42#ifndef DEVESC_SETPS
43 #define DEVESC_SETPS 49149L
44#endif
45
46#define FLOAT_TO_FIXED(x) ((FIXED) ((x) * 65536.0))
47#define MICRO_HPS_TO_HDC(x) ((x) & 0xFFFFFFFE)
48
49#define PMRECT_FROM_WINRECT( pmRect, winRect ) \
50{ \
51 (pmRect).xLeft = (winRect).left; \
52 (pmRect).yBottom = (winRect).bottom; \
53 (pmRect).xRight = (winRect).right; \
54 (pmRect).yTop = (winRect).top; \
55}
56
57#define WINRECT_FROM_PMRECT( winRect, pmRect ) \
58{ \
59 (winRect).left = (pmRect).xLeft; \
60 (winRect).top = (pmRect).yTop; \
61 (winRect).right = (pmRect).xRight; \
62 (winRect).bottom = (pmRect).yBottom; \
63}
64
65#define MEM_HPS_MAX 768
66
67const XFORM_W XFORMIdentity = { 1.0, 0.0, 0.0, 1.0, 0, 0 };
68const MATRIXLF matrixlfIdentity = { 0x10000, 0, 0, 0, 0x10000, 0, 0, 0, 0};
69
70BOOL setPageXForm(Win32BaseWindow *wnd, pDCData pHps);
71BOOL changePageXForm(Win32BaseWindow *wnd, pDCData pHps, PPOINTL pValue, int x, int y, PPOINTL pPrev);
72LONG clientHeight(Win32BaseWindow *wnd, HWND hwnd, pDCData pHps);
73
74#ifdef DEBUG
75#define dprintfRegion(a,b,c) if(DbgEnabledLvl2[DBG_LOCALLOG] == 1) dprintfRegion1(a,b,c)
76
77void dprintfRegion1(HPS hps, HWND hWnd, HRGN hrgnClip)
78{
79 RGNRECT rgnRect = {0, 16, 0, RECTDIR_LFRT_TOPBOT};
80 RECTL rectRegion[16];
81 APIRET rc;
82
83 dprintf(("dprintfRegion %x %x", hWnd, hps));
84 rc = GpiQueryRegionRects(hps, hrgnClip, NULL, &rgnRect, &rectRegion[0]);
85 for(int i=0;i<rgnRect.crcReturned;i++) {
86 dprintf(("(%d,%d)(%d,%d)", rectRegion[i].xLeft, rectRegion[i].yBottom, rectRegion[i].xRight, rectRegion[i].yTop));
87 }
88}
89#else
90#define dprintfRegion(a,b,c)
91#endif
92
93//******************************************************************************
94//******************************************************************************
95void TestWideLine (pDCData pHps)
96{
97 const LOGPEN_W *pLogPen;
98
99 pHps->isWideLine = FALSE;
100 pLogPen = pHps->penIsExtPen ?
101 &(pHps->lastPenObject->ExtPen.logpen) :
102 &(pHps->lastPenObject->Pen.logpen);
103
104 if (((pLogPen->lopnStyle & PS_STYLE_MASK_W) != PS_NULL_W) &&
105 (pLogPen->lopnWidth.x > 0))
106 {
107 POINTL aptl[2] = { 0, 0, pLogPen->lopnWidth.x, pLogPen->lopnWidth.x };
108
109 GpiConvert(pHps->hps, CVTC_WORLD, CVTC_DEVICE, 2, aptl);
110
111 ULONG dx = abs(aptl[0].x - aptl[1].x);
112 ULONG dy = abs(aptl[0].y - aptl[1].y);
113
114 pHps->isWideLine = (dx > 1) || (dy > 1);
115 }
116}
117//******************************************************************************
118//******************************************************************************
119void Calculate1PixelDelta(pDCData pHps)
120{
121 POINTL aptl[2] = {0, 0, 1, 1};
122
123 GpiConvert(pHps->hps, CVTC_DEVICE, CVTC_WORLD, 2, aptl);
124 pHps->worldYDeltaFor1Pixel = (int)(aptl[1].y - aptl[0].y);
125 pHps->worldXDeltaFor1Pixel = (int)(aptl[1].x - aptl[0].x); // 171182
126}
127//******************************************************************************
128//******************************************************************************
129int setMapMode(Win32BaseWindow *wnd, pDCData pHps, int mode)
130{
131 int prevMode = 0;
132 ULONG flOptions;
133
134 switch (mode)
135 {
136 case MM_HIENGLISH_W : flOptions = PU_HIENGLISH; break;
137 case MM_LOENGLISH_W : flOptions = PU_LOENGLISH; break;
138 case MM_HIMETRIC_W : flOptions = PU_HIMETRIC ; break;
139 case MM_LOMETRIC_W : flOptions = PU_LOMETRIC ; break;
140 case MM_TEXT_W : flOptions = PU_PELS ; break;
141 case MM_TWIPS_W : flOptions = PU_TWIPS ; break;
142 case MM_ANISOTROPIC_W: flOptions = PU_PELS ; break;
143 case MM_ISOTROPIC_W : flOptions = PU_LOMETRIC ; break;
144 default:
145 SetLastError(ERROR_INVALID_PARAMETER_W);
146 return FALSE;
147 }
148
149 prevMode = pHps->MapMode; /* store previous mode */
150 pHps->MapMode = mode;
151
152 if (mode == MM_TEXT_W)
153 {
154 pHps->viewportXExt =
155 pHps->viewportYExt = 1.0;
156 pHps->windowExt.cx =
157 pHps->windowExt.cy = 1;
158 }
159 else if (mode != MM_ANISOTROPIC_W)
160 {
161 RECTL rectl;
162 SIZEL sizel;
163 ULONG data[3];
164
165 data[0] = flOptions;
166 data[1] = data[2] = 0;
167
168 if (DevEscape(pHps->hdc ? pHps->hdc : pHps->hps, DEVESC_SETPS, 12, (PBYTE)data, 0, 0) == DEVESC_ERROR)
169 {
170 SetLastError(ERROR_INVALID_PARAMETER_W);
171 return 0;
172 }
173
174 GpiQueryPageViewport(pHps->hps, &rectl);
175 pHps->viewportXExt = (double)rectl.xRight;
176 pHps->viewportYExt = -(double)rectl.yTop;
177
178 GreGetPageUnits(pHps->hdc? pHps->hdc : pHps->hps, &sizel);
179 pHps->windowExt.cx = sizel.cx;
180 pHps->windowExt.cy = sizel.cy;
181
182 data[0] = PU_PELS;
183 DevEscape(pHps->hdc ? pHps->hdc : pHps->hps, DEVESC_SETPS, 12, (PBYTE)data, 0, 0);
184 }
185
186 if (((prevMode != MM_ISOTROPIC_W) && (prevMode != MM_ANISOTROPIC_W)) &&
187 ((mode == MM_ISOTROPIC_W) || (mode == MM_ANISOTROPIC_W)))
188 {
189 if (pHps->lWndXExtSave && pHps->lWndYExtSave)
190 {
191 changePageXForm (wnd, pHps, (PPOINTL)&pHps->windowExt,
192 pHps->lWndXExtSave, pHps->lWndYExtSave, NULL );
193 pHps->lWndXExtSave = pHps->lWndYExtSave = 0;
194 }
195 if (pHps->lVwpXExtSave && pHps->lVwpYExtSave)
196 {
197 changePageXForm (wnd, pHps, NULL,
198 pHps->lVwpXExtSave, pHps->lVwpYExtSave, NULL );
199 pHps->lVwpXExtSave = pHps->lVwpYExtSave = 0;
200 }
201 }
202
203 setPageXForm(wnd, pHps);
204
205 return prevMode;
206}
207//******************************************************************************
208//******************************************************************************
209BOOL setPageXForm(Win32BaseWindow *wnd, pDCData pHps)
210{
211 MATRIXLF mlf;
212 BOOL rc = TRUE;
213
214 pHps->height = clientHeight(wnd, 0, pHps) - 1;
215
216 double xScale = pHps->viewportXExt / (double)pHps->windowExt.cx;
217 double yScale = pHps->viewportYExt / (double)pHps->windowExt.cy;
218
219 mlf.fxM11 = FLOAT_TO_FIXED(xScale);
220 mlf.fxM12 = 0;
221 mlf.lM13 = 0;
222 mlf.fxM21 = 0;
223 mlf.fxM22 = FLOAT_TO_FIXED(yScale);
224 mlf.lM23 = 0;
225 mlf.lM31 = pHps->viewportOrg.x - (LONG)(pHps->windowOrg.x * xScale);
226 mlf.lM32 = pHps->viewportOrg.y - (LONG)(pHps->windowOrg.y * yScale);
227
228 pHps->isLeftLeft = mlf.fxM11 >= 0;
229 pHps->isTopTop = mlf.fxM22 >= 0;
230
231 BOOL bEnableYInversion = FALSE;
232 if ((mlf.fxM22 > 0) ||
233 ((pHps->graphicsMode == GM_ADVANCED_W) &&
234 ((pHps->MapMode == MM_ANISOTROPIC_W) ||
235 (pHps->MapMode == MM_ISOTROPIC_W))))
236 {
237 bEnableYInversion = TRUE;
238 }
239 else
240 {
241 bEnableYInversion = FALSE;
242 mlf.lM32 = pHps->HPStoHDCInversionHeight + pHps->height - mlf.lM32;
243 mlf.fxM22 = -mlf.fxM22;
244 }
245
246 if (!pHps->isMetaPS)
247// if ((!pHps->isMetaPS) ||
248// (pHps->pMetaFileObject && pHps->pMetaFileObject->isEnhanced()))
249 rc = GpiSetDefaultViewMatrix(pHps->hps, 8, &mlf, TRANSFORM_REPLACE);
250
251 if (bEnableYInversion)
252 GpiEnableYInversion(pHps->hps, pHps->height + pHps->HPStoHDCInversionHeight);
253 else
254 GpiEnableYInversion(pHps->hps, 0);
255
256 TestWideLine(pHps);
257 Calculate1PixelDelta(pHps);
258 return rc;
259}
260//******************************************************************************
261//******************************************************************************
262BOOL changePageXForm(Win32BaseWindow *wnd, pDCData pHps, PPOINTL pValue, int x, int y, PPOINTL pPrev)
263{
264 BOOL result = FALSE;
265
266 if (pValue)
267 {
268 if (pPrev)
269 *pPrev = *pValue;
270
271 if ((pValue->x == x) && (pValue->y == y)) {
272 return TRUE;
273 }
274 pValue->x = x;
275 pValue->y = y;
276 }
277 else
278 {
279 if (pPrev)
280 {
281 pPrev->x = (int)pHps->viewportXExt;
282 pPrev->y = (int)pHps->viewportYExt;
283 }
284 pHps->viewportXExt = (double)x;
285 pHps->viewportYExt = (double)y;
286 }
287
288 if (pHps->MapMode == MM_ISOTROPIC_W)
289 {
290 double xExt = fabs(pHps->viewportXExt);
291 double yExt = fabs(pHps->viewportYExt);
292 double sf = fabs((double)pHps->windowExt.cx / pHps->windowExt.cy);
293
294 if (xExt > (yExt * sf))
295 {
296 xExt = yExt * sf;
297
298 if ((double)LONG_MAX <= xExt) return (result);
299
300 if (pHps->viewportXExt < 0.0)
301 pHps->viewportXExt = -xExt;
302 else
303 pHps->viewportXExt = xExt;
304 }
305 else
306 {
307 yExt = xExt / sf;
308
309 if ((double)LONG_MAX <= yExt) return (result);
310
311 if (pHps->viewportYExt < 0.0)
312 pHps->viewportYExt = -yExt;
313 else
314 pHps->viewportYExt = yExt;
315 }
316 }
317 result = setPageXForm(wnd, pHps);
318
319 return (result);
320}
321//******************************************************************************
322//******************************************************************************
323VOID removeClientArea(Win32BaseWindow *window, pDCData pHps)
324{
325 POINTL point;
326
327 // This function checks to see if a client area is currently selected, if
328 // it is the origin plus the visible region of the frame are restored.
329
330 pHps->isClient = FALSE;
331
332#ifdef DEBUG
333 GreGetDCOrigin(pHps->hps, &point);
334#endif
335
336 if(pHps->isClientArea)
337 {
338 dprintf2(("removeClientArea %x: (%d,%d) -> (%d,%d)", window->getWindowHandle(), point.x, point.y, pHps->ptlOrigin.x, pHps->ptlOrigin.y));
339 pHps->isClientArea = FALSE;
340 GreSetupDC(pHps->hps,
341 pHps->hrgnVis,
342 pHps->ptlOrigin.x,
343 pHps->ptlOrigin.y,
344 0,
345 SETUPDC_ORIGIN | SETUPDC_VISRGN | SETUPDC_RECALCCLIP);
346 }
347 else dprintf2(("removeClientArea: %x (%d,%d)", window->getWindowHandle(), point.x, point.y));
348
349}
350//******************************************************************************
351//******************************************************************************
352void selectClientArea(Win32BaseWindow *window, pDCData pHps)
353{
354 // This function checks to see if the DC needs to be adjusted to a client
355 // area and makes the adjustment.
356 RECTL rcl, rcltemp;
357 HRGN hrgnRect, hrgnClip, hrgnOldClip = 0;
358 HWND hwnd;
359 LONG rc;
360 PRECT pClient = window->getClientRectPtr();
361 PRECT pWindow = window->getWindowRect();
362
363 if(pClient->left == 0 && pClient->top == 0 &&
364 window->getClientHeight() == window->getWindowHeight() &&
365 window->getClientWidth() == window->getWindowWidth())
366 {
367 //client rectangle = frame rectangle -> no change necessary
368 return;
369 }
370 pHps->isClient = TRUE;
371
372 hwnd = window->getOS2WindowHandle();
373
374 mapWin32ToOS2Rect(window->getWindowHeight(), window->getClientRectPtr(), (PRECTLOS2)&rcl);
375
376 //convert to screen coordinates
377 GreGetDCOrigin(pHps->hps, (PPOINTL)&rcltemp);
378
379 if(pHps->isClientArea)
380 {
381 //TODO: counter
382 dprintf2(("WARNING: selectClientArea %x; already selected! origin (%d,%d) original origin (%d,%d)", window->getWindowHandle(), rcltemp.xLeft, rcltemp.yBottom, pHps->ptlOrigin.x, pHps->ptlOrigin.y));
383 RECT rectWindow;
384 RECTL rectWindowOS2;
385 GetWindowRect(window->getWindowHandle(), &rectWindow);
386 mapWin32ToOS2Rect(OSLibGetScreenHeight(), &rectWindow, (PRECTLOS2)&rectWindowOS2);
387 if(rectWindowOS2.xLeft + rcl.xLeft != rcltemp.xLeft ||
388 rectWindowOS2.yBottom + rcl.yBottom != rcltemp.yBottom)
389 {
390 dprintf2(("WARNING: origin changed (%d,%d) instead of (%d,%d)!", rcltemp.xLeft, rcltemp.yBottom, rectWindowOS2.xLeft + rcl.xLeft, rectWindowOS2.yBottom + rcl.yBottom));
391 rcl.xLeft += rectWindowOS2.xLeft;
392 rcl.xRight += rectWindowOS2.xLeft;
393 rcl.yTop += rectWindowOS2.yBottom;
394 rcl.yBottom += rectWindowOS2.yBottom;
395 }
396 else return;
397 }
398 else {
399 rcl.xLeft += rcltemp.xLeft;
400 rcl.xRight += rcltemp.xLeft;
401 rcl.yTop += rcltemp.yBottom;
402 rcl.yBottom += rcltemp.yBottom;
403
404 pHps->ptlOrigin.x = rcltemp.xLeft;
405 pHps->ptlOrigin.y = rcltemp.yBottom;
406 }
407
408 dprintf2(("selectClientArea %x: (%d,%d) -> (%d,%d)", window->getWindowHandle(), rcltemp.xLeft, rcltemp.yBottom, rcl.xLeft, rcl.yBottom));
409
410 if(pHps->hrgnVis == 0)
411 pHps->hrgnVis = GreCreateRectRegion(pHps->hps, &rcl, 1);
412
413 hrgnRect = GreCreateRectRegion(pHps->hps, &rcl, 1);
414
415 // Query the visible region
416 GreCopyClipRegion(pHps->hps, pHps->hrgnVis, 0, COPYCRGN_VISRGN);
417 GpiQueryRegionBox(pHps->hps, pHps->hrgnVis, &rcltemp);
418 // And the visible region of the frame with the client rectangle
419 // to get the new visible region
420 GreCombineRegion(pHps->hps, hrgnRect, pHps->hrgnVis, hrgnRect, CRGN_AND);
421
422 // Set the new origin plus visible region in the DC
423 GreSetupDC(pHps->hps,
424 hrgnRect,
425 rcl.xLeft,
426 rcl.yBottom,
427 NULL,
428 SETUPDC_ORIGIN | SETUPDC_VISRGN | SETUPDC_RECALCCLIP);
429
430 pHps->isClientArea = TRUE;
431
432 // Destroy the region now we have finished with it.
433 GreDestroyRegion(pHps->hps, hrgnRect);
434}
435//******************************************************************************
436//******************************************************************************
437LONG clientHeight(Win32BaseWindow *wnd, HWND hwnd, pDCData pHps)
438{
439 if ((hwnd == 0) && (pHps != 0))
440 hwnd = pHps->hwnd;
441
442 if ((hwnd != 0) || (pHps == 0))
443 {
444 if(wnd) {
445 if(pHps && !pHps->isClientArea) {
446 return (wnd->getWindowHeight());
447 }
448 else return (wnd->getClientHeight());
449 }
450 else return OSLibQueryScreenHeight();
451 }
452 else if (pHps->bitmapHandle)
453 {
454 return pHps->bitmapHeight;
455 }
456 else if (pHps->isMetaPS)
457 {
458 return 0;
459 }
460 else if (pHps->isPrinter)
461 {
462 return pHps->printPageHeight;
463 }
464 else
465 {
466 return MEM_HPS_MAX;
467 }
468}
469//******************************************************************************
470//******************************************************************************
471BOOL isYup (pDCData pHps)
472{
473 if (((pHps->windowExt.cy < 0) && (pHps->viewportYExt > 0.0)) ||
474 ((pHps->windowExt.cy > 0) && (pHps->viewportYExt < 0.0)))
475 {
476 if ((pHps->graphicsMode == GM_COMPATIBLE_W) ||
477 ((pHps->graphicsMode == GM_ADVANCED_W) && (pHps->xform.eM22 >= 0.0)))
478 return TRUE;
479 }
480 else
481 {
482 if ((pHps->graphicsMode == GM_ADVANCED_W) && (pHps->xform.eM22 < 0.0))
483 return TRUE;
484 }
485 return FALSE;
486}
487//******************************************************************************
488//******************************************************************************
489INT revertDy (Win32BaseWindow *wnd, INT dy)
490{
491 //SvL: Hack for memory.exe (doesn't get repainted properly otherwise)
492// if (wnd->isOwnDC() && wnd->getOwnDC())
493 if (wnd->isOwnDC())
494 {
495 pDCData pHps = (pDCData)GpiQueryDCData (wnd->getOwnDC());
496
497 if (pHps != NULLHANDLE)
498 if (!isYup (pHps))
499 dy = -dy;
500 }
501 else
502 {
503 dy = -dy;
504 }
505 return (dy);
506}
507//******************************************************************************
508//******************************************************************************
509HDC sendEraseBkgnd (Win32BaseWindow *wnd)
510{
511 BOOL erased;
512 HWND hwnd;
513 HDC hdc;
514 HPS hps;
515 HRGN hrgnUpdate, hrgnOld, hrgnClip, hrgnCombined;
516 RECTL rectl = { 1, 1, 2, 2 };
517
518 hwnd = wnd->getOS2WindowHandle();
519 hps = WinGetPS(hwnd);
520
521 hrgnUpdate = GpiCreateRegion (hps, 1, &rectl);
522 WinQueryUpdateRegion (hwnd, hrgnUpdate);
523 hrgnClip = GpiQueryClipRegion (hps);
524
525 if (hrgnClip == NULLHANDLE)
526 {
527 GpiSetClipRegion (hps, hrgnUpdate, &hrgnOld);
528 }
529 else
530 {
531 hrgnCombined = GpiCreateRegion (hps, 1, &rectl);
532 GpiCombineRegion (hps, hrgnCombined, hrgnClip, hrgnUpdate, CRGN_AND);
533 GpiSetClipRegion (hps, hrgnCombined, &hrgnOld);
534 GpiDestroyRegion (hps, hrgnUpdate);
535 GpiDestroyRegion (hps, hrgnClip);
536 }
537 if (hrgnOld != NULLHANDLE)
538 GpiDestroyRegion (hps, hrgnOld);
539
540 hdc = HPSToHDC (hwnd, hps, NULL, NULL);
541
542 erased = wnd->MsgEraseBackGround (hdc);
543
544 DeleteHDC (hdc);
545 WinReleasePS (hps);
546
547 return erased;
548}
549//******************************************************************************
550//******************************************************************************
551void releaseOwnDC (HDC hps)
552{
553 pDCData pHps = (pDCData)GpiQueryDCData ((HPS)hps);
554
555 dprintf2(("releaseOwnDC %x", hps));
556
557 if (pHps) {
558 if (pHps->hrgnHDC)
559 GpiDestroyRegion (pHps->hps, pHps->hrgnHDC);
560
561 GpiSetBitmap (pHps->hps, NULL);
562 O32_DeleteObject (pHps->nullBitmapHandle);
563 GpiDestroyPS(pHps->hps);
564
565 if (pHps->hdc)
566 DevCloseDC(pHps->hdc);
567 }
568}
569//******************************************************************************
570//******************************************************************************
571HDC WIN32API BeginPaint (HWND hWnd, PPAINTSTRUCT_W lpps)
572{
573 HWND hwnd = hWnd ? hWnd : HWND_DESKTOP;
574 pDCData pHps = NULLHANDLE;
575 HPS hPS_ownDC = NULLHANDLE, hpsPaint = 0;
576 RECTL rectl = {0, 0, 1, 1};
577 HRGN hrgnOldClip;
578 LONG lComplexity;
579 RECTL rectlClient;
580 RECTL rectlClip;
581
582 memset(lpps, 0, sizeof(*lpps));
583 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
584 if(!lpps || !wnd) {
585 dprintf (("USER32: BeginPaint %x invalid parameter %x", hWnd, lpps));
586 SetLastError(ERROR_INVALID_PARAMETER_W);
587 return (HDC)0;
588 }
589 HWND hwndClient = wnd->getOS2WindowHandle();
590
591 if(hwnd != HWND_DESKTOP && wnd->isOwnDC())
592 {
593 hPS_ownDC = wnd->getOwnDC();
594 //SvL: Hack for memory.exe (doesn't get repainted properly otherwise)
595 if(hPS_ownDC) {
596 pHps = (pDCData)GpiQueryDCData(hPS_ownDC);
597 if (!pHps)
598 {
599 dprintf (("USER32: BeginPaint %x invalid parameter %x", hWnd, lpps));
600 SetLastError(ERROR_INVALID_PARAMETER_W);
601 return (HDC)NULLHANDLE;
602 }
603 hpsPaint = hPS_ownDC;
604 }
605 }
606 if(!hpsPaint) {
607 hpsPaint = GetDCEx(hwnd, 0, (DCX_CACHE_W|DCX_WINDOW_W|DCX_USESTYLE_W));
608 pHps = (pDCData)GpiQueryDCData(hpsPaint);
609 if (!pHps)
610 {
611 dprintf (("USER32: BeginPaint %x invalid parameter %x", hWnd, lpps));
612 SetLastError(ERROR_INVALID_PARAMETER_W);
613 return (HDC)NULLHANDLE;
614 }
615 }
616
617 if(WinQueryUpdateRect(hwndClient, &rectl) == FALSE) {
618 memset(&rectl, 0, sizeof(rectl));
619 dprintf (("USER32: WARNING: WinQueryUpdateRect failed (error or no update rectangle)!!"));
620
621 HRGN hrgnClip = GpiCreateRegion(pHps->hps, 1, &rectl);
622 GpiSetClipRegion(pHps->hps, hrgnClip, &hrgnOldClip);
623
624 selectClientArea(wnd, pHps);
625
626 //save old clip region (restored for CS_OWNDC windows in EndPaint)
627 wnd->SetClipRegion(hrgnOldClip);
628 lComplexity = RGN_NULL;
629 }
630 else {
631 rectlClip.yBottom = rectlClip.xLeft = 0;
632 rectlClip.yTop = rectlClip.xRight = 1;
633
634 //Query update region
635 HRGN hrgnClip = GpiCreateRegion(pHps->hps, 1, &rectlClip);
636 WinQueryUpdateRegion(hwndClient, hrgnClip);
637 WinValidateRegion(hwndClient, hrgnClip, FALSE);
638
639 mapWin32ToOS2Rect(wnd->getWindowHeight(), wnd->getClientRectPtr(), (PRECTLOS2)&rectlClient);
640 WinIntersectRect(NULL, &rectlClip, &rectl, &rectlClient);
641 WinOffsetRect(NULL, &rectlClip, -rectlClient.xLeft, -rectlClient.yBottom);
642
643 //change presentation space for client window
644 selectClientArea(wnd, pHps);
645
646 //clip update region with client window rectangle
647 HRGN hrgnClient = GpiCreateRegion(pHps->hps, 1, &rectlClient);
648 GpiCombineRegion(pHps->hps, hrgnClip, hrgnClip, hrgnClient, CRGN_AND);
649 GpiDestroyRegion(pHps->hps, hrgnClient);
650
651 //change origin of clip region (window -> client)
652 POINTL point = {-rectlClient.xLeft, -rectlClient.yBottom};
653 GpiOffsetRegion(pHps->hps, hrgnClip, &point);
654
655 //set clip region
656 GpiSetClipRegion(pHps->hps, hrgnClip, &hrgnOldClip);
657
658 //save old clip region (restored for CS_OWNDC windows in EndPaint)
659 wnd->SetClipRegion(hrgnOldClip);
660 memcpy(&rectl, &rectlClip, sizeof(RECTL));
661 lComplexity = RGN_RECT;
662 }
663
664 if(hPS_ownDC == 0)
665 setMapMode (wnd, pHps, MM_TEXT_W);
666 else
667 setPageXForm(wnd, pHps);
668
669 pHps->hdcType = TYPE_3;
670
671 HideCaret(hwnd);
672 WinShowTrackRect(wnd->getOS2WindowHandle(), FALSE);
673
674#ifdef DEBUG
675 POINTL point;
676 GreGetDCOrigin(pHps->hps, &point);
677 dprintf(("dc origin (%d,%d)", point.x, point.y));
678#endif
679
680 if(wnd->needsEraseBkgnd() && lComplexity != RGN_NULL) {
681 wnd->setEraseBkgnd(FALSE);
682 lpps->fErase = (wnd->MsgEraseBackGround(pHps->hps) != 0);
683 }
684 else lpps->fErase = TRUE;
685
686#ifdef DEBUG
687 GreGetDCOrigin(pHps->hps, &point);
688 dprintf(("dc origin (%d,%d)", point.x, point.y));
689#endif
690
691 lpps->hdc = (HDC)pHps->hps;
692
693 if(lComplexity != RGN_NULL) {
694 long height = wnd->getClientHeight();
695 lpps->rcPaint.top = height - rectl.yTop;
696 lpps->rcPaint.left = rectl.xLeft;
697 lpps->rcPaint.bottom = height - rectl.yBottom;
698 lpps->rcPaint.right = rectl.xRight;
699 }
700 else {
701 lpps->rcPaint.bottom = lpps->rcPaint.top = 0;
702 lpps->rcPaint.right = lpps->rcPaint.left = 0;
703 }
704
705 SetLastError(0);
706 dprintf(("USER32: BeginPaint %x -> hdc %x (%d,%d)(%d,%d)", hWnd, pHps->hps, lpps->rcPaint.left, lpps->rcPaint.top, lpps->rcPaint.right, lpps->rcPaint.bottom));
707 return (HDC)pHps->hps;
708}
709//******************************************************************************
710//******************************************************************************
711BOOL WIN32API EndPaint (HWND hWnd, const PAINTSTRUCT_W *pPaint)
712{
713 HWND hwnd = hWnd ? hWnd : HWND_DESKTOP;
714 HRGN hrgnOld;
715 pDCData pHps;
716
717 dprintf (("USER32: EndPaint(%x)", hwnd));
718
719 if (!pPaint || !pPaint->hdc )
720 return TRUE;
721
722 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
723
724 if (!wnd) goto exit;
725
726 pHps = (pDCData)GpiQueryDCData((HPS)pPaint->hdc);
727 if (pHps && (pHps->hdcType == TYPE_3))
728 {
729 GpiSetClipRegion(pHps->hps, wnd->GetClipRegion(), &hrgnOld);
730 wnd->SetClipRegion(0);
731 if(hrgnOld) {
732 GpiDestroyRegion(pHps->hps, hrgnOld);
733 }
734 pHps->hdcType = TYPE_1; //otherwise Open32's ReleaseDC fails
735 ReleaseDC(hwnd, pPaint->hdc);
736 }
737 else {
738 dprintf(("EndPaint: wrong hdc %x!!", pPaint->hdc));
739 }
740 wnd->setEraseBkgnd(TRUE);
741 ShowCaret(hwnd);
742 WinShowTrackRect(wnd->getOS2WindowHandle(), TRUE);
743
744exit:
745 SetLastError(0);
746 return TRUE;
747}
748//******************************************************************************
749//******************************************************************************
750int WIN32API ReleaseDC (HWND hwnd, HDC hdc)
751{
752 BOOL isOwnDC = FALSE;
753 int rc;
754
755 if (hwnd)
756 {
757 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
758 if(wnd == NULL) {
759 dprintf(("ERROR: ReleaseDC %x %x failed", hwnd, hdc));
760 return 0;
761 }
762 isOwnDC = wnd->isOwnDC() && (wnd->getOwnDC() == hdc);
763 if(!isOwnDC)
764 {
765 pDCData pHps = (pDCData)GpiQueryDCData((HPS)hdc);
766 if(pHps && pHps->psType == MICRO_CACHED) {
767 removeClientArea(wnd, pHps);
768 if(pHps->hrgnVis) {
769 GreDestroyRegion(pHps->hps, pHps->hrgnVis);
770 pHps->hrgnVis = 0;
771 }
772 }
773 else {
774 dprintf(("ERROR: ReleaseDC: pHps == NULL!!"));
775 DebugInt3();
776 }
777 }
778 else {
779 dprintf2(("ReleaseDC: CS_OWNDC, not released"));
780 }
781 }
782
783 if(isOwnDC) {
784 rc = TRUE;
785 }
786 else {
787 rc = O32_ReleaseDC (0, hdc);
788 }
789
790 dprintf(("ReleaseDC %x %x", hwnd, hdc));
791 return (rc);
792}
793//******************************************************************************
794// This implementation of GetDCEx supports
795// DCX_WINDOW
796// DCX_CACHE
797// DCX_EXCLUDERGN (complex regions allowed)
798// DCX_INTERSECTRGN (complex regions allowed)
799// DCX_USESTYLE
800// DCX_CLIPSIBLINGS
801// DCX_CLIPCHILDREN
802// DCX_PARENTCLIP
803//
804//TODO: WM_SETREDRAW affects drawingAllowed flag!!
805//******************************************************************************
806HDC WIN32API GetDCEx (HWND hwnd, HRGN hrgn, ULONG flags)
807{
808 Win32BaseWindow *wnd = NULL;
809 HWND hWindow;
810 BOOL success;
811 pDCData pHps = NULL;
812 HPS hps = NULLHANDLE;
813 BOOL drawingAllowed = TRUE;
814 BOOL isWindowOwnDC;
815 BOOL creatingOwnDC = FALSE;
816 PS_Type psType;
817
818 if(hwnd == 0) {
819 dprintf(("error: GetDCEx window %x not found", hwnd));
820 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
821 return 0;
822 }
823
824 if (hwnd)
825 {
826 wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
827 if(wnd == NULL) {
828 dprintf (("ERROR: User32: GetDCEx bad window handle %X!!!!!", hwnd));
829 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
830 return 0;
831 }
832 hWindow = wnd->getOS2WindowHandle();
833 }
834
835 isWindowOwnDC = (((hWindow == HWND_DESKTOP) ? FALSE : (wnd->isOwnDC()))
836 && !(flags & (DCX_CACHE_W|DCX_WINDOW_W)));
837
838 if(isWindowOwnDC) //own dc always for client area
839 {
840 hps = wnd->getOwnDC();
841 if (hps)
842 {
843 pDCData pHps = (pDCData)GpiQueryDCData (hps);
844 if (!pHps)
845 goto error;
846
847 selectClientArea(wnd, pHps);
848
849 //TODO: Is this always necessary??
850 setPageXForm (wnd, pHps);
851 pHps->hdcType = TYPE_1;
852
853 //TODO: intersect/exclude clip region?
854 dprintf (("User32: GetDCEx hwnd %x (%x %x) -> wnd %x hdc %x", hwnd, hrgn, flags, wnd, hps));
855 return (HDC)hps;
856 }
857 else
858 creatingOwnDC = TRUE;
859 }
860
861 if(isWindowOwnDC)
862 {
863 SIZEL sizel = {0,0};
864 hps = GpiCreatePS (WinQueryAnchorBlock (hWindow),
865 WinOpenWindowDC (hWindow),
866 &sizel, PU_PELS | GPIT_MICRO | GPIA_ASSOC );
867 psType = MICRO;
868 }
869 else
870 {
871 if (hWindow == HWND_DESKTOP) {
872 hps = WinGetScreenPS (hWindow);
873 }
874 else {
875 int clipstyle = 0;
876 int clipwnd = HWND_TOP;
877 if(flags & (DCX_USESTYLE_W)) {
878 int style = wnd->getStyle();
879 if(style & WS_CLIPCHILDREN_W) {
880 clipstyle |= PSF_CLIPCHILDREN;
881 }
882 if(style & WS_CLIPSIBLINGS_W) {
883 clipstyle |= PSF_CLIPSIBLINGS;
884 }
885 if(wnd->fHasParentDC()) {
886 clipstyle |= PSF_PARENTCLIP;
887 }
888 }
889 if(flags & DCX_CLIPSIBLINGS_W) {
890 clipstyle |= PSF_CLIPSIBLINGS;
891 }
892 if(flags & DCX_CLIPCHILDREN_W) {
893 clipstyle |= PSF_CLIPCHILDREN;
894 }
895 if(flags & DCX_PARENTCLIP_W) {
896 clipstyle |= PSF_PARENTCLIP;
897 }
898 if(clipstyle) {
899 dprintf2(("WinGetClipPS style %x", clipstyle));
900 hps = WinGetClipPS(hWindow, clipwnd, clipstyle);
901 }
902 else hps = WinGetPS (hWindow);
903 }
904 psType = MICRO_CACHED;
905 }
906
907 if (!hps)
908 goto error;
909
910 HPSToHDC (hWindow, hps, NULL, NULL);
911 pHps = (pDCData)GpiQueryDCData (hps);
912
913 if(!(flags & DCX_WINDOW_W))
914 {
915 selectClientArea(wnd, pHps);
916 }
917 else removeClientArea(wnd, pHps);
918
919 setMapMode(wnd, pHps, MM_TEXT_W);
920
921 if ((flags & DCX_EXCLUDERGN_W) || (flags & DCX_INTERSECTRGN_W))
922 {
923 ULONG BytesNeeded;
924 PRGNDATA RgnData;
925 PRECT pr;
926 int i;
927 RECTL rectl;
928
929 if (!hrgn)
930 goto error;
931
932 success = TRUE;
933 if (flags & DCX_EXCLUDERGN_W)
934 {
935#if 0 //CB: todo
936 long height;
937
938 BytesNeeded = GetRegionData (hrgn, 0, NULL);
939 RgnData = (PRGNDATA_W)_alloca (BytesNeeded);
940 if (RgnData == NULL)
941 goto error;
942 GetRegionData (hrgn, BytesNeeded, RgnData);
943
944 i = RgnData->rdh.nCount;
945 pr = (PRECT)(RgnData->Buffer);
946
947 if (flags & DCX_WINDOW_W)
948 height = wnd->getWindowHeight();
949 else height = wnd->getClientHeight();
950
951 for (; (i > 0) && success; i--, pr++) {
952 LONG y = pr->yBottom;
953
954 pr->yBottom = height - pr->yTop;
955 pr->yTop = height - y;
956 success &= GpiExcludeClipRectangle (pHps->hps, pr);
957 }
958#endif
959 }
960 else //DCX_INTERSECTRGN_W
961 {
962 //SvL: I'm getting paint problems when clipping a dc created in GetDCEx
963 // with a region that covers the entire window (RealPlayer 7 Update 1)
964 // Using SelectClipRgn here doesn't make any difference.
965 if(ExtSelectClipRgn(pHps->hps, hrgn, RGN_AND_W) == ERROR_W) {
966 dprintf(("ExtSelectClipRgn failed!!"));
967 }
968 }
969 if (!success)
970 goto error;
971 }
972
973 if (creatingOwnDC)
974 wnd->setOwnDC ((HDC)hps);
975
976 pHps->psType = psType;
977 pHps->hdcType = TYPE_1;
978 //TODO: WM_SETREDRAW affects drawingAllowed flag!!
979 GpiSetDrawControl (hps, DCTL_DISPLAY, drawingAllowed ? DCTL_ON : DCTL_OFF);
980
981 dprintf (("User32: GetDCEx hwnd %x (%x %x) -> hdc %x", hwnd, hrgn, flags, pHps->hps));
982 return (HDC)pHps->hps;
983
984error:
985 /* Something went wrong; clean up
986 */
987 dprintf(("ERROR: GetDCEx hwnd %x (%x %x) FAILED!", hwnd, hrgn, flags));
988 DebugInt3();
989 if (pHps)
990 {
991 if (pHps->hps)
992 {
993 if(pHps->psType == MICRO_CACHED)
994 WinReleasePS(pHps->hps);
995 else
996 GpiDestroyPS(pHps->hps);
997 }
998
999 if (pHps->hdc) DevCloseDC(pHps->hdc);
1000 if (pHps->hrgnHDC) GpiDestroyRegion(pHps->hps, pHps->hrgnHDC);
1001
1002 O32_DeleteObject (pHps->nullBitmapHandle);
1003 }
1004 SetLastError(ERROR_INVALID_PARAMETER_W);
1005 return NULL;
1006}
1007//******************************************************************************
1008//******************************************************************************
1009HDC WIN32API GetDC (HWND hwnd)
1010{
1011 if(!hwnd)
1012 return GetDCEx( GetDesktopWindow(), 0, DCX_CACHE_W | DCX_WINDOW_W );
1013 return GetDCEx (hwnd, NULL, 0);
1014}
1015//******************************************************************************
1016//******************************************************************************
1017HDC WIN32API GetWindowDC (HWND hwnd)
1018{
1019 if (!hwnd) hwnd = GetDesktopWindow();
1020 return GetDCEx (hwnd, NULL, DCX_WINDOW_W);
1021}
1022//******************************************************************************
1023//Helper for RedrawWindow (RDW_ALLCHILDREN_W)
1024//******************************************************************************
1025LRESULT WIN32API RedrawChildEnumProc(HWND hwnd, LPARAM lParam)
1026{
1027 RedrawWindow(hwnd, NULL, 0, lParam);
1028 return TRUE;
1029}
1030//******************************************************************************
1031// This implementation of RedrawWindow supports
1032// RDW_ERASE
1033// RDW_NOERASE
1034// RDW_INTERNALPAINT
1035// RDW_NOINTERNALPAINT
1036// RDW_INVALIDATE
1037// RDW_VALIDATE
1038// RDW_ERASENOW
1039// RDW_UPDATENOW
1040// RDW_FRAME
1041//
1042//TODO: Works ok for RDW_FRAME??
1043//******************************************************************************
1044BOOL WIN32API RedrawWindow(HWND hwnd, const RECT* pRect, HRGN hrgn, DWORD redraw)
1045{
1046 Win32BaseWindow *wnd;
1047
1048 if(pRect) {
1049 dprintf(("RedrawWindow %x (%d,%d)(%d,%d) %x %x", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom, hrgn, redraw));
1050 }
1051 else dprintf(("RedrawWindow %x %x %x %x", hwnd, pRect, hrgn, redraw));
1052
1053 if (hwnd == NULLHANDLE)
1054 {
1055#if 1
1056 // Don't do this for now (causes lots of desktop repaints in WordPad)
1057 SetLastError(ERROR_INVALID_PARAMETER_W);
1058 return FALSE;
1059#else
1060 hwnd = HWND_DESKTOP;
1061 wnd = Win32BaseWindow::GetWindowFromOS2Handle(OSLIB_HWND_DESKTOP);
1062
1063 if (!wnd)
1064 {
1065 dprintf(("USER32:dc: RedrawWindow can't find desktop window %08xh\n",
1066 hwnd));
1067 SetLastError(ERROR_INVALID_PARAMETER_W);
1068 return FALSE;
1069 }
1070#endif
1071 }
1072 else
1073 {
1074 wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
1075
1076 if (!wnd)
1077 {
1078 dprintf(("USER32:dc: RedrawWindow can't find window %08xh\n",
1079 hwnd));
1080 SetLastError(ERROR_INVALID_PARAMETER_W);
1081 return FALSE;
1082 }
1083 hwnd = wnd->getOS2WindowHandle();
1084 }
1085
1086 BOOL IncludeChildren = (redraw & RDW_ALLCHILDREN_W) ? TRUE : FALSE;
1087 BOOL success = TRUE;
1088 HPS hpsTemp = NULLHANDLE;
1089 HRGN hrgnTemp = NULLHANDLE;
1090 RECTL rectl;
1091
1092 if (hrgn)
1093 {
1094 ULONG BytesNeeded;
1095 PRGNDATA RgnData;
1096 PRECTL pr;
1097 int i;
1098 LONG height;
1099
1100 if(wnd) {
1101 height = (redraw & RDW_FRAME_W) ? wnd->getWindowHeight() : wnd->getClientHeight();
1102 }
1103 else height = OSLibQueryScreenHeight();
1104
1105 if (!hrgn)
1106 goto error;
1107
1108 BytesNeeded = GetRegionData (hrgn, 0, NULL);
1109 RgnData = (PRGNDATA)_alloca (BytesNeeded);
1110 if (RgnData == NULL)
1111 goto error;
1112 GetRegionData (hrgn, BytesNeeded, RgnData);
1113
1114 pr = (PRECTL)(RgnData->Buffer);
1115 for (i = RgnData->rdh.nCount; i > 0; i--, pr++) {
1116 LONG temp = pr->yTop;
1117 pr->yTop = height - pr->yBottom;
1118 pr->yBottom = height - temp;
1119 }
1120
1121 hpsTemp = WinGetScreenPS (HWND_DESKTOP);
1122 hrgnTemp = GpiCreateRegion (hpsTemp, RgnData->rdh.nCount, (PRECTL)(RgnData->Buffer));
1123 if (!hrgnTemp) goto error;
1124 }
1125 else if (pRect)
1126 {
1127 if(wnd) {
1128 if(redraw & RDW_FRAME_W) {
1129 mapWin32ToOS2Rect(wnd->getWindowHeight(), (PRECT)pRect, (PRECTLOS2)&rectl);
1130 }
1131 else mapWin32ToOS2RectClientToFrame(wnd, (PRECT)pRect, (PRECTLOS2)&rectl);
1132 }
1133 else mapWin32ToOS2Rect(OSLibQueryScreenHeight(), (PRECT)pRect, (PRECTLOS2)&rectl);
1134 }
1135
1136 if (redraw & RDW_INVALIDATE_W)
1137 {
1138 //TODO: SvL: pingpong.exe doesn't have RDW_NOERASE, but doesn't want WM_ERASEBKGND msgs
1139 if (redraw & RDW_ERASE_W) {
1140 wnd->setEraseBkgnd(TRUE);
1141 }
1142 else
1143 if (redraw & RDW_NOERASE_W)
1144 wnd->setEraseBkgnd(FALSE);
1145
1146 if (!pRect && !hrgn)
1147 success = WinInvalidateRect (hwnd, NULL, IncludeChildren);
1148 else
1149 if (hrgn) {
1150 success = WinInvalidateRegion (hwnd, hrgnTemp, IncludeChildren);
1151 if(IncludeChildren && WinQueryUpdateRect(hwnd, NULL) == FALSE) {
1152 dprintf(("WARNING: WinQueryUpdateRect %x region %x returned false even though we just invalidated part of a window!!!", hwnd, hrgnTemp));
1153 success = success = WinInvalidateRegion (hwnd, hrgnTemp, FALSE);
1154 }
1155 }
1156 else {
1157 success = WinInvalidateRect (hwnd, &rectl, IncludeChildren);
1158//SvL: If all children are included, then WinInvalidateRect is called
1159// with fIncludeChildren=1 -> rect of hwnd isn't invalidated if child(ren)
1160// overlap(s) the specified rectangle completely (EVEN if window doesn't
1161// have WS_CLIPCHILREN!)
1162// -> example: XWing vs Tie Fighter install window
1163// WinInvalidateRect with fIncludeChildren=0 invalidates both the parent
1164// and child windows
1165//SvL: Can't always set fIncludeChildren to FALSE or else some controls in
1166// the RealPlayer setup application aren't redrawn when invalidating
1167// their parent
1168// SO: Check if IncludeChildren is set and part of the window is invalid
1169// If not -> call WinInvalidateRect with IncludeChildren=0 to force
1170// the window rectangle to be invalidated
1171//
1172 if(IncludeChildren && WinQueryUpdateRect(hwnd, NULL) == FALSE) {
1173 dprintf(("WARNING: WinQueryUpdateRect %x (%d,%d)(%d,%d) returned false even though we just invalidated part of a window!!!", hwnd, rectl.xLeft, rectl.yBottom, rectl.xRight, rectl.yTop));
1174 success = WinInvalidateRect (hwnd, &rectl, FALSE);
1175 }
1176 }
1177
1178 if (!success) goto error;
1179 }
1180 else if (redraw & RDW_VALIDATE_W)
1181 {
1182 if (redraw & RDW_NOERASE_W)
1183 wnd->setEraseBkgnd(FALSE);
1184
1185 if (WinQueryUpdateRect (hwnd, NULL))
1186 {
1187 if(!pRect && !hrgn) {
1188 success = WinValidateRect (hwnd, NULL, IncludeChildren);
1189 }
1190 else
1191 if(hrgn) {
1192 success = WinValidateRegion (hwnd, hrgnTemp, IncludeChildren);
1193 }
1194 else {
1195 success = WinValidateRect (hwnd, &rectl, IncludeChildren);
1196 }
1197 if(!success) goto error;
1198 }
1199 }
1200
1201 if(WinQueryUpdateRect(hwnd, NULL))
1202 {
1203 //TODO: Does this work if RDW_ALLCHILDREN is set??
1204 if(redraw & RDW_UPDATENOW_W) {
1205 wnd->MsgNCPaint();
1206 wnd->MsgPaint(0, FALSE);
1207 }
1208 else
1209// if((redraw & RDW_ERASE_W) && (redraw & RDW_ERASENOW_W))
1210 if(redraw & RDW_ERASENOW_W && wnd->needsEraseBkgnd())
1211 wnd->setEraseBkgnd(sendEraseBkgnd(wnd) == 0);
1212// if(redraw & RDW_ALLCHILDREN_W) {
1213// EnumChildWindows(wnd->getWindowHandle(), RedrawChildEnumProc, redraw);
1214// }
1215 }
1216 else if((redraw & RDW_INTERNALPAINT_W) && !(redraw & RDW_INVALIDATE_W))
1217 {
1218 if(redraw & RDW_UPDATENOW_W) {
1219 wnd->MsgNCPaint();
1220 wnd->MsgPaint (0, FALSE);
1221 }
1222 else PostMessageA(hwnd, WINWM_PAINT, 0, 0);
1223 }
1224
1225error:
1226 /* clean up */
1227 if (hrgnTemp)
1228 GpiDestroyRegion (hpsTemp, hrgnTemp);
1229
1230 if (hpsTemp)
1231 WinReleasePS (hpsTemp);
1232
1233 if (!success) {
1234 dprintf(("RedrawWindow failure!"));
1235 SetLastError(ERROR_INVALID_PARAMETER_W);
1236 }
1237 return (success);
1238}
1239//******************************************************************************
1240//******************************************************************************
1241BOOL WIN32API UpdateWindow (HWND hwnd)
1242{
1243 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
1244
1245 if(!wnd) {
1246 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);
1247 return FALSE;
1248 }
1249
1250 dprintf (("User32: UpdateWindow hwnd %x", hwnd));
1251//SvL: This doesn't work right (Wine uses RDW_NOCHILDREN_W -> doesn't work here)
1252// Breaks vpbuddy
1253// return RedrawWindow(hwnd, NULL, 0, RDW_UPDATENOW_W | RDW_ALLCHILDREN_W);
1254// -> RDW_UPDATENOW causes WM_PAINT messages to be directy posted to window
1255// handler; possibly bypassing queued WM_PAINT messages for parent window(s)
1256// -> out of sync painting (i.e. parent paints over child)
1257 WinUpdateWindow(wnd->getOS2WindowHandle());
1258 return TRUE;
1259}
1260//******************************************************************************
1261//******************************************************************************
1262BOOL WIN32API ValidateRect( HWND hwnd, const RECT * lprc)
1263{
1264 if(lprc) {
1265 dprintf(("USER32: ValidateRect %x (%d,%d)(%d,%d)", hwnd, lprc->left, lprc->top, lprc->right, lprc->bottom));
1266 }
1267 else dprintf(("USER32: ValidateRect %x", hwnd));
1268
1269 return RedrawWindow( hwnd, lprc, 0, RDW_VALIDATE_W | RDW_NOCHILDREN_W | (hwnd==0 ? RDW_UPDATENOW_W : 0));
1270}
1271//******************************************************************************
1272//******************************************************************************
1273BOOL WIN32API ValidateRgn( HWND hwnd, HRGN hrgn)
1274{
1275 dprintf(("USER32: ValidateRgn %x %x", hwnd, hrgn));
1276 return RedrawWindow( hwnd, NULL, hrgn, RDW_VALIDATE_W | RDW_NOCHILDREN_W | (hwnd==0 ? RDW_UPDATENOW_W : 0));
1277}
1278//******************************************************************************
1279//******************************************************************************
1280BOOL WIN32API InvalidateRect (HWND hwnd, const RECT *pRect, BOOL erase)
1281{
1282 BOOL result;
1283
1284 if(pRect) {
1285 dprintf(("InvalidateRect %x (%d,%d)(%d,%d) erase=%d", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom, erase));
1286 }
1287 else dprintf(("InvalidateRect %x NULL erase=%d", hwnd, erase));
1288 result = RedrawWindow (hwnd, pRect, NULLHANDLE,
1289 RDW_ALLCHILDREN_W | RDW_INVALIDATE_W |
1290 (erase ? RDW_ERASE_W : RDW_NOERASE_W) |
1291 (hwnd == NULLHANDLE ? RDW_UPDATENOW_W : 0));
1292 return (result);
1293}
1294//******************************************************************************
1295//******************************************************************************
1296BOOL WIN32API InvalidateRgn (HWND hwnd, HRGN hrgn, BOOL erase)
1297{
1298 BOOL result;
1299
1300 dprintf(("InvalidateRgn %x %x erase=%d", hwnd, hrgn, erase));
1301 result = RedrawWindow (hwnd, NULL, hrgn,
1302 RDW_ALLCHILDREN_W | RDW_INVALIDATE_W |
1303 (erase ? RDW_ERASE_W : RDW_NOERASE_W) |
1304 (hwnd == NULLHANDLE ? RDW_UPDATENOW_W : 0));
1305 return (result);
1306}
1307//******************************************************************************
1308//TODO: Change for client rectangle!!!!!
1309//******************************************************************************
1310BOOL setPMRgnIntoWinRgn (HRGN hrgnPM, HRGN hrgnWin, LONG height)
1311{
1312 BOOL rc;
1313 HPS hps = WinGetScreenPS (HWND_DESKTOP);
1314 RGNRECT rgnRect;
1315 rgnRect.ircStart = 1;
1316 rgnRect.crc = 0;
1317 rgnRect.ulDirection = RECTDIR_LFRT_TOPBOT; // doesn't make a difference because we're getting them all
1318
1319 rc = GpiQueryRegionRects (hps, hrgnPM, NULL, &rgnRect, NULL);
1320
1321 if (rc && (rgnRect.crcReturned > 0))
1322 {
1323 PRECTL Rcls = new RECTL[rgnRect.crcReturned];
1324 PRECTL pRcl = Rcls;
1325
1326 if (Rcls != NULL)
1327 {
1328 rgnRect.crc = rgnRect.crcReturned;
1329 rc = GpiQueryRegionRects (hps, hrgnPM, NULL, &rgnRect, Rcls);
1330
1331 rc = SetRectRgn(hrgnWin, pRcl->xLeft,
1332 pRcl->xRight,
1333 height - pRcl->yTop,
1334 height - pRcl->yBottom);
1335
1336 if (rgnRect.crcReturned > 1)
1337 {
1338 int i;
1339 HRGN temp;
1340 temp = CreateRectRgn (0, 0, 1, 1);
1341
1342 for (i = 1, pRcl++; rc && (i < rgnRect.crcReturned); i++, pRcl++)
1343 {
1344 rc = SetRectRgn (temp, pRcl->xLeft,
1345 pRcl->xRight,
1346 height - pRcl->yTop,
1347 height - pRcl->yBottom);
1348 rc &= CombineRgn (hrgnWin, hrgnWin, temp, RGN_OR_W);
1349 }
1350 DeleteObject (temp);
1351 }
1352 delete[] Rcls;
1353 }
1354 else
1355 {
1356 rc = FALSE;
1357 }
1358 }
1359 else
1360 {
1361 rc = SetRectRgn (hrgnWin, 0, 0, 0, 0);
1362 }
1363
1364 WinReleasePS (hps);
1365 return (rc);
1366}
1367//******************************************************************************
1368//TODO: Check if this one works correctly...
1369//Have to check if dc is for frame or client!!
1370//******************************************************************************
1371BOOL WIN32API ScrollDC(HDC hDC, int dx, int dy, const RECT *pScroll,
1372 const RECT *pClip, HRGN hrgnUpdate, LPRECT pRectUpdate)
1373{
1374 BOOL rc = TRUE;
1375
1376 dprintf (("USER32: ScrollDC %x (%d,%d), %x %x %x %x", hDC, dx, dy, pScroll, pClip, hrgnUpdate, pRectUpdate));
1377
1378 if (!hDC)
1379 {
1380 return (FALSE);
1381 }
1382
1383 pDCData pHps = (pDCData)GpiQueryDCData ((HPS)hDC);
1384 HWND hwnd = pHps->hwnd;
1385 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
1386
1387 if ((hwnd == NULLHANDLE) || !wnd)
1388 {
1389 return (FALSE);
1390 }
1391
1392 POINTL ptl[2] = { 0, 0, dx, dy };
1393
1394 GpiConvert (pHps->hps, CVTC_WORLD, CVTC_DEVICE, 2, ptl);
1395 dx = (int)(ptl[1].x - ptl[0].x);
1396 dy = (int)(ptl[1].y - ptl[0].y);
1397
1398 RECT scrollRect;
1399 RECT clipRect;
1400
1401 if (pClip)
1402 {
1403 memcpy(&clipRect, pClip, sizeof(clipRect));
1404
1405 if ((pHps->graphicsMode == GM_COMPATIBLE_W) &&
1406 (clipRect.left != clipRect.right) &&
1407 (clipRect.bottom != clipRect.top))
1408 {
1409 if (abs((int)pHps->viewportXExt) <= abs((int)pHps->windowExt.cx))
1410 clipRect.right -= abs(pHps->worldXDeltaFor1Pixel);
1411 else
1412 clipRect.left += abs(pHps->worldXDeltaFor1Pixel);
1413
1414 if (abs((int)pHps->viewportYExt) <= abs((int)pHps->windowExt.cy))
1415 clipRect.bottom -= abs(pHps->worldYDeltaFor1Pixel);
1416 else
1417 clipRect.top += abs(pHps->worldYDeltaFor1Pixel);
1418 }
1419 GpiConvert(pHps->hps, CVTC_WORLD, CVTC_DEVICE, 2, (PPOINTL)&clipRect);
1420 if (clipRect.right < clipRect.left) {
1421 ULONG temp = clipRect.left;
1422 clipRect.left = clipRect.right;
1423 clipRect.right = temp;
1424 }
1425 if (clipRect.bottom < clipRect.top) {
1426 ULONG temp = clipRect.top;
1427 clipRect.top = clipRect.bottom;
1428 clipRect.bottom = temp;
1429 }
1430 }
1431
1432 if (pScroll)
1433 {
1434 memcpy(&scrollRect, pScroll, sizeof(scrollRect));
1435
1436 if ((pHps->graphicsMode == GM_COMPATIBLE_W) &&
1437 (scrollRect.left != scrollRect.right) &&
1438 (scrollRect.top != scrollRect.bottom))
1439 {
1440 if (abs((int)pHps->viewportXExt) <= abs((int)pHps->windowExt.cx))
1441 scrollRect.right -= abs(pHps->worldXDeltaFor1Pixel);
1442 else
1443 scrollRect.left += abs(pHps->worldXDeltaFor1Pixel);
1444
1445 if (abs((int)pHps->viewportYExt) <= abs((int)pHps->windowExt.cy))
1446 scrollRect.bottom -= abs(pHps->worldYDeltaFor1Pixel);
1447 else
1448 scrollRect.top += abs(pHps->worldYDeltaFor1Pixel);
1449 }
1450 GpiConvert (pHps->hps, CVTC_WORLD, CVTC_DEVICE, 2, (PPOINTL)&scrollRect);
1451 if (scrollRect.right < scrollRect.left) {
1452 ULONG temp = scrollRect.left;
1453 scrollRect.left = scrollRect.right;
1454 scrollRect.right = temp;
1455 }
1456 if (scrollRect.bottom < scrollRect.top) {
1457 ULONG temp = scrollRect.top;
1458 scrollRect.top = scrollRect.bottom;
1459 scrollRect.bottom = temp;
1460 }
1461 }
1462 RECTL rectlUpdate;
1463 HRGN hrgn;
1464 RECTL clientRect;
1465 RECTL clipOS2;
1466 RECTL scrollOS2;
1467 PRECTL pScrollOS2 = NULL;
1468 PRECTL pClipOS2 = NULL;
1469
1470 mapWin32ToOS2Rect(wnd->getWindowHeight(), wnd->getClientRectPtr(), (PRECTLOS2)&clientRect);
1471
1472 if(pScroll) {
1473 mapWin32ToOS2RectClientToFrame(wnd, &scrollRect, (PRECTLOS2)&scrollOS2);
1474 pScrollOS2 = &scrollOS2;
1475
1476 //Scroll rectangle relative to client area
1477 WinIntersectRect ((HAB) 0, pScrollOS2, pScrollOS2, &clientRect);
1478 }
1479 else {
1480 pScrollOS2 = &clientRect;
1481 }
1482
1483 if(pClip) {
1484 mapWin32ToOS2RectClientToFrame(wnd, &clipRect, (PRECTLOS2)&clipOS2);
1485 pClipOS2 = &clipOS2;
1486
1487 //Clip rectangle relative to client area
1488 WinIntersectRect((HAB) 0, pClipOS2, pClipOS2, &clientRect);
1489 }
1490 else {
1491 pClipOS2 = &clientRect;
1492 }
1493
1494 LONG lComplexity = WinScrollWindow(hwnd, dx, dy, pScrollOS2,
1495 pClipOS2, hrgn, &rectlUpdate, 0);
1496 if (lComplexity == RGN_ERROR)
1497 {
1498 return (FALSE);
1499 }
1500
1501 RECT winRectUpdate;
1502
1503 mapOS2ToWin32Rect(wnd->getWindowHeight(), (PRECTLOS2)&rectlUpdate, &winRectUpdate);
1504
1505 if (pRectUpdate)
1506 *pRectUpdate = winRectUpdate;
1507
1508 if (hrgnUpdate)
1509 rc = setPMRgnIntoWinRgn(hrgn, hrgnUpdate, wnd->getWindowHeight());
1510
1511 return (rc);
1512}
1513//******************************************************************************
1514//******************************************************************************
1515BOOL WIN32API ScrollWindow(HWND hwnd, int dx, int dy, const RECT *pScroll, const RECT *pClip)
1516{
1517 Win32BaseWindow *window;
1518 APIRET rc;
1519 RECTL clientRect;
1520 RECTL scrollRect;
1521 RECTL clipRect;
1522 PRECTL pScrollOS2 = NULL;
1523 PRECTL pClipOS2 = NULL;
1524 ULONG scrollFlags = SW_INVALIDATERGN;
1525
1526 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1527 if(!window) {
1528 dprintf(("ScrollWindow, window %x not found", hwnd));
1529 return 0;
1530 }
1531 dprintf(("ScrollWindow %x %d %d %x %x", hwnd, dx, dy, pScroll, pClip));
1532
1533 mapWin32ToOS2Rect(window->getWindowHeight(), window->getClientRectPtr(), (PRECTLOS2)&clientRect);
1534
1535 if(pScroll) {
1536 mapWin32ToOS2RectClientToFrame(window,(RECT *)pScroll, (PRECTLOS2)&scrollRect);
1537 pScrollOS2 = &scrollRect;
1538
1539 //Scroll rectangle relative to client area
1540 WinIntersectRect ((HAB) 0, pScrollOS2, pScrollOS2, &clientRect);
1541 }
1542 else {
1543 pScrollOS2 = &clientRect;
1544 scrollFlags |= SW_SCROLLCHILDREN;
1545 }
1546
1547 if(pClip) {
1548 mapWin32ToOS2RectClientToFrame(window,(RECT *)pClip, (PRECTLOS2)&clipRect);
1549 pClipOS2 = &clipRect;
1550
1551 //Clip rectangle relative to client area
1552 WinIntersectRect ((HAB) 0, pClipOS2, pClipOS2, &clientRect);
1553 }
1554 else {
1555 pClipOS2 = &clientRect;
1556 }
1557
1558 dy = revertDy (window, dy);
1559
1560 rc = WinScrollWindow(window->getOS2WindowHandle(), dx, dy,
1561 pScrollOS2, pClipOS2, NULLHANDLE,
1562 NULL, scrollFlags);
1563
1564 return (rc != RGN_ERROR);
1565}
1566//******************************************************************************
1567//******************************************************************************
1568INT WIN32API ScrollWindowEx(HWND hwnd, int dx, int dy, const RECT *pScroll, const RECT *pClip,
1569 HRGN hrgnUpdate, PRECT pRectUpdate, UINT scrollFlag)
1570{
1571 Win32BaseWindow *window;
1572 APIRET rc;
1573 RECTL clientRect;
1574 RECTL scrollRect;
1575 RECTL clipRect;
1576 PRECTL pScrollOS2 = NULL;
1577 PRECTL pClipOS2 = NULL;
1578 ULONG scrollFlags = 0;
1579 int regionType = ERROR_W;
1580
1581 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1582 if(!window) {
1583 dprintf(("ScrollWindowEx, window %x not found", hwnd));
1584 return 0;
1585 }
1586
1587 dprintf(("ScrollWindowEx %x %d %d %x %x", hwnd, dx, dy, pScroll, pClip));
1588
1589 dy = revertDy (window, dy);
1590
1591 if (scrollFlag & SW_INVALIDATE_W) scrollFlags |= SW_INVALIDATERGN;
1592 if (scrollFlag & SW_SCROLLCHILDREN_W) scrollFlags |= SW_SCROLLCHILDREN;
1593
1594 mapWin32ToOS2Rect(window->getWindowHeight(), window->getClientRectPtr(), (PRECTLOS2)&clientRect);
1595
1596 if(pScroll) {
1597 mapWin32ToOS2RectClientToFrame(window,(RECT *)pScroll, (PRECTLOS2)&scrollRect);
1598 pScrollOS2 = &scrollRect;
1599
1600 //Scroll rectangle relative to client area
1601 WinIntersectRect ((HAB) 0, pScrollOS2, pScrollOS2, &clientRect);
1602 }
1603 else {
1604 pScrollOS2 = &clientRect;
1605 scrollFlags |= SW_SCROLLCHILDREN; //TODO: ?????
1606 }
1607
1608 if(pClip) {
1609 mapWin32ToOS2RectClientToFrame(window,(RECT *)pClip, (PRECTLOS2)&clipRect);
1610 pClipOS2 = &clipRect;
1611
1612 //Clip rectangle relative to client area
1613 WinIntersectRect ((HAB) 0, pClipOS2, pClipOS2, &clientRect);
1614 }
1615 else {
1616 pClipOS2 = &clientRect;
1617 }
1618
1619 RECTL rectlUpdate;
1620 HRGN hrgn;
1621
1622 if (scrollFlag & SW_SMOOTHSCROLL_W)
1623 {
1624 INT time = (scrollFlag >> 16) & 0xFFFF;
1625
1626 //CB: todo, scroll in several steps
1627 // is time in ms? time <-> iteration count?
1628 }
1629
1630 LONG lComplexity = WinScrollWindow (window->getOS2WindowHandle(), dx, dy,
1631 pScrollOS2,
1632 pClipOS2,
1633 hrgn, &rectlUpdate, scrollFlags);
1634 if (lComplexity == RGN_ERROR)
1635 {
1636 return ERROR_W;
1637 }
1638
1639 RECT winRectUpdate;
1640
1641 mapOS2ToWin32Rect(window->getWindowHeight(), (PRECTLOS2)&rectlUpdate, &winRectUpdate);
1642
1643 if (pRectUpdate)
1644 *pRectUpdate = winRectUpdate;
1645
1646 if (hrgnUpdate)
1647 rc = setPMRgnIntoWinRgn (hrgn, hrgnUpdate, window->getWindowHeight());
1648
1649#if 0
1650 //SvL: WinScrollWindow already invalidates the area; no need to do it again
1651 //(call to invalidateRect was wrong; has to include erase flag)
1652 if ((scrollFlag & SW_INVALIDATE_W) &&
1653 ((lComplexity == RGN_RECT) || (lComplexity == RGN_COMPLEX)))
1654 {
1655 rc = InvalidateRect (hwnd, &winRectUpdate, (scrollFlag & SW_ERASE_W) ? 1 : 0);
1656 if (rc == FALSE)
1657 {
1658 return (0);
1659 }
1660 }
1661#endif
1662
1663 switch (lComplexity)
1664 {
1665 case RGN_NULL:
1666 regionType = NULLREGION_W;
1667 break;
1668 case RGN_RECT:
1669 regionType = SIMPLEREGION_W;
1670 break;
1671 case RGN_COMPLEX:
1672 regionType = COMPLEXREGION_W;
1673 break;
1674 default:
1675 regionType = ERROR_W;
1676 break;
1677 }
1678
1679 return (regionType);
1680}
1681//******************************************************************************
1682//******************************************************************************
1683HWND WIN32API WindowFromDC(HDC hdc)
1684{
1685 pDCData pHps = (pDCData)GpiQueryDCData( (HPS)hdc );
1686
1687 dprintf2(("USER32: WindowFromDC %x", hdc));
1688 if ( pHps )
1689 return Win32BaseWindow::OS2ToWin32Handle(pHps->hwnd);
1690 else
1691 return 0;
1692}
1693//******************************************************************************
1694//******************************************************************************
1695int WIN32API SetMapMode(HDC hdc, int mode)
1696{
1697 Win32BaseWindow *wnd;
1698 pDCData pHps = (pDCData)GpiQueryDCData((HPS)hdc);
1699 if(!pHps)
1700 {
1701 SetLastError(ERROR_INVALID_HANDLE_W);
1702 dprintf(("GDI32: SetMapMode %x %x -> invalid hdc!!", hdc, mode));
1703 return 0;
1704 }
1705 wnd = Win32BaseWindow::GetWindowFromHandle(WindowFromDC(hdc));
1706 //todo: metafile recording
1707
1708 dprintf(("GDI32: SetMapMode %x %x", hdc, mode));
1709 return setMapMode(wnd, pHps, mode);
1710}
1711//******************************************************************************
1712//******************************************************************************
1713int WIN32API GetMapMode(HDC hdc)
1714{
1715 pDCData pHps = (pDCData)GpiQueryDCData((HPS)hdc);
1716 if(pHps) {
1717 dprintf(("GDI32: GetMapMode %x -> %x", hdc, pHps->MapMode));
1718 return pHps->MapMode;
1719 }
1720 dprintf(("GDI32: GetMapMode: invalid hdc %x!!!", hdc));
1721 SetLastError(ERROR_INVALID_HANDLE_W);
1722 return 0;
1723}
1724//******************************************************************************
1725//******************************************************************************
1726BOOL WIN32API SetViewportExtEx(HDC hdc, int xExt, int yExt, LPSIZE pSize)
1727{
1728 Win32BaseWindow *wnd;
1729 pDCData pHps = (pDCData)GpiQueryDCData((HPS)hdc);
1730
1731 if(!pHps)
1732 {
1733 dprintf(("GDI32: SetViewportExtEx %x %d %d %x -> INVALID HDC", hdc, xExt, yExt, pSize));
1734 SetLastError(ERROR_INVALID_HANDLE_W);
1735 return FALSE;
1736 }
1737
1738 if(pSize) {
1739 dprintf(("GDI32: SetViewportExtEx %x %d %d (%d,%d)", hdc, xExt, yExt, pSize->cx, pSize->cy));
1740 }
1741 else dprintf(("GDI32: SetViewportExtEx %x %d %d NULL", hdc, xExt, yExt));
1742
1743 if (xExt && yExt )
1744 {
1745 //todo: Metafile recording!! (done for any map mode)
1746
1747 if(pHps->MapMode == MM_ISOTROPIC_W || pHps->MapMode == MM_ANISOTROPIC_W)
1748 {
1749 wnd = Win32BaseWindow::GetWindowFromHandle(WindowFromDC(hdc));
1750 if(changePageXForm(wnd, pHps, NULL, xExt, yExt, (PPOINTL) pSize))
1751 {
1752 SetLastError(ERROR_SUCCESS_W);
1753 return TRUE;
1754 }
1755 }
1756 else
1757 {
1758 pHps->lVwpXExtSave = xExt;
1759 pHps->lVwpYExtSave = yExt;
1760
1761 //if map mode is not ISOTROPIC nor ANISOTROPIC, this function does
1762 //nothing and returns TRUE (NT)
1763 SetLastError(ERROR_SUCCESS_W);
1764 return TRUE;
1765 }
1766
1767 SetLastError(ERROR_SUCCESS_W);
1768 return FALSE;
1769 }
1770
1771 SetLastError(ERROR_INVALID_PARAMETER_W);
1772 return FALSE;
1773}
1774//******************************************************************************
1775//******************************************************************************
1776BOOL WIN32API GetViewportExtEx(HDC hdc, LPSIZE pSize)
1777{
1778 pDCData pHps = (pDCData)GpiQueryDCData((HPS)hdc);
1779 if(!pHps)
1780 {
1781 dprintf(("GDI32: GetViewportExtEx %x %x -> INVALID HDC", hdc, pSize));
1782 SetLastError(ERROR_INVALID_HANDLE_W);
1783 return FALSE;
1784 }
1785
1786 if(!pSize)
1787 {
1788 dprintf(("GDI32: GetViewportExtEx %x NULL -> INVALID parameter", hdc));
1789 SetLastError(ERROR_INVALID_PARAMETER_W);
1790 return FALSE;
1791 }
1792
1793 pSize->cx = (LONG)pHps->viewportXExt;
1794 pSize->cy = (LONG)pHps->viewportYExt;
1795 dprintf(("GDI32: GetViewportExtEx %x -> (%d,%d)", hdc, pSize->cx, pSize->cy));
1796
1797 SetLastError(ERROR_SUCCESS_W);
1798 return TRUE;
1799}
1800//******************************************************************************
1801//******************************************************************************
Note: See TracBrowser for help on using the repository browser.