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
1fec58e8
Commit
1fec58e8
authored
Oct 08, 2009
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eeschema: fixed bugs in netlist generation and drag components
parent
ee918d7d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
33 deletions
+41
-33
block.cpp
eeschema/block.cpp
+16
-25
class_libentry.cpp
eeschema/class_libentry.cpp
+22
-7
class_libentry.h
eeschema/class_libentry.h
+3
-1
No files found.
eeschema/block.cpp
View file @
1fec58e8
...
...
@@ -36,8 +36,9 @@ void DuplicateItemsInList( SCH_SCREEN* screen,
/* Fonctions Locales */
static
void
CollectStructsToDrag
(
SCH_SCREEN
*
screen
);
static
void
AddPickedItem
(
SCH_SCREEN
*
screen
,
wxPoint
aPosition
);
static
LIB_DRAW_ITEM
*
GetNextPinPosition
(
SCH_COMPONENT
*
aDrawLibItem
,
wxPoint
&
aPosition
);
static
LIB_PIN
*
GetNextPinPosition
(
SCH_COMPONENT
*
aDrawLibItem
,
wxPoint
&
aPosition
,
bool
aSearchFirst
);
static
void
DrawMovingBlockOutlines
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
...
...
@@ -650,10 +651,10 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
if
(
Struct
->
Type
()
==
TYPE_SCH_COMPONENT
)
{
// Add all pins of the selected component to list
LIB_
DRAW_ITEM
*
DrawItem
;
LIB_
PIN
*
pin
;
wxPoint
pos
;
DrawItem
=
GetNextPinPosition
(
(
SCH_COMPONENT
*
)
Struct
,
pos
);
while
(
DrawItem
)
pin
=
GetNextPinPosition
(
(
SCH_COMPONENT
*
)
Struct
,
pos
,
true
);
while
(
pin
)
{
if
(
!
screen
->
m_BlockLocate
.
Inside
(
pos
)
)
{
...
...
@@ -663,7 +664,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
AddPickedItem
(
screen
,
pos
);
}
DrawItem
=
GetNextPinPosition
(
NULL
,
pos
);
pin
=
GetNextPinPosition
(
(
SCH_COMPONENT
*
)
Struct
,
pos
,
false
);
}
}
...
...
@@ -845,31 +846,26 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
/*********************************************************************************/
static
LIB_DRAW_ITEM
*
GetNextPinPosition
(
SCH_COMPONENT
*
aDrawLibItem
,
wxPoint
&
aPosition
)
static
LIB_PIN
*
GetNextPinPosition
(
SCH_COMPONENT
*
aDrawLibItem
,
wxPoint
&
aPosition
,
bool
aSearchFirst
)
/*********************************************************************************/
/** GetNextPinPosition()
* calculate position of the "next" pin of the aDrawLibItem component
* if aDrawLibItem is non null : search for the first pin
* if aDrawLibItem == NULL, search the next pin
* returns its position
* @param aDrawLibItem = component test. search for the first pin
* if NULL, serach for the next pin for each call
* @param aDrawLibItem = component to test.
* @param aPosition = the calculated pin position, according to the component orientation and position
* @param aSearchFirst = if true, search for the first pin
* @return a pointer to the pin
*/
{
static
LIB_COMPONENT
*
Entry
;
static
LIB_PIN
*
NextPin
;
static
int
Multi
,
convert
,
TransMat
[
2
][
2
];
int
orient
;
LIB_PIN
*
Pin
;
static
wxPoint
CmpPosition
;
static
LIB_PIN
*
Pin
;
if
(
a
DrawLibItem
)
if
(
a
SearchFirst
)
{
NextPin
=
NULL
;
Entry
=
CMP_LIBRARY
::
FindLibraryComponent
(
aDrawLibItem
->
m_ChipName
);
if
(
Entry
==
NULL
)
...
...
@@ -882,9 +878,9 @@ static LIB_DRAW_ITEM* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
memcpy
(
TransMat
,
aDrawLibItem
->
m_Transform
,
sizeof
(
TransMat
)
);
}
else
Pin
=
NextPin
;
Pin
=
Entry
->
GetNextPin
(
Pin
)
;
for
(
;
Pin
!=
NULL
;
Next
Pin
=
Entry
->
GetNextPin
(
Pin
)
)
for
(
;
Pin
!=
NULL
;
Pin
=
Entry
->
GetNextPin
(
Pin
)
)
{
wxASSERT
(
Pin
->
Type
()
==
COMPONENT_PIN_DRAW_TYPE
);
...
...
@@ -894,14 +890,9 @@ static LIB_DRAW_ITEM* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
if
(
convert
&&
Pin
->
m_Convert
&&
(
Pin
->
m_Convert
!=
convert
)
)
continue
;
/* Calculate the pin orient (according to the component orientation) */
orient
=
Pin
->
ReturnPinDrawOrient
(
TransMat
);
/* Calculate the pin position (according to the component orientation) */
aPosition
=
TransformCoordinate
(
TransMat
,
Pin
->
m_Pos
)
+
CmpPosition
;
return
Pin
;
}
NextPin
=
NULL
;
return
NULL
;
}
eeschema/class_libentry.cpp
View file @
1fec58e8
...
...
@@ -397,19 +397,34 @@ void LIB_COMPONENT::AddDrawItem( LIB_DRAW_ITEM* item )
LIB_DRAW_ITEM
*
LIB_COMPONENT
::
GetNextDrawItem
(
LIB_DRAW_ITEM
*
item
,
KICAD_T
type
)
{
/* Return the next draw object pointer.
* If item is NULL return the first item of type in the list.
*/
if
(
m_Drawings
.
empty
()
)
return
NULL
;
if
(
item
==
NULL
&&
type
==
TYPE_NOT_INIT
)
if
(
item
==
NULL
&&
type
==
TYPE_NOT_INIT
)
// type is unspecified
return
&
m_Drawings
[
0
];
for
(
size_t
i
=
0
;
i
<
m_Drawings
.
size
()
-
1
;
i
++
)
// Search for last item
size_t
idx
=
0
;
if
(
item
)
{
if
(
item
!=
&
m_Drawings
[
i
]
)
continue
;
for
(
;
idx
<
m_Drawings
.
size
();
idx
++
)
{
if
(
item
==
&
m_Drawings
[
idx
]
)
{
idx
++
;
// Prepare the next item search
break
;
}
}
}
if
(
type
==
TYPE_NOT_INIT
||
m_Drawings
[
i
+
1
].
Type
()
==
type
)
return
&
m_Drawings
[
i
+
1
];
// Search the next item
for
(
;
idx
<
m_Drawings
.
size
();
idx
++
)
{
if
(
type
==
TYPE_NOT_INIT
||
m_Drawings
[
idx
].
Type
()
==
type
)
return
&
m_Drawings
[
idx
];
}
return
NULL
;
...
...
eeschema/class_libentry.h
View file @
1fec58e8
...
...
@@ -233,11 +233,13 @@ public:
WinEDA_DrawPanel
*
panel
=
NULL
,
wxDC
*
dc
=
NULL
);
/**
/**
GetNextDrawItem()
* Return the next draw object pointer.
*
* @param item - Pointer to the current draw item. Setting item NULL
* with return the first item of type in the list.
* @param type - type of searched item (filter).
* if TYPE_NOT_INIT search for all items types
*
*/
...
...
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