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