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
e073bdc0
Commit
e073bdc0
authored
May 24, 2009
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pcbnew: cleaned code in ratsnet calculations (work in progress). The new code is also faster.
parent
8d604456
Changes
50
Hide whitespace changes
Inline
Side-by-side
Showing
50 changed files
with
905 additions
and
1049 deletions
+905
-1049
trackball.cpp
3d-viewer/trackball.cpp
+1
-2
CHANGELOG.txt
CHANGELOG.txt
+12
-0
CMakeLists.txt
common/CMakeLists.txt
+1
-0
base_struct.h
include/base_struct.h
+0
-1
pcbstruct.h
include/pcbstruct.h
+2
-2
wxPcbStruct.h
include/wxPcbStruct.h
+1
-3
ar_protos.h
pcbnew/ar_protos.h
+3
-3
autoplac.cpp
pcbnew/autoplac.cpp
+16
-16
autorout.cpp
pcbnew/autorout.cpp
+17
-17
autorout.h
pcbnew/autorout.h
+1
-66
block.cpp
pcbnew/block.cpp
+1
-1
board.cpp
pcbnew/board.cpp
+10
-14
class_board.cpp
pcbnew/class_board.cpp
+68
-96
class_board.h
pcbnew/class_board.h
+23
-20
class_board_item.cpp
pcbnew/class_board_item.cpp
+1
-10
class_equipot.cpp
pcbnew/class_equipot.cpp
+17
-50
class_equipot.h
pcbnew/class_equipot.h
+151
-57
class_netinfolist.cpp
pcbnew/class_netinfolist.cpp
+180
-0
class_track.cpp
pcbnew/class_track.cpp
+3
-3
class_zone.cpp
pcbnew/class_zone.cpp
+3
-3
clean.cpp
pcbnew/clean.cpp
+1
-2
connect.cpp
pcbnew/connect.cpp
+5
-30
dialog_copper_zones.cpp
pcbnew/dialog_copper_zones.cpp
+8
-17
dialog_drc.cpp
pcbnew/dialog_drc.cpp
+1
-1
dialog_pad_properties.cpp
pcbnew/dialog_pad_properties.cpp
+1
-1
drc.cpp
pcbnew/drc.cpp
+6
-6
edit.cpp
pcbnew/edit.cpp
+10
-3
editrack-part2.cpp
pcbnew/editrack-part2.cpp
+31
-32
export_gencad.cpp
pcbnew/export_gencad.cpp
+11
-10
files.cpp
pcbnew/files.cpp
+2
-1
globaleditpad.cpp
pcbnew/globaleditpad.cpp
+1
-2
ioascii.cpp
pcbnew/ioascii.cpp
+4
-4
librairi.cpp
pcbnew/librairi.cpp
+1
-1
loadcmp.cpp
pcbnew/loadcmp.cpp
+2
-2
modedit_onclick.cpp
pcbnew/modedit_onclick.cpp
+0
-1
modules.cpp
pcbnew/modules.cpp
+10
-11
move-drag_pads.cpp
pcbnew/move-drag_pads.cpp
+1
-2
onleftclick.cpp
pcbnew/onleftclick.cpp
+1
-1
onrightclick.cpp
pcbnew/onrightclick.cpp
+1
-2
ratsnest.cpp
pcbnew/ratsnest.cpp
+213
-425
router.cpp
pcbnew/router.cpp
+2
-2
solve.cpp
pcbnew/solve.cpp
+37
-37
specctra_export.cpp
pcbnew/specctra_export.cpp
+13
-12
specctra_import.cpp
pcbnew/specctra_import.cpp
+6
-6
surbrill.cpp
pcbnew/surbrill.cpp
+11
-14
tracepcb.cpp
pcbnew/tracepcb.cpp
+0
-6
undelete.cpp
pcbnew/undelete.cpp
+4
-4
work.cpp
pcbnew/work.cpp
+6
-6
xchgmod.cpp
pcbnew/xchgmod.cpp
+3
-3
zones_by_polygon.cpp
pcbnew/zones_by_polygon.cpp
+2
-41
No files found.
3d-viewer/trackball.cpp
View file @
e073bdc0
...
@@ -50,8 +50,7 @@
...
@@ -50,8 +50,7 @@
* Gavin Bell
* Gavin Bell
*/
*/
#include <math.h>
#include <math.h>
#include "fctsys.h" // used only to define GLfloat
#include "wx/glcanvas.h" // used only to define GLfloat
#include "3d_viewer.h" // used only to define GLfloat
#include "trackball.h"
#include "trackball.h"
/*
/*
...
...
CHANGELOG.txt
View file @
e073bdc0
...
@@ -4,6 +4,18 @@ KiCad ChangeLog 2009
...
@@ -4,6 +4,18 @@ KiCad ChangeLog 2009
Please add newer entries at the top, list the date and your name with
Please add newer entries at the top, list the date and your name with
email address.
email address.
2009-may-24 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++Pcbnew:
clean code in ratsnet calculations (work in progress)
The old code was very difficukt to understand, and was sometime very ugly.
Mainly, the list of nets (RATSNEST_ITEM class, formerly EQUIPOT class)
are now handled in a std::vector, and not a linked list.
This is better, because nets identifiers for pads and tracks are a number called netcode.
now, this is the index of the given net in this list, and the code to find a net given by its netcode
is very fast.
2009-may-12 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
2009-may-12 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
================================================================================
++All:
++All:
...
...
common/CMakeLists.txt
View file @
e073bdc0
...
@@ -57,6 +57,7 @@ set(PCB_COMMON_SRCS
...
@@ -57,6 +57,7 @@ set(PCB_COMMON_SRCS
../pcbnew/class_drc_item.cpp
../pcbnew/class_drc_item.cpp
../pcbnew/class_edge_mod.cpp
../pcbnew/class_edge_mod.cpp
../pcbnew/class_equipot.cpp
../pcbnew/class_equipot.cpp
../pcbnew/class_netinfolist.cpp
../pcbnew/class_marker.cpp
../pcbnew/class_marker.cpp
../pcbnew/class_mire.cpp
../pcbnew/class_mire.cpp
../pcbnew/class_module.cpp
../pcbnew/class_module.cpp
...
...
include/base_struct.h
View file @
e073bdc0
...
@@ -26,7 +26,6 @@ enum KICAD_T {
...
@@ -26,7 +26,6 @@ enum KICAD_T {
TYPE_PCB
,
TYPE_PCB
,
// Items in pcb
// Items in pcb
TYPE_EQUIPOT
,
TYPE_MODULE
,
TYPE_MODULE
,
TYPE_PAD
,
TYPE_PAD
,
TYPE_DRAWSEGMENT
,
TYPE_DRAWSEGMENT
,
...
...
include/pcbstruct.h
View file @
e073bdc0
...
@@ -123,9 +123,9 @@
...
@@ -123,9 +123,9 @@
#define EXTERNAL_LAYERS 0x00008001
#define EXTERNAL_LAYERS 0x00008001
/* Forward declaration */
/* Forward declaration */
class
EQUIPOT
;
class
NETINFO_ITEM
;
class
MARKER
;
class
MARKER
;
class
CHEVELU
;
class
RATSNEST_ITEM
;
//class Ki_PageDescr;
//class Ki_PageDescr;
//class DrawBlockStruct;
//class DrawBlockStruct;
...
...
include/wxPcbStruct.h
View file @
e073bdc0
...
@@ -286,8 +286,6 @@ public:
...
@@ -286,8 +286,6 @@ public:
void
Build_Board_Ratsnest
(
wxDC
*
DC
);
void
Build_Board_Ratsnest
(
wxDC
*
DC
);
void
DrawGeneralRatsnest
(
wxDC
*
DC
,
int
net_code
=
0
);
void
DrawGeneralRatsnest
(
wxDC
*
DC
,
int
net_code
=
0
);
void
trace_ratsnest_pad
(
wxDC
*
DC
);
void
trace_ratsnest_pad
(
wxDC
*
DC
);
void
recalcule_pad_net_code
();
/* compute and update the PAD net codes */
void
build_liste_pads
();
int
*
build_ratsnest_pad
(
EDA_BaseStruct
*
ref
,
int
*
build_ratsnest_pad
(
EDA_BaseStruct
*
ref
,
const
wxPoint
&
refpos
,
const
wxPoint
&
refpos
,
bool
init
);
bool
init
);
...
@@ -295,7 +293,7 @@ public:
...
@@ -295,7 +293,7 @@ public:
void
Tst_Ratsnest
(
wxDC
*
DC
,
int
ref_netcode
);
void
Tst_Ratsnest
(
wxDC
*
DC
,
int
ref_netcode
);
void
test_connexions
(
wxDC
*
DC
);
void
test_connexions
(
wxDC
*
DC
);
void
test_1_net_connexion
(
wxDC
*
DC
,
int
net_code
);
void
test_1_net_connexion
(
wxDC
*
DC
,
int
net_code
);
void
reattribution_reference_piste
(
int
affiche
);
void
RecalculateAllTracksNetcode
(
);
// Plotting
// Plotting
void
ToPlotter
(
wxCommandEvent
&
event
);
void
ToPlotter
(
wxCommandEvent
&
event
);
...
...
pcbnew/ar_protos.h
View file @
e073bdc0
...
@@ -59,8 +59,8 @@ void ReSetQueue( int, int, int, int, int, int, int );
...
@@ -59,8 +59,8 @@ void ReSetQueue( int, int, int, int, int, int, int );
/* WORK.CPP */
/* WORK.CPP */
void
InitWork
();
void
InitWork
();
void
ReInitWork
();
void
ReInitWork
();
int
SetWork
(
int
,
int
,
int
,
int
,
int
,
CHEVELU
*
,
int
);
int
SetWork
(
int
,
int
,
int
,
int
,
int
,
RATSNEST_ITEM
*
,
int
);
void
GetWork
(
int
*
,
int
*
,
int
*
,
int
*
,
int
*
,
CHEVELU
**
);
void
GetWork
(
int
*
,
int
*
,
int
*
,
int
*
,
int
*
,
RATSNEST_ITEM
**
);
void
SortWork
();
/* order the work items; shortest first */
void
SortWork
();
/* order the work items; shortest first */
/* DIST.CPP */
/* DIST.CPP */
...
@@ -69,7 +69,7 @@ int CalcDist( int, int, int ,int );
...
@@ -69,7 +69,7 @@ int CalcDist( int, int, int ,int );
/* BOARD.CPP */
/* BOARD.CPP */
bool
ComputeMatriceSize
(
WinEDA_BasePcbFrame
*
frame
,
int
pas_route
);
bool
ComputeMatriceSize
(
WinEDA_BasePcbFrame
*
frame
,
int
pas_route
);
int
Build_Work
(
BOARD
*
Pcb
,
CHEVELU
*
pt_chevelus
);
int
Build_Work
(
BOARD
*
Pcb
,
RATSNEST_ITEM
*
pt_chevelus
);
void
PlaceCells
(
BOARD
*
Pcb
,
int
net_code
,
int
flag
=
0
);
void
PlaceCells
(
BOARD
*
Pcb
,
int
net_code
,
int
flag
=
0
);
BoardCell
GetCell
(
int
,
int
,
int
);
BoardCell
GetCell
(
int
,
int
,
int
);
...
...
pcbnew/autoplac.cpp
View file @
e073bdc0
...
@@ -62,7 +62,7 @@ static void TracePenaliteRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, i
...
@@ -62,7 +62,7 @@ static void TracePenaliteRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, i
static
MODULE
*
PickModule
(
WinEDA_PcbFrame
*
pcbframe
,
wxDC
*
DC
);
static
MODULE
*
PickModule
(
WinEDA_PcbFrame
*
pcbframe
,
wxDC
*
DC
);
/* variables importees */
/* variables importees */
extern
CHEVELU
*
local_liste_chevelu
;
// adresse de base du buffer des chevelus locaux
extern
RATSNEST_ITEM
*
local_liste_chevelu
;
// adresse de base du buffer des chevelus locaux
extern
int
nb_local_chevelu
;
// nbr de links du module en deplacement
extern
int
nb_local_chevelu
;
// nbr de links du module en deplacement
...
@@ -315,7 +315,7 @@ end_of_tst:
...
@@ -315,7 +315,7 @@ end_of_tst:
/* Recalcul de la liste des pads, detruite par les calculs precedents */
/* Recalcul de la liste des pads, detruite par les calculs precedents */
GetBoard
()
->
m_Status_Pcb
=
0
;
GetBoard
()
->
m_Status_Pcb
=
0
;
build_liste_pads
();
GetBoard
()
->
Build_Pads_Full_List
();
DrawPanel
->
ReDraw
(
DC
,
TRUE
);
DrawPanel
->
ReDraw
(
DC
,
TRUE
);
...
@@ -607,7 +607,7 @@ int WinEDA_PcbFrame::RecherchePlacementModule( MODULE* Module, wxDC* DC )
...
@@ -607,7 +607,7 @@ int WinEDA_PcbFrame::RecherchePlacementModule( MODULE* Module, wxDC* DC )
g_Offset_Module
.
x
=
cx
-
CurrPosition
.
x
;
g_Offset_Module
.
x
=
cx
-
CurrPosition
.
x
;
g_Offset_Module
.
y
=
cy
-
CurrPosition
.
y
;
g_Offset_Module
.
y
=
cy
-
CurrPosition
.
y
;
GetBoard
()
->
m_Status_Pcb
&=
~
CHEVELU
_LOCAL_OK
;
GetBoard
()
->
m_Status_Pcb
&=
~
RATSNEST_ITEM
_LOCAL_OK
;
/* tst des pastilles traversantes, qui pour un circuit imprime ayant des
/* tst des pastilles traversantes, qui pour un circuit imprime ayant des
* composants des 2 cotes, peuvent tomber sur un composant de cote oppose:
* composants des 2 cotes, peuvent tomber sur un composant de cote oppose:
...
@@ -710,7 +710,7 @@ int WinEDA_PcbFrame::RecherchePlacementModule( MODULE* Module, wxDC* DC )
...
@@ -710,7 +710,7 @@ int WinEDA_PcbFrame::RecherchePlacementModule( MODULE* Module, wxDC* DC )
Module
->
m_RealBoundaryBox
.
m_Pos
.
y
=
oy
+
cy
;
Module
->
m_RealBoundaryBox
.
m_Pos
.
y
=
oy
+
cy
;
CurrPosition
=
LastPosOK
;
CurrPosition
=
LastPosOK
;
GetBoard
()
->
m_Status_Pcb
&=
~
(
CHEVELU
_LOCAL_OK
|
LISTE_PAD_OK
);
GetBoard
()
->
m_Status_Pcb
&=
~
(
RATSNEST_ITEM
_LOCAL_OK
|
LISTE_PAD_OK
);
MinCout
=
mincout
;
MinCout
=
mincout
;
return
error
;
return
error
;
...
@@ -866,14 +866,14 @@ float WinEDA_PcbFrame::Compute_Ratsnest_PlaceModule( wxDC* DC )
...
@@ -866,14 +866,14 @@ float WinEDA_PcbFrame::Compute_Ratsnest_PlaceModule( wxDC* DC )
* penalite pour les inclinaisons se rapprochant de 45 degre
* penalite pour les inclinaisons se rapprochant de 45 degre
*/
*/
{
{
CHEVELU
*
pt_local_chevelu
;
RATSNEST_ITEM
*
pt_local_chevelu
;
int
ii
;
int
ii
;
float
cout
,
icout
;
float
cout
,
icout
;
int
ox
,
oy
;
int
ox
,
oy
;
int
fx
,
fy
;
int
fx
,
fy
;
int
dx
,
dy
;
int
dx
,
dy
;
if
(
(
GetBoard
()
->
m_Status_Pcb
&
CHEVELU
_LOCAL_OK
)
==
0
)
if
(
(
GetBoard
()
->
m_Status_Pcb
&
RATSNEST_ITEM
_LOCAL_OK
)
==
0
)
return
-
1
;
return
-
1
;
pt_local_chevelu
=
local_liste_chevelu
;
pt_local_chevelu
=
local_liste_chevelu
;
...
@@ -882,12 +882,12 @@ float WinEDA_PcbFrame::Compute_Ratsnest_PlaceModule( wxDC* DC )
...
@@ -882,12 +882,12 @@ float WinEDA_PcbFrame::Compute_Ratsnest_PlaceModule( wxDC* DC )
while
(
ii
--
>
0
)
while
(
ii
--
>
0
)
{
{
if
(
!
(
pt_local_chevelu
->
status
&
LOCAL_CHEVELU
)
)
if
(
!
(
pt_local_chevelu
->
m_Status
&
LOCAL_RATSNEST_ITEM
)
)
{
{
ox
=
pt_local_chevelu
->
pad_s
tart
->
GetPosition
().
x
-
g_Offset_Module
.
x
;
ox
=
pt_local_chevelu
->
m_PadS
tart
->
GetPosition
().
x
-
g_Offset_Module
.
x
;
oy
=
pt_local_chevelu
->
pad_s
tart
->
GetPosition
().
y
-
g_Offset_Module
.
y
;
oy
=
pt_local_chevelu
->
m_PadS
tart
->
GetPosition
().
y
-
g_Offset_Module
.
y
;
fx
=
pt_local_chevelu
->
pad_e
nd
->
GetPosition
().
x
;
fx
=
pt_local_chevelu
->
m_PadE
nd
->
GetPosition
().
x
;
fy
=
pt_local_chevelu
->
pad_e
nd
->
GetPosition
().
y
;
fy
=
pt_local_chevelu
->
m_PadE
nd
->
GetPosition
().
y
;
if
(
AutoPlaceShowAll
)
if
(
AutoPlaceShowAll
)
{
{
...
@@ -962,7 +962,7 @@ void Build_PlacedPads_List( BOARD* aPcb )
...
@@ -962,7 +962,7 @@ void Build_PlacedPads_List( BOARD* aPcb )
}
}
aPcb
->
m_Status_Pcb
|=
LISTE_PAD_OK
;
aPcb
->
m_Status_Pcb
|=
LISTE_PAD_OK
;
aPcb
->
m_Status_Pcb
&=
~
(
LISTE_
CHEVELU_OK
|
CHEVELU
_LOCAL_OK
);
aPcb
->
m_Status_Pcb
&=
~
(
LISTE_
RATSNEST_ITEM_OK
|
RATSNEST_ITEM
_LOCAL_OK
);
}
}
...
@@ -1102,7 +1102,7 @@ static MODULE* PickModule( WinEDA_PcbFrame* pcbframe, wxDC* DC )
...
@@ -1102,7 +1102,7 @@ static MODULE* PickModule( WinEDA_PcbFrame* pcbframe, wxDC* DC )
{
{
MODULE
**
BaseListeModules
,
**
pt_Dmod
;
MODULE
**
BaseListeModules
,
**
pt_Dmod
;
MODULE
*
Module
=
NULL
,
*
AltModule
=
NULL
;
MODULE
*
Module
=
NULL
,
*
AltModule
=
NULL
;
CHEVELU
*
pt_local_chevelu
;
RATSNEST_ITEM
*
pt_local_chevelu
;
int
NbModules
,
ii
;
int
NbModules
,
ii
;
BaseListeModules
=
GenListeModules
(
pcbframe
->
GetBoard
(),
&
NbModules
);
BaseListeModules
=
GenListeModules
(
pcbframe
->
GetBoard
(),
&
NbModules
);
...
@@ -1122,7 +1122,7 @@ static MODULE* PickModule( WinEDA_PcbFrame* pcbframe, wxDC* DC )
...
@@ -1122,7 +1122,7 @@ static MODULE* PickModule( WinEDA_PcbFrame* pcbframe, wxDC* DC )
(
*
pt_Dmod
)
->
flag
=
0
;
(
*
pt_Dmod
)
->
flag
=
0
;
if
(
!
(
(
*
pt_Dmod
)
->
m_ModuleStatus
&
MODULE_to_PLACE
)
)
if
(
!
(
(
*
pt_Dmod
)
->
m_ModuleStatus
&
MODULE_to_PLACE
)
)
continue
;
continue
;
pcbframe
->
GetBoard
()
->
m_Status_Pcb
&=
~
CHEVELU
_LOCAL_OK
;
pcbframe
->
GetBoard
()
->
m_Status_Pcb
&=
~
RATSNEST_ITEM
_LOCAL_OK
;
(
*
pt_Dmod
)
->
DisplayInfo
(
pcbframe
);
(
*
pt_Dmod
)
->
DisplayInfo
(
pcbframe
);
pcbframe
->
build_ratsnest_module
(
DC
,
*
pt_Dmod
);
pcbframe
->
build_ratsnest_module
(
DC
,
*
pt_Dmod
);
...
@@ -1131,13 +1131,13 @@ static MODULE* PickModule( WinEDA_PcbFrame* pcbframe, wxDC* DC )
...
@@ -1131,13 +1131,13 @@ static MODULE* PickModule( WinEDA_PcbFrame* pcbframe, wxDC* DC )
ii
=
nb_local_chevelu
;
ii
=
nb_local_chevelu
;
while
(
ii
--
>
0
)
while
(
ii
--
>
0
)
{
{
if
(
(
pt_local_chevelu
->
status
&
LOCAL_CHEVELU
)
==
0
)
if
(
(
pt_local_chevelu
->
m_Status
&
LOCAL_RATSNEST_ITEM
)
==
0
)
(
*
pt_Dmod
)
->
flag
++
;
(
*
pt_Dmod
)
->
flag
++
;
pt_local_chevelu
++
;
pt_local_chevelu
++
;
}
}
}
}
pcbframe
->
GetBoard
()
->
m_Status_Pcb
&=
~
CHEVELU
_LOCAL_OK
;
pcbframe
->
GetBoard
()
->
m_Status_Pcb
&=
~
RATSNEST_ITEM
_LOCAL_OK
;
qsort
(
BaseListeModules
,
NbModules
,
sizeof
(
MODULE
*
*
),
qsort
(
BaseListeModules
,
NbModules
,
sizeof
(
MODULE
*
*
),
(
int
(
*
)(
const
void
*
,
const
void
*
)
)
Tri_RatsModules
);
(
int
(
*
)(
const
void
*
,
const
void
*
)
)
Tri_RatsModules
);
...
...
pcbnew/autorout.cpp
View file @
e073bdc0
...
@@ -34,7 +34,7 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
...
@@ -34,7 +34,7 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
/* init board, route traces*/
/* init board, route traces*/
{
{
int
ii
,
start
,
stop
;
int
ii
,
start
,
stop
;
CHEVELU
*
ptmp
;
RATSNEST_ITEM
*
ptmp
;
MODULE
*
Module
=
NULL
;
MODULE
*
Module
=
NULL
;
D_PAD
*
Pad
=
NULL
;
D_PAD
*
Pad
=
NULL
;
int
autoroute_net_code
=
-
1
;
int
autoroute_net_code
=
-
1
;
...
@@ -90,23 +90,23 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
...
@@ -90,23 +90,23 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
break
;
break
;
}
}
if
(
(
GetBoard
()
->
m_Status_Pcb
&
LISTE_
CHEVELU
_OK
)
==
0
)
if
(
(
GetBoard
()
->
m_Status_Pcb
&
LISTE_
RATSNEST_ITEM
_OK
)
==
0
)
Compile_Ratsnest
(
DC
,
TRUE
);
Compile_Ratsnest
(
DC
,
TRUE
);
/* Placement du flag CH_ROUTE_REQ sur les chevelus demandes */
/* Placement du flag CH_ROUTE_REQ sur les chevelus demandes */
ptmp
=
(
CHEVELU
*
)
GetBoard
()
->
m_Ratsnest
;
ptmp
=
(
RATSNEST_ITEM
*
)
GetBoard
()
->
m_Ratsnest
;
for
(
ii
=
GetBoard
()
->
GetNumRatsnests
();
ii
>
0
;
ii
--
,
ptmp
++
)
for
(
ii
=
GetBoard
()
->
GetNumRatsnests
();
ii
>
0
;
ii
--
,
ptmp
++
)
{
{
ptmp
->
s
tatus
&=
~
CH_ROUTE_REQ
;
ptmp
->
m_S
tatus
&=
~
CH_ROUTE_REQ
;
switch
(
mode
)
switch
(
mode
)
{
{
case
ROUTE_ALL
:
case
ROUTE_ALL
:
ptmp
->
s
tatus
|=
CH_ROUTE_REQ
;
break
;
ptmp
->
m_S
tatus
|=
CH_ROUTE_REQ
;
break
;
case
ROUTE_NET
:
case
ROUTE_NET
:
if
(
autoroute_net_code
==
ptmp
->
GetNet
()
)
if
(
autoroute_net_code
==
ptmp
->
GetNet
()
)
ptmp
->
s
tatus
|=
CH_ROUTE_REQ
;
ptmp
->
m_S
tatus
|=
CH_ROUTE_REQ
;
break
;
break
;
case
ROUTE_MODULE
:
case
ROUTE_MODULE
:
...
@@ -114,23 +114,23 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
...
@@ -114,23 +114,23 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
D_PAD
*
pt_pad
=
(
D_PAD
*
)
Module
->
m_Pads
;
D_PAD
*
pt_pad
=
(
D_PAD
*
)
Module
->
m_Pads
;
for
(
;
pt_pad
!=
NULL
;
pt_pad
=
pt_pad
->
Next
()
)
for
(
;
pt_pad
!=
NULL
;
pt_pad
=
pt_pad
->
Next
()
)
{
{
if
(
ptmp
->
pad_s
tart
==
pt_pad
)
if
(
ptmp
->
m_PadS
tart
==
pt_pad
)
ptmp
->
s
tatus
|=
CH_ROUTE_REQ
;
ptmp
->
m_S
tatus
|=
CH_ROUTE_REQ
;
if
(
ptmp
->
pad_e
nd
==
pt_pad
)
if
(
ptmp
->
m_PadE
nd
==
pt_pad
)
ptmp
->
s
tatus
|=
CH_ROUTE_REQ
;
ptmp
->
m_S
tatus
|=
CH_ROUTE_REQ
;
}
}
break
;
break
;
}
}
case
ROUTE_PAD
:
case
ROUTE_PAD
:
if
(
(
ptmp
->
pad_start
==
Pad
)
||
(
ptmp
->
pad_e
nd
==
Pad
)
)
if
(
(
ptmp
->
m_PadStart
==
Pad
)
||
(
ptmp
->
m_PadE
nd
==
Pad
)
)
ptmp
->
s
tatus
|=
CH_ROUTE_REQ
;
ptmp
->
m_S
tatus
|=
CH_ROUTE_REQ
;
break
;
break
;
}
}
}
}
ptmp
=
(
CHEVELU
*
)
GetBoard
()
->
m_Ratsnest
;
ptmp
=
(
RATSNEST_ITEM
*
)
GetBoard
()
->
m_Ratsnest
;
start
=
time
(
NULL
);
start
=
time
(
NULL
);
...
@@ -191,18 +191,18 @@ void WinEDA_PcbFrame::Reset_Noroutable( wxDC* DC )
...
@@ -191,18 +191,18 @@ void WinEDA_PcbFrame::Reset_Noroutable( wxDC* DC )
*/
*/
{
{
int
ii
;
int
ii
;
CHEVELU
*
pt_rats
;
RATSNEST_ITEM
*
pt_rats
;
if
(
(
GetBoard
()
->
m_Status_Pcb
&
LISTE_
CHEVELU
_OK
)
==
0
)
if
(
(
GetBoard
()
->
m_Status_Pcb
&
LISTE_
RATSNEST_ITEM
_OK
)
==
0
)
Compile_Ratsnest
(
DC
,
TRUE
);
Compile_Ratsnest
(
DC
,
TRUE
);
pt_rats
=
(
CHEVELU
*
)
GetBoard
()
->
m_Ratsnest
;
pt_rats
=
(
RATSNEST_ITEM
*
)
GetBoard
()
->
m_Ratsnest
;
if
(
pt_rats
==
NULL
)
if
(
pt_rats
==
NULL
)
return
;
return
;
for
(
ii
=
GetBoard
()
->
GetNumRatsnests
();
ii
>
0
;
ii
--
,
pt_rats
++
)
for
(
ii
=
GetBoard
()
->
GetNumRatsnests
();
ii
>
0
;
ii
--
,
pt_rats
++
)
{
{
pt_rats
->
s
tatus
&=
~
CH_UNROUTABLE
;
pt_rats
->
m_S
tatus
&=
~
CH_UNROUTABLE
;
}
}
}
}
...
...
pcbnew/autorout.h
View file @
e073bdc0
/****************************************************/
/****************************************************/
/* AUTOROUT.H */
/* AUTOROUT.H */
/* d
‚clarations communes relative au routage, DRC
*/
/* d
eclarations communes relative au routage
*/
/* et placement automatique des composants */
/* et placement automatique des composants */
/****************************************************/
/****************************************************/
...
@@ -14,74 +14,9 @@
...
@@ -14,74 +14,9 @@
#define ILLEGAL -1
#define ILLEGAL -1
/*****************************************************/
/* Structures de representation des pads et chevelus */
/* pour etablissement du chevelu general complet */
/*****************************************************/
/***********************************************/
/***********************************************/
/* description d'un segment de chevelu general */
/* description d'un segment de chevelu general */
/***********************************************/
/***********************************************/
/****************************/
/* bits d'etat du chevelu : */
/****************************/
#define CH_VISIBLE 1
/* affichage permanent demande */
#define CH_UNROUTABLE 2
/* non route par l'autorouteur */
#define CH_ROUTE_REQ 4
/* doit etre route par l'autorouteur */
#define CH_ACTIF 8
/* chevelu non encore routé */
#define LOCAL_CHEVELU 0x8000
/* indique un chevelu reliant 2 pins d'un meme
* module pour le calcul des chevelus relatifs a 1 seul module */
class
CHEVELU
{
private
:
int
m_NetCode
;
// numero de code du net ( = 0.. n , avec 0 si non connecte)
public
:
int
status
;
// etat: voir defines précédents (CH_ ...)
D_PAD
*
pad_start
;
// pointeur sur le pad de depart
D_PAD
*
pad_end
;
// pointeur sur le pad de fin
int
dist
;
// longeur du chevelu
/**
* Function GetNet
* @return int - the net code.
*/
int
GetNet
()
const
{
return
m_NetCode
;
}
void
SetNet
(
int
aNetCode
)
{
m_NetCode
=
aNetCode
;
}
};
/****************************************************************/
/* description d'un point de piste pour le suivi des connexions */
/****************************************************************/
#define START_ON_PAD 0x10
#define END_ON_PAD 0x20
#define START_ON_TRACK 0x40
#define END_ON_TRACK 0x80
//#define START_EQU_VIA 0x10
//#define END_EQU_VIA 0x20
/* Status bit (OR'ed bits) for class BOARD member .m_Status_Pcb */
enum
StatusPcbFlags
{
LISTE_PAD_OK
=
1
,
/* Pad list is Ok */
LISTE_CHEVELU_OK
=
2
,
/* General Rastnest is Ok */
CHEVELU_LOCAL_OK
=
4
,
/* current MODULE rastnest is Ok */
CONNEXION_OK
=
8
,
/* Bit indicant que la liste des connexions existe */
NET_CODES_OK
=
0x10
,
/* Bit indicant que les netcodes sont OK ( pas de modif
* de noms de net */
DO_NOT_SHOW_GENERAL_RASTNEST
=
0x20
/* Do not display the general rastnest (used in module moves) */
};
/* Commandes d'autoplacement / autorouage possibles */
/* Commandes d'autoplacement / autorouage possibles */
enum
CommandOpt
{
enum
CommandOpt
{
...
...
pcbnew/block.cpp
View file @
e073bdc0
...
@@ -578,7 +578,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
...
@@ -578,7 +578,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
else
else
{
{
m_Pcb
->
m_Status_Pcb
=
0
;
/* we need (later) a full ratnest computation */
m_Pcb
->
m_Status_Pcb
=
0
;
/* we need (later) a full ratnest computation */
build_liste_pads
();
m_Pcb
->
Build_Pads_Full_List
();
}
}
}
}
...
...
pcbnew/board.cpp
View file @
e073bdc0
/************************************************/
/* Fichier BOARD.CPP : functions for autorouting */
/* EDITEUR de PCB: AUTOROUTAGE: routines d'init */
/************************************************/
/* Fichier BOARD.CC */
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "gr_basic.h"
...
@@ -18,7 +14,7 @@
...
@@ -18,7 +14,7 @@
/* routines externes : */
/* routines externes : */
/* Routines definies ici: */
/* Routines definies ici: */
int
Build_Work
(
BOARD
*
Pcb
,
CHEVELU
*
pt_base_chevelu
);
int
Build_Work
(
BOARD
*
Pcb
,
RATSNEST_ITEM
*
pt_base_chevelu
);
void
PlaceCells
(
BOARD
*
Pcb
,
int
net_code
,
int
flag
);
void
PlaceCells
(
BOARD
*
Pcb
,
int
net_code
,
int
flag
);
int
InitBoard
();
int
InitBoard
();
BoardCell
GetCell
(
int
,
int
,
int
);
BoardCell
GetCell
(
int
,
int
,
int
);
...
@@ -340,15 +336,15 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
...
@@ -340,15 +336,15 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
/******************************************************/
/******************************************************/
int
Build_Work
(
BOARD
*
Pcb
,
CHEVELU
*
pt_base_chevelu
)
int
Build_Work
(
BOARD
*
Pcb
,
RATSNEST_ITEM
*
pt_base_chevelu
)
/*****************************************************/
/*****************************************************/
/* Build liste conn */
/* Build liste conn */
{
{
int
ii
;
int
ii
;
CHEVELU
*
pt_rats
=
pt_base_chevelu
;
RATSNEST_ITEM
*
pt_rats
=
pt_base_chevelu
;
D_PAD
*
pt_pad
;
D_PAD
*
pt_pad
;
int
r1
,
r2
,
c1
,
c2
,
current_net_code
;
int
r1
,
r2
,
c1
,
c2
,
current_net_code
;
CHEVELU
*
pt_ch
;
RATSNEST_ITEM
*
pt_ch
;
int
demi_pas
=
g_GridRoutingSize
/
2
;
int
demi_pas
=
g_GridRoutingSize
/
2
;
wxString
msg
;
wxString
msg
;
...
@@ -357,13 +353,13 @@ int Build_Work( BOARD* Pcb, CHEVELU* pt_base_chevelu )
...
@@ -357,13 +353,13 @@ int Build_Work( BOARD* Pcb, CHEVELU* pt_base_chevelu )
for
(
ii
=
Pcb
->
GetNumRatsnests
();
ii
>
0
;
ii
--
,
pt_rats
++
)
for
(
ii
=
Pcb
->
GetNumRatsnests
();
ii
>
0
;
ii
--
,
pt_rats
++
)
{
{
/* On ne route que les chevelus actifs et routables */
/* On ne route que les chevelus actifs et routables */
if
(
(
pt_rats
->
s
tatus
&
CH_ACTIF
)
==
0
)
if
(
(
pt_rats
->
m_S
tatus
&
CH_ACTIF
)
==
0
)
continue
;
continue
;
if
(
pt_rats
->
s
tatus
&
CH_UNROUTABLE
)
if
(
pt_rats
->
m_S
tatus
&
CH_UNROUTABLE
)
continue
;
continue
;
if
(
(
pt_rats
->
s
tatus
&
CH_ROUTE_REQ
)
==
0
)
if
(
(
pt_rats
->
m_S
tatus
&
CH_ROUTE_REQ
)
==
0
)
continue
;
continue
;
pt_pad
=
pt_rats
->
pad_s
tart
;
pt_pad
=
pt_rats
->
m_PadS
tart
;
current_net_code
=
pt_pad
->
GetNet
();
current_net_code
=
pt_pad
->
GetNet
();
pt_ch
=
pt_rats
;
pt_ch
=
pt_rats
;
...
@@ -385,7 +381,7 @@ int Build_Work( BOARD* Pcb, CHEVELU* pt_base_chevelu )
...
@@ -385,7 +381,7 @@ int Build_Work( BOARD* Pcb, CHEVELU* pt_base_chevelu )
return
0
;
return
0
;
}
}
pt_pad
=
pt_rats
->
pad_e
nd
;
pt_pad
=
pt_rats
->
m_PadE
nd
;
r2
=
(
pt_pad
->
GetPosition
().
y
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
y
+
demi_pas
)
/
g_GridRoutingSize
;
r2
=
(
pt_pad
->
GetPosition
().
y
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
y
+
demi_pas
)
/
g_GridRoutingSize
;
if
(
r2
<
0
||
r2
>=
Nrows
)
if
(
r2
<
0
||
r2
>=
Nrows
)
...
...
pcbnew/class_board.cpp
View file @
e073bdc0
...
@@ -33,7 +33,8 @@ BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) :
...
@@ -33,7 +33,8 @@ BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) :
m_Ratsnest
=
NULL
;
// pointeur liste rats
m_Ratsnest
=
NULL
;
// pointeur liste rats
m_LocalRatsnest
=
NULL
;
// pointeur liste rats local
m_LocalRatsnest
=
NULL
;
// pointeur liste rats local
m_CurrentZoneContour
=
NULL
;
// This ZONE_CONTAINER handle the zone contour cuurently in progress
m_CurrentZoneContour
=
NULL
;
// This ZONE_CONTAINER handle the zone contour cuurently in progress
// de determination des contours de zone
m_NetInfo
=
new
NETINFO_LIST
(
this
)
;
// handle nets info list (name, design constraints ..
for
(
int
layer
=
0
;
layer
<
NB_COPPER_LAYERS
;
++
layer
)
for
(
int
layer
=
0
;
layer
<
NB_COPPER_LAYERS
;
++
layer
)
{
{
...
@@ -65,6 +66,8 @@ BOARD::~BOARD()
...
@@ -65,6 +66,8 @@ BOARD::~BOARD()
delete
m_CurrentZoneContour
;
delete
m_CurrentZoneContour
;
m_CurrentZoneContour
=
NULL
;
m_CurrentZoneContour
=
NULL
;
delete
m_NetInfo
;
}
}
...
@@ -239,15 +242,7 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
...
@@ -239,15 +242,7 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
aBoardItem
->
SetParent
(
this
);
aBoardItem
->
SetParent
(
this
);
break
;
break
;
case
TYPE_EQUIPOT
:
// other types may use linked list
if
(
aControl
&
ADD_APPEND
)
m_Equipots
.
PushBack
(
(
EQUIPOT
*
)
aBoardItem
);
else
m_Equipots
.
PushFront
(
(
EQUIPOT
*
)
aBoardItem
);
aBoardItem
->
SetParent
(
this
);
break
;
// other types may use linked list
default
:
default
:
wxFAIL_MSG
(
wxT
(
"BOARD::Add() needs work: BOARD_ITEM type not handled"
)
);
wxFAIL_MSG
(
wxT
(
"BOARD::Add() needs work: BOARD_ITEM type not handled"
)
);
}
}
...
@@ -306,10 +301,6 @@ BOARD_ITEM* BOARD::Remove( BOARD_ITEM* aBoardItem )
...
@@ -306,10 +301,6 @@ BOARD_ITEM* BOARD::Remove( BOARD_ITEM* aBoardItem )
m_Drawings
.
Remove
(
aBoardItem
);
m_Drawings
.
Remove
(
aBoardItem
);
break
;
break
;
case
TYPE_EQUIPOT
:
m_Equipots
.
Remove
(
(
EQUIPOT
*
)
aBoardItem
);
break
;
// other types may use linked list
// other types may use linked list
default
:
default
:
wxFAIL_MSG
(
wxT
(
"BOARD::Remove() needs more ::Type() support"
)
);
wxFAIL_MSG
(
wxT
(
"BOARD::Remove() needs more ::Type() support"
)
);
...
@@ -534,7 +525,7 @@ void BOARD::DisplayInfo( WinEDA_DrawFrame* frame )
...
@@ -534,7 +525,7 @@ void BOARD::DisplayInfo( WinEDA_DrawFrame* frame )
txt
.
Printf
(
wxT
(
"%d"
),
m_NbLinks
);
txt
.
Printf
(
wxT
(
"%d"
),
m_NbLinks
);
Affiche_1_Parametre
(
frame
,
POS_AFF_NBLINKS
,
_
(
"Links"
),
txt
,
DARKGREEN
);
Affiche_1_Parametre
(
frame
,
POS_AFF_NBLINKS
,
_
(
"Links"
),
txt
,
DARKGREEN
);
txt
.
Printf
(
wxT
(
"%d"
),
m_
Equipots
.
GetCount
()
);
txt
.
Printf
(
wxT
(
"%d"
),
m_
NetInfo
->
GetCount
()
);
Affiche_1_Parametre
(
frame
,
POS_AFF_NBNETS
,
_
(
"Nets"
),
txt
,
RED
);
Affiche_1_Parametre
(
frame
,
POS_AFF_NBNETS
,
_
(
"Nets"
),
txt
,
RED
);
txt
.
Printf
(
wxT
(
"%d"
),
m_NbLinks
-
GetNumNoconnect
()
);
txt
.
Printf
(
wxT
(
"%d"
),
m_NbLinks
-
GetNumNoconnect
()
);
...
@@ -683,11 +674,6 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
...
@@ -683,11 +674,6 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
++
p
;
++
p
;
break
;
break
;
case
TYPE_EQUIPOT
:
result
=
IterateForward
(
m_Equipots
,
inspector
,
testData
,
p
);
++
p
;
break
;
case
TYPE_ZONE
:
case
TYPE_ZONE
:
result
=
IterateForward
(
m_Zone
,
inspector
,
testData
,
p
);
result
=
IterateForward
(
m_Zone
,
inspector
,
testData
,
p
);
++
p
;
++
p
;
...
@@ -794,18 +780,12 @@ BOARD_ITEM* BOARD::FindPadOrModule( const wxPoint& refPos, int layer )
...
@@ -794,18 +780,12 @@ BOARD_ITEM* BOARD::FindPadOrModule( const wxPoint& refPos, int layer )
* @param anetcode The netcode to search for.
* @param anetcode The netcode to search for.
* @return EQUIPOT* - the net or NULL if not found.
* @return EQUIPOT* - the net or NULL if not found.
*/
*/
EQUIPOT
*
BOARD
::
FindNet
(
int
anetcode
)
const
NETINFO_ITEM
*
BOARD
::
FindNet
(
int
anetcode
)
const
{
{
// the first valid netcode is 1.
// the first valid netcode is 1.
// zero is reserved for "no connection" and is not used.
// zero is reserved for "no connection" and is not used.
if
(
anetcode
>
0
)
if
(
anetcode
>
0
)
{
return
m_NetInfo
->
GetItem
(
anetcode
);
for
(
EQUIPOT
*
net
=
m_Equipots
;
net
;
net
=
net
->
Next
()
)
{
if
(
net
->
GetNet
()
==
anetcode
)
return
net
;
}
}
return
NULL
;
return
NULL
;
}
}
...
@@ -816,16 +796,16 @@ EQUIPOT* BOARD::FindNet( int anetcode ) const
...
@@ -816,16 +796,16 @@ EQUIPOT* BOARD::FindNet( int anetcode ) const
* @param aNetname A Netname to search for.
* @param aNetname A Netname to search for.
* @return EQUIPOT* - the net or NULL if not found.
* @return EQUIPOT* - the net or NULL if not found.
*/
*/
EQUIPOT
*
BOARD
::
FindNet
(
const
wxString
&
aNetname
)
const
NETINFO_ITEM
*
BOARD
::
FindNet
(
const
wxString
&
aNetname
)
const
{
{
// the first valid netcode is 1.
// the first valid netcode is 1.
// zero is reserved for "no connection" and is not used.
// zero is reserved for "no connection" and is not used.
if
(
!
aNetname
.
IsEmpty
()
)
if
(
!
aNetname
.
IsEmpty
()
)
{
{
for
(
EQUIPOT
*
net
=
m_Equipots
;
net
;
net
=
net
->
Next
()
)
for
(
unsigned
ii
=
1
;
ii
<
m_NetInfo
->
GetCount
();
ii
++
)
{
{
if
(
net
->
GetNetname
()
==
aNetname
)
if
(
m_NetInfo
->
GetItem
(
ii
)
->
GetNetname
()
==
aNetname
)
return
net
;
return
m_NetInfo
->
GetItem
(
ii
)
;
}
}
}
}
return
NULL
;
return
NULL
;
...
@@ -865,81 +845,40 @@ MODULE* BOARD::FindModuleByReference( const wxString& aReference ) const
...
@@ -865,81 +845,40 @@ MODULE* BOARD::FindModuleByReference( const wxString& aReference ) const
}
}
/* Two sort functions used in BOARD::ReturnSortedNetnamesList */
// Sort nets by name
int
s_SortByNames
(
const
void
*
ptr1
,
const
void
*
ptr2
)
{
EQUIPOT
*
item1
=
*
(
EQUIPOT
**
)
ptr1
;
EQUIPOT
*
item2
=
*
(
EQUIPOT
**
)
ptr2
;
return
item1
->
GetNetname
().
CmpNoCase
(
item2
->
GetNetname
());
}
// Sort nets by decreasing pad count
// Sort nets by decreasing pad count
int
s_SortByNodes
(
const
void
*
ptr1
,
const
void
*
ptr2
)
static
bool
s_SortByNodes
(
const
NETINFO_ITEM
*
a
,
const
NETINFO_ITEM
*
b
)
{
{
EQUIPOT
*
item1
=
*
(
EQUIPOT
**
)
ptr1
;
return
a
->
GetNodesCount
()
<
b
->
GetNodesCount
();
EQUIPOT
*
item2
=
*
(
EQUIPOT
**
)
ptr2
;
if
(
(
item1
->
m_NbNodes
-
item2
->
m_NbNodes
)
!=
0
)
return
-
(
item1
->
m_NbNodes
-
item2
->
m_NbNodes
);
return
item1
->
GetNetname
().
CmpNoCase
(
item2
->
GetNetname
());
}
}
/**
/**
* Function ReturnSortedNetnamesList
* Function ReturnSortedNetnamesList
* searches for a net with the given netcode.
* @param aNames An array string to fill with net names.
* @param aNames An array string to fill with net names.
* @param aSort
_Type : NO_SORT = no sort, ALPHA_SORT = sort by alphabetic order, PAD_CNT_SORT = sort by active pads count.
* @param aSort
byPadsCount : true = sort by active pads count, false = no sort (i.e. leave the sort by net names)
* @return int - net names count.
* @return int - net names count.
*/
*/
int
BOARD
::
ReturnSortedNetnamesList
(
wxArrayString
&
aNames
,
const
int
aSort_Type
)
int
BOARD
::
ReturnSortedNetnamesList
(
wxArrayString
&
aNames
,
bool
aSortbyPadsCount
)
{
{
int
NetCount
=
0
;
if
(
m_NetInfo
->
GetCount
()
==
0
)
return
0
;
int
ii
;
EQUIPOT
*
net
;
/* count items to list and sort */
for
(
net
=
m_Equipots
;
net
;
net
=
net
->
Next
()
)
{
if
(
net
->
GetNetname
().
IsEmpty
()
)
continue
;
NetCount
++
;
}
if
(
NetCount
==
0
)
return
0
;
/* Build the list */
/* Build the list */
EQUIPOT
*
*
net_ptr_list
=
(
EQUIPOT
*
*
)
MyMalloc
(
NetCount
*
sizeof
(
*
net_ptr_list
)
);
std
::
vector
<
NETINFO_ITEM
*>
netBuffer
;
for
(
ii
=
0
,
net
=
m_Equipots
;
net
;
net
=
net
->
Next
()
)
netBuffer
.
reserve
(
m_NetInfo
->
GetCount
());
for
(
unsigned
ii
=
1
;
ii
<
m_NetInfo
->
GetCount
();
ii
++
)
{
{
if
(
net
->
GetNetname
().
IsEmpty
()
)
continue
;
if
(
m_NetInfo
->
GetItem
(
ii
)
->
GetNet
()
>
0
)
net_ptr_list
[
ii
]
=
net
;
netBuffer
.
push_back
(
m_NetInfo
->
GetItem
(
ii
));
ii
++
;
}
}
/* sort the list */
/* sort the list */
switch
(
aSort_Type
)
if
(
aSortbyPadsCount
)
{
sort
(
netBuffer
.
begin
(),
netBuffer
.
end
(),
s_SortByNodes
);
case
NO_SORT
:
break
;
case
ALPHA_SORT
:
for
(
unsigned
ii
=
0
;
ii
<
netBuffer
.
size
();
ii
++
)
qsort
(
net_ptr_list
,
NetCount
,
sizeof
(
EQUIPOT
*
),
s_SortByNames
);
aNames
.
Add
(
netBuffer
[
ii
]
->
GetNetname
());
break
;
case
PAD_CNT_SORT
:
return
netBuffer
.
size
();
qsort
(
net_ptr_list
,
NetCount
,
sizeof
(
EQUIPOT
*
),
s_SortByNodes
);
break
;
}
/* fill the given list */
for
(
ii
=
0
;
ii
<
NetCount
;
ii
++
)
{
net
=
net_ptr_list
[
ii
];
aNames
.
Add
(
net
->
GetNetname
());
}
MyFree
(
net_ptr_list
);
return
NetCount
;
}
}
/************************************/
/************************************/
...
@@ -950,8 +889,8 @@ bool BOARD::Save( FILE* aFile ) const
...
@@ -950,8 +889,8 @@ bool BOARD::Save( FILE* aFile ) const
BOARD_ITEM
*
item
;
BOARD_ITEM
*
item
;
// save the nets
// save the nets
for
(
item
=
m_Equipots
;
item
;
item
=
item
->
Next
()
)
for
(
unsigned
ii
=
0
;
ii
<
m_NetInfo
->
GetCount
();
ii
++
)
if
(
!
item
->
Save
(
aFile
)
)
if
(
!
m_NetInfo
->
GetItem
(
ii
)
->
Save
(
aFile
)
)
goto
out
;
goto
out
;
// save the modules
// save the modules
...
@@ -1084,6 +1023,45 @@ ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos, int aSt
...
@@ -1084,6 +1023,45 @@ ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos, int aSt
return
NULL
;
return
NULL
;
}
}
/**
* Function SetAreasNetCodesFromNetNames
* Set the .m_NetCode member of all copper areas, according to the area Net Name
* The SetNetCodesFromNetNames is an equivalent to net name, for fast comparisons.
* However the Netcode is an arbitrary equivalence, it must be set after each netlist read
* or net change
* Must be called after pad netcodes are calculated
* @return : error count
* For non copper areas, netcode is set to 0
*/
int
BOARD
::
SetAreasNetCodesFromNetNames
(
void
)
{
int
error_count
=
0
;
for
(
int
ii
=
0
;
ii
<
GetAreaCount
();
ii
++
)
{
if
(
!
GetArea
(
ii
)
->
IsOnCopperLayer
()
)
{
GetArea
(
ii
)
->
SetNet
(
0
);
continue
;
}
if
(
GetArea
(
ii
)
->
GetNet
()
!=
0
)
// i.e. if this zone is connected to a net
{
const
NETINFO_ITEM
*
net
=
FindNet
(
GetArea
(
ii
)
->
m_Netname
);
if
(
net
)
{
GetArea
(
ii
)
->
SetNet
(
net
->
GetNet
()
);
}
else
{
error_count
++
;
GetArea
(
ii
)
->
SetNet
(
-
1
);
//keep Net Name ane set m_NetCode to -1 : error flag
}
}
}
return
error_count
;
}
#if defined(DEBUG)
#if defined(DEBUG)
...
@@ -1115,12 +1093,6 @@ void BOARD::Show( int nestLevel, std::ostream& os )
...
@@ -1115,12 +1093,6 @@ void BOARD::Show( int nestLevel, std::ostream& os )
p
->
Show
(
nestLevel
+
2
,
os
);
p
->
Show
(
nestLevel
+
2
,
os
);
NestedSpace
(
nestLevel
+
1
,
os
)
<<
"</pdrawings>
\n
"
;
NestedSpace
(
nestLevel
+
1
,
os
)
<<
"</pdrawings>
\n
"
;
NestedSpace
(
nestLevel
+
1
,
os
)
<<
"<nets>
\n
"
;
p
=
m_Equipots
;
for
(
;
p
;
p
=
p
->
Next
()
)
p
->
Show
(
nestLevel
+
2
,
os
);
NestedSpace
(
nestLevel
+
1
,
os
)
<<
"</nets>
\n
"
;
NestedSpace
(
nestLevel
+
1
,
os
)
<<
"<tracks>
\n
"
;
NestedSpace
(
nestLevel
+
1
,
os
)
<<
"<tracks>
\n
"
;
p
=
m_Track
;
p
=
m_Track
;
for
(
;
p
;
p
=
p
->
Next
()
)
for
(
;
p
;
p
=
p
->
Next
()
)
...
...
pcbnew/class_board.h
View file @
e073bdc0
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#include "dlist.h"
#include "dlist.h"
#include "class_equipot.h"
class
ZONE_CONTAINER
;
class
ZONE_CONTAINER
;
...
@@ -86,21 +87,19 @@ public:
...
@@ -86,21 +87,19 @@ public:
EDA_BoardDesignSettings
*
m_BoardSettings
;
// Link to current design settings
EDA_BoardDesignSettings
*
m_BoardSettings
;
// Link to current design settings
int
m_NbNodes
;
// Active pads (pads attached to a net ) count
int
m_NbNodes
;
// Active pads (pads attached to a net ) count
int
m_NbLinks
;
// Ratsnest count
int
m_NbLinks
;
// Ratsnest count
int
m_NbLoclinks
;
//
Ratsest
s to show while creating a track
int
m_NbLoclinks
;
//
Number of ratsnests from mouse cursor to pad
s to show while creating a track
int
m_NbNoconnect
;
// Active ratsnet count (rastnest
not alraedy connected by tracks
int
m_NbNoconnect
;
// Active ratsnet count (rastnest
s not alraedy connected by tracks)
DLIST
<
BOARD_ITEM
>
m_Drawings
;
// linked list of lines & texts
DLIST
<
BOARD_ITEM
>
m_Drawings
;
// linked list of lines & texts
DLIST
<
MODULE
>
m_Modules
;
// linked list of MODULEs
DLIST
<
MODULE
>
m_Modules
;
// linked list of MODULEs
DLIST
<
EQUIPOT
>
m_Equipots
;
// linked list of nets
DLIST
<
TRACK
>
m_Track
;
// linked list of TRACKs and SEGVIAs
DLIST
<
TRACK
>
m_Track
;
// linked list of TRACKs and SEGVIAs
DLIST
<
SEGZONE
>
m_Zone
;
// linked list of SEGZONEs
DLIST
<
SEGZONE
>
m_Zone
;
// linked list of SEGZONEs
std
::
vector
<
D_PAD
*>
m_Pads
;
// Entry for a sorted pad list (used in ratsnest calculations)
std
::
vector
<
D_PAD
*>
m_Pads
;
// Entry for a sorted pad list (used in ratsnest calculations)
NETINFO_LIST
*
m_NetInfo
;
// nets info list (name, design constraints ..
CHEVELU
*
m_Ratsnest
;
// Rastnest list
RATSNEST_ITEM
*
m_Ratsnest
;
// Rastnest list
CHEVELU
*
m_LocalRatsnest
;
// Rastnest list used while moving a footprint
RATSNEST_ITEM
*
m_LocalRatsnest
;
// Rastnest list used while moving a footprint
ZONE_CONTAINER
*
m_CurrentZoneContour
;
// zone contour currently in progress
ZONE_CONTAINER
*
m_CurrentZoneContour
;
// zone contour currently in progress
...
@@ -247,6 +246,17 @@ public:
...
@@ -247,6 +246,17 @@ public:
int
GetNumNodes
();
// retourne le nombre de pads a netcode > 0
int
GetNumNodes
();
// retourne le nombre de pads a netcode > 0
/** Function Build_Pads_Full_List
* Create the pad list
* initialise:
* m_Pads (list of pads)
* m_NbNodes = 0
* set m_Status_Pcb = LISTE_PAD_OK;
* and clear for all pads the m_SubRatsnest member;
* delete ( free memory) m_Pcb->m_Ratsnest and set m_Pcb->m_Ratsnest to NULL
*/
void
Build_Pads_Full_List
();
// Calcul du rectangle d'encadrement:
// Calcul du rectangle d'encadrement:
bool
ComputeBoundaryBox
();
bool
ComputeBoundaryBox
();
...
@@ -294,17 +304,17 @@ public:
...
@@ -294,17 +304,17 @@ public:
* Function FindNet
* Function FindNet
* searches for a net with the given netcode.
* searches for a net with the given netcode.
* @param aNetcode A netcode to search for.
* @param aNetcode A netcode to search for.
* @return
EQUIPOT
* - the net or NULL if not found.
* @return
NETINFO_ITEM_ITEM
* - the net or NULL if not found.
*/
*/
EQUIPOT
*
FindNet
(
int
aNetcode
)
const
;
NETINFO_ITEM
*
FindNet
(
int
aNetcode
)
const
;
/**
/**
* Function FindNet overlayed
* Function FindNet overlayed
* searches for a net with the given name.
* searches for a net with the given name.
* @param aNetname A Netname to search for.
* @param aNetname A Netname to search for.
* @return
EQUIPOT
* - the net or NULL if not found.
* @return
NETINFO_ITEM
* - the net or NULL if not found.
*/
*/
EQUIPOT
*
FindNet
(
const
wxString
&
aNetname
)
const
;
NETINFO_ITEM
*
FindNet
(
const
wxString
&
aNetname
)
const
;
/**
/**
* Function FindModuleByReference
* Function FindModuleByReference
...
@@ -319,18 +329,11 @@ public:
...
@@ -319,18 +329,11 @@ public:
/**
/**
* Function ReturnSortedNetnamesList
* Function ReturnSortedNetnamesList
* searches for a net with the given netcode.
* @param aNames An array string to fill with net names.
* @param aNames An array string to fill with net names.
* @param aSort
_Type : NO_SORT = no sort, ALPHA_SORT = sort by alphabetic order, PAD_CNT_SORT = sort by active pads count.
* @param aSort
byPadsCount : true = sort by active pads count, false = no sort (i.e. leave the sort by net names)
* @return int - net names count.
* @return int - net names count.
*/
*/
enum
netname_sort_type
{
int
ReturnSortedNetnamesList
(
wxArrayString
&
aNames
,
bool
aSortbyPadsCount
);
NO_SORT
,
ALPHA_SORT
,
PAD_CNT_SORT
};
int
ReturnSortedNetnamesList
(
wxArrayString
&
aNames
,
const
int
aSort_Type
);
/**
/**
* Function Save
* Function Save
...
...
pcbnew/class_board_item.cpp
View file @
e073bdc0
...
@@ -47,17 +47,12 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
...
@@ -47,17 +47,12 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
wxString
text
;
wxString
text
;
wxString
msg
;
wxString
msg
;
wxString
temp
;
wxString
temp
;
NETINFO_ITEM
*
net
;
const
BOARD_ITEM
*
item
=
this
;
const
BOARD_ITEM
*
item
=
this
;
EQUIPOT
*
net
;
D_PAD
*
pad
;
D_PAD
*
pad
;
switch
(
item
->
Type
()
)
switch
(
item
->
Type
()
)
{
{
case
TYPE_EQUIPOT
:
text
<<
_
(
"Net"
)
<<
(
(
EQUIPOT
*
)
item
)
->
GetNetname
()
<<
wxT
(
" "
)
<<
(
(
EQUIPOT
*
)
item
)
->
GetNet
();
break
;
case
TYPE_MODULE
:
case
TYPE_MODULE
:
text
<<
_
(
"Footprint"
)
<<
wxT
(
" "
)
<<
(
(
MODULE
*
)
item
)
->
GetReference
();
text
<<
_
(
"Footprint"
)
<<
wxT
(
" "
)
<<
(
(
MODULE
*
)
item
)
->
GetReference
();
text
<<
wxT
(
" ("
)
<<
aPcb
->
GetLayerName
(
item
->
m_Layer
).
Trim
()
<<
wxT
(
")"
);
text
<<
wxT
(
" ("
)
<<
aPcb
->
GetLayerName
(
item
->
m_Layer
).
Trim
()
<<
wxT
(
")"
);
...
@@ -258,10 +253,6 @@ const char** BOARD_ITEM::MenuIcon() const
...
@@ -258,10 +253,6 @@ const char** BOARD_ITEM::MenuIcon() const
switch
(
item
->
Type
()
)
switch
(
item
->
Type
()
)
{
{
case
TYPE_EQUIPOT
:
xpm
=
general_ratsnet_xpm
;
break
;
case
TYPE_MODULE
:
case
TYPE_MODULE
:
xpm
=
module_xpm
;
xpm
=
module_xpm
;
break
;
break
;
...
...
pcbnew/class_equipot.cpp
View file @
e073bdc0
/*****************************************************************/
/*****************************************************************
********
/
/*
fonctions membres de la classe EQUIPOT et fonctions associ�s
*/
/*
NETINFO_ITEM class, to handle info on nets (netnames, net constraints ...)
*/
/*****************************************************************/
/*****************************************************************
********
/
#include "fctsys.h"
#include "fctsys.h"
#include "wxstruct.h"
#include "wxstruct.h"
...
@@ -10,44 +10,31 @@
...
@@ -10,44 +10,31 @@
/*********************************************************/
/*********************************************************/
/* class
e EQUIPOT: gestion des listes d'equipotentielles
*/
/* class
NETINFO_ITEM: hand data relative to a given net
*/
/*********************************************************/
/*********************************************************/
/* Constructeur de la classe EQUIPOT */
/* Constructor */
EQUIPOT
::
EQUIPOT
(
BOARD_ITEM
*
aParent
)
:
NETINFO_ITEM
::
NETINFO_ITEM
(
BOARD_ITEM
*
aParent
)
BOARD_ITEM
(
aParent
,
TYPE_EQUIPOT
)
{
{
SetNet
(
0
);
SetNet
(
0
);
m_NbNodes
=
m_NbLink
=
m_NbNoconn
=
0
;
m_NbNodes
=
m_NbLink
=
m_NbNoconn
=
0
;
m_Masque_Layer
=
0
;
m_Masque_Plan
=
0
;
m_ForceWidth
=
0
;
m_ForceWidth
=
0
;
m_PadzoneStart
=
NULL
;
// pointeur sur debut de liste pads du net
m_PadzoneEnd
=
NULL
;
// pointeur sur fin de liste pads du net
m_RatsnestStart
=
NULL
;
// pointeur sur debut de liste ratsnests du net
m_RatsnestStart
=
NULL
;
// pointeur sur debut de liste ratsnests du net
m_RatsnestEnd
=
NULL
;
// pointeur sur fin de liste ratsnests du net
m_RatsnestEnd
=
NULL
;
// pointeur sur fin de liste ratsnests du net
}
}
/* destruct
eu
t */
/* destruct
o
t */
EQUIPOT
::~
EQUIPOT
()
NETINFO_ITEM
::~
NETINFO_ITEM
()
{
{
}
}
wxPoint
&
EQUIPOT
::
GetPosition
()
{
static
wxPoint
dummy
;
return
dummy
;
}
/*********************************************************/
/*********************************************************/
int
EQUIPOT
::
ReadDescr
(
FILE
*
File
,
int
*
LineNum
)
int
NETINFO_ITEM
::
ReadDescr
(
FILE
*
File
,
int
*
LineNum
)
/*********************************************************/
/*********************************************************/
/* Routine de lecture de 1 descr Equipotentielle.
/* Routine de lecture de 1 descr Equipotentielle.
* retourne 0 si OK
* retourne 0 si OK
* 1 si lecture incomplete
* 1 si lecture incomplete
...
@@ -84,12 +71,12 @@ int EQUIPOT:: ReadDescr( FILE* File, int* LineNum )
...
@@ -84,12 +71,12 @@ int EQUIPOT:: ReadDescr( FILE* File, int* LineNum )
/**************************************/
/**************************************/
bool
EQUIPOT
::
Save
(
FILE
*
aFile
)
const
bool
NETINFO_ITEM
::
Save
(
FILE
*
aFile
)
const
/**************************************/
/**************************************/
/** Note: the old name of class NETINFO_ITEM was EQUIPOT
* so in Save (and read) functions, for compatibility, we use EQUIPOT as keyword
*/
{
{
if
(
GetState
(
DELETED
)
)
return
true
;
bool
success
=
false
;
bool
success
=
false
;
fprintf
(
aFile
,
"$EQUIPOT
\n
"
);
fprintf
(
aFile
,
"$EQUIPOT
\n
"
);
...
@@ -112,17 +99,17 @@ out:
...
@@ -112,17 +99,17 @@ out:
* Function SetNetname
* Function SetNetname
* @param const wxString : the new netname
* @param const wxString : the new netname
*/
*/
void
EQUIPOT
::
SetNetname
(
const
wxString
&
aNetname
)
void
NETINFO_ITEM
::
SetNetname
(
const
wxString
&
aNetname
)
{
{
m_Netname
=
aNetname
;
m_Netname
=
aNetname
;
m_ShortNetname
=
m_Netname
.
AfterLast
(
'/'
);
m_ShortNetname
=
m_Netname
.
AfterLast
(
'/'
);
}
}
/** function Draw
/** function Draw
(TODO)
* we actually could show a NET, simply show all the tracks and pads or net name on pad and vias
* we actually could show a NET, simply show all the tracks and pads or net name on pad and vias
*/
*/
void
EQUIPOT
::
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
int
aDrawMode
,
const
wxPoint
&
offset
)
void
NETINFO_ITEM
::
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
int
aDrawMode
,
const
wxPoint
&
offset
)
{
{
}
}
...
@@ -134,7 +121,7 @@ void EQUIPOT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPo
...
@@ -134,7 +121,7 @@ void EQUIPOT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPo
* Is virtual from EDA_BaseStruct.
* Is virtual from EDA_BaseStruct.
* @param frame A WinEDA_DrawFrame in which to print status information.
* @param frame A WinEDA_DrawFrame in which to print status information.
*/
*/
void
EQUIPOT
::
DisplayInfo
(
WinEDA_DrawFrame
*
frame
)
void
NETINFO_ITEM
::
DisplayInfo
(
WinEDA_DrawFrame
*
frame
)
{
{
int
count
;
int
count
;
EDA_BaseStruct
*
Struct
;
EDA_BaseStruct
*
Struct
;
...
@@ -182,23 +169,3 @@ void EQUIPOT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPo
...
@@ -182,23 +169,3 @@ void EQUIPOT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPo
valeur_param
(
(
int
)
lengthnet
,
txt
);
valeur_param
(
(
int
)
lengthnet
,
txt
);
Affiche_1_Parametre
(
frame
,
60
,
_
(
"Net Length"
),
txt
,
RED
);
Affiche_1_Parametre
(
frame
,
60
,
_
(
"Net Length"
),
txt
,
RED
);
}
}
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
void
EQUIPOT
::
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
{
// for now, make it look like XML:
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
GetClass
().
Lower
().
mb_str
()
<<
" name=
\"
"
<<
m_Netname
.
mb_str
()
<<
'"'
<<
" netcode=
\"
"
<<
GetNet
()
<<
"
\"
/>
\n
"
;
}
#endif
pcbnew/class_equipot.h
View file @
e073bdc0
/************************
*************************
/
/************************/
/*
classe EQUIPOT: Class to handle info on nets
*/
/*
file class_equipot.h
*/
/************************
*************************
/
/************************/
class
EQUIPOT
:
public
BOARD_ITEM
/*
* Classes to handle info on nets
*/
#ifndef __CLASSES_NETINFO__
#define __CLASSES_NETINFO__
// Forward declaration:
class
NETINFO_ITEM
;
/* Class RATSNEST_ITEM: describes a ratsnest line: a straight line connecting 2 pads */
class
RATSNEST_ITEM
{
{
private
:
private
:
int
m_NetCode
;
// this is a number equivalent to the net name
int
m_NetCode
;
// netcode ( = 1.. n , 0 is the value used for not connected items)
// Used for fast comparisons in rastnest and DRC computations.
wxString
m_Netname
;
// Full net name like /mysheet/mysubsheet/vout used by eeschema
public
:
wxString
m_ShortNetname
;
// short net name, like vout from /mysheet/mysubsheet/vout
int
m_Status
;
// etat: voir defines prcdents (CH_ ...)
D_PAD
*
m_PadStart
;
// pointer to the starting pad
D_PAD
*
m_PadEnd
;
// pointer to ending pad
int
m_Lenght
;
// lenght of the line
/**
* Function GetNet
* @return int - the net code.
*/
int
GetNet
()
const
{
return
m_NetCode
;
}
void
SetNet
(
int
aNetCode
)
{
m_NetCode
=
aNetCode
;
}
/** function Draw
*/
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
int
aDrawMode
,
const
wxPoint
&
offset
);
};
/***************************************************************/
/******************* class NETINFO *****************************/
/***************************************************************/
class
NETINFO_LIST
{
private
:
BOARD
*
m_Parent
;
// boost::ptr_vector<NETINFO_ITEM*> m_NetBuffer; // nets buffer list (name, design constraints ..
std
::
vector
<
NETINFO_ITEM
*>
m_NetBuffer
;
// nets buffer list (name, design constraints ..
public
:
public
:
int
status
;
// no route, hight light...
NETINFO_LIST
(
BOARD
*
aParent
);
int
m_NbNodes
;
// Pads count for this net
~
NETINFO_LIST
();
int
m_NbLink
;
// Ratsnets count for this net
int
m_NbNoconn
;
// Ratsnets remaining to route count
/** Function GetItem
int
m_Masque_Layer
;
// couches interdites (bit 0 = layer 0...)
* @param aNetcode = netcode to identify a given NETINFO_ITEM
int
m_Masque_Plan
;
// couches mises en plan de cuivre
* @return a NETINFO_ITEM pointer to the selected NETINFO_ITEM by its netcode, or NULL if not found
int
m_ForceWidth
;
// specific width (O = default width)
*/
LISTE_PAD
*
m_PadzoneStart
;
// pointeur sur debut de liste pads du net
NETINFO_ITEM
*
GetItem
(
int
aNetcode
);
LISTE_PAD
*
m_PadzoneEnd
;
// pointeur sur fin de liste pads du net
CHEVELU
*
m_RatsnestStart
;
// pointeur sur debut de liste ratsnests du net
/** Function GetCount()
CHEVELU
*
m_RatsnestEnd
;
// pointeur sur fin de liste ratsnests du net
* @return the number of nets ( always >= 1 )
* the first net is the "not connected" net
EQUIPOT
(
BOARD_ITEM
*
aParent
);
*/
~
EQUIPOT
();
unsigned
GetCount
()
{
return
m_NetBuffer
.
size
();
}
EQUIPOT
*
Next
()
const
{
return
(
EQUIPOT
*
)
Pnext
;
}
EQUIPOT
*
Back
()
const
{
return
(
EQUIPOT
*
)
Pback
;
}
/**
/**
* Function GetPosition
* Function Append
* returns the position of this object.
* adds \a aNewElement to the end of the list.
* @return wxPoint& - The position of this object, non-const so it
*/
* can be changed
void
Append
(
NETINFO_ITEM
*
aNewElement
);
* A dummy to satisfy pure virtual BOARD::GetPosition()
/** Function Clear
* delete the list of nets (and free memory)
*/
*/
wxPoint
&
GetPosition
();
void
Clear
();
/** Function BuildListOfNets
* initialize the list of NETINFO_ITEM m_NetBuffer
* The list is sorted by names.
*/
void
BuildListOfNets
();
};
/** class NETINFO_ITEM
* @info This class handle the data relative to a given net
*/
class
NETINFO_ITEM
{
private
:
int
m_NetCode
;
// this is a number equivalent to the net name
// Used for fast comparisons in rastnest and DRC computations.
wxString
m_Netname
;
// Full net name like /mysheet/mysubsheet/vout used by eeschema
wxString
m_ShortNetname
;
// short net name, like vout from /mysheet/mysubsheet/vout
public
:
int
m_NbNodes
;
// Pads count for this net
int
m_NbLink
;
// Ratsnets count for this net
int
m_NbNoconn
;
// Ratsnets remaining to route count
int
m_ForceWidth
;
// specific width (O = default width)
std
::
vector
<
D_PAD
*>
m_ListPad
;
// List of pads connected to this net
RATSNEST_ITEM
*
m_RatsnestStart
;
// pointeur sur debut de liste ratsnests du net
RATSNEST_ITEM
*
m_RatsnestEnd
;
// pointeur sur fin de liste ratsnests du net
std
::
vector
<
RATSNEST_ITEM
*>
m_ListRatsnest
;
// List of Ratsnests for this net
NETINFO_ITEM
(
BOARD_ITEM
*
aParent
);
~
NETINFO_ITEM
();
/* Readind and writing data on files */
/* Readind and writing data on files */
int
ReadDescr
(
FILE
*
File
,
int
*
LineNum
);
int
ReadDescr
(
FILE
*
File
,
int
*
LineNum
);
/**
/**
* Function Save
* Function Save
...
@@ -54,8 +135,7 @@ public:
...
@@ -54,8 +135,7 @@ public:
/** function Draw
/** function Draw
* @todo we actually could show a NET, simply show all the tracks and pads or net name on pad and vias
* @todo we actually could show a NET, simply show all the tracks and pads or net name on pad and vias
*/
*/
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
int
aDrawMode
,
const
wxPoint
&
offset
);
int
aDrawMode
,
const
wxPoint
&
offset
=
ZeroOffset
);
/**
/**
...
@@ -65,11 +145,14 @@ public:
...
@@ -65,11 +145,14 @@ public:
int
GetNet
()
const
{
return
m_NetCode
;
}
int
GetNet
()
const
{
return
m_NetCode
;
}
void
SetNet
(
int
aNetCode
)
{
m_NetCode
=
aNetCode
;
}
void
SetNet
(
int
aNetCode
)
{
m_NetCode
=
aNetCode
;
}
int
GetNodesCount
()
const
{
return
m_ListPad
.
size
();
}
/**
/**
* Function GetNetname
* Function GetNetname
* @return const wxString * , a pointer to the full netname
* @return const wxString * , a pointer to the full netname
*/
*/
wxString
GetNetname
()
const
{
return
m_Netname
;
}
wxString
GetNetname
()
const
{
return
m_Netname
;
}
/**
/**
* Function GetShortNetname
* Function GetShortNetname
* @return const wxString * , a pointer to the short netname
* @return const wxString * , a pointer to the short netname
...
@@ -80,18 +163,7 @@ public:
...
@@ -80,18 +163,7 @@ public:
* Function SetNetname
* Function SetNetname
* @param const wxString : the new netname
* @param const wxString : the new netname
*/
*/
void
SetNetname
(
const
wxString
&
aNetname
);
void
SetNetname
(
const
wxString
&
aNetname
);
/**
* Function GetClass
* returns the class name.
* @return wxString
*/
wxString
GetClass
()
const
{
return
wxT
(
"NET"
);
}
/**
/**
...
@@ -101,18 +173,40 @@ public:
...
@@ -101,18 +173,40 @@ public:
* Is virtual from EDA_BaseStruct.
* Is virtual from EDA_BaseStruct.
* @param frame A WinEDA_DrawFrame in which to print status information.
* @param frame A WinEDA_DrawFrame in which to print status information.
*/
*/
void
DisplayInfo
(
WinEDA_DrawFrame
*
frame
);
void
DisplayInfo
(
WinEDA_DrawFrame
*
frame
);
};
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
virtual
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
#endif
/*****************************/
/* flags for a RATSNEST_ITEM */
/*****************************/
#define CH_VISIBLE 1
/* affichage permanent demande */
#define CH_UNROUTABLE 2
/* non route par l'autorouteur */
#define CH_ROUTE_REQ 4
/* doit etre route par l'autorouteur */
#define CH_ACTIF 8
/* chevelu non encore rout */
#define LOCAL_RATSNEST_ITEM 0x8000
/* indique un chevelu reliant 2 pins d'un meme
* module pour le calcul des chevelus relatifs a 1 seul module */
/****************************************************************/
/* description d'un point de piste pour le suivi des connexions */
/****************************************************************/
#define START_ON_PAD 0x10
#define END_ON_PAD 0x20
#define START_ON_TRACK 0x40
#define END_ON_TRACK 0x80
/* Status bit (OR'ed bits) for class BOARD member .m_Status_Pcb */
enum
StatusPcbFlags
{
LISTE_PAD_OK
=
1
,
/* Pad list is Ok */
LISTE_RATSNEST_ITEM_OK
=
2
,
/* General Rastnest is Ok */
RATSNEST_ITEM_LOCAL_OK
=
4
,
/* current MODULE rastnest is Ok */
CONNEXION_OK
=
8
,
/* Bit indicant que la liste des connexions existe */
NET_CODES_OK
=
0x10
,
/* Bit indicant que les netcodes sont OK ( pas de modif
* de noms de net */
DO_NOT_SHOW_GENERAL_RASTNEST
=
0x20
/* Do not display the general rastnest (used in module moves) */
};
};
#endif // __CLASSES_NETINFO__
pcbnew/class_netinfolist.cpp
0 → 100644
View file @
e073bdc0
/***********************/
/**** class_netinfolist.cpp ****/
/***********************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "class_drawpanel.h"
#include "pcbnew.h"
#include "autorout.h"
// Constructor and destructor
NETINFO_LIST
::
NETINFO_LIST
(
BOARD
*
aParent
)
{
m_Parent
=
aParent
;
}
NETINFO_LIST
::~
NETINFO_LIST
()
{
Clear
();
}
/** Function GetItem
* @param aNetcode = netcode to identify a given NETINFO_ITEM
* @return a NETINFO_ITEM pointer to the selected NETINFO_ITEM by its netcode, or NULL if not found
*/
NETINFO_ITEM
*
NETINFO_LIST
::
GetItem
(
int
aNetcode
)
{
if
(
aNetcode
<
0
||
(
aNetcode
>
(
int
)
(
GetCount
()
-
1
)
)
)
return
NULL
;
return
m_NetBuffer
[
aNetcode
];
}
/** Function Clear
* delete the list of nets (and free memory)
*/
void
NETINFO_LIST
::
Clear
()
{
for
(
unsigned
ii
=
0
;
ii
<
GetCount
();
ii
++
)
delete
m_NetBuffer
[
ii
];
m_NetBuffer
.
clear
();
}
/**
* Function Append
* adds \a aNewElement to the end of the list.
*/
void
NETINFO_LIST
::
Append
(
NETINFO_ITEM
*
aNewElement
)
{
m_NetBuffer
.
push_back
(
aNewElement
);
}
/* sort function, to sort pad list by netnames
*/
static
bool
PadlistSortByNetnames
(
const
D_PAD
*
a
,
const
D_PAD
*
b
)
{
return
(
a
->
GetNetname
().
Cmp
(
b
->
GetNetname
()
)
)
<
0
;
}
/*****************************************************/
void
NETINFO_LIST
::
BuildListOfNets
()
/*****************************************************/
/**
* Compute and update the net_codes for PADS et and equipots (.m_NetCode member)
* net_codes are >= 1 (net_code = 0 means not connected)
* Update the equipotents buffer
* Must be called after editing pads (netname, or deleting) or after read a netlist
* set to 1 flag NET_CODE_OK of m_Pcb->m_Status_Pcb;
* m_Pcb->m_NbNodes and m_Pcb->m_NbNets are updated
*/
{
D_PAD
*
pad
;
int
nodes_count
=
0
;
NETINFO_ITEM
*
net_item
;
Clear
();
// Remove all nets info and free memory
// Create and add the "unconnected net"
net_item
=
new
NETINFO_ITEM
(
m_Parent
);
Append
(
net_item
);
/* Build the PAD list, sorted by net */
m_Parent
->
Build_Pads_Full_List
();
int
netcode
=
0
;
/* Build netnames list, and create a netcode for each netname */
D_PAD
*
last_pad
=
NULL
;
for
(
unsigned
ii
=
0
;
ii
<
m_Parent
->
m_Pads
.
size
();
ii
++
)
{
pad
=
m_Parent
->
m_Pads
[
ii
];
if
(
pad
->
GetNetname
().
IsEmpty
()
)
// pad not connected
{
pad
->
SetNet
(
0
);
continue
;
}
/* if the current netname was already found: add pad to the current net_item ,
* else create a new net_code and a new net_item
*/
if
(
last_pad
==
NULL
||
(
pad
->
GetNetname
()
!=
last_pad
->
GetNetname
()
)
)
// create a new net_code
{
netcode
++
;
net_item
=
new
NETINFO_ITEM
(
m_Parent
);
net_item
->
SetNet
(
netcode
);
net_item
->
SetNetname
(
pad
->
GetNetname
()
);
Append
(
net_item
);
}
pad
->
SetNet
(
netcode
);
net_item
->
m_ListPad
.
push_back
(
pad
);
nodes_count
++
;
last_pad
=
pad
;
}
m_Parent
->
m_NbNodes
=
nodes_count
;
m_Parent
->
m_Status_Pcb
|=
NET_CODES_OK
;
m_Parent
->
SetAreasNetCodesFromNetNames
();
}
/**********************************/
void
BOARD
::
Build_Pads_Full_List
()
/**********************************/
/** Function Build_Pads_Full_List
* Create the pad list
* initialise:
* m_Pads (list of pads)
* m_NbNodes = 0
* set m_Status_Pcb = LISTE_PAD_OK;
* and clear for all pads the m_SubRatsnest member;
* delete ( free memory) m_Pcb->m_Ratsnest and set m_Pcb->m_Ratsnest to NULL
*/
{
if
(
m_Status_Pcb
&
LISTE_PAD_OK
)
return
;
// empty the old list
m_Pads
.
clear
();
m_NbNodes
=
0
;
/* Clear variables used in rastnest computation */
for
(
MODULE
*
module
=
m_Modules
;
module
;
module
=
module
->
Next
()
)
{
for
(
D_PAD
*
pad
=
module
->
m_Pads
;
pad
;
pad
=
pad
->
Next
()
)
{
m_Pads
.
push_back
(
pad
);
pad
->
SetSubRatsnest
(
0
);
pad
->
SetParent
(
module
);
if
(
pad
->
GetNet
()
)
m_NbNodes
++
;
}
}
// Sort pad list per net
sort
(
m_Pads
.
begin
(),
m_Pads
.
end
(),
PadlistSortByNetnames
);
if
(
m_Ratsnest
)
{
MyFree
(
m_Ratsnest
);
m_Ratsnest
=
NULL
;
}
m_Status_Pcb
=
LISTE_PAD_OK
;
}
pcbnew/class_track.cpp
View file @
e073bdc0
...
@@ -665,7 +665,7 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
...
@@ -665,7 +665,7 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
if
(
GetNet
()
==
0
)
if
(
GetNet
()
==
0
)
return
;
return
;
EQUIPOT
*
net
=
(
(
BOARD
*
)
GetParent
()
)
->
FindNet
(
GetNet
()
);
NETINFO_ITEM
*
net
=
(
(
BOARD
*
)
GetParent
()
)
->
FindNet
(
GetNet
()
);
if
(
net
==
NULL
)
if
(
net
==
NULL
)
return
;
return
;
...
@@ -824,7 +824,7 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
...
@@ -824,7 +824,7 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
return
;
return
;
if
(
DisplayOpt
.
DisplayNetNamesMode
==
0
||
DisplayOpt
.
DisplayNetNamesMode
==
1
)
if
(
DisplayOpt
.
DisplayNetNamesMode
==
0
||
DisplayOpt
.
DisplayNetNamesMode
==
1
)
return
;
return
;
EQUIPOT
*
net
=
(
(
BOARD
*
)
GetParent
()
)
->
FindNet
(
GetNet
()
);
NETINFO_ITEM
*
net
=
(
(
BOARD
*
)
GetParent
()
)
->
FindNet
(
GetNet
()
);
if
(
net
==
NULL
)
if
(
net
==
NULL
)
return
;
return
;
...
@@ -886,7 +886,7 @@ void TRACK::DisplayInfo( WinEDA_DrawFrame* frame )
...
@@ -886,7 +886,7 @@ void TRACK::DisplayInfo( WinEDA_DrawFrame* frame )
{
{
/* Display NetName pour les segments de piste type cuivre */
/* Display NetName pour les segments de piste type cuivre */
EQUIPOT
*
equipot
=
board
->
FindNet
(
GetNet
()
);
NETINFO_ITEM
*
equipot
=
board
->
FindNet
(
GetNet
()
);
if
(
equipot
)
if
(
equipot
)
msg
=
equipot
->
GetNetname
();
msg
=
equipot
->
GetNetname
();
...
...
pcbnew/class_zone.cpp
View file @
e073bdc0
...
@@ -71,7 +71,7 @@ void ZONE_CONTAINER::SetNet( int anet_code )
...
@@ -71,7 +71,7 @@ void ZONE_CONTAINER::SetNet( int anet_code )
if
(
m_Parent
)
if
(
m_Parent
)
{
{
BOARD
*
board
=
(
BOARD
*
)
m_Parent
;
BOARD
*
board
=
(
BOARD
*
)
m_Parent
;
EQUIPOT
*
net
=
board
->
FindNet
(
anet_code
);
NETINFO_ITEM
*
net
=
board
->
FindNet
(
anet_code
);
if
(
net
)
if
(
net
)
m_Netname
=
net
->
GetNetname
();
m_Netname
=
net
->
GetNetname
();
else
else
...
@@ -883,7 +883,7 @@ void ZONE_CONTAINER::DisplayInfo( WinEDA_DrawFrame* frame )
...
@@ -883,7 +883,7 @@ void ZONE_CONTAINER::DisplayInfo( WinEDA_DrawFrame* frame )
{
{
if
(
GetNet
()
>=
0
)
if
(
GetNet
()
>=
0
)
{
{
EQUIPOT
*
equipot
=
(
(
WinEDA_PcbFrame
*
)
frame
)
->
GetBoard
()
->
FindNet
(
GetNet
()
);
NETINFO_ITEM
*
equipot
=
(
(
WinEDA_PcbFrame
*
)
frame
)
->
GetBoard
()
->
FindNet
(
GetNet
()
);
if
(
equipot
)
if
(
equipot
)
msg
=
equipot
->
GetNetname
();
msg
=
equipot
->
GetNetname
();
...
@@ -1055,7 +1055,7 @@ void ZONE_CONTAINER::Copy( ZONE_CONTAINER* src )
...
@@ -1055,7 +1055,7 @@ void ZONE_CONTAINER::Copy( ZONE_CONTAINER* src )
*/
*/
bool
ZONE_CONTAINER
::
SetNetNameFromNetCode
(
void
)
bool
ZONE_CONTAINER
::
SetNetNameFromNetCode
(
void
)
{
{
EQUIPOT
*
net
;
NETINFO_ITEM
*
net
;
if
(
m_Parent
&&
(
net
=
((
BOARD
*
)
m_Parent
)
->
FindNet
(
GetNet
())
)
)
if
(
m_Parent
&&
(
net
=
((
BOARD
*
)
m_Parent
)
->
FindNet
(
GetNet
())
)
)
{
{
m_Netname
=
net
->
GetNetname
();
m_Netname
=
net
->
GetNetname
();
...
...
pcbnew/clean.cpp
View file @
e073bdc0
...
@@ -77,8 +77,7 @@ void Clean_Pcb_Items( WinEDA_PcbFrame* frame, wxDC* DC )
...
@@ -77,8 +77,7 @@ void Clean_Pcb_Items( WinEDA_PcbFrame* frame, wxDC* DC )
/* Rebuild the pad infos (pad list and netcodes) to ensure an up to date info */
/* Rebuild the pad infos (pad list and netcodes) to ensure an up to date info */
frame
->
GetBoard
()
->
m_Status_Pcb
=
0
;
frame
->
GetBoard
()
->
m_Status_Pcb
=
0
;
frame
->
build_liste_pads
();
frame
->
GetBoard
()
->
m_NetInfo
->
BuildListOfNets
();
frame
->
recalcule_pad_net_code
();
if
(
s_CleanVias
)
// delete redundant vias
if
(
s_CleanVias
)
// delete redundant vias
{
{
...
...
pcbnew/connect.cpp
View file @
e073bdc0
...
@@ -7,7 +7,6 @@
...
@@ -7,7 +7,6 @@
#include "common.h"
#include "common.h"
#include "pcbnew.h"
#include "pcbnew.h"
#include "autorout.h"
#include "protos.h"
#include "protos.h"
...
@@ -322,7 +321,7 @@ void WinEDA_BasePcbFrame::test_1_net_connexion( wxDC* DC, int net_code )
...
@@ -322,7 +321,7 @@ void WinEDA_BasePcbFrame::test_1_net_connexion( wxDC* DC, int net_code )
if
(
net_code
==
0
)
if
(
net_code
==
0
)
return
;
return
;
if
(
(
m_Pcb
->
m_Status_Pcb
&
LISTE_
CHEVELU
_OK
)
==
0
)
if
(
(
m_Pcb
->
m_Status_Pcb
&
LISTE_
RATSNEST_ITEM
_OK
)
==
0
)
Compile_Ratsnest
(
DC
,
TRUE
);
Compile_Ratsnest
(
DC
,
TRUE
);
for
(
unsigned
i
=
0
;
i
<
m_Pcb
->
m_Pads
.
size
();
++
i
)
for
(
unsigned
i
=
0
;
i
<
m_Pcb
->
m_Pads
.
size
();
++
i
)
...
@@ -563,12 +562,11 @@ void CreateSortedPadListByXCoord( BOARD* aBoard, std::vector<D_PAD*>* aVector )
...
@@ -563,12 +562,11 @@ void CreateSortedPadListByXCoord( BOARD* aBoard, std::vector<D_PAD*>* aVector )
/********************************************************************/
/********************************************************************/
void
WinEDA_BasePcbFrame
::
reattribution_reference_piste
(
int
affiche
)
void
WinEDA_BasePcbFrame
::
RecalculateAllTracksNetcode
(
)
/********************************************************************/
/********************************************************************/
/* search connections between tracks and pads, and propagate pad net codes to the track segments
/* search connections between tracks and pads, and propagate pad net codes to the track segments
* This is a 2 pass computation.
* This is a 2 pass computation.
* The pad netcodes are assumed to be initialized.
* First:
* First:
* We search a connection between a track segment and a pad: if found : this segment netcode is set to the pad netcode
* We search a connection between a track segment and a pad: if found : this segment netcode is set to the pad netcode
*/
*/
...
@@ -583,6 +581,9 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche )
...
@@ -583,6 +581,9 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche )
int
masque_layer
;
int
masque_layer
;
wxString
msg
;
wxString
msg
;
// Build the net info list
GetBoard
()
->
m_NetInfo
->
BuildListOfNets
();
if
(
m_Pcb
->
m_Pads
.
size
()
==
0
)
// If no pad, reset pointers and netcode, and do nothing else
if
(
m_Pcb
->
m_Pads
.
size
()
==
0
)
// If no pad, reset pointers and netcode, and do nothing else
{
{
pt_piste
=
m_Pcb
->
m_Track
;
pt_piste
=
m_Pcb
->
m_Track
;
...
@@ -593,28 +594,14 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche )
...
@@ -593,28 +594,14 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche )
pt_piste
->
SetNet
(
0
);
pt_piste
->
SetNet
(
0
);
pt_piste
->
end
=
NULL
;
pt_piste
->
end
=
NULL
;
}
}
return
;
return
;
}
}
a_color
=
CYAN
;
if
(
affiche
)
Affiche_1_Parametre
(
this
,
POS_AFF_CHREF
,
wxT
(
"DataBase"
),
wxT
(
"Netcodes"
),
a_color
);
recalcule_pad_net_code
();
if
(
affiche
)
Affiche_1_Parametre
(
this
,
-
1
,
wxEmptyString
,
wxT
(
"Gen Pads "
),
a_color
);
/**************************************************************/
/**************************************************************/
/* Pass 1: search the connections between track ends and pads */
/* Pass 1: search the connections between track ends and pads */
/**************************************************************/
/**************************************************************/
CreateSortedPadListByXCoord
(
m_Pcb
,
&
sortedPads
);
CreateSortedPadListByXCoord
(
m_Pcb
,
&
sortedPads
);
if
(
affiche
)
Affiche_1_Parametre
(
this
,
-
1
,
wxEmptyString
,
wxT
(
"Conn Pads"
),
a_color
);
/* Reset variables and flags used in computation */
/* Reset variables and flags used in computation */
pt_piste
=
m_Pcb
->
m_Track
;
pt_piste
=
m_Pcb
->
m_Track
;
for
(
;
pt_piste
!=
NULL
;
pt_piste
=
pt_piste
->
Next
()
)
for
(
;
pt_piste
!=
NULL
;
pt_piste
=
pt_piste
->
Next
()
)
...
@@ -667,8 +654,6 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche )
...
@@ -667,8 +654,6 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche )
* the connection (if found) is between segments
* the connection (if found) is between segments
* when a track has a net code and the other has a null net code, the null net code is changed
* when a track has a net code and the other has a null net code, the null net code is changed
*/
*/
if
(
affiche
)
Affiche_1_Parametre
(
this
,
POS_AFF_CHREF
,
wxEmptyString
,
wxT
(
"Conn Segm"
),
a_color
);
for
(
pt_piste
=
m_Pcb
->
m_Track
;
pt_piste
!=
NULL
;
pt_piste
=
pt_piste
->
Next
()
)
for
(
pt_piste
=
m_Pcb
->
m_Track
;
pt_piste
!=
NULL
;
pt_piste
=
pt_piste
->
Next
()
)
{
{
...
@@ -693,11 +678,6 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche )
...
@@ -693,11 +678,6 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche )
{
{
bool
reset_flag
=
FALSE
;
bool
reset_flag
=
FALSE
;
new_passe_request
=
0
;
new_passe_request
=
0
;
if
(
affiche
)
{
msg
.
Printf
(
wxT
(
"Net->Segm pass %d "
),
new_passe_request
+
1
);
Affiche_1_Parametre
(
this
,
POS_AFF_CHREF
,
wxEmptyString
,
msg
,
a_color
);
}
/* look for vias which could be connect many tracks */
/* look for vias which could be connect many tracks */
for
(
TRACK
*
via
=
m_Pcb
->
m_Track
;
via
!=
NULL
;
via
=
via
->
Next
()
)
for
(
TRACK
*
via
=
m_Pcb
->
m_Track
;
via
!=
NULL
;
via
=
via
->
Next
()
)
...
@@ -789,12 +769,7 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche )
...
@@ -789,12 +769,7 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche )
}
}
/* Sort the track list by net codes: */
/* Sort the track list by net codes: */
if
(
affiche
)
Affiche_1_Parametre
(
this
,
-
1
,
wxEmptyString
,
wxT
(
"Reorder "
),
a_color
);
RebuildTrackChain
(
m_Pcb
);
RebuildTrackChain
(
m_Pcb
);
if
(
affiche
)
Affiche_1_Parametre
(
this
,
-
1
,
wxEmptyString
,
wxT
(
" "
),
a_color
);
}
}
...
...
pcbnew/dialog_copper_zones.cpp
View file @
e073bdc0
...
@@ -157,8 +157,7 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
...
@@ -157,8 +157,7 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
wxArrayString
ListNetName
;
wxArrayString
ListNetName
;
m_Parent
->
GetBoard
()
->
ReturnSortedNetnamesList
(
m_Parent
->
GetBoard
()
->
ReturnSortedNetnamesList
(
ListNetName
,
ListNetName
,
m_NetSorting
==
m_NetSorting
==
0
?
false
:
true
);
0
?
BOARD
::
ALPHA_SORT
:
BOARD
::
PAD_CNT_SORT
);
if
(
m_NetSorting
!=
0
)
if
(
m_NetSorting
!=
0
)
{
{
...
@@ -181,7 +180,7 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
...
@@ -181,7 +180,7 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
if
(
net_select
>
0
)
if
(
net_select
>
0
)
{
{
EQUIPOT
*
equipot
=
m_Parent
->
GetBoard
()
->
FindNet
(
net_select
);
NETINFO_ITEM
*
equipot
=
m_Parent
->
GetBoard
()
->
FindNet
(
net_select
);
if
(
equipot
)
// Search net in list and select it
if
(
equipot
)
// Search net in list and select it
{
{
for
(
unsigned
ii
=
0
;
ii
<
ListNetName
.
GetCount
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
ListNetName
.
GetCount
();
ii
++
)
...
@@ -351,15 +350,9 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab
...
@@ -351,15 +350,9 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab
/* Search net_code for this net, if a net was selected */
/* Search net_code for this net, if a net was selected */
if
(
m_ListNetNameSelection
->
GetSelection
()
>
0
)
if
(
m_ListNetNameSelection
->
GetSelection
()
>
0
)
{
{
EQUIPOT
*
net
;
NETINFO_ITEM
*
net
=
m_Parent
->
GetBoard
()
->
FindNet
(
net_name
);
for
(
net
=
m_Parent
->
GetBoard
()
->
m_Equipots
;
net
;
net
=
net
->
Next
()
)
if
(
net
)
{
g_Zone_Default_Setting
.
m_NetcodeSelection
=
net
->
GetNet
();
if
(
net
->
GetNetname
()
==
net_name
)
{
g_Zone_Default_Setting
.
m_NetcodeSelection
=
net
->
GetNet
();
break
;
}
}
}
}
return
true
;
return
true
;
...
@@ -374,9 +367,7 @@ void dialog_copper_zone::OnNetSortingOptionSelected( wxCommandEvent& event )
...
@@ -374,9 +367,7 @@ void dialog_copper_zone::OnNetSortingOptionSelected( wxCommandEvent& event )
m_NetSorting
=
m_NetSortingOption
->
GetSelection
();
m_NetSorting
=
m_NetSortingOption
->
GetSelection
();
m_Parent
->
GetBoard
()
->
ReturnSortedNetnamesList
(
m_Parent
->
GetBoard
()
->
ReturnSortedNetnamesList
(
ListNetName
,
ListNetName
,
m_NetSorting
==
0
?
false
:
true
);
m_NetSorting
==
0
?
BOARD
::
ALPHA_SORT
:
BOARD
::
PAD_CNT_SORT
);
if
(
m_NetSorting
!=
0
)
if
(
m_NetSorting
!=
0
)
{
{
wxString
Filter
=
m_NetNameFilter
->
GetValue
();
wxString
Filter
=
m_NetNameFilter
->
GetValue
();
...
@@ -398,11 +389,11 @@ void dialog_copper_zone::OnNetSortingOptionSelected( wxCommandEvent& event )
...
@@ -398,11 +389,11 @@ void dialog_copper_zone::OnNetSortingOptionSelected( wxCommandEvent& event )
m_Config
->
Write
(
ZONE_NET_FILTER_STRING_KEY
,
Filter
);
m_Config
->
Write
(
ZONE_NET_FILTER_STRING_KEY
,
Filter
);
}
}
// Select and isplay current zone net name in listbox:
// Select and
d
isplay current zone net name in listbox:
int
net_select
=
m_Zone_Setting
->
m_NetcodeSelection
;
int
net_select
=
m_Zone_Setting
->
m_NetcodeSelection
;
if
(
net_select
>
0
)
if
(
net_select
>
0
)
{
{
EQUIPOT
*
equipot
=
m_Parent
->
GetBoard
()
->
FindNet
(
net_select
);
NETINFO_ITEM
*
equipot
=
m_Parent
->
GetBoard
()
->
FindNet
(
net_select
);
if
(
equipot
)
// Search net in list and select it
if
(
equipot
)
// Search net in list and select it
{
{
for
(
unsigned
ii
=
0
;
ii
<
ListNetName
.
GetCount
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
ListNetName
.
GetCount
();
ii
++
)
...
...
pcbnew/dialog_drc.cpp
View file @
e073bdc0
...
@@ -634,7 +634,7 @@ void DrcDialog::OnStartdrcClick( wxCommandEvent& event )
...
@@ -634,7 +634,7 @@ void DrcDialog::OnStartdrcClick( wxCommandEvent& event )
// running the module editor and selecting "Update module in current board"
// running the module editor and selecting "Update module in current board"
// causes the list to become obsolete because of the new pads from the
// causes the list to become obsolete because of the new pads from the
// revised module.
// revised module.
m_Parent
->
build_liste_pads
();
m_Parent
->
GetBoard
()
->
Build_Pads_Full_List
();
// run all the tests, with no UI at this time.
// run all the tests, with no UI at this time.
m_tester
->
RunTests
();
m_tester
->
RunTests
();
...
...
pcbnew/dialog_pad_properties.cpp
View file @
e073bdc0
...
@@ -521,7 +521,7 @@ void DialogPadProperties::PadPropertiesAccept( wxCommandEvent& event )
...
@@ -521,7 +521,7 @@ void DialogPadProperties::PadPropertiesAccept( wxCommandEvent& event )
}
}
else
else
{
{
const
EQUIPOT
*
net
=
m_Parent
->
GetBoard
()
->
FindNet
(
Current_PadNetName
);
const
NETINFO_ITEM
*
net
=
m_Parent
->
GetBoard
()
->
FindNet
(
Current_PadNetName
);
if
(
net
)
if
(
net
)
{
{
RastnestIsChanged
=
true
;
RastnestIsChanged
=
true
;
...
...
pcbnew/drc.cpp
View file @
e073bdc0
...
@@ -190,7 +190,7 @@ int DRC::Drc( ZONE_CONTAINER* aArea, int CornerIndex )
...
@@ -190,7 +190,7 @@ int DRC::Drc( ZONE_CONTAINER* aArea, int CornerIndex )
void
DRC
::
RunTests
()
void
DRC
::
RunTests
()
{
{
// Ensure ratsnest is up to date:
// Ensure ratsnest is up to date:
if
(
(
m_pcb
->
m_Status_Pcb
&
LISTE_
CHEVELU
_OK
)
==
0
)
if
(
(
m_pcb
->
m_Status_Pcb
&
LISTE_
RATSNEST_ITEM
_OK
)
==
0
)
m_mainWindow
->
Compile_Ratsnest
(
NULL
,
true
);
m_mainWindow
->
Compile_Ratsnest
(
NULL
,
true
);
// someone should have cleared the two lists before calling this.
// someone should have cleared the two lists before calling this.
...
@@ -296,7 +296,7 @@ void DRC::testPad2Pad()
...
@@ -296,7 +296,7 @@ void DRC::testPad2Pad()
void
DRC
::
testUnconnected
()
void
DRC
::
testUnconnected
()
{
{
if
(
(
m_pcb
->
m_Status_Pcb
&
LISTE_
CHEVELU
_OK
)
==
0
)
if
(
(
m_pcb
->
m_Status_Pcb
&
LISTE_
RATSNEST_ITEM
_OK
)
==
0
)
{
{
wxClientDC
dc
(
m_mainWindow
->
DrawPanel
);
wxClientDC
dc
(
m_mainWindow
->
DrawPanel
);
m_mainWindow
->
Compile_Ratsnest
(
&
dc
,
TRUE
);
m_mainWindow
->
Compile_Ratsnest
(
&
dc
,
TRUE
);
...
@@ -305,14 +305,14 @@ void DRC::testUnconnected()
...
@@ -305,14 +305,14 @@ void DRC::testUnconnected()
if
(
m_pcb
->
m_Ratsnest
==
NULL
)
if
(
m_pcb
->
m_Ratsnest
==
NULL
)
return
;
return
;
CHEVELU
*
rat
=
m_pcb
->
m_Ratsnest
;
RATSNEST_ITEM
*
rat
=
m_pcb
->
m_Ratsnest
;
for
(
int
i
=
0
;
i
<
m_pcb
->
GetNumRatsnests
();
++
i
,
++
rat
)
for
(
int
i
=
0
;
i
<
m_pcb
->
GetNumRatsnests
();
++
i
,
++
rat
)
{
{
if
(
(
rat
->
s
tatus
&
CH_ACTIF
)
==
0
)
if
(
(
rat
->
m_S
tatus
&
CH_ACTIF
)
==
0
)
continue
;
continue
;
D_PAD
*
padStart
=
rat
->
pad_s
tart
;
D_PAD
*
padStart
=
rat
->
m_PadS
tart
;
D_PAD
*
padEnd
=
rat
->
pad_e
nd
;
D_PAD
*
padEnd
=
rat
->
m_PadE
nd
;
DRC_ITEM
*
uncItem
=
new
DRC_ITEM
(
DRCE_UNCONNECTED_PADS
,
padStart
->
GetPosition
(),
DRC_ITEM
*
uncItem
=
new
DRC_ITEM
(
DRCE_UNCONNECTED_PADS
,
padStart
->
GetPosition
(),
padStart
->
MenuText
(
m_pcb
),
padEnd
->
MenuText
(
m_pcb
),
padStart
->
MenuText
(
m_pcb
),
padEnd
->
MenuText
(
m_pcb
),
...
...
pcbnew/edit.cpp
View file @
e073bdc0
...
@@ -261,7 +261,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -261,7 +261,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case
ID_TRACK_BUTT
:
case
ID_TRACK_BUTT
:
SetToolID
(
id
,
wxCURSOR_PENCIL
,
_
(
"Add Tracks"
)
);
SetToolID
(
id
,
wxCURSOR_PENCIL
,
_
(
"Add Tracks"
)
);
DisplayTrackSettings
();
DisplayTrackSettings
();
if
(
(
GetBoard
()
->
m_Status_Pcb
&
LISTE_
CHEVELU
_OK
)
==
0
)
if
(
(
GetBoard
()
->
m_Status_Pcb
&
LISTE_
RATSNEST_ITEM
_OK
)
==
0
)
{
{
Compile_Ratsnest
(
&
dc
,
true
);
Compile_Ratsnest
(
&
dc
,
true
);
}
}
...
@@ -311,7 +311,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -311,7 +311,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case
ID_PCB_SHOW_1_RATSNEST_BUTT
:
case
ID_PCB_SHOW_1_RATSNEST_BUTT
:
SetToolID
(
id
,
wxCURSOR_HAND
,
_
(
"Local Ratsnest"
)
);
SetToolID
(
id
,
wxCURSOR_HAND
,
_
(
"Local Ratsnest"
)
);
if
(
(
GetBoard
()
->
m_Status_Pcb
&
LISTE_
CHEVELU
_OK
)
==
0
)
if
(
(
GetBoard
()
->
m_Status_Pcb
&
LISTE_
RATSNEST_ITEM
_OK
)
==
0
)
Compile_Ratsnest
(
&
dc
,
true
);
Compile_Ratsnest
(
&
dc
,
true
);
break
;
break
;
...
@@ -466,6 +466,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -466,6 +466,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
SetCurItem
(
NULL
);
SetCurItem
(
NULL
);
test_1_net_connexion
(
NULL
,
netcode
);
test_1_net_connexion
(
NULL
,
netcode
);
GetScreen
()
->
SetModify
();
GetScreen
()
->
SetModify
();
GetBoard
()
->
DisplayInfo
(
this
);
}
}
break
;
break
;
...
@@ -494,6 +495,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -494,6 +495,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
Delete_Zone_Contour
(
&
dc
,
(
ZONE_CONTAINER
*
)
GetCurItem
()
);
Delete_Zone_Contour
(
&
dc
,
(
ZONE_CONTAINER
*
)
GetCurItem
()
);
SetCurItem
(
NULL
);
SetCurItem
(
NULL
);
test_1_net_connexion
(
NULL
,
netcode
);
test_1_net_connexion
(
NULL
,
netcode
);
GetBoard
()
->
DisplayInfo
(
this
);
}
}
break
;
break
;
...
@@ -571,6 +573,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -571,6 +573,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case
ID_POPUP_PCB_FILL_ALL_ZONES
:
case
ID_POPUP_PCB_FILL_ALL_ZONES
:
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
MouseToCursorSchema
();
Fill_All_Zones
();
Fill_All_Zones
();
GetBoard
()
->
DisplayInfo
(
this
);
break
;
break
;
case
ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE
:
case
ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE
:
...
@@ -580,8 +583,10 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -580,8 +583,10 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
Delete_Zone_Fill
(
&
dc
,
NULL
,
zone_container
->
m_TimeStamp
);
Delete_Zone_Fill
(
&
dc
,
NULL
,
zone_container
->
m_TimeStamp
);
test_1_net_connexion
(
NULL
,
zone_container
->
GetNet
()
);
test_1_net_connexion
(
NULL
,
zone_container
->
GetNet
()
);
GetScreen
()
->
SetModify
();
GetScreen
()
->
SetModify
();
GetBoard
()
->
DisplayInfo
(
this
);
DrawPanel
->
Refresh
();
DrawPanel
->
Refresh
();
}
}
SetCurItem
(
NULL
);
break
;
break
;
case
ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES
:
// Remove all zones :
case
ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES
:
// Remove all zones :
...
@@ -595,6 +600,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -595,6 +600,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
test_connexions
(
NULL
);
test_connexions
(
NULL
);
Tst_Ratsnest
(
NULL
,
0
);
// Recalculate the active ratsnest, i.e. the unconnected links */
Tst_Ratsnest
(
NULL
,
0
);
// Recalculate the active ratsnest, i.e. the unconnected links */
GetScreen
()
->
SetModify
();
GetScreen
()
->
SetModify
();
GetBoard
()
->
DisplayInfo
(
this
);
DrawPanel
->
Refresh
();
DrawPanel
->
Refresh
();
break
;
break
;
...
@@ -602,6 +608,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -602,6 +608,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
MouseToCursorSchema
();
Fill_Zone
(
NULL
,
(
ZONE_CONTAINER
*
)
GetCurItem
()
);
Fill_Zone
(
NULL
,
(
ZONE_CONTAINER
*
)
GetCurItem
()
);
test_1_net_connexion
(
NULL
,
(
(
ZONE_CONTAINER
*
)
GetCurItem
()
)
->
GetNet
()
);
test_1_net_connexion
(
NULL
,
(
(
ZONE_CONTAINER
*
)
GetCurItem
()
)
->
GetNet
()
);
GetBoard
()
->
DisplayInfo
(
this
);
DrawPanel
->
Refresh
();
DrawPanel
->
Refresh
();
break
;
break
;
...
@@ -1133,6 +1140,7 @@ void WinEDA_PcbFrame::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
...
@@ -1133,6 +1140,7 @@ void WinEDA_PcbFrame::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
int
netcode
=
((
ZONE_CONTAINER
*
)
Item
)
->
GetNet
();
int
netcode
=
((
ZONE_CONTAINER
*
)
Item
)
->
GetNet
();
Delete_Zone_Contour
(
DC
,
(
ZONE_CONTAINER
*
)
Item
);
Delete_Zone_Contour
(
DC
,
(
ZONE_CONTAINER
*
)
Item
);
test_1_net_connexion
(
NULL
,
netcode
);
test_1_net_connexion
(
NULL
,
netcode
);
GetBoard
()
->
DisplayInfo
(
this
);
}
}
break
;
break
;
...
@@ -1151,7 +1159,6 @@ void WinEDA_PcbFrame::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
...
@@ -1151,7 +1159,6 @@ void WinEDA_PcbFrame::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
break
;
break
;
case
TYPE_NOT_INIT
:
case
TYPE_NOT_INIT
:
case
TYPE_EQUIPOT
:
case
TYPE_PCB
:
case
TYPE_PCB
:
default
:
default
:
{
{
...
...
pcbnew/editrack-part2.cpp
View file @
e073bdc0
...
@@ -10,7 +10,6 @@
...
@@ -10,7 +10,6 @@
#include "confirm.h"
#include "confirm.h"
#include "pcbnew.h"
#include "pcbnew.h"
#include "autorout.h"
#include "protos.h"
#include "protos.h"
...
@@ -45,9 +44,9 @@ void WinEDA_PcbFrame::Ratsnest_On_Off( wxDC* DC )
...
@@ -45,9 +44,9 @@ void WinEDA_PcbFrame::Ratsnest_On_Off( wxDC* DC )
/* Affiche ou efface le chevelu selon l'etat du bouton d'appel */
/* Affiche ou efface le chevelu selon l'etat du bouton d'appel */
{
{
int
ii
;
int
ii
;
CHEVELU
*
pt_chevelu
;
RATSNEST_ITEM
*
pt_chevelu
;
if
(
(
GetBoard
()
->
m_Status_Pcb
&
LISTE_
CHEVELU
_OK
)
==
0
)
if
(
(
GetBoard
()
->
m_Status_Pcb
&
LISTE_
RATSNEST_ITEM
_OK
)
==
0
)
{
{
if
(
g_Show_Ratsnest
)
if
(
g_Show_Ratsnest
)
Compile_Ratsnest
(
DC
,
TRUE
);
Compile_Ratsnest
(
DC
,
TRUE
);
...
@@ -64,7 +63,7 @@ void WinEDA_PcbFrame::Ratsnest_On_Off( wxDC* DC )
...
@@ -64,7 +63,7 @@ void WinEDA_PcbFrame::Ratsnest_On_Off( wxDC* DC )
{
{
for
(
ii
=
GetBoard
()
->
GetNumRatsnests
();
ii
>
0
;
pt_chevelu
++
,
ii
--
)
for
(
ii
=
GetBoard
()
->
GetNumRatsnests
();
ii
>
0
;
pt_chevelu
++
,
ii
--
)
{
{
pt_chevelu
->
s
tatus
|=
CH_VISIBLE
;
pt_chevelu
->
m_S
tatus
|=
CH_VISIBLE
;
}
}
DrawGeneralRatsnest
(
DC
,
0
);
DrawGeneralRatsnest
(
DC
,
0
);
...
@@ -73,7 +72,7 @@ void WinEDA_PcbFrame::Ratsnest_On_Off( wxDC* DC )
...
@@ -73,7 +72,7 @@ void WinEDA_PcbFrame::Ratsnest_On_Off( wxDC* DC )
{
{
for
(
ii
=
GetBoard
()
->
GetNumRatsnests
();
ii
>
0
;
pt_chevelu
++
,
ii
--
)
for
(
ii
=
GetBoard
()
->
GetNumRatsnests
();
ii
>
0
;
pt_chevelu
++
,
ii
--
)
{
{
pt_chevelu
->
s
tatus
&=
~
CH_VISIBLE
;
pt_chevelu
->
m_S
tatus
&=
~
CH_VISIBLE
;
}
}
}
}
}
}
...
@@ -346,14 +345,14 @@ void WinEDA_PcbFrame::Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC )
...
@@ -346,14 +345,14 @@ void WinEDA_PcbFrame::Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC )
*/
*/
{
{
int
ii
;
int
ii
;
CHEVELU
*
pt_chevelu
;
RATSNEST_ITEM
*
pt_chevelu
;
D_PAD
*
pt_pad
=
NULL
;
D_PAD
*
pt_pad
=
NULL
;
MODULE
*
Module
=
NULL
;
MODULE
*
Module
=
NULL
;
if
(
g_Show_Ratsnest
)
if
(
g_Show_Ratsnest
)
return
;
// Deja Affich�
return
;
// Deja Affich�
if
(
(
GetBoard
()
->
m_Status_Pcb
&
LISTE_
CHEVELU
_OK
)
==
0
)
if
(
(
GetBoard
()
->
m_Status_Pcb
&
LISTE_
RATSNEST_ITEM
_OK
)
==
0
)
{
{
Compile_Ratsnest
(
DC
,
TRUE
);
Compile_Ratsnest
(
DC
,
TRUE
);
}
}
...
@@ -369,22 +368,22 @@ void WinEDA_PcbFrame::Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC )
...
@@ -369,22 +368,22 @@ void WinEDA_PcbFrame::Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC )
if
(
pt_pad
)
/* Affichage du chevelu du net correspondant */
if
(
pt_pad
)
/* Affichage du chevelu du net correspondant */
{
{
pt_pad
->
DisplayInfo
(
this
);
pt_pad
->
DisplayInfo
(
this
);
pt_chevelu
=
(
CHEVELU
*
)
GetBoard
()
->
m_Ratsnest
;
pt_chevelu
=
(
RATSNEST_ITEM
*
)
GetBoard
()
->
m_Ratsnest
;
for
(
ii
=
GetBoard
()
->
GetNumRatsnests
();
ii
>
0
;
pt_chevelu
++
,
ii
--
)
for
(
ii
=
GetBoard
()
->
GetNumRatsnests
();
ii
>
0
;
pt_chevelu
++
,
ii
--
)
{
{
if
(
pt_chevelu
->
GetNet
()
==
pt_pad
->
GetNet
()
)
if
(
pt_chevelu
->
GetNet
()
==
pt_pad
->
GetNet
()
)
{
{
if
(
(
pt_chevelu
->
s
tatus
&
CH_VISIBLE
)
!=
0
)
if
(
(
pt_chevelu
->
m_S
tatus
&
CH_VISIBLE
)
!=
0
)
continue
;
continue
;
pt_chevelu
->
s
tatus
|=
CH_VISIBLE
;
pt_chevelu
->
m_S
tatus
|=
CH_VISIBLE
;
if
(
(
pt_chevelu
->
s
tatus
&
CH_ACTIF
)
==
0
)
if
(
(
pt_chevelu
->
m_S
tatus
&
CH_ACTIF
)
==
0
)
continue
;
continue
;
GRSetDrawMode
(
DC
,
GR_XOR
);
GRSetDrawMode
(
DC
,
GR_XOR
);
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
pt_chevelu
->
pad_s
tart
->
m_Pos
.
x
,
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
pt_chevelu
->
m_PadS
tart
->
m_Pos
.
x
,
pt_chevelu
->
pad_s
tart
->
m_Pos
.
y
,
pt_chevelu
->
m_PadS
tart
->
m_Pos
.
y
,
pt_chevelu
->
pad_e
nd
->
m_Pos
.
x
,
pt_chevelu
->
m_PadE
nd
->
m_Pos
.
x
,
pt_chevelu
->
pad_e
nd
->
m_Pos
.
y
,
pt_chevelu
->
m_PadE
nd
->
m_Pos
.
y
,
0
,
0
,
g_DesignSettings
.
m_RatsnestColor
);
g_DesignSettings
.
m_RatsnestColor
);
}
}
...
@@ -408,24 +407,24 @@ void WinEDA_PcbFrame::Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC )
...
@@ -408,24 +407,24 @@ void WinEDA_PcbFrame::Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC )
pt_pad
=
Module
->
m_Pads
;
pt_pad
=
Module
->
m_Pads
;
for
(
;
pt_pad
!=
NULL
;
pt_pad
=
(
D_PAD
*
)
pt_pad
->
Next
()
)
for
(
;
pt_pad
!=
NULL
;
pt_pad
=
(
D_PAD
*
)
pt_pad
->
Next
()
)
{
{
pt_chevelu
=
(
CHEVELU
*
)
GetBoard
()
->
m_Ratsnest
;
pt_chevelu
=
(
RATSNEST_ITEM
*
)
GetBoard
()
->
m_Ratsnest
;
for
(
ii
=
GetBoard
()
->
GetNumRatsnests
();
ii
>
0
;
pt_chevelu
++
,
ii
--
)
for
(
ii
=
GetBoard
()
->
GetNumRatsnests
();
ii
>
0
;
pt_chevelu
++
,
ii
--
)
{
{
if
(
(
pt_chevelu
->
pad_s
tart
==
pt_pad
)
if
(
(
pt_chevelu
->
m_PadS
tart
==
pt_pad
)
||
(
pt_chevelu
->
pad_e
nd
==
pt_pad
)
)
||
(
pt_chevelu
->
m_PadE
nd
==
pt_pad
)
)
{
{
if
(
pt_chevelu
->
s
tatus
&
CH_VISIBLE
)
if
(
pt_chevelu
->
m_S
tatus
&
CH_VISIBLE
)
continue
;
continue
;
pt_chevelu
->
s
tatus
|=
CH_VISIBLE
;
pt_chevelu
->
m_S
tatus
|=
CH_VISIBLE
;
if
(
(
pt_chevelu
->
s
tatus
&
CH_ACTIF
)
==
0
)
if
(
(
pt_chevelu
->
m_S
tatus
&
CH_ACTIF
)
==
0
)
continue
;
continue
;
GRSetDrawMode
(
DC
,
GR_XOR
);
GRSetDrawMode
(
DC
,
GR_XOR
);
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
pt_chevelu
->
pad_s
tart
->
m_Pos
.
x
,
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
pt_chevelu
->
m_PadS
tart
->
m_Pos
.
x
,
pt_chevelu
->
pad_s
tart
->
m_Pos
.
y
,
pt_chevelu
->
m_PadS
tart
->
m_Pos
.
y
,
pt_chevelu
->
pad_e
nd
->
m_Pos
.
x
,
pt_chevelu
->
m_PadE
nd
->
m_Pos
.
x
,
pt_chevelu
->
pad_e
nd
->
m_Pos
.
y
,
pt_chevelu
->
m_PadE
nd
->
m_Pos
.
y
,
0
,
0
,
g_DesignSettings
.
m_RatsnestColor
);
g_DesignSettings
.
m_RatsnestColor
);
}
}
...
@@ -442,10 +441,10 @@ void WinEDA_PcbFrame::Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC )
...
@@ -442,10 +441,10 @@ void WinEDA_PcbFrame::Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC )
if
(
(
pt_pad
==
NULL
)
&&
(
Module
==
NULL
)
)
if
(
(
pt_pad
==
NULL
)
&&
(
Module
==
NULL
)
)
{
{
DrawGeneralRatsnest
(
DC
);
DrawGeneralRatsnest
(
DC
);
pt_chevelu
=
(
CHEVELU
*
)
GetBoard
()
->
m_Ratsnest
;
pt_chevelu
=
(
RATSNEST_ITEM
*
)
GetBoard
()
->
m_Ratsnest
;
for
(
ii
=
GetBoard
()
->
GetNumRatsnests
();
(
ii
>
0
)
&&
pt_chevelu
;
pt_chevelu
++
,
ii
--
)
for
(
ii
=
GetBoard
()
->
GetNumRatsnests
();
(
ii
>
0
)
&&
pt_chevelu
;
pt_chevelu
++
,
ii
--
)
pt_chevelu
->
s
tatus
&=
~
CH_VISIBLE
;
pt_chevelu
->
m_S
tatus
&=
~
CH_VISIBLE
;
}
}
}
}
...
@@ -459,21 +458,21 @@ void WinEDA_PcbFrame::Affiche_PadsNoConnect( wxDC* DC )
...
@@ -459,21 +458,21 @@ void WinEDA_PcbFrame::Affiche_PadsNoConnect( wxDC* DC )
*/
*/
{
{
int
ii
;
int
ii
;
CHEVELU
*
pt_chevelu
;
RATSNEST_ITEM
*
pt_chevelu
;
D_PAD
*
pt_pad
;
D_PAD
*
pt_pad
;
pt_chevelu
=
(
CHEVELU
*
)
GetBoard
()
->
m_Ratsnest
;
pt_chevelu
=
(
RATSNEST_ITEM
*
)
GetBoard
()
->
m_Ratsnest
;
for
(
ii
=
GetBoard
()
->
GetNumRatsnests
();
ii
>
0
;
pt_chevelu
++
,
ii
--
)
for
(
ii
=
GetBoard
()
->
GetNumRatsnests
();
ii
>
0
;
pt_chevelu
++
,
ii
--
)
{
{
if
(
(
pt_chevelu
->
s
tatus
&
CH_ACTIF
)
==
0
)
if
(
(
pt_chevelu
->
m_S
tatus
&
CH_ACTIF
)
==
0
)
continue
;
continue
;
pt_pad
=
pt_chevelu
->
pad_s
tart
;
pt_pad
=
pt_chevelu
->
m_PadS
tart
;
if
(
pt_pad
)
if
(
pt_pad
)
pt_pad
->
Draw
(
DrawPanel
,
DC
,
GR_OR
|
GR_SURBRILL
);
pt_pad
->
Draw
(
DrawPanel
,
DC
,
GR_OR
|
GR_SURBRILL
);
pt_pad
=
pt_chevelu
->
pad_e
nd
;
pt_pad
=
pt_chevelu
->
m_PadE
nd
;
if
(
pt_pad
)
if
(
pt_pad
)
pt_pad
->
Draw
(
DrawPanel
,
DC
,
GR_OR
|
GR_SURBRILL
);
pt_pad
->
Draw
(
DrawPanel
,
DC
,
GR_OR
|
GR_SURBRILL
);
}
}
...
...
pcbnew/export_gencad.cpp
View file @
e073bdc0
...
@@ -433,25 +433,26 @@ void CreateSignalsSection( FILE* file, BOARD* pcb )
...
@@ -433,25 +433,26 @@ void CreateSignalsSection( FILE* file, BOARD* pcb )
*/
*/
{
{
wxString
msg
;
wxString
msg
;
EQUIPOT
*
equipo
t
;
NETINFO_ITEM
*
ne
t
;
D_PAD
*
pad
;
D_PAD
*
pad
;
MODULE
*
module
;
MODULE
*
module
;
int
NbNoConn
=
1
;
int
NbNoConn
=
1
;
fputs
(
"$SIGNALS
\n
"
,
file
);
fputs
(
"$SIGNALS
\n
"
,
file
);
for
(
equipot
=
pcb
->
m_Equipots
;
equipot
!=
NULL
;
equipot
=
equipot
->
Next
()
)
for
(
unsigned
ii
=
0
;
ii
<
pcb
->
m_NetInfo
->
GetCount
()
;
ii
++
)
{
{
if
(
equipot
->
GetNetname
()
==
wxEmptyString
)
// dummy equipot (non connexion)
net
=
pcb
->
m_NetInfo
->
GetItem
(
ii
);
if
(
net
->
GetNetname
()
==
wxEmptyString
)
// dummy equipot (non connexion)
{
{
wxString
msg
;
msg
<<
wxT
(
"NoConnection"
)
<<
NbNoConn
++
;
wxString
msg
;
msg
<<
wxT
(
"NoConnection"
)
<<
NbNoConn
++
;
equipo
t
->
SetNetname
(
msg
);
;
ne
t
->
SetNetname
(
msg
);
;
}
}
if
(
equipo
t
->
GetNet
()
<=
0
)
// dummy equipot (non connexion)
if
(
ne
t
->
GetNet
()
<=
0
)
// dummy equipot (non connexion)
continue
;
continue
;
msg
=
wxT
(
"
\n
SIGNAL "
)
+
equipo
t
->
GetNetname
();
msg
=
wxT
(
"
\n
SIGNAL "
)
+
ne
t
->
GetNetname
();
fputs
(
CONV_TO_UTF8
(
msg
),
file
);
fputs
(
CONV_TO_UTF8
(
msg
),
file
);
fputs
(
"
\n
"
,
file
);
fputs
(
"
\n
"
,
file
);
...
@@ -461,7 +462,7 @@ void CreateSignalsSection( FILE* file, BOARD* pcb )
...
@@ -461,7 +462,7 @@ void CreateSignalsSection( FILE* file, BOARD* pcb )
for
(
pad
=
module
->
m_Pads
;
pad
!=
NULL
;
pad
=
pad
->
Next
()
)
for
(
pad
=
module
->
m_Pads
;
pad
!=
NULL
;
pad
=
pad
->
Next
()
)
{
{
wxString
padname
;
wxString
padname
;
if
(
pad
->
GetNet
()
!=
equipo
t
->
GetNet
()
)
if
(
pad
->
GetNet
()
!=
ne
t
->
GetNet
()
)
continue
;
continue
;
pad
->
ReturnStringPadName
(
padname
);
pad
->
ReturnStringPadName
(
padname
);
...
@@ -587,10 +588,10 @@ void CreateRoutesSection( FILE* file, BOARD* pcb )
...
@@ -587,10 +588,10 @@ void CreateRoutesSection( FILE* file, BOARD* pcb )
if
(
old_netcode
!=
track
->
GetNet
()
)
if
(
old_netcode
!=
track
->
GetNet
()
)
{
{
old_netcode
=
track
->
GetNet
();
old_netcode
=
track
->
GetNet
();
EQUIPOT
*
equipo
t
=
pcb
->
FindNet
(
track
->
GetNet
()
);
NETINFO_ITEM
*
ne
t
=
pcb
->
FindNet
(
track
->
GetNet
()
);
wxString
netname
;
wxString
netname
;
if
(
equipot
&&
(
equipo
t
->
GetNetname
()
!=
wxEmptyString
)
)
if
(
net
&&
(
ne
t
->
GetNetname
()
!=
wxEmptyString
)
)
netname
=
equipo
t
->
GetNetname
();
netname
=
ne
t
->
GetNetname
();
else
else
netname
=
wxT
(
"_noname_"
);
netname
=
wxT
(
"_noname_"
);
fprintf
(
file
,
"
\n
ROUTE %s
\n
"
,
CONV_TO_UTF8
(
netname
)
);
fprintf
(
file
,
"
\n
ROUTE %s
\n
"
,
CONV_TO_UTF8
(
netname
)
);
...
...
pcbnew/files.cpp
View file @
e073bdc0
...
@@ -262,7 +262,8 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append )
...
@@ -262,7 +262,8 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append )
SetLastProject
(
GetScreen
()
->
m_FileName
);
SetLastProject
(
GetScreen
()
->
m_FileName
);
/* Rebuild the new pad list (for drc and ratsnet control ...) */
/* Rebuild the new pad list (for drc and ratsnet control ...) */
build_liste_pads
();
GetBoard
()
->
m_Status_Pcb
=
0
;
GetBoard
()
->
Build_Pads_Full_List
();
GetBoard
()
->
DisplayInfo
(
this
);
GetBoard
()
->
DisplayInfo
(
this
);
DrawPanel
->
Refresh
(
true
);
DrawPanel
->
Refresh
(
true
);
...
...
pcbnew/globaleditpad.cpp
View file @
e073bdc0
...
@@ -8,7 +8,6 @@
...
@@ -8,7 +8,6 @@
#include "class_drawpanel.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "confirm.h"
#include "pcbnew.h"
#include "pcbnew.h"
#include "autorout.h"
#include "trigo.h"
#include "trigo.h"
#include "drag.h"
#include "drag.h"
...
@@ -279,7 +278,7 @@ void WinEDA_BasePcbFrame::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
...
@@ -279,7 +278,7 @@ void WinEDA_BasePcbFrame::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
if
(
pt_pad
->
m_Masque_Layer
!=
g_Pad_Master
.
m_Masque_Layer
)
if
(
pt_pad
->
m_Masque_Layer
!=
g_Pad_Master
.
m_Masque_Layer
)
continue
;
continue
;
else
else
m_Pcb
->
m_Status_Pcb
&=
~
(
LISTE_
CHEVELU
_OK
|
CONNEXION_OK
);
m_Pcb
->
m_Status_Pcb
&=
~
(
LISTE_
RATSNEST_ITEM
_OK
|
CONNEXION_OK
);
}
}
/* Modif des caracteristiques: */
/* Modif des caracteristiques: */
...
...
pcbnew/ioascii.cpp
View file @
e073bdc0
...
@@ -595,7 +595,7 @@ bool WinEDA_PcbFrame::WriteGeneralDescrPcb( FILE* File )
...
@@ -595,7 +595,7 @@ bool WinEDA_PcbFrame::WriteGeneralDescrPcb( FILE* File )
fprintf
(
File
,
"Nzone %d
\n
"
,
GetBoard
()
->
GetNumSegmZone
()
);
fprintf
(
File
,
"Nzone %d
\n
"
,
GetBoard
()
->
GetNumSegmZone
()
);
fprintf
(
File
,
"Nmodule %d
\n
"
,
NbModules
);
fprintf
(
File
,
"Nmodule %d
\n
"
,
NbModules
);
fprintf
(
File
,
"Nnets %d
\n
"
,
GetBoard
()
->
m_
Equipots
.
GetCount
()
);
fprintf
(
File
,
"Nnets %d
\n
"
,
GetBoard
()
->
m_
NetInfo
->
GetCount
()
);
fprintf
(
File
,
"$EndGENERAL
\n\n
"
);
fprintf
(
File
,
"$EndGENERAL
\n\n
"
);
return
TRUE
;
return
TRUE
;
...
@@ -784,9 +784,9 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append )
...
@@ -784,9 +784,9 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append )
if
(
strnicmp
(
Line
,
"$EQUIPOT"
,
7
)
==
0
)
if
(
strnicmp
(
Line
,
"$EQUIPOT"
,
7
)
==
0
)
{
{
EQUIPOT
*
Equipot
=
new
EQUIPOT
(
GetBoard
()
);
NETINFO_ITEM
*
net
=
new
NETINFO_ITEM
(
GetBoard
()
);
GetBoard
()
->
m_
Equipots
.
PushBack
(
Equipo
t
);
GetBoard
()
->
m_
NetInfo
->
Append
(
ne
t
);
Equipo
t
->
ReadDescr
(
File
,
&
LineNum
);
ne
t
->
ReadDescr
(
File
,
&
LineNum
);
continue
;
continue
;
}
}
...
...
pcbnew/librairi.cpp
View file @
e073bdc0
...
@@ -131,7 +131,7 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC )
...
@@ -131,7 +131,7 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC )
module
->
DisplayInfo
(
this
);
module
->
DisplayInfo
(
this
);
Place_Module
(
module
,
DC
);
Place_Module
(
module
,
DC
);
GetBoard
()
->
m_Status_Pcb
=
0
;
GetBoard
()
->
m_Status_Pcb
=
0
;
build_liste_pads
();
GetBoard
()
->
Build_Pads_Full_List
();
return
module
;
return
module
;
}
}
...
...
pcbnew/loadcmp.cpp
View file @
e073bdc0
...
@@ -77,7 +77,7 @@ void WinEDA_ModuleEditFrame::Load_Module_Module_From_BOARD( MODULE* Module )
...
@@ -77,7 +77,7 @@ void WinEDA_ModuleEditFrame::Load_Module_Module_From_BOARD( MODULE* Module )
Module
->
m_Flags
=
0
;
Module
->
m_Flags
=
0
;
build_liste_pads
();
GetBoard
()
->
Build_Pads_Full_List
();
GetScreen
()
->
m_Curseur
.
x
=
GetScreen
()
->
m_Curseur
.
y
=
0
;
GetScreen
()
->
m_Curseur
.
x
=
GetScreen
()
->
m_Curseur
.
y
=
0
;
Place_Module
(
Module
,
NULL
);
Place_Module
(
Module
,
NULL
);
...
@@ -162,7 +162,7 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library,
...
@@ -162,7 +162,7 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library,
module
->
m_TimeStamp
=
GetTimeStamp
();
module
->
m_TimeStamp
=
GetTimeStamp
();
GetBoard
()
->
m_Status_Pcb
=
0
;
GetBoard
()
->
m_Status_Pcb
=
0
;
module
->
SetPosition
(
curspos
);
module
->
SetPosition
(
curspos
);
build_liste_pads
();
GetBoard
()
->
Build_Pads_Full_List
();
if
(
DC
)
if
(
DC
)
module
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
module
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
}
}
...
...
pcbnew/modedit_onclick.cpp
View file @
e073bdc0
...
@@ -333,7 +333,6 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
...
@@ -333,7 +333,6 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
case
TYPE_SCREEN
:
case
TYPE_SCREEN
:
case
TYPE_NOT_INIT
:
case
TYPE_NOT_INIT
:
case
TYPE_PCB
:
case
TYPE_PCB
:
case
TYPE_EQUIPOT
:
msg
.
Printf
(
msg
.
Printf
(
wxT
(
"WinEDA_ModuleEditFrame::OnRightClick Error: illegal DrawType %d"
),
wxT
(
"WinEDA_ModuleEditFrame::OnRightClick Error: illegal DrawType %d"
),
DrawStruct
->
Type
()
);
DrawStruct
->
Type
()
);
...
...
pcbnew/modules.cpp
View file @
e073bdc0
...
@@ -11,7 +11,6 @@
...
@@ -11,7 +11,6 @@
#include "confirm.h"
#include "confirm.h"
#include "pcbnew.h"
#include "pcbnew.h"
#include "autorout.h"
#include "trigo.h"
#include "trigo.h"
#include "protos.h"
#include "protos.h"
...
@@ -103,7 +102,7 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
...
@@ -103,7 +102,7 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
return
;
return
;
SetCurItem
(
module
);
SetCurItem
(
module
);
GetBoard
()
->
m_Status_Pcb
&=
~
CHEVELU
_LOCAL_OK
;
GetBoard
()
->
m_Status_Pcb
&=
~
RATSNEST_ITEM
_LOCAL_OK
;
module
->
m_Flags
|=
IS_MOVED
;
module
->
m_Flags
|=
IS_MOVED
;
ModuleInitOrient
=
module
->
m_Orient
;
ModuleInitOrient
=
module
->
m_Orient
;
ModuleInitLayer
=
module
->
GetLayer
();
ModuleInitLayer
=
module
->
GetLayer
();
...
@@ -154,7 +153,7 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC )
...
@@ -154,7 +153,7 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC )
WinEDA_BasePcbFrame
*
pcbframe
=
(
WinEDA_BasePcbFrame
*
)
Panel
->
m_Parent
;
WinEDA_BasePcbFrame
*
pcbframe
=
(
WinEDA_BasePcbFrame
*
)
Panel
->
m_Parent
;
module
=
(
MODULE
*
)
pcbframe
->
GetScreen
()
->
GetCurItem
();
module
=
(
MODULE
*
)
pcbframe
->
GetScreen
()
->
GetCurItem
();
pcbframe
->
GetBoard
()
->
m_Status_Pcb
&=
~
CHEVELU
_LOCAL_OK
;
pcbframe
->
GetBoard
()
->
m_Status_Pcb
&=
~
RATSNEST_ITEM
_LOCAL_OK
;
if
(
module
)
if
(
module
)
{
{
...
@@ -195,7 +194,7 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC )
...
@@ -195,7 +194,7 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC )
module
->
DeleteStructure
();
module
->
DeleteStructure
();
module
=
NULL
;
module
=
NULL
;
pcbframe
->
GetBoard
()
->
m_Status_Pcb
=
0
;
pcbframe
->
GetBoard
()
->
m_Status_Pcb
=
0
;
pcbframe
->
build_liste_pads
();
pcbframe
->
GetBoard
()
->
Build_Pads_Full_List
();
}
}
}
}
...
@@ -250,10 +249,10 @@ MODULE* WinEDA_BasePcbFrame::Copie_Module( MODULE* module )
...
@@ -250,10 +249,10 @@ MODULE* WinEDA_BasePcbFrame::Copie_Module( MODULE* module )
newmodule
->
m_Flags
=
IS_NEW
;
newmodule
->
m_Flags
=
IS_NEW
;
build_liste_pads
();
GetBoard
()
->
Build_Pads_Full_List
();
newmodule
->
DisplayInfo
(
this
);
newmodule
->
DisplayInfo
(
this
);
GetBoard
()
->
m_Status_Pcb
&=
~
CHEVELU
_LOCAL_OK
;
GetBoard
()
->
m_Status_Pcb
&=
~
RATSNEST_ITEM
_LOCAL_OK
;
return
newmodule
;
return
newmodule
;
}
}
...
@@ -329,7 +328,7 @@ bool WinEDA_PcbFrame::Delete_Module( MODULE* module, wxDC* DC, bool aAskBeforeDe
...
@@ -329,7 +328,7 @@ bool WinEDA_PcbFrame::Delete_Module( MODULE* module, wxDC* DC, bool aAskBeforeDe
SaveItemEfface
(
module
,
1
);
SaveItemEfface
(
module
,
1
);
GetBoard
()
->
m_Status_Pcb
=
0
;
GetBoard
()
->
m_Status_Pcb
=
0
;
build_liste_pads
();
GetBoard
()
->
Build_Pads_Full_List
();
ReCompile_Ratsnest_After_Changes
(
DC
);
ReCompile_Ratsnest_After_Changes
(
DC
);
// redraw the area where the module was
// redraw the area where the module was
...
@@ -367,7 +366,7 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC )
...
@@ -367,7 +366,7 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC )
if
(
!
(
Module
->
m_Flags
&
IS_MOVED
)
)
if
(
!
(
Module
->
m_Flags
&
IS_MOVED
)
)
{
{
m_Status_Pcb
&=
~
(
LISTE_
CHEVELU
_OK
|
CONNEXION_OK
);
m_Status_Pcb
&=
~
(
LISTE_
RATSNEST_ITEM
_OK
|
CONNEXION_OK
);
if
(
DC
&&
m_PcbFrame
)
if
(
DC
&&
m_PcbFrame
)
{
{
int
tmp
=
Module
->
m_Flags
;
int
tmp
=
Module
->
m_Flags
;
...
@@ -540,7 +539,7 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC )
...
@@ -540,7 +539,7 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC )
DrawModuleOutlines
(
m_PcbFrame
->
DrawPanel
,
DC
,
Module
);
DrawModuleOutlines
(
m_PcbFrame
->
DrawPanel
,
DC
,
Module
);
Dessine_Segments_Dragges
(
m_PcbFrame
->
DrawPanel
,
DC
);
Dessine_Segments_Dragges
(
m_PcbFrame
->
DrawPanel
,
DC
);
}
}
m_Status_Pcb
&=
~
CHEVELU
_LOCAL_OK
;
m_Status_Pcb
&=
~
RATSNEST_ITEM
_LOCAL_OK
;
}
}
}
}
...
@@ -669,7 +668,7 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module, wxDC* DC )
...
@@ -669,7 +668,7 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module, wxDC* DC )
return
;
return
;
GetScreen
()
->
SetModify
();
GetScreen
()
->
SetModify
();
GetBoard
()
->
m_Status_Pcb
&=
~
(
LISTE_
CHEVELU
_OK
|
CONNEXION_OK
);
GetBoard
()
->
m_Status_Pcb
&=
~
(
LISTE_
RATSNEST_ITEM
_OK
|
CONNEXION_OK
);
if
(
g_Show_Module_Ratsnest
&&
(
GetBoard
()
->
m_Status_Pcb
&
LISTE_PAD_OK
)
&&
DC
)
if
(
g_Show_Module_Ratsnest
&&
(
GetBoard
()
->
m_Status_Pcb
&
LISTE_PAD_OK
)
&&
DC
)
trace_ratsnest_module
(
DC
);
trace_ratsnest_module
(
DC
);
...
@@ -750,7 +749,7 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module,
...
@@ -750,7 +749,7 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module,
}
}
}
}
GetBoard
()
->
m_Status_Pcb
&=
~
(
LISTE_
CHEVELU
_OK
|
CONNEXION_OK
);
GetBoard
()
->
m_Status_Pcb
&=
~
(
LISTE_
RATSNEST_ITEM
_OK
|
CONNEXION_OK
);
if
(
incremental
)
if
(
incremental
)
module
->
SetOrientation
(
module
->
m_Orient
+
angle
);
module
->
SetOrientation
(
module
->
m_Orient
+
angle
);
...
...
pcbnew/move-drag_pads.cpp
View file @
e073bdc0
...
@@ -8,7 +8,6 @@
...
@@ -8,7 +8,6 @@
#include "class_drawpanel.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "confirm.h"
#include "pcbnew.h"
#include "pcbnew.h"
#include "autorout.h"
#include "trigo.h"
#include "trigo.h"
#include "drag.h"
#include "drag.h"
...
@@ -357,7 +356,7 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
...
@@ -357,7 +356,7 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
GetScreen
()
->
SetModify
();
GetScreen
()
->
SetModify
();
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
m_Pcb
->
m_Status_Pcb
&=
~
(
LISTE_
CHEVELU
_OK
|
CONNEXION_OK
);
m_Pcb
->
m_Status_Pcb
&=
~
(
LISTE_
RATSNEST_ITEM
_OK
|
CONNEXION_OK
);
}
}
...
...
pcbnew/onleftclick.cpp
View file @
e073bdc0
...
@@ -139,7 +139,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
...
@@ -139,7 +139,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
GetBoard
()
->
DisplayInfo
(
this
);
GetBoard
()
->
DisplayInfo
(
this
);
else
else
{
{
EQUIPOT
*
net
=
GetBoard
()
->
FindNet
(
netcode
);
NETINFO_ITEM
*
net
=
GetBoard
()
->
FindNet
(
netcode
);
if
(
net
)
if
(
net
)
net
->
DisplayInfo
(
this
);
net
->
DisplayInfo
(
this
);
}
}
...
...
pcbnew/onrightclick.cpp
View file @
e073bdc0
...
@@ -302,9 +302,8 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
...
@@ -302,9 +302,8 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
case
TYPE_SCREEN
:
case
TYPE_SCREEN
:
case
TYPE_NOT_INIT
:
case
TYPE_NOT_INIT
:
case
TYPE_PCB
:
case
TYPE_PCB
:
case
TYPE_EQUIPOT
:
msg
.
Printf
(
msg
.
Printf
(
wxT
(
"WinEDA_PcbFrame::OnRightClick() Error:
illegal
DrawType %d"
),
wxT
(
"WinEDA_PcbFrame::OnRightClick() Error:
unexpected
DrawType %d"
),
item
->
Type
()
);
item
->
Type
()
);
DisplayError
(
this
,
msg
);
DisplayError
(
this
,
msg
);
SetCurItem
(
NULL
);
SetCurItem
(
NULL
);
...
...
pcbnew/ratsnest.cpp
View file @
e073bdc0
...
@@ -15,9 +15,10 @@
...
@@ -15,9 +15,10 @@
extern
char
*
adr_lowmem
;
/* adresse de base memoire de calcul disponible */
extern
char
*
adr_lowmem
;
/* adresse de base memoire de calcul disponible */
/* exported variables */
/* exported variables */
CHEVELU
*
g_pt_chevelu
;
RATSNEST_ITEM
*
g_pt_chevelu
;
CHEVELU
*
local_liste_chevelu
;
// Buffer address for local ratsnest
RATSNEST_ITEM
*
local_liste_chevelu
;
// Buffer address for local ratsnest
// (ratnest relative to one footprint while moving it
// (ratnest relative to one footprint while moving it
int
nb_local_chevelu
;
// link count (active ratnest count) for the footprint beeing moved
int
nb_local_chevelu
;
// link count (active ratnest count) for the footprint beeing moved
...
@@ -100,38 +101,44 @@ static bool DisplayRastnestInProgress; // Enable the display of the ratsnes
...
@@ -100,38 +101,44 @@ static bool DisplayRastnestInProgress; // Enable the display of the ratsnes
void
WinEDA_BasePcbFrame
::
Compile_Ratsnest
(
wxDC
*
DC
,
bool
display_status_pcb
)
void
WinEDA_BasePcbFrame
::
Compile_Ratsnest
(
wxDC
*
DC
,
bool
display_status_pcb
)
/******************************************************************************/
/******************************************************************************/
/*
/*
* Function Compile_Ratsnest
* Create the entire board ratsnesr.
* Create the entire board ratsnesr.
* Msut be called AFTER the connectivity computation
* Msut be called AFTER the connectivity computation
* Must be called after a board change (changes for
* Must be called after a board change (changes for
* pads, footprints or a read netlist ).
* pads, footprints or a read netlist ).
*
*
*
if display_status_pcb == true : D
isplay the computation results
*
@param display_status_pcb : if true, d
isplay the computation results
*/
*/
{
{
wxString
msg
;
wxString
msg
;
DisplayRastnestInProgress
=
TRUE
;
DisplayRastnestInProgress
=
TRUE
;
/* Create the sorted pad list */
m_Pcb
->
m_Status_Pcb
=
0
;
/* we want a full ratnest computation, from the scratch */
build_liste_pads
();
GetBoard
()
->
m_Status_Pcb
=
0
;
/* we want a full ratnest computation, from the scratch */
GetBoard
()
->
Build_Pads_Full_List
();
/* Create the sorted pad list */
MsgPanel
->
EraseMsgBox
();
MsgPanel
->
EraseMsgBox
();
msg
.
Printf
(
wxT
(
" %d"
),
m_Pcb
->
m_Pads
.
size
()
);
if
(
display_status_pcb
)
Affiche_1_Parametre
(
this
,
1
,
wxT
(
"pads"
),
msg
,
RED
);
{
msg
.
Printf
(
wxT
(
" %d"
),
m_Pcb
->
m_Pads
.
size
()
);
Affiche_1_Parametre
(
this
,
1
,
wxT
(
"pads"
),
msg
,
RED
);
}
msg
.
Printf
(
wxT
(
" %d"
),
m_Pcb
->
m_Equipots
.
GetCount
()
);
//Rebuild the net info list
Affiche_1_Parametre
(
this
,
8
,
wxT
(
"Nets"
),
msg
,
CYAN
);
RecalculateAllTracksNetcode
(
);
reattribution_reference_piste
(
display_status_pcb
);
if
(
display_status_pcb
)
{
msg
.
Printf
(
wxT
(
" %d"
),
m_Pcb
->
m_NetInfo
->
GetCount
()
);
Affiche_1_Parametre
(
this
,
8
,
wxT
(
"Nets"
),
msg
,
CYAN
);
}
/* Compute the full ratsnest
/* Compute the full ratsnest
* which can be see like all the possible links or logical connections.
* which can be see like all the possible links or logical connections.
* some of thems are active (no track connected) and others are inactive (when track connect pads)
* some of thems are active (no track connected) and others are inactive (when track connect pads)
* This full ratsnest is not modified by track editing.
* This full ratsnest is not modified by track editing.
* It change only when a netlist is read, or footprints are modified
* It change
s
only when a netlist is read, or footprints are modified
*/
*/
Build_Board_Ratsnest
(
DC
);
Build_Board_Ratsnest
(
DC
);
...
@@ -161,8 +168,8 @@ static int tri_par_net( const void* o1, const void* o2 )
...
@@ -161,8 +168,8 @@ static int tri_par_net( const void* o1, const void* o2 )
* Sort pads by net code
* Sort pads by net code
*/
*/
{
{
LISTE_PAD
*
pt_ref
=
(
LISTE_PAD
*
)
o1
;
D_PAD
**
pt_ref
=
(
D_PAD
*
*
)
o1
;
LISTE_PAD
*
pt_compare
=
(
LISTE_PAD
*
)
o2
;
D_PAD
**
pt_compare
=
(
D_PAD
*
*
)
o2
;
return
(
*
pt_ref
)
->
GetNet
()
-
(
*
pt_compare
)
->
GetNet
();
return
(
*
pt_ref
)
->
GetNet
()
-
(
*
pt_compare
)
->
GetNet
();
}
}
...
@@ -176,16 +183,16 @@ static int sort_by_length( const void* o1, const void* o2 )
...
@@ -176,16 +183,16 @@ static int sort_by_length( const void* o1, const void* o2 )
* Sort ratsnest by lenght
* Sort ratsnest by lenght
*/
*/
{
{
CHEVELU
*
ref
=
(
CHEVELU
*
)
o1
;
RATSNEST_ITEM
*
ref
=
(
RATSNEST_ITEM
*
)
o1
;
CHEVELU
*
compare
=
(
CHEVELU
*
)
o2
;
RATSNEST_ITEM
*
compare
=
(
RATSNEST_ITEM
*
)
o2
;
return
ref
->
dist
-
compare
->
dis
t
;
return
ref
->
m_Lenght
-
compare
->
m_Lengh
t
;
}
}
/*****************************************************************************/
/*****************************************************************************/
static
int
gen_rats_block_to_block
(
WinEDA_DrawPanel
*
DrawPanel
,
wxDC
*
DC
,
static
int
gen_rats_block_to_block
(
WinEDA_DrawPanel
*
DrawPanel
,
wxDC
*
DC
,
LISTE_PAD
*
pt_liste_pad
,
LISTE_PAD
*
pt_limite
,
int
*
nblinks
)
D_PAD
**
pt_liste_pad
,
D_PAD
*
*
pt_limite
,
int
*
nblinks
)
/*****************************************************************************/
/*****************************************************************************/
/**
/**
...
@@ -206,10 +213,10 @@ static int gen_rats_block_to_block( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
...
@@ -206,10 +213,10 @@ static int gen_rats_block_to_block( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
{
{
int
dist_min
,
current_dist
;
int
dist_min
,
current_dist
;
int
current_num_block
=
1
;
int
current_num_block
=
1
;
LISTE_PAD
*
pt_liste_pad_tmp
;
D_PAD
*
*
pt_liste_pad_tmp
;
LISTE_PAD
*
pt_liste_pad_aux
;
D_PAD
*
*
pt_liste_pad_aux
;
LISTE_PAD
*
pt_liste_pad_block1
=
NULL
;
D_PAD
*
*
pt_liste_pad_block1
=
NULL
;
LISTE_PAD
*
pt_start_liste
;
D_PAD
*
*
pt_start_liste
;
pt_liste_pad_tmp
=
NULL
;
pt_liste_pad_tmp
=
NULL
;
...
@@ -278,16 +285,16 @@ static int gen_rats_block_to_block( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
...
@@ -278,16 +285,16 @@ static int gen_rats_block_to_block( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
/* Create the new ratsnet */
/* Create the new ratsnet */
(
*
nblinks
)
++
;
(
*
nblinks
)
++
;
g_pt_chevelu
->
SetNet
(
(
*
pt_liste_pad
)
->
GetNet
()
);
g_pt_chevelu
->
SetNet
(
(
*
pt_liste_pad
)
->
GetNet
()
);
g_pt_chevelu
->
s
tatus
=
CH_ACTIF
|
CH_VISIBLE
;
g_pt_chevelu
->
m_S
tatus
=
CH_ACTIF
|
CH_VISIBLE
;
g_pt_chevelu
->
dis
t
=
dist_min
;
g_pt_chevelu
->
m_Lengh
t
=
dist_min
;
g_pt_chevelu
->
pad_s
tart
=
*
pt_liste_pad
;
g_pt_chevelu
->
m_PadS
tart
=
*
pt_liste_pad
;
g_pt_chevelu
->
pad_e
nd
=
*
pt_liste_pad_tmp
;
g_pt_chevelu
->
m_PadE
nd
=
*
pt_liste_pad_tmp
;
if
(
DisplayRastnestInProgress
&&
DC
)
if
(
DisplayRastnestInProgress
&&
DC
)
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
g_pt_chevelu
->
pad_s
tart
->
m_Pos
.
x
,
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
g_pt_chevelu
->
m_PadS
tart
->
m_Pos
.
x
,
g_pt_chevelu
->
pad_s
tart
->
m_Pos
.
y
,
g_pt_chevelu
->
m_PadS
tart
->
m_Pos
.
y
,
g_pt_chevelu
->
pad_e
nd
->
m_Pos
.
x
,
g_pt_chevelu
->
m_PadE
nd
->
m_Pos
.
x
,
g_pt_chevelu
->
pad_e
nd
->
m_Pos
.
y
,
g_pt_chevelu
->
m_PadE
nd
->
m_Pos
.
y
,
0
,
g_DesignSettings
.
m_RatsnestColor
);
0
,
g_DesignSettings
.
m_RatsnestColor
);
g_pt_chevelu
++
;
g_pt_chevelu
++
;
...
@@ -298,8 +305,8 @@ static int gen_rats_block_to_block( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
...
@@ -298,8 +305,8 @@ static int gen_rats_block_to_block( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
/*****************************************************************************/
/*****************************************************************************/
static
int
gen_rats_pad_to_pad
(
WinEDA_DrawPanel
*
DrawPanel
,
wxDC
*
DC
,
static
int
gen_rats_pad_to_pad
(
WinEDA_DrawPanel
*
DrawPanel
,
wxDC
*
DC
,
LISTE_PAD
*
pt_liste_pad
,
D_PAD
*
*
pt_liste_pad
,
LISTE_PAD
*
pt_limite
,
int
current_num_block
,
int
*
nblinks
)
D_PAD
*
*
pt_limite
,
int
current_num_block
,
int
*
nblinks
)
/*****************************************************************************/
/*****************************************************************************/
/**
/**
...
@@ -325,9 +332,9 @@ static int gen_rats_pad_to_pad( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
...
@@ -325,9 +332,9 @@ static int gen_rats_pad_to_pad( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
*/
*/
{
{
int
dist_min
,
current_dist
;
int
dist_min
,
current_dist
;
LISTE_PAD
*
pt_liste_pad_tmp
;
D_PAD
*
*
pt_liste_pad_tmp
;
LISTE_PAD
*
pt_liste_pad_aux
;
D_PAD
*
*
pt_liste_pad_aux
;
LISTE_PAD
*
pt_start_liste
;
D_PAD
*
*
pt_start_liste
;
D_PAD
*
ref_pad
,
*
pad
;
D_PAD
*
ref_pad
,
*
pad
;
pt_start_liste
=
pt_liste_pad
;
pt_start_liste
=
pt_liste_pad
;
...
@@ -356,8 +363,8 @@ static int gen_rats_pad_to_pad( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
...
@@ -356,8 +363,8 @@ static int gen_rats_pad_to_pad( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
pad
=
*
pt_liste_pad_aux
;
pad
=
*
pt_liste_pad_aux
;
/* Compare distance between pads ("Manhattan" distance) */
/* Compare distance between pads ("Manhattan" distance) */
current_dist
=
abs
(
pad
->
m_Pos
.
x
-
ref_pad
->
m_Pos
.
x
)
+
current_dist
=
abs
(
pad
->
m_Pos
.
x
-
ref_pad
->
m_Pos
.
x
)
+
abs
(
pad
->
m_Pos
.
y
-
ref_pad
->
m_Pos
.
y
);
abs
(
pad
->
m_Pos
.
y
-
ref_pad
->
m_Pos
.
y
);
if
(
dist_min
>
current_dist
)
if
(
dist_min
>
current_dist
)
{
{
...
@@ -376,28 +383,28 @@ static int gen_rats_pad_to_pad( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
...
@@ -376,28 +383,28 @@ static int gen_rats_pad_to_pad( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
if
(
(
pad
->
GetSubRatsnest
()
==
0
)
&&
(
ref_pad
->
GetSubRatsnest
()
==
0
)
)
if
(
(
pad
->
GetSubRatsnest
()
==
0
)
&&
(
ref_pad
->
GetSubRatsnest
()
==
0
)
)
{
{
current_num_block
++
;
current_num_block
++
;
pad
->
SetSubRatsnest
(
current_num_block
);
pad
->
SetSubRatsnest
(
current_num_block
);
ref_pad
->
SetSubRatsnest
(
current_num_block
);
ref_pad
->
SetSubRatsnest
(
current_num_block
);
}
}
/* If a pad is already connected connected : merge the other pad in the block */
/* If a pad is already connected connected : merge the other pad in the block */
else
else
{
{
ref_pad
->
SetSubRatsnest
(
pad
->
GetSubRatsnest
());
ref_pad
->
SetSubRatsnest
(
pad
->
GetSubRatsnest
()
);
}
}
(
*
nblinks
)
++
;
(
*
nblinks
)
++
;
g_pt_chevelu
->
SetNet
(
ref_pad
->
GetNet
()
);
g_pt_chevelu
->
SetNet
(
ref_pad
->
GetNet
()
);
g_pt_chevelu
->
s
tatus
=
CH_ACTIF
|
CH_VISIBLE
;
g_pt_chevelu
->
m_S
tatus
=
CH_ACTIF
|
CH_VISIBLE
;
g_pt_chevelu
->
dis
t
=
dist_min
;
g_pt_chevelu
->
m_Lengh
t
=
dist_min
;
g_pt_chevelu
->
pad_s
tart
=
ref_pad
;
g_pt_chevelu
->
m_PadS
tart
=
ref_pad
;
g_pt_chevelu
->
pad_e
nd
=
pad
;
g_pt_chevelu
->
m_PadE
nd
=
pad
;
if
(
DisplayRastnestInProgress
&&
DC
)
if
(
DisplayRastnestInProgress
&&
DC
)
{
{
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
g_pt_chevelu
->
pad_s
tart
->
m_Pos
.
x
,
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
g_pt_chevelu
->
m_PadS
tart
->
m_Pos
.
x
,
g_pt_chevelu
->
pad_s
tart
->
m_Pos
.
y
,
g_pt_chevelu
->
m_PadS
tart
->
m_Pos
.
y
,
g_pt_chevelu
->
pad_e
nd
->
m_Pos
.
x
,
g_pt_chevelu
->
m_PadE
nd
->
m_Pos
.
x
,
g_pt_chevelu
->
pad_e
nd
->
m_Pos
.
y
,
g_pt_chevelu
->
m_PadE
nd
->
m_Pos
.
y
,
0
,
g_DesignSettings
.
m_RatsnestColor
);
0
,
g_DesignSettings
.
m_RatsnestColor
);
}
}
g_pt_chevelu
++
;
g_pt_chevelu
++
;
...
@@ -438,15 +445,11 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC )
...
@@ -438,15 +445,11 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC )
*
*
*/
*/
{
{
LISTE_PAD
*
pt_liste_pad
,
*
pt_start_liste
,
*
pt_end_liste
,
*
pt_liste_pad_limite
;
D_PAD
*
pad
;
D_PAD
*
pad
;
int
noconn
;
int
num_block
,
nbpads
;
int
ii
;
CHEVELU
*
pt_deb_liste_ch
;
int
current_net_code
,
noconn
;
m_Pcb
->
m_NbNoconnect
=
0
;
m_Pcb
->
m_NbNoconnect
=
0
;
m_Pcb
->
m_NbLinks
=
0
;
m_Pcb
->
m_NbLinks
=
0
;
if
(
m_Pcb
->
m_Ratsnest
)
if
(
m_Pcb
->
m_Ratsnest
)
MyFree
(
m_Pcb
->
m_Ratsnest
);
MyFree
(
m_Pcb
->
m_Ratsnest
);
...
@@ -458,17 +461,14 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC )
...
@@ -458,17 +461,14 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC )
/* Created pad list and the net_codes if needed */
/* Created pad list and the net_codes if needed */
if
(
(
m_Pcb
->
m_Status_Pcb
&
NET_CODES_OK
)
==
0
)
if
(
(
m_Pcb
->
m_Status_Pcb
&
NET_CODES_OK
)
==
0
)
recalcule_pad_net_code
();
m_Pcb
->
m_NetInfo
->
BuildListOfNets
();
for
(
unsigned
i
=
0
;
i
<
m_Pcb
->
m_Pads
.
size
();
++
i
)
for
(
unsigned
i
i
=
0
;
ii
<
m_Pcb
->
m_Pads
.
size
();
++
i
i
)
{
{
pad
=
m_Pcb
->
m_Pads
[
i
];
pad
=
m_Pcb
->
m_Pads
[
i
i
];
pad
->
SetSubRatsnest
(
0
);
pad
->
SetSubRatsnest
(
0
);
}
}
/* Sort the pad list by nets */
qsort
(
&
m_Pcb
->
m_Pads
[
0
],
m_Pcb
->
m_Pads
.
size
(),
sizeof
(
LISTE_PAD
),
tri_par_net
);
/* Allocate memory for buffer ratsnest: there are nb_nodes - 1 ratsnest
/* Allocate memory for buffer ratsnest: there are nb_nodes - 1 ratsnest
* maximum ( 1 node = 1 active pad ).
* maximum ( 1 node = 1 active pad ).
* Memory is allocated for nb_nodes ratsnests... (+ a bit more, just in case)
* Memory is allocated for nb_nodes ratsnests... (+ a bit more, just in case)
...
@@ -477,7 +477,7 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC )
...
@@ -477,7 +477,7 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC )
if
(
m_Pcb
->
m_NbNodes
==
0
)
if
(
m_Pcb
->
m_NbNodes
==
0
)
return
;
/* pas de connexions utiles */
return
;
/* pas de connexions utiles */
m_Pcb
->
m_Ratsnest
=
(
CHEVELU
*
)
MyZMalloc
(
(
m_Pcb
->
m_NbNodes
+
10
)
*
sizeof
(
CHEVELU
)
);
m_Pcb
->
m_Ratsnest
=
(
RATSNEST_ITEM
*
)
MyZMalloc
(
(
m_Pcb
->
m_NbNodes
+
10
)
*
sizeof
(
RATSNEST_ITEM
)
);
if
(
m_Pcb
->
m_Ratsnest
==
NULL
)
if
(
m_Pcb
->
m_Ratsnest
==
NULL
)
return
;
return
;
...
@@ -485,104 +485,63 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC )
...
@@ -485,104 +485,63 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC )
DisplayRastnestInProgress
=
TRUE
;
DisplayRastnestInProgress
=
TRUE
;
g_pt_chevelu
=
m_Pcb
->
m_Ratsnest
;
g_pt_chevelu
=
m_Pcb
->
m_Ratsnest
;
pt_liste_pad
=
pt_start_liste
=
&
m_Pcb
->
m_Pads
[
0
];
unsigned
current_net_code
=
1
;
// 1er net_code a analyser (net_code = 0 -> no connect)
pt_liste_pad_limite
=
pt_start_liste
+
m_Pcb
->
m_Pads
.
size
();
noconn
=
0
;
current_net_code
=
1
;
// 1er net_code a analyser (net_code = 0 -> no connect)
EQUIPOT
*
equipot
=
m_Pcb
->
m_Equipots
;
for
(
;
current_net_code
<
m_Pcb
->
m_NetInfo
->
GetCount
();
current_net_code
++
)
noconn
=
0
;
for
(
;
pt_liste_pad
<
pt_liste_pad_limite
;
)
{
{
pt_deb_liste_ch
=
g_pt_chevelu
;
NETINFO_ITEM
*
net
=
m_Pcb
->
FindNet
(
current_net_code
);
pad
=
*
pt_liste_pad
;
net
->
m_RatsnestStart
=
g_pt_chevelu
;
m_Pcb
->
m_NbLinks
+=
net
->
m_ListPad
.
size
()
-
1
;
/* Skip the not connected pads */
if
(
pad
->
GetNet
()
==
0
)
{
pt_liste_pad
++
;
pt_start_liste
=
pt_liste_pad
;
continue
;
}
/* Search the end of pad list des pads for the current net */
int
num_block
=
0
;
num_block
=
pad
->
GetSubRatsnest
();
for
(
unsigned
ii
=
0
;
ii
<
net
->
m_ListPad
.
size
();
ii
++
)
nbpads
=
0
;
for
(
pt_end_liste
=
pt_liste_pad
+
1
;
;
pt_end_liste
++
)
{
{
if
(
pt_end_liste
>=
pt_liste_pad_limite
)
pad
=
net
->
m_ListPad
[
ii
];
break
;
pad
=
*
pt_end_liste
;
if
(
pad
->
GetNet
()
!=
current_net_code
)
break
;
nbpads
++
;
if
(
num_block
<
pad
->
GetSubRatsnest
()
)
if
(
num_block
<
pad
->
GetSubRatsnest
()
)
num_block
=
pad
->
GetSubRatsnest
();
num_block
=
pad
->
GetSubRatsnest
();
}
}
m_Pcb
->
m_NbLinks
+=
nbpads
;
/* Compute the ratsnest relative to the current net */
/* End of list found: Compute the ratsnest relative to the current net "net_code" */
equipot
=
m_Pcb
->
FindNet
(
current_net_code
);
if
(
equipot
==
NULL
)
DisplayError
(
this
,
wxT
(
"Gen ratsnest err: NULL equipot"
)
);
else
{
equipot
->
m_NbNodes
=
nbpads
;
equipot
->
m_NbLink
=
nbpads
+
1
;
equipot
->
m_PadzoneStart
=
pt_start_liste
;
equipot
->
m_PadzoneEnd
=
pt_end_liste
;
equipot
->
m_RatsnestStart
=
g_pt_chevelu
;
}
/* a - first pass : create the blocks from "not in block" pads */
/* a - first pass : create the blocks from not already in block pads */
ii
=
gen_rats_pad_to_pad
(
DrawPanel
,
DC
,
pt_start_liste
,
D_PAD
**
pstart
=
&
net
->
m_ListPad
[
0
];
pt_end_liste
,
num_block
,
&
noconn
);
D_PAD
**
pend
=
pstart
+
net
->
m_ListPad
.
size
();
int
icnt
=
gen_rats_pad_to_pad
(
DrawPanel
,
DC
,
pstart
,
pend
,
num_block
,
&
noconn
);
/* b - blocks connection (Iteration) */
/* b - blocks connection (Iteration) */
while
(
i
i
>
1
)
while
(
i
cnt
>
1
)
{
{
ii
=
gen_rats_block_to_block
(
DrawPanel
,
DC
,
pt_liste_pad
,
icnt
=
gen_rats_block_to_block
(
DrawPanel
,
DC
,
pstart
,
pend
,
&
noconn
);
pt_end_liste
,
&
noconn
);
}
}
if
(
equipot
)
net
->
m_RatsnestEnd
=
g_pt_chevelu
;
{
equipot
->
m_RatsnestEnd
=
g_pt_chevelu
;
/* sort by lenght */
/* sort by lenght */
qsort
(
equipot
->
m_RatsnestStart
,
qsort
(
net
->
m_RatsnestStart
,
equipot
->
m_RatsnestEnd
-
equipot
->
m_RatsnestStart
,
net
->
m_RatsnestEnd
-
net
->
m_RatsnestStart
,
sizeof
(
CHEVELU
),
sizeof
(
RATSNEST_ITEM
),
sort_by_length
);
sort_by_length
);
}
pt_liste_pad
=
pt_start_liste
=
pt_end_liste
;
pt_deb_liste_ch
=
g_pt_chevelu
;
if
(
pt_start_liste
<
pt_liste_pad_limite
)
current_net_code
=
(
*
pt_start_liste
)
->
GetNet
();
}
}
m_Pcb
->
m_NbNoconnect
=
noconn
;
m_Pcb
->
m_NbNoconnect
=
noconn
;
m_Pcb
->
m_Status_Pcb
|=
LISTE_
CHEVELU
_OK
;
m_Pcb
->
m_Status_Pcb
|=
LISTE_
RATSNEST_ITEM
_OK
;
// erase the ratsnest displayed on screen if needed
// erase the ratsnest displayed on screen if needed
CHEVELU
*
Chevelu
=
(
CHEVELU
*
)
m_Pcb
->
m_Ratsnest
;
RATSNEST_ITEM
*
Chevelu
=
m_Pcb
->
m_Ratsnest
;
if
(
DC
)
if
(
DC
)
GRSetDrawMode
(
DC
,
GR_XOR
);
GRSetDrawMode
(
DC
,
GR_XOR
);
for
(
i
i
=
m_Pcb
->
GetNumRatsnests
();
ii
>
0
;
ii
--
,
Chevelu
++
)
for
(
i
nt
ii
=
m_Pcb
->
GetNumRatsnests
();
ii
>
0
&&
Chevelu
;
ii
--
,
Chevelu
++
)
{
{
if
(
!
g_Show_Ratsnest
)
if
(
!
g_Show_Ratsnest
)
Chevelu
->
s
tatus
&=
~
CH_VISIBLE
;
Chevelu
->
m_S
tatus
&=
~
CH_VISIBLE
;
if
(
DC
)
if
(
DC
)
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
Chevelu
->
pad_start
->
m_Pos
.
x
,
Chevelu
->
pad_s
tart
->
m_Pos
.
y
,
Chevelu
->
m_PadStart
->
m_Pos
.
x
,
Chevelu
->
m_PadS
tart
->
m_Pos
.
y
,
Chevelu
->
pad_end
->
m_Pos
.
x
,
Chevelu
->
pad_e
nd
->
m_Pos
.
y
,
Chevelu
->
m_PadEnd
->
m_Pos
.
x
,
Chevelu
->
m_PadE
nd
->
m_Pos
.
y
,
0
,
g_DesignSettings
.
m_RatsnestColor
);
0
,
g_DesignSettings
.
m_RatsnestColor
);
}
}
}
}
...
@@ -611,9 +570,9 @@ void WinEDA_BasePcbFrame::DrawGeneralRatsnest( wxDC* DC, int net_code )
...
@@ -611,9 +570,9 @@ void WinEDA_BasePcbFrame::DrawGeneralRatsnest( wxDC* DC, int net_code )
*/
*/
{
{
int
ii
;
int
ii
;
CHEVELU
*
Chevelu
;
RATSNEST_ITEM
*
Chevelu
;
if
(
(
m_Pcb
->
m_Status_Pcb
&
LISTE_
CHEVELU
_OK
)
==
0
)
if
(
(
m_Pcb
->
m_Status_Pcb
&
LISTE_
RATSNEST_ITEM
_OK
)
==
0
)
return
;
return
;
if
(
(
m_Pcb
->
m_Status_Pcb
&
DO_NOT_SHOW_GENERAL_RASTNEST
)
)
if
(
(
m_Pcb
->
m_Status_Pcb
&
DO_NOT_SHOW_GENERAL_RASTNEST
)
)
return
;
return
;
...
@@ -627,25 +586,23 @@ void WinEDA_BasePcbFrame::DrawGeneralRatsnest( wxDC* DC, int net_code )
...
@@ -627,25 +586,23 @@ void WinEDA_BasePcbFrame::DrawGeneralRatsnest( wxDC* DC, int net_code )
GRSetDrawMode
(
DC
,
GR_XOR
);
GRSetDrawMode
(
DC
,
GR_XOR
);
for
(
ii
=
m_Pcb
->
GetNumRatsnests
();
ii
>
0
;
Chevelu
++
,
ii
--
)
for
(
ii
=
m_Pcb
->
GetNumRatsnests
();
ii
>
0
;
Chevelu
++
,
ii
--
)
{
{
if
(
(
Chevelu
->
s
tatus
&
(
CH_VISIBLE
|
CH_ACTIF
)
)
!=
(
CH_VISIBLE
|
CH_ACTIF
)
)
if
(
(
Chevelu
->
m_S
tatus
&
(
CH_VISIBLE
|
CH_ACTIF
)
)
!=
(
CH_VISIBLE
|
CH_ACTIF
)
)
continue
;
continue
;
if
(
(
net_code
<=
0
)
||
(
net_code
==
Chevelu
->
GetNet
()
)
)
if
(
(
net_code
<=
0
)
||
(
net_code
==
Chevelu
->
GetNet
()
)
)
{
{
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
Chevelu
->
pad_start
->
m_Pos
.
x
,
Chevelu
->
pad_s
tart
->
m_Pos
.
y
,
Chevelu
->
m_PadStart
->
m_Pos
.
x
,
Chevelu
->
m_PadS
tart
->
m_Pos
.
y
,
Chevelu
->
pad_end
->
m_Pos
.
x
,
Chevelu
->
pad_e
nd
->
m_Pos
.
y
,
Chevelu
->
m_PadEnd
->
m_Pos
.
x
,
Chevelu
->
m_PadE
nd
->
m_Pos
.
y
,
0
,
g_DesignSettings
.
m_RatsnestColor
);
0
,
g_DesignSettings
.
m_RatsnestColor
);
}
}
}
}
}
}
/*****************************************************************************/
/**********************************************************************************************/
static
int
tst_rats_block_to_block
(
WinEDA_DrawPanel
*
DrawPanel
,
wxDC
*
DC
,
static
int
tst_rats_block_to_block
(
WinEDA_DrawPanel
*
DrawPanel
,
wxDC
*
DC
,
NETINFO_ITEM
*
net
)
LISTE_PAD
*
pt_liste_pad_start
,
LISTE_PAD
*
pt_liste_pad_end
,
/**********************************************************************************************/
CHEVELU
*
start_rat_list
,
CHEVELU
*
end_rat_list
)
/*****************************************************************************/
/**
/**
* Function used by Tst_Ratsnest()
* Function used by Tst_Ratsnest()
...
@@ -658,29 +615,25 @@ static int tst_rats_block_to_block( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
...
@@ -658,29 +615,25 @@ static int tst_rats_block_to_block( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
* The function activate the smallest ratsnest between block 1 and the block n
* The function activate the smallest ratsnest between block 1 and the block n
* (activate a logical connexion)
* (activate a logical connexion)
*
*
* @param pt_liste_pad_start = adresse de debut de zone pad utile
* @param net = the current NETINFO_ITEM for the current net
* pt_liste_pad_end = adresse de fin de zone pad
* start_rat_list = adresse de debut de zone ratsnest utile
* end_rat_list = adresse de fin de zone ratsnest
* output:
* output:
* .state member of the ratsnests
* .state member of the ratsnests
* @return blocks not connected count
* @return blocks not connected count
*/
*/
{
{
int
current_num_block
,
min_block
;
int
current_num_block
,
min_block
;
LISTE_PAD
*
pt_liste_pad
;
RATSNEST_ITEM
*
chevelu
,
*
min_chevelu
;
CHEVELU
*
chevelu
,
*
min_chevelu
;
/* Search a link from a blockto an other block */
/* Search a link from a block
to an other block */
min_chevelu
=
NULL
;
min_chevelu
=
NULL
;
for
(
chevelu
=
start_rat_list
;
chevelu
<
end_rat_list
;
chevelu
++
)
for
(
chevelu
=
net
->
m_RatsnestStart
;
chevelu
<
net
->
m_RatsnestEnd
;
chevelu
++
)
{
{
if
(
chevelu
->
pad_start
->
GetSubRatsnest
()
==
chevelu
->
pad_e
nd
->
GetSubRatsnest
()
)
// Same block
if
(
chevelu
->
m_PadStart
->
GetSubRatsnest
()
==
chevelu
->
m_PadE
nd
->
GetSubRatsnest
()
)
// Same block
continue
;
continue
;
if
(
min_chevelu
==
NULL
)
if
(
min_chevelu
==
NULL
)
min_chevelu
=
chevelu
;
min_chevelu
=
chevelu
;
else
if
(
min_chevelu
->
dist
>
chevelu
->
dis
t
)
else
if
(
min_chevelu
->
m_Lenght
>
chevelu
->
m_Lengh
t
)
min_chevelu
=
chevelu
;
min_chevelu
=
chevelu
;
}
}
...
@@ -690,19 +643,19 @@ static int tst_rats_block_to_block( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
...
@@ -690,19 +643,19 @@ static int tst_rats_block_to_block( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
/* At this point we have found a link between 2 differents blocks (clusters) :
/* At this point we have found a link between 2 differents blocks (clusters) :
* we must set its status to ACTIVE and merge the 2 blocks
* we must set its status to ACTIVE and merge the 2 blocks
*/
*/
min_chevelu
->
s
tatus
|=
CH_ACTIF
;
min_chevelu
->
m_S
tatus
|=
CH_ACTIF
;
current_num_block
=
min_chevelu
->
pad_s
tart
->
GetSubRatsnest
();
current_num_block
=
min_chevelu
->
m_PadS
tart
->
GetSubRatsnest
();
min_block
=
min_chevelu
->
pad_e
nd
->
GetSubRatsnest
();
min_block
=
min_chevelu
->
m_PadE
nd
->
GetSubRatsnest
();
if
(
min_block
>
current_num_block
)
if
(
min_block
>
current_num_block
)
EXCHG
(
min_block
,
current_num_block
);
EXCHG
(
min_block
,
current_num_block
);
/* Merging the 2 blocks in one cluster */
/* Merging the 2 blocks in one cluster */
for
(
pt_liste_pad
=
pt_liste_pad_start
;
pt_liste_pad
<
pt_liste_pad_end
;
pt_liste_pad
++
)
for
(
unsigned
ii
=
0
;
ii
<
net
->
m_ListPad
.
size
();
ii
++
)
{
{
if
(
(
*
pt_liste_pad
)
->
GetSubRatsnest
()
==
current_num_block
)
if
(
net
->
m_ListPad
[
ii
]
->
GetSubRatsnest
()
==
current_num_block
)
{
{
(
*
pt_liste_pad
)
->
SetSubRatsnest
(
min_block
);
net
->
m_ListPad
[
ii
]
->
SetSubRatsnest
(
min_block
);
}
}
}
}
...
@@ -713,7 +666,7 @@ static int tst_rats_block_to_block( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
...
@@ -713,7 +666,7 @@ static int tst_rats_block_to_block( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
/*********************************************************************/
/*********************************************************************/
static
int
tst_rats_pad_to_pad
(
WinEDA_DrawPanel
*
DrawPanel
,
wxDC
*
DC
,
static
int
tst_rats_pad_to_pad
(
WinEDA_DrawPanel
*
DrawPanel
,
wxDC
*
DC
,
int
current_num_block
,
int
current_num_block
,
CHEVELU
*
start_rat_list
,
CHEVELU
*
end_rat_list
)
RATSNEST_ITEM
*
start_rat_list
,
RATSNEST_ITEM
*
end_rat_list
)
/**********************************************************************/
/**********************************************************************/
/**
/**
...
@@ -736,32 +689,32 @@ static int tst_rats_pad_to_pad( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
...
@@ -736,32 +689,32 @@ static int tst_rats_pad_to_pad( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
*/
*/
{
{
D_PAD
*
pad_start
,
*
pad_end
;
D_PAD
*
pad_start
,
*
pad_end
;
CHEVELU
*
chevelu
;
RATSNEST_ITEM
*
chevelu
;
for
(
chevelu
=
start_rat_list
;
chevelu
<
end_rat_list
;
chevelu
++
)
for
(
chevelu
=
start_rat_list
;
chevelu
<
end_rat_list
;
chevelu
++
)
{
{
pad_start
=
chevelu
->
pad_s
tart
;
pad_start
=
chevelu
->
m_PadS
tart
;
pad_end
=
chevelu
->
pad_e
nd
;
pad_end
=
chevelu
->
m_PadE
nd
;
/* Update the block if the 2 pads are not connected : a new block is created
/* Update the block if the 2 pads are not connected : a new block is created
*/
*/
if
(
(
pad_start
->
GetSubRatsnest
()
==
0
)
&&
(
pad_end
->
GetSubRatsnest
()
==
0
)
)
if
(
(
pad_start
->
GetSubRatsnest
()
==
0
)
&&
(
pad_end
->
GetSubRatsnest
()
==
0
)
)
{
{
current_num_block
++
;
current_num_block
++
;
pad_start
->
SetSubRatsnest
(
current_num_block
);
pad_start
->
SetSubRatsnest
(
current_num_block
);
pad_end
->
SetSubRatsnest
(
current_num_block
);
pad_end
->
SetSubRatsnest
(
current_num_block
);
chevelu
->
s
tatus
|=
CH_ACTIF
;
chevelu
->
m_S
tatus
|=
CH_ACTIF
;
}
}
/* If a pad is already connected : the other is merged in the current block */
/* If a pad is already connected : the other is merged in the current block */
else
if
(
pad_start
->
GetSubRatsnest
()
==
0
)
else
if
(
pad_start
->
GetSubRatsnest
()
==
0
)
{
{
pad_start
->
SetSubRatsnest
(
pad_end
->
GetSubRatsnest
()
);
pad_start
->
SetSubRatsnest
(
pad_end
->
GetSubRatsnest
()
);
chevelu
->
s
tatus
|=
CH_ACTIF
;
chevelu
->
m_S
tatus
|=
CH_ACTIF
;
}
}
else
if
(
pad_end
->
GetSubRatsnest
()
==
0
)
else
if
(
pad_end
->
GetSubRatsnest
()
==
0
)
{
{
pad_end
->
SetSubRatsnest
(
pad_start
->
GetSubRatsnest
()
);
pad_end
->
SetSubRatsnest
(
pad_start
->
GetSubRatsnest
()
);
chevelu
->
s
tatus
|=
CH_ACTIF
;
chevelu
->
m_S
tatus
|=
CH_ACTIF
;
}
}
}
}
...
@@ -776,59 +729,58 @@ void WinEDA_BasePcbFrame::Tst_Ratsnest( wxDC* DC, int ref_netcode )
...
@@ -776,59 +729,58 @@ void WinEDA_BasePcbFrame::Tst_Ratsnest( wxDC* DC, int ref_netcode )
/* Compute the active ratsnest
/* Compute the active ratsnest
* The general ratsnest list must exists
* The general ratsnest list must exists
* Compute the ACTIVE ratsnests in the general ratsnest list
* Compute the ACTIVE ratsnests in the general ratsnest list
* if ref_netcode == 0, test all nets, else test only ref_netcode
*/
*/
{
{
LISTE_PAD
*
pt_liste_pad
;
RATSNEST_ITEM
*
chevelu
;
CHEVELU
*
chevelu
;
D_PAD
*
pad
;
D_PAD
*
pad
;
int
net_code
;
int
ii
,
num_block
;
NETINFO_ITEM
*
net
;
int
net_code
;
EQUIPOT
*
equipot
;
if
(
m_Pcb
->
m_Pads
.
size
()
==
0
)
if
(
m_Pcb
->
m_Pads
.
size
()
==
0
)
return
;
return
;
if
(
(
m_Pcb
->
m_Status_Pcb
&
LISTE_RATSNEST_ITEM_OK
)
==
0
)
Build_Board_Ratsnest
(
DC
);
for
(
net_code
=
1
;
;
net_code
++
)
for
(
net_code
=
1
;
;
net_code
++
)
{
{
equipo
t
=
m_Pcb
->
FindNet
(
net_code
);
ne
t
=
m_Pcb
->
FindNet
(
net_code
);
if
(
equipo
t
==
NULL
)
if
(
ne
t
==
NULL
)
break
;
break
;
if
(
ref_netcode
&&
(
net_code
!=
ref_netcode
)
)
if
(
ref_netcode
&&
(
net_code
!=
ref_netcode
)
)
continue
;
continue
;
num_block
=
0
;
int
num_block
=
0
;
pt_liste_pad
=
equipot
->
m_PadzoneStart
;
for
(
unsigned
ip
=
0
;
ip
<
net
->
m_ListPad
.
size
();
ip
++
)
for
(
;
pt_liste_pad
<
equipot
->
m_PadzoneEnd
;
pt_liste_pad
++
)
{
{
pad
=
*
pt_liste_pad
;
pad
=
net
->
m_ListPad
[
ip
];
pad
->
SetSubRatsnest
(
pad
->
GetSubNet
()
);
int
subnet
=
pad
->
GetSubNet
();
num_block
=
MAX
(
num_block
,
pad
->
GetSubRatsnest
()
);
pad
->
SetSubRatsnest
(
subnet
);
num_block
=
MAX
(
num_block
,
subnet
);
}
}
for
(
chevelu
=
equipot
->
m_RatsnestStart
;
chevelu
<
equipo
t
->
m_RatsnestEnd
;
chevelu
++
)
for
(
chevelu
=
net
->
m_RatsnestStart
;
chevelu
<
ne
t
->
m_RatsnestEnd
;
chevelu
++
)
{
{
chevelu
->
s
tatus
&=
~
CH_ACTIF
;
chevelu
->
m_S
tatus
&=
~
CH_ACTIF
;
}
}
/* a - tst connection between pads */
/* a - tst connection between pads */
ii
=
tst_rats_pad_to_pad
(
DrawPanel
,
DC
,
num_block
,
i
nt
i
i
=
tst_rats_pad_to_pad
(
DrawPanel
,
DC
,
num_block
,
equipot
->
m_RatsnestStart
,
equipo
t
->
m_RatsnestEnd
);
net
->
m_RatsnestStart
,
ne
t
->
m_RatsnestEnd
);
/* b - test connexion between blocks (Iteration) */
/* b - test connexion between blocks (Iteration) */
while
(
ii
>
1
)
while
(
ii
>
1
)
{
{
ii
=
tst_rats_block_to_block
(
DrawPanel
,
DC
,
ii
=
tst_rats_block_to_block
(
DrawPanel
,
DC
,
net
);
equipot
->
m_PadzoneStart
,
equipot
->
m_PadzoneEnd
,
equipot
->
m_RatsnestStart
,
equipot
->
m_RatsnestEnd
);
}
}
}
}
m_Pcb
->
m_NbNoconnect
=
0
;
m_Pcb
->
m_NbNoconnect
=
0
;
CHEVELU
*
Chevelu
=
m_Pcb
->
m_Ratsnest
;
RATSNEST_ITEM
*
Chevelu
=
m_Pcb
->
m_Ratsnest
;
for
(
ii
=
m_Pcb
->
GetNumRatsnests
();
ii
>
0
;
ii
--
,
Chevelu
++
)
for
(
i
nt
i
i
=
m_Pcb
->
GetNumRatsnests
();
ii
>
0
;
ii
--
,
Chevelu
++
)
{
{
if
(
Chevelu
->
s
tatus
&
CH_ACTIF
)
if
(
Chevelu
->
m_S
tatus
&
CH_ACTIF
)
m_Pcb
->
m_NbNoconnect
++
;
m_Pcb
->
m_NbNoconnect
++
;
}
}
}
}
...
@@ -852,167 +804,6 @@ int WinEDA_BasePcbFrame::Test_1_Net_Ratsnest( wxDC* DC, int ref_netcode )
...
@@ -852,167 +804,6 @@ int WinEDA_BasePcbFrame::Test_1_Net_Ratsnest( wxDC* DC, int ref_netcode )
}
}
/*****************************************************/
void
WinEDA_BasePcbFrame
::
recalcule_pad_net_code
()
/*****************************************************/
/**
* Compute and update the net_codes for PADS et and equipots (.m_NetCode member)
* net_codes are >= 1 (net_code = 0 means not connected)
* Update the equipotents buffer
* Must be called after editing pads (netname, or deleting) or after read a netlist
* set to 1 flag NET_CODE_OK of m_Pcb->m_Status_Pcb;
* m_Pcb->m_NbNodes and m_Pcb->m_NbNets are updated
*/
{
LISTE_PAD
*
pad_ref
,
*
pad_courant
;
int
ii
;
EQUIPOT
**
BufPtEquipot
;
/* Build the PAD list */
build_liste_pads
();
/* calcul des net_codes des pads */
ii
=
m_Pcb
->
m_Pads
.
size
();
m_Pcb
->
m_NbNodes
=
0
;
int
netcode
=
0
;
/* search for differents netnames, and create a netcode for each netname */
pad_courant
=
&
m_Pcb
->
m_Pads
[
0
];
for
(
;
ii
>
0
;
pad_courant
++
,
ii
--
)
{
if
(
(
*
pad_courant
)
->
GetNetname
().
IsEmpty
()
)
// pad not connected
{
(
*
pad_courant
)
->
SetNet
(
0
);
continue
;
}
m_Pcb
->
m_NbNodes
++
;
/* if the current netname was already found: use the current net_code , else create a new net_code */
pad_ref
=
&
m_Pcb
->
m_Pads
[
0
];
while
(
pad_ref
<
pad_courant
)
{
if
(
(
*
pad_ref
)
->
GetNetname
()
==
(
*
pad_courant
)
->
GetNetname
()
)
break
;
// sont du meme met
pad_ref
++
;
}
/* if pad_ref != pad_courant we have found 2 pads on the same net., Use the current net_code for pad_courant
* if pad_ref == pad_courant: new net found (end of list reached) without other pad found on the same net:
* we must create a new net_code
*/
if
(
pad_ref
==
pad_courant
)
// create a new net_code
{
netcode
++
;
(
*
pad_courant
)
->
SetNet
(
netcode
);
}
else
// Use the current net_code for pad_courant
(
*
pad_courant
)
->
SetNet
(
(
*
pad_ref
)
->
GetNet
()
);
}
/* Build or update the equipotent list: we reuse the old list */
BufPtEquipot
=
(
EQUIPOT
**
)
MyMalloc
(
sizeof
(
EQUIPOT
*
)
*
(
netcode
+
1
)
);
EQUIPOT
*
equipot
=
m_Pcb
->
m_Equipots
;
for
(
ii
=
0
;
ii
<=
netcode
;
equipot
=
equipot
->
Next
(),
++
ii
)
{
if
(
equipot
==
NULL
)
/* Create a new equipot if no more equipot in old list */
{
equipot
=
new
EQUIPOT
(
m_Pcb
);
m_Pcb
->
Add
(
equipot
,
ADD_APPEND
);
}
// Set the net_code for this equipot and reset other values
equipot
->
SetNet
(
ii
);
equipot
->
m_NbNodes
=
0
;
equipot
->
SetNetname
(
wxEmptyString
);
BufPtEquipot
[
ii
]
=
equipot
;
}
/* Delete the unused equipots in the old list */
while
(
equipot
)
{
EQUIPOT
*
next
=
equipot
->
Next
();
equipot
->
DeleteStructure
();
equipot
=
next
;
}
pad_courant
=
&
m_Pcb
->
m_Pads
[
0
];
equipot
=
m_Pcb
->
m_Equipots
;
/* Set the equpot net name and node count for each equipot in equipot list */
for
(
ii
=
m_Pcb
->
m_Pads
.
size
();
ii
>
0
;
pad_courant
++
,
ii
--
)
{
int
net
=
(
*
pad_courant
)
->
GetNet
();
equipot
=
BufPtEquipot
[
net
];
equipot
->
m_NbNodes
++
;
if
(
equipot
->
GetNetname
().
IsEmpty
()
)
{
equipot
->
SetNetname
((
*
pad_courant
)
->
GetNetname
());
}
}
MyFree
(
BufPtEquipot
);
m_Pcb
->
m_Status_Pcb
|=
NET_CODES_OK
;
m_Pcb
->
SetAreasNetCodesFromNetNames
();
}
/***********************************************/
void
WinEDA_BasePcbFrame
::
build_liste_pads
()
/***********************************************/
/*
* Create the pad list
* initialise:
* m_Pcb->m_Pads (list of pads)
* m_Pcb->m_NbNodes = node count
* set m_Pcb->m_Status_Pcb = LISTE_PAD_OK;
* and clear for all pad their m_SubRatsnest member;
* delete ( free memory) m_Pcb->m_Ratsnest and set m_Pcb->m_Ratsnest to NULL
*/
{
if
(
m_Pcb
->
m_Status_Pcb
&
LISTE_PAD_OK
)
return
;
// empty the old list
m_Pcb
->
m_Pads
.
clear
();
m_Pcb
->
m_NbNodes
=
0
;
/* Clear variables used in rastnest computation */
for
(
MODULE
*
module
=
m_Pcb
->
m_Modules
;
module
;
module
=
module
->
Next
()
)
{
for
(
D_PAD
*
pad
=
module
->
m_Pads
;
pad
;
pad
=
pad
->
Next
()
)
{
m_Pcb
->
m_Pads
.
push_back
(
pad
);
pad
->
SetSubRatsnest
(
0
);
pad
->
SetParent
(
module
);
if
(
pad
->
GetNet
()
)
m_Pcb
->
m_NbNodes
++
;
}
}
if
(
m_Pcb
->
m_Ratsnest
)
{
MyFree
(
m_Pcb
->
m_Ratsnest
);
m_Pcb
->
m_Ratsnest
=
NULL
;
}
m_Pcb
->
m_Status_Pcb
=
LISTE_PAD_OK
;
}
/*****************************************************************************/
/*****************************************************************************/
char
*
WinEDA_BasePcbFrame
::
build_ratsnest_module
(
wxDC
*
DC
,
MODULE
*
Module
)
char
*
WinEDA_BasePcbFrame
::
build_ratsnest_module
(
wxDC
*
DC
,
MODULE
*
Module
)
/*****************************************************************************/
/*****************************************************************************/
...
@@ -1032,35 +823,37 @@ char* WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module )
...
@@ -1032,35 +823,37 @@ char* WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module )
* The ratsnest section must be computed for each new position
* The ratsnest section must be computed for each new position
*/
*/
{
{
LISTE_PAD
*
pt_liste_pad
;
D_PAD
*
*
pt_liste_pad
;
LISTE_PAD
*
pt_liste_ref
;
D_PAD
*
*
pt_liste_ref
;
LISTE_PAD
*
pt_liste_generale
;
D_PAD
*
*
pt_liste_generale
;
D_PAD
*
pad_ref
;
D_PAD
*
pad_ref
;
D_PAD
*
pad_externe
;
D_PAD
*
pad_externe
;
LISTE_PAD
*
pt_liste_pad_limite
;
D_PAD
*
*
pt_liste_pad_limite
;
LISTE_PAD
*
pt_start_liste
;
D_PAD
*
*
pt_start_liste
;
LISTE_PAD
*
pt_end_liste
;
D_PAD
*
*
pt_end_liste
;
int
ii
,
jj
;
int
ii
,
jj
;
CHEVELU
*
local_chevelu
;
RATSNEST_ITEM
*
local_chevelu
;
static
CHEVELU
*
pt_fin_int_chevelu
;
// End list for "internal" ratsnest
static
RATSNEST_ITEM
*
pt_fin_int_chevelu
;
// End list for "internal" ratsnest
static
int
nb_int_chevelu
;
// "internal" ratsnest count
static
int
nb_int_chevelu
;
// "internal" ratsnest count
int
current_net_code
;
int
current_net_code
;
int
increment
,
distance
;
// variables de calcul de ratsnest
int
increment
,
distance
;
// variables de calcul de ratsnest
int
pad_pos_X
,
pad_pos_Y
;
// True pad position according to the current footprint position
int
pad_pos_X
,
pad_pos_Y
;
// True pad position according to the current footprint position
if
(
(
m_Pcb
->
m_Status_Pcb
&
LISTE_PAD_OK
)
==
0
)
if
(
(
GetBoard
()
->
m_Status_Pcb
&
LISTE_PAD_OK
)
==
0
)
build_liste_pads
();
{
GetBoard
()
->
Build_Pads_Full_List
();
}
/* Compute the "local" ratsnest if needed (when this footprint starts move)
/* Compute the "local" ratsnest if needed (when this footprint starts move)
and the list of external pads to consider, i.e pads in others footprints which are "connected" to
*
and the list of external pads to consider, i.e pads in others footprints which are "connected" to
a pad in the current footprint
*
a pad in the current footprint
*/
*/
if
(
(
m_Pcb
->
m_Status_Pcb
&
CHEVELU
_LOCAL_OK
)
!=
0
)
if
(
(
m_Pcb
->
m_Status_Pcb
&
RATSNEST_ITEM
_LOCAL_OK
)
!=
0
)
goto
calcul_chevelu_ext
;
goto
calcul_chevelu_ext
;
/* Compute the "internal" ratsnest, i.e the links bet
e
ween the curent footprint pads */
/* Compute the "internal" ratsnest, i.e the links between the curent footprint pads */
pt_liste_pad
=
(
LISTE_PAD
*
)
adr_lowmem
;
pt_liste_pad
=
(
D_PAD
*
*
)
adr_lowmem
;
nb_pads_ref
=
0
;
nb_pads_ref
=
0
;
pad_ref
=
Module
->
m_Pads
;
pad_ref
=
Module
->
m_Pads
;
...
@@ -1080,9 +873,9 @@ char* WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module )
...
@@ -1080,9 +873,9 @@ char* WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module )
qsort
(
adr_lowmem
,
nb_pads_ref
,
sizeof
(
D_PAD
*
),
tri_par_net
);
qsort
(
adr_lowmem
,
nb_pads_ref
,
sizeof
(
D_PAD
*
),
tri_par_net
);
/* Build the list of pads linked to the current f
f
otprint pads */
/* Build the list of pads linked to the current f
o
otprint pads */
DisplayRastnestInProgress
=
FALSE
;
DisplayRastnestInProgress
=
FALSE
;
pt_liste_ref
=
(
LISTE_PAD
*
)
adr_lowmem
;
pt_liste_ref
=
(
D_PAD
*
*
)
adr_lowmem
;
nb_pads_externes
=
0
;
nb_pads_externes
=
0
;
current_net_code
=
0
;
current_net_code
=
0
;
...
@@ -1104,7 +897,7 @@ char* WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module )
...
@@ -1104,7 +897,7 @@ char* WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module )
if
(
pad_externe
->
GetParent
()
==
Module
)
if
(
pad_externe
->
GetParent
()
==
Module
)
continue
;
continue
;
pad_externe
->
SetSubRatsnest
(
0
);
pad_externe
->
SetSubRatsnest
(
0
);
pad_externe
->
SetSubNet
(
0
);
pad_externe
->
SetSubNet
(
0
);
*
pt_liste_pad
=
pad_externe
;
*
pt_liste_pad
=
pad_externe
;
...
@@ -1121,17 +914,17 @@ char* WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module )
...
@@ -1121,17 +914,17 @@ char* WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module )
/* Compute the internal rats nest:
/* Compute the internal rats nest:
* this is the same as general ratsnest, but considers only the current footprint pads
* this is the same as general ratsnest, but considers only the current footprint pads
* it is therefore not time consuming, and it is made only once
* it is therefore not time consuming, and it is made only once
*/
*/
local_liste_chevelu
=
(
CHEVELU
*
)
pt_liste_pad
;
// buffer chevelu a la suite de la liste des pads
local_liste_chevelu
=
(
RATSNEST_ITEM
*
)
pt_liste_pad
;
// buffer chevelu a la suite de la liste des pads
nb_local_chevelu
=
0
;
nb_local_chevelu
=
0
;
pt_liste_ref
=
(
LISTE_PAD
*
)
adr_lowmem
;
pt_liste_ref
=
(
D_PAD
*
*
)
adr_lowmem
;
g_pt_chevelu
=
local_liste_chevelu
;
g_pt_chevelu
=
local_liste_chevelu
;
pt_liste_pad
=
pt_start_liste
=
(
LISTE_PAD
*
)
adr_lowmem
;
pt_liste_pad
=
pt_start_liste
=
(
D_PAD
*
*
)
adr_lowmem
;
pt_liste_pad_limite
=
pt_liste_pad
+
nb_pads_ref
;
pt_liste_pad_limite
=
pt_liste_pad
+
nb_pads_ref
;
current_net_code
=
(
*
pt_liste_pad
)
->
GetNet
();
current_net_code
=
(
*
pt_liste_pad
)
->
GetNet
();
for
(
;
pt_liste_pad
<
pt_liste_pad_limite
;
)
for
(
;
pt_liste_pad
<
pt_liste_pad_limite
;
)
{
{
...
@@ -1151,7 +944,7 @@ char* WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module )
...
@@ -1151,7 +944,7 @@ char* WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module )
ii
=
gen_rats_pad_to_pad
(
DrawPanel
,
DC
,
pt_start_liste
,
pt_end_liste
,
ii
=
gen_rats_pad_to_pad
(
DrawPanel
,
DC
,
pt_start_liste
,
pt_end_liste
,
0
,
&
nb_local_chevelu
);
0
,
&
nb_local_chevelu
);
/* b - secon step of lee algorithm : build the block to block link list (Iteration) */
/* b - secon
d
step of lee algorithm : build the block to block link list (Iteration) */
while
(
ii
>
1
)
while
(
ii
>
1
)
{
{
ii
=
gen_rats_block_to_block
(
DrawPanel
,
DC
,
pt_liste_pad
,
ii
=
gen_rats_block_to_block
(
DrawPanel
,
DC
,
pt_liste_pad
,
...
@@ -1164,20 +957,20 @@ char* WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module )
...
@@ -1164,20 +957,20 @@ char* WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module )
}
}
pt_fin_int_chevelu
=
local_chevelu
=
g_pt_chevelu
;
pt_fin_int_chevelu
=
local_chevelu
=
g_pt_chevelu
;
nb_int_chevelu
=
nb_local_chevelu
;
nb_int_chevelu
=
nb_local_chevelu
;
/* set the ratsnets status, flag LOCAL_
CHEVELU
*/
/* set the ratsnets status, flag LOCAL_
RATSNEST_ITEM
*/
g_pt_chevelu
=
local_liste_chevelu
;
g_pt_chevelu
=
local_liste_chevelu
;
while
(
g_pt_chevelu
<
pt_fin_int_chevelu
)
while
(
g_pt_chevelu
<
pt_fin_int_chevelu
)
{
{
g_pt_chevelu
->
status
=
LOCAL_CHEVELU
;
g_pt_chevelu
++
;
g_pt_chevelu
->
m_Status
=
LOCAL_RATSNEST_ITEM
;
g_pt_chevelu
++
;
}
}
m_Pcb
->
m_Status_Pcb
|=
CHEVELU
_LOCAL_OK
;
m_Pcb
->
m_Status_Pcb
|=
RATSNEST_ITEM
_LOCAL_OK
;
/*
/*
This section computes the "external" ratsnest: must be done when the footprint position changes
*
This section computes the "external" ratsnest: must be done when the footprint position changes
*/
*/
calcul_chevelu_ext
:
calcul_chevelu_ext
:
/* This section search:
/* This section search:
...
@@ -1187,12 +980,12 @@ calcul_chevelu_ext:
...
@@ -1187,12 +980,12 @@ calcul_chevelu_ext:
*/
*/
local_chevelu
=
pt_fin_int_chevelu
;
local_chevelu
=
pt_fin_int_chevelu
;
nb_local_chevelu
=
nb_int_chevelu
;
nb_local_chevelu
=
nb_int_chevelu
;
pt_liste_ref
=
(
LISTE_PAD
*
)
adr_lowmem
;
pt_liste_ref
=
(
D_PAD
*
*
)
adr_lowmem
;
pad_ref
=
*
pt_liste_ref
;
pad_ref
=
*
pt_liste_ref
;
current_net_code
=
pad_ref
->
GetNet
();
current_net_code
=
pad_ref
->
GetNet
();
local_chevelu
->
dis
t
=
0x7FFFFFFF
;
local_chevelu
->
m_Lengh
t
=
0x7FFFFFFF
;
local_chevelu
->
s
tatus
=
0
;
local_chevelu
->
m_S
tatus
=
0
;
increment
=
0
;
increment
=
0
;
for
(
ii
=
0
;
ii
<
nb_pads_ref
;
ii
++
)
for
(
ii
=
0
;
ii
<
nb_pads_ref
;
ii
++
)
{
{
...
@@ -1206,7 +999,7 @@ calcul_chevelu_ext:
...
@@ -1206,7 +999,7 @@ calcul_chevelu_ext:
}
}
increment
=
0
;
increment
=
0
;
current_net_code
=
pad_ref
->
GetNet
();
current_net_code
=
pad_ref
->
GetNet
();
local_chevelu
->
dis
t
=
0x7FFFFFFF
;
local_chevelu
->
m_Lengh
t
=
0x7FFFFFFF
;
}
}
pad_pos_X
=
pad_ref
->
m_Pos
.
x
-
g_Offset_Module
.
x
;
pad_pos_X
=
pad_ref
->
m_Pos
.
x
-
g_Offset_Module
.
x
;
...
@@ -1227,13 +1020,13 @@ calcul_chevelu_ext:
...
@@ -1227,13 +1020,13 @@ calcul_chevelu_ext:
distance
=
abs
(
pad_externe
->
m_Pos
.
x
-
pad_pos_X
)
+
distance
=
abs
(
pad_externe
->
m_Pos
.
x
-
pad_pos_X
)
+
abs
(
pad_externe
->
m_Pos
.
y
-
pad_pos_Y
);
abs
(
pad_externe
->
m_Pos
.
y
-
pad_pos_Y
);
if
(
distance
<
local_chevelu
->
dis
t
)
if
(
distance
<
local_chevelu
->
m_Lengh
t
)
{
{
local_chevelu
->
pad_s
tart
=
pad_ref
;
local_chevelu
->
m_PadS
tart
=
pad_ref
;
local_chevelu
->
pad_e
nd
=
pad_externe
;
local_chevelu
->
m_PadE
nd
=
pad_externe
;
local_chevelu
->
SetNet
(
pad_ref
->
GetNet
()
);
local_chevelu
->
SetNet
(
pad_ref
->
GetNet
()
);
local_chevelu
->
dis
t
=
distance
;
local_chevelu
->
m_Lengh
t
=
distance
;
local_chevelu
->
s
tatus
=
0
;
local_chevelu
->
m_S
tatus
=
0
;
increment
=
1
;
increment
=
1
;
}
}
...
@@ -1246,9 +1039,9 @@ calcul_chevelu_ext:
...
@@ -1246,9 +1039,9 @@ calcul_chevelu_ext:
local_chevelu
++
;
local_chevelu
++
;
}
}
return
(
char
*
)
(
local_chevelu
+
1
);
/* the struct pointed by local_chevelu is used
return
(
char
*
)
(
local_chevelu
+
1
);
/* the struct pointed by local_chevelu is used
in temporary computations, so we skip it
*
in temporary computations, so we skip it
*/
*/
}
}
...
@@ -1260,12 +1053,12 @@ void WinEDA_BasePcbFrame::trace_ratsnest_module( wxDC* DC )
...
@@ -1260,12 +1053,12 @@ void WinEDA_BasePcbFrame::trace_ratsnest_module( wxDC* DC )
* Display the rastnest of a moving footprint, computed by build_ratsnest_module()
* Display the rastnest of a moving footprint, computed by build_ratsnest_module()
*/
*/
{
{
CHEVELU
*
local_chevelu
;
RATSNEST_ITEM
*
local_chevelu
;
int
ii
;
int
ii
;
if
(
DC
==
NULL
)
if
(
DC
==
NULL
)
return
;
return
;
if
(
(
m_Pcb
->
m_Status_Pcb
&
CHEVELU
_LOCAL_OK
)
==
0
)
if
(
(
m_Pcb
->
m_Status_Pcb
&
RATSNEST_ITEM
_LOCAL_OK
)
==
0
)
return
;
return
;
local_chevelu
=
local_liste_chevelu
;
local_chevelu
=
local_liste_chevelu
;
...
@@ -1275,22 +1068,22 @@ void WinEDA_BasePcbFrame::trace_ratsnest_module( wxDC* DC )
...
@@ -1275,22 +1068,22 @@ void WinEDA_BasePcbFrame::trace_ratsnest_module( wxDC* DC )
while
(
ii
--
>
0
)
while
(
ii
--
>
0
)
{
{
if
(
local_chevelu
->
status
&
LOCAL_CHEVELU
)
if
(
local_chevelu
->
m_Status
&
LOCAL_RATSNEST_ITEM
)
{
{
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
local_chevelu
->
pad_s
tart
->
m_Pos
.
x
-
g_Offset_Module
.
x
,
local_chevelu
->
m_PadS
tart
->
m_Pos
.
x
-
g_Offset_Module
.
x
,
local_chevelu
->
pad_s
tart
->
m_Pos
.
y
-
g_Offset_Module
.
y
,
local_chevelu
->
m_PadS
tart
->
m_Pos
.
y
-
g_Offset_Module
.
y
,
local_chevelu
->
pad_e
nd
->
m_Pos
.
x
-
g_Offset_Module
.
x
,
local_chevelu
->
m_PadE
nd
->
m_Pos
.
x
-
g_Offset_Module
.
x
,
local_chevelu
->
pad_e
nd
->
m_Pos
.
y
-
g_Offset_Module
.
y
,
local_chevelu
->
m_PadE
nd
->
m_Pos
.
y
-
g_Offset_Module
.
y
,
0
,
YELLOW
);
0
,
YELLOW
);
}
}
else
else
{
{
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
local_chevelu
->
pad_s
tart
->
m_Pos
.
x
-
g_Offset_Module
.
x
,
local_chevelu
->
m_PadS
tart
->
m_Pos
.
x
-
g_Offset_Module
.
x
,
local_chevelu
->
pad_s
tart
->
m_Pos
.
y
-
g_Offset_Module
.
y
,
local_chevelu
->
m_PadS
tart
->
m_Pos
.
y
-
g_Offset_Module
.
y
,
local_chevelu
->
pad_e
nd
->
m_Pos
.
x
,
local_chevelu
->
m_PadE
nd
->
m_Pos
.
x
,
local_chevelu
->
pad_e
nd
->
m_Pos
.
y
,
local_chevelu
->
m_PadE
nd
->
m_Pos
.
y
,
0
,
g_DesignSettings
.
m_RatsnestColor
);
0
,
g_DesignSettings
.
m_RatsnestColor
);
}
}
local_chevelu
++
;
local_chevelu
++
;
...
@@ -1298,10 +1091,6 @@ void WinEDA_BasePcbFrame::trace_ratsnest_module( wxDC* DC )
...
@@ -1298,10 +1091,6 @@ void WinEDA_BasePcbFrame::trace_ratsnest_module( wxDC* DC )
}
}
/*********************************************************************************************/
/* int * WinEDA_BasePcbFrame::build_ratsnest_pad(D_PAD * pad_ref, const wxPoint & refpos) */
/*********************************************************************************************/
/**
/**
* construction de la liste en mode de calcul rapide pour affichage
* construction de la liste en mode de calcul rapide pour affichage
* en temps reel du chevelu d'un pad lors des tracés d'une piste démarrant
* en temps reel du chevelu d'un pad lors des tracés d'une piste démarrant
...
@@ -1316,13 +1105,13 @@ void WinEDA_BasePcbFrame::trace_ratsnest_module( wxDC* DC )
...
@@ -1316,13 +1105,13 @@ void WinEDA_BasePcbFrame::trace_ratsnest_module( wxDC* DC )
* retourne: adresse memoire disponible
* retourne: adresse memoire disponible
*/
*/
/* Used by build_ratsnest_pad(): sort function by link lenght (manathan
n
distance)*/
/* Used by build_ratsnest_pad(): sort function by link lenght (manathan distance)*/
static
int
sort_by_localnetlength
(
const
void
*
o1
,
const
void
*
o2
)
static
int
sort_by_localnetlength
(
const
void
*
o1
,
const
void
*
o2
)
{
{
int
*
ref
=
(
int
*
)
o1
;
int
*
ref
=
(
int
*
)
o1
;
int
*
compare
=
(
int
*
)
o2
;
int
*
compare
=
(
int
*
)
o2
;
int
*
org
=
(
int
*
)
adr_lowmem
;
// ref coordinate (todo : change for a betted code: used an external wxPoint variable)
int
*
org
=
(
int
*
)
adr_lowmem
;
// ref coordinate (todo : change for a betted code: used an external wxPoint variable)
int
ox
=
*
org
++
;
int
ox
=
*
org
++
;
int
oy
=
*
org
++
;
int
oy
=
*
org
++
;
int
lengthref
,
lengthcmp
;
int
lengthref
,
lengthcmp
;
...
@@ -1350,10 +1139,10 @@ int* WinEDA_BasePcbFrame::build_ratsnest_pad( EDA_BaseStruct* ref,
...
@@ -1350,10 +1139,10 @@ int* WinEDA_BasePcbFrame::build_ratsnest_pad( EDA_BaseStruct* ref,
int
ii
;
int
ii
;
int
*
pt_coord
,
*
base_data
;
int
*
pt_coord
,
*
base_data
;
int
current_net_code
=
0
,
conn_number
=
0
;
int
current_net_code
=
0
,
conn_number
=
0
;
LISTE_PAD
*
padlist
;
D_PAD
*
*
padlist
;
D_PAD
*
pad_ref
=
NULL
;
D_PAD
*
pad_ref
=
NULL
;
if
(
(
(
m_Pcb
->
m_Status_Pcb
&
LISTE_
CHEVELU
_OK
)
==
0
)
if
(
(
(
m_Pcb
->
m_Status_Pcb
&
LISTE_
RATSNEST_ITEM
_OK
)
==
0
)
||
(
(
m_Pcb
->
m_Status_Pcb
&
LISTE_PAD_OK
)
==
0
)
)
||
(
(
m_Pcb
->
m_Status_Pcb
&
LISTE_PAD_OK
)
==
0
)
)
{
{
nb_local_chevelu
=
0
;
nb_local_chevelu
=
0
;
...
@@ -1362,7 +1151,7 @@ int* WinEDA_BasePcbFrame::build_ratsnest_pad( EDA_BaseStruct* ref,
...
@@ -1362,7 +1151,7 @@ int* WinEDA_BasePcbFrame::build_ratsnest_pad( EDA_BaseStruct* ref,
base_data
=
pt_coord
=
(
int
*
)
adr_lowmem
;
base_data
=
pt_coord
=
(
int
*
)
adr_lowmem
;
local_liste_chevelu
=
(
CHEVELU
*
)
pt_coord
;
local_liste_chevelu
=
(
RATSNEST_ITEM
*
)
pt_coord
;
if
(
init
)
if
(
init
)
{
{
nb_local_chevelu
=
0
;
nb_local_chevelu
=
0
;
...
@@ -1417,7 +1206,6 @@ int* WinEDA_BasePcbFrame::build_ratsnest_pad( EDA_BaseStruct* ref,
...
@@ -1417,7 +1206,6 @@ int* WinEDA_BasePcbFrame::build_ratsnest_pad( EDA_BaseStruct* ref,
}
}
}
}
}
/* end if Init */
}
/* end if Init */
else
if
(
nb_local_chevelu
)
else
if
(
nb_local_chevelu
)
{
{
*
pt_coord
=
refpos
.
x
;
*
pt_coord
=
refpos
.
x
;
...
@@ -1442,10 +1230,10 @@ void WinEDA_BasePcbFrame::trace_ratsnest_pad( wxDC* DC )
...
@@ -1442,10 +1230,10 @@ void WinEDA_BasePcbFrame::trace_ratsnest_pad( wxDC* DC )
int
ii
;
int
ii
;
int
refX
,
refY
;
int
refX
,
refY
;
if
(
DC
==
NULL
)
if
(
DC
==
NULL
)
return
;
return
;
if
(
(
m_Pcb
->
m_Status_Pcb
&
LISTE_
CHEVELU
_OK
)
==
0
)
if
(
(
m_Pcb
->
m_Status_Pcb
&
LISTE_
RATSNEST_ITEM
_OK
)
==
0
)
return
;
return
;
if
(
nb_local_chevelu
==
0
)
if
(
nb_local_chevelu
==
0
)
...
...
pcbnew/router.cpp
View file @
e073bdc0
...
@@ -191,9 +191,9 @@ void Out_Pads( BOARD* Pcb, FILE* outfile )
...
@@ -191,9 +191,9 @@ void Out_Pads( BOARD* Pcb, FILE* outfile )
if
(
nb_pads
<
2
)
if
(
nb_pads
<
2
)
{
{
wxString
Line
;
wxString
Line
;
EQUIPOT
*
equipo
t
=
Pcb
->
FindNet
(
netcode
);
NETINFO_ITEM
*
ne
t
=
Pcb
->
FindNet
(
netcode
);
Line
.
Printf
(
wxT
(
"Warning: %d pad, net %s"
),
Line
.
Printf
(
wxT
(
"Warning: %d pad, net %s"
),
nb_pads
,
equipo
t
->
GetNetname
().
GetData
()
);
nb_pads
,
ne
t
->
GetNetname
().
GetData
()
);
DisplayError
(
NULL
,
Line
,
20
);
DisplayError
(
NULL
,
Line
,
20
);
}
}
fprintf
(
outfile
,
"r %d %d %d %d %d %d 1 1
\n
"
,
fprintf
(
outfile
,
"r %d %d %d %d %d %d 1 1
\n
"
,
...
...
pcbnew/solve.cpp
View file @
e073bdc0
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
/* Routines definies ici : */
/* Routines definies ici : */
static
int
Autoroute_One_Track
(
WinEDA_PcbFrame
*
pcbframe
,
wxDC
*
DC
,
int
two_sides
,
int
row_source
,
static
int
Autoroute_One_Track
(
WinEDA_PcbFrame
*
pcbframe
,
wxDC
*
DC
,
int
two_sides
,
int
row_source
,
int
col_source
,
int
col_source
,
int
row_target
,
int
col_target
,
CHEVELU
*
pt_chevelu
);
int
row_target
,
int
col_target
,
RATSNEST_ITEM
*
pt_chevelu
);
static
int
Retrace
(
WinEDA_PcbFrame
*
pcbframe
,
wxDC
*
DC
,
int
,
int
,
int
,
int
,
int
,
int
net_code
);
static
int
Retrace
(
WinEDA_PcbFrame
*
pcbframe
,
wxDC
*
DC
,
int
,
int
,
int
,
int
,
int
,
int
net_code
);
static
void
OrCell_Trace
(
BOARD
*
pcb
,
int
col
,
int
row
,
int
side
,
int
orient
,
int
current_net_code
);
static
void
OrCell_Trace
(
BOARD
*
pcb
,
int
col
,
int
row
,
int
side
,
int
orient
,
int
current_net_code
);
static
void
Place_Piste_en_Buffer
(
WinEDA_PcbFrame
*
pcbframe
,
wxDC
*
DC
);
static
void
Place_Piste_en_Buffer
(
WinEDA_PcbFrame
*
pcbframe
,
wxDC
*
DC
);
...
@@ -29,7 +29,7 @@ static void Place_Piste_en_Buffer( WinEDA_PcbFrame* pcbframe, wxDC* DC );
...
@@ -29,7 +29,7 @@ static void Place_Piste_en_Buffer( WinEDA_PcbFrame* pcbframe, wxDC* DC );
/* Variables locales : */
/* Variables locales : */
static
int
segm_oX
,
segm_oY
;
static
int
segm_oX
,
segm_oY
;
static
int
segm_fX
,
segm_fY
;
/* Origine et fin de la piste en cours de trace */
static
int
segm_fX
,
segm_fY
;
/* Origine et fin de la piste en cours de trace */
static
CHEVELU
*
pt_cur_ch
;
static
RATSNEST_ITEM
*
pt_cur_ch
;
static
int
Ncurrent
;
/* measures of progress */
static
int
Ncurrent
;
/* measures of progress */
...
@@ -212,7 +212,7 @@ int WinEDA_PcbFrame::Solve( wxDC* DC, int two_sides )
...
@@ -212,7 +212,7 @@ int WinEDA_PcbFrame::Solve( wxDC* DC, int two_sides )
int
current_net_code
;
int
current_net_code
;
int
row_source
,
col_source
,
row_target
,
col_target
;
int
row_source
,
col_source
,
row_target
,
col_target
;
int
success
,
nbsucces
=
0
,
nbunsucces
=
0
;
int
success
,
nbsucces
=
0
,
nbunsucces
=
0
;
EQUIPOT
*
pt_equipo
t
;
NETINFO_ITEM
*
ne
t
;
bool
stop
=
FALSE
;
bool
stop
=
FALSE
;
wxString
msg
;
wxString
msg
;
...
@@ -248,10 +248,10 @@ int WinEDA_PcbFrame::Solve( wxDC* DC, int two_sides )
...
@@ -248,10 +248,10 @@ int WinEDA_PcbFrame::Solve( wxDC* DC, int two_sides )
}
}
Ncurrent
++
;
Ncurrent
++
;
pt_equipo
t
=
GetBoard
()
->
FindNet
(
current_net_code
);
ne
t
=
GetBoard
()
->
FindNet
(
current_net_code
);
if
(
pt_equipo
t
)
if
(
ne
t
)
{
{
msg
.
Printf
(
wxT
(
"[%8.8s]"
),
pt_equipo
t
->
GetNetname
().
GetData
()
);
msg
.
Printf
(
wxT
(
"[%8.8s]"
),
ne
t
->
GetNetname
().
GetData
()
);
Affiche_1_Parametre
(
this
,
1
,
wxT
(
"Net route"
),
msg
,
BROWN
);
Affiche_1_Parametre
(
this
,
1
,
wxT
(
"Net route"
),
msg
,
BROWN
);
msg
.
Printf
(
wxT
(
"%d / %d"
),
Ncurrent
,
Ntotal
);
msg
.
Printf
(
wxT
(
"%d / %d"
),
Ncurrent
,
Ntotal
);
Affiche_1_Parametre
(
this
,
12
,
wxT
(
"Activity"
),
msg
,
BROWN
);
Affiche_1_Parametre
(
this
,
12
,
wxT
(
"Activity"
),
msg
,
BROWN
);
...
@@ -265,8 +265,8 @@ int WinEDA_PcbFrame::Solve( wxDC* DC, int two_sides )
...
@@ -265,8 +265,8 @@ int WinEDA_PcbFrame::Solve( wxDC* DC, int two_sides )
/* Affiche Liaison */
/* Affiche Liaison */
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
segm_oX
,
segm_oY
,
segm_fX
,
segm_fY
,
0
,
WHITE
|
GR_XOR
);
GRLine
(
&
DrawPanel
->
m_ClipBox
,
DC
,
segm_oX
,
segm_oY
,
segm_fX
,
segm_fY
,
0
,
WHITE
|
GR_XOR
);
pt_cur_ch
->
pad_s
tart
->
Draw
(
DrawPanel
,
DC
,
GR_OR
|
GR_SURBRILL
);
pt_cur_ch
->
m_PadS
tart
->
Draw
(
DrawPanel
,
DC
,
GR_OR
|
GR_SURBRILL
);
pt_cur_ch
->
pad_e
nd
->
Draw
(
DrawPanel
,
DC
,
GR_OR
|
GR_SURBRILL
);
pt_cur_ch
->
m_PadE
nd
->
Draw
(
DrawPanel
,
DC
,
GR_OR
|
GR_SURBRILL
);
success
=
Autoroute_One_Track
(
this
,
DC
,
two_sides
,
row_source
,
col_source
,
success
=
Autoroute_One_Track
(
this
,
DC
,
two_sides
,
row_source
,
col_source
,
row_target
,
col_target
,
pt_cur_ch
);
row_target
,
col_target
,
pt_cur_ch
);
...
@@ -274,7 +274,7 @@ int WinEDA_PcbFrame::Solve( wxDC* DC, int two_sides )
...
@@ -274,7 +274,7 @@ int WinEDA_PcbFrame::Solve( wxDC* DC, int two_sides )
switch
(
success
)
switch
(
success
)
{
{
case
NOSUCCESS
:
case
NOSUCCESS
:
pt_cur_ch
->
s
tatus
|=
CH_UNROUTABLE
;
pt_cur_ch
->
m_S
tatus
|=
CH_UNROUTABLE
;
nbunsucces
++
;
nbunsucces
++
;
break
;
break
;
...
@@ -299,8 +299,8 @@ int WinEDA_PcbFrame::Solve( wxDC* DC, int two_sides )
...
@@ -299,8 +299,8 @@ int WinEDA_PcbFrame::Solve( wxDC* DC, int two_sides )
Affiche_1_Parametre
(
this
,
38
,
wxT
(
"NoConn"
),
msg
,
CYAN
);
Affiche_1_Parametre
(
this
,
38
,
wxT
(
"NoConn"
),
msg
,
CYAN
);
/* Effacement des affichages de routage sur l'ecran */
/* Effacement des affichages de routage sur l'ecran */
pt_cur_ch
->
pad_s
tart
->
Draw
(
DrawPanel
,
DC
,
GR_AND
);
pt_cur_ch
->
m_PadS
tart
->
Draw
(
DrawPanel
,
DC
,
GR_AND
);
pt_cur_ch
->
pad_e
nd
->
Draw
(
DrawPanel
,
DC
,
GR_AND
);
pt_cur_ch
->
m_PadE
nd
->
Draw
(
DrawPanel
,
DC
,
GR_AND
);
if
(
stop
)
if
(
stop
)
break
;
break
;
...
@@ -315,7 +315,7 @@ int WinEDA_PcbFrame::Solve( wxDC* DC, int two_sides )
...
@@ -315,7 +315,7 @@ int WinEDA_PcbFrame::Solve( wxDC* DC, int two_sides )
/**********************************************************************************/
/**********************************************************************************/
static
int
Autoroute_One_Track
(
WinEDA_PcbFrame
*
pcbframe
,
wxDC
*
DC
,
static
int
Autoroute_One_Track
(
WinEDA_PcbFrame
*
pcbframe
,
wxDC
*
DC
,
int
two_sides
,
int
row_source
,
int
col_source
,
int
two_sides
,
int
row_source
,
int
col_source
,
int
row_target
,
int
col_target
,
CHEVELU
*
pt_chevelu
)
int
row_target
,
int
col_target
,
RATSNEST_ITEM
*
pt_chevelu
)
/**********************************************************************************/
/**********************************************************************************/
/* Route une piste du BOARD.
/* Route une piste du BOARD.
...
@@ -374,8 +374,8 @@ static int Autoroute_One_Track( WinEDA_PcbFrame* pcbframe, wxDC* DC,
...
@@ -374,8 +374,8 @@ static int Autoroute_One_Track( WinEDA_PcbFrame* pcbframe, wxDC* DC,
pt_cur_ch
=
pt_chevelu
;
pt_cur_ch
=
pt_chevelu
;
current_net_code
=
pt_chevelu
->
GetNet
();
current_net_code
=
pt_chevelu
->
GetNet
();
pad_masque_layer_s
=
pt_cur_ch
->
pad_s
tart
->
m_Masque_Layer
;
pad_masque_layer_s
=
pt_cur_ch
->
m_PadS
tart
->
m_Masque_Layer
;
pad_masque_layer_e
=
pt_cur_ch
->
pad_e
nd
->
m_Masque_Layer
;
pad_masque_layer_e
=
pt_cur_ch
->
m_PadE
nd
->
m_Masque_Layer
;
/* Test 1 Si routage possible c.a.d si les pads sont accessibles
/* Test 1 Si routage possible c.a.d si les pads sont accessibles
* sur les couches de routage */
* sur les couches de routage */
...
@@ -390,23 +390,23 @@ static int Autoroute_One_Track( WinEDA_PcbFrame* pcbframe, wxDC* DC,
...
@@ -390,23 +390,23 @@ static int Autoroute_One_Track( WinEDA_PcbFrame* pcbframe, wxDC* DC,
{
{
int
cX
=
(
g_GridRoutingSize
*
col_source
)
+
pcbframe
->
GetBoard
()
->
m_BoundaryBox
.
m_Pos
.
x
;
int
cX
=
(
g_GridRoutingSize
*
col_source
)
+
pcbframe
->
GetBoard
()
->
m_BoundaryBox
.
m_Pos
.
x
;
int
cY
=
(
g_GridRoutingSize
*
row_source
)
+
pcbframe
->
GetBoard
()
->
m_BoundaryBox
.
m_Pos
.
y
;
int
cY
=
(
g_GridRoutingSize
*
row_source
)
+
pcbframe
->
GetBoard
()
->
m_BoundaryBox
.
m_Pos
.
y
;
int
dx
=
pt_cur_ch
->
pad_s
tart
->
m_Size
.
x
/
2
;
int
dx
=
pt_cur_ch
->
m_PadS
tart
->
m_Size
.
x
/
2
;
int
dy
=
pt_cur_ch
->
pad_s
tart
->
m_Size
.
y
/
2
;
int
dy
=
pt_cur_ch
->
m_PadS
tart
->
m_Size
.
y
/
2
;
int
px
=
pt_cur_ch
->
pad_s
tart
->
GetPosition
().
x
;
int
px
=
pt_cur_ch
->
m_PadS
tart
->
GetPosition
().
x
;
int
py
=
pt_cur_ch
->
pad_s
tart
->
GetPosition
().
y
;
int
py
=
pt_cur_ch
->
m_PadS
tart
->
GetPosition
().
y
;
if
(
(
(
pt_cur_ch
->
pad_s
tart
->
m_Orient
/
900
)
&
1
)
!=
0
)
if
(
(
(
pt_cur_ch
->
m_PadS
tart
->
m_Orient
/
900
)
&
1
)
!=
0
)
EXCHG
(
dx
,
dy
);
EXCHG
(
dx
,
dy
);
if
(
(
abs
(
cX
-
px
)
>
dx
)
||
(
abs
(
cY
-
py
)
>
dy
)
)
if
(
(
abs
(
cX
-
px
)
>
dx
)
||
(
abs
(
cY
-
py
)
>
dy
)
)
goto
end_of_route
;
goto
end_of_route
;
cX
=
(
g_GridRoutingSize
*
col_target
)
+
pcbframe
->
GetBoard
()
->
m_BoundaryBox
.
m_Pos
.
x
;
cX
=
(
g_GridRoutingSize
*
col_target
)
+
pcbframe
->
GetBoard
()
->
m_BoundaryBox
.
m_Pos
.
x
;
cY
=
(
g_GridRoutingSize
*
row_target
)
+
pcbframe
->
GetBoard
()
->
m_BoundaryBox
.
m_Pos
.
y
;
cY
=
(
g_GridRoutingSize
*
row_target
)
+
pcbframe
->
GetBoard
()
->
m_BoundaryBox
.
m_Pos
.
y
;
dx
=
pt_cur_ch
->
pad_e
nd
->
m_Size
.
x
/
2
;
dx
=
pt_cur_ch
->
m_PadE
nd
->
m_Size
.
x
/
2
;
dy
=
pt_cur_ch
->
pad_e
nd
->
m_Size
.
y
/
2
;
dy
=
pt_cur_ch
->
m_PadE
nd
->
m_Size
.
y
/
2
;
px
=
pt_cur_ch
->
pad_e
nd
->
GetPosition
().
x
;
px
=
pt_cur_ch
->
m_PadE
nd
->
GetPosition
().
x
;
py
=
pt_cur_ch
->
pad_e
nd
->
GetPosition
().
y
;
py
=
pt_cur_ch
->
m_PadE
nd
->
GetPosition
().
y
;
if
(
(
(
pt_cur_ch
->
pad_e
nd
->
m_Orient
/
900
)
&
1
)
!=
0
)
if
(
(
(
pt_cur_ch
->
m_PadE
nd
->
m_Orient
/
900
)
&
1
)
!=
0
)
EXCHG
(
dx
,
dy
);
EXCHG
(
dx
,
dy
);
if
(
(
abs
(
cX
-
px
)
>
dx
)
||
(
abs
(
cY
-
py
)
>
dy
)
)
if
(
(
abs
(
cX
-
px
)
>
dx
)
||
(
abs
(
cY
-
py
)
>
dy
)
)
...
@@ -427,8 +427,8 @@ static int Autoroute_One_Track( WinEDA_PcbFrame* pcbframe, wxDC* DC,
...
@@ -427,8 +427,8 @@ static int Autoroute_One_Track( WinEDA_PcbFrame* pcbframe, wxDC* DC,
pcbframe
->
Affiche_Message
(
wxT
(
"Gen Cells"
)
);
pcbframe
->
Affiche_Message
(
wxT
(
"Gen Cells"
)
);
Place_1_Pad_Board
(
Place_1_Pad_Board
(
pcbframe
->
GetBoard
(),
pt_cur_ch
->
pad_s
tart
,
CURRENT_PAD
,
marge
,
WRITE_OR_CELL
);
pcbframe
->
GetBoard
(),
pt_cur_ch
->
m_PadS
tart
,
CURRENT_PAD
,
marge
,
WRITE_OR_CELL
);
Place_1_Pad_Board
(
pcbframe
->
GetBoard
(),
pt_cur_ch
->
pad_e
nd
,
CURRENT_PAD
,
marge
,
WRITE_OR_CELL
);
Place_1_Pad_Board
(
pcbframe
->
GetBoard
(),
pt_cur_ch
->
m_PadE
nd
,
CURRENT_PAD
,
marge
,
WRITE_OR_CELL
);
/* Regenere les barrieres restantes (qui peuvent empieter sur le placement
/* Regenere les barrieres restantes (qui peuvent empieter sur le placement
* des bits precedents) */
* des bits precedents) */
...
@@ -436,7 +436,7 @@ static int Autoroute_One_Track( WinEDA_PcbFrame* pcbframe, wxDC* DC,
...
@@ -436,7 +436,7 @@ static int Autoroute_One_Track( WinEDA_PcbFrame* pcbframe, wxDC* DC,
i
=
pcbframe
->
GetBoard
()
->
m_Pads
.
size
();
i
=
pcbframe
->
GetBoard
()
->
m_Pads
.
size
();
for
(
;
i
>
0
;
i
--
,
ptr
++
)
for
(
;
i
>
0
;
i
--
,
ptr
++
)
{
{
if
(
(
pt_cur_ch
->
pad_start
!=
*
ptr
)
&&
(
pt_cur_ch
->
pad_e
nd
!=
*
ptr
)
)
if
(
(
pt_cur_ch
->
m_PadStart
!=
*
ptr
)
&&
(
pt_cur_ch
->
m_PadE
nd
!=
*
ptr
)
)
{
{
Place_1_Pad_Board
(
pcbframe
->
GetBoard
(),
*
ptr
,
~
CURRENT_PAD
,
marge
,
WRITE_AND_CELL
);
Place_1_Pad_Board
(
pcbframe
->
GetBoard
(),
*
ptr
,
~
CURRENT_PAD
,
marge
,
WRITE_AND_CELL
);
}
}
...
@@ -697,9 +697,9 @@ static int Autoroute_One_Track( WinEDA_PcbFrame* pcbframe, wxDC* DC,
...
@@ -697,9 +697,9 @@ static int Autoroute_One_Track( WinEDA_PcbFrame* pcbframe, wxDC* DC,
end_of_route
:
end_of_route
:
Place_1_Pad_Board
(
Place_1_Pad_Board
(
pcbframe
->
GetBoard
(),
pt_cur_ch
->
pad_s
tart
,
~
CURRENT_PAD
,
marge
,
WRITE_AND_CELL
);
pcbframe
->
GetBoard
(),
pt_cur_ch
->
m_PadS
tart
,
~
CURRENT_PAD
,
marge
,
WRITE_AND_CELL
);
Place_1_Pad_Board
(
Place_1_Pad_Board
(
pcbframe
->
GetBoard
(),
pt_cur_ch
->
pad_e
nd
,
~
CURRENT_PAD
,
marge
,
WRITE_AND_CELL
);
pcbframe
->
GetBoard
(),
pt_cur_ch
->
m_PadE
nd
,
~
CURRENT_PAD
,
marge
,
WRITE_AND_CELL
);
AFFICHE_ACTIVITE_ROUTE
;
AFFICHE_ACTIVITE_ROUTE
;
...
@@ -982,17 +982,17 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
...
@@ -982,17 +982,17 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
dx1
=
g_CurrentTrackSegment
->
m_End
.
x
-
g_CurrentTrackSegment
->
m_Start
.
x
;
dx1
=
g_CurrentTrackSegment
->
m_End
.
x
-
g_CurrentTrackSegment
->
m_Start
.
x
;
dy1
=
g_CurrentTrackSegment
->
m_End
.
y
-
g_CurrentTrackSegment
->
m_Start
.
y
;
dy1
=
g_CurrentTrackSegment
->
m_End
.
y
-
g_CurrentTrackSegment
->
m_Start
.
y
;
dx0
=
pt_cur_ch
->
pad_e
nd
->
GetPosition
().
x
-
g_CurrentTrackSegment
->
m_Start
.
x
;
dx0
=
pt_cur_ch
->
m_PadE
nd
->
GetPosition
().
x
-
g_CurrentTrackSegment
->
m_Start
.
x
;
dy0
=
pt_cur_ch
->
pad_e
nd
->
GetPosition
().
y
-
g_CurrentTrackSegment
->
m_Start
.
y
;
dy0
=
pt_cur_ch
->
m_PadE
nd
->
GetPosition
().
y
-
g_CurrentTrackSegment
->
m_Start
.
y
;
/* si aligne: modif du point origine */
/* si aligne: modif du point origine */
if
(
abs
(
dx0
*
dy1
)
==
abs
(
dx1
*
dy0
)
)
/* Alignes ! */
if
(
abs
(
dx0
*
dy1
)
==
abs
(
dx1
*
dy0
)
)
/* Alignes ! */
{
{
g_CurrentTrackSegment
->
m_Start
=
pt_cur_ch
->
pad_e
nd
->
GetPosition
();
g_CurrentTrackSegment
->
m_Start
=
pt_cur_ch
->
m_PadE
nd
->
GetPosition
();
}
}
else
// Creation of a supplemental segment
else
// Creation of a supplemental segment
{
{
g_CurrentTrackSegment
->
m_Start
=
pt_cur_ch
->
pad_e
nd
->
GetPosition
();
g_CurrentTrackSegment
->
m_Start
=
pt_cur_ch
->
m_PadE
nd
->
GetPosition
();
newTrack
=
g_CurrentTrackSegment
->
Copy
();
newTrack
=
g_CurrentTrackSegment
->
Copy
();
newTrack
->
m_Start
=
g_CurrentTrackSegment
->
m_End
;
newTrack
->
m_Start
=
g_CurrentTrackSegment
->
m_End
;
...
@@ -1058,19 +1058,19 @@ static void Place_Piste_en_Buffer( WinEDA_PcbFrame* pcbframe, wxDC* DC )
...
@@ -1058,19 +1058,19 @@ static void Place_Piste_en_Buffer( WinEDA_PcbFrame* pcbframe, wxDC* DC )
dy1
=
g_CurrentTrackSegment
->
m_End
.
y
-
g_CurrentTrackSegment
->
m_Start
.
y
;
dy1
=
g_CurrentTrackSegment
->
m_End
.
y
-
g_CurrentTrackSegment
->
m_Start
.
y
;
/* Replacement sur le centre du pad si hors grille */
/* Replacement sur le centre du pad si hors grille */
dx0
=
pt_cur_ch
->
pad_s
tart
->
GetPosition
().
x
-
g_CurrentTrackSegment
->
m_Start
.
x
;
dx0
=
pt_cur_ch
->
m_PadS
tart
->
GetPosition
().
x
-
g_CurrentTrackSegment
->
m_Start
.
x
;
dy0
=
pt_cur_ch
->
pad_s
tart
->
GetPosition
().
y
-
g_CurrentTrackSegment
->
m_Start
.
y
;
dy0
=
pt_cur_ch
->
m_PadS
tart
->
GetPosition
().
y
-
g_CurrentTrackSegment
->
m_Start
.
y
;
/* si aligne: modif du point origine */
/* si aligne: modif du point origine */
if
(
abs
(
dx0
*
dy1
)
==
abs
(
dx1
*
dy0
)
)
/* Alignes ! */
if
(
abs
(
dx0
*
dy1
)
==
abs
(
dx1
*
dy0
)
)
/* Alignes ! */
{
{
g_CurrentTrackSegment
->
m_End
=
pt_cur_ch
->
pad_s
tart
->
GetPosition
();
g_CurrentTrackSegment
->
m_End
=
pt_cur_ch
->
m_PadS
tart
->
GetPosition
();
}
}
else
/* Creation d'un segment suppl raccord */
else
/* Creation d'un segment suppl raccord */
{
{
TRACK
*
newTrack
=
g_CurrentTrackSegment
->
Copy
();
TRACK
*
newTrack
=
g_CurrentTrackSegment
->
Copy
();
newTrack
->
m_End
=
pt_cur_ch
->
pad_s
tart
->
GetPosition
();
newTrack
->
m_End
=
pt_cur_ch
->
m_PadS
tart
->
GetPosition
();
newTrack
->
m_Start
=
g_CurrentTrackSegment
->
m_End
;
newTrack
->
m_Start
=
g_CurrentTrackSegment
->
m_End
;
g_CurrentTrackList
.
PushBack
(
newTrack
);
g_CurrentTrackList
.
PushBack
(
newTrack
);
...
...
pcbnew/specctra_export.cpp
View file @
e073bdc0
...
@@ -1112,9 +1112,9 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
...
@@ -1112,9 +1112,9 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
// find the highest numbered netCode within the board.
// find the highest numbered netCode within the board.
int
highestNetCode
=
-
1
;
int
highestNetCode
=
-
1
;
for
(
EQUIPOT
*
equipot
=
aBoard
->
m_Equipots
;
equipot
;
equipot
=
equipot
->
Next
()
)
//
for( EQUIPOT* equipot = aBoard->m_Equipots; equipot; equipot = equipot->Next() )
highestNetCode
=
MAX
(
highestNetCode
,
equipot
->
GetNet
()
);
//
highestNetCode = MAX( highestNetCode, equipot->GetNet() );
highestNetCode
=
aBoard
->
m_NetInfo
->
GetCount
()
-
1
;
deleteNETs
();
deleteNETs
();
// expand the net vector to highestNetCode+1, setting empty to NULL
// expand the net vector to highestNetCode+1, setting empty to NULL
...
@@ -1124,11 +1124,12 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
...
@@ -1124,11 +1124,12 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
for
(
unsigned
i
=
1
;
i
<
nets
.
size
();
++
i
)
for
(
unsigned
i
=
1
;
i
<
nets
.
size
();
++
i
)
nets
[
i
]
=
new
NET
(
pcb
->
network
);
nets
[
i
]
=
new
NET
(
pcb
->
network
);
for
(
EQUIPOT
*
equipot
=
aBoard
->
m_Equipots
;
equipot
;
equipot
=
equipot
->
Next
()
)
for
(
unsigned
ii
=
0
;
ii
<
aBoard
->
m_NetInfo
->
GetCount
();
ii
++
)
{
{
int
netcode
=
equipot
->
GetNet
();
NETINFO_ITEM
*
net
=
aBoard
->
m_NetInfo
->
GetItem
(
ii
);
int
netcode
=
net
->
GetNet
();
if
(
netcode
>
0
)
if
(
netcode
>
0
)
nets
[
netcode
]
->
net_id
=
CONV_TO_UTF8
(
equipo
t
->
GetNetname
()
);
nets
[
netcode
]
->
net_id
=
CONV_TO_UTF8
(
ne
t
->
GetNetname
()
);
}
}
items
.
Collect
(
aBoard
,
scanMODULEs
);
items
.
Collect
(
aBoard
,
scanMODULEs
);
...
@@ -1303,9 +1304,9 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
...
@@ -1303,9 +1304,9 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
if
(
old_netcode
!=
netcode
)
if
(
old_netcode
!=
netcode
)
{
{
old_netcode
=
netcode
;
old_netcode
=
netcode
;
EQUIPOT
*
equipo
t
=
aBoard
->
FindNet
(
netcode
);
NETINFO_ITEM
*
ne
t
=
aBoard
->
FindNet
(
netcode
);
wxASSERT
(
equipo
t
);
wxASSERT
(
ne
t
);
netname
=
CONV_TO_UTF8
(
equipo
t
->
GetNetname
()
);
netname
=
CONV_TO_UTF8
(
ne
t
->
GetNetname
()
);
}
}
WIRE
*
wire
=
new
WIRE
(
wiring
);
WIRE
*
wire
=
new
WIRE
(
wiring
);
...
@@ -1364,10 +1365,10 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
...
@@ -1364,10 +1365,10 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
dsnVia
->
padstack_id
=
registered
->
padstack_id
;
dsnVia
->
padstack_id
=
registered
->
padstack_id
;
dsnVia
->
vertexes
.
push_back
(
mapPt
(
via
->
GetPosition
()
)
);
dsnVia
->
vertexes
.
push_back
(
mapPt
(
via
->
GetPosition
()
)
);
EQUIPOT
*
equipo
t
=
aBoard
->
FindNet
(
netcode
);
NETINFO_ITEM
*
ne
t
=
aBoard
->
FindNet
(
netcode
);
wxASSERT
(
equipo
t
);
wxASSERT
(
ne
t
);
dsnVia
->
net_id
=
CONV_TO_UTF8
(
equipo
t
->
GetNetname
()
);
dsnVia
->
net_id
=
CONV_TO_UTF8
(
ne
t
->
GetNetname
()
);
dsnVia
->
via_type
=
T_protect
;
// @todo, this should be configurable
dsnVia
->
via_type
=
T_protect
;
// @todo, this should be configurable
}
}
...
...
pcbnew/specctra_import.cpp
View file @
e073bdc0
...
@@ -447,9 +447,9 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
...
@@ -447,9 +447,9 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
{
{
wxString
netName
=
CONV_FROM_UTF8
(
net
->
net_id
.
c_str
()
);
wxString
netName
=
CONV_FROM_UTF8
(
net
->
net_id
.
c_str
()
);
EQUIPOT
*
equipo
t
=
aBoard
->
FindNet
(
netName
);
NETINFO_ITEM
*
ne
t
=
aBoard
->
FindNet
(
netName
);
if
(
equipo
t
)
if
(
ne
t
)
netCode
=
equipo
t
->
GetNet
();
netCode
=
ne
t
->
GetNet
();
else
// else netCode remains 0
else
// else netCode remains 0
{
{
// int breakhere = 1;
// int breakhere = 1;
...
@@ -508,9 +508,9 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
...
@@ -508,9 +508,9 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
{
{
wxString
netName
=
CONV_FROM_UTF8
(
net
->
net_id
.
c_str
()
);
wxString
netName
=
CONV_FROM_UTF8
(
net
->
net_id
.
c_str
()
);
EQUIPOT
*
equipo
t
=
aBoard
->
FindNet
(
netName
);
NETINFO_ITEM
*
ne
t
=
aBoard
->
FindNet
(
netName
);
if
(
equipo
t
)
if
(
ne
t
)
netCode
=
equipo
t
->
GetNet
();
netCode
=
ne
t
->
GetNet
();
// else netCode remains 0
// else netCode remains 0
}
}
...
...
pcbnew/surbrill.cpp
View file @
e073bdc0
...
@@ -24,10 +24,10 @@ void WinEDA_PcbFrame::Liste_Equipot( wxCommandEvent& event )
...
@@ -24,10 +24,10 @@ void WinEDA_PcbFrame::Liste_Equipot( wxCommandEvent& event )
* if an equipot is selected the corresponding tracks and pads are highlighted
* if an equipot is selected the corresponding tracks and pads are highlighted
*/
*/
{
{
EQUIPOT
*
Equipo
t
;
NETINFO_ITEM
*
ne
t
;
wxString
msg
;
wxString
msg
;
WinEDA_TextFrame
*
List
;
WinEDA_TextFrame
*
List
;
int
ii
,
jj
;
unsigned
ii
;
msg
=
wxT
(
"*"
);
msg
=
wxT
(
"*"
);
Get_Message
(
_
(
"Filter for net names:"
),
_
(
"Net Filter"
),
msg
,
this
);
Get_Message
(
_
(
"Filter for net names:"
),
_
(
"Net Filter"
),
msg
,
this
);
...
@@ -36,16 +36,15 @@ void WinEDA_PcbFrame::Liste_Equipot( wxCommandEvent& event )
...
@@ -36,16 +36,15 @@ void WinEDA_PcbFrame::Liste_Equipot( wxCommandEvent& event )
List
=
new
WinEDA_TextFrame
(
this
,
_
(
"List Nets"
)
);
List
=
new
WinEDA_TextFrame
(
this
,
_
(
"List Nets"
)
);
Equipot
=
(
EQUIPOT
*
)
GetBoard
()
->
m_Equipots
;
for
(
ii
=
0
;
ii
<
GetBoard
()
->
m_NetInfo
->
GetCount
()
;
ii
++
)
for
(
;
Equipot
!=
NULL
;
Equipot
=
(
EQUIPOT
*
)
Equipot
->
Next
()
)
{
{
net
=
GetBoard
()
->
m_NetInfo
->
GetItem
(
ii
);
wxString
Line
;
wxString
Line
;
/* calcul adr relative du nom de la pastille reference de la piste */
if
(
!
WildCompareString
(
msg
,
net
->
GetNetname
(),
false
)
)
if
(
!
WildCompareString
(
msg
,
Equipot
->
GetNetname
(),
FALSE
)
)
continue
;
continue
;
Line
.
Printf
(
wxT
(
"net_code = %3.3d [%.16s] "
),
Equipo
t
->
GetNet
(),
Line
.
Printf
(
wxT
(
"net_code = %3.3d [%.16s] "
),
ne
t
->
GetNet
(),
Equipo
t
->
GetNetname
().
GetData
()
);
ne
t
->
GetNetname
().
GetData
()
);
List
->
Append
(
Line
);
List
->
Append
(
Line
);
}
}
...
@@ -56,17 +55,15 @@ void WinEDA_PcbFrame::Liste_Equipot( wxCommandEvent& event )
...
@@ -56,17 +55,15 @@ void WinEDA_PcbFrame::Liste_Equipot( wxCommandEvent& event )
if
(
ii
<
0
)
if
(
ii
<
0
)
return
;
return
;
/* Recherche du numero de net rellement selectionn�*/
for
(
unsigned
jj
=
0
;
jj
<
GetBoard
()
->
m_NetInfo
->
GetCount
()
;
jj
++
)
Equipot
=
(
EQUIPOT
*
)
GetBoard
()
->
m_Equipots
;
for
(
jj
=
0
;
Equipot
!=
NULL
;
Equipot
=
(
EQUIPOT
*
)
Equipot
->
Next
()
)
{
{
/* calcul adr relative du nom de la pastille reference de la piste */
net
=
GetBoard
()
->
m_NetInfo
->
GetItem
(
ii
);
if
(
!
WildCompareString
(
msg
,
Equipot
->
GetNetname
(),
FALSE
)
)
if
(
!
WildCompareString
(
msg
,
net
->
GetNetname
(),
false
)
)
continue
;
continue
;
if
(
ii
==
jj
)
if
(
ii
==
jj
)
{
{
ii
=
Equipo
t
->
GetNet
();
ii
=
ne
t
->
GetNet
();
break
;
break
;
}
}
jj
++
;
jj
++
;
...
...
pcbnew/tracepcb.cpp
View file @
e073bdc0
...
@@ -178,12 +178,6 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
...
@@ -178,12 +178,6 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
}
}
}
}
// Draw equipots info
for
(
EQUIPOT
*
net
=
m_Equipots
;
net
;
net
=
net
->
Next
()
)
{
if
(
net
->
GetNet
()
!=
0
)
// no net if 0
net
->
Draw
(
aPanel
,
DC
,
aDrawMode
);
}
// @todo: this high-light functionality could be built into me.
// @todo: this high-light functionality could be built into me.
if
(
g_HightLigt_Status
)
if
(
g_HightLigt_Status
)
...
...
pcbnew/undelete.cpp
View file @
e073bdc0
...
@@ -95,9 +95,8 @@ void WinEDA_BasePcbFrame::UnDeleteItem( wxDC* DC )
...
@@ -95,9 +95,8 @@ void WinEDA_BasePcbFrame::UnDeleteItem( wxDC* DC )
item
->
SetState
(
DELETED
,
OFF
);
/* Creal DELETED flag */
item
->
SetState
(
DELETED
,
OFF
);
/* Creal DELETED flag */
item
->
m_Flags
=
0
;
item
->
m_Flags
=
0
;
m_Pcb
->
m_Status_Pcb
=
0
;
GetBoard
()
->
m_Status_Pcb
=
0
;
GetBoard
()
->
Build_Pads_Full_List
();
build_liste_pads
();
ReCompile_Ratsnest_After_Changes
(
DC
);
ReCompile_Ratsnest_After_Changes
(
DC
);
break
;
break
;
#endif
#endif
...
@@ -168,7 +167,8 @@ BOARD_ITEM* WinEDA_BasePcbFrame::SaveItemEfface( BOARD_ITEM* aItem, int nbitems
...
@@ -168,7 +167,8 @@ BOARD_ITEM* WinEDA_BasePcbFrame::SaveItemEfface( BOARD_ITEM* aItem, int nbitems
m_Pcb
->
m_Modules
.
Remove
(
module
);
m_Pcb
->
m_Modules
.
Remove
(
module
);
module
->
SetState
(
DELETED
,
ON
);
module
->
SetState
(
DELETED
,
ON
);
g_UnDeleteStack
[
g_UnDeleteStackPtr
++
]
=
module
;
g_UnDeleteStack
[
g_UnDeleteStackPtr
++
]
=
module
;
build_liste_pads
();
GetBoard
()
->
m_Status_Pcb
=
0
;
GetBoard
()
->
Build_Pads_Full_List
();
}
}
break
;
break
;
#endif
#endif
...
...
pcbnew/work.cpp
View file @
e073bdc0
...
@@ -23,7 +23,7 @@ struct CWORK /* a unit of work is a hole-pair to connect */
...
@@ -23,7 +23,7 @@ struct CWORK /* a unit of work is a hole-pair to connect */
int
net_code
;
/* net_code */
int
net_code
;
/* net_code */
int
ToRow
;
/* target row */
int
ToRow
;
/* target row */
int
ToCol
;
/* target column */
int
ToCol
;
/* target column */
CHEVELU
*
pt_rats
;
/* chevelu correspondant*/
RATSNEST_ITEM
*
pt_rats
;
/* chevelu correspondant*/
int
ApxDist
;
/* approximate distance */
int
ApxDist
;
/* approximate distance */
int
Cost
;
/* cost for sort by length */
int
Cost
;
/* cost for sort by length */
int
Priority
;
/* routage priority */
int
Priority
;
/* routage priority */
...
@@ -38,8 +38,8 @@ static CWORK *Current = NULL;
...
@@ -38,8 +38,8 @@ static CWORK *Current = NULL;
void
InitWork
();
void
InitWork
();
void
ReInitWork
();
void
ReInitWork
();
int
SetWork
(
int
,
int
,
int
,
int
,
int
,
CHEVELU
*
,
int
);
int
SetWork
(
int
,
int
,
int
,
int
,
int
,
RATSNEST_ITEM
*
,
int
);
void
GetWork
(
int
*
,
int
*
,
int
*
,
int
*
,
int
*
,
CHEVELU
**
);
void
GetWork
(
int
*
,
int
*
,
int
*
,
int
*
,
int
*
,
RATSNEST_ITEM
**
);
void
SortWork
();
void
SortWork
();
...
@@ -71,7 +71,7 @@ void ReInitWork()
...
@@ -71,7 +71,7 @@ void ReInitWork()
}
}
/*****************************************************************************/
/*****************************************************************************/
/*int SetWork(int r1,int c1,int* n_c,int r2,int c2,
CHEVELU
* pt_ch,int pri )*/
/*int SetWork(int r1,int c1,int* n_c,int r2,int c2,
RATSNEST_ITEM
* pt_ch,int pri )*/
/*****************************************************************************/
/*****************************************************************************/
/* add a unit of work to the work list
/* add a unit of work to the work list
...
@@ -81,7 +81,7 @@ void ReInitWork()
...
@@ -81,7 +81,7 @@ void ReInitWork()
*/
*/
static
int
GetCost
(
int
r1
,
int
c1
,
int
r2
,
int
c2
);
static
int
GetCost
(
int
r1
,
int
c1
,
int
r2
,
int
c2
);
int
SetWork
(
int
r1
,
int
c1
,
int
n_c
,
int
r2
,
int
c2
,
CHEVELU
*
pt_ch
,
int
pri
)
int
SetWork
(
int
r1
,
int
c1
,
int
n_c
,
int
r2
,
int
c2
,
RATSNEST_ITEM
*
pt_ch
,
int
pri
)
{
{
CWORK
*
p
;
CWORK
*
p
;
...
@@ -113,7 +113,7 @@ CWORK *p;
...
@@ -113,7 +113,7 @@ CWORK *p;
/* void GetWork (int *r1,int *c1,int *r2,int *c2, char **n1,char **n2 ) */
/* void GetWork (int *r1,int *c1,int *r2,int *c2, char **n1,char **n2 ) */
/************************************************************************/
/************************************************************************/
void
GetWork
(
int
*
r1
,
int
*
c1
,
int
*
n_c
,
int
*
r2
,
int
*
c2
,
CHEVELU
**
pt_ch
)
void
GetWork
(
int
*
r1
,
int
*
c1
,
int
*
n_c
,
int
*
r2
,
int
*
c2
,
RATSNEST_ITEM
**
pt_ch
)
/* fetch a unit of work from the work list */
/* fetch a unit of work from the work list */
{
{
if
(
Current
)
if
(
Current
)
...
...
pcbnew/xchgmod.cpp
View file @
e073bdc0
...
@@ -310,7 +310,7 @@ void WinEDA_ExchangeModuleFrame::Change_Module( wxCommandEvent& event )
...
@@ -310,7 +310,7 @@ void WinEDA_ExchangeModuleFrame::Change_Module( wxCommandEvent& event )
if
(
Change_1_Module
(
m_CurrentModule
,
newmodulename
,
TRUE
)
)
if
(
Change_1_Module
(
m_CurrentModule
,
newmodulename
,
TRUE
)
)
{
{
m_Parent
->
GetBoard
()
->
m_Status_Pcb
=
0
;
m_Parent
->
GetBoard
()
->
m_Status_Pcb
=
0
;
m_Parent
->
build_liste_pads
();
m_Parent
->
GetBoard
()
->
Build_Pads_Full_List
();
}
}
}
}
...
@@ -395,7 +395,7 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleId( wxCommandEvent& event )
...
@@ -395,7 +395,7 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleId( wxCommandEvent& event )
if
(
change
)
if
(
change
)
{
{
m_Parent
->
GetBoard
()
->
m_Status_Pcb
=
0
;
m_Parent
->
GetBoard
()
->
m_Status_Pcb
=
0
;
m_Parent
->
build_liste_pads
();
m_Parent
->
GetBoard
()
->
Build_Pads_Full_List
();
}
}
}
}
...
@@ -446,7 +446,7 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleAll( wxCommandEvent& event )
...
@@ -446,7 +446,7 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleAll( wxCommandEvent& event )
if
(
change
)
if
(
change
)
{
{
m_Parent
->
GetBoard
()
->
m_Status_Pcb
=
0
;
m_Parent
->
GetBoard
()
->
m_Status_Pcb
=
0
;
m_Parent
->
build_liste_pads
();
m_Parent
->
GetBoard
()
->
Build_Pads_Full_List
();
}
}
}
}
...
...
pcbnew/zones_by_polygon.cpp
View file @
e073bdc0
...
@@ -793,7 +793,7 @@ void WinEDA_PcbFrame::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container
...
@@ -793,7 +793,7 @@ void WinEDA_PcbFrame::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container
}
}
g_Zone_Default_Setting
.
ExportSetting
(
*
zone_container
);
g_Zone_Default_Setting
.
ExportSetting
(
*
zone_container
);
EQUIPOT
*
net
=
GetBoard
()
->
FindNet
(
g_Zone_Default_Setting
.
m_NetcodeSelection
);
NETINFO_ITEM
*
net
=
GetBoard
()
->
FindNet
(
g_Zone_Default_Setting
.
m_NetcodeSelection
);
if
(
net
)
// net === NULL should not occur
if
(
net
)
// net === NULL should not occur
zone_container
->
m_Netname
=
net
->
GetNetname
();
zone_container
->
m_Netname
=
net
->
GetNetname
();
...
@@ -880,7 +880,7 @@ int WinEDA_PcbFrame::Fill_Zone( wxDC* DC, ZONE_CONTAINER* zone_container, bool v
...
@@ -880,7 +880,7 @@ int WinEDA_PcbFrame::Fill_Zone( wxDC* DC, ZONE_CONTAINER* zone_container, bool v
if
(
g_HightLigth_NetCode
>
0
)
if
(
g_HightLigth_NetCode
>
0
)
{
{
EQUIPOT
*
net
=
GetBoard
()
->
FindNet
(
g_HightLigth_NetCode
);
NETINFO_ITEM
*
net
=
GetBoard
()
->
FindNet
(
g_HightLigth_NetCode
);
if
(
net
==
NULL
)
if
(
net
==
NULL
)
{
{
if
(
g_HightLigth_NetCode
>
0
)
if
(
g_HightLigth_NetCode
>
0
)
...
@@ -943,42 +943,3 @@ int WinEDA_PcbFrame::Fill_All_Zones( bool verbose )
...
@@ -943,42 +943,3 @@ int WinEDA_PcbFrame::Fill_All_Zones( bool verbose )
}
}
/**
* Function SetAreasNetCodesFromNetNames
* Set the .m_NetCode member of all copper areas, according to the area Net Name
* The SetNetCodesFromNetNames is an equivalent to net name, for fast comparisons.
* However the Netcode is an arbitrary equivalence, it must be set after each netlist read
* or net change
* Must be called after pad netcodes are calculated
* @return : error count
* For non copper areas, netcode is set to 0
*/
int
BOARD
::
SetAreasNetCodesFromNetNames
(
void
)
{
int
error_count
=
0
;
for
(
int
ii
=
0
;
ii
<
GetAreaCount
();
ii
++
)
{
if
(
!
GetArea
(
ii
)
->
IsOnCopperLayer
()
)
{
GetArea
(
ii
)
->
SetNet
(
0
);
continue
;
}
if
(
GetArea
(
ii
)
->
GetNet
()
!=
0
)
// i.e. if this zone is connected to a net
{
const
EQUIPOT
*
net
=
FindNet
(
GetArea
(
ii
)
->
m_Netname
);
if
(
net
)
{
GetArea
(
ii
)
->
SetNet
(
net
->
GetNet
()
);
}
else
{
error_count
++
;
GetArea
(
ii
)
->
SetNet
(
-
1
);
//keep Net Name ane set m_NetCode to -1 : error flag
}
}
}
return
error_count
;
}
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