Added dummy keyword panel; fixed directory finding; added more controls to style panel

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@86 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-11-21 16:26:22 +00:00
parent 7148d90bcb
commit 11a0276232
18 changed files with 204 additions and 32 deletions
+25 -1
View File
@@ -14,7 +14,7 @@ IMPLEMENT_REFLECTION(KeywordParam) {
REFLECT(name);
REFLECT(description);
REFLECT(match);
REFLECT(in_reminder);
REFLECT(script);
}
IMPLEMENT_REFLECTION(KeywordMode) {
REFLECT(name);
@@ -25,8 +25,32 @@ IMPLEMENT_REFLECTION(KeywordExpansion) {
REFLECT(after);
REFLECT(reminder);
}
// backwards compatability
template <typename T> void read_compat(T&, const Keyword*) {}
void read_compat(Reader& tag, Keyword* k) {
String separator, parameter, reminder;
REFLECT(separator);
REFLECT(parameter);
REFLECT(reminder);
if (!separator.empty() || !parameter.empty() || !reminder.empty()) {
// old style keyword declaration, no separate expansion
KeywordExpansionP e(new KeywordExpansion);
size_t start = separator.find_first_of('[');
size_t end = separator.find_first_of(']');
if (start != String.npos && end != String.npos) {
e->after += separator.substr(start + 1, end - start - 1);
}
if (!parameter.empty()) {
e->after += _("<param>") + parameter + _("</param>");
}
e->reminder.set(reminder);
}
}
IMPLEMENT_REFLECTION(Keyword) {
REFLECT(keyword);
read_compat(tag, this);
REFLECT(expansions);
REFLECT(rules);
REFLECT(mode);
+2 -2
View File
@@ -26,7 +26,7 @@ class KeywordParam {
String description; ///< Description of the type
String match; ///< Uncompiled regex
wxRegEx matchRe; ///< Regular expression to match
OptionalScript in_reminder; ///< Transformation of the value for showing in the reminder text
OptionalScript script; ///< Transformation of the value for showing in the reminder text
DECLARE_REFLECTION();
};
@@ -50,7 +50,7 @@ class KeywordExpansion {
String after; ///< Components after the keyword: parameters and separators
vector<KeywordParamP> parameters; ///< The types of parameters
wxRegEx splitter; ///< Regular expression to split/match the components, automatically generated
OptionalScript reminder; ///< Reminder text of the keyword
StringScript reminder; ///< Reminder text of the keyword
DECLARE_REFLECTION();
};
+6 -2
View File
@@ -13,9 +13,10 @@
#include <util/reflect.hpp>
#include <util/io/reader.hpp>
#include <util/io/writer.hpp>
#include <script/value.hpp>
#include <wx/filename.h>
#include <wx/wfstream.h>
#include <script/value.hpp>
#include <wx/stdpaths.h>
// ----------------------------------------------------------------------------- : Extra types
@@ -131,8 +132,11 @@ StyleSheetSettings& Settings::stylesheetSettingsFor(const StyleSheet& stylesheet
return *ss;
}
/// Retrieve the directory to use for settings and other data files
String user_settings_dir() {
return _(""); // TODO
String dir = wxStandardPaths::Get().GetUserDataDir();
if (!wxDirExists(dir)) wxMkDir(dir);
return dir + _("/");
}
String Settings::settingsFile() {