Changeset 18


Ignore:
Timestamp:
Jan 1, 2001, 4:30:29 PM (25 years ago)
Author:
umoeller
Message:

Tons of updates.

Location:
trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/helpers/comctl.h

    r14 r18  
    7272        ULONG      ulAttr;
    7373        PFNWP      OldStaticProc;
    74         RECTL      rclBar;
    7574    } PROGRESSBARDATA, *PPROGRESSBARDATA;
    7675
  • trunk/include/helpers/dosh.h

    r17 r18  
    374374
    375375    APIRET doshSetEnvironmentVar(PDOSENVIRONMENT pEnv,
    376                                  PSZ pszNewEnv);
     376                                 PSZ pszNewEnv,
     377                                 BOOL fAddFirst);
    377378
    378379    APIRET doshConvertEnvironment(PDOSENVIRONMENT pEnv,
     
    392393     *      old DOS EXE header at offset 0
    393394     *      in any EXE file.
     395     *
     396     *@@changed V0.9.7 (2000-12-20) [umoeller]: fixed NE offset
    394397     */
    395398
     
    419422         ULONG  ulUnused6;              // 34:
    420423         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]
    422427    } DOSEXEHEADER, *PDOSEXEHEADER;
    423428
     
    440445        CHAR      achNE[2];             // 00: NE
    441446        BYTE      bLinkerVersion;       // 02: linker version
    442         BYTE      bLlinkerRevision;     // 03: linker revision
     447        BYTE      bLinkerRevision;      // 03: linker revision
    443448        USHORT    usEntryTblOfs;        // 04: ofs from this to entrytable
    444449        USHORT    usEntryTblLen;        // 06: length of entrytable
  • trunk/include/helpers/gpih.h

    r14 r18  
    154154                          LONG lPointSize);
    155155
    156     LONG gpihQueryLineSpacing(HPS hps,
    157                               PSZ pszText);
     156    LONG gpihQueryLineSpacing(HPS hps);
    158157
    159158    /* ******************************************************************
  • trunk/include/helpers/threads.h

    r14 r18  
    3636    #define THRF_PMMSGQUEUE     0x0001
    3737    #define THRF_WAIT           0x0002
     38    #define THRF_TRANSIENT      0x0004
    3839
    3940    /*
  • trunk/include/helpers/xstring.h

    r15 r18  
    5858    typedef XSTRINITSET *PXSTRINITSET;
    5959
    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);
    6262    typedef XSTRINITCOPY *PXSTRINITCOPY;
    6363
  • trunk/src/helpers/animate.c

    r17 r18  
    280280            rclDraw.yBottom = rclNow.yTop;
    281281            rclDraw.yTop = rclLast.yTop;
    282             WinFillRect(hps, &rclDraw, CLR_BLACK);
     282            WinFillRect(hps, &rclDraw, CLR_BLACK); // exclusive
    283283
    284284            // draw black rectangle left of rclNow
     
    287287            rclDraw.yBottom = rclLast.yBottom;
    288288            rclDraw.yTop = rclLast.yTop;
    289             WinFillRect(hps, &rclDraw, CLR_BLACK);
     289            WinFillRect(hps, &rclDraw, CLR_BLACK); // exclusive
    290290
    291291            // draw black rectangle right of rclNow
     
    294294            rclDraw.yBottom = rclLast.yBottom;
    295295            rclDraw.yTop = rclLast.yTop;
    296             WinFillRect(hps, &rclDraw, CLR_BLACK);
     296            WinFillRect(hps, &rclDraw, CLR_BLACK); // exclusive
    297297
    298298            // draw black rectangle at the bottom of rclNow
     
    301301            rclDraw.yBottom = rclLast.yBottom;
    302302            rclDraw.yTop = rclNow.yBottom;
    303             WinFillRect(hps, &rclDraw, CLR_BLACK);
     303            WinFillRect(hps, &rclDraw, CLR_BLACK); // exclusive
    304304
    305305            // remember rclNow for next iteration
     
    365365            rclDraw.yBottom = rclLast.yBottom;
    366366            rclDraw.yTop = rclLast.yTop;
    367             WinFillRect(hps, &rclDraw, CLR_BLACK);
     367            WinFillRect(hps, &rclDraw, CLR_BLACK); // exclusive
    368368
    369369            // draw black rectangle right of rclNow
     
    372372            rclDraw.yBottom = rclLast.yBottom;
    373373            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
    377377
    378378            // remember rclNow for next iteration
     
    391391                rclLast.yTop = rclScreen.yTop - rclLast.yBottom;
    392392
    393                 WinFillRect(hps, &rclLast, CLR_WHITE);
     393                WinFillRect(hps, &rclLast, CLR_WHITE); // exclusive
    394394            }
    395395        }
     
    435435            rclDraw.yBottom = rclNow.yTop;
    436436            rclDraw.yTop = rclLast.yTop;
    437             WinFillRect(hps, &rclDraw, CLR_BLACK);
     437            WinFillRect(hps, &rclDraw, CLR_BLACK); // exclusive
    438438
    439439            // draw black rectangle at the bottom of rclNow
     
    442442            rclDraw.yBottom = rclLast.yBottom;
    443443            rclDraw.yTop = rclNow.yBottom;
    444             WinFillRect(hps, &rclDraw, CLR_BLACK);
     444            WinFillRect(hps, &rclDraw, CLR_BLACK); // exclusive
    445445
    446446            // remember rclNow for next iteration
     
    473473    // sleep a while
    474474    DosSleep(ulWaitEnd / 2);
    475     WinFillRect(hps, &rclScreen, CLR_BLACK);
     475    WinFillRect(hps, &rclScreen, CLR_BLACK); // exclusive
    476476    DosSleep(ulWaitEnd / 2);
    477477
  • trunk/src/helpers/cctl_chart.c

    r14 r18  
    744744        sprintf(szDebug, "Error, no values set");
    745745        WinFillRect(hps,
    746                     &rclStatic,
     746                    &rclStatic,  // exclusive
    747747                    CLR_WHITE);
    748748        WinDrawText(hps,
  • trunk/src/helpers/cctl_progbar.c

    r14 r18  
    100100 */
    101101
    102 VOID PaintProgress(PPROGRESSBARDATA pData, HWND hwndBar, HPS hps)
     102VOID PaintProgress(PPROGRESSBARDATA pData,
     103                   HWND hwndBar,
     104                   PRECTL prclWin,      // in: window rectangle (WinQueryWindowRect)
     105                   HPS hps)
    103106{
    104     POINTL  ptl1, ptlText, aptlText[TXTBOX_COUNT];
    105     RECTL   rcl, rcl2;
    106 
     107    POINTL  ptlText; // , aptlText[TXTBOX_COUNT];
     108    BOOL    fBackgroundPainted = FALSE;
    107109    CHAR    szPercent[10] = "";
     110    RECTL   rclInnerButton;
     111    LONG    lcolScrollbar = WinQuerySysColor(HWND_DESKTOP,
     112                                             SYSCLR_SCROLLBAR,
     113                                             0);
    108114
    109115    // switch to RGB mode
    110     GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, NULL);
     116    gpihSwitchToRGB(hps);
    111117
    112118    if (pData->ulPaintX <= pData->ulOldPaintX)
    113119    {
    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
    139152    if (pData->ulAttr & PBA_PERCENTFLAGS)
    140153    {
    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
    142162        sprintf(szPercent, "%lu %%", ((100 * pData->ulNow) / pData->ulMax) );
    143 
    144163        // 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)
    152173                            )
    153174                        / 2);
    154         ptlText.y = 2 + pData->rclBar.yBottom +     // fixed V0.9.5 (2000-09-22) [umoeller]
    155                         (   (   (pData->rclBar.yTop-pData->rclBar.yBottom)
    156                               - (aptlText[TXTBOX_TOPLEFT].y-aptlText[TXTBOX_BOTTOMLEFT].y)
     175        ptlText.y =
     176                        (   (   (prclWin->yTop)       // cy
     177                              - (lLineSpacing)
    157178                            )
    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)
    168182        {
    169183            // if we haven't drawn the background already,
    170184            // 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);
    177193        }
    178194    }
    179195
    180     // now draw the actual progress
    181     rcl2.xLeft = pData->rclBar.xLeft;
    182     rcl2.xRight = (pData->ulPaintX > (rcl2.xLeft + 3))
    183             ? pData->ulPaintX
    184             : rcl2.xLeft + ((pData->ulAttr & PBA_BUTTONSTYLE)
    185                            ? 3 : 1);
    186     rcl2.yBottom = pData->rclBar.yBottom;
    187     rcl2.yTop = pData->rclBar.yTop-1;
    188 
    189196    if (pData->ulAttr & PBA_BUTTONSTYLE)
    190197    {
    191         RECTL rcl3 = rcl2;
    192198        // 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,
    198202                        WinQuerySysColor(HWND_DESKTOP, SYSCLR_BUTTONLIGHT, 0),
    199203                        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
    209215        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;
    215220        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);
    222228    }
    223229
     
    227233        GpiMove(hps, &ptlText);
    228234        GpiSetColor(hps, WinQuerySysColor(HWND_DESKTOP,
    229                 // SYSCLR_HILITEFOREGROUND,
    230                 SYSCLR_BUTTONDEFAULT,
    231             0));
     235                                          SYSCLR_BUTTONDEFAULT,
     236                                          0));
    232237        GpiCharString(hps, strlen(szPercent), szPercent);
    233238    }
     
    284289            case WM_UPDATEPROGRESSBAR:
    285290            {
     291                RECTL rclWin;
     292                WinQueryWindowRect(hwndBar, &rclWin);
    286293                if (    (ppd->ulNow != (ULONG)mp1)
    287294                     || (ppd->ulMax != (ULONG)mp2)
     
    309316                ppd->ulPaintX =
    310317                    (ULONG)(
    311                               (    (ULONG)(ppd->rclBar.xRight - ppd->rclBar.xLeft)
     318                              (    (ULONG)(rclWin.xRight - rclWin.xLeft - 2)
    312319                                 * (ULONG)(ppd->ulNow)
    313320                              )
     
    319326                    // WinInvalidateRect(hwndBar, NULL, FALSE);
    320327                    hps = WinGetPS(hwndBar);
    321                     PaintProgress(ppd, hwndBar, hps);
     328                    PaintProgress(ppd, hwndBar, &rclWin, hps);
    322329                    WinReleasePS(hps);
    323330                }
     
    326333            case WM_PAINT:
    327334            {
    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);
    331339                WinEndPaint(hps);
    332340            break; }
     
    401409        pData->ulAttr = ulAttr;
    402410        pData->OldStaticProc = OldStaticProc;
    403         WinQueryWindowRect(hwndChart, &(pData->rclBar));
    404         (pData->rclBar.xRight)--;
    405         (pData->rclBar.yTop)--;
    406411
    407412        WinSetWindowULong(hwndChart, QWL_USER, (ULONG)pData);
  • trunk/src/helpers/dosh2.c

    r17 r18  
    552552 *      If "VARNAME" has already been set to something
    553553 *      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.
    556561 *
    557562 *@@added V0.9.4 (2000-07-19) [umoeller]
     563 *@@changed V0.9.7 (2000-12-17) [umoeller]: added fAddFirst
    558564 */
    559565
    560566APIRET doshSetEnvironmentVar(PDOSENVIRONMENT pEnv,
    561                              PSZ pszNewEnv)
     567                             PSZ pszNewEnv,
     568                             BOOL fAddFirst)
    562569{
    563570    APIRET  arc = NO_ERROR;
     
    576583                free(*ppszEnvLine);
    577584                *ppszEnvLine = strdup(pszNewEnv);
     585                if (!(*ppszEnvLine))
     586                    arc = ERROR_NOT_ENOUGH_MEMORY;
    578587            }
    579588            else
    580589            {
    581                 PSZ *ppszNew;
    582                 PSZ *papszNew;
     590                PSZ *ppszNew = NULL;
     591                PSZ *papszNew = NULL;
    583592                // 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
    587614                if (!papszNew)
    588615                    arc = ERROR_NOT_ENOUGH_MEMORY;
     
    590617                {
    591618                    pEnv->papszVars = papszNew;
    592                     ppszNew = pEnv->papszVars + pEnv->cVars;
    593619                    pEnv->cVars++;
    594620                    *ppszNew = strdup(pszNewEnv);
     
    618644APIRET doshConvertEnvironment(PDOSENVIRONMENT pEnv,
    619645                              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
    621647{
    622648    APIRET  arc = NO_ERROR;
     
    652678            {
    653679                PSZ     pTarget = *ppszEnv;
    654                 *pulSize = cbNeeded;
     680                if (pulSize)
     681                    *pulSize = cbNeeded;
    655682                ppszThis = pEnv->papszVars;
    656683
     
    831858                            // specified in header
    832859                            arc = DosSetFilePtr(hFile,
    833                                                 (*ppExec)->pDosExeHeader->usNewHeaderOfs,
     860                                                (*ppExec)->pDosExeHeader->ulNewHeaderOfs,
    834861                                                FILE_BEGIN,
    835862                                                &ulLocal);
     
    847874                                // reset file ptr
    848875                                DosSetFilePtr(hFile,
    849                                               (*ppExec)->pDosExeHeader->usNewHeaderOfs,
     876                                              (*ppExec)->pDosExeHeader->ulNewHeaderOfs,
    850877                                              FILE_BEGIN,
    851878                                              &ulLocal);
  • trunk/src/helpers/gpih.c

    r14 r18  
    1515 *      example, WinQueryWindowRect returns an inclusive-exclusive
    1616 *      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.
    1823 *
    1924 *      Function prefixes (new with V0.81):
     
    194199 *      (bitmap) PS's also.
    195200 *
    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.
    201204 *
    202205 *      Changes to the HPS:
     
    272275 *      The specified rectangle is inclusive, that is, the top
    273276 *      right corner specifies the top right pixel to be drawn.
     277 *      This is different from WinFillRect.
    274278 *
    275279 *      If usWidth > 1, the additional pixels will be drawn towards
     
    288292
    289293VOID gpihDrawThickFrame(HPS hps,              // in: presentation space for output
    290                         PRECTL prcl,          // in: rectangle to draw (exclusive)
     294                        PRECTL prcl,          // in: rectangle to draw (inclusive)
    291295                        ULONG ulWidth)       // in: line width (>= 1)
    292296{
     
    318322 *      The specified rectangle is inclusive, that is, the top
    319323 *      right corner specifies the top right pixel to be drawn.
     324 *      This is different from WinFillRect.
    320325 *
    321326 *      If usWidth > 1, the additional pixels will be drawn towards
     
    324329 *
    325330 *@@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...
    326332 */
    327333
    328334VOID gpihDraw3DFrame(HPS hps,
    329                      PRECTL prcl,       // in: rectangle
     335                     PRECTL prcl,       // in: rectangle (inclusive)
    330336                     USHORT usWidth,    // in: line width (>= 1)
    331337                     LONG lColorLeft,   // in: color to use for left and top; e.g. SYSCLR_BUTTONLIGHT
     
    342348        ptl1.y = rcl2.yBottom;
    343349        GpiMove(hps, &ptl1);
    344         ptl1.y = rcl2.yTop-1;
     350        ptl1.y = rcl2.yTop;     // V0.9.7 (2000-12-20) [umoeller]
    345351        GpiLine(hps, &ptl1);
    346         ptl1.x = rcl2.xRight-1;
     352        ptl1.x = rcl2.xRight;   // V0.9.7 (2000-12-20) [umoeller]
    347353        GpiLine(hps, &ptl1);
    348354        GpiSetColor(hps, lColorRight);
     
    10631069 *      screen yourself and need the height of a text
    10641070 *      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
     1075LONG gpihQueryLineSpacing(HPS hps)
    10691076{
    10701077    FONTMETRICS fm;
    1071     POINTL aptlText[TXTBOX_COUNT];
    1072     GpiQueryTextBox(hps, strlen(pszText), pszText,
    1073                     TXTBOX_COUNT, (PPOINTL)&aptlText);
    10741078
    10751079    if (GpiQueryFontMetrics(hps, sizeof(FONTMETRICS), &fm))
    10761080        return ( (  fm.lMaxBaselineExt     // max vertical font space
    10771081                   +fm.lExternalLeading)    // space advised by font designer
    1078                  // * 12 / 10
    10791082               );
    10801083    else
  • trunk/src/helpers/stringh.c

    r14 r18  
    11181118 *      and, if pszCopyTo != NULL, copies the rest of the line to
    11191119 *      that buffer, of which cbCopyTo specified the size.
     1120 *
    11201121 *      If the key is not found, NULL is returned.
    11211122 *      String search is done by calling strhFindKey.
    11221123 *      This is useful for querying CONFIG.SYS settings.
    11231124 *
    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.
    11261129 */
    11271130
  • trunk/src/helpers/syssound.c

    r13 r18  
    173173 *@@changed V0.9.6 (2000-10-16) [umoeller]: now using MMBASE environment variable
    174174 *@@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
    175176 */
    176177
     
    186187        // variable set:
    187188        PSZ p;
    188         sprintf(szMMPM, "%s\\MMPM.INI", pszMMPMPath);
     189
     190        strcpy(szMMPM, pszMMPMPath); // V0.9.7 (2000-12-17) [umoeller]
     191
    189192        // kill semicolon if present
    190193        p = strchr(szMMPM, ';');
    191194        if (p)
    192195           *p = 0;
     196
     197        strcat(szMMPM, "\\MMPM.INI");
    193198    }
    194199    else
     
    251256    BOOL    rc = FALSE;
    252257    HINI    hiniMMPM = sndOpenMmpmIni(hab);
     258
     259    #ifdef DEBUG_SOUNDS
     260        _Pmpf((__FUNCTION__ ": entering, hiniMMPM is 0x%lX", hiniMMPM));
     261    #endif
     262
    253263    if (hiniMMPM)
    254264    {
     
    540550    APIRET arc = NO_ERROR;
    541551
    542     _Pmpf(("Entering sndLoadSoundScheme"));
     552    #ifdef DEBUG_SOUNDS
     553        _Pmpf(("Entering sndLoadSoundScheme"));
     554    #endif
    543555
    544556    if (hiniMMPM)
     
    550562                                    pszScheme,
    551563                                    NULL);
    552         _Pmpf(("    pszSchemeAppName: %s", pszSchemeAppName));
     564        #ifdef DEBUG_SOUNDS
     565            _Pmpf(("    pszSchemeAppName: %s", pszSchemeAppName));
     566        #endif
    553567
    554568        if (pszSchemeAppName)
     
    650664        arc = ERROR_INVALID_HANDLE;
    651665
    652     _Pmpf(("End of sndLoadSoundScheme, arc: %d", arc));
     666    #ifdef DEBUG_SOUNDS
     667        _Pmpf(("End of sndLoadSoundScheme, arc: %d", arc));
     668    #endif
    653669    return (arc);
    654670}
  • trunk/src/helpers/textview.c

    r14 r18  
    24762476                // reduce clip region to update rectangle
    24772477                GpiIntersectClipRectangle(ptxvd->hps,
    2478                                           &rcl2Update);
     2478                                          &rcl2Update);     // exclusive
    24792479
    24802480                // draw little box at the bottom right
     
    25022502                // this can be larger than "view text"
    25032503                WinFillRect(ptxvd->hps,
    2504                             &ptxvd->rclViewPaint,
     2504                            &ptxvd->rclViewPaint,       // exclusive
    25052505                            ptxvd->lBackColor);
    25062506
     
    25112511                rclClip.yTop = ptxvd->rclViewText.yTop - 1;
    25122512                GpiIntersectClipRectangle(ptxvd->hps,
    2513                                           &rclClip);
     2513                                          &rclClip);    // exclusive
    25142514                // finally, draw text lines in invalid rectangle;
    25152515                // this subfunction is smart enough to redraw only
  • trunk/src/helpers/threads.c

    r14 r18  
    6565 *
    6666 *@@added V0.9.2 (2000-03-05) [umoeller]
     67 *@@changed V0.9.7 (2000-12-18) [lafaix]: THRF_TRANSIENT support added
    6768 */
    6869
     
    106107            DosCloseEventSem(pti->hevRunning);
    107108
    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        }
    115124    }
    116125}
     
    174183 *@@changed V0.9.3 (2000-05-01) [umoeller]: added pbRunning and flFlags
    175184 *@@changed V0.9.5 (2000-08-26) [umoeller]: now using PTHREADINFO
     185 *@@changed V0.9.7 (2000-12-18) [lafaix]: THRF_TRANSIENT support added
    176186 */
    177187
     
    184194{
    185195    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    }
    186205
    187206    if (pti)
  • trunk/src/helpers/winh.c

    r17 r18  
    16081608 *      area and will adjust coordinates accordingly. This can
    16091609 *      happen when changing video resolutions.
     1610 *
     1611 *@@changed V0.9.7 (2000-12-20) [umoeller]: fixed invalid params if INI key not found
    16101612 */
    16111613
     
    16171619{
    16181620    BOOL    brc = FALSE;
    1619     SWP     swp, swpNow;
     1621    SWP     swp;
    16201622    ULONG   cbswp = sizeof(swp);
    1621     ULONG   fl2 = fl;
     1623    ULONG   fl2 = (fl & ~SWP_ZORDER);
    16221624
    16231625    if (PrfQueryProfileData(hIni, pszApp, pszKey, &swp, &cbswp))
     
    16311633        {
    16321634            // if no resize, we need to get the current position
     1635            SWP swpNow;
    16331636            brc = WinQueryWindowPos(hwnd, &swpNow);
    16341637            swp.cx = swpNow.cx;
     
    16491652    }
    16501653    else
     1654    {
    16511655        // window pos not found in INI: unset SWP_MOVE etc.
     1656        WinQueryWindowPos(hwnd, &swp);
    16521657        fl2 &= ~(SWP_MOVE | SWP_SIZE);
     1658    }
    16531659
    16541660    WinSetWindowPos(hwnd,
     
    21242130 *
    21252131 *      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);
    21332140 *
    21342141 *@@added V0.9.0 [umoeller]
     
    24942501 *@@added V0.9.6 (2000-10-16) [umoeller]
    24952502 *@@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
    24962504 */
    24972505
     
    25102518    ProgDetails.Length = sizeof(PROGDETAILS);
    25112519    ProgDetails.progt.fbVisible = SHE_VISIBLE;
    2512     ProgDetails.pszEnvironment = 0;
     2520    // ProgDetails.pszEnvironment = 0;
    25132521
    25142522    // memset(&ProgDetails.swpInitial, 0, sizeof(SWP));
     
    31563164 *      SWP structure (*pswpFrame).
    31573165 *
     3166 *      The client window is created with the frame as
     3167 *      its parent and owner and gets an ID of FID_CLIENT.
     3168 *
    31583169 *      Alternatively, you can set pswpFrame to NULL
    31593170 *      and specify FCF_SHELLPOSITION with flFrameCreateFlags.
     
    32153226        {
    32163227            if (pswpFrame)
     3228            {
    32173229                // position frame
    32183230                WinSetWindowPos(hwndFrame,
     
    32243236                                pswpFrame->fl);
    32253237
    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            }
    32433256        }
    32443257    }
     
    35903603    flCmd2 = flCmd | DT_WORDBREAK | DT_TEXTATTRS;
    35913604
    3592     ulCharHeight = gpihQueryLineSpacing(hps, pszText);
     3605    ulCharHeight = gpihQueryLineSpacing(hps);
    35933606
    35943607    while (   (lDrawn)
  • trunk/src/helpers/xstring.c

    r15 r18  
    201201 *
    202202 *@@added V0.9.6 (2000-11-01) [umoeller]
     203 *@@changed V0.9.7 (2000-12-31) [umoeller]: added ulExtraAllocate
    203204 */
    204205
    205206void xstrInitCopy(PXSTRING pxstr,
    206                   const char *pcszSource)
     207                  const char *pcszSource,
     208                  ULONG ulExtraAllocate)          // in: if > 0, extra memory to allocate
    207209{
    208210    if (pxstr)
     
    216218        {
    217219            // we do have a source string:
    218             pxstr->cbAllocated = pxstr->ulLength + 1;
     220            pxstr->cbAllocated = pxstr->ulLength + 1 + ulExtraAllocate;
    219221            pxstr->psz = (PSZ)malloc(pxstr->cbAllocated);
    220222            strcpy(pxstr->psz, pcszSource);
Note: See TracChangeset for help on using the changeset viewer.