[Ttssh2-commit] [7228] CMakeLists.txt deffile関連調整

scmno****@osdn***** scmno****@osdn*****
2018年 9月 3日 (月) 20:02:33 JST


Revision: 7228
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/7228
Author:   zmatsuo
Date:     2018-09-03 20:02:33 +0900 (Mon, 03 Sep 2018)
Log Message:
-----------
CMakeLists.txt deffile関連調整
GetDpiForWindow()サポート
vtwinでWM_DPICHANGEDに対応
tmfcを少し整理
不要リソースファイル削除

Modified Paths:
--------------
    branches/cmake/CMakeLists.txt
    branches/cmake/TTXKanjiMenu/ttxkanjimenu.rc
    branches/cmake/teraterm/common/compat_win.cpp
    branches/cmake/teraterm/common/compat_win.h
    branches/cmake/teraterm/teraterm/CMakeLists.txt
    branches/cmake/teraterm/teraterm/commlib.h
    branches/cmake/teraterm/teraterm/tekwin.h
    branches/cmake/teraterm/teraterm/tmfc.h
    branches/cmake/teraterm/teraterm/vtdisp.c
    branches/cmake/teraterm/teraterm/vtdisp.h
    branches/cmake/teraterm/teraterm/vtwin.cpp
    branches/cmake/teraterm/teraterm/vtwin.h
    branches/cmake/teraterm/ttpcmn/CMakeLists.txt
    branches/cmake/teraterm/ttpset/ttpset.rc
    branches/cmake/teraterm/ttptek/CMakeLists.txt
    branches/cmake/ttpmenu/ttpmenu.rc
    branches/cmake/ttssh2/ttxssh/ttxssh.rc

Added Paths:
-----------
    branches/cmake/teraterm/teraterm/tmfc_frame.cpp

Removed Paths:
-------------
    branches/cmake/teraterm/common/afxres.h
    branches/cmake/teraterm/teraterm/tekwin_sub.cpp
    branches/cmake/teraterm/teraterm/tekwin_sub.h
    branches/cmake/teraterm/ttpcmn/ttpcmn.rc
    branches/cmake/teraterm/ttptek/ttptek.rc

-------------- next part --------------
Modified: branches/cmake/CMakeLists.txt
===================================================================
--- branches/cmake/CMakeLists.txt	2018-09-03 10:52:11 UTC (rev 7227)
+++ branches/cmake/CMakeLists.txt	2018-09-03 11:02:33 UTC (rev 7228)
@@ -8,12 +8,12 @@
 option(ENABLE_TTXSAMPLES "TTXSamples" ON)
 
 set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
