[BUG_FIXED] Fix UDL name load bug.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@318 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
0f77948833
commit
11b624062f
|
@ -1820,7 +1820,7 @@ int NppParameters::addUserLangToEnd(const UserLangContainer & userLang, const TC
|
|||
return -1;
|
||||
_userLangArray[_nbUserLang] = new UserLangContainer();
|
||||
*(_userLangArray[_nbUserLang]) = userLang;
|
||||
lstrcpy(_userLangArray[_nbUserLang]->_name, newName);
|
||||
_userLangArray[_nbUserLang]->_name = newName;
|
||||
_nbUserLang++;
|
||||
return _nbUserLang-1;
|
||||
}
|
||||
|
|
|
@ -708,25 +708,15 @@ friend class UserDefineDialog;
|
|||
|
||||
public :
|
||||
UserLangContainer(){
|
||||
lstrcpy(_name, TEXT("new user define"));
|
||||
_ext[0] = '\0';
|
||||
_name = TEXT("new user define");
|
||||
_ext = TEXT("");
|
||||
|
||||
// Keywords list of Delimiters (index 0)
|
||||
lstrcpy(_keywordLists[0], TEXT("000000"));
|
||||
for (int i = 1 ; i < nbKeywodList ; i++)
|
||||
*_keywordLists[i] = '\0';
|
||||
};
|
||||
UserLangContainer(const TCHAR *name, const TCHAR *ext){
|
||||
//si le nom est trop long, on le tranche!
|
||||
//int minSize = ((sizeof(_name) - 1) < lstrlen(name))?(sizeof(_name) - 1):lstrlen(name);
|
||||
int minSize = min(langNameLenMax-1, lstrlen(_name));
|
||||
int i = 0;
|
||||
for ( ; i < minSize ; i++)
|
||||
_name[i] = name[i];
|
||||
_name[i] = '\0';
|
||||
|
||||
lstrcpy(_ext, ext);
|
||||
|
||||
UserLangContainer(const TCHAR *name, const TCHAR *ext) : _name(name), _ext(ext) {
|
||||
// Keywords list of Delimiters (index 0)
|
||||
lstrcpy(_keywordLists[0], TEXT("000000"));
|
||||
for (int j = 1 ; j < nbKeywodList ; j++)
|
||||
|
@ -736,8 +726,8 @@ public :
|
|||
UserLangContainer & operator=(const UserLangContainer & ulc) {
|
||||
if (this != &ulc)
|
||||
{
|
||||
lstrcpy(this->_name, ulc._name);
|
||||
lstrcpy(this->_ext, ulc._ext);
|
||||
this->_name = ulc._name;
|
||||
this->_ext = ulc._ext;
|
||||
this->_isCaseIgnored = ulc._isCaseIgnored;
|
||||
this->_styleArray = ulc._styleArray;
|
||||
int nbStyler = this->_styleArray.getNbStyler();
|
||||
|
@ -756,11 +746,13 @@ public :
|
|||
};
|
||||
|
||||
int getNbKeywordList() {return nbKeywodList;};
|
||||
TCHAR * getName() {return _name;};
|
||||
const TCHAR * getName() {return _name.c_str();};
|
||||
|
||||
private:
|
||||
TCHAR _name[langNameLenMax];
|
||||
TCHAR _ext[extsLenMax];
|
||||
//TCHAR _name[langNameLenMax];
|
||||
//TCHAR _ext[extsLenMax];
|
||||
generic_string _name;
|
||||
generic_string _ext;
|
||||
|
||||
StyleArray _styleArray;
|
||||
TCHAR _keywordLists[nbKeywodList][max_char];
|
||||
|
@ -913,7 +905,7 @@ public:
|
|||
UserLangContainer & getULCFromIndex(int i) {return *_userLangArray[i];};
|
||||
UserLangContainer * getULCFromName(const TCHAR *userLangName) {
|
||||
for (int i = 0 ; i < _nbUserLang ; i++)
|
||||
if (!lstrcmp(userLangName, _userLangArray[i]->_name))
|
||||
if (!lstrcmp(userLangName, _userLangArray[i]->_name.c_str()))
|
||||
return _userLangArray[i];
|
||||
//qui doit etre jamais passer
|
||||
return NULL;
|
||||
|
@ -946,7 +938,7 @@ public:
|
|||
|
||||
for (int i = 0 ; i < _nbUserLang ; i++)
|
||||
{
|
||||
if (!lstrcmp(_userLangArray[i]->_name, newName))
|
||||
if (!lstrcmp(_userLangArray[i]->_name.c_str(), newName))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -959,10 +951,10 @@ public:
|
|||
for (int i = 0 ; i < _nbUserLang ; i++)
|
||||
{
|
||||
vector<generic_string> extVect;
|
||||
cutString(_userLangArray[i]->_ext, extVect);
|
||||
cutString(_userLangArray[i]->_ext.c_str(), extVect);
|
||||
for (size_t j = 0 ; j < extVect.size() ; j++)
|
||||
if (!generic_stricmp(extVect[j].c_str(), ext))
|
||||
return _userLangArray[i]->_name;
|
||||
return _userLangArray[i]->_name.c_str();
|
||||
}
|
||||
return NULL;
|
||||
};
|
||||
|
|
|
@ -1179,7 +1179,7 @@ void UserDefineDialog::enableLangAndControlsBy(int index)
|
|||
{
|
||||
_pUserLang = (index == 0)?_pCurrentUserLang:&((NppParameters::getInstance())->getULCFromIndex(index - 1));
|
||||
if (index != 0)
|
||||
::SetWindowText(::GetDlgItem(_hSelf, IDC_EXT_EDIT), _pUserLang->_ext);
|
||||
::SetWindowText(::GetDlgItem(_hSelf, IDC_EXT_EDIT), _pUserLang->_ext.c_str());
|
||||
|
||||
::ShowWindow(::GetDlgItem(_hSelf, IDC_EXT_STATIC), (index == 0)?SW_HIDE:SW_SHOW);
|
||||
::ShowWindow(::GetDlgItem(_hSelf, IDC_EXT_EDIT), (index == 0)?SW_HIDE:SW_SHOW);
|
||||
|
@ -1322,7 +1322,7 @@ BOOL CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
{
|
||||
if (HIWORD(wParam) == EN_CHANGE)
|
||||
{
|
||||
::SendDlgItemMessage(_hSelf, IDC_EXT_EDIT, WM_GETTEXT, extsLenMax, (LPARAM)(_pUserLang->_ext));
|
||||
::SendDlgItemMessage(_hSelf, IDC_EXT_EDIT, WM_GETTEXT, extsLenMax, (LPARAM)(_pUserLang->_ext.c_str()));
|
||||
return TRUE;
|
||||
}
|
||||
else if (HIWORD(wParam) == CBN_SELCHANGE)
|
||||
|
@ -1429,7 +1429,7 @@ BOOL CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
|
||||
//rename current language name in userLangArray
|
||||
UserLangContainer & userLangContainer = pNppParam->getULCFromIndex(i-1);
|
||||
lstrcpy(userLangContainer._name, newName);
|
||||
userLangContainer._name = newName;
|
||||
|
||||
//rename current language name in langMenu
|
||||
HWND hNpp = ::GetParent(_hSelf);
|
||||
|
|
Loading…
Reference in New Issue