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
+31
View File
@@ -72,3 +72,34 @@ template <> void GetDefaultMember::handle(const OptionalScript& os) {
handle(script_nil);
}
}
// ----------------------------------------------------------------------------- : StringScript
const String& StringScript::get() const {
return unparsed;
}
void StringScript::set(const String& s) {
unparsed = s;
script = ::parse(unparsed, true);
}
template <> void Reader::handle(StringScript& os) {
handle(os.unparsed);
os.parse(*this, true);
}
// same as OptionalScript
template <> void Writer::handle(const StringScript& os) {
handle(os.unparsed);
}
template <> void GetDefaultMember::handle(const StringScript& os) {
// reflect as the script itself
if (os.script) {
handle(os.script);
} else {
handle(script_nil);
}
}
+12 -2
View File
@@ -30,7 +30,7 @@ void store(const ScriptValueP& val, Defaultable<String>& var);
// ----------------------------------------------------------------------------- : OptionalScript
/// An optional script,
/// An optional script
class OptionalScript {
public:
inline OptionalScript() {}
@@ -73,7 +73,7 @@ class OptionalScript {
/// Initialize things this script depends on by adding dep to their list of dependent scripts
void initDependencies(Context&, const Dependency& dep) const;
private:
protected:
ScriptP script; ///< The script, may be null if there is no script
String unparsed; ///< Unparsed script, for writing back to a file
// parse the unparsed string, while reading
@@ -85,6 +85,16 @@ class OptionalScript {
template <typename T>
inline ScriptValueP toScript(const Defaultable<T>& v) { return toScript(v.get()); }
// ----------------------------------------------------------------------------- : StringScript
/// An optional script which is parsed in string mode
class StringScript : public OptionalScript {
public:
const String& get() const;
void set(const String&);
DECLARE_REFLECTION();
};
// ----------------------------------------------------------------------------- : Scriptable
/// A script that defines a calculation to find a value