mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
'ported' scripting code to work with unicode and the rest of MSE
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@14 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <data/game.hpp>
|
||||
#include <data/field.hpp>
|
||||
#include <util/error.hpp>
|
||||
#include <script/value.hpp>
|
||||
|
||||
DECLARE_TYPEOF_COLLECTION(FieldP);
|
||||
|
||||
|
||||
+24
-3
@@ -7,10 +7,30 @@
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <data/field.hpp>
|
||||
#include <data/field/text.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- : Field
|
||||
|
||||
Field::Field()
|
||||
: index (0) // sensible default?
|
||||
, editable (true)
|
||||
, saveValue (true)
|
||||
, showStatistics (true)
|
||||
, identifying (false)
|
||||
, cardListColumn (-1)
|
||||
, cardListWidth (100)
|
||||
, cardListAllow (true)
|
||||
// , cardListAlign (ALIGN_LEFT)
|
||||
, tabIndex (0)
|
||||
{}
|
||||
|
||||
Field::~Field() {}
|
||||
|
||||
IMPLEMENT_REFLECTION(Field) {
|
||||
if (!tag.reading()) {
|
||||
String type = typeName();
|
||||
REFLECT_N("type", type);
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
@@ -18,10 +38,11 @@ shared_ptr<Field> read_new<Field>(Reader& reader) {
|
||||
// there must be a type specified
|
||||
String type;
|
||||
reader.handle(_("type"), type);
|
||||
// if (type == _("text")) {
|
||||
// } else {
|
||||
if (type == _("text")) {
|
||||
return new_shared<TextField>();
|
||||
} else {
|
||||
throw "TODO";
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+8
-6
@@ -41,14 +41,14 @@ class Field {
|
||||
|
||||
/// Creates a new Value corresponding to this Field
|
||||
/** thisP is a smart pointer to this */
|
||||
virtual ValueP newValue(FieldP thisP) = 0;
|
||||
virtual ValueP newValue(const FieldP& thisP) const = 0;
|
||||
/// Creates a new Style corresponding to this Field
|
||||
/** thisP is a smart pointer to this */
|
||||
virtual StyleP newStyle(FieldP thisP) = 0;
|
||||
virtual StyleP newStyle(const FieldP& thisP) const = 0;
|
||||
/// create a copy of this field
|
||||
virtual FieldP clone() = 0;
|
||||
virtual FieldP clone() const = 0;
|
||||
/// Type of this field
|
||||
virtual String typeName() = 0;
|
||||
virtual String typeName() const = 0;
|
||||
|
||||
private:
|
||||
DECLARE_REFLECTION_VIRTUAL();
|
||||
@@ -60,6 +60,7 @@ shared_ptr<Field> read_new<Field>(Reader& reader);
|
||||
|
||||
// ----------------------------------------------------------------------------- : Style
|
||||
|
||||
/// Style information needed to display a Value in a Field.
|
||||
class Style {
|
||||
public:
|
||||
virtual ~Style();
|
||||
@@ -72,13 +73,14 @@ void initObject(const FieldP&, StyleP&);
|
||||
|
||||
// ----------------------------------------------------------------------------- : Value
|
||||
|
||||
/// A specific value 'in' a Field.
|
||||
class Value {
|
||||
public:
|
||||
virtual ~Value();
|
||||
|
||||
/// Create a copy of this value
|
||||
virtual ValueP clone() = 0;
|
||||
|
||||
virtual ValueP clone() const = 0;
|
||||
|
||||
private:
|
||||
DECLARE_REFLECTION_VIRTUAL();
|
||||
};
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <data/game.hpp>
|
||||
#include <data/field.hpp>
|
||||
#include <util/io/package_manager.hpp>
|
||||
#include <script/value.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- : Game
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <data/set.hpp>
|
||||
#include <data/card.hpp>
|
||||
#include <script/value.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- : Set
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <util/io/writer.hpp>
|
||||
#include <wx/filename.h>
|
||||
#include <wx/wfstream.h>
|
||||
#include <script/value.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- : Extra types
|
||||
|
||||
@@ -105,7 +106,7 @@ IMPLEMENT_REFLECTION(Settings) {
|
||||
REFLECT_N("check updates", checkUpdates);
|
||||
// ioAll(io, "game settings", gameSettings);
|
||||
// ioStyleSettings(io);
|
||||
REFLECT_N("default style settings", defaultStyleSettings);
|
||||
// REFLECT_N("default style settings", defaultStyleSettings);
|
||||
}
|
||||
|
||||
void Settings::read() {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <data/symbol.hpp>
|
||||
#include <gfx/bezier.hpp>
|
||||
#include <script/value.hpp>
|
||||
|
||||
DECLARE_TYPEOF_COLLECTION(SymbolPartP);
|
||||
DECLARE_TYPEOF_COLLECTION(ControlPointP);
|
||||
|
||||
Reference in New Issue
Block a user