• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision7527 (tree)
Time2019-03-29 01:38:41
Authorzmatsuo

Log Message

tekwinでMFCを使用しないようにした

Change Summary

Incremental Difference

--- trunk/teraterm/common/ttlib.h (revision 7526)
+++ trunk/teraterm/common/ttlib.h (revision 7527)
@@ -113,6 +113,8 @@
113113 #define CheckFlag(var, flag) (((var) & (flag)) != 0)
114114
115115 void SetDlgTexts(HWND hDlgWnd, const DlgTextInfo *infos, int infoCount, const char *UILanguageFile);
116+void SetDlgMenuTexts(HMENU hMenu, const DlgTextInfo *infos, int infoCount, const char *UILanguageFile);
117+
116118 #if defined(_UNICODE)
117119 #define get_lang_msgT(p1, p2, p3, p4, p5) get_lang_msgW(p1, p2, p3, p4, p5)
118120 #define get_OPENFILENAME_SIZE() get_OPENFILENAME_SIZEW()
--- trunk/teraterm/teraterm/tekwin.cpp (revision 7526)
+++ trunk/teraterm/teraterm/tekwin.cpp (revision 7527)
@@ -1,6 +1,6 @@
11 /*
22 * Copyright (C) 1994-1998 T. Teranishi
3- * (C) 2006-2017 TeraTerm Project
3+ * (C) 2006-2019 TeraTerm Project
44 * All rights reserved.
55 *
66 * Redistribution and use in source and binary forms, with or without
@@ -28,7 +28,7 @@
2828 */
2929
3030 /* TERATERM.EXE, TEK window */
31-#include "stdafx.h"
31+#include <windowsx.h>
3232 #include "teraterm.h"
3333 #include "tttypes.h"
3434 #include "tektypes.h"
@@ -43,9 +43,15 @@
4343 #include "tt_res.h"
4444 #include "tekwin.h"
4545 #include "ttlib.h"
46+#include <htmlhelp.h>
47+#include "dlglib.h"
48+#include <tchar.h>
4649
47-#define TEKClassName "TEKWin32"
50+#define CWnd TTCWnd
51+#define CFrameWnd TTCFrameWnd
4852
53+#define TEKClassName _T("TEKWin32")
54+
4955 #ifdef _DEBUG
5056 #define new DEBUG_NEW
5157 #undef THIS_FILE
@@ -52,6 +58,11 @@
5258 static char THIS_FILE[] = __FILE__;
5359 #endif
5460
61+static HINSTANCE AfxGetInstanceHandle()
62+{
63+ return hInst;
64+}
65+
5566 /////////////////////////////////////////////////////////////////////////////
5667 // CTEKWindow
5768
@@ -76,7 +87,7 @@
7687 }
7788
7889 wc.style = CS_HREDRAW | CS_VREDRAW;
79- wc.lpfnWndProc = AfxWndProc;
90+ wc.lpfnWndProc = (WNDPROC)ProcStub;
8091 wc.cbClsExtra = 0;
8192 wc.cbWndExtra = 0;
8293 wc.hInstance = AfxGetInstanceHandle();
@@ -97,7 +108,7 @@
97108 rect.right = rect.left + 640; //temporary width
98109 rect.bottom = rect.top + 400; //temporary height
99110 }
100- Create(TEKClassName, "Tera Term", Style, rect, GetDesktopWindow(), NULL);
111+ Create(hInst, TEKClassName, _T("Tera Term"), Style, rect, ::GetDesktopWindow(), NULL);
101112 //--------------------------------------------------------
102113 HTEKWin = GetSafeHwnd();
103114 if (HTEKWin == NULL) {
@@ -151,6 +162,33 @@
151162
152163 void CTEKWindow::InitMenu(HMENU *Menu)
153164 {
165+ static const DlgTextInfo MenuTextInfo[] = {
166+ { 0, "TEKMENU_FILE" },
167+ { 1, "TEKMENU_EDIT" },
168+ { 2, "TEKMENU_SETUP" },
169+ { ID_TEKVTWIN, "TEKMENU_VTWIN"},
170+ { 4, "TEKMENU_HELP"},
171+ };
172+ static const DlgTextInfo FileMenuTextInfo[] = {
173+ { ID_TEKFILE_PRINT, "TEKMENU_FILE_PRINT" },
174+ { ID_TEKFILE_EXIT, "TEKMENU_FILE_EXIT" },
175+ };
176+ static const DlgTextInfo EditMenuTextInfo[] = {
177+ { ID_TEKEDIT_COPY, "TEKMENU_EDIT_COPY" },
178+ { ID_TEKEDIT_COPYSCREEN, "TEKMENU_EDIT_COPYSCREEN" },
179+ { ID_TEKEDIT_PASTE, "TEKMENU_EDIT_PASTE" },
180+ { ID_TEKEDIT_PASTECR, "TEKMENU_EDIT_PASTECR" },
181+ { ID_TEKEDIT_CLEARSCREEN, "TEKMENU_EDIT_CLSCREEN" },
182+ };
183+ static const DlgTextInfo SetupMenuTextInfo[] = {
184+ { ID_TEKSETUP_WINDOW, "TEKMENU_SETUP_WINDOW" },
185+ { ID_TEKSETUP_FONT, "TEKMENU_SETUP_FONT" },
186+ };
187+ static const DlgTextInfo HelpMenuTextInfo[] = {
188+ { ID_TEKHELP_INDEX, "TEKMENU_HELP_INDEX" },
189+ { ID_TEKHELP_ABOUT, "TEKMENU_HELP_ABOUT" },
190+ };
191+
154192 *Menu = ::LoadMenu(AfxGetInstanceHandle(),
155193 MAKEINTRESOURCE(IDR_TEKMENU));
156194 EditMenu = GetSubMenu(MainMenu,1);
@@ -157,66 +195,19 @@
157195 FileMenu = GetSubMenu(MainMenu,0);
158196 SetupMenu = GetSubMenu(MainMenu,2);
159197 HelpMenu = GetSubMenu(MainMenu,4);
160- char uimsg[MAX_UIMSG];
161198
162- GetMenuString(*Menu, 0, uimsg, sizeof(uimsg), MF_BYPOSITION);
163- get_lang_msg("TEKMENU_FILE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
164- ModifyMenu(*Menu, 0, MF_BYPOSITION, 0, ts.UIMsg);
165- GetMenuString(FileMenu, ID_TEKFILE_PRINT, uimsg, sizeof(uimsg), MF_BYCOMMAND);
166- get_lang_msg("TEKMENU_FILE_PRINT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
167- ModifyMenu(FileMenu, ID_TEKFILE_PRINT, MF_BYCOMMAND, ID_TEKFILE_PRINT, ts.UIMsg);
168- GetMenuString(FileMenu, ID_TEKFILE_EXIT, uimsg, sizeof(uimsg), MF_BYCOMMAND);
169- get_lang_msg("TEKMENU_FILE_EXIT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
170- ModifyMenu(FileMenu, ID_TEKFILE_EXIT, MF_BYCOMMAND, ID_TEKFILE_EXIT, ts.UIMsg);
199+ SetDlgMenuTexts(*Menu, MenuTextInfo, _countof(MenuTextInfo), ts.UILanguageFile);
200+ SetDlgMenuTexts(FileMenu, FileMenuTextInfo, _countof(FileMenuTextInfo), ts.UILanguageFile);
201+ SetDlgMenuTexts(EditMenu, EditMenuTextInfo, _countof(EditMenuTextInfo), ts.UILanguageFile);
202+ SetDlgMenuTexts(SetupMenu, SetupMenuTextInfo, _countof(SetupMenuTextInfo), ts.UILanguageFile);
203+ SetDlgMenuTexts(HelpMenu, HelpMenuTextInfo, _countof(HelpMenuTextInfo), ts.UILanguageFile);
171204
172- GetMenuString(*Menu, 1, uimsg, sizeof(uimsg), MF_BYPOSITION);
173- get_lang_msg("TEKMENU_EDIT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
174- ModifyMenu(*Menu, 1, MF_BYPOSITION, 1, ts.UIMsg);
175- GetMenuString(EditMenu, ID_TEKEDIT_COPY, uimsg, sizeof(uimsg), MF_BYCOMMAND);
176- get_lang_msg("TEKMENU_EDIT_COPY", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
177- ModifyMenu(EditMenu, ID_TEKEDIT_COPY, MF_BYCOMMAND, ID_TEKEDIT_COPY, ts.UIMsg);
178- GetMenuString(EditMenu, ID_TEKEDIT_COPYSCREEN, uimsg, sizeof(uimsg), MF_BYCOMMAND);
179- get_lang_msg("TEKMENU_EDIT_COPYSCREEN", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
180- ModifyMenu(EditMenu, ID_TEKEDIT_COPYSCREEN, MF_BYCOMMAND, ID_TEKEDIT_COPYSCREEN, ts.UIMsg);
181- GetMenuString(EditMenu, ID_TEKEDIT_PASTE, uimsg, sizeof(uimsg), MF_BYCOMMAND);
182- get_lang_msg("TEKMENU_EDIT_PASTE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
183- ModifyMenu(EditMenu, ID_TEKEDIT_PASTE, MF_BYCOMMAND, ID_TEKEDIT_PASTE, ts.UIMsg);
184- GetMenuString(EditMenu, ID_TEKEDIT_PASTECR, uimsg, sizeof(uimsg), MF_BYCOMMAND);
185- get_lang_msg("TEKMENU_EDIT_PASTECR", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
186- ModifyMenu(EditMenu, ID_TEKEDIT_PASTECR, MF_BYCOMMAND, ID_TEKEDIT_PASTECR, ts.UIMsg);
187- GetMenuString(EditMenu, ID_TEKEDIT_CLEARSCREEN, uimsg, sizeof(uimsg), MF_BYCOMMAND);
188- get_lang_msg("TEKMENU_EDIT_CLSCREEN", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
189- ModifyMenu(EditMenu, ID_TEKEDIT_CLEARSCREEN, MF_BYCOMMAND, ID_TEKEDIT_CLEARSCREEN, ts.UIMsg);
190-
191- GetMenuString(*Menu, 2, uimsg, sizeof(uimsg), MF_BYPOSITION);
192- get_lang_msg("TEKMENU_SETUP", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
193- ModifyMenu(*Menu, 2, MF_BYPOSITION, 2, ts.UIMsg);
194- GetMenuString(SetupMenu, ID_TEKSETUP_WINDOW, uimsg, sizeof(uimsg), MF_BYCOMMAND);
195- get_lang_msg("TEKMENU_SETUP_WINDOW", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
196- ModifyMenu(SetupMenu, ID_TEKSETUP_WINDOW, MF_BYCOMMAND, ID_TEKSETUP_WINDOW, ts.UIMsg);
197- GetMenuString(SetupMenu, ID_TEKSETUP_FONT, uimsg, sizeof(uimsg), MF_BYCOMMAND);
198- get_lang_msg("TEKMENU_SETUP_FONT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
199- ModifyMenu(SetupMenu, ID_TEKSETUP_FONT, MF_BYCOMMAND, ID_TEKSETUP_FONT, ts.UIMsg);
200-
201- GetMenuString(*Menu, ID_TEKVTWIN, uimsg, sizeof(uimsg), MF_BYCOMMAND);
202- get_lang_msg("TEKMENU_VTWIN", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
203- ModifyMenu(*Menu, ID_TEKVTWIN, MF_BYCOMMAND, ID_TEKVTWIN, ts.UIMsg);
204-
205- GetMenuString(*Menu, 4, uimsg, sizeof(uimsg), MF_BYPOSITION);
206- get_lang_msg("TEKMENU_HELP", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
207- ModifyMenu(*Menu, 4, MF_BYPOSITION, 4, ts.UIMsg);
208- GetMenuString(HelpMenu, ID_TEKHELP_INDEX, uimsg, sizeof(uimsg), MF_BYCOMMAND);
209- get_lang_msg("TEKMENU_HELP_INDEX", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
210- ModifyMenu(HelpMenu, ID_TEKHELP_INDEX, MF_BYCOMMAND, ID_TEKHELP_INDEX, ts.UIMsg);
211- GetMenuString(HelpMenu, ID_TEKHELP_ABOUT, uimsg, sizeof(uimsg), MF_BYCOMMAND);
212- get_lang_msg("TEKMENU_HELP_ABOUT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
213- ModifyMenu(HelpMenu, ID_TEKHELP_ABOUT, MF_BYCOMMAND, ID_TEKHELP_ABOUT, ts.UIMsg);
214-
215205 if ((ts.MenuFlag & MF_SHOWWINMENU) !=0) {
206+ TCHAR uimsg[MAX_UIMSG];
216207 WinMenu = CreatePopupMenu();
217- get_lang_msg("TEKMENU_WINDOW", ts.UIMsg, sizeof(ts.UIMsg), "&Window", ts.UILanguageFile);
208+ get_lang_msgT("TEKMENU_WINDOW", uimsg, _countof(uimsg), _T("&Window"), ts.UILanguageFile);
218209 ::InsertMenu(*Menu,4,MF_STRING | MF_ENABLED | MF_POPUP | MF_BYPOSITION,
219- (int)WinMenu, ts.UIMsg);
210+ (UINT_PTR)WinMenu, uimsg);
220211 }
221212 }
222213
@@ -246,6 +237,7 @@
246237 }
247238 }
248239
240+#if 0
249241 BEGIN_MESSAGE_MAP(CTEKWindow, CFrameWnd)
250242 //{{AFX_MSG_MAP(CTEKWindow)
251243 ON_WM_ACTIVATE()
@@ -291,6 +283,7 @@
291283 ON_WM_TIMER()
292284 //}}AFX_MSG_MAP
293285 END_MESSAGE_MAP()
286+#endif
294287
295288 /////////////////////////////////////////////////////////////////////////////
296289 // CTEKWindow message handler
@@ -326,7 +319,7 @@
326319 }
327320 }
328321
329-void CTEKWindow::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
322+void CTEKWindow::OnActivate(UINT nState, HWND pWndOther, BOOL bMinimized)
330323 {
331324 if (nState!=WA_INACTIVE) {
332325 tk.Active = TRUE;
@@ -382,9 +375,9 @@
382375 lpMMI->ptMaxTrackSize.y = 10000;
383376 }
384377
385-void CTEKWindow::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
378+void CTEKWindow::OnInitMenuPopup(HMENU hPopupMenu, UINT nIndex, BOOL bSysMenu)
386379 {
387- InitMenuPopup(pPopupMenu->m_hMenu);
380+ InitMenuPopup(hPopupMenu);
388381 }
389382
390383 void CTEKWindow::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
@@ -397,13 +390,13 @@
397390 KeyUp(nChar);
398391 }
399392
400-void CTEKWindow::OnKillFocus(CWnd* pNewWnd)
393+void CTEKWindow::OnKillFocus(HWND hNewWnd)
401394 {
402395 TEKDestroyCaret(&tk,&ts);
403- CFrameWnd::OnKillFocus(pNewWnd);
396+ CFrameWnd::OnKillFocus(hNewWnd);
404397 }
405398
406-void CTEKWindow::OnLButtonDown(UINT nFlags, CPoint point)
399+void CTEKWindow::OnLButtonDown(UINT nFlags, POINTS point)
407400 {
408401 POINT p;
409402 HMENU PopupMenu, PopupBase;
@@ -414,6 +407,7 @@
414407 // popup menu
415408 if (ControlKey() && (MainMenu==NULL))
416409 {
410+ TCHAR uimsg[MAX_UIMSG];
417411 InitMenu(&PopupMenu);
418412 InitMenuPopup(EditMenu);
419413 if (WinMenu!=NULL) {
@@ -420,26 +414,26 @@
420414 InitMenuPopup(WinMenu);
421415 }
422416 PopupBase = CreatePopupMenu();
423- get_lang_msg("MENU_CONTROL", ts.UIMsg, sizeof(ts.UIMsg), "&File", ts.UILanguageFile);
417+ get_lang_msgT("MENU_CONTROL", uimsg, _countof(uimsg), _T("&File"), ts.UILanguageFile);
424418 AppendMenu(PopupBase, MF_STRING | MF_ENABLED | MF_POPUP,
425- (UINT)GetSubMenu(PopupMenu,0), ts.UIMsg);
426- get_lang_msg("TEKMENU_EDIT", ts.UIMsg, sizeof(ts.UIMsg), "&Edit", ts.UILanguageFile);
419+ (UINT_PTR)GetSubMenu(PopupMenu,0), uimsg);
420+ get_lang_msgT("TEKMENU_EDIT", uimsg, _countof(uimsg), _T("&Edit"), ts.UILanguageFile);
427421 AppendMenu(PopupBase, MF_STRING | MF_ENABLED | MF_POPUP,
428- (UINT)EditMenu, ts.UIMsg);
429- get_lang_msg("TEKMENU_SETUP", ts.UIMsg, sizeof(ts.UIMsg), "&Setup", ts.UILanguageFile);
422+ (UINT_PTR)EditMenu, uimsg);
423+ get_lang_msgT("TEKMENU_SETUP", uimsg, _countof(uimsg), _T("&Setup"), ts.UILanguageFile);
430424 AppendMenu(PopupBase, MF_STRING | MF_ENABLED | MF_POPUP,
431- (UINT)GetSubMenu(PopupMenu,2), ts.UIMsg);
432- get_lang_msg("TEKMENU_VTWIN", ts.UIMsg, sizeof(ts.UIMsg), "VT-Wind&ow", ts.UILanguageFile);
425+ (UINT_PTR)GetSubMenu(PopupMenu,2), uimsg);
426+ get_lang_msgT("TEKMENU_VTWIN", uimsg, _countof(uimsg), _T("VT-Wind&ow"), ts.UILanguageFile);
433427 AppendMenu(PopupBase, MF_STRING | MF_ENABLED,
434- ID_TEKVTWIN, ts.UIMsg);
428+ ID_TEKVTWIN, uimsg);
435429 if (WinMenu!=NULL) {
436- get_lang_msg("TEKMENU_WINDOW", ts.UIMsg, sizeof(ts.UIMsg), "&Window", ts.UILanguageFile);
430+ get_lang_msgT("TEKMENU_WINDOW", uimsg, _countof(uimsg), _T("&Window"), ts.UILanguageFile);
437431 AppendMenu(PopupBase, MF_STRING | MF_ENABLED | MF_POPUP,
438- (UINT)WinMenu, ts.UIMsg);
432+ (UINT_PTR)WinMenu, uimsg);
439433 }
440- get_lang_msg("TEKMENU_HELP", ts.UIMsg, sizeof(ts.UIMsg), "&Help", ts.UILanguageFile);
434+ get_lang_msgT("TEKMENU_HELP", uimsg, _countof(uimsg), _T("&Help"), ts.UILanguageFile);
441435 AppendMenu(PopupBase, MF_STRING | MF_ENABLED | MF_POPUP,
442- (UINT)GetSubMenu(PopupMenu,4), ts.UIMsg);
436+ (UINT_PTR)GetSubMenu(PopupMenu,4), uimsg);
443437 ::ClientToScreen(tk.HWin, &p);
444438 TrackPopupMenu(PopupBase,TPM_LEFTALIGN | TPM_LEFTBUTTON,
445439 p.x,p.y,0,tk.HWin,NULL);
@@ -455,17 +449,17 @@
455449 TEKWMLButtonDown(&tk,&ts,&cv,p);
456450 }
457451
458-void CTEKWindow::OnLButtonUp(UINT nFlags, CPoint point)
452+void CTEKWindow::OnLButtonUp(UINT nFlags, POINTS point)
459453 {
460454 TEKWMLButtonUp(&tk,&ts);
461455 }
462456
463-void CTEKWindow::OnMButtonUp(UINT nFlags, CPoint point)
457+void CTEKWindow::OnMButtonUp(UINT nFlags, POINTS point)
464458 {
465459 //OnRButtonUp(nFlags,point);
466460 }
467461
468-int CTEKWindow::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message)
462+int CTEKWindow::OnMouseActivate(HWND pDesktopWnd, UINT nHitTest, UINT message)
469463 {
470464 if ((ts.SelOnActive==0) &&
471465 (nHitTest==HTCLIENT)) { //disable mouse event for text selection
@@ -476,7 +470,7 @@
476470 }
477471 }
478472
479-void CTEKWindow::OnMouseMove(UINT nFlags, CPoint point)
473+void CTEKWindow::OnMouseMove(UINT nFlags, POINTS point)
480474 {
481475 POINT p;
482476
@@ -497,11 +491,9 @@
497491 void CTEKWindow::OnPaint()
498492 {
499493 PAINTSTRUCT ps;
500- CDC *cdc;
501494 HDC PaintDC;
502495
503- cdc = BeginPaint(&ps);
504- PaintDC = cdc->GetSafeHdc();
496+ PaintDC = BeginPaint(&ps);
505497
506498 TEKPaint(&tk,&ts,PaintDC,&ps);
507499
@@ -508,15 +500,15 @@
508500 EndPaint(&ps);
509501 }
510502
511-void CTEKWindow::OnRButtonUp(UINT nFlags, CPoint point)
503+void CTEKWindow::OnRButtonUp(UINT nFlags, POINTS point)
512504 {
513505 CBStartPaste(tk.HWin, FALSE, FALSE);
514506 }
515507
516-void CTEKWindow::OnSetFocus(CWnd* pOldWnd)
508+void CTEKWindow::OnSetFocus(HWND hOldWnd)
517509 {
518510 TEKChangeCaret(&tk,&ts);
519- CFrameWnd::OnSetFocus(pOldWnd);
511+ CFrameWnd::OnSetFocus(hOldWnd);
520512 }
521513
522514 void CTEKWindow::OnSize(UINT nType, int cx, int cy)
@@ -571,7 +563,7 @@
571563 }
572564 }
573565
574-void CTEKWindow::OnTimer(UINT nIDEvent)
566+void CTEKWindow::OnTimer(UINT_PTR nIDEvent)
575567 {
576568 UINT T;
577569
@@ -590,7 +582,7 @@
590582 }
591583 }
592584
593-LONG CTEKWindow::OnAccelCommand(UINT wParam, LONG lParam)
585+LRESULT CTEKWindow::OnAccelCommand(WPARAM wParam, LPARAM lParam)
594586 {
595587 switch (wParam) {
596588 case IdPrint:
@@ -632,7 +624,7 @@
632624 return 0;
633625 }
634626
635-LONG CTEKWindow::OnChangeMenu(UINT wParam, LONG lParam)
627+LRESULT CTEKWindow::OnChangeMenu(WPARAM wParam, LPARAM lParam)
636628 {
637629 HMENU SysMenu;
638630 BOOL Show, B1, B2;
@@ -661,11 +653,12 @@
661653 if ((MainMenu!=NULL) &&
662654 (B1 != B2)) {
663655 if (WinMenu==NULL) {
656+ TCHAR uimsg[MAX_UIMSG];
664657 WinMenu = CreatePopupMenu();
665- get_lang_msg("TEKMENU_WINDOW", ts.UIMsg, sizeof(ts.UIMsg), "&Window", ts.UILanguageFile);
658+ get_lang_msgT("TEKMENU_WINDOW", uimsg, _countof(uimsg), _T("&Window"), ts.UILanguageFile);
666659 ::InsertMenu(MainMenu,4,
667660 MF_STRING | MF_ENABLED | MF_POPUP | MF_BYPOSITION,
668- (int)WinMenu, ts.UIMsg);
661+ (UINT_PTR)WinMenu, uimsg);
669662 }
670663 else {
671664 RemoveMenu(MainMenu,4,MF_BYPOSITION);
@@ -677,21 +670,22 @@
677670
678671 ::GetSystemMenu(tk.HWin,TRUE);
679672 if ((! Show) && ((ts.MenuFlag & MF_NOSHOWMENU)==0)) {
673+ TCHAR uimsg[MAX_UIMSG];
680674 SysMenu = ::GetSystemMenu(tk.HWin,FALSE);
681675 AppendMenu(SysMenu, MF_SEPARATOR, 0, NULL);
682- get_lang_msg("TEKMENU_SHOW_MENUBAR", ts.UIMsg, sizeof(ts.UIMsg), "Show menu &bar", ts.UILanguageFile);
683- AppendMenu(SysMenu, MF_STRING, ID_SHOWMENUBAR, ts.UIMsg);
676+ get_lang_msgT("TEKMENU_SHOW_MENUBAR", uimsg, _countof(uimsg), _T("Show menu &bar"), ts.UILanguageFile);
677+ AppendMenu(SysMenu, MF_STRING, ID_SHOWMENUBAR, uimsg);
684678 }
685679 return 0;
686680 }
687681
688-LONG CTEKWindow::OnChangeTBar(UINT wParam, LONG lParam)
682+LRESULT CTEKWindow::OnChangeTBar(WPARAM wParam, LPARAM lParam)
689683 {
690684 BOOL TBar;
691685 DWORD Style;
692686 HMENU SysMenu;
693687
694- Style = GetWindowLong (HTEKWin, GWL_STYLE);
688+ Style = GetWindowLongPtr (GWL_STYLE);
695689 TBar = ((Style & WS_SYSMENU)!=0);
696690 if (TBar == (ts.HideTitle==0)) {
697691 return 0;
@@ -704,7 +698,7 @@
704698 Style = Style & ~WS_POPUP | WS_SYSMENU | WS_CAPTION | WS_MINIMIZEBOX;
705699 }
706700 tk.AdjustSize = TRUE;
707- SetWindowLong (HTEKWin, GWL_STYLE, Style);
701+ SetWindowLongPtr (GWL_STYLE, Style);
708702 ::SetWindowPos (HTEKWin, NULL, 0, 0, 0, 0,
709703 SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
710704 ::ShowWindow (HTEKWin, SW_SHOW);
@@ -711,21 +705,22 @@
711705
712706 if ((ts.HideTitle==0) && (MainMenu==NULL) &&
713707 ((ts.MenuFlag & MF_NOSHOWMENU) == 0)) {
708+ TCHAR uimsg[MAX_UIMSG];
714709 SysMenu = ::GetSystemMenu(HTEKWin,FALSE);
715710 AppendMenu(SysMenu, MF_SEPARATOR, 0, NULL);
716- get_lang_msg("TEKMENU_SHOW_MENUBAR", ts.UIMsg, sizeof(ts.UIMsg), "Show menu &bar", ts.UILanguageFile);
717- AppendMenu(SysMenu, MF_STRING, ID_SHOWMENUBAR, ts.UIMsg);
711+ get_lang_msgT("TEKMENU_SHOW_MENUBAR", uimsg, _countof(uimsg), _T("Show menu &bar"), ts.UILanguageFile);
712+ AppendMenu(SysMenu, MF_STRING, ID_SHOWMENUBAR, uimsg);
718713 }
719714 return 0;
720715 }
721716
722-LONG CTEKWindow::OnDlgHelp(UINT wParam, LONG lParam)
717+LRESULT CTEKWindow::OnDlgHelp(WPARAM wParam, LPARAM lParam)
723718 {
724719 OpenHelp(HH_HELP_CONTEXT, HelpId, ts.UILanguageFile);
725720 return 0;
726721 }
727722
728-LONG CTEKWindow::OnGetSerialNo(UINT wParam, LONG lParam)
723+LRESULT CTEKWindow::OnGetSerialNo(WPARAM wParam, LPARAM lParam)
729724 {
730725 return (LONG)SerialNo;
731726 }
@@ -855,3 +850,123 @@
855850 (*AboutDialog)(tk.HWin);
856851 FreeTTDLG();
857852 }
853+
854+LRESULT CTEKWindow::Proc(UINT msg, WPARAM wp, LPARAM lp)
855+{
856+ LRESULT retval = 0;
857+ switch(msg)
858+ {
859+ case WM_ACTIVATE:
860+ OnActivate(wp & 0xFFFF, (HWND)wp, (wp >> 16) & 0xFFFF);
861+ break;
862+ case WM_CHAR:
863+ OnChar(wp, LOWORD(lp), HIWORD(lp));
864+ break;
865+ case WM_DESTROY:
866+ OnDestroy();
867+ PostQuitMessage(0);
868+ break;
869+ case WM_GETMINMAXINFO:
870+ OnGetMinMaxInfo((MINMAXINFO *)lp);
871+ break;
872+ case WM_INITMENUPOPUP:
873+ OnInitMenuPopup((HMENU)wp, LOWORD(lp), HIWORD(lp));
874+ break;
875+ case WM_KEYDOWN:
876+ OnKeyDown(wp, LOWORD(lp), HIWORD(lp));
877+ break;
878+ case WM_KEYUP:
879+ OnKeyUp(wp, LOWORD(lp), HIWORD(lp));
880+ break;
881+ case WM_KILLFOCUS:
882+ OnKillFocus((HWND)wp);
883+ break;
884+ case WM_LBUTTONDOWN:
885+ OnLButtonDown(wp, MAKEPOINTS(lp));
886+ break;
887+ case WM_LBUTTONUP:
888+ OnLButtonUp(wp, MAKEPOINTS(lp));
889+ break;
890+ case WM_MBUTTONUP:
891+ OnMButtonUp(wp, MAKEPOINTS(lp));
892+ break;
893+ case WM_MOUSEACTIVATE:
894+ OnMouseActivate((HWND)wp, LOWORD(lp), HIWORD(lp));
895+ break;
896+ case WM_MOUSEMOVE:
897+ OnMouseMove(wp, MAKEPOINTS(lp));
898+ break;
899+ case WM_MOVE:
900+ OnMove(LOWORD(lp), HIWORD(lp));
901+ break;
902+ case WM_PAINT:
903+ OnPaint();
904+ break;
905+ case WM_RBUTTONUP:
906+ OnRButtonUp((UINT)wp, MAKEPOINTS(lp));
907+ break;
908+ case WM_SETFOCUS:
909+ OnSetFocus((HWND)wp);
910+ DefWindowProc(msg, wp, lp);
911+ break;
912+ case WM_SIZE:
913+ OnSize(wp, LOWORD(lp), HIWORD(lp));
914+ break;
915+ case WM_SYSCOMMAND:
916+ OnSysCommand(wp, lp);
917+ DefWindowProc(msg, wp, lp);
918+ break;
919+ case WM_SYSKEYDOWN:
920+ OnSysKeyDown(wp, LOWORD(lp), HIWORD(lp));
921+ break;
922+ case WM_SYSKEYUP:
923+ OnSysKeyUp(wp, LOWORD(lp), HIWORD(lp));
924+ break;
925+ case WM_TIMER:
926+ OnTimer(wp);
927+ break;
928+ case WM_USER_ACCELCOMMAND:
929+ OnAccelCommand(wp, lp);
930+ break;
931+ case WM_USER_CHANGEMENU:
932+ OnChangeMenu(wp, lp);
933+ break;
934+ case WM_USER_CHANGETBAR:
935+ OnChangeTBar(wp, lp);
936+ break;
937+ case WM_USER_DLGHELP2:
938+ OnDlgHelp(wp, lp);
939+ break;
940+ case WM_USER_GETSERIALNO:
941+ OnGetSerialNo(wp, lp);
942+ break;
943+ case WM_COMMAND:
944+ {
945+ const WORD wID = GET_WM_COMMAND_ID(wp, lp);
946+ switch (wID) {
947+ case ID_TEKFILE_PRINT: OnFilePrint(); break;
948+ case ID_TEKFILE_EXIT: OnFileExit(); break;
949+ case ID_TEKEDIT_COPY: OnEditCopy(); break;
950+ case ID_TEKEDIT_COPYSCREEN: OnEditCopyScreen(); break;
951+ case ID_TEKEDIT_PASTE: OnEditPaste(); break;
952+ case ID_TEKEDIT_PASTECR: OnEditPasteCR(); break;
953+ case ID_TEKEDIT_CLEARSCREEN: OnEditClearScreen(); break;
954+ case ID_TEKSETUP_WINDOW: OnSetupWindow(); break;
955+ case ID_TEKSETUP_FONT: OnSetupFont(); break;
956+ case ID_TEKVTWIN: OnVTWin(); break;
957+ case ID_TEKWINDOW_WINDOW: OnWindowWindow(); break;
958+ case ID_TEKHELP_INDEX: OnHelpIndex(); break;
959+ case ID_TEKHELP_ABOUT: OnHelpAbout(); break;
960+ default:
961+ OnCommand(wp, lp);
962+ break;
963+ }
964+ break;
965+ }
966+ default:
967+ retval = DefWindowProc(msg, wp, lp);
968+ break;
969+ }
970+
971+ return retval;
972+}
--- trunk/teraterm/teraterm/tekwin.h (revision 7526)
+++ trunk/teraterm/teraterm/tekwin.h (revision 7527)
@@ -1,6 +1,6 @@
11 /*
22 * Copyright (C) 1994-1998 T. Teranishi
3- * (C) 2006-2017 TeraTerm Project
3+ * (C) 2006-2019 TeraTerm Project
44 * All rights reserved.
55 *
66 * Redistribution and use in source and binary forms, with or without
@@ -31,17 +31,13 @@
3131
3232 /////////////////////////////////////////////////////////////////////////////
3333 // CTEKWindow
34-
35-class CTEKWindow : public CFrameWnd
34+#include "tmfc.h"
35+class CTEKWindow : public TTCFrameWnd
3636 {
3737 private:
3838 TTEKVar tk;
39-#ifndef NO_I18N
4039 HMENU MainMenu, EditMenu, WinMenu,
4140 FileMenu, SetupMenu, HelpMenu;
42-#else
43- HMENU MainMenu, EditMenu, WinMenu;
44-#endif
4541
4642 public:
4743 CTEKWindow();
@@ -61,33 +57,34 @@
6157
6258 protected:
6359 //{{AFX_MSG(CTEKWindow)
64- afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
60+#define afx_msg
61+ afx_msg void OnActivate(UINT nState, HWND pWndOther, BOOL bMinimized);
6562 afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
6663 afx_msg void OnDestroy();
6764 afx_msg void OnGetMinMaxInfo(MINMAXINFO *lpMMI);
68- afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
65+ afx_msg void OnInitMenuPopup(HMENU hPopupMenu, UINT nIndex, BOOL bSysMenu);
6966 afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
7067 afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
71- afx_msg void OnKillFocus(CWnd* pNewWnd);
72- afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
73- afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
74- afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
75- afx_msg int OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message);
76- afx_msg void OnMouseMove(UINT nFlags, CPoint point);
68+ afx_msg void OnKillFocus(HWND hNewWnd);
69+ afx_msg void OnLButtonDown(UINT nFlags, POINTS point);
70+ afx_msg void OnLButtonUp(UINT nFlags, POINTS point);
71+ afx_msg void OnMButtonUp(UINT nFlags, POINTS point);
72+ afx_msg int OnMouseActivate(HWND hDesktopWnd, UINT nHitTest, UINT message);
73+ afx_msg void OnMouseMove(UINT nFlags, POINTS point);
7774 afx_msg void OnMove(int x, int y);
7875 afx_msg void OnPaint();
79- afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
80- afx_msg void OnSetFocus(CWnd* pOldWnd);
76+ afx_msg void OnRButtonUp(UINT nFlags, POINTS point);
77+ afx_msg void OnSetFocus(HWND hOldWnd);
8178 afx_msg void OnSize(UINT nType, int cx, int cy);
8279 afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
8380 afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
8481 afx_msg void OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
85- afx_msg void OnTimer(UINT nIDEvent);
86- afx_msg LONG OnAccelCommand(UINT wParam, LONG lParam);
87- afx_msg LONG OnChangeMenu(UINT wParam, LONG lParam);
88- afx_msg LONG OnChangeTBar(UINT wParam, LONG lParam);
89- afx_msg LONG OnDlgHelp(UINT wParam, LONG lParam);
90- afx_msg LONG OnGetSerialNo(UINT wParam, LONG lParam);
82+ afx_msg void OnTimer(UINT_PTR nIDEvent);
83+ afx_msg LRESULT OnAccelCommand(WPARAM wParam, LPARAM lParam);
84+ afx_msg LRESULT OnChangeMenu(WPARAM wParam, LPARAM lParam);
85+ afx_msg LRESULT OnChangeTBar(WPARAM wParam, LPARAM lParam);
86+ afx_msg LRESULT OnDlgHelp(WPARAM wParam, LPARAM lParam);
87+ afx_msg LRESULT OnGetSerialNo(WPARAM wParam, LPARAM lParam);
9188 afx_msg void OnFilePrint();
9289 afx_msg void OnFileExit();
9390 afx_msg void OnEditCopy();
@@ -103,5 +100,7 @@
103100 afx_msg void OnHelpUsing();
104101 afx_msg void OnHelpAbout();
105102 //}}AFX_MSG
106- DECLARE_MESSAGE_MAP()
103+// DECLARE_MESSAGE_MAP()
104+#undef afx_msg
105+ virtual LRESULT Proc(UINT msg, WPARAM wp, LPARAM lp);
107106 };
--- trunk/teraterm/teraterm/teraprn.cpp (revision 7526)
+++ trunk/teraterm/teraterm/teraprn.cpp (revision 7527)
@@ -45,16 +45,18 @@
4545
4646 #include "teraprn.h"
4747
48-#ifdef _DEBUG
48+#if 0 //def _DEBUG
4949 #define new DEBUG_NEW
5050 #undef THIS_FILE
5151 static char THIS_FILE[] = __FILE__;
5252 #endif
5353
54+//#define CWnd TTCWnd
55+
5456 static PRINTDLG PrnDlg;
5557
5658 static HDC PrintDC;
57-static LOGFONT Prnlf;
59+static LOGFONTA Prnlf;
5860 static HFONT PrnFont[AttrFontMask+1];
5961 static int PrnFW, PrnFH;
6062 static RECT Margin;
@@ -124,7 +126,7 @@
124126
125127 BOOL PrnStart(LPSTR DocumentName)
126128 {
127- DOCINFO Doc;
129+ DOCINFOA Doc;
128130 char DocName[50];
129131 CWnd* pParent;
130132
@@ -146,13 +148,13 @@
146148
147149 SetAbortProc(PrintDC,PrnAbortProc);
148150
149- Doc.cbSize = sizeof(DOCINFO);
151+ Doc.cbSize = sizeof(Doc);
150152 strncpy_s(DocName,sizeof(DocName),DocumentName,_TRUNCATE);
151153 Doc.lpszDocName = DocName;
152154 Doc.lpszOutput = NULL;
153155 Doc.lpszDatatype = NULL;
154156 Doc.fwType = 0;
155- if (StartDoc(PrintDC, &Doc) > 0) {
157+ if (StartDocA(PrintDC, &Doc) > 0) {
156158 Printing = TRUE;
157159 }
158160 else {
@@ -243,7 +245,7 @@
243245 (int)((float)ts.PrnMargin[3] / 100.0 * (float)PPI.y);
244246
245247 /* create test font */
246- memset(&Prnlf, 0, sizeof(LOGFONT));
248+ memset(&Prnlf, 0, sizeof(Prnlf));
247249
248250 if (ts.PrnFont[0]==0) {
249251 Prnlf.lfHeight = ts.VTFontSize.y;
@@ -266,7 +268,7 @@
266268 Prnlf.lfQuality = DEFAULT_QUALITY;
267269 Prnlf.lfPitchAndFamily = FIXED_PITCH | FF_DONTCARE;
268270
269- PrnFont[0] = CreateFontIndirect(&Prnlf);
271+ PrnFont[0] = CreateFontIndirectA(&Prnlf);
270272
271273 DC = GetDC(HVTWin);
272274 SelectObject(DC, PrnFont[0]);
@@ -285,7 +287,7 @@
285287 /* Normal Font */
286288 Prnlf.lfWeight = FW_NORMAL;
287289 Prnlf.lfUnderline = 0;
288- PrnFont[0] = CreateFontIndirect(&Prnlf);
290+ PrnFont[0] = CreateFontIndirectA(&Prnlf);
289291 SelectObject(PrintDC,PrnFont[0]);
290292 GetTextMetrics(PrintDC, &Metrics);
291293 PrnFW = Metrics.tmAveCharWidth;
@@ -292,16 +294,16 @@
292294 PrnFH = Metrics.tmHeight;
293295 /* Under line */
294296 Prnlf.lfUnderline = 1;
295- PrnFont[AttrUnder] = CreateFontIndirect(&Prnlf);
297+ PrnFont[AttrUnder] = CreateFontIndirectA(&Prnlf);
296298
297299 if (ts.FontFlag & FF_BOLD) {
298300 /* Bold */
299301 Prnlf.lfUnderline = 0;
300302 Prnlf.lfWeight = FW_BOLD;
301- PrnFont[AttrBold] = CreateFontIndirect(&Prnlf);
303+ PrnFont[AttrBold] = CreateFontIndirectA(&Prnlf);
302304 /* Bold + Underline */
303305 Prnlf.lfUnderline = 1;
304- PrnFont[AttrBold | AttrUnder] = CreateFontIndirect(&Prnlf);
306+ PrnFont[AttrBold | AttrUnder] = CreateFontIndirectA(&Prnlf);
305307 }
306308 else {
307309 PrnFont[AttrBold] = PrnFont[AttrDefault];
@@ -315,7 +317,7 @@
315317 Prnlf.lfCharSet = SYMBOL_CHARSET;
316318
317319 strncpy_s(Prnlf.lfFaceName, sizeof(Prnlf.lfFaceName),"Tera Special", _TRUNCATE);
318- PrnFont[AttrSpecial] = CreateFontIndirect(&Prnlf);
320+ PrnFont[AttrSpecial] = CreateFontIndirectA(&Prnlf);
319321 PrnFont[AttrSpecial | AttrBold] = PrnFont[AttrSpecial];
320322 PrnFont[AttrSpecial | AttrUnder] = PrnFont[AttrSpecial];
321323 PrnFont[AttrSpecial | AttrBold | AttrUnder] = PrnFont[AttrSpecial];
@@ -416,7 +418,7 @@
416418 Ptr2 = Ptr;
417419 do {
418420 Ptr1 = Ptr2;
419- Ptr2 = CharNext(Ptr1);
421+ Ptr2 = CharNextA(Ptr1);
420422 } while ((Ptr2!=NULL) && ((Ptr2-Ptr)<=i));
421423 i = Ptr1-Ptr;
422424 if (i<=0) {
@@ -428,7 +430,7 @@
428430 RText.right = PrnX + i*PrnFW;
429431 RText.top = PrnY;
430432 RText.bottom = PrnY+PrnFH;
431- ExtTextOut(PrintDC,PrnX,PrnY,6,&RText,Ptr,i,&PrnDx[0]);
433+ ExtTextOutA(PrintDC,PrnX,PrnY,6,&RText,Ptr,i,&PrnDx[0]);
432434 PrnX = RText.right;
433435 Count=Count-i;
434436 Ptr = Ptr + i;
@@ -474,8 +476,8 @@
474476 return;
475477 }
476478 if (PrnFName[0] == 0) {
477- GetTempPath(sizeof(Temp),Temp);
478- if (GetTempFileName(Temp,"tmp",0,PrnFName)==0) {
479+ GetTempPathA(sizeof(Temp),Temp);
480+ if (GetTempFileNameA(Temp,"tmp",0,PrnFName)==0) {
479481 return;
480482 }
481483 HPrnFile = _lcreat(PrnFName,0);
--- trunk/teraterm/teraterm/vtwin.cpp (revision 7526)
+++ trunk/teraterm/teraterm/vtwin.cpp (revision 7527)
@@ -49,7 +49,6 @@
4949 #include "filesys.h"
5050 #include "telnet.h"
5151 #include "tektypes.h"
52-#include "tekwin.h"
5352 #include "ttdde.h"
5453 #include "ttlib.h"
5554 #include "helpid.h"
@@ -79,6 +78,7 @@
7978 #include "winjump.h"
8079 #include "sizetip.h"
8180 #include "dnddlg.h"
81+#include "tekwin.h"
8282 #include "compat_win.h"
8383
8484 #include "initguid.h"
Show on old repository browser