Revision: 9941 https://osdn.net/projects/ttssh2/scm/svn/commits/9941 Author: zmatsuo Date: 2022-05-21 22:55:57 +0900 (Sat, 21 May 2022) Log Message: ----------- TTTSet.TmpColor を使用しないようにした - 次の箇所でしか使用していない - iniファイルの読み込み - window設定ダイアログ - ローカル変数へ切り替え - farキーワードを削除 Modified Paths: -------------- trunk/teraterm/common/tttypes.h trunk/teraterm/ttpdlg/ttdlg.c trunk/teraterm/ttpset/ttset.c -------------- next part -------------- Modified: trunk/teraterm/common/tttypes.h =================================================================== --- trunk/teraterm/common/tttypes.h 2022-05-21 12:37:50 UTC (rev 9940) +++ trunk/teraterm/common/tttypes.h 2022-05-21 13:55:57 UTC (rev 9941) @@ -430,10 +430,7 @@ /*------ WinSet --------*/ WORD VTFlag; HFONT SampleFont; - /* begin - ishizaki */ - /* WORD TmpColor[3][6]; */ - WORD TmpColor[12][6]; - /* end - ishizaki */ + WORD reserve_TmpColor[12][6]; /* Tera Term window setup variables */ char Title[TitleBuffSize]; WORD TitleFormat; Modified: trunk/teraterm/ttpdlg/ttdlg.c =================================================================== --- trunk/teraterm/ttpdlg/ttdlg.c 2022-05-21 12:37:50 UTC (rev 9940) +++ trunk/teraterm/ttpdlg/ttdlg.c 2022-05-21 13:55:57 UTC (rev 9941) @@ -427,7 +427,17 @@ return FALSE; } -void DispSample(HWND Dialog, PTTSet ts, int IAttr) +////////////////////////////////////////////////////////////////////////////// +// WinDlg + +typedef struct { + WORD TmpColor[12][6]; + PTTSet ts; + HFONT SampleFont; + WORD VTFlag; +} WinDlgWork; + +static void DispSample(HWND Dialog, WinDlgWork *work, int IAttr) { int i,x,y; COLORREF Text, Back; @@ -438,17 +448,17 @@ HDC DC; DC = GetDC(Dialog); - Text = RGB(ts->TmpColor[IAttr][0], - ts->TmpColor[IAttr][1], - ts->TmpColor[IAttr][2]); + Text = RGB(work->TmpColor[IAttr][0], + work->TmpColor[IAttr][1], + work->TmpColor[IAttr][2]); Text = GetNearestColor(DC, Text); - Back = RGB(ts->TmpColor[IAttr][3], - ts->TmpColor[IAttr][4], - ts->TmpColor[IAttr][5]); + Back = RGB(work->TmpColor[IAttr][3], + work->TmpColor[IAttr][4], + work->TmpColor[IAttr][5]); Back = GetNearestColor(DC, Back); SetTextColor(DC, Text); SetBkColor(DC, Back); - SelectObject(DC,ts->SampleFont); + SelectObject(DC,work->SampleFont); GetTextMetrics(DC, &Metrics); FW = Metrics.tmAveCharWidth; FH = Metrics.tmHeight; @@ -470,16 +480,16 @@ ReleaseDC(Dialog,DC); } -void ChangeColor(HWND Dialog, PTTSet ts, int IAttr, int IOffset) +static void ChangeColor(HWND Dialog, WinDlgWork *work, int IAttr, int IOffset) { - SetDlgItemInt(Dialog,IDC_WINRED,ts->TmpColor[IAttr][IOffset],FALSE); - SetDlgItemInt(Dialog,IDC_WINGREEN,ts->TmpColor[IAttr][IOffset+1],FALSE); - SetDlgItemInt(Dialog,IDC_WINBLUE,ts->TmpColor[IAttr][IOffset+2],FALSE); + SetDlgItemInt(Dialog,IDC_WINRED,work->TmpColor[IAttr][IOffset],FALSE); + SetDlgItemInt(Dialog,IDC_WINGREEN,work->TmpColor[IAttr][IOffset+1],FALSE); + SetDlgItemInt(Dialog,IDC_WINBLUE,work->TmpColor[IAttr][IOffset+2],FALSE); - DispSample(Dialog,ts,IAttr); + DispSample(Dialog,work,IAttr); } -void ChangeSB (HWND Dialog, PTTSet ts, int IAttr, int IOffset) +static void ChangeSB(HWND Dialog, WinDlgWork *work, int IAttr, int IOffset) { HWND HRed, HGreen, HBlue; @@ -487,13 +497,13 @@ HGreen = GetDlgItem(Dialog, IDC_WINGREENBAR); HBlue = GetDlgItem(Dialog, IDC_WINBLUEBAR); - SetScrollPos(HRed,SB_CTL,ts->TmpColor[IAttr][IOffset+0],TRUE); - SetScrollPos(HGreen,SB_CTL,ts->TmpColor[IAttr][IOffset+1],TRUE); - SetScrollPos(HBlue,SB_CTL,ts->TmpColor[IAttr][IOffset+2],TRUE); - ChangeColor(Dialog,ts,IAttr,IOffset); + SetScrollPos(HRed,SB_CTL,work->TmpColor[IAttr][IOffset+0],TRUE); + SetScrollPos(HGreen,SB_CTL,work->TmpColor[IAttr][IOffset+1],TRUE); + SetScrollPos(HBlue,SB_CTL,work->TmpColor[IAttr][IOffset+2],TRUE); + ChangeColor(Dialog,work,IAttr,IOffset); } -void RestoreVar(HWND Dialog, PTTSet ts, int *IAttr, int *IOffset) +static void RestoreVar(HWND Dialog, WinDlgWork* work, int *IAttr, int *IOffset) { WORD w; @@ -504,7 +514,7 @@ else { *IOffset = 0; } - if ((ts!=NULL) && (ts->VTFlag>0)) { + if (work->VTFlag>0) { *IAttr = GetCurSel(Dialog,IDC_WINATTR); if (*IAttr>0) (*IAttr)--; } @@ -551,11 +561,13 @@ int IAttr, IOffset; WORD i, pos, ScrollCode, NewPos; HDC DC; + WinDlgWork *work = (WinDlgWork *)GetWindowLongPtr(Dialog,DWLP_USER); switch (Message) { case WM_INITDIALOG: - ts = (PTTSet)lParam; + work = (WinDlgWork *)lParam;; SetWindowLongPtr(Dialog, DWLP_USER, lParam); + ts = work->ts; SetDlgTextsW(Dialog, TextInfos, _countof(TextInfos), ts->UILanguageFileW); SetDlgItemTextA(Dialog, IDC_WINTITLE, ts->Title); @@ -567,7 +579,7 @@ if ( ts->HideTitle>0 ) DisableDlgItem(Dialog,IDC_WINHIDEMENU,IDC_WINHIDEMENU); - if (ts->VTFlag>0) { + if (work->VTFlag>0) { wchar_t *uimsg; GetI18nStrWW("Tera Term", "DLG_WIN_PCBOLD16", L"&16 Colors (PC style)", ts->UILanguageFileW, &uimsg); SetDlgItemTextW(Dialog, IDC_WINCOLOREMU, uimsg); @@ -597,12 +609,12 @@ // VTReverseColor\x82\xAA\x97L\x8C\xF8\x82̎\x9E\x82\xCD // VTColor\x82\xC6VTReverseColor\x82\xF0\x93\xFC\x82\xEA\x91ւ\xA6\x82\xE9 // - ts->TmpColor[0][i*3] = GetRValue(ts->VTReverseColor[i]); - ts->TmpColor[0][i*3+1] = GetGValue(ts->VTReverseColor[i]); - ts->TmpColor[0][i*3+2] = GetBValue(ts->VTReverseColor[i]); - ts->TmpColor[3][i*3] = GetRValue(ts->VTColor[i]); - ts->TmpColor[3][i*3+1] = GetGValue(ts->VTColor[i]); - ts->TmpColor[3][i*3+2] = GetBValue(ts->VTColor[i]); + work->TmpColor[0][i*3] = GetRValue(ts->VTReverseColor[i]); + work->TmpColor[0][i*3+1] = GetGValue(ts->VTReverseColor[i]); + work->TmpColor[0][i*3+2] = GetBValue(ts->VTReverseColor[i]); + work->TmpColor[3][i*3] = GetRValue(ts->VTColor[i]); + work->TmpColor[3][i*3+1] = GetGValue(ts->VTColor[i]); + work->TmpColor[3][i*3+2] = GetBValue(ts->VTColor[i]); } else { // @@ -610,40 +622,40 @@ // \x81EVTColor\x82̕\xB6\x8E\x9A\x90F\x82Ɣw\x8Ci\x90F\x82\xF0\x93\xFC\x82\xEA\x91ւ\xA6\x82\xE9 // \x81EVTReverseColor\x82͂\xA2\x82\xB6\x82\xE7\x82Ȃ\xA2 // - ts->TmpColor[0][i*3] = GetRValue(ts->VTColor[!i]); - ts->TmpColor[0][i*3+1] = GetGValue(ts->VTColor[!i]); - ts->TmpColor[0][i*3+2] = GetBValue(ts->VTColor[!i]); + work->TmpColor[0][i*3] = GetRValue(ts->VTColor[!i]); + work->TmpColor[0][i*3+1] = GetGValue(ts->VTColor[!i]); + work->TmpColor[0][i*3+2] = GetBValue(ts->VTColor[!i]); } // // \x91\xBC\x82̑\xAE\x90\xAB\x90F\x82͕\xB6\x8E\x9A\x90F\x82Ɣw\x8Ci\x90F\x82\xF0\x93\xFC\x82\xEA\x91ւ\xA6\x82\xE9 // - ts->TmpColor[1][i*3] = GetRValue(ts->VTBoldColor[!i]); - ts->TmpColor[1][i*3+1] = GetGValue(ts->VTBoldColor[!i]); - ts->TmpColor[1][i*3+2] = GetBValue(ts->VTBoldColor[!i]); - ts->TmpColor[2][i*3] = GetRValue(ts->VTBlinkColor[!i]); - ts->TmpColor[2][i*3+1] = GetGValue(ts->VTBlinkColor[!i]); - ts->TmpColor[2][i*3+2] = GetBValue(ts->VTBlinkColor[!i]); - ts->TmpColor[4][i*3] = GetRValue(ts->URLColor[!i]); - ts->TmpColor[4][i*3+1] = GetGValue(ts->URLColor[!i]); - ts->TmpColor[4][i*3+2] = GetBValue(ts->URLColor[!i]); + work->TmpColor[1][i*3] = GetRValue(ts->VTBoldColor[!i]); + work->TmpColor[1][i*3+1] = GetGValue(ts->VTBoldColor[!i]); + work->TmpColor[1][i*3+2] = GetBValue(ts->VTBoldColor[!i]); + work->TmpColor[2][i*3] = GetRValue(ts->VTBlinkColor[!i]); + work->TmpColor[2][i*3+1] = GetGValue(ts->VTBlinkColor[!i]); + work->TmpColor[2][i*3+2] = GetBValue(ts->VTBlinkColor[!i]); + work->TmpColor[4][i*3] = GetRValue(ts->URLColor[!i]); + work->TmpColor[4][i*3+1] = GetGValue(ts->URLColor[!i]); + work->TmpColor[4][i*3+2] = GetBValue(ts->URLColor[!i]); } else { - ts->TmpColor[0][i*3] = GetRValue(ts->VTColor[i]); - ts->TmpColor[0][i*3+1] = GetGValue(ts->VTColor[i]); - ts->TmpColor[0][i*3+2] = GetBValue(ts->VTColor[i]); - ts->TmpColor[1][i*3] = GetRValue(ts->VTBoldColor[i]); - ts->TmpColor[1][i*3+1] = GetGValue(ts->VTBoldColor[i]); - ts->TmpColor[1][i*3+2] = GetBValue(ts->VTBoldColor[i]); - ts->TmpColor[2][i*3] = GetRValue(ts->VTBlinkColor[i]); - ts->TmpColor[2][i*3+1] = GetGValue(ts->VTBlinkColor[i]); - ts->TmpColor[2][i*3+2] = GetBValue(ts->VTBlinkColor[i]); - ts->TmpColor[3][i*3] = GetRValue(ts->VTReverseColor[i]); - ts->TmpColor[3][i*3+1] = GetGValue(ts->VTReverseColor[i]); - ts->TmpColor[3][i*3+2] = GetBValue(ts->VTReverseColor[i]); + work->TmpColor[0][i*3] = GetRValue(ts->VTColor[i]); + work->TmpColor[0][i*3+1] = GetGValue(ts->VTColor[i]); + work->TmpColor[0][i*3+2] = GetBValue(ts->VTColor[i]); + work->TmpColor[1][i*3] = GetRValue(ts->VTBoldColor[i]); + work->TmpColor[1][i*3+1] = GetGValue(ts->VTBoldColor[i]); + work->TmpColor[1][i*3+2] = GetBValue(ts->VTBoldColor[i]); + work->TmpColor[2][i*3] = GetRValue(ts->VTBlinkColor[i]); + work->TmpColor[2][i*3+1] = GetGValue(ts->VTBlinkColor[i]); + work->TmpColor[2][i*3+2] = GetBValue(ts->VTBlinkColor[i]); + work->TmpColor[3][i*3] = GetRValue(ts->VTReverseColor[i]); + work->TmpColor[3][i*3+1] = GetGValue(ts->VTReverseColor[i]); + work->TmpColor[3][i*3+2] = GetBValue(ts->VTReverseColor[i]); /* begin - ishizaki */ - ts->TmpColor[4][i*3] = GetRValue(ts->URLColor[i]); - ts->TmpColor[4][i*3+1] = GetGValue(ts->URLColor[i]); - ts->TmpColor[4][i*3+2] = GetBValue(ts->URLColor[i]); + work->TmpColor[4][i*3] = GetRValue(ts->URLColor[i]); + work->TmpColor[4][i*3+1] = GetGValue(ts->URLColor[i]); + work->TmpColor[4][i*3+2] = GetBValue(ts->URLColor[i]); /* end - ishizaki */ } } @@ -667,9 +679,9 @@ } else { for (i = 0 ; i <=1 ; i++) { - ts->TmpColor[0][i*3] = GetRValue(ts->TEKColor[i]); - ts->TmpColor[0][i*3+1] = GetGValue(ts->TEKColor[i]); - ts->TmpColor[0][i*3+2] = GetBValue(ts->TEKColor[i]); + work->TmpColor[0][i*3] = GetRValue(ts->TEKColor[i]); + work->TmpColor[0][i*3+1] = GetGValue(ts->TEKColor[i]); + work->TmpColor[0][i*3+2] = GetBValue(ts->TEKColor[i]); } SetRB(Dialog,ts->TEKColorEmu,IDC_WINCOLOREMU,IDC_WINCOLOREMU); } @@ -689,7 +701,7 @@ HBlue = GetDlgItem(Dialog, IDC_WINBLUEBAR); SetScrollRange(HBlue,SB_CTL,0,255,TRUE); - ChangeSB(Dialog,ts,IAttr,IOffset); + ChangeSB(Dialog,work,IAttr,IOffset); CenterWindow(Dialog, GetParent(Dialog)); @@ -696,8 +708,8 @@ return TRUE; case WM_COMMAND: - ts = (PTTSet)GetWindowLongPtr(Dialog,DWLP_USER); - RestoreVar(Dialog,ts,&IAttr,&IOffset); + ts = work->ts; + RestoreVar(Dialog,work,&IAttr,&IOffset); switch (LOWORD(wParam)) { case IDOK: if ( ts!=NULL ) { @@ -705,7 +717,7 @@ GetRB(Dialog,&ts->HideTitle,IDC_WINHIDETITLE,IDC_WINHIDETITLE); GetRB(Dialog,&ts->PopupMenu,IDC_WINHIDEMENU,IDC_WINHIDEMENU); DC = GetDC(Dialog); - if (ts->VTFlag>0) { + if (work->VTFlag>0) { GetRB(Dialog,&i,IDC_WINCOLOREMU,IDC_WINCOLOREMU); if (i!=0) { ts->ColorFlag |= CF_PCBOLD16; @@ -743,13 +755,13 @@ // VTColor\x82\xC6VTReverseColor\x82\xF0\x93\xFC\x82\xEA\x91ւ\xA6\x82\xE9 // ts->VTReverseColor[i] = - RGB(ts->TmpColor[0][i*3], - ts->TmpColor[0][i*3+1], - ts->TmpColor[0][i*3+2]); + RGB(work->TmpColor[0][i*3], + work->TmpColor[0][i*3+1], + work->TmpColor[0][i*3+2]); ts->VTColor[i] = - RGB(ts->TmpColor[3][i*3], - ts->TmpColor[3][i*3+1], - ts->TmpColor[3][i*3+2]); + RGB(work->TmpColor[3][i*3], + work->TmpColor[3][i*3+1], + work->TmpColor[3][i*3+2]); } else { // @@ -758,48 +770,48 @@ // \x81EVTReverseColor\x82͂\xA2\x82\xB6\x82\xE7\x82Ȃ\xA2 // ts->VTColor[i] = - RGB(ts->TmpColor[0][(!i)*3], - ts->TmpColor[0][(!i)*3+1], - ts->TmpColor[0][(!i)*3+2]); + RGB(work->TmpColor[0][(!i)*3], + work->TmpColor[0][(!i)*3+1], + work->TmpColor[0][(!i)*3+2]); } // // \x81E\x91\xBC\x82̑\xAE\x90\xAB\x90F\x82͕\xB6\x8E\x9A\x90F\x82Ɣw\x8Ci\x90F\x82\xF0\x93\xFC\x82\xEA\x91ւ\xA6\x82\xE9 // ts->VTBoldColor[i] = - RGB(ts->TmpColor[1][(!i)*3], - ts->TmpColor[1][(!i)*3+1], - ts->TmpColor[1][(!i)*3+2]); + RGB(work->TmpColor[1][(!i)*3], + work->TmpColor[1][(!i)*3+1], + work->TmpColor[1][(!i)*3+2]); ts->VTBlinkColor[i] = - RGB(ts->TmpColor[2][(!i)*3], - ts->TmpColor[2][(!i)*3+1], - ts->TmpColor[2][(!i)*3+2]); + RGB(work->TmpColor[2][(!i)*3], + work->TmpColor[2][(!i)*3+1], + work->TmpColor[2][(!i)*3+2]); ts->URLColor[i] = - RGB(ts->TmpColor[4][(!i)*3], - ts->TmpColor[4][(!i)*3+1], - ts->TmpColor[4][(!i)*3+2]); + RGB(work->TmpColor[4][(!i)*3], + work->TmpColor[4][(!i)*3+1], + work->TmpColor[4][(!i)*3+2]); } else { ts->VTColor[i] = - RGB(ts->TmpColor[0][i*3], - ts->TmpColor[0][i*3+1], - ts->TmpColor[0][i*3+2]); + RGB(work->TmpColor[0][i*3], + work->TmpColor[0][i*3+1], + work->TmpColor[0][i*3+2]); ts->VTBoldColor[i] = - RGB(ts->TmpColor[1][i*3], - ts->TmpColor[1][i*3+1], - ts->TmpColor[1][i*3+2]); + RGB(work->TmpColor[1][i*3], + work->TmpColor[1][i*3+1], + work->TmpColor[1][i*3+2]); ts->VTBlinkColor[i] = - RGB(ts->TmpColor[2][i*3], - ts->TmpColor[2][i*3+1], - ts->TmpColor[2][i*3+2]); + RGB(work->TmpColor[2][i*3], + work->TmpColor[2][i*3+1], + work->TmpColor[2][i*3+2]); ts->VTReverseColor[i] = - RGB(ts->TmpColor[3][i*3], - ts->TmpColor[3][i*3+1], - ts->TmpColor[3][i*3+2]); + RGB(work->TmpColor[3][i*3], + work->TmpColor[3][i*3+1], + work->TmpColor[3][i*3+2]); /* begin - ishizaki */ ts->URLColor[i] = - RGB(ts->TmpColor[4][i*3], - ts->TmpColor[4][i*3+1], - ts->TmpColor[4][i*3+2]); + RGB(work->TmpColor[4][i*3], + work->TmpColor[4][i*3+1], + work->TmpColor[4][i*3+2]); /* end - ishizaki */ } ts->VTColor[i] = GetNearestColor(DC,ts->VTColor[i]); @@ -861,9 +873,9 @@ else { for (i = 0 ; i <= 1 ; i++) { ts->TEKColor[i] = - RGB(ts->TmpColor[0][i*3], - ts->TmpColor[0][i*3+1], - ts->TmpColor[0][i*3+2]); + RGB(work->TmpColor[0][i*3], + work->TmpColor[0][i*3+1], + work->TmpColor[0][i*3+2]); ts->TEKColor[i] = GetNearestColor(DC,ts->TEKColor[i]); } GetRB(Dialog,&ts->TEKColorEmu,IDC_WINCOLOREMU,IDC_WINCOLOREMU); @@ -890,9 +902,6 @@ break; case IDC_WINSCROLL1: - if ( ts==NULL ) { - return TRUE; - } GetRB(Dialog,&i,IDC_WINSCROLL1,IDC_WINSCROLL1); if ( i>0 ) { EnableDlgItem(Dialog,IDC_WINSCROLL2,IDC_WINSCROLL3); @@ -903,46 +912,35 @@ break; case IDC_WINTEXT: - if ( ts==NULL ) { - return TRUE; - } IOffset = 0; - ChangeSB(Dialog,ts,IAttr,IOffset); + ChangeSB(Dialog,work,IAttr,IOffset); break; case IDC_WINBACK: - if ( ts==NULL ) { - return TRUE; - } IOffset = 3; - ChangeSB(Dialog,ts,IAttr,IOffset); + ChangeSB(Dialog,work,IAttr,IOffset); break; case IDC_WINREV: - if ( ts==NULL ) { - return TRUE; - } - i = ts->TmpColor[IAttr][0]; - ts->TmpColor[IAttr][0] = ts->TmpColor[IAttr][3]; - ts->TmpColor[IAttr][3] = i; - i = ts->TmpColor[IAttr][1]; - ts->TmpColor[IAttr][1] = ts->TmpColor[IAttr][4]; - ts->TmpColor[IAttr][4] = i; - i = ts->TmpColor[IAttr][2]; - ts->TmpColor[IAttr][2] = ts->TmpColor[IAttr][5]; - ts->TmpColor[IAttr][5] = i; + i = work->TmpColor[IAttr][0]; + work->TmpColor[IAttr][0] = work->TmpColor[IAttr][3]; + work->TmpColor[IAttr][3] = i; + i = work->TmpColor[IAttr][1]; + work->TmpColor[IAttr][1] = work->TmpColor[IAttr][4]; + work->TmpColor[IAttr][4] = i; + i = work->TmpColor[IAttr][2]; + work->TmpColor[IAttr][2] = work->TmpColor[IAttr][5]; + work->TmpColor[IAttr][5] = i; - ChangeSB(Dialog,ts,IAttr,IOffset); + ChangeSB(Dialog,work,IAttr,IOffset); break; case IDC_WINATTR: - if ( ts!=NULL ) { - ChangeSB(Dialog,ts,IAttr,IOffset); - } + ChangeSB(Dialog,work,IAttr,IOffset); break; case IDC_WINHELP: { - const WPARAM HelpId = ts->VTFlag > 0 ? HlpSetupWindow : HlpTEKSetupWindow; + const WPARAM HelpId = work->VTFlag > 0 ? HlpSetupWindow : HlpTEKSetupWindow; PostMessage(GetParent(Dialog),WM_USER_DLGHELP2,HelpId,0); break; } @@ -950,20 +948,14 @@ break; case WM_PAINT: - ts = (PTTSet)GetWindowLongPtr(Dialog,DWLP_USER); - if ( ts==NULL ) { - return TRUE; - } - RestoreVar(Dialog,ts,&IAttr,&IOffset); - DispSample(Dialog,ts,IAttr); + ts = work->ts; + RestoreVar(Dialog,work,&IAttr,&IOffset); + DispSample(Dialog,work,IAttr); break; case WM_HSCROLL: - ts = (PTTSet)GetWindowLongPtr(Dialog,DWLP_USER); - if (ts==NULL) { - return TRUE; - } - RestoreVar(Dialog,ts,&IAttr,&IOffset); + ts = work->ts; + RestoreVar(Dialog,work,&IAttr,&IOffset); HRed = GetDlgItem(Dialog, IDC_WINREDBAR); HGreen = GetDlgItem(Dialog, IDC_WINGREENBAR); HBlue = GetDlgItem(Dialog, IDC_WINBLUEBAR); @@ -982,7 +974,7 @@ else { return TRUE; } - pos = ts->TmpColor[IAttr][i]; + pos = work->TmpColor[IAttr][i]; switch (ScrollCode) { case SB_BOTTOM: pos = 255; @@ -1023,9 +1015,9 @@ if (pos > 255) { pos = 255; } - ts->TmpColor[IAttr][i] = pos; + work->TmpColor[IAttr][i] = pos; SetScrollPos(Wnd,SB_CTL,pos,TRUE); - ChangeColor(Dialog,ts,IAttr,IOffset); + ChangeColor(Dialog,work,IAttr,IOffset); return FALSE; } return FALSE; @@ -3222,10 +3214,14 @@ BOOL WINAPI _SetupWin(HWND WndParent, PTTSet ts) { - return - (BOOL)DialogBoxParam(hInst, - MAKEINTRESOURCE(IDD_WINDLG), - WndParent, WinDlg, (LPARAM)ts); + WinDlgWork *work = (WinDlgWork *)calloc(sizeof(*work), 1); + INT_PTR r; + work->ts = ts; + work->SampleFont = ts->SampleFont; + work->VTFlag = ts->VTFlag; + r = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_WINDLG), WndParent, WinDlg, (LPARAM)work); + free(work); + return (BOOL)r; } BOOL WINAPI _SetupKeyboard(HWND WndParent, PTTSet ts) Modified: trunk/teraterm/ttpset/ttset.c =================================================================== --- trunk/teraterm/ttpset/ttset.c 2022-05-21 12:37:50 UTC (rev 9940) +++ trunk/teraterm/ttpset/ttset.c 2022-05-21 13:55:57 UTC (rev 9941) @@ -740,6 +740,7 @@ HDC TmpDC; char Temp[MAX_PATH], Temp2[MAX_PATH], *p; wchar_t TempW[MAX_PATH]; + WORD TmpColor[12][6]; ts->Minimize = 0; ts->HideWindow = 0; @@ -808,13 +809,13 @@ /* VT win position */ GetPrivateProfileString(Section, "VTPos", "-2147483648,-2147483648", Temp, sizeof(Temp), FName); /* default: random position */ - GetNthNum(Temp, 1, (int far *) (&ts->VTPos.x)); - GetNthNum(Temp, 2, (int far *) (&ts->VTPos.y)); + GetNthNum(Temp, 1, (int *) (&ts->VTPos.x)); + GetNthNum(Temp, 2, (int *) (&ts->VTPos.y)); /* TEK win position */ GetPrivateProfileString(Section, "TEKPos", "-2147483648,-2147483648", Temp, sizeof(Temp), FName); /* default: random position */ - GetNthNum(Temp, 1, (int far *) &(ts->TEKPos.x)); - GetNthNum(Temp, 2, (int far *) &(ts->TEKPos.y)); + GetNthNum(Temp, 1, (int *) &(ts->TEKPos.x)); + GetNthNum(Temp, 2, (int *) &(ts->TEKPos.y)); /* Save VT Window position */ ts->SaveVTWinPos = GetOnOff(Section, "SaveVTWinPos", FName, FALSE); @@ -974,21 +975,21 @@ GetPrivateProfileString(Section, "VTColor", "0,0,0,255,255,255", Temp, sizeof(Temp), FName); for (i = 0; i <= 5; i++) - GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i])); + GetNthNum(Temp, i + 1, (int *) &(TmpColor[0][i])); for (i = 0; i <= 1; i++) - ts->VTColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3], - (BYTE) ts->TmpColor[0][i * 3 + 1], - (BYTE) ts->TmpColor[0][i * 3 + 2]); + ts->VTColor[i] = RGB((BYTE) TmpColor[0][i * 3], + (BYTE) TmpColor[0][i * 3 + 1], + (BYTE) TmpColor[0][i * 3 + 2]); /* VT Bold Color */ GetPrivateProfileString(Section, "VTBoldColor", "0,0,255,255,255,255", Temp, sizeof(Temp), FName); for (i = 0; i <= 5; i++) - GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i])); + GetNthNum(Temp, i + 1, (int *) &(TmpColor[0][i])); for (i = 0; i <= 1; i++) - ts->VTBoldColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3], - (BYTE) ts->TmpColor[0][i * 3 + 1], - (BYTE) ts->TmpColor[0][i * 3 + 2]); + ts->VTBoldColor[i] = RGB((BYTE) TmpColor[0][i * 3], + (BYTE) TmpColor[0][i * 3 + 1], + (BYTE) TmpColor[0][i * 3 + 2]); if (GetOnOff(Section, "EnableBoldAttrColor", FName, TRUE)) ts->ColorFlag |= CF_BOLDCOLOR; @@ -996,11 +997,11 @@ GetPrivateProfileString(Section, "VTBlinkColor", "255,0,0,255,255,255", Temp, sizeof(Temp), FName); for (i = 0; i <= 5; i++) - GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i])); + GetNthNum(Temp, i + 1, (int *) &(TmpColor[0][i])); for (i = 0; i <= 1; i++) - ts->VTBlinkColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3], - (BYTE) ts->TmpColor[0][i * 3 + 1], - (BYTE) ts->TmpColor[0][i * 3 + 2]); + ts->VTBlinkColor[i] = RGB((BYTE) TmpColor[0][i * 3], + (BYTE) TmpColor[0][i * 3 + 1], + (BYTE) TmpColor[0][i * 3 + 2]); if (GetOnOff(Section, "EnableBlinkAttrColor", FName, TRUE)) ts->ColorFlag |= CF_BLINKCOLOR; @@ -1008,11 +1009,11 @@ GetPrivateProfileString(Section, "VTReverseColor", "255,255,255,0,0,0", Temp, sizeof(Temp), FName); for (i = 0; i <= 5; i++) - GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i])); + GetNthNum(Temp, i + 1, (int *) &(TmpColor[0][i])); for (i = 0; i <= 1; i++) - ts->VTReverseColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3], - (BYTE) ts->TmpColor[0][i * 3 + 1], - (BYTE) ts->TmpColor[0][i * 3 + 2]); + ts->VTReverseColor[i] = RGB((BYTE) TmpColor[0][i * 3], + (BYTE) TmpColor[0][i * 3 + 1], + (BYTE) TmpColor[0][i * 3 + 2]); if (GetOnOff(Section, "EnableReverseAttrColor", FName, FALSE)) ts->ColorFlag |= CF_REVERSECOLOR; @@ -1023,11 +1024,11 @@ GetPrivateProfileString(Section, "URLColor", "0,255,0,255,255,255", Temp, sizeof(Temp), FName); for (i = 0; i <= 5; i++) - GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i])); + GetNthNum(Temp, i + 1, (int *) &(TmpColor[0][i])); for (i = 0; i <= 1; i++) - ts->URLColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3], - (BYTE) ts->TmpColor[0][i * 3 + 1], - (BYTE) ts->TmpColor[0][i * 3 + 2]); + ts->URLColor[i] = RGB((BYTE) TmpColor[0][i * 3], + (BYTE) TmpColor[0][i * 3 + 1], + (BYTE) TmpColor[0][i * 3 + 2]); if (GetOnOff(Section, "EnableURLColor", FName, TRUE)) ts->ColorFlag |= CF_URLCOLOR; @@ -1038,11 +1039,11 @@ GetPrivateProfileString(Section, "TEKColor", "0,0,0,255,255,255", Temp, sizeof(Temp), FName); for (i = 0; i <= 5; i++) - GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i])); + GetNthNum(Temp, i + 1, (int *) &(TmpColor[0][i])); for (i = 0; i <= 1; i++) - ts->TEKColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3], - (BYTE) ts->TmpColor[0][i * 3 + 1], - (BYTE) ts->TmpColor[0][i * 3 + 2]); + ts->TEKColor[i] = RGB((BYTE) TmpColor[0][i * 3], + (BYTE) TmpColor[0][i * 3 + 1], + (BYTE) TmpColor[0][i * 3 + 2]); /* ANSI color definition (in the case FullColor=on) -- special option o UseTextColor should be off, or the background and foreground color of @@ -1076,10 +1077,10 @@ n /= 4; for (i = 0; i < n; i++) { int colorid, r, g, b; - GetNthNum(Temp, i * 4 + 1, (int far *) &colorid); - GetNthNum(Temp, i * 4 + 2, (int far *) &r); - GetNthNum(Temp, i * 4 + 3, (int far *) &g); - GetNthNum(Temp, i * 4 + 4, (int far *) &b); + GetNthNum(Temp, i * 4 + 1, (int *) &colorid); + GetNthNum(Temp, i * 4 + 2, (int *) &r); + GetNthNum(Temp, i * 4 + 3, (int *) &g); + GetNthNum(Temp, i * 4 + 4, (int *) &b); ts->ANSIColor[colorid & 15] = RGB((BYTE) r, (BYTE) g, (BYTE) b); } @@ -1616,14 +1617,14 @@ // VT-print scaling factors (pixels per inch) --- special option GetPrivateProfileString(Section, "VTPPI", "0,0", Temp, sizeof(Temp), FName); - GetNthNum(Temp, 1, (int far *) &ts->VTPPI.x); - GetNthNum(Temp, 2, (int far *) &ts->VTPPI.y); + GetNthNum(Temp, 1, (int *) &ts->VTPPI.x); + GetNthNum(Temp, 2, (int *) &ts->VTPPI.y); // TEK-print scaling factors (pixels per inch) --- special option GetPrivateProfileString(Section, "TEKPPI", "0,0", Temp, sizeof(Temp), FName); - GetNthNum(Temp, 1, (int far *) &ts->TEKPPI.x); - GetNthNum(Temp, 2, (int far *) &ts->TEKPPI.y); + GetNthNum(Temp, 1, (int *) &ts->TEKPPI.x); + GetNthNum(Temp, 2, (int *) &ts->TEKPPI.y); // Show "Window" menu -- special option if (GetOnOff(Section, "WindowMenu", FName, TRUE)) @@ -2239,6 +2240,7 @@ char buf[20]; int ret; char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG], msg[MAX_UIMSG]; + WORD TmpColor[12][6]; /* version */ ret = WritePrivateProfileString(Section, "Version", TT_VERSION_STR("."), FName); @@ -2481,76 +2483,76 @@ for (i = 0; i <= 1; i++) { if (ts->ColorFlag & CF_REVERSEVIDEO) { if (ts->ColorFlag & CF_REVERSECOLOR) { - ts->TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]); - ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]); - ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]); + TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]); + TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]); + TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]); } else { - ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[!i]); - ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[!i]); - ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[!i]); + TmpColor[0][i * 3] = GetRValue(ts->VTColor[!i]); + TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[!i]); + TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[!i]); } } else { - ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]); - ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]); - ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]); + TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]); + TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]); + TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]); } } WriteInt6(Section, "VTColor", FName, - ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2], - ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]); + TmpColor[0][0], TmpColor[0][1], TmpColor[0][2], + TmpColor[0][3], TmpColor[0][4], TmpColor[0][5]); /* VT Bold Color */ for (i = 0; i <= 1; i++) { if (ts->ColorFlag & CF_REVERSEVIDEO) { - ts->TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[!i]); - ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[!i]); - ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[!i]); + TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[!i]); + TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[!i]); + TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[!i]); } else { - ts->TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[i]); - ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[i]); - ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[i]); + TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[i]); + TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[i]); + TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[i]); } } WriteInt6(Section, "VTBoldColor", FName, - ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2], - ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]); + TmpColor[0][0], TmpColor[0][1], TmpColor[0][2], + TmpColor[0][3], TmpColor[0][4], TmpColor[0][5]); /* VT Blink Color */ for (i = 0; i <= 1; i++) { if (ts->ColorFlag & CF_REVERSEVIDEO) { - ts->TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[!i]); - ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[!i]); - ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[!i]); + TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[!i]); + TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[!i]); + TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[!i]); } else { - ts->TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[i]); - ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[i]); - ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[i]); + TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[i]); + TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[i]); + TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[i]); } } WriteInt6(Section, "VTBlinkColor", FName, - ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2], - ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]); + TmpColor[0][0], TmpColor[0][1], TmpColor[0][2], + TmpColor[0][3], TmpColor[0][4], TmpColor[0][5]); /* VT Reverse Color */ for (i = 0; i <= 1; i++) { if (ts->ColorFlag & CF_REVERSEVIDEO && ts->ColorFlag & CF_REVERSECOLOR) { - ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]); - ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]); - ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]); + TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]); + TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]); + TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]); } else { - ts->TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]); - ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]); - ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]); + TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]); + TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]); + TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]); } } WriteInt6(Section, "VTReverseColor", FName, - ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2], - ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]); + TmpColor[0][0], TmpColor[0][1], TmpColor[0][2], + TmpColor[0][3], TmpColor[0][4], TmpColor[0][5]); WriteOnOff(Section, "EnableClickableUrl", FName, ts->EnableClickableUrl); @@ -2558,19 +2560,19 @@ /* URL color */ for (i = 0; i <= 1; i++) { if (ts->ColorFlag & CF_REVERSEVIDEO) { - ts->TmpColor[0][i * 3] = GetRValue(ts->URLColor[!i]); - ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[!i]); - ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[!i]); + TmpColor[0][i * 3] = GetRValue(ts->URLColor[!i]); + TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[!i]); + TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[!i]); } else { - ts->TmpColor[0][i * 3] = GetRValue(ts->URLColor[i]); - ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[i]); - ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[i]); + TmpColor[0][i * 3] = GetRValue(ts->URLColor[i]); + TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[i]); + TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[i]); } } WriteInt6(Section, "URLColor", FName, - ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2], - ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]); + TmpColor[0][0], TmpColor[0][1], TmpColor[0][2], + TmpColor[0][3], TmpColor[0][4], TmpColor[0][5]); WriteOnOff(Section, "EnableBoldAttrColor", FName, (WORD) (ts->ColorFlag & CF_BOLDCOLOR)); @@ -2592,13 +2594,13 @@ /* TEK Color */ for (i = 0; i <= 1; i++) { - ts->TmpColor[0][i * 3] = GetRValue(ts->TEKColor[i]); - ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->TEKColor[i]); - ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->TEKColor[i]); + TmpColor[0][i * 3] = GetRValue(ts->TEKColor[i]); + TmpColor[0][i * 3 + 1] = GetGValue(ts->TEKColor[i]); + TmpColor[0][i * 3 + 2] = GetBValue(ts->TEKColor[i]); } WriteInt6(Section, "TEKColor", FName, - ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2], - ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]); + TmpColor[0][0], TmpColor[0][1], TmpColor[0][2], + TmpColor[0][3], TmpColor[0][4], TmpColor[0][5]); /* TEK color emulation */ WriteOnOff(Section, "TEKColorEmulation", FName, ts->TEKColorEmu);