Add wxIsascii() function and use it instead of isascii() in our code.
isascii() is non-ANSI and is not available under all platforms. While we currently define it ourselves in wx/wxcrtbase.h in this case, it's not a good idea as this can't be easily done correctly for all platforms so start transitioning away from using isascii() by adding wxIsascii() and using it in our own code. The only remaining occurrences of isascii() are in Scintilla code which we probably don't want to modify. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63165 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
f030eeed1e
commit
7a0079d5a4
@ -987,4 +987,6 @@ wxDEPRECATED( inline int wxIsctrl(const wxUniChar& c) );
|
||||
inline int wxIsctrl(const wxUniChar& c) { return wxIscntrl(c); }
|
||||
#endif // WXWIN_COMPATIBILITY_2_8
|
||||
|
||||
inline bool wxIsascii(const wxUniChar& c) { return c.IsAscii(); }
|
||||
|
||||
#endif /* _WX_WXCRT_H_ */
|
||||
|
@ -323,7 +323,9 @@ wxString wxAcceleratorEntry::ToString() const
|
||||
// must be a simple key
|
||||
if (
|
||||
#if !wxUSE_UNICODE
|
||||
isascii(code) &&
|
||||
// we can't call wxIsalnum() for non-ASCII characters in ASCII
|
||||
// build as they're only defined for the ASCII range (or EOF)
|
||||
wxIsascii(code) &&
|
||||
#endif // ANSI
|
||||
wxIsalnum(code) )
|
||||
{
|
||||
|
@ -94,8 +94,8 @@ wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]
|
||||
const wxAcceleratorEntry& entry = entries[i];
|
||||
|
||||
int keycode = entry.GetKeyCode();
|
||||
if ( isascii(keycode) )
|
||||
keycode = toupper(keycode);
|
||||
if ( wxIsascii(keycode) )
|
||||
keycode = wxToupper(keycode);
|
||||
|
||||
M_ACCELDATA->m_accels.Append(new wxAcceleratorEntry(entry.GetFlags(),
|
||||
keycode,
|
||||
|
@ -1027,13 +1027,8 @@ bool wxGridCellFloatEditor::IsAcceptedKey(wxKeyEvent& event)
|
||||
if ( wxGridCellEditor::IsAcceptedKey(event) )
|
||||
{
|
||||
const int keycode = event.GetKeyCode();
|
||||
if ( isascii(keycode) )
|
||||
if ( wxIsascii(keycode) )
|
||||
{
|
||||
char tmpbuf[2];
|
||||
tmpbuf[0] = (char) keycode;
|
||||
tmpbuf[1] = '\0';
|
||||
wxString strbuf(tmpbuf, *wxConvCurrent);
|
||||
|
||||
#if wxUSE_INTL
|
||||
const wxString decimalPoint =
|
||||
wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER);
|
||||
|
@ -172,7 +172,7 @@ bool wxExtHelpController::ParseMapFileLine(const wxString& line)
|
||||
const wxChar *p = line.c_str();
|
||||
|
||||
// skip whitespace
|
||||
while ( isascii(*p) && isspace(*p) )
|
||||
while ( isascii(*p) && wxIsspace(*p) )
|
||||
p++;
|
||||
|
||||
// skip empty lines and comments
|
||||
@ -187,16 +187,16 @@ bool wxExtHelpController::ParseMapFileLine(const wxString& line)
|
||||
return false;
|
||||
|
||||
p = end;
|
||||
while ( isascii(*p) && isspace(*p) )
|
||||
while ( isascii(*p) && wxIsspace(*p) )
|
||||
p++;
|
||||
|
||||
// next should be the URL
|
||||
wxString url;
|
||||
url.reserve(line.length());
|
||||
while ( isascii(*p) && !isspace(*p) )
|
||||
while ( isascii(*p) && !wxIsspace(*p) )
|
||||
url += *p++;
|
||||
|
||||
while ( isascii(*p) && isspace(*p) )
|
||||
while ( isascii(*p) && wxIsspace(*p) )
|
||||
p++;
|
||||
|
||||
// and finally the optional description of the entry after comment
|
||||
@ -204,7 +204,7 @@ bool wxExtHelpController::ParseMapFileLine(const wxString& line)
|
||||
if ( *p == WXEXTHELP_COMMENTCHAR )
|
||||
{
|
||||
p++;
|
||||
while ( isascii(*p) && isspace(*p) )
|
||||
while ( isascii(*p) && wxIsspace(*p) )
|
||||
p++;
|
||||
doc = p;
|
||||
}
|
||||
|
@ -108,8 +108,8 @@ bool wxAcceleratorEntry::MatchesEvent(const wxKeyEvent& event) const
|
||||
bool accShiftDown = ((GetFlags() & wxACCEL_SHIFT) == wxACCEL_SHIFT);
|
||||
int accKeyCode = GetKeyCode();
|
||||
int accKeyCode2 = GetKeyCode();
|
||||
if (isascii(accKeyCode2))
|
||||
accKeyCode2 = tolower(accKeyCode2);
|
||||
if (wxIsascii(accKeyCode2))
|
||||
accKeyCode2 = wxTolower(accKeyCode2);
|
||||
|
||||
return ((eventAltDown == accAltDown) && (eventCtrlDown == accCtrlDown) &&
|
||||
(eventShiftDown == accShiftDown) &&
|
||||
|
@ -387,7 +387,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
|
||||
XmTextVerifyCallbackStruct *textStruct =
|
||||
(XmTextVerifyCallbackStruct *) m_tempCallbackStruct;
|
||||
textStruct->doit = True;
|
||||
if (isascii(event.m_keyCode) && (textStruct->text->length == 1))
|
||||
if (wxIsascii(event.m_keyCode) && (textStruct->text->length == 1))
|
||||
{
|
||||
textStruct->text->ptr[0] = (char)((event.m_keyCode == WXK_RETURN) ? 10 : event.m_keyCode);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user