mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Choice images recomputed less often;
Implemented GraphType for choosing different layouts on the stats panel; Added option to define order of graph groups; Added busy cursor when loading recent file; Parentheses in FOR_EACH macro git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@351 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -164,6 +164,7 @@ ChoiceStyle::ChoiceStyle(const ChoiceFieldP& field)
|
||||
: Style(field)
|
||||
, popup_style(POPUP_DROPDOWN)
|
||||
, render_style(RENDER_TEXT)
|
||||
, choice_images_initialized(false)
|
||||
, combine(COMBINE_NORMAL)
|
||||
, alignment(ALIGN_STRETCH)
|
||||
, angle(0)
|
||||
@@ -179,10 +180,14 @@ bool ChoiceStyle::update(Context& ctx) {
|
||||
// Don't update the choice images, leave that to invalidate()
|
||||
bool change = Style ::update(ctx)
|
||||
| mask_filename.update(ctx);
|
||||
FOR_EACH(ci, choice_images) {
|
||||
if (ci.second.update(ctx)) {
|
||||
change = true;
|
||||
// TODO : remove this thumbnail
|
||||
if (!choice_images_initialized) {
|
||||
// we only want to do this once because it is rather slow, other updates are handled by dependencies
|
||||
choice_images_initialized = true;
|
||||
FOR_EACH(ci, choice_images) {
|
||||
if (ci.second.update(ctx)) {
|
||||
change = true;
|
||||
// TODO : remove this thumbnail
|
||||
}
|
||||
}
|
||||
}
|
||||
return change;
|
||||
|
||||
@@ -133,6 +133,7 @@ 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)
|
||||
bool choice_images_initialized;
|
||||
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
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
//+----------------------------------------------------------------------------+
|
||||
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
|
||||
//| Copyright: (C) 2001 - 2007 Twan van Laarhoven |
|
||||
//| License: GNU General Public License 2 or later (see file COPYING) |
|
||||
//+----------------------------------------------------------------------------+
|
||||
|
||||
#ifndef HEADER_DATA_GRAPH_TYPE
|
||||
#define HEADER_DATA_GRAPH_TYPE
|
||||
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <util/prec.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- : GraphType
|
||||
|
||||
/// Types of graphs
|
||||
enum GraphType
|
||||
{ GRAPH_TYPE_BAR
|
||||
, GRAPH_TYPE_PIE
|
||||
, GRAPH_TYPE_STACK
|
||||
, GRAPH_TYPE_SCATTER
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
#endif
|
||||
+16
-9
@@ -29,10 +29,14 @@ StatsDimension::StatsDimension(const Field& field)
|
||||
, numeric (false)
|
||||
, show_empty (false)
|
||||
{
|
||||
// choice colors?
|
||||
// choice field?
|
||||
const ChoiceField* choice_field = dynamic_cast<const ChoiceField*>(&field);
|
||||
if (choice_field) {
|
||||
colors = choice_field->choice_colors;
|
||||
int count = choice_field->choices->lastId();
|
||||
for (int i = 0 ; i < count ; ++i) {
|
||||
groups.push_back(choice_field->choices->choiceName(i));
|
||||
}
|
||||
}
|
||||
// initialize script, card.{field_name}
|
||||
Script& s = script.getScript();
|
||||
@@ -50,6 +54,7 @@ IMPLEMENT_REFLECTION_NO_GET_MEMBER(StatsDimension) {
|
||||
REFLECT(numeric);
|
||||
REFLECT(show_empty);
|
||||
REFLECT(colors);
|
||||
REFLECT(groups);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,13 +74,6 @@ StatsCategory::StatsCategory(const StatsDimensionP& dim)
|
||||
, type(GRAPH_TYPE_BAR)
|
||||
{}
|
||||
|
||||
IMPLEMENT_REFLECTION_ENUM(GraphType) {
|
||||
VALUE_N("bar", GRAPH_TYPE_BAR);
|
||||
VALUE_N("stack", GRAPH_TYPE_STACK);
|
||||
VALUE_N("pie", GRAPH_TYPE_PIE);
|
||||
VALUE_N("scatter", GRAPH_TYPE_SCATTER);
|
||||
}
|
||||
|
||||
IMPLEMENT_REFLECTION_NO_GET_MEMBER(StatsCategory) {
|
||||
if (!automatic) {
|
||||
REFLECT(name);
|
||||
@@ -102,4 +100,13 @@ void StatsCategory::find_dimensions(const vector<StatsDimensionP>& available) {
|
||||
dimensions.push_back(dim);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : GraphType (from graph_type.hpp)
|
||||
|
||||
IMPLEMENT_REFLECTION_ENUM(GraphType) {
|
||||
VALUE_N("bar", GRAPH_TYPE_BAR);
|
||||
VALUE_N("pie", GRAPH_TYPE_PIE);
|
||||
VALUE_N("stack", GRAPH_TYPE_STACK);
|
||||
VALUE_N("scatter", GRAPH_TYPE_SCATTER);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <util/prec.hpp>
|
||||
#include <util/reflect.hpp>
|
||||
#include <data/graph_type.hpp>
|
||||
#include <script/scriptable.hpp>
|
||||
|
||||
class Field;
|
||||
@@ -34,20 +35,13 @@ class StatsDimension : public IntrusivePtrBase<StatsDimension> {
|
||||
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
|
||||
vector<String> groups; ///< Order of the items
|
||||
|
||||
DECLARE_REFLECTION();
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : Statistics category
|
||||
|
||||
/// Types of graphs
|
||||
enum GraphType
|
||||
{ GRAPH_TYPE_BAR
|
||||
, GRAPH_TYPE_STACK
|
||||
, GRAPH_TYPE_PIE
|
||||
, GRAPH_TYPE_SCATTER
|
||||
};
|
||||
|
||||
/// A category for statistics
|
||||
/** Can be generated automatically based on a dimension */
|
||||
class StatsCategory : public IntrusivePtrBase<StatsCategory> {
|
||||
|
||||
Reference in New Issue
Block a user