mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-07 23:25:34 +00:00
Cleaning code to draw/plot texts; italic allowed for pcbnew
This commit is contained in:
parent
7b6bb15349
commit
daeb9f0e07
CHANGELOG.txt
common
CMakeLists.txtcommon_plotHPGL_functions.cppcommon_plotPS_functions.cppcommon_plot_functions.cppdrawtxt.cppedaappl.cppmakefile.include
gerbview
include
pcbnew
CMakeLists.txtclass_text_mod.cppclass_text_mod.hdialog_edit_mod_text.cppdialog_edit_mod_text.pjddialog_edit_module_text.cppdialog_edit_module_text.hdialog_edit_module_text_base.cppdialog_edit_module_text_base.fbpdialog_edit_module_text_base.hgen_drill_report_files.cppmakefile.includemodules.cpppcbplot.hplot_rtn.cppplotgerb.cppplotgerb.hplothpgl.cppprotos.h
@ -5,11 +5,18 @@ Started 2007-June-11
|
||||
Please add newer entries at the top, list the date and your name with
|
||||
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>
|
||||
================================================================================
|
||||
++All
|
||||
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)
|
||||
In eeschema, italic and bold texts allowed (in pcbenew, texts thickness is already adjustable)
|
||||
|
||||
|
@ -12,7 +12,8 @@ set(COMMON_SRCS
|
||||
common_plot_functions.cpp
|
||||
common_plotHPGL_functions.cpp
|
||||
common_plotPS_functions.cpp
|
||||
confirm.cpp
|
||||
common_plotGERBER_functions.cpp
|
||||
confirm.cpp
|
||||
copy_to_clipboard.cpp
|
||||
dcsvg.cpp
|
||||
displlst.cpp
|
||||
|
@ -14,13 +14,6 @@
|
||||
/* parametre HPGL pour trace de cercle: */
|
||||
#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
|
||||
void Move_Plume_HPGL( wxPoint pos, 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
|
||||
* xscale,yscale = coordinate scale (scale coefficient for coordinates)
|
||||
* device_xscale,device_yscale = device coordinate scale (i.e scale used by plot device)
|
||||
* g_Plot_XScale,g_Plot_YScale = coordinate scale (scale coefficient for coordinates)
|
||||
* device_g_Plot_XScale,device_g_Plot_YScale = device coordinate scale (i.e scale used by plot device)
|
||||
*/
|
||||
{
|
||||
PlotOffset = offset;
|
||||
XScale = xscale;
|
||||
YScale = yscale;
|
||||
g_DefaultPenWidth = 6; /* epaisseur du trait standard en 1/1000 pouce */
|
||||
PlotOrientOptions = orient;
|
||||
g_CurrentPenWidth = -1;
|
||||
g_Plot_PlotOffset = offset;
|
||||
g_Plot_XScale = aXScale;
|
||||
g_Plot_YScale = aYScale;
|
||||
g_Plot_DefaultPenWidth = 6; /* epaisseur du trait standard en 1/1000 pouce */
|
||||
g_Plot_PlotOrientOptions = orient;
|
||||
g_Plot_CurrentPenWidth = -1;
|
||||
}
|
||||
|
||||
|
||||
@ -51,8 +44,8 @@ bool PrintHeaderHPGL( FILE* plot_file, int pen_speed, int pen_num )
|
||||
{
|
||||
char Line[256];
|
||||
|
||||
PlotOutputFile = plot_file;
|
||||
etat_plume = 'U';
|
||||
g_Plot_PlotOutputFile = plot_file;
|
||||
g_Plot_PenState = 'U';
|
||||
sprintf( Line, "IN;VS%d;PU;PA;SP%d;\n", pen_speed, pen_num );
|
||||
fputs( Line, plot_file );
|
||||
return TRUE;
|
||||
@ -79,7 +72,7 @@ void PlotRectHPGL( wxPoint p1, wxPoint p2, bool fill, int width )
|
||||
|
||||
Plume_HPGL( 'U' );
|
||||
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;
|
||||
}
|
||||
@ -93,14 +86,14 @@ void PlotCircleHPGL( wxPoint centre, int diameter, bool fill, int width )
|
||||
char Line[256];
|
||||
|
||||
UserToDeviceCoordinate( centre );
|
||||
rayon = (int) (diameter / 2 * XScale);
|
||||
rayon = (int) (diameter / 2 * g_Plot_XScale);
|
||||
|
||||
if( rayon < 0 )
|
||||
rayon = 0;
|
||||
|
||||
Plume_HPGL( 'U' );
|
||||
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;
|
||||
}
|
||||
@ -129,7 +122,7 @@ void PlotArcHPGL( wxPoint centre, int StAngle, int EndAngle, int rayon, bool fil
|
||||
|
||||
cpos = centre; UserToDeviceCoordinate( cpos );
|
||||
|
||||
if( PlotOrientOptions == PLOT_MIROIR )
|
||||
if( g_Plot_PlotOrientOptions == PLOT_MIROIR )
|
||||
{
|
||||
EndAngle = -EndAngle;
|
||||
StAngle = -StAngle;
|
||||
@ -143,11 +136,11 @@ void PlotArcHPGL( wxPoint centre, int StAngle, int EndAngle, int rayon, bool fil
|
||||
|
||||
Plume_HPGL( 'U' );
|
||||
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
|
||||
fputs( Line, PlotOutputFile );
|
||||
sprintf( Line, ", %d", CHORD_ANGLE ); fputs( Line, PlotOutputFile );
|
||||
sprintf( Line, ";PU;\n" ); fputs( Line, PlotOutputFile );
|
||||
fputs( Line, g_Plot_PlotOutputFile );
|
||||
sprintf( Line, ", %d", CHORD_ANGLE ); fputs( Line, g_Plot_PlotOutputFile );
|
||||
sprintf( Line, ";PU;\n" ); fputs( Line, g_Plot_PlotOutputFile );
|
||||
Plume_HPGL( 'U' );
|
||||
}
|
||||
|
||||
@ -205,7 +198,7 @@ void Move_Plume_HPGL( wxPoint pos, int plume )
|
||||
Plume_HPGL( plume );
|
||||
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 )
|
||||
{
|
||||
if( plume == 'U' )
|
||||
{
|
||||
if( etat_plume != 'U' )
|
||||
fputs( "PU;", PlotOutputFile );
|
||||
etat_plume = 'U';
|
||||
if( g_Plot_PenState != 'U' )
|
||||
fputs( "PU;", g_Plot_PlotOutputFile );
|
||||
g_Plot_PenState = 'U';
|
||||
}
|
||||
else
|
||||
{
|
||||
if( etat_plume != 'D' )
|
||||
fputs( "PD;", PlotOutputFile );
|
||||
etat_plume = 'D';
|
||||
if( g_Plot_PenState != 'D' )
|
||||
fputs( "PD;", g_Plot_PlotOutputFile );
|
||||
g_Plot_PenState = 'D';
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
/******************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
#include "trigo.h"
|
||||
#include "wxstruct.h"
|
||||
#include "base_struct.h"
|
||||
@ -11,36 +10,26 @@
|
||||
#include "plot_common.h"
|
||||
#include "macros.h"
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
// 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;
|
||||
|
||||
// Locales
|
||||
static Ki_PageDescr* SheetPS;
|
||||
|
||||
|
||||
/*************************************************************************************/
|
||||
void InitPlotParametresPS( wxPoint offset, Ki_PageDescr* sheet,
|
||||
double xscale, double yscale, int orient )
|
||||
double aXScale, double aYScale, int orient )
|
||||
/*************************************************************************************/
|
||||
|
||||
/* Set the plot offset for the current plotting
|
||||
* xscale,yscale = coordinate scale (scale coefficient for coordinates)
|
||||
* device_xscale,device_yscale = device coordinate scale (i.e scale used by plot device)
|
||||
* g_Plot_XScale,g_Plot_YScale = coordinate scale (scale coefficient for coordinates)
|
||||
* device_g_Plot_XScale,device_g_Plot_YScale = device coordinate scale (i.e scale used by plot device)
|
||||
*/
|
||||
{
|
||||
PlotOrientOptions = orient;
|
||||
PlotOffset = offset;
|
||||
g_Plot_PlotOrientOptions = orient;
|
||||
g_Plot_PlotOffset = offset;
|
||||
SheetPS = sheet;
|
||||
XScale = xscale;
|
||||
YScale = yscale;
|
||||
g_CurrentPenWidth = -1;
|
||||
g_Plot_XScale = aXScale;
|
||||
g_Plot_YScale = aYScale;
|
||||
g_Plot_CurrentPenWidth = -1;
|
||||
}
|
||||
|
||||
|
||||
@ -51,8 +40,8 @@ void SetDefaultLineWidthPS( int width )
|
||||
/* Set the default line width (in 1/1000 inch) for the current plotting
|
||||
*/
|
||||
{
|
||||
g_DefaultPenWidth = width; // epaisseur du trait standard en 1/1000 pouce
|
||||
g_CurrentPenWidth = -1;
|
||||
g_Plot_DefaultPenWidth = width; // epaisseur du trait standard en 1/1000 pouce
|
||||
g_Plot_CurrentPenWidth = -1;
|
||||
}
|
||||
|
||||
|
||||
@ -68,12 +57,12 @@ void SetCurrentLineWidthPS( int width )
|
||||
if( width > 0 )
|
||||
pen_width = width;
|
||||
else
|
||||
pen_width = g_DefaultPenWidth;
|
||||
pen_width = g_Plot_DefaultPenWidth;
|
||||
|
||||
if( pen_width != g_CurrentPenWidth )
|
||||
fprintf( PlotOutputFile, "%d setlinewidth\n", (int) (XScale * pen_width) );
|
||||
if( pen_width != g_Plot_CurrentPenWidth )
|
||||
fprintf( g_Plot_PlotOutputFile, "%d setlinewidth\n", (int) (g_Plot_XScale * pen_width) );
|
||||
|
||||
g_CurrentPenWidth = pen_width;
|
||||
g_Plot_CurrentPenWidth = pen_width;
|
||||
}
|
||||
|
||||
|
||||
@ -95,7 +84,7 @@ void SetColorMapPS( int color )
|
||||
(float) ColorRefs[color].m_Green / 255,
|
||||
(float) ColorRefs[color].m_Blue / 255 );
|
||||
to_point( Line );
|
||||
fputs( Line, PlotOutputFile );
|
||||
fputs( Line, g_Plot_PlotOutputFile );
|
||||
}
|
||||
|
||||
|
||||
@ -110,7 +99,7 @@ void PlotFilledSegmentPS( wxPoint start, wxPoint end, int width )
|
||||
UserToDeviceCoordinate( end );
|
||||
|
||||
SetCurrentLineWidthPS( width );
|
||||
fprintf( PlotOutputFile, "%d %d %d %d line\n", start.x, start.y, end.x, end.y );
|
||||
fprintf( g_Plot_PlotOutputFile, "%d %d %d %d line\n", start.x, start.y, end.x, end.y );
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
@ -121,7 +110,7 @@ void PlotRectPS( wxPoint p1, wxPoint p2, bool fill, int width )
|
||||
UserToDeviceCoordinate( p2 );
|
||||
|
||||
SetCurrentLineWidthPS( width );
|
||||
fprintf( PlotOutputFile, "%d %d %d %d rect%d\n", p1.x, p1.y,
|
||||
fprintf( g_Plot_PlotOutputFile, "%d %d %d %d rect%d\n", p1.x, p1.y,
|
||||
p2.x-p1.x, p2.y-p1.y, fill );
|
||||
}
|
||||
|
||||
@ -133,14 +122,14 @@ void PlotCirclePS( wxPoint pos, int diametre, bool fill, int width )
|
||||
char Line[256];
|
||||
|
||||
UserToDeviceCoordinate( pos );
|
||||
rayon = (int) (XScale * diametre / 2);
|
||||
rayon = (int) (g_Plot_XScale * diametre / 2);
|
||||
|
||||
if( rayon < 0 )
|
||||
rayon = 0;
|
||||
|
||||
SetCurrentLineWidthPS( width );
|
||||
sprintf(Line, "%d %d %d cir%d\n", pos.x, pos.y, rayon, fill);
|
||||
fputs( Line, PlotOutputFile );
|
||||
fputs( Line, g_Plot_PlotOutputFile );
|
||||
}
|
||||
|
||||
|
||||
@ -162,18 +151,18 @@ void PlotArcPS( wxPoint centre, int StAngle, int EndAngle, int rayon, bool fill,
|
||||
// Calcul des coord du point de depart :
|
||||
UserToDeviceCoordinate( centre );
|
||||
|
||||
if( PlotOrientOptions == PLOT_MIROIR )
|
||||
if( g_Plot_PlotOrientOptions == PLOT_MIROIR )
|
||||
sprintf( Line, "%d %d %d %f %f arc%d\n", centre.x, centre.y,
|
||||
(int) (rayon * XScale), (float) StAngle / 10, (float) EndAngle / 10,
|
||||
(int) (rayon * g_Plot_XScale), (float) StAngle / 10, (float) EndAngle / 10,
|
||||
fill);
|
||||
else
|
||||
sprintf( Line, "%d %d %d %f %f arc%d\n", centre.x, centre.y,
|
||||
(int) (rayon * XScale), -(float) EndAngle / 10, -(float) StAngle / 10,
|
||||
(int) (rayon * g_Plot_XScale), -(float) EndAngle / 10, -(float) StAngle / 10,
|
||||
fill);
|
||||
|
||||
// Undo internationalization printf (float x.y printed x,y)
|
||||
to_point( Line );
|
||||
fputs( Line, PlotOutputFile );
|
||||
fputs( Line, g_Plot_PlotOutputFile );
|
||||
}
|
||||
|
||||
|
||||
@ -199,18 +188,18 @@ void PlotPolyPS( int nb_segm, int* coord, bool fill, int width )
|
||||
pos.x = coord[0];
|
||||
pos.y = coord[1];
|
||||
UserToDeviceCoordinate( pos );
|
||||
fprintf( PlotOutputFile, "newpath %d %d moveto\n", pos.x, pos.y );
|
||||
fprintf( g_Plot_PlotOutputFile, "newpath %d %d moveto\n", pos.x, pos.y );
|
||||
|
||||
for( ii = 1; ii < nb_segm; ii++ )
|
||||
{
|
||||
pos.x = coord[2 * ii];
|
||||
pos.y = coord[2 * ii + 1];
|
||||
UserToDeviceCoordinate( pos );
|
||||
fprintf( PlotOutputFile, "%d %d lineto\n", pos.x, pos.y );
|
||||
fprintf( g_Plot_PlotOutputFile, "%d %d lineto\n", pos.x, pos.y );
|
||||
}
|
||||
|
||||
// Fermeture du polygone
|
||||
fprintf(PlotOutputFile, "poly%d\n", fill);
|
||||
fprintf(g_Plot_PlotOutputFile, "poly%d\n", fill);
|
||||
}
|
||||
|
||||
|
||||
@ -229,10 +218,10 @@ void LineTo_PS( wxPoint pos, int plume )
|
||||
{
|
||||
char Line[256];
|
||||
sprintf( Line, "%d %d %d %d line\n",
|
||||
LastPenPosition.x, LastPenPosition.y, pos.x, pos.y );
|
||||
fputs( Line, PlotOutputFile );
|
||||
g_Plot_LastPenPosition.x, g_Plot_LastPenPosition.y, pos.x, pos.y );
|
||||
fputs( Line, g_Plot_PlotOutputFile );
|
||||
}
|
||||
LastPenPosition = pos;
|
||||
g_Plot_LastPenPosition = pos;
|
||||
}
|
||||
|
||||
|
||||
@ -294,26 +283,26 @@ void PrintHeaderPS( FILE* file, const wxString& Creator,
|
||||
int ii;
|
||||
time_t time1970 = time( NULL );
|
||||
|
||||
PlotOutputFile = file;
|
||||
g_Plot_PlotOutputFile = file;
|
||||
|
||||
fputs( "%!PS-Adobe-3.0\n", PlotOutputFile ); // Print header
|
||||
fputs( "%!PS-Adobe-3.0\n", g_Plot_PlotOutputFile ); // Print header
|
||||
|
||||
sprintf( Line, "%%%%Creator: %s\n", CONV_TO_UTF8( Creator ) );
|
||||
fputs( Line, PlotOutputFile );
|
||||
fputs( Line, g_Plot_PlotOutputFile );
|
||||
|
||||
// A "newline" character ("\n") is not included in the following string,
|
||||
// because it is provided by the ctime() function.
|
||||
sprintf( Line, "%%%%CreationDate: %s", ctime( &time1970 ) );
|
||||
fputs( Line, PlotOutputFile );
|
||||
fputs( Line, g_Plot_PlotOutputFile );
|
||||
|
||||
sprintf( Line, "%%%%Title: %s\n", CONV_TO_UTF8( FileName ) );
|
||||
fputs( Line, PlotOutputFile );
|
||||
fputs( Line, g_Plot_PlotOutputFile );
|
||||
|
||||
sprintf( Line, "%%%%Pages: %d\n", PageCount );
|
||||
fputs( Line, PlotOutputFile );
|
||||
fputs( Line, g_Plot_PlotOutputFile );
|
||||
|
||||
sprintf( Line, "%%%%PageOrder: Ascend\n" );
|
||||
fputs( Line, PlotOutputFile );
|
||||
fputs( Line, g_Plot_PlotOutputFile );
|
||||
|
||||
// Print boundary box en 1/72 pouce, box is in mils
|
||||
const double CONV_SCALE = MIL_TO_INCH * 72;
|
||||
@ -325,7 +314,7 @@ void PrintHeaderPS( FILE* file, const wxString& Creator,
|
||||
(int) floor( (BBox[1] * CONV_SCALE) ), (int) floor( (BBox[0] * CONV_SCALE) ),
|
||||
(int) ceil( (BBox[3] * CONV_SCALE) ), (int) ceil( (BBox[2] * CONV_SCALE) ) );
|
||||
|
||||
fputs( Line, PlotOutputFile );
|
||||
fputs( Line, g_Plot_PlotOutputFile );
|
||||
|
||||
// Specify the size of the sheet and the name associated with that size.
|
||||
// (If the "User size" option has been selected for the sheet size,
|
||||
@ -349,17 +338,17 @@ void PrintHeaderPS( FILE* file, const wxString& Creator,
|
||||
CONV_TO_UTF8( SheetPS->m_Name ),
|
||||
(int) round( SheetPS->m_Size.y * CONV_SCALE ),
|
||||
(int) round( SheetPS->m_Size.x * CONV_SCALE ) );
|
||||
fputs( Line, PlotOutputFile );
|
||||
fputs( Line, g_Plot_PlotOutputFile );
|
||||
|
||||
if( PaperOrientation == wxPORTRAIT )
|
||||
sprintf( Line, "%%%%Orientation: Portrait\n" );
|
||||
else
|
||||
sprintf( Line, "%%%%Orientation: Landscape\n" );
|
||||
|
||||
fputs( Line, PlotOutputFile );
|
||||
fputs( Line, g_Plot_PlotOutputFile );
|
||||
|
||||
sprintf( Line, "%%%%EndComments\n" );
|
||||
fputs( Line, PlotOutputFile );
|
||||
fputs( Line, g_Plot_PlotOutputFile );
|
||||
|
||||
// Now specify various other details.
|
||||
|
||||
@ -368,11 +357,11 @@ void PrintHeaderPS( FILE* file, const wxString& Creator,
|
||||
// contents of the postscript file comply with the details specified
|
||||
// within the Document Structuring Convention.
|
||||
sprintf( Line, "%%%%Page: 1 1\n" );
|
||||
fputs( Line, PlotOutputFile );
|
||||
fputs( Line, g_Plot_PlotOutputFile );
|
||||
|
||||
for( ii = 0; PSMacro[ii] != NULL; ii++ )
|
||||
{
|
||||
fputs( PSMacro[ii], PlotOutputFile );
|
||||
fputs( PSMacro[ii], g_Plot_PlotOutputFile );
|
||||
}
|
||||
|
||||
if( PaperOrientation == wxLANDSCAPE )
|
||||
@ -386,15 +375,15 @@ void PrintHeaderPS( FILE* file, const wxString& Creator,
|
||||
// compensation internationalisation printf (float x.y généré x,y)
|
||||
to_point( Line );
|
||||
|
||||
fputs( Line, PlotOutputFile );
|
||||
fputs( Line, g_Plot_PlotOutputFile );
|
||||
|
||||
sprintf( Line, "%f %f scale\t\t%% Move to User coordinates\n",
|
||||
XScale, YScale );
|
||||
g_Plot_XScale, g_Plot_YScale );
|
||||
to_point( Line );
|
||||
fputs( Line, PlotOutputFile );
|
||||
fputs( Line, g_Plot_PlotOutputFile );
|
||||
|
||||
// Set default line width ( g_DefaultPenWidth is in user units )
|
||||
fprintf( PlotOutputFile, "%d setlinewidth\n", g_DefaultPenWidth );
|
||||
// Set default line width ( g_Plot_DefaultPenWidth is in user units )
|
||||
fprintf( g_Plot_PlotOutputFile, "%d setlinewidth\n", g_Plot_DefaultPenWidth );
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,68 +14,46 @@
|
||||
|
||||
|
||||
// Variables partagees avec Common plot Postscript et HPLG Routines
|
||||
wxPoint LastPenPosition;
|
||||
wxPoint PlotOffset;
|
||||
FILE* PlotOutputFile;
|
||||
double XScale, YScale;
|
||||
int g_DefaultPenWidth;
|
||||
int g_CurrentPenWidth = -1;
|
||||
int PlotOrientOptions, etat_plume;
|
||||
|
||||
|
||||
// Locales
|
||||
static Ki_PageDescr* SheetPS;
|
||||
wxPoint g_Plot_LastPenPosition;
|
||||
wxPoint g_Plot_PlotOffset;
|
||||
FILE* g_Plot_PlotOutputFile;
|
||||
double g_Plot_XScale, g_Plot_YScale;
|
||||
int g_Plot_DefaultPenWidth;
|
||||
int g_Plot_CurrentPenWidth = -1;
|
||||
int g_Plot_PlotOrientOptions, g_Plot_PenState;
|
||||
|
||||
/*************************/
|
||||
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
|
||||
*/
|
||||
{
|
||||
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)
|
||||
*/
|
||||
{
|
||||
XScale = xscale;
|
||||
YScale = yscale;
|
||||
g_Plot_XScale = aXScale;
|
||||
g_Plot_YScale = aYScale;
|
||||
}
|
||||
|
||||
|
||||
/*********************************/
|
||||
void SetPlotOffset( wxPoint offset )
|
||||
void Setg_Plot_PlotOffset( wxPoint offset )
|
||||
/*********************************/
|
||||
|
||||
/* Set the plot offset for the current plotting)
|
||||
*/
|
||||
{
|
||||
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;
|
||||
g_Plot_PlotOffset = offset;
|
||||
}
|
||||
|
||||
|
||||
@ -114,6 +92,9 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
|
||||
break;
|
||||
|
||||
case PLOT_FORMAT_GERBER:
|
||||
FctPlume = LineTo_GERBER;
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@ -507,17 +488,17 @@ void UserToDeviceCoordinate( 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 * XScale);
|
||||
pos.y = (int) (pos.y * YScale);
|
||||
pos.x = (int) (pos.x * g_Plot_XScale);
|
||||
pos.y = (int) (pos.y * g_Plot_YScale);
|
||||
|
||||
switch( PlotOrientOptions ) /* Calcul du cadrage */
|
||||
switch( g_Plot_PlotOrientOptions ) /* Calcul du cadrage */
|
||||
{
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -528,6 +509,6 @@ void UserToDeviceSize( wxSize& size )
|
||||
/************************************/
|
||||
/* modifie les dimension size.x et size.y pour le trace selon l'echelle */
|
||||
{
|
||||
size.x = (int) (size.x * XScale);
|
||||
size.y = (int) (size.y * YScale);
|
||||
size.x = (int) (size.x * g_Plot_XScale);
|
||||
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)
|
||||
|
||||
PenLastPos = pend;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************************/
|
||||
void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aColor,
|
||||
const wxString& aText,
|
||||
@ -372,7 +374,6 @@ void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aCo
|
||||
* @param aItalic = true to simulate an italic font
|
||||
*/
|
||||
{
|
||||
|
||||
// Initialise the actual function used to plot lines:
|
||||
switch( aFormat_plot )
|
||||
{
|
||||
@ -385,6 +386,9 @@ void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aCo
|
||||
break;
|
||||
|
||||
case PLOT_FORMAT_GERBER:
|
||||
MovePenFct = LineTo_GERBER;
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "hotkeys_basic.h"
|
||||
#include "macros.h"
|
||||
#include "online_help.h"
|
||||
|
||||
#include "bitmaps.h"
|
||||
|
||||
|
||||
|
@ -13,6 +13,7 @@ OBJECTS= \
|
||||
copy_to_clipboard.o\
|
||||
class_drawpickedstruct.o\
|
||||
common_plot_functions.o\
|
||||
common_plotGERBER_functions.o\
|
||||
common_plotPS_functions.o\
|
||||
common_plotHPGL_functions.o\
|
||||
dlist.o \
|
||||
|
@ -25,12 +25,6 @@ void Print_PcbItems(BOARD * Pcb, wxDC *DC, int drawmode, int printmasklayer);
|
||||
/*****************/
|
||||
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 */
|
||||
void ComputePlotFileName( char * FullFileName, char * Ext );
|
||||
@ -38,14 +32,10 @@ void calcule_coord_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);
|
||||
/* 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,
|
||||
int rayon,int epaisseur);
|
||||
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 );
|
||||
|
||||
|
@ -31,13 +31,21 @@ static inline bool IsPostScript( int aFormat )
|
||||
|
||||
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 */
|
||||
/*******************************/
|
||||
void SetPlotScale( double xscale, double yscale ); // Set the plot scale for the current plotting)
|
||||
void SetPlotOffset( wxPoint offset ); // Set the plot offset for the current plotting)
|
||||
void InitPlotParametresGERBER( wxPoint offset, double xscale, double yscale );
|
||||
void SetPlotScale( double aXScale, double aYScale ); // Set the plot scale for the current plotting)
|
||||
void Setg_Plot_PlotOffset( wxPoint offset ); // Set the plot offset for the current plotting)
|
||||
void InitPlotParametresGERBER( wxPoint offset, double aXScale, double aYScale );
|
||||
void PlotWorkSheet( int format_plot, BASE_SCREEN* screen );
|
||||
void UserToDeviceCoordinate( wxPoint& pos );
|
||||
|
||||
@ -47,7 +55,7 @@ void UserToDeviceSize( wxSize& size );
|
||||
// modifie les dimension size.x et size.y pour le trace selon l'echelle
|
||||
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
|
||||
|
||||
|
||||
@ -57,8 +65,8 @@ void ForcePenReinit();
|
||||
void SetCurrentLineWidthPS( int width );
|
||||
void InitPlotParametresPS( wxPoint offset,
|
||||
Ki_PageDescr* sheet,
|
||||
double xscale,
|
||||
double yscale,
|
||||
double aXScale,
|
||||
double aYScale,
|
||||
int orient = 0 );
|
||||
void SetDefaultLineWidthPS( int width );
|
||||
void PlotRectPS( wxPoint p1, wxPoint p2, bool fill, int width = -1 );
|
||||
@ -82,7 +90,7 @@ void SetColorMapPS( int color );
|
||||
/*********************************/
|
||||
/* 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 CloseFileHPGL( FILE* plot_file );
|
||||
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 );
|
||||
void Move_Plume_HPGL( wxPoint pos, 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 */
|
||||
|
@ -275,7 +275,6 @@ public:
|
||||
int garde, int tracevia, int modetrace );
|
||||
void Plot_Layer_GERBER( FILE* File, int masque_layer,
|
||||
int garde, int tracevia );
|
||||
int Gen_D_CODE_File( FILE* file );
|
||||
void Plot_Layer_PS( FILE* File, int masque_layer,
|
||||
int garde, int tracevia, int modetrace );
|
||||
|
||||
|
@ -48,7 +48,8 @@ set(PCBNEW_SRCS
|
||||
dialog_copper_zones_base.cpp
|
||||
dialog_display_options_base.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_freeroute_exchange.cpp
|
||||
# dialog_gendrill.cpp
|
||||
|
@ -28,19 +28,16 @@
|
||||
|
||||
/* Constructeur de TEXTE_MODULE */
|
||||
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;
|
||||
|
||||
m_NoShow = 0; /* visible */
|
||||
m_Type = text_type; /* Reference */
|
||||
if( (m_Type != TEXT_is_REFERENCE) && (m_Type != TEXT_is_VALUE) )
|
||||
m_Type = TEXT_is_DIVERS;
|
||||
|
||||
m_NoShow = false;
|
||||
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 );
|
||||
if( Module && (Module->Type() == TYPE_MODULE) )
|
||||
@ -60,7 +57,7 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) :
|
||||
|| moduleLayer == ADHESIVE_N_CU
|
||||
|| moduleLayer == COPPER_LAYER_N )
|
||||
{
|
||||
m_Miroir = 0;
|
||||
m_Mirror = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -85,17 +82,20 @@ bool TEXTE_MODULE::Save( FILE* aFile ) const
|
||||
MODULE* parent = (MODULE*) GetParent();
|
||||
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 )
|
||||
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_Pos0.x, m_Pos0.y,
|
||||
m_Size.y, m_Size.x,
|
||||
orient,
|
||||
m_Width,
|
||||
m_Miroir ? 'N' : 'M', m_NoShow ? 'I' : 'V',
|
||||
m_Mirror ? 'M' : 'N', m_NoShow ? 'I' : 'V',
|
||||
GetLayer(),
|
||||
m_Italic ? 'I' : 'N',
|
||||
CONV_TO_UTF8( m_Text ) );
|
||||
|
||||
return ret > 20;
|
||||
@ -117,33 +117,40 @@ int TEXTE_MODULE::ReadDescr( char* aLine, FILE* aFile, int* aLineNum )
|
||||
int success = true;
|
||||
int type;
|
||||
int layer;
|
||||
char BufCar1[128], BufCar2[128], BufLine[256];
|
||||
char BufCar1[128], BufCar2[128], BufCar3[128], BufLine[256];
|
||||
|
||||
layer = SILKSCREEN_N_CMP;
|
||||
BufCar1[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,
|
||||
&m_Pos0.x, &m_Pos0.y,
|
||||
&m_Size.y, &m_Size.x,
|
||||
&m_Orient, &m_Width,
|
||||
BufCar1, BufCar2, &layer ) < 10 )
|
||||
BufCar1, BufCar2, &layer, BufCar3 ) >= 10 )
|
||||
success = true;
|
||||
|
||||
if( (type != TEXT_is_REFERENCE) && (type != TEXT_is_VALUE) )
|
||||
type = TEXT_is_DIVERS;
|
||||
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;
|
||||
if( BufCar1[0] == 'M' )
|
||||
m_Miroir = 0;
|
||||
m_Mirror = true;
|
||||
else
|
||||
m_Miroir = 1;
|
||||
m_Mirror = false;
|
||||
if( BufCar2[0] == 'I' )
|
||||
m_NoShow = 1;
|
||||
m_NoShow = true;
|
||||
else
|
||||
m_NoShow = 0;
|
||||
m_NoShow = false;
|
||||
|
||||
if( BufCar3[0] == 'I' )
|
||||
m_Italic = true;
|
||||
else
|
||||
m_Italic = false;
|
||||
|
||||
// Test for a reasonnable layer:
|
||||
if( layer < 0 )
|
||||
@ -191,7 +198,7 @@ void TEXTE_MODULE::Copy( TEXTE_MODULE* source )
|
||||
m_Pos = source->m_Pos;
|
||||
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_Type = source->m_Type; // 0: ref,1: val, others = 2..255
|
||||
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
|
||||
*/
|
||||
{
|
||||
int zoom;
|
||||
int width, color, orient, miroir;
|
||||
int width, color, orient;
|
||||
wxSize size;
|
||||
wxPoint pos; // Centre du texte
|
||||
PCB_SCREEN* screen;
|
||||
@ -367,7 +374,6 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const
|
||||
|
||||
size = m_Size;
|
||||
orient = GetDrawRotation();
|
||||
miroir = m_Miroir & 1; // = 0 si vu en miroir
|
||||
width = m_Width;
|
||||
|
||||
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
|
||||
if( (color & ITEM_NOT_SHOW) != 0 )
|
||||
return;
|
||||
|
||||
/* Si le texte doit etre mis en miroir: modif des parametres */
|
||||
if( miroir == 0 )
|
||||
/* If the text is mirrored : negate size.x (mirror / Y axis) */
|
||||
if( m_Mirror )
|
||||
size.x = -size.x;
|
||||
|
||||
/* Trace du texte */
|
||||
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 )
|
||||
msg.Printf( wxT( "%d" ), ii );
|
||||
Affiche_1_Parametre( frame, 31, _( "Layer" ), msg, DARKGREEN );
|
||||
|
||||
msg = wxT( " Yes" );
|
||||
if( m_Miroir & 1 )
|
||||
msg = wxT( " No" );
|
||||
msg = _( " No" );
|
||||
if( m_Mirror )
|
||||
msg = _( " Yes" );
|
||||
|
||||
Affiche_1_Parametre( frame, 37, _( "Mirror" ), msg, DARKGREEN );
|
||||
|
||||
|
@ -13,21 +13,16 @@
|
||||
#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:
|
||||
wxPoint m_Pos; // Real (physical)coord
|
||||
int m_Width;
|
||||
wxPoint m_Pos0; // text coordinates relatives to the footprint ancre, orient 0
|
||||
// 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
|
||||
int m_Orient; // orientation in 1/10 deg relative to the footprint
|
||||
// Physical orient is m_Orient + m_Parent->m_Orient
|
||||
wxSize m_Size; // text size
|
||||
wxString m_Text;
|
||||
bool m_NoShow; // true = invisible
|
||||
|
||||
public:
|
||||
TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS );
|
||||
@ -52,7 +47,6 @@ public:
|
||||
/* Gestion du texte */
|
||||
void SetWidth( int new_width );
|
||||
int GetLength(); /* text length */
|
||||
int Pitch(); /* retourne le pas entre 2 caracteres */
|
||||
int GetDrawRotation(); // Return text rotation for drawings and plotting
|
||||
|
||||
/** Function GetTextRect
|
||||
|
@ -1,474 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Name: edtxtmod.cpp
|
||||
// Purpose:
|
||||
// Author: jean-pierre Charras
|
||||
// Modified by:
|
||||
// Created: 09/02/2006 18:17:15
|
||||
// RCS-ID:
|
||||
// Copyright: License GNU
|
||||
// Licence:
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Generated by DialogBlocks (unregistered), 09/02/2006 18:17:15
|
||||
|
||||
#if defined (__GNUG__) && !defined (NO_GCC_PRAGMA)
|
||||
#pragma implementation "edtxtmod.h"
|
||||
#endif
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
////@begin includes
|
||||
////@end includes
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "pcbnew.h"
|
||||
|
||||
#include "dialog_edit_mod_text.h"
|
||||
|
||||
extern wxPoint MoveVector; // Move vector for move edge, imported from edtxtmod.cpp
|
||||
|
||||
////@begin XPM images
|
||||
////@end XPM images
|
||||
|
||||
/***************************************************************************/
|
||||
void WinEDA_BasePcbFrame::InstallTextModOptionsFrame( TEXTE_MODULE* TextMod,
|
||||
wxDC* DC, const wxPoint& pos )
|
||||
/***************************************************************************/
|
||||
{
|
||||
DrawPanel->m_IgnoreMouseEvents = TRUE;
|
||||
WinEDA_TextModPropertiesFrame* frame = new WinEDA_TextModPropertiesFrame( this,
|
||||
TextMod, DC );
|
||||
frame->ShowModal(); frame->Destroy();
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
DrawPanel->m_IgnoreMouseEvents = FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* WinEDA_TextModPropertiesFrame type definition
|
||||
*/
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS( WinEDA_TextModPropertiesFrame, wxDialog )
|
||||
|
||||
/*!
|
||||
* WinEDA_TextModPropertiesFrame event table definition
|
||||
*/
|
||||
|
||||
BEGIN_EVENT_TABLE( WinEDA_TextModPropertiesFrame, wxDialog )
|
||||
|
||||
////@begin WinEDA_TextModPropertiesFrame event table entries
|
||||
EVT_BUTTON( wxID_OK, WinEDA_TextModPropertiesFrame::OnOkClick )
|
||||
|
||||
EVT_BUTTON( wxID_CANCEL, WinEDA_TextModPropertiesFrame::OnCancelClick )
|
||||
|
||||
////@end WinEDA_TextModPropertiesFrame event table entries
|
||||
|
||||
END_EVENT_TABLE()
|
||||
|
||||
/*!
|
||||
* WinEDA_TextModPropertiesFrame constructors
|
||||
*/
|
||||
|
||||
WinEDA_TextModPropertiesFrame::WinEDA_TextModPropertiesFrame()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
WinEDA_TextModPropertiesFrame::WinEDA_TextModPropertiesFrame( WinEDA_BasePcbFrame* parent,
|
||||
TEXTE_MODULE* TextMod,
|
||||
wxDC* DC,
|
||||
wxWindowID id,
|
||||
const wxString& caption,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style )
|
||||
{
|
||||
m_Parent = parent;
|
||||
m_DC = DC;
|
||||
m_Module = NULL;
|
||||
m_CurrentTextMod = TextMod;
|
||||
if( m_CurrentTextMod )
|
||||
{
|
||||
m_Module = (MODULE*) m_CurrentTextMod->GetParent();
|
||||
}
|
||||
|
||||
Create( parent, id, caption, pos, size, style );
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* WinEDA_TextModPropertiesFrame creator
|
||||
*/
|
||||
|
||||
bool WinEDA_TextModPropertiesFrame::Create( wxWindow* parent,
|
||||
wxWindowID id,
|
||||
const wxString& caption,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style )
|
||||
{
|
||||
////@begin WinEDA_TextModPropertiesFrame member initialisation
|
||||
m_ModuleInfoText = NULL;
|
||||
m_TextDataTitle = NULL;
|
||||
m_Name = NULL;
|
||||
m_SizeXTitle = NULL;
|
||||
m_TxtSizeCtrlX = NULL;
|
||||
m_SizeYTitle = NULL;
|
||||
m_TxtSizeCtrlY = NULL;
|
||||
m_PosXTitle = NULL;
|
||||
m_TxtPosCtrlX = NULL;
|
||||
m_PosYTitle = NULL;
|
||||
m_TxtPosCtrlY = NULL;
|
||||
m_WidthTitle = NULL;
|
||||
m_TxtWidthCtlr = NULL;
|
||||
m_Orient = NULL;
|
||||
m_Show = NULL;
|
||||
|
||||
////@end WinEDA_TextModPropertiesFrame member initialisation
|
||||
|
||||
////@begin WinEDA_TextModPropertiesFrame creation
|
||||
SetExtraStyle( GetExtraStyle() | wxWS_EX_BLOCK_EVENTS );
|
||||
wxDialog::Create( parent, id, caption, pos, size, style );
|
||||
|
||||
CreateControls();
|
||||
GetSizer()->Fit( this );
|
||||
GetSizer()->SetSizeHints( this );
|
||||
Centre();
|
||||
|
||||
////@end WinEDA_TextModPropertiesFrame creation
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Control creation for WinEDA_TextModPropertiesFrame
|
||||
*/
|
||||
|
||||
void WinEDA_TextModPropertiesFrame::CreateControls()
|
||||
{
|
||||
SetFont( *g_DialogFont );
|
||||
|
||||
////@begin WinEDA_TextModPropertiesFrame content construction
|
||||
// Generated by DialogBlocks, 09/02/2006 19:51:49 (unregistered)
|
||||
|
||||
WinEDA_TextModPropertiesFrame* itemDialog1 = this;
|
||||
|
||||
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxVERTICAL );
|
||||
itemDialog1->SetSizer( itemBoxSizer2 );
|
||||
|
||||
m_ModuleInfoText = new wxStaticText( itemDialog1, wxID_STATIC, _(
|
||||
"Module %s (%s) orient %.1f" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ModuleInfoText->SetForegroundColour( wxColour( 0, 0, 255 ) );
|
||||
itemBoxSizer2->Add( m_ModuleInfoText,
|
||||
0,
|
||||
wxALIGN_CENTER_HORIZONTAL | wxALL | wxADJUST_MINSIZE,
|
||||
5 );
|
||||
|
||||
wxStaticLine* itemStaticLine4 = new wxStaticLine( itemDialog1,
|
||||
wxID_STATIC,
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
wxLI_HORIZONTAL );
|
||||
itemBoxSizer2->Add( itemStaticLine4, 0, wxGROW | wxALL, 5 );
|
||||
|
||||
m_TextDataTitle = new wxStaticText( itemDialog1, wxID_STATIC, _(
|
||||
"Reference:" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer2->Add( m_TextDataTitle,
|
||||
0,
|
||||
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
||||
5 );
|
||||
|
||||
m_Name = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(
|
||||
"" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer2->Add( m_Name, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
||||
|
||||
wxBoxSizer* itemBoxSizer7 = new wxBoxSizer( wxHORIZONTAL );
|
||||
itemBoxSizer2->Add( itemBoxSizer7, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
|
||||
|
||||
wxBoxSizer* itemBoxSizer8 = new wxBoxSizer( wxVERTICAL );
|
||||
itemBoxSizer7->Add( itemBoxSizer8, 0, wxGROW | wxALL, 5 );
|
||||
|
||||
m_SizeXTitle = new wxStaticText( itemDialog1, wxID_STATIC, _(
|
||||
"Size X" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer8->Add( m_SizeXTitle,
|
||||
0,
|
||||
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
||||
5 );
|
||||
|
||||
m_TxtSizeCtrlX = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(
|
||||
"" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer8->Add( m_TxtSizeCtrlX, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
||||
|
||||
m_SizeYTitle = new wxStaticText( itemDialog1, wxID_STATIC, _(
|
||||
"Size Y" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer8->Add( m_SizeYTitle,
|
||||
0,
|
||||
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
||||
5 );
|
||||
|
||||
m_TxtSizeCtrlY = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T(
|
||||
"" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer8->Add( m_TxtSizeCtrlY, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
||||
|
||||
itemBoxSizer8->Add( 5, 5, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
|
||||
|
||||
m_PosXTitle = new wxStaticText( itemDialog1, wxID_STATIC, _(
|
||||
"Offset X" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer8->Add( m_PosXTitle,
|
||||
0,
|
||||
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
||||
5 );
|
||||
|
||||
m_TxtPosCtrlX = new wxTextCtrl( itemDialog1, ID_TEXTCTRL3, _T(
|
||||
"" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer8->Add( m_TxtPosCtrlX, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
||||
|
||||
m_PosYTitle = new wxStaticText( itemDialog1, wxID_STATIC, _(
|
||||
"Offset Y" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer8->Add( m_PosYTitle,
|
||||
0,
|
||||
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
||||
5 );
|
||||
|
||||
m_TxtPosCtrlY = new wxTextCtrl( itemDialog1, ID_TEXTCTRL4, _T(
|
||||
"" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer8->Add( m_TxtPosCtrlY, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
||||
|
||||
wxBoxSizer* itemBoxSizer18 = new wxBoxSizer( wxVERTICAL );
|
||||
itemBoxSizer7->Add( itemBoxSizer18, 0, wxGROW | wxALL, 5 );
|
||||
|
||||
m_WidthTitle = new wxStaticText( itemDialog1, wxID_STATIC, _(
|
||||
"Width" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer18->Add( m_WidthTitle,
|
||||
0,
|
||||
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
||||
5 );
|
||||
|
||||
m_TxtWidthCtlr = new wxTextCtrl( itemDialog1, ID_TEXTCTRL5, _T(
|
||||
"" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer18->Add( m_TxtWidthCtlr, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
||||
|
||||
wxBoxSizer* itemBoxSizer21 = new wxBoxSizer( wxVERTICAL );
|
||||
itemBoxSizer7->Add( itemBoxSizer21, 0, wxGROW | wxALL, 5 );
|
||||
|
||||
wxButton* itemButton22 = new wxButton( itemDialog1, wxID_OK, _(
|
||||
"&OK" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemButton22->SetForegroundColour( wxColour( 198, 0, 0 ) );
|
||||
itemBoxSizer21->Add( itemButton22, 0, wxGROW | wxALL, 5 );
|
||||
|
||||
wxButton* itemButton23 = new wxButton( itemDialog1, wxID_CANCEL, _(
|
||||
"&Cancel" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemButton23->SetForegroundColour( wxColour( 0, 0, 255 ) );
|
||||
itemBoxSizer21->Add( itemButton23, 0, wxGROW | wxALL, 5 );
|
||||
|
||||
wxString m_OrientStrings[] = {
|
||||
_( "horiz" ),
|
||||
_( "vertical" )
|
||||
};
|
||||
m_Orient = new wxRadioBox( itemDialog1, ID_RADIOBOX, _(
|
||||
"Orientation" ), wxDefaultPosition, wxDefaultSize, 2, m_OrientStrings, 1,
|
||||
wxRA_SPECIFY_COLS );
|
||||
itemBoxSizer21->Add( m_Orient, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
|
||||
|
||||
wxString m_ShowStrings[] = {
|
||||
_( "show" ),
|
||||
_( "no show" )
|
||||
};
|
||||
m_Show = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _(
|
||||
"Display" ), wxDefaultPosition, wxDefaultSize, 2, m_ShowStrings, 1, wxRA_SPECIFY_COLS );
|
||||
itemBoxSizer21->Add( m_Show, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
|
||||
|
||||
////@end WinEDA_TextModPropertiesFrame content construction
|
||||
|
||||
/* Setup titles and datas */
|
||||
SetDisplayValue();
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
|
||||
*/
|
||||
|
||||
void WinEDA_TextModPropertiesFrame::OnOkClick( wxCommandEvent& event )
|
||||
{
|
||||
TextModPropertiesAccept( event );
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
|
||||
*/
|
||||
|
||||
void WinEDA_TextModPropertiesFrame::OnCancelClick( wxCommandEvent& event )
|
||||
{
|
||||
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_TextModPropertiesFrame.
|
||||
// Before editing this code, remove the block markers.
|
||||
event.Skip();
|
||||
|
||||
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_TextModPropertiesFrame.
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Should we show tooltips?
|
||||
*/
|
||||
|
||||
bool WinEDA_TextModPropertiesFrame::ShowToolTips()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Get bitmap resources
|
||||
*/
|
||||
|
||||
wxBitmap WinEDA_TextModPropertiesFrame::GetBitmapResource( const wxString& name )
|
||||
{
|
||||
// Bitmap retrieval
|
||||
////@begin WinEDA_TextModPropertiesFrame bitmap retrieval
|
||||
wxUnusedVar( name );
|
||||
return wxNullBitmap;
|
||||
|
||||
////@end WinEDA_TextModPropertiesFrame bitmap retrieval
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Get icon resources
|
||||
*/
|
||||
|
||||
wxIcon WinEDA_TextModPropertiesFrame::GetIconResource( const wxString& name )
|
||||
{
|
||||
// Icon retrieval
|
||||
////@begin WinEDA_TextModPropertiesFrame icon retrieval
|
||||
wxUnusedVar( name );
|
||||
return wxNullIcon;
|
||||
|
||||
////@end WinEDA_TextModPropertiesFrame icon retrieval
|
||||
}
|
||||
|
||||
|
||||
/********************************************************/
|
||||
void WinEDA_TextModPropertiesFrame::SetDisplayValue()
|
||||
/********************************************************/
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
if( m_Module )
|
||||
{
|
||||
wxString format = m_ModuleInfoText->GetLabel();
|
||||
msg.Printf( format,
|
||||
m_Module->m_Reference->m_Text.GetData(),
|
||||
m_Module->m_Value->m_Text.GetData(),
|
||||
(float) (m_Module->m_Orient / 10) );
|
||||
m_ModuleInfoText->SetLabel( msg );
|
||||
}
|
||||
|
||||
if( m_CurrentTextMod->m_Type == TEXT_is_VALUE )
|
||||
m_TextDataTitle->SetLabel( _( "Value:" ) );
|
||||
else if( m_CurrentTextMod->m_Type == TEXT_is_DIVERS )
|
||||
m_TextDataTitle->SetLabel( _( "Text:" ) );
|
||||
else if( m_CurrentTextMod->m_Type != TEXT_is_REFERENCE )
|
||||
m_TextDataTitle->SetLabel( wxT( "???" ) );
|
||||
|
||||
m_Name->SetValue( m_CurrentTextMod->m_Text );
|
||||
|
||||
AddUnitSymbol( *m_SizeXTitle );
|
||||
PutValueInLocalUnits( *m_TxtSizeCtrlX, m_CurrentTextMod->m_Size.x,
|
||||
m_Parent->m_InternalUnits );
|
||||
|
||||
AddUnitSymbol( *m_SizeYTitle );
|
||||
PutValueInLocalUnits( *m_TxtSizeCtrlY, m_CurrentTextMod->m_Size.y,
|
||||
m_Parent->m_InternalUnits );
|
||||
|
||||
AddUnitSymbol( *m_PosXTitle );
|
||||
PutValueInLocalUnits( *m_TxtPosCtrlX, m_CurrentTextMod->m_Pos0.x,
|
||||
m_Parent->m_InternalUnits );
|
||||
|
||||
AddUnitSymbol( *m_PosYTitle );
|
||||
PutValueInLocalUnits( *m_TxtPosCtrlY, m_CurrentTextMod->m_Pos0.y,
|
||||
m_Parent->m_InternalUnits );
|
||||
|
||||
AddUnitSymbol( *m_WidthTitle );
|
||||
PutValueInLocalUnits( *m_TxtWidthCtlr, m_CurrentTextMod->m_Width,
|
||||
m_Parent->m_InternalUnits );
|
||||
|
||||
if( (m_CurrentTextMod->m_Orient != 0) && (m_CurrentTextMod->m_Orient != 1800)
|
||||
&& (m_CurrentTextMod->m_Orient != -1800) )
|
||||
m_Orient->SetSelection( 1 );;
|
||||
|
||||
if( m_CurrentTextMod->m_NoShow )
|
||||
m_Show->SetSelection( 1 );;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************/
|
||||
void WinEDA_TextModPropertiesFrame::TextModPropertiesAccept( wxCommandEvent& event )
|
||||
/*********************************************************************************/
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
m_Parent->SaveCopyInUndoList( m_Parent->m_Pcb->m_Modules );
|
||||
if( m_DC ) // Effacement ancien texte
|
||||
{
|
||||
m_CurrentTextMod->Draw( m_Parent->DrawPanel, m_DC, GR_XOR,
|
||||
(m_CurrentTextMod->m_Flags & IS_MOVED) ? MoveVector : wxPoint( 0, 0 ) );
|
||||
}
|
||||
m_CurrentTextMod->m_Text = m_Name->GetValue();
|
||||
|
||||
msg = m_TxtPosCtrlX->GetValue();
|
||||
m_CurrentTextMod->m_Pos0.x = ReturnValueFromString( g_UnitMetric, msg,
|
||||
m_Parent->m_InternalUnits );
|
||||
msg = m_TxtPosCtrlY->GetValue();
|
||||
m_CurrentTextMod->m_Pos0.y = ReturnValueFromString( g_UnitMetric, msg,
|
||||
m_Parent->m_InternalUnits );
|
||||
|
||||
msg = m_TxtSizeCtrlX->GetValue();
|
||||
m_CurrentTextMod->m_Size.x = ReturnValueFromString( g_UnitMetric, msg,
|
||||
m_Parent->m_InternalUnits );
|
||||
msg = m_TxtSizeCtrlY->GetValue();
|
||||
m_CurrentTextMod->m_Size.y = ReturnValueFromString( g_UnitMetric, msg,
|
||||
m_Parent->m_InternalUnits );
|
||||
|
||||
// Test for a reasonnable size:
|
||||
if( m_CurrentTextMod->m_Size.x< TEXTS_MIN_SIZE )
|
||||
m_CurrentTextMod->m_Size.x = TEXTS_MIN_SIZE;
|
||||
if( m_CurrentTextMod->m_Size.y< TEXTS_MIN_SIZE )
|
||||
m_CurrentTextMod->m_Size.y = TEXTS_MIN_SIZE;
|
||||
|
||||
msg = m_TxtWidthCtlr->GetValue();
|
||||
int width = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits );
|
||||
|
||||
// Test for a reasonnable width:
|
||||
if( width <= 1 )
|
||||
width = 1;
|
||||
if( width > TEXTS_MAX_WIDTH )
|
||||
width = TEXTS_MAX_WIDTH;
|
||||
m_CurrentTextMod->SetWidth( width );
|
||||
|
||||
m_CurrentTextMod->m_NoShow = (m_Show->GetSelection() == 0) ? 0 : 1;
|
||||
m_CurrentTextMod->m_Orient = (m_Orient->GetSelection() == 0) ? 0 : 900;
|
||||
m_CurrentTextMod->SetDrawCoord();
|
||||
if( m_DC ) // Display new text
|
||||
{
|
||||
m_CurrentTextMod->Draw( m_Parent->DrawPanel, m_DC, GR_XOR,
|
||||
(m_CurrentTextMod->m_Flags & IS_MOVED) ? MoveVector : wxPoint( 0, 0 ) );
|
||||
}
|
||||
m_Parent->GetScreen()->SetModify();
|
||||
( (MODULE*) m_CurrentTextMod->GetParent() )->m_LastEdit_Time = time( NULL );
|
||||
Close( TRUE );
|
||||
}
|
File diff suppressed because it is too large
Load Diff
201
pcbnew/dialog_edit_module_text.cpp
Normal file
201
pcbnew/dialog_edit_module_text.cpp
Normal file
@ -0,0 +1,201 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dialog_edit_module_text.cpp
|
||||
// Author: jean-pierre Charras
|
||||
// Licence: GPL
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "macros.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "pcbnew.h"
|
||||
|
||||
#include "dialog_edit_module_text_base.h"
|
||||
|
||||
extern wxPoint MoveVector; // Move vector for move edge, imported from edtxtmod.cpp
|
||||
|
||||
/*************** **************/
|
||||
/* class DialogEditModuleText */
|
||||
/*************** **************/
|
||||
class DialogEditModuleText : public DialogEditModuleText_base
|
||||
{
|
||||
private:
|
||||
WinEDA_BasePcbFrame* m_Parent;
|
||||
wxDC* m_DC;
|
||||
MODULE* m_Module;
|
||||
TEXTE_MODULE* m_CurrentTextMod;
|
||||
|
||||
public:
|
||||
DialogEditModuleText( WinEDA_BasePcbFrame* parent, TEXTE_MODULE* TextMod, wxDC* DC );
|
||||
~DialogEditModuleText() {};
|
||||
|
||||
private:
|
||||
void OnInitDialog( wxInitDialogEvent& event );
|
||||
void OnOkClick( wxCommandEvent& event );
|
||||
void OnCancelClick( wxCommandEvent& event );
|
||||
};
|
||||
|
||||
/***************************************************************************/
|
||||
void WinEDA_BasePcbFrame::InstallTextModOptionsFrame( TEXTE_MODULE* TextMod,
|
||||
wxDC* DC, const wxPoint& pos )
|
||||
/***************************************************************************/
|
||||
{
|
||||
DrawPanel->m_IgnoreMouseEvents = TRUE;
|
||||
DialogEditModuleText* frame = new DialogEditModuleText( this,
|
||||
TextMod, DC );
|
||||
frame->ShowModal(); frame->Destroy();
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
DrawPanel->m_IgnoreMouseEvents = FALSE;
|
||||
}
|
||||
|
||||
|
||||
DialogEditModuleText::DialogEditModuleText( WinEDA_BasePcbFrame* parent,
|
||||
TEXTE_MODULE* TextMod,
|
||||
wxDC* DC ) :
|
||||
DialogEditModuleText_base(parent)
|
||||
|
||||
{
|
||||
m_Parent = parent;
|
||||
m_DC = DC;
|
||||
m_Module = NULL;
|
||||
m_CurrentTextMod = TextMod;
|
||||
if( m_CurrentTextMod )
|
||||
{
|
||||
m_Module = (MODULE*) m_CurrentTextMod->GetParent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DialogEditModuleText::OnCancelClick( wxCommandEvent& event )
|
||||
{
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
/********************************************************/
|
||||
void DialogEditModuleText::OnInitDialog( wxInitDialogEvent& event )
|
||||
/********************************************************/
|
||||
{
|
||||
SetFont( *g_DialogFont );
|
||||
SetFocus();
|
||||
|
||||
wxString msg;
|
||||
|
||||
if( m_Module )
|
||||
{
|
||||
wxString format = m_ModuleInfoText->GetLabel();
|
||||
msg.Printf( format,
|
||||
m_Module->m_Reference->m_Text.GetData(),
|
||||
m_Module->m_Value->m_Text.GetData(),
|
||||
(float) (m_Module->m_Orient / 10) );
|
||||
m_ModuleInfoText->SetLabel( msg );
|
||||
}
|
||||
|
||||
if( m_CurrentTextMod->m_Type == TEXT_is_VALUE )
|
||||
m_TextDataTitle->SetLabel( _( "Value:" ) );
|
||||
else if( m_CurrentTextMod->m_Type == TEXT_is_DIVERS )
|
||||
m_TextDataTitle->SetLabel( _( "Text:" ) );
|
||||
else if( m_CurrentTextMod->m_Type != TEXT_is_REFERENCE )
|
||||
m_TextDataTitle->SetLabel( wxT( "???" ) );
|
||||
|
||||
m_Name->SetValue( m_CurrentTextMod->m_Text );
|
||||
|
||||
m_Style->SetSelection( m_CurrentTextMod->m_Italic ? 1 : 0 );
|
||||
|
||||
AddUnitSymbol( *m_SizeXTitle );
|
||||
PutValueInLocalUnits( *m_TxtSizeCtrlX, m_CurrentTextMod->m_Size.x,
|
||||
m_Parent->m_InternalUnits );
|
||||
|
||||
AddUnitSymbol( *m_SizeYTitle );
|
||||
PutValueInLocalUnits( *m_TxtSizeCtrlY, m_CurrentTextMod->m_Size.y,
|
||||
m_Parent->m_InternalUnits );
|
||||
|
||||
AddUnitSymbol( *m_PosXTitle );
|
||||
PutValueInLocalUnits( *m_TxtPosCtrlX, m_CurrentTextMod->m_Pos0.x,
|
||||
m_Parent->m_InternalUnits );
|
||||
|
||||
AddUnitSymbol( *m_PosYTitle );
|
||||
PutValueInLocalUnits( *m_TxtPosCtrlY, m_CurrentTextMod->m_Pos0.y,
|
||||
m_Parent->m_InternalUnits );
|
||||
|
||||
AddUnitSymbol( *m_WidthTitle );
|
||||
PutValueInLocalUnits( *m_TxtWidthCtlr, m_CurrentTextMod->m_Width,
|
||||
m_Parent->m_InternalUnits );
|
||||
|
||||
int text_orient = m_CurrentTextMod->m_Orient;
|
||||
NORMALIZE_ANGLE_90(text_orient)
|
||||
if( (text_orient != 0) )
|
||||
m_Orient->SetSelection( 1 );
|
||||
|
||||
if( m_CurrentTextMod->m_NoShow )
|
||||
m_Show->SetSelection( 1 );;
|
||||
|
||||
GetSizer()->Fit( this );
|
||||
GetSizer()->SetSizeHints( this );
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************/
|
||||
void DialogEditModuleText::OnOkClick( wxCommandEvent& event )
|
||||
/*********************************************************************************/
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
m_Parent->SaveCopyInUndoList( m_Parent->m_Pcb->m_Modules );
|
||||
if( m_DC ) //Erase old text on screen
|
||||
{
|
||||
m_CurrentTextMod->Draw( m_Parent->DrawPanel, m_DC, GR_XOR,
|
||||
(m_CurrentTextMod->m_Flags & IS_MOVED) ? MoveVector : wxPoint( 0, 0 ) );
|
||||
}
|
||||
m_CurrentTextMod->m_Text = m_Name->GetValue();
|
||||
|
||||
m_CurrentTextMod->m_Italic = m_Style->GetSelection() == 1 ? true : false;
|
||||
|
||||
|
||||
msg = m_TxtPosCtrlX->GetValue();
|
||||
m_CurrentTextMod->m_Pos0.x = ReturnValueFromString( g_UnitMetric, msg,
|
||||
m_Parent->m_InternalUnits );
|
||||
msg = m_TxtPosCtrlY->GetValue();
|
||||
m_CurrentTextMod->m_Pos0.y = ReturnValueFromString( g_UnitMetric, msg,
|
||||
m_Parent->m_InternalUnits );
|
||||
|
||||
msg = m_TxtSizeCtrlX->GetValue();
|
||||
m_CurrentTextMod->m_Size.x = ReturnValueFromString( g_UnitMetric, msg,
|
||||
m_Parent->m_InternalUnits );
|
||||
msg = m_TxtSizeCtrlY->GetValue();
|
||||
m_CurrentTextMod->m_Size.y = ReturnValueFromString( g_UnitMetric, msg,
|
||||
m_Parent->m_InternalUnits );
|
||||
|
||||
// Test for a reasonnable size:
|
||||
if( m_CurrentTextMod->m_Size.x< TEXTS_MIN_SIZE )
|
||||
m_CurrentTextMod->m_Size.x = TEXTS_MIN_SIZE;
|
||||
if( m_CurrentTextMod->m_Size.y< TEXTS_MIN_SIZE )
|
||||
m_CurrentTextMod->m_Size.y = TEXTS_MIN_SIZE;
|
||||
|
||||
msg = m_TxtWidthCtlr->GetValue();
|
||||
int width = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits );
|
||||
|
||||
// Test for a reasonnable width:
|
||||
if( width <= 1 )
|
||||
width = 1;
|
||||
int minthickness = min(m_CurrentTextMod->m_Size.x, m_CurrentTextMod->m_Size.y) / 4;
|
||||
if( width > minthickness )
|
||||
width = minthickness;
|
||||
m_CurrentTextMod->SetWidth( width );
|
||||
|
||||
m_CurrentTextMod->m_NoShow = (m_Show->GetSelection() == 0) ? 0 : 1;
|
||||
int text_orient = (m_Orient->GetSelection() == 0) ? 0 : 900;
|
||||
m_CurrentTextMod->m_Orient = text_orient;
|
||||
|
||||
m_CurrentTextMod->SetDrawCoord();
|
||||
if( m_DC ) // Display new text
|
||||
{
|
||||
m_CurrentTextMod->Draw( m_Parent->DrawPanel, m_DC, GR_XOR,
|
||||
(m_CurrentTextMod->m_Flags & IS_MOVED) ? MoveVector : wxPoint( 0, 0 ) );
|
||||
}
|
||||
m_Parent->GetScreen()->SetModify();
|
||||
( (MODULE*) m_CurrentTextMod->GetParent() )->m_LastEdit_Time = time( NULL );
|
||||
|
||||
Close( TRUE );
|
||||
}
|
135
pcbnew/dialog_edit_module_text_base.cpp
Normal file
135
pcbnew/dialog_edit_module_text_base.cpp
Normal file
@ -0,0 +1,135 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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 );
|
||||
}
|
1137
pcbnew/dialog_edit_module_text_base.fbp
Normal file
1137
pcbnew/dialog_edit_module_text_base.fbp
Normal file
File diff suppressed because it is too large
Load Diff
69
pcbnew/dialog_edit_module_text_base.h
Normal file
69
pcbnew/dialog_edit_module_text_base.h
Normal file
@ -0,0 +1,69 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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
|
||||
|
||||
case PLOT_FORMAT_POST:
|
||||
wxString Text = wxT( "Infos" );
|
||||
Plot_1_texte( format, Text, 0, TextWidth,
|
||||
x, y,
|
||||
(int) (CharSize * CharScale), (int) (CharSize * CharScale),
|
||||
FALSE );
|
||||
PlotGraphicText( format, wxPoint(x,y), BLACK,
|
||||
Text,
|
||||
0, wxSize((int)(CharSize * CharScale), (int)(CharSize * CharScale)),
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||
TextWidth );
|
||||
break;
|
||||
}
|
||||
|
||||
@ -335,11 +336,11 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName, w
|
||||
aToolListBuffer[ii].m_TotalCount,
|
||||
aToolListBuffer[ii].m_OvalCount );
|
||||
msg += CONV_FROM_UTF8( line );
|
||||
Plot_1_texte( format, msg, 0, TextWidth,
|
||||
x, y,
|
||||
(int) (CharSize * CharScale),
|
||||
(int) (CharSize * CharScale),
|
||||
FALSE );
|
||||
PlotGraphicText( format, wxPoint(x,y), BLACK,
|
||||
msg,
|
||||
0, wxSize((int)(CharSize * CharScale), (int)(CharSize * CharScale)),
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||
TextWidth );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,8 @@ OBJECTS= $(TARGET).o classpcb.o\
|
||||
globaleditpad.o \
|
||||
editedge.o\
|
||||
edtxtmod.o \
|
||||
dialog_edit_mod_text.o\
|
||||
dialog_edit_module_text.o\
|
||||
dialog_edit_module_text_base.o\
|
||||
ratsnest.o drc.o \
|
||||
block.o\
|
||||
clean.o \
|
||||
@ -243,7 +244,9 @@ cotation.o: cotation.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
|
||||
|
||||
@ -259,7 +262,7 @@ pcbplot.o: pcbplot.cpp pcbplot.h
|
||||
|
||||
plothpgl.o: plothpgl.cpp
|
||||
|
||||
plotgerb.o: plotgerb.cpp pcbplot.h plotgerb.h
|
||||
plotgerb.o: plotgerb.cpp pcbplot.h
|
||||
|
||||
plotps.o: plotps.cpp pcbplot.h
|
||||
|
||||
|
@ -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 = -pt_texte->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_Miroir = false;
|
||||
pt_texte->m_Pos0.y = -pt_texte->m_Pos0.y;
|
||||
pt_texte->m_Mirror = false;
|
||||
NEGATE_AND_NORMALIZE_ANGLE_POS( pt_texte->m_Orient );
|
||||
pt_texte->SetLayer( Module->GetLayer() );
|
||||
pt_texte->SetLayer( ChangeSideNumLayer( pt_texte->GetLayer() ) );
|
||||
@ -434,15 +434,15 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC )
|
||||
|
||||
if( (Module->GetLayer() == SILKSCREEN_N_CU)
|
||||
|| (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 : */
|
||||
pt_texte = Module->m_Value;
|
||||
pt_texte->m_Pos.y -= Module->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_Pos0.y = pt_texte->m_Pos0.y;
|
||||
pt_texte->m_Miroir = false;
|
||||
pt_texte->m_Pos0.y = -pt_texte->m_Pos0.y;
|
||||
pt_texte->m_Mirror = false;
|
||||
NEGATE_AND_NORMALIZE_ANGLE_POS( pt_texte->m_Orient );
|
||||
pt_texte->SetLayer( Module->GetLayer() );
|
||||
pt_texte->SetLayer( ChangeSideNumLayer( pt_texte->GetLayer() ) );
|
||||
@ -455,7 +455,7 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC )
|
||||
|
||||
if( (Module->GetLayer() == SILKSCREEN_N_CU)
|
||||
|| (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 : */
|
||||
PtStruct = Module->m_Drawings;
|
||||
@ -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 = -pt_texte->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_Miroir = false;
|
||||
pt_texte->m_Pos0.y = - pt_texte->m_Pos0.y;
|
||||
pt_texte->m_Mirror = false;
|
||||
NEGATE_AND_NORMALIZE_ANGLE_POS( pt_texte->m_Orient );
|
||||
|
||||
pt_texte->SetLayer( Module->GetLayer() );
|
||||
@ -505,7 +505,7 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC )
|
||||
|| Module->GetLayer() == ADHESIVE_N_CU
|
||||
|| Module->GetLayer() == COPPER_LAYER_N )
|
||||
{
|
||||
pt_texte->m_Miroir = true;
|
||||
pt_texte->m_Mirror = true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -123,36 +123,15 @@ eda_global int g_DrillShapeOpt
|
||||
#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
|
||||
*/
|
||||
|
||||
|
||||
/* Routines generales de trace : */
|
||||
|
||||
|
||||
/* PLOT_RTN.CC */
|
||||
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,
|
||||
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,
|
||||
int rayon,int width);
|
||||
void PlotCircle(int format_plot,int width, wxPoint centre, int rayon);
|
||||
void PlotFilledPolygon(int format_plot, int nbpoints, int * coord);
|
||||
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 );
|
||||
|
||||
@ -165,10 +144,7 @@ void Plot_1_EdgeModule(int format_plot, EDGE_MODULE * PtEdge);
|
||||
void PlotFilledAreas( ZONE_CONTAINER * aZone, int aFormat);
|
||||
|
||||
/* PLOTGERB.CPP */
|
||||
void PlotGERBERLine(wxPoint start, wxPoint end, int width);
|
||||
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 SelectD_CODE_For_LineDraw( int aSize );
|
||||
void trace_1_contour_GERBER(wxPoint pos, wxSize size, wxSize delta,
|
||||
int penwidth, int orient);
|
||||
/* Trace 1 contour rectangulaire ou trapezoidal d'orientation quelconque
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user