[BUG_FIXED] Fix wrong result returned by NPPM_GETLANGUAGENAME.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@777 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2011-06-18 21:53:14 +00:00
parent 4782e310b2
commit 9ea90c6449
4 changed files with 12 additions and 8 deletions

View File

@ -1542,22 +1542,26 @@ void Notepad_plus::checkLangsMenu(int id) const
::CheckMenuRadioItem(_mainMenuHandle, IDM_LANG_C, IDM_LANG_USER_LIMIT, id, MF_BYCOMMAND);
}
generic_string Notepad_plus::getLangDesc(LangType langType, bool shortDesc)
generic_string Notepad_plus::getLangDesc(LangType langType, bool getName)
{
if ((langType >= L_EXTERNAL) && (langType < NppParameters::getInstance()->L_END))
{
ExternalLangContainer & elc = NppParameters::getInstance()->getELCFromIndex(langType - L_EXTERNAL);
if (shortDesc)
if (getName)
return generic_string(elc._name);
else
return generic_string(elc._desc);
}
}
if (langType > L_EXTERNAL)
langType = L_TEXT;
generic_string str2Show = ScintillaEditView::langNames[langType].longName;
generic_string str2Show;
if (getName)
str2Show = ScintillaEditView::langNames[langType].shortName;
else
str2Show = ScintillaEditView::langNames[langType].longName;
if (langType == L_USER)
{

View File

@ -470,7 +470,7 @@ private:
void enableConvertMenuItems(formatType f) const;
void checkUnicodeMenuItems() const;
generic_string getLangDesc(LangType langType, bool shortDesc = false);
generic_string getLangDesc(LangType langType, bool getName = false);
void setLangStatus(LangType langType){
_statusBar.setText(getLangDesc(langType).c_str(), STATUSBAR_DOC_TYPE);

View File

@ -1772,7 +1772,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
case NPPM_GETLANGUAGENAME:
{
generic_string langName = getLangDesc((LangType)wParam, false);
generic_string langName = getLangDesc((LangType)wParam, true);
if (lParam)
lstrcpy((LPTSTR)lParam, langName.c_str());
return langName.length();
@ -1780,7 +1780,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
case NPPM_GETLANGUAGEDESC:
{
generic_string langDesc = getLangDesc((LangType)wParam, true);
generic_string langDesc = getLangDesc((LangType)wParam, false);
if (lParam)
lstrcpy((LPTSTR)lParam, langDesc.c_str());
return langDesc.length();

View File

@ -434,7 +434,7 @@ int Notepad_plus::setFileOpenSaveDlgFilters(FileDialog & fDlg, int langType)
const TCHAR *filters = stringFilters.c_str();
if (filters[0])
{
fDlg.setExtsFilter(getLangDesc(lid, true).c_str(), filters);
fDlg.setExtsFilter(getLangDesc(lid, false).c_str(), filters);
//
// Get index of lang type to find