Revert files to previous version that were affected by wxIsXXX((wxChar)X) change. Note - passing a negative value to those c lib functions is undefined, and could return true on platforms using a lookup table, for example (might crash also?), which is what will happen when casting to char to ansii mode and a char is above 127
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30319 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -411,7 +411,7 @@ void MyFrame::OnRename(wxCommandEvent& WXUNUSED(event))
|
||||
static wxString s_text;
|
||||
s_text = wxGetTextFromUser(wxT("New name: "), wxT("Tree sample question"),
|
||||
s_text, this);
|
||||
if ( !s_text.empty() )
|
||||
if ( !s_text.IsEmpty() )
|
||||
{
|
||||
m_treeCtrl->SetItemText(item, s_text);
|
||||
}
|
||||
@@ -906,8 +906,8 @@ TREE_EVENT_HANDLER(OnSelChanging)
|
||||
void LogKeyEvent(const wxChar *name, const wxKeyEvent& event)
|
||||
{
|
||||
wxString key;
|
||||
int keycode = event.GetKeyCode();
|
||||
|
||||
long keycode = event.GetKeyCode();
|
||||
{
|
||||
switch ( keycode )
|
||||
{
|
||||
case WXK_BACK: key = wxT("BACK"); break;
|
||||
@@ -1014,12 +1014,13 @@ void LogKeyEvent(const wxChar *name, const wxKeyEvent& event)
|
||||
|
||||
default:
|
||||
{
|
||||
if ( wxIsprint((wxChar)keycode) )
|
||||
if ( wxIsprint((int)keycode) )
|
||||
key.Printf(wxT("'%c'"), (char)keycode);
|
||||
else if ( keycode > 0 && keycode < 27 )
|
||||
key.Printf(_("Ctrl-%c"), wxT('A') + keycode - 1);
|
||||
else
|
||||
key.Printf(wxT("unknown (%d)"), keycode);
|
||||
key.Printf(wxT("unknown (%ld)"), keycode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -141,7 +141,7 @@ wxAcceleratorEntry *wxGetAccelFromString(const wxString& label)
|
||||
}
|
||||
}
|
||||
|
||||
if ( current.empty() ) {
|
||||
if ( current.IsEmpty() ) {
|
||||
wxLogDebug(wxT("No accel key found, accel string ignored."));
|
||||
}
|
||||
else {
|
||||
@@ -262,7 +262,7 @@ void wxMenuItemBase::SetAccel(wxAcceleratorEntry *accel)
|
||||
// we should process them here
|
||||
|
||||
default:
|
||||
if ( wxIsalnum((wxChar)code) )
|
||||
if ( wxIsalnum(code) )
|
||||
{
|
||||
text << (wxChar)code;
|
||||
|
||||
|
@@ -243,9 +243,9 @@ void wxTextValidator::OnChar(wxKeyEvent& event)
|
||||
((m_validatorStyle & wxFILTER_INCLUDE_CHAR_LIST) && !IsInCharIncludeList(wxString((wxChar) keyCode, 1))) ||
|
||||
((m_validatorStyle & wxFILTER_EXCLUDE_CHAR_LIST) && !IsNotInCharExcludeList(wxString((wxChar) keyCode, 1))) ||
|
||||
((m_validatorStyle & wxFILTER_ASCII) && !isascii(keyCode)) ||
|
||||
((m_validatorStyle & wxFILTER_ALPHA) && !wxIsalpha((wxChar)keyCode)) ||
|
||||
((m_validatorStyle & wxFILTER_ALPHANUMERIC) && !wxIsalnum((wxChar)keyCode)) ||
|
||||
((m_validatorStyle & wxFILTER_NUMERIC) && !wxIsdigit((wxChar)keyCode)
|
||||
((m_validatorStyle & wxFILTER_ALPHA) && !wxIsalpha(keyCode)) ||
|
||||
((m_validatorStyle & wxFILTER_ALPHANUMERIC) && !wxIsalnum(keyCode)) ||
|
||||
((m_validatorStyle & wxFILTER_NUMERIC) && !wxIsdigit(keyCode)
|
||||
&& keyCode != '.' && keyCode != ',' && keyCode != '-')
|
||||
)
|
||||
)
|
||||
|
@@ -525,7 +525,6 @@ void wxGridCellEditor::Show(bool show, wxGridCellAttr *attr)
|
||||
m_control->SetBackgroundColour(m_colBgOld);
|
||||
m_colBgOld = wxNullColour;
|
||||
}
|
||||
|
||||
// Workaround for GTK+1 font setting problem on some platforms
|
||||
#if !defined(__WXGTK__) || defined(__WXGTK20__)
|
||||
if ( m_fontOld.Ok() )
|
||||
@@ -729,7 +728,7 @@ bool wxGridCellTextEditor::IsAcceptedKey(wxKeyEvent& event)
|
||||
|
||||
default:
|
||||
// accept 8 bit chars too if isprint() agrees
|
||||
if ( (keycode < 255) && (wxIsprint((wxChar)keycode)) )
|
||||
if ( (keycode < 255) && (wxIsprint(keycode)) )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -836,7 +835,7 @@ void wxGridCellNumberEditor::BeginEdit(int row, int col, wxGrid* grid)
|
||||
{
|
||||
m_valueOld = 0;
|
||||
wxString sValue = table->GetValue(row, col);
|
||||
if (! sValue.ToLong(&m_valueOld) && ! sValue.empty())
|
||||
if (! sValue.ToLong(&m_valueOld) && ! sValue.IsEmpty())
|
||||
{
|
||||
wxFAIL_MSG( _T("this cell doesn't have numeric value") );
|
||||
return;
|
||||
@@ -871,7 +870,7 @@ bool wxGridCellNumberEditor::EndEdit(int row, int col,
|
||||
else
|
||||
{
|
||||
text = Text()->GetValue();
|
||||
changed = (text.empty() || text.ToLong(&value)) && (value != m_valueOld);
|
||||
changed = (text.IsEmpty() || text.ToLong(&value)) && (value != m_valueOld);
|
||||
}
|
||||
|
||||
if ( changed )
|
||||
@@ -923,7 +922,7 @@ bool wxGridCellNumberEditor::IsAcceptedKey(wxKeyEvent& event)
|
||||
return true;
|
||||
|
||||
default:
|
||||
if ( (keycode < 128) && wxIsdigit((wxChar)keycode) )
|
||||
if ( (keycode < 128) && wxIsdigit(keycode) )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -936,7 +935,7 @@ void wxGridCellNumberEditor::StartingKey(wxKeyEvent& event)
|
||||
if ( !HasRange() )
|
||||
{
|
||||
int keycode = event.GetKeyCode();
|
||||
if ( wxIsdigit((wxChar)keycode) || keycode == '+' || keycode == '-'
|
||||
if ( wxIsdigit(keycode) || keycode == '+' || keycode == '-'
|
||||
|| keycode == WXK_NUMPAD0
|
||||
|| keycode == WXK_NUMPAD1
|
||||
|| keycode == WXK_NUMPAD2
|
||||
@@ -1040,7 +1039,7 @@ void wxGridCellFloatEditor::BeginEdit(int row, int col, wxGrid* grid)
|
||||
{
|
||||
m_valueOld = 0.0;
|
||||
wxString sValue = table->GetValue(row, col);
|
||||
if (! sValue.ToDouble(&m_valueOld) && ! sValue.empty())
|
||||
if (! sValue.ToDouble(&m_valueOld) && ! sValue.IsEmpty())
|
||||
{
|
||||
wxFAIL_MSG( _T("this cell doesn't have float value") );
|
||||
return;
|
||||
@@ -1056,7 +1055,7 @@ bool wxGridCellFloatEditor::EndEdit(int row, int col,
|
||||
double value = 0.0;
|
||||
wxString text(Text()->GetValue());
|
||||
|
||||
if ( (text.empty() || text.ToDouble(&value)) && (value != m_valueOld) )
|
||||
if ( (text.IsEmpty() || text.ToDouble(&value)) && (value != m_valueOld) )
|
||||
{
|
||||
if (grid->GetTable()->CanSetValueAs(row, col, wxGRID_VALUE_FLOAT))
|
||||
grid->GetTable()->SetValueAsDouble(row, col, value);
|
||||
@@ -1082,7 +1081,7 @@ void wxGridCellFloatEditor::StartingKey(wxKeyEvent& event)
|
||||
wxString strbuf(tmpbuf, *wxConvCurrent);
|
||||
bool is_decimal_point = ( strbuf ==
|
||||
wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER) );
|
||||
if ( wxIsdigit((wxChar)keycode) || keycode == '+' || keycode == '-'
|
||||
if ( wxIsdigit(keycode) || keycode == '+' || keycode == '-'
|
||||
|| is_decimal_point
|
||||
|| keycode == WXK_NUMPAD0
|
||||
|| keycode == WXK_NUMPAD1
|
||||
@@ -1193,7 +1192,7 @@ bool wxGridCellFloatEditor::IsAcceptedKey(wxKeyEvent& event)
|
||||
( strbuf == wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT,
|
||||
wxLOCALE_CAT_NUMBER) );
|
||||
if ( (keycode < 128) &&
|
||||
(wxIsdigit((wxChar)keycode) || tolower(keycode) == 'e' ||
|
||||
(wxIsdigit(keycode) || tolower(keycode) == 'e' ||
|
||||
is_decimal_point || keycode == '+' || keycode == '-') )
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user