mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 21:06:59 -04:00
Added Alignment, Defaultable and Scriptable types, needed some reflection tweaks for the last two.
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@17 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+2
-2
@@ -20,7 +20,7 @@ Field::Field()
|
||||
, card_list_column (-1)
|
||||
, card_list_width (100)
|
||||
, card_list_allow (true)
|
||||
// , card_list_align (ALIGN_LEFT)
|
||||
, card_list_align (ALIGN_LEFT)
|
||||
, tab_index (0)
|
||||
{}
|
||||
|
||||
@@ -38,7 +38,7 @@ IMPLEMENT_REFLECTION(Field) {
|
||||
REFLECT(card_list_column);
|
||||
REFLECT(card_list_width);
|
||||
REFLECT(card_list_allow);
|
||||
// REFLECT(card_list_align);
|
||||
REFLECT(card_list_align);
|
||||
REFLECT(tab_index);
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <util/prec.hpp>
|
||||
#include <util/reflect.hpp>
|
||||
#include <util/alignment.hpp>
|
||||
|
||||
DECLARE_POINTER_TYPE(Field);
|
||||
DECLARE_POINTER_TYPE(Style);
|
||||
@@ -35,9 +36,9 @@ class Field {
|
||||
UInt card_list_width; ///< Width of the card list column (pixels).
|
||||
bool card_list_allow; ///< Is this field allowed to appear in the card list.
|
||||
String card_list_name; ///< Alternate name to use in card list.
|
||||
// Alignment card_list_align; ///< Alignment of the card list colummn.
|
||||
Alignment card_list_align; ///< Alignment of the card list colummn.
|
||||
int tab_index; ///< Tab index in editor
|
||||
// Vector<DependendScript> dependendScripts; // scripts that depend on values of this field
|
||||
// vector<Dependency> dependentScripts; // scripts that depend on values of this field
|
||||
|
||||
/// Creates a new Value corresponding to this Field
|
||||
/** thisP is a smart pointer to this */
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <data/field/text.hpp>
|
||||
#include <script/script.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- : TextField
|
||||
|
||||
@@ -37,8 +38,8 @@ String TextField::typeName() const {
|
||||
IMPLEMENT_REFLECTION(TextField) {
|
||||
REFLECT_BASE(Field);
|
||||
REFLECT(multi_line);
|
||||
// REFLECT(script);
|
||||
// REFLECT_N("default", default_script);
|
||||
REFLECT(script);
|
||||
REFLECT_N("default", default_script);
|
||||
REFLECT(move_cursor_with_sort);
|
||||
REFLECT(default_name);
|
||||
}
|
||||
@@ -61,4 +62,5 @@ ValueP TextValue::clone() const {
|
||||
|
||||
IMPLEMENT_REFLECTION(TextValue) {
|
||||
REFLECT_BASE(Value);
|
||||
REFLECT_NAMELESS(value);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <util/prec.hpp>
|
||||
#include <util/defaultable.hpp>
|
||||
#include <data/field.hpp>
|
||||
#include <script/scriptable.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- : TextField
|
||||
|
||||
@@ -19,8 +21,8 @@ class TextField : public Field {
|
||||
public:
|
||||
TextField();
|
||||
|
||||
// Script script;
|
||||
// Script default_script;
|
||||
OptionalScript script;
|
||||
OptionalScript default_script;
|
||||
bool multi_line; ///< Are newlines allowed in the text?
|
||||
bool move_cursor_with_sort; ///< When the text is reordered by a script should the cursor position be updated?
|
||||
String default_name; ///< Name of "default" value
|
||||
@@ -43,7 +45,7 @@ class TextStyle : public Style {
|
||||
// SymbolFontInfo symbol_font; ///< Symbol font for symbols in the text
|
||||
bool always_symbol; ///< Should everything be drawn as symbols?
|
||||
bool allow_formatting; ///< Is formating (bold/italic/..) allowed?
|
||||
// Alignment alignment; ///< Alignment inside the box
|
||||
Alignment alignment; ///< Alignment inside the box
|
||||
int angle; ///< Angle of the text inside the box
|
||||
int padding_left, padding_left_min; ///< Padding
|
||||
int padding_right, padding_right_min; ///< Padding
|
||||
@@ -66,9 +68,9 @@ class TextStyle : public Style {
|
||||
/// The Value in a TextField
|
||||
class TextValue : public Value {
|
||||
public:
|
||||
virtual ValueP clone() const;
|
||||
Defaultable<String> value; ///< The text of this value
|
||||
|
||||
String value;
|
||||
virtual ValueP clone() const;
|
||||
private:
|
||||
DECLARE_REFLECTION();
|
||||
};
|
||||
|
||||
+2
-1
@@ -9,6 +9,7 @@
|
||||
#include <data/game.hpp>
|
||||
#include <data/field.hpp>
|
||||
#include <util/io/package_manager.hpp>
|
||||
#include <script/script.hpp>
|
||||
#include <script/value.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- : Game
|
||||
@@ -27,7 +28,7 @@ IMPLEMENT_REFLECTION(Game) {
|
||||
// ioMseVersion(io, fileName, fileVersion);
|
||||
REFLECT(full_name);
|
||||
REFLECT_N("icon", icon_filename);
|
||||
// REFLECT(init_script);
|
||||
REFLECT(init_script);
|
||||
REFLECT(set_fields);
|
||||
REFLECT(card_fields);
|
||||
// REFLECT_N("keyword parameter type", keyword_params);
|
||||
|
||||
+6
-4
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <util/prec.hpp>
|
||||
#include <util/io/package.hpp>
|
||||
#include <script/scriptable.hpp>
|
||||
|
||||
DECLARE_POINTER_TYPE(Field);
|
||||
DECLARE_POINTER_TYPE(Game);
|
||||
@@ -19,10 +20,11 @@ DECLARE_POINTER_TYPE(Game);
|
||||
|
||||
class Game : public Packaged {
|
||||
public:
|
||||
String full_name;
|
||||
String icon_filename;
|
||||
vector<FieldP> set_fields;
|
||||
vector<FieldP> card_fields;
|
||||
String full_name; ///< Name of this game for menus etc.
|
||||
String icon_filename; ///< Filename of icon to use in NewWindow
|
||||
OptionalScript init_script; ///< Script of variables available to other scripts in this game
|
||||
vector<FieldP> set_fields; ///< Fields for set information
|
||||
vector<FieldP> card_fields; ///< Fields on each card
|
||||
|
||||
/// Loads the game with a particular name, for example "magic"
|
||||
static GameP byName(const String& name);
|
||||
|
||||
Reference in New Issue
Block a user