deTABified

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6085 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-02-16 19:15:13 +00:00
parent 0e10e17b86
commit d1c0b4f97e
2 changed files with 81 additions and 75 deletions

View File

@@ -311,6 +311,9 @@ public:
virtual void SetAttr(wxGridCellAttr *attr, int row, int col); virtual void SetAttr(wxGridCellAttr *attr, int row, int col);
virtual void SetRowAttr(wxGridCellAttr *attr, int row); virtual void SetRowAttr(wxGridCellAttr *attr, int row);
virtual void SetColAttr(wxGridCellAttr *attr, int col); virtual void SetColAttr(wxGridCellAttr *attr, int col);
// these functions must be called whenever some rows/cols are deleted
// because the internal data must be updated then
void UpdateAttrRows( size_t pos, int numRows ); void UpdateAttrRows( size_t pos, int numRows );
void UpdateAttrCols( size_t pos, int numCols ); void UpdateAttrCols( size_t pos, int numCols );

View File

@@ -637,29 +637,29 @@ void wxGridCellAttrData::UpdateAttrRows( size_t pos, int numRows )
for ( size_t n = 0; n < count; n++ ) for ( size_t n = 0; n < count; n++ )
{ {
wxGridCellCoords& coords = m_attrs[n].coords; wxGridCellCoords& coords = m_attrs[n].coords;
wxCoord row = coords.GetRow(); wxCoord row = coords.GetRow();
if ((size_t)row >= pos) if ((size_t)row >= pos)
{ {
if (numRows > 0) if (numRows > 0)
{ {
// If rows inserted, include row counter where necessary // If rows inserted, include row counter where necessary
coords.SetRow(row + numRows); coords.SetRow(row + numRows);
} }
else if (numRows < 0) else if (numRows < 0)
{ {
// If rows deleted ... // If rows deleted ...
if ((size_t)row >= pos - numRows) if ((size_t)row >= pos - numRows)
{ {
// ...either decrement row counter (if row still exists)... // ...either decrement row counter (if row still exists)...
coords.SetRow(row + numRows); coords.SetRow(row + numRows);
} }
else else
{ {
// ...or remove the attribute // ...or remove the attribute
m_attrs.RemoveAt((size_t)n); m_attrs.RemoveAt((size_t)n);
n--; count--; n--; count--;
} }
} }
} }
} }
} }
@@ -670,29 +670,29 @@ void wxGridCellAttrData::UpdateAttrCols( size_t pos, int numCols )
for ( size_t n = 0; n < count; n++ ) for ( size_t n = 0; n < count; n++ )
{ {
wxGridCellCoords& coords = m_attrs[n].coords; wxGridCellCoords& coords = m_attrs[n].coords;
wxCoord col = coords.GetCol(); wxCoord col = coords.GetCol();
if ( (size_t)col >= pos ) if ( (size_t)col >= pos )
{ {
if ( numCols > 0 ) if ( numCols > 0 )
{ {
// If rows inserted, include row counter where necessary // If rows inserted, include row counter where necessary
coords.SetCol(col + numCols); coords.SetCol(col + numCols);
} }
else if (numCols < 0) else if (numCols < 0)
{ {
// If rows deleted ... // If rows deleted ...
if ((size_t)col >= pos - numCols) if ((size_t)col >= pos - numCols)
{ {
// ...either decrement row counter (if row still exists)... // ...either decrement row counter (if row still exists)...
coords.SetCol(col + numCols); coords.SetCol(col + numCols);
} }
else else
{ {
// ...or remove the attribute // ...or remove the attribute
m_attrs.RemoveAt((size_t)n); m_attrs.RemoveAt((size_t)n);
n--; count--; n--; count--;
} }
} }
} }
} }
} }
@@ -771,25 +771,25 @@ void wxGridRowOrColAttrData::UpdateAttrRowsOrCols( size_t pos, int numRowsOrCols
for ( size_t n = 0; n < count; n++ ) for ( size_t n = 0; n < count; n++ )
{ {
int & rowOrCol = m_rowsOrCols[n]; int & rowOrCol = m_rowsOrCols[n];
if ( (size_t)rowOrCol >= pos ) if ( (size_t)rowOrCol >= pos )
{ {
if ( numRowsOrCols > 0 ) if ( numRowsOrCols > 0 )
{ {
// If rows inserted, include row counter where necessary // If rows inserted, include row counter where necessary
rowOrCol += numRowsOrCols; rowOrCol += numRowsOrCols;
} }
else if ( numRowsOrCols < 0) else if ( numRowsOrCols < 0)
{ {
// If rows deleted, either decrement row counter (if row still exists) // If rows deleted, either decrement row counter (if row still exists)
if ((size_t)rowOrCol >= pos - numRowsOrCols) if ((size_t)rowOrCol >= pos - numRowsOrCols)
rowOrCol += numRowsOrCols; rowOrCol += numRowsOrCols;
else else
{ {
m_rowsOrCols.RemoveAt((size_t)n); m_rowsOrCols.RemoveAt((size_t)n);
m_attrs.RemoveAt((size_t)n); m_attrs.RemoveAt((size_t)n);
n--; count--; n--; count--;
} }
} }
} }
} }
} }
@@ -869,7 +869,7 @@ void wxGridCellAttrProvider::UpdateAttrRows( size_t pos, int numRows )
{ {
m_data->m_cellAttrs.UpdateAttrRows( pos, numRows ); m_data->m_cellAttrs.UpdateAttrRows( pos, numRows );
m_data->m_rowAttrs.UpdateAttrRowsOrCols( pos, numRows ); m_data->m_rowAttrs.UpdateAttrRowsOrCols( pos, numRows );
} }
} }
@@ -879,7 +879,7 @@ void wxGridCellAttrProvider::UpdateAttrCols( size_t pos, int numCols )
{ {
m_data->m_cellAttrs.UpdateAttrCols( pos, numCols ); m_data->m_cellAttrs.UpdateAttrCols( pos, numCols );
m_data->m_colAttrs.UpdateAttrRowsOrCols( pos, numCols ); m_data->m_colAttrs.UpdateAttrRowsOrCols( pos, numCols );
} }
} }
@@ -2832,10 +2832,10 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
wxClientDC dc( m_gridWin ); wxClientDC dc( m_gridWin );
PrepareDC( dc ); PrepareDC( dc );
y = wxMax( y, y = wxMax( y,
m_rowBottoms[m_dragRowOrCol] - m_rowBottoms[m_dragRowOrCol] -
m_rowHeights[m_dragRowOrCol] + m_rowHeights[m_dragRowOrCol] +
WXGRID_MIN_ROW_HEIGHT ); WXGRID_MIN_ROW_HEIGHT );
dc.SetLogicalFunction(wxINVERT); dc.SetLogicalFunction(wxINVERT);
if ( m_dragLastPos >= 0 ) if ( m_dragLastPos >= 0 )
{ {
@@ -2852,9 +2852,9 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
wxClientDC dc( m_gridWin ); wxClientDC dc( m_gridWin );
PrepareDC( dc ); PrepareDC( dc );
x = wxMax( x, x = wxMax( x,
m_colRights[m_dragRowOrCol] - m_colRights[m_dragRowOrCol] -
m_colWidths[m_dragRowOrCol] + WXGRID_MIN_COL_WIDTH ); m_colWidths[m_dragRowOrCol] + WXGRID_MIN_COL_WIDTH );
dc.SetLogicalFunction(wxINVERT); dc.SetLogicalFunction(wxINVERT);
if ( m_dragLastPos >= 0 ) if ( m_dragLastPos >= 0 )
{ {
@@ -3700,7 +3700,10 @@ void wxGrid::SetCurrentCell( const wxGridCellCoords& coords )
// Clear the old current cell highlight // Clear the old current cell highlight
wxRect r = BlockToDeviceRect(m_currentCellCoords, m_currentCellCoords); wxRect r = BlockToDeviceRect(m_currentCellCoords, m_currentCellCoords);
m_currentCellCoords = coords; // Otherwise refresh redraws the highlight!
// Otherwise refresh redraws the highlight!
m_currentCellCoords = coords;
m_gridWin->Refresh( FALSE, &r ); m_gridWin->Refresh( FALSE, &r );
} }