Commit daeb1901 authored by charras's avatar charras

minor changes

parent 2a801170
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#define BUILD_VERSION "(20090621-unstable)" #define BUILD_VERSION "(20090628-unstable)"
#ifdef HAVE_SVN_VERSION #ifdef HAVE_SVN_VERSION
...@@ -133,6 +133,7 @@ void InitKiCadAbout( wxAboutDialogInfo& info ) ...@@ -133,6 +133,7 @@ void InitKiCadAbout( wxAboutDialogInfo& info )
info.AddDeveloper( SetMsg( wxT( "Jerry Jacobs <jerkejacobs@gmail.com>" ) ) ); info.AddDeveloper( SetMsg( wxT( "Jerry Jacobs <jerkejacobs@gmail.com>" ) ) );
info.AddDeveloper( SetMsg( wxT( "Jonas Diemer <diemer@gmx.de>" ) ) ); 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( "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( "Marco Serantoni <marco.serantoni@gmail.com>" ) ) );
info.AddDeveloper( SetMsg( wxT( "Rok Markovic <rok@kanardia.eu>" ) ) ); info.AddDeveloper( SetMsg( wxT( "Rok Markovic <rok@kanardia.eu>" ) ) );
info.AddDeveloper( SetMsg( wxT( "Tim Hanson <sideskate@gmail.com>" ) ) ); info.AddDeveloper( SetMsg( wxT( "Tim Hanson <sideskate@gmail.com>" ) ) );
......
...@@ -15,29 +15,30 @@ ...@@ -15,29 +15,30 @@
/***************************************************************************/ /***************************************************************************/
void Gerber_Plotter::set_viewport( wxPoint offset, void Gerber_Plotter::set_viewport( wxPoint offset,
double aScale, int orient ) double aScale, int orient )
/***************************************************************************/ /***************************************************************************/
/** function set_viewport /** function set_viewport
* Set the plot offset for the current plotting * Set the plot offset for the current plotting
* @param aOffset = plot offset * @param aOffset = plot offset
* @param aScale = coordinate scale (scale coefficient for coordinates) * @param aScale = coordinate scale (scale coefficient for coordinates)
*/ */
{ {
wxASSERT(!output_file); wxASSERT( !output_file );
wxASSERT(orient == 0); wxASSERT( orient == 0 );
plot_orient_options = 0; plot_orient_options = 0;
plot_offset = offset; plot_offset = offset;
wxASSERT(aScale == 1); wxASSERT( aScale == 1 );
plot_scale = 1; plot_scale = 1;
device_scale = 1; device_scale = 1;
set_default_line_width(100); /* epaisseur du trait standard en 1/1000 pouce */ set_default_line_width( 100 ); /* epaisseur du trait standard en 1/1000 pouce */
} }
/******************************************************************/ /******************************************************************/
void Gerber_Plotter::start_plot( FILE *aFile ) void Gerber_Plotter::start_plot( FILE* aFile )
/*****************************************************************/ /*****************************************************************/
/** Function start_plot /** Function start_plot
* Write GERBER header to file * Write GERBER header to file
* initialize global variable g_Plot_PlotOutputFile * initialize global variable g_Plot_PlotOutputFile
...@@ -46,9 +47,9 @@ void Gerber_Plotter::start_plot( FILE *aFile ) ...@@ -46,9 +47,9 @@ void Gerber_Plotter::start_plot( FILE *aFile )
{ {
char Line[1024]; char Line[1024];
wxASSERT(!output_file); wxASSERT( !output_file );
final_file = aFile; final_file = aFile;
work_file = tmpfile(); work_file = tmpfile();
output_file = work_file; output_file = work_file;
DateAndTime( Line ); DateAndTime( Line );
wxString Title = creator + wxT( " " ) + GetBuildVersion(); wxString Title = creator + wxT( " " ) + GetBuildVersion();
...@@ -60,24 +61,25 @@ void Gerber_Plotter::start_plot( FILE *aFile ) ...@@ -60,24 +61,25 @@ void Gerber_Plotter::start_plot( FILE *aFile )
/* Set gerber format to 3.4 */ /* Set gerber format to 3.4 */
fputs( "G04 Gerber Fmt 3.4, Leading zero omitted, Abs format*\n%FSLAX34Y34*%\n", fputs( "G04 Gerber Fmt 3.4, Leading zero omitted, Abs format*\n%FSLAX34Y34*%\n",
output_file); output_file );
fputs( "G04 APERTURE LIST*\n", output_file ); fputs( "G04 APERTURE LIST*\n", output_file );
/* Select the default aperture */ /* Select the default aperture */
set_current_line_width(-1); set_current_line_width( -1 );
} }
/******************************************************************/ /******************************************************************/
void Gerber_Plotter::end_plot( ) void Gerber_Plotter::end_plot()
/*****************************************************************/ /*****************************************************************/
{ {
char line[1024]; char line[1024];
wxString msg; wxString msg;
wxASSERT(output_file); wxASSERT( output_file );
/* Outfile is actually a temporary file! */ /* Outfile is actually a temporary file! */
fputs( "M02*\n", output_file ); fputs( "M02*\n", output_file );
fflush(output_file); fflush( output_file );
rewind( work_file ); // work_file == output_file !!! rewind( work_file ); // work_file == output_file !!!
output_file = final_file; output_file = final_file;
...@@ -85,12 +87,12 @@ void Gerber_Plotter::end_plot( ) ...@@ -85,12 +87,12 @@ void Gerber_Plotter::end_plot( )
// Placement des Apertures en RS274X // Placement des Apertures en RS274X
while( fgets( line, 1024, work_file ) ) while( fgets( line, 1024, work_file ) )
{ {
fputs( line, output_file ); fputs( line, output_file );
if( strcmp( strtok( line, "\n\r" ), "G04 APERTURE LIST*" ) == 0 ) if( strcmp( strtok( line, "\n\r" ), "G04 APERTURE LIST*" ) == 0 )
{ {
write_aperture_list(); write_aperture_list();
fputs( "G04 APERTURE END LIST*\n", output_file ); fputs( "G04 APERTURE END LIST*\n", output_file );
} }
} }
fclose( work_file ); fclose( work_file );
...@@ -98,6 +100,7 @@ void Gerber_Plotter::end_plot( ) ...@@ -98,6 +100,7 @@ void Gerber_Plotter::end_plot( )
output_file = 0; output_file = 0;
} }
/*************************************************************************************/ /*************************************************************************************/
void Gerber_Plotter::set_default_line_width( int width ) void Gerber_Plotter::set_default_line_width( int width )
/*************************************************************************************/ /*************************************************************************************/
...@@ -106,9 +109,10 @@ void Gerber_Plotter::set_default_line_width( int width ) ...@@ -106,9 +109,10 @@ void Gerber_Plotter::set_default_line_width( int width )
*/ */
{ {
default_pen_width = width; // epaisseur du trait standard en 1/1000 pouce default_pen_width = width; // epaisseur du trait standard en 1/1000 pouce
current_aperture = apertures.end(); current_aperture = apertures.end();
} }
/***************************************/ /***************************************/
void Gerber_Plotter::set_current_line_width( int width ) void Gerber_Plotter::set_current_line_width( int width )
/***************************************/ /***************************************/
...@@ -123,154 +127,168 @@ void Gerber_Plotter::set_current_line_width( int width ) ...@@ -123,154 +127,168 @@ void Gerber_Plotter::set_current_line_width( int width )
else else
pen_width = default_pen_width; pen_width = default_pen_width;
select_aperture(wxSize(pen_width, pen_width), Aperture::Plotting); select_aperture( wxSize( pen_width, pen_width ), Aperture::Plotting );
current_pen_width = pen_width; current_pen_width = pen_width;
} }
/******************************************************/ /******************************************************/
vector<Aperture>::iterator Gerber_Plotter::get_aperture(const wxSize &size, vector<Aperture>::iterator Gerber_Plotter::get_aperture( const wxSize& size,
Aperture::Aperture_Type type) Aperture::Aperture_Type type )
/******************************************************/ /******************************************************/
{ {
int last_D_code = 9; int last_D_code = 9;
// Search an existing aperture // Search an existing aperture
vector<Aperture>::iterator tool = apertures.begin(); vector<Aperture>::iterator tool = apertures.begin();
while (tool != apertures.end()) { while( tool != apertures.end() )
last_D_code = tool->D_code; {
if ((tool->type == type) last_D_code = tool->D_code;
&& (tool->size == size)) if( (tool->type == type)
return tool; && (tool->size == size) )
tool++; return tool;
tool++;
} }
// Allocate a new aperture // Allocate a new aperture
Aperture new_tool; Aperture new_tool;
new_tool.size = size; new_tool.size = size;
new_tool.type = type; new_tool.type = type;
new_tool.D_code = last_D_code+1; new_tool.D_code = last_D_code + 1;
apertures.push_back(new_tool); apertures.push_back( new_tool );
return apertures.end()-1; return apertures.end() - 1;
} }
/******************************************************/ /******************************************************/
void Gerber_Plotter::select_aperture(const wxSize &size, Aperture::Aperture_Type type) void Gerber_Plotter::select_aperture( const wxSize& size, Aperture::Aperture_Type type )
/******************************************************/ /******************************************************/
{ {
wxASSERT(output_file); wxASSERT( output_file );
if ((current_aperture == apertures.end()) if( ( current_aperture == apertures.end() )
|| (current_aperture->type != type) || (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); /* Pick an existing aperture or create a new one */
fprintf( output_file, "G54D%d*\n", current_aperture->D_code ); current_aperture = get_aperture( size, type );
fprintf( output_file, "G54D%d*\n", current_aperture->D_code );
} }
} }
/******************************************************/ /******************************************************/
void Gerber_Plotter::write_aperture_list( ) void Gerber_Plotter::write_aperture_list()
/******************************************************/ /******************************************************/
/* Genere la liste courante des D_CODES /* Genere la liste courante des D_CODES
* Retourne le nombre de D_Codes utilises * Retourne le nombre de D_Codes utilises
* Genere une sequence RS274X * Genere une sequence RS274X
*/ */
{ {
wxASSERT(output_file); wxASSERT( output_file );
char cbuf[1024]; char cbuf[1024];
/* Init : */ /* Init : */
for (vector<Aperture>::iterator tool=apertures.begin(); for( vector<Aperture>::iterator tool = apertures.begin();
tool != apertures.end(); tool++) tool != apertures.end(); tool++ )
{ {
const float fscale = 0.0001f * plot_scale; // For 3.4 format const float fscale = 0.0001f * plot_scale; // For 3.4 format
char* text; char* text;
text = cbuf + sprintf( cbuf, "%%ADD%d", tool->D_code); text = cbuf + sprintf( cbuf, "%%ADD%d", tool->D_code );
switch( tool->type ) switch( tool->type )
{ {
case Aperture::Circle: case Aperture::Circle:
sprintf( text, "C,%f*%%\n", tool->size.x * fscale ); sprintf( text, "C,%f*%%\n", tool->size.x * fscale );
break; break;
case Aperture::Rect: case Aperture::Rect:
sprintf( text, "R,%fX%f*%%\n", tool->size.x * fscale, sprintf( text, "R,%fX%f*%%\n", tool->size.x * fscale,
tool->size.y * fscale ); tool->size.y * fscale );
break; break;
case Aperture::Plotting: case Aperture::Plotting:
sprintf( text, "C,%f*%%\n", tool->size.x * fscale ); sprintf( text, "C,%f*%%\n", tool->size.x * fscale );
break; break;
case Aperture::Oval: case Aperture::Oval:
sprintf( text, "O,%fX%f*%%\n", tool->size.x * fscale, sprintf( text, "O,%fX%f*%%\n", tool->size.x * fscale,
tool->size.y * fscale ); tool->size.y * fscale );
break; break;
} }
fputs( cbuf, output_file ); fputs( cbuf, output_file );
} }
} }
/**********************************************/ /**********************************************/
void Gerber_Plotter::pen_to( wxPoint aPos, char plume ) void Gerber_Plotter::pen_to( wxPoint aPos, char plume )
{ {
wxASSERT(output_file); wxASSERT( output_file );
user_to_device_coordinates( aPos ); user_to_device_coordinates( aPos );
switch ( plume ) switch( plume )
{ {
case 'Z': case 'Z':
break; break;
case 'U': case 'U':
fprintf( output_file, "X%5.5dY%5.5dD02*\n", aPos.x, aPos.y ); fprintf( output_file, "X%5.5dY%5.5dD02*\n", aPos.x, aPos.y );
break; break;
case 'D':
fprintf( output_file, "X%5.5dY%5.5dD01*\n", aPos.x, aPos.y );
}
case 'D':
fprintf( output_file, "X%5.5dY%5.5dD01*\n", aPos.x, aPos.y );
}
pen_state = plume; pen_state = plume;
} }
/************************************************************/
/**************************************************************************/
void Gerber_Plotter::rect( wxPoint p1, wxPoint p2, FILL_T fill, int width ) void Gerber_Plotter::rect( wxPoint p1, wxPoint p2, FILL_T fill, int width )
/************************************************************/ /**************************************************************************/
{ {
wxASSERT(output_file); wxASSERT( output_file );
int coord[10] = { int coord[10] =
p1.x, p1.y, {
p1.x, p2.y, p1.x, p1.y,
p2.x, p2.y, p1.x, p2.y,
p2.x, p1.y, p2.x, p2.y,
p1.x, p1.y p2.x, p1.y,
p1.x, p1.y
}; };
poly( 5, coord, fill, width); poly( 5, coord, fill, width );
} }
/********************************************************************/
void Gerber_Plotter::circle( wxPoint pos, int diametre, FILL_T fill, int width ) /*************************************************************************************/
/********************************************************************/ void Gerber_Plotter::circle( wxPoint aCentre, int aDiameter, FILL_T fill, int aWidth )
/** Function PlotCircle_GERBER /*************************************************************************************/
/** Function circle
* writes a non filled circle to output file * writes a non filled circle to output file
* Plot one circle as segments (6 to 16 depending on its radius * Plot one circle as segments (6 to 16 depending on its radius
* @param aCentre = centre coordintes * @param aCentre = centre coordintes
* @param aRadius = radius of the circle * @param aDiameter = diameter of the circle
* @param aWidth = line width * @param aWidth = line width
*/ */
{ {
wxASSERT(output_file); wxASSERT( output_file );
wxPoint start,end; wxPoint start, end;
double aRadius = diametre / 2; double radius = aDiameter / 2;
const int delta = 3600/32; /* increment (in 0.1 degrees) to draw circles */ const int delta = 3600 / 32; /* increment (in 0.1 degrees) to draw circles */
start.x = pos.x + aRadius; start.x = aCentre.x + radius;
start.y = pos.y; start.y = aCentre.y;
set_current_line_width(width); set_current_line_width( aWidth );
move_to(start); move_to( start );
for(int ii = delta; ii < 3600; ii += delta ) for( int ii = delta; ii < 3600; ii += delta )
{ {
end.x = pos.x + (int) (aRadius * fcosinus[ii]); end.x = aCentre.x + (int) ( radius * fcosinus[ii] );
end.y = pos.y + (int) (aRadius * fsinus[ii]); end.y = aCentre.y + (int) ( radius * fsinus[ii] );
line_to(end); line_to( end );
} }
finish_to( start ); finish_to( start );
...@@ -278,65 +296,74 @@ void Gerber_Plotter::circle( wxPoint pos, int diametre, FILL_T fill, int width ) ...@@ -278,65 +296,74 @@ 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 /** Function PlotFilledPolygon_GERBER
* writes a filled polyline to output file * writes a filled polyline to output file
* @param aCornersCount = numer of corners * @param aCornersCount = numer of corners
* @param aCoord = buffer of corners coordinates * @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); wxASSERT( output_file );
wxPoint pos, startpos; wxPoint pos, startpos;
set_current_line_width(width); set_current_line_width( aWidth );
if (fill) if( aFill )
fputs( "G36*\n", output_file ); fputs( "G36*\n", output_file );
startpos.x = *coord++; startpos.x = *aCoord++;
startpos.y = *coord++; startpos.y = *aCoord++;
move_to(startpos); move_to( startpos );
for(int ii = 1; ii < nb_segm; ii++ ) for( int ii = 1; ii < aCornersCount; ii++ )
{ {
pos.x = *coord++; pos.x = *aCoord++;
pos.y = *coord++; pos.y = *aCoord++;
line_to( pos ); line_to( pos );
} }
if (fill)
if( aFill )
{ {
finish_to(startpos); finish_to( startpos );
fputs( "G37*\n", output_file ); fputs( "G37*\n", output_file );
} }
else else
{ {
pen_finish(); pen_finish();
} }
} }
void Gerber_Plotter::flash_pad_circle(wxPoint pos, int diametre,
GRTraceMode trace_mode) /* Function flash_pad_circle
/* Plot a circular pad or via at the user position pos * Plot a circular pad or via at the user position pos
*/ */
void Gerber_Plotter::flash_pad_circle( wxPoint pos, int diametre,
GRTraceMode trace_mode )
{ {
wxASSERT(output_file); wxASSERT( output_file );
wxSize size( diametre, diametre ); wxSize size( diametre, diametre );
switch (trace_mode) switch( trace_mode )
{ {
case FILAIRE: case FILAIRE:
case SKETCH: case SKETCH:
set_current_line_width(-1); set_current_line_width( -1 );
circle(pos, diametre-current_pen_width, NO_FILL); circle( pos, diametre - current_pen_width, NO_FILL );
break; break;
case FILLED: case FILLED:
user_to_device_coordinates( pos ); user_to_device_coordinates( pos );
select_aperture(size, Aperture::Circle); select_aperture( size, Aperture::Circle );
fprintf( output_file, "X%5.5dY%5.5dD03*\n", pos.x, pos.y ); fprintf( output_file, "X%5.5dY%5.5dD03*\n", pos.x, pos.y );
break; break;
} }
} }
void Gerber_Plotter::flash_pad_oval(wxPoint pos, wxSize size, int orient,
GRTraceMode trace_mode) 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: /* Trace 1 pastille PAD_OVAL en position pos_X,Y:
* dimensions dx, dy, * dimensions dx, dy,
* orientation orient * orientation orient
...@@ -344,56 +371,59 @@ void Gerber_Plotter::flash_pad_oval(wxPoint pos, wxSize size, int orient, ...@@ -344,56 +371,59 @@ void Gerber_Plotter::flash_pad_oval(wxPoint pos, wxSize size, int orient,
* Pour une orientation quelconque la forme est tracee comme un segment * Pour une orientation quelconque la forme est tracee comme un segment
*/ */
{ {
wxASSERT(output_file); wxASSERT( output_file );
int x0, y0, x1, y1, delta; int x0, y0, x1, y1, delta;
/* Trace de la forme flashee */ /* Trace de la forme flashee */
if(( orient == 0 || orient == 900 || orient == 1800 || orient == 2700 ) if( ( orient == 0 || orient == 900 || orient == 1800 || orient == 2700 )
&& trace_mode == FILLED) && trace_mode == FILLED )
{ {
if( orient == 900 || orient == 2700 ) /* orient tournee de 90 deg */ if( orient == 900 || orient == 2700 ) /* orient tournee de 90 deg */
EXCHG( size.x, size.y ); EXCHG( size.x, size.y );
user_to_device_coordinates( pos ); user_to_device_coordinates( pos );
select_aperture(size, Aperture::Oval); select_aperture( size, Aperture::Oval );
fprintf( output_file, "X%5.5dY%5.5dD03*\n", pos.x, pos.y ); fprintf( output_file, "X%5.5dY%5.5dD03*\n", pos.x, pos.y );
} }
else /* Forme tracee comme un segment */ else /* Forme tracee comme un segment */
{ {
if( size.x > size.y ) if( size.x > size.y )
{ {
EXCHG( size.x, size.y ); EXCHG( size.x, size.y );
if( orient < 2700 ) if( orient < 2700 )
orient += 900; orient += 900;
else else
orient -= 2700; orient -= 2700;
} }
if (trace_mode == FILLED) if( trace_mode == FILLED )
{ {
/* la pastille est ramenee a une pastille ovale avec dy > dx */ /* la pastille est ramenee a une pastille ovale avec dy > dx */
delta = size.y - size.x; delta = size.y - size.x;
x0 = 0; x0 = 0;
y0 = -delta / 2; y0 = -delta / 2;
x1 = 0; x1 = 0;
y1 = delta / 2; y1 = delta / 2;
RotatePoint( &x0, &y0, orient ); RotatePoint( &x0, &y0, orient );
RotatePoint( &x1, &y1, orient ); RotatePoint( &x1, &y1, orient );
thick_segment( wxPoint( pos.x + x0, pos.y + y0 ), thick_segment( wxPoint( pos.x + x0, pos.y + y0 ),
wxPoint( pos.x + x1, pos.y + y1 ), wxPoint( pos.x + x1, pos.y + y1 ),
size.x, trace_mode ); size.x, trace_mode );
} else }
sketch_oval(pos, size, orient, -1); else
sketch_oval( pos, size, orient, -1 );
} }
} }
void Gerber_Plotter::flash_pad_rect(wxPoint pos, wxSize size,
int orient, GRTraceMode trace_mode) void Gerber_Plotter::flash_pad_rect( wxPoint pos, wxSize size,
int orient, GRTraceMode trace_mode )
/* Plot 1 rectangular pad /* Plot 1 rectangular pad
* donne par son centre, ses dimensions, et son orientation * 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 * For a vertical or horizontal shape, the shape is an aperture (Dcode) and it is flashed
* For others orientations the shape is plotted as a polygon * For others orientations the shape is plotted as a polygon
*/ */
{ {
wxASSERT(output_file); wxASSERT( output_file );
/* Trace de la forme flashee */ /* Trace de la forme flashee */
switch( orient ) switch( orient )
{ {
...@@ -405,23 +435,26 @@ void Gerber_Plotter::flash_pad_rect(wxPoint pos, wxSize size, ...@@ -405,23 +435,26 @@ void Gerber_Plotter::flash_pad_rect(wxPoint pos, wxSize size,
case 0: case 0:
case 1800: case 1800:
switch (trace_mode) { switch( trace_mode )
case FILAIRE: {
case SKETCH: case FILAIRE:
set_current_line_width(-1); case SKETCH:
rect(wxPoint(pos.x-(size.x-current_pen_width)/2, set_current_line_width( -1 );
pos.y-(size.y-current_pen_width)/2), rect( wxPoint( pos.x - (size.x - current_pen_width) / 2,
wxPoint(pos.x+(size.x-current_pen_width)/2, pos.y - (size.y - current_pen_width) / 2 ),
pos.y+(size.y-current_pen_width)/2), wxPoint( pos.x + (size.x - current_pen_width) / 2,
NO_FILL); pos.y + (size.y - current_pen_width) / 2 ),
break; NO_FILL );
case FILLED: break;
user_to_device_coordinates( pos );
select_aperture(size, Aperture::Rect); case FILLED:
fprintf( output_file, "X%5.5dY%5.5dD03*\n", pos.x, pos.y ); user_to_device_coordinates( pos );
break; select_aperture( size, Aperture::Rect );
} fprintf( output_file, "X%5.5dY%5.5dD03*\n", pos.x, pos.y );
break; break;
}
break;
default: /* plot pad shape as polygon */ default: /* plot pad shape as polygon */
flash_pad_trapez( pos, size, wxSize( 0, 0 ), orient, trace_mode ); flash_pad_trapez( pos, size, wxSize( 0, 0 ), orient, trace_mode );
...@@ -429,8 +462,10 @@ void Gerber_Plotter::flash_pad_rect(wxPoint pos, wxSize size, ...@@ -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) void Gerber_Plotter::flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta,
int orient, GRTraceMode trace_mode )
/* Trace 1 pad trapezoidal donne par : /* Trace 1 pad trapezoidal donne par :
* son centre pos.x,pos.y * son centre pos.x,pos.y
* ses dimensions size.x et size.y * ses dimensions size.x et size.y
...@@ -472,7 +507,7 @@ void Gerber_Plotter::flash_pad_trapez(wxPoint pos, wxSize size, wxSize delta, ...@@ -472,7 +507,7 @@ void Gerber_Plotter::flash_pad_trapez(wxPoint pos, wxSize size, wxSize delta,
* " 1 " * " 1 "
*/ */
{ {
wxASSERT(output_file); wxASSERT( output_file );
int ii, jj; int ii, jj;
int dx, dy; int dx, dy;
wxPoint polygon[4]; /* polygon corners */ wxPoint polygon[4]; /* polygon corners */
...@@ -501,16 +536,16 @@ void Gerber_Plotter::flash_pad_trapez(wxPoint pos, wxSize size, wxSize delta, ...@@ -501,16 +536,16 @@ void Gerber_Plotter::flash_pad_trapez(wxPoint pos, wxSize size, wxSize delta,
for( ii = 0, jj = 0; ii < 4; ii++ ) for( ii = 0, jj = 0; ii < 4; ii++ )
{ {
RotatePoint( &polygon[ii].x, &polygon[ii].y, orient ); RotatePoint( &polygon[ii].x, &polygon[ii].y, orient );
coord[jj] = polygon[ii].x += pos.x; coord[jj] = polygon[ii].x += pos.x;
jj++; jj++;
coord[jj] = polygon[ii].y += pos.y; coord[jj] = polygon[ii].y += pos.y;
jj++; jj++;
} }
coord[8]=coord[0];
coord[9]=coord[1];
set_current_line_width(-1); coord[8] = coord[0];
poly( 5, coord, trace_mode==FILLED?FILLED_SHAPE:NO_FILL ); coord[9] = coord[1];
}
set_current_line_width( -1 );
poly( 5, coord, trace_mode==FILLED ? FILLED_SHAPE : NO_FILL );
}
...@@ -17,17 +17,17 @@ ...@@ -17,17 +17,17 @@
#include "protos.h" #include "protos.h"
/* Local Variables : */ /* Local Variables : */
static void Plot_Hierarchical_PIN_Sheet(Plotter *plotter, static void Plot_Hierarchical_PIN_Sheet( Plotter* plotter,
Hierarchical_PIN_Sheet_Struct* Struct ); Hierarchical_PIN_Sheet_Struct* Struct );
static void PlotTextField(Plotter *plotter, SCH_COMPONENT* DrawLibItem, static void PlotTextField( Plotter* plotter, SCH_COMPONENT* DrawLibItem,
int FieldNumber, int IsMulti, int DrawMode ); int FieldNumber, int IsMulti, int DrawMode );
static void PlotPinSymbol(Plotter *plotter, const wxPoint& pos, static void PlotPinSymbol( Plotter* plotter, const wxPoint& pos,
int len, int orient, int Shape ); int len, int orient, int Shape );
/***/ /***/
/**********************************************************/ /**********************************************************/
static void PlotNoConnectStruct(Plotter *plotter, DrawNoConnectStruct* Struct ) static void PlotNoConnectStruct( Plotter* plotter, DrawNoConnectStruct* Struct )
/**********************************************************/ /**********************************************************/
/* Routine de dessin des symboles de "No Connexion" .. /* Routine de dessin des symboles de "No Connexion" ..
...@@ -47,16 +47,16 @@ static void PlotNoConnectStruct(Plotter *plotter, DrawNoConnectStruct* Struct ) ...@@ -47,16 +47,16 @@ static void PlotNoConnectStruct(Plotter *plotter, DrawNoConnectStruct* Struct )
/*************************************************/ /*************************************************/
static void PlotLibPart(Plotter *plotter, SCH_COMPONENT* DrawLibItem ) static void PlotLibPart( Plotter* plotter, SCH_COMPONENT* DrawLibItem )
/*************************************************/ /*************************************************/
/* Polt a component */ /* Polt a component */
{ {
int ii, t1, t2, * Poly, orient; int ii, t1, t2, * Poly, orient;
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
int TransMat[2][2], Multi, convert; int TransMat[2][2], Multi, convert;
EDA_Colors CharColor = UNSPECIFIED_COLOR; EDA_Colors CharColor = UNSPECIFIED_COLOR;
wxPoint pos; wxPoint pos;
bool draw_bgfill = false; bool draw_bgfill = false;
Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( Entry == NULL ) if( Entry == NULL )
...@@ -65,8 +65,8 @@ static void PlotLibPart(Plotter *plotter, SCH_COMPONENT* DrawLibItem ) ...@@ -65,8 +65,8 @@ static void PlotLibPart(Plotter *plotter, SCH_COMPONENT* DrawLibItem )
Multi = DrawLibItem->m_Multi; Multi = DrawLibItem->m_Multi;
convert = DrawLibItem->m_Convert; convert = DrawLibItem->m_Convert;
for(LibEDA_BaseStruct* DEntry = Entry->m_Drawings; for( LibEDA_BaseStruct* DEntry = Entry->m_Drawings;
DEntry != NULL; DEntry = DEntry->Next() ) DEntry != NULL; DEntry = DEntry->Next() )
{ {
/* Elimination des elements non relatifs a l'unite */ /* Elimination des elements non relatifs a l'unite */
if( Multi && DEntry->m_Unit && (DEntry->m_Unit != Multi) ) if( Multi && DEntry->m_Unit && (DEntry->m_Unit != Multi) )
...@@ -74,8 +74,8 @@ static void PlotLibPart(Plotter *plotter, SCH_COMPONENT* DrawLibItem ) ...@@ -74,8 +74,8 @@ static void PlotLibPart(Plotter *plotter, SCH_COMPONENT* DrawLibItem )
if( convert && DEntry->m_Convert && (DEntry->m_Convert != convert) ) if( convert && DEntry->m_Convert && (DEntry->m_Convert != convert) )
continue; continue;
plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) ); plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
draw_bgfill = plotter->get_color_mode(); draw_bgfill = plotter->get_color_mode();
switch( DEntry->Type() ) switch( DEntry->Type() )
{ {
...@@ -90,13 +90,13 @@ static void PlotLibPart(Plotter *plotter, SCH_COMPONENT* DrawLibItem ) ...@@ -90,13 +90,13 @@ static void PlotLibPart(Plotter *plotter, SCH_COMPONENT* DrawLibItem )
plotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); plotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
plotter->arc( pos, t1, t2, Arc->m_Rayon, FILLED_SHAPE, 0 ); plotter->arc( pos, t1, t2, Arc->m_Rayon, FILLED_SHAPE, 0 );
} }
plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) ); plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
plotter->arc( pos, plotter->arc( pos,
t1, t1,
t2, t2,
Arc->m_Rayon, Arc->m_Rayon,
Arc->m_Fill, Arc->m_Fill,
Arc->m_Width ); Arc->m_Width );
} }
break; break;
...@@ -109,11 +109,11 @@ static void PlotLibPart(Plotter *plotter, SCH_COMPONENT* DrawLibItem ) ...@@ -109,11 +109,11 @@ static void PlotLibPart(Plotter *plotter, SCH_COMPONENT* DrawLibItem )
plotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); plotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
plotter->circle( pos, Circle->m_Rayon * 2, FILLED_SHAPE, 0 ); plotter->circle( pos, Circle->m_Rayon * 2, FILLED_SHAPE, 0 );
} }
plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) ); plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
plotter->circle( pos, plotter->circle( pos,
Circle->m_Rayon * 2, Circle->m_Rayon * 2,
Circle->m_Fill, Circle->m_Fill,
Circle->m_Width ); Circle->m_Width );
} }
break; break;
...@@ -130,11 +130,11 @@ static void PlotLibPart(Plotter *plotter, SCH_COMPONENT* DrawLibItem ) ...@@ -130,11 +130,11 @@ static void PlotLibPart(Plotter *plotter, SCH_COMPONENT* DrawLibItem )
thickness = Clamp_Text_PenSize( thickness, Text->m_Size, Text->m_Bold ); thickness = Clamp_Text_PenSize( thickness, Text->m_Size, Text->m_Bold );
plotter->text( pos, CharColor, plotter->text( pos, CharColor,
Text->m_Text, Text->m_Text,
t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT, t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT,
Text->m_Size, Text->m_Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, Text->m_Italic, Text->m_Bold ); thickness, Text->m_Italic, Text->m_Bold );
} }
break; break;
...@@ -150,7 +150,7 @@ static void PlotLibPart(Plotter *plotter, SCH_COMPONENT* DrawLibItem ) ...@@ -150,7 +150,7 @@ static void PlotLibPart(Plotter *plotter, SCH_COMPONENT* DrawLibItem )
plotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); plotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
plotter->rect( pos, end, FILLED_WITH_BG_BODYCOLOR, 0 ); plotter->rect( pos, end, FILLED_WITH_BG_BODYCOLOR, 0 );
} }
plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) ); plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
plotter->rect( pos, end, Square->m_Fill, Square->m_Width ); plotter->rect( pos, end, Square->m_Fill, Square->m_Width );
} }
break; break;
...@@ -167,7 +167,7 @@ static void PlotLibPart(Plotter *plotter, SCH_COMPONENT* DrawLibItem ) ...@@ -167,7 +167,7 @@ static void PlotLibPart(Plotter *plotter, SCH_COMPONENT* DrawLibItem )
pos = TransformCoordinate( TransMat, Pin->m_Pos ) + DrawLibItem->m_Pos; pos = TransformCoordinate( TransMat, Pin->m_Pos ) + DrawLibItem->m_Pos;
/* Dessin de la pin et du symbole special associe */ /* Dessin de la pin et du symbole special associe */
PlotPinSymbol(plotter, pos, Pin->m_PinLen, orient, Pin->m_PinShape ); PlotPinSymbol( plotter, pos, Pin->m_PinLen, orient, Pin->m_PinShape );
int thickness = g_DrawDefaultLineThickness; int thickness = g_DrawDefaultLineThickness;
Pin->PlotPinTexts( plotter, pos, orient, Pin->PlotPinTexts( plotter, pos, orient,
Entry->m_TextInside, Entry->m_TextInside,
...@@ -180,7 +180,7 @@ static void PlotLibPart(Plotter *plotter, SCH_COMPONENT* DrawLibItem ) ...@@ -180,7 +180,7 @@ static void PlotLibPart(Plotter *plotter, SCH_COMPONENT* DrawLibItem )
{ {
LibDrawPolyline* polyline = (LibDrawPolyline*) DEntry; LibDrawPolyline* polyline = (LibDrawPolyline*) DEntry;
Poly = (int*) MyMalloc( sizeof(int) * 2 * polyline->GetCornerCount() ); Poly = (int*) MyMalloc( sizeof(int) * 2 * polyline->GetCornerCount() );
for(ii = 0; ii < (int) polyline->GetCornerCount(); ii++ ) for( ii = 0; ii < (int) polyline->GetCornerCount(); ii++ )
{ {
pos = polyline->m_PolyPoints[ii]; pos = polyline->m_PolyPoints[ii];
pos = TransformCoordinate( TransMat, pos ) + DrawLibItem->m_Pos; pos = TransformCoordinate( TransMat, pos ) + DrawLibItem->m_Pos;
...@@ -193,7 +193,7 @@ static void PlotLibPart(Plotter *plotter, SCH_COMPONENT* DrawLibItem ) ...@@ -193,7 +193,7 @@ static void PlotLibPart(Plotter *plotter, SCH_COMPONENT* DrawLibItem )
plotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); plotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
plotter->poly( ii, Poly, FILLED_WITH_BG_BODYCOLOR, 0 ); plotter->poly( ii, Poly, FILLED_WITH_BG_BODYCOLOR, 0 );
} }
plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) ); plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
plotter->poly( ii, Poly, polyline->m_Fill, polyline->m_Width ); plotter->poly( ii, Poly, polyline->m_Fill, polyline->m_Width );
MyFree( Poly ); MyFree( Poly );
} }
...@@ -216,7 +216,7 @@ static void PlotLibPart(Plotter *plotter, SCH_COMPONENT* DrawLibItem ) ...@@ -216,7 +216,7 @@ static void PlotLibPart(Plotter *plotter, SCH_COMPONENT* DrawLibItem )
plotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); plotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
plotter->poly( ii, Poly, FILLED_WITH_BG_BODYCOLOR, 0 ); plotter->poly( ii, Poly, FILLED_WITH_BG_BODYCOLOR, 0 );
} }
plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) ); plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
plotter->poly( ii, Poly, polyline->m_Fill, polyline->m_Width ); plotter->poly( ii, Poly, polyline->m_Fill, polyline->m_Width );
MyFree( Poly ); MyFree( Poly );
} }
...@@ -238,23 +238,23 @@ static void PlotLibPart(Plotter *plotter, SCH_COMPONENT* DrawLibItem ) ...@@ -238,23 +238,23 @@ static void PlotLibPart(Plotter *plotter, SCH_COMPONENT* DrawLibItem )
if( (Entry->m_Prefix.m_Attributs & TEXT_NO_VISIBLE) == 0 ) if( (Entry->m_Prefix.m_Attributs & TEXT_NO_VISIBLE) == 0 )
{ {
if( Entry->m_UnitCount > 1 ) if( Entry->m_UnitCount > 1 )
PlotTextField(plotter, DrawLibItem, REFERENCE, 1, 0 ); PlotTextField( plotter, DrawLibItem, REFERENCE, 1, 0 );
else else
PlotTextField(plotter, DrawLibItem, REFERENCE, 0, 0 ); PlotTextField( plotter, DrawLibItem, REFERENCE, 0, 0 );
} }
if( (Entry->m_Name.m_Attributs & TEXT_NO_VISIBLE) == 0 ) if( (Entry->m_Name.m_Attributs & TEXT_NO_VISIBLE) == 0 )
PlotTextField(plotter, DrawLibItem, VALUE, 0, 0 ); PlotTextField( plotter, DrawLibItem, VALUE, 0, 0 );
for( ii = 2; ii < NUMBER_OF_FIELDS; ii++ ) for( ii = 2; ii < NUMBER_OF_FIELDS; ii++ )
{ {
PlotTextField(plotter, DrawLibItem, ii, 0, 0 ); PlotTextField( plotter, DrawLibItem, ii, 0, 0 );
} }
} }
/*************************************************************/ /*************************************************************/
static void PlotTextField( Plotter *plotter, SCH_COMPONENT* DrawLibItem, static void PlotTextField( Plotter* plotter, SCH_COMPONENT* DrawLibItem,
int FieldNumber, int IsMulti, int DrawMode ) int FieldNumber, int IsMulti, int DrawMode )
/**************************************************************/ /**************************************************************/
...@@ -274,7 +274,7 @@ static void PlotTextField( Plotter *plotter, SCH_COMPONENT* DrawLibItem, ...@@ -274,7 +274,7 @@ static void PlotTextField( Plotter *plotter, SCH_COMPONENT* DrawLibItem,
int orient; int orient;
EDA_Colors color = UNSPECIFIED_COLOR; EDA_Colors color = UNSPECIFIED_COLOR;
color = ReturnLayerColor( field->GetLayer() ); color = ReturnLayerColor( field->GetLayer() );
DrawMode = 0; /* Unused */ DrawMode = 0; /* Unused */
if( field->m_Attributs & TEXT_NO_VISIBLE ) if( field->m_Attributs & TEXT_NO_VISIBLE )
...@@ -375,10 +375,10 @@ static void PlotTextField( Plotter *plotter, SCH_COMPONENT* DrawLibItem, ...@@ -375,10 +375,10 @@ static void PlotTextField( Plotter *plotter, SCH_COMPONENT* DrawLibItem,
if( !IsMulti || (FieldNumber != REFERENCE) ) if( !IsMulti || (FieldNumber != REFERENCE) )
{ {
plotter->text( textpos, color, field->m_Text, plotter->text( textpos, color, field->m_Text,
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
field->m_Size, field->m_Size,
hjustify, vjustify, hjustify, vjustify,
thickness, field->m_Italic, field->m_Bold ); thickness, field->m_Italic, field->m_Bold );
} }
else /* We plt the reference, for a multiple parts per package */ else /* We plt the reference, for a multiple parts per package */
{ {
...@@ -394,16 +394,16 @@ static void PlotTextField( Plotter *plotter, SCH_COMPONENT* DrawLibItem, ...@@ -394,16 +394,16 @@ static void PlotTextField( Plotter *plotter, SCH_COMPONENT* DrawLibItem,
#endif #endif
Text.Append( unit_id ); Text.Append( unit_id );
plotter->text( textpos, color, Text, plotter->text( textpos, color, Text,
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
field->m_Size, hjustify, vjustify, field->m_Size, hjustify, vjustify,
thickness, field->m_Italic, field->m_Bold ); thickness, field->m_Italic, field->m_Bold );
} }
} }
/**************************************************************************/ /**************************************************************************/
static void PlotPinSymbol(Plotter *plotter, const wxPoint& pos, static void PlotPinSymbol( Plotter* plotter, const wxPoint& pos,
int len, int orient, int Shape ) int len, int orient, int Shape )
/**************************************************************************/ /**************************************************************************/
/* Trace la pin du symbole en cours de trace /* Trace la pin du symbole en cours de trace
...@@ -442,13 +442,13 @@ static void PlotPinSymbol(Plotter *plotter, const wxPoint& pos, ...@@ -442,13 +442,13 @@ static void PlotPinSymbol(Plotter *plotter, const wxPoint& pos,
if( Shape & INVERT ) if( Shape & INVERT )
{ {
plotter->circle( wxPoint( MapX1 * INVERT_PIN_RADIUS + x1, plotter->circle( wxPoint( MapX1 * INVERT_PIN_RADIUS + x1,
MapY1 * INVERT_PIN_RADIUS + y1 ), MapY1 * INVERT_PIN_RADIUS + y1 ),
INVERT_PIN_RADIUS * 2, // diameter INVERT_PIN_RADIUS * 2, // diameter
NO_FILL, // fill NO_FILL, // fill
-1 ); // width -1 ); // width
plotter->move_to( wxPoint( MapX1 * INVERT_PIN_RADIUS * 2 + x1, plotter->move_to( wxPoint( MapX1 * INVERT_PIN_RADIUS * 2 + x1,
MapY1 * INVERT_PIN_RADIUS * 2 + y1 )); MapY1 * INVERT_PIN_RADIUS * 2 + y1 ) );
plotter->finish_to( pos ); plotter->finish_to( pos );
} }
else else
...@@ -479,14 +479,14 @@ static void PlotPinSymbol(Plotter *plotter, const wxPoint& pos, ...@@ -479,14 +479,14 @@ static void PlotPinSymbol(Plotter *plotter, const wxPoint& pos,
{ {
plotter->move_to( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, y1 ) ); plotter->move_to( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, y1 ) );
plotter->line_to( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, plotter->line_to( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2,
y1 - IEEE_SYMBOL_PIN_DIM ) ); y1 - IEEE_SYMBOL_PIN_DIM ) );
plotter->finish_to( wxPoint( x1, y1 ) ); plotter->finish_to( wxPoint( x1, y1 ) );
} }
else /* MapX1 = 0 */ else /* MapX1 = 0 */
{ {
plotter->move_to( wxPoint( x1, y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) ); plotter->move_to( wxPoint( x1, y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) );
plotter->line_to( wxPoint( x1 - IEEE_SYMBOL_PIN_DIM, plotter->line_to( wxPoint( x1 - IEEE_SYMBOL_PIN_DIM,
y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) ); y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) );
plotter->finish_to( wxPoint( x1, y1 ) ); plotter->finish_to( wxPoint( x1, y1 ) );
} }
} }
...@@ -509,7 +509,7 @@ static void PlotPinSymbol(Plotter *plotter, const wxPoint& pos, ...@@ -509,7 +509,7 @@ static void PlotPinSymbol(Plotter *plotter, const wxPoint& pos,
/*******************************************/ /*******************************************/
static void PlotTextStruct(Plotter *plotter, EDA_BaseStruct* Struct ) static void PlotTextStruct( Plotter* plotter, EDA_BaseStruct* Struct )
/*******************************************/ /*******************************************/
/* /*
...@@ -531,11 +531,11 @@ static void PlotTextStruct(Plotter *plotter, EDA_BaseStruct* Struct ) ...@@ -531,11 +531,11 @@ static void PlotTextStruct(Plotter *plotter, EDA_BaseStruct* Struct )
return; return;
} }
SCH_TEXT* schText = (SCH_TEXT*) Struct; SCH_TEXT* schText = (SCH_TEXT*) Struct;
EDA_Colors color = UNSPECIFIED_COLOR; EDA_Colors color = UNSPECIFIED_COLOR;
color = ReturnLayerColor( schText->m_Layer ); color = ReturnLayerColor( schText->m_Layer );
wxPoint textpos = schText->m_Pos + schText->GetSchematicTextOffset(); wxPoint textpos = schText->m_Pos + schText->GetSchematicTextOffset();
int thickness = (schText->m_Width == 0) ? g_DrawDefaultLineThickness : schText->m_Width; int thickness = (schText->m_Width == 0) ? g_DrawDefaultLineThickness : schText->m_Width;
thickness = Clamp_Text_PenSize( thickness, schText->m_Size, schText->m_Bold ); thickness = Clamp_Text_PenSize( thickness, schText->m_Size, schText->m_Bold );
plotter->set_current_line_width( thickness ); plotter->set_current_line_width( thickness );
...@@ -553,20 +553,19 @@ static void PlotTextStruct(Plotter *plotter, EDA_BaseStruct* Struct ) ...@@ -553,20 +553,19 @@ static void PlotTextStruct(Plotter *plotter, EDA_BaseStruct* Struct )
{ {
wxString txt = list->Item( i ); wxString txt = list->Item( i );
plotter->text( pos, plotter->text( pos,
color, txt, schText->m_Orient, schText->m_Size, color, txt, schText->m_Orient, schText->m_Size,
schText->m_HJustify, schText->m_VJustify, schText->m_HJustify, schText->m_VJustify,
thickness, schText->m_Italic, schText->m_Bold ); thickness, schText->m_Italic, schText->m_Bold );
pos += offset; pos += offset;
} }
delete (list); delete (list);
} }
else else
plotter->text( textpos, plotter->text( textpos,
color, schText->m_Text, schText->m_Orient, schText->m_Size, color, schText->m_Text, schText->m_Orient, schText->m_Size,
schText->m_HJustify, schText->m_VJustify, schText->m_HJustify, schText->m_VJustify,
thickness, schText->m_Italic, schText->m_Bold ); thickness, schText->m_Italic, schText->m_Bold );
/* Draw graphic symbol for global or hierachical labels */ /* Draw graphic symbol for global or hierachical labels */
if( Struct->Type() == TYPE_SCH_GLOBALLABEL ) if( Struct->Type() == TYPE_SCH_GLOBALLABEL )
...@@ -583,8 +582,8 @@ static void PlotTextStruct(Plotter *plotter, EDA_BaseStruct* Struct ) ...@@ -583,8 +582,8 @@ static void PlotTextStruct(Plotter *plotter, EDA_BaseStruct* Struct )
/*****************************************************************************************/ /*****************************************************************************************/
static void Plot_Hierarchical_PIN_Sheet(Plotter *plotter, static void Plot_Hierarchical_PIN_Sheet( Plotter* plotter,
Hierarchical_PIN_Sheet_Struct* aHierarchical_PIN ) Hierarchical_PIN_Sheet_Struct* aHierarchical_PIN )
/****************************************************************************************/ /****************************************************************************************/
/* Plot a Hierarchical_PIN_Sheet /* Plot a Hierarchical_PIN_Sheet
...@@ -595,7 +594,7 @@ static void Plot_Hierarchical_PIN_Sheet(Plotter *plotter, ...@@ -595,7 +594,7 @@ static void Plot_Hierarchical_PIN_Sheet(Plotter *plotter,
static std::vector <wxPoint> Poly; static std::vector <wxPoint> Poly;
txtcolor = ReturnLayerColor( aHierarchical_PIN->GetLayer() ); txtcolor = ReturnLayerColor( aHierarchical_PIN->GetLayer() );
posx = aHierarchical_PIN->m_Pos.x; posx = aHierarchical_PIN->m_Pos.x;
posy = aHierarchical_PIN->m_Pos.y; posy = aHierarchical_PIN->m_Pos.y;
...@@ -612,14 +611,18 @@ static void Plot_Hierarchical_PIN_Sheet(Plotter *plotter, ...@@ -612,14 +611,18 @@ static void Plot_Hierarchical_PIN_Sheet(Plotter *plotter,
side = GR_TEXT_HJUSTIFY_LEFT; side = GR_TEXT_HJUSTIFY_LEFT;
} }
int thickness = (aHierarchical_PIN->m_Width == 0) ? g_DrawDefaultLineThickness : aHierarchical_PIN->m_Width; int thickness =
thickness = Clamp_Text_PenSize( thickness, aHierarchical_PIN->m_Size, aHierarchical_PIN->m_Bold ); (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->set_current_line_width( thickness );
plotter->text( wxPoint( tposx, posy ), txtcolor, plotter->text( wxPoint( tposx, posy ), txtcolor,
aHierarchical_PIN->m_Text, TEXT_ORIENT_HORIZ, wxSize( size, size ), aHierarchical_PIN->m_Text, TEXT_ORIENT_HORIZ, wxSize( size, size ),
side, GR_TEXT_VJUSTIFY_CENTER, side, GR_TEXT_VJUSTIFY_CENTER,
thickness, aHierarchical_PIN->m_Italic, aHierarchical_PIN->m_Bold ); thickness, aHierarchical_PIN->m_Italic, aHierarchical_PIN->m_Bold );
/* Draw the associated graphic symbol */ /* Draw the associated graphic symbol */
aHierarchical_PIN->CreateGraphicShape( Poly, aHierarchical_PIN->m_Pos ); aHierarchical_PIN->CreateGraphicShape( Poly, aHierarchical_PIN->m_Pos );
...@@ -629,7 +632,7 @@ static void Plot_Hierarchical_PIN_Sheet(Plotter *plotter, ...@@ -629,7 +632,7 @@ static void Plot_Hierarchical_PIN_Sheet(Plotter *plotter,
/*************************************************/ /*************************************************/
static void PlotSheetStruct(Plotter *plotter, DrawSheetStruct* Struct ) static void PlotSheetStruct( Plotter* plotter, DrawSheetStruct* Struct )
/*************************************************/ /*************************************************/
/* Routine de dessin du bloc type hierarchie */ /* Routine de dessin du bloc type hierarchie */
{ {
...@@ -667,9 +670,9 @@ static void PlotSheetStruct(Plotter *plotter, DrawSheetStruct* Struct ) ...@@ -667,9 +670,9 @@ static void PlotSheetStruct(Plotter *plotter, DrawSheetStruct* Struct )
bool italic = false; bool italic = false;
plotter->text( pos, txtcolor, plotter->text( pos, txtcolor,
Text, TEXT_ORIENT_HORIZ, size, Text, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM,
thickness, italic, false ); thickness, italic, false );
/*Draw texts : FileName */ /*Draw texts : FileName */
Text = Struct->GetFileName(); Text = Struct->GetFileName();
...@@ -680,10 +683,10 @@ static void PlotSheetStruct(Plotter *plotter, DrawSheetStruct* Struct ) ...@@ -680,10 +683,10 @@ static void PlotSheetStruct(Plotter *plotter, DrawSheetStruct* Struct )
plotter->set_color( ReturnLayerColor( LAYER_SHEETFILENAME ) ); plotter->set_color( ReturnLayerColor( LAYER_SHEETFILENAME ) );
plotter->text( wxPoint( Struct->m_Pos.x, Struct->m_Pos.y + Struct->m_Size.y + 4 ), plotter->text( wxPoint( Struct->m_Pos.x, Struct->m_Pos.y + Struct->m_Size.y + 4 ),
txtcolor, txtcolor,
Text, TEXT_ORIENT_HORIZ, size, Text, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP,
thickness, italic, false ); thickness, italic, false );
/* Draw texts : SheetLabel */ /* Draw texts : SheetLabel */
SheetLabelStruct = Struct->m_Label; SheetLabelStruct = Struct->m_Label;
...@@ -691,20 +694,21 @@ static void PlotSheetStruct(Plotter *plotter, DrawSheetStruct* Struct ) ...@@ -691,20 +694,21 @@ static void PlotSheetStruct(Plotter *plotter, DrawSheetStruct* Struct )
while( SheetLabelStruct != NULL ) while( SheetLabelStruct != NULL )
{ {
Plot_Hierarchical_PIN_Sheet(plotter, SheetLabelStruct ); Plot_Hierarchical_PIN_Sheet( plotter, SheetLabelStruct );
SheetLabelStruct = SheetLabelStruct->Next(); SheetLabelStruct = SheetLabelStruct->Next();
} }
} }
/*************************************************/ /*************************************************/
void PlotDrawlist(Plotter *plotter, SCH_ITEM* drawlist ) void PlotDrawlist( Plotter* plotter, SCH_ITEM* drawlist )
/*************************************************/ /*************************************************/
{ {
while( drawlist ) /* tracage */ while( drawlist ) /* tracage */
{ {
SCH_COMPONENT* DrawLibItem; SCH_COMPONENT* DrawLibItem;
int layer; int layer;
wxPoint StartPos, EndPos; wxPoint StartPos, EndPos;
switch( drawlist->Type() ) switch( drawlist->Type() )
{ {
...@@ -718,33 +722,31 @@ void PlotDrawlist(Plotter *plotter, SCH_ITEM* drawlist ) ...@@ -718,33 +722,31 @@ void PlotDrawlist(Plotter *plotter, SCH_ITEM* drawlist )
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (EDA_DrawLineStruct*) drawlist ) #define STRUCT ( (EDA_DrawLineStruct*) drawlist )
if( drawlist->Type() == DRAW_SEGMENT_STRUCT_TYPE ) StartPos = STRUCT->m_Start;
{ EndPos = STRUCT->m_End;
StartPos = STRUCT->m_Start; layer = STRUCT->GetLayer();
EndPos = STRUCT->m_End; plotter->set_color( ReturnLayerColor( layer ) );
layer = STRUCT->GetLayer();
}
plotter->set_color( ReturnLayerColor( layer ) );
switch( layer ) switch( layer )
{ {
case LAYER_NOTES: /* Trace en pointilles */ case LAYER_NOTES: /* Trace en pointilles */
plotter->set_current_line_width( g_DrawDefaultLineThickness ); plotter->set_current_line_width( g_DrawDefaultLineThickness );
plotter->set_dash(true); plotter->set_dash( true );
plotter->move_to( StartPos ); plotter->move_to( StartPos );
plotter->finish_to( EndPos ); plotter->finish_to( EndPos );
plotter->set_dash(false); plotter->set_dash( false );
break; break;
case LAYER_BUS: /* Trait large */ case LAYER_BUS: /* Trait large */
{ {
int thickness = wxRound( g_DrawDefaultLineThickness * 2 ); int thickness = wxRound( g_DrawDefaultLineThickness * 2 );
if ( thickness < 3 ) thickness = 3; if( thickness < 3 )
/* We NEED it to be thick, even on HPGL */ thickness = 3;
plotter->thick_segment(StartPos, EndPos, thickness, FILLED); /* We NEED it to be thick, even on HPGL */
plotter->thick_segment( StartPos, EndPos, thickness, FILLED );
plotter->set_current_line_width( g_DrawDefaultLineThickness ); plotter->set_current_line_width( g_DrawDefaultLineThickness );
} }
break; break;
default: default:
plotter->set_current_line_width( g_DrawDefaultLineThickness ); plotter->set_current_line_width( g_DrawDefaultLineThickness );
...@@ -752,12 +754,13 @@ void PlotDrawlist(Plotter *plotter, SCH_ITEM* drawlist ) ...@@ -752,12 +754,13 @@ void PlotDrawlist(Plotter *plotter, SCH_ITEM* drawlist )
plotter->finish_to( EndPos ); plotter->finish_to( EndPos );
break; break;
} }
break; break;
case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawJunctionStruct*) drawlist ) #define STRUCT ( (DrawJunctionStruct*) drawlist )
plotter->set_color( ReturnLayerColor( STRUCT->GetLayer() ) ); plotter->set_color( ReturnLayerColor( STRUCT->GetLayer() ) );
plotter->circle( STRUCT->m_Pos, DRAWJUNCTION_SIZE, FILLED_SHAPE ); plotter->circle( STRUCT->m_Pos, DRAWJUNCTION_SIZE, FILLED_SHAPE );
break; break;
...@@ -765,12 +768,12 @@ void PlotDrawlist(Plotter *plotter, SCH_ITEM* drawlist ) ...@@ -765,12 +768,12 @@ void PlotDrawlist(Plotter *plotter, SCH_ITEM* drawlist )
case TYPE_SCH_LABEL: case TYPE_SCH_LABEL:
case TYPE_SCH_GLOBALLABEL: case TYPE_SCH_GLOBALLABEL:
case TYPE_SCH_HIERLABEL: case TYPE_SCH_HIERLABEL:
PlotTextStruct(plotter, drawlist ); PlotTextStruct( plotter, drawlist );
break; break;
case TYPE_SCH_COMPONENT: case TYPE_SCH_COMPONENT:
DrawLibItem = (SCH_COMPONENT*) drawlist; DrawLibItem = (SCH_COMPONENT*) drawlist;
PlotLibPart(plotter, DrawLibItem ); PlotLibPart( plotter, DrawLibItem );
break; break;
case DRAW_PICK_ITEM_STRUCT_TYPE: case DRAW_PICK_ITEM_STRUCT_TYPE:
...@@ -788,14 +791,14 @@ void PlotDrawlist(Plotter *plotter, SCH_ITEM* drawlist ) ...@@ -788,14 +791,14 @@ void PlotDrawlist(Plotter *plotter, SCH_ITEM* drawlist )
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawSheetStruct*) drawlist ) #define STRUCT ( (DrawSheetStruct*) drawlist )
PlotSheetStruct(plotter, STRUCT ); PlotSheetStruct( plotter, STRUCT );
break; break;
case DRAW_NOCONNECT_STRUCT_TYPE: case DRAW_NOCONNECT_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawNoConnectStruct*) drawlist ) #define STRUCT ( (DrawNoConnectStruct*) drawlist )
plotter->set_color( ReturnLayerColor( LAYER_NOCONNECT ) ); plotter->set_color( ReturnLayerColor( LAYER_NOCONNECT ) );
PlotNoConnectStruct(plotter, STRUCT ); PlotNoConnectStruct( plotter, STRUCT );
break; break;
default: default:
...@@ -804,4 +807,3 @@ void PlotDrawlist(Plotter *plotter, SCH_ITEM* drawlist ) ...@@ -804,4 +807,3 @@ void PlotDrawlist(Plotter *plotter, SCH_ITEM* drawlist )
drawlist = drawlist->Next(); drawlist = drawlist->Next();
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment