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());
}
}
+4 -3
View File
@@ -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
+6
View File
@@ -52,6 +52,7 @@ ScriptParseErrors::ScriptParseErrors(const vector<ScriptParseError>& errors)
// Errors for which a message box was already shown
vector<String> previous_errors;
vector<String> previous_warnings;
String pending_errors;
String pending_warnings;
DECLARE_TYPEOF_COLLECTION(String);
@@ -90,6 +91,11 @@ void handle_warning(const String& w, bool now) {
{
// Check duplicates
wxCriticalSectionLocker lock(crit_error_handling);
// Check duplicates
FOR_EACH(pw, previous_warnings) {
if (w == pw) return;
}
previous_warnings.push_back(w);
// Only show errors in the main thread
if (!pending_warnings.empty()) pending_warnings += _("\n\n");
pending_warnings += w;