Commit 81b6cbcb authored by diemer's avatar diemer

added GetBoundingBox for SCH_TEXT. Beatufication.

parent dbb69b75
...@@ -467,3 +467,54 @@ void SCH_GLOBALLABEL::CreateGraphicShape( int* corner_list, const wxPoint& Pos ) ...@@ -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 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;
}
...@@ -82,7 +82,7 @@ class SCH_TEXT : public SCH_ITEM ...@@ -82,7 +82,7 @@ class SCH_TEXT : public SCH_ITEM
public: public:
int m_Layer; int m_Layer;
int m_Shape; int m_Shape;
bool m_IsDangling; // TRUE si non connect� bool m_IsDangling; // TRUE if not connected
public: public:
SCH_TEXT( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString, SCH_TEXT( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString,
...@@ -102,6 +102,7 @@ public: ...@@ -102,6 +102,7 @@ public:
void SwapData( SCH_TEXT* copyitem ); void SwapData( SCH_TEXT* copyitem );
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC ); virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );
EDA_Rect GetBoundingBox();
}; };
......
...@@ -52,7 +52,7 @@ public: ...@@ -52,7 +52,7 @@ public:
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "PartText" ); return wxT( "PartTextStruct" );
} }
......
...@@ -191,7 +191,7 @@ int distance(int dx, int dy, int spot_cX, int spot_cY, int seuil); ...@@ -191,7 +191,7 @@ int distance(int dx, int dy, int spot_cX, int spot_cY, int seuil);
/***************/ /***************/
/* EEREDRAW.CPP */ /* EEREDRAW.CPP */
/***************/ /***************/
void DrawDanglingSymbol(WinEDA_DrawPanel * panel,wxDC * DC, void DrawDanglingSymbol(WinEDA_DrawPanel * panel,wxDC * DC,
const wxPoint & pos, int Color); const wxPoint & pos, int Color);
void Draw_Marqueur(WinEDA_DrawPanel * panel, wxDC * DC, void Draw_Marqueur(WinEDA_DrawPanel * panel, wxDC * DC,
......
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