mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user