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
7988f2ca
Commit
7988f2ca
authored
May 05, 2009
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code cleanup
parent
b49c2d2b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
101 deletions
+74
-101
class_drawsheet.h
eeschema/class_drawsheet.h
+7
-0
class_hierarchical_PIN_sheet.cpp
eeschema/class_hierarchical_PIN_sheet.cpp
+47
-43
plot.cpp
eeschema/plot.cpp
+20
-58
No files found.
eeschema/class_drawsheet.h
View file @
7988f2ca
...
...
@@ -58,6 +58,13 @@ public:
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
#endif
/** function CreateGraphicShape
* Calculates the graphic shape (a polygon) associated to the text
* @param aCorner_list = list to fill with polygon corners coordinates
* @param Pos = Position of the shape
*/
void
CreateGraphicShape
(
std
::
vector
<
wxPoint
>&
aCorner_list
,
const
wxPoint
&
Pos
);
};
...
...
eeschema/class_hierarchical_PIN_sheet.cpp
View file @
7988f2ca
...
...
@@ -65,14 +65,11 @@ void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, con
{
GRTextHorizJustifyType
side
;
EDA_Colors
txtcolor
;
int
posx
,
tposx
,
posy
,
size2
;
wxSize
size
;
int
NbSegm
;
int
posx
,
tposx
,
posy
;
// @todo use wxPoints here
int
coord
[
20
];
static
std
::
vector
<
wxPoint
>
Poly
;
int
LineWidth
=
g_DrawMinimunLineWidth
;
int
LineWidth
=
g_DrawMinimunLineWidth
;
if
(
Color
>=
0
)
txtcolor
=
(
EDA_Colors
)
Color
;
...
...
@@ -80,9 +77,9 @@ void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, con
txtcolor
=
ReturnLayerColor
(
m_Layer
);
GRSetDrawMode
(
DC
,
DrawMode
);
posx
=
m_Pos
.
x
+
offset
.
x
;
posy
=
m_Pos
.
y
+
offset
.
y
;
size
=
m_Size
;
posx
=
m_Pos
.
x
+
offset
.
x
;
posy
=
m_Pos
.
y
+
offset
.
y
;
wxSize
size
=
m_Size
;
if
(
!
m_Text
.
IsEmpty
()
)
{
...
...
@@ -100,63 +97,70 @@ void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, con
m_Text
,
TEXT_ORIENT_HORIZ
,
size
,
side
,
GR_TEXT_VJUSTIFY_CENTER
,
LineWidth
,
false
,
true
);
}
/* dessin du symbole de connexion */
/* Draw the graphic symbol */
CreateGraphicShape
(
Poly
,
m_Pos
+
offset
);
int
FillShape
=
false
;
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
Poly
.
size
(),
&
Poly
[
0
],
FillShape
,
LineWidth
,
txtcolor
,
txtcolor
);
/* Poly Non rempli */
}
/** function CreateGraphicShape
* Calculates the graphic shape (a polygon) associated to the text
* @param aCorner_list = list to fill with polygon corners coordinates
* @param Pos = Position of the shape
*/
void
Hierarchical_PIN_Sheet_Struct
::
CreateGraphicShape
(
std
::
vector
<
wxPoint
>&
aCorner_list
,
const
wxPoint
&
Pos
)
{
wxSize
size
=
m_Size
;
aCorner_list
.
clear
();
if
(
m_Edge
)
{
size
.
x
=
-
size
.
x
;
size
.
y
=
-
size
.
y
;
}
coord
[
0
]
=
posx
;
coord
[
1
]
=
posy
;
size2
=
size
.
x
/
2
;
NbSegm
=
0
;
int
size2
=
size
.
x
/
2
;
aCorner_list
.
push_back
(
Pos
);
switch
(
m_Shape
)
{
case
0
:
/* input |> */
coord
[
2
]
=
posx
;
coord
[
3
]
=
posy
-
size2
;
coord
[
4
]
=
posx
+
size2
;
coord
[
5
]
=
posy
-
size2
;
coord
[
6
]
=
posx
+
size
.
x
;
coord
[
7
]
=
posy
;
coord
[
8
]
=
posx
+
size2
;
coord
[
9
]
=
posy
+
size2
;
coord
[
10
]
=
posx
;
coord
[
11
]
=
posy
+
size2
;
coord
[
12
]
=
coord
[
0
];
coord
[
13
]
=
coord
[
1
];
NbSegm
=
7
;
aCorner_list
.
push_back
(
wxPoint
(
Pos
.
x
,
Pos
.
y
-
size2
)
);
aCorner_list
.
push_back
(
wxPoint
(
Pos
.
x
+
size2
,
Pos
.
y
-
size2
)
);
aCorner_list
.
push_back
(
wxPoint
(
Pos
.
x
+
size
.
x
,
Pos
.
y
)
);
aCorner_list
.
push_back
(
wxPoint
(
Pos
.
x
+
size2
,
Pos
.
y
+
size2
)
);
aCorner_list
.
push_back
(
wxPoint
(
Pos
.
x
,
Pos
.
y
+
size2
)
);
aCorner_list
.
push_back
(
Pos
);
break
;
case
1
:
/* output <| */
coord
[
2
]
=
posx
+
size2
;
coord
[
3
]
=
posy
-
size2
;
coord
[
4
]
=
posx
+
size
.
x
;
coord
[
5
]
=
posy
-
size2
;
coord
[
6
]
=
posx
+
size
.
x
;
coord
[
7
]
=
posy
+
size2
;
coord
[
8
]
=
posx
+
size2
;
coord
[
9
]
=
posy
+
size2
;
coord
[
10
]
=
coord
[
0
];
coord
[
11
]
=
coord
[
1
];
NbSegm
=
6
;
aCorner_list
.
push_back
(
wxPoint
(
Pos
.
x
+
size2
,
Pos
.
y
-
size2
)
);
aCorner_list
.
push_back
(
wxPoint
(
Pos
.
x
+
size
.
x
,
Pos
.
y
-
size2
)
);
aCorner_list
.
push_back
(
wxPoint
(
Pos
.
x
+
size
.
x
,
Pos
.
y
+
size2
)
);
aCorner_list
.
push_back
(
wxPoint
(
Pos
.
x
+
size2
,
Pos
.
y
+
size2
)
);
aCorner_list
.
push_back
(
Pos
);
break
;
case
2
:
/* bidi <> */
case
3
:
/* TriSt <> */
coord
[
2
]
=
posx
+
size2
;
coord
[
3
]
=
posy
-
size2
;
coord
[
4
]
=
posx
+
size
.
x
;
coord
[
5
]
=
posy
;
coord
[
6
]
=
posx
+
size2
;
coord
[
7
]
=
posy
+
size2
;
coord
[
8
]
=
coord
[
0
];
coord
[
9
]
=
coord
[
1
];
NbSegm
=
5
;
aCorner_list
.
push_back
(
wxPoint
(
Pos
.
x
+
size2
,
Pos
.
y
-
size2
)
);
aCorner_list
.
push_back
(
wxPoint
(
Pos
.
x
+
size
.
x
,
Pos
.
y
)
);
aCorner_list
.
push_back
(
wxPoint
(
Pos
.
x
+
size2
,
Pos
.
y
+
size2
)
);
aCorner_list
.
push_back
(
Pos
);
break
;
default
:
/* unsp []*/
coord
[
2
]
=
posx
;
coord
[
3
]
=
posy
-
size2
;
coord
[
4
]
=
posx
+
size
.
x
;
coord
[
5
]
=
posy
-
size2
;
coord
[
6
]
=
posx
+
size
.
x
;
coord
[
7
]
=
posy
+
size2
;
coord
[
8
]
=
posx
;
coord
[
9
]
=
posy
+
size2
;
coord
[
10
]
=
coord
[
0
];
coord
[
11
]
=
coord
[
1
];
NbSegm
=
6
;
aCorner_list
.
push_back
(
wxPoint
(
Pos
.
x
,
Pos
.
y
-
size2
)
);
aCorner_list
.
push_back
(
wxPoint
(
Pos
.
x
+
size
.
x
,
Pos
.
y
-
size2
)
);
aCorner_list
.
push_back
(
wxPoint
(
Pos
.
x
+
size
.
x
,
Pos
.
y
+
size2
)
);
aCorner_list
.
push_back
(
wxPoint
(
Pos
.
x
,
Pos
.
y
+
size2
)
);
aCorner_list
.
push_back
(
Pos
);
break
;
}
int
FillShape
=
FALSE
;
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
NbSegm
,
(
wxPoint
*
)
coord
,
FillShape
,
LineWidth
,
txtcolor
,
txtcolor
);
/* Poly Non rempli */
}
...
...
eeschema/plot.cpp
View file @
7988f2ca
...
...
@@ -17,7 +17,7 @@
#include "protos.h"
/* Local Variables : */
static
void
Plot
SheetLabelStruc
t
(
Hierarchical_PIN_Sheet_Struct
*
Struct
);
static
void
Plot
_Hierarchical_PIN_Shee
t
(
Hierarchical_PIN_Sheet_Struct
*
Struct
);
static
void
PlotTextField
(
SCH_COMPONENT
*
DrawLibItem
,
int
FieldNumber
,
int
IsMulti
,
int
DrawMode
);
static
void
PlotPinSymbol
(
const
wxPoint
&
pos
,
int
len
,
int
orient
,
int
Shape
);
...
...
@@ -747,21 +747,24 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
}
/***********************************************************************/
static
void
PlotSheetLabelStruct
(
Hierarchical_PIN_Sheet_Struct
*
Struct
)
/***********************************************************************/
/* Routine de dessin des Sheet Labels type hierarchie */
/*****************************************************************************************/
static
void
Plot_Hierarchical_PIN_Sheet
(
Hierarchical_PIN_Sheet_Struct
*
aHierarchical_PIN
)
/****************************************************************************************/
/* Plot a Hierarchical_PIN_Sheet
*/
{
EDA_Colors
txtcolor
=
UNSPECIFIED_COLOR
;
int
posx
,
tposx
,
posy
,
size
,
size2
;
int
coord
[
16
]
;
int
posx
,
tposx
,
posy
,
size
;
static
std
::
vector
<
wxPoint
>
Poly
;
if
(
(
g_PlotFormat
==
PLOT_FORMAT_POST
)
&&
g_PlotPSColorOpt
)
txtcolor
=
ReturnLayerColor
(
Struct
->
GetLayer
()
);
txtcolor
=
ReturnLayerColor
(
aHierarchical_PIN
->
GetLayer
()
);
posx
=
Struct
->
m_Pos
.
x
;
posy
=
Struct
->
m_Pos
.
y
;
size
=
Struct
->
m_Size
.
x
;
posx
=
aHierarchical_PIN
->
m_Pos
.
x
;
posy
=
aHierarchical_PIN
->
m_Pos
.
y
;
size
=
aHierarchical_PIN
->
m_Size
.
x
;
GRTextHorizJustifyType
side
;
if
(
Struct
->
m_Edge
)
if
(
aHierarchical_PIN
->
m_Edge
)
{
tposx
=
posx
-
size
;
side
=
GR_TEXT_HJUSTIFY_RIGHT
;
...
...
@@ -771,61 +774,20 @@ static void PlotSheetLabelStruct( Hierarchical_PIN_Sheet_Struct* Struct )
tposx
=
posx
+
size
+
(
size
/
8
);
side
=
GR_TEXT_HJUSTIFY_LEFT
;
}
int
thickness
=
Struct
->
m_Width
;
int
thickness
=
aHierarchical_PIN
->
m_Width
;
if
(
thickness
==
0
)
thickness
=
MAX
(
g_PlotLine_Width
,
g_DrawMinimunLineWidth
);
SetCurrentLineWidth
(
thickness
);
bool
italic
=
Struct
->
m_Italic
;
PlotGraphicText
(
g_PlotFormat
,
wxPoint
(
tposx
,
posy
),
txtcolor
,
Struct
->
m_Text
,
TEXT_ORIENT_HORIZ
,
wxSize
(
size
,
size
),
aHierarchical_PIN
->
m_Text
,
TEXT_ORIENT_HORIZ
,
wxSize
(
size
,
size
),
side
,
GR_TEXT_VJUSTIFY_CENTER
,
thickness
,
italic
,
true
);
/* dessin du symbole de connexion */
if
(
Struct
->
m_Edge
)
size
=
-
size
;
coord
[
0
]
=
posx
;
coord
[
1
]
=
posy
;
size2
=
size
/
2
;
switch
(
Struct
->
m_Shape
)
{
case
0
:
/* input |> */
coord
[
2
]
=
posx
;
coord
[
3
]
=
posy
-
size2
;
coord
[
4
]
=
posx
+
size2
;
coord
[
5
]
=
posy
-
size2
;
coord
[
6
]
=
posx
+
size
;
coord
[
7
]
=
posy
;
coord
[
8
]
=
posx
+
size2
;
coord
[
9
]
=
posy
+
size2
;
coord
[
10
]
=
posx
;
coord
[
11
]
=
posy
+
size2
;
coord
[
12
]
=
posx
;
coord
[
13
]
=
posy
;
PlotPoly
(
7
,
coord
,
NOFILL
);
break
;
thickness
,
aHierarchical_PIN
->
m_Italic
,
true
);
case
1
:
/* output <| */
coord
[
2
]
=
posx
+
size2
;
coord
[
3
]
=
posy
-
size2
;
coord
[
4
]
=
posx
+
size
;
coord
[
5
]
=
posy
-
size2
;
coord
[
6
]
=
posx
+
size
;
coord
[
7
]
=
posy
+
size2
;
coord
[
8
]
=
posx
+
size2
;
coord
[
9
]
=
posy
+
size2
;
coord
[
10
]
=
posx
;
coord
[
11
]
=
posy
;
PlotPoly
(
6
,
coord
,
NOFILL
);
break
;
case
2
:
/* bidi <> */
case
3
:
/* TriSt <> */
coord
[
2
]
=
posx
+
size2
;
coord
[
3
]
=
posy
-
size2
;
coord
[
4
]
=
posx
+
size
;
coord
[
5
]
=
posy
;
coord
[
6
]
=
posx
+
size2
;
coord
[
7
]
=
posy
+
size2
;
coord
[
8
]
=
posx
;
coord
[
9
]
=
posy
;
PlotPoly
(
5
,
coord
,
NOFILL
);
break
;
/* Draw the associated graphic symbol */
aHierarchical_PIN
->
CreateGraphicShape
(
Poly
,
aHierarchical_PIN
->
m_Pos
);
default
:
/* unsp []*/
coord
[
2
]
=
posx
;
coord
[
3
]
=
posy
-
size2
;
coord
[
4
]
=
posx
+
size
;
coord
[
5
]
=
posy
-
size2
;
coord
[
6
]
=
posx
+
size
;
coord
[
7
]
=
posy
+
size2
;
coord
[
8
]
=
posx
;
coord
[
9
]
=
posy
+
size2
;
coord
[
10
]
=
posx
;
coord
[
11
]
=
posy
;
PlotPoly
(
6
,
coord
,
NOFILL
);
break
;
}
PlotPoly
(
Poly
.
size
(),
&
Poly
[
0
].
x
,
NOFILL
);
}
...
...
@@ -895,7 +857,7 @@ void PlotSheetStruct( DrawSheetStruct* Struct )
while
(
SheetLabelStruct
!=
NULL
)
{
Plot
SheetLabelStruc
t
(
SheetLabelStruct
);
Plot
_Hierarchical_PIN_Shee
t
(
SheetLabelStruct
);
SheetLabelStruct
=
SheetLabelStruct
->
Next
();
}
}
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