135
std::string FormatProbeItem( BOARD_ITEM* aItem )
139
switch( aItem->Type() )
142
module = (MODULE*) aItem;
143
return StrPrintf( "$PART: \"%s\"", TO_UTF8( module->GetReference() ) );
147
module = (MODULE*) aItem->GetParent();
148
wxString pad = ((D_PAD*)aItem)->GetPadName();
150
return StrPrintf( "$PART: \"%s\" $PAD: \"%s\"",
151
TO_UTF8( module->GetReference() ),
155
case PCB_MODULE_TEXT_T:
157
module = (MODULE*) aItem->GetParent();
159
TEXTE_MODULE* text_mod = (TEXTE_MODULE*) aItem;
161
const char* text_key;
163
if( text_mod->GetType() == TEXTE_MODULE::TEXT_is_REFERENCE )
165
else if( text_mod->GetType() == TEXTE_MODULE::TEXT_is_VALUE )
170
return StrPrintf( "$PART: \"%s\" %s \"%s\"",
171
TO_UTF8( module->GetReference() ),
173
TO_UTF8( text_mod->GetText() ) );
134
185
* Send a remote command to Eeschema via a socket,
135
186
* @param objectToSync = item to be located on schematic (module, pin or text)
139
190
* $PART: "reference" $REF: "reference" put cursor on the component ref
140
191
* $PART: "reference" $VAL: "value" put cursor on the component value
142
void PCB_EDIT_FRAME::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
193
void PCB_EDIT_FRAME::SendMessageToEESCHEMA( BOARD_ITEM* aSyncItem )
145
const char* text_key;
146
MODULE* module = NULL;
148
TEXTE_MODULE* text_mod;
151
if( objectToSync == NULL )
196
wxASSERT( aSyncItem ); // can't we fix the caller?
154
switch( objectToSync->Type() )
202
std::string packet = FormatProbeItem( aSyncItem );
157
module = (MODULE*) objectToSync;
158
sprintf( cmd, "$PART: \"%s\"", TO_UTF8( module->GetReference() ) );
162
module = (MODULE*) objectToSync->GetParent();
163
pad = (D_PAD*) objectToSync;
164
msg = pad->GetPadName();
165
sprintf( cmd, "$PART: \"%s\" $PAD: \"%s\"",
166
TO_UTF8( module->GetReference() ),
170
case PCB_MODULE_TEXT_T:
171
module = (MODULE*) objectToSync->GetParent();
172
text_mod = (TEXTE_MODULE*) objectToSync;
174
if( text_mod->GetType() == TEXTE_MODULE::TEXT_is_REFERENCE )
176
else if( text_mod->GetType() == TEXTE_MODULE::TEXT_is_VALUE )
206
if( Kiface().IsSingle() )
207
SendCommand( MSG_TO_SCH, packet.c_str() );
181
sprintf( cmd, "$PART: \"%s\" %s \"%s\"",
182
TO_UTF8( module->GetReference() ),
184
TO_UTF8( text_mod->GetText() ) );
210
// Typically ExpressMail is going to be s-expression packets, but since
211
// we have existing interpreter of the cross probe packet on the other
212
// side in place, we use that here.
213
Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
219
void PCB_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
221
const std::string& payload = mail.GetPayload();
223
switch( mail.Command() )
193
SendCommand( MSG_TO_SCH, cmd );
225
case MAIL_CROSS_PROBE:
226
ExecuteRemoteCommand( payload.c_str() );