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
block_commande.cpp
class_marker_base.cpp
class_plotter.cpp
class_undoredo_container.cpp
common.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"
/***********************************************************************************/
void DXF_Plotter::set_viewport( wxPoint offset,
void DXF_PLOTTER::set_viewport( wxPoint offset,
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 );
@ -54,7 +54,7 @@ void DXF_Plotter::start_plot( FILE* fout )
/**********************************/
void DXF_Plotter::end_plot()
void DXF_PLOTTER::end_plot()
/**********************************/
{
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 );
@ -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 );
@ -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
@ -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 */
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 )
/** 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 )
/********************************************************************/
@ -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 )
/************************************************************************************/
/* 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 )
/*******************************************************************************/
/* 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 )
/**************************************************************************/
@ -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 )
/*******************************************************************/

View File

@ -14,7 +14,7 @@
/***************************************************************************/
void Gerber_Plotter::set_viewport( wxPoint offset,
void GERBER_PLOTTER::set_viewport( wxPoint offset,
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
@ -70,7 +70,7 @@ void Gerber_Plotter::start_plot( FILE* aFile )
/******************************************************************/
void Gerber_Plotter::end_plot()
void GERBER_PLOTTER::end_plot()
/*****************************************************************/
{
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
@ -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
@ -127,20 +127,20 @@ void Gerber_Plotter::set_current_line_width( int width )
else
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;
}
/******************************************************/
vector<Aperture>::iterator Gerber_Plotter::get_aperture( const wxSize& size,
Aperture::Aperture_Type type )
std::vector<APERTURE>::iterator GERBER_PLOTTER::get_aperture( const wxSize& size,
APERTURE::Aperture_Type type )
/******************************************************/
{
int last_D_code = 9;
// Search an existing aperture
vector<Aperture>::iterator tool = apertures.begin();
std::vector<APERTURE>::iterator tool = apertures.begin();
while( tool != apertures.end() )
{
last_D_code = tool->D_code;
@ -151,7 +151,7 @@ vector<Aperture>::iterator Gerber_Plotter::get_aperture( const wxSize&
}
// Allocate a new aperture
Aperture new_tool;
APERTURE new_tool;
new_tool.size = size;
new_tool.type = type;
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 );
@ -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
@ -189,7 +189,7 @@ void Gerber_Plotter::write_aperture_list()
char cbuf[1024];
/* Init : */
for( vector<Aperture>::iterator tool = apertures.begin();
for( std::vector<APERTURE>::iterator tool = apertures.begin();
tool != apertures.end(); tool++ )
{
const float fscale = 0.0001f * plot_scale; // For 3.4 format
@ -199,20 +199,20 @@ void Gerber_Plotter::write_aperture_list()
switch( tool->type )
{
case Aperture::Circle:
case APERTURE::Circle:
sprintf( text, "C,%f*%%\n", tool->size.x * fscale );
break;
case Aperture::Rect:
case APERTURE::Rect:
sprintf( text, "R,%fX%f*%%\n", tool->size.x * fscale,
tool->size.y * fscale );
break;
case Aperture::Plotting:
case APERTURE::Plotting:
sprintf( text, "C,%f*%%\n", tool->size.x * fscale );
break;
case Aperture::Oval:
case APERTURE::Oval:
sprintf( text, "O,%fX%f*%%\n", tool->size.x * fscale,
tool->size.y * fscale );
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 );
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 );
@ -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
@ -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
@ -338,7 +338,7 @@ void Gerber_Plotter::poly( int aCornersCount, int* aCoord, FILL_T aFill, int aWi
/* Function flash_pad_circle
* Plot a circular pad or via at the user position pos
*/
void Gerber_Plotter::flash_pad_circle( wxPoint pos, int diametre,
void GERBER_PLOTTER::flash_pad_circle( wxPoint pos, int diametre,
GRTraceMode trace_mode )
{
wxASSERT( output_file );
@ -354,14 +354,14 @@ void Gerber_Plotter::flash_pad_circle( wxPoint pos, int diametre,
case FILLED:
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 );
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 )
/* 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 */
EXCHG( size.x, size.y );
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 );
}
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 )
/* Plot 1 rectangular pad
@ -449,7 +449,7 @@ void Gerber_Plotter::flash_pad_rect( wxPoint pos, wxSize size,
case FILLED:
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 );
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 )
/* Trace 1 pad trapezoidal donne par :

View File

@ -15,8 +15,7 @@
const double SCALE_HPGL = 0.102041;
/***********************************************************************************/
void HPGL_Plotter::set_viewport( wxPoint offset,
double aScale, int orient )
void HPGL_PLOTTER::set_viewport( wxPoint offset, double aScale, int orient )
/***********************************************************************************/
/* 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);
@ -40,7 +39,7 @@ void HPGL_Plotter::start_plot( FILE *fout )
}
/**********************************/
void HPGL_Plotter::end_plot()
void HPGL_PLOTTER::end_plot()
/**********************************/
{
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);
@ -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);
@ -71,12 +70,12 @@ void HPGL_Plotter::circle( wxPoint centre, int diameter, FILL_T fill, int width
{
move_to(centre);
fprintf( output_file, "CI %g;\n", rayon);
pen_finish();
pen_finish();
}
}
/*****************************************************/
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
@ -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
@ -120,7 +119,7 @@ void HPGL_Plotter::pen_control( int plume )
}
break;
case 'D':
if( pen_state != 'D' )
if( pen_state != 'D' )
{
fputs( "PD;", output_file );
pen_state = 'D';
@ -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 )
/**********************************************/
/*
@ -156,11 +155,11 @@ void HPGL_Plotter::pen_to( wxPoint pos, char plume )
user_to_device_coordinates( pos );
if (pen_lastpos != pos)
fprintf( output_file, "PA %d,%d;\n", pos.x, pos.y );
fprintf( output_file, "PA %d,%d;\n", pos.x, pos.y );
pen_lastpos = pos;
}
void HPGL_Plotter::set_dash( bool dashed )
void HPGL_PLOTTER::set_dash( bool dashed )
{
wxASSERT(output_file);
if (dashed)
@ -169,7 +168,7 @@ void HPGL_Plotter::set_dash( bool dashed )
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)
/** Function Plot a filled segment (track)
* @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 )
/********************************************************************/
@ -213,7 +212,7 @@ void HPGL_Plotter::arc( wxPoint centre, int StAngle, int EndAngle, int rayon,
if( rayon <= 0 )
return;
cpos = centre;
cpos = centre;
user_to_device_coordinates( cpos );
if( plot_orient_options == PLOT_MIROIR )
@ -226,13 +225,13 @@ void HPGL_Plotter::arc( wxPoint centre, int StAngle, int EndAngle, int rayon,
user_to_device_coordinates( cmap );
fprintf( output_file, "PU;PA %d,%d;PD;AA %d,%d, ", cmap.x, cmap.y, cpos.x, cpos.y );
fprintf( output_file, "%f", angle );
fprintf( output_file, "%f", angle );
fprintf( output_file, ";PU;\n" );
pen_finish();
}
/***********************************************************************************/
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 )
/************************************************************************************/
/* 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)
/*******************************************************************************/
/* 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)
/**************************************************************************/
/*
@ -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 )
/*******************************************************************/
/*

View File

@ -12,7 +12,7 @@
#include "kicad_string.h"
/*************************************************************************************/
void PS_Plotter::set_viewport( wxPoint offset,
void PS_PLOTTER::set_viewport( wxPoint offset,
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
@ -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
@ -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:
@ -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);
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 );
@ -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);
@ -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 )
/**************************************************************************************/
@ -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
@ -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
@ -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)
@ -378,7 +378,7 @@ void PS_Plotter::start_plot( FILE *fout)
}
/******************************************/
void PS_Plotter::end_plot()
void PS_PLOTTER::end_plot()
/******************************************/
{
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 )
/************************************************************************************/
@ -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)
/*******************************************************************************/
/* 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)
/**************************************************************************/
/*
@ -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 )
/*******************************************************************/
/*

View File

@ -15,30 +15,30 @@
#include "drawtxt.h"
/**************************************************************************/
void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
void WinEDA_DrawFrame::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
/**************************************************************************/
/* Plot sheet references
* margin is in mils (1/1000 inch)
* margin is in mils (1/1000 inch)
*/
{
#define WSTEXTSIZE 50 // Text size in mils
Ki_PageDescr* Sheet = screen->m_CurrentSheetDesc;
int xg, yg, ipas, gxpas, gypas;
wxSize PageSize;
wxPoint pos, ref;
EDA_Colors color;
int conv_unit = screen->GetInternalUnits() / 1000; /* Scale to convert dimension in 1/1000 in into internal units
* (1/1000 inc for EESchema, 1/10000 for pcbnew */
wxString msg;
wxSize text_size;
int UpperLimit = VARIABLE_BLOCK_START_POSITION;
bool italic = false;
bool bold = false;
bool thickness = 0; //@todo : use current pen
Ki_PageDescr* Sheet = screen->m_CurrentSheetDesc;
int xg, yg, ipas, gxpas, gypas;
wxSize PageSize;
wxPoint pos, ref;
EDA_Colors color;
int conv_unit = screen->GetInternalUnits() / 1000; /* Scale to convert dimension in 1/1000 in into internal units
* (1/1000 inc for EESchema, 1/10000 for pcbnew */
wxString msg;
wxSize text_size;
int UpperLimit = VARIABLE_BLOCK_START_POSITION;
bool italic = false;
bool bold = false;
bool thickness = 0; //@todo : use current pen
color = BLACK;
plotter->set_color(color);
plotter->set_color( color );
PageSize.x = Sheet->m_Size.x;
PageSize.y = Sheet->m_Size.y;
@ -69,11 +69,12 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
pos.x = ref.x; pos.y = yg;
plotter->line_to( pos );
plotter->finish_to( ref );
ref.x += GRID_REF_W * conv_unit;
ref.y += GRID_REF_W * conv_unit;
xg -= GRID_REF_W * conv_unit;
yg -= GRID_REF_W * conv_unit;
ref.x += GRID_REF_W * conv_unit;
ref.y += GRID_REF_W * conv_unit;
xg -= GRID_REF_W * conv_unit;
yg -= GRID_REF_W * conv_unit;
}
#endif
/* trace des reperes */
@ -86,84 +87,89 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
yg = (PageSize.y - Sheet->m_BottomMargin); /* lower right corner in 1/1000 inch */
#if defined(KICAD_GOST)
for ( Ki_WorkSheetData* WsItem = &WS_Segm1_LU;
WsItem != NULL;
WsItem = WsItem->Pnext )
for( Ki_WorkSheetData* WsItem = &WS_Segm1_LU;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
pos.x = (ref.x - WsItem->m_Posx) * conv_unit;
pos.y = (yg - WsItem->m_Posy) * conv_unit;
msg.Empty();
switch( WsItem->m_Type )
{
case WS_CADRE:
break;
case WS_PODPIS_LU:
if(WsItem->m_Legende) msg = WsItem->m_Legende;
plotter->text( pos, color,
msg, TEXT_ORIENT_VERT, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
thickness, italic, false );
break;
case WS_SEGMENT_LU:
plotter->move_to(pos);
pos.x = (ref.x - WsItem->m_Endx) * conv_unit;
pos.y = (yg - WsItem->m_Endy) * conv_unit;
plotter->finish_to(pos);
break;
}
pos.x = (ref.x - WsItem->m_Posx) * conv_unit;
pos.y = (yg - WsItem->m_Posy) * conv_unit;
msg.Empty();
switch( WsItem->m_Type )
{
case WS_CADRE:
break;
case WS_PODPIS_LU:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
plotter->text( pos, color,
msg, TEXT_ORIENT_VERT, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
thickness, italic, false );
break;
case WS_SEGMENT_LU:
plotter->move_to( pos );
pos.x = (ref.x - WsItem->m_Endx) * conv_unit;
pos.y = (yg - WsItem->m_Endy) * conv_unit;
plotter->finish_to( pos );
break;
}
}
for ( Ki_WorkSheetData* WsItem = &WS_Segm1_LT;
WsItem != NULL;
WsItem = WsItem->Pnext )
for( Ki_WorkSheetData* WsItem = &WS_Segm1_LT;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
pos.x = (ref.x + WsItem->m_Posx) * conv_unit;
pos.y = (ref.y + WsItem->m_Posy) * conv_unit;
msg.Empty();
switch( WsItem->m_Type )
{
case WS_SEGMENT_LT:
plotter->move_to(pos);
pos.x = (ref.x + WsItem->m_Endx) * conv_unit;
pos.y = (ref.y + WsItem->m_Endy) * conv_unit;
plotter->finish_to(pos);
break;
}
pos.x = (ref.x + WsItem->m_Posx) * conv_unit;
pos.y = (ref.y + WsItem->m_Posy) * conv_unit;
msg.Empty();
switch( WsItem->m_Type )
{
case WS_SEGMENT_LT:
plotter->move_to( pos );
pos.x = (ref.x + WsItem->m_Endx) * conv_unit;
pos.y = (ref.y + WsItem->m_Endy) * conv_unit;
plotter->finish_to( pos );
break;
}
}
#else
/* Trace des reperes selon l'axe X */
ipas = (xg - ref.x) / PAS_REF;
gxpas = ( xg - ref.x) / ipas;
for(int ii = ref.x + gxpas, jj = 1; ipas > 0; ii += gxpas, jj++, ipas-- )
for( int ii = ref.x + gxpas, jj = 1; ipas > 0; ii += gxpas, jj++, ipas-- )
{
msg.Empty(); msg << jj;
if( ii < xg - PAS_REF / 2 )
{
pos.x = ii * conv_unit; pos.y = ref.y * conv_unit;
plotter->move_to(pos);
plotter->move_to( pos );
pos.x = ii * conv_unit; pos.y = (ref.y + GRID_REF_W) * conv_unit;
plotter->finish_to(pos);
plotter->finish_to( pos );
}
pos.x = (ii - gxpas / 2) * conv_unit;
pos.y = (ref.y + GRID_REF_W / 2) * conv_unit;
plotter->text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
if( ii < xg - PAS_REF / 2 )
{
pos.x = ii * conv_unit; pos.y = yg * conv_unit;
plotter->move_to( pos);
plotter->move_to( pos );
pos.x = ii * conv_unit; pos.y = (yg - GRID_REF_W) * conv_unit;
plotter->finish_to(pos);
plotter->finish_to( pos );
}
pos.x = (ii - gxpas / 2) * conv_unit;
pos.y = (yg - GRID_REF_W / 2) * conv_unit;
plotter->text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
}
/* Trace des reperes selon l'axe Y */
@ -178,30 +184,31 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
if( ii < yg - PAS_REF / 2 )
{
pos.x = ref.x * conv_unit; pos.y = ii * conv_unit;
plotter->move_to(pos);
plotter->move_to( pos );
pos.x = (ref.x + GRID_REF_W) * conv_unit; pos.y = ii * conv_unit;
plotter->finish_to(pos);
plotter->finish_to( pos );
}
pos.x = (ref.x + GRID_REF_W / 2) * conv_unit;
pos.y = (ii - gypas / 2) * conv_unit;
plotter->text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
if( ii < yg - PAS_REF / 2 )
{
pos.x = xg * conv_unit; pos.y = ii * conv_unit;
plotter->move_to(pos);
plotter->move_to( pos );
pos.x = (xg - GRID_REF_W) * conv_unit; pos.y = ii * conv_unit;
plotter->finish_to(pos);
plotter->finish_to( pos );
}
pos.x = (xg - GRID_REF_W / 2) * conv_unit;
pos.y = (ii - gypas / 2) * conv_unit;
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
}
#endif
/* Trace du cartouche */
@ -210,113 +217,135 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
#if defined(KICAD_GOST)
ref.x = PageSize.x - Sheet->m_RightMargin;
ref.y = PageSize.y - Sheet->m_BottomMargin;
if (screen->m_ScreenNumber == 1)
if( screen->m_ScreenNumber == 1 )
{
for(Ki_WorkSheetData* WsItem = &WS_Date;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
pos.x = (ref.x - WsItem->m_Posx) * conv_unit;
pos.y = (ref.y - WsItem->m_Posy) * conv_unit;
msg.Empty();
switch( WsItem->m_Type )
{
case WS_DATE:
break;
case WS_REV:
break;
case WS_KICAD_VERSION:
break;
case WS_PODPIS:
if(WsItem->m_Legende) msg = WsItem->m_Legende;
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ,text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
break;
case WS_SIZESHEET:
break;
case WS_IDENTSHEET:
if(WsItem->m_Legende) msg = WsItem->m_Legende;
msg << screen->m_ScreenNumber;
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ,text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
break;
case WS_SHEETS:
if(WsItem->m_Legende) msg = WsItem->m_Legende;
msg << screen->m_NumberOfScreen;
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
break;
case WS_COMPANY_NAME:
break;
case WS_TITLE:
break;
case WS_COMMENT1:
break;
case WS_COMMENT2:
break;
case WS_COMMENT3:
break;
case WS_COMMENT4:
break;
case WS_UPPER_SEGMENT:
case WS_LEFT_SEGMENT:
case WS_SEGMENT:
plotter->move_to(pos);
pos.x = (ref.x - WsItem->m_Endx) * conv_unit;
pos.y = (ref.y - WsItem->m_Endy) * conv_unit;
plotter->finish_to(pos);
break;
}
}
} else {
for(Ki_WorkSheetData* WsItem = &WS_CADRE_D;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
pos.x = (ref.x - WsItem->m_Posx) * conv_unit;
pos.y = (ref.y - WsItem->m_Posy) * conv_unit;
msg.Empty();
switch( WsItem->m_Type )
{
case WS_CADRE:
/* Begin list number > 1 */
case WS_PODPIS_D:
if(WsItem->m_Legende) msg = WsItem->m_Legende;
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
break;
case WS_IDENTSHEET_D:
if(WsItem->m_Legende) msg = WsItem->m_Legende;
msg << screen->m_ScreenNumber;
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
break;
case WS_LEFT_SEGMENT_D:
case WS_SEGMENT_D:
plotter->move_to(pos);
pos.x = (ref.x - WsItem->m_Endx) * conv_unit;
pos.y = (ref.y - WsItem->m_Endy) * conv_unit;
plotter->finish_to(pos);
break;
}
}
for( Ki_WorkSheetData* WsItem = &WS_Date;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
pos.x = (ref.x - WsItem->m_Posx) * conv_unit;
pos.y = (ref.y - WsItem->m_Posy) * conv_unit;
msg.Empty();
switch( WsItem->m_Type )
{
case WS_DATE:
break;
case WS_REV:
break;
case WS_KICAD_VERSION:
break;
case WS_PODPIS:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
break;
case WS_SIZESHEET:
break;
case WS_IDENTSHEET:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg << screen->m_ScreenNumber;
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
break;
case WS_SHEETS:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg << screen->m_NumberOfScreen;
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
break;
case WS_COMPANY_NAME:
break;
case WS_TITLE:
break;
case WS_COMMENT1:
break;
case WS_COMMENT2:
break;
case WS_COMMENT3:
break;
case WS_COMMENT4:
break;
case WS_UPPER_SEGMENT:
case WS_LEFT_SEGMENT:
case WS_SEGMENT:
plotter->move_to( pos );
pos.x = (ref.x - WsItem->m_Endx) * conv_unit;
pos.y = (ref.y - WsItem->m_Endy) * conv_unit;
plotter->finish_to( pos );
break;
}
}
}
else
{
for( Ki_WorkSheetData* WsItem = &WS_CADRE_D;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
pos.x = (ref.x - WsItem->m_Posx) * conv_unit;
pos.y = (ref.y - WsItem->m_Posy) * conv_unit;
msg.Empty();
switch( WsItem->m_Type )
{
case WS_CADRE:
/* Begin list number > 1 */
case WS_PODPIS_D:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
break;
case WS_IDENTSHEET_D:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg << screen->m_ScreenNumber;
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
break;
case WS_LEFT_SEGMENT_D:
case WS_SEGMENT_D:
plotter->move_to( pos );
pos.x = (ref.x - WsItem->m_Endx) * conv_unit;
pos.y = (ref.y - WsItem->m_Endy) * conv_unit;
plotter->finish_to( pos );
break;
}
}
}
#else
ref.x = PageSize.x - GRID_REF_W - Sheet->m_RightMargin;
ref.y = PageSize.y - GRID_REF_W - Sheet->m_BottomMargin;
for (Ki_WorkSheetData* WsItem = &WS_Date;
WsItem != NULL;
WsItem = WsItem->Pnext )
for( Ki_WorkSheetData* WsItem = &WS_Date;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
pos.x = (ref.x - WsItem->m_Posx) * conv_unit;
pos.y = (ref.y - WsItem->m_Posy) * conv_unit;
bold = false;
bold = false;
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
else
@ -326,12 +355,12 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
{
case WS_DATE:
msg += screen->m_Date;
bold = true;
bold = true;
break;
case WS_REV:
msg += screen->m_Revision;
bold = true;
bold = true;
break;
case WS_KICAD_VERSION:
@ -352,7 +381,7 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
wxFileName::SplitPath( screen->m_FileName, (wxString*) NULL, &fname, &fext );
msg << fname << wxT( "." ) << fext;
}
break;
break;
case WS_FULLSHEETNAME:
msg += GetScreenDesc();
@ -362,12 +391,12 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
msg += screen->m_Company;
if( !msg.IsEmpty() )
UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT );
bold = true;
bold = true;
break;
case WS_TITLE:
msg += screen->m_Title;
bold = true;
bold = true;
break;
case WS_COMMENT1:
@ -409,393 +438,21 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
wxPoint auxpos;
auxpos.x = (ref.x - WsItem->m_Endx) * conv_unit;;
auxpos.y = (ref.y - WsItem->m_Endy) * conv_unit;;
plotter->move_to( pos );
plotter->finish_to( auxpos );
plotter->move_to( pos );
plotter->finish_to( auxpos );
}
break;
break;
}
if( !msg.IsEmpty() )
{
plotter->text( pos, color,
msg.GetData(), TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, bold );
plotter->text( pos, color,
msg.GetData(), TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, bold );
}
}
#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,
wxPoint* coord,
void (* aCallback)(int x0, int y0, int xf, int yf ),
Plotter *plotter )
PLOTTER *plotter )
{
if( plotter )
{
@ -242,7 +242,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
bool aItalic,
bool aBold,
void (* aCallback)( int x0, int y0, int xf, int yf ),
Plotter *plotter )
PLOTTER *plotter )
/****************************************************************************************************/
{
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)
*/
/******************************************************************************************/
void Plotter::text( const wxPoint& aPos,
void PLOTTER::text( const wxPoint& aPos,
enum EDA_Colors aColor,
const wxString& aText,
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 *
* the opposite direction to x2,y2), otherwise all is drawn outside. *
*****************************************************************************/
void LibDrawPin::PlotPinTexts( Plotter *plotter,
void LibDrawPin::PlotPinTexts( PLOTTER *plotter,
wxPoint& pin_pos,
int orient,
int TextInside,

View File

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

View File

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

View File

@ -16,17 +16,17 @@
#include "protos.h"
/* Local Variables : */
static void Plot_Hierarchical_PIN_Sheet( Plotter* plotter,
static void Plot_Hierarchical_PIN_Sheet( PLOTTER* plotter,
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 );
static void PlotPinSymbol( Plotter* plotter, const wxPoint& pos,
static void PlotPinSymbol( PLOTTER* plotter, const wxPoint& pos,
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" ..
@ -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 */
{
@ -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 )
/**************************************************************/
@ -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 )
/**************************************************************************/
@ -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 )
/****************************************************************************************/
@ -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 */
{
@ -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 */

View File

@ -370,7 +370,7 @@ void WinEDA_PlotDXFFrame::PlotOneSheetDXF( const wxString& FileName,
msg.Printf( _( "Plot: %s\n" ), FileName.GetData() );
m_MsgBox->AppendText( msg );
DXF_Plotter *plotter = new DXF_Plotter();
DXF_PLOTTER *plotter = new DXF_PLOTTER();
plotter->set_paper_size(sheet);
plotter->set_viewport( plot_offset, scale, 0);
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() );
m_MsgBox->AppendText( msg );
HPGL_Plotter *plotter = new HPGL_Plotter();
HPGL_PLOTTER *plotter = new HPGL_PLOTTER();
plotter->set_paper_size(sheet);
plotter->set_viewport( offset, plot_scale, 0);
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() );
m_MsgBox->AppendText( msg );
PS_Plotter *plotter = new PS_Plotter();
PS_PLOTTER *plotter = new PS_PLOTTER();
plotter->set_paper_size(sheet);
plotter->set_viewport( plot_offset, scale, 0);
plotter->set_default_line_width( g_DrawDefaultLineThickness );

View File

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

View File

@ -10,7 +10,7 @@
#include "base_struct.h"
class WinEDA_DrawPanel;
class Plotter;
class PLOTTER;
/** Function Clamp_Text_PenSize
*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 aBold,
void (*aCallback)( int x0, int y0, int xf, int yf ) = NULL,
Plotter * plotter = NULL );
PLOTTER * plotter = NULL );
#endif /* __INCLUDE__DRAWTXT_H__ */

View File

@ -9,7 +9,6 @@
#define __INCLUDE__PLOT_COMMON_H__ 1
#include <vector>
using namespace std;
#include "drawtxt.h"
/**
@ -25,24 +24,14 @@ enum PlotFormat {
const int PLOT_MIROIR = 1;
class Plotter
class PLOTTER
{
public:
Plotter()
{
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;
}
PlotFormat m_PlotType; // type of plot
public:
PLOTTER( PlotFormat aPlotType );
virtual ~Plotter()
virtual ~PLOTTER()
{
/* Emergency cleanup */
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 end_plot() = 0;
@ -198,9 +193,13 @@ protected:
wxSize paper_size;
};
class HPGL_Plotter : public Plotter
class HPGL_PLOTTER : public PLOTTER
{
public:
HPGL_PLOTTER() : PLOTTER(PLOT_FORMAT_HPGL)
{
}
virtual void start_plot( FILE* fout );
virtual void end_plot();
@ -270,16 +269,15 @@ protected:
double pen_overlap;
};
class PS_Plotter : public Plotter
class PS_PLOTTER : public PLOTTER
{
public:
PS_Plotter()
PS_PLOTTER() : PLOTTER(PLOT_FORMAT_POST)
{
plot_scale_adjX = 1;
plot_scale_adjY = 1;
}
virtual void start_plot( FILE* fout );
virtual void end_plot();
virtual void set_current_line_width( int width );
@ -318,7 +316,7 @@ protected:
/* 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
struct Aperture
struct APERTURE
{
enum Aperture_Type {
Circle = 1,
@ -335,10 +333,10 @@ struct Aperture
* tool change? */
};
class Gerber_Plotter : public Plotter
class GERBER_PLOTTER : public PLOTTER
{
public:
Gerber_Plotter()
GERBER_PLOTTER() : PLOTTER(PLOT_FORMAT_GERBER)
{
work_file = 0;
final_file = 0;
@ -346,45 +344,50 @@ public:
}
virtual void start_plot( FILE* fout );
virtual void end_plot();
virtual void set_current_line_width( int width );
virtual void set_default_line_width( int width );
virtual void start_plot( FILE* fout );
virtual void end_plot();
virtual void set_current_line_width( int width );
virtual void set_default_line_width( int width );
/* RS274X has no dashing, nor colours */
virtual void set_dash( bool dashed ) {};
virtual void set_color( int color ) {};
virtual void set_viewport( wxPoint offset,
double scale, int orient );
virtual void rect( wxPoint p1, wxPoint p2, FILL_T fill, int width = -1 );
virtual void circle( wxPoint pos, int diametre, FILL_T fill, int width = -1 );
virtual void poly( int nb_segm, int* coord, FILL_T fill, int width = -1 );
virtual void pen_to( wxPoint pos, char plume );
virtual void flash_pad_circle( wxPoint pos, int diametre,
GRTraceMode trace_mode );
virtual void flash_pad_oval( wxPoint pos, wxSize size, int orient,
GRTraceMode trace_mode );
virtual void flash_pad_rect( wxPoint pos, wxSize size,
int orient, GRTraceMode trace_mode );
virtual void flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta,
int orient, GRTraceMode trace_mode );
virtual void set_viewport( wxPoint offset,
double scale, int orient );
virtual void rect( wxPoint p1, wxPoint p2, FILL_T fill, int width = -1 );
virtual void circle( wxPoint pos, int diametre, FILL_T fill, int width = -1 );
virtual void poly( int nb_segm, int* coord, FILL_T fill, int width = -1 );
virtual void pen_to( wxPoint pos, char plume );
virtual void flash_pad_circle( wxPoint pos, int diametre,
GRTraceMode trace_mode );
virtual void flash_pad_oval( wxPoint pos, wxSize size, int orient,
GRTraceMode trace_mode );
virtual void flash_pad_rect( wxPoint pos, wxSize size,
int orient, GRTraceMode trace_mode );
virtual void flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta,
int orient, GRTraceMode trace_mode );
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,
Aperture::Aperture_Type type );
std::vector<APERTURE>::iterator get_aperture( const wxSize& size,
APERTURE::Aperture_Type type );
FILE* work_file, * final_file;
void write_aperture_list();
FILE* work_file, * final_file;
void write_aperture_list();
vector<Aperture> apertures;
vector<Aperture>::iterator current_aperture;
std::vector<APERTURE> apertures;
std::vector<APERTURE>::iterator current_aperture;
};
class DXF_Plotter : public Plotter
class DXF_PLOTTER : public PLOTTER
{
public:
DXF_PLOTTER() : PLOTTER(PLOT_FORMAT_DXF)
{
}
virtual void start_plot( FILE* fout );
virtual void end_plot();
@ -394,10 +397,10 @@ public:
/* Handy override */
current_pen_width = 0;
};
virtual void set_default_line_width( int width )
virtual void set_default_line_width( int width )
{
/* DXF lines are infinitesimal */
default_pen_width = 0;
/* DXF lines are infinitesimal */
default_pen_width = 0;
};
virtual void set_dash( bool dashed );
@ -423,7 +426,7 @@ public:
int orient, GRTraceMode trace_mode );
protected:
int current_color;
int current_color;
};
#endif /* __INCLUDE__PLOT_COMMON_H__ */

