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
1833ff24
Commit
1833ff24
authored
Oct 16, 2009
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eeschema: fixed: incorrect position of texts fields in some components orientations
parent
5d887ebc
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
111 additions
and
192 deletions
+111
-192
class_sch_cmp_field.cpp
eeschema/class_sch_cmp_field.cpp
+92
-110
plot.cpp
eeschema/plot.cpp
+19
-82
No files found.
eeschema/class_sch_cmp_field.cpp
View file @
1833ff24
This diff is collapsed.
Click to expand it.
eeschema/plot.cpp
View file @
1833ff24
...
@@ -85,9 +85,7 @@ static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
...
@@ -85,9 +85,7 @@ static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
*/
*/
{
{
wxPoint
textpos
;
/* Position des textes */
SCH_CMP_FIELD
*
field
=
DrawLibItem
->
GetField
(
FieldNumber
);
SCH_CMP_FIELD
*
field
=
DrawLibItem
->
GetField
(
FieldNumber
);
int
orient
;
EDA_Colors
color
=
UNSPECIFIED_COLOR
;
EDA_Colors
color
=
UNSPECIFIED_COLOR
;
color
=
ReturnLayerColor
(
field
->
GetLayer
()
);
color
=
ReturnLayerColor
(
field
->
GetLayer
()
);
...
@@ -98,98 +96,37 @@ static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
...
@@ -98,98 +96,37 @@ static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
if
(
field
->
IsVoid
()
)
if
(
field
->
IsVoid
()
)
return
;
return
;
/* Calcul de la position des textes, selon orientation du composant */
/* Calculate the text orientation, according to the component orientation/mirror */
orient
=
field
->
m_Orient
;
int
orient
=
field
->
m_Orient
;
GRTextHorizJustifyType
hjustify
=
field
->
m_HJustify
;
if
(
DrawLibItem
->
m_Transform
[
0
][
1
]
)
// Rotation du composant de 90deg
GRTextVertJustifyType
vjustify
=
field
->
m_VJustify
;
textpos
=
field
->
m_Pos
-
DrawLibItem
->
m_Pos
;
// textpos is the text position relative to the component anchor
textpos
=
TransformCoordinate
(
DrawLibItem
->
m_Transform
,
textpos
)
+
DrawLibItem
->
m_Pos
;
/* Y a t-il rotation */
if
(
DrawLibItem
->
m_Transform
[
0
][
1
]
)
{
{
if
(
orient
==
TEXT_ORIENT_HORIZ
)
if
(
orient
==
TEXT_ORIENT_HORIZ
)
orient
=
TEXT_ORIENT_VERT
;
orient
=
TEXT_ORIENT_VERT
;
else
else
orient
=
TEXT_ORIENT_HORIZ
;
orient
=
TEXT_ORIENT_HORIZ
;
/* Y a t-il rotation, miroir (pour les justifications)*/
GRTextHorizJustifyType
tmp
=
hjustify
;
hjustify
=
(
GRTextHorizJustifyType
)
vjustify
;
vjustify
=
(
GRTextVertJustifyType
)
tmp
;
if
(
DrawLibItem
->
m_Transform
[
1
][
0
]
<
0
)
switch
(
vjustify
)
{
case
GR_TEXT_VJUSTIFY_BOTTOM
:
vjustify
=
GR_TEXT_VJUSTIFY_TOP
;
break
;
case
GR_TEXT_VJUSTIFY_TOP
:
vjustify
=
GR_TEXT_VJUSTIFY_BOTTOM
;
break
;
default
:
break
;
}
if
(
DrawLibItem
->
m_Transform
[
1
][
0
]
>
0
)
switch
(
hjustify
)
{
case
GR_TEXT_HJUSTIFY_LEFT
:
hjustify
=
GR_TEXT_HJUSTIFY_RIGHT
;
break
;
case
GR_TEXT_HJUSTIFY_RIGHT
:
hjustify
=
GR_TEXT_HJUSTIFY_LEFT
;
break
;
default
:
break
;
}
}
}
else
{
/* Texte horizontal: Y a t-il miroir (pour les justifications)*/
if
(
DrawLibItem
->
m_Transform
[
0
][
0
]
<
0
)
switch
(
hjustify
)
{
case
GR_TEXT_HJUSTIFY_LEFT
:
hjustify
=
GR_TEXT_HJUSTIFY_RIGHT
;
break
;
case
GR_TEXT_HJUSTIFY_RIGHT
:
hjustify
=
GR_TEXT_HJUSTIFY_LEFT
;
break
;
default
:
break
;
}
if
(
DrawLibItem
->
m_Transform
[
1
][
1
]
>
0
)
/* Calculate the text justification, according to the component orientation/mirror
switch
(
vjustify
)
* this is a bit complicated due to cumulative calculations:
{
* - numerous cases (mirrored or not, rotation)
case
GR_TEXT_VJUSTIFY_BOTTOM
:
* - the DrawGraphicText function recalculate also H and H vustifications
vjustify
=
GR_TEXT_VJUSTIFY_TOP
;
* according to the text orienation.
break
;
* - When a component is mirrored, the text is not mirrored and justifications
* are complicated to calculate
case
GR_TEXT_VJUSTIFY_TOP
:
* so the more easily way is to use no justifications ( Centered text )
vjustify
=
GR_TEXT_VJUSTIFY_BOTTOM
;
* and use GetBoundaryBox to know the text coordinate considered as centered
break
;
*/
EDA_Rect
BoundaryBox
=
field
->
GetBoundaryBox
();
default
:
GRTextHorizJustifyType
hjustify
=
GR_TEXT_HJUSTIFY_CENTER
;
break
;
GRTextVertJustifyType
vjustify
=
GR_TEXT_VJUSTIFY_CENTER
;
}
wxPoint
textpos
=
BoundaryBox
.
Centre
();
}
int
thickness
=
field
->
GetPenSize
();
int
thickness
=
field
->
GetPenSize
();
if
(
!
IsMulti
||
(
FieldNumber
!=
REFERENCE
)
)
if
(
!
IsMulti
||
(
FieldNumber
!=
REFERENCE
)
)
{
{
plotter
->
text
(
textpos
,
color
,
field
->
m_Text
,
plotter
->
text
(
textpos
,
color
,
field
->
m_Text
,
orient
?
TEXT_ORIENT_VERT
:
TEXT_ORIENT_HORIZ
,
orient
,
field
->
m_Size
,
field
->
m_Size
,
hjustify
,
vjustify
,
hjustify
,
vjustify
,
thickness
,
field
->
m_Italic
,
field
->
m_Bold
);
thickness
,
field
->
m_Italic
,
field
->
m_Bold
);
...
@@ -208,7 +145,7 @@ static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
...
@@ -208,7 +145,7 @@ static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
#endif
#endif
Text
.
Append
(
unit_id
);
Text
.
Append
(
unit_id
);
plotter
->
text
(
textpos
,
color
,
Text
,
plotter
->
text
(
textpos
,
color
,
Text
,
orient
?
TEXT_ORIENT_VERT
:
TEXT_ORIENT_HORIZ
,
orient
,
field
->
m_Size
,
hjustify
,
vjustify
,
field
->
m_Size
,
hjustify
,
vjustify
,
thickness
,
field
->
m_Italic
,
field
->
m_Bold
);
thickness
,
field
->
m_Italic
,
field
->
m_Bold
);
}
}
...
...
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