Loading change_log.txt +6 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,12 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. 2008-Mar-13 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ +pcbnew Dirty rect used in footprint rotation, flip and delete. Better calculation of the footprint dirty rect. 2008-Mar-13 UPDATE Dick Hollenbeck <dick@softplc.com> ================================================================================ Loading include/base_struct.h +1 −1 Original line number Diff line number Diff line Loading @@ -167,7 +167,7 @@ public: #define STRUCT_DELETED (1 << 13) ///< Bit flag de Status pour structures effacee #define CANDIDATE (1 << 14) ///< flag indiquant que la structure est connectee #define SKIP_STRUCT (1 << 15) ///< flag indiquant que la structure ne doit pas etre traitee #define DO_NOT_DRAW (1 << 16) ///< Used to disable draw function unsigned long m_TimeStamp; // Time stamp used for logical links int m_Selected; /* Used by block commands, and selective editing */ Loading pcbnew/class_module.cpp +65 −14 Original line number Diff line number Diff line Loading @@ -267,20 +267,22 @@ void MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode ) /**********************************************************/ /* Dessin d'une empreinte sur l'ecran actif: * Entree : * Module: pointeur sur le module * ox, oy = offset de trace * draw_mode = mode de trace ( GR_OR, GR_XOR, GR_AND) * Utilise par ailleur: * Description des parametres de l'empreinte calcules par caract() ; /** Function Draw * Draws the footprint to the current Device Context * @param panel = The active Draw Panel (used to know the clip box) * @param DC = current Device Context * @param offset = draw offset (usually wxPoint(0,0) * @param draw_mode = GR_OR, GR_XOR, GR_AND */ { D_PAD* pt_pad; EDA_BaseStruct* PtStruct; TEXTE_MODULE* PtTexte; /* trace des pastilles */ if ( (m_Flags & DO_NOT_DRAW) ) return; /* Draw pads */ pt_pad = m_Pads; for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext ) { Loading @@ -289,10 +291,10 @@ void MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, pt_pad->Draw( panel, DC, offset, draw_mode ); } /* Impression de l'ancre du module */ /* Draws foootprint anchor */ DrawAncre( panel, DC, offset, DIM_ANCRE_MODULE, draw_mode ); /* impression des graphismes */ /* Draw graphic items */ if( !(m_Reference->m_Flags & IS_MOVED) ) m_Reference->Draw( panel, DC, offset, draw_mode ); if( !(m_Value->m_Flags & IS_MOVED) ) Loading Loading @@ -326,10 +328,17 @@ void MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, void MODULE::DrawEdgesOnly( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode ) /**************************************************************/ /** Function DrawEdgesOnly * Draws the footprint edges only to the current Device Context * @param panel = The active Draw Panel (used to know the clip box) * @param DC = current Device Context * @param offset = draw offset (usually wxPoint(0,0) * @param draw_mode = GR_OR, GR_XOR, GR_AND */ { EDA_BaseStruct* PtStruct; /* impression des graphismes */ /* Draw graphic items */ PtStruct = m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { Loading Loading @@ -1041,13 +1050,55 @@ void MODULE::SetRectangleExinscrit() /** * Function GetBoundingBox * returns the bounding box of this Footprint * returns the full bounding box of this Footprint, including texts */ EDA_Rect MODULE::GetBoundingBox() { // Calculate area without text fielsd: SetRectangleExinscrit(); return m_RealBoundaryBox; EDA_Rect area = m_RealBoundaryBox; area.Normalize(); // Calculate extended area including text field: EDGE_MODULE* EdgeMod = (EDGE_MODULE*) m_Drawings; TEXTE_MODULE* text; EDA_Rect text_area; wxPoint textstart, textend; wxPoint modstart = area.GetOrigin(); wxPoint modend = area.GetEnd(); for( int ii = 0 ; ; ii++ ) { if ( ii == 0 ) text = m_Reference; else if ( ii == 1 ) text = m_Value; else { if ( EdgeMod == NULL ) break; text = (TEXTE_MODULE*) EdgeMod; EdgeMod = (EDGE_MODULE*) EdgeMod->Pnext; if( text->Type() != TYPETEXTEMODULE ) continue; } text_area = text->GetTextRect(); textstart = text_area.GetOrigin(); textend = text_area.GetEnd(); int angle = text->GetDrawRotation(); RotatePoint( &textstart, text->m_Pos, angle); RotatePoint( &textend, text->m_Pos, angle); modstart.x = min( modstart.x, textstart.x); modstart.x = min( modstart.x, textend.x); modstart.y = min( modstart.y, textstart.y); modstart.y = min( modstart.y, textend.y); modend.x = max( modend.x, textstart.x); modend.x = max( modend.x, textend.x); modend.y = max( modend.y, textstart.y); modend.y = max( modend.y, textend.y); } area.SetOrigin(modstart); area.SetEnd(modend); return area; } /*******************************************************/ Loading pcbnew/class_text_mod.cpp +28 −2 Original line number Diff line number Diff line Loading @@ -194,6 +194,31 @@ void TEXTE_MODULE:: SetLocalCoord() /* locate functions */ /** Function GetTextRect * @return an EDA_Rect which gives the position and size of the text area (for the O orient footprint) */ EDA_Rect TEXTE_MODULE::GetTextRect(void) { EDA_Rect area; int dx, dy; dx = ( m_Size.x * GetLength() ) / 2; dx = (dx * 10) / 9 ; /* letter size = 10/9 */ dx += m_Width / 2; dy = ( m_Size.y + m_Width ) / 2; wxPoint Org = m_Pos; // This is the position of the centre of the area Org.x -= dx; Org.y -= dy; area.SetOrigin( Org); area.SetHeight(2 * dy); area.SetWidth(2 * dx); area.Normalize(); return area; } bool TEXTE_MODULE::HitTest( const wxPoint& posref ) { int mX, mY, dx, dy; Loading @@ -204,8 +229,9 @@ bool TEXTE_MODULE::HitTest( const wxPoint& posref ) angle += Module->m_Orient; dx = ( m_Size.x * GetLength() ) / 2; dy = m_Size.y / 2; dx = ( (dx * 10) / 9 ) + m_Width; /* Facteur de forme des lettres : 10/9 */ dx = (dx * 10) / 9; /* Facteur de forme des lettres : 10/9 */ dx += m_Width / 2; dy = ( m_Size.y + m_Width ) / 2; /* le point de reference est tourn�de - angle * pour se ramener a un rectangle de reference horizontal */ Loading pcbnew/class_text_mod.h +5 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,11 @@ public: int Pitch(); /* retourne le pas entre 2 caracteres */ int GetDrawRotation(); // Return text rotation for drawings and plotting /** Function GetTextRect * @return an EDA_Rect which gives the position and size of the text area (for the O orient text and footprint) */ EDA_Rect GetTextRect(void); void SetDrawCoord(); // mise a jour des coordonn�s absolues de trac� // a partir des coord relatives Loading Loading
change_log.txt +6 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,12 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. 2008-Mar-13 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ +pcbnew Dirty rect used in footprint rotation, flip and delete. Better calculation of the footprint dirty rect. 2008-Mar-13 UPDATE Dick Hollenbeck <dick@softplc.com> ================================================================================ Loading
include/base_struct.h +1 −1 Original line number Diff line number Diff line Loading @@ -167,7 +167,7 @@ public: #define STRUCT_DELETED (1 << 13) ///< Bit flag de Status pour structures effacee #define CANDIDATE (1 << 14) ///< flag indiquant que la structure est connectee #define SKIP_STRUCT (1 << 15) ///< flag indiquant que la structure ne doit pas etre traitee #define DO_NOT_DRAW (1 << 16) ///< Used to disable draw function unsigned long m_TimeStamp; // Time stamp used for logical links int m_Selected; /* Used by block commands, and selective editing */ Loading
pcbnew/class_module.cpp +65 −14 Original line number Diff line number Diff line Loading @@ -267,20 +267,22 @@ void MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode ) /**********************************************************/ /* Dessin d'une empreinte sur l'ecran actif: * Entree : * Module: pointeur sur le module * ox, oy = offset de trace * draw_mode = mode de trace ( GR_OR, GR_XOR, GR_AND) * Utilise par ailleur: * Description des parametres de l'empreinte calcules par caract() ; /** Function Draw * Draws the footprint to the current Device Context * @param panel = The active Draw Panel (used to know the clip box) * @param DC = current Device Context * @param offset = draw offset (usually wxPoint(0,0) * @param draw_mode = GR_OR, GR_XOR, GR_AND */ { D_PAD* pt_pad; EDA_BaseStruct* PtStruct; TEXTE_MODULE* PtTexte; /* trace des pastilles */ if ( (m_Flags & DO_NOT_DRAW) ) return; /* Draw pads */ pt_pad = m_Pads; for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext ) { Loading @@ -289,10 +291,10 @@ void MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, pt_pad->Draw( panel, DC, offset, draw_mode ); } /* Impression de l'ancre du module */ /* Draws foootprint anchor */ DrawAncre( panel, DC, offset, DIM_ANCRE_MODULE, draw_mode ); /* impression des graphismes */ /* Draw graphic items */ if( !(m_Reference->m_Flags & IS_MOVED) ) m_Reference->Draw( panel, DC, offset, draw_mode ); if( !(m_Value->m_Flags & IS_MOVED) ) Loading Loading @@ -326,10 +328,17 @@ void MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, void MODULE::DrawEdgesOnly( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode ) /**************************************************************/ /** Function DrawEdgesOnly * Draws the footprint edges only to the current Device Context * @param panel = The active Draw Panel (used to know the clip box) * @param DC = current Device Context * @param offset = draw offset (usually wxPoint(0,0) * @param draw_mode = GR_OR, GR_XOR, GR_AND */ { EDA_BaseStruct* PtStruct; /* impression des graphismes */ /* Draw graphic items */ PtStruct = m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { Loading Loading @@ -1041,13 +1050,55 @@ void MODULE::SetRectangleExinscrit() /** * Function GetBoundingBox * returns the bounding box of this Footprint * returns the full bounding box of this Footprint, including texts */ EDA_Rect MODULE::GetBoundingBox() { // Calculate area without text fielsd: SetRectangleExinscrit(); return m_RealBoundaryBox; EDA_Rect area = m_RealBoundaryBox; area.Normalize(); // Calculate extended area including text field: EDGE_MODULE* EdgeMod = (EDGE_MODULE*) m_Drawings; TEXTE_MODULE* text; EDA_Rect text_area; wxPoint textstart, textend; wxPoint modstart = area.GetOrigin(); wxPoint modend = area.GetEnd(); for( int ii = 0 ; ; ii++ ) { if ( ii == 0 ) text = m_Reference; else if ( ii == 1 ) text = m_Value; else { if ( EdgeMod == NULL ) break; text = (TEXTE_MODULE*) EdgeMod; EdgeMod = (EDGE_MODULE*) EdgeMod->Pnext; if( text->Type() != TYPETEXTEMODULE ) continue; } text_area = text->GetTextRect(); textstart = text_area.GetOrigin(); textend = text_area.GetEnd(); int angle = text->GetDrawRotation(); RotatePoint( &textstart, text->m_Pos, angle); RotatePoint( &textend, text->m_Pos, angle); modstart.x = min( modstart.x, textstart.x); modstart.x = min( modstart.x, textend.x); modstart.y = min( modstart.y, textstart.y); modstart.y = min( modstart.y, textend.y); modend.x = max( modend.x, textstart.x); modend.x = max( modend.x, textend.x); modend.y = max( modend.y, textstart.y); modend.y = max( modend.y, textend.y); } area.SetOrigin(modstart); area.SetEnd(modend); return area; } /*******************************************************/ Loading
pcbnew/class_text_mod.cpp +28 −2 Original line number Diff line number Diff line Loading @@ -194,6 +194,31 @@ void TEXTE_MODULE:: SetLocalCoord() /* locate functions */ /** Function GetTextRect * @return an EDA_Rect which gives the position and size of the text area (for the O orient footprint) */ EDA_Rect TEXTE_MODULE::GetTextRect(void) { EDA_Rect area; int dx, dy; dx = ( m_Size.x * GetLength() ) / 2; dx = (dx * 10) / 9 ; /* letter size = 10/9 */ dx += m_Width / 2; dy = ( m_Size.y + m_Width ) / 2; wxPoint Org = m_Pos; // This is the position of the centre of the area Org.x -= dx; Org.y -= dy; area.SetOrigin( Org); area.SetHeight(2 * dy); area.SetWidth(2 * dx); area.Normalize(); return area; } bool TEXTE_MODULE::HitTest( const wxPoint& posref ) { int mX, mY, dx, dy; Loading @@ -204,8 +229,9 @@ bool TEXTE_MODULE::HitTest( const wxPoint& posref ) angle += Module->m_Orient; dx = ( m_Size.x * GetLength() ) / 2; dy = m_Size.y / 2; dx = ( (dx * 10) / 9 ) + m_Width; /* Facteur de forme des lettres : 10/9 */ dx = (dx * 10) / 9; /* Facteur de forme des lettres : 10/9 */ dx += m_Width / 2; dy = ( m_Size.y + m_Width ) / 2; /* le point de reference est tourn�de - angle * pour se ramener a un rectangle de reference horizontal */ Loading
pcbnew/class_text_mod.h +5 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,11 @@ public: int Pitch(); /* retourne le pas entre 2 caracteres */ int GetDrawRotation(); // Return text rotation for drawings and plotting /** Function GetTextRect * @return an EDA_Rect which gives the position and size of the text area (for the O orient text and footprint) */ EDA_Rect GetTextRect(void); void SetDrawCoord(); // mise a jour des coordonn�s absolues de trac� // a partir des coord relatives Loading