Commit daeb1901 authored by charras's avatar charras
Browse files

minor changes

parent 2a801170
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@
#include "appl_wxstruct.h"


#define BUILD_VERSION "(20090621-unstable)"
#define BUILD_VERSION "(20090628-unstable)"


#ifdef HAVE_SVN_VERSION
@@ -133,6 +133,7 @@ void InitKiCadAbout( wxAboutDialogInfo& info )
	info.AddDeveloper( SetMsg( wxT( "Jerry Jacobs <jerkejacobs@gmail.com>" ) ) );
	info.AddDeveloper( SetMsg( wxT( "Jonas Diemer <diemer@gmx.de>" ) ) );
	info.AddDeveloper( SetMsg( wxT( "KBool Library <http://boolean.klaasholwerda.nl/bool.html>" ) ) );
	info.AddDeveloper( SetMsg( wxT( "Lorenzo <lomarcan@tin.it>" ) ) );
	info.AddDeveloper( SetMsg( wxT( "Marco Serantoni <marco.serantoni@gmail.com>" ) ) );
	info.AddDeveloper( SetMsg( wxT( "Rok Markovic <rok@kanardia.eu>" ) ) );
	info.AddDeveloper( SetMsg( wxT( "Tim Hanson <sideskate@gmail.com>" ) ) );
+245 −210
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ void Gerber_Plotter::set_viewport( wxPoint offset,
/******************************************************************/
void Gerber_Plotter::start_plot( FILE* aFile )
/*****************************************************************/

/** Function start_plot
 * Write GERBER header to file
 * initialize global variable g_Plot_PlotOutputFile
@@ -67,6 +68,7 @@ void Gerber_Plotter::start_plot( FILE *aFile )
    set_current_line_width( -1 );
}


/******************************************************************/
void Gerber_Plotter::end_plot()
/*****************************************************************/
@@ -98,6 +100,7 @@ void Gerber_Plotter::end_plot( )
    output_file = 0;
}


/*************************************************************************************/
void Gerber_Plotter::set_default_line_width( int width )
/*************************************************************************************/
@@ -109,6 +112,7 @@ void Gerber_Plotter::set_default_line_width( int width )
    current_aperture  = apertures.end();
}


/***************************************/
void Gerber_Plotter::set_current_line_width( int width )
/***************************************/
@@ -127,21 +131,25 @@ void Gerber_Plotter::set_current_line_width( int width )
    current_pen_width = pen_width;
}


/******************************************************/
vector<Aperture>::iterator Gerber_Plotter::get_aperture( const wxSize&           size,
                                                         Aperture::Aperture_Type type )
/******************************************************/
{
    int last_D_code = 9;

    // Search an existing aperture
    vector<Aperture>::iterator tool = apertures.begin();
    while (tool != apertures.end()) {
    while( tool != apertures.end() )
    {
        last_D_code = tool->D_code;
        if( (tool->type == type)
           && (tool->size == size) )
            return tool;
        tool++;
    }

    // Allocate a new aperture
    Aperture new_tool;
    new_tool.size   = size;
@@ -151,6 +159,7 @@ vector<Aperture>::iterator Gerber_Plotter::get_aperture(const wxSize &size,
    return apertures.end() - 1;
}


/******************************************************/
void Gerber_Plotter::select_aperture( const wxSize& size, Aperture::Aperture_Type type )
/******************************************************/
@@ -158,16 +167,19 @@ void Gerber_Plotter::select_aperture(const wxSize &size, Aperture::Aperture_Type
    wxASSERT( output_file );
    if( ( current_aperture == apertures.end() )
       || (current_aperture->type != type)
	    || (current_aperture->size != size)) {
       || (current_aperture->size != size) )
    {
        /* Pick an existing aperture or create a new one */
        current_aperture = get_aperture( size, type );
        fprintf( output_file, "G54D%d*\n", current_aperture->D_code );
    }
}


/******************************************************/
void Gerber_Plotter::write_aperture_list()
/******************************************************/

/* Genere la liste courante des D_CODES
 * Retourne le nombre de D_Codes utilises
 * Genere une sequence RS274X
@@ -210,6 +222,7 @@ void Gerber_Plotter::write_aperture_list( )
    }
}


/**********************************************/
void Gerber_Plotter::pen_to( wxPoint aPos, char plume )
{
@@ -228,15 +241,18 @@ void Gerber_Plotter::pen_to( wxPoint aPos, char plume )
    case 'D':
        fprintf( output_file, "X%5.5dY%5.5dD01*\n", aPos.x, aPos.y );
    }

    pen_state = plume;
}

/************************************************************/

/**************************************************************************/
void Gerber_Plotter::rect( wxPoint p1, wxPoint p2, FILL_T fill, int width )
/************************************************************/
/**************************************************************************/
{
    wxASSERT( output_file );
    int coord[10] = {
    int coord[10] =
    {
        p1.x, p1.y,
        p1.x, p2.y,
        p2.x, p2.y,
@@ -246,30 +262,32 @@ void Gerber_Plotter::rect( wxPoint p1, wxPoint p2, FILL_T fill, int width )
    poly( 5, coord, fill, width );
}

/********************************************************************/
void Gerber_Plotter::circle( wxPoint pos, int diametre, FILL_T fill, int width )
/********************************************************************/
/** Function PlotCircle_GERBER

/*************************************************************************************/
void Gerber_Plotter::circle( wxPoint aCentre, int aDiameter, FILL_T fill, int aWidth )
/*************************************************************************************/

/** Function circle
 * writes a non filled circle to output file
 * Plot one circle as segments (6 to 16 depending on its radius
 * @param aCentre = centre coordintes
 * @param aRadius = radius of the circle
 * @param aDiameter = diameter of the circle
 * @param aWidth = line width
 */
{
    wxASSERT( output_file );
    wxPoint   start, end;
    double aRadius = diametre / 2;
    double    radius = aDiameter / 2;
    const int delta  = 3600 / 32; /* increment (in 0.1 degrees) to draw circles */

    start.x = pos.x + aRadius;
    start.y = pos.y;
    set_current_line_width(width);
    start.x = aCentre.x + radius;
    start.y = aCentre.y;
    set_current_line_width( aWidth );
    move_to( start );
    for( int ii = delta; ii < 3600; ii += delta )
    {
        end.x = pos.x + (int) (aRadius * fcosinus[ii]);
        end.y = pos.y + (int) (aRadius * fsinus[ii]);
        end.x = aCentre.x + (int) ( radius * fcosinus[ii] );
        end.y = aCentre.y + (int) ( radius * fsinus[ii] );
        line_to( end );
    }

@@ -278,30 +296,34 @@ void Gerber_Plotter::circle( wxPoint pos, int diametre, FILL_T fill, int width )


/***************************************************************/
void Gerber_Plotter::poly( int nb_segm, int* coord, FILL_T fill, int width )
void Gerber_Plotter::poly( int aCornersCount, int* aCoord, FILL_T aFill, int aWidth )
/***************************************************************/

/** Function PlotFilledPolygon_GERBER
 * writes a filled polyline to output file
 * @param aCornersCount = numer of corners
 * @param aCoord = buffer of corners coordinates
 * @param aFill = plot option (NO_FILL, FILLED_SHAPE, FILLED_WITH_BG_BODYCOLOR)
 * @param aCoord = buffer of corners coordinates
 */
{
    wxASSERT( output_file );
    wxPoint pos, startpos;
    set_current_line_width(width);
    set_current_line_width( aWidth );

    if (fill)
    if( aFill )
        fputs( "G36*\n", output_file );
    startpos.x = *coord++;
    startpos.y = *coord++;
    startpos.x = *aCoord++;
    startpos.y = *aCoord++;
    move_to( startpos );
    for(int ii = 1; ii < nb_segm; ii++ )
    for( int ii = 1; ii < aCornersCount; ii++ )
    {
        pos.x = *coord++;
        pos.y = *coord++;
        pos.x = *aCoord++;
        pos.y = *aCoord++;
        line_to( pos );
    }
    if (fill)

    if( aFill )
    {
        finish_to( startpos );
        fputs( "G37*\n", output_file );
@@ -312,10 +334,12 @@ void Gerber_Plotter::poly( int nb_segm, int* coord, FILL_T fill, int width )
    }
}


/* Function flash_pad_circle
 * Plot a circular pad or via at the user position pos
 */
void Gerber_Plotter::flash_pad_circle( wxPoint pos, int diametre,
                                       GRTraceMode trace_mode )
/* Plot a circular pad or via at the user position pos
 */
{
    wxASSERT( output_file );
    wxSize size( diametre, diametre );
@@ -327,6 +351,7 @@ void Gerber_Plotter::flash_pad_circle(wxPoint pos, int diametre,
        set_current_line_width( -1 );
        circle( pos, diametre - current_pen_width, NO_FILL );
        break;

    case FILLED:
        user_to_device_coordinates( pos );
        select_aperture( size, Aperture::Circle );
@@ -335,8 +360,10 @@ void Gerber_Plotter::flash_pad_circle(wxPoint pos, int diametre,
    }
}


void Gerber_Plotter::flash_pad_oval( wxPoint pos, wxSize size, int orient,
                                     GRTraceMode trace_mode )

/* Trace 1 pastille PAD_OVAL en position pos_X,Y:
 *     dimensions dx, dy,
 *     orientation orient
@@ -380,13 +407,16 @@ void Gerber_Plotter::flash_pad_oval(wxPoint pos, wxSize size, int orient,
            thick_segment( wxPoint( pos.x + x0, pos.y + y0 ),
                           wxPoint( pos.x + x1, pos.y + y1 ),
                           size.x, trace_mode );
	} else
        }
        else
            sketch_oval( pos, size, orient, -1 );
    }
}


void Gerber_Plotter::flash_pad_rect( wxPoint pos, wxSize size,
                                     int orient, GRTraceMode trace_mode )

/* Plot 1 rectangular pad
 * donne par son centre, ses dimensions, et son orientation
 * For a vertical or horizontal shape, the shape is an aperture (Dcode) and it is flashed
@@ -405,7 +435,8 @@ void Gerber_Plotter::flash_pad_rect(wxPoint pos, wxSize size,

    case 0:
    case 1800:
	switch (trace_mode) {
        switch( trace_mode )
        {
        case FILAIRE:
        case SKETCH:
            set_current_line_width( -1 );
@@ -415,12 +446,14 @@ void Gerber_Plotter::flash_pad_rect(wxPoint pos, wxSize size,
                           pos.y + (size.y - current_pen_width) / 2 ),
                  NO_FILL );
            break;

        case FILLED:
            user_to_device_coordinates( pos );
            select_aperture( size, Aperture::Rect );
            fprintf( output_file, "X%5.5dY%5.5dD03*\n", pos.x, pos.y );
            break;
        }

        break;

    default: /* plot pad shape as polygon */
@@ -429,8 +462,10 @@ void Gerber_Plotter::flash_pad_rect(wxPoint pos, wxSize size,
    }
}


void Gerber_Plotter::flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta,
                                       int orient, GRTraceMode trace_mode )

/* Trace 1 pad trapezoidal donne par :
 *    son centre pos.x,pos.y
 *    ses dimensions size.x et size.y
@@ -507,10 +542,10 @@ void Gerber_Plotter::flash_pad_trapez(wxPoint pos, wxSize size, wxSize delta,
        coord[jj] = polygon[ii].y += pos.y;
        jj++;
    }

    coord[8] = coord[0];
    coord[9] = coord[1];

    set_current_line_width( -1 );
    poly( 5, coord, trace_mode==FILLED ? FILLED_SHAPE : NO_FILL );
}
+115 −113
Original line number Diff line number Diff line
@@ -561,7 +561,6 @@ static void PlotTextStruct(Plotter *plotter, EDA_BaseStruct* Struct )

        delete (list);
    }

    else
        plotter->text( textpos,
                       color, schText->m_Text, schText->m_Orient, schText->m_Size,
@@ -612,8 +611,12 @@ static void Plot_Hierarchical_PIN_Sheet(Plotter *plotter,
        side  = GR_TEXT_HJUSTIFY_LEFT;
    }

    int thickness = (aHierarchical_PIN->m_Width == 0) ? g_DrawDefaultLineThickness : aHierarchical_PIN->m_Width;
    thickness = Clamp_Text_PenSize( thickness, aHierarchical_PIN->m_Size, aHierarchical_PIN->m_Bold );
    int thickness =
        (aHierarchical_PIN->m_Width ==
         0) ? g_DrawDefaultLineThickness : aHierarchical_PIN->m_Width;
    thickness = Clamp_Text_PenSize( thickness,
                                    aHierarchical_PIN->m_Size,
                                    aHierarchical_PIN->m_Bold );
    plotter->set_current_line_width( thickness );

    plotter->text( wxPoint( tposx, posy ), txtcolor,
@@ -696,6 +699,7 @@ static void PlotSheetStruct(Plotter *plotter, DrawSheetStruct* Struct )
    }
}


/*************************************************/
void PlotDrawlist( Plotter* plotter, SCH_ITEM* drawlist )
/*************************************************/
@@ -718,12 +722,9 @@ void PlotDrawlist(Plotter *plotter, SCH_ITEM* drawlist )
        case DRAW_SEGMENT_STRUCT_TYPE:
            #undef STRUCT
            #define STRUCT ( (EDA_DrawLineStruct*) drawlist )
            if( drawlist->Type() == DRAW_SEGMENT_STRUCT_TYPE )
            {
            StartPos = STRUCT->m_Start;
            EndPos   = STRUCT->m_End;
            layer    = STRUCT->GetLayer();
            }
            plotter->set_color( ReturnLayerColor( layer ) );

            switch( layer )
@@ -739,7 +740,8 @@ void PlotDrawlist(Plotter *plotter, SCH_ITEM* drawlist )
            case LAYER_BUS:         /* Trait large */
            {
                int thickness = wxRound( g_DrawDefaultLineThickness * 2 );
                if ( thickness < 3 ) thickness = 3;
                if( thickness < 3 )
                    thickness = 3;
                /* We NEED it to be thick, even on HPGL */
                plotter->thick_segment( StartPos, EndPos, thickness, FILLED );
                plotter->set_current_line_width( g_DrawDefaultLineThickness );
@@ -752,6 +754,7 @@ void PlotDrawlist(Plotter *plotter, SCH_ITEM* drawlist )
                plotter->finish_to( EndPos );
                break;
            }

            break;

        case DRAW_JUNCTION_STRUCT_TYPE:
@@ -804,4 +807,3 @@ void PlotDrawlist(Plotter *plotter, SCH_ITEM* drawlist )
        drawlist = drawlist->Next();
    }
}