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
5fda7bf3
Commit
5fda7bf3
authored
Apr 09, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Netnames and pad numbers are displayed on pads (using GAL)
parent
d400a250
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
83 additions
and
9 deletions
+83
-9
layers_id_colors_and_visibility.h
include/layers_id_colors_and_visibility.h
+1
-0
basepcbframe.cpp
pcbnew/basepcbframe.cpp
+1
-0
class_pad.cpp
pcbnew/class_pad.cpp
+8
-5
pcb_painter.cpp
pcbnew/pcb_painter.cpp
+70
-4
pcb_painter.h
pcbnew/pcb_painter.h
+3
-0
No files found.
include/layers_id_colors_and_visibility.h
View file @
5fda7bf3
...
@@ -147,6 +147,7 @@ enum PCB_VISIBLE
...
@@ -147,6 +147,7 @@ enum PCB_VISIBLE
PADS_VISIBLE
,
PADS_VISIBLE
,
VIA_HOLES_VISIBLE
,
VIA_HOLES_VISIBLE
,
PAD_HOLES_VISIBLE
,
PAD_HOLES_VISIBLE
,
NETNAME_VISIBLE
,
END_PCB_VISIBLE_LIST
// sentinel
END_PCB_VISIBLE_LIST
// sentinel
};
};
...
...
pcbnew/basepcbframe.cpp
View file @
5fda7bf3
...
@@ -95,6 +95,7 @@ const int m_galLayerOrder[] =
...
@@ -95,6 +95,7 @@ const int m_galLayerOrder[] =
ITEM_GAL_LAYER
(
MOD_REFERENCES_VISIBLE
),
ITEM_GAL_LAYER
(
MOD_VALUES_VISIBLE
),
ITEM_GAL_LAYER
(
MOD_REFERENCES_VISIBLE
),
ITEM_GAL_LAYER
(
MOD_VALUES_VISIBLE
),
SILKSCREEN_N_FRONT
,
SOLDERPASTE_N_FRONT
,
ADHESIVE_N_FRONT
,
SOLDERMASK_N_FRONT
,
SILKSCREEN_N_FRONT
,
SOLDERPASTE_N_FRONT
,
ADHESIVE_N_FRONT
,
SOLDERMASK_N_FRONT
,
ITEM_GAL_LAYER
(
NETNAME_VISIBLE
),
ITEM_GAL_LAYER
(
VIA_HOLES_VISIBLE
),
ITEM_GAL_LAYER
(
PAD_HOLES_VISIBLE
),
ITEM_GAL_LAYER
(
VIA_HOLES_VISIBLE
),
ITEM_GAL_LAYER
(
PAD_HOLES_VISIBLE
),
ITEM_GAL_LAYER
(
VIAS_VISIBLE
),
ITEM_GAL_LAYER
(
PADS_VISIBLE
),
ITEM_GAL_LAYER
(
VIAS_VISIBLE
),
ITEM_GAL_LAYER
(
PADS_VISIBLE
),
...
...
pcbnew/class_pad.cpp
View file @
5fda7bf3
...
@@ -852,18 +852,21 @@ EDA_ITEM* D_PAD::Clone() const
...
@@ -852,18 +852,21 @@ EDA_ITEM* D_PAD::Clone() const
void
D_PAD
::
ViewGetLayers
(
int
aLayers
[],
int
&
aCount
)
const
void
D_PAD
::
ViewGetLayers
(
int
aLayers
[],
int
&
aCount
)
const
{
{
// Pad description layer (number / net)
aLayers
[
0
]
=
ITEM_GAL_LAYER
(
NETNAME_VISIBLE
);
if
(
m_Attribute
==
PAD_SMD
||
m_Attribute
==
PAD_CONN
)
if
(
m_Attribute
==
PAD_SMD
||
m_Attribute
==
PAD_CONN
)
{
{
// Single layer pad (smd) without hole
// Single layer pad (smd) without hole
aLayers
[
0
]
=
GetParent
()
->
GetLayer
();
aLayers
[
1
]
=
GetParent
()
->
GetLayer
();
aCount
=
1
;
aCount
=
2
;
}
}
else
else
{
{
// Multi layer pad with hole - pad is shown on one common layer, hole on the other
// Multi layer pad with hole - pad is shown on one common layer, hole on the other
aLayers
[
0
]
=
ITEM_GAL_LAYER
(
PADS_VISIBLE
);
aLayers
[
1
]
=
ITEM_GAL_LAYER
(
PADS_VISIBLE
);
aLayers
[
1
]
=
ITEM_GAL_LAYER
(
PAD_HOLES_VISIBLE
);
aLayers
[
2
]
=
ITEM_GAL_LAYER
(
PAD_HOLES_VISIBLE
);
aCount
=
2
;
aCount
=
3
;
}
}
}
}
...
...
pcbnew/pcb_painter.cpp
View file @
5fda7bf3
...
@@ -71,6 +71,7 @@ void PCB_RENDER_SETTINGS::ImportLegacyColors( COLORS_DESIGN_SETTINGS* aSettings
...
@@ -71,6 +71,7 @@ void PCB_RENDER_SETTINGS::ImportLegacyColors( COLORS_DESIGN_SETTINGS* aSettings
m_itemColors
[
PAD_HOLES_VISIBLE
]
=
COLOR4D
(
0.0
,
0.5
,
0.5
,
1.0
);
m_itemColors
[
PAD_HOLES_VISIBLE
]
=
COLOR4D
(
0.0
,
0.5
,
0.5
,
1.0
);
m_itemColors
[
VIAS_VISIBLE
]
=
COLOR4D
(
0.7
,
0.7
,
0.7
,
1.0
);
m_itemColors
[
VIAS_VISIBLE
]
=
COLOR4D
(
0.7
,
0.7
,
0.7
,
1.0
);
m_itemColors
[
PADS_VISIBLE
]
=
COLOR4D
(
0.7
,
0.7
,
0.7
,
1.0
);
m_itemColors
[
PADS_VISIBLE
]
=
COLOR4D
(
0.7
,
0.7
,
0.7
,
1.0
);
m_itemColors
[
NETNAME_VISIBLE
]
=
COLOR4D
(
0.9
,
0.9
,
0.9
,
1.0
);
Update
();
Update
();
}
}
...
@@ -111,6 +112,8 @@ void PCB_RENDER_SETTINGS::Update()
...
@@ -111,6 +112,8 @@ void PCB_RENDER_SETTINGS::Update()
}
}
const
double
PCB_PAINTER
::
MAX_FONT_SIZE
=
1500000
;
PCB_PAINTER
::
PCB_PAINTER
(
GAL
*
aGal
)
:
PCB_PAINTER
::
PCB_PAINTER
(
GAL
*
aGal
)
:
PAINTER
(
aGal
)
PAINTER
(
aGal
)
{
{
...
@@ -307,11 +310,78 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
...
@@ -307,11 +310,78 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
{
{
COLOR4D
color
;
COLOR4D
color
;
VECTOR2D
size
;
VECTOR2D
size
;
VECTOR2D
position
(
aPad
->
GetPosition
()
);
PAD_SHAPE_T
shape
;
PAD_SHAPE_T
shape
;
double
m
,
n
;
double
m
,
n
;
double
orientation
=
aPad
->
GetOrientation
();
NORMALIZE_ANGLE_90
(
orientation
);
// do not display descriptions upside down
orientation
=
orientation
*
M_PI
/
1800.0
;
color
=
getLayerColor
(
aLayer
,
aPad
->
GetNet
()
);
color
=
getLayerColor
(
aLayer
,
aPad
->
GetNet
()
);
// Draw description layer
if
(
aLayer
==
ITEM_GAL_LAYER
(
NETNAME_VISIBLE
)
)
{
size
=
VECTOR2D
(
aPad
->
GetSize
()
/
2
);
// Font size limits
if
(
size
.
x
>
MAX_FONT_SIZE
)
size
.
x
=
MAX_FONT_SIZE
;
if
(
size
.
y
>
MAX_FONT_SIZE
)
size
.
y
=
MAX_FONT_SIZE
;
// Keep the size ratio for the font, but make it smaller
if
(
size
.
x
<
size
.
y
)
{
orientation
-=
M_PI
/
2
;
size
.
y
=
size
.
x
*
4.0
/
3.0
;
}
else
{
size
.
x
=
size
.
y
*
3.0
/
4.0
;
}
m_gal
->
Save
();
m_gal
->
Translate
(
position
);
m_gal
->
Rotate
(
-
orientation
);
// Default font settings
m_stroke_font
->
SetHorizontalJustify
(
GR_TEXT_HJUSTIFY_CENTER
);
m_stroke_font
->
SetVerticalJustify
(
GR_TEXT_VJUSTIFY_CENTER
);
m_stroke_font
->
SetBold
(
false
);
m_stroke_font
->
SetItalic
(
false
);
m_stroke_font
->
SetMirrored
(
false
);
m_gal
->
SetStrokeColor
(
color
);
// Let's make some space for a netname too, if there's one to display
if
(
!
aPad
->
GetNetname
().
empty
()
)
{
size
=
size
/
2.0
;
m_stroke_font
->
SetGlyphSize
(
size
);
m_gal
->
SetLineWidth
(
size
.
y
/
10.0
);
m_stroke_font
->
Draw
(
std
::
string
(
aPad
->
GetNetname
().
mb_str
()
),
VECTOR2D
(
0
,
size
.
y
),
0.0
);
m_gal
->
Translate
(
VECTOR2D
(
0.0
,
-
size
.
y
/
2.0
)
);
}
else
{
// In case when there's no netname assigned
m_stroke_font
->
SetGlyphSize
(
size
);
m_gal
->
SetLineWidth
(
size
.
y
/
10.0
);
}
m_stroke_font
->
Draw
(
std
::
string
(
aPad
->
GetPadName
().
mb_str
()
),
VECTOR2D
(
0
,
0
),
0.0
);
m_gal
->
Restore
();
return
;
}
// Pad/hole drawing
m_gal
->
Save
();
m_gal
->
Translate
(
position
);
m_gal
->
Rotate
(
-
orientation
);
if
(
m_pcbSettings
->
m_sketchModeSelect
[
PADS_VISIBLE
]
)
if
(
m_pcbSettings
->
m_sketchModeSelect
[
PADS_VISIBLE
]
)
{
{
// Outline mode
// Outline mode
...
@@ -330,10 +400,6 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
...
@@ -330,10 +400,6 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
m_gal
->
SetFillColor
(
color
);
m_gal
->
SetFillColor
(
color
);
}
}
m_gal
->
Save
();
m_gal
->
Translate
(
VECTOR2D
(
aPad
->
GetPosition
()
)
);
m_gal
->
Rotate
(
-
aPad
->
GetOrientation
()
*
M_PI
/
1800.0
);
// orientation is in tenths of degree
// Choose drawing settings depending on if we are drawing a pad itself or a hole
// Choose drawing settings depending on if we are drawing a pad itself or a hole
if
(
aLayer
==
ITEM_GAL_LAYER
(
PAD_HOLES_VISIBLE
)
)
if
(
aLayer
==
ITEM_GAL_LAYER
(
PAD_HOLES_VISIBLE
)
)
{
{
...
...
pcbnew/pcb_painter.h
View file @
5fda7bf3
...
@@ -151,6 +151,9 @@ protected:
...
@@ -151,6 +151,9 @@ protected:
void
draw
(
const
ZONE_CONTAINER
*
);
void
draw
(
const
ZONE_CONTAINER
*
);
void
draw
(
const
DIMENSION
*
);
void
draw
(
const
DIMENSION
*
);
void
draw
(
const
PCB_TARGET
*
);
void
draw
(
const
PCB_TARGET
*
);
/// Maximum font size for drawing descriptions
static
const
double
MAX_FONT_SIZE
;
};
};
}
// namespace KiGfx
}
// namespace KiGfx
...
...
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