]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/grid.cpp
Build fix after wxColourBase introduction.
[wxWidgets.git] / src / generic / grid.cpp
index 8c54f1eb9992ba51ec21b909e1c8f1e0dcb0ae64..285cfeda4f0adb39e26309ceb011e056a7f732d8 100644 (file)
@@ -9,11 +9,9 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-// For compilers that support precompilatixon, includes "wx/wx.h".
+// For compilers that support precompilation, includes "wx/wx.h".
 #include "wx/wxprec.h"
 
-#include "wx/defs.h"
-
 #ifdef __BORLANDC__
     #pragma hdrstop
 #endif
@@ -150,7 +148,7 @@ public:
 private:
     wxGrid   *m_owner;
 
-    void OnPaint( wxPaintEvent &event );
+    void OnPaint( wxPaintEventevent );
     void OnMouseEvent( wxMouseEvent& event );
     void OnMouseWheel( wxMouseEvent& event );
     void OnKeyDown( wxKeyEvent& event );
@@ -264,7 +262,6 @@ BEGIN_EVENT_TABLE( wxGridCellEditorEvtHandler, wxEvtHandler )
 END_EVENT_TABLE()
 
 
-
 // ----------------------------------------------------------------------------
 // the internal data representation used by wxGridCellAttrProvider
 // ----------------------------------------------------------------------------
@@ -372,6 +369,7 @@ private:
     wxGridDataTypeInfoArray m_typeinfo;
 };
 
+
 // ----------------------------------------------------------------------------
 // conditional compilation
 // ----------------------------------------------------------------------------
@@ -480,7 +478,7 @@ void wxGridCellEditor::Destroy()
 {
     if (m_control)
     {
-        m_control->PopEventHandler(true /* delete it*/);
+        m_control->PopEventHandler( true /* delete it*/ );
 
         m_control->Destroy();
         m_control = NULL;
@@ -509,6 +507,7 @@ void wxGridCellEditor::Show(bool show, wxGridCellAttr *attr)
             m_fontOld = m_control->GetFont();
             m_control->SetFont(attr->GetFont());
 #endif
+
             // can't do anything more in the base class version, the other
             // attributes may only be used by the derived classes
         }
@@ -633,8 +632,8 @@ void wxGridCellTextEditor::Create(wxWindow* parent,
 void wxGridCellTextEditor::PaintBackground(const wxRect& WXUNUSED(rectCell),
                                            wxGridCellAttr * WXUNUSED(attr))
 {
-    // as we fill the entire client area, don't do anything here to minimize
-    // flicker
+    // as we fill the entire client area,
+    // don't do anything here to minimize flicker
 }
 
 void wxGridCellTextEditor::SetSize(const wxRect& rectOrig)
@@ -654,7 +653,7 @@ void wxGridCellTextEditor::SetSize(const wxRect& rectOrig)
         rect.height -= 1;
     }
 #else // !GTK
-    int extra_x = ( rect.x > 2 )? 2 : 1;
+    int extra_x = ( rect.x > 2 ) ? 2 : 1;
 
 // MB: treat MSW separately here otherwise the caret doesn't show
 // when the editor is in the first row.
@@ -695,8 +694,7 @@ void wxGridCellTextEditor::DoBeginEdit(const wxString& startValue)
     Text()->SetFocus();
 }
 
