• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision7172 (tree)
Time2018-08-05 19:49:00
Authorzmatsuo

Log Message

teraterm/common/dlglib.c,h dnddlgからSetDlgTexts()を移動
teraterm/common/ttftypes.h,tttypes.h に #pragma once 追加
teraterm/teraterm/dnddlg.cpp,vtwin 引数修正
teraterm/teraterm/dnddlg.cpp データ収納をGWLP_USERDATAからDWLP_USERに変更

Change Summary

Incremental Difference

--- trunk/teraterm/common/dlglib.c (revision 7171)
+++ trunk/teraterm/common/dlglib.c (revision 7172)
@@ -30,6 +30,7 @@
3030 /* Routines for dialog boxes */
3131 #include <windows.h>
3232 #include "dlglib.h"
33+#include "i18n.h" // for MAX_UIMSG
3334 #include <stdio.h>
3435 #include <commctrl.h>
3536
@@ -324,11 +325,13 @@
324325 SetWindowLongPtr(dlg, GWLP_WNDPROC, (LONG_PTR)data->OrigProc);
325326 SetWindowLongPtr(dlg, GWLP_USERDATA, (LONG_PTR)data->OrigUser);
326327 Result = CallWindowProc(data->OrigProc, dlg, msg, wParam, lParam);
328+ data->OrigProc = (WNDPROC)GetWindowLongPtr(dlg, GWLP_WNDPROC);
329+ data->OrigUser = GetWindowLongPtr(dlg, GWLP_USERDATA);
327330 SetWindowLongPtr(dlg, GWLP_WNDPROC, (LONG_PTR)HostnameEditProc);
328331 SetWindowLongPtr(dlg, GWLP_USERDATA, (LONG_PTR)data);
329332
330333 switch (msg) {
331- case WM_DESTROY:
334+ case WM_NCDESTROY:
332335 SetWindowLongPtr(dlg, GWLP_WNDPROC, (LONG_PTR)data->OrigProc);
333336 SetWindowLongPtr(dlg, GWLP_USERDATA, (LONG_PTR)data->OrigUser);
334337 free(data);
@@ -353,3 +356,20 @@
353356 SetWindowLongPtr(hWndEdit, GWL_WNDPROC, (LONG_PTR)HostnameEditProc);
354357 SetWindowLongPtr(hWndEdit, GWLP_USERDATA, (LONG_PTR)data);
355358 }
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+}
--- trunk/teraterm/common/dlglib.h (revision 7171)
+++ trunk/teraterm/common/dlglib.h (revision 7172)
@@ -44,6 +44,11 @@
4444 LONG GetCurSel(HWND HDlg, int Id_Item);
4545 void InitDlgProgress(HWND HDlg, int id_Progress, int *CurProgStat);
4646 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);
4752
4853 #ifdef __cplusplus
4954 }
--- trunk/teraterm/common/ttftypes.h (revision 7171)
+++ trunk/teraterm/common/ttftypes.h (revision 7172)
@@ -28,6 +28,7 @@
2828 */
2929
3030 /* Constants, types for file transfer */
31+#pragma once
3132
3233 /* GetSetupFname function id */
3334 #define GSF_SAVE 0 // Save setup
--- trunk/teraterm/common/tttypes.h (revision 7171)
+++ trunk/teraterm/common/tttypes.h (revision 7172)
@@ -28,6 +28,8 @@
2828 */
2929
3030 /* Constants and types for Tera Term */
31+#pragma once
32+
3133 #include <locale.h>
3234 #include "teraterm.h"
3335 #include "tt-version.h"
--- trunk/teraterm/teraterm/dnddlg.cpp (revision 7171)
+++ trunk/teraterm/teraterm/dnddlg.cpp (revision 7172)
@@ -37,14 +37,7 @@
3737 #include "i18n.h"
3838 #include "ttlib.h"
3939 #include "dlglib.h"
40-#include "tttypes.h" // for ttwinman.h
41-#include "ttwinman.h" // for ts
4240
43-struct DlgTextInfo {
44- int nIDDlgItem;
45- char *key;
46-};
47-
4841 struct DrapDropDlgParam {
4942 const char *TargetFilename;
5043 enum drop_type DropType;
@@ -83,23 +76,6 @@
8376 return hNewFont;
8477 }
8578
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-
10379 static LRESULT CALLBACK OnDragDropDlgProc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp)
10480 {
10581 static const int FontIDs[] = {
@@ -132,13 +108,13 @@
132108 { IDOK, "BTN_OK" },
133109 { IDCANCEL, "BTN_CANCEL" },
134110 };
135- DrapDropDlgData *DlgData = (DrapDropDlgData *)GetWindowLongPtr(hDlgWnd, GWLP_USERDATA);
111+ DrapDropDlgData *DlgData = (DrapDropDlgData *)GetWindowLongPtr(hDlgWnd, DWLP_USER);
136112
137113 switch (msg) {
138114 case WM_INITDIALOG:
139115 {
140116 DlgData = (DrapDropDlgData *)malloc(sizeof(DrapDropDlgData));
141- SetWindowLongPtr(hDlgWnd, GWLP_USERDATA, (LONG_PTR)DlgData);
117+ SetWindowLongPtr(hDlgWnd, DWLP_USER, (LONG_PTR)DlgData);
142118 DrapDropDlgParam *Param = (DrapDropDlgParam *)lp;
143119 DlgData->Param = Param;
144120 DlgData->hPrevFont = SetDlgFonts(hDlgWnd, FontIDs, _countof(FontIDs), Param->UILanguageFile, NULL);
@@ -305,7 +281,7 @@
305281 int RemaingFileCount,
306282 bool EnableSCP,
307283 bool EnableSendFile,
308- bool EnableDoNotShowDialog,
284+ TTTSet *pts,
309285 unsigned char *DropTypePaste,
310286 bool *DoSameProcess,
311287 bool *DoSameProcessNextDrop,
@@ -316,14 +292,15 @@
316292 Param.DropType = DefaultDropType;
317293 Param.DropTypePaste = *DropTypePaste;
318294 Param.ScpEnable = EnableSCP;
319- Param.ScpSendDirPtr = ts.ScpSendDir;
320- Param.ScpSendDirSize = sizeof(ts.ScpSendDir);
321295 Param.SendfileEnable = EnableSendFile;
322296 Param.PasteNewlineEnable = true;
323297 Param.RemaingFileCount = RemaingFileCount;
324298 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+
327304 int ret = DialogBoxParam(
328305 hInstance, MAKEINTRESOURCE(IDD_DAD_DIALOG),
329306 hWndParent, (DLGPROC)OnDragDropDlgProc,
--- trunk/teraterm/teraterm/dnddlg.h (revision 7171)
+++ trunk/teraterm/teraterm/dnddlg.h (revision 7172)
@@ -27,6 +27,7 @@
2727 */
2828
2929 #include <windows.h>
30+#include "tttypes.h" // for TTTSet
3031
3132 enum drop_type {
3233 DROP_TYPE_CANCEL,
@@ -46,7 +47,7 @@
4647 int RemaingFileCount,
4748 bool EnableSCP,
4849 bool EnableSendFile,
49- bool EnableDoNotShowDialog,
50+ TTTSet *pts,
5051 unsigned char *DropTypePaste,
5152 bool *DoSameProcess,
5253 bool *DoSameProcessNextDrop,
--- trunk/teraterm/teraterm/vtwin.cpp (revision 7171)
+++ trunk/teraterm/teraterm/vtwin.cpp (revision 7172)
@@ -2222,7 +2222,7 @@
22222222 DropListCount - i,
22232223 (DirectoryCount == 0 && isSSH) ? true : false,
22242224 DirectoryCount == 0 ? true : false,
2225- ts.ConfirmFileDragAndDrop ? false : true,
2225+ &ts,
22262226 &DropTypePaste,
22272227 &DoSameProcess,
22282228 &DoSameProcessNextDrop,
Show on old repository browser