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
This commit is contained in:
Julian Smart
2005-03-30 16:49:41 +00:00
parent 7af29d2ff6
commit 2a1f999faf
17 changed files with 41 additions and 36 deletions

View File

@@ -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

View File

@@ -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);

View File

@@ -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

View File

@@ -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 );

View File

@@ -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

View File

@@ -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);

View File

@@ -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());
}

View File

@@ -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 ?
}

View File

@@ -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

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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."),

View File

@@ -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);

View File

@@ -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();
}

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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