-bool wxGridCellTextEditor::EndEdit(int row, int col,
-                                   wxGrid* grid)
+bool wxGridCellTextEditor::EndEdit(int row, int col, wxGrid* grid)
 {
     wxASSERT_MSG(m_control, wxT("The wxGridCellEditor must be created first!"));
 
@@ -709,6 +707,7 @@ bool wxGridCellTextEditor::EndEdit(int row, int col,
         grid->GetTable()->SetValue(row, col, value);
 
     m_startValue = wxEmptyString;
+
     // No point in setting the text of the hidden control
     //Text()->SetValue(m_startValue);
 
@@ -803,7 +802,7 @@ void wxGridCellTextEditor::SetParameters(const wxString& params)
         long tmp;
         if ( !params.ToLong(&tmp) )
         {
-            wxLogDebug(_T("Invalid wxGridCellTextEditor parameter string '%s' ignored"), params.c_str());
+            wxLogDebug( _T("Invalid wxGridCellTextEditor parameter string '%s' ignored"), params.c_str() );
         }
         else
         {
@@ -1687,7 +1686,7 @@ void wxGridCellEditorEvtHandler::OnChar(wxKeyEvent& event)
 
             int xUnit = 1, yUnit = 1;
             m_grid->GetScrollPixelsPerUnit(&xUnit, &yUnit);
-            m_grid->Scroll(colXPos/xUnit-1, m_grid->GetScrollPos(wxVERTICAL));
+            m_grid->Scroll(colXPos / xUnit - 1, m_grid->GetScrollPos(wxVERTICAL));
             event.Skip();
             break;
         }
@@ -3180,7 +3179,7 @@ bool wxGridTableBase::DeleteCols( size_t WXUNUSED(pos),
 wxString wxGridTableBase::GetRowLabelValue( int row )
 {
     wxString s;
+
     // RD: Starting the rows at zero confuses users,
     // no matter how much it makes sense to us geeks.
     s << row + 1;
@@ -3673,17 +3672,17 @@ IMPLEMENT_DYNAMIC_CLASS( wxGridRowLabelWindow, wxWindow )
 
 BEGIN_EVENT_TABLE( wxGridRowLabelWindow, wxWindow )
     EVT_PAINT( wxGridRowLabelWindow::OnPaint )
-    EVT_MOUSEWHEEL( wxGridRowLabelWindow::OnMouseWheel)
+    EVT_MOUSEWHEEL( wxGridRowLabelWindow::OnMouseWheel )
     EVT_MOUSE_EVENTS( wxGridRowLabelWindow::OnMouseEvent )
     EVT_KEY_DOWN( wxGridRowLabelWindow::OnKeyDown )
     EVT_KEY_UP( wxGridRowLabelWindow::OnKeyUp )
-    EVT_CHAR ( wxGridRowLabelWindow::OnChar )
+    EVT_CHAR( wxGridRowLabelWindow::OnChar )
 END_EVENT_TABLE()
 
 wxGridRowLabelWindow::wxGridRowLabelWindow( wxGrid *parent,
                                             wxWindowID id,
                                             const wxPoint &pos, const wxSize &size )
-  : wxWindow( parent, id, pos, size, wxWANTS_CHARS|wxBORDER_NONE|wxFULL_REPAINT_ON_RESIZE )
+  : wxWindow( parent, id, pos, size, wxWANTS_CHARS | wxBORDER_NONE | wxFULL_REPAINT_ON_RESIZE )
 {
     m_owner = parent;
 }
@@ -3703,7 +3702,7 @@ void wxGridRowLabelWindow::OnPaint( wxPaintEvent& WXUNUSED(event) )
     dc.SetDeviceOrigin( 0, -y );
 
     wxArrayInt rows = m_owner->CalcRowLabelsExposed( GetUpdateRegion() );
-    m_owner->DrawRowLabels( dc , rows );
+    m_owner->DrawRowLabels( dc, rows );
 }
 
 void wxGridRowLabelWindow::OnMouseEvent( wxMouseEvent& event )
@@ -3713,7 +3712,7 @@ void wxGridRowLabelWindow::OnMouseEvent( wxMouseEvent& event )
 
 void wxGridRowLabelWindow::OnMouseWheel( wxMouseEvent& event )
 {
-    m_owner->GetEventHandler()->ProcessEvent(event);
+    m_owner->GetEventHandler()->ProcessEvent( event );
 }
 
 // This seems to be required for wxMotif otherwise the mouse
@@ -3743,17 +3742,17 @@ IMPLEMENT_DYNAMIC_CLASS( wxGridColLabelWindow, wxWindow )
 
 BEGIN_EVENT_TABLE( wxGridColLabelWindow, wxWindow )
     EVT_PAINT( wxGridColLabelWindow::OnPaint )
-    EVT_MOUSEWHEEL( wxGridColLabelWindow::OnMouseWheel)
+    EVT_MOUSEWHEEL( wxGridColLabelWindow::OnMouseWheel )
     EVT_MOUSE_EVENTS( wxGridColLabelWindow::OnMouseEvent )
     EVT_KEY_DOWN( wxGridColLabelWindow::OnKeyDown )
     EVT_KEY_UP( wxGridColLabelWindow::OnKeyUp )
-    EVT_CHAR ( wxGridColLabelWindow::OnChar )
+    EVT_CHAR( wxGridColLabelWindow::OnChar )
 END_EVENT_TABLE()
 
 wxGridColLabelWindow::wxGridColLabelWindow( wxGrid *parent,
                                             wxWindowID id,
                                             const wxPoint &pos, const wxSize &size )
-  : wxWindow( parent, id, pos, size, wxWANTS_CHARS|wxBORDER_NONE|wxFULL_REPAINT_ON_RESIZE )
+  : wxWindow( parent, id, pos, size, wxWANTS_CHARS | wxBORDER_NONE | wxFULL_REPAINT_ON_RESIZE )
 {
     m_owner = parent;
 }
@@ -3773,7 +3772,7 @@ void wxGridColLabelWindow::OnPaint( wxPaintEvent& WXUNUSED(event) )
     dc.SetDeviceOrigin( -x, 0 );
 
     wxArrayInt cols = m_owner->CalcColLabelsExposed( GetUpdateRegion() );
-    m_owner->DrawColLabels( dc , cols );
+    m_owner->DrawColLabels( dc, cols );
 }
 
 void wxGridColLabelWindow::OnMouseEvent( wxMouseEvent& event )
@@ -3783,7 +3782,7 @@ void wxGridColLabelWindow::OnMouseEvent( wxMouseEvent& event )
 
 void wxGridColLabelWindow::OnMouseWheel( wxMouseEvent& event )
 {
-    m_owner->GetEventHandler()->ProcessEvent(event);
+    m_owner->GetEventHandler()->ProcessEvent( event );
 }
 
 // This seems to be required for wxMotif otherwise the mouse
@@ -3812,12 +3811,12 @@ void wxGridColLabelWindow::OnChar( wxKeyEvent& event )
 IMPLEMENT_DYNAMIC_CLASS( wxGridCornerLabelWindow, wxWindow )
 
 BEGIN_EVENT_TABLE( wxGridCornerLabelWindow, wxWindow )
-    EVT_MOUSEWHEEL( wxGridCornerLabelWindow::OnMouseWheel)
+    EVT_MOUSEWHEEL( wxGridCornerLabelWindow::OnMouseWheel )
     EVT_MOUSE_EVENTS( wxGridCornerLabelWindow::OnMouseEvent )
-    EVT_PAINT( wxGridCornerLabelWindow::OnPaint)
+    EVT_PAINT( wxGridCornerLabelWindow::OnPaint )
     EVT_KEY_DOWN( wxGridCornerLabelWindow::OnKeyDown )
     EVT_KEY_UP( wxGridCornerLabelWindow::OnKeyUp )
-    EVT_CHAR ( wxGridCornerLabelWindow::OnChar )
+    EVT_CHAR( wxGridCornerLabelWindow::OnChar )
 END_EVENT_TABLE()
 
 wxGridCornerLabelWindow::wxGridCornerLabelWindow( wxGrid *parent,
@@ -3846,16 +3845,16 @@ void wxGridCornerLabelWindow::OnPaint( wxPaintEvent& WXUNUSED(event) )
 
     wxRendererNative::Get().DrawHeaderButton( this, dc, rect, 0 );
 #else // !__WXGTK__
-    dc.SetPen( wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW),1, wxSOLID) );
-    dc.DrawLine( client_width-1, client_height-1, client_width-1, 0 );
-    dc.DrawLine( client_width-1, client_height-1, 0, client_height-1 );
+    dc.SetPen( wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW), 1, wxSOLID) );
+    dc.DrawLine( client_width - 1, client_height - 1, client_width - 1, 0 );
+    dc.DrawLine( client_width - 1, client_height - 1, 0, client_height - 1 );
     dc.DrawLine( 0, 0, client_width, 0 );
     dc.DrawLine( 0, 0, 0, client_height );
 
     dc.SetPen( *wxWHITE_PEN );
-    dc.DrawLine( 1, 1, client_width-1, 1 );
-    dc.DrawLine( 1, 1, 1, client_height-1 );
-#endif // __WXGTK__/!__WXGTK__
+    dc.DrawLine( 1, 1, client_width - 1, 1 );
+    dc.DrawLine( 1, 1, 1, client_height - 1 );
+#endif
 }
 
 void wxGridCornerLabelWindow::OnMouseEvent( wxMouseEvent& event )
@@ -3895,11 +3894,11 @@ IMPLEMENT_DYNAMIC_CLASS( wxGridWindow, wxWindow )
 
 BEGIN_EVENT_TABLE( wxGridWindow, wxWindow )
     EVT_PAINT( wxGridWindow::OnPaint )
-    EVT_MOUSEWHEEL( wxGridWindow::OnMouseWheel)
+    EVT_MOUSEWHEEL( wxGridWindow::OnMouseWheel )
     EVT_MOUSE_EVENTS( wxGridWindow::OnMouseEvent )
     EVT_KEY_DOWN( wxGridWindow::OnKeyDown )
     EVT_KEY_UP( wxGridWindow::OnKeyUp )
-    EVT_CHAR ( wxGridWindow::OnChar )
+    EVT_CHAR( wxGridWindow::OnChar )
     EVT_SET_FOCUS( wxGridWindow::OnFocus )
     EVT_KILL_FOCUS( wxGridWindow::OnFocus )
     EVT_ERASE_BACKGROUND( wxGridWindow::OnEraseBackground )
@@ -3911,8 +3910,10 @@ wxGridWindow::wxGridWindow( wxGrid *parent,
                             wxWindowID id,
                             const wxPoint &pos,
                             const wxSize &size )
-            : wxWindow( parent, id, pos, size, wxWANTS_CHARS | wxBORDER_NONE | wxCLIP_CHILDREN|wxFULL_REPAINT_ON_RESIZE,
-                        wxT("grid window") )
+            : wxWindow(
+                parent, id, pos, size,
+                wxWANTS_CHARS | wxBORDER_NONE | wxCLIP_CHILDREN | wxFULL_REPAINT_ON_RESIZE,
+                wxT("grid window") )
 {
     m_owner = parent;
     m_rowLabelWin = rowLblWin;
@@ -3924,15 +3925,15 @@ void wxGridWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
     wxPaintDC dc( this );
     m_owner->PrepareDC( dc );
     wxRegion reg = GetUpdateRegion();
-    wxGridCellCoordsArray DirtyCells = m_owner->CalcCellsExposed( reg );
-    m_owner->DrawGridCellArea( dc , DirtyCells);
+    wxGridCellCoordsArray dirtyCells = m_owner->CalcCellsExposed( reg );
+    m_owner->DrawGridCellArea( dc, dirtyCells );
 
 #if WXGRID_DRAW_LINES
     m_owner->DrawAllGridLines( dc, reg );
 #endif
 
     m_owner->DrawGridSpace( dc );
-    m_owner->DrawHighlight( dc , DirtyCells );
+    m_owner->DrawHighlight( dc, dirtyCells );
 }
 
 void wxGridWindow::ScrollWindow( int dx, int dy, const wxRect *rect )
@@ -3952,7 +3953,7 @@ void wxGridWindow::OnMouseEvent( wxMouseEvent& event )
 
 void wxGridWindow::OnMouseWheel( wxMouseEvent& event )
 {
-    m_owner->GetEventHandler()->ProcessEvent(event);
+    m_owner->GetEventHandler()->ProcessEvent( event );
 }
 
 // This seems to be required for wxMotif/wxGTK otherwise the mouse
@@ -4005,6 +4006,7 @@ static int CoordToRowOrCol(int coord, int defaultDist, int minDist,
 #define internalYToRow(y) CoordToRowOrCol(y, m_defaultRowHeight, \
                                           m_minAcceptableRowHeight, \
                                           m_rowBottoms, m_numRows, true)
+
 /////////////////////////////////////////////////////////////////////
 
 #if wxUSE_EXTENDED_RTTI
@@ -4034,7 +4036,7 @@ wxBEGIN_FLAGS( wxGridStyle )
     wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
     wxFLAGS_MEMBER(wxWANTS_CHARS)
     wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
-    wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
+    wxFLAGS_MEMBER(wxALWAYS_SHOW_SB)
     wxFLAGS_MEMBER(wxVSCROLL)
     wxFLAGS_MEMBER(wxHSCROLL)
 
@@ -4053,7 +4055,7 @@ wxEND_HANDLERS_TABLE()
 wxCONSTRUCTOR_5( wxGrid , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size , long , WindowStyle )
 
 /*
- TODO : Expose more information of a list's layout etc. via appropriate objects (\81à la NotebookPageInfo)
+ TODO : Expose more information of a list's layout, etc. via appropriate objects (e.g., NotebookPageInfo)
 */
 #else
 IMPLEMENT_DYNAMIC_CLASS( wxGrid, wxScrolledWindow )
@@ -4285,15 +4287,15 @@ bool wxGrid::SetTable( wxGridTableBase *table, bool takeOwnership,
 
         if (m_ownTable)
         {
-            wxGridTableBase *t=m_table;
-            m_table=0;
+            wxGridTableBase *t = m_table;
+            m_table = NULL;
             delete t;
         }
 
         delete m_selection;
 
-        m_table = 0;
-        m_selection = 0;
+        m_table = NULL;
+        m_selection = NULL;
         m_numRows = 0;
         m_numCols = 0;
     }
@@ -4327,10 +4329,10 @@ void wxGrid::Init()
     }
     else
     {
-        m_labelBackgroundColour = wxColour( _T("WHITE") );
+        m_labelBackgroundColour = wxColour( wxT("WHITE") );
     }
 
-    m_labelTextColour = wxColour( _T("BLACK") );
+    m_labelTextColour = wxColour( wxT("BLACK") );
 
     // init attr cache
     m_attrCache.row = -1;
@@ -4555,13 +4557,13 @@ void wxGrid::CalcWindowSizes()
         m_cornerLabelWin->SetSize( 0, 0, m_rowLabelWidth, m_colLabelHeight );
 
     if (  m_colLabelWin && m_colLabelWin->IsShown() )
-        m_colLabelWin->SetSize( m_rowLabelWidth, 0, cw-m_rowLabelWidth, m_colLabelHeight);
+        m_colLabelWin->SetSize( m_rowLabelWidth, 0, cw - m_rowLabelWidth, m_colLabelHeight);
 
     if ( m_rowLabelWin && m_rowLabelWin->IsShown() )
-        m_rowLabelWin->SetSize( 0, m_colLabelHeight, m_rowLabelWidth, ch-m_colLabelHeight);
+        m_rowLabelWin->SetSize( 0, m_colLabelHeight, m_rowLabelWidth, ch - m_colLabelHeight);
 
     if ( m_gridWin && m_gridWin->IsShown() )
-        m_gridWin->SetSize( m_rowLabelWidth, m_colLabelHeight, cw-m_rowLabelWidth, ch-m_colLabelHeight);
+        m_gridWin->SetSize( m_rowLabelWidth, m_colLabelHeight, cw - m_rowLabelWidth, ch - m_colLabelHeight);
 }
 
 
@@ -4730,6 +4732,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg )
                     attrProvider->UpdateAttrCols( 0, -GetNumberCols() );
 #endif
             }
+
             if ( !GetBatchCount() )
             {
                 CalcDimensions();
@@ -4856,6 +4859,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg )
             if (attrProvider)
             {
                 attrProvider->UpdateAttrCols( pos, -((int)numCols) );
+
 // ifdef'd out following patch from Paul Gammans
 #if 0
                 // No need to touch row attributes, unless we
@@ -4867,6 +4871,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg )
                     attrProvider->UpdateAttrRows( 0, -GetNumberRows() );
 #endif
             }
+
             if ( !GetBatchCount() )
             {
                 CalcDimensions();
@@ -5113,7 +5118,8 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event )
 
     if (m_isDragging)
     {
-        if (m_rowLabelWin->HasCapture()) m_rowLabelWin->ReleaseMouse();
+        if (m_rowLabelWin->HasCapture())
+            m_rowLabelWin->ReleaseMouse();
         m_isDragging = false;
     }
 
@@ -5169,7 +5175,6 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event )
         else
         {
             // starting to drag-resize a row
-            //
             if ( CanDragRowSize() )
                 ChangeCursorMode(WXGRID_CURSOR_RESIZE_ROW, m_rowLabelWin);
         }
@@ -5195,7 +5200,7 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event )
             AutoSizeRowLabelSize( row );
 
             ChangeCursorMode(WXGRID_CURSOR_SELECT_CELL, m_colLabelWin);
-            m_dragLastPos  = -1;
+            m_dragLastPos = -1;
         }
     }
 
@@ -5294,9 +5299,9 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event )
                     dc.SetLogicalFunction(wxINVERT);
                     if ( m_dragLastPos >= 0 )
                     {
-                        dc.DrawLine( m_dragLastPos, top, m_dragLastPos, top+ch );
+                        dc.DrawLine( m_dragLastPos, top, m_dragLastPos, top + ch );
                     }
-                    dc.DrawLine( x, top, x, top+ch );
+                    dc.DrawLine( x, top, x, top + ch );
                     m_dragLastPos = x;
                 }
                 break;
@@ -5331,7 +5336,8 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event )
 
     if (m_isDragging)
     {
-        if (m_colLabelWin->HasCapture()) m_colLabelWin->ReleaseMouse();
+        if (m_colLabelWin->HasCapture())
+            m_colLabelWin->ReleaseMouse();
         m_isDragging = false;
     }
 
@@ -5412,7 +5418,7 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event )
             AutoSizeColLabelSize( col );
 
             ChangeCursorMode(WXGRID_CURSOR_SELECT_CELL, m_colLabelWin);
-            m_dragLastPos  = -1;
+            m_dragLastPos = -1;
         }
     }
 
@@ -5431,7 +5437,7 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event )
         }
 
         ChangeCursorMode(WXGRID_CURSOR_SELECT_CELL, m_colLabelWin);
-        m_dragLastPos  = -1;
+        m_dragLastPos = -1;
     }
 
     // ------------ Right button down
@@ -5638,7 +5644,7 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
                 {
                     if ( m_selectingKeyboard == wxGridNoCellCoords)
                         m_selectingKeyboard = coords;
-                    HighlightBlock ( m_selectingKeyboard, coords );
+                    HighlightBlock( m_selectingKeyboard, coords );
                 }
                 else if ( CanDragCell() )
                 {
@@ -5704,9 +5710,9 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
             dc.SetLogicalFunction(wxINVERT);
             if ( m_dragLastPos >= 0 )
             {
-                dc.DrawLine( m_dragLastPos, top, m_dragLastPos, top+ch );
+                dc.DrawLine( m_dragLastPos, top, m_dragLastPos, top + ch );
             }
-            dc.DrawLine( x, top, x, top+ch );
+            dc.DrawLine( x, top, x, top + ch );
             m_dragLastPos = x;
         }
 
@@ -5791,7 +5797,6 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
         }
     }
 
-
     // ------------ Left double click
     //
     else if ( event.LeftDClick() && coords != wxGridNoCellCoords )
@@ -5812,7 +5817,6 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
         }
     }
 
-
     // ------------ Left button released
     //
     else if ( event.LeftUp() )
@@ -5980,7 +5984,7 @@ void wxGrid::DoEndDragResizeRow()
         wxClientDC dc( m_gridWin );
         PrepareDC( dc );
         dc.SetLogicalFunction( wxINVERT );
-        dc.DrawLine( left, m_dragLastPos, left+cw, m_dragLastPos );
+        dc.DrawLine( left, m_dragLastPos, left + cw, m_dragLastPos );
         HideCellEditControl();
         SaveEditControlValue();
 
@@ -5998,12 +6002,13 @@ void wxGrid::DoEndDragResizeRow()
             rect.height = ch - rect.y;
             m_rowLabelWin->Refresh( true, &rect );
             rect.width = cw;
+
             // if there is a multicell block, paint all of it
             if (m_table)
             {
                 int i, cell_rows, cell_cols, subtract_rows = 0;
                 int leftCol = XToCol(left);
-                int rightCol = internalXToCol(left+cw);
+                int rightCol = internalXToCol(left + cw);
                 if (leftCol >= 0)
                 {
                     for (i=leftCol; i<rightCol; i++)
@@ -6038,7 +6043,7 @@ void wxGrid::DoEndDragResizeCol()
         wxClientDC dc( m_gridWin );
         PrepareDC( dc );
         dc.SetLogicalFunction( wxINVERT );
-        dc.DrawLine( m_dragLastPos, top, m_dragLastPos, top+ch );
+        dc.DrawLine( m_dragLastPos, top, m_dragLastPos, top + ch );
         HideCellEditControl();
         SaveEditControlValue();
 
@@ -6063,7 +6068,7 @@ void wxGrid::DoEndDragResizeCol()
             {
                 int i, cell_rows, cell_cols, subtract_cols = 0;
                 int topRow = YToRow(top);
-                int bottomRow = internalYToRow(top+cw);
+                int bottomRow = internalYToRow(top + cw);
                 if (topRow >= 0)
                 {
                     for (i=topRow; i<bottomRow; i++)
@@ -6072,6 +6077,7 @@ void wxGrid::DoEndDragResizeCol()
                         if (cell_cols < subtract_cols)
                             subtract_cols = cell_cols;
                     }
+
                     rect.x = GetColLeft(m_dragRowOrCol + subtract_cols);
                     CalcScrolledPosition(rect.x, 0, &rect.x, &dummy);
                     rect.width = cw - rect.x;
@@ -6112,7 +6118,7 @@ bool wxGrid::ProcessTableMessage( wxGridTableMessage& msg )
 }
 
 // The behaviour of this function depends on the grid table class
-// Clear() function.  For the default wxGridStringTable class the
+// Clear() function. For the default wxGridStringTable class the
 // behavious is to replace all cell contents with wxEmptyString but
 // not to change the number of rows or cols.
 //
@@ -6124,7 +6130,8 @@ void wxGrid::ClearGrid()
             DisableCellEditControl();
 
         m_table->Clear();
-        if ( !GetBatchCount() ) m_gridWin->Refresh();
+        if (!GetBatchCount())
+            m_gridWin->Refresh();
     }
 }
 
@@ -6149,6 +6156,7 @@ bool wxGrid::InsertRows( int pos, int numRows, bool WXUNUSED(updateLabels) )
         // the table will have sent the results of the insert row
         // operation to this view object as a grid table message
     }
+
     return false;
 }
 
@@ -6166,9 +6174,11 @@ bool wxGrid::AppendRows( int numRows, bool WXUNUSED(updateLabels) )
     {
         bool done = m_table && m_table->AppendRows( numRows );
         return done;
+
         // the table will have sent the results of the append row
         // operation to this view object as a grid table message
     }
+
     return false;
 }
 
@@ -6192,6 +6202,7 @@ bool wxGrid::DeleteRows( int pos, int numRows, bool WXUNUSED(updateLabels) )
         // the table will have sent the results of the delete row
         // operation to this view object as a grid table message
     }
+
     return false;
 }
 
