Commit 76d04d6a authored by stambaughw's avatar stambaughw
Browse files

Library component and draw object improvements and compile warning fix.

* Library component draw items now stored in Boost ptr_vector.
* Updated draw item object comparison to include greater and less than condition.
* Moved set parts per package code from component edit dialog to component object.
* Moved set alternate body style code from component edit dialog to component object.
* Tweaked component library file draw item sort order for improved file readability.
* Documented component object draw item sort ordering.
* Moved plot code to the appropriate library component and draw item objects.
* Fixed compiler type conversion warning in plot_common.h.
parent f765a408
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -505,7 +505,7 @@ static void ComputeReferenceNumber( std::vector <OBJ_CMP_TO_LIST>& aComponentsLi
        }
        }


        /* Annotation of one part per package components (trivial case)*/
        /* Annotation of one part per package components (trivial case)*/
        if( aComponentsList[ii].m_Entry->m_UnitCount <= 1 )
        if( aComponentsList[ii].m_Entry->GetPartCount() <= 1 )
        {
        {
            if( aComponentsList[ii].m_IsNew )
            if( aComponentsList[ii].m_IsNew )
            {
            {
@@ -520,7 +520,7 @@ static void ComputeReferenceNumber( std::vector <OBJ_CMP_TO_LIST>& aComponentsLi


        /* Annotation of multi-part components ( n parts per package )
        /* Annotation of multi-part components ( n parts per package )
         * (complex case) */
         * (complex case) */
        NumberOfUnits = aComponentsList[ii].m_Entry->m_UnitCount;
        NumberOfUnits = aComponentsList[ii].m_Entry->GetPartCount();


        if( aComponentsList[ii].m_IsNew )
        if( aComponentsList[ii].m_IsNew )
        {
        {
@@ -709,7 +709,7 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList, bool aOne
        }
        }


        // Annotate error
        // Annotate error
        if( MAX( ComponentsList[ii].m_Entry->m_UnitCount, 1 ) < ComponentsList[ii].m_Unit  )
        if( MAX( ComponentsList[ii].m_Entry->GetPartCount(), 1 ) < ComponentsList[ii].m_Unit  )
        {
        {
            if( ComponentsList[ii].m_NumRef >= 0 )
            if( ComponentsList[ii].m_NumRef >= 0 )
                Buff << ComponentsList[ii].m_NumRef;
                Buff << ComponentsList[ii].m_NumRef;
@@ -721,7 +721,7 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList, bool aOne
                       Buff.GetData() );
                       Buff.GetData() );


            Buff.Printf( _( " unit %d and no more than %d parts" ),
            Buff.Printf( _( " unit %d and no more than %d parts" ),
                         ComponentsList[ii].m_Unit, ComponentsList[ii].m_Entry->m_UnitCount );
                         ComponentsList[ii].m_Unit, ComponentsList[ii].m_Entry->GetPartCount() );
            msg << Buff;
            msg << Buff;
            if( aMessageList )
            if( aMessageList )
            {
            {
@@ -777,7 +777,7 @@ int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList, bool aOne


        /* Test error if units are different but number of parts per package
        /* Test error if units are different but number of parts per package
         * too hight (ex U3 ( 1 part) and we find U3B this is an error) */
         * too hight (ex U3 ( 1 part) and we find U3B this is an error) */
        if( ComponentsList[ii].m_Entry->m_UnitCount != ComponentsList[ii + 1].m_Entry->m_UnitCount )
        if( ComponentsList[ii].m_Entry->GetPartCount() != ComponentsList[ii + 1].m_Entry->GetPartCount() )
        {
        {
            if( ComponentsList[ii].m_NumRef >= 0 )
            if( ComponentsList[ii].m_NumRef >= 0 )
                Buff << ComponentsList[ii].m_NumRef;
                Buff << ComponentsList[ii].m_NumRef;
+2 −2
Original line number Original line Diff line number Diff line
@@ -650,7 +650,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
        Unit  = ' ';
        Unit  = ' ';
        Entry = CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName );
        Entry = CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName );
        if( Entry )
        if( Entry )
            Multi = Entry->m_UnitCount;
            Multi = Entry->GetPartCount();


        if( ( Multi > 1 ) && aIncludeSubComponents )
        if( ( Multi > 1 ) && aIncludeSubComponents )
#if defined (KICAD_GOST)
#if defined (KICAD_GOST)
@@ -749,7 +749,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal(
        Unit  = ' ';
        Unit  = ' ';
        Entry = CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName );
        Entry = CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName );
        if( Entry )
        if( Entry )
            Multi = Entry->m_UnitCount;
            Multi = Entry->GetPartCount();


        if( ( Multi > 1 ) && aIncludeSubComponents )
        if( ( Multi > 1 ) && aIncludeSubComponents )
        {
        {
+18 −0
Original line number Original line Diff line number Diff line
@@ -11,6 +11,7 @@
#include "gr_basic.h"
#include "gr_basic.h"
#include "common.h"
#include "common.h"
#include "class_drawpanel.h"
#include "class_drawpanel.h"
#include "plot_common.h"
#include "drawtxt.h"
#include "drawtxt.h"
#include "trigo.h"
#include "trigo.h"


@@ -248,6 +249,23 @@ void LibDrawText::DoMirrorHorizontal( const wxPoint& center )
}
}




void LibDrawText::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
                          const int transform[2][2] )
{
    wxASSERT( plotter != NULL );

    /* The text orientation may need to be flipped if the
     * transformation matrix causes xy axes to be flipped. */
    int t1  = ( transform[0][0] != 0 ) ^ ( m_Orient != 0 );
    wxPoint pos = TransformCoordinate( transform, m_Pos ) + offset;

    plotter->text( pos, UNSPECIFIED_COLOR, m_Text,
                   t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT,
                   m_Size, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
                   GetPenSize(), m_Italic, m_Bold );
}


/** Function GetPenSize
/** Function GetPenSize
 * @return the size of the "pen" that be used to draw or plot this item
 * @return the size of the "pen" that be used to draw or plot this item
 */
 */
Loading