X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d7463f75f9c170c29b4965d27dccf535ac32cfde..b271d60d6a009930d80092a8cb534a5df19fc99b:/utils/configtool/src/wxconfigtool.cpp diff --git a/utils/configtool/src/wxconfigtool.cpp b/utils/configtool/src/wxconfigtool.cpp index f667b1b632..60679df140 100644 --- a/utils/configtool/src/wxconfigtool.cpp +++ b/utils/configtool/src/wxconfigtool.cpp @@ -9,30 +9,32 @@ // Licence: ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#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" @@ -51,29 +53,28 @@ ctApp::ctApp() m_docManager = NULL; } -ctApp::~ctApp() -{ -} - bool ctApp::OnInit(void) { + +#if wxUSE_LOG wxLog::SetTimestamp(NULL); - +#endif // wxUSE_LOG + wxHelpProvider::Set(new wxSimpleHelpProvider); #if wxUSE_LIBPNG wxImage::AddHandler( new wxPNGHandler ); #endif - + #if wxUSE_LIBJPEG wxImage::AddHandler( new wxJPEGHandler ); #endif - + #if wxUSE_GIF wxImage::AddHandler( new wxGIFHandler ); #endif -#ifdef __WXMSW__ +#if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__) m_helpController = new wxCHMHelpController; m_helpControllerReference = new wxCHMHelpController; #else @@ -89,16 +90,18 @@ 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. - if ((m_appDir.Right(5).CmpNoCase("DEBUG") == 0) || - (m_appDir.Right(11).CmpNoCase("DEBUGSTABLE") == 0) || - (m_appDir.Right(7).CmpNoCase("RELEASE") == 0) || - (m_appDir.Right(13).CmpNoCase("RELEASESTABLE") == 0) || - (m_appDir.Right(10).CmpNoCase("RELEASEDEV") == 0) || - (m_appDir.Right(8).CmpNoCase("DEBUGDEV") == 0) + if ((m_appDir.Right(5).CmpNoCase(_T("DEBUG")) == 0) || + (m_appDir.Right(11).CmpNoCase(_T("DEBUGSTABLE")) == 0) || + (m_appDir.Right(7).CmpNoCase(_T("RELEASE")) == 0) || + (m_appDir.Right(13).CmpNoCase(_T("RELEASESTABLE")) == 0) || + (m_appDir.Right(10).CmpNoCase(_T("RELEASEDEV")) == 0) || + (m_appDir.Right(8).CmpNoCase(_T("DEBUGDEV")) == 0) ) m_appDir = wxPathOnly(m_appDir); #endif @@ -113,28 +116,28 @@ bool ctApp::OnInit(void) m_settings.Init(); LoadConfig(); - + wxString helpFilePathReference(GetFullAppPath(_("wx"))); m_helpControllerReference->Initialize(helpFilePathReference); - + 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); + wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN); SetTopWindow(frame); switch (wxGetApp().GetSettings().m_frameStatus) { case ctSHOW_STATUS_MAXIMIZED: { - frame->Maximize(TRUE); + frame->Maximize(true); break; } case ctSHOW_STATUS_MINIMIZED: { - frame->Iconize(TRUE); + frame->Iconize(true); break; } default: @@ -171,7 +174,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 { @@ -180,19 +183,19 @@ 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); - - return TRUE; + + GetTopWindow()->Show(true); + + return true; } int ctApp::OnExit(void) { SaveConfig(); - + // Save the file history { wxConfig config(wxGetApp().GetSettings().GetAppName(), wxT("Generic Organisation")); @@ -201,7 +204,7 @@ int ctApp::OnExit(void) delete m_docManager; m_docManager = NULL; - + return 0; } @@ -209,7 +212,7 @@ void ctApp::ClearHelpControllers() { delete m_helpController; m_helpController = NULL; - + delete m_helpControllerReference; m_helpControllerReference = NULL; } @@ -222,7 +225,7 @@ wxString ctApp::GetFullAppPath(const wxString& filename) const if (path.Last() != wxFILE_SEP_PATH && filename[0] != wxFILE_SEP_PATH) path += wxFILE_SEP_PATH; path += filename; - + return path; }