mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 21:06:59 -04:00
Symbol resizing using aspect ratio;
TODO: copy code for rarity box to other styles git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@622 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+5
-1
@@ -170,7 +170,11 @@ void Style::checkContentDependencies(Context& ctx, const Dependency& dep) const
|
||||
}
|
||||
|
||||
void Style::markDependencyMember(const String& name, const Dependency& dep) const {
|
||||
// no content specific properties here
|
||||
// mark dependencies on content
|
||||
if (dep.type == DEP_DUMMY && dep.index == false && starts_with(name, _("content "))) {
|
||||
// anything that starts with "content_" is a content property
|
||||
const_cast<Dependency&>(dep).index = true;
|
||||
}
|
||||
}
|
||||
|
||||
void mark_dependency_member(const Style& style, const String& name, const Dependency& dep) {
|
||||
|
||||
@@ -283,6 +283,12 @@ IMPLEMENT_REFLECTION_ENUM(ChoiceRenderStyle) {
|
||||
VALUE_N("both list", RENDER_BOTH_LIST);
|
||||
}
|
||||
|
||||
template <typename T> void reflect_content(T& tag, const ChoiceStyle& cs) {}
|
||||
template <> void reflect_content(GetMember& tag, const ChoiceStyle& cs) {
|
||||
REFLECT_N("content_width", cs.content_width);
|
||||
REFLECT_N("content_height", cs.content_height);
|
||||
}
|
||||
|
||||
IMPLEMENT_REFLECTION(ChoiceStyle) {
|
||||
REFLECT_ALIAS(300, "card list colors", "colors card list");
|
||||
REFLECT_BASE(Style);
|
||||
@@ -295,6 +301,7 @@ IMPLEMENT_REFLECTION(ChoiceStyle) {
|
||||
REFLECT(font);
|
||||
REFLECT(image);
|
||||
REFLECT(choice_images);
|
||||
reflect_content(tag, *this);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : ChoiceValue
|
||||
|
||||
@@ -155,6 +155,8 @@ class ChoiceStyle : public Style {
|
||||
int angle; ///< Angle by which the images are rotated
|
||||
wxImageList* thumbnails; ///< Thumbnails for the choices
|
||||
vector<ThumbnailStatus> thumbnails_status; ///< Which thumbnails are up to date?
|
||||
// information from image rendering
|
||||
double content_width, content_height; ///< Size of the rendered image/text
|
||||
|
||||
/// Load the mask image, if it's not already done
|
||||
void loadMask(Package& pkg);
|
||||
|
||||
@@ -81,14 +81,6 @@ void TextStyle::checkContentDependencies(Context& ctx, const Dependency& dep) co
|
||||
Style ::checkContentDependencies(ctx, dep);
|
||||
alignment.initDependencies(ctx, dep);
|
||||
}
|
||||
void TextStyle::markDependencyMember(const String& name, const Dependency& dep) const {
|
||||
Style::markDependencyMember(name, dep);
|
||||
// mark dependencies on content
|
||||
if (dep.type == DEP_DUMMY && dep.index == false &&
|
||||
(name == _("content width") || name == _("content height") || name == _("content lines"))) {
|
||||
const_cast<Dependency&>(dep).index = true;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T> void reflect_content(T& tag, const TextStyle& ts) {}
|
||||
template <> void reflect_content(GetMember& tag, const TextStyle& ts) {
|
||||
|
||||
@@ -75,7 +75,6 @@ class TextStyle : public Style {
|
||||
virtual bool update(Context&);
|
||||
virtual void initDependencies(Context&, const Dependency&) const;
|
||||
virtual void checkContentDependencies(Context&, const Dependency&) const;
|
||||
virtual void markDependencyMember(const String& name, const Dependency&) const;
|
||||
|
||||
/// The rotation to use when drawing
|
||||
inline Rotation getRotation() const {
|
||||
|
||||
Reference in New Issue
Block a user