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
0f0ced37
Commit
0f0ced37
authored
Mar 13, 2008
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
beautify
parent
0f06e2ad
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
675 additions
and
547 deletions
+675
-547
block.cpp
eeschema/block.cpp
+10
-2
cmpclass.cpp
eeschema/cmpclass.cpp
+25
-6
delete.cpp
eeschema/delete.cpp
+518
-442
erc.cpp
eeschema/erc.cpp
+102
-86
program.h
eeschema/program.h
+17
-11
schedit.cpp
eeschema/schedit.cpp
+3
-0
No files found.
eeschema/block.cpp
View file @
0f0ced37
...
@@ -932,7 +932,8 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct
...
@@ -932,7 +932,8 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct
if
(
DrawStruct
->
Type
()
==
DRAW_SHEETLABEL_STRUCT_TYPE
)
if
(
DrawStruct
->
Type
()
==
DRAW_SHEETLABEL_STRUCT_TYPE
)
{
/* Cette stucture est rattachee a une feuille, et n'est pas
{
/* Cette stucture est rattachee a une feuille, et n'est pas
* accessible par la liste globale directement */
* accessible par la liste globale directement */
frame
->
SaveCopyInUndoList
(
(
(
DrawSheetLabelStruct
*
)
DrawStruct
)
->
m_Parent
,
IS_CHANGED
);
frame
->
SaveCopyInUndoList
(
(
(
DrawSheetLabelStruct
*
)
DrawStruct
)
->
m_Parent
,
IS_CHANGED
);
frame
->
DeleteSheetLabel
(
DC
,
(
DrawSheetLabelStruct
*
)
DrawStruct
);
frame
->
DeleteSheetLabel
(
DC
,
(
DrawSheetLabelStruct
*
)
DrawStruct
);
...
@@ -961,7 +962,14 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct
...
@@ -961,7 +962,14 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct
{
{
screen
->
RemoveFromDrawList
(
DrawStruct
);
screen
->
RemoveFromDrawList
(
DrawStruct
);
RedrawOneStruct
(
panel
,
DC
,
DrawStruct
,
g_XorMode
);
if
(
DrawStruct
->
Type
()
==
DRAW_SEGMENT_STRUCT_TYPE
)
{
D
(
printf
(
"PostDirtyRect()
\n
"
);
)
panel
->
PostDirtyRect
(
((
EDA_DrawLineStruct
*
)
DrawStruct
)
->
GetBoundingBox
()
);
}
else
RedrawOneStruct
(
panel
,
DC
,
DrawStruct
,
g_XorMode
);
/* Unlink the structure */
/* Unlink the structure */
DrawStruct
->
Pnext
=
DrawStruct
->
Pback
=
NULL
;
// Only one struct -> no link
DrawStruct
->
Pnext
=
DrawStruct
->
Pback
=
NULL
;
// Only one struct -> no link
if
(
DrawStruct
->
Type
()
==
DRAW_SHEET_STRUCT_TYPE
)
if
(
DrawStruct
->
Type
()
==
DRAW_SHEET_STRUCT_TYPE
)
...
...
eeschema/cmpclass.cpp
View file @
0f0ced37
...
@@ -147,14 +147,14 @@ wxString DrawMarkerStruct::GetComment()
...
@@ -147,14 +147,14 @@ wxString DrawMarkerStruct::GetComment()
/**
/**
* Function Show
* Function Show
* is used to output the object tree, currently for debugging only.
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
* @param os The ostream& to output to.
*/
*/
void
DrawMarkerStruct
::
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
void
DrawMarkerStruct
::
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
{
{
// for now, make it look like XML:
// for now, make it look like XML:
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
GetClass
().
Lower
().
mb_str
()
<<
m_Pos
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
GetClass
().
Lower
().
mb_str
()
<<
m_Pos
<<
"/>
\n
"
;
<<
"/>
\n
"
;
}
}
#endif
#endif
...
@@ -222,17 +222,17 @@ bool EDA_DrawLineStruct::IsOneEndPointAt( const wxPoint& pos )
...
@@ -222,17 +222,17 @@ bool EDA_DrawLineStruct::IsOneEndPointAt( const wxPoint& pos )
/**
/**
* Function Show
* Function Show
* is used to output the object tree, currently for debugging only.
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
* @param os The ostream& to output to.
*/
*/
void
EDA_DrawLineStruct
::
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
void
EDA_DrawLineStruct
::
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
{
{
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
GetClass
().
Lower
().
mb_str
()
<<
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
GetClass
().
Lower
().
mb_str
()
<<
" layer=
\"
"
<<
m_Layer
<<
'"'
<<
" layer=
\"
"
<<
m_Layer
<<
'"'
<<
" width=
\"
"
<<
m_Width
<<
'"'
<<
" width=
\"
"
<<
m_Width
<<
'"'
<<
" startIsDangling=
\"
"
<<
m_StartIsDangling
<<
'"'
<<
" startIsDangling=
\"
"
<<
m_StartIsDangling
<<
'"'
<<
" endIsDangling=
\"
"
<<
m_EndIsDangling
<<
'"'
<<
">"
<<
" endIsDangling=
\"
"
<<
m_EndIsDangling
<<
'"'
<<
">"
<<
" <start"
<<
m_Start
<<
"/>"
<<
" <start"
<<
m_Start
<<
"/>"
<<
" <end"
<<
m_End
<<
"/>"
<<
" <end"
<<
m_End
<<
"/>"
<<
"</"
<<
GetClass
().
Lower
().
mb_str
()
<<
">
\n
"
;
"</"
<<
GetClass
().
Lower
().
mb_str
()
<<
">
\n
"
;
...
@@ -240,6 +240,25 @@ void EDA_DrawLineStruct::Show( int nestLevel, std::ostream& os )
...
@@ -240,6 +240,25 @@ void EDA_DrawLineStruct::Show( int nestLevel, std::ostream& os )
#endif
#endif
EDA_Rect
EDA_DrawLineStruct
::
GetBoundingBox
()
const
{
int
width
=
25
;
int
xmin
=
MIN
(
m_Start
.
x
,
m_End
.
x
)
-
width
;
int
ymin
=
MIN
(
m_Start
.
y
,
m_End
.
y
)
-
width
;
int
xmax
=
MAX
(
m_Start
.
x
,
m_End
.
x
)
+
width
;
int
ymax
=
MAX
(
m_Start
.
y
,
m_End
.
y
)
+
width
;
// return a rectangle which is [pos,dim) in nature. therefore the +1
EDA_Rect
ret
(
wxPoint
(
xmin
,
ymin
),
wxSize
(
xmax
-
xmin
+
1
,
ymax
-
ymin
+
1
)
);
return
ret
;
}
/****************************/
/****************************/
/* Class DrawPolylineStruct */
/* Class DrawPolylineStruct */
/****************************/
/****************************/
...
...
eeschema/delete.cpp
View file @
0f0ced37
/************************************/
/************************************/
/* Delete.cpp: routines d'effacement */
/* Delete.cpp: routines d'effacement */
/************************************/
/************************************/
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "gr_basic.h"
...
@@ -17,485 +17,561 @@
...
@@ -17,485 +17,561 @@
/********************************************************************************/
/********************************************************************************/
static
int
CountConnectedItems
(
WinEDA_SchematicFrame
*
frame
,
static
int
CountConnectedItems
(
WinEDA_SchematicFrame
*
frame
,
EDA_BaseStruct
*
ListStruct
,
wxPoint
pos
,
bool
TstJunction
)
EDA_BaseStruct
*
ListStruct
,
wxPoint
pos
,
bool
TstJunction
)
/********************************************************************************/
/********************************************************************************/
/* Count number of items connected to point pos :
pins, end wire or bus, and junctions if TstJunction == TRUE
Return this count
Used by WinEDA_SchematicFrame::DeleteConnection()
/* Count number of items connected to point pos :
*/
* pins, end wire or bus, and junctions if TstJunction == TRUE
* Return this count
*
* Used by WinEDA_SchematicFrame::DeleteConnection()
*/
{
{
EDA_BaseStruct
*
Struct
;
EDA_BaseStruct
*
Struct
;
int
count
=
0
;
int
count
=
0
;
if
(
frame
->
LocatePinEnd
(
ListStruct
,
pos
)
)
count
++
;
if
(
frame
->
LocatePinEnd
(
ListStruct
,
pos
)
)
count
++
;
for
(
Struct
=
ListStruct
;
Struct
!=
NULL
;
Struct
=
Struct
->
Pnext
)
{
for
(
Struct
=
ListStruct
;
Struct
!=
NULL
;
Struct
=
Struct
->
Pnext
)
if
(
Struct
->
m_Flags
&
STRUCT_DELETED
)
continue
;
{
if
(
Struct
->
m_Flags
&
SKIP_STRUCT
)
continue
;
if
(
Struct
->
m_Flags
&
STRUCT_DELETED
)
continue
;
if
(
Struct
->
m_Flags
&
SKIP_STRUCT
)
if
(
TstJunction
&&
(
Struct
->
Type
()
==
DRAW_JUNCTION_STRUCT_TYPE
)
)
continue
;
{
#define JUNCTION ((DrawJunctionStruct*)Struct)
if
(
(
JUNCTION
->
m_Pos
.
x
==
pos
.
x
)
&&
(
JUNCTION
->
m_Pos
.
y
==
pos
.
y
)
)
if
(
TstJunction
&&
(
Struct
->
Type
()
==
DRAW_JUNCTION_STRUCT_TYPE
)
)
count
++
;
{
#undef JUNCTION
#define JUNCTION ( (DrawJunctionStruct*) Struct )
}
if
(
(
JUNCTION
->
m_Pos
.
x
==
pos
.
x
)
&&
(
JUNCTION
->
m_Pos
.
y
==
pos
.
y
)
)
count
++
;
if
(
Struct
->
Type
()
!=
DRAW_SEGMENT_STRUCT_TYPE
)
continue
;
#undef JUNCTION
#define SEGM ((EDA_DrawLineStruct*)Struct)
}
if
(
SEGM
->
IsOneEndPointAt
(
pos
)
)
count
++
;
#undef SEGM
if
(
Struct
->
Type
()
!=
DRAW_SEGMENT_STRUCT_TYPE
)
}
continue
;
return
count
;
#define SEGM ( (EDA_DrawLineStruct*) Struct )
if
(
SEGM
->
IsOneEndPointAt
(
pos
)
)
count
++
;
#undef SEGM
}
return
count
;
}
}
/************************************************************************************/
/************************************************************************************/
static
bool
MarkConnected
(
WinEDA_SchematicFrame
*
frame
,
EDA_BaseStruct
*
ListStruct
,
static
bool
MarkConnected
(
WinEDA_SchematicFrame
*
frame
,
EDA_BaseStruct
*
ListStruct
,
EDA_DrawLineStruct
*
segment
)
EDA_DrawLineStruct
*
segment
)
/************************************************************************************/
/************************************************************************************/
/* Mark to "CANDIDATE" all wires or junction connected to "segment" in list "ListStruct"
Search wire stop at an any pin
Used by WinEDA_SchematicFrame::DeleteConnection()
/* Mark to "CANDIDATE" all wires or junction connected to "segment" in list "ListStruct"
*/
* Search wire stop at an any pin
*
* Used by WinEDA_SchematicFrame::DeleteConnection()
*/
{
{
EDA_BaseStruct
*
Struct
;
EDA_BaseStruct
*
Struct
;
for
(
Struct
=
ListStruct
;
Struct
!=
NULL
;
Struct
=
Struct
->
Pnext
)
for
(
Struct
=
ListStruct
;
Struct
!=
NULL
;
Struct
=
Struct
->
Pnext
)
{
{
if
(
Struct
->
m_Flags
)
continue
;
if
(
Struct
->
m_Flags
)
if
(
Struct
->
Type
()
==
DRAW_JUNCTION_STRUCT_TYPE
)
continue
;
{
if
(
Struct
->
Type
()
==
DRAW_JUNCTION_STRUCT_TYPE
)
#define JUNCTION ((DrawJunctionStruct*)Struct)
{
if
(
segment
->
IsOneEndPointAt
(
JUNCTION
->
m_Pos
)
)
Struct
->
m_Flags
|=
CANDIDATE
;
#define JUNCTION ( (DrawJunctionStruct*) Struct )
continue
;
if
(
segment
->
IsOneEndPointAt
(
JUNCTION
->
m_Pos
)
)
#undef JUNCTION
Struct
->
m_Flags
|=
CANDIDATE
;
}
continue
;
#undef JUNCTION
if
(
Struct
->
Type
()
!=
DRAW_SEGMENT_STRUCT_TYPE
)
continue
;
}
#define SEGM ((EDA_DrawLineStruct*)Struct)
if
(
Struct
->
Type
()
!=
DRAW_SEGMENT_STRUCT_TYPE
)
if
(
segment
->
IsOneEndPointAt
(
SEGM
->
m_Start
)
)
continue
;
{
if
(
!
frame
->
LocatePinEnd
(
ListStruct
,
SEGM
->
m_Start
)
)
#define SEGM ( (EDA_DrawLineStruct*) Struct )
{
if
(
segment
->
IsOneEndPointAt
(
SEGM
->
m_Start
)
)
Struct
->
m_Flags
|=
CANDIDATE
;
{
MarkConnected
(
frame
,
ListStruct
,
SEGM
);
if
(
!
frame
->
LocatePinEnd
(
ListStruct
,
SEGM
->
m_Start
)
)
}
{
}
Struct
->
m_Flags
|=
CANDIDATE
;
if
(
segment
->
IsOneEndPointAt
(
SEGM
->
m_End
)
)
MarkConnected
(
frame
,
ListStruct
,
SEGM
);
{
}
if
(
!
frame
->
LocatePinEnd
(
ListStruct
,
SEGM
->
m_End
)
)
}
{
if
(
segment
->
IsOneEndPointAt
(
SEGM
->
m_End
)
)
Struct
->
m_Flags
|=
CANDIDATE
;
{
MarkConnected
(
frame
,
ListStruct
,
SEGM
);
if
(
!
frame
->
LocatePinEnd
(
ListStruct
,
SEGM
->
m_End
)
)
}
{
}
Struct
->
m_Flags
|=
CANDIDATE
;
#undef SEGM
MarkConnected
(
frame
,
ListStruct
,
SEGM
);
}
}
}
return
TRUE
;
#undef SEGM
}
return
TRUE
;
}
}
/********************************************************************************/
/********************************************************************************/
void
WinEDA_SchematicFrame
::
DeleteConnection
(
wxDC
*
DC
,
bool
DeleteFullConnection
)
void
WinEDA_SchematicFrame
::
DeleteConnection
(
wxDC
*
DC
,
bool
DeleteFullConnection
)
/********************************************************************************/
/********************************************************************************/
/* Delete a connection, i.e wires or bus connected
/* Delete a connection, i.e wires or bus connected
stop on a node (more than 2 wires (bus) connected)
*
stop on a node (more than 2 wires (bus) connected)
*/
*/
{
{
wxPoint
refpos
=
GetScreen
()
->
m_Curseur
;
wxPoint
refpos
=
GetScreen
()
->
m_Curseur
;
EDA_BaseStruct
*
DelStruct
;
EDA_BaseStruct
*
DelStruct
;
DrawPickedStruct
*
PickedItem
,
*
PickedList
=
NULL
;
DrawPickedStruct
*
PickedItem
,
*
PickedList
=
NULL
;
/* Clear .m_Flags member for all items */
/* Clear .m_Flags member for all items */
for
(
DelStruct
=
GetScreen
()
->
EEDrawList
;
DelStruct
!=
NULL
;
DelStruct
=
DelStruct
->
Pnext
)
for
(
DelStruct
=
GetScreen
()
->
EEDrawList
;
DelStruct
!=
NULL
;
DelStruct
=
DelStruct
->
Pnext
)
DelStruct
->
m_Flags
=
0
;
DelStruct
->
m_Flags
=
0
;
BreakSegmentOnJunction
(
(
SCH_SCREEN
*
)
GetScreen
()
);
BreakSegmentOnJunction
(
(
SCH_SCREEN
*
)
GetScreen
()
);
DelStruct
=
GetScreen
()
->
EEDrawList
;
DelStruct
=
GetScreen
()
->
EEDrawList
;
/* Locate all the wires, bus or junction under the mouse cursor, and put them in a list
/* Locate all the wires, bus or junction under the mouse cursor, and put them in a list
of items to delete
* of items to delete
*/
*/
SCH_SCREEN
*
screen
=
(
SCH_SCREEN
*
)
GetScreen
();
SCH_SCREEN
*
screen
=
(
SCH_SCREEN
*
)
GetScreen
();
EDA_BaseStruct
*
savedEEDrawList
=
screen
->
EEDrawList
;
EDA_BaseStruct
*
savedEEDrawList
=
screen
->
EEDrawList
;
while
(
DelStruct
&&
while
(
DelStruct
(
DelStruct
=
PickStruct
(
screen
->
m_Curseur
,
&&
(
DelStruct
=
PickStruct
(
screen
->
m_Curseur
,
screen
,
JUNCTIONITEM
|
WIREITEM
|
BUSITEM
))
!=
NULL
)
screen
,
JUNCTIONITEM
|
WIREITEM
|
BUSITEM
)
)
!=
NULL
)
{
{
DelStruct
->
m_Flags
=
SELECTEDNODE
|
STRUCT_DELETED
;
DelStruct
->
m_Flags
=
SELECTEDNODE
|
STRUCT_DELETED
;
/* Put this structure in the picked list: */
/* Put this structure in the picked list: */
PickedItem
=
new
DrawPickedStruct
(
DelStruct
);
PickedItem
=
new
DrawPickedStruct
(
DelStruct
);
PickedItem
->
Pnext
=
PickedList
;
PickedList
=
PickedItem
;
PickedItem
->
Pnext
=
PickedList
;
DelStruct
=
DelStruct
->
Pnext
;
PickedList
=
PickedItem
;
screen
->
EEDrawList
=
DelStruct
;
DelStruct
=
DelStruct
->
Pnext
;
}
screen
->
EEDrawList
=
DelStruct
;
GetScreen
()
->
EEDrawList
=
savedEEDrawList
;
}
/* Mark all wires, junctions, .. connected to one of the item to delete
*/
GetScreen
()
->
EEDrawList
=
savedEEDrawList
;
if
(
DeleteFullConnection
)
{
/* Mark all wires, junctions, .. connected to one of the item to delete
for
(
DelStruct
=
GetScreen
()
->
EEDrawList
;
DelStruct
!=
NULL
;
DelStruct
=
DelStruct
->
Pnext
)
*/
{
if
(
DeleteFullConnection
)
if
(
!
(
DelStruct
->
m_Flags
&
SELECTEDNODE
)
)
continue
;
{
#define SEGM ((EDA_DrawLineStruct*)DelStruct)
for
(
DelStruct
=
GetScreen
()
->
EEDrawList
;
DelStruct
!=
NULL
;
DelStruct
=
DelStruct
->
Pnext
)
if
(
DelStruct
->
Type
()
!=
DRAW_SEGMENT_STRUCT_TYPE
)
continue
;
{
MarkConnected
(
this
,
GetScreen
()
->
EEDrawList
,
SEGM
);
if
(
!
(
DelStruct
->
m_Flags
&
SELECTEDNODE
)
)
#undef SEGM
continue
;
}
#define SEGM ( (EDA_DrawLineStruct*) DelStruct )
// Search all removable wires (i.e wire with one new dangling end )
if
(
DelStruct
->
Type
()
!=
DRAW_SEGMENT_STRUCT_TYPE
)
for
(
DelStruct
=
GetScreen
()
->
EEDrawList
;
DelStruct
!=
NULL
;
DelStruct
=
DelStruct
->
Pnext
)
continue
;
{
bool
noconnect
=
FALSE
;
MarkConnected
(
this
,
GetScreen
()
->
EEDrawList
,
SEGM
);
#undef SEGM
if
(
DelStruct
->
m_Flags
&
STRUCT_DELETED
)
continue
;
// Already seen
}
if
(
!
(
DelStruct
->
m_Flags
&
CANDIDATE
)
)
continue
;
// Already seen
if
(
DelStruct
->
Type
()
!=
DRAW_SEGMENT_STRUCT_TYPE
)
continue
;
// Search all removable wires (i.e wire with one new dangling end )
DelStruct
->
m_Flags
|=
SKIP_STRUCT
;
for
(
DelStruct
=
GetScreen
()
->
EEDrawList
;
DelStruct
!=
NULL
;
DelStruct
=
DelStruct
->
Pnext
)
#define SEGM ((EDA_DrawLineStruct*)DelStruct)
{
/* Test the SEGM->m_Start point: if this point was connected to an STRUCT_DELETED wire,
bool
noconnect
=
FALSE
;
and now is not connected, the wire can be deleted */
EDA_BaseStruct
*
removed_struct
;
if
(
DelStruct
->
m_Flags
&
STRUCT_DELETED
)
for
(
removed_struct
=
GetScreen
()
->
EEDrawList
;
removed_struct
!=
NULL
;
removed_struct
=
removed_struct
->
Pnext
)
continue
;
// Already seen
{
if
(
(
removed_struct
->
m_Flags
&
STRUCT_DELETED
)
==
0
)
continue
;
if
(
!
(
DelStruct
->
m_Flags
&
CANDIDATE
)
)
if
(
removed_struct
->
Type
()
!=
DRAW_SEGMENT_STRUCT_TYPE
)
continue
;
continue
;
// Already seen
#define WIRE ((EDA_DrawLineStruct*)removed_struct)
if
(
WIRE
->
IsOneEndPointAt
(
SEGM
->
m_Start
)
)
break
;
if
(
DelStruct
->
Type
()
!=
DRAW_SEGMENT_STRUCT_TYPE
)
}
continue
;
if
(
WIRE
&&
!
CountConnectedItems
(
this
,
GetScreen
()
->
EEDrawList
,
SEGM
->
m_Start
,
TRUE
)
)
DelStruct
->
m_Flags
|=
SKIP_STRUCT
;
noconnect
=
TRUE
;
#define SEGM ( (EDA_DrawLineStruct*) DelStruct )
/* Test the SEGM->m_End point: if this point was connected to an STRUCT_DELETED wire,
and now is not connected, the wire can be deleted */
/* Test the SEGM->m_Start point: if this point was connected to an STRUCT_DELETED wire,
for
(
removed_struct
=
GetScreen
()
->
EEDrawList
;
removed_struct
!=
NULL
;
removed_struct
=
removed_struct
->
Pnext
)
* and now is not connected, the wire can be deleted */
{
EDA_BaseStruct
*
removed_struct
;
if
(
(
removed_struct
->
m_Flags
&
STRUCT_DELETED
)
==
0
)
continue
;
for
(
removed_struct
=
GetScreen
()
->
EEDrawList
;
if
(
removed_struct
->
Type
()
!=
DRAW_SEGMENT_STRUCT_TYPE
)
continue
;
removed_struct
!=
NULL
;
if
(
WIRE
->
IsOneEndPointAt
(
SEGM
->
m_End
)
)
break
;
removed_struct
=
removed_struct
->
Pnext
)
}
{
if
(
removed_struct
&&
!
CountConnectedItems
(
this
,
GetScreen
()
->
EEDrawList
,
SEGM
->
m_End
,
TRUE
)
)
if
(
(
removed_struct
->
m_Flags
&
STRUCT_DELETED
)
==
0
)
noconnect
=
TRUE
;
continue
;
DelStruct
->
m_Flags
&=
~
SKIP_STRUCT
;
if
(
removed_struct
->
Type
()
!=
DRAW_SEGMENT_STRUCT_TYPE
)
if
(
noconnect
)
continue
;
{
DelStruct
->
m_Flags
|=
STRUCT_DELETED
;
#define WIRE ( (EDA_DrawLineStruct*) removed_struct )
/* Put this structure in the picked list: */
if
(
WIRE
->
IsOneEndPointAt
(
SEGM
->
m_Start
)
)
PickedItem
=
new
DrawPickedStruct
(
DelStruct
);
break
;
PickedItem
->
Pnext
=
PickedList
;
}
PickedList
=
PickedItem
;
DelStruct
=
GetScreen
()
->
EEDrawList
;
if
(
WIRE
&&
!
CountConnectedItems
(
this
,
GetScreen
()
->
EEDrawList
,
SEGM
->
m_Start
,
TRUE
)
)
}
noconnect
=
TRUE
;
#undef SEGM
}
/* Test the SEGM->m_End point: if this point was connected to an STRUCT_DELETED wire,
* and now is not connected, the wire can be deleted */
// Delete redundant junctions (junctions which connect < 3 end wires and no pin are removed)
for
(
removed_struct
=
GetScreen
()
->
EEDrawList
;
for
(
DelStruct
=
GetScreen
()
->
EEDrawList
;
DelStruct
!=
NULL
;
DelStruct
=
DelStruct
->
Pnext
)
removed_struct
!=
NULL
;
{
removed_struct
=
removed_struct
->
Pnext
)
int
count
;
{
if
(
DelStruct
->
m_Flags
&
STRUCT_DELETED
)
continue
;
if
(
(
removed_struct
->
m_Flags
&
STRUCT_DELETED
)
==
0
)
if
(
!
(
DelStruct
->
m_Flags
&
CANDIDATE
)
)
continue
;
continue
;
if
(
DelStruct
->
Type
()
==
DRAW_JUNCTION_STRUCT_TYPE
)
if
(
removed_struct
->
Type
()
!=
DRAW_SEGMENT_STRUCT_TYPE
)
{
continue
;
#define JUNCTION ((DrawJunctionStruct*)DelStruct)
if
(
WIRE
->
IsOneEndPointAt
(
SEGM
->
m_End
)
)
count
=
CountConnectedItems
(
this
,
GetScreen
()
->
EEDrawList
,
JUNCTION
->
m_Pos
,
FALSE
);
break
;
if
(
count
<=
2
)
}
{
DelStruct
->
m_Flags
|=
STRUCT_DELETED
;
if
(
removed_struct
&&
/* Put this structure in the picked list: */
!
CountConnectedItems
(
this
,
GetScreen
()
->
EEDrawList
,
SEGM
->
m_End
,
TRUE
)
)
PickedItem
=
new
DrawPickedStruct
(
DelStruct
);
noconnect
=
TRUE
;
PickedItem
->
Pnext
=
PickedList
;
PickedList
=
PickedItem
;
DelStruct
->
m_Flags
&=
~
SKIP_STRUCT
;
}
#undef JUNCTION
if
(
noconnect
)
}
{
}
DelStruct
->
m_Flags
|=
STRUCT_DELETED
;
/* Put this structure in the picked list: */
// Delete labels attached to wires
PickedItem
=
new
DrawPickedStruct
(
DelStruct
);
wxPoint
pos
=
GetScreen
()
->
m_Curseur
;
for
(
DelStruct
=
GetScreen
()
->
EEDrawList
;
DelStruct
!=
NULL
;
DelStruct
=
DelStruct
->
Pnext
)
PickedItem
->
Pnext
=
PickedList
;
{
PickedList
=
PickedItem
;
if
(
DelStruct
->
m_Flags
&
STRUCT_DELETED
)
continue
;
DelStruct
=
GetScreen
()
->
EEDrawList
;
if
(
DelStruct
->
Type
()
!=
DRAW_LABEL_STRUCT_TYPE
)
continue
;
}
GetScreen
()
->
m_Curseur
=
((
DrawTextStruct
*
)
DelStruct
)
->
m_Pos
;
#undef SEGM
EDA_BaseStruct
*
TstStruct
=
}
PickStruct
(
GetScreen
()
->
m_Curseur
,
GetScreen
(),
WIREITEM
|
BUSITEM
);
if
(
TstStruct
&&
TstStruct
->
m_Flags
&
STRUCT_DELETED
)
// Delete redundant junctions (junctions which connect < 3 end wires and no pin are removed)
{
for
(
DelStruct
=
GetScreen
()
->
EEDrawList
;
DelStruct
!=
NULL
;
DelStruct
=
DelStruct
->
Pnext
)
DelStruct
->
m_Flags
|=
STRUCT_DELETED
;
{
/* Put this structure in the picked list: */
int
count
;
PickedItem
=
new
DrawPickedStruct
(
DelStruct
);
if
(
DelStruct
->
m_Flags
&
STRUCT_DELETED
)
PickedItem
->
Pnext
=
PickedList
;
continue
;
PickedList
=
PickedItem
;
}
if
(
!
(
DelStruct
->
m_Flags
&
CANDIDATE
)
)
}
continue
;
GetScreen
()
->
m_Curseur
=
pos
;
}
if
(
DelStruct
->
Type
()
==
DRAW_JUNCTION_STRUCT_TYPE
)
{
for
(
DelStruct
=
GetScreen
()
->
EEDrawList
;
DelStruct
!=
NULL
;
DelStruct
=
DelStruct
->
Pnext
)
#define JUNCTION ( (DrawJunctionStruct*) DelStruct )
DelStruct
->
m_Flags
=
0
;
count
=
CountConnectedItems
(
this
,
GetScreen
()
->
EEDrawList
,
JUNCTION
->
m_Pos
,
FALSE
);
if
(
count
<=
2
)
if
(
PickedList
)
{
{
DelStruct
->
m_Flags
|=
STRUCT_DELETED
;
DeleteStruct
(
DrawPanel
,
DC
,
PickedList
);
GetScreen
()
->
SetModify
();
/* Put this structure in the picked list: */
}
PickedItem
=
new
DrawPickedStruct
(
DelStruct
);
PickedItem
->
Pnext
=
PickedList
;
PickedList
=
PickedItem
;
}
#undef JUNCTION
}
}
// Delete labels attached to wires
wxPoint
pos
=
GetScreen
()
->
m_Curseur
;
for
(
DelStruct
=
GetScreen
()
->
EEDrawList
;
DelStruct
!=
NULL
;
DelStruct
=
DelStruct
->
Pnext
)
{
if
(
DelStruct
->
m_Flags
&
STRUCT_DELETED
)
continue
;
if
(
DelStruct
->
Type
()
!=
DRAW_LABEL_STRUCT_TYPE
)
continue
;
GetScreen
()
->
m_Curseur
=
(
(
DrawTextStruct
*
)
DelStruct
)
->
m_Pos
;
EDA_BaseStruct
*
TstStruct
=
PickStruct
(
GetScreen
()
->
m_Curseur
,
GetScreen
(),
WIREITEM
|
BUSITEM
);
if
(
TstStruct
&&
TstStruct
->
m_Flags
&
STRUCT_DELETED
)
{
DelStruct
->
m_Flags
|=
STRUCT_DELETED
;
/* Put this structure in the picked list: */
PickedItem
=
new
DrawPickedStruct
(
DelStruct
);
PickedItem
->
Pnext
=
PickedList
;
PickedList
=
PickedItem
;
}
}
GetScreen
()
->
m_Curseur
=
pos
;
}
for
(
DelStruct
=
GetScreen
()
->
EEDrawList
;
DelStruct
!=
NULL
;
DelStruct
=
DelStruct
->
Pnext
)
DelStruct
->
m_Flags
=
0
;
if
(
PickedList
)
{
DeleteStruct
(
DrawPanel
,
DC
,
PickedList
);
GetScreen
()
->
SetModify
();
}
}
}
/*****************************************************************/
/*****************************************************************/
bool
LocateAndDeleteItem
(
WinEDA_SchematicFrame
*
frame
,
wxDC
*
DC
)
bool
LocateAndDeleteItem
(
WinEDA_SchematicFrame
*
frame
,
wxDC
*
DC
)
/*****************************************************************/
/*****************************************************************/
/* Locate and delete the item found under the mouse cousor
/* Locate and delete the item found under the mouse cousor
If more than one item found: the priority order is:
*
If more than one item found: the priority order is:
1 : MARKER
*
1 : MARKER
2 : JUNCTION
*
2 : JUNCTION
2 : NOCONNECT
*
2 : NOCONNECT
3 : WIRE ou BUS
*
3 : WIRE ou BUS
4 : DRAWITEM
*
4 : DRAWITEM
5 : TEXT
*
5 : TEXT
6 : COMPOSANT
*
6 : COMPOSANT
7 : SHEET
*
7 : SHEET
*
return TRUE if an item was deleted
*
return TRUE if an item was deleted
*/
*/
{
{
EDA_BaseStruct
*
DelStruct
;
EDA_BaseStruct
*
DelStruct
;
SCH_SCREEN
*
screen
=
(
SCH_SCREEN
*
)(
frame
->
GetScreen
());
SCH_SCREEN
*
screen
=
(
SCH_SCREEN
*
)
(
frame
->
GetScreen
()
);
bool
item_deleted
=
FALSE
;
bool
item_deleted
=
FALSE
;
DelStruct
=
PickStruct
(
screen
->
m_Curseur
,
DelStruct
=
PickStruct
(
screen
->
m_Curseur
,
screen
,
MARKERITEM
);
screen
,
MARKERITEM
);
if
(
DelStruct
==
NULL
)
if
(
DelStruct
==
NULL
)
DelStruct
=
PickStruct
(
screen
->
m_Curseur
,
DelStruct
=
PickStruct
(
screen
->
m_Curseur
,
screen
,
JUNCTIONITEM
);
screen
,
JUNCTIONITEM
);
if
(
DelStruct
==
NULL
)
if
(
DelStruct
==
NULL
)
DelStruct
=
PickStruct
(
screen
->
m_Curseur
,
DelStruct
=
PickStruct
(
screen
->
m_Curseur
,
screen
,
NOCONNECTITEM
);
screen
,
NOCONNECTITEM
);
if
(
DelStruct
==
NULL
)
if
(
DelStruct
==
NULL
)
DelStruct
=
PickStruct
(
screen
->
m_Curseur
,
DelStruct
=
PickStruct
(
screen
->
m_Curseur
,
screen
,
RACCORDITEM
);
screen
,
RACCORDITEM
);
if
(
DelStruct
==
NULL
)
if
(
DelStruct
==
NULL
)
DelStruct
=
PickStruct
(
screen
->
m_Curseur
,
DelStruct
=
PickStruct
(
screen
->
m_Curseur
,
screen
,
WIREITEM
|
BUSITEM
);
screen
,
WIREITEM
|
BUSITEM
);
if
(
DelStruct
==
NULL
)
if
(
DelStruct
==
NULL
)
DelStruct
=
PickStruct
(
screen
->
m_Curseur
,
DelStruct
=
PickStruct
(
screen
->
m_Curseur
,
screen
,
DRAWITEM
);
screen
,
DRAWITEM
);
if
(
DelStruct
==
NULL
)
if
(
DelStruct
==
NULL
)
DelStruct
=
PickStruct
(
screen
->
m_Curseur
,
DelStruct
=
PickStruct
(
screen
->
m_Curseur
,
screen
,
TEXTITEM
|
LABELITEM
);
screen
,
TEXTITEM
|
LABELITEM
);
if
(
DelStruct
==
NULL
)
if
(
DelStruct
==
NULL
)
DelStruct
=
PickStruct
(
screen
->
m_Curseur
,
DelStruct
=
PickStruct
(
screen
->
m_Curseur
,
screen
,
LIBITEM
);
screen
,
LIBITEM
);
if
(
DelStruct
==
NULL
)
if
(
DelStruct
==
NULL
)
DelStruct
=
PickStruct
(
screen
->
m_Curseur
,
DelStruct
=
PickStruct
(
screen
->
m_Curseur
,
screen
,
SHEETITEM
);
screen
,
SHEETITEM
);
if
(
DelStruct
)
if
(
DelStruct
)
{
{
g_ItemToRepeat
=
NULL
;
g_ItemToRepeat
=
NULL
;
DeleteStruct
(
frame
->
DrawPanel
,
DC
,
DelStruct
);
DeleteStruct
(
frame
->
DrawPanel
,
DC
,
DelStruct
);
frame
->
TestDanglingEnds
(
frame
->
GetScreen
()
->
EEDrawList
,
DC
);
frame
->
TestDanglingEnds
(
frame
->
GetScreen
()
->
EEDrawList
,
DC
);
frame
->
GetScreen
()
->
SetModify
();
frame
->
GetScreen
()
->
SetModify
();
item_deleted
=
TRUE
;
item_deleted
=
TRUE
;
}
}
return
item_deleted
;
return
item_deleted
;
}
}
/***************************************************************/
/***************************************************************/
void
EraseStruct
(
EDA_BaseStruct
*
DrawStruct
,
SCH_SCREEN
*
Screen
)
void
EraseStruct
(
EDA_BaseStruct
*
DrawStruct
,
SCH_SCREEN
*
Screen
)
/***************************************************************/
/***************************************************************/
/* Suppression definitive d'une structure dans une liste chainee
/* Suppression definitive d'une structure dans une liste chainee
d'elements de dessin
*
d'elements de dessin
DrawStruct = pointeur sur la structure
*
DrawStruct = pointeur sur la structure
Screen = pointeur sur l'ecran d'appartenance
*
Screen = pointeur sur l'ecran d'appartenance
Le chainage de la liste est modifie.
*
Le chainage de la liste est modifie.
*
Remarque:
*
Remarque:
pour les structures DRAW_SHEET_STRUCT_TYPE, l'ecran et les structures
*
pour les structures DRAW_SHEET_STRUCT_TYPE, l'ecran et les structures
correspondantes ne sont pas touches.
*
correspondantes ne sont pas touches.
Ils doivent etre traites separement
*
Ils doivent etre traites separement
*/
*/
{
{
EDA_BaseStruct
*
DrawList
;
EDA_BaseStruct
*
DrawList
;
DrawPickedStruct
*
PickedList
=
NULL
;
DrawPickedStruct
*
PickedList
=
NULL
;
DrawSheetLabelStruct
*
SheetLabel
,
*
NextLabel
;
DrawSheetLabelStruct
*
SheetLabel
,
*
NextLabel
;
if
(
DrawStruct
==
NULL
)
return
;
if
(
DrawStruct
==
NULL
)
if
(
Screen
==
NULL
)
return
;
return
;
Screen
->
SetModify
();
if
(
Screen
==
NULL
)
return
;
if
(
DrawStruct
->
Type
()
==
DRAW_SHEETLABEL_STRUCT_TYPE
)
{
/* Cette stucture est rattachee a une feuille, et n'est pas
Screen
->
SetModify
();
accessible par la liste globale directement */
//this structure has a sheet attached, which we must find.
if
(
DrawStruct
->
Type
()
==
DRAW_SHEETLABEL_STRUCT_TYPE
)
DrawList
=
Screen
->
EEDrawList
;
{
for
(
;
DrawList
!=
NULL
;
DrawList
=
DrawList
->
Pnext
)
/* Cette stucture est rattachee a une feuille, et n'est pas
{
* accessible par la liste globale directement */
if
(
DrawList
->
Type
()
!=
DRAW_SHEET_STRUCT_TYPE
)
continue
;
//this structure has a sheet attached, which we must find.
/* Examen de la Sheet */
DrawList
=
Screen
->
EEDrawList
;
SheetLabel
=
((
DrawSheetStruct
*
)
DrawList
)
->
m_Label
;
for
(
;
DrawList
!=
NULL
;
DrawList
=
DrawList
->
Pnext
)
if
(
SheetLabel
==
NULL
)
continue
;
{
if
(
SheetLabel
==
(
DrawSheetLabelStruct
*
)
DrawStruct
)
if
(
DrawList
->
Type
()
!=
DRAW_SHEET_STRUCT_TYPE
)
{
continue
;
((
DrawSheetStruct
*
)
DrawList
)
->
m_Label
=
(
DrawSheetLabelStruct
*
)
SheetLabel
->
Pnext
;
/* Examen de la Sheet */
SAFE_DELETE
(
DrawStruct
);
SheetLabel
=
(
(
DrawSheetStruct
*
)
DrawList
)
->
m_Label
;
return
;
if
(
SheetLabel
==
NULL
)
}
continue
;
else
while
(
SheetLabel
->
Pnext
)
/* Examen de la liste dependante */
{
if
(
SheetLabel
==
(
DrawSheetLabelStruct
*
)
DrawStruct
)
NextLabel
=
(
DrawSheetLabelStruct
*
)
SheetLabel
->
Pnext
;
{
if
(
NextLabel
==
(
DrawSheetLabelStruct
*
)
DrawStruct
)
(
(
DrawSheetStruct
*
)
DrawList
)
->
m_Label
=
{
(
DrawSheetLabelStruct
*
)
SheetLabel
->
Pnext
;
SheetLabel
->
Pnext
=
(
EDA_BaseStruct
*
)
NextLabel
->
Pnext
;
SAFE_DELETE
(
DrawStruct
);
SAFE_DELETE
(
DrawStruct
);
return
;
return
;
}
}
SheetLabel
=
NextLabel
;
else
}
{
}
while
(
SheetLabel
->
Pnext
)
/* Examen de la liste dependante */
return
;
{
}
NextLabel
=
(
DrawSheetLabelStruct
*
)
SheetLabel
->
Pnext
;
if
(
NextLabel
==
(
DrawSheetLabelStruct
*
)
DrawStruct
)
if
(
DrawStruct
->
Type
()
==
DRAW_PICK_ITEM_STRUCT_TYPE
)
{
{
SheetLabel
->
Pnext
=
(
EDA_BaseStruct
*
)
NextLabel
->
Pnext
;
PickedList
=
(
DrawPickedStruct
*
)
DrawStruct
;
SAFE_DELETE
(
DrawStruct
);
while
(
PickedList
)
return
;
{
}
if
(
PickedList
->
m_PickedStruct
==
Screen
->
EEDrawList
)
SheetLabel
=
NextLabel
;
{
}
Screen
->
EEDrawList
=
Screen
->
EEDrawList
->
Pnext
;
}
SAFE_DELETE
(
DrawStruct
);
}
}
else
return
;
{
}
DrawList
=
Screen
->
EEDrawList
;
while
(
DrawList
&&
DrawList
->
Pnext
)
if
(
DrawStruct
->
Type
()
==
DRAW_PICK_ITEM_STRUCT_TYPE
)
{
{
if
(
DrawList
->
Pnext
==
PickedList
->
m_PickedStruct
)
PickedList
=
(
DrawPickedStruct
*
)
DrawStruct
;
{
while
(
PickedList
)
DrawList
->
Pnext
=
DrawList
->
Pnext
->
Pnext
;
{
SAFE_DELETE
(
DrawStruct
);
if
(
PickedList
->
m_PickedStruct
==
Screen
->
EEDrawList
)
return
;
{
}
Screen
->
EEDrawList
=
Screen
->
EEDrawList
->
Pnext
;
DrawList
=
DrawList
->
Pnext
;
SAFE_DELETE
(
DrawStruct
);
}
}
}
else
PickedList
=
(
DrawPickedStruct
*
)
PickedList
->
Pnext
;
{
}
DrawList
=
Screen
->
EEDrawList
;
}
while
(
DrawList
&&
DrawList
->
Pnext
)
else
// structure usuelle */
{
{
if
(
DrawList
->
Pnext
==
PickedList
->
m_PickedStruct
)
if
(
DrawStruct
==
Screen
->
EEDrawList
)
{
{
DrawList
->
Pnext
=
DrawList
->
Pnext
->
Pnext
;
Screen
->
EEDrawList
=
DrawStruct
->
Pnext
;
SAFE_DELETE
(
DrawStruct
);
SAFE_DELETE
(
DrawStruct
);
return
;
}
}
else
DrawList
=
DrawList
->
Pnext
;
{
}
DrawList
=
Screen
->
EEDrawList
;
}
while
(
DrawList
&&
DrawList
->
Pnext
)
PickedList
=
(
DrawPickedStruct
*
)
PickedList
->
Pnext
;
{
}
if
(
DrawList
->
Pnext
==
DrawStruct
)
}
{
else
// structure usuelle */
DrawList
->
Pnext
=
DrawStruct
->
Pnext
;
{
SAFE_DELETE
(
DrawStruct
);
if
(
DrawStruct
==
Screen
->
EEDrawList
)
return
;
{
}
Screen
->
EEDrawList
=
DrawStruct
->
Pnext
;
DrawList
=
DrawList
->
Pnext
;
SAFE_DELETE
(
DrawStruct
);
}
}
}
else
}
{
DrawList
=
Screen
->
EEDrawList
;
while
(
DrawList
&&
DrawList
->
Pnext
)
{
if
(
DrawList
->
Pnext
==
DrawStruct
)
{
DrawList
->
Pnext
=
DrawStruct
->
Pnext
;
SAFE_DELETE
(
DrawStruct
);
return
;
}
DrawList
=
DrawList
->
Pnext
;
}
}
}
}
}
/********************************/
/********************************/
void
DeleteAllMarkers
(
int
type
)
void
DeleteAllMarkers
(
int
type
)
/********************************/
/********************************/
/* Effacement des marqueurs du type "type" */
/* Effacement des marqueurs du type "type" */
{
{
SCH_SCREEN
*
screen
;
SCH_SCREEN
*
screen
;
EDA_BaseStruct
*
DrawStruct
,
*
NextStruct
;
EDA_BaseStruct
*
DrawStruct
,
*
NextStruct
;
DrawMarkerStruct
*
Marker
;
DrawMarkerStruct
*
Marker
;
EDA_ScreenList
ScreenList
;
EDA_ScreenList
ScreenList
;
for
(
screen
=
ScreenList
.
GetFirst
();
screen
!=
NULL
;
screen
=
ScreenList
.
GetNext
()
)
{
for
(
screen
=
ScreenList
.
GetFirst
();
screen
!=
NULL
;
screen
=
ScreenList
.
GetNext
()
)
for
(
DrawStruct
=
screen
->
EEDrawList
;
DrawStruct
!=
NULL
;
DrawStruct
=
NextStruct
)
{
{
for
(
DrawStruct
=
screen
->
EEDrawList
;
DrawStruct
!=
NULL
;
DrawStruct
=
NextStruct
)
NextStruct
=
DrawStruct
->
Pnext
;
{
if
(
DrawStruct
->
Type
()
!=
DRAW_MARKER_STRUCT_TYPE
)
continue
;
NextStruct
=
DrawStruct
->
Pnext
;
/* Marqueur trouve */
if
(
DrawStruct
->
Type
()
!=
DRAW_MARKER_STRUCT_TYPE
)
Marker
=
(
DrawMarkerStruct
*
)
DrawStruct
;
continue
;
if
(
Marker
->
m_Type
!=
type
)
continue
;
/* Suppression du marqueur */
/* Marqueur trouve */
EraseStruct
(
DrawStruct
,
screen
);
Marker
=
(
DrawMarkerStruct
*
)
DrawStruct
;
}
if
(
Marker
->
m_Type
!=
type
)
}
continue
;
/* Suppression du marqueur */
EraseStruct
(
DrawStruct
,
screen
);
}
}
}
}
/********************************************************************/
/********************************************************************/
void
DeleteOneLibraryDrawStruct
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
DeleteOneLibraryDrawStruct
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
EDA_LibComponentStruct
*
LibEntry
,
EDA_LibComponentStruct
*
LibEntry
,
LibEDA_BaseStruct
*
DrawItem
,
int
Affiche
)
LibEDA_BaseStruct
*
DrawItem
,
int
Affiche
)
/********************************************************************/
/********************************************************************/
/* Routine d'effacement d'un "LibraryDrawStruct"
(d'un element de dessin d'un composant )
Parametres d'entree
/* Routine d'effacement d'un "LibraryDrawStruct"
Pointeur sur le composant comportant la structure
* (d'un element de dessin d'un composant )
(Si NULL la structure a effacer est supposee non rattachee
*
a un composant)
* Parametres d'entree
Pointeur sur la structure a effacer
* Pointeur sur le composant comportant la structure
* (Si NULL la structure a effacer est supposee non rattachee
Efface egalement le graphique correspondant de l'ecran
* a un composant)
*/
* Pointeur sur la structure a effacer
*
* Efface egalement le graphique correspondant de l'ecran
*/
{
{
LibEDA_BaseStruct
*
PreviousDrawItem
;
LibEDA_BaseStruct
*
PreviousDrawItem
;
/* Effacement du graphique */
/* Effacement du graphique */
if
(
Affiche
&&
DC
)
if
(
Affiche
&&
DC
)
DrawLibraryDrawStruct
(
panel
,
DC
,
LibEntry
,
0
,
0
,
DrawItem
,
CurrentUnit
,
g_XorMode
);
DrawLibraryDrawStruct
(
panel
,
DC
,
LibEntry
,
0
,
0
,
DrawItem
,
CurrentUnit
,
g_XorMode
);
/* Effacement de la structure en memoire */
/* Effacement de la structure en memoire */
if
(
LibEntry
)
/* Recherche du predecesseur */
if
(
LibEntry
)
/* Recherche du predecesseur */
{
{
PreviousDrawItem
=
LibEntry
->
m_Drawings
;
PreviousDrawItem
=
LibEntry
->
m_Drawings
;
/* Cas du 1er symbole graphique = struct a supprimer */
/* Cas du 1er symbole graphique = struct a supprimer */
if
(
LibEntry
->
m_Drawings
==
DrawItem
)
if
(
LibEntry
->
m_Drawings
==
DrawItem
)
{
{
LibEntry
->
m_Drawings
=
DrawItem
->
Next
();
LibEntry
->
m_Drawings
=
DrawItem
->
Next
();
SAFE_DELETE
(
DrawItem
);
SAFE_DELETE
(
DrawItem
);
}
}
else
/* Cas des autres items */
else
/* Cas des autres items */
{
while
(
PreviousDrawItem
)
while
(
PreviousDrawItem
)
{
{
if
(
PreviousDrawItem
->
Pnext
==
DrawItem
)
if
(
PreviousDrawItem
->
Pnext
==
DrawItem
)
{
{
PreviousDrawItem
->
Pnext
=
DrawItem
->
Pnext
;
PreviousDrawItem
->
Pnext
=
DrawItem
->
Pnext
;
SAFE_DELETE
(
DrawItem
);
break
;
SAFE_DELETE
(
DrawItem
);
}
break
;
PreviousDrawItem
=
PreviousDrawItem
->
Next
();
}
}
PreviousDrawItem
=
PreviousDrawItem
->
Next
();
}
}
}
else
/* Structure non reliee a un composant */
}
{
SAFE_DELETE
(
DrawItem
);
else
/* Structure non reliee a un composant */
}
{
SAFE_DELETE
(
DrawItem
);
}
}
}
eeschema/erc.cpp
View file @
0f0ced37
...
@@ -101,16 +101,17 @@ bool DiagErcTableInit; // go to TRUE after DiagErc init
...
@@ -101,16 +101,17 @@ bool DiagErcTableInit; // go to TRUE after DiagErc init
*/
*/
static
int
DefaultDiagErc
[
PIN_NMAX
][
PIN_NMAX
]
=
static
int
DefaultDiagErc
[
PIN_NMAX
][
PIN_NMAX
]
=
{
/* I, O, Bi, 3S, Pas, UnS,PwrI,PwrO, OC, OE, NC */
{
/* I, O, Bi, 3S, Pas, UnS,PwrI,PwrO, OC, OE, NC */
/* I */
{
OK
,
OK
,
OK
,
OK
,
OK
,
WAR
,
OK
,
OK
,
OK
,
OK
,
WAR
},
/* I */
/* O */
{
OK
,
ERR
,
OK
,
WAR
,
OK
,
WAR
,
OK
,
ERR
,
ERR
,
ERR
,
WAR
},
{
OK
,
OK
,
OK
,
OK
,
OK
,
WAR
,
OK
,
OK
,
OK
,
OK
,
WAR
},
/* Bi*/
{
OK
,
OK
,
OK
,
OK
,
OK
,
WAR
,
OK
,
WAR
,
OK
,
WAR
,
WAR
},
/* O */
{
OK
,
ERR
,
OK
,
WAR
,
OK
,
WAR
,
OK
,
ERR
,
ERR
,
ERR
,
WAR
},
/* 3S*/
{
OK
,
WAR
,
OK
,
OK
,
OK
,
WAR
,
WAR
,
ERR
,
WAR
,
WAR
,
WAR
},
/* Bi*/
{
OK
,
OK
,
OK
,
OK
,
OK
,
WAR
,
OK
,
WAR
,
OK
,
WAR
,
WAR
},
/*Pas*/
{
OK
,
OK
,
OK
,
OK
,
OK
,
WAR
,
OK
,
OK
,
OK
,
OK
,
WAR
},
/* 3S*/
{
OK
,
WAR
,
OK
,
OK
,
OK
,
WAR
,
WAR
,
ERR
,
WAR
,
WAR
,
WAR
},
/*Pas*/
{
OK
,
OK
,
OK
,
OK
,
OK
,
WAR
,
OK
,
OK
,
OK
,
OK
,
WAR
},
/*UnS */
{
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
},
/*UnS */
{
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
},
/*PwrI*/
{
OK
,
OK
,
OK
,
WAR
,
OK
,
WAR
,
OK
,
OK
,
OK
,
OK
,
ERR
},
/*PwrI*/
{
OK
,
OK
,
OK
,
WAR
,
OK
,
WAR
,
OK
,
OK
,
OK
,
OK
,
ERR
},
/*PwrO*/
{
OK
,
ERR
,
WAR
,
ERR
,
OK
,
WAR
,
OK
,
ERR
,
ERR
,
ERR
,
WAR
},
/*PwrO*/
{
OK
,
ERR
,
WAR
,
ERR
,
OK
,
WAR
,
OK
,
ERR
,
ERR
,
ERR
,
WAR
},
/* OC */
{
OK
,
ERR
,
OK
,
WAR
,
OK
,
WAR
,
OK
,
ERR
,
OK
,
OK
,
WAR
},
/* OC */
{
OK
,
ERR
,
OK
,
WAR
,
OK
,
WAR
,
OK
,
ERR
,
OK
,
OK
,
WAR
},
/* OE */
{
OK
,
ERR
,
WAR
,
WAR
,
OK
,
WAR
,
OK
,
ERR
,
OK
,
OK
,
WAR
},
/* OE */
{
OK
,
ERR
,
WAR
,
WAR
,
OK
,
WAR
,
OK
,
ERR
,
OK
,
OK
,
WAR
},
/* NC */
{
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
}
/* NC */
{
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
}
};
};
...
@@ -124,29 +125,29 @@ static int DefaultDiagErc[PIN_NMAX][PIN_NMAX] =
...
@@ -124,29 +125,29 @@ static int DefaultDiagErc[PIN_NMAX][PIN_NMAX] =
/* Look up table which gives the minimal drive for a pair of connected pins on a net
/* Look up table which gives the minimal drive for a pair of connected pins on a net
* Initial state of a net is NOC (No Connection)
* Initial state of a net is NOC (No Connection)
* Can be updated to NET_NC, or NOD (Not Driven) or DRV (DRIven)
* Can be updated to NET_NC, or NOD (Not Driven) or DRV (DRIven)
*
*
* Can be updated to NET_NC only if the previous state is NOC
* Can be updated to NET_NC only if the previous state is NOC
*
*
* Nets are OK when their final state is NET_NC or DRV
* Nets are OK when their final state is NET_NC or DRV
* Nets with the state NOD have no source signal
* Nets with the state NOD have no source signal
*/
*/
static
int
MinimalReq
[
PIN_NMAX
][
PIN_NMAX
]
=
static
int
MinimalReq
[
PIN_NMAX
][
PIN_NMAX
]
=
{
/* In, Out, Bi, 3S, Pas, UnS,PwrI,PwrO, OC, OE, NC */
{
/* In, Out, Bi, 3S, Pas, UnS,PwrI,PwrO, OC, OE, NC */
/* In*/
{
NOD
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/* In*/
/*Out*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOC
},
{
NOD
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/* Bi*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/*Out*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOC
},
/* 3S*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/* Bi*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/*Pas*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/* 3S*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/*UnS*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/*Pas*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/*UnS*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/*PwrI*/
{
NOD
,
DRV
,
NOD
,
NOD
,
NOD
,
NOD
,
NOD
,
DRV
,
NOD
,
NOD
,
NOC
},
/*PwrI*/
{
NOD
,
DRV
,
NOD
,
NOD
,
NOD
,
NOD
,
NOD
,
DRV
,
NOD
,
NOD
,
NOC
},
/*PwrO*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOC
},
/*PwrO*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOC
},
/* OC*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/* OC*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/* OE*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/* OE*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/* NC*/
{
NOC
,
NOC
,
NOC
,
NOC
,
NOC
,
NOC
,
NOC
,
NOC
,
NOC
,
NOC
,
NOC
}
/* NC*/
{
NOC
,
NOC
,
NOC
,
NOC
,
NOC
,
NOC
,
NOC
,
NOC
,
NOC
,
NOC
,
NOC
}
};
};
/*********************************************/
/*********************************************/
void
WinEDA_ErcFrame
::
ReBuildMatrixPanel
()
void
WinEDA_ErcFrame
::
ReBuildMatrixPanel
()
/*********************************************/
/*********************************************/
...
@@ -174,7 +175,7 @@ void WinEDA_ErcFrame::ReBuildMatrixPanel()
...
@@ -174,7 +175,7 @@ void WinEDA_ErcFrame::ReBuildMatrixPanel()
text_height
=
text
->
GetRect
().
GetHeight
();
text_height
=
text
->
GetRect
().
GetHeight
();
bitmap_size
=
MAX
(
bitmap_size
,
text_height
);
bitmap_size
=
MAX
(
bitmap_size
,
text_height
);
SAFE_DELETE
(
text
);
SAFE_DELETE
(
text
);
// compute the Y pos interval:
// compute the Y pos interval:
BoxMatrixMinSize
.
y
=
(
bitmap_size
*
(
PIN_NMAX
+
1
)
)
+
5
;
BoxMatrixMinSize
.
y
=
(
bitmap_size
*
(
PIN_NMAX
+
1
)
)
+
5
;
...
@@ -273,7 +274,7 @@ void WinEDA_ErcFrame::TestErc( wxCommandEvent& event )
...
@@ -273,7 +274,7 @@ void WinEDA_ErcFrame::TestErc( wxCommandEvent& event )
ObjetNetListStruct
*
OldItem
;
ObjetNetListStruct
*
OldItem
;
ObjetNetListStruct
*
StartNet
;
ObjetNetListStruct
*
StartNet
;
ObjetNetListStruct
*
Lim
;
ObjetNetListStruct
*
Lim
;
int
NetNbItems
,
MinConn
;
int
NetNbItems
,
MinConn
;
if
(
!
DiagErcTableInit
)
if
(
!
DiagErcTableInit
)
...
@@ -324,19 +325,19 @@ void WinEDA_ErcFrame::TestErc( wxCommandEvent& event )
...
@@ -324,19 +325,19 @@ void WinEDA_ErcFrame::TestErc( wxCommandEvent& event )
for
(
NetItemRef
=
g_TabObjNet
;
NetItemRef
<
Lim
;
NetItemRef
++
)
for
(
NetItemRef
=
g_TabObjNet
;
NetItemRef
<
Lim
;
NetItemRef
++
)
NetItemRef
->
m_FlagOfConnection
=
(
IsConnectType
)
0
;
NetItemRef
->
m_FlagOfConnection
=
(
IsConnectType
)
0
;
NetNbItems
=
0
;
NetNbItems
=
0
;
MinConn
=
NOC
;
MinConn
=
NOC
;
StartNet
=
OldItem
=
NetItemRef
=
g_TabObjNet
;
StartNet
=
OldItem
=
NetItemRef
=
g_TabObjNet
;
for
(
;
NetItemRef
<
Lim
;
NetItemRef
++
)
for
(
;
NetItemRef
<
Lim
;
NetItemRef
++
)
{
{
/* Tst changement de net */
/* Tst changement de net */
if
(
OldItem
->
GetNet
()
!=
NetItemRef
->
GetNet
()
)
if
(
OldItem
->
GetNet
()
!=
NetItemRef
->
GetNet
()
)
{
{
MinConn
=
NOC
;
MinConn
=
NOC
;
NetNbItems
=
0
;
NetNbItems
=
0
;
StartNet
=
NetItemRef
;
StartNet
=
NetItemRef
;
}
}
switch
(
NetItemRef
->
m_Type
)
switch
(
NetItemRef
->
m_Type
)
...
@@ -347,8 +348,8 @@ void WinEDA_ErcFrame::TestErc( wxCommandEvent& event )
...
@@ -347,8 +348,8 @@ void WinEDA_ErcFrame::TestErc( wxCommandEvent& event )
case
NET_LABEL
:
case
NET_LABEL
:
case
NET_BUSLABELMEMBER
:
case
NET_BUSLABELMEMBER
:
case
NET_PINLABEL
:
case
NET_PINLABEL
:
case
NET_GLOBLABEL
:
//not sure how to handle global labels -- they should be treated like other nets (just global!0
case
NET_GLOBLABEL
:
//not sure how to handle global labels -- they should be treated like other nets (just global!0
case
NET_GLOBBUSLABELMEMBER
:
case
NET_GLOBBUSLABELMEMBER
:
break
;
break
;
case
NET_HIERLABEL
:
case
NET_HIERLABEL
:
...
@@ -366,7 +367,7 @@ void WinEDA_ErcFrame::TestErc( wxCommandEvent& event )
...
@@ -366,7 +367,7 @@ void WinEDA_ErcFrame::TestErc( wxCommandEvent& event )
case
NET_PIN
:
case
NET_PIN
:
TestOthersItems
(
m_Parent
->
DrawPanel
,
&
dc
,
TestOthersItems
(
m_Parent
->
DrawPanel
,
&
dc
,
NetItemRef
,
StartNet
,
&
NetNbItems
,
&
MinConn
);
NetItemRef
,
StartNet
,
&
NetNbItems
,
&
MinConn
);
break
;
break
;
}
}
...
@@ -389,17 +390,18 @@ void WinEDA_ErcFrame::TestErc( wxCommandEvent& event )
...
@@ -389,17 +390,18 @@ void WinEDA_ErcFrame::TestErc( wxCommandEvent& event )
if
(
WriteFichierERC
==
TRUE
)
if
(
WriteFichierERC
==
TRUE
)
{
{
wxString
ErcFullFileName
;
wxString
ErcFullFileName
;
ErcFullFileName
=
g_RootSheet
->
m_AssociatedScreen
->
m_FileName
;
ErcFullFileName
=
g_RootSheet
->
m_AssociatedScreen
->
m_FileName
;
ChangeFileNameExt
(
ErcFullFileName
,
wxT
(
".erc"
)
);
ChangeFileNameExt
(
ErcFullFileName
,
wxT
(
".erc"
)
);
ErcFullFileName
=
EDA_FileSelector
(
_
(
"ERC file:"
),
ErcFullFileName
=
EDA_FileSelector
(
_
(
"ERC file:"
),
wxEmptyString
,
/* Chemin par defaut */
wxEmptyString
,
/* Chemin par defaut */
ErcFullFileName
,
/* nom fichier par defaut */
ErcFullFileName
,
/* nom fichier par defaut */
wxT
(
".erc"
),
/* extension par defaut */
wxT
(
".erc"
),
/* extension par defaut */
wxT
(
"*.erc"
),
/* Masque d'affichage */
wxT
(
"*.erc"
),
/* Masque d'affichage */
this
,
this
,
wxFD_SAVE
,
wxFD_SAVE
,
TRUE
TRUE
);
);
if
(
ErcFullFileName
.
IsEmpty
()
)
if
(
ErcFullFileName
.
IsEmpty
()
)
return
;
return
;
...
@@ -434,6 +436,7 @@ void WinEDA_ErcFrame::DelERCMarkers( wxCommandEvent& event )
...
@@ -434,6 +436,7 @@ void WinEDA_ErcFrame::DelERCMarkers( wxCommandEvent& event )
{
{
if
(
DrawStruct
->
Type
()
!=
DRAW_MARKER_STRUCT_TYPE
)
if
(
DrawStruct
->
Type
()
!=
DRAW_MARKER_STRUCT_TYPE
)
continue
;
continue
;
/* Marqueur trouve */
/* Marqueur trouve */
Marker
=
(
DrawMarkerStruct
*
)
DrawStruct
;
Marker
=
(
DrawMarkerStruct
*
)
DrawStruct
;
if
(
Marker
->
m_Type
==
MARQ_ERC
)
if
(
Marker
->
m_Type
==
MARQ_ERC
)
...
@@ -466,7 +469,7 @@ void WinEDA_ErcFrame::ChangeErrorLevel( wxCommandEvent& event )
...
@@ -466,7 +469,7 @@ void WinEDA_ErcFrame::ChangeErrorLevel( wxCommandEvent& event )
{
{
int
id
,
level
,
ii
,
x
,
y
;
int
id
,
level
,
ii
,
x
,
y
;
wxBitmapButton
*
Butt
;
wxBitmapButton
*
Butt
;
const
char
**
new_bitmap_xpm
=
NULL
;
const
char
**
new_bitmap_xpm
=
NULL
;
wxPoint
pos
;
wxPoint
pos
;
id
=
event
.
GetId
();
id
=
event
.
GetId
();
...
@@ -545,11 +548,11 @@ static void Diagnose( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -545,11 +548,11 @@ static void Diagnose( WinEDA_DrawPanel* panel, wxDC* DC,
||
(
NetItemRef
->
m_Type
==
NET_HIERBUSLABELMEMBER
)
)
||
(
NetItemRef
->
m_Type
==
NET_HIERBUSLABELMEMBER
)
)
{
{
Marker
->
m_Comment
.
Printf
(
_
(
"Warning HLabel %s not connected to SheetLabel"
),
Marker
->
m_Comment
.
Printf
(
_
(
"Warning HLabel %s not connected to SheetLabel"
),
NetItemRef
->
m_Label
->
GetData
()
);
NetItemRef
->
m_Label
->
GetData
()
);
}
}
else
else
Marker
->
m_Comment
.
Printf
(
_
(
"Warning SheetLabel %s not connected to HLabel"
),
Marker
->
m_Comment
.
Printf
(
_
(
"Warning SheetLabel %s not connected to HLabel"
),
NetItemRef
->
m_Label
->
GetData
()
);
NetItemRef
->
m_Label
->
GetData
()
);
if
(
screen
==
panel
->
GetScreen
()
)
if
(
screen
==
panel
->
GetScreen
()
)
RedrawOneStruct
(
panel
,
DC
,
Marker
,
GR_COPY
);
RedrawOneStruct
(
panel
,
DC
,
Marker
,
GR_COPY
);
...
@@ -573,6 +576,7 @@ static void Diagnose( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -573,6 +576,7 @@ static void Diagnose( WinEDA_DrawPanel* panel, wxDC* DC,
Marker
->
m_Comment
.
Printf
(
Marker
->
m_Comment
.
Printf
(
_
(
"Warning Pin %s not driven (Net %d)"
),
_
(
"Warning Pin %s not driven (Net %d)"
),
MsgPinElectricType
[
ii
],
NetItemRef
->
GetNet
()
);
MsgPinElectricType
[
ii
],
NetItemRef
->
GetNet
()
);
if
(
screen
==
panel
->
GetScreen
()
)
if
(
screen
==
panel
->
GetScreen
()
)
RedrawOneStruct
(
panel
,
DC
,
Marker
,
GR_COPY
);
RedrawOneStruct
(
panel
,
DC
,
Marker
,
GR_COPY
);
return
;
return
;
...
@@ -582,6 +586,7 @@ static void Diagnose( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -582,6 +586,7 @@ static void Diagnose( WinEDA_DrawPanel* panel, wxDC* DC,
{
{
Marker
->
m_Comment
.
Printf
(
Marker
->
m_Comment
.
Printf
(
_
(
"Warning More than 1 Pin connected to UnConnect symbol"
)
);
_
(
"Warning More than 1 Pin connected to UnConnect symbol"
)
);
if
(
screen
==
panel
->
GetScreen
()
)
if
(
screen
==
panel
->
GetScreen
()
)
RedrawOneStruct
(
panel
,
DC
,
Marker
,
GR_COPY
);
RedrawOneStruct
(
panel
,
DC
,
Marker
,
GR_COPY
);
return
;
return
;
...
@@ -600,10 +605,10 @@ static void Diagnose( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -600,10 +605,10 @@ static void Diagnose( WinEDA_DrawPanel* panel, wxDC* DC,
}
}
Marker
->
m_Comment
.
Printf
(
_
(
Marker
->
m_Comment
.
Printf
(
_
(
"%s: Pin %s connected to Pin %s (net %d)"
),
"%s: Pin %s connected to Pin %s (net %d)"
),
DiagLevel
.
GetData
(),
DiagLevel
.
GetData
(),
MsgPinElectricType
[
ii
],
MsgPinElectricType
[
ii
],
MsgPinElectricType
[
jj
],
NetItemRef
->
GetNet
()
);
MsgPinElectricType
[
jj
],
NetItemRef
->
GetNet
()
);
if
(
screen
==
panel
->
GetScreen
()
)
if
(
screen
==
panel
->
GetScreen
()
)
RedrawOneStruct
(
panel
,
DC
,
Marker
,
GR_COPY
);
RedrawOneStruct
(
panel
,
DC
,
Marker
,
GR_COPY
);
...
@@ -625,12 +630,12 @@ static void TestOthersItems( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -625,12 +630,12 @@ static void TestOthersItems( WinEDA_DrawPanel* panel, wxDC* DC,
{
{
ObjetNetListStruct
*
NetItemTst
;
ObjetNetListStruct
*
NetItemTst
;
ObjetNetListStruct
*
Lim
;
ObjetNetListStruct
*
Lim
;
int
ref_elect_type
,
jj
,
erc
=
OK
,
local_minconn
;
int
ref_elect_type
,
jj
,
erc
=
OK
,
local_minconn
;
/* Analyse de la table des connexions : */
/* Analyse de la table des connexions : */
Lim
=
g_TabObjNet
+
g_NbrObjNet
;
// pointe la fin de la liste
Lim
=
g_TabObjNet
+
g_NbrObjNet
;
// pointe la fin de la liste
ref_elect_type
=
NetItemRef
->
m_ElectricalType
;
ref_elect_type
=
NetItemRef
->
m_ElectricalType
;
NetItemTst
=
netstart
;
NetItemTst
=
netstart
;
...
@@ -644,7 +649,7 @@ static void TestOthersItems( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -644,7 +649,7 @@ static void TestOthersItems( WinEDA_DrawPanel* panel, wxDC* DC,
/* Est - on toujours dans le meme net ? */
/* Est - on toujours dans le meme net ? */
if
(
(
NetItemTst
>=
Lim
)
// fin de liste (donc fin de net)
if
(
(
NetItemTst
>=
Lim
)
// fin de liste (donc fin de net)
||
(
NetItemRef
->
GetNet
()
!=
NetItemTst
->
GetNet
()
)
)
// fin de net
||
(
NetItemRef
->
GetNet
()
!=
NetItemTst
->
GetNet
()
)
)
// fin de net
{
/* Fin de netcode trouve: Tst connexion minimum */
{
/* Fin de netcode trouve: Tst connexion minimum */
if
(
(
*
MinConnexion
<
NET_NC
)
if
(
(
*
MinConnexion
<
NET_NC
)
&&
(
local_minconn
<
NET_NC
)
)
/* pin non connect�e ou non pilotee */
&&
(
local_minconn
<
NET_NC
)
)
/* pin non connect�e ou non pilotee */
...
@@ -666,8 +671,8 @@ static void TestOthersItems( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -666,8 +671,8 @@ static void TestOthersItems( WinEDA_DrawPanel* panel, wxDC* DC,
case
NET_HIERBUSLABELMEMBER
:
case
NET_HIERBUSLABELMEMBER
:
case
NET_SHEETBUSLABELMEMBER
:
case
NET_SHEETBUSLABELMEMBER
:
case
NET_SHEETLABEL
:
case
NET_SHEETLABEL
:
case
NET_GLOBLABEL
:
case
NET_GLOBLABEL
:
case
NET_GLOBBUSLABELMEMBER
:
case
NET_GLOBBUSLABELMEMBER
:
case
NET_PINLABEL
:
case
NET_PINLABEL
:
break
;
break
;
...
@@ -681,7 +686,7 @@ static void TestOthersItems( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -681,7 +686,7 @@ static void TestOthersItems( WinEDA_DrawPanel* panel, wxDC* DC,
if
(
NetItemTst
<=
NetItemRef
)
if
(
NetItemTst
<=
NetItemRef
)
break
;
break
;
*
NetNbItems
+=
1
;
*
NetNbItems
+=
1
;
if
(
erc
==
OK
)
// 1 marqueur par pin maxi
if
(
erc
==
OK
)
// 1 marqueur par pin maxi
{
{
...
@@ -712,7 +717,7 @@ static bool WriteDiagnosticERC( const wxString& FullFileName )
...
@@ -712,7 +717,7 @@ static bool WriteDiagnosticERC( const wxString& FullFileName )
DrawMarkerStruct
*
Marker
;
DrawMarkerStruct
*
Marker
;
char
Line
[
256
];
char
Line
[
256
];
static
FILE
*
OutErc
;
static
FILE
*
OutErc
;
DrawSheetPath
*
Sheet
;
DrawSheetPath
*
Sheet
;
wxString
msg
;
wxString
msg
;
if
(
(
OutErc
=
wxFopen
(
FullFileName
,
wxT
(
"wt"
)
)
)
==
NULL
)
if
(
(
OutErc
=
wxFopen
(
FullFileName
,
wxT
(
"wt"
)
)
)
==
NULL
)
...
@@ -720,23 +725,26 @@ static bool WriteDiagnosticERC( const wxString& FullFileName )
...
@@ -720,23 +725,26 @@ static bool WriteDiagnosticERC( const wxString& FullFileName )
DateAndTime
(
Line
);
DateAndTime
(
Line
);
msg
=
_
(
"ERC control"
);
msg
=
_
(
"ERC control"
);
fprintf
(
OutErc
,
"%s (%s)
\n
"
,
CONV_TO_UTF8
(
msg
),
Line
);
fprintf
(
OutErc
,
"%s (%s)
\n
"
,
CONV_TO_UTF8
(
msg
),
Line
);
EDA_SheetList
SheetList
(
NULL
);
EDA_SheetList
SheetList
(
NULL
);
for
(
Sheet
=
SheetList
.
GetFirst
();
Sheet
!=
NULL
;
Sheet
=
SheetList
.
GetNext
()
)
for
(
Sheet
=
SheetList
.
GetFirst
();
Sheet
!=
NULL
;
Sheet
=
SheetList
.
GetNext
()
)
{
{
if
(
Sheet
->
Last
()
==
g_RootSheet
){
if
(
Sheet
->
Last
()
==
g_RootSheet
)
msg
.
Printf
(
_
(
"
\n
***** Sheet / (Root)
\n
"
)
);
{
}
else
{
msg
.
Printf
(
_
(
"
\n
***** Sheet / (Root)
\n
"
)
);
wxString
str
=
Sheet
->
PathHumanReadable
();
}
msg
.
Printf
(
_
(
"
\n
***** Sheet %s
\n
"
),
str
.
GetData
()
);
else
}
{
wxString
str
=
Sheet
->
PathHumanReadable
();
msg
.
Printf
(
_
(
"
\n
***** Sheet %s
\n
"
),
str
.
GetData
()
);
}
fprintf
(
OutErc
,
"%s"
,
CONV_TO_UTF8
(
msg
)
);
fprintf
(
OutErc
,
"%s"
,
CONV_TO_UTF8
(
msg
)
);
DrawStruct
=
Sheet
->
LastDrawList
();
DrawStruct
=
Sheet
->
LastDrawList
();
for
(
;
DrawStruct
!=
NULL
;
DrawStruct
=
DrawStruct
->
Pnext
)
for
(
;
DrawStruct
!=
NULL
;
DrawStruct
=
DrawStruct
->
Pnext
)
{
{
if
(
DrawStruct
->
Type
()
!=
DRAW_MARKER_STRUCT_TYPE
)
if
(
DrawStruct
->
Type
()
!=
DRAW_MARKER_STRUCT_TYPE
)
...
@@ -746,13 +754,13 @@ static bool WriteDiagnosticERC( const wxString& FullFileName )
...
@@ -746,13 +754,13 @@ static bool WriteDiagnosticERC( const wxString& FullFileName )
Marker
=
(
DrawMarkerStruct
*
)
DrawStruct
;
Marker
=
(
DrawMarkerStruct
*
)
DrawStruct
;
if
(
Marker
->
m_Type
!=
MARQ_ERC
)
if
(
Marker
->
m_Type
!=
MARQ_ERC
)
continue
;
continue
;
/* Write diag marqueur */
/* Write diag marqueur */
msg
.
Printf
(
_
(
"ERC: %s (X= %2.3f inches, Y= %2.3f inches
\n
"
),
msg
.
Printf
(
_
(
"ERC: %s (X= %2.3f inches, Y= %2.3f inches
\n
"
),
Marker
->
GetComment
().
GetData
(),
Marker
->
GetComment
().
GetData
(),
(
float
)
Marker
->
m_Pos
.
x
/
1000
,
(
float
)
Marker
->
m_Pos
.
x
/
1000
,
(
float
)
Marker
->
m_Pos
.
y
/
1000
);
(
float
)
Marker
->
m_Pos
.
y
/
1000
);
fprintf
(
OutErc
,
"%s"
,
CONV_TO_UTF8
(
msg
)
);
fprintf
(
OutErc
,
"%s"
,
CONV_TO_UTF8
(
msg
)
);
}
}
}
}
...
@@ -764,18 +772,24 @@ static bool WriteDiagnosticERC( const wxString& FullFileName )
...
@@ -764,18 +772,24 @@ static bool WriteDiagnosticERC( const wxString& FullFileName )
return
TRUE
;
return
TRUE
;
}
}
bool
TestLabel_
(
ObjetNetListStruct
*
a
,
ObjetNetListStruct
*
b
)
bool
TestLabel_
(
ObjetNetListStruct
*
a
,
ObjetNetListStruct
*
b
)
{
{
int
at
=
a
->
m_Type
;
int
at
=
a
->
m_Type
;
int
bt
=
b
->
m_Type
;
int
bt
=
b
->
m_Type
;
if
(
(
at
==
NET_HIERLABEL
||
at
==
NET_HIERBUSLABELMEMBER
)
&&
(
bt
==
NET_SHEETLABEL
||
bt
==
NET_SHEETBUSLABELMEMBER
)
){
if
(
(
at
==
NET_HIERLABEL
||
at
==
NET_HIERBUSLABELMEMBER
)
if
(
a
->
m_SheetList
==
b
->
m_SheetListInclude
){
&&
(
bt
==
NET_SHEETLABEL
||
bt
==
NET_SHEETBUSLABELMEMBER
)
)
return
true
;
//connected!
{
}
if
(
a
->
m_SheetList
==
b
->
m_SheetListInclude
)
}
{
return
false
;
//these two are unconnected
return
true
;
//connected!
}
}
return
false
;
//these two are unconnected
}
}
/***********************************************************************/
/***********************************************************************/
void
TestLabel
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
TestLabel
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
ObjetNetListStruct
*
NetItemRef
,
ObjetNetListStruct
*
StartNet
)
ObjetNetListStruct
*
NetItemRef
,
ObjetNetListStruct
*
StartNet
)
...
@@ -802,18 +816,20 @@ void TestLabel( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -802,18 +816,20 @@ void TestLabel( WinEDA_DrawPanel* panel, wxDC* DC,
/* Est - on toujours dans le meme net ? */
/* Est - on toujours dans le meme net ? */
if
(
(
NetItemTst
==
Lim
)
if
(
(
NetItemTst
==
Lim
)
||
(
NetItemRef
->
GetNet
()
!=
NetItemTst
->
GetNet
()
)
)
||
(
NetItemRef
->
GetNet
()
!=
NetItemTst
->
GetNet
()
)
)
{
{
/* Fin de netcode trouve */
/* Fin de netcode trouve */
if
(
erc
){
if
(
erc
)
{
/* GLabel ou SheetLabel orphelin */
/* GLabel ou SheetLabel orphelin */
Diagnose
(
panel
,
DC
,
NetItemRef
,
NULL
,
-
1
,
WAR
);
Diagnose
(
panel
,
DC
,
NetItemRef
,
NULL
,
-
1
,
WAR
);
}
}
return
;
return
;
}
}
if
(
TestLabel_
(
NetItemRef
,
NetItemTst
))
if
(
TestLabel_
(
NetItemRef
,
NetItemTst
)
)
erc
=
0
;
erc
=
0
;
//same thing, different order.
if
(
TestLabel_
(
NetItemTst
,
NetItemRef
))
//same thing, different order.
erc
=
0
;
if
(
TestLabel_
(
NetItemTst
,
NetItemRef
)
)
erc
=
0
;
}
}
}
}
eeschema/program.h
View file @
0f0ced37
...
@@ -76,7 +76,7 @@ public:
...
@@ -76,7 +76,7 @@ public:
public
:
public
:
EDA_DrawLineStruct
(
const
wxPoint
&
pos
,
int
layer
);
EDA_DrawLineStruct
(
const
wxPoint
&
pos
,
int
layer
);
~
EDA_DrawLineStruct
()
{
}
~
EDA_DrawLineStruct
()
{
}
virtual
wxString
GetClass
()
const
virtual
wxString
GetClass
()
const
{
{
return
wxT
(
"EDA_DrawLine"
);
return
wxT
(
"EDA_DrawLine"
);
...
@@ -92,19 +92,25 @@ public:
...
@@ -92,19 +92,25 @@ public:
}
}
/**
* Function GetBoundingBox
* returns the bounding box of this TRACK
*/
EDA_Rect
GetBoundingBox
()
const
;
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
int
Color
=
-
1
);
#if defined(DEBUG)
#if defined(DEBUG)
/**
/**
* Function Show
* Function Show
* is used to output the object tree, currently for debugging only.
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
* @param os The ostream& to output to.
*/
*/
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
#endif
#endif
};
};
...
@@ -129,16 +135,16 @@ public:
...
@@ -129,16 +135,16 @@ public:
wxString
GetComment
();
wxString
GetComment
();
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
int
draw_mode
,
int
Color
=
-
1
);
#if defined(DEBUG)
#if defined(DEBUG)
/**
/**
* Function Show
* Function Show
* is used to output the object tree, currently for debugging only.
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
* @param os The ostream& to output to.
*/
*/
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
#endif
#endif
};
};
...
@@ -177,7 +183,7 @@ public:
...
@@ -177,7 +183,7 @@ public:
public
:
public
:
DrawBusEntryStruct
(
const
wxPoint
&
pos
,
int
shape
,
int
id
);
DrawBusEntryStruct
(
const
wxPoint
&
pos
,
int
shape
,
int
id
);
~
DrawBusEntryStruct
()
{
}
~
DrawBusEntryStruct
()
{
}
virtual
wxString
GetClass
()
const
virtual
wxString
GetClass
()
const
{
{
return
wxT
(
"DrawBusEntry"
);
return
wxT
(
"DrawBusEntry"
);
...
@@ -201,7 +207,7 @@ public:
...
@@ -201,7 +207,7 @@ public:
public
:
public
:
DrawPolylineStruct
(
int
layer
);
DrawPolylineStruct
(
int
layer
);
~
DrawPolylineStruct
();
~
DrawPolylineStruct
();
virtual
wxString
GetClass
()
const
virtual
wxString
GetClass
()
const
{
{
return
wxT
(
"DrawPolyline"
);
return
wxT
(
"DrawPolyline"
);
...
@@ -222,7 +228,7 @@ public:
...
@@ -222,7 +228,7 @@ public:
public
:
public
:
DrawJunctionStruct
(
const
wxPoint
&
pos
);
DrawJunctionStruct
(
const
wxPoint
&
pos
);
~
DrawJunctionStruct
()
{
}
~
DrawJunctionStruct
()
{
}
virtual
wxString
GetClass
()
const
virtual
wxString
GetClass
()
const
{
{
return
wxT
(
"DrawJunction"
);
return
wxT
(
"DrawJunction"
);
...
...
eeschema/schedit.cpp
View file @
0f0ced37
...
@@ -478,6 +478,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -478,6 +478,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
MouseToCursorSchema
();
if
(
GetScreen
()
->
GetCurItem
()
->
m_Flags
==
0
)
if
(
GetScreen
()
->
GetCurItem
()
->
m_Flags
==
0
)
SaveCopyInUndoList
(
GetScreen
()
->
GetCurItem
(),
IS_CHANGED
);
SaveCopyInUndoList
(
GetScreen
()
->
GetCurItem
(),
IS_CHANGED
);
CmpRotationMiroir
(
CmpRotationMiroir
(
(
EDA_SchComponentStruct
*
)
GetScreen
()
->
GetCurItem
(),
(
EDA_SchComponentStruct
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
,
option
);
&
dc
,
option
);
...
@@ -497,6 +498,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -497,6 +498,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
GetScreen
()
)
);
GetScreen
()
)
);
if
(
GetScreen
()
->
GetCurItem
()
==
NULL
)
if
(
GetScreen
()
->
GetCurItem
()
==
NULL
)
break
;
break
;
EditComponentValue
(
EditComponentValue
(
(
EDA_SchComponentStruct
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
(
EDA_SchComponentStruct
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
break
;
break
;
...
@@ -510,6 +512,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -510,6 +512,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
GetScreen
()
)
);
GetScreen
()
)
);
if
(
GetScreen
()
->
GetCurItem
()
==
NULL
)
if
(
GetScreen
()
->
GetCurItem
()
==
NULL
)
break
;
break
;
EditComponentReference
(
EditComponentReference
(
(
EDA_SchComponentStruct
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
(
EDA_SchComponentStruct
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
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