Use double instead float when possible, ande code cleaning.
change EXCHG macro to equivalent inline functions (better code compatibility with some compilers)
This commit is contained in:
parent
abd75ea366
commit
78bbe94923
|
@ -230,7 +230,7 @@ void Pcb3D_GLCanvas::OnMouseEvent( wxMouseEvent& event )
|
||||||
/********************************************************/
|
/********************************************************/
|
||||||
{
|
{
|
||||||
wxSize size( GetClientSize() );
|
wxSize size( GetClientSize() );
|
||||||
float spin_quat[4];
|
double spin_quat[4];
|
||||||
|
|
||||||
|
|
||||||
if( event.RightDown() )
|
if( event.RightDown() )
|
||||||
|
@ -298,7 +298,7 @@ void Pcb3D_GLCanvas::OnMouseEvent( wxMouseEvent& event )
|
||||||
{
|
{
|
||||||
/* middle button drag -> pan */
|
/* middle button drag -> pan */
|
||||||
/* Current zoom and an additional factor are taken into account for the amount of panning. */
|
/* Current zoom and an additional factor are taken into account for the amount of panning. */
|
||||||
const float PAN_FACTOR = 8.0 * g_Parm_3D_Visu.m_Zoom;
|
const double PAN_FACTOR = 8.0 * g_Parm_3D_Visu.m_Zoom;
|
||||||
g_Draw3d_dx -= PAN_FACTOR * ( g_Parm_3D_Visu.m_Beginx - event.GetX() ) / size.x;
|
g_Draw3d_dx -= PAN_FACTOR * ( g_Parm_3D_Visu.m_Beginx - event.GetX() ) / size.x;
|
||||||
g_Draw3d_dy -= PAN_FACTOR * (event.GetY() - g_Parm_3D_Visu.m_Beginy) / size.y;
|
g_Draw3d_dy -= PAN_FACTOR * (event.GetY() - g_Parm_3D_Visu.m_Beginy) / size.y;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,6 @@
|
||||||
#include "pcbstruct.h"
|
#include "pcbstruct.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
// #include "pcbnew.h"
|
|
||||||
|
|
||||||
#include "3d_viewer.h"
|
#include "3d_viewer.h"
|
||||||
#include "trackball.h"
|
#include "trackball.h"
|
||||||
|
|
||||||
|
@ -111,7 +109,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
|
||||||
g_Parm_3D_Visu.m_Layers = pcb->m_BoardSettings->m_CopperLayerCount;
|
g_Parm_3D_Visu.m_Layers = pcb->m_BoardSettings->m_CopperLayerCount;
|
||||||
g_Parm_3D_Visu.m_BoardScale = 2.0 / MAX( g_Parm_3D_Visu.m_BoardSize.x,
|
g_Parm_3D_Visu.m_BoardScale = 2.0 / MAX( g_Parm_3D_Visu.m_BoardSize.x,
|
||||||
g_Parm_3D_Visu.m_BoardSize.y );
|
g_Parm_3D_Visu.m_BoardSize.y );
|
||||||
float epoxy_width = 1.6; // epoxy width in mm
|
double epoxy_width = 1.6; // epoxy width in mm
|
||||||
g_Parm_3D_Visu.m_Epoxy_Width = epoxy_width / 2.54 * 1000
|
g_Parm_3D_Visu.m_Epoxy_Width = epoxy_width / 2.54 * 1000
|
||||||
* g_Parm_3D_Visu.m_BoardScale;
|
* g_Parm_3D_Visu.m_BoardScale;
|
||||||
|
|
||||||
|
@ -591,7 +589,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
int angle, delta_angle;
|
int angle, delta_angle;
|
||||||
int coord[4][2];
|
int coord[4][2];
|
||||||
double fcoord[8][2], f_hole_coord[8][2];
|
double fcoord[8][2], f_hole_coord[8][2];
|
||||||
float scale;
|
double scale;
|
||||||
double zpos;
|
double zpos;
|
||||||
wxPoint shape_pos;
|
wxPoint shape_pos;
|
||||||
double x, y, r, w, hole, holeX, holeY;
|
double x, y, r, w, hole, holeX, holeY;
|
||||||
|
|
|
@ -49,10 +49,10 @@ class SEGVIA;
|
||||||
class Info_3D_Visu
|
class Info_3D_Visu
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
float m_Beginx, m_Beginy; /* position of mouse */
|
double m_Beginx, m_Beginy; /* position of mouse */
|
||||||
float m_Quat[4]; /* orientation of object */
|
double m_Quat[4]; /* orientation of object */
|
||||||
float m_Rot[4]; /* man rotation of object */
|
double m_Rot[4]; /* man rotation of object */
|
||||||
float m_Zoom; /* field of view in degrees */
|
double m_Zoom; /* field of view in degrees */
|
||||||
S3D_Color m_BgColor;
|
S3D_Color m_BgColor;
|
||||||
bool m_Draw3DAxis;
|
bool m_Draw3DAxis;
|
||||||
bool m_Draw3DModule;
|
bool m_Draw3DModule;
|
||||||
|
@ -65,11 +65,11 @@ public:
|
||||||
wxSize m_BoardSize;
|
wxSize m_BoardSize;
|
||||||
int m_Layers;
|
int m_Layers;
|
||||||
EDA_BoardDesignSettings * m_BoardSettings; // Link to current board design settings
|
EDA_BoardDesignSettings * m_BoardSettings; // Link to current board design settings
|
||||||
float m_Epoxy_Width; /* Epoxy tickness (normalized) */
|
double m_Epoxy_Width; /* Epoxy tickness (normalized) */
|
||||||
|
|
||||||
float m_BoardScale; /* Normalisation scale for coordinates:
|
double m_BoardScale; /* Normalisation scale for coordinates:
|
||||||
when scaled tey are between -1.0 and +1.0 */
|
when scaled tey are between -1.0 and +1.0 */
|
||||||
float m_LayerZcoord[32];
|
double m_LayerZcoord[32];
|
||||||
public:
|
public:
|
||||||
Info_3D_Visu();
|
Info_3D_Visu();
|
||||||
~Info_3D_Visu();
|
~Info_3D_Visu();
|
||||||
|
|
|
@ -50,6 +50,8 @@
|
||||||
* Gavin Bell
|
* Gavin Bell
|
||||||
*/
|
*/
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include "fctsys.h" // used only to define GLfloat
|
||||||
|
#include "3d_viewer.h" // used only to define GLfloat
|
||||||
#include "trackball.h"
|
#include "trackball.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -64,11 +66,11 @@
|
||||||
/*
|
/*
|
||||||
* Local function prototypes (not defined in trackball.h)
|
* Local function prototypes (not defined in trackball.h)
|
||||||
*/
|
*/
|
||||||
static float tb_project_to_sphere(float, float, float);
|
static double tb_project_to_sphere(double, double, double);
|
||||||
static void normalize_quat(float [4]);
|
static void normalize_quat(double [4]);
|
||||||
|
|
||||||
void
|
void
|
||||||
vzero(float *v)
|
vzero(double *v)
|
||||||
{
|
{
|
||||||
v[0] = 0.0;
|
v[0] = 0.0;
|
||||||
v[1] = 0.0;
|
v[1] = 0.0;
|
||||||
|
@ -76,7 +78,7 @@ vzero(float *v)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
vset(float *v, float x, float y, float z)
|
vset(double *v, double x, double y, double z)
|
||||||
{
|
{
|
||||||
v[0] = x;
|
v[0] = x;
|
||||||
v[1] = y;
|
v[1] = y;
|
||||||
|
@ -84,7 +86,7 @@ vset(float *v, float x, float y, float z)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
vsub(const float *src1, const float *src2, float *dst)
|
vsub(const double *src1, const double *src2, double *dst)
|
||||||
{
|
{
|
||||||
dst[0] = src1[0] - src2[0];
|
dst[0] = src1[0] - src2[0];
|
||||||
dst[1] = src1[1] - src2[1];
|
dst[1] = src1[1] - src2[1];
|
||||||
|
@ -92,7 +94,7 @@ vsub(const float *src1, const float *src2, float *dst)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
vcopy(const float *v1, float *v2)
|
vcopy(const double *v1, double *v2)
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
for (i = 0 ; i < 3 ; i++)
|
for (i = 0 ; i < 3 ; i++)
|
||||||
|
@ -100,9 +102,9 @@ vcopy(const float *v1, float *v2)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
vcross(const float *v1, const float *v2, float *cross)
|
vcross(const double *v1, const double *v2, double *cross)
|
||||||
{
|
{
|
||||||
float temp[3];
|
double temp[3];
|
||||||
|
|
||||||
temp[0] = (v1[1] * v2[2]) - (v1[2] * v2[1]);
|
temp[0] = (v1[1] * v2[2]) - (v1[2] * v2[1]);
|
||||||
temp[1] = (v1[2] * v2[0]) - (v1[0] * v2[2]);
|
temp[1] = (v1[2] * v2[0]) - (v1[0] * v2[2]);
|
||||||
|
@ -110,14 +112,14 @@ vcross(const float *v1, const float *v2, float *cross)
|
||||||
vcopy(temp, cross);
|
vcopy(temp, cross);
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
double
|
||||||
vlength(const float *v)
|
vlength(const double *v)
|
||||||
{
|
{
|
||||||
return (float) sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
|
return (double) sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
vscale(float *v, float div)
|
vscale(double *v, double div)
|
||||||
{
|
{
|
||||||
v[0] *= div;
|
v[0] *= div;
|
||||||
v[1] *= div;
|
v[1] *= div;
|
||||||
|
@ -125,19 +127,19 @@ vscale(float *v, float div)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
vnormal(float *v)
|
vnormal(double *v)
|
||||||
{
|
{
|
||||||
vscale(v, 1.0f/vlength(v));
|
vscale(v, 1.0f/vlength(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
double
|
||||||
vdot(const float *v1, const float *v2)
|
vdot(const double *v1, const double *v2)
|
||||||
{
|
{
|
||||||
return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];
|
return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
vadd(const float *src1, const float *src2, float *dst)
|
vadd(const double *src1, const double *src2, double *dst)
|
||||||
{
|
{
|
||||||
dst[0] = src1[0] + src2[0];
|
dst[0] = src1[0] + src2[0];
|
||||||
dst[1] = src1[1] + src2[1];
|
dst[1] = src1[1] + src2[1];
|
||||||
|
@ -157,12 +159,12 @@ vadd(const float *src1, const float *src2, float *dst)
|
||||||
* (-1.0 ... 1.0)
|
* (-1.0 ... 1.0)
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
trackball(float q[4], float p1x, float p1y, float p2x, float p2y)
|
trackball(double q[4], double p1x, double p1y, double p2x, double p2y)
|
||||||
{
|
{
|
||||||
float a[3]; /* Axis of rotation */
|
double a[3]; /* Axis of rotation */
|
||||||
float phi; /* how much to rotate about axis */
|
double phi; /* how much to rotate about axis */
|
||||||
float p1[3], p2[3], d[3];
|
double p1[3], p2[3], d[3];
|
||||||
float t;
|
double t;
|
||||||
|
|
||||||
if (p1x == p2x && p1y == p2y) {
|
if (p1x == p2x && p1y == p2y) {
|
||||||
/* Zero rotation */
|
/* Zero rotation */
|
||||||
|
@ -194,7 +196,7 @@ trackball(float q[4], float p1x, float p1y, float p2x, float p2y)
|
||||||
*/
|
*/
|
||||||
if (t > 1.0) t = 1.0;
|
if (t > 1.0) t = 1.0;
|
||||||
if (t < -1.0) t = -1.0;
|
if (t < -1.0) t = -1.0;
|
||||||
phi = 2.0f * (float) asin(t);
|
phi = 2.0f * (double) asin(t);
|
||||||
|
|
||||||
axis_to_quat(a,phi,q);
|
axis_to_quat(a,phi,q);
|
||||||
}
|
}
|
||||||
|
@ -203,26 +205,26 @@ trackball(float q[4], float p1x, float p1y, float p2x, float p2y)
|
||||||
* Given an axis and angle, compute quaternion.
|
* Given an axis and angle, compute quaternion.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
axis_to_quat(float a[3], float phi, float q[4])
|
axis_to_quat(double a[3], double phi, double q[4])
|
||||||
{
|
{
|
||||||
vnormal(a);
|
vnormal(a);
|
||||||
vcopy(a, q);
|
vcopy(a, q);
|
||||||
vscale(q, (float) sin(phi/2.0));
|
vscale(q, (double) sin(phi/2.0));
|
||||||
q[3] = (float) cos(phi/2.0);
|
q[3] = (double) cos(phi/2.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Project an x,y pair onto a sphere of radius r OR a hyperbolic sheet
|
* Project an x,y pair onto a sphere of radius r OR a hyperbolic sheet
|
||||||
* if we are away from the center of the sphere.
|
* if we are away from the center of the sphere.
|
||||||
*/
|
*/
|
||||||
static float
|
static double
|
||||||
tb_project_to_sphere(float r, float x, float y)
|
tb_project_to_sphere(double r, double x, double y)
|
||||||
{
|
{
|
||||||
float d, t, z;
|
double d, t, z;
|
||||||
|
|
||||||
d = (float) sqrt(x*x + y*y);
|
d = (double) sqrt(x*x + y*y);
|
||||||
if (d < r * 0.70710678118654752440) { /* Inside sphere */
|
if (d < r * 0.70710678118654752440) { /* Inside sphere */
|
||||||
z = (float) sqrt(r*r - d*d);
|
z = (double) sqrt(r*r - d*d);
|
||||||
} else { /* On hyperbola */
|
} else { /* On hyperbola */
|
||||||
t = r / 1.41421356237309504880f;
|
t = r / 1.41421356237309504880f;
|
||||||
z = t*t / d;
|
z = t*t / d;
|
||||||
|
@ -244,11 +246,11 @@ tb_project_to_sphere(float r, float x, float y)
|
||||||
#define RENORMCOUNT 97
|
#define RENORMCOUNT 97
|
||||||
|
|
||||||
void
|
void
|
||||||
add_quats(float q1[4], float q2[4], float dest[4])
|
add_quats(double q1[4], double q2[4], double dest[4])
|
||||||
{
|
{
|
||||||
static int count=0;
|
static int count=0;
|
||||||
float t1[4], t2[4], t3[4];
|
double t1[4], t2[4], t3[4];
|
||||||
float tf[4];
|
double tf[4];
|
||||||
|
|
||||||
vcopy(q1,t1);
|
vcopy(q1,t1);
|
||||||
vscale(t1,q2[3]);
|
vscale(t1,q2[3]);
|
||||||
|
@ -284,11 +286,10 @@ add_quats(float q1[4], float q2[4], float dest[4])
|
||||||
* - Pletinckx, D., Quaternion calculus as a basic tool in computer
|
* - Pletinckx, D., Quaternion calculus as a basic tool in computer
|
||||||
* graphics, The Visual Computer 5, 2-13, 1989.
|
* graphics, The Visual Computer 5, 2-13, 1989.
|
||||||
*/
|
*/
|
||||||
static void
|
static void normalize_quat(double q[4])
|
||||||
normalize_quat(float q[4])
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
float mag;
|
double mag;
|
||||||
|
|
||||||
mag = (q[0]*q[0] + q[1]*q[1] + q[2]*q[2] + q[3]*q[3]);
|
mag = (q[0]*q[0] + q[1]*q[1] + q[2]*q[2] + q[3]*q[3]);
|
||||||
for (i = 0; i < 4; i++) q[i] /= mag;
|
for (i = 0; i < 4; i++) q[i] /= mag;
|
||||||
|
@ -298,8 +299,7 @@ normalize_quat(float q[4])
|
||||||
* Build a rotation matrix, given a quaternion rotation.
|
* Build a rotation matrix, given a quaternion rotation.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void
|
void build_rotmatrix(GLfloat m[4][4], double q[4])
|
||||||
build_rotmatrix(float m[4][4], float q[4])
|
|
||||||
{
|
{
|
||||||
m[0][0] = 1.0f - 2.0f * (q[1] * q[1] + q[2] * q[2]);
|
m[0][0] = 1.0f - 2.0f * (q[1] * q[1] + q[2] * q[2]);
|
||||||
m[0][1] = 2.0f * (q[0] * q[1] - q[2] * q[3]);
|
m[0][1] = 2.0f * (q[0] * q[1] - q[2] * q[3]);
|
||||||
|
|
|
@ -47,8 +47,7 @@
|
||||||
* The resulting rotation is returned as a quaternion rotation in the
|
* The resulting rotation is returned as a quaternion rotation in the
|
||||||
* first paramater.
|
* first paramater.
|
||||||
*/
|
*/
|
||||||
void
|
void trackball(double q[4], double p1x, double p1y, double p2x, double p2y);
|
||||||
trackball(float q[4], float p1x, float p1y, float p2x, float p2y);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Given two quaternions, add them together to get a third quaternion.
|
* Given two quaternions, add them together to get a third quaternion.
|
||||||
|
@ -58,21 +57,18 @@ trackball(float q[4], float p1x, float p1y, float p2x, float p2y);
|
||||||
* rotation, the second and third the total rotation (which will be
|
* rotation, the second and third the total rotation (which will be
|
||||||
* over-written with the resulting new total rotation).
|
* over-written with the resulting new total rotation).
|
||||||
*/
|
*/
|
||||||
void
|
void add_quats(double *q1, double *q2, double *dest);
|
||||||
add_quats(float *q1, float *q2, float *dest);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A useful function, builds a rotation matrix in Matrix based on
|
* A useful function, builds a rotation matrix in Matrix based on
|
||||||
* given quaternion.
|
* given quaternion.
|
||||||
*/
|
*/
|
||||||
void
|
void build_rotmatrix(GLfloat m[4][4], double q[4]);
|
||||||
build_rotmatrix(float m[4][4], float q[4]);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function computes a quaternion based on an axis (defined by
|
* This function computes a quaternion based on an axis (defined by
|
||||||
* the given vector) and an angle about which to rotate. The angle is
|
* the given vector) and an angle about which to rotate. The angle is
|
||||||
* expressed in radians. The result is put into the third argument.
|
* expressed in radians. The result is put into the third argument.
|
||||||
*/
|
*/
|
||||||
void
|
void axis_to_quat(double a[3], double phi, double q[4]);
|
||||||
axis_to_quat(float a[3], float phi, float q[4]);
|
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,15 @@ 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-oct-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
||||||
|
================================================================================
|
||||||
|
++All
|
||||||
|
Use double instead float when possible, ande code cleaning.
|
||||||
|
change EXCHG macro to equivalent inline functions
|
||||||
|
(better code compatibility with some compilers)
|
||||||
|
|
||||||
|
|
||||||
2008-Oct-19 UPDATE Dick Hollenbeck <dick@softplc.com>
|
2008-Oct-19 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||||
================================================================================
|
================================================================================
|
||||||
+eeschema
|
+eeschema
|
||||||
|
|
|
@ -65,7 +65,8 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffs
|
||||||
bool swap = MapAngles( &pt1, &pt2, aTransformMatrix );
|
bool swap = MapAngles( &pt1, &pt2, aTransformMatrix );
|
||||||
if( swap )
|
if( swap )
|
||||||
{
|
{
|
||||||
EXCHG( pos1.x, pos2.x ); EXCHG( pos1.y, pos2.y )
|
EXCHG( pos1.x, pos2.x );
|
||||||
|
EXCHG( pos1.y, pos2.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
GRSetDrawMode( aDC, aDrawMode );
|
GRSetDrawMode( aDC, aDrawMode );
|
||||||
|
@ -297,8 +298,9 @@ void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
void LibDrawField::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset, int aColor,
|
void LibDrawField::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset, int aColor,
|
||||||
int aDrawMode, void* aData, int aTransformMatrix[2][2] )
|
int aDrawMode, void* aData, int aTransformMatrix[2][2] )
|
||||||
/*************************************************************************************************/
|
/*************************************************************************************************/
|
||||||
|
|
||||||
/* if aData not NULL, adat must point a wxString which is used instead of the m_Text
|
/* if aData not NULL, adat must point a wxString which is used instead of the m_Text
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxPoint text_pos;
|
wxPoint text_pos;
|
||||||
|
|
||||||
|
@ -332,7 +334,7 @@ void LibDrawField::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOf
|
||||||
}
|
}
|
||||||
text_pos = TransformCoordinate( aTransformMatrix, m_Pos ) + aOffset;
|
text_pos = TransformCoordinate( aTransformMatrix, m_Pos ) + aOffset;
|
||||||
|
|
||||||
wxString * text = aData ? (wxString *) aData : &m_Text;
|
wxString* text = aData ? (wxString*) aData : &m_Text;
|
||||||
GRSetDrawMode( aDC, aDrawMode );
|
GRSetDrawMode( aDC, aDrawMode );
|
||||||
DrawGraphicText( aPanel, aDC, text_pos,
|
DrawGraphicText( aPanel, aDC, text_pos,
|
||||||
color, text->GetData(),
|
color, text->GetData(),
|
||||||
|
|
|
@ -75,7 +75,7 @@ public:
|
||||||
* determined, upon placement, from the library component.
|
* determined, upon placement, from the library component.
|
||||||
* determined, upon file load, by the first non-digits in the reference fields. */
|
* determined, upon file load, by the first non-digits in the reference fields. */
|
||||||
|
|
||||||
int m_Convert; /* Gestion (management) des mutiples representations (ex: conversion De Morgan) */
|
int m_Convert; /* Handle mutiple shape (for instance De Morgan conversion) */
|
||||||
int m_Transform[2][2]; /* The rotation/mirror transformation matrix. */
|
int m_Transform[2][2]; /* The rotation/mirror transformation matrix. */
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -407,7 +407,6 @@ void WinEDA_SetOptionsFrame::Accept( wxCommandEvent& event )
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
{
|
{
|
||||||
wxSize grid;
|
wxSize grid;
|
||||||
bool setgrid = TRUE;
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
g_DrawMinimunLineWidth = m_DefaultDrawLineWidthCtrl->GetValue();
|
g_DrawMinimunLineWidth = m_DefaultDrawLineWidthCtrl->GetValue();
|
||||||
|
@ -459,7 +458,6 @@ void WinEDA_SetOptionsFrame::Accept( wxCommandEvent& event )
|
||||||
switch( m_SelGridSize->GetSelection() )
|
switch( m_SelGridSize->GetSelection() )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
setgrid = FALSE;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -473,11 +471,22 @@ void WinEDA_SetOptionsFrame::Accept( wxCommandEvent& event )
|
||||||
case 2:
|
case 2:
|
||||||
grid = wxSize( 10, 10 );
|
grid = wxSize( 10, 10 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
grid = wxSize( 5, 5 );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
grid = wxSize( 2, 2 );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 5:
|
||||||
|
grid = wxSize( 1, 1 );
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_Parent->GetBaseScreen() )
|
if( m_Parent->GetBaseScreen() )
|
||||||
{
|
{
|
||||||
if( setgrid )
|
|
||||||
m_Parent->GetBaseScreen()->SetGrid( grid );
|
m_Parent->GetBaseScreen()->SetGrid( grid );
|
||||||
m_Parent->GetBaseScreen()->SetRefreshReq();
|
m_Parent->GetBaseScreen()->SetRefreshReq();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
/* Macros utiles */
|
/**************************************/
|
||||||
|
/* Useful macros and inline functions */
|
||||||
|
/**************************************/
|
||||||
|
|
||||||
#ifndef MACROS_H
|
#ifndef MACROS_H
|
||||||
#define MACROS_H
|
#define MACROS_H
|
||||||
|
@ -48,10 +50,85 @@
|
||||||
Angle -= 1800; }
|
Angle -= 1800; }
|
||||||
|
|
||||||
|
|
||||||
/* exchange 2 items */
|
/****************************************/
|
||||||
#define EXCHG( a, b ) { typeof(a) __temp__ = (a); (a) = (b); (b) = __temp__; }
|
/* inline functions to exchange 2 items */
|
||||||
|
/****************************************/
|
||||||
|
static inline void EXCHG( int a, int b )
|
||||||
|
{
|
||||||
|
int temp = a;
|
||||||
|
a = b;
|
||||||
|
b = temp;
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline void EXCHG( int* a, int* b )
|
||||||
|
{
|
||||||
|
int* temp = a;
|
||||||
|
a = b;
|
||||||
|
b = temp;
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline void EXCHG( double a, double b )
|
||||||
|
{
|
||||||
|
double temp = a;
|
||||||
|
a = b;
|
||||||
|
b = temp;
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline void EXCHG( wxPoint a, wxPoint b )
|
||||||
|
{
|
||||||
|
wxPoint temp = a;
|
||||||
|
a = b;
|
||||||
|
b = temp;
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline void EXCHG( wxSize a, wxSize b )
|
||||||
|
{
|
||||||
|
wxSize temp = a;
|
||||||
|
a = b;
|
||||||
|
b = temp;
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline void EXCHG( const wxChar* a, const wxChar* b )
|
||||||
|
{
|
||||||
|
const wxChar* temp = a;
|
||||||
|
a = b;
|
||||||
|
b = temp;
|
||||||
|
};
|
||||||
|
|
||||||
|
class Hierarchical_PIN_Sheet_Struct;
|
||||||
|
static inline void EXCHG( const Hierarchical_PIN_Sheet_Struct* a, const Hierarchical_PIN_Sheet_Struct* b )
|
||||||
|
{
|
||||||
|
const Hierarchical_PIN_Sheet_Struct* temp = a;
|
||||||
|
a = b;
|
||||||
|
b = temp;
|
||||||
|
};
|
||||||
|
|
||||||
|
class SCH_CMP_FIELD;
|
||||||
|
static inline void EXCHG( const SCH_CMP_FIELD* a, const SCH_CMP_FIELD* b )
|
||||||
|
{
|
||||||
|
const SCH_CMP_FIELD* temp = a;
|
||||||
|
a = b;
|
||||||
|
b = temp;
|
||||||
|
};
|
||||||
|
|
||||||
|
class BOARD_ITEM;
|
||||||
|
static inline void EXCHG( const BOARD_ITEM* a, const BOARD_ITEM* b )
|
||||||
|
{
|
||||||
|
const BOARD_ITEM* temp = a;
|
||||||
|
a = b;
|
||||||
|
b = temp;
|
||||||
|
};
|
||||||
|
|
||||||
|
class D_PAD;
|
||||||
|
static inline void EXCHG( const D_PAD* a, const D_PAD* b )
|
||||||
|
{
|
||||||
|
const D_PAD* temp = a;
|
||||||
|
a = b;
|
||||||
|
b = temp;
|
||||||
|
};
|
||||||
|
/*****************************************************/
|
||||||
/* inline functions to insert menuitems with a icon: */
|
/* inline functions to insert menuitems with a icon: */
|
||||||
|
/*****************************************************/
|
||||||
static inline void ADD_MENUITEM( wxMenu* menu, int id,
|
static inline void ADD_MENUITEM( wxMenu* menu, int id,
|
||||||
const wxString& text,
|
const wxString& text,
|
||||||
const wxBitmap& icon )
|
const wxBitmap& icon )
|
||||||
|
|
|
@ -119,6 +119,7 @@ public:
|
||||||
public:
|
public:
|
||||||
WinEDA_PlotFrame( WinEDA_BasePcbFrame* parent );
|
WinEDA_PlotFrame( WinEDA_BasePcbFrame* parent );
|
||||||
private:
|
private:
|
||||||
|
void OnInitDialog( wxInitDialogEvent& event );
|
||||||
void Plot( wxCommandEvent& event );
|
void Plot( wxCommandEvent& event );
|
||||||
void OnQuit( wxCommandEvent& event );
|
void OnQuit( wxCommandEvent& event );
|
||||||
void OnClose( wxCloseEvent& event );
|
void OnClose( wxCloseEvent& event );
|
||||||
|
@ -130,6 +131,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE( WinEDA_PlotFrame, wxDialog )
|
BEGIN_EVENT_TABLE( WinEDA_PlotFrame, wxDialog )
|
||||||
|
EVT_INIT_DIALOG( WinEDA_PlotFrame::OnInitDialog )
|
||||||
EVT_CLOSE( WinEDA_PlotFrame::OnClose )
|
EVT_CLOSE( WinEDA_PlotFrame::OnClose )
|
||||||
EVT_BUTTON( wxID_CANCEL, WinEDA_PlotFrame::OnQuit )
|
EVT_BUTTON( wxID_CANCEL, WinEDA_PlotFrame::OnQuit )
|
||||||
EVT_BUTTON( ID_EXEC_PLOT, WinEDA_PlotFrame::Plot )
|
EVT_BUTTON( ID_EXEC_PLOT, WinEDA_PlotFrame::Plot )
|
||||||
|
@ -149,18 +151,25 @@ WinEDA_PlotFrame::WinEDA_PlotFrame( WinEDA_BasePcbFrame* parent ) :
|
||||||
wxDEFAULT_DIALOG_STYLE )
|
wxDEFAULT_DIALOG_STYLE )
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
{
|
{
|
||||||
|
m_Parent = parent;
|
||||||
|
Centre();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************/
|
||||||
|
void WinEDA_PlotFrame::OnInitDialog( wxInitDialogEvent& event )
|
||||||
|
/**************************************************************/
|
||||||
|
{
|
||||||
|
|
||||||
wxButton* button;
|
wxButton* button;
|
||||||
|
|
||||||
m_Parent = parent;
|
BOARD* board = m_Parent->m_Pcb;
|
||||||
|
|
||||||
BOARD* board = parent->m_Pcb;
|
|
||||||
|
|
||||||
wxConfig* config = m_Parent->m_Parent->m_EDA_Config; // Current config used by application
|
wxConfig* config = m_Parent->m_Parent->m_EDA_Config; // Current config used by application
|
||||||
|
|
||||||
|
|
||||||
SetFont( *g_DialogFont );
|
SetFont( *g_DialogFont );
|
||||||
Centre();
|
|
||||||
|
|
||||||
m_Plot_Sheet_Ref = NULL;
|
m_Plot_Sheet_Ref = NULL;
|
||||||
|
|
||||||
wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxHORIZONTAL );
|
wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
@ -443,17 +452,16 @@ WinEDA_PlotFrame::WinEDA_PlotFrame( WinEDA_BasePcbFrame* parent ) :
|
||||||
MidLeftBoxSizer->Add( m_HPGL_PlotCenter_Opt, 0, wxGROW | wxALL, 5 );
|
MidLeftBoxSizer->Add( m_HPGL_PlotCenter_Opt, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
// Mise a jour des activations des menus:
|
// Mise a jour des activations des menus:
|
||||||
wxCommandEvent event;
|
wxCommandEvent cmd_event;
|
||||||
SetCommands( event );
|
SetCommands( cmd_event );
|
||||||
|
|
||||||
GetSizer()->Fit( this );
|
GetSizer()->Fit( this );
|
||||||
GetSizer()->SetSizeHints( this );
|
GetSizer()->SetSizeHints( this );
|
||||||
|
|
||||||
// without this line, the ESC key does not work
|
// without this line, the ESC key does not work
|
||||||
m_PlotButton->SetFocus();
|
SetFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
void WinEDA_PlotFrame::OnQuit( wxCommandEvent& WXUNUSED (event) )
|
void WinEDA_PlotFrame::OnQuit( wxCommandEvent& WXUNUSED (event) )
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
|
@ -613,7 +613,7 @@ void Plot_1_texte( int format_plot, const wxString& Text, int angle,
|
||||||
|
|
||||||
/* calcul de la position du debut du texte */
|
/* calcul de la position du debut du texte */
|
||||||
if( centreX )
|
if( centreX )
|
||||||
sx = cX - ( (espacement * nbcodes) / 2 ) + (espacement / 9);
|
sx = cX - ( (espacement * nbcodes) / 2 );
|
||||||
else
|
else
|
||||||
sx = cX;
|
sx = cX;
|
||||||
if( centreY )
|
if( centreY )
|
||||||
|
|
Loading…
Reference in New Issue