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
e07fd7ef
Commit
e07fd7ef
authored
Jun 06, 2012
by
Ryan Bunch
Committed by
Dick Hollenbeck
Jun 06, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow comments in library files
parent
f5047b29
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
29 deletions
+32
-29
class_libentry.cpp
eeschema/class_libentry.cpp
+32
-29
No files found.
eeschema/class_libentry.cpp
View file @
e07fd7ef
...
@@ -300,7 +300,7 @@ void LIB_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOff
...
@@ -300,7 +300,7 @@ void LIB_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOff
if
(
drawItem
.
m_Flags
&
IS_MOVED
)
if
(
drawItem
.
m_Flags
&
IS_MOVED
)
continue
;
continue
;
/
* Do not draw items not attached to the current part */
/
/ Do not draw items not attached to the current part
if
(
aMulti
&&
drawItem
.
m_Unit
&&
(
drawItem
.
m_Unit
!=
aMulti
)
)
if
(
aMulti
&&
drawItem
.
m_Unit
&&
(
drawItem
.
m_Unit
!=
aMulti
)
)
continue
;
continue
;
...
@@ -330,7 +330,7 @@ void LIB_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOff
...
@@ -330,7 +330,7 @@ void LIB_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOff
if
(
drawItem
.
m_Flags
&
IS_MOVED
)
if
(
drawItem
.
m_Flags
&
IS_MOVED
)
continue
;
continue
;
/
* Do not draw items not attached to the current part */
/
/ Do not draw items not attached to the current part
if
(
aMulti
&&
drawItem
.
m_Unit
&&
(
drawItem
.
m_Unit
!=
aMulti
)
)
if
(
aMulti
&&
drawItem
.
m_Unit
&&
(
drawItem
.
m_Unit
!=
aMulti
)
)
continue
;
continue
;
...
@@ -358,7 +358,7 @@ void LIB_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOff
...
@@ -358,7 +358,7 @@ void LIB_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOff
}
}
/
* Enable this to draw the anchor of the component. */
/
/ Enable this to draw the anchor of the component.
#if 0
#if 0
int len = aDc->DeviceToLogicalXRel( 3 );
int len = aDc->DeviceToLogicalXRel( 3 );
...
@@ -534,10 +534,10 @@ bool LIB_COMPONENT::Save( OUTPUTFORMATTER& aFormatter )
...
@@ -534,10 +534,10 @@ bool LIB_COMPONENT::Save( OUTPUTFORMATTER& aFormatter )
size_t
i
;
size_t
i
;
LIB_FIELD
&
value
=
GetValueField
();
LIB_FIELD
&
value
=
GetValueField
();
/
* First line: it s a comment (component name for readers) */
/
/ First line: it s a comment (component name for readers)
aFormatter
.
Print
(
0
,
"#
\n
# %s
\n
#
\n
"
,
TO_UTF8
(
value
.
m_Text
)
);
aFormatter
.
Print
(
0
,
"#
\n
# %s
\n
#
\n
"
,
TO_UTF8
(
value
.
m_Text
)
);
/
* Save data */
/
/ Save data
aFormatter
.
Print
(
0
,
"DEF"
);
aFormatter
.
Print
(
0
,
"DEF"
);
if
(
value
.
IsVisible
()
)
if
(
value
.
IsVisible
()
)
...
@@ -618,7 +618,7 @@ bool LIB_COMPONENT::Save( OUTPUTFORMATTER& aFormatter )
...
@@ -618,7 +618,7 @@ bool LIB_COMPONENT::Save( OUTPUTFORMATTER& aFormatter )
aFormatter
.
Print
(
0
,
"
\n
"
);
aFormatter
.
Print
(
0
,
"
\n
"
);
}
}
/
* Write the footprint filter list */
/
/ Write the footprint filter list
if
(
m_FootprintList
.
GetCount
()
!=
0
)
if
(
m_FootprintList
.
GetCount
()
!=
0
)
{
{
aFormatter
.
Print
(
0
,
"$FPLIST
\n
"
);
aFormatter
.
Print
(
0
,
"$FPLIST
\n
"
);
...
@@ -631,7 +631,7 @@ bool LIB_COMPONENT::Save( OUTPUTFORMATTER& aFormatter )
...
@@ -631,7 +631,7 @@ bool LIB_COMPONENT::Save( OUTPUTFORMATTER& aFormatter )
aFormatter
.
Print
(
0
,
"$ENDFPLIST
\n
"
);
aFormatter
.
Print
(
0
,
"$ENDFPLIST
\n
"
);
}
}
/
* Save graphics items (including pins) */
/
/ Save graphics items (including pins)
if
(
!
drawings
.
empty
()
)
if
(
!
drawings
.
empty
()
)
{
{
/* we sort the draw items, in order to have an edition more easy,
/* we sort the draw items, in order to have an edition more easy,
...
@@ -680,21 +680,21 @@ bool LIB_COMPONENT::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
...
@@ -680,21 +680,21 @@ bool LIB_COMPONENT::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
return
false
;
return
false
;
}
}
/
* Read DEF line: */
/
/ Read DEF line:
char
drawnum
=
0
;
char
drawnum
=
0
;
char
drawname
=
0
;
char
drawname
=
0
;
if
(
(
componentName
=
strtok
(
NULL
,
"
\t\n
"
)
)
==
NULL
/
* Part name: */
if
(
(
componentName
=
strtok
(
NULL
,
"
\t\n
"
)
)
==
NULL
/
/ Part name:
||
(
prefix
=
strtok
(
NULL
,
"
\t\n
"
)
)
==
NULL
/
* Prefix name: */
||
(
prefix
=
strtok
(
NULL
,
"
\t\n
"
)
)
==
NULL
/
/ Prefix name:
||
(
p
=
strtok
(
NULL
,
"
\t\n
"
)
)
==
NULL
/
* NumOfPins: */
||
(
p
=
strtok
(
NULL
,
"
\t\n
"
)
)
==
NULL
/
/ NumOfPins:
||
sscanf
(
p
,
"%d"
,
&
unused
)
!=
1
||
sscanf
(
p
,
"%d"
,
&
unused
)
!=
1
||
(
p
=
strtok
(
NULL
,
"
\t\n
"
)
)
==
NULL
/
* TextInside: */
||
(
p
=
strtok
(
NULL
,
"
\t\n
"
)
)
==
NULL
/
/ TextInside:
||
sscanf
(
p
,
"%d"
,
&
m_pinNameOffset
)
!=
1
||
sscanf
(
p
,
"%d"
,
&
m_pinNameOffset
)
!=
1
||
(
p
=
strtok
(
NULL
,
"
\t\n
"
)
)
==
NULL
/
* DrawNums: */
||
(
p
=
strtok
(
NULL
,
"
\t\n
"
)
)
==
NULL
/
/ DrawNums:
||
sscanf
(
p
,
"%c"
,
&
drawnum
)
!=
1
||
sscanf
(
p
,
"%c"
,
&
drawnum
)
!=
1
||
(
p
=
strtok
(
NULL
,
"
\t\n
"
)
)
==
NULL
/
* DrawNums: */
||
(
p
=
strtok
(
NULL
,
"
\t\n
"
)
)
==
NULL
/
/ DrawNums:
||
sscanf
(
p
,
"%c"
,
&
drawname
)
!=
1
||
sscanf
(
p
,
"%c"
,
&
drawname
)
!=
1
||
(
p
=
strtok
(
NULL
,
"
\t\n
"
)
)
==
NULL
/
* m_unitCount: */
||
(
p
=
strtok
(
NULL
,
"
\t\n
"
)
)
==
NULL
/
/ m_unitCount:
||
sscanf
(
p
,
"%d"
,
&
m_unitCount
)
!=
1
)
||
sscanf
(
p
,
"%d"
,
&
m_unitCount
)
!=
1
)
{
{
aErrorMsg
.
Printf
(
wxT
(
"Wrong DEF format in line %d, skipped."
),
aErrorMsg
.
Printf
(
wxT
(
"Wrong DEF format in line %d, skipped."
),
...
@@ -720,7 +720,7 @@ bool LIB_COMPONENT::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
...
@@ -720,7 +720,7 @@ bool LIB_COMPONENT::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
m_showPinNumbers
=
(
drawnum
==
'N'
)
?
false
:
true
;
m_showPinNumbers
=
(
drawnum
==
'N'
)
?
false
:
true
;
m_showPinNames
=
(
drawname
==
'N'
)
?
false
:
true
;
m_showPinNames
=
(
drawname
==
'N'
)
?
false
:
true
;
/
* Copy part name and prefix. */
/
/ Copy part name and prefix.
LIB_FIELD
&
value
=
GetValueField
();
LIB_FIELD
&
value
=
GetValueField
();
if
(
componentName
[
0
]
!=
'~'
)
if
(
componentName
[
0
]
!=
'~'
)
...
@@ -763,7 +763,7 @@ bool LIB_COMPONENT::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
...
@@ -763,7 +763,7 @@ bool LIB_COMPONENT::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
p
=
strtok
(
line
,
"
\t\r\n
"
);
p
=
strtok
(
line
,
"
\t\r\n
"
);
/
* This is the error flag ( if an error occurs, Res = false) */
/
/ This is the error flag ( if an error occurs, Res = false)
Res
=
true
;
Res
=
true
;
if
(
*
line
==
'#'
)
// a comment
if
(
*
line
==
'#'
)
// a comment
...
@@ -785,7 +785,7 @@ bool LIB_COMPONENT::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
...
@@ -785,7 +785,7 @@ bool LIB_COMPONENT::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
else
if
(
strncmp
(
p
,
"$FPLIST"
,
5
)
==
0
)
else
if
(
strncmp
(
p
,
"$FPLIST"
,
5
)
==
0
)
Res
=
LoadFootprints
(
aLineReader
,
Msg
);
Res
=
LoadFootprints
(
aLineReader
,
Msg
);
/
* End line or block analysis: test for an error */
/
/ End line or block analysis: test for an error
if
(
!
Res
)
if
(
!
Res
)
{
{
if
(
Msg
.
IsEmpty
()
)
if
(
Msg
.
IsEmpty
()
)
...
@@ -798,7 +798,7 @@ bool LIB_COMPONENT::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
...
@@ -798,7 +798,7 @@ bool LIB_COMPONENT::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
}
}
}
}
/
* If we are here, this part is O.k. - put it in: */
/
/ If we are here, this part is O.k. - put it in:
drawings
.
sort
();
drawings
.
sort
();
return
true
;
return
true
;
...
@@ -827,34 +827,37 @@ bool LIB_COMPONENT::LoadDrawEntries( LINE_READER& aLineReader, wxString& aErrorM
...
@@ -827,34 +827,37 @@ bool LIB_COMPONENT::LoadDrawEntries( LINE_READER& aLineReader, wxString& aErrorM
switch
(
line
[
0
]
)
switch
(
line
[
0
]
)
{
{
case
'A'
:
/
* Arc */
case
'A'
:
/
/ Arc
newEntry
=
(
LIB_ITEM
*
)
new
LIB_ARC
(
this
);
newEntry
=
(
LIB_ITEM
*
)
new
LIB_ARC
(
this
);
break
;
break
;
case
'C'
:
/
* Circle */
case
'C'
:
/
/ Circle
newEntry
=
(
LIB_ITEM
*
)
new
LIB_CIRCLE
(
this
);
newEntry
=
(
LIB_ITEM
*
)
new
LIB_CIRCLE
(
this
);
break
;
break
;
case
'T'
:
/
* Text */
case
'T'
:
/
/ Text
newEntry
=
(
LIB_ITEM
*
)
new
LIB_TEXT
(
this
);
newEntry
=
(
LIB_ITEM
*
)
new
LIB_TEXT
(
this
);
break
;
break
;
case
'S'
:
/
* Square */
case
'S'
:
/
/ Square
newEntry
=
(
LIB_ITEM
*
)
new
LIB_RECTANGLE
(
this
);
newEntry
=
(
LIB_ITEM
*
)
new
LIB_RECTANGLE
(
this
);
break
;
break
;
case
'X'
:
/
* Pin Description */
case
'X'
:
/
/ Pin Description
newEntry
=
(
LIB_ITEM
*
)
new
LIB_PIN
(
this
);
newEntry
=
(
LIB_ITEM
*
)
new
LIB_PIN
(
this
);
break
;
break
;
case
'P'
:
/
* Polyline */
case
'P'
:
/
/ Polyline
newEntry
=
(
LIB_ITEM
*
)
new
LIB_POLYLINE
(
this
);
newEntry
=
(
LIB_ITEM
*
)
new
LIB_POLYLINE
(
this
);
break
;
break
;
case
'B'
:
/
* Bezier Curves */
case
'B'
:
/
/ Bezier Curves
newEntry
=
(
LIB_ITEM
*
)
new
LIB_BEZIER
(
this
);
newEntry
=
(
LIB_ITEM
*
)
new
LIB_BEZIER
(
this
);
break
;
break
;
case
'#'
:
// Comment
continue
;
default
:
default
:
aErrorMsg
.
Printf
(
wxT
(
"undefined DRAW command %c"
),
line
[
0
]
);
aErrorMsg
.
Printf
(
wxT
(
"undefined DRAW command %c"
),
line
[
0
]
);
return
false
;
return
false
;
...
@@ -866,7 +869,7 @@ bool LIB_COMPONENT::LoadDrawEntries( LINE_READER& aLineReader, wxString& aErrorM
...
@@ -866,7 +869,7 @@ bool LIB_COMPONENT::LoadDrawEntries( LINE_READER& aLineReader, wxString& aErrorM
GetChars
(
aErrorMsg
),
line
[
0
]
);
GetChars
(
aErrorMsg
),
line
[
0
]
);
SAFE_DELETE
(
newEntry
);
SAFE_DELETE
(
newEntry
);
/
* Flush till end of draw section */
/
/ Flush till end of draw section
do
do
{
{
if
(
!
aLineReader
.
ReadLine
()
)
if
(
!
aLineReader
.
ReadLine
()
)
...
@@ -1469,7 +1472,7 @@ void LIB_COMPONENT::SetConversion( bool aSetConvert )
...
@@ -1469,7 +1472,7 @@ void LIB_COMPONENT::SetConversion( bool aSetConvert )
{
{
BOOST_FOREACH
(
LIB_ITEM
&
item
,
drawings
)
BOOST_FOREACH
(
LIB_ITEM
&
item
,
drawings
)
{
{
/
* Only pins are duplicated. */
/
/ Only pins are duplicated.
if
(
item
.
Type
()
!=
LIB_PIN_T
)
if
(
item
.
Type
()
!=
LIB_PIN_T
)
continue
;
continue
;
...
@@ -1548,7 +1551,7 @@ void LIB_COMPONENT::SetAliases( const wxArrayString& aAliasList )
...
@@ -1548,7 +1551,7 @@ void LIB_COMPONENT::SetAliases( const wxArrayString& aAliasList )
m_aliases
.
push_back
(
new
LIB_ALIAS
(
aAliasList
[
i
],
this
)
);
m_aliases
.
push_back
(
new
LIB_ALIAS
(
aAliasList
[
i
],
this
)
);
}
}
/
* Remove names in the current component that are not in the new alias list. */
/
/ Remove names in the current component that are not in the new alias list.
LIB_ALIASES
::
iterator
it
;
LIB_ALIASES
::
iterator
it
;
for
(
it
=
m_aliases
.
begin
();
it
<
m_aliases
.
end
();
it
++
)
for
(
it
=
m_aliases
.
begin
();
it
<
m_aliases
.
end
();
it
++
)
...
...
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