drag and dropダイアログファイル分離
- サイズ調整
- far,pascalキーワード削除(一部)
- プロジェクトの依存関係がおかしかったので修正(VS2017)
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - * Copyright (C) 2006-2017 TeraTerm Project | |
2 | + * Copyright (C) 2006-2018 TeraTerm Project | |
3 | 3 | * All rights reserved. |
4 | 4 | * |
5 | 5 | * Redistribution and use in source and binary forms, with or without |
@@ -28,13 +28,13 @@ | ||
28 | 28 | |
29 | 29 | #include "i18n.h" |
30 | 30 | |
31 | -void PASCAL GetI18nStr(PCHAR section, PCHAR key, PCHAR buf, int buf_len, PCHAR def, PCHAR iniFile) | |
31 | +void GetI18nStr(PCHAR section, PCHAR key, PCHAR buf, int buf_len, PCHAR def, const char *iniFile) | |
32 | 32 | { |
33 | 33 | GetPrivateProfileString(section, key, def, buf, buf_len, iniFile); |
34 | 34 | RestoreNewLine(buf); |
35 | 35 | } |
36 | 36 | |
37 | -int PASCAL GetI18nLogfont(PCHAR section, PCHAR key, PLOGFONT logfont, int ppi, PCHAR iniFile) | |
37 | +int GetI18nLogfont(PCHAR section, PCHAR key, PLOGFONT logfont, int ppi, const char *iniFile) | |
38 | 38 | { |
39 | 39 | static char tmp[MAX_UIMSG]; |
40 | 40 | static char font[LF_FACESIZE]; |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - * Copyright (C) 2006-2017 TeraTerm Project | |
2 | + * Copyright (C) 2006-2018 TeraTerm Project | |
3 | 3 | * All rights reserved. |
4 | 4 | * |
5 | 5 | * Redistribution and use in source and binary forms, with or without |
@@ -38,8 +38,8 @@ | ||
38 | 38 | extern "C" { |
39 | 39 | #endif |
40 | 40 | |
41 | -void PASCAL GetI18nStr(PCHAR section, PCHAR key, PCHAR buf, int buf_len, PCHAR def, PCHAR iniFile); | |
42 | -int PASCAL GetI18nLogfont(PCHAR section, PCHAR key, PLOGFONT logfont, int ppi, PCHAR iniFile); | |
41 | +void GetI18nStr(PCHAR section, PCHAR key, PCHAR buf, int buf_len, PCHAR def, const char *iniFile); | |
42 | +int GetI18nLogfont(PCHAR section, PCHAR key, PLOGFONT logfont, int ppi, const char *iniFile); | |
43 | 43 | |
44 | 44 | #ifdef __cplusplus |
45 | 45 | } |
@@ -970,12 +970,12 @@ | ||
970 | 970 | strncpy_s(buf, buflen, Temp, _TRUNCATE); |
971 | 971 | } |
972 | 972 | |
973 | -void get_lang_msg(PCHAR key, PCHAR buf, int buf_len, PCHAR def, PCHAR iniFile) | |
973 | +void get_lang_msg(PCHAR key, PCHAR buf, int buf_len, PCHAR def, const char *iniFile) | |
974 | 974 | { |
975 | 975 | GetI18nStr("Tera Term", key, buf, buf_len, def, iniFile); |
976 | 976 | } |
977 | 977 | |
978 | -int get_lang_font(PCHAR key, HWND dlg, PLOGFONT logfont, HFONT *font, PCHAR iniFile) | |
978 | +int get_lang_font(PCHAR key, HWND dlg, PLOGFONT logfont, HFONT *font, const char *iniFile) | |
979 | 979 | { |
980 | 980 | if (GetI18nLogfont("Tera Term", key, logfont, |
981 | 981 | GetDeviceCaps(GetDC(dlg),LOGPIXELSY), |
@@ -67,8 +67,8 @@ | ||
67 | 67 | void GetDefaultSetupFName(char *home, char *dest, int destlen); |
68 | 68 | void GetUILanguageFile(char *buf, int buflen); |
69 | 69 | void GetOnOffEntryInifile(char *entry, char *buf, int buflen); |
70 | -void get_lang_msg(PCHAR key, PCHAR buf, int buf_len, PCHAR def, PCHAR iniFile); | |
71 | -int get_lang_font(PCHAR key, HWND dlg, PLOGFONT logfont, HFONT *font, PCHAR iniFile); | |
70 | +void get_lang_msg(PCHAR key, PCHAR buf, int buf_len, PCHAR def, const char *iniFile); | |
71 | +int get_lang_font(PCHAR key, HWND dlg, PLOGFONT logfont, HFONT *font, const char *iniFile); | |
72 | 72 | BOOL doSelectFolder(HWND hWnd, char *path, int pathlen, char *def, char *msg); |
73 | 73 | void OutputDebugPrintf(char *fmt, ...); |
74 | 74 | BOOL is_NT4(); |
@@ -684,7 +684,6 @@ | ||
684 | 684 | }; |
685 | 685 | |
686 | 686 | typedef struct tttset TTTSet, *PTTSet; |
687 | -//typedef TTTSet far *PTTSet; | |
688 | 687 | |
689 | 688 | /* New Line modes */ |
690 | 689 | #define IdCR 1 |
@@ -782,11 +781,6 @@ | ||
782 | 781 | /* Baud rate ID */ |
783 | 782 | #define BaudNone 0 |
784 | 783 | |
785 | -static PCHAR far BaudList[] = | |
786 | - {"110","300","600","1200","2400","4800","9600", | |
787 | - "14400","19200","38400","57600","115200", | |
788 | - "230400", "460800", "921600", NULL}; | |
789 | - | |
790 | 784 | /* Parity ID */ |
791 | 785 | #define IdParityNone 1 |
792 | 786 | #define IdParityOdd 2 |
@@ -817,7 +811,7 @@ | ||
817 | 811 | WORD ComPort; // serial port # |
818 | 812 | WORD MaxComPort; // max serial port # |
819 | 813 | } TGetHNRec; |
820 | -typedef TGetHNRec far *PGetHNRec; | |
814 | +typedef TGetHNRec *PGetHNRec; | |
821 | 815 | |
822 | 816 | /* Tera Term internal key codes */ |
823 | 817 | #define IdUp 1 |
@@ -935,7 +929,7 @@ | ||
935 | 929 | /* user key type */ |
936 | 930 | BYTE UserKeyType[NumOfUserKey]; |
937 | 931 | } TKeyMap; |
938 | -typedef TKeyMap far *PKeyMap; | |
932 | +typedef TKeyMap *PKeyMap; | |
939 | 933 | |
940 | 934 | /* Control Characters */ |
941 | 935 |
@@ -1093,7 +1087,7 @@ | ||
1093 | 1087 | |
1094 | 1088 | DWORD ConnectedTime; |
1095 | 1089 | } TComVar; |
1096 | -typedef TComVar far *PComVar; | |
1090 | +typedef TComVar *PComVar; | |
1097 | 1091 | |
1098 | 1092 | #define ID_FILE 0 |
1099 | 1093 | #define ID_EDIT 1 |
@@ -1138,7 +1132,7 @@ | ||
1138 | 1132 | BOOL WinUndoFlag; |
1139 | 1133 | int WinUndoStyle; |
1140 | 1134 | } TMap; |
1141 | -typedef TMap far *PMap; | |
1135 | +typedef TMap *PMap; | |
1142 | 1136 | |
1143 | 1137 | // TMap を格納するファイルマッピングオブジェクト(共有メモリ)の名前 |
1144 | 1138 | // TMap(とそのメンバ)の更新時は旧バージョンとの同時起動の為に変える必要があるが |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - * Copyright (C) 2009-2017 TeraTerm Project | |
2 | + * Copyright (C) 2009-2018 TeraTerm Project | |
3 | 3 | * All rights reserved. |
4 | 4 | * |
5 | 5 | * Redistribution and use in source and binary forms, with or without |
@@ -43,7 +43,10 @@ | ||
43 | 43 | |
44 | 44 | // _popen はスペースが含まれる場合にダブルクォートで囲んでも |
45 | 45 | // うまく動かないため 8.3 形式に変換 |
46 | - GetShortPathName(svnversion, arg1, sizeof(arg1)); | |
46 | + DWORD r = GetShortPathName(svnversion, arg1, sizeof(arg1)); | |
47 | + if (r == 0) { | |
48 | + return -1; // svn did not exist | |
49 | + } | |
47 | 50 | GetShortPathName(path, arg2, sizeof(arg2)); |
48 | 51 | |
49 | 52 | _snprintf_s(command, sizeof(command), _TRUNCATE, "%s -n %s", arg1, arg2); |
@@ -0,0 +1,329 @@ | ||
1 | +/* | |
2 | + * (C) 2005-2018 TeraTerm Project | |
3 | + * All rights reserved. | |
4 | + * | |
5 | + * Redistribution and use in source and binary forms, with or without | |
6 | + * modification, are permitted provided that the following conditions | |
7 | + * are met: | |
8 | + * | |
9 | + * 1. Redistributions of source code must retain the above copyright | |
10 | + * notice, this list of conditions and the following disclaimer. | |
11 | + * 2. Redistributions in binary form must reproduce the above copyright | |
12 | + * notice, this list of conditions and the following disclaimer in the | |
13 | + * documentation and/or other materials provided with the distribution. | |
14 | + * 3. The name of the author may not be used to endorse or promote products | |
15 | + * derived from this software without specific prior written permission. | |
16 | + * | |
17 | + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR | |
18 | + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
19 | + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
20 | + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, | |
21 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
22 | + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
23 | + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
24 | + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
25 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
26 | + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
27 | + */ | |
28 | + | |
29 | +#include "dnddlg.h" | |
30 | + | |
31 | +#include <windowsx.h> | |
32 | +#include <stdio.h> // for _snprintf_s | |
33 | + | |
34 | +#include "tt_res.h" | |
35 | + | |
36 | +#include "i18n.h" | |
37 | +#include "ttlib.h" | |
38 | +#include "dlglib.h" | |
39 | +#include "tttypes.h" // for ttwinman.h | |
40 | +#include "ttwinman.h" // for ts | |
41 | + | |
42 | +struct DlgTextInfo { | |
43 | + int nIDDlgItem; | |
44 | + char *key; | |
45 | +}; | |
46 | + | |
47 | +struct DrapDropDlgParam { | |
48 | + const char *TargetFilename; | |
49 | + enum drop_type DropType; | |
50 | + unsigned char DropTypePaste; | |
51 | + bool ScpEnable; | |
52 | + char *ScpSendDirPtr; | |
53 | + int ScpSendDirSize; | |
54 | + bool SendfileEnable; | |
55 | + bool PasteNewlineEnable; | |
56 | + int RemaingFileCount; | |
57 | + bool DoSameProcess; | |
58 | + bool DoSameProcessNextDrop; | |
59 | + bool DoNotShowDialogEnable; | |
60 | + bool DoNotShowDialog; | |
61 | + const char *UILanguageFile; | |
62 | +}; | |
63 | + | |
64 | +struct DrapDropDlgData { | |
65 | + HFONT hPrevFont; | |
66 | + DrapDropDlgParam *Param; | |
67 | +}; | |
68 | + | |
69 | +static HFONT SetDlgFonts(HWND hDlg, const int nIDDlgItems[], int nIDDlgItemCount, const char *UILanguageFile, PCHAR key) | |
70 | +{ | |
71 | + if (key == NULL) key = "DLG_TAHOMA_FONT"; | |
72 | + HFONT hPrevFont = (HFONT)SendMessage(hDlg, WM_GETFONT, 0, 0); | |
73 | + LOGFONT logfont; | |
74 | + GetObject(hPrevFont, sizeof(LOGFONT), &logfont); | |
75 | + HFONT hNewFont; | |
76 | + if (get_lang_font("DLG_TAHOMA_FONT", hDlg, &logfont, &hNewFont, UILanguageFile)) { | |
77 | + for (int i = 0 ; i < nIDDlgItemCount ; i++) { | |
78 | + const int nIDDlgItem = nIDDlgItems[i]; | |
79 | + SendDlgItemMessage(hDlg, nIDDlgItem, WM_SETFONT, (WPARAM)hNewFont, MAKELPARAM(TRUE,0)); | |
80 | + } | |
81 | + } | |
82 | + return hNewFont; | |
83 | +} | |
84 | + | |
85 | +static void SetDlgTexts(HWND hDlgWnd, const DlgTextInfo *infos, int infoCount, const char *UILanguageFile) | |
86 | +{ | |
87 | + for (int i = 0 ; i < infoCount; i++) { | |
88 | + char *key = infos[i].key; | |
89 | + char uimsg[MAX_UIMSG]; | |
90 | + get_lang_msg(key, uimsg, sizeof(uimsg), "", UILanguageFile); | |
91 | + if (uimsg[0] != '\0') { | |
92 | + const int nIDDlgItem = infos[i].nIDDlgItem; | |
93 | + if (nIDDlgItem == 0) { | |
94 | + SetWindowText(hDlgWnd, uimsg); | |
95 | + } else { | |
96 | + SetDlgItemText(hDlgWnd, nIDDlgItem, uimsg); | |
97 | + } | |
98 | + } | |
99 | + } | |
100 | +} | |
101 | + | |
102 | +static LRESULT CALLBACK OnDragDropDlgProc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp) | |
103 | +{ | |
104 | + static const int FontIDs[] = { | |
105 | + IDC_FILENAME_EDIT, | |
106 | + IDC_DAD_STATIC, | |
107 | + IDC_SCP_RADIO, IDC_SENDFILE_RADIO, IDC_PASTE_RADIO, | |
108 | + IDC_SCP_PATH_LABEL, IDC_SCP_PATH, IDC_SCP_PATH_NOTE, | |
109 | + IDC_BINARY_CHECK, | |
110 | + IDC_ESCAPE_CHECK, IDC_NEWLINE_RADIO, IDC_SPACE_RADIO, | |
111 | + IDC_SAME_PROCESS_CHECK, IDC_SAME_PROCESS_NEXTDROP_CHECK, IDC_DONTSHOW_CHECK, | |
112 | + IDC_DAD_NOTE, | |
113 | + IDOK, IDCANCEL, | |
114 | + }; | |
115 | + static const DlgTextInfo TextInfos[] = { | |
116 | + { 0, "DLG_DANDD_TITLE" }, | |
117 | + { IDC_DAD_STATIC, "DLG_DANDD_TEXT" }, | |
118 | + { IDC_SCP_PATH_NOTE, "DLG_DADDD_DEST_NOTE" }, | |
119 | + { IDC_SAME_PROCESS_CHECK, "DLG_DANDD_CONFLICTS" }, | |
120 | + { IDC_SAME_PROCESS_NEXTDROP_CHECK, "DLG_DANDD_SAME_NEEXTDROP" }, | |
121 | + { IDC_DONTSHOW_CHECK, "DLG_DANDD_DONTSHOW_NEEXTDROP" }, | |
122 | + { IDC_DAD_NOTE, "DLG_DANDD_NOTE" }, | |
123 | + { IDOK, "BTN_OK" }, | |
124 | + { IDCANCEL, "BTN_CANCEL" }, | |
125 | + }; | |
126 | + DrapDropDlgData *DlgData = (DrapDropDlgData *)GetWindowLongPtr(hDlgWnd, GWLP_USERDATA); | |
127 | + | |
128 | + switch (msg) { | |
129 | + case WM_INITDIALOG: | |
130 | + { | |
131 | + DlgData = (DrapDropDlgData *)malloc(sizeof(DrapDropDlgData)); | |
132 | + SetWindowLongPtr(hDlgWnd, GWLP_USERDATA, (LONG_PTR)DlgData); | |
133 | + DrapDropDlgParam *Param = (DrapDropDlgParam *)lp; | |
134 | + DlgData->Param = Param; | |
135 | + DlgData->hPrevFont = SetDlgFonts(hDlgWnd, FontIDs, _countof(FontIDs), Param->UILanguageFile, NULL); | |
136 | + SetDlgTexts(hDlgWnd, TextInfos, _countof(TextInfos), Param->UILanguageFile); | |
137 | + | |
138 | + // target file | |
139 | + SetDlgItemText(hDlgWnd, IDC_FILENAME_EDIT, Param->TargetFilename); | |
140 | + | |
141 | + // checkbox | |
142 | + CheckRadioButton(hDlgWnd, IDC_SCP_RADIO, IDC_PASTE_RADIO, | |
143 | + (Param->DropType == DROP_TYPE_SEND_FILE || | |
144 | + Param->DropType == DROP_TYPE_SEND_FILE_BINARY) ? IDC_SENDFILE_RADIO : | |
145 | + Param->DropType == DROP_TYPE_PASTE_FILENAME ? IDC_PASTE_RADIO : | |
146 | + IDC_SCP_RADIO); | |
147 | + | |
148 | + // SCP | |
149 | + SendMessage(GetDlgItem(hDlgWnd, IDC_SCP_PATH), WM_SETTEXT, 0, (LPARAM)Param->ScpSendDirPtr); | |
150 | + if (!Param->ScpEnable) { | |
151 | + // 無効化 | |
152 | + EnableWindow(GetDlgItem(hDlgWnd, IDC_SCP_RADIO), FALSE); | |
153 | + EnableWindow(GetDlgItem(hDlgWnd, IDC_SCP_PATH_LABEL), FALSE); | |
154 | + EnableWindow(GetDlgItem(hDlgWnd, IDC_SCP_PATH), FALSE); | |
155 | + EnableWindow(GetDlgItem(hDlgWnd, IDC_SCP_PATH_NOTE), FALSE); | |
156 | + } | |
157 | + | |
158 | + // Send File | |
159 | + if (Param->DropType == DROP_TYPE_SEND_FILE_BINARY) { | |
160 | + SendMessage(GetDlgItem(hDlgWnd, IDC_BINARY_CHECK), BM_SETCHECK, BST_CHECKED, 0); | |
161 | + } | |
162 | + if (!Param->SendfileEnable) { | |
163 | + // 無効化 | |
164 | + EnableWindow(GetDlgItem(hDlgWnd, IDC_SENDFILE_RADIO), FALSE); | |
165 | + EnableWindow(GetDlgItem(hDlgWnd, IDC_BINARY_CHECK), FALSE); | |
166 | + } | |
167 | + | |
168 | + // Paste Filename | |
169 | + if (Param->DropTypePaste & DROP_TYPE_PASTE_ESCAPE) { | |
170 | + SendMessage(GetDlgItem(hDlgWnd, IDC_ESCAPE_CHECK), BM_SETCHECK, BST_CHECKED, 0); | |
171 | + } | |
172 | + CheckRadioButton(hDlgWnd, IDC_SPACE_RADIO, IDC_NEWLINE_RADIO, | |
173 | + Param->DropTypePaste & DROP_TYPE_PASTE_NEWLINE? | |
174 | + IDC_NEWLINE_RADIO : IDC_SPACE_RADIO); | |
175 | + if (Param->RemaingFileCount < 2) { | |
176 | + EnableWindow(GetDlgItem(hDlgWnd, IDC_SPACE_RADIO), FALSE); | |
177 | + EnableWindow(GetDlgItem(hDlgWnd, IDC_NEWLINE_RADIO), FALSE); | |
178 | + } | |
179 | + | |
180 | + // Do this for the next %d conflicts | |
181 | + char orgmsg[MAX_UIMSG]; | |
182 | + GetDlgItemText(hDlgWnd, IDC_SAME_PROCESS_CHECK, orgmsg, sizeof(orgmsg)); | |
183 | + char uimsg[MAX_UIMSG]; | |
184 | + _snprintf_s(uimsg, sizeof(uimsg), _TRUNCATE, orgmsg, Param->RemaingFileCount - 1); | |
185 | + SetDlgItemText(hDlgWnd, IDC_SAME_PROCESS_CHECK, uimsg); | |
186 | + if (Param->RemaingFileCount < 2) { | |
187 | + EnableWindow(GetDlgItem(hDlgWnd, IDC_SAME_PROCESS_CHECK), FALSE); | |
188 | + } | |
189 | + | |
190 | + // Dont Show Dialog | |
191 | + if (Param->DoNotShowDialog) { | |
192 | + SendMessage(GetDlgItem(hDlgWnd, IDC_DONTSHOW_CHECK), BM_SETCHECK, BST_CHECKED, 0); | |
193 | + } | |
194 | + if (!Param->DoNotShowDialogEnable) { | |
195 | + EnableWindow(GetDlgItem(hDlgWnd, IDC_DONTSHOW_CHECK), FALSE); | |
196 | + EnableWindow(GetDlgItem(hDlgWnd, IDC_DAD_NOTE), FALSE); | |
197 | + } | |
198 | + | |
199 | + // focus to "SCP dest textbox" or "Cancel" | |
200 | + if (Param->ScpEnable) { | |
201 | + // "SCP" 有効時は Cancel にフォーカスを当て、最終的に SCP PATH にフォーカスが | |
202 | + // 当たるようにする。 | |
203 | + SetFocus(GetDlgItem(hDlgWnd, IDC_SCP_RADIO)); | |
204 | + } else { | |
205 | + // フォーカスの初期状態を Cancel にする為、この時点では IDOK に | |
206 | + // フォーカスを当てる。後で WM_NEXTDLGCTL でフォーカスが次のボタンになる。 | |
207 | + SetFocus(GetDlgItem(hDlgWnd, IDOK)); | |
208 | + } | |
209 | + // フォーカスを次のボタンに移す | |
210 | + // SetFocus() で直接フォーカスを当てるとタブキーの動作等に問題が出るため、 | |
211 | + // このメッセージを併用する | |
212 | + PostMessage(hDlgWnd, WM_NEXTDLGCTL, 0, 0L); | |
213 | + | |
214 | + // TRUEにするとボタンにフォーカスが当たらない。 | |
215 | + return FALSE; | |
216 | + } | |
217 | + | |
218 | + case WM_COMMAND: | |
219 | + { | |
220 | + WORD wID = GET_WM_COMMAND_ID(wp, lp); | |
221 | + const WORD wCMD = GET_WM_COMMAND_CMD(wp, lp); | |
222 | + if (wCMD == BN_DBLCLK && | |
223 | + (wID == IDC_SCP_RADIO || wID == IDC_SENDFILE_RADIO || wID == IDC_PASTE_RADIO)) | |
224 | + { // radio buttons double click | |
225 | + wID = IDOK; | |
226 | + } | |
227 | + if (wCMD == EN_SETFOCUS && wID == IDC_SCP_PATH) { | |
228 | + CheckRadioButton(hDlgWnd, IDC_SCP_RADIO, IDC_PASTE_RADIO, IDC_SCP_RADIO); | |
229 | + } | |
230 | + if (wID == IDC_BINARY_CHECK) { | |
231 | + CheckRadioButton(hDlgWnd, IDC_SCP_RADIO, IDC_PASTE_RADIO, IDC_SENDFILE_RADIO); | |
232 | + } | |
233 | + if (wID == IDC_ESCAPE_CHECK || | |
234 | + wID == IDC_SPACE_RADIO || wID == IDC_NEWLINE_RADIO) | |
235 | + { | |
236 | + CheckRadioButton(hDlgWnd, IDC_SCP_RADIO, IDC_PASTE_RADIO, IDC_PASTE_RADIO); | |
237 | + } | |
238 | + if (wID == IDOK) { | |
239 | + if (IsDlgButtonChecked(hDlgWnd, IDC_SCP_RADIO) == BST_CHECKED) { | |
240 | + // SCP | |
241 | + DlgData->Param->DropType = DROP_TYPE_SCP; | |
242 | + SendMessage(GetDlgItem(hDlgWnd, IDC_SCP_PATH), WM_GETTEXT, | |
243 | + (WPARAM)DlgData->Param->ScpSendDirSize, | |
244 | + (LPARAM)DlgData->Param->ScpSendDirPtr); | |
245 | + } else if (IsDlgButtonChecked(hDlgWnd, IDC_SENDFILE_RADIO) == BST_CHECKED) { | |
246 | + // Send File | |
247 | + DlgData->Param->DropType = | |
248 | + (IsDlgButtonChecked(hDlgWnd, IDC_BINARY_CHECK) == BST_CHECKED) ? | |
249 | + DROP_TYPE_SEND_FILE_BINARY : DROP_TYPE_SEND_FILE; | |
250 | + } else /* if (IsDlgButtonChecked(hDlgWnd, IDC_PASTE_RADIO) == BST_CHECKED) */ { | |
251 | + // Paste Filename | |
252 | + DlgData->Param->DropType = DROP_TYPE_PASTE_FILENAME; | |
253 | + DlgData->Param->DropTypePaste = 0; | |
254 | + DlgData->Param->DropTypePaste |= | |
255 | + (IsDlgButtonChecked(hDlgWnd, IDC_ESCAPE_CHECK) == BST_CHECKED) ? | |
256 | + DROP_TYPE_PASTE_ESCAPE : 0; | |
257 | + DlgData->Param->DropTypePaste |= | |
258 | + (IsDlgButtonChecked(hDlgWnd, IDC_NEWLINE_RADIO) == BST_CHECKED) ? | |
259 | + DROP_TYPE_PASTE_NEWLINE : 0; | |
260 | + } | |
261 | + DlgData->Param->DoSameProcess = | |
262 | + (IsDlgButtonChecked(hDlgWnd, IDC_SAME_PROCESS_CHECK) == BST_CHECKED) ? | |
263 | + true : false; | |
264 | + DlgData->Param->DoSameProcessNextDrop = | |
265 | + (IsDlgButtonChecked(hDlgWnd, IDC_SAME_PROCESS_NEXTDROP_CHECK) == BST_CHECKED) ? | |
266 | + true : false; | |
267 | + DlgData->Param->DoNotShowDialog = | |
268 | + (IsDlgButtonChecked(hDlgWnd, IDC_DONTSHOW_CHECK) == BST_CHECKED) ? | |
269 | + true : false; | |
270 | + } | |
271 | + if (wID == IDCANCEL) { | |
272 | + DlgData->Param->DropType = DROP_TYPE_CANCEL; | |
273 | + } | |
274 | + if (wID == IDOK || wID == IDCANCEL) { | |
275 | + if (DlgData->hPrevFont != NULL) { | |
276 | + DeleteObject(DlgData->hPrevFont); | |
277 | + } | |
278 | + EndDialog(hDlgWnd, wID); | |
279 | + free(DlgData); | |
280 | + break; | |
281 | + } | |
282 | + return FALSE; | |
283 | + } | |
284 | + | |
285 | + default: | |
286 | + return FALSE; | |
287 | + } | |
288 | + return TRUE; | |
289 | +} | |
290 | + | |
291 | +enum drop_type ShowDropDialogBox( | |
292 | + HINSTANCE hInstance, HWND hWndParent, | |
293 | + const char *TargetFilename, | |
294 | + enum drop_type DefaultDropType, | |
295 | + int RemaingFileCount, | |
296 | + bool EnableSCP, | |
297 | + bool EnableSendFile, | |
298 | + bool EnableDoNotShowDialog, | |
299 | + unsigned char *DropTypePaste, | |
300 | + bool *DoSameProcess, | |
301 | + bool *DoSameProcessNextDrop, | |
302 | + bool *DoNotShowDialog) | |
303 | +{ | |
304 | + DrapDropDlgParam Param; | |
305 | + Param.TargetFilename = TargetFilename; | |
306 | + Param.DropType = DefaultDropType; | |
307 | + Param.DropTypePaste = *DropTypePaste; | |
308 | + Param.ScpEnable = EnableSCP; | |
309 | + Param.ScpSendDirPtr = ts.ScpSendDir; | |
310 | + Param.ScpSendDirSize = sizeof(ts.ScpSendDir); | |
311 | + Param.SendfileEnable = EnableSendFile; | |
312 | + Param.PasteNewlineEnable = true; | |
313 | + Param.RemaingFileCount = RemaingFileCount; | |
314 | + Param.DoNotShowDialog = *DoNotShowDialog; | |
315 | + Param.DoNotShowDialogEnable = EnableDoNotShowDialog; | |
316 | + Param.UILanguageFile = ts.UILanguageFile; | |
317 | + int ret = DialogBoxParam( | |
318 | + hInstance, MAKEINTRESOURCE(IDD_DAD_DIALOG), | |
319 | + hWndParent, (DLGPROC)OnDragDropDlgProc, | |
320 | + (LPARAM)&Param); | |
321 | + if (ret != IDOK) { | |
322 | + return DROP_TYPE_CANCEL; | |
323 | + } | |
324 | + *DropTypePaste = Param.DropTypePaste; | |
325 | + *DoSameProcess = Param.DoSameProcess; | |
326 | + *DoSameProcessNextDrop = Param.DoSameProcessNextDrop; | |
327 | + *DoNotShowDialog = Param.DoNotShowDialog; | |
328 | + return Param.DropType; | |
329 | +} |
@@ -0,0 +1,53 @@ | ||
1 | +/* | |
2 | + * (C) 2005-2018 TeraTerm Project | |
3 | + * All rights reserved. | |
4 | + * | |
5 | + * Redistribution and use in source and binary forms, with or without | |
6 | + * modification, are permitted provided that the following conditions | |
7 | + * are met: | |
8 | + * | |
9 | + * 1. Redistributions of source code must retain the above copyright | |
10 | + * notice, this list of conditions and the following disclaimer. | |
11 | + * 2. Redistributions in binary form must reproduce the above copyright | |
12 | + * notice, this list of conditions and the following disclaimer in the | |
13 | + * documentation and/or other materials provided with the distribution. | |
14 | + * 3. The name of the author may not be used to endorse or promote products | |
15 | + * derived from this software without specific prior written permission. | |
16 | + * | |
17 | + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR | |
18 | + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
19 | + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
20 | + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, | |
21 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
22 | + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
23 | + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
24 | + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
25 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
26 | + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
27 | + */ | |
28 | + | |
29 | +#include <windows.h> | |
30 | + | |
31 | +enum drop_type { | |
32 | + DROP_TYPE_CANCEL, | |
33 | + DROP_TYPE_SCP, | |
34 | + DROP_TYPE_SEND_FILE, // past contents of file | |
35 | + DROP_TYPE_SEND_FILE_BINARY, | |
36 | + DROP_TYPE_PASTE_FILENAME, | |
37 | +}; | |
38 | + | |
39 | +#define DROP_TYPE_PASTE_ESCAPE 0x01 | |
40 | +#define DROP_TYPE_PASTE_NEWLINE 0x02 | |
41 | + | |
42 | +enum drop_type ShowDropDialogBox( | |
43 | + HINSTANCE hInstance, HWND hWndParent, | |
44 | + const char *TargetFilename, | |
45 | + enum drop_type DefaultDropType, | |
46 | + int RemaingFileCount, | |
47 | + bool EnableSCP, | |
48 | + bool EnableSendFile, | |
49 | + bool EnableDoNotShowDialog, | |
50 | + unsigned char *DropTypePaste, | |
51 | + bool *DoSameProcess, | |
52 | + bool *DoSameProcessNextDrop, | |
53 | + bool *DoNotShowDialog); |
@@ -1,6 +1,6 @@ | ||
1 | 1 | /* |
2 | 2 | * Copyright (C) 1994-1998 T. Teranishi |
3 | - * (C) 2005-2017 TeraTerm Project | |
3 | + * (C) 2005-2018 TeraTerm Project | |
4 | 4 | * All rights reserved. |
5 | 5 | * |
6 | 6 | * Redistribution and use in source and binary forms, with or without |
@@ -44,7 +44,7 @@ | ||
44 | 44 | |
45 | 45 | #define CurWidth 2 |
46 | 46 | |
47 | -int DefaultColorTable[256][3] = { | |
47 | +static const BYTE DefaultColorTable[256][3] = { | |
48 | 48 | { 0, 0, 0}, {255, 0, 0}, { 0,255, 0}, {255,255, 0}, { 0, 0,255}, {255, 0,255}, { 0,255,255}, {255,255,255}, // 0 - 7 |
49 | 49 | {128,128,128}, {128, 0, 0}, { 0,128, 0}, {128,128, 0}, { 0, 0,128}, {128, 0,128}, { 0,128,128}, {192,192,192}, // 8 - 15 |
50 | 50 | { 0, 0, 0}, { 0, 0, 95}, { 0, 0,135}, { 0, 0,175}, { 0, 0,215}, { 0, 0,255}, { 0, 95, 0}, { 0, 95, 95}, // 16 - 23 |
@@ -77,6 +77,7 @@ | ||
77 | 77 | #include "addsetting.h" |
78 | 78 | #include "winjump.h" |
79 | 79 | #include "sizetip.h" |
80 | +#include "dnddlg.h" | |
80 | 81 | |
81 | 82 | #include "initguid.h" |
82 | 83 | //#include "Usbiodef.h" |
@@ -2024,301 +2025,6 @@ | ||
2024 | 2025 | DeleteNotifyIcon(&cv); |
2025 | 2026 | } |
2026 | 2027 | |
2027 | -static void SetDlgFonts(HWND hDlg, const int nIDDlgItems[], int nIDDlgItemCount, HFONT hFont) | |
2028 | -{ | |
2029 | - for (int i = 0 ; i < nIDDlgItemCount ; i++) { | |
2030 | - const int nIDDlgItem = nIDDlgItems[i]; | |
2031 | - SendDlgItemMessage(hDlg, nIDDlgItem, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE,0)); | |
2032 | - } | |
2033 | -} | |
2034 | - | |
2035 | -typedef struct { | |
2036 | - int nIDDlgItem; | |
2037 | - char *key; | |
2038 | -} DlgTextInfo; | |
2039 | - | |
2040 | -static void SetDlgTexts(HWND hDlgWnd, const DlgTextInfo *infos, int infoCount, char *UILanguageFile) | |
2041 | -{ | |
2042 | - for (int i = 0 ; i < infoCount; i++) { | |
2043 | - char *key = infos[i].key; | |
2044 | - char uimsg[MAX_UIMSG]; | |
2045 | - get_lang_msg(key, uimsg, sizeof(uimsg), "", UILanguageFile); | |
2046 | - if (uimsg[0] != '\0') { | |
2047 | - const int nIDDlgItem = infos[i].nIDDlgItem; | |
2048 | - if (nIDDlgItem == 0) { | |
2049 | - SetWindowText(hDlgWnd, uimsg); | |
2050 | - } else { | |
2051 | - SetDlgItemText(hDlgWnd, nIDDlgItem, uimsg); | |
2052 | - } | |
2053 | - } | |
2054 | - } | |
2055 | -} | |
2056 | - | |
2057 | -enum drop_type { | |
2058 | - DROP_TYPE_CANCEL, | |
2059 | - DROP_TYPE_SCP, | |
2060 | - DROP_TYPE_SEND_FILE, // past contents of file | |
2061 | - DROP_TYPE_SEND_FILE_BINARY, | |
2062 | - DROP_TYPE_PASTE_FILENAME, | |
2063 | -}; | |
2064 | - | |
2065 | -#define DROP_TYPE_PASTE_ESCAPE 0x01 | |
2066 | -#define DROP_TYPE_PASTE_NEWLINE 0x02 | |
2067 | - | |
2068 | -struct DrapDropDlgParam { | |
2069 | - const char *TargetFilename; | |
2070 | - enum drop_type DropType; | |
2071 | - unsigned char DropTypePaste; | |
2072 | - bool ScpEnable; | |
2073 | - char *ScpSendDirPtr; | |
2074 | - int ScpSendDirSize; | |
2075 | - bool SendfileEnable; | |
2076 | - bool PasteNewlineEnable; | |
2077 | - int RemaingFileCount; | |
2078 | - bool DoSameProcess; | |
2079 | - bool DoSameProcessNextDrop; | |
2080 | - bool DoNotShowDialogEnable; | |
2081 | - bool DoNotShowDialog; | |
2082 | -}; | |
2083 | - | |
2084 | -struct DrapDropDlgData { | |
2085 | - HFONT DlgDragDropFont; | |
2086 | - struct DrapDropDlgParam *Param; | |
2087 | -}; | |
2088 | - | |
2089 | -static LRESULT CALLBACK OnDragDropDlgProc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp) | |
2090 | -{ | |
2091 | - struct DrapDropDlgData *DlgData = (struct DrapDropDlgData *)GetWindowLongPtr(hDlgWnd, GWLP_USERDATA); | |
2092 | - | |
2093 | - switch (msg) { | |
2094 | - case WM_INITDIALOG: | |
2095 | - { | |
2096 | - LOGFONT logfont; | |
2097 | - HFONT font; | |
2098 | - HFONT DlgDragDropFont = NULL; | |
2099 | - DlgData = (struct DrapDropDlgData *)malloc(sizeof(struct DrapDropDlgData)); | |
2100 | - SetWindowLongPtr(hDlgWnd, GWLP_USERDATA, (LONG_PTR)DlgData); | |
2101 | - struct DrapDropDlgParam *Param = (struct DrapDropDlgParam *)lp; | |
2102 | - DlgData->Param = Param; | |
2103 | - font = (HFONT)SendMessage(hDlgWnd, WM_GETFONT, 0, 0); | |
2104 | - GetObject(font, sizeof(LOGFONT), &logfont); | |
2105 | - if (get_lang_font("DLG_TAHOMA_FONT", hDlgWnd, &logfont, &DlgDragDropFont, ts.UILanguageFile)) { | |
2106 | - static const int IDs[] = { | |
2107 | - IDC_FILENAME_EDIT, | |
2108 | - IDC_DAD_STATIC, | |
2109 | - IDC_SCP_RADIO, IDC_SENDFILE_RADIO, IDC_PASTE_RADIO, | |
2110 | - IDC_SCP_PATH_LABEL, IDC_SCP_PATH, IDC_SCP_PATH_NOTE, | |
2111 | - IDC_BINARY_CHECK, | |
2112 | - IDC_ESCAPE_CHECK, IDC_NEWLINE_RADIO, IDC_SPACE_RADIO, | |
2113 | - IDC_SAME_PROCESS_CHECK, IDC_SAME_PROCESS_NEXTDROP_CHECK, IDC_DONTSHOW_CHECK, | |
2114 | - IDC_DAD_NOTE, | |
2115 | - IDOK, IDCANCEL, | |
2116 | - }; | |
2117 | - SetDlgFonts(hDlgWnd, IDs, _countof(IDs), DlgDragDropFont); | |
2118 | - } else { | |
2119 | - DlgDragDropFont = NULL; | |
2120 | - } | |
2121 | - DlgData->DlgDragDropFont = DlgDragDropFont; | |
2122 | - | |
2123 | - static const DlgTextInfo textInfos[] = { | |
2124 | - { 0, "MSG_DANDD_CONF_TITLE" }, | |
2125 | - { IDC_DAD_STATIC, "MSG_DANDD_CONF" }, | |
2126 | - { IDC_SAME_PROCESS_CHECK, "MSG_DANDD_CONF_CONFLICTS" }, | |
2127 | - }; | |
2128 | - SetDlgTexts(hDlgWnd, textInfos, _countof(textInfos), ts.UILanguageFile); | |
2129 | - | |
2130 | - // target file | |
2131 | - SetDlgItemText(hDlgWnd, IDC_FILENAME_EDIT, Param->TargetFilename); | |
2132 | - | |
2133 | - // checkbox | |
2134 | - CheckRadioButton(hDlgWnd, IDC_SCP_RADIO, IDC_PASTE_RADIO, | |
2135 | - (Param->DropType == DROP_TYPE_SEND_FILE || | |
2136 | - Param->DropType == DROP_TYPE_SEND_FILE_BINARY) ? IDC_SENDFILE_RADIO : | |
2137 | - Param->DropType == DROP_TYPE_PASTE_FILENAME ? IDC_PASTE_RADIO : | |
2138 | - IDC_SCP_RADIO); | |
2139 | - | |
2140 | - // SCP | |
2141 | - SendMessage(GetDlgItem(hDlgWnd, IDC_SCP_PATH), WM_SETTEXT, 0, (LPARAM)Param->ScpSendDirPtr); | |
2142 | - if (!Param->ScpEnable) { | |
2143 | - // 無効化 | |
2144 | - EnableWindow(GetDlgItem(hDlgWnd, IDC_SCP_RADIO), FALSE); | |
2145 | - EnableWindow(GetDlgItem(hDlgWnd, IDC_SCP_PATH_LABEL), FALSE); | |
2146 | - EnableWindow(GetDlgItem(hDlgWnd, IDC_SCP_PATH), FALSE); | |
2147 | - EnableWindow(GetDlgItem(hDlgWnd, IDC_SCP_PATH_NOTE), FALSE); | |
2148 | - } | |
2149 | - | |
2150 | - // Send File | |
2151 | - if (Param->DropType == DROP_TYPE_SEND_FILE_BINARY) { | |
2152 | - SendMessage(GetDlgItem(hDlgWnd, IDC_BINARY_CHECK), BM_SETCHECK, BST_CHECKED, 0); | |
2153 | - } | |
2154 | - if (!Param->SendfileEnable) { | |
2155 | - // 無効化 | |
2156 | - EnableWindow(GetDlgItem(hDlgWnd, IDC_SENDFILE_RADIO), FALSE); | |
2157 | - EnableWindow(GetDlgItem(hDlgWnd, IDC_BINARY_CHECK), FALSE); | |
2158 | - } | |
2159 | - | |
2160 | - // Paste Filename | |
2161 | - if (Param->DropTypePaste & DROP_TYPE_PASTE_ESCAPE) { | |
2162 | - SendMessage(GetDlgItem(hDlgWnd, IDC_ESCAPE_CHECK), BM_SETCHECK, BST_CHECKED, 0); | |
2163 | - } | |
2164 | - CheckRadioButton(hDlgWnd, IDC_SPACE_RADIO, IDC_NEWLINE_RADIO, | |
2165 | - Param->DropTypePaste & DROP_TYPE_PASTE_NEWLINE? | |
2166 | - IDC_NEWLINE_RADIO : IDC_SPACE_RADIO); | |
2167 | - if (Param->RemaingFileCount < 2) { | |
2168 | - EnableWindow(GetDlgItem(hDlgWnd, IDC_SPACE_RADIO), FALSE); | |
2169 | - EnableWindow(GetDlgItem(hDlgWnd, IDC_NEWLINE_RADIO), FALSE); | |
2170 | - } | |
2171 | - | |
2172 | - // Do this for the next %d conflicts | |
2173 | - char orgmsg[MAX_UIMSG]; | |
2174 | - GetDlgItemText(hDlgWnd, IDC_SAME_PROCESS_CHECK, orgmsg, sizeof(orgmsg)); | |
2175 | - char uimsg[MAX_UIMSG]; | |
2176 | - _snprintf_s(uimsg, sizeof(uimsg), _TRUNCATE, orgmsg, Param->RemaingFileCount - 1); | |
2177 | - SetDlgItemText(hDlgWnd, IDC_SAME_PROCESS_CHECK, uimsg); | |
2178 | - if (Param->RemaingFileCount < 2) { | |
2179 | - EnableWindow(GetDlgItem(hDlgWnd, IDC_SAME_PROCESS_CHECK), FALSE); | |
2180 | - } | |
2181 | - | |
2182 | - // Dont Show Dialog | |
2183 | - if (Param->DoNotShowDialog) { | |
2184 | - SendMessage(GetDlgItem(hDlgWnd, IDC_DONTSHOW_CHECK), BM_SETCHECK, BST_CHECKED, 0); | |
2185 | - } | |
2186 | - if (!Param->DoNotShowDialogEnable) { | |
2187 | - EnableWindow(GetDlgItem(hDlgWnd, IDC_DONTSHOW_CHECK), FALSE); | |
2188 | - EnableWindow(GetDlgItem(hDlgWnd, IDC_DAD_NOTE), FALSE); | |
2189 | - } | |
2190 | - | |
2191 | - // focus to "SCP dest textbox" or "Cancel" | |
2192 | - if (Param->ScpEnable) { | |
2193 | - // "SCP" 有効時は Cancel にフォーカスを当て、最終的に SCP PATH にフォーカスが | |
2194 | - // 当たるようにする。 | |
2195 | - SetFocus(GetDlgItem(hDlgWnd, IDC_SCP_RADIO)); | |
2196 | - } else { | |
2197 | - // フォーカスの初期状態を Cancel にする為、この時点では IDOK に | |
2198 | - // フォーカスを当てる。後で WM_NEXTDLGCTL でフォーカスが次のボタンになる。 | |
2199 | - SetFocus(GetDlgItem(hDlgWnd, IDOK)); | |
2200 | - } | |
2201 | - // フォーカスを次のボタンに移す | |
2202 | - // SetFocus() で直接フォーカスを当てるとタブキーの動作等に問題が出るため、 | |
2203 | - // このメッセージを併用する | |
2204 | - PostMessage(hDlgWnd, WM_NEXTDLGCTL, 0, 0L); | |
2205 | - | |
2206 | - // TRUEにするとボタンにフォーカスが当たらない。 | |
2207 | - return FALSE; | |
2208 | - } | |
2209 | - | |
2210 | - case WM_COMMAND: | |
2211 | - { | |
2212 | - WORD wID = GET_WM_COMMAND_ID(wp, lp); | |
2213 | - const WORD wCMD = GET_WM_COMMAND_CMD(wp, lp); | |
2214 | - if (wCMD == BN_DBLCLK && | |
2215 | - (wID == IDC_SCP_RADIO || wID == IDC_SENDFILE_RADIO || wID == IDC_PASTE_RADIO)) | |
2216 | - { // radio buttons double click | |
2217 | - wID = IDOK; | |
2218 | - } | |
2219 | - if (wCMD == EN_SETFOCUS && wID == IDC_SCP_PATH) { | |
2220 | - CheckRadioButton(hDlgWnd, IDC_SCP_RADIO, IDC_PASTE_RADIO, IDC_SCP_RADIO); | |
2221 | - } | |
2222 | - if (wID == IDC_BINARY_CHECK) { | |
2223 | - CheckRadioButton(hDlgWnd, IDC_SCP_RADIO, IDC_PASTE_RADIO, IDC_SENDFILE_RADIO); | |
2224 | - } | |
2225 | - if (wID == IDC_ESCAPE_CHECK || | |
2226 | - wID == IDC_SPACE_RADIO || wID == IDC_NEWLINE_RADIO) | |
2227 | - { | |
2228 | - CheckRadioButton(hDlgWnd, IDC_SCP_RADIO, IDC_PASTE_RADIO, IDC_PASTE_RADIO); | |
2229 | - } | |
2230 | - if (wID == IDOK) { | |
2231 | - if (IsDlgButtonChecked(hDlgWnd, IDC_SCP_RADIO) == BST_CHECKED) { | |
2232 | - // SCP | |
2233 | - DlgData->Param->DropType = DROP_TYPE_SCP; | |
2234 | - SendMessage(GetDlgItem(hDlgWnd, IDC_SCP_PATH), WM_GETTEXT, | |
2235 | - (WPARAM)DlgData->Param->ScpSendDirSize, | |
2236 | - (LPARAM)DlgData->Param->ScpSendDirPtr); | |
2237 | - } else if (IsDlgButtonChecked(hDlgWnd, IDC_SENDFILE_RADIO) == BST_CHECKED) { | |
2238 | - // Send File | |
2239 | - DlgData->Param->DropType = | |
2240 | - (IsDlgButtonChecked(hDlgWnd, IDC_BINARY_CHECK) == BST_CHECKED) ? | |
2241 | - DROP_TYPE_SEND_FILE_BINARY : DROP_TYPE_SEND_FILE; | |
2242 | - } else /* if (IsDlgButtonChecked(hDlgWnd, IDC_PASTE_RADIO) == BST_CHECKED) */ { | |
2243 | - // Paste Filename | |
2244 | - DlgData->Param->DropType = DROP_TYPE_PASTE_FILENAME; | |
2245 | - DlgData->Param->DropTypePaste = 0; | |
2246 | - DlgData->Param->DropTypePaste |= | |
2247 | - (IsDlgButtonChecked(hDlgWnd, IDC_ESCAPE_CHECK) == BST_CHECKED) ? | |
2248 | - DROP_TYPE_PASTE_ESCAPE : 0; | |
2249 | - DlgData->Param->DropTypePaste |= | |
2250 | - (IsDlgButtonChecked(hDlgWnd, IDC_NEWLINE_RADIO) == BST_CHECKED) ? | |
2251 | - DROP_TYPE_PASTE_NEWLINE : 0; | |
2252 | - } | |
2253 | - DlgData->Param->DoSameProcess = | |
2254 | - (IsDlgButtonChecked(hDlgWnd, IDC_SAME_PROCESS_CHECK) == BST_CHECKED) ? | |
2255 | - true : false; | |
2256 | - DlgData->Param->DoSameProcessNextDrop = | |
2257 | - (IsDlgButtonChecked(hDlgWnd, IDC_SAME_PROCESS_NEXTDROP_CHECK) == BST_CHECKED) ? | |
2258 | - true : false; | |
2259 | - DlgData->Param->DoNotShowDialog = | |
2260 | - (IsDlgButtonChecked(hDlgWnd, IDC_DONTSHOW_CHECK) == BST_CHECKED) ? | |
2261 | - true : false; | |
2262 | - } | |
2263 | - if (wID == IDCANCEL) { | |
2264 | - DlgData->Param->DropType = DROP_TYPE_CANCEL; | |
2265 | - } | |
2266 | - if (wID == IDOK || wID == IDCANCEL) { | |
2267 | - if (DlgData->DlgDragDropFont != NULL) { | |
2268 | - DeleteObject(DlgData->DlgDragDropFont); | |
2269 | - } | |
2270 | - EndDialog(hDlgWnd, wID); | |
2271 | - free(DlgData); | |
2272 | - break; | |
2273 | - } | |
2274 | - return FALSE; | |
2275 | - } | |
2276 | - | |
2277 | - default: | |
2278 | - return FALSE; | |
2279 | - } | |
2280 | - return TRUE; | |
2281 | -} | |
2282 | - | |
2283 | -static enum drop_type ShowDropDialogBox( | |
2284 | - HINSTANCE hInstance, HWND hWndParent, | |
2285 | - const char *TargetFilename, | |
2286 | - enum drop_type DefaultDropType, | |
2287 | - int RemaingFileCount, | |
2288 | - bool EnableSCP, | |
2289 | - bool EnableSendFile, | |
2290 | - bool EnableDoNotShowDialog, | |
2291 | - unsigned char *DropTypePaste, | |
2292 | - bool *DoSameProcess, | |
2293 | - bool *DoSameProcessNextDrop, | |
2294 | - bool *DoNotShowDialog) | |
2295 | -{ | |
2296 | - struct DrapDropDlgParam Param; | |
2297 | - Param.TargetFilename = TargetFilename; | |
2298 | - Param.DropType = DefaultDropType; | |
2299 | - Param.DropTypePaste = *DropTypePaste; | |
2300 | - Param.ScpEnable = EnableSCP; | |
2301 | - Param.ScpSendDirPtr = ts.ScpSendDir; | |
2302 | - Param.ScpSendDirSize = sizeof(ts.ScpSendDir); | |
2303 | - Param.SendfileEnable = EnableSendFile; | |
2304 | - Param.PasteNewlineEnable = true; | |
2305 | - Param.RemaingFileCount = RemaingFileCount; | |
2306 | - Param.DoNotShowDialog = *DoNotShowDialog; | |
2307 | - Param.DoNotShowDialogEnable = EnableDoNotShowDialog; | |
2308 | - int ret = DialogBoxParam( | |
2309 | - hInstance, MAKEINTRESOURCE(IDD_DAD_DIALOG), | |
2310 | - hWndParent, (DLGPROC)OnDragDropDlgProc, | |
2311 | - (LPARAM)&Param); | |
2312 | - if (ret != IDOK) { | |
2313 | - return DROP_TYPE_CANCEL; | |
2314 | - } | |
2315 | - *DropTypePaste = Param.DropTypePaste; | |
2316 | - *DoSameProcess = Param.DoSameProcess; | |
2317 | - *DoSameProcessNextDrop = Param.DoSameProcessNextDrop; | |
2318 | - *DoNotShowDialog = Param.DoNotShowDialog; | |
2319 | - return Param.DropType; | |
2320 | -} | |
2321 | - | |
2322 | 2028 | static void EscapeFilename(const char *src, char *dest) |
2323 | 2029 | { |
2324 | 2030 | #define ESCAPE_CHARS " ;&()$!`'[]{}#^~" |
@@ -1,6 +1,6 @@ | ||
1 | 1 | /* |
2 | 2 | * Copyright (C) 1994-1998 T. Teranishi |
3 | - * (C) 2004-2017 TeraTerm Project | |
3 | + * (C) 2004-2018 TeraTerm Project | |
4 | 4 | * All rights reserved. |
5 | 5 | * |
6 | 6 | * Redistribution and use in source and binary forms, with or without |
@@ -72,9 +72,9 @@ | ||
72 | 72 | |
73 | 73 | char UILanguageFile[MAX_PATH]; |
74 | 74 | |
75 | -static PCHAR far NLListRcv[] = {"CR","CR+LF", "LF", "AUTO", NULL}; | |
76 | -static PCHAR far NLList[] = {"CR","CR+LF", "LF", NULL}; | |
77 | -static PCHAR far TermList[] = | |
75 | +static PCHAR NLListRcv[] = {"CR","CR+LF", "LF", "AUTO", NULL}; | |
76 | +static PCHAR NLList[] = {"CR","CR+LF", "LF", NULL}; | |
77 | +static PCHAR TermList[] = | |
78 | 78 | {"VT100", "VT101", "VT102", "VT282", "VT320", "VT382", |
79 | 79 | "VT420", "VT520", "VT525", NULL}; |
80 | 80 | static WORD Term_TermJ[] = |
@@ -81,29 +81,34 @@ | ||
81 | 81 | {IdVT100, IdVT101, IdVT102, IdVT282, IdVT320, IdVT382, |
82 | 82 | IdVT420, IdVT520, IdVT525}; |
83 | 83 | static WORD TermJ_Term[] = {1, 1, 2, 3, 3, 4, 4, 5, 6, 7, 8, 9}; |
84 | -static PCHAR far TermListJ[] = | |
84 | +static PCHAR TermListJ[] = | |
85 | 85 | {"VT100", "VT100J", "VT101", "VT102", "VT102J", "VT220J", "VT282", |
86 | 86 | "VT320", "VT382", "VT420", "VT520", "VT525", NULL}; |
87 | -static PCHAR far KanjiList[] = {"SJIS","EUC","JIS", "UTF-8", "UTF-8m", NULL}; | |
88 | -static PCHAR far KanjiListSend[] = {"SJIS","EUC","JIS", "UTF-8", NULL}; | |
89 | -static PCHAR far KanjiInList[] = {"^[$@","^[$B",NULL}; | |
90 | -static PCHAR far KanjiOutList[] = {"^[(B","^[(J",NULL}; | |
91 | -static PCHAR far KanjiOutList2[] = {"^[(B","^[(J","^[(H",NULL}; | |
92 | -static PCHAR far RussList[] = {"Windows","KOI8-R","CP 866","ISO 8859-5",NULL}; | |
93 | -static PCHAR far RussList2[] = {"Windows","KOI8-R",NULL}; | |
94 | -static PCHAR far LocaleList[] = {"japanese","chinese", "chinese-simplified", "chinese-traditional", NULL}; | |
95 | -static PCHAR far MetaList[] = {"off", "on", "left", "right", NULL}; | |
96 | -static PCHAR far MetaList2[] = {"off", "on", NULL}; | |
87 | +static PCHAR KanjiList[] = {"SJIS","EUC","JIS", "UTF-8", "UTF-8m", NULL}; | |
88 | +static PCHAR KanjiListSend[] = {"SJIS","EUC","JIS", "UTF-8", NULL}; | |
89 | +static PCHAR KanjiInList[] = {"^[$@","^[$B",NULL}; | |
90 | +static PCHAR KanjiOutList[] = {"^[(B","^[(J",NULL}; | |
91 | +static PCHAR KanjiOutList2[] = {"^[(B","^[(J","^[(H",NULL}; | |
92 | +static PCHAR RussList[] = {"Windows","KOI8-R","CP 866","ISO 8859-5",NULL}; | |
93 | +static PCHAR RussList2[] = {"Windows","KOI8-R",NULL}; | |
94 | +static PCHAR LocaleList[] = {"japanese","chinese", "chinese-simplified", "chinese-traditional", NULL}; | |
95 | +static PCHAR MetaList[] = {"off", "on", "left", "right", NULL}; | |
96 | +static PCHAR MetaList2[] = {"off", "on", NULL}; | |
97 | 97 | |
98 | 98 | // HKS |
99 | -static PCHAR far KoreanList[] = {"KS5601", "UTF-8", "UTF-8m", NULL}; | |
100 | -static PCHAR far KoreanListSend[] = {"KS5601", "UTF-8", NULL}; | |
99 | +static PCHAR KoreanList[] = {"KS5601", "UTF-8", "UTF-8m", NULL}; | |
100 | +static PCHAR KoreanListSend[] = {"KS5601", "UTF-8", NULL}; | |
101 | 101 | |
102 | 102 | // UTF-8 |
103 | -static PCHAR far Utf8List[] = {"UTF-8", "UTF-8m", NULL}; | |
104 | -static PCHAR far Utf8ListSend[] = {"UTF-8", NULL}; | |
103 | +static PCHAR Utf8List[] = {"UTF-8", "UTF-8m", NULL}; | |
104 | +static PCHAR Utf8ListSend[] = {"UTF-8", NULL}; | |
105 | 105 | |
106 | +static PCHAR BaudList[] = | |
107 | + {"110","300","600","1200","2400","4800","9600", | |
108 | + "14400","19200","38400","57600","115200", | |
109 | + "230400", "460800", "921600", NULL}; | |
106 | 110 | |
111 | + | |
107 | 112 | BOOL CALLBACK TermDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam) |
108 | 113 | { |
109 | 114 | PTTSet ts; |
@@ -1359,10 +1364,10 @@ | ||
1359 | 1364 | return FALSE; |
1360 | 1365 | } |
1361 | 1366 | |
1362 | -static PCHAR far DataList[] = {"7 bit","8 bit",NULL}; | |
1363 | -static PCHAR far ParityList[] = {"none", "odd", "even", "mark", "space", NULL}; | |
1364 | -static PCHAR far StopList[] = {"1 bit", "1.5 bit", "2 bit", NULL}; | |
1365 | -static PCHAR far FlowList[] = {"Xon/Xoff","hardware","none",NULL}; | |
1367 | +static PCHAR DataList[] = {"7 bit","8 bit",NULL}; | |
1368 | +static PCHAR ParityList[] = {"none", "odd", "even", "mark", "space", NULL}; | |
1369 | +static PCHAR StopList[] = {"1 bit", "1.5 bit", "2 bit", NULL}; | |
1370 | +static PCHAR FlowList[] = {"Xon/Xoff","hardware","none",NULL}; | |
1366 | 1371 | |
1367 | 1372 | BOOL CALLBACK SerialDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam) |
1368 | 1373 | { |
@@ -3036,7 +3041,7 @@ | ||
3036 | 3041 | return FALSE; |
3037 | 3042 | } |
3038 | 3043 | |
3039 | -static PCHAR far LangList[] = {"English","Japanese","Russian","Korean","UTF-8",NULL}; | |
3044 | +static PCHAR LangList[] = {"English","Japanese","Russian","Korean","UTF-8",NULL}; | |
3040 | 3045 | static char **LangUIList = NULL; |
3041 | 3046 | #define LANG_PATH "lang" |
3042 | 3047 | #define LANG_EXT ".lng" |
@@ -3573,7 +3578,7 @@ | ||
3573 | 3578 | switch (ul_reason_for_call) { |
3574 | 3579 | case DLL_THREAD_ATTACH: |
3575 | 3580 | /* do thread initialization */ |
3576 | - break; | |
3581 | + break; | |
3577 | 3582 | case DLL_THREAD_DETACH: |
3578 | 3583 | /* do thread cleanup */ |
3579 | 3584 | break; |