Teach cvpcb about new KIWAY based cross-probing, factor out MAIL_T into mail_type.h

This commit is contained in:
Dick Hollenbeck 2014-04-22 10:16:19 -05:00
parent 7a129e167b
commit 8afe4599d0
6 changed files with 31 additions and 28 deletions

View File

@ -297,7 +297,7 @@ bool KIWAY::PlayersClose( bool doForce )
void KIWAY::ExpressMail( FRAME_T aDestination, 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 ); KIWAY_EXPRESS mail( aDestination, aCommand, aPayload, aSource );

View File

@ -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 ) : const std::string& aPayload, wxWindow* aSource ) :
wxEvent( aCommand, wxEVENT_ID ), wxEvent( aCommand, wxEVENT_ID ),
m_destination( aDestination ), m_destination( aDestination ),

View File

@ -786,14 +786,10 @@ void CVPCB_MAINFRAME::UpdateTitle()
void CVPCB_MAINFRAME::SendMessageToEESCHEMA() void CVPCB_MAINFRAME::SendMessageToEESCHEMA()
{ {
char cmd[1024];
int selection;
COMPONENT* Component;
if( m_netlist.IsEmpty() ) if( m_netlist.IsEmpty() )
return; return;
selection = m_ListCmp->GetSelection(); int selection = m_ListCmp->GetSelection();
if ( selection < 0 ) if ( selection < 0 )
selection = 0; selection = 0;
@ -801,12 +797,14 @@ void CVPCB_MAINFRAME::SendMessageToEESCHEMA()
if( m_netlist.GetComponent( selection ) == NULL ) if( m_netlist.GetComponent( selection ) == NULL )
return; return;
Component = m_netlist.GetComponent( selection ); COMPONENT* component = m_netlist.GetComponent( selection );
sprintf( cmd, "$PART: \"%s\"", TO_UTF8( Component->GetReference() ) ); std::string packet = StrPrintf( "$PART: \"%s\"", TO_UTF8( component->GetReference() ) );
SendCommand( MSG_TO_SCH, cmd );
if( Kiface().IsSingle() )
SendCommand( MSG_TO_SCH, packet.c_str() );
else
Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
} }

View File

@ -102,6 +102,7 @@ as such! As such, it is OK to use UTF8 characters:
#include <search_stack.h> #include <search_stack.h>
#include <project.h> #include <project.h>
#include <frame_type.h> #include <frame_type.h>
#include <mail_type.h>
#define VTBL_ENTRY virtual #define VTBL_ENTRY virtual
@ -324,7 +325,7 @@ public:
*/ */
VTBL_ENTRY bool PlayersClose( bool doForce ); 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 * Function Prj

View File

@ -28,24 +28,12 @@
#include <wx/wx.h> #include <wx/wx.h>
#include <frame_type.h> #include <frame_type.h>
#include <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 ExpressMail().
*/
enum MAIL_T
{
MAIL_CROSS_PROBE,
};
/** /**
* Class KIWAY_EXPRESS * 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 class KIWAY_EXPRESS : public wxEvent
{ {
@ -58,7 +46,7 @@ public:
/** /**
* Function Command * Function Command
* returns the EXPRESS_MAIL_T associated with this mail. * returns the MAIL_T associated with this mail.
*/ */
MAIL_T Command() MAIL_T Command()
{ {
@ -78,7 +66,7 @@ public:
//KIWAY_EXPRESS() {} //KIWAY_EXPRESS() {}
KIWAY_EXPRESS( FRAME_T aDestination, KIWAY_EXPRESS( FRAME_T aDestination,
wxEventType aCommand, MAIL_T aCommand,
const std::string& aPayload, const std::string& aPayload,
wxWindow* aSource = NULL ); wxWindow* aSource = NULL );

16
include/mail_type.h Normal file
View File

@ -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_