Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
c931d47a
Commit
c931d47a
authored
Oct 08, 2007
by
raburton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set eol-style native on new file
parent
af16e7a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
142 additions
and
142 deletions
+142
-142
cross-probing.cpp
eeschema/cross-probing.cpp
+142
-142
No files found.
eeschema/cross-probing.cpp
View file @
c931d47a
/*********************/
/*********************/
/* cross-probing.cpp */
/* cross-probing.cpp */
/*********************/
/*********************/
#include "fctsys.h"
#include "fctsys.h"
#include "common.h"
#include "common.h"
#include "program.h"
#include "program.h"
#include "libcmp.h"
#include "libcmp.h"
#include "general.h"
#include "general.h"
#include "eda_dde.h"
#include "eda_dde.h"
#include "id.h"
#include "id.h"
#include "protos.h"
#include "protos.h"
/***************************************************************/
/***************************************************************/
void
RemoteCommand
(
const
char
*
cmdline
)
void
RemoteCommand
(
const
char
*
cmdline
)
/***************************************************************/
/***************************************************************/
/** Read a remote command sent by pcbnew (via a socket connection) ,
/** Read a remote command sent by pcbnew (via a socket connection) ,
* so when user selects a module or pin in pcbnew,
* so when user selects a module or pin in pcbnew,
* eeschema shows that same component or pin.
* eeschema shows that same component or pin.
* The cursor is put on the item
* The cursor is put on the item
* port KICAD_SCH_PORT_SERVICE_NUMBER (currently 4243)
* port KICAD_SCH_PORT_SERVICE_NUMBER (currently 4243)
* @param cmdline = received command from pcbnew
* @param cmdline = received command from pcbnew
* commands are:
* commands are:
* $PART: "reference" put cursor on component
* $PART: "reference" put cursor on component
* $PART: "reference" $REF: "ref" put cursor on reference component
* $PART: "reference" $REF: "ref" put cursor on reference component
* $PART: "reference" $VAL: "value" put cursor on value component
* $PART: "reference" $VAL: "value" put cursor on value component
* $PART: "reference" $PAD: "pin name" put cursor on the component pin
* $PART: "reference" $PAD: "pin name" put cursor on the component pin
*/
*/
{
{
char
line
[
1024
];
char
line
[
1024
];
char
*
idcmd
;
char
*
idcmd
;
char
*
text
;
char
*
text
;
WinEDA_SchematicFrame
*
frame
=
EDA_Appl
->
m_SchematicFrame
;
WinEDA_SchematicFrame
*
frame
=
EDA_Appl
->
m_SchematicFrame
;
wxString
part_ref
,
msg
;
wxString
part_ref
,
msg
;
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
)
return
;
return
;
part_ref
=
CONV_FROM_UTF8
(
text
);
part_ref
=
CONV_FROM_UTF8
(
text
);
/* look for a complement */
/* look for a complement */
idcmd
=
strtok
(
NULL
,
"
\n\r
"
);
idcmd
=
strtok
(
NULL
,
"
\n\r
"
);
if
(
idcmd
==
NULL
)
// component only
if
(
idcmd
==
NULL
)
// component only
{
{
frame
->
FindComponentAndItem
(
part_ref
,
true
,
0
,
wxEmptyString
,
false
);
frame
->
FindComponentAndItem
(
part_ref
,
true
,
0
,
wxEmptyString
,
false
);
return
;
return
;
}
}
text
=
strtok
(
NULL
,
"
\"\n\r
"
);
text
=
strtok
(
NULL
,
"
\"\n\r
"
);
if
(
text
==
NULL
)
if
(
text
==
NULL
)
return
;
return
;
msg
=
CONV_FROM_UTF8
(
text
);
msg
=
CONV_FROM_UTF8
(
text
);
if
(
strcmp
(
idcmd
,
"$REF:"
)
==
0
)
if
(
strcmp
(
idcmd
,
"$REF:"
)
==
0
)
{
{
frame
->
FindComponentAndItem
(
part_ref
,
true
,
2
,
msg
,
false
);
frame
->
FindComponentAndItem
(
part_ref
,
true
,
2
,
msg
,
false
);
}
}
else
if
(
strcmp
(
idcmd
,
"$VAL:"
)
==
0
)
else
if
(
strcmp
(
idcmd
,
"$VAL:"
)
==
0
)
{
{
frame
->
FindComponentAndItem
(
part_ref
,
true
,
3
,
msg
,
false
);
frame
->
FindComponentAndItem
(
part_ref
,
true
,
3
,
msg
,
false
);
}
}
else
if
(
strcmp
(
idcmd
,
"$PAD:"
)
==
0
)
else
if
(
strcmp
(
idcmd
,
"$PAD:"
)
==
0
)
{
{
frame
->
FindComponentAndItem
(
part_ref
,
true
,
1
,
msg
,
false
);
frame
->
FindComponentAndItem
(
part_ref
,
true
,
1
,
msg
,
false
);
}
}
else
else
frame
->
FindComponentAndItem
(
part_ref
,
true
,
0
,
wxEmptyString
,
false
);
frame
->
FindComponentAndItem
(
part_ref
,
true
,
0
,
wxEmptyString
,
false
);
}
}
/*****************************************************************************/
/*****************************************************************************/
void
WinEDA_SchematicFrame
::
SendMessageToPCBNEW
(
EDA_BaseStruct
*
objectToSync
)
void
WinEDA_SchematicFrame
::
SendMessageToPCBNEW
(
EDA_BaseStruct
*
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 board (footprint, pad or text)
* @param objectToSync = item to be located on board (footprint, pad or text)
* Commands are
* Commands are
* $PART: reference put cursor on footprint anchor
* $PART: reference put cursor on footprint anchor
* $PIN: number $PART: reference put cursor on the footprint pad
* $PIN: number $PART: reference put cursor on the footprint pad
*/
*/
{
{
if
(
objectToSync
==
NULL
)
return
;
if
(
objectToSync
==
NULL
)
return
;
LibDrawPin
*
Pin
=
NULL
;
LibDrawPin
*
Pin
=
NULL
;
EDA_SchComponentStruct
*
LibItem
=
NULL
;
EDA_SchComponentStruct
*
LibItem
=
NULL
;
char
Line
[
1024
];
char
Line
[
1024
];
/* Cross probing to pcbnew if a pin or a component is found */
/* Cross probing to pcbnew if a pin or a component is found */
switch
(
objectToSync
->
Type
()
)
switch
(
objectToSync
->
Type
()
)
{
{
case
COMPONENT_FIELD_DRAW_TYPE
:
case
COMPONENT_FIELD_DRAW_TYPE
:
{
{
PartTextStruct
*
Field
=
(
PartTextStruct
*
)
objectToSync
;
PartTextStruct
*
Field
=
(
PartTextStruct
*
)
objectToSync
;
LibItem
=
(
EDA_SchComponentStruct
*
)
Field
->
m_Parent
;
LibItem
=
(
EDA_SchComponentStruct
*
)
Field
->
m_Parent
;
if
(
LibItem
==
NULL
)
break
;
if
(
LibItem
==
NULL
)
break
;
sprintf
(
Line
,
"$PART: %s"
,
CONV_TO_UTF8
(
LibItem
->
m_Field
[
REFERENCE
].
m_Text
)
);
sprintf
(
Line
,
"$PART: %s"
,
CONV_TO_UTF8
(
LibItem
->
m_Field
[
REFERENCE
].
m_Text
)
);
SendCommand
(
MSG_TO_PCB
,
Line
);
SendCommand
(
MSG_TO_PCB
,
Line
);
}
}
break
;
break
;
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
LibItem
=
(
EDA_SchComponentStruct
*
)
objectToSync
;
LibItem
=
(
EDA_SchComponentStruct
*
)
objectToSync
;
sprintf
(
Line
,
"$PART: %s"
,
CONV_TO_UTF8
(
LibItem
->
m_Field
[
REFERENCE
].
m_Text
)
);
sprintf
(
Line
,
"$PART: %s"
,
CONV_TO_UTF8
(
LibItem
->
m_Field
[
REFERENCE
].
m_Text
)
);
SendCommand
(
MSG_TO_PCB
,
Line
);
SendCommand
(
MSG_TO_PCB
,
Line
);
break
;
break
;
case
COMPONENT_PIN_DRAW_TYPE
:
case
COMPONENT_PIN_DRAW_TYPE
:
Pin
=
(
LibDrawPin
*
)
objectToSync
;
Pin
=
(
LibDrawPin
*
)
objectToSync
;
LibItem
=
(
EDA_SchComponentStruct
*
)
Pin
->
m_Parent
;
LibItem
=
(
EDA_SchComponentStruct
*
)
Pin
->
m_Parent
;
if
(
LibItem
==
NULL
)
break
;
if
(
LibItem
==
NULL
)
break
;
if
(
Pin
->
m_PinNum
)
if
(
Pin
->
m_PinNum
)
{
{
wxString
pinnum
;
wxString
pinnum
;
Pin
->
ReturnPinStringNum
(
pinnum
);
Pin
->
ReturnPinStringNum
(
pinnum
);
sprintf
(
Line
,
"$PIN: %s $PART: %s"
,
CONV_TO_UTF8
(
pinnum
),
sprintf
(
Line
,
"$PIN: %s $PART: %s"
,
CONV_TO_UTF8
(
pinnum
),
CONV_TO_UTF8
(
LibItem
->
m_Field
[
REFERENCE
].
m_Text
)
);
CONV_TO_UTF8
(
LibItem
->
m_Field
[
REFERENCE
].
m_Text
)
);
}
}
else
else
sprintf
(
Line
,
"$PART: %s"
,
CONV_TO_UTF8
(
LibItem
->
m_Field
[
REFERENCE
].
m_Text
)
);
sprintf
(
Line
,
"$PART: %s"
,
CONV_TO_UTF8
(
LibItem
->
m_Field
[
REFERENCE
].
m_Text
)
);
SendCommand
(
MSG_TO_PCB
,
Line
);
SendCommand
(
MSG_TO_PCB
,
Line
);
break
;
break
;
default
:
default
:
break
;
break
;
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment