marge trunk 7172
@@ -30,6 +30,7 @@ | ||
30 | 30 | /* Routines for dialog boxes */ |
31 | 31 | #include <windows.h> |
32 | 32 | #include "dlglib.h" |
33 | +#include "i18n.h" // for MAX_UIMSG | |
33 | 34 | #include <stdio.h> |
34 | 35 | #include <commctrl.h> |
35 | 36 |
@@ -324,11 +325,13 @@ | ||
324 | 325 | SetWindowLongPtr(dlg, GWLP_WNDPROC, (LONG_PTR)data->OrigProc); |
325 | 326 | SetWindowLongPtr(dlg, GWLP_USERDATA, (LONG_PTR)data->OrigUser); |
326 | 327 | Result = CallWindowProc(data->OrigProc, dlg, msg, wParam, lParam); |
328 | + data->OrigProc = (WNDPROC)GetWindowLongPtr(dlg, GWLP_WNDPROC); | |
329 | + data->OrigUser = GetWindowLongPtr(dlg, GWLP_USERDATA); | |
327 | 330 | SetWindowLongPtr(dlg, GWLP_WNDPROC, (LONG_PTR)HostnameEditProc); |
328 | 331 | SetWindowLongPtr(dlg, GWLP_USERDATA, (LONG_PTR)data); |
329 | 332 | |
330 | 333 | switch (msg) { |
331 | - case WM_DESTROY: | |
334 | + case WM_NCDESTROY: | |
332 | 335 | SetWindowLongPtr(dlg, GWLP_WNDPROC, (LONG_PTR)data->OrigProc); |
333 | 336 | SetWindowLongPtr(dlg, GWLP_USERDATA, (LONG_PTR)data->OrigUser); |
334 | 337 | free(data); |
@@ -353,3 +356,20 @@ | ||
353 | 356 | SetWindowLongPtr(hWndEdit, GWL_WNDPROC, (LONG_PTR)HostnameEditProc); |
354 | 357 | SetWindowLongPtr(hWndEdit, GWLP_USERDATA, (LONG_PTR)data); |
355 | 358 | } |
359 | + | |
360 | +void SetDlgTexts(HWND hDlgWnd, const DlgTextInfo *infos, int infoCount, const char *UILanguageFile) | |
361 | +{ | |
362 | + for (int i = 0 ; i < infoCount; i++) { | |
363 | + char *key = infos[i].key; | |
364 | + char uimsg[MAX_UIMSG]; | |
365 | + get_lang_msg(key, uimsg, sizeof(uimsg), "", UILanguageFile); | |
366 | + if (uimsg[0] != '\0') { | |
367 | + const int nIDDlgItem = infos[i].nIDDlgItem; | |
368 | + if (nIDDlgItem == 0) { | |
369 | + SetWindowText(hDlgWnd, uimsg); | |
370 | + } else { | |
371 | + SetDlgItemText(hDlgWnd, nIDDlgItem, uimsg); | |
372 | + } | |
373 | + } | |
374 | + } | |
375 | +} |
@@ -44,6 +44,11 @@ | ||
44 | 44 | LONG GetCurSel(HWND HDlg, int Id_Item); |
45 | 45 | void InitDlgProgress(HWND HDlg, int id_Progress, int *CurProgStat); |
46 | 46 | void SetEditboxSubclass(HWND hDlg, int nID, BOOL ComboBox); |
47 | +typedef struct { | |
48 | + int nIDDlgItem; | |
49 | + char *key; | |
50 | +} DlgTextInfo; | |
51 | +void SetDlgTexts(HWND hDlgWnd, const DlgTextInfo *infos, int infoCount, const char *UILanguageFile); | |
47 | 52 | |
48 | 53 | #ifdef __cplusplus |
49 | 54 | } |
@@ -28,6 +28,7 @@ | ||
28 | 28 | */ |
29 | 29 | |
30 | 30 | /* Constants, types for file transfer */ |
31 | +#pragma once | |
31 | 32 | |
32 | 33 | /* GetSetupFname function id */ |
33 | 34 | #define GSF_SAVE 0 // Save setup |
@@ -28,6 +28,8 @@ | ||
28 | 28 | */ |
29 | 29 | |
30 | 30 | /* Constants and types for Tera Term */ |
31 | +#pragma once | |
32 | + | |
31 | 33 | #include <locale.h> |
32 | 34 | #include "teraterm.h" |
33 | 35 | #include "tt-version.h" |
@@ -37,14 +37,7 @@ | ||
37 | 37 | #include "i18n.h" |
38 | 38 | #include "ttlib.h" |
39 | 39 | #include "dlglib.h" |
40 | -#include "tttypes.h" // for ttwinman.h | |
41 | -#include "ttwinman.h" // for ts | |
42 | 40 | |
43 | -struct DlgTextInfo { | |
44 | - int nIDDlgItem; | |
45 | - char *key; | |
46 | -}; | |
47 | - | |
48 | 41 | struct DrapDropDlgParam { |
49 | 42 | const char *TargetFilename; |
50 | 43 | enum drop_type DropType; |
@@ -83,23 +76,6 @@ | ||
83 | 76 | return hNewFont; |
84 | 77 | } |
85 | 78 | |
86 | -static void SetDlgTexts(HWND hDlgWnd, const DlgTextInfo *infos, int infoCount, const char *UILanguageFile) | |
87 | -{ | |
88 | - for (int i = 0 ; i < infoCount; i++) { | |
89 | - char *key = infos[i].key; | |
90 | - char uimsg[MAX_UIMSG]; | |
91 | - get_lang_msg(key, uimsg, sizeof(uimsg), "", UILanguageFile); | |
92 | - if (uimsg[0] != '\0') { | |
93 | - const int nIDDlgItem = infos[i].nIDDlgItem; | |
94 | - if (nIDDlgItem == 0) { | |
95 | - SetWindowText(hDlgWnd, uimsg); | |
96 | - } else { | |
97 | - SetDlgItemText(hDlgWnd, nIDDlgItem, uimsg); | |
98 | - } | |
99 | - } | |
100 | - } | |
101 | -} | |
102 | - | |
103 | 79 | static LRESULT CALLBACK OnDragDropDlgProc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp) |
104 | 80 | { |
105 | 81 | static const int FontIDs[] = { |
@@ -132,13 +108,13 @@ | ||
132 | 108 | { IDOK, "BTN_OK" }, |
133 | 109 | { IDCANCEL, "BTN_CANCEL" }, |
134 | 110 | }; |
135 | - DrapDropDlgData *DlgData = (DrapDropDlgData *)GetWindowLongPtr(hDlgWnd, GWLP_USERDATA); | |
111 | + DrapDropDlgData *DlgData = (DrapDropDlgData *)GetWindowLongPtr(hDlgWnd, DWLP_USER); | |
136 | 112 | |
137 | 113 | switch (msg) { |
138 | 114 | case WM_INITDIALOG: |
139 | 115 | { |
140 | 116 | DlgData = (DrapDropDlgData *)malloc(sizeof(DrapDropDlgData)); |
141 | - SetWindowLongPtr(hDlgWnd, GWLP_USERDATA, (LONG_PTR)DlgData); | |
117 | + SetWindowLongPtr(hDlgWnd, DWLP_USER, (LONG_PTR)DlgData); | |
142 | 118 | DrapDropDlgParam *Param = (DrapDropDlgParam *)lp; |
143 | 119 | DlgData->Param = Param; |
144 | 120 | DlgData->hPrevFont = SetDlgFonts(hDlgWnd, FontIDs, _countof(FontIDs), Param->UILanguageFile, NULL); |
@@ -305,7 +281,7 @@ | ||
305 | 281 | int RemaingFileCount, |
306 | 282 | bool EnableSCP, |
307 | 283 | bool EnableSendFile, |
308 | - bool EnableDoNotShowDialog, | |
284 | + TTTSet *pts, | |
309 | 285 | unsigned char *DropTypePaste, |
310 | 286 | bool *DoSameProcess, |
311 | 287 | bool *DoSameProcessNextDrop, |
@@ -316,14 +292,15 @@ | ||
316 | 292 | Param.DropType = DefaultDropType; |
317 | 293 | Param.DropTypePaste = *DropTypePaste; |
318 | 294 | Param.ScpEnable = EnableSCP; |
319 | - Param.ScpSendDirPtr = ts.ScpSendDir; | |
320 | - Param.ScpSendDirSize = sizeof(ts.ScpSendDir); | |
321 | 295 | Param.SendfileEnable = EnableSendFile; |
322 | 296 | Param.PasteNewlineEnable = true; |
323 | 297 | Param.RemaingFileCount = RemaingFileCount; |
324 | 298 | Param.DoNotShowDialog = *DoNotShowDialog; |
325 | - Param.DoNotShowDialogEnable = EnableDoNotShowDialog; | |
326 | - Param.UILanguageFile = ts.UILanguageFile; | |
299 | + Param.DoNotShowDialogEnable = pts->ConfirmFileDragAndDrop ? false : true, | |
300 | + Param.ScpSendDirPtr = pts->ScpSendDir; | |
301 | + Param.ScpSendDirSize = _countof(pts->ScpSendDir); | |
302 | + Param.UILanguageFile = pts->UILanguageFile; | |
303 | + | |
327 | 304 | int ret = DialogBoxParam( |
328 | 305 | hInstance, MAKEINTRESOURCE(IDD_DAD_DIALOG), |
329 | 306 | hWndParent, (DLGPROC)OnDragDropDlgProc, |
@@ -27,6 +27,7 @@ | ||
27 | 27 | */ |
28 | 28 | |
29 | 29 | #include <windows.h> |
30 | +#include "tttypes.h" // for TTTSet | |
30 | 31 | |
31 | 32 | enum drop_type { |
32 | 33 | DROP_TYPE_CANCEL, |
@@ -46,7 +47,7 @@ | ||
46 | 47 | int RemaingFileCount, |
47 | 48 | bool EnableSCP, |
48 | 49 | bool EnableSendFile, |
49 | - bool EnableDoNotShowDialog, | |
50 | + TTTSet *pts, | |
50 | 51 | unsigned char *DropTypePaste, |
51 | 52 | bool *DoSameProcess, |
52 | 53 | bool *DoSameProcessNextDrop, |
@@ -2222,7 +2222,7 @@ | ||
2222 | 2222 | DropListCount - i, |
2223 | 2223 | (DirectoryCount == 0 && isSSH) ? true : false, |
2224 | 2224 | DirectoryCount == 0 ? true : false, |
2225 | - ts.ConfirmFileDragAndDrop ? false : true, | |
2225 | + &ts, | |
2226 | 2226 | &DropTypePaste, |
2227 | 2227 | &DoSameProcess, |
2228 | 2228 | &DoSameProcessNextDrop, |