Author Topic: bool cbEditor::SaveAs()  (Read 4600 times)

sethjackson

  • Guest
bool cbEditor::SaveAs()
« on: April 27, 2006, 07:34:22 pm »
Hi I have two small fixes to the bool cbEditor::SaveAs() function. :D

1. Wrong parent for the wxFileDialog.
2. Forgot to destroy it (allocated with new need to use wxWindow::Destroy()).  :wink:

Proposed patch is below. :D

Code: diff
Index: src/sdk/cbeditor.cpp
===================================================================
--- src/sdk/cbeditor.cpp (revision 2388)
+++ src/sdk/cbeditor.cpp (working copy)
@@ -882,12 +882,12 @@
 {
     wxFileName fname;
     fname.Assign(m_Filename);
-    wxFileDialog* dlg = new wxFileDialog(this,
-                            _("Save file"),
-                            fname.GetPath(),
-                            fname.GetFullName(),
-                            FileFilters::GetFilterString(),
-                            wxSAVE | wxOVERWRITE_PROMPT);
+    wxFileDialog* dlg = new wxFileDialog(Manager::Get()->GetAppWindow(),
+                                         _("Save file"),
+                                         fname.GetPath(),
+                                         fname.GetFullName(),
+                                         FileFilters::GetFilterString(),
+                                         wxSAVE | wxOVERWRITE_PROMPT);
 
     PlaceWindow(dlg);
     if (dlg->ShowModal() != wxID_OK)
@@ -901,6 +901,9 @@
     m_IsOK = true;
     SetModified(true);
     SetLanguage( HL_AUTO );
+
+    dlg->Destroy();
+
     return Save();
 }
 


EDIT:

Posted at BerliOS

https://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=1016&group_id=5358
« Last Edit: April 27, 2006, 07:38:32 pm by sethjackson »