diff --git a/CHANGELOG.md b/CHANGELOG.md index f0b7153b92..39a9bdcaa7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,35 @@ # Change Log +## [v2.4.0-beta4](https://github.com/sakura-editor/sakura/tree/v2.4.0-beta4) (2020-02-15) + +[Full Changelog](https://github.com/sakura-editor/sakura/compare/v2.4.0-beta3...v2.4.0-beta4) + +### 機能追加 + +- batch ファイルのキーワードに setlocal/endlocal を追加 [\#1171](https://github.com/sakura-editor/sakura/pull/1171) ([m-tmatma](https://github.com/m-tmatma)) + +### バグ修正 + +- C++ファイルのアウトライン解析がトグルで閉じない不具合の修正 [\#1176](https://github.com/sakura-editor/sakura/pull/1176) ([berryzplus](https://github.com/berryzplus)) +- 検索条件の文字列をエスケープする処理を関数化する変更のうち、CNativeW::AppendStringF を使うように変更したのをやっぱ止める [\#1135](https://github.com/sakura-editor/sakura/pull/1135) ([beru](https://github.com/beru)) + + + +### その他変更 + +- ChmSourceConverterのターゲットバージョンを下げる [\#1195](https://github.com/sakura-editor/sakura/pull/1195) ([berryzplus](https://github.com/berryzplus)) +- ログの整形、変数の定義位置の移動 \(\#1183 を分割してレビューしやすくする\) [\#1186](https://github.com/sakura-editor/sakura/pull/1186) ([m-tmatma](https://github.com/m-tmatma)) +- Appveyor 専用の環境変数を汎用的なものに定義しなおす \(\#1183 を分割した PR\) [\#1185](https://github.com/sakura-editor/sakura/pull/1185) ([m-tmatma](https://github.com/m-tmatma)) +- Visual Studio 2017/2019 の環境構築方法に関する説明を更新 [\#1165](https://github.com/sakura-editor/sakura/pull/1165) ([m-tmatma](https://github.com/m-tmatma)) +- Visual Studio のインストールオプションの設定ファイルを追加する [\#1162](https://github.com/sakura-editor/sakura/pull/1162) ([m-tmatma](https://github.com/m-tmatma)) +- インストーラに同梱する bregonig.dll を Ver.4.20 にする [\#1158](https://github.com/sakura-editor/sakura/pull/1158) ([m-tmatma](https://github.com/m-tmatma)) +- Universal Ctags の Windows のバイナリ \(2020-01-12/feffe43a\) に差し替え [\#1156](https://github.com/sakura-editor/sakura/pull/1156) ([m-tmatma](https://github.com/m-tmatma)) +- CDataProfileの「abortします」コメントを復活する [\#1155](https://github.com/sakura-editor/sakura/pull/1155) ([berryzplus](https://github.com/berryzplus)) +- Copyright を 2020 にする [\#1154](https://github.com/sakura-editor/sakura/pull/1154) ([m-tmatma](https://github.com/m-tmatma)) +- 検索条件の文字列をエスケープする処理を関数化する [\#1132](https://github.com/sakura-editor/sakura/pull/1132) ([berryzplus](https://github.com/berryzplus)) +- 未初期化のout変数を参照しないため戻り値をチェックするようにする [\#1120](https://github.com/sakura-editor/sakura/pull/1120) ([berryzplus](https://github.com/berryzplus)) +- \#1117 で入れた修正のうち master に入れるべきではない修正を取り除いて取り込む [\#1118](https://github.com/sakura-editor/sakura/pull/1118) ([m-tmatma](https://github.com/m-tmatma)) + ## [v2.4.0-beta3](https://github.com/sakura-editor/sakura/tree/v2.4.0-beta3) (2019-12-22) [Full Changelog](https://github.com/sakura-editor/sakura/compare/v2.4.0-beta2...v2.4.0-beta3) diff --git a/appveyor_env.py b/appveyor_env.py index 99f4a44afd..a10fb764c2 100644 --- a/appveyor_env.py +++ b/appveyor_env.py @@ -111,7 +111,7 @@ def __init__(self): # appveyor の PR の最新の commit Hash if "APPVEYOR_PULL_REQUEST_NUMBER" in self.env and "APPVEYOR_PULL_REQUEST_HEAD_COMMIT" in self.env: - # GITHUB_COMMIT_URL_PR_HEAD + # GITHUB_PR_HEAD_URL temp = [ repoURL, "pull", @@ -119,7 +119,7 @@ def __init__(self): "commits", self.env["APPVEYOR_PULL_REQUEST_HEAD_COMMIT"], ] - self.var["GITHUB_COMMIT_URL_PR_HEAD"] = '/'.join(temp) + self.var["GITHUB_PR_HEAD_URL"] = '/'.join(temp) # msbuild のログに現れる小文字に変換されてしまったファイルパスを # もともとの大文字小文字を保存したパスに変換する。 diff --git a/ci-build.md b/ci-build.md index de2f60a28b..a264780aad 100644 --- a/ci-build.md +++ b/ci-build.md @@ -14,7 +14,7 @@ |CI_BUILD_VERSION|CI のビルドバージョン (文字列)|×|◎|◎|◎| |CI_REPO_NAME|リポジトリ名|×|◎|◎|◎| |GITHUB_COMMIT_URL|GitHub の Commit URL|×|◎|◎|◎| -|GITHUB_COMMIT_URL_PR_HEAD|GitHub の PR の Head の URL|×|○ (PRのみ)|○ (PRのみ)|○ (PRのみ)| +|GITHUB_PR_HEAD_URL|GitHub の PR の Head の URL|×|○ (PRのみ)|○ (PRのみ)|○ (PRのみ)| |GITHUB_PR_HEAD_COMMIT|GitHub の PR の Head Revision|×|○ (PRのみ)|○ (PRのみ)|○ (PRのみ)| |GITHUB_PR_HEAD_SHORT_COMMIT|GitHub の PR の Head Revision 短縮形|×|○ (PRのみ)|○ (PRのみ)|○ (PRのみ)| |GITHUB_PR_NUMBER|GitHub の PR 番号|×|○ (PRのみ)|○ (PRのみ)|○ (PRのみ)| @@ -75,7 +75,7 @@ APPVEYOR_REPO_TAG_NAME は利用をやめて 代わりに GIT_TAG_NAME を使う |GITHUB_PR_NUMBER_INT|GITHUB_PR_NUMBER|数値| |GITHUB_PR_NUMBER_LABEL|GITHUB_PR_NUMBER|文字列| |GITHUB_COMMIT_URL|GITHUB_COMMIT_URL|文字列| -|GITHUB_COMMIT_URL_PR_HEAD|GITHUB_COMMIT_URL_PR_HEAD|文字列| +|GITHUB_PR_HEAD_URL|GITHUB_PR_HEAD_URL|文字列| |GITHUB_PR_HEAD_COMMIT|GITHUB_PR_HEAD_COMMIT|文字列| |GITHUB_PR_HEAD_SHORT_COMMIT|GITHUB_PR_HEAD_SHORT_COMMIT|文字列| |CI_BUILD_URL|CI_BUILD_URL|文字列| diff --git a/help/sakura/res/HLP000001.html b/help/sakura/res/HLP000001.html index 69dcb4d6b2..e5e0cc9e50 100644 --- a/help/sakura/res/HLP000001.html +++ b/help/sakura/res/HLP000001.html @@ -15,8 +15,8 @@ -->

-
サクラエディタ Ver 2.4.0 (開発版)
-
ヘルプファイル最終更新日 2019/12/21
+
サクラエディタ Ver 2.4.0 (Beta5)
+
ヘルプファイル最終更新日 2020/03/19
https://sakura-editor.github.io/

サクラエディタ(旧称:テキストエディタ)は、「たけ(竹パンダ)」さんのテキストエディタSAKURAの公開ソース(2000/02/21付)を元に不具合修正および機能拡張を行ったものです。
@@ -112,7 +112,7 @@

このヘルプファイルについて/GNU Free ■ヘルプファイル更新履歴


