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:
Ryan Norton
2004-11-06 07:09:35 +00:00
parent 311765c2a8
commit 0c6099b79e
4 changed files with 131 additions and 131 deletions

View File

@@ -502,7 +502,7 @@ void wxGridCellEditor::Show(bool show, wxGridCellAttr *attr)
m_colBgOld = m_control->GetBackgroundColour();
m_control->SetBackgroundColour(attr->GetBackgroundColour());
// Workaround for GTK+1 font setting problem on some platforms
// Workaround for GTK+1 font setting problem on some platforms
#if !defined(__WXGTK__) || defined(__WXGTK20__)
m_fontOld = m_control->GetFont();
m_control->SetFont(attr->GetFont());
@@ -525,8 +525,7 @@ 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
// 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
@@ -1189,11 +1188,11 @@ bool wxGridCellFloatEditor::IsAcceptedKey(wxKeyEvent& event)
tmpbuf[0] = (char) keycode;
tmpbuf[1] = '\0';
wxString strbuf(tmpbuf, *wxConvCurrent);
bool is_decimal_point =
bool is_decimal_point =
( 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;
}