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

@ -30,9 +30,10 @@ 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;
@ -44,7 +45,6 @@ void InitPlotParametresHPGL(wxPoint offset, double xscale, double yscale, int or
} }
/*****************************************************************/ /*****************************************************************/
bool PrintHeaderHPGL( FILE* plot_file, int pen_speed, int pen_num ) bool PrintHeaderHPGL( FILE* plot_file, int pen_speed, int pen_num )
/*****************************************************************/ /*****************************************************************/
@ -58,6 +58,7 @@ char Line[256];
return TRUE; return TRUE;
} }
/**********************************/ /**********************************/
bool CloseFileHPGL( FILE* plot_file ) bool CloseFileHPGL( FILE* plot_file )
/**********************************/ /**********************************/
@ -78,7 +79,8 @@ 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 );
@ -91,13 +93,14 @@ char Line[256];
/********************************************************************/ /********************************************************************/
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];
@ -105,7 +108,8 @@ 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 );
@ -135,14 +139,17 @@ float angle; /* angle de l'arc*/
/*****************************************************/ /*****************************************************/
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;
if( nb <= 1 )
return;
Move_Plume_HPGL( wxPoint( coord[0], coord[1] ), 'U' ); Move_Plume_HPGL( wxPoint( coord[0], coord[1] ), 'U' );
for( ii = 1; ii < nb; ii++ ) for( ii = 1; ii < nb; ii++ )
@ -164,11 +171,12 @@ int ii;
/**********************************************/ /**********************************************/
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];
@ -188,20 +196,20 @@ char Line[256];
/***************************/ /***************************/
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' )
fputs( "PU;", PlotOutputFile );
etat_plume = 'U'; etat_plume = 'U';
} }
else else
{ {
if(etat_plume != 'D' )fputs("PD;",PlotOutputFile) ; if( etat_plume != 'D' )
fputs( "PD;", PlotOutputFile );
etat_plume = 'D'; etat_plume = 'D';
} }
} }

View File

