@@ -96,21 +96,21 @@ void CControlTray::DoGrep()
9696 m_cDlgGrep.m_strText = m_pShareData->m_sSearchKeywords .m_aSearchKeys [0 ];
9797 }
9898 if ( 0 < m_pShareData->m_sSearchKeywords .m_aGrepFiles .size () ){
99- wcscpy ( m_cDlgGrep.m_szFile , m_pShareData->m_sSearchKeywords .m_aGrepFiles [0 ] ) ; /* 検索ファイル */
99+ m_cDlgGrep.m_szFile = m_pShareData->m_sSearchKeywords .m_aGrepFiles [0 ]; /* 検索ファイル */
100100 }
101101 if ( 0 < m_pShareData->m_sSearchKeywords .m_aGrepFolders .size () ){
102- wcscpy ( m_cDlgGrep.m_szFolder , m_pShareData->m_sSearchKeywords .m_aGrepFolders [0 ] ) ; /* 検索フォルダー */
102+ m_cDlgGrep.m_szFolder = m_pShareData->m_sSearchKeywords .m_aGrepFolders [0 ]; /* 検索フォルダー */
103103 }
104104 if (0 < m_pShareData->m_sSearchKeywords .m_aExcludeFiles .size ()) {
105- wcscpy ( m_cDlgGrep.m_szExcludeFile , m_pShareData->m_sSearchKeywords .m_aExcludeFiles [0 ]) ; /* 除外ファイル */
105+ m_cDlgGrep.m_szExcludeFile = m_pShareData->m_sSearchKeywords .m_aExcludeFiles [0 ]; /* 除外ファイル */
106106 }
107107 if (0 < m_pShareData->m_sSearchKeywords .m_aExcludeFolders .size ()) {
108- wcscpy ( m_cDlgGrep.m_szExcludeFolder , m_pShareData->m_sSearchKeywords .m_aExcludeFolders [0 ]) ; /* 除外フォルダー */
108+ m_cDlgGrep.m_szExcludeFolder = m_pShareData->m_sSearchKeywords .m_aExcludeFolders [0 ]; /* 除外フォルダー */
109109 }
110110
111111 /* Grepダイアログの表示 */
112- int nRet = m_cDlgGrep.DoModal ( m_hInstance, nullptr , L" " );
113- if ( !nRet || GetTrayHwnd () == nullptr ){
112+ if ( const auto nRet = m_cDlgGrep.DoModal (m_hInstance, nullptr , L" " );
113+ !nRet || GetTrayHwnd () == nullptr ){
114114 return ;
115115 }
116116 m_nCurSearchKeySequence = GetDllShareData ().m_Common .m_sSearch .m_nSearchKeySequence ;
@@ -384,7 +384,6 @@ LRESULT CControlTray::DispatchEvent(
384384
385385 int nId;
386386 HWND hwndWork;
387- LPHELPINFO lphi;
388387
389388 int nRowNum;
390389 EditNode* pEditNodeArr;
@@ -461,7 +460,7 @@ LRESULT CControlTray::DispatchEvent(
461460 case MYWM_HTMLHELP :
462461 {
463462 auto &sWorkBuffer = m_pShareData->m_sWorkBuffer ;
464- WCHAR * pWork = sWorkBuffer .GetWorkBuffer <WCHAR >();
463+ const auto pWork = sWorkBuffer .GetWorkBuffer <WCHAR >();
465464
466465 // pszHelpFile取得
467466 const WCHAR * pszHelpFile = pWork;
@@ -470,6 +469,8 @@ LRESULT CControlTray::DispatchEvent(
470469 // pszKeywords取得
471470 const WCHAR * pszKeywords = &pWork[cchHelpFile + 1 ];
472471
472+ if (!*pszHelpFile) return 0L ;
473+
473474 // Jul. 6, 2001 genta HtmlHelpの呼び出し方法変更
474475 hwndHtmlHelp = OpenHtmlHelp (
475476 nullptr ,
@@ -564,13 +565,8 @@ LRESULT CControlTray::DispatchEvent(
564565
565566// case WM_QUERYENDSESSION:
566567 case WM_HELP :
567- lphi = (LPHELPINFO ) lParam;
568- switch ( lphi->iContextType ){
569- case HELPINFO_MENUITEM :
568+ if (const auto lphi = (LPHELPINFO ) lParam; lphi && HELPINFO_MENUITEM == lphi->iContextType ) {
570569 MyWinHelp ( hwnd, HELP_CONTEXT , FuncID_To_HelpContextID ( (EFunctionCode)lphi->iCtrlId ) );
571- break ;
572- default :
573- break ;
574570 }
575571 return TRUE ;
576572 case WM_COMMAND :
@@ -1442,24 +1438,23 @@ void CControlTray::TerminateApplication(
14421438 HWND hWndFrom // !< [in] 呼び出し元のウィンドウハンドル
14431439)
14441440{
1445- DLLSHAREDATA * pShareData = &GetDllShareData (); /* 共有データ構造体のアドレスを返す */
1441+ const auto pShareData = &GetDllShareData (); /* 共有データ構造体のアドレスを返す */
14461442
14471443 /* 現在の編集ウィンドウの数を調べる */
1448- if ( pShareData->m_Common .m_sGeneral .m_bExitConfirm ){ // 終了時の確認
1449- if ( 0 < CAppNodeGroupHandle (0 ).GetEditorWindowsNum () ){
1450- if ( IDYES != ::MYMESSAGEBOX (
1444+ if ( pShareData->m_Common .m_sGeneral .m_bExitConfirm && // 終了時の確認
1445+ 0 < CAppNodeGroupHandle (0 ).GetEditorWindowsNum () &&
1446+ IDYES != ::MessageBoxF (
14511447 hWndFrom,
14521448 MB_YESNO | MB_APPLMODAL | MB_ICONQUESTION ,
14531449 GSTR_APPNAME ,
14541450 LS (STR_TRAY_EXITALL )
14551451 ) ){
14561452 return ;
1457- }
1458- }
14591453 }
1454+
14601455 /* 「すべてのウィンドウを閉じる」要求 */ // Oct. 7, 2000 jepro 「編集ウィンドウの全終了」という説明を左記のように変更
1461- BOOL bCheckConfirm = ( pShareData->m_Common .m_sGeneral .m_bExitConfirm )? FALSE : TRUE ; // 2006.12.25 ryoji 終了確認済みならそれ以上は確認しない
1462- if ( CloseAllEditor ( bCheckConfirm, hWndFrom, TRUE , 0 ) ) { // 2006.12.25, 2007.02.13 ryoji 引数追加
1456+ if ( const auto bCheckConfirm = pShareData->m_Common .m_sGeneral .m_bExitConfirm ; // 2006.12.25 ryoji 終了確認済みならそれ以上は確認しない
1457+ CloseAllEditor (bCheckConfirm, hWndFrom, TRUE , 0 )) { // 2006.12.25, 2007.02.13 ryoji 引数追加
14631458 ::PostMessageAny ( pShareData->m_sHandles.m_hwndTray, WM_CLOSE , 0 , 0 );
14641459 }
14651460 return ;
@@ -1506,7 +1501,6 @@ int CControlTray::CreatePopUpMenu_L( void )
15061501 WCHAR szMenu[100 + MAX_PATH * 2 ]; // Jan. 19, 2001 genta
15071502 POINT po;
15081503 RECT rc;
1509- EditInfo* pfi;
15101504
15111505 // 本当はセマフォにしないとだめ
15121506 if ( m_bUseTrayMenu ) return -1 ;
@@ -1568,7 +1562,7 @@ int CControlTray::CreatePopUpMenu_L( void )
15681562 if ( IsSakuraMainWindow ( m_pShareData->m_sNodes .m_pEditArr [i].GetHwnd () ) ){
15691563 /* トレイからエディタへの編集ファイル名要求通知 */
15701564 ::SendMessage ( m_pShareData->m_sNodes.m_pEditArr[i].GetHwnd(), MYWM_GETFILEINFO, 0, 0 );
1571- pfi = (EditInfo*) &m_pShareData->m_sWorkBuffer .m_EditInfo_MYWM_GETFILEINFO ;
1565+ const auto pfi = &m_pShareData->m_sWorkBuffer .m_EditInfo_MYWM_GETFILEINFO ;
15721566
15731567 // メニューラベル。1からアクセスキーを振る
15741568 CFileNameManager::getInstance ()->GetMenuFullLabel_WinList ( szMenu, int (std::size (szMenu)), pfi, m_pShareData->m_sNodes .m_pEditArr [i].m_nId , i, dcFont.GetHDC () );
0 commit comments