]> git.saurik.com Git - wxWidgets.git/commitdiff
remove debugging printf() from wxGridCellFloatEditor::IsAcceptedKey(); cleaned up...
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 26 Jul 2006 13:00:49 +0000 (13:00 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 26 Jul 2006 13:00:49 +0000 (13:00 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40335 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/grid.cpp

index 7be6a92d1f84fe0ecdd86736b5bba21e6fefbd51..6d791ab4809f9acf6a6a85d231284f33a33b90e6 100644 (file)
@@ -1192,27 +1192,30 @@ bool wxGridCellFloatEditor::IsAcceptedKey(wxKeyEvent& event)
 {
     if ( wxGridCellEditor::IsAcceptedKey(event) )
     {
-        int keycode = event.GetKeyCode();
-        printf("%d\n", keycode);
-        // accept digits, 'e' as in '1e+6', also '-', '+', and '.'
-        char tmpbuf[2];
-        tmpbuf[0] = (char) keycode;
-        tmpbuf[1] = '\0';
-        wxString strbuf(tmpbuf, *wxConvCurrent);
+        const int keycode = event.GetKeyCode();
+        if ( isascii(keycode) )
+        {
+            char tmpbuf[2];
+            tmpbuf[0] = (char) keycode;
+            tmpbuf[1] = '\0';
+            wxString strbuf(tmpbuf, *wxConvCurrent);
 
 #if wxUSE_INTL
-        bool is_decimal_point =
-            ( strbuf == wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT,
-                                          wxLOCALE_CAT_NUMBER) );
+            const wxString decimalPoint =
+                wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER);
 #else
-        bool is_decimal_point = ( strbuf == _T(".") );
+            const wxString decimalPoint(_T('.'));
 #endif
 
-        if ( (keycode < 128) &&
-             (wxIsdigit(keycode) || tolower(keycode) == 'e' ||
-              is_decimal_point || keycode == '+' || keycode == '-') )
-        {
-            return true;
+            // accept digits, 'e' as in '1e+6', also '-', '+', and '.'
+            if ( wxIsdigit(keycode) ||
+                    tolower(keycode) == 'e' ||
+                        keycode == decimalPoint ||
+                            keycode == '+' ||
+                                keycode == '-' )
+            {
+                return true;
+            }
         }
     }