@@ -6342,27 +6353,20 @@ int wxGrid::SendEvent( const wxEventType type,
 int wxGrid::SendEvent( const wxEventType type,
                         int row, int col )
 {
-   bool claimed;
-   bool vetoed;
+   bool claimed, vetoed;
 
     if ( type == wxEVT_GRID_ROW_SIZE || type == wxEVT_GRID_COL_SIZE )
     {
         int rowOrCol = (row == -1 ? col : row);
 
-        wxGridSizeEvent gridEvt( GetId(),
-                                 type,
-                                 this,
-                                 rowOrCol );
+        wxGridSizeEvent gridEvt( GetId(), type, this, rowOrCol );
 
         claimed = GetEventHandler()->ProcessEvent(gridEvt);
         vetoed  = !gridEvt.IsAllowed();
     }
     else
     {
-        wxGridEvent gridEvt( GetId(),
-                             type,
-                             this,
-                             row, col );
+        wxGridEvent gridEvt( GetId(), type, this, row, col );
 
         claimed = GetEventHandler()->ProcessEvent(gridEvt);
         vetoed  = !gridEvt.IsAllowed();
@@ -6406,7 +6410,8 @@ void wxGrid::Refresh(bool eraseb, const wxRect* rect)
                 width_label = rectWidth;
 
             height_label = m_colLabelHeight - rect_y;
-            if (height_label > rectHeight) height_label = rectHeight;
+            if (height_label > rectHeight)
+                height_label = rectHeight;
 
             if (rect_x > m_rowLabelWidth)
             {
@@ -6490,60 +6495,41 @@ void wxGrid::OnKeyDown( wxKeyEvent& event )
     m_inOnKeyDown = true;
 
     // propagate the event up and see if it gets processed
-    //
     wxWindow *parent = GetParent();
     wxKeyEvent keyEvt( event );
     keyEvt.SetEventObject( parent );
 
     if ( !parent->GetEventHandler()->ProcessEvent( keyEvt ) )
     {
-
         // try local handlers
-        //
         switch ( event.GetKeyCode() )
         {
             case WXK_UP:
                 if ( event.ControlDown() )
-                {
                     MoveCursorUpBlock( event.ShiftDown() );
-                }
                 else
-                {
                     MoveCursorUp( event.ShiftDown() );
-                }
                 break;
 
             case WXK_DOWN:
                 if ( event.ControlDown() )
-                {
                     MoveCursorDownBlock( event.ShiftDown() );
-                }
                 else
-                {
                     MoveCursorDown( event.ShiftDown() );
-                }
                 break;
 
             case WXK_LEFT:
                 if ( event.ControlDown() )
-                {
                     MoveCursorLeftBlock( event.ShiftDown() );
-                }
                 else
-                {
                     MoveCursorLeft( event.ShiftDown() );
-                }
                 break;
 
             case WXK_RIGHT:
                 if ( event.ControlDown() )
-                {
                     MoveCursorRightBlock( event.ShiftDown() );
-                }
                 else
-                {
                     MoveCursorRight( event.ShiftDown() );
-                }
                 break;
 
             case WXK_RETURN:
@@ -6585,7 +6571,7 @@ void wxGrid::OnKeyDown( wxKeyEvent& event )
                 }
                 else
                 {
-                    if ( GetGridCursorCol() < GetNumberCols()-1 )
+                    if ( GetGridCursorCol() < GetNumberCols() - 1 )
                     {
                         MoveCursorRight( false );
                     }
@@ -6612,8 +6598,8 @@ void wxGrid::OnKeyDown( wxKeyEvent& event )
             case WXK_END:
                 if ( event.ControlDown() )
                 {
-                    MakeCellVisible( m_numRows-1, m_numCols-1 );
-                    SetCurrentCell( m_numRows-1, m_numCols-1 );
+                    MakeCellVisible( m_numRows - 1, m_numCols - 1 );
+                    SetCurrentCell( m_numRows - 1, m_numCols - 1 );
                 }
                 else
                 {
@@ -6634,21 +6620,22 @@ void wxGrid::OnKeyDown( wxKeyEvent& event )
                 {
                     if ( m_selection )
                     {
-                        m_selection->ToggleCellSelection( m_currentCellCoords.GetRow(),
-                                                          m_currentCellCoords.GetCol(),
-                                                          event.ControlDown(),
-                                                          event.ShiftDown(),
-                                                          event.AltDown(),
-                                                          event.MetaDown() );
+                        m_selection->ToggleCellSelection(
+                            m_currentCellCoords.GetRow(),
+                            m_currentCellCoords.GetCol(),
+                            event.ControlDown(),
+                            event.ShiftDown(),
+                            event.AltDown(),
+                            event.MetaDown() );
                     }
                     break;
                 }
+
                 if ( !IsEditable() )
-                {
                     MoveCursorRight( false );
-                    break;
-                }
-                // Otherwise fall through to default
+                else
+                    event.Skip();
+                break;
 
             default:
                 event.Skip();
@@ -6670,14 +6657,15 @@ void wxGrid::OnKeyUp( wxKeyEvent& event )
         {
             if ( m_selection )
             {
-                m_selection->SelectBlock( m_selectingTopLeft.GetRow(),
-                                          m_selectingTopLeft.GetCol(),
-                                          m_selectingBottomRight.GetRow(),
-                                          m_selectingBottomRight.GetCol(),
-                                          event.ControlDown(),
-                                          true,
-                                          event.AltDown(),
-                                          event.MetaDown() );
+                m_selection->SelectBlock(
+                    m_selectingTopLeft.GetRow(),
+                    m_selectingTopLeft.GetCol(),
+                    m_selectingBottomRight.GetRow(),
+                    m_selectingBottomRight.GetCol(),
+                    event.ControlDown(),
+                    true,
+                    event.AltDown(),
+                    event.MetaDown() );
             }
         }
 
@@ -6838,9 +6826,9 @@ void wxGrid::HighlightBlock( int topRow, int leftCol, int bottomRow, int rightCo
         int     i;
 
         // Store intermediate values
-        wxCoord oldLeft   = m_selectingTopLeft.GetCol();
-        wxCoord oldTop    = m_selectingTopLeft.GetRow();
-        wxCoord oldRight  = m_selectingBottomRight.GetCol();
+        wxCoord oldLeft = m_selectingTopLeft.GetCol();
+        wxCoord oldTop = m_selectingTopLeft.GetRow();
+        wxCoord oldRight = m_selectingBottomRight.GetCol();
         wxCoord oldBottom = m_selectingBottomRight.GetRow();
 
         // Determine the outer/inner coordinates.
@@ -6878,10 +6866,9 @@ void wxGrid::HighlightBlock( int topRow, int leftCol, int bottomRow, int rightCo
             // Refresh the newly selected or deselected
             // area to the left of the old or new selection.
             need_refresh[0] = true;
-            rect[0] = BlockToDeviceRect( wxGridCellCoords ( oldTop,
-                                                            oldLeft ),
-                                         wxGridCellCoords ( oldBottom,
-                                                            leftCol - 1 ) );
+            rect[0] = BlockToDeviceRect(
+                wxGridCellCoords( oldTop,  oldLeft ),
+                wxGridCellCoords( oldBottom, leftCol - 1 ) );
         }
 
         if ( oldTop < topRow )
@@ -6900,8 +6887,8 @@ void wxGrid::HighlightBlock( int topRow, int leftCol, int bottomRow, int rightCo
             // area to the right of the old or new selection.
             need_refresh[2] = true;
             rect[2] = BlockToDeviceRect(
-                wxGridCellCoords ( oldTop, rightCol + 1 ),
-                wxGridCellCoords ( oldBottom, oldRight ) );
+                wxGridCellCoords( oldTop, rightCol + 1 ),
+                wxGridCellCoords( oldBottom, oldRight ) );
         }
 
         if ( oldBottom > bottomRow )
@@ -6910,8 +6897,8 @@ void wxGrid::HighlightBlock( int topRow, int leftCol, int bottomRow, int rightCo
             // area below the old or new selection.
             need_refresh[3] = true;
             rect[3] = BlockToDeviceRect(
-                wxGridCellCoords ( bottomRow + 1, leftCol ),
-                wxGridCellCoords ( oldBottom, rightCol ) );
+                wxGridCellCoords( bottomRow + 1, leftCol ),
+                wxGridCellCoords( oldBottom, rightCol ) );
         }
 
         // various Refresh() calls
@@ -6983,7 +6970,7 @@ void wxGrid::DrawGridCellArea( wxDC& dc, const wxGridCellCoordsArray& cells )
     int row, col, cell_rows, cell_cols;
     wxGridCellCoordsArray redrawCells;
 
-    for ( i = numCells-1; i >= 0;  i-- )
+    for ( i = numCells - 1; i >= 0; i-- )
     {
         row = cells[i].GetRow();
         col = cells[i].GetCol();
@@ -6992,9 +6979,9 @@ void wxGrid::DrawGridCellArea( wxDC& dc, const wxGridCellCoordsArray& cells )
         // If this cell is part of a multicell block, find owner for repaint
         if ( cell_rows <= 0 || cell_cols <= 0 )
         {
-            wxGridCellCoords cell(row+cell_rows, col+cell_cols);
+            wxGridCellCoords cell( row + cell_rows, col + cell_cols );
             bool marked = false;
-            for ( int j = 0;  j < numCells;  j++ )
+            for ( int j = 0;  j < numCells; j++ )
             {
                 if ( cell == cells[j] )
                 {
@@ -7111,12 +7098,12 @@ void wxGrid::DrawGridSpace( wxDC& dc )
 
       if ( right > rightCol )
       {
-          dc.DrawRectangle( rightCol, top, right - rightCol, ch);
+          dc.DrawRectangle( rightCol, top, right - rightCol, ch );
       }
 
       if ( bottom > bottomRow )
       {
-          dc.DrawRectangle( left, bottomRow, cw, bottom - bottomRow);
+          dc.DrawRectangle( left, bottomRow, cw, bottom - bottomRow );
       }
   }
 }
@@ -7145,7 +7132,7 @@ void wxGrid::DrawCell( wxDC& dc, const wxGridCellCoords& coords )
     // Note: However, only if it is really _shown_, i.e. not hidden!
     if ( isCurrent && IsCellEditControlShown() )
     {
-        // OSAF NB: this "#if..." is temporary and fixes a problem where the
+        // NB: this "#if..." is temporary and fixes a problem where the
         // edit control is erased by this code after being rendered.
         // On wxMac (QD build only), the cell editor is a wxTextCntl and is rendered
         // implicitly, causing this out-of order render.
@@ -7157,8 +7144,7 @@ void wxGrid::DrawCell( wxDC& dc, const wxGridCellCoords& coords )
     }
     else
     {
-        // but all the rest is drawn by the cell renderer and hence may be
-        // customized
+        // but all the rest is drawn by the cell renderer and hence may be customized
         wxGridCellRenderer *renderer = attr->GetRenderer(this, row, col);
         renderer->Draw(*this, *attr, dc, rect, row, col, IsInSelection(coords));
         renderer->DecRef();
@@ -7186,9 +7172,9 @@ void wxGrid::DrawCellHighlight( wxDC& dc, const wxGridCellAttr *attr )
     if (penWidth > 0)
     {
         // The center of th drawn line is where the position/width/height of
-        // the rectangle is actually at, (on wxMSW atr least,) so we will
+        // the rectangle is actually at, (on wxMSW at least,) so we will
         // reduce the size of the rectangle to compensate for the thickness of
-        // the line.  If this is too strange on non wxMSW platforms then
+        // the line. If this is too strange on non wxMSW platforms then
         // please #ifdef this appropriately.
         rect.x += penWidth / 2;
         rect.y += penWidth / 2;
@@ -7222,7 +7208,7 @@ void wxGrid::DrawCellHighlight( wxDC& dc, const wxGridCellAttr *attr )
         dc.SetPen(*wxBLACK_PEN);
         dc.DrawLine(x1, y2, x2, y2);
         dc.DrawLine(x2, y1, x2, y2 + 1);
-#endif // 0
+#endif
 }
 
 void wxGrid::DrawCellBorder( wxDC& dc, const wxGridCellCoords& coords )
@@ -7237,12 +7223,10 @@ void wxGrid::DrawCellBorder( wxDC& dc, const wxGridCellCoords& coords )
     wxRect rect = CellToRect( row, col );
 
     // right hand border
-    //
     dc.DrawLine( rect.x + rect.width, rect.y,
                  rect.x + rect.width, rect.y + rect.height + 1 );
 
     // bottom border
-    //
     dc.DrawLine( rect.x, rect.y + rect.height,
                  rect.x + rect.width, rect.y + rect.height);
 }
@@ -7326,9 +7310,9 @@ void wxGrid::DrawAllGridLines( wxDC& dc, const wxRegion & WXUNUSED(reg) )
     bottom = wxMin( bottom, GetRowBottom(m_numRows - 1) );
 
     // no gridlines inside multicells, clip them out
-    int leftCol   = internalXToCol(left);
-    int topRow    = internalYToRow(top);
-    int rightCol  = internalXToCol(right);
+    int leftCol = internalXToCol(left);
+    int topRow = internalYToRow(top);
+    int rightCol = internalXToCol(right);
     int bottomRow = internalYToRow(bottom);
 
 #ifndef __WXMAC__
@@ -7351,7 +7335,7 @@ void wxGrid::DrawAllGridLines( wxDC& dc, const wxRegion & WXUNUSED(reg) )
             }
             else if ((cell_rows < 0) || (cell_cols < 0))
             {
-                rect = CellToRect(j+cell_rows, i+cell_cols);
+                rect = CellToRect(j + cell_rows, i + cell_cols);
                 CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y );
                 clippedcells.Subtract(rect);
             }
@@ -7381,6 +7365,7 @@ void wxGrid::DrawAllGridLines( wxDC& dc, const wxRegion & WXUNUSED(reg) )
         }
     }
 #endif
+
     dc.SetClippingRegion( clippedcells );
 
     dc.SetPen( wxPen(GetGridLineColour(), 1, wxSOLID) );
@@ -7418,6 +7403,7 @@ void wxGrid::DrawAllGridLines( wxDC& dc, const wxRegion & WXUNUSED(reg) )
             dc.DrawLine( colRight, top, colRight, bottom );
         }
     }
+
     dc.DestroyClippingRegion();
 }
 
@@ -7457,17 +7443,14 @@ void wxGrid::DrawRowLabel( wxDC& dc, int row )
     int rowTop = GetRowTop(row),
         rowBottom = GetRowBottom(row) - 1;
 
-    dc.SetPen( wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW),1, wxSOLID) );
-    dc.DrawLine( m_rowLabelWidth-1, rowTop,
-                 m_rowLabelWidth-1, rowBottom );
-
+    dc.SetPen( wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW), 1, wxSOLID) );
+    dc.DrawLine( m_rowLabelWidth - 1, rowTop, m_rowLabelWidth - 1, rowBottom );
     dc.DrawLine( 0, rowTop, 0, rowBottom );