@ -63,6 +63,8 @@ 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
*/ */
{ {
D(printf( "PlotOutputFile = %p\n", PlotOutputFile );)
int pen_width; int pen_width;
if( width > 0 ) if( width > 0 )
@ -88,6 +90,8 @@ void SetColorMapPS(int color)
* color = color index in ColorRefs[] * color = color index in ColorRefs[]
*/ */
{ {
D(printf( "PlotOutputFile = %p\n", PlotOutputFile );)
char Line[1024]; char Line[1024];
sprintf( Line, "%.3f %.3f %.3f setrgbcolor\n", sprintf( Line, "%.3f %.3f %.3f setrgbcolor\n",
@ -106,6 +110,8 @@ void PlotFilledSegmentPS(wxPoint start, wxPoint end, int width)
/* Plot 1 segment like a track segment /* Plot 1 segment like a track segment
*/ */
{ {
D(printf( "PlotOutputFile = %p\n", PlotOutputFile );)
UserToDeviceCoordinate( start ); UserToDeviceCoordinate( start );
UserToDeviceCoordinate( end ); UserToDeviceCoordinate( end );
@ -118,6 +124,8 @@ void PlotFilledSegmentPS(wxPoint start, wxPoint end, int width)
void PlotCircle_PS( wxPoint pos, int diametre, int width ) void PlotCircle_PS( wxPoint pos, int diametre, int width )
/******************************************************/ /******************************************************/
{ {
D(printf( "PlotOutputFile = %p\n", PlotOutputFile );)
int rayon; int rayon;
char Line[256]; char Line[256];
@ -141,12 +149,15 @@ void PlotArcPS(wxPoint centre, int StAngle, int EndAngle, int rayon, int width)
* StAngle, EndAngle = start and end arc in 0.1 degree * StAngle, EndAngle = start and end arc in 0.1 degree
*/ */
{ {
D(printf( "PlotOutputFile = %p\n", PlotOutputFile );)
char Line[256]; char Line[256];
if( rayon <= 0 ) if( rayon <= 0 )
return; return;
SetCurrentLineWidthPS( width ); SetCurrentLineWidthPS( width );
// Calcul des coord du point de depart : // Calcul des coord du point de depart :
UserToDeviceCoordinate( centre ); UserToDeviceCoordinate( centre );
@ -156,6 +167,7 @@ char Line[256];
else else
sprintf( Line, "newpath %d %d %d %f %f arc stroke\n", centre.x, centre.y, sprintf( Line, "newpath %d %d %d %f %f arc stroke\n", centre.x, centre.y,
(int) (rayon * XScale), -(float) EndAngle / 10, -(float) StAngle / 10 ); (int) (rayon * XScale), -(float) EndAngle / 10, -(float) StAngle / 10 );
// Undo internationalization printf (float x.y printed x,y) // Undo internationalization printf (float x.y printed x,y)
to_point( Line ); to_point( Line );
fputs( Line, PlotOutputFile ); fputs( Line, PlotOutputFile );
@ -173,6 +185,8 @@ void PlotPolyPS(int nb_segm, int * coord, int fill, int width)
* @param width = line width * @param width = line width
*/ */
{ {
D(printf( "PlotOutputFile = %p\n", PlotOutputFile );)
int ii; int ii;
wxPoint pos; wxPoint pos;
@ -210,6 +224,8 @@ void LineTo_PS(wxPoint pos, int plume)
/* Routine to draw to a new position /* Routine to draw to a new position
*/ */
{ {
D(printf( "PlotOutputFile = %p\n", PlotOutputFile );)
if( plume == 'Z' ) if( plume == 'Z' )
return; return;
@ -251,7 +267,8 @@ void PrintHeaderPS(FILE * file, const wxString & Creator,
{ {
wxString msg; wxString msg;
char Line[1024]; char Line[1024];
const char *PSMacro[] = {
static const char* PSMacro[] = {
"/line {\n", "/line {\n",
" newpath\n", " newpath\n",
" moveto\n", " moveto\n",
@ -265,12 +282,16 @@ const char *PSMacro[] = {
"1 setlinewidth\n", "1 setlinewidth\n",
NULL NULL
}; };
const double MIL_TO_INCH = 0.001; const double MIL_TO_INCH = 0.001;
int ii; int ii;
time_t time1970 = time( NULL ); time_t time1970 = time( NULL );
PlotOutputFile = file; PlotOutputFile = file;
D(printf( "PrintHeaderPS PlotOutputFile = %p\n", PlotOutputFile );)
fputs( "%!PS-Adobe-3.0\n", PlotOutputFile ); // Print header fputs( "%!PS-Adobe-3.0\n", PlotOutputFile ); // Print header
sprintf( Line, "%%%%Creator: %s\n", CONV_TO_UTF8( Creator ) ); sprintf( Line, "%%%%Creator: %s\n", CONV_TO_UTF8( Creator ) );
@ -292,12 +313,14 @@ time_t time1970 = time(NULL);
// Print boundary box en 1/72 pouce, box is in mils // Print boundary box en 1/72 pouce, box is in mils
const double CONV_SCALE = MIL_TO_INCH * 72; const double CONV_SCALE = MIL_TO_INCH * 72;
// The coordinates of the lower left corner of the boundary // The coordinates of the lower left corner of the boundary
// box need to be "rounded down", but the coordinates of its // box need to be "rounded down", but the coordinates of its
// upper right corner need to be "rounded up" instead. // upper right corner need to be "rounded up" instead.
sprintf( Line, "%%%%BoundingBox: %d %d %d %d\n", sprintf( Line, "%%%%BoundingBox: %d %d %d %d\n",
(int) floor( (BBox[1] * CONV_SCALE) ), (int) floor( (BBox[0] * CONV_SCALE) ), (int) floor( (BBox[1] * CONV_SCALE) ), (int) floor( (BBox[0] * CONV_SCALE) ),
(int) ceil( (BBox[3] * CONV_SCALE) ), (int) ceil( (BBox[2] * CONV_SCALE) ) ); (int) ceil( (BBox[3] * CONV_SCALE) ), (int) ceil( (BBox[2] * CONV_SCALE) ) );
fputs( Line, PlotOutputFile ); fputs( Line, PlotOutputFile );
// Specify the size of the sheet and the name associated with that size. // Specify the size of the sheet and the name associated with that size.
@ -316,6 +339,7 @@ time_t time1970 = time(NULL);
sprintf( Line, "%%%%DocumentMedia: Custom %d %d 0 () ()\n", sprintf( Line, "%%%%DocumentMedia: Custom %d %d 0 () ()\n",
(int) round( SheetPS->m_Size.y * CONV_SCALE ), (int) round( SheetPS->m_Size.y * CONV_SCALE ),
(int) round( SheetPS->m_Size.x * CONV_SCALE ) ); (int) round( SheetPS->m_Size.x * CONV_SCALE ) );
else // ( if SheetPS->m_Name does not equal "User" ) else // ( if SheetPS->m_Name does not equal "User" )
sprintf( Line, "%%%%DocumentMedia: %s %d %d 0 () ()\n", sprintf( Line, "%%%%DocumentMedia: %s %d %d 0 () ()\n",
CONV_TO_UTF8( SheetPS->m_Name ), CONV_TO_UTF8( SheetPS->m_Name ),
@ -327,6 +351,7 @@ time_t time1970 = time(NULL);
sprintf( Line, "%%%%Orientation: Portrait\n" ); sprintf( Line, "%%%%Orientation: Portrait\n" );
else else
sprintf( Line, "%%%%Orientation: Landscape\n" ); sprintf( Line, "%%%%Orientation: Landscape\n" );
fputs( Line, PlotOutputFile ); fputs( Line, PlotOutputFile );
sprintf( Line, "%%%%EndComments\n" ); sprintf( Line, "%%%%EndComments\n" );
@ -349,6 +374,7 @@ time_t time1970 = time(NULL);
if( PaperOrientation == wxLANDSCAPE ) if( PaperOrientation == wxLANDSCAPE )
sprintf( Line, "%f %f translate 90 rotate\n", sprintf( Line, "%f %f translate 90 rotate\n",
(float) BBox[3] * MIL_TO_INCH, (float) BBox[0] * MIL_TO_INCH ); (float) BBox[3] * MIL_TO_INCH, (float) BBox[0] * MIL_TO_INCH );
// (If support for creating postscript files with a portrait orientation // (If support for creating postscript files with a portrait orientation
// is ever provided, determine whether it would be necessary to provide // is ever provided, determine whether it would be necessary to provide
// an "else" command and then an appropriate "sprintf" command here.) // an "else" command and then an appropriate "sprintf" command here.)
@ -372,6 +398,8 @@ time_t time1970 = time(NULL);
bool CloseFilePS( FILE* plot_file ) bool CloseFilePS( FILE* plot_file )
/******************************************/ /******************************************/
{ {
D(printf( "CloseFilePS\n" );)
fputs( "showpage\n", plot_file ); fputs( "showpage\n", plot_file );
fputs( "grestore\n", plot_file ); fputs( "grestore\n", plot_file );
fputs( "%%EOF\n", plot_file ); fputs( "%%EOF\n", plot_file );
@ -380,4 +408,3 @@ bool CloseFilePS(FILE * plot_file)
return TRUE; return TRUE;
} }

View File

@ -29,16 +29,19 @@ 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)
*/ */
{ {
@ -46,20 +49,24 @@ void SetPlotScale(double xscale, double yscale)
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;
@ -75,8 +82,9 @@ void InitPlotParametresGERBER(wxPoint offset, double xscale, double yscale)
/*******************************************************/ /*******************************************************/
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
@ -87,7 +95,7 @@ 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 );
@ -217,8 +225,11 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION;
{ {
pos.x = (ref.x - WsItem->m_Posx) * conv_unit; pos.x = (ref.x - WsItem->m_Posx) * conv_unit;
pos.y = (ref.y - WsItem->m_Posy) * conv_unit; pos.y = (ref.y - WsItem->m_Posy) * conv_unit;
if(WsItem->m_Legende) msg = WsItem->m_Legende; if( WsItem->m_Legende )
else msg.Empty(); msg = WsItem->m_Legende;
else
msg.Empty();
switch( WsItem->m_Type ) switch( WsItem->m_Type )
{ {
case WS_DATE: case WS_DATE:
@ -250,6 +261,7 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION;
break; break;
case WS_FULLSHEETNAME: case WS_FULLSHEETNAME:
// msg += GetScreenDesc(); // msg += GetScreenDesc();
break; break;
@ -288,12 +300,15 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION;
break; break;
case WS_UPPER_SEGMENT: case WS_UPPER_SEGMENT:
if (UpperLimit == 0 ) break; if( UpperLimit == 0 )
break;
case WS_LEFT_SEGMENT: case WS_LEFT_SEGMENT:
WS_MostUpperLine.m_Posy = WS_MostUpperLine.m_Posy =
WS_MostUpperLine.m_Endy = WS_MostUpperLine.m_Endy =
WS_MostLeftLine.m_Posy = UpperLimit; WS_MostLeftLine.m_Posy = UpperLimit;
pos.y = (ref.y - WsItem->m_Posy) * conv_unit; pos.y = (ref.y - WsItem->m_Posy) * conv_unit;
case WS_SEGMENT: case WS_SEGMENT:
{ {
wxPoint auxpos; wxPoint auxpos;
@ -303,8 +318,8 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION;
FctPlume( auxpos, 'D' ); FctPlume( auxpos, 'D' );
} }
break; break;
} }
if( !msg.IsEmpty() ) if( !msg.IsEmpty() )
{ {
PlotGraphicText( format_plot, pos, color, PlotGraphicText( format_plot, pos, color,
@ -318,6 +333,7 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION;
case PLOT_FORMAT_HPGL: case PLOT_FORMAT_HPGL:
Plume_HPGL( 'U' ); Plume_HPGL( 'U' );
break; break;
case PLOT_FORMAT_POST: case PLOT_FORMAT_POST:
break; break;
} }
@ -327,10 +343,10 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION;
/******************************************/ /******************************************/
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 */
{
/* modifie les coord pos.x et pos.y pour le trace selon l'orientation,
* l'echelle, les offsets de trace */
{
pos.x = (int) (pos.x * XScale); pos.x = (int) (pos.x * XScale);
pos.y = (int) (pos.y * YScale); pos.y = (int) (pos.y * YScale);
@ -343,9 +359,9 @@ void UserToDeviceCoordinate(wxPoint & pos )
case PLOT_MIROIR: case PLOT_MIROIR:
pos.x -= PlotOffset.x; pos.y = -PlotOffset.y + pos.y; pos.x -= PlotOffset.x; pos.y = -PlotOffset.y + pos.y;
break; break;
}
}
}
}
/************************************/ /************************************/
void UserToDeviceSize( wxSize& size ) void UserToDeviceSize( wxSize& size )
@ -355,4 +371,3 @@ void UserToDeviceSize(wxSize & size )
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

@ -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;

View File

@ -17,12 +17,12 @@ 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,
@ -37,8 +37,10 @@ int PinTextBarPos[256];
int PinTextBarCount; int PinTextBarCount;
int NameColor, NumColor; int NameColor, NumColor;
int PinTxtLen; int PinTxtLen;
wxSize PinNameSize( m_PinNameSize, m_PinNameSize ); wxSize PinNameSize( m_PinNameSize, m_PinNameSize );
wxSize PinNumSize( m_PinNumSize, m_PinNumSize ); wxSize PinNumSize( m_PinNumSize, m_PinNumSize );
int LineWidth = g_DrawMinimunLineWidth; int LineWidth = g_DrawMinimunLineWidth;
GRSetDrawMode( DC, DrawMode ); GRSetDrawMode( DC, DrawMode );
@ -51,12 +53,20 @@ int LineWidth = g_DrawMinimunLineWidth;
ReturnPinStringNum( StringPinNum ); ReturnPinStringNum( StringPinNum );
x1 = pin_pos.x; y1 = pin_pos.y; x1 = pin_pos.x; y1 = pin_pos.y;
switch( orient ) switch( orient )
{ {
case PIN_UP: y1 -= m_PinLen; break; case PIN_UP:
case PIN_DOWN: y1 += m_PinLen; break; y1 -= m_PinLen; break;
case PIN_LEFT: x1 -= m_PinLen; break;
case PIN_RIGHT: x1 += 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(); const wxChar* textsrc = m_PinName.GetData();
@ -82,11 +92,13 @@ int LineWidth = g_DrawMinimunLineWidth;
PinTxtLen = (int) (fPinTextPitch * PinTxtLen); PinTxtLen = (int) (fPinTextPitch * PinTxtLen);
PinTextBarPos[PinTextBarCount] = PinTxtLen; // Needed if no end '~' PinTextBarPos[PinTextBarCount] = PinTxtLen; // Needed if no end '~'
if (PinText[0] == 0) DrawPinName = FALSE; if( PinText[0] == 0 )
DrawPinName = FALSE;
if( TextInside ) /* Draw the text inside, but the pin numbers outside. */ if( TextInside ) /* Draw the text inside, but the pin numbers outside. */
{ {
if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) ) if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
// It is an horizontal line // It is an horizontal line
{ {
if( PinText && DrawPinName ) if( PinText && DrawPinName )
@ -139,9 +151,9 @@ int LineWidth = g_DrawMinimunLineWidth;
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth ); GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth );
} }
} }
else /* Its a vertical line. */ else /* Its a vertical line. */
{ // Text is drawn from bottom to top (i.e. to negative value for Y axis) {
// Text is drawn from bottom to top (i.e. to negative value for Y axis)
if( PinText && DrawPinName ) if( PinText && DrawPinName )
{ {
if( orient == PIN_DOWN ) if( orient == PIN_DOWN )
@ -163,7 +175,6 @@ int LineWidth = g_DrawMinimunLineWidth;
GRLineRel( &panel->m_ClipBox, DC, 0, -len, LineWidth, NameColor ); GRLineRel( &panel->m_ClipBox, DC, 0, -len, LineWidth, NameColor );
} }
} }
else /* PIN_UP */ else /* PIN_UP */
{ {
y = y1 - TextInside; y = y1 - TextInside;
@ -194,7 +205,6 @@ int LineWidth = g_DrawMinimunLineWidth;
} }
} }
} }
else /**** Draw num & text pin outside ****/ else /**** Draw num & text pin outside ****/
{ {
if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) ) if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
@ -259,6 +269,7 @@ int LineWidth = g_DrawMinimunLineWidth;
} }
} }
/***************************************************************************** /*****************************************************************************
* 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
@ -290,12 +301,20 @@ bool plot_color = (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt;
/* Create the pin num string */ /* Create the pin num string */
ReturnPinStringNum( StringPinNum ); ReturnPinStringNum( StringPinNum );
x1 = pin_pos.x; y1 = pin_pos.y; x1 = pin_pos.x; y1 = pin_pos.y;
switch( orient ) switch( orient )
{ {
case PIN_UP: y1 -= m_PinLen; break; case PIN_UP:
case PIN_DOWN: y1 += m_PinLen; break; y1 -= m_PinLen; break;
case PIN_LEFT: x1 -= m_PinLen; break;
case PIN_RIGHT: x1 += 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(); const wxChar* textsrc = m_PinName.GetData();
@ -321,7 +340,8 @@ bool plot_color = (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt;
PinTxtLen = (int) (fPinTextPitch * PinTxtLen); PinTxtLen = (int) (fPinTextPitch * PinTxtLen);
PinTextBarPos[PinTextBarCount] = PinTxtLen; // Needed if no end '~' PinTextBarPos[PinTextBarCount] = PinTxtLen; // Needed if no end '~'
if (PinText[0] == 0) DrawPinName = FALSE; if( PinText[0] == 0 )
DrawPinName = FALSE;
if( TextInside ) /* Draw the text inside, but the pin numbers outside. */ if( TextInside ) /* Draw the text inside, but the pin numbers outside. */
{ {
@ -373,7 +393,6 @@ bool plot_color = (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt;
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM ); GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM );
} }
} }
else /* Its a vertical line. */ else /* Its a vertical line. */
{ {
if( PinText && DrawPinName ) if( PinText && DrawPinName )
@ -395,7 +414,6 @@ bool plot_color = (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt;
Move_Plume( wxPoint( cte, y + PinTxtLen - len ), 'D' ); Move_Plume( wxPoint( cte, y + PinTxtLen - len ), 'D' );
} }
} }
else /* PIN_UP */ else /* PIN_UP */
{ {
y = y1 - TextInside; y = y1 - TextInside;
@ -424,7 +442,6 @@ bool plot_color = (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt;
} }
} }
} }
else /* Draw num & text pin outside */ else /* Draw num & text pin outside */
{ {
if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) ) if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
@ -488,4 +505,3 @@ bool plot_color = (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt;
} }
} }
} }

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

@ -12,12 +12,22 @@
#endif #endif
typedef enum { /**
* Enum PlotFormat
* must be kept in order of the radio buttons in the plot panel/window.
*/
enum PlotFormat {
PLOT_FORMAT_HPGL, PLOT_FORMAT_HPGL,
PLOT_FORMAT_POST,
PLOT_FORMAT_GERBER, PLOT_FORMAT_GERBER,
PLOT_FORMAT_POST_A4 PLOT_FORMAT_POST,
} PlotFormat; };
static inline bool IsPostScript( int aFormat )
{
return aFormat==PLOT_FORMAT_POST;
}
const int PLOT_MIROIR = 1; const int PLOT_MIROIR = 1;
@ -30,10 +40,13 @@ void SetPlotOffset(wxPoint offset); // Set the plot offset for the current plott
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 // modifie les coord pos.x et pos.y pour le trace selon l'orientation, l'echelle, les offsets de trace
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
void ForcePenReinit(); void ForcePenReinit();
// set the flag g_CurrentPenWidth to -1 in order // set the flag g_CurrentPenWidth to -1 in order
// to force a pen width redefinition for the next draw command // to force a pen width redefinition for the next draw command
@ -42,15 +55,25 @@ void ForcePenReinit();
/* 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,
Ki_PageDescr* sheet,
double xscale,
double yscale,
int orient = 0 );
void SetDefaultLineWidthPS( int width ); void SetDefaultLineWidthPS( int width );
void PlotCircle_PS( wxPoint pos, int diametre, int width = -1 ); void PlotCircle_PS( wxPoint pos, int diametre, int width = -1 );
void PlotArcPS( wxPoint centre, int StAngle, int EndAngle, int rayon, int width = -1 ); void PlotArcPS( wxPoint centre, int StAngle, int EndAngle, int rayon, int width = -1 );
// Plot an arc: StAngle, EndAngle = start and end arc in 0.1 degree // Plot an arc: StAngle, EndAngle = start and end arc in 0.1 degree
void PlotPolyPS( int nb_segm, int* coord, int fill, int width = -1 ); void PlotPolyPS( int nb_segm, int* coord, int fill, int width = -1 );
void PlotFilledSegmentPS( wxPoint start, wxPoint end, int width ); void PlotFilledSegmentPS( wxPoint start, wxPoint end, int width );
void LineTo_PS( wxPoint pos, int plume ); void LineTo_PS( wxPoint pos, int plume );
void PrintHeaderPS(FILE * file, const wxString & Creator, const wxString & FileName, int PageCount, int BBox[4], int PaperOrientation); void PrintHeaderPS( FILE* file,
const wxString& Creator,
const wxString& FileName,
int PageCount,
int BBox[4],
int PaperOrientation );
bool CloseFilePS( FILE* plot_file ); bool CloseFilePS( FILE* plot_file );
void SetColorMapPS( int color ); void SetColorMapPS( int color );
@ -68,4 +91,3 @@ 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,

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;
} }

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,32 +190,15 @@ 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
{
switch( m_PlotFormat )
{
case PLOT_FORMAT_HPGL:
m_PlotFormatOpt->SetSelection( 0 );
break;
case PLOT_FORMAT_GERBER: if( config )
m_PlotFormatOpt->SetSelection( 1 ); {
break; config->Read( OPTKEY_OUTPUT_FORMAT, &myFormatIndex );
}
m_PlotFormatOpt->SetSelection( myFormatIndex );
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;
}
}
// 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" ),
@ -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

@ -102,7 +102,6 @@ eda_global int g_PlotScaleOpt // 0 = automatique, >=1 echelle specifiee
= 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

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;

View File

@ -88,6 +88,7 @@ int tracevia = 1;
nb_plot_erreur = 0; nb_plot_erreur = 0;
int layer_mask = g_TabOneLayerMask[Layer]; int layer_mask = g_TabOneLayerMask[Layer];
// Specify that the contents of the "Edges Pcb" layer are also to be // Specify that the contents of the "Edges Pcb" layer are also to be
// plotted, unless the option of excluding that layer has been selected. // plotted, unless the option of excluding that layer has been selected.
if( !g_Exclude_Edges_Pcb ) if( !g_Exclude_Edges_Pcb )
@ -245,6 +246,7 @@ wxString msg;
break; break;
case PAD_OVAL: case PAD_OVAL:
// Check whether the pad really has a circular shape instead // Check whether the pad really has a circular shape instead
if( size.x == size.y ) if( size.x == size.y )
Plot_1_CIRCLE_pad_GERBER( pos, size.x ); Plot_1_CIRCLE_pad_GERBER( pos, size.x );
@ -265,10 +267,12 @@ wxString msg;
PlotRectangularPad_GERBER( pos, size, PtPad->m_Orient ); PlotRectangularPad_GERBER( pos, size, PtPad->m_Orient );
break; break;
} }
msg.Printf( wxT( "%d" ), nb_items ); msg.Printf( wxT( "%d" ), nb_items );
Affiche_1_Parametre( this, 48, wxEmptyString, msg, GREEN ); Affiche_1_Parametre( this, 48, wxEmptyString, msg, GREEN );
} }
} }
/* trace des VIAS : */ /* trace des VIAS : */
if( tracevia ) if( tracevia )
{ {
@ -279,6 +283,7 @@ wxString msg;
if( track->Type() != TYPEVIA ) if( track->Type() != TYPEVIA )
continue; continue;
SEGVIA* Via = (SEGVIA*) track; SEGVIA* Via = (SEGVIA*) track;
// vias not plotted if not on selected layer, but if layer // vias not plotted if not on selected layer, but if layer
// == SOLDERMASK_LAYER_CU or SOLDERMASK_LAYER_CMP, vias are drawn, // == SOLDERMASK_LAYER_CU or SOLDERMASK_LAYER_CMP, vias are drawn,
// if they are on a external copper layer // if they are on a external copper layer
@ -383,7 +388,6 @@ int x0, y0, x1, y1, delta;
sprintf( cbuf, "X%5.5dY%5.5dD03*\n", pos.x, pos.y ); sprintf( cbuf, "X%5.5dY%5.5dD03*\n", pos.x, pos.y );
fputs( cbuf, dest ); fputs( cbuf, dest );
} }
else /* Forme tracee comme un segment */ else /* Forme tracee comme un segment */
{ {
if( size.x > size.y ) if( size.x > size.y )
@ -416,6 +420,7 @@ void Plot_1_CIRCLE_pad_GERBER(wxPoint pos,int diametre)
*/ */
{ {
D_CODE* dcode_ptr; D_CODE* dcode_ptr;
wxSize size( diametre, diametre ); wxSize size( diametre, diametre );
UserToDeviceCoordinate( pos ); UserToDeviceCoordinate( pos );
@ -453,6 +458,7 @@ D_CODE * dcode_ptr;
case 900: case 900:
case 2700: /* la rotation de 90 ou 270 degres revient a permutter des dimensions */ case 2700: /* la rotation de 90 ou 270 degres revient a permutter des dimensions */
EXCHG( size.x, size.y ); EXCHG( size.x, size.y );
// Pass through // Pass through
case 0: case 0:
@ -611,7 +617,6 @@ int ddx, ddy;
PlotGERBERLine( polygone[2], polygone[3], scale_spot_mini ); PlotGERBERLine( polygone[2], polygone[3], scale_spot_mini );
PlotGERBERLine( polygone[3], polygone[0], scale_spot_mini ); PlotGERBERLine( polygone[3], polygone[0], scale_spot_mini );
} }
else else
PlotPolygon_GERBER( 4, coord, TRUE ); PlotPolygon_GERBER( 4, coord, TRUE );
} }
@ -724,10 +729,10 @@ int num_new_D_code = FIRST_DCODE_VALUE;
while( ptr_tool && ptr_tool->m_Type >= 0 ) while( ptr_tool && ptr_tool->m_Type >= 0 )
{ {
if( ( ptr_tool->m_Size.x == dx ) && if( ( ptr_tool->m_Size.x == dx )
( ptr_tool->m_Size.y == dy ) && && ( ptr_tool->m_Size.y == dy )
( ptr_tool->m_Type == type ) ) && ( ptr_tool->m_Type == type ) )
return(ptr_tool); /* D_code deja existant */ return ptr_tool; /* D_code deja existant */
last_dcode_ptr = ptr_tool; last_dcode_ptr = ptr_tool;
ptr_tool = ptr_tool->m_Pnext; ptr_tool = ptr_tool->m_Pnext;
num_new_D_code++; num_new_D_code++;
@ -737,6 +742,7 @@ int num_new_D_code = FIRST_DCODE_VALUE;
if( ptr_tool == NULL ) /* We must create a new data */ if( ptr_tool == NULL ) /* We must create a new data */
{ {
ptr_tool = new D_CODE(); ptr_tool = new D_CODE();
ptr_tool->m_NumDcode = num_new_D_code; ptr_tool->m_NumDcode = num_new_D_code;
if( last_dcode_ptr ) if( last_dcode_ptr )
{ {
@ -749,7 +755,7 @@ int num_new_D_code = FIRST_DCODE_VALUE;
ptr_tool->m_Size.x = dx; ptr_tool->m_Size.x = dx;
ptr_tool->m_Size.y = dy; ptr_tool->m_Size.y = dy;
ptr_tool->m_Type = type; ptr_tool->m_Type = type;
return(ptr_tool); return ptr_tool;
} }
@ -795,6 +801,7 @@ D_CODE * ptr_tool;
s_DCodeList->m_Type = -1; s_DCodeList->m_Type = -1;
ptr_tool = ptr_tool->m_Pnext; ptr_tool = ptr_tool->m_Pnext;
} }
ShowDcodeError = TRUE; ShowDcodeError = TRUE;
} }
@ -869,6 +876,7 @@ int nb_dcodes = 0 ;
char* text; char* text;
sprintf( cbuf, "%%ADD%d", ptr_tool->m_NumDcode ); sprintf( cbuf, "%%ADD%d", ptr_tool->m_NumDcode );
text = cbuf + strlen( cbuf ); text = cbuf + strlen( cbuf );
switch( ptr_tool->m_Type ) switch( ptr_tool->m_Type )
{ {
case 1: // Circle (flash ) case 1: // Circle (flash )
@ -893,6 +901,7 @@ int nb_dcodes = 0 ;
DisplayError( this, wxT( "Gen_D_CODE_File(): Dcode Type err" ) ); DisplayError( this, wxT( "Gen_D_CODE_File(): Dcode Type err" ) );
break; break;
} }
// compensation localisation printf (float x.y généré x,y) // compensation localisation printf (float x.y généré x,y)
to_point( text + 2 ); to_point( text + 2 );
@ -901,5 +910,5 @@ int nb_dcodes = 0 ;
nb_dcodes++; nb_dcodes++;
} }
return( nb_dcodes ); return nb_dcodes;
} }

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;

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;