X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b99be8fb783c506bd71f6ae156a1f2fba0303037..80a58c9968cc740b50fb92cd95d6a014a1c6e9bf:/src/generic/grid.cpp diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index b8e9d144cc..006465a559 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -31,10 +31,11 @@ #include "wx/dcclient.h" #include "wx/settings.h" #include "wx/log.h" - #include "wx/sizer.h" - #include "wx/layout.h" #endif +// this include needs to be outside precomp for BCC +#include "wx/textfile.h" + #include "wx/generic/grid.h" // ---------------------------------------------------------------------------- @@ -320,59 +321,50 @@ void wxGridTableBase::SetAttr(const wxGridCellAttr *attr, int row, int col ) } } -// FIXME VZ: these should be wxFAIL_MSG(), not wxLogWarning, they're for the -// programmer, not the user! - bool wxGridTableBase::InsertRows( size_t pos, size_t numRows ) { - wxLogWarning( wxT("Called grid table class function InsertRows(pos=%d, N=%d)\n" - "but your derived table class does not override this function"), - pos, numRows ); + wxFAIL_MSG( wxT("Called grid table class function InsertRows\n" + "but your derived table class does not override this function") ); return FALSE; } bool wxGridTableBase::AppendRows( size_t numRows ) { - wxLogWarning( wxT("Called grid table class function AppendRows(N=%d)\n" - "but your derived table class does not override this function"), - numRows ); + wxFAIL_MSG( wxT("Called grid table class function AppendRows\n" + "but your derived table class does not override this function")); return FALSE; } bool wxGridTableBase::DeleteRows( size_t pos, size_t numRows ) { - wxLogWarning( wxT("Called grid table class function DeleteRows(pos=%d, N=%d)\n" - "but your derived table class does not override this function"), - pos, numRows ); + wxFAIL_MSG( wxT("Called grid table class function DeleteRows\n" + "but your derived table class does not override this function")); return FALSE; } bool wxGridTableBase::InsertCols( size_t pos, size_t numCols ) { - wxLogWarning( wxT("Called grid table class function InsertCols(pos=%d, N=%d)\n" - "but your derived table class does not override this function"), - pos, numCols ); + wxFAIL_MSG( wxT("Called grid table class function InsertCols\n" + "but your derived table class does not override this function")); return FALSE; } bool wxGridTableBase::AppendCols( size_t numCols ) { - wxLogWarning( wxT("Called grid table class function AppendCols(N=%d)\n" - "but your derived table class does not override this function"), - numCols ); + wxFAIL_MSG(wxT("Called grid table class function AppendCols\n" + "but your derived table class does not override this function")); return FALSE; } bool wxGridTableBase::DeleteCols( size_t pos, size_t numCols ) { - wxLogWarning( wxT("Called grid table class function DeleteCols(pos=%d, N=%d)\n" - "but your derived table class does not override this function"), - pos, numCols ); + wxFAIL_MSG( wxT("Called grid table class function DeleteCols\n" + "but your derived table class does not override this function")); return FALSE; } @@ -612,9 +604,11 @@ bool wxGridStringTable::DeleteRows( size_t pos, size_t numRows ) if ( pos >= curNumRows ) { - wxLogError( wxT("Called wxGridStringTable::DeleteRows(pos=%d, N=%d)...\n" - "Pos value is invalid for present table with %d rows"), - pos, numRows, curNumRows ); + wxString errmsg; + errmsg.Printf("Called wxGridStringTable::DeleteRows(pos=%d, N=%d)\n" + "Pos value is invalid for present table with %d rows", + pos, numRows, curNumRows ); + wxFAIL_MSG( wxT(errmsg) ); return FALSE; } @@ -690,8 +684,8 @@ bool wxGridStringTable::AppendCols( size_t numCols ) { // TODO: something better than this ? // - wxLogError( wxT("Unable to append cols to a grid table with no rows.\n" - "Call AppendRows() first") ); + wxFAIL_MSG( wxT("Unable to append cols to a grid table with no rows.\n" + "Call AppendRows() first") ); return FALSE; } @@ -724,9 +718,11 @@ bool wxGridStringTable::DeleteCols( size_t pos, size_t numCols ) if ( pos >= curNumCols ) { - wxLogError( wxT("Called wxGridStringTable::DeleteCols(pos=%d, N=%d)...\n" - "Pos value is invalid for present table with %d cols"), - pos, numCols, curNumCols ); + wxString errmsg; + errmsg.Printf( "Called wxGridStringTable::DeleteCols(pos=%d, N=%d)...\n" + "Pos value is invalid for present table with %d cols", + pos, numCols, curNumCols ); + wxFAIL_MSG( wxT( errmsg ) ); return FALSE; } @@ -1234,7 +1230,7 @@ bool wxGrid::CreateGrid( int numRows, int numCols ) { if ( m_created ) { - wxLogError( wxT("wxGrid::CreateGrid(numRows, numCols) called more than once") ); + wxFAIL_MSG( wxT("wxGrid::CreateGrid called more than once") ); return FALSE; } else @@ -1714,7 +1710,6 @@ void wxGrid::CalcCellsExposed( wxRegion& reg ) CalcUnscrolledPosition( r.GetLeft(), r.GetTop(), &left, &top ); CalcUnscrolledPosition( r.GetRight(), r.GetBottom(), &right, &bottom ); - left++; top++; // find the cells within these bounds // int row, col; @@ -1794,9 +1789,18 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event ) m_isDragging = FALSE; + // ------------ Entering or leaving the window + // + if ( event.Entering() || event.Leaving() ) + { + m_cursorMode = WXGRID_CURSOR_SELECT_CELL; + m_rowLabelWin->SetCursor( *wxSTANDARD_CURSOR ); + } + + // ------------ Left button pressed // - if ( event.LeftDown() ) + else if ( event.LeftDown() ) { // don't send a label click event for a hit on the // edge of the row label - this is probably the user @@ -1840,43 +1844,12 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event ) if ( m_cursorMode == WXGRID_CURSOR_RESIZE_ROW ) { m_rowLabelWin->ReleaseMouse(); + DoEndDragResizeRow(); - if ( m_dragLastPos >= 0 ) - { - // erase the last line and resize the row - // - int cw, ch, left, dummy; - m_gridWin->GetClientSize( &cw, &ch ); - CalcUnscrolledPosition( 0, 0, &left, &dummy ); - - wxClientDC dc( m_gridWin ); - PrepareDC( dc ); - dc.SetLogicalFunction( wxINVERT ); - dc.DrawLine( left, m_dragLastPos, left+cw, m_dragLastPos ); - HideCellEditControl(); - - int rowTop = m_rowBottoms[m_dragRowOrCol] - m_rowHeights[m_dragRowOrCol]; - SetRowSize( m_dragRowOrCol, wxMax( y - rowTop, WXGRID_MIN_ROW_HEIGHT ) ); - if ( !GetBatchCount() ) - { - // Only needed to get the correct rect.y: - wxRect rect ( CellToRect( m_dragRowOrCol, 0 ) ); - rect.x = 0; - CalcScrolledPosition(0, rect.y, &dummy, &rect.y); - rect.width = m_rowLabelWidth; - rect.height = ch - rect.y; - m_rowLabelWin->Refresh( TRUE, &rect ); - rect.width = cw; - m_gridWin->Refresh( FALSE, &rect ); - } - - ShowCellEditControl(); - - // Note: we are ending the event *after* doing - // default processing in this case - // - SendEvent( EVT_GRID_ROW_SIZE, m_dragRowOrCol, -1, event ); - } + // Note: we are ending the event *after* doing + // default processing in this case + // + SendEvent( EVT_GRID_ROW_SIZE, m_dragRowOrCol, -1, event ); } m_cursorMode = WXGRID_CURSOR_SELECT_CELL; @@ -1921,11 +1894,10 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event ) m_rowLabelWin->SetCursor( m_rowResizeCursor ); } } - else + else if ( m_cursorMode != WXGRID_CURSOR_SELECT_CELL ) { m_cursorMode = WXGRID_CURSOR_SELECT_CELL; - if ( m_rowLabelWin->GetCursor() == m_rowResizeCursor ) - m_rowLabelWin->SetCursor( *wxSTANDARD_CURSOR ); + m_rowLabelWin->SetCursor( *wxSTANDARD_CURSOR ); } } } @@ -1980,9 +1952,18 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event ) m_isDragging = FALSE; + // ------------ Entering or leaving the window + // + if ( event.Entering() || event.Leaving() ) + { + m_cursorMode = WXGRID_CURSOR_SELECT_CELL; + m_colLabelWin->SetCursor( *wxSTANDARD_CURSOR ); + } + + // ------------ Left button pressed // - if ( event.LeftDown() ) + else if ( event.LeftDown() ) { // don't send a label click event for a hit on the // edge of the col label - this is probably the user @@ -2026,44 +2007,12 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event ) if ( m_cursorMode == WXGRID_CURSOR_RESIZE_COL ) { m_colLabelWin->ReleaseMouse(); - - if ( m_dragLastPos >= 0 ) - { - // erase the last line and resize the col - // - int cw, ch, dummy, top; - m_gridWin->GetClientSize( &cw, &ch ); - CalcUnscrolledPosition( 0, 0, &dummy, &top ); - - wxClientDC dc( m_gridWin ); - PrepareDC( dc ); - dc.SetLogicalFunction( wxINVERT ); - dc.DrawLine( m_dragLastPos, top, m_dragLastPos, top+ch ); - HideCellEditControl(); - - int colLeft = m_colRights[m_dragRowOrCol] - m_colWidths[m_dragRowOrCol]; - SetColSize( m_dragRowOrCol, wxMax( x - colLeft, WXGRID_MIN_COL_WIDTH ) ); - - if ( !GetBatchCount() ) - { - // Only needed to get the correct rect.x: - wxRect rect ( CellToRect( 0, m_dragRowOrCol ) ); - rect.y = 0; - CalcScrolledPosition(rect.x, 0, &rect.x, &dummy); - rect.width = cw - rect.x; - rect.height = m_colLabelHeight; - m_colLabelWin->Refresh( TRUE, &rect ); - rect.height = ch; - m_gridWin->Refresh( FALSE, &rect ); - } - - ShowCellEditControl(); - - // Note: we are ending the event *after* doing - // default processing in this case - // - SendEvent( EVT_GRID_COL_SIZE, -1, m_dragRowOrCol, event ); - } + DoEndDragResizeCol(); + + // Note: we are ending the event *after* doing + // default processing in this case + // + SendEvent( EVT_GRID_COL_SIZE, -1, m_dragRowOrCol, event ); } m_cursorMode = WXGRID_CURSOR_SELECT_CELL; @@ -2108,11 +2057,10 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event ) m_colLabelWin->SetCursor( m_colResizeCursor ); } } - else + else if ( m_cursorMode != WXGRID_CURSOR_SELECT_CELL ) { m_cursorMode = WXGRID_CURSOR_SELECT_CELL; - if ( m_colLabelWin->GetCursor() == m_colResizeCursor ) - m_colLabelWin->SetCursor( *wxSTANDARD_CURSOR ); + m_colLabelWin->SetCursor( *wxSTANDARD_CURSOR ); } } } @@ -2184,7 +2132,39 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event ) } } } + else if ( m_cursorMode == WXGRID_CURSOR_RESIZE_ROW ) + { + int cw, ch, left, dummy; + m_gridWin->GetClientSize( &cw, &ch ); + CalcUnscrolledPosition( 0, 0, &left, &dummy ); + wxClientDC dc( m_gridWin ); + PrepareDC( dc ); + dc.SetLogicalFunction(wxINVERT); + if ( m_dragLastPos >= 0 ) + { + dc.DrawLine( left, m_dragLastPos, left+cw, m_dragLastPos ); + } + dc.DrawLine( left, y, left+cw, y ); + m_dragLastPos = y; + } + else if ( m_cursorMode == WXGRID_CURSOR_RESIZE_COL ) + { + int cw, ch, dummy, top; + m_gridWin->GetClientSize( &cw, &ch ); + CalcUnscrolledPosition( 0, 0, &dummy, &top ); + + wxClientDC dc( m_gridWin ); + PrepareDC( dc ); + dc.SetLogicalFunction(wxINVERT); + if ( m_dragLastPos >= 0 ) + { + dc.DrawLine( m_dragLastPos, top, m_dragLastPos, top+ch ); + } + dc.DrawLine( x, top, x, top+ch ); + m_dragLastPos = x; + } + return; } @@ -2192,13 +2172,22 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event ) if ( coords != wxGridNoCellCoords ) { - if ( event.LeftDown() ) + if ( event.Entering() || event.Leaving() ) + { + m_cursorMode = WXGRID_CURSOR_SELECT_CELL; + m_gridWin->SetCursor( *wxSTANDARD_CURSOR ); + } + + // ------------ Left button pressed + // + else if ( event.LeftDown() ) { if ( event.ShiftDown() ) { SelectBlock( m_currentCellCoords, coords ); } - else + else if ( XToEdgeOfCol(x) < 0 && + YToEdgeOfRow(y) < 0 ) { if ( !SendEvent( EVT_GRID_CELL_LEFT_CLICK, coords.GetRow(), @@ -2216,10 +2205,13 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event ) // else if ( event.LeftDClick() ) { - SendEvent( EVT_GRID_CELL_LEFT_DCLICK, - coords.GetRow(), - coords.GetCol(), - event ); + if ( XToEdgeOfCol(x) < 0 && YToEdgeOfRow(y) < 0 ) + { + SendEvent( EVT_GRID_CELL_LEFT_DCLICK, + coords.GetRow(), + coords.GetCol(), + event ); + } } @@ -2233,13 +2225,33 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event ) { SendEvent( EVT_GRID_RANGE_SELECT, -1, -1, event ); } - } - // Show the edit control, if it has - // been hidden for drag-shrinking. - if ( IsCellEditControlEnabled() ) - ShowCellEditControl(); + // Show the edit control, if it has + // been hidden for drag-shrinking. + if ( IsCellEditControlEnabled() ) + ShowCellEditControl(); + } + else if ( m_cursorMode == WXGRID_CURSOR_RESIZE_ROW ) + { + m_gridWin->ReleaseMouse(); + DoEndDragResizeRow(); + // Note: we are ending the event *after* doing + // default processing in this case + // + SendEvent( EVT_GRID_ROW_SIZE, m_dragRowOrCol, -1, event ); + } + else if ( m_cursorMode == WXGRID_CURSOR_RESIZE_COL ) + { + m_gridWin->ReleaseMouse(); + DoEndDragResizeCol(); + + // Note: we are ending the event *after* doing + // default processing in this case + // + SendEvent( EVT_GRID_COL_SIZE, -1, m_dragRowOrCol, event ); + } + m_dragLastPos = -1; } @@ -2275,12 +2287,134 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event ) // else if ( event.Moving() && !event.IsButton() ) { - m_cursorMode = WXGRID_CURSOR_SELECT_CELL; + int dragRow = YToEdgeOfRow( y ); + int dragCol = XToEdgeOfCol( x ); + + // Dragging on the corner of a cell to resize in both + // directions is not implemented yet... + // + if ( dragRow >= 0 && dragCol >= 0 ) + { + m_cursorMode = WXGRID_CURSOR_SELECT_CELL; + m_gridWin->SetCursor( *wxSTANDARD_CURSOR ); + return; + } + + if ( dragRow >= 0 ) + { + m_dragRowOrCol = dragRow; + + if ( m_cursorMode == WXGRID_CURSOR_SELECT_CELL ) + { + m_cursorMode = WXGRID_CURSOR_RESIZE_ROW; + m_gridWin->SetCursor( m_rowResizeCursor ); + } + + return; + } + + if ( dragCol >= 0 ) + { + m_dragRowOrCol = dragCol; + + if ( m_cursorMode == WXGRID_CURSOR_SELECT_CELL ) + { + m_cursorMode = WXGRID_CURSOR_RESIZE_COL; + m_gridWin->SetCursor( m_colResizeCursor ); + } + + return; + } + + // Neither on a row or col edge + // + if ( m_cursorMode != WXGRID_CURSOR_SELECT_CELL ) + { + m_cursorMode = WXGRID_CURSOR_SELECT_CELL; + m_gridWin->SetCursor( *wxSTANDARD_CURSOR ); + } } } } +void wxGrid::DoEndDragResizeRow() +{ + if ( m_dragLastPos >= 0 ) + { + // erase the last line and resize the row + // + int cw, ch, left, dummy; + m_gridWin->GetClientSize( &cw, &ch ); + CalcUnscrolledPosition( 0, 0, &left, &dummy ); + + wxClientDC dc( m_gridWin ); + PrepareDC( dc ); + dc.SetLogicalFunction( wxINVERT ); + dc.DrawLine( left, m_dragLastPos, left+cw, m_dragLastPos ); + HideCellEditControl(); + + int rowTop = m_rowBottoms[m_dragRowOrCol] - m_rowHeights[m_dragRowOrCol]; + SetRowSize( m_dragRowOrCol, + wxMax( m_dragLastPos - rowTop, WXGRID_MIN_ROW_HEIGHT ) ); + + if ( !GetBatchCount() ) + { + // Only needed to get the correct rect.y: + wxRect rect ( CellToRect( m_dragRowOrCol, 0 ) ); + rect.x = 0; + CalcScrolledPosition(0, rect.y, &dummy, &rect.y); + rect.width = m_rowLabelWidth; + rect.height = ch - rect.y; + m_rowLabelWin->Refresh( TRUE, &rect ); + rect.width = cw; + m_gridWin->Refresh( FALSE, &rect ); + } + + ShowCellEditControl(); + } +} + + +void wxGrid::DoEndDragResizeCol() +{ + if ( m_dragLastPos >= 0 ) + { + // erase the last line and resize the col + // + int cw, ch, dummy, top; + m_gridWin->GetClientSize( &cw, &ch ); + CalcUnscrolledPosition( 0, 0, &dummy, &top ); + + wxClientDC dc( m_gridWin ); + PrepareDC( dc ); + dc.SetLogicalFunction( wxINVERT ); + dc.DrawLine( m_dragLastPos, top, m_dragLastPos, top+ch ); + HideCellEditControl(); + + int colLeft = m_colRights[m_dragRowOrCol] - m_colWidths[m_dragRowOrCol]; + SetColSize( m_dragRowOrCol, + wxMax( m_dragLastPos - colLeft, WXGRID_MIN_COL_WIDTH ) ); + + if ( !GetBatchCount() ) + { + // Only needed to get the correct rect.x: + wxRect rect ( CellToRect( 0, m_dragRowOrCol ) ); + rect.y = 0; + CalcScrolledPosition(rect.x, 0, &rect.x, &dummy); + rect.width = cw - rect.x; + rect.height = m_colLabelHeight; + m_colLabelWin->Refresh( TRUE, &rect ); + rect.height = ch; + m_gridWin->Refresh( FALSE, &rect ); + } + + ShowCellEditControl(); + } +} + + + // // ------ interaction with data model // @@ -2331,7 +2465,7 @@ bool wxGrid::InsertRows( int pos, int numRows, bool WXUNUSED(updateLabels) ) if ( !m_created ) { - wxLogError( wxT("Called wxGrid::InsertRows() before calling CreateGrid()") ); + wxFAIL_MSG( wxT("Called wxGrid::InsertRows() before calling CreateGrid()") ); return FALSE; } @@ -2381,7 +2515,7 @@ bool wxGrid::AppendRows( int numRows, bool WXUNUSED(updateLabels) ) if ( !m_created ) { - wxLogError( wxT("Called wxGrid::AppendRows() before calling CreateGrid()") ); + wxFAIL_MSG( wxT("Called wxGrid::AppendRows() before calling CreateGrid()") ); return FALSE; } @@ -2415,7 +2549,7 @@ bool wxGrid::DeleteRows( int pos, int numRows, bool WXUNUSED(updateLabels) ) if ( !m_created ) { - wxLogError( wxT("Called wxGrid::DeleteRows() before calling CreateGrid()") ); + wxFAIL_MSG( wxT("Called wxGrid::DeleteRows() before calling CreateGrid()") ); return FALSE; } @@ -2446,7 +2580,7 @@ bool wxGrid::InsertCols( int pos, int numCols, bool WXUNUSED(updateLabels) ) if ( !m_created ) { - wxLogError( wxT("Called wxGrid::InsertCols() before calling CreateGrid()") ); + wxFAIL_MSG( wxT("Called wxGrid::InsertCols() before calling CreateGrid()") ); return FALSE; } @@ -2488,7 +2622,7 @@ bool wxGrid::AppendCols( int numCols, bool WXUNUSED(updateLabels) ) if ( !m_created ) { - wxLogError( wxT("Called wxGrid::AppendCols() before calling CreateGrid()") ); + wxFAIL_MSG( wxT("Called wxGrid::AppendCols() before calling CreateGrid()") ); return FALSE; } @@ -2522,7 +2656,7 @@ bool wxGrid::DeleteCols( int pos, int numCols, bool WXUNUSED(updateLabels) ) if ( !m_created ) { - wxLogError( wxT("Called wxGrid::DeleteCols() before calling CreateGrid()") ); + wxFAIL_MSG( wxT("Called wxGrid::DeleteCols() before calling CreateGrid()") ); return FALSE; } @@ -2670,7 +2804,7 @@ void wxGrid::OnKeyDown( wxKeyEvent& event ) { // shouldn't be here - we are going round in circles... // - wxLogFatalError( wxT("wxGrid::OnKeyDown called while alread active") ); + wxFAIL_MSG( wxT("wxGrid::OnKeyDown called while alread active") ); } m_inOnKeyDown = TRUE; @@ -2922,13 +3056,13 @@ void wxGrid::DrawCellBorder( wxDC& dc, const wxGridCellCoords& coords ) // right hand border // - dc.DrawLine( m_colRights[col]-1, m_rowBottoms[row] - m_rowHeights[row], - m_colRights[col]-1, m_rowBottoms[row]-1 ); + dc.DrawLine( m_colRights[col], m_rowBottoms[row] - m_rowHeights[row], + m_colRights[col], m_rowBottoms[row] ); // bottom border // - dc.DrawLine( m_colRights[col] - m_colWidths[col], m_rowBottoms[row]-1, - m_colRights[col]-1, m_rowBottoms[row]-1 ); + dc.DrawLine( m_colRights[col] - m_colWidths[col], m_rowBottoms[row], + m_colRights[col], m_rowBottoms[row] ); } @@ -3040,13 +3174,13 @@ void wxGrid::DrawAllGridLines( wxDC& dc, const wxRegion & reg ) int i; for ( i = 0; i < m_numRows; i++ ) { - if ( m_rowBottoms[i]-1 > bottom ) + if ( m_rowBottoms[i] > bottom ) { break; } - else if ( m_rowBottoms[i]-1 >= top ) + else if ( m_rowBottoms[i] >= top ) { - dc.DrawLine( left, m_rowBottoms[i]-1, right, m_rowBottoms[i]-1 ); + dc.DrawLine( left, m_rowBottoms[i], right, m_rowBottoms[i] ); } } @@ -3055,13 +3189,13 @@ void wxGrid::DrawAllGridLines( wxDC& dc, const wxRegion & reg ) // for ( i = 0; i < m_numCols; i++ ) { - if ( m_colRights[i]-1 > right ) + if ( m_colRights[i] > right ) { break; } - else if ( m_colRights[i]-1 >= left ) + else if ( m_colRights[i] >= left ) { - dc.DrawLine( m_colRights[i]-1, top, m_colRights[i]-1, bottom ); + dc.DrawLine( m_colRights[i], top, m_colRights[i], bottom ); } } } @@ -3231,13 +3365,14 @@ void wxGrid::DrawTextRectangle( wxDC& dc, // void wxGrid::StringToLines( const wxString& value, wxArrayString& lines ) { - // TODO: this won't work for WXMAC ? (lines end with '\r') - // => use wxTextFile functions then (VZ) int startPos = 0; int pos; - while ( startPos < (int)value.Length() ) + wxString eol = wxTextFile::GetEOL( wxTextFileType_Unix ); + wxString tVal = wxTextFile::Translate( value, wxTextFileType_Unix ); + + while ( startPos < (int)tVal.Length() ) { - pos = value.Mid(startPos).Find( '\n' ); + pos = tVal.Mid(startPos).Find( eol ); if ( pos < 0 ) { break; @@ -3248,14 +3383,7 @@ void wxGrid::StringToLines( const wxString& value, wxArrayString& lines ) } else { - if ( value[startPos+pos-1] == '\r' ) - { - lines.Add( value.Mid(startPos, pos-1) ); - } - else - { - lines.Add( value.Mid(startPos, pos) ); - } + lines.Add( value.Mid(startPos, pos) ); } startPos += pos+1; } @@ -4376,7 +4504,7 @@ int wxGrid::GetColSize( int col ) wxColour wxGrid::GetDefaultCellBackgroundColour() { - return GetBackgroundColour(); + return m_gridWin->GetBackgroundColour(); } // TODO VZ: this must be optimized to allow only retrieveing attr once! @@ -4398,7 +4526,7 @@ wxColour wxGrid::GetCellBackgroundColour(int row, int col) wxColour wxGrid::GetDefaultCellTextColour() { - return GetForegroundColour(); + return m_gridWin->GetForegroundColour(); } wxColour wxGrid::GetCellTextColour( int row, int col ) @@ -4490,12 +4618,6 @@ void wxGrid::SetRowSize( int row, int height ) m_rowBottoms[i] += diff; } CalcDimensions(); - - // Note: we are ending the event *after* doing - // default processing in this case - // - SendEvent( EVT_GRID_ROW_SIZE, - row, -1 ); } void wxGrid::SetDefaultColSize( int width, bool resizeExistingCols ) @@ -4531,22 +4653,16 @@ void wxGrid::SetColSize( int col, int width ) m_colRights[i] += diff; } CalcDimensions(); - - // Note: we are ending the event *after* doing - // default processing in this case - // - SendEvent( EVT_GRID_COL_SIZE, - -1, col ); } void wxGrid::SetDefaultCellBackgroundColour( const wxColour& col ) { - SetBackgroundColour(col); + m_gridWin->SetBackgroundColour(col); } void wxGrid::SetDefaultCellTextColour( const wxColour& col ) { - SetForegroundColour(col); + m_gridWin->SetForegroundColour(col); } void wxGrid::SetDefaultCellAlignment( int horiz, int vert )