50 changed files with 396 additions and 267 deletions
-
383d-viewer/3d_draw.cpp
-
15change_log.txt
-
2cvpcb/cvstruct.h
-
9cvpcb/displayframe.cpp
-
94eeschema/controle.cpp
-
142eeschema/cross-probing.cpp
-
7eeschema/libedit_onrightclick.cpp
-
1eeschema/makefile.include
-
7eeschema/onrightclick.cpp
-
3eeschema/viewlibs.cpp
-
7gerbview/onrightclick.cpp
-
2include/drawpanel_wxstruct.h
-
8include/pcbstruct.h
-
23include/wxstruct.h
-
8pcbnew/autoplac.cpp
-
13pcbnew/autorout.cpp
-
68pcbnew/basepcbframe.cpp
-
2pcbnew/block.cpp
-
2pcbnew/class_board.cpp
-
2pcbnew/class_module.cpp
-
4pcbnew/class_pcb_text.cpp
-
8pcbnew/class_text_mod.cpp
-
6pcbnew/class_track.cpp
-
4pcbnew/classpcb.cpp
-
2pcbnew/classtrc.cpp.notused
-
4pcbnew/collectors.cpp
-
16pcbnew/controle.cpp
-
6pcbnew/cross-probing.cpp
-
4pcbnew/dialog_edit_module.cpp
-
6pcbnew/edgemod.cpp
-
8pcbnew/edit.cpp
-
2pcbnew/editrack-part2.cpp
-
2pcbnew/export_gencad.cpp
-
6pcbnew/gen_modules_placefile.cpp
-
12pcbnew/hotkeys.cpp
-
2pcbnew/lay2plot.cpp
-
6pcbnew/locate.cpp
-
6pcbnew/modedit_onclick.cpp
-
18pcbnew/modules.cpp
-
7pcbnew/move-drag_pads.cpp
-
51pcbnew/onrightclick.cpp
-
2pcbnew/pcbnew.h
-
2pcbnew/pcbtexte.cpp
-
2pcbnew/plotgerb.cpp
-
2pcbnew/plothpgl.cpp
-
2pcbnew/plotps.cpp
-
4pcbnew/router.cpp
-
4pcbnew/set_color.cpp
-
2pcbnew/tracepcb.cpp
-
10share/drawpanel.cpp
@ -0,0 +1,142 @@ |
|||
/*********************/ |
|||
/* cross-probing.cpp */ |
|||
/*********************/ |
|||
|
|||
#include "fctsys.h"
|
|||
|
|||
#include "common.h"
|
|||
#include "program.h"
|
|||
#include "libcmp.h"
|
|||
#include "general.h"
|
|||
|
|||
#include "eda_dde.h"
|
|||
|
|||
#include "id.h"
|
|||
|
|||
#include "protos.h"
|
|||
|
|||
|
|||
/***************************************************************/ |
|||
void RemoteCommand( const char* cmdline ) |
|||
/***************************************************************/ |
|||
|
|||
/** Read a remote command sent by pcbnew (via a socket connection) ,
|
|||
* so when user selects a module or pin in pcbnew, |
|||
* eeschema shows that same component or pin. |
|||
* The cursor is put on the item |
|||
* port KICAD_SCH_PORT_SERVICE_NUMBER (currently 4243) |
|||
* @param cmdline = received command from pcbnew |
|||
* commands are: |
|||
* $PART: "reference" put cursor on component |
|||
* $PART: "reference" $REF: "ref" put cursor on reference component |
|||
* $PART: "reference" $VAL: "value" put cursor on value component |
|||
* $PART: "reference" $PAD: "pin name" put cursor on the component pin |
|||
*/ |
|||
{ |
|||
char line[1024]; |
|||
char* idcmd; |
|||
char* text; |
|||
WinEDA_SchematicFrame* frame = EDA_Appl->m_SchematicFrame; |
|||
wxString part_ref, msg; |
|||
|
|||
strncpy( line, cmdline, sizeof(line) - 1 ); |
|||
|
|||
idcmd = strtok( line, " \n\r" ); |
|||
text = strtok( NULL, "\"\n\r" ); |
|||
if( (idcmd == NULL) || (text == NULL) ) |
|||
return; |
|||
|
|||
if( strcmp( idcmd, "$PART:" ) != 0 ) |
|||
return; |
|||
|
|||
part_ref = CONV_FROM_UTF8( text ); |
|||
|
|||
/* look for a complement */ |
|||
idcmd = strtok( NULL, " \n\r" ); |
|||
if( idcmd == NULL ) // component only
|
|||
{ |
|||
frame->FindComponentAndItem( part_ref, true, 0, wxEmptyString, false ); |
|||
return; |
|||
} |
|||
|
|||
text = strtok( NULL, "\"\n\r" ); |
|||
if( text == NULL ) |
|||
return; |
|||
|
|||
msg = CONV_FROM_UTF8( text ); |
|||
|
|||
if( strcmp( idcmd, "$REF:" ) == 0 ) |
|||
{ |
|||
frame->FindComponentAndItem( part_ref, true, 2, msg, false ); |
|||
} |
|||
else if( strcmp( idcmd, "$VAL:" ) == 0 ) |
|||
{ |
|||
frame->FindComponentAndItem( part_ref, true, 3, msg, false ); |
|||
} |
|||
else if( strcmp( idcmd, "$PAD:" ) == 0 ) |
|||
{ |
|||
frame->FindComponentAndItem( part_ref, true, 1, msg, false ); |
|||
} |
|||
else |
|||
frame->FindComponentAndItem( part_ref, true, 0, wxEmptyString, false ); |
|||
} |
|||
|
|||
|
|||
/*****************************************************************************/ |
|||
void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectToSync ) |
|||
/*****************************************************************************/ |
|||
|
|||
/** Send a remote command to eeschema via a socket,
|
|||
* @param objectToSync = item to be located on board (footprint, pad or text) |
|||
* Commands are |
|||
* $PART: reference put cursor on footprint anchor |
|||
* $PIN: number $PART: reference put cursor on the footprint pad |
|||
*/ |
|||
{ |
|||
if ( objectToSync == NULL )return; |
|||
|
|||
LibDrawPin* Pin = NULL; |
|||
EDA_SchComponentStruct* LibItem = NULL; |
|||
char Line[1024]; |
|||
|
|||
/* Cross probing to pcbnew if a pin or a component is found */ |
|||
switch( objectToSync->Type() ) |
|||
{ |
|||
case COMPONENT_FIELD_DRAW_TYPE: |
|||
{ |
|||
PartTextStruct* Field = (PartTextStruct*) objectToSync; |
|||
LibItem = (EDA_SchComponentStruct*) Field->m_Parent; |
|||
if( LibItem == NULL ) break; |
|||
sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->m_Field[REFERENCE].m_Text ) ); |
|||
SendCommand( MSG_TO_PCB, Line ); |
|||
} |
|||
break; |
|||
|
|||
case DRAW_LIB_ITEM_STRUCT_TYPE: |
|||
LibItem = (EDA_SchComponentStruct*) objectToSync; |
|||
sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->m_Field[REFERENCE].m_Text ) ); |
|||
SendCommand( MSG_TO_PCB, Line ); |
|||
break; |
|||
|
|||
|
|||
case COMPONENT_PIN_DRAW_TYPE: |
|||
Pin = (LibDrawPin*) objectToSync; |
|||
LibItem = (EDA_SchComponentStruct *) Pin->m_Parent; |
|||
if( LibItem == NULL ) break; |
|||
if ( Pin->m_PinNum ) |
|||
{ |
|||
wxString pinnum; |
|||
Pin->ReturnPinStringNum( pinnum ); |
|||
sprintf( Line, "$PIN: %s $PART: %s", CONV_TO_UTF8( pinnum ), |
|||
CONV_TO_UTF8( LibItem->m_Field[REFERENCE].m_Text ) ); |
|||
} |
|||
else |
|||
sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->m_Field[REFERENCE].m_Text ) ); |
|||
|
|||
SendCommand( MSG_TO_PCB, Line ); |
|||
break; |
|||
|
|||
default: |
|||
break; |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue