From fbf9a38fea6861f311197e4cd6e0adbcc8035134 Mon Sep 17 00:00:00 2001 From: zmatsuo <6488847+zmatsuo@users.noreply.github.com> Date: Sat, 28 Sep 2024 01:05:46 +0900 Subject: [PATCH] =?UTF-8?q?Window=E3=82=BF=E3=83=96=E3=81=AE=E4=B8=8D?= =?UTF-8?q?=E5=85=B7=E5=90=88=E4=BF=AE=E6=AD=A3=20#84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Windowタブで設定した色が反映されなかったので修正 - VTWinとTekWinから呼び出されたときに表示内容を変更するようにした - 修正前はどちらの内容が表示されるか不定だった - その他設定ダイアログの読み出し元を親ウィンドウとして扱うよう修正 - TekWinからその他設定ダイアログが表示されたときWindowタブのみ表示するようにした --- teraterm/common/tttypes.h | 2 +- teraterm/teraterm/addsetting.cpp | 70 +++++--- teraterm/teraterm/addsetting.h | 7 + teraterm/teraterm/tekwin.cpp | 2 - teraterm/teraterm/term_pp.cpp | 22 +-- teraterm/teraterm/vtwin.cpp | 128 +++++++-------- teraterm/teraterm/vtwin.h | 4 +- teraterm/teraterm/win_pp.cpp | 274 +++++++++++++------------------ teraterm/ttpdlg/choosefontdlg.c | 93 +---------- teraterm/ttpdlg/dlg_res.h | 2 - teraterm/ttpdlg/generaldlg.c | 4 +- teraterm/ttpdlg/keyboarddlg.c | 4 +- teraterm/ttpdlg/tcpipdlg.c | 5 +- teraterm/ttpdlg/termdlg.c | 4 +- teraterm/ttpdlg/ttdlg.c | 5 +- teraterm/ttpdlg/ttpdlg.rc | 6 - teraterm/ttpdlg/windlg.cpp | 4 +- 17 files changed, 255 insertions(+), 381 deletions(-) diff --git a/teraterm/common/tttypes.h b/teraterm/common/tttypes.h index 5a3e1ac23..cd293e45d 100644 --- a/teraterm/common/tttypes.h +++ b/teraterm/common/tttypes.h @@ -379,7 +379,7 @@ struct tttset { WORD TerminalID; WORD TermFlag; /*------ WinSet --------*/ - WORD VTFlag; + WORD reserve_VTFlag; HFONT SampleFont; WORD reserve_TmpColor[12][6]; /* Tera Term window setup variables */ diff --git a/teraterm/teraterm/addsetting.cpp b/teraterm/teraterm/addsetting.cpp index 2781f012e..865d85381 100644 --- a/teraterm/teraterm/addsetting.cpp +++ b/teraterm/teraterm/addsetting.cpp @@ -1492,14 +1492,18 @@ void CCygwinPropPageDlg::OnHelp() CAddSettingPropSheetDlg::CAddSettingPropSheetDlg(HINSTANCE hInstance, HWND hParentWnd): TTCPropSheetDlg(hInstance, hParentWnd, ts.UILanguageFileW) { + AddsettingWin parent_win = AddsettingCheckWin(hParentWnd); + // CPP,tmfcTTCPropertyPagehNX琶 int i = 0; - m_Page[i++] = new CGeneralPropPageDlg(hInstance); - m_Page[i++] = new CSequencePropPageDlg(hInstance); - m_Page[i++] = new CCopypastePropPageDlg(hInstance); - m_Page[i++] = new CVisualPropPageDlg(hInstance); - m_Page[i++] = new CLogPropPageDlg(hInstance); - m_Page[i++] = new CCygwinPropPageDlg(hInstance); + if (parent_win == ADDSETTING_WIN_VT) { + m_Page[i++] = new CGeneralPropPageDlg(hInstance); + m_Page[i++] = new CSequencePropPageDlg(hInstance); + m_Page[i++] = new CCopypastePropPageDlg(hInstance); + m_Page[i++] = new CVisualPropPageDlg(hInstance); + m_Page[i++] = new CLogPropPageDlg(hInstance); + m_Page[i++] = new CCygwinPropPageDlg(hInstance); + } if ((GetKeyState(VK_CONTROL) & 0x8000) != 0 || (GetKeyState(VK_SHIFT) & 0x8000) != 0 ) { m_Page[i++] = new CDebugPropPage(hInstance); @@ -1513,20 +1517,22 @@ CAddSettingPropSheetDlg::CAddSettingPropSheetDlg(HINSTANCE hInstance, HWND hPare } // TTCPropertyPage gpȂ PropertyPage - page = CodingPageCreate(hInstance, &ts); - AddPage(page); - page = FontPageCreate(hInstance, &ts); - AddPage(page); - page = ThemePageCreate(hInstance, &ts); - AddPage(page); - page = KeyboardPageCreate(hInstance, &ts); - AddPage(page); - page = MousePageCreate(hInstance, &ts); - AddPage(page); - page = TcpIPPageCreate(hInstance, &ts); - AddPage(page); - page = CreateTerminalPP(hInstance, hParentWnd, & ts); - AddPage(page); + if (parent_win == ADDSETTING_WIN_VT) { + page = CodingPageCreate(hInstance, &ts); + AddPage(page); + page = FontPageCreate(hInstance, &ts); + AddPage(page); + page = ThemePageCreate(hInstance, &ts); + AddPage(page); + page = KeyboardPageCreate(hInstance, &ts); + AddPage(page); + page = MousePageCreate(hInstance, &ts); + AddPage(page); + page = TcpIPPageCreate(hInstance, &ts); + AddPage(page); + page = CreateTerminalPP(hInstance, hParentWnd, & ts); + AddPage(page); + } page = CreateWinPP(hInstance, hParentWnd, &ts); AddPage(page); @@ -1573,3 +1579,27 @@ void CAddSettingPropSheetDlg::SetStartPage(Page page) } TTCPropSheetDlg::SetStartPage(start_page); } + +/** + * hWnd ǂ̃EBhEׂ + * hWnd VTWINTEKWIN̂͂ + */ +AddsettingWin AddsettingCheckWin(HWND hWnd) +{ + if (hWnd == NULL) { + // ActiveWin g? + assert(false); + if (ActiveWin == IdTEK) + hWnd = HTEKWin; + else + hWnd = HVTWin; + } + if (hWnd == HVTWin) { + return ADDSETTING_WIN_VT; + } + else if (hWnd == HTEKWin) { + return ADDSETTING_WIN_TEK; + } + assert(false); + return ADDSETTING_WIN_VT; +} diff --git a/teraterm/teraterm/addsetting.h b/teraterm/teraterm/addsetting.h index e21bb2a70..4469ca256 100644 --- a/teraterm/teraterm/addsetting.h +++ b/teraterm/teraterm/addsetting.h @@ -76,3 +76,10 @@ typedef enum { TermPage, WinPage, } CAddSettingPropSheetDlgPage; + +typedef enum { + ADDSETTING_WIN_VT, + ADDSETTING_WIN_TEK, +} AddsettingWin; + +AddsettingWin AddsettingCheckWin(HWND hWnd); diff --git a/teraterm/teraterm/tekwin.cpp b/teraterm/teraterm/tekwin.cpp index 98af54aa7..3f9acccbc 100644 --- a/teraterm/teraterm/tekwin.cpp +++ b/teraterm/teraterm/tekwin.cpp @@ -721,7 +721,6 @@ void CTEKWindow::OnSetupWindow() WORD OldEmu; HelpId = HlpTEKSetupWindow; - ts.VTFlag = 0; ts.SampleFont = tk.TEKFont[0]; if (! LoadTTDLG()) { @@ -744,7 +743,6 @@ void CTEKWindow::OnSetupFont() BOOL Ok; HelpId = HlpTEKSetupFont; - ts.VTFlag = 0; if (! LoadTTDLG()) { return; } diff --git a/teraterm/teraterm/term_pp.cpp b/teraterm/teraterm/term_pp.cpp index 87209dc12..a18b6d7d2 100644 --- a/teraterm/teraterm/term_pp.cpp +++ b/teraterm/teraterm/term_pp.cpp @@ -73,7 +73,6 @@ typedef struct { static INT_PTR CALLBACK TermDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam) { static const DlgTextInfo TextInfosCom[] = { - { 0, "DLG_TERM_TITLE" }, { IDC_TERMWIDTHLABEL, "DLG_TERM_WIDTHLABEL" }, { IDC_TERMISWIN, "DLG_TERM_ISWIN" }, { IDC_TERMRESIZE, "DLG_TERM_RESIZE" }, @@ -84,9 +83,6 @@ static INT_PTR CALLBACK TermDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM { IDC_TERMLOCALECHO, "DLG_TERM_LOCALECHO" }, { IDC_TERMANSBACKTEXT, "DLG_TERM_ANSBACK" }, { IDC_TERMAUTOSWITCH, "DLG_TERM_AUTOSWITCH" }, - { IDOK, "BTN_OK" }, - { IDCANCEL, "BTN_CANCEL" }, - { IDC_TERMHELP, "BTN_HELP" }, }; WORD w; @@ -155,10 +151,6 @@ static INT_PTR CALLBACK TermDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM SetRB(Dialog,ts->AutoWinSwitch,IDC_TERMAUTOSWITCH,IDC_TERMAUTOSWITCH); - ShowWindow(GetDlgItem(Dialog, IDOK), FALSE); - ShowWindow(GetDlgItem(Dialog, IDCANCEL), FALSE); - ShowWindow(GetDlgItem(Dialog, IDC_TERMHELP), FALSE); - return TRUE; } @@ -226,7 +218,6 @@ static INT_PTR CALLBACK TermDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM return TRUE; } else if (nmhdr->code == PSN_HELP) { - wParam = IDC_TERMHELP; const WPARAM HelpId = HlpMenuSetupAdditionalTerminal; PostMessage(data->VTWin, WM_USER_DLGHELP2, HelpId, 0); break; @@ -275,25 +266,22 @@ static UINT CALLBACK CallBack(HWND hwnd, UINT uMsg, struct _PROPSHEETPAGEW *ppsp HPROPSHEETPAGE CreateTerminalPP(HINSTANCE inst, HWND vtwin, TTTSet *pts) { - int id = IDD_TERMDLG; - PROPSHEETPAGEW_V1 psp = {}; - DialogData *data; - wchar_t *uimsg; - - data = (DialogData *)malloc(sizeof(*data)); + DialogData *data = (DialogData *)calloc(1, sizeof(*data)); data->pts = &ts; data->VTWin = vtwin; + PROPSHEETPAGEW_V1 psp = {}; psp.dwSize = sizeof(psp); psp.dwFlags = PSP_DEFAULT | PSP_USECALLBACK | PSP_USETITLE | PSP_HASHELP; psp.hInstance = inst; psp.pfnCallback = CallBack; + wchar_t *uimsg; GetI18nStrWW("Tera Term", "DLG_TERM_TITLE", L"Tera Term: Terminal setup", pts->UILanguageFileW, &uimsg); psp.pszTitle = uimsg; - psp.pszTemplate = MAKEINTRESOURCEW(id); + psp.pszTemplate = MAKEINTRESOURCEW(IDD_TERMDLG); #if defined(REWRITE_TEMPLATE) psp.dwFlags |= PSP_DLGINDIRECT; - psp.pResource = TTGetDlgTemplate(inst, MAKEINTRESOURCEW(id)); + psp.pResource = TTGetDlgTemplate(inst, MAKEINTRESOURCEW(IDD_TERMDLG)); #endif psp.pfnDlgProc = TermDlg; psp.lParam = (LPARAM)data; diff --git a/teraterm/teraterm/vtwin.cpp b/teraterm/teraterm/vtwin.cpp index 02539ad26..5d7cdc90a 100644 --- a/teraterm/teraterm/vtwin.cpp +++ b/teraterm/teraterm/vtwin.cpp @@ -4072,7 +4072,10 @@ void CVTWindow::OnFileQVSend() void CVTWindow::OnFileChangeDir() { - OpenExternalSetup(CAddSettingPropSheetDlg::DefaultPage); + if (! LoadTTDLG()) { + return; + } + (*ChangeDirectory)(HVTWin, &ts); } void CVTWindow::OnFilePrint() @@ -4208,60 +4211,86 @@ void CVTWindow::OnEditCancelSelection() ChangeSelectRegion(); } -void CVTWindow::OpenExternalSetup(CAddSettingPropSheetDlg::Page page) +/** + * Additional Setting \ + */ +BOOL CVTWindow::OpenExternalSetup(HWND hWndParent, CAddSettingPropSheetDlg::Page page) { BOOL old_use_unicode_api = UnicodeDebugParam.UseUnicodeApi; + char *orgTitle = _strdup(ts.Title); + ts.SampleFont = VTFont[0]; // for Window^u SetDialogFont(ts.DialogFontNameW, ts.DialogFontPoint, ts.DialogFontCharSet, ts.UILanguageFileW, "Tera Term", "DLG_TAHOMA_FONT"); - CAddSettingPropSheetDlg CAddSetting(m_hInst, HVTWin); + CAddSettingPropSheetDlg CAddSetting(m_hInst, hWndParent); CAddSetting.SetTreeViewMode(ts.ExperimentalTreeProprtySheetEnable); CAddSetting.SetStartPage(page); INT_PTR ret = CAddSetting.DoModal(); if (ret == IDOK) { + // General^u + { + ResetCharSet(); + ResetIME(); + } + // Window^u + { + SetColor(); + + // ^CgύXĂA[g^CgNA + if ((ts.AcceptTitleChangeRequest == IdTitleChangeRequestOverwrite) && + (strcmp(orgTitle, ts.Title) != 0)) { + free(cv.TitleRemoteW); + cv.TitleRemoteW = NULL; + } + } + ChangeWin(); ChangeFont(); - if (old_use_unicode_api != UnicodeDebugParam.UseUnicodeApi) { - BuffSetDispAPI(UnicodeDebugParam.UseUnicodeApi); - } - // R[fBO^uŐݒ肪ωƂR[Kv - SetupTerm(); + // Encoding^u + { + if (old_use_unicode_api != UnicodeDebugParam.UseUnicodeApi) { + BuffSetDispAPI(UnicodeDebugParam.UseUnicodeApi); + } + + // R[fBO^u(Terminal tab)Őݒ肪ωƂR[Kv + SetupTerm(); + } TelUpdateKeepAliveInterval(); + + // keyboard^u + { + //ResetKeypadMode(TRUE); + //ResetIME(); + } } + free(orgTitle); + + return (ret == IDOK) ? TRUE : FALSE; } /** * NXO炻̑̐ݒJ߂ɒlj */ -void OpenExternalSetupOutside(CAddSettingPropSheetDlgPage page) +BOOL OpenExternalSetupOutside(HWND hWndParent, CAddSettingPropSheetDlgPage page) { - pVTWin->OpenExternalSetup((CAddSettingPropSheetDlg::Page)page); + return pVTWin->OpenExternalSetup(hWndParent, (CAddSettingPropSheetDlg::Page)page); } -// Additional settings dialog -// -// (2004.9.5 yutaka) new added -// (2005.2.22 yutaka) changed to Tab Control -// (2008.5.12 maya) changed to PropertySheet +/** + * Additional settings dialog + */ void CVTWindow::OnExternalSetup() { - OpenExternalSetup(CAddSettingPropSheetDlg::DefaultPage); + OpenExternalSetup(m_hWnd, CAddSettingPropSheetDlg::DefaultPage); } void CVTWindow::OnSetupTerminal() { - BOOL Ok; - HelpId = HlpSetupTerminal; if (! LoadTTDLG()) { return; } - SetDialogFont(ts.DialogFontNameW, ts.DialogFontPoint, ts.DialogFontCharSet, - ts.UILanguageFileW, "Tera Term", "DLG_SYSTEM_FONT"); - Ok = (*SetupTerminal)(HVTWin, &ts); - if (Ok) { - SetupTerm(); - } + (*SetupTerminal)(HVTWin, &ts); } /** @@ -4291,41 +4320,16 @@ void CVTWindow::SetColor() void CVTWindow::OnSetupWindow() { - BOOL Ok; - - HelpId = HlpSetupWindow; - ts.VTFlag = 1; ts.SampleFont = VTFont[0]; - if (! LoadTTDLG()) { return; } - - SetDialogFont(ts.DialogFontNameW, ts.DialogFontPoint, ts.DialogFontCharSet, - ts.UILanguageFileW, "Tera Term", "DLG_SYSTEM_FONT"); - char *orgTitle = _strdup(ts.Title); - Ok = (*SetupWin)(HVTWin, &ts); - - if (Ok) { - SetColor(); - - // ^CgύXĂA[g^CgNA - if ((ts.AcceptTitleChangeRequest == IdTitleChangeRequestOverwrite) && - (strcmp(orgTitle, ts.Title) != 0)) { - free(cv.TitleRemoteW); - cv.TitleRemoteW = NULL; - } - - ChangeFont(); - ChangeWin(); - } - - free(orgTitle); + (*SetupWin)(HVTWin, &ts); } void CVTWindow::OnSetupFont() { - OpenExternalSetup(CAddSettingPropSheetDlg::FontPage); + (*ChooseFontDlg)(HVTWin, NULL, &ts); } static UINT_PTR CALLBACK TFontHook(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam) @@ -4348,20 +4352,11 @@ static UINT_PTR CALLBACK TFontHook(HWND Dialog, UINT Message, WPARAM wParam, LPA void CVTWindow::OnSetupKeyboard() { - BOOL Ok; - HelpId = HlpSetupKeyboard; if (! LoadTTDLG()) { return; } - SetDialogFont(ts.DialogFontNameW, ts.DialogFontPoint, ts.DialogFontCharSet, - ts.UILanguageFileW, "Tera Term", "DLG_SYSTEM_FONT"); - Ok = (*SetupKeyboard)(HVTWin, &ts); - - if (Ok) { -// ResetKeypadMode(TRUE); - ResetIME(); - } + (*SetupKeyboard)(HVTWin, &ts); } void CVTWindow::OnSetupSerialPort() @@ -4426,7 +4421,7 @@ void CVTWindow::OnSetupSerialPort() void CVTWindow::OnSetupTCPIP() { - OpenExternalSetup(CAddSettingPropSheetDlg::TcpIpPage); + (*SetupTCPIP)(HVTWin, &ts); } void CVTWindow::OnSetupGeneral() @@ -4435,12 +4430,7 @@ void CVTWindow::OnSetupGeneral() if (! LoadTTDLG()) { return; } - SetDialogFont(ts.DialogFontNameW, ts.DialogFontPoint, ts.DialogFontCharSet, - ts.UILanguageFileW, "Tera Term", "DLG_SYSTEM_FONT"); - if ((*SetupGeneral)(HVTWin,&ts)) { - ResetCharSet(); - ResetIME(); - } + (*SetupGeneral)(HVTWin,&ts); } void CVTWindow::OnSetupSave() @@ -5216,7 +5206,7 @@ LRESULT CVTWindow::Proc(UINT msg, WPARAM wp, LPARAM lp) case ID_EDIT_SELECTSCREEN: OnEditSelectScreenBuffer(); break; case ID_SETUP_ADDITIONALSETTINGS: OnExternalSetup(); break; case ID_SETUP_ADDITIONALSETTINGS_CODING: { - OpenExternalSetup(CAddSettingPropSheetDlg::CodingPage); + OpenExternalSetup(m_hWnd, CAddSettingPropSheetDlg::CodingPage); break; } case ID_SETUP_TERMINAL: OnSetupTerminal(); break; diff --git a/teraterm/teraterm/vtwin.h b/teraterm/teraterm/vtwin.h index 1f52ee218..34a088495 100644 --- a/teraterm/teraterm/vtwin.h +++ b/teraterm/teraterm/vtwin.h @@ -240,7 +240,7 @@ class CVTWindow : public TTCFrameWnd void CodePopup(int client_x, int client_y); void SetColor(); public: - void OpenExternalSetup(CAddSettingPropSheetDlg::Page page); + BOOL OpenExternalSetup(HWND hWndParent, CAddSettingPropSheetDlg::Page page); }; #endif @@ -249,7 +249,7 @@ extern "C" { #endif void VtwinSetHelpId(DWORD data); -void OpenExternalSetupOutside(CAddSettingPropSheetDlgPage page); +BOOL OpenExternalSetupOutside(HWND hWndParent, CAddSettingPropSheetDlgPage page); #ifdef __cplusplus } diff --git a/teraterm/teraterm/win_pp.cpp b/teraterm/teraterm/win_pp.cpp index 29ccd39e4..e309af7d6 100644 --- a/teraterm/teraterm/win_pp.cpp +++ b/teraterm/teraterm/win_pp.cpp @@ -45,8 +45,8 @@ #include "win32helper.h" #include "compat_win.h" #include "asprintf.h" -#include "ttwinman.h" #include "color_sample.h" +#include "addsetting.h" // for AddsettingCheckWin() #include "win_pp.h" @@ -56,13 +56,11 @@ typedef struct { WORD TmpColor[12][6]; PTTSet ts; - HFONT SampleFont; WORD VTFlag; HWND VTWin; + ColorSample *cs; } WinDlgWork; -static ColorSample *cs; - static void DispSample(HWND Dialog, WinDlgWork *work, int IAttr) { COLORREF Text, Back; @@ -72,7 +70,7 @@ static void DispSample(HWND Dialog, WinDlgWork *work, int IAttr) Back = RGB(work->TmpColor[IAttr][3], work->TmpColor[IAttr][4], work->TmpColor[IAttr][5]); - ColorSampleSetColor(cs, Text, Back); + ColorSampleSetColor(work->cs, Text, Back); } static void ChangeColor(HWND Dialog, WinDlgWork *work, int IAttr, int IOffset) @@ -121,7 +119,6 @@ static void RestoreVar(HWND Dialog, WinDlgWork* work, int *IAttr, int *IOffset) static INT_PTR CALLBACK WinDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam) { static const DlgTextInfo TextInfos[] = { - { 0, "DLG_WIN_TITLE" }, { IDC_WINTITLELABEL, "DLG_WIN_TITLELABEL" }, { IDC_WINCURSOR, "DLG_WIN_CURSOR" }, { IDC_WINBLOCK, "DLG_WIN_BLOCK" }, @@ -143,9 +140,6 @@ static INT_PTR CALLBACK WinDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM { IDC_WINGREENLABEL, "DLG_WIN_G" }, { IDC_WINBLUELABEL, "DLG_WIN_B" }, { IDC_WINUSENORMALBG, "DLG_WIN_ALWAYSBG" }, - { IDOK, "BTN_OK" }, - { IDCANCEL, "BTN_CANCEL" }, - { IDC_WINHELP, "BTN_HELP" }, }; PTTSet ts; HWND Wnd, HRed, HGreen, HBlue; @@ -250,7 +244,7 @@ static INT_PTR CALLBACK WinDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM SetRB(Dialog,ts->CursorShape,IDC_WINBLOCK,IDC_WINHORZ); - cs = ColorSampleInit(GetDlgItem(Dialog, IDC_DRAW_SAMPLE_AREA)); + work->cs = ColorSampleInit(GetDlgItem(Dialog, IDC_DRAW_SAMPLE_AREA)); IAttr = 0; IOffset = 0; @@ -266,135 +260,124 @@ static INT_PTR CALLBACK WinDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM ChangeSB(Dialog,work,IAttr,IOffset); - //CenterWindow(Dialog, GetParent(Dialog)); - - ShowWindow(GetDlgItem(Dialog, IDOK), SW_HIDE); - ShowWindow(GetDlgItem(Dialog, IDCANCEL), SW_HIDE); - ShowWindow(GetDlgItem(Dialog, IDC_WINHELP), SW_HIDE); - - return TRUE; - case WM_NOTIFY: - case WM_COMMAND: + case WM_NOTIFY: { ts = work->ts; RestoreVar(Dialog,work,&IAttr,&IOffset); assert(IAttr < _countof(work->TmpColor)); - if (Message == WM_NOTIFY) { - NMHDR *nmhdr = (NMHDR *)lParam; - if (nmhdr->code == PSN_APPLY) { - wParam = IDOK; - } - else if (nmhdr->code == PSN_HELP) { - wParam = IDC_WINHELP; - } - else { - break; - } - } - switch (LOWORD(wParam)) { - case IDOK: { - WORD w; - //HDC DC; - GetDlgItemText(Dialog, IDC_WINTITLE, ts->Title, sizeof(ts->Title)); - GetRB(Dialog, &ts->HideTitle, IDC_WINHIDETITLE, IDC_WINHIDETITLE); - GetRB(Dialog, &w, IDC_NO_FRAME, IDC_NO_FRAME); - ts->EtermLookfeel.BGNoFrame = w; - GetRB(Dialog, &ts->PopupMenu, IDC_WINHIDEMENU, IDC_WINHIDEMENU); - // DC = GetDC(Dialog); - if (work->VTFlag > 0) { - GetRB(Dialog, &i, IDC_WINCOLOREMU, IDC_WINCOLOREMU); - if (i != 0) { - ts->ColorFlag |= CF_PCBOLD16; - } - else { - ts->ColorFlag &= ~(WORD)CF_PCBOLD16; - } - GetRB(Dialog, &i, IDC_WINAIXTERM16, IDC_WINAIXTERM16); - if (i != 0) { - ts->ColorFlag |= CF_AIXTERM16; - } - else { - ts->ColorFlag &= ~(WORD)CF_AIXTERM16; - } - GetRB(Dialog, &i, IDC_WINXTERM256, IDC_WINXTERM256); - if (i != 0) { - ts->ColorFlag |= CF_XTERM256; - } - else { - ts->ColorFlag &= ~(WORD)CF_XTERM256; - } - GetRB(Dialog, &ts->EnableScrollBuff, IDC_WINSCROLL1, IDC_WINSCROLL1); - if (ts->EnableScrollBuff > 0) { - ts->ScrollBuffSize = - GetDlgItemInt(Dialog,IDC_WINSCROLL2,NULL,FALSE); - } - for (i = 0; i <= 1; i++) { - ts->VTColor[i] = - RGB(work->TmpColor[0][i*3], - work->TmpColor[0][i*3+1], - work->TmpColor[0][i*3+2]); - ts->VTBoldColor[i] = - RGB(work->TmpColor[1][i*3], - work->TmpColor[1][i*3+1], - work->TmpColor[1][i*3+2]); - ts->VTBlinkColor[i] = - RGB(work->TmpColor[2][i*3], - work->TmpColor[2][i*3+1], - work->TmpColor[2][i*3+2]); - ts->VTReverseColor[i] = - RGB(work->TmpColor[3][i*3], - work->TmpColor[3][i*3+1], - work->TmpColor[3][i*3+2]); - ts->URLColor[i] = - RGB(work->TmpColor[4][i*3], - work->TmpColor[4][i*3+1], - work->TmpColor[4][i*3+2]); - ts->VTUnderlineColor[i] = - RGB(work->TmpColor[5][i * 3], - work->TmpColor[5][i * 3 + 1], - work->TmpColor[5][i * 3 + 2]); + NMHDR *nmhdr = (NMHDR *)lParam; + switch (nmhdr->code) { + case PSN_APPLY: { + WORD w; + //HDC DC; + GetDlgItemText(Dialog, IDC_WINTITLE, ts->Title, sizeof(ts->Title)); + GetRB(Dialog, &ts->HideTitle, IDC_WINHIDETITLE, IDC_WINHIDETITLE); + GetRB(Dialog, &w, IDC_NO_FRAME, IDC_NO_FRAME); + ts->EtermLookfeel.BGNoFrame = w; + GetRB(Dialog, &ts->PopupMenu, IDC_WINHIDEMENU, IDC_WINHIDEMENU); + // DC = GetDC(Dialog); + if (work->VTFlag > 0) { + GetRB(Dialog, &i, IDC_WINCOLOREMU, IDC_WINCOLOREMU); + if (i != 0) { + ts->ColorFlag |= CF_PCBOLD16; + } + else { + ts->ColorFlag &= ~(WORD)CF_PCBOLD16; + } + GetRB(Dialog, &i, IDC_WINAIXTERM16, IDC_WINAIXTERM16); + if (i != 0) { + ts->ColorFlag |= CF_AIXTERM16; + } + else { + ts->ColorFlag &= ~(WORD)CF_AIXTERM16; + } + GetRB(Dialog, &i, IDC_WINXTERM256, IDC_WINXTERM256); + if (i != 0) { + ts->ColorFlag |= CF_XTERM256; + } + else { + ts->ColorFlag &= ~(WORD)CF_XTERM256; + } + GetRB(Dialog, &ts->EnableScrollBuff, IDC_WINSCROLL1, IDC_WINSCROLL1); + if (ts->EnableScrollBuff > 0) { + ts->ScrollBuffSize = + GetDlgItemInt(Dialog,IDC_WINSCROLL2,NULL,FALSE); + } + for (i = 0; i <= 1; i++) { + ts->VTColor[i] = + RGB(work->TmpColor[0][i*3], + work->TmpColor[0][i*3+1], + work->TmpColor[0][i*3+2]); + ts->VTBoldColor[i] = + RGB(work->TmpColor[1][i*3], + work->TmpColor[1][i*3+1], + work->TmpColor[1][i*3+2]); + ts->VTBlinkColor[i] = + RGB(work->TmpColor[2][i*3], + work->TmpColor[2][i*3+1], + work->TmpColor[2][i*3+2]); + ts->VTReverseColor[i] = + RGB(work->TmpColor[3][i*3], + work->TmpColor[3][i*3+1], + work->TmpColor[3][i*3+2]); + ts->URLColor[i] = + RGB(work->TmpColor[4][i*3], + work->TmpColor[4][i*3+1], + work->TmpColor[4][i*3+2]); + ts->VTUnderlineColor[i] = + RGB(work->TmpColor[5][i * 3], + work->TmpColor[5][i * 3 + 1], + work->TmpColor[5][i * 3 + 2]); #if 0 - ts->VTColor[i] = GetNearestColor(DC, ts->VTColor[i]); - ts->VTBoldColor[i] = GetNearestColor(DC, ts->VTBoldColor[i]); - ts->VTBlinkColor[i] = GetNearestColor(DC, ts->VTBlinkColor[i]); - ts->VTReverseColor[i] = GetNearestColor(DC, ts->VTReverseColor[i]); - ts->URLColor[i] = GetNearestColor(DC, ts->URLColor[i]); + ts->VTColor[i] = GetNearestColor(DC, ts->VTColor[i]); + ts->VTBoldColor[i] = GetNearestColor(DC, ts->VTBoldColor[i]); + ts->VTBlinkColor[i] = GetNearestColor(DC, ts->VTBlinkColor[i]); + ts->VTReverseColor[i] = GetNearestColor(DC, ts->VTReverseColor[i]); + ts->URLColor[i] = GetNearestColor(DC, ts->URLColor[i]); #endif - } - GetRB(Dialog, &ts->UseNormalBGColor, - IDC_WINUSENORMALBG, IDC_WINUSENORMALBG); - GetRB(Dialog, &i, IDC_FONTBOLD, IDC_FONTBOLD); - if (i > 0) { - ts->FontFlag |= FF_BOLD; - } - else { - ts->FontFlag &= ~(WORD)FF_BOLD; - } + } + GetRB(Dialog, &ts->UseNormalBGColor, + IDC_WINUSENORMALBG, IDC_WINUSENORMALBG); + GetRB(Dialog, &i, IDC_FONTBOLD, IDC_FONTBOLD); + if (i > 0) { + ts->FontFlag |= FF_BOLD; } else { - for (i = 0; i <= 1; i++) { - ts->TEKColor[i] = - RGB(work->TmpColor[0][i*3], - work->TmpColor[0][i*3+1], - work->TmpColor[0][i*3+2]); + ts->FontFlag &= ~(WORD)FF_BOLD; + } + } + else { + for (i = 0; i <= 1; i++) { + ts->TEKColor[i] = + RGB(work->TmpColor[0][i*3], + work->TmpColor[0][i*3+1], + work->TmpColor[0][i*3+2]); #if 0 - ts->TEKColor[i] = GetNearestColor(DC, ts->TEKColor[i]); + ts->TEKColor[i] = GetNearestColor(DC, ts->TEKColor[i]); #endif - } - GetRB(Dialog, &ts->TEKColorEmu, IDC_WINCOLOREMU, IDC_WINCOLOREMU); } - // ReleaseDC(Dialog,DC); - - GetRB(Dialog, &ts->CursorShape, IDC_WINBLOCK, IDC_WINHORZ); - //EndDialog(Dialog, 1); - return TRUE; + GetRB(Dialog, &ts->TEKColorEmu, IDC_WINCOLOREMU, IDC_WINCOLOREMU); } + // ReleaseDC(Dialog,DC); - case IDCANCEL: - //EndDialog(Dialog, 0); - return TRUE; - + GetRB(Dialog, &ts->CursorShape, IDC_WINBLOCK, IDC_WINHORZ); + //EndDialog(Dialog, 1); + return TRUE; + } + case PSN_HELP: { + const WPARAM HelpId = work->VTFlag > 0 ? HlpMenuSetupAdditionalWindow : HlpTEKSetupWindow; + PostMessage(work->VTWin, WM_USER_DLGHELP2, HelpId, 0); + break; + } + } + break; + } + case WM_COMMAND: + ts = work->ts; + RestoreVar(Dialog,work,&IAttr,&IOffset); + assert(IAttr < _countof(work->TmpColor)); + switch (LOWORD(wParam)) { case IDC_WINHIDETITLE: GetRB(Dialog,&i,IDC_WINHIDETITLE,IDC_WINHIDETITLE); if (i>0) { @@ -444,13 +427,7 @@ static INT_PTR CALLBACK WinDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM case IDC_WINATTR: ChangeSB(Dialog,work,IAttr,IOffset); break; - - case IDC_WINHELP: { - const WPARAM HelpId = work->VTFlag > 0 ? HlpMenuSetupAdditionalWindow : HlpTEKSetupWindow; - PostMessage(work->VTWin, WM_USER_DLGHELP2, HelpId, 0); - break; } - } break; case WM_HSCROLL: @@ -545,27 +522,23 @@ static UINT CALLBACK CallBack(HWND hwnd, UINT uMsg, struct _PROPSHEETPAGEW *ppsp HPROPSHEETPAGE CreateWinPP(HINSTANCE inst, HWND vtwin, TTTSet *pts) { - int id; - PROPSHEETPAGEW_V1 psp = { 0 }; - WinDlgWork *data; - wchar_t *uimsg; -// BOOL r; - - id = IDD_WINDLG; - data = (WinDlgWork *)malloc(sizeof(*data)); - data->ts = &ts; - data-> VTWin = vtwin; + WinDlgWork *data = (WinDlgWork *)calloc(1, sizeof(*data)); + data->ts = pts; + data->VTWin = vtwin; + data->VTFlag = AddsettingCheckWin(vtwin) == ADDSETTING_WIN_VT ? 1 : 0; + PROPSHEETPAGEW_V1 psp = {}; psp.dwSize = sizeof(psp); psp.dwFlags = PSP_DEFAULT | PSP_USECALLBACK | PSP_USETITLE | PSP_HASHELP; psp.hInstance = inst; psp.pfnCallback = CallBack; + wchar_t *uimsg; GetI18nStrWW("Tera Term", "DLG_WIN_TITLE", L"Tera Term: Terminal win...", pts->UILanguageFileW, &uimsg); psp.pszTitle = uimsg; - psp.pszTemplate = MAKEINTRESOURCEW(id); + psp.pszTemplate = MAKEINTRESOURCEW(IDD_WINDLG); #if defined(REWRITE_TEMPLATE) psp.dwFlags |= PSP_DLGINDIRECT; - psp.pResource = TTGetDlgTemplate(inst, MAKEINTRESOURCEW(id)); + psp.pResource = TTGetDlgTemplate(inst, MAKEINTRESOURCEW(IDD_WINDLG)); #endif psp.pfnDlgProc = WinDlg; psp.lParam = (LPARAM)data; @@ -574,18 +547,3 @@ HPROPSHEETPAGE CreateWinPP(HINSTANCE inst, HWND vtwin, TTTSet *pts) free(uimsg); return hpsp; } - -#if 0 -BOOL WINAPI _SetupWin(HWND WndParent, PTTSet ts) -{ - WinDlgWork *work = (WinDlgWork *)calloc(sizeof(*work), 1); - INT_PTR r; - work->ts = ts; - work->SampleFont = ts->SampleFont; - work->VTFlag = ts->VTFlag; - work->VTWin = WndParent; - r = TTDialogBoxParam(hInst, MAKEINTRESOURCE(IDD_WINDLG), WndParent, WinDlg, (LPARAM)work); - free(work); - return (BOOL)r; -} -#endif diff --git a/teraterm/ttpdlg/choosefontdlg.c b/teraterm/ttpdlg/choosefontdlg.c index c03cd02c3..b1e40b2d6 100644 --- a/teraterm/ttpdlg/choosefontdlg.c +++ b/teraterm/ttpdlg/choosefontdlg.c @@ -27,96 +27,13 @@ */ /* choosefont dialog */ -#include "teraterm.h" -#include -#include -#include -#include -#define _CRTDBG_MAP_ALLOC -#include -#include -#include - -#include "tttypes.h" -#include "ttlib.h" -#include "dlglib.h" -#include "ttcommon.h" -#include "dlg_res.h" -#include "codeconv.h" -#include "helpid.h" -#include "asprintf.h" -#include "win32helper.h" -#include "compat_win.h" -#include "asprintf.h" -#include "ttwinman.h" - +#include +#include "vtwin.h" #include "ttdlg.h" -static UINT_PTR CALLBACK TFontHook(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam) -{ - switch (Message) { - case WM_INITDIALOG: - { - const PTTSet ts = (PTTSet)((CHOOSEFONTA *)lParam)->lCustData; - wchar_t *uimsg; - - //EnableWindow(GetDlgItem(Dialog, cmb2), FALSE); - - GetI18nStrWW("Tera Term", "DLG_CHOOSEFONT_STC6", L"\"Font style\" selection here won't affect actual font appearance.", - ts->UILanguageFileW, &uimsg); - SetDlgItemTextW(Dialog, stc6, uimsg); - free(uimsg); - - SetFocus(GetDlgItem(Dialog,cmb1)); - - CenterWindow(Dialog, GetParent(Dialog)); - - break; - } -#if 0 - case WM_COMMAND: - if (LOWORD(wParam) == cmb2) { - if (HIWORD(wParam) == CBN_SELCHANGE) { - // tHg̕ύXɂ(bZ[Wɂ)X^C̕ύXł - // cmb2 ̒ʒmȂ - SendMessage(GetDlgItem(Dialog, cmb2), CB_GETCURSEL, 0, 0); - } - } - else if (LOWORD(wParam) == cmb1) { - if (HIWORD(wParam) == CBN_SELCHANGE) { - // tHg̕ύXOɈꎞۑꂽX^C - // 𔲂Ƃɉ߂ăZbgĂ܂悤 - SendMessage(GetDlgItem(Dialog, cmb2), CB_GETCURSEL, 0, 0); - } - } - break; -#endif - } - return FALSE; -} - BOOL WINAPI _ChooseFontDlg(HWND WndParent, LPLOGFONTA LogFont, const TTTSet *ts) { - CHOOSEFONTA cf; - BOOL Ok; - - memset(&cf, 0, sizeof(cf)); - cf.lStructSize = sizeof(cf); - cf.hwndOwner = WndParent; - cf.lpLogFont = LogFont; - cf.Flags = - CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT | - CF_FIXEDPITCHONLY | - //CF_SHOWHELP | - CF_NOVERTFONTS | - CF_ENABLEHOOK; - if (ts->ListHiddenFonts) { - cf.Flags |= CF_INACTIVEFONTS; - } - cf.lpfnHook = TFontHook; - cf.nFontType = REGULAR_FONTTYPE; - cf.hInstance = hInst; - cf.lCustData = (LPARAM)ts; - Ok = ChooseFontA(&cf); - return Ok; + (void)ts; + (void)LogFont; + return OpenExternalSetupOutside(WndParent, FontPage); } diff --git a/teraterm/ttpdlg/dlg_res.h b/teraterm/ttpdlg/dlg_res.h index 8f2bda12c..e29452a07 100644 --- a/teraterm/ttpdlg/dlg_res.h +++ b/teraterm/ttpdlg/dlg_res.h @@ -22,7 +22,6 @@ #define IDC_TERMAUTOSWITCH 111 #define IDC_TERMRUSSHOST 120 #define IDC_TERMRUSSCLIENT 121 -#define IDC_TERMHELP 199 #define IDD_WINDLG 200 #define IDC_WINTITLE 201 #define IDC_WINBLOCK 202 @@ -50,7 +49,6 @@ #define IDC_NO_FRAME 224 #define IDC_DRAW_SAMPLE_AREA 225 #define IDC_WINUSENORMALBG 231 -#define IDC_WINHELP 299 #define IDD_KEYBDLG 300 #define IDC_KEYBBS 301 #define IDC_KEYBDEL 302 diff --git a/teraterm/ttpdlg/generaldlg.c b/teraterm/ttpdlg/generaldlg.c index fdf0e69fe..b501dff33 100644 --- a/teraterm/ttpdlg/generaldlg.c +++ b/teraterm/ttpdlg/generaldlg.c @@ -33,8 +33,6 @@ BOOL WINAPI _SetupGeneral(HWND WndParent, PTTSet ts) { - (void)WndParent; (void)ts; - OpenExternalSetupOutside(GeneralPage); - return FALSE; + return OpenExternalSetupOutside(WndParent, GeneralPage); } diff --git a/teraterm/ttpdlg/keyboarddlg.c b/teraterm/ttpdlg/keyboarddlg.c index c5d7c8162..dfd5bd2c7 100644 --- a/teraterm/ttpdlg/keyboarddlg.c +++ b/teraterm/ttpdlg/keyboarddlg.c @@ -35,8 +35,6 @@ BOOL WINAPI _SetupKeyboard(HWND WndParent, PTTSet ts) { - (void)WndParent; (void)ts; - OpenExternalSetupOutside(KeyboardPage); - return FALSE; + return OpenExternalSetupOutside(WndParent, KeyboardPage); } diff --git a/teraterm/ttpdlg/tcpipdlg.c b/teraterm/ttpdlg/tcpipdlg.c index d42900d10..06ae74eb4 100644 --- a/teraterm/ttpdlg/tcpipdlg.c +++ b/teraterm/ttpdlg/tcpipdlg.c @@ -31,11 +31,12 @@ #include #include "tttypes.h" +#include "vtwin.h" #include "ttdlg.h" BOOL WINAPI _SetupTCPIP(HWND WndParent, PTTSet ts) { - MessageBoxA(WndParent, "TCPIP Dialog was deleteed", "teraterm", MB_OK); - return FALSE; + (void)ts; + return OpenExternalSetupOutside(WndParent, TcpIpPage); } diff --git a/teraterm/ttpdlg/termdlg.c b/teraterm/ttpdlg/termdlg.c index 348c02eff..80e69408a 100644 --- a/teraterm/ttpdlg/termdlg.c +++ b/teraterm/ttpdlg/termdlg.c @@ -36,8 +36,6 @@ BOOL WINAPI _SetupTerminal(HWND WndParent, PTTSet ts) { - (void)WndParent; (void)ts; - OpenExternalSetupOutside(TermPage); - return FALSE; + return OpenExternalSetupOutside(WndParent, TermPage); } diff --git a/teraterm/ttpdlg/ttdlg.c b/teraterm/ttpdlg/ttdlg.c index 8cb1be05e..a825fa4a4 100644 --- a/teraterm/ttpdlg/ttdlg.c +++ b/teraterm/ttpdlg/ttdlg.c @@ -30,11 +30,12 @@ #include #include "tttypes.h" +#include "vtwin.h" #include "ttdlg.h" BOOL WINAPI _ChangeDirectory(HWND WndParent, PTTSet ts) { - MessageBoxA(WndParent, "ChangeDirectory Dialog was deleteed", "teraterm", MB_OK); - return FALSE; + (void)ts; + return OpenExternalSetupOutside(WndParent, GeneralPage); } diff --git a/teraterm/ttpdlg/ttpdlg.rc b/teraterm/ttpdlg/ttpdlg.rc index 08b157db7..000da3c25 100644 --- a/teraterm/ttpdlg/ttpdlg.rc +++ b/teraterm/ttpdlg/ttpdlg.rc @@ -75,9 +75,6 @@ BEGIN LTEXT "&Answerback:",IDC_TERMANSBACKTEXT,9,82,44,10,NOT WS_GROUP EDITTEXT IDC_TERMANSBACK,55,80,61,12,ES_AUTOHSCROLL | WS_GROUP CONTROL "A&uto switch (VT<->TEK)",IDC_TERMAUTOSWITCH,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,123,80,126,12 - DEFPUSHBUTTON "OK",IDOK,209,10,40,14,WS_GROUP - PUSHBUTTON "Cancel",IDCANCEL,209,30,40,14 - PUSHBUTTON "&Help",IDC_TERMHELP,209,54,40,14 END IDD_SERIALDLG DIALOGEX 20, 20, 234, 214 @@ -259,9 +256,6 @@ BEGIN LTEXT "255",IDC_WINBLUE,42,197,16,8 SCROLLBAR IDC_WINBLUEBAR,59,197,100,8,WS_TABSTOP CONTROL "Always &use Normal text's BG",IDC_WINUSENORMALBG,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,17,209,115,12 - DEFPUSHBUTTON "OK",1,194,4,40,16,WS_GROUP - PUSHBUTTON "Cancel",2,194,26,40,16 - PUSHBUTTON "&Help",IDC_WINHELP,194,48,40,16 CONTROL "",IDC_DRAW_SAMPLE_AREA,"Static",SS_BLACKFRAME,165,147,57,63 END diff --git a/teraterm/ttpdlg/windlg.cpp b/teraterm/ttpdlg/windlg.cpp index 5bff7ed00..e737c53da 100644 --- a/teraterm/ttpdlg/windlg.cpp +++ b/teraterm/ttpdlg/windlg.cpp @@ -35,8 +35,6 @@ BOOL WINAPI _SetupWin(HWND WndParent, PTTSet ts) { - (void)WndParent; (void)ts; - OpenExternalSetupOutside(WinPage); - return FALSE; + return OpenExternalSetupOutside(WndParent, WinPage); }