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
c4815e1d
Commit
c4815e1d
authored
Mar 30, 2008
by
diemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplified GetBoundingBox to always include the dangling symbol.
parent
cc103ad3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
78 deletions
+63
-78
class_text-label.cpp
eeschema/class_text-label.cpp
+63
-78
No files found.
eeschema/class_text-label.cpp
View file @
c4815e1d
...
@@ -307,25 +307,20 @@ void SCH_HIERLABEL::CreateGraphicShape( int* corner_list, const wxPoint& Pos )
...
@@ -307,25 +307,20 @@ void SCH_HIERLABEL::CreateGraphicShape( int* corner_list, const wxPoint& Pos )
EDA_Rect
SCH_HIERLABEL
::
GetBoundingBox
()
EDA_Rect
SCH_HIERLABEL
::
GetBoundingBox
()
{
{
int
x
,
y
,
dx
,
dy
,
dangle
,
length
,
height
;
int
x
,
y
,
dx
,
dy
,
length
,
height
;
x
=
m_Pos
.
x
;
x
=
m_Pos
.
x
;
y
=
m_Pos
.
y
;
y
=
m_Pos
.
y
;
if
(
m_IsDangling
)
dangle
=
DANGLING_SYMBOL_SIZE
;
else
dangle
=
0
;
height
=
m_Size
.
y
+
2
*
TXTMARGE
;
height
=
m_Size
.
y
+
2
*
TXTMARGE
;
length
=
(
Pitch
()
*
GetLength
()
)
+
height
+
2
*
dangle
;
// add height for triangular shapes
length
=
(
Pitch
()
*
GetLength
()
)
+
height
+
2
*
DANGLING_SYMBOL_SIZE
;
// add height for triangular shapes
switch
(
m_Orient
)
// respect orientation
switch
(
m_Orient
)
// respect orientation
{
{
case
0
:
/* Horiz Normal Orientation (left justified) */
case
0
:
/* Horiz Normal Orientation (left justified) */
dx
=
-
length
;
dx
=
-
length
;
dy
=
height
;
dy
=
height
;
x
+=
dangle
;
x
+=
DANGLING_SYMBOL_SIZE
;
y
-=
height
/
2
;
y
-=
height
/
2
;
break
;
break
;
...
@@ -333,13 +328,13 @@ EDA_Rect SCH_HIERLABEL::GetBoundingBox()
...
@@ -333,13 +328,13 @@ EDA_Rect SCH_HIERLABEL::GetBoundingBox()
dx
=
height
;
dx
=
height
;
dy
=
length
;
dy
=
length
;
x
-=
height
/
2
;
x
-=
height
/
2
;
y
-=
dangle
;
y
-=
DANGLING_SYMBOL_SIZE
;
break
;
break
;
case
2
:
/* Horiz Orientation - Right justified */
case
2
:
/* Horiz Orientation - Right justified */
dx
=
length
;
dx
=
length
;
dy
=
height
;
dy
=
height
;
x
-=
dangle
;
x
-=
DANGLING_SYMBOL_SIZE
;
y
-=
height
/
2
;
y
-=
height
/
2
;
break
;
break
;
...
@@ -347,7 +342,7 @@ EDA_Rect SCH_HIERLABEL::GetBoundingBox()
...
@@ -347,7 +342,7 @@ EDA_Rect SCH_HIERLABEL::GetBoundingBox()
dx
=
height
;
dx
=
height
;
dy
=
-
length
;
dy
=
-
length
;
x
-=
height
/
2
;
x
-=
height
/
2
;
y
+=
dangle
;
y
+=
DANGLING_SYMBOL_SIZE
;
break
;
break
;
}
}
...
@@ -521,25 +516,20 @@ void SCH_GLOBALLABEL::CreateGraphicShape( int* corner_list, const wxPoint& Pos )
...
@@ -521,25 +516,20 @@ void SCH_GLOBALLABEL::CreateGraphicShape( int* corner_list, const wxPoint& Pos )
EDA_Rect
SCH_GLOBALLABEL
::
GetBoundingBox
()
EDA_Rect
SCH_GLOBALLABEL
::
GetBoundingBox
()
{
{
int
x
,
y
,
dx
,
dy
,
dangle
,
length
,
height
;
int
x
,
y
,
dx
,
dy
,
length
,
height
;
x
=
m_Pos
.
x
;
x
=
m_Pos
.
x
;
y
=
m_Pos
.
y
;
y
=
m_Pos
.
y
;
if
(
m_IsDangling
)
dangle
=
DANGLING_SYMBOL_SIZE
;
else
dangle
=
0
;
height
=
m_Size
.
y
+
2
*
TXTMARGE
;
height
=
m_Size
.
y
+
2
*
TXTMARGE
;
length
=
(
Pitch
()
*
GetLength
()
)
+
2
*
height
+
2
*
dangle
;
// add 2*height for triangular shapes (bidirectional)
length
=
(
Pitch
()
*
GetLength
()
)
+
2
*
height
+
2
*
DANGLING_SYMBOL_SIZE
;
// add 2*height for triangular shapes (bidirectional)
switch
(
m_Orient
)
// respect orientation
switch
(
m_Orient
)
// respect orientation
{
{
case
0
:
/* Horiz Normal Orientation (left justified) */
case
0
:
/* Horiz Normal Orientation (left justified) */
dx
=
-
length
;
dx
=
-
length
;
dy
=
height
;
dy
=
height
;
x
+=
dangle
;
x
+=
DANGLING_SYMBOL_SIZE
;
y
-=
height
/
2
;
y
-=
height
/
2
;
break
;
break
;
...
@@ -547,13 +537,13 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox()
...
@@ -547,13 +537,13 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox()
dx
=
height
;
dx
=
height
;
dy
=
length
;
dy
=
length
;
x
-=
height
/
2
;
x
-=
height
/
2
;
y
-=
dangle
;
y
-=
DANGLING_SYMBOL_SIZE
;
break
;
break
;
case
2
:
/* Horiz Orientation - Right justified */
case
2
:
/* Horiz Orientation - Right justified */
dx
=
length
;
dx
=
length
;
dy
=
height
;
dy
=
height
;
x
-=
dangle
;
x
-=
DANGLING_SYMBOL_SIZE
;
y
-=
height
/
2
;
y
-=
height
/
2
;
break
;
break
;
...
@@ -561,7 +551,7 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox()
...
@@ -561,7 +551,7 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox()
dx
=
height
;
dx
=
height
;
dy
=
-
length
;
dy
=
-
length
;
x
-=
height
/
2
;
x
-=
height
/
2
;
y
+=
dangle
;
y
+=
DANGLING_SYMBOL_SIZE
;
break
;
break
;
}
}
...
@@ -573,46 +563,41 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox()
...
@@ -573,46 +563,41 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox()
EDA_Rect
SCH_TEXT
::
GetBoundingBox
()
EDA_Rect
SCH_TEXT
::
GetBoundingBox
()
{
{
int
x
,
y
,
dx
,
dy
,
dangle
,
length
,
height
;
int
x
,
y
,
dx
,
dy
,
length
,
height
;
x
=
m_Pos
.
x
;
x
=
m_Pos
.
x
;
y
=
m_Pos
.
y
;
y
=
m_Pos
.
y
;
length
=
(
Pitch
()
*
GetLength
()
);
length
=
(
Pitch
()
*
GetLength
()
);
height
=
m_Size
.
y
;
height
=
m_Size
.
y
;
if
(
m_IsDangling
)
dangle
=
DANGLING_SYMBOL_SIZE
;
else
dangle
=
0
;
switch
(
m_Orient
)
// respect orientation
switch
(
m_Orient
)
// respect orientation
{
{
case
0
:
/* Horiz Normal Orientation (left justified) */
case
0
:
/* Horiz Normal Orientation (left justified) */
dx
=
2
*
dangle
+
length
;
dx
=
2
*
DANGLING_SYMBOL_SIZE
+
length
;
dy
=
-
2
*
dangle
-
height
-
TXTMARGE
;
dy
=
-
2
*
DANGLING_SYMBOL_SIZE
-
height
-
TXTMARGE
;
x
-=
dangle
;
x
-=
DANGLING_SYMBOL_SIZE
;
y
+=
dangle
;
y
+=
DANGLING_SYMBOL_SIZE
;
break
;
break
;
case
1
:
/* Vert Orientation UP */
case
1
:
/* Vert Orientation UP */
dx
=
-
2
*
dangle
-
height
-
TXTMARGE
;
dx
=
-
2
*
DANGLING_SYMBOL_SIZE
-
height
-
TXTMARGE
;
dy
=
-
2
*
dangle
-
length
;
dy
=
-
2
*
DANGLING_SYMBOL_SIZE
-
length
;
x
+=
dangle
;
x
+=
DANGLING_SYMBOL_SIZE
;
y
+=
dangle
;
y
+=
DANGLING_SYMBOL_SIZE
;
break
;
break
;
case
2
:
/* Horiz Orientation - Right justified */
case
2
:
/* Horiz Orientation - Right justified */
dx
=
-
2
*
dangle
-
length
;
dx
=
-
2
*
DANGLING_SYMBOL_SIZE
-
length
;
dy
=
-
2
*
dangle
-
height
-
TXTMARGE
;
dy
=
-
2
*
DANGLING_SYMBOL_SIZE
-
height
-
TXTMARGE
;
x
+=
dangle
;
x
+=
DANGLING_SYMBOL_SIZE
;
y
+=
dangle
;
y
+=
DANGLING_SYMBOL_SIZE
;
break
;
break
;
case
3
:
/* Vert Orientation BOTTOM */
case
3
:
/* Vert Orientation BOTTOM */
dx
=
-
2
*
dangle
-
height
-
TXTMARGE
;
dx
=
-
2
*
DANGLING_SYMBOL_SIZE
-
height
-
TXTMARGE
;
dy
=
2
*
dangle
+
length
;
dy
=
2
*
DANGLING_SYMBOL_SIZE
+
length
;
x
+=
dangle
;
x
+=
DANGLING_SYMBOL_SIZE
;
y
-=
dangle
;
y
-=
DANGLING_SYMBOL_SIZE
;
break
;
break
;
}
}
...
...
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