Changeset 18
- Timestamp:
- Jan 1, 2001, 4:30:29 PM (25 years ago)
- Location:
- trunk
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/helpers/comctl.h
r14 r18 72 72 ULONG ulAttr; 73 73 PFNWP OldStaticProc; 74 RECTL rclBar;75 74 } PROGRESSBARDATA, *PPROGRESSBARDATA; 76 75 -
trunk/include/helpers/dosh.h
r17 r18 374 374 375 375 APIRET doshSetEnvironmentVar(PDOSENVIRONMENT pEnv, 376 PSZ pszNewEnv); 376 PSZ pszNewEnv, 377 BOOL fAddFirst); 377 378 378 379 APIRET doshConvertEnvironment(PDOSENVIRONMENT pEnv, … … 392 393 * old DOS EXE header at offset 0 393 394 * in any EXE file. 395 * 396 *@@changed V0.9.7 (2000-12-20) [umoeller]: fixed NE offset 394 397 */ 395 398 … … 419 422 ULONG ulUnused6; // 34: 420 423 ULONG ulUnused7; // 38: 421 USHORT usNewHeaderOfs; // new header ofs (if 0x18 > 0x40) 424 ULONG ulNewHeaderOfs; // new header ofs (if 0x18 > 0x40) 425 // fixed this from USHORT, thanks Martin Lafaix 426 // V0.9.7 (2000-12-20) [umoeller] 422 427 } DOSEXEHEADER, *PDOSEXEHEADER; 423 428 … … 440 445 CHAR achNE[2]; // 00: NE 441 446 BYTE bLinkerVersion; // 02: linker version 442 BYTE bL linkerRevision;// 03: linker revision447 BYTE bLinkerRevision; // 03: linker revision 443 448 USHORT usEntryTblOfs; // 04: ofs from this to entrytable 444 449 USHORT usEntryTblLen; // 06: length of entrytable -
trunk/include/helpers/gpih.h
r14 r18 154 154 LONG lPointSize); 155 155 156 LONG gpihQueryLineSpacing(HPS hps, 157 PSZ pszText); 156 LONG gpihQueryLineSpacing(HPS hps); 158 157 159 158 /* ****************************************************************** -
trunk/include/helpers/threads.h
r14 r18 36 36 #define THRF_PMMSGQUEUE 0x0001 37 37 #define THRF_WAIT 0x0002 38 #define THRF_TRANSIENT 0x0004 38 39 39 40 /* -
trunk/include/helpers/xstring.h
r15 r18 58 58 typedef XSTRINITSET *PXSTRINITSET; 59 59 60 void XWPENTRY xstrInitCopy(PXSTRING pxstr, const char *pcszSource );61 typedef void XWPENTRY XSTRINITCOPY(PXSTRING pxstr, const char *pcszSource );60 void XWPENTRY xstrInitCopy(PXSTRING pxstr, const char *pcszSource, ULONG ulExtraAllocate); 61 typedef void XWPENTRY XSTRINITCOPY(PXSTRING pxstr, const char *pcszSource, ULONG ulExtraAllocate); 62 62 typedef XSTRINITCOPY *PXSTRINITCOPY; 63 63 -
trunk/src/helpers/animate.c
r17 r18 280 280 rclDraw.yBottom = rclNow.yTop; 281 281 rclDraw.yTop = rclLast.yTop; 282 WinFillRect(hps, &rclDraw, CLR_BLACK); 282 WinFillRect(hps, &rclDraw, CLR_BLACK); // exclusive 283 283 284 284 // draw black rectangle left of rclNow … … 287 287 rclDraw.yBottom = rclLast.yBottom; 288 288 rclDraw.yTop = rclLast.yTop; 289 WinFillRect(hps, &rclDraw, CLR_BLACK); 289 WinFillRect(hps, &rclDraw, CLR_BLACK); // exclusive 290 290 291 291 // draw black rectangle right of rclNow … … 294 294 rclDraw.yBottom = rclLast.yBottom; 295 295 rclDraw.yTop = rclLast.yTop; 296 WinFillRect(hps, &rclDraw, CLR_BLACK); 296 WinFillRect(hps, &rclDraw, CLR_BLACK); // exclusive 297 297 298 298 // draw black rectangle at the bottom of rclNow … … 301 301 rclDraw.yBottom = rclLast.yBottom; 302 302 rclDraw.yTop = rclNow.yBottom; 303 WinFillRect(hps, &rclDraw, CLR_BLACK); 303 WinFillRect(hps, &rclDraw, CLR_BLACK); // exclusive 304 304 305 305 // remember rclNow for next iteration … … 365 365 rclDraw.yBottom = rclLast.yBottom; 366 366 rclDraw.yTop = rclLast.yTop; 367 WinFillRect(hps, &rclDraw, CLR_BLACK); 367 WinFillRect(hps, &rclDraw, CLR_BLACK); // exclusive 368 368 369 369 // draw black rectangle right of rclNow … … 372 372 rclDraw.yBottom = rclLast.yBottom; 373 373 rclDraw.yTop = rclLast.yTop; 374 WinFillRect(hps, &rclDraw, CLR_BLACK); 375 376 // WinFillRect(hps, &rclNow, CLR_WHITE); 374 WinFillRect(hps, &rclDraw, CLR_BLACK); // exclusive 375 376 // WinFillRect(hps, &rclNow, CLR_WHITE); // exclusive 377 377 378 378 // remember rclNow for next iteration … … 391 391 rclLast.yTop = rclScreen.yTop - rclLast.yBottom; 392 392 393 WinFillRect(hps, &rclLast, CLR_WHITE); 393 WinFillRect(hps, &rclLast, CLR_WHITE); // exclusive 394 394 } 395 395 } … … 435 435 rclDraw.yBottom = rclNow.yTop; 436 436 rclDraw.yTop = rclLast.yTop; 437 WinFillRect(hps, &rclDraw, CLR_BLACK); 437 WinFillRect(hps, &rclDraw, CLR_BLACK); // exclusive 438 438 439 439 // draw black rectangle at the bottom of rclNow … … 442 442 rclDraw.yBottom = rclLast.yBottom; 443 443 rclDraw.yTop = rclNow.yBottom; 444 WinFillRect(hps, &rclDraw, CLR_BLACK); 444 WinFillRect(hps, &rclDraw, CLR_BLACK); // exclusive 445 445 446 446 // remember rclNow for next iteration … … 473 473 // sleep a while 474 474 DosSleep(ulWaitEnd / 2); 475 WinFillRect(hps, &rclScreen, CLR_BLACK); 475 WinFillRect(hps, &rclScreen, CLR_BLACK); // exclusive 476 476 DosSleep(ulWaitEnd / 2); 477 477 -
trunk/src/helpers/cctl_chart.c
r14 r18 744 744 sprintf(szDebug, "Error, no values set"); 745 745 WinFillRect(hps, 746 &rclStatic, 746 &rclStatic, // exclusive 747 747 CLR_WHITE); 748 748 WinDrawText(hps, -
trunk/src/helpers/cctl_progbar.c
r14 r18 100 100 */ 101 101 102 VOID PaintProgress(PPROGRESSBARDATA pData, HWND hwndBar, HPS hps) 102 VOID PaintProgress(PPROGRESSBARDATA pData, 103 HWND hwndBar, 104 PRECTL prclWin, // in: window rectangle (WinQueryWindowRect) 105 HPS hps) 103 106 { 104 POINTL ptl1, ptlText, aptlText[TXTBOX_COUNT]; 105 RECTL rcl, rcl2; 106 107 POINTL ptlText; // , aptlText[TXTBOX_COUNT]; 108 BOOL fBackgroundPainted = FALSE; 107 109 CHAR szPercent[10] = ""; 110 RECTL rclInnerButton; 111 LONG lcolScrollbar = WinQuerySysColor(HWND_DESKTOP, 112 SYSCLR_SCROLLBAR, 113 0); 108 114 109 115 // switch to RGB mode 110 GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, NULL);116 gpihSwitchToRGB(hps); 111 117 112 118 if (pData->ulPaintX <= pData->ulOldPaintX) 113 119 { 114 // draw frame and background only if this is either 115 // a "real" WM_PAINT (i.e., the window was overlapped 116 // and needs repainting; then ulPaintX == ulOldPaintX) 117 // or if ulNow has _de_creased 118 GpiSetColor(hps, WinQuerySysColor(HWND_DESKTOP, SYSCLR_BUTTONDARK, 0)); 119 ptl1.x = 0; 120 ptl1.y = 0; 121 GpiMove(hps, &ptl1); 122 ptl1.y = (pData->rclBar.yTop); 123 GpiLine(hps, &ptl1); 124 ptl1.x = (pData->rclBar.xRight); 125 GpiLine(hps, &ptl1); 126 GpiSetColor(hps, WinQuerySysColor(HWND_DESKTOP, SYSCLR_BUTTONLIGHT, 0)); 127 ptl1.y = 0; 128 GpiLine(hps, &ptl1); 129 ptl1.x = 0; 130 GpiLine(hps, &ptl1); 131 132 pData->rclBar.xLeft = 1; 133 pData->rclBar.yBottom = 1; 134 WinFillRect(hps, &(pData->rclBar), 135 WinQuerySysColor(HWND_DESKTOP, SYSCLR_SCROLLBAR, 0)); 136 } 137 138 // draw percentage? 120 RECTL rclOuterFrame; // inclusive 121 rclOuterFrame.xLeft = 0; 122 rclOuterFrame.yBottom = 0; 123 rclOuterFrame.xRight = prclWin->xRight - 1; 124 rclOuterFrame.yTop = prclWin->yTop - 1; 125 126 gpihDraw3DFrame(hps, 127 &rclOuterFrame, // inclusive 128 1, 129 WinQuerySysColor(HWND_DESKTOP, SYSCLR_BUTTONDARK, 0), 130 WinQuerySysColor(HWND_DESKTOP, SYSCLR_BUTTONLIGHT, 0)); 131 132 rclOuterFrame.xLeft++; 133 rclOuterFrame.yBottom++; 134 WinFillRect(hps, 135 &rclOuterFrame, // exclusive, top right not drawn 136 lcolScrollbar); 137 fBackgroundPainted = TRUE; 138 } 139 140 // now draw the actual progress; 141 // rclInnerButton receives an _inclusive_ rectangle 142 rclInnerButton.xLeft = 1; 143 rclInnerButton.xRight = (pData->ulPaintX > (rclInnerButton.xLeft + 3)) 144 ? pData->ulPaintX 145 : rclInnerButton.xLeft + 146 ((pData->ulAttr & PBA_BUTTONSTYLE) 147 ? 3 : 1); 148 rclInnerButton.yBottom = 1; 149 rclInnerButton.yTop = prclWin->yTop // exclusive 150 - 2; // 1 to make inclusive, 1 for outer frame 151 139 152 if (pData->ulAttr & PBA_PERCENTFLAGS) 140 153 { 141 // make string 154 // percentage desired: 155 156 POINTL aptlText[TXTBOX_COUNT]; 157 LONG lLineSpacing = 1; 158 FONTMETRICS fm; 159 if (GpiQueryFontMetrics(hps, sizeof(FONTMETRICS), &fm)) 160 lLineSpacing = fm.lEmHeight; 161 142 162 sprintf(szPercent, "%lu %%", ((100 * pData->ulNow) / pData->ulMax) ); 143 144 163 // calculate string space 145 GpiQueryTextBox(hps, strlen(szPercent), szPercent, 146 TXTBOX_COUNT, (PPOINTL)&aptlText); 147 148 // calculate coordinates 149 ptlText.x = pData->rclBar.xLeft + 150 ( ( (pData->rclBar.xRight-pData->rclBar.xLeft) 151 - (aptlText[TXTBOX_BOTTOMRIGHT].x-aptlText[TXTBOX_BOTTOMLEFT].x) 164 GpiQueryTextBox(hps, 165 strlen(szPercent), 166 szPercent, 167 TXTBOX_COUNT, 168 (PPOINTL)&aptlText); 169 170 ptlText.x = 171 ( ( (prclWin->xRight) // cx 172 - (aptlText[TXTBOX_BOTTOMRIGHT].x - aptlText[TXTBOX_BOTTOMLEFT].x) 152 173 ) 153 174 / 2); 154 ptlText.y = 2 + pData->rclBar.yBottom + // fixed V0.9.5 (2000-09-22) [umoeller]155 ( ( (p Data->rclBar.yTop-pData->rclBar.yBottom)156 - ( aptlText[TXTBOX_TOPLEFT].y-aptlText[TXTBOX_BOTTOMLEFT].y)175 ptlText.y = 176 ( ( (prclWin->yTop) // cy 177 - (lLineSpacing) 157 178 ) 158 / 2); 159 160 // do we need to repaint the background under the percentage? 161 if ( ( (ptlText.x 162 + ( aptlText[TXTBOX_BOTTOMRIGHT].x 163 - aptlText[TXTBOX_BOTTOMLEFT].x) 164 ) 165 > pData->ulPaintX) 166 && (pData->ulPaintX > pData->ulOldPaintX) 167 ) 179 / 2) + 2; 180 181 if (!fBackgroundPainted) 168 182 { 169 183 // if we haven't drawn the background already, 170 184 // we'll need to do it now for the percentage area 171 rcl.xLeft = ptlText.x; 172 rcl.xRight = ptlText.x + (aptlText[TXTBOX_BOTTOMRIGHT].x-aptlText[TXTBOX_BOTTOMLEFT].x); 173 rcl.yBottom = ptlText.y; 174 rcl.yTop = ptlText.y + (aptlText[TXTBOX_TOPLEFT].y-aptlText[TXTBOX_BOTTOMLEFT].y); 175 WinFillRect(hps, &rcl, 176 WinQuerySysColor(HWND_DESKTOP, SYSCLR_SCROLLBAR, 0)); 185 RECTL rcl2; 186 rcl2.xLeft = ptlText.x; 187 rcl2.xRight = ptlText.x + (aptlText[TXTBOX_BOTTOMRIGHT].x-aptlText[TXTBOX_BOTTOMLEFT].x); 188 rcl2.yBottom = ptlText.y; 189 rcl2.yTop = ptlText.y + lLineSpacing; 190 WinFillRect(hps, 191 &rcl2, 192 lcolScrollbar); 177 193 } 178 194 } 179 195 180 // now draw the actual progress181 rcl2.xLeft = pData->rclBar.xLeft;182 rcl2.xRight = (pData->ulPaintX > (rcl2.xLeft + 3))183 ? pData->ulPaintX184 : rcl2.xLeft + ((pData->ulAttr & PBA_BUTTONSTYLE)185 ? 3 : 1);186 rcl2.yBottom = pData->rclBar.yBottom;187 rcl2.yTop = pData->rclBar.yTop-1;188 189 196 if (pData->ulAttr & PBA_BUTTONSTYLE) 190 197 { 191 RECTL rcl3 = rcl2;192 198 // draw "raised" inner rect 193 rcl3.xLeft = rcl2.xLeft; 194 rcl3.yBottom = rcl2.yBottom; 195 rcl3.yTop = rcl2.yTop+1; 196 rcl3.xRight = rcl2.xRight+1; 197 gpihDraw3DFrame(hps, &rcl3, 2, 199 gpihDraw3DFrame(hps, 200 &rclInnerButton, 201 2, 198 202 WinQuerySysColor(HWND_DESKTOP, SYSCLR_BUTTONLIGHT, 0), 199 203 WinQuerySysColor(HWND_DESKTOP, SYSCLR_BUTTONDARK, 0)); 200 // WinInflateRect(WinQueryAnchorBlock(hwndBar), &rcl2, -2, -2); 201 rcl2.xLeft += 2; 202 rcl2.yBottom += 2; 203 rcl2.yTop -= 2; 204 rcl2.xRight -= 2; 205 } 206 207 if (rcl2.xRight > rcl2.xLeft) 208 { 204 } 205 206 rclInnerButton.xLeft += 2; 207 rclInnerButton.yBottom += 2; 208 rclInnerButton.yTop -= 2; 209 rclInnerButton.xRight -= 2; 210 211 if (rclInnerButton.xRight > rclInnerButton.xLeft) 212 { 213 POINTL ptl1; 214 // draw interior of inner rect 209 215 GpiSetColor(hps, WinQuerySysColor(HWND_DESKTOP, 210 // SYSCLR_HILITEBACKGROUND, 211 SYSCLR_BUTTONMIDDLE, 212 0)); 213 ptl1.x = rcl2.xLeft; 214 ptl1.y = rcl2.yBottom; 216 SYSCLR_BUTTONMIDDLE, 217 0)); 218 ptl1.x = rclInnerButton.xLeft; 219 ptl1.y = rclInnerButton.yBottom; 215 220 GpiMove(hps, &ptl1); 216 ptl1.x = rcl2.xRight; 217 ptl1.y = rcl2.yTop; 218 GpiBox(hps, DRO_FILL | DRO_OUTLINE, 219 &ptl1, 220 0, 221 0); 221 ptl1.x = rclInnerButton.xRight; 222 ptl1.y = rclInnerButton.yTop; 223 GpiBox(hps, 224 DRO_FILL | DRO_OUTLINE, 225 &ptl1, // inclusive! 226 0, 227 0); 222 228 } 223 229 … … 227 233 GpiMove(hps, &ptlText); 228 234 GpiSetColor(hps, WinQuerySysColor(HWND_DESKTOP, 229 // SYSCLR_HILITEFOREGROUND, 230 SYSCLR_BUTTONDEFAULT, 231 0)); 235 SYSCLR_BUTTONDEFAULT, 236 0)); 232 237 GpiCharString(hps, strlen(szPercent), szPercent); 233 238 } … … 284 289 case WM_UPDATEPROGRESSBAR: 285 290 { 291 RECTL rclWin; 292 WinQueryWindowRect(hwndBar, &rclWin); 286 293 if ( (ppd->ulNow != (ULONG)mp1) 287 294 || (ppd->ulMax != (ULONG)mp2) … … 309 316 ppd->ulPaintX = 310 317 (ULONG)( 311 ( (ULONG)( ppd->rclBar.xRight - ppd->rclBar.xLeft)318 ( (ULONG)(rclWin.xRight - rclWin.xLeft - 2) 312 319 * (ULONG)(ppd->ulNow) 313 320 ) … … 319 326 // WinInvalidateRect(hwndBar, NULL, FALSE); 320 327 hps = WinGetPS(hwndBar); 321 PaintProgress(ppd, hwndBar, hps);328 PaintProgress(ppd, hwndBar, &rclWin, hps); 322 329 WinReleasePS(hps); 323 330 } … … 326 333 case WM_PAINT: 327 334 { 328 RECTL rcl; 329 hps = WinBeginPaint(hwndBar, NULLHANDLE, &rcl); 330 PaintProgress(ppd, hwndBar, hps); 335 RECTL rclWin; 336 WinQueryWindowRect(hwndBar, &rclWin); 337 hps = WinBeginPaint(hwndBar, NULLHANDLE, NULL); 338 PaintProgress(ppd, hwndBar, &rclWin, hps); 331 339 WinEndPaint(hps); 332 340 break; } … … 401 409 pData->ulAttr = ulAttr; 402 410 pData->OldStaticProc = OldStaticProc; 403 WinQueryWindowRect(hwndChart, &(pData->rclBar));404 (pData->rclBar.xRight)--;405 (pData->rclBar.yTop)--;406 411 407 412 WinSetWindowULong(hwndChart, QWL_USER, (ULONG)pData); -
trunk/src/helpers/dosh2.c
r17 r18 552 552 * If "VARNAME" has already been set to something 553 553 * in the string array in pEnv, that array item 554 * is replaced. Otherwise a new item is added to 555 * the array, and pEnv->cVars is raised by one. 554 * is replaced. 555 * 556 * OTOH, if "VARNAME" has not been set yet, a new 557 * item is added to the array, and pEnv->cVars is 558 * raised by one. In that case, fAddFirst determines 559 * whether the new array item is added to the front 560 * or the tail of the environment list. 556 561 * 557 562 *@@added V0.9.4 (2000-07-19) [umoeller] 563 *@@changed V0.9.7 (2000-12-17) [umoeller]: added fAddFirst 558 564 */ 559 565 560 566 APIRET doshSetEnvironmentVar(PDOSENVIRONMENT pEnv, 561 PSZ pszNewEnv) 567 PSZ pszNewEnv, 568 BOOL fAddFirst) 562 569 { 563 570 APIRET arc = NO_ERROR; … … 576 583 free(*ppszEnvLine); 577 584 *ppszEnvLine = strdup(pszNewEnv); 585 if (!(*ppszEnvLine)) 586 arc = ERROR_NOT_ENOUGH_MEMORY; 578 587 } 579 588 else 580 589 { 581 PSZ *ppszNew ;582 PSZ *papszNew ;590 PSZ *ppszNew = NULL; 591 PSZ *papszNew = NULL; 583 592 // not set already: 584 // append 585 // reallocate array and add new string 586 papszNew = (PSZ*)realloc(pEnv->papszVars, sizeof(PSZ) * (pEnv->cVars + 1)); 593 if (fAddFirst) 594 { 595 // add as first entry: 596 papszNew = (PSZ*)malloc(sizeof(PSZ) * (pEnv->cVars + 1)); 597 // overwrite first entry 598 ppszNew = papszNew; 599 // copy old entries 600 memcpy(papszNew + 1, // second new entry 601 pEnv->papszVars, // first old entry 602 sizeof(PSZ) * pEnv->cVars); 603 } 604 else 605 { 606 // append at the tail: 607 // reallocate array and add new string 608 papszNew = (PSZ*)realloc(pEnv->papszVars, 609 sizeof(PSZ) * (pEnv->cVars + 1)); 610 // overwrite last entry 611 ppszNew = papszNew + pEnv->cVars; 612 } 613 587 614 if (!papszNew) 588 615 arc = ERROR_NOT_ENOUGH_MEMORY; … … 590 617 { 591 618 pEnv->papszVars = papszNew; 592 ppszNew = pEnv->papszVars + pEnv->cVars;593 619 pEnv->cVars++; 594 620 *ppszNew = strdup(pszNewEnv); … … 618 644 APIRET doshConvertEnvironment(PDOSENVIRONMENT pEnv, 619 645 PSZ *ppszEnv, // out: environment string 620 PULONG pulSize) // out: size of block allocated in *ppszEnv 646 PULONG pulSize) // out: size of block allocated in *ppszEnv; ptr can be NULL 621 647 { 622 648 APIRET arc = NO_ERROR; … … 652 678 { 653 679 PSZ pTarget = *ppszEnv; 654 *pulSize = cbNeeded; 680 if (pulSize) 681 *pulSize = cbNeeded; 655 682 ppszThis = pEnv->papszVars; 656 683 … … 831 858 // specified in header 832 859 arc = DosSetFilePtr(hFile, 833 (*ppExec)->pDosExeHeader->u sNewHeaderOfs,860 (*ppExec)->pDosExeHeader->ulNewHeaderOfs, 834 861 FILE_BEGIN, 835 862 &ulLocal); … … 847 874 // reset file ptr 848 875 DosSetFilePtr(hFile, 849 (*ppExec)->pDosExeHeader->u sNewHeaderOfs,876 (*ppExec)->pDosExeHeader->ulNewHeaderOfs, 850 877 FILE_BEGIN, 851 878 &ulLocal); -
trunk/src/helpers/gpih.c
r14 r18 15 15 * example, WinQueryWindowRect returns an inclusive-exclusive 16 16 * rectangle (so that the xRight value is the same as the window 17 * width). However, GpiBox expects an inclusive-inclusive rectangle. 17 * width -- tested V0.9.7 (2000-12-20) [umoeller]). 18 * 19 * WinFillRect expects an inclusive-exclusive rectangle, so it 20 * will work with a rectangle from WinQueryWindowRect directly. 21 * 22 * By contrast, the GpiBox expects an inclusive-inclusive rectangle. 18 23 * 19 24 * Function prefixes (new with V0.81): … … 194 199 * (bitmap) PS's also. 195 200 * 196 * The specified rectangle is exclusive, meaning that 197 * the top right point lies _outside_ the rectangle 198 * which is actually drawn. This is the same as with 199 * WinFillRect. ### I don't think so any more... GpiBox 200 * uses inclusive-inclusive rectangles... 201 * The specified rectangle is inclusive, that is, the top 202 * right corner specifies the top right pixel to be drawn. 203 * This is different from WinFillRect. 201 204 * 202 205 * Changes to the HPS: … … 272 275 * The specified rectangle is inclusive, that is, the top 273 276 * right corner specifies the top right pixel to be drawn. 277 * This is different from WinFillRect. 274 278 * 275 279 * If usWidth > 1, the additional pixels will be drawn towards … … 288 292 289 293 VOID gpihDrawThickFrame(HPS hps, // in: presentation space for output 290 PRECTL prcl, // in: rectangle to draw ( exclusive)294 PRECTL prcl, // in: rectangle to draw (inclusive) 291 295 ULONG ulWidth) // in: line width (>= 1) 292 296 { … … 318 322 * The specified rectangle is inclusive, that is, the top 319 323 * right corner specifies the top right pixel to be drawn. 324 * This is different from WinFillRect. 320 325 * 321 326 * If usWidth > 1, the additional pixels will be drawn towards … … 324 329 * 325 330 *@@changed V0.9.0 [umoeller]: changed function prototype to have colors specified 331 *@@changed V0.9.7 (2000-12-20) [umoeller]: now really using inclusive rectangle... 326 332 */ 327 333 328 334 VOID gpihDraw3DFrame(HPS hps, 329 PRECTL prcl, // in: rectangle 335 PRECTL prcl, // in: rectangle (inclusive) 330 336 USHORT usWidth, // in: line width (>= 1) 331 337 LONG lColorLeft, // in: color to use for left and top; e.g. SYSCLR_BUTTONLIGHT … … 342 348 ptl1.y = rcl2.yBottom; 343 349 GpiMove(hps, &ptl1); 344 ptl1.y = rcl2.yTop -1;350 ptl1.y = rcl2.yTop; // V0.9.7 (2000-12-20) [umoeller] 345 351 GpiLine(hps, &ptl1); 346 ptl1.x = rcl2.xRight -1;352 ptl1.x = rcl2.xRight; // V0.9.7 (2000-12-20) [umoeller] 347 353 GpiLine(hps, &ptl1); 348 354 GpiSetColor(hps, lColorRight); … … 1063 1069 * screen yourself and need the height of a text 1064 1070 * line to advance to the next. 1065 */ 1066 1067 LONG gpihQueryLineSpacing(HPS hps, 1068 PSZ pszText) // in: text to output 1071 * 1072 *@@changed V0.9.7 (2000-12-20) [umoeller]: removed psz param 1073 */ 1074 1075 LONG gpihQueryLineSpacing(HPS hps) 1069 1076 { 1070 1077 FONTMETRICS fm; 1071 POINTL aptlText[TXTBOX_COUNT];1072 GpiQueryTextBox(hps, strlen(pszText), pszText,1073 TXTBOX_COUNT, (PPOINTL)&aptlText);1074 1078 1075 1079 if (GpiQueryFontMetrics(hps, sizeof(FONTMETRICS), &fm)) 1076 1080 return ( ( fm.lMaxBaselineExt // max vertical font space 1077 1081 +fm.lExternalLeading) // space advised by font designer 1078 // * 12 / 101079 1082 ); 1080 1083 else -
trunk/src/helpers/stringh.c
r14 r18 1118 1118 * and, if pszCopyTo != NULL, copies the rest of the line to 1119 1119 * that buffer, of which cbCopyTo specified the size. 1120 * 1120 1121 * If the key is not found, NULL is returned. 1121 1122 * String search is done by calling strhFindKey. 1122 1123 * This is useful for querying CONFIG.SYS settings. 1123 1124 * 1124 * <B>Example:</B> this would return "YES" if you searched 1125 * for "PAUSEONERROR=", and "PAUSEONERROR=YES" existed in pszSearchIn. 1125 * <B>Example:</B> 1126 * 1127 * this would return "YES" if you searched for "PAUSEONERROR=", 1128 * and "PAUSEONERROR=YES" existed in pszSearchIn. 1126 1129 */ 1127 1130 -
trunk/src/helpers/syssound.c
r13 r18 173 173 *@@changed V0.9.6 (2000-10-16) [umoeller]: now using MMBASE environment variable 174 174 *@@changed V0.9.6 (2000-10-16) [umoeller]: added proper HAB param 175 *@@changed V0.9.7 (2000-12-17) [umoeller]: fixed broken MMBASE handling 175 176 */ 176 177 … … 186 187 // variable set: 187 188 PSZ p; 188 sprintf(szMMPM, "%s\\MMPM.INI", pszMMPMPath); 189 190 strcpy(szMMPM, pszMMPMPath); // V0.9.7 (2000-12-17) [umoeller] 191 189 192 // kill semicolon if present 190 193 p = strchr(szMMPM, ';'); 191 194 if (p) 192 195 *p = 0; 196 197 strcat(szMMPM, "\\MMPM.INI"); 193 198 } 194 199 else … … 251 256 BOOL rc = FALSE; 252 257 HINI hiniMMPM = sndOpenMmpmIni(hab); 258 259 #ifdef DEBUG_SOUNDS 260 _Pmpf((__FUNCTION__ ": entering, hiniMMPM is 0x%lX", hiniMMPM)); 261 #endif 262 253 263 if (hiniMMPM) 254 264 { … … 540 550 APIRET arc = NO_ERROR; 541 551 542 _Pmpf(("Entering sndLoadSoundScheme")); 552 #ifdef DEBUG_SOUNDS 553 _Pmpf(("Entering sndLoadSoundScheme")); 554 #endif 543 555 544 556 if (hiniMMPM) … … 550 562 pszScheme, 551 563 NULL); 552 _Pmpf((" pszSchemeAppName: %s", pszSchemeAppName)); 564 #ifdef DEBUG_SOUNDS 565 _Pmpf((" pszSchemeAppName: %s", pszSchemeAppName)); 566 #endif 553 567 554 568 if (pszSchemeAppName) … … 650 664 arc = ERROR_INVALID_HANDLE; 651 665 652 _Pmpf(("End of sndLoadSoundScheme, arc: %d", arc)); 666 #ifdef DEBUG_SOUNDS 667 _Pmpf(("End of sndLoadSoundScheme, arc: %d", arc)); 668 #endif 653 669 return (arc); 654 670 } -
trunk/src/helpers/textview.c
r14 r18 2476 2476 // reduce clip region to update rectangle 2477 2477 GpiIntersectClipRectangle(ptxvd->hps, 2478 &rcl2Update); 2478 &rcl2Update); // exclusive 2479 2479 2480 2480 // draw little box at the bottom right … … 2502 2502 // this can be larger than "view text" 2503 2503 WinFillRect(ptxvd->hps, 2504 &ptxvd->rclViewPaint, 2504 &ptxvd->rclViewPaint, // exclusive 2505 2505 ptxvd->lBackColor); 2506 2506 … … 2511 2511 rclClip.yTop = ptxvd->rclViewText.yTop - 1; 2512 2512 GpiIntersectClipRectangle(ptxvd->hps, 2513 &rclClip); 2513 &rclClip); // exclusive 2514 2514 // finally, draw text lines in invalid rectangle; 2515 2515 // this subfunction is smart enough to redraw only -
trunk/src/helpers/threads.c
r14 r18 65 65 * 66 66 *@@added V0.9.2 (2000-03-05) [umoeller] 67 *@@changed V0.9.7 (2000-12-18) [lafaix]: THRF_TRANSIENT support added 67 68 */ 68 69 … … 106 107 DosCloseEventSem(pti->hevRunning); 107 108 108 // thread func returns: 109 pti->fExitComplete = TRUE; 110 pti->tid = NULLHANDLE; 111 112 if (pti->pfRunning) 113 // clear "running" flag 114 *(pti->pfRunning) = FALSE; 109 // (2000-12-18) [lafaix] clean up pti if thread is transient. 110 if (pti->flFlags & THRF_TRANSIENT) 111 free(pti); 112 else 113 { 114 // for non-transient threads: set exit flags 115 // V0.9.7 (2000-12-20) [umoeller] 116 // thread func returns: 117 pti->fExitComplete = TRUE; 118 pti->tid = NULLHANDLE; 119 120 if (pti->pfRunning) 121 // clear "running" flag 122 *(pti->pfRunning) = FALSE; 123 } 115 124 } 116 125 } … … 174 183 *@@changed V0.9.3 (2000-05-01) [umoeller]: added pbRunning and flFlags 175 184 *@@changed V0.9.5 (2000-08-26) [umoeller]: now using PTHREADINFO 185 *@@changed V0.9.7 (2000-12-18) [lafaix]: THRF_TRANSIENT support added 176 186 */ 177 187 … … 184 194 { 185 195 BOOL rc = FALSE; 196 197 // (2000-12-18) [lafaix] TRANSIENT 198 if (flFlags & THRF_TRANSIENT) 199 { 200 if (pti == NULL) 201 pti = (PTHREADINFO) malloc(sizeof(THREADINFO)); 202 else 203 return (rc); 204 } 186 205 187 206 if (pti) -
trunk/src/helpers/winh.c
r17 r18 1608 1608 * area and will adjust coordinates accordingly. This can 1609 1609 * happen when changing video resolutions. 1610 * 1611 *@@changed V0.9.7 (2000-12-20) [umoeller]: fixed invalid params if INI key not found 1610 1612 */ 1611 1613 … … 1617 1619 { 1618 1620 BOOL brc = FALSE; 1619 SWP swp , swpNow;1621 SWP swp; 1620 1622 ULONG cbswp = sizeof(swp); 1621 ULONG fl2 = fl;1623 ULONG fl2 = (fl & ~SWP_ZORDER); 1622 1624 1623 1625 if (PrfQueryProfileData(hIni, pszApp, pszKey, &swp, &cbswp)) … … 1631 1633 { 1632 1634 // if no resize, we need to get the current position 1635 SWP swpNow; 1633 1636 brc = WinQueryWindowPos(hwnd, &swpNow); 1634 1637 swp.cx = swpNow.cx; … … 1649 1652 } 1650 1653 else 1654 { 1651 1655 // window pos not found in INI: unset SWP_MOVE etc. 1656 WinQueryWindowPos(hwnd, &swp); 1652 1657 fl2 &= ~(SWP_MOVE | SWP_SIZE); 1658 } 1653 1659 1654 1660 WinSetWindowPos(hwnd, … … 2124 2130 * 2125 2131 * Example: 2126 + PPRESPARAMS ppp = NULL; 2127 + CHAR szFont[] = "9.WarpSans"; 2128 + LONG lColor = CLR_WHITE; 2129 + winhStorePresParam(&ppp, PP_FONTNAMESIZE, sizeof(szFont), szFont); 2130 + winhStorePresParam(&ppp, PP_BACKGROUNDCOLOR, sizeof(lColor), &lColor); 2131 + WinCreateWindow(...., ppp); 2132 + free(ppp); 2132 * 2133 + PPRESPARAMS ppp = NULL; 2134 + CHAR szFont[] = "9.WarpSans"; 2135 + LONG lColor = CLR_WHITE; 2136 + winhStorePresParam(&ppp, PP_FONTNAMESIZE, sizeof(szFont), szFont); 2137 + winhStorePresParam(&ppp, PP_BACKGROUNDCOLOR, sizeof(lColor), &lColor); 2138 + WinCreateWindow(...., ppp); 2139 + free(ppp); 2133 2140 * 2134 2141 *@@added V0.9.0 [umoeller] … … 2494 2501 *@@added V0.9.6 (2000-10-16) [umoeller] 2495 2502 *@@changed V0.9.7 (2000-12-10) [umoeller]: PROGDETAILS.swpInitial no longer zeroed... this broke VIOs 2503 *@@changed V0.9.7 (2000-12-17) [umoeller]: PROGDETAILS.pszEnvironment no longer zeroed 2496 2504 */ 2497 2505 … … 2510 2518 ProgDetails.Length = sizeof(PROGDETAILS); 2511 2519 ProgDetails.progt.fbVisible = SHE_VISIBLE; 2512 ProgDetails.pszEnvironment = 0;2520 // ProgDetails.pszEnvironment = 0; 2513 2521 2514 2522 // memset(&ProgDetails.swpInitial, 0, sizeof(SWP)); … … 3156 3164 * SWP structure (*pswpFrame). 3157 3165 * 3166 * The client window is created with the frame as 3167 * its parent and owner and gets an ID of FID_CLIENT. 3168 * 3158 3169 * Alternatively, you can set pswpFrame to NULL 3159 3170 * and specify FCF_SHELLPOSITION with flFrameCreateFlags. … … 3215 3226 { 3216 3227 if (pswpFrame) 3228 { 3217 3229 // position frame 3218 3230 WinSetWindowPos(hwndFrame, … … 3224 3236 pswpFrame->fl); 3225 3237 3226 // position client 3227 // WinQueryWindowRect(hwndFrame, &rclClient); 3228 // doesn't work because it might be invisible V0.9.7 (2000-12-08) [umoeller] 3229 rclClient.xLeft = 0; 3230 rclClient.yBottom = 0; 3231 rclClient.xRight = pswpFrame->cx; 3232 rclClient.yTop = pswpFrame->cy; 3233 WinCalcFrameRect(hwndFrame, 3234 &rclClient, 3235 TRUE); // calc client from frame 3236 WinSetWindowPos(*phwndClient, 3237 HWND_TOP, 3238 rclClient.xLeft, 3239 rclClient.yBottom, 3240 rclClient.xRight - rclClient.xLeft, 3241 rclClient.yTop - rclClient.yBottom, 3242 SWP_MOVE | SWP_SIZE | SWP_SHOW); 3238 // position client 3239 // WinQueryWindowRect(hwndFrame, &rclClient); 3240 // doesn't work because it might be invisible V0.9.7 (2000-12-08) [umoeller] 3241 rclClient.xLeft = 0; 3242 rclClient.yBottom = 0; 3243 rclClient.xRight = pswpFrame->cx; 3244 rclClient.yTop = pswpFrame->cy; 3245 WinCalcFrameRect(hwndFrame, 3246 &rclClient, 3247 TRUE); // calc client from frame 3248 WinSetWindowPos(*phwndClient, 3249 HWND_TOP, 3250 rclClient.xLeft, 3251 rclClient.yBottom, 3252 rclClient.xRight - rclClient.xLeft, 3253 rclClient.yTop - rclClient.yBottom, 3254 SWP_MOVE | SWP_SIZE | SWP_SHOW); 3255 } 3243 3256 } 3244 3257 } … … 3590 3603 flCmd2 = flCmd | DT_WORDBREAK | DT_TEXTATTRS; 3591 3604 3592 ulCharHeight = gpihQueryLineSpacing(hps , pszText);3605 ulCharHeight = gpihQueryLineSpacing(hps); 3593 3606 3594 3607 while ( (lDrawn) -
trunk/src/helpers/xstring.c
r15 r18 201 201 * 202 202 *@@added V0.9.6 (2000-11-01) [umoeller] 203 *@@changed V0.9.7 (2000-12-31) [umoeller]: added ulExtraAllocate 203 204 */ 204 205 205 206 void xstrInitCopy(PXSTRING pxstr, 206 const char *pcszSource) 207 const char *pcszSource, 208 ULONG ulExtraAllocate) // in: if > 0, extra memory to allocate 207 209 { 208 210 if (pxstr) … … 216 218 { 217 219 // we do have a source string: 218 pxstr->cbAllocated = pxstr->ulLength + 1 ;220 pxstr->cbAllocated = pxstr->ulLength + 1 + ulExtraAllocate; 219 221 pxstr->psz = (PSZ)malloc(pxstr->cbAllocated); 220 222 strcpy(pxstr->psz, pcszSource);
Note:
See TracChangeset
for help on using the changeset viewer.