Ignore:
Timestamp:
Nov 30, 2008, 1:57:41 AM (17 years ago)
Author:
pr
Message:

Allow copy to clipboard from textview control. Bug 1116.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/textview.c

    r373 r375  
    270270    lstInit(&pxfd->llWords,
    271271            TRUE);      // auto-free items
     272    xstrInit(&pxfd->strOrigText, 0);  // WarpIN V1.0.18
    272273    xstrInit(&pxfd->strViewText, 0);
    273274}
     
    420421 *@@added V0.9.3 (2000-05-07) [umoeller]
    421422 *@@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
    422424 */
    423425
     
    452454            break;
    453455
    454             case '\xFF':        // V0.9.20 (2002-08-10) [umoeller]
     456            case TXVESC_CHAR:        // V0.9.20 (2002-08-10) [umoeller]
    455457                AppendCharNoCheck(&pszNew,
    456458                                  &cbNew,
    457459                                  &pTarget,
    458460                                  ' ');
    459                 pSource++;
     461                pSource += 3;  // V1.0.18
    460462            break;
    461463
     
    21242126 *
    21252127 *@@added V0.9.20 (2002-08-10) [umoeller]
     2128 *@@changed WarpIN V1.0.18 (2008-11-29) [pr]
    21262129 */
    21272130
     
    21352138        PSZ p;
    21362139
     2140        // WarpIN V1.0.18
     2141        xstrcpy(&ptxvd->xfd.strOrigText,
     2142                pcszText,
     2143                0);
     2144
    21372145        switch (ptxvd->flStyle & XS_FORMAT_MASK)
    21382146        {
    21392147            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
    21512149                if (p = strdup(pcszText))
    21522150                {
    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 = ' ');
    21562164                    txvConvertFromHTML(&p, NULL, NULL, NULL);
    21572165                    xstrset(pstr, p);
     
    27992807 *@@added V1.0.0 (2002-08-12) [umoeller]
    28002808 *@@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
    28012810 */
    28022811
     
    28962905
    28972906                    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                    }
    28982916                break;
    28992917
     
    29933011    {
    29943012        xstrClear(&ptxvd->xfd.strViewText);
     3013        xstrClear(&ptxvd->xfd.strOrigText);  // WarpIN V1.0.18
    29953014        lstClear(&ptxvd->xfd.llRectangles);
    29963015        lstClear(&ptxvd->xfd.llWords);
     
    30593078 *@@changed V1.0.0 (2002-08-12) [umoeller]: optimized locality by moving big chunks into subfuncs
    30603079 *@@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
    30613082 */
    30623083
     
    34383459                       sizeof(SIZEL));
    34393460                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));
    34403529            }
    34413530        break;
Note: See TracChangeset for help on using the changeset viewer.