Add selection/unselection by Occurrence collection in CellWidget.

This commit is contained in:
Jean-Paul Chaput 2023-04-13 00:15:38 +02:00
parent b9862ecd5e
commit 31b0c4daf1
2 changed files with 39 additions and 0 deletions

View File

@ -2737,6 +2737,31 @@ namespace Hurricane {
}
void CellWidget::select ( Occurrences occurrences )
{
if ( (++_delaySelectionChanged == 1) and not _state->cumulativeSelection() ) {
openRefreshSession();
unselectAll();
closeRefreshSession();
}
bool selected = true;
// SelectorCriterion* criterion = _state->getSelection().add ( selectArea );
// if ( criterion and (not criterion->isEnabled()) ) {
// criterion->enable();
for ( const Occurrence& occurrence : occurrences ) {
if (occurrence.getOwnerCell() == getCell()) {
select( occurrence );
}
}
// } else
// selected = false;
if ( (--_delaySelectionChanged == 0) and selected ) emit selectionChanged( _selectors );
}
void CellWidget::select ( Occurrence occurrence )
{
if ( (++_delaySelectionChanged == 1) and not _state->cumulativeSelection() ) {
@ -2860,6 +2885,18 @@ namespace Hurricane {
}
void CellWidget::unselect ( Occurrences occurrences )
{
++_delaySelectionChanged;
for ( const Occurrence& occurrence : occurrences ) {
if (occurrence.getOwnerCell() == getCell()) {
unselect( occurrence );
}
}
if ( --_delaySelectionChanged == 0 ) emit selectionChanged( _selectors );
}
void CellWidget::unselectAll ()
{
++_delaySelectionChanged;

View File

@ -265,12 +265,14 @@ namespace Hurricane {
inline DrawingPlanes& getDrawingPlanes ();
// void select ( const Net* );
void select ( Occurrence );
void select ( Occurrences );
void selectSet ( const OccurrenceSet& );
void selectSet ( const ComponentSet& );
bool isSelected ( Occurrence );
void selectOccurrencesUnder ( Box selectArea );
// void unselect ( const Net* );
void unselect ( Occurrence );
void unselect ( Occurrences );
void unselectSet ( const ComponentSet& );
void unselectSet ( const OccurrenceSet& );
void unselectAll ();