-
     dc.DrawLine( 0, rowBottom, m_rowLabelWidth, rowBottom );
 
     dc.SetPen( *wxWHITE_PEN );
     dc.DrawLine( 1, rowTop, 1, rowBottom );
-    dc.DrawLine( 1, rowTop, m_rowLabelWidth-1, rowTop );
+    dc.DrawLine( 1, rowTop, m_rowLabelWidth - 1, rowTop );
 #endif
 
     dc.SetBackgroundMode( wxTRANSPARENT );
@@ -7520,16 +7503,13 @@ void wxGrid::DrawColLabel( wxDC& dc, int col )
     int colRight = GetColRight(col) - 1;
 
     dc.SetPen( wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW), 1, wxSOLID) );
-    dc.DrawLine( colRight, 0,
-                 colRight, m_colLabelHeight-1 );
-
+    dc.DrawLine( colRight, 0, colRight, m_colLabelHeight - 1 );
     dc.DrawLine( colLeft, 0, colRight, 0 );
-
-    dc.DrawLine( colLeft, m_colLabelHeight-1,
-                 colRight+1, m_colLabelHeight-1 );
+    dc.DrawLine( colLeft, m_colLabelHeight - 1,
+                 colRight + 1, m_colLabelHeight - 1 );
 
     dc.SetPen( *wxWHITE_PEN );
