Commit daeb9f0e authored by charras's avatar charras

Cleaning code to draw/plot texts; italic allowed for pcbnew

parent 7b6bb153
...@@ -5,11 +5,18 @@ Started 2007-June-11 ...@@ -5,11 +5,18 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2008-Dec-22 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
++All
Cleaning code to draw/plot texts:
Now only one function is used to draw and plot texts in pcbnew in all formats
Italics texts are allowed in pcbnew (work in progress)
2008-Dec-14 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2008-Dec-14 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
++All ++All
Cleaning code to draw/plot texts (work in progress): Cleaning code to draw/plot texts (work in progress):
Now only one function is used to draw and plot texts Now only one function is used to draw and plot texts (not for pcbnew)
(easier to maintain and ensure texts have the same size in ploting and drawing) (easier to maintain and ensure texts have the same size in ploting and drawing)
In eeschema, italic and bold texts allowed (in pcbenew, texts thickness is already adjustable) In eeschema, italic and bold texts allowed (in pcbenew, texts thickness is already adjustable)
......
...@@ -12,6 +12,7 @@ set(COMMON_SRCS ...@@ -12,6 +12,7 @@ set(COMMON_SRCS
common_plot_functions.cpp common_plot_functions.cpp
common_plotHPGL_functions.cpp common_plotHPGL_functions.cpp
common_plotPS_functions.cpp common_plotPS_functions.cpp
common_plotGERBER_functions.cpp
confirm.cpp confirm.cpp
copy_to_clipboard.cpp copy_to_clipboard.cpp
dcsvg.cpp dcsvg.cpp
......
...@@ -14,13 +14,6 @@ ...@@ -14,13 +14,6 @@
/* parametre HPGL pour trace de cercle: */ /* parametre HPGL pour trace de cercle: */
#define CHORD_ANGLE 10 #define CHORD_ANGLE 10
// Variables partagees avec Common plot Postscript Routines
extern wxPoint LastPenPosition;
extern wxPoint PlotOffset;
extern FILE* PlotOutputFile;
extern double XScale, YScale;
extern int g_DefaultPenWidth, g_CurrentPenWidth;
extern int PlotOrientOptions, etat_plume;
//Variables locales //Variables locales
void Move_Plume_HPGL( wxPoint pos, int plume ); void Move_Plume_HPGL( wxPoint pos, int plume );
...@@ -28,20 +21,20 @@ void Plume_HPGL( int plume ); ...@@ -28,20 +21,20 @@ void Plume_HPGL( int plume );
/***********************************************************************************/ /***********************************************************************************/
void InitPlotParametresHPGL( wxPoint offset, double xscale, double yscale, int orient ) void InitPlotParametresHPGL( wxPoint offset, double aXScale, double aYScale, int orient )
/***********************************************************************************/ /***********************************************************************************/
/* Set the plot offset for the current plotting /* Set the plot offset for the current plotting
* xscale,yscale = coordinate scale (scale coefficient for coordinates) * g_Plot_XScale,g_Plot_YScale = coordinate scale (scale coefficient for coordinates)
* device_xscale,device_yscale = device coordinate scale (i.e scale used by plot device) * device_g_Plot_XScale,device_g_Plot_YScale = device coordinate scale (i.e scale used by plot device)
*/ */
{ {
PlotOffset = offset; g_Plot_PlotOffset = offset;
XScale = xscale; g_Plot_XScale = aXScale;
YScale = yscale; g_Plot_YScale = aYScale;
g_DefaultPenWidth = 6; /* epaisseur du trait standard en 1/1000 pouce */ g_Plot_DefaultPenWidth = 6; /* epaisseur du trait standard en 1/1000 pouce */
PlotOrientOptions = orient; g_Plot_PlotOrientOptions = orient;
g_CurrentPenWidth = -1; g_Plot_CurrentPenWidth = -1;
} }
...@@ -51,8 +44,8 @@ bool PrintHeaderHPGL( FILE* plot_file, int pen_speed, int pen_num ) ...@@ -51,8 +44,8 @@ bool PrintHeaderHPGL( FILE* plot_file, int pen_speed, int pen_num )
{ {
char Line[256]; char Line[256];
PlotOutputFile = plot_file; g_Plot_PlotOutputFile = plot_file;
etat_plume = 'U'; g_Plot_PenState = 'U';
sprintf( Line, "IN;VS%d;PU;PA;SP%d;\n", pen_speed, pen_num ); sprintf( Line, "IN;VS%d;PU;PA;SP%d;\n", pen_speed, pen_num );
fputs( Line, plot_file ); fputs( Line, plot_file );
return TRUE; return TRUE;
...@@ -79,7 +72,7 @@ void PlotRectHPGL( wxPoint p1, wxPoint p2, bool fill, int width ) ...@@ -79,7 +72,7 @@ void PlotRectHPGL( wxPoint p1, wxPoint p2, bool fill, int width )
Plume_HPGL( 'U' ); Plume_HPGL( 'U' );
sprintf( Line, "PA %d,%d;EA %d,%d;\n", p1.x, p1.y, p2.x, p2.y ); sprintf( Line, "PA %d,%d;EA %d,%d;\n", p1.x, p1.y, p2.x, p2.y );
fputs( Line, PlotOutputFile ); fputs( Line, g_Plot_PlotOutputFile );
Plume_HPGL( 'U' ); return; Plume_HPGL( 'U' ); return;
} }
...@@ -93,14 +86,14 @@ void PlotCircleHPGL( wxPoint centre, int diameter, bool fill, int width ) ...@@ -93,14 +86,14 @@ void PlotCircleHPGL( wxPoint centre, int diameter, bool fill, int width )
char Line[256]; char Line[256];
UserToDeviceCoordinate( centre ); UserToDeviceCoordinate( centre );
rayon = (int) (diameter / 2 * XScale); rayon = (int) (diameter / 2 * g_Plot_XScale);
if( rayon < 0 ) if( rayon < 0 )
rayon = 0; rayon = 0;
Plume_HPGL( 'U' ); Plume_HPGL( 'U' );
sprintf( Line, "PA %d,%d;CI %d,%d;\n", centre.x, centre.y, rayon, CHORD_ANGLE ); sprintf( Line, "PA %d,%d;CI %d,%d;\n", centre.x, centre.y, rayon, CHORD_ANGLE );
fputs( Line, PlotOutputFile ); fputs( Line, g_Plot_PlotOutputFile );
Plume_HPGL( 'U' ); return; Plume_HPGL( 'U' ); return;
} }
...@@ -129,7 +122,7 @@ void PlotArcHPGL( wxPoint centre, int StAngle, int EndAngle, int rayon, bool fil ...@@ -129,7 +122,7 @@ void PlotArcHPGL( wxPoint centre, int StAngle, int EndAngle, int rayon, bool fil
cpos = centre; UserToDeviceCoordinate( cpos ); cpos = centre; UserToDeviceCoordinate( cpos );
if( PlotOrientOptions == PLOT_MIROIR ) if( g_Plot_PlotOrientOptions == PLOT_MIROIR )
{ {
EndAngle = -EndAngle; EndAngle = -EndAngle;
StAngle = -StAngle; StAngle = -StAngle;
...@@ -143,11 +136,11 @@ void PlotArcHPGL( wxPoint centre, int StAngle, int EndAngle, int rayon, bool fil ...@@ -143,11 +136,11 @@ void PlotArcHPGL( wxPoint centre, int StAngle, int EndAngle, int rayon, bool fil
Plume_HPGL( 'U' ); Plume_HPGL( 'U' );
sprintf( Line, "PU;PA %d,%d;PD;AA %d,%d, ", cmap.x, cmap.y, cpos.x, cpos.y ); sprintf( Line, "PU;PA %d,%d;PD;AA %d,%d, ", cmap.x, cmap.y, cpos.x, cpos.y );
fputs( Line, PlotOutputFile ); fputs( Line, g_Plot_PlotOutputFile );
sprintf( Line, "%f", -angle ); to_point( Line ); // Transforme , et . du separateur sprintf( Line, "%f", -angle ); to_point( Line ); // Transforme , et . du separateur
fputs( Line, PlotOutputFile ); fputs( Line, g_Plot_PlotOutputFile );
sprintf( Line, ", %d", CHORD_ANGLE ); fputs( Line, PlotOutputFile ); sprintf( Line, ", %d", CHORD_ANGLE ); fputs( Line, g_Plot_PlotOutputFile );
sprintf( Line, ";PU;\n" ); fputs( Line, PlotOutputFile ); sprintf( Line, ";PU;\n" ); fputs( Line, g_Plot_PlotOutputFile );
Plume_HPGL( 'U' ); Plume_HPGL( 'U' );
} }
...@@ -205,7 +198,7 @@ void Move_Plume_HPGL( wxPoint pos, int plume ) ...@@ -205,7 +198,7 @@ void Move_Plume_HPGL( wxPoint pos, int plume )
Plume_HPGL( plume ); Plume_HPGL( plume );
UserToDeviceCoordinate( pos ); UserToDeviceCoordinate( pos );
sprintf( Line, "PA %d,%d;\n", pos.x, pos.y ); fputs( Line, PlotOutputFile ); sprintf( Line, "PA %d,%d;\n", pos.x, pos.y ); fputs( Line, g_Plot_PlotOutputFile );
} }
...@@ -218,14 +211,14 @@ void Plume_HPGL( int plume ) ...@@ -218,14 +211,14 @@ void Plume_HPGL( int plume )
{ {
if( plume == 'U' ) if( plume == 'U' )
{ {
if( etat_plume != 'U' ) if( g_Plot_PenState != 'U' )
fputs( "PU;", PlotOutputFile ); fputs( "PU;", g_Plot_PlotOutputFile );
etat_plume = 'U'; g_Plot_PenState = 'U';
} }
else else
{ {
if( etat_plume != 'D' ) if( g_Plot_PenState != 'D' )
fputs( "PD;", PlotOutputFile ); fputs( "PD;", g_Plot_PlotOutputFile );
etat_plume = 'D'; g_Plot_PenState = 'D';
} }
} }
This diff is collapsed.
...@@ -14,68 +14,46 @@ ...@@ -14,68 +14,46 @@
// Variables partagees avec Common plot Postscript et HPLG Routines // Variables partagees avec Common plot Postscript et HPLG Routines
wxPoint LastPenPosition; wxPoint g_Plot_LastPenPosition;
wxPoint PlotOffset; wxPoint g_Plot_PlotOffset;
FILE* PlotOutputFile; FILE* g_Plot_PlotOutputFile;
double XScale, YScale; double g_Plot_XScale, g_Plot_YScale;
int g_DefaultPenWidth; int g_Plot_DefaultPenWidth;
int g_CurrentPenWidth = -1; int g_Plot_CurrentPenWidth = -1;
int PlotOrientOptions, etat_plume; int g_Plot_PlotOrientOptions, g_Plot_PenState;
// Locales
static Ki_PageDescr* SheetPS;
/*************************/ /*************************/
void ForcePenReinit() void ForcePenReinit()
/*************************/ /*************************/
/* set the flag g_CurrentPenWidth to -1 in order to force a pen width redefinition /* set the flag g_Plot_CurrentPenWidth to -1 in order to force a pen width redefinition
* for the next draw command * for the next draw command
*/ */
{ {
g_CurrentPenWidth = -1; g_Plot_CurrentPenWidth = -1;
} }
/**********************************************/ /**********************************************/
void SetPlotScale( double xscale, double yscale ) void SetPlotScale( double aXScale, double aYScale )
/**********************************************/ /**********************************************/
/* Set the plot scale for the current plotting) /* Set the plot scale for the current plotting)
*/ */
{ {
XScale = xscale; g_Plot_XScale = aXScale;
YScale = yscale; g_Plot_YScale = aYScale;
} }
/*********************************/ /*********************************/
void SetPlotOffset( wxPoint offset ) void Setg_Plot_PlotOffset( wxPoint offset )
/*********************************/ /*********************************/
/* Set the plot offset for the current plotting) /* Set the plot offset for the current plotting)
*/ */
{ {
PlotOffset = offset; g_Plot_PlotOffset = offset;
}
/***************************************************************************/
void InitPlotParametresGERBER( wxPoint offset, double xscale, double yscale )
/***************************************************************************/
/* Set the plot offset for the current plotting
* xscale,yscale = coordinate scale (scale coefficient for coordinates)
*/
{
PlotOrientOptions = 0;
PlotOffset = offset;
SheetPS = NULL;
XScale = xscale;
YScale = yscale;
g_DefaultPenWidth = 120; /* epaisseur du trait standard en 1/1000 pouce */
g_CurrentPenWidth = -1;
} }
...@@ -114,6 +92,9 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen ) ...@@ -114,6 +92,9 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
break; break;
case PLOT_FORMAT_GERBER: case PLOT_FORMAT_GERBER:
FctPlume = LineTo_GERBER;
break;
default: default:
return; return;
} }
...@@ -507,17 +488,17 @@ void UserToDeviceCoordinate( wxPoint& pos ) ...@@ -507,17 +488,17 @@ void UserToDeviceCoordinate( wxPoint& pos )
/* modifie les coord pos.x et pos.y pour le trace selon l'orientation, /* modifie les coord pos.x et pos.y pour le trace selon l'orientation,
* l'echelle, les offsets de trace */ * l'echelle, les offsets de trace */
{ {
pos.x = (int) (pos.x * XScale); pos.x = (int) (pos.x * g_Plot_XScale);
pos.y = (int) (pos.y * YScale); pos.y = (int) (pos.y * g_Plot_YScale);
switch( PlotOrientOptions ) /* Calcul du cadrage */ switch( g_Plot_PlotOrientOptions ) /* Calcul du cadrage */
{ {
default: default:
pos.x -= PlotOffset.x; pos.y = PlotOffset.y - pos.y; pos.x -= g_Plot_PlotOffset.x; pos.y = g_Plot_PlotOffset.y - pos.y;
break; break;
case PLOT_MIROIR: case PLOT_MIROIR:
pos.x -= PlotOffset.x; pos.y = -PlotOffset.y + pos.y; pos.x -= g_Plot_PlotOffset.x; pos.y = -g_Plot_PlotOffset.y + pos.y;
break; break;
} }
} }
...@@ -528,6 +509,6 @@ void UserToDeviceSize( wxSize& size ) ...@@ -528,6 +509,6 @@ void UserToDeviceSize( wxSize& size )
/************************************/ /************************************/
/* modifie les dimension size.x et size.y pour le trace selon l'echelle */ /* modifie les dimension size.x et size.y pour le trace selon l'echelle */
{ {
size.x = (int) (size.x * XScale); size.x = (int) (size.x * g_Plot_XScale);
size.y = (int) (size.y * YScale); size.y = (int) (size.y * g_Plot_YScale);
} }
...@@ -348,6 +348,8 @@ static void s_Callback_plot(int x0, int y0, int xf, int yf) ...@@ -348,6 +348,8 @@ static void s_Callback_plot(int x0, int y0, int xf, int yf)
PenLastPos = pend; PenLastPos = pend;
} }
/******************************************************************************************/ /******************************************************************************************/
void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aColor, void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aColor,
const wxString& aText, const wxString& aText,
...@@ -372,7 +374,6 @@ void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aCo ...@@ -372,7 +374,6 @@ void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aCo
* @param aItalic = true to simulate an italic font * @param aItalic = true to simulate an italic font
*/ */
{ {
// Initialise the actual function used to plot lines: // Initialise the actual function used to plot lines:
switch( aFormat_plot ) switch( aFormat_plot )
{ {
...@@ -385,6 +386,9 @@ void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aCo ...@@ -385,6 +386,9 @@ void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aCo
break; break;
case PLOT_FORMAT_GERBER: case PLOT_FORMAT_GERBER:
MovePenFct = LineTo_GERBER;
break;
default: default:
return; return;
} }
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "hotkeys_basic.h" #include "hotkeys_basic.h"
#include "macros.h" #include "macros.h"
#include "online_help.h" #include "online_help.h"
#include "bitmaps.h" #include "bitmaps.h"
......
...@@ -13,6 +13,7 @@ OBJECTS= \ ...@@ -13,6 +13,7 @@ OBJECTS= \
copy_to_clipboard.o\ copy_to_clipboard.o\
class_drawpickedstruct.o\ class_drawpickedstruct.o\
common_plot_functions.o\ common_plot_functions.o\
common_plotGERBER_functions.o\
common_plotPS_functions.o\ common_plotPS_functions.o\
common_plotHPGL_functions.o\ common_plotHPGL_functions.o\
dlist.o \ dlist.o \
......
...@@ -25,12 +25,6 @@ void Print_PcbItems(BOARD * Pcb, wxDC *DC, int drawmode, int printmasklayer); ...@@ -25,12 +25,6 @@ void Print_PcbItems(BOARD * Pcb, wxDC *DC, int drawmode, int printmasklayer);
/*****************/ /*****************/
void DisplayColorSetupFrame(WinEDA_DrawFrame * parent, const wxPoint & framepos); void DisplayColorSetupFrame(WinEDA_DrawFrame * parent, const wxPoint & framepos);
/***************/
/* affiche.cpp */
/***************/
void valeur_param(int valeur,char * buf_texte);
void Affiche_Infos_PCB_Texte(WinEDA_BasePcbFrame * frame, TEXTE_PCB* pt_texte);
void Affiche_Infos_Piste(WinEDA_BasePcbFrame * frame, TRACK * pt_piste);
/* PLOT_RTN.CC */ /* PLOT_RTN.CC */
void ComputePlotFileName( char * FullFileName, char * Ext ); void ComputePlotFileName( char * FullFileName, char * Ext );
...@@ -38,14 +32,10 @@ void calcule_coord_plot(int * dx, int * dy ) ; ...@@ -38,14 +32,10 @@ void calcule_coord_plot(int * dx, int * dy ) ;
void calcule_dim_plot(int * dx, int * dy ) ; void calcule_dim_plot(int * dx, int * dy ) ;
void Trace_Un_TextePcb( TEXTE_PCB * pt_texte,int format_plot,int masque_layer); void Trace_Un_TextePcb( TEXTE_PCB * pt_texte,int format_plot,int masque_layer);
/* Trace 1 Texte type PCB , c.a.d autre que les textes sur modules, /* Trace 1 Texte type PCB , c.a.d autre que les textes sur modules,
prepare les parametres de trace de Plot_1_texte */ prepare les parametres de trace de texte */
void trace_1_arc(int format_plot,int cx,int cy,int start,int end, void trace_1_arc(int format_plot,int cx,int cy,int start,int end,
int rayon,int epaisseur); int rayon,int epaisseur);
void trace_1_cercle(int format_plot,int epaisseur,int cx, int cy, int rayon); void trace_1_cercle(int format_plot,int epaisseur,int cx, int cy, int rayon);
void Plot_1_texte( int format_plot,
char * ptr,int t_nbcodes, int t_orient,
int epaisseur, int ox,int oy,int size_h,int size_v);
/* Routine de base de trace de 1 chaine de caracteres */
void Trace_Un_DrawSegment( DRAWSEGMENT* PtSegm, int format_plot,int masque_layer ); void Trace_Un_DrawSegment( DRAWSEGMENT* PtSegm, int format_plot,int masque_layer );
......
...@@ -31,13 +31,21 @@ static inline bool IsPostScript( int aFormat ) ...@@ -31,13 +31,21 @@ static inline bool IsPostScript( int aFormat )
const int PLOT_MIROIR = 1; const int PLOT_MIROIR = 1;
// Variables used in Common plot functions
extern wxPoint g_Plot_LastPenPosition;
extern wxPoint g_Plot_PlotOffset;
extern FILE* g_Plot_PlotOutputFile;
extern double g_Plot_XScale, g_Plot_YScale;
extern int g_Plot_DefaultPenWidth, g_Plot_CurrentPenWidth;
extern int g_Plot_PlotOrientOptions, g_Plot_PenState;
/*******************************/ /*******************************/
/* common_plot_functions.cpp */ /* common_plot_functions.cpp */
/*******************************/ /*******************************/
void SetPlotScale( double xscale, double yscale ); // Set the plot scale for the current plotting) void SetPlotScale( double aXScale, double aYScale ); // Set the plot scale for the current plotting)
void SetPlotOffset( wxPoint offset ); // Set the plot offset for the current plotting) void Setg_Plot_PlotOffset( wxPoint offset ); // Set the plot offset for the current plotting)
void InitPlotParametresGERBER( wxPoint offset, double xscale, double yscale ); void InitPlotParametresGERBER( wxPoint offset, double aXScale, double aYScale );
void PlotWorkSheet( int format_plot, BASE_SCREEN* screen ); void PlotWorkSheet( int format_plot, BASE_SCREEN* screen );
void UserToDeviceCoordinate( wxPoint& pos ); void UserToDeviceCoordinate( wxPoint& pos );
...@@ -47,7 +55,7 @@ void UserToDeviceSize( wxSize& size ); ...@@ -47,7 +55,7 @@ void UserToDeviceSize( wxSize& size );
// modifie les dimension size.x et size.y pour le trace selon l'echelle // modifie les dimension size.x et size.y pour le trace selon l'echelle
void ForcePenReinit(); void ForcePenReinit();
// set the flag g_CurrentPenWidth to -1 in order // set the flag g_Plot_CurrentPenWidth to -1 in order
// to force a pen width redefinition for the next draw command // to force a pen width redefinition for the next draw command
...@@ -57,8 +65,8 @@ void ForcePenReinit(); ...@@ -57,8 +65,8 @@ void ForcePenReinit();
void SetCurrentLineWidthPS( int width ); void SetCurrentLineWidthPS( int width );
void InitPlotParametresPS( wxPoint offset, void InitPlotParametresPS( wxPoint offset,
Ki_PageDescr* sheet, Ki_PageDescr* sheet,
double xscale, double aXScale,
double yscale, double aYScale,
int orient = 0 ); int orient = 0 );
void SetDefaultLineWidthPS( int width ); void SetDefaultLineWidthPS( int width );
void PlotRectPS( wxPoint p1, wxPoint p2, bool fill, int width = -1 ); void PlotRectPS( wxPoint p1, wxPoint p2, bool fill, int width = -1 );
...@@ -82,7 +90,7 @@ void SetColorMapPS( int color ); ...@@ -82,7 +90,7 @@ void SetColorMapPS( int color );
/*********************************/ /*********************************/
/* common_plotHPGL_functions.cpp */ /* common_plotHPGL_functions.cpp */
/*********************************/ /*********************************/
void InitPlotParametresHPGL( wxPoint offset, double xscale, double yscale, int orient = 0 ); void InitPlotParametresHPGL( wxPoint offset, double aXScale, double aYScale, int orient = 0 );
bool PrintHeaderHPGL( FILE* plot_file, int pen_speed, int pen_num ); bool PrintHeaderHPGL( FILE* plot_file, int pen_speed, int pen_num );
bool CloseFileHPGL( FILE* plot_file ); bool CloseFileHPGL( FILE* plot_file );
void PlotCircleHPGL( wxPoint centre, int diameter, bool fill, int width = -1 ); void PlotCircleHPGL( wxPoint centre, int diameter, bool fill, int width = -1 );
...@@ -92,4 +100,64 @@ void PlotPolyHPGL( int nb, int* coord, bool fill, int width = -1 ); ...@@ -92,4 +100,64 @@ void PlotPolyHPGL( int nb, int* coord, bool fill, int width = -1 );
void Move_Plume_HPGL( wxPoint pos, int plume ); void Move_Plume_HPGL( wxPoint pos, int plume );
void Plume_HPGL( int plume ); void Plume_HPGL( int plume );
/*********************************/
/* common_plotGERBER_functions.cpp */
/*********************************/
/** function InitPlotParametresGERBER
* Set the plot offset for the current plotting
* @param aOffset = plot offset
* @param aXScale,aYScale = coordinate scale (scale coefficient for coordinates)
*/
void InitPlotParametresGERBER( wxPoint aOffset, double aXScale, double aYScale );
/** Function Write_Header_GERBER
* Write GERBER header to file
* initialize global variable g_Plot_PlotOutputFile
* @param aTitle: the name of creator (comment)
* @param aFile: an opened file to write to
*/
void Write_Header_GERBER( const wxString aTitle, FILE* aFile );
/** Function LineTo_GERBER
* if aCommand = 'U' initialise the starting point of a line
* if aCommand = 'D' draw a line from the starting point, or last point to aPos
* @param aPos = end of the current line.
* @param aCommand = 'U' or 'D' or 'Z' (Pen up , no moving )
*/
void LineTo_GERBER( wxPoint aPos, int aCommand );
/** Function PlotGERBERLine
* Plot a line
* @param aStartPos = starting point of the line
* @param aEndPos = ending point of the line
* @param aThickness = line thickness
*/
void PlotGERBERLine( wxPoint aStartPos, wxPoint aEndPos, int aThickness );
/** Function PlotCircle_GERBER
* writes a non filled circle to output file
* Plot one circle as segments (6 to 16 depending on its radius
* @param aCentre = centre coordintes
* @param aRadius = radius of the circle
* @param aWidth = line width (noc currently used, D_CODEs must be selected before)
*/
void PlotCircle_GERBER( wxPoint aCentre, int aRadius, int aWidth );
/** Function PlotPolygon_GERBER
* writes a closed polyline (not a filled polygon) to output file
* @param aCornersCount = numer of corners
* @param aCoord = buffer of corners coordinates
* @param aWidth = line width (noc currently used, D_CODEs must be selected before)
*/
void PlotPolygon_GERBER( int aCornersCount, int* aCoord, int aWidth );
/** Function PlotFilledPolygon_GERBER
* writes a filled polyline to output file
* @param aCornersCount = numer of corners
* @param aCoord = buffer of corners coordinates
*/
void PlotFilledPolygon_GERBER( int aCornersCount, int* aCoord );
#endif /* #ifndef PLOT_COMMON_H */ #endif /* #ifndef PLOT_COMMON_H */
...@@ -275,7 +275,6 @@ public: ...@@ -275,7 +275,6 @@ public:
int garde, int tracevia, int modetrace ); int garde, int tracevia, int modetrace );
void Plot_Layer_GERBER( FILE* File, int masque_layer, void Plot_Layer_GERBER( FILE* File, int masque_layer,
int garde, int tracevia ); int garde, int tracevia );
int Gen_D_CODE_File( FILE* file );
void Plot_Layer_PS( FILE* File, int masque_layer, void Plot_Layer_PS( FILE* File, int masque_layer,
int garde, int tracevia, int modetrace ); int garde, int tracevia, int modetrace );
......
...@@ -48,7 +48,8 @@ set(PCBNEW_SRCS ...@@ -48,7 +48,8 @@ set(PCBNEW_SRCS
dialog_copper_zones_base.cpp dialog_copper_zones_base.cpp
dialog_display_options_base.cpp dialog_display_options_base.cpp
# dialog_drc.cpp # dialog_drc.cpp
dialog_edit_mod_text.cpp dialog_edit_module_text.cpp
dialog_edit_module_text_base.cpp
# dialog_edit_module.cpp # dialog_edit_module.cpp
dialog_freeroute_exchange.cpp dialog_freeroute_exchange.cpp
# dialog_gendrill.cpp # dialog_gendrill.cpp
......
...@@ -28,19 +28,16 @@ ...@@ -28,19 +28,16 @@
/* Constructeur de TEXTE_MODULE */ /* Constructeur de TEXTE_MODULE */
TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) : TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) :
BOARD_ITEM( parent, TYPE_TEXTE_MODULE ) BOARD_ITEM( parent, TYPE_TEXTE_MODULE ), EDA_TextStruct ()
{ {
MODULE* Module = (MODULE*) m_Parent; MODULE* Module = (MODULE*) m_Parent;
m_NoShow = 0; /* visible */
m_Type = text_type; /* Reference */ m_Type = text_type; /* Reference */
if( (m_Type != TEXT_is_REFERENCE) && (m_Type != TEXT_is_VALUE) ) if( (m_Type != TEXT_is_REFERENCE) && (m_Type != TEXT_is_VALUE) )
m_Type = TEXT_is_DIVERS; m_Type = TEXT_is_DIVERS;
m_NoShow = false;
m_Size.x = m_Size.y = 400; m_Width = 120; /* dimensions raisonnables par defaut */ m_Size.x = m_Size.y = 400; m_Width = 120; /* dimensions raisonnables par defaut */
m_Orient = 0; /* en 1/10 degre */
m_Miroir = 1; // Mode normal (pas de miroir)
m_Unused = 0;
SetLayer( SILKSCREEN_N_CMP ); SetLayer( SILKSCREEN_N_CMP );
if( Module && (Module->Type() == TYPE_MODULE) ) if( Module && (Module->Type() == TYPE_MODULE) )
...@@ -60,7 +57,7 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) : ...@@ -60,7 +57,7 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) :
|| moduleLayer == ADHESIVE_N_CU || moduleLayer == ADHESIVE_N_CU
|| moduleLayer == COPPER_LAYER_N ) || moduleLayer == COPPER_LAYER_N )
{ {
m_Miroir = 0; m_Mirror = true;
} }
} }
} }
...@@ -85,17 +82,20 @@ bool TEXTE_MODULE::Save( FILE* aFile ) const ...@@ -85,17 +82,20 @@ bool TEXTE_MODULE::Save( FILE* aFile ) const
MODULE* parent = (MODULE*) GetParent(); MODULE* parent = (MODULE*) GetParent();
int orient = m_Orient; int orient = m_Orient;
// Due to the pcbnew history, m_Orient is saved in screen value
// but it is handled as relative to its parent footprint
if( parent ) if( parent )
orient += parent->m_Orient; orient += parent->m_Orient;
int ret = fprintf( aFile, "T%d %d %d %d %d %d %d %c %c %d \"%s\"\n", int ret = fprintf( aFile, "T%d %d %d %d %d %d %d %c %c %d %c\"%s\"\n",
m_Type, m_Type,
m_Pos0.x, m_Pos0.y, m_Pos0.x, m_Pos0.y,
m_Size.y, m_Size.x, m_Size.y, m_Size.x,
orient, orient,
m_Width, m_Width,
m_Miroir ? 'N' : 'M', m_NoShow ? 'I' : 'V', m_Mirror ? 'M' : 'N', m_NoShow ? 'I' : 'V',
GetLayer(), GetLayer(),
m_Italic ? 'I' : 'N',
CONV_TO_UTF8( m_Text ) ); CONV_TO_UTF8( m_Text ) );
return ret > 20; return ret > 20;
...@@ -117,33 +117,40 @@ int TEXTE_MODULE::ReadDescr( char* aLine, FILE* aFile, int* aLineNum ) ...@@ -117,33 +117,40 @@ int TEXTE_MODULE::ReadDescr( char* aLine, FILE* aFile, int* aLineNum )
int success = true; int success = true;
int type; int type;
int layer; int layer;
char BufCar1[128], BufCar2[128], BufLine[256]; char BufCar1[128], BufCar2[128], BufCar3[128], BufLine[256];
layer = SILKSCREEN_N_CMP; layer = SILKSCREEN_N_CMP;
BufCar1[0] = 0; BufCar1[0] = 0;
BufCar2[0] = 0; BufCar2[0] = 0;
if ( sscanf( aLine + 1, "%d %d %d %d %d %d %d %s %s %d", BufCar3[0] = 0;
if ( sscanf( aLine + 1, "%d %d %d %d %d %d %d %s %s %d %s",
&type, &type,
&m_Pos0.x, &m_Pos0.y, &m_Pos0.x, &m_Pos0.y,
&m_Size.y, &m_Size.x, &m_Size.y, &m_Size.x,
&m_Orient, &m_Width, &m_Orient, &m_Width,
BufCar1, BufCar2, &layer ) < 10 ) BufCar1, BufCar2, &layer, BufCar3 ) >= 10 )
success = true; success = true;
if( (type != TEXT_is_REFERENCE) && (type != TEXT_is_VALUE) ) if( (type != TEXT_is_REFERENCE) && (type != TEXT_is_VALUE) )
type = TEXT_is_DIVERS; type = TEXT_is_DIVERS;
m_Type = type; m_Type = type;
// .m_Orient member must be relative to the parent module // Due to the pcbnew history, .m_Orient is saved in screen value
// but it is handled as relative to its parent footprint
m_Orient -= ((MODULE * )m_Parent)->m_Orient; m_Orient -= ((MODULE * )m_Parent)->m_Orient;
if( BufCar1[0] == 'M' ) if( BufCar1[0] == 'M' )
m_Miroir = 0; m_Mirror = true;
else else
m_Miroir = 1; m_Mirror = false;
if( BufCar2[0] == 'I' ) if( BufCar2[0] == 'I' )
m_NoShow = 1; m_NoShow = true;
else else
m_NoShow = 0; m_NoShow = false;
if( BufCar3[0] == 'I' )
m_Italic = true;
else
m_Italic = false;
// Test for a reasonnable layer: // Test for a reasonnable layer:
if( layer < 0 ) if( layer < 0 )
...@@ -191,7 +198,7 @@ void TEXTE_MODULE::Copy( TEXTE_MODULE* source ) ...@@ -191,7 +198,7 @@ void TEXTE_MODULE::Copy( TEXTE_MODULE* source )
m_Pos = source->m_Pos; m_Pos = source->m_Pos;
SetLayer( source->GetLayer() ); SetLayer( source->GetLayer() );
m_Miroir = source->m_Miroir; // Show normal / mirror m_Mirror = source->m_Mirror; // Show normal / mirror
m_NoShow = source->m_NoShow; // 0: visible 1: invisible m_NoShow = source->m_NoShow; // 0: visible 1: invisible
m_Type = source->m_Type; // 0: ref,1: val, others = 2..255 m_Type = source->m_Type; // 0: ref,1: val, others = 2..255
m_Orient = source->m_Orient; // orientation in 1/10 deg m_Orient = source->m_Orient; // orientation in 1/10 deg
...@@ -347,7 +354,7 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const ...@@ -347,7 +354,7 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const
*/ */
{ {
int zoom; int zoom;
int width, color, orient, miroir; int width, color, orient;
wxSize size; wxSize size;
wxPoint pos; // Centre du texte wxPoint pos; // Centre du texte
PCB_SCREEN* screen; PCB_SCREEN* screen;
...@@ -367,7 +374,6 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const ...@@ -367,7 +374,6 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const
size = m_Size; size = m_Size;
orient = GetDrawRotation(); orient = GetDrawRotation();
miroir = m_Miroir & 1; // = 0 si vu en miroir
width = m_Width; width = m_Width;
if( (frame->m_DisplayModText == FILAIRE) || ( (width / zoom) < L_MIN_DESSIN ) ) if( (frame->m_DisplayModText == FILAIRE) || ( (width / zoom) < L_MIN_DESSIN ) )
...@@ -406,13 +412,13 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const ...@@ -406,13 +412,13 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const
if( (color & ITEM_NOT_SHOW) != 0 ) if( (color & ITEM_NOT_SHOW) != 0 )
return; return;
/* Si le texte doit etre mis en miroir: modif des parametres */ /* If the text is mirrored : negate size.x (mirror / Y axis) */
if( miroir == 0 ) if( m_Mirror )
size.x = -size.x; size.x = -size.x;
/* Trace du texte */ /* Trace du texte */
DrawGraphicText( panel, DC, pos, (enum EDA_Colors) color, m_Text, DrawGraphicText( panel, DC, pos, (enum EDA_Colors) color, m_Text,
orient, size, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width ); orient, size, m_HJustify, m_VJustify, width, m_Italic );
} }
...@@ -489,9 +495,9 @@ void TEXTE_MODULE::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -489,9 +495,9 @@ void TEXTE_MODULE::Display_Infos( WinEDA_DrawFrame* frame )
msg.Printf( wxT( "%d" ), ii ); msg.Printf( wxT( "%d" ), ii );
Affiche_1_Parametre( frame, 31, _( "Layer" ), msg, DARKGREEN ); Affiche_1_Parametre( frame, 31, _( "Layer" ), msg, DARKGREEN );
msg = wxT( " Yes" ); msg = _( " No" );
if( m_Miroir & 1 ) if( m_Mirror )
msg = wxT( " No" ); msg = _( " Yes" );
Affiche_1_Parametre( frame, 37, _( "Mirror" ), msg, DARKGREEN ); Affiche_1_Parametre( frame, 37, _( "Mirror" ), msg, DARKGREEN );
......
...@@ -13,21 +13,16 @@ ...@@ -13,21 +13,16 @@
#define TEXT_is_DIVERS 2 #define TEXT_is_DIVERS 2
class TEXTE_MODULE : public BOARD_ITEM class TEXTE_MODULE : public BOARD_ITEM, public EDA_TextStruct
{ {
/* Note: orientation in 1/10 deg relative to the footprint
* Physical orient is m_Orient + m_Parent->m_Orient
*/
public: public:
wxPoint m_Pos; // Real (physical)coord
int m_Width;
wxPoint m_Pos0; // text coordinates relatives to the footprint ancre, orient 0 wxPoint m_Pos0; // text coordinates relatives to the footprint ancre, orient 0
// Text coordinate ref point is the text centre // Text coordinate ref point is the text centre
char m_Unused; // unused (reserved for future extensions)
char m_Miroir; // Show normal / mirror
char m_NoShow; // 0: visible 1: invisible (bool)
char m_Type; // 0: ref,1: val, others = 2..255 char m_Type; // 0: ref,1: val, others = 2..255
int m_Orient; // orientation in 1/10 deg relative to the footprint bool m_NoShow; // true = invisible
// Physical orient is m_Orient + m_Parent->m_Orient
wxSize m_Size; // text size
wxString m_Text;
public: public:
TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS ); TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS );
...@@ -52,7 +47,6 @@ public: ...@@ -52,7 +47,6 @@ public:
/* Gestion du texte */ /* Gestion du texte */
void SetWidth( int new_width ); void SetWidth( int new_width );
int GetLength(); /* text length */ int GetLength(); /* text length */
int Pitch(); /* retourne le pas entre 2 caracteres */
int GetDrawRotation(); // Return text rotation for drawings and plotting int GetDrawRotation(); // Return text rotation for drawings and plotting
/** Function GetTextRect /** Function GetTextRect
......
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_edit_module_text_base.h"
///////////////////////////////////////////////////////////////////////////
DialogEditModuleText_base::DialogEditModuleText_base( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
m_ModuleInfoText = new wxStaticText( this, wxID_ANY, _("Module %s (%s) orient %.1f"), wxDefaultPosition, wxDefaultSize, 0 );
m_ModuleInfoText->Wrap( -1 );
bMainSizer->Add( m_ModuleInfoText, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainSizer->Add( m_staticline1, 0, wxALL|wxEXPAND, 5 );
m_TextDataTitle = new wxStaticText( this, wxID_ANY, _("Reference:"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextDataTitle->Wrap( -1 );
bMainSizer->Add( m_TextDataTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_Name = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bMainSizer->Add( m_Name, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizer3;
bSizer3 = new wxBoxSizer( wxVERTICAL );
m_SizeXTitle = new wxStaticText( this, wxID_ANY, _("Size X"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeXTitle->Wrap( -1 );
bSizer3->Add( m_SizeXTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_TxtSizeCtrlX = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizer3->Add( m_TxtSizeCtrlX, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_SizeYTitle = new wxStaticText( this, wxID_ANY, _("Size Y"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeYTitle->Wrap( -1 );
bSizer3->Add( m_SizeYTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_TxtSizeCtrlY = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizer3->Add( m_TxtSizeCtrlY, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_PosXTitle = new wxStaticText( this, wxID_ANY, _("Offset X"), wxDefaultPosition, wxDefaultSize, 0 );
m_PosXTitle->Wrap( -1 );
bSizer3->Add( m_PosXTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_TxtPosCtrlX = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizer3->Add( m_TxtPosCtrlX, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_PosYTitle = new wxStaticText( this, wxID_ANY, _("Offset Y"), wxDefaultPosition, wxDefaultSize, 0 );
m_PosYTitle->Wrap( -1 );
bSizer3->Add( m_PosYTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_TxtPosCtrlY = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizer3->Add( m_TxtPosCtrlY, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bSizer2->Add( bSizer3, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxVERTICAL );
m_WidthTitle = new wxStaticText( this, wxID_ANY, _("Thickness"), wxDefaultPosition, wxDefaultSize, 0 );
m_WidthTitle->Wrap( -1 );
bSizer4->Add( m_WidthTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_TxtWidthCtlr = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizer4->Add( m_TxtWidthCtlr, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxString m_OrientChoices[] = { _("horizontal"), _("vertical") };
int m_OrientNChoices = sizeof( m_OrientChoices ) / sizeof( wxString );
m_Orient = new wxRadioBox( this, wxID_ANY, _("Orientation"), wxDefaultPosition, wxDefaultSize, m_OrientNChoices, m_OrientChoices, 1, wxRA_SPECIFY_COLS );
m_Orient->SetSelection( 0 );
bSizer4->Add( m_Orient, 0, wxALL|wxEXPAND, 5 );
wxString m_ShowChoices[] = { _("Visible"), _("Invisible") };
int m_ShowNChoices = sizeof( m_ShowChoices ) / sizeof( wxString );
m_Show = new wxRadioBox( this, wxID_ANY, _("Display"), wxDefaultPosition, wxDefaultSize, m_ShowNChoices, m_ShowChoices, 1, wxRA_SPECIFY_COLS );
m_Show->SetSelection( 0 );
bSizer4->Add( m_Show, 0, wxALL|wxEXPAND, 5 );
bSizer2->Add( bSizer4, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer5;
bSizer5 = new wxBoxSizer( wxVERTICAL );
wxString m_StyleChoices[] = { _("Normal"), _("Italic") };
int m_StyleNChoices = sizeof( m_StyleChoices ) / sizeof( wxString );
m_Style = new wxRadioBox( this, wxID_ANY, _("Style"), wxDefaultPosition, wxDefaultSize, m_StyleNChoices, m_StyleChoices, 1, wxRA_SPECIFY_COLS );
m_Style->SetSelection( 0 );
bSizer5->Add( m_Style, 0, wxALL|wxEXPAND, 5 );
bSizer5->Add( 10, 10, 0, 0, 5 );
m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonOK->SetDefault();
m_buttonOK->SetForegroundColour( wxColour( 202, 0, 0 ) );
bSizer5->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_buttonCANCEL = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonCANCEL->SetForegroundColour( wxColour( 0, 0, 220 ) );
bSizer5->Add( m_buttonCANCEL, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
bSizer2->Add( bSizer5, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
bMainSizer->Add( bSizer2, 1, wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
// Connect Events
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DialogEditModuleText_base::OnInitDialog ) );
m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogEditModuleText_base::OnOkClick ), NULL, this );
m_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogEditModuleText_base::OnCancelClick ), NULL, this );
}
DialogEditModuleText_base::~DialogEditModuleText_base()
{
// Disconnect Events
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DialogEditModuleText_base::OnInitDialog ) );
m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogEditModuleText_base::OnOkClick ), NULL, this );
m_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogEditModuleText_base::OnCancelClick ), NULL, this );
}
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_edit_module_text_base__
#define __dialog_edit_module_text_base__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/statline.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/radiobox.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DialogEditModuleText_base
///////////////////////////////////////////////////////////////////////////////
class DialogEditModuleText_base : public wxDialog
{
private:
protected:
wxStaticText* m_ModuleInfoText;
wxStaticLine* m_staticline1;
wxStaticText* m_TextDataTitle;
wxTextCtrl* m_Name;
wxStaticText* m_SizeXTitle;
wxTextCtrl* m_TxtSizeCtrlX;
wxStaticText* m_SizeYTitle;
wxTextCtrl* m_TxtSizeCtrlY;
wxStaticText* m_PosXTitle;
wxTextCtrl* m_TxtPosCtrlX;
wxStaticText* m_PosYTitle;
wxTextCtrl* m_TxtPosCtrlY;
wxStaticText* m_WidthTitle;
wxTextCtrl* m_TxtWidthCtlr;
wxRadioBox* m_Orient;
wxRadioBox* m_Show;
wxRadioBox* m_Style;
wxButton* m_buttonOK;
wxButton* m_buttonCANCEL;
// Virtual event handlers, overide them in your derived class
virtual void OnInitDialog( wxInitDialogEvent& event ){ event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
public:
DialogEditModuleText_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Footprint text properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 357,299 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DialogEditModuleText_base();
};
#endif //__dialog_edit_module_text_base__
...@@ -232,10 +232,11 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName, w ...@@ -232,10 +232,11 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName, w
case PLOT_FORMAT_POST: case PLOT_FORMAT_POST:
wxString Text = wxT( "Infos" ); wxString Text = wxT( "Infos" );
Plot_1_texte( format, Text, 0, TextWidth, PlotGraphicText( format, wxPoint(x,y), BLACK,
x, y, Text,
(int) (CharSize * CharScale), (int) (CharSize * CharScale), 0, wxSize((int)(CharSize * CharScale), (int)(CharSize * CharScale)),
FALSE ); GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
TextWidth );
break; break;
} }
...@@ -335,11 +336,11 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName, w ...@@ -335,11 +336,11 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName, w
aToolListBuffer[ii].m_TotalCount, aToolListBuffer[ii].m_TotalCount,
aToolListBuffer[ii].m_OvalCount ); aToolListBuffer[ii].m_OvalCount );
msg += CONV_FROM_UTF8( line ); msg += CONV_FROM_UTF8( line );
Plot_1_texte( format, msg, 0, TextWidth, PlotGraphicText( format, wxPoint(x,y), BLACK,
x, y, msg,
(int) (CharSize * CharScale), 0, wxSize((int)(CharSize * CharScale), (int)(CharSize * CharScale)),
(int) (CharSize * CharScale), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
FALSE ); TextWidth );
break; break;
} }
......
...@@ -92,7 +92,8 @@ OBJECTS= $(TARGET).o classpcb.o\ ...@@ -92,7 +92,8 @@ OBJECTS= $(TARGET).o classpcb.o\
globaleditpad.o \ globaleditpad.o \
editedge.o\ editedge.o\
edtxtmod.o \ edtxtmod.o \
dialog_edit_mod_text.o\ dialog_edit_module_text.o\
dialog_edit_module_text_base.o\
ratsnest.o drc.o \ ratsnest.o drc.o \
block.o\ block.o\
clean.o \ clean.o \
...@@ -243,7 +244,9 @@ cotation.o: cotation.cpp ...@@ -243,7 +244,9 @@ cotation.o: cotation.cpp
edtxtmod.o: edtxtmod.cpp edtxtmod.o: edtxtmod.cpp
dialog_edit_mod_text.o: dialog_edit_mod_text.cpp dialog_edit_mod_text.h dialog_edit_module_text.o: dialog_edit_module_text.cpp dialog_edit_module_text_base.h
dialog_edit_module_text_base.o: dialog_edit_module_text_base.cpp dialog_edit_module_text_base.h
ratsnest.o: ratsnest.cpp ratsnest.o: ratsnest.cpp
...@@ -259,7 +262,7 @@ pcbplot.o: pcbplot.cpp pcbplot.h ...@@ -259,7 +262,7 @@ pcbplot.o: pcbplot.cpp pcbplot.h
plothpgl.o: plothpgl.cpp plothpgl.o: plothpgl.cpp
plotgerb.o: plotgerb.cpp pcbplot.h plotgerb.h plotgerb.o: plotgerb.cpp pcbplot.h
plotps.o: plotps.cpp pcbplot.h plotps.o: plotps.cpp pcbplot.h
......
...@@ -420,8 +420,8 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC ) ...@@ -420,8 +420,8 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC )
pt_texte->m_Pos.y -= Module->m_Pos.y; pt_texte->m_Pos.y -= Module->m_Pos.y;
pt_texte->m_Pos.y = -pt_texte->m_Pos.y; pt_texte->m_Pos.y = -pt_texte->m_Pos.y;
pt_texte->m_Pos.y += Module->m_Pos.y; pt_texte->m_Pos.y += Module->m_Pos.y;
pt_texte->m_Pos0.y = pt_texte->m_Pos0.y; pt_texte->m_Pos0.y = -pt_texte->m_Pos0.y;
pt_texte->m_Miroir = false; pt_texte->m_Mirror = false;
NEGATE_AND_NORMALIZE_ANGLE_POS( pt_texte->m_Orient ); NEGATE_AND_NORMALIZE_ANGLE_POS( pt_texte->m_Orient );
pt_texte->SetLayer( Module->GetLayer() ); pt_texte->SetLayer( Module->GetLayer() );
pt_texte->SetLayer( ChangeSideNumLayer( pt_texte->GetLayer() ) ); pt_texte->SetLayer( ChangeSideNumLayer( pt_texte->GetLayer() ) );
...@@ -434,15 +434,15 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC ) ...@@ -434,15 +434,15 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC )
if( (Module->GetLayer() == SILKSCREEN_N_CU) if( (Module->GetLayer() == SILKSCREEN_N_CU)
|| (Module->GetLayer() == ADHESIVE_N_CU) || (Module->GetLayer() == COPPER_LAYER_N) ) || (Module->GetLayer() == ADHESIVE_N_CU) || (Module->GetLayer() == COPPER_LAYER_N) )
pt_texte->m_Miroir = true; pt_texte->m_Mirror = true;
/* Inversion miroir de la Valeur et mise en miroir : */ /* Inversion miroir de la Valeur et mise en miroir : */
pt_texte = Module->m_Value; pt_texte = Module->m_Value;
pt_texte->m_Pos.y -= Module->m_Pos.y; pt_texte->m_Pos.y -= Module->m_Pos.y;
pt_texte->m_Pos.y = -pt_texte->m_Pos.y; pt_texte->m_Pos.y = -pt_texte->m_Pos.y;
pt_texte->m_Pos.y += Module->m_Pos.y; pt_texte->m_Pos.y += Module->m_Pos.y;
pt_texte->m_Pos0.y = pt_texte->m_Pos0.y; pt_texte->m_Pos0.y = -pt_texte->m_Pos0.y;
pt_texte->m_Miroir = false; pt_texte->m_Mirror = false;
NEGATE_AND_NORMALIZE_ANGLE_POS( pt_texte->m_Orient ); NEGATE_AND_NORMALIZE_ANGLE_POS( pt_texte->m_Orient );
pt_texte->SetLayer( Module->GetLayer() ); pt_texte->SetLayer( Module->GetLayer() );
pt_texte->SetLayer( ChangeSideNumLayer( pt_texte->GetLayer() ) ); pt_texte->SetLayer( ChangeSideNumLayer( pt_texte->GetLayer() ) );
...@@ -455,7 +455,7 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC ) ...@@ -455,7 +455,7 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC )
if( (Module->GetLayer() == SILKSCREEN_N_CU) if( (Module->GetLayer() == SILKSCREEN_N_CU)
|| (Module->GetLayer() == ADHESIVE_N_CU) || (Module->GetLayer() == COPPER_LAYER_N) ) || (Module->GetLayer() == ADHESIVE_N_CU) || (Module->GetLayer() == COPPER_LAYER_N) )
pt_texte->m_Miroir = true; pt_texte->m_Mirror = true;
/* Inversion miroir des dessins de l'empreinte : */ /* Inversion miroir des dessins de l'empreinte : */
PtStruct = Module->m_Drawings; PtStruct = Module->m_Drawings;
...@@ -488,8 +488,8 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC ) ...@@ -488,8 +488,8 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC )
pt_texte->m_Pos.y -= Module->m_Pos.y; pt_texte->m_Pos.y -= Module->m_Pos.y;
pt_texte->m_Pos.y = -pt_texte->m_Pos.y; pt_texte->m_Pos.y = -pt_texte->m_Pos.y;
pt_texte->m_Pos.y += Module->m_Pos.y; pt_texte->m_Pos.y += Module->m_Pos.y;
pt_texte->m_Pos0.y = pt_texte->m_Pos0.y; pt_texte->m_Pos0.y = - pt_texte->m_Pos0.y;
pt_texte->m_Miroir = false; pt_texte->m_Mirror = false;
NEGATE_AND_NORMALIZE_ANGLE_POS( pt_texte->m_Orient ); NEGATE_AND_NORMALIZE_ANGLE_POS( pt_texte->m_Orient );
pt_texte->SetLayer( Module->GetLayer() ); pt_texte->SetLayer( Module->GetLayer() );
...@@ -505,7 +505,7 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC ) ...@@ -505,7 +505,7 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC )
|| Module->GetLayer() == ADHESIVE_N_CU || Module->GetLayer() == ADHESIVE_N_CU
|| Module->GetLayer() == COPPER_LAYER_N ) || Module->GetLayer() == COPPER_LAYER_N )
{ {
pt_texte->m_Miroir = true; pt_texte->m_Mirror = true;
} }
break; break;
......
...@@ -123,36 +123,15 @@ eda_global int g_DrillShapeOpt ...@@ -123,36 +123,15 @@ eda_global int g_DrillShapeOpt
#define GERB_OVALE 4 #define GERB_OVALE 4
#define GERB_DONUT 5 #define GERB_DONUT 5
/* liste des D_CODES en fonction de leur numero d'ordre (numero d'outil)
(l'ordre 0 n'est pas utilise) ;
Tools have D_CODES >= 10
D_CODES <= 9 are used for commands only:
D01 ... D9 = command codes for photo plotting:
D01 = Light on
D02 = Light off
D03 = Flash
D04 .. D08 = ?
D09 = VAPE Flash
*/
/* Routines generales de trace : */
/* PLOT_RTN.CC */ /* PLOT_RTN.CC */
void PlotTextePcb( TEXTE_PCB * pt_texte,int format_plot,int masque_layer); void PlotTextePcb( TEXTE_PCB * pt_texte,int format_plot,int masque_layer);
/* Trace 1 Texte type PCB , c.a.d autre que les textes sur modules, /* Trace 1 Texte type PCB , c.a.d autre que les textes sur modules,
prepare les parametres de trace de Plot_1_texte */ prepare les parametres de trace de texte */
void PlotArc(int format_plot, wxPoint centre, int start_angle,int end_angle, void PlotArc(int format_plot, wxPoint centre, int start_angle,int end_angle,
int rayon,int width); int rayon,int width);
void PlotCircle(int format_plot,int width, wxPoint centre, int rayon); void PlotCircle(int format_plot,int width, wxPoint centre, int rayon);
void PlotFilledPolygon(int format_plot, int nbpoints, int * coord); void PlotFilledPolygon(int format_plot, int nbpoints, int * coord);
void PlotPolygon(int format_plot, int nbpoints, int * coord, int width); void PlotPolygon(int format_plot, int nbpoints, int * coord, int width);
void Plot_1_texte( int format_plot,
const wxString & Text, int t_orient,
int width, int ox,int oy,int size_h,int size_v,
bool centreX = TRUE, bool centreY = TRUE);
/* Routine de base de trace de 1 chaine de caracteres */
void PlotDrawSegment( DRAWSEGMENT* PtSegm, int format_plot,int masque_layer ); void PlotDrawSegment( DRAWSEGMENT* PtSegm, int format_plot,int masque_layer );
...@@ -165,10 +144,7 @@ void Plot_1_EdgeModule(int format_plot, EDGE_MODULE * PtEdge); ...@@ -165,10 +144,7 @@ void Plot_1_EdgeModule(int format_plot, EDGE_MODULE * PtEdge);
void PlotFilledAreas( ZONE_CONTAINER * aZone, int aFormat); void PlotFilledAreas( ZONE_CONTAINER * aZone, int aFormat);
/* PLOTGERB.CPP */ /* PLOTGERB.CPP */
void PlotGERBERLine(wxPoint start, wxPoint end, int width); void SelectD_CODE_For_LineDraw( int aSize );
void PlotCircle_GERBER( wxPoint centre, int rayon, int width);
void PlotFilledPolygon_GERBER(int nb_segm, int * coord);
void PlotPolygon_GERBER(int nb_segm, int * coord, int width);
void trace_1_contour_GERBER(wxPoint pos, wxSize size, wxSize delta, void trace_1_contour_GERBER(wxPoint pos, wxSize size, wxSize delta,
int penwidth, int orient); int penwidth, int orient);
/* Trace 1 contour rectangulaire ou trapezoidal d'orientation quelconque /* Trace 1 contour rectangulaire ou trapezoidal d'orientation quelconque
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
/* Fichier PLOT_RTN.CPP*/ /* Fichier PLOT_RTN.CPP*/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "plot_common.h" #include "plot_common.h"
...@@ -13,14 +12,10 @@ ...@@ -13,14 +12,10 @@
#include "pcbplot.h" #include "pcbplot.h"
#include "trigo.h" #include "trigo.h"
#include "grfonte.h"
#include "protos.h"
/* Fonctions locales */ /* Fonctions locales */
static void Plot_Edges_Modules( BOARD* pcb, int format_plot, int masque_layer ); static void Plot_Edges_Modules( BOARD* pcb, int format_plot, int masque_layer );
static void PlotTextModule( TEXTE_MODULE* pt_texte ); static void PlotTextModule( TEXTE_MODULE* pt_texte, int format_plot );
/**********************************************************/ /**********************************************************/
...@@ -247,7 +242,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot, ...@@ -247,7 +242,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot,
/* Trace effectif des textes */ /* Trace effectif des textes */
if( trace_ref ) if( trace_ref )
{ {
PlotTextModule( Module->m_Reference ); PlotTextModule( Module->m_Reference, format_plot );
nb_items++; nb_items++;
msg.Printf( wxT( "%d" ), nb_items ); msg.Printf( wxT( "%d" ), nb_items );
Affiche_1_Parametre( this, 64, wxEmptyString, msg, LIGHTBLUE ); Affiche_1_Parametre( this, 64, wxEmptyString, msg, LIGHTBLUE );
...@@ -255,7 +250,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot, ...@@ -255,7 +250,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot,
if( trace_val ) if( trace_val )
{ {
PlotTextModule( Module->m_Value ); PlotTextModule( Module->m_Value, format_plot );
nb_items++; nb_items++;
msg.Printf( wxT( "%d" ), nb_items ); msg.Printf( wxT( "%d" ), nb_items );
Affiche_1_Parametre( this, 64, wxEmptyString, msg, LIGHTBLUE ); Affiche_1_Parametre( this, 64, wxEmptyString, msg, LIGHTBLUE );
...@@ -287,7 +282,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot, ...@@ -287,7 +282,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot,
if( !( (1<<textLayer) & masque_layer ) ) if( !( (1<<textLayer) & masque_layer ) )
continue; continue;
PlotTextModule( pt_texte ); PlotTextModule( pt_texte, format_plot );
nb_items++; nb_items++;
msg.Printf( wxT( "%d" ), nb_items ); msg.Printf( wxT( "%d" ), nb_items );
Affiche_1_Parametre( this, 64, wxEmptyString, msg, LIGHTBLUE ); Affiche_1_Parametre( this, 64, wxEmptyString, msg, LIGHTBLUE );
...@@ -308,13 +303,13 @@ exit: ...@@ -308,13 +303,13 @@ exit:
} }
/**************************************************/ /********************************************************************/
static void PlotTextModule( TEXTE_MODULE* pt_texte ) static void PlotTextModule( TEXTE_MODULE* pt_texte, int format_plot )
/**************************************************/ /********************************************************************/
{ {
wxSize size; wxSize size;
wxPoint pos; wxPoint pos;
int orient, thickness, no_miroir; int orient, thickness;
/* calcul des parametres du texte :*/ /* calcul des parametres du texte :*/
size = pt_texte->m_Size; size = pt_texte->m_Size;
...@@ -322,17 +317,21 @@ static void PlotTextModule( TEXTE_MODULE* pt_texte ) ...@@ -322,17 +317,21 @@ static void PlotTextModule( TEXTE_MODULE* pt_texte )
orient = pt_texte->GetDrawRotation(); orient = pt_texte->GetDrawRotation();
no_miroir = pt_texte->m_Miroir & 1;
thickness = pt_texte->m_Width; thickness = pt_texte->m_Width;
if( Plot_Mode == FILAIRE ) if( Plot_Mode == FILAIRE )
thickness = g_PlotLine_Width; thickness = g_PlotLine_Width;
if( no_miroir == 0 ) if( pt_texte->m_Mirror )
size.x = -size.x; // Text is mirrored size.x = -size.x; // Text is mirrored
Plot_1_texte( g_PlotFormat, pt_texte->m_Text, if ( format_plot == PLOT_FORMAT_GERBER )
orient, thickness, SelectD_CODE_For_LineDraw(thickness);
pos.x, pos.y, size.x, size.y );
PlotGraphicText( format_plot, pos, BLACK,
pt_texte->m_Text,
orient, size,
pt_texte->m_HJustify, pt_texte->m_VJustify,
thickness, pt_texte->m_Italic );
} }
...@@ -347,8 +346,6 @@ void PlotCotation( COTATION* Cotation, int format_plot, int masque_layer ) ...@@ -347,8 +346,6 @@ void PlotCotation( COTATION* Cotation, int format_plot, int masque_layer )
DrawTmp = new DRAWSEGMENT( NULL ); DrawTmp = new DRAWSEGMENT( NULL );
// (Following command has been superceded by new commands elsewhere.)
// masque_layer |= EDGE_LAYER;
DrawTmp->m_Width = Cotation->m_Width; DrawTmp->m_Width = Cotation->m_Width;
DrawTmp->SetLayer( Cotation->GetLayer() ); DrawTmp->SetLayer( Cotation->GetLayer() );
...@@ -398,8 +395,6 @@ void PlotMirePcb( MIREPCB* Mire, int format_plot, int masque_layer ) ...@@ -398,8 +395,6 @@ void PlotMirePcb( MIREPCB* Mire, int format_plot, int masque_layer )
DrawTmp = new DRAWSEGMENT( NULL ); DrawTmp = new DRAWSEGMENT( NULL );
// (Following command has been superceded by new commands elsewhere.)
// masque_layer |= EDGE_LAYER;
DrawTmp->m_Width = Mire->m_Width; DrawTmp->m_Width = Mire->m_Width;
DrawTmp->SetLayer( Mire->GetLayer() ); DrawTmp->SetLayer( Mire->GetLayer() );
...@@ -581,136 +576,17 @@ void PlotTextePcb( TEXTE_PCB* pt_texte, int format_plot, int masque_layer ) ...@@ -581,136 +576,17 @@ void PlotTextePcb( TEXTE_PCB* pt_texte, int format_plot, int masque_layer )
if( pt_texte->m_Mirror ) if( pt_texte->m_Mirror )
size.x = -size.x; size.x = -size.x;
Plot_1_texte( format_plot, pt_texte->m_Text, orient, if ( format_plot == PLOT_FORMAT_GERBER )
thickness, pos.x, pos.y, size.x, size.y ); SelectD_CODE_For_LineDraw(thickness);
}
/**********************************************************************/
void Plot_1_texte( int format_plot, const wxString& Text, int angle,
int thickness, int cX, int cY, int size_h, int size_v,
bool centreX, bool centreY )
/***********************************************************************/
/*
* Trace de 1 texte:
* ptr = pointeur sur le texte
* angle = angle d'orientation, dependant aussi du mode de trace (miroir..)
* cX, cY = position du centre du texte
* size_h , size_v = dimensions ( algebriques );
*/
{
int kk = 0, k1, k2, end;
int espacement;
char f_cod, plume;
const SH_CODE* ptcar;
int ox, oy, fx, fy; /* Coord de debut et fin des segments a tracer */
int sx, sy; /* coord du debut du caractere courant */
int nbcodes = Text.Len();
espacement = ( (10 * size_h) / 9 ) + ( (size_h >= 0 ) ? thickness : -thickness );
/* calcul de la position du debut du texte */
if( centreX )
sx = cX - ( (espacement * nbcodes) / 2 );
else
sx = cX;
if( centreY )
sy = cY + (size_v / 2);
else
sy = cY;
/* trace du texte */
for( ; kk < nbcodes; kk++ )
{
#if defined(wxUSE_UNICODE) && defined(KICAD_CYRILLIC)
int code = Text.GetChar(kk) & 0x7FF;
if ( code > 0x40F && code < 0x450 ) // big small Cyr
code = utf8_to_ascii[code - 0x410] & 0xFF;
else
code = code & 0xFF;
#else
int code = Text.GetChar( kk ) & 0xFF;
#endif
ptcar = graphic_fonte_shape[code]; /* ptcar pointe la description
* du caractere a dessiner */
plume = 'U';
ox = sx;
oy = sy;
RotatePoint( &ox, &oy, cX, cY, angle );
fx = ox; fy = oy;
for( end = 0; end == 0; ptcar++ )
{
f_cod = *ptcar;
/* get code n de la forme selectionnee */
switch( f_cod )
{
case 'X':
end = 1; /* fin du caractere */
break;
case 'U':
case 'D':
plume = f_cod; break;
default:
k1 = f_cod; // Coord X
k1 = (k1 * size_v) / 9;
ptcar++;
k2 = *ptcar; // Coord Y
k2 = (k2 * size_h) / 8;
fx = k2 + sx; fy = -k1 + sy;
RotatePoint( &fx, &fy, cX, cY, angle );
/* Trace du segment */
if( plume == 'D' )
{
switch( format_plot )
{
case PLOT_FORMAT_GERBER:
PlotGERBERLine( wxPoint( ox, oy ), wxPoint( fx, fy ), thickness );
break;
case PLOT_FORMAT_HPGL:
trace_1_segment_HPGL( ox, oy, fx, fy, thickness );
break;
case PLOT_FORMAT_POST:
PlotFilledSegmentPS( wxPoint( ox, oy ), wxPoint( fx, fy ), thickness );
break;
}
}
ox = fx; oy = fy;
}
/* fin switch decodade matrice de forme */
}
/* end boucle for = end trace de 1 caractere */
sx += espacement; PlotGraphicText( format_plot, pos, BLACK,
} pt_texte->m_Text,
orient, size,
/* end trace du texte */ pt_texte->m_HJustify, pt_texte->m_VJustify,
thickness, pt_texte->m_Italic );
} }
/***********************************/
void Affiche_erreur( int nb_err )
/***********************************/
/* Affiche le nombre d'erreurs commises ( segments traces avec plume trop grosse
* ou autres */
{
// sprintf(msg,"%d",nb_err) ;
// Affiche_1_Parametre(this, 30,"Err",msg,GREEN) ;
}
/*********************************************************/ /*********************************************************/
void PlotFilledAreas( ZONE_CONTAINER * aZone, int aFormat ) void PlotFilledAreas( ZONE_CONTAINER * aZone, int aFormat )
/*********************************************************/ /*********************************************************/
...@@ -835,6 +711,7 @@ void PlotCircle( int format_plot, int thickness, wxPoint centre, int radius ) ...@@ -835,6 +711,7 @@ void PlotCircle( int format_plot, int thickness, wxPoint centre, int radius )
switch( format_plot ) switch( format_plot )
{ {
case PLOT_FORMAT_GERBER: case PLOT_FORMAT_GERBER:
SelectD_CODE_For_LineDraw(thickness);
PlotCircle_GERBER( centre, radius, thickness ); PlotCircle_GERBER( centre, radius, thickness );
break; break;
...@@ -878,6 +755,7 @@ void PlotPolygon( int format_plot, int nbpoints, int* coord, int width ) ...@@ -878,6 +755,7 @@ void PlotPolygon( int format_plot, int nbpoints, int* coord, int width )
switch( format_plot ) switch( format_plot )
{ {
case PLOT_FORMAT_GERBER: case PLOT_FORMAT_GERBER:
SelectD_CODE_For_LineDraw(width);
PlotPolygon_GERBER( nbpoints, coord, width ); PlotPolygon_GERBER( nbpoints, coord, width );
break; break;
...@@ -933,6 +811,9 @@ void PlotArc( int format_plot, wxPoint centre, int start_angle, int end_angle, ...@@ -933,6 +811,9 @@ void PlotArc( int format_plot, wxPoint centre, int start_angle, int end_angle,
RotatePoint( &ox, &oy, start_angle ); RotatePoint( &ox, &oy, start_angle );
if ( format_plot == PLOT_FORMAT_GERBER )
SelectD_CODE_For_LineDraw(thickness);
delta = 120; /* un cercle sera trace en 3600/delta = 30 segments / cercle*/ delta = 120; /* un cercle sera trace en 3600/delta = 30 segments / cercle*/
for( ii = start_angle + delta; ii < end_angle; ii += delta ) for( ii = start_angle + delta; ii < end_angle; ii += delta )
{ {
......
This diff is collapsed.
/************/
/* pcbplot.h*/
/************/
#ifndef PLOTGERB_H
#define PLOTGERB_H
/* Format Gerber : NOTES :
Fonctions preparatoires:
Gn =
G01 interpolation lineaire ( trace de droites )
G02,G20,G21 Interpolation circulaire , sens trigo < 0
G03,G30,G31 Interpolation circulaire , sens trigo > 0
G04 commentaire
G06 Interpolation parabolique
G07 Interpolation cubique
G10 interpolation lineaire ( echelle 10x )
G11 interpolation lineaire ( echelle 0.1x )
G12 interpolation lineaire ( echelle 0.01x )
G36 Start polygon description
G37 End polygon description
G52 plot symbole reference par Dnn code
G53 plot symbole reference par Dnn ; symbole tourne de -90 degres
G54 Selection d'outil
G55 Mode exposition photo
G56 plot symbole reference par Dnn A code
G57 affiche le symbole reference sur la console
G58 plot et affiche le symbole reference sur la console
G60 interpolation lineaire ( echelle 100x )
G70 Unites = Inches
G71 Unites = Millimetres
G74 supprime interpolation circulaire sur 360 degre, revient a G01
G75 Active interpolation circulaire sur 360 degre
G90 Mode Coordonnees absolues
G91 Mode Coordonnees Relatives
Coordonnees X,Y
X,Y sont suivies de + ou - et de m+n chiffres (non separes)
m = partie entiere
n = partie apres la virgule
formats classiques : m = 2, n = 3 (format 2.3)
m = 3, n = 4 (format 3.4)
ex:
G__ X00345Y-06123 D__*
Outils et D_CODES
numero d'outil ( identification des formes )
1 a 99 (classique)
1 a 999
D_CODES:
D01 ... D9 = codes d'action:
D01 = activation de lumiere ( baisser de plume)
D02 = extinction de lumiere ( lever de plume)
D03 = Flash
D09 = VAPE Flash
D51 = precede par G54 -> Select VAPE
D10 ... D255 = Indentification d'outils ( d'ouvertures )
Ne sont pas tj dans l'ordre ( voir tableau ci dessous)
*/
/*************************************/
/* Constantes utiles en trace GERBER */
/*************************************/
/* codes de type de forme d'outils */
/*
#define GERB_CIRCLE 1
#define GERB_RECT 2
#define GERB_LINE 3
#define GERB_OVALE 4
#define GERB_DONUT 5
*/
/* liste des D_CODES en fonction de leur numero d'ordre (numero d'outil)
(l'ordre 0 n'est pas utilise) ;
Tools have D_CODES >= 10
D_CODES <= 9 are used for commands only:
D01 ... D9 = command codes for photo plotting:
D01 = Light on
D02 = Light off
D03 = Flash
D04 .. D08 = ?
D09 = VAPE Flash
*/
#define FIRST_DCODE_VALUE 10
/* Structure de Description d'un D_CODE GERBER : */
class D_CODE
{
public:
D_CODE * m_Pnext, * m_Pback; /* for a linked list */
wxSize m_Size; /* horiz and Vert size*/
int m_Type; /* Type ( Line, rect , circulaire , ovale .. ); -1 = not used (free) descr */
int m_NumDcode; /* code number ( >= 10 ); 0 = not in use */
D_CODE()
{
m_Pnext = m_Pback = NULL;
m_Type = -1;
m_NumDcode = 0;
}
} ;
#endif /* #define PLOTGERB_H */
...@@ -513,7 +513,7 @@ void trace_1_pastille_RONDE_HPGL( wxPoint pos, int diametre, int modetrace ) ...@@ -513,7 +513,7 @@ void trace_1_pastille_RONDE_HPGL( wxPoint pos, int diametre, int modetrace )
if( rayon < 0 ) if( rayon < 0 )
{ {
rayon = 0; nb_plot_erreur++; Affiche_erreur( nb_plot_erreur ); rayon = 0; nb_plot_erreur++;
} }
wxSize rsize( rayon, rayon ); wxSize rsize( rayon, rayon );
...@@ -563,7 +563,7 @@ void PlotRectangularPad_HPGL( wxPoint padpos, wxSize padsize, ...@@ -563,7 +563,7 @@ void PlotRectangularPad_HPGL( wxPoint padpos, wxSize padsize,
if( (size.x < 0 ) || (size.y < 0) ) if( (size.x < 0 ) || (size.y < 0) )
{ {
nb_plot_erreur++; Affiche_erreur( nb_plot_erreur ); nb_plot_erreur++;
} }
if( size.x < 0 ) if( size.x < 0 )
size.x = 0;if( size.y < 0 ) size.x = 0;if( size.y < 0 )
...@@ -810,7 +810,7 @@ void trace_1_segment_HPGL( int pos_X0, int pos_Y0, int pos_X1, int pos_Y1, ...@@ -810,7 +810,7 @@ void trace_1_segment_HPGL( int pos_X0, int pos_Y0, int pos_X1, int pos_Y1,
dh = (epaisseur - (int) pen_diam ) / 2; dh = (epaisseur - (int) pen_diam ) / 2;
if( dh < 0 ) if( dh < 0 )
{ {
dh = 0; nb_plot_erreur++; Affiche_erreur( nb_plot_erreur ); dh = 0; nb_plot_erreur++;
} }
if( (dh == 0) || (Plot_Mode == FILAIRE) ) /* Le trace se reduit a 1 trait */ if( (dh == 0) || (Plot_Mode == FILAIRE) ) /* Le trace se reduit a 1 trait */
......
...@@ -326,12 +326,6 @@ void Trace_Block( WinEDA_DrawPanel* panel, wxDC* DC, int ox, int oy, int fx, ...@@ -326,12 +326,6 @@ void Trace_Block( WinEDA_DrawPanel* panel, wxDC* DC, int ox, int oy, int fx,
/* Routine de trace d'un rectangle symbolisant un block /* Routine de trace d'un rectangle symbolisant un block
* (toujours en mode XOR) */ * (toujours en mode XOR) */
/***************/
/* PLOT_RTN.CPP */
/***************/
void Affiche_erreur( int nb_err );
/*****************************************************************/ /*****************************************************************/
/* AFFICHE.CPP: (Fonctions d'affichage de messages, parametres... */ /* AFFICHE.CPP: (Fonctions d'affichage de messages, parametres... */
......
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