Loading eeschema/block.cpp +7 −3 Original line number Original line Diff line number Diff line Loading @@ -962,13 +962,17 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct { { screen->RemoveFromDrawList( DrawStruct ); screen->RemoveFromDrawList( DrawStruct ); if( DrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE ) if( (DrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE) || (DrawStruct->Type() == DRAW_JUNCTION_STRUCT_TYPE) || (DrawStruct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE) ) { { D( printf("PostDirtyRect()\n"); ) panel->PostDirtyRect( DrawStruct->GetBoundingBox() ); panel->PostDirtyRect( ((EDA_DrawLineStruct*)DrawStruct)->GetBoundingBox() ); } } else else { D( DrawStruct->Show( 0, std::cout ); ) // tell me which classes still need GetBoundingBox support RedrawOneStruct( panel, DC, DrawStruct, g_XorMode ); 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 Loading eeschema/cmpclass.cpp +43 −1 Original line number Original line Diff line number Diff line Loading @@ -241,7 +241,7 @@ void EDA_DrawLineStruct::Show( int nestLevel, std::ostream& os ) EDA_Rect EDA_DrawLineStruct::GetBoundingBox() const EDA_Rect EDA_DrawLineStruct::GetBoundingBox() { { int width = 25; int width = 25; Loading @@ -257,7 +257,49 @@ EDA_Rect EDA_DrawLineStruct::GetBoundingBox() const return ret; return ret; } } EDA_Rect DrawJunctionStruct::GetBoundingBox() { int width = DRAWJUNCTION_SIZE * 2; int xmin = m_Pos.x - DRAWJUNCTION_SIZE ; int ymin = m_Pos.y - DRAWJUNCTION_SIZE; EDA_Rect ret( wxPoint( xmin, ymin ), wxSize( width, width ) ); return ret; }; EDA_Rect EDA_SchComponentStruct::GetBoundingBox() { const int PADDING = 40; int xmin, xmax, ymin, ymax; // This gives a reasonable approximation (but some things are missing so... EDA_Rect ret = GetBoundaryBox(); xmin = ret.m_Pos.x; ymin = ret.m_Pos.y; xmax = ret.m_Pos.x + ret.m_Size.x; ymax = ret.m_Pos.y + ret.m_Size.y; // Include BoundingBoxes of fields for( int i = REFERENCE; i < NUMBER_OF_FIELDS; i++ ) { EDA_Rect box = m_Field[i].GetBoundaryBox(); xmin = MIN( xmin, box.m_Pos.x); ymin = MIN( ymin, box.m_Pos.y); xmax = MAX( xmax, box.m_Pos.x + box.m_Size.x); ymax = MAX( ymax, box.m_Pos.y + box.m_Size.y); } // ... add padding TODO: improve this ret.m_Pos.x = xmin - PADDING; ret.m_Pos.y = ymin - PADDING; ret.m_Size.x = xmax - xmin + 2*PADDING; ret.m_Size.y = ymax - ymin + 2*PADDING; D( printf("final box: %d,%d, %d,%d\n", ret.m_Pos.x, ret.m_Pos.y, ret.m_Size.x, ret.m_Size.y); ) return ret; } /****************************/ /****************************/ /* Class DrawPolylineStruct */ /* Class DrawPolylineStruct */ Loading eeschema/component_class.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -234,7 +234,7 @@ EDA_SchComponentStruct::EDA_SchComponentStruct( const wxPoint& pos ) : /************************************************/ /************************************************/ EDA_Rect EDA_SchComponentStruct::GetBoundaryBox() EDA_Rect EDA_SchComponentStruct::GetBoundaryBox() const /************************************************/ /************************************************/ { { EDA_LibComponentStruct* Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); EDA_LibComponentStruct* Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); Loading Loading @@ -733,7 +733,7 @@ bool PartTextStruct::IsVoid() /********************************************/ /********************************************/ EDA_Rect PartTextStruct::GetBoundaryBox() EDA_Rect PartTextStruct::GetBoundaryBox() const /********************************************/ /********************************************/ /* return /* return Loading eeschema/component_class.h +3 −2 Original line number Original line Diff line number Diff line Loading @@ -59,7 +59,7 @@ public: void PartTextCopy( PartTextStruct* target ); void PartTextCopy( PartTextStruct* target ); void Place( WinEDA_DrawFrame* frame, wxDC* DC ); void Place( WinEDA_DrawFrame* frame, wxDC* DC ); EDA_Rect GetBoundaryBox(); EDA_Rect GetBoundaryBox() const; bool IsVoid(); bool IsVoid(); void SwapData( PartTextStruct* copyitem ); void SwapData( PartTextStruct* copyitem ); }; }; Loading Loading @@ -123,7 +123,8 @@ public: wxPoint GetScreenCoord( const wxPoint& coord ); wxPoint GetScreenCoord( const wxPoint& coord ); void Display_Infos( WinEDA_DrawFrame* frame ); void Display_Infos( WinEDA_DrawFrame* frame ); void ClearAnnotation(); void ClearAnnotation(); EDA_Rect GetBoundaryBox(); EDA_Rect GetBoundaryBox() const; EDA_Rect GetBoundingBox(); const wxString& ReturnFieldName( int aFieldNdx ) const; const wxString& ReturnFieldName( int aFieldNdx ) const; Loading eeschema/program.h +2 −6 Original line number Original line Diff line number Diff line Loading @@ -91,12 +91,7 @@ public: return m_Start == m_End; return m_Start == m_End; } } EDA_Rect GetBoundingBox(); /** * Function GetBoundingBox * returns the bounding box of this TRACK */ EDA_Rect GetBoundingBox() const; virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode, int Color = -1 ); int Color = -1 ); Loading Loading @@ -234,6 +229,7 @@ public: return wxT( "DrawJunction" ); return wxT( "DrawJunction" ); } } EDA_Rect GetBoundingBox(); DrawJunctionStruct* GenCopy(); DrawJunctionStruct* GenCopy(); virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, Loading Loading
eeschema/block.cpp +7 −3 Original line number Original line Diff line number Diff line Loading @@ -962,13 +962,17 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct { { screen->RemoveFromDrawList( DrawStruct ); screen->RemoveFromDrawList( DrawStruct ); if( DrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE ) if( (DrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE) || (DrawStruct->Type() == DRAW_JUNCTION_STRUCT_TYPE) || (DrawStruct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE) ) { { D( printf("PostDirtyRect()\n"); ) panel->PostDirtyRect( DrawStruct->GetBoundingBox() ); panel->PostDirtyRect( ((EDA_DrawLineStruct*)DrawStruct)->GetBoundingBox() ); } } else else { D( DrawStruct->Show( 0, std::cout ); ) // tell me which classes still need GetBoundingBox support RedrawOneStruct( panel, DC, DrawStruct, g_XorMode ); 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 Loading
eeschema/cmpclass.cpp +43 −1 Original line number Original line Diff line number Diff line Loading @@ -241,7 +241,7 @@ void EDA_DrawLineStruct::Show( int nestLevel, std::ostream& os ) EDA_Rect EDA_DrawLineStruct::GetBoundingBox() const EDA_Rect EDA_DrawLineStruct::GetBoundingBox() { { int width = 25; int width = 25; Loading @@ -257,7 +257,49 @@ EDA_Rect EDA_DrawLineStruct::GetBoundingBox() const return ret; return ret; } } EDA_Rect DrawJunctionStruct::GetBoundingBox() { int width = DRAWJUNCTION_SIZE * 2; int xmin = m_Pos.x - DRAWJUNCTION_SIZE ; int ymin = m_Pos.y - DRAWJUNCTION_SIZE; EDA_Rect ret( wxPoint( xmin, ymin ), wxSize( width, width ) ); return ret; }; EDA_Rect EDA_SchComponentStruct::GetBoundingBox() { const int PADDING = 40; int xmin, xmax, ymin, ymax; // This gives a reasonable approximation (but some things are missing so... EDA_Rect ret = GetBoundaryBox(); xmin = ret.m_Pos.x; ymin = ret.m_Pos.y; xmax = ret.m_Pos.x + ret.m_Size.x; ymax = ret.m_Pos.y + ret.m_Size.y; // Include BoundingBoxes of fields for( int i = REFERENCE; i < NUMBER_OF_FIELDS; i++ ) { EDA_Rect box = m_Field[i].GetBoundaryBox(); xmin = MIN( xmin, box.m_Pos.x); ymin = MIN( ymin, box.m_Pos.y); xmax = MAX( xmax, box.m_Pos.x + box.m_Size.x); ymax = MAX( ymax, box.m_Pos.y + box.m_Size.y); } // ... add padding TODO: improve this ret.m_Pos.x = xmin - PADDING; ret.m_Pos.y = ymin - PADDING; ret.m_Size.x = xmax - xmin + 2*PADDING; ret.m_Size.y = ymax - ymin + 2*PADDING; D( printf("final box: %d,%d, %d,%d\n", ret.m_Pos.x, ret.m_Pos.y, ret.m_Size.x, ret.m_Size.y); ) return ret; } /****************************/ /****************************/ /* Class DrawPolylineStruct */ /* Class DrawPolylineStruct */ Loading
eeschema/component_class.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -234,7 +234,7 @@ EDA_SchComponentStruct::EDA_SchComponentStruct( const wxPoint& pos ) : /************************************************/ /************************************************/ EDA_Rect EDA_SchComponentStruct::GetBoundaryBox() EDA_Rect EDA_SchComponentStruct::GetBoundaryBox() const /************************************************/ /************************************************/ { { EDA_LibComponentStruct* Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); EDA_LibComponentStruct* Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); Loading Loading @@ -733,7 +733,7 @@ bool PartTextStruct::IsVoid() /********************************************/ /********************************************/ EDA_Rect PartTextStruct::GetBoundaryBox() EDA_Rect PartTextStruct::GetBoundaryBox() const /********************************************/ /********************************************/ /* return /* return Loading
eeschema/component_class.h +3 −2 Original line number Original line Diff line number Diff line Loading @@ -59,7 +59,7 @@ public: void PartTextCopy( PartTextStruct* target ); void PartTextCopy( PartTextStruct* target ); void Place( WinEDA_DrawFrame* frame, wxDC* DC ); void Place( WinEDA_DrawFrame* frame, wxDC* DC ); EDA_Rect GetBoundaryBox(); EDA_Rect GetBoundaryBox() const; bool IsVoid(); bool IsVoid(); void SwapData( PartTextStruct* copyitem ); void SwapData( PartTextStruct* copyitem ); }; }; Loading Loading @@ -123,7 +123,8 @@ public: wxPoint GetScreenCoord( const wxPoint& coord ); wxPoint GetScreenCoord( const wxPoint& coord ); void Display_Infos( WinEDA_DrawFrame* frame ); void Display_Infos( WinEDA_DrawFrame* frame ); void ClearAnnotation(); void ClearAnnotation(); EDA_Rect GetBoundaryBox(); EDA_Rect GetBoundaryBox() const; EDA_Rect GetBoundingBox(); const wxString& ReturnFieldName( int aFieldNdx ) const; const wxString& ReturnFieldName( int aFieldNdx ) const; Loading
eeschema/program.h +2 −6 Original line number Original line Diff line number Diff line Loading @@ -91,12 +91,7 @@ public: return m_Start == m_End; return m_Start == m_End; } } EDA_Rect GetBoundingBox(); /** * Function GetBoundingBox * returns the bounding box of this TRACK */ EDA_Rect GetBoundingBox() const; virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode, int Color = -1 ); int Color = -1 ); Loading Loading @@ -234,6 +229,7 @@ public: return wxT( "DrawJunction" ); return wxT( "DrawJunction" ); } } EDA_Rect GetBoundingBox(); DrawJunctionStruct* GenCopy(); DrawJunctionStruct* GenCopy(); virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, Loading