Changeset 375
- Timestamp:
- Nov 30, 2008, 1:57:41 AM (17 years ago)
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/branch-1-0/include/helpers/textview.h
r206 r375 8 8 */ 9 9 10 /* Copyright (C) 2000 Ulrich Mller.10 /* Copyright (C) 2000-2008 Ulrich Mller. 11 11 * This file is part of the "XWorkplace helpers" source package. 12 12 * This is free software; you can redistribute it and/or modify … … 351 351 typedef struct _XFORMATDATA 352 352 { 353 XSTRING strOrigText; // original text from WinSetWindowText 354 353 355 // input to txvFormatText 354 XSTRING strViewText; // original view text 355 // from WinSetWindowText 356 XSTRING strViewText; // view text after conversion 356 357 357 358 XFMTPARAGRAPH … … 406 407 */ 407 408 408 409 409 // #define TXM_QUERYCHARFORMAT (WM_USER + 1022) 410 // #define TXM_SETCHARFORMAT (WM_USER + 1023) 410 411 #define TXM_QUERYPARFORMAT (WM_USER + 1022) 411 412 #define TXM_SETPARFORMAT (WM_USER + 1023) … … 415 416 #define TXM_JUMPTOANCHORNAME (WM_USER + 1027) 416 417 #define TXM_QUERYTEXTEXTENT (WM_USER + 1028) 418 #define TXM_QUERYSTYLE (WM_USER + 1029) 419 #define TXM_SETSTYLE (WM_USER + 1030) 420 #define TXM_COPY (WM_USER + 1031) 417 421 418 422 #define WC_XTEXTVIEW "XTextViewClass" -
branches/branch-1-0/src/helpers/textview.c
r374 r375 270 270 lstInit(&pxfd->llWords, 271 271 TRUE); // auto-free items 272 xstrInit(&pxfd->strOrigText, 0); // WarpIN V1.0.18 272 273 xstrInit(&pxfd->strViewText, 0); 273 274 } … … 420 421 *@@added V0.9.3 (2000-05-07) [umoeller] 421 422 *@@changed V0.9.20 (2002-08-10) [umoeller]: now stripping \xFF too 423 *@@changed V1.0.18 (2008-11-24) [pr]: fixes \xFF stripping @@fixes 1116 422 424 */ 423 425 … … 452 454 break; 453 455 454 case '\xFF': // V0.9.20 (2002-08-10) [umoeller]456 case TXVESC_CHAR: // V0.9.20 (2002-08-10) [umoeller] 455 457 AppendCharNoCheck(&pszNew, 456 458 &cbNew, 457 459 &pTarget, 458 460 ' '); 459 pSource ++;461 pSource += 3; // V1.0.18 460 462 break; 461 463 … … 2125 2127 * 2126 2128 *@@added V0.9.20 (2002-08-10) [umoeller] 2129 *@@changed WarpIN V1.0.18 (2008-11-29) [pr] 2127 2130 */ 2128 2131 … … 2136 2139 PSZ p; 2137 2140 2141 // WarpIN V1.0.18 2142 xstrcpy(&ptxvd->xfd.strOrigText, 2143 pcszText, 2144 0); 2145 2138 2146 switch (ptxvd->flStyle & XS_FORMAT_MASK) 2139 2147 { 2140 2148 case XS_PLAINTEXT: // 0x0100 2141 xstrcpy(pstr, 2142 pcszText, 2143 0); 2144 xstrConvertLineFormat(pstr, 2145 CRLF2LF); 2146 p = pstr->psz; 2147 while (p = strchr(p, '\xFF')) 2148 *p = ' '; 2149 break; 2150 2151 case XS_HTML: // 0x0200 2149 // WarpIN V1.0.18 2152 2150 if (p = strdup(pcszText)) 2153 2151 { 2154 PSZ p2 = p; 2155 while (p2 = strchr(p2, '\xFF')) 2156 *p2 = ' '; 2152 PSZ p2; 2153 for (p2 = p; p2 = strchr(p2, TXVESC_CHAR); *p2 = ' '); 2154 txvStripLinefeeds(&p, 4); 2155 xstrset(pstr, p); 2156 } 2157 break; 2158 2159 case XS_HTML: // 0x0200 2160 // WarpIN V1.0.18 2161 if (p = strdup(pcszText)) 2162 { 2163 PSZ p2; 2164 for (p2 = p; p2 = strchr(p2, TXVESC_CHAR); *p2 = ' '); 2157 2165 txvConvertFromHTML(&p, NULL, NULL, NULL); 2158 2166 xstrset(pstr, p); … … 2777 2785 *@@added V1.0.0 (2002-08-12) [umoeller] 2778 2786 *@@changed WarpIN V1.0.18 (2008-11-16) [pr]: added correct ID for horiz. scroll @@fixes 1086 2787 *@@changed WarpIN V1.0.18 (2008-11-16) [pr]: added Ctrl-Ins copy capability @@fixes 1116 2779 2788 */ 2780 2789 … … 2874 2883 2875 2884 usCmd = SB_SLIDERPOSITION; 2885 break; 2886 2887 // WarpIN V1.0.18 2888 case VK_INSERT: 2889 if (usFlags & KC_CTRL) 2890 { 2891 ulMsg = TXM_COPY; 2892 usID = 0; 2893 } 2876 2894 break; 2877 2895 … … 2971 2989 { 2972 2990 xstrClear(&ptxvd->xfd.strViewText); 2991 xstrClear(&ptxvd->xfd.strOrigText); // WarpIN V1.0.18 2973 2992 lstClear(&ptxvd->xfd.llRectangles); 2974 2993 lstClear(&ptxvd->xfd.llWords); … … 3036 3055 *@@changed V0.9.20 (2002-08-10) [umoeller]: added support for formatting HTML and plain text automatically 3037 3056 *@@changed V1.0.0 (2002-08-12) [umoeller]: optimized locality by moving big chunks into subfuncs 3057 *@@changed WarpIN V1.0.18 (2008-11-16) [pr]: added Ctrl-Ins copy capability @@fixes 1116 3058 *@@changed WarpIN V1.0.18 (2008-11-29) [pr]: added style set/query functions @@fixes 1116 3038 3059 */ 3039 3060 … … 3446 3467 sizeof(SIZEL)); 3447 3468 mrc = (MRESULT)TRUE; 3469 } 3470 break; 3471 3472 /* 3473 *@@ TXM_QUERYSTYLE: 3474 * returns the current style flags. 3475 * 3476 * This must be sent, not posted, to the control. 3477 * 3478 * Parameters: 3479 * 3480 * -- PULONG mp1: pointer to a ULONG buffer. 3481 * 3482 * Returns TRUE on success. 3483 * 3484 *@@added WarpIN V1.0.18 (2008-11-29) [pr] 3485 */ 3486 3487 case TXM_QUERYSTYLE: 3488 if ( (mp1) 3489 && (ptxvd = (PTEXTVIEWWINDATA)WinQueryWindowPtr(hwndTextView, QWL_PRIVATE)) 3490 ) 3491 { 3492 *((ULONG *) mp1) = ptxvd->flStyle; 3493 mrc = (MRESULT)TRUE; 3494 } 3495 break; 3496 3497 /* 3498 *@@ TXM_SETSTYLE: 3499 * sets the current style flags. 3500 * 3501 * This must be sent, not posted, to the control. 3502 * 3503 * Parameters: 3504 * 3505 * -- PULONG mp1: pointer to a ULONG buffer. 3506 * 3507 * Returns TRUE on success. 3508 * 3509 *@@added WarpIN V1.0.18 (2008-11-29) [pr] 3510 */ 3511 3512 case TXM_SETSTYLE: 3513 if ( (mp1) 3514 && (ptxvd = (PTEXTVIEWWINDATA)WinQueryWindowPtr(hwndTextView, QWL_PRIVATE)) 3515 ) 3516 { 3517 ptxvd->flStyle = *((ULONG *) mp1); 3518 mrc = (MRESULT)TRUE; 3519 } 3520 break; 3521 3522 /* 3523 *@@ TXM_COPY: 3524 * copies the unprocessed window text to the clipboard. 3525 * 3526 * Returns TRUE on success. 3527 * 3528 *@@added WarpIN V1.0.18 (2008-11-16) [pr] 3529 */ 3530 3531 case TXM_COPY: 3532 if (ptxvd = (PTEXTVIEWWINDATA)WinQueryWindowPtr(hwndTextView, QWL_PRIVATE)) 3533 { 3534 mrc = (MRESULT) winhSetClipboardText(ptxvd->hab, 3535 ptxvd->xfd.strOrigText.psz, 3536 strlen(ptxvd->xfd.strOrigText.psz)); 3448 3537 } 3449 3538 break; -
trunk/include/helpers/textview.h
r257 r375 8 8 */ 9 9 10 /* Copyright (C) 2000 Ulrich Mller.10 /* Copyright (C) 2000-2008 Ulrich Mller. 11 11 * This file is part of the "XWorkplace helpers" source package. 12 12 * This is free software; you can redistribute it and/or modify … … 351 351 typedef struct _XFORMATDATA 352 352 { 353 XSTRING strOrigText; // original text from WinSetWindowText 354 353 355 // input to txvFormatText 354 XSTRING strViewText; // original view text 355 // from WinSetWindowText 356 XSTRING strViewText; // view text after conversion 356 357 357 358 XFMTPARAGRAPH … … 406 407 */ 407 408 408 409 409 // #define TXM_QUERYCHARFORMAT (WM_USER + 1022) 410 // #define TXM_SETCHARFORMAT (WM_USER + 1023) 410 411 #define TXM_QUERYPARFORMAT (WM_USER + 1022) 411 412 #define TXM_SETPARFORMAT (WM_USER + 1023) … … 415 416 #define TXM_JUMPTOANCHORNAME (WM_USER + 1027) 416 417 #define TXM_QUERYTEXTEXTENT (WM_USER + 1028) 418 #define TXM_QUERYSTYLE (WM_USER + 1029) 419 #define TXM_SETSTYLE (WM_USER + 1030) 420 #define TXM_COPY (WM_USER + 1031) 417 421 418 422 #define WC_XTEXTVIEW "XTextViewClass" -
trunk/src/helpers/textview.c
r373 r375 270 270 lstInit(&pxfd->llWords, 271 271 TRUE); // auto-free items 272 xstrInit(&pxfd->strOrigText, 0); // WarpIN V1.0.18 272 273 xstrInit(&pxfd->strViewText, 0); 273 274 } … … 420 421 *@@added V0.9.3 (2000-05-07) [umoeller] 421 422 *@@changed V0.9.20 (2002-08-10) [umoeller]: now stripping \xFF too 423 *@@changed V1.0.18 (2008-11-24) [pr]: fixes \xFF stripping @@fixes 1116 422 424 */ 423 425 … … 452 454 break; 453 455 454 case '\xFF': // V0.9.20 (2002-08-10) [umoeller]456 case TXVESC_CHAR: // V0.9.20 (2002-08-10) [umoeller] 455 457 AppendCharNoCheck(&pszNew, 456 458 &cbNew, 457 459 &pTarget, 458 460 ' '); 459 pSource ++;461 pSource += 3; // V1.0.18 460 462 break; 461 463 … … 2124 2126 * 2125 2127 *@@added V0.9.20 (2002-08-10) [umoeller] 2128 *@@changed WarpIN V1.0.18 (2008-11-29) [pr] 2126 2129 */ 2127 2130 … … 2135 2138 PSZ p; 2136 2139 2140 // WarpIN V1.0.18 2141 xstrcpy(&ptxvd->xfd.strOrigText, 2142 pcszText, 2143 0); 2144 2137 2145 switch (ptxvd->flStyle & XS_FORMAT_MASK) 2138 2146 { 2139 2147 case XS_PLAINTEXT: // 0x0100 2140 xstrcpy(pstr, 2141 pcszText, 2142 0); 2143 xstrConvertLineFormat(pstr, 2144 CRLF2LF); 2145 p = pstr->psz; 2146 while (p = strchr(p, '\xFF')) 2147 *p = ' '; 2148 break; 2149 2150 case XS_HTML: // 0x0200 2148 // WarpIN V1.0.18 2151 2149 if (p = strdup(pcszText)) 2152 2150 { 2153 PSZ p2 = p; 2154 while (p2 = strchr(p2, '\xFF')) 2155 *p2 = ' '; 2151 PSZ p2; 2152 for (p2 = p; p2 = strchr(p2, TXVESC_CHAR); *p2 = ' '); 2153 txvStripLinefeeds(&p, 4); 2154 xstrset(pstr, p); 2155 } 2156 break; 2157 2158 case XS_HTML: // 0x0200 2159 // WarpIN V1.0.18 2160 if (p = strdup(pcszText)) 2161 { 2162 PSZ p2; 2163 for (p2 = p; p2 = strchr(p2, TXVESC_CHAR); *p2 = ' '); 2156 2164 txvConvertFromHTML(&p, NULL, NULL, NULL); 2157 2165 xstrset(pstr, p); … … 2799 2807 *@@added V1.0.0 (2002-08-12) [umoeller] 2800 2808 *@@changed WarpIN V1.0.18 (2008-11-16) [pr]: added correct ID for horiz. scroll @@fixes 1086 2809 *@@changed WarpIN V1.0.18 (2008-11-16) [pr]: added Ctrl-Ins copy capability @@fixes 1116 2801 2810 */ 2802 2811 … … 2896 2905 2897 2906 usCmd = SB_SLIDERPOSITION; 2907 break; 2908 2909 // WarpIN V1.0.18 2910 case VK_INSERT: 2911 if (usFlags & KC_CTRL) 2912 { 2913 ulMsg = TXM_COPY; 2914 usID = 0; 2915 } 2898 2916 break; 2899 2917 … … 2993 3011 { 2994 3012 xstrClear(&ptxvd->xfd.strViewText); 3013 xstrClear(&ptxvd->xfd.strOrigText); // WarpIN V1.0.18 2995 3014 lstClear(&ptxvd->xfd.llRectangles); 2996 3015 lstClear(&ptxvd->xfd.llWords); … … 3059 3078 *@@changed V1.0.0 (2002-08-12) [umoeller]: optimized locality by moving big chunks into subfuncs 3060 3079 *@@changed V1.0.1 (2003-01-25) [umoeller]: adjusted scroll msgs for new handler code 3080 *@@changed WarpIN V1.0.18 (2008-11-16) [pr]: added Ctrl-Ins copy capability @@fixes 1116 3081 *@@changed WarpIN V1.0.18 (2008-11-29) [pr]: added style set/query functions @@fixes 1116 3061 3082 */ 3062 3083 … … 3438 3459 sizeof(SIZEL)); 3439 3460 mrc = (MRESULT)TRUE; 3461 } 3462 break; 3463 3464 /* 3465 *@@ TXM_QUERYSTYLE: 3466 * returns the current style flags. 3467 * 3468 * This must be sent, not posted, to the control. 3469 * 3470 * Parameters: 3471 * 3472 * -- PULONG mp1: pointer to a ULONG buffer. 3473 * 3474 * Returns TRUE on success. 3475 * 3476 *@@added WarpIN V1.0.18 (2008-11-29) [pr] 3477 */ 3478 3479 case TXM_QUERYSTYLE: 3480 if ( (mp1) 3481 && (ptxvd = (PTEXTVIEWWINDATA)WinQueryWindowPtr(hwndTextView, QWL_PRIVATE)) 3482 ) 3483 { 3484 *((ULONG *) mp1) = ptxvd->flStyle; 3485 mrc = (MRESULT)TRUE; 3486 } 3487 break; 3488 3489 /* 3490 *@@ TXM_SETSTYLE: 3491 * sets the current style flags. 3492 * 3493 * This must be sent, not posted, to the control. 3494 * 3495 * Parameters: 3496 * 3497 * -- PULONG mp1: pointer to a ULONG buffer. 3498 * 3499 * Returns TRUE on success. 3500 * 3501 *@@added WarpIN V1.0.18 (2008-11-29) [pr] 3502 */ 3503 3504 case TXM_SETSTYLE: 3505 if ( (mp1) 3506 && (ptxvd = (PTEXTVIEWWINDATA)WinQueryWindowPtr(hwndTextView, QWL_PRIVATE)) 3507 ) 3508 { 3509 ptxvd->flStyle = *((ULONG *) mp1); 3510 mrc = (MRESULT)TRUE; 3511 } 3512 break; 3513 3514 /* 3515 *@@ TXM_COPY: 3516 * copies the unprocessed window text to the clipboard. 3517 * 3518 * Returns TRUE on success. 3519 * 3520 *@@added WarpIN V1.0.18 (2008-11-16) [pr] 3521 */ 3522 3523 case TXM_COPY: 3524 if (ptxvd = (PTEXTVIEWWINDATA)WinQueryWindowPtr(hwndTextView, QWL_PRIVATE)) 3525 { 3526 mrc = (MRESULT) winhSetClipboardText(ptxvd->hab, 3527 ptxvd->xfd.strOrigText.psz, 3528 strlen(ptxvd->xfd.strOrigText.psz)); 3440 3529 } 3441 3530 break;
Note:
See TracChangeset
for help on using the changeset viewer.