diff --git a/src/app/commands/cmd_export_sprite_sheet.cpp b/src/app/commands/cmd_export_sprite_sheet.cpp index 72b12242f..e9e34171d 100644 --- a/src/app/commands/cmd_export_sprite_sheet.cpp +++ b/src/app/commands/cmd_export_sprite_sheet.cpp @@ -787,6 +787,15 @@ void ExportSpriteSheetCommand::onExecute(Context* context) if (statusbar) statusbar->showTip(1000, "Sprite Sheet Generated"); + // Copy background and grid preferences + { + DocumentPreferences& newDocPref(Preferences::instance().document(newDocument)); + newDocPref.bg = docPref.bg; + newDocPref.grid = docPref.grid; + newDocPref.pixelGrid = docPref.pixelGrid; + Preferences::instance().removeDocument(newDocument); + } + if (docPref.spriteSheet.openGenerated()) { newDocument->setContext(context); newDocument.release(); diff --git a/src/app/pref/preferences.cpp b/src/app/pref/preferences.cpp index c7c1e81a0..1d992a7df 100644 --- a/src/app/pref/preferences.cpp +++ b/src/app/pref/preferences.cpp @@ -113,7 +113,7 @@ DocumentPreferences& Preferences::document(const app::Document* document) } } -void Preferences::onRemoveDocument(doc::Document* doc) +void Preferences::removeDocument(doc::Document* doc) { ASSERT(dynamic_cast(doc)); @@ -125,6 +125,11 @@ void Preferences::onRemoveDocument(doc::Document* doc) } } +void Preferences::onRemoveDocument(doc::Document* doc) +{ + removeDocument(doc); +} + std::string Preferences::docConfigFileName(const app::Document* doc) { if (!doc) diff --git a/src/app/pref/preferences.h b/src/app/pref/preferences.h index 5cd281fcf..8bbedf0b0 100644 --- a/src/app/pref/preferences.h +++ b/src/app/pref/preferences.h @@ -55,6 +55,11 @@ namespace app { ToolPreferences& tool(tools::Tool* tool); DocumentPreferences& document(const app::Document* doc); + // Remove one document explicitly (this can be used if the + // document used in Preferences::document() function wasn't member + // of UIContext. + void removeDocument(doc::Document* doc); + protected: void onRemoveDocument(doc::Document* doc) override;