Handle block selection removal of libraries in SYMBOL_LIB_TABLE dialog

Fixes: lp:1741543
* https://bugs.launchpad.net/kicad/+bug/1741543
This commit is contained in:
Maciej Suminski 2018-01-17 09:59:02 +01:00
parent a386da9ee9
commit ac1771a9f0
1 changed files with 9 additions and 0 deletions

View File

@ -421,11 +421,20 @@ void DIALOG_SYMBOL_LIB_TABLE::deleteRowHandler( wxCommandEvent& event )
// If no candidate, just delete the row with the grid cursor. // If no candidate, just delete the row with the grid cursor.
wxArrayInt selectedRows = m_cur_grid->GetSelectedRows(); wxArrayInt selectedRows = m_cur_grid->GetSelectedRows();
wxGridCellCoordsArray cells = m_cur_grid->GetSelectedCells(); wxGridCellCoordsArray cells = m_cur_grid->GetSelectedCells();
wxGridCellCoordsArray blockTopLeft = m_cur_grid->GetSelectionBlockTopLeft();
wxGridCellCoordsArray blockBotRight = m_cur_grid->GetSelectionBlockBottomRight();
// Add all row having cell selected to list: // Add all row having cell selected to list:
for( unsigned ii = 0; ii < cells.GetCount(); ii++ ) for( unsigned ii = 0; ii < cells.GetCount(); ii++ )
selectedRows.Add( cells[ii].GetRow() ); selectedRows.Add( cells[ii].GetRow() );
// Handle block selection
if( !blockTopLeft.IsEmpty() && !blockBotRight.IsEmpty() )
{
for( int i = blockTopLeft[0].GetRow(); i <= blockBotRight[0].GetRow(); ++i )
selectedRows.Add( i );
}
// Use the row having the grid cursor only if we have no candidate: // Use the row having the grid cursor only if we have no candidate:
if( selectedRows.size() == 0 && getCursorRow() >= 0 ) if( selectedRows.size() == 0 && getCursorRow() >= 0 )
selectedRows.Add( getCursorRow() ); selectedRows.Add( getCursorRow() );