Skip to content

Commit

Permalink
Windowタブの不具合修正 #84
Browse files Browse the repository at this point in the history
- Windowタブで設定した色が反映されなかったので修正
- VTWinとTekWinから呼び出されたときに表示内容を変更するようにした
  - 修正前はどちらの内容が表示されるか不定だった
- その他設定ダイアログの読み出し元を親ウィンドウとして扱うよう修正
- TekWinからその他設定ダイアログが表示されたときWindowタブのみ表示するようにした
  • Loading branch information
zmatsuo committed Sep 27, 2024
1 parent dcda4ab commit fbf9a38
Show file tree
Hide file tree
Showing 17 changed files with 255 additions and 381 deletions.
2 changes: 1 addition & 1 deletion teraterm/common/tttypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
70 changes: 50 additions & 20 deletions teraterm/teraterm/addsetting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1492,14 +1492,18 @@ void CCygwinPropPageDlg::OnHelp()
CAddSettingPropSheetDlg::CAddSettingPropSheetDlg(HINSTANCE hInstance, HWND hParentWnd):
TTCPropSheetDlg(hInstance, hParentWnd, ts.UILanguageFileW)
{
AddsettingWin parent_win = AddsettingCheckWin(hParentWnd);

// CPP,tmfcのTTCPropertyPage派生クラスから生成
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);
Expand All @@ -1513,20 +1517,22 @@ CAddSettingPropSheetDlg::CAddSettingPropSheetDlg(HINSTANCE hInstance, HWND hPare
}

// TTCPropertyPage を使用しない 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);

Expand Down Expand Up @@ -1573,3 +1579,27 @@ void CAddSettingPropSheetDlg::SetStartPage(Page page)
}
TTCPropSheetDlg::SetStartPage(start_page);
}

/**
* hWnd がどのウィンドウか調べる
* hWnd は VTWINかTEKWINのはず
*/
AddsettingWin AddsettingCheckWin(HWND hWnd)
{
if (hWnd == NULL) {
// ActiveWin が使える?
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;
}
7 changes: 7 additions & 0 deletions teraterm/teraterm/addsetting.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,10 @@ typedef enum {
TermPage,
WinPage,
} CAddSettingPropSheetDlgPage;

typedef enum {
ADDSETTING_WIN_VT,
ADDSETTING_WIN_TEK,
} AddsettingWin;

AddsettingWin AddsettingCheckWin(HWND hWnd);
2 changes: 0 additions & 2 deletions teraterm/teraterm/tekwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,6 @@ void CTEKWindow::OnSetupWindow()
WORD OldEmu;

HelpId = HlpTEKSetupWindow;
ts.VTFlag = 0;
ts.SampleFont = tk.TEKFont[0];

if (! LoadTTDLG()) {
Expand All @@ -744,7 +743,6 @@ void CTEKWindow::OnSetupFont()
BOOL Ok;

HelpId = HlpTEKSetupFont;
ts.VTFlag = 0;
if (! LoadTTDLG()) {
return;
}
Expand Down
22 changes: 5 additions & 17 deletions teraterm/teraterm/term_pp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand All @@ -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;

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Loading

0 comments on commit fbf9a38

Please sign in to comment.