X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7db713aea6713ef70756179ee88e7ab4bccb2e0d..15f0ad701496612df8c145e8e46d4b38515c0bbf:/src/generic/grid.cpp diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index f5fcc66684..b108ed7eb1 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// Name: generic/grid.cpp +// Name: src/generic/grid.cpp // Purpose: wxGrid and related classes // Author: Michael Bedward (based on code by Julian Smart, Robin Dunn) // Modified by: Robin Dunn, Vadim Zeitlin @@ -1616,7 +1616,7 @@ void wxGridCellEditorEvtHandler::OnChar(wxKeyEvent& event) // get the widths of all cells previous to this one int colXPos = 0; - for ( int i = 0; i < col; i++ ) + for ( int i = 0; i < col; i++ ) { colXPos += m_grid->GetColSize(i); } @@ -1667,7 +1667,7 @@ void wxGridCellEditorEvtHandler::OnChar(wxKeyEvent& event) // get the widths of all cells previous to this one int colXPos = 0; - for ( int i = 0; i < col; i++ ) + for ( int i = 0; i < col; i++ ) { colXPos += m_grid->GetColSize(i); } @@ -5785,7 +5785,6 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event ) m_waitForSlowClick = true; } } - } @@ -5801,7 +5800,7 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event ) m_winCapture = NULL; } - if ( coords == m_currentCellCoords && m_waitForSlowClick && CanEnableCellControl()) + if ( coords == m_currentCellCoords && m_waitForSlowClick && CanEnableCellControl() ) { ClearSelection(); EnableCellEditControl(); @@ -6609,11 +6608,11 @@ void wxGrid::OnKeyDown( wxKeyEvent& event ) } break; - case WXK_PRIOR: + case WXK_PAGEUP: MovePageUp(); break; - case WXK_NEXT: + case WXK_PAGEDOWN: MovePageDown(); break; @@ -6729,8 +6728,8 @@ void wxGrid::SetCurrentCell( const wxGridCellCoords& coords ) return; } - wxClientDC dc(m_gridWin); - PrepareDC(dc); + wxClientDC dc( m_gridWin ); + PrepareDC( dc ); if ( m_currentCellCoords != wxGridNoCellCoords ) { @@ -6739,7 +6738,7 @@ void wxGrid::SetCurrentCell( const wxGridCellCoords& coords ) if ( IsVisible( m_currentCellCoords, false ) ) { wxRect r; - r = BlockToDeviceRect(m_currentCellCoords, m_currentCellCoords); + r = BlockToDeviceRect( m_currentCellCoords, m_currentCellCoords ); if ( !m_gridLinesEnabled ) { r.x--; @@ -6753,15 +6752,15 @@ void wxGrid::SetCurrentCell( const wxGridCellCoords& coords ) // Otherwise refresh redraws the highlight! m_currentCellCoords = coords; - DrawGridCellArea(dc,cells); + DrawGridCellArea( dc, cells ); DrawAllGridLines( dc, r ); } } m_currentCellCoords = coords; - wxGridCellAttr* attr = GetCellAttr(coords); - DrawCellHighlight(dc, attr); + wxGridCellAttr *attr = GetCellAttr( coords ); + DrawCellHighlight( dc, attr ); attr->DecRef(); } @@ -7665,7 +7664,7 @@ void wxGrid::StringToLines( const wxString& value, wxArrayString& lines ) wxString eol = wxTextFile::GetEOL( wxTextFileType_Unix ); wxString tVal = wxTextFile::Translate( value, wxTextFileType_Unix ); - while ( startPos < (int)tVal.Length() ) + while ( startPos < (int)tVal.length() ) { pos = tVal.Mid(startPos).Find( eol ); if ( pos < 0 ) @@ -7683,7 +7682,7 @@ void wxGrid::StringToLines( const wxString& value, wxArrayString& lines ) startPos += pos + 1; } - if ( startPos < (int)value.Length() ) + if ( startPos < (int)value.length() ) { lines.Add( value.Mid( startPos ) ); } @@ -7772,9 +7771,6 @@ void wxGrid::EnableCellEditControl( bool enable ) if (! m_editable) return; - if ( m_currentCellCoords == wxGridNoCellCoords ) - SetCurrentCell( 0, 0 ); - if ( enable != m_cellEditCtrlEnabled ) { if ( enable ) @@ -7886,7 +7882,7 @@ void wxGrid::ShowCellEditControl() CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y ); int nXMove = 0; - if(rect.x < 0) + if (rect.x < 0) nXMove = rect.x; // done in PaintBackground() @@ -7950,33 +7946,34 @@ void wxGrid::ShowCellEditControl() int c_rows, c_cols; GetCellSize( row, i, &c_rows, &c_cols ); // looks weird going over a multicell - if (m_table->IsEmptyCell(row,i) && + if (m_table->IsEmptyCell( row, i ) && (rect.width < maxWidth) && (c_rows == 1)) - rect.width += GetColWidth(i); + rect.width += GetColWidth( i ); else break; } if (rect.GetRight() > client_right) - rect.SetRight(client_right - 1); + rect.SetRight( client_right - 1 ); } - editor->SetCellAttr(attr); + editor->SetCellAttr( attr ); editor->SetSize( rect ); - editor->GetControl()->Move(editor->GetControl()->GetPosition().x + nXMove, editor->GetControl()->GetPosition().y); + editor->GetControl()->Move( editor->GetControl()->GetPosition().x + nXMove, editor->GetControl()->GetPosition().y ); editor->Show( true, attr ); int colXPos = 0; - for (int i = 0; i < m_currentCellCoords.GetCol(); i++) + for (int i = 0; i < m_currentCellCoords.GetCol(); i++) { - colXPos += GetColSize(i); + colXPos += GetColSize( i ); } - int xUnit=1, yUnit=1; - GetScrollPixelsPerUnit(&xUnit, &yUnit); + + int xUnit = 1, yUnit = 1; + GetScrollPixelsPerUnit( &xUnit, &yUnit ); if (m_currentCellCoords.GetCol() != 0) - Scroll(colXPos/xUnit-1, GetScrollPos(wxVERTICAL)); + Scroll( colXPos / xUnit - 1, GetScrollPos( wxVERTICAL ) ); else - Scroll(colXPos/xUnit, GetScrollPos(wxVERTICAL)); + Scroll( colXPos / xUnit, GetScrollPos( wxVERTICAL ) ); // recalc dimensions in case we need to // expand the scrolled window to account for editor @@ -7998,7 +7995,7 @@ void wxGrid::HideCellEditControl() int row = m_currentCellCoords.GetRow(); int col = m_currentCellCoords.GetCol(); - wxGridCellAttr* attr = GetCellAttr(row, col); + wxGridCellAttr *attr = GetCellAttr(row, col); wxGridCellEditor *editor = attr->GetEditor(this, row, col); editor->Show( false ); editor->DecRef(); @@ -8308,7 +8305,7 @@ void wxGrid::MakeCellVisible( int row, int col ) } // special handling for wide cells - show always left part of the cell! - // Otherwise, e.g. when stepping from row to row, it would jump between + // 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 ) @@ -8348,7 +8345,7 @@ bool wxGrid::MoveCursorUp( bool expandSelection ) if ( m_currentCellCoords != wxGridNoCellCoords && m_currentCellCoords.GetRow() >= 0 ) { - if ( expandSelection) + if ( expandSelection ) { if ( m_selectingKeyboard == wxGridNoCellCoords ) m_selectingKeyboard = m_currentCellCoords; @@ -9705,7 +9702,7 @@ wxGrid::GetDefaultEditorForType(const wxString& typeName) const int index = m_typeRegistry->FindOrCloneDataType(typeName); if ( index == wxNOT_FOUND ) { - wxString errStr; + wxString errStr; errStr.Printf(wxT("Unknown data type name [%s]"), typeName.c_str()); wxFAIL_MSG(errStr.c_str()); @@ -10651,4 +10648,3 @@ wxGridEditorCreatedEvent::wxGridEditorCreatedEvent(int id, wxEventType type, } #endif // wxUSE_GRID -