From cc103ad317f20eb24e3c2f317742dd484af89acd Mon Sep 17 00:00:00 2001 From: diemer Date: Sun, 30 Mar 2008 10:14:37 +0000 Subject: [PATCH] Added GetBoundingBox() for DrawSheetStruct. Minor beautification. --- eeschema/class_drawsheet.cpp | 14 ++++++++++++++ eeschema/class_screen.h | 7 ++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/eeschema/class_drawsheet.cpp b/eeschema/class_drawsheet.cpp index 9452384cf0..ae6726409f 100644 --- a/eeschema/class_drawsheet.cpp +++ b/eeschema/class_drawsheet.cpp @@ -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 ) diff --git a/eeschema/class_screen.h b/eeschema/class_screen.h index 246a3e419f..3a049afb92 100644 --- a/eeschema/class_screen.h +++ b/eeschema/class_screen.h @@ -130,6 +130,7 @@ public: void CleanupSheet( WinEDA_SchematicFrame* frame, wxDC* DC ); virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode, int Color = -1 ); + EDA_Rect GetBoundingBox(); void SwapData( DrawSheetStruct* copyitem ); void DeleteAnnotation( bool recurse ); int ComponentCount(); @@ -137,9 +138,9 @@ public: bool SearchHierarchy( wxString filename, SCH_SCREEN** screen ); bool LocatePathOfScreen( SCH_SCREEN* screen, DrawSheetPath* list ); int CountSheets(); - wxString GetFileName(void); - void SetFileName(const wxString & aFilename); // Set a new filename without changing anything else - bool ChangeFileName(WinEDA_SchematicFrame * aFrame, const wxString & aFileName); // Set a new filename and manage data and associated screen + wxString GetFileName(void); + void SetFileName(const wxString & aFilename); // Set a new filename without changing anything else + bool ChangeFileName(WinEDA_SchematicFrame * aFrame, const wxString & aFileName); // Set a new filename and manage data and associated screen //void RemoveSheet(DrawSheetStruct* sheet); //to remove a sheet, just delete it