View File

@ -53,11 +53,11 @@ public:
bool m_DisplayPadFill; // How show pads
bool m_DisplayPadNum; // show pads numbers
int m_DisplayModEdge; // How show module drawings
int m_DisplayModText; // How show module texts
int m_DisplayModEdge; // How show module drawings
int m_DisplayModText; // How show module texts
bool m_DisplayPcbTrackFill; /* FALSE : tracks are show in sketch mode, TRUE = filled */
int m_UserGridUnits;
wxRealPoint m_UserGridSize;
wxRealPoint m_UserGridSize;
WinEDA3D_DrawFrame* m_Draw3DFrame;
WinEDA_ModuleEditFrame* m_ModuleEditFrame;
@ -90,25 +90,26 @@ public:
// General
virtual void OnCloseWindow( wxCloseEvent& Event ) = 0;
virtual void OnCloseWindow( wxCloseEvent& Event ) = 0;
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) { }
virtual void ReCreateHToolbar() = 0;
virtual void ReCreateVToolbar() = 0;
virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0;
virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) = 0;
virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
virtual void ReCreateMenuBar();
virtual void SetToolID( int id, int new_cursor_id,
const wxString& title );
virtual void UpdateStatusBar();
virtual void ReCreateHToolbar() = 0;
virtual void ReCreateVToolbar() = 0;
virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0;
virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) = 0;
virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
virtual void ReCreateMenuBar();
virtual void SetToolID( int id, int new_cursor_id,
const wxString& title );
virtual void UpdateStatusBar();
PCB_SCREEN* GetScreen() const { return (PCB_SCREEN*) WinEDA_DrawFrame::GetBaseScreen(); }
BASE_SCREEN* GetBaseScreen() const;
BASE_SCREEN* GetBaseScreen() const;
int BestZoom();
int BestZoom();
virtual void Show3D_Frame( wxCommandEvent& event );
virtual void Show3D_Frame( wxCommandEvent& event );
public:
@ -199,7 +200,9 @@ public:
MODULE* module,
int angle,
bool incremental );
void Place_Module( MODULE* module, wxDC* DC, bool aDoNotRecreateRatsnest = false );
void Place_Module( MODULE* module,
wxDC* DC,
bool aDoNotRecreateRatsnest = false );
// module texts
void RotateTextModule( TEXTE_MODULE* Text, wxDC* DC );
@ -223,6 +226,7 @@ public:
// loading footprints
/** function Get_Librairie_Module
*
* Read active libraries or one library to find and load a given module
@ -233,9 +237,9 @@ public:
* @return a MODULE * pointer to the new module, or NULL
*
*/
MODULE* Get_Librairie_Module( const wxString& aLibraryFullFilename,
const wxString& aModuleName,
bool aDisplayMessageError );
MODULE* Get_Librairie_Module( const wxString& aLibraryFullFilename,
const wxString& aModuleName,
bool aDisplayMessageError );
/** Function Select_1_Module_From_List
* Display a list of modules found in active libraries or a given library
@ -246,57 +250,68 @@ public:
*
* @return wxEmptyString if abort or fails, or the selected module name if Ok
*/
wxString Select_1_Module_From_List(
wxString Select_1_Module_From_List(
WinEDA_DrawFrame* active_window, const wxString& aLibraryFullFilename,
const wxString& aMask, const wxString& aKeyWord );
MODULE* Load_Module_From_Library( const wxString& library, wxDC* DC );
MODULE* Load_Module_From_Library( const wxString& library, wxDC* DC );
// ratsnest functions
void Compile_Ratsnest( wxDC* DC, bool affiche ); /* Recalcul complet du chevelu */
int Test_1_Net_Ratsnest( wxDC* DC, int net_code );
void build_ratsnest_module( wxDC* DC, MODULE* Module );
void trace_ratsnest_module( wxDC* DC );
void Build_Board_Ratsnest( wxDC* DC );
void DrawGeneralRatsnest( wxDC* DC, int net_code = 0 );
void trace_ratsnest_pad( wxDC* DC );
void build_ratsnest_pad( BOARD_ITEM* ref,
const wxPoint& refpos,
bool init );
void Compile_Ratsnest( wxDC* DC, bool affiche ); /* Recalcul complet du chevelu */
int Test_1_Net_Ratsnest( wxDC* DC, int net_code );
void build_ratsnest_module( wxDC* DC, MODULE* Module );
void trace_ratsnest_module( wxDC* DC );
void Build_Board_Ratsnest( wxDC* DC );
void DrawGeneralRatsnest( wxDC* DC, int net_code = 0 );
void trace_ratsnest_pad( wxDC* DC );
void build_ratsnest_pad( BOARD_ITEM* ref,
const wxPoint& refpos,
bool init );
void Tst_Ratsnest( wxDC* DC, int ref_netcode );
void test_connexions( wxDC* DC );
void test_1_net_connexion( wxDC* DC, int net_code );
void RecalculateAllTracksNetcode( );
void Tst_Ratsnest( wxDC* DC, int ref_netcode );
void test_connexions( wxDC* DC );
void test_1_net_connexion( wxDC* DC, int net_code );
void RecalculateAllTracksNetcode();
// Plotting
void ToPlotter( wxCommandEvent& event );
void Genere_GERBER( const wxString& FullFileName, int Layer,
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 );
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,
GRTraceMode trace_mode );
void Plot_Serigraphie( Plotter *plotter, int masque_layer,
GRTraceMode trace_mode);
void PlotDrillMark(Plotter *plotter, GRTraceMode trace_mode );
/* Plotting functions:
*/
void ToPlotter( wxCommandEvent& event );
void Genere_GERBER( const wxString& FullFileName, int Layer,
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 );
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,
GRTraceMode trace_mode );
void Plot_Serigraphie( PLOTTER* plotter, int masque_layer, GRTraceMode trace_mode );
/** Function SaveCopyInUndoList (virtual pure)
/** 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)
* Creates a new entry in undo list of commands.
* add a picker to handle aItemToCopy
* @param aItemToCopy = the board item modified by the command to undo
* @param aTypeCommand = command type (see enum UndoRedoOpType)
* @param aTransformPoint = the reference point of the transformation, for commands like move
*/
virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy, UndoRedoOpType aTypeCommand,
const wxPoint& aTransformPoint = wxPoint(0,0) ) = 0;
virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy, UndoRedoOpType aTypeCommand,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) = 0;
/** Function SaveCopyInUndoList (virtual pure, overloaded).
* Creates a new entry in undo list of commands.
@ -305,23 +320,23 @@ public:
* @param aTypeCommand = command type (see enum UndoRedoOpType)
* @param aTransformPoint = the reference point of the transformation, for commands like move
*/
virtual void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, UndoRedoOpType aTypeCommand,
const wxPoint& aTransformPoint = wxPoint(0,0) ) = 0;
virtual void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, UndoRedoOpType aTypeCommand,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) = 0;
// layerhandling:
// (See pcbnew/sel_layer.cpp for description of why null_layer parameter is provided)
int SelectLayer( int default_layer, int min_layer, int max_layer,
bool null_layer = false );
void SelectLayerPair();
virtual void SwitchLayer( wxDC* DC, int layer );
int SelectLayer( int default_layer, int min_layer, int max_layer,
bool null_layer = false );
void SelectLayerPair();
virtual void SwitchLayer( wxDC* DC, int layer );
// divers
void AddHistory( int value, KICAD_T type ); // Add value in data list history
void InstallGridFrame( const wxPoint& pos );
void AddHistory( int value, KICAD_T type ); // Add value in data list history
void InstallGridFrame( const wxPoint& pos );
virtual void LoadSettings();
virtual void SaveSettings();
virtual void LoadSettings();
virtual void SaveSettings();
DECLARE_EVENT_TABLE()
};

View File

@ -45,7 +45,7 @@ class WinEDAChoiceBox;
class PARAM_CFG_BASE;
class Ki_PageDescr;
class Ki_HotkeyInfo;
class Plotter;
class PLOTTER;
enum id_librarytype {
LIBRARY_TYPE_EESCHEMA,
@ -244,7 +244,7 @@ public:
void OnActivate( wxActivateEvent& event );
void ReDrawPanel();
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
* Return the X,Y sheet references where the point position is located

View File

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

View File

@ -22,11 +22,11 @@ using namespace std;
/**********************************************************************************/
void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
Ki_PageDescr* aSheet,
Ki_PageDescr* aSheet,
std::vector<HOLE_INFO> aHoleListBuffer,
std::vector<DRILL_TOOL> aToolListBuffer,
bool aUnit_Drill_is_Inch, int format,
const wxPoint &auxoffset)
const wxPoint& auxoffset )
/**********************************************************************************/
/* Genere le plan de percage (Drill map)
@ -34,18 +34,18 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
{
int x, y;
int plotX, plotY, TextWidth;
double scale = 1.0;
double scale = 1.0;
int intervalle = 0, CharSize = 0;
EDA_BaseStruct* PtStruct;
char line[1024];
int dX, dY;
wxPoint BoardCentre;
wxPoint offset;
wxPoint offset;
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
/* calcul des dimensions et centre du PCB */
aPcb->ComputeBoundaryBox();
@ -58,91 +58,92 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
switch( format )
{
case PLOT_FORMAT_GERBER:
scale = 1;
offset = auxoffset;
plotter = new Gerber_Plotter();
plotter->set_viewport(offset, scale, 0);
break;
scale = 1;
offset = auxoffset;
plotter = new GERBER_PLOTTER();
plotter->set_viewport( offset, scale, 0 );
break;
case PLOT_FORMAT_HPGL: /* Calcul des echelles de conversion format HPGL */
{
offset.x = 0;
offset.y = 0;
scale = 1;
HPGL_Plotter *hpgl_plotter = new HPGL_Plotter;
plotter = hpgl_plotter;
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_overlap(0);
plotter->set_paper_size(aSheet);
plotter->set_viewport(offset, scale, 0);
scale = 1;
HPGL_PLOTTER* hpgl_plotter = new HPGL_PLOTTER;
plotter = hpgl_plotter;
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_overlap( 0 );
plotter->set_paper_size( aSheet );
plotter->set_viewport( offset, scale, 0 );
}
break;
break;
case PLOT_FORMAT_POST:
{
Ki_PageDescr* SheetPS = &g_Sheet_A4;
wxSize SheetSize;
Ki_PageDescr* SheetPS = &g_Sheet_A4;
wxSize SheetSize;
SheetSize.x = SheetPS->m_Size.x * U_PCB;
SheetSize.y = SheetPS->m_Size.y * U_PCB;
/* Keep size for drill legend */
/* Keep size for drill legend */
double Xscale = (double) ( SheetSize.x * 0.8 ) / dX;
double Yscale = (double) ( SheetSize.y * 0.6 ) / dY;
scale = MIN( Xscale, Yscale );
offset.x = BoardCentre.x-(SheetSize.x/2)/scale;
offset.y = BoardCentre.y-(SheetSize.y/2)/scale;
offset.x = BoardCentre.x - (SheetSize.x / 2) / scale;
offset.y = BoardCentre.y - (SheetSize.y / 2) / scale;
offset.y += SheetSize.y / 8; /* decalage pour legende */
PS_Plotter *ps_plotter = new PS_Plotter;
plotter=ps_plotter;
ps_plotter->set_paper_size(SheetPS);
plotter->set_viewport(offset, scale, 0);
PS_PLOTTER* ps_plotter = new PS_PLOTTER;
plotter = ps_plotter;
ps_plotter->set_paper_size( SheetPS );
plotter->set_viewport( offset, scale, 0 );
break;
}
case PLOT_FORMAT_DXF:
{
offset.x = 0;
offset.y = 0;
scale = 1;
DXF_Plotter *dxf_plotter = new DXF_Plotter;
plotter = dxf_plotter;
plotter->set_paper_size(aSheet);
plotter->set_viewport(offset, scale, 0);
break;
scale = 1;
DXF_PLOTTER* dxf_plotter = new DXF_PLOTTER;
plotter = dxf_plotter;
plotter->set_paper_size( aSheet );
plotter->set_viewport( offset, scale, 0 );
break;
}
default:
wxASSERT(false);
wxASSERT( false );
}
plotter->set_creator(wxT("PCBNEW"));
plotter->set_filename(aFullFileName);
plotter->set_default_line_width(10);
plotter->start_plot(aFile);
plotter->set_creator( wxT( "PCBNEW" ) );
plotter->set_filename( aFullFileName );
plotter->set_default_line_width( 10 );
plotter->start_plot( aFile );
/* Draw items on edge layer */
for (PtStruct = aPcb->m_Drawings;
PtStruct != NULL;
PtStruct = PtStruct->Next() )
for( PtStruct = aPcb->m_Drawings;
PtStruct != NULL;
PtStruct = PtStruct->Next() )
{
switch( PtStruct->Type() )
{
case TYPE_DRAWSEGMENT:
PlotDrawSegment(plotter, (DRAWSEGMENT*) PtStruct, EDGE_LAYER, FILLED );
PlotDrawSegment( plotter, (DRAWSEGMENT*) PtStruct, EDGE_LAYER, FILLED );
break;
case TYPE_TEXTE:
PlotTextePcb(plotter, (TEXTE_PCB*) PtStruct, EDGE_LAYER, FILLED );
PlotTextePcb( plotter, (TEXTE_PCB*) PtStruct, EDGE_LAYER, FILLED );
break;
case TYPE_COTATION:
PlotCotation(plotter, (COTATION*) PtStruct, EDGE_LAYER, FILLED );
PlotCotation( plotter, (COTATION*) PtStruct, EDGE_LAYER, FILLED );
break;
case TYPE_MIRE:
PlotMirePcb(plotter, (MIREPCB*) PtStruct, EDGE_LAYER, FILLED );
PlotMirePcb( plotter, (MIREPCB*) PtStruct, EDGE_LAYER, FILLED );
break;
case TYPE_MARKER_PCB: // do not draw
@ -155,17 +156,18 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
}
// Set Drill Symbols width in 1/10000 mils
plotter->set_default_line_width(10);
plotter->set_current_line_width(-1);
plotter->set_default_line_width( 10 );
plotter->set_current_line_width( -1 );
// Plot board outlines and drill map
Gen_Drill_PcbMap( aPcb, plotter, aHoleListBuffer, aToolListBuffer);
Gen_Drill_PcbMap( aPcb, plotter, aHoleListBuffer, aToolListBuffer );
/* Impression de la liste des symboles utilises */
CharSize = 800; /* text size in 1/10000 mils */
CharSize = 800; /* text size in 1/10000 mils */
double CharScale = 1.0 / scale; /* real scale will be CharScale * scale_x,
* because the global plot scale is scale_x */
TextWidth = (int) ((CharSize * CharScale) / 10); // Set text width (thickness)
intervalle = (int) (CharSize * CharScale) + TextWidth;
* because the global plot scale is scale_x */
TextWidth = (int) ( (CharSize * CharScale) / 10 ); // Set text width (thickness)
intervalle = (int) ( CharSize * CharScale ) + TextWidth;
/* Trace des informations */
plotX = aPcb->m_BoundaryBox.GetX() + 200 * CharScale;
@ -173,64 +175,65 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
/* Plot title "Info" */
wxString Text = wxT( "Drill Map:" );
plotter->text( wxPoint(plotX,plotY), BLACK,
Text,
0, wxSize((int)(CharSize * CharScale), (int)(CharSize * CharScale)),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
TextWidth, false, false );
plotter->text( wxPoint( plotX, plotY ), BLACK,
Text,
0, wxSize( (int) ( CharSize * CharScale ), (int) ( CharSize * CharScale ) ),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
TextWidth, false, false );
for(unsigned ii = 0; ii < aToolListBuffer.size(); ii++ )
for( unsigned ii = 0; ii < aToolListBuffer.size(); ii++ )
{
int plot_diam;
if( aToolListBuffer[ii].m_TotalCount == 0 )
continue;
plotY += intervalle;
plotY += intervalle;
plot_diam = (int) (aToolListBuffer[ii].m_Diameter);
x = plotX - 200 * CharScale - plot_diam / 2;
y = plotY + CharSize*CharScale;
plot_diam = (int) ( aToolListBuffer[ii].m_Diameter );
x = plotX - 200 * CharScale - plot_diam / 2;
y = plotY + CharSize * CharScale;
plotter->marker( wxPoint( x, y ), plot_diam, ii );
/* Trace de la legende associee */
// List the diameter of each drill in the selected Drill Unit,
// and then its diameter in the other Drill Unit.
if( aUnit_Drill_is_Inch )
sprintf( line, "%2.3f\" / %2.2fmm ",
double (aToolListBuffer[ii].m_Diameter) * 0.0001,
double (aToolListBuffer[ii].m_Diameter) * 0.00254 );
else
sprintf( line, "%2.2fmm / %2.3f\" ",
double (aToolListBuffer[ii].m_Diameter) * 0.00254,
double (aToolListBuffer[ii].m_Diameter) * 0.0001 );
msg = CONV_FROM_UTF8( line );
// Now list how many holes and ovals are associated with each drill.
if( ( aToolListBuffer[ii].m_TotalCount == 1 )
&& ( aToolListBuffer[ii].m_OvalCount == 0 ) )
sprintf( line, "(1 hole)" );
else if( aToolListBuffer[ii].m_TotalCount == 1 ) // && ( aToolListBuffer[ii]m_OvalCount == 1 )
sprintf( line, "(1 slot)" );
else if( aToolListBuffer[ii].m_OvalCount == 0 )
sprintf( line, "(%d holes)",
aToolListBuffer[ii].m_TotalCount );
else if( aToolListBuffer[ii].m_OvalCount == 1 )
sprintf( line, "(%d holes + 1 slot)",
aToolListBuffer[ii].m_TotalCount - 1 );
else // if ( aToolListBuffer[ii]m_OvalCount > 1 )
sprintf( line, "(%d holes + %d slots)",
aToolListBuffer[ii].m_TotalCount -
aToolListBuffer[ii].m_OvalCount,
aToolListBuffer[ii].m_OvalCount );
msg += CONV_FROM_UTF8( line );
plotter->text( wxPoint(plotX,y), BLACK,
msg,
0, wxSize((int)(CharSize * CharScale), (int)(CharSize * CharScale)),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
TextWidth, false, false );
// List the diameter of each drill in the selected Drill Unit,
// and then its diameter in the other Drill Unit.
if( aUnit_Drill_is_Inch )
sprintf( line, "%2.3f\" / %2.2fmm ",
double (aToolListBuffer[ii].m_Diameter) * 0.0001,
double (aToolListBuffer[ii].m_Diameter) * 0.00254 );
else
sprintf( line, "%2.2fmm / %2.3f\" ",
double (aToolListBuffer[ii].m_Diameter) * 0.00254,
double (aToolListBuffer[ii].m_Diameter) * 0.0001 );
msg = CONV_FROM_UTF8( line );
intervalle = (int) (CharSize * CharScale) + TextWidth;
intervalle = (int) ( intervalle * 1.2);
// Now list how many holes and ovals are associated with each drill.
if( ( aToolListBuffer[ii].m_TotalCount == 1 )
&& ( aToolListBuffer[ii].m_OvalCount == 0 ) )
sprintf( line, "(1 hole)" );
else if( aToolListBuffer[ii].m_TotalCount == 1 ) // && ( aToolListBuffer[ii]m_OvalCount == 1 )
sprintf( line, "(1 slot)" );
else if( aToolListBuffer[ii].m_OvalCount == 0 )
sprintf( line, "(%d holes)",
aToolListBuffer[ii].m_TotalCount );
else if( aToolListBuffer[ii].m_OvalCount == 1 )
sprintf( line, "(%d holes + 1 slot)",
aToolListBuffer[ii].m_TotalCount - 1 );
else // if ( aToolListBuffer[ii]m_OvalCount > 1 )
sprintf( line, "(%d holes + %d slots)",
aToolListBuffer[ii].m_TotalCount -
aToolListBuffer[ii].m_OvalCount,
aToolListBuffer[ii].m_OvalCount );
msg += CONV_FROM_UTF8( line );
plotter->text( wxPoint( plotX, y ), BLACK,
msg,
0, wxSize( (int) ( CharSize * CharScale ), (int) ( CharSize * CharScale ) ),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
TextWidth, false, false );
intervalle = (int) ( CharSize * CharScale ) + TextWidth;
intervalle = (int) ( intervalle * 1.2 );
if( intervalle < (plot_diam + 200 + TextWidth) )
intervalle = plot_diam + 200 + TextWidth;
@ -238,14 +241,14 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
plotter->end_plot();
delete plotter;
SetLocaleTo_Default( ); // Revert to local notation for float numbers
SetLocaleTo_Default(); // Revert to local notation for float numbers
}
/****************************************************************************************/
void Gen_Drill_PcbMap( BOARD* aPcb, Plotter *plotter,
void Gen_Drill_PcbMap( BOARD* aPcb, PLOTTER* plotter,
std::vector<HOLE_INFO>& aHoleListBuffer,
std::vector<DRILL_TOOL>& aToolListBuffer)
std::vector<DRILL_TOOL>& aToolListBuffer )
/****************************************************************************************/
/** Creates the drill map aFile in HPGL or POSTSCRIPT format
@ -260,9 +263,9 @@ void Gen_Drill_PcbMap( BOARD* aPcb, Plotter *plotter,
if( aToolListBuffer.size() > 13 )
{
DisplayInfoMessage( NULL,
_(
" Drill map: Too many diameter values to draw to draw one symbol per drill value (max 13)\nPlot uses circle shape for some drill values" ),
10 );
_(
" Drill map: Too many diameter values to draw to draw one symbol per drill value (max 13)\nPlot uses circle shape for some drill values" ),
10 );
}
// Plot the drill map:
@ -271,18 +274,18 @@ void Gen_Drill_PcbMap( BOARD* aPcb, Plotter *plotter,
pos.x = aHoleListBuffer[ii].m_Hole_Pos_X;
pos.y = aHoleListBuffer[ii].m_Hole_Pos_Y;
/* Always plot the drill symbol (for slots identifies the needed
* cutter!) */
plotter->marker( pos, aHoleListBuffer[ii].m_Hole_Diameter,
aHoleListBuffer[ii].m_Tool_Reference - 1);
/* Always plot the drill symbol (for slots identifies the needed
* cutter!) */
plotter->marker( pos, aHoleListBuffer[ii].m_Hole_Diameter,
aHoleListBuffer[ii].m_Tool_Reference - 1 );
if( aHoleListBuffer[ii].m_Hole_Shape != 0 )
{
wxSize oblong_size;
oblong_size.x = aHoleListBuffer[ii].m_Hole_SizeX;
oblong_size.y = aHoleListBuffer[ii].m_Hole_SizeY;
plotter->flash_pad_oval( pos, oblong_size,
aHoleListBuffer[ii].m_Hole_Orient, FILAIRE);
}
plotter->flash_pad_oval( pos, oblong_size,
aHoleListBuffer[ii].m_Hole_Orient, FILAIRE );
}
}
}
@ -337,15 +340,15 @@ void GenDrillReportFile( FILE* aFile, BOARD* aPcb, const wxString& aBoardFilenam
}
else
{
if ( layer1 == COPPER_LAYER_N ) // First partial hole list
if( layer1 == COPPER_LAYER_N ) // First partial hole list
{
sprintf( line, "Drill report for buried and blind vias :\n\n");
sprintf( line, "Drill report for buried and blind vias :\n\n" );
fputs( line, aFile );
}
sprintf( line, "Drill report for holes from layer %s to layer %s\n",
CONV_TO_UTF8 (aPcb->GetLayerName(layer1) ),
CONV_TO_UTF8 (aPcb->GetLayerName(layer2) ) );
CONV_TO_UTF8( aPcb->GetLayerName( layer1 ) ),
CONV_TO_UTF8( aPcb->GetLayerName( layer2 ) ) );
}
fputs( line, aFile );

