svnno****@sourc*****
svnno****@sourc*****
2013年 3月 24日 (日) 19:55:37 JST
Revision: 5171 http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5171 Author: yutakapon Date: 2013-03-24 19:55:37 +0900 (Sun, 24 Mar 2013) Log Message: ----------- ログ・ローテートの設定を Additional settings ダイアログから行えるようにした。 Modified Paths: -------------- trunk/installer/release/TERATERM.INI trunk/teraterm/common/tt_res.h trunk/teraterm/common/tttypes.h trunk/teraterm/teraterm/addsetting.cpp trunk/teraterm/teraterm/filesys.cpp trunk/teraterm/teraterm/ttermpro.rc trunk/teraterm/ttpset/ttset.c -------------- next part -------------- Modified: trunk/installer/release/TERATERM.INI =================================================================== --- trunk/installer/release/TERATERM.INI 2013-03-23 12:41:50 UTC (rev 5170) +++ trunk/installer/release/TERATERM.INI 2013-03-24 10:55:37 UTC (rev 5171) @@ -344,6 +344,17 @@ ; Auto start logging with default log file name. LogAutoStart=off +; === Log Rotate === +; Mode: 0(none), 1(size) +LogRotate=0 +; Size +LogRotateSize=0 +; Size type: 0(byte), 1(KB), 2(MB) +LogRotateSizeType=0 +; Step: 0(none), >=1(count times) +LogRotateStep=0 + + ; XMODEM option (checksum/crc/1k) XmodemOpt=checksum ; Binary flag for XMODEM Receive and ZMODEM Send (on/off) Modified: trunk/teraterm/common/tt_res.h =================================================================== --- trunk/teraterm/common/tt_res.h 2013-03-23 12:41:50 UTC (rev 5170) +++ trunk/teraterm/common/tt_res.h 2013-03-24 10:55:37 UTC (rev 5171) @@ -132,9 +132,11 @@ #define IDC_PASTEDELAY_EDIT 2510 #define IDC_SCP_PATH 2510 #define IDC_BGIMG_EDIT 2510 +#define IDC_ROTATE_SIZE 2510 #define IDC_CHECK1 2512 #define IDC_CONFIRM_CHANGE_PASTE 2512 #define IDC_CURSOR_CTRL_SEQ 2512 +#define IDC_LOG_ROTATE 2512 #define IDC_MOUSEWHEEL_SCROLL_LINE 2513 #define IDC_WINDOW_CTRL 2513 #define IDC_TRANSPROGRESS 2514 @@ -160,7 +162,12 @@ #define IDC_BUTTON1 2528 #define IDC_BGIMG_BUTTON 2528 #define IDC_CLIPBOARD_ACCESS_LABEL 2529 +#define IDC_ROTATE_SIZE_TYPE 2529 #define IDC_CLIPBOARD_ACCESS 2530 +#define IDC_ROTATE_STEP 2530 +#define IDC_ROTATE_STEP_TEXT 2531 +#define IDC_ROTATE_SIZE_TEXT 2532 +#define IDC_ROTATE_GROUP 2533 #define ID_ACC_SENDBREAK 50001 #define ID_ACC_COPY 50002 #define ID_ACC_NEWCONNECTION 50003 @@ -254,7 +261,7 @@ #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 123 #define _APS_NEXT_COMMAND_VALUE 52031 -#define _APS_NEXT_CONTROL_VALUE 2529 +#define _APS_NEXT_CONTROL_VALUE 2534 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif Modified: trunk/teraterm/common/tttypes.h =================================================================== --- trunk/teraterm/common/tttypes.h 2013-03-23 12:41:50 UTC (rev 5170) +++ trunk/teraterm/common/tttypes.h 2013-03-24 10:55:37 UTC (rev 5171) @@ -557,6 +557,10 @@ WORD FontQuality; char ScpSendDir[MAXPATHLEN]; char BGImageFilePath[MAX_PATH]; + enum rotate_mode LogRotate; + DWORD LogRotateSize; + WORD LogRotateSizeType; + WORD LogRotateStep; }; typedef struct tttset TTTSet, *PTTSet; @@ -1012,6 +1016,12 @@ * Increment the number of this macro value * when you change TMap or member of TMap. * + * - At version 4.78, ttset_memfilemap was replaced with ttset_memfilemap_20. + * added tttset.LogRotate + * added tttset.LogRotateSize + * added tttset.LogRotateSizeType + * added tttset.LogRotateStep + * * - At version 4.74, ttset_memfilemap was replaced with ttset_memfilemap_19. * added tttset.FontQuality * added tttset.ScpSenDir @@ -1127,4 +1137,4 @@ * added tttset.VTCompatTab. */ -#define TT_FILEMAPNAME "ttset_memfilemap_19" +#define TT_FILEMAPNAME "ttset_memfilemap_20" Modified: trunk/teraterm/teraterm/addsetting.cpp =================================================================== --- trunk/teraterm/teraterm/addsetting.cpp 2013-03-23 12:41:50 UTC (rev 5170) +++ trunk/teraterm/teraterm/addsetting.cpp 2013-03-24 10:55:37 UTC (rev 5171) @@ -12,6 +12,7 @@ #include "tttypes.h" #include "ttwinman.h" #include "ttcommon.h" +#include "ttftypes.h" mouse_cursor_t MouseCursor[] = { {"ARROW", IDC_ARROW}, @@ -1208,10 +1209,25 @@ // CLogPropPageDlg \x83\x81\x83b\x83Z\x81[\x83W \x83n\x83\x93\x83h\x83\x89 +#define LOG_ROTATE_SIZETYPE_NUM 3 +static char *LogRotateSizeType[] = { + "Byte", "KB", "MB" +}; + +static char *GetLogRotateSizeType(int val) +{ + if (val >= LOG_ROTATE_SIZETYPE_NUM) + val = 0; + + return LogRotateSizeType[val]; +} + BOOL CLogPropPageDlg::OnInitDialog() { char uimsg[MAX_UIMSG]; CButton *btn; + CComboBox *combo; + int i; CPropertyPage::OnInitDialog(); @@ -1227,6 +1243,14 @@ SendDlgItemMessage(IDC_DEFAULTPATH_EDITOR, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0)); SendDlgItemMessage(IDC_DEFAULTPATH_PUSH, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0)); SendDlgItemMessage(IDC_AUTOSTART, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0)); + + // Log rotate + SendDlgItemMessage(IDC_LOG_ROTATE, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0)); + SendDlgItemMessage(IDC_ROTATE_SIZE_TEXT, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0)); + SendDlgItemMessage(IDC_ROTATE_SIZE, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0)); + SendDlgItemMessage(IDC_ROTATE_SIZE_TYPE, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0)); + SendDlgItemMessage(IDC_ROTATE_STEP_TEXT, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0)); + SendDlgItemMessage(IDC_ROTATE_STEP, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0)); } else { DlgLogFont = NULL; @@ -1244,7 +1268,17 @@ GetDlgItemText(IDC_AUTOSTART, uimsg, sizeof(uimsg)); get_lang_msg("DLG_TAB_LOG_AUTOSTART", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile); SetDlgItemText(IDC_AUTOSTART, ts.UIMsg); + // TODO: Log rotate +#if 0 + get_lang_msg("DLG_TAB_LOG_ROTATE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile); + SetDlgItemText(IDC_LOG_ROTATE, ts.UIMsg); + get_lang_msg("DLG_TAB_LOG_ROTATE_SIZE_TEXT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile); + SetDlgItemText(IDC_ROTATE_SIZE_TEXT, ts.UIMsg); + get_lang_msg("IDC_ROTATE_STEP_TEXT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile); + SetDlgItemText(IDC_ROTATE_STEP_TEXT, ts.UIMsg); +#endif + // Viewlog Editor path (2005.1.29 yutaka) SetDlgItemText(IDC_VIEWLOG_EDITOR, ts.ViewlogEditor); @@ -1258,6 +1292,33 @@ btn = (CButton *)GetDlgItem(IDC_AUTOSTART); btn->SetCheck(ts.LogAutoStart); + // Log rotate + btn = (CButton *)GetDlgItem(IDC_LOG_ROTATE); + btn->SetCheck(ts.LogRotate != ROTATE_NONE); + + combo = (CComboBox *)GetDlgItem(IDC_ROTATE_SIZE_TYPE); + for (i = 0 ; i < LOG_ROTATE_SIZETYPE_NUM ; i++) { + combo->AddString(LogRotateSizeType[i]); + } + + SetDlgItemInt(IDC_ROTATE_SIZE, ts.LogRotateSize, FALSE); + combo->SelectString(-1, GetLogRotateSizeType(ts.LogRotateSizeType)); + SetDlgItemInt(IDC_ROTATE_STEP, ts.LogRotateStep, FALSE); + if (ts.LogRotate == ROTATE_NONE) { + GetDlgItem(IDC_ROTATE_SIZE_TEXT)->EnableWindow(FALSE); + GetDlgItem(IDC_ROTATE_SIZE)->EnableWindow(FALSE); + GetDlgItem(IDC_ROTATE_SIZE_TYPE)->EnableWindow(FALSE); + GetDlgItem(IDC_ROTATE_STEP_TEXT)->EnableWindow(FALSE); + GetDlgItem(IDC_ROTATE_STEP)->EnableWindow(FALSE); + } else { + GetDlgItem(IDC_ROTATE_SIZE_TEXT)->EnableWindow(TRUE); + GetDlgItem(IDC_ROTATE_SIZE)->EnableWindow(TRUE); + GetDlgItem(IDC_ROTATE_SIZE_TYPE)->EnableWindow(TRUE); + GetDlgItem(IDC_ROTATE_STEP_TEXT)->EnableWindow(TRUE); + GetDlgItem(IDC_ROTATE_STEP)->EnableWindow(TRUE); + } + + // \x83_\x83C\x83A\x83\x8D\x83O\x82Ƀt\x83H\x81[\x83J\x83X\x82Ă\xE9 ::SetFocus(::GetDlgItem(GetSafeHwnd(), IDC_VIEWLOG_EDITOR)); @@ -1300,6 +1361,27 @@ SetDlgItemText(IDC_DEFAULTPATH_EDITOR, ts.LogDefaultPath); return TRUE; + + case IDC_LOG_ROTATE | (BN_CLICKED << 16): + { + CButton *btn; + btn = (CButton *)GetDlgItem(IDC_LOG_ROTATE); + if (btn->GetCheck()) { + GetDlgItem(IDC_ROTATE_SIZE_TEXT)->EnableWindow(TRUE); + GetDlgItem(IDC_ROTATE_SIZE)->EnableWindow(TRUE); + GetDlgItem(IDC_ROTATE_SIZE_TYPE)->EnableWindow(TRUE); + GetDlgItem(IDC_ROTATE_STEP_TEXT)->EnableWindow(TRUE); + GetDlgItem(IDC_ROTATE_STEP)->EnableWindow(TRUE); + } else { + GetDlgItem(IDC_ROTATE_SIZE_TEXT)->EnableWindow(FALSE); + GetDlgItem(IDC_ROTATE_SIZE)->EnableWindow(FALSE); + GetDlgItem(IDC_ROTATE_SIZE_TYPE)->EnableWindow(FALSE); + GetDlgItem(IDC_ROTATE_STEP_TEXT)->EnableWindow(FALSE); + GetDlgItem(IDC_ROTATE_STEP)->EnableWindow(FALSE); + } + + } + return TRUE; } return CPropertyPage::OnCommand(wParam, lParam); @@ -1312,6 +1394,8 @@ struct tm *tm_local; char uimsg[MAX_UIMSG]; CButton *btn; + CString str; + int i; // Viewlog Editor path (2005.1.29 yutaka) GetDlgItemText(IDC_VIEWLOG_EDITOR, ts.ViewlogEditor, sizeof(ts.ViewlogEditor)); @@ -1351,6 +1435,32 @@ /* Auto start logging (2007.5.31 maya) */ btn = (CButton *)GetDlgItem(IDC_AUTOSTART); ts.LogAutoStart = btn->GetCheck(); + + /* Log Rotate */ + btn = (CButton *)GetDlgItem(IDC_LOG_ROTATE); + if (btn->GetCheck()) { /* on */ + ts.LogRotate = ROTATE_SIZE; + + ((CComboBox*)GetDlgItem(IDC_ROTATE_SIZE_TYPE))->GetWindowText(str); + for (i = 0 ; i < LOG_ROTATE_SIZETYPE_NUM ; i++) { + if (strcmp(str, LogRotateSizeType[i]) == 0) + break; + } + if (i >= LOG_ROTATE_SIZETYPE_NUM) + i = 0; + ts.LogRotateSizeType = i; + + ts.LogRotateSize = GetDlgItemInt(IDC_ROTATE_SIZE); + for (i = 0 ; i < ts.LogRotateSizeType ; i++) + ts.LogRotateSize *= 1024; + + ts.LogRotateStep = GetDlgItemInt(IDC_ROTATE_STEP); + + } else { /* off */ + ts.LogRotate = ROTATE_NONE; + /* \x8Ec\x82\xE8\x82̃\x81\x83\x93\x83o\x81[\x82͈Ӑ}\x93I\x82ɐݒ\xE8\x82\xF0\x8Ec\x82\xB7\x81B*/ + } + } Modified: trunk/teraterm/teraterm/filesys.cpp =================================================================== --- trunk/teraterm/teraterm/filesys.cpp 2013-03-23 12:41:50 UTC (rev 5170) +++ trunk/teraterm/teraterm/filesys.cpp 2013-03-24 10:55:37 UTC (rev 5171) @@ -532,7 +532,10 @@ } LogVar->ByteCount = 0; - LogVar->RotateMode = ROTATE_NONE; + // Log rotate configuration + LogVar->RotateMode = ts.LogRotate; + LogVar->RotateSize = ts.LogRotateSize; + LogVar->RotateStep = ts.LogRotateStep; if (! OpenFTDlg(LogVar)) { FileTransEnd(OpLog); Modified: trunk/teraterm/teraterm/ttermpro.rc =================================================================== --- trunk/teraterm/teraterm/ttermpro.rc 2013-03-23 12:41:50 UTC (rev 5170) +++ trunk/teraterm/teraterm/ttermpro.rc 2013-03-24 10:55:37 UTC (rev 5171) @@ -157,6 +157,13 @@ EDITTEXT IDC_DEFAULTPATH_EDITOR,11,83,120,12,ES_AUTOHSCROLL PUSHBUTTON "...",IDC_DEFAULTPATH_PUSH,135,84,13,10 CONTROL "A&uto start logging",IDC_AUTOSTART,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,102,124,10 + CONTROL "Log Rotate",IDC_LOG_ROTATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,120,51,10 + EDITTEXT IDC_ROTATE_SIZE,61,134,46,14,ES_AUTOHSCROLL + COMBOBOX IDC_ROTATE_SIZE_TYPE,112,135,31,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_ROTATE_STEP,195,134,30,14,ES_AUTOHSCROLL + LTEXT "Rotate",IDC_ROTATE_STEP_TEXT,166,137,23,8 + LTEXT "Size",IDC_ROTATE_SIZE_TEXT,41,137,14,8 + GROUPBOX "",IDC_ROTATE_GROUP,19,112,214,39 END IDD_TABSHEET_CYGWIN DIALOGEX 0, 0, 242, 158 Modified: trunk/teraterm/ttpset/ttset.c =================================================================== --- trunk/teraterm/ttpset/ttset.c 2013-03-23 12:41:50 UTC (rev 5170) +++ trunk/teraterm/ttpset/ttset.c 2013-03-24 10:55:37 UTC (rev 5171) @@ -775,6 +775,13 @@ /* Auto start logging (2007.5.31 maya) */ ts->LogAutoStart = GetOnOff(Section, "LogAutoStart", FName, FALSE); + /* Log Rotate (2013.3.24 yutaka) */ + ts->LogRotate = GetPrivateProfileInt(Section, "LogRotate", 0, FName); + ts->LogRotateSize = GetPrivateProfileInt(Section, "LogRotateSize", 0, FName); + ts->LogRotateSizeType = GetPrivateProfileInt(Section, "LogRotateSizeType", 0, FName); + ts->LogRotateStep = GetPrivateProfileInt(Section, "LogRotateStep", 0, FName); + + /* XMODEM option */ GetPrivateProfileString(Section, "XmodemOpt", "", Temp, sizeof(Temp), FName); @@ -2106,6 +2113,12 @@ /* Auto start logging (2007.5.31 maya) */ WriteOnOff(Section, "LogAutoStart", FName, ts->LogAutoStart); + /* Log Rotate (2013.3.24 yutaka) */ + WriteInt(Section, "LogRotate", FName, ts->LogRotate); + WriteInt(Section, "LogRotateSize", FName, ts->LogRotateSize); + WriteInt(Section, "LogRotateSizeType", FName, ts->LogRotateSizeType); + WriteInt(Section, "LogRotateStep", FName, ts->LogRotateStep); + /* XMODEM option */ switch (ts->XmodemOpt) { case XoptCRC: