Compute update rectangle only when needed [i.e. if (!m_grid->GetBatchCount())]
[Patch 882656] git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25367 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -259,10 +259,12 @@ void wxGridSelection::SelectRow( int row,
|
||||
}
|
||||
|
||||
// Update View:
|
||||
if ( !m_grid->GetBatchCount() )
|
||||
{
|
||||
wxRect r = m_grid->BlockToDeviceRect( wxGridCellCoords( row, 0 ),
|
||||
wxGridCellCoords( row, m_grid->GetNumberCols() - 1 ) );
|
||||
if ( !m_grid->GetBatchCount() )
|
||||
((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
|
||||
}
|
||||
|
||||
// Send Event
|
||||
wxGridRangeSelectEvent gridEvt( m_grid->GetId(),
|
||||
@@ -352,10 +354,12 @@ void wxGridSelection::SelectCol( int col,
|
||||
}
|
||||
|
||||
// Update View:
|
||||
if ( !m_grid->GetBatchCount() )
|
||||
{
|
||||
wxRect r = m_grid->BlockToDeviceRect( wxGridCellCoords( 0, col ),
|
||||
wxGridCellCoords( m_grid->GetNumberRows() - 1, col ) );
|
||||
if ( !m_grid->GetBatchCount() )
|
||||
((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
|
||||
}
|
||||
|
||||
// Send Event
|
||||
wxGridRangeSelectEvent gridEvt( m_grid->GetId(),
|
||||
@@ -494,10 +498,12 @@ void wxGridSelection::SelectBlock( int topRow, int leftCol,
|
||||
m_blockSelectionBottomRight.Add( wxGridCellCoords( bottomRow, rightCol ) );
|
||||
|
||||
// Update View:
|
||||
if ( !m_grid->GetBatchCount() )
|
||||
{
|
||||
wxRect r = m_grid->BlockToDeviceRect( wxGridCellCoords( topRow, leftCol ),
|
||||
wxGridCellCoords( bottomRow, rightCol ) );
|
||||
if ( !m_grid->GetBatchCount() )
|
||||
((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
|
||||
}
|
||||
|
||||
// Send Event, if not disabled.
|
||||
if ( sendEvent )
|
||||
@@ -536,10 +542,12 @@ void wxGridSelection::SelectCell( int row, int col,
|
||||
m_cellSelection.Add( wxGridCellCoords( row, col ) );
|
||||
|
||||
// Update View:
|
||||
if ( !m_grid->GetBatchCount() )
|
||||
{
|
||||
wxRect r = m_grid->BlockToDeviceRect( wxGridCellCoords( row, col ),
|
||||
wxGridCellCoords( row, col ) );
|
||||
if ( !m_grid->GetBatchCount() )
|
||||
((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
|
||||
}
|
||||
|
||||
// Send event
|
||||
if (sendEvent)
|
||||
@@ -585,12 +593,13 @@ void wxGridSelection::ToggleCellSelection( int row, int col,
|
||||
wxGridCellCoords& coords = m_cellSelection[n];
|
||||
if ( row == coords.GetRow() && col == coords.GetCol() )
|
||||
{
|
||||
wxRect r;
|
||||
r = m_grid->BlockToDeviceRect( m_cellSelection[n],
|
||||
m_cellSelection[n] );
|
||||
wxGridCellCoords coords = m_cellSelection[n];
|
||||
m_cellSelection.RemoveAt(n);
|
||||
if ( !m_grid->GetBatchCount() )
|
||||
{
|
||||
wxRect r = m_grid->BlockToDeviceRect( coords, coords );
|
||||
((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
|
||||
}
|
||||
|
||||
// Send event
|
||||
wxGridRangeSelectEvent gridEvt( m_grid->GetId(),
|
||||
@@ -718,11 +727,14 @@ void wxGridSelection::ToggleCellSelection( int row, int col,
|
||||
switch (m_selectionMode)
|
||||
{
|
||||
case wxGrid::wxGridSelectCells:
|
||||
{
|
||||
if ( !m_grid->GetBatchCount() )
|
||||
{
|
||||
r = m_grid->BlockToDeviceRect( wxGridCellCoords( row, col ),
|
||||
wxGridCellCoords( row, col ) );
|
||||
if ( !m_grid->GetBatchCount() )
|
||||
((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
|
||||
}
|
||||
|
||||
wxGridRangeSelectEvent gridEvt( m_grid->GetId(),
|
||||
wxEVT_GRID_RANGE_SELECT,
|
||||
m_grid,
|
||||
@@ -735,11 +747,14 @@ void wxGridSelection::ToggleCellSelection( int row, int col,
|
||||
break;
|
||||
}
|
||||
case wxGrid::wxGridSelectRows:
|
||||
{
|
||||
if ( !m_grid->GetBatchCount() )
|
||||
{
|
||||
r = m_grid->BlockToDeviceRect( wxGridCellCoords( row, 0 ),
|
||||
wxGridCellCoords( row, m_grid->GetNumberCols() - 1 ) );
|
||||
if ( !m_grid->GetBatchCount() )
|
||||
((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
|
||||
}
|
||||
|
||||
wxGridRangeSelectEvent gridEvt( m_grid->GetId(),
|
||||
wxEVT_GRID_RANGE_SELECT,
|
||||
m_grid,
|
||||
@@ -752,11 +767,14 @@ void wxGridSelection::ToggleCellSelection( int row, int col,
|
||||
break;
|
||||
}
|
||||
case wxGrid::wxGridSelectColumns:
|
||||
{
|
||||
if ( !m_grid->GetBatchCount() )
|
||||
{
|
||||
r = m_grid->BlockToDeviceRect( wxGridCellCoords( 0, col ),
|
||||
wxGridCellCoords( m_grid->GetNumberRows() - 1, col ) );
|
||||
if ( !m_grid->GetBatchCount() )
|
||||
((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
|
||||
}
|
||||
|
||||
wxGridRangeSelectEvent gridEvt( m_grid->GetId(),
|
||||
wxEVT_GRID_RANGE_SELECT,
|
||||
m_grid,
|
||||
@@ -774,35 +792,39 @@ void wxGridSelection::ToggleCellSelection( int row, int col,
|
||||
void wxGridSelection::ClearSelection()
|
||||
{
|
||||
size_t n;
|
||||
wxRect r;
|
||||
wxGridCellCoords coords1, coords2;
|
||||
|
||||
// deselect all invidiual cells and update the screen
|
||||
if ( m_selectionMode == wxGrid::wxGridSelectCells )
|
||||
{
|
||||
|
||||
while( ( n = m_cellSelection.GetCount() ) > 0)
|
||||
{
|
||||
wxRect r;
|
||||
n--;
|
||||
r = m_grid->BlockToDeviceRect( m_cellSelection[n],
|
||||
m_cellSelection[n] );
|
||||
coords1 = m_cellSelection[n];
|
||||
m_cellSelection.RemoveAt(n);
|
||||
if ( !m_grid->GetBatchCount() )
|
||||
{
|
||||
r = m_grid->BlockToDeviceRect( coords1, coords1 );
|
||||
((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// deselect all blocks and update the screen
|
||||
while( ( n = m_blockSelectionTopLeft.GetCount() ) > 0)
|
||||
{
|
||||
wxRect r;
|
||||
n--;
|
||||
r = m_grid->BlockToDeviceRect( m_blockSelectionTopLeft[n],
|
||||
m_blockSelectionBottomRight[n] );
|
||||
coords1 = m_blockSelectionTopLeft[n];
|
||||
coords2 = m_blockSelectionBottomRight[n];
|
||||
m_blockSelectionTopLeft.RemoveAt(n);
|
||||
m_blockSelectionBottomRight.RemoveAt(n);
|
||||
if ( !m_grid->GetBatchCount() )
|
||||
{
|
||||
r = m_grid->BlockToDeviceRect( coords1, coords2 );
|
||||
((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
|
||||
}
|
||||
}
|
||||
|
||||
// deselect all rows and update the screen
|
||||
if ( m_selectionMode != wxGrid::wxGridSelectColumns )
|
||||
@@ -810,15 +832,16 @@ void wxGridSelection::ClearSelection()
|
||||
while( ( n = m_rowSelection.GetCount() ) > 0)
|
||||
{
|
||||
n--;
|
||||
int & row = m_rowSelection[n];
|
||||
wxRect r;
|
||||
r = m_grid->BlockToDeviceRect( wxGridCellCoords( row, 0 ),
|
||||
wxGridCellCoords( row, m_grid->GetNumberCols() - 1 ) );
|
||||
int row = m_rowSelection[n];
|
||||
m_rowSelection.RemoveAt(n);
|
||||
if ( !m_grid->GetBatchCount() )
|
||||
{
|
||||
r = m_grid->BlockToDeviceRect( wxGridCellCoords( row, 0 ),
|
||||
wxGridCellCoords( row, m_grid->GetNumberCols() - 1 ) );
|
||||
((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// deselect all columns and update the screen
|
||||
if ( m_selectionMode != wxGrid::wxGridSelectRows )
|
||||
@@ -826,15 +849,16 @@ void wxGridSelection::ClearSelection()
|
||||
while( ( n = m_colSelection.GetCount() ) > 0)
|
||||
{
|
||||
n--;
|
||||
int & col = m_colSelection[n];
|
||||
wxRect r;
|
||||
r = m_grid->BlockToDeviceRect( wxGridCellCoords( 0, col ),
|
||||
wxGridCellCoords( m_grid->GetNumberRows() - 1, col ) );
|
||||
int col = m_colSelection[n];
|
||||
m_colSelection.RemoveAt(n);
|
||||
if ( !m_grid->GetBatchCount() )
|
||||
{
|
||||
r = m_grid->BlockToDeviceRect( wxGridCellCoords( 0, col ),
|
||||
wxGridCellCoords( m_grid->GetNumberRows() - 1, col ) );
|
||||
((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// One deselection event, indicating deselection of _all_ cells.
|
||||
// (No finer grained events for each of the smaller regions
|
||||
|
Reference in New Issue
Block a user