Eeschema highlight symbols (cross probing) fix a few issues.
Fix highlight not cleared by Pcbnew. Fix highlight not cleared by Cvpcb (missing code). Add comments. Remove a few now useless printf used for debug When clicking on a empty area, clear any highligthed symbols Fixes: lp:1809977 https://bugs.launchpad.net/kicad/+bug/1809977
This commit is contained in:
parent
ad0d9f8df0
commit
fb35a7c8b4
|
@ -274,6 +274,10 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
|
|||
|
||||
m_modified = false;
|
||||
|
||||
// clear highlight symbol in schematic:
|
||||
SendMessageToEESCHEMA( true );
|
||||
|
||||
// Delete window
|
||||
Destroy();
|
||||
}
|
||||
|
||||
|
@ -717,22 +721,35 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles()
|
|||
}
|
||||
|
||||
|
||||
void CVPCB_MAINFRAME::SendMessageToEESCHEMA()
|
||||
void CVPCB_MAINFRAME::SendMessageToEESCHEMA( bool aClearHighligntOnly )
|
||||
{
|
||||
if( m_netlist.IsEmpty() )
|
||||
return;
|
||||
|
||||
// clear highlight of previously selected components (if any):
|
||||
// Selecting a non existing symbol clears any previously highlighted symbols
|
||||
std::string packet = "$PART: \"$DUMMY$\"";
|
||||
|
||||
if( Kiface().IsSingle() )
|
||||
SendCommand( MSG_TO_SCH, packet.c_str() );
|
||||
else
|
||||
Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
|
||||
|
||||
if( aClearHighligntOnly )
|
||||
return;
|
||||
|
||||
int selection = m_compListBox->GetSelection();
|
||||
|
||||
if ( selection < 0 )
|
||||
selection = 0;
|
||||
if ( selection < 0 ) // Nothing selected
|
||||
return;
|
||||
|
||||
if( m_netlist.GetComponent( selection ) == NULL )
|
||||
return;
|
||||
|
||||
// Now highlight the selected component:
|
||||
COMPONENT* component = m_netlist.GetComponent( selection );
|
||||
|
||||
std::string packet = StrPrintf( "$PART: \"%s\"", TO_UTF8( component->GetReference() ) );
|
||||
packet = StrPrintf( "$PART: \"%s\"", TO_UTF8( component->GetReference() ) );
|
||||
|
||||
if( Kiface().IsSingle() )
|
||||
SendCommand( MSG_TO_SCH, packet.c_str() );
|
||||
|
|
|
@ -288,8 +288,10 @@ public:
|
|||
* Send a remote command to Eeschema via a socket,
|
||||
* Commands are
|
||||
* $PART: "reference" put cursor on component anchor
|
||||
* @param aClearHighligntOnly = true if the message to send is only "clear highlight"
|
||||
* (used when exiting Cvpcb)
|
||||
*/
|
||||
void SendMessageToEESCHEMA();
|
||||
void SendMessageToEESCHEMA( bool aClearHighligntOnly = false );
|
||||
|
||||
COMPONENT* GetSelectedComponent();
|
||||
|
||||
|
|
|
@ -108,8 +108,9 @@ void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
|
|||
/* look for a complement */
|
||||
idcmd = strtok( NULL, " \n\r" );
|
||||
|
||||
if( idcmd == NULL ) // component only
|
||||
if( idcmd == NULL ) // Highlight component only (from Cvpcb or Pcbnew)
|
||||
{
|
||||
// Highlight component part_ref, or clear Highlight, if part_ref is not existing
|
||||
FindComponentAndItem( part_ref, true, FIND_COMPONENT_ONLY, wxEmptyString );
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -235,12 +235,9 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference,
|
|||
|
||||
SetStatusText( msg );
|
||||
|
||||
if( foundItem )
|
||||
{
|
||||
// highlight selection
|
||||
// highlight selection if foundItem is not null, or clear any highlight selection
|
||||
GetCanvas()->GetView()->HighlightItem( foundItem, pin );
|
||||
GetCanvas()->Refresh();
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
|
|
@ -62,10 +62,9 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
{
|
||||
SCH_ITEM* item = GetScreen()->GetCurItem();
|
||||
wxPoint gridPosition = GetGridPosition( aPosition );
|
||||
DBG(printf("mousep %d %d gridp %d %d\n", aPosition.x, aPosition.y, gridPosition.x, gridPosition.y );)
|
||||
|
||||
|
||||
if( ( GetToolId() == ID_NO_TOOL_SELECTED ) || ( item && item->GetFlags() ) )
|
||||
if( ( GetToolId() == ID_NO_TOOL_SELECTED ) ||
|
||||
( item && ( item->GetFlags() & ~HIGHLIGHTED ) ) )
|
||||
{
|
||||
m_canvas->SetAutoPanRequest( false );
|
||||
SetRepeatItem( NULL );
|
||||
|
@ -108,6 +107,9 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
}
|
||||
}
|
||||
|
||||
if( !item ) // If clicked on a empty area, clear any highligthed symbol
|
||||
GetCanvas()->GetView()->HighlightItem( nullptr, nullptr );
|
||||
|
||||
switch( GetToolId() )
|
||||
{
|
||||
case ID_NO_TOOL_SELECTED:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2004-2017 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -48,6 +48,7 @@
|
|||
#include <sch_sheet_path.h>
|
||||
#include <sch_bitmap.h>
|
||||
#include <symbol_lib_table.h>
|
||||
#include <sch_view.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
@ -76,7 +77,9 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
|
|||
bool blockActive = GetScreen()->IsBlockActive();
|
||||
wxString msg;
|
||||
|
||||
DBG(printf("on-rclick cur %p blk %d\n", item, blockActive ? 1 : 0 );)
|
||||
// Ugly hack, clear any highligthed symbol, because the HIGHLIGHT flag create issues when creating menus
|
||||
// Will be fixed later
|
||||
GetCanvas()->GetView()->HighlightItem( nullptr, nullptr );
|
||||
|
||||
// Do not start a block command on context menu.
|
||||
m_canvas->SetCanStartBlock( -1 );
|
||||
|
@ -142,9 +145,6 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
|
|||
bool actionCancelled = false;
|
||||
item = LocateAndShowItem( aPosition, SCH_COLLECTOR::AllItemsButPins, 0, &actionCancelled );
|
||||
|
||||
printf("Locateandshow %d %d item %p type %d\n", aPosition.x, aPosition.y,
|
||||
item, item ? item->Type() : 0 ); fflush(0);
|
||||
|
||||
// If the clarify item selection context menu is aborted, don't show the context menu.
|
||||
if( item == NULL && actionCancelled )
|
||||
return false;
|
||||
|
|
|
@ -190,7 +190,7 @@ void SCH_VIEW::HideWorksheet()
|
|||
|
||||
void SCH_VIEW::HighlightItem( EDA_ITEM *aItem, LIB_PIN* aPin )
|
||||
{
|
||||
if(! aItem )
|
||||
if( !aItem )
|
||||
{
|
||||
for( auto item : *m_allItems )
|
||||
{
|
||||
|
|
|
@ -93,7 +93,11 @@ public:
|
|||
void ShowSelectionArea( bool aShow = true );
|
||||
void ShowPreview( bool aShow = true );
|
||||
|
||||
/**
|
||||
* Clear the hide flag of all items in the view
|
||||
*/
|
||||
void ClearHiddenFlags();
|
||||
|
||||
void HideWorksheet();
|
||||
|
||||
void HighlightItem( EDA_ITEM *aItem, LIB_PIN* aPin = nullptr );
|
||||
|
|
Loading…
Reference in New Issue