Added support for custom colors for graphs;

Moved 'choice colors' from styel to field, split into 'choice colors' and 'choice colors cardlist';
Added support for pie graphs (no gui to use them, though);
Fixed bugs caused by selecting a card before the set was changed on all panels.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@336 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-05-11 14:10:29 +00:00
parent f9eade95eb
commit 3b6743b110
33 changed files with 634 additions and 186 deletions
+2 -3
View File
@@ -41,6 +41,8 @@ IMPLEMENT_REFLECTION(ChoiceField) {
REFLECT_IF_READING {
choices->initIds();
}
REFLECT(choice_colors);
REFLECT(choice_colors_cardlist);
}
// ----------------------------------------------------------------------------- : ChoiceField::Choice
@@ -162,7 +164,6 @@ ChoiceStyle::ChoiceStyle(const ChoiceFieldP& field)
: Style(field)
, popup_style(POPUP_DROPDOWN)
, render_style(RENDER_TEXT)
, colors_card_list(false)
, combine(COMBINE_NORMAL)
, alignment(ALIGN_STRETCH)
, angle(0)
@@ -242,10 +243,8 @@ IMPLEMENT_REFLECTION(ChoiceStyle) {
REFLECT(combine);
REFLECT(alignment);
REFLECT(angle);
REFLECT(colors_card_list);
REFLECT(font);
REFLECT(choice_images);
REFLECT(choice_colors);
}
// ----------------------------------------------------------------------------- : ChoiceValue
+2 -2
View File
@@ -37,6 +37,8 @@ class ChoiceField : public Field {
OptionalScript default_script; ///< Script that generates the default value
String initial; ///< Initial choice of a new value, or ""
String default_name; ///< Name of "default" value
map<String,Color> choice_colors; ///< Colors for the various choices (when color_cardlist)
map<String,Color> choice_colors_cardlist; ///< Colors for the various choices, for in the card list
virtual void initDependencies(Context&, const Dependency&) const;
@@ -131,8 +133,6 @@ class ChoiceStyle : public Style {
ChoiceRenderStyle render_style; ///< Style of rendering
Font 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?
Scriptable<String> mask_filename; ///< Filename of an additional mask over the images
ImageCombine combine; ///< Combining mode for drawing the images
Alignment alignment; ///< Alignment of images
+14 -4
View File
@@ -8,21 +8,29 @@
#include <data/statistics.hpp>
#include <data/field.hpp>
#include <data/field/choice.hpp>
// ----------------------------------------------------------------------------- : Statistics dimension
StatsDimension::StatsDimension()
: automatic(false)
, numeric(false)
: automatic (false)
, numeric (false)
, show_empty(false)
{}
StatsDimension::StatsDimension(const Field& field)
: automatic(true)
: automatic (true)
, name (field.name)
, description (field.description)
, icon_filename(field.icon_filename)
, numeric(false)
, numeric (false)
, show_empty (false)
{
// choice colors?
const ChoiceField* choice_field = dynamic_cast<const ChoiceField*>(&field);
if (choice_field) {
colors = choice_field->choice_colors;
}
// initialize script, card.{field_name}
Script& s = script.getScript();
s.addInstruction(I_GET_VAR, string_to_variable(_("card")));
@@ -37,6 +45,8 @@ IMPLEMENT_REFLECTION(StatsDimension) {
REFLECT_N("icon", icon_filename);
REFLECT(script);
REFLECT(numeric);
REFLECT(show_empty);
REFLECT(colors);
}
}
+8 -6
View File
@@ -26,12 +26,14 @@ class StatsDimension {
StatsDimension();
StatsDimension(const Field&);
bool automatic; ///< Based on a card field?
String name; ///< Name of this dimension
String description; ///< Description, used in status bar
String icon_filename; ///< Icon for lists
OptionalScript script; ///< Script that determines the value(s)
bool numeric; ///< Are the values numeric? If so, they require special sorting
bool automatic; ///< Based on a card field?
String name; ///< Name of this dimension
String description; ///< Description, used in status bar
String icon_filename; ///< Icon for lists
OptionalScript script; ///< Script that determines the value(s)
bool numeric; ///< Are the values numeric? If so, they require special sorting
bool show_empty; ///< Should "" be shown?
map<String,Color> colors; ///< Colors for the categories
DECLARE_REFLECTION();
};