diff --git a/src/Editor/CStartWindow.cpp b/src/Editor/CStartWindow.cpp index 6c5c7305..4dbb364c 100644 --- a/src/Editor/CStartWindow.cpp +++ b/src/Editor/CStartWindow.cpp @@ -28,24 +28,29 @@ CStartWindow::~CStartWindow() delete mpModelEditor; } +void CStartWindow::closeEvent(QCloseEvent *pEvent) +{ + if (mpWorldEditor->close()) + qApp->quit(); + else + pEvent->ignore(); +} + void CStartWindow::on_actionOpen_MLVL_triggered() { QString WorldFile = QFileDialog::getOpenFileName(this, "Open MLVL", "", "Metroid Prime World (*.MLVL)"); if (WorldFile.isEmpty()) return; - if (mpWorldEditor->CheckUnsavedChanges()) + if (mpWorldEditor->close()) { gResCache.SetFolder(TString(WorldFile.toStdString()).GetFileDirectory()); mpWorld = gResCache.GetResource(WorldFile.toStdString()); - mpWorldEditor->close(); - FillWorldUI(); } } void CStartWindow::FillWorldUI() { - CStringTable *pWorldName = mpWorld->GetWorldName(); if (pWorldName) { diff --git a/src/Editor/CStartWindow.h b/src/Editor/CStartWindow.h index 07a9c5cb..8b84a786 100644 --- a/src/Editor/CStartWindow.h +++ b/src/Editor/CStartWindow.h @@ -26,6 +26,7 @@ class CStartWindow : public QMainWindow public: explicit CStartWindow(QWidget *parent = 0); ~CStartWindow(); + void closeEvent(QCloseEvent *pEvent); private slots: void on_actionOpen_MLVL_triggered(); diff --git a/src/Editor/WorldEditor/CWorldEditor.cpp b/src/Editor/WorldEditor/CWorldEditor.cpp index e4cc958a..25fe9c56 100644 --- a/src/Editor/WorldEditor/CWorldEditor.cpp +++ b/src/Editor/WorldEditor/CWorldEditor.cpp @@ -93,6 +93,8 @@ void CWorldEditor::closeEvent(QCloseEvent *pEvent) if (ShouldClose) { + mUndoStack.clear(); + if (mpPoiDialog) mpPoiDialog->close(); } diff --git a/templates/dkcr/Properties.xml b/templates/dkcr/Properties.xml index b4579003..cb819e57 100644 --- a/templates/dkcr/Properties.xml +++ b/templates/dkcr/Properties.xml @@ -480,7 +480,7 @@ - + diff --git a/templates/mp1/Structs/LightParameters.xml b/templates/mp1/Structs/LightParameters.xml index 6bd1db11..8f607f8c 100644 --- a/templates/mp1/Structs/LightParameters.xml +++ b/templates/mp1/Structs/LightParameters.xml @@ -21,6 +21,6 @@ - + diff --git a/templates/mp2/Properties.xml b/templates/mp2/Properties.xml index 42f14f55..02d2aace 100644 --- a/templates/mp2/Properties.xml +++ b/templates/mp2/Properties.xml @@ -864,8 +864,8 @@ - - + + diff --git a/templates/mp2demo/Properties.xml b/templates/mp2demo/Properties.xml index 7ebc5e36..24c5d6f3 100644 --- a/templates/mp2demo/Properties.xml +++ b/templates/mp2demo/Properties.xml @@ -794,7 +794,7 @@ - + diff --git a/templates/mp3/Properties.xml b/templates/mp3/Properties.xml index 9a99c110..08a01ba1 100644 --- a/templates/mp3/Properties.xml +++ b/templates/mp3/Properties.xml @@ -682,8 +682,8 @@ - - + + diff --git a/templates/mp3proto/Properties.xml b/templates/mp3proto/Properties.xml index 1d46013e..efbc1c0e 100644 --- a/templates/mp3proto/Properties.xml +++ b/templates/mp3proto/Properties.xml @@ -258,7 +258,7 @@ - +