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
3a9f3f89
Commit
3a9f3f89
authored
Apr 28, 2013
by
Felix Morgner
Browse files
Options
Browse Files
Download
Plain Diff
merge with upstream
parents
6c2c6477
4a9681d5
Changes
29
Show whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
288 additions
and
214 deletions
+288
-214
drawframe.cpp
common/drawframe.cpp
+2
-1
autosel.cpp
cvpcb/autosel.cpp
+1
-1
cvframe.cpp
cvpcb/cvframe.cpp
+7
-7
listboxes.cpp
cvpcb/listboxes.cpp
+1
-1
readwrite_dlgs.cpp
cvpcb/readwrite_dlgs.cpp
+5
-5
class_libentry.cpp
eeschema/class_libentry.cpp
+3
-3
dialog_erc.cpp
eeschema/dialogs/dialog_erc.cpp
+1
-1
edit_label.cpp
eeschema/edit_label.cpp
+1
-1
files-io.cpp
eeschema/files-io.cpp
+2
-1
libedit.cpp
eeschema/libedit.cpp
+6
-4
load_one_schematic_file.cpp
eeschema/load_one_schematic_file.cpp
+1
-1
schframe.cpp
eeschema/schframe.cpp
+8
-4
sheet.cpp
eeschema/sheet.cpp
+1
-1
common.h
include/common.h
+0
-2
macros.h
include/macros.h
+57
-71
wxstruct.h
include/wxstruct.h
+0
-5
class_board.cpp
pcbnew/class_board.cpp
+7
-7
class_track.cpp
pcbnew/class_track.cpp
+0
-2
dialog_edit_module_for_Modedit.cpp
pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp
+2
-2
dialog_gendrill.cpp
pcbnew/dialogs/dialog_gendrill.cpp
+7
-8
dialog_netlist.cpp
pcbnew/dialogs/dialog_netlist.cpp
+1
-0
editrack.cpp
pcbnew/editrack.cpp
+1
-1
gendrill_Excellon_writer.h
pcbnew/gendrill_Excellon_writer.h
+3
-2
kicad_netlist_reader.cpp
pcbnew/kicad_netlist_reader.cpp
+10
-9
legacy_netlist_reader.cpp
pcbnew/legacy_netlist_reader.cpp
+20
-4
netlist.cpp
pcbnew/netlist.cpp
+18
-7
netlist_reader.cpp
pcbnew/netlist_reader.cpp
+47
-26
netlist_reader.h
pcbnew/netlist_reader.h
+75
-36
specctra_import.cpp
pcbnew/specctra_import.cpp
+1
-1
No files found.
common/drawframe.cpp
View file @
3a9f3f89
...
@@ -168,7 +168,8 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* aParent,
...
@@ -168,7 +168,8 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* aParent,
EDA_DRAW_FRAME
::~
EDA_DRAW_FRAME
()
EDA_DRAW_FRAME
::~
EDA_DRAW_FRAME
()
{
{
SAFE_DELETE
(
m_currentScreen
);
delete
m_currentScreen
;
m_currentScreen
=
NULL
;
m_auimgr
.
UnInit
();
m_auimgr
.
UnInit
();
}
}
...
...
cvpcb/autosel.cpp
View file @
3a9f3f89
...
@@ -165,7 +165,7 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
...
@@ -165,7 +165,7 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
bool
found
=
false
;
bool
found
=
false
;
m_ListCmp
->
SetSelection
(
ii
++
,
true
);
m_ListCmp
->
SetSelection
(
ii
++
,
true
);
if
(
!
component
->
GetFootprint
Lib
Name
().
IsEmpty
()
)
if
(
!
component
->
GetFootprintName
().
IsEmpty
()
)
continue
;
continue
;
BOOST_FOREACH
(
FOOTPRINT_ALIAS
&
alias
,
aliases
)
BOOST_FOREACH
(
FOOTPRINT_ALIAS
&
alias
,
aliases
)
...
...
cvpcb/cvframe.cpp
View file @
3a9f3f89
...
@@ -344,7 +344,7 @@ void CVPCB_MAINFRAME::ToFirstNA( wxCommandEvent& event )
...
@@ -344,7 +344,7 @@ void CVPCB_MAINFRAME::ToFirstNA( wxCommandEvent& event )
for
(
unsigned
jj
=
0
;
jj
<
m_netlist
.
GetCount
();
jj
++
)
for
(
unsigned
jj
=
0
;
jj
<
m_netlist
.
GetCount
();
jj
++
)
{
{
if
(
m_netlist
.
GetComponent
(
jj
)
->
GetFootprint
Lib
Name
().
IsEmpty
()
&&
ii
>
selection
)
if
(
m_netlist
.
GetComponent
(
jj
)
->
GetFootprintName
().
IsEmpty
()
&&
ii
>
selection
)
{
{
m_ListCmp
->
SetSelection
(
ii
);
m_ListCmp
->
SetSelection
(
ii
);
SendMessageToEESCHEMA
();
SendMessageToEESCHEMA
();
...
@@ -374,7 +374,7 @@ void CVPCB_MAINFRAME::ToPreviousNA( wxCommandEvent& event )
...
@@ -374,7 +374,7 @@ void CVPCB_MAINFRAME::ToPreviousNA( wxCommandEvent& event )
for
(
unsigned
kk
=
m_netlist
.
GetCount
()
-
1
;
kk
>=
0
;
kk
--
)
for
(
unsigned
kk
=
m_netlist
.
GetCount
()
-
1
;
kk
>=
0
;
kk
--
)
{
{
if
(
m_netlist
.
GetComponent
(
kk
)
->
GetFootprint
Lib
Name
().
IsEmpty
()
&&
ii
<
selection
)
if
(
m_netlist
.
GetComponent
(
kk
)
->
GetFootprintName
().
IsEmpty
()
&&
ii
<
selection
)
{
{
m_ListCmp
->
SetSelection
(
ii
);
m_ListCmp
->
SetSelection
(
ii
);
SendMessageToEESCHEMA
();
SendMessageToEESCHEMA
();
...
@@ -414,7 +414,7 @@ void CVPCB_MAINFRAME::DelAssociations( wxCommandEvent& event )
...
@@ -414,7 +414,7 @@ void CVPCB_MAINFRAME::DelAssociations( wxCommandEvent& event )
for
(
unsigned
i
=
0
;
i
<
m_netlist
.
GetCount
();
i
++
)
for
(
unsigned
i
=
0
;
i
<
m_netlist
.
GetCount
();
i
++
)
{
{
m_netlist
.
GetComponent
(
i
)
->
SetFootprint
Lib
Name
(
wxEmptyString
);
m_netlist
.
GetComponent
(
i
)
->
SetFootprintName
(
wxEmptyString
);
SetNewPkg
(
wxEmptyString
);
SetNewPkg
(
wxEmptyString
);
}
}
...
@@ -568,7 +568,7 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
...
@@ -568,7 +568,7 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
if
(
FindFocus
()
==
m_ListCmp
)
if
(
FindFocus
()
==
m_ListCmp
)
{
{
wxString
module
=
m_netlist
.
GetComponent
(
selection
)
->
GetFootprint
Lib
Name
();
wxString
module
=
m_netlist
.
GetComponent
(
selection
)
->
GetFootprintName
();
bool
found
=
false
;
bool
found
=
false
;
for
(
int
ii
=
0
;
ii
<
m_FootprintList
->
GetCount
();
ii
++
)
for
(
int
ii
=
0
;
ii
<
m_FootprintList
->
GetCount
();
ii
++
)
...
@@ -788,8 +788,8 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
...
@@ -788,8 +788,8 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
// not the actual name of the footprint.
// not the actual name of the footprint.
for
(
unsigned
ii
=
0
;
ii
<
m_netlist
.
GetCount
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
m_netlist
.
GetCount
();
ii
++
)
{
{
if
(
m_netlist
.
GetComponent
(
ii
)
->
GetFootprint
Lib
Name
()
==
wxT
(
"$noname"
)
)
if
(
m_netlist
.
GetComponent
(
ii
)
->
GetFootprintName
()
==
wxT
(
"$noname"
)
)
m_netlist
.
GetComponent
(
ii
)
->
SetFootprint
Lib
Name
(
wxEmptyString
);
m_netlist
.
GetComponent
(
ii
)
->
SetFootprintName
(
wxEmptyString
);
}
}
// Sort components by reference:
// Sort components by reference:
...
@@ -840,7 +840,7 @@ bool CVPCB_MAINFRAME::WriteComponentLinkFile( const wxString& aFullFileName )
...
@@ -840,7 +840,7 @@ bool CVPCB_MAINFRAME::WriteComponentLinkFile( const wxString& aFullFileName )
retval
|=
fprintf
(
outputFile
,
"Reference = %s;
\n
"
,
TO_UTF8
(
component
->
GetReference
()
)
);
retval
|=
fprintf
(
outputFile
,
"Reference = %s;
\n
"
,
TO_UTF8
(
component
->
GetReference
()
)
);
retval
|=
fprintf
(
outputFile
,
"ValeurCmp = %s;
\n
"
,
TO_UTF8
(
component
->
GetValue
()
)
);
retval
|=
fprintf
(
outputFile
,
"ValeurCmp = %s;
\n
"
,
TO_UTF8
(
component
->
GetValue
()
)
);
retval
|=
fprintf
(
outputFile
,
"IdModule = %s;
\n
"
,
retval
|=
fprintf
(
outputFile
,
"IdModule = %s;
\n
"
,
TO_UTF8
(
component
->
GetFootprint
Lib
Name
()
)
);
TO_UTF8
(
component
->
GetFootprintName
()
)
);
retval
|=
fprintf
(
outputFile
,
"EndCmp
\n
"
);
retval
|=
fprintf
(
outputFile
,
"EndCmp
\n
"
);
}
}
...
...
cvpcb/listboxes.cpp
View file @
3a9f3f89
...
@@ -117,7 +117,7 @@ void CVPCB_MAINFRAME::BuildCmpListBox()
...
@@ -117,7 +117,7 @@ void CVPCB_MAINFRAME::BuildCmpListBox()
msg
.
Printf
(
CMP_FORMAT
,
m_ListCmp
->
GetCount
()
+
1
,
msg
.
Printf
(
CMP_FORMAT
,
m_ListCmp
->
GetCount
()
+
1
,
GetChars
(
component
->
GetReference
()
),
GetChars
(
component
->
GetReference
()
),
GetChars
(
component
->
GetValue
()
),
GetChars
(
component
->
GetValue
()
),
GetChars
(
component
->
GetFootprint
Lib
Name
()
)
);
GetChars
(
component
->
GetFootprintName
()
)
);
m_ListCmp
->
m_ComponentList
.
Add
(
msg
);
m_ListCmp
->
m_ComponentList
.
Add
(
msg
);
}
}
...
...
cvpcb/readwrite_dlgs.cpp
View file @
3a9f3f89
...
@@ -71,16 +71,16 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
...
@@ -71,16 +71,16 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
// Check to see if the component has already a footprint set.
// Check to see if the component has already a footprint set.
hasFootprint
=
!
(
component
->
GetFootprint
Lib
Name
().
IsEmpty
());
hasFootprint
=
!
(
component
->
GetFootprintName
().
IsEmpty
());
component
->
SetFootprint
Lib
Name
(
aFootprintName
);
component
->
SetFootprintName
(
aFootprintName
);
// create the new component description
// create the new component description
description
.
Printf
(
CMP_FORMAT
,
componentIndex
+
1
,
description
.
Printf
(
CMP_FORMAT
,
componentIndex
+
1
,
GetChars
(
component
->
GetReference
()
),
GetChars
(
component
->
GetReference
()
),
GetChars
(
component
->
GetValue
()
),
GetChars
(
component
->
GetValue
()
),
GetChars
(
component
->
GetFootprint
Lib
Name
()
)
);
GetChars
(
component
->
GetFootprintName
()
)
);
// If the component hasn't had a footprint associated with it
// If the component hasn't had a footprint associated with it
// it now has, so we decrement the count of components without
// it now has, so we decrement the count of components without
...
@@ -135,10 +135,10 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
...
@@ -135,10 +135,10 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
msg
.
Printf
(
CMP_FORMAT
,
m_ListCmp
->
GetCount
()
+
1
,
msg
.
Printf
(
CMP_FORMAT
,
m_ListCmp
->
GetCount
()
+
1
,
GetChars
(
component
->
GetReference
()
),
GetChars
(
component
->
GetReference
()
),
GetChars
(
component
->
GetValue
()
),
GetChars
(
component
->
GetValue
()
),
GetChars
(
component
->
GetFootprint
Lib
Name
()
)
);
GetChars
(
component
->
GetFootprintName
()
)
);
m_ListCmp
->
AppendLine
(
msg
);
m_ListCmp
->
AppendLine
(
msg
);
if
(
component
->
GetFootprint
Lib
Name
().
IsEmpty
()
)
if
(
component
->
GetFootprintName
().
IsEmpty
()
)
m_undefinedComponentCnt
+=
1
;
m_undefinedComponentCnt
+=
1
;
}
}
...
...
eeschema/class_libentry.cpp
View file @
3a9f3f89
...
@@ -868,7 +868,7 @@ bool LIB_COMPONENT::LoadDrawEntries( LINE_READER& aLineReader, wxString& aErrorM
...
@@ -868,7 +868,7 @@ bool LIB_COMPONENT::LoadDrawEntries( LINE_READER& aLineReader, wxString& aErrorM
{
{
aErrorMsg
.
Printf
(
wxT
(
"error <%s> in DRAW command %c"
),
aErrorMsg
.
Printf
(
wxT
(
"error <%s> in DRAW command %c"
),
GetChars
(
aErrorMsg
),
line
[
0
]
);
GetChars
(
aErrorMsg
),
line
[
0
]
);
SAFE_DELETE
(
newEntry
)
;
delete
newEntry
;
// Flush till end of draw section
// Flush till end of draw section
do
do
...
@@ -913,7 +913,7 @@ bool LIB_COMPONENT::LoadField( LINE_READER& aLineReader, wxString& aErrorMsg )
...
@@ -913,7 +913,7 @@ bool LIB_COMPONENT::LoadField( LINE_READER& aLineReader, wxString& aErrorMsg )
if
(
!
field
->
Load
(
aLineReader
,
aErrorMsg
)
)
if
(
!
field
->
Load
(
aLineReader
,
aErrorMsg
)
)
{
{
SAFE_DELETE
(
field
)
;
delete
field
;
return
false
;
return
false
;
}
}
...
@@ -931,7 +931,7 @@ bool LIB_COMPONENT::LoadField( LINE_READER& aLineReader, wxString& aErrorMsg )
...
@@ -931,7 +931,7 @@ bool LIB_COMPONENT::LoadField( LINE_READER& aLineReader, wxString& aErrorMsg )
if
(
field
->
GetId
()
==
VALUE
)
if
(
field
->
GetId
()
==
VALUE
)
m_name
=
field
->
GetText
();
m_name
=
field
->
GetText
();
SAFE_DELETE
(
field
)
;
delete
field
;
}
}
else
else
{
{
...
...
eeschema/dialogs/dialog_erc.cpp
View file @
3a9f3f89
...
@@ -247,7 +247,7 @@ void DIALOG_ERC::ReBuildMatrixPanel()
...
@@ -247,7 +247,7 @@ void DIALOG_ERC::ReBuildMatrixPanel()
wxStaticText
*
text
=
new
wxStaticText
(
m_matrixPanel
,
-
1
,
wxT
(
"W"
),
pos
);
wxStaticText
*
text
=
new
wxStaticText
(
m_matrixPanel
,
-
1
,
wxT
(
"W"
),
pos
);
int
text_height
=
text
->
GetRect
().
GetHeight
();
int
text_height
=
text
->
GetRect
().
GetHeight
();
bitmap_size
.
y
=
std
::
max
(
bitmap_size
.
y
,
text_height
);
bitmap_size
.
y
=
std
::
max
(
bitmap_size
.
y
,
text_height
);
SAFE_DELETE
(
text
)
;
delete
text
;
// compute the Y pos interval:
// compute the Y pos interval:
pos
.
y
=
text_height
;
pos
.
y
=
text_height
;
...
...
eeschema/edit_label.cpp
View file @
3a9f3f89
...
@@ -110,7 +110,7 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType )
...
@@ -110,7 +110,7 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType )
if
(
textItem
->
GetText
().
IsEmpty
()
)
if
(
textItem
->
GetText
().
IsEmpty
()
)
{
{
SAFE_DELETE
(
textItem
)
;
delete
textItem
;
return
NULL
;
return
NULL
;
}
}
...
...
eeschema/files-io.cpp
View file @
3a9f3f89
...
@@ -293,7 +293,8 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& aFileName, bool aIsNew )
...
@@ -293,7 +293,8 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& aFileName, bool aIsNew )
// Clear the screen before open a new file
// Clear the screen before open a new file
if
(
g_RootSheet
)
if
(
g_RootSheet
)
{
{
SAFE_DELETE
(
g_RootSheet
);
delete
g_RootSheet
;
g_RootSheet
=
NULL
;
}
}
CreateScreens
();
CreateScreens
();
...
...
eeschema/libedit.cpp
View file @
3a9f3f89
...
@@ -143,7 +143,8 @@ void LIB_EDIT_FRAME::LoadOneLibraryPart( wxCommandEvent& event )
...
@@ -143,7 +143,8 @@ void LIB_EDIT_FRAME::LoadOneLibraryPart( wxCommandEvent& event )
// Delete previous library component, if any
// Delete previous library component, if any
if
(
m_component
)
if
(
m_component
)
{
{
SAFE_DELETE
(
m_component
);
delete
m_component
;
m_component
=
NULL
;
m_aliasName
.
Empty
();
m_aliasName
.
Empty
();
}
}
...
@@ -212,7 +213,7 @@ bool LIB_EDIT_FRAME::LoadOneLibraryPartAux( LIB_ALIAS* aEntry, CMP_LIBRARY* aLib
...
@@ -212,7 +213,7 @@ bool LIB_EDIT_FRAME::LoadOneLibraryPartAux( LIB_ALIAS* aEntry, CMP_LIBRARY* aLib
if
(
m_component
)
if
(
m_component
)
{
{
SAFE_DELETE
(
m_component
)
;
delete
m_component
;
m_aliasName
.
Empty
();
m_aliasName
.
Empty
();
}
}
...
@@ -574,7 +575,8 @@ All changes will be lost. Discard changes?" ) ) )
...
@@ -574,7 +575,8 @@ All changes will be lost. Discard changes?" ) ) )
}
}
else
else
{
{
SAFE_DELETE
(
m_component
);
delete
m_component
;
m_component
=
NULL
;
m_aliasName
.
Empty
();
m_aliasName
.
Empty
();
}
}
...
@@ -660,7 +662,7 @@ lost!\n\nClear the current component from the screen?" ) ) )
...
@@ -660,7 +662,7 @@ lost!\n\nClear the current component from the screen?" ) ) )
if
(
m_component
)
if
(
m_component
)
{
{
SAFE_DELETE
(
m_component
)
;
delete
m_component
;
m_aliasName
.
Empty
();
m_aliasName
.
Empty
();
}
}
...
...
eeschema/load_one_schematic_file.cpp
View file @
3a9f3f89
...
@@ -232,7 +232,7 @@ again." );
...
@@ -232,7 +232,7 @@ again." );
if
(
!
itemLoaded
)
if
(
!
itemLoaded
)
{
{
SAFE_DELETE
(
item
)
;
delete
item
;
}
}
else
else
{
{
...
...
eeschema/schframe.cpp
View file @
3a9f3f89
...
@@ -274,10 +274,14 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* aParent, const wxString& aTitle,
...
@@ -274,10 +274,14 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* aParent, const wxString& aTitle,
SCH_EDIT_FRAME
::~
SCH_EDIT_FRAME
()
SCH_EDIT_FRAME
::~
SCH_EDIT_FRAME
()
{
{
SetScreen
(
NULL
);
SetScreen
(
NULL
);
SAFE_DELETE
(
m_CurrentSheet
);
// a SCH_SHEET_PATH, on the heap.
delete
m_CurrentSheet
;
// a SCH_SHEET_PATH, on the heap.
SAFE_DELETE
(
m_undoItem
);
delete
m_undoItem
;
SAFE_DELETE
(
g_RootSheet
);
delete
g_RootSheet
;
SAFE_DELETE
(
m_findReplaceData
);
delete
m_findReplaceData
;
m_CurrentSheet
=
NULL
;
m_undoItem
=
NULL
;
g_RootSheet
=
NULL
;
m_findReplaceData
=
NULL
;
CMP_LIBRARY
::
RemoveAllLibraries
();
CMP_LIBRARY
::
RemoveAllLibraries
();
}
}
...
...
eeschema/sheet.cpp
View file @
3a9f3f89
...
@@ -292,7 +292,7 @@ static void ExitSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
...
@@ -292,7 +292,7 @@ static void ExitSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
if
(
item
->
IsNew
()
)
if
(
item
->
IsNew
()
)
{
{
SAFE_DELETE
(
item
)
;
delete
item
;
}
}
else
if
(
item
->
IsMoving
()
||
item
->
IsResized
()
)
else
if
(
item
->
IsMoving
()
||
item
->
IsResized
()
)
{
{
...
...
include/common.h
View file @
3a9f3f89
...
@@ -116,8 +116,6 @@ enum pseudokeys {
...
@@ -116,8 +116,6 @@ enum pseudokeys {
#define TEXT_ORIENT_HORIZ 0
#define TEXT_ORIENT_HORIZ 0
#define TEXT_ORIENT_VERT 900
#define TEXT_ORIENT_VERT 900
#define ON 1
#define OFF 0
//-----<KiROUND KIT>------------------------------------------------------------
//-----<KiROUND KIT>------------------------------------------------------------
...
...
include/macros.h
View file @
3a9f3f89
...
@@ -13,6 +13,8 @@
...
@@ -13,6 +13,8 @@
* converts a wxString to a UTF8 encoded C string for all wxWidgets build modes.
* converts a wxString to a UTF8 encoded C string for all wxWidgets build modes.
* wxstring is a wxString, not a wxT() or _(). The scope of the return value
* wxstring is a wxString, not a wxT() or _(). The scope of the return value
* is very limited and volatile, but can be used with printf() style functions well.
* is very limited and volatile, but can be used with printf() style functions well.
* NOTE: Trying to convert it to a function is tricky because of the
* type of the parameter!
*/
*/
#define TO_UTF8( wxstring ) ( (const char*) (wxstring).utf8_str() )
#define TO_UTF8( wxstring ) ( (const char*) (wxstring).utf8_str() )
...
@@ -20,7 +22,6 @@
...
@@ -20,7 +22,6 @@
* function FROM_UTF8
* function FROM_UTF8
* converts a UTF8 encoded C string to a wxString for all wxWidgets build modes.
* converts a UTF8 encoded C string to a wxString for all wxWidgets build modes.
*/
*/
//#define FROM_UTF8( cstring ) wxString::FromUTF8( cstring )
static
inline
wxString
FROM_UTF8
(
const
char
*
cstring
)
static
inline
wxString
FROM_UTF8
(
const
char
*
cstring
)
{
{
wxString
line
=
wxString
::
FromUTF8
(
cstring
);
wxString
line
=
wxString
::
FromUTF8
(
cstring
);
...
@@ -56,82 +57,67 @@ static inline const wxChar* GetChars( const wxString& s )
...
@@ -56,82 +57,67 @@ static inline const wxChar* GetChars( const wxString& s )
#endif
#endif
}
}
#define NEGATE( x ) (x = -x)
// This really need a function? anyway is used *a lot* of times
template
<
class
T
>
inline
void
NEGATE
(
T
&
x
)
{
x
=
-
x
;
}
/// # of elements in an array
/// # of elements in an array
#define DIM( x ) unsigned( sizeof(x) / sizeof( (x)[0] ) ) // not size_t
#define DIM( x ) unsigned( sizeof(x) / sizeof( (x)[0] ) ) // not size_t
inline
double
DEG2RAD
(
double
deg
)
{
return
deg
*
M_PI
/
180
.
0
;
}
inline
double
RAD2DEG
(
double
rad
)
{
return
rad
*
180
.
0
/
M_PI
;
}
#define DEG2RAD( Deg ) ( (Deg) * M_PI / 180.0 )
/// Normalize angle to be in the -360.0 .. 360.0:
#define RAD2DEG( Rad ) ( (Rad) * 180.0 / M_PI )
template
<
class
T
>
inline
void
NORMALIZE_ANGLE_360
(
T
&
Angle
)
{
// Normalize angle to be in the -360.0 .. 360.0:
while
(
Angle
<
-
3600
)
#define NORMALIZE_ANGLE_360( Angle ) { \
Angle
+=
3600
;
while( Angle < -3600 ) \
while
(
Angle
>
3600
)
Angle += 3600; \
Angle
-=
3600
;
while( Angle > 3600 ) \
}
Angle -= 3600; }
/// Normalize angle to be in the 0.0 .. 360.0 range:
/* Normalize angle to be in the 0.0 .. 360.0 range: */
template
<
class
T
>
inline
void
NORMALIZE_ANGLE_POS
(
T
&
Angle
)
#define NORMALIZE_ANGLE_POS( Angle ) { \
{
while( Angle < 0 ) \
while
(
Angle
<
0
)
Angle += 3600; \
Angle
+=
3600
;
while( Angle >= 3600 ) \
while
(
Angle
>=
3600
)
Angle -= 3600; }
Angle
-=
3600
;
}
#define NEGATE_AND_NORMALIZE_ANGLE_POS( Angle ) { \
Angle = -Angle; \
template
<
class
T
>
inline
void
NEGATE_AND_NORMALIZE_ANGLE_POS
(
T
&
Angle
)
while( Angle < 0 ) \
{
Angle += 3600; \
Angle
=
-
Angle
;
while( Angle >= 3600 ) \
while
(
Angle
<
0
)
Angle -= 3600; }
Angle
+=
3600
;
while
(
Angle
>=
3600
)
/* Normalize angle to be in the -90.0 .. 90.0 range */
Angle
-=
3600
;
#define NORMALIZE_ANGLE_90( Angle ) { \
}
while( Angle < -900 ) \
Angle += 1800; \
/// Normalize angle to be in the -90.0 .. 90.0 range
while( Angle > 900 ) \
template
<
class
T
>
inline
void
NORMALIZE_ANGLE_90
(
T
&
Angle
)
Angle -= 1800; }
{
while
(
Angle
<
-
900
)
/* Normalize angle to be in the -180.0 .. 180.0 range */
Angle
+=
1800
;
#define NORMALIZE_ANGLE_180( Angle ) { \
while
(
Angle
>
900
)
while( Angle <= -1800 ) \
Angle
-=
1800
;
Angle += 3600; \
}
while( Angle > 1800 ) \
Angle -= 3600; }
/*****************************/
/* macro to exchange 2 items */
/*****************************/
/*
* The EXCHG macro uses BOOST_TYPEOF for compilers that do not have native
* typeof support (MSVC). Please do not attempt to qualify these macros
* within #ifdef compiler definitions pragmas. BOOST_TYPEOF is smart enough
* to check for native typeof support and use it instead of it's own
* implementation. These macros effectively compile to nothing on platforms
* with native typeof support.
*/
#include <boost/typeof/typeof.hpp>
/// Normalize angle to be in the -180.0 .. 180.0 range
template
<
class
T
>
inline
void
NORMALIZE_ANGLE_180
(
T
&
Angle
)
// we have to register the types used with the typeof keyword with boost
{
BOOST_TYPEOF_REGISTER_TYPE
(
wxPoint
)
while
(
Angle
<=
-
1800
)
BOOST_TYPEOF_REGISTER_TYPE
(
wxSize
)
Angle
+=
3600
;
BOOST_TYPEOF_REGISTER_TYPE
(
wxString
)
while
(
Angle
>
1800
)
class
DrawSheetLabelStruct
;
Angle
-=
3600
;
BOOST_TYPEOF_REGISTER_TYPE
(
DrawSheetLabelStruct
*
)
}
class
EDA_ITEM
;
BOOST_TYPEOF_REGISTER_TYPE
(
EDA_ITEM
*
)
class
D_PAD
;
BOOST_TYPEOF_REGISTER_TYPE
(
D_PAD
*
)
BOOST_TYPEOF_REGISTER_TYPE
(
const
D_PAD
*
)
class
BOARD_ITEM
;
BOOST_TYPEOF_REGISTER_TYPE
(
BOARD_ITEM
*
)
#define EXCHG( a, b ) { BOOST_TYPEOF( a ) __temp__ = (a); \
(a) = (b); \
(b) = __temp__; }
/// Exchange two values; std::swap works only with arguments of the
// same type; here the compiler will figure out what to do (I hope)
template
<
class
T
,
class
T2
>
inline
void
EXCHG
(
T
&
a
,
T2
&
b
)
{
T
temp
=
a
;
a
=
b
;
b
=
temp
;
}
#endif
/* ifdef MACRO_H */
#endif
/* ifdef MACRO_H */
include/wxstruct.h
View file @
3a9f3f89
...
@@ -51,11 +51,6 @@
...
@@ -51,11 +51,6 @@
#include <wx/overlay.h>
#include <wx/overlay.h>
#endif
#endif
// C++ guarantees that operator delete checks its argument for null-ness
#ifndef SAFE_DELETE
#define SAFE_DELETE( p ) delete (p); (p) = NULL;
#endif
// Option for dialog boxes
// Option for dialog boxes
#define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT | MAYBE_RESIZE_BORDER
#define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT | MAYBE_RESIZE_BORDER
...
...
pcbnew/class_board.cpp
View file @
3a9f3f89
...
@@ -2373,7 +2373,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, REPORTER* aReporter )
...
@@ -2373,7 +2373,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, REPORTER* aReporter )
msg
.
Printf
(
_
(
"Checking netlist component footprint
\"
%s:%s:%s
\"
.
\n
"
),
msg
.
Printf
(
_
(
"Checking netlist component footprint
\"
%s:%s:%s
\"
.
\n
"
),
GetChars
(
component
->
GetReference
()
),
GetChars
(
component
->
GetReference
()
),
GetChars
(
component
->
GetTimeStamp
()
),
GetChars
(
component
->
GetTimeStamp
()
),
GetChars
(
component
->
GetFootprint
Lib
Name
()
)
);
GetChars
(
component
->
GetFootprintName
()
)
);
aReporter
->
Report
(
msg
);
aReporter
->
Report
(
msg
);
}
}
...
@@ -2390,13 +2390,13 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, REPORTER* aReporter )
...
@@ -2390,13 +2390,13 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, REPORTER* aReporter )
msg
.
Printf
(
_
(
"Adding new component
\"
%s:%s
\"
footprint
\"
%s
\"
.
\n
"
),
msg
.
Printf
(
_
(
"Adding new component
\"
%s:%s
\"
footprint
\"
%s
\"
.
\n
"
),
GetChars
(
component
->
GetReference
()
),
GetChars
(
component
->
GetReference
()
),
GetChars
(
component
->
GetTimeStamp
()
),
GetChars
(
component
->
GetTimeStamp
()
),
GetChars
(
component
->
GetFootprint
Lib
Name
()
)
);
GetChars
(
component
->
GetFootprintName
()
)
);
else
else
msg
.
Printf
(
_
(
"Cannot add new component
\"
%s:%s
\"
due to missing "
msg
.
Printf
(
_
(
"Cannot add new component
\"
%s:%s
\"
due to missing "
"footprint
\"
%s
\"
.
\n
"
),
"footprint
\"
%s
\"
.
\n
"
),
GetChars
(
component
->
GetReference
()
),
GetChars
(
component
->
GetReference
()
),
GetChars
(
component
->
GetTimeStamp
()
),
GetChars
(
component
->
GetTimeStamp
()
),
GetChars
(
component
->
GetFootprint
Lib
Name
()
)
);
GetChars
(
component
->
GetFootprintName
()
)
);
aReporter
->
Report
(
msg
);
aReporter
->
Report
(
msg
);
}
}
...
@@ -2414,8 +2414,8 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, REPORTER* aReporter )
...
@@ -2414,8 +2414,8 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, REPORTER* aReporter )
else
// An existing footprint.
else
// An existing footprint.
{
{
// Test for footprint change.
// Test for footprint change.
if
(
!
component
->
GetFootprint
Lib
Name
().
IsEmpty
()
&&
if
(
!
component
->
GetFootprintName
().
IsEmpty
()
&&
footprint
->
GetLibRef
()
!=
component
->
GetFootprint
Lib
Name
()
)
footprint
->
GetLibRef
()
!=
component
->
GetFootprintName
()
)
{
{
if
(
aNetlist
.
GetReplaceFootprints
()
)
if
(
aNetlist
.
GetReplaceFootprints
()
)
{
{
...
@@ -2427,13 +2427,13 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, REPORTER* aReporter )
...
@@ -2427,13 +2427,13 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, REPORTER* aReporter )
GetChars
(
footprint
->
GetReference
()
),
GetChars
(
footprint
->
GetReference
()
),
GetChars
(
footprint
->
GetPath
()
),
GetChars
(
footprint
->
GetPath
()
),
GetChars
(
footprint
->
GetLibRef
()
),
GetChars
(
footprint
->
GetLibRef
()
),
GetChars
(
component
->
GetFootprint
Lib
Name
()
)
);
GetChars
(
component
->
GetFootprintName
()
)
);
else
else
msg
.
Printf
(
_
(
"Cannot replace component
\"
%s:%s
\"
due to missing "
msg
.
Printf
(
_
(
"Cannot replace component
\"
%s:%s
\"
due to missing "
"footprint
\"
%s
\"
.
\n
"
),
"footprint
\"
%s
\"
.
\n
"
),
GetChars
(
footprint
->
GetReference
()
),
GetChars
(
footprint
->
GetReference
()
),
GetChars
(
footprint
->
GetPath
()
),
GetChars
(
footprint
->
GetPath
()
),
GetChars
(
component
->
GetFootprint
Lib
Name
()
)
);
GetChars
(
component
->
GetFootprintName
()
)
);
aReporter
->
Report
(
msg
);
aReporter
->
Report
(
msg
);
}
}
...
...
pcbnew/class_track.cpp
View file @
3a9f3f89
...
@@ -162,8 +162,6 @@ wxString SEGZONE::GetSelectMenuText() const
...
@@ -162,8 +162,6 @@ wxString SEGZONE::GetSelectMenuText() const
NETINFO_ITEM
*
net
;
NETINFO_ITEM
*
net
;
BOARD
*
board
=
GetBoard
();
BOARD
*
board
=
GetBoard
();
text
<<
_
(
"Zone"
)
<<
wxT
(
" "
)
<<
wxString
::
Format
(
wxT
(
"(%08lX)"
),
m_TimeStamp
);
if
(
board
)
if
(
board
)
{
{
net
=
board
->
FindNet
(
GetNet
()
);
net
=
board
->
FindNet
(
GetNet
()
);
...
...
pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp
View file @
3a9f3f89
...
@@ -117,9 +117,9 @@ void DIALOG_MODULE_MODULE_EDITOR::initModeditProperties()
...
@@ -117,9 +117,9 @@ void DIALOG_MODULE_MODULE_EDITOR::initModeditProperties()
m_ValueCtrl
->
SetValue
(
m_valueCopy
->
GetText
()
);
m_ValueCtrl
->
SetValue
(
m_valueCopy
->
GetText
()
);
m_FootprintNameCtrl
->
SetValue
(
m_currentModule
->
GetLibRef
()
);
m_FootprintNameCtrl
->
SetValue
(
m_currentModule
->
GetLibRef
()
);
m_AttributsCtrl
->
SetItemToolTip
(
0
,
_
(
"Use this attribute for most non
smd
components"
)
);
m_AttributsCtrl
->
SetItemToolTip
(
0
,
_
(
"Use this attribute for most non
SMD
components"
)
);
m_AttributsCtrl
->
SetItemToolTip
(
1
,
m_AttributsCtrl
->
SetItemToolTip
(
1
,
_
(
"Use this attribute for
smd
components.
\n
Only components with this option are put in the footprint position list file"
)
);
_
(
"Use this attribute for
SMD
components.
\n
Only components with this option are put in the footprint position list file"
)
);
m_AttributsCtrl
->
SetItemToolTip
(
2
,
m_AttributsCtrl
->
SetItemToolTip
(
2
,
_
(
"Use this attribute for
\"
virtual
\"
components drawn on board (like a old ISA PC bus connector)"
)
);
_
(
"Use this attribute for
\"
virtual
\"
components drawn on board (like a old ISA PC bus connector)"
)
);
...
...
pcbnew/dialogs/dialog_gendrill.cpp
View file @
3a9f3f89
...
@@ -440,9 +440,10 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles(bool aGenDrill, bool aGenMap)
...
@@ -440,9 +440,10 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles(bool aGenDrill, bool aGenMap)
if
(
choice
>=
m_Choice_Drill_Map
->
GetCount
()
)
if
(
choice
>=
m_Choice_Drill_Map
->
GetCount
()
)
choice
=
1
;
choice
=
1
;
fn
.
SetExt
(
wxEmptyString
);
// Will be modified by GenDrillMap
fn
.
SetExt
(
wxEmptyString
);
// Will be added by GenDrillMap
wxString
fullfilename
=
fn
.
GetFullPath
()
+
wxT
(
"-drl_map"
);
GenDrillMap
(
f
n
.
GetFullPath
()
,
excellonWriter
,
filefmt
[
choice
]
);
GenDrillMap
(
f
ullfilename
,
excellonWriter
,
filefmt
[
choice
]
);
}
}
}
}
...
@@ -530,7 +531,7 @@ void DIALOG_GENDRILL::OnGenReportFile( wxCommandEvent& event )
...
@@ -530,7 +531,7 @@ void DIALOG_GENDRILL::OnGenReportFile( wxCommandEvent& event )
// Generate the drill map of the board
// Generate the drill map of the board
void
DIALOG_GENDRILL
::
GenDrillMap
(
const
wxString
aF
ileName
,
void
DIALOG_GENDRILL
::
GenDrillMap
(
const
wxString
aF
ullFileNameWithoutExt
,
EXCELLON_WRITER
&
aExcellonWriter
,
EXCELLON_WRITER
&
aExcellonWriter
,
PlotFormat
format
)
PlotFormat
format
)
{
{
...
@@ -574,11 +575,9 @@ void DIALOG_GENDRILL::GenDrillMap( const wxString aFileName,
...
@@ -574,11 +575,9 @@ void DIALOG_GENDRILL::GenDrillMap( const wxString aFileName,
return
;
return
;
}
}
/* Init file name */
// Add file name extension
wxFileName
fn
=
aFileName
;
wxString
fullFilename
=
aFullFileNameWithoutExt
;
fn
.
SetName
(
fn
.
GetName
()
+
wxT
(
"-drl_map"
)
);
fullFilename
<<
wxT
(
"."
)
<<
ext
;
fn
.
SetExt
(
ext
);
wxString
fullFilename
=
fn
.
GetFullPath
();
bool
success
=
aExcellonWriter
.
GenDrillMapFile
(
fullFilename
,
bool
success
=
aExcellonWriter
.
GenDrillMapFile
(
fullFilename
,
m_parent
->
GetPageSettings
(),
m_parent
->
GetPageSettings
(),
...
...
pcbnew/dialogs/dialog_netlist.cpp
View file @
3a9f3f89
...
@@ -98,6 +98,7 @@ DIALOG_NETLIST::DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxDC * aDC,
...
@@ -98,6 +98,7 @@ DIALOG_NETLIST::DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxDC * aDC,
GetSizer
()
->
SetSizeHints
(
this
);
GetSizer
()
->
SetSizeHints
(
this
);
}
}
void
DIALOG_NETLIST
::
OnOpenNetlistClick
(
wxCommandEvent
&
event
)
void
DIALOG_NETLIST
::
OnOpenNetlistClick
(
wxCommandEvent
&
event
)
{
{
wxString
lastPath
=
wxFileName
::
GetCwd
();
wxString
lastPath
=
wxFileName
::
GetCwd
();
...
...
pcbnew/editrack.cpp
View file @
3a9f3f89
pcbnew/gendrill_Excellon_writer.h
View file @
3a9f3f89
...
@@ -228,11 +228,12 @@ public: EXCELLON_WRITER( BOARD* aPcb, wxPoint aOffset )
...
@@ -228,11 +228,12 @@ public: EXCELLON_WRITER( BOARD* aPcb, wxPoint aOffset )
/**
/**
* Function GenDrillMapFile
* Function GenDrillMapFile
* Plot a map of drill marks for holes.
* Plot a map of drill marks for holes.
* @param aFullFileName : the name of this file (to plot it)
* @param aFullFileNameWithoutExt : the full filename of the file to create,
* without extension (will be added accordint ti the format)
* @param aSheet : the paper sheet touse for plot
* @param aSheet : the paper sheet touse for plot
* @param aFormat : one of the supported plot formats (see enum PlotFormat )
* @param aFormat : one of the supported plot formats (see enum PlotFormat )
*/
*/
bool
GenDrillMapFile
(
const
wxString
&
aFullFileName
,
bool
GenDrillMapFile
(
const
wxString
&
aFullFileName
WithoutExt
,
const
PAGE_INFO
&
aSheet
,
const
PAGE_INFO
&
aSheet
,
PlotFormat
aFormat
);
PlotFormat
aFormat
);
private
:
private
:
...
...
pcbnew/kicad_netlist_reader.cpp
View file @
3a9f3f89
...
@@ -283,12 +283,12 @@ void KICAD_NETLIST_PARSER::parseComponent() throw( IO_ERROR, PARSE_ERROR )
...
@@ -283,12 +283,12 @@ void KICAD_NETLIST_PARSER::parseComponent() throw( IO_ERROR, PARSE_ERROR )
*/
*/
wxString
ref
;
wxString
ref
;
wxString
value
;
wxString
value
;
wxString
compone
ntName
;
wxString
footpri
ntName
;
wxString
lib
PartName
;
wxString
lib
rary
;
wxString
libN
ame
;
wxString
n
ame
;
wxString
pathtimestamp
,
timestamp
;
wxString
pathtimestamp
,
timestamp
;
// The token comp was read, so the next data is (ref P1)
// The token comp was read, so the next data is (ref P1)
while
(
(
token
=
NextTok
())
!=
T_RIGHT
)
while
(
(
token
=
NextTok
())
!=
T_RIGHT
)
{
{
if
(
token
==
T_LEFT
)
if
(
token
==
T_LEFT
)
...
@@ -310,7 +310,7 @@ void KICAD_NETLIST_PARSER::parseComponent() throw( IO_ERROR, PARSE_ERROR )
...
@@ -310,7 +310,7 @@ void KICAD_NETLIST_PARSER::parseComponent() throw( IO_ERROR, PARSE_ERROR )
case
T_footprint
:
case
T_footprint
:
NeedSYMBOLorNUMBER
();
NeedSYMBOLorNUMBER
();
compone
ntName
=
FROM_UTF8
(
CurText
()
);
footpri
ntName
=
FROM_UTF8
(
CurText
()
);
NeedRIGHT
();
NeedRIGHT
();
break
;
break
;
...
@@ -324,13 +324,13 @@ void KICAD_NETLIST_PARSER::parseComponent() throw( IO_ERROR, PARSE_ERROR )
...
@@ -324,13 +324,13 @@ void KICAD_NETLIST_PARSER::parseComponent() throw( IO_ERROR, PARSE_ERROR )
if
(
token
==
T_lib
)
if
(
token
==
T_lib
)
{
{
NeedSYMBOLorNUMBER
();
NeedSYMBOLorNUMBER
();
lib
Name
=
FROM_UTF8
(
CurText
()
);
lib
rary
=
FROM_UTF8
(
CurText
()
);
NeedRIGHT
();
NeedRIGHT
();
}
}
else
if
(
token
==
T_part
)
else
if
(
token
==
T_part
)
{
{
NeedSYMBOLorNUMBER
();
NeedSYMBOLorNUMBER
();
libPartN
ame
=
FROM_UTF8
(
CurText
()
);
n
ame
=
FROM_UTF8
(
CurText
()
);
NeedRIGHT
();
NeedRIGHT
();
}
}
else
else
...
@@ -362,8 +362,9 @@ void KICAD_NETLIST_PARSER::parseComponent() throw( IO_ERROR, PARSE_ERROR )
...
@@ -362,8 +362,9 @@ void KICAD_NETLIST_PARSER::parseComponent() throw( IO_ERROR, PARSE_ERROR )
}
}
pathtimestamp
+=
timestamp
;
pathtimestamp
+=
timestamp
;
COMPONENT
*
component
=
new
COMPONENT
(
componentName
,
ref
,
value
,
pathtimestamp
);
COMPONENT
*
component
=
new
COMPONENT
(
footprintName
,
ref
,
value
,
pathtimestamp
);
component
->
SetLibrarySource
(
libName
,
libPartName
);
component
->
SetName
(
name
);
component
->
SetLibrary
(
library
);
m_netlist
->
AddComponent
(
component
);
m_netlist
->
AddComponent
(
component
);
}
}
...
...
pcbnew/legacy_netlist_reader.cpp
View file @
3a9f3f89
...
@@ -102,9 +102,10 @@ COMPONENT* LEGACY_NETLIST_READER::loadComponent( char* aText ) throw( PARSE_ERRO
...
@@ -102,9 +102,10 @@ COMPONENT* LEGACY_NETLIST_READER::loadComponent( char* aText ) throw( PARSE_ERRO
char
*
text
;
char
*
text
;
wxString
msg
;
wxString
msg
;
wxString
timeStamp
;
// the full time stamp read from netlist
wxString
timeStamp
;
// the full time stamp read from netlist
wxString
name
;
// the compone
nt name read from netlist
wxString
footprintName
;
// the footpri
nt name read from netlist
wxString
value
;
// the component value read from netlist
wxString
value
;
// the component value read from netlist
wxString
reference
;
// the component schematic reference designator read from netlist
wxString
reference
;
// the component schematic reference designator read from netlist
wxString
name
;
// the name of component that was placed in the schematic
char
line
[
1024
];
char
line
[
1024
];
strcpy
(
line
,
aText
);
strcpy
(
line
,
aText
);
...
@@ -126,12 +127,16 @@ COMPONENT* LEGACY_NETLIST_READER::loadComponent( char* aText ) throw( PARSE_ERRO
...
@@ -126,12 +127,16 @@ COMPONENT* LEGACY_NETLIST_READER::loadComponent( char* aText ) throw( PARSE_ERRO
// Read footprint name (second word)
// Read footprint name (second word)
if
(
(
text
=
strtok
(
NULL
,
" ()
\t\n
"
)
)
==
NULL
)
if
(
(
text
=
strtok
(
NULL
,
" ()
\t\n
"
)
)
==
NULL
)
{
{
msg
=
_
(
"Cannot parse name in component section of netlist."
);
msg
=
_
(
"Cannot parse
footprint
name in component section of netlist."
);
THROW_PARSE_ERROR
(
msg
,
m_lineReader
->
GetSource
(),
aText
,
m_lineReader
->
LineNumber
(),
THROW_PARSE_ERROR
(
msg
,
m_lineReader
->
GetSource
(),
aText
,
m_lineReader
->
LineNumber
(),
m_lineReader
->
Length
()
);
m_lineReader
->
Length
()
);
}
}
name
=
FROM_UTF8
(
text
);
footprintName
=
FROM_UTF8
(
text
);
// The footprint name will have to be looked up in the *.cmp file.
if
(
footprintName
==
wxT
(
"$noname"
)
)
footprintName
=
wxEmptyString
;
// Read schematic reference designator (third word)
// Read schematic reference designator (third word)
if
(
(
text
=
strtok
(
NULL
,
" ()
\t\n
"
)
)
==
NULL
)
if
(
(
text
=
strtok
(
NULL
,
" ()
\t\n
"
)
)
==
NULL
)
...
@@ -153,7 +158,18 @@ COMPONENT* LEGACY_NETLIST_READER::loadComponent( char* aText ) throw( PARSE_ERRO
...
@@ -153,7 +158,18 @@ COMPONENT* LEGACY_NETLIST_READER::loadComponent( char* aText ) throw( PARSE_ERRO
value
=
FROM_UTF8
(
text
);
value
=
FROM_UTF8
(
text
);
COMPONENT
*
component
=
new
COMPONENT
(
name
,
reference
,
value
,
timeStamp
);
// Read component name (fifth word) {Lib=C}
if
(
(
text
=
strtok
(
NULL
,
" ()
\t\n
"
)
)
==
NULL
)
{
msg
=
_
(
"Cannot parse name comment in component section of netlist."
);
THROW_PARSE_ERROR
(
msg
,
m_lineReader
->
GetSource
(),
aText
,
m_lineReader
->
LineNumber
(),
m_lineReader
->
Length
()
);
}
name
=
FROM_UTF8
(
text
).
AfterFirst
(
wxChar
(
'='
)
).
BeforeLast
(
wxChar
(
'}'
)
);
COMPONENT
*
component
=
new
COMPONENT
(
footprintName
,
reference
,
value
,
timeStamp
);
component
->
SetName
(
name
);
m_netlist
->
AddComponent
(
component
);
m_netlist
->
AddComponent
(
component
);
return
component
;
return
component
;
}
}
...
...
pcbnew/netlist.cpp
View file @
3a9f3f89
...
@@ -73,7 +73,7 @@ void PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFileName,
...
@@ -73,7 +73,7 @@ void PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFileName,
}
}
catch
(
IO_ERROR
&
ioe
)
catch
(
IO_ERROR
&
ioe
)
{
{
msg
=
wxString
::
Format
(
_
(
"Error loading netlist.
\n
%s"
),
ioe
.
errorText
.
GetData
()
);
msg
.
Printf
(
_
(
"Error loading netlist.
\n
%s"
),
ioe
.
errorText
.
GetData
()
);
wxMessageBox
(
msg
,
_
(
"Netlist Load Error"
),
wxOK
|
wxICON_ERROR
);
wxMessageBox
(
msg
,
_
(
"Netlist Load Error"
),
wxOK
|
wxICON_ERROR
);
return
;
return
;
}
}
...
@@ -160,15 +160,17 @@ MODULE* PCB_EDIT_FRAME::ListAndSelectModuleName()
...
@@ -160,15 +160,17 @@ MODULE* PCB_EDIT_FRAME::ListAndSelectModuleName()
void
PCB_EDIT_FRAME
::
loadFootprints
(
NETLIST
&
aNetlist
,
REPORTER
*
aReporter
)
void
PCB_EDIT_FRAME
::
loadFootprints
(
NETLIST
&
aNetlist
,
REPORTER
*
aReporter
)
throw
(
IO_ERROR
,
PARSE_ERROR
)
throw
(
IO_ERROR
,
PARSE_ERROR
)
{
{
bool
loadFootprint
;
wxString
msg
;
wxString
msg
;
wxString
lastFootprintLibName
;
wxString
lastFootprintLibName
;
COMPONENT
*
component
;
COMPONENT
*
component
;
MODULE
*
module
;
MODULE
*
module
;
MODULE
*
fpOnBoard
;
if
(
aNetlist
.
IsEmpty
()
)
if
(
aNetlist
.
IsEmpty
()
)
return
;
return
;
aNetlist
.
SortByFootprint
Lib
Name
();
aNetlist
.
SortByFootprintName
();
wxString
libPath
;
wxString
libPath
;
wxFileName
fn
;
wxFileName
fn
;
...
@@ -179,8 +181,17 @@ void PCB_EDIT_FRAME::loadFootprints( NETLIST& aNetlist, REPORTER* aReporter )
...
@@ -179,8 +181,17 @@ void PCB_EDIT_FRAME::loadFootprints( NETLIST& aNetlist, REPORTER* aReporter )
{
{
component
=
aNetlist
.
GetComponent
(
ii
);
component
=
aNetlist
.
GetComponent
(
ii
);
// @todo Check if component is already on BOARD and only load footprint if it's needed.
// Check if component footprint is already on BOARD and only load the footprint from
if
(
ii
==
0
||
component
->
GetFootprintLibName
()
!=
lastFootprintLibName
)
// the library if it's needed.
if
(
aNetlist
.
IsFindByTimeStamp
()
)
fpOnBoard
=
m_Pcb
->
FindModule
(
aNetlist
.
GetComponent
(
ii
)
->
GetTimeStamp
(),
true
);
else
fpOnBoard
=
m_Pcb
->
FindModule
(
aNetlist
.
GetComponent
(
ii
)
->
GetReference
()
);
loadFootprint
=
(
fpOnBoard
!=
NULL
)
&&
(
fpOnBoard
->
GetPath
()
!=
component
->
GetFootprintName
());
if
(
loadFootprint
&&
(
component
->
GetFootprintName
()
!=
lastFootprintLibName
)
)
{
{
module
=
NULL
;
module
=
NULL
;
...
@@ -194,11 +205,11 @@ void PCB_EDIT_FRAME::loadFootprints( NETLIST& aNetlist, REPORTER* aReporter )
...
@@ -194,11 +205,11 @@ void PCB_EDIT_FRAME::loadFootprints( NETLIST& aNetlist, REPORTER* aReporter )
if
(
!
libPath
)
if
(
!
libPath
)
continue
;
continue
;
module
=
pi
->
FootprintLoad
(
libPath
,
component
->
GetFootprint
Lib
Name
()
);
module
=
pi
->
FootprintLoad
(
libPath
,
component
->
GetFootprintName
()
);
if
(
module
)
if
(
module
)
{
{
lastFootprintLibName
=
component
->
GetFootprint
Lib
Name
();
lastFootprintLibName
=
component
->
GetFootprintName
();
break
;
break
;
}
}
}
}
...
@@ -211,7 +222,7 @@ void PCB_EDIT_FRAME::loadFootprints( NETLIST& aNetlist, REPORTER* aReporter )
...
@@ -211,7 +222,7 @@ void PCB_EDIT_FRAME::loadFootprints( NETLIST& aNetlist, REPORTER* aReporter )
msg
.
Printf
(
_
(
"*** Warning: component `%s` footprint <%s> was not found in "
msg
.
Printf
(
_
(
"*** Warning: component `%s` footprint <%s> was not found in "
"any libraries. ***
\n
"
),
"any libraries. ***
\n
"
),
GetChars
(
component
->
GetReference
()
),
GetChars
(
component
->
GetReference
()
),
GetChars
(
component
->
GetFootprint
Lib
Name
()
)
);
GetChars
(
component
->
GetFootprintName
()
)
);
aReporter
->
Report
(
msg
);
aReporter
->
Report
(
msg
);
}
}
...
...
pcbnew/netlist_reader.cpp
View file @
3a9f3f89
...
@@ -72,7 +72,7 @@ void COMPONENT::SetModule( MODULE* aModule )
...
@@ -72,7 +72,7 @@ void COMPONENT::SetModule( MODULE* aModule )
aModule
->
SetReference
(
m_reference
);
aModule
->
SetReference
(
m_reference
);
aModule
->
SetValue
(
m_value
);
aModule
->
SetValue
(
m_value
);
aModule
->
SetLibRef
(
m_footprint
Lib
Name
);
aModule
->
SetLibRef
(
m_footprintName
);
aModule
->
SetPath
(
m_timeStamp
);
aModule
->
SetPath
(
m_timeStamp
);
}
}
...
@@ -98,9 +98,11 @@ void COMPONENT::Show( int aNestLevel, REPORTER& aReporter )
...
@@ -98,9 +98,11 @@ void COMPONENT::Show( int aNestLevel, REPORTER& aReporter )
NestedSpace
(
aNestLevel
,
aReporter
);
NestedSpace
(
aNestLevel
,
aReporter
);
aReporter
.
Report
(
wxT
(
"<component>
\n
"
)
);
aReporter
.
Report
(
wxT
(
"<component>
\n
"
)
);
NestedSpace
(
aNestLevel
+
1
,
aReporter
);
NestedSpace
(
aNestLevel
+
1
,
aReporter
);
aReporter
.
Report
(
wxString
::
Format
(
wxT
(
"<ref=%s value=%s name=%s fpid=%s timestamp=%s>
\n
"
),
aReporter
.
Report
(
wxString
::
Format
(
wxT
(
"<ref=%s value=%s name=%s library=%s footprint=%s "
"footprint-lib=%s timestamp=%s>
\n
"
),
GetChars
(
m_reference
),
GetChars
(
m_value
),
GetChars
(
m_reference
),
GetChars
(
m_value
),
GetChars
(
m_name
),
GetChars
(
m_footprintLibName
),
GetChars
(
m_name
),
GetChars
(
m_library
),
GetChars
(
m_footprintName
),
GetChars
(
m_footprintLib
),
GetChars
(
m_timeStamp
)
)
);
GetChars
(
m_timeStamp
)
)
);
if
(
!
m_footprintFilters
.
IsEmpty
()
)
if
(
!
m_footprintFilters
.
IsEmpty
()
)
...
@@ -177,36 +179,19 @@ COMPONENT* NETLIST::GetComponentByTimeStamp( const wxString& aTimeStamp )
...
@@ -177,36 +179,19 @@ COMPONENT* NETLIST::GetComponentByTimeStamp( const wxString& aTimeStamp )
}
}
COMPONENT
*
NETLIST
::
GetComponentByLibName
(
const
wxString
&
aLibName
)
{
COMPONENT
*
component
=
NULL
;
for
(
unsigned
i
=
0
;
i
<
m_components
.
size
();
i
++
)
{
if
(
m_components
[
i
].
GetLibName
()
==
aLibName
)
{
component
=
&
m_components
[
i
];
break
;
}
}
return
component
;
}
/**
/**
* Function
SortByLib
Name
* Function
ByFootprint
Name
* is a helper function used to sort the component list used by loadNewModules.
* is a helper function used to sort the component list used by loadNewModules.
*/
*/
static
bool
SortByLib
Name
(
const
COMPONENT
&
ref
,
const
COMPONENT
&
cmp
)
static
bool
ByFootprint
Name
(
const
COMPONENT
&
ref
,
const
COMPONENT
&
cmp
)
{
{
return
ref
.
GetFootprint
LibName
().
CmpNoCase
(
cmp
.
GetFootprintLib
Name
()
)
>
0
;
return
ref
.
GetFootprint
Name
().
CmpNoCase
(
cmp
.
GetFootprint
Name
()
)
>
0
;
}
}
void
NETLIST
::
SortByFootprint
Lib
Name
()
void
NETLIST
::
SortByFootprintName
()
{
{
m_components
.
sort
(
SortByLib
Name
);
m_components
.
sort
(
ByFootprint
Name
);
}
}
...
@@ -226,6 +211,42 @@ void NETLIST::SortByReference()
...
@@ -226,6 +211,42 @@ void NETLIST::SortByReference()
}
}
bool
NETLIST
::
AnyFootprintsLinked
()
const
{
for
(
unsigned
i
=
0
;
i
<
m_components
.
size
();
i
++
)
{
if
(
!
m_components
[
i
].
GetFootprintName
().
IsEmpty
()
)
return
true
;
}
return
false
;
}
bool
NETLIST
::
AllFootprintsLinked
()
const
{
for
(
unsigned
i
=
0
;
i
<
m_components
.
size
();
i
++
)
{
if
(
m_components
[
i
].
GetFootprintName
().
IsEmpty
()
)
return
false
;
}
return
true
;
}
bool
NETLIST
::
AnyFootprintsChanged
()
const
{
for
(
unsigned
i
=
0
;
i
<
m_components
.
size
();
i
++
)
{
if
(
m_components
[
i
].
FootprintChanged
()
)
return
true
;
}
return
false
;
}
#if defined( DEBUG )
#if defined( DEBUG )
void
NETLIST
::
Show
(
int
aNestLevel
,
REPORTER
&
aReporter
)
void
NETLIST
::
Show
(
int
aNestLevel
,
REPORTER
&
aReporter
)
{
{
...
@@ -413,6 +434,6 @@ void CMP_READER::Load( NETLIST* aNetlist ) throw( IO_ERROR, PARSE_ERROR )
...
@@ -413,6 +434,6 @@ void CMP_READER::Load( NETLIST* aNetlist ) throw( IO_ERROR, PARSE_ERROR )
m_lineReader
->
LineNumber
(),
m_lineReader
->
Length
()
);
m_lineReader
->
LineNumber
(),
m_lineReader
->
Length
()
);
}
}
component
->
SetFootprint
Lib
Name
(
footprint
);
component
->
SetFootprintName
(
footprint
);
}
}
}
}
pcbnew/netlist_reader.h
View file @
3a9f3f89
...
@@ -30,7 +30,6 @@
...
@@ -30,7 +30,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
*/
#include <algorithm>
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
#include <fctsys.h>
#include <fctsys.h>
...
@@ -106,31 +105,46 @@ class COMPONENT
...
@@ -106,31 +105,46 @@ class COMPONENT
// ZZZ This timestamp is string, not time_t
// ZZZ This timestamp is string, not time_t
wxString
m_timeStamp
;
///< The component full time stamp found in netlist.
wxString
m_timeStamp
;
///< The component full time stamp found in netlist.
wxString
m_name
;
///< The name of the component found in the netlist.
/// The name of the
footprint in the library assigned to the component
.
/// The name of the
component in #m_library used when it was placed on the schematic.
.
wxString
m_
footprintLibN
ame
;
wxString
m_
n
ame
;
/// The lib part name used to look up the component library part information. This only has
/**
/// meaning in the new s-expression netlist file format.
* The name of the component library where #m_name was found. This will be set to
wxString
m_libraryName
;
* wxEmptyString for legacy netlist files.
wxString
m_libraryPartName
;
*/
wxString
m_library
;
/// The name of the footprint in the footprint library assigned to the component.
wxString
m_footprintName
;
/**
* The name of the footprint library that #m_footprintName is located. This will be
* set to wxEmptyString for legacy netlist formats indicating that all libraries need
* to be searched.
*/
wxString
m_footprintLib
;
/// The
footprint loaded from the library for this component
.
/// The
#MODULE loaded for #m_footprintName found in #m_footprintLib
.
std
::
auto_ptr
<
MODULE
>
m_footprint
;
std
::
auto_ptr
<
MODULE
>
m_footprint
;
/// Set to true if #m_footprintName or #m_footprintLib was changed when the footprint
/// link file was read.
bool
m_footprintChanged
;
static
COMPONENT_NET
m_emptyNet
;
static
COMPONENT_NET
m_emptyNet
;
public
:
public
:
COMPONENT
(
const
wxString
&
aName
,
COMPONENT
(
const
wxString
&
a
Footprint
Name
,
const
wxString
&
aReference
,
const
wxString
&
aReference
,
const
wxString
&
aValue
,
const
wxString
&
aValue
,
const
wxString
&
aTimeStamp
)
const
wxString
&
aTimeStamp
)
{
{
m_
name
=
a
Name
;
m_
footprintName
=
aFootprint
Name
;
m_reference
=
aReference
;
m_reference
=
aReference
;
m_value
=
aValue
;
m_value
=
aValue
;
m_timeStamp
=
aTimeStamp
;
m_timeStamp
=
aTimeStamp
;
m_footprintChanged
=
false
;
}
}
virtual
~
COMPONENT
()
{
};
virtual
~
COMPONENT
()
{
};
...
@@ -148,27 +162,34 @@ public:
...
@@ -148,27 +162,34 @@ public:
void
SortPins
()
{
sort
(
m_nets
.
begin
(),
m_nets
.
end
()
);
}
void
SortPins
()
{
sort
(
m_nets
.
begin
(),
m_nets
.
end
()
);
}
void
SetName
(
const
wxString
&
aName
)
{
m_name
=
aName
;}
const
wxString
&
GetName
()
const
{
return
m_name
;
}
void
SetLibrary
(
const
wxString
&
aLibrary
)
{
m_library
=
aLibrary
;
}
const
wxString
&
GetLibrary
()
const
{
return
m_library
;
}
const
wxString
&
GetReference
()
const
{
return
m_reference
;
}
const
wxString
&
GetReference
()
const
{
return
m_reference
;
}
const
wxString
&
GetValue
()
const
{
return
m_value
;
}
const
wxString
&
GetValue
()
const
{
return
m_value
;
}
void
SetFootprint
LibName
(
const
wxString
&
aFootprintLib
Name
)
void
SetFootprint
Name
(
const
wxString
&
aFootprint
Name
)
{
{
m_footprintLibName
=
aFootprintLibName
;
m_footprintChanged
=
!
m_footprintName
.
IsEmpty
()
&&
(
m_footprintName
!=
aFootprintName
);
m_footprintName
=
aFootprintName
;
}
}
const
wxString
&
GetFootprintLibName
()
const
{
return
m_footprintLibName
;
}
const
wxString
&
GetFootprintName
()
const
{
return
m_footprintName
;
}
const
wxString
&
GetTimeStamp
()
const
{
return
m_timeStamp
;
}
const
wxString
&
GetLibName
()
const
{
return
m_name
;
}
void
Set
LibrarySource
(
const
wxString
&
aLibName
,
const
wxString
&
aCompName
)
void
Set
FootprintLib
(
const
wxString
&
aFootprintLib
)
{
{
m_
libraryName
=
aLibName
;
m_
footprintChanged
=
!
m_footprintLib
.
IsEmpty
()
&&
(
m_footprintLib
!=
aFootprintLib
)
;
m_
libraryPartName
=
aCompName
;
m_
footprintLib
=
aFootprintLib
;
}
}
const
wxString
&
GetFootprintLib
()
const
{
return
m_footprintLib
;
}
const
wxString
&
GetTimeStamp
()
const
{
return
m_timeStamp
;
}
void
SetFootprintFilters
(
const
wxArrayString
&
aFilterList
)
void
SetFootprintFilters
(
const
wxArrayString
&
aFilterList
)
{
{
m_footprintFilters
=
aFilterList
;
m_footprintFilters
=
aFilterList
;
...
@@ -183,11 +204,13 @@ public:
...
@@ -183,11 +204,13 @@ public:
void
SetModule
(
MODULE
*
aModule
);
void
SetModule
(
MODULE
*
aModule
);
bool
IsLibSource
(
const
wxString
&
aLib
Name
,
const
wxString
&
aComp
Name
)
const
bool
IsLibSource
(
const
wxString
&
aLib
rary
,
const
wxString
&
a
Name
)
const
{
{
return
aLib
Name
==
m_libraryName
&&
aCompName
==
m_libraryPartN
ame
;
return
aLib
rary
==
m_library
&&
aName
==
m_n
ame
;
}
}
bool
FootprintChanged
()
const
{
return
m_footprintChanged
;
}
#if defined(DEBUG)
#if defined(DEBUG)
/**
/**
* Function Show
* Function Show
...
@@ -293,16 +316,7 @@ public:
...
@@ -293,16 +316,7 @@ public:
*/
*/
COMPONENT
*
GetComponentByTimeStamp
(
const
wxString
&
aTimeStamp
);
COMPONENT
*
GetComponentByTimeStamp
(
const
wxString
&
aTimeStamp
);
/*
void
SortByFootprintName
();
* Function GetComponentByLibName
* returns a #COMPONENT by \a aLibName.
*
* @param aLibName is the component library name of the #COMPONENT.
* @return a pointer to the #COMPONENT that matches \a aLibName if found. Otherwise NULL.
*/
COMPONENT
*
GetComponentByLibName
(
const
wxString
&
aLibName
);
void
SortByFootprintLibName
();
void
SortByReference
();
void
SortByReference
();
...
@@ -328,6 +342,31 @@ public:
...
@@ -328,6 +342,31 @@ public:
bool
GetReplaceFootprints
()
const
{
return
m_replaceFootprints
;
}
bool
GetReplaceFootprints
()
const
{
return
m_replaceFootprints
;
}
/**
* Function AnyFootprintsLinked
* @return true if any component with a footprint link is found.
*/
bool
AnyFootprintsLinked
()
const
;
/**
* Function AllFootprintsLinked
* @return true if all components have a footprint link.
*/
bool
AllFootprintsLinked
()
const
;
/**
* Function NoFootprintsLinked
* @return true if none of the components have a footprint link.
*/
bool
NoFootprintsLinked
()
const
{
return
!
AnyFootprintsLinked
();
}
/**
* Function AnyFootprintsChanged
* @return true if any components footprints were changed when the footprint link file
* (*.cmp) was loaded.
*/
bool
AnyFootprintsChanged
()
const
;
#if defined(DEBUG)
#if defined(DEBUG)
/**
/**
* Function Show
* Function Show
...
...
pcbnew/specctra_import.cpp
View file @
3a9f3f89
...
@@ -320,7 +320,7 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
...
@@ -320,7 +320,7 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
else
// VIA_MICROVIA or VIA_BLIND_BURIED
else
// VIA_MICROVIA or VIA_BLIND_BURIED
{
{
LAYER_NUM
topLayerNdx
=
UNDEFINED_LAYER
;
LAYER_NUM
topLayerNdx
=
UNDEFINED_LAYER
;
LAYER_NUM
botLayerNdx
=
7000
;
LAYER_NUM
botLayerNdx
=
7000
;
// Ask Dick if this number loses its magic
int
viaDiam
=
-
1
;
int
viaDiam
=
-
1
;
for
(
int
i
=
0
;
i
<
shapeCount
;
++
i
)
for
(
int
i
=
0
;
i
<
shapeCount
;
++
i
)
...
...
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