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
9dce6fba
Commit
9dce6fba
authored
Dec 07, 2011
by
Wayne Stambaugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Encapsulate SCH_JUNCTION, SCH_LINE, and SCH_NO_CONNECT classes.
parent
16131a50
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
228 additions
and
217 deletions
+228
-217
bus-wire-junction.cpp
eeschema/bus-wire-junction.cpp
+25
-26
onrightclick.cpp
eeschema/onrightclick.cpp
+2
-2
sch_junction.cpp
eeschema/sch_junction.cpp
+26
-26
sch_junction.h
eeschema/sch_junction.h
+5
-7
sch_line.cpp
eeschema/sch_line.cpp
+98
-98
sch_line.h
eeschema/sch_line.h
+17
-11
sch_no_connect.cpp
eeschema/sch_no_connect.cpp
+29
-29
sch_no_connect.h
eeschema/sch_no_connect.h
+5
-7
sch_screen.cpp
eeschema/sch_screen.cpp
+21
-11
No files found.
eeschema/bus-wire-junction.cpp
View file @
9dce6fba
...
...
@@ -88,7 +88,7 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
if
(
g_HVLines
)
/* Coerce the line to vertical or horizontal one: */
ComputeBreakPoint
(
CurrentLine
,
endpos
);
else
CurrentLine
->
m_End
=
endpos
;
CurrentLine
->
SetEndPoint
(
endpos
)
;
segment
=
CurrentLine
;
...
...
@@ -201,7 +201,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
if
(
nextsegment
)
{
newsegment
=
new
SCH_LINE
(
*
nextsegment
);
nextsegment
->
m_Start
=
newsegment
->
m_End
;
nextsegment
->
SetStartPoint
(
newsegment
->
GetEndPoint
()
)
;
nextsegment
->
SetNext
(
NULL
);
nextsegment
->
SetBack
(
newsegment
);
newsegment
->
SetNext
(
nextsegment
);
...
...
@@ -210,10 +210,10 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
else
{
newsegment
=
new
SCH_LINE
(
*
oldsegment
);
newsegment
->
m_Start
=
oldsegment
->
m_End
;
newsegment
->
SetStartPoint
(
oldsegment
->
GetEndPoint
()
)
;
}
newsegment
->
m_End
=
cursorpos
;
newsegment
->
SetEndPoint
(
cursorpos
)
;
oldsegment
->
ClearFlags
(
IS_NEW
);
oldsegment
->
SetFlags
(
SELECTED
);
newsegment
->
SetFlags
(
IS_NEW
);
...
...
@@ -224,7 +224,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
* Create a junction if needed. Note: a junction can be needed later,
* if the new segment is merged (after a cleanup) with an older one
* (tested when the connection will be finished)*/
if
(
oldsegment
->
m_Start
==
s_ConnexionStartPoint
)
if
(
oldsegment
->
GetStartPoint
()
==
s_ConnexionStartPoint
)
{
if
(
GetScreen
()
->
IsJunctionNeeded
(
s_ConnexionStartPoint
)
)
AddJunction
(
DC
,
s_ConnexionStartPoint
);
...
...
@@ -288,14 +288,14 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
wxPoint
end_point
,
alt_end_point
;
/* A junction can be needed to connect the last segment
* usually to m_
E
nd coordinate.
* usually to m_
e
nd coordinate.
* But if the last segment is removed by a cleanup, because of redundancy,
* a junction can be needed to connect the previous segment m_
E
nd
* coordinate with is also the lastsegment->m_
S
tart coordinate */
* a junction can be needed to connect the previous segment m_
e
nd
* coordinate with is also the lastsegment->m_
s
tart coordinate */
if
(
lastsegment
)
{
end_point
=
lastsegment
->
m_End
;
alt_end_point
=
lastsegment
->
m_Start
;
end_point
=
lastsegment
->
GetEndPoint
()
;
alt_end_point
=
lastsegment
->
GetStartPoint
()
;
}
GetScreen
()
->
SchematicCleanUp
(
DrawPanel
);
...
...
@@ -373,37 +373,36 @@ static void ComputeBreakPoint( SCH_LINE* aSegment, const wxPoint& aPosition )
if
(
nextsegment
==
NULL
)
return
;
#if 0
if( ABS( middle_position.x - aSegment->
m_Start
.x ) <
ABS( middle_position.y - aSegment->
m_Start
.y ) )
middle_position.x = aSegment->
m_Start
.x;
if( ABS( middle_position.x - aSegment->
GetStartPoint()
.x ) <
ABS( middle_position.y - aSegment->
GetStartPoint()
.y ) )
middle_position.x = aSegment->
GetStartPoint()
.x;
else
middle_position.y = aSegment->
m_Start
.y;
middle_position.y = aSegment->
GetStartPoint()
.y;
#else
int
iDx
=
aSegment
->
m_End
.
x
-
aSegment
->
m_Start
.
x
;
int
iDy
=
aSegment
->
m_End
.
y
-
aSegment
->
m_Start
.
y
;
int
iDx
=
aSegment
->
GetEndPoint
().
x
-
aSegment
->
GetStartPoint
()
.
x
;
int
iDy
=
aSegment
->
GetEndPoint
().
y
-
aSegment
->
GetStartPoint
()
.
y
;
if
(
iDy
!=
0
)
// keep the first segment orientation (currently horizontal)
{
middle_position
.
x
=
aSegment
->
m_Start
.
x
;
middle_position
.
x
=
aSegment
->
GetStartPoint
()
.
x
;
}
else
if
(
iDx
!=
0
)
// keep the first segment orientation (currently vertical)
{
middle_position
.
y
=
aSegment
->
m_Start
.
y
;
middle_position
.
y
=
aSegment
->
GetStartPoint
()
.
y
;
}
else
{
if
(
ABS
(
middle_position
.
x
-
aSegment
->
m_Start
.
x
)
<
ABS
(
middle_position
.
y
-
aSegment
->
m_Start
.
y
)
)
middle_position
.
x
=
aSegment
->
m_Start
.
x
;
if
(
ABS
(
middle_position
.
x
-
aSegment
->
GetStartPoint
()
.
x
)
<
ABS
(
middle_position
.
y
-
aSegment
->
GetStartPoint
()
.
y
)
)
middle_position
.
x
=
aSegment
->
GetStartPoint
()
.
x
;
else
middle_position
.
y
=
aSegment
->
m_Start
.
y
;
middle_position
.
y
=
aSegment
->
GetStartPoint
()
.
y
;
}
#endif
aSegment
->
m_End
=
middle_position
;
nextsegment
->
m_Start
=
middle_position
;
nextsegment
->
m_End
=
aPosition
;
aSegment
->
SetEndPoint
(
middle_position
);
nextsegment
->
SetStartPoint
(
middle_position
);
nextsegment
->
SetEndPoint
(
aPosition
);
}
...
...
eeschema/onrightclick.cpp
View file @
9dce6fba
...
...
@@ -578,7 +578,7 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
AddMenuItem
(
PopMenu
,
ID_POPUP_SCH_ADD_LABEL
,
msg
,
KiBitmap
(
add_line_label_xpm
)
);
// Add global label command only if the cursor is over one end of the wire.
if
(
(
pos
==
Wire
->
m_Start
)
||
(
pos
==
Wire
->
m_End
)
)
if
(
Wire
->
IsEndPoint
(
pos
)
)
AddMenuItem
(
PopMenu
,
ID_POPUP_SCH_ADD_GLABEL
,
_
(
"Add Global Label"
),
KiBitmap
(
add_glabel_xpm
)
);
}
...
...
@@ -608,7 +608,7 @@ void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame )
AddMenuItem
(
PopMenu
,
ID_POPUP_SCH_ADD_LABEL
,
msg
,
KiBitmap
(
add_line_label_xpm
)
);
// Add global label command only if the cursor is over one end of the bus.
if
(
(
pos
==
Bus
->
m_Start
)
||
(
pos
==
Bus
->
m_End
)
)
if
(
Bus
->
IsEndPoint
(
pos
)
)
AddMenuItem
(
PopMenu
,
ID_POPUP_SCH_ADD_GLABEL
,
_
(
"Add Global Label"
),
KiBitmap
(
add_glabel_xpm
)
);
}
...
...
eeschema/sch_junction.cpp
View file @
9dce6fba
...
...
@@ -46,9 +46,9 @@ SCH_JUNCTION::SCH_JUNCTION( const wxPoint& pos ) :
SCH_ITEM
(
NULL
,
SCH_JUNCTION_T
)
{
#define DRAWJUNCTION_DIAMETER 32
/* Diameter of junction symbol between wires */
m_
P
os
=
pos
;
m_
p
os
=
pos
;
m_Layer
=
LAYER_JUNCTION
;
m_
Size
.
x
=
m_S
ize
.
y
=
DRAWJUNCTION_DIAMETER
;
m_
size
.
x
=
m_s
ize
.
y
=
DRAWJUNCTION_DIAMETER
;
#undef DRAWJUNCTION_DIAMETER
}
...
...
@@ -56,8 +56,8 @@ SCH_JUNCTION::SCH_JUNCTION( const wxPoint& pos ) :
SCH_JUNCTION
::
SCH_JUNCTION
(
const
SCH_JUNCTION
&
aJunction
)
:
SCH_ITEM
(
aJunction
)
{
m_
Pos
=
aJunction
.
m_P
os
;
m_
Size
=
aJunction
.
m_S
ize
;
m_
pos
=
aJunction
.
m_p
os
;
m_
size
=
aJunction
.
m_s
ize
;
}
...
...
@@ -65,7 +65,7 @@ bool SCH_JUNCTION::Save( FILE* aFile ) const
{
bool
success
=
true
;
if
(
fprintf
(
aFile
,
"Connection ~ %-4d %-4d
\n
"
,
m_
Pos
.
x
,
m_P
os
.
y
)
==
EOF
)
if
(
fprintf
(
aFile
,
"Connection ~ %-4d %-4d
\n
"
,
m_
pos
.
x
,
m_p
os
.
y
)
==
EOF
)
{
success
=
false
;
}
...
...
@@ -86,8 +86,8 @@ void SCH_JUNCTION::SwapData( SCH_ITEM* aItem )
wxT
(
"Cannot swap junction data with invalid item."
)
);
SCH_JUNCTION
*
item
=
(
SCH_JUNCTION
*
)
aItem
;
EXCHG
(
m_
Pos
,
item
->
m_P
os
);
EXCHG
(
m_
Size
,
item
->
m_S
ize
);
EXCHG
(
m_
pos
,
item
->
m_p
os
);
EXCHG
(
m_
size
,
item
->
m_s
ize
);
}
...
...
@@ -99,7 +99,7 @@ bool SCH_JUNCTION::Load( LINE_READER& aLine, wxString& aErrorMsg )
while
(
(
*
line
!=
' '
)
&&
*
line
)
line
++
;
if
(
sscanf
(
line
,
"%s %d %d"
,
name
,
&
m_
Pos
.
x
,
&
m_P
os
.
y
)
!=
3
)
if
(
sscanf
(
line
,
"%s %d %d"
,
name
,
&
m_
pos
.
x
,
&
m_p
os
.
y
)
!=
3
)
{
aErrorMsg
.
Printf
(
wxT
(
"Eeschema file connection load error at line %d, aborted"
),
aLine
.
LineNumber
()
);
...
...
@@ -115,8 +115,8 @@ EDA_RECT SCH_JUNCTION::GetBoundingBox() const
{
EDA_RECT
rect
;
rect
.
SetOrigin
(
m_
P
os
);
rect
.
Inflate
(
(
GetPenSize
()
+
m_
S
ize
.
x
)
/
2
);
rect
.
SetOrigin
(
m_
p
os
);
rect
.
Inflate
(
(
GetPenSize
()
+
m_
s
ize
.
x
)
/
2
);
return
rect
;
}
...
...
@@ -134,36 +134,36 @@ void SCH_JUNCTION::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffs
GRSetDrawMode
(
aDC
,
aDrawMode
);
GRFilledCircle
(
&
aPanel
->
m_ClipBox
,
aDC
,
m_
Pos
.
x
+
aOffset
.
x
,
m_P
os
.
y
+
aOffset
.
y
,
(
m_
S
ize
.
x
/
2
),
0
,
color
,
color
);
GRFilledCircle
(
&
aPanel
->
m_ClipBox
,
aDC
,
m_
pos
.
x
+
aOffset
.
x
,
m_p
os
.
y
+
aOffset
.
y
,
(
m_
s
ize
.
x
/
2
),
0
,
color
,
color
);
}
void
SCH_JUNCTION
::
Mirror_X
(
int
aXaxis_position
)
{
m_
P
os
.
y
-=
aXaxis_position
;
NEGATE
(
m_
P
os
.
y
);
m_
P
os
.
y
+=
aXaxis_position
;
m_
p
os
.
y
-=
aXaxis_position
;
NEGATE
(
m_
p
os
.
y
);
m_
p
os
.
y
+=
aXaxis_position
;
}
void
SCH_JUNCTION
::
Mirror_Y
(
int
aYaxis_position
)
{
m_
P
os
.
x
-=
aYaxis_position
;
NEGATE
(
m_
P
os
.
x
);
m_
P
os
.
x
+=
aYaxis_position
;
m_
p
os
.
x
-=
aYaxis_position
;
NEGATE
(
m_
p
os
.
x
);
m_
p
os
.
x
+=
aYaxis_position
;
}
void
SCH_JUNCTION
::
Rotate
(
wxPoint
rotationPoint
)
{
RotatePoint
(
&
m_
P
os
,
rotationPoint
,
900
);
RotatePoint
(
&
m_
p
os
,
rotationPoint
,
900
);
}
void
SCH_JUNCTION
::
GetEndPoints
(
std
::
vector
<
DANGLING_END_ITEM
>&
aItemList
)
{
DANGLING_END_ITEM
item
(
JUNCTION_END
,
this
,
m_
P
os
);
DANGLING_END_ITEM
item
(
JUNCTION_END
,
this
,
m_
p
os
);
aItemList
.
push_back
(
item
);
}
...
...
@@ -172,7 +172,7 @@ bool SCH_JUNCTION::IsSelectStateChanged( const wxRect& aRect )
{
bool
previousState
=
IsSelected
();
if
(
aRect
.
Contains
(
m_
P
os
)
)
if
(
aRect
.
Contains
(
m_
p
os
)
)
m_Flags
|=
SELECTED
;
else
m_Flags
&=
~
SELECTED
;
...
...
@@ -183,7 +183,7 @@ bool SCH_JUNCTION::IsSelectStateChanged( const wxRect& aRect )
void
SCH_JUNCTION
::
GetConnectionPoints
(
vector
<
wxPoint
>&
aPoints
)
const
{
aPoints
.
push_back
(
m_
P
os
);
aPoints
.
push_back
(
m_
p
os
);
}
...
...
@@ -196,7 +196,7 @@ void SCH_JUNCTION::GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
item
->
m_SheetListInclude
=
*
aSheetPath
;
item
->
m_Comp
=
(
SCH_ITEM
*
)
this
;
item
->
m_Type
=
NET_JUNCTION
;
item
->
m_Start
=
item
->
m_End
=
m_
P
os
;
item
->
m_Start
=
item
->
m_End
=
m_
p
os
;
aNetListItems
.
push_back
(
item
);
}
...
...
@@ -208,7 +208,7 @@ void SCH_JUNCTION::Show( int nestLevel, std::ostream& os )
// XML output:
wxString
s
=
GetClass
();
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
s
.
Lower
().
mb_str
()
<<
m_
P
os
<<
"/>
\n
"
;
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
s
.
Lower
().
mb_str
()
<<
m_
p
os
<<
"/>
\n
"
;
}
#endif
...
...
@@ -238,12 +238,12 @@ bool SCH_JUNCTION::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccur
bool
SCH_JUNCTION
::
doIsConnected
(
const
wxPoint
&
aPosition
)
const
{
return
m_
P
os
==
aPosition
;
return
m_
p
os
==
aPosition
;
}
void
SCH_JUNCTION
::
doPlot
(
PLOTTER
*
aPlotter
)
{
aPlotter
->
set_color
(
ReturnLayerColor
(
GetLayer
()
)
);
aPlotter
->
circle
(
m_
Pos
,
m_S
ize
.
x
,
FILLED_SHAPE
);
aPlotter
->
circle
(
m_
pos
,
m_s
ize
.
x
,
FILLED_SHAPE
);
}
eeschema/sch_junction.h
View file @
9dce6fba
...
...
@@ -36,10 +36,8 @@
class
SCH_JUNCTION
:
public
SCH_ITEM
{
wxPoint
m_Pos
;
/* XY coordinates of connection. */
public
:
wxSize
m_Size
;
wxPoint
m_pos
;
/* XY coordinates of connection. */
wxSize
m_size
;
public
:
SCH_JUNCTION
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
)
);
...
...
@@ -94,7 +92,7 @@ public:
*/
virtual
void
Move
(
const
wxPoint
&
aMoveVector
)
{
m_
P
os
+=
aMoveVector
;
m_
p
os
+=
aMoveVector
;
}
/**
...
...
@@ -133,8 +131,8 @@ private:
virtual
bool
doIsConnected
(
const
wxPoint
&
aPosition
)
const
;
virtual
EDA_ITEM
*
doClone
()
const
;
virtual
void
doPlot
(
PLOTTER
*
aPlotter
);
virtual
wxPoint
doGetPosition
()
const
{
return
m_
P
os
;
}
virtual
void
doSetPosition
(
const
wxPoint
&
aPosition
)
{
m_
P
os
=
aPosition
;
}
virtual
wxPoint
doGetPosition
()
const
{
return
m_
p
os
;
}
virtual
void
doSetPosition
(
const
wxPoint
&
aPosition
)
{
m_
p
os
=
aPosition
;
}
};
...
...
eeschema/sch_line.cpp
View file @
9dce6fba
This diff is collapsed.
Click to expand it.
eeschema/sch_line.h
View file @
9dce6fba
...
...
@@ -41,13 +41,11 @@
*/
class
SCH_LINE
:
public
SCH_ITEM
{
bool
m_StartIsDangling
;
bool
m_EndIsDangling
;
// true if not connected (wires, tracks...)
public
:
int
m_Width
;
// 0 = line, > 0 = tracks, bus ...
wxPoint
m_Start
;
// Line start point
wxPoint
m_End
;
// Line end point
bool
m_startIsDangling
;
///< True if start point is not connected.
bool
m_endIsDangling
;
///< True if end point is not connected.
int
m_width
;
///< Set to 0 for wires and greater than 0 for busses.
wxPoint
m_start
;
///< Line start point
wxPoint
m_end
;
///< Line end point
public
:
SCH_LINE
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
),
int
layer
=
LAYER_NOTES
);
...
...
@@ -64,10 +62,18 @@ public:
bool
IsEndPoint
(
const
wxPoint
&
aPoint
)
const
{
return
aPoint
==
m_
Start
||
aPoint
==
m_E
nd
;
return
aPoint
==
m_
start
||
aPoint
==
m_e
nd
;
}
bool
IsNull
()
const
{
return
m_Start
==
m_End
;
}
bool
IsNull
()
const
{
return
m_start
==
m_end
;
}
wxPoint
GetStartPoint
()
const
{
return
m_start
;
}
void
SetStartPoint
(
const
wxPoint
&
aPosition
)
{
m_start
=
aPosition
;
}
wxPoint
GetEndPoint
()
const
{
return
m_end
;
}
void
SetEndPoint
(
const
wxPoint
&
aPosition
)
{
m_end
=
aPosition
;
}
/**
* Function GetBoundingBox
...
...
@@ -145,7 +151,7 @@ public:
virtual
bool
IsDanglingStateChanged
(
vector
<
DANGLING_END_ITEM
>&
aItemList
);
virtual
bool
IsDangling
()
const
{
return
m_
StartIsDangling
||
m_E
ndIsDangling
;
}
virtual
bool
IsDangling
()
const
{
return
m_
startIsDangling
||
m_e
ndIsDangling
;
}
virtual
bool
IsSelectStateChanged
(
const
wxRect
&
aRect
);
...
...
@@ -176,7 +182,7 @@ private:
virtual
bool
doIsConnected
(
const
wxPoint
&
aPosition
)
const
;
virtual
EDA_ITEM
*
doClone
()
const
;
virtual
void
doPlot
(
PLOTTER
*
aPlotter
);
virtual
wxPoint
doGetPosition
()
const
{
return
m_
S
tart
;
}
virtual
wxPoint
doGetPosition
()
const
{
return
m_
s
tart
;
}
virtual
void
doSetPosition
(
const
wxPoint
&
aPosition
);
};
...
...
eeschema/sch_no_connect.cpp
View file @
9dce6fba
...
...
@@ -47,8 +47,8 @@ SCH_NO_CONNECT::SCH_NO_CONNECT( const wxPoint& pos ) :
SCH_ITEM
(
NULL
,
SCH_NO_CONNECT_T
)
{
#define DRAWNOCONNECT_SIZE 48
/* No symbol connection range. */
m_
P
os
=
pos
;
m_
Size
.
x
=
m_S
ize
.
y
=
DRAWNOCONNECT_SIZE
;
m_
p
os
=
pos
;
m_
size
.
x
=
m_s
ize
.
y
=
DRAWNOCONNECT_SIZE
;
#undef DRAWNOCONNECT_SIZE
SetLayer
(
LAYER_NOCONNECT
);
...
...
@@ -58,8 +58,8 @@ SCH_NO_CONNECT::SCH_NO_CONNECT( const wxPoint& pos ) :
SCH_NO_CONNECT
::
SCH_NO_CONNECT
(
const
SCH_NO_CONNECT
&
aNoConnect
)
:
SCH_ITEM
(
aNoConnect
)
{
m_
Pos
=
aNoConnect
.
m_P
os
;
m_
Size
=
aNoConnect
.
m_S
ize
;
m_
pos
=
aNoConnect
.
m_p
os
;
m_
size
=
aNoConnect
.
m_s
ize
;
}
...
...
@@ -75,17 +75,17 @@ void SCH_NO_CONNECT::SwapData( SCH_ITEM* aItem )
wxT
(
"Cannot swap no connect data with invalid item."
)
);
SCH_NO_CONNECT
*
item
=
(
SCH_NO_CONNECT
*
)
aItem
;
EXCHG
(
m_
Pos
,
item
->
m_P
os
);
EXCHG
(
m_
Size
,
item
->
m_S
ize
);
EXCHG
(
m_
pos
,
item
->
m_p
os
);
EXCHG
(
m_
size
,
item
->
m_s
ize
);
}
EDA_RECT
SCH_NO_CONNECT
::
GetBoundingBox
()
const
{
int
delta
=
(
GetPenSize
()
+
m_
S
ize
.
x
)
/
2
;
int
delta
=
(
GetPenSize
()
+
m_
s
ize
.
x
)
/
2
;
EDA_RECT
box
;
box
.
SetOrigin
(
m_
P
os
);
box
.
SetOrigin
(
m_
p
os
);
box
.
Inflate
(
delta
);
return
box
;
...
...
@@ -96,7 +96,7 @@ bool SCH_NO_CONNECT::Save( FILE* aFile ) const
{
bool
success
=
true
;
if
(
fprintf
(
aFile
,
"NoConn ~ %-4d %-4d
\n
"
,
m_
Pos
.
x
,
m_P
os
.
y
)
==
EOF
)
if
(
fprintf
(
aFile
,
"NoConn ~ %-4d %-4d
\n
"
,
m_
pos
.
x
,
m_p
os
.
y
)
==
EOF
)
{
success
=
false
;
}
...
...
@@ -113,7 +113,7 @@ bool SCH_NO_CONNECT::Load( LINE_READER& aLine, wxString& aErrorMsg )
while
(
(
*
line
!=
' '
)
&&
*
line
)
line
++
;
if
(
sscanf
(
line
,
"%s %d %d"
,
name
,
&
m_
Pos
.
x
,
&
m_P
os
.
y
)
!=
3
)
if
(
sscanf
(
line
,
"%s %d %d"
,
name
,
&
m_
pos
.
x
,
&
m_p
os
.
y
)
!=
3
)
{
aErrorMsg
.
Printf
(
wxT
(
"Eeschema file No Connect load error at line %d"
),
aLine
.
LineNumber
()
);
...
...
@@ -135,11 +135,11 @@ void SCH_NO_CONNECT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
int
aDrawMode
,
int
aColor
)
{
int
pX
,
pY
,
color
;
int
delta
=
m_
S
ize
.
x
/
2
;
int
delta
=
m_
s
ize
.
x
/
2
;
int
width
=
g_DrawDefaultLineThickness
;
pX
=
m_
P
os
.
x
+
aOffset
.
x
;
pY
=
m_
P
os
.
y
+
aOffset
.
y
;
pX
=
m_
p
os
.
x
+
aOffset
.
x
;
pY
=
m_
p
os
.
y
+
aOffset
.
y
;
if
(
aColor
>=
0
)
color
=
aColor
;
...
...
@@ -155,23 +155,23 @@ void SCH_NO_CONNECT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
void
SCH_NO_CONNECT
::
Mirror_X
(
int
aXaxis_position
)
{
m_
P
os
.
y
-=
aXaxis_position
;
NEGATE
(
m_
P
os
.
y
);
m_
P
os
.
y
+=
aXaxis_position
;
m_
p
os
.
y
-=
aXaxis_position
;
NEGATE
(
m_
p
os
.
y
);
m_
p
os
.
y
+=
aXaxis_position
;
}
void
SCH_NO_CONNECT
::
Mirror_Y
(
int
aYaxis_position
)
{
m_
P
os
.
x
-=
aYaxis_position
;
NEGATE
(
m_
P
os
.
x
);
m_
P
os
.
x
+=
aYaxis_position
;
m_
p
os
.
x
-=
aYaxis_position
;
NEGATE
(
m_
p
os
.
x
);
m_
p
os
.
x
+=
aYaxis_position
;
}
void
SCH_NO_CONNECT
::
Rotate
(
wxPoint
rotationPoint
)
{
RotatePoint
(
&
m_
P
os
,
rotationPoint
,
900
);
RotatePoint
(
&
m_
p
os
,
rotationPoint
,
900
);
}
...
...
@@ -179,7 +179,7 @@ bool SCH_NO_CONNECT::IsSelectStateChanged( const wxRect& aRect )
{
bool
previousState
=
IsSelected
();
if
(
aRect
.
Contains
(
m_
P
os
)
)
if
(
aRect
.
Contains
(
m_
p
os
)
)
m_Flags
|=
SELECTED
;
else
m_Flags
&=
~
SELECTED
;
...
...
@@ -190,7 +190,7 @@ bool SCH_NO_CONNECT::IsSelectStateChanged( const wxRect& aRect )
void
SCH_NO_CONNECT
::
GetConnectionPoints
(
vector
<
wxPoint
>&
aPoints
)
const
{
aPoints
.
push_back
(
m_
P
os
);
aPoints
.
push_back
(
m_
p
os
);
}
...
...
@@ -203,7 +203,7 @@ void SCH_NO_CONNECT::GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
item
->
m_SheetListInclude
=
*
aSheetPath
;
item
->
m_Comp
=
this
;
item
->
m_Type
=
NET_NOCONNECT
;
item
->
m_Start
=
item
->
m_End
=
m_
P
os
;
item
->
m_Start
=
item
->
m_End
=
m_
p
os
;
aNetListItems
.
push_back
(
item
);
}
...
...
@@ -211,14 +211,14 @@ void SCH_NO_CONNECT::GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
bool
SCH_NO_CONNECT
::
doIsConnected
(
const
wxPoint
&
aPosition
)
const
{
return
m_
P
os
==
aPosition
;
return
m_
p
os
==
aPosition
;
}
bool
SCH_NO_CONNECT
::
doHitTest
(
const
wxPoint
&
aPoint
,
int
aAccuracy
)
const
{
int
delta
=
(
(
m_
S
ize
.
x
+
g_DrawDefaultLineThickness
)
/
2
)
+
aAccuracy
;
int
delta
=
(
(
m_
s
ize
.
x
+
g_DrawDefaultLineThickness
)
/
2
)
+
aAccuracy
;
wxPoint
dist
=
aPoint
-
m_
P
os
;
wxPoint
dist
=
aPoint
-
m_
p
os
;
if
(
(
ABS
(
dist
.
x
)
<=
delta
)
&&
(
ABS
(
dist
.
y
)
<=
delta
)
)
return
true
;
...
...
@@ -242,11 +242,11 @@ bool SCH_NO_CONNECT::doHitTest( const EDA_RECT& aRect, bool aContained, int aAcc
void
SCH_NO_CONNECT
::
doPlot
(
PLOTTER
*
aPlotter
)
{
int
delta
=
m_
S
ize
.
x
/
2
;
int
delta
=
m_
s
ize
.
x
/
2
;
int
pX
,
pY
;
pX
=
m_
P
os
.
x
;
pY
=
m_
P
os
.
y
;
pX
=
m_
p
os
.
x
;
pY
=
m_
p
os
.
y
;
aPlotter
->
set_current_line_width
(
GetPenSize
()
);
aPlotter
->
set_color
(
ReturnLayerColor
(
GetLayer
()
)
);
...
...
eeschema/sch_no_connect.h
View file @
9dce6fba
...
...
@@ -36,10 +36,8 @@
class
SCH_NO_CONNECT
:
public
SCH_ITEM
{
wxPoint
m_Pos
;
/* XY coordinates of NoConnect. */
public
:
wxSize
m_Size
;
// size of this symbol
wxPoint
m_pos
;
///< Position of the no connect object.
wxSize
m_size
;
///< Size of the no connect object.
public
:
SCH_NO_CONNECT
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
)
);
...
...
@@ -101,7 +99,7 @@ public:
*/
virtual
void
Move
(
const
wxPoint
&
aMoveVector
)
{
m_
P
os
+=
aMoveVector
;
m_
p
os
+=
aMoveVector
;
}
/**
...
...
@@ -134,8 +132,8 @@ private:
virtual
bool
doHitTest
(
const
EDA_RECT
&
aRect
,
bool
aContained
,
int
aAccuracy
)
const
;
virtual
EDA_ITEM
*
doClone
()
const
;
virtual
void
doPlot
(
PLOTTER
*
aPlotter
);
virtual
wxPoint
doGetPosition
()
const
{
return
m_
P
os
;
}
virtual
void
doSetPosition
(
const
wxPoint
&
aPosition
)
{
m_
P
os
=
aPosition
;
}
virtual
wxPoint
doGetPosition
()
const
{
return
m_
p
os
;
}
virtual
void
doSetPosition
(
const
wxPoint
&
aPosition
)
{
m_
p
os
=
aPosition
;
}
};
...
...
eeschema/sch_screen.cpp
View file @
9dce6fba
...
...
@@ -259,6 +259,7 @@ void SCH_SCREEN::AddToDrawList( SCH_ITEM* aItem )
{
if
(
aItem
==
NULL
)
return
;
aItem
->
SetNext
(
GetDrawItems
()
);
SetDrawItems
(
aItem
);
}
...
...
@@ -393,13 +394,15 @@ void SCH_SCREEN::MarkConnections( SCH_LINE* aSegment )
SCH_LINE
*
segment
=
(
SCH_LINE
*
)
item
;
if
(
aSegment
->
IsEndPoint
(
segment
->
m_Start
)
&&
!
GetPin
(
segment
->
m_Start
,
NULL
,
true
)
)
if
(
aSegment
->
IsEndPoint
(
segment
->
GetStartPoint
()
)
&&
!
GetPin
(
segment
->
GetStartPoint
(),
NULL
,
true
)
)
{
item
->
SetFlags
(
CANDIDATE
);
MarkConnections
(
segment
);
}
if
(
aSegment
->
IsEndPoint
(
segment
->
m_End
)
&&
!
GetPin
(
segment
->
m_End
,
NULL
,
true
)
)
if
(
aSegment
->
IsEndPoint
(
segment
->
GetEndPoint
()
)
&&
!
GetPin
(
segment
->
GetEndPoint
(),
NULL
,
true
)
)
{
item
->
SetFlags
(
CANDIDATE
);
MarkConnections
(
segment
);
...
...
@@ -671,17 +674,21 @@ LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_COMPONENT** aComponen
{
pin
=
NULL
;
LIB_COMPONENT
*
entry
=
CMP_LIBRARY
::
FindLibraryComponent
(
component
->
GetLibName
()
);
if
(
entry
==
NULL
)
continue
;
for
(
pin
=
entry
->
GetNextPin
();
pin
!=
NULL
;
pin
=
entry
->
GetNextPin
(
pin
)
)
{
// Skip items not used for this part.
if
(
component
->
GetUnit
()
&&
pin
->
GetUnit
()
&&
(
pin
->
GetUnit
()
!=
component
->
GetUnit
()
)
)
continue
;
if
(
component
->
GetConvert
()
&&
pin
->
GetConvert
()
&&
(
pin
->
GetConvert
()
!=
component
->
GetConvert
()
)
)
continue
;
if
(
component
->
GetPinPhysicalPosition
(
pin
)
==
aPosition
)
break
;
}
...
...
@@ -691,6 +698,7 @@ LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_COMPONENT** aComponen
else
{
pin
=
(
LIB_PIN
*
)
component
->
GetDrawItem
(
aPosition
,
LIB_PIN_T
);
if
(
pin
)
break
;
}
...
...
@@ -879,9 +887,9 @@ void SCH_SCREEN::addConnectedItemsToBlock( const wxPoint& position )
SCH_LINE
*
line
=
(
SCH_LINE
*
)
item
;
if
(
line
->
m_Start
==
position
)
if
(
line
->
GetStartPoint
()
==
position
)
item
->
ClearFlags
(
STARTPOINT
);
else
if
(
line
->
m_End
==
position
)
else
if
(
line
->
GetEndPoint
()
==
position
)
item
->
ClearFlags
(
ENDPOINT
);
}
else
...
...
@@ -962,8 +970,8 @@ bool SCH_SCREEN::BreakSegment( const wxPoint& aPoint )
// Break the segment at aPoint and create a new segment.
newSegment
=
new
SCH_LINE
(
*
segment
);
newSegment
->
m_Start
=
aPoint
;
segment
->
m_End
=
newSegment
->
m_Start
;
newSegment
->
GetStartPoint
()
=
aPoint
;
segment
->
GetEndPoint
()
=
newSegment
->
GetStartPoint
()
;
newSegment
->
SetNext
(
segment
->
Next
()
);
segment
->
SetNext
(
newSegment
);
item
=
newSegment
;
...
...
@@ -991,7 +999,8 @@ bool SCH_SCREEN::BreakSegmentsOnJunctions()
{
SCH_BUS_ENTRY
*
busEntry
=
(
SCH_BUS_ENTRY
*
)
item
;
if
(
BreakSegment
(
busEntry
->
GetPosition
()
)
||
BreakSegment
(
busEntry
->
m_End
()
)
)
if
(
BreakSegment
(
busEntry
->
GetPosition
()
)
||
BreakSegment
(
busEntry
->
m_End
()
)
)
brokenSegments
=
true
;
}
}
...
...
@@ -1117,6 +1126,7 @@ bool SCH_SCREEN::SetComponentFootprint( SCH_SHEET_PATH* aSheetPath, const wxStri
fpfield
->
m_Orient
=
component
->
GetField
(
VALUE
)
->
m_Orient
;
fpfield
->
m_Pos
=
component
->
GetField
(
VALUE
)
->
m_Pos
;
fpfield
->
m_Size
=
component
->
GetField
(
VALUE
)
->
m_Size
;
if
(
fpfield
->
m_Orient
==
0
)
fpfield
->
m_Pos
.
y
+=
100
;
else
...
...
@@ -1210,14 +1220,14 @@ int SCH_SCREEN::GetConnection( const wxPoint& aPosition, PICKED_ITEMS_LIST& aLis
SCH_LINE
*
testSegment
=
(
SCH_LINE
*
)
tmp
;
// Test for segment connected to the previously deleted segment:
if
(
testSegment
->
IsEndPoint
(
segment
->
m_Start
)
)
if
(
testSegment
->
IsEndPoint
(
segment
->
GetStartPoint
()
)
)
break
;
}
// when tmp != NULL, segment is a new candidate:
// put it in deleted list if
// the start point is not connected to an other item (like pin)
if
(
tmp
&&
!
CountConnectedItems
(
segment
->
m_Start
,
true
)
)
if
(
tmp
&&
!
CountConnectedItems
(
segment
->
GetStartPoint
()
,
true
)
)
noconnect
=
true
;
/* If the wire end point is connected to a wire that has already been found
...
...
@@ -1234,14 +1244,14 @@ int SCH_SCREEN::GetConnection( const wxPoint& aPosition, PICKED_ITEMS_LIST& aLis
SCH_LINE
*
testSegment
=
(
SCH_LINE
*
)
tmp
;
// Test for segment connected to the previously deleted segment:
if
(
testSegment
->
IsEndPoint
(
segment
->
m_End
)
)
if
(
testSegment
->
IsEndPoint
(
segment
->
GetEndPoint
()
)
)
break
;
}
// when tmp != NULL, segment is a new candidate:
// put it in deleted list if
// the end point is not connected to an other item (like pin)
if
(
tmp
&&
!
CountConnectedItems
(
segment
->
m_End
,
true
)
)
if
(
tmp
&&
!
CountConnectedItems
(
segment
->
GetEndPoint
()
,
true
)
)
noconnect
=
true
;
item
->
ClearFlags
(
SKIP_STRUCT
);
...
...
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