diff --git a/PowerEditor/src/MISC/Common/Common.cpp b/PowerEditor/src/MISC/Common/Common.cpp index 50679c51..0e694ecf 100644 --- a/PowerEditor/src/MISC/Common/Common.cpp +++ b/PowerEditor/src/MISC/Common/Common.cpp @@ -174,47 +174,47 @@ int filter(unsigned int code, struct _EXCEPTION_POINTERS *) return EXCEPTION_CONTINUE_SEARCH; } - + int getCpFromStringValue(const char * encodingStr) { if (!encodingStr) return CP_ACP; if (stricmp("windows-1250", encodingStr) == 0) - return 1250; + return NPP_CP_WIN_1250; if (stricmp("windows-1251", encodingStr) == 0) - return 1251; + return NPP_CP_WIN_1251; if (stricmp("windows-1252", encodingStr) == 0) - return 1252; + return NPP_CP_WIN_1252; if (stricmp("windows-1253", encodingStr) == 0) - return 1253; + return NPP_CP_WIN_1253; if (stricmp("windows-1254", encodingStr) == 0) - return 1254; + return NPP_CP_WIN_1254; if (stricmp("windows-1255", encodingStr) == 0) - return 1255; + return NPP_CP_WIN_1255; if (stricmp("windows-1256", encodingStr) == 0) - return 1256; + return NPP_CP_WIN_1256; if (stricmp("windows-1257", encodingStr) == 0) - return 1257; + return NPP_CP_WIN_1257; if (stricmp("windows-1258", encodingStr) == 0) - return 1258; + return NPP_CP_WIN_1258; if (stricmp("big5", encodingStr) == 0) - return 950; + return NPP_CP_BIG5; if (stricmp("gb2312", encodingStr) == 0) - return 936; + return NPP_CP_GB2312; if (stricmp("shift_jis", encodingStr) == 0) - return 932; + return NPP_CP_SHIFT_JIS; if (stricmp("euc-kr", encodingStr) == 0) - return 51949; + return NPP_CP_EUC_KR; if (stricmp("tis-620", encodingStr) == 0) - return 874; + return NPP_CP_TIS_620; if (stricmp("iso-8859-8", encodingStr) == 0) - return 28598; + return NPP_CP_ISO_8859_8; if (stricmp("utf-8", encodingStr) == 0) - return 65001; + return CP_UTF8; return CP_ACP; } diff --git a/PowerEditor/src/MISC/Common/Common.h b/PowerEditor/src/MISC/Common/Common.h index ad249cbf..57297a51 100644 --- a/PowerEditor/src/MISC/Common/Common.h +++ b/PowerEditor/src/MISC/Common/Common.h @@ -18,8 +18,28 @@ #ifndef M30_IDE_COMMUN_H #define M30_IDE_COMMUN_H -#define CP_ANSI_LATIN_1 1252 -#define CP_BIG5 950 +#define NPP_CP_WIN_1250 1250 +#define NPP_CP_WIN_1251 1251 +#define NPP_CP_WIN_1252 1252 +#define NPP_CP_WIN_1253 1253 +#define NPP_CP_WIN_1254 1254 +#define NPP_CP_WIN_1255 1255 +#define NPP_CP_WIN_1256 1256 +#define NPP_CP_WIN_1257 1257 +#define NPP_CP_WIN_1258 1258 + +#define NPP_CP_BIG5 950 +#define NPP_CP_EUC_KR 51949 +#define NPP_CP_SHIFT_JIS 932 +#define NPP_CP_GB2312 936 +#define NPP_CP_ISO_8859_8 28598 +#define NPP_CP_TIS_620 874 + + + + + + #ifdef UNICODE #define NppMainEntry wWinMain diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 8e17f12c..655ac836 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -4371,14 +4371,41 @@ void Notepad_plus::command(int id) } break; } - + case IDM_FORMAT_WIN1250 : + case IDM_FORMAT_WIN1253 : + case IDM_FORMAT_WIN1256 : + case IDM_FORMAT_TIS_620 : + case IDM_FORMAT_GB2312 : + case IDM_FORMAT_SHIFT_JIS : + case IDM_FORMAT_EUC_KR : case IDM_FORMAT_BIG5 : { int encoding = -1; switch (id) { case IDM_FORMAT_BIG5: - encoding = CP_BIG5; + encoding = NPP_CP_BIG5; + break; + case IDM_FORMAT_EUC_KR: + encoding = NPP_CP_EUC_KR; + break; + case IDM_FORMAT_SHIFT_JIS: + encoding = NPP_CP_SHIFT_JIS; + break; + case IDM_FORMAT_GB2312: + encoding = NPP_CP_GB2312; + break; + case IDM_FORMAT_TIS_620: + encoding = NPP_CP_TIS_620; + break; + case IDM_FORMAT_WIN1256: + encoding = NPP_CP_WIN_1256; + break; + case IDM_FORMAT_WIN1253: + encoding = NPP_CP_WIN_1253; + break; + case IDM_FORMAT_WIN1250: + encoding = NPP_CP_WIN_1250; break; default : // IDM_FORMAT_ANSI @@ -4685,13 +4712,13 @@ void Notepad_plus::command(int id) _aboutDlg.doDialog(); if (isFirstTime && _nativeLangA) { - if (_nativeLangEncoding == CP_BIG5) + if (_nativeLangEncoding == NPP_CP_BIG5) { char *authorName = "«J¤µ§^"; HWND hItem = ::GetDlgItem(_aboutDlg.getHSelf(), IDC_AUTHOR_NAME); #ifdef UNICODE WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - const wchar_t *authorNameW = wmc->char2wchar(authorName, CP_BIG5); + const wchar_t *authorNameW = wmc->char2wchar(authorName, NPP_CP_BIG5); ::SetWindowText(hItem, authorNameW); #else ::SetWindowText(hItem, authorName); diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index 716a0b20..95524014 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -398,7 +398,14 @@ BEGIN MENUITEM "Encode in UCS-2 Little Endian", IDM_FORMAT_UCS_2LE POPUP "More..." BEGIN - MENUITEM "Chinese Traditional (Big5)", IDM_FORMAT_BIG5 + MENUITEM "Arabic(Windows)", IDM_FORMAT_WIN1256 + MENUITEM "Central European(Windows)" IDM_FORMAT_WIN1250 + MENUITEM "Chinese Traditional(Big5)", IDM_FORMAT_BIG5 + MENUITEM "Chinese Simplified(GB2312)", IDM_FORMAT_GB2312 + MENUITEM "Greek(Windows)", IDM_FORMAT_WIN1253 + MENUITEM "Japanese(Shift-JIS)", IDM_FORMAT_SHIFT_JIS + MENUITEM "Korean(EUC)", IDM_FORMAT_EUC_KR + MENUITEM "Thai(Windows)", IDM_FORMAT_TIS_620 END MENUITEM SEPARATOR MENUITEM "Convert to ANSI", IDM_FORMAT_CONV2_ANSI diff --git a/PowerEditor/src/lastRecentFileList.cpp b/PowerEditor/src/lastRecentFileList.cpp index f98477cd..bc34dc77 100644 --- a/PowerEditor/src/lastRecentFileList.cpp +++ b/PowerEditor/src/lastRecentFileList.cpp @@ -23,7 +23,7 @@ void LastRecentFileList::initMenu(HMENU hMenu, int idBase, int posBase) { _hMenu = hMenu; _idBase = idBase; _posBase = posBase; - _nativeLangEncoding = CP_ANSI_LATIN_1; + _nativeLangEncoding = NPP_CP_WIN_1252; for (int i = 0 ; i < sizeof(_idFreeArray) ; i++) _idFreeArray[i] = true; diff --git a/PowerEditor/src/menuCmdID.h b/PowerEditor/src/menuCmdID.h index 29888d85..f9c8e215 100644 --- a/PowerEditor/src/menuCmdID.h +++ b/PowerEditor/src/menuCmdID.h @@ -238,7 +238,21 @@ #define IDM_FORMAT_CONV2_UCS_2BE (IDM_FORMAT + 12) #define IDM_FORMAT_CONV2_UCS_2LE (IDM_FORMAT + 13) - #define IDM_FORMAT_BIG5 (IDM_FORMAT + 20) + #define IDM_FORMAT_WIN1250 (IDM_FORMAT + 20) + #define IDM_FORMAT_WIN1251 (IDM_FORMAT + 21) + #define IDM_FORMAT_WIN1252 (IDM_FORMAT + 22) + #define IDM_FORMAT_WIN1253 (IDM_FORMAT + 23) + #define IDM_FORMAT_WIN1254 (IDM_FORMAT + 24) + #define IDM_FORMAT_WIN1255 (IDM_FORMAT + 25) + #define IDM_FORMAT_WIN1256 (IDM_FORMAT + 26) + #define IDM_FORMAT_WIN1257 (IDM_FORMAT + 27) + #define IDM_FORMAT_WIN1258 (IDM_FORMAT + 28) + #define IDM_FORMAT_BIG5 (IDM_FORMAT + 29) + #define IDM_FORMAT_GB2312 (IDM_FORMAT + 30) + #define IDM_FORMAT_SHIFT_JIS (IDM_FORMAT + 31) + #define IDM_FORMAT_EUC_KR (IDM_FORMAT + 32) + #define IDM_FORMAT_TIS_620 (IDM_FORMAT + 33) + #define IDM_LANG (IDM + 6000) #define IDM_LANGSTYLE_CONFIG_DLG (IDM_LANG + 1)