• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythongamewindowsbathyscaphephpguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

Tera Termの個人的な作業用リポジトリ


Commit MetaInfo

修订版d380fb4295be2cf3adadb2dfdb8d4d342c735ec5 (tree)
时间2020-03-24 00:54:56
作者zmatsuo <zmatsuo@user...>
Commiterzmatsuo

Log Message

_GetOpenFileNameW(), TTMessageBoxW() を使用するようにした

git-svn-id: svn+ssh://svn.osdn.net/svnroot/ttssh2/trunk@8619 f5f01b69-1e22-0410-acbf-894ab4bd6246

更改概述

差异

--- a/teraterm/teraterm/addsetting.cpp
+++ b/teraterm/teraterm/addsetting.cpp
@@ -54,6 +54,8 @@
5454 #include "debug_pp.h"
5555 #include "tipwin.h"
5656 #include "i18n.h"
57+#include "codeconv.h"
58+#include "layer_for_unicode.h"
5759
5860 const mouse_cursor_t MouseCursor[] = {
5961 {"ARROW", IDC_ARROW},
@@ -499,8 +501,6 @@ void CCopypastePropPageDlg::OnInitDialog()
499501
500502 BOOL CCopypastePropPageDlg::OnCommand(WPARAM wParam, LPARAM lParam)
501503 {
502- char uimsg[MAX_UIMSG];
503-
504504 switch (wParam) {
505505 case IDC_DISABLE_PASTE_RBUTTON | (BN_CLICKED << 16):
506506 EnableDlgItem(IDC_CONFIRM_PASTE_RBUTTON,
@@ -519,23 +519,28 @@ BOOL CCopypastePropPageDlg::OnCommand(WPARAM wParam, LPARAM lParam)
519519
520520 case IDC_CONFIRM_STRING_FILE_PATH | (BN_CLICKED << 16):
521521 {
522- OPENFILENAMEA ofn;
522+ wchar_t fileW[_countof(ts.ConfirmChangePasteStringFile)];
523+ MultiByteToWideChar(CP_ACP, 0, ts.ConfirmChangePasteStringFile, -1, fileW, _countof(fileW));
524+
525+ OPENFILENAMEW ofn;
523526
524527 memset(&ofn, 0, sizeof(ofn));
525- ofn.lStructSize = get_OPENFILENAME_SIZEA();
528+ ofn.lStructSize = get_OPENFILENAME_SIZEW();
526529 ofn.hwndOwner = GetSafeHwnd();
527- get_lang_msg("FILEDLG_SELECT_CONFIRM_STRING_APP_FILTER", ts.UIMsg, sizeof(ts.UIMsg),
528- "txt(*.txt)\\0*.txt\\0all(*.*)\\0*.*\\0\\0", ts.UILanguageFile);
529- ofn.lpstrFilter = ts.UIMsg;
530- ofn.lpstrFile = ts.ConfirmChangePasteStringFile;
531- ofn.nMaxFile = sizeof(ts.ConfirmChangePasteStringFile);
532- get_lang_msg("FILEDLG_SELECT_CONFIRM_STRING_APP_TITLE", uimsg, sizeof(uimsg),
533- "Choose a file including strings for ConfirmChangePaste", ts.UILanguageFile);
534- ofn.lpstrTitle = uimsg;
530+ ofn.lpstrFilter = TTGetLangStrW("Tera Term", "FILEDLG_SELECT_CONFIRM_STRING_APP_FILTER", L"txt(*.txt)\\0*.txt\\0all(*.*)\\0*.*\\0\\0", ts.UILanguageFile);
531+ ofn.lpstrFile = fileW;
532+ ofn.nMaxFile = _countof(fileW);
533+ ofn.lpstrTitle = TTGetLangStrW("Tera Term", "FILEDLG_SELECT_CONFIRM_STRING_APP_TITLE", L"Choose a file including strings for ConfirmChangePaste", ts.UILanguageFile);
535534 ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
536- if (GetOpenFileNameA(&ofn) != 0) {
535+ BOOL ok = _GetOpenFileNameW(&ofn);
536+ if (ok) {
537+ char *file = ToCharW(fileW);
538+ strncpy_s(ts.ConfirmChangePasteStringFile, sizeof(ts.ConfirmChangePasteStringFile), file, _TRUNCATE);
539+ free(file);
537540 SetDlgItemTextA(IDC_CONFIRM_STRING_FILE, ts.ConfirmChangePasteStringFile);
538541 }
542+ free((void *)ofn.lpstrFilter);
543+ free((void *)ofn.lpstrTitle);
539544 }
540545 return TRUE;
541546 }
@@ -938,20 +943,21 @@ BOOL CVisualPropPageDlg::OnCommand(WPARAM wParam, LPARAM lParam)
938943 case IDC_BGIMG_BUTTON | (BN_CLICKED << 16):
939944 // 背景画像をダイアログで指定する。
940945 {
941- OPENFILENAMEA ofn;
942- char szFile[MAX_PATH];
946+ OPENFILENAMEW ofn;
947+ wchar_t szFile[MAX_PATH];
943948
944949 memset(&ofn, 0, sizeof(ofn));
945950 memset(szFile, 0, sizeof(szFile));
946- ofn.lStructSize = get_OPENFILENAME_SIZEA();
951+ ofn.lStructSize = get_OPENFILENAME_SIZEW();
947952 ofn.hwndOwner = GetSafeHwnd();
948- ofn.lpstrFilter = "Image Files(*.jpg;*.jpeg;*.bmp)\0*.jpg;*.jpeg;*.bmp\0All Files(*.*)\0*.*\0";
953+ ofn.lpstrFilter = L"Image Files(*.jpg;*.jpeg;*.bmp)\0*.jpg;*.jpeg;*.bmp\0All Files(*.*)\0*.*\0";
949954 ofn.lpstrFile = szFile;
950955 ofn.nMaxFile = _countof(szFile);
951- ofn.lpstrTitle = "select image file";
956+ ofn.lpstrTitle = L"select image file";
952957 ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
953- if (GetOpenFileNameA(&ofn) != 0) {
954- SetDlgItemTextA(IDC_BGIMG_EDIT, szFile);
958+ BOOL ok = _GetOpenFileNameW(&ofn);
959+ if (ok) {
960+ SetDlgItemTextW(IDC_BGIMG_EDIT, szFile);
955961 }
956962 }
957963 return TRUE;
@@ -1386,28 +1392,31 @@ void CLogPropPageDlg::OnInitDialog()
13861392
13871393 BOOL CLogPropPageDlg::OnCommand(WPARAM wParam, LPARAM lParam)
13881394 {
1389- char uimsg[MAX_UIMSG];
1390-
13911395 switch (wParam) {
13921396 case IDC_VIEWLOG_PATH | (BN_CLICKED << 16):
13931397 {
1394- OPENFILENAMEA ofn;
1398+ wchar_t fileW[_countof(ts.ViewlogEditor)];
1399+ MultiByteToWideChar(CP_ACP, 0, ts.ViewlogEditor, -1, fileW, _countof(fileW));
13951400
1396- ZeroMemory(&ofn, sizeof(ofn));
1397- ofn.lStructSize = get_OPENFILENAME_SIZEA();
1401+ OPENFILENAMEW ofn;
1402+
1403+ memset(&ofn, 0, sizeof(ofn));
1404+ ofn.lStructSize = get_OPENFILENAME_SIZEW();
13981405 ofn.hwndOwner = GetSafeHwnd();
1399- get_lang_msg("FILEDLG_SELECT_LOGVIEW_APP_FILTER", ts.UIMsg, sizeof(ts.UIMsg),
1400- "exe(*.exe)\\0*.exe\\0all(*.*)\\0*.*\\0\\0", ts.UILanguageFile);
1401- ofn.lpstrFilter = ts.UIMsg;
1402- ofn.lpstrFile = ts.ViewlogEditor;
1403- ofn.nMaxFile = sizeof(ts.ViewlogEditor);
1404- get_lang_msg("FILEDLG_SELECT_LOGVIEW_APP_TITLE", uimsg, sizeof(uimsg),
1405- "Choose a executing file with launching logging file", ts.UILanguageFile);
1406- ofn.lpstrTitle = uimsg;
1406+ ofn.lpstrFilter = TTGetLangStrW("Tera Term", "FILEDLG_SELECT_LOGVIEW_APP_FILTER", L"exe(*.exe)\\0*.exe\\0all(*.*)\\0*.*\\0\\0", ts.UILanguageFile);
1407+ ofn.lpstrFile = fileW;
1408+ ofn.nMaxFile = _countof(fileW);
1409+ ofn.lpstrTitle = TTGetLangStrW("Tera Term", "FILEDLG_SELECT_LOGVIEW_APP_TITLE", L"Choose a executing file with launching logging file", ts.UILanguageFile);
14071410 ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
1408- if (GetOpenFileNameA(&ofn) != 0) {
1411+ BOOL ok = _GetOpenFileNameW(&ofn);
1412+ if (ok) {
1413+ char *file = ToCharW(fileW);
1414+ strncpy_s(ts.ViewlogEditor, sizeof(ts.ViewlogEditor), file, _TRUNCATE);
1415+ free(file);
14091416 SetDlgItemTextA(IDC_VIEWLOG_EDITOR, ts.ViewlogEditor);
14101417 }
1418+ free((void *)ofn.lpstrFilter);
1419+ free((void *)ofn.lpstrTitle);
14111420 }
14121421 return TRUE;
14131422
@@ -1481,8 +1490,6 @@ void CLogPropPageDlg::OnOK()
14811490 char buf[80], buf2[80];
14821491 time_t time_local;
14831492 struct tm *tm_local;
1484- TCHAR uimsg[MAX_UIMSG];
1485- TCHAR uimsg2[MAX_UIMSG];
14861493
14871494 // Viewlog Editor path (2005.1.29 yutaka)
14881495 GetDlgItemTextA(IDC_VIEWLOG_EDITOR, ts.ViewlogEditor, _countof(ts.ViewlogEditor));
@@ -1490,10 +1497,11 @@ void CLogPropPageDlg::OnOK()
14901497 // Log Default File Name (2006.8.28 maya)
14911498 GetDlgItemTextA(IDC_DEFAULTNAME_EDITOR, buf, sizeof(buf));
14921499 if (isInvalidStrftimeChar(buf)) {
1493- get_lang_msgT("MSG_ERROR", uimsg, _countof(uimsg), _T("ERROR"), ts.UILanguageFile);
1494- get_lang_msgT("MSG_LOGFILE_INVALID_CHAR_ERROR", uimsg2, _countof(uimsg2),
1495- _T("Invalid character is included in log file name."), ts.UILanguageFile);
1496- MessageBox(uimsg2, uimsg, MB_ICONEXCLAMATION);
1500+ static const TTMessageBoxInfoW info = {
1501+ "Tera Term",
1502+ "MSG_ERROR", L"ERROR",
1503+ "MSG_LOGFILE_INVALID_CHAR_ERROR", L"Invalid character is included in log file name." };
1504+ TTMessageBoxW(m_hWnd, &info, MB_ICONEXCLAMATION, ts.UILanguageFile);
14971505 return;
14981506 }
14991507
@@ -1502,17 +1510,19 @@ void CLogPropPageDlg::OnOK()
15021510 tm_local = localtime(&time_local);
15031511 // 時刻文字列に変換
15041512 if (strlen(buf) != 0 && strftime(buf2, sizeof(buf2), buf, tm_local) == 0) {
1505- get_lang_msgT("MSG_ERROR", uimsg, _countof(uimsg), _T("ERROR"), ts.UILanguageFile);
1506- get_lang_msgT("MSG_LOGFILE_TOOLONG_ERROR", uimsg2, _countof(uimsg2),
1507- _T("The log file name is too long."), ts.UILanguageFile);
1508- MessageBox(uimsg2, uimsg, MB_ICONEXCLAMATION);
1513+ static const TTMessageBoxInfoW info = {
1514+ "Tera Term",
1515+ "MSG_ERROR", L"ERROR",
1516+ "MSG_LOGFILE_TOOLONG_ERROR", L"The log file name is too long." };
1517+ TTMessageBoxW(m_hWnd, &info, MB_ICONEXCLAMATION, ts.UILanguageFile);
15091518 return;
15101519 }
15111520 if (isInvalidFileNameChar(buf2)) {
1512- get_lang_msgT("MSG_ERROR", uimsg, _countof(uimsg), _T("ERROR"), ts.UILanguageFile);
1513- get_lang_msgT("MSG_LOGFILE_INVALID_CHAR_ERROR", uimsg2, _countof(uimsg2),
1514- _T("Invalid character is included in log file name."), ts.UILanguageFile);
1515- MessageBox(uimsg2, uimsg, MB_ICONEXCLAMATION);
1521+ static const TTMessageBoxInfoW info = {
1522+ "Tera Term",
1523+ "MSG_ERROR", L"ERROR",
1524+ "MSG_LOGFILE_INVALID_CHAR_ERROR", L"Invalid character is included in log file name." };
1525+ TTMessageBoxW(m_hWnd, &info, MB_ICONEXCLAMATION, ts.UILanguageFile);
15161526 return;
15171527 }
15181528 strncpy_s(ts.LogDefaultName, sizeof(ts.LogDefaultName), buf, _TRUNCATE);