From b73037a282dadf2402162bddbbfd5082d7fe920e Mon Sep 17 00:00:00 2001 From: Andrey Fedorushkov Date: Wed, 12 Oct 2011 17:09:12 +0400 Subject: [PATCH] cvpcb: add send message to eeschema when selecting item in list components --- cvpcb/cvframe.cpp | 34 ++++++++++++++++++++++++++++++++++ cvpcb/cvpcb_mainframe.h | 8 ++++++++ 2 files changed, 42 insertions(+) diff --git a/cvpcb/cvframe.cpp b/cvpcb/cvframe.cpp index 95503932b2..76f1e208aa 100644 --- a/cvpcb/cvframe.cpp +++ b/cvpcb/cvframe.cpp @@ -7,6 +7,7 @@ #include "macros.h" #include "confirm.h" #include "eda_doc.h" +#include "eda_dde.h" #include "gestfich.h" #include "param_config.h" #include "bitmaps.h" @@ -316,6 +317,7 @@ void CVPCB_MAINFRAME::ToFirstNA( wxCommandEvent& event ) if( component.m_Module.IsEmpty() && ii > selection ) { m_ListCmp->SetSelection( ii ); + SendMessageToEESCHEMA(); return; } @@ -345,6 +347,7 @@ void CVPCB_MAINFRAME::ToPreviousNA( wxCommandEvent& event ) if( component.m_Module.IsEmpty() && ii < selection ) { m_ListCmp->SetSelection( ii ); + SendMessageToEESCHEMA(); return; } @@ -500,6 +503,7 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event ) } m_FootprintList->SetFootprintFilteredList( &m_components[ selection ], m_footprints ); + SendMessageToEESCHEMA(); DisplayStatus(); } @@ -617,3 +621,33 @@ void CVPCB_MAINFRAME::UpdateTitle() SetTitle( title ); } + +/** + * Send a remote command to Eeschema via a socket, + * Commands are + * $PART: "reference" put cursor on component anchor + */ +void CVPCB_MAINFRAME::SendMessageToEESCHEMA() +{ + char cmd[1024]; + int selection; + COMPONENT* Component; + + if( m_components.empty() ) + return; + + selection = m_ListCmp->GetSelection(); + + if ( selection < 0 ) + selection = 0; + + if( &m_components[ selection ] == NULL ) + return; + + Component = &m_components[ selection ]; + + sprintf( cmd, "$PART: \"%s\"", TO_UTF8( Component->m_Reference ) ); + + SendCommand( MSG_TO_SCH, cmd ); + +} diff --git a/cvpcb/cvpcb_mainframe.h b/cvpcb/cvpcb_mainframe.h index 5c02a7223d..bbdc80a76b 100644 --- a/cvpcb/cvpcb_mainframe.h +++ b/cvpcb/cvpcb_mainframe.h @@ -233,6 +233,14 @@ public: */ void UpdateTitle(); + /** + * Function SendMessageToEESCHEMA + * Send a remote command to Eeschema via a socket, + * Commands are + * $PART: "reference" put cursor on component anchor + */ + void SendMessageToEESCHEMA(); + DECLARE_EVENT_TABLE() };