[Ttssh2-commit] [7172] teraterm/common/dlglib.c, h dnddlgからSetDlgTexts () を移動

Back to archive index

scmno****@osdn***** scmno****@osdn*****
2018年 8月 5日 (日) 19:49:01 JST


Revision: 7172
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/7172
Author:   zmatsuo
Date:     2018-08-05 19:49:00 +0900 (Sun, 05 Aug 2018)
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に変更

Modified Paths:
--------------
    trunk/teraterm/common/dlglib.c
    trunk/teraterm/common/dlglib.h
    trunk/teraterm/common/ttftypes.h
    trunk/teraterm/common/tttypes.h
    trunk/teraterm/teraterm/dnddlg.cpp
    trunk/teraterm/teraterm/dnddlg.h
    trunk/teraterm/teraterm/vtwin.cpp

-------------- next part --------------
Modified: trunk/teraterm/common/dlglib.c
===================================================================
--- trunk/teraterm/common/dlglib.c	2018-07-31 15:28:11 UTC (rev 7171)
+++ trunk/teraterm/common/dlglib.c	2018-08-05 10:49:00 UTC (rev 7172)
@@ -30,6 +30,7 @@
 /* Routines for dialog boxes */
 #include <windows.h>
 #include "dlglib.h"
+#include "i18n.h"		// for MAX_UIMSG
 #include <stdio.h>
 #include <commctrl.h>
 
@@ -324,11 +325,13 @@
 	SetWindowLongPtr(dlg, GWLP_WNDPROC, (LONG_PTR)data->OrigProc);
 	SetWindowLongPtr(dlg, GWLP_USERDATA, (LONG_PTR)data->OrigUser);
 	Result = CallWindowProc(data->OrigProc, dlg, msg, wParam, lParam);
+	data->OrigProc = (WNDPROC)GetWindowLongPtr(dlg, GWLP_WNDPROC);
+	data->OrigUser = GetWindowLongPtr(dlg, GWLP_USERDATA);
 	SetWindowLongPtr(dlg, GWLP_WNDPROC, (LONG_PTR)HostnameEditProc);
 	SetWindowLongPtr(dlg, GWLP_USERDATA, (LONG_PTR)data);
 
 	switch (msg) {
-		case WM_DESTROY:
+		case WM_NCDESTROY:
 			SetWindowLongPtr(dlg, GWLP_WNDPROC, (LONG_PTR)data->OrigProc);
 			SetWindowLongPtr(dlg, GWLP_USERDATA, (LONG_PTR)data->OrigUser);
 			free(data);
@@ -353,3 +356,20 @@
 	SetWindowLongPtr(hWndEdit, GWL_WNDPROC, (LONG_PTR)HostnameEditProc);
 	SetWindowLongPtr(hWndEdit, GWLP_USERDATA, (LONG_PTR)data);
 }
+
+void SetDlgTexts(HWND hDlgWnd, const DlgTextInfo *infos, int infoCount, const char *UILanguageFile)
+{
+	for (int i = 0 ; i < infoCount; i++) {
+		char *key = infos[i].key;
+		char uimsg[MAX_UIMSG];
+		get_lang_msg(key, uimsg, sizeof(uimsg), "", UILanguageFile);
+		if (uimsg[0] != '\0') {
+			const int nIDDlgItem = infos[i].nIDDlgItem;
+			if (nIDDlgItem == 0) {
+				SetWindowText(hDlgWnd, uimsg);
+			} else {
+				SetDlgItemText(hDlgWnd, nIDDlgItem, uimsg);
+			}
+		}
+	}
+}

Modified: trunk/teraterm/common/dlglib.h
===================================================================
--- trunk/teraterm/common/dlglib.h	2018-07-31 15:28:11 UTC (rev 7171)
+++ trunk/teraterm/common/dlglib.h	2018-08-05 10:49:00 UTC (rev 7172)
@@ -44,6 +44,11 @@
 LONG GetCurSel(HWND HDlg, int Id_Item);
 void InitDlgProgress(HWND HDlg, int id_Progress, int *CurProgStat);
 void SetEditboxSubclass(HWND hDlg, int nID, BOOL ComboBox);
+typedef struct {
+	int nIDDlgItem;
+	char *key;
+} DlgTextInfo;
+void SetDlgTexts(HWND hDlgWnd, const DlgTextInfo *infos, int infoCount, const char *UILanguageFile);
 
 #ifdef __cplusplus
 }

Modified: trunk/teraterm/common/ttftypes.h
===================================================================
--- trunk/teraterm/common/ttftypes.h	2018-07-31 15:28:11 UTC (rev 7171)
+++ trunk/teraterm/common/ttftypes.h	2018-08-05 10:49:00 UTC (rev 7172)
@@ -28,6 +28,7 @@
  */
 
 /* Constants, types for file transfer */
+#pragma once
 
 /* GetSetupFname function id */
 #define GSF_SAVE	0 // Save setup

Modified: trunk/teraterm/common/tttypes.h
===================================================================
--- trunk/teraterm/common/tttypes.h	2018-07-31 15:28:11 UTC (rev 7171)
+++ trunk/teraterm/common/tttypes.h	2018-08-05 10:49:00 UTC (rev 7172)
@@ -28,6 +28,8 @@
  */
 
 /* Constants and types for Tera Term */
+#pragma once
+
 #include <locale.h>
 #include "teraterm.h"
 #include "tt-version.h"

Modified: trunk/teraterm/teraterm/dnddlg.cpp
===================================================================
--- trunk/teraterm/teraterm/dnddlg.cpp	2018-07-31 15:28:11 UTC (rev 7171)
+++ trunk/teraterm/teraterm/dnddlg.cpp	2018-08-05 10:49:00 UTC (rev 7172)
@@ -37,14 +37,7 @@
 #include "i18n.h"
 #include "ttlib.h"
 #include "dlglib.h"