-    dc.DrawLine( colLeft, 1, colLeft, m_colLabelHeight-1 );
+    dc.DrawLine( colLeft, 1, colLeft, m_colLabelHeight - 1 );
     dc.DrawLine( colLeft, 1, colRight, 1 );
 #endif
 
@@ -7560,7 +7540,7 @@ void wxGrid::DrawTextRectangle( wxDC& dc,
     StringToLines( value, lines );
 
     // Forward to new API.
-    DrawTextRectangle(  dc,
+    DrawTextRectangle( dc,
         lines,
         rect,
         horizAlign,
@@ -7588,7 +7568,7 @@ void wxGrid::DrawTextRectangle( wxDC& dc,
         float x = 0.0, y = 0.0;
 
         if ( textOrientation == wxHORIZONTAL )
-            GetTextBoxSize(dc, lines, &textWidth, &textHeight);
+            GetTextBoxSize( dc, lines, &textWidth, &textHeight );
         else
             GetTextBoxSize( dc, lines, &textHeight, &textWidth );
 
@@ -7603,9 +7583,9 @@ void wxGrid::DrawTextRectangle( wxDC& dc,
 
         case wxALIGN_CENTRE:
             if ( textOrientation == wxHORIZONTAL )
-                y = rect.y + ((rect.height - textHeight)/2);
+                y = rect.y + ((rect.height - textHeight) / 2);
             else
-                x = rect.x + ((rect.width - textWidth)/2);
+                x = rect.x + ((rect.width - textWidth) / 2);
             break;
 
         case wxALIGN_TOP:
@@ -7688,6 +7668,7 @@ void wxGrid::StringToLines( const wxString& value, wxArrayString& lines )
         {
             lines.Add( value.Mid(startPos, pos) );
         }
+
         startPos += pos + 1;
     }
 
@@ -7786,8 +7767,7 @@ void wxGrid::EnableCellEditControl( bool enable )
                 return;
 
             // this should be checked by the caller!
-            wxASSERT_MSG( CanEnableCellControl(),
-                          _T("can't enable editing for this cell!") );
+            wxASSERT_MSG( CanEnableCellControl(), _T("can't enable editing for this cell!") );
 
             // do it before ShowCellEditControl()
             m_cellEditCtrlEnabled = enable;
@@ -7797,7 +7777,7 @@ void wxGrid::EnableCellEditControl( bool enable )
         else
         {
             //FIXME:add veto support
-            SendEvent( wxEVT_GRID_EDITOR_HIDDEN);
+            SendEvent( wxEVT_GRID_EDITOR_HIDDEN );
 
             HideCellEditControl();
             SaveEditControlValue();
@@ -7822,7 +7802,6 @@ bool wxGrid::CanEnableCellControl() const
 {
     return m_editable && (m_currentCellCoords != wxGridNoCellCoords) &&
         !IsCurrentCellReadOnly();
-
 }
 
 bool wxGrid::IsCellEditControlEnabled() const
@@ -7885,14 +7864,13 @@ void wxGrid::ShowCellEditControl()
             }
 
             // convert to scrolled coords
-            //
             CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y );
 
             int nXMove = 0;
             if (rect.x < 0)
                 nXMove = rect.x;
 
-            // done in PaintBackground()
+            // performed in PaintBackground()
 #if 0
             // erase the highlight and the cell contents because the editor
             // might not cover the entire cell
@@ -7901,7 +7879,7 @@ void wxGrid::ShowCellEditControl()
             dc.SetBrush(*wxLIGHT_GREY_BRUSH); //wxBrush(attr->GetBackgroundColour(), wxSOLID));
             dc.SetPen(*wxTRANSPARENT_PEN);
             dc.DrawRectangle(rect);
-#endif // 0
+#endif
 
             // cell is shifted by one pixel
             // However, don't allow x or y to become negative
@@ -8069,7 +8047,7 @@ void wxGrid::XYToCell( int x, int y, wxGridCellCoords& coords )
     int row = YToRow(y);
     int col = XToCol(x);
 
-    if ( row == -1  ||  col == -1 )
+    if ( row == -1 || col == -1 )
     {
         coords = wxGridNoCellCoords;
     }
@@ -8189,7 +8167,7 @@ int wxGrid::XToEdgeOfCol( int x )
 
     if ( GetColWidth(i) > WXGRID_LABEL_EDGE_ZONE )
     {
-        // We know that we are in column i test whether we are
+        // We know that we are in column i; test whether we are
         // close enough to right or left border, respectively.
         if ( abs(GetColRight(i) - x) < WXGRID_LABEL_EDGE_ZONE )
             return i;
@@ -8254,7 +8232,6 @@ bool wxGrid::IsVisible( int row, int col, bool wholeCellVisible )
     if ( wholeCellVisible )
     {
         // is the cell wholly visible ?
-        //
         return ( left >= 0 && right <= cw &&
                  top >= 0 && bottom <= ch );
     }
@@ -8297,7 +8274,7 @@ void wxGrid::MakeCellVisible( int row, int col )
         {
             int h = r.GetHeight();
             ypos = r.GetTop();
-            for ( i = row-1;  i >= 0;  i-- )
+            for ( i = row - 1;  i >= 0;  i-- )
             {
                 int rowHeight = GetRowHeight(i);
                 if ( h + rowHeight > ch )
@@ -8320,7 +8297,7 @@ void wxGrid::MakeCellVisible( int row, int col )
         // Otherwise, e.g. when stepping from row to row, it would jump between
         // left and right part of the cell on every step!
 //      if ( left < 0 )
-        if ( left < 0 || (right-left) >= cw )
+        if ( left < 0 || (right - left) >= cw )
         {
             xpos = r.GetLeft();
         }
@@ -8335,7 +8312,7 @@ void wxGrid::MakeCellVisible( int row, int col )
             xpos += m_scrollLineX;
         }
 
-        if ( xpos != -1  ||  ypos != -1 )
+        if ( xpos != -1 || ypos != -1 )
         {
             if ( xpos != -1 )
                 xpos /= m_scrollLineX;
@@ -8394,7 +8371,7 @@ bool wxGrid::MoveCursorDown( bool expandSelection )
         {
             if ( m_selectingKeyboard == wxGridNoCellCoords )
                 m_selectingKeyboard = m_currentCellCoords;
-            if ( m_selectingKeyboard.GetRow() < m_numRows-1 )
+            if ( m_selectingKeyboard.GetRow() < m_numRows - 1 )
             {
                 m_selectingKeyboard.SetRow( m_selectingKeyboard.GetRow() + 1 );
                 MakeCellVisible( m_selectingKeyboard.GetRow(),
@@ -8522,7 +8499,7 @@ bool wxGrid::MovePageDown()
         return false;
 
     int row = m_currentCellCoords.GetRow();
-    if ( (row+1) < m_numRows )
+    if ( (row + 1) < m_numRows )
     {
         int cw, ch;
         m_gridWin->GetClientSize( &cw, &ch );
@@ -8897,7 +8874,8 @@ void wxGrid::SetColLabelSize( int height )
         else if ( m_colLabelHeight == 0 )
         {
             m_colLabelWin->Show( true );
-            if ( m_rowLabelWidth > 0 ) m_cornerLabelWin->Show( true );
+            if ( m_rowLabelWidth > 0 )
+                m_cornerLabelWin->Show( true );
         }
 
         m_colLabelHeight = height;
@@ -9023,14 +9001,10 @@ void wxGrid::SetColLabelAlignment( int horiz, int vert )
 void wxGrid::SetColLabelTextOrientation( int textOrientation )
 {
     if ( textOrientation == wxHORIZONTAL || textOrientation == wxVERTICAL )
-    {
         m_colLabelTextOrientation = textOrientation;
-    }
 
     if ( !GetBatchCount() )
-    {
         m_colLabelWin->Refresh();
-    }
 }
 
 void wxGrid::SetRowLabelValue( int row, const wxString& s )
@@ -9040,7 +9014,7 @@ void wxGrid::SetRowLabelValue( int row, const wxString& s )
         m_table->SetRowLabelValue( row, s );
         if ( !GetBatchCount() )
         {
-            wxRect rect = CellToRect( row, 0);
+            wxRect rect = CellToRect( row, 0 );
             if ( rect.height > 0 )
             {
                 CalcScrolledPosition(0, rect.y, &rect.x, &rect.y);
@@ -9127,6 +9101,7 @@ void wxGrid::SetCellHighlightROPenWidth(int width)
         int col = m_currentCellCoords.GetCol();
         if ( GetColWidth(col) <= 0 || GetRowHeight(row) <= 0 )
             return;
+
         wxRect rect = CellToRect(row, col);
         m_gridWin->Refresh(true, &rect);
     }
@@ -9695,19 +9670,19 @@ void wxGrid::RegisterDataType(const wxString& typeName,
 }
 
 
-wxGridCellEditor* wxGrid::GetDefaultEditorForCell(int row, int col) const
+wxGridCellEditor * wxGrid::GetDefaultEditorForCell(int row, int col) const
 {
     wxString typeName = m_table->GetTypeName(row, col);
     return GetDefaultEditorForType(typeName);
 }
 
-wxGridCellRenderer* wxGrid::GetDefaultRendererForCell(int row, int col) const
+wxGridCellRenderer * wxGrid::GetDefaultRendererForCell(int row, int col) const
 {
     wxString typeName = m_table->GetTypeName(row, col);
     return GetDefaultRendererForType(typeName);
 }
 
-wxGridCellEditor* wxGrid::GetDefaultEditorForType(const wxString& typeName) const
+wxGridCellEditor * wxGrid::GetDefaultEditorForType(const wxString& typeName) const
 {
     int index = m_typeRegistry->FindOrCloneDataType(typeName);
     if ( index == wxNOT_FOUND )
@@ -9723,7 +9698,7 @@ wxGridCellEditor* wxGrid::GetDefaultEditorForType(const wxString& typeName) cons
     return m_typeRegistry->GetEditor(index);
 }
 
-wxGridCellRenderer* wxGrid::GetDefaultRendererForType(const wxString& typeName) const
+wxGridCellRenderer * wxGrid::GetDefaultRendererForType(const wxString& typeName) const
 {
     int index = m_typeRegistry->FindOrCloneDataType(typeName);
     if ( index == wxNOT_FOUND )
@@ -9833,7 +9808,7 @@ void wxGrid::SetColSize( int col, int width )
     //                                                                 (VZ)
     // No, because it is reasonable to assume the library user know's
     // what he is doing. However whe should test against the weaker
-    // constariant of minimalAcceptableWidth, as this breaks rendering
+    // constraint of minimalAcceptableWidth, as this breaks rendering
     //
     // This test then fixes sf.net bug #645734
 
@@ -10034,7 +10009,7 @@ void wxGrid::AutoSizeColOrRow( int colOrRow, bool setAsMin, bool column )
         {
             int cw, ch, dummy;
             m_gridWin->GetClientSize( &cw, &ch );
-            wxRect rect ( CellToRect( row, 0 ) );
+            wxRect rect( CellToRect( row, 0 ) );
             rect.x = 0;
             CalcScrolledPosition(0, rect.y, &dummy, &rect.y);
             rect.width = m_rowLabelWidth;
@@ -10108,7 +10083,7 @@ void wxGrid::AutoSize()
     // scrollbar steps
     wxSize sizeFit(
         GetScrollX(size.x + m_extraWidth + 1) * m_scrollLineX,
-        GetScrollY(size.y + m_extraHeight + 1) * m_scrollLineY);
+        GetScrollY(size.y + m_extraHeight + 1) * m_scrollLineY );
 
     // distribute the extra space between the columns/rows to avoid having
     // extra white space
@@ -10184,7 +10159,7 @@ void wxGrid::AutoSizeRowLabelSize( int row )
     // autosize row height depending on label text
     StringToLines( GetRowLabelValue( row ), lines );
     wxClientDC dc( m_rowLabelWin );
-    GetTextBoxSize( dc, lines, &w, &h);
+    GetTextBoxSize( dc, lines, &w, &h );
     if ( h < m_defaultRowHeight )
         h = m_defaultRowHeight;
     SetRowSize(row, h);
@@ -10341,7 +10316,7 @@ void wxGrid::SelectAll()
     if ( m_numRows > 0 && m_numCols > 0 )
     {
         if ( m_selection )
-            m_selection->SelectBlock( 0, 0, m_numRows-1, m_numCols-1 );
+            m_selection->SelectBlock( 0, 0, m_numRows - 1, m_numCols - 1 );
     }
 }