code cleaning. Pcbnew: Minor enhancements in Plot dialog

This commit is contained in:
charras 2009-08-29 10:20:48 +00:00
parent 0a58e6303f
commit c3fde30419
30 changed files with 1079 additions and 960 deletions

View File

@ -13,6 +13,7 @@ set(COMMON_SRCS
bezier_curves.cpp bezier_curves.cpp
block_commande.cpp block_commande.cpp
class_marker_base.cpp class_marker_base.cpp
class_plotter.cpp
class_undoredo_container.cpp class_undoredo_container.cpp
common.cpp common.cpp
common_plot_functions.cpp common_plot_functions.cpp

439
common/class_plotter.cpp Normal file
View File

@ -0,0 +1,439 @@
/******************************************
* class_plotter.cpp
* the class PLOTTER handle basic functions to plot schematic and boards
* with different plot formats.
* currently formats are:*
* HPGL
* POSTSCRIPT
* GERBER
* DXF
******************************************/
#include "fctsys.h"
//#include "gr_basic.h"
#include "trigo.h"
#include "wxstruct.h"
#include "base_struct.h"
#include "common.h"
#include "plot_common.h"
#include "worksheet.h"
#include "macros.h"
#include "class_base_screen.h"
#include "drawtxt.h"
PLOTTER::PLOTTER( PlotFormat aPlotType )
{
m_PlotType = aPlotType;
plot_scale = 1;
default_pen_width = 0;
current_pen_width = -1; /* To-be-set marker */
pen_state = 'Z'; /* End-of-path idle */
plot_orient_options = 0; /* Mirror flag */
output_file = 0;
color_mode = false; /* Start as a BW plot */
negative_mode = false;
sheet = NULL;
}
/********************************************************/
void PLOTTER::user_to_device_coordinates( wxPoint& pos )
/********************************************************/
/* 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 - plot_offset.x) * plot_scale * device_scale );
if( plot_orient_options == PLOT_MIROIR )
pos.y = (int) ( (pos.y - plot_offset.y) * plot_scale * device_scale );
else
pos.y = (int) ( (paper_size.y - (pos.y - plot_offset.y) * plot_scale) * device_scale );
}
/********************************************************************/
void PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int rayon,
FILL_T fill, int width )
/********************************************************************/
/* Generic arc rendered as a polyline */
{
wxPoint start, end;
const int delta = 50; /* increment (in 0.1 degrees) to draw circles */
double alpha;
if( StAngle > EndAngle )
EXCHG( StAngle, EndAngle );
set_current_line_width( width );
/* Please NOTE the different sign due to Y-axis flip */
alpha = StAngle / 1800.0 * M_PI;
start.x = centre.x + (int) ( rayon * cos( -alpha ) );
start.y = centre.y + (int) ( rayon * sin( -alpha ) );
move_to( start );
for( int ii = StAngle + delta; ii < EndAngle; ii += delta )
{
alpha = ii / 1800.0 * M_PI;
end.x = centre.x + (int) ( rayon * cos( -alpha ) );
end.y = centre.y + (int) ( rayon * sin( -alpha ) );
line_to( end );
}
alpha = EndAngle / 1800.0 * M_PI;
end.x = centre.x + (int) ( rayon * cos( -alpha ) );
end.y = centre.y + (int) ( rayon * sin( -alpha ) );
finish_to( end );
}
/************************************/
void PLOTTER::user_to_device_size( wxSize& size )
/************************************/
/* modifie les dimension size.x et size.y pour le trace selon l'echelle */
{
size.x = (int) ( size.x * plot_scale * device_scale );
size.y = (int) ( size.y * plot_scale * device_scale );
}
/************************************/
double PLOTTER::user_to_device_size( double size )
/************************************/
{
return size * plot_scale * device_scale;
}
/************************************************************************************/
void PLOTTER::center_square( const wxPoint& position, int diametre, FILL_T fill )
/************************************************************************************/
{
int rayon = diametre / 2.8284;
int coord[10] =
{
position.x + rayon, position.y + rayon,
position.x + rayon, position.y - rayon,
position.x - rayon, position.y - rayon,
position.x - rayon, position.y + rayon,
position.x + rayon, position.y + rayon
};
if( fill )
{
poly( 4, coord, fill );
}
else
{
poly( 5, coord, fill );
}
}
/************************************************************************************/
void PLOTTER::center_lozenge( const wxPoint& position, int diametre, FILL_T fill )
/************************************************************************************/
{
int rayon = diametre / 2;
int coord[10] =
{
position.x, position.y + rayon,
position.x + rayon, position.y,
position.x, position.y - rayon,
position.x - rayon, position.y,
position.x, position.y + rayon,
};
if( fill )
{
poly( 4, coord, fill );
}
else
{
poly( 5, coord, fill );
}
}
/************************************************************************************/
void PLOTTER::marker( const wxPoint& position, int diametre, int aShapeId )
/************************************************************************************/
/* Trace un motif de numero de forme aShapeId, aux coord x0, y0.
* x0, y0 = coordonnees tables
* diametre = diametre (coord table) du trou
* aShapeId = index ( permet de generer des formes caract )
*/
{
int rayon = diametre / 2;
int x0, y0;
x0 = position.x; y0 = position.y;
switch( aShapeId )
{
case 0: /* vias : forme en X */
move_to( wxPoint( x0 - rayon, y0 - rayon ) );
line_to( wxPoint( x0 + rayon, y0 + rayon ) );
move_to( wxPoint( x0 + rayon, y0 - rayon ) );
finish_to( wxPoint( x0 - rayon, y0 + rayon ) );
break;
case 1: /* Cercle */
circle( position, diametre, NO_FILL );
break;
case 2: /* forme en + */
move_to( wxPoint( x0, y0 - rayon ) );
line_to( wxPoint( x0, y0 + rayon ) );
move_to( wxPoint( x0 + rayon, y0 ) );
finish_to( wxPoint( x0 - rayon, y0 ) );
break;
case 3: /* forme en X cercle */
circle( position, diametre, NO_FILL );
move_to( wxPoint( x0 - rayon, y0 - rayon ) );
line_to( wxPoint( x0 + rayon, y0 + rayon ) );
move_to( wxPoint( x0 + rayon, y0 - rayon ) );
finish_to( wxPoint( x0 - rayon, y0 + rayon ) );
break;
case 4: /* forme en cercle barre de - */
circle( position, diametre, NO_FILL );
move_to( wxPoint( x0 - rayon, y0 ) );
finish_to( wxPoint( x0 + rayon, y0 ) );
break;
case 5: /* forme en cercle barre de | */
circle( position, diametre, NO_FILL );
move_to( wxPoint( x0, y0 - rayon ) );
finish_to( wxPoint( x0, y0 + rayon ) );
break;
case 6: /* forme en carre */
center_square( position, diametre, NO_FILL );
break;
case 7: /* forme en losange */
center_lozenge( position, diametre, NO_FILL );
break;
case 8: /* forme en carre barre par un X*/
center_square( position, diametre, NO_FILL );
move_to( wxPoint( x0 - rayon, y0 - rayon ) );
line_to( wxPoint( x0 + rayon, y0 + rayon ) );
move_to( wxPoint( x0 + rayon, y0 - rayon ) );
finish_to( wxPoint( x0 - rayon, y0 + rayon ) );
break;
case 9: /* forme en losange barre par un +*/
center_lozenge( position, diametre, NO_FILL );
move_to( wxPoint( x0, y0 - rayon ) );
line_to( wxPoint( x0, y0 + rayon ) );
move_to( wxPoint( x0 + rayon, y0 ) );
finish_to( wxPoint( x0 - rayon, y0 ) );
break;
case 10: /* forme en carre barre par un '/' */
center_square( position, diametre, NO_FILL );
move_to( wxPoint( x0 - rayon, y0 - rayon ) );
finish_to( wxPoint( x0 + rayon, y0 + rayon ) );
break;
case 11: /* forme en losange barre par un |*/
center_lozenge( position, diametre, NO_FILL );
move_to( wxPoint( x0, y0 - rayon ) );
finish_to( wxPoint( x0, y0 + rayon ) );
break;
case 12: /* forme en losange barre par un -*/
center_lozenge( position, diametre, NO_FILL );
move_to( wxPoint( x0 - rayon, y0 ) );
finish_to( wxPoint( x0 + rayon, y0 ) );
break;
default:
circle( position, diametre, NO_FILL );
break;
}
}
/***************************************************************/
void PLOTTER::segment_as_oval( wxPoint start, wxPoint end, int width,
GRTraceMode tracemode )
/***************************************************************/
{
/* Convert a thick segment and plot it as an oval */
wxPoint center( (start.x + end.x) / 2, (start.y + end.y) / 2 );
wxSize size( end.x - start.x, end.y - start.y );
int orient;
if( size.y == 0 )
orient = 0;
else if( size.x == 0 )
orient = 900;
else
orient = -(int) ( atan2( (double) size.y, (double) size.x ) * 1800.0 / M_PI );
size.x = (int) sqrt( ( (double) size.x * size.x ) + ( (double) size.y * size.y ) ) + width;
size.y = width;
flash_pad_oval( center, size, orient, tracemode );
}
/***************************************************************/
void PLOTTER::sketch_oval( wxPoint pos, wxSize size, int orient,
int width )
/***************************************************************/
{
set_current_line_width( width );
width = current_pen_width;
int rayon, deltaxy, cx, cy;
if( size.x > size.y )
{
EXCHG( size.x, size.y ); orient += 900;
if( orient >= 3600 )
orient -= 3600;
}
deltaxy = size.y - size.x; /* = distance entre centres de l'ovale */
rayon = (size.x - width) / 2;
cx = -rayon; cy = -deltaxy / 2;
RotatePoint( &cx, &cy, orient );
move_to( wxPoint( cx + pos.x, cy + pos.y ) );
cx = -rayon; cy = deltaxy / 2;
RotatePoint( &cx, &cy, orient );
finish_to( wxPoint( cx + pos.x, cy + pos.y ) );
cx = rayon; cy = -deltaxy / 2;
RotatePoint( &cx, &cy, orient );
move_to( wxPoint( cx + pos.x, cy + pos.y ) );
cx = rayon; cy = deltaxy / 2;
RotatePoint( &cx, &cy, orient );
finish_to( wxPoint( cx + pos.x, cy + pos.y ) );
cx = 0; cy = deltaxy / 2;
RotatePoint( &cx, &cy, orient );
arc( wxPoint( cx + pos.x, cy + pos.y ),
orient + 1800, orient + 3600,
rayon, NO_FILL );
cx = 0; cy = -deltaxy / 2;
RotatePoint( &cx, &cy, orient );
arc( wxPoint( cx + pos.x, cy + pos.y ),
orient, orient + 1800,
rayon, NO_FILL );
}
/***************************************************************/
void PLOTTER::thick_segment( wxPoint start, wxPoint end, int width,
GRTraceMode tracemode )
/***************************************************************/
/* Plot 1 segment like a track segment
*/
{
switch( tracemode )
{
case FILLED:
case FILAIRE:
set_current_line_width( tracemode==FILLED ? width : -1 );
move_to( start );
finish_to( end );
break;
case SKETCH:
set_current_line_width( -1 );
segment_as_oval( start, end, width, tracemode );
break;
}
}
void PLOTTER::thick_arc( wxPoint centre, int StAngle, int EndAngle, int rayon,
int width, GRTraceMode tracemode )
{
switch( tracemode )
{
case FILAIRE:
set_current_line_width( -1 );
arc( centre, StAngle, EndAngle, rayon, NO_FILL, -1 );
break;
case FILLED:
arc( centre, StAngle, EndAngle, rayon, NO_FILL, width );
break;
case SKETCH:
set_current_line_width( -1 );
arc( centre, StAngle, EndAngle, rayon - (width - current_pen_width) / 2, NO_FILL, -1 );
arc( centre, StAngle, EndAngle, rayon + (width - current_pen_width) / 2, NO_FILL, -1 );
break;
}
}
void PLOTTER::thick_rect( wxPoint p1, wxPoint p2, int width,
GRTraceMode tracemode )
{
switch( tracemode )
{
case FILAIRE:
rect( p1, p2, NO_FILL, -1 );
break;
case FILLED:
rect( p1, p2, NO_FILL, width );
break;
case SKETCH:
set_current_line_width( -1 );
p1.x -= (width - current_pen_width) / 2;
p1.y -= (width - current_pen_width) / 2;
p2.x += (width - current_pen_width) / 2;
p2.y += (width - current_pen_width) / 2;
rect( p1, p2, NO_FILL, -1 );
p1.x += (width - current_pen_width);
p1.y += (width - current_pen_width);
p2.x -= (width - current_pen_width);
p2.y -= (width - current_pen_width);
rect( p1, p2, NO_FILL, -1 );
break;
}
}
void PLOTTER::thick_circle( wxPoint pos, int diametre, int width,
GRTraceMode tracemode )
{
switch( tracemode )
{
case FILAIRE:
circle( pos, diametre, NO_FILL, -1 );
break;
case FILLED:
circle( pos, diametre, NO_FILL, width );
break;
case SKETCH:
set_current_line_width( -1 );
circle( pos, diametre - width + current_pen_width, NO_FILL, -1 );
circle( pos, diametre + width - current_pen_width, NO_FILL, -1 );
break;
}
}
/*************************************************************************************/
void PLOTTER::set_paper_size( Ki_PageDescr* asheet )
/*************************************************************************************/
{
wxASSERT( !output_file );
sheet = asheet;
// Sheets are in mils, plotter works with decimils
paper_size.x = sheet->m_Size.x * 10;
paper_size.y = sheet->m_Size.y * 10;
}

