Commit c3fde304 authored by charras's avatar charras

code cleaning. Pcbnew: Minor enhancements in Plot dialog

parent 0a58e630
......@@ -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
......
/******************************************
* 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;
}
......@@ -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 )
/*******************************************************************/
......
......@@ -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 :
......
......@@ -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);
......@@ -76,7 +75,7 @@ void HPGL_Plotter::circle( wxPoint centre, int diameter, FILL_T fill, int width
}
/*****************************************************/
void HPGL_Plotter::poly( int nb, int* coord, FILL_T fill, int width )
void HPGL_PLOTTER::poly( int nb, int* coord, FILL_T fill, int width )
/*****************************************************/
/* Trace un polygone (ferme si rempli) en format HPGL
......@@ -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
......@@ -136,7 +135,7 @@ void HPGL_Plotter::pen_control( int plume )
}
/**********************************************/
void HPGL_Plotter::pen_to( wxPoint pos, char plume )
void HPGL_PLOTTER::pen_to( wxPoint pos, char plume )
/**********************************************/
/*
......@@ -160,7 +159,7 @@ void HPGL_Plotter::pen_to( wxPoint pos, char plume )
pen_lastpos = pos;
}
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 )
/********************************************************************/
......@@ -232,7 +231,7 @@ void HPGL_Plotter::arc( wxPoint centre, int StAngle, int EndAngle, int rayon,
}
/***********************************************************************************/
void HPGL_Plotter::flash_pad_oval( wxPoint pos, wxSize size, int orient,
void HPGL_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
GRTraceMode trace_mode )
/************************************************************************************/
/* 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 )
/*******************************************************************/
/*
......
......@@ -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 )
/*******************************************************************/
/*
......
......@@ -15,7 +15,7 @@
#include "drawtxt.h"
/**************************************************************************/
void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
void WinEDA_DrawFrame::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
/**************************************************************************/
/* Plot sheet references
......@@ -38,7 +38,7 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
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;
......@@ -74,6 +74,7 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
xg -= GRID_REF_W * conv_unit;
yg -= GRID_REF_W * conv_unit;
}
#endif
/* trace des reperes */
......@@ -86,7 +87,7 @@ 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;
for( Ki_WorkSheetData* WsItem = &WS_Segm1_LU;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
......@@ -97,22 +98,26 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
{
case WS_CADRE:
break;
case WS_PODPIS_LU:
if(WsItem->m_Legende) msg = WsItem->m_Legende;
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);
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);
plotter->finish_to( pos );
break;
}
}
for ( Ki_WorkSheetData* WsItem = &WS_Segm1_LT;
for( Ki_WorkSheetData* WsItem = &WS_Segm1_LT;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
......@@ -122,27 +127,28 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
switch( WsItem->m_Type )
{
case WS_SEGMENT_LT:
plotter->move_to(pos);
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);
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;
......@@ -154,9 +160,9 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
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;
......@@ -178,9 +184,9 @@ 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;
......@@ -192,9 +198,9 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
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;
......@@ -202,6 +208,7 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
}
#endif
/* Trace du cartouche */
......@@ -210,9 +217,9 @@ 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;
for( Ki_WorkSheetData* WsItem = &WS_Date;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
......@@ -223,56 +230,74 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
{
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,
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;
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg << screen->m_ScreenNumber;
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ,text_size,
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
break;
case WS_SHEETS:
if(WsItem->m_Legende) msg = WsItem->m_Legende;
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);
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);
plotter->finish_to( pos );
break;
}
}
} else {
for(Ki_WorkSheetData* WsItem = &WS_CADRE_D;
}
else
{
for( Ki_WorkSheetData* WsItem = &WS_CADRE_D;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
......@@ -284,24 +309,28 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
case WS_CADRE:
/* Begin list number > 1 */
case WS_PODPIS_D:
if(WsItem->m_Legende) msg = WsItem->m_Legende;
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
plotter->text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
break;
case WS_IDENTSHEET_D:
if(WsItem->m_Legende) msg = WsItem->m_Legende;
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);
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);
plotter->finish_to( pos );
break;
}
}
......@@ -310,7 +339,7 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
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;
for( Ki_WorkSheetData* WsItem = &WS_Date;
WsItem != NULL;
WsItem = WsItem->Pnext )
{
......@@ -423,379 +452,7 @@ void WinEDA_DrawFrame::PlotWorkSheet( Plotter *plotter, BASE_SCREEN* screen )
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;
#endif
}
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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" ) );
}
bool success = DrawPage( fn.GetFullPath(), screen, aPrint_Sheet_Ref );
msg = _( "Create file " ) + fn.GetFullPath();
......
......@@ -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 */
......
......@@ -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);
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -278,7 +278,7 @@ void ReAnnotatePowerSymbolsOnly();
/************/
/* PLOT.CPP */
/************/
void PlotDrawlist( Plotter* plotter, SCH_ITEM* drawlist );
void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* drawlist );
/***************/
/* DELSHEET.CPP */
......
......@@ -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__ */
......@@ -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;
......@@ -370,21 +368,26 @@ public:
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();
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();
......
......@@ -91,6 +91,7 @@ public:
// General
virtual void OnCloseWindow( wxCloseEvent& Event ) = 0;
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) { }
virtual void ReCreateHToolbar() = 0;
virtual void ReCreateVToolbar() = 0;
......@@ -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
......@@ -267,26 +271,37 @@ public:
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 RecalculateAllTracksNetcode();
// Plotting
/* Plotting functions:
*/
void ToPlotter( wxCommandEvent& event );
void Genere_GERBER( const wxString& FullFileName, int Layer,
bool PlotOriginIsAuxAxis,
bool PlotOriginIsAuxAxis, GRTraceMode trace_mode );
void Genere_HPGL( const wxString& FullFileName, int Layer, GRTraceMode trace_mode );
void Genere_PS( const wxString& FullFileName,
int Layer,
bool useA4,
GRTraceMode trace_mode );
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,
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 );
void Plot_Serigraphie( PLOTTER* plotter, int masque_layer, GRTraceMode trace_mode );
/** function PlotDrillMark
* Draw a drill mark for pads and vias.
* Must be called after all drawings, because it
* redraw the drill mark on a pad or via, as a negative (i.e. white) shape in FILLED plot mode
* @param aPlotter = the PLOTTER
* @param aTraceMode = the mode of plot (FILLED, SKETCH)
* @param aSmallDrillShape = true to plot a smalle drill shape, false to plot the actual drill shape
*/
void PlotDrillMark( PLOTTER* aPlotter, GRTraceMode aTraceMode, bool aSmallDrillShape );
/* Functions relative to Undo/redo commands:
*/
/** Function SaveCopyInUndoList (virtual pure)
* Creates a new entry in undo list of commands.
......@@ -296,7 +311,7 @@ public:
* @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;
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) = 0;
/** Function SaveCopyInUndoList (virtual pure, overloaded).
* Creates a new entry in undo list of commands.
......@@ -306,7 +321,7 @@ public:
* @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;
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) = 0;
// layerhandling:
......
......@@ -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
......
#include "wx/msw/wx.rc"
......@@ -26,7 +26,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
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)
......@@ -42,10 +42,10 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
wxPoint BoardCentre;
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();
......@@ -60,8 +60,8 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
case PLOT_FORMAT_GERBER:
scale = 1;
offset = auxoffset;
plotter = new Gerber_Plotter();
plotter->set_viewport(offset, scale, 0);
plotter = new GERBER_PLOTTER();
plotter->set_viewport( offset, scale, 0 );
break;
case PLOT_FORMAT_HPGL: /* Calcul des echelles de conversion format HPGL */
......@@ -69,13 +69,13 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
offset.x = 0;
offset.y = 0;
scale = 1;
HPGL_Plotter *hpgl_plotter = new HPGL_Plotter;
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);
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;
......@@ -91,58 +91,59 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
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;
DXF_PLOTTER* dxf_plotter = new DXF_PLOTTER;
plotter = dxf_plotter;
plotter->set_paper_size(aSheet);
plotter->set_viewport(offset, scale, 0);
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;
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 */
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;
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,13 +175,13 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
/* Plot title "Info" */
wxString Text = wxT( "Drill Map:" );
plotter->text( wxPoint(plotX,plotY), BLACK,
plotter->text( wxPoint( plotX, plotY ), BLACK,
Text,
0, wxSize((int)(CharSize * CharScale), (int)(CharSize * CharScale)),
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 )
......@@ -187,12 +189,13 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
plotY += intervalle;
plot_diam = (int) (aToolListBuffer[ii].m_Diameter);
plot_diam = (int) ( aToolListBuffer[ii].m_Diameter );
x = plotX - 200 * CharScale - plot_diam / 2;
y = plotY + CharSize*CharScale;
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 )
......@@ -223,14 +226,14 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
aToolListBuffer[ii].m_OvalCount,
aToolListBuffer[ii].m_OvalCount );
msg += CONV_FROM_UTF8( line );
plotter->text( wxPoint(plotX,y), BLACK,
plotter->text( wxPoint( plotX, y ), BLACK,
msg,
0, wxSize((int)(CharSize * CharScale), (int)(CharSize * CharScale)),
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);
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
......@@ -274,14 +277,14 @@ void Gen_Drill_PcbMap( BOARD* aPcb, Plotter *plotter,
/* 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);
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);
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 );
......
......@@ -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);
......
......@@ -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 );
......@@ -621,7 +619,6 @@ 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_Drill_Shape_Opt->Enable( false );
m_PlotModeOpt->Enable( true );
m_Choice_Plot_Offset->Enable( false );
......
......@@ -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 */
......@@ -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 */
......@@ -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 );
}
}
......@@ -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" ) );
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment