mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
check for stylesheet in import scripts
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
// ----------------------------------------------------------------------------- : WebRequestWindow
|
// ----------------------------------------------------------------------------- : WebRequestWindow
|
||||||
|
|
||||||
WebRequestWindow::WebRequestWindow(const String& url, bool sizer)
|
WebRequestWindow::WebRequestWindow(const String& url, bool sizer)
|
||||||
: wxDialog(wxTheApp->GetTopWindow(), wxID_ANY, _TITLE_("web request"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
: wxDialog(NULL, wxID_ANY, _TITLE_("web request"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxDIALOG_NO_PARENT)
|
||||||
{
|
{
|
||||||
// init controls
|
// init controls
|
||||||
info = new wxStaticText(this, -1, _LABEL_("web request address"));
|
info = new wxStaticText(this, -1, _LABEL_("web request address"));
|
||||||
|
|||||||
@@ -60,9 +60,18 @@ SCRIPT_FUNCTION(new_card) {
|
|||||||
ScriptValueP script_input = field->import_script.invoke(ctx, true);
|
ScriptValueP script_input = field->import_script.invoke(ctx, true);
|
||||||
// if the script result is a collection, iterate on the key/value pairs
|
// if the script result is a collection, iterate on the key/value pairs
|
||||||
// treat the keys as field names and the values as what to populate those fields with
|
// treat the keys as field names and the values as what to populate those fields with
|
||||||
if (script_input->type() == SCRIPT_COLLECTION) {
|
if (script_input->type() == SCRIPT_COLLECTION) {
|
||||||
|
// check for a stylesheet first, since other things depend on it
|
||||||
ScriptValueP script_it = script_input->makeIterator();
|
ScriptValueP script_it = script_input->makeIterator();
|
||||||
ScriptValueP script_key;
|
ScriptValueP script_key;
|
||||||
|
while (ScriptValueP script_value = script_it->next(&script_key)) {
|
||||||
|
assert(script_key);
|
||||||
|
if (script_key == script_nil) continue;
|
||||||
|
String script_key_name = script_key->toString();
|
||||||
|
if (set_stylesheet_container(*game, new_card, script_value, script_key_name, ignore_field_not_found)) break;
|
||||||
|
}
|
||||||
|
// iterate on the rest of the key/value pairs given by the script
|
||||||
|
script_it = script_input->makeIterator();
|
||||||
while (ScriptValueP script_value = script_it->next(&script_key)) {
|
while (ScriptValueP script_value = script_it->next(&script_key)) {
|
||||||
assert(script_key);
|
assert(script_key);
|
||||||
if (script_key == script_nil) continue;
|
if (script_key == script_nil) continue;
|
||||||
@@ -94,10 +103,18 @@ SCRIPT_FUNCTION(new_card) {
|
|||||||
ScriptValueP ctx_card = ctx.getVariableOpt(SCRIPT_VAR_card);
|
ScriptValueP ctx_card = ctx.getVariableOpt(SCRIPT_VAR_card);
|
||||||
ctx.setVariable(SCRIPT_VAR_card, to_script(new_card));
|
ctx.setVariable(SCRIPT_VAR_card, to_script(new_card));
|
||||||
ScriptValueP script_input = game->import_script.invoke(ctx, true);
|
ScriptValueP script_input = game->import_script.invoke(ctx, true);
|
||||||
if (script_input->type() == SCRIPT_COLLECTION) {
|
if (script_input->type() == SCRIPT_COLLECTION) {
|
||||||
// iterate on the key/value pairs given by the script
|
// check for a stylesheet first, since other things depend on it
|
||||||
ScriptValueP script_it = script_input->makeIterator();
|
ScriptValueP script_it = script_input->makeIterator();
|
||||||
ScriptValueP script_key;
|
ScriptValueP script_key;
|
||||||
|
while (ScriptValueP script_value = script_it->next(&script_key)) {
|
||||||
|
assert(script_key);
|
||||||
|
if (script_key == script_nil) continue;
|
||||||
|
String script_key_name = script_key->toString();
|
||||||
|
if (set_stylesheet_container(*game, new_card, script_value, script_key_name, ignore_field_not_found)) break;
|
||||||
|
}
|
||||||
|
// iterate on the rest of the key/value pairs given by the script
|
||||||
|
script_it = script_input->makeIterator();
|
||||||
while (ScriptValueP script_value = script_it->next(&script_key)) {
|
while (ScriptValueP script_value = script_it->next(&script_key)) {
|
||||||
assert(script_key);
|
assert(script_key);
|
||||||
if (script_key == script_nil) continue;
|
if (script_key == script_nil) continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user