diff --git a/MBlockEditor/src/BlockEditor.cpp b/MBlockEditor/src/BlockEditor.cpp index 45475ed..78c09ff 100644 --- a/MBlockEditor/src/BlockEditor.cpp +++ b/MBlockEditor/src/BlockEditor.cpp @@ -38,6 +38,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../../common/plugin.h" +#include +using namespace std; //FIXME: bad practice. https://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice #ifdef MDEBUG //#include "/VCProject/MLib/MLibDef.h" @@ -849,50 +851,82 @@ BOOL DoTabLeft() return TRUE; } -void SetCommentDefaults(LPCTSTR psExt) +bool filename_match(LPCTSTR fn, LPCTSTR ref) { - if (_tcsicmp(psExt, _T(".bat"))==0 || _tcsicmp(psExt, _T(".cmd"))==0) + LPCTSTR _fn = & fn[ lstrlen(fn)-lstrlen(ref) ]; + return (_tcsicmp(_fn, ref) == 0); +} + +//match string to one from to comma separated list +bool _ext_match_to_any(LPCTSTR str, LPCTSTR clst) +{ + int slen = lstrlen(str); + int clen = lstrlen(clst); + for (int idx=0, i=0; i"); psComment = _T(""); } - else if (_tcsicmp(psExt, _T(".php"))==0) + else if ( EXT_MATCH("php") ) { psCommentBegin = _T("\0*/\0"); psComment = _T("//\0#\0"); } - else if (_tcsicmp(psExt, _T(".ps1"))==0 || _tcsicmp(psExt, _T(".psm1"))==0) + else if ( EXT_MATCH("ps1,psm1") ) { psCommentBegin = _T("<#"); psCommentEnd = _T("#>"); psComment = _T("#"); } - else if (_tcsicmp(psExt, _T(".lua"))==0 || _tcsicmp(psExt, _T(".psm1"))==0) + else if ( EXT_MATCH("lua,psm1") ) { psComment = _T("--"); } @@ -991,9 +1025,7 @@ void LoadCommentSettings(LPCTSTR pszFileName, TCHAR (&szComment)[100], TCHAR (&s } } - // Если НЕ NULL - значит в настройках плагина ничего прописано не было - if (psExt) - SetCommentDefaults(psExt); + SetCommentDefaults(pszFileName, psExt); } BOOL DoComment() diff --git a/MBlockEditor/src/MBlockEditor.vcxproj b/MBlockEditor/src/MBlockEditor.vcxproj index ee00777..8d0706f 100644 --- a/MBlockEditor/src/MBlockEditor.vcxproj +++ b/MBlockEditor/src/MBlockEditor.vcxproj @@ -1134,6 +1134,8 @@ Level3 true ProgramDatabase + true + true _DEBUG;FAR_UNICODE=3000;%(PreprocessorDefinitions) @@ -1153,6 +1155,7 @@ MachineX64 false Windows + UseLinkTimeCodeGeneration true