Loading eeschema/block_libedit.cpp +3 −4 Original line number Diff line number Diff line Loading @@ -462,8 +462,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, if( CurrentConvert && item->m_Convert && (item->m_Convert != CurrentConvert) ) continue; DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, PtBlock->m_MoveVector.x, PtBlock->m_MoveVector.y, item, CurrentUnit, g_XorMode ); PtBlock->m_MoveVector, item, g_XorMode ); } } } Loading Loading @@ -491,8 +490,8 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, if( CurrentConvert && item->m_Convert && (item->m_Convert != CurrentConvert) ) continue; DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, PtBlock->m_MoveVector.x, PtBlock->m_MoveVector.y, item, CurrentUnit, g_XorMode ); PtBlock->m_MoveVector, item, g_XorMode ); } } } Loading eeschema/class_pin.cpp +163 −0 Original line number Diff line number Diff line Loading @@ -665,3 +665,166 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient, } } } /***************************************************************/ LibDrawPin::LibDrawPin() : LibEDA_BaseStruct( COMPONENT_PIN_DRAW_TYPE ) /***************************************************************/ { m_PinLen = 300; /* default Pin len */ m_Orient = PIN_RIGHT; /* Pin oprient: Up, Down, Left, Right */ m_PinShape = NONE; /* Bit a bit: Pin shape (voir enum prec) */ m_PinType = PIN_UNSPECIFIED; /* electrical type of pin */ m_Attributs = 0; /* bit 0 != 0: pin invisible */ m_PinNum = 0; /*pin number ( i.e. 4 codes Ascii ) */ m_PinNumSize = 50; m_PinNameSize = 50; /* Default size for pin name and num */ m_Width = 0; // m_PinNumWidth = m_PinNameWidth = 0; // Unused } /******************************************/ wxPoint LibDrawPin::ReturnPinEndPoint() /******************************************/ /* return the pin end position, for a component in normal orient */ { wxPoint pos = m_Pos; switch( m_Orient ) { case PIN_UP: pos.y += m_PinLen; break; case PIN_DOWN: pos.y -= m_PinLen; break; case PIN_LEFT: pos.x -= m_PinLen; break; case PIN_RIGHT: pos.x += m_PinLen; break; } return pos; } /********************************************************/ int LibDrawPin::ReturnPinDrawOrient( int TransMat[2][2] ) /********************************************************/ /* Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT), * according to its orientation, * AND the matrix transform (rot, mirror) TransMat */ { int orient; int x1 = 0, y1 = 0; int t1, t2; switch( m_Orient ) { case PIN_UP: y1 = 1; break; case PIN_DOWN: y1 = -1; break; case PIN_LEFT: x1 = -1; break; case PIN_RIGHT: x1 = 1; break; } t1 = TransMat[0][0] * x1 + TransMat[0][1] * y1; t2 = TransMat[1][0] * x1 + TransMat[1][1] * y1; orient = PIN_UP; if( t1 == 0 ) { if( t2 > 0 ) orient = PIN_DOWN; } else { orient = PIN_RIGHT; if( t1 < 0 ) orient = PIN_LEFT; } return orient; } /****************************************************/ void LibDrawPin::ReturnPinStringNum( wxString& buffer ) /****************************************************/ /* fill the buffer with pin num as a wxString * Pin num is coded as a long * Used to print/draw the pin num */ { char ascii_buf[5]; strncpy( ascii_buf, (char*) &m_PinNum, 4 ); ascii_buf[4] = 0; buffer = CONV_FROM_UTF8( ascii_buf ); } /****************************************************/ void LibDrawPin::SetPinNumFromString( wxString& buffer ) /****************************************************/ /* fill the buffer with pin num as a wxString * Pin num is coded as a long * Used to print/draw the pin num */ { char ascii_buf[4]; unsigned ii, len = buffer.Len(); ascii_buf[0] = ascii_buf[1] = ascii_buf[2] = ascii_buf[3] = 0; if( len > 4 ) len = 4; for( ii = 0; ii < len; ii++ ) { ascii_buf[ii] = buffer.GetChar( ii ) & 0xFF; } strncpy( (char*) &m_PinNum, ascii_buf, 4 ); } /*************************************/ LibDrawPin* LibDrawPin::GenCopy() /*************************************/ { LibDrawPin* newpin = new LibDrawPin(); newpin->m_Pos = m_Pos; newpin->m_PinLen = m_PinLen; newpin->m_Orient = m_Orient; newpin->m_PinShape = m_PinShape; newpin->m_PinType = m_PinType; newpin->m_Attributs = m_Attributs; newpin->m_PinNum = m_PinNum; newpin->m_PinNumSize = m_PinNumSize; newpin->m_PinNameSize = m_PinNameSize; newpin->m_Unit = m_Unit; newpin->m_Convert = m_Convert; newpin->m_Flags = m_Flags; newpin->m_Width = m_Width; newpin->m_PinName = m_PinName; return newpin; } eeschema/classes_body_items.cpp +18 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,20 @@ //#define DRAW_ARC_WITH_ANGLE // Used to draw arcs /* Basic class (abstract) for components bodies items */ LibEDA_BaseStruct::LibEDA_BaseStruct( KICAD_T struct_type ) : EDA_BaseStruct( struct_type ) { m_Unit = 0; /* Unit identification (for multi part per package) * 0 if the item is common to all units */ m_Convert = 0; /* Shape identification (for parts which have a convert shape) * 0 if the item is common to all shapes */ m_Width = 0; /* Default value to draw lines or arc ... */ m_Fill = NO_FILL; /* NO_FILL, FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR. * has meaning only for some items */ } /** Function Draw (virtual) * Draw A body item * @param aPanel = DrawPanel to use (can be null) mainly used for clipping purposes Loading Loading @@ -70,10 +84,14 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffs else #ifdef DRAW_ARC_WITH_ANGLE GRArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2, m_Rayon, LineWidth, color ); #else GRArc1( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, posc.x, posc.y, LineWidth, color ); #endif Loading eeschema/classes_body_items.h +2 −6 Original line number Diff line number Diff line Loading @@ -132,6 +132,7 @@ public: * 0 if the item is common to all shapes */ wxPoint m_Pos; /* Position or centre (Arc and Circle) or start point (segments) */ int m_Width; /* Tickness */ FILL_T m_Fill; /* NO_FILL, FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR. has meaning only for some items */ public: LibEDA_BaseStruct* Next() Loading @@ -154,7 +155,7 @@ public: * used for some items to force to force no fill mode * ( has meaning only for items what can be filled ). used in printing or moving objects mode * or to pass refernce to the lib component for pins * @param aTransformMatrix = Transform Matrix * @param aTransformMatrix = Transform Matrix (rotaion, mirror ..) */ virtual void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor, int aDrawMode, void * aData, int aTransformMatrix[2][2] ) = 0; Loading Loading @@ -223,7 +224,6 @@ class LibDrawArc : public LibEDA_BaseStruct { public: int m_Rayon; FILL_T m_Fill; // NO_FILL, FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR int t1, t2; /* position des 2 extremites de l'arc en 0.1 degres */ wxPoint m_ArcStart, m_ArcEnd; /* position des 2 extremites de l'arc en coord reelles*/ Loading @@ -249,7 +249,6 @@ class LibDrawCircle : public LibEDA_BaseStruct { public: int m_Rayon; FILL_T m_Fill; public: LibDrawCircle(); Loading Loading @@ -304,7 +303,6 @@ class LibDrawSquare : public LibEDA_BaseStruct { public: wxPoint m_End; FILL_T m_Fill; public: LibDrawSquare(); Loading Loading @@ -352,7 +350,6 @@ class LibDrawPolyline : public LibEDA_BaseStruct public: int m_CornersCount; int* m_PolyList; FILL_T m_Fill; public: LibDrawPolyline(); Loading Loading @@ -392,7 +389,6 @@ class LibDrawField : public LibEDA_BaseStruct public: int m_FieldId; // 0 a 11 // 0 = Name; 1 = Valeur; 2 .. 11 other fields wxPoint m_Pos; wxSize m_Size; int m_Orient; /* Orientation */ int m_Attributs; /* Attributes (Non visible ...) */ Loading eeschema/delete.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -540,7 +540,7 @@ void DeleteOneLibraryDrawStruct( WinEDA_DrawPanel* panel, wxDC* DC, /* Effacement du graphique */ if( Affiche && DC ) DrawLibraryDrawStruct( panel, DC, LibEntry, 0, 0, DrawItem, CurrentUnit, g_XorMode ); DrawLibraryDrawStruct( panel, DC, LibEntry, wxPoint(0, 0), DrawItem, g_XorMode ); /* Effacement de la structure en memoire */ if( LibEntry ) /* Recherche du predecesseur */ Loading Loading
eeschema/block_libedit.cpp +3 −4 Original line number Diff line number Diff line Loading @@ -462,8 +462,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, if( CurrentConvert && item->m_Convert && (item->m_Convert != CurrentConvert) ) continue; DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, PtBlock->m_MoveVector.x, PtBlock->m_MoveVector.y, item, CurrentUnit, g_XorMode ); PtBlock->m_MoveVector, item, g_XorMode ); } } } Loading Loading @@ -491,8 +490,8 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, if( CurrentConvert && item->m_Convert && (item->m_Convert != CurrentConvert) ) continue; DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, PtBlock->m_MoveVector.x, PtBlock->m_MoveVector.y, item, CurrentUnit, g_XorMode ); PtBlock->m_MoveVector, item, g_XorMode ); } } } Loading
eeschema/class_pin.cpp +163 −0 Original line number Diff line number Diff line Loading @@ -665,3 +665,166 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient, } } } /***************************************************************/ LibDrawPin::LibDrawPin() : LibEDA_BaseStruct( COMPONENT_PIN_DRAW_TYPE ) /***************************************************************/ { m_PinLen = 300; /* default Pin len */ m_Orient = PIN_RIGHT; /* Pin oprient: Up, Down, Left, Right */ m_PinShape = NONE; /* Bit a bit: Pin shape (voir enum prec) */ m_PinType = PIN_UNSPECIFIED; /* electrical type of pin */ m_Attributs = 0; /* bit 0 != 0: pin invisible */ m_PinNum = 0; /*pin number ( i.e. 4 codes Ascii ) */ m_PinNumSize = 50; m_PinNameSize = 50; /* Default size for pin name and num */ m_Width = 0; // m_PinNumWidth = m_PinNameWidth = 0; // Unused } /******************************************/ wxPoint LibDrawPin::ReturnPinEndPoint() /******************************************/ /* return the pin end position, for a component in normal orient */ { wxPoint pos = m_Pos; switch( m_Orient ) { case PIN_UP: pos.y += m_PinLen; break; case PIN_DOWN: pos.y -= m_PinLen; break; case PIN_LEFT: pos.x -= m_PinLen; break; case PIN_RIGHT: pos.x += m_PinLen; break; } return pos; } /********************************************************/ int LibDrawPin::ReturnPinDrawOrient( int TransMat[2][2] ) /********************************************************/ /* Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT), * according to its orientation, * AND the matrix transform (rot, mirror) TransMat */ { int orient; int x1 = 0, y1 = 0; int t1, t2; switch( m_Orient ) { case PIN_UP: y1 = 1; break; case PIN_DOWN: y1 = -1; break; case PIN_LEFT: x1 = -1; break; case PIN_RIGHT: x1 = 1; break; } t1 = TransMat[0][0] * x1 + TransMat[0][1] * y1; t2 = TransMat[1][0] * x1 + TransMat[1][1] * y1; orient = PIN_UP; if( t1 == 0 ) { if( t2 > 0 ) orient = PIN_DOWN; } else { orient = PIN_RIGHT; if( t1 < 0 ) orient = PIN_LEFT; } return orient; } /****************************************************/ void LibDrawPin::ReturnPinStringNum( wxString& buffer ) /****************************************************/ /* fill the buffer with pin num as a wxString * Pin num is coded as a long * Used to print/draw the pin num */ { char ascii_buf[5]; strncpy( ascii_buf, (char*) &m_PinNum, 4 ); ascii_buf[4] = 0; buffer = CONV_FROM_UTF8( ascii_buf ); } /****************************************************/ void LibDrawPin::SetPinNumFromString( wxString& buffer ) /****************************************************/ /* fill the buffer with pin num as a wxString * Pin num is coded as a long * Used to print/draw the pin num */ { char ascii_buf[4]; unsigned ii, len = buffer.Len(); ascii_buf[0] = ascii_buf[1] = ascii_buf[2] = ascii_buf[3] = 0; if( len > 4 ) len = 4; for( ii = 0; ii < len; ii++ ) { ascii_buf[ii] = buffer.GetChar( ii ) & 0xFF; } strncpy( (char*) &m_PinNum, ascii_buf, 4 ); } /*************************************/ LibDrawPin* LibDrawPin::GenCopy() /*************************************/ { LibDrawPin* newpin = new LibDrawPin(); newpin->m_Pos = m_Pos; newpin->m_PinLen = m_PinLen; newpin->m_Orient = m_Orient; newpin->m_PinShape = m_PinShape; newpin->m_PinType = m_PinType; newpin->m_Attributs = m_Attributs; newpin->m_PinNum = m_PinNum; newpin->m_PinNumSize = m_PinNumSize; newpin->m_PinNameSize = m_PinNameSize; newpin->m_Unit = m_Unit; newpin->m_Convert = m_Convert; newpin->m_Flags = m_Flags; newpin->m_Width = m_Width; newpin->m_PinName = m_PinName; return newpin; }
eeschema/classes_body_items.cpp +18 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,20 @@ //#define DRAW_ARC_WITH_ANGLE // Used to draw arcs /* Basic class (abstract) for components bodies items */ LibEDA_BaseStruct::LibEDA_BaseStruct( KICAD_T struct_type ) : EDA_BaseStruct( struct_type ) { m_Unit = 0; /* Unit identification (for multi part per package) * 0 if the item is common to all units */ m_Convert = 0; /* Shape identification (for parts which have a convert shape) * 0 if the item is common to all shapes */ m_Width = 0; /* Default value to draw lines or arc ... */ m_Fill = NO_FILL; /* NO_FILL, FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR. * has meaning only for some items */ } /** Function Draw (virtual) * Draw A body item * @param aPanel = DrawPanel to use (can be null) mainly used for clipping purposes Loading Loading @@ -70,10 +84,14 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffs else #ifdef DRAW_ARC_WITH_ANGLE GRArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2, m_Rayon, LineWidth, color ); #else GRArc1( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, posc.x, posc.y, LineWidth, color ); #endif Loading
eeschema/classes_body_items.h +2 −6 Original line number Diff line number Diff line Loading @@ -132,6 +132,7 @@ public: * 0 if the item is common to all shapes */ wxPoint m_Pos; /* Position or centre (Arc and Circle) or start point (segments) */ int m_Width; /* Tickness */ FILL_T m_Fill; /* NO_FILL, FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR. has meaning only for some items */ public: LibEDA_BaseStruct* Next() Loading @@ -154,7 +155,7 @@ public: * used for some items to force to force no fill mode * ( has meaning only for items what can be filled ). used in printing or moving objects mode * or to pass refernce to the lib component for pins * @param aTransformMatrix = Transform Matrix * @param aTransformMatrix = Transform Matrix (rotaion, mirror ..) */ virtual void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor, int aDrawMode, void * aData, int aTransformMatrix[2][2] ) = 0; Loading Loading @@ -223,7 +224,6 @@ class LibDrawArc : public LibEDA_BaseStruct { public: int m_Rayon; FILL_T m_Fill; // NO_FILL, FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR int t1, t2; /* position des 2 extremites de l'arc en 0.1 degres */ wxPoint m_ArcStart, m_ArcEnd; /* position des 2 extremites de l'arc en coord reelles*/ Loading @@ -249,7 +249,6 @@ class LibDrawCircle : public LibEDA_BaseStruct { public: int m_Rayon; FILL_T m_Fill; public: LibDrawCircle(); Loading Loading @@ -304,7 +303,6 @@ class LibDrawSquare : public LibEDA_BaseStruct { public: wxPoint m_End; FILL_T m_Fill; public: LibDrawSquare(); Loading Loading @@ -352,7 +350,6 @@ class LibDrawPolyline : public LibEDA_BaseStruct public: int m_CornersCount; int* m_PolyList; FILL_T m_Fill; public: LibDrawPolyline(); Loading Loading @@ -392,7 +389,6 @@ class LibDrawField : public LibEDA_BaseStruct public: int m_FieldId; // 0 a 11 // 0 = Name; 1 = Valeur; 2 .. 11 other fields wxPoint m_Pos; wxSize m_Size; int m_Orient; /* Orientation */ int m_Attributs; /* Attributes (Non visible ...) */ Loading
eeschema/delete.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -540,7 +540,7 @@ void DeleteOneLibraryDrawStruct( WinEDA_DrawPanel* panel, wxDC* DC, /* Effacement du graphique */ if( Affiche && DC ) DrawLibraryDrawStruct( panel, DC, LibEntry, 0, 0, DrawItem, CurrentUnit, g_XorMode ); DrawLibraryDrawStruct( panel, DC, LibEntry, wxPoint(0, 0), DrawItem, g_XorMode ); /* Effacement de la structure en memoire */ if( LibEntry ) /* Recherche du predecesseur */ Loading