From 217a3c51c6b2ab7e40460bde5ff2637ef06a245a Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 28 May 2015 20:19:35 -0300 Subject: [PATCH] Fix invalid behavior when ImportSpriteSheet's "Import" button is pressed without a document --- src/app/commands/cmd_import_sprite_sheet.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/app/commands/cmd_import_sprite_sheet.cpp b/src/app/commands/cmd_import_sprite_sheet.cpp index a3af3a663..d9165d099 100644 --- a/src/app/commands/cmd_import_sprite_sheet.cpp +++ b/src/app/commands/cmd_import_sprite_sheet.cpp @@ -52,6 +52,8 @@ public: , m_editor(NULL) , m_fileOpened(false) , m_docPref(nullptr) { + import()->setEnabled(false); + x()->EntryChange.connect(Bind(&ImportSpriteSheetWindow::onEntriesChange, this)); y()->EntryChange.connect(Bind(&ImportSpriteSheetWindow::onEntriesChange, this)); width()->EntryChange.connect(Bind(&ImportSpriteSheetWindow::onEntriesChange, this)); @@ -180,6 +182,8 @@ private: captureEditor(); + import()->setEnabled(m_document ? true: false); + if (m_document) { m_docPref = &Preferences::instance().document(m_document); @@ -241,7 +245,6 @@ void ImportSpriteSheetCommand::onExecute(Context* context) { ImportSpriteSheetWindow window(context); -retry:; window.openWindowInForeground(); if (!window.ok()) return; @@ -250,11 +253,9 @@ retry:; DocumentPreferences* docPref = window.docPref(); gfx::Rect frameBounds = window.frameBounds(); - // The user don't select a sheet yet. - if (!document) { - Alert::show("Import Sprite Sheet<