Develop and Download Open Source Software

Browse Subversion Repository

Diff of /trunk/teraterm/teraterm/addsetting.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 8618 by zmatsuo, Wed Feb 26 16:27:42 2020 UTC revision 8619 by zmatsuo, Mon Mar 23 15:54:56 2020 UTC
# Line 54  Line 54 
54  #include "debug_pp.h"  #include "debug_pp.h"
55  #include "tipwin.h"  #include "tipwin.h"
56  #include "i18n.h"  #include "i18n.h"
57    #include "codeconv.h"
58    #include "layer_for_unicode.h"
59    
60  const mouse_cursor_t MouseCursor[] = {  const mouse_cursor_t MouseCursor[] = {
61          {"ARROW", IDC_ARROW},          {"ARROW", IDC_ARROW},
# Line 499  void CCopypastePropPageDlg::OnInitDialog Line 501  void CCopypastePropPageDlg::OnInitDialog
501    
502  BOOL CCopypastePropPageDlg::OnCommand(WPARAM wParam, LPARAM lParam)  BOOL CCopypastePropPageDlg::OnCommand(WPARAM wParam, LPARAM lParam)
503  {  {
         char uimsg[MAX_UIMSG];  
   
504          switch (wParam) {          switch (wParam) {
505                  case IDC_DISABLE_PASTE_RBUTTON | (BN_CLICKED << 16):                  case IDC_DISABLE_PASTE_RBUTTON | (BN_CLICKED << 16):
506                          EnableDlgItem(IDC_CONFIRM_PASTE_RBUTTON,                          EnableDlgItem(IDC_CONFIRM_PASTE_RBUTTON,
# Line 519  BOOL CCopypastePropPageDlg::OnCommand(WP Line 519  BOOL CCopypastePropPageDlg::OnCommand(WP
519    
520                  case IDC_CONFIRM_STRING_FILE_PATH | (BN_CLICKED << 16):                  case IDC_CONFIRM_STRING_FILE_PATH | (BN_CLICKED << 16):
521                          {                          {
522                                  OPENFILENAMEA ofn;                                  wchar_t fileW[_countof(ts.ConfirmChangePasteStringFile)];
523                                    MultiByteToWideChar(CP_ACP, 0, ts.ConfirmChangePasteStringFile, -1, fileW, _countof(fileW));
524    
525                                    OPENFILENAMEW ofn;
526    
527                                  memset(&ofn, 0, sizeof(ofn));                                  memset(&ofn, 0, sizeof(ofn));
528                                  ofn.lStructSize = get_OPENFILENAME_SIZEA();                                  ofn.lStructSize = get_OPENFILENAME_SIZEW();
529                                  ofn.hwndOwner = GetSafeHwnd();                                  ofn.hwndOwner = GetSafeHwnd();
530                                  get_lang_msg("FILEDLG_SELECT_CONFIRM_STRING_APP_FILTER", ts.UIMsg, sizeof(ts.UIMsg),                                  ofn.lpstrFilter = TTGetLangStrW("Tera Term", "FILEDLG_SELECT_CONFIRM_STRING_APP_FILTER", L"txt(*.txt)\\0*.txt\\0all(*.*)\\0*.*\\0\\0", ts.UILanguageFile);
531                                               "txt(*.txt)\\0*.txt\\0all(*.*)\\0*.*\\0\\0", ts.UILanguageFile);                                  ofn.lpstrFile = fileW;
532                                  ofn.lpstrFilter = ts.UIMsg;                                  ofn.nMaxFile = _countof(fileW);
533                                  ofn.lpstrFile = ts.ConfirmChangePasteStringFile;                                  ofn.lpstrTitle = TTGetLangStrW("Tera Term", "FILEDLG_SELECT_CONFIRM_STRING_APP_TITLE", L"Choose a file including strings for ConfirmChangePaste", ts.UILanguageFile);
                                 ofn.nMaxFile = sizeof(ts.ConfirmChangePasteStringFile);  
                                 get_lang_msg("FILEDLG_SELECT_CONFIRM_STRING_APP_TITLE", uimsg, sizeof(uimsg),  
                                              "Choose a file including strings for ConfirmChangePaste", ts.UILanguageFile);  
                                 ofn.lpstrTitle = uimsg;  
534                                  ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;                                  ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
535                                  if (GetOpenFileNameA(&ofn) != 0) {                                  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);
540                                          SetDlgItemTextA(IDC_CONFIRM_STRING_FILE, ts.ConfirmChangePasteStringFile);                                          SetDlgItemTextA(IDC_CONFIRM_STRING_FILE, ts.ConfirmChangePasteStringFile);
541                                  }                                  }
542                                    free((void *)ofn.lpstrFilter);
543                                    free((void *)ofn.lpstrTitle);
544                          }                          }
545                          return TRUE;                          return TRUE;
546          }          }
# Line 938  BOOL CVisualPropPageDlg::OnCommand(WPARA Line 943  BOOL CVisualPropPageDlg::OnCommand(WPARA
943                  case IDC_BGIMG_BUTTON | (BN_CLICKED << 16):                  case IDC_BGIMG_BUTTON | (BN_CLICKED << 16):
944                          // 背景画像をダイアログで指定する。                          // 背景画像をダイアログで指定する。
945                          {                          {
946                                  OPENFILENAMEA ofn;                                  OPENFILENAMEW ofn;
947                                  char szFile[MAX_PATH];                                  wchar_t szFile[MAX_PATH];
948    
949                                  memset(&ofn, 0, sizeof(ofn));                                  memset(&ofn, 0, sizeof(ofn));
950                                  memset(szFile, 0, sizeof(szFile));                                  memset(szFile, 0, sizeof(szFile));
951                                  ofn.lStructSize = get_OPENFILENAME_SIZEA();                                  ofn.lStructSize = get_OPENFILENAME_SIZEW();
952                                  ofn.hwndOwner = GetSafeHwnd();                                  ofn.hwndOwner = GetSafeHwnd();
953                                  ofn.lpstrFilter = "Image Files(*.jpg;*.jpeg;*.bmp)\0*.jpg;*.jpeg;*.bmp\0All Files(*.*)\0*.*\0";                                  ofn.lpstrFilter = L"Image Files(*.jpg;*.jpeg;*.bmp)\0*.jpg;*.jpeg;*.bmp\0All Files(*.*)\0*.*\0";
954                                  ofn.lpstrFile = szFile;                                  ofn.lpstrFile = szFile;
955                                  ofn.nMaxFile = _countof(szFile);                                  ofn.nMaxFile = _countof(szFile);
956                                  ofn.lpstrTitle = "select image file";                                  ofn.lpstrTitle = L"select image file";
957                                  ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;                                  ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
958                                  if (GetOpenFileNameA(&ofn) != 0) {                                  BOOL ok = _GetOpenFileNameW(&ofn);
959                                          SetDlgItemTextA(IDC_BGIMG_EDIT, szFile);                                  if (ok) {
960                                            SetDlgItemTextW(IDC_BGIMG_EDIT, szFile);
961                                  }                                  }
962                          }                          }
963                          return TRUE;                          return TRUE;
# Line 1386  void CLogPropPageDlg::OnInitDialog() Line 1392  void CLogPropPageDlg::OnInitDialog()
1392    
1393  BOOL CLogPropPageDlg::OnCommand(WPARAM wParam, LPARAM lParam)  BOOL CLogPropPageDlg::OnCommand(WPARAM wParam, LPARAM lParam)
1394  {  {
         char uimsg[MAX_UIMSG];  
   
1395          switch (wParam) {          switch (wParam) {
1396                  case IDC_VIEWLOG_PATH | (BN_CLICKED << 16):                  case IDC_VIEWLOG_PATH | (BN_CLICKED << 16):
1397                          {                          {
1398                                  OPENFILENAMEA ofn;                                  wchar_t fileW[_countof(ts.ViewlogEditor)];
1399                                    MultiByteToWideChar(CP_ACP, 0, ts.ViewlogEditor, -1, fileW, _countof(fileW));
1400    
1401                                  ZeroMemory(&ofn, sizeof(ofn));                                  OPENFILENAMEW ofn;
1402                                  ofn.lStructSize = get_OPENFILENAME_SIZEA();  
1403                                    memset(&ofn, 0, sizeof(ofn));
1404                                    ofn.lStructSize = get_OPENFILENAME_SIZEW();
1405                                  ofn.hwndOwner = GetSafeHwnd();                                  ofn.hwndOwner = GetSafeHwnd();
1406                                  get_lang_msg("FILEDLG_SELECT_LOGVIEW_APP_FILTER", ts.UIMsg, sizeof(ts.UIMsg),                                  ofn.lpstrFilter = TTGetLangStrW("Tera Term", "FILEDLG_SELECT_LOGVIEW_APP_FILTER", L"exe(*.exe)\\0*.exe\\0all(*.*)\\0*.*\\0\\0", ts.UILanguageFile);
1407                                               "exe(*.exe)\\0*.exe\\0all(*.*)\\0*.*\\0\\0", ts.UILanguageFile);                                  ofn.lpstrFile = fileW;
1408                                  ofn.lpstrFilter = ts.UIMsg;                                  ofn.nMaxFile = _countof(fileW);
1409                                  ofn.lpstrFile = ts.ViewlogEditor;                                  ofn.lpstrTitle = TTGetLangStrW("Tera Term", "FILEDLG_SELECT_LOGVIEW_APP_TITLE", L"Choose a executing file with launching logging file", ts.UILanguageFile);
                                 ofn.nMaxFile = sizeof(ts.ViewlogEditor);  
                                 get_lang_msg("FILEDLG_SELECT_LOGVIEW_APP_TITLE", uimsg, sizeof(uimsg),  
                                              "Choose a executing file with launching logging file", ts.UILanguageFile);  
                                 ofn.lpstrTitle = uimsg;  
1410                                  ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;                                  ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
1411                                  if (GetOpenFileNameA(&ofn) != 0) {                                  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);
1416                                          SetDlgItemTextA(IDC_VIEWLOG_EDITOR, ts.ViewlogEditor);                                          SetDlgItemTextA(IDC_VIEWLOG_EDITOR, ts.ViewlogEditor);
1417                                  }                                  }
1418                                    free((void *)ofn.lpstrFilter);
1419                                    free((void *)ofn.lpstrTitle);
1420                          }                          }
1421                          return TRUE;                          return TRUE;
1422    
# Line 1481  void CLogPropPageDlg::OnOK() Line 1490  void CLogPropPageDlg::OnOK()
1490          char buf[80], buf2[80];          char buf[80], buf2[80];
1491          time_t time_local;          time_t time_local;
1492          struct tm *tm_local;          struct tm *tm_local;
         TCHAR uimsg[MAX_UIMSG];  
         TCHAR uimsg2[MAX_UIMSG];  
1493    
1494          // Viewlog Editor path (2005.1.29 yutaka)          // Viewlog Editor path (2005.1.29 yutaka)
1495          GetDlgItemTextA(IDC_VIEWLOG_EDITOR, ts.ViewlogEditor, _countof(ts.ViewlogEditor));          GetDlgItemTextA(IDC_VIEWLOG_EDITOR, ts.ViewlogEditor, _countof(ts.ViewlogEditor));
# Line 1490  void CLogPropPageDlg::OnOK() Line 1497  void CLogPropPageDlg::OnOK()
1497          // Log Default File Name (2006.8.28 maya)          // Log Default File Name (2006.8.28 maya)
1498          GetDlgItemTextA(IDC_DEFAULTNAME_EDITOR, buf, sizeof(buf));          GetDlgItemTextA(IDC_DEFAULTNAME_EDITOR, buf, sizeof(buf));
1499          if (isInvalidStrftimeChar(buf)) {          if (isInvalidStrftimeChar(buf)) {
1500                  get_lang_msgT("MSG_ERROR", uimsg, _countof(uimsg), _T("ERROR"), ts.UILanguageFile);                  static const TTMessageBoxInfoW info = {
1501                  get_lang_msgT("MSG_LOGFILE_INVALID_CHAR_ERROR", uimsg2, _countof(uimsg2),                          "Tera Term",
1502                                _T("Invalid character is included in log file name."), ts.UILanguageFile);                          "MSG_ERROR", L"ERROR",
1503                  MessageBox(uimsg2, uimsg, MB_ICONEXCLAMATION);                          "MSG_LOGFILE_INVALID_CHAR_ERROR", L"Invalid character is included in log file name." };
1504                    TTMessageBoxW(m_hWnd, &info, MB_ICONEXCLAMATION, ts.UILanguageFile);
1505                  return;                  return;
1506          }          }
1507    
# Line 1502  void CLogPropPageDlg::OnOK() Line 1510  void CLogPropPageDlg::OnOK()
1510          tm_local = localtime(&time_local);          tm_local = localtime(&time_local);
1511          // 時刻文字列に変換          // 時刻文字列に変換
1512          if (strlen(buf) != 0 && strftime(buf2, sizeof(buf2), buf, tm_local) == 0) {          if (strlen(buf) != 0 && strftime(buf2, sizeof(buf2), buf, tm_local) == 0) {
1513                  get_lang_msgT("MSG_ERROR", uimsg, _countof(uimsg), _T("ERROR"), ts.UILanguageFile);                  static const TTMessageBoxInfoW info = {
1514                  get_lang_msgT("MSG_LOGFILE_TOOLONG_ERROR", uimsg2, _countof(uimsg2),                          "Tera Term",
1515                                            _T("The log file name is too long."), ts.UILanguageFile);                          "MSG_ERROR", L"ERROR",
1516                  MessageBox(uimsg2, uimsg, MB_ICONEXCLAMATION);                          "MSG_LOGFILE_TOOLONG_ERROR", L"The log file name is too long." };
1517                    TTMessageBoxW(m_hWnd, &info, MB_ICONEXCLAMATION, ts.UILanguageFile);
1518                  return;                  return;
1519          }          }
1520          if (isInvalidFileNameChar(buf2)) {          if (isInvalidFileNameChar(buf2)) {
1521                  get_lang_msgT("MSG_ERROR", uimsg, _countof(uimsg), _T("ERROR"), ts.UILanguageFile);                  static const TTMessageBoxInfoW info = {
1522                  get_lang_msgT("MSG_LOGFILE_INVALID_CHAR_ERROR", uimsg2, _countof(uimsg2),                          "Tera Term",
1523                                            _T("Invalid character is included in log file name."), ts.UILanguageFile);                          "MSG_ERROR", L"ERROR",
1524                  MessageBox(uimsg2, uimsg, MB_ICONEXCLAMATION);                          "MSG_LOGFILE_INVALID_CHAR_ERROR", L"Invalid character is included in log file name." };
1525                    TTMessageBoxW(m_hWnd, &info, MB_ICONEXCLAMATION, ts.UILanguageFile);
1526                  return;                  return;
1527          }          }
1528          strncpy_s(ts.LogDefaultName, sizeof(ts.LogDefaultName), buf, _TRUNCATE);          strncpy_s(ts.LogDefaultName, sizeof(ts.LogDefaultName), buf, _TRUNCATE);

Legend:
Removed from v.8618  
changed lines
  Added in v.8619

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26