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
  • branches/branch-1-0/src/helpers/textview.c

    r374 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
     
    21252127 *
    21262128 *@@added V0.9.20 (2002-08-10) [umoeller]
     2129 *@@changed WarpIN V1.0.18 (2008-11-29) [pr]
    21272130 */
    21282131
     
    21362139        PSZ p;
    21372140
     2141        // WarpIN V1.0.18
     2142        xstrcpy(&ptxvd->xfd.strOrigText,
     2143                pcszText,
     2144                0);
     2145
    21382146        switch (ptxvd->flStyle & XS_FORMAT_MASK)
    21392147        {
    21402148            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
    21522150                if (p = strdup(pcszText))
    21532151                {
    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 = ' ');
    21572165                    txvConvertFromHTML(&p, NULL, NULL, NULL);
    21582166                    xstrset(pstr, p);
     
    27772785 *@@added V1.0.0 (2002-08-12) [umoeller]
    27782786 *@@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
    27792788 */
    27802789
     
    28742883
    28752884                    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                    }
    28762894                break;
    28772895
     
    29712989    {
    29722990        xstrClear(&ptxvd->xfd.strViewText);
     2991        xstrClear(&ptxvd->xfd.strOrigText);  // WarpIN V1.0.18
    29732992        lstClear(&ptxvd->xfd.llRectangles);
    29742993        lstClear(&ptxvd->xfd.llWords);
     
    30363055 *@@changed V0.9.20 (2002-08-10) [umoeller]: added support for formatting HTML and plain text automatically
    30373056 *@@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
    30383059 */
    30393060
     
    34463467                       sizeof(SIZEL));
    34473468                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));
    34483537            }
    34493538        break;
Note: See TracChangeset for help on using the changeset viewer.