| 1 | /* $Id: oslibgpi.cpp,v 1.11 2001-05-10 17:03:18 sandervl Exp $ */
|
|---|
| 2 |
|
|---|
| 3 | /*
|
|---|
| 4 | * GPI interface code
|
|---|
| 5 | *
|
|---|
| 6 | * Copyright 1999 Christoph Bratschi (cbratschi@datacomm.ch)
|
|---|
| 7 | *
|
|---|
| 8 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 9 | *
|
|---|
| 10 | */
|
|---|
| 11 |
|
|---|
| 12 | #define INCL_GPI
|
|---|
| 13 | #define INCL_WIN
|
|---|
| 14 | #include <os2wrap.h> //Odin32 OS/2 api wrappers
|
|---|
| 15 | #include <stdlib.h>
|
|---|
| 16 | #include <string.h>
|
|---|
| 17 | #include <math.h>
|
|---|
| 18 | #include "win32type.h"
|
|---|
| 19 | #include <winconst.h>
|
|---|
| 20 | #include "oslibgpi.h"
|
|---|
| 21 | #include <dcdata.h>
|
|---|
| 22 | #include <misc.h>
|
|---|
| 23 |
|
|---|
| 24 | #define DBG_LOCALLOG DBG_oslibgpi
|
|---|
| 25 | #include "dbglocal.h"
|
|---|
| 26 |
|
|---|
| 27 | #define GetDCData(a) ((pDCData)a)
|
|---|
| 28 |
|
|---|
| 29 | LONG APIENTRY _GpiQueryTabbedTextExtent(HPS hps,LONG lCount,PCH pchString,LONG lTabCount,PULONG puTabStops);
|
|---|
| 30 |
|
|---|
| 31 | inline LONG GpiQueryTabbedTextExtent(HPS hps,LONG lCount,PCH pchString,LONG lTabCount,PULONG puTabStops)
|
|---|
| 32 | {
|
|---|
| 33 | LONG yyrc;
|
|---|
| 34 | USHORT sel = RestoreOS2FS();
|
|---|
| 35 |
|
|---|
| 36 | yyrc = _GpiQueryTabbedTextExtent(hps,lCount,pchString,lTabCount,puTabStops);
|
|---|
| 37 | SetFS(sel);
|
|---|
| 38 |
|
|---|
| 39 | return yyrc;
|
|---|
| 40 | }
|
|---|
| 41 |
|
|---|
| 42 | LONG APIENTRY _GpiTabbedCharStringAt(HPS hps,PPOINTL pPtStart,PRECTL prclRect,ULONG flOptions,LONG lCount,PCH pchString,LONG lTabCount,PULONG puTabStops,LONG lTabOrigin);
|
|---|
| 43 |
|
|---|
| 44 | inline LONG GpiTabbedCharStringAt(HPS hps,PPOINTL pPtStart,PRECTL prclRect,ULONG flOptions,LONG lCount,PCH pchString,LONG lTabCount,PULONG puTabStops,LONG lTabOrigin)
|
|---|
| 45 | {
|
|---|
| 46 | LONG yyrc;
|
|---|
| 47 | USHORT sel = RestoreOS2FS();
|
|---|
| 48 |
|
|---|
| 49 | yyrc = _GpiTabbedCharStringAt(hps,pPtStart,prclRect,flOptions,lCount,pchString,lTabCount,puTabStops,lTabOrigin);
|
|---|
| 50 | SetFS(sel);
|
|---|
| 51 |
|
|---|
| 52 | return yyrc;
|
|---|
| 53 | }
|
|---|
| 54 |
|
|---|
| 55 | LONG APIENTRY WinDrawTabbedText(HPS hps,LONG cchText,LONG lTabWidth,PCH lpchText,PRECTL prcl,LONG clrFore,LONG clrBack,ULONG flCmd);
|
|---|
| 56 |
|
|---|
| 57 | inline LONG _WinDrawTabbedText(HPS hps,LONG cchText,LONG lTabWidth,PCH lpchText,PRECTL prcl,LONG clrFore,LONG clrBack,ULONG flCmd)
|
|---|
| 58 | {
|
|---|
| 59 | LONG yyrc;
|
|---|
| 60 | USHORT sel = RestoreOS2FS();
|
|---|
| 61 |
|
|---|
| 62 | yyrc = WinDrawTabbedText(hps,cchText,lTabWidth,lpchText,prcl,clrFore,clrBack,flCmd);
|
|---|
| 63 | SetFS(sel);
|
|---|
| 64 |
|
|---|
| 65 | return yyrc;
|
|---|
| 66 | }
|
|---|
| 67 |
|
|---|
| 68 | #undef WinDrawTabbedText
|
|---|
| 69 | #define WinDrawTabbedText _WinDrawTabbedText
|
|---|
| 70 |
|
|---|
| 71 | void inline swap(LONG &a,LONG &b)
|
|---|
| 72 | {
|
|---|
| 73 | LONG temp = a;
|
|---|
| 74 |
|
|---|
| 75 | a = b;
|
|---|
| 76 | b = temp;
|
|---|
| 77 | }
|
|---|
| 78 |
|
|---|
| 79 | void inline swap(int &a,int &b)
|
|---|
| 80 | {
|
|---|
| 81 | int temp = a;
|
|---|
| 82 |
|
|---|
| 83 | a = b;
|
|---|
| 84 | b = temp;
|
|---|
| 85 | }
|
|---|
| 86 |
|
|---|
| 87 | void inline sortAscending(LONG &a,LONG &b)
|
|---|
| 88 | {
|
|---|
| 89 | if (a > b) swap(a,b);
|
|---|
| 90 | }
|
|---|
| 91 |
|
|---|
| 92 | void inline sortAscending(int &a,int &b)
|
|---|
| 93 | {
|
|---|
| 94 | if (a > b) swap(a,b);
|
|---|
| 95 | }
|
|---|
| 96 |
|
|---|
| 97 | void inline sortAscending(POINTLOS2 &a,POINTLOS2 &b)
|
|---|
| 98 | {
|
|---|
| 99 | sortAscending(a.x,b.x);
|
|---|
| 100 | sortAscending(a.y,b.y);
|
|---|
| 101 | }
|
|---|
| 102 |
|
|---|
| 103 | BOOL excludeBottomRightPoint(PVOID pHps,PPOINTLOS2 pptl)
|
|---|
| 104 | {
|
|---|
| 105 | sortAscending(pptl[0],pptl[1]);
|
|---|
| 106 |
|
|---|
| 107 | if (GetDCData(pHps)->graphicsMode != GM_COMPATIBLE_W)
|
|---|
| 108 | {
|
|---|
| 109 | return TRUE;
|
|---|
| 110 | }
|
|---|
| 111 |
|
|---|
| 112 | if (pptl[0].x == pptl[1].x || pptl[0].y == pptl[1].y)
|
|---|
| 113 | {
|
|---|
| 114 | return FALSE;
|
|---|
| 115 | }
|
|---|
| 116 |
|
|---|
| 117 | if (abs((int)GetDCData(pHps)->viewportXExt) <= abs((int)GetDCData(pHps)->windowExt.cx))
|
|---|
| 118 | {
|
|---|
| 119 | if (GetDCData(pHps)->isLeftLeft)
|
|---|
| 120 | pptl[1].x -= abs(GetDCData(pHps)->worldXDeltaFor1Pixel);
|
|---|
| 121 | else
|
|---|
| 122 | pptl[0].x += abs(GetDCData(pHps)->worldXDeltaFor1Pixel);
|
|---|
| 123 | }
|
|---|
| 124 |
|
|---|
| 125 | if (abs((int)GetDCData(pHps)->viewportYExt) <= abs((int)GetDCData(pHps)->windowExt.cy))
|
|---|
| 126 | {
|
|---|
| 127 | if (GetDCData(pHps)->isTopTop)
|
|---|
| 128 | pptl[1].y -= abs(GetDCData(pHps)->worldYDeltaFor1Pixel);
|
|---|
| 129 | else
|
|---|
| 130 | pptl[0].y += abs(GetDCData(pHps)->worldYDeltaFor1Pixel);
|
|---|
| 131 | }
|
|---|
| 132 |
|
|---|
| 133 | sortAscending(pptl[0], pptl[1]);
|
|---|
| 134 |
|
|---|
| 135 | return TRUE;
|
|---|
| 136 | }
|
|---|
| 137 |
|
|---|
| 138 | BOOL includeBottomRightPoint(PVOID pHps,PPOINTLOS2 pptl)
|
|---|
| 139 | {
|
|---|
| 140 | if(GetDCData(pHps)->graphicsMode != GM_COMPATIBLE_W)
|
|---|
| 141 | {
|
|---|
| 142 | return TRUE; // already inclusive/inclusive
|
|---|
| 143 | }
|
|---|
| 144 |
|
|---|
| 145 | if(GetDCData(pHps)->isLeftLeft)
|
|---|
| 146 | {
|
|---|
| 147 | pptl[1].x += abs(GetDCData(pHps)->worldXDeltaFor1Pixel);
|
|---|
| 148 | sortAscending(pptl[0].x, pptl[1].x);
|
|---|
| 149 | }
|
|---|
| 150 | else
|
|---|
| 151 | {
|
|---|
| 152 | pptl[0].x -= abs(GetDCData(pHps)->worldXDeltaFor1Pixel);
|
|---|
| 153 | sortAscending(pptl[1].x, pptl[0].x);
|
|---|
| 154 | }
|
|---|
| 155 |
|
|---|
| 156 | if(GetDCData(pHps)->isTopTop)
|
|---|
| 157 | {
|
|---|
| 158 | pptl[1].y += abs(GetDCData(pHps)->worldYDeltaFor1Pixel);
|
|---|
| 159 | sortAscending(pptl[1].y, pptl[0].y);
|
|---|
| 160 | }
|
|---|
| 161 | else
|
|---|
| 162 | {
|
|---|
| 163 | pptl[0].y -= abs(GetDCData(pHps)->worldYDeltaFor1Pixel);
|
|---|
| 164 | sortAscending(pptl[0].y, pptl[1].y);
|
|---|
| 165 | }
|
|---|
| 166 | return TRUE;
|
|---|
| 167 | }
|
|---|
| 168 |
|
|---|
| 169 | BOOL getAlignUpdateCP(PVOID pHps)
|
|---|
| 170 | {
|
|---|
| 171 | return GetDCData(pHps)->alignUpdateCP;
|
|---|
| 172 | }
|
|---|
| 173 |
|
|---|
| 174 | INT getWorldYDeltaFor1Pixel(PVOID pHps)
|
|---|
| 175 | {
|
|---|
| 176 | return GetDCData(pHps)->worldYDeltaFor1Pixel;
|
|---|
| 177 | }
|
|---|
| 178 |
|
|---|
| 179 | INT getWorldXDeltaFor1Pixel(PVOID pHps)
|
|---|
| 180 | {
|
|---|
| 181 | return GetDCData(pHps)->worldXDeltaFor1Pixel;
|
|---|
| 182 | }
|
|---|
| 183 |
|
|---|
| 184 | BOOL getInPath(PVOID pHps)
|
|---|
| 185 | {
|
|---|
| 186 | return GetDCData(pHps)->inPath;
|
|---|
| 187 | }
|
|---|
| 188 |
|
|---|
| 189 | VOID setInPath(PVOID pHps,BOOL inPath)
|
|---|
| 190 | {
|
|---|
| 191 | GetDCData(pHps)->inPath = inPath;
|
|---|
| 192 | }
|
|---|
| 193 |
|
|---|
| 194 | BOOL getIsWideLine(PVOID pHps)
|
|---|
| 195 | {
|
|---|
| 196 | return GetDCData(pHps)->isWideLine;
|
|---|
| 197 | }
|
|---|
| 198 |
|
|---|
| 199 | BOOL getIsTopTop(PVOID pHps)
|
|---|
| 200 | {
|
|---|
| 201 | return GetDCData(pHps)->isTopTop;
|
|---|
| 202 | }
|
|---|
| 203 |
|
|---|
| 204 | ULONG getMapMode(PVOID pHps)
|
|---|
| 205 | {
|
|---|
| 206 | return GetDCData(pHps)->MapMode;
|
|---|
| 207 | }
|
|---|
| 208 |
|
|---|
| 209 | BOOL OSLibGpiQueryCurrentPosition(PVOID pHps,PPOINTLOS2 ptl)
|
|---|
| 210 | {
|
|---|
| 211 | return GpiQueryCurrentPosition(GetDCData(pHps)->hps,(PPOINTL)ptl);
|
|---|
| 212 | }
|
|---|
| 213 |
|
|---|
| 214 | BOOL OSLibGpiSetCurrentPosition(PVOID pHps,PPOINTLOS2 ptl)
|
|---|
| 215 | {
|
|---|
| 216 | return GpiSetCurrentPosition(GetDCData(pHps)->hps,(PPOINTL)ptl);
|
|---|
| 217 | }
|
|---|
| 218 |
|
|---|
| 219 | BOOL OSLibGpiCharStringPosAt(PVOID pHps,PPOINTLOS2 ptl,PRECTLOS2 rct,ULONG flOptions,LONG lCount,LPCSTR pchString,CONST INT *alAdx)
|
|---|
| 220 | {
|
|---|
| 221 | return GpiCharStringPosAt(GetDCData(pHps)->hps,(PPOINTL)ptl,(PRECTL)rct,flOptions,lCount,(PCH)pchString,(PLONG)alAdx);
|
|---|
| 222 | }
|
|---|
| 223 |
|
|---|
| 224 | BOOL OSLibGpiQueryCharStringPosAt(PVOID pHps,PPOINTLOS2 ptl,ULONG flOptions,LONG lCount,LPCSTR pchString,CONST INT *alAdx,PPOINTLOS2 aptlPos)
|
|---|
| 225 | {
|
|---|
| 226 | return GpiQueryCharStringPosAt(GetDCData(pHps)->hps,(PPOINTL)ptl,flOptions,lCount,(PCH)pchString,(PLONG)alAdx,(PPOINTL)aptlPos);
|
|---|
| 227 | }
|
|---|
| 228 |
|
|---|
| 229 | BOOL OSLibGpiSetTextAlignment(PVOID pHps,LONG lHoriz,LONG lVert)
|
|---|
| 230 | {
|
|---|
| 231 | return GpiSetTextAlignment(GetDCData(pHps)->hps,lHoriz,lVert);
|
|---|
| 232 | }
|
|---|
| 233 |
|
|---|
| 234 | BOOL OSLibGpiQueryTextAlignment(PVOID pHps,PLONG plHoriz,PLONG plVert)
|
|---|
| 235 | {
|
|---|
| 236 | return GpiQueryTextAlignment(GetDCData(pHps)->hps,plHoriz,plVert);
|
|---|
| 237 | }
|
|---|
| 238 |
|
|---|
| 239 | LONG OSLibGpiQueryTabbedTextExtent(pDCData pHps,INT lCount,LPCSTR pchString,INT lTabCount,PINT puTabStops)
|
|---|
| 240 | {
|
|---|
| 241 | return GpiQueryTabbedTextExtent(pHps->hps,lCount,(PCH)pchString,lTabCount,(PULONG)puTabStops);
|
|---|
| 242 | }
|
|---|
| 243 |
|
|---|
| 244 | LONG OSLibGpiTabbedCharStringAt(PVOID pHps,PPOINTLOS2 pPtStart,PRECTLOS2 prclRect,ULONG flOptions,INT lCount,LPCSTR pchString,INT lTabCount,PINT puTabStops,INT lTabOrigin)
|
|---|
| 245 | {
|
|---|
| 246 | return GpiTabbedCharStringAt(GetDCData(pHps)->hps,(PPOINTL)pPtStart,(PRECTL)prclRect,flOptions,lCount,(PCH)pchString,lTabCount,(PULONG)puTabStops,lTabOrigin);
|
|---|
| 247 | }
|
|---|
| 248 |
|
|---|
| 249 | BOOL OSLibGpiQueryTextBox(pDCData pHps,LONG lCount1,LPCSTR pchString,LONG lCount2,PPOINTLOS2 aptlPoints)
|
|---|
| 250 | {
|
|---|
| 251 | return GpiQueryTextBox(pHps->hps,lCount1,(PCH)pchString,lCount2,(PPOINTL)aptlPoints);
|
|---|
| 252 | }
|
|---|
| 253 |
|
|---|
| 254 | VOID calcDimensions(POINTLOS2 box[],PPOINTLOS2 point)
|
|---|
| 255 | {
|
|---|
| 256 | ULONG cx;
|
|---|
| 257 | ULONG cy;
|
|---|
| 258 |
|
|---|
| 259 | if (box[TXTBOX_BOTTOMLEFT].y == box[TXTBOX_BOTTOMRIGHT].y)
|
|---|
| 260 | {
|
|---|
| 261 | point->y = labs (box[TXTBOX_BOTTOMLEFT].y-box[TXTBOX_TOPLEFT].y);
|
|---|
| 262 | point->x = labs (box[TXTBOX_BOTTOMRIGHT].x-box[TXTBOX_BOTTOMLEFT].x);
|
|---|
| 263 |
|
|---|
| 264 | if (box[TXTBOX_BOTTOMLEFT].x != box[TXTBOX_TOPLEFT].x)
|
|---|
| 265 | {
|
|---|
| 266 | if (point->y < 25)
|
|---|
| 267 | cx = 2;
|
|---|
| 268 | else
|
|---|
| 269 | cx = ((point->y*10)+50)/100;
|
|---|
| 270 | point->x += cx;
|
|---|
| 271 | }
|
|---|
| 272 | } else
|
|---|
| 273 | {
|
|---|
| 274 | cx = labs (box[TXTBOX_BOTTOMLEFT].x-box[TXTBOX_TOPLEFT].x);
|
|---|
| 275 | cy = labs (box[TXTBOX_BOTTOMLEFT].y-box[TXTBOX_TOPLEFT].y);
|
|---|
| 276 | point->y = (ULONG)hypot(cx,cy);
|
|---|
| 277 |
|
|---|
| 278 | cx = labs (box[TXTBOX_TOPRIGHT].x-box[TXTBOX_TOPLEFT].x);
|
|---|
| 279 | cy = labs (box[TXTBOX_TOPRIGHT].y-box[TXTBOX_TOPLEFT].y);
|
|---|
| 280 | point->x = (ULONG)hypot(cx,cy);
|
|---|
| 281 | }
|
|---|
| 282 | }
|
|---|
| 283 |
|
|---|
| 284 | LONG OSLibGpiQueryBackMix(PVOID pHps)
|
|---|
| 285 | {
|
|---|
| 286 | return GpiQueryBackMix(GetDCData(pHps)->hps);
|
|---|
| 287 | }
|
|---|
| 288 |
|
|---|
| 289 | BOOL doesYAxisGrowNorth(PVOID pHps)
|
|---|
| 290 | {
|
|---|
| 291 | if ((GetDCData(pHps)->windowExt.cy < 0 && GetDCData(pHps)->viewportYExt > 0.0) ||
|
|---|
| 292 | (GetDCData(pHps)->windowExt.cy > 0 && GetDCData(pHps)->viewportYExt < 0.0))
|
|---|
| 293 | {
|
|---|
| 294 | if (GetDCData(pHps)->graphicsMode == GM_COMPATIBLE_W ||
|
|---|
| 295 | (GetDCData(pHps)->graphicsMode == GM_ADVANCED_W && GetDCData(pHps)->xform.eM22 >= 0.0))
|
|---|
| 296 | return TRUE;
|
|---|
| 297 | } else
|
|---|
| 298 | {
|
|---|
| 299 | if (GetDCData(pHps)->graphicsMode == GM_ADVANCED_W && GetDCData(pHps)->xform.eM22 < 0.0)
|
|---|
| 300 | return TRUE;
|
|---|
| 301 | }
|
|---|
| 302 |
|
|---|
| 303 | return FALSE;
|
|---|
| 304 | }
|
|---|
| 305 |
|
|---|
| 306 | LONG OSLibWinDrawTabbedText(PVOID pHps,LONG cchText,LONG lTabs,LPCSTR lpchText,PVOID prcl,LONG clrFore,LONG clrBack,ULONG flCmd)
|
|---|
| 307 | {
|
|---|
| 308 | return WinDrawTabbedText(GetDCData(pHps)->hps,cchText,lTabs,(PCH)lpchText,(PRECTL)prcl,clrFore,clrBack,flCmd);
|
|---|
| 309 | }
|
|---|
| 310 |
|
|---|
| 311 | BOOL OSLibGpiMove(PVOID pHps,PPOINTLOS2 pptlPoint)
|
|---|
| 312 | {
|
|---|
| 313 | return GpiMove(GetDCData(pHps)->hps,(PPOINTL)pptlPoint);
|
|---|
| 314 | }
|
|---|
| 315 |
|
|---|
| 316 | LONG OSLibGpiLine(PVOID pHps,PPOINTLOS2 pptlEndPoint)
|
|---|
| 317 | {
|
|---|
| 318 | return GpiLine(GetDCData(pHps)->hps,(PPOINTL)pptlEndPoint);
|
|---|
| 319 | }
|
|---|
| 320 |
|
|---|
| 321 | #define FSP_ENDPATH 0x00000010
|
|---|
| 322 | #define FSP_FILL 0x00000020
|
|---|
| 323 | #define FSP_CLOSEPATH 0x00000040
|
|---|
| 324 |
|
|---|
| 325 | BOOL APIENTRY _PaxStrokeAndFillPath(HPS hPS,ULONG ulAction,ULONG ulStrokeAttrs,PAREABUNDLE pPenStroke);
|
|---|
| 326 |
|
|---|
| 327 | inline BOOL PaxStrokeAndFillPath(HPS hPS,ULONG ulAction,ULONG ulStrokeAttrs,PAREABUNDLE pPenStroke)
|
|---|
| 328 | {
|
|---|
| 329 | BOOL yyrc;
|
|---|
| 330 | USHORT sel = RestoreOS2FS();
|
|---|
| 331 |
|
|---|
| 332 | yyrc = _PaxStrokeAndFillPath(hPS,ulAction,ulStrokeAttrs,pPenStroke);
|
|---|
| 333 | SetFS(sel);
|
|---|
| 334 |
|
|---|
| 335 | return yyrc;
|
|---|
| 336 | }
|
|---|
| 337 |
|
|---|
| 338 |
|
|---|
| 339 | BOOL OSLibGpiEndPath(PVOID pHps)
|
|---|
| 340 | {
|
|---|
| 341 | return GpiEndPath(GetDCData(pHps)->hps);
|
|---|
| 342 | }
|
|---|
| 343 |
|
|---|
| 344 | BOOL drawLinePointCircle(PVOID pHps,INT width,INT height,LONG color)
|
|---|
| 345 | {
|
|---|
| 346 | ARCPARAMS arcp;
|
|---|
| 347 | BOOL rc = TRUE;
|
|---|
| 348 |
|
|---|
| 349 | arcp.lP = 1;
|
|---|
| 350 | arcp.lQ = 1;
|
|---|
| 351 | arcp.lR = 0;
|
|---|
| 352 | arcp.lS = 0;
|
|---|
| 353 | if (!GpiSetArcParams(GetDCData(pHps)->hps,&arcp))
|
|---|
| 354 | return FALSE;
|
|---|
| 355 |
|
|---|
| 356 | AREABUNDLE newAreaBundle, oldAreaBundle;
|
|---|
| 357 | LINEBUNDLE lineBundle;
|
|---|
| 358 |
|
|---|
| 359 | GpiQueryAttrs(GetDCData(pHps)->hps,PRIM_AREA,ABB_COLOR | ABB_MIX_MODE | ABB_SET | ABB_SYMBOL,(PBUNDLE)&oldAreaBundle);
|
|---|
| 360 | GpiQueryAttrs(GetDCData(pHps)->hps,PRIM_LINE,LBB_MIX_MODE, (PBUNDLE)&lineBundle);
|
|---|
| 361 |
|
|---|
| 362 | newAreaBundle = oldAreaBundle;
|
|---|
| 363 | newAreaBundle.lColor = color;
|
|---|
| 364 | newAreaBundle.usMixMode = lineBundle.usMixMode;
|
|---|
| 365 | newAreaBundle.usSet = LCID_DEFAULT;
|
|---|
| 366 | newAreaBundle.usSymbol = PATSYM_SOLID;
|
|---|
| 367 |
|
|---|
| 368 | if (!GpiSetAttrs(GetDCData(pHps)->hps,PRIM_AREA,ABB_COLOR | ABB_MIX_MODE | ABB_SET | ABB_SYMBOL,0,(PBUNDLE)&newAreaBundle))
|
|---|
| 369 | return FALSE;
|
|---|
| 370 |
|
|---|
| 371 | if (GpiFullArc(GetDCData(pHps)->hps,DRO_FILL,MAKEFIXED((width-1)>>1,0)) == GPI_ERROR)
|
|---|
| 372 | rc = FALSE;
|
|---|
| 373 | GpiSetAttrs(GetDCData(pHps)->hps,PRIM_AREA,ABB_COLOR | ABB_MIX_MODE | ABB_SET | ABB_SYMBOL,0,(PBUNDLE)&oldAreaBundle);
|
|---|
| 374 |
|
|---|
| 375 | return rc;
|
|---|
| 376 | }
|
|---|
| 377 |
|
|---|
| 378 | BOOL drawLinePoint(PVOID pHps,PPOINTLOS2 pt,LONG color)
|
|---|
| 379 | {
|
|---|
| 380 | LINEBUNDLE lbOld, lbNew;
|
|---|
| 381 | LONG defaults = GpiQueryAttrs(GetDCData(pHps)->hps, PRIM_LINE, LBB_COLOR, &lbOld);
|
|---|
| 382 |
|
|---|
| 383 | lbNew.lColor = color;
|
|---|
| 384 | BOOL rc = GpiSetAttrs(GetDCData(pHps)->hps,PRIM_LINE,LBB_COLOR,0,&lbNew) && GpiSetPel(GetDCData(pHps)->hps,(PPOINTL)pt) != GPI_ERROR;
|
|---|
| 385 |
|
|---|
| 386 | GpiSetAttrs(GetDCData(pHps)->hps,PRIM_LINE,LBB_COLOR,defaults,&lbOld);
|
|---|
| 387 |
|
|---|
| 388 | return rc;
|
|---|
| 389 | }
|
|---|
| 390 |
|
|---|
| 391 | ULONG OSLibGpiQueryCp(HDC hdc)
|
|---|
| 392 | {
|
|---|
| 393 | return GpiQueryCp(hdc);
|
|---|
| 394 | }
|
|---|
| 395 |
|
|---|
| 396 | BOOL OSLibGpiSetCp(HDC hdc, ULONG codepage)
|
|---|
| 397 | {
|
|---|
| 398 | return GpiSetCp(hdc, codepage);
|
|---|
| 399 | }
|
|---|
| 400 |
|
|---|
| 401 |
|
|---|
| 402 | int OSLibGpiQueryFontMaxHeight(HDC hdc)
|
|---|
| 403 | {
|
|---|
| 404 | FONTMETRICS metrics;
|
|---|
| 405 | BOOL rc;
|
|---|
| 406 |
|
|---|
| 407 | rc = GpiQueryFontMetrics(hdc, sizeof(metrics), &metrics);
|
|---|
| 408 | if(rc) {
|
|---|
| 409 | return metrics.lMaxAscender;
|
|---|
| 410 | }
|
|---|
| 411 | else {
|
|---|
| 412 | dprintf(("GpiQueryFontMetrics returned FALSE!!"));
|
|---|
| 413 | return 0;
|
|---|
| 414 | }
|
|---|
| 415 | }
|
|---|
| 416 |
|
|---|
| 417 | #ifdef DEBUG
|
|---|
| 418 | void dprintfOrigin(HDC hdc)
|
|---|
| 419 | {
|
|---|
| 420 | POINTL point;
|
|---|
| 421 |
|
|---|
| 422 | pDCData pHps = (pDCData)OSLibGpiQueryDCData((HPS)hdc);
|
|---|
| 423 | if(!pHps)
|
|---|
| 424 | {
|
|---|
| 425 | return;
|
|---|
| 426 | }
|
|---|
| 427 |
|
|---|
| 428 | GreGetDCOrigin(pHps->hps, &point);
|
|---|
| 429 | dprintf2(("HDC %x origin (%d,%d) org (%d,%d)", hdc, point.x, point.y, pHps->ptlOrigin.x, pHps->ptlOrigin.y));
|
|---|
| 430 | }
|
|---|
| 431 | #endif
|
|---|
| 432 |
|
|---|
| 433 | BOOL OSLibDevQueryCaps(pDCData pHps, LONG lStart, LONG lCount, LONG *alArray)
|
|---|
| 434 | {
|
|---|
| 435 | return DevQueryCaps(pHps->hdc, lStart, lCount, alArray);
|
|---|
| 436 | }
|
|---|