View File

@ -12,7 +12,7 @@
#include "kicad_string.h" #include "kicad_string.h"
/***********************************************************************************/ /***********************************************************************************/
void DXF_Plotter::set_viewport( wxPoint offset, void DXF_PLOTTER::set_viewport( wxPoint offset,
double aScale, int orient ) double aScale, int orient )
/***********************************************************************************/ /***********************************************************************************/
@ -30,7 +30,7 @@ void DXF_Plotter::set_viewport( wxPoint offset,
/*****************************************************************/ /*****************************************************************/
void DXF_Plotter::start_plot( FILE* fout ) void DXF_PLOTTER::start_plot( FILE* fout )
/*****************************************************************/ /*****************************************************************/
{ {
wxASSERT( !output_file ); wxASSERT( !output_file );
@ -54,7 +54,7 @@ void DXF_Plotter::start_plot( FILE* fout )
/**********************************/ /**********************************/
void DXF_Plotter::end_plot() void DXF_PLOTTER::end_plot()
/**********************************/ /**********************************/
{ {
wxASSERT( output_file ); wxASSERT( output_file );
@ -66,7 +66,7 @@ void DXF_Plotter::end_plot()
/******************************/ /******************************/
void DXF_Plotter::set_color( int color ) void DXF_PLOTTER::set_color( int color )
/******************************/ /******************************/
/* /*
@ -84,7 +84,7 @@ void DXF_Plotter::set_color( int color )
/************************************************************/ /************************************************************/
void DXF_Plotter::rect( wxPoint p1, wxPoint p2, FILL_T fill, int width ) void DXF_PLOTTER::rect( wxPoint p1, wxPoint p2, FILL_T fill, int width )
/************************************************************/ /************************************************************/
{ {
wxASSERT( output_file ); wxASSERT( output_file );
@ -97,7 +97,7 @@ void DXF_Plotter::rect( wxPoint p1, wxPoint p2, FILL_T fill, int width )
/************************************************************/ /************************************************************/
void DXF_Plotter::circle( wxPoint centre, int diameter, FILL_T fill, int width ) void DXF_PLOTTER::circle( wxPoint centre, int diameter, FILL_T fill, int width )
/************************************************************/ /************************************************************/
{ {
wxASSERT( output_file ); wxASSERT( output_file );
@ -114,7 +114,7 @@ void DXF_Plotter::circle( wxPoint centre, int diameter, FILL_T fill, int width )
/*****************************************************/ /*****************************************************/
void DXF_Plotter::poly( int nb, int* coord, FILL_T fill, int width ) void DXF_PLOTTER::poly( int nb, int* coord, FILL_T fill, int width )
/*****************************************************/ /*****************************************************/
/* Trace un polygone (ferme si rempli) en format DXF /* Trace un polygone (ferme si rempli) en format DXF
@ -143,7 +143,7 @@ void DXF_Plotter::poly( int nb, int* coord, FILL_T fill, int width )
/**********************************************/ /**********************************************/
void DXF_Plotter::pen_to( wxPoint pos, char plume ) void DXF_PLOTTER::pen_to( wxPoint pos, char plume )
/**********************************************/ /**********************************************/
/* /*
@ -172,14 +172,14 @@ void DXF_Plotter::pen_to( wxPoint pos, char plume )
} }
void DXF_Plotter::set_dash( bool dashed ) void DXF_PLOTTER::set_dash( bool dashed )
{ {
/* NOP for now */ /* NOP for now */
wxASSERT( output_file ); wxASSERT( output_file );
} }
void DXF_Plotter::thick_segment( wxPoint start, wxPoint end, int width, void DXF_PLOTTER::thick_segment( wxPoint start, wxPoint end, int width,
GRTraceMode tracemode ) GRTraceMode tracemode )
/** Function Plot a filled segment (track) /** Function Plot a filled segment (track)
@ -202,7 +202,7 @@ void DXF_Plotter::thick_segment( wxPoint start, wxPoint end, int width,
/********************************************************************/ /********************************************************************/
void DXF_Plotter::arc( wxPoint centre, int StAngle, int EndAngle, int rayon, void DXF_PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int rayon,
FILL_T fill, int width ) FILL_T fill, int width )
/********************************************************************/ /********************************************************************/
@ -230,7 +230,7 @@ void DXF_Plotter::arc( wxPoint centre, int StAngle, int EndAngle, int rayon,
/***********************************************************************************/ /***********************************************************************************/
void DXF_Plotter::flash_pad_oval( wxPoint pos, wxSize size, int orient, void DXF_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/************************************************************************************/ /************************************************************************************/
/* Trace 1 pastille PAD_OVAL en position pos_X,Y , de dim size.x, size.y */ /* Trace 1 pastille PAD_OVAL en position pos_X,Y , de dim size.x, size.y */
@ -250,7 +250,7 @@ void DXF_Plotter::flash_pad_oval( wxPoint pos, wxSize size, int orient,
/*******************************************************************************/ /*******************************************************************************/
void DXF_Plotter::flash_pad_circle( wxPoint pos, int diametre, void DXF_PLOTTER::flash_pad_circle( wxPoint pos, int diametre,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/*******************************************************************************/ /*******************************************************************************/
/* Trace 1 pastille RONDE (via,pad rond) en position pos */ /* Trace 1 pastille RONDE (via,pad rond) en position pos */
@ -261,7 +261,7 @@ void DXF_Plotter::flash_pad_circle( wxPoint pos, int diametre,
/**************************************************************************/ /**************************************************************************/
void DXF_Plotter::flash_pad_rect( wxPoint pos, wxSize padsize, void DXF_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize,
int orient, GRTraceMode trace_mode ) int orient, GRTraceMode trace_mode )
/**************************************************************************/ /**************************************************************************/
@ -325,7 +325,7 @@ void DXF_Plotter::flash_pad_rect( wxPoint pos, wxSize padsize,
/*******************************************************************/ /*******************************************************************/
void DXF_Plotter::flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta, void DXF_PLOTTER::flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta,
int orient, GRTraceMode trace_mode ) int orient, GRTraceMode trace_mode )
/*******************************************************************/ /*******************************************************************/

View File

@ -14,7 +14,7 @@
/***************************************************************************/ /***************************************************************************/
void Gerber_Plotter::set_viewport( wxPoint offset, void GERBER_PLOTTER::set_viewport( wxPoint offset,
double aScale, int orient ) double aScale, int orient )
/***************************************************************************/ /***************************************************************************/
@ -36,7 +36,7 @@ void Gerber_Plotter::set_viewport( wxPoint offset,
/******************************************************************/ /******************************************************************/
void Gerber_Plotter::start_plot( FILE* aFile ) void GERBER_PLOTTER::start_plot( FILE* aFile )
/*****************************************************************/ /*****************************************************************/
/** Function start_plot /** Function start_plot
@ -70,7 +70,7 @@ void Gerber_Plotter::start_plot( FILE* aFile )
/******************************************************************/ /******************************************************************/
void Gerber_Plotter::end_plot() void GERBER_PLOTTER::end_plot()
/*****************************************************************/ /*****************************************************************/
{ {
char line[1024]; char line[1024];
@ -102,7 +102,7 @@ void Gerber_Plotter::end_plot()
/*************************************************************************************/ /*************************************************************************************/
void Gerber_Plotter::set_default_line_width( int width ) void GERBER_PLOTTER::set_default_line_width( 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
@ -114,7 +114,7 @@ void Gerber_Plotter::set_default_line_width( int width )
/***************************************/ /***************************************/
void Gerber_Plotter::set_current_line_width( int width ) void GERBER_PLOTTER::set_current_line_width( 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
@ -127,20 +127,20 @@ void Gerber_Plotter::set_current_line_width( int width )
else else
pen_width = default_pen_width; pen_width = default_pen_width;
select_aperture( wxSize( pen_width, pen_width ), Aperture::Plotting ); select_aperture( wxSize( pen_width, pen_width ), APERTURE::Plotting );
current_pen_width = pen_width; current_pen_width = pen_width;
} }
/******************************************************/ /******************************************************/
vector<Aperture>::iterator Gerber_Plotter::get_aperture( const wxSize& size, std::vector<APERTURE>::iterator GERBER_PLOTTER::get_aperture( const wxSize& size,
Aperture::Aperture_Type type ) APERTURE::Aperture_Type type )
/******************************************************/ /******************************************************/
{ {
int last_D_code = 9; int last_D_code = 9;
// Search an existing aperture // Search an existing aperture
vector<Aperture>::iterator tool = apertures.begin(); std::vector<APERTURE>::iterator tool = apertures.begin();
while( tool != apertures.end() ) while( tool != apertures.end() )
{ {
last_D_code = tool->D_code; last_D_code = tool->D_code;
@ -151,7 +151,7 @@ vector<Aperture>::iterator Gerber_Plotter::get_aperture( const wxSize&
} }
// Allocate a new aperture // Allocate a new aperture
Aperture new_tool; APERTURE new_tool;
new_tool.size = size; new_tool.size = size;
new_tool.type = type; new_tool.type = type;
new_tool.D_code = last_D_code + 1; new_tool.D_code = last_D_code + 1;
@ -161,7 +161,7 @@ vector<Aperture>::iterator Gerber_Plotter::get_aperture( const wxSize&
/******************************************************/ /******************************************************/
void Gerber_Plotter::select_aperture( const wxSize& size, Aperture::Aperture_Type type ) void GERBER_PLOTTER::select_aperture( const wxSize& size, APERTURE::Aperture_Type type )
/******************************************************/ /******************************************************/
{ {
wxASSERT( output_file ); wxASSERT( output_file );
@ -177,7 +177,7 @@ void Gerber_Plotter::select_aperture( const wxSize& size, Aperture::Aperture_Typ
/******************************************************/ /******************************************************/
void Gerber_Plotter::write_aperture_list() void GERBER_PLOTTER::write_aperture_list()
/******************************************************/ /******************************************************/
/* Genere la liste courante des D_CODES /* Genere la liste courante des D_CODES
@ -189,7 +189,7 @@ void Gerber_Plotter::write_aperture_list()
char cbuf[1024]; char cbuf[1024];
/* Init : */ /* Init : */
for( vector<Aperture>::iterator tool = apertures.begin(); for( std::vector<APERTURE>::iterator tool = apertures.begin();
tool != apertures.end(); tool++ ) tool != apertures.end(); tool++ )
{ {
const float fscale = 0.0001f * plot_scale; // For 3.4 format const float fscale = 0.0001f * plot_scale; // For 3.4 format
@ -199,20 +199,20 @@ void Gerber_Plotter::write_aperture_list()
switch( tool->type ) switch( tool->type )
{ {
case Aperture::Circle: case APERTURE::Circle:
sprintf( text, "C,%f*%%\n", tool->size.x * fscale ); sprintf( text, "C,%f*%%\n", tool->size.x * fscale );
break; break;
case Aperture::Rect: case APERTURE::Rect:
sprintf( text, "R,%fX%f*%%\n", tool->size.x * fscale, sprintf( text, "R,%fX%f*%%\n", tool->size.x * fscale,
tool->size.y * fscale ); tool->size.y * fscale );
break; break;
case Aperture::Plotting: case APERTURE::Plotting:
sprintf( text, "C,%f*%%\n", tool->size.x * fscale ); sprintf( text, "C,%f*%%\n", tool->size.x * fscale );
break; break;
case Aperture::Oval: case APERTURE::Oval:
sprintf( text, "O,%fX%f*%%\n", tool->size.x * fscale, sprintf( text, "O,%fX%f*%%\n", tool->size.x * fscale,
tool->size.y * fscale ); tool->size.y * fscale );
break; break;
@ -224,7 +224,7 @@ void Gerber_Plotter::write_aperture_list()
/**********************************************/ /**********************************************/
void Gerber_Plotter::pen_to( wxPoint aPos, char plume ) void GERBER_PLOTTER::pen_to( wxPoint aPos, char plume )
{ {
wxASSERT( output_file ); wxASSERT( output_file );
user_to_device_coordinates( aPos ); user_to_device_coordinates( aPos );
@ -247,7 +247,7 @@ void Gerber_Plotter::pen_to( wxPoint aPos, char plume )
/**************************************************************************/ /**************************************************************************/
void Gerber_Plotter::rect( wxPoint p1, wxPoint p2, FILL_T fill, int width ) void GERBER_PLOTTER::rect( wxPoint p1, wxPoint p2, FILL_T fill, int width )
/**************************************************************************/ /**************************************************************************/
{ {
wxASSERT( output_file ); wxASSERT( output_file );
@ -264,7 +264,7 @@ void Gerber_Plotter::rect( wxPoint p1, wxPoint p2, FILL_T fill, int width )
/*************************************************************************************/ /*************************************************************************************/
void Gerber_Plotter::circle( wxPoint aCentre, int aDiameter, FILL_T fill, int aWidth ) void GERBER_PLOTTER::circle( wxPoint aCentre, int aDiameter, FILL_T fill, int aWidth )
/*************************************************************************************/ /*************************************************************************************/
/** Function circle /** Function circle
@ -296,7 +296,7 @@ void Gerber_Plotter::circle( wxPoint aCentre, int aDiameter, FILL_T fill, int aW
/***************************************************************/ /***************************************************************/
void Gerber_Plotter::poly( int aCornersCount, int* aCoord, FILL_T aFill, int aWidth ) void GERBER_PLOTTER::poly( int aCornersCount, int* aCoord, FILL_T aFill, int aWidth )
/***************************************************************/ /***************************************************************/
/** Function PlotFilledPolygon_GERBER /** Function PlotFilledPolygon_GERBER
@ -338,7 +338,7 @@ void Gerber_Plotter::poly( int aCornersCount, int* aCoord, FILL_T aFill, int aWi
/* Function flash_pad_circle /* Function flash_pad_circle
* Plot a circular pad or via at the user position pos * Plot a circular pad or via at the user position pos
*/ */
void Gerber_Plotter::flash_pad_circle( wxPoint pos, int diametre, void GERBER_PLOTTER::flash_pad_circle( wxPoint pos, int diametre,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
{ {
wxASSERT( output_file ); wxASSERT( output_file );
@ -354,14 +354,14 @@ void Gerber_Plotter::flash_pad_circle( wxPoint pos, int diametre,
case FILLED: case FILLED:
user_to_device_coordinates( pos ); user_to_device_coordinates( pos );
select_aperture( size, Aperture::Circle ); select_aperture( size, APERTURE::Circle );
fprintf( output_file, "X%5.5dY%5.5dD03*\n", pos.x, pos.y ); fprintf( output_file, "X%5.5dY%5.5dD03*\n", pos.x, pos.y );
break; break;
} }
} }
void Gerber_Plotter::flash_pad_oval( wxPoint pos, wxSize size, int orient, void GERBER_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/* Trace 1 pastille PAD_OVAL en position pos_X,Y: /* Trace 1 pastille PAD_OVAL en position pos_X,Y:
@ -381,7 +381,7 @@ void Gerber_Plotter::flash_pad_oval( wxPoint pos, wxSize size, int orient,
if( orient == 900 || orient == 2700 ) /* orient tournee de 90 deg */ if( orient == 900 || orient == 2700 ) /* orient tournee de 90 deg */
EXCHG( size.x, size.y ); EXCHG( size.x, size.y );
user_to_device_coordinates( pos ); user_to_device_coordinates( pos );
select_aperture( size, Aperture::Oval ); select_aperture( size, APERTURE::Oval );
fprintf( output_file, "X%5.5dY%5.5dD03*\n", pos.x, pos.y ); fprintf( output_file, "X%5.5dY%5.5dD03*\n", pos.x, pos.y );
} }
else /* Forme tracee comme un segment */ else /* Forme tracee comme un segment */
@ -414,7 +414,7 @@ void Gerber_Plotter::flash_pad_oval( wxPoint pos, wxSize size, int orient,
} }
void Gerber_Plotter::flash_pad_rect( wxPoint pos, wxSize size, void GERBER_PLOTTER::flash_pad_rect( wxPoint pos, wxSize size,
int orient, GRTraceMode trace_mode ) int orient, GRTraceMode trace_mode )
/* Plot 1 rectangular pad /* Plot 1 rectangular pad
@ -449,7 +449,7 @@ void Gerber_Plotter::flash_pad_rect( wxPoint pos, wxSize size,
case FILLED: case FILLED:
user_to_device_coordinates( pos ); user_to_device_coordinates( pos );
select_aperture( size, Aperture::Rect ); select_aperture( size, APERTURE::Rect );
fprintf( output_file, "X%5.5dY%5.5dD03*\n", pos.x, pos.y ); fprintf( output_file, "X%5.5dY%5.5dD03*\n", pos.x, pos.y );
break; break;
} }
@ -463,7 +463,7 @@ void Gerber_Plotter::flash_pad_rect( wxPoint pos, wxSize size,
} }
void Gerber_Plotter::flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta, void GERBER_PLOTTER::flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta,
int orient, GRTraceMode trace_mode ) int orient, GRTraceMode trace_mode )
/* Trace 1 pad trapezoidal donne par : /* Trace 1 pad trapezoidal donne par :

View File

@ -15,8 +15,7 @@
const double SCALE_HPGL = 0.102041; const double SCALE_HPGL = 0.102041;
/***********************************************************************************/ /***********************************************************************************/
void HPGL_Plotter::set_viewport( wxPoint offset, void HPGL_PLOTTER::set_viewport( wxPoint offset, double aScale, int orient )
double aScale, int orient )
/***********************************************************************************/ /***********************************************************************************/
/* Set the plot offset for the current plotting /* Set the plot offset for the current plotting
@ -31,7 +30,7 @@ void HPGL_Plotter::set_viewport( wxPoint offset,
} }
/*****************************************************************/ /*****************************************************************/
void HPGL_Plotter::start_plot( FILE *fout ) void HPGL_PLOTTER::start_plot( FILE *fout )
/*****************************************************************/ /*****************************************************************/
{ {
wxASSERT(!output_file); wxASSERT(!output_file);
@ -40,7 +39,7 @@ void HPGL_Plotter::start_plot( FILE *fout )
} }
/**********************************/ /**********************************/
void HPGL_Plotter::end_plot() void HPGL_PLOTTER::end_plot()
/**********************************/ /**********************************/
{ {
wxASSERT(output_file); wxASSERT(output_file);
@ -50,7 +49,7 @@ void HPGL_Plotter::end_plot()
} }
/************************************************************/ /************************************************************/
void HPGL_Plotter::rect( wxPoint p1, wxPoint p2, FILL_T fill, int width ) void HPGL_PLOTTER::rect( wxPoint p1, wxPoint p2, FILL_T fill, int width )
/************************************************************/ /************************************************************/
{ {
wxASSERT(output_file); wxASSERT(output_file);
@ -61,7 +60,7 @@ void HPGL_Plotter::rect( wxPoint p1, wxPoint p2, FILL_T fill, int width )
} }
/************************************************************/ /************************************************************/
void HPGL_Plotter::circle( wxPoint centre, int diameter, FILL_T fill, int width ) void HPGL_PLOTTER::circle( wxPoint centre, int diameter, FILL_T fill, int width )
/************************************************************/ /************************************************************/
{ {
wxASSERT(output_file); wxASSERT(output_file);
@ -76,7 +75,7 @@ void HPGL_Plotter::circle( wxPoint centre, int diameter, FILL_T fill, int width
} }
/*****************************************************/ /*****************************************************/
void HPGL_Plotter::poly( int nb, int* coord, FILL_T fill, int width ) void HPGL_PLOTTER::poly( int nb, int* coord, FILL_T fill, int width )
/*****************************************************/ /*****************************************************/
/* Trace un polygone (ferme si rempli) en format HPGL /* Trace un polygone (ferme si rempli) en format HPGL
@ -104,7 +103,7 @@ void HPGL_Plotter::poly( int nb, int* coord, FILL_T fill, int width )
} }
/***************************/ /***************************/
void HPGL_Plotter::pen_control( int plume ) void HPGL_PLOTTER::pen_control( int plume )
/***************************/ /***************************/
/* leve (plume = 'U') ou baisse (plume = 'D') la plume /* leve (plume = 'U') ou baisse (plume = 'D') la plume
@ -136,7 +135,7 @@ void HPGL_Plotter::pen_control( int plume )
} }
/**********************************************/ /**********************************************/
void HPGL_Plotter::pen_to( wxPoint pos, char plume ) void HPGL_PLOTTER::pen_to( wxPoint pos, char plume )
/**********************************************/ /**********************************************/
/* /*
@ -160,7 +159,7 @@ void HPGL_Plotter::pen_to( wxPoint pos, char plume )
pen_lastpos = pos; pen_lastpos = pos;
} }
void HPGL_Plotter::set_dash( bool dashed ) void HPGL_PLOTTER::set_dash( bool dashed )
{ {
wxASSERT(output_file); wxASSERT(output_file);
if (dashed) if (dashed)
@ -169,7 +168,7 @@ void HPGL_Plotter::set_dash( bool dashed )
fputs("LI;\n", stderr); fputs("LI;\n", stderr);
} }
void HPGL_Plotter::thick_segment( wxPoint start, wxPoint end, int width, void HPGL_PLOTTER::thick_segment( wxPoint start, wxPoint end, int width,
GRTraceMode tracemode) GRTraceMode tracemode)
/** Function Plot a filled segment (track) /** Function Plot a filled segment (track)
* @param start = starting point * @param start = starting point
@ -192,7 +191,7 @@ void HPGL_Plotter::thick_segment( wxPoint start, wxPoint end, int width,
} }
/********************************************************************/ /********************************************************************/
void HPGL_Plotter::arc( wxPoint centre, int StAngle, int EndAngle, int rayon, void HPGL_PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int rayon,
FILL_T fill, int width ) FILL_T fill, int width )
/********************************************************************/ /********************************************************************/
@ -232,7 +231,7 @@ void HPGL_Plotter::arc( wxPoint centre, int StAngle, int EndAngle, int rayon,
} }
/***********************************************************************************/ /***********************************************************************************/
void HPGL_Plotter::flash_pad_oval( wxPoint pos, wxSize size, int orient, void HPGL_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/************************************************************************************/ /************************************************************************************/
/* Trace 1 pastille PAD_OVAL en position pos_X,Y , de dim size.x, size.y */ /* Trace 1 pastille PAD_OVAL en position pos_X,Y , de dim size.x, size.y */
@ -268,7 +267,7 @@ void HPGL_Plotter::flash_pad_oval( wxPoint pos, wxSize size, int orient,
} }
/*******************************************************************************/ /*******************************************************************************/
void HPGL_Plotter::flash_pad_circle(wxPoint pos, int diametre, void HPGL_PLOTTER::flash_pad_circle(wxPoint pos, int diametre,
GRTraceMode trace_mode) GRTraceMode trace_mode)
/*******************************************************************************/ /*******************************************************************************/
/* Trace 1 pastille RONDE (via,pad rond) en position pos */ /* Trace 1 pastille RONDE (via,pad rond) en position pos */
@ -311,7 +310,7 @@ void HPGL_Plotter::flash_pad_circle(wxPoint pos, int diametre,
} }
/**************************************************************************/ /**************************************************************************/
void HPGL_Plotter::flash_pad_rect(wxPoint pos, wxSize padsize, void HPGL_PLOTTER::flash_pad_rect(wxPoint pos, wxSize padsize,
int orient, GRTraceMode trace_mode) int orient, GRTraceMode trace_mode)
/**************************************************************************/ /**************************************************************************/
/* /*
@ -412,7 +411,7 @@ void HPGL_Plotter::flash_pad_rect(wxPoint pos, wxSize padsize,
} }
/*******************************************************************/ /*******************************************************************/
void HPGL_Plotter::flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta, void HPGL_PLOTTER::flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta,
int orient, GRTraceMode trace_mode ) int orient, GRTraceMode trace_mode )
/*******************************************************************/ /*******************************************************************/
/* /*

View File

@ -12,7 +12,7 @@
#include "kicad_string.h" #include "kicad_string.h"
/*************************************************************************************/ /*************************************************************************************/
void PS_Plotter::set_viewport( wxPoint offset, void PS_PLOTTER::set_viewport( wxPoint offset,
double aScale, int orient ) double aScale, int orient )
/*************************************************************************************/ /*************************************************************************************/
@ -27,7 +27,7 @@ void PS_Plotter::set_viewport( wxPoint offset,
} }
/*************************************************************************************/ /*************************************************************************************/
void PS_Plotter::set_default_line_width( int width ) void PS_PLOTTER::set_default_line_width( 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
@ -38,7 +38,7 @@ void PS_Plotter::set_default_line_width( int width )
} }
/***************************************/ /***************************************/
void PS_Plotter::set_current_line_width( int width ) void PS_PLOTTER::set_current_line_width( 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
@ -61,7 +61,7 @@ void PS_Plotter::set_current_line_width( int width )
/******************************/ /******************************/
void PS_Plotter::set_color( int color ) void PS_PLOTTER::set_color( int color )
/******************************/ /******************************/
/* Print the postscript set color command: /* Print the postscript set color command:
@ -114,7 +114,7 @@ void PS_Plotter::set_color( int color )
} }
} }
void PS_Plotter::set_dash( bool dashed ) void PS_PLOTTER::set_dash( bool dashed )
{ {
wxASSERT(output_file); wxASSERT(output_file);
if (dashed) if (dashed)
@ -124,7 +124,7 @@ void PS_Plotter::set_dash( bool dashed )
} }
/***************************************************************/ /***************************************************************/
void PS_Plotter::rect( wxPoint p1, wxPoint p2, FILL_T fill, int width ) void PS_PLOTTER::rect( wxPoint p1, wxPoint p2, FILL_T fill, int width )
/***************************************************************/ /***************************************************************/
{ {
user_to_device_coordinates( p1 ); user_to_device_coordinates( p1 );
@ -136,7 +136,7 @@ void PS_Plotter::rect( wxPoint p1, wxPoint p2, FILL_T fill, int width )
} }
/******************************************************/ /******************************************************/
void PS_Plotter::circle( wxPoint pos, int diametre, FILL_T fill, int width ) void PS_PLOTTER::circle( wxPoint pos, int diametre, FILL_T fill, int width )
/******************************************************/ /******************************************************/
{ {
wxASSERT(output_file); wxASSERT(output_file);
@ -152,7 +152,7 @@ void PS_Plotter::circle( wxPoint pos, int diametre, FILL_T fill, int width )
/**************************************************************************************/ /**************************************************************************************/
void PS_Plotter::arc( wxPoint centre, int StAngle, int EndAngle, int rayon, void PS_PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int rayon,
FILL_T fill, int width ) FILL_T fill, int width )
/**************************************************************************************/ /**************************************************************************************/
@ -181,7 +181,7 @@ void PS_Plotter::arc( wxPoint centre, int StAngle, int EndAngle, int rayon,
/*****************************************************************/ /*****************************************************************/
void PS_Plotter::poly( int nb_segm, int* coord, FILL_T fill, int width ) void PS_PLOTTER::poly( int nb_segm, int* coord, FILL_T 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
@ -218,7 +218,7 @@ void PS_Plotter::poly( int nb_segm, int* coord, FILL_T fill, int width )
/*************************************/ /*************************************/
void PS_Plotter::pen_to( wxPoint pos, char plume ) void PS_PLOTTER::pen_to( wxPoint pos, char plume )
/*************************************/ /*************************************/
/* Routine to draw to a new position /* Routine to draw to a new position
@ -247,7 +247,7 @@ void PS_Plotter::pen_to( wxPoint pos, char plume )
/***********************************************************/ /***********************************************************/
void PS_Plotter::start_plot( FILE *fout) void PS_PLOTTER::start_plot( FILE *fout)
/***********************************************************/ /***********************************************************/
/* The code within this function (and the CloseFilePS function) /* The code within this function (and the CloseFilePS function)
@ -378,7 +378,7 @@ void PS_Plotter::start_plot( FILE *fout)
} }
/******************************************/ /******************************************/
void PS_Plotter::end_plot() void PS_PLOTTER::end_plot()
/******************************************/ /******************************************/
{ {
wxASSERT(output_file); wxASSERT(output_file);
@ -388,7 +388,7 @@ void PS_Plotter::end_plot()
} }
/***********************************************************************************/ /***********************************************************************************/
void PS_Plotter::flash_pad_oval( wxPoint pos, wxSize size, int orient, void PS_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
GRTraceMode modetrace ) GRTraceMode modetrace )
/************************************************************************************/ /************************************************************************************/
@ -426,7 +426,7 @@ void PS_Plotter::flash_pad_oval( wxPoint pos, wxSize size, int orient,
} }
/*******************************************************************************/ /*******************************************************************************/
void PS_Plotter::flash_pad_circle(wxPoint pos, int diametre, void PS_PLOTTER::flash_pad_circle(wxPoint pos, int diametre,
GRTraceMode modetrace) GRTraceMode modetrace)
/*******************************************************************************/ /*******************************************************************************/
/* Trace 1 pastille RONDE (via,pad rond) en position pos_X,Y /* Trace 1 pastille RONDE (via,pad rond) en position pos_X,Y
@ -447,7 +447,7 @@ void PS_Plotter::flash_pad_circle(wxPoint pos, int diametre,
} }
/**************************************************************************/ /**************************************************************************/
void PS_Plotter::flash_pad_rect(wxPoint pos, wxSize size, void PS_PLOTTER::flash_pad_rect(wxPoint pos, wxSize size,
int orient, GRTraceMode trace_mode) int orient, GRTraceMode trace_mode)
/**************************************************************************/ /**************************************************************************/
/* /*
@ -488,7 +488,7 @@ void PS_Plotter::flash_pad_rect(wxPoint pos, wxSize size,
} }
/*******************************************************************/ /*******************************************************************/
void PS_Plotter::flash_pad_trapez( wxPoint centre, wxSize size, wxSize delta, void PS_PLOTTER::flash_pad_trapez( wxPoint centre, wxSize size, wxSize delta,
int orient, GRTraceMode modetrace ) int orient, GRTraceMode modetrace )
/*******************************************************************/ /*******************************************************************/
/* /*

View File

@ -15,7 +15,7 @@
#include "drawtxt.h" #include "drawtxt.h"
/**************************************************************************/ /**************************************************************************/
void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen ) void WinEDA_DrawFrame::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
/**************************************************************************/ /**************************************************************************/
/* Plot sheet references /* Plot sheet references
@ -74,6 +74,7 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
xg -= GRID_REF_W * conv_unit; xg -= GRID_REF_W * conv_unit;
yg -= GRID_REF_W * conv_unit; yg -= GRID_REF_W * conv_unit;
} }
#endif #endif
/* trace des reperes */ /* trace des reperes */
@ -97,13 +98,16 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
{ {
case WS_CADRE: case WS_CADRE:
break; break;
case WS_PODPIS_LU: case WS_PODPIS_LU:
if(WsItem->m_Legende) msg = WsItem->m_Legende; if( WsItem->m_Legende )
msg = WsItem->m_Legende;
plotter->text( pos, color, plotter->text( pos, color,
msg, TEXT_ORIENT_VERT, text_size, msg, TEXT_ORIENT_VERT, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
thickness, italic, false ); thickness, italic, false );
break; break;
case WS_SEGMENT_LU: case WS_SEGMENT_LU:
plotter->move_to( pos ); plotter->move_to( pos );
pos.x = (ref.x - WsItem->m_Endx) * conv_unit; pos.x = (ref.x - WsItem->m_Endx) * conv_unit;
@ -112,6 +116,7 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
break; break;
} }
} }
for( Ki_WorkSheetData* WsItem = &WS_Segm1_LT; for( Ki_WorkSheetData* WsItem = &WS_Segm1_LT;
WsItem != NULL; WsItem != NULL;
WsItem = WsItem->Pnext ) WsItem = WsItem->Pnext )
@ -129,6 +134,7 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
break; break;
} }
} }
#else #else
/* Trace des reperes selon l'axe X */ /* Trace des reperes selon l'axe X */
@ -202,6 +208,7 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false ); thickness, italic, false );
} }
#endif #endif
/* Trace du cartouche */ /* Trace du cartouche */
@ -223,44 +230,60 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
{ {
case WS_DATE: case WS_DATE:
break; break;
case WS_REV: case WS_REV:
break; break;
case WS_KICAD_VERSION: case WS_KICAD_VERSION:
break; break;
case WS_PODPIS: case WS_PODPIS:
if(WsItem->m_Legende) msg = WsItem->m_Legende; if( WsItem->m_Legende )
msg = WsItem->m_Legende;
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size, plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false ); thickness, italic, false );
break; break;
case WS_SIZESHEET: case WS_SIZESHEET:
break; break;
case WS_IDENTSHEET: case WS_IDENTSHEET:
if(WsItem->m_Legende) msg = WsItem->m_Legende; if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg << screen->m_ScreenNumber; msg << screen->m_ScreenNumber;
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size, plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false ); thickness, italic, false );
break; break;
case WS_SHEETS: case WS_SHEETS:
if(WsItem->m_Legende) msg = WsItem->m_Legende; if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg << screen->m_NumberOfScreen; msg << screen->m_NumberOfScreen;
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size, plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false ); thickness, italic, false );
break; break;
case WS_COMPANY_NAME: case WS_COMPANY_NAME:
break; break;
case WS_TITLE: case WS_TITLE:
break; break;
case WS_COMMENT1: case WS_COMMENT1:
break; break;
case WS_COMMENT2: case WS_COMMENT2:
break; break;
case WS_COMMENT3: case WS_COMMENT3:
break; break;
case WS_COMMENT4: case WS_COMMENT4:
break; break;
case WS_UPPER_SEGMENT: case WS_UPPER_SEGMENT:
case WS_LEFT_SEGMENT: case WS_LEFT_SEGMENT:
case WS_SEGMENT: case WS_SEGMENT:
@ -271,7 +294,9 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
break; break;
} }
} }
} else { }
else
{
for( Ki_WorkSheetData* WsItem = &WS_CADRE_D; for( Ki_WorkSheetData* WsItem = &WS_CADRE_D;
WsItem != NULL; WsItem != NULL;
WsItem = WsItem->Pnext ) WsItem = WsItem->Pnext )
@ -284,18 +309,22 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
case WS_CADRE: case WS_CADRE:
/* Begin list number > 1 */ /* Begin list number > 1 */
case WS_PODPIS_D: case WS_PODPIS_D:
if(WsItem->m_Legende) msg = WsItem->m_Legende; if( WsItem->m_Legende )
msg = WsItem->m_Legende;
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size, plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false ); thickness, italic, false );
break; break;
case WS_IDENTSHEET_D: case WS_IDENTSHEET_D:
if(WsItem->m_Legende) msg = WsItem->m_Legende; if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg << screen->m_ScreenNumber; msg << screen->m_ScreenNumber;
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size, plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false ); thickness, italic, false );
break; break;
case WS_LEFT_SEGMENT_D: case WS_LEFT_SEGMENT_D:
case WS_SEGMENT_D: case WS_SEGMENT_D:
plotter->move_to( pos ); plotter->move_to( pos );
@ -423,379 +452,7 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
thickness, italic, bold ); thickness, italic, bold );
} }
} }
#endif #endif
} }
/******************************************/
void Plotter::user_to_device_coordinates( wxPoint& pos )
/******************************************/
/* 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 - plot_offset.x) * plot_scale * device_scale);
if (plot_orient_options == PLOT_MIROIR)
pos.y = (int) ((pos.y - plot_offset.y) * plot_scale * device_scale);
else
pos.y = (int) ((paper_size.y - (pos.y - plot_offset.y) * plot_scale) * device_scale);
}
/********************************************************************/
void Plotter::arc( wxPoint centre, int StAngle, int EndAngle, int rayon,
FILL_T fill, int width )
/********************************************************************/
/* Generic arc rendered as a polyline */
{
wxPoint start, end;
const int delta = 50; /* increment (in 0.1 degrees) to draw circles */
double alpha;
if (StAngle > EndAngle)
EXCHG(StAngle, EndAngle);
set_current_line_width(width);
/* Please NOTE the different sign due to Y-axis flip */
alpha = StAngle/1800.0*M_PI;
start.x = centre.x + (int) (rayon * cos(-alpha));
start.y = centre.y + (int) (rayon * sin(-alpha));
move_to(start);
for(int ii = StAngle+delta; ii < EndAngle; ii += delta )
{
alpha = ii/1800.0*M_PI;
end.x = centre.x + (int) (rayon * cos(-alpha));
end.y = centre.y + (int) (rayon * sin(-alpha));
line_to(end);
}
alpha = EndAngle/1800.0*M_PI;
end.x = centre.x + (int) (rayon * cos(-alpha));
end.y = centre.y + (int) (rayon * sin(-alpha));
finish_to( end );
}
/************************************/
void Plotter::user_to_device_size( wxSize& size )
/************************************/
/* modifie les dimension size.x et size.y pour le trace selon l'echelle */
{
size.x = (int) (size.x * plot_scale * device_scale);
size.y = (int) (size.y * plot_scale * device_scale);
}
/************************************/
double Plotter::user_to_device_size( double size )
/************************************/
{
return size * plot_scale * device_scale;
}
/************************************************************************************/
void Plotter::center_square( const wxPoint& position, int diametre, FILL_T fill)
/************************************************************************************/
{
int rayon = diametre / 2.8284;
int coord[10] = {
position.x+rayon, position.y+rayon,
position.x+rayon, position.y-rayon,
position.x-rayon, position.y-rayon,
position.x-rayon, position.y+rayon,
position.x+rayon, position.y+rayon
};
if (fill)
{
poly(4, coord, fill);
}
else
{
poly(5, coord, fill);
}
}
/************************************************************************************/
void Plotter::center_lozenge( const wxPoint& position, int diametre, FILL_T fill)
/************************************************************************************/
{
int rayon = diametre / 2;
int coord[10] = {
position.x, position.y+rayon,
position.x+rayon, position.y,
position.x, position.y-rayon,
position.x-rayon, position.y,
position.x, position.y+rayon,
};
if (fill)
{
poly(4, coord, fill);
}
else
{
poly(5, coord, fill);
}
}
/************************************************************************************/
void Plotter::marker( const wxPoint& position, int diametre, int aShapeId)
/************************************************************************************/
/* Trace un motif de numero de forme aShapeId, aux coord x0, y0.
* x0, y0 = coordonnees tables
* diametre = diametre (coord table) du trou
* aShapeId = index ( permet de generer des formes caract )
*/
{
int rayon = diametre / 2;
int x0, y0;
x0 = position.x; y0 = position.y;
switch( aShapeId )
{
case 0: /* vias : forme en X */
move_to( wxPoint( x0 - rayon, y0 - rayon ) );
line_to( wxPoint( x0 + rayon, y0 + rayon ) );
move_to( wxPoint( x0 + rayon, y0 - rayon ) );
finish_to( wxPoint( x0 - rayon, y0 + rayon ) );
break;
case 1: /* Cercle */
circle(position, diametre, NO_FILL);
break;
case 2: /* forme en + */
move_to( wxPoint( x0, y0 - rayon ) );
line_to( wxPoint( x0, y0 + rayon ) );
move_to( wxPoint( x0 + rayon, y0 ) );
finish_to( wxPoint( x0 - rayon, y0 ) );
break;
case 3: /* forme en X cercle */
circle(position, diametre, NO_FILL);
move_to( wxPoint( x0 - rayon, y0 - rayon ) );
line_to( wxPoint( x0 + rayon, y0 + rayon ) );
move_to( wxPoint( x0 + rayon, y0 - rayon ) );
finish_to( wxPoint( x0 - rayon, y0 + rayon ) );
break;
case 4: /* forme en cercle barre de - */
circle(position, diametre, NO_FILL);
move_to( wxPoint( x0 - rayon, y0 ) );
finish_to( wxPoint( x0 + rayon, y0 ) );
break;
case 5: /* forme en cercle barre de | */
circle(position, diametre, NO_FILL);
move_to( wxPoint( x0, y0 - rayon ) );
finish_to( wxPoint( x0, y0 + rayon ) );
break;
case 6: /* forme en carre */
center_square(position, diametre, NO_FILL);
break;
case 7: /* forme en losange */
center_lozenge(position, diametre, NO_FILL);
break;
case 8: /* forme en carre barre par un X*/
center_square(position, diametre, NO_FILL);
move_to( wxPoint( x0 - rayon, y0 - rayon ) );
line_to( wxPoint( x0 + rayon, y0 + rayon ) );
move_to( wxPoint( x0 + rayon, y0 - rayon ) );
finish_to( wxPoint( x0 - rayon, y0 + rayon ) );
break;
case 9: /* forme en losange barre par un +*/
center_lozenge(position, diametre, NO_FILL);
move_to( wxPoint( x0, y0 - rayon ) );
line_to( wxPoint( x0, y0 + rayon ) );
move_to( wxPoint( x0 + rayon, y0 ) );
finish_to( wxPoint( x0 - rayon, y0 ) );
break;
case 10: /* forme en carre barre par un '/' */
center_square(position, diametre, NO_FILL);
move_to( wxPoint( x0 - rayon, y0 - rayon ) );
finish_to( wxPoint( x0 + rayon, y0 + rayon ) );
break;
case 11: /* forme en losange barre par un |*/
center_lozenge(position, diametre, NO_FILL);
move_to( wxPoint( x0, y0 - rayon ) );
finish_to( wxPoint( x0, y0 + rayon ) );
break;
case 12: /* forme en losange barre par un -*/
center_lozenge(position, diametre, NO_FILL);
move_to( wxPoint( x0 - rayon, y0 ) );
finish_to( wxPoint( x0 + rayon, y0 ) );
break;
default:
circle(position, diametre, NO_FILL);
break;
}
}
/***************************************************************/
void Plotter::segment_as_oval( wxPoint start, wxPoint end, int width,
GRTraceMode tracemode)
/***************************************************************/
{
/* Convert a thick segment and plot it as an oval */
wxPoint center( (start.x + end.x) / 2, (start.y + end.y) / 2);
wxSize size( end.x - start.x, end.y - start.y);
int orient;
if ( size.y == 0 )
orient = 0;
else if ( size.x == 0 )
orient = 900;
else orient = - (int) (atan2( (double)size.y, (double)size.x ) * 1800.0 / M_PI);
size.x = (int) sqrt( ((double)size.x * size.x) + ((double)size.y * size.y) ) + width;
size.y = width;
flash_pad_oval( center, size, orient, tracemode );
}
/***************************************************************/
void Plotter::sketch_oval(wxPoint pos, wxSize size, int orient,
int width)
/***************************************************************/
{
set_current_line_width(width);
width = current_pen_width;
int rayon, deltaxy, cx, cy;
if( size.x > size.y )
{
EXCHG( size.x, size.y ); orient += 900;
if( orient >= 3600 )
orient -= 3600;
}
deltaxy = size.y - size.x; /* = distance entre centres de l'ovale */
rayon = (size.x-width) / 2;
cx = -rayon; cy = -deltaxy / 2;
RotatePoint( &cx, &cy, orient );
move_to( wxPoint( cx + pos.x, cy + pos.y ) );
cx = -rayon; cy = deltaxy / 2;
RotatePoint( &cx, &cy, orient );
finish_to( wxPoint( cx + pos.x, cy + pos.y ) );
cx = rayon; cy = -deltaxy / 2;
RotatePoint( &cx, &cy, orient );
move_to( wxPoint( cx + pos.x, cy + pos.y ) );
cx = rayon; cy = deltaxy / 2;
RotatePoint( &cx, &cy, orient );
finish_to( wxPoint( cx + pos.x, cy + pos.y ) );
cx = 0; cy = deltaxy / 2;
RotatePoint( &cx, &cy, orient );
arc( wxPoint( cx + pos.x, cy + pos.y ),
orient + 1800 , orient + 3600,
rayon, NO_FILL);
cx = 0; cy = -deltaxy / 2;
RotatePoint( &cx, &cy, orient );
arc( wxPoint( cx + pos.x, cy + pos.y ),
orient, orient + 1800,
rayon, NO_FILL );
}
/***************************************************************/
void Plotter::thick_segment( wxPoint start, wxPoint end, int width,
GRTraceMode tracemode )
/***************************************************************/
/* Plot 1 segment like a track segment
*/
{
switch (tracemode)
{
case FILLED:
case FILAIRE:
set_current_line_width(tracemode==FILLED?width:-1);
move_to(start);
finish_to(end);
break;
case SKETCH:
set_current_line_width(-1);
segment_as_oval(start, end, width, tracemode);
break;
}
}
void Plotter::thick_arc( wxPoint centre, int StAngle, int EndAngle, int rayon,
int width, GRTraceMode tracemode )
{
switch (tracemode)
{
case FILAIRE:
set_current_line_width(-1);
arc(centre, StAngle, EndAngle, rayon, NO_FILL,-1);
break;
case FILLED:
arc(centre, StAngle, EndAngle, rayon,NO_FILL, width);
break;
case SKETCH:
set_current_line_width(-1);
arc(centre, StAngle, EndAngle, rayon-(width-current_pen_width)/2,NO_FILL, -1);
arc(centre, StAngle, EndAngle, rayon+(width-current_pen_width)/2,NO_FILL, -1);
break;
}
}
void Plotter::thick_rect( wxPoint p1, wxPoint p2, int width,
GRTraceMode tracemode)
{
switch (tracemode)
{
case FILAIRE:
rect(p1, p2,NO_FILL, -1);
break;
case FILLED:
rect(p1, p2,NO_FILL, width);
break;
case SKETCH:
set_current_line_width(-1);
p1.x -= (width-current_pen_width)/2;
p1.y -= (width-current_pen_width)/2;
p2.x += (width-current_pen_width)/2;
p2.y += (width-current_pen_width)/2;
rect(p1, p2,NO_FILL, -1);
p1.x += (width-current_pen_width);
p1.y += (width-current_pen_width);
p2.x -= (width-current_pen_width);
p2.y -= (width-current_pen_width);
rect(p1, p2,NO_FILL, -1);
break;
}
}
void Plotter::thick_circle( wxPoint pos, int diametre, int width,
GRTraceMode tracemode)
{
switch (tracemode)
{
case FILAIRE:
circle(pos, diametre,NO_FILL, -1);
break;
case FILLED:
circle(pos, diametre,NO_FILL, width);
break;
case SKETCH:
set_current_line_width(-1);
circle(pos, diametre-width+current_pen_width,NO_FILL, -1);
circle(pos, diametre+width-current_pen_width,NO_FILL, -1);
break;
}
}
/*************************************************************************************/
void Plotter::set_paper_size(Ki_PageDescr* asheet)
/*************************************************************************************/
{
wxASSERT(!output_file);
sheet = asheet;
// Sheets are in mils, plotter works with decimils
paper_size.x = sheet->m_Size.x * 10;
paper_size.y = sheet->m_Size.y * 10;
}

View File

@ -172,7 +172,7 @@ static void DrawGraphicTextPline(
int point_count, int point_count,
wxPoint* coord, wxPoint* coord,
void (* aCallback)(int x0, int y0, int xf, int yf ), void (* aCallback)(int x0, int y0, int xf, int yf ),
Plotter *plotter ) PLOTTER *plotter )
{ {
if( plotter ) if( plotter )
{ {
@ -242,7 +242,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
bool aItalic, bool aItalic,
bool aBold, bool aBold,
void (* aCallback)( int x0, int y0, int xf, int yf ), void (* aCallback)( int x0, int y0, int xf, int yf ),
Plotter *plotter ) PLOTTER *plotter )
/****************************************************************************************************/ /****************************************************************************************************/
{ {
int AsciiCode; int AsciiCode;
@ -520,7 +520,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
* @param aBold = true to use a bold font Useful only with default width value (aWidth = 0) * @param aBold = true to use a bold font Useful only with default width value (aWidth = 0)
*/ */
/******************************************************************************************/ /******************************************************************************************/
void Plotter::text( const wxPoint& aPos, void PLOTTER::text( const wxPoint& aPos,
enum EDA_Colors aColor, enum EDA_Colors aColor,
const wxString& aText, const wxString& aText,
int aOrient, int aOrient,

View File

@ -714,7 +714,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
* 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( Plotter *plotter, void LibDrawPin::PlotPinTexts( PLOTTER *plotter,
wxPoint& pin_pos, wxPoint& pin_pos,
int orient, int orient,
int TextInside, int TextInside,

View File

@ -300,7 +300,7 @@ public:
wxPoint& pin_pos, int orient, wxPoint& pin_pos, int orient,
int TextInside, bool DrawPinNum, int TextInside, bool DrawPinNum,
bool DrawPinName, int Color, int DrawMode ); bool DrawPinName, int Color, int DrawMode );
void PlotPinTexts( Plotter *plotter, void PlotPinTexts( PLOTTER *plotter,
wxPoint& pin_pos, wxPoint& pin_pos,
int orient, int orient,
int TextInside, int TextInside,

View File

@ -182,10 +182,9 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
fn = m_FileNameCtrl->GetValue(); fn = m_FileNameCtrl->GetValue();
if( !fn.IsOk() ) if( !fn.IsOk() )
{
fn = screen->m_FileName; fn = screen->m_FileName;
fn.SetExt( wxT( "svg" ) ); fn.SetExt( wxT( "svg" ) );
}
bool success = DrawPage( fn.GetFullPath(), screen, aPrint_Sheet_Ref ); bool success = DrawPage( fn.GetFullPath(), screen, aPrint_Sheet_Ref );
msg = _( "Create file " ) + fn.GetFullPath(); msg = _( "Create file " ) + fn.GetFullPath();

View File

@ -16,17 +16,17 @@
#include "protos.h" #include "protos.h"
/* Local Variables : */ /* Local Variables : */
static void Plot_Hierarchical_PIN_Sheet( Plotter* plotter, static void Plot_Hierarchical_PIN_Sheet( PLOTTER* plotter,
Hierarchical_PIN_Sheet_Struct* Struct ); Hierarchical_PIN_Sheet_Struct* Struct );
static void PlotTextField( Plotter* plotter, SCH_COMPONENT* DrawLibItem, static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
int FieldNumber, int IsMulti, int DrawMode ); int FieldNumber, int IsMulti, int DrawMode );
static void PlotPinSymbol( Plotter* plotter, const wxPoint& pos, static void PlotPinSymbol( PLOTTER* plotter, const wxPoint& pos,
int len, int orient, int Shape ); int len, int orient, int Shape );
/***/ /***/
/**********************************************************/ /**********************************************************/
static void PlotNoConnectStruct( Plotter* plotter, DrawNoConnectStruct* Struct ) static void PlotNoConnectStruct( PLOTTER* plotter, DrawNoConnectStruct* Struct )
/**********************************************************/ /**********************************************************/
/* Routine de dessin des symboles de "No Connexion" .. /* Routine de dessin des symboles de "No Connexion" ..
@ -46,7 +46,7 @@ static void PlotNoConnectStruct( Plotter* plotter, DrawNoConnectStruct* Struct )
/*************************************************/ /*************************************************/
static void PlotLibPart( Plotter* plotter, SCH_COMPONENT* DrawLibItem ) static void PlotLibPart( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem )
/*************************************************/ /*************************************************/
/* Polt a component */ /* Polt a component */
{ {
@ -252,7 +252,7 @@ static void PlotLibPart( Plotter* plotter, SCH_COMPONENT* DrawLibItem )
/*************************************************************/ /*************************************************************/
static void PlotTextField( Plotter* plotter, SCH_COMPONENT* DrawLibItem, static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
int FieldNumber, int IsMulti, int DrawMode ) int FieldNumber, int IsMulti, int DrawMode )
/**************************************************************/ /**************************************************************/
@ -398,7 +398,7 @@ static void PlotTextField( Plotter* plotter, SCH_COMPONENT* DrawLibItem,
/**************************************************************************/ /**************************************************************************/
static void PlotPinSymbol( Plotter* plotter, const wxPoint& pos, static void PlotPinSymbol( PLOTTER* plotter, const wxPoint& pos,
int len, int orient, int Shape ) int len, int orient, int Shape )
/**************************************************************************/ /**************************************************************************/
@ -503,7 +503,7 @@ static void PlotPinSymbol( Plotter* plotter, const wxPoint& pos,
/********************************************************************/ /********************************************************************/
static void PlotTextStruct( Plotter* plotter, SCH_TEXT* aSchText ) static void PlotTextStruct( PLOTTER* plotter, SCH_TEXT* aSchText )
/********************************************************************/ /********************************************************************/
/* /*
@ -574,7 +574,7 @@ static void PlotTextStruct( Plotter* plotter, SCH_TEXT* aSchText )
/*****************************************************************************************/ /*****************************************************************************************/
static void Plot_Hierarchical_PIN_Sheet( Plotter* plotter, static void Plot_Hierarchical_PIN_Sheet( PLOTTER* plotter,
Hierarchical_PIN_Sheet_Struct* aHierarchical_PIN ) Hierarchical_PIN_Sheet_Struct* aHierarchical_PIN )
/****************************************************************************************/ /****************************************************************************************/
@ -619,7 +619,7 @@ static void Plot_Hierarchical_PIN_Sheet( Plotter* plotter,
/*************************************************/ /*************************************************/
static void PlotSheetStruct( Plotter* plotter, DrawSheetStruct* Struct ) static void PlotSheetStruct( PLOTTER* plotter, DrawSheetStruct* Struct )
/*************************************************/ /*************************************************/
/* Routine de dessin du bloc type hierarchie */ /* Routine de dessin du bloc type hierarchie */
{ {
@ -688,7 +688,7 @@ static void PlotSheetStruct( Plotter* plotter, DrawSheetStruct* Struct )
/********************************************************/ /********************************************************/
void PlotDrawlist( Plotter* plotter, SCH_ITEM* aDrawlist ) void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* aDrawlist )
/*********************************************************/ /*********************************************************/
{ {
while( aDrawlist ) /* Plot each item in draw list */ while( aDrawlist ) /* Plot each item in draw list */

View File

@ -370,7 +370,7 @@ void WinEDA_PlotDXFFrame::PlotOneSheetDXF( const wxString& FileName,
msg.Printf( _( "Plot: %s\n" ), FileName.GetData() ); msg.Printf( _( "Plot: %s\n" ), FileName.GetData() );
m_MsgBox->AppendText( msg ); m_MsgBox->AppendText( msg );
DXF_Plotter *plotter = new DXF_Plotter(); DXF_PLOTTER *plotter = new DXF_PLOTTER();
plotter->set_paper_size(sheet); plotter->set_paper_size(sheet);
plotter->set_viewport( plot_offset, scale, 0); plotter->set_viewport( plot_offset, scale, 0);
plotter->set_color_mode(PlotDXFColorOpt); plotter->set_color_mode(PlotDXFColorOpt);

View File

@ -592,7 +592,7 @@ void WinEDA_PlotHPGLFrame::Plot_1_Page_HPGL( const wxString& FileName,
msg.Printf( _( "Plot: %s\n" ), FileName.GetData() ); msg.Printf( _( "Plot: %s\n" ), FileName.GetData() );
m_MsgBox->AppendText( msg ); m_MsgBox->AppendText( msg );
HPGL_Plotter *plotter = new HPGL_Plotter(); HPGL_PLOTTER *plotter = new HPGL_PLOTTER();
plotter->set_paper_size(sheet); plotter->set_paper_size(sheet);
plotter->set_viewport( offset, plot_scale, 0); plotter->set_viewport( offset, plot_scale, 0);
plotter->set_default_line_width( g_DrawDefaultLineThickness ); plotter->set_default_line_width( g_DrawDefaultLineThickness );

View File

@ -419,7 +419,7 @@ void WinEDA_PlotPSFrame::PlotOneSheetPS( const wxString& FileName,
msg.Printf( _( "Plot: %s\n" ), FileName.GetData() ); msg.Printf( _( "Plot: %s\n" ), FileName.GetData() );
m_MsgBox->AppendText( msg ); m_MsgBox->AppendText( msg );
PS_Plotter *plotter = new PS_Plotter(); PS_PLOTTER *plotter = new PS_PLOTTER();
plotter->set_paper_size(sheet); plotter->set_paper_size(sheet);
plotter->set_viewport( plot_offset, scale, 0); plotter->set_viewport( plot_offset, scale, 0);
plotter->set_default_line_width( g_DrawDefaultLineThickness ); plotter->set_default_line_width( g_DrawDefaultLineThickness );

View File

@ -278,7 +278,7 @@ void ReAnnotatePowerSymbolsOnly();
/************/ /************/
/* PLOT.CPP */ /* PLOT.CPP */
/************/ /************/
void PlotDrawlist( Plotter* plotter, SCH_ITEM* drawlist ); void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* drawlist );
/***************/ /***************/
/* DELSHEET.CPP */ /* DELSHEET.CPP */

View File

@ -10,7 +10,7 @@
#include "base_struct.h" #include "base_struct.h"
class WinEDA_DrawPanel; class WinEDA_DrawPanel;
class Plotter; class PLOTTER;
/** Function Clamp_Text_PenSize /** Function Clamp_Text_PenSize
*As a rule, pen width should not be >1/4em, otherwise the character *As a rule, pen width should not be >1/4em, otherwise the character
@ -74,7 +74,7 @@ void DrawGraphicText( WinEDA_DrawPanel * aPanel,
bool aItalic, bool aItalic,
bool aBold, bool aBold,
void (*aCallback)( int x0, int y0, int xf, int yf ) = NULL, void (*aCallback)( int x0, int y0, int xf, int yf ) = NULL,
Plotter * plotter = NULL ); PLOTTER * plotter = NULL );
#endif /* __INCLUDE__DRAWTXT_H__ */ #endif /* __INCLUDE__DRAWTXT_H__ */

View File

@ -9,7 +9,6 @@
#define __INCLUDE__PLOT_COMMON_H__ 1 #define __INCLUDE__PLOT_COMMON_H__ 1
#include <vector> #include <vector>
using namespace std;
#include "drawtxt.h" #include "drawtxt.h"
/** /**
@ -25,24 +24,14 @@ enum PlotFormat {
const int PLOT_MIROIR = 1; const int PLOT_MIROIR = 1;
class Plotter class PLOTTER
{ {
public: public:
Plotter() PlotFormat m_PlotType; // type of plot
{ public:
plot_scale = 1; PLOTTER( PlotFormat aPlotType );
default_pen_width = 0;
current_pen_width = -1; /* To-be-set marker */
pen_state = 'Z'; /* End-of-path idle */
plot_orient_options = 0; /* Mirror flag */
output_file = 0;
color_mode = false; /* Start as a BW plot */
negative_mode = false;
sheet = NULL;
}
virtual ~PLOTTER()
virtual ~Plotter()
{ {
/* Emergency cleanup */ /* Emergency cleanup */
if( output_file ) if( output_file )
@ -52,6 +41,12 @@ public:
} }
/** function GetPlotterType()
* @return the format of the plot file
*/
PlotFormat GetPlotterType()
{ return m_PlotType; }
virtual void start_plot( FILE* fout ) = 0; virtual void start_plot( FILE* fout ) = 0;
virtual void end_plot() = 0; virtual void end_plot() = 0;
@ -198,9 +193,13 @@ protected:
wxSize paper_size; wxSize paper_size;
}; };
class HPGL_Plotter : public Plotter class HPGL_PLOTTER : public PLOTTER
{ {
public: public:
HPGL_PLOTTER() : PLOTTER(PLOT_FORMAT_HPGL)
{
}
virtual void start_plot( FILE* fout ); virtual void start_plot( FILE* fout );
virtual void end_plot(); virtual void end_plot();
@ -270,16 +269,15 @@ protected:
double pen_overlap; double pen_overlap;
}; };
class PS_Plotter : public Plotter class PS_PLOTTER : public PLOTTER
{ {
public: public:
PS_Plotter() PS_PLOTTER() : PLOTTER(PLOT_FORMAT_POST)
{ {
plot_scale_adjX = 1; plot_scale_adjX = 1;
plot_scale_adjY = 1; plot_scale_adjY = 1;
} }
virtual void start_plot( FILE* fout ); virtual void start_plot( FILE* fout );
virtual void end_plot(); virtual void end_plot();
virtual void set_current_line_width( int width ); virtual void set_current_line_width( int width );
@ -318,7 +316,7 @@ protected:
/* Class to handle a D_CODE when plotting a board : */ /* Class to handle a D_CODE when plotting a board : */
#define FIRST_DCODE_VALUE 10 // D_CODE < 10 is a command, D_CODE >= 10 is a tool #define FIRST_DCODE_VALUE 10 // D_CODE < 10 is a command, D_CODE >= 10 is a tool
struct Aperture struct APERTURE
{ {
enum Aperture_Type { enum Aperture_Type {
Circle = 1, Circle = 1,
@ -335,10 +333,10 @@ struct Aperture
* tool change? */ * tool change? */
}; };
class Gerber_Plotter : public Plotter class GERBER_PLOTTER : public PLOTTER
{ {
public: public:
Gerber_Plotter() GERBER_PLOTTER() : PLOTTER(PLOT_FORMAT_GERBER)
{ {
work_file = 0; work_file = 0;
final_file = 0; final_file = 0;
@ -370,21 +368,26 @@ public:
int orient, GRTraceMode trace_mode ); int orient, GRTraceMode trace_mode );
protected: protected:
void select_aperture( const wxSize& size, Aperture::Aperture_Type type ); void select_aperture( const wxSize& size,
APERTURE::Aperture_Type type );
vector<Aperture>::iterator get_aperture( const wxSize& size, std::vector<APERTURE>::iterator get_aperture( const wxSize& size,
Aperture::Aperture_Type type ); APERTURE::Aperture_Type type );
FILE* work_file, * final_file; FILE* work_file, * final_file;
void write_aperture_list(); void write_aperture_list();
vector<Aperture> apertures; std::vector<APERTURE> apertures;
vector<Aperture>::iterator current_aperture; std::vector<APERTURE>::iterator current_aperture;
}; };
class DXF_Plotter : public Plotter class DXF_PLOTTER : public PLOTTER
{ {
public: public:
DXF_PLOTTER() : PLOTTER(PLOT_FORMAT_DXF)
{
}
virtual void start_plot( FILE* fout ); virtual void start_plot( FILE* fout );
virtual void end_plot(); virtual void end_plot();

View File

@ -91,6 +91,7 @@ public:
// General // General
virtual void OnCloseWindow( wxCloseEvent& Event ) = 0; virtual void OnCloseWindow( wxCloseEvent& Event ) = 0;
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) { } virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) { }
virtual void ReCreateHToolbar() = 0; virtual void ReCreateHToolbar() = 0;
virtual void ReCreateVToolbar() = 0; virtual void ReCreateVToolbar() = 0;
@ -199,7 +200,9 @@ public:
MODULE* module, MODULE* module,
int angle, int angle,
bool incremental ); bool incremental );
void Place_Module( MODULE* module, wxDC* DC, bool aDoNotRecreateRatsnest = false ); void Place_Module( MODULE* module,
wxDC* DC,
bool aDoNotRecreateRatsnest = false );
// module texts // module texts
void RotateTextModule( TEXTE_MODULE* Text, wxDC* DC ); void RotateTextModule( TEXTE_MODULE* Text, wxDC* DC );
@ -223,6 +226,7 @@ public:
// loading footprints // loading footprints
/** function Get_Librairie_Module /** function Get_Librairie_Module
* *
* Read active libraries or one library to find and load a given module * Read active libraries or one library to find and load a given module
@ -269,24 +273,35 @@ public:
void test_1_net_connexion( wxDC* DC, int net_code ); void test_1_net_connexion( wxDC* DC, int net_code );
void RecalculateAllTracksNetcode(); void RecalculateAllTracksNetcode();
// Plotting /* Plotting functions:
*/
void ToPlotter( wxCommandEvent& event ); void ToPlotter( wxCommandEvent& event );
void Genere_GERBER( const wxString& FullFileName, int Layer, void Genere_GERBER( const wxString& FullFileName, int Layer,
bool PlotOriginIsAuxAxis, bool PlotOriginIsAuxAxis, GRTraceMode trace_mode );
void Genere_HPGL( const wxString& FullFileName, int Layer, GRTraceMode trace_mode );
void Genere_PS( const wxString& FullFileName,
int Layer,
bool useA4,
GRTraceMode trace_mode ); GRTraceMode trace_mode );
void Genere_HPGL( const wxString& FullFileName, int Layer, void Genere_DXF( const wxString& FullFileName, int Layer, GRTraceMode trace_mode );
GRTraceMode trace_mode); void Plot_Layer( PLOTTER* plotter, int Layer, GRTraceMode trace_mode );
void Genere_PS( const wxString& FullFileName, int Layer, void Plot_Standard_Layer( PLOTTER* plotter, int masque_layer,
bool useA4, GRTraceMode trace_mode );
void Genere_DXF( const wxString& FullFileName, int Layer,
GRTraceMode trace_mode);
void Plot_Layer(Plotter *plotter, int Layer, GRTraceMode trace_mode );
void Plot_Standard_Layer( Plotter *plotter, int masque_layer,
int garde, bool trace_via, int garde, bool trace_via,
GRTraceMode trace_mode ); GRTraceMode trace_mode );
void Plot_Serigraphie( Plotter *plotter, int masque_layer, void Plot_Serigraphie( PLOTTER* plotter, int masque_layer, GRTraceMode trace_mode );
GRTraceMode trace_mode);
void PlotDrillMark(Plotter *plotter, GRTraceMode trace_mode ); /** function PlotDrillMark
* Draw a drill mark for pads and vias.
* Must be called after all drawings, because it
* redraw the drill mark on a pad or via, as a negative (i.e. white) shape in FILLED plot mode
* @param aPlotter = the PLOTTER
* @param aTraceMode = the mode of plot (FILLED, SKETCH)
* @param aSmallDrillShape = true to plot a smalle drill shape, false to plot the actual drill shape
*/
void PlotDrillMark( PLOTTER* aPlotter, GRTraceMode aTraceMode, bool aSmallDrillShape );
/* Functions relative to Undo/redo commands:
*/
/** Function SaveCopyInUndoList (virtual pure) /** Function SaveCopyInUndoList (virtual pure)
* Creates a new entry in undo list of commands. * Creates a new entry in undo list of commands.

View File

@ -45,7 +45,7 @@ class WinEDAChoiceBox;
class PARAM_CFG_BASE; class PARAM_CFG_BASE;
class Ki_PageDescr; class Ki_PageDescr;
class Ki_HotkeyInfo; class Ki_HotkeyInfo;
class Plotter; class PLOTTER;
enum id_librarytype { enum id_librarytype {
LIBRARY_TYPE_EESCHEMA, LIBRARY_TYPE_EESCHEMA,
@ -244,7 +244,7 @@ public:
void OnActivate( wxActivateEvent& event ); void OnActivate( wxActivateEvent& event );
void ReDrawPanel(); void ReDrawPanel();
void TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width ); void TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width );
void PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen ); void PlotWorkSheet( PLOTTER *plotter, BASE_SCREEN* screen );
/** Function GetXYSheetReferences /** Function GetXYSheetReferences
* Return the X,Y sheet references where the point position is located * Return the X,Y sheet references where the point position is located

View File

@ -1 +0,0 @@
#include "wx/msw/wx.rc"

View File

@ -42,7 +42,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
wxPoint BoardCentre; wxPoint BoardCentre;
wxPoint offset; wxPoint offset;
wxString msg; wxString msg;
Plotter *plotter = NULL; PLOTTER* plotter = NULL;
SetLocaleTo_C_standard(); // Use the standard notation for float numbers SetLocaleTo_C_standard(); // Use the standard notation for float numbers
@ -60,7 +60,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
case PLOT_FORMAT_GERBER: case PLOT_FORMAT_GERBER:
scale = 1; scale = 1;
offset = auxoffset; offset = auxoffset;
plotter = new Gerber_Plotter(); plotter = new GERBER_PLOTTER();
plotter->set_viewport( offset, scale, 0 ); plotter->set_viewport( offset, scale, 0 );
break; break;
@ -69,7 +69,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
offset.x = 0; offset.x = 0;
offset.y = 0; offset.y = 0;
scale = 1; scale = 1;
HPGL_Plotter *hpgl_plotter = new HPGL_Plotter; HPGL_PLOTTER* hpgl_plotter = new HPGL_PLOTTER;
plotter = hpgl_plotter; plotter = hpgl_plotter;
hpgl_plotter->set_pen_number( g_pcb_plot_options.HPGL_Pen_Num ); hpgl_plotter->set_pen_number( g_pcb_plot_options.HPGL_Pen_Num );
hpgl_plotter->set_pen_speed( g_pcb_plot_options.HPGL_Pen_Speed ); hpgl_plotter->set_pen_speed( g_pcb_plot_options.HPGL_Pen_Speed );
@ -94,18 +94,19 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
offset.x = BoardCentre.x - (SheetSize.x / 2) / scale; offset.x = BoardCentre.x - (SheetSize.x / 2) / scale;
offset.y = BoardCentre.y - (SheetSize.y / 2) / scale; offset.y = BoardCentre.y - (SheetSize.y / 2) / scale;
offset.y += SheetSize.y / 8; /* decalage pour legende */ offset.y += SheetSize.y / 8; /* decalage pour legende */
PS_Plotter *ps_plotter = new PS_Plotter; PS_PLOTTER* ps_plotter = new PS_PLOTTER;
plotter = ps_plotter; plotter = ps_plotter;
ps_plotter->set_paper_size( SheetPS ); ps_plotter->set_paper_size( SheetPS );
plotter->set_viewport( offset, scale, 0 ); plotter->set_viewport( offset, scale, 0 );
break; break;
} }
case PLOT_FORMAT_DXF: case PLOT_FORMAT_DXF:
{ {
offset.x = 0; offset.x = 0;
offset.y = 0; offset.y = 0;
scale = 1; scale = 1;
DXF_Plotter *dxf_plotter = new DXF_Plotter; DXF_PLOTTER* dxf_plotter = new DXF_PLOTTER;
plotter = dxf_plotter; plotter = dxf_plotter;
plotter->set_paper_size( aSheet ); plotter->set_paper_size( aSheet );
plotter->set_viewport( offset, scale, 0 ); plotter->set_viewport( offset, scale, 0 );
@ -157,6 +158,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
// Set Drill Symbols width in 1/10000 mils // Set Drill Symbols width in 1/10000 mils
plotter->set_default_line_width( 10 ); plotter->set_default_line_width( 10 );
plotter->set_current_line_width( -1 ); plotter->set_current_line_width( -1 );
// Plot board outlines and drill map // Plot board outlines and drill map
Gen_Drill_PcbMap( aPcb, plotter, aHoleListBuffer, aToolListBuffer ); Gen_Drill_PcbMap( aPcb, plotter, aHoleListBuffer, aToolListBuffer );
@ -193,6 +195,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
plotter->marker( wxPoint( x, y ), plot_diam, ii ); plotter->marker( wxPoint( x, y ), plot_diam, ii );
/* Trace de la legende associee */ /* Trace de la legende associee */
// List the diameter of each drill in the selected Drill Unit, // List the diameter of each drill in the selected Drill Unit,
// and then its diameter in the other Drill Unit. // and then its diameter in the other Drill Unit.
if( aUnit_Drill_is_Inch ) if( aUnit_Drill_is_Inch )
@ -243,7 +246,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
/****************************************************************************************/ /****************************************************************************************/
void Gen_Drill_PcbMap( BOARD* aPcb, Plotter *plotter, void Gen_Drill_PcbMap( BOARD* aPcb, PLOTTER* plotter,
std::vector<HOLE_INFO>& aHoleListBuffer, std::vector<HOLE_INFO>& aHoleListBuffer,
std::vector<DRILL_TOOL>& aToolListBuffer ) std::vector<DRILL_TOOL>& aToolListBuffer )
/****************************************************************************************/ /****************************************************************************************/

View File

@ -85,7 +85,7 @@ void GenDrillMapFile( BOARD* aPcb,
bool aUnit_Drill_is_Inch, bool aUnit_Drill_is_Inch,
int format, const wxPoint& auxoffset ); int format, const wxPoint& auxoffset );
void Gen_Drill_PcbMap( BOARD* aPcb, Plotter* plotter, void Gen_Drill_PcbMap( BOARD* aPcb, PLOTTER* plotter,
std::vector<HOLE_INFO>& aHoleListBuffer, std::vector<HOLE_INFO>& aHoleListBuffer,
std::vector<DRILL_TOOL>& aToolListBuffer); std::vector<DRILL_TOOL>& aToolListBuffer);

View File

@ -577,7 +577,6 @@ void WinEDA_PlotFrame::SetCommands( wxCommandEvent& event )
break; break;
case PLOT_FORMAT_GERBER: case PLOT_FORMAT_GERBER:
m_Drill_Shape_Opt->SetSelection( 0 );
m_Drill_Shape_Opt->Enable( false ); m_Drill_Shape_Opt->Enable( false );
m_PlotModeOpt->SetSelection( 1 ); m_PlotModeOpt->SetSelection( 1 );
m_PlotModeOpt->Enable( false ); m_PlotModeOpt->Enable( false );
@ -600,7 +599,6 @@ void WinEDA_PlotFrame::SetCommands( wxCommandEvent& event )
case PLOT_FORMAT_HPGL: case PLOT_FORMAT_HPGL:
m_PlotMirorOpt->Enable( true ); m_PlotMirorOpt->Enable( true );
m_Drill_Shape_Opt->SetSelection( 0 );
m_Drill_Shape_Opt->Enable( false ); m_Drill_Shape_Opt->Enable( false );
m_PlotModeOpt->Enable( true ); m_PlotModeOpt->Enable( true );
m_Choice_Plot_Offset->Enable( false ); m_Choice_Plot_Offset->Enable( false );
@ -621,7 +619,6 @@ void WinEDA_PlotFrame::SetCommands( wxCommandEvent& event )
case PLOT_FORMAT_DXF: case PLOT_FORMAT_DXF:
m_PlotMirorOpt->Enable( false ); m_PlotMirorOpt->Enable( false );
m_PlotMirorOpt->SetValue( false ); m_PlotMirorOpt->SetValue( false );
m_Drill_Shape_Opt->SetSelection( 0 );
m_Drill_Shape_Opt->Enable( false ); m_Drill_Shape_Opt->Enable( false );
m_PlotModeOpt->Enable( true ); m_PlotModeOpt->Enable( true );
m_Choice_Plot_Offset->Enable( false ); m_Choice_Plot_Offset->Enable( false );

View File

@ -70,29 +70,29 @@ extern PCB_Plot_Options g_pcb_plot_options;
/*************************************/ /*************************************/
/* PLOT_RTN.CC */ /* PLOT_RTN.CC */
void PlotTextePcb( Plotter* plotter, TEXTE_PCB* pt_texte, int masque_layer, void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
GRTraceMode trace_mode ); GRTraceMode trace_mode );
/* 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 texte */ * prepare les parametres de trace de texte */
void PlotDrawSegment( Plotter* plotter, DRAWSEGMENT* PtSegm, int masque_layer, void PlotDrawSegment( PLOTTER* plotter, DRAWSEGMENT* PtSegm, int masque_layer,
GRTraceMode trace_mode ); GRTraceMode trace_mode );
void PlotCotation( Plotter* plotter, COTATION* Cotation, int masque_layer, void PlotCotation( PLOTTER* plotter, COTATION* Cotation, int masque_layer,
GRTraceMode trace_mode ); GRTraceMode trace_mode );
void PlotMirePcb( Plotter* plotter, MIREPCB* PtMire, int masque_layer, void PlotMirePcb( PLOTTER* plotter, MIREPCB* PtMire, int masque_layer,
GRTraceMode trace_mode ); GRTraceMode trace_mode );
void Plot_1_EdgeModule( Plotter* plotter, EDGE_MODULE* PtEdge, void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge,
GRTraceMode trace_mode ); GRTraceMode trace_mode );
void PlotFilledAreas( Plotter* plotter, ZONE_CONTAINER* aZone, void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone,
GRTraceMode trace_mode ); GRTraceMode trace_mode );
/* PLOTGERB.CPP */ /* PLOTGERB.CPP */
void SelectD_CODE_For_LineDraw( Plotter* plotter, int aSize ); void SelectD_CODE_For_LineDraw( PLOTTER* plotter, int aSize );
#endif /* #define PCBPLOT_H */ #endif /* #define PCBPLOT_H */

View File

@ -16,13 +16,13 @@
/* Fonctions locales */ /* Fonctions locales */
static void Plot_Edges_Modules( Plotter* plotter, BOARD* pcb, int masque_layer, static void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int masque_layer,
GRTraceMode trace_mode ); GRTraceMode trace_mode );
static void PlotTextModule( Plotter* plotter, TEXTE_MODULE* pt_texte, static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte,
GRTraceMode trace_mode ); GRTraceMode trace_mode );
/**********************************************************/ /**********************************************************/
void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter* plotter, void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
int masque_layer, GRTraceMode trace_mode ) int masque_layer, GRTraceMode trace_mode )
/***********************************************************/ /***********************************************************/
@ -234,7 +234,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter* plotter,
/********************************************************************/ /********************************************************************/
static void PlotTextModule( Plotter* plotter, TEXTE_MODULE* pt_texte, static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/********************************************************************/ /********************************************************************/
{ {
@ -264,7 +264,7 @@ static void PlotTextModule( Plotter* plotter, TEXTE_MODULE* pt_texte,
/*******************************************************************************/ /*******************************************************************************/
void PlotCotation( Plotter* plotter, COTATION* Cotation, int masque_layer, void PlotCotation( PLOTTER* plotter, COTATION* Cotation, int masque_layer,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/*******************************************************************************/ /*******************************************************************************/
{ {
@ -313,7 +313,7 @@ void PlotCotation( Plotter* plotter, COTATION* Cotation, int masque_layer,
/*****************************************************************/ /*****************************************************************/
void PlotMirePcb( Plotter* plotter, MIREPCB* Mire, int masque_layer, void PlotMirePcb( PLOTTER* plotter, MIREPCB* Mire, int masque_layer,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/*****************************************************************/ /*****************************************************************/
{ {
@ -359,7 +359,7 @@ void PlotMirePcb( Plotter* plotter, MIREPCB* Mire, int masque_layer,
/**********************************************************************/ /**********************************************************************/
void Plot_Edges_Modules( Plotter* plotter, BOARD* pcb, int masque_layer, void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int masque_layer,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/**********************************************************************/ /**********************************************************************/
/* Trace les contours des modules */ /* Trace les contours des modules */
@ -383,7 +383,7 @@ void Plot_Edges_Modules( Plotter* plotter, BOARD* pcb, int masque_layer,
/**************************************************************/ /**************************************************************/
void Plot_1_EdgeModule( Plotter* plotter, EDGE_MODULE* PtEdge, void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/**************************************************************/ /**************************************************************/
/* Trace les contours des modules */ /* Trace les contours des modules */
@ -462,7 +462,7 @@ void Plot_1_EdgeModule( Plotter* plotter, EDGE_MODULE* PtEdge,
/****************************************************************************/ /****************************************************************************/
void PlotTextePcb( Plotter* plotter, TEXTE_PCB* pt_texte, int masque_layer, void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/****************************************************************************/ /****************************************************************************/
/* 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 */
@ -516,7 +516,7 @@ void PlotTextePcb( Plotter* plotter, TEXTE_PCB* pt_texte, int masque_layer,
/*********************************************************/ /*********************************************************/
void PlotFilledAreas( Plotter* plotter, ZONE_CONTAINER* aZone, void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/*********************************************************/ /*********************************************************/
@ -598,7 +598,7 @@ void PlotFilledAreas( Plotter* plotter, ZONE_CONTAINER* aZone,
/******************************************************************************/ /******************************************************************************/
void PlotDrawSegment( Plotter* plotter, DRAWSEGMENT* pt_segm, int masque_layer, void PlotDrawSegment( PLOTTER* plotter, DRAWSEGMENT* pt_segm, int masque_layer,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/******************************************************************************/ /******************************************************************************/
@ -649,7 +649,7 @@ void PlotDrawSegment( Plotter* plotter, DRAWSEGMENT* pt_segm, int masque_layer,
/*********************************************************************/ /*********************************************************************/
void WinEDA_BasePcbFrame::Plot_Layer( Plotter* plotter, int Layer, void WinEDA_BasePcbFrame::Plot_Layer( PLOTTER* plotter, int Layer,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/*********************************************************************/ /*********************************************************************/
{ {
@ -679,6 +679,17 @@ void WinEDA_BasePcbFrame::Plot_Layer( Plotter* plotter, int Layer,
case LAYER_N_15: case LAYER_N_15:
case LAST_COPPER_LAYER: case LAST_COPPER_LAYER:
Plot_Standard_Layer( plotter, layer_mask, 0, true, trace_mode ); Plot_Standard_Layer( plotter, layer_mask, 0, true, trace_mode );
// Adding drill marks, if required and if the plotter is able to plot them:
if( g_pcb_plot_options.DrillShapeOpt != PCB_Plot_Options::NO_DRILL_SHAPE )
{
if( plotter->GetPlotterType() == PLOT_FORMAT_POST )
PlotDrillMark(
plotter,
trace_mode,
g_pcb_plot_options.DrillShapeOpt ==
PCB_Plot_Options::SMALL_DRILL_SHAPE );
}
break; break;
case SOLDERMASK_N_CU: case SOLDERMASK_N_CU:
@ -697,13 +708,11 @@ void WinEDA_BasePcbFrame::Plot_Layer( Plotter* plotter, int Layer,
Plot_Serigraphie( plotter, layer_mask, trace_mode ); Plot_Serigraphie( plotter, layer_mask, trace_mode );
break; break;
} }
PlotDrillMark( plotter, trace_mode );
} }
/*********************************************************************/ /*********************************************************************/
void WinEDA_BasePcbFrame::Plot_Standard_Layer( Plotter* plotter, void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* plotter,
int masque_layer, int masque_layer,
int garde, int garde,
bool trace_via, bool trace_via,
@ -888,14 +897,16 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( Plotter* plotter,
} }
/***********************************************************************************/ /** function PlotDrillMark
void WinEDA_BasePcbFrame::PlotDrillMark( Plotter* plotter, GRTraceMode trace_mode ) * Draw a drill mark for pads and vias.
/***********************************************************************************/
/* Draw a drill mark for pads and vias.
* Must be called after all drawings, because it * Must be called after all drawings, because it
* redraw the drill mark on a pad or via, as a negative (i.e. white) shape * redraw the drill mark on a pad or via, as a negative (i.e. white) shape in FILLED plot mode
* @param aPlotter = the PLOTTER
* @param aTraceMode = the mode of plot (FILLED, SKETCH)
* @param aSmallDrillShape = true to plot a smalle drill shape, false to plot the actual drill shape
*/ */
void WinEDA_BasePcbFrame::PlotDrillMark( PLOTTER* aPlotter, GRTraceMode aTraceMode,
bool aSmallDrillShape )
{ {
const int SMALL_DRILL = 150; const int SMALL_DRILL = 150;
wxPoint pos; wxPoint pos;
@ -904,12 +915,9 @@ void WinEDA_BasePcbFrame::PlotDrillMark( Plotter* plotter, GRTraceMode trace_mod
D_PAD* PtPad; D_PAD* PtPad;
TRACK* pts; TRACK* pts;
if( g_pcb_plot_options.DrillShapeOpt == PCB_Plot_Options::NO_DRILL_SHAPE ) if( aTraceMode == FILLED )
return;
if( trace_mode == FILLED )
{ {
plotter->set_color( WHITE ); aPlotter->set_color( WHITE );
} }
for( pts = m_Pcb->m_Track; pts != NULL; pts = pts->Next() ) for( pts = m_Pcb->m_Track; pts != NULL; pts = pts->Next() )
@ -922,7 +930,7 @@ void WinEDA_BasePcbFrame::PlotDrillMark( Plotter* plotter, GRTraceMode trace_mod
else else
diam.x = diam.y = pts->GetDrillValue(); diam.x = diam.y = pts->GetDrillValue();
plotter->flash_pad_circle( pos, diam.x, trace_mode ); aPlotter->flash_pad_circle( pos, diam.x, aTraceMode );
} }
for( Module = m_Pcb->m_Modules; for( Module = m_Pcb->m_Modules;
@ -941,19 +949,18 @@ void WinEDA_BasePcbFrame::PlotDrillMark( Plotter* plotter, GRTraceMode trace_mod
if( PtPad->m_DrillShape == PAD_OVAL ) if( PtPad->m_DrillShape == PAD_OVAL )
{ {
diam = PtPad->m_Drill; diam = PtPad->m_Drill;
plotter->flash_pad_oval( pos, diam, PtPad->m_Orient, trace_mode ); aPlotter->flash_pad_oval( pos, diam, PtPad->m_Orient, aTraceMode );
} }
else else
{ {
diam.x = (g_pcb_plot_options.DrillShapeOpt == PCB_Plot_Options::SMALL_DRILL_SHAPE) diam.x = aSmallDrillShape ? SMALL_DRILL : PtPad->m_Drill.x;
? SMALL_DRILL : PtPad->m_Drill.x; aPlotter->flash_pad_circle( pos, diam.x, aTraceMode );
plotter->flash_pad_circle( pos, diam.x, trace_mode );
} }
} }
} }
if( trace_mode == FILLED ) if( aTraceMode == FILLED )
{ {
plotter->set_color( BLACK ); aPlotter->set_color( BLACK );
} }
} }

View File

@ -32,7 +32,7 @@ void WinEDA_BasePcbFrame::Genere_DXF( const wxString& FullFileName, int Layer,
SetLocaleTo_C_standard(); SetLocaleTo_C_standard();
Affiche_1_Parametre( this, 0, _( "File" ), FullFileName, CYAN ); Affiche_1_Parametre( this, 0, _( "File" ), FullFileName, CYAN );
DXF_Plotter* plotter = new DXF_Plotter(); DXF_PLOTTER* plotter = new DXF_PLOTTER();
plotter->set_paper_size( currentsheet ); plotter->set_paper_size( currentsheet );
plotter->set_viewport( wxPoint(0,0), 1, 0 ); plotter->set_viewport( wxPoint(0,0), 1, 0 );
plotter->set_creator( wxT( "PCBNEW-DXF" ) ); plotter->set_creator( wxT( "PCBNEW-DXF" ) );

View File

@ -58,7 +58,7 @@ void WinEDA_BasePcbFrame::Genere_GERBER( const wxString& FullFileName, int Layer
} }
SetLocaleTo_C_standard(); SetLocaleTo_C_standard();
Plotter* plotter = new Gerber_Plotter(); PLOTTER* plotter = new GERBER_PLOTTER();
/* No mirror and scaling for gerbers! */ /* No mirror and scaling for gerbers! */
plotter->set_viewport( offset, scale, 0 ); plotter->set_viewport( offset, scale, 0 );
plotter->set_default_line_width( g_pcb_plot_options.PlotLine_Width ); plotter->set_default_line_width( g_pcb_plot_options.PlotLine_Width );

View File

@ -89,7 +89,7 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
offset.y = 0; offset.y = 0;
} }
HPGL_Plotter* plotter = new HPGL_Plotter(); HPGL_PLOTTER* plotter = new HPGL_PLOTTER();
plotter->set_paper_size( currentsheet ); plotter->set_paper_size( currentsheet );
plotter->set_viewport( offset, scale, plotter->set_viewport( offset, scale,
g_pcb_plot_options.PlotOrient ); g_pcb_plot_options.PlotOrient );

View File

@ -98,7 +98,7 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
offset.y = 0; offset.y = 0;
} }
PS_Plotter* plotter = new PS_Plotter(); PS_PLOTTER* plotter = new PS_PLOTTER();
plotter->set_paper_size( SheetPS ); plotter->set_paper_size( SheetPS );
plotter->set_scale_adjust( g_pcb_plot_options.ScaleAdjX, plotter->set_scale_adjust( g_pcb_plot_options.ScaleAdjX,
g_pcb_plot_options.ScaleAdjY ); g_pcb_plot_options.ScaleAdjY );