-#include "tttypes.h"	// for ttwinman.h
-#include "ttwinman.h"	// for ts
 
-struct DlgTextInfo {
-	int nIDDlgItem;
-	char *key;
-};
-
 struct DrapDropDlgParam {
 	const char *TargetFilename;
 	enum drop_type DropType;
@@ -83,23 +76,6 @@
 	return hNewFont;
 }
 
-static void SetDlgTexts(HWND hDlgWnd, const DlgTextInfo *infos, int infoCount, const char *UILanguageFile)
-{
-	for (int i = 0 ; i < infoCount; i++) {
-		char *key = infos[i].key;
-		char uimsg[MAX_UIMSG];
-		get_lang_msg(key, uimsg, sizeof(uimsg), "", UILanguageFile);
-		if (uimsg[0] != '\0') {
-			const int nIDDlgItem = infos[i].nIDDlgItem;
-			if (nIDDlgItem == 0) {
-				SetWindowText(hDlgWnd, uimsg);
-			} else {
-				SetDlgItemText(hDlgWnd, nIDDlgItem, uimsg);
-			}
-		}
-	}
-}
-
 static LRESULT CALLBACK OnDragDropDlgProc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp)
 {
 	static const int FontIDs[] = {
@@ -132,13 +108,13 @@
 		{ IDOK, "BTN_OK" },
 		{ IDCANCEL, "BTN_CANCEL" },
 	};
-	DrapDropDlgData *DlgData = (DrapDropDlgData *)GetWindowLongPtr(hDlgWnd, GWLP_USERDATA);
+	DrapDropDlgData *DlgData = (DrapDropDlgData *)GetWindowLongPtr(hDlgWnd, DWLP_USER);
 
 	switch (msg) {
 	case WM_INITDIALOG:
 	{
 		DlgData = (DrapDropDlgData *)malloc(sizeof(DrapDropDlgData));
-		SetWindowLongPtr(hDlgWnd, GWLP_USERDATA, (LONG_PTR)DlgData);
+		SetWindowLongPtr(hDlgWnd, DWLP_USER, (LONG_PTR)DlgData);
 		DrapDropDlgParam *Param = (DrapDropDlgParam *)lp;
 		DlgData->Param = Param;
 		DlgData->hPrevFont = SetDlgFonts(hDlgWnd, FontIDs, _countof(FontIDs), Param->UILanguageFile, NULL);
@@ -305,7 +281,7 @@
 	int RemaingFileCount,
 	bool EnableSCP,
 	bool EnableSendFile,
-	bool EnableDoNotShowDialog,
+	TTTSet *pts,
 	unsigned char *DropTypePaste,
 	bool *DoSameProcess,
 	bool *DoSameProcessNextDrop,
@@ -316,14 +292,15 @@
 	Param.DropType = DefaultDropType;
 	Param.DropTypePaste = *DropTypePaste;
 	Param.ScpEnable = EnableSCP;
-	Param.ScpSendDirPtr = ts.ScpSendDir;
-	Param.ScpSendDirSize = sizeof(ts.ScpSendDir);
 	Param.SendfileEnable = EnableSendFile;
 	Param.PasteNewlineEnable = true;
 	Param.RemaingFileCount = RemaingFileCount;
 	Param.DoNotShowDialog = *DoNotShowDialog;
-	Param.DoNotShowDialogEnable = EnableDoNotShowDialog;
-	Param.UILanguageFile = ts.UILanguageFile;
+	Param.DoNotShowDialogEnable = pts->ConfirmFileDragAndDrop ? false : true,
+	Param.ScpSendDirPtr = pts->ScpSendDir;
+	Param.ScpSendDirSize = _countof(pts->ScpSendDir);
+	Param.UILanguageFile = pts->UILanguageFile;
+
 	int ret = DialogBoxParam(
 		hInstance, MAKEINTRESOURCE(IDD_DAD_DIALOG),
 		hWndParent, (DLGPROC)OnDragDropDlgProc,

Modified: trunk/teraterm/teraterm/dnddlg.h
===================================================================
--- trunk/teraterm/teraterm/dnddlg.h	2018-07-31 15:28:11 UTC (rev 7171)
+++ trunk/teraterm/teraterm/dnddlg.h	2018-08-05 10:49:00 UTC (rev 7172)
@@ -27,6 +27,7 @@
  */
 
 #include <windows.h>
+#include "tttypes.h"	// for TTTSet
 
 enum drop_type {
 	DROP_TYPE_CANCEL,
@@ -46,7 +47,7 @@
 	int RemaingFileCount,
 	bool EnableSCP,
 	bool EnableSendFile,
-	bool EnableDoNotShowDialog,
+	TTTSet *pts,
 	unsigned char *DropTypePaste,
 	bool *DoSameProcess,
 	bool *DoSameProcessNextDrop,

Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2018-07-31 15:28:11 UTC (rev 7171)
+++ trunk/teraterm/teraterm/vtwin.cpp	2018-08-05 10:49:00 UTC (rev 7172)
@@ -2222,7 +2222,7 @@
 								  DropListCount - i,
 								  (DirectoryCount == 0 && isSSH) ? true : false,
 								  DirectoryCount == 0 ? true : false,
-								  ts.ConfirmFileDragAndDrop ? false : true,
+								  &ts,
 								  &DropTypePaste,
 								  &DoSameProcess,
 								  &DoSameProcessNextDrop,



Ttssh2-commit メーリングリストの案内
Back to archive index