Commit a1998410 authored by charras's avatar charras
Browse files

Some enhancements and fixes. (see changelog)

parent cacb2225
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -4,6 +4,15 @@ KiCad ChangeLog 2009
Please add newer entries at the top, list the date and your name with
Please add newer entries at the top, list the date and your name with
email address.
email address.


2009-Dec-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++pcbnew
    Added option to use some usual Gerber files extension, depending on the layer
    Do not allow in plot menu to output files for non enabled layers.
++Kicad and Gerbview
    Display Gerber files that use usual files extension (in tree project or dialog files)
    (See http://en.wikipedia.org/wiki/Gerber_File)

2009-Dec-20 UPDATE Dick Hollenbeck <dick@softplc.com>
2009-Dec-20 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
================================================================================
++pcbnew
++pcbnew
+2 −2
Original line number Original line Diff line number Diff line
@@ -521,7 +521,7 @@ void WinEDA_DrawPanel::EraseScreen( wxDC* DC )
#ifndef WX_ZOOM
#ifndef WX_ZOOM
    GRSFilledRect( &m_ClipBox, DC, m_ClipBox.GetX(), m_ClipBox.GetY(),
    GRSFilledRect( &m_ClipBox, DC, m_ClipBox.GetX(), m_ClipBox.GetY(),
                   m_ClipBox.GetRight(), m_ClipBox.GetBottom(),
                   m_ClipBox.GetRight(), m_ClipBox.GetBottom(),
                   g_DrawBgColor, g_DrawBgColor );
                   0, g_DrawBgColor, g_DrawBgColor );
#else
#else
    EDA_Rect tmp = m_ClipBox;
    EDA_Rect tmp = m_ClipBox;


@@ -534,7 +534,7 @@ void WinEDA_DrawPanel::EraseScreen( wxDC* DC )


    GRSFilledRect( &m_ClipBox, DC, m_ClipBox.GetX(), m_ClipBox.GetY(),
    GRSFilledRect( &m_ClipBox, DC, m_ClipBox.GetX(), m_ClipBox.GetY(),
                   m_ClipBox.GetRight(), m_ClipBox.GetBottom(),
                   m_ClipBox.GetRight(), m_ClipBox.GetBottom(),
                   g_DrawBgColor, g_DrawBgColor );
                   0, g_DrawBgColor, g_DrawBgColor );


    m_ClipBox = tmp;
    m_ClipBox = tmp;
#endif
#endif
+63 −51
Original line number Original line Diff line number Diff line
@@ -69,6 +69,13 @@ static int lastwidth = -1;
static int   s_Last_Pen_Style = -1;
static int   s_Last_Pen_Style = -1;
static wxDC* lastDC = NULL;
static wxDC* lastDC = NULL;



/* Local functions: */
static void GRSRect( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1,
              int x2, int y2, int Color );
static void GRSRect( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1,
              int x2, int y2, int width, int Color );

/*
/*
 * Macro clipping the trace of a line:
 * Macro clipping the trace of a line:
 * Line (x1, y1 x2, y2) is clipped to remain within
 * Line (x1, y1 x2, y2) is clipped to remain within
@@ -362,9 +369,13 @@ void GRSetDrawMode( wxDC* DC, int draw_mode )
    if( draw_mode & GR_OR )
    if( draw_mode & GR_OR )
#if defined(__WXMAC__) && (wxMAC_USE_CORE_GRAPHICS || wxCHECK_VERSION( 2, 9, 0 ) )
#if defined(__WXMAC__) && (wxMAC_USE_CORE_GRAPHICS || wxCHECK_VERSION( 2, 9, 0 ) )




        DC->SetLogicalFunction( wxCOPY );
        DC->SetLogicalFunction( wxCOPY );
#else
#else




        DC->SetLogicalFunction( wxOR );
        DC->SetLogicalFunction( wxOR );
#endif
#endif
    else if( draw_mode & GR_XOR )
    else if( draw_mode & GR_XOR )
@@ -372,9 +383,13 @@ void GRSetDrawMode( wxDC* DC, int draw_mode )
    else if( draw_mode & GR_NXOR )
    else if( draw_mode & GR_NXOR )
#if defined(__WXMAC__) && (wxMAC_USE_CORE_GRAPHICS || wxCHECK_VERSION( 2, 9, 0 ) )
#if defined(__WXMAC__) && (wxMAC_USE_CORE_GRAPHICS || wxCHECK_VERSION( 2, 9, 0 ) )




        DC->SetLogicalFunction( wxXOR );
        DC->SetLogicalFunction( wxXOR );
#else
#else




        DC->SetLogicalFunction( wxEQUIV );
        DC->SetLogicalFunction( wxEQUIV );
#endif
#endif
    else
    else
@@ -1422,12 +1437,8 @@ void GRArc( EDA_Rect* ClipBox,
/*
/*
 * Draw a rectangle in drawing space.
 * Draw a rectangle in drawing space.
 */
 */
void GRRect( EDA_Rect* ClipBox,
void GRRect( EDA_Rect* ClipBox, wxDC* DC,
             wxDC*     DC,
             int x1, int y1, int x2, int y2,
             int       x1,
             int       y1,
             int       x2,
             int       y2,
             int Color )
             int Color )
{
{
    x1 = GRMapX( x1 );
    x1 = GRMapX( x1 );
@@ -1438,18 +1449,25 @@ void GRRect( EDA_Rect* ClipBox,
    GRSRect( ClipBox, DC, x1, y1, x2, y2, Color );
    GRSRect( ClipBox, DC, x1, y1, x2, y2, Color );
}
}


void GRRect( EDA_Rect* aClipBox, wxDC* aDC,
             const EDA_Rect& aRect,
             int aColor )
{
    int x1 = GRMapX( aRect.GetX() );
    int y1 = GRMapY( aRect.GetY() );
    int x2 = GRMapX( aRect.GetRight() );
    int y2 = GRMapY( aRect.GetBottom() );

    GRSRect( aClipBox, aDC, x1, y1, x2, y2, aColor );
}



/*
/*
 * Draw a rectangle in drawing space.
 * Draw a rectangle (thick lines) in drawing space.
 */
 */
void GRRect( EDA_Rect* ClipBox,
void GRRect( EDA_Rect* ClipBox, wxDC* DC,
             wxDC*     DC,
             int x1, int y1, int x2, int y2,
             int       x1,
             int width, int Color )
             int       y1,
             int       x2,
             int       y2,
             int       width,
             int       Color )
{
{
    x1    = GRMapX( x1 );
    x1    = GRMapX( x1 );
    y1    = GRMapY( y1 );
    y1    = GRMapY( y1 );
@@ -1460,6 +1478,20 @@ void GRRect( EDA_Rect* ClipBox,
    GRSRect( ClipBox, DC, x1, y1, x2, y2, width, Color );
    GRSRect( ClipBox, DC, x1, y1, x2, y2, width, Color );
}
}


void GRRect( EDA_Rect* aClipBox, wxDC* aDC,
             const EDA_Rect& aRect,
             int aWidth, int aColor )
{
    int x1 = GRMapX( aRect.GetX() );
    int y1 = GRMapY( aRect.GetY() );
    int x2 = GRMapX( aRect.GetRight() );
    int y2 = GRMapY( aRect.GetBottom() );

    int width = ZoomValue( aWidth );

    GRSRect( aClipBox, aDC, x1, y1, x2, y2, width, aColor );
}



/*
/*
 * Draw a rectangle (filled with AreaColor) in drawing space.
 * Draw a rectangle (filled with AreaColor) in drawing space.
@@ -1543,31 +1575,10 @@ void GRSRect( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
}
}




/*
 * Draw a filled rectangle in screen space.
 */
void GRSFilledRect( EDA_Rect* ClipBox,
                    wxDC*     DC,
                    int       x1,
                    int       y1,
                    int       x2,
                    int       y2,
                    int       Color,
                    int       BgColor )
{
    GRSFilledRect( ClipBox, DC, x1, y1, x2, y2, 0, Color, BgColor );
}



void GRSFilledRect( EDA_Rect* ClipBox,
void GRSFilledRect( EDA_Rect* ClipBox, wxDC*     DC,
                    wxDC*     DC,
                    int       x1, int       y1, int       x2, int       y2,
                    int       x1,
                    int       width, int       Color, int       BgColor )
                    int       y1,
                    int       x2,
                    int       y2,
                    int       width,
                    int       Color,
                    int       BgColor )
{
{
    if( x1 > x2 )
    if( x1 > x2 )
        EXCHG( x1, x2 );
        EXCHG( x1, x2 );
@@ -1656,6 +1667,7 @@ void ClipAndDrawFilledPoly( EDA_Rect* aClipBox,
        aDC->DrawPolygon( clippedPolygon.size(), &clippedPolygon[0] );
        aDC->DrawPolygon( clippedPolygon.size(), &clippedPolygon[0] );
}
}



#endif
#endif




+2 −2
Original line number Original line Diff line number Diff line
@@ -451,7 +451,7 @@ bool LIB_COMPONENT::Save( FILE* aFile )
    if( fprintf( aFile, "DEF" ) < 0 )
    if( fprintf( aFile, "DEF" ) < 0 )
        return false;
        return false;


    if( ( value.m_Attributs & TEXT_NO_VISIBLE ) == 0 )
    if( value.IsVisible() )
    {
    {
        if( fprintf( aFile, " %s", CONV_TO_UTF8( value.m_Text ) ) < 0 )
        if( fprintf( aFile, " %s", CONV_TO_UTF8( value.m_Text ) ) < 0 )
            return false;
            return false;
@@ -859,7 +859,7 @@ EDA_Rect LIB_COMPONENT::GetBoundaryBox( int aUnit, int aConvert )
            continue;
            continue;


        if ( ( item.Type() == COMPONENT_FIELD_DRAW_TYPE )
        if ( ( item.Type() == COMPONENT_FIELD_DRAW_TYPE )
            && ( ( ( LIB_TEXT& ) item ).m_Attributs & TEXT_NO_VISIBLE ) )
            && !( ( LIB_FIELD& ) item ).IsVisible() )
            continue;
            continue;


        bBox.Merge( item.GetBoundingBox() );
        bBox.Merge( item.GetBoundingBox() );
+8 −1
Original line number Original line Diff line number Diff line
@@ -84,9 +84,16 @@ public:
               int aColor, int aDrawMode, void* aData,
               int aColor, int aDrawMode, void* aData,
               const int aTransformMatrix[2][2] );
               const int aTransformMatrix[2][2] );


    /** Function IsVisible
     * @return true is this field is visible, false if flagged invisible
     */
    bool IsVisible()
    {
        return (m_Attributs & TEXT_NO_VISIBLE) == 0 ? true : false;
    }

    /**
    /**
     * Return the bounding rectangle of the field text.
     * Return the bounding rectangle of the field text.
     *
     * @return Bounding rectangle.
     * @return Bounding rectangle.
     */
     */
    virtual EDA_Rect GetBoundingBox();
    virtual EDA_Rect GetBoundingBox();
Loading