Commit 300c066b authored by Maciej Suminski's avatar Maciej Suminski

The last fix to selection rules.

parent 867067aa
...@@ -210,11 +210,11 @@ void SELECTION_TOOL::selectSingle( const VECTOR2I& aWhere ) ...@@ -210,11 +210,11 @@ void SELECTION_TOOL::selectSingle( const VECTOR2I& aWhere )
default: default:
// Remove modules, they have to be selected by clicking on area that does not // Remove modules, they have to be selected by clicking on area that does not
// contain anything but module footprint // contain anything but module footprint and not selectable items
for( int i = 0; i < collector.GetCount(); ++i ) for( int i = collector.GetCount() - 1; i >= 0 ; --i )
{ {
BOARD_ITEM* boardItem = ( collector )[i]; BOARD_ITEM* boardItem = ( collector )[i];
if( boardItem->Type() == PCB_MODULE_T ) if( boardItem->Type() == PCB_MODULE_T || !selectable( boardItem ) )
collector.Remove( i ); collector.Remove( i );
} }
...@@ -223,7 +223,7 @@ void SELECTION_TOOL::selectSingle( const VECTOR2I& aWhere ) ...@@ -223,7 +223,7 @@ void SELECTION_TOOL::selectSingle( const VECTOR2I& aWhere )
{ {
toggleSelection( collector[0] ); toggleSelection( collector[0] );
} }
else else if( collector.GetCount() > 1 )
{ {
item = disambiguationMenu( &collector ); item = disambiguationMenu( &collector );
if( item ) if( item )
...@@ -345,22 +345,14 @@ BOARD_ITEM* SELECTION_TOOL::disambiguationMenu( GENERAL_COLLECTOR* aCollector ) ...@@ -345,22 +345,14 @@ BOARD_ITEM* SELECTION_TOOL::disambiguationMenu( GENERAL_COLLECTOR* aCollector )
int limit = std::min( 10, aCollector->GetCount() ); int limit = std::min( 10, aCollector->GetCount() );
int addedItems = 0;
for( int i = 0; i < limit; ++i ) for( int i = 0; i < limit; ++i )
{ {
wxString text; wxString text;
BOARD_ITEM* item = ( *aCollector )[i]; BOARD_ITEM* item = ( *aCollector )[i];
if( selectable( item ) ) text = item->GetSelectMenuText();
{ m_menu->Add( text, i );
text = item->GetSelectMenuText();
m_menu->Add( text, i );
addedItems++;
}
} }
if( addedItems == 0 ) // none of items was selectable
return NULL;
SetContextMenu( m_menu.get(), CMENU_NOW ); SetContextMenu( m_menu.get(), CMENU_NOW );
while( OPT_TOOL_EVENT evt = Wait() ) while( OPT_TOOL_EVENT evt = Wait() )
...@@ -411,7 +403,6 @@ BOARD_ITEM* SELECTION_TOOL::disambiguationMenu( GENERAL_COLLECTOR* aCollector ) ...@@ -411,7 +403,6 @@ BOARD_ITEM* SELECTION_TOOL::disambiguationMenu( GENERAL_COLLECTOR* aCollector )
bool SELECTION_TOOL::selectable( const BOARD_ITEM* aItem ) bool SELECTION_TOOL::selectable( const BOARD_ITEM* aItem )
{ {
BOARD* board = getModel<BOARD>( PCB_T );
bool highContrast = getView()->GetPainter()->GetSettings()->GetHighContrast(); bool highContrast = getView()->GetPainter()->GetSettings()->GetHighContrast();
if( highContrast ) if( highContrast )
...@@ -437,6 +428,7 @@ bool SELECTION_TOOL::selectable( const BOARD_ITEM* aItem ) ...@@ -437,6 +428,7 @@ bool SELECTION_TOOL::selectable( const BOARD_ITEM* aItem )
return false; return false;
} }
BOARD* board = getModel<BOARD>( PCB_T );
switch( aItem->Type() ) switch( aItem->Type() )
{ {
case PCB_VIA_T: case PCB_VIA_T:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment