mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
Now also requires a dependency for symbol fonts;
Fixed all the dependency warnings for the magic templates git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@754 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <data/symbol_font.hpp>
|
||||
#include <data/stylesheet.hpp>
|
||||
#include <util/dynamic_arg.hpp>
|
||||
#include <util/io/package_manager.hpp>
|
||||
#include <util/rotation.hpp>
|
||||
@@ -581,10 +582,10 @@ bool SymbolFontRef::valid() const {
|
||||
bool SymbolFontRef::update(Context& ctx) {
|
||||
if (name.update(ctx)) {
|
||||
// font name changed, load another font
|
||||
loadFont();
|
||||
loadFont(ctx);
|
||||
return true;
|
||||
} else {
|
||||
if (!font) loadFont();
|
||||
if (!font) loadFont(ctx);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -592,11 +593,15 @@ void SymbolFontRef::initDependencies(Context& ctx, const Dependency& dep) const
|
||||
name.initDependencies(ctx, dep);
|
||||
}
|
||||
|
||||
void SymbolFontRef::loadFont() {
|
||||
void SymbolFontRef::loadFont(Context& ctx) {
|
||||
if (name().empty()) {
|
||||
font = SymbolFontP();
|
||||
} else {
|
||||
font = SymbolFont::byName(name);
|
||||
// ensure the dependency on the font is present in the stylesheet this ref is in
|
||||
// Getting this stylesheet from the context is a bit of a hack
|
||||
StyleSheetP stylesheet = from_script<StyleSheetP>(ctx.getVariable(_("stylesheet")));
|
||||
stylesheet->requireDependency(font.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -169,10 +169,11 @@ class SymbolFontRef {
|
||||
Alignment alignment; ///< Alignment of symbols in a line of text
|
||||
SymbolFontP font; ///< The font, if it is loaded
|
||||
|
||||
/// (re)load the symbol font based on name
|
||||
void loadFont();
|
||||
|
||||
private:
|
||||
DECLARE_REFLECTION();
|
||||
|
||||
/// (re)load the symbol font based on name
|
||||
void loadFont(Context& ctx);
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
|
||||
Reference in New Issue
Block a user