From d94b2f688b2b82fd940b9d39bbf284411cebcfe0 Mon Sep 17 00:00:00 2001 From: twanvl Date: Sun, 18 May 2008 18:59:55 +0000 Subject: [PATCH] Fixed crash in TextCtrl; No longer ask to save set when it is still open in another window. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@862 0fc631ac-6414-0410-93d0-97cfa31319b6 --- src/gui/control/text_ctrl.cpp | 3 +++ src/gui/set/window.cpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/control/text_ctrl.cpp b/src/gui/control/text_ctrl.cpp index c2996e3b..8a3d1a9d 100644 --- a/src/gui/control/text_ctrl.cpp +++ b/src/gui/control/text_ctrl.cpp @@ -74,6 +74,7 @@ void TextCtrl::setValue(const FakeTextValueP& value) { } void TextCtrl::onChangeSet() { + wxLogDebug(_("TextCtrl::onChangeSet %p"),this); DataEditor::onChangeSet(); // initialize if (viewers.empty()) { @@ -109,6 +110,8 @@ void TextCtrl::onInit() { FOR_EACH_EDITOR { e->onShow(true); } + // also init the DataEditor + DataEditor::onInit(); } void TextCtrl::onSize(wxSizeEvent&) { diff --git a/src/gui/set/window.cpp b/src/gui/set/window.cpp index 07db14d7..fabe04b1 100644 --- a/src/gui/set/window.cpp +++ b/src/gui/set/window.cpp @@ -437,14 +437,14 @@ void SetWindow::updateRecentSets() { void SetWindow::onFileNew(wxCommandEvent&) { - if (!askSaveAndContinue()) return; + if (isOnlyWithSet() && !askSaveAndContinue()) return; // new set? SetP new_set = new_set_window(this); if (new_set) setSet(new_set); } void SetWindow::onFileOpen(wxCommandEvent&) { - if (!askSaveAndContinue()) return; + if (isOnlyWithSet() && !askSaveAndContinue()) return; wxFileDialog dlg(this, _TITLE_("open set"), _(""), _(""), import_formats(), wxOPEN); if (dlg.ShowModal() == wxID_OK) { wxBusyCursor busy;