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
23003001
Commit
23003001
authored
Dec 15, 2008
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor changes.
parent
829f5483
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
22 deletions
+23
-22
class_pad_draw_functions.cpp
pcbnew/class_pad_draw_functions.cpp
+13
-14
class_track.cpp
pcbnew/class_track.cpp
+10
-8
No files found.
pcbnew/class_pad_draw_functions.cpp
View file @
23003001
...
@@ -399,7 +399,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
...
@@ -399,7 +399,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
wxPoint
tpos0
=
wxPoint
(
ux0
,
uy0
);
// Position of the centre of text
wxPoint
tpos0
=
wxPoint
(
ux0
,
uy0
);
// Position of the centre of text
wxPoint
tpos
=
tpos0
;
wxPoint
tpos
=
tpos0
;
wxSize
AreaSize
;
// size of text area, normalized to AreaSize.y < AreaSize.x
wxSize
AreaSize
;
// size of text area, normalized to AreaSize.y < AreaSize.x
int
len
;
int
shortname_len
=
m_ShortNetname
.
Len
()
;
if
(
GetShape
()
==
PAD_CIRCLE
)
if
(
GetShape
()
==
PAD_CIRCLE
)
angle
=
0
;
angle
=
0
;
AreaSize
=
m_Size
;
AreaSize
=
m_Size
;
...
@@ -410,7 +410,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
...
@@ -410,7 +410,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
AreaSize
.
y
=
m_Size
.
x
;
AreaSize
.
y
=
m_Size
.
x
;
}
}
if
(
!
m_Netname
.
IsEmpty
()
)
// if there is a netname, provides room to display this netname
if
(
shortname_len
>
0
)
// if there is a netname, provides room to display this netname
{
{
AreaSize
.
y
/=
2
;
// Text used only the upper area of the pad. The lower area displays the net name
AreaSize
.
y
/=
2
;
// Text used only the upper area of the pad. The lower area displays the net name
tpos
.
y
-=
AreaSize
.
y
/
2
;
tpos
.
y
-=
AreaSize
.
y
/
2
;
...
@@ -424,32 +424,31 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
...
@@ -424,32 +424,31 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
NORMALIZE_ANGLE_90
(
t_angle
);
NORMALIZE_ANGLE_90
(
t_angle
);
/* Note: in next calculations, texte size is calculated for 3 or more chars.
/* Note: in next calculations, texte size is calculated for 3 or more chars.
Of course, pads n
i
mbers and nets names can have less than 3 chars.
Of course, pads n
u
mbers and nets names can have less than 3 chars.
but after some tries, i found this is gives the best look
but after some tries, i found this is gives the best look
*/
*/
#define MIN_CHAR_COUNT 3
#define MIN_CHAR_COUNT 3
wxString
buffer
;
wxString
buffer
;
ReturnStringPadName
(
buffer
);
ReturnStringPadName
(
buffer
);
len
=
buffer
.
Len
();
int
numpad_
len
=
buffer
.
Len
();
len
=
MAX
(
len
,
MIN_CHAR_COUNT
);
numpad_len
=
MAX
(
numpad_
len
,
MIN_CHAR_COUNT
);
int
tsize
=
min
(
AreaSize
.
y
,
AreaSize
.
x
/
len
);
int
tsize
=
min
(
AreaSize
.
y
,
AreaSize
.
x
/
numpad_
len
);
#define CHAR_SIZE_MIN 5
#define CHAR_SIZE_MIN 5
if
(
(
tsize
/
zoom
)
>=
CHAR_SIZE_MIN
)
// Not drawable
i
n size too small.
if
(
(
tsize
/
zoom
)
>=
CHAR_SIZE_MIN
)
// Not drawable
whe
n size too small.
{
{
tsize
=
(
int
)
(
tsize
*
0.8
);
// reserve room for marges and segments thickness
tsize
=
(
int
)
(
tsize
*
0.8
);
// reserve room for marges and segments thickness
DrawGraphicText
(
panel
,
DC
,
tpos
,
DrawGraphicText
(
panel
,
DC
,
tpos
,
WHITE
,
buffer
,
t_angle
,
wxSize
(
tsize
,
tsize
),
WHITE
,
buffer
,
t_angle
,
wxSize
(
tsize
,
tsize
),
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
tsize
/
8
);
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
tsize
/
7
);
}
}
// display the short netname
// display the short netnam, if exists
len
=
m_ShortNetname
.
Len
();
if
(
shortname_len
==
0
)
if
(
len
==
0
)
return
;
return
;
len
=
MAX
(
len
,
MIN_CHAR_COUNT
);
shortname_len
=
MAX
(
shortname_
len
,
MIN_CHAR_COUNT
);
tsize
=
min
(
AreaSize
.
y
,
AreaSize
.
x
/
len
);
tsize
=
min
(
AreaSize
.
y
,
AreaSize
.
x
/
shortname_
len
);
if
(
(
tsize
/
zoom
)
>=
CHAR_SIZE_MIN
)
// Not drawable in size too small.
if
(
(
tsize
/
zoom
)
>=
CHAR_SIZE_MIN
)
// Not drawable in size too small.
{
{
...
@@ -460,7 +459,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
...
@@ -460,7 +459,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
tsize
=
(
int
)
(
tsize
*
0.8
);
// reserve room for marges and segments thickness
tsize
=
(
int
)
(
tsize
*
0.8
);
// reserve room for marges and segments thickness
DrawGraphicText
(
panel
,
DC
,
tpos
,
DrawGraphicText
(
panel
,
DC
,
tpos
,
WHITE
,
m_ShortNetname
,
t_angle
,
wxSize
(
tsize
,
tsize
),
WHITE
,
m_ShortNetname
,
t_angle
,
wxSize
(
tsize
,
tsize
),
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
tsize
/
8
);
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
tsize
/
7
);
}
}
}
}
pcbnew/class_track.cpp
View file @
23003001
...
@@ -773,15 +773,17 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
...
@@ -773,15 +773,17 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
return
;
return
;
int
len
=
net
->
GetShortNetname
().
Len
();
int
len
=
net
->
GetShortNetname
().
Len
();
if
(
len
>
0
)
// calculate a good size for the text (fixed to 9 pixels, if possible)
{
// calculate a good size for the text
int
tsize
=
m_Width
/
len
;
int
tsize
=
m_Width
/
len
;
if
(
(
tsize
/
zoom
)
>=
6
)
if
(
(
tsize
/
zoom
)
>=
6
)
{
{
tsize
=
(
tsize
*
8
)
/
10
;
// small reduction to give a better look, inside via
tsize
=
(
tsize
*
8
)
/
10
;
// small reduction to give a better look, inside via
DrawGraphicText
(
panel
,
DC
,
m_Start
,
DrawGraphicText
(
panel
,
DC
,
m_Start
,
WHITE
,
net
->
GetShortNetname
(),
0
,
wxSize
(
tsize
,
tsize
),
WHITE
,
net
->
GetShortNetname
(),
0
,
wxSize
(
tsize
,
tsize
),
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
tsize
/
8
);
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
tsize
/
7
);
}
}
}
}
}
...
...
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