svnno****@sourc*****
svnno****@sourc*****
2009年 6月 26日 (金) 20:20:56 JST
Revision: 3535 http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=3535 Author: yutakapon Date: 2009-06-26 20:20:55 +0900 (Fri, 26 Jun 2009) Log Message: ----------- ConfirmChangePaste æã«ããããããæå®ããããã¹ããã¡ã¤ã«ã§å®ç¾©ãããæåå群ãã ã¯ãªãããã¼ãã«å«ã¾ãã¦ãããã©ãããå¤æããããã«ããã ããã¼ã¯ä»¥ä¸ã®ã¨ããã 1. ConfirmChangePaste ãæå¹åã©ãã 2. ã¯ãªãããã¼ãã«æ¹è¡ãå«ã¾ãã¦ãããã©ãã 3. ã¯ãªãããã¼ãã«ãã¡ã¤ã«ã«æå®ãããæååãå«ã¾ãã¦ãããã©ãã TERATERM.INI ã« ConfirmChangePasteStringFile ã¨ã³ããªã追å ããã Modified Paths: -------------- trunk/installer/release/TERATERM.INI trunk/teraterm/common/tttypes.h trunk/teraterm/teraterm/clipboar.c trunk/teraterm/ttpset/ttset.c -------------- next part -------------- Modified: trunk/installer/release/TERATERM.INI =================================================================== --- trunk/installer/release/TERATERM.INI 2009-06-23 16:22:05 UTC (rev 3534) +++ trunk/installer/release/TERATERM.INI 2009-06-26 11:20:55 UTC (rev 3535) @@ -50,6 +50,7 @@ ; confirm changing clipboard string by clicking mouse right button ConfirmChangePaste=on PasteDialogSize=330,220 +ConfirmChangePasteStringFile= ; Scroll out the current buffer when the clear screen does. ScrollWindowClearScreen=on Modified: trunk/teraterm/common/tttypes.h =================================================================== --- trunk/teraterm/common/tttypes.h 2009-06-23 16:22:05 UTC (rev 3534) +++ trunk/teraterm/common/tttypes.h 2009-06-26 11:20:55 UTC (rev 3535) @@ -470,6 +470,7 @@ WORD Meta8Bit; WORD WindowFlag; WORD EnableLineMode; + char ConfirmChangePasteStringFile[MAX_PATH]; }; typedef struct tttset TTTSet, *PTTSet; @@ -919,6 +920,7 @@ * added tttset.Meta8Bit. * added tttset.WindowFlag. * added tttset.EnableLineMode + * added tttset.ConfirmChangePasteStringFile * * - At version 4.62, ttset_memfilemap was replaced with ttset_memfilemap_10. * added tttset.DisableMouseTrackingByCtrl. Modified: trunk/teraterm/teraterm/clipboar.c =================================================================== --- trunk/teraterm/teraterm/clipboar.c 2009-06-23 16:22:05 UTC (rev 3534) +++ trunk/teraterm/teraterm/clipboar.c 2009-06-26 11:20:55 UTC (rev 3535) @@ -488,6 +488,42 @@ return TRUE; } +// t@CÉè`³ê½¶ñªAtextÉÜÜêé©ð²×éB +static int search_clipboard(char *filename, char *text) +{ + int ret = 0; // no hit + FILE *fp = NULL; + char buf[256]; + int len; + + if (filename == NULL || filename[0] == '\0') + goto error; + + fp = fopen(filename, "r"); + if (fp == NULL) + goto error; + + // TODO: êsª256byteð´¦Ä¢éêÌl¶ + while (fgets(buf, sizeof(buf), fp) != NULL) { + len = strlen(buf); + if (buf[len - 1] == '\n') + buf[len - 1] = '\0'; + if (buf[0] == '\0') + continue; + if (strstr(text, buf)) { // hit + ret = 1; + break; + } + } + +error: + if (fp) + fclose(fp); + + return (ret); +} + + // // Nbv{[hÉüsR[hªÜÜêÄ¢½çAmF_CAOð\¦·éB // Nbv{[hÌÏXàÂ\B @@ -504,6 +540,7 @@ char *pText; int pos; int ret = 0; + int confirm = 0; if (ts.ConfirmChangePaste == 0) return 1; @@ -529,6 +566,17 @@ pText = (char *)GlobalLock(hText); pos = strcspn(pText, "\r\n"); // üsªÜÜêÄ¢½ç if (pText[pos] != '\0') { + confirm = 1; + + } else { + // «ðT[`·é + if (search_clipboard(ts.ConfirmChangePasteStringFile, pText)) { + confirm = 1; + } + + } + + if (confirm) { ClipboardPtr = pText; PasteCanceled = 0; ret = DialogBox(hInst, MAKEINTRESOURCE(IDD_CLIPBOARD_DIALOG), Modified: trunk/teraterm/ttpset/ttset.c =================================================================== --- trunk/teraterm/ttpset/ttset.c 2009-06-23 16:22:05 UTC (rev 3534) +++ trunk/teraterm/ttpset/ttset.c 2009-06-26 11:20:55 UTC (rev 3535) @@ -1105,6 +1105,10 @@ // added ConfirmChangePaste (2008.2.3 yutaka) ts->ConfirmChangePaste = GetOnOff(Section, "ConfirmChangePaste", FName, TRUE); + GetPrivateProfileString(Section, "ConfirmChangePasteStringFile", "", + Temp, sizeof(Temp), FName); + strncpy_s(ts->ConfirmChangePasteStringFile, sizeof(ts->ConfirmChangePasteStringFile), Temp, + _TRUNCATE); // added ScrollWindowClearScreen (2008.5.3 yutaka) ts->ScrollWindowClearScreen = @@ -1511,6 +1515,8 @@ // added ConfirmChangePaste WriteOnOff(Section, "ConfirmChangePaste", FName, ts->ConfirmChangePaste); + WritePrivateProfileString(Section, "ConfirmChangePasteStringFile", + ts->ConfirmChangePasteStringFile, FName); // added ScrollWindowClearScreen WriteOnOff(Section, "ScrollWindowClearScreen", FName,