plot fix, beautification

This commit is contained in:
dickelbeck 2008-03-22 05:55:06 +00:00
parent 11d8f51b5c
commit 2da432b271
16 changed files with 1995 additions and 1905 deletions

View File

@ -1,6 +1,6 @@
/******************************************/ /******************************************/
/* Kicad: Common plot HPGL Routines */ /* Kicad: Common plot HPGL Routines */
/******************************************/ /******************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
@ -17,191 +17,199 @@
// Variables partagees avec Common plot Postscript Routines // Variables partagees avec Common plot Postscript Routines
extern wxPoint LastPenPosition; extern wxPoint LastPenPosition;
extern wxPoint PlotOffset; extern wxPoint PlotOffset;
extern FILE * PlotOutputFile; extern FILE* PlotOutputFile;
extern double XScale, YScale; extern double XScale, YScale;
extern int g_DefaultPenWidth, g_CurrentPenWidth; extern int g_DefaultPenWidth, g_CurrentPenWidth;
extern int PlotOrientOptions, etat_plume; extern int PlotOrientOptions, etat_plume;
//Variables locales //Variables locales
void Move_Plume_HPGL( wxPoint pos, int plume ); void Move_Plume_HPGL( wxPoint pos, int plume );
void Plume_HPGL( int plume ); void Plume_HPGL( int plume );
/***********************************************************************************/ /***********************************************************************************/
void InitPlotParametresHPGL(wxPoint offset, double xscale, double yscale, int orient) void InitPlotParametresHPGL( wxPoint offset, double xscale, double yscale, int orient )
/***********************************************************************************/ /***********************************************************************************/
/* Set the plot offset for the current plotting /* Set the plot offset for the current plotting
xscale,yscale = coordinate scale (scale coefficient for coordinates) * xscale,yscale = coordinate scale (scale coefficient for coordinates)
device_xscale,device_yscale = device coordinate scale (i.e scale used by plot device) * device_xscale,device_yscale = device coordinate scale (i.e scale used by plot device)
*/ */
{ {
PlotOffset = offset; PlotOffset = offset;
XScale = xscale; XScale = xscale;
YScale = yscale; YScale = yscale;
g_DefaultPenWidth = 6; /* epaisseur du trait standard en 1/1000 pouce */ g_DefaultPenWidth = 6; /* epaisseur du trait standard en 1/1000 pouce */
PlotOrientOptions = orient; PlotOrientOptions = orient;
g_CurrentPenWidth = -1; g_CurrentPenWidth = -1;
} }
/*****************************************************************/ /*****************************************************************/
bool PrintHeaderHPGL(FILE * plot_file, int pen_speed, int pen_num) bool PrintHeaderHPGL( FILE* plot_file, int pen_speed, int pen_num )
/*****************************************************************/ /*****************************************************************/
{ {
char Line[256]; char Line[256];
PlotOutputFile = plot_file; PlotOutputFile = plot_file;
etat_plume = 'U'; etat_plume = 'U';
sprintf(Line,"IN;VS%d;PU;PA;SP%d;\n",pen_speed,pen_num); sprintf( Line, "IN;VS%d;PU;PA;SP%d;\n", pen_speed, pen_num );
fputs(Line,plot_file); fputs( Line, plot_file );
return TRUE; return TRUE;
} }
/**********************************/ /**********************************/
bool CloseFileHPGL(FILE * plot_file) bool CloseFileHPGL( FILE* plot_file )
/**********************************/ /**********************************/
{ {
fputs("PU;PA;SP0;\n",plot_file); fputs( "PU;PA;SP0;\n", plot_file );
fclose(plot_file); fclose( plot_file );
return TRUE; return TRUE;
} }
/************************************************************/ /************************************************************/
void PlotCircle_HPGL(wxPoint centre, int diameter, int width) void PlotCircle_HPGL( wxPoint centre, int diameter, int width )
/************************************************************/ /************************************************************/
{ {
int rayon; int rayon;
char Line[256]; char Line[256];
UserToDeviceCoordinate(centre); UserToDeviceCoordinate( centre );
rayon = (int)(diameter / 2 * XScale); rayon = (int) (diameter / 2 * XScale);
if(rayon < 0 ) rayon = 0 ; if( rayon < 0 )
rayon = 0;
Plume_HPGL('U'); Plume_HPGL( 'U' );
sprintf(Line,"PA %d,%d;CI %d,%d;\n", centre.x, centre.y, rayon , CHORD_ANGLE); sprintf( Line, "PA %d,%d;CI %d,%d;\n", centre.x, centre.y, rayon, CHORD_ANGLE );
fputs(Line,PlotOutputFile) ; fputs( Line, PlotOutputFile );
Plume_HPGL('U'); return ; Plume_HPGL( 'U' ); return;
} }
/********************************************************************/ /********************************************************************/
void PlotArcHPGL(wxPoint centre, int StAngle, int EndAngle, int rayon, int width) void PlotArcHPGL( wxPoint centre, int StAngle, int EndAngle, int rayon, int width )
/********************************************************************/ /********************************************************************/
/* trace d'un arc de cercle: /* trace d'un arc de cercle:
centre = coord du centre * centre = coord du centre
StAngle, EndAngle = angle de debut et fin * StAngle, EndAngle = angle de debut et fin
rayon = rayon de l'arc * rayon = rayon de l'arc
commande * commande
PU;PA x,y;PD;AA start_arc_X, start_arc_Y, angle, NbSegm; PU; * PU;PA x,y;PD;AA start_arc_X, start_arc_Y, angle, NbSegm; PU;
ou PU;PA x,y;PD;AA start_arc_X, start_arc_Y, angle; PU; * ou PU;PA x,y;PD;AA start_arc_X, start_arc_Y, angle; PU;
*/ */
{ {
char Line[256]; char Line[256];
wxPoint cmap; /* point de depart */ wxPoint cmap; /* point de depart */
wxPoint cpos; /* centre */ wxPoint cpos; /* centre */
float angle; /* angle de l'arc*/ float angle; /* angle de l'arc*/
if(rayon <= 0 ) return ; if( rayon <= 0 )
return;
cpos = centre; UserToDeviceCoordinate(cpos); cpos = centre; UserToDeviceCoordinate( cpos );
if( PlotOrientOptions == PLOT_MIROIR) if( PlotOrientOptions == PLOT_MIROIR )
{ {
EndAngle = - EndAngle; EndAngle = -EndAngle;
StAngle = - StAngle; StAngle = -StAngle;
EXCHG (StAngle, EndAngle); EXCHG( StAngle, EndAngle );
} }
angle = (EndAngle - StAngle) /10.0; angle = (EndAngle - StAngle) / 10.0;
/* Calcul des coord du point de depart : */ /* Calcul des coord du point de depart : */
cmap.x = (int)( centre.x + ( rayon * cos(StAngle * M_PI / 1800 ) ) ); cmap.x = (int) ( centre.x + ( rayon * cos( StAngle * M_PI / 1800 ) ) );
cmap.y = (int)(centre.y + ( rayon * sin(StAngle * M_PI / 1800 ) ) ); cmap.y = (int) ( centre.y + ( rayon * sin( StAngle * M_PI / 1800 ) ) );
UserToDeviceCoordinate(cmap); UserToDeviceCoordinate( cmap );
Plume_HPGL('U'); Plume_HPGL( 'U' );
sprintf(Line,"PU;PA %d,%d;PD;AA %d,%d, ", cmap.x, cmap.y, cpos.x, cpos.y); sprintf( Line, "PU;PA %d,%d;PD;AA %d,%d, ", cmap.x, cmap.y, cpos.x, cpos.y );
fputs(Line,PlotOutputFile) ; fputs( Line, PlotOutputFile );
sprintf(Line,"%f", - angle); to_point(Line); // Transforme , et . du separateur sprintf( Line, "%f", -angle ); to_point( Line ); // Transforme , et . du separateur
fputs(Line,PlotOutputFile) ; fputs( Line, PlotOutputFile );
sprintf(Line,", %d", CHORD_ANGLE); fputs(Line,PlotOutputFile) ; sprintf( Line, ", %d", CHORD_ANGLE ); fputs( Line, PlotOutputFile );
sprintf(Line,";PU;\n"); fputs(Line,PlotOutputFile) ; sprintf( Line, ";PU;\n" ); fputs( Line, PlotOutputFile );
Plume_HPGL('U'); Plume_HPGL( 'U' );
} }
/*****************************************************/ /*****************************************************/
void PlotPolyHPGL( int nb, int * coord, int fill, int width) void PlotPolyHPGL( int nb, int* coord, int fill, int width )
/*****************************************************/ /*****************************************************/
/* Trace un polygone (ferme si rempli) en format HPGL /* Trace un polygone (ferme si rempli) en format HPGL
coord = tableau des coord des sommets * coord = tableau des coord des sommets
nb = nombre de coord ( 1 coord = 2 elements: X et Y du tableau ) * nb = nombre de coord ( 1 coord = 2 elements: X et Y du tableau )
fill : si != 0 polygone rempli * fill : si != 0 polygone rempli
*/ */
{ {
int ii; int ii;
if( nb <= 1 ) return;
Move_Plume_HPGL( wxPoint(coord[0],coord[1]), 'U'); if( nb <= 1 )
for( ii = 1; ii < nb ; ii ++ ) return;
{
Move_Plume_HPGL( wxPoint(coord[ii * 2],coord[(ii*2) +1]), 'D');
}
/* Fermeture eventuelle du polygone */ Move_Plume_HPGL( wxPoint( coord[0], coord[1] ), 'U' );
if ( fill ) for( ii = 1; ii < nb; ii++ )
{ {
ii = (nb - 1) * 2; Move_Plume_HPGL( wxPoint( coord[ii * 2], coord[(ii * 2) + 1] ), 'D' );
if( (coord[ii] != coord[0] ) || (coord[ii+1] != coord[0]) ) }
Move_Plume_HPGL( wxPoint(coord[0],coord[1]), 'D');
} /* Fermeture eventuelle du polygone */
Plume_HPGL('U'); if( fill )
{
ii = (nb - 1) * 2;
if( (coord[ii] != coord[0] ) || (coord[ii + 1] != coord[0]) )
Move_Plume_HPGL( wxPoint( coord[0], coord[1] ), 'D' );
}
Plume_HPGL( 'U' );
} }
/**********************************************/ /**********************************************/
void Move_Plume_HPGL( wxPoint pos, int plume ) void Move_Plume_HPGL( wxPoint pos, int plume )
/**********************************************/ /**********************************************/
/* /*
deplace la plume levee (plume = 'U') ou baissee (plume = 'D') * deplace la plume levee (plume = 'U') ou baissee (plume = 'D')
en position x,y * en position x,y
Unites en Unites DESSIN * Unites en Unites DESSIN
Si plume = 'Z' lever de plume sans deplacement * Si plume = 'Z' lever de plume sans deplacement
*/ */
{ {
char Line[256]; char Line[256];
if ( plume == 'Z') if( plume == 'Z' )
{ {
Plume_HPGL('U'); Plume_HPGL( 'U' );
return; return;
} }
Plume_HPGL(plume); Plume_HPGL( plume );
UserToDeviceCoordinate(pos); UserToDeviceCoordinate( pos );
sprintf(Line,"PA %d,%d;\n",pos.x,pos.y) ; fputs(Line,PlotOutputFile) ; sprintf( Line, "PA %d,%d;\n", pos.x, pos.y ); fputs( Line, PlotOutputFile );
} }
/***************************/ /***************************/
void Plume_HPGL( int plume ) void Plume_HPGL( int plume )
/***************************/ /***************************/
/* leve (plume = 'U') ou baisse (plume = 'D') la plume /* leve (plume = 'U') ou baisse (plume = 'D') la plume
*/ */
{ {
if ( plume == 'U') if( plume == 'U' )
{ {
if(etat_plume != 'U' ) fputs("PU;",PlotOutputFile) ; if( etat_plume != 'U' )
etat_plume = 'U'; fputs( "PU;", PlotOutputFile );
} etat_plume = 'U';
else }
{ else
if(etat_plume != 'D' )fputs("PD;",PlotOutputFile) ; {
etat_plume = 'D'; if( etat_plume != 'D' )
} fputs( "PD;", PlotOutputFile );
etat_plume = 'D';
}
} }

View File

@ -1,6 +1,6 @@
/******************************************/ /******************************************/
/* Kicad: Common plot Postscript Routines */ /* Kicad: Common plot Postscript Routines */
/******************************************/ /******************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
@ -14,20 +14,20 @@
#include "wx/defs.h" #include "wx/defs.h"
// Variables partagees avec Common plot Postscript Routines // Variables partagees avec Common plot Postscript Routines
extern wxPoint LastPenPosition; extern wxPoint LastPenPosition;
extern wxPoint PlotOffset; extern wxPoint PlotOffset;
extern FILE * PlotOutputFile; extern FILE* PlotOutputFile;
extern double XScale, YScale; extern double XScale, YScale;
extern int g_DefaultPenWidth, g_CurrentPenWidth; extern int g_DefaultPenWidth, g_CurrentPenWidth;
extern int PlotOrientOptions, etat_plume; extern int PlotOrientOptions, etat_plume;
// Locales // Locales
static Ki_PageDescr * SheetPS; static Ki_PageDescr* SheetPS;
/*************************************************************************************/ /*************************************************************************************/
void InitPlotParametresPS(wxPoint offset, Ki_PageDescr * sheet, void InitPlotParametresPS( wxPoint offset, Ki_PageDescr* sheet,
double xscale, double yscale, int orient) double xscale, double yscale, int orient )
/*************************************************************************************/ /*************************************************************************************/
/* Set the plot offset for the current plotting /* Set the plot offset for the current plotting
@ -35,50 +35,52 @@ void InitPlotParametresPS(wxPoint offset, Ki_PageDescr * sheet,
* device_xscale,device_yscale = device coordinate scale (i.e scale used by plot device) * device_xscale,device_yscale = device coordinate scale (i.e scale used by plot device)
*/ */
{ {
PlotOrientOptions = orient; PlotOrientOptions = orient;
PlotOffset = offset; PlotOffset = offset;
SheetPS = sheet; SheetPS = sheet;
XScale = xscale; XScale = xscale;
YScale = yscale; YScale = yscale;
g_CurrentPenWidth = -1; g_CurrentPenWidth = -1;
} }
/*************************************************************************************/ /*************************************************************************************/
void SetDefaultLineWidthPS(int width) void SetDefaultLineWidthPS( int width )
/*************************************************************************************/ /*************************************************************************************/
/* Set the default line width (in 1/1000 inch) for the current plotting /* Set the default line width (in 1/1000 inch) for the current plotting
*/ */
{ {
g_DefaultPenWidth = width; // epaisseur du trait standard en 1/1000 pouce g_DefaultPenWidth = width; // epaisseur du trait standard en 1/1000 pouce
g_CurrentPenWidth = -1; g_CurrentPenWidth = -1;
} }
/***************************************/ /***************************************/
void SetCurrentLineWidthPS(int width) void SetCurrentLineWidthPS( int width )
/***************************************/ /***************************************/
/* Set the Current line width (in 1/1000 inch) for the next plot /* Set the Current line width (in 1/1000 inch) for the next plot
*/ */
{ {
int pen_width; D(printf( "PlotOutputFile = %p\n", PlotOutputFile );)
if( width > 0 ) int pen_width;
pen_width = width;
else
pen_width = g_DefaultPenWidth;
if( pen_width != g_CurrentPenWidth ) if( width > 0 )
fprintf(PlotOutputFile, "%d setlinewidth\n", (int)(XScale * pen_width) ); pen_width = width;
else
pen_width = g_DefaultPenWidth;
g_CurrentPenWidth = pen_width; if( pen_width != g_CurrentPenWidth )
fprintf( PlotOutputFile, "%d setlinewidth\n", (int) (XScale * pen_width) );
g_CurrentPenWidth = pen_width;
} }
/******************************/ /******************************/
void SetColorMapPS(int color) void SetColorMapPS( int color )
/******************************/ /******************************/
/* Print the postscript set color command: /* Print the postscript set color command:
@ -88,82 +90,92 @@ void SetColorMapPS(int color)
* color = color index in ColorRefs[] * color = color index in ColorRefs[]
*/ */
{ {
char Line[1024]; D(printf( "PlotOutputFile = %p\n", PlotOutputFile );)
sprintf( Line, "%.3f %.3f %.3f setrgbcolor\n", char Line[1024];
(float)ColorRefs[color].m_Red / 255,
(float)ColorRefs[color].m_Green / 255, sprintf( Line, "%.3f %.3f %.3f setrgbcolor\n",
(float)ColorRefs[color].m_Blue / 255 ); (float) ColorRefs[color].m_Red / 255,
to_point(Line); (float) ColorRefs[color].m_Green / 255,
fputs( Line, PlotOutputFile ); (float) ColorRefs[color].m_Blue / 255 );
to_point( Line );
fputs( Line, PlotOutputFile );
} }
/***************************************************************/ /***************************************************************/
void PlotFilledSegmentPS(wxPoint start, wxPoint end, int width) void PlotFilledSegmentPS( wxPoint start, wxPoint end, int width )
/***************************************************************/ /***************************************************************/
/* Plot 1 segment like a track segment /* Plot 1 segment like a track segment
*/ */
{ {
UserToDeviceCoordinate(start); D(printf( "PlotOutputFile = %p\n", PlotOutputFile );)
UserToDeviceCoordinate(end);
SetCurrentLineWidthPS(width); UserToDeviceCoordinate( start );
fprintf(PlotOutputFile,"%d %d %d %d line\n", start.x, start.y, end.x, end.y); UserToDeviceCoordinate( end );
SetCurrentLineWidthPS( width );
fprintf( PlotOutputFile, "%d %d %d %d line\n", start.x, start.y, end.x, end.y );
} }
/******************************************************/ /******************************************************/
void PlotCircle_PS(wxPoint pos, int diametre, int width) void PlotCircle_PS( wxPoint pos, int diametre, int width )
/******************************************************/ /******************************************************/
{ {
int rayon; D(printf( "PlotOutputFile = %p\n", PlotOutputFile );)
char Line[256];
UserToDeviceCoordinate(pos); int rayon;
rayon = (int)(XScale * diametre / 2); char Line[256];
if( rayon < 0 ) UserToDeviceCoordinate( pos );
rayon = 0; rayon = (int) (XScale * diametre / 2);
SetCurrentLineWidthPS(width); if( rayon < 0 )
sprintf(Line, "newpath %d %d %d 0 360 arc stroke\n", pos.x, pos.y, rayon); rayon = 0;
fputs(Line, PlotOutputFile);
SetCurrentLineWidthPS( width );
sprintf( Line, "newpath %d %d %d 0 360 arc stroke\n", pos.x, pos.y, rayon );
fputs( Line, PlotOutputFile );
} }
/**************************************************************************************/ /**************************************************************************************/
void PlotArcPS(wxPoint centre, int StAngle, int EndAngle, int rayon, int width) void PlotArcPS( wxPoint centre, int StAngle, int EndAngle, int rayon, int width )
/**************************************************************************************/ /**************************************************************************************/
/* Plot an arc: /* Plot an arc:
* StAngle, EndAngle = start and end arc in 0.1 degree * StAngle, EndAngle = start and end arc in 0.1 degree
*/ */
{ {
char Line[256]; D(printf( "PlotOutputFile = %p\n", PlotOutputFile );)
if( rayon <= 0 ) char Line[256];
return;
SetCurrentLineWidthPS(width); if( rayon <= 0 )
// Calcul des coord du point de depart : return;
UserToDeviceCoordinate(centre);
if( PlotOrientOptions == PLOT_MIROIR ) SetCurrentLineWidthPS( width );
sprintf( Line, "newpath %d %d %d %f %f arc stroke\n", centre.x, centre.y,
(int)(rayon * XScale), (float)StAngle / 10, (float)EndAngle / 10 ); // Calcul des coord du point de depart :
else UserToDeviceCoordinate( centre );
sprintf( Line, "newpath %d %d %d %f %f arc stroke\n", centre.x, centre.y,
(int)(rayon * XScale), -(float)EndAngle / 10, -(float)StAngle / 10 ); if( PlotOrientOptions == PLOT_MIROIR )
// Undo internationalization printf (float x.y printed x,y) sprintf( Line, "newpath %d %d %d %f %f arc stroke\n", centre.x, centre.y,
to_point(Line); (int) (rayon * XScale), (float) StAngle / 10, (float) EndAngle / 10 );
fputs(Line, PlotOutputFile); else
sprintf( Line, "newpath %d %d %d %f %f arc stroke\n", centre.x, centre.y,
(int) (rayon * XScale), -(float) EndAngle / 10, -(float) StAngle / 10 );
// Undo internationalization printf (float x.y printed x,y)
to_point( Line );
fputs( Line, PlotOutputFile );
} }
/*****************************************************************/ /*****************************************************************/
void PlotPolyPS(int nb_segm, int * coord, int fill, int width) void PlotPolyPS( int nb_segm, int* coord, int fill, int width )
/*****************************************************************/ /*****************************************************************/
/* Draw a polygon ( a filled polygon if fill == 1 ) in POSTSCRIPT format /* Draw a polygon ( a filled polygon if fill == 1 ) in POSTSCRIPT format
@ -173,211 +185,226 @@ void PlotPolyPS(int nb_segm, int * coord, int fill, int width)
* @param width = line width * @param width = line width
*/ */
{ {
int ii; D(printf( "PlotOutputFile = %p\n", PlotOutputFile );)
wxPoint pos;
if( nb_segm <= 1 ) int ii;
return; wxPoint pos;
SetCurrentLineWidthPS(width); if( nb_segm <= 1 )
return;
pos.x = coord[0]; SetCurrentLineWidthPS( width );
pos.y = coord[1];
UserToDeviceCoordinate(pos);
fprintf(PlotOutputFile, "newpath %d %d moveto\n", pos.x, pos.y);
for( ii = 1; ii < nb_segm; ii ++ ) pos.x = coord[0];
{ pos.y = coord[1];
pos.x = coord[2 * ii]; UserToDeviceCoordinate( pos );
pos.y = coord[2 * ii + 1]; fprintf( PlotOutputFile, "newpath %d %d moveto\n", pos.x, pos.y );
UserToDeviceCoordinate(pos);
fprintf(PlotOutputFile, "%d %d lineto\n", pos.x, pos.y);
}
// Fermeture du polygone for( ii = 1; ii < nb_segm; ii++ )
if( fill ) {
fprintf(PlotOutputFile, "closepath "); pos.x = coord[2 * ii];
if( fill == 1 ) pos.y = coord[2 * ii + 1];
fprintf(PlotOutputFile, "fill "); UserToDeviceCoordinate( pos );
fprintf(PlotOutputFile, "stroke\n"); fprintf( PlotOutputFile, "%d %d lineto\n", pos.x, pos.y );
}
// Fermeture du polygone
if( fill )
fprintf( PlotOutputFile, "closepath " );
if( fill == 1 )
fprintf( PlotOutputFile, "fill " );
fprintf( PlotOutputFile, "stroke\n" );
} }
/*************************************/ /*************************************/
void LineTo_PS(wxPoint pos, int plume) void LineTo_PS( wxPoint pos, int plume )
/*************************************/ /*************************************/
/* Routine to draw to a new position /* Routine to draw to a new position
*/ */
{ {
if( plume == 'Z' ) D(printf( "PlotOutputFile = %p\n", PlotOutputFile );)
return;
UserToDeviceCoordinate(pos); if( plume == 'Z' )
if( plume == 'D' ) return;
{
char Line[256]; UserToDeviceCoordinate( pos );
sprintf(Line, "%d %d %d %d line\n", if( plume == 'D' )
LastPenPosition.x, LastPenPosition.y, pos.x, pos.y); {
fputs(Line, PlotOutputFile); char Line[256];
} sprintf( Line, "%d %d %d %d line\n",
LastPenPosition = pos; LastPenPosition.x, LastPenPosition.y, pos.x, pos.y );
fputs( Line, PlotOutputFile );
}
LastPenPosition = pos;
} }
/***********************************************************/ /***********************************************************/
void PrintHeaderPS(FILE * file, const wxString & Creator, void PrintHeaderPS( FILE* file, const wxString& Creator,
const wxString & FileName, int PageCount, const wxString& FileName, int PageCount,
int BBox[4], int PaperOrientation) int BBox[4], int PaperOrientation )
/***********************************************************/ /***********************************************************/
/* The code within this function (and the CloseFilePS function) /* The code within this function (and the CloseFilePS function)
* creates postscript files whose contents comply with Adobe's * creates postscript files whose contents comply with Adobe's
* Document Structuring Convention, as documented by assorted * Document Structuring Convention, as documented by assorted
* details described within the following URLs: * details described within the following URLs:
* *
* http://en.wikipedia.org/wiki/Document_Structuring_Conventions * http://en.wikipedia.org/wiki/Document_Structuring_Conventions
* http://partners.adobe.com/public/developer/en/ps/5001.DSC_Spec.pdf * http://partners.adobe.com/public/developer/en/ps/5001.DSC_Spec.pdf
* *
* *
* The PageCount and PaperOrientation parameters have been provided to * The PageCount and PaperOrientation parameters have been provided to
* respectively cater for the production of multiple-page postscript * respectively cater for the production of multiple-page postscript
* files, and postscript files having either a portrait orientation * files, and postscript files having either a portrait orientation
* or a landscape orientation. * or a landscape orientation.
* *
* BBox is the boundary box (position and size of the "client rectangle" * BBox is the boundary box (position and size of the "client rectangle"
* for drawings (page - margins) in mils (0.001 inch) * for drawings (page - margins) in mils (0.001 inch)
*/ */
{ {
wxString msg; wxString msg;
char Line[1024]; char Line[1024];
const char *PSMacro[] = {
"/line {\n",
" newpath\n",
" moveto\n",
" lineto\n",
" stroke\n",
"} def\n",
"gsave\n",
"72 72 scale\t\t\t% Talk inches\n",
"1 setlinecap\n",
"1 setlinejoin\n",
"1 setlinewidth\n",
NULL
};
const double MIL_TO_INCH = 0.001;
int ii;
time_t time1970 = time(NULL);
PlotOutputFile = file; static const char* PSMacro[] = {
"/line {\n",
" newpath\n",
" moveto\n",
" lineto\n",
" stroke\n",
"} def\n",
"gsave\n",
"72 72 scale\t\t\t% Talk inches\n",
"1 setlinecap\n",
"1 setlinejoin\n",
"1 setlinewidth\n",
NULL
};
fputs("%!PS-Adobe-3.0\n", PlotOutputFile); // Print header const double MIL_TO_INCH = 0.001;
int ii;
time_t time1970 = time( NULL );
sprintf( Line, "%%%%Creator: %s\n", CONV_TO_UTF8(Creator) ); PlotOutputFile = file;
fputs(Line, PlotOutputFile);
// A "newline" character ("\n") is not included in the following string, D(printf( "PrintHeaderPS PlotOutputFile = %p\n", PlotOutputFile );)
// because it is provided by the ctime() function.
sprintf( Line, "%%%%CreationDate: %s", ctime(&time1970) );
fputs(Line, PlotOutputFile);
sprintf( Line, "%%%%Title: %s\n", CONV_TO_UTF8(FileName) );
fputs(Line, PlotOutputFile);
sprintf( Line, "%%%%Pages: %d\n", PageCount ); fputs( "%!PS-Adobe-3.0\n", PlotOutputFile ); // Print header
fputs(Line, PlotOutputFile);
sprintf( Line, "%%%%PageOrder: Ascend\n" ); sprintf( Line, "%%%%Creator: %s\n", CONV_TO_UTF8( Creator ) );
fputs(Line, PlotOutputFile); fputs( Line, PlotOutputFile );
// Print boundary box en 1/72 pouce, box is in mils // A "newline" character ("\n") is not included in the following string,
const double CONV_SCALE = MIL_TO_INCH * 72; // because it is provided by the ctime() function.
// The coordinates of the lower left corner of the boundary sprintf( Line, "%%%%CreationDate: %s", ctime( &time1970 ) );
// box need to be "rounded down", but the coordinates of its fputs( Line, PlotOutputFile );
// upper right corner need to be "rounded up" instead.
sprintf( Line, "%%%%BoundingBox: %d %d %d %d\n",
(int)floor((BBox[1] * CONV_SCALE)), (int)floor((BBox[0] * CONV_SCALE)),
(int)ceil((BBox[3] * CONV_SCALE)), (int)ceil((BBox[2] * CONV_SCALE)) );
fputs(Line, PlotOutputFile);
// Specify the size of the sheet and the name associated with that size. sprintf( Line, "%%%%Title: %s\n", CONV_TO_UTF8( FileName ) );
// (If the "User size" option has been selected for the sheet size, fputs( Line, PlotOutputFile );
// identify the sheet size as "Custom" (rather than as "User"), but
// otherwise use the name assigned by KiCad for each sheet size.)
//
// (The Document Structuring Convention also supports sheet weight,
// sheet colour, and sheet type properties being specified within a
// %%DocumentMedia comment, but they are not being specified here;
// a zero and two null strings are subsequently provided instead.)
//
// (NOTE: m_Size.y is *supposed* to be listed before m_Size.x;
// the order in which they are specified is not wrong!)
if( SheetPS->m_Name.Cmp( wxT("User") ) == 0 )
sprintf( Line, "%%%%DocumentMedia: Custom %d %d 0 () ()\n",
(int)round( SheetPS->m_Size.y * CONV_SCALE ),
(int)round( SheetPS->m_Size.x * CONV_SCALE ) );
else // ( if SheetPS->m_Name does not equal "User" )
sprintf( Line, "%%%%DocumentMedia: %s %d %d 0 () ()\n",
CONV_TO_UTF8( SheetPS->m_Name ),
(int)round( SheetPS->m_Size.y * CONV_SCALE ),
(int)round( SheetPS->m_Size.x * CONV_SCALE ) );
fputs(Line, PlotOutputFile);
if( PaperOrientation == wxPORTRAIT ) sprintf( Line, "%%%%Pages: %d\n", PageCount );
sprintf( Line, "%%%%Orientation: Portrait\n" ); fputs( Line, PlotOutputFile );
else
sprintf( Line, "%%%%Orientation: Landscape\n" );
fputs(Line, PlotOutputFile);
sprintf( Line, "%%%%EndComments\n" ); sprintf( Line, "%%%%PageOrder: Ascend\n" );
fputs(Line, PlotOutputFile); fputs( Line, PlotOutputFile );
// Now specify various other details. // Print boundary box en 1/72 pouce, box is in mils
const double CONV_SCALE = MIL_TO_INCH * 72;
// The following string has been specified here (rather than within // The coordinates of the lower left corner of the boundary
// PSMacro[]) to highlight that it has been provided to ensure that the // box need to be "rounded down", but the coordinates of its
// contents of the postscript file comply with the details specified // upper right corner need to be "rounded up" instead.
// within the Document Structuring Convention. sprintf( Line, "%%%%BoundingBox: %d %d %d %d\n",
sprintf( Line, "%%%%Page: 1 1\n" ); (int) floor( (BBox[1] * CONV_SCALE) ), (int) floor( (BBox[0] * CONV_SCALE) ),
fputs(Line, PlotOutputFile); (int) ceil( (BBox[3] * CONV_SCALE) ), (int) ceil( (BBox[2] * CONV_SCALE) ) );
for ( ii = 0; PSMacro[ii] != NULL; ii++ ) fputs( Line, PlotOutputFile );
{
fputs(PSMacro[ii], PlotOutputFile);
}
if( PaperOrientation == wxLANDSCAPE ) // Specify the size of the sheet and the name associated with that size.
sprintf(Line, "%f %f translate 90 rotate\n", // (If the "User size" option has been selected for the sheet size,
(float)BBox[3] * MIL_TO_INCH, (float)BBox[0] * MIL_TO_INCH); // identify the sheet size as "Custom" (rather than as "User"), but
// (If support for creating postscript files with a portrait orientation // otherwise use the name assigned by KiCad for each sheet size.)
// is ever provided, determine whether it would be necessary to provide //
// an "else" command and then an appropriate "sprintf" command here.) // (The Document Structuring Convention also supports sheet weight,
// sheet colour, and sheet type properties being specified within a
// %%DocumentMedia comment, but they are not being specified here;
// a zero and two null strings are subsequently provided instead.)
//
// (NOTE: m_Size.y is *supposed* to be listed before m_Size.x;
// the order in which they are specified is not wrong!)
if( SheetPS->m_Name.Cmp( wxT( "User" ) ) == 0 )
sprintf( Line, "%%%%DocumentMedia: Custom %d %d 0 () ()\n",
(int) round( SheetPS->m_Size.y * CONV_SCALE ),
(int) round( SheetPS->m_Size.x * CONV_SCALE ) );
// compensation internationalisation printf (float x.y généré x,y) else // ( if SheetPS->m_Name does not equal "User" )
to_point(Line); sprintf( Line, "%%%%DocumentMedia: %s %d %d 0 () ()\n",
CONV_TO_UTF8( SheetPS->m_Name ),
(int) round( SheetPS->m_Size.y * CONV_SCALE ),
(int) round( SheetPS->m_Size.x * CONV_SCALE ) );
fputs( Line, PlotOutputFile );
fputs(Line, PlotOutputFile); if( PaperOrientation == wxPORTRAIT )
sprintf( Line, "%%%%Orientation: Portrait\n" );
else
sprintf( Line, "%%%%Orientation: Landscape\n" );
sprintf(Line, "%f %f scale\t\t%% Move to User coordinates\n", fputs( Line, PlotOutputFile );
XScale, YScale);
to_point(Line);
fputs(Line, PlotOutputFile);
// Set default line width ( g_DefaultPenWidth is in user units ) sprintf( Line, "%%%%EndComments\n" );
fprintf(PlotOutputFile, "%d setlinewidth\n", g_DefaultPenWidth); fputs( Line, PlotOutputFile );
// Now specify various other details.
// The following string has been specified here (rather than within
// PSMacro[]) to highlight that it has been provided to ensure that the
// contents of the postscript file comply with the details specified
// within the Document Structuring Convention.
sprintf( Line, "%%%%Page: 1 1\n" );
fputs( Line, PlotOutputFile );
for( ii = 0; PSMacro[ii] != NULL; ii++ )
{
fputs( PSMacro[ii], PlotOutputFile );
}
if( PaperOrientation == wxLANDSCAPE )
sprintf( Line, "%f %f translate 90 rotate\n",
(float) BBox[3] * MIL_TO_INCH, (float) BBox[0] * MIL_TO_INCH );
// (If support for creating postscript files with a portrait orientation
// is ever provided, determine whether it would be necessary to provide
// an "else" command and then an appropriate "sprintf" command here.)
// compensation internationalisation printf (float x.y généré x,y)
to_point( Line );
fputs( Line, PlotOutputFile );
sprintf( Line, "%f %f scale\t\t%% Move to User coordinates\n",
XScale, YScale );
to_point( Line );
fputs( Line, PlotOutputFile );
// Set default line width ( g_DefaultPenWidth is in user units )
fprintf( PlotOutputFile, "%d setlinewidth\n", g_DefaultPenWidth );
} }
/******************************************/ /******************************************/
bool CloseFilePS(FILE * plot_file) bool CloseFilePS( FILE* plot_file )
/******************************************/ /******************************************/
{ {
fputs("showpage\n", plot_file); D(printf( "CloseFilePS\n" );)
fputs("grestore\n", plot_file);
fputs("%%EOF\n", plot_file);
fclose(plot_file); fputs( "showpage\n", plot_file );
fputs( "grestore\n", plot_file );
fputs( "%%EOF\n", plot_file );
return TRUE; fclose( plot_file );
return TRUE;
} }

View File

@ -1,6 +1,6 @@
/******************************************/ /******************************************/
/* Kicad: Common plot Postscript Routines */ /* Kicad: Common plot Postscript Routines */
/******************************************/ /******************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
@ -16,343 +16,358 @@
// Variables partagees avec Common plot Postscript et HPLG Routines // Variables partagees avec Common plot Postscript et HPLG Routines
wxPoint LastPenPosition; wxPoint LastPenPosition;
wxPoint PlotOffset; wxPoint PlotOffset;
FILE * PlotOutputFile; FILE* PlotOutputFile;
double XScale, YScale; double XScale, YScale;
int g_DefaultPenWidth; int g_DefaultPenWidth;
int g_CurrentPenWidth = -1; int g_CurrentPenWidth = -1;
int PlotOrientOptions, etat_plume; int PlotOrientOptions, etat_plume;
// Locales // Locales
static Ki_PageDescr * SheetPS; static Ki_PageDescr* SheetPS;
/*************************/ /*************************/
void ForcePenReinit() void ForcePenReinit()
/*************************/ /*************************/
/* set the flag g_CurrentPenWidth to -1 in order to force a pen width redefinition /* set the flag g_CurrentPenWidth to -1 in order to force a pen width redefinition
for the next draw command * for the next draw command
*/ */
{ {
g_CurrentPenWidth = -1; g_CurrentPenWidth = -1;
} }
/**********************************************/ /**********************************************/
void SetPlotScale(double xscale, double yscale) void SetPlotScale( double xscale, double yscale )
/**********************************************/ /**********************************************/
/* Set the plot scale for the current plotting) /* Set the plot scale for the current plotting)
*/ */
{ {
XScale = xscale; XScale = xscale;
YScale = yscale; YScale = yscale;
} }
/*********************************/ /*********************************/
void SetPlotOffset(wxPoint offset) void SetPlotOffset( wxPoint offset )
/*********************************/ /*********************************/
/* Set the plot offset for the current plotting) /* Set the plot offset for the current plotting)
*/ */
{ {
PlotOffset = offset; PlotOffset = offset;
} }
/***************************************************************************/ /***************************************************************************/
void InitPlotParametresGERBER(wxPoint offset, double xscale, double yscale) void InitPlotParametresGERBER( wxPoint offset, double xscale, double yscale )
/***************************************************************************/ /***************************************************************************/
/* Set the plot offset for the current plotting /* Set the plot offset for the current plotting
xscale,yscale = coordinate scale (scale coefficient for coordinates) * xscale,yscale = coordinate scale (scale coefficient for coordinates)
*/ */
{ {
PlotOrientOptions = 0; PlotOrientOptions = 0;
PlotOffset = offset; PlotOffset = offset;
SheetPS = NULL; SheetPS = NULL;
XScale = xscale; XScale = xscale;
YScale = yscale; YScale = yscale;
g_DefaultPenWidth = 120; /* epaisseur du trait standard en 1/1000 pouce */ g_DefaultPenWidth = 120; /* epaisseur du trait standard en 1/1000 pouce */
g_CurrentPenWidth = -1; g_CurrentPenWidth = -1;
} }
/*******************************************************/ /*******************************************************/
void PlotWorkSheet(int format_plot, BASE_SCREEN * screen) void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
/*******************************************************/ /*******************************************************/
/* Plot sheet references /* Plot sheet references
margin is in mils (1/1000 inch) * margin is in mils (1/1000 inch)
*/ */
{ {
#define WSTEXTSIZE 50 // Text size in mils #define WSTEXTSIZE 50 // Text size in mils
Ki_PageDescr * Sheet = screen->m_CurrentSheetDesc; Ki_PageDescr* Sheet = screen->m_CurrentSheetDesc;
int ii, jj, xg , yg, ipas, gxpas, gypas; int ii, jj, xg, yg, ipas, gxpas, gypas;
wxSize PageSize; wxSize PageSize;
wxPoint pos, ref; wxPoint pos, ref;
int color; int color;
Ki_WorkSheetData * WsItem; Ki_WorkSheetData* WsItem;
int conv_unit = screen->GetInternalUnits()/1000; /* Scale to convert dimension in 1/1000 in into internal units int conv_unit = screen->GetInternalUnits() / 1000; /* Scale to convert dimension in 1/1000 in into internal units
(1/1000 inc for EESchema, 1/10000 for pcbnew */ * (1/1000 inc for EESchema, 1/10000 for pcbnew */
wxString msg; wxString msg;
wxSize text_size; wxSize text_size;
void (*FctPlume)(wxPoint pos, int state); void (*FctPlume)( wxPoint pos, int state );
int UpperLimit = VARIABLE_BLOCK_START_POSITION; int UpperLimit = VARIABLE_BLOCK_START_POSITION;
switch ( format_plot) switch( format_plot )
{ {
case PLOT_FORMAT_POST: case PLOT_FORMAT_POST:
FctPlume = LineTo_PS; FctPlume = LineTo_PS;
break; break;
case PLOT_FORMAT_HPGL: case PLOT_FORMAT_HPGL:
FctPlume = Move_Plume_HPGL; FctPlume = Move_Plume_HPGL;
break; break;
case PLOT_FORMAT_GERBER: case PLOT_FORMAT_GERBER:
default: default:
return; return;
} }
color = BLACK; color = BLACK;
PageSize.x = Sheet->m_Size.x;
PageSize.y = Sheet->m_Size.y;
/* trace de la bordure */ PageSize.x = Sheet->m_Size.x;
ref.x = Sheet->m_LeftMargin * conv_unit; PageSize.y = Sheet->m_Size.y;
ref.y = Sheet->m_TopMargin * conv_unit; /* Upper left corner */
xg = (PageSize.x - Sheet->m_RightMargin) * conv_unit;
yg = (PageSize.y - Sheet->m_BottomMargin) * conv_unit; /* lower right corner */
for ( ii = 0; ii < 2 ; ii++ ) /* trace de la bordure */
{ ref.x = Sheet->m_LeftMargin * conv_unit;
FctPlume(ref,'U'); ref.y = Sheet->m_TopMargin * conv_unit; /* Upper left corner */
pos.x = xg; pos.y = ref.y; xg = (PageSize.x - Sheet->m_RightMargin) * conv_unit;
FctPlume(pos,'D'); yg = (PageSize.y - Sheet->m_BottomMargin) * conv_unit; /* lower right corner */
pos.x = xg; pos.y = yg;
FctPlume(pos,'D');
pos.x = ref.x; pos.y = yg;
FctPlume( pos,'D' );
FctPlume(ref,'D');
ref.x += GRID_REF_W * conv_unit; ref.y += GRID_REF_W * conv_unit;
xg -= GRID_REF_W * conv_unit; yg -= GRID_REF_W * conv_unit;
}
/* trace des reperes */ for( ii = 0; ii < 2; ii++ )
text_size.x = WSTEXTSIZE * conv_unit; {
text_size.y = WSTEXTSIZE * conv_unit; FctPlume( ref, 'U' );
pos.x = xg; pos.y = ref.y;
FctPlume( pos, 'D' );
pos.x = xg; pos.y = yg;
FctPlume( pos, 'D' );
pos.x = ref.x; pos.y = yg;
FctPlume( pos, 'D' );
FctPlume( ref, 'D' );
ref.x += GRID_REF_W * conv_unit; ref.y += GRID_REF_W * conv_unit;
xg -= GRID_REF_W * conv_unit; yg -= GRID_REF_W * conv_unit;
}
ref.x = Sheet->m_LeftMargin; /* trace des reperes */
ref.y = Sheet->m_TopMargin; /* Upper left corner in 1/1000 inch */ text_size.x = WSTEXTSIZE * conv_unit;
xg = (PageSize.x - Sheet->m_RightMargin); text_size.y = WSTEXTSIZE * conv_unit;
yg = (PageSize.y - Sheet->m_BottomMargin); /* lower right corner in 1/1000 inch */
/* Trace des reperes selon l'axe X */ ref.x = Sheet->m_LeftMargin;
ipas = (xg - ref.x) / PAS_REF; ref.y = Sheet->m_TopMargin; /* Upper left corner in 1/1000 inch */
gxpas = ( xg - ref.x) / ipas; xg = (PageSize.x - Sheet->m_RightMargin);
for ( ii = ref.x + gxpas, jj = 1; ipas > 0 ; ii += gxpas , jj++, ipas--) yg = (PageSize.y - Sheet->m_BottomMargin); /* lower right corner in 1/1000 inch */
{
msg.Empty(); msg << jj;
if( ii < xg - PAS_REF/2 )
{
pos.x = ii * conv_unit; pos.y = ref.y * conv_unit;
FctPlume(pos, 'U');
pos.x = ii * conv_unit; pos.y = (ref.y + GRID_REF_W) * conv_unit;
FctPlume(pos,'D');
}
pos.x = (ii - gxpas/2) * conv_unit;
pos.y = (ref.y + GRID_REF_W/2) * conv_unit;
PlotGraphicText(format_plot, pos, color,
msg, TEXT_ORIENT_HORIZ,text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER);
if( ii < xg - PAS_REF/2 ) /* Trace des reperes selon l'axe X */
{ ipas = (xg - ref.x) / PAS_REF;
pos.x = ii * conv_unit; pos.y = yg * conv_unit; gxpas = ( xg - ref.x) / ipas;
FctPlume(pos,'U'); for( ii = ref.x + gxpas, jj = 1; ipas > 0; ii += gxpas, jj++, ipas-- )
pos.x = ii * conv_unit; pos.y = (yg - GRID_REF_W) * conv_unit; {
FctPlume(pos,'D'); msg.Empty(); msg << jj;
} if( ii < xg - PAS_REF / 2 )
pos.x = (ii - gxpas/2) * conv_unit; {
pos.y = (yg - GRID_REF_W/2) * conv_unit; pos.x = ii * conv_unit; pos.y = ref.y * conv_unit;
PlotGraphicText(format_plot, pos, color, FctPlume( pos, 'U' );
msg, TEXT_ORIENT_HORIZ,text_size, pos.x = ii * conv_unit; pos.y = (ref.y + GRID_REF_W) * conv_unit;
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER); FctPlume( pos, 'D' );
} }
pos.x = (ii - gxpas / 2) * conv_unit;
pos.y = (ref.y + GRID_REF_W / 2) * conv_unit;
PlotGraphicText( format_plot, pos, color,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER );
/* Trace des reperes selon l'axe Y */ if( ii < xg - PAS_REF / 2 )
ipas = (yg - ref.y) / PAS_REF; {
gypas = ( yg - ref.y) / ipas; pos.x = ii * conv_unit; pos.y = yg * conv_unit;
for ( ii = ref.y + gypas, jj = 0; ipas > 0 ; ii += gypas , jj++, ipas--) FctPlume( pos, 'U' );
{ pos.x = ii * conv_unit; pos.y = (yg - GRID_REF_W) * conv_unit;
msg.Empty(); msg << jj; FctPlume( pos, 'D' );
if( ii < yg - PAS_REF/2 ) }
{ pos.x = (ii - gxpas / 2) * conv_unit;
pos.x = ref.x * conv_unit; pos.y = ii * conv_unit; pos.y = (yg - GRID_REF_W / 2) * conv_unit;
FctPlume(pos,'U'); PlotGraphicText( format_plot, pos, color,
pos.x = (ref.x + GRID_REF_W) * conv_unit; pos.y = ii * conv_unit; msg, TEXT_ORIENT_HORIZ, text_size,
FctPlume(pos, 'D'); GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER );
} }
pos.x = (ref.x + GRID_REF_W/2) * conv_unit;
pos.y = (ii - gypas/2) * conv_unit;
PlotGraphicText(format_plot, pos, color,
msg, TEXT_ORIENT_HORIZ,text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER);
if( ii < yg - PAS_REF/2 ) /* Trace des reperes selon l'axe Y */
{ ipas = (yg - ref.y) / PAS_REF;
pos.x = xg * conv_unit; pos.y = ii * conv_unit; gypas = ( yg - ref.y) / ipas;
FctPlume(pos,'U'); for( ii = ref.y + gypas, jj = 0; ipas > 0; ii += gypas, jj++, ipas-- )
pos.x = (xg - GRID_REF_W) * conv_unit; pos.y = ii * conv_unit; {
FctPlume(pos,'D'); msg.Empty(); msg << jj;
} if( ii < yg - PAS_REF / 2 )
pos.x = (xg - GRID_REF_W/2) * conv_unit; {
pos.y = (ii - gypas/2) * conv_unit; pos.x = ref.x * conv_unit; pos.y = ii * conv_unit;
PlotGraphicText(format_plot, pos, color, msg, TEXT_ORIENT_HORIZ,text_size, FctPlume( pos, 'U' );
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER); pos.x = (ref.x + GRID_REF_W) * conv_unit; pos.y = ii * conv_unit;
} FctPlume( pos, 'D' );
}
pos.x = (ref.x + GRID_REF_W / 2) * conv_unit;
pos.y = (ii - gypas / 2) * conv_unit;
PlotGraphicText( format_plot, pos, color,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER );
/* Trace du cartouche */ if( ii < yg - PAS_REF / 2 )
text_size.x = SIZETEXT * conv_unit; {
text_size.y = SIZETEXT * conv_unit; pos.x = xg * conv_unit; pos.y = ii * conv_unit;
ref.x = PageSize.x - GRID_REF_W - Sheet->m_RightMargin; FctPlume( pos, 'U' );
ref.y = PageSize.y - GRID_REF_W - Sheet->m_BottomMargin; pos.x = (xg - GRID_REF_W) * conv_unit; pos.y = ii * conv_unit;
FctPlume( pos, 'D' );
}
pos.x = (xg - GRID_REF_W / 2) * conv_unit;
pos.y = (ii - gypas / 2) * conv_unit;
PlotGraphicText( format_plot, pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER );
}
for( WsItem = &WS_Date; WsItem != NULL; WsItem = WsItem->Pnext ) /* Trace du cartouche */
{ text_size.x = SIZETEXT * conv_unit;
pos.x = (ref.x - WsItem->m_Posx) * conv_unit; text_size.y = SIZETEXT * conv_unit;
pos.y = (ref.y - WsItem->m_Posy) * conv_unit; ref.x = PageSize.x - GRID_REF_W - Sheet->m_RightMargin;
if(WsItem->m_Legende) msg = WsItem->m_Legende; ref.y = PageSize.y - GRID_REF_W - Sheet->m_BottomMargin;
else msg.Empty();
switch( WsItem->m_Type )
{
case WS_DATE:
msg += screen->m_Date;
break;
case WS_REV: for( WsItem = &WS_Date; WsItem != NULL; WsItem = WsItem->Pnext )
msg += screen->m_Revision; {
break; pos.x = (ref.x - WsItem->m_Posx) * conv_unit;
pos.y = (ref.y - WsItem->m_Posy) * conv_unit;
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
else
msg.Empty();
case WS_KICAD_VERSION: switch( WsItem->m_Type )
msg += g_ProductName; {
break; case WS_DATE:
msg += screen->m_Date;
break;
case WS_SIZESHEET: case WS_REV:
msg += screen->m_CurrentSheetDesc->m_Name; msg += screen->m_Revision;
break; break;
case WS_IDENTSHEET: case WS_KICAD_VERSION:
msg << screen->m_ScreenNumber << wxT("/") << screen->m_NumberOfScreen; msg += g_ProductName;
break; break;
case WS_FILENAME: case WS_SIZESHEET:
{ msg += screen->m_CurrentSheetDesc->m_Name;
wxString fname, fext; break;
wxFileName::SplitPath(screen->m_FileName, (wxString*)NULL, &fname, &fext);
msg << fname << wxT(".") << fext;
}
break;
case WS_FULLSHEETNAME: case WS_IDENTSHEET:
// msg += GetScreenDesc(); msg << screen->m_ScreenNumber << wxT( "/" ) << screen->m_NumberOfScreen;
break; break;
case WS_COMPANY_NAME: case WS_FILENAME:
msg += screen->m_Company; {
if ( ! msg.IsEmpty() ) wxString fname, fext;
UpperLimit = MAX(UpperLimit, WsItem->m_Posy+SIZETEXT); wxFileName::SplitPath( screen->m_FileName, (wxString*) NULL, &fname, &fext );
break; msg << fname << wxT( "." ) << fext;
}
break;
case WS_TITLE: case WS_FULLSHEETNAME:
msg += screen->m_Title;
break;
case WS_COMMENT1: // msg += GetScreenDesc();
msg += screen->m_Commentaire1; break;
if ( ! msg.IsEmpty() )
UpperLimit = MAX(UpperLimit, WsItem->m_Posy+SIZETEXT);
break;
case WS_COMMENT2: case WS_COMPANY_NAME:
msg += screen->m_Commentaire2; msg += screen->m_Company;
if ( ! msg.IsEmpty() ) if( !msg.IsEmpty() )
UpperLimit = MAX(UpperLimit, WsItem->m_Posy+SIZETEXT); UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT );
break; break;
case WS_COMMENT3: case WS_TITLE:
msg += screen->m_Commentaire3; msg += screen->m_Title;
if ( ! msg.IsEmpty() ) break;
UpperLimit = MAX(UpperLimit, WsItem->m_Posy+SIZETEXT);
break;
case WS_COMMENT4: case WS_COMMENT1:
msg += screen->m_Commentaire4; msg += screen->m_Commentaire1;
if ( ! msg.IsEmpty() ) if( !msg.IsEmpty() )
UpperLimit = MAX(UpperLimit, WsItem->m_Posy+SIZETEXT); UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT );
break; break;
case WS_UPPER_SEGMENT: case WS_COMMENT2:
if (UpperLimit == 0 ) break; msg += screen->m_Commentaire2;
case WS_LEFT_SEGMENT: if( !msg.IsEmpty() )
WS_MostUpperLine.m_Posy = UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT );
WS_MostUpperLine.m_Endy = break;
WS_MostLeftLine.m_Posy = UpperLimit;
pos.y = (ref.y - WsItem->m_Posy) * conv_unit;
case WS_SEGMENT:
{
wxPoint auxpos;
auxpos.x = (ref.x - WsItem->m_Endx) * conv_unit;;
auxpos.y = (ref.y - WsItem->m_Endy) * conv_unit;;
FctPlume(pos, 'U');
FctPlume(auxpos, 'D');
}
break;
} case WS_COMMENT3:
if ( ! msg.IsEmpty() ) msg += screen->m_Commentaire3;
{ if( !msg.IsEmpty() )
PlotGraphicText(format_plot, pos, color, UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT );
msg.GetData(), TEXT_ORIENT_HORIZ,text_size, break;
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER);
}
}
switch ( format_plot ) case WS_COMMENT4:
{ msg += screen->m_Commentaire4;
case PLOT_FORMAT_HPGL: if( !msg.IsEmpty() )
Plume_HPGL('U'); UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT );
break; break;
case PLOT_FORMAT_POST:
break; case WS_UPPER_SEGMENT:
} if( UpperLimit == 0 )
break;
case WS_LEFT_SEGMENT:
WS_MostUpperLine.m_Posy =
WS_MostUpperLine.m_Endy =
WS_MostLeftLine.m_Posy = UpperLimit;
pos.y = (ref.y - WsItem->m_Posy) * conv_unit;
case WS_SEGMENT:
{
wxPoint auxpos;
auxpos.x = (ref.x - WsItem->m_Endx) * conv_unit;;
auxpos.y = (ref.y - WsItem->m_Endy) * conv_unit;;
FctPlume( pos, 'U' );
FctPlume( auxpos, 'D' );
}
break;
}
if( !msg.IsEmpty() )
{
PlotGraphicText( format_plot, pos, color,
msg.GetData(), TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER );
}
}
switch( format_plot )
{
case PLOT_FORMAT_HPGL:
Plume_HPGL( 'U' );
break;
case PLOT_FORMAT_POST:
break;
}
} }
/******************************************/ /******************************************/
void UserToDeviceCoordinate(wxPoint & pos ) void UserToDeviceCoordinate( wxPoint& pos )
/******************************************/ /******************************************/
/* modifie les coord pos.x et pos.y pour le trace selon l'orientation, /* modifie les coord pos.x et pos.y pour le trace selon l'orientation,
l'echelle, les offsets de trace */ * l'echelle, les offsets de trace */
{ {
pos.x = (int) (pos.x * XScale);
pos.y = (int) (pos.y * YScale);
pos.x = (int) (pos.x * XScale); switch( PlotOrientOptions ) /* Calcul du cadrage */
pos.y = (int) (pos.y * YScale); {
default:
pos.x -= PlotOffset.x; pos.y = PlotOffset.y - pos.y;
break;
switch ( PlotOrientOptions) /* Calcul du cadrage */ case PLOT_MIROIR:
{ pos.x -= PlotOffset.x; pos.y = -PlotOffset.y + pos.y;
default : break;
pos.x -= PlotOffset.x ; pos.y = PlotOffset.y - pos.y; }
break ;
case PLOT_MIROIR :
pos.x -= PlotOffset.x ; pos.y = - PlotOffset.y + pos.y;
break ;
}
} }
/************************************/ /************************************/
void UserToDeviceSize(wxSize & size ) void UserToDeviceSize( wxSize& size )
/************************************/ /************************************/
/* modifie les dimension size.x et size.y pour le trace selon l'echelle */ /* modifie les dimension size.x et size.y pour le trace selon l'echelle */
{ {
size.x = (int) (size.x * XScale); size.x = (int) (size.x * XScale);
size.y = (int) (size.y * YScale); size.y = (int) (size.y * YScale);
} }

