Commit 78cd9593 authored by twanvl's avatar twanvl

More field types, just the headers for now

parent 13c0c5e2
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
// ----------------------------------------------------------------------------- : Includes
#include <data/field/boolean.hpp>
// ----------------------------------------------------------------------------- : BooleanField
// ----------------------------------------------------------------------------- : BooleanStyle
// ----------------------------------------------------------------------------- : BooleanValue
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
#ifndef HEADER_DATA_FIELD_BOOLEAN
#define HEADER_DATA_FIELD_BOOLEAN
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <data/field/choice.hpp>
// ----------------------------------------------------------------------------- : BooleanField
/// A field whos value is either true or false
class BooleanField : public ChoiceField {
public:
BooleanField();
// no extra data
private:
DECLARE_REFLECTION();
};
// ----------------------------------------------------------------------------- : BooleanStyle
/// The Style for a BooleanField
class BooleanStyle : public ChoiceStyle {
public:
// no extra data
private:
DECLARE_REFLECTION();
};
// ----------------------------------------------------------------------------- : BooleanValue
/// The Value in a BooleanField
class BooleanValue : public ChoiceValue {
public:
// no extra data
private:
DECLARE_REFLECTION();
};
// ----------------------------------------------------------------------------- : EOF
#endif
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
// ----------------------------------------------------------------------------- : Includes
#include <data/field/choice.hpp>
// ----------------------------------------------------------------------------- : ChoiceField
// ----------------------------------------------------------------------------- : ChoiceStyle
// ----------------------------------------------------------------------------- : ChoiceValue
\ No newline at end of file
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
#ifndef HEADER_DATA_FIELD_CHOICE
#define HEADER_DATA_FIELD_CHOICE
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <util/defaultable.hpp>
#include <data/field.hpp>
#include <gfx/gfx.hpp> // for ImageCombine
// ----------------------------------------------------------------------------- : ChoiceField
/// A field that contains a list of choices
class ChoiceField : public Field {
public:
class Choice;
DECLARE_POINTER_TYPE(Choice);
private:
DECLARE_REFLECTION();
};
/// An item that can be chosen for this field
class ChoiceField::Choice {
public:
String name; ///< Name/value of the item
String default_name; ///< A default item, if this is a group and default_name.empty() there is no default
vector<ChoiceP> choices; ///< Choices and sub groups in this group
UInt first_id; ///< First item-id in this group (can be the default item)
/// Is this a group?
bool isGroup() const;
/// Can this Choice itself be chosen?
bool hasDefault() const;
/// Initialize the first_id of children
/** Returns lastId() */
UInt initIds() const;
/// Number of choices in this group (and subgroups), 1 if it is not a group
/** The default choice also counts */
UInt choiceCount() const;
/// item-id just beyond the end of this group
UInt lastId() const;
/// item-id of a choice, given the internal name
/** If the id is not in this group, returns -1 */
UInt choiceId(const String& name);
/// Internal name of a choice
/** The internal name is formed by concatenating the names of all parents, separated by spaces.
* Returns "" if id is not in this group
*/
String choiceName(UInt id);
/// Formated name of a choice.
/** Intended for use in menu structures, so it doesn't include the group name for children.
* Returns "" if id is not in this group.
*/
String choiceNameNice(UInt id);
DECLARE_REFLECTION();
};
// ----------------------------------------------------------------------------- : ChoiceStyle
// How should the menu for a choice look?
enum ChoicePopupStyle
{ POPUP_MENU
, POPUP_DROPDOWN
, POPUP_DROPDOWN_IN_PLACE
};
// How should a choice value be rendered?
enum ChoiceRenderStyle
{ RENDER_TEXT = 0x01 // render the name as text
, RENDER_IMAGE = 0x10 // render an image
, RENDER_BOTH = RENDER_TEXT | RENDER_IMAGE
, RENDER_HIDDEN = 0x20 // don't render anything, only have a menu
, RENDER_HIDDEN_IMAGE = RENDER_HIDDEN | RENDER_IMAGE
};
/// The Style for a ChoiceField
class ChoiceStyle : public Style {
public:
// FontInfo font; ///< Font for drawing text (when RENDER_TEXT)
// map<String,ScriptableImage> choice_images; ///< Images for the various choices (when RENDER_IMAGE)
map<String,Color> choice_colors; ///< Colors for the various choices (when color_cardlist)
bool colors_card_list;///< Does this field determine colors of the rows in the card list?
ChoicePopupStyle popup_style; ///< Style of popups/menus
ChoiceRenderStyle render_style; ///< Style of rendering
String mask_filename; ///< Filename of an additional mask over the images
ImageCombine combine; ///< Combining mode for drawing the images
Alignment alignment; ///< Alignment of images
private:
DECLARE_REFLECTION();
};
// ----------------------------------------------------------------------------- : ChoiceValue
/// The Value in a ChoiceField
class ChoiceValue : public Value {
public:
Defaultable<String> value; /// The name of the selected choice
private:
DECLARE_REFLECTION();
};
// ----------------------------------------------------------------------------- : EOF
#endif
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
// ----------------------------------------------------------------------------- : Includes
#include <data/field/color.hpp>
// ----------------------------------------------------------------------------- : ColorField
// ----------------------------------------------------------------------------- : ColorStyle
// ----------------------------------------------------------------------------- : ColorValue
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
#ifndef HEADER_DATA_FIELD_COLOR
#define HEADER_DATA_FIELD_COLOR
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <util/defaultable.hpp>
#include <data/field.hpp>
#include <script/scriptable.hpp>
// ----------------------------------------------------------------------------- : ColorField
/// A field for color values, it contains a list of choices for colors
class ColorField : public Field {
public:
ColorField();
class Choice;
DECLARE_POINTER_TYPE(Choice);
OptionalScript script; ///< Script to apply to all values
OptionalScript default_script; ///< Script that generates the default value
vector<ChoiceP> choices; ///< Color choices available
bool allow_custom; ///< Are colors not in the list of choices allowed?
String default_name; ///< Name of "default" value
private:
DECLARE_REFLECTION();
};
/// A color that can be chosen for this field
class ColorField::Choice {
public:
String name; ///< Name of the color
Color color; ///< The actual color
DECLARE_REFLECTION();
};
// ----------------------------------------------------------------------------- : ColorStyle
/// The Style for a ColorField
class ColorStyle : public Style {
public:
ColorStyle();
int radius; ///< Radius of round corners
UInt left_width; ///< Width of the colored region on the left side
UInt right_width; ///< Width of the colored region on the right side
UInt top_width; ///< Width of the colored region on the top side
UInt bottom_width; ///< Width of the colored region on the bottom side
private:
DECLARE_REFLECTION();
};
// ----------------------------------------------------------------------------- : ColorValue
/// The Value in a ColorField
class ColorValue : public Value {
public:
Defaultable<Color> value; ///< The value
private:
DECLARE_REFLECTION();
};
// ----------------------------------------------------------------------------- : EOF
#endif
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
// ----------------------------------------------------------------------------- : Includes
#include <data/field/image.hpp>
// ----------------------------------------------------------------------------- : ImageField
// ----------------------------------------------------------------------------- : ImageStyle
// ----------------------------------------------------------------------------- : ImageValue
\ No newline at end of file
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
#ifndef HEADER_DATA_FIELD_IMAGE
#define HEADER_DATA_FIELD_IMAGE
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <data/field.hpp>
#include <script/scriptable.hpp>
// ----------------------------------------------------------------------------- : ImageField
/// A field for image values
class ImageField : public Field {
public:
// no extra data
private:
DECLARE_REFLECTION();
};
// ----------------------------------------------------------------------------- : ImageStyle
/// The Style for a ImageField
class ImageStyle : public Style {
public:
Scriptable<String> mask_filename; ///< Filename for a mask image
private:
DECLARE_REFLECTION();
};
// ----------------------------------------------------------------------------- : ImageValue
/// The Value in a ImageField, i.e. an image
class ImageValue : public Value {
public:
String filename; ///< Filename of the image (in the current package)
private:
DECLARE_REFLECTION();
};
// ----------------------------------------------------------------------------- : EOF
#endif
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
// ----------------------------------------------------------------------------- : Includes
#include <data/field/symbol.hpp>
// ----------------------------------------------------------------------------- : SymbolField
// ----------------------------------------------------------------------------- : SymbolStyle
// ----------------------------------------------------------------------------- : SymbolValue
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
#ifndef HEADER_DATA_FIELD_SYMBOL
#define HEADER_DATA_FIELD_SYMBOL
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <data/field.hpp>
#include <script/scriptable.hpp>
DECLARE_POINTER_TYPE(SymbolFilter);
// ----------------------------------------------------------------------------- : SymbolField
/// A field for image values
class SymbolField : public Field {
public:
// no extra data
private:
DECLARE_REFLECTION();
};
// ----------------------------------------------------------------------------- : SymbolStyle
/// The Style for a SymbolField
class SymbolStyle : public Style {
public:
class Variation;
DECLARE_POINTER_TYPE(Variation);
vector<VariationP> variations; ///< Different variantions of the same symbol
private:
DECLARE_REFLECTION();
};
/// Styling for a symbol variation, defines color, border, etc.
class SymbolStyle::Variation {
public:
String name; ///< Name of this variation
SymbolFilterP filter; ///< Filter to color the symbol
double border_radius; ///< Border radius for the symbol
DECLARE_REFLECTION();
};
// ----------------------------------------------------------------------------- : SymbolValue
/// The Value in a SymbolField, i.e. a symbol
class SymbolValue : public Value {
public:
String filename; ///< Filename of the symbol (in the current package)
private:
DECLARE_REFLECTION();
};
// ----------------------------------------------------------------------------- : EOF
#endif
......@@ -16,16 +16,16 @@
// ----------------------------------------------------------------------------- : TextField
/// A field that stores tagged text
/// A field for values containing tagged text
class TextField : public Field {
public:
TextField();
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
OptionalScript script; ///< Script to apply to all values
OptionalScript default_script; ///< Script that generates the default value
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
virtual ValueP newValue(const FieldP& thisP) const;
virtual StyleP newStyle(const FieldP& thisP) const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment