Commit 4ca6c4fb authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Eeschema:

* fix incorrect bounding box size calculation of schematic components.
* fix incorrect bounding box position and size used when schematic components are not found in lib (dummy lib componen used).
Pcbnew:
* Fix issues in block selection for arcs in modedit. Minor code cleaning.
CopyToClipboard: fix incorrect call to PrintPage (bad parameters)
parent 38b69092
Loading
Loading
Loading
Loading
+5 −6
Original line number Original line Diff line number Diff line
@@ -15,9 +15,6 @@
#include "confirm.h"
#include "confirm.h"
#include "wxstruct.h"
#include "wxstruct.h"


static const bool   s_PlotBlackAndWhite = FALSE;
static const bool   Print_Sheet_Ref = TRUE;

static bool DrawPage( EDA_DRAW_FRAME* aFrame );
static bool DrawPage( EDA_DRAW_FRAME* aFrame );




@@ -77,11 +74,12 @@ bool DrawPage( EDA_DRAW_FRAME* aFrame )


    screen->SetZoom( 1 );
    screen->SetZoom( 1 );


    wxMetafileDC dc /*(wxT(""), DrawArea.GetWidth(), DrawArea.GetHeight())*/;
    wxMetafileDC dc;


    EDA_Rect tmp = aFrame->DrawPanel->m_ClipBox;
    EDA_Rect tmp = aFrame->DrawPanel->m_ClipBox;
    GRResetPenAndBrush( &dc );
    GRResetPenAndBrush( &dc );
    GRForceBlackPen( s_PlotBlackAndWhite );
    const bool plotBlackAndWhite = FALSE;
    GRForceBlackPen( plotBlackAndWhite );
    screen->m_IsPrinting = true;
    screen->m_IsPrinting = true;
    dc.SetUserScale( scale, scale );
    dc.SetUserScale( scale, scale );
    ClipboardSizeX = dc.MaxX() + 10;
    ClipboardSizeX = dc.MaxX() + 10;
@@ -96,7 +94,8 @@ bool DrawPage( EDA_DRAW_FRAME* aFrame )
        dc.SetClippingRegion( DrawArea );
        dc.SetClippingRegion( DrawArea );
    }
    }


    aFrame->PrintPage( &dc, Print_Sheet_Ref, -1, false );
    const int maskLayer = 0xFFFFFFFF;
    aFrame->PrintPage( &dc, maskLayer, false );
    screen->m_IsPrinting = false;
    screen->m_IsPrinting = false;
    aFrame->DrawPanel->m_ClipBox = tmp;
    aFrame->DrawPanel->m_ClipBox = tmp;
    wxMetafile* mf = dc.Close();
    wxMetafile* mf = dc.Close();
+33 −5
Original line number Original line Diff line number Diff line
@@ -959,15 +959,13 @@ bool LIB_COMPONENT::LoadFootprints( FILE* aFile, char* aLine,
    return true;
    return true;
}
}



/**********************************************************************/
/* Return the component boundary box ( in user coordinates )
/* Return the component boundary box ( in user coordinates )
 *  The unit aUnit, and the shape aConvert are considered.
 * aUnit = unit selection = 0, or 1..n
 * aConvert = 0, 1 or 2
 *  If aUnit == 0, unit is not used
 *  If aUnit == 0, unit is not used
 *  if aConvert == 0 Convert is non used
 *  if aConvert == 0 Convert is non used
 *  Invisible fields are not take in account
 *  Invisible fields are not taken in account
 **/
 **/
/**********************************************************************/
EDA_Rect LIB_COMPONENT::GetBoundingBox( int aUnit, int aConvert ) const
EDA_Rect LIB_COMPONENT::GetBoundingBox( int aUnit, int aConvert ) const
{
{
    EDA_Rect bBox( wxPoint( 0, 0 ), wxSize( 0, 0 ) );
    EDA_Rect bBox( wxPoint( 0, 0 ), wxSize( 0, 0 ) );
@@ -991,6 +989,36 @@ EDA_Rect LIB_COMPONENT::GetBoundingBox( int aUnit, int aConvert ) const
}
}




/* Return the component boundary box ( in user coordinates )
 * aUnit = unit selection = 0, or 1..n
 * aConvert = 0, 1 or 2
 *  If aUnit == 0, unit is not used
 *  if aConvert == 0 Convert is non used
 *  Fields are not take in account
 **/
