Win32: MS Spell dictionary charset is identified in the proper way. Also, language ID is in human readable form now.
This commit is contained in:
parent
3152ff7713
commit
f5971f8c6e
@ -1117,12 +1117,35 @@ int GMenuSChecker::Run(CSpellChecker &schecker, const char *word)
|
||||
|
||||
for (idx = 0; idx < langcount; idx++)
|
||||
{
|
||||
uint type = langs[idx]->GetSpellType();
|
||||
const char *code = langs[idx]->GetLangCode();
|
||||
|
||||
std::string buff = " ";
|
||||
std::string buff = " ";
|
||||
buff += streql(lcode, code) ? '\x10' : ' ';
|
||||
buff += code; buff += ' ';
|
||||
|
||||
#if !(defined(GCFG_NO_MSSPELL) || defined(GCFG_NO_MYSPELL))
|
||||
if (type == SCHECKET_TYPE_MSSPELL)
|
||||
buff += " MS ";
|
||||
else if (type == SCHECKET_TYPE_MYSPELL)
|
||||
buff += " MY ";
|
||||
else
|
||||
buff += " ?? ";
|
||||
#endif
|
||||
|
||||
#if !defined(GCFG_NO_MYSPELL)
|
||||
if (type == SCHECKET_TYPE_MSSPELL)
|
||||
{
|
||||
char langANSI[100];
|
||||
char langOEM[100];
|
||||
GetLocaleInfo(atoi(code), LOCALE_SLANGUAGE, langANSI, sizeof(langANSI));
|
||||
CharToOem(langANSI, langOEM);
|
||||
buff += langOEM;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
buff += code;
|
||||
|
||||
buff += ' ';
|
||||
langstr.push_back(buff);
|
||||
}
|
||||
|
||||
|
@ -328,17 +328,18 @@ void CMSSpellLang::UnLoad()
|
||||
void CMSSpellLang::BuildRTable(const char *codeset)
|
||||
{
|
||||
char codeset2[20];
|
||||
sprintf(codeset2, "CP%i", GetACP());
|
||||
strcpy(codeset2, "CP");
|
||||
GetLocaleInfo(mLIDC, LOCALE_IDEFAULTANSICODEPAGE, &codeset2[2], sizeof(codeset2)-2);
|
||||
|
||||
LoadCharset(codeset, codeset2);
|
||||
mToDicTable = new Chs;
|
||||
memset(mToDicTable, 0, sizeof(Chs));
|
||||
*mToDicTable = CharTable ? *CharTable : *mToDicTable;
|
||||
if (CharTable ) *mToDicTable = *CharTable;
|
||||
|
||||
LoadCharset(codeset2, codeset);
|
||||
mToLocTable = new Chs;
|
||||
memset(mToLocTable, 0, sizeof(Chs));
|
||||
*mToLocTable = CharTable ? *CharTable : *mToLocTable;
|
||||
if (CharTable ) *mToLocTable = *CharTable;
|
||||
}
|
||||
|
||||
|
||||
@ -409,6 +410,8 @@ bool CMSSpellLang::SpellSuggest(const char *text, bool more)
|
||||
mSIB.lrgChr = (char*)text;
|
||||
mSIB.cChr = strlen(text);
|
||||
|
||||
memset(mSZ, 0, sizeof(mSZ));
|
||||
|
||||
mSRB.cChr = sizeof(mSZ);
|
||||
mSRB.cbRate = sizeof(mRate);
|
||||
mSRB.lrgSZ = mSZ;
|
||||
@ -503,12 +506,12 @@ void CMYSpellLang::BuildRTable(const char *codeset)
|
||||
LoadCharset(codeset, mMSpell->get_dic_encoding());
|
||||
mToDicTable = new Chs;
|
||||
memset(mToDicTable, 0, sizeof(Chs));
|
||||
*mToDicTable = CharTable ? *CharTable : *mToDicTable;
|
||||
if (CharTable ) *mToDicTable = *CharTable;
|
||||
|
||||
LoadCharset(mMSpell->get_dic_encoding(), codeset);
|
||||
mToLocTable = new Chs;
|
||||
memset(mToLocTable, 0, sizeof(Chs));
|
||||
*mToLocTable = CharTable ? *CharTable : *mToLocTable;
|
||||
if (CharTable ) *mToLocTable = *CharTable;
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,6 +40,10 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
const uint SCHECKET_TYPE_UNKNOWN = 0;
|
||||
const uint SCHECKET_TYPE_MSSPELL = 1;
|
||||
const uint SCHECKET_TYPE_MYSPELL = 2;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
@ -51,6 +55,8 @@ class CSpellLang
|
||||
friend class CSpellChecker;
|
||||
|
||||
protected:
|
||||
uint mSpellType;
|
||||
|
||||
bool mIsMdrLoaded;
|
||||
bool mIsUdrLoaded;
|
||||
char mLangCode[100];
|
||||
@ -64,6 +70,7 @@ protected:
|
||||
public:
|
||||
CSpellLang()
|
||||
{
|
||||
mSpellType = SCHECKET_TYPE_UNKNOWN;
|
||||
mIsMdrLoaded = mIsUdrLoaded = false;
|
||||
mToDicTable = mToLocTable = NULL;
|
||||
}
|
||||
@ -81,7 +88,9 @@ public:
|
||||
|
||||
bool IsMdrLoaded() { return mIsMdrLoaded; }
|
||||
bool IsUdrLoaded() { return mIsUdrLoaded; }
|
||||
|
||||
const char *GetLangCode() { return mLangCode; }
|
||||
uint GetSpellType() { return mSpellType; }
|
||||
};
|
||||
|
||||
|
||||
@ -203,7 +212,11 @@ private:
|
||||
bool SpellSuggest(const char *text, bool more);
|
||||
|
||||
public:
|
||||
CMSSpellLang() { mLibrary = NULL; }
|
||||
CMSSpellLang()
|
||||
{
|
||||
mLibrary = NULL;
|
||||
mSpellType = SCHECKET_TYPE_MSSPELL;
|
||||
}
|
||||
|
||||
bool Init(HKEY hKey, const char *name);
|
||||
|
||||
@ -234,7 +247,11 @@ private:
|
||||
MySpell *mMSpell;
|
||||
|
||||
public:
|
||||
CMYSpellLang() { mMSpell = NULL; }
|
||||
CMYSpellLang()
|
||||
{
|
||||
mMSpell = NULL;
|
||||
mSpellType = SCHECKET_TYPE_MYSPELL;
|
||||
}
|
||||
|
||||
bool Init(const gdirentry *entry);
|
||||
|
||||
|
Reference in New Issue
Block a user