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
1809f692
Commit
1809f692
authored
Apr 29, 2011
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Eeschema: SCH_SHEET::GetBoundingBox(): better bounding box calculation.
parent
f2e6170f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
13 deletions
+24
-13
sch_sheet.cpp
eeschema/sch_sheet.cpp
+24
-13
No files found.
eeschema/sch_sheet.cpp
View file @
1809f692
...
...
@@ -525,7 +525,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
int
name_orientation
;
wxPoint
pos_sheetname
,
pos_filename
;
wxPoint
pos
=
m_Pos
+
aOffset
;
int
LineWidth
=
g_DrawDefaultLineThickness
;
int
lineWidth
=
GetPenSize
()
;
if
(
aColor
>=
0
)
color
=
aColor
;
...
...
@@ -535,7 +535,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
GRSetDrawMode
(
aDC
,
aDrawMode
);
GRRect
(
&
aPanel
->
m_ClipBox
,
aDC
,
pos
.
x
,
pos
.
y
,
pos
.
x
+
m_Size
.
x
,
pos
.
y
+
m_Size
.
y
,
L
ineWidth
,
color
);
pos
.
x
+
m_Size
.
x
,
pos
.
y
+
m_Size
.
y
,
l
ineWidth
,
color
);
pos_sheetname
=
GetSheetNamePosition
()
+
aOffset
;
pos_filename
=
GetFileNamePosition
()
+
aOffset
;
...
...
@@ -555,7 +555,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
DrawGraphicText
(
aPanel
,
aDC
,
pos_sheetname
,
(
EDA_Colors
)
txtcolor
,
Text
,
name_orientation
,
wxSize
(
m_SheetNameSize
,
m_SheetNameSize
),
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_VJUSTIFY_BOTTOM
,
L
ineWidth
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_VJUSTIFY_BOTTOM
,
l
ineWidth
,
false
,
false
);
/* Draw text : FileName */
...
...
@@ -568,7 +568,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
DrawGraphicText
(
aPanel
,
aDC
,
pos_filename
,
(
EDA_Colors
)
txtcolor
,
Text
,
name_orientation
,
wxSize
(
m_FileNameSize
,
m_FileNameSize
),
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_VJUSTIFY_TOP
,
L
ineWidth
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_VJUSTIFY_TOP
,
l
ineWidth
,
false
,
false
);
...
...
@@ -583,19 +583,30 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
EDA_RECT
SCH_SHEET
::
GetBoundingBox
()
const
{
int
dx
,
dy
;
wxPoint
end
;
EDA_RECT
box
(
m_Pos
,
m_Size
);
int
lineWidth
=
GetPenSize
();
// Determine length of texts
wxString
Text1
=
wxT
(
"Sheet: "
)
+
m_SheetName
;
wxString
Text2
=
wxT
(
"File: "
)
+
m_FileName
;
int
textlen1
=
10
*
Text1
.
Len
()
*
m_SheetNameSize
/
9
;
int
textlen2
=
10
*
Text2
.
Len
()
*
m_FileNameSize
/
9
;
wxString
text
=
wxT
(
"Sheet: "
)
+
m_SheetName
;
int
textlen
=
ReturnGraphicTextWidth
(
text
,
m_SheetNameSize
,
false
,
lineWidth
)
;
text
=
wxT
(
"File: "
)
+
m_FileName
;
int
textlen2
=
ReturnGraphicTextWidth
(
text
,
m_FileNameSize
,
false
,
lineWidth
)
;
textlen1
=
MAX
(
textlen1
,
textlen2
);
dx
=
MAX
(
m_Size
.
x
,
textlen1
);
dy
=
m_Size
.
y
+
m_SheetNameSize
+
m_FileNameSize
+
16
;
// Calculate bounding box X size:
textlen
=
MAX
(
textlen
,
textlen2
);
end
.
x
=
MAX
(
m_Size
.
x
,
textlen
)
;
EDA_RECT
box
(
wxPoint
(
m_Pos
.
x
,
m_Pos
.
y
-
m_SheetNameSize
-
8
),
wxSize
(
dx
,
dy
)
);
// Calculate bounding box pos:
end
.
y
=
m_Size
.
y
;
end
+=
m_Pos
;
// Move upper and lower limits to include texts:
box
.
m_Pos
.
y
-=
wxRound
(
m_SheetNameSize
*
1.3
)
+
8
;
end
.
y
+=
wxRound
(
m_FileNameSize
*
1.3
)
+
8
;
box
.
SetEnd
(
end
);
box
.
Inflate
(
lineWidth
/
2
);
return
box
;
}
...
...
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