From 12e59b887f6d8e387a1d9d01662822a44efae87a Mon Sep 17 00:00:00 2001 From: Gaspar Capello Date: Wed, 13 Jul 2022 18:11:46 -0300 Subject: [PATCH] Add remember new tilemap layer base index (fix #2735) --- data/pref.xml | 3 +++ src/app/commands/cmd_new_layer.cpp | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/data/pref.xml b/data/pref.xml index 67be99cb2..078db47ef 100644 --- a/data/pref.xml +++ b/data/pref.xml @@ -423,6 +423,9 @@
+
+
diff --git a/src/app/commands/cmd_new_layer.cpp b/src/app/commands/cmd_new_layer.cpp index 5bc9644d7..4b845aefc 100644 --- a/src/app/commands/cmd_new_layer.cpp +++ b/src/app/commands/cmd_new_layer.cpp @@ -24,6 +24,7 @@ #include "app/i18n/strings.h" #include "app/load_widget.h" #include "app/modules/gui.h" +#include "app/pref/preferences.h" #include "app/restore_visible_layers.h" #include "app/tx.h" #include "app/ui/main_window.h" @@ -208,6 +209,9 @@ void NewLayerCommand::onExecute(Context* context) #ifdef ENABLE_UI // If params specify to ask the user about the name... if (params().ask() && context->isUIAvailable()) { + auto& pref = Preferences::instance(); + tilesetInfo.baseIndex = pref.tileset.baseIndex(); + // We open the window to ask the name app::gen::NewLayer window; TilesetSelector* tilesetSelector = nullptr; @@ -227,6 +231,8 @@ void NewLayerCommand::onExecute(Context* context) if (window.closer() != window.ok()) return; + pref.tileset.baseIndex(tilesetSelector->getInfo().baseIndex); + name = window.name()->text(); if (tilesetSelector) tilesetInfo = tilesetSelector->getInfo();