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
d3dc65b6
Commit
d3dc65b6
authored
May 29, 2009
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minot changes
parent
866d5c3a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
15 deletions
+14
-15
base_struct.cpp
common/base_struct.cpp
+1
-1
drawtxt.cpp
common/drawtxt.cpp
+6
-6
class_pin.cpp
eeschema/class_pin.cpp
+2
-7
drawtxt.h
include/drawtxt.h
+5
-1
No files found.
common/base_struct.cpp
View file @
d3dc65b6
...
@@ -193,7 +193,7 @@ EDA_TextStruct::~EDA_TextStruct()
...
@@ -193,7 +193,7 @@ EDA_TextStruct::~EDA_TextStruct()
*/
*/
int
EDA_TextStruct
::
LenSize
(
const
wxString
&
aLine
)
const
int
EDA_TextStruct
::
LenSize
(
const
wxString
&
aLine
)
const
{
{
return
TextWidth
(
aLine
,
m_Size
.
x
,
m_Italic
,
m_Bold
)
+
m_Width
;
return
ReturnGraphic
TextWidth
(
aLine
,
m_Size
.
x
,
m_Italic
,
m_Bold
)
+
m_Width
;
}
}
...
...
common/drawtxt.cpp
View file @
d3dc65b6
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
#define EDA_DRAWBASE
#define EDA_DRAWBASE
#include "hershey_fonts.h"
#include "hershey_fonts.h"
#define HERSHEY_SIZE 32.0
#define HERSHEY_SIZE 32.0
// size factor used to calculate actual size of shapes from hershey fonts
/* Functions to draw / plot a string.
/* Functions to draw / plot a string.
* texts have only one line.
* texts have only one line.
...
@@ -67,7 +67,7 @@ static const char* get_hershey_recipe( int AsciiCode, bool bold )
...
@@ -67,7 +67,7 @@ static const char* get_hershey_recipe( int AsciiCode, bool bold )
}
}
int
TextWidth
(
const
wxString
&
aText
,
int
size_h
,
bool
italic
,
bool
bold
)
int
ReturnGraphicTextWidth
(
const
wxString
&
aText
,
int
aXSize
,
bool
italic
,
bool
bold
)
{
{
int
tally
=
0
;
int
tally
=
0
;
int
char_count
=
aText
.
length
();
int
char_count
=
aText
.
length
();
...
@@ -85,13 +85,13 @@ int TextWidth( const wxString& aText, int size_h, bool italic, bool bold )
...
@@ -85,13 +85,13 @@ int TextWidth( const wxString& aText, int size_h, bool italic, bool bold )
/* Get metrics */
/* Get metrics */
int
xsta
=
*
ptcar
++
-
'R'
;
int
xsta
=
*
ptcar
++
-
'R'
;
int
xsto
=
*
ptcar
++
-
'R'
;
int
xsto
=
*
ptcar
++
-
'R'
;
tally
+=
wxRound
(
size_h
*
(
xsto
-
xsta
)
/
HERSHEY_SIZE
);
tally
+=
wxRound
(
aXSize
*
(
xsto
-
xsta
)
/
HERSHEY_SIZE
);
}
}
/* Italic correction, 1/8em */
/* Italic correction, 1/8em */
if
(
italic
)
if
(
italic
)
{
{
tally
+=
wxRound
(
size_h
*
0.125
);
tally
+=
wxRound
(
aXSize
*
0.125
);
}
}
return
tally
;
return
tally
;
}
}
...
@@ -130,7 +130,7 @@ static void DrawGraphicTextPline(
...
@@ -130,7 +130,7 @@ static void DrawGraphicTextPline(
static
int
overbar_position
(
int
size_v
,
int
thickness
)
static
int
overbar_position
(
int
size_v
,
int
thickness
)
{
{
return
wxRound
(
(
double
)
size_v
*
30.0
/
HERSHEY_SIZE
+
(
double
)
thickness
);
return
wxRound
(
(
(
double
)
size_v
*
26
/
HERSHEY_SIZE
)
+
((
double
)
thickness
*
1.5
)
);
}
}
...
@@ -228,7 +228,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
...
@@ -228,7 +228,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
current_char_pos
=
aPos
;
current_char_pos
=
aPos
;
dx
=
TextWidth
(
aText
,
size_h
,
aItalic
,
aBold
);
dx
=
ReturnGraphic
TextWidth
(
aText
,
size_h
,
aItalic
,
aBold
);
dy
=
size_v
;
dy
=
size_v
;
/* Do not draw the text if out of draw area! */
/* Do not draw the text if out of draw area! */
...
...
eeschema/class_pin.cpp
View file @
d3dc65b6
...
@@ -456,7 +456,6 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
...
@@ -456,7 +456,6 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
int
x
,
y
,
x1
,
y1
;
int
x
,
y
,
x1
,
y1
;
wxString
StringPinNum
;
wxString
StringPinNum
;
EDA_Colors
NameColor
,
NumColor
;
EDA_Colors
NameColor
,
NumColor
;
int
PinTxtLen
;
wxSize
PinNameSize
(
m_PinNameSize
,
m_PinNameSize
);
wxSize
PinNameSize
(
m_PinNameSize
,
m_PinNameSize
);
wxSize
PinNumSize
(
m_PinNumSize
,
m_PinNumSize
);
wxSize
PinNumSize
(
m_PinNumSize
,
m_PinNumSize
);
...
@@ -491,9 +490,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
...
@@ -491,9 +490,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
x1
+=
m_PinLen
;
break
;
x1
+=
m_PinLen
;
break
;
}
}
PinTxtLen
=
TextWidth
(
m_PinName
,
PinNameSize
.
x
,
false
,
false
)
+
LineWidth
;
if
(
m_PinName
.
IsEmpty
()
)
if
(
PinTxtLen
==
0
)
DrawPinName
=
FALSE
;
DrawPinName
=
FALSE
;
if
(
TextInside
)
/* Draw the text inside, but the pin numbers outside. */
if
(
TextInside
)
/* Draw the text inside, but the pin numbers outside. */
...
@@ -658,7 +655,6 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
...
@@ -658,7 +655,6 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
int
x
,
y
,
x1
,
y1
;
int
x
,
y
,
x1
,
y1
;
wxString
StringPinNum
;
wxString
StringPinNum
;
EDA_Colors
NameColor
,
NumColor
;
EDA_Colors
NameColor
,
NumColor
;
int
PinTxtLen
=
0
;
wxSize
PinNameSize
=
wxSize
(
m_PinNameSize
,
m_PinNameSize
);
wxSize
PinNameSize
=
wxSize
(
m_PinNameSize
,
m_PinNameSize
);
wxSize
PinNumSize
=
wxSize
(
m_PinNumSize
,
m_PinNumSize
);
wxSize
PinNumSize
=
wxSize
(
m_PinNumSize
,
m_PinNumSize
);
bool
plot_color
=
(
g_PlotFormat
==
PLOT_FORMAT_POST
)
bool
plot_color
=
(
g_PlotFormat
==
PLOT_FORMAT_POST
)
...
@@ -687,8 +683,7 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
...
@@ -687,8 +683,7 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
x1
+=
m_PinLen
;
break
;
x1
+=
m_PinLen
;
break
;
}
}
PinTxtLen
=
TextWidth
(
m_PinName
,
PinNameSize
.
x
,
false
,
false
)
+
aWidth
;
if
(
m_PinName
.
IsEmpty
()
)
if
(
PinTxtLen
==
0
)
DrawPinName
=
FALSE
;
DrawPinName
=
FALSE
;
if
(
TextInside
)
/* Draw the text inside, but the pin numbers outside. */
if
(
TextInside
)
/* Draw the text inside, but the pin numbers outside. */
...
...
include/drawtxt.h
View file @
d3dc65b6
...
@@ -9,7 +9,11 @@
...
@@ -9,7 +9,11 @@
class
WinEDA_DrawPanel
;
class
WinEDA_DrawPanel
;
int
TextWidth
(
const
wxString
&
aText
,
int
size_h
,
bool
italic
,
bool
bold
);
/** Function ReturnGraphicTextWidth
* @return the X size of the graphic text
* the full X size is ReturnGraphicTextWidth + the thickness of graphic lines
*/
int
ReturnGraphicTextWidth
(
const
wxString
&
aText
,
int
size_h
,
bool
italic
,
bool
bold
);
/** Function NegableTextLength
/** Function NegableTextLength
* Return the text length of a negable string, excluding the ~ markers */
* Return the text length of a negable string, excluding the ~ markers */
...
...
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