mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
Split script/functions.cpp into multiple files in new script/functions/ directory.
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@217 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -92,7 +92,7 @@ void export_image(const SetP& set, const CardP& card, const String& filename);
|
||||
Bitmap export_bitmap(const SetP& set, const CardP& card);
|
||||
|
||||
/// Export a set to Magic Workstation format
|
||||
void export_mws(const SetP& set);
|
||||
void export_mws(Window* parent, const SetP& set);
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
#endif
|
||||
|
||||
@@ -52,7 +52,7 @@ String card_rarity_code(const String& rarity) {
|
||||
|
||||
// ----------------------------------------------------------------------------- : export_mws
|
||||
|
||||
void export_mws(const SetP& set) {
|
||||
void export_mws(Window* parent, const SetP& set) {
|
||||
if (!set->game->isMagic()) {
|
||||
throw Error(_("Can only export Magic sets to Magic Workstation"));
|
||||
}
|
||||
@@ -60,7 +60,7 @@ void export_mws(const SetP& set) {
|
||||
// Select filename
|
||||
String name = wxFileSelector(_("Export to file"),_(""),_(""),_(""),
|
||||
_("Text files (*.txt)|*.txt|All Files|*.*"),
|
||||
wxSAVE | wxOVERWRITE_PROMPT);
|
||||
wxSAVE | wxOVERWRITE_PROMPT, parent);
|
||||
if (name.empty()) return;
|
||||
wxBusyCursor busy;
|
||||
// Open file
|
||||
|
||||
@@ -389,17 +389,17 @@ String KeywordDatabase::expand(const String& text,
|
||||
part = part + param; // keep tags
|
||||
} else if (kw->parameters[j/2-1]->script) {
|
||||
// apply parameter script
|
||||
ctx.setVariable(_("input"), toScript(part));
|
||||
ctx.setVariable(_("input"), to_script(part));
|
||||
part = kw->parameters[j/2-1]->script.invoke(ctx)->toString();
|
||||
ctx.setVariable(_("input"), toScript(part));
|
||||
ctx.setVariable(_("input"), to_script(part));
|
||||
param = kw->parameters[j/2-1]->script.invoke(ctx)->toString();
|
||||
}
|
||||
ctx.setVariable(String(_("param")) << (int)(j/2), toScript(param));
|
||||
ctx.setVariable(String(_("param")) << (int)(j/2), to_script(param));
|
||||
}
|
||||
total += part;
|
||||
start = part_end;
|
||||
}
|
||||
ctx.setVariable(_("mode"), toScript(kw->mode));
|
||||
ctx.setVariable(_("mode"), to_script(kw->mode));
|
||||
|
||||
// Show reminder text?
|
||||
bool expand = expand_type == _('1');
|
||||
@@ -412,8 +412,8 @@ String KeywordDatabase::expand(const String& text,
|
||||
// Combine keyword & reminder with result
|
||||
if (expand) {
|
||||
String reminder = kw->reminder.invoke(ctx)->toString();
|
||||
ctx.setVariable(_("keyword"), toScript(total));
|
||||
ctx.setVariable(_("reminder"), toScript(reminder));
|
||||
ctx.setVariable(_("keyword"), to_script(total));
|
||||
ctx.setVariable(_("reminder"), to_script(reminder));
|
||||
result += _("<kw-"); result += expand_type; result += _(">");
|
||||
result += combine_script->eval(ctx)->toString();
|
||||
result += _("</kw-"); result += expand_type; result += _(">");
|
||||
|
||||
@@ -33,7 +33,7 @@ ColumnSettings::ColumnSettings()
|
||||
{}
|
||||
|
||||
// dummy for ColumnSettings reflection
|
||||
ScriptValueP toScript(const ColumnSettings&) { return script_nil; }
|
||||
ScriptValueP to_script(const ColumnSettings&) { return script_nil; }
|
||||
|
||||
IMPLEMENT_REFLECTION(ColumnSettings) {
|
||||
REFLECT(width);
|
||||
|
||||
Reference in New Issue
Block a user