[1231183] 'cleanup: mismatched indentation' and other cleanings.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34914 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -144,24 +144,24 @@ void wxDataInputStream::Read64(wxUint64 *buffer, size_t size)
|
||||
|
||||
void wxDataInputStream::Read32(wxUint32 *buffer, size_t size)
|
||||
{
|
||||
m_input->Read(buffer, size * 4);
|
||||
m_input->Read(buffer, size * 4);
|
||||
|
||||
if (m_be_order)
|
||||
{
|
||||
for (wxUint32 i=0; i<size; i++)
|
||||
if (m_be_order)
|
||||
{
|
||||
wxUint32 v = wxUINT32_SWAP_ON_LE(*buffer);
|
||||
*(buffer++) = v;
|
||||
for (wxUint32 i=0; i<size; i++)
|
||||
{
|
||||
wxUint32 v = wxUINT32_SWAP_ON_LE(*buffer);
|
||||
*(buffer++) = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (wxUint32 i=0; i<size; i++)
|
||||
else
|
||||
{
|
||||
wxUint32 v = wxUINT32_SWAP_ON_BE(*buffer);
|
||||
*(buffer++) = v;
|
||||
for (wxUint32 i=0; i<size; i++)
|
||||
{
|
||||
wxUint32 v = wxUINT32_SWAP_ON_BE(*buffer);
|
||||
*(buffer++) = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wxDataInputStream::Read16(wxUint16 *buffer, size_t size)
|
||||
|
@@ -612,11 +612,14 @@ wxChar *wxExpandPath(wxChar *buf, const wxChar *name)
|
||||
nnm = *s ? s + 1 : s;
|
||||
*s = 0;
|
||||
// FIXME: wxGetUserHome could return temporary storage in Unicode mode
|
||||
if ((home = WXSTRINGCAST wxGetUserHome(wxString(nm + 1))) == NULL) {
|
||||
if (was_sep) /* replace only if it was there: */
|
||||
*s = SEP;
|
||||
if ((home = WXSTRINGCAST wxGetUserHome(wxString(nm + 1))) == NULL)
|
||||
{
|
||||
if (was_sep) /* replace only if it was there: */
|
||||
*s = SEP;
|
||||
s = NULL;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
nm = nnm;
|
||||
s = home;
|
||||
}
|
||||
@@ -1778,123 +1781,123 @@ bool wxIsWild( const wxString& pattern )
|
||||
|
||||
bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special )
|
||||
{
|
||||
if (text.empty())
|
||||
if (text.empty())
|
||||
{
|
||||
/* Match if both are empty. */
|
||||
return pat.empty();
|
||||
}
|
||||
|
||||
const wxChar *m = pat.c_str(),
|
||||
*n = text.c_str(),
|
||||
*ma = NULL,
|
||||
*na = NULL,
|
||||
*mp = NULL,
|
||||
*np = NULL;
|
||||
int just = 0,
|
||||
pcount = 0,
|
||||
acount = 0,
|
||||
count = 0;
|
||||
|
||||
if (dot_special && (*n == wxT('.')))
|
||||
{
|
||||
/* Never match so that hidden Unix files
|
||||
* are never found. */
|
||||
return false;
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (*m == wxT('*'))
|
||||
{
|
||||
/* Match if both are empty. */
|
||||
return pat.empty();
|
||||
ma = ++m;
|
||||
na = n;
|
||||
just = 1;
|
||||
mp = NULL;
|
||||
acount = count;
|
||||
}
|
||||
|
||||
const wxChar *m = pat.c_str(),
|
||||
*n = text.c_str(),
|
||||
*ma = NULL,
|
||||
*na = NULL,
|
||||
*mp = NULL,
|
||||
*np = NULL;
|
||||
int just = 0,
|
||||
pcount = 0,
|
||||
acount = 0,
|
||||
count = 0;
|
||||
|
||||
if (dot_special && (*n == wxT('.')))
|
||||
else if (*m == wxT('?'))
|
||||
{
|
||||
/* Never match so that hidden Unix files
|
||||
* are never found. */
|
||||
m++;
|
||||
if (!*n++)
|
||||
return false;
|
||||
}
|
||||
|
||||
for (;;)
|
||||
else
|
||||
{
|
||||
if (*m == wxT('*'))
|
||||
if (*m == wxT('\\'))
|
||||
{
|
||||
m++;
|
||||
/* Quoting "nothing" is a bad thing */
|
||||
if (!*m)
|
||||
return false;
|
||||
}
|
||||
if (!*m)
|
||||
{
|
||||
/*
|
||||
* If we are out of both strings or we just
|
||||
* saw a wildcard, then we can say we have a
|
||||
* match
|
||||
*/
|
||||
if (!*n)
|
||||
return true;
|
||||
if (just)
|
||||
return true;
|
||||
just = 0;
|
||||
goto not_matched;
|
||||
}
|
||||
/*
|
||||
* We could check for *n == NULL at this point, but
|
||||
* since it's more common to have a character there,
|
||||
* check to see if they match first (m and n) and
|
||||
* then if they don't match, THEN we can check for
|
||||
* the NULL of n
|
||||
*/
|
||||
just = 0;
|
||||
if (*m == *n)
|
||||
{
|
||||
m++;
|
||||
if (*n == wxT(' '))
|
||||
mp = NULL;
|
||||
count++;
|
||||
n++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
not_matched:
|
||||
|
||||
/*
|
||||
* If there are no more characters in the
|
||||
* string, but we still need to find another
|
||||
* character (*m != NULL), then it will be
|
||||
* impossible to match it
|
||||
*/
|
||||
if (!*n)
|
||||
return false;
|
||||
if (mp)
|
||||
{
|
||||
ma = ++m;
|
||||
na = n;
|
||||
just = 1;
|
||||
m = mp;
|
||||
if (*np == wxT(' '))
|
||||
{
|
||||
mp = NULL;
|
||||
acount = count;
|
||||
}
|
||||
else if (*m == wxT('?'))
|
||||
{
|
||||
m++;
|
||||
if (!*n++)
|
||||
return false;
|
||||
goto check_percent;
|
||||
}
|
||||
n = ++np;
|
||||
count = pcount;
|
||||
}
|
||||
else
|
||||
check_percent:
|
||||
|
||||
if (ma)
|
||||
{
|
||||
if (*m == wxT('\\'))
|
||||
{
|
||||
m++;
|
||||
/* Quoting "nothing" is a bad thing */
|
||||
if (!*m)
|
||||
return false;
|
||||
}
|
||||
if (!*m)
|
||||
{
|
||||
/*
|
||||
* If we are out of both strings or we just
|
||||
* saw a wildcard, then we can say we have a
|
||||
* match
|
||||
*/
|
||||
if (!*n)
|
||||
return true;
|
||||
if (just)
|
||||
return true;
|
||||
just = 0;
|
||||
goto not_matched;
|
||||
}
|
||||
/*
|
||||
* We could check for *n == NULL at this point, but
|
||||
* since it's more common to have a character there,
|
||||
* check to see if they match first (m and n) and
|
||||
* then if they don't match, THEN we can check for
|
||||
* the NULL of n
|
||||
*/
|
||||
just = 0;
|
||||
if (*m == *n)
|
||||
{
|
||||
m++;
|
||||
if (*n == wxT(' '))
|
||||
mp = NULL;
|
||||
count++;
|
||||
n++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
not_matched:
|
||||
|
||||
/*
|
||||
* If there are no more characters in the
|
||||
* string, but we still need to find another
|
||||
* character (*m != NULL), then it will be
|
||||
* impossible to match it
|
||||
*/
|
||||
if (!*n)
|
||||
return false;
|
||||
if (mp)
|
||||
{
|
||||
m = mp;
|
||||
if (*np == wxT(' '))
|
||||
{
|
||||
mp = NULL;
|
||||
goto check_percent;
|
||||
}
|
||||
n = ++np;
|
||||
count = pcount;
|
||||
}
|
||||
else
|
||||
check_percent:
|
||||
|
||||
if (ma)
|
||||
{
|
||||
m = ma;
|
||||
n = ++na;
|
||||
count = acount;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
m = ma;
|
||||
n = ++na;
|
||||
count = acount;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Return the type of an open file
|
||||
|
@@ -4,7 +4,7 @@
|
||||
// Author: John Labenski
|
||||
// Modified by:
|
||||
// Created: 14.06.03 (extracted from src/*/filedlg.cpp)
|
||||
// RCS-ID:
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -37,7 +37,7 @@
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxFileDialogBase, wxDialog)
|
||||
|
||||
void wxFileDialogBase::Init()
|
||||
{
|
||||
{
|
||||
m_filterIndex = m_dialogStyle = 0;
|
||||
m_parent = NULL;
|
||||
}
|
||||
@@ -179,24 +179,24 @@ wxString wxFileSelector(const wxChar *title,
|
||||
|
||||
// if filter is of form "All files (*)|*|..." set correct filter index
|
||||
if((wxStrlen(defaultExtension) != 0) && (filter2.Find(wxT('|')) != wxNOT_FOUND))
|
||||
{
|
||||
{
|
||||
int filterIndex = 0;
|
||||
|
||||
wxArrayString descriptions, filters;
|
||||
// don't care about errors, handled already by wxFileDialog
|
||||
(void)wxParseCommonDialogsFilter(filter2, descriptions, filters);
|
||||
for (size_t n=0; n<filters.GetCount(); n++)
|
||||
{
|
||||
{
|
||||
if (filters[n].Contains(defaultExtension))
|
||||
{
|
||||
{
|
||||
filterIndex = n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (filterIndex > 0)
|
||||
fileDialog.SetFilterIndex(filterIndex);
|
||||
}
|
||||
}
|
||||
|
||||
wxString filename;
|
||||
if ( fileDialog.ShowModal() == wxID_OK )
|
||||
|
@@ -68,7 +68,7 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case wxT('2'): // ASCII Grey
|
||||
case wxT('2'): // ASCII Grey
|
||||
case wxT('3'): // ASCII RGB
|
||||
case wxT('5'): // RAW Grey
|
||||
case wxT('6'): break;
|
||||
@@ -94,14 +94,14 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
|
||||
}
|
||||
|
||||
|
||||
if (c=='2') // Ascii GREY
|
||||
{
|
||||
if (c=='2') // Ascii GREY
|
||||
{
|
||||
wxUint32 value, size=width*height;
|
||||
for (wxUint32 i=0; i<size; ++i)
|
||||
{
|
||||
value=text_stream.Read32();
|
||||
*ptr++=(unsigned char)value; // R
|
||||
*ptr++=(unsigned char)value; // G
|
||||
*ptr++=(unsigned char)value; // G
|
||||
*ptr++=(unsigned char)value; // B
|
||||
if ( !buf_stream )
|
||||
{
|
||||
@@ -110,8 +110,8 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
|
||||
}
|
||||
}
|
||||
}
|
||||
if (c=='3') // Ascii RBG
|
||||
{
|
||||
if (c=='3') // Ascii RBG
|
||||
{
|
||||
wxUint32 value, size=3*width*height;
|
||||
for (wxUint32 i=0; i<size; ++i)
|
||||
{
|
||||
@@ -126,9 +126,9 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (c=='5') // Raw GREY
|
||||
{
|
||||
}
|
||||
if (c=='5') // Raw GREY
|
||||
{
|
||||
wxUint32 size=width*height;
|
||||
unsigned char value;
|
||||
for (wxUint32 i=0; i<size; ++i)
|
||||
@@ -136,7 +136,7 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
|
||||
buf_stream.Read(&value,1);
|
||||
*ptr++=value; // R
|
||||
*ptr++=value; // G
|
||||
*ptr++=value; // B
|
||||
*ptr++=value; // B
|
||||
if ( !buf_stream )
|
||||
{
|
||||
if (verbose) wxLogError(_("PNM: File seems truncated."));
|
||||
|
@@ -802,7 +802,8 @@ const wxChar *wxSysErrorMsg(unsigned long nErrCode)
|
||||
// copy it to our buffer and free memory
|
||||
// Crashes on SmartPhone (FIXME)
|
||||
#if !defined(__SMARTPHONE__) /* of WinCE */
|
||||
if( lpMsgBuf != 0 ) {
|
||||
if( lpMsgBuf != 0 )
|
||||
{
|
||||
wxStrncpy(s_szBuf, (const wxChar *)lpMsgBuf, WXSIZEOF(s_szBuf) - 1);
|
||||
s_szBuf[WXSIZEOF(s_szBuf) - 1] = wxT('\0');
|
||||
|
||||
|
@@ -289,14 +289,14 @@ wxAcceleratorEntry *wxGetAccelFromString(const wxString& label)
|
||||
keyCode = WXK_WINDOWS_LEFT;
|
||||
else if ( current == wxT("WINDOWS_RIGHT") )
|
||||
keyCode = WXK_WINDOWS_RIGHT;
|
||||
else if ( current == wxT("WINDOWS_MENU") )
|
||||
else if ( current == wxT("WINDOWS_MENU") )
|
||||
keyCode = WXK_WINDOWS_MENU;
|
||||
else if ( current == wxT("COMMAND") )
|
||||
keyCode = WXK_COMMAND;
|
||||
else if ( current.Left(3) == wxT("KP_") && wxIsdigit(current[3U]) ) {
|
||||
keyCode = WXK_NUMPAD0 + wxAtoi(current.c_str() + 3); }
|
||||
else if ( current.Left(7) == wxT("SPECIAL") && wxIsdigit(current[7U]) ) {
|
||||
keyCode = WXK_SPECIAL1 + wxAtoi(current.c_str() + 7) - 1; }
|
||||
else if ( current.Left(3) == wxT("KP_") && wxIsdigit(current[3U]) )
|
||||
keyCode = WXK_NUMPAD0 + wxAtoi(current.c_str() + 3);
|
||||
else if ( current.Left(7) == wxT("SPECIAL") && wxIsdigit(current[7U]) )
|
||||
keyCode = WXK_SPECIAL1 + wxAtoi(current.c_str() + 7) - 1;
|
||||
else
|
||||
{
|
||||
wxLogDebug(wxT("Unrecognized accel key '%s', accel string ignored."),
|
||||
|
@@ -435,35 +435,35 @@ wxStringBase::iterator wxStringBase::erase(iterator it)
|
||||
|
||||
wxStringBase& wxStringBase::erase(size_t nStart, size_t nLen)
|
||||
{
|
||||
wxASSERT(nStart <= length());
|
||||
size_t strLen = length() - nStart;
|
||||
// delete nLen or up to the end of the string characters
|
||||
nLen = strLen < nLen ? strLen : nLen;
|
||||
wxString strTmp(c_str(), nStart);
|
||||
strTmp.append(c_str() + nStart + nLen, length() - nStart - nLen);
|
||||
wxASSERT(nStart <= length());
|
||||
size_t strLen = length() - nStart;
|
||||
// delete nLen or up to the end of the string characters
|
||||
nLen = strLen < nLen ? strLen : nLen;
|
||||
wxString strTmp(c_str(), nStart);
|
||||
strTmp.append(c_str() + nStart + nLen, length() - nStart - nLen);
|
||||
|
||||
swap(strTmp);
|
||||
return *this;
|
||||
swap(strTmp);
|
||||
return *this;
|
||||
}
|
||||
|
||||
wxStringBase& wxStringBase::insert(size_t nPos, const wxChar *sz, size_t n)
|
||||
{
|
||||
wxASSERT( nPos <= length() );
|
||||
wxASSERT( nPos <= length() );
|
||||
|
||||
if ( n == npos ) n = wxStrlen(sz);
|
||||
if ( n == 0 ) return *this;
|
||||
if ( n == npos ) n = wxStrlen(sz);
|
||||
if ( n == 0 ) return *this;
|
||||
|
||||
if ( !Alloc(length() + n) || !CopyBeforeWrite() ) {
|
||||
wxFAIL_MSG( _T("out of memory in wxStringBase::insert") );
|
||||
}
|
||||
if ( !Alloc(length() + n) || !CopyBeforeWrite() ) {
|
||||
wxFAIL_MSG( _T("out of memory in wxStringBase::insert") );
|
||||
}
|
||||
|
||||
memmove(m_pchData + nPos + n, m_pchData + nPos,
|
||||
(length() - nPos) * sizeof(wxChar));
|
||||
memcpy(m_pchData + nPos, sz, n * sizeof(wxChar));
|
||||
GetStringData()->nDataLength = length() + n;
|
||||
m_pchData[length()] = '\0';
|
||||
memmove(m_pchData + nPos + n, m_pchData + nPos,
|
||||
(length() - nPos) * sizeof(wxChar));
|
||||
memcpy(m_pchData + nPos, sz, n * sizeof(wxChar));
|
||||
GetStringData()->nDataLength = length() + n;
|
||||
m_pchData[length()] = '\0';
|
||||
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void wxStringBase::swap(wxStringBase& str)
|
||||
@@ -475,50 +475,50 @@ void wxStringBase::swap(wxStringBase& str)
|
||||
|
||||
size_t wxStringBase::find(const wxStringBase& str, size_t nStart) const
|
||||
{
|
||||
wxASSERT( str.GetStringData()->IsValid() );
|
||||
wxASSERT( nStart <= length() );
|
||||
wxASSERT( str.GetStringData()->IsValid() );
|
||||
wxASSERT( nStart <= length() );
|
||||
|
||||
//anchor
|
||||
const wxChar* p = (const wxChar*)wxTmemchr(c_str() + nStart,
|
||||
str.c_str()[0],
|
||||
length() - nStart);
|
||||
//anchor
|
||||
const wxChar* p = (const wxChar*)wxTmemchr(c_str() + nStart,
|
||||
str.c_str()[0],
|
||||
length() - nStart);
|
||||
|
||||
if(!p)
|
||||
return npos;
|
||||
if(!p)
|
||||
return npos;
|
||||
|
||||
while(p - c_str() + str.length() <= length() &&
|
||||
wxTmemcmp(p, str.c_str(), str.length()) )
|
||||
{
|
||||
//Previosly passed as the first argument to wxTmemchr,
|
||||
//but C/C++ standard does not specify evaluation order
|
||||
//of arguments to functions -
|
||||
//http://embedded.com/showArticle.jhtml?articleID=9900607
|
||||
++p;
|
||||
while(p - c_str() + str.length() <= length() &&
|
||||
wxTmemcmp(p, str.c_str(), str.length()) )
|
||||
{
|
||||
//Previosly passed as the first argument to wxTmemchr,
|
||||
//but C/C++ standard does not specify evaluation order
|
||||
//of arguments to functions -
|
||||
//http://embedded.com/showArticle.jhtml?articleID=9900607
|
||||
++p;
|
||||
|
||||
//anchor again
|
||||
p = (const wxChar*)wxTmemchr(p,
|
||||
str.c_str()[0],
|
||||
length() - (p - c_str()));
|
||||
//anchor again
|
||||
p = (const wxChar*)wxTmemchr(p,
|
||||
str.c_str()[0],
|
||||
length() - (p - c_str()));
|
||||
|
||||
if(!p)
|
||||
return npos;
|
||||
}
|
||||
if(!p)
|
||||
return npos;
|
||||
}
|
||||
|
||||
return (p - c_str() + str.length() <= length()) ? p - c_str() : npos;
|
||||
return (p - c_str() + str.length() <= length()) ? p - c_str() : npos;
|
||||
}
|
||||
|
||||
size_t wxStringBase::find(const wxChar* sz, size_t nStart, size_t n) const
|
||||
{
|
||||
return find(wxStringBase(sz, n), nStart);
|
||||
return find(wxStringBase(sz, n), nStart);
|
||||
}
|
||||
|
||||
size_t wxStringBase::find(wxChar ch, size_t nStart) const
|
||||
{
|
||||
wxASSERT( nStart <= length() );
|
||||
wxASSERT( nStart <= length() );
|
||||
|
||||
const wxChar *p = (const wxChar*)wxTmemchr(c_str() + nStart, ch, length() - nStart);
|
||||
const wxChar *p = (const wxChar*)wxTmemchr(c_str() + nStart, ch, length() - nStart);
|
||||
|
||||
return p == NULL ? npos : p - c_str();
|
||||
return p == NULL ? npos : p - c_str();
|
||||
}
|
||||
|
||||
size_t wxStringBase::rfind(const wxStringBase& str, size_t nStart) const
|
||||
|
@@ -132,7 +132,7 @@ wxUint32 wxTextInputStream::Read32(int base)
|
||||
if(!m_input) return 0;
|
||||
|
||||
wxString word = ReadWord();
|
||||
if(word.IsEmpty())
|
||||
if(word.empty())
|
||||
return 0;
|
||||
return wxStrtoul(word.c_str(), 0, base);
|
||||
}
|
||||
@@ -153,7 +153,7 @@ wxInt32 wxTextInputStream::Read32S(int base)
|
||||
if(!m_input) return 0;
|
||||
|
||||
wxString word = ReadWord();
|
||||
if(word.IsEmpty())
|
||||
if(word.empty())
|
||||
return 0;
|
||||
return wxStrtol(word.c_str(), 0, base);
|
||||
}
|
||||
@@ -172,7 +172,7 @@ double wxTextInputStream::ReadDouble()
|
||||
{
|
||||
if(!m_input) return 0;
|
||||
wxString word = ReadWord();
|
||||
if(word.IsEmpty())
|
||||
if(word.empty())
|
||||
return 0;
|
||||
return wxStrtod(word.c_str(), 0);
|
||||
}
|
||||
@@ -406,7 +406,7 @@ void wxTextOutputStream::WriteString(const wxString& string)
|
||||
}
|
||||
|
||||
out << c;
|
||||
}
|
||||
}
|
||||
|
||||
// We must not write the trailing NULL here
|
||||
#if wxUSE_UNICODE
|
||||
|
@@ -4,9 +4,9 @@
|
||||
// Author: Kevin Smith
|
||||
// Modified by:
|
||||
// Created: Jan 22 1999
|
||||
// RCS-ID:
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 Kevin Smith
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
||||
@@ -336,65 +336,66 @@ bool wxGenericValidator::TransferToWindow(void)
|
||||
// Called to transfer data from the window
|
||||
bool wxGenericValidator::TransferFromWindow(void)
|
||||
{
|
||||
if ( !m_validatorWindow )
|
||||
return false;
|
||||
if ( !m_validatorWindow )
|
||||
return false;
|
||||
|
||||
// bool controls
|
||||
// BOOL CONTROLS **************************************
|
||||
#if wxUSE_CHECKBOX
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckBox)) )
|
||||
{
|
||||
wxCheckBox* pControl = (wxCheckBox*) m_validatorWindow;
|
||||
if (m_pBool)
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckBox)) )
|
||||
{
|
||||
*m_pBool = pControl->GetValue() ;
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
wxCheckBox* pControl = (wxCheckBox*) m_validatorWindow;
|
||||
if (m_pBool)
|
||||
{
|
||||
*m_pBool = pControl->GetValue() ;
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
#if wxUSE_RADIOBTN
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioButton)) )
|
||||
{
|
||||
wxRadioButton* pControl = (wxRadioButton*) m_validatorWindow;
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioButton)) )
|
||||
{
|
||||
wxRadioButton* pControl = (wxRadioButton*) m_validatorWindow;
|
||||
if (m_pBool)
|
||||
{
|
||||
*m_pBool = pControl->GetValue() ;
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
{
|
||||
*m_pBool = pControl->GetValue() ;
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
// int controls
|
||||
|
||||
// INT CONTROLS ***************************************
|
||||
#if wxUSE_GAUGE
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxGauge)) )
|
||||
{
|
||||
wxGauge* pControl = (wxGauge*) m_validatorWindow;
|
||||
if (m_pInt)
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxGauge)) )
|
||||
{
|
||||
*m_pInt = pControl->GetValue() ;
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
wxGauge* pControl = (wxGauge*) m_validatorWindow;
|
||||
if (m_pInt)
|
||||
{
|
||||
*m_pInt = pControl->GetValue() ;
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
#if wxUSE_RADIOBOX
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioBox)) )
|
||||
{
|
||||
wxRadioBox* pControl = (wxRadioBox*) m_validatorWindow;
|
||||
if (m_pInt)
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioBox)) )
|
||||
{
|
||||
*m_pInt = pControl->GetSelection() ;
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
wxRadioBox* pControl = (wxRadioBox*) m_validatorWindow;
|
||||
if (m_pInt)
|
||||
{
|
||||
*m_pInt = pControl->GetSelection() ;
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
#if wxUSE_SCROLLBAR
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxScrollBar)) )
|
||||
{
|
||||
wxScrollBar* pControl = (wxScrollBar*) m_validatorWindow;
|
||||
if (m_pInt)
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxScrollBar)) )
|
||||
{
|
||||
*m_pInt = pControl->GetThumbPosition() ;
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
wxScrollBar* pControl = (wxScrollBar*) m_validatorWindow;
|
||||
if (m_pInt)
|
||||
{
|
||||
*m_pInt = pControl->GetThumbPosition() ;
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
#if wxUSE_SPINCTRL && !defined(__WXMOTIF__)
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinCtrl)) )
|
||||
@@ -408,153 +409,156 @@ bool wxGenericValidator::TransferFromWindow(void)
|
||||
} else
|
||||
#endif
|
||||
#if wxUSE_SPINBTN
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinButton)) )
|
||||
{
|
||||
wxSpinButton* pControl = (wxSpinButton*) m_validatorWindow;
|
||||
if (m_pInt)
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinButton)) )
|
||||
{
|
||||
*m_pInt = pControl->GetValue() ;
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
wxSpinButton* pControl = (wxSpinButton*) m_validatorWindow;
|
||||
if (m_pInt)
|
||||
{
|
||||
*m_pInt = pControl->GetValue() ;
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
#if wxUSE_SLIDER
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxSlider)) )
|
||||
{
|
||||
wxSlider* pControl = (wxSlider*) m_validatorWindow;
|
||||
if (m_pInt)
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxSlider)) )
|
||||
{
|
||||
*m_pInt = pControl->GetValue() ;
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
wxSlider* pControl = (wxSlider*) m_validatorWindow;
|
||||
if (m_pInt)
|
||||
{
|
||||
*m_pInt = pControl->GetValue() ;
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
// string controls
|
||||
|
||||
// STRING CONTROLS ************************************
|
||||
#if wxUSE_BUTTON
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxButton)) )
|
||||
{
|
||||
wxButton* pControl = (wxButton*) m_validatorWindow;
|
||||
if (m_pString)
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxButton)) )
|
||||
{
|
||||
*m_pString = pControl->GetLabel() ;
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
wxButton* pControl = (wxButton*) m_validatorWindow;
|
||||
if (m_pString)
|
||||
{
|
||||
*m_pString = pControl->GetLabel() ;
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
#if wxUSE_COMBOBOX
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) )
|
||||
{
|
||||
wxComboBox* pControl = (wxComboBox*) m_validatorWindow;
|
||||
if (m_pInt)
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) )
|
||||
{
|
||||
*m_pInt = pControl->GetSelection() ;
|
||||
return true;
|
||||
}
|
||||
else if (m_pString)
|
||||
{
|
||||
if (m_validatorWindow->GetWindowStyle() & wxCB_READONLY)
|
||||
*m_pString = pControl->GetStringSelection();
|
||||
else
|
||||
*m_pString = pControl->GetValue();
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
wxComboBox* pControl = (wxComboBox*) m_validatorWindow;
|
||||
if (m_pInt)
|
||||
{
|
||||
*m_pInt = pControl->GetSelection() ;
|
||||
return true;
|
||||
}
|
||||
else if (m_pString)
|
||||
{
|
||||
if (m_validatorWindow->GetWindowStyle() & wxCB_READONLY)
|
||||
*m_pString = pControl->GetStringSelection();
|
||||
else
|
||||
*m_pString = pControl->GetValue();
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
#if wxUSE_CHOICE
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxChoice)) )
|
||||
{
|
||||
wxChoice* pControl = (wxChoice*) m_validatorWindow;
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxChoice)) )
|
||||
{
|
||||
wxChoice* pControl = (wxChoice*) m_validatorWindow;
|
||||
if (m_pInt)
|
||||
{
|
||||
*m_pInt = pControl->GetSelection() ;
|
||||
return true;
|
||||
}
|
||||
else if (m_pString)
|
||||
{
|
||||
*m_pString = pControl->GetStringSelection();
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
{
|
||||
*m_pInt = pControl->GetSelection() ;
|
||||
return true;
|
||||
}
|
||||
else if (m_pString)
|
||||
{
|
||||
*m_pString = pControl->GetStringSelection();
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
#if wxUSE_STATTEXT
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxStaticText)) )
|
||||
{
|
||||
wxStaticText* pControl = (wxStaticText*) m_validatorWindow;
|
||||
if (m_pString)
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxStaticText)) )
|
||||
{
|
||||
*m_pString = pControl->GetLabel() ;
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
wxStaticText* pControl = (wxStaticText*) m_validatorWindow;
|
||||
if (m_pString)
|
||||
{
|
||||
*m_pString = pControl->GetLabel() ;
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
#if wxUSE_TEXTCTRL
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxTextCtrl)) )
|
||||
{
|
||||
wxTextCtrl* pControl = (wxTextCtrl*) m_validatorWindow;
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxTextCtrl)) )
|
||||
{
|
||||
wxTextCtrl* pControl = (wxTextCtrl*) m_validatorWindow;
|
||||
if (m_pString)
|
||||
{
|
||||
*m_pString = pControl->GetValue() ;
|
||||
return true;
|
||||
}
|
||||
else if (m_pInt)
|
||||
{
|
||||
*m_pInt = wxAtoi(pControl->GetValue());
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
{
|
||||
*m_pString = pControl->GetValue() ;
|
||||
return true;
|
||||
}
|
||||
else if (m_pInt)
|
||||
{
|
||||
*m_pInt = wxAtoi(pControl->GetValue());
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
// array controls
|
||||
|
||||
// ARRAY CONTROLS *************************************
|
||||
#if wxUSE_CHECKLISTBOX
|
||||
// NOTE: wxCheckListBox isa wxListBox, so wxCheckListBox MUST come first:
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckListBox)) )
|
||||
{
|
||||
wxCheckListBox* pControl = (wxCheckListBox*) m_validatorWindow;
|
||||
if (m_pArrayInt)
|
||||
// NOTE: wxCheckListBox isa wxListBox, so wxCheckListBox MUST come first:
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckListBox)) )
|
||||
{
|
||||
// clear our array
|
||||
m_pArrayInt->Clear();
|
||||
wxCheckListBox* pControl = (wxCheckListBox*) m_validatorWindow;
|
||||
if (m_pArrayInt)
|
||||
{
|
||||
// clear our array
|
||||
m_pArrayInt->Clear();
|
||||
|
||||
// add each selected item to our array
|
||||
size_t i,
|
||||
count = pControl->GetCount();
|
||||
for ( i = 0; i < count; i++ )
|
||||
{
|
||||
if (pControl->IsChecked(i))
|
||||
m_pArrayInt->Add(i);
|
||||
}
|
||||
// add each selected item to our array
|
||||
size_t i,
|
||||
count = pControl->GetCount();
|
||||
for ( i = 0; i < count; i++ )
|
||||
{
|
||||
if (pControl->IsChecked(i))
|
||||
m_pArrayInt->Add(i);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
} else
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
} else
|
||||
#endif
|
||||
#if wxUSE_LISTBOX
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxListBox)) )
|
||||
{
|
||||
wxListBox* pControl = (wxListBox*) m_validatorWindow;
|
||||
if (m_pArrayInt)
|
||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxListBox)) )
|
||||
{
|
||||
// clear our array
|
||||
m_pArrayInt->Clear();
|
||||
wxListBox* pControl = (wxListBox*) m_validatorWindow;
|
||||
if (m_pArrayInt)
|
||||
{
|
||||
// clear our array
|
||||
m_pArrayInt->Clear();
|
||||
|
||||
// add each selected item to our array
|
||||
size_t i,
|
||||
count = pControl->GetCount();
|
||||
for ( i = 0; i < count; i++ )
|
||||
{
|
||||
if (pControl->Selected(i))
|
||||
m_pArrayInt->Add(i);
|
||||
}
|
||||
// add each selected item to our array
|
||||
size_t i,
|
||||
count = pControl->GetCount();
|
||||
for ( i = 0; i < count; i++ )
|
||||
{
|
||||
if (pControl->Selected(i))
|
||||
m_pArrayInt->Add(i);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
|
||||
// unrecognized control, or bad pointer
|
||||
// unrecognized control, or bad pointer
|
||||
return false;
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -261,7 +261,7 @@ wxString wxFileData::GetFileType() const
|
||||
return _("<LINK>");
|
||||
else if (IsDrive())
|
||||
return _("<DRIVE>");
|
||||
else if (m_fileName.Find(wxT('.'), true) != wxNOT_FOUND)
|
||||
else if (m_fileName.Find(wxT('.'), true) != wxNOT_FOUND)
|
||||
return m_fileName.AfterLast(wxT('.'));
|
||||
|
||||
return wxEmptyString;
|
||||
@@ -318,7 +318,7 @@ wxString wxFileData::GetEntry( fileListFieldType num ) const
|
||||
break;
|
||||
|
||||
case FileList_Time:
|
||||
if (!IsDrive())
|
||||
if (!IsDrive())
|
||||
s = GetModificationTime();
|
||||
break;
|
||||
|
||||
@@ -534,7 +534,7 @@ void wxFileCtrl::UpdateFiles()
|
||||
#endif // __UNIX__
|
||||
wxFileData *fd = new wxFileData(p, wxT(".."), wxFileData::is_dir, wxFileIconsTable::folder);
|
||||
if (Add(fd, item) != -1)
|
||||
item.m_itemId++;
|
||||
item.m_itemId++;
|
||||
else
|
||||
delete fd;
|
||||
}
|
||||
@@ -563,7 +563,7 @@ void wxFileCtrl::UpdateFiles()
|
||||
{
|
||||
wxFileData *fd = new wxFileData(dirPrefix + f, f, wxFileData::is_dir, wxFileIconsTable::folder);
|
||||
if (Add(fd, item) != -1)
|
||||
item.m_itemId++;
|
||||
item.m_itemId++;
|
||||
else
|
||||
delete fd;
|
||||
|
||||
@@ -581,7 +581,7 @@ void wxFileCtrl::UpdateFiles()
|
||||
{
|
||||
wxFileData *fd = new wxFileData(dirPrefix + f, f, wxFileData::is_file, wxFileIconsTable::file);
|
||||
if (Add(fd, item) != -1)
|
||||
item.m_itemId++;
|
||||
item.m_itemId++;
|
||||
else
|
||||
delete fd;
|
||||
|
||||
|
@@ -260,7 +260,7 @@ private:
|
||||
// Work around the fact that a focus kill event can be sent to
|
||||
// a combobox within a set focus event.
|
||||
bool m_inSetFocus;
|
||||
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxGridCellEditorEvtHandler)
|
||||
DECLARE_NO_COPY_CLASS(wxGridCellEditorEvtHandler)
|
||||
@@ -1972,21 +1972,19 @@ void wxGridCellFloatRenderer::SetParameters(const wxString& params)
|
||||
{
|
||||
wxLogDebug(_T("Invalid wxGridCellFloatRenderer width parameter string '%s ignored"), params.c_str());
|
||||
}
|
||||
|
||||
}
|
||||
tmp = params.AfterFirst(_T(','));
|
||||
if ( !tmp.empty() )
|
||||
{
|
||||
long precision;
|
||||
tmp = params.AfterFirst(_T(','));
|
||||
if ( !tmp.empty() )
|
||||
{
|
||||
long precision;
|
||||
if ( tmp.ToLong(&precision) )
|
||||
{
|
||||
{
|
||||
SetPrecision((int)precision);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogDebug(_T("Invalid wxGridCellFloatRenderer precision parameter string '%s ignored"), params.c_str());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -118,8 +118,9 @@ wxSize wxGridCellDateTimeRenderer::GetBestSize(wxGrid& grid,
|
||||
return DoGetBestSize(attr, dc, GetString(grid, row, col));
|
||||
}
|
||||
|
||||
void wxGridCellDateTimeRenderer::SetParameters(const wxString& params){
|
||||
if (!params.IsEmpty())
|
||||
void wxGridCellDateTimeRenderer::SetParameters(const wxString& params)
|
||||
{
|
||||
if (!params.empty())
|
||||
m_oformat=params;
|
||||
}
|
||||
|
||||
@@ -134,7 +135,7 @@ void wxGridCellDateTimeRenderer::SetParameters(const wxString& params){
|
||||
|
||||
wxGridCellEnumRenderer::wxGridCellEnumRenderer(const wxString& choices)
|
||||
{
|
||||
if (!choices.IsEmpty())
|
||||
if (!choices.empty())
|
||||
SetParameters(choices);
|
||||
}
|
||||
|
||||
@@ -222,11 +223,11 @@ void wxGridCellEnumRenderer::SetParameters(const wxString& params)
|
||||
// "John","Fred"..."Bob" in the combo choice box
|
||||
|
||||
wxGridCellEnumEditor::wxGridCellEnumEditor(const wxString& choices)
|
||||
: wxGridCellChoiceEditor()
|
||||
:wxGridCellChoiceEditor()
|
||||
{
|
||||
m_startint = -1;
|
||||
|
||||
if (!choices.IsEmpty())
|
||||
if (!choices.empty())
|
||||
SetParameters(choices);
|
||||
}
|
||||
|
||||
@@ -251,7 +252,7 @@ void wxGridCellEnumEditor::BeginEdit(int row, int col, wxGrid* grid)
|
||||
else
|
||||
{
|
||||
wxString startValue = table->GetValue(row, col);
|
||||
if (startValue.IsNumber() && !startValue.IsEmpty())
|
||||
if (startValue.IsNumber() && !startValue.empty())
|
||||
{
|
||||
startValue.ToLong(&m_startint);
|
||||
}
|
||||
@@ -349,22 +350,24 @@ wxGridCellAutoWrapStringRenderer::GetTextLines(wxGrid& grid,
|
||||
while ( tk.HasMoreTokens() )
|
||||
{
|
||||
wxString tok = tk.GetNextToken();
|
||||
//FIXME: this causes us to print an extra unnecesary
|
||||
// space at the end of the line. But it
|
||||
// is invisible , simplifies the size calculation
|
||||
// and ensures tokens are separated in the display
|
||||
tok += _T(" ");
|
||||
//FIXME: this causes us to print an extra unnecesary
|
||||
// space at the end of the line. But it
|
||||
// is invisible , simplifies the size calculation
|
||||
// and ensures tokens are separated in the display
|
||||
tok += _T(" ");
|
||||
|
||||
dc.GetTextExtent(tok, &x, &y);
|
||||
if ( curr_x + x > max_x) {
|
||||
if ( curr_x + x > max_x)
|
||||
{
|
||||
lines.Add( wxString(thisline) );
|
||||
thisline = tok;
|
||||
curr_x=x;
|
||||
} else {
|
||||
thisline = tok;
|
||||
curr_x=x;
|
||||
}
|
||||
else
|
||||
{
|
||||
thisline+= tok;
|
||||
curr_x += x;
|
||||
}
|
||||
|
||||
curr_x += x;
|
||||
}
|
||||
}
|
||||
//Add last line
|
||||
lines.Add( wxString(thisline) );
|
||||
|
@@ -3716,8 +3716,8 @@ void wxListMainWindow::SetItemState( long litem, long state, long stateMask )
|
||||
return;
|
||||
}
|
||||
|
||||
wxCHECK_RET( litem >= 0 && (size_t)litem < GetItemCount(),
|
||||
_T("invalid list ctrl item index in SetItem") );
|
||||
wxCHECK_RET( litem >= 0 && (size_t)litem < GetItemCount(),
|
||||
_T("invalid list ctrl item index in SetItem") );
|
||||
|
||||
size_t oldCurrent = m_current;
|
||||
size_t item = (size_t)litem; // safe because of the check above
|
||||
|
@@ -114,14 +114,14 @@ wxHtmlTagsCache::wxHtmlTagsCache(const wxString& source)
|
||||
else
|
||||
{
|
||||
m_Cache[tg].End1 = m_Cache[tg].End2 = -1;
|
||||
|
||||
|
||||
if (wxIsCDATAElement(tagBuffer))
|
||||
{
|
||||
// store the orig pos in case we are missing the closing
|
||||
// tag (see below)
|
||||
wxInt32 old_pos = pos;
|
||||
wxInt32 old_pos = pos;
|
||||
bool foundCloseTag = false;
|
||||
|
||||
|
||||
// find next matching tag
|
||||
int tag_len = wxStrlen(tagBuffer);
|
||||
while (pos < lng)
|
||||
@@ -152,7 +152,7 @@ wxHtmlTagsCache::wxHtmlTagsCache(const wxString& source)
|
||||
}
|
||||
|
||||
// found a match
|
||||
if (match_pos == tag_len)
|
||||
if (match_pos == tag_len)
|
||||
{
|
||||
pos = pos - tag_len - 3;
|
||||
foundCloseTag = true;
|
||||
@@ -365,12 +365,12 @@ wxHtmlTag::wxHtmlTag(wxHtmlTag *parent,
|
||||
}
|
||||
|
||||
#undef IS_WHITE
|
||||
}
|
||||
m_Begin = i;
|
||||
}
|
||||
m_Begin = i;
|
||||
|
||||
cache->QueryTag(pos, &m_End1, &m_End2);
|
||||
if (m_End1 > end_pos) m_End1 = end_pos;
|
||||
if (m_End2 > end_pos) m_End2 = end_pos;
|
||||
cache->QueryTag(pos, &m_End1, &m_End2);
|
||||
if (m_End1 > end_pos) m_End1 = end_pos;
|
||||
if (m_End2 > end_pos) m_End2 = end_pos;
|
||||
}
|
||||
|
||||
wxHtmlTag::~wxHtmlTag()
|
||||
|
Reference in New Issue
Block a user