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
2b215d81
Commit
2b215d81
authored
Feb 12, 2008
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
amazing free specctra software
parent
dd141c17
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
869 additions
and
745 deletions
+869
-745
change_log.txt
change_log.txt
+15
-0
undelete.cpp
gerbview/undelete.cpp
+14
-13
class_board.cpp
pcbnew/class_board.cpp
+168
-148
class_board.h
pcbnew/class_board.h
+191
-189
classpcb.cpp
pcbnew/classpcb.cpp
+2
-2
editrack.cpp
pcbnew/editrack.cpp
+8
-11
menubarpcb.cpp
pcbnew/menubarpcb.cpp
+306
-304
solve.cpp
pcbnew/solve.cpp
+7
-8
specctra.h
pcbnew/specctra.h
+6
-1
specctra_export.cpp
pcbnew/specctra_export.cpp
+39
-7
specctra_import.cpp
pcbnew/specctra_import.cpp
+93
-38
undelete.cpp
pcbnew/undelete.cpp
+20
-24
No files found.
change_log.txt
View file @
2b215d81
...
@@ -6,6 +6,21 @@ Please add newer entries at the top, list the date and your name with
...
@@ -6,6 +6,21 @@ Please add newer entries at the top, list the date and your name with
email address.
email address.
2008-Feb-11 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+pcbnew
* Added case TYPETRACK, TYPEVIA, and TYPEMODULE support to Board::Add() so
that we can over time hide more of the storage architecture of a BOARD and
isolate those dependencies in fewer places.
* Fixed some pad orientation issues in specctra_export.
* Added VIA_MICROVIA & VIA_BLIND_BURIED support to SPECCTRA::makeVIA().
* Commented out the specctra design import menu choice for now, don't have
time or need for this import.
* Specctra export adds 1/2 mil to clearance rules for freerouter so that
the routed board clears our DRC checker OK.
* Session import seems done now.
2008-Feb-7 UPDATE Dick Hollenbeck <dick@softplc.com>
2008-Feb-7 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
================================================================================
+pcbnew
+pcbnew
...
...
gerbview/undelete.cpp
View file @
2b215d81
...
@@ -20,7 +20,8 @@ void WinEDA_GerberFrame::UnDeleteItem( wxDC* DC )
...
@@ -20,7 +20,8 @@ void WinEDA_GerberFrame::UnDeleteItem( wxDC* DC )
/* Restitution d'un element (MODULE ou TRACK ) Efface
/* Restitution d'un element (MODULE ou TRACK ) Efface
*/
*/
{
{
EDA_BaseStruct
*
PtStruct
,
*
PtNext
;
BOARD_ITEM
*
item
;
BOARD_ITEM
*
next
;
TRACK
*
pt_track
;
TRACK
*
pt_track
;
int
net_code
;
int
net_code
;
...
@@ -28,25 +29,25 @@ void WinEDA_GerberFrame::UnDeleteItem( wxDC* DC )
...
@@ -28,25 +29,25 @@ void WinEDA_GerberFrame::UnDeleteItem( wxDC* DC )
return
;
return
;
g_UnDeleteStackPtr
--
;
g_UnDeleteStackPtr
--
;
PtStruct
=
g_UnDeleteStack
[
g_UnDeleteStackPtr
];
item
=
g_UnDeleteStack
[
g_UnDeleteStackPtr
];
if
(
PtStruct
==
NULL
)
if
(
item
==
NULL
)
return
;
// Ne devrait pas se produire
return
;
// Ne devrait pas se produire
switch
(
PtStruct
->
Type
()
)
switch
(
item
->
Type
()
)
{
{
case
TYPEVIA
:
case
TYPEVIA
:
case
TYPETRACK
:
case
TYPETRACK
:
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtN
ext
)
for
(
;
item
;
item
=
n
ext
)
{
{
PtNext
=
PtStruct
->
Pnext
;
next
=
item
->
Next
()
;
PtStruct
->
SetState
(
DELETED
,
OFF
);
/* Effacement du bit DELETED */
item
->
SetState
(
DELETED
,
OFF
);
/* Effacement du bit DELETED */
Trace_Segment
(
DrawPanel
,
DC
,
(
TRACK
*
)
PtStruct
,
GR_OR
);
Trace_Segment
(
DrawPanel
,
DC
,
(
TRACK
*
)
item
,
GR_OR
);
}
}
PtStruct
=
g_UnDeleteStack
[
g_UnDeleteStackPtr
];
item
=
g_UnDeleteStack
[
g_UnDeleteStackPtr
];
net_code
=
(
(
TRACK
*
)
PtStruct
)
->
GetNet
();
net_code
=
(
(
TRACK
*
)
item
)
->
GetNet
();
pt_track
=
(
(
TRACK
*
)
PtStruct
)
->
GetBestInsertPoint
(
m_Pcb
);
(
(
TRACK
*
)
PtStruct
)
->
Insert
(
m_Pcb
,
pt_track
);
m_Pcb
->
Add
(
item
);
g_UnDeleteStack
[
g_UnDeleteStackPtr
]
=
NULL
;
g_UnDeleteStack
[
g_UnDeleteStackPtr
]
=
NULL
;
break
;
break
;
...
...
pcbnew/class_board.cpp
View file @
2b215d81
...
@@ -142,6 +142,26 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
...
@@ -142,6 +142,26 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
m_ZoneDescriptorList
.
push_back
(
(
ZONE_CONTAINER
*
)
aBoardItem
);
m_ZoneDescriptorList
.
push_back
(
(
ZONE_CONTAINER
*
)
aBoardItem
);
break
;
break
;
case
TYPETRACK
:
case
TYPEVIA
:
{
TRACK
*
insertAid
=
((
TRACK
*
)
aBoardItem
)
->
GetBestInsertPoint
(
this
);
((
TRACK
*
)
aBoardItem
)
->
Insert
(
this
,
insertAid
);
}
break
;
case
TYPEMODULE
:
// this is an insert, not an append which may also be needed.
{
aBoardItem
->
Pback
=
this
;
BOARD_ITEM
*
next
=
m_Modules
;
aBoardItem
->
Pnext
=
next
;
if
(
next
)
next
->
Pback
=
aBoardItem
;
m_Modules
=
(
MODULE
*
)
aBoardItem
;
}
break
;
// other types may use linked list
// other types may use linked list
default
:
default
:
wxFAIL_MSG
(
wxT
(
"BOARD::Add() needs work"
)
);
wxFAIL_MSG
(
wxT
(
"BOARD::Add() needs work"
)
);
...
...
pcbnew/class_board.h
View file @
2b215d81
...
@@ -71,6 +71,8 @@ public:
...
@@ -71,6 +71,8 @@ public:
* @param aControl An int which can vary how the item is added.
* @param aControl An int which can vary how the item is added.
*/
*/
void
Add
(
BOARD_ITEM
*
aBoardItem
,
int
aControl
=
0
);
void
Add
(
BOARD_ITEM
*
aBoardItem
,
int
aControl
=
0
);
#define ADD_APPEND 1 ///< aControl flag for Add( aControl ), appends not inserts
/**
/**
* Function Delete
* Function Delete
...
...
pcbnew/classpcb.cpp
View file @
2b215d81
...
@@ -150,7 +150,7 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
...
@@ -150,7 +150,7 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
m_ViaDrill
=
250
;
// defualt via drill (for the entire board)
m_ViaDrill
=
250
;
// defualt via drill (for the entire board)
m_ViaDrillCustomValue
=
250
;
// via drill for vias which must have a defined drill value
m_ViaDrillCustomValue
=
250
;
// via drill for vias which must have a defined drill value
m_CurrentViaSize
=
450
;
// Current via size
m_CurrentViaSize
=
450
;
// Current via size
m_CurrentViaType
=
VIA_THROUGH
;
// via type (VIA_BLIND_BURIED, VIA_T
ROUGHT
VIA_MICROVIA)
m_CurrentViaType
=
VIA_THROUGH
;
// via type (VIA_BLIND_BURIED, VIA_T
HROUGH
VIA_MICROVIA)
m_CurrentTrackWidth
=
170
;
// current track width
m_CurrentTrackWidth
=
170
;
// current track width
m_UseConnectedTrackWidth
=
false
;
// if true, when creating a new track starting on an existing track, use this track width
m_UseConnectedTrackWidth
=
false
;
// if true, when creating a new track starting on an existing track, use this track width
m_MicroViaDrill
=
50
;
// micro via drill (for the entire board)
m_MicroViaDrill
=
50
;
// micro via drill (for the entire board)
...
...
pcbnew/editrack.cpp
View file @
2b215d81
...
@@ -387,7 +387,6 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC )
...
@@ -387,7 +387,6 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC )
* Routine de fin de trace d'une piste (succession de segments)
* Routine de fin de trace d'une piste (succession de segments)
*/
*/
{
{
TRACK
*
pt_track
;
int
masquelayer
=
g_TabOneLayerMask
[
GetScreen
()
->
m_Active_Layer
];
int
masquelayer
=
g_TabOneLayerMask
[
GetScreen
()
->
m_Active_Layer
];
wxPoint
pos
;
wxPoint
pos
;
EDA_BaseStruct
*
LockPoint
;
EDA_BaseStruct
*
LockPoint
;
...
@@ -453,11 +452,8 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC )
...
@@ -453,11 +452,8 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC )
/* Test if no segment left. Can happend on a double click on the start point */
/* Test if no segment left. Can happend on a double click on the start point */
if
(
g_FirstTrackSegment
!=
NULL
)
if
(
g_FirstTrackSegment
!=
NULL
)
{
{
/* Put new track in buffer: search the best insertion poinr */
// Put new track in board
pt_track
=
g_FirstTrackSegment
->
GetBestInsertPoint
(
m_Pcb
);
m_Pcb
->
Add
(
g_FirstTrackSegment
);
/* Uut track in linked list */
g_FirstTrackSegment
->
Insert
(
m_Pcb
,
pt_track
);
trace_ratsnest_pad
(
DC
);
trace_ratsnest_pad
(
DC
);
Trace_Une_Piste
(
DrawPanel
,
DC
,
g_FirstTrackSegment
,
g_TrackSegmentCount
,
GR_OR
);
Trace_Une_Piste
(
DrawPanel
,
DC
,
g_FirstTrackSegment
,
g_TrackSegmentCount
,
GR_OR
);
...
@@ -466,7 +462,8 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC )
...
@@ -466,7 +462,8 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC )
TRACK
*
ptr
=
g_FirstTrackSegment
;
int
ii
;
TRACK
*
ptr
=
g_FirstTrackSegment
;
int
ii
;
for
(
ii
=
0
;
(
ptr
!=
NULL
)
&&
(
ii
<
g_TrackSegmentCount
);
ii
++
)
for
(
ii
=
0
;
(
ptr
!=
NULL
)
&&
(
ii
<
g_TrackSegmentCount
);
ii
++
)
{
{
ptr
->
m_Flags
=
0
;
ptr
=
ptr
->
Next
();
ptr
->
m_Flags
=
0
;
ptr
=
ptr
->
Next
();
}
}
/* Delete the old track, if exists */
/* Delete the old track, if exists */
...
...
pcbnew/menubarpcb.cpp
View file @
2b215d81
...
@@ -126,10 +126,12 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
...
@@ -126,10 +126,12 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
item
->
SetBitmap
(
export_xpm
);
// @todo need better bitmap
item
->
SetBitmap
(
export_xpm
);
// @todo need better bitmap
submenuImport
->
Append
(
item
);
submenuImport
->
Append
(
item
);
/* would be implemented in WinEDA_PcbFrame::ImportSpecctraDesign() in specctra_import.cpp
item = new wxMenuItem(submenuImport, ID_GEN_IMPORT_SPECCTRA_DESIGN,
item = new wxMenuItem(submenuImport, ID_GEN_IMPORT_SPECCTRA_DESIGN,
_("&Specctra Design"), _("Import a \"Specctra Design\" (*.dsn) file") );
_("&Specctra Design"), _("Import a \"Specctra Design\" (*.dsn) file") );
item->SetBitmap(export_xpm); // @todo need better bitmap
item->SetBitmap(export_xpm); // @todo need better bitmap
submenuImport->Append(item);
submenuImport->Append(item);
*/
ADD_MENUITEM_WITH_HELP_AND_SUBMENU
(
m_FilesMenu
,
submenuImport
,
ADD_MENUITEM_WITH_HELP_AND_SUBMENU
(
m_FilesMenu
,
submenuImport
,
ID_GEN_IMPORT_FILE
,
_
(
"Import"
),
_
(
"Import files"
),
export_xpm
);
ID_GEN_IMPORT_FILE
,
_
(
"Import"
),
_
(
"Import files"
),
export_xpm
);
...
...
pcbnew/solve.cpp
View file @
2b215d81
...
@@ -1082,8 +1082,7 @@ static void Place_Piste_en_Buffer( WinEDA_PcbFrame* pcbframe, wxDC* DC )
...
@@ -1082,8 +1082,7 @@ static void Place_Piste_en_Buffer( WinEDA_PcbFrame* pcbframe, wxDC* DC )
g_CurrentTrackSegment
->
SetState
(
END_ONPAD
,
ON
);
g_CurrentTrackSegment
->
SetState
(
END_ONPAD
,
ON
);
/* recherche de la zone de rangement et insertion de la nouvelle piste */
/* recherche de la zone de rangement et insertion de la nouvelle piste */
pt_track
=
g_FirstTrackSegment
->
GetBestInsertPoint
(
pcbframe
->
m_Pcb
);
pcbframe
->
m_Pcb
->
Add
(
g_FirstTrackSegment
);
g_FirstTrackSegment
->
Insert
(
pcbframe
->
m_Pcb
,
pt_track
);
Trace_Une_Piste
(
panel
,
DC
,
g_FirstTrackSegment
,
g_TrackSegmentCount
,
GR_OR
);
Trace_Une_Piste
(
panel
,
DC
,
g_FirstTrackSegment
,
g_TrackSegmentCount
,
GR_OR
);
...
...
pcbnew/specctra.h
View file @
2b215d81
...
@@ -3760,7 +3760,12 @@ class SPECCTRA_DB : public OUTPUTFORMATTER
...
@@ -3760,7 +3760,12 @@ class SPECCTRA_DB : public OUTPUTFORMATTER
TRACK
*
makeTRACK
(
PATH
*
aPath
,
int
aPointIndex
,
int
aNetcode
)
throw
(
IOError
);
TRACK
*
makeTRACK
(
PATH
*
aPath
,
int
aPointIndex
,
int
aNetcode
)
throw
(
IOError
);
SEGVIA
*
makeVIA
(
PADSTACK
*
aPadstack
,
const
POINT
&
aPoint
,
int
aNetCode
);
/**
* Function makeVIA
* instantiates a Kicad SEGVIA on the heap and initializes it with internal
* values consistent with the given PADSTACK, POINT, and netcode.
*/
SEGVIA
*
makeVIA
(
PADSTACK
*
aPadstack
,
const
POINT
&
aPoint
,
int
aNetCode
)
throw
(
IOError
);
//-----</FromSESSION>----------------------------------------------------
//-----</FromSESSION>----------------------------------------------------
...
...
pcbnew/specctra_export.cpp
View file @
2b215d81
...
@@ -37,6 +37,8 @@
...
@@ -37,6 +37,8 @@
#include "wxPcbStruct.h" // Change_Side_Module()
#include "wxPcbStruct.h" // Change_Side_Module()
#include "pcbstruct.h" // HISTORY_NUMBER
#include "pcbstruct.h" // HISTORY_NUMBER
#include "autorout.h" // NET_CODES_OK
#include "autorout.h" // NET_CODES_OK
#include "trigo.h" // RotatePoint()
#include <set> // std::set
#include <set> // std::set
...
@@ -351,8 +353,38 @@ IMAGE* SPECCTRA_DB::makeIMAGE( MODULE* aModule )
...
@@ -351,8 +353,38 @@ IMAGE* SPECCTRA_DB::makeIMAGE( MODULE* aModule )
pin
->
padstack_id
=
padstack
->
padstack_id
;
pin
->
padstack_id
=
padstack
->
padstack_id
;
pin
->
pin_id
=
CONV_TO_UTF8
(
pad
->
ReturnStringPadName
()
);
pin
->
pin_id
=
CONV_TO_UTF8
(
pad
->
ReturnStringPadName
()
);
#if 0
if( pad->m_Orient )
{
int angle = pad->m_Orient - aModule->m_Orient; // tenths of degrees
NORMALIZE_ANGLE_POS(angle);
pin->SetRotation( angle / 10.0 );
}
#else
{
int
angle
=
pad
->
m_Orient
-
aModule
->
m_Orient
;
// tenths of degrees
if
(
angle
)
{
NORMALIZE_ANGLE_POS
(
angle
);
pin
->
SetRotation
(
angle
/
10.0
);
}
}
#endif
wxPoint
pos
;
int
angle
=
pad
->
m_Orient
-
aModule
->
m_Orient
;
// tenths of degrees
if
(
angle
&&
(
pad
->
m_Offset
.
x
||
pad
->
m_Offset
.
y
)
)
{
wxPoint
offset
(
pad
->
m_Offset
.
x
,
pad
->
m_Offset
.
y
);
RotatePoint
(
&
offset
,
angle
);
pos
=
pad
->
m_Pos0
+
offset
;
}
else
{
// copper shape's position is hole position + offset
// copper shape's position is hole position + offset
wxPoint
pos
=
pad
->
m_Pos0
+
pad
->
m_Offset
;
pos
=
pad
->
m_Pos0
+
pad
->
m_Offset
;
}
pin
->
SetVertex
(
mapPt
(
pos
)
);
pin
->
SetVertex
(
mapPt
(
pos
)
);
}
}
...
@@ -385,8 +417,8 @@ PADSTACK* SPECCTRA_DB::makeVia( const SEGVIA* aVia )
...
@@ -385,8 +417,8 @@ PADSTACK* SPECCTRA_DB::makeVia( const SEGVIA* aVia )
circle
->
SetLayerId
(
"signal"
);
circle
->
SetLayerId
(
"signal"
);
snprintf
(
name
,
sizeof
(
name
),
"Via
_
%.6g:%.6g_mil"
,
dsnDiameter
,
snprintf
(
name
,
sizeof
(
name
),
"Via
[A]
%.6g:%.6g_mil"
,
dsnDiameter
,
// encode the drill value in the name for later import
// encode the drill value in
to
the name for later import
scale
(
aVia
->
GetDrillValue
()
)
);
scale
(
aVia
->
GetDrillValue
()
)
);
name
[
sizeof
(
name
)
-
1
]
=
0
;
name
[
sizeof
(
name
)
-
1
]
=
0
;
padstack
->
SetPadstackId
(
name
);
padstack
->
SetPadstackId
(
name
);
...
@@ -418,7 +450,7 @@ PADSTACK* SPECCTRA_DB::makeVia( const SEGVIA* aVia )
...
@@ -418,7 +450,7 @@ PADSTACK* SPECCTRA_DB::makeVia( const SEGVIA* aVia )
snprintf
(
name
,
sizeof
(
name
),
"Via[%d-%d]_%.6g:%.6g_mil"
,
snprintf
(
name
,
sizeof
(
name
),
"Via[%d-%d]_%.6g:%.6g_mil"
,
topLayer
,
botLayer
,
dsnDiameter
,
topLayer
,
botLayer
,
dsnDiameter
,
// encode the drill value in the name for later import
// encode the drill value in
to
the name for later import
scale
(
aVia
->
GetDrillValue
()
)
scale
(
aVia
->
GetDrillValue
()
)
);
);
name
[
sizeof
(
name
)
-
1
]
=
0
;
name
[
sizeof
(
name
)
-
1
]
=
0
;
...
@@ -446,8 +478,8 @@ PADSTACK* SPECCTRA_DB::makeVia( int aCopperDiameter, int aDrillDiameter )
...
@@ -446,8 +478,8 @@ PADSTACK* SPECCTRA_DB::makeVia( int aCopperDiameter, int aDrillDiameter )
circle
->
SetLayerId
(
"signal"
);
circle
->
SetLayerId
(
"signal"
);
snprintf
(
name
,
sizeof
(
name
),
"Via
_
%.6g:%.6g_mil"
,
dsnDiameter
,
snprintf
(
name
,
sizeof
(
name
),
"Via
[A]
%.6g:%.6g_mil"
,
dsnDiameter
,
// encode the drill value in the name for later import
// encode the drill value in
to
the name for later import
scale
(
aDrillDiameter
)
);
scale
(
aDrillDiameter
)
);
name
[
sizeof
(
name
)
-
1
]
=
0
;
name
[
sizeof
(
name
)
-
1
]
=
0
;
padstack
->
SetPadstackId
(
name
);
padstack
->
SetPadstackId
(
name
);
...
...
pcbnew/specctra_import.cpp
View file @
2b215d81
...
@@ -150,6 +150,14 @@ static int scale( double distance, UNIT_RES* aResolution )
...
@@ -150,6 +150,14 @@ static int scale( double distance, UNIT_RES* aResolution )
return
ret
;
return
ret
;
}
}
/**
* Function mapPt
* translates a point from the Specctra Session format coordinate system
* to the Kicad coordinate system.
* @param aPoint The session point to translate
* @return wxPoint - The Kicad coordinate system point.
*/
static
wxPoint
mapPt
(
const
POINT
&
aPoint
,
UNIT_RES
*
aResolution
)
static
wxPoint
mapPt
(
const
POINT
&
aPoint
,
UNIT_RES
*
aResolution
)
{
{
wxPoint
ret
(
scale
(
aPoint
.
x
,
aResolution
),
wxPoint
ret
(
scale
(
aPoint
.
x
,
aResolution
),
...
@@ -182,16 +190,14 @@ TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode ) thro
...
@@ -182,16 +190,14 @@ TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode ) thro
}
}
SEGVIA
*
SPECCTRA_DB
::
makeVIA
(
PADSTACK
*
aPadstack
,
const
POINT
&
aPoint
,
int
aNetCode
)
SEGVIA
*
SPECCTRA_DB
::
makeVIA
(
PADSTACK
*
aPadstack
,
const
POINT
&
aPoint
,
int
aNetCode
)
throw
(
IOError
)
{
{
SEGVIA
*
via
=
0
;
SEGVIA
*
via
=
0
;
SHAPE
*
shape
;
SHAPE
*
shape
;
int
shapeCount
=
aPadstack
->
Length
();
int
shapeCount
=
aPadstack
->
Length
();
int
drillDiam
=
-
1
;
int
drillDiam
=
-
1
;
int
viaDiam
=
400
;
int
copperLayerCount
=
sessionBoard
->
GetCopperLayerCount
();
// @todo this needs a lot of work yet, it is not complete yet.
// The drill diameter is encoded in the padstack name if PCBNEW did the DSN export.
// The drill diameter is encoded in the padstack name if PCBNEW did the DSN export.
...
@@ -200,15 +206,16 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
...
@@ -200,15 +206,16 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
if
(
drillStartNdx
!=
-
1
)
if
(
drillStartNdx
!=
-
1
)
{
{
++
drillStartNdx
;
// skip over the ':'
int
drillEndNdx
=
aPadstack
->
padstack_id
.
rfind
(
'_'
);
int
drillEndNdx
=
aPadstack
->
padstack_id
.
rfind
(
'_'
);
if
(
drillEndNdx
!=
-
1
)
if
(
drillEndNdx
!=
-
1
)
{
{
std
::
string
diamTxt
(
aPadstack
->
padstack_id
,
drillStartNdx
+
1
,
drillEndNdx
-
drillStartNdx
-
1
);
std
::
string
diamTxt
(
aPadstack
->
padstack_id
,
drillStartNdx
,
drillEndNdx
-
drillStartNdx
);
const
char
*
sdiamTxt
=
diamTxt
.
c_str
();
const
char
*
sdiamTxt
=
diamTxt
.
c_str
();
double
drillMils
=
strtod
(
sdiamTxt
,
0
);
double
drillMils
=
strtod
(
sdiamTxt
,
0
);
// drillMils is not in the session units, but actual mils so we don't use scale()
// drillMils is not in the session units, but actual mils so we don't use scale()
drillDiam
=
drillMils
*
10
;
drillDiam
=
(
int
)
(
drillMils
*
10
)
;
if
(
drillDiam
==
g_DesignSettings
.
m_ViaDrill
)
// default
if
(
drillDiam
==
g_DesignSettings
.
m_ViaDrill
)
// default
drillDiam
=
-
1
;
// import as default
drillDiam
=
-
1
;
// import as default
...
@@ -217,14 +224,18 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
...
@@ -217,14 +224,18 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
if
(
shapeCount
==
0
)
if
(
shapeCount
==
0
)
{
{
ThrowIOError
(
_
(
"Session via padstack has no shapes"
)
);
}
}
else
if
(
shapeCount
==
1
)
else
if
(
shapeCount
==
1
)
{
{
shape
=
(
SHAPE
*
)
(
*
aPadstack
)[
0
];
shape
=
(
SHAPE
*
)
(
*
aPadstack
)[
0
];
if
(
shape
->
shape
->
Type
()
==
T_circle
)
DSN_T
type
=
shape
->
shape
->
Type
();
{
if
(
type
!=
T_circle
)
ThrowIOError
(
_
(
"Unsupported via shape:
\"
%s
\"
"
),
LEXER
::
GetTokenString
(
type
).
GetData
()
);
CIRCLE
*
circle
=
(
CIRCLE
*
)
shape
->
shape
;
CIRCLE
*
circle
=
(
CIRCLE
*
)
shape
->
shape
;
viaDiam
=
scale
(
circle
->
diameter
,
routeResolution
);
int
viaDiam
=
scale
(
circle
->
diameter
,
routeResolution
);
via
=
new
SEGVIA
(
sessionBoard
);
via
=
new
SEGVIA
(
sessionBoard
);
via
->
SetPosition
(
mapPt
(
aPoint
,
routeResolution
)
);
via
->
SetPosition
(
mapPt
(
aPoint
,
routeResolution
)
);
...
@@ -233,14 +244,16 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
...
@@ -233,14 +244,16 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
via
->
m_Width
=
viaDiam
;
via
->
m_Width
=
viaDiam
;
via
->
SetLayerPair
(
CMP_N
,
COPPER_LAYER_N
);
via
->
SetLayerPair
(
CMP_N
,
COPPER_LAYER_N
);
}
}
}
else
if
(
shapeCount
==
copperLayerCount
)
else
if
(
shapeCount
==
sessionBoard
->
GetCopperLayerCount
()
)
{
{
shape
=
(
SHAPE
*
)
(
*
aPadstack
)[
0
];
shape
=
(
SHAPE
*
)
(
*
aPadstack
)[
0
];
if
(
shape
->
shape
->
Type
()
==
T_circle
)
DSN_T
type
=
shape
->
shape
->
Type
();
{
if
(
type
!=
T_circle
)
ThrowIOError
(
_
(
"Unsupported via shape:
\"
%s
\"
"
),
LEXER
::
GetTokenString
(
type
).
GetData
()
);
CIRCLE
*
circle
=
(
CIRCLE
*
)
shape
->
shape
;
CIRCLE
*
circle
=
(
CIRCLE
*
)
shape
->
shape
;
viaDiam
=
scale
(
circle
->
diameter
,
routeResolution
);
int
viaDiam
=
scale
(
circle
->
diameter
,
routeResolution
);
via
=
new
SEGVIA
(
sessionBoard
);
via
=
new
SEGVIA
(
sessionBoard
);
via
->
SetPosition
(
mapPt
(
aPoint
,
routeResolution
)
);
via
->
SetPosition
(
mapPt
(
aPoint
,
routeResolution
)
);
...
@@ -249,6 +262,56 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
...
@@ -249,6 +262,56 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
via
->
m_Width
=
viaDiam
;
via
->
m_Width
=
viaDiam
;
via
->
SetLayerPair
(
CMP_N
,
COPPER_LAYER_N
);
via
->
SetLayerPair
(
CMP_N
,
COPPER_LAYER_N
);
}
}
else
// VIA_MICROVIA or VIA_BLIND_BURIED
{
int
topLayerNdx
=
-
1
;
int
botLayerNdx
=
7000
;
int
viaDiam
=
-
1
;
for
(
int
i
=
0
;
i
<
shapeCount
;
++
i
)
{
shape
=
(
SHAPE
*
)
(
*
aPadstack
)[
i
];
DSN_T
type
=
shape
->
shape
->
Type
();
if
(
type
!=
T_circle
)
ThrowIOError
(
_
(
"Unsupported via shape:
\"
%s
\"
"
),
LEXER
::
GetTokenString
(
type
).
GetData
()
);
CIRCLE
*
circle
=
(
CIRCLE
*
)
shape
->
shape
;
int
layerNdx
=
findLayerName
(
circle
->
layer_id
);
if
(
layerNdx
==
-
1
)
{
wxString
layerName
=
CONV_FROM_UTF8
(
circle
->
layer_id
.
c_str
()
);
ThrowIOError
(
_
(
"Session file uses invalid layer id
\"
%s
\"
"
),
layerName
.
GetData
()
);
}
if
(
layerNdx
>
topLayerNdx
)
topLayerNdx
=
layerNdx
;
if
(
layerNdx
<
botLayerNdx
)
botLayerNdx
=
layerNdx
;
if
(
viaDiam
==
-
1
)
viaDiam
=
scale
(
circle
->
diameter
,
routeResolution
);
}
via
=
new
SEGVIA
(
sessionBoard
);
via
->
SetPosition
(
mapPt
(
aPoint
,
routeResolution
)
);
via
->
SetDrillValue
(
drillDiam
);
if
(
(
topLayerNdx
==
0
&&
botLayerNdx
==
1
)
||
(
topLayerNdx
==
copperLayerCount
-
2
&&
botLayerNdx
==
copperLayerCount
-
1
))
via
->
m_Shape
=
VIA_MICROVIA
;
else
via
->
m_Shape
=
VIA_BLIND_BURIED
;
via
->
m_Width
=
viaDiam
;
topLayerNdx
=
pcbLayer2kicad
[
topLayerNdx
];
botLayerNdx
=
pcbLayer2kicad
[
botLayerNdx
];
via
->
SetLayerPair
(
topLayerNdx
,
botLayerNdx
);
}
}
if
(
via
)
if
(
via
)
...
@@ -365,7 +428,6 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
...
@@ -365,7 +428,6 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
// else netCode remains 0
// else netCode remains 0
}
}
WIRES
&
wires
=
net
->
wires
;
WIRES
&
wires
=
net
->
wires
;
for
(
unsigned
i
=
0
;
i
<
wires
.
size
();
++
i
)
for
(
unsigned
i
=
0
;
i
<
wires
.
size
();
++
i
)
{
{
...
@@ -386,9 +448,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
...
@@ -386,9 +448,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
for
(
unsigned
pt
=
0
;
pt
<
path
->
points
.
size
()
-
1
;
++
pt
)
for
(
unsigned
pt
=
0
;
pt
<
path
->
points
.
size
()
-
1
;
++
pt
)
{
{
TRACK
*
track
=
makeTRACK
(
path
,
pt
,
netCode
);
TRACK
*
track
=
makeTRACK
(
path
,
pt
,
netCode
);
aBoard
->
Add
(
track
);
TRACK
*
insertAid
=
track
->
GetBestInsertPoint
(
aBoard
);
track
->
Insert
(
aBoard
,
insertAid
);
}
}
}
}
...
@@ -428,12 +488,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
...
@@ -428,12 +488,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
for
(
unsigned
v
=
0
;
v
<
wire_via
->
vertexes
.
size
();
++
v
)
for
(
unsigned
v
=
0
;
v
<
wire_via
->
vertexes
.
size
();
++
v
)
{
{
SEGVIA
*
via
=
makeVIA
(
padstack
,
wire_via
->
vertexes
[
v
],
netCode
);
SEGVIA
*
via
=
makeVIA
(
padstack
,
wire_via
->
vertexes
[
v
],
netCode
);
aBoard
->
Add
(
via
);
if
(
!
via
)
ThrowIOError
(
_
(
"Unable to make a via"
)
);
TRACK
*
insertAid
=
via
->
GetBestInsertPoint
(
aBoard
);
via
->
Insert
(
aBoard
,
insertAid
);
}
}
}
}
}
}
...
...
pcbnew/undelete.cpp
View file @
2b215d81
...
@@ -21,33 +21,33 @@ void WinEDA_PcbFrame::UnDeleteItem( wxDC* DC )
...
@@ -21,33 +21,33 @@ void WinEDA_PcbFrame::UnDeleteItem( wxDC* DC )
/* Restitution d'un element (MODULE ou TRACK ) Efface
/* Restitution d'un element (MODULE ou TRACK ) Efface
*/
*/
{
{
BOARD_ITEM
*
PtStruct
,
*
PtNext
;
BOARD_ITEM
*
item
;
TRACK
*
pt_track
;
BOARD_ITEM
*
next
;
int
net_code
;
int
net_code
;
if
(
!
g_UnDeleteStackPtr
)
if
(
!
g_UnDeleteStackPtr
)
return
;
return
;
g_UnDeleteStackPtr
--
;
g_UnDeleteStackPtr
--
;
PtStruct
=
g_UnDeleteStack
[
g_UnDeleteStackPtr
];
item
=
g_UnDeleteStack
[
g_UnDeleteStackPtr
];
if
(
PtStruct
==
NULL
)
if
(
item
==
NULL
)
return
;
// Ne devrait pas se produire
return
;
// Ne devrait pas se produire
switch
(
PtStruct
->
Type
()
)
switch
(
item
->
Type
()
)
{
{
case
TYPEVIA
:
case
TYPEVIA
:
case
TYPETRACK
:
case
TYPETRACK
:
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtN
ext
)
for
(
;
item
;
item
=
n
ext
)
{
{
PtNext
=
PtStruct
->
Next
();
next
=
item
->
Next
();
PtStruct
->
SetState
(
DELETED
,
OFF
);
/* Effacement du bit DELETED */
item
->
SetState
(
DELETED
,
OFF
);
/* Effacement du bit DELETED */
(
(
TRACK
*
)
PtStruct
)
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
(
(
TRACK
*
)
item
)
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
}
}
PtStruct
=
g_UnDeleteStack
[
g_UnDeleteStackPtr
];
item
=
g_UnDeleteStack
[
g_UnDeleteStackPtr
];
net_code
=
(
(
TRACK
*
)
PtStruct
)
->
GetNet
();
net_code
=
(
(
TRACK
*
)
item
)
->
GetNet
();
pt_track
=
(
(
TRACK
*
)
PtStruct
)
->
GetBestInsertPoint
(
m_Pcb
);
(
(
TRACK
*
)
PtStruct
)
->
Insert
(
m_Pcb
,
pt_track
);
m_Pcb
->
Add
(
item
);
g_UnDeleteStack
[
g_UnDeleteStackPtr
]
=
NULL
;
g_UnDeleteStack
[
g_UnDeleteStackPtr
]
=
NULL
;
test_1_net_connexion
(
DC
,
net_code
);
test_1_net_connexion
(
DC
,
net_code
);
...
@@ -61,18 +61,14 @@ void WinEDA_PcbFrame::UnDeleteItem( wxDC* DC )
...
@@ -61,18 +61,14 @@ void WinEDA_PcbFrame::UnDeleteItem( wxDC* DC )
/* Reinsertion du module dans la liste chainee des modules,
/* Reinsertion du module dans la liste chainee des modules,
* en debut de chaine */
* en debut de chaine */
PtStruct
->
Pback
=
m_Pcb
;
m_Pcb
->
Add
(
item
);
PtNext
=
m_Pcb
->
m_Modules
;
PtStruct
->
Pnext
=
PtNext
;
if
(
PtNext
)
PtNext
->
Pback
=
PtStruct
;
m_Pcb
->
m_Modules
=
(
MODULE
*
)
PtStruct
;
g_UnDeleteStack
[
g_UnDeleteStackPtr
]
=
NULL
;
g_UnDeleteStack
[
g_UnDeleteStackPtr
]
=
NULL
;
(
(
MODULE
*
)
PtStruct
)
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_OR
);
(
(
MODULE
*
)
item
)
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_OR
);
PtStruct
->
SetState
(
DELETED
,
OFF
);
/* Creal DELETED flag */
item
->
SetState
(
DELETED
,
OFF
);
/* Creal DELETED flag */
PtStruct
->
m_Flags
=
0
;
item
->
m_Flags
=
0
;
m_Pcb
->
m_Status_Pcb
=
0
;
m_Pcb
->
m_Status_Pcb
=
0
;
build_liste_pads
();
build_liste_pads
();
ReCompile_Ratsnest_After_Changes
(
DC
);
ReCompile_Ratsnest_After_Changes
(
DC
);
...
...
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