| 1 |  | 
|---|
| 2 | /* | 
|---|
| 3 | *@@sourcefile textview.h: | 
|---|
| 4 | *      header file for textview.c. See remarks there. | 
|---|
| 5 | * | 
|---|
| 6 | *      Note: Version numbering in this file relates to XWorkplace version | 
|---|
| 7 | *            numbering. | 
|---|
| 8 | */ | 
|---|
| 9 |  | 
|---|
| 10 | /*      Copyright (C) 2000 Ulrich Mller. | 
|---|
| 11 | *      This file is part of the "XWorkplace helpers" source package. | 
|---|
| 12 | *      This is free software; you can redistribute it and/or modify | 
|---|
| 13 | *      it under the terms of the GNU General Public License as published | 
|---|
| 14 | *      by the Free Software Foundation, in version 2 as it comes in the | 
|---|
| 15 | *      "COPYING" file of the XWorkplace main distribution. | 
|---|
| 16 | *      This program is distributed in the hope that it will be useful, | 
|---|
| 17 | *      but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 18 | *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 19 | *      GNU General Public License for more details. | 
|---|
| 20 | * | 
|---|
| 21 | *@@include #define INCL_SPL        // for printing functions | 
|---|
| 22 | *@@include #include <os2.h> | 
|---|
| 23 | *@@include #include "linklist.h"   // for device-independent functions | 
|---|
| 24 | *@@include #include "xstring.h"    // for device-independent functions | 
|---|
| 25 | *@@include #include "textview.h" | 
|---|
| 26 | */ | 
|---|
| 27 |  | 
|---|
| 28 | #if __cplusplus | 
|---|
| 29 | extern "C" { | 
|---|
| 30 | #endif | 
|---|
| 31 |  | 
|---|
| 32 | #ifndef TEXTVIEW_HEADER_INCLUDED | 
|---|
| 33 | #define TEXTVIEW_HEADER_INCLUDED | 
|---|
| 34 |  | 
|---|
| 35 | /* ****************************************************************** | 
|---|
| 36 | * | 
|---|
| 37 | *   Escape sequences | 
|---|
| 38 | * | 
|---|
| 39 | ********************************************************************/ | 
|---|
| 40 |  | 
|---|
| 41 | /* | 
|---|
| 42 | *@@ TXVESC_CHAR: | 
|---|
| 43 | *      general escape character which introduces | 
|---|
| 44 | *      all escape sequences. | 
|---|
| 45 | */ | 
|---|
| 46 |  | 
|---|
| 47 | #define TXVESC_CHAR             '\xFF' | 
|---|
| 48 | #define TXVESC_STRING           "\xFF" | 
|---|
| 49 |  | 
|---|
| 50 | // fixed formatting tags: PRE, B, I U, STRIKE | 
|---|
| 51 | // (no parameters) | 
|---|
| 52 | /* #define TXVESC_PRE_BEGIN        TXVESC_STRING "\x01\x01" | 
|---|
| 53 | #define TXVESC_PRE_END          TXVESC_STRING "\x01\x02" */ | 
|---|
| 54 |  | 
|---|
| 55 | #define TXVESC_SET_FONT         TXVESC_STRING "\x01" | 
|---|
| 56 | // here follow three characters with the | 
|---|
| 57 | // font index: | 
|---|
| 58 | // e.g. "000" == default font | 
|---|
| 59 | //      "001" == monospaced font | 
|---|
| 60 | // Fonts 0 and 1 always exist in the XTextView control. | 
|---|
| 61 | // Other fonts are presently not supported. | 
|---|
| 62 | // --> total size: 5 | 
|---|
| 63 |  | 
|---|
| 64 | #define TXVESC_BOLD_BEGIN       TXVESC_STRING "\x02\x01" | 
|---|
| 65 | #define TXVESC_BOLD_END         TXVESC_STRING "\x02\x02" | 
|---|
| 66 |  | 
|---|
| 67 | #define TXVESC_ITALICS_BEGIN    TXVESC_STRING "\x03\x01" | 
|---|
| 68 | #define TXVESC_ITALICS_END      TXVESC_STRING "\x03\x02" | 
|---|
| 69 |  | 
|---|
| 70 | #define TXVESC_UNDERLINE_BEGIN  TXVESC_STRING "\x04\x01" | 
|---|
| 71 | #define TXVESC_UNDERLINE_END    TXVESC_STRING "\x04\x02" | 
|---|
| 72 |  | 
|---|
| 73 | #define TXVESC_STRIKE_BEGIN     TXVESC_STRING "\x05\x01" | 
|---|
| 74 | #define TXVESC_STRIKE_END       TXVESC_STRING "\x05\x02" | 
|---|
| 75 |  | 
|---|
| 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" | 
|---|
| 84 | // here follows the anchor name, which is | 
|---|
| 85 | // variable in length and must be terminated | 
|---|
| 86 | // with another 0xFF escape code (NOT null byte); | 
|---|
| 87 | // --> total size: 2 plus anchor name length | 
|---|
| 88 | //      plus 1 for 0xFF terminator | 
|---|
| 89 |  | 
|---|
| 90 | // character formatting with parameters: | 
|---|
| 91 | #define TXVESC_POINTSIZE_REL    TXVESC_STRING "\x10" | 
|---|
| 92 | // here follow three characters with a percentage | 
|---|
| 93 | // of the default point size | 
|---|
| 94 | // e.g. "050" == half the size | 
|---|
| 95 | //      "200" == double the size | 
|---|
| 96 | // --> total size: 5 | 
|---|
| 97 |  | 
|---|
| 98 | /* | 
|---|
| 99 | * paragraph formatting | 
|---|
| 100 | *      -- left and right margins: | 
|---|
| 101 | */ | 
|---|
| 102 |  | 
|---|
| 103 | #define TXVESC_LEFTMARGIN               TXVESC_STRING "\x20" | 
|---|
| 104 | // here follow four characters to specify the | 
|---|
| 105 | // new first line left margin (XFMTPARAGRAPH.lLeftMargin), | 
|---|
| 106 | // which is based on the average char width of | 
|---|
| 107 | // the current font: | 
|---|
| 108 | // e.g. "0020" == set margin to 20 average char widths | 
|---|
| 109 | // --> total size: 6 | 
|---|
| 110 |  | 
|---|
| 111 | #define TXVESC_FIRSTLINEMARGIN_LEFT     TXVESC_STRING "\x21-" | 
|---|
| 112 | #define TXVESC_FIRSTLINEMARGIN_RIGHT    TXVESC_STRING "\x21+" | 
|---|
| 113 | // here follow three characters to specify the | 
|---|
| 114 | // new absolute left margin (XFMTPARAGRAPH.lFirstLineMargin) | 
|---|
| 115 | // which is based on the average char width of | 
|---|
| 116 | // the current font: | 
|---|
| 117 | // e.g. "+020" == set first line margin to 20 average char widths | 
|---|
| 118 | // e.g. "-020" == set first line margin to 20 average char widths | 
|---|
| 119 | // --> total size: 6 | 
|---|
| 120 |  | 
|---|
| 121 | #define TXVESC_TAB                      TXVESC_STRING "\x22" | 
|---|
| 122 | // the tab can be used to move from the first line margin | 
|---|
| 123 | // to the left margin, if the first line margin is negative; | 
|---|
| 124 | // used with list items (UL LI and such) | 
|---|
| 125 | // --> total size: 2 | 
|---|
| 126 |  | 
|---|
| 127 | #define TXVESC_MARKER                   TXVESC_STRING "\x23" | 
|---|
| 128 | // draw marker at the current position: the next byte | 
|---|
| 129 | // determines the type of marker: | 
|---|
| 130 | // -- 1: disc (filled circle) | 
|---|
| 131 | // -- 2: square (filled box) | 
|---|
| 132 | // -- 3: circle (hollow circle) | 
|---|
| 133 | // --> total size: 3 | 
|---|
| 134 |  | 
|---|
| 135 | /* | 
|---|
| 136 | * paragraph formatting | 
|---|
| 137 | *      -- paragraph spacing: | 
|---|
| 138 | */ | 
|---|
| 139 |  | 
|---|
| 140 | #define TXVESC_SPACEBEFORE              TXVESC_STRING "\x30" | 
|---|
| 141 | #define TXVESC_SPACEAFTER               TXVESC_STRING "\x31" | 
|---|
| 142 | // here follow four characters to specify the | 
|---|
| 143 | // new spacing before or after a paragraph: | 
|---|
| 144 | // e.g. "0020" == twenty | 
|---|
| 145 | // !! special case: "####" means reset to default | 
|---|
| 146 | // --> total size: 6 | 
|---|
| 147 |  | 
|---|
| 148 | #define TXVESC_WORDWRAP                 TXVESC_STRING "\x32" | 
|---|
| 149 | // here follows a single character being "0" or "1" | 
|---|
| 150 | // --> total size: 3 | 
|---|
| 151 |  | 
|---|
| 152 | /* ****************************************************************** | 
|---|
| 153 | * | 
|---|
| 154 | *   Device-independent functions | 
|---|
| 155 | * | 
|---|
| 156 | ********************************************************************/ | 
|---|
| 157 |  | 
|---|
| 158 | #define TXVWORDF_GLUEWITHNEXT       1       // escape | 
|---|
| 159 | #define TXVWORDF_LINEBREAK          2       // \n | 
|---|
| 160 | #define TXVWORDF_LINEFEED           4       // \r | 
|---|
| 161 |  | 
|---|
| 162 | typedef struct _TXVRECTANGLE *PTXVRECTANGLE; | 
|---|
| 163 |  | 
|---|
| 164 | /* | 
|---|
| 165 | *@@ TXVWORD: | 
|---|
| 166 | *      this defines a "word" to be drawn. A word is | 
|---|
| 167 | *      normally a sequence of characters between | 
|---|
| 168 | *      space, \n, or \r characters, unless escape | 
|---|
| 169 | *      sequences come up. See txvFormatText. | 
|---|
| 170 | * | 
|---|
| 171 | *@@added V0.9.3 (2000-05-14) [umoeller] | 
|---|
| 172 | */ | 
|---|
| 173 |  | 
|---|
| 174 | typedef struct _TXVWORD | 
|---|
| 175 | { | 
|---|
| 176 | const char  *pStart;        // ptr into TEXTVIEWWINDATA.pszViewText | 
|---|
| 177 | ULONG       cChars;         // characters in line to draw, starting | 
|---|
| 178 | // at pStartOfLine; | 
|---|
| 179 | // this might be less than the next \n | 
|---|
| 180 | // char if word-wrapping has been enabled | 
|---|
| 181 | // or an escape character was found | 
|---|
| 182 |  | 
|---|
| 183 | CHAR        cEscapeCode; | 
|---|
| 184 | // if 0, this word represents a substring to be painted | 
|---|
| 185 | // ("normal word"). | 
|---|
| 186 | // If != 0; this "word" holds an escape sequence in *pStart | 
|---|
| 187 | // which must be considered for paragraph formatting, but | 
|---|
| 188 | // NOT be painted, except if fPaintEscapeWord is TRUE also. | 
|---|
| 189 | // cEscapeCode then holds a copy of the escape character | 
|---|
| 190 | // (which is pStart + 1). | 
|---|
| 191 | BOOL        fPaintEscapeWord; | 
|---|
| 192 | // if this is TRUE, this escape is some special graphics | 
|---|
| 193 | // to be painted also (e.g. list markers). txvPaint then | 
|---|
| 194 | // evaluates the escape code (in pStart) to see what needs | 
|---|
| 195 | // to be done. | 
|---|
| 196 |  | 
|---|
| 197 | // all the following are only set if (fIsEscapeSequence == FALSE): | 
|---|
| 198 |  | 
|---|
| 199 | ULONG       ulFlags; | 
|---|
| 200 | // one of the following: | 
|---|
| 201 | // -- TXVWORDF_GLUEWITHNEXT: this "word" was cut because | 
|---|
| 202 | //          an escape sequence was found; this word must | 
|---|
| 203 | //          therefore be in the same line with the next word | 
|---|
| 204 | // -- TXVWORDF_LINEBREAK: this word ends with a \n char; | 
|---|
| 205 | //          start new paragraph after this | 
|---|
| 206 | // -- TXVWORDF_LINEFEED: this words ends with a \r char; | 
|---|
| 207 | //          start new line after this | 
|---|
| 208 |  | 
|---|
| 209 | ULONG       ulCXWithSpaces, // width of word (in pels), including trailing spaces | 
|---|
| 210 | ulCXWord,       // width of word (in pels), without trailing spaces | 
|---|
| 211 | ulCY;           // height of word (in pels) | 
|---|
| 212 |  | 
|---|
| 213 | LONG        lX;             // X position to paint this word at; | 
|---|
| 214 | // this is (re)set during word-to-rectangle correlation! | 
|---|
| 215 | PTXVRECTANGLE pRectangle;   // reverse pointer to the TXVRECTANGLE structure to | 
|---|
| 216 | // which this word belongs; useful for repainting; | 
|---|
| 217 | // this is (re)set during word-to-rectangle correlation! | 
|---|
| 218 | ULONG       ulBaseLineOfs;  // base line offset; add this to rcl.yBottom | 
|---|
| 219 | // to get the the start point to be used for | 
|---|
| 220 | // GpiCharStringPosAt | 
|---|
| 221 |  | 
|---|
| 222 | LONG        lcid;           // logical font ID to use for this rectangle | 
|---|
| 223 | LONG        lPointSize;     // point size to use for this rectangle; | 
|---|
| 224 | // this is set to 0 for bitmap fonts | 
|---|
| 225 | ULONG       flOptions;      // flOptions parameter for GpiCharStringPosAt; | 
|---|
| 226 | // this will only have the CHS_UNDERSCORE or | 
|---|
| 227 | // CHS_STRIKEOUT flags set | 
|---|
| 228 |  | 
|---|
| 229 | USHORT      usAnchor;       // != 0 if this word belongs to an anchor | 
|---|
| 230 | } TXVWORD, *PTXVWORD; | 
|---|
| 231 |  | 
|---|
| 232 | #ifdef LINKLIST_HEADER_INCLUDED | 
|---|
| 233 | /* | 
|---|
| 234 | *@@ TXVRECTANGLE: | 
|---|
| 235 | *      this defines one line to be drawn. | 
|---|
| 236 | *      This is device-independent. | 
|---|
| 237 | *      See txvFormatText. | 
|---|
| 238 | */ | 
|---|
| 239 |  | 
|---|
| 240 | typedef struct _TXVRECTANGLE | 
|---|
| 241 | { | 
|---|
| 242 | RECTL       rcl;            // rectangle of this line, into which | 
|---|
| 243 | // the words in llWords should be painted; | 
|---|
| 244 | // the bottom of this rectangle specifies the | 
|---|
| 245 | // bottommost point used (neccessary for | 
|---|
| 246 | // characters with underlengths, such as | 
|---|
| 247 | // "g" or "y"); ulMaxBaseLineOfs must be | 
|---|
| 248 | // added to the starting point | 
|---|
| 249 | // when using GpiCharStringPosAt | 
|---|
| 250 | ULONG       ulMaxBaseLineOfs; // highest ulBaseLineOfs of all words | 
|---|
| 251 | // belonging to this rectangle. | 
|---|
| 252 | LINKLIST    llWords;        // list of TXVWORD's which belong to this | 
|---|
| 253 | // rectangle. Note that these are duplicate | 
|---|
| 254 | // pointers to be able to correlate rectangles | 
|---|
| 255 | // to words; there is a second list of TXVWORD's | 
|---|
| 256 | // in XFORMATDATA which holds really all the | 
|---|
| 257 | // words which were created (for cleanup). | 
|---|
| 258 | // So one allocated TXVWORD structure can | 
|---|
| 259 | // have two pointers pointing to it. | 
|---|
| 260 | } TXVRECTANGLE; | 
|---|
| 261 | #endif | 
|---|
| 262 |  | 
|---|
| 263 | /* | 
|---|
| 264 | *@@ XFMTFONT: | 
|---|
| 265 | *      specifies a font to be used in | 
|---|
| 266 | *      XFMTCHARACTER. | 
|---|
| 267 | * | 
|---|
| 268 | *@@added V0.9.3 (2000-05-06) [umoeller] | 
|---|
| 269 | */ | 
|---|
| 270 |  | 
|---|
| 271 | typedef struct _XFMTFONT | 
|---|
| 272 | { | 
|---|
| 273 | LONG        lcid; | 
|---|
| 274 | // default font to use for this paragraph | 
|---|
| 275 | FONTMETRICS FontMetrics; | 
|---|
| 276 | LONG        alCX[256]; // width of each ASCII character for this | 
|---|
| 277 | // string; computed by txvSetFormatFont | 
|---|
| 278 | } XFMTFONT, *PXFMTFONT; | 
|---|
| 279 |  | 
|---|
| 280 | /* | 
|---|
| 281 | *@@ XFMTCHARACTER: | 
|---|
| 282 | *      character formatting parameters. | 
|---|
| 283 | *      This is used by the formatting engine | 
|---|
| 284 | *      (txvFormat) | 
|---|
| 285 | *      to describe character formatting. | 
|---|
| 286 | *      Character formatting can only be | 
|---|
| 287 | *      changed between words (TXVWORD). | 
|---|
| 288 | * | 
|---|
| 289 | *@@added V0.9.3 (2000-05-06) [umoeller] | 
|---|
| 290 | */ | 
|---|
| 291 |  | 
|---|
| 292 | typedef struct _XFMTCHARACTER | 
|---|
| 293 | { | 
|---|
| 294 | LONG        lPointSize; | 
|---|
| 295 | // default font size to use for this paragraph | 
|---|
| 296 | XFMTFONT    fntRegular, | 
|---|
| 297 | fntBold, | 
|---|
| 298 | fntItalics, | 
|---|
| 299 | fntBoldItalics; | 
|---|
| 300 | } XFMTCHARACTER, *PXFMTCHARACTER; | 
|---|
| 301 |  | 
|---|
| 302 | /* | 
|---|
| 303 | *@@ XFMTPARAGRAPH: | 
|---|
| 304 | *      paragraph formatting parameters. | 
|---|
| 305 | *      This is used by the formatting engine | 
|---|
| 306 | *      (txvFormat) | 
|---|
| 307 | *      for every paragraph which is started. | 
|---|
| 308 | * | 
|---|
| 309 | *@@added V0.9.3 (2000-05-06) [umoeller] | 
|---|
| 310 | */ | 
|---|
| 311 |  | 
|---|
| 312 | typedef struct _XFMTPARAGRAPH | 
|---|
| 313 | { | 
|---|
| 314 | BOOL        fWordWrap; | 
|---|
| 315 | LONG        lLeftMargin, | 
|---|
| 316 | // left indentation for all lines | 
|---|
| 317 | // (in pixels) | 
|---|
| 318 | lRightMargin, | 
|---|
| 319 | // right indentation for all lines | 
|---|
| 320 | // (in pixels) | 
|---|
| 321 | lFirstLineMargin; | 
|---|
| 322 | // additional indentation for first line only; | 
|---|
| 323 | // this is added to lLeftMargin (can be negative) | 
|---|
| 324 | // (in pixels) | 
|---|
| 325 | LONG        lSpaceBefore, | 
|---|
| 326 | // space before each paragraph | 
|---|
| 327 | // (in pixels) | 
|---|
| 328 | lSpaceAfter; | 
|---|
| 329 | // space after each paragraph | 
|---|
| 330 | // (in pixels) | 
|---|
| 331 | } XFMTPARAGRAPH, *PXFMTPARAGRAPH; | 
|---|
| 332 |  | 
|---|
| 333 | #ifdef LINKLIST_HEADER_INCLUDED | 
|---|
| 334 | #ifdef XSTRING_HEADER_INCLUDED | 
|---|
| 335 |  | 
|---|
| 336 | /* | 
|---|
| 337 | *@@ XFORMATDATA: | 
|---|
| 338 | *      text formatting data. Passed to | 
|---|
| 339 | *      txvPaintText, stored in TEXTVIEWWINDATA. | 
|---|
| 340 | *      This is device-independent. | 
|---|
| 341 | */ | 
|---|
| 342 |  | 
|---|
| 343 | typedef struct _XFORMATDATA | 
|---|
| 344 | { | 
|---|
| 345 | // input to txvFormatText | 
|---|
| 346 | XSTRING     strViewText;    // original view text | 
|---|
| 347 | // from WinSetWindowText | 
|---|
| 348 |  | 
|---|
| 349 | XFMTPARAGRAPH | 
|---|
| 350 | fmtpStandard;   // standard paragraph format | 
|---|
| 351 |  | 
|---|
| 352 | XFMTCHARACTER | 
|---|
| 353 | fmtcStandard,   // format for standard text | 
|---|
| 354 | fmtcCode;       // format for code text (monospaced; PRE, CODE etc.) | 
|---|
| 355 |  | 
|---|
| 356 | // output from txvFormatText | 
|---|
| 357 | LINKLIST    llRectangles; | 
|---|
| 358 | // list of TXVRECTANGLE, from top to bottom; | 
|---|
| 359 | // text pointers point into pszViewText | 
|---|
| 360 | LINKLIST    llWords; | 
|---|
| 361 | // list of TXVWORD's, in order of creation; | 
|---|
| 362 | // this is just for proper cleanup. The items | 
|---|
| 363 | // in the TXVRECTANGLE.llWords list also point | 
|---|
| 364 | // to the words stored in this list. | 
|---|
| 365 |  | 
|---|
| 366 | ULONG       ulViewportCX,   // width of viewport (total text space) | 
|---|
| 367 | ulViewportCY;   // height of viewport (total text space) | 
|---|
| 368 |  | 
|---|
| 369 | } XFORMATDATA, *PXFORMATDATA; | 
|---|
| 370 |  | 
|---|
| 371 | VOID txvInitFormat(PXFORMATDATA pxfd); | 
|---|
| 372 |  | 
|---|
| 373 | VOID txvFormatText(HPS hps, | 
|---|
| 374 | PXFORMATDATA pxfd, | 
|---|
| 375 | PRECTL prclView, | 
|---|
| 376 | BOOL fFullRecalc); | 
|---|
| 377 | #endif | 
|---|
| 378 | #endif | 
|---|
| 379 |  | 
|---|
| 380 | VOID txvStripLinefeeds(char **ppszText, | 
|---|
| 381 | ULONG ulTabSize); | 
|---|
| 382 |  | 
|---|
| 383 | /* ****************************************************************** | 
|---|
| 384 | * | 
|---|
| 385 | *   Window-dependent functions | 
|---|
| 386 | * | 
|---|
| 387 | ********************************************************************/ | 
|---|
| 388 |  | 
|---|
| 389 | /* | 
|---|
| 390 | * XTextView messages: | 
|---|
| 391 | * | 
|---|
| 392 | */ | 
|---|
| 393 |  | 
|---|
| 394 | #define TXM_QUERYCHARFORMAT             (WM_USER + 1022) | 
|---|
| 395 | #define TXM_SETCHARFORMAT               (WM_USER + 1023) | 
|---|
| 396 | #define TXM_QUERYPARFORMAT              (WM_USER + 1022) | 
|---|
| 397 | #define TXM_SETPARFORMAT                (WM_USER + 1023) | 
|---|
| 398 | #define TXM_SETWORDWRAP                 (WM_USER + 1024) | 
|---|
| 399 | #define TXM_QUERYCDATA                  (WM_USER + 1025) | 
|---|
| 400 | #define TXM_SETCDATA                    (WM_USER + 1026) | 
|---|
| 401 | #define TXM_JUMPTOANCHORNAME            (WM_USER + 1027) | 
|---|
| 402 |  | 
|---|
| 403 | #define WC_XTEXTVIEW     "XTextViewClass" | 
|---|
| 404 |  | 
|---|
| 405 | /* | 
|---|
| 406 | * XTextView nofication codes: | 
|---|
| 407 | * | 
|---|
| 408 | */ | 
|---|
| 409 |  | 
|---|
| 410 | /* | 
|---|
| 411 | *@@ TXVN_LINK: | 
|---|
| 412 | *      WM_CONTROL notification code posted (!) | 
|---|
| 413 | *      to the XTextView control's owner. | 
|---|
| 414 | * | 
|---|
| 415 | *      Parameters: | 
|---|
| 416 | * | 
|---|
| 417 | *      -- USHORT SHORT1FROMMP(mp1): id of the control. | 
|---|
| 418 | *      -- USHORT SHORT2FROMMP(mp1): nofify code (TXVN_LINK). | 
|---|
| 419 | *      -- USHORT mp2: index of anchor (1 >= index > 0xFFFF). | 
|---|
| 420 | * | 
|---|
| 421 | *@@added V0.9.3 (2000-05-18) [umoeller] | 
|---|
| 422 | */ | 
|---|
| 423 |  | 
|---|
| 424 | #define TXVN_LINK                       1 | 
|---|
| 425 |  | 
|---|
| 426 | /* | 
|---|
| 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 | 
|---|
| 435 |  | 
|---|
| 436 | /* | 
|---|
| 437 | *@@ XTEXTVIEWCDATA: | 
|---|
| 438 | *      control data structure for text view | 
|---|
| 439 | *      control. This can be passed to | 
|---|
| 440 | *      WinCreateWindow with the pCtlData | 
|---|
| 441 | *      parameter. You then MUST set the | 
|---|
| 442 | *      "cbData" field to sizeof(XTEXTVIEWCDATA). | 
|---|
| 443 | */ | 
|---|
| 444 |  | 
|---|
| 445 | typedef struct _XTEXTVIEWCDATA | 
|---|
| 446 | { | 
|---|
| 447 | 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 | ULONG       ulXBorder, | 
|---|
| 455 | // space to leave on the left and right of text view; | 
|---|
| 456 | // defaults to 0 | 
|---|
| 457 | ulYBorder; | 
|---|
| 458 | // space to leave on the top and bottom of text view; | 
|---|
| 459 | // defaults to 0 | 
|---|
| 460 | ULONG       ulVScrollLineUnit, | 
|---|
| 461 | // pixels to scroll if scroll bar "up" or "down" button | 
|---|
| 462 | // is pressed; defaults to 15 | 
|---|
| 463 | ulHScrollLineUnit; | 
|---|
| 464 | // pixels to scroll if scroll bar "left" or "right" button | 
|---|
| 465 | // is pressed; defaults to 15 | 
|---|
| 466 | } XTEXTVIEWCDATA, *PXTEXTVIEWCDATA; | 
|---|
| 467 |  | 
|---|
| 468 |  | 
|---|
| 469 | BOOL txvRegisterTextView(HAB hab); | 
|---|
| 470 |  | 
|---|
| 471 | HWND txvReplaceWithTextView(HWND hwndParentAndOwner, | 
|---|
| 472 | USHORT usID, | 
|---|
| 473 | ULONG flWinStyle, | 
|---|
| 474 | ULONG flStyle, | 
|---|
| 475 | USHORT usBorder); | 
|---|
| 476 |  | 
|---|
| 477 | /* ****************************************************************** | 
|---|
| 478 | * | 
|---|
| 479 | *   Printer-dependent functions | 
|---|
| 480 | * | 
|---|
| 481 | ********************************************************************/ | 
|---|
| 482 |  | 
|---|
| 483 | typedef BOOL APIENTRY FNPRINTCALLBACK(ULONG ulPage, | 
|---|
| 484 | ULONG ulUser); | 
|---|
| 485 |  | 
|---|
| 486 | #ifdef INCL_SPL | 
|---|
| 487 | BOOL txvPrint(HAB hab, | 
|---|
| 488 | HDC hdc, | 
|---|
| 489 | HPS hps, | 
|---|
| 490 | PSZ pszViewText, | 
|---|
| 491 | ULONG ulSize, | 
|---|
| 492 | PSZ pszFaceName, | 
|---|
| 493 | HCINFO  *phci, | 
|---|
| 494 | PSZ pszDocTitle, | 
|---|
| 495 | FNPRINTCALLBACK *pfnCallback); | 
|---|
| 496 | #endif | 
|---|
| 497 |  | 
|---|
| 498 | int txvPrintWindow(HWND hwndTextView, | 
|---|
| 499 | PSZ pszDocTitle, | 
|---|
| 500 | FNPRINTCALLBACK *pfnCallback); | 
|---|
| 501 |  | 
|---|
| 502 | #endif | 
|---|
| 503 |  | 
|---|
| 504 | #if __cplusplus | 
|---|
| 505 | } | 
|---|
| 506 | #endif | 
|---|
| 507 |  | 
|---|