View File

@ -62,7 +62,7 @@ void DrawGraphicText( WinEDA_DrawPanel* panel, wxDC* DC,
width = -width; width = -width;
sketch_mode = TRUE; sketch_mode = TRUE;
} }
kk = 0; kk = 0;
ptr = 0; /* ptr = text index */ ptr = 0; /* ptr = text index */
nbchar = Text.Len(); nbchar = Text.Len();
@ -70,7 +70,7 @@ void DrawGraphicText( WinEDA_DrawPanel* panel, wxDC* DC,
return; return;
espacement = (10 * size_h ) / 9; // this is the pitch between chars espacement = (10 * size_h ) / 9; // this is the pitch between chars
ox = cX = Pos.x; ox = cX = Pos.x;
oy = cY = Pos.y; oy = cY = Pos.y;
/* Do not draw the text if out of draw area! */ /* Do not draw the text if out of draw area! */
@ -79,15 +79,15 @@ void DrawGraphicText( WinEDA_DrawPanel* panel, wxDC* DC,
int xm, ym, ll, xc, yc; int xm, ym, ll, xc, yc;
int textsize = ABS( espacement ); int textsize = ABS( espacement );
ll = (textsize * nbchar) / zoom; ll = (textsize * nbchar) / zoom;
xc = GRMapX( cX ); xc = GRMapX( cX );
yc = GRMapY( cY ); yc = GRMapY( cY );
x0 = panel->m_ClipBox.GetX() - ll; x0 = panel->m_ClipBox.GetX() - ll;
y0 = panel->m_ClipBox.GetY() - ll; y0 = panel->m_ClipBox.GetY() - ll;
xm = panel->m_ClipBox.GetRight() + ll; xm = panel->m_ClipBox.GetRight() + ll;
ym = panel->m_ClipBox.GetBottom() + ll; ym = panel->m_ClipBox.GetBottom() + ll;
if( xc < x0 ) if( xc < x0 )
return; return;
if( yc < y0 ) if( yc < y0 )
@ -165,10 +165,10 @@ void DrawGraphicText( WinEDA_DrawPanel* panel, wxDC* DC,
break; break;
} }
} }
cX += ux0; cX += ux0;
cY += uy0; cY += uy0;
ox = cX - dx; ox = cX - dx;
oy = cY + dy; oy = cY + dy;
@ -180,15 +180,15 @@ void DrawGraphicText( WinEDA_DrawPanel* panel, wxDC* DC,
dx = (espacement * nbchar) / 2; dx = (espacement * nbchar) / 2;
dy = size_v / 2; /* Decalage du debut du texte / centre */ dy = size_v / 2; /* Decalage du debut du texte / centre */
ux0 = cX - dx; ux0 = cX - dx;
uy0 = cY; uy0 = cY;
dx += cX; dx += cX;
dy = cY; dy = cY;
RotatePoint( &ux0, &uy0, cX, cY, orient ); RotatePoint( &ux0, &uy0, cX, cY, orient );
RotatePoint( &dx, &dy, cX, cY, orient ); RotatePoint( &dx, &dy, cX, cY, orient );
GRLine( &panel->m_ClipBox, DC, ux0, uy0, dx, dy, width, gcolor ); GRLine( &panel->m_ClipBox, DC, ux0, uy0, dx, dy, width, gcolor );
return; return;
@ -197,21 +197,21 @@ void DrawGraphicText( WinEDA_DrawPanel* panel, wxDC* DC,
#if 0 #if 0
dx = (espacement * nbchar) / 2; dx = (espacement * nbchar) / 2;
dy = size_v / 2;/* Decalage du debut du texte / centre */ dy = size_v / 2;/* Decalage du debut du texte / centre */
ux0 = cX - dx; ux0 = cX - dx;
uy0 = cY; uy0 = cY;
dx += cX; dx += cX;
dy = cY; dy = cY;
RotatePoint( &ux0, &uy0, cX, cY, orient ); RotatePoint( &ux0, &uy0, cX, cY, orient );
RotatePoint( &dx, &dy, cX, cY, orient ); RotatePoint( &dx, &dy, cX, cY, orient );
DC->SetTextForeground( wxColour( DC->SetTextForeground( wxColour(
ColorRefs[gcolor].r, ColorRefs[gcolor].r,
ColorRefs[gcolor].g, ColorRefs[gcolor].g,
ColorRefs[gcolor].b ) ); ColorRefs[gcolor].b ) );
DC->DrawRotatedText( Text, GRMapX( ux0 ), GRMapY( uy0 ), (double) orient / 10.0 ); DC->DrawRotatedText( Text, GRMapX( ux0 ), GRMapY( uy0 ), (double) orient / 10.0 );
return; return;
#endif #endif
@ -256,24 +256,24 @@ void DrawGraphicText( WinEDA_DrawPanel* panel, wxDC* DC,
break; break;
case 'D': case 'D':
plume = f_cod; plume = f_cod;
break; break;
default: default:
{ {
k1 = f_cod; /* trace sur axe V */ k1 = f_cod; /* trace sur axe V */
k1 = -( (k1 * size_v) / 9 ); k1 = -( (k1 * size_v) / 9 );
ptcar++; ptcar++;
f_cod = *ptcar; f_cod = *ptcar;
k2 = f_cod; /* trace sur axe H */ k2 = f_cod; /* trace sur axe H */
k2 = (k2 * size_h) / 9; k2 = (k2 * size_h) / 9;
dx = k2 + ox; dy = k1 + oy; dx = k2 + ox; dy = k1 + oy;
RotatePoint( &dx, &dy, cX, cY, orient ); RotatePoint( &dx, &dy, cX, cY, orient );
coord[ii++] = dx; coord[ii++] = dx;
coord[ii++] = dy; coord[ii++] = dy;
break; break;
} }
} }
@ -326,7 +326,7 @@ void PlotGraphicText( int format_plot, const wxPoint& Pos, int gcolor,
return; return;
} }
if( (gcolor >= 0) && (format_plot == PLOT_FORMAT_POST) ) if( gcolor >= 0 && IsPostScript( format_plot ) )
SetColorMapPS( gcolor ); SetColorMapPS( gcolor );
size_h = Size.x; size_h = Size.x;
@ -336,14 +336,14 @@ void PlotGraphicText( int format_plot, const wxPoint& Pos, int gcolor,
if( size_v == 0 ) if( size_v == 0 )
size_v = DEFAULT_SIZE_TEXT; size_v = DEFAULT_SIZE_TEXT;
kk = 0; kk = 0;
ptr = 0; /* ptr = text index */ ptr = 0; /* ptr = text index */
/* calcul de la position du debut des textes: ox et oy */ /* calcul de la position du debut des textes: ox et oy */
nbchar = Text.Len(); nbchar = Text.Len();
espacement = (10 * size_h ) / 9; espacement = (10 * size_h ) / 9;
ox = cX = Pos.x; ox = cX = Pos.x;
oy = cY = Pos.y; oy = cY = Pos.y;
/* Calcul du cadrage du texte */ /* Calcul du cadrage du texte */
@ -412,11 +412,11 @@ void PlotGraphicText( int format_plot, const wxPoint& Pos, int gcolor,
break; break;
} }
} }
cX += ux0; cX += ux0;
cY += uy0; /* cX, cY = coord du centre du texte */ cY += uy0; /* cX, cY = coord du centre du texte */
ox = -dx; ox = -dx;
oy = +dy; /* ox, oy = coord debut texte, relativement au centre */ oy = +dy; /* ox, oy = coord debut texte, relativement au centre */
FctPlume( wxPoint( 0, 0 ), 'Z' ); FctPlume( wxPoint( 0, 0 ), 'Z' );
@ -446,17 +446,17 @@ void PlotGraphicText( int format_plot, const wxPoint& Pos, int gcolor,
k1 = -(k1 * size_v) / 9; k1 = -(k1 * size_v) / 9;
ptcar++; ptcar++;
f_cod = *ptcar; f_cod = *ptcar;
k2 = f_cod; /* trace sur axe H */ k2 = f_cod; /* trace sur axe H */
k2 = (k2 * size_h) / 9; k2 = (k2 * size_h) / 9;
dx = k2 + ox; dx = k2 + ox;
dy = k1 + oy; dy = k1 + oy;
RotatePoint( &dx, &dy, orient ); RotatePoint( &dx, &dy, orient );
FctPlume( wxPoint( cX + dx, cY + dy ), plume ); FctPlume( wxPoint( cX + dx, cY + dy ), plume );
x0 = k2; x0 = k2;
y0 = k1; y0 = k1;
break; break;
} }

View File

@ -1,6 +1,6 @@
/**************************************/ /**************************************/
/* Module to handle screen printing. */ /* Module to handle screen printing. */
/**************************************/ /**************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
@ -17,248 +17,259 @@ extern void Move_Plume( wxPoint pos, int plume ); // see plot.cpp
/***************************************************************************** /*****************************************************************************
Put out pin number and pin text info, given the pin line coordinates. * Put out pin number and pin text info, given the pin line coordinates.
The line must be vertical or horizontal. * The line must be vertical or horizontal.
If PinText == NULL nothing is printed. If PinNum = 0 no number is printed. * If PinText == NULL nothing is printed. If PinNum = 0 no number is printed.
Current Zoom factor is taken into account. * Current Zoom factor is taken into account.
If TextInside then the text is been put inside,otherwise all is drawn outside. * If TextInside then the text is been put inside,otherwise all is drawn outside.
Pin Name: substring beteween '~' is negated * Pin Name: substring beteween '~' is negated
*****************************************************************************/ *****************************************************************************/
void LibDrawPin::DrawPinTexts(WinEDA_DrawPanel * panel, wxDC * DC, void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
wxPoint & pin_pos, int orient, wxPoint& pin_pos, int orient,
int TextInside, bool DrawPinNum, bool DrawPinName, int TextInside, bool DrawPinNum, bool DrawPinName,
int Color, int DrawMode) int Color, int DrawMode )
/* DrawMode = GR_OR, XOR ... */ /* DrawMode = GR_OR, XOR ... */
{ {
int ii, x, y, x1, y1, dx, dy, len; int ii, x, y, x1, y1, dx, dy, len;
wxString StringPinNum; wxString StringPinNum;
wxString PinText; wxString PinText;
int PinTextBarPos[256]; int PinTextBarPos[256];
int PinTextBarCount; int PinTextBarCount;
int NameColor, NumColor; int NameColor, NumColor;
int PinTxtLen; int PinTxtLen;
wxSize PinNameSize(m_PinNameSize,m_PinNameSize);
wxSize PinNumSize(m_PinNumSize,m_PinNumSize);
int LineWidth = g_DrawMinimunLineWidth;
GRSetDrawMode(DC, DrawMode); wxSize PinNameSize( m_PinNameSize, m_PinNameSize );
wxSize PinNumSize( m_PinNumSize, m_PinNumSize );
/* Get the num and name colors */ int LineWidth = g_DrawMinimunLineWidth;
NameColor = Color == - 1 ? ReturnLayerColor(LAYER_PINNAM) : Color;
NumColor = Color == - 1 ? ReturnLayerColor(LAYER_PINNUM) : Color;
/* Create the pin num string */ GRSetDrawMode( DC, DrawMode );
ReturnPinStringNum(StringPinNum);
x1 = pin_pos.x; y1 = pin_pos.y; /* Get the num and name colors */
switch(orient) NameColor = Color == -1 ? ReturnLayerColor( LAYER_PINNAM ) : Color;
{ NumColor = Color == -1 ? ReturnLayerColor( LAYER_PINNUM ) : Color;
case PIN_UP: y1 -= m_PinLen; break;
case PIN_DOWN: y1 += m_PinLen; break;
case PIN_LEFT: x1 -= m_PinLen; break;
case PIN_RIGHT: x1 += m_PinLen; break;
}
const wxChar * textsrc = m_PinName.GetData(); /* Create the pin num string */
float fPinTextPitch = PinNameSize.x * 1.1; ReturnPinStringNum( StringPinNum );
/* Do we need to invert the string? Is this string has only "~"? */
PinTextBarCount = 0; PinTxtLen = 0;
ii = 0;
while ( * textsrc )
{
if ( * textsrc == '~' )
{
PinTextBarPos[PinTextBarCount++] = (int)(PinTxtLen * fPinTextPitch);
}
else
{
PinText.Append(* textsrc);
PinTxtLen ++;
}
textsrc++;
}
PinTxtLen = (int) (fPinTextPitch * PinTxtLen);
PinTextBarPos[PinTextBarCount] = PinTxtLen; // Needed if no end '~'
if (PinText[0] == 0) DrawPinName = FALSE;
if( TextInside ) /* Draw the text inside, but the pin numbers outside. */ x1 = pin_pos.x; y1 = pin_pos.y;
{
if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
// It is an horizontal line
{
if (PinText && DrawPinName)
{
if( orient == PIN_RIGHT)
{
x = x1 + TextInside;
DrawGraphicText(panel, DC, wxPoint(x, y1), NameColor, PinText,
TEXT_ORIENT_HORIZ,
PinNameSize,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, LineWidth);
for ( ii = 0; ii < PinTextBarCount; ) switch( orient )
{ {
GRMoveTo(x, y1 - TXTMARGE); case PIN_UP:
dy = -PinNameSize.y / 2; y1 -= m_PinLen; break;
GRMoveRel(0, dy);
dx = PinTextBarPos[ii++]; // Get the line pos
GRMoveRel(dx, 0);
len = PinTextBarPos[ii++] - dx; // Get the line length
GRLineRel(&panel->m_ClipBox, DC, len, 0, LineWidth, NameColor);
}
}
else // Orient == PIN_LEFT
{
x = x1 - TextInside;
DrawGraphicText(panel, DC, wxPoint(x, y1) , NameColor, PinText,
TEXT_ORIENT_HORIZ,
PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, LineWidth);
for ( ii = 0; ii < PinTextBarCount; ) case PIN_DOWN:
{ y1 += m_PinLen; break;
GRMoveTo(x, y1 - TXTMARGE);
dy = -PinNameSize.y / 2;
GRMoveRel(0, dy);
dx = PinTextBarPos[ii++]; // Get the line pos
GRMoveRel(dx - PinTxtLen, 0);
len = PinTextBarPos[ii++] - dx; // Get the line length
GRLineRel(&panel->m_ClipBox, DC, len, 0, LineWidth, NameColor);
}
}
}
if ( DrawPinNum) case PIN_LEFT:
{ x1 -= m_PinLen; break;
DrawGraphicText(panel, DC,
wxPoint((x1 + pin_pos.x) / 2, y1 - TXTMARGE), NumColor, StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth);
}
}
else /* Its a vertical line. */ case PIN_RIGHT:
{ // Text is drawn from bottom to top (i.e. to negative value for Y axis) x1 += m_PinLen; break;
if (PinText && DrawPinName) }
{
if ( orient == PIN_DOWN )
{
y = y1 + TextInside;
DrawGraphicText(panel, DC, wxPoint(x1, y), NameColor, PinText, const wxChar* textsrc = m_PinName.GetData();
TEXT_ORIENT_VERT, PinNameSize, float fPinTextPitch = PinNameSize.x * 1.1;
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, LineWidth); /* Do we need to invert the string? Is this string has only "~"? */
PinTextBarCount = 0; PinTxtLen = 0;
ii = 0;
while( *textsrc )
{
if( *textsrc == '~' )
{
PinTextBarPos[PinTextBarCount++] = (int) (PinTxtLen * fPinTextPitch);
}
else
{
PinText.Append( *textsrc );
PinTxtLen++;
}
for ( ii = 0; ii < PinTextBarCount; ) textsrc++;
{ }
GRMoveTo(x1 - TXTMARGE, y);
dy = -PinNameSize.y / 2;
GRMoveRel(dy , 0);
dx = PinTextBarPos[ii++]; // Get the line pos
GRMoveRel(0, PinTxtLen - dx);
len = PinTextBarPos[ii++] - dx; // Get the line length
GRLineRel(&panel->m_ClipBox, DC, 0, -len, LineWidth, NameColor);
}
}
else /* PIN_UP */ PinTxtLen = (int) (fPinTextPitch * PinTxtLen);
{ PinTextBarPos[PinTextBarCount] = PinTxtLen; // Needed if no end '~'
y = y1 - TextInside;
DrawGraphicText(panel, DC, wxPoint(x1, y), NameColor, PinText, if( PinText[0] == 0 )
TEXT_ORIENT_VERT, PinNameSize, DrawPinName = FALSE;
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth);
for ( ii = 0; ii < PinTextBarCount; ) if( TextInside ) /* Draw the text inside, but the pin numbers outside. */
{ {
GRMoveTo(x1 - TXTMARGE, y); if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
dy = -PinNameSize.y / 2;
GRMoveRel(dy, 0);
dx = PinTextBarPos[ii++]; // Get the line pos
GRMoveRel(0, - dx);
len = PinTextBarPos[ii++] - dx; // Get the line length
GRLineRel(&panel->m_ClipBox, DC, 0, -len, LineWidth, NameColor);
}
}
}
if(DrawPinNum) // It is an horizontal line
{ {
DrawGraphicText(panel, DC, if( PinText && DrawPinName )
wxPoint(x1 - TXTMARGE, (y1 + pin_pos.y) / 2) , NumColor, StringPinNum, {
TEXT_ORIENT_VERT, PinNumSize, if( orient == PIN_RIGHT )
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, LineWidth); {
} x = x1 + TextInside;
} DrawGraphicText( panel, DC, wxPoint( x, y1 ), NameColor, PinText,
} TEXT_ORIENT_HORIZ,
PinNameSize,
else /**** Draw num & text pin outside ****/ GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, LineWidth );
{
if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
/* Its an horizontal line. */
{
if (PinText && DrawPinName)
{
x = (x1 + pin_pos.x) / 2;
DrawGraphicText(panel, DC, wxPoint(x , y1 - TXTMARGE),
NameColor, PinText,
TEXT_ORIENT_HORIZ, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth);
for ( ii = 0; ii < PinTextBarCount; ) for( ii = 0; ii < PinTextBarCount; )
{ {
GRMoveTo(x, y1 - TXTMARGE*2); GRMoveTo( x, y1 - TXTMARGE );
GRMoveRel(-PinTxtLen / 2, -PinNameSize.y ); dy = -PinNameSize.y / 2;
dx = PinTextBarPos[ii++]; // Get the line pos GRMoveRel( 0, dy );
GRMoveRel(dx, 0); dx = PinTextBarPos[ii++]; // Get the line pos
len = PinTextBarPos[ii++] - dx; // Get the line length GRMoveRel( dx, 0 );
GRLineRel(&panel->m_ClipBox, DC, len, 0, LineWidth, NameColor); len = PinTextBarPos[ii++] - dx; // Get the line length
} GRLineRel( &panel->m_ClipBox, DC, len, 0, LineWidth, NameColor );
} }
if(DrawPinNum) }
{ else // Orient == PIN_LEFT
x = (x1 + pin_pos.x) / 2; {
DrawGraphicText(panel, DC, wxPoint(x, y1 + TXTMARGE), x = x1 - TextInside;
NumColor, StringPinNum, DrawGraphicText( panel, DC, wxPoint( x, y1 ), NameColor, PinText,
TEXT_ORIENT_HORIZ, PinNumSize, TEXT_ORIENT_HORIZ,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, LineWidth); PinNameSize,
} GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, LineWidth );
}
else /* Its a vertical line. */
{
if (PinText && DrawPinName)
{
y = (y1 + pin_pos.y) / 2;
DrawGraphicText(panel, DC, wxPoint(x1 - TXTMARGE , y ),
NameColor, PinText,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, LineWidth);
for ( ii = 0; ii < PinTextBarCount; ) for( ii = 0; ii < PinTextBarCount; )
{ {
GRMoveTo(x1 - (TXTMARGE * 2), y); GRMoveTo( x, y1 - TXTMARGE );
GRMoveRel(-PinNameSize.y, -PinTxtLen / 2); dy = -PinNameSize.y / 2;
dx = PinTextBarPos[ii++]; // Get the line pos GRMoveRel( 0, dy );
GRMoveRel(0, PinTxtLen - dx); dx = PinTextBarPos[ii++]; // Get the line pos
len = PinTextBarPos[ii++] - dx; // Get the line length GRMoveRel( dx - PinTxtLen, 0 );
GRLineRel(&panel->m_ClipBox, DC, 0, - len, LineWidth, NameColor); len = PinTextBarPos[ii++] - dx; // Get the line length
} GRLineRel( &panel->m_ClipBox, DC, len, 0, LineWidth, NameColor );
} }
}
}
if(DrawPinNum) if( DrawPinNum )
{ {
DrawGraphicText(panel, DC, wxPoint(x1 + TXTMARGE , (y1 + pin_pos.y) / 2), DrawGraphicText( panel, DC,
NumColor, StringPinNum, wxPoint( (x1 + pin_pos.x) / 2, y1 - TXTMARGE ), NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize, TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, LineWidth); GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth );
} }
} }
} else /* Its a vertical line. */
{
// Text is drawn from bottom to top (i.e. to negative value for Y axis)
if( PinText && DrawPinName )
{
if( orient == PIN_DOWN )
{
y = y1 + TextInside;
DrawGraphicText( panel, DC, wxPoint( x1, y ), NameColor, PinText,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, LineWidth );
for( ii = 0; ii < PinTextBarCount; )
{
GRMoveTo( x1 - TXTMARGE, y );
dy = -PinNameSize.y / 2;
GRMoveRel( dy, 0 );
dx = PinTextBarPos[ii++]; // Get the line pos
GRMoveRel( 0, PinTxtLen - dx );
len = PinTextBarPos[ii++] - dx; // Get the line length
GRLineRel( &panel->m_ClipBox, DC, 0, -len, LineWidth, NameColor );
}
}
else /* PIN_UP */
{
y = y1 - TextInside;
DrawGraphicText( panel, DC, wxPoint( x1, y ), NameColor, PinText,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth );
for( ii = 0; ii < PinTextBarCount; )
{
GRMoveTo( x1 - TXTMARGE, y );
dy = -PinNameSize.y / 2;
GRMoveRel( dy, 0 );
dx = PinTextBarPos[ii++]; // Get the line pos
GRMoveRel( 0, -dx );
len = PinTextBarPos[ii++] - dx; // Get the line length
GRLineRel( &panel->m_ClipBox, DC, 0, -len, LineWidth, NameColor );
}
}
}
if( DrawPinNum )
{
DrawGraphicText( panel, DC,
wxPoint( x1 - TXTMARGE, (y1 + pin_pos.y) / 2 ), NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, LineWidth );
}
}
}
else /**** Draw num & text pin outside ****/
{
if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
/* Its an horizontal line. */
{
if( PinText && DrawPinName )
{
x = (x1 + pin_pos.x) / 2;
DrawGraphicText( panel, DC, wxPoint( x, y1 - TXTMARGE ),
NameColor, PinText,
TEXT_ORIENT_HORIZ, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth );
for( ii = 0; ii < PinTextBarCount; )
{
GRMoveTo( x, y1 - TXTMARGE * 2 );
GRMoveRel( -PinTxtLen / 2, -PinNameSize.y );
dx = PinTextBarPos[ii++]; // Get the line pos
GRMoveRel( dx, 0 );
len = PinTextBarPos[ii++] - dx; // Get the line length
GRLineRel( &panel->m_ClipBox, DC, len, 0, LineWidth, NameColor );
}
}
if( DrawPinNum )
{
x = (x1 + pin_pos.x) / 2;
DrawGraphicText( panel, DC, wxPoint( x, y1 + TXTMARGE ),
NumColor, StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, LineWidth );
}
}
else /* Its a vertical line. */
{
if( PinText && DrawPinName )
{
y = (y1 + pin_pos.y) / 2;
DrawGraphicText( panel, DC, wxPoint( x1 - TXTMARGE, y ),
NameColor, PinText,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, LineWidth );
for( ii = 0; ii < PinTextBarCount; )
{
GRMoveTo( x1 - (TXTMARGE * 2), y );
GRMoveRel( -PinNameSize.y, -PinTxtLen / 2 );
dx = PinTextBarPos[ii++]; // Get the line pos
GRMoveRel( 0, PinTxtLen - dx );
len = PinTextBarPos[ii++] - dx; // Get the line length
GRLineRel( &panel->m_ClipBox, DC, 0, -len, LineWidth, NameColor );
}
}
if( DrawPinNum )
{
DrawGraphicText( panel, DC, wxPoint( x1 + TXTMARGE, (y1 + pin_pos.y) / 2 ),
NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, LineWidth );
}
}
}
} }
/***************************************************************************** /*****************************************************************************
* Plot pin number and pin text info, given the pin line coordinates. * * Plot pin number and pin text info, given the pin line coordinates. *
* Same as DrawPinTexts((), but output is the plotter * Same as DrawPinTexts((), but output is the plotter
@ -268,224 +279,229 @@ int LineWidth = g_DrawMinimunLineWidth;
* If TextInside then the text is been put inside (moving from x1, y1 in * * If TextInside then the text is been put inside (moving from x1, y1 in *
* the opposite direction to x2,y2), otherwise all is drawn outside. * * the opposite direction to x2,y2), otherwise all is drawn outside. *
*****************************************************************************/ *****************************************************************************/
void LibDrawPin::PlotPinTexts(wxPoint & pin_pos, int orient, void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
int TextInside, bool DrawPinNum, bool DrawPinName) int TextInside, bool DrawPinNum, bool DrawPinName )
{ {
int dx, len, start; int dx, len, start;
int ii , x, y, x1, y1, cte; int ii, x, y, x1, y1, cte;
wxString StringPinNum; wxString StringPinNum;
wxString PinText; wxString PinText;
int PinTextBarPos[256]; int PinTextBarPos[256];
int PinTextBarCount; int PinTextBarCount;
int NameColor, NumColor; int NameColor, NumColor;
int PinTxtLen = 0; int PinTxtLen = 0;
wxSize PinNameSize = wxSize(m_PinNameSize,m_PinNameSize); wxSize PinNameSize = wxSize( m_PinNameSize, m_PinNameSize );
wxSize PinNumSize = wxSize(m_PinNumSize,m_PinNumSize); wxSize PinNumSize = wxSize( m_PinNumSize, m_PinNumSize );
bool plot_color = (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt; bool plot_color = (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt;
/* Get the num and name colors */
NameColor = plot_color ? ReturnLayerColor(LAYER_PINNAM) : -1;
NumColor = plot_color ? ReturnLayerColor(LAYER_PINNUM) : -1;
/* Create the pin num string */ /* Get the num and name colors */
ReturnPinStringNum(StringPinNum); NameColor = plot_color ? ReturnLayerColor( LAYER_PINNAM ) : -1;
x1 = pin_pos.x; y1 = pin_pos.y; NumColor = plot_color ? ReturnLayerColor( LAYER_PINNUM ) : -1;
switch(orient)
{
case PIN_UP: y1 -= m_PinLen; break;
case PIN_DOWN: y1 += m_PinLen; break;
case PIN_LEFT: x1 -= m_PinLen; break;
case PIN_RIGHT: x1 += m_PinLen; break;
}
const wxChar * textsrc = m_PinName.GetData(); /* Create the pin num string */
float fPinTextPitch = PinNameSize.x * 1.1; ReturnPinStringNum( StringPinNum );
/* Do we need to invert the string? Is this string has only "~"? */ x1 = pin_pos.x; y1 = pin_pos.y;
PinTextBarCount = 0; PinTxtLen = 0;
ii = 0;
while ( * textsrc )
{
if ( * textsrc == '~' )
{
PinTextBarPos[PinTextBarCount++] = (int) (fPinTextPitch * PinTxtLen);
}
else
{
PinText.Append(* textsrc);
PinTxtLen ++;
}
textsrc++;
}
PinTxtLen = (int) (fPinTextPitch * PinTxtLen);
PinTextBarPos[PinTextBarCount] = PinTxtLen; // Needed if no end '~'
if (PinText[0] == 0) DrawPinName = FALSE;
if (TextInside) /* Draw the text inside, but the pin numbers outside. */ switch( orient )
{ {
if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) ) case PIN_UP:
{ /* Its an horizontal line. */ y1 -= m_PinLen; break;
if (PinText && DrawPinName)
{
if( orient == PIN_RIGHT)
{
x = x1 + TextInside;
PlotGraphicText(g_PlotFormat, wxPoint(x, y1), NameColor, PinText,
TEXT_ORIENT_HORIZ,
PinNameSize,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER);
for ( ii = 0; ii < PinTextBarCount; ) case PIN_DOWN:
{ y1 += m_PinLen; break;
cte = y1 - PinNameSize.y/2 - TXTMARGE;
dx = PinTextBarPos[ii++]; // Get the line pos
Move_Plume( wxPoint(x+dx, cte), 'U');
len = PinTextBarPos[ii++]; // Get the line end
Move_Plume( wxPoint(x + len, cte), 'D');
}
}
else // orient == PIN_LEFT
{
x = x1 - TextInside;
PlotGraphicText(g_PlotFormat, wxPoint(x, y1),
NameColor, PinText, TEXT_ORIENT_HORIZ,
PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER);
for ( ii = 0; ii < PinTextBarCount; ) case PIN_LEFT:
{ x1 -= m_PinLen; break;
cte = y1 - PinNameSize.y/2 - TXTMARGE;
dx = PinTextBarPos[ii++]; // Get the line pos
Move_Plume( wxPoint(x+dx - PinTxtLen, cte), 'U');
len = PinTextBarPos[ii++]; // Get the line end
Move_Plume(wxPoint(x + len - PinTxtLen, cte), 'D');
}
}
}
if (DrawPinNum) case PIN_RIGHT:
{ x1 += m_PinLen; break;
PlotGraphicText( g_PlotFormat, wxPoint((x1 + pin_pos.x) / 2, y1 - TXTMARGE), }
NumColor, StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM);
}
}
else /* Its a vertical line. */ const wxChar* textsrc = m_PinName.GetData();
{ float fPinTextPitch = PinNameSize.x * 1.1;
if (PinText && DrawPinName) /* Do we need to invert the string? Is this string has only "~"? */
{ PinTextBarCount = 0; PinTxtLen = 0;
if ( orient == PIN_DOWN ) ii = 0;
{ while( *textsrc )
y = y1 + TextInside; {
if( *textsrc == '~' )
{
PinTextBarPos[PinTextBarCount++] = (int) (fPinTextPitch * PinTxtLen);
}
else
{
PinText.Append( *textsrc );
PinTxtLen++;
}
PlotGraphicText( g_PlotFormat, wxPoint(x1, y), NameColor, PinText, textsrc++;
TEXT_ORIENT_VERT, PinNameSize, }
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP);
for ( ii = 0; ii < PinTextBarCount; ) PinTxtLen = (int) (fPinTextPitch * PinTxtLen);
{ PinTextBarPos[PinTextBarCount] = PinTxtLen; // Needed if no end '~'
cte = x1 - PinNameSize.y/2 - TXTMARGE;
dx = PinTextBarPos[ii++]; // Get the line pos
Move_Plume( wxPoint(cte, y + PinTxtLen - dx), 'U');
len = PinTextBarPos[ii++]; // Get the line end
Move_Plume( wxPoint(cte , y + PinTxtLen - len), 'D');
}
}
else /* PIN_UP */ if( PinText[0] == 0 )
{ DrawPinName = FALSE;
y = y1 - TextInside;
PlotGraphicText( g_PlotFormat, wxPoint(x1, y), NameColor, PinText, if( TextInside ) /* Draw the text inside, but the pin numbers outside. */
TEXT_ORIENT_VERT, PinNameSize, {
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM); if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
{ /* Its an horizontal line. */
if( PinText && DrawPinName )
{
if( orient == PIN_RIGHT )
{
x = x1 + TextInside;
PlotGraphicText( g_PlotFormat, wxPoint( x, y1 ), NameColor, PinText,
TEXT_ORIENT_HORIZ,
PinNameSize,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER );
for ( ii = 0; ii < PinTextBarCount; ) for( ii = 0; ii < PinTextBarCount; )
{ {
cte = x1 - PinNameSize.y/2 - TXTMARGE; cte = y1 - PinNameSize.y / 2 - TXTMARGE;
dx = PinTextBarPos[ii++]; // Get the line pos dx = PinTextBarPos[ii++]; // Get the line pos
Move_Plume( wxPoint(cte, y -dx), 'U'); Move_Plume( wxPoint( x + dx, cte ), 'U' );
len = PinTextBarPos[ii++]; // Get the line end len = PinTextBarPos[ii++]; // Get the line end
Move_Plume(wxPoint(cte, y - len), 'D'); Move_Plume( wxPoint( x + len, cte ), 'D' );
} }
} }
} else // orient == PIN_LEFT
{
x = x1 - TextInside;
PlotGraphicText( g_PlotFormat, wxPoint( x, y1 ),
NameColor, PinText, TEXT_ORIENT_HORIZ,
PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER );
if (DrawPinNum) for( ii = 0; ii < PinTextBarCount; )
{ {
PlotGraphicText( g_PlotFormat, wxPoint(x1 - TXTMARGE, (y1 + pin_pos.y) / 2), cte = y1 - PinNameSize.y / 2 - TXTMARGE;
NumColor, StringPinNum, dx = PinTextBarPos[ii++]; // Get the line pos
TEXT_ORIENT_VERT, PinNumSize, Move_Plume( wxPoint( x + dx - PinTxtLen, cte ), 'U' );
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER); len = PinTextBarPos[ii++]; // Get the line end
} Move_Plume( wxPoint( x + len - PinTxtLen, cte ), 'D' );
} }
} }
}
else /* Draw num & text pin outside */
{
if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
/* Its an horizontal line. */
{
if (PinText && DrawPinName)
{
x = (x1 + pin_pos.x) / 2;
PlotGraphicText( g_PlotFormat, wxPoint(x, y1 - TXTMARGE),
NameColor, PinText,
TEXT_ORIENT_HORIZ, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM);
for ( ii = 0; ii < PinTextBarCount; ) if( DrawPinNum )
{ {
cte = y1 - PinNameSize.y - TXTMARGE*2; PlotGraphicText( g_PlotFormat, wxPoint( (x1 + pin_pos.x) / 2, y1 - TXTMARGE ),
start = x - (PinTxtLen / 2); NumColor, StringPinNum,
dx = PinTextBarPos[ii++]; // Get the line pos TEXT_ORIENT_HORIZ, PinNumSize,
Move_Plume( wxPoint(start + dx, cte), 'U'); GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM );
len = PinTextBarPos[ii++]; // Get the line end }
Move_Plume(wxPoint(start + len, cte), 'D'); }
} else /* Its a vertical line. */
} {
if (DrawPinNum) if( PinText && DrawPinName )
{ {
x = (x1 + pin_pos.x) / 2; if( orient == PIN_DOWN )
PlotGraphicText(g_PlotFormat, wxPoint(x, y1 + TXTMARGE), {
NumColor, StringPinNum, y = y1 + TextInside;
TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP);
}
}
else /* Its a vertical line. */
{
if (PinText && DrawPinName)
{
y = (y1 + pin_pos.y) / 2;
PlotGraphicText( g_PlotFormat, wxPoint(x1 - TXTMARGE,y),
NameColor, PinText,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER);
for ( ii = 0; ii < PinTextBarCount; ) PlotGraphicText( g_PlotFormat, wxPoint( x1, y ), NameColor, PinText,
{ TEXT_ORIENT_VERT, PinNameSize,
cte = x1 - PinNameSize.y - TXTMARGE*2; GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP );
start = y + (PinTxtLen / 2);
dx = PinTextBarPos[ii++]; // Get the line pos
Move_Plume( wxPoint(cte, start - dx), 'U');
len = PinTextBarPos[ii++]; // Get the line end
Move_Plume( wxPoint(cte, start - len), 'D');
}
}
if (DrawPinNum) for( ii = 0; ii < PinTextBarCount; )
{ {
PlotGraphicText( g_PlotFormat, wxPoint(x1 + TXTMARGE, (y1 + pin_pos.y) / 2), cte = x1 - PinNameSize.y / 2 - TXTMARGE;
NumColor, StringPinNum, dx = PinTextBarPos[ii++]; // Get the line pos
TEXT_ORIENT_VERT, PinNumSize, Move_Plume( wxPoint( cte, y + PinTxtLen - dx ), 'U' );
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER); len = PinTextBarPos[ii++]; // Get the line end
} Move_Plume( wxPoint( cte, y + PinTxtLen - len ), 'D' );
} }
} }
else /* PIN_UP */
{
y = y1 - TextInside;
PlotGraphicText( g_PlotFormat, wxPoint( x1, y ), NameColor, PinText,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM );
for( ii = 0; ii < PinTextBarCount; )
{
cte = x1 - PinNameSize.y / 2 - TXTMARGE;
dx = PinTextBarPos[ii++]; // Get the line pos
Move_Plume( wxPoint( cte, y - dx ), 'U' );
len = PinTextBarPos[ii++]; // Get the line end
Move_Plume( wxPoint( cte, y - len ), 'D' );
}
}
}
if( DrawPinNum )
{
PlotGraphicText( g_PlotFormat, wxPoint( x1 - TXTMARGE, (y1 + pin_pos.y) / 2 ),
NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER );
}
}
}
else /* Draw num & text pin outside */
{
if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
/* Its an horizontal line. */
{
if( PinText && DrawPinName )
{
x = (x1 + pin_pos.x) / 2;
PlotGraphicText( g_PlotFormat, wxPoint( x, y1 - TXTMARGE ),
NameColor, PinText,
TEXT_ORIENT_HORIZ, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM );
for( ii = 0; ii < PinTextBarCount; )
{
cte = y1 - PinNameSize.y - TXTMARGE * 2;
start = x - (PinTxtLen / 2);
dx = PinTextBarPos[ii++]; // Get the line pos
Move_Plume( wxPoint( start + dx, cte ), 'U' );
len = PinTextBarPos[ii++]; // Get the line end
Move_Plume( wxPoint( start + len, cte ), 'D' );
}
}
if( DrawPinNum )
{
x = (x1 + pin_pos.x) / 2;
PlotGraphicText( g_PlotFormat, wxPoint( x, y1 + TXTMARGE ),
NumColor, StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP );
}
}
else /* Its a vertical line. */
{
if( PinText && DrawPinName )
{
y = (y1 + pin_pos.y) / 2;
PlotGraphicText( g_PlotFormat, wxPoint( x1 - TXTMARGE, y ),
NameColor, PinText,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER );
for( ii = 0; ii < PinTextBarCount; )
{
cte = x1 - PinNameSize.y - TXTMARGE * 2;
start = y + (PinTxtLen / 2);
dx = PinTextBarPos[ii++]; // Get the line pos
Move_Plume( wxPoint( cte, start - dx ), 'U' );
len = PinTextBarPos[ii++]; // Get the line end
Move_Plume( wxPoint( cte, start - len ), 'D' );
}
}
if( DrawPinNum )
{
PlotGraphicText( g_PlotFormat, wxPoint( x1 + TXTMARGE, (y1 + pin_pos.y) / 2 ),
NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER );
}
}
}
} }

View File

@ -54,7 +54,6 @@ void Move_Plume( wxPoint pos, int plume )
break; break;
case PLOT_FORMAT_POST: case PLOT_FORMAT_POST:
case PLOT_FORMAT_POST_A4:
LineTo_PS( pos, plume ); LineTo_PS( pos, plume );
break; break;
} }
@ -69,7 +68,6 @@ void SetCurrentLineWidth( int width )
break; break;
case PLOT_FORMAT_POST: case PLOT_FORMAT_POST:
case PLOT_FORMAT_POST_A4:
SetCurrentLineWidthPS( width ); SetCurrentLineWidthPS( width );
break; break;
} }

