Commit cc103ad3 authored by diemer's avatar diemer

Added GetBoundingBox() for DrawSheetStruct. Minor beautification.

parent 6d5a764e
...@@ -262,6 +262,20 @@ void DrawSheetStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& of ...@@ -262,6 +262,20 @@ void DrawSheetStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& of
} }
} }
EDA_Rect DrawSheetStruct::GetBoundingBox(){
int dx, dy;
// 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;
textlen1 = MAX(textlen1, textlen2);
dx = MAX(m_Size.x, textlen1 );
dy = m_Size.y+m_SheetNameSize+m_FileNameSize+16;
EDA_Rect box(wxPoint(m_Pos.x,m_Pos.y-m_SheetNameSize-8), wxSize(dx,dy) );
return box;
}
/**************************************************************************************/ /**************************************************************************************/
void DrawSheetStruct::DeleteAnnotation( bool recurse ) void DrawSheetStruct::DeleteAnnotation( bool recurse )
......
...@@ -130,6 +130,7 @@ public: ...@@ -130,6 +130,7 @@ public:
void CleanupSheet( WinEDA_SchematicFrame* frame, wxDC* DC ); void CleanupSheet( WinEDA_SchematicFrame* frame, wxDC* DC );
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color = -1 ); int draw_mode, int Color = -1 );
EDA_Rect GetBoundingBox();
void SwapData( DrawSheetStruct* copyitem ); void SwapData( DrawSheetStruct* copyitem );
void DeleteAnnotation( bool recurse ); void DeleteAnnotation( bool recurse );
int ComponentCount(); int ComponentCount();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment