set eol-style native on new file
This commit is contained in:
parent
9e32b2abdb
commit
88ef06efe2
|
@ -1,185 +1,185 @@
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
/* Cross probing function: handle communication to/from eeschema */
|
/* Cross probing function: handle communication to/from eeschema */
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
|
|
||||||
/* cross-probing.cpp */
|
/* cross-probing.cpp */
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "pcbnew.h"
|
#include "pcbnew.h"
|
||||||
#include "eda_dde.h"
|
#include "eda_dde.h"
|
||||||
|
|
||||||
#include "id.h"
|
#include "id.h"
|
||||||
#include "collectors.h"
|
#include "collectors.h"
|
||||||
|
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
|
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
void RemoteCommand( const char* cmdline )
|
void RemoteCommand( const char* cmdline )
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
|
|
||||||
/** Read a remote command send by eeschema via a socket,
|
/** Read a remote command send by eeschema via a socket,
|
||||||
* port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242)
|
* port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242)
|
||||||
* @param cmdline = received command from eeschema
|
* @param cmdline = received command from eeschema
|
||||||
* Commands are
|
* Commands are
|
||||||
* $PART: "reference" put cursor on component
|
* $PART: "reference" put cursor on component
|
||||||
* $PIN: "pin name" $PART: "reference" put cursor on the footprint pin
|
* $PIN: "pin name" $PART: "reference" put cursor on the footprint pin
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
char line[1024];
|
char line[1024];
|
||||||
wxString msg;
|
wxString msg;
|
||||||
char* idcmd;
|
char* idcmd;
|
||||||
char* text;
|
char* text;
|
||||||
MODULE* module = 0;
|
MODULE* module = 0;
|
||||||
WinEDA_PcbFrame* frame = EDA_Appl->m_PcbFrame;
|
WinEDA_PcbFrame* frame = EDA_Appl->m_PcbFrame;
|
||||||
|
|
||||||
strncpy( line, cmdline, sizeof(line) - 1 );
|
strncpy( line, cmdline, sizeof(line) - 1 );
|
||||||
|
|
||||||
idcmd = strtok( line, " \n\r" );
|
idcmd = strtok( line, " \n\r" );
|
||||||
text = strtok( NULL, " \n\r" );
|
text = strtok( NULL, " \n\r" );
|
||||||
if( (idcmd == NULL) || (text == NULL) )
|
if( (idcmd == NULL) || (text == NULL) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( strcmp( idcmd, "$PART:" ) == 0 )
|
if( strcmp( idcmd, "$PART:" ) == 0 )
|
||||||
{
|
{
|
||||||
msg = CONV_FROM_UTF8( text );
|
msg = CONV_FROM_UTF8( text );
|
||||||
|
|
||||||
module = ReturnModule( frame->m_Pcb, msg );
|
module = ReturnModule( frame->m_Pcb, msg );
|
||||||
|
|
||||||
msg.Printf( _( "Locate module %s %s" ), msg.GetData(),
|
msg.Printf( _( "Locate module %s %s" ), msg.GetData(),
|
||||||
module ? wxT( "Ok" ) : wxT( "not found" ) );
|
module ? wxT( "Ok" ) : wxT( "not found" ) );
|
||||||
|
|
||||||
frame->Affiche_Message( msg );
|
frame->Affiche_Message( msg );
|
||||||
if( module )
|
if( module )
|
||||||
{
|
{
|
||||||
wxClientDC dc( frame->DrawPanel );
|
wxClientDC dc( frame->DrawPanel );
|
||||||
|
|
||||||
frame->DrawPanel->PrepareGraphicContext( &dc );
|
frame->DrawPanel->PrepareGraphicContext( &dc );
|
||||||
frame->DrawPanel->CursorOff( &dc );
|
frame->DrawPanel->CursorOff( &dc );
|
||||||
frame->GetScreen()->m_Curseur = module->m_Pos;
|
frame->GetScreen()->m_Curseur = module->m_Pos;
|
||||||
frame->DrawPanel->CursorOn( &dc );
|
frame->DrawPanel->CursorOn( &dc );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( idcmd && strcmp( idcmd, "$PIN:" ) == 0 )
|
if( idcmd && strcmp( idcmd, "$PIN:" ) == 0 )
|
||||||
{
|
{
|
||||||
wxString pinName, modName;
|
wxString pinName, modName;
|
||||||
D_PAD* pad = NULL;
|
D_PAD* pad = NULL;
|
||||||
int netcode = -1;
|
int netcode = -1;
|
||||||
|
|
||||||
pinName = CONV_FROM_UTF8( text );
|
pinName = CONV_FROM_UTF8( text );
|
||||||
|
|
||||||
text = strtok( NULL, " \n\r" );
|
text = strtok( NULL, " \n\r" );
|
||||||
if( text && strcmp( text, "$PART:" ) == 0 )
|
if( text && strcmp( text, "$PART:" ) == 0 )
|
||||||
text = strtok( NULL, "\n\r" );
|
text = strtok( NULL, "\n\r" );
|
||||||
|
|
||||||
wxClientDC dc( frame->DrawPanel );
|
wxClientDC dc( frame->DrawPanel );
|
||||||
|
|
||||||
frame->DrawPanel->PrepareGraphicContext( &dc );
|
frame->DrawPanel->PrepareGraphicContext( &dc );
|
||||||
|
|
||||||
modName = CONV_FROM_UTF8( text );
|
modName = CONV_FROM_UTF8( text );
|
||||||
module = ReturnModule( frame->m_Pcb, modName );
|
module = ReturnModule( frame->m_Pcb, modName );
|
||||||
if( module )
|
if( module )
|
||||||
pad = ReturnPad( module, pinName );
|
pad = ReturnPad( module, pinName );
|
||||||
|
|
||||||
if( pad )
|
if( pad )
|
||||||
netcode = pad->m_NetCode;
|
netcode = pad->m_NetCode;
|
||||||
|
|
||||||
if( netcode > 0 ) /* hightlighted the net selected net*/
|
if( netcode > 0 ) /* hightlighted the net selected net*/
|
||||||
{
|
{
|
||||||
if( g_HightLigt_Status ) /* erase the old hightlighted net */
|
if( g_HightLigt_Status ) /* erase the old hightlighted net */
|
||||||
frame->Hight_Light( &dc );
|
frame->Hight_Light( &dc );
|
||||||
|
|
||||||
g_HightLigth_NetCode = netcode;
|
g_HightLigth_NetCode = netcode;
|
||||||
frame->Hight_Light( &dc ); /* hightlighted the new one */
|
frame->Hight_Light( &dc ); /* hightlighted the new one */
|
||||||
|
|
||||||
frame->DrawPanel->CursorOff( &dc );
|
frame->DrawPanel->CursorOff( &dc );
|
||||||
frame->GetScreen()->m_Curseur = pad->m_Pos;
|
frame->GetScreen()->m_Curseur = pad->m_Pos;
|
||||||
frame->DrawPanel->CursorOn( &dc );
|
frame->DrawPanel->CursorOn( &dc );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( module == NULL )
|
if( module == NULL )
|
||||||
msg.Printf( _( "module %s not found" ), text );
|
msg.Printf( _( "module %s not found" ), text );
|
||||||
else if( pad == NULL )
|
else if( pad == NULL )
|
||||||
msg.Printf( _( "Pin %s (module %s) not found" ), pinName.GetData(), modName.GetData() );
|
msg.Printf( _( "Pin %s (module %s) not found" ), pinName.GetData(), modName.GetData() );
|
||||||
else
|
else
|
||||||
msg.Printf( _( "Locate Pin %s (module %s)" ), pinName.GetData(), modName.GetData() );
|
msg.Printf( _( "Locate Pin %s (module %s)" ), pinName.GetData(), modName.GetData() );
|
||||||
|
|
||||||
frame->Affiche_Message( msg );
|
frame->Affiche_Message( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( module ) // if found, center the module on screen.
|
if( module ) // if found, center the module on screen.
|
||||||
frame->Recadre_Trace( false );
|
frame->Recadre_Trace( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// see wxstruct.h
|
// see wxstruct.h
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
void WinEDA_PcbFrame::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
|
void WinEDA_PcbFrame::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/** Send a remote command to eeschema via a socket,
|
/** Send a remote command to eeschema via a socket,
|
||||||
* @param objectToSync = item to be located on schematic (module, pin or text)
|
* @param objectToSync = item to be located on schematic (module, pin or text)
|
||||||
* Commands are
|
* Commands are
|
||||||
* $PART: "reference" put cursor on component anchor
|
* $PART: "reference" put cursor on component anchor
|
||||||
* $PART: "reference" $PAD: "pad number" put cursor on the component pin
|
* $PART: "reference" $PAD: "pad number" put cursor on the component pin
|
||||||
* $PART: "reference" $REF: "reference" put cursor on the component ref
|
* $PART: "reference" $REF: "reference" put cursor on the component ref
|
||||||
* $PART: "reference" $VAL: "value" put cursor on the component value
|
* $PART: "reference" $VAL: "value" put cursor on the component value
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
char cmd[1024];
|
char cmd[1024];
|
||||||
const char* text_key;
|
const char* text_key;
|
||||||
MODULE* module = NULL;
|
MODULE* module = NULL;
|
||||||
D_PAD* pad;
|
D_PAD* pad;
|
||||||
TEXTE_MODULE* text_mod;
|
TEXTE_MODULE* text_mod;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
if( objectToSync == NULL )
|
if( objectToSync == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch( objectToSync->Type() )
|
switch( objectToSync->Type() )
|
||||||
{
|
{
|
||||||
case TYPEMODULE:
|
case TYPEMODULE:
|
||||||
module = (MODULE*) objectToSync;
|
module = (MODULE*) objectToSync;
|
||||||
sprintf( cmd, "$PART: \"%s\"",
|
sprintf( cmd, "$PART: \"%s\"",
|
||||||
CONV_TO_UTF8( module->m_Reference->m_Text ) );
|
CONV_TO_UTF8( module->m_Reference->m_Text ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPEPAD:
|
case TYPEPAD:
|
||||||
module = (MODULE*) objectToSync->m_Parent;
|
module = (MODULE*) objectToSync->m_Parent;
|
||||||
pad = (D_PAD*) objectToSync;
|
pad = (D_PAD*) objectToSync;
|
||||||
msg = pad->ReturnStringPadName();
|
msg = pad->ReturnStringPadName();
|
||||||
sprintf( cmd, "$PART: \"%s\" $PAD: \"%s\"",
|
sprintf( cmd, "$PART: \"%s\" $PAD: \"%s\"",
|
||||||
CONV_TO_UTF8( module->m_Reference->m_Text ),
|
CONV_TO_UTF8( module->m_Reference->m_Text ),
|
||||||
CONV_TO_UTF8( msg ) );
|
CONV_TO_UTF8( msg ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPETEXTEMODULE:
|
case TYPETEXTEMODULE:
|
||||||
#define REFERENCE 0
|
#define REFERENCE 0
|
||||||
#define VALUE 1
|
#define VALUE 1
|
||||||
module = (MODULE*) objectToSync->m_Parent;
|
module = (MODULE*) objectToSync->m_Parent;
|
||||||
text_mod = (TEXTE_MODULE*) objectToSync;
|
text_mod = (TEXTE_MODULE*) objectToSync;
|
||||||
if( text_mod->m_Type == REFERENCE )
|
if( text_mod->m_Type == REFERENCE )
|
||||||
text_key = "$REF:";
|
text_key = "$REF:";
|
||||||
else if( text_mod->m_Type == VALUE )
|
else if( text_mod->m_Type == VALUE )
|
||||||
text_key = "$VAL:";
|
text_key = "$VAL:";
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
|
||||||
sprintf( cmd, "$PART: \"%s\" %s \"%s\"",
|
sprintf( cmd, "$PART: \"%s\" %s \"%s\"",
|
||||||
CONV_TO_UTF8( module->m_Reference->m_Text ),
|
CONV_TO_UTF8( module->m_Reference->m_Text ),
|
||||||
text_key,
|
text_key,
|
||||||
CONV_TO_UTF8( text_mod->m_Text ) );
|
CONV_TO_UTF8( text_mod->m_Text ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( module )
|
if( module )
|
||||||
{
|
{
|
||||||
SendCommand( MSG_TO_SCH, cmd );
|
SendCommand( MSG_TO_SCH, cmd );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue