minor changes and bug corrections (interface unchanged)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@423 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1998-08-03 22:49:01 +00:00
parent 0be4095abb
commit 275bf4c13a
5 changed files with 54 additions and 42 deletions

View File

@@ -39,7 +39,7 @@
#include <wx/config.h>
// we must include (one of) these files for wxConfigBase::Create
#if defined(__MSWIN__) && defined(wxCONFIG_WIN32_NATIVE)
#if defined(__WXMSW__) && defined(wxCONFIG_WIN32_NATIVE)
#ifdef __WIN32__
#include <wx/msw/regconf.h>
#else //WIN16
@@ -56,7 +56,8 @@
// global and class static variables
// ----------------------------------------------------------------------------
wxConfigBase *wxConfigBase::ms_pConfig = NULL;
wxConfigBase *wxConfigBase::ms_pConfig = NULL;
bool wxConfigBase::ms_bAutoCreate = TRUE;
// ============================================================================
// implementation
@@ -75,17 +76,21 @@ wxConfigBase *wxConfigBase::Set(wxConfigBase *pConfig)
wxConfigBase *wxConfigBase::Create()
{
return ms_pConfig =
#if defined(__MSWIN__) && defined(wxCONFIG_WIN32_NATIVE)
#ifdef __WIN32__
new wxRegConfig(wxTheApp->GetAppName(), wxTheApp->GetVendorName());
#else //WIN16
#error "Sorry, no wxIniConfig yet..."
//new wxIniConfig(wxTheApp->GetAppName(), wxTheApp->GetVendorName());
if ( ms_bAutoCreate && ms_pConfig == NULL ) {
ms_pConfig =
#if defined(__WXMSW__) && defined(wxCONFIG_WIN32_NATIVE)
#ifdef __WIN32__
new wxRegConfig(wxTheApp->GetVendorName() + '\\'
+ wxTheApp->GetAppName());
#else //WIN16
new wxIniConfig(wxTheApp->GetAppName(), wxTheApp->GetVendorName());
#endif
#else // either we're under Unix or wish to use files even under Windows
new wxFileConfig(wxTheApp->GetAppName());
#endif
#else // either we're under Unix or wish to use files even under Windows
new wxFileConfig(wxTheApp->GetAppName());
#endif
}
return ms_pConfig;
}
const char *wxConfigBase::Read(const char *szKey, const char *szDefault) const

View File

@@ -124,7 +124,7 @@ wxString wxFileConfig::GetLocalDir()
strDir << szHome;
#else // Win16
// Win16 has no idea about home, so use the current directory instead
strDir = ".\\";
strDir = ".\\";
#endif // WIN16/32
#endif // UNIX/Win
@@ -222,16 +222,13 @@ wxFileConfig::wxFileConfig(const wxString& strLocal, const wxString& strGlobal)
// if the path is not absolute, prepend the standard directory to it
if ( !strLocal.IsEmpty() && !wxIsPathSeparator(strLocal[0u]) )
{
m_strLocalFile = GetLocalDir();
m_strLocalFile << strLocal;
}
m_strLocalFile = GetLocalDir();
m_strLocalFile << strLocal;
if ( !strGlobal.IsEmpty() && !wxIsPathSeparator(strGlobal[0u]) )
{
m_strGlobalFile = GetGlobalDir();
m_strGlobalFile << strGlobal;
}
m_strGlobalFile = GetGlobalDir();
m_strGlobalFile << strGlobal;
Init();
}
@@ -671,9 +668,6 @@ bool wxFileConfig::DeleteAll()
{
CleanUp();
m_strLocalFile = m_strGlobalFile = "";
Init();
const char *szFile = m_strLocalFile;
if ( remove(szFile) == -1 )
@@ -683,6 +677,9 @@ bool wxFileConfig::DeleteAll()
if ( remove(szFile) )
wxLogSysError(_("can't delete system configuration file '%s'"), szFile);
m_strLocalFile = m_strGlobalFile = "";
Init();
return TRUE;
}

View File

@@ -216,19 +216,22 @@ wxLog::wxLog()
wxLog *wxLog::GetActiveTarget()
{
if ( !ms_bInitialized ) {
if ( ms_bAutoCreate && ms_pLogger == NULL ) {
// prevent infinite recursion if someone calls wxLogXXX() from
// wxApp::CreateLogTarget()
ms_bInitialized = TRUE;
static bool s_bInGetActiveTarget = FALSE;
if ( !s_bInGetActiveTarget ) {
s_bInGetActiveTarget = TRUE;
#ifdef WX_TEST_MINIMAL
ms_pLogger = new wxLogStderr;
#else
// ask the application to create a log target for us
ms_pLogger = wxTheApp->CreateLogTarget();
#endif
#ifdef WX_TEST_MINIMAL
ms_pLogger = new wxLogStderr;
#else
// ask the application to create a log target for us
ms_pLogger = wxTheApp->CreateLogTarget();
#endif
// do nothing if it fails - what can we do?
// do nothing if it fails - what can we do?
}
}
return ms_pLogger;
@@ -240,8 +243,6 @@ wxLog *wxLog::SetActiveTarget(wxLog *pLogger)
if ( ms_pLogger != NULL )
ms_pLogger->Flush();
ms_bInitialized = TRUE;
wxLog *pOldLogger = ms_pLogger;
ms_pLogger = pLogger;
return pOldLogger;
@@ -705,7 +706,7 @@ wxLogWindow::~wxLogWindow()
// static variables
// ----------------------------------------------------------------------------
wxLog *wxLog::ms_pLogger = NULL;
bool wxLog::ms_bInitialized = FALSE;
bool wxLog::ms_bAutoCreate = TRUE;
wxTraceMask wxLog::ms_ulTraceMask = (wxTraceMask)0;
// ----------------------------------------------------------------------------