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:
twanvl
2007-09-24 21:54:52 +00:00
parent 36a36356c5
commit 4c40394ba5
22 changed files with 279 additions and 29 deletions
+8 -3
View File
@@ -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());
}
}