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
70c30bce
Commit
70c30bce
authored
Jun 20, 2012
by
Moses McKnight
Committed by
jean-pierre charras
Jun 20, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit patches from Moses McKnight, to avoid duplicate junctions.
parent
52ee7c6e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
31 deletions
+34
-31
bus-wire-junction.cpp
eeschema/bus-wire-junction.cpp
+4
-23
onleftclick.cpp
eeschema/onleftclick.cpp
+13
-6
sch_screen.cpp
eeschema/sch_screen.cpp
+17
-2
No files found.
eeschema/bus-wire-junction.cpp
View file @
70c30bce
...
...
@@ -255,14 +255,7 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
screen
->
SetCurItem
(
NULL
);
m_canvas
->
EndMouseCapture
(
-
1
,
-
1
,
wxEmptyString
,
false
);
DLIST
<
SCH_ITEM
>
tmp
;
for
(
item
=
s_wires
.
begin
();
item
!=
NULL
;
item
=
item
->
Next
()
)
tmp
.
PushBack
(
(
SCH_ITEM
*
)
item
->
Clone
()
);
// Temporarily add the new segments to the schematic item list to test if any
// junctions are required.
screen
->
Append
(
tmp
);
screen
->
Append
(
s_wires
);
// Correct and remove segments that need merged.
screen
->
SchematicCleanUp
(
NULL
,
DC
);
...
...
@@ -271,27 +264,15 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
// removed by a cleanup, a junction may be needed to connect the segment's end point
// which is also the same as the previous segment's start point.
if
(
screen
->
IsJunctionNeeded
(
segment
->
GetEndPoint
()
)
)
s
_wires
.
Append
(
AddJunction
(
DC
,
segment
->
GetEndPoint
()
)
);
s
creen
->
Append
(
AddJunction
(
DC
,
segment
->
GetEndPoint
()
)
);
else
if
(
screen
->
IsJunctionNeeded
(
segment
->
GetStartPoint
()
)
)
s
_wires
.
Append
(
AddJunction
(
DC
,
segment
->
GetStartPoint
()
)
);
s
creen
->
Append
(
AddJunction
(
DC
,
segment
->
GetStartPoint
()
)
);
// Automatically place a junction on the start point if necessary because the cleanup
// can suppress intermediate points by merging wire segments.
if
(
screen
->
IsJunctionNeeded
(
s_startPoint
)
)
s_wires
.
Append
(
AddJunction
(
DC
,
s_startPoint
)
);
// Make a copy of the original wires, buses, and junctions.
for
(
item
=
s_oldWires
.
begin
();
item
!=
NULL
;
item
=
item
->
Next
()
)
tmp
.
PushBack
(
(
SCH_ITEM
*
)
item
->
Clone
()
);
screen
->
Append
(
AddJunction
(
DC
,
s_startPoint
)
);
// Restore the old wires.
if
(
tmp
.
GetCount
()
!=
0
)
screen
->
ReplaceWires
(
tmp
);
// Now add the new wires and any required junctions to the schematic item list.
screen
->
Append
(
s_wires
);
screen
->
SchematicCleanUp
(
NULL
,
DC
);
m_canvas
->
Refresh
();
// Put the snap shot of the previous wire, buses, and junctions in the undo/redo list.
...
...
eeschema/onleftclick.cpp
View file @
70c30bce
...
...
@@ -86,6 +86,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
wxFAIL_MSG
(
wxT
(
"SCH_EDIT_FRAME::OnLeftClick error. Item type <"
)
+
item
->
GetClass
()
+
wxT
(
"> is already being edited."
)
);
item
->
ClearFlags
();
break
;
}
}
else
...
...
@@ -123,11 +124,14 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case
ID_NOCONN_BUTT
:
if
(
(
item
==
NULL
)
||
(
item
->
GetFlags
()
==
0
)
)
{
if
(
false
==
GetScreen
()
->
GetItem
(
gridPosition
,
0
,
SCH_NO_CONNECT_T
)
)
{
m_itemToRepeat
=
AddNoConnect
(
aDC
,
gridPosition
);
GetScreen
()
->
SetCurItem
(
m_itemToRepeat
);
m_canvas
->
SetAutoPanRequest
(
true
);
}
}
else
{
addCurrentItemToList
(
aDC
);
...
...
@@ -137,11 +141,14 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case
ID_JUNCTION_BUTT
:
if
(
(
item
==
NULL
)
||
(
item
->
GetFlags
()
==
0
)
)
{
if
(
false
==
GetScreen
()
->
GetItem
(
gridPosition
,
0
,
SCH_JUNCTION_T
)
)
{
m_itemToRepeat
=
AddJunction
(
aDC
,
gridPosition
,
true
);
GetScreen
()
->
SetCurItem
(
m_itemToRepeat
);
m_canvas
->
SetAutoPanRequest
(
true
);
}
}
else
{
addCurrentItemToList
(
aDC
);
...
...
eeschema/sch_screen.cpp
View file @
70c30bce
...
...
@@ -434,14 +434,14 @@ bool SCH_SCREEN::SchematicCleanUp( EDA_DRAW_PANEL* aCanvas, wxDC* aDC )
for
(
;
item
!=
NULL
;
item
=
item
->
Next
()
)
{
if
(
item
->
Type
()
!=
SCH_LINE_T
)
if
(
(
item
->
Type
()
!=
SCH_LINE_T
)
&&
(
item
->
Type
()
!=
SCH_JUNCTION_T
)
)
continue
;
testItem
=
item
->
Next
();
while
(
testItem
)
{
if
(
testItem
->
Type
()
==
SCH_LINE_T
)
if
(
(
item
->
Type
()
==
SCH_LINE_T
)
&&
(
testItem
->
Type
()
==
SCH_LINE_T
)
)
{
SCH_LINE
*
line
=
(
SCH_LINE
*
)
item
;
...
...
@@ -458,6 +458,21 @@ bool SCH_SCREEN::SchematicCleanUp( EDA_DRAW_PANEL* aCanvas, wxDC* aDC )
testItem
=
testItem
->
Next
();
}
}
else
if
(
(
(
item
->
Type
()
==
SCH_JUNCTION_T
)
&&
(
testItem
->
Type
()
==
SCH_JUNCTION_T
)
)
&&
(
testItem
!=
item
)
)
{
if
(
testItem
->
HitTest
(
item
->
GetPosition
()
)
)
{
// Keep the current flags, because the deleted segment can be flagged.
item
->
SetFlags
(
testItem
->
GetFlags
()
);
DeleteItem
(
testItem
);
testItem
=
m_drawList
.
begin
();
modified
=
true
;
}
else
{
testItem
=
testItem
->
Next
();
}
}
else
{
testItem
=
testItem
->
Next
();
...
...
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