-Copyright (c) 2001-2015 Project Sakura-Editor.
+Copyright (c) 2001-2020 Project SAKURA Editor.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation. A copy of the license is included in the section entitled "GNU Free Documentation License". diff --git a/sakura/githash.bat b/sakura/githash.bat index 5cf60ff771..dda67dc6d2 100644 --- a/sakura/githash.bat +++ b/sakura/githash.bat @@ -138,7 +138,7 @@ exit /b 0 @rem No PR ) else ( @rem PR URL - set "GITHUB_COMMIT_URL_PR_HEAD=%PREFIX_GITHUB%/%CI_REPO_NAME%/pull/%GITHUB_PR_NUMBER%/commits/%GITHUB_PR_HEAD_COMMIT%" + set "GITHUB_PR_HEAD_URL=%PREFIX_GITHUB%/%CI_REPO_NAME%/pull/%GITHUB_PR_NUMBER%/commits/%GITHUB_PR_HEAD_COMMIT%" ) ) exit /b 0 @@ -203,7 +203,7 @@ exit /b 0 @echo CI_BUILD_URL : %CI_BUILD_URL% @echo. @echo GITHUB_COMMIT_URL : %GITHUB_COMMIT_URL% - @echo GITHUB_COMMIT_URL_PR_HEAD : %GITHUB_COMMIT_URL_PR_HEAD% + @echo GITHUB_PR_HEAD_URL : %GITHUB_PR_HEAD_URL% @echo GITHUB_PR_HEAD_COMMIT : %GITHUB_PR_HEAD_COMMIT% @echo GITHUB_PR_HEAD_SHORT_COMMIT : %GITHUB_PR_HEAD_SHORT_COMMIT% @echo. @@ -249,7 +249,7 @@ exit /b 0 ) @rem enable 'dev version' macro which will be disabled on release branches - echo #define DEV_VERSION + @rem echo #define DEV_VERSION if "%CI_ACCOUNT_NAME%" == "" ( echo // CI_ACCOUNT_NAME is not defined @@ -289,10 +289,10 @@ exit /b 0 echo #define GITHUB_COMMIT_URL "%GITHUB_COMMIT_URL%" ) - if "%GITHUB_COMMIT_URL_PR_HEAD%" == "" ( - echo // GITHUB_COMMIT_URL_PR_HEAD is not defined + if "%GITHUB_PR_HEAD_URL%" == "" ( + echo // GITHUB_PR_HEAD_URL is not defined ) else ( - echo #define GITHUB_COMMIT_URL_PR_HEAD "%GITHUB_COMMIT_URL_PR_HEAD%" + echo #define GITHUB_PR_HEAD_URL "%GITHUB_PR_HEAD_URL%" ) if "%GITHUB_PR_HEAD_COMMIT%" == "" ( diff --git a/sakura_core/CDataProfile.h b/sakura_core/CDataProfile.h index 5e7fe2f4c9..336997fc09 100644 --- a/sakura_core/CDataProfile.h +++ b/sakura_core/CDataProfile.h @@ -44,7 +44,6 @@ typedef const StringBufferW_ StringBufferW; //文字列バッファ型インスタンスの生成マクロ #define MakeStringBufferW(S) StringBufferW(S,_countof(S)) -#define MakeStringBufferW0(S) StringBufferW(S,0) //2007.09.24 kobake データ変換部を子クラスに分離 //!各種データ変換付きCProfile diff --git a/sakura_core/CGrepAgent.cpp b/sakura_core/CGrepAgent.cpp index f04532d4d0..bdeb982a84 100644 --- a/sakura_core/CGrepAgent.cpp +++ b/sakura_core/CGrepAgent.cpp @@ -49,6 +49,34 @@ inline CNativeW EscapeStringLiteral( const STypeConfig& type, const CNativeW& cm return cmemWork2; } +/*! + * パスリストを文字列化する + */ +template +std::wstring FormatPathList( const ContainerType& containter ) +{ + std::wstring strPatterns; + bool firstItem = true; + for( const auto& pattern : containter ){ + // パスリストは ':' で区切る(2つ目以降の前に付加する) + if( firstItem ){ + firstItem = false; + }else { + strPatterns += L';'; + } + + // ';' を含むパス名は引用符で囲む + if( std::wstring::npos != std::wstring_view( pattern ).find( L';' ) ){ + strPatterns += L'"'; + strPatterns += pattern; + strPatterns += L'"'; + }else{ + strPatterns += pattern; + } + } + return strPatterns; +} + CGrepAgent::CGrepAgent() : m_bGrepMode( false ) /* Grepモードか */ , m_bGrepRunning( false ) /* Grep処理中 */ @@ -190,8 +218,6 @@ DWORD CGrepAgent::DoGrep( const CNativeW* pcmGrepReplace, const CNativeW* pcmGrepFile, const CNativeW* pcmGrepFolder, - const CNativeW* pcmExcludeFile, - const CNativeW* pcmExcludeFolder, bool bGrepCurFolder, BOOL bGrepSubFolder, bool bGrepStdout, @@ -379,9 +405,7 @@ DWORD CGrepAgent::DoGrep( CGrepEnumKeys cGrepEnumKeys; { int nErrorNo = cGrepEnumKeys.SetFileKeys( pcmGrepFile->GetStringPtr() ); - int nErrorNo_ExcludeFile = cGrepEnumKeys.AddExceptFile(pcmExcludeFile->GetStringPtr()); - int nErrorNo_ExcludeFolder = cGrepEnumKeys.AddExceptFolder(pcmExcludeFolder->GetStringPtr()); - if( nErrorNo != 0 || nErrorNo_ExcludeFile != 0 || nErrorNo_ExcludeFolder != 0){ + if( nErrorNo != 0 ){ this->m_bGrepRunning = false; pcViewDst->m_bDoing_UndoRedo = false; pcViewDst->SetUndoBuffer(); @@ -393,18 +417,6 @@ DWORD CGrepAgent::DoGrep( else if( nErrorNo == 2 ){ pszErrorMessage = LS(STR_GREP_ERR_ENUMKEYS2); } - else if (nErrorNo_ExcludeFile == 1) { - pszErrorMessage = LS(STR_GREP_ERR_ENUMKEYS1); - } - else if (nErrorNo_ExcludeFile == 2) { - pszErrorMessage = LS(STR_GREP_ERR_ENUMKEYS2); - } - else if (nErrorNo_ExcludeFolder == 1) { - pszErrorMessage = LS(STR_GREP_ERR_ENUMKEYS1); - } - else if (nErrorNo_ExcludeFolder == 2) { - pszErrorMessage = LS(STR_GREP_ERR_ENUMKEYS2); - } ErrorMessage( pcViewDst->m_hwndParent, L"%s", pszErrorMessage ); return 0; } @@ -441,39 +453,40 @@ DWORD CGrepAgent::DoGrep( } cmemMessage.AppendString( LS( STR_GREP_SEARCH_TARGET ) ); //L"検索対象 " - cmemMessage.AppendString( pcmGrepFile->GetStringPtr() ); + { + // 解析済みのファイルパターン配列を取得する + const auto& vecSearchFileKeys = cGrepEnumKeys.m_vecSearchFileKeys; + std::wstring strPatterns = FormatPathList( vecSearchFileKeys ); + cmemMessage.AppendString( strPatterns.c_str(), strPatterns.length() ); + } cmemMessage.AppendString( L"\r\n" ); cmemMessage.AppendString( LS( STR_GREP_SEARCH_FOLDER ) ); //L"フォルダ " { - std::wstring grepFolder; - for( int i = 0; i < (int)vPaths.size(); i++ ){ - // パスリストは ':' で区切る(2つ目以降の前に付加する) - if( i ){ - grepFolder += L';'; - } - // 末尾のバックスラッシュを削る - std::wstring sPath = ChopYen( vPaths[i] ); - - // ';' を含むパス名は引用符で囲む - if( auto_strchr( sPath.c_str(), L';' ) ){ - grepFolder += L'"'; - grepFolder += sPath; - grepFolder += L'"'; - }else{ - grepFolder += sPath; - } - } - cmemMessage.AppendString( grepFolder.c_str() ); + // フォルダリストから末尾のバックスラッシュを削ったパスリストを作る + std::list folders; + std::transform( vPaths.cbegin(), vPaths.cend(), std::back_inserter( folders ), []( const auto& path ) { return ChopYen( path ); } ); + std::wstring strPatterns = FormatPathList( folders ); + cmemMessage.AppendString( strPatterns.c_str(), strPatterns.length() ); } cmemMessage.AppendString( L"\r\n" ); cmemMessage.AppendString(LS(STR_GREP_EXCLUDE_FILE)); //L"除外ファイル " - cmemMessage.AppendString( pcmExcludeFile->GetStringPtr() ); + { + // 除外ファイルの解析済みリストを取得る + auto excludeFiles = cGrepEnumKeys.GetExcludeFiles(); + std::wstring strPatterns = FormatPathList( excludeFiles ); + cmemMessage.AppendString( strPatterns.c_str(), strPatterns.length() ); + } cmemMessage.AppendString(L"\r\n"); cmemMessage.AppendString(LS(STR_GREP_EXCLUDE_FOLDER)); //L"除外フォルダ " - cmemMessage.AppendString( pcmExcludeFolder->GetStringPtr() ); + { + // 除外フォルダの解析済みリストを取得する + auto excludeFolders = cGrepEnumKeys.GetExcludeFolders(); + std::wstring strPatterns = FormatPathList( excludeFolders ); + cmemMessage.AppendString( strPatterns.c_str(), strPatterns.length() ); + } cmemMessage.AppendString(L"\r\n"); const wchar_t* pszWork; diff --git a/sakura_core/CGrepAgent.h b/sakura_core/CGrepAgent.h index bb99de5760..7ea716a271 100644 --- a/sakura_core/CGrepAgent.h +++ b/sakura_core/CGrepAgent.h @@ -84,8 +84,6 @@ class CGrepAgent : public CDocListenerEx{ const CNativeW* pcmGrepReplace, const CNativeW* pcmGrepFile, const CNativeW* pcmGrepFolder, - const CNativeW* pcmExcludeFile, - const CNativeW* pcmExcludeFolder, bool bGrepCurFolder, BOOL bGrepSubFolder, bool bGrepStdout, diff --git a/sakura_core/CGrepEnumKeys.h b/sakura_core/CGrepEnumKeys.h index b9d76b8ee5..878f4d4b53 100644 --- a/sakura_core/CGrepEnumKeys.h +++ b/sakura_core/CGrepEnumKeys.h @@ -31,6 +31,7 @@ */ #pragma once +#include #include #include #include @@ -59,6 +60,26 @@ class CGrepEnumKeys { ClearItems(); } + // 除外ファイルの2つの解析済み配列から1つのリストを作る + auto GetExcludeFiles() const -> std::list { + std::list excludeFiles; + const auto& fileKeys = m_vecExceptFileKeys; + excludeFiles.insert( excludeFiles.cend(), fileKeys.cbegin(), fileKeys.cend() ); + const auto& absFileKeys = m_vecExceptAbsFileKeys; + excludeFiles.insert( excludeFiles.cend(), absFileKeys.cbegin(), absFileKeys.cend() ); + return excludeFiles; + } + + // 除外フォルダの2つの解析済み配列から1つのリストを作る + auto GetExcludeFolders() const -> std::list { + std::list excludeFolders; + const auto& folderKeys = m_vecExceptFolderKeys; + excludeFolders.insert( excludeFolders.cend(), folderKeys.cbegin(), folderKeys.cend() ); + const auto& absFolderKeys = m_vecExceptAbsFolderKeys; + excludeFolders.insert( excludeFolders.cend(), absFolderKeys.cbegin(), absFolderKeys.cend() ); + return excludeFolders; + } + int SetFileKeys( LPCWSTR lpKeys ){ const WCHAR* WILDCARD_ANY = L"*.*"; //サブフォルダ探索用 ClearItems(); diff --git a/sakura_core/GrepInfo.cpp b/sakura_core/GrepInfo.cpp index cfb2382aed..b609dab55f 100644 --- a/sakura_core/GrepInfo.cpp +++ b/sakura_core/GrepInfo.cpp @@ -34,8 +34,6 @@ GrepInfo::GrepInfo() noexcept , cmGrepRep() , cmGrepFile() , cmGrepFolder() - , cmExcludeFile() - , cmExcludeFolder() , sGrepSearchOption() , bGrepCurFolder(false) , bGrepStdout(false) diff --git a/sakura_core/GrepInfo.h b/sakura_core/GrepInfo.h index dacda5eb49..0f163ca971 100644 --- a/sakura_core/GrepInfo.h +++ b/sakura_core/GrepInfo.h @@ -41,8 +41,6 @@ struct GrepInfo { CNativeW cmGrepRep; //!< 置換キー CNativeW cmGrepFile; //!< 検索対象ファイル CNativeW cmGrepFolder; //!< 検索対象フォルダ - CNativeW cmExcludeFile; //!< 除外対象ファイル - CNativeW cmExcludeFolder; //!< 除外対象フォルダ SSearchOption sGrepSearchOption; //!< 検索オプション bool bGrepCurFolder; //!< カレントディレクトリを維持 bool bGrepStdout; //!< 標準出力モード diff --git a/sakura_core/_main/CControlTray.cpp b/sakura_core/_main/CControlTray.cpp index 44cb9c1760..632d44a8fc 100644 --- a/sakura_core/_main/CControlTray.cpp +++ b/sakura_core/_main/CControlTray.cpp @@ -97,67 +97,6 @@ void CControlTray::DoGrep() DoGrepCreateWindow(m_hInstance, GetDllShareData().m_sHandles.m_hwndTray, m_cDlgGrep); } -/* - @brief ファイル/フォルダの除外パターンをエスケープする必要があるか判断する - @param[in] pattern チェックするパターン - @return true エスケープする必要がある - @return false エスケープする必要がない -*/ -static bool IsEscapeRequiredForExcludePattern(const wstring & pattern) -{ - const auto NotFound = std::string::npos; - if (pattern.find(L'!') != NotFound) - { - return true; - } - if (pattern.find(L'#') != NotFound) - { - return true; - } - return false; -} - -/* - @brief エスケープパターンを取得する - @param[in] pattern エスケープ対象文字列 -*/ -static LPCWSTR GetEscapePattern(const wstring& pattern) -{ - return IsEscapeRequiredForExcludePattern(pattern) ? L"\"\"" : L""; -} - -/* - @brief フォルダの除外パターンを詰める - @param[in,out] cFilePattern "-GFILE=" に指定する引数用のバッファ (このバッファの末尾に追加する) - @param[in] cmWorkExcludeFolder Grep ダイアログで指定されたフォルダの除外パターン -*/ -static void AppendExcludeFolderPatterns(CNativeW& cFilePattern, const CNativeW& cmWorkExcludeFolder) -{ - auto patterns = CGrepEnumKeys::SplitPattern(cmWorkExcludeFolder.GetStringPtr()); - for (auto iter = patterns.begin(); iter != patterns.end(); ++iter) - { - const auto & pattern = (*iter); - LPCWSTR escapeStr = GetEscapePattern(pattern); - cFilePattern.AppendStringF(L"#%s%s%s;", escapeStr, pattern.c_str(), escapeStr); - } -} - -/* - @brief ファイルの除外パターンを詰める - @param[in,out] cFilePattern "-GFILE=" に指定する引数用のバッファ (このバッファの末尾に追加する) - @param[in] cmWorkExcludeFile Grep ダイアログで指定されたファイルの除外パターン -*/ -static void AppendExcludeFilePatterns(CNativeW& cFilePattern, const CNativeW& cmWorkExcludeFile) -{ - auto patterns = CGrepEnumKeys::SplitPattern(cmWorkExcludeFile.GetStringPtr()); - for (auto iter = patterns.begin(); iter != patterns.end(); ++iter) - { - const auto & pattern = (*iter); - LPCWSTR escapeStr = GetEscapePattern(pattern); - cFilePattern.AppendStringF(L"!%s%s%s;", escapeStr, pattern.c_str(), escapeStr); - } -} - void CControlTray::DoGrepCreateWindow(HINSTANCE hinst, HWND msgParent, CDlgGrep& cDlgGrep) { /*======= Grepの実行 =============*/ @@ -166,35 +105,23 @@ void CControlTray::DoGrepCreateWindow(HINSTANCE hinst, HWND msgParent, CDlgGrep& CNativeW cmWork1; CNativeW cmWork2; CNativeW cmWork3; - CNativeW cmWorkExcludeFile; - CNativeW cmWorkExcludeFolder; + cmWork1.SetString( cDlgGrep.m_strText.c_str() ); - cmWork2.SetString( cDlgGrep.m_szFile ); + cmWork2 = cDlgGrep.GetPackedGFileString(); cmWork3.SetString( cDlgGrep.m_szFolder ); - cmWorkExcludeFile.SetString(cDlgGrep.m_szExcludeFile); - cmWorkExcludeFolder.SetString(cDlgGrep.m_szExcludeFolder); - cmWork1.Replace( L"\"", L"\"\"" ); cmWork2.Replace( L"\"", L"\"\"" ); cmWork3.Replace( L"\"", L"\"\"" ); - cmWorkExcludeFile.Replace( L"\"", L"\"\""); - cmWorkExcludeFolder.Replace(L"\"", L"\"\""); // -GREPMODE -GKEY="1" -GFILE="*.*;*.c;*.h" -GFOLDER="c:\" -GCODE=0 -GOPT=S CNativeW cCmdLine; WCHAR szTemp[20]; - // 除外ファイル、除外フォルダの設定を "-GFILE=" の設定に pack するためにデータを作る。 - CNativeW cFilePattern; - AppendExcludeFolderPatterns(cFilePattern, cmWorkExcludeFolder); - AppendExcludeFilePatterns(cFilePattern, cmWorkExcludeFile); - cFilePattern.AppendString(cmWork2.GetStringPtr()); - cCmdLine.AppendString(L"-GREPMODE -GKEY=\""); cCmdLine.AppendString(cmWork1.GetStringPtr()); cCmdLine.AppendString(L"\" -GFILE=\""); - cCmdLine.AppendString(cFilePattern.GetStringPtr()); + cCmdLine.AppendString(cmWork2.GetStringPtr()); cCmdLine.AppendString(L"\" -GFOLDER=\""); cCmdLine.AppendString(cmWork3.GetStringPtr()); cCmdLine.AppendString(L"\" -GCODE="); diff --git a/sakura_core/_main/CNormalProcess.cpp b/sakura_core/_main/CNormalProcess.cpp index 5ddd0c04ad..9db2f7f2fb 100644 --- a/sakura_core/_main/CNormalProcess.cpp +++ b/sakura_core/_main/CNormalProcess.cpp @@ -210,8 +210,6 @@ bool CNormalProcess::InitializeProcess() &gi.cmGrepRep, &gi.cmGrepFile, &gi.cmGrepFolder, - &gi.cmExcludeFile, - &gi.cmExcludeFolder, gi.bGrepCurFolder, gi.bGrepSubFolder, gi.bGrepStdout, diff --git a/sakura_core/cmd/CViewCommander_Grep.cpp b/sakura_core/cmd/CViewCommander_Grep.cpp index a71de64fe2..e25905b21e 100644 --- a/sakura_core/cmd/CViewCommander_Grep.cpp +++ b/sakura_core/cmd/CViewCommander_Grep.cpp @@ -59,13 +59,9 @@ void CViewCommander::Command_GREP( void ) CNativeW cmWork2; CNativeW cmWork3; CNativeW cmWork4; - CNativeW cmWorkExcludeFile; - CNativeW cmWorkExcludeFolder; cmWork1.SetString( GetEditWindow()->m_cDlgGrep.m_strText.c_str() ); - cmWork2.SetString( GetEditWindow()->m_cDlgGrep.m_szFile ); + cmWork2 = GetEditWindow()->m_cDlgGrep.GetPackedGFileString(); cmWork3.SetString( GetEditWindow()->m_cDlgGrep.m_szFolder ); - cmWorkExcludeFile.SetString(GetEditWindow()->m_cDlgGrep.m_szExcludeFile); - cmWorkExcludeFolder.SetString(GetEditWindow()->m_cDlgGrep.m_szExcludeFolder); /* 今のEditViewにGrep結果を表示する。 Grepモードのとき、または未編集で無題かつアウトプットでない場合。 @@ -97,8 +93,6 @@ void CViewCommander::Command_GREP( void ) &cmWork4, &cmWork2, &cmWork3, - &cmWorkExcludeFile, - &cmWorkExcludeFolder, false, GetEditWindow()->m_cDlgGrep.m_bSubFolder, false, @@ -168,16 +162,12 @@ void CViewCommander::Command_GREP_REPLACE( void ) CNativeW cmWork2; CNativeW cmWork3; CNativeW cmWork4; - CNativeW cmWorkExcludeFile; - CNativeW cmWorkExcludeFolder; CDlgGrepReplace& cDlgGrepRep = GetEditWindow()->m_cDlgGrepReplace; cmWork1.SetString( cDlgGrepRep.m_strText.c_str() ); - cmWork2.SetString( cDlgGrepRep.m_szFile ); + cmWork2 = cDlgGrepRep.GetPackedGFileString(); cmWork3.SetString( cDlgGrepRep.m_szFolder ); cmWork4.SetString( cDlgGrepRep.m_strText2.c_str() ); - cmWorkExcludeFile.SetString(cDlgGrepRep.m_szExcludeFile); - cmWorkExcludeFolder.SetString(cDlgGrepRep.m_szExcludeFolder); /* 今のEditViewにGrep結果を表示する。 Grepモードのとき、または未編集で無題かつアウトプットでない場合。 @@ -197,8 +187,6 @@ void CViewCommander::Command_GREP_REPLACE( void ) &cmWork4, &cmWork2, &cmWork3, - &cmWorkExcludeFile, - &cmWorkExcludeFolder, false, cDlgGrepRep.m_bSubFolder, false, // Stdout diff --git a/sakura_core/dlg/CDialog.cpp b/sakura_core/dlg/CDialog.cpp index 556dba7182..d5d3dc2bd0 100644 --- a/sakura_core/dlg/CDialog.cpp +++ b/sakura_core/dlg/CDialog.cpp @@ -446,6 +446,7 @@ BOOL CDialog::OnCommand( WPARAM wParam, LPARAM lParam ) }else if( ::lstrcmpi(szClass, L"Edit") == 0 ){ switch( wNotifyCode ){ case EN_CHANGE: return OnEnChange( hwndCtl, wID ); + case EN_SETFOCUS: return OnEnSetFocus( hwndCtl, wID ); case EN_KILLFOCUS: return OnEnKillFocus( hwndCtl, wID ); } }else if( ::lstrcmpi(szClass, L"ListBox") == 0 ){ diff --git a/sakura_core/dlg/CDialog.h b/sakura_core/dlg/CDialog.h index 3ae3c34297..280674f00d 100644 --- a/sakura_core/dlg/CDialog.h +++ b/sakura_core/dlg/CDialog.h @@ -102,6 +102,7 @@ class CDialog virtual BOOL OnBnClicked(int wID); virtual BOOL OnStnClicked( int ){return FALSE;} virtual BOOL OnEnChange( HWND hwndCtl, int wID ){return FALSE;} + virtual BOOL OnEnSetFocus( HWND hwndCtl, int wID ){return FALSE;} virtual BOOL OnEnKillFocus( HWND hwndCtl, int wID ){return FALSE;} virtual BOOL OnLbnSelChange( HWND hwndCtl, int wID ){return FALSE;} virtual BOOL OnLbnDblclk( int wID ){return FALSE;} diff --git a/sakura_core/dlg/CDlgAbout.cpp b/sakura_core/dlg/CDlgAbout.cpp index a96a9f6489..1985ec26a1 100644 --- a/sakura_core/dlg/CDlgAbout.cpp +++ b/sakura_core/dlg/CDlgAbout.cpp @@ -280,7 +280,7 @@ BOOL CDlgAbout::OnInitDialog( HWND hwndDlg, WPARAM wParam, LPARAM lParam ) #if defined( GITHUB_COMMIT_URL ) m_UrlGitHubCommitWnd.SetSubclassWindow( GetItemHwnd( IDC_STATIC_URL_GITHUB_COMMIT ) ); #endif -#if defined( GITHUB_COMMIT_URL_PR_HEAD ) +#if defined( GITHUB_PR_HEAD_URL ) m_UrlGitHubPRWnd.SetSubclassWindow( GetItemHwnd( IDC_STATIC_URL_GITHUB_PR ) ); #endif @@ -344,8 +344,8 @@ BOOL CDlgAbout::OnStnClicked( int wID ) #endif return TRUE; case IDC_STATIC_URL_GITHUB_PR: -#if defined(GITHUB_COMMIT_URL_PR_HEAD) - ::ShellExecute(GetHwnd(), NULL, _T(GITHUB_COMMIT_URL_PR_HEAD), NULL, NULL, SW_SHOWNORMAL); +#if defined(GITHUB_PR_HEAD_URL) + ::ShellExecute(GetHwnd(), NULL, _T(GITHUB_PR_HEAD_URL), NULL, NULL, SW_SHOWNORMAL); #endif return TRUE; } diff --git a/sakura_core/dlg/CDlgGrep.cpp b/sakura_core/dlg/CDlgGrep.cpp index d826edf958..0e1ac85b29 100644 --- a/sakura_core/dlg/CDlgGrep.cpp +++ b/sakura_core/dlg/CDlgGrep.cpp @@ -87,6 +87,97 @@ CDlgGrep::CDlgGrep() return; } +/* + @brief ファイル/フォルダの除外パターンをエスケープする必要があるか判断する + @param[in] pattern チェックするパターン + @return true エスケープする必要がある + @return false エスケープする必要がない + @author m-tmatma +*/ +static bool IsEscapeRequiredForExcludePattern(const std::wstring & pattern) +{ + const auto NotFound = std::wstring::npos; + if (pattern.find(L'!') != NotFound) + { + return true; + } + if (pattern.find(L'#') != NotFound) + { + return true; + } + if (pattern.find(L'\x20') != NotFound) + { + return true; + } + if (pattern.find(L';') != NotFound) + { + return true; + } + return false; +} + +/* + @brief エスケープパターンを取得する + @param[in] pattern エスケープ対象文字列 + @author m-tmatma +*/ +static LPCWSTR GetEscapePattern(const std::wstring& pattern) +{ + return IsEscapeRequiredForExcludePattern(pattern) ? L"\"" : L""; +} + +/* + @brief フォルダの除外パターンを詰める + @param[in,out] cFilePattern "-GFILE=" に指定する引数用のバッファ (このバッファの末尾に追加する) + @param[in] cmWorkExcludeFolder Grep ダイアログで指定されたフォルダの除外パターン + @author m-tmatma +*/ +static void AppendExcludeFolderPatterns(CNativeW& cFilePattern, const CNativeW& cmWorkExcludeFolder) +{ + auto patterns = CGrepEnumKeys::SplitPattern(cmWorkExcludeFolder.GetStringPtr()); + for (auto iter = patterns.begin(); iter != patterns.end(); ++iter) + { + const auto & pattern = (*iter); + LPCWSTR escapeStr = GetEscapePattern(pattern); + cFilePattern.AppendStringF(L";%s#%s%s", escapeStr, pattern.c_str(), escapeStr); + } +} + +/* + @brief ファイルの除外パターンを詰める + @param[in,out] cFilePattern "-GFILE=" に指定する引数用のバッファ (このバッファの末尾に追加する) + @param[in] cmWorkExcludeFile Grep ダイアログで指定されたファイルの除外パターン + @author m-tmatma +*/ +static void AppendExcludeFilePatterns(CNativeW& cFilePattern, const CNativeW& cmWorkExcludeFile) +{ + auto patterns = CGrepEnumKeys::SplitPattern(cmWorkExcludeFile.GetStringPtr()); + for (auto iter = patterns.begin(); iter != patterns.end(); ++iter) + { + const auto & pattern = (*iter); + LPCWSTR escapeStr = GetEscapePattern(pattern); + cFilePattern.AppendStringF(L";%s!%s%s", escapeStr, pattern.c_str(), escapeStr); + } +} + +/*! + * 除外ファイル、除外フォルダの設定を "-GFILE=" の設定に pack する + */ +CNativeW CDlgGrep::GetPackedGFileString() const +{ + // ダイアログデータを取得 + CNativeW cmFilePattern( m_szFile ); + CNativeW cmExcludeFiles( m_szExcludeFile ); + CNativeW cmExcludeFolders( m_szExcludeFolder ); + + // 除外ファイル、除外フォルダの設定を "-GFILE=" の設定に pack するためにデータを作る。 + CNativeW cmGFileString( std::move( cmFilePattern ) ); + AppendExcludeFolderPatterns( cmGFileString, cmExcludeFolders ); + AppendExcludeFilePatterns( cmGFileString, cmExcludeFiles ); + + return cmGFileString; +} + /*! コンボボックスのドロップダウンメッセージを捕捉する diff --git a/sakura_core/dlg/CDlgGrep.h b/sakura_core/dlg/CDlgGrep.h index 69432e6a9c..044204b38a 100644 --- a/sakura_core/dlg/CDlgGrep.h +++ b/sakura_core/dlg/CDlgGrep.h @@ -34,6 +34,7 @@ class CDlgGrep : public CDialog /* || Attributes & Operations */ + CNativeW GetPackedGFileString() const; //!< 除外ファイル、除外フォルダの設定を "-GFILE=" の設定に pack する BOOL OnCbnDropDown( HWND hwndCtl, int wID ) override; int DoModal( HINSTANCE, HWND, const WCHAR* ); /* モーダルダイアログの表示 */ // HWND DoModeless( HINSTANCE, HWND, const char* ); /* モードレスダイアログの表示 */ diff --git a/sakura_core/dlg/CDlgJump.cpp b/sakura_core/dlg/CDlgJump.cpp index 9b9e7b1e5c..415c842c1f 100644 --- a/sakura_core/dlg/CDlgJump.cpp +++ b/sakura_core/dlg/CDlgJump.cpp @@ -22,6 +22,7 @@ #include "outline/CFuncInfo.h" #include "outline/CFuncInfoArr.h"// 2002/2/10 aroka ヘッダ整理 #include "util/shell.h" +#include "util/os.h" #include "window/CEditWnd.h" #include "sakura_rc.h" #include "sakura.hh" @@ -184,6 +185,35 @@ BOOL CDlgJump::OnBnClicked( int wID ) return CDialog::OnBnClicked( wID ); } +// IMEのオープン状態復帰用 +static BOOL s_isImmOpenBkup; + +// IMEを使用したくないコントロールのID判定 +static bool isImeUndesirable(int id) +{ + switch (id) { + case IDC_EDIT_LINENUM: + case IDC_EDIT_PLSQL_E1: + return true; + default: + return false; + } +} + +BOOL CDlgJump::OnEnSetFocus(HWND hwndCtl, int wID) +{ + if (isImeUndesirable(wID)) + ImeSetOpen(hwndCtl, FALSE, &s_isImmOpenBkup); + return 0; +} + +BOOL CDlgJump::OnEnKillFocus(HWND hwndCtl, int wID) +{ + if (isImeUndesirable(wID)) + ImeSetOpen(hwndCtl, s_isImmOpenBkup, nullptr); + return 0; +} + /* ダイアログデータの設定 */ void CDlgJump::SetData( void ) { diff --git a/sakura_core/dlg/CDlgJump.h b/sakura_core/dlg/CDlgJump.h index 235a520d9c..d98dd8c222 100644 --- a/sakura_core/dlg/CDlgJump.h +++ b/sakura_core/dlg/CDlgJump.h @@ -42,6 +42,9 @@ class CDlgJump final : public CDialog BOOL OnNotify(WPARAM wParam, LPARAM lParam) override; // Oct. 6, 2000 JEPRO added for Spin control BOOL OnCbnSelChange(HWND hwndCtl, int wID) override; BOOL OnBnClicked(int wID) override; + BOOL OnEnSetFocus(HWND hwndCtl, int wID) override; + BOOL OnEnKillFocus(HWND hwndCtl, int wID) override; + LPVOID GetHelpIdTable(void) override; //@@@ 2002.01.18 add void SetData( void ) override; /* ダイアログデータの設定 */ int GetData( void ) override; /* ダイアログデータの取得 */ diff --git a/sakura_core/dlg/CDlgPrintSetting.cpp b/sakura_core/dlg/CDlgPrintSetting.cpp index 6f6d007e49..5c964c27da 100644 --- a/sakura_core/dlg/CDlgPrintSetting.cpp +++ b/sakura_core/dlg/CDlgPrintSetting.cpp @@ -39,6 +39,7 @@ #include "func/Funccode.h" // Stonee, 2001/03/12 #include "util/shell.h" #include "util/window.h" +#include "util/os.h" #include "sakura_rc.h" // 2002/2/10 aroka #include "sakura.hh" @@ -406,6 +407,34 @@ BOOL CDlgPrintSetting::OnEnChange( HWND hwndCtl, int wID ) return CDialog::OnEnChange( hwndCtl, wID ); } +// IMEのオープン状態復帰用 +static BOOL s_isImmOpenBkup; + +// IMEを使用したくないコントロールのID判定 +static bool isImeUndesirable(int id) +{ + switch (id) { + case IDC_EDIT_FONTHEIGHT: + case IDC_EDIT_LINESPACE: + case IDC_EDIT_DANSUU: + case IDC_EDIT_DANSPACE: + case IDC_EDIT_MARGINTY: + case IDC_EDIT_MARGINBY: + case IDC_EDIT_MARGINLX: + case IDC_EDIT_MARGINRX: + return true; + default: + return false; + } +} + +BOOL CDlgPrintSetting::OnEnSetFocus(HWND hwndCtl, int wID) +{ + if (isImeUndesirable(wID)) + ImeSetOpen(hwndCtl, FALSE, &s_isImmOpenBkup); + return 0; +} + BOOL CDlgPrintSetting::OnEnKillFocus( HWND hwndCtl, int wID ) { switch( wID ){ @@ -426,6 +455,10 @@ BOOL CDlgPrintSetting::OnEnKillFocus( HWND hwndCtl, int wID ) UpdatePrintableLineAndColumn(); break; // ここでは行と桁の更新要求のみ。後の処理はCDialogに任せる。 } + + if (isImeUndesirable(wID)) + ImeSetOpen(hwndCtl, s_isImmOpenBkup, nullptr); + /* 基底クラスメンバ */ return CDialog::OnEnKillFocus( hwndCtl, wID ); } diff --git a/sakura_core/dlg/CDlgPrintSetting.h b/sakura_core/dlg/CDlgPrintSetting.h index c8429830cb..242a18a901 100644 --- a/sakura_core/dlg/CDlgPrintSetting.h +++ b/sakura_core/dlg/CDlgPrintSetting.h @@ -71,6 +71,7 @@ class CDlgPrintSetting final : public CDialog BOOL OnBnClicked(int wID) override; BOOL OnStnClicked(int wID) override; BOOL OnEnChange( HWND hwndCtl, int wID ) override; + BOOL OnEnSetFocus(HWND hwndCtl, int wID) override; BOOL OnEnKillFocus( HWND hwndCtl, int wID ) override; LPVOID GetHelpIdTable(void) override; //@@@ 2002.01.18 add diff --git a/sakura_core/dlg/CDlgTagJumpList.cpp b/sakura_core/dlg/CDlgTagJumpList.cpp index c9f8be311d..cf69d2db45 100644 --- a/sakura_core/dlg/CDlgTagJumpList.cpp +++ b/sakura_core/dlg/CDlgTagJumpList.cpp @@ -1255,15 +1255,13 @@ bool CDlgTagJumpList::ReadTagsParameter( ACHAR s[4][1024]; int nLines = 0; int n2; - fpos_t old_offset; - + fpos_t old_offset = 0; // バッファの後ろから2文字目が\0かどうかで、行末まで読み込んだか確認する const int nLINEDATA_LAST_CHAR = _countof( szLineData ) - 2; szLineData[nLINEDATA_LAST_CHAR] = '\0'; - while( fgets( szLineData, _countof( szLineData ), fp ) ) - { + while( fgets( szLineData, _countof( szLineData ), fp ) ) { nLines++; // fgetsが行すべてを読み込めていない場合の考慮 if( '\0' != szLineData[nLINEDATA_LAST_CHAR] && '\n' != szLineData[nLINEDATA_LAST_CHAR] ){ @@ -1336,15 +1334,17 @@ bool CDlgTagJumpList::ReadTagsParameter( } } szLineData[nLINEDATA_LAST_CHAR] = '\0'; + //巻き戻し用に現在のオフセット位置を退避 + old_offset = ftell(fp); + if (old_offset == -1) { //読み取りエラー or ファイル終端に到達時はタグファイルとして扱わない + return false; + } continue; } else { - //巻き戻し fsetpos(fp, &old_offset); break; } - //巻き戻し用に現在のオフセット位置を退避 - old_offset = ftell(fp); } return true; } diff --git a/sakura_core/dlg/CDlgWinSize.cpp b/sakura_core/dlg/CDlgWinSize.cpp index 830f3f9b3f..0e346e2225 100644 --- a/sakura_core/dlg/CDlgWinSize.cpp +++ b/sakura_core/dlg/CDlgWinSize.cpp @@ -32,6 +32,7 @@ #include "StdAfx.h" #include "dlg/CDlgWinSize.h" #include "util/shell.h" +#include "util/os.h" #include "sakura_rc.h" #include "sakura.hh" @@ -125,6 +126,37 @@ BOOL CDlgWinSize::OnBnClicked( int wID ) return CDialog::OnBnClicked( wID ); } +// IMEのオープン状態復帰用 +static BOOL s_isImmOpenBkup; + +// IMEを使用したくないコントロールのID判定 +static bool isImeUndesirable(int id) +{ + switch (id) { + case IDC_EDIT_WX: + case IDC_EDIT_WY: + case IDC_EDIT_SX: + case IDC_EDIT_SY: + return true; + default: + return false; + } +} + +BOOL CDlgWinSize::OnEnSetFocus(HWND hwndCtl, int wID) +{ + if (isImeUndesirable(wID)) + ImeSetOpen(hwndCtl, FALSE, &s_isImmOpenBkup); + return 0; +} + +BOOL CDlgWinSize::OnEnKillFocus(HWND hwndCtl, int wID) +{ + if (isImeUndesirable(wID)) + ImeSetOpen(hwndCtl, s_isImmOpenBkup, nullptr); + return 0; +} + /*! @brief ダイアログボックスにデータを設定 */ void CDlgWinSize::SetData( void ) diff --git a/sakura_core/dlg/CDlgWinSize.h b/sakura_core/dlg/CDlgWinSize.h index 561d358d5e..9453514673 100644 --- a/sakura_core/dlg/CDlgWinSize.h +++ b/sakura_core/dlg/CDlgWinSize.h @@ -50,6 +50,8 @@ class CDlgWinSize final : public CDialog BOOL OnInitDialog(HWND hwndDlg, WPARAM wParam, LPARAM lParam) override; BOOL OnBnClicked(int wID) override; + BOOL OnEnSetFocus(HWND hwndCtl, int wID) override; + BOOL OnEnKillFocus(HWND hwndCtl, int wID) override; int GetData( void ) override; void SetData( void ) override; LPVOID GetHelpIdTable( void ) override; diff --git a/sakura_core/env/CShareData_IO.cpp b/sakura_core/env/CShareData_IO.cpp index f888dde7eb..081e238110 100644 --- a/sakura_core/env/CShareData_IO.cpp +++ b/sakura_core/env/CShareData_IO.cpp @@ -1383,6 +1383,81 @@ void CShareData_IO::ShareData_IO_Types( CDataProfile& cProfile ) } } +/*! + * ブロックコメントデータの入出力 + * + * @date 2004/10/02 Moca 対になるコメント設定がともに読み込まれたときだけ有効な設定と見なす. + * @date 2020/01/01 berryzplus ShareData_IO_Type_Oneから分離 + */ +static bool ShareData_IO_BlockComment( CDataProfile& cProfile, + const WCHAR* pszSectionName, + const WCHAR* pszEntryKeyFrom, + const WCHAR* pszEntryKeyTo, + CBlockComment& cBlockComment +) noexcept +{ + WCHAR szFrom[BLOCKCOMMENT_BUFFERSIZE]{ 0 }; + WCHAR szTo[BLOCKCOMMENT_BUFFERSIZE]{ 0 }; + + // 書き込み準備 + if( !cProfile.IsReadingMode() ){ + ::wcscpy_s( szFrom, cBlockComment.getBlockCommentFrom() ); + ::wcscpy_s( szTo, cBlockComment.getBlockCommentTo() ); + } + + bool ret = false; + if( cProfile.IOProfileData( pszSectionName, pszEntryKeyFrom, MakeStringBufferW( szFrom ) ) + && cProfile.IOProfileData( pszSectionName, pszEntryKeyTo, MakeStringBufferW( szTo ) ) ){ + //対になる設定が揃った場合のみ有効 + ret = true; + } + + // 読み込み後処理 + if( cProfile.IsReadingMode() && ret ){ + cBlockComment.SetBlockCommentRule( szFrom, szTo ); + } + + return ret; +} + +/*! + * 行コメントデータの入出力 + * + * @date 2004/10/02 Moca 対になるコメント設定がともに読み込まれたときだけ有効な設定と見なす. + * @date 2020/01/01 berryzplus ShareData_IO_Type_Oneから分離 + */ +static bool ShareData_IO_LineComment( CDataProfile& cProfile, + const WCHAR* pszSectionName, + const WCHAR* pszEntryKeyComment, + const WCHAR* pszEntryKeyColumn, + CLineComment& cLineComment, + const int nDataIndex +) noexcept +{ + WCHAR lbuf[COMMENT_DELIMITER_BUFFERSIZE]{ 0 }; + int pos = -1; + + // 書き込み準備 + if( !cProfile.IsReadingMode() ){ + ::wcscpy_s( lbuf, cLineComment.getLineComment( nDataIndex ) ); + pos = cLineComment.getLineCommentPos( nDataIndex ); + } + + bool ret = false; + if( cProfile.IOProfileData( pszSectionName, pszEntryKeyComment, MakeStringBufferW( lbuf ) ) + && cProfile.IOProfileData( pszSectionName, pszEntryKeyColumn, pos ) ){ + //対になる設定が揃った場合のみ有効 + ret = true; + } + + // 読み込み後処理 + if( cProfile.IsReadingMode() && ret ){ + cLineComment.CopyTo( nDataIndex, lbuf, pos ); + } + + return ret; +} + /*! @brief 共有データのSTypeConfigセクションの入出力(1個分) @param[in,out] cProfile INIファイル入出力クラス @@ -1490,75 +1565,14 @@ void CShareData_IO::ShareData_IO_Type_One( CDataProfile& cProfile, STypeConfig& cProfile.IOProfileData( pszSecName, LTEXT("bStringLineOnly"), types.m_bStringLineOnly ); cProfile.IOProfileData( pszSecName, LTEXT("bStringEndLine"), types.m_bStringEndLine ); - // From Here Sep. 28, 2002 genta / YAZAKI - if( cProfile.IsReadingMode() ){ - // Block Comment - wchar_t buffer[2][ BLOCKCOMMENT_BUFFERSIZE ]; - // 2004.10.02 Moca 対になるコメント設定がともに読み込まれたときだけ有効な設定と見なす. - // ブロックコメントの始まりと終わり.行コメントの記号と桁位置 - bool bRet1, bRet2; - buffer[0][0] = buffer[1][0] = L'\0'; - bRet1 = cProfile.IOProfileData( pszSecName, LTEXT("szBlockCommentFrom"), MakeStringBufferW(buffer[0]) ); - bRet2 = cProfile.IOProfileData( pszSecName, LTEXT("szBlockCommentTo"), MakeStringBufferW(buffer[1]) ); - if( bRet1 && bRet2 ) types.m_cBlockComments[0].SetBlockCommentRule( buffer[0], buffer[1] ); - - //@@@ 2001.03.10 by MIK - buffer[0][0] = buffer[1][0] = L'\0'; - bRet1 = cProfile.IOProfileData( pszSecName, LTEXT("szBlockCommentFrom2"), MakeStringBufferW(buffer[0]) ); - bRet2 = cProfile.IOProfileData( pszSecName, LTEXT("szBlockCommentTo2") , MakeStringBufferW(buffer[1]) ); - if( bRet1 && bRet2 ) types.m_cBlockComments[1].SetBlockCommentRule( buffer[0], buffer[1] ); - - // Line Comment - wchar_t lbuf[ COMMENT_DELIMITER_BUFFERSIZE ]; - int pos; - - lbuf[0] = L'\0'; pos = -1; - bRet1 = cProfile.IOProfileData( pszSecName, LTEXT("szLineComment") , MakeStringBufferW(lbuf) ); - bRet2 = cProfile.IOProfileData( pszSecName, LTEXT("nLineCommentColumn") , pos ); - if( bRet1 && bRet2 ) types.m_cLineComment.CopyTo( 0, lbuf, pos ); - - lbuf[0] = L'\0'; pos = -1; - bRet1 = cProfile.IOProfileData( pszSecName, LTEXT("szLineComment2") , MakeStringBufferW(lbuf) ); - bRet2 = cProfile.IOProfileData( pszSecName, LTEXT("nLineCommentColumn2"), pos ); - if( bRet1 && bRet2 ) types.m_cLineComment.CopyTo( 1, lbuf, pos ); - - lbuf[0] = L'\0'; pos = -1; - bRet1 = cProfile.IOProfileData( pszSecName, LTEXT("szLineComment3") , MakeStringBufferW(lbuf) ); //Jun. 01, 2001 JEPRO 追加 - bRet2 = cProfile.IOProfileData( pszSecName, LTEXT("nLineCommentColumn3"), pos ); //Jun. 01, 2001 JEPRO 追加 - if( bRet1 && bRet2 ) types.m_cLineComment.CopyTo( 2, lbuf, pos ); - } - else { // write - // Block Comment - cProfile.IOProfileData( pszSecName, LTEXT("szBlockCommentFrom") , - MakeStringBufferW0(const_cast(types.m_cBlockComments[0].getBlockCommentFrom())) ); - cProfile.IOProfileData( pszSecName, LTEXT("szBlockCommentTo") , - MakeStringBufferW0(const_cast(types.m_cBlockComments[0].getBlockCommentTo())) ); - - //@@@ 2001.03.10 by MIK - cProfile.IOProfileData( pszSecName, LTEXT("szBlockCommentFrom2"), - MakeStringBufferW0(const_cast(types.m_cBlockComments[1].getBlockCommentFrom())) ); - cProfile.IOProfileData( pszSecName, LTEXT("szBlockCommentTo2") , - MakeStringBufferW0(const_cast(types.m_cBlockComments[1].getBlockCommentTo())) ); - - // Line Comment - cProfile.IOProfileData( pszSecName, LTEXT("szLineComment") , - MakeStringBufferW0(const_cast(types.m_cLineComment.getLineComment(0))) ); - cProfile.IOProfileData( pszSecName, LTEXT("szLineComment2") , - MakeStringBufferW0(const_cast(types.m_cLineComment.getLineComment(1))) ); - cProfile.IOProfileData( pszSecName, LTEXT("szLineComment3") , - MakeStringBufferW0(const_cast(types.m_cLineComment.getLineComment(2))) ); //Jun. 01, 2001 JEPRO 追加 - - // From here May 12, 2001 genta - int pos; - pos = types.m_cLineComment.getLineCommentPos( 0 ); - cProfile.IOProfileData( pszSecName, LTEXT("nLineCommentColumn") , pos ); - pos = types.m_cLineComment.getLineCommentPos( 1 ); - cProfile.IOProfileData( pszSecName, LTEXT("nLineCommentColumn2"), pos ); - pos = types.m_cLineComment.getLineCommentPos( 2 ); - cProfile.IOProfileData( pszSecName, LTEXT("nLineCommentColumn3"), pos ); //Jun. 01, 2001 JEPRO 追加 - // To here May 12, 2001 genta - } - // To Here Sep. 28, 2002 genta / YAZAKI + // Block Comment + ShareData_IO_BlockComment( cProfile, pszSecName, L"szBlockCommentFrom", L"szBlockCommentTo", types.m_cBlockComments[0] ); + ShareData_IO_BlockComment( cProfile, pszSecName, L"szBlockCommentFrom2", L"szBlockCommentTo2", types.m_cBlockComments[1] ); + + // Line Comment + ShareData_IO_LineComment( cProfile, pszSecName, L"szLineComment", L"nLineCommentColumn", types.m_cLineComment, 0 ); + ShareData_IO_LineComment( cProfile, pszSecName, L"szLineComment2", L"nLineCommentColumn2", types.m_cLineComment, 1 ); + ShareData_IO_LineComment( cProfile, pszSecName, L"szLineComment3", L"nLineCommentColumn3", types.m_cLineComment, 2 ); cProfile.IOProfileData( pszSecName, LTEXT("szIndentChars") , MakeStringBufferW(types.m_szIndentChars) ); cProfile.IOProfileData( pszSecName, LTEXT("cLineTermChar") , types.m_cLineTermChar ); diff --git a/sakura_core/prop/CPropComFile.cpp b/sakura_core/prop/CPropComFile.cpp index aa8e9f4110..637f719f94 100644 --- a/sakura_core/prop/CPropComFile.cpp +++ b/sakura_core/prop/CPropComFile.cpp @@ -19,6 +19,7 @@ #include "CPropertyManager.h" #include "util/shell.h" #include "util/window.h" +#include "util/os.h" #include "sakura_rc.h" #include "sakura.hh" @@ -67,6 +68,23 @@ INT_PTR CALLBACK CPropFile::DlgProc_page( } // To Here Jun. 2, 2001 genta +// IMEのオープン状態復帰用 +static BOOL s_isImmOpenBkup; + +// IMEを使用したくないコントロールのID判定 +static bool isImeUndesirable(int id) +{ + switch (id) { + case IDC_EDIT_AUTOLOAD_DELAY: + case IDC_EDIT_nDropFileNumMax: + case IDC_EDIT_ALERT_FILESIZE: + case IDC_EDIT_AUTOBACKUP_INTERVAL: + return true; + default: + return false; + } +} + /*! ファイルページ メッセージ処理 */ INT_PTR CPropFile::DispatchEvent( HWND hwndDlg, //!< handle to dialog box @@ -77,6 +95,7 @@ INT_PTR CPropFile::DispatchEvent( { WORD wNotifyCode; WORD wID; + HWND hwndCtl; NMHDR* pNMHDR; NM_UPDOWN* pMNUD; int idCtrl; @@ -210,6 +229,7 @@ INT_PTR CPropFile::DispatchEvent( case WM_COMMAND: wNotifyCode = HIWORD(wParam); /* 通知コード */ wID = LOWORD(wParam); /* 項目ID、 コントロールID、 またはアクセラレータID */ + hwndCtl = (HWND) lParam; /* コントロールのハンドル */ if( wID == IDC_COMBO_FILESHAREMODE && wNotifyCode == CBN_SELCHANGE ){ // コンボボックスの選択変更 EnableFilePropInput(hwndDlg); @@ -228,6 +248,14 @@ INT_PTR CPropFile::DispatchEvent( break; } break; + case EN_SETFOCUS: + if (isImeUndesirable(wID)) + ImeSetOpen(hwndCtl, FALSE, &s_isImmOpenBkup); + break; + case EN_KILLFOCUS: + if (isImeUndesirable(wID)) + ImeSetOpen(hwndCtl, s_isImmOpenBkup, nullptr); + break; } break; diff --git a/sakura_core/prop/CPropComFileName.cpp b/sakura_core/prop/CPropComFileName.cpp index b480a5f836..53006e6df5 100644 --- a/sakura_core/prop/CPropComFileName.cpp +++ b/sakura_core/prop/CPropComFileName.cpp @@ -35,6 +35,7 @@ #include "prop/CPropCommon.h" #include "util/shell.h" #include "util/window.h" +#include "util/os.h" #include "sakura_rc.h" #include "sakura.hh" @@ -56,9 +57,44 @@ static const DWORD p_helpids[] = { //13400 0, 0 // }; +// IMEのオープン状態復帰用 +static BOOL s_isImmOpenBkup; + +// IMEを使用したくないコントロールのID判定 +static bool isImeUndesirable(int id) +{ + switch (id) { + case IDC_EDIT_SHORTMAXWIDTH: + return true; + default: + return false; + } +} + INT_PTR CALLBACK CPropFileName::DlgProc_page( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) { + WORD wNotifyCode; + WORD wID; + HWND hwndCtl; + switch (uMsg) { + case WM_COMMAND: + wNotifyCode = HIWORD(wParam); /* 通知コード */ + wID = LOWORD(wParam); /* 項目ID、 コントロールID、 またはアクセラレータID */ + hwndCtl = (HWND) lParam; /* コントロールのハンドル */ + switch( wNotifyCode ){ + case EN_SETFOCUS: + if (isImeUndesirable(wID)) + ImeSetOpen(hwndCtl, FALSE, &s_isImmOpenBkup); + break; + case EN_KILLFOCUS: + if (isImeUndesirable(wID)) + ImeSetOpen(hwndCtl, s_isImmOpenBkup, nullptr); + break; + } + break; + } + return DlgProc( reinterpret_cast(&CPropFileName::DispatchEvent), hwndDlg, uMsg, wParam, lParam ); } diff --git a/sakura_core/prop/CPropComGeneral.cpp b/sakura_core/prop/CPropComGeneral.cpp index cd3fc21356..a36edbf39d 100644 --- a/sakura_core/prop/CPropComGeneral.cpp +++ b/sakura_core/prop/CPropComGeneral.cpp @@ -17,6 +17,7 @@ #include "recent/CMRUFile.h" #include "recent/CMRUFolder.h" #include "util/shell.h" +#include "util/os.h" #include "sakura_rc.h" #include "sakura.hh" @@ -73,6 +74,23 @@ INT_PTR CALLBACK CPropGeneral::DlgProc_page( return DlgProc( reinterpret_cast(&CPropGeneral::DispatchEvent), hwndDlg, uMsg, wParam, lParam ); } +// IMEのオープン状態復帰用 +static BOOL s_isImmOpenBkup; + +// IMEを使用したくないコントロールのID判定 +static bool isImeUndesirable(int id) +{ + switch (id) { + case IDC_EDIT_REPEATEDSCROLLLINENUM: + case IDD_PROP_GENERAL: + case IDC_EDIT_MAX_MRU_FILE: + case IDC_EDIT_MAX_MRU_FOLDER: + return true; + default: + return false; + } +} + /* General メッセージ処理 */ INT_PTR CPropGeneral::DispatchEvent( HWND hwndDlg, // handle to dialog box @@ -83,7 +101,7 @@ INT_PTR CPropGeneral::DispatchEvent( { WORD wNotifyCode; WORD wID; -// HWND hwndCtl; + HWND hwndCtl; NMHDR* pNMHDR; NM_UPDOWN* pMNUD; int idCtrl; @@ -104,7 +122,7 @@ INT_PTR CPropGeneral::DispatchEvent( case WM_COMMAND: wNotifyCode = HIWORD(wParam); /* 通知コード */ wID = LOWORD(wParam); /* 項目ID、 コントロールID、 またはアクセラレータID */ -// hwndCtl = (HWND) lParam; /* コントロールのハンドル */ + hwndCtl = (HWND) lParam; /* コントロールのハンドル */ switch( wNotifyCode ){ /* ボタン/チェックボックスがクリックされた */ case BN_CLICKED: @@ -181,6 +199,14 @@ INT_PTR CPropGeneral::DispatchEvent( return TRUE; } break; // CBN_SELENDOK + case EN_SETFOCUS: + if (isImeUndesirable(wID)) + ImeSetOpen(hwndCtl, FALSE, &s_isImmOpenBkup); + break; + case EN_KILLFOCUS: + if (isImeUndesirable(wID)) + ImeSetOpen(hwndCtl, s_isImmOpenBkup, nullptr); + break; } break; /* WM_COMMAND */ case WM_NOTIFY: diff --git a/sakura_core/prop/CPropComMacro.cpp b/sakura_core/prop/CPropComMacro.cpp index 6d33c274af..d3c65cf675 100644 --- a/sakura_core/prop/CPropComMacro.cpp +++ b/sakura_core/prop/CPropComMacro.cpp @@ -39,6 +39,7 @@ #include "util/shell.h" #include "util/string_ex2.h" #include "util/module.h" +#include "util/os.h" #include "sakura_rc.h" #include "sakura.hh" @@ -74,6 +75,20 @@ INT_PTR CALLBACK CPropMacro::DlgProc_page( return DlgProc( reinterpret_cast(&CPropMacro::DispatchEvent), hwndDlg, uMsg, wParam, lParam ); } +// IMEのオープン状態復帰用 +static BOOL s_isImmOpenBkup; + +// IMEを使用したくないコントロールのID判定 +static bool isImeUndesirable(int id) +{ + switch (id) { + case IDC_MACROCANCELTIMER: + return true; + default: + return false; + } +} + /*! Macroページのメッセージ処理 @param hwndDlg ダイアログボックスのWindow Handlw @param uMsg メッセージ @@ -87,6 +102,7 @@ INT_PTR CPropMacro::DispatchEvent( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA WORD wNotifyCode; WORD wID; + HWND hwndCtl; switch( uMsg ){ @@ -137,6 +153,7 @@ INT_PTR CPropMacro::DispatchEvent( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA case WM_COMMAND: wNotifyCode = HIWORD(wParam); /* 通知コード */ wID = LOWORD(wParam); /* 項目ID、 コントロールID、 またはアクセラレータID */ + hwndCtl = (HWND) lParam; /* コントロールのハンドル */ switch( wNotifyCode ){ /* ボタン/チェックボックスがクリックされた */ @@ -158,7 +175,13 @@ INT_PTR CPropMacro::DispatchEvent( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA } break; /* CBN_DROPDOWN */ // From Here 2003.06.23 Moca マクロフォルダの最後の\がなければ付ける + case EN_SETFOCUS: + if (isImeUndesirable(wID)) + ImeSetOpen(hwndCtl, FALSE, &s_isImmOpenBkup); + break; case EN_KILLFOCUS: + if (isImeUndesirable(wID)) + ImeSetOpen(hwndCtl, FALSE, &s_isImmOpenBkup); switch( wID ){ case IDC_MACRODIR: { diff --git a/sakura_core/prop/CPropComWin.cpp b/sakura_core/prop/CPropComWin.cpp index a399e8ac7a..776aa9f425 100644 --- a/sakura_core/prop/CPropComWin.cpp +++ b/sakura_core/prop/CPropComWin.cpp @@ -21,6 +21,7 @@ #include "prop/CPropCommon.h" #include "dlg/CDlgWinSize.h" // 2004.05.13 Moca #include "util/shell.h" +#include "util/os.h" #include "sakura_rc.h" #include "sakura.hh" #include "_main/CProcess.h" @@ -68,6 +69,23 @@ INT_PTR CALLBACK CPropWin::DlgProc_page( } // To Here Jun. 2, 2001 genta +// IMEのオープン状態復帰用 +static BOOL s_isImmOpenBkup; + +// IMEを使用したくないコントロールのID判定 +static bool isImeUndesirable(int id) +{ + switch (id) { + case IDC_EDIT_nRulerHeight: + case IDC_EDIT_nRulerBottomSpace: + case IDC_EDIT_nLineNumberRightSpace: + case IDC_EDIT_FUNCKEYWND_GROUPNUM: + return true; + default: + return false; + } +} + /* メッセージ処理 */ INT_PTR CPropWin::DispatchEvent( HWND hwndDlg, // handle to dialog box @@ -79,6 +97,7 @@ INT_PTR CPropWin::DispatchEvent( // From Here Sept. 9, 2000 JEPRO WORD wNotifyCode; WORD wID; + HWND hwndCtl; // To Here Sept. 9, 2000 NMHDR* pNMHDR; @@ -197,6 +216,7 @@ INT_PTR CPropWin::DispatchEvent( case WM_COMMAND: wNotifyCode = HIWORD(wParam); /* 通知コード */ wID = LOWORD(wParam); /* 項目ID、 コントロールID、 またはアクセラレータID */ + hwndCtl = (HWND) lParam; /* コントロールのハンドル */ switch( wNotifyCode ){ /* ボタン/チェックボックスがクリックされた */ case BN_CLICKED: @@ -233,6 +253,14 @@ INT_PTR CPropWin::DispatchEvent( // To Here 2004.05.13 Moca } break; + case EN_SETFOCUS: + if (isImeUndesirable(wID)) + ImeSetOpen(hwndCtl, FALSE, &s_isImmOpenBkup); + break; + case EN_KILLFOCUS: + if (isImeUndesirable(wID)) + ImeSetOpen(hwndCtl, s_isImmOpenBkup, nullptr); + break; } break; // To Here Sept. 9, 2000 diff --git a/sakura_core/sakura_rc.rc b/sakura_core/sakura_rc.rc index d2f884e9a5..6e72f3deba 100644 --- a/sakura_core/sakura_rc.rc +++ b/sakura_core/sakura_rc.rc @@ -104,7 +104,7 @@ BEGIN EDITTEXT IDC_EDIT_VER, 33, 6, 204, 51, ES_MULTILINE | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP LTEXT "原作者: たけ(竹パンダ) さん", IDC_STATIC, 33, 61, 125, 8, NOT WS_GROUP LTEXT S_COPYRIGHT, IDC_STATIC, 33, 75, 205, 8, NOT WS_GROUP | SS_NOPREFIX - LTEXT "Project Sakura-Editor:", IDC_STATIC_URL_CAPTION, 33, 103, 71, 8, NOT WS_GROUP + LTEXT "Project URL:", IDC_STATIC_URL_CAPTION, 33, 103, 71, 8, NOT WS_GROUP LTEXT "https://sakura-editor.github.io/", IDC_STATIC_URL_UR, 101, 103, 120, 8, SS_NOTIFY | NOT WS_GROUP | WS_TABSTOP #ifdef GIT_REMOTE_ORIGIN_URL LTEXT "Source URL:", IDC_STATIC_GIT_CAPTION, 33, 113, 71, 8, NOT WS_GROUP @@ -114,13 +114,13 @@ BEGIN LTEXT "Build URL:", IDC_STATIC_URL_CI_BUILD_CAPTION, 33, 123, 71, 8, NOT WS_GROUP LTEXT CI_BUILD_NUMBER_LABEL, IDC_STATIC_URL_CI_BUILD, 101, 123, 120, 8, SS_NOTIFY | NOT WS_GROUP | WS_TABSTOP #endif -#if defined( GITHUB_COMMIT_URL ) || defined( GITHUB_COMMIT_URL_PR_HEAD ) +#if defined( GITHUB_COMMIT_URL ) || defined( GITHUB_PR_HEAD_URL ) LTEXT "GitHub URL:", IDC_STATIC_URL_GITHUB_CAPTION, 33, 133, 50, 8, NOT WS_GROUP #endif #if defined( GITHUB_COMMIT_URL ) LTEXT GIT_SHORT_COMMIT_HASH, IDC_STATIC_URL_GITHUB_COMMIT, 101, 133, 30, 8, SS_NOTIFY | NOT WS_GROUP | WS_TABSTOP #endif -#if defined( GITHUB_COMMIT_URL_PR_HEAD ) +#if defined( GITHUB_PR_HEAD_URL ) LTEXT GITHUB_PR_NUMBER_LABEL, IDC_STATIC_URL_GITHUB_PR, 150, 133, 30, 8, SS_NOTIFY | NOT WS_GROUP | WS_TABSTOP #endif EDITTEXT IDC_EDIT_ABOUT, 5, 146, 233, 53, ES_MULTILINE | ES_READONLY | WS_VSCROLL | NOT WS_TABSTOP diff --git a/sakura_core/typeprop/CPropTypesColor.cpp b/sakura_core/typeprop/CPropTypesColor.cpp index a069ce64b9..6ebdcdccce 100644 --- a/sakura_core/typeprop/CPropTypesColor.cpp +++ b/sakura_core/typeprop/CPropTypesColor.cpp @@ -30,6 +30,7 @@ #include "uiparts/CGraphics.h" #include "util/shell.h" #include "util/window.h" +#include "util/os.h" #include "sakura_rc.h" #include "sakura.hh" #include "prop/CPropCommon.h" @@ -264,6 +265,22 @@ LRESULT APIENTRY ColorList_SubclassProc( HWND hwnd, UINT uMsg, WPARAM wParam, LP return CallWindowProc( m_wpColorListProc, hwnd, uMsg, wParam, lParam ); } +// IMEのオープン状態復帰用 +static BOOL s_isImmOpenBkup; + +// IMEを使用したくないコントロールのID判定 +static bool isImeUndesirable(int id) +{ + switch (id) { + case IDC_EDIT_LINECOMMENTPOS: + case IDC_EDIT_LINECOMMENTPOS2: + case IDC_EDIT_LINECOMMENTPOS3: + return true; + default: + return false; + } +} + /* color メッセージ処理 */ INT_PTR CPropTypesColor::DispatchEvent( HWND hwndDlg, // handle to dialog box @@ -469,6 +486,14 @@ INT_PTR CPropTypesColor::DispatchEvent( } } break; /* BN_CLICKED */ + case EN_SETFOCUS: + if (isImeUndesirable(wID)) + ImeSetOpen(hwndCtl, FALSE, &s_isImmOpenBkup); + break; + case EN_KILLFOCUS: + if (isImeUndesirable(wID)) + ImeSetOpen(hwndCtl, s_isImmOpenBkup, nullptr); + break; } break; /* WM_COMMAND */ case WM_NOTIFY: diff --git a/sakura_core/typeprop/CPropTypesScreen.cpp b/sakura_core/typeprop/CPropTypesScreen.cpp index 6aaee8b325..f9f65e391f 100644 --- a/sakura_core/typeprop/CPropTypesScreen.cpp +++ b/sakura_core/typeprop/CPropTypesScreen.cpp @@ -26,6 +26,7 @@ #include "util/shell.h" #include "util/window.h" #include "util/file.h" // _IS_REL_PATH +#include "util/os.h" #include "sakura_rc.h" #include "sakura.hh" #include "doc/layout/CTsvModeInfo.h" @@ -162,6 +163,23 @@ void CPropTypesScreen::CPropTypes_Screen() } } +// IMEのオープン状態復帰用 +static BOOL s_isImmOpenBkup; + +// IMEを使用したくないコントロールのID判定 +static bool isImeUndesirable(int id) +{ + switch (id) { + case IDC_EDIT_MAXLINELEN: + case IDC_EDIT_CHARSPACE: + case IDC_EDIT_LINESPACE: + case IDC_EDIT_TABSPACE: + return true; + default: + return false; + } +} + /* Screen メッセージ処理 */ INT_PTR CPropTypesScreen::DispatchEvent( HWND hwndDlg, // handle to dialog box @@ -172,6 +190,7 @@ INT_PTR CPropTypesScreen::DispatchEvent( { WORD wNotifyCode; WORD wID; + HWND hwndCtl; NMHDR* pNMHDR; NM_UPDOWN* pMNUD; int idCtrl; @@ -203,7 +222,7 @@ INT_PTR CPropTypesScreen::DispatchEvent( case WM_COMMAND: wNotifyCode = HIWORD(wParam); /* 通知コード */ wID = LOWORD(wParam); /* 項目ID、 コントロールID、 またはアクセラレータID */ -// hwndCtl = (HWND) lParam; /* コントロールのハンドル */ + hwndCtl = (HWND) lParam; /* コントロールのハンドル */ switch( wNotifyCode ){ case CBN_SELCHANGE: switch( wID ){ @@ -299,6 +318,14 @@ INT_PTR CPropTypesScreen::DispatchEvent( || ::IsDlgButtonChecked( hwndDlg, IDC_CHECK_KINSOKUKUTO ) ); } break; /* BN_CLICKED */ + case EN_SETFOCUS: + if (isImeUndesirable(wID)) + ImeSetOpen(hwndCtl, FALSE, &s_isImmOpenBkup); + break; + case EN_KILLFOCUS: + if (isImeUndesirable(wID)) + ImeSetOpen(hwndCtl, s_isImmOpenBkup, nullptr); + break; } break; /* WM_COMMAND */ case WM_NOTIFY: diff --git a/sakura_core/typeprop/CPropTypesWindow.cpp b/sakura_core/typeprop/CPropTypesWindow.cpp index 564b5761e0..151972a1bb 100644 --- a/sakura_core/typeprop/CPropTypesWindow.cpp +++ b/sakura_core/typeprop/CPropTypesWindow.cpp @@ -16,6 +16,7 @@ #include "charset/CCodePage.h" #include "util/shell.h" #include "util/window.h" +#include "util/os.h" #include "sakura_rc.h" #include "sakura.hh" @@ -86,6 +87,23 @@ static const EEolType aeEolType[] = { EOL_PS, }; +// IMEのオープン状態復帰用 +static BOOL s_isImmOpenBkup; + +// IMEを使用したくないコントロールのID判定 +static bool isImeUndesirable(int id) +{ + switch (id) { + case IDC_EDIT_LINENUMWIDTH: + case IDC_EDIT_BACKIMG_OFFSET_X: + case IDC_EDIT_BACKIMG_OFFSET_Y: + case IDC_EDIT_BACKIMG_TRANSPARENCY: + return true; + default: + return false; + } +} + /*! window メッセージ処理 */ INT_PTR CPropTypesWindow::DispatchEvent( HWND hwndDlg, // handle to dialog box @@ -96,6 +114,7 @@ INT_PTR CPropTypesWindow::DispatchEvent( { WORD wNotifyCode; WORD wID; + HWND hwndCtl; NMHDR* pNMHDR; NM_UPDOWN* pMNUD; // 追加 2014.08.02 katze @@ -115,6 +134,7 @@ INT_PTR CPropTypesWindow::DispatchEvent( case WM_COMMAND: wNotifyCode = HIWORD( wParam ); /* 通知コード */ wID = LOWORD( wParam ); /* 項目ID、 コントロールID、 またはアクセラレータID */ + hwndCtl = (HWND) lParam; /* コントロールのハンドル */ switch( wNotifyCode ){ case CBN_SELCHANGE: @@ -161,7 +181,13 @@ INT_PTR CPropTypesWindow::DispatchEvent( return TRUE; } break; /* BN_CLICKED */ + case EN_SETFOCUS: + if (isImeUndesirable(wID)) + ImeSetOpen(hwndCtl, FALSE, &s_isImmOpenBkup); + break; case EN_KILLFOCUS: + if (isImeUndesirable(wID)) + ImeSetOpen(hwndCtl, s_isImmOpenBkup, nullptr); if(wID == IDC_EDIT_BACKIMG_TRANSPARENCY){ int nVal = ::GetDlgItemInt( hwndDlg, IDC_EDIT_BACKIMG_TRANSPARENCY, NULL, FALSE ); if(nVal < 0) nVal = 0; diff --git a/sakura_core/util/os.cpp b/sakura_core/util/os.cpp index d77d052b6c..829e15db8a 100644 --- a/sakura_core/util/os.cpp +++ b/sakura_core/util/os.cpp @@ -449,3 +449,24 @@ BOOL IsPowerShellAvailable(void) return FALSE; } } + +/*! + @brief IMEのオープン状態を設定する + @param hWnd 設定対象のウィンドウハンドル + @param bOpen 設定するオープン状態 + @param pBackup `nullptr` でなければ設定前のオープン状態を取得 + @return 手続きが成功したら true 失敗したら false +*/ +BOOL ImeSetOpen(HWND hWnd, BOOL bOpen, BOOL* pBackup) +{ + HIMC hIMC = ImmGetContext(hWnd); + if (!hIMC) { + return FALSE; + } + if (pBackup) { + *pBackup = ImmGetOpenStatus(hIMC); + } + BOOL bRet = ImmSetOpenStatus(hIMC, bOpen); + bRet &= ImmReleaseContext(hWnd, hIMC); + return bRet; +} diff --git a/sakura_core/util/os.h b/sakura_core/util/os.h index 807c917d1f..b6d281eb33 100644 --- a/sakura_core/util/os.h +++ b/sakura_core/util/os.h @@ -99,3 +99,12 @@ class CCurrentDirectoryBackupPoint{ @brief PowerShell が利用可能か判定する */ BOOL IsPowerShellAvailable(void); + +/*! + @brief IMEのオープン状態を設定する + @param hWnd 設定対象のウィンドウハンドル + @param bOpen 設定するオープン状態 + @param pBackup `nullptr` でなければ設定前のオープン状態を取得 + @return 手続きが成功したら true 失敗したら false +*/ +BOOL ImeSetOpen(HWND hWnd, BOOL bOpen, BOOL* pBackup); diff --git a/sakura_lang_en_US/sakura_lang_rc.rc b/sakura_lang_en_US/sakura_lang_rc.rc index ad6f7e9fdc..b8db577306 100644 --- a/sakura_lang_en_US/sakura_lang_rc.rc +++ b/sakura_lang_en_US/sakura_lang_rc.rc @@ -110,7 +110,7 @@ BEGIN LTEXT S_COPYRIGHT, IDC_STATIC, 33, 75, 205, 8, NOT WS_GROUP | SS_NOPREFIX LTEXT "Translation:",IDC_STATIC,33,90,41,8 LTEXT S_COPYRIGHT_TRANSLATION,IDC_STATIC,74,90,164,8,SS_NOPREFIX | NOT WS_GROUP - LTEXT "Project Sakura-Editor:", IDC_STATIC_URL_CAPTION, 33, 103, 71, 8, NOT WS_GROUP + LTEXT "Project URL:", IDC_STATIC_URL_CAPTION, 33, 103, 71, 8, NOT WS_GROUP LTEXT "https://sakura-editor.github.io/", IDC_STATIC_URL_UR, 101, 103, 120, 8, SS_NOTIFY | NOT WS_GROUP | WS_TABSTOP #ifdef GIT_REMOTE_ORIGIN_URL LTEXT "Source URL:", IDC_STATIC_GIT_CAPTION, 33, 113, 71, 8, NOT WS_GROUP @@ -120,13 +120,13 @@ BEGIN LTEXT "Build URL:", IDC_STATIC_URL_CI_BUILD_CAPTION, 33, 123, 71, 8, NOT WS_GROUP LTEXT CI_BUILD_NUMBER_LABEL, IDC_STATIC_URL_CI_BUILD, 101, 123, 120, 8, SS_NOTIFY | NOT WS_GROUP | WS_TABSTOP #endif -#if defined( GITHUB_COMMIT_URL ) || defined( GITHUB_COMMIT_URL_PR_HEAD ) +#if defined( GITHUB_COMMIT_URL ) || defined( GITHUB_PR_HEAD_URL ) LTEXT "GitHub URL:", IDC_STATIC_URL_GITHUB_CAPTION, 33, 133, 50, 8, NOT WS_GROUP #endif #if defined( GITHUB_COMMIT_URL ) LTEXT GIT_SHORT_COMMIT_HASH, IDC_STATIC_URL_GITHUB_COMMIT, 101, 133, 30, 8, SS_NOTIFY | NOT WS_GROUP | WS_TABSTOP #endif -#if defined( GITHUB_COMMIT_URL_PR_HEAD ) +#if defined( GITHUB_PR_HEAD_URL ) LTEXT GITHUB_PR_NUMBER_LABEL, IDC_STATIC_URL_GITHUB_PR, 150, 133, 30, 8, SS_NOTIFY | NOT WS_GROUP | WS_TABSTOP #endif EDITTEXT IDC_EDIT_ABOUT, 5, 146, 233, 53, ES_MULTILINE | ES_READONLY | WS_VSCROLL | NOT WS_TABSTOP diff --git a/tests/unittests/test-grepinfo.cpp b/tests/unittests/test-grepinfo.cpp index 3a4bea37d7..66e0a5af5a 100644 --- a/tests/unittests/test-grepinfo.cpp +++ b/tests/unittests/test-grepinfo.cpp @@ -46,8 +46,6 @@ bool operator == (const GrepInfo& lhs, const GrepInfo& rhs) noexcept { && lhs.cmGrepRep == rhs.cmGrepRep && lhs.cmGrepFile == rhs.cmGrepFile && lhs.cmGrepFolder == rhs.cmGrepFolder - && lhs.cmExcludeFile == rhs.cmExcludeFile - && lhs.cmExcludeFolder == rhs.cmExcludeFolder && lhs.sGrepSearchOption == rhs.sGrepSearchOption && lhs.bGrepCurFolder == rhs.bGrepCurFolder && lhs.bGrepStdout == rhs.bGrepStdout @@ -122,14 +120,6 @@ TEST(GrepInfo, operatorNotEqual) ASSERT_NE(value, other); value.cmGrepFolder = other.cmGrepFolder; - value.cmExcludeFile = L"除外ファイルの仕様がなんでここに残ってんだっけ?"; - ASSERT_NE(value, other); - value.cmExcludeFile = other.cmExcludeFile; - - value.cmExcludeFolder = L"除外フォルダの仕様がなんで(ry"; - ASSERT_NE(value, other); - value.cmExcludeFolder = other.cmExcludeFolder; - value.sGrepSearchOption.bRegularExp = true; ASSERT_NE(value, other); value.sGrepSearchOption = other.sGrepSearchOption; diff --git a/tools/ChmSourceConverter/.vsconfig b/tools/ChmSourceConverter/.vsconfig new file mode 100644 index 0000000000..41cb3ceacc --- /dev/null +++ b/tools/ChmSourceConverter/.vsconfig @@ -0,0 +1,10 @@ +{ + "version": "1.0", + "components": [ + "Microsoft.Net.ComponentGroup.DevelopmentPrerequisites", + "Microsoft.VisualStudio.Workload.ManagedDesktop", + "Microsoft.VisualStudio.Component.Roslyn.Compiler", + "Microsoft.VisualStudio.Component.Roslyn.LanguageServices", + "Microsoft.Net.Component.4.6.1.TargetingPack" + ] +} \ No newline at end of file diff --git a/tools/ChmSourceConverter/ChmSourceConverter.Test/ChmSourceConverter.Test.csproj b/tools/ChmSourceConverter/ChmSourceConverter.Test/ChmSourceConverter.Test.csproj index 3e7c57f2e3..49a63cc716 100644 --- a/tools/ChmSourceConverter/ChmSourceConverter.Test/ChmSourceConverter.Test.csproj +++ b/tools/ChmSourceConverter/ChmSourceConverter.Test/ChmSourceConverter.Test.csproj @@ -10,7 +10,7 @@ Properties ChmSourceConverter ChmSourceConverter.Test - v4.7.2 + v4.6.1 512 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15.0 diff --git a/tools/ChmSourceConverter/ChmSourceConverter.Test/packages.config b/tools/ChmSourceConverter/ChmSourceConverter.Test/packages.config index 2f7c5a189c..102a45c0a6 100644 --- a/tools/ChmSourceConverter/ChmSourceConverter.Test/packages.config +++ b/tools/ChmSourceConverter/ChmSourceConverter.Test/packages.config @@ -1,5 +1,5 @@  - - + + \ No newline at end of file diff --git a/tools/ChmSourceConverter/ChmSourceConverter/App.config b/tools/ChmSourceConverter/ChmSourceConverter/App.config index 4ab481f4ba..b382b6cb62 100644 --- a/tools/ChmSourceConverter/ChmSourceConverter/App.config +++ b/tools/ChmSourceConverter/ChmSourceConverter/App.config @@ -1,4 +1,4 @@ - + @@ -6,7 +6,7 @@ - + diff --git a/tools/ChmSourceConverter/ChmSourceConverter/ChmSourceConverter.csproj b/tools/ChmSourceConverter/ChmSourceConverter/ChmSourceConverter.csproj index a55f642b81..ae09634f30 100644 --- a/tools/ChmSourceConverter/ChmSourceConverter/ChmSourceConverter.csproj +++ b/tools/ChmSourceConverter/ChmSourceConverter/ChmSourceConverter.csproj @@ -8,7 +8,7 @@ Exe ChmSourceConverter ChmSourceConverter - v4.7.2 + v4.6.1 512 true true diff --git a/tools/ToolBarTools/.vsconfig b/tools/ToolBarTools/.vsconfig new file mode 100644 index 0000000000..41cb3ceacc --- /dev/null +++ b/tools/ToolBarTools/.vsconfig @@ -0,0 +1,10 @@ +{ + "version": "1.0", + "components": [ + "Microsoft.Net.ComponentGroup.DevelopmentPrerequisites", + "Microsoft.VisualStudio.Workload.ManagedDesktop", + "Microsoft.VisualStudio.Component.Roslyn.Compiler", + "Microsoft.VisualStudio.Component.Roslyn.LanguageServices", + "Microsoft.Net.Component.4.6.1.TargetingPack" + ] +} \ No newline at end of file