The check_spelling function now has support for additional dictionaries and regexes to match.

The magic game uses these features.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1269 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-12-30 02:09:11 +00:00
parent 09216eca5d
commit 12f8be203e
11 changed files with 185 additions and 18 deletions
+21
View File
@@ -120,6 +120,27 @@ InputStreamP PackageManager::openFileFromPackage(Packaged*& package, const Strin
throw FileNotFoundError(name, _("No package name specified, use '/package/filename'"));
}
String PackageManager::openFilenameFromPackage(Packaged*& package, const String& name) {
if (!name.empty() && name.GetChar(0) == _('/')) {
// absolute name; break name
size_t start = name.find_first_not_of(_("/\\"), 1); // allow "//package/name" from incorrect scripts
size_t pos = name.find_first_of(_("/\\"), start);
if (start < pos && pos != String::npos) {
// open package
PackagedP p = openAny(name.substr(start, pos-start));
if (package && !is_substr(name,start,_(":NO-WARN-DEP:"))) {
package->requireDependency(p.get());
}
package = p.get();
return p->absoluteFilename() + _("/") + name.substr(pos + 1);
}
} else if (package) {
// relative name
return package->absoluteFilename() + _("/") + name;
}
throw FileNotFoundError(name, _("No package name specified, use '/package/filename'"));
}
String PackageManager::getDictionaryDir(bool l) const {
String dir = (l ? local : global).getDirectory();
if (dir.empty()) return wxEmptyString;