From 2a1f999fafa4312ccd47b7be65c672c2220fea36 Mon Sep 17 00:00:00 2001
From: Julian Smart <julian@anthemion.co.uk>
Date: Wed, 30 Mar 2005 16:49:41 +0000
Subject: [PATCH] Applied patch [ 1171542 ] access static class members via
 scoping operator Paul Cornett: A static class member can be accessed as
 X::member, there is no need for an object or pointer (s.member or p->member).
 There are also a few bugs with incorrect usage of wxString::Format and
 wxString::FromAscii.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33188 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 distrib/msw/mac.rsp           |  6 ++++++
 samples/font/font.cpp         |  2 +-
 samples/grid/griddemo.cpp     |  4 ++--
 samples/typetest/typetest.cpp |  2 +-
 src/common/fontcmn.cpp        |  2 +-
 src/common/log.cpp            |  3 +--
 src/common/zstream.cpp        |  4 ++--
 src/mac/carbon/toplevel.cpp   | 18 +++++++++---------
 src/mac/carbon/window.cpp     |  6 +++---
 src/msw/datectrl.cpp          |  4 ++--
 src/msw/dialup.cpp            |  2 +-
 src/msw/listctrl.cpp          |  4 ++--
 src/msw/spinbutt.cpp          |  2 +-
 src/msw/tbar95.cpp            | 12 ++++++------
 src/msw/tooltip.cpp           |  2 +-
 src/msw/treectrl.cpp          |  2 +-
 src/msw/uxtheme.cpp           |  2 +-
 17 files changed, 41 insertions(+), 36 deletions(-)

