Changeset 25


Ignore:
Timestamp:
Jan 17, 2001, 6:34:55 PM (25 years ago)
Author:
umoeller
Message:

Misc. changes for V0.9.7.

Location:
trunk
Files:
6 edited

Legend:

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

    r23 r25  
    8686    VOID gpihBox(HPS hps,
    8787                 LONG lControl,
    88                  PRECTL prcl,
    89                  LONG lColor);
     88                 PRECTL prcl);
    9089
    9190    VOID gpihMarker(HPS hps,
    9291                    LONG x,
    9392                    LONG y,
    94                     ULONG ulWidth,
    95                     LONG lColor);
     93                    ULONG ulWidth);
    9694
    9795    VOID gpihDrawThickFrame(HPS hps,
  • trunk/include/helpers/winh.h

    r14 r25  
    129129                                      SHORT iPosition,
    130130                                      SHORT sItemId,
    131                                       PSZ pszItemTitle,
     131                                      const char *pcszItemTitle,
    132132                                      SHORT afStyle,
    133133                                      SHORT afAttr);
     
    136136                                    ULONG iPosition,
    137137                                    SHORT sMenuId,
    138                                     PSZ pszSubmenuTitle,
     138                                    const char *pcszSubmenuTitle,
    139139                                    USHORT afMenuStyle,
    140140                                    SHORT sItemId,
    141                                     PSZ pszItemTitle,
     141                                    const char *pcszItemTitle,
    142142                                    USHORT afItemStyle,
    143143                                    USHORT afAttribute);
     
    469469    BOOL XWPENTRY winhHandleScrollMsg(HWND hwnd2Scroll,
    470470                                      HWND hwndScrollBar,
    471                                       PLONG plCurUnitOfs,
     471                                      PULONG pulCurPelsOfs,
    472472                                      PRECTL prcl2Scroll,
    473473                                      LONG ulViewportPels,
     
    490490     ********************************************************************/
    491491
    492     BOOL XWPENTRY winhSaveWindowPos(HWND hwnd, HINI hIni, PSZ pszApp, PSZ pszKey);
    493 
    494     BOOL XWPENTRY winhRestoreWindowPos(HWND hwnd, HINI hIni, PSZ pszApp, PSZ pszKey, ULONG fl);
     492    BOOL XWPENTRY winhSaveWindowPos(HWND hwnd, HINI hIni, const char *pcszApp, const char *pcszKey);
     493
     494    BOOL XWPENTRY winhRestoreWindowPos(HWND hwnd, HINI hIni, const char *pcszApp, const char *pcszKey, ULONG fl);
    495495
    496496    #define XAC_MOVEX       0x0001
     
    571571    #ifdef INCL_WINHELP
    572572        HWND XWPENTRY winhCreateHelp(HWND hwndFrame,
    573                                      PSZ pszFileName,
     573                                     const char *pcszFileName,
    574574                                     HMODULE hmod,
    575575                                     PHELPTABLE pHelpTable,
    576                                      PSZ pszWindowTitle);
     576                                     const char *pcszWindowTitle);
    577577
    578578        void XWPENTRY winhDestroyHelp(HWND hwndHelp, HWND hwndFrame);
     
    589589    #endif
    590590
    591     BOOL XWPENTRY winhAnotherInstance(PSZ pszSemName, BOOL fSwitch);
     591    BOOL XWPENTRY winhAnotherInstance(const char *pcszSemName, BOOL fSwitch);
    592592
    593593    HSWITCH XWPENTRY winhAddToTasklist(HWND hwnd, HPOINTER hIcon);
     
    613613                              ULONG flFlags,
    614614                              HINI hini,
    615                               PSZ pszApplication,
    616                               PSZ pszKey);
     615                              const char *pcszApplication,
     616                              const char *pcszKey);
    617617
    618618    HPOINTER XWPENTRY winhSetWaitPointer(VOID);
     
    629629
    630630    BOOL XWPENTRY winhReplaceWindowText(HWND hwnd,
    631                                         PSZ pszSearch,
    632                                         PSZ pszReplaceWith);
     631                                        const char *pcszSearch,
     632                                        const char *pcszReplaceWith);
    633633
    634634    ULONG XWPENTRY winhCenteredDlgBox(HWND hwndParent, HWND hwndOwner,
     
    647647                                      ULONG flFrameCreateFlags,
    648648                                      ULONG ulFrameStyle,
    649                                       PSZ pszFrameTitle,
     649                                      const char *pcszFrameTitle,
    650650                                      ULONG ulResourcesID,
    651                                       PSZ pszClassClient,
     651                                      const char *pcszClassClient,
    652652                                      ULONG flStyleClient,
    653653                                      ULONG ulID,
     
    655655                                      PHWND phwndClient);
    656656
    657     /*
    658      *@@ winhCreateObjectWindow:
    659      *      creates an object window of the specified
    660      *      window class, which you should have registered
    661      *      before calling this. pvCreateParam will be
    662      *      given to the window on WM_CREATE.
    663      *
    664      *      Returns the HWND of the object window or
    665      *      NULLHANDLE on errors.
    666      *
    667      *@@added V0.9.3 (2000-04-17) [umoeller]
    668      */
    669 
    670     #define winhCreateObjectWindow(pcszWindowClass, pvCreateParam) \
    671                 WinCreateWindow(HWND_OBJECT, pcszWindowClass,   \
    672                     (PSZ)"", 0, 0,0,0,0, 0, HWND_BOTTOM, 0, pvCreateParam, NULL)
     657    HWND winhCreateObjectWindow(const char *pcszWindowClass,
     658                                PVOID pvCreateParam);
    673659
    674660    VOID XWPENTRY winhRepaintWindows(HWND hwndParent);
     
    684670                                 ULONG ulDownUnits);
    685671
    686     ULONG XWPENTRY winhDrawFormattedText(HPS hps, PRECTL prcl, PSZ pszText, ULONG flCmd);
     672    ULONG XWPENTRY winhDrawFormattedText(HPS hps, PRECTL prcl, const char *pcszText, ULONG flCmd);
    687673
    688674    #ifdef INCL_WINSWITCHLIST
  • trunk/src/helpers/cctl_chart.c

    r21 r25  
    196196
    197197            // fill bitmap with static's background color
     198            GpiSetColor(hpsMem, lBackgroundColor);
    198199            gpihBox(hpsMem,
    199200                    DRO_FILL,
    200                     &rclWholeStatic,
    201                     lBackgroundColor);
     201                    &rclWholeStatic);
    202202
    203203            // We'll paint into the bitmap in two loops:
  • trunk/src/helpers/gpih.c

    r23 r25  
    225225 *      This is different from WinFillRect.
    226226 *
     227 *      If (lColor != -1), the HPS's current foreground color
     228 *      is changed to that color.
     229 *
    227230 *      Changes to the HPS:
    228  *      --  the current (foreground) color is changed to
    229  *          lBackColor;
    230  *      --  the current area color is changed to lForeColor;
     231 *
    231232 *      --  the current position is moved to the lower left
    232233 *          corner of *prcl.
     
    234235 *@@changed V0.9.0 [umoeller]: renamed from gpihFillRect
    235236 *@@changed V0.9.0 [umoeller]: modified function prototype to support lControl
     237 *@@changed V0.9.7 (2001-01-17) [umoeller]: removed lColor
    236238 */
    237239
    238240VOID gpihBox(HPS hps,              // in: presentation space for output
    239241             LONG lControl,        // in: one of DRO_OUTLINE, DRO_FILL, DRO_OUTLINEFILL
    240              PRECTL prcl,          // in: rectangle to draw (exclusive)
    241              LONG lColor)          // in: color for outline and/or fill
     242             PRECTL prcl)          // in: rectangle to draw (exclusive)
    242243{
    243244    POINTL      ptl;
    244245
    245     GpiSetColor(hps, lColor);
    246246    ptl.x = prcl->xLeft;
    247247    ptl.y = prcl->yBottom;
     
    263263 *
    264264 *      No PS data is changed.
     265 *
     266 *@@changed V0.9.7 (2001-01-17) [umoeller]: removed lColor
    265267 */
    266268
     
    268270                LONG x,             // in: x-center of rectangle
    269271                LONG y,             // in: y-center of rectangle
    270                 ULONG ulWidth,      // in: rectangle width and height
    271                 LONG lColor)        // in: color
     272                ULONG ulWidth)      // in: rectangle width and height
    272273{
    273274    POINTL  ptlSave;
    274     LONG    lColorSave;
    275275    RECTL   rclTemp;
    276276    ULONG   ulWidth2 = ulWidth / 2;
     
    280280    rclTemp.yTop    = y + ulWidth2;
    281281
    282     lColorSave = GpiQueryColor(hps);
    283282    GpiQueryCurrentPosition(hps, &ptlSave);
    284283    gpihBox(hps,
    285284            DRO_FILL,
    286             &rclTemp,
    287             lColor);
     285            &rclTemp);
    288286    GpiMove(hps, &ptlSave);
    289     GpiSetColor(hps, lColorSave);
    290287}
    291288
     
    746743 *          semaphore is held by the wrapper. Then use only
    747744 *          the wrapper in your code.
     745 *
     746 *      <B>Font metrics:</B>
     747 *
     748 *      The important values in the returned FONTMETRICS are
     749 *      like this (according to PMREF):
     750 *
     751 +   ÉÍ ________________________________________________
     752 +   º
     753 +   º lExternalLeading, according to font designer.
     754 +   º  ________________________________________________  Í»
     755 +   ÈÍ                                                    º
     756 +                                  #       #              º
     757 +                                  ##     ##              º lMaxAscender (of entire;
     758 +   ÉÍ _______________             # #   # #              º font); this can be > capital
     759 +   º                 ####         #  # #  #              º letters because miniscules
     760 +   º                #    #        #   #   #              º can exceed that.
     761 +   º  lXHeight      #    #        #       #              º
     762 +   º                #    #        #       #              º
     763 +   º                #    #        #       #              º
     764 +   º  _______________#####________#_______#___ baseline Í»
     765 +   ÈÍ                    #                               º
     766 +                         #                               º lMaxDescender
     767 +      ______________ ####______________________________ ÍŒ
     768 +
     769 *
     770 *      In turn, lMaxBaselineExt is lMaxAscender + lMaxDescender.
     771 *
     772 *      Soooo... to find out about the optimal line spacing, GPIREF
     773 *      recommends to use lMaxBaselineExt + lExternalLeading.
    748774 *
    749775 *@@added V0.9.0 [umoeller]
  • trunk/src/helpers/textview.c

    r23 r25  
    14931493                                       // can be NULL to paint all
    14941494                  LONG lViewXOfs,      // in: x offset to paint; 0 means rightmost
    1495                   PLONG plViewYOfs,    // in: y offset to paint; 0 means _top_most;
     1495                  PULONG pulViewYOfs,  // in: y offset to paint; 0 means _top_most;
    14961496                                       // out: y offset which should be passed to next call
    14971497                                       // (if TRUE is returned and fPaintHalfLines == FALSE)
     
    15051505            fAnyLinesPainted = FALSE;
    15061506    ULONG   ulCurrentLineIndex = *pulLineIndex;
    1507     // LONG    lViewYOfsSaved = *plViewYOfs;
     1507    // LONG    lViewYOfsSaved = *pulViewYOfs;
    15081508    PLISTNODE pRectNode = lstNodeFromIndex(&pxfd->llRectangles,
    15091509                                           ulCurrentLineIndex);
     
    15211521        rclLine.xLeft = pLineRcl->rcl.xLeft - lViewXOfs;
    15221522        rclLine.xRight = pLineRcl->rcl.xRight - lViewXOfs;
    1523         rclLine.yBottom = pLineRcl->rcl.yBottom + *plViewYOfs;
    1524         rclLine.yTop = pLineRcl->rcl.yTop + *plViewYOfs;
     1523        rclLine.yBottom = pLineRcl->rcl.yBottom + *pulViewYOfs;
     1524        rclLine.yTop = pLineRcl->rcl.yTop + *pulViewYOfs;
    15251525
    15261526        /* if (pmpf)
     
    16821682                    // return TRUE
    16831683                    brc = TRUE;
    1684                     // and set *plViewYOfs to the top of
     1684                    // and set *pulViewYOfs to the top of
    16851685                    // the next line, which wasn't visible
    16861686                    // on the page any more
    1687                     *plViewYOfs = pLineRcl2->rcl.yTop + *plViewYOfs;
     1687                    *pulViewYOfs = pLineRcl2->rcl.yTop + *pulViewYOfs;
    16881688                }
    16891689                break;
     
    18441844            rclViewText;        // same as rclViewPaint, but excluding cdata borders
    18451845
    1846     LONG    lViewXOfs,          // pixels that we have scrolled to the RIGHT; 0 means very left
    1847             lViewYOfs;          // pixels that we have scrolled to the BOTTOM; 0 means very top
     1846    ULONG   ulViewXOfs,         // pixels that we have scrolled to the RIGHT; 0 means very left
     1847            ulViewYOfs;         // pixels that we have scrolled to the BOTTOM; 0 means very top
    18481848
    18491849    BOOL    fAcceptsPresParamsNow; // TRUE after first WM_PAINT
     
    20092009    ulWinCY = (ptxvd->rclViewText.yTop - ptxvd->rclViewText.yBottom);
    20102010
    2011     if (ptxvd->lViewYOfs < 0)
    2012         ptxvd->lViewYOfs = 0;
    2013     if (ptxvd->lViewYOfs > ((LONG)ptxvd->xfd.ulViewportCY - ulWinCY))
    2014         ptxvd->lViewYOfs = (LONG)ptxvd->xfd.ulViewportCY - ulWinCY;
     2011    if (ptxvd->ulViewYOfs < 0)
     2012        ptxvd->ulViewYOfs = 0;
     2013    if (ptxvd->ulViewYOfs > ((LONG)ptxvd->xfd.ulViewportCY - ulWinCY))
     2014        ptxvd->ulViewYOfs = (LONG)ptxvd->xfd.ulViewportCY - ulWinCY;
    20152015
    20162016    // vertical scroll bar enabled at all?
     
    20202020                                            ulWinCY,
    20212021                                            ptxvd->xfd.ulViewportCY,
    2022                                             ptxvd->lViewYOfs,
     2022                                            ptxvd->ulViewYOfs,
    20232023                                            (ptxvd->cdata.flStyle & XTXF_AUTOVHIDE));
    20242024        // is auto-hide on?
     
    20512051                                            ulWinCX,
    20522052                                            ptxvd->xfd.ulViewportCX,
    2053                                             ptxvd->lViewXOfs,
     2053                                            ptxvd->ulViewXOfs,
    20542054                                            (ptxvd->cdata.flStyle & XTXF_AUTOHHIDE));
    20552055        // is auto-hide on?
     
    20842084{
    20852085    ULONG   ulLineIndex = 0;
    2086     LONG    lYOfs = ptxvd->lViewYOfs;
     2086    ULONG   ulYOfs = ptxvd->ulViewYOfs;
    20872087    txvPaintText(ptxvd->hab,
    20882088                 ptxvd->hps,        // paint PS: screen
    20892089                 &ptxvd->xfd,       // formatting data
    20902090                 prcl2Paint,        // update rectangle given to us
    2091                  ptxvd->lViewXOfs,  // current X scrolling offset
    2092                  &lYOfs,            // current Y scrolling offset
     2091                 ptxvd->ulViewXOfs,  // current X scrolling offset
     2092                 &ulYOfs,            // current Y scrolling offset
    20932093                 TRUE,              // draw even partly visible lines
    20942094                 &ulLineIndex);
     
    21402140
    21412141    RECTL           rclLine;
    2142     rclLine.xLeft = pLineRcl->rcl.xLeft - ptxvd->lViewXOfs;
    2143     rclLine.xRight = pLineRcl->rcl.xRight - ptxvd->lViewXOfs;
    2144     rclLine.yBottom = pLineRcl->rcl.yBottom + ptxvd->lViewYOfs;
    2145     rclLine.yTop = pLineRcl->rcl.yTop + ptxvd->lViewYOfs;
     2142    rclLine.xLeft = pLineRcl->rcl.xLeft - ptxvd->ulViewXOfs;
     2143    rclLine.xRight = pLineRcl->rcl.xRight - ptxvd->ulViewXOfs;
     2144    rclLine.yBottom = pLineRcl->rcl.yBottom + ptxvd->ulViewYOfs;
     2145    rclLine.yTop = pLineRcl->rcl.yTop + ptxvd->ulViewYOfs;
    21462146
    21472147    if (pWordThis->usAnchor)
     
    21492149
    21502150    // x start: this word's X coordinate
    2151     ptlStart.x = pWordThis->lX - ptxvd->lViewXOfs;
     2151    ptlStart.x = pWordThis->lX - ptxvd->ulViewXOfs;
    21522152    // y start: bottom line of rectangle plus highest
    21532153    // base line offset found in all words (format step 2)
     
    21752175                       &rclLine,
    21762176                       pWordThis,
    2177                        ptxvd->lViewXOfs);
     2177                       ptxvd->ulViewXOfs);
    21782178}
    21792179
     
    23992399                            pwndParams->pszText,
    24002400                            0);
    2401                     ptxvd->lViewXOfs = 0;
    2402                     ptxvd->lViewYOfs = 0;
     2401                    ptxvd->ulViewXOfs = 0;
     2402                    ptxvd->ulViewYOfs = 0;
    24032403                    /* ptxvd->fVScrollVisible = FALSE;
    24042404                    ptxvd->fHScrollVisible = FALSE; */
     
    25812581                winhHandleScrollMsg(hwndTextView,
    25822582                                    ptxvd->hwndVScroll,
    2583                                     &ptxvd->lViewYOfs,
     2583                                    &ptxvd->ulViewYOfs,
    25842584                                    &ptxvd->rclViewText,
    25852585                                    ptxvd->xfd.ulViewportCY,
     
    26012601                winhHandleScrollMsg(hwndTextView,
    26022602                                    ptxvd->hwndHScroll,
    2603                                     &ptxvd->lViewXOfs,
     2603                                    &ptxvd->ulViewXOfs,
    26042604                                    &ptxvd->rclViewText,
    26052605                                    ptxvd->xfd.ulViewportCX,
     
    26572657            PLISTNODE pWordNodeClicked = NULL;
    26582658
    2659             ptlPos.x = SHORT1FROMMP(mp1) + ptxvd->lViewXOfs;
    2660             ptlPos.y = SHORT2FROMMP(mp1) - ptxvd->lViewYOfs;
     2659            ptlPos.x = SHORT1FROMMP(mp1) + ptxvd->ulViewXOfs;
     2660            ptlPos.y = SHORT2FROMMP(mp1) - ptxvd->ulViewYOfs;
    26612661
    26622662            if (hwndTextView != WinQueryFocus(HWND_DESKTOP))
     
    27212721            HWND        hwndOwner = NULLHANDLE;
    27222722
    2723             ptlPos.x = SHORT1FROMMP(mp1) + ptxvd->lViewXOfs;
    2724             ptlPos.y = SHORT2FROMMP(mp1) - ptxvd->lViewYOfs;
     2723            ptlPos.x = SHORT1FROMMP(mp1) + ptxvd->ulViewXOfs;
     2724            ptlPos.y = SHORT2FROMMP(mp1) - ptxvd->ulViewYOfs;
    27252725            WinSetCapture(HWND_DESKTOP, NULLHANDLE);
    27262726
     
    30373037                        // and then have lower y coordinates down to way in the negatives,
    30383038                        // to get the y offset, we must...
    3039                         ptxvd->lViewYOfs = (-pRect->rcl.yTop) - ulWinCY;
    3040 
    3041                         if (ptxvd->lViewYOfs < 0)
    3042                             ptxvd->lViewYOfs = 0;
    3043                         if (ptxvd->lViewYOfs > ((LONG)ptxvd->xfd.ulViewportCY - ulWinCY))
    3044                             ptxvd->lViewYOfs = (LONG)ptxvd->xfd.ulViewportCY - ulWinCY;
     3039                        ptxvd->ulViewYOfs = (-pRect->rcl.yTop) - ulWinCY;
     3040
     3041                        if (ptxvd->ulViewYOfs < 0)
     3042                            ptxvd->ulViewYOfs = 0;
     3043                        if (ptxvd->ulViewYOfs > ((LONG)ptxvd->xfd.ulViewportCY - ulWinCY))
     3044                            ptxvd->ulViewYOfs = (LONG)ptxvd->xfd.ulViewportCY - ulWinCY;
    30453045
    30463046                        // vertical scroll bar enabled at all?
     
    30503050                                                                ulWinCY,
    30513051                                                                ptxvd->xfd.ulViewportCY,
    3052                                                                 ptxvd->lViewYOfs,
     3052                                                                ptxvd->ulViewYOfs,
    30533053                                                                (ptxvd->cdata.flStyle & XTXF_AUTOVHIDE));
    30543054                            WinInvalidateRect(hwndTextView, NULL, FALSE);
     
    34403440    ULONG       ulCurrentLineIndex = 0,
    34413441                ulCurrentPage = 1;
    3442     LONG        lCurrentYOfs = 0;
     3442    ULONG       ulCurrentYOfs = 0;
    34433443
    34443444    /* MATRIXLF    matlf;
     
    35103510                                    &rclPageWorld,
    35113511                                    0,
    3512                                     &lCurrentYOfs,
     3512                                    &ulCurrentYOfs,
    35133513                                    FALSE,      // draw only fully visible lines
    35143514                                    &ulCurrentLineIndex); // in/out: line to start with
  • trunk/src/helpers/winh.c

    r23 r25  
    109109                                            //      insert or MIT_END
    110110                         SHORT sItemId,     // in:  ID of new menu item
    111                          PSZ pszItemTitle,  // in:  title of new menu item
     111                         const char *pcszItemTitle,  // in:  title of new menu item
    112112                         SHORT afStyle,
    113113                            // in:  MIS_* style flags.
     
    168168                                  MM_INSERTITEM,
    169169                                  (MPARAM)&mi,
    170                                   (MPARAM)pszItemTitle));
     170                                  (MPARAM)pcszItemTitle));
    171171    return (src);
    172172}
     
    186186                       ULONG iPosition,     // in: index where to add submenu or MIT_END
    187187                       SHORT sMenuId,       // in: menu ID of new submenu
    188                        PSZ pszSubmenuTitle, // in: title of new submenu
     188                       const char *pcszSubmenuTitle, // in: title of new submenu
    189189                       USHORT afMenuStyle,  // in: MIS* style flags for submenu;
    190190                                            // MIS_SUBMENU will always be added
    191191                       SHORT sItemId,       // in: ID of first item to add to submenu;
    192192                                            // if 0, no first item is inserted
    193                        PSZ pszItemTitle,    // in: title of this item
     193                       const char *pcszItemTitle,    // in: title of this item
    194194                                            // (if sItemID != 0)
    195195                       USHORT afItemStyle,  // in: style flags for this item, e.g. MIS_TEXT
     
    216216        mi.hwndSubMenu = hwndNewMenu;
    217217        mi.hItem = 0;
    218         src = SHORT1FROMMR(WinSendMsg(hwndMenu, MM_INSERTITEM, (MPARAM)&mi, (MPARAM)pszSubmenuTitle));
     218        src = SHORT1FROMMR(WinSendMsg(hwndMenu, MM_INSERTITEM, (MPARAM)&mi, (MPARAM)pcszSubmenuTitle));
    219219        if (    (src != MIT_MEMERROR)
    220220            &&  (src != MIT_ERROR)
     
    237237                           MM_INSERTITEM,
    238238                           (MPARAM)&mi,
    239                            (MPARAM)pszItemTitle);
     239                           (MPARAM)pcszItemTitle);
    240240            }
    241241        }
     
    10591059 *      extension, and position, all in one shot.
    10601060 *
     1061 *      This function usually gets called when the window is
     1062 *      created and later when the window is resized.
     1063 *
    10611064 *      This simplifies the typical functionality of a scroll
    10621065 *      bar in a client window which is to be scrolled. I am
     
    10681071 *
    10691072 *      -- "window": the actual window with scroll bars which displays
    1070  *         a subrectangle of the available data.
     1073 *         a subrectangle of the available data. With a typical PM
     1074 *         application, this will be your client window.
     1075 *
    10711076 *         The width or height of this must be passed in ulWinPels.
    10721077 *
    10731078 *      -- "viewport": the entire data to be displayed, of which the
    10741079 *         "window" can only display a subrectangle, if the viewport
    1075  *         is larger than the window. The width or height of this must be
    1076  *         passed in ulViewportPels. This can be smaller than ulWinPels (if the
    1077  *         window is larger than the data), the same or larger than ulWinPels
     1080 *         is larger than the window.
     1081 *
     1082 *         The width or height of this must be passed in ulViewportPels.
     1083 *         This can be smaller than ulWinPels (if the window is larger
     1084 *         than the data) or the same or larger than ulWinPels
    10781085 *         (if the window is too small to show all the data).
    10791086 *
    10801087 *      -- "window offset": the offset of the current window within
    1081  *         the viewport. For horizontal scroll bars, this is
    1082  *         the X coordinate, counting from the left of the window
    1083  *         (0 means leftmost).
     1088 *         the viewport.
     1089 *
     1090 *         For horizontal scroll bars, this is the X coordinate,
     1091 *         counting from the left of the window (0 means leftmost).
     1092 *
    10841093 *         For vertical scroll bars, this is counted from the _top_
    10851094 *         of the viewport (0 means topmost, as opposed to OS/2
    1086  *         window coordinates!).
    1087  *         This is because for vertical scroll bars controls, higher
    1088  *         values move the thumb _down_.
    1089  *
    1090  *      The scroll bar is disabled if the entire viewport is visible,
     1095 *         window coordinates!). This is because for vertical scroll
     1096 *         bars controls, higher values move the thumb _down_. Yes
     1097 *         indeed, this conflicts with PM's coordinate system.
     1098 *
     1099 *         The window offset is therefore always positive.
     1100 *
     1101 *      The scroll bar gets disabled if the entire viewport is visible,
    10911102 *      that is, if ulViewportPels <= ulWinPels. In that case
    10921103 *      FALSE is returned. If (fAutoHide == TRUE), the scroll
     
    10991110 *      bars, 0 means topmost (which is kinda sick with the OS/2
    11001111 *      coordinate system), for horizontal scroll bars, 0 means leftmost.
    1101  *      The maximum value of the scroll bar will be:
     1112 *
     1113 *      The maximum value of the scroll bar will be
     1114 *
    11021115 +          (ulViewportPels - ulWinPels) / usScrollUnitPels
    11031116 *
     
    12101223 *      on values starting from zero. The maximum value
    12111224 *      of the scroll bar is:
     1225 *
    12121226 +          ulViewportPels - (prcl2Scroll->yTop - prcl2Scroll->yBottom)
    12131227 *
     
    12241238 *@@changed V0.9.3 (2000-04-30) [umoeller]: changed prototype, fixed pels/unit confusion
    12251239 *@@changed V0.9.3 (2000-05-08) [umoeller]: now handling scroll units automatically
     1240 *@@changed V0.9.7 (2001-01-17) [umoeller]: changed PLONG to PULONG
    12261241 */
    12271242
    12281243BOOL winhHandleScrollMsg(HWND hwnd2Scroll,          // in: client window to scroll
    12291244                         HWND hwndScrollBar,        // in: vertical or horizontal scroll bar window
    1230                          PLONG plCurPelsOfs,        // in/out: current viewport offset;
     1245                         PULONG pulCurPelsOfs,      // in/out: current viewport offset;
    12311246                                                    // this is updated with the proper scroll units
    12321247                         PRECTL prcl2Scroll,        // in: hwnd2Scroll rectangle to scroll
     
    12431258                                                    // see PMREF for details
    12441259{
    1245     LONG    lOldPelsOfs = *plCurPelsOfs;
     1260    ULONG   ulOldPelsOfs = *pulCurPelsOfs;
    12461261    USHORT  usPosUnits = SHORT1FROMMP(mp2), // in scroll units
    12471262            usCmd = SHORT2FROMMP(mp2);
     
    12671282    {
    12681283        case SB_LINEUP:
    1269             // _Pmpf(("SB_LINEUP"));
    1270             *plCurPelsOfs -= usLineStepPels;  //  * usScrollUnitPels);
     1284            if (*pulCurPelsOfs > usLineStepPels)
     1285                *pulCurPelsOfs -= usLineStepPels;  //  * usScrollUnitPels);
     1286            else
     1287                *pulCurPelsOfs = 0;
    12711288        break;
    12721289
    12731290        case SB_LINEDOWN:
    1274             // _Pmpf(("SB_LINEDOWN"));
    1275             *plCurPelsOfs += usLineStepPels;  //  * usScrollUnitPels);
     1291            *pulCurPelsOfs += usLineStepPels;  //  * usScrollUnitPels);
    12761292        break;
    12771293
    12781294        case SB_PAGEUP:
    1279             *plCurPelsOfs -= ulWinPels; // convert to units
     1295            if (*pulCurPelsOfs > ulWinPels)
     1296                *pulCurPelsOfs -= ulWinPels; // convert to units
     1297            else
     1298                *pulCurPelsOfs = 0;
    12801299        break;
    12811300
    12821301        case SB_PAGEDOWN:
    1283             *plCurPelsOfs += ulWinPels; // convert to units
     1302            *pulCurPelsOfs += ulWinPels; // convert to units
    12841303        break;
    12851304
    12861305        case SB_SLIDERTRACK:
    1287             *plCurPelsOfs = (usPosUnits * usScrollUnitPels);
     1306            *pulCurPelsOfs = (usPosUnits * usScrollUnitPels);
    12881307            // _Pmpf(("    SB_SLIDERTRACK: usUnits = %d", usPosUnits));
    12891308        break;
    12901309
    12911310        case SB_SLIDERPOSITION:
    1292             *plCurPelsOfs = (usPosUnits * usScrollUnitPels);
     1311            *pulCurPelsOfs = (usPosUnits * usScrollUnitPels);
    12931312        break;
    12941313    }
     
    13041323    } */
    13051324
    1306     if (*plCurPelsOfs < 0)
    1307         *plCurPelsOfs = 0;
    1308     if (*plCurPelsOfs > (lMaxAllowedUnitOfs * usScrollUnitPels))
     1325    /* if (*plCurPelsOfs < 0)
     1326        *plCurPelsOfs = 0; */       // checked above
     1327    if (*pulCurPelsOfs > (lMaxAllowedUnitOfs * usScrollUnitPels))
    13091328    {
    13101329        // _Pmpf(("        !!! limiting 2: %d to %d", *plCurUnitOfs, lMaxAllowedUnitOfs));
    1311         *plCurPelsOfs = (lMaxAllowedUnitOfs * usScrollUnitPels);
    1312     }
    1313     if (    (*plCurPelsOfs != lOldPelsOfs)
    1314          || (*plCurPelsOfs == 0)
    1315          || (*plCurPelsOfs == (lMaxAllowedUnitOfs * usScrollUnitPels))
     1330        *pulCurPelsOfs = (lMaxAllowedUnitOfs * usScrollUnitPels);
     1331    }
     1332    if (    (*pulCurPelsOfs != ulOldPelsOfs)
     1333         || (*pulCurPelsOfs == 0)
     1334         || (*pulCurPelsOfs == (lMaxAllowedUnitOfs * usScrollUnitPels))
    13161335       )
    13171336    {
     
    13221341        WinSendMsg(hwndScrollBar,
    13231342                   SBM_SETPOS,
    1324                    (MPARAM)(*plCurPelsOfs / usScrollUnitPels), //  / usScrollUnit),
     1343                   (MPARAM)(*pulCurPelsOfs / usScrollUnitPels), //  / usScrollUnit),
    13251344                   0);
    13261345        // scroll window rectangle:
     
    13331352            WinScrollWindow(hwnd2Scroll,
    13341353                            0,
    1335                             (*plCurPelsOfs - lOldPelsOfs)  // scroll units changed
     1354                            (*pulCurPelsOfs - ulOldPelsOfs)  // scroll units changed
    13361355                            ,    // * usScrollUnitPels,     // convert to pels
    13371356                            &rcl2Scroll,  // rcl to scroll
     
    13421361        else
    13431362            WinScrollWindow(hwnd2Scroll,
    1344                             -(*plCurPelsOfs - lOldPelsOfs) // scroll units changed
     1363                            -(LONG)(*pulCurPelsOfs - ulOldPelsOfs) // scroll units changed
    13451364                            ,    // * usScrollUnitPels,
    13461365                            0,
     
    15551574BOOL winhSaveWindowPos(HWND hwnd,   // in: window to save
    15561575                       HINI hIni,   // in: INI file (or HINI_USER/SYSTEM)
    1557                        PSZ pszApp,  // in: INI application name
    1558                        PSZ pszKey)  // in: INI key name
     1576                       const char *pcszApp,  // in: INI application name
     1577                       const char *pcszKey)  // in: INI key name
    15591578{
    15601579    BOOL brc = FALSE;
     
    15721591        }
    15731592
    1574         brc = PrfWriteProfileData(hIni, pszApp, pszKey, &swp, sizeof(swp));
     1593        brc = PrfWriteProfileData(hIni, (PSZ)pcszApp, (PSZ)pcszKey, &swp, sizeof(swp));
    15751594    }
    15761595    return (brc);
     
    16141633BOOL winhRestoreWindowPos(HWND hwnd,   // in: window to restore
    16151634                          HINI hIni,   // in: INI file (or HINI_USER/SYSTEM)
    1616                           PSZ pszApp,  // in: INI application name
    1617                           PSZ pszKey,  // in: INI key name
     1635                          const char *pcszApp,  // in: INI application name
     1636                          const char *pcszKey,  // in: INI key name
    16181637                          ULONG fl)    // in: "fl" parameter for WinSetWindowPos
    16191638{
     
    16231642    ULONG   fl2 = (fl & ~SWP_ZORDER);
    16241643
    1625     if (PrfQueryProfileData(hIni, pszApp, pszKey, &swp, &cbswp))
     1644    if (PrfQueryProfileData(hIni, (PSZ)pcszApp, (PSZ)pcszKey, &swp, &cbswp))
    16261645    {
    16271646        ULONG ulScreenCX = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN);
     
    23412360 */
    23422361
    2343 HWND winhCreateHelp(HWND    hwndFrame,      // in: app's frame window handle; can be NULLHANDLE
    2344                     PSZ     pszFileName,    // in: help file name or NULL
     2362HWND winhCreateHelp(HWND hwndFrame,      // in: app's frame window handle; can be NULLHANDLE
     2363                    const char *pcszFileName,    // in: help file name or NULL
    23452364                    HMODULE hmod,           // in: module with help table or NULLHANDLE (current)
    23462365                    PHELPTABLE pHelpTable,  // in: help table or resource ID
    2347                     PSZ     pszWindowTitle) // in: help window title or NULL
     2366                    const char *pcszWindowTitle) // in: help window title or NULL
    23482367{
    23492368    PPIB     ppib;
     
    23542373    HWND     hwndHelp;
    23552374
    2356     if (     (pszFileName == NULL)
     2375    if (     (pcszFileName == NULL)
    23572376          // || (*pszFileName)
    23582377       )
     
    23682387            strcat(szName, ".hlp");
    23692388
    2370         pszFileName = szName;
     2389        pcszFileName = szName;
    23712390    }
    23722391
     
    23792398    hi.idAccelTable             = 0;
    23802399    hi.idActionBar              = 0;
    2381     hi.pszHelpWindowTitle       = pszWindowTitle;
     2400    hi.pszHelpWindowTitle       = (PSZ)pcszWindowTitle;
    23822401    hi.fShowPanelId             = CMIC_HIDE_PANEL_ID;
    2383     hi.pszHelpLibraryName       = pszFileName;
     2402    hi.pszHelpLibraryName       = (PSZ)pcszFileName;
    23842403
    23852404    hwndHelp = WinCreateHelpInstance(WinQueryAnchorBlock(hwndFrame),
     
    27832802 */
    27842803
    2785 BOOL winhAnotherInstance(PSZ pszSemName,    // in: semaphore ID
     2804BOOL winhAnotherInstance(const char *pcszSemName,    // in: semaphore ID
    27862805                         BOOL fSwitch)      // in: if TRUE, switch to first instance if running
    27872806{
    27882807    HMTX hmtx;
    27892808
    2790     if (DosCreateMutexSem(pszSemName,
     2809    if (DosCreateMutexSem((PSZ)pcszSemName,
    27912810                          &hmtx,
    27922811                          DC_SEM_SHARED,
     
    28042823    {
    28052824        // yes: query mutex creator
    2806         if (DosOpenMutexSem(pszSemName,
     2825        if (DosOpenMutexSem((PSZ)pcszSemName,
    28072826                            &hmtx)
    28082827                    == NO_ERROR)
     
    29662985                                    // -- WINH_FOD_INISAVEDIR: store FOD path to INI on OK
    29672986                 HINI hini,         // in: INI file to load/store last path from (can be HINI_USER)
    2968                  PSZ pszApplication, // in: INI application to load/store last path from
    2969                  PSZ pszKey)        // in: INI key to load/store last path from
     2987                 const char *pcszApplication, // in: INI application to load/store last path from
     2988                 const char *pcszKey)        // in: INI key to load/store last path from
    29702989{
    29712990    FILEDLG fd;
     
    29863005        // overwrite with initial directory for FOD from OS2.INI
    29873006        if (PrfQueryProfileString(hini,
    2988                                   pszApplication,
    2989                                   pszKey,
     3007                                  (PSZ)pcszApplication,
     3008                                  (PSZ)pcszKey,
    29903009                                  "",      // default string
    29913010                                  fd.szFullFile,
     
    30203039                {
    30213040                    PrfWriteProfileString(hini,
    3022                                           pszApplication,
    3023                                           pszKey, // "XWPSound:LastDir"
     3041                                          (PSZ)pcszApplication,
     3042                                          (PSZ)pcszKey,
    30243043                                          pszDir);
    30253044                    free(pszDir);
     
    31013120
    31023121BOOL winhReplaceWindowText(HWND hwnd,           // in: window whose text is to be modified
    3103                            PSZ pszSearch,       // in: search string (e.g. "%1")
    3104                            PSZ pszReplaceWith)  // in: replacement string for pszSearch
     3122                           const char *pcszSearch,       // in: search string (e.g. "%1")
     3123                           const char *pcszReplaceWith)  // in: replacement string for pszSearch
    31053124{
    31063125    BOOL    brc = FALSE;
     
    31093128    {
    31103129        ULONG ulOfs = 0;
    3111         if (strhFindReplace(&pszText, &ulOfs, pszSearch, pszReplaceWith) > 0)
     3130        if (strhFindReplace(&pszText, &ulOfs, pcszSearch, pcszReplaceWith) > 0)
    31123131        {
    31133132            WinSetWindowText(hwnd, pszText);
     
    31973216                         ULONG flFrameCreateFlags,  // in: FCF_* flags
    31983217                         ULONG ulFrameStyle,        // in: WS_* flags (e.g. WS_VISIBLE, WS_ANIMATE)
    3199                          PSZ pszFrameTitle,
     3218                         const char *pcszFrameTitle,
    32003219                         ULONG ulResourcesID,       // in: according to FCF_* flags
    3201                          PSZ pszClassClient,
     3220                         const char *pcszClassClient,
    32023221                         ULONG flStyleClient,
    32033222                         ULONG ulID,                // in: frame window ID
     
    32173236    hwndFrame = WinCreateWindow(hwndFrameParent,
    32183237                                WC_FRAME,
    3219                                 pszFrameTitle,
     3238                                (PSZ)pcszFrameTitle,
    32203239                                ulFrameStyle,
    32213240                                0,0,0,0,         // size and position = 0
     
    32293248    {
    32303249        *phwndClient = WinCreateWindow(hwndFrame,      // parent
    3231                                        pszClassClient, // class
     3250                                       (PSZ)pcszClassClient, // class
    32323251                                       NULL,           // no title
    32333252                                       flStyleClient,  // style
     
    32733292    }
    32743293    return (hwndFrame);
     3294}
     3295
     3296/*
     3297 *@@ winhCreateObjectWindow:
     3298 *      creates an object window of the specified
     3299 *      window class, which you should have registered
     3300 *      before calling this. pvCreateParam will be
     3301 *      given to the window on WM_CREATE.
     3302 *
     3303 *      Returns the HWND of the object window or
     3304 *      NULLHANDLE on errors.
     3305 *
     3306 *@@added V0.9.3 (2000-04-17) [umoeller]
     3307 *@@changed V0.9.7 (2001-01-17) [umoeller]: made this a function from a macro
     3308 */
     3309
     3310HWND winhCreateObjectWindow(const char *pcszWindowClass,    // in: PM window class name
     3311                            PVOID pvCreateParam)            // in: create param
     3312{
     3313    return (WinCreateWindow(HWND_OBJECT,
     3314                            (PSZ)pcszWindowClass,
     3315                            (PSZ)"",
     3316                            0,
     3317                            0,0,0,0,
     3318                            0,
     3319                            HWND_BOTTOM,
     3320                            0,
     3321                            pvCreateParam,
     3322                            NULL));
    32753323}
    32763324
     
    35703618 *
    35713619 *      After this function returns, *prcl is modified like this:
     3620 *
    35723621 *      -- yTop and yBottom contain the upper and lower boundaries
    35733622 *         which were needed to draw the text. This depends on
     
    35973646                            PRECTL prcl, // in/out: rectangle to use for drawing
    35983647                                         // (modified)
    3599                             PSZ pszText, // in: text to draw (zero-terminated)
     3648                            const char *pcszText, // in: text to draw (zero-terminated)
    36003649                            ULONG flCmd) // in: flags like in WinDrawText; I have
    36013650                                         // only tested DT_TOP and DT_LEFT though.
     
    36053654                                         // have prcl calculated without drawing.
    36063655{
    3607     PSZ     p = pszText;
     3656    PSZ     p = (PSZ)pcszText;
    36083657    LONG    lDrawn = 1,
    36093658            lTotalDrawn = 0,
    36103659            lLineCount = 0,
    36113660            lOrigYTop = prcl->yTop;
    3612     ULONG   ulTextLen = strlen(pszText),
     3661    ULONG   ulTextLen = strlen(pcszText),
    36133662            ulCharHeight,
    36143663            flCmd2,
Note: See TracChangeset for help on using the changeset viewer.