diff --git a/eeschema/block.cpp b/eeschema/block.cpp index 2404a6df72..4be7d8957b 100644 --- a/eeschema/block.cpp +++ b/eeschema/block.cpp @@ -959,19 +959,7 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct { screen->RemoveFromDrawList( DrawStruct ); - switch( DrawStruct->Type() ) - { - 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 ); - } + panel->PostDirtyRect( DrawStruct->GetBoundingBox() ); /* Unlink the structure */ DrawStruct->Pnext = DrawStruct->Pback = NULL; // Only one struct -> no link diff --git a/eeschema/eeredraw.cpp b/eeschema/eeredraw.cpp index 8af5f1f698..22047b2bca 100644 --- a/eeschema/eeredraw.cpp +++ b/eeschema/eeredraw.cpp @@ -263,7 +263,7 @@ void DrawNoConnectStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint /*************************************************************************/ /* DRaw the "No Connect" symbol.. */ { -#define DELTA (DRAWNOCONNECT_SIZE / 2) + const int DELTA = (DRAWNOCONNECT_SIZE / 2); int pX, pY, color; int width = g_DrawMinimunLineWidth; @@ -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, int DrawMode, int Color ) @@ -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. * *****************************************************************************/ diff --git a/eeschema/program.h b/eeschema/program.h index ad89f428a1..9f08f9ab2b 100644 --- a/eeschema/program.h +++ b/eeschema/program.h @@ -160,6 +160,7 @@ public: DrawNoConnectStruct* GenCopy(); virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode, int Color = -1 ); + EDA_Rect GetBoundingBox(); }; @@ -189,6 +190,7 @@ public: wxPoint m_End(); // retourne la coord de fin du raccord virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode, int Color = -1 ); + EDA_Rect GetBoundingBox(); }; class DrawPolylineStruct : public EDA_BaseStruct /* Polyligne (serie de segments) */