Changeset 25
- Timestamp:
- Jan 17, 2001, 6:34:55 PM (25 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/helpers/gpih.h
r23 r25 86 86 VOID gpihBox(HPS hps, 87 87 LONG lControl, 88 PRECTL prcl, 89 LONG lColor); 88 PRECTL prcl); 90 89 91 90 VOID gpihMarker(HPS hps, 92 91 LONG x, 93 92 LONG y, 94 ULONG ulWidth, 95 LONG lColor); 93 ULONG ulWidth); 96 94 97 95 VOID gpihDrawThickFrame(HPS hps, -
trunk/include/helpers/winh.h
r14 r25 129 129 SHORT iPosition, 130 130 SHORT sItemId, 131 PSZ pszItemTitle,131 const char *pcszItemTitle, 132 132 SHORT afStyle, 133 133 SHORT afAttr); … … 136 136 ULONG iPosition, 137 137 SHORT sMenuId, 138 PSZ pszSubmenuTitle,138 const char *pcszSubmenuTitle, 139 139 USHORT afMenuStyle, 140 140 SHORT sItemId, 141 PSZ pszItemTitle,141 const char *pcszItemTitle, 142 142 USHORT afItemStyle, 143 143 USHORT afAttribute); … … 469 469 BOOL XWPENTRY winhHandleScrollMsg(HWND hwnd2Scroll, 470 470 HWND hwndScrollBar, 471 P LONG plCurUnitOfs,471 PULONG pulCurPelsOfs, 472 472 PRECTL prcl2Scroll, 473 473 LONG ulViewportPels, … … 490 490 ********************************************************************/ 491 491 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); 495 495 496 496 #define XAC_MOVEX 0x0001 … … 571 571 #ifdef INCL_WINHELP 572 572 HWND XWPENTRY winhCreateHelp(HWND hwndFrame, 573 PSZ pszFileName,573 const char *pcszFileName, 574 574 HMODULE hmod, 575 575 PHELPTABLE pHelpTable, 576 PSZ pszWindowTitle);576 const char *pcszWindowTitle); 577 577 578 578 void XWPENTRY winhDestroyHelp(HWND hwndHelp, HWND hwndFrame); … … 589 589 #endif 590 590 591 BOOL XWPENTRY winhAnotherInstance( PSZ pszSemName, BOOL fSwitch);591 BOOL XWPENTRY winhAnotherInstance(const char *pcszSemName, BOOL fSwitch); 592 592 593 593 HSWITCH XWPENTRY winhAddToTasklist(HWND hwnd, HPOINTER hIcon); … … 613 613 ULONG flFlags, 614 614 HINI hini, 615 PSZ pszApplication,616 PSZ pszKey);615 const char *pcszApplication, 616 const char *pcszKey); 617 617 618 618 HPOINTER XWPENTRY winhSetWaitPointer(VOID); … … 629 629 630 630 BOOL XWPENTRY winhReplaceWindowText(HWND hwnd, 631 PSZ pszSearch,632 PSZ pszReplaceWith);631 const char *pcszSearch, 632 const char *pcszReplaceWith); 633 633 634 634 ULONG XWPENTRY winhCenteredDlgBox(HWND hwndParent, HWND hwndOwner, … … 647 647 ULONG flFrameCreateFlags, 648 648 ULONG ulFrameStyle, 649 PSZ pszFrameTitle,649 const char *pcszFrameTitle, 650 650 ULONG ulResourcesID, 651 PSZ pszClassClient,651 const char *pcszClassClient, 652 652 ULONG flStyleClient, 653 653 ULONG ulID, … … 655 655 PHWND phwndClient); 656 656 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); 673 659 674 660 VOID XWPENTRY winhRepaintWindows(HWND hwndParent); … … 684 670 ULONG ulDownUnits); 685 671 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); 687 673 688 674 #ifdef INCL_WINSWITCHLIST -
trunk/src/helpers/cctl_chart.c
r21 r25 196 196 197 197 // fill bitmap with static's background color 198 GpiSetColor(hpsMem, lBackgroundColor); 198 199 gpihBox(hpsMem, 199 200 DRO_FILL, 200 &rclWholeStatic, 201 lBackgroundColor); 201 &rclWholeStatic); 202 202 203 203 // We'll paint into the bitmap in two loops: -
trunk/src/helpers/gpih.c
r23 r25 225 225 * This is different from WinFillRect. 226 226 * 227 * If (lColor != -1), the HPS's current foreground color 228 * is changed to that color. 229 * 227 230 * Changes to the HPS: 228 * -- the current (foreground) color is changed to 229 * lBackColor; 230 * -- the current area color is changed to lForeColor; 231 * 231 232 * -- the current position is moved to the lower left 232 233 * corner of *prcl. … … 234 235 *@@changed V0.9.0 [umoeller]: renamed from gpihFillRect 235 236 *@@changed V0.9.0 [umoeller]: modified function prototype to support lControl 237 *@@changed V0.9.7 (2001-01-17) [umoeller]: removed lColor 236 238 */ 237 239 238 240 VOID gpihBox(HPS hps, // in: presentation space for output 239 241 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) 242 243 { 243 244 POINTL ptl; 244 245 245 GpiSetColor(hps, lColor);246 246 ptl.x = prcl->xLeft; 247 247 ptl.y = prcl->yBottom; … … 263 263 * 264 264 * No PS data is changed. 265 * 266 *@@changed V0.9.7 (2001-01-17) [umoeller]: removed lColor 265 267 */ 266 268 … … 268 270 LONG x, // in: x-center of rectangle 269 271 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 272 273 { 273 274 POINTL ptlSave; 274 LONG lColorSave;275 275 RECTL rclTemp; 276 276 ULONG ulWidth2 = ulWidth / 2; … … 280 280 rclTemp.yTop = y + ulWidth2; 281 281 282 lColorSave = GpiQueryColor(hps);283 282 GpiQueryCurrentPosition(hps, &ptlSave); 284 283 gpihBox(hps, 285 284 DRO_FILL, 286 &rclTemp, 287 lColor); 285 &rclTemp); 288 286 GpiMove(hps, &ptlSave); 289 GpiSetColor(hps, lColorSave);290 287 } 291 288 … … 746 743 * semaphore is held by the wrapper. Then use only 747 744 * 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. 748 774 * 749 775 *@@added V0.9.0 [umoeller] -
trunk/src/helpers/textview.c
r23 r25 1493 1493 // can be NULL to paint all 1494 1494 LONG lViewXOfs, // in: x offset to paint; 0 means rightmost 1495 P LONG plViewYOfs,// in: y offset to paint; 0 means _top_most;1495 PULONG pulViewYOfs, // in: y offset to paint; 0 means _top_most; 1496 1496 // out: y offset which should be passed to next call 1497 1497 // (if TRUE is returned and fPaintHalfLines == FALSE) … … 1505 1505 fAnyLinesPainted = FALSE; 1506 1506 ULONG ulCurrentLineIndex = *pulLineIndex; 1507 // LONG lViewYOfsSaved = *p lViewYOfs;1507 // LONG lViewYOfsSaved = *pulViewYOfs; 1508 1508 PLISTNODE pRectNode = lstNodeFromIndex(&pxfd->llRectangles, 1509 1509 ulCurrentLineIndex); … … 1521 1521 rclLine.xLeft = pLineRcl->rcl.xLeft - lViewXOfs; 1522 1522 rclLine.xRight = pLineRcl->rcl.xRight - lViewXOfs; 1523 rclLine.yBottom = pLineRcl->rcl.yBottom + *p lViewYOfs;1524 rclLine.yTop = pLineRcl->rcl.yTop + *p lViewYOfs;1523 rclLine.yBottom = pLineRcl->rcl.yBottom + *pulViewYOfs; 1524 rclLine.yTop = pLineRcl->rcl.yTop + *pulViewYOfs; 1525 1525 1526 1526 /* if (pmpf) … … 1682 1682 // return TRUE 1683 1683 brc = TRUE; 1684 // and set *p lViewYOfs to the top of1684 // and set *pulViewYOfs to the top of 1685 1685 // the next line, which wasn't visible 1686 1686 // on the page any more 1687 *p lViewYOfs = pLineRcl2->rcl.yTop + *plViewYOfs;1687 *pulViewYOfs = pLineRcl2->rcl.yTop + *pulViewYOfs; 1688 1688 } 1689 1689 break; … … 1844 1844 rclViewText; // same as rclViewPaint, but excluding cdata borders 1845 1845 1846 LONG lViewXOfs,// pixels that we have scrolled to the RIGHT; 0 means very left1847 lViewYOfs;// pixels that we have scrolled to the BOTTOM; 0 means very top1846 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 1848 1848 1849 1849 BOOL fAcceptsPresParamsNow; // TRUE after first WM_PAINT … … 2009 2009 ulWinCY = (ptxvd->rclViewText.yTop - ptxvd->rclViewText.yBottom); 2010 2010 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; 2015 2015 2016 2016 // vertical scroll bar enabled at all? … … 2020 2020 ulWinCY, 2021 2021 ptxvd->xfd.ulViewportCY, 2022 ptxvd-> lViewYOfs,2022 ptxvd->ulViewYOfs, 2023 2023 (ptxvd->cdata.flStyle & XTXF_AUTOVHIDE)); 2024 2024 // is auto-hide on? … … 2051 2051 ulWinCX, 2052 2052 ptxvd->xfd.ulViewportCX, 2053 ptxvd-> lViewXOfs,2053 ptxvd->ulViewXOfs, 2054 2054 (ptxvd->cdata.flStyle & XTXF_AUTOHHIDE)); 2055 2055 // is auto-hide on? … … 2084 2084 { 2085 2085 ULONG ulLineIndex = 0; 2086 LONG lYOfs = ptxvd->lViewYOfs;2086 ULONG ulYOfs = ptxvd->ulViewYOfs; 2087 2087 txvPaintText(ptxvd->hab, 2088 2088 ptxvd->hps, // paint PS: screen 2089 2089 &ptxvd->xfd, // formatting data 2090 2090 prcl2Paint, // update rectangle given to us 2091 ptxvd-> lViewXOfs, // current X scrolling offset2092 & lYOfs, // current Y scrolling offset2091 ptxvd->ulViewXOfs, // current X scrolling offset 2092 &ulYOfs, // current Y scrolling offset 2093 2093 TRUE, // draw even partly visible lines 2094 2094 &ulLineIndex); … … 2140 2140 2141 2141 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; 2146 2146 2147 2147 if (pWordThis->usAnchor) … … 2149 2149 2150 2150 // x start: this word's X coordinate 2151 ptlStart.x = pWordThis->lX - ptxvd-> lViewXOfs;2151 ptlStart.x = pWordThis->lX - ptxvd->ulViewXOfs; 2152 2152 // y start: bottom line of rectangle plus highest 2153 2153 // base line offset found in all words (format step 2) … … 2175 2175 &rclLine, 2176 2176 pWordThis, 2177 ptxvd-> lViewXOfs);2177 ptxvd->ulViewXOfs); 2178 2178 } 2179 2179 … … 2399 2399 pwndParams->pszText, 2400 2400 0); 2401 ptxvd-> lViewXOfs = 0;2402 ptxvd-> lViewYOfs = 0;2401 ptxvd->ulViewXOfs = 0; 2402 ptxvd->ulViewYOfs = 0; 2403 2403 /* ptxvd->fVScrollVisible = FALSE; 2404 2404 ptxvd->fHScrollVisible = FALSE; */ … … 2581 2581 winhHandleScrollMsg(hwndTextView, 2582 2582 ptxvd->hwndVScroll, 2583 &ptxvd-> lViewYOfs,2583 &ptxvd->ulViewYOfs, 2584 2584 &ptxvd->rclViewText, 2585 2585 ptxvd->xfd.ulViewportCY, … … 2601 2601 winhHandleScrollMsg(hwndTextView, 2602 2602 ptxvd->hwndHScroll, 2603 &ptxvd-> lViewXOfs,2603 &ptxvd->ulViewXOfs, 2604 2604 &ptxvd->rclViewText, 2605 2605 ptxvd->xfd.ulViewportCX, … … 2657 2657 PLISTNODE pWordNodeClicked = NULL; 2658 2658 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; 2661 2661 2662 2662 if (hwndTextView != WinQueryFocus(HWND_DESKTOP)) … … 2721 2721 HWND hwndOwner = NULLHANDLE; 2722 2722 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; 2725 2725 WinSetCapture(HWND_DESKTOP, NULLHANDLE); 2726 2726 … … 3037 3037 // and then have lower y coordinates down to way in the negatives, 3038 3038 // 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; 3045 3045 3046 3046 // vertical scroll bar enabled at all? … … 3050 3050 ulWinCY, 3051 3051 ptxvd->xfd.ulViewportCY, 3052 ptxvd-> lViewYOfs,3052 ptxvd->ulViewYOfs, 3053 3053 (ptxvd->cdata.flStyle & XTXF_AUTOVHIDE)); 3054 3054 WinInvalidateRect(hwndTextView, NULL, FALSE); … … 3440 3440 ULONG ulCurrentLineIndex = 0, 3441 3441 ulCurrentPage = 1; 3442 LONGlCurrentYOfs = 0;3442 ULONG ulCurrentYOfs = 0; 3443 3443 3444 3444 /* MATRIXLF matlf; … … 3510 3510 &rclPageWorld, 3511 3511 0, 3512 & lCurrentYOfs,3512 &ulCurrentYOfs, 3513 3513 FALSE, // draw only fully visible lines 3514 3514 &ulCurrentLineIndex); // in/out: line to start with -
trunk/src/helpers/winh.c
r23 r25 109 109 // insert or MIT_END 110 110 SHORT sItemId, // in: ID of new menu item 111 PSZ pszItemTitle, // in: title of new menu item111 const char *pcszItemTitle, // in: title of new menu item 112 112 SHORT afStyle, 113 113 // in: MIS_* style flags. … … 168 168 MM_INSERTITEM, 169 169 (MPARAM)&mi, 170 (MPARAM)p szItemTitle));170 (MPARAM)pcszItemTitle)); 171 171 return (src); 172 172 } … … 186 186 ULONG iPosition, // in: index where to add submenu or MIT_END 187 187 SHORT sMenuId, // in: menu ID of new submenu 188 PSZ pszSubmenuTitle, // in: title of new submenu188 const char *pcszSubmenuTitle, // in: title of new submenu 189 189 USHORT afMenuStyle, // in: MIS* style flags for submenu; 190 190 // MIS_SUBMENU will always be added 191 191 SHORT sItemId, // in: ID of first item to add to submenu; 192 192 // if 0, no first item is inserted 193 PSZ pszItemTitle, // in: title of this item193 const char *pcszItemTitle, // in: title of this item 194 194 // (if sItemID != 0) 195 195 USHORT afItemStyle, // in: style flags for this item, e.g. MIS_TEXT … … 216 216 mi.hwndSubMenu = hwndNewMenu; 217 217 mi.hItem = 0; 218 src = SHORT1FROMMR(WinSendMsg(hwndMenu, MM_INSERTITEM, (MPARAM)&mi, (MPARAM)p szSubmenuTitle));218 src = SHORT1FROMMR(WinSendMsg(hwndMenu, MM_INSERTITEM, (MPARAM)&mi, (MPARAM)pcszSubmenuTitle)); 219 219 if ( (src != MIT_MEMERROR) 220 220 && (src != MIT_ERROR) … … 237 237 MM_INSERTITEM, 238 238 (MPARAM)&mi, 239 (MPARAM)p szItemTitle);239 (MPARAM)pcszItemTitle); 240 240 } 241 241 } … … 1059 1059 * extension, and position, all in one shot. 1060 1060 * 1061 * This function usually gets called when the window is 1062 * created and later when the window is resized. 1063 * 1061 1064 * This simplifies the typical functionality of a scroll 1062 1065 * bar in a client window which is to be scrolled. I am … … 1068 1071 * 1069 1072 * -- "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 * 1071 1076 * The width or height of this must be passed in ulWinPels. 1072 1077 * 1073 1078 * -- "viewport": the entire data to be displayed, of which the 1074 1079 * "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 1078 1085 * (if the window is too small to show all the data). 1079 1086 * 1080 1087 * -- "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 * 1084 1093 * For vertical scroll bars, this is counted from the _top_ 1085 1094 * 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, 1091 1102 * that is, if ulViewportPels <= ulWinPels. In that case 1092 1103 * FALSE is returned. If (fAutoHide == TRUE), the scroll … … 1099 1110 * bars, 0 means topmost (which is kinda sick with the OS/2 1100 1111 * 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 * 1102 1115 + (ulViewportPels - ulWinPels) / usScrollUnitPels 1103 1116 * … … 1210 1223 * on values starting from zero. The maximum value 1211 1224 * of the scroll bar is: 1225 * 1212 1226 + ulViewportPels - (prcl2Scroll->yTop - prcl2Scroll->yBottom) 1213 1227 * … … 1224 1238 *@@changed V0.9.3 (2000-04-30) [umoeller]: changed prototype, fixed pels/unit confusion 1225 1239 *@@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 1226 1241 */ 1227 1242 1228 1243 BOOL winhHandleScrollMsg(HWND hwnd2Scroll, // in: client window to scroll 1229 1244 HWND hwndScrollBar, // in: vertical or horizontal scroll bar window 1230 P LONG plCurPelsOfs,// in/out: current viewport offset;1245 PULONG pulCurPelsOfs, // in/out: current viewport offset; 1231 1246 // this is updated with the proper scroll units 1232 1247 PRECTL prcl2Scroll, // in: hwnd2Scroll rectangle to scroll … … 1243 1258 // see PMREF for details 1244 1259 { 1245 LONG lOldPelsOfs = *plCurPelsOfs;1260 ULONG ulOldPelsOfs = *pulCurPelsOfs; 1246 1261 USHORT usPosUnits = SHORT1FROMMP(mp2), // in scroll units 1247 1262 usCmd = SHORT2FROMMP(mp2); … … 1267 1282 { 1268 1283 case SB_LINEUP: 1269 // _Pmpf(("SB_LINEUP")); 1270 *plCurPelsOfs -= usLineStepPels; // * usScrollUnitPels); 1284 if (*pulCurPelsOfs > usLineStepPels) 1285 *pulCurPelsOfs -= usLineStepPels; // * usScrollUnitPels); 1286 else 1287 *pulCurPelsOfs = 0; 1271 1288 break; 1272 1289 1273 1290 case SB_LINEDOWN: 1274 // _Pmpf(("SB_LINEDOWN")); 1275 *plCurPelsOfs += usLineStepPels; // * usScrollUnitPels); 1291 *pulCurPelsOfs += usLineStepPels; // * usScrollUnitPels); 1276 1292 break; 1277 1293 1278 1294 case SB_PAGEUP: 1279 *plCurPelsOfs -= ulWinPels; // convert to units 1295 if (*pulCurPelsOfs > ulWinPels) 1296 *pulCurPelsOfs -= ulWinPels; // convert to units 1297 else 1298 *pulCurPelsOfs = 0; 1280 1299 break; 1281 1300 1282 1301 case SB_PAGEDOWN: 1283 *p lCurPelsOfs += ulWinPels; // convert to units1302 *pulCurPelsOfs += ulWinPels; // convert to units 1284 1303 break; 1285 1304 1286 1305 case SB_SLIDERTRACK: 1287 *p lCurPelsOfs = (usPosUnits * usScrollUnitPels);1306 *pulCurPelsOfs = (usPosUnits * usScrollUnitPels); 1288 1307 // _Pmpf((" SB_SLIDERTRACK: usUnits = %d", usPosUnits)); 1289 1308 break; 1290 1309 1291 1310 case SB_SLIDERPOSITION: 1292 *p lCurPelsOfs = (usPosUnits * usScrollUnitPels);1311 *pulCurPelsOfs = (usPosUnits * usScrollUnitPels); 1293 1312 break; 1294 1313 } … … 1304 1323 } */ 1305 1324 1306 if (*plCurPelsOfs < 0)1307 *plCurPelsOfs = 0; 1308 if (*p lCurPelsOfs > (lMaxAllowedUnitOfs * usScrollUnitPels))1325 /* if (*plCurPelsOfs < 0) 1326 *plCurPelsOfs = 0; */ // checked above 1327 if (*pulCurPelsOfs > (lMaxAllowedUnitOfs * usScrollUnitPels)) 1309 1328 { 1310 1329 // _Pmpf((" !!! limiting 2: %d to %d", *plCurUnitOfs, lMaxAllowedUnitOfs)); 1311 *p lCurPelsOfs = (lMaxAllowedUnitOfs * usScrollUnitPels);1312 } 1313 if ( (*p lCurPelsOfs !=lOldPelsOfs)1314 || (*p lCurPelsOfs == 0)1315 || (*p lCurPelsOfs == (lMaxAllowedUnitOfs * usScrollUnitPels))1330 *pulCurPelsOfs = (lMaxAllowedUnitOfs * usScrollUnitPels); 1331 } 1332 if ( (*pulCurPelsOfs != ulOldPelsOfs) 1333 || (*pulCurPelsOfs == 0) 1334 || (*pulCurPelsOfs == (lMaxAllowedUnitOfs * usScrollUnitPels)) 1316 1335 ) 1317 1336 { … … 1322 1341 WinSendMsg(hwndScrollBar, 1323 1342 SBM_SETPOS, 1324 (MPARAM)(*p lCurPelsOfs / usScrollUnitPels), // / usScrollUnit),1343 (MPARAM)(*pulCurPelsOfs / usScrollUnitPels), // / usScrollUnit), 1325 1344 0); 1326 1345 // scroll window rectangle: … … 1333 1352 WinScrollWindow(hwnd2Scroll, 1334 1353 0, 1335 (*p lCurPelsOfs -lOldPelsOfs) // scroll units changed1354 (*pulCurPelsOfs - ulOldPelsOfs) // scroll units changed 1336 1355 , // * usScrollUnitPels, // convert to pels 1337 1356 &rcl2Scroll, // rcl to scroll … … 1342 1361 else 1343 1362 WinScrollWindow(hwnd2Scroll, 1344 -( *plCurPelsOfs -lOldPelsOfs) // scroll units changed1363 -(LONG)(*pulCurPelsOfs - ulOldPelsOfs) // scroll units changed 1345 1364 , // * usScrollUnitPels, 1346 1365 0, … … 1555 1574 BOOL winhSaveWindowPos(HWND hwnd, // in: window to save 1556 1575 HINI hIni, // in: INI file (or HINI_USER/SYSTEM) 1557 PSZ pszApp, // in: INI application name1558 PSZ pszKey) // in: INI key name1576 const char *pcszApp, // in: INI application name 1577 const char *pcszKey) // in: INI key name 1559 1578 { 1560 1579 BOOL brc = FALSE; … … 1572 1591 } 1573 1592 1574 brc = PrfWriteProfileData(hIni, pszApp, pszKey, &swp, sizeof(swp));1593 brc = PrfWriteProfileData(hIni, (PSZ)pcszApp, (PSZ)pcszKey, &swp, sizeof(swp)); 1575 1594 } 1576 1595 return (brc); … … 1614 1633 BOOL winhRestoreWindowPos(HWND hwnd, // in: window to restore 1615 1634 HINI hIni, // in: INI file (or HINI_USER/SYSTEM) 1616 PSZ pszApp, // in: INI application name1617 PSZ pszKey, // in: INI key name1635 const char *pcszApp, // in: INI application name 1636 const char *pcszKey, // in: INI key name 1618 1637 ULONG fl) // in: "fl" parameter for WinSetWindowPos 1619 1638 { … … 1623 1642 ULONG fl2 = (fl & ~SWP_ZORDER); 1624 1643 1625 if (PrfQueryProfileData(hIni, pszApp, pszKey, &swp, &cbswp))1644 if (PrfQueryProfileData(hIni, (PSZ)pcszApp, (PSZ)pcszKey, &swp, &cbswp)) 1626 1645 { 1627 1646 ULONG ulScreenCX = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN); … … 2341 2360 */ 2342 2361 2343 HWND winhCreateHelp(HWND 2344 PSZ pszFileName, // in: help file name or NULL2362 HWND winhCreateHelp(HWND hwndFrame, // in: app's frame window handle; can be NULLHANDLE 2363 const char *pcszFileName, // in: help file name or NULL 2345 2364 HMODULE hmod, // in: module with help table or NULLHANDLE (current) 2346 2365 PHELPTABLE pHelpTable, // in: help table or resource ID 2347 PSZ pszWindowTitle) // in: help window title or NULL2366 const char *pcszWindowTitle) // in: help window title or NULL 2348 2367 { 2349 2368 PPIB ppib; … … 2354 2373 HWND hwndHelp; 2355 2374 2356 if ( (p szFileName == NULL)2375 if ( (pcszFileName == NULL) 2357 2376 // || (*pszFileName) 2358 2377 ) … … 2368 2387 strcat(szName, ".hlp"); 2369 2388 2370 p szFileName = szName;2389 pcszFileName = szName; 2371 2390 } 2372 2391 … … 2379 2398 hi.idAccelTable = 0; 2380 2399 hi.idActionBar = 0; 2381 hi.pszHelpWindowTitle = pszWindowTitle;2400 hi.pszHelpWindowTitle = (PSZ)pcszWindowTitle; 2382 2401 hi.fShowPanelId = CMIC_HIDE_PANEL_ID; 2383 hi.pszHelpLibraryName = pszFileName;2402 hi.pszHelpLibraryName = (PSZ)pcszFileName; 2384 2403 2385 2404 hwndHelp = WinCreateHelpInstance(WinQueryAnchorBlock(hwndFrame), … … 2783 2802 */ 2784 2803 2785 BOOL winhAnotherInstance( PSZ pszSemName, // in: semaphore ID2804 BOOL winhAnotherInstance(const char *pcszSemName, // in: semaphore ID 2786 2805 BOOL fSwitch) // in: if TRUE, switch to first instance if running 2787 2806 { 2788 2807 HMTX hmtx; 2789 2808 2790 if (DosCreateMutexSem( pszSemName,2809 if (DosCreateMutexSem((PSZ)pcszSemName, 2791 2810 &hmtx, 2792 2811 DC_SEM_SHARED, … … 2804 2823 { 2805 2824 // yes: query mutex creator 2806 if (DosOpenMutexSem( pszSemName,2825 if (DosOpenMutexSem((PSZ)pcszSemName, 2807 2826 &hmtx) 2808 2827 == NO_ERROR) … … 2966 2985 // -- WINH_FOD_INISAVEDIR: store FOD path to INI on OK 2967 2986 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 from2969 PSZ pszKey) // in: INI key to load/store last path from2987 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 2970 2989 { 2971 2990 FILEDLG fd; … … 2986 3005 // overwrite with initial directory for FOD from OS2.INI 2987 3006 if (PrfQueryProfileString(hini, 2988 pszApplication,2989 pszKey,3007 (PSZ)pcszApplication, 3008 (PSZ)pcszKey, 2990 3009 "", // default string 2991 3010 fd.szFullFile, … … 3020 3039 { 3021 3040 PrfWriteProfileString(hini, 3022 pszApplication,3023 pszKey, // "XWPSound:LastDir"3041 (PSZ)pcszApplication, 3042 (PSZ)pcszKey, 3024 3043 pszDir); 3025 3044 free(pszDir); … … 3101 3120 3102 3121 BOOL 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 pszSearch3122 const char *pcszSearch, // in: search string (e.g. "%1") 3123 const char *pcszReplaceWith) // in: replacement string for pszSearch 3105 3124 { 3106 3125 BOOL brc = FALSE; … … 3109 3128 { 3110 3129 ULONG ulOfs = 0; 3111 if (strhFindReplace(&pszText, &ulOfs, p szSearch, pszReplaceWith) > 0)3130 if (strhFindReplace(&pszText, &ulOfs, pcszSearch, pcszReplaceWith) > 0) 3112 3131 { 3113 3132 WinSetWindowText(hwnd, pszText); … … 3197 3216 ULONG flFrameCreateFlags, // in: FCF_* flags 3198 3217 ULONG ulFrameStyle, // in: WS_* flags (e.g. WS_VISIBLE, WS_ANIMATE) 3199 PSZ pszFrameTitle,3218 const char *pcszFrameTitle, 3200 3219 ULONG ulResourcesID, // in: according to FCF_* flags 3201 PSZ pszClassClient,3220 const char *pcszClassClient, 3202 3221 ULONG flStyleClient, 3203 3222 ULONG ulID, // in: frame window ID … … 3217 3236 hwndFrame = WinCreateWindow(hwndFrameParent, 3218 3237 WC_FRAME, 3219 pszFrameTitle,3238 (PSZ)pcszFrameTitle, 3220 3239 ulFrameStyle, 3221 3240 0,0,0,0, // size and position = 0 … … 3229 3248 { 3230 3249 *phwndClient = WinCreateWindow(hwndFrame, // parent 3231 pszClassClient, // class3250 (PSZ)pcszClassClient, // class 3232 3251 NULL, // no title 3233 3252 flStyleClient, // style … … 3273 3292 } 3274 3293 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 3310 HWND 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)); 3275 3323 } 3276 3324 … … 3570 3618 * 3571 3619 * After this function returns, *prcl is modified like this: 3620 * 3572 3621 * -- yTop and yBottom contain the upper and lower boundaries 3573 3622 * which were needed to draw the text. This depends on … … 3597 3646 PRECTL prcl, // in/out: rectangle to use for drawing 3598 3647 // (modified) 3599 PSZ pszText, // in: text to draw (zero-terminated)3648 const char *pcszText, // in: text to draw (zero-terminated) 3600 3649 ULONG flCmd) // in: flags like in WinDrawText; I have 3601 3650 // only tested DT_TOP and DT_LEFT though. … … 3605 3654 // have prcl calculated without drawing. 3606 3655 { 3607 PSZ p = pszText;3656 PSZ p = (PSZ)pcszText; 3608 3657 LONG lDrawn = 1, 3609 3658 lTotalDrawn = 0, 3610 3659 lLineCount = 0, 3611 3660 lOrigYTop = prcl->yTop; 3612 ULONG ulTextLen = strlen(p szText),3661 ULONG ulTextLen = strlen(pcszText), 3613 3662 ulCharHeight, 3614 3663 flCmd2,
Note:
See TracChangeset
for help on using the changeset viewer.