diff --git a/eeschema/class_text-label.cpp b/eeschema/class_text-label.cpp index abf41f7175..b13f0d47d1 100644 --- a/eeschema/class_text-label.cpp +++ b/eeschema/class_text-label.cpp @@ -467,3 +467,54 @@ void SCH_GLOBALLABEL::CreateGraphicShape( int* corner_list, const wxPoint& Pos ) corner_list[12] = corner_list[0]; corner_list[13] = corner_list[1]; // closing } + + +EDA_Rect SCH_TEXT::GetBoundingBox() +{ + int x, y, dx, dy, dangle, length, height; + + x = m_Pos.x; + y = m_Pos.y; + length = ( Pitch() * GetLength() ); + height = m_Size.y; + + if( m_IsDangling ) + dangle = DANGLING_SYMBOL_SIZE; + else + dangle = 0; + + switch( m_Orient ) // respect orientation + { + case 0: /* Horiz Normal Orientation (left justified) */ + dx = 2*dangle + length; + dy = -2*dangle - height - TXTMARGE; + x -= dangle; + y += dangle; + break; + + case 1: /* Vert Orientation UP */ + dx = -2*dangle - height - TXTMARGE; + dy = -2*dangle - length; + x += dangle; + y += dangle; + break; + + case 2: /* Horiz Orientation - Right justified */ + dx = -2*dangle - length; + dy = -2*dangle - height - TXTMARGE; + x += dangle; + y += dangle; + break; + + case 3: /* Vert Orientation BOTTOM */ + dx = -2*dangle - height - TXTMARGE; + dy = 2*dangle + length; + x += dangle; + y -= dangle; + break; + } + + EDA_Rect box(wxPoint(x,y), wxSize(dx,dy) ); + box.Normalize(); + return box; +} diff --git a/eeschema/class_text-label.h b/eeschema/class_text-label.h index bea99d9c12..896f15639e 100644 --- a/eeschema/class_text-label.h +++ b/eeschema/class_text-label.h @@ -82,7 +82,7 @@ class SCH_TEXT : public SCH_ITEM public: int m_Layer; int m_Shape; - bool m_IsDangling; // TRUE si non connect� + bool m_IsDangling; // TRUE if not connected public: SCH_TEXT( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString, @@ -102,6 +102,7 @@ public: void SwapData( SCH_TEXT* copyitem ); virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC ); + EDA_Rect GetBoundingBox(); }; diff --git a/eeschema/component_class.h b/eeschema/component_class.h index 38f25d8b16..46334f4fd3 100644 --- a/eeschema/component_class.h +++ b/eeschema/component_class.h @@ -52,7 +52,7 @@ public: virtual wxString GetClass() const { - return wxT( "PartText" ); + return wxT( "PartTextStruct" ); } diff --git a/eeschema/protos.h b/eeschema/protos.h index b7fe987e77..5cc30743a7 100644 --- a/eeschema/protos.h +++ b/eeschema/protos.h @@ -191,7 +191,7 @@ int distance(int dx, int dy, int spot_cX, int spot_cY, int seuil); /***************/ /* EEREDRAW.CPP */ /***************/ -void DrawDanglingSymbol(WinEDA_DrawPanel * panel,wxDC * DC, +void DrawDanglingSymbol(WinEDA_DrawPanel * panel,wxDC * DC, const wxPoint & pos, int Color); void Draw_Marqueur(WinEDA_DrawPanel * panel, wxDC * DC,