Commit f12a19fe authored by diemer's avatar diemer

Added GetBoundingBox() for DrawNoConnectStruct, DrawBusEntryStruct. Removed...

Added GetBoundingBox() for DrawNoConnectStruct, DrawBusEntryStruct. Removed old XOR method form DeleteStruct(). 
parent 08467e09
...@@ -959,19 +959,7 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct ...@@ -959,19 +959,7 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct
{ {
screen->RemoveFromDrawList( DrawStruct ); screen->RemoveFromDrawList( DrawStruct );
switch( DrawStruct->Type() ) panel->PostDirtyRect( DrawStruct->GetBoundingBox() );
{
case DRAW_SEGMENT_STRUCT_TYPE:
case DRAW_JUNCTION_STRUCT_TYPE:
case TYPE_SCH_COMPONENT:
panel->PostDirtyRect( DrawStruct->GetBoundingBox() );
break;
// other classes do not yet have GetBoundingBox() implementations
default:
D( DrawStruct->Show( 0, std::cout ); ) // tell me which classes still need GetBoundingBox support
RedrawOneStruct( panel, DC, DrawStruct, g_XorMode );
}
/* Unlink the structure */ /* Unlink the structure */
DrawStruct->Pnext = DrawStruct->Pback = NULL; // Only one struct -> no link DrawStruct->Pnext = DrawStruct->Pback = NULL; // Only one struct -> no link
......
...@@ -263,7 +263,7 @@ void DrawNoConnectStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint ...@@ -263,7 +263,7 @@ void DrawNoConnectStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint
/*************************************************************************/ /*************************************************************************/
/* DRaw the "No Connect" symbol.. */ /* DRaw the "No Connect" symbol.. */
{ {
#define DELTA (DRAWNOCONNECT_SIZE / 2) const int DELTA = (DRAWNOCONNECT_SIZE / 2);
int pX, pY, color; int pX, pY, color;
int width = g_DrawMinimunLineWidth; int width = g_DrawMinimunLineWidth;
...@@ -280,6 +280,15 @@ void DrawNoConnectStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint ...@@ -280,6 +280,15 @@ void DrawNoConnectStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint
} }
EDA_Rect DrawNoConnectStruct::GetBoundingBox()
{
const int DELTA = (DRAWNOCONNECT_SIZE / 2);
EDA_Rect box( wxPoint(m_Pos.x-DELTA,m_Pos.y-DELTA), wxSize(2*DELTA,2*DELTA) );
box.Normalize();
return box;
}
/**************************************************************/ /**************************************************************/
void DrawBusEntryStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, void DrawBusEntryStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color ) int DrawMode, int Color )
...@@ -306,6 +315,15 @@ void DrawBusEntryStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& ...@@ -306,6 +315,15 @@ void DrawBusEntryStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint&
} }
EDA_Rect DrawBusEntryStruct::GetBoundingBox()
{
int dx = m_Pos.x - m_End().x;
int dy = m_Pos.y - m_End().y;
EDA_Rect box( wxPoint(m_Pos.x,m_Pos.y), wxSize(dx,dy) );
box.Normalize();
return box;
}
/***************************************************************************** /*****************************************************************************
* Routine to redraw polyline struct. * * Routine to redraw polyline struct. *
*****************************************************************************/ *****************************************************************************/
......
...@@ -160,6 +160,7 @@ public: ...@@ -160,6 +160,7 @@ public:
DrawNoConnectStruct* GenCopy(); DrawNoConnectStruct* GenCopy();
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();
}; };
...@@ -189,6 +190,7 @@ public: ...@@ -189,6 +190,7 @@ public:
wxPoint m_End(); // retourne la coord de fin du raccord wxPoint m_End(); // retourne la coord de fin du raccord
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();
}; };
class DrawPolylineStruct : public EDA_BaseStruct /* Polyligne (serie de segments) */ class DrawPolylineStruct : public EDA_BaseStruct /* Polyligne (serie de segments) */
......
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