Added 'insert symbol' menu for SymbolFonts;

Added scriptable 'enabled' to symbols in symbol font, used instead of scripted filenames. This means changing the tap symbol style now works;
Added localisation for games, stylesheets and symbolfonts;
Warnings from Reader are now shown onIdle;

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@198 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-02-07 22:31:21 +00:00
parent b93e5b2ae3
commit 73a2f61e68
36 changed files with 606 additions and 101 deletions
+52 -4
View File
@@ -7,6 +7,9 @@
// ----------------------------------------------------------------------------- : Includes
#include <data/locale.hpp>
#include <data/game.hpp>
#include <data/stylesheet.hpp>
#include <data/symbol_font.hpp>
#include <util/io/package_manager.hpp>
#include <script/to_value.hpp>
@@ -32,19 +35,64 @@ IMPLEMENT_REFLECTION(Locale) {
REFLECT_N("error", translations[LOCALE_CAT_ERROR]);
REFLECT_N("type", translations[LOCALE_CAT_TYPE]);
REFLECT_N("game", game_translations);
REFLECT_N("stylesheet", stylesheet_translations);
REFLECT_N("symbol font", symbol_font_translations);
}
IMPLEMENT_REFLECTION_NAMELESS(GameLocale) {
IMPLEMENT_REFLECTION_NAMELESS(SubLocale) {
REFLECT_NAMELESS(translations);
}
// ----------------------------------------------------------------------------- : Translation
String SubLocale::tr(const String& key) {
map<String,String>::const_iterator it = translations.find(key);
if (it == translations.end()) {
return _("missing:") + key;
} else {
return it->second;
}
}
String SubLocale::tr(const String& key, const String& def) {
map<String,String>::const_iterator it = translations.find(key);
if (it == translations.end()) {
return def;
} else {
return it->second;
}
}
// from util/locale.hpp
String tr(LocaleCategory cat, const String& key) {
if (!the_locale) return key; // no locale loaded (yet)
map<String,String>::const_iterator it = the_locale->translations[cat].find(key);
if (it == the_locale->translations[cat].end()) return _("missing:") + key;
return it->second;
return the_locale->translations[cat].tr(key);
}
String tr(const Game& g, const String& key) {
if (!the_locale) return key; // no locale loaded (yet)
return the_locale->game_translations[g.name()]->tr(key);
}
String tr(const StyleSheet& s, const String& key) {
if (!the_locale) return key; // no locale loaded (yet)
return the_locale->stylesheet_translations[s.name()]->tr(key);
}
String tr(const SymbolFont& f, const String& key) {
if (!the_locale) return key; // no locale loaded (yet)
return the_locale->symbol_font_translations[f.name()]->tr(key);
}
String tr(const Game& g, const String& key, const String& def) {
if (!the_locale) return key; // no locale loaded (yet)
return the_locale->game_translations[g.name()]->tr(key, def);
}
String tr(const StyleSheet& s, const String& key, const String& def) {
if (!the_locale) return key; // no locale loaded (yet)
return the_locale->stylesheet_translations[s.name()]->tr(key, def);
}
String tr(const SymbolFont& f, const String& key, const String& def) {
if (!the_locale) return key; // no locale loaded (yet)
return the_locale->symbol_font_translations[f.name()]->tr(key, def);
}