View File

@ -1,6 +1,6 @@
/********************/ /********************/
/* plot_common.h */ /* plot_common.h */
/********************/ /********************/
#ifndef PLOT_COMMON_H #ifndef PLOT_COMMON_H
#define PLOT_COMMON_H #define PLOT_COMMON_H
@ -12,12 +12,22 @@
#endif #endif
typedef enum { /**
PLOT_FORMAT_HPGL, * Enum PlotFormat
PLOT_FORMAT_POST, * must be kept in order of the radio buttons in the plot panel/window.
PLOT_FORMAT_GERBER, */
PLOT_FORMAT_POST_A4 enum PlotFormat {
} PlotFormat; PLOT_FORMAT_HPGL,
PLOT_FORMAT_GERBER,
PLOT_FORMAT_POST,
};
static inline bool IsPostScript( int aFormat )
{
return aFormat==PLOT_FORMAT_POST;
}
const int PLOT_MIROIR = 1; const int PLOT_MIROIR = 1;
@ -25,47 +35,59 @@ const int PLOT_MIROIR = 1;
/*******************************/ /*******************************/
/* common_plot_functions.cpp */ /* common_plot_functions.cpp */
/*******************************/ /*******************************/
void SetPlotScale(double xscale, double yscale); // Set the plot scale for the current plotting) void SetPlotScale( double xscale, double yscale ); // Set the plot scale for the current plotting)
void SetPlotOffset(wxPoint offset); // Set the plot offset for the current plotting) void SetPlotOffset( wxPoint offset ); // Set the plot offset for the current plotting)
void InitPlotParametresGERBER(wxPoint offset, double xscale, double yscale); void InitPlotParametresGERBER( wxPoint offset, double xscale, double yscale );
void PlotWorkSheet(int format_plot, BASE_SCREEN * screen); void PlotWorkSheet( int format_plot, BASE_SCREEN* screen );
void UserToDeviceCoordinate(wxPoint & pos ); void UserToDeviceCoordinate( wxPoint& pos );
// modifie les coord pos.x et pos.y pour le trace selon l'orientation, l'echelle, les offsets de trace
void UserToDeviceSize(wxSize & size ); // modifie les coord pos.x et pos.y pour le trace selon l'orientation, l'echelle, les offsets de trace
// modifie les dimension size.x et size.y pour le trace selon l'echelle void UserToDeviceSize( wxSize& size );
void ForcePenReinit();
// set the flag g_CurrentPenWidth to -1 in order // modifie les dimension size.x et size.y pour le trace selon l'echelle
// to force a pen width redefinition for the next draw command void ForcePenReinit();
// set the flag g_CurrentPenWidth to -1 in order
// to force a pen width redefinition for the next draw command
/*******************************/ /*******************************/
/* common_plotPS_functions.cpp */ /* common_plotPS_functions.cpp */
/*******************************/ /*******************************/
void SetCurrentLineWidthPS( int width); void SetCurrentLineWidthPS( int width );
void InitPlotParametresPS( wxPoint offset, Ki_PageDescr * sheet, double xscale, double yscale, int orient = 0); void InitPlotParametresPS( wxPoint offset,
void SetDefaultLineWidthPS( int width); Ki_PageDescr* sheet,
void PlotCircle_PS(wxPoint pos, int diametre, int width = -1); double xscale,
void PlotArcPS(wxPoint centre, int StAngle, int EndAngle, int rayon, int width = -1); double yscale,
// Plot an arc: StAngle, EndAngle = start and end arc in 0.1 degree int orient = 0 );
void PlotPolyPS( int nb_segm, int * coord, int fill, int width = -1); void SetDefaultLineWidthPS( int width );
void PlotFilledSegmentPS(wxPoint start , wxPoint end, int width); void PlotCircle_PS( wxPoint pos, int diametre, int width = -1 );
void LineTo_PS(wxPoint pos, int plume); void PlotArcPS( wxPoint centre, int StAngle, int EndAngle, int rayon, int width = -1 );
void PrintHeaderPS(FILE * file, const wxString & Creator, const wxString & FileName, int PageCount, int BBox[4], int PaperOrientation);
bool CloseFilePS(FILE * plot_file); // Plot an arc: StAngle, EndAngle = start and end arc in 0.1 degree
void SetColorMapPS(int color); void PlotPolyPS( int nb_segm, int* coord, int fill, int width = -1 );
void PlotFilledSegmentPS( wxPoint start, wxPoint end, int width );
void LineTo_PS( wxPoint pos, int plume );
void PrintHeaderPS( FILE* file,
const wxString& Creator,
const wxString& FileName,
int PageCount,
int BBox[4],
int PaperOrientation );
bool CloseFilePS( FILE* plot_file );
void SetColorMapPS( int color );
/*********************************/ /*********************************/
/* common_plotHPGL_functions.cpp */ /* common_plotHPGL_functions.cpp */
/*********************************/ /*********************************/
void InitPlotParametresHPGL(wxPoint offset, double xscale, double yscale, int orient = 0); void InitPlotParametresHPGL( wxPoint offset, double xscale, double yscale, int orient = 0 );
bool PrintHeaderHPGL(FILE * plot_file, int pen_speed, int pen_num); bool PrintHeaderHPGL( FILE* plot_file, int pen_speed, int pen_num );
bool CloseFileHPGL(FILE * plot_file); bool CloseFileHPGL( FILE* plot_file );
void PlotCircle_HPGL(wxPoint centre, int diameter, int width = -1); void PlotCircle_HPGL( wxPoint centre, int diameter, int width = -1 );
void PlotArcHPGL(wxPoint centre, int StAngle, int EndAngle, int rayon, int width = -1); void PlotArcHPGL( wxPoint centre, int StAngle, int EndAngle, int rayon, int width = -1 );
void PlotPolyHPGL( int nb, int * coord, int fill, int width = -1); void PlotPolyHPGL( int nb, int* coord, int fill, int width = -1 );
void Move_Plume_HPGL( wxPoint pos, int plume ); void Move_Plume_HPGL( wxPoint pos, int plume );
void Plume_HPGL( int plume ); void Plume_HPGL( int plume );
#endif // PLOT_COMMON_H
#endif // PLOT_COMMON_H

View File

@ -258,7 +258,7 @@ public:
void Genere_GERBER( const wxString& FullFileName, int Layer, void Genere_GERBER( const wxString& FullFileName, int Layer,
bool PlotOriginIsAuxAxis ); bool PlotOriginIsAuxAxis );
void Genere_HPGL( const wxString& FullFileName, int Layer ); void Genere_HPGL( const wxString& FullFileName, int Layer );
void Genere_PS( const wxString& FullFileName, int Layer ); void Genere_PS( const wxString& FullFileName, int Layer, bool useA4 );
void Plot_Layer_HPGL( FILE* File, int masque_layer, void Plot_Layer_HPGL( FILE* File, int masque_layer,
int garde, int tracevia, int modetrace ); int garde, int tracevia, int modetrace );
void Plot_Layer_GERBER( FILE* File, int masque_layer, void Plot_Layer_GERBER( FILE* File, int masque_layer,
@ -413,13 +413,13 @@ public:
*/ */
void ImportSpecctraDesign( wxCommandEvent& event ); void ImportSpecctraDesign( wxCommandEvent& event );
/** /**
* Function Access_to_External_Tool * Function Access_to_External_Tool
* Run an external tool (like freeroute ) * Run an external tool (like freeroute )
*/ */
void Access_to_External_Tool( wxCommandEvent& event ); void Access_to_External_Tool( wxCommandEvent& event );
/* Fonctions specifiques */ /* Fonctions specifiques */
MODULE* ListAndSelectModuleName(); MODULE* ListAndSelectModuleName();
void Liste_Equipot( wxCommandEvent& event ); void Liste_Equipot( wxCommandEvent& event );
void Swap_Layers( wxCommandEvent& event ); void Swap_Layers( wxCommandEvent& event );

View File

@ -158,7 +158,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName, w
TextWidth = 50; // Set Drill Symbols width in 1/10000 mils TextWidth = 50; // Set Drill Symbols width in 1/10000 mils
if( format == PLOT_FORMAT_POST ) if( IsPostScript( format ) )
{ {
sprintf( line, "%d setlinewidth\n", TextWidth ); sprintf( line, "%d setlinewidth\n", TextWidth );
fputs( line, aFile ); fputs( line, aFile );
@ -429,7 +429,7 @@ void PlotDrillSymbol( const wxPoint& position, int diametre, int aShapeId, int f
x0 = position.x; y0 = position.y; x0 = position.x; y0 = position.y;
FctPlume = Move_Plume_HPGL; FctPlume = Move_Plume_HPGL;
if( format == PLOT_FORMAT_POST ) if( IsPostScript( format ) )
FctPlume = LineTo_PS; FctPlume = LineTo_PS;
switch( aShapeId ) switch( aShapeId )
@ -444,7 +444,7 @@ void PlotDrillSymbol( const wxPoint& position, int diametre, int aShapeId, int f
case 1: /* Cercle */ case 1: /* Cercle */
if( format == PLOT_FORMAT_HPGL ) if( format == PLOT_FORMAT_HPGL )
trace_1_pastille_RONDE_HPGL( wxPoint( x0, y0 ), diametre, FILAIRE ); trace_1_pastille_RONDE_HPGL( wxPoint( x0, y0 ), diametre, FILAIRE );
if( format == PLOT_FORMAT_POST ) if( IsPostScript( format ) )
trace_1_pastille_RONDE_POST( wxPoint( x0, y0 ), diametre, FILAIRE ); trace_1_pastille_RONDE_POST( wxPoint( x0, y0 ), diametre, FILAIRE );
break; break;
@ -462,7 +462,7 @@ void PlotDrillSymbol( const wxPoint& position, int diametre, int aShapeId, int f
FctPlume( wxPoint( x0 - rayon, y0 + rayon ), 'D' ); FctPlume( wxPoint( x0 - rayon, y0 + rayon ), 'D' );
if( format == PLOT_FORMAT_HPGL ) if( format == PLOT_FORMAT_HPGL )
trace_1_pastille_RONDE_HPGL( wxPoint( x0, y0 ), diametre, FILAIRE ); trace_1_pastille_RONDE_HPGL( wxPoint( x0, y0 ), diametre, FILAIRE );
if( format == PLOT_FORMAT_POST ) if( IsPostScript( format ) )
trace_1_pastille_RONDE_POST( wxPoint( x0, y0 ), diametre, FILAIRE ); trace_1_pastille_RONDE_POST( wxPoint( x0, y0 ), diametre, FILAIRE );
break; break;
@ -471,7 +471,7 @@ void PlotDrillSymbol( const wxPoint& position, int diametre, int aShapeId, int f
FctPlume( wxPoint( x0 + rayon, y0 ), 'D' ); FctPlume( wxPoint( x0 + rayon, y0 ), 'D' );
if( format == PLOT_FORMAT_HPGL ) if( format == PLOT_FORMAT_HPGL )
trace_1_pastille_RONDE_HPGL( wxPoint( x0, y0 ), diametre, FILAIRE ); trace_1_pastille_RONDE_HPGL( wxPoint( x0, y0 ), diametre, FILAIRE );
if( format == PLOT_FORMAT_POST ) if( IsPostScript( format ) )
trace_1_pastille_RONDE_POST( wxPoint( x0, y0 ), diametre, FILAIRE ); trace_1_pastille_RONDE_POST( wxPoint( x0, y0 ), diametre, FILAIRE );
break; break;
@ -480,7 +480,7 @@ void PlotDrillSymbol( const wxPoint& position, int diametre, int aShapeId, int f
FctPlume( wxPoint( x0, y0 + rayon ), 'D' ); FctPlume( wxPoint( x0, y0 + rayon ), 'D' );
if( format == PLOT_FORMAT_HPGL ) if( format == PLOT_FORMAT_HPGL )
trace_1_pastille_RONDE_HPGL( wxPoint( x0, y0 ), diametre, FILAIRE ); trace_1_pastille_RONDE_HPGL( wxPoint( x0, y0 ), diametre, FILAIRE );
if( format == PLOT_FORMAT_POST ) if( IsPostScript( format ) )
trace_1_pastille_RONDE_POST( wxPoint( x0, y0 ), diametre, FILAIRE ); trace_1_pastille_RONDE_POST( wxPoint( x0, y0 ), diametre, FILAIRE );
break; break;
@ -489,7 +489,7 @@ void PlotDrillSymbol( const wxPoint& position, int diametre, int aShapeId, int f
trace_1_pad_TRAPEZE_HPGL( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0, trace_1_pad_TRAPEZE_HPGL( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
0 ), 0, 0 ), 0,
FILAIRE ); FILAIRE );
if( format == PLOT_FORMAT_POST ) if( IsPostScript( format ) )
trace_1_pad_TRAPEZE_POST( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0, trace_1_pad_TRAPEZE_POST( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
0 ), 0, 0 ), 0,
FILAIRE ); FILAIRE );
@ -500,7 +500,7 @@ void PlotDrillSymbol( const wxPoint& position, int diametre, int aShapeId, int f
trace_1_pad_TRAPEZE_HPGL( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0, trace_1_pad_TRAPEZE_HPGL( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
0 ), 450, 0 ), 450,
FILAIRE ); FILAIRE );
if( format == PLOT_FORMAT_POST ) if( IsPostScript( format ) )
trace_1_pad_TRAPEZE_POST( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0, trace_1_pad_TRAPEZE_POST( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
0 ), 450, 0 ), 450,
FILAIRE ); FILAIRE );
@ -515,7 +515,7 @@ void PlotDrillSymbol( const wxPoint& position, int diametre, int aShapeId, int f
trace_1_pad_TRAPEZE_HPGL( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0, trace_1_pad_TRAPEZE_HPGL( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
0 ), 0, 0 ), 0,
FILAIRE ); FILAIRE );
if( format == PLOT_FORMAT_POST ) if( IsPostScript( format ) )
trace_1_pad_TRAPEZE_POST( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0, trace_1_pad_TRAPEZE_POST( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
0 ), 0, 0 ), 0,
FILAIRE ); FILAIRE );
@ -530,7 +530,7 @@ void PlotDrillSymbol( const wxPoint& position, int diametre, int aShapeId, int f
trace_1_pad_TRAPEZE_HPGL( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0, trace_1_pad_TRAPEZE_HPGL( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
0 ), 450, 0 ), 450,
FILAIRE ); FILAIRE );
if( format == PLOT_FORMAT_POST ) if( IsPostScript( format ) )
trace_1_pad_TRAPEZE_POST( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0, trace_1_pad_TRAPEZE_POST( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
0 ), 450, 0 ), 450,
FILAIRE ); FILAIRE );
@ -543,7 +543,7 @@ void PlotDrillSymbol( const wxPoint& position, int diametre, int aShapeId, int f
trace_1_pad_TRAPEZE_HPGL( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0, trace_1_pad_TRAPEZE_HPGL( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
0 ), 0, 0 ), 0,
FILAIRE ); FILAIRE );
if( format == PLOT_FORMAT_POST ) if( IsPostScript( format ) )
trace_1_pad_TRAPEZE_POST( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0, trace_1_pad_TRAPEZE_POST( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
0 ), 0, 0 ), 0,
FILAIRE ); FILAIRE );
@ -556,7 +556,7 @@ void PlotDrillSymbol( const wxPoint& position, int diametre, int aShapeId, int f
trace_1_pad_TRAPEZE_HPGL( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0, trace_1_pad_TRAPEZE_HPGL( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
0 ), 450, 0 ), 450,
FILAIRE ); FILAIRE );
if( format == PLOT_FORMAT_POST ) if( IsPostScript( format ) )
trace_1_pad_TRAPEZE_POST( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0, trace_1_pad_TRAPEZE_POST( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
0 ), 450, 0 ), 450,
FILAIRE ); FILAIRE );
@ -569,7 +569,7 @@ void PlotDrillSymbol( const wxPoint& position, int diametre, int aShapeId, int f
trace_1_pad_TRAPEZE_HPGL( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0, trace_1_pad_TRAPEZE_HPGL( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
0 ), 450, 0 ), 450,
FILAIRE ); FILAIRE );
if( format == PLOT_FORMAT_POST ) if( IsPostScript( format ) )
trace_1_pad_TRAPEZE_POST( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0, trace_1_pad_TRAPEZE_POST( wxPoint( x0, y0 ), wxSize( rayon, rayon ), wxSize( 0,
0 ), 450, 0 ), 450,
FILAIRE ); FILAIRE );
@ -578,7 +578,7 @@ void PlotDrillSymbol( const wxPoint& position, int diametre, int aShapeId, int f
default: default:
if( format == PLOT_FORMAT_HPGL ) if( format == PLOT_FORMAT_HPGL )
trace_1_pastille_RONDE_HPGL( wxPoint( x0, y0 ), diametre, FILAIRE ); trace_1_pastille_RONDE_HPGL( wxPoint( x0, y0 ), diametre, FILAIRE );
if( format == PLOT_FORMAT_POST ) if( IsPostScript( format ) )
trace_1_pastille_RONDE_POST( wxPoint( x0, y0 ), diametre, FILAIRE ); trace_1_pastille_RONDE_POST( wxPoint( x0, y0 ), diametre, FILAIRE );
break; break;
} }
@ -654,21 +654,21 @@ void GenDrillReportFile( FILE* aFile, BOARD* aPcb, const wxString& aBoardFilenam
TotalHoleCount = 0; TotalHoleCount = 0;
if( gen_through_holes ) if( gen_through_holes )
{ {
sprintf( line, "Drill report for through holes :\n" ); sprintf( line, "Drill report for through holes :\n" );
} }
else else
{ {
if ( layer1 == COPPER_LAYER_N ) // First partial hole list if ( layer1 == COPPER_LAYER_N ) // First partial hole list
{ {
sprintf( line, "Drill report for buried and blind vias :\n\n"); sprintf( line, "Drill report for buried and blind vias :\n\n");
fputs( line, aFile ); fputs( line, aFile );
} }
sprintf( line, "Drill report for holes from layer %s to layer %s\n", sprintf( line, "Drill report for holes from layer %s to layer %s\n",
CONV_TO_UTF8 (aPcb->GetLayerName(layer1) ), CONV_TO_UTF8 (aPcb->GetLayerName(layer1) ),
CONV_TO_UTF8 (aPcb->GetLayerName(layer2) ) ); CONV_TO_UTF8 (aPcb->GetLayerName(layer2) ) );
} }
fputs( line, aFile ); fputs( line, aFile );

View File

@ -287,64 +287,64 @@ void WinEDA_DrillFrame::GenDrillFiles( wxCommandEvent& event )
Build_Holes_List( m_Parent->m_Pcb, s_HoleListBuffer, s_ToolListBuffer, Build_Holes_List( m_Parent->m_Pcb, s_HoleListBuffer, s_ToolListBuffer,
layer1, layer2, gen_through_holes ? false : true ); layer1, layer2, gen_through_holes ? false : true );
if( s_ToolListBuffer.size() > 0 ) //holes? if( s_ToolListBuffer.size() > 0 ) //holes?
{ {
FullFileName = m_Parent->m_CurrentScreen->m_FileName; FullFileName = m_Parent->m_CurrentScreen->m_FileName;
layer_extend.Empty(); layer_extend.Empty();
if( !gen_through_holes ) if( !gen_through_holes )
{ {
if( layer1 == COPPER_LAYER_N ) if( layer1 == COPPER_LAYER_N )
layer_extend << wxT( "-copper" ); layer_extend << wxT( "-copper" );
else else
layer_extend << wxT( "-inner" ) << layer1; layer_extend << wxT( "-inner" ) << layer1;
if( layer2 == LAYER_CMP_N ) if( layer2 == LAYER_CMP_N )
layer_extend << wxT( "-cmp" ); layer_extend << wxT( "-cmp" );
else else
layer_extend << wxT( "-inner" ) << layer2; layer_extend << wxT( "-inner" ) << layer2;
} }
layer_extend << Ext; layer_extend << Ext;
ChangeFileNameExt( FullFileName, layer_extend ); ChangeFileNameExt( FullFileName, layer_extend );
FullFileName = EDA_FileSelector( _( "Drill file" ), FullFileName = EDA_FileSelector( _( "Drill file" ),
wxEmptyString, /* Chemin par defaut */ wxEmptyString, /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */ FullFileName, /* nom fichier par defaut */
Ext, /* extension par defaut */ Ext, /* extension par defaut */
Mask, /* Masque d'affichage */ Mask, /* Masque d'affichage */
this, this,
wxFD_SAVE, wxFD_SAVE,
TRUE TRUE
); );
if( FullFileName != wxEmptyString ) if( FullFileName != wxEmptyString )
{ {
dest = wxFopen( FullFileName, wxT( "w" ) ); dest = wxFopen( FullFileName, wxT( "w" ) );
if( dest == 0 ) if( dest == 0 )
{ {
msg = _( "Unable to create file " ) + FullFileName; msg = _( "Unable to create file " ) + FullFileName;
DisplayError( this, msg ); DisplayError( this, msg );
EndModal( 0 ); EndModal( 0 );
return; return;
} }
Create_Drill_File_EXCELLON( s_HoleListBuffer, s_ToolListBuffer ); Create_Drill_File_EXCELLON( s_HoleListBuffer, s_ToolListBuffer );
} }
switch( m_Choice_Drill_Map->GetSelection() ) switch( m_Choice_Drill_Map->GetSelection() )
{ {
case 0: case 0:
break; break;
case 1: case 1:
GenDrillMap( FullFileName, s_HoleListBuffer, s_ToolListBuffer, PLOT_FORMAT_HPGL ); GenDrillMap( FullFileName, s_HoleListBuffer, s_ToolListBuffer, PLOT_FORMAT_HPGL );
break; break;
case 2: case 2:
GenDrillMap( FullFileName, s_HoleListBuffer, s_ToolListBuffer, PLOT_FORMAT_POST ); GenDrillMap( FullFileName, s_HoleListBuffer, s_ToolListBuffer, PLOT_FORMAT_POST );
break; break;
} }
if( !ExistsBuriedVias ) if( !ExistsBuriedVias )
break; break;
} }
if( gen_through_holes ) if( gen_through_holes )
layer2 = layer1 + 1; layer2 = layer1 + 1;
else else

View File

@ -90,7 +90,29 @@ public:
WinEDA_ValueCtrl* m_HPGLPenOverlayOpt; WinEDA_ValueCtrl* m_HPGLPenOverlayOpt;
WinEDA_DFloatValueCtrl* m_FineAdjustXscaleOpt, * m_FineAdjustYscaleOpt; WinEDA_DFloatValueCtrl* m_FineAdjustXscaleOpt, * m_FineAdjustYscaleOpt;
double m_XScaleAdjust, m_YScaleAdjust; double m_XScaleAdjust, m_YScaleAdjust;
int m_PlotFormat;
bool useA4()
{
return m_PlotFormatOpt->GetSelection() == 3;
}
/**
* Function getFormat
* returns one of the values from the PlotFormat enum. If the 4th
* radio button is selected, map this back to postscript.
*/
PlotFormat getFormat()
{
int radioNdx = m_PlotFormatOpt->GetSelection();
// change the A4 to the simple postscript, according to the PlotFormat enum
if( radioNdx == 3 )
radioNdx = 2;
return PlotFormat( radioNdx );
}
public: public:
WinEDA_PlotFrame( WinEDA_BasePcbFrame * parent ); WinEDA_PlotFrame( WinEDA_BasePcbFrame * parent );
@ -137,7 +159,6 @@ WinEDA_PlotFrame::WinEDA_PlotFrame( WinEDA_BasePcbFrame* parent ) :
SetFont( *g_DialogFont ); SetFont( *g_DialogFont );
Centre(); Centre();
m_PlotFormat = format_plot;
m_Plot_Sheet_Ref = NULL; m_Plot_Sheet_Ref = NULL;
wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxHORIZONTAL );
@ -169,33 +190,16 @@ WinEDA_PlotFrame::WinEDA_PlotFrame( WinEDA_BasePcbFrame* parent ) :
4, fmtmsg, 1, wxRA_SPECIFY_COLS ); 4, fmtmsg, 1, wxRA_SPECIFY_COLS );
MidRightBoxSizer->Add( m_PlotFormatOpt, 0, wxGROW | wxALL, 5 ); MidRightBoxSizer->Add( m_PlotFormatOpt, 0, wxGROW | wxALL, 5 );
if( config && config->Read( OPTKEY_OUTPUT_FORMAT, &m_PlotFormat ) ) int myFormatIndex = format_plot;
m_PlotFormatOpt->SetSelection( m_PlotFormat );
else if( config )
{ {
switch( m_PlotFormat ) config->Read( OPTKEY_OUTPUT_FORMAT, &myFormatIndex );
{
case PLOT_FORMAT_HPGL:
m_PlotFormatOpt->SetSelection( 0 );
break;
case PLOT_FORMAT_GERBER:
m_PlotFormatOpt->SetSelection( 1 );
break;
default: // ( PLOT_FORMAT_POST or PLOT_FORMAT_POST_A4 )
// As m_PlotFormat is never set to a value of PLOT_FORMAT_POST_A4,
// use the value of g_ForcePlotPS_On_A4 to determine whether the
// "Postscript" or "Postscipt A4" radiobutton had been selected
// previously (and thus which button should be reselected now).
if( g_ForcePlotPS_On_A4 )
m_PlotFormatOpt->SetSelection( 3 );
else
m_PlotFormatOpt->SetSelection( 2 );
break;
}
} }
m_PlotFormatOpt->SetSelection( myFormatIndex );
// Creation des menus d'option du format GERBER // Creation des menus d'option du format GERBER
m_GerbSpotSizeMinOpt = new WinEDA_ValueCtrl( this, _( "Spot min" ), m_GerbSpotSizeMinOpt = new WinEDA_ValueCtrl( this, _( "Spot min" ),
spot_mini, g_UnitMetric, MidRightBoxSizer, spot_mini, g_UnitMetric, MidRightBoxSizer,
@ -490,18 +494,10 @@ void WinEDA_PlotFrame::SetCommands( wxCommandEvent& event )
/* active ou désactive les différents menus d'option selon le standard choisi /* active ou désactive les différents menus d'option selon le standard choisi
*/ */
{ {
int format; int format = getFormat();
static const int format_list[] = {
PLOT_FORMAT_HPGL, PLOT_FORMAT_GERBER,
PLOT_FORMAT_POST, PLOT_FORMAT_POST_A4
};
format = format_list[m_PlotFormatOpt->GetSelection()];
switch( format ) switch( format )
{ {
case PLOT_FORMAT_POST_A4:
case PLOT_FORMAT_POST: case PLOT_FORMAT_POST:
default: default:
m_Drill_Shape_Opt->Enable( true ); m_Drill_Shape_Opt->Enable( true );
@ -519,8 +515,6 @@ void WinEDA_PlotFrame::SetCommands( wxCommandEvent& event )
m_Scale_Opt->Enable( true ); m_Scale_Opt->Enable( true );
m_FineAdjustXscaleOpt->Enable( true ); m_FineAdjustXscaleOpt->Enable( true );
m_FineAdjustYscaleOpt->Enable( true ); m_FineAdjustYscaleOpt->Enable( true );
m_PlotFormat = PLOT_FORMAT_POST;
g_ForcePlotPS_On_A4 = (format == PLOT_FORMAT_POST_A4);
m_Plot_PS_Negative->Enable( true ); m_Plot_PS_Negative->Enable( true );
break; break;
@ -540,7 +534,6 @@ void WinEDA_PlotFrame::SetCommands( wxCommandEvent& event )
m_Scale_Opt->Enable( false ); m_Scale_Opt->Enable( false );
m_FineAdjustXscaleOpt->Enable( false ); m_FineAdjustXscaleOpt->Enable( false );
m_FineAdjustYscaleOpt->Enable( false ); m_FineAdjustYscaleOpt->Enable( false );
m_PlotFormat = PLOT_FORMAT_GERBER;
m_Plot_PS_Negative->Enable( false ); m_Plot_PS_Negative->Enable( false );
break; break;
@ -560,12 +553,11 @@ void WinEDA_PlotFrame::SetCommands( wxCommandEvent& event )
m_Scale_Opt->Enable( true ); m_Scale_Opt->Enable( true );
m_FineAdjustXscaleOpt->Enable( false ); m_FineAdjustXscaleOpt->Enable( false );
m_FineAdjustYscaleOpt->Enable( false ); m_FineAdjustYscaleOpt->Enable( false );
m_PlotFormat = PLOT_FORMAT_HPGL;
m_Plot_PS_Negative->Enable( false ); m_Plot_PS_Negative->Enable( false );
break; break;
} }
format_plot = m_PlotFormat; format_plot = format;
} }
@ -616,8 +608,8 @@ void WinEDA_PlotFrame::SaveOptPlot( wxCommandEvent& event )
config->Write( OPTKEY_PADS_ON_SILKSCREEN, PlotPadsOnSilkLayer ); config->Write( OPTKEY_PADS_ON_SILKSCREEN, PlotPadsOnSilkLayer );
config->Write( OPTKEY_ALWAYS_PRINT_PADS, Plot_Pads_All_Layers ); config->Write( OPTKEY_ALWAYS_PRINT_PADS, Plot_Pads_All_Layers );
m_PlotFormat = m_PlotFormatOpt->GetSelection(); int formatNdx = m_PlotFormatOpt->GetSelection();
config->Write( OPTKEY_OUTPUT_FORMAT, m_PlotFormat ); config->Write( OPTKEY_OUTPUT_FORMAT, formatNdx );
wxString layerKey; wxString layerKey;
for( int layer=0; layer<NB_LAYERS; ++layer ) for( int layer=0; layer<NB_LAYERS; ++layer )
@ -668,12 +660,15 @@ void WinEDA_PlotFrame::Plot( wxCommandEvent& event )
BaseFileName = m_Parent->GetScreen()->m_FileName; BaseFileName = m_Parent->GetScreen()->m_FileName;
ChangeFileNameExt( BaseFileName, wxT( "-" ) ); ChangeFileNameExt( BaseFileName, wxT( "-" ) );
switch( m_PlotFormat ) int format = getFormat();
switch( format )
{ {
case PLOT_FORMAT_POST: case PLOT_FORMAT_POST:
ext = wxT( ".ps" ); ext = wxT( ".ps" );
break; break;
default:
case PLOT_FORMAT_GERBER: case PLOT_FORMAT_GERBER:
ext = wxT( ".pho" ); ext = wxT( ".pho" );
break; break;
@ -695,12 +690,13 @@ void WinEDA_PlotFrame::Plot( wxCommandEvent& event )
// Calcul du nom du fichier // Calcul du nom du fichier
FullFileName = BaseFileName + board->GetLayerName( layer_to_plot ) + ext; FullFileName = BaseFileName + board->GetLayerName( layer_to_plot ) + ext;
switch( m_PlotFormat ) switch( format )
{ {
case PLOT_FORMAT_POST: case PLOT_FORMAT_POST:
m_Parent->Genere_PS( FullFileName, layer_to_plot ); m_Parent->Genere_PS( FullFileName, layer_to_plot, useA4() );
break; break;
default:
case PLOT_FORMAT_GERBER: case PLOT_FORMAT_GERBER:
m_Parent->Genere_GERBER( FullFileName, layer_to_plot, s_PlotOriginIsAuxAxis ); m_Parent->Genere_GERBER( FullFileName, layer_to_plot, s_PlotOriginIsAuxAxis );
break; break;

View File

@ -1,6 +1,6 @@
/************/ /************/
/* pcbplot.h*/ /* pcbplot.h*/
/************/ /************/
#ifndef PCBPLOT_H #ifndef PCBPLOT_H
#define PCBPLOT_H #define PCBPLOT_H
@ -60,9 +60,9 @@ eda_global bool PlotPadsOnSilkLayer /* Plot pads sur couche serigraphie */
#endif #endif
; ;
eda_global bool Plot_Pads_All_Layers; /* Plot pads meme n'appartenant pas a la eda_global bool Plot_Pads_All_Layers; /* Plot pads meme n'appartenant pas a la
couche ( utile pour serigraphie) */ couche ( utile pour serigraphie) */
/* Variables utiles */ /* Variables utiles */
eda_global FILE * dest; eda_global FILE * dest;
@ -90,19 +90,18 @@ eda_global wxPoint g_PlotOffset; /* Offset de trace modifies par l'echelle */
eda_global int nb_plot_erreur ; eda_global int nb_plot_erreur ;
eda_global int nb_items; /* utilise pour decompter les objets traces */ eda_global int nb_items; /* utilise pour decompter les objets traces */
eda_global int g_PlotLine_Width; /* Largeur du trait en mode filaire (utilise en serigraphie, eda_global int g_PlotLine_Width; /* Largeur du trait en mode filaire (utilise en serigraphie,
pour traces en mode sketch et filaire) */ pour traces en mode sketch et filaire) */
eda_global int format_plot; /* numero de code du format de sortie */ eda_global int format_plot; /* numero de code du format de sortie */
eda_global int g_PlotOrient; /* numero de code de l'orientation du trace ( voir eda_global int g_PlotOrient; /* numero de code de l'orientation du trace ( voir
defines precedents): defines precedents):
0 = normal 0 = normal
PLOT_MIROIR = MIROIR PLOT_MIROIR = MIROIR
*/ */
eda_global int g_PlotScaleOpt // 0 = automatique, >=1 echelle specifiee eda_global int g_PlotScaleOpt // 0 = automatique, >=1 echelle specifiee
#ifdef MAIN #ifdef MAIN
= 1 = 1
#endif #endif
; ;
eda_global bool g_ForcePlotPS_On_A4; // Force la selection de la feuille A4 pour le plot POSTSCRIPT
eda_global int g_DrillShapeOpt eda_global int g_DrillShapeOpt
#ifdef MAIN #ifdef MAIN
@ -111,9 +110,9 @@ eda_global int g_DrillShapeOpt
; ;
/*************************************/ /*************************************/
/* Constantes utiles en trace GERBER */ /* Constantes utiles en trace GERBER */
/*************************************/ /*************************************/
/* codes de type de forme d'outils */ /* codes de type de forme d'outils */
#define GERB_CIRCLE 1 #define GERB_CIRCLE 1
@ -123,34 +122,34 @@ eda_global int g_DrillShapeOpt
#define GERB_DONUT 5 #define GERB_DONUT 5
/* liste des D_CODES en fonction de leur numero d'ordre (numero d'outil) /* liste des D_CODES en fonction de leur numero d'ordre (numero d'outil)
(l'ordre 0 n'est pas utilise) ; (l'ordre 0 n'est pas utilise) ;
Tools have D_CODES >= 10 Tools have D_CODES >= 10
D_CODES <= 9 are used for commands only: D_CODES <= 9 are used for commands only:
D01 ... D9 = command codes for photo plotting: D01 ... D9 = command codes for photo plotting:
D01 = Light on D01 = Light on
D02 = Light off D02 = Light off
D03 = Flash D03 = Flash
D04 .. D08 = ? D04 .. D08 = ?
D09 = VAPE Flash D09 = VAPE Flash
*/ */
/* Routines generales de trace : */ /* Routines generales de trace : */
/* PLOT_RTN.CC */ /* PLOT_RTN.CC */
void PlotTextePcb( TEXTE_PCB * pt_texte,int format_plot,int masque_layer); void PlotTextePcb( TEXTE_PCB * pt_texte,int format_plot,int masque_layer);
/* Trace 1 Texte type PCB , c.a.d autre que les textes sur modules, /* Trace 1 Texte type PCB , c.a.d autre que les textes sur modules,
prepare les parametres de trace de Plot_1_texte */ prepare les parametres de trace de Plot_1_texte */
void PlotArc(int format_plot, wxPoint centre, int start_angle,int end_angle, void PlotArc(int format_plot, wxPoint centre, int start_angle,int end_angle,
int rayon,int width); int rayon,int width);
void PlotCircle(int format_plot,int width, wxPoint centre, int rayon); void PlotCircle(int format_plot,int width, wxPoint centre, int rayon);
void PlotPolygon(int format_plot, bool filled, int nbpoints, int * coord); void PlotPolygon(int format_plot, bool filled, int nbpoints, int * coord);
void Plot_1_texte( int format_plot, void Plot_1_texte( int format_plot,
const wxString & Text, int t_orient, const wxString & Text, int t_orient,
int width, int ox,int oy,int size_h,int size_v, int width, int ox,int oy,int size_h,int size_v,
bool centreX = TRUE, bool centreY = TRUE); bool centreX = TRUE, bool centreY = TRUE);
/* Routine de base de trace de 1 chaine de caracteres */ /* Routine de base de trace de 1 chaine de caracteres */
void PlotDrawSegment( DRAWSEGMENT* PtSegm, int format_plot,int masque_layer ); void PlotDrawSegment( DRAWSEGMENT* PtSegm, int format_plot,int masque_layer );
@ -165,17 +164,17 @@ void PlotGERBERLine(wxPoint start, wxPoint end, int hauteur);
void PlotCircle_GERBER( wxPoint centre, int rayon, int width); void PlotCircle_GERBER( wxPoint centre, int rayon, int width);
void PlotPolygon_GERBER(int nb_segm, int * coord, bool fill); void PlotPolygon_GERBER(int nb_segm, int * coord, bool fill);
void trace_1_contour_GERBER(wxPoint pos, wxSize size, wxSize delta, void trace_1_contour_GERBER(wxPoint pos, wxSize size, wxSize delta,
int penwidth, int orient); int penwidth, int orient);
/* Trace 1 contour rectangulaire ou trapezoidal d'orientation quelconque /* Trace 1 contour rectangulaire ou trapezoidal d'orientation quelconque
donne par son centre, ses dimensions, donne par son centre, ses dimensions,
ses variations, l'epaisseur du trait et son orientation orient */ ses variations, l'epaisseur du trait et son orientation orient */
/* PLOTHPGL.CC */ /* PLOTHPGL.CC */
void trace_1_segment_HPGL(int pos_X0,int pos_Y0,int pos_X1,int pos_Y1, void trace_1_segment_HPGL(int pos_X0,int pos_Y0,int pos_X1,int pos_Y1,
int hauteur); int hauteur);
void trace_1_pad_TRAPEZE_HPGL(wxPoint padpos, wxSize size,wxSize delta, void trace_1_pad_TRAPEZE_HPGL(wxPoint padpos, wxSize size,wxSize delta,
int orient,int modetrace); int orient,int modetrace);
void trace_1_pastille_RONDE_HPGL(wxPoint padpos, int diametre,int modetrace) ; void trace_1_pastille_RONDE_HPGL(wxPoint padpos, int diametre,int modetrace) ;
void trace_1_pastille_OVALE_HPGL(wxPoint padpos, wxSize size, int orient, int modetrace); void trace_1_pastille_OVALE_HPGL(wxPoint padpos, wxSize size, int orient, int modetrace);
@ -187,11 +186,11 @@ void PlotRectangularPad_HPGL(wxPoint padpos, wxSize padsize, int orient,int mode
void trace_1_pastille_OVALE_POST(wxPoint centre, wxSize size, int orient, int modetrace); void trace_1_pastille_OVALE_POST(wxPoint centre, wxSize size, int orient, int modetrace);
void trace_1_pastille_RONDE_POST(wxPoint centre, int diametre, int modetrace); void trace_1_pastille_RONDE_POST(wxPoint centre, int diametre, int modetrace);
void trace_1_pad_rectangulaire_POST(wxPoint centre, wxSize size,int orient, void trace_1_pad_rectangulaire_POST(wxPoint centre, wxSize size,int orient,
int modetrace); int modetrace);
void trace_1_contour_POST(wxPoint centre, wxSize size, wxSize delta, void trace_1_contour_POST(wxPoint centre, wxSize size, wxSize delta,
int dim_trait, int orient); int dim_trait, int orient);
void trace_1_pad_TRAPEZE_POST(wxPoint centre, wxSize size, wxSize delta, void trace_1_pad_TRAPEZE_POST(wxPoint centre, wxSize size, wxSize delta,
int orient,int modetrace); int orient,int modetrace);
#endif /* #define PCBPLOT_H */ #endif /* #define PCBPLOT_H */

View File

@ -33,7 +33,6 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot,
wxPoint pos, shape_pos; wxPoint pos, shape_pos;
wxSize size; wxSize size;
bool trace_val, trace_ref; bool trace_val, trace_ref;
MODULE* Module;
D_PAD* pt_pad; D_PAD* pt_pad;
TEXTE_MODULE* pt_texte; TEXTE_MODULE* pt_texte;
EDA_BaseStruct* PtStruct; EDA_BaseStruct* PtStruct;
@ -87,8 +86,8 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot,
{ {
nb_items = 0; nb_items = 0;
Affiche_1_Parametre( this, 56, wxT( "Pads" ), wxEmptyString, GREEN ); Affiche_1_Parametre( this, 56, wxT( "Pads" ), wxEmptyString, GREEN );
Module = m_Pcb->m_Modules;
for( ; Module != NULL; Module = (MODULE*) Module->Pnext ) for( MODULE* Module = m_Pcb->m_Modules; Module; Module = Module->Next() )
{ {
pt_pad = (D_PAD*) Module->m_Pads; pt_pad = (D_PAD*) Module->m_Pads;
for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext ) for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext )
@ -121,7 +120,6 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot,
trace_1_pastille_RONDE_POST( pos, size.x, FILAIRE ); trace_1_pastille_RONDE_POST( pos, size.x, FILAIRE );
break; break;
} }
break; break;
case PAD_OVAL: case PAD_OVAL:
@ -144,7 +142,6 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot,
pt_pad->m_Orient, FILAIRE ); pt_pad->m_Orient, FILAIRE );
break; break;
} }
break; break;
case PAD_TRAPEZOID: case PAD_TRAPEZOID:
@ -172,7 +169,6 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot,
FILAIRE ); FILAIRE );
break; break;
} }
break; break;
} }
@ -196,7 +192,6 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot,
(int) pt_pad->m_Orient, FILAIRE ); (int) pt_pad->m_Orient, FILAIRE );
break; break;
} }
break; break;
} }
@ -209,8 +204,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot,
/* Trace Textes MODULES */ /* Trace Textes MODULES */
nb_items = 0; Affiche_1_Parametre( this, 64, wxT( "TxtMod" ), wxEmptyString, LIGHTBLUE ); nb_items = 0; Affiche_1_Parametre( this, 64, wxT( "TxtMod" ), wxEmptyString, LIGHTBLUE );
Module = m_Pcb->m_Modules; for( MODULE* Module = m_Pcb->m_Modules; Module; Module = Module->Next() )
for( ; Module != NULL; Module = (MODULE*) Module->Pnext )
{ {
/* Analyse des autorisations de trace pour les textes VALEUR et REF */ /* Analyse des autorisations de trace pour les textes VALEUR et REF */
trace_val = Sel_Texte_Valeur; trace_val = Sel_Texte_Valeur;
@ -831,7 +825,7 @@ void PlotArc( int format_plot, wxPoint centre, int start_angle, int end_angle,
if( Plot_Mode == FILAIRE ) if( Plot_Mode == FILAIRE )
epaisseur = g_PlotLine_Width; epaisseur = g_PlotLine_Width;
if( format_plot == PLOT_FORMAT_POST ) if( IsPostScript( format_plot ) )
{ {
PlotArcPS( centre, start_angle, end_angle, rayon, epaisseur ); PlotArcPS( centre, start_angle, end_angle, rayon, epaisseur );
return; return;

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,7 @@ const int DRILL_MARK = 1;
/****************************************************************************/ /****************************************************************************/
void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer ) void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer, bool useA4 )
/****************************************************************************/ /****************************************************************************/
/* Genere un fichier POSTSCRIPT (*.ps) de trace du circuit, couche layer /* Genere un fichier POSTSCRIPT (*.ps) de trace du circuit, couche layer
@ -59,6 +59,7 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer )
if( g_PlotScaleOpt != 1 ) if( g_PlotScaleOpt != 1 )
Center = TRUE; // Echelle != 1 donc trace centree du PCB Center = TRUE; // Echelle != 1 donc trace centree du PCB
modetrace = Plot_Mode; modetrace = Plot_Mode;
scale_format = 1.0; scale_format = 1.0;
@ -69,7 +70,8 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer )
// calcul en unites internes des dimensions des feuilles ( connues en 1/1000 pouce ) // calcul en unites internes des dimensions des feuilles ( connues en 1/1000 pouce )
PcbSheetSize.x = currentsheet->m_Size.x * U_PCB; PcbSheetSize.x = currentsheet->m_Size.x * U_PCB;
PcbSheetSize.y = currentsheet->m_Size.y * U_PCB; PcbSheetSize.y = currentsheet->m_Size.y * U_PCB;
if( g_ForcePlotPS_On_A4 )
if( useA4 )
{ {
SheetPS = &g_Sheet_A4; SheetPS = &g_Sheet_A4;
PaperSize.x = g_Sheet_A4.m_Size.x * U_PCB; PaperSize.x = g_Sheet_A4.m_Size.x * U_PCB;
@ -168,9 +170,9 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer )
SetColorMapPS( WHITE ); SetColorMapPS( WHITE );
} }
// Specify that the contents of the "Edges Pcb" layer are to be plotted // Specify that the contents of the "Edges Pcb" layer are to be plotted
// in addition to the contents of the currently specified layer. // in addition to the contents of the currently specified layer.
int layer_mask = g_TabOneLayerMask[Layer] | EDGE_LAYER; int layer_mask = g_TabOneLayerMask[Layer] | EDGE_LAYER;
switch( Layer ) switch( Layer )
{ {
@ -464,7 +466,7 @@ static void PrintDrillMark( BOARD* Pcb )
if( g_DrillShapeOpt == DRILL_MARK ) if( g_DrillShapeOpt == DRILL_MARK )
diam.x = diam.y = SMALL_DRILL; diam.x = diam.y = SMALL_DRILL;
else else
diam.x = diam.y = pts->GetDrillValue(); diam.x = diam.y = pts->GetDrillValue();
trace_1_pastille_RONDE_POST( pos, diam.x, FILLED ); trace_1_pastille_RONDE_POST( pos, diam.x, FILLED );
} }
@ -573,7 +575,7 @@ void trace_1_pastille_RONDE_POST( wxPoint centre, int diametre, int modetrace )
if( modetrace == FILLED ) if( modetrace == FILLED )
{ {
SetCurrentLineWidthPS(0); SetCurrentLineWidthPS(0);
rayon = diam.x / 2; rayon = diam.x / 2;
if( rayon < 1 ) if( rayon < 1 )
rayon = 1; rayon = 1;
@ -588,7 +590,7 @@ void trace_1_pastille_RONDE_POST( wxPoint centre, int diametre, int modetrace )
rayon = 1; rayon = 1;
if( rayon < w ) if( rayon < w )
w = rayon; w = rayon;
SetCurrentLineWidthPS(w); SetCurrentLineWidthPS(w);
fprintf( dest, "newpath %d %d %d 0 360 arc stroke\n", fprintf( dest, "newpath %d %d %d 0 360 arc stroke\n",
centre.x, centre.y, rayon ); centre.x, centre.y, rayon );
} }

View File

@ -2707,6 +2707,10 @@ public:
}; };
/**
* Class CLASS
* corresponds to the &lt;class_descriptor&gt; in the specctra spec.
*/
class CLASS : public ELEM class CLASS : public ELEM
{ {
friend class SPECCTRA_DB; friend class SPECCTRA_DB;