View File

@ -85,7 +85,7 @@ void GenDrillMapFile( BOARD* aPcb,
bool aUnit_Drill_is_Inch,
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<DRILL_TOOL>& aToolListBuffer);
@ -95,8 +95,8 @@ void Gen_Drill_PcbMap( BOARD* aPcb, Plotter* plotter,
*/
void GenDrillReportFile( FILE* aFile, BOARD * aPcb, const wxString& aBoardFilename,
bool aUnit_Drill_is_Inch,
std::vector<HOLE_INFO> & aHoleListBuffer,
std::vector<DRILL_TOOL>& aToolListBuffer
std::vector<HOLE_INFO> & aHoleListBuffer,
std::vector<DRILL_TOOL>& aToolListBuffer
);
#endif // #ifndef GENDRILL_H

View File

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

View File

@ -70,29 +70,29 @@ extern PCB_Plot_Options g_pcb_plot_options;
/*************************************/
/* 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 );
/* Trace 1 Texte type PCB , c.a.d autre que les textes sur modules,
* 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 );
void PlotCotation( Plotter* plotter, COTATION* Cotation, int masque_layer,
void PlotCotation( PLOTTER* plotter, COTATION* Cotation, int masque_layer,
GRTraceMode trace_mode );
void PlotMirePcb( Plotter* plotter, MIREPCB* PtMire, int masque_layer,
void PlotMirePcb( PLOTTER* plotter, MIREPCB* PtMire, int masque_layer,
GRTraceMode trace_mode );
void Plot_1_EdgeModule( Plotter* plotter, EDGE_MODULE* PtEdge,
void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge,
GRTraceMode trace_mode );
void PlotFilledAreas( Plotter* plotter, ZONE_CONTAINER* aZone,
void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone,
GRTraceMode trace_mode );
/* PLOTGERB.CPP */
void SelectD_CODE_For_LineDraw( Plotter* plotter, int aSize );
void SelectD_CODE_For_LineDraw( PLOTTER* plotter, int aSize );
#endif /* #define PCBPLOT_H */

View File

@ -16,13 +16,13 @@
/* 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 );
static void PlotTextModule( Plotter* plotter, TEXTE_MODULE* pt_texte,
static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte,
GRTraceMode trace_mode );
/**********************************************************/
void WinEDA_BasePcbFrame::Plot_Serigraphie( Plotter* plotter,
void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
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 )
/********************************************************************/
{
@ -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 )
/*******************************************************************************/
{
@ -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 )
/*****************************************************************/
{
@ -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 )
/**********************************************************************/
/* 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 )
/**************************************************************/
/* 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 )
/****************************************************************************/
/* Trace 1 Texte type PCB , c.a.d autre que les textes sur modules */
@ -477,8 +477,8 @@ void PlotTextePcb( Plotter* plotter, TEXTE_PCB* pt_texte, int masque_layer,
return;
/* calcul des parametres du texte :*/
size = pt_texte->m_Size;
pos = pt_texte->m_Pos;
size = pt_texte->m_Size;
pos = pt_texte->m_Pos;
orient = pt_texte->m_Orient;
thickness = (trace_mode==FILAIRE) ? -1 : pt_texte->m_Width;
@ -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 )
/*********************************************************/
@ -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 )
/******************************************************************************/
@ -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 )
/*********************************************************************/
{
@ -679,6 +679,17 @@ void WinEDA_BasePcbFrame::Plot_Layer( Plotter* plotter, int Layer,
case LAYER_N_15:
case LAST_COPPER_LAYER:
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;
case SOLDERMASK_N_CU:
@ -697,13 +708,11 @@ void WinEDA_BasePcbFrame::Plot_Layer( Plotter* plotter, int Layer,
Plot_Serigraphie( plotter, layer_mask, trace_mode );
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 garde,
bool trace_via,
@ -888,14 +897,16 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( Plotter* plotter,
}
/***********************************************************************************/
void WinEDA_BasePcbFrame::PlotDrillMark( Plotter* plotter, GRTraceMode trace_mode )
/***********************************************************************************/
/* Draw a drill mark for pads and vias.
/** 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
* 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;
wxPoint pos;
@ -904,12 +915,9 @@ void WinEDA_BasePcbFrame::PlotDrillMark( Plotter* plotter, GRTraceMode trace_mod
D_PAD* PtPad;
TRACK* pts;
if( g_pcb_plot_options.DrillShapeOpt == PCB_Plot_Options::NO_DRILL_SHAPE )
return;
if( trace_mode == FILLED )
if( aTraceMode == FILLED )
{
plotter->set_color( WHITE );
aPlotter->set_color( WHITE );
}
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
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;
@ -941,19 +949,18 @@ void WinEDA_BasePcbFrame::PlotDrillMark( Plotter* plotter, GRTraceMode trace_mod
if( PtPad->m_DrillShape == PAD_OVAL )
{
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
{
diam.x = (g_pcb_plot_options.DrillShapeOpt == PCB_Plot_Options::SMALL_DRILL_SHAPE)
? SMALL_DRILL : PtPad->m_Drill.x;
plotter->flash_pad_circle( pos, diam.x, trace_mode );
diam.x = aSmallDrillShape ? SMALL_DRILL : PtPad->m_Drill.x;
aPlotter->flash_pad_circle( pos, diam.x, aTraceMode );
}
}
}
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();
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_viewport( wxPoint(0,0), 1, 0 );
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();
Plotter* plotter = new Gerber_Plotter();
PLOTTER* plotter = new GERBER_PLOTTER();
/* No mirror and scaling for gerbers! */
plotter->set_viewport( offset, scale, 0 );
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;
}
HPGL_Plotter* plotter = new HPGL_Plotter();
HPGL_PLOTTER* plotter = new HPGL_PLOTTER();
plotter->set_paper_size( currentsheet );
plotter->set_viewport( offset, scale,
g_pcb_plot_options.PlotOrient );

View File

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