EDA_Rect LIB_COMPONENT::GetBodyBoundingBox( int aUnit, int aConvert ) const
{
    EDA_Rect bBox( wxPoint( 0, 0 ), wxSize( 0, 0 ) );

    BOOST_FOREACH( const LIB_DRAW_ITEM& item, drawings )
    {
        if( ( item.m_Unit > 0 ) && ( ( m_unitCount > 1 ) && ( aUnit > 0 )
                                     && ( aUnit != item.m_Unit ) ) )
            continue;

        if( item.m_Convert > 0 && ( ( aConvert > 0 ) && ( aConvert != item.m_Convert ) ) )
            continue;

        if ( item.Type() == LIB_FIELD_T )
            continue;

        bBox.Merge( item.GetBoundingBox() );
    }

    return bBox;
}


void LIB_COMPONENT::deleteAllFields()
void LIB_COMPONENT::deleteAllFields()
{
{
    LIB_DRAW_ITEM_LIST::iterator it;
    LIB_DRAW_ITEM_LIST::iterator it;
+20 −0
Original line number Original line Diff line number Diff line
@@ -233,8 +233,28 @@ public:


    wxArrayString& GetFootPrints() { return m_FootprintList; }
    wxArrayString& GetFootPrints() { return m_FootprintList; }


    /**
     * Function GetBoundingBox
     * @return the component boundary box ( in user coordinates )
     * @param aUnit = unit selection = 0, or 1..n
     * @param aConvert = 0, 1 or 2
     *  If aUnit == 0, unit is not used
     *  if aConvert == 0 Convert is non used
     *  Invisible fields are not taken in account
     **/
    EDA_Rect GetBoundingBox( int aUnit, int aConvert ) const;
    EDA_Rect GetBoundingBox( int aUnit, int aConvert ) const;


    /**
     * Function GetBodyBoundingBox
     * @return the component boundary box ( in user coordinates ) without fields
     * @param aUnit = unit selection = 0, or 1..n
     * @param aConvert = 0, 1 or 2
     *  If aUnit == 0, unit is not used
     *  if aConvert == 0 Convert is non used
     *  Fields are not taken in account
     **/
    EDA_Rect GetBodyBoundingBox( int aUnit, int aConvert ) const;

    bool SaveDateAndTime( FILE* aFile );
    bool SaveDateAndTime( FILE* aFile );
    bool LoadDateAndTime( char* aLine );
    bool LoadDateAndTime( char* aLine );


+6 −2
Original line number Original line Diff line number Diff line
@@ -1360,10 +1360,14 @@ EDA_Rect SCH_COMPONENT::GetBodyBoundingBox() const
    int            x0, xm, y0, ym;
    int            x0, xm, y0, ym;


    if( Entry == NULL )
    if( Entry == NULL )
        return EDA_Rect( wxPoint( 0, 0 ), wxSize( 0, 0 ) );
    {
        if( DummyCmp == NULL )
            CreateDummyCmp();
        Entry = DummyCmp;
    }


    /* Get the basic Boundary box */
    /* Get the basic Boundary box */
    bBox = Entry->GetBoundingBox( m_unit, m_convert );
    bBox = Entry->GetBodyBoundingBox( m_unit, m_convert );
    x0 = bBox.GetX();
    x0 = bBox.GetX();
    xm = bBox.GetRight();
    xm = bBox.GetRight();


+1 −8
Original line number Original line Diff line number Diff line
@@ -667,14 +667,7 @@ int MarkItemsInBloc( MODULE* module, EDA_Rect& Rect )
        switch( item->Type() )
        switch( item->Type() )
        {
        {
        case TYPE_EDGE_MODULE:
        case TYPE_EDGE_MODULE:
            pos = ( (EDGE_MODULE*) item )->m_Start;
            if( ((EDGE_MODULE*)item )->HitTest( Rect ) )
            if( Rect.Contains( pos ) )
            {
                item->m_Selected = IS_SELECTED;
                ItemsCount++;
            }
            pos = ( (EDGE_MODULE*) item )->m_End;
            if( Rect.Contains( pos ) )
            {
            {
                item->m_Selected = IS_SELECTED;
                item->m_Selected = IS_SELECTED;
                ItemsCount++;
                ItemsCount++;
Loading