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
beeaf53a
Commit
beeaf53a
authored
Dec 16, 2008
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleaning. Removed obscure code to draw texts
parent
de78cdb1
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
495 additions
and
633 deletions
+495
-633
3d_draw.cpp
3d-viewer/3d_draw.cpp
+61
-64
base_struct.cpp
common/base_struct.cpp
+50
-342
drawtxt.cpp
common/drawtxt.cpp
+63
-48
class_hierarchical_PIN_sheet.cpp
eeschema/class_hierarchical_PIN_sheet.cpp
+1
-1
class_sch_cmp_field.cpp
eeschema/class_sch_cmp_field.cpp
+6
-28
class_sch_cmp_field.h
eeschema/class_sch_cmp_field.h
+0
-1
classes_body_items.h
eeschema/classes_body_items.h
+92
-69
edit_component_in_lib.cpp
eeschema/edit_component_in_lib.cpp
+2
-2
eelibs_draw_components.cpp
eeschema/eelibs_draw_components.cpp
+52
-9
eelibs_read_libraryfiles.cpp
eeschema/eelibs_read_libraryfiles.cpp
+3
-3
load_one_schematic_file.cpp
eeschema/load_one_schematic_file.cpp
+2
-2
plot.cpp
eeschema/plot.cpp
+51
-8
base_struct.h
include/base_struct.h
+50
-38
common.h
include/common.h
+13
-2
block.cpp
pcbnew/block.cpp
+0
-3
class_pcb_text.cpp
pcbnew/class_pcb_text.cpp
+4
-4
class_track.cpp
pcbnew/class_track.cpp
+45
-2
cotation.cpp
pcbnew/cotation.cpp
+0
-3
pcbtexte.cpp
pcbnew/pcbtexte.cpp
+0
-4
No files found.
3d-viewer/3d_draw.cpp
View file @
beeaf53a
...
@@ -92,18 +92,18 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
...
@@ -92,18 +92,18 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
*/
*/
{
{
WinEDA_BasePcbFrame
*
pcbframe
=
m_Parent
->
m_Parent
;
WinEDA_BasePcbFrame
*
pcbframe
=
m_Parent
->
m_Parent
;
BOARD
*
pcb
=
pcbframe
->
m_Pcb
;
BOARD
*
pcb
=
pcbframe
->
m_Pcb
;
TRACK
*
track
;
TRACK
*
track
;
SEGZONE
*
segzone
;
SEGZONE
*
segzone
;
int
ii
;
int
ii
;
wxBusyCursor
dummy
;
wxBusyCursor
dummy
;
m_gllist
=
glGenLists
(
1
);
m_gllist
=
glGenLists
(
1
);
pcb
->
ComputeBoundaryBox
();
pcb
->
ComputeBoundaryBox
();
g_Parm_3D_Visu
.
m_BoardSettings
=
pcb
->
m_BoardSettings
;
g_Parm_3D_Visu
.
m_BoardSettings
=
pcb
->
m_BoardSettings
;
g_Parm_3D_Visu
.
m_BoardSize
=
pcb
->
m_BoundaryBox
.
GetSize
();
g_Parm_3D_Visu
.
m_BoardSize
=
pcb
->
m_BoundaryBox
.
GetSize
();
g_Parm_3D_Visu
.
m_BoardPos
=
pcb
->
m_BoundaryBox
.
Centre
();
g_Parm_3D_Visu
.
m_BoardPos
=
pcb
->
m_BoundaryBox
.
Centre
();
g_Parm_3D_Visu
.
m_BoardPos
.
y
=
-
g_Parm_3D_Visu
.
m_BoardPos
.
y
;
g_Parm_3D_Visu
.
m_BoardPos
.
y
=
-
g_Parm_3D_Visu
.
m_BoardPos
.
y
;
g_Parm_3D_Visu
.
m_Layers
=
pcb
->
m_BoardSettings
->
m_CopperLayerCount
;
g_Parm_3D_Visu
.
m_Layers
=
pcb
->
m_BoardSettings
->
m_CopperLayerCount
;
...
@@ -232,7 +232,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
...
@@ -232,7 +232,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
}
}
/* draw footprints */
/* draw footprints */
MODULE
*
Module
=
pcb
->
m_Modules
;
MODULE
*
Module
=
pcb
->
m_Modules
;
for
(
;
Module
!=
NULL
;
Module
=
Module
->
Next
()
)
for
(
;
Module
!=
NULL
;
Module
=
Module
->
Next
()
)
{
{
Module
->
Draw3D
(
this
);
Module
->
Draw3D
(
this
);
...
@@ -291,8 +291,8 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
...
@@ -291,8 +291,8 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
r
=
via
->
m_Width
*
g_Parm_3D_Visu
.
m_BoardScale
/
2
;
r
=
via
->
m_Width
*
g_Parm_3D_Visu
.
m_BoardScale
/
2
;
hole
=
via
->
GetDrillValue
();
hole
=
via
->
GetDrillValue
();
hole
*=
g_Parm_3D_Visu
.
m_BoardScale
/
2
;
hole
*=
g_Parm_3D_Visu
.
m_BoardScale
/
2
;
x
=
via
->
m_Start
.
x
*
g_Parm_3D_Visu
.
m_BoardScale
;
x
=
via
->
m_Start
.
x
*
g_Parm_3D_Visu
.
m_BoardScale
;
y
=
via
->
m_Start
.
y
*
g_Parm_3D_Visu
.
m_BoardScale
;
y
=
via
->
m_Start
.
y
*
g_Parm_3D_Visu
.
m_BoardScale
;
via
->
ReturnLayerPair
(
&
top_layer
,
&
bottom_layer
);
via
->
ReturnLayerPair
(
&
top_layer
,
&
bottom_layer
);
...
@@ -308,6 +308,7 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
...
@@ -308,6 +308,7 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
continue
;
continue
;
SetGLColor
(
color
);
SetGLColor
(
color
);
// SetGLColor( LIGHTGRAY );
// SetGLColor( LIGHTGRAY );
glNormal3f
(
0.0
,
0.0
,
(
layer
==
COPPER_LAYER_N
)
?
-
1.0
:
1.0
);
glNormal3f
(
0.0
,
0.0
,
(
layer
==
COPPER_LAYER_N
)
?
-
1.0
:
1.0
);
if
(
layer
==
COPPER_LAYER_N
)
if
(
layer
==
COPPER_LAYER_N
)
...
@@ -395,52 +396,48 @@ void Pcb3D_GLCanvas::Draw3D_DrawSegment( DRAWSEGMENT* segment )
...
@@ -395,52 +396,48 @@ void Pcb3D_GLCanvas::Draw3D_DrawSegment( DRAWSEGMENT* segment )
}
}
/*************************************************************/
/* function to draw 3D segments, called by DrawGraphicText
void
Pcb3D_GLCanvas
::
Draw3D_DrawText
(
TEXTE_PCB
*
text
)
* When DrawGraphicText is called to draw a text to an OpenGL DC
/*************************************************************/
* it calls Draw3dTextSegm to each segment to draw.
* 2 parameters used by Draw3D_FilledSegment are not handled by DrawGraphicText
* but are used in Draw3D_FilledSegment().
* they are 2 local variables. This is an ugly, but trivial code.
* Using DrawGraphicText to draw all texts ensure texts have the same shape
* in all contexts
*/
static
double
s_Text3DWidth
,
s_Text3DZPos
;
static
void
Draw3dTextSegm
(
int
x0
,
int
y0
,
int
xf
,
int
yf
)
{
{
int
layer
=
text
->
GetLayer
();
double
startx
=
x0
*
g_Parm_3D_Visu
.
m_BoardScale
;
double
x
,
y
,
xf
,
yf
;
double
starty
=
y0
*
g_Parm_3D_Visu
.
m_BoardScale
;
double
zpos
,
w
;
double
endx
=
xf
*
g_Parm_3D_Visu
.
m_BoardScale
;
int
color
=
g_Parm_3D_Visu
.
m_BoardSettings
->
m_LayerColor
[
layer
];
double
endy
=
yf
*
g_Parm_3D_Visu
.
m_BoardScale
;
#define BUFFSIZE 50
int
coord
[(
BUFFSIZE
+
2
)
*
2
];
int
ii
,
jj
,
kk
,
ll
,
nbpoints
;
if
(
Get3DLayerEnable
(
layer
)
)
Draw3D_FilledSegment
(
startx
,
-
starty
,
endx
,
-
endy
,
s_Text3DWidth
,
s_Text3DZPos
);
{
}
zpos
=
g_Parm_3D_Visu
.
m_LayerZcoord
[
layer
];
glNormal3f
(
0.0
,
0.0
,
Get3DLayerSide
(
layer
)
);
jj
=
5
;
ii
=
jj
+
1
;
while
(
ii
<
text
->
m_TextDrawingsSize
)
{
nbpoints
=
text
->
m_TextDrawings
[
jj
];
if
(
nbpoints
>
BUFFSIZE
)
nbpoints
=
BUFFSIZE
;
for
(
kk
=
0
,
ll
=
0
;
(
kk
<
nbpoints
)
&&
(
ii
<
text
->
m_TextDrawingsSize
);
kk
++
)
{
coord
[
ll
++
]
=
text
->
m_TextDrawings
[
ii
++
]
+
text
->
m_Pos
.
x
;
coord
[
ll
++
]
=
text
->
m_TextDrawings
[
ii
++
]
+
text
->
m_Pos
.
y
;
}
jj
=
ii
++
;
/*************************************************************/
void
Pcb3D_GLCanvas
::
Draw3D_DrawText
(
TEXTE_PCB
*
text
)
/*************************************************************/
{
if
(
!
Get3DLayerEnable
(
layer
)
)
return
;
int
layer
=
text
->
GetLayer
();
int
color
=
g_Parm_3D_Visu
.
m_BoardSettings
->
m_LayerColor
[
layer
];
for
(
kk
=
0
,
ll
=
0
;
kk
<
(
nbpoints
-
1
);
kk
++
,
ll
+=
2
)
{
SetGLColor
(
color
);
w
=
text
->
m_Width
*
g_Parm_3D_Visu
.
m_BoardScale
;
x
=
coord
[
ll
]
*
g_Parm_3D_Visu
.
m_BoardScale
;
y
=
coord
[
ll
+
1
]
*
g_Parm_3D_Visu
.
m_BoardScale
;
xf
=
coord
[
ll
+
2
]
*
g_Parm_3D_Visu
.
m_BoardScale
;
yf
=
coord
[
ll
+
3
]
*
g_Parm_3D_Visu
.
m_BoardScale
;
Draw3D_FilledSegment
(
x
,
-
y
,
xf
,
-
yf
,
w
,
zpos
);
SetGLColor
(
color
);
}
s_Text3DZPos
=
g_Parm_3D_Visu
.
m_LayerZcoord
[
layer
];
}
s_Text3DWidth
=
text
->
m_Width
*
g_Parm_3D_Visu
.
m_BoardScale
;
}
glNormal3f
(
0.0
,
0.0
,
Get3DLayerSide
(
layer
)
);
DrawGraphicText
(
NULL
,
NULL
,
text
->
m_Pos
,
(
EDA_Colors
)
color
,
text
->
m_Text
,
text
->
m_Orient
,
text
->
m_Size
,
text
->
m_HJustify
,
text
->
m_VJustify
,
text
->
m_Width
,
text
->
m_Italic
,
Draw3dTextSegm
);
}
}
...
@@ -473,7 +470,7 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
...
@@ -473,7 +470,7 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
/* Draw module shape: 3D shape if exists (or module edge if not exists) */
/* Draw module shape: 3D shape if exists (or module edge if not exists) */
S3D_MASTER
*
Struct3D
=
m_3D_Drawings
;
S3D_MASTER
*
Struct3D
=
m_3D_Drawings
;
bool
As3dShape
=
FALSE
;
bool
As3dShape
=
FALSE
;
if
(
g_Parm_3D_Visu
.
m_Draw3DModule
)
if
(
g_Parm_3D_Visu
.
m_Draw3DModule
)
{
{
glPushMatrix
();
glPushMatrix
();
...
@@ -591,7 +588,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
...
@@ -591,7 +588,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
int
angle
,
delta_angle
;
int
angle
,
delta_angle
;
int
coord
[
4
][
2
];
int
coord
[
4
][
2
];
double
fcoord
[
8
][
2
],
f_hole_coord
[
8
][
2
];
double
fcoord
[
8
][
2
],
f_hole_coord
[
8
][
2
];
double
scale
;
double
scale
;
double
zpos
;
double
zpos
;
wxPoint
shape_pos
;
wxPoint
shape_pos
;
double
x
,
y
,
r
,
w
,
hole
,
holeX
,
holeY
;
double
x
,
y
,
r
,
w
,
hole
,
holeX
,
holeY
;
...
@@ -682,10 +679,10 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
...
@@ -682,10 +679,10 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
RotatePoint
(
&
delta_cx
,
&
delta_cy
,
angle
);
RotatePoint
(
&
delta_cx
,
&
delta_cy
,
angle
);
{
{
double
ox
,
oy
,
fx
,
fy
;
double
ox
,
oy
,
fx
,
fy
;
ox
=
(
double
)
(
ux0
+
delta_cx
)
*
scale
;
ox
=
(
double
)
(
ux0
+
delta_cx
)
*
scale
;
oy
=
(
double
)
(
uy0
+
delta_cy
)
*
scale
;
oy
=
(
double
)
(
uy0
+
delta_cy
)
*
scale
;
fx
=
(
double
)
(
ux0
-
delta_cx
)
*
scale
;
fx
=
(
double
)
(
ux0
-
delta_cx
)
*
scale
;
fy
=
(
double
)
(
uy0
-
delta_cy
)
*
scale
;
fy
=
(
double
)
(
uy0
-
delta_cy
)
*
scale
;
for
(
layer
=
FIRST_COPPER_LAYER
;
layer
<=
LAST_COPPER_LAYER
;
layer
++
)
for
(
layer
=
FIRST_COPPER_LAYER
;
layer
<=
LAST_COPPER_LAYER
;
layer
++
)
{
{
if
(
layer
&&
(
layer
==
nlmax
)
)
if
(
layer
&&
(
layer
==
nlmax
)
)
...
@@ -738,8 +735,8 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
...
@@ -738,8 +735,8 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
coord
[
ii
][
0
]
+=
ux0
;
coord
[
ii
][
0
]
+=
ux0
;
coord
[
ii
][
1
]
+=
uy0
;
coord
[
ii
][
1
]
+=
uy0
;
ll
=
ii
*
2
;
ll
=
ii
*
2
;
fcoord
[
ll
][
0
]
=
coord
[
ii
][
0
]
*
scale
;
fcoord
[
ll
][
0
]
=
coord
[
ii
][
0
]
*
scale
;
fcoord
[
ll
][
1
]
=
coord
[
ii
][
1
]
*
scale
;
fcoord
[
ll
][
1
]
=
coord
[
ii
][
1
]
*
scale
;
}
}
for
(
ii
=
0
;
ii
<
7
;
ii
+=
2
)
for
(
ii
=
0
;
ii
<
7
;
ii
+=
2
)
...
@@ -794,7 +791,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
...
@@ -794,7 +791,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
glEnd
();
glEnd
();
}
}
}
}
break
;
break
;
default
:
default
:
break
;
break
;
...
@@ -896,8 +893,8 @@ static void Draw3D_FilledSegment( double startx, double starty,
...
@@ -896,8 +893,8 @@ static void Draw3D_FilledSegment( double startx, double starty,
dy
=
endy
-
starty
;
dy
=
endy
-
starty
;
angle
=
(
int
)
(
(
atan2
(
dy
,
dx
)
*
1800
/
M_PI
)
+
0.5
);
angle
=
(
int
)
(
(
atan2
(
dy
,
dx
)
*
1800
/
M_PI
)
+
0.5
);
RotatePoint
(
&
dx
,
&
dy
,
angle
);
// apres rotation: dx = longueur du segment
RotatePoint
(
&
dx
,
&
dy
,
angle
);
// apres rotation: dx = longueur du segment
// dy = 0;
// dy = 0;
width
/=
2
;
width
/=
2
;
glBegin
(
GL_POLYGON
);
glBegin
(
GL_POLYGON
);
...
@@ -962,8 +959,8 @@ static void Draw3D_FilledSegmentWithHole( double startx,
...
@@ -962,8 +959,8 @@ static void Draw3D_FilledSegmentWithHole( double startx,
holey
-=
starty
;
holey
-=
starty
;
angle
=
(
int
)
(
(
atan2
(
endy
,
endx
)
*
1800
/
M_PI
)
+
0.5
);
angle
=
(
int
)
(
(
atan2
(
endy
,
endx
)
*
1800
/
M_PI
)
+
0.5
);
RotatePoint
(
&
endx
,
&
endy
,
angle
);
// apres rotation: endx = longueur du segment
RotatePoint
(
&
endx
,
&
endy
,
angle
);
// apres rotation: endx = longueur du segment
// endy = 0;
// endy = 0;
RotatePoint
(
&
holex
,
&
holey
,
angle
);
RotatePoint
(
&
holex
,
&
holey
,
angle
);
width
/=
2
;
width
/=
2
;
...
@@ -999,8 +996,8 @@ static void Draw3D_FilledSegmentWithHole( double startx,
...
@@ -999,8 +996,8 @@ static void Draw3D_FilledSegmentWithHole( double startx,
for
(
ii
=
0
;
ii
<=
8
;
ii
++
)
for
(
ii
=
0
;
ii
<=
8
;
ii
++
)
{
{
theta
=
-
ii
*
225
;
theta
=
-
ii
*
225
;
x
=
0.0
;
x
=
0.0
;
y
=
width
;
y
=
width
;
RotatePoint
(
&
x
,
&
y
,
-
angle
+
theta
);
RotatePoint
(
&
x
,
&
y
,
-
angle
+
theta
);
xin
=
0.0
;
xin
=
0.0
;
yin
=
holeradius
;
yin
=
holeradius
;
...
...
common/base_struct.cpp
View file @
beeaf53a
This diff is collapsed.
Click to expand it.
common/drawtxt.cpp
View file @
beeaf53a
...
@@ -23,25 +23,34 @@
...
@@ -23,25 +23,34 @@
/****************************************************************************************************/
/****************************************************************************************************/
void
DrawGraphicText
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
DC
,
void
DrawGraphicText
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
DC
,
const
wxPoint
&
aPos
,
enum
EDA_Colors
aColor
,
const
wxString
&
aText
,
const
wxPoint
&
aPos
,
EDA_Colors
aColor
,
const
wxString
&
aText
,
int
aOrient
,
const
wxSize
&
aSize
,
int
aH_justify
,
int
aV_justify
,
int
aWidth
)
int
aOrient
,
const
wxSize
&
aSize
,
enum
GRTextHorizJustifyType
aH_justify
,
enum
GRTextVertJustifyType
aV_justify
,
int
aWidth
,
bool
aItalic
,
void
(
*
aCallback
)
(
int
x0
,
int
y0
,
int
xf
,
int
yf
))
/****************************************************************************************************/
/****************************************************************************************************/
/** Function DrawGraphicText
/** Function DrawGraphicText
* Draw a graphic text (like module texts)
* Draw a graphic text (like module texts)
* Draw a graphic text (like module texts)
* @param aPanel = the current DrawPanel
* @param aPanel = the current DrawPanel
* @param aPos = text position (according to
aH_justify, aV
_justify)
* @param aPos = text position (according to
h_justify, v
_justify)
* @param aColor (enum EDA_Colors) = text color
* @param aColor (enum EDA_Colors) = text color
* @param aText = text to draw
* @param aText = text to draw
* @param aOrient = angle in 0.1 degree
* @param aOrient = angle in 0.1 degree
* @param aSize = text size (size.x or size.y can be < 0 for mirrored texts)
* @param aSize = text size (size.x or size.y can be < 0 for mirrored texts)
* @param aH_justify = horizontal justification (Left, center, right)
* @param aH_justify = horizontal justification (Left, center, right)
* @param aV_justify = vertical justification (bottom, center, top)
* @param aV_justify = vertical justification (bottom, center, top)
* @param aWidth = line aWidth (pen aWidth) (default = 0)
* @param aWidth = line width (pen width) (default = 0)
* if width < 0 : draw segments in sketch mode, width = abs(width)
* @param aItalic = true to simulate an italic font
* @param aCallback() = function called (if non null) to draw each segment.
* used only to draw 3D texts
*/
*/
{
{
int
ii
,
kk
,
nbchar
,
AsciiCode
,
endcar
;
int
ii
,
kk
,
char_count
,
AsciiCode
,
endcar
;
int
k1
,
k2
,
x0
,
y0
;
int
x0
,
y0
;
int
zoom
;
int
zoom
;
int
size_h
,
size_v
,
espacement
;
int
size_h
,
size_v
,
espacement
;
SH_CODE
f_cod
,
plume
=
'U'
;
SH_CODE
f_cod
,
plume
=
'U'
;
...
@@ -51,9 +60,12 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
...
@@ -51,9 +60,12 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
int
cX
,
cY
;
// Texte center
int
cX
,
cY
;
// Texte center
int
ox
,
oy
;
// Draw coordinates for the current char
int
ox
,
oy
;
// Draw coordinates for the current char
int
coord
[
100
];
// Buffer coordinate used to draw polylines (char shapes)
int
coord
[
100
];
// Buffer coordinate used to draw polylines (char shapes)
bool
sketch_mode
=
FALSE
;
bool
sketch_mode
=
false
;
zoom
=
aPanel
->
GetZoom
();
if
(
aPanel
)
zoom
=
aPanel
->
GetZoom
();
else
zoom
=
1
;
size_h
=
aSize
.
x
;
size_h
=
aSize
.
x
;
size_v
=
aSize
.
y
;
size_v
=
aSize
.
y
;
...
@@ -63,14 +75,20 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
...
@@ -63,14 +75,20 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
aWidth
=
-
aWidth
;
aWidth
=
-
aWidth
;
sketch_mode
=
TRUE
;
sketch_mode
=
TRUE
;
}
}
kk
=
0
;
kk
=
0
;
ptr
=
0
;
/* ptr = text index */
ptr
=
0
;
/* ptr = text index */
nbchar
=
aText
.
Len
();
char_count
=
aText
.
Len
();
if
(
nbchar
==
0
)
if
(
char_count
==
0
)
return
;
return
;
espacement
=
(
10
*
size_h
)
/
9
;
// this is the pitch between chars
espacement
=
(
10
*
size_h
)
/
9
;
// this is the pitch between chars
if
(
espacement
>
0
)
espacement
+=
ABS
(
aWidth
);
else
espacement
-=
ABS
(
aWidth
);
ox
=
cX
=
aPos
.
x
;
ox
=
cX
=
aPos
.
x
;
oy
=
cY
=
aPos
.
y
;
oy
=
cY
=
aPos
.
y
;
...
@@ -79,7 +97,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
...
@@ -79,7 +97,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
{
{
int
xm
,
ym
,
ll
,
xc
,
yc
;
int
xm
,
ym
,
ll
,
xc
,
yc
;
int
textsize
=
ABS
(
espacement
);
int
textsize
=
ABS
(
espacement
);
ll
=
(
textsize
*
nbchar
)
/
zoom
;
ll
=
(
textsize
*
char_count
)
/
zoom
;
xc
=
GRMapX
(
cX
);
xc
=
GRMapX
(
cX
);
yc
=
GRMapY
(
cY
);
yc
=
GRMapY
(
cY
);
...
@@ -101,7 +119,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
...
@@ -101,7 +119,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
/* Compute the position ux0, uy0 of the first letter , next */
/* Compute the position ux0, uy0 of the first letter , next */
dx
=
(
espacement
*
nbchar
)
/
2
;
dx
=
(
espacement
*
char_count
)
/
2
;
dy
=
size_v
/
2
;
/* dx, dy = draw offset between first letter and text center */
dy
=
size_v
/
2
;
/* dx, dy = draw offset between first letter and text center */
ux0
=
uy0
=
0
;
/* Decalage du centre du texte / coord de ref */
ux0
=
uy0
=
0
;
/* Decalage du centre du texte / coord de ref */
...
@@ -178,7 +196,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
...
@@ -178,7 +196,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
if
(
ABS
(
(
aSize
.
x
/
zoom
)
)
<
3
)
/* chars trop petits pour etre dessines */
if
(
ABS
(
(
aSize
.
x
/
zoom
)
)
<
3
)
/* chars trop petits pour etre dessines */
{
/* le texte est symbolise par une barre */
{
/* le texte est symbolise par une barre */
dx
=
(
espacement
*
nbchar
)
/
2
;
dx
=
(
espacement
*
char_count
)
/
2
;
dy
=
size_v
/
2
;
/* Decalage du debut du texte / centre */
dy
=
size_v
/
2
;
/* Decalage du debut du texte / centre */
ux0
=
cX
-
dx
;
ux0
=
cX
-
dx
;
...
@@ -190,34 +208,15 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
...
@@ -190,34 +208,15 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
RotatePoint
(
&
ux0
,
&
uy0
,
cX
,
cY
,
aOrient
);
RotatePoint
(
&
ux0
,
&
uy0
,
cX
,
cY
,
aOrient
);
RotatePoint
(
&
dx
,
&
dy
,
cX
,
cY
,
aOrient
);
RotatePoint
(
&
dx
,
&
dy
,
cX
,
cY
,
aOrient
);
GRLine
(
&
aPanel
->
m_ClipBox
,
DC
,
ux0
,
uy0
,
dx
,
dy
,
aWidth
,
aColor
);
if
(
aCallback
)
aCallback
(
ux0
,
uy0
,
dx
,
dy
);
else
GRLine
(
&
aPanel
->
m_ClipBox
,
DC
,
ux0
,
uy0
,
dx
,
dy
,
aWidth
,
aColor
);
return
;
return
;
}
}
#if 0
while
(
kk
++
<
char_count
)
dx = (espacement * nbchar) / 2;
dy = size_v / 2;/* Decalage du debut du texte / centre */
ux0 = cX - dx;
uy0 = cY;
dx += cX;
dy = cY;
RotatePoint( &ux0, &uy0, cX, cY, aOrient );
RotatePoint( &dx, &dy, cX, cY, aOrient );
DC->SetTextForeground( wxColour(
ColorRefs[aColor].r,
ColorRefs[aColor].g,
ColorRefs[aColor].b ) );
DC->DrawRotatedText( Text, GRMapX( ux0 ), GRMapY( uy0 ), (double) aOrient / 10.0 );
return;
#endif
while
(
kk
++
<
nbchar
)
{
{
x0
=
0
;
y0
=
0
;
x0
=
0
;
y0
=
0
;
#if defined(wxUSE_UNICODE) && defined(KICAD_CYRILLIC)
#if defined(wxUSE_UNICODE) && defined(KICAD_CYRILLIC)
...
@@ -247,8 +246,16 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
...
@@ -247,8 +246,16 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
if
(
ii
&&
(
plume
==
'D'
)
)
if
(
ii
&&
(
plume
==
'D'
)
)
{
{
if
(
aWidth
<=
1
)
if
(
aWidth
<=
1
)
GRPoly
(
&
aPanel
->
m_ClipBox
,
DC
,
ii
/
2
,
coord
,
0
,
0
,
aWidth
=
0
;
aColor
,
aColor
);
if
(
aCallback
)
{
int
ik
,
*
coordptr
;
coordptr
=
coord
;
for
(
ik
=
0
;
ik
<
(
ii
-
2
);
ik
+=
2
,
coordptr
+=
2
)
aCallback
(
*
coordptr
,
*
(
coordptr
+
1
),
*
(
coordptr
+
2
),
*
(
coordptr
+
3
)
);
}
else
if
(
sketch_mode
)
else
if
(
sketch_mode
)
{
{
int
ik
,
*
coordptr
;
int
ik
,
*
coordptr
;
...
@@ -270,7 +277,8 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
...
@@ -270,7 +277,8 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
default
:
default
:
{
{
k1
=
f_cod
;
/* trace sur axe V */
int
y
,
k1
,
k2
;
y
=
k1
=
f_cod
;
/* trace sur axe V */
k1
=
-
(
(
k1
*
size_v
)
/
9
);
k1
=
-
(
(
k1
*
size_v
)
/
9
);
ptcar
++
;
ptcar
++
;
...
@@ -278,6 +286,9 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
...
@@ -278,6 +286,9 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
k2
=
f_cod
;
/* trace sur axe H */
k2
=
f_cod
;
/* trace sur axe H */
k2
=
(
k2
*
size_h
)
/
9
;
k2
=
(
k2
*
size_h
)
/
9
;
// To simulate an italic font, add a x offset depending on the y offset
if
(
aItalic
)
k2
-=
k1
/
8
;
dx
=
k2
+
ox
;
dy
=
k1
+
oy
;
dx
=
k2
+
ox
;
dy
=
k1
+
oy
;
RotatePoint
(
&
dx
,
&
dy
,
cX
,
cY
,
aOrient
);
RotatePoint
(
&
dx
,
&
dy
,
cX
,
cY
,
aOrient
);
...
@@ -290,19 +301,20 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
...
@@ -290,19 +301,20 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
/* end switch */
/* end switch */
}
}
/* end
boucle for = end trace de 1 caractere
*/
/* end
draw 1 char
*/
ptr
++
;
ox
+=
espacement
;
ptr
++
;
ox
+=
espacement
;
}
}
/* end trace du texte */
}
}
/******************************************************************************************/
/******************************************************************************************/
void
PlotGraphicText
(
int
aFormat_plot
,
const
wxPoint
&
aPos
,
enum
EDA_Colors
aColor
,
void
PlotGraphicText
(
int
aFormat_plot
,
const
wxPoint
&
aPos
,
enum
EDA_Colors
aColor
,
const
wxString
&
aText
,
const
wxString
&
aText
,
int
aOrient
,
const
wxSize
&
aSize
,
int
aH_justify
,
int
aV_justify
)
int
aOrient
,
const
wxSize
&
aSize
,
enum
GRTextHorizJustifyType
aH_justify
,
enum
GRTextVertJustifyType
aV_justify
,
bool
aItalic
)
/******************************************************************************************/
/******************************************************************************************/
/** Function PlotGraphicText
/** Function PlotGraphicText
...
@@ -317,7 +329,7 @@ void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aCo
...
@@ -317,7 +329,7 @@ void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aCo
* @param aV_justify = vertical justification (bottom, center, top)
* @param aV_justify = vertical justification (bottom, center, top)
*/
*/
{
{
int
kk
,
nbchar
,
end
,
AsciiCode
;
int
kk
,
char_count
,
end
,
AsciiCode
;
int
k1
,
k2
,
x0
,
y0
,
ox
,
oy
;
int
k1
,
k2
,
x0
,
y0
,
ox
,
oy
;
int
size_h
,
size_v
,
espacement
;
int
size_h
,
size_v
,
espacement
;
SH_CODE
f_cod
,
plume
=
'U'
;
SH_CODE
f_cod
,
plume
=
'U'
;
...
@@ -357,14 +369,14 @@ void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aCo
...
@@ -357,14 +369,14 @@ void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aCo
ptr
=
0
;
/* ptr = text index */
ptr
=
0
;
/* ptr = text index */
/* calcul de la position du debut des textes: ox et oy */
/* calcul de la position du debut des textes: ox et oy */
nbchar
=
aText
.
Len
();
char_count
=
aText
.
Len
();
espacement
=
(
10
*
size_h
)
/
9
;
espacement
=
(
10
*
size_h
)
/
9
;
ox
=
cX
=
aPos
.
x
;
ox
=
cX
=
aPos
.
x
;
oy
=
cY
=
aPos
.
y
;
oy
=
cY
=
aPos
.
y
;
/* Calcul du cadrage du texte */
/* Calcul du cadrage du texte */
dx
=
(
espacement
*
nbchar
)
/
2
;
dx
=
(
espacement
*
char_count
)
/
2
;
dy
=
size_v
/
2
;
/* Decalage du debut du texte / centre */
dy
=
size_v
/
2
;
/* Decalage du debut du texte / centre */
ux0
=
uy0
=
0
;
/* Decalage du centre du texte / ccord de ref */
ux0
=
uy0
=
0
;
/* Decalage du centre du texte / ccord de ref */
...
@@ -438,7 +450,7 @@ void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aCo
...
@@ -438,7 +450,7 @@ void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aCo
FctPlume
(
wxPoint
(
0
,
0
),
'Z'
);
FctPlume
(
wxPoint
(
0
,
0
),
'Z'
);
while
(
kk
++
<
nbchar
)
while
(
kk
++
<
char_count
)
{
{
#if defined(wxUSE_UNICODE) && defined(KICAD_CYRILLIC)
#if defined(wxUSE_UNICODE) && defined(KICAD_CYRILLIC)
AsciiCode
=
aText
.
GetChar
(
ptr
)
&
0x7FF
;
AsciiCode
=
aText
.
GetChar
(
ptr
)
&
0x7FF
;
...
@@ -474,6 +486,9 @@ void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aCo
...
@@ -474,6 +486,9 @@ void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aCo
k2
=
f_cod
;
/* trace sur axe H */
k2
=
f_cod
;
/* trace sur axe H */
k2
=
(
k2
*
size_h
)
/
9
;
k2
=
(
k2
*
size_h
)
/
9
;
// To simulate an italic font, add a x offset depending on the y offset
if
(
aItalic
)
k2
-=
k1
/
8
;
dx
=
k2
+
ox
;
dx
=
k2
+
ox
;
dy
=
k1
+
oy
;
dy
=
k1
+
oy
;
...
...
eeschema/class_hierarchical_PIN_sheet.cpp
View file @
beeaf53a
...
@@ -72,7 +72,7 @@ void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, con
...
@@ -72,7 +72,7 @@ void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, con
/********************************************************************************************/
/********************************************************************************************/
/* Routine de dessin des Labels type hierarchie */
/* Routine de dessin des Labels type hierarchie */
{
{
int
side
;
GRTextHorizJustifyType
side
;
EDA_Colors
txtcolor
;
EDA_Colors
txtcolor
;
int
posx
,
tposx
,
posy
,
size2
;
int
posx
,
tposx
,
posy
,
size2
;
wxSize
size
;
wxSize
size
;
...
...
eeschema/class_sch_cmp_field.cpp
View file @
beeaf53a
...
@@ -53,36 +53,12 @@ void SCH_CMP_FIELD::SwapData( SCH_CMP_FIELD* copyitem )
...
@@ -53,36 +53,12 @@ void SCH_CMP_FIELD::SwapData( SCH_CMP_FIELD* copyitem )
EXCHG
(
m_Orient
,
copyitem
->
m_Orient
);
EXCHG
(
m_Orient
,
copyitem
->
m_Orient
);
EXCHG
(
m_Miroir
,
copyitem
->
m_Miroir
);
EXCHG
(
m_Miroir
,
copyitem
->
m_Miroir
);
EXCHG
(
m_Attributs
,
copyitem
->
m_Attributs
);
EXCHG
(
m_Attributs
,
copyitem
->
m_Attributs
);
EXCHG
(
m_
CharType
,
copyitem
->
m_CharType
);
EXCHG
(
m_
Italic
,
copyitem
->
m_Italic
);
EXCHG
(
m_HJustify
,
copyitem
->
m_HJustify
);
EXCHG
(
m_HJustify
,
copyitem
->
m_HJustify
);
EXCHG
(
m_VJustify
,
copyitem
->
m_VJustify
);
EXCHG
(
m_VJustify
,
copyitem
->
m_VJustify
);
EXCHG
(
m_ZoomLevelDrawable
,
copyitem
->
m_ZoomLevelDrawable
);
EXCHG
(
m_TextDrawings
,
copyitem
->
m_TextDrawings
);
EXCHG
(
m_TextDrawingsSize
,
copyitem
->
m_TextDrawingsSize
);
}
}
#if 0
/***********************************************************/
void SCH_CMP_FIELD::PartTextCopy( SCH_CMP_FIELD* target )
/***********************************************************/
{
target->m_Text = m_Text;
if( m_FieldId >= FIELD1 )
target->m_Name = m_Name;
target->m_Layer = m_Layer;
target->m_Pos = m_Pos;
target->m_Size = m_Size;
target->m_Attributs = m_Attributs;
target->m_FieldId = m_FieldId;
target->m_Orient = m_Orient;
target->m_HJustify = m_HJustify;
target->m_VJustify = m_VJustify;
target->m_Flags = m_Flags;
}
#endif
/*********************************/
/*********************************/
bool
SCH_CMP_FIELD
::
IsVoid
()
bool
SCH_CMP_FIELD
::
IsVoid
()
/*********************************/
/*********************************/
...
@@ -92,8 +68,8 @@ bool SCH_CMP_FIELD::IsVoid()
...
@@ -92,8 +68,8 @@ bool SCH_CMP_FIELD::IsVoid()
*/
*/
{
{
if
(
m_Text
.
IsEmpty
()
||
m_Text
==
wxT
(
"~"
)
)
if
(
m_Text
.
IsEmpty
()
||
m_Text
==
wxT
(
"~"
)
)
return
TRUE
;
return
true
;
return
FALSE
;
return
false
;
}
}
...
@@ -142,7 +118,7 @@ EDA_Rect SCH_CMP_FIELD::GetBoundaryBox() const
...
@@ -142,7 +118,7 @@ EDA_Rect SCH_CMP_FIELD::GetBoundaryBox() const
y2
=
pos
.
y
+
(
DrawLibItem
->
m_Transform
[
1
][
0
]
*
x1
)
y2
=
pos
.
y
+
(
DrawLibItem
->
m_Transform
[
1
][
0
]
*
x1
)
+
(
DrawLibItem
->
m_Transform
[
1
][
1
]
*
y1
);
+
(
DrawLibItem
->
m_Transform
[
1
][
1
]
*
y1
);
/* If the component orientation is +/- 90 deg, the text orienation must be changed */
/* If the component orientation is +/- 90 deg, the text orien
t
ation must be changed */
if
(
DrawLibItem
->
m_Transform
[
0
][
1
]
)
if
(
DrawLibItem
->
m_Transform
[
0
][
1
]
)
{
{
if
(
orient
==
TEXT_ORIENT_HORIZ
)
if
(
orient
==
TEXT_ORIENT_HORIZ
)
...
@@ -206,7 +182,9 @@ EDA_Rect SCH_CMP_FIELD::GetBoundaryBox() const
...
@@ -206,7 +182,9 @@ EDA_Rect SCH_CMP_FIELD::GetBoundaryBox() const
}
}
/*********************************************/
bool
SCH_CMP_FIELD
::
Save
(
FILE
*
aFile
)
const
bool
SCH_CMP_FIELD
::
Save
(
FILE
*
aFile
)
const
/*********************************************/
{
{
char
hjustify
=
'C'
;
char
hjustify
=
'C'
;
if
(
m_HJustify
==
GR_TEXT_HJUSTIFY_LEFT
)
if
(
m_HJustify
==
GR_TEXT_HJUSTIFY_LEFT
)
...
...
eeschema/class_sch_cmp_field.h
View file @
beeaf53a
...
@@ -44,7 +44,6 @@ public:
...
@@ -44,7 +44,6 @@ public:
}
}
void
PartTextCopy
(
SCH_CMP_FIELD
*
target
);
void
Place
(
WinEDA_SchematicFrame
*
frame
,
wxDC
*
DC
);
void
Place
(
WinEDA_SchematicFrame
*
frame
,
wxDC
*
DC
);
EDA_Rect
GetBoundaryBox
()
const
;
EDA_Rect
GetBoundaryBox
()
const
;
...
...
eeschema/classes_body_items.h
View file @
beeaf53a
This diff is collapsed.
Click to expand it.
eeschema/edit_component_in_lib.cpp
View file @
beeaf53a
...
@@ -106,11 +106,11 @@ void WinEDA_PartPropertiesFrame::CopyBufferToFieldData( LibDrawField* Field )
...
@@ -106,11 +106,11 @@ void WinEDA_PartPropertiesFrame::CopyBufferToFieldData( LibDrawField* Field )
* field "Field"
* field "Field"
*/
*/
{
{
int
hjustify
[
3
]
=
{
GRTextHorizJustifyType
hjustify
[
3
]
=
{
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_HJUSTIFY_RIGHT
GR_TEXT_HJUSTIFY_RIGHT
};
};
int
vjustify
[
3
]
=
{
GRTextVertJustifyType
vjustify
[
3
]
=
{
GR_TEXT_VJUSTIFY_BOTTOM
,
GR_TEXT_VJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_BOTTOM
,
GR_TEXT_VJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_TOP
GR_TEXT_VJUSTIFY_TOP
};
};
...
...
eeschema/eelibs_draw_components.cpp
View file @
beeaf53a
...
@@ -253,7 +253,8 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel,
...
@@ -253,7 +253,8 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel,
EDA_Colors
color
;
EDA_Colors
color
;
wxPoint
pos
;
/* Position des textes */
wxPoint
pos
;
/* Position des textes */
SCH_COMPONENT
*
DrawLibItem
=
(
SCH_COMPONENT
*
)
m_Parent
;
SCH_COMPONENT
*
DrawLibItem
=
(
SCH_COMPONENT
*
)
m_Parent
;
int
hjustify
,
vjustify
;
GRTextHorizJustifyType
hjustify
;
GRTextVertJustifyType
vjustify
;
int
LineWidth
=
MAX
(
m_Width
,
g_DrawMinimunLineWidth
);
int
LineWidth
=
MAX
(
m_Width
,
g_DrawMinimunLineWidth
);
if
(
m_Attributs
&
TEXT_NO_VISIBLE
)
if
(
m_Attributs
&
TEXT_NO_VISIBLE
)
...
@@ -280,19 +281,61 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel,
...
@@ -280,19 +281,61 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel,
else
else
orient
=
TEXT_ORIENT_HORIZ
;
orient
=
TEXT_ORIENT_HORIZ
;
/* Y a t-il rotation, miroir (pour les justifications)*/
/* Y a t-il rotation, miroir (pour les justifications)*/
EXCHG
(
hjustify
,
vjustify
);
GRTextHorizJustifyType
tmp
=
hjustify
;
hjustify
=
(
GRTextHorizJustifyType
)
vjustify
;
vjustify
=
(
GRTextVertJustifyType
)
tmp
;
if
(
DrawLibItem
->
m_Transform
[
1
][
0
]
<
0
)
if
(
DrawLibItem
->
m_Transform
[
1
][
0
]
<
0
)
vjustify
=
-
vjustify
;
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
)
if
(
DrawLibItem
->
m_Transform
[
1
][
0
]
>
0
)
hjustify
=
-
hjustify
;
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
else
{
{
/* Texte horizontal: Y a t-il miroir (pour les justifications)*/
/* Texte horizontal: Y a t-il miroir (pour les justifications)*/
if
(
DrawLibItem
->
m_Transform
[
0
][
0
]
<
0
)
if
(
DrawLibItem
->
m_Transform
[
0
][
0
]
<
0
)
hjustify
=
-
hjustify
;
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
)
if
(
DrawLibItem
->
m_Transform
[
1
][
1
]
>
0
)
vjustify
=
-
vjustify
;
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
(
m_FieldId
==
REFERENCE
)
if
(
m_FieldId
==
REFERENCE
)
...
@@ -309,9 +352,9 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel,
...
@@ -309,9 +352,9 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel,
m_Size
,
m_Size
,
hjustify
,
vjustify
,
LineWidth
);
hjustify
,
vjustify
,
LineWidth
);
}
}
else
//
Si il y a plusieurs parts par boitier, ajouter a la reference l'identification de la selection ( A, B ...
)
else
//
For more than one part per package, we must add the part selection to the reference
)
{
{
/*
On ajoute alors A ou B ... a la
reference */
/*
Adding A ou B ... or .1 .2 ... to the
reference */
wxString
fulltext
=
m_Text
;
wxString
fulltext
=
m_Text
;
#if defined(KICAD_GOST)
#if defined(KICAD_GOST)
fulltext
.
Append
(
'.'
);
fulltext
.
Append
(
'.'
);
...
@@ -320,7 +363,7 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel,
...
@@ -320,7 +363,7 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel,
fulltext
.
Append
(
'A'
-
1
+
DrawLibItem
->
m_Multi
);
fulltext
.
Append
(
'A'
-
1
+
DrawLibItem
->
m_Multi
);
#endif
#endif
DrawGraphicText
(
panel
,
DC
,
pos
,
color
,
fulltext
.
GetData
()
,
DrawGraphicText
(
panel
,
DC
,
pos
,
color
,
fulltext
,
orient
?
TEXT_ORIENT_VERT
:
TEXT_ORIENT_HORIZ
,
orient
?
TEXT_ORIENT_VERT
:
TEXT_ORIENT_HORIZ
,
m_Size
,
m_Size
,
hjustify
,
vjustify
,
LineWidth
);
hjustify
,
vjustify
,
LineWidth
);
...
...
eeschema/eelibs_read_libraryfiles.cpp
View file @
beeaf53a
...
@@ -871,7 +871,7 @@ GetLibEntryField (EDA_LibComponentStruct* LibEntry,
...
@@ -871,7 +871,7 @@ GetLibEntryField (EDA_LibComponentStruct* LibEntry,
* ou n = 0 (REFERENCE), 1 (VALUE) , 2 .. 11 = autres champs, facultatifs
* ou n = 0 (REFERENCE), 1 (VALUE) , 2 .. 11 = autres champs, facultatifs
*/
*/
{
{
int
posx
,
posy
,
size
,
orient
,
hjustify
,
vjustify
;
int
posx
,
posy
,
size
,
orient
;
bool
draw
;
bool
draw
;
char
*
Text
,
char
*
Text
,
Char1
[
256
],
Char2
[
256
],
Char1
[
256
],
Char2
[
256
],
...
@@ -919,8 +919,8 @@ GetLibEntryField (EDA_LibComponentStruct* LibEntry,
...
@@ -919,8 +919,8 @@ GetLibEntryField (EDA_LibComponentStruct* LibEntry,
draw
=
TRUE
;
if
(
Char2
[
0
]
==
'I'
)
draw
=
TRUE
;
if
(
Char2
[
0
]
==
'I'
)
draw
=
FALSE
;
draw
=
FALSE
;
hjustify
=
GR_TEXT_HJUSTIFY_CENTER
;
GRTextHorizJustifyType
hjustify
=
GR_TEXT_HJUSTIFY_CENTER
;
vjustify
=
GR_TEXT_VJUSTIFY_CENTER
;
GRTextVertJustifyType
vjustify
=
GR_TEXT_VJUSTIFY_CENTER
;
if
(
nbparam
>=
6
)
if
(
nbparam
>=
6
)
{
{
...
...
eeschema/load_one_schematic_file.cpp
View file @
beeaf53a
...
@@ -670,8 +670,8 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
...
@@ -670,8 +670,8 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
int
fieldNdx
;
int
fieldNdx
;
char
FieldUserName
[
1024
];
char
FieldUserName
[
1024
];
int
hjustify
=
GR_TEXT_HJUSTIFY_CENTER
;
GRTextHorizJustifyType
hjustify
=
GR_TEXT_HJUSTIFY_CENTER
;
int
vjustify
=
GR_TEXT_VJUSTIFY_CENTER
;
GRTextVertJustifyType
vjustify
=
GR_TEXT_VJUSTIFY_CENTER
;
FieldUserName
[
0
]
=
0
;
FieldUserName
[
0
]
=
0
;
...
...
eeschema/plot.cpp
View file @
beeaf53a
...
@@ -376,7 +376,6 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem,
...
@@ -376,7 +376,6 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem,
{
{
wxPoint
textpos
;
/* Position des textes */
wxPoint
textpos
;
/* Position des textes */
SCH_CMP_FIELD
*
field
=
DrawLibItem
->
GetField
(
FieldNumber
);
SCH_CMP_FIELD
*
field
=
DrawLibItem
->
GetField
(
FieldNumber
);
int
hjustify
,
vjustify
;
int
orient
;
int
orient
;
EDA_Colors
color
=
UNSPECIFIED_COLOR
;
EDA_Colors
color
=
UNSPECIFIED_COLOR
;
...
@@ -391,7 +390,8 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem,
...
@@ -391,7 +390,8 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem,
/* Calcul de la position des textes, selon orientation du composant */
/* Calcul de la position des textes, selon orientation du composant */
orient
=
field
->
m_Orient
;
orient
=
field
->
m_Orient
;
hjustify
=
field
->
m_HJustify
;
vjustify
=
field
->
m_VJustify
;
GRTextHorizJustifyType
hjustify
=
field
->
m_HJustify
;
GRTextVertJustifyType
vjustify
=
field
->
m_VJustify
;
textpos
=
field
->
m_Pos
-
DrawLibItem
->
m_Pos
;
// textpos is the text position relative to the component anchor
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
;
textpos
=
TransformCoordinate
(
DrawLibItem
->
m_Transform
,
textpos
)
+
DrawLibItem
->
m_Pos
;
...
@@ -404,19 +404,62 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem,
...
@@ -404,19 +404,62 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem,
else
else
orient
=
TEXT_ORIENT_HORIZ
;
orient
=
TEXT_ORIENT_HORIZ
;
/* Y a t-il rotation, miroir (pour les justifications)*/
/* Y a t-il rotation, miroir (pour les justifications)*/
EXCHG
(
hjustify
,
vjustify
);
GRTextHorizJustifyType
tmp
=
hjustify
;
hjustify
=
(
GRTextHorizJustifyType
)
vjustify
;
vjustify
=
(
GRTextVertJustifyType
)
tmp
;
if
(
DrawLibItem
->
m_Transform
[
1
][
0
]
<
0
)
if
(
DrawLibItem
->
m_Transform
[
1
][
0
]
<
0
)
vjustify
=
-
vjustify
;
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
)
if
(
DrawLibItem
->
m_Transform
[
1
][
0
]
>
0
)
hjustify
=
-
hjustify
;
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
else
{
{
/* Texte horizontal: Y a t-il miroir (pour les justifications)*/
/* Texte horizontal: Y a t-il miroir (pour les justifications)*/
if
(
DrawLibItem
->
m_Transform
[
0
][
0
]
<
0
)
if
(
DrawLibItem
->
m_Transform
[
0
][
0
]
<
0
)
hjustify
=
-
hjustify
;
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
)
if
(
DrawLibItem
->
m_Transform
[
1
][
1
]
>
0
)
vjustify
=
-
vjustify
;
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
;
}
}
}
SetCurrentLineWidth
(
-
1
);
SetCurrentLineWidth
(
-
1
);
...
@@ -686,7 +729,6 @@ static void PlotSheetLabelStruct( Hierarchical_PIN_Sheet_Struct* Struct )
...
@@ -686,7 +729,6 @@ static void PlotSheetLabelStruct( Hierarchical_PIN_Sheet_Struct* Struct )
/***********************************************************************/
/***********************************************************************/
/* Routine de dessin des Sheet Labels type hierarchie */
/* Routine de dessin des Sheet Labels type hierarchie */
{
{
int
side
;
EDA_Colors
txtcolor
=
UNSPECIFIED_COLOR
;
EDA_Colors
txtcolor
=
UNSPECIFIED_COLOR
;
int
posx
,
tposx
,
posy
,
size
,
size2
;
int
posx
,
tposx
,
posy
,
size
,
size2
;
int
coord
[
16
];
int
coord
[
16
];
...
@@ -695,6 +737,7 @@ static void PlotSheetLabelStruct( Hierarchical_PIN_Sheet_Struct* Struct )
...
@@ -695,6 +737,7 @@ static void PlotSheetLabelStruct( Hierarchical_PIN_Sheet_Struct* Struct )
txtcolor
=
ReturnLayerColor
(
Struct
->
GetLayer
()
);
txtcolor
=
ReturnLayerColor
(
Struct
->
GetLayer
()
);
posx
=
Struct
->
m_Pos
.
x
;
posy
=
Struct
->
m_Pos
.
y
;
size
=
Struct
->
m_Size
.
x
;
posx
=
Struct
->
m_Pos
.
x
;
posy
=
Struct
->
m_Pos
.
y
;
size
=
Struct
->
m_Size
.
x
;
GRTextHorizJustifyType
side
;
if
(
Struct
->
m_Edge
)
if
(
Struct
->
m_Edge
)
{
{
tposx
=
posx
-
size
;
tposx
=
posx
-
size
;
...
...
include/base_struct.h
View file @
beeaf53a
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#ifndef BASE_STRUCT_H
#ifndef BASE_STRUCT_H
#define BASE_STRUCT_H
#define BASE_STRUCT_H
#include "colors.h"
#if defined (DEBUG)
#if defined (DEBUG)
#include <iostream> // needed for Show()
#include <iostream> // needed for Show()
...
@@ -127,7 +128,6 @@ public:
...
@@ -127,7 +128,6 @@ public:
};
};
/**
/**
* Class EDA_Rect
* Class EDA_Rect
* handles the component boundary box.
* handles the component boundary box.
...
@@ -144,8 +144,9 @@ public:
...
@@ -144,8 +144,9 @@ public:
EDA_Rect
()
{
};
EDA_Rect
()
{
};
EDA_Rect
(
const
wxPoint
&
aPos
,
const
wxSize
&
aSize
)
:
EDA_Rect
(
const
wxPoint
&
aPos
,
const
wxSize
&
aSize
)
:
m_Pos
(
aPos
),
m_Size
(
aSize
)
m_Pos
(
aPos
)
{}
,
m_Size
(
aSize
)
{
}
wxPoint
Centre
()
wxPoint
Centre
()
{
{
...
@@ -182,6 +183,7 @@ public:
...
@@ -182,6 +183,7 @@ public:
m_Size
.
x
=
pos
.
x
-
m_Pos
.
x
;
m_Size
.
y
=
pos
.
y
-
m_Pos
.
y
;
m_Size
.
x
=
pos
.
x
-
m_Pos
.
x
;
m_Size
.
y
=
pos
.
y
-
m_Pos
.
y
;
}
}
/**
/**
* Function Intersects
* Function Intersects
* @return bool - true if the argument rectangle intersects this rectangle.
* @return bool - true if the argument rectangle intersects this rectangle.
...
@@ -195,15 +197,14 @@ public:
...
@@ -195,15 +197,14 @@ public:
*/
*/
operator
wxRect
()
const
{
return
wxRect
(
m_Pos
,
m_Size
);
}
operator
wxRect
()
const
{
return
wxRect
(
m_Pos
,
m_Size
);
}
EDA_Rect
&
Inflate
(
wxCoord
dx
,
wxCoord
dy
);
EDA_Rect
&
Inflate
(
wxCoord
dx
,
wxCoord
dy
);
/** Function Merge
/** Function Merge
* Modify Position and Size of this in order to contain the given rect
* Modify Position and Size of this in order to contain the given rect
* mainly used to calculate bounding boxes
* mainly used to calculate bounding boxes
* @param aRect = given rect to merge with this
* @param aRect = given rect to merge with this
*/
*/
void
Merge
(
const
EDA_Rect
&
aRect
);
void
Merge
(
const
EDA_Rect
&
aRect
);
};
};
...
@@ -236,7 +237,7 @@ protected:
...
@@ -236,7 +237,7 @@ protected:
public
:
public
:
int
m_Flags
;
// flags for editing and other misc. uses
int
m_Flags
;
// flags for editing and other misc. uses
#define IS_CHANGED (1 << 0)
#define IS_CHANGED (1 << 0)
#define IS_LINKED (1 << 1)
#define IS_LINKED (1 << 1)
#define IN_EDIT (1 << 2)
#define IN_EDIT (1 << 2)
...
@@ -259,11 +260,11 @@ public:
...
@@ -259,11 +260,11 @@ public:
EDA_BaseStruct
*
m_Image
;
/* Link to an image copy for undelete or abort command */
EDA_BaseStruct
*
m_Image
;
/* Link to an image copy for undelete or abort command */
unsigned
long
m_TimeStamp
;
// Time stamp used for logical links
unsigned
long
m_TimeStamp
;
// Time stamp used for logical links
int
m_Selected
;
/* Used by block commands, and selective editing */
int
m_Selected
;
/* Used by block commands, and selective editing */
private
:
private
:
int
m_Status
;
int
m_Status
;
private
:
private
:
void
InitVars
();
void
InitVars
();
...
@@ -284,11 +285,11 @@ public:
...
@@ -284,11 +285,11 @@ public:
KICAD_T
Type
()
const
{
return
m_StructType
;
}
KICAD_T
Type
()
const
{
return
m_StructType
;
}
EDA_BaseStruct
*
Next
()
const
{
return
(
EDA_BaseStruct
*
)
Pnext
;
}
EDA_BaseStruct
*
Next
()
const
{
return
(
EDA_BaseStruct
*
)
Pnext
;
}
EDA_BaseStruct
*
Back
()
const
{
return
(
EDA_BaseStruct
*
)
Pback
;
}
EDA_BaseStruct
*
Back
()
const
{
return
(
EDA_BaseStruct
*
)
Pback
;
}
EDA_BaseStruct
*
GetParent
()
const
{
return
m_Parent
;
}
EDA_BaseStruct
*
GetParent
()
const
{
return
m_Parent
;
}
EDA_BaseStruct
*
GetSon
()
const
{
return
m_Son
;
}
EDA_BaseStruct
*
GetSon
()
const
{
return
m_Son
;
}
DHEAD
*
GetList
()
const
{
return
m_List
;
}
DHEAD
*
GetList
()
const
{
return
m_List
;
}
void
SetNext
(
EDA_BaseStruct
*
aNext
)
{
Pnext
=
aNext
;
}
void
SetNext
(
EDA_BaseStruct
*
aNext
)
{
Pnext
=
aNext
;
}
void
SetBack
(
EDA_BaseStruct
*
aBack
)
{
Pback
=
aBack
;
}
void
SetBack
(
EDA_BaseStruct
*
aBack
)
{
Pback
=
aBack
;
}
...
@@ -320,6 +321,7 @@ public:
...
@@ -320,6 +321,7 @@ public:
m_Status
=
new_status
;
m_Status
=
new_status
;
}
}
/**
/**
* Function Display_Infos
* Function Display_Infos
* has knowledge about the frame and how and where to put status information
* has knowledge about the frame and how and where to put status information
...
@@ -343,6 +345,7 @@ public:
...
@@ -343,6 +345,7 @@ public:
return
false
;
// derived classes should override this function
return
false
;
// derived classes should override this function
}
}
/**
/**
* Function HitTest (overlayed)
* Function HitTest (overlayed)
* tests if the given EDA_Rect intersect this object.
* tests if the given EDA_Rect intersect this object.
...
@@ -355,6 +358,7 @@ public:
...
@@ -355,6 +358,7 @@ public:
return
false
;
// derived classes should override this function
return
false
;
// derived classes should override this function
}
}
/**
/**
* Function GetBoundingBox
* Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display purposes.
* returns the orthogonal, bounding box of this object for display purposes.
...
@@ -365,14 +369,16 @@ public:
...
@@ -365,14 +369,16 @@ public:
virtual
EDA_Rect
GetBoundingBox
()
virtual
EDA_Rect
GetBoundingBox
()
{
{
#if defined (DEBUG)
#if defined (DEBUG)
printf
(
"Missing GetBoundingBox()
\n
"
);
printf
(
"Missing GetBoundingBox()
\n
"
);
Show
(
0
,
std
::
cout
);
// tell me which classes still need GetBoundingBox support
Show
(
0
,
std
::
cout
);
// tell me which classes still need GetBoundingBox support
#endif
#endif
// return a zero-sized box per default. derived classes should override this
// return a zero-sized box per default. derived classes should override this
EDA_Rect
ret
(
wxPoint
(
0
,
0
),
wxSize
(
0
,
0
)
);
EDA_Rect
ret
(
wxPoint
(
0
,
0
),
wxSize
(
0
,
0
)
);
return
ret
;
return
ret
;
}
}
/**
/**
* Function IterateForward
* Function IterateForward
* walks through the object tree calling the inspector() on each object
* walks through the object tree calling the inspector() on each object
...
@@ -449,26 +455,27 @@ public:
...
@@ -449,26 +455,27 @@ public:
};
};
// Text justify:
//
Graphic
Text justify:
// Values -1,0,1 are used in computations, do not change them
// Values -1,0,1 are used in computations, do not change them
typedef
enum
{
enum
GRTextHorizJustifyType
{
GR_TEXT_HJUSTIFY_LEFT
=
-
1
,
GR_TEXT_HJUSTIFY_LEFT
=
-
1
,
GR_TEXT_HJUSTIFY_CENTER
=
0
,
GR_TEXT_HJUSTIFY_CENTER
=
0
,
GR_TEXT_HJUSTIFY_RIGHT
=
1
GR_TEXT_HJUSTIFY_RIGHT
=
1
}
GRTextHorizJustifyType
;
};
typedef
enum
{
enum
GRTextVertJustifyType
{
GR_TEXT_VJUSTIFY_TOP
=
-
1
,
GR_TEXT_VJUSTIFY_TOP
=
-
1
,
GR_TEXT_VJUSTIFY_CENTER
=
0
,
GR_TEXT_VJUSTIFY_CENTER
=
0
,
GR_TEXT_VJUSTIFY_BOTTOM
=
1
GR_TEXT_VJUSTIFY_BOTTOM
=
1
}
GRTextVertJustifyType
;
};
/* controle des remplissages a l'ecran (Segments textes...)*/
/* Options to show solid segments (segments, texts...) */
#define FILAIRE 0
enum
GRFillMode
{
#define FILLED 1
FILAIRE
=
0
,
// segments are drawn as lines
#define SKETCH 2
FILLED
,
// normal mode: segments have thickness
SKETCH
// skect mode: segments have thickness, but are not filled
};
#define DEFAULT_SIZE_TEXT 60
/* default text height (in mils or 1/1000") */
#define DEFAULT_SIZE_TEXT 60
/* default text height (in mils or 1/1000") */
...
@@ -489,18 +496,13 @@ public:
...
@@ -489,18 +496,13 @@ public:
int
m_Orient
;
/* Orient in 0.1 degrees */
int
m_Orient
;
/* Orient in 0.1 degrees */
int
m_Miroir
;
// Display Normal / mirror
int
m_Miroir
;
// Display Normal / mirror
int
m_Attributs
;
/* flags (visible...) */
int
m_Attributs
;
/* flags (visible...) */
int
m_CharType
;
/* normal, bold, italic ... */
bool
m_Italic
;
/* true to simulate an italic font... */
int
m_HJustify
,
m_VJustify
;
/* Horiz and Vert Justifications */
GRTextHorizJustifyType
m_HJustify
;
/* Horiz Justify */
int
m_ZoomLevelDrawable
;
/* zoom level to draw text.
GRTextVertJustifyType
m_VJustify
;
/* Vertical and Vert Justify */
* if zoom < m_ZoomLevelDrawable: the text is drawn as a single line
*/
int
*
m_TextDrawings
;
/* list of segments to draw, for the Draw function */
int
m_TextDrawingsSize
;
/* segment count */
public
:
public
:
EDA_TextStruct
(
const
wxString
&
text
=
wxEmptyString
);
EDA_TextStruct
(
const
wxString
&
text
=
wxEmptyString
);
virtual
~
EDA_TextStruct
();
virtual
~
EDA_TextStruct
();
void
CreateDrawData
();
int
GetLength
()
const
{
return
m_Text
.
Length
();
};
int
GetLength
()
const
{
return
m_Text
.
Length
();
};
...
@@ -510,9 +512,19 @@ public:
...
@@ -510,9 +512,19 @@ public:
*/
*/
int
Pitch
();
int
Pitch
();
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
/** Function Draw
const
wxPoint
&
offset
,
int
color
,
* @param aPanel = the current DrawPanel
int
draw_mode
,
int
display_mode
=
FILAIRE
,
int
anchor_color
=
-
1
);
* @param aDC = the current Device Context
* @param aOffset = draw offset (usually (0,0))
* @param EDA_Colors aColor = text color
* @param aDraw_mode = GR_OR, GR_XOR.., -1 to use the current mode.
* @param GRFillMode aDisplay_mode = FILAIRE, FILLED or SKETCH
* @param EDA_Colors aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ).
*/
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
EDA_Colors
aColor
,
int
aDisplayMode
,
GRFillMode
aDisplay_mode
=
FILAIRE
,
EDA_Colors
aAnchor_color
=
UNSPECIFIED_COLOR
);
/**
/**
* Function HitTest
* Function HitTest
...
...
include/common.h
View file @
beeaf53a
...
@@ -439,10 +439,17 @@ double round( double aNumber );
...
@@ -439,10 +439,17 @@ double round( double aNumber );
* @param aV_justify = vertical justification (bottom, center, top)
* @param aV_justify = vertical justification (bottom, center, top)
* @param aWidth = line width (pen width) (default = 0)
* @param aWidth = line width (pen width) (default = 0)
* if width < 0 : draw segments in sketch mode, width = abs(width)
* if width < 0 : draw segments in sketch mode, width = abs(width)
* @param aItalic = true to simulate an italic font
* @param aCallback() = function called (if non null) to draw each segment.
* used only to draw 3D texts
*/
*/
void
DrawGraphicText
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
void
DrawGraphicText
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aPos
,
enum
EDA_Colors
aColor
,
const
wxString
&
aText
,
const
wxPoint
&
aPos
,
enum
EDA_Colors
aColor
,
const
wxString
&
aText
,
int
aOrient
,
const
wxSize
&
aSize
,
int
aH_justify
,
int
aV_justify
,
int
aWidth
=
0
);
int
aOrient
,
const
wxSize
&
aSize
,
enum
GRTextHorizJustifyType
aH_justify
,
enum
GRTextVertJustifyType
aV_justify
,
int
aWidth
=
0
,
bool
aItalic
=
false
,
void
(
*
aCallback
)(
int
x0
,
int
y0
,
int
xf
,
int
yf
)
=
NULL
);
/** Function PlotGraphicText
/** Function PlotGraphicText
* same as DrawGraphicText, but plot graphic text insteed of draw it
* same as DrawGraphicText, but plot graphic text insteed of draw it
...
@@ -454,10 +461,14 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* aDC,
...
@@ -454,10 +461,14 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* aDC,
* @param aSize = text size (size.x or size.y can be < 0 for mirrored texts)
* @param aSize = text size (size.x or size.y can be < 0 for mirrored texts)
* @param aH_justify = horizontal justification (Left, center, right)
* @param aH_justify = horizontal justification (Left, center, right)
* @param aV_justify = vertical justification (bottom, center, top)
* @param aV_justify = vertical justification (bottom, center, top)
* @param aItalic = true to simulate an italic font
*/
*/
void
PlotGraphicText
(
int
aFormat_plot
,
const
wxPoint
&
aPos
,
enum
EDA_Colors
aColor
,
void
PlotGraphicText
(
int
aFormat_plot
,
const
wxPoint
&
aPos
,
enum
EDA_Colors
aColor
,
const
wxString
&
aText
,
const
wxString
&
aText
,
int
aOrient
,
const
wxSize
&
aSize
,
int
aH_justify
,
int
aV_justify
);
int
aOrient
,
const
wxSize
&
aSize
,
enum
GRTextHorizJustifyType
aH_justify
,
enum
GRTextVertJustifyType
aV_justify
,
bool
aItalic
=
false
);
/***************/
/***************/
/* CONFIRM.CPP */
/* CONFIRM.CPP */
...
...
pcbnew/block.cpp
View file @
beeaf53a
...
@@ -710,8 +710,6 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
...
@@ -710,8 +710,6 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
STRUCT
->
m_Orient
+=
900
;
STRUCT
->
m_Orient
+=
900
;
if
(
STRUCT
->
m_Orient
>=
3600
)
if
(
STRUCT
->
m_Orient
>=
3600
)
STRUCT
->
m_Orient
-=
3600
;
STRUCT
->
m_Orient
-=
3600
;
STRUCT
->
CreateDrawData
();
break
;
break
;
case
TYPE_MIRE
:
case
TYPE_MIRE
:
...
@@ -896,7 +894,6 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
...
@@ -896,7 +894,6 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
STRUCT
->
m_Miroir
^=
1
;
/* inverse miroir */
STRUCT
->
m_Miroir
^=
1
;
/* inverse miroir */
}
}
STRUCT
->
SetLayer
(
ChangeSideNumLayer
(
STRUCT
->
GetLayer
()
)
);
STRUCT
->
SetLayer
(
ChangeSideNumLayer
(
STRUCT
->
GetLayer
()
)
);
STRUCT
->
CreateDrawData
();
break
;
break
;
case
TYPE_MIRE
:
case
TYPE_MIRE
:
...
...
pcbnew/class_pcb_text.cpp
View file @
beeaf53a
...
@@ -40,7 +40,7 @@ void TEXTE_PCB::Copy( TEXTE_PCB* source )
...
@@ -40,7 +40,7 @@ void TEXTE_PCB::Copy( TEXTE_PCB* source )
m_Layer
=
source
->
m_Layer
;
m_Layer
=
source
->
m_Layer
;
m_Width
=
source
->
m_Width
;
m_Width
=
source
->
m_Width
;
m_Attributs
=
source
->
m_Attributs
;
m_Attributs
=
source
->
m_Attributs
;
m_
CharType
=
source
->
m_CharType
;
m_
Italic
=
source
->
m_Italic
;
m_HJustify
=
source
->
m_HJustify
;
m_HJustify
=
source
->
m_HJustify
;
m_VJustify
=
source
->
m_VJustify
;
m_VJustify
=
source
->
m_VJustify
;
...
@@ -135,9 +135,9 @@ void TEXTE_PCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -135,9 +135,9 @@ void TEXTE_PCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
if
(
color
&
ITEM_NOT_SHOW
)
if
(
color
&
ITEM_NOT_SHOW
)
return
;
return
;
EDA_TextStruct
::
Draw
(
panel
,
DC
,
offset
,
color
,
EDA_TextStruct
::
Draw
(
panel
,
DC
,
offset
,
(
EDA_Colors
)
color
,
DrawMode
,
DisplayOpt
.
DisplayDrawItems
,
DrawMode
,
(
GRFillMode
)
DisplayOpt
.
DisplayDrawItems
,
(
g_AnchorColor
&
ITEM_NOT_SHOW
)
?
-
1
:
(
g_AnchorColor
&
MASKCOLOR
)
);
(
g_AnchorColor
&
ITEM_NOT_SHOW
)
?
UNSPECIFIED_COLOR
:
(
EDA_Colors
)
g_AnchorColor
);
}
}
...
...
pcbnew/class_track.cpp
View file @
beeaf53a
...
@@ -635,6 +635,49 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
...
@@ -635,6 +635,49 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
m_End
.
x
,
m_End
.
y
,
m_End
.
x
,
m_End
.
y
,
m_Width
+
(
g_DesignSettings
.
m_TrackClearence
*
2
),
color
);
m_Width
+
(
g_DesignSettings
.
m_TrackClearence
*
2
),
color
);
}
}
/* Display the short netname:
* we must filter tracks, to avoid a lot of texts.
* - only horizontal or vertical tracks are eligible
* - only tracks with a length > 10 * thickness are eligible
*/
#define THRESHOLD 10
if
(
(
m_End
.
x
-
m_Start
.
x
)
!=
0
&&
(
m_End
.
y
-
m_Start
.
y
)
!=
0
)
return
;
int
len
=
ABS
(
(
m_End
.
x
-
m_Start
.
x
)
+
(
m_End
.
y
-
m_Start
.
y
)
);
if
(
len
<
THRESHOLD
*
m_Width
)
return
;
if
(
GetNet
()
==
0
)
return
;
EQUIPOT
*
net
=
(
(
BOARD
*
)
GetParent
()
)
->
FindNet
(
GetNet
()
);
if
(
net
==
NULL
)
return
;
int
textlen
=
net
->
GetShortNetname
().
Len
();
if
(
textlen
>
0
)
{
// calculate a good size for the text
int
tsize
=
MIN
(
m_Width
,
len
/
textlen
);
wxPoint
tpos
=
m_Start
+
m_End
;
tpos
.
x
/=
2
;
tpos
.
y
/=
2
;
// Calculate angle: if the track segment is vertical, angle = 90 degrees
int
angle
=
0
;
if
(
(
m_End
.
x
-
m_Start
.
x
)
==
0
)
// Vertical segment
angle
=
900
;
// angle is in 0.1 degree
if
(
(
tsize
/
zoom
)
>=
6
)
{
tsize
=
(
tsize
*
8
)
/
10
;
// small reduction to give a better look
DrawGraphicText
(
panel
,
DC
,
tpos
,
WHITE
,
net
->
GetShortNetname
(),
angle
,
wxSize
(
tsize
,
tsize
),
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
tsize
/
7
);
}
}
}
}
...
@@ -768,12 +811,12 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
...
@@ -768,12 +811,12 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
// Display the short netname:
// Display the short netname:
if
(
GetNet
()
==
0
)
if
(
GetNet
()
==
0
)
return
;
return
;
EQUIPOT
*
net
=
(
(
BOARD
*
)
GetParent
()
)
->
FindNet
(
GetNet
()
);
EQUIPOT
*
net
=
(
(
BOARD
*
)
GetParent
()
)
->
FindNet
(
GetNet
()
);
if
(
net
==
NULL
)
if
(
net
==
NULL
)
return
;
return
;
int
len
=
net
->
GetShortNetname
().
Len
();
int
len
=
net
->
GetShortNetname
().
Len
();
if
(
len
>
0
)
if
(
len
>
0
)
{
{
// calculate a good size for the text
// calculate a good size for the text
int
tsize
=
m_Width
/
len
;
int
tsize
=
m_Width
/
len
;
...
...
pcbnew/cotation.cpp
View file @
beeaf53a
...
@@ -178,8 +178,6 @@ void WinEDA_CotationPropertiesFrame::OnOkClick( wxCommandEvent& event )
...
@@ -178,8 +178,6 @@ void WinEDA_CotationPropertiesFrame::OnOkClick( wxCommandEvent& event )
CurrentCotation
->
SetLayer
(
m_SelLayerBox
->
GetChoice
()
+
FIRST_NO_COPPER_LAYER
);
CurrentCotation
->
SetLayer
(
m_SelLayerBox
->
GetChoice
()
+
FIRST_NO_COPPER_LAYER
);
CurrentCotation
->
m_Text
->
SetLayer
(
m_SelLayerBox
->
GetChoice
()
+
FIRST_NO_COPPER_LAYER
);
CurrentCotation
->
m_Text
->
SetLayer
(
m_SelLayerBox
->
GetChoice
()
+
FIRST_NO_COPPER_LAYER
);
CurrentCotation
->
m_Text
->
CreateDrawData
();
if
(
m_DC
)
// Affichage nouveau texte
if
(
m_DC
)
// Affichage nouveau texte
{
{
/* Redessin du Texte */
/* Redessin du Texte */
...
@@ -482,5 +480,4 @@ static void Ajuste_Details_Cotation( COTATION* Cotation )
...
@@ -482,5 +480,4 @@ static void Ajuste_Details_Cotation( COTATION* Cotation )
Cotation
->
m_Value
=
mesure
;
Cotation
->
m_Value
=
mesure
;
valeur_param
(
Cotation
->
m_Value
,
msg
);
valeur_param
(
Cotation
->
m_Value
,
msg
);
Cotation
->
SetText
(
msg
);
Cotation
->
SetText
(
msg
);
Cotation
->
m_Text
->
CreateDrawData
();
}
}
pcbnew/pcbtexte.cpp
View file @
beeaf53a
...
@@ -233,7 +233,6 @@ void WinEDA_TextPCBPropertiesFrame::OnOkClick( wxCommandEvent& event )
...
@@ -233,7 +233,6 @@ void WinEDA_TextPCBPropertiesFrame::OnOkClick( wxCommandEvent& event )
CurrentTextPCB
->
m_Miroir
=
(
m_Mirror
->
GetSelection
()
==
0
)
?
1
:
0
;
CurrentTextPCB
->
m_Miroir
=
(
m_Mirror
->
GetSelection
()
==
0
)
?
1
:
0
;
CurrentTextPCB
->
m_Orient
=
m_Orient
->
GetSelection
()
*
900
;
CurrentTextPCB
->
m_Orient
=
m_Orient
->
GetSelection
()
*
900
;
CurrentTextPCB
->
SetLayer
(
m_SelLayerBox
->
GetChoice
()
);
CurrentTextPCB
->
SetLayer
(
m_SelLayerBox
->
GetChoice
()
);
CurrentTextPCB
->
CreateDrawData
();
if
(
m_DC
)
// Affichage nouveau texte
if
(
m_DC
)
// Affichage nouveau texte
{
{
...
@@ -283,7 +282,6 @@ void WinEDA_PcbFrame::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
...
@@ -283,7 +282,6 @@ void WinEDA_PcbFrame::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
if
(
TextePcb
==
NULL
)
if
(
TextePcb
==
NULL
)
return
;
return
;
TextePcb
->
CreateDrawData
();
TextePcb
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
TextePcb
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
...
@@ -407,8 +405,6 @@ void WinEDA_PcbFrame::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
...
@@ -407,8 +405,6 @@ void WinEDA_PcbFrame::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
if
(
TextePcb
->
m_Orient
<
0
)
if
(
TextePcb
->
m_Orient
<
0
)
TextePcb
->
m_Orient
+=
3600
;
TextePcb
->
m_Orient
+=
3600
;
TextePcb
->
CreateDrawData
();
/* Redessin du Texte */
/* Redessin du Texte */
TextePcb
->
Draw
(
DrawPanel
,
DC
,
drawmode
);
TextePcb
->
Draw
(
DrawPanel
,
DC
,
drawmode
);
TextePcb
->
Display_Infos
(
this
);
TextePcb
->
Display_Infos
(
this
);
...
...
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