Changeset 201
- Timestamp:
- Aug 11, 2002, 7:07:59 PM (23 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/helpers/apps.h
r153 r201 116 116 PULONG pulExitCode); 117 117 118 HAPP XWPENTRY appQuickStartApp(const char *pcszFile, 119 ULONG ulProgType, 120 const char *pcszArgs, 121 PULONG pulExitCode); 118 HAPP appQuickStartApp(const char *pcszFile, 119 ULONG ulProgType, 120 const char *pcszArgs, 121 const char *pcszWorkingDir, 122 PULONG pulExitCode); 123 124 BOOL appOpenURL(PCSZ pcszURL); 122 125 123 126 #endif -
trunk/include/helpers/dialog.h
r198 r201 430 430 id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING, pctldata } 431 431 432 // the following require #include helpers\textview.h 433 434 #define CONTROLDEF_XTEXTVIEW(text, id, cx, pctldata) { WC_XTEXTVIEW, text, \ 435 WS_VISIBLE | XS_STATIC | XS_WORDWRAP, \ 436 id, CTL_COMMON_FONT, 0, {cx, SZL_AUTOSIZE}, COMMON_SPACING, pctldata } 437 438 #define CONTROLDEF_XTEXTVIEW_HTML(text, id, cx, pctldata) { WC_XTEXTVIEW, text, \ 439 WS_VISIBLE | XS_STATIC | XS_WORDWRAP | XS_HTML, \ 440 id, CTL_COMMON_FONT, 0, {cx, SZL_AUTOSIZE}, COMMON_SPACING, pctldata } 441 432 442 /* ****************************************************************** 433 443 * -
trunk/include/helpers/textv_html.h
r113 r201 37 37 ********************************************************************/ 38 38 39 /* 40 *@@ XHTMLLINK: 41 * describes a link. 42 * 43 *@@added V0.9.3 (2000-05-19) [umoeller] 44 */ 45 46 typedef struct _XHTMLLINK 47 { 48 USHORT usLinkIndex; // >= 1; this is stored in the XTextView control 49 PSZ pszTargetFile; // target file (HREF="...") without anchors; 50 // this is NULL if the target is an anchor only 51 // (HREF="#anchor") 52 PSZ pszTargetAnchor; // anchor in target file; this is NULL if the 53 // target has no anchor 54 } XHTMLLINK, *PXHTMLLINK; 55 56 #ifdef LINKLIST_HEADER_INCLUDED 57 /* 58 *@@ XHTMLDATA: 59 * for storing output from txvConvertFromHTML. 60 * 61 *@@added V0.9.3 (2000-05-19) [umoeller] 62 */ 63 64 typedef struct _XHTMLDATA 65 { 66 PSZ pszTitle; // contents of TITLE tag (must be freed) 67 LINKLIST llLinks; // list of XHTMLLINK structures; empty if none 68 // (auto-free mode; use lstClear) 69 } XHTMLDATA, *PXHTMLDATA; 70 #endif 71 72 BOOL txvConvertFromHTML(char **ppszText, 73 PVOID pxhtml, 39 BOOL txvConvertFromHTML(PSZ *ppszText, 40 PSZ *ppszTitle, 74 41 PULONG pulProgress, 75 42 PBOOL pfCancel); 76 77 43 #endif 78 44 -
trunk/include/helpers/textview.h
r113 r201 75 75 76 76 // links 77 #define TXVESC_LINK TXVESC_STRING "\x06" 78 // here follow four characters with the 79 // link index in hex (0001-FFFF); 80 // "####" means end of link 81 // --> total size: 6 82 83 #define TXVESC_ANCHORNAME TXVESC_STRING "\x07" 77 #define TXVESC_LINK_BEGIN TXVESC_STRING "\x06" 78 // here follows the link reference, which 79 // is variable in length and must be terminated 80 // with another 0xFF escape code (NOT null byte); 81 // --> total size: 2 plus link name length 82 // plus 1 for 0xFF terminator 83 84 #define TXVESC_LINK_END TXVESC_STRING "\x07" 85 // end of the link 86 // --> total size: 2 87 88 #define TXVESC_ANCHORNAME TXVESC_STRING "\x08" 84 89 // here follows the anchor name, which is 85 90 // variable in length and must be terminated … … 223 228 LONG lPointSize; // point size to use for this rectangle; 224 229 // this is set to 0 for bitmap fonts 225 ULONG fl Options;// flOptions parameter for GpiCharStringPosAt;230 ULONG flChar; // flOptions parameter for GpiCharStringPosAt; 226 231 // this will only have the CHS_UNDERSCORE or 227 232 // CHS_STRIKEOUT flags set 228 233 229 USHORT usAnchor; // != 0 if this word belongs to an anchor 234 PSZ pszLinkTarget; // if != NULL, pointer to a string in XFORMATDATA.llLinks; 235 // the word is then part of a link 236 // V0.9.20 (2002-08-10) [umoeller] 237 230 238 } TXVWORD, *PTXVWORD; 231 239 … … 364 372 // to the words stored in this list. 365 373 366 ULONG ulViewportCX, // width of viewport (total text space) 367 ulViewportCY; // height of viewport (total text space) 374 SIZEL szlWorkspace; // width and height of viewport (total text space) 375 376 LINKLIST llLinks; 377 // list of malloc'd PSZ's (auto-free) with all 378 // the links encountered while parsing the text. 379 // These are needed for passing the correct link 380 // target names when the user clicks on one. 381 // V0.9.20 (2002-08-10) [umoeller] 368 382 369 383 } XFORMATDATA, *PXFORMATDATA; … … 400 414 #define TXM_SETCDATA (WM_USER + 1026) 401 415 #define TXM_JUMPTOANCHORNAME (WM_USER + 1027) 416 #define TXM_QUERYTEXTEXTENT (WM_USER + 1028) 402 417 403 418 #define WC_XTEXTVIEW "XTextViewClass" … … 417 432 * -- USHORT SHORT1FROMMP(mp1): id of the control. 418 433 * -- USHORT SHORT2FROMMP(mp1): nofify code (TXVN_LINK). 419 * -- USHORT mp2: index of anchor (1 >= index > 0xFFFF).434 * -- const char *mp2: link target. 420 435 * 421 436 *@@added V0.9.3 (2000-05-18) [umoeller] … … 425 440 426 441 /* 427 * XTextView style flags: 428 * 429 */ 430 431 #define XTXF_VSCROLL 0x0100 432 #define XTXF_HSCROLL 0x0200 433 #define XTXF_AUTOVHIDE 0x0400 434 #define XTXF_AUTOHHIDE 0x0800 442 * XTextView window style flags: 443 * all renamed, all turned into window style flags 444 */ 445 446 #define XS_VSCROLL 0x0001 // show vertical scroll bar 447 #define XS_HSCROLL 0x0002 // show horizontal scroll bar 448 #define XS_AUTOVHIDE 0x0004 // with XTXF_VSCROLL: automatically hide scrollbar 449 #define XS_AUTOHHIDE 0x0008 // with XTXF_HSCROLL: automatically hide scrollbar 450 451 // handy macro V0.9.20 (2002-08-10) [umoeller] 452 #define XS_FULLSCROLL (XS_VSCROLL | XS_HSCROLL | XS_AUTOVHIDE | XS_AUTOHHIDE) 453 454 #define XS_WORDWRAP 0x0010 455 // enable word-wrapping in the default paragraph 456 // format from the start 457 458 #define XS_STATIC 0x0020 459 // behave like static control: no focus, be skipped 460 // over with tabbing in dialogs 461 // V0.9.20 (2002-08-10) [umoeller] 462 463 #define XS_FORMAT_MASK 0x0700 464 #define XS_PREFORMATTED 0x0000 // plain text with \n only plus \xFF escape codes 465 // (no conversion performed) 466 #define XS_PLAINTEXT 0x0100 // plain text with \r and \xFF chars that need conversion 467 #define XS_HTML 0x0200 // HTML 435 468 436 469 /* … … 446 479 { 447 480 USHORT cbData; 448 ULONG flStyle;449 // XTXF_* flags:450 // -- XTXF_VSCROLL: show vertical scroll bar.451 // -- XTXF_HSCROLL: show horizontal scroll bar.452 // -- XTXF_AUTOVHIDE: with XTXF_VSCROLL: automatically hide scrollbar.453 // -- XTXF_AUTOHHIDE: with XTXF_HSCROLL: automatically hide scrollbar.454 481 ULONG ulXBorder, 455 482 // space to leave on the left and right of text view; … … 472 499 USHORT usID, 473 500 ULONG flWinStyle, 474 ULONG flStyle,475 501 USHORT usBorder); 476 502 -
trunk/src/helpers/apps.c
r196 r201 39 39 40 40 #define INCL_WINPROGRAMLIST // needed for PROGDETAILS, wppgm.h 41 #define INCL_WINSHELLDATA 41 42 #define INCL_WINERRORS 42 43 #define INCL_SHLERRORS … … 1146 1147 *@@added V0.9.18 (2002-03-27) [umoeller] 1147 1148 *@@changed V0.9.19 (2002-03-28) [umoeller]: now allocating contiguous buffer 1149 *@@changed V0.9.20 (2002-07-03) [umoeller]: fixed Win-OS/2 full screen breakage 1150 *@@changed V0.9.20 (2002-07-03) [umoeller]: fixed broken bat and cmd files when PROG_DEFAULT was set 1148 1151 */ 1149 1152 … … 1163 1166 1164 1167 if (!pcProgDetails && !ppDetails) 1165 return (ERROR_INVALID_PARAMETER);1168 return ERROR_INVALID_PARAMETER; 1166 1169 1167 1170 /* … … 1386 1389 { 1387 1390 if ( (ulIsWinApp) 1388 && ( ( Details.pszEnvironment == NULL)1389 || (! strlen(Details.pszEnvironment))1391 && ( (!(Details.pszEnvironment)) 1392 || (!(*Details.pszEnvironment)) 1390 1393 ) 1391 1394 ) … … 1729 1732 1730 1733 if (!pcProgDetails) 1731 return (ERROR_INVALID_PARAMETER);1734 return ERROR_INVALID_PARAMETER; 1732 1735 1733 1736 if (pszFailingName) … … 1933 1936 1934 1937 if (!phapp) 1935 return (ERROR_INVALID_PARAMETER);1938 return ERROR_INVALID_PARAMETER; 1936 1939 1937 1940 if (!(arc = appBuildProgDetails(&pDetails, … … 2015 2018 /* 2016 2019 *@@ appQuickStartApp: 2017 * shortcut for simply starting an app and 2018 * waiting until it's finished. 2020 * shortcut for simply starting an app. 2019 2021 * 2020 2022 * On errors, NULLHANDLE is returned. 2021 2023 * 2022 * If pulReturnCode != NULL, it receives the 2023 * return code of the app. 2024 * Only if pulExitCode != NULL, we wait for 2025 * the app to complete and return the 2026 * exit code. 2024 2027 * 2025 2028 *@@added V0.9.16 (2001-10-19) [umoeller] 2029 *@@changed V0.9.20 (2002-08-10) [umoeller]: fixed missing destroy window, made wait optional 2030 *@@changed V0.9.20 (2002-08-10) [umoeller]: added pcszWorkingDir 2026 2031 */ 2027 2032 2028 2033 HAPP appQuickStartApp(const char *pcszFile, 2029 ULONG ulProgType, // e.g. PROG_PM 2030 const char *pcszArgs, 2031 PULONG pulExitCode) 2034 ULONG ulProgType, // e.g. PROG_PM 2035 const char *pcszArgs, // in: arguments (can be NULL) 2036 const char *pcszWorkingDir, // in: working dir (can be NULL) 2037 PULONG pulExitCode) // out: exit code; if ptr is NULL, we don't wait 2032 2038 { 2033 2039 PROGDETAILS pd = {0}; … … 2043 2049 pd.pszExecutable = (PSZ)pcszFile; 2044 2050 pd.pszParameters = (PSZ)pcszArgs; 2045 if (p = strrchr(pcszFile, '\\')) 2051 2052 if ( (!(pd.pszStartupDir = (PSZ)pcszWorkingDir)) 2053 && (p = strrchr(pcszFile, '\\')) 2054 ) 2046 2055 { 2047 2056 strhncpy0(szDir, … … 2060 2069 ) 2061 2070 { 2062 if (appWaitForApp(hwndObject, 2071 if (pulExitCode) 2072 appWaitForApp(hwndObject, 2063 2073 happ, 2064 pulExitCode)) 2065 happReturn = happ; 2074 pulExitCode); 2075 2076 happReturn = happ; 2077 2078 WinDestroyWindow(hwndObject); // was missing V0.9.20 (2002-08-10) [umoeller] 2066 2079 } 2067 2080 2068 2081 return happReturn; 2069 2082 } 2083 2084 /* 2085 *@@ appOpenURL: 2086 * opens the system default browser with the given 2087 * URL. 2088 * 2089 *@@added V0.9.20 (2002-08-10) [umoeller] 2090 */ 2091 2092 BOOL appOpenURL(PCSZ pcszURL) 2093 { 2094 BOOL brc = FALSE; 2095 2096 CHAR szBrowser[CCHMAXPATH], 2097 szStartupDir[CCHMAXPATH]; 2098 XSTRING strParameters; 2099 2100 xstrInit(&strParameters, 0); 2101 2102 if (PrfQueryProfileString(HINI_USER, 2103 "WPURLDEFAULTSETTINGS", 2104 "DefaultBrowserExe", 2105 "NETSCAPE.EXE", 2106 szBrowser, 2107 sizeof(szBrowser))) 2108 { 2109 PSZ pszDefParams; 2110 2111 if (pszDefParams = prfhQueryProfileData(HINI_USER, 2112 "WPURLDEFAULTSETTINGS", 2113 "DefaultParameters", 2114 NULL)) 2115 { 2116 xstrcpy(&strParameters, pszDefParams, 0); 2117 xstrcatc(&strParameters, ' '); 2118 free(pszDefParams); 2119 } 2120 2121 xstrcat(&strParameters, pcszURL, 0); 2122 2123 PrfQueryProfileString(HINI_USER, 2124 "WPURLDEFAULTSETTINGS", 2125 "DefaultWorkingDir", 2126 "", 2127 szStartupDir, 2128 sizeof(szStartupDir)); 2129 2130 2131 brc = !!appQuickStartApp(szBrowser, 2132 PROG_DEFAULT, 2133 strParameters.psz, 2134 szStartupDir, 2135 NULL); // don't wait 2136 } 2137 2138 xstrClear(&strParameters); 2139 2140 return brc; 2141 } -
trunk/src/helpers/dialog.c
r199 r201 80 80 #include "helpers\standards.h" 81 81 #include "helpers\stringh.h" 82 #include "helpers\textview.h" 82 83 #include "helpers\winh.h" 83 84 #include "helpers\xstring.h" … … 118 119 119 120 POINTL ptlTotalOfs; 121 122 LINKLIST llTempControls; // linked list of HWNDs that were 123 // created temporarily to determine 124 // control sizes for SZL_AUTOSIZE 125 // V0.9.20 (2002-08-10) [umoeller] 120 126 121 127 PLINKLIST pllControls; // linked list of HWNDs in the order … … 365 371 { 366 372 RECTL rcl = {0, 0, 0, 0}; 367 /*368 if (pControlDef->szlControlProposed.cx > 0)369 rcl.xRight = pControlDef->szlControlProposed.cx; // V0.9.12 (2001-05-31) [umoeller]370 else371 rcl.xRight = winhQueryScreenCX() * 2 / 3;372 */373 373 rcl.xRight = ulWidth; 374 374 if (pControlDef->szlDlgUnits.cy > 0) … … 488 488 489 489 default: 490 // any other control (just to be safe): 491 SetDlgFont(pControlDef, pDlgData); 492 pszlAuto->cx = 50; 493 pszlAuto->cy = pDlgData->fmLast.lMaxBaselineExt 494 + pDlgData->fmLast.lExternalLeading 495 + 7; // some space 490 if (!strcmp(pControlDef->pcszClass, WC_XTEXTVIEW)) 491 { 492 HWND hwnd = NULLHANDLE; 493 PCSZ pcszTitle; 494 495 PLISTNODE pTempNode; 496 HWND hwndFound = NULLHANDLE; 497 FOR_ALL_NODES(&pDlgData->llTempControls, pTempNode) 498 { 499 HWND hwndThis = (HWND)pTempNode->pItemData; 500 if (WinQueryWindowUShort(hwndThis, QWS_ID) == pControlDef->usID) 501 { 502 hwnd = hwndThis; 503 504 // resize it to what we really need 505 WinSetWindowPos(hwndThis, 506 HWND_BOTTOM, 507 0, 508 0, 509 ulWidth, 510 2000, 511 SWP_SIZE); 512 break; 513 } 514 } 515 516 if (!hwnd) 517 { 518 if (hwnd = WinCreateWindow(pDlgData->hwndDlg, // parent 519 (PSZ)pControlDef->pcszClass, 520 NULL, 521 pControlDef->flStyle, 522 0, 523 0, 524 ulWidth, 525 2000, // cy, for now 526 pDlgData->hwndDlg, // owner 527 HWND_BOTTOM, 528 pControlDef->usID, 529 pControlDef->pvCtlData, 530 NULL)) 531 { 532 PCSZ pcszFont = pControlDef->pcszFont; 533 // can be NULL, or CTL_COMMON_FONT 534 if (pcszFont == CTL_COMMON_FONT) 535 pcszFont = pDlgData->pcszControlsFont; 536 537 if (pcszFont) 538 winhSetWindowFont(hwnd, 539 pcszFont); 540 541 WinSetWindowText(hwnd, 542 (pcszTitle = pControlDef->pcszText) 543 ? (PSZ)pcszTitle 544 : ""); 545 546 // store the window we have created in the temp 547 // windows list so it can be reused in 548 // ColumnCreateControls 549 lstAppendItem(&pDlgData->llTempControls, 550 (PVOID)hwnd); 551 } 552 else 553 arc = DLGERR_CANNOT_CREATE_CONTROL; 554 } 555 556 if (hwnd) 557 { 558 SIZEL szlTemp; 559 WinSendMsg(hwnd, 560 TXM_QUERYTEXTEXTENT, 561 (MPARAM)&szlTemp, 562 0); 563 564 pszlAuto->cy = szlTemp.cy; 565 } 566 } 567 else 568 { 569 // any other control (just to be safe): 570 SetDlgFont(pControlDef, pDlgData); 571 pszlAuto->cx = 50; 572 pszlAuto->cy = pDlgData->fmLast.lMaxBaselineExt 573 + pDlgData->fmLast.lExternalLeading 574 + 7; // some space 575 } 496 576 } 497 577 … … 958 1038 { 959 1039 // create something: 960 PCSZ pcszFont = pControlDef->pcszFont; 961 // can be NULL, or CTL_COMMON_FONT 962 if (pcszFont == CTL_COMMON_FONT) 963 pcszFont = pDlgData->pcszControlsFont; 964 965 if (pColumnDef->hwndControl 966 = WinCreateWindow(pDlgData->hwndDlg, // parent 967 (PSZ)pcszClass, // hacked 968 (pcszTitle) // hacked 969 ? (PSZ)pcszTitle 970 : "", 971 flStyle, // hacked 972 x, 973 y, 974 cx, 975 cy, 976 pDlgData->hwndDlg, // owner 977 HWND_BOTTOM, 978 pControlDef->usID, 979 pControlDef->pvCtlData, 980 NULL)) 981 { 1040 1041 // check if we have the window on the temp list from 1042 // CalcAutoSize V0.9.20 (2002-08-10) [umoeller] 1043 PLISTNODE pTempNode; 1044 HWND hwndFound = NULLHANDLE; 1045 FOR_ALL_NODES(&pDlgData->llTempControls, pTempNode) 1046 { 1047 HWND hwndThis = (HWND)pTempNode->pItemData; 1048 if (WinQueryWindowUShort(hwndThis, QWS_ID) == pControlDef->usID) 1049 { 1050 hwndFound 1051 = pColumnDef->hwndControl 1052 = hwndThis; 1053 1054 // resize it to what we really need 1055 WinSetWindowPos(hwndThis, 1056 HWND_BOTTOM, 1057 x, 1058 y, 1059 cx, 1060 cy, 1061 SWP_SIZE | SWP_MOVE | SWP_ZORDER); 1062 1063 lstRemoveNode(&pDlgData->llTempControls, pTempNode); 1064 break; 1065 } 1066 } 1067 1068 if ( (!hwndFound) 1069 && (!(pColumnDef->hwndControl = WinCreateWindow(pDlgData->hwndDlg, // parent 1070 (PSZ)pcszClass, // hacked 1071 (pcszTitle) // hacked 1072 ? (PSZ)pcszTitle 1073 : "", 1074 flStyle, // hacked 1075 x, 1076 y, 1077 cx, 1078 cy, 1079 pDlgData->hwndDlg, // owner 1080 HWND_BOTTOM, 1081 pControlDef->usID, 1082 pControlDef->pvCtlData, 1083 NULL))) 1084 ) 1085 arc = DLGERR_CANNOT_CREATE_CONTROL; 1086 1087 if (!arc) 1088 { 1089 PCSZ pcszFont = pControlDef->pcszFont; 1090 // can be NULL, or CTL_COMMON_FONT 1091 if (pcszFont == CTL_COMMON_FONT) 1092 pcszFont = pDlgData->pcszControlsFont; 1093 1094 if (lHandleSet) 1095 { 1096 // subclass the damn static 1097 if ((flOld & 0x0F) == SS_ICON) 1098 // this was a static: 1099 ctlPrepareStaticIcon(pColumnDef->hwndControl, 1100 1); 1101 else 1102 // this was a bitmap: 1103 ctlPrepareStretchedBitmap(pColumnDef->hwndControl, 1104 TRUE); 1105 1106 WinSendMsg(pColumnDef->hwndControl, 1107 SM_SETHANDLE, 1108 (MPARAM)lHandleSet, 1109 0); 1110 } 1111 else if (pcszFont) 1112 // we must set the font explicitly here... 1113 // doesn't always work with WinCreateWindow 1114 // presparams parameter, for some reason 1115 // V0.9.12 (2001-05-31) [umoeller] 1116 winhSetWindowFont(pColumnDef->hwndControl, 1117 pcszFont); 1118 982 1119 #ifdef DEBUG_DIALOG_WINDOWS 983 1120 { … … 1020 1157 } 1021 1158 #endif 1022 1023 if (lHandleSet)1024 {1025 // subclass the damn static1026 if ((flOld & 0x0F) == SS_ICON)1027 // this was a static:1028 ctlPrepareStaticIcon(pColumnDef->hwndControl,1029 1);1030 else1031 // this was a bitmap:1032 ctlPrepareStretchedBitmap(pColumnDef->hwndControl,1033 TRUE);1034 1035 WinSendMsg(pColumnDef->hwndControl,1036 SM_SETHANDLE,1037 (MPARAM)lHandleSet,1038 0);1039 }1040 else1041 if (pcszFont)1042 // we must set the font explicitly here...1043 // doesn't always work with WinCreateWindow1044 // presparams parameter, for some reason1045 // V0.9.12 (2001-05-31) [umoeller]1046 winhSetWindowFont(pColumnDef->hwndControl,1047 pcszFont);1048 1049 1159 // append window that was created 1050 1160 // V0.9.18 (2002-03-03) [umoeller] … … 1260 1370 PROWDEF pRowThis = (PROWDEF)pRowNode->pItemData; 1261 1371 PCOLUMNDEF pCorrespondingColumn; 1262 if ( (pCorrespondingColumn = lstItemFromIndex(&pRowThis->llColumns, ulMyIndex)) 1372 if ( (pCorrespondingColumn = (PCOLUMNDEF)lstItemFromIndex(&pRowThis->llColumns, 1373 ulMyIndex)) 1263 1374 && (pCorrespondingColumn->cpColumn.cx > pColumnDef->cpColumn.cx) 1264 1375 ) … … 1357 1468 } 1358 1469 } 1470 // we should stop on errors V0.9.20 (2002-08-10) [umoeller] 1471 else 1472 break; 1359 1473 } 1360 1474 … … 1526 1640 } 1527 1641 } 1642 // we should stop on errors V0.9.20 (2002-08-10) [umoeller] 1643 else 1644 break; 1528 1645 } 1529 1646 … … 1651 1768 ZERO(pDlgData); 1652 1769 lstInit(&pDlgData->llTables, FALSE); 1770 1771 lstInit(&pDlgData->llTempControls, FALSE); // V0.9.20 (2002-08-10) [umoeller] 1653 1772 1654 1773 if (pllControls) … … 1904 2023 *@@added V0.9.15 (2001-08-26) [umoeller] 1905 2024 *@@changed V0.9.15 (2001-08-26) [umoeller]: BS_DEFAULT for other than first button was ignored, fixed 2025 *@@changed V0.9.20 (2002-08-10) [umoeller]: return code checking was missing, fixed 1906 2026 */ 1907 2027 … … 1916 2036 */ 1917 2037 1918 ProcessAll(pDlgData, 1919 PROCESS_4_CALC_POSITIONS); 1920 1921 /* 1922 * 6) create control windows, finally 1923 * 1924 */ 1925 1926 pDlgData->ptlTotalOfs.x = DLG_OUTER_SPACING_X * FACTOR_X; 1927 pDlgData->ptlTotalOfs.y = DLG_OUTER_SPACING_Y * FACTOR_Y; 1928 1929 ProcessAll(pDlgData, 1930 PROCESS_5_CREATE_CONTROLS); 1931 1932 if (pDlgData->hwndDefPushbutton) 1933 { 1934 // we had a default pushbutton: 1935 // go set it V0.9.14 (2001-08-21) [umoeller] 1936 WinSetWindowULong(pDlgData->hwndDlg, 1937 QWL_DEFBUTTON, 1938 pDlgData->hwndDefPushbutton); 1939 *phwndFocusItem = pDlgData->hwndDefPushbutton; 1940 // V0.9.15 (2001-08-26) [umoeller] 1941 } 1942 else 1943 *phwndFocusItem = (pDlgData->hwndFirstFocus) 1944 ? pDlgData->hwndFirstFocus 1945 : pDlgData->hwndDlg; 2038 // this was missing a return code, fixed V0.9.20 (2002-08-10) [umoeller] 2039 if (!(arc = ProcessAll(pDlgData, 2040 PROCESS_4_CALC_POSITIONS))) 2041 { 2042 /* 2043 * 6) create control windows, finally 2044 * 2045 */ 2046 2047 pDlgData->ptlTotalOfs.x = DLG_OUTER_SPACING_X * FACTOR_X; 2048 pDlgData->ptlTotalOfs.y = DLG_OUTER_SPACING_Y * FACTOR_Y; 2049 2050 // this was missing a return code, fixed V0.9.20 (2002-08-10) [umoeller] 2051 if (!(arc = ProcessAll(pDlgData, 2052 PROCESS_5_CREATE_CONTROLS))) 2053 { 2054 if (pDlgData->hwndDefPushbutton) 2055 { 2056 // we had a default pushbutton: 2057 // go set it V0.9.14 (2001-08-21) [umoeller] 2058 WinSetWindowULong(pDlgData->hwndDlg, 2059 QWL_DEFBUTTON, 2060 pDlgData->hwndDefPushbutton); 2061 *phwndFocusItem = pDlgData->hwndDefPushbutton; 2062 // V0.9.15 (2001-08-26) [umoeller] 2063 } 2064 else 2065 *phwndFocusItem = (pDlgData->hwndFirstFocus) 2066 ? pDlgData->hwndFirstFocus 2067 : pDlgData->hwndDlg; 2068 } 2069 } 1946 2070 1947 2071 return arc; … … 1973 2097 // this may recurse for nested tables 1974 2098 } 2099 2100 lstClear(&pDlgData->llTempControls); // V0.9.20 (2002-08-10) [umoeller] 1975 2101 1976 2102 lstClear(&pDlgData->llTables); … … 2461 2587 2462 2588 APIRET dlghFormatDlg(HWND hwndDlg, // in: dialog frame to work on 2463 PCDLGHITEM paDlgItems, 2589 PCDLGHITEM paDlgItems, // in: definition array 2464 2590 ULONG cDlgItems, // in: array item count (NOT array size) 2465 PCSZ pcszControlsFont, // in: font for ctls with CTL_COMMON_FONT2591 PCSZ pcszControlsFont, // in: font for ctls with CTL_COMMON_FONT 2466 2592 ULONG flFlags, // in: DFFL_* flags 2467 2593 PSIZEL pszlClient, // out: size of all controls (ptr can be NULL) 2468 PVOID *ppllControls) // out: new LINKLIST receiving HWNDs of created controls (ptr can be NULL)2594 PVOID *ppllControls) // out: new LINKLIST receiving HWNDs of created controls (ptr can be NULL) 2469 2595 { 2470 2596 APIRET arc = NO_ERROR; -
trunk/src/helpers/dosh.c
r192 r201 268 268 // Warp 3 is reported as 20.30 269 269 // Warp 4 is reported as 20.40 270 // Aurora is reported as 20.45 270 // Aurora is reported as 20.45 (regardless of convenience packs) 271 271 272 272 if ( (aulBuf[0] > 20) // major > 20; not the case with Warp 3, 4, 5 -
trunk/src/helpers/gpih.c
r200 r201 534 534 * 535 535 *@@added V0.9.3 (2000-05-06) [umoeller] 536 *@@changed V0.9.20 (2002-08-10) [umoeller]: fixed underline for bitmap fonts, which never worked 536 537 */ 537 538 … … 559 560 lHits = GpiCharStringPos(hps, 560 561 prclRect, 561 flOptions,562 0, // flOptions, 562 563 lCountThis, 563 564 pchThis, … … 567 568 lCountLeft -= 512; 568 569 } while (lCountLeft > 0); 570 } 571 572 // I can't get underscore to work with bitmap fonts, 573 // so I'm doing it manually always now 574 // V0.9.20 (2002-08-10) [umoeller] 575 if (flOptions & CHS_UNDERSCORE) 576 { 577 POINTL ptl2, ptlSave; 578 GpiQueryCurrentPosition(hps, &ptlSave); 579 ptl2.x = pptlStart->x; 580 ptl2.y = pptlStart->y - 2; 581 GpiMove(hps, &ptl2); 582 ptl2.x = ptlSave.x; 583 GpiLine(hps, &ptl2); 584 GpiMove(hps, &ptlSave); 569 585 } 570 586 -
trunk/src/helpers/makefile
r159 r201 183 183 $(TESTCASE_DIR)\except.obj \ 184 184 $(TESTCASE_DIR)\debug.obj \ 185 $(TESTCASE_DIR)\textview.obj \ 186 $(TESTCASE_DIR)\textv_html.obj \ 187 $(TESTCASE_DIR)\tmsgfile.obj \ 188 $(TESTCASE_DIR)\datetime.obj \ 189 $(TESTCASE_DIR)\tree.obj \ 185 190 $(TESTCASE_DIR)\gpih.obj 186 191 -
trunk/src/helpers/textv_html.c
r167 r201 114 114 CHAR cSaved; 115 115 116 PXHTMLDATA pxhtml; // ptr to XHTMLDATA passed to txvConvertFromHTML 116 PSZ *ppszTitle; // out: title (ptr can be NULL) 117 // V0.9.20 (2002-08-10) [umoeller] 117 118 118 119 // formatting flags while going through the text … … 133 134 134 135 // anchors count 135 USHORT usAnchorIndex; // start with 1136 // USHORT usAnchorIndex; // start with 1 removed V0.9.20 (2002-08-10) [umoeller] 136 137 137 138 // list maintenance … … 421 422 *pSource = pct->cSaved; 422 423 423 pSource = strchr(pct->pSource, '>'); 424 if (pSource) 424 if (pSource = strchr(pct->pSource, '>')) 425 425 { 426 PSZ pNextOpen = strchr(pSource, '<');427 if (pNextOpen )426 PSZ pNextOpen; 427 if (pNextOpen = strchr(pSource, '<')) 428 428 { 429 429 // extract title 430 pct->pxhtml->pszTitle = strhSubstr(pSource + 1, pNextOpen); 430 if (pct->ppszTitle) 431 *(pct->ppszTitle) = strhSubstr(pSource + 1, pNextOpen); 432 // adjusted V0.9.20 (2002-08-10) [umoeller] 431 433 432 434 if (strnicmp(pNextOpen + 1, "/TITLE", 6) == 0) … … 434 436 // closing /TITLE tag found: 435 437 // search on after that 436 pct->pNewSource = strchr(pNextOpen, '>'); 437 if (pct->pNewSource) 438 if (pct->pNewSource = strchr(pNextOpen, '>')) 438 439 pct->pNewSource++; 439 440 } … … 806 807 { 807 808 CHAR szAnchor[10]; 809 PSZ pHREF = NULL; 808 810 809 811 pct->fInLink = FALSE; 810 812 811 if ( (pct->pszAttributes) && (pct->pxhtml)) // points into main source buffer813 if (pct->pszAttributes) 812 814 { 813 815 // we have attributes: 814 PSZ pszClosingTag = strchr(pct->pszAttributes, '>');815 if (pszClosingTag )816 PSZ pszClosingTag; 817 if (pszClosingTag = strchr(pct->pszAttributes, '>')) 816 818 { 817 819 ULONG ulOfs = 0; … … 822 824 */ 823 825 824 PSZ pHREF = strhGetTextAttr(pct->pszAttributes, "HREF", &ulOfs), 825 pNAME = 0; 826 PSZ pNAME = 0; 826 827 827 828 // replace '>' with null char to mark end of search 828 829 *pszClosingTag = 0; 829 830 830 if (pHREF) 831 { 831 if (pHREF = strhGetTextAttr(pct->pszAttributes, "HREF", &ulOfs)) 832 832 // OK, we got a link target: 833 // create a link item and append it to the output list834 PXHTMLLINK pNewLink = (PXHTMLLINK)malloc(sizeof(XHTMLLINK));835 memset(pNewLink, 0, sizeof(XHTMLLINK));836 837 833 pct->fInLink = TRUE; 838 839 // this starts with anchor 1840 pNewLink->usLinkIndex = ++pct->usAnchorIndex;841 pNewLink->pszTargetFile = pHREF;842 834 // do not free 843 lstAppendItem(&pct->pxhtml->llLinks, pNewLink);844 }845 835 846 836 /* … … 849 839 */ 850 840 851 pNAME = strhGetTextAttr(pct->pszAttributes, "NAME", &ulOfs); 852 if (pNAME) 841 if (pNAME = strhGetTextAttr(pct->pszAttributes, "NAME", &ulOfs)) 853 842 { 854 843 AppendString(pct, … … 860 849 free(pNAME); 861 850 } 851 862 852 // restore '>' 863 853 *pszClosingTag = '>'; … … 865 855 } 866 856 867 if (p ct->fInLink)857 if (pHREF) 868 858 { 869 sprintf(szAnchor, "%04hX", pct->usAnchorIndex);870 859 AppendString(pct, 871 TXVESC_LINK );860 TXVESC_LINK_BEGIN); 872 861 AppendString(pct, 873 szAnchor); 862 pHREF); 863 // must be terminated with 0xFF 864 AppendChar(pct, 0xFF); 865 866 free(pHREF); 874 867 } 875 868 } … … 880 873 { 881 874 AppendString(pct, 882 TXVESC_LINK "####");875 TXVESC_LINK_END); 883 876 pct->fInLink = FALSE; 884 877 } … … 2051 2044 * 2052 2045 *@@added V0.9.3 (2000-05-06) [umoeller] 2046 *@@changed V0.9.20 (2002-08-10) [umoeller]: changed prototype 2053 2047 */ 2054 2048 2055 BOOL txvConvertFromHTML( char **ppszText,2056 P VOID pxhtml, // out: various config data (PXHTMLDATA)2049 BOOL txvConvertFromHTML(PSZ *ppszText, // in/out: text (gets reallocated) 2050 PSZ *ppszTitle, // out: if != NULL, receives malloc'd buffer with HTML title 2057 2051 PULONG pulProgress, // out: progress (ptr can be NULL) 2058 2052 PBOOL pfCancel) // in: cancel flag (ptr can be NULL) … … 2062 2056 ULONG cbSource = strlen(*ppszText); 2063 2057 2064 XHTMLDATA xhtmlTemp = {0};2065 BOOL fUsingTemp = FALSE;2066 2058 COPYTARGET ct = {0}; 2067 2059 2068 2060 lstInit(&ct.llLists, 2069 2061 TRUE); // free items 2062 2063 ct.ppszTitle = ppszTitle; // V0.9.20 (2002-08-10) [umoeller] 2064 // can be NULL 2070 2065 2071 2066 ct.pSource = *ppszText; 2072 2067 // skip leading spaces 2073 2068 ct.fSkipNextSpace = TRUE; 2074 ct.pxhtml = (PXHTMLDATA)pxhtml;2075 if (ct.pxhtml == NULL) // not specified:2076 {2077 ct.pxhtml = &xhtmlTemp;2078 fUsingTemp = TRUE;2079 }2080 2081 lstInit(&ct.pxhtml->llLinks, TRUE); // auto-free2082 2069 2083 2070 // step 2: … … 2229 2216 lstClear(&ct.llLists); 2230 2217 2231 if (fUsingTemp)2232 {2233 if (xhtmlTemp.pszTitle)2234 free(xhtmlTemp.pszTitle);2235 lstClear(&xhtmlTemp.llLinks);2236 // ### better really clear this... there are PSZ's inside2237 }2238 2239 2218 return brc; 2240 2219 } -
trunk/src/helpers/textview.c
r167 r201 243 243 244 244 #include "helpers\textview.h" 245 #include "helpers\textv_html.h" 245 246 246 247 #pragma hdrstop … … 418 419 * 419 420 *@@added V0.9.3 (2000-05-07) [umoeller] 421 *@@changed V0.9.20 (2002-08-10) [umoeller]: now stripping \xFF too 420 422 */ 421 423 … … 423 425 ULONG ulTabSize) 424 426 { 425 PSZ pSource = *ppszText; 426 ULONG cbNew = 1000; 427 PSZ pszNew = (PSZ)malloc(cbNew); 428 PSZ pTarget = pszNew; 427 PSZ pSource = *ppszText; 428 ULONG cbNew = 1000; 429 PSZ pszNew = (PSZ)malloc(cbNew); 430 PSZ pTarget = pszNew; 431 ULONG ul; 429 432 430 433 while (*pSource) 431 434 { 432 if (*pSource == '\r') 433 pSource++; 434 else if (*pSource == '\t') 435 { 436 ULONG ul; 437 for (ul = 0; 438 ul < ulTabSize; 439 ul++) 435 switch (*pSource) 436 { 437 case '\r': 438 pSource++; 439 break; 440 441 case '\t': 442 for (ul = 0; 443 ul < ulTabSize; 444 ul++) 445 AppendCharNoCheck(&pszNew, 446 &cbNew, 447 &pTarget, 448 ' '); 449 450 // skip the tab 451 pSource++; 452 break; 453 454 case '\xFF': // V0.9.20 (2002-08-10) [umoeller] 440 455 AppendCharNoCheck(&pszNew, 441 456 &cbNew, 442 457 &pTarget, 443 458 ' '); 444 445 // skip the tab 446 pSource++; 459 pSource++; 460 break; 461 462 default: 463 AppendCharNoCheck(&pszNew, 464 &cbNew, 465 &pTarget, 466 *pSource++); 447 467 } 448 else449 AppendCharNoCheck(&pszNew,450 &cbNew,451 &pTarget,452 *pSource++);453 468 } 469 454 470 AppendCharNoCheck(&pszNew, 455 471 &cbNew, … … 542 558 // of the next line or points to the \0 character 543 559 544 return (prc);560 return prc; 545 561 } 546 562 … … 551 567 #define TXVFRECTF_ENDOFTEXT 0x0010 552 568 */ 569 553 570 /* 554 571 *@@ FORMATLINEBUF: … … 577 594 578 595 // current anchor 579 USHORT usCurrentAnchor; 580 // this is > 0 if we're currently in an anchor block 596 PSZ pszCurrentLink; 597 // this is != NULL if we're currently in a link block 598 // and points to an item in XFORMATDATA.llLinks 599 // (simply copied to the word structs that are created) 581 600 582 601 // data copied to TXVWORD 583 602 LONG lcid; 584 603 LONG lPointSize; 585 ULONG fl Options;// any combination of CHS_UNDERSCORE and CHS_STRIKEOUT604 ULONG flChar; // any combination of CHS_UNDERSCORE and CHS_STRIKEOUT 586 605 587 606 // counters, ... … … 611 630 * 612 631 *@@added V0.9.3 (2000-05-14) [umoeller] 632 *@@changed V0.9.20 (2002-08-10) [umoeller]: rewrote link implementation 613 633 */ 614 634 … … 709 729 pWord->lcid = pflbuf->pfmtf->lcid; 710 730 pWord->lPointSize = pflbuf->lPointSize; 711 pWord->fl Options = pflbuf->flOptions;712 713 pWord-> usAnchor = pflbuf->usCurrentAnchor; // 0 if none731 pWord->flChar = pflbuf->flChar; 732 733 pWord->pszLinkTarget = pflbuf->pszCurrentLink; // 0 if none 714 734 } 715 735 716 return (pWord);736 return pWord; 717 737 } 718 738 … … 756 776 // an escape character was found; txvCreateRectangle 757 777 // then sets pCurrent to the escape character (\xFF) 758 CHAR cCode1 = *((*ppCurrent) +1);759 CHAR cCode2 = *((*ppCurrent) +2);778 CHAR cCode1 = *((*ppCurrent) + 1); 779 CHAR cCode2 = *((*ppCurrent) + 2); 760 780 ULONG ulSkip = 3; // per default, skip \xFF plus two 761 781 CHAR szDecimal[10]; … … 769 789 case 1: // change font: 770 790 // three decimals follow specifying the font 771 memcpy(szDecimal, (*ppCurrent) +2, 3);791 memcpy(szDecimal, (*ppCurrent) + 2, 3); 772 792 szDecimal[3] = 0; 773 793 lDecimal = atoi(szDecimal); … … 795 815 case 4: // U or /U 796 816 if (cCode2 == 1) 797 pflbuf->fl Options|= CHS_UNDERSCORE;817 pflbuf->flChar |= CHS_UNDERSCORE; 798 818 else 799 pflbuf->fl Options&= ~CHS_UNDERSCORE;819 pflbuf->flChar &= ~CHS_UNDERSCORE; 800 820 break; 801 821 802 822 case 5: // STRIKE or /STRIKE 803 823 if (cCode2 == 1) 804 pflbuf->fl Options|= CHS_STRIKEOUT;824 pflbuf->flChar |= CHS_STRIKEOUT; 805 825 else 806 pflbuf->fl Options&= ~CHS_STRIKEOUT;826 pflbuf->flChar &= ~CHS_STRIKEOUT; 807 827 break; 808 828 809 case 6: // A or /A HREF= (link) 810 // four characters with hex anchor index (>=1) 811 // or "####" 812 if ( *( (*ppCurrent)+2 ) 813 == '#' 814 ) 815 pflbuf->usCurrentAnchor = 0; 816 else 829 case 6: // A HREF= (link) 830 // changed implementation V0.9.20 (2002-08-10) [umoeller] 831 { 832 // this is variable in length and terminated with 833 // another 0xFF char; what's in between is the 834 // link target name and gets appended to 835 // XFORMATDATA.llLinks 836 PSZ pEnd; 837 if (pEnd = strchr((*ppCurrent) + 2, 0xFF)) 817 838 { 818 PSZ pEnd;819 memcpy(szDecimal, (*ppCurrent)+2, 4);820 szDecimal[4] = 0; 821 l Decimal = strtol(szDecimal, &pEnd, 16);822 pflbuf->usCurrentAnchor = lDecimal;839 pflbuf->pszCurrentLink = strhSubstr((*ppCurrent) + 2, pEnd); 840 ulSkip = pEnd - *ppCurrent + 1; 841 842 lstAppendItem(&pxfd->llLinks, 843 pflbuf->pszCurrentLink); 823 844 } 824 825 ulSkip = 6; 845 } 826 846 break; 827 847 828 case 7: // A NAME= (anchor name) 848 case 7: // /A HREF (end of link) 849 pflbuf->pszCurrentLink = NULL; 850 ulSkip = 2; 851 break; 852 853 case 8: // A NAME= (anchor name) 829 854 { 830 855 // this is variable in length and terminated with … … 834 859 // searches the buffer 835 860 PSZ pEnd; 836 if (pEnd = strchr((*ppCurrent) +2, 0xFF))861 if (pEnd = strchr((*ppCurrent) + 2, 0xFF)) 837 862 { 838 863 ulSkip = pEnd - *ppCurrent + 1; … … 849 874 // three characters follow specifying the 850 875 // percentage 851 memcpy(szDecimal, (*ppCurrent) +2, 3);876 memcpy(szDecimal, (*ppCurrent) + 2, 3); 852 877 szDecimal[3] = 0; 853 878 lDecimal = atoi(szDecimal); … … 858 883 859 884 case 0x20: // left margin changed: 860 memcpy(szDecimal, (*ppCurrent) +2, 4); // four decimals xxxx885 memcpy(szDecimal, (*ppCurrent) + 2, 4); // four decimals xxxx 861 886 szDecimal[4] = 0; 862 887 lDecimal = atoi(szDecimal); … … 871 896 872 897 case 0x21: // first line margin changed: 873 memcpy(szDecimal, (*ppCurrent) +2, 4); // +xxx, -xxx898 memcpy(szDecimal, (*ppCurrent) + 2, 4); // +xxx, -xxx 874 899 szDecimal[4] = 0; 875 900 lDecimal = atoi(szDecimal); … … 899 924 case 0x30: // spacing before paragraph: 900 925 // four chars follow with either "####" or decimal spacing 901 memcpy(szDecimal, (*ppCurrent) +2, 4);926 memcpy(szDecimal, (*ppCurrent) + 2, 4); 902 927 szDecimal[4] = 0; 903 928 if (memcmp(szDecimal, "####", 4) == 0) … … 915 940 case 0x31: // spacing before paragraph: 916 941 // four chars follow with either "####" or decimal spacing 917 memcpy(szDecimal, (*ppCurrent) +2, 4);942 memcpy(szDecimal, (*ppCurrent) + 2, 4); 918 943 szDecimal[4] = 0; 919 944 if (memcmp(szDecimal, "####", 4) == 0) … … 949 974 pEscapeWord->cEscapeCode = *(*ppCurrent + 1); 950 975 pEscapeWord->fPaintEscapeWord = fPaintEscapeWord; 951 pEscapeWord->usAnchor = pflbuf->usCurrentAnchor; // 0 if none 976 pEscapeWord->pszLinkTarget = pflbuf->pszCurrentLink; 977 // V0.9.20 (2002-08-10) [umoeller] 978 // NULL if none 952 979 if (fPaintEscapeWord) 953 980 { … … 955 982 pEscapeWord->lcid = pflbuf->pfmtf->lcid; 956 983 pEscapeWord->lPointSize = pflbuf->lPointSize; 957 pEscapeWord->fl Options = pflbuf->flOptions;984 pEscapeWord->flChar = pflbuf->flChar; 958 985 } 959 986 lstAppendItem(&pxfd->llWords, pEscapeWord); … … 965 992 *ppCurrent += ulSkip; 966 993 967 return (pEscapeWord);994 return pEscapeWord; 968 995 } 969 996 … … 1055 1082 * to paint rectangles. 1056 1083 * 1057 * -- XFORMATDATA. ulViewportCX, ulViewportCY: total width1058 * and height of the " viewport", i.e. the total space1084 * -- XFORMATDATA.szlWorkspace: total width 1085 * and height of the "workspace", i.e. the total space 1059 1086 * needed to display the text (in pels). This might 1060 1087 * be smaller, the same, or larger than prclView, … … 1062 1089 * 1063 1090 * When displaying text, you should display scroll bars 1064 * if the viewportis larger than the window (prclView).1065 * 1066 * When printing, if the viewportis larger than the1091 * if the workspace is larger than the window (prclView). 1092 * 1093 * When printing, if the workspace is larger than the 1067 1094 * printer page (prclView), you will need to call 1068 1095 * txvPaintText several times for each page. … … 1087 1114 lstClear(&pxfd->llWords); 1088 1115 1089 pxfd-> ulViewportCX= 0;1090 pxfd-> ulViewportCY= 0;1116 pxfd->szlWorkspace.cx = 0; 1117 pxfd->szlWorkspace.cy = 0; 1091 1118 1092 1119 if (pxfd->strViewText.cbAllocated) … … 1366 1393 1367 1394 // update x extents 1368 if (pRect->rcl.xRight > pxfd-> ulViewportCX)1369 pxfd-> ulViewportCX= pRect->rcl.xRight;1395 if (pRect->rcl.xRight > pxfd->szlWorkspace.cx) 1396 pxfd->szlWorkspace.cx = pRect->rcl.xRight; 1370 1397 1371 1398 // and quit the inner loop … … 1392 1419 1393 1420 // lCurrentYTop now has the bottommost point we've used; 1394 // store this as viewport(this might be negative)1395 pxfd-> ulViewportCY= lOrigYTop - lCurrentYTop;1421 // store this as workspace (this might be negative) 1422 pxfd->szlWorkspace.cy = lOrigYTop - lCurrentYTop; 1396 1423 } 1397 1424 } … … 1586 1613 { 1587 1614 PTXVWORD pWordThis = (PTXVWORD)pWordNode->pItemData; 1588 ULONG fl Options = pWordThis->flOptions;1589 1590 if (pWordThis-> usAnchor)1591 fl Options|= CHS_UNDERSCORE;1615 ULONG flChar = pWordThis->flChar; 1616 1617 if (pWordThis->pszLinkTarget) // V0.9.20 (2002-08-10) [umoeller] 1618 flChar |= CHS_UNDERSCORE; 1592 1619 1593 1620 // x start: this word's X coordinate … … 1621 1648 &ptlStart, 1622 1649 &rclLine, 1623 fl Options,1650 flChar, 1624 1651 pWordThis->cChars, 1625 1652 (PSZ)pWordThis->pStart); … … 1749 1776 } 1750 1777 1751 return (pWordNodeFound);1778 return pWordNodeFound; 1752 1779 } 1753 1780 … … 1802 1829 } 1803 1830 1804 return (pNodeFound);1831 return pNodeFound; 1805 1832 } 1806 1833 … … 1810 1837 * 1811 1838 ********************************************************************/ 1839 1840 #define QWL_PRIVATE 4 // V0.9.20 (2002-08-10) [umoeller] 1812 1841 1813 1842 /* 1814 1843 *@@ TEXTVIEWWINDATA: 1815 1844 * view control-internal structure, stored in 1816 * QWL_ USERat fnwpTextView.1845 * QWL_PRIVATE at fnwpTextView. 1817 1846 * This is device-dependent on the text view 1818 1847 * window. … … 1826 1855 HPS hps; 1827 1856 1857 ULONG flStyle; // window style flags copied on WM_CREATE 1858 // V0.9.20 (2002-08-10) [umoeller] 1859 1828 1860 LONG lBackColor, 1829 1861 lForeColor; … … 1840 1872 1841 1873 RECTL rclViewReal, // window rect as returned by WinQueryWindowRect 1842 // (top right point is inclusive! !)1874 // (top right point is inclusive!) 1843 1875 rclViewPaint, // same as rclViewReal, but excluding scroll bars 1844 1876 rclViewText; // same as rclViewPaint, but excluding cdata borders … … 1851 1883 // anchor clicking 1852 1884 PLISTNODE pWordNodeFirstInAnchor; // points to first word which belongs to anchor 1853 USHORT usLastAnchorClicked; // last anchor which was clicked (1-0xFFFF) 1885 // USHORT usLastAnchorClicked; // last anchor which was clicked (1-0xFFFF) 1886 PSZ pszLastLinkClicked; // last link that was clicked (points into llLinks) 1887 1854 1888 } TEXTVIEWWINDATA, *PTEXTVIEWWINDATA; 1855 1889 … … 1953 1987 // if either the vertical or horizontal scroll bar has 1954 1988 // popped up or been hidden 1955 if (ptxvd-> cdata.flStyle & XTXF_VSCROLL)1989 if (ptxvd->flStyle & XS_VSCROLL) 1956 1990 { 1957 1991 // vertical scroll bar enabled: … … 1968 2002 } 1969 2003 1970 if (ptxvd-> cdata.flStyle & XTXF_HSCROLL)2004 if (ptxvd->flStyle & XS_HSCROLL) 1971 2005 { 1972 2006 ulOfs = 0; … … 2011 2045 if (ptxvd->ulViewYOfs < 0) 2012 2046 ptxvd->ulViewYOfs = 0; 2013 if (ptxvd->ulViewYOfs > ((LONG)ptxvd->xfd. ulViewportCY- ulWinCY))2014 ptxvd->ulViewYOfs = (LONG)ptxvd->xfd. ulViewportCY- ulWinCY;2047 if (ptxvd->ulViewYOfs > ((LONG)ptxvd->xfd.szlWorkspace.cy - ulWinCY)) 2048 ptxvd->ulViewYOfs = (LONG)ptxvd->xfd.szlWorkspace.cy - ulWinCY; 2015 2049 2016 2050 // vertical scroll bar enabled at all? 2017 if (ptxvd-> cdata.flStyle & XTXF_VSCROLL)2051 if (ptxvd->flStyle & XS_VSCROLL) 2018 2052 { 2019 2053 BOOL fEnabled = winhUpdateScrollBar(ptxvd->hwndVScroll, 2020 2054 ulWinCY, 2021 ptxvd->xfd. ulViewportCY,2055 ptxvd->xfd.szlWorkspace.cy, 2022 2056 ptxvd->ulViewYOfs, 2023 (ptxvd-> cdata.flStyle & XTXF_AUTOVHIDE));2057 (ptxvd->flStyle & XS_AUTOVHIDE)); 2024 2058 // is auto-hide on? 2025 if (ptxvd-> cdata.flStyle & XTXF_AUTOVHIDE)2059 if (ptxvd->flStyle & XS_AUTOVHIDE) 2026 2060 { 2027 2061 // yes, auto-hide on: did visibility change? … … 2046 2080 2047 2081 // horizontal scroll bar enabled at all? 2048 if (ptxvd-> cdata.flStyle & XTXF_HSCROLL)2082 if (ptxvd->flStyle & XS_HSCROLL) 2049 2083 { 2050 2084 BOOL fEnabled = winhUpdateScrollBar(ptxvd->hwndHScroll, 2051 2085 ulWinCX, 2052 ptxvd->xfd. ulViewportCX,2086 ptxvd->xfd.szlWorkspace.cx, 2053 2087 ptxvd->ulViewXOfs, 2054 (ptxvd-> cdata.flStyle & XTXF_AUTOHHIDE));2088 (ptxvd->flStyle & XS_AUTOHHIDE)); 2055 2089 // is auto-hide on? 2056 if (ptxvd-> cdata.flStyle & XTXF_AUTOHHIDE)2090 if (ptxvd->flStyle & XS_AUTOHHIDE) 2057 2091 { 2058 2092 // yes, auto-hide on: did visibility change? … … 2071 2105 2072 2106 WinInvalidateRect(hwndTextView, NULL, FALSE); 2107 } 2108 2109 /* 2110 *@@ SetWindowText: 2111 * implementation for WM_SETWINDOWPARAMS and 2112 * also WM_CREATE to set the window text. 2113 * 2114 *@@added V0.9.20 (2002-08-10) [umoeller] 2115 */ 2116 2117 VOID SetWindowText(HWND hwndTextView, 2118 PTEXTVIEWWINDATA ptxvd, 2119 PCSZ pcszText) 2120 { 2121 if (pcszText && *pcszText) 2122 { 2123 PXSTRING pstr = &ptxvd->xfd.strViewText; 2124 PSZ p; 2125 2126 switch (ptxvd->flStyle & XS_FORMAT_MASK) 2127 { 2128 case XS_PLAINTEXT: // 0x0100 2129 xstrcpy(pstr, 2130 pcszText, 2131 0); 2132 xstrConvertLineFormat(pstr, 2133 CRLF2LF); 2134 p = pstr->psz; 2135 while (p = strchr(p, '\xFF')) 2136 *p = ' '; 2137 break; 2138 2139 case XS_HTML: // 0x0200 2140 if (p = strdup(pcszText)) 2141 { 2142 PSZ p2 = p; 2143 while (p2 = strchr(p2, '\xFF')) 2144 *p2 = ' '; 2145 txvConvertFromHTML(&p, NULL, NULL, NULL); 2146 xstrset(pstr, p); 2147 xstrConvertLineFormat(pstr, 2148 CRLF2LF); 2149 } 2150 break; 2151 2152 default: // case XS_PREFORMATTED: // 0x0000 2153 // no conversion (default) 2154 xstrcpy(pstr, 2155 pcszText, 2156 0); 2157 break; 2158 } 2159 2160 // if the last character of the window text is not "\n", 2161 // add it explicitly here, or our lines processing 2162 // is being funny 2163 // V0.9.20 (2002-08-10) [umoeller] 2164 if (pstr->psz[pstr->ulLength - 1] != '\n') 2165 xstrcatc(pstr, '\n'); 2166 2167 ptxvd->ulViewXOfs = 0; 2168 ptxvd->ulViewYOfs = 0; 2169 AdjustViewRects(hwndTextView, 2170 ptxvd); 2171 FormatText2Screen(hwndTextView, 2172 ptxvd, 2173 FALSE, 2174 TRUE); // full format 2175 } 2073 2176 } 2074 2177 … … 2136 2239 { 2137 2240 POINTL ptlStart; 2138 ULONG fl Options = pWordThis->flOptions;2241 ULONG flChar = pWordThis->flChar; 2139 2242 PTXVRECTANGLE pLineRcl = pWordThis->pRectangle; 2140 2243 … … 2145 2248 rclLine.yTop = pLineRcl->rcl.yTop + ptxvd->ulViewYOfs; 2146 2249 2147 if (pWordThis-> usAnchor)2148 fl Options|= CHS_UNDERSCORE;2250 if (pWordThis->pszLinkTarget) 2251 flChar |= CHS_UNDERSCORE; 2149 2252 2150 2253 // x start: this word's X coordinate … … 2164 2267 2165 2268 if (!pWordThis->cEscapeCode) 2269 { 2166 2270 gpihCharStringPosAt(ptxvd->hps, 2167 2271 &ptlStart, 2168 2272 &rclLine, 2169 fl Options,2273 flChar, 2170 2274 pWordThis->cChars, 2171 2275 (PSZ)pWordThis->pStart); 2276 } 2172 2277 else 2173 2278 // escape to be painted: … … 2188 2293 { 2189 2294 PLISTNODE pNode = ptxvd->pWordNodeFirstInAnchor; 2190 USHORT usAnchor = 0;2295 PSZ pszLinkTarget = NULL; 2191 2296 while (pNode) 2192 2297 { 2193 2298 PTXVWORD pWordThis = (PTXVWORD)pNode->pItemData; 2194 if ( usAnchor == 0)2299 if (!pszLinkTarget) 2195 2300 // first loop: 2196 usAnchor = pWordThis->usAnchor;2301 pszLinkTarget = pWordThis->pszLinkTarget; 2197 2302 else 2198 if (pWordThis-> usAnchor != usAnchor)2303 if (pWordThis->pszLinkTarget != pszLinkTarget) 2199 2304 // first word with different anchor: 2200 2305 break; … … 2211 2316 * window procedure for the text view control. This is 2212 2317 * registered with the WC_XTEXTVIEW class in txvRegisterTextView. 2213 * We have a TEXTVIEWWINDATA structure in QWL_USER where we2214 * store all information we need.2215 2318 * 2216 2319 * The text view control is not a subclassed whatever control, … … 2236 2339 * 2237 2340 * -- WM_CHAR: if we have the focus, the user can move the 2238 * visible part within the viewportusing the usual2341 * visible part within the workspace using the usual 2239 2342 * cursor and HOME/END keys. 2240 2343 * … … 2251 2354 * should be speedier. 2252 2355 * 2356 * The text view control uses a private window word for storing 2357 * its own data. The client is free to use QWL_USER of the 2358 * text view control. 2359 * 2253 2360 *@@changed V0.9.3 (2000-05-05) [umoeller]: removed TXM_NEWTEXT; now supporting WinSetWindowText 2254 2361 *@@changed V0.9.3 (2000-05-07) [umoeller]: crashed if create param was NULL; fixed 2362 *@@changed V0.9.20 (2002-08-10) [umoeller]: no longer using QWL_USER, which is free now 2363 *@@changed V0.9.20 (2002-08-10) [umoeller]: setting text on window creation never worked, fixed 2364 *@@changed V0.9.20 (2002-08-10) [umoeller]: added TXN_ANCHORCLICKED owner notify for anchors 2365 *@@changed V0.9.20 (2002-08-10) [umoeller]: converted private style flags to XS_* window style flags 2366 *@@changed V0.9.20 (2002-08-10) [umoeller]: added support for formatting HTML and plain text automatically 2255 2367 */ 2256 2368 … … 2259 2371 MRESULT mrc = 0; 2260 2372 2261 PTEXTVIEWWINDATA ptxvd = (PTEXTVIEWWINDATA)WinQueryWindowPtr(hwndTextView, QWL_ USER);2373 PTEXTVIEWWINDATA ptxvd = (PTEXTVIEWWINDATA)WinQueryWindowPtr(hwndTextView, QWL_PRIVATE); 2262 2374 2263 2375 switch (msg) … … 2277 2389 mrc = (MPARAM)TRUE; // error 2278 2390 2279 // allocate TEXTVIEWWINDATA for QWL_ USER2391 // allocate TEXTVIEWWINDATA for QWL_PRIVATE 2280 2392 if (ptxvd = (PTEXTVIEWWINDATA)malloc(sizeof(TEXTVIEWWINDATA))) 2281 2393 { 2282 2394 SIZEL szlPage = {0, 0}; 2283 2395 BOOL fShow = FALSE; 2284 // LONG lcid = 0;2285 2396 2286 2397 // query message queue … … 2290 2401 2291 2402 memset(ptxvd, 0, sizeof(TEXTVIEWWINDATA)); 2292 WinSetWindowPtr(hwndTextView, QWL_ USER, ptxvd);2403 WinSetWindowPtr(hwndTextView, QWL_PRIVATE, ptxvd); 2293 2404 2294 2405 ptxvd->hab = WinQueryAnchorBlock(hwndTextView); … … 2299 2410 &szlPage, // use same page size as device 2300 2411 PU_PELS | GPIT_MICRO | GPIA_ASSOC); 2412 2413 // copy window style flags V0.9.20 (2002-08-10) [umoeller] 2414 ptxvd->flStyle = pcs->flStyle; 2301 2415 2302 2416 gpihSwitchToRGB(ptxvd->hps); … … 2345 2459 &sbcd, 2346 2460 0); 2347 fShow = ((ptxvd-> cdata.flStyle & XTXF_VSCROLL) != 0);2461 fShow = ((ptxvd->flStyle & XS_VSCROLL) != 0); 2348 2462 WinShowWindow(ptxvd->hwndVScroll, fShow); 2349 2463 ptxvd->fVScrollVisible = fShow; … … 2360 2474 &sbcd, 2361 2475 0); 2362 fShow = ((ptxvd-> cdata.flStyle & XTXF_HSCROLL) != 0);2476 fShow = ((ptxvd->flStyle & XS_HSCROLL) != 0); 2363 2477 WinShowWindow(ptxvd->hwndHScroll, fShow); 2364 2478 ptxvd->fHScrollVisible = fShow; 2365 2479 2480 if (ptxvd->flStyle & XS_WORDWRAP) 2481 // word-wrapping should be enabled from the start: 2482 // V0.9.20 (2002-08-10) [umoeller] 2483 ptxvd->xfd.fmtpStandard.fWordWrap = TRUE; 2484 2366 2485 // set "code" format 2367 2486 SetFormatFont(ptxvd->hps, 2368 2369 2370 2487 &ptxvd->xfd.fmtcCode, 2488 6, 2489 "System VIO"); 2371 2490 2372 2491 // get colors from presparams/syscolors … … 2375 2494 AdjustViewRects(hwndTextView, 2376 2495 ptxvd); 2496 2497 if (ptxvd->flStyle & XS_HTML) 2498 { 2499 // if we're operating in HTML mode, set a 2500 // different default paragraph format to 2501 // make things prettier 2502 // V0.9.20 (2002-08-10) [umoeller] 2503 ptxvd->xfd.fmtpStandard.lSpaceBefore = 5; 2504 ptxvd->xfd.fmtpStandard.lSpaceAfter = 5; 2505 } 2506 2507 // setting the window text on window creation never 2508 // worked V0.9.20 (2002-08-10) [umoeller] 2509 if (pcs->pszText) 2510 SetWindowText(hwndTextView, 2511 ptxvd, 2512 pcs->pszText); 2377 2513 2378 2514 mrc = (MPARAM)FALSE; // OK … … 2392 2528 { 2393 2529 WNDPARAMS *pwndParams; 2394 if (pwndParams = (WNDPARAMS *)mp1) 2530 if ( (pwndParams = (WNDPARAMS *)mp1) 2531 && (pwndParams->fsStatus & WPM_TEXT) 2532 ) 2395 2533 { 2396 if (pwndParams->fsStatus & WPM_TEXT) 2397 { 2398 xstrcpy(&ptxvd->xfd.strViewText, 2399 pwndParams->pszText, 2400 0); 2401 ptxvd->ulViewXOfs = 0; 2402 ptxvd->ulViewYOfs = 0; 2403 /* ptxvd->fVScrollVisible = FALSE; 2404 ptxvd->fHScrollVisible = FALSE; */ 2405 AdjustViewRects(hwndTextView, 2406 ptxvd); 2407 FormatText2Screen(hwndTextView, 2408 ptxvd, 2409 FALSE, 2410 TRUE); // full format 2411 } 2534 SetWindowText(hwndTextView, 2535 ptxvd, 2536 pwndParams->pszText); 2537 mrc = (MRESULT)TRUE; // was missing V0.9.20 (2002-08-10) [umoeller] 2412 2538 } 2413 2539 } … … 2485 2611 // (in between scroll bars) if we have 2486 2612 // both vertical and horizontal scroll bars 2487 if ( (ptxvd-> cdata.flStyle & (XTXF_VSCROLL | XTXF_HSCROLL))2488 == (X TXF_VSCROLL | XTXF_HSCROLL)2613 if ( (ptxvd->flStyle & (XS_VSCROLL | XS_HSCROLL)) 2614 == (XS_VSCROLL | XS_HSCROLL) 2489 2615 && (ptxvd->fVScrollVisible) 2490 2616 && (ptxvd->fHScrollVisible) … … 2523 2649 &rcl2Update); 2524 2650 2525 if (WinQueryFocus(HWND_DESKTOP) == hwndTextView) 2651 if ( (!(ptxvd->flStyle & XS_STATIC)) 2652 // V0.9.20 (2002-08-10) [umoeller] 2653 && (WinQueryFocus(HWND_DESKTOP) == hwndTextView) 2654 ) 2526 2655 { 2527 2656 // we have the focus: … … 2585 2714 &ptxvd->ulViewYOfs, 2586 2715 &ptxvd->rclViewText, 2587 ptxvd->xfd. ulViewportCY,2716 ptxvd->xfd.szlWorkspace.cy, 2588 2717 ptxvd->cdata.ulVScrollLineUnit, 2589 2718 msg, … … 2604 2733 &ptxvd->ulViewXOfs, 2605 2734 &ptxvd->rclViewText, 2606 ptxvd->xfd. ulViewportCX,2735 ptxvd->xfd.szlWorkspace.cx, 2607 2736 ptxvd->cdata.ulHScrollLineUnit, 2608 2737 msg, … … 2618 2747 case WM_SETFOCUS: 2619 2748 { 2620 HPS hps = WinGetPS(hwndTextView); 2621 gpihSwitchToRGB(hps); 2622 PaintViewFocus(hps, 2623 ptxvd, 2624 (mp2 != 0)); 2625 WinReleasePS(hps); 2749 if (ptxvd->flStyle & XS_STATIC) 2750 { 2751 if (mp2) 2752 { 2753 // we're receiving the focus, but shouldn't have it: 2754 // then behave like the static control does, that is, 2755 // give focus to the next window in the dialog 2756 HWND hwnd = hwndTextView, 2757 hwndStart = hwnd; 2758 2759 while (TRUE) 2760 { 2761 ULONG flStyle; 2762 2763 if (!(hwnd = WinQueryWindow(hwnd, QW_NEXT))) 2764 hwnd = WinQueryWindow(WinQueryWindow(hwndStart, QW_PARENT), QW_TOP); 2765 2766 // avoid endless looping 2767 if (hwnd == hwndStart) 2768 { 2769 if ( (hwnd = WinQueryWindow(hwnd, QW_OWNER)) 2770 && (hwnd == hwndStart) 2771 ) 2772 hwnd = NULLHANDLE; 2773 2774 break; 2775 } 2776 2777 if ( (flStyle = WinQueryWindowULong(hwnd, QWL_STYLE)) 2778 && (flStyle & (WS_DISABLED | WS_TABSTOP | WS_VISIBLE) 2779 == (WS_TABSTOP | WS_VISIBLE)) 2780 ) 2781 { 2782 WinSetFocus(HWND_DESKTOP, hwnd); 2783 break; 2784 } 2785 }; 2786 } 2787 } 2788 else 2789 { 2790 HPS hps = WinGetPS(hwndTextView); 2791 gpihSwitchToRGB(hps); 2792 PaintViewFocus(hps, 2793 ptxvd, 2794 (mp2 != 0)); 2795 WinReleasePS(hps); 2796 } 2626 2797 } 2627 2798 break; … … 2663 2834 ptlPos.y = SHORT2FROMMP(mp1) - ptxvd->ulViewYOfs; 2664 2835 2665 if (hwndTextView != WinQueryFocus(HWND_DESKTOP)) 2836 if ( (!(ptxvd->flStyle & XS_STATIC)) 2837 // V0.9.20 (2002-08-10) [umoeller] 2838 && (hwndTextView != WinQueryFocus(HWND_DESKTOP)) 2839 ) 2666 2840 WinSetFocus(HWND_DESKTOP, hwndTextView); 2667 2841 2668 ptxvd-> usLastAnchorClicked = 0;2842 ptxvd->pszLastLinkClicked = NULL; 2669 2843 2670 2844 if (pWordNodeClicked = txvFindWordFromPoint(&ptxvd->xfd, … … 2673 2847 PTXVWORD pWordClicked = (PTXVWORD)pWordNodeClicked->pItemData; 2674 2848 2675 // store anchor (can be 0) 2676 ptxvd->usLastAnchorClicked = pWordClicked->usAnchor; 2677 2678 if (pWordClicked->usAnchor) 2849 // store link target (can be NULL) 2850 if (ptxvd->pszLastLinkClicked = pWordClicked->pszLinkTarget) 2679 2851 { 2680 // word has a n anchor:2852 // word has a link target: 2681 2853 PLISTNODE pNode = pWordNodeClicked; 2682 2854 … … 2689 2861 { 2690 2862 PTXVWORD pWordThis = (PTXVWORD)pNode->pItemData; 2691 if (pWordThis-> usAnchor == pWordClicked->usAnchor)2863 if (pWordThis->pszLinkTarget == pWordClicked->pszLinkTarget) 2692 2864 { 2693 2865 // still has same anchor: … … 2727 2899 WinSetCapture(HWND_DESKTOP, NULLHANDLE); 2728 2900 2729 if (ptxvd-> usLastAnchorClicked)2901 if (ptxvd->pszLastLinkClicked) 2730 2902 { 2731 2903 RepaintAnchor(ptxvd, … … 2739 2911 QWS_ID), 2740 2912 TXVN_LINK), 2741 (MPARAM)(ULONG)(ptxvd-> usLastAnchorClicked));2913 (MPARAM)(ULONG)(ptxvd->pszLastLinkClicked)); 2742 2914 } 2743 2915 … … 2803 2975 if (usFlags & KC_CTRL) 2804 2976 { 2805 sPos = ptxvd->xfd. ulViewportCY;2977 sPos = ptxvd->xfd.szlWorkspace.cy; 2806 2978 usCmd = SB_SLIDERPOSITION; 2807 2979 } … … 2826 2998 // vertical: 2827 2999 ulMsg = WM_VSCROLL; 2828 sPos = ptxvd->xfd. ulViewportCY;3000 sPos = ptxvd->xfd.szlWorkspace.cy; 2829 3001 } 2830 3002 else 2831 3003 { 2832 3004 ulMsg = WM_HSCROLL; 2833 sPos = ptxvd->xfd. ulViewportCX;3005 sPos = ptxvd->xfd.szlWorkspace.cx; 2834 3006 } 2835 3007 … … 2866 3038 * index specified in mp1. 2867 3039 * 3040 * This must be sent, not posted, to the control. 3041 * 2868 3042 * Parameters: 3043 * 2869 3044 * -- ULONG mp1: index of format to query. 2870 3045 * Must be 0 currently for the standard 2871 3046 * paragraph format. 3047 * 2872 3048 * -- PXFMTPARAGRAPH mp2: pointer to buffer 2873 3049 * which is to receive the formatting … … 2904 3080 * and such). 2905 3081 * 3082 * This must be sent, not posted, to the control. 3083 * 2906 3084 * Parameters: 3085 * 2907 3086 * -- ULONG mp1: index of format to set. 2908 3087 * Must be 0 currently for the standard 2909 3088 * paragraph format. 3089 * 2910 3090 * -- PXFMTPARAGRAPH mp2: pointer to buffer 2911 3091 * from which to copy formatting data. … … 2953 3133 * the word-wrapping style of the default 2954 3134 * paragraph formatting. 3135 * 3136 * This may be sent or posted. 3137 * 2955 3138 * (BOOL)mp1 determines whether word wrapping 2956 3139 * should be turned on or off. … … 2972 3155 *@@ TXM_QUERYCDATA: 2973 3156 * copies the current XTEXTVIEWCDATA 2974 * into the specified buffer. This must 2975 * be sent to the control. 3157 * into the specified buffer. 3158 * 3159 * This must be sent, not posted, to the control. 2976 3160 * 2977 3161 * Parameters: 2978 * -- PXTEXTVIEWCDATA mp1: target buffer. 2979 * Before calling this, you MUST specify 2980 * XTEXTVIEWCDATA.cbData. 3162 * 3163 * -- PXTEXTVIEWCDATA mp1: target buffer. 3164 * Before calling this, you MUST specify 3165 * XTEXTVIEWCDATA.cbData. 3166 * 3167 * Returns: the bytes that were copied as 3168 * a ULONG. 2981 3169 */ 2982 3170 … … 2985 3173 { 2986 3174 PXTEXTVIEWCDATA pTarget = (PXTEXTVIEWCDATA)mp1; 2987 memcpy(pTarget, &ptxvd->cdata, pTarget->cbData); 3175 mrc = (MRESULT)min(pTarget->cbData, sizeof(XTEXTVIEWCDATA)); 3176 memcpy(pTarget, 3177 &ptxvd->cdata, 3178 (ULONG)mrc); 2988 3179 } 2989 3180 break; … … 2993 3184 * updates the current XTEXTVIEWCDATA 2994 3185 * with the data from the specified buffer. 2995 * This must be sent to the control. 3186 * 3187 * This must be sent, not posted, to the control. 2996 3188 * 2997 3189 * Parameters: … … 3016 3208 * of the control. 3017 3209 * 3018 * This must be sent, not posted to the control3210 * This must be sent, not posted, to the control. 3019 3211 * 3020 3212 * Parameters: … … 3046 3238 if (ptxvd->ulViewYOfs < 0) 3047 3239 ptxvd->ulViewYOfs = 0; 3048 if (ptxvd->ulViewYOfs > ((LONG)ptxvd->xfd. ulViewportCY- ulWinCY))3049 ptxvd->ulViewYOfs = (LONG)ptxvd->xfd. ulViewportCY- ulWinCY;3240 if (ptxvd->ulViewYOfs > ((LONG)ptxvd->xfd.szlWorkspace.cy - ulWinCY)) 3241 ptxvd->ulViewYOfs = (LONG)ptxvd->xfd.szlWorkspace.cy - ulWinCY; 3050 3242 3051 3243 // vertical scroll bar enabled at all? 3052 if (ptxvd-> cdata.flStyle & XTXF_VSCROLL)3244 if (ptxvd->flStyle & XS_VSCROLL) 3053 3245 { 3054 3246 /* BOOL fEnabled = */ winhUpdateScrollBar(ptxvd->hwndVScroll, 3055 3247 ulWinCY, 3056 ptxvd->xfd. ulViewportCY,3248 ptxvd->xfd.szlWorkspace.cy, 3057 3249 ptxvd->ulViewYOfs, 3058 (ptxvd-> cdata.flStyle & XTXF_AUTOVHIDE));3250 (ptxvd->flStyle & XS_AUTOVHIDE)); 3059 3251 WinInvalidateRect(hwndTextView, NULL, FALSE); 3060 3252 } 3061 3253 } 3062 3254 } 3255 } 3256 break; 3257 3258 /* 3259 *@@ TXM_QUERYTEXTEXTENT: 3260 * returns the extents of the currently set text, 3261 * that is, the width and height of the internal 3262 * work area, of which the current view rectangle 3263 * displays a subrectangle. 3264 * 3265 * This must be sent, not posted, to the control. 3266 * 3267 * Parameters: 3268 * 3269 * -- PSIZEL mp1: pointer to a SIZEL buffer, 3270 * which receives the extent in the cx and 3271 * cy members. These will be set to null 3272 * values if the control currently has no 3273 * text. 3274 * 3275 * Returns TRUE on success. 3276 * 3277 *@@added V0.9.20 (2002-08-10) [umoeller] 3278 */ 3279 3280 case TXM_QUERYTEXTEXTENT: 3281 if (mp1) 3282 { 3283 memcpy((PSIZEL)mp1, 3284 &ptxvd->xfd.szlWorkspace, 3285 sizeof(SIZEL)); 3286 mrc = (MRESULT)TRUE; 3063 3287 } 3064 3288 break; … … 3093 3317 BOOL txvRegisterTextView(HAB hab) 3094 3318 { 3095 return (WinRegisterClass(hab,3096 3097 3098 3099 sizeof(PVOID))); // QWL_USER3319 return WinRegisterClass(hab, 3320 WC_XTEXTVIEW, 3321 fnwpTextView, 3322 0, 3323 2 * sizeof(PVOID)); // QWL_USER and QWL_PRIVATE 3100 3324 } 3101 3325 … … 3111 3335 USHORT usID, 3112 3336 ULONG flWinStyle, 3113 ULONG flStyle,3114 3337 USHORT usBorder) 3115 3338 { … … 3150 3373 memset(&xtxCData, 0, sizeof(xtxCData)); 3151 3374 xtxCData.cbData = sizeof(xtxCData); 3152 xtxCData.flStyle = flStyle;3153 3375 xtxCData.ulXBorder = usBorder; 3154 3376 xtxCData.ulYBorder = usBorder; … … 3183 3405 &lForeClr); 3184 3406 } 3185 return (hwndTextView);3407 return hwndTextView; 3186 3408 } 3187 3409 … … 3240 3462 } 3241 3463 3242 return (pprq3);3464 return pprq3; 3243 3465 } 3244 3466 … … 3301 3523 palRes); // buffer 3302 3524 3303 return (hdc);3525 return hdc; 3304 3526 } 3305 3527 … … 3334 3556 } 3335 3557 3336 return (pahci);3558 return pahci; 3337 3559 } 3338 3560 … … 3362 3584 sizel.cx = 0; 3363 3585 sizel.cy = 0; 3364 return (GpiCreatePS(hab,3365 3366 3367 ulUnits | GPIA_ASSOC | GPIT_NORMAL));3586 return GpiCreatePS(hab, 3587 hdc, 3588 &sizel, 3589 ulUnits | GPIA_ASSOC | GPIT_NORMAL); 3368 3590 } 3369 3591 … … 3529 3751 prthEndDoc(hdc, hps); 3530 3752 3531 return (TRUE);3753 return TRUE; 3532 3754 } 3533 3755 … … 3549 3771 int irc = 0; 3550 3772 3551 PTEXTVIEWWINDATA ptxvd = (PTEXTVIEWWINDATA)WinQueryWindowPtr(hwndTextView, QWL_ USER);3773 PTEXTVIEWWINDATA ptxvd = (PTEXTVIEWWINDATA)WinQueryWindowPtr(hwndTextView, QWL_PRIVATE); 3552 3774 3553 3775 if (!ptxvd) … … 3646 3868 } 3647 3869 3648 return (irc);3870 return irc; 3649 3871 } 3650 3872 -
trunk/src/helpers/winh.c
r200 r201 545 545 0, 546 546 0); 547 _PmpfF(("lOldDefault is %d", lOldDefault));548 547 } 549 548 else
Note:
See TracChangeset
for help on using the changeset viewer.