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
5dc3cf98
Commit
5dc3cf98
authored
Apr 03, 2011
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more free sweet work
parent
39194ef6
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
143 additions
and
129 deletions
+143
-129
eeschema_part_sexpr_format_EN.odt
new/eeschema_part_sexpr_format_EN.odt
+0
-0
make-dir-lib-source-test-data.sh
new/make-dir-lib-source-test-data.sh
+1
-1
sch_part.cpp
new/sch_part.cpp
+23
-36
sch_part.h
new/sch_part.h
+17
-4
sch_sweet_parser.cpp
new/sch_sweet_parser.cpp
+102
-88
No files found.
new/eeschema_part_sexpr_format_EN.odt
View file @
5dc3cf98
No preview for this file type
new/make-dir-lib-source-test-data.sh
View file @
5dc3cf98
...
@@ -40,7 +40,7 @@ BEZIER="
...
@@ -40,7 +40,7 @@ BEZIER="
)"
)"
TEXT
=
"
TEXT
=
"
(text
\"
This is some text
\"
(at 23 23 90.0)
(justify left bottom)(visible yes)(fill filled)
(text
(at 23 23 90.0)
\"
This is some text
\"
(justify left bottom)(visible yes)(fill filled)
(font arial (size .8 1.2))
(font arial (size .8 1.2))
)"
)"
...
...
new/sch_part.cpp
View file @
5dc3cf98
...
@@ -31,6 +31,20 @@
...
@@ -31,6 +31,20 @@
#include <macros.h>
#include <macros.h>
//#include <richio.h>
//#include <richio.h>
/**
* Function formatAt
* returns a formatted "(at X Y [ANGLE])" s-expression
*/
static
void
formatAt
(
OUTPUTFORMATTER
*
out
,
const
POINT
&
aPos
,
ANGLE
aAngle
,
int
indent
=
0
)
throw
(
IO_ERROR
)
{
out
->
Print
(
indent
,
aAngle
==
0.0
?
"(at %.6g %.6g %.6g)"
:
"(at %.6g %.6g)"
,
InternalToLogical
(
aPos
.
x
),
InternalToLogical
(
aPos
.
y
),
double
(
aAngle
)
);
}
using
namespace
SCH
;
using
namespace
SCH
;
...
@@ -40,13 +54,6 @@ PART::PART( LIB* aOwner, const STRING& aPartNameAndRev ) :
...
@@ -40,13 +54,6 @@ PART::PART( LIB* aOwner, const STRING& aPartNameAndRev ) :
partNameAndRev
(
aPartNameAndRev
),
partNameAndRev
(
aPartNameAndRev
),
extends
(
0
),
extends
(
0
),
base
(
0
)
base
(
0
)
/*
reference( this, wxT( "reference " ) ),
value( this, wxT( "value" ) ),
footprint( this, wxT( "footprint" ) ),
model( this, wxT( "model" ) ),
datasheet( this, wxT( "datasheet" ) )
*/
{
{
// Our goal is to have class LIB only instantiate what is needed, so print here
// Our goal is to have class LIB only instantiate what is needed, so print here
// what it is doing. It is the only class where PART can be instantiated.
// what it is doing. It is the only class where PART can be instantiated.
...
@@ -307,12 +314,7 @@ void TEXT_EFFECTS::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
...
@@ -307,12 +314,7 @@ void TEXT_EFFECTS::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
else
else
out
->
Print
(
indent
,
"(effects %s "
,
out
->
Quotew
(
propName
).
c_str
()
);
out
->
Print
(
indent
,
"(effects %s "
,
out
->
Quotew
(
propName
).
c_str
()
);
out
->
Print
(
0
,
"(at %.6g %.6g"
,
InternalToLogical
(
pos
.
x
),
InternalToLogical
(
pos
.
y
)
);
formatAt
(
out
,
pos
,
angle
);
if
(
angle
)
out
->
Print
(
0
,
" %.6g)"
,
double
(
angle
)
);
else
out
->
Print
(
0
,
")"
);
font
.
Format
(
out
,
0
,
ctl
|
CTL_OMIT_NL
);
font
.
Format
(
out
,
0
,
ctl
|
CTL_OMIT_NL
);
...
@@ -349,13 +351,8 @@ void PIN::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
...
@@ -349,13 +351,8 @@ void PIN::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
{
{
out
->
Print
(
indent
,
"(pin %s %s "
,
ShowType
(),
ShowShape
()
);
out
->
Print
(
indent
,
"(pin %s %s "
,
ShowType
(),
ShowShape
()
);
if
(
angle
)
formatAt
(
out
,
pos
,
angle
);
out
->
Print
(
0
,
"(at %.6g %.6g %.6g)"
,
InternalToLogical
(
pos
.
x
),
InternalToLogical
(
pos
.
y
),
double
(
angle
)
);
else
out
->
Print
(
0
,
"(at %.6g %.6g)"
,
InternalToLogical
(
pos
.
x
),
InternalToLogical
(
pos
.
y
)
);
out
->
Print
(
0
,
"(length %.6g)"
,
InternalToLogical
(
length
)
);
out
->
Print
(
0
,
"(length %.6g)"
,
InternalToLogical
(
length
)
);
out
->
Print
(
0
,
"(visible %s)
\n
"
,
isVisible
?
"yes"
:
"no"
);
out
->
Print
(
0
,
"(visible %s)
\n
"
,
isVisible
?
"yes"
:
"no"
);
signal
.
Format
(
out
,
"signal"
,
indent
+
1
,
0
);
signal
.
Format
(
out
,
"signal"
,
indent
+
1
,
0
);
...
@@ -386,7 +383,7 @@ void POLY_LINE::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
...
@@ -386,7 +383,7 @@ void POLY_LINE::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
void
POLY_LINE
::
formatContents
(
OUTPUTFORMATTER
*
out
,
int
indent
,
int
ctl
)
const
void
POLY_LINE
::
formatContents
(
OUTPUTFORMATTER
*
out
,
int
indent
,
int
ctl
)
const
throw
(
IO_ERROR
)
throw
(
IO_ERROR
)
{
{
out
->
Print
(
0
,
"(line_width %.6g)"
,
lineWidth
);
// @todo use logical units?
out
->
Print
(
0
,
"(line_width %.6g)"
,
InternalToWidth
(
lineWidth
)
);
if
(
fillType
!=
PR
::
T_none
)
if
(
fillType
!=
PR
::
T_none
)
out
->
Print
(
0
,
"(fill %s)"
,
ShowFill
(
fillType
)
);
out
->
Print
(
0
,
"(fill %s)"
,
ShowFill
(
fillType
)
);
...
@@ -437,7 +434,7 @@ void RECTANGLE::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
...
@@ -437,7 +434,7 @@ void RECTANGLE::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
out
->
Print
(
indent
,
"(rectangle (start %.6g %.6g)(end %.6g %.6g)(line_width %.6g)"
,
out
->
Print
(
indent
,
"(rectangle (start %.6g %.6g)(end %.6g %.6g)(line_width %.6g)"
,
InternalToLogical
(
start
.
x
),
InternalToLogical
(
start
.
y
),
InternalToLogical
(
start
.
x
),
InternalToLogical
(
start
.
y
),
InternalToLogical
(
end
.
x
),
InternalToLogical
(
end
.
y
),
InternalToLogical
(
end
.
x
),
InternalToLogical
(
end
.
y
),
lineWidth
);
InternalToWidth
(
lineWidth
)
);
if
(
fillType
!=
PR
::
T_none
)
if
(
fillType
!=
PR
::
T_none
)
out
->
Print
(
0
,
"(fill %s)"
,
ShowFill
(
fillType
)
);
out
->
Print
(
0
,
"(fill %s)"
,
ShowFill
(
fillType
)
);
...
@@ -456,7 +453,7 @@ void CIRCLE::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
...
@@ -456,7 +453,7 @@ void CIRCLE::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
out
->
Print
(
indent
,
"(circle (center %.6g %.6g)(radius %.6g)(line_width %.6g)"
,
out
->
Print
(
indent
,
"(circle (center %.6g %.6g)(radius %.6g)(line_width %.6g)"
,
InternalToLogical
(
center
.
x
),
InternalToLogical
(
center
.
y
),
InternalToLogical
(
center
.
x
),
InternalToLogical
(
center
.
y
),
InternalToLogical
(
radius
),
InternalToLogical
(
radius
),
lineWidth
);
InternalToWidth
(
lineWidth
)
);
if
(
fillType
!=
PR
::
T_none
)
if
(
fillType
!=
PR
::
T_none
)
out
->
Print
(
0
,
"(fill %s)"
,
ShowFill
(
fillType
)
);
out
->
Print
(
0
,
"(fill %s)"
,
ShowFill
(
fillType
)
);
...
@@ -477,7 +474,7 @@ void ARC::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
...
@@ -477,7 +474,7 @@ void ARC::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
InternalToLogical
(
radius
),
InternalToLogical
(
radius
),
InternalToLogical
(
start
.
x
),
InternalToLogical
(
start
.
y
),
InternalToLogical
(
start
.
x
),
InternalToLogical
(
start
.
y
),
InternalToLogical
(
end
.
x
),
InternalToLogical
(
end
.
y
),
InternalToLogical
(
end
.
x
),
InternalToLogical
(
end
.
y
),
lineWidth
);
InternalToWidth
(
lineWidth
)
);
if
(
fillType
!=
PR
::
T_none
)
if
(
fillType
!=
PR
::
T_none
)
out
->
Print
(
0
,
"(fill %s)"
,
ShowFill
(
fillType
)
);
out
->
Print
(
0
,
"(fill %s)"
,
ShowFill
(
fillType
)
);
...
@@ -491,23 +488,14 @@ void GR_TEXT::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
...
@@ -491,23 +488,14 @@ void GR_TEXT::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
{
{
/*
/*
(text "This is the text that gets drawn."
(text "This is the text that gets drawn."
(at X Y [ANGLE])
(at X Y [ANGLE])(justify HORIZONTAL_JUSTIFY VERTICAL_JUSTIFY)(visible YES)(fill FILL_TYPE)
# Valid horizontal justification values are center, right, and left. Valid
# vertical justification values are center, top, bottom.
(justify HORIZONTAL_JUSTIFY VERTICAL_JUSTIFY)
(font [FONT] (size HEIGHT WIDTH) [italic] [bold])
(font [FONT] (size HEIGHT WIDTH) [italic] [bold])
(visible YES)
(fill FILL_TYPE)
)
)
*/
*/
out
->
Print
(
indent
,
"(text %s
\n
"
,
out
->
Quotew
(
text
).
c_str
()
);
out
->
Print
(
indent
,
"(text %s
\n
"
,
out
->
Quotew
(
text
).
c_str
()
);
if
(
angle
)
formatAt
(
out
,
pos
,
angle
,
indent
+
1
);
out
->
Print
(
indent
+
1
,
"(at %.6g %.6g %.6g)"
,
InternalToLogical
(
pos
.
x
),
InternalToLogical
(
pos
.
y
),
double
(
angle
)
);
else
out
->
Print
(
indent
+
1
,
"(at %.6g %.6g)"
,
InternalToLogical
(
pos
.
x
),
InternalToLogical
(
pos
.
y
)
);
out
->
Print
(
0
,
"(justify %s %s)(visible %s)"
,
out
->
Print
(
0
,
"(justify %s %s)(visible %s)"
,
ShowJustify
(
hjustify
),
ShowJustify
(
vjustify
),
ShowJustify
(
hjustify
),
ShowJustify
(
vjustify
),
...
@@ -516,8 +504,7 @@ void GR_TEXT::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
...
@@ -516,8 +504,7 @@ void GR_TEXT::Format( OUTPUTFORMATTER* out, int indent, int ctl ) const
if
(
fillType
!=
PR
::
T_none
)
if
(
fillType
!=
PR
::
T_none
)
out
->
Print
(
0
,
"(fill %s)"
,
ShowFill
(
fillType
)
);
out
->
Print
(
0
,
"(fill %s)"
,
ShowFill
(
fillType
)
);
out
->
Print
(
0
,
"
\n
"
);
font
.
Format
(
out
,
0
,
CTL_OMIT_NL
);
font
.
Format
(
out
,
indent
+
1
,
CTL_OMIT_NL
);
out
->
Print
(
0
,
")
\n
"
);
out
->
Print
(
0
,
")
\n
"
);
}
}
new/sch_part.h
View file @
5dc3cf98
...
@@ -55,6 +55,19 @@ static inline int LogicalToInternal( double aCoord )
...
@@ -55,6 +55,19 @@ static inline int LogicalToInternal( double aCoord )
return
int
(
aCoord
*
INTERNAL_PER_LOGICAL
);
return
int
(
aCoord
*
INTERNAL_PER_LOGICAL
);
}
}
static
inline
int
WidthToInternal
(
double
aWidth
)
{
// sweet line widths are a "percent of a logical unit"
return
LogicalToInternal
(
aWidth
)
/
100
;
}
static
inline
double
InternalToWidth
(
int
aWidth
)
{
// sweet line widths are a "percent of a logical unit"
return
InternalToLogical
(
aWidth
)
*
100
;
}
//-----<temporary home for PART sub objects, move after stable>------------------
//-----<temporary home for PART sub objects, move after stable>------------------
#include <wx/gdicmn.h>
#include <wx/gdicmn.h>
...
@@ -174,7 +187,7 @@ class POLY_LINE : public BASE_GRAPHIC
...
@@ -174,7 +187,7 @@ class POLY_LINE : public BASE_GRAPHIC
friend
class
SWEET_PARSER
;
friend
class
SWEET_PARSER
;
protected
:
protected
:
double
lineWidth
;
int
lineWidth
;
int
fillType
;
// T_none, T_filled, or T_transparent
int
fillType
;
// T_none, T_filled, or T_transparent
POINTS
pts
;
POINTS
pts
;
...
@@ -216,7 +229,7 @@ class RECTANGLE : public BASE_GRAPHIC
...
@@ -216,7 +229,7 @@ class RECTANGLE : public BASE_GRAPHIC
friend
class
SWEET_PARSER
;
friend
class
SWEET_PARSER
;
protected
:
protected
:
double
lineWidth
;
int
lineWidth
;
int
fillType
;
// T_none, T_filled, or T_transparent
int
fillType
;
// T_none, T_filled, or T_transparent
POINT
start
;
POINT
start
;
POINT
end
;
POINT
end
;
...
@@ -242,7 +255,7 @@ class CIRCLE : public BASE_GRAPHIC
...
@@ -242,7 +255,7 @@ class CIRCLE : public BASE_GRAPHIC
protected
:
protected
:
POINT
center
;
POINT
center
;
int
radius
;
int
radius
;
double
lineWidth
;
int
lineWidth
;
int
fillType
;
// T_none, T_filled, or T_transparent
int
fillType
;
// T_none, T_filled, or T_transparent
public
:
public
:
...
@@ -266,7 +279,7 @@ class ARC : public BASE_GRAPHIC
...
@@ -266,7 +279,7 @@ class ARC : public BASE_GRAPHIC
protected
:
protected
:
POINT
pos
;
POINT
pos
;
double
lineWidth
;
int
lineWidth
;
int
fillType
;
// T_none, T_filled, or T_transparent
int
fillType
;
// T_none, T_filled, or T_transparent
int
radius
;
int
radius
;
POINT
start
;
POINT
start
;
...
...
new/sch_sweet_parser.cpp
View file @
5dc3cf98
This diff is collapsed.
Click to expand 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