Revision: 9856 https://osdn.net/projects/ttssh2/scm/svn/commits/9856 Author: zmatsuo Date: 2022-04-12 22:21:09 +0900 (Tue, 12 Apr 2022) Log Message: ----------- ファイル選択時にデフォルトのログフォルダを開くようにした - フィルタに txt, log を追加 - GetCommonDialogFilterWW() のプロトタイプが誤っていたので修正 ticket #44319 Ticket Links: ------------ https://osdn.net/projects/ttssh2/tracker/detail/44319 Modified Paths: -------------- trunk/teraterm/common/dlglib.h trunk/teraterm/teraterm/filesys_log.cpp -------------- next part -------------- Modified: trunk/teraterm/common/dlglib.h =================================================================== --- trunk/teraterm/common/dlglib.h 2022-04-12 13:20:57 UTC (rev 9855) +++ trunk/teraterm/common/dlglib.h 2022-04-12 13:21:09 UTC (rev 9856) @@ -92,7 +92,7 @@ int GetFontPointFromPixel(HWND hWnd, int pixel); int GetFontPixelFromPoint(HWND hWnd, int point); void ExpandCBWidth(HWND dlg, int ID); -wchar_t *GetCommonDialogFilterWW(const char *user_filter_mask, const wchar_t *UILanguageFile); +wchar_t *GetCommonDialogFilterWW(const wchar_t *user_filter_mask, const wchar_t *UILanguageFile); wchar_t *GetCommonDialogFilterW(const char *user_filter_mask, const char *UILanguageFile); void SetDlgItemIcon(HWND dlg, int nID, const wchar_t *name, int cx, int cy); void SetComboBoxHostHistory(HWND dlg, int dlg_item, int maxhostlist, const wchar_t *SetupFNW); Modified: trunk/teraterm/teraterm/filesys_log.cpp =================================================================== --- trunk/teraterm/teraterm/filesys_log.cpp 2022-04-12 13:20:57 UTC (rev 9855) +++ trunk/teraterm/teraterm/filesys_log.cpp 2022-04-12 13:21:09 UTC (rev 9856) @@ -578,7 +578,7 @@ break; case IDC_FOPT_FILENAME_BUTTON: { /* save current dir */ - const char *UILanguageFile = work->pts->UILanguageFile; + const wchar_t *UILanguageFile = work->pts->UILanguageFileW; wchar_t curdir[MAXPATHLEN]; GetCurrentDirectoryW(_countof(curdir), curdir); @@ -585,13 +585,15 @@ wchar_t fname[MAX_PATH]; GetDlgItemTextW(Dialog, IDC_FOPT_FILENAME_EDIT, fname, _countof(fname)); - wchar_t *FNFilter = GetCommonDialogFilterW(NULL, UILanguageFile); + const wchar_t* simple_log_filter = L"*.txt;*.log"; + wchar_t *FNFilter = GetCommonDialogFilterWW(simple_log_filter, UILanguageFile); - wchar_t caption[MAX_PATH]; - wchar_t uimsg[MAX_UIMSG]; - get_lang_msgW("FILEDLG_TRANS_TITLE_LOG", uimsg, _countof(uimsg), TitLog, UILanguageFile); - wcsncpy_s(caption, _countof(caption), L"Tera Term: ", _TRUNCATE); - wcsncat_s(caption, _countof(caption), uimsg, _TRUNCATE); + wchar_t *caption; + wchar_t *uimsg; + GetI18nStrWW("Tera Term", "FILEDLG_TRANS_TITLE_LOG", + TitLog, UILanguageFile, &uimsg); + aswprintf(&caption, L"Tera Term: %s", uimsg); + free(uimsg); OPENFILENAMEW ofn = {}; ofn.lStructSize = get_OPENFILENAME_SIZEW(); @@ -605,7 +607,10 @@ ofn.lpstrFile = fname; ofn.nMaxFile = _countof(fname); ofn.lpstrTitle = caption; + ofn.lpstrInitialDir = ToWcharA(work->pts->LogDefaultPath); BOOL Ok = GetSaveFileNameW(&ofn); + free((void *)ofn.lpstrInitialDir); + free(caption); free(FNFilter); if (Ok) { SetDlgItemTextW(Dialog, IDC_FOPT_FILENAME_EDIT, fname);