From 8afe4599d00921df775ae9433a7637050904f65e Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Tue, 22 Apr 2014 10:16:19 -0500 Subject: [PATCH] Teach cvpcb about new KIWAY based cross-probing, factor out MAIL_T into mail_type.h --- common/kiway.cpp | 2 +- common/kiway_express.cpp | 2 +- cvpcb/cvframe.cpp | 16 +++++++--------- include/kiway.h | 3 ++- include/kiway_express.h | 20 ++++---------------- include/mail_type.h | 16 ++++++++++++++++ 6 files changed, 31 insertions(+), 28 deletions(-) create mode 100644 include/mail_type.h diff --git a/common/kiway.cpp b/common/kiway.cpp index 56dff4a288..9004566f14 100644 --- a/common/kiway.cpp +++ b/common/kiway.cpp @@ -297,7 +297,7 @@ bool KIWAY::PlayersClose( bool doForce ) void KIWAY::ExpressMail( FRAME_T aDestination, - int aCommand, const std::string& aPayload, wxWindow* aSource ) + MAIL_T aCommand, const std::string& aPayload, wxWindow* aSource ) { KIWAY_EXPRESS mail( aDestination, aCommand, aPayload, aSource ); diff --git a/common/kiway_express.cpp b/common/kiway_express.cpp index d11e6e7cee..8056f4a37b 100644 --- a/common/kiway_express.cpp +++ b/common/kiway_express.cpp @@ -49,7 +49,7 @@ KIWAY_EXPRESS::KIWAY_EXPRESS( const KIWAY_EXPRESS& anOther ) : } -KIWAY_EXPRESS::KIWAY_EXPRESS( FRAME_T aDestination, int aCommand, +KIWAY_EXPRESS::KIWAY_EXPRESS( FRAME_T aDestination, MAIL_T aCommand, const std::string& aPayload, wxWindow* aSource ) : wxEvent( aCommand, wxEVENT_ID ), m_destination( aDestination ), diff --git a/cvpcb/cvframe.cpp b/cvpcb/cvframe.cpp index 4adba22292..74b79b3567 100644 --- a/cvpcb/cvframe.cpp +++ b/cvpcb/cvframe.cpp @@ -786,14 +786,10 @@ void CVPCB_MAINFRAME::UpdateTitle() void CVPCB_MAINFRAME::SendMessageToEESCHEMA() { - char cmd[1024]; - int selection; - COMPONENT* Component; - if( m_netlist.IsEmpty() ) return; - selection = m_ListCmp->GetSelection(); + int selection = m_ListCmp->GetSelection(); if ( selection < 0 ) selection = 0; @@ -801,12 +797,14 @@ void CVPCB_MAINFRAME::SendMessageToEESCHEMA() if( m_netlist.GetComponent( selection ) == NULL ) return; - Component = m_netlist.GetComponent( selection ); + COMPONENT* component = m_netlist.GetComponent( selection ); - sprintf( cmd, "$PART: \"%s\"", TO_UTF8( Component->GetReference() ) ); - - SendCommand( MSG_TO_SCH, cmd ); + std::string packet = StrPrintf( "$PART: \"%s\"", TO_UTF8( component->GetReference() ) ); + if( Kiface().IsSingle() ) + SendCommand( MSG_TO_SCH, packet.c_str() ); + else + Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this ); } diff --git a/include/kiway.h b/include/kiway.h index ae4337b563..9b2ffd6b2d 100644 --- a/include/kiway.h +++ b/include/kiway.h @@ -102,6 +102,7 @@ as such! As such, it is OK to use UTF8 characters: #include #include #include +#include #define VTBL_ENTRY virtual @@ -324,7 +325,7 @@ public: */ VTBL_ENTRY bool PlayersClose( bool doForce ); - VTBL_ENTRY void ExpressMail( FRAME_T aDestination, int aCommand, const std::string& aPayload, wxWindow* aSource=NULL ); + VTBL_ENTRY void ExpressMail( FRAME_T aDestination, MAIL_T aCommand, const std::string& aPayload, wxWindow* aSource=NULL ); /** * Function Prj diff --git a/include/kiway_express.h b/include/kiway_express.h index e331f3fcb9..e5fba42f63 100644 --- a/include/kiway_express.h +++ b/include/kiway_express.h @@ -28,24 +28,12 @@ #include #include - - -/** - * Enum MAIL_T - * is the set of mail types sendable via KIWAY::ExpressMail() and supplied as - * the @a aCommand parameter to that function. Such mail will be received in - * KIWAY_PLAYER::KiwayMailIn( KIWAY_EXPRESS& aEvent ) and aEvent.Command() will - * match aCommand to ExpressMail(). - */ -enum MAIL_T -{ - MAIL_CROSS_PROBE, -}; +#include /** * Class KIWAY_EXPRESS - * carries a payload from one KIWAY_PLAYER to anothing within a PROJECT. + * carries a payload from one KIWAY_PLAYER to another within a PROJECT. */ class KIWAY_EXPRESS : public wxEvent { @@ -58,7 +46,7 @@ public: /** * Function Command - * returns the EXPRESS_MAIL_T associated with this mail. + * returns the MAIL_T associated with this mail. */ MAIL_T Command() { @@ -78,7 +66,7 @@ public: //KIWAY_EXPRESS() {} KIWAY_EXPRESS( FRAME_T aDestination, - wxEventType aCommand, + MAIL_T aCommand, const std::string& aPayload, wxWindow* aSource = NULL ); diff --git a/include/mail_type.h b/include/mail_type.h new file mode 100644 index 0000000000..9f30d3e284 --- /dev/null +++ b/include/mail_type.h @@ -0,0 +1,16 @@ +#ifndef MAIL_TYPE_H_ +#define MAIL_TYPE_H_ + +/** + * Enum MAIL_T + * is the set of mail types sendable via KIWAY::ExpressMail() and supplied as + * the @a aCommand parameter to that function. Such mail will be received in + * KIWAY_PLAYER::KiwayMailIn( KIWAY_EXPRESS& aEvent ) and aEvent.Command() will + * match aCommand to KIWAY::ExpressMail(). + */ +enum MAIL_T +{ + MAIL_CROSS_PROBE, ///< PCB<->SCH, CVPCB->SCH cross-probing. +}; + +#endif // MAIL_TYPE_H_