-string(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
-string(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
-string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
-string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
 
 if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
+  string(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
+  string(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
+  string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
+  string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_CRT_SECURE_NO_DEPRECATE /W3")
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D_CRT_SECURE_NO_DEPRECATE /W3")
   # _WIN32_WINNT_WIN10 0x0A00
@@ -23,6 +23,10 @@
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
   endif()
+elseif(MINGW)
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__MINGW_USE_VC2005_COMPAT=1")
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__MINGW_USE_VC2005_COMPAT=1")
+#  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lmsvcr80")
 endif()
 
 add_subdirectory(teraterm)

Modified: branches/cmake/TTXKanjiMenu/ttxkanjimenu.rc
===================================================================
--- branches/cmake/TTXKanjiMenu/ttxkanjimenu.rc	2018-09-03 10:52:11 UTC (rev 7227)
+++ branches/cmake/TTXKanjiMenu/ttxkanjimenu.rc	2018-09-03 11:02:33 UTC (rev 7228)
@@ -7,7 +7,7 @@
 //
 // Generated from the TEXTINCLUDE 2 resource.
 //
-#include "afxres.h"
+//#include "afxres.h"
 
 /////////////////////////////////////////////////////////////////////////////
 #undef APSTUDIO_READONLY_SYMBOLS
@@ -17,7 +17,7 @@
 
 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
 #ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+//LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 #pragma code_page(1252)
 #endif //_WIN32
 

Deleted: branches/cmake/teraterm/common/afxres.h
===================================================================
--- branches/cmake/teraterm/common/afxres.h	2018-09-03 10:52:11 UTC (rev 7227)
+++ branches/cmake/teraterm/common/afxres.h	2018-09-03 11:02:33 UTC (rev 7228)
@@ -1,9 +0,0 @@
-
-//#include <winres.h>
-
-#define VS_VERSION_INFO 1
-
-#include <winresrc.h>
-
-
-

Modified: branches/cmake/teraterm/common/compat_win.cpp
===================================================================
--- branches/cmake/teraterm/common/compat_win.cpp	2018-09-03 10:52:11 UTC (rev 7227)
+++ branches/cmake/teraterm/common/compat_win.cpp	2018-09-03 11:02:33 UTC (rev 7228)
@@ -2,6 +2,7 @@
 #include "compat_win.h"
 
 TSetThreadDpiAwarenessContext PSetThreadDpiAwarenessContext;
+TGetDpiForWindow PGetDpiForWindow;
 
 void WinCompatInit()
 {
@@ -17,4 +18,7 @@
 	PSetThreadDpiAwarenessContext =
 		(TSetThreadDpiAwarenessContext)
 		GetProcAddress(dll_handle, "SetThreadDpiAwarenessContext");
+	PGetDpiForWindow =
+		(TGetDpiForWindow)
+		GetProcAddress(dll_handle, "GetDpiForWindow");
 }

Modified: branches/cmake/teraterm/common/compat_win.h
===================================================================
--- branches/cmake/teraterm/common/compat_win.h	2018-09-03 10:52:11 UTC (rev 7227)
+++ branches/cmake/teraterm/common/compat_win.h	2018-09-03 11:02:33 UTC (rev 7228)
@@ -1,7 +1,9 @@
 
 #include <windows.h>
 
+#ifdef __cplusplus
 extern "C" {
+#endif
 
 #if !defined(DPI_AWARENESS_CONTEXT_SYSTEM_AWARE)
 #define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE          ((DPI_AWARENESS_CONTEXT)-2)
@@ -18,7 +20,11 @@
 	(DPI_AWARENESS_CONTEXT dpiContext);
 extern TSetThreadDpiAwarenessContext PSetThreadDpiAwarenessContext;
 
+typedef UINT (WINAPI *TGetDpiForWindow)(HWND hwnd);
+extern TGetDpiForWindow PGetDpiForWindow;
+
 void WinCompatInit();
 
-
+#ifdef __cplusplus
 }
+#endif

Modified: branches/cmake/teraterm/teraterm/CMakeLists.txt
===================================================================
--- branches/cmake/teraterm/teraterm/CMakeLists.txt	2018-09-03 10:52:11 UTC (rev 7227)
+++ branches/cmake/teraterm/teraterm/CMakeLists.txt	2018-09-03 11:02:33 UTC (rev 7228)
@@ -42,10 +42,12 @@
   )
 
 set(SRC
+  tmfc.h
+  tmfc.cpp
+  tmfc_frame.cpp
+  #
   addsetting.cpp
   addsetting.h
-  tmfc.cpp
-  tmfc.h
   buffer.c
   buffer.h
   clipboar.c
@@ -70,8 +72,6 @@
   teklib.h
   tekwin.cpp
   tekwin.h
-  tekwin_sub.cpp
-  tekwin_sub.h
   telnet.c
   telnet.h
   teraapp.h

Modified: branches/cmake/teraterm/teraterm/commlib.h
===================================================================
--- branches/cmake/teraterm/teraterm/commlib.h	2018-09-03 10:52:11 UTC (rev 7227)
+++ branches/cmake/teraterm/teraterm/commlib.h	2018-09-03 11:02:33 UTC (rev 7228)
@@ -34,11 +34,7 @@
 
 void CommInit(PComVar cv);
 void CommOpen(HWND HW, PTTSet ts, PComVar cv);
-#ifndef NO_I18N
 void CommStart(PComVar cv, LONG lParam, PTTSet ts);
-#else
-void CommStart(PComVar cv, LONG lParam);
-#endif
 BOOL CommCanClose(PComVar cv);
 void CommClose(PComVar cv);
 void CommProcRRQ(PComVar cv);

Modified: branches/cmake/teraterm/teraterm/tekwin.h
===================================================================
--- branches/cmake/teraterm/teraterm/tekwin.h	2018-09-03 10:52:11 UTC (rev 7227)
+++ branches/cmake/teraterm/teraterm/tekwin.h	2018-09-03 11:02:33 UTC (rev 7228)
@@ -31,17 +31,13 @@
 
 /////////////////////////////////////////////////////////////////////////////
 // CTEKWindow
-#include "tekwin_sub.h"
+#include "tmfc.h"
 class CTEKWindow : public TTCFrameWnd
 {
 private:
   TTEKVar tk;
-#ifndef NO_I18N
   HMENU MainMenu, EditMenu, WinMenu,
     FileMenu, SetupMenu, HelpMenu;
-#else
-  HMENU MainMenu, EditMenu, WinMenu;
-#endif
 
 public:
 	CTEKWindow();

Deleted: branches/cmake/teraterm/teraterm/tekwin_sub.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/tekwin_sub.cpp	2018-09-03 10:52:11 UTC (rev 7227)
+++ branches/cmake/teraterm/teraterm/tekwin_sub.cpp	2018-09-03 11:02:33 UTC (rev 7228)
@@ -1,127 +0,0 @@
-
-#include "tekwin_sub.h"
-#include "ttlib.h"
-
-const RECT TTCFrameWnd::rectDefault =
-{
-	CW_USEDEFAULT, CW_USEDEFAULT,
-//	2*CW_USEDEFAULT, 2*CW_USEDEFAULT
-	0, 0
-};
-
-TTCFrameWnd::TTCFrameWnd()
-{
-}
-
-TTCFrameWnd::~TTCFrameWnd()
-{
-}
-
-BOOL TTCFrameWnd::Create(
-	HINSTANCE hInstance,
-	LPCTSTR lpszClassName,
-	LPCTSTR lpszWindowName,
-	DWORD dwStyle,
-	const RECT& rect,
-	HWND hParentWnd,
-	LPCTSTR lpszMenuName,
-	DWORD dwExStyle)
-{
-	pseudoPtr = this;
-	DWORD s = WS_OVERLAPPEDWINDOW;
-	HWND hWnd = ::CreateWindowExA(
-		0,
-		lpszClassName,
-		lpszWindowName,
-		dwStyle,
-		rect.left, rect.top,
-		rect.right - rect.left, rect.bottom - rect.top,
-		hParentWnd,
-		NULL,
-		hInstance,
-		NULL);
-	pseudoPtr = NULL;
-	if (hWnd == NULL) {
-		OutputDebugPrintf("CreateWindow %d\n", GetLastError());
-		return FALSE;
-	} else {
-		m_hWnd = hWnd;
-		SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)this);
-		return TRUE;
-	}
-}
-
-TTCFrameWnd *TTCFrameWnd::pseudoPtr;
-
-LRESULT TTCFrameWnd::ProcStub(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
-{
-	TTCFrameWnd *self;
-	if (pseudoPtr != NULL) {
-		self = pseudoPtr;
-		self->m_hWnd = hWnd;
-	} else {
-		self = (TTCFrameWnd *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
-	}
-	return self->Proc(msg, wp, lp);
-}
-
-LRESULT TTCFrameWnd::Proc(UINT msg, WPARAM wp, LPARAM lp)
-{
-	return DefWindowProc(msg, wp, lp);
-}
-
-BOOL TTCFrameWnd::OnCommand(WPARAM wParam, LPARAM lParam)
-{
-	return FALSE;
-}
-
-void TTCFrameWnd::OnInitMenuPopup(TTCMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
-{}
-
-void TTCFrameWnd::OnKillFocus(HWND hNewWnd)
-{}
-
-void TTCFrameWnd::OnDestroy()
-{}
-
-void TTCFrameWnd::OnSetFocus(HWND hOldWnd)
-{}
-
-void TTCFrameWnd::OnSysCommand(UINT nID, LPARAM lParam)
-{}
-
-void TTCFrameWnd::OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
-{
-	TTCFrameWnd::Proc(WM_SYSKEYDOWN, (WPARAM)nChar, MAKELONG(nRepCnt, nFlags));
-}
-
-void TTCFrameWnd::OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
-{
-	TTCFrameWnd::Proc(WM_SYSKEYUP, (WPARAM)nChar, MAKELONG(nRepCnt, nFlags));
-}
-
-void TTCFrameWnd::OnClose()
-{}
-
-
-////////////////////////////////////////
-
-void TTCWnd::DestroyWindow()
-{
-	::DestroyWindow(m_hWnd);
-}
-
-HDC TTCWnd::BeginPaint(LPPAINTSTRUCT lpPaint)
-{
-	return ::BeginPaint(m_hWnd, lpPaint);
-}
-
-BOOL TTCWnd::EndPaint(LPPAINTSTRUCT lpPaint)
-{
-	return ::EndPaint(m_hWnd, lpPaint);
-}
-
-LRESULT TTCWnd::DefWindowProc(UINT msg, WPARAM wParam, LPARAM lParam)
-{
-	return ::DefWindowProc(m_hWnd, msg, wParam, lParam);
-}

Deleted: branches/cmake/teraterm/teraterm/tekwin_sub.h
===================================================================
--- branches/cmake/teraterm/teraterm/tekwin_sub.h	2018-09-03 10:52:11 UTC (rev 7227)
+++ branches/cmake/teraterm/teraterm/tekwin_sub.h	2018-09-03 11:02:33 UTC (rev 7228)
@@ -1,51 +0,0 @@
-
-#pragma once
-
-#include <windows.h>
-#include "tmfc.h"
-
-class TTCMenu
-{
-public:
-	HMENU m_hMenu;
-};
-
-class TTCFrameWnd : public TTCWnd
-{
-public:
-	TTCFrameWnd();
-	virtual ~TTCFrameWnd();
-	static TTCFrameWnd *pseudoPtr;
-	static LRESULT ProcStub(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
-	virtual BOOL Create(HINSTANCE hInstance,
-						LPCTSTR lpszClassName,
-						LPCTSTR lpszWindowName,
-						DWORD dwStyle = WS_OVERLAPPEDWINDOW,
-						const RECT& rect = rectDefault,
-						HWND pParentWnd = NULL,        // != NULL for popups
-						LPCTSTR lpszMenuName = NULL,
-						DWORD dwExStyle = 0);//,
-						//CCreateContext* pContext = NULL);
-	virtual LRESULT Proc(UINT msg, WPARAM wp, LPARAM lp);
-	static const RECT rectDefault;
-	///
-	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
-	///
-#if 1
-	void OnInitMenuPopup(TTCMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
-	void OnKillFocus(HWND hNewWnd);
-	void OnDestroy();
-	void OnSetFocus(HWND hOldWnd);
-	void OnSysCommand(UINT nID, LPARAM lParam);
-	void OnClose();
-#endif
-	void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
-	void OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
-};
-
-class TTCPoint {
-public:
-	int x;
-	int y;
-};
-

Modified: branches/cmake/teraterm/teraterm/tmfc.h
===================================================================
--- branches/cmake/teraterm/teraterm/tmfc.h	2018-09-03 10:52:11 UTC (rev 7227)
+++ branches/cmake/teraterm/teraterm/tmfc.h	2018-09-03 11:02:33 UTC (rev 7228)
@@ -32,6 +32,18 @@
 #pragma once
 #include <windows.h>
 
+class TTCMenu
+{
+public:
+	HMENU m_hMenu;
+};
+
+class TTCPoint {
+public:
+	int x;
+	int y;
+};
+
 class TTCWnd
 {
 public:
@@ -64,6 +76,39 @@
 	int MessageBox(LPCTSTR lpText, LPCTSTR lpCaption, UINT uType);
 };
 
+class TTCFrameWnd : public TTCWnd
+{
+public:
+	TTCFrameWnd();
+	virtual ~TTCFrameWnd();
+	static TTCFrameWnd *pseudoPtr;
+	static LRESULT ProcStub(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
+	virtual BOOL Create(HINSTANCE hInstance,
+						LPCTSTR lpszClassName,
+						LPCTSTR lpszWindowName,
+						DWORD dwStyle = WS_OVERLAPPEDWINDOW,
+						const RECT& rect = rectDefault,
+						HWND pParentWnd = NULL,        // != NULL for popups
+						LPCTSTR lpszMenuName = NULL,
+						DWORD dwExStyle = 0);//,
+						//CCreateContext* pContext = NULL);
+	virtual LRESULT Proc(UINT msg, WPARAM wp, LPARAM lp);
+	static const RECT rectDefault;
+	///
+	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
+	///
+#if 1
+	void OnInitMenuPopup(TTCMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
+	void OnKillFocus(HWND hNewWnd);
+	void OnDestroy();
+	void OnSetFocus(HWND hOldWnd);
+	void OnSysCommand(UINT nID, LPARAM lParam);
+	void OnClose();
+#endif
+	void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+	void OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
+};
+
 class TTCDialog : public TTCWnd
 {
 public:

Copied: branches/cmake/teraterm/teraterm/tmfc_frame.cpp (from rev 7227, branches/cmake/teraterm/teraterm/tekwin_sub.cpp)
===================================================================
--- branches/cmake/teraterm/teraterm/tmfc_frame.cpp	                        (rev 0)
+++ branches/cmake/teraterm/teraterm/tmfc_frame.cpp	2018-09-03 11:02:33 UTC (rev 7228)
@@ -0,0 +1,127 @@
+
+#include "tmfc.h"
+#include "ttlib.h"
+
+const RECT TTCFrameWnd::rectDefault =
+{
+	CW_USEDEFAULT, CW_USEDEFAULT,
+//	2*CW_USEDEFAULT, 2*CW_USEDEFAULT
+	0, 0
+};
+
+TTCFrameWnd::TTCFrameWnd()
+{
+}
+
+TTCFrameWnd::~TTCFrameWnd()
+{
+}
+
+BOOL TTCFrameWnd::Create(
+	HINSTANCE hInstance,
+	LPCTSTR lpszClassName,
+	LPCTSTR lpszWindowName,
+	DWORD dwStyle,
+	const RECT& rect,
+	HWND hParentWnd,
+	LPCTSTR lpszMenuName,
+	DWORD dwExStyle)
+{
+	pseudoPtr = this;
+	DWORD s = WS_OVERLAPPEDWINDOW;
+	HWND hWnd = ::CreateWindowExA(
+		0,
+		lpszClassName,
+		lpszWindowName,
+		dwStyle,
+		rect.left, rect.top,
+		rect.right - rect.left, rect.bottom - rect.top,
+		hParentWnd,
+		NULL,
+		hInstance,
+		NULL);
+	pseudoPtr = NULL;
+	if (hWnd == NULL) {
+		OutputDebugPrintf("CreateWindow %d\n", GetLastError());
+		return FALSE;
+	} else {
+		m_hWnd = hWnd;
+		SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)this);
+		return TRUE;
+	}
+}
+
+TTCFrameWnd *TTCFrameWnd::pseudoPtr;
+
+LRESULT TTCFrameWnd::ProcStub(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
+{
+	TTCFrameWnd *self;
+	if (pseudoPtr != NULL) {
+		self = pseudoPtr;
+		self->m_hWnd = hWnd;
+	} else {
+		self = (TTCFrameWnd *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
+	}
+	return self->Proc(msg, wp, lp);
+}
+
+LRESULT TTCFrameWnd::Proc(UINT msg, WPARAM wp, LPARAM lp)
+{
+	return DefWindowProc(msg, wp, lp);
+}
+
+BOOL TTCFrameWnd::OnCommand(WPARAM wParam, LPARAM lParam)
+{
+	return FALSE;
+}
+
+void TTCFrameWnd::OnInitMenuPopup(TTCMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
+{}
+
+void TTCFrameWnd::OnKillFocus(HWND hNewWnd)
+{}
+
+void TTCFrameWnd::OnDestroy()
+{}
+
+void TTCFrameWnd::OnSetFocus(HWND hOldWnd)
+{}
+
+void TTCFrameWnd::OnSysCommand(UINT nID, LPARAM lParam)
+{}
+
+void TTCFrameWnd::OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+	TTCFrameWnd::Proc(WM_SYSKEYDOWN, (WPARAM)nChar, MAKELONG(nRepCnt, nFlags));
+}
+
+void TTCFrameWnd::OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+	TTCFrameWnd::Proc(WM_SYSKEYUP, (WPARAM)nChar, MAKELONG(nRepCnt, nFlags));
+}
+
+void TTCFrameWnd::OnClose()
+{}
+
+
+////////////////////////////////////////
+
+void TTCWnd::DestroyWindow()
+{
+	::DestroyWindow(m_hWnd);
+}
+
+HDC TTCWnd::BeginPaint(LPPAINTSTRUCT lpPaint)
+{
+	return ::BeginPaint(m_hWnd, lpPaint);
+}
+
+BOOL TTCWnd::EndPaint(LPPAINTSTRUCT lpPaint)
+{
+	return ::EndPaint(m_hWnd, lpPaint);
+}
+
+LRESULT TTCWnd::DefWindowProc(UINT msg, WPARAM wParam, LPARAM lParam)
+{
+	return ::DefWindowProc(m_hWnd, msg, wParam, lParam);
+}

Modified: branches/cmake/teraterm/teraterm/vtdisp.c
===================================================================
--- branches/cmake/teraterm/teraterm/vtdisp.c	2018-09-03 10:52:11 UTC (rev 7227)
+++ branches/cmake/teraterm/teraterm/vtdisp.c	2018-09-03 11:02:33 UTC (rev 7228)
@@ -36,6 +36,7 @@
 #include "ttime.h"
 #include "ttdialog.h"
 #include "ttcommon.h"
+#include "compat_win.h"
 
 #include "vtdisp.h"
 
@@ -100,7 +101,6 @@
 int PageStart, BuffEnd;
 
 static BOOL CursorOnDBCS = FALSE;
-static LOGFONT VTlf;
 static BOOL SaveWinSize = FALSE;
 static int WinWidthOld, WinHeightOld;
 static HBRUSH Background;
@@ -1951,21 +1951,21 @@
        *Yw = (Ys - WinOrgY) * FontHeight;
 }
 
-void SetLogFont()
+static void SetLogFont(LOGFONT *VTlf)
 {
-  memset(&VTlf, 0, sizeof(LOGFONT));
-  VTlf.lfWeight = FW_NORMAL;
-  VTlf.lfItalic = 0;
-  VTlf.lfUnderline = 0;
-  VTlf.lfStrikeOut = 0;
-  VTlf.lfWidth = ts.VTFontSize.x;
-  VTlf.lfHeight = ts.VTFontSize.y;
-  VTlf.lfCharSet = ts.VTFontCharSet;
-  VTlf.lfOutPrecision  = OUT_CHARACTER_PRECIS;
-  VTlf.lfClipPrecision = CLIP_CHARACTER_PRECIS;
-  VTlf.lfQuality       = (BYTE)ts.FontQuality;
-  VTlf.lfPitchAndFamily = FIXED_PITCH | FF_DONTCARE;
-  strncpy_s(VTlf.lfFaceName, sizeof(VTlf.lfFaceName),ts.VTFont, _TRUNCATE);
+  memset(VTlf, 0, sizeof(LOGFONT));
+  VTlf->lfWeight = FW_NORMAL;
+  VTlf->lfItalic = 0;
+  VTlf->lfUnderline = 0;
+  VTlf->lfStrikeOut = 0;
+  VTlf->lfWidth = ts.VTFontSize.x;
+  VTlf->lfHeight = ts.VTFontSize.y;
+  VTlf->lfCharSet = ts.VTFontCharSet;
+  VTlf->lfOutPrecision  = OUT_CHARACTER_PRECIS;
+  VTlf->lfClipPrecision = CLIP_CHARACTER_PRECIS;
+  VTlf->lfQuality       = (BYTE)ts.FontQuality;
+  VTlf->lfPitchAndFamily = FIXED_PITCH | FF_DONTCARE;
+  strncpy_s(VTlf->lfFaceName, sizeof(VTlf->lfFaceName),ts.VTFont, _TRUNCATE);
 }
 
 void ChangeFont()
@@ -1972,7 +1972,7 @@
 {
   int i, j;
   TEXTMETRIC Metrics;
-  HDC TmpDC;
+  LOGFONT VTlf;
 
   /* Delete Old Fonts */
   for (i = 0 ; i <= AttrFontMask ; i++)
@@ -1984,15 +1984,24 @@
       DeleteObject(VTFont[i]);
   }
 
+  {
+  HDC TmpDC = GetDC(HVTWin);
+  UINT uDpi;
+
   /* Normal Font */
-  SetLogFont();
+  SetLogFont(&VTlf);
+  if (PGetDpiForWindow == NULL) {
+	  uDpi = GetDeviceCaps(TmpDC,LOGPIXELSY);	// \x82\xA2\x82‚\xE096\x82\xF0\x95Ԃ\xB7?
+  } else {
+	  uDpi = PGetDpiForWindow(HVTWin);
+  }
+  VTlf.lfWidth = -MulDiv(VTlf.lfWidth, uDpi, 72);
+  VTlf.lfHeight = -MulDiv(VTlf.lfHeight, uDpi, 72);
   VTFont[0] = CreateFontIndirect(&VTlf);
 
   /* set IME font */
   SetConversionLogFont(&VTlf);
 
-  TmpDC = GetDC(HVTWin);
-
   SelectObject(TmpDC, VTFont[0]);
   GetTextMetrics(TmpDC, &Metrics);
   FontWidth = Metrics.tmAveCharWidth + ts.FontDW;
@@ -1999,6 +2008,7 @@
   FontHeight = Metrics.tmHeight + ts.FontDH;
 
   ReleaseDC(HVTWin,TmpDC);
+  }
 
   /* Underline */
   VTlf.lfUnderline = 1;
@@ -2049,8 +2059,6 @@
     VTFont[AttrSpecial | AttrBold | AttrUnder] = VTFont[AttrSpecial | AttrUnder];
   }
 
-  SetLogFont();
-
   for (i = 0 ; i < TermWidthMax; i++)
     Dx[i] = FontWidth;
 }
@@ -2070,8 +2078,11 @@
 
 		if (ts.UseIME>0)
 		{
-			if (ts.IMEInline>0)
+			if (ts.IMEInline>0) {
+				LOGFONT VTlf;
+				SetLogFont(&VTlf);
 				SetConversionLogFont(&VTlf);
+			}
 			else
 				SetConversionWindow(HVTWin,-1,0);
 		}
@@ -3358,10 +3369,11 @@
 //  reset window
 {
   BOOL Ok;
+  LOGFONT VTlf;
 
   ts.VTFlag = 1;
   if (! LoadTTDLG()) return;
-  SetLogFont();
+  SetLogFont(&VTlf);
   Ok = ChooseFontDlg(HVTWin,&VTlf,&ts);
   FreeTTDLG();
   if (! Ok) return;
@@ -3861,3 +3873,10 @@
 	}
 	return color;
 }
+
+void DpiChanged(void)
+{
+  ChangeFont();
+  DispChangeWinSize(WinWidth,WinHeight);
+  ChangeCaret();
+}

Modified: branches/cmake/teraterm/teraterm/vtdisp.h
===================================================================
--- branches/cmake/teraterm/teraterm/vtdisp.h	2018-09-03 10:52:11 UTC (rev 7227)
+++ branches/cmake/teraterm/teraterm/vtdisp.h	2018-09-03 11:02:33 UTC (rev 7228)
@@ -55,7 +55,7 @@
   (int Xw, int Yw, int *Xs, int *Ys, PBOOL Right);
 void DispConvScreenToWin
   (int Xs, int Ys, int *Xw, int *Yw);
-void SetLogFont();
+//void SetLogFont();
 void ChangeFont();
 void ResetIME();
 void ChangeCaret();
@@ -116,6 +116,7 @@
 void DispGetRootWinSize(int *x, int *y);
 int DispFindClosestColor(int red, int green, int blue);
 void UpdateBGBrush(void);
+void DpiChanged(void);
 
 extern int WinWidth, WinHeight;
 extern HFONT VTFont[AttrFontMask+1];

Modified: branches/cmake/teraterm/teraterm/vtwin.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/vtwin.cpp	2018-09-03 10:52:11 UTC (rev 7227)
+++ branches/cmake/teraterm/teraterm/vtwin.cpp	2018-09-03 11:02:33 UTC (rev 7228)
@@ -82,6 +82,7 @@
 #include "dnddlg.h"
 #include "tekwin.h"
 #include "htmlhelp.h"
+#include "compat_win.h"
 
 #include "initguid.h"
 //#include "Usbiodef.h"
@@ -256,6 +257,7 @@
 	ON_COMMAND(ID_HELP_INDEX2, OnHelpIndex)
 	ON_COMMAND(ID_HELP_ABOUT, OnHelpAbout)
 	ON_MESSAGE(WM_USER_DROPNOTIFY, OnDropNotify)
+	ON_MESSAGE(WM_DPICHANGED, OnDpiChanged)
 	//}}AFX_MSG_MAP
 END_MESSAGE_MAP()
 #endif
@@ -6118,6 +6120,19 @@
 	FreeTTDLG();
 }
 
+LRESULT CVTWindow::OnDpiChanged(WPARAM wParam, LPARAM lParam)
+{
+	static DWORD preTime = 0;
+	DWORD currentTime = GetTickCount();
+	if (currentTime - preTime < 1000) {
+		return 0;
+	}
+	preTime = currentTime;
+		
+	DpiChanged();
+	return TRUE;
+}
+
 LRESULT CVTWindow::Proc(UINT msg, WPARAM wp, LPARAM lp)
 {
 	LRESULT retval = 0;
@@ -6317,6 +6332,9 @@
 	case WM_USER_DROPNOTIFY:
 		OnDropNotify(wp, lp);
 		break;
+	case WM_DPICHANGED:
+		OnDpiChanged(wp, lp);
+		break;
 	case WM_COMMAND:
 	{
 		WORD wID = GET_WM_COMMAND_ID(wp, lp);

Modified: branches/cmake/teraterm/teraterm/vtwin.h
===================================================================
--- branches/cmake/teraterm/teraterm/vtwin.h	2018-09-03 10:52:11 UTC (rev 7227)
+++ branches/cmake/teraterm/teraterm/vtwin.h	2018-09-03 11:02:33 UTC (rev 7228)
@@ -31,7 +31,7 @@
 
 #ifdef __cplusplus
 
-#include "tekwin_sub.h"
+#include "tmfc.h"
 //class CVTWindow : public CFrameWnd
 class CVTWindow : public TTCFrameWnd
 {
@@ -225,6 +225,7 @@
 //	afx_msg void OnHelpUsing();		// 実体なし不要
 	afx_msg void OnHelpAbout();
 	afx_msg LRESULT OnDropNotify(WPARAM ShowMenu, LPARAM lParam);
+	afx_msg LRESULT OnDpiChanged(WPARAM wParam, LPARAM lParam);
 	//}}AFX_MSG
 //	DECLARE_MESSAGE_MAP();
 #undef afx_msg

Modified: branches/cmake/teraterm/ttpcmn/CMakeLists.txt
===================================================================
--- branches/cmake/teraterm/ttpcmn/CMakeLists.txt	2018-09-03 10:52:11 UTC (rev 7227)
+++ branches/cmake/teraterm/ttpcmn/CMakeLists.txt	2018-09-03 11:02:33 UTC (rev 7228)
@@ -40,7 +40,6 @@
   language.h
   ttcmn.c
   ttpcmn-version.rc
-  ttpcmn.rc
   ${COMMON_SRC}
   )
 

Deleted: branches/cmake/teraterm/ttpcmn/ttpcmn.rc
===================================================================
--- branches/cmake/teraterm/ttpcmn/ttpcmn.rc	2018-09-03 10:52:11 UTC (rev 7227)
+++ branches/cmake/teraterm/ttpcmn/ttpcmn.rc	2018-09-03 11:02:33 UTC (rev 7228)
@@ -1,65 +0,0 @@
-// Microsoft Visual C++ generated resource script.
-//
-#include "cmn_res.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-//#include "afxres.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// \x93\xFA\x96{\x8C\xEA resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN)
-#ifdef _WIN32
-//LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
-//#pragma code_page(932)
-#endif //_WIN32
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE 
-BEGIN
-    "cmn_res.h\0"
-END
-
-2 TEXTINCLUDE 
-BEGIN
-    "#include ""afxres.h""\r\n"
-    "\0"
-END
-
-3 TEXTINCLUDE 
-BEGIN
-    "#include ""ttpcmn-version.rc""\r\n"
-    "\0"
-END
-
-#endif    // APSTUDIO_INVOKED
-
-
-
-#endif    // \x93\xFA\x96{\x8C\xEA resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-//#include "ttpcmn-version.rc"
-
-/////////////////////////////////////////////////////////////////////////////
-#endif    // not APSTUDIO_INVOKED
-

Modified: branches/cmake/teraterm/ttpset/ttpset.rc
===================================================================
--- branches/cmake/teraterm/ttpset/ttpset.rc	2018-09-03 10:52:11 UTC (rev 7227)
+++ branches/cmake/teraterm/ttpset/ttpset.rc	2018-09-03 11:02:33 UTC (rev 7228)
@@ -7,7 +7,7 @@
 //
 // Generated from the TEXTINCLUDE 2 resource.
 //
-#include "afxres.h"
+//#include "afxres.h"
 
 /////////////////////////////////////////////////////////////////////////////
 #undef APSTUDIO_READONLY_SYMBOLS

Modified: branches/cmake/teraterm/ttptek/CMakeLists.txt
===================================================================
--- branches/cmake/teraterm/ttptek/CMakeLists.txt	2018-09-03 10:52:11 UTC (rev 7227)
+++ branches/cmake/teraterm/ttptek/CMakeLists.txt	2018-09-03 11:02:33 UTC (rev 7228)
@@ -34,7 +34,7 @@
   tek_res.h
   tekesc.c
   tekesc.h
-  ttptek.rc
+#  ttptek.rc
   ttptek-version.rc
   tttek.h
   tttek.c

Deleted: branches/cmake/teraterm/ttptek/ttptek.rc
===================================================================
--- branches/cmake/teraterm/ttptek/ttptek.rc	2018-09-03 10:52:11 UTC (rev 7227)
+++ branches/cmake/teraterm/ttptek/ttptek.rc	2018-09-03 11:02:33 UTC (rev 7228)
@@ -1,65 +0,0 @@
-// Microsoft Visual C++ generated resource script.
-//
-#include "tek_res.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-//#include "afxres.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// \x93\xFA\x96{\x8C\xEA resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN)
-#ifdef _WIN32
-//LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
-//#pragma code_page(932)
-#endif //_WIN32
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE 
-BEGIN
-    "tek_res.h\0"
-END
-
-2 TEXTINCLUDE 
-BEGIN
-    "#include ""afxres.h""\r\n"
-    "\0"
-END
-
-3 TEXTINCLUDE 
-BEGIN
-    "#include ""ttptek-version.rc""\r\n"
-    "\0"
-END
-
-#endif    // APSTUDIO_INVOKED
-
-
-
-#endif    // \x93\xFA\x96{\x8C\xEA resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-//#include "ttptek-version.rc"
-
-/////////////////////////////////////////////////////////////////////////////
-#endif    // not APSTUDIO_INVOKED
-

Modified: branches/cmake/ttpmenu/ttpmenu.rc
===================================================================
--- branches/cmake/ttpmenu/ttpmenu.rc	2018-09-03 10:52:11 UTC (rev 7227)
+++ branches/cmake/ttpmenu/ttpmenu.rc	2018-09-03 11:02:33 UTC (rev 7228)
@@ -7,7 +7,8 @@
 //
 // Generated from the TEXTINCLUDE 2 resource.
 //
-#include "afxres.h"
+//#include "afxres.h"
+#include <windows.h>
 
 /////////////////////////////////////////////////////////////////////////////
 #undef APSTUDIO_READONLY_SYMBOLS
@@ -17,7 +18,7 @@
 
 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
 #ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+//LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 #pragma code_page(1252)
 #endif //_WIN32
 

Modified: branches/cmake/ttssh2/ttxssh/ttxssh.rc
===================================================================
--- branches/cmake/ttssh2/ttxssh/ttxssh.rc	2018-09-03 10:52:11 UTC (rev 7227)
+++ branches/cmake/ttssh2/ttxssh/ttxssh.rc	2018-09-03 11:02:33 UTC (rev 7228)
@@ -7,7 +7,8 @@
 //
 // Generated from the TEXTINCLUDE 2 resource.
 //
-#include "afxres.h"
+//#include "afxres.h"
+#include <windows.h>
 #ifndef IDC_STATIC
 #define IDC_STATIC -1
 #endif
@@ -20,7 +21,7 @@
 
 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
 #ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+//LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 #pragma code_page(1252)
 #endif //_WIN32
 



Ttssh2-commit メーリングリストの案内