Commit 658ca2a2 authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Fixed some issues about trapezoidal pads. Better pad editor dialog. fixed...

Fixed some issues about trapezoidal pads. Better pad editor dialog. fixed other (very) minor bugs. Code cleaning
parent 0c3541b7
Loading
Loading
Loading
Loading
+71 −67
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@
double s_HerscheyScaleFactor = HERSHEY_SCALE_FACTOR;



/** Function GetPensizeForBold
 * @return the "best" value for a pen size to draw/plot a bold text
 * @param aTextSize = the char size (height or width)
@@ -62,14 +61,15 @@ int Clamp_Text_PenSize( int aPenSize, int aSize, bool aBold )
    return penSize;
}


int Clamp_Text_PenSize( int aPenSize, wxSize aSize, bool aBold )
{
    int size = MIN( ABS( aSize.x ), ABS( aSize.y ) );

    return Clamp_Text_PenSize( aPenSize, size, aBold );;
}



/* Functions to draw / plot a string.
 *  texts have only one line.
 *  They can be in italic.
@@ -97,7 +97,6 @@ int NegableTextLength( const wxString& aText )
}



/* Function GetHersheyShapeDescription()
 * return a pointer to the shape corresponding to unicode value AsciiCode
 * Note we use the same font for Bold and Normal texts
@@ -108,6 +107,7 @@ static const char* GetHersheyShapeDescription( int AsciiCode )
{
    /* calculate font length */
    int font_length_max = newstroke_font_bufsize;

    if( AsciiCode >= (32 + font_length_max) )
        AsciiCode = '?';
    if( AsciiCode < 32 )
