]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/configtool/src/wxconfigtool.cpp
fixed memory leak in Submit(cmd, false) (bug 1037115)
[wxWidgets.git] / utils / configtool / src / wxconfigtool.cpp
index 65efe5bd5852630b91a3875d233ae3bb05b24e45..509039926c946ad109f6e6a16400db740adf7a5b 100644 (file)
 #pragma implementation "wxconfigtool.h"
 #endif
 
-#include "wx/wx.h"
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
 
 #ifdef __BORLANDC__
 #pragma hdrstop
 #endif
 
-#include "wx/config.h"
+#ifndef WX_PRECOMP
+
 #include "wx/laywin.h"
-#include "wx/image.h"
 #include "wx/menuitem.h"
 #include "wx/tooltip.h"
+#include "wx/variant.h"
+
+#endif
+
 #include "wx/cshelp.h"
 #include "wx/helphtml.h"
 #include "wx/html/htmprint.h"
 #include "wx/html/htmlwin.h"
+#include "wx/image.h"
 #include "wx/filesys.h"
 #include "wx/fs_mem.h"
 #include "wx/fs_zip.h"
 #include "wx/wfstream.h"
-#include "wx/variant.h"
-
+#include "wx/config.h"
 #include "wxconfigtool.h"
 #include "configtooldoc.h"
 #include "configtoolview.h"
@@ -58,7 +63,10 @@ ctApp::~ctApp()
 
 bool ctApp::OnInit(void)
 {
+
+#if wxUSE_LOG
     wxLog::SetTimestamp(NULL);
+#endif // wxUSE_LOG
     
     wxHelpProvider::Set(new wxSimpleHelpProvider);
 
@@ -90,7 +98,9 @@ bool ctApp::OnInit(void)
     wxString currentDir = wxGetCwd();
 
     // Use argv to get current app directory
-    m_appDir = apFindAppPath(argv[0], currentDir, wxT("WXCONFIGTOOLDIR"));
+    wxString argv0(argv[0]);
+    wxString appVariableName(wxT("WXCONFIGTOOLDIR"));
+    m_appDir = apFindAppPath(argv0, currentDir, appVariableName);
 
 #ifdef __WXMSW__
     // If the development version, go up a directory.
@@ -121,7 +131,7 @@ bool ctApp::OnInit(void)
     wxString helpFilePath(GetFullAppPath(_("configtool")));
     m_helpController->Initialize(helpFilePath);
     
-    ctMainFrame* frame = new ctMainFrame(m_docManager, NULL, -1, wxGetApp().GetSettings().GetAppName(),
+    ctMainFrame* frame = new ctMainFrame(m_docManager, NULL, wxID_ANY, wxGetApp().GetSettings().GetAppName(),
         GetSettings().m_frameSize.GetPosition(), GetSettings().m_frameSize.GetSize(),
         wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN);
     SetTopWindow(frame);
@@ -130,12 +140,12 @@ bool ctApp::OnInit(void)
     {
     case ctSHOW_STATUS_MAXIMIZED:
         {
-            frame->Maximize(TRUE);
+            frame->Maximize(true);
             break;
         }
     case ctSHOW_STATUS_MINIMIZED:
         {
-            frame->Iconize(TRUE);
+            frame->Iconize(true);
             break;
         }
     default:
@@ -172,7 +182,7 @@ bool ctApp::OnInit(void)
         // Load the file
         wxDocument* doc = m_docManager->CreateDocument(arg, wxDOC_SILENT);
         if (doc)
-            doc->SetDocumentSaved(TRUE);
+            doc->SetDocumentSaved(true);
     }
     else
     {
@@ -181,13 +191,13 @@ bool ctApp::OnInit(void)
             // Load the file that was last loaded
             wxDocument* doc = m_docManager->CreateDocument(GetSettings().m_lastFilename, wxDOC_SILENT);
             if (doc)
-                doc->SetDocumentSaved(TRUE);
+                doc->SetDocumentSaved(true);
         }
     }
     
-    GetTopWindow()->Show(TRUE);
+    GetTopWindow()->Show(true);
     
-    return TRUE;
+    return true;
 }
 
 int ctApp::OnExit(void)