diff --git a/distrib/msw/mac.rsp b/distrib/msw/mac.rsp
index 3c74a87370..6208be8092 100644
--- a/distrib/msw/mac.rsp
+++ b/distrib/msw/mac.rsp
@@ -7,6 +7,12 @@ docs/mac/*.sh
 docs/mac/*.applescript
 docs/mac/*.diff
 
+docs/metrowerks/*.txt
+docs/metrowerks/*.sh
+docs/metrowerks/mwar
+docs/metrowerks/mwpefar
+docs/metrowerks/wchar_t_panther_fix/machine/ansi.h
+
 distrib/mac/*-sh
 
 src/html/htmlctrl/webkit/*.mm
diff --git a/samples/font/font.cpp b/samples/font/font.cpp
index 425f0a5fe3..5e2f27962e 100644
--- a/samples/font/font.cpp
+++ b/samples/font/font.cpp
@@ -741,7 +741,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
     fontInfo.Printf(wxT("Font size is %d points, family: %s, encoding: %s"),
                     m_font.GetPointSize(),
                     m_font.GetFamilyString().c_str(),
-                    wxFontMapper::Get()->
+                    wxFontMapper::
                         GetEncodingDescription(m_font.GetEncoding()).c_str());
 
     dc.DrawText(fontInfo, x, y);
diff --git a/samples/grid/griddemo.cpp b/samples/grid/griddemo.cpp
index 9464900565..0fec752751 100644
--- a/samples/grid/griddemo.cpp
+++ b/samples/grid/griddemo.cpp
@@ -246,8 +246,8 @@ GridFrame::GridFrame()
                              wxTE_MULTILINE );
 
     logger = new wxLogTextCtrl( logWin );
-    m_logOld = logger->SetActiveTarget( logger );
-    logger->SetTimestamp( NULL );
+    m_logOld = wxLog::SetActiveTarget( logger );
+    wxLog::SetTimestamp( NULL );
 #endif // wxUSE_LOG
 
     // this will create a grid and, by default, an associated grid
diff --git a/samples/typetest/typetest.cpp b/samples/typetest/typetest.cpp
index 49aaa75753..38133d498f 100644
--- a/samples/typetest/typetest.cpp
+++ b/samples/typetest/typetest.cpp
@@ -189,7 +189,7 @@ void MyApp::DoStreamDemo(wxCommandEvent& WXUNUSED(event))
 
     char std_buf[200];
     std_file_input >> std_buf;
-    str.FromAscii(std_buf);
+    str = wxString::FromAscii(std_buf);
     tmp.Printf( _T("String: %s\n"), str.c_str() );
     textCtrl.WriteText( tmp );
 
diff --git a/src/common/fontcmn.cpp b/src/common/fontcmn.cpp
index c4416f5bec..2c0415e7e9 100644
--- a/src/common/fontcmn.cpp
+++ b/src/common/fontcmn.cpp
@@ -602,7 +602,7 @@ wxString wxNativeFontInfo::ToUserString() const
     wxFontEncoding enc = GetEncoding();
     if ( enc != wxFONTENCODING_DEFAULT && enc != wxFONTENCODING_SYSTEM )
     {
-        desc << _T(' ') << wxFontMapper::Get()->GetEncodingName(enc);
+        desc << _T(' ') << wxFontMapper::GetEncodingName(enc);
     }
 #endif // wxUSE_FONTMAP
 
diff --git a/src/common/log.cpp b/src/common/log.cpp
index 98256b16e0..37143c97c4 100644
--- a/src/common/log.cpp
+++ b/src/common/log.cpp
@@ -209,8 +209,7 @@ void wxLogFatalError(const wxChar *szFormat, ...)
 void wxVLogVerbose(const wxChar *szFormat, va_list argptr)
 {
     if ( IsLoggingEnabled() ) {
-        wxLog *pLog = wxLog::GetActiveTarget();
-        if ( pLog != NULL && pLog->GetVerbose() ) {
+        if ( wxLog::GetActiveTarget() != NULL && wxLog::GetVerbose() ) {
             wxCRIT_SECT_LOCKER(locker, gs_csLogBuf);
 
             wxVsnprintf(s_szBuf, s_szBufSize, szFormat, argptr);
diff --git a/src/common/zstream.cpp b/src/common/zstream.cpp
index 7afa0548ff..8280bfbc0e 100644
--- a/src/common/zstream.cpp
+++ b/src/common/zstream.cpp
@@ -162,7 +162,7 @@ size_t wxZlibInputStream::OnSysRead(void *buffer, size_t size)
     default:
       wxString msg(m_inflate->msg, *wxConvCurrent);
       if (!msg)
-        msg.Format(_("zlib error %d"), err);
+        msg = wxString::Format(_("zlib error %d"), err);
       wxLogError(_("Can't read from inflate stream: %s"), msg.c_str());
       m_lasterror = wxSTREAM_READ_ERROR;
   }
@@ -312,7 +312,7 @@ size_t wxZlibOutputStream::OnSysWrite(const void *buffer, size_t size)
     m_lasterror = wxSTREAM_WRITE_ERROR;
     wxString msg(m_deflate->msg, *wxConvCurrent);
     if (!msg)
-      msg.Format(_("zlib error %d"), err);
+      msg = wxString::Format(_("zlib error %d"), err);
     wxLogError(_("Can't write to deflate stream: %s"), msg.c_str());
   }
 
diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp
index 8d72ff0208..32b4831f14 100644
--- a/src/mac/carbon/toplevel.cpp
+++ b/src/mac/carbon/toplevel.cpp
@@ -242,31 +242,31 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
                 event.SetTimestamp(when);
                 event.SetEventObject(focus);
 
-                if ( focus && (modifiers ^ wxTheApp->s_lastModifiers ) & controlKey )
+                if ( focus && (modifiers ^ wxApp::s_lastModifiers ) & controlKey )
                 {
                     event.m_keyCode = WXK_CONTROL ;
                     event.SetEventType( ( modifiers & controlKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
                     focus->GetEventHandler()->ProcessEvent( event ) ;
                 }
-                if ( focus && (modifiers ^ wxTheApp->s_lastModifiers ) & shiftKey )
+                if ( focus && (modifiers ^ wxApp::s_lastModifiers ) & shiftKey )
                 {
                     event.m_keyCode = WXK_SHIFT ;
                     event.SetEventType( ( modifiers & shiftKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
                     focus->GetEventHandler()->ProcessEvent( event ) ;
                 }
-                if ( focus && (modifiers ^ wxTheApp->s_lastModifiers ) & optionKey )
+                if ( focus && (modifiers ^ wxApp::s_lastModifiers ) & optionKey )
                 {
                     event.m_keyCode = WXK_ALT ;
                     event.SetEventType( ( modifiers & optionKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
                     focus->GetEventHandler()->ProcessEvent( event ) ;
                 }
-                if ( focus && (modifiers ^ wxTheApp->s_lastModifiers ) & cmdKey )
+                if ( focus && (modifiers ^ wxApp::s_lastModifiers ) & cmdKey )
                 {
                     event.m_keyCode = WXK_COMMAND ;
                     event.SetEventType( ( modifiers & cmdKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
                     focus->GetEventHandler()->ProcessEvent( event ) ;
                 }
-                wxTheApp->s_lastModifiers = modifiers ;
+                wxApp::s_lastModifiers = modifiers ;
             }
              break ;
     }
@@ -464,9 +464,9 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev
     {
         QDGlobalToLocalPoint( UMAGetWindowPort(window ) ,  &windowMouseLocation ) ;
 
-        if ( wxTheApp->s_captureWindow && wxTheApp->s_captureWindow->MacGetTopLevelWindowRef() == (WXWindow) window && windowPart == inContent )
+        if ( wxApp::s_captureWindow && wxApp::s_captureWindow->MacGetTopLevelWindowRef() == (WXWindow) window && windowPart == inContent )
         {
-            currentMouseWindow = wxTheApp->s_captureWindow ;
+            currentMouseWindow = wxApp::s_captureWindow ;
         }
         else if ( (IsWindowActive(window) && windowPart == inContent) )
         {
@@ -601,9 +601,9 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev
                 result = noErr ;
             }
         }
-        if ( cEvent.GetKind() == kEventMouseUp && wxTheApp->s_captureWindow )
+        if ( cEvent.GetKind() == kEventMouseUp && wxApp::s_captureWindow )
         {
-            wxTheApp->s_captureWindow = NULL ;
+            wxApp::s_captureWindow = NULL ;
             // update cursor ?
          }
 
diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp
index 625eabb20d..6230cb10d3 100644
--- a/src/mac/carbon/window.cpp
+++ b/src/mac/carbon/window.cpp
@@ -1115,17 +1115,17 @@ void wxWindowMac::SetFocus()
 
 void wxWindowMac::DoCaptureMouse()
 {
-    wxTheApp->s_captureWindow = this ;
+    wxApp::s_captureWindow = this ;
 }
 
 wxWindow* wxWindowBase::GetCapture()
 {
-    return wxTheApp->s_captureWindow ;
+    return wxApp::s_captureWindow ;
 }
 
 void wxWindowMac::DoReleaseMouse()
 {
-    wxTheApp->s_captureWindow = NULL ;
+    wxApp::s_captureWindow = NULL ;
 }
 
 #if    wxUSE_DRAG_AND_DROP
diff --git a/src/msw/datectrl.cpp b/src/msw/datectrl.cpp
index 2928307558..2660838d00 100644
--- a/src/msw/datectrl.cpp
+++ b/src/msw/datectrl.cpp
@@ -104,7 +104,7 @@ wxDatePickerCtrl::Create(wxWindow *parent,
     static bool s_initDone = false; // MT-ok: used from GUI thread only
     if ( !s_initDone )
     {
-        if ( wxTheApp->GetComCtl32Version() < 470 )
+        if ( wxApp::GetComCtl32Version() < 470 )
         {
             wxLogError(_("This system doesn't support date picker control, please upgrade your version of comctl32.dll"));
 
@@ -153,7 +153,7 @@ WXDWORD wxDatePickerCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const
 
     // although MSDN doesn't mention it, DTS_UPDOWN doesn't work with
     // comctl32.dll 4.72
-    if ( wxTheApp->GetComCtl32Version() > 472 && (style & wxDP_SPIN) )
+    if ( wxApp::GetComCtl32Version() > 472 && (style & wxDP_SPIN) )
         styleMSW |= DTS_UPDOWN;
     //else: drop down by default
 
diff --git a/src/msw/dialup.cpp b/src/msw/dialup.cpp
index 04ee582b81..815d7f3acc 100644
--- a/src/msw/dialup.cpp
+++ b/src/msw/dialup.cpp
@@ -1285,7 +1285,7 @@ static void WINAPI wxRasDialFunc(UINT WXUNUSED(unMsg),
 
     wxCHECK_RET( dialUpManager, wxT("who started to dial then?") );
 
-    SendMessage(dialUpManager->GetRasWindow(), wxWM_RAS_DIALING_PROGRESS,
+    SendMessage(wxDialUpManagerMSW::GetRasWindow(), wxWM_RAS_DIALING_PROGRESS,
                 rasconnstate, dwError);
 }
 
diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp
index 2486ceef12..dd212e951c 100644
--- a/src/msw/listctrl.cpp
+++ b/src/msw/listctrl.cpp
@@ -359,7 +359,7 @@ bool wxListCtrl::Create(wxWindow *parent,
 
     // for comctl32.dll v 4.70+ we want to have this attribute because it's
     // prettier (and also because wxGTK does it like this)
-    if ( InReportView() && wxTheApp->GetComCtl32Version() >= 470 )
+    if ( InReportView() && wxApp::GetComCtl32Version() >= 470 )
     {
         ::SendMessage(GetHwnd(), LVM_SETEXTENDEDLISTVIEWSTYLE,
                       0, LVS_EX_FULLROWSELECT);
@@ -428,7 +428,7 @@ WXDWORD wxListCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const
 #if !( defined(__GNUWIN32__) && !wxCHECK_W32API_VERSION( 1, 0 ) )
     if ( style & wxLC_VIRTUAL )
     {
-        int ver = wxTheApp->GetComCtl32Version();
+        int ver = wxApp::GetComCtl32Version();
         if ( ver < 470 )
         {
             wxLogWarning(_("Please install a newer version of comctl32.dll\n(at least version 4.70 is required but you have %d.%02d)\nor this program won't operate correctly."),
diff --git a/src/msw/spinbutt.cpp b/src/msw/spinbutt.cpp
index 9a8874d88e..297e172694 100644
--- a/src/msw/spinbutt.cpp
+++ b/src/msw/spinbutt.cpp
@@ -257,7 +257,7 @@ void wxSpinButton::SetRange(int minVal, int maxVal)
     wxSpinButtonBase::SetRange(minVal, maxVal);
 
 #ifdef UDM_SETRANGE32
-    if ( wxTheApp->GetComCtl32Version() >= 471 )
+    if ( wxApp::GetComCtl32Version() >= 471 )
     {
         // use the full 32 bit range if available
         ::SendMessage(GetHwnd(), UDM_SETRANGE32, minVal, maxVal);
diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp
index 56f1bc60c5..9cf966b5af 100644
--- a/src/msw/tbar95.cpp
+++ b/src/msw/tbar95.cpp
@@ -397,7 +397,7 @@ WXDWORD wxToolBar::MSWGetStyle(long style, WXDWORD *exstyle) const
     if ( style & (wxTB_FLAT | wxTB_HORZ_LAYOUT) )
     {
         // static as it doesn't change during the program lifetime
-        static int s_verComCtl = wxTheApp->GetComCtl32Version();
+        static int s_verComCtl = wxApp::GetComCtl32Version();
 
         // comctl32.dll 4.00 doesn't support the flat toolbars and using this
         // style with 6.00 (part of Windows XP) leads to the toolbar with
@@ -731,7 +731,7 @@ bool wxToolBar::Realize()
         if ( oldToolBarBitmap )
         {
 #ifdef TB_REPLACEBITMAP
-            if ( wxTheApp->GetComCtl32Version() >= 400 )
+            if ( wxApp::GetComCtl32Version() >= 400 )
             {
                 TBREPLACEBITMAP replaceBitmap;
                 replaceBitmap.hInstOld = NULL;
@@ -813,7 +813,7 @@ bool wxToolBar::Realize()
         // don't add separators to the vertical toolbar with old comctl32.dll
         // versions as they didn't handle this properly
         if ( isVertical && tool->IsSeparator() &&
-                wxTheApp->GetComCtl32Version() <= 472 )
+                wxApp::GetComCtl32Version() <= 472 )
         {
             continue;
         }
@@ -946,7 +946,7 @@ bool wxToolBar::Realize()
 #ifdef TB_SETBUTTONINFO
         // available in headers, now check whether it is available now
         // (during run-time)
-        if ( wxTheApp->GetComCtl32Version() >= 471 )
+        if ( wxApp::GetComCtl32Version() >= 471 )
         {
             // set the (underlying) separators width to be that of the
             // control
@@ -1160,7 +1160,7 @@ wxSize wxToolBar::GetToolSize() const
 #if defined(_WIN32_IE) && (_WIN32_IE >= 0x300 ) \
     && !( defined(__GNUWIN32__) && !wxCHECK_W32API_VERSION( 1, 0 ) ) \
     && !defined (__DIGITALMARS__)
-    if ( wxTheApp->GetComCtl32Version() >= 470 )
+    if ( wxApp::GetComCtl32Version() >= 470 )
     {
         DWORD dw = ::SendMessage(GetHwnd(), TB_GETBUTTONSIZE, 0, 0);
 
@@ -1213,7 +1213,7 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
 
     // if comctl32 version < 4.71 wxToolBar95 adds dummy spacers
 #if defined(_WIN32_IE) && (_WIN32_IE >= 0x400 )
-    if ( wxTheApp->GetComCtl32Version() >= 471 )
+    if ( wxApp::GetComCtl32Version() >= 471 )
     {
         return m_tools.Item((size_t)index)->GetData();
     }
diff --git a/src/msw/tooltip.cpp b/src/msw/tooltip.cpp
index d91f36afc1..71ef1f714e 100644
--- a/src/msw/tooltip.cpp
+++ b/src/msw/tooltip.cpp
@@ -289,7 +289,7 @@ void wxToolTip::Add(WXHWND hWnd)
         if ( index != wxNOT_FOUND )
         {
 #ifdef TTM_SETMAXTIPWIDTH
-            if ( wxTheApp->GetComCtl32Version() >= 470 )
+            if ( wxApp::GetComCtl32Version() >= 470 )
             {
                 // use TTM_SETMAXTIPWIDTH to make tooltip multiline using the
                 // extent of its first line as max value
diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp
index 6bc4c2341c..8250f48782 100644
--- a/src/msw/treectrl.cpp
+++ b/src/msw/treectrl.cpp
@@ -659,7 +659,7 @@ bool wxTreeCtrl::Create(wxWindow *parent,
 
     if ( m_windowStyle & wxTR_FULL_ROW_HIGHLIGHT )
     {
-        if ( wxTheApp->GetComCtl32Version() >= 471 )
+        if ( wxApp::GetComCtl32Version() >= 471 )
             wstyle |= TVS_FULLROWSELECT;
     }
 
diff --git a/src/msw/uxtheme.cpp b/src/msw/uxtheme.cpp
index a28d3311e3..e8ffd842a4 100644
--- a/src/msw/uxtheme.cpp
+++ b/src/msw/uxtheme.cpp
@@ -108,7 +108,7 @@ wxUxThemeEngine* wxUxThemeEngine::Get()
 
 bool wxUxThemeEngine::Initialize()
 {
-    if ( wxTheApp->GetComCtl32Version() < 600 )
+    if ( wxApp::GetComCtl32Version() < 600 )
     {
         // not using theme-aware comctl32.dll anyhow, don't even try to use
         // themes
-- 
2.47.2