@@ -150,7 +150,7 @@ int ReturnGraphicTextWidth( const wxString& aText, int aXSize, bool aItalic, boo

/* Helper function for drawing character polygons */
static void DrawGraphicTextPline(
    WinEDA_DrawPanel* aPanel,
    EDA_Rect* aClipBox,
    wxDC* aDC,
    EDA_Colors aColor,
    int aWidth,
@@ -167,6 +167,7 @@ static void DrawGraphicTextPline(
        {
            plotter->line_to( coord[ik] );
        }

        plotter->pen_finish();
    }
    else if( aCallback )
@@ -180,11 +181,11 @@ static void DrawGraphicTextPline(
    else if( sketch_mode )
    {
        for( int ik = 0; ik < (point_count - 1); ik++ )
            GRCSegm( &aPanel->m_ClipBox, aDC, coord[ik].x, coord[ik].y,
            GRCSegm( aClipBox, aDC, coord[ik].x, coord[ik].y,
                     coord[ik + 1].x, coord[ik + 1].y, aWidth, aColor );
    }
    else
        GRPoly( &aPanel->m_ClipBox, aDC, point_count, coord, 0,
        GRPoly( aClipBox, aDC, point_count, coord, 0,
                aWidth, aColor, aColor );
}

@@ -240,8 +241,9 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
    wxPoint   overbar_pos;                  // Start point for the current overbar
    int       overbars;                     // Number of ~ seen
    int       overbar_italic_comp;          // Italic compensation for overbar
    EDA_Rect* clipBox;                      // Clip box used in basic draw functions


    clipBox = aPanel ? &aPanel->m_ClipBox : NULL;
    #define        BUF_SIZE 100
    wxPoint coord[BUF_SIZE + 1];                // Buffer coordinate used to draw polylines (one char shape)
    bool    sketch_mode    = false;
@@ -347,7 +349,8 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
        RotatePoint( &current_char_pos, aPos, aOrient );
        RotatePoint( &end, aPos, aOrient );

        if( plotter ) {
        if( plotter )
        {
            plotter->move_to( current_char_pos );
            plotter->finish_to( end );
        }
@@ -402,7 +405,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
                RotatePoint( &overbar_pos, aPos, aOrient );
                coord[1] = overbar_pos;
                /* Plot the overbar segment */
                DrawGraphicTextPline( aPanel, aDC, aColor, aWidth,
                DrawGraphicTextPline( clipBox, aDC, aColor, aWidth,
                                      sketch_mode, 2, coord, aCallback, plotter );
            }
            continue; /* Skip ~ processing */
@@ -426,12 +429,13 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
            }
            else
            {
                /* End of character, insert a synthetic pen up */
                // End of character, insert a synthetic pen up:
                hc1    = ' ';
                hc2    = 'R';
                endcar = true;
            }
            hc1 -= 'R'; hc2 -= 'R'; /* Do the Hershey decode thing: coordinates values are coded as <value> + 'R' */
            // Do the Hershey decode thing: coordinates values are coded as <value> + 'R'
            hc1 -= 'R'; hc2 -= 'R';

            /* Pen up request */
            if( hc1 == -50 && hc2 == 0 )
@@ -440,7 +444,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
                {
                    if( aWidth <= 1 )
                        aWidth = 0;
                    DrawGraphicTextPline( aPanel, aDC, aColor, aWidth,
                    DrawGraphicTextPline( clipBox, aDC, aColor, aWidth,
                                          sketch_mode, point_count, coord,
                                          aCallback, plotter );
                }
@@ -483,7 +487,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
        RotatePoint( &overbar_pos, aPos, aOrient );
        coord[1] = overbar_pos;
        /* Plot the overbar segment */
        DrawGraphicTextPline( aPanel, aDC, aColor, aWidth,
        DrawGraphicTextPline( clipBox, aDC, aColor, aWidth,
                              sketch_mode, 2, coord, aCallback, plotter );
    }
}
+3 −0
Original line number Diff line number Diff line
@@ -1138,6 +1138,9 @@ void GRSCSegm( EDA_Rect* ClipBox,

static bool IsGRSPolyDrawable( EDA_Rect* ClipBox, int n, wxPoint Points[] )
{
    if( ! ClipBox )
        return true;

    int Xmin, Xmax, Ymin, Ymax;

    Xmin = Xmax = Points[0].x;
+0 −48
Original line number Diff line number Diff line
@@ -13,11 +13,6 @@
#include "cvpcb.h"
#include "protos.h"

#define MAX_LEN_NETNAME 16


static void ChangePinNet( COMPONENT_LIST& list, wxString& PinNet,
                          int* netNumber, bool rightJustify );
static void WriteFootprintFilterInfos( FILE* dest, COMPONENT_LIST& list );


@@ -74,7 +69,6 @@ int GenNetlistPcbnew( FILE* file, COMPONENT_LIST& list, bool isEESchemaNetlist,
{
#define NETLIST_HEAD_STRING "EESchema Netlist Version 1.1"
    char       Line[1024];
    int        netNumber = 1;

    DateAndTime( Line );

@@ -103,9 +97,6 @@ int GenNetlistPcbnew( FILE* file, COMPONENT_LIST& list, bool isEESchemaNetlist,

        BOOST_FOREACH( PIN& pin, component.m_Pins )
        {
            if( pin.m_Net.Len() > MAX_LEN_NETNAME )
                ChangePinNet( list, pin.m_Net, &netNumber, rightJustify );

            if( !pin.m_Net.IsEmpty() )
                fprintf( file, "  ( %s %s )\n",
                         CONV_TO_UTF8( pin.m_Number ),
@@ -161,42 +152,3 @@ void WriteFootprintFilterInfos( FILE* file, COMPONENT_LIST& list )
        fprintf( file, "$endfootprintlist\n}\n" );
}

/* ???
 * Change le NetName PinNet par un nom compose des 8 derniers codes de PinNet
 * suivi de _Xnnnnn ou nnnnn est un nom de 0 a 99999
 */
static void ChangePinNet( COMPONENT_LIST& list, wxString& PinNet,
                          int* netNumber,  bool rightJustify )
{
    wxASSERT( netNumber != NULL );

    wxString   OldName;
    wxString   NewName;

    OldName = PinNet;

    if( rightJustify )  /* Retain the last 8 letters of the name. */
    {
        NewName = OldName.Right( 8 );
        NewName << *netNumber;
    }
    else                /* Retain the first 8 letters of the name. */
    {
        NewName = OldName.Left( 8 );
        NewName << *netNumber;
    }

    *netNumber = *netNumber + 1;

    BOOST_FOREACH( COMPONENT& component, list )
    {
        BOOST_FOREACH( PIN& pin, component.m_Pins )
        {
            if( pin.m_Net != OldName )
                continue;

            pin.m_Net = NewName;
        }
    }
}
+13 −5
Original line number Diff line number Diff line
@@ -41,11 +41,6 @@ private:
                                     *  orientation.
                                     */

public:

    //int m_Shape;
    //bool m_IsDangling;  // TRUE non connected

public:
    SCH_SHEET_PIN( SCH_SHEET* parent,
                   const wxPoint& pos = wxPoint( 0, 0 ),
@@ -63,6 +58,19 @@ public:

    SCH_SHEET_PIN* GenCopy();

    virtual void    Draw( WinEDA_DrawPanel* aPanel,
                          wxDC*             aDC,
                          const wxPoint&    aOffset,
                          int               aDraw_mode,
                          int               aColor = -1 );

    /** function CreateGraphicShape (virual)
     * Calculates the graphic shape (a polygon) associated to the text
     * @param aCorner_list = a buffer to fill with polygon corners coordinates
     * @param Pos = Position of the shape
     */
    virtual void    CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
                                        const wxPoint&         Pos );
    SCH_SHEET_PIN* Next()
    {
        return (SCH_SHEET_PIN*) Pnext;
+16 −0
Original line number Diff line number Diff line
@@ -60,6 +60,22 @@ SCH_SHEET_PIN* SCH_SHEET_PIN::GenCopy()
    return newitem;
}

/** SCH_SHEET_PIN::Draw is the same as SCH_HIERLABEL::Draw
 * but the graphic icon is slightly different
 * for INPUT type the icon is the OUTPUT shape of SCH_HIERLABEL
 * for OUTPUT type the icon is the INPUT shape of SCH_HIERLABEL
 */
void SCH_SHEET_PIN::Draw( WinEDA_DrawPanel* aPanel,
                          wxDC*             aDC,
                          const wxPoint&    aOffset,
                          int               aDraw_mode,
                          int               aColor )
{
    // The icon selection is handle by the virtual method CreateGraphicShape
    // called by ::Draw
    SCH_HIERLABEL::Draw(aPanel, aDC, aOffset, aDraw_mode, aColor );
}


void SCH_SHEET_PIN::SwapData( SCH_SHEET_PIN* copyitem )
{
Loading