X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f8105809ef8f7cb0d1a9933f3f790b7b446c7cfa..3a39df31ff47004a46cfb06f3fb2d3e317f96d2b:/utils/configtool/src/appsettings.cpp diff --git a/utils/configtool/src/appsettings.cpp b/utils/configtool/src/appsettings.cpp index 41cbfccc05..0016aa669d 100644 --- a/utils/configtool/src/appsettings.cpp +++ b/utils/configtool/src/appsettings.cpp @@ -6,35 +6,37 @@ // Created: 2002-09-04 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: +// Licence: ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "appsettings.h" #endif -#include "wx/wx.h" +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP -#include "wx/wx.h" -#endif -#include "wx/wfstream.h" #include "wx/datstrm.h" -#include "wx/config.h" -#include "wx/fileconf.h" #include "wx/dir.h" -#include "wx/valgen.h" #include "wx/colordlg.h" #include "wx/wxhtml.h" #include "wx/effects.h" #include "wx/spinctrl.h" #include "wx/tooltip.h" +#include "wx/settings.h" + +#endif +#include "wx/wfstream.h" +#include "wx/config.h" +#include "wx/fileconf.h" +#include "wx/valgen.h" #include "utils.h" #include "wxconfigtool.h" #include "appsettings.h" @@ -51,41 +53,40 @@ IMPLEMENT_DYNAMIC_CLASS(ctSettings, wxObject) ctSettings::ctSettings() { m_noUses = 0; - m_showToolBar = TRUE; - m_showWelcomeDialog = TRUE; + m_showToolBar = true; + m_showWelcomeDialog = true; m_exportDir = wxEmptyString; m_frameSize = wxRect(10, 10, 600, 500); // m_backgroundColour = wxColour(140, 172, 179); // blue-grey - m_editWindowFont = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT); + m_editWindowFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); - m_appName = wxT("wxWindows Configuration Tool"); + m_appName = wxT("wxWidgets Configuration Tool"); m_appNameShort = wxT("Configuration Tool"); - m_showSplashScreen = FALSE; + m_showSplashScreen = false; m_userName = wxEmptyString; m_frameStatus = ctSHOW_STATUS_NORMAL; - m_loadLastDocument = TRUE; - m_firstTimeRun = TRUE; - m_smallToolbar = TRUE; + m_loadLastDocument = true; + m_firstTimeRun = true; + m_smallToolbar = true; m_mainSashSize = 200; - m_useToolTips = TRUE; - m_showTrayIcon = TRUE; - m_trayIconIsShown = FALSE; - m_useEnvironmentVariable = TRUE; + m_useToolTips = true; + m_showTrayIcon = true; + m_trayIconIsShown = false; + m_useEnvironmentVariable = true; m_frameworkDir = wxEmptyString; + m_matchWholeWord = false; + m_matchCase = false; + m_defaultFileKind = wxT("Setup file"); } // Copy constructor -ctSettings::ctSettings(const ctSettings& settings) +ctSettings::ctSettings(const ctSettings& settings) : wxObject() { Copy(settings); } -ctSettings::~ctSettings() -{ -} - void ctSettings::operator = (const ctSettings& settings) { Copy(settings); @@ -93,7 +94,7 @@ void ctSettings::operator = (const ctSettings& settings) void ctSettings::Copy (const ctSettings& settings) { - m_currentDocumentDir = settings.m_currentDocumentDir; + m_lastSetupSaveDir = settings.m_lastSetupSaveDir; m_lastDocument = settings.m_lastDocument; m_showToolBar = settings.m_showToolBar; m_frameSize = settings.m_frameSize; @@ -114,23 +115,26 @@ void ctSettings::Copy (const ctSettings& settings) m_useEnvironmentVariable = settings.m_useEnvironmentVariable; m_frameworkDir = settings.m_frameworkDir; + m_matchWholeWord = settings.m_matchWholeWord; + m_matchCase = settings.m_matchCase; + m_defaultFileKind = settings.m_defaultFileKind ; } // Do some initialisation within stApp::OnInit bool ctSettings::Init() { - m_currentDocumentDir = wxEmptyString; - if (m_userName.IsEmpty()) + m_lastSetupSaveDir = wxEmptyString; + if (m_userName.empty()) m_userName = wxGetUserName(); - return TRUE; + return true; } // Create new filename wxString ctSettings::GenerateFilename(const wxString& rootName) { wxString path; - if (!m_lastFilename.IsEmpty()) + if (!m_lastFilename.empty()) path = wxPathOnly(m_lastFilename); else path = wxGetApp().GetAppDir(); @@ -146,7 +150,7 @@ wxString ctSettings::GenerateFilename(const wxString& rootName) while (wxFileExists(fullFilename)) { i ++; - postfixStr.Printf("%d", i); + postfixStr.Printf(_T("%d"), i); fullFilename = filename + postfixStr + wxT(".wxs"); } @@ -157,10 +161,10 @@ wxString ctSettings::GenerateFilename(const wxString& rootName) // Load config info bool ctSettings::LoadConfig() { - wxConfig config(wxGetApp().GetSettings().GetAppName(), wxT("wxWindows")); + wxConfig config(wxGetApp().GetSettings().GetAppName(), wxT("wxWidgets")); config.Read(wxT("Files/LastFile"), & m_lastFilename); - config.Read(wxT("Files/DocumentDir"), & m_currentDocumentDir); + config.Read(wxT("Files/LastSetupSaveDir"), & m_lastSetupSaveDir); config.Read(wxT("Files/ExportDir"), & m_exportDir); config.Read(wxT("Files/FrameworkDir"), & m_frameworkDir); config.Read(wxT("Files/UseEnvironmentVariable"), (bool*) & m_useEnvironmentVariable); @@ -173,6 +177,9 @@ bool ctSettings::LoadConfig() config.Read(wxT("Misc/ShowWelcomeDialog"), (bool*) & m_showWelcomeDialog); config.Read(wxT("Misc/Ran"), & m_noUses); config.Read(wxT("Misc/ShowTrayIcon"), (bool*) & m_showTrayIcon); + config.Read(wxT("Misc/MatchWholeWord"), (bool*) & m_matchWholeWord); + config.Read(wxT("Misc/MatchCase"), (bool*) & m_matchCase); + config.Read(wxT("Misc/BuildMode"), & m_defaultFileKind ); m_noUses ++; @@ -190,7 +197,7 @@ bool ctSettings::LoadConfig() fontSpec = wxEmptyString; config.Read(wxT("Style/EditWindowFont"), & fontSpec); - if (!fontSpec.IsEmpty()) + if (!fontSpec.empty()) m_editWindowFont = apStringToFont(fontSpec); // Crash-resistance @@ -203,22 +210,22 @@ bool ctSettings::LoadConfig() // facility just in case it's trying to load a damaged file. if (runningProgram != 0) { - m_loadLastDocument = FALSE; + m_loadLastDocument = false; } #endif config.Write(wxT("Misc/RunningProgram"), (long) 1); - return TRUE; + return true; } // Save config info bool ctSettings::SaveConfig() { - wxConfig config(wxGetApp().GetSettings().GetAppName(), wxT("wxWindows")); + wxConfig config(wxGetApp().GetSettings().GetAppName(), wxT("wxWidgets")); config.Write(wxT("Files/LastFile"), m_lastFilename); - config.Write(wxT("Files/DocumentDir"), m_currentDocumentDir); + config.Write(wxT("Files/LastSetupSaveDir"), m_lastSetupSaveDir); config.Write(wxT("Files/ExportDir"), m_exportDir); config.Write(wxT("Files/FrameworkDir"), m_frameworkDir); config.Write(wxT("Files/UseEnvironmentVariable"), m_useEnvironmentVariable); @@ -231,6 +238,9 @@ bool ctSettings::SaveConfig() config.Write(wxT("Misc/ShowWelcomeDialog"), (long) m_showWelcomeDialog); config.Write(wxT("Misc/Ran"), m_noUses); config.Write(wxT("Misc/ShowTrayIcon"), (long) m_showTrayIcon); + config.Write(wxT("Misc/MatchWholeWord"), (long) m_matchWholeWord); + config.Write(wxT("Misc/MatchCase"), (long) m_matchCase); + config.Write(wxT("Misc/BuildMode"), m_defaultFileKind); config.Write(wxT("Windows/ShowToolBar"), m_showToolBar); config.Write(wxT("Windows/WindowX"), (long) m_frameSize.x); @@ -252,16 +262,16 @@ bool ctSettings::SaveConfig() // Indicate that we're no longer running, so we know if the program // crashed last time around. config.Write(wxT("Misc/RunningProgram"), (long) 0); - + { config.SetPath(wxT("FileHistory/")); wxGetApp().GetDocManager()->FileHistorySave(config); } - return TRUE; + return true; } -void ctSettings::ShowSettingsDialog(const wxString& page) +void ctSettings::ShowSettingsDialog(const wxString& WXUNUSED(page)) { ctSettingsDialog* dialog = new ctSettingsDialog(wxGetApp().GetTopWindow()); // if (!page.IsEmpty())