fix a minor issue in Eeschema when left clicking on a highlighted symbol.

This commit is contained in:
jean-pierre charras 2018-12-31 14:44:59 +01:00
parent 7ad21fefe5
commit 6040eee710
1 changed files with 17 additions and 16 deletions

View File

@ -62,14 +62,15 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
{
SCH_ITEM* item = GetScreen()->GetCurItem();
wxPoint gridPosition = GetGridPosition( aPosition );
// item_flags != 0 means a current item in edit, or new ...
int item_flags = item ? (item->GetFlags() & ~HIGHLIGHTED) : 0;
if( ( GetToolId() == ID_NO_TOOL_SELECTED ) ||
( item && ( item->GetFlags() & ~HIGHLIGHTED ) ) )
if( ( GetToolId() == ID_NO_TOOL_SELECTED ) || item_flags )
{
m_canvas->SetAutoPanRequest( false );
SetRepeatItem( NULL );
if( item && item->GetFlags() )
if( item_flags )
{
switch( item->Type() )
{
@ -123,7 +124,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
case ID_NOCONN_BUTT:
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
if( item_flags == 0 )
{
if( GetScreen()->GetItem( gridPosition, 0, SCH_NO_CONNECT_T ) == NULL )
{
@ -140,7 +141,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
case ID_JUNCTION_BUTT:
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
if( item_flags == 0 )
{
if( GetScreen()->GetItem( gridPosition, 0, SCH_JUNCTION_T ) == NULL )
{
@ -157,7 +158,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
case ID_WIRETOBUS_ENTRY_BUTT:
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
if( item_flags == 0 )
{
CreateBusWireEntry();
m_canvas->SetAutoPanRequest( true );
@ -169,7 +170,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
case ID_BUSTOBUS_ENTRY_BUTT:
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
if( item_flags == 0 )
{
CreateBusBusEntry();
m_canvas->SetAutoPanRequest( true );
@ -200,7 +201,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
case ID_TEXT_COMMENT_BUTT:
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
if( item_flags == 0 )
{
GetScreen()->SetCurItem( CreateNewText( LAYER_NOTES ) );
m_canvas->SetAutoPanRequest( true );
@ -212,7 +213,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
case ID_ADD_IMAGE_BUTT:
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
if( item_flags == 0 )
{
GetScreen()->SetCurItem( CreateNewImage( aDC ) );
m_canvas->SetAutoPanRequest( true );
@ -224,7 +225,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
case ID_LABEL_BUTT:
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
if( item_flags == 0 )
{
GetScreen()->SetCurItem( CreateNewText( LAYER_LOCLABEL ) );
m_canvas->SetAutoPanRequest( true );
@ -237,7 +238,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case ID_GLABEL_BUTT:
case ID_HIERLABEL_BUTT:
if( (item == NULL) || (item->GetFlags() == 0) )
if( item_flags == 0 )
{
if( GetToolId() == ID_GLABEL_BUTT )
GetScreen()->SetCurItem( CreateNewText( LAYER_GLOBLABEL ) );
@ -254,7 +255,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
case ID_SHEET_SYMBOL_BUTT:
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
if( item_flags == 0 )
{
item = CreateSheet( aDC );
@ -272,13 +273,13 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case ID_IMPORT_HLABEL_BUTT:
case ID_SHEET_PIN_BUTT:
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
if( item_flags == 0 )
item = LocateAndShowItem( aPosition, SCH_COLLECTOR::SheetsAndSheetLabels );
if( item == NULL )
break;
if( (item->Type() == SCH_SHEET_T) && (item->GetFlags() == 0) )
if( (item->Type() == SCH_SHEET_T) && (item_flags == 0) )
{
if( GetToolId() == ID_IMPORT_HLABEL_BUTT )
GetScreen()->SetCurItem( ImportSheetPin( (SCH_SHEET*) item ) );
@ -292,7 +293,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
case ID_SCH_PLACE_COMPONENT:
if( (item == NULL) || (item->GetFlags() == 0) )
if( item_flags == 0 )
{
// ERC dialog interferes with moving items so we close it before starting
CloseErc();
@ -306,7 +307,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
case ID_PLACE_POWER_BUTT:
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
if( item_flags == 0 )
{
SCHLIB_FILTER filter;
filter.FilterPowerParts( true );