Commit a28492f4 authored by dickelbeck's avatar dickelbeck

bug fixing, gerbers, etc.

parent 16784384
......@@ -19,9 +19,16 @@ email address.
2009-Feb-25 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++pcbnew
Markers were now shown when on top of a high-lighted pad. Moved highlight
* Markers were now shown when on top of a high-lighted pad. Moved highlight
drawing function into class BOARD and out of Frame. Call BOARD::DrawHighLight() from
within BOARD::Draw() to fix.
* Gerbers were not generated if you had EDGE_MODULEs on a copper layer, such as in
a MuWaveBasicShape. The line thickness was not being put into the gerber via a DCODE.
These gerber files were bad, and geda gerbv would also complain.
* A few window titles were not conformant with UIpolicies.txt.
* You could not load a *.pro file from another project into PCBNEW if your current
project had none. Changed wildcard mask.
* Deleted gen_self.h and moved that code into muonde.cpp
2009-Feb-24 UPDATE Dick Hollenbeck <dick@softplc.com>
......
......@@ -51,7 +51,6 @@ void EDGE_MODULE:: Copy( EDGE_MODULE* source ) // copy structure
if( source == NULL )
return;
// @todo why not just use "*this = source;" ?
m_Start = source->m_Start;
m_End = source->m_End;
m_Shape = source->m_Shape;
......
......@@ -420,7 +420,7 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC )
if( !segment->IsNull() )
continue;
/* Lenght segment = 0; delete it */
/* Length segment = 0; delete it */
segment->Draw( frame->DrawPanel, DC, GR_XOR );
segment->DeleteStructure();
nbpoints_supprimes++;
......
/****************************************************/
/* Gestion des composants specifiques aux microndes */
/* Generation d'une self */
/****************************************************/
/* Fichier GEN_SELF.H */
/* Fonctions locales */
static void Exit_Self( WinEDA_DrawPanel* Panel, wxDC* DC );
static EDGE_MODULE* gen_arc( EDGE_MODULE* PtSegm, int cX, int cY, int angle );
static void ShowCadreSelf( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
/* structures locales */
class SELFPCB // Definition d'une self constituee par une piste
{
public:
int forme; // Serpentin, spirale ..
int orient; // 0..3600
int valeur; // Valeur de la self
wxPoint m_Start;
wxPoint m_End; // Coord du point de depart et d'arrivee
wxSize m_Size;
D_PAD* pt_pad_start, * pt_pad_end; // Pointeurs sur les pads d'extremite
int lng; // Longueur de la piste constituant la self
int m_Width; // m_Size.xur de la piste
int nbrin; // Parametres de calcul: nombre de brins
int lbrin; // longueur du brin
int rayon; // Rayon des raccords entre brins
int delta; // distance aux pads
};
/* Variables locales */
static SELFPCB Mself;
static int Self_On;
static int Bl_X0, Bl_Y0, Bl_Xf, Bl_Yf; // Coord du cadre insrcivant la self
/*************************************************************************/
static void ShowCadreSelf( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/*************************************************************************/
/* Routine d'affichage a l'ecran du cadre de la self */
{
int deltaX, deltaY;
/* Calcul de l'orientation et de la taille de la fenetre:
* - orient = vert ou Horiz ( dimension max)
* - Size.x = Size.y / 2
*/
GRSetDrawMode( DC, GR_XOR );
if( erase )/* effacement du cadre */
{
GRRect( &panel->m_ClipBox, DC, Bl_X0, Bl_Y0, Bl_Xf, Bl_Yf, YELLOW );
}
deltaX = (panel->GetScreen()->m_Curseur.x - Mself.m_Start.x) / 4;
deltaY = (panel->GetScreen()->m_Curseur.y - Mself.m_Start.y) / 4;
Mself.orient = 900;
if( abs( deltaX ) > abs( deltaY ) )
Mself.orient = 0;
if( Mself.orient == 0 )
{
Bl_X0 = Mself.m_Start.x;
Bl_Y0 = Mself.m_Start.y - deltaX;
Bl_Xf = panel->GetScreen()->m_Curseur.x;
Bl_Yf = Mself.m_Start.y + deltaX;
}
else
{
Bl_X0 = Mself.m_Start.x - deltaY;
Bl_Y0 = Mself.m_Start.y;
Bl_Xf = Mself.m_Start.x + deltaY;
Bl_Yf = panel->GetScreen()->m_Curseur.y;
}
GRRect( &panel->m_ClipBox, DC, Bl_X0, Bl_Y0, Bl_Xf, Bl_Yf, YELLOW );
}
/*************************************************/
void Exit_Self( WinEDA_DrawPanel* Panel, wxDC* DC )
/*************************************************/
/* Routine de fermeture de l'application : ferme les commandes en cours */
{
if( Self_On )
{
Self_On = 0;
Panel->ManageCurseur( Panel, DC, 0 ); /* efface cadre */
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
}
}
/*******************************************/
void WinEDA_PcbFrame::Begin_Self( wxDC* DC )
/*******************************************/
/*
* Routine d'initialisation d'un trace de self
*/
{
if( Self_On )
{
Genere_Self( DC );
return;
}
Mself.m_Start = GetScreen()->m_Curseur;
Self_On = 1;
/* Mise a jour de l'origine des coord relatives */
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
Affiche_Status_Box();
Bl_X0 = Mself.m_Start.x; Bl_Y0 = Mself.m_Start.y;
Bl_Xf = Bl_X0; Bl_Yf = Bl_Y0;
DrawPanel->ManageCurseur = ShowCadreSelf;
DrawPanel->ForceCloseManageCurseur = Exit_Self;
DrawPanel->ManageCurseur( DrawPanel, DC, 0 ); /* Affiche cadre */
}
/**********************************************/
MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
/**********************************************/
/* Genere une self en forme de serpentin
* - longueur Mself.lng
* - Extremites Mself.m_Start et Mself.m_End
* - Contrainte: m_Start.x = m_End.x ( self verticale )
* ou m_Start.y = m_End.y ( self horizontale )
*
* On doit determiner:
* Mself.nbrin = nombre de segments perpendiculaires a la direction
* ( le serpention aura nbrin + 1 demicercles + 2 1/4 de cercle)
* Mself.lbrin = longueur d'un brin
* Mself.rayon = rayon des parties arrondies du serpentin
* Mself.delta = segments raccord entre extremites et le serpention lui meme
*
* Les equations sont
* Mself.m_Size.x = 2*Mself.rayon + Mself.lbrin
* Mself.m_Size.y = 2*Mself.delta + 2*Mself.nbrin*Mself.rayon
* Mself.lng = 2*Mself.delta // Raccords au serpentin
+ (Mself.nbrin-2) * Mself.lbrin //longueur des brins sauf 1er et dernier
+ (Mself.nbrin+1) * ( PI * Mself.rayon) // longueur des arrondis
+ Mself.lbrin/2 - Melf.rayon*2) // longueur du 1er et dernier brin
*
* Les contraintes sont:
* nbrin >= 2
* Mself.rayon < Mself.m_Size.x
* Mself.m_Size.y = Mself.rayon*4 + 2*Mself.raccord
* Mself.lbrin > Mself.rayon *2
*
* Le calcul est conduit de la facon suivante:
* Initialement:
* nbrin = 2
* rayon = 4 * m_Size.x (valeur fixe arbitraire)
* puis:
* on augmente le nombre de brins jusqu'a la longueur desiree
* ( le rayon est diminue si necessaire )
*
*/
{
EDGE_MODULE* PtSegm, * LastSegm, * FirstSegm, * newedge;
MODULE* Module;
D_PAD* PtPad;
int ii, ll, lextbrin;
double fcoeff;
bool abort = FALSE;
wxString msg;
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); /* efface cadre */
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
if( Self_On == 0 )
{
DisplayError( this, wxT( "Starting point not init.." ) ); return NULL;
}
Self_On = 0;
Mself.m_End = GetScreen()->m_Curseur;
/* Agencement des parametres pour simplifier le calcul : */
/* le point de depart doit avoir la coord depart < celle du point de fin */
if( Mself.orient == 0 ) // Self horizontale
{
Mself.m_End.y = Mself.m_Start.y;
if( Mself.m_Start.x > Mself.m_End.x )
EXCHG( Mself.m_Start.x, Mself.m_End.x );
Mself.m_Size.y = Mself.m_End.x - Mself.m_Start.x;
Mself.lng = Mself.m_Size.y;
}
else // Self verticale
{
Mself.m_End.x = Mself.m_Start.x;
if( Mself.m_Start.y > Mself.m_End.y )
EXCHG( Mself.m_Start.y, Mself.m_End.y );
Mself.m_Size.y = Mself.m_End.y - Mself.m_Start.y;
Mself.lng = Mself.m_Size.y;
}
/* Entree de la vraie longueur desiree */
if( !g_UnitMetric )
{
fcoeff = 10000.0;
msg.Printf( wxT( "%1.4f" ), Mself.lng / fcoeff );
abort = Get_Message( _( "Length(inch):" ), _("Lenght"), msg, this );
}
else
{
fcoeff = 10000.0 / 25.4;
msg.Printf( wxT( "%2.3f" ), Mself.lng / fcoeff );
abort = Get_Message( _( "Length(mm):" ), _("Lenght"), msg, this );
}
if( abort )
return NULL;
double fval;
if( !msg.ToDouble( &fval ) )
{
DisplayError( this, _( "Incorrect number, abort" ) );
return NULL;
}
Mself.lng = (int) round( fval * fcoeff );
/* Controle des valeurs ( ii = valeur minimale de la longueur */
if( Mself.lng < Mself.m_Size.y )
{
DisplayError( this, _( "Requested length < minimum length" ) );
return NULL;
}
/* Generation du composant: calcul des elements de la self */
Mself.m_Width = g_DesignSettings.m_CurrentTrackWidth;
Mself.m_Size.x = Mself.m_Size.y / 2;
// Choix d'une Valeur de depart raisonnable pour le rayon des arcs de cercle
Mself.rayon = MIN( Mself.m_Width * 5, Mself.m_Size.x / 4 );
/* Calcul des parametres */
for( Mself.nbrin = 2; ; Mself.nbrin++ )
{
Mself.delta = ( Mself.m_Size.y - ( Mself.rayon * 2 * Mself.nbrin ) ) / 2;
if( Mself.delta < Mself.m_Size.y / 10 ) // C.a.d. si m_Size.yeur self > m_Size.yeur specifiee
{ // Reduction du rayon des arrondis
Mself.delta = Mself.m_Size.y / 10;
Mself.rayon = (Mself.m_Size.y - 2 * Mself.delta) / ( 2 * Mself.nbrin);
if( Mself.rayon < Mself.m_Width )
{ // Rayon vraiment trop petit...
Affiche_Message( _( "Unable to create line: Requested length is too big" ) );
return NULL;
}
}
Mself.lbrin = Mself.m_Size.x - (Mself.rayon * 2);
lextbrin = (Mself.lbrin / 2) - Mself.rayon;
ll = 2 * lextbrin; // Longueur du 1er et dernier brin
ll += 2 * Mself.delta; // Longueur des raccord au serpentin
ll += Mself.nbrin * (Mself.lbrin - 2); // longueur des autres brins
ll += ( (Mself.nbrin + 1) * 314 * Mself.rayon ) / 100;
msg.Printf( _( "Segm count = %d, Lenght = " ), Mself.nbrin );
wxString stlen;
valeur_param( ll, stlen ); msg += stlen;
Affiche_Message( msg );
if( ll >= Mself.lng )
break;
}
/* Generation du composant : le calcul est fait self Verticale */
if( Create_1_Module( DC, wxEmptyString ) == NULL )
return NULL;
Module = GetBoard()->m_Modules;
Module->m_LibRef = wxT( "MuSelf" );
Module->m_Attributs = MOD_VIRTUAL | MOD_CMS;
Module->m_Flags = 0;
Module->Draw( DrawPanel, DC, GR_XOR );
/* Generation des elements speciaux: drawsegments */
FirstSegm = PtSegm = new EDGE_MODULE( Module );
Module->m_Drawings.PushBack( PtSegm );
PtSegm->m_Start = Mself.m_Start;
PtSegm->m_End.x = Mself.m_Start.x;
PtSegm->m_End.y = PtSegm->m_Start.y + Mself.delta;
PtSegm->m_Width = Mself.m_Width;
PtSegm->SetLayer( Module->GetLayer() );
PtSegm->m_Shape = S_SEGMENT;
newedge = new EDGE_MODULE( Module );
newedge->Copy( PtSegm );
Module->m_Drawings.Insert( newedge, PtSegm->Next() );
PtSegm = newedge;
PtSegm->m_Start = PtSegm->m_End;
PtSegm = gen_arc( PtSegm, PtSegm->m_End.x - Mself.rayon, PtSegm->m_End.y, -900 );
if( lextbrin )
{
newedge = new EDGE_MODULE( Module );
newedge->Copy( PtSegm );
Module->m_Drawings.Insert( newedge, PtSegm->Next() );
PtSegm = newedge;
PtSegm->m_Start = PtSegm->m_End;
PtSegm->m_End.x -= lextbrin;
}
/* Trace du serpentin */
for( ii = 1; ii < Mself.nbrin; ii++ )
{
int arc_angle;
newedge = new EDGE_MODULE( Module );
newedge->Copy( PtSegm );
Module->m_Drawings.Insert( newedge, PtSegm->Next() );
PtSegm = newedge;
PtSegm->m_Start = PtSegm->m_End;
if( ii & 1 ) /* brin d'ordre impair : cercles de sens > 0 */
arc_angle = 1800;
else
arc_angle = -1800;
PtSegm = gen_arc( PtSegm, PtSegm->m_End.x,
PtSegm->m_End.y + Mself.rayon, arc_angle );
if( ii < Mself.nbrin - 1 )
{
newedge = new EDGE_MODULE( Module );
newedge->Copy( PtSegm );
Module->m_Drawings.Insert( newedge, PtSegm->Next() );
PtSegm = newedge;
PtSegm->m_Start = PtSegm->m_End;
if( ii & 1 )
PtSegm->m_End.x += Mself.lbrin;
else
PtSegm->m_End.x -= Mself.lbrin;
}
}
/* Trace du point final */
if( ii & 1 ) /* brin final de sens > 0 */
{
if( lextbrin )
{
newedge = new EDGE_MODULE( Module );
newedge->Copy( PtSegm );
Module->m_Drawings.Insert( newedge, PtSegm->Next() );
PtSegm = newedge;
PtSegm->m_Start = PtSegm->m_End;
PtSegm->m_End.x -= lextbrin;
}
newedge = new EDGE_MODULE( Module );
newedge->Copy( PtSegm );
Module->m_Drawings.Insert( newedge, PtSegm->Next() );
PtSegm = newedge;
PtSegm->m_Start.x = PtSegm->m_End.x; PtSegm->m_Start.y = PtSegm->m_End.y;
PtSegm = gen_arc( PtSegm, PtSegm->m_End.x, PtSegm->m_End.y + Mself.rayon, 900 );
}
else
{
if( lextbrin )
{
newedge = new EDGE_MODULE( Module );
newedge->Copy( PtSegm );
Module->m_Drawings.Insert( newedge, PtSegm->Next() );
PtSegm = newedge;
PtSegm->m_Start = PtSegm->m_End;
PtSegm->m_End.x += lextbrin;
}
newedge = new EDGE_MODULE( Module );
newedge->Copy( PtSegm );
Module->m_Drawings.Insert( newedge, PtSegm->Next() );
PtSegm = newedge;
PtSegm->m_Start = PtSegm->m_End;
PtSegm = gen_arc( PtSegm, PtSegm->m_End.x, PtSegm->m_End.y + Mself.rayon, -900 );
}
newedge = new EDGE_MODULE( Module );
newedge->Copy( PtSegm );
Module->m_Drawings.Insert( newedge, PtSegm->Next() );
PtSegm = newedge;
PtSegm->m_Start = PtSegm->m_End;
PtSegm->m_End = Mself.m_End;
/* Rotation de la self si le trace doit etre horizontal : */
LastSegm = PtSegm;
if( Mself.orient == 0 )
{
for( PtSegm = FirstSegm; PtSegm != NULL; PtSegm = (EDGE_MODULE*) PtSegm->Next() )
{
RotatePoint( &PtSegm->m_Start.x, &PtSegm->m_Start.y,
FirstSegm->m_Start.x, FirstSegm->m_Start.y, 900 );
if( PtSegm != LastSegm )
RotatePoint( &PtSegm->m_End.x, &PtSegm->m_End.y,
FirstSegm->m_Start.x, FirstSegm->m_Start.y, 900 );
}
}
/* Modif position ancre */
Module->m_Pos = LastSegm->m_End;
/* Placement des 2 pads sur extremite */
PtPad = new D_PAD( Module );
Module->m_Pads.PushFront( PtPad );
PtPad->SetPadName( wxT( "1" ) );
PtPad->m_Pos = LastSegm->m_End;
PtPad->m_Pos0 = PtPad->m_Pos - Module->m_Pos;
PtPad->m_Size.x = PtPad->m_Size.y = LastSegm->m_Width;
PtPad->m_Masque_Layer = g_TabOneLayerMask[LastSegm->GetLayer()];
PtPad->m_Attribut = PAD_SMD;
PtPad->m_PadShape = PAD_CIRCLE;
PtPad->m_Rayon = PtPad->m_Size.x / 2;
D_PAD* newpad = new D_PAD( Module );
newpad->Copy( PtPad );
Module->m_Pads.Insert( newpad, PtPad->Next() );
PtPad = newpad;
PtPad->SetPadName( wxT( "2" ) );
PtPad->m_Pos = FirstSegm->m_Start;
PtPad->m_Pos0 = PtPad->m_Pos - Module->m_Pos;
/* Modif des positions textes */
Module->Display_Infos( this );
Module->m_Value->m_Pos.x = Module->m_Reference->m_Pos.x = ( FirstSegm->m_Start.x +
LastSegm->m_End.x ) / 2;
Module->m_Value->m_Pos.y = Module->m_Reference->m_Pos.y = ( FirstSegm->m_Start.y +
LastSegm->m_End.y ) / 2;
Module->m_Reference->m_Pos.y -= Module->m_Reference->m_Size.y;
Module->m_Value->m_Pos.y += Module->m_Value->m_Size.y;
Module->m_Reference->m_Pos0 = Module->m_Reference->m_Pos - Module->m_Pos;
Module->m_Value->m_Pos0 = Module->m_Value->m_Pos - Module->m_Pos;
/* Init des Coord locales des segments */
for( PtSegm = FirstSegm; PtSegm; PtSegm = PtSegm->Next() )
{
PtSegm->m_Start0 = PtSegm->m_Start - Module->m_Pos;
PtSegm->m_End0 = PtSegm->m_End - Module->m_Pos;
}
Module->Set_Rectangle_Encadrement();
Module->Draw( DrawPanel, DC, GR_OR );
return Module;
}
/**************************************************************************/
static EDGE_MODULE* gen_arc( EDGE_MODULE* PtSegm, int cX, int cY, int angle )
/**************************************************************************/
/* Genere un arc de EDGE_MODULE :
* de centre cX,cY
* d'angle "angle"
* de point de depart donne dans la structure pointee par PtSegm, qui doit
* entre a jour (type,net..)
* Retourne un pointeur sur la derniere structure EDGE_MODULE generee
*/
{
int ii, nb_seg;
double alpha, beta, fsin, fcos;
int x0, xr0, y0, yr0;
EDGE_MODULE* newedge;
// m_Drawings in the board
DLIST<BOARD_ITEM>* list = (DLIST<BOARD_ITEM>*) PtSegm->GetList();
wxASSERT( list );
angle = -angle;
y0 = PtSegm->m_Start.x - cX;
x0 = PtSegm->m_Start.y - cY;
nb_seg = ( abs( angle ) ) / 225; if( nb_seg == 0 )
nb_seg = 1;
alpha = ( (double) angle * 3.14159 / 1800 ) / nb_seg;
for( ii = 1; ii <= nb_seg; ii++ )
{
if( ii > 1 )
{
newedge = new EDGE_MODULE( (MODULE*) NULL );
newedge->Copy( PtSegm );
newedge->SetParent( PtSegm->GetParent() );
list->Insert( newedge, PtSegm->Next() );
PtSegm = newedge;
PtSegm->m_Start = PtSegm->m_End;
}
beta = (alpha * ii);
fcos = cos( beta ); fsin = sin( beta );
xr0 = (int) (x0 * fcos + y0 * fsin);
yr0 = (int) (y0 * fcos - x0 * fsin);
PtSegm->m_End.x = cX + yr0;
PtSegm->m_End.y = cY + xr0;
}
return PtSegm;
}
......@@ -722,7 +722,7 @@ MODULE* WinEDA_BasePcbFrame::Create_1_Module( wxDC* DC, const wxString& module_n
/* Ask fo the new module reference */
if( module_name.IsEmpty() )
{
if( Get_Message( _( "Module Reference:" ), _( "Module Creation:" ), Line, this ) != 0 )
if( Get_Message( _( "Module Reference:" ), _( "Module Creation" ), Line, this ) != 0 )
{
DisplayInfo( this, _( "No reference, aborted" ) );
return NULL;
......
......@@ -26,7 +26,545 @@ static double ShapeScaleX, ShapeScaleY;
static wxSize ShapeSize;
static int PolyShapeType;
#include "gen_self.h"
/* Fonctions locales */
static void Exit_Self( WinEDA_DrawPanel* Panel, wxDC* DC );
static EDGE_MODULE* gen_arc( MODULE* aModule, EDGE_MODULE* PtSegm, int cX, int cY, int angle );
static void ShowCadreSelf( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
/* structures locales */
class SELFPCB // Definition d'une self constituee par une piste
{
public:
int forme; // Serpentin, spirale ..
int orient; // 0..3600
int valeur; // Valeur de la self
wxPoint m_Start;
wxPoint m_End; // Coord du point de depart et d'arrivee
wxSize m_Size;
D_PAD* pt_pad_start, * pt_pad_end; // Pointeurs sur les pads d'extremite
int lng; // Longueur de la piste constituant la self
int m_Width; // m_Size.xur de la piste
int nbrin; // Parametres de calcul: nombre de brins
int lbrin; // longueur du brin
int rayon; // Rayon des raccords entre brins
int delta; // distance aux pads
};
/* Variables locales */
static SELFPCB Mself;
static int Self_On;
static int Bl_X0, Bl_Y0, Bl_Xf, Bl_Yf; // Coord du cadre insrcivant la self
/*************************************************************************/
static void ShowCadreSelf( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/*************************************************************************/
/* Routine d'affichage a l'ecran du cadre de la self */
{
int deltaX, deltaY;
/* Calcul de l'orientation et de la taille de la fenetre:
* - orient = vert ou Horiz ( dimension max)
* - Size.x = Size.y / 2
*/
GRSetDrawMode( DC, GR_XOR );
if( erase )/* effacement du cadre */
{
GRRect( &panel->m_ClipBox, DC, Bl_X0, Bl_Y0, Bl_Xf, Bl_Yf, YELLOW );
}
deltaX = (panel->GetScreen()->m_Curseur.x - Mself.m_Start.x) / 4;
deltaY = (panel->GetScreen()->m_Curseur.y - Mself.m_Start.y) / 4;
Mself.orient = 900;
if( abs( deltaX ) > abs( deltaY ) )
Mself.orient = 0;
if( Mself.orient == 0 )
{
Bl_X0 = Mself.m_Start.x;
Bl_Y0 = Mself.m_Start.y - deltaX;
Bl_Xf = panel->GetScreen()->m_Curseur.x;
Bl_Yf = Mself.m_Start.y + deltaX;
}
else
{
Bl_X0 = Mself.m_Start.x - deltaY;
Bl_Y0 = Mself.m_Start.y;
Bl_Xf = Mself.m_Start.x + deltaY;
Bl_Yf = panel->GetScreen()->m_Curseur.y;
}
GRRect( &panel->m_ClipBox, DC, Bl_X0, Bl_Y0, Bl_Xf, Bl_Yf, YELLOW );
}
/*************************************************/
void Exit_Self( WinEDA_DrawPanel* Panel, wxDC* DC )
/*************************************************/
/* Routine de fermeture de l'application : ferme les commandes en cours */
{
if( Self_On )
{
Self_On = 0;
Panel->ManageCurseur( Panel, DC, 0 ); /* efface cadre */
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
}
}
/*******************************************/
void WinEDA_PcbFrame::Begin_Self( wxDC* DC )
/*******************************************/
{
if( Self_On )
{
Genere_Self( DC );
return;
}
Mself.m_Start = GetScreen()->m_Curseur;
Self_On = 1;
/* Mise a jour de l'origine des coord relatives */
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
Affiche_Status_Box();
Bl_X0 = Mself.m_Start.x;
Bl_Y0 = Mself.m_Start.y;
Bl_Xf = Bl_X0;
Bl_Yf = Bl_Y0;
DrawPanel->ManageCurseur = ShowCadreSelf;
DrawPanel->ForceCloseManageCurseur = Exit_Self;
DrawPanel->ManageCurseur( DrawPanel, DC, 0 ); /* Affiche cadre */
}
/**********************************************/
MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
/**********************************************/
/* Genere une self en forme de serpentin
* - longueur Mself.lng
* - Extremites Mself.m_Start et Mself.m_End
* - Contrainte: m_Start.x = m_End.x ( self verticale )
* ou m_Start.y = m_End.y ( self horizontale )
*
* On doit determiner:
* Mself.nbrin = nombre de segments perpendiculaires a la direction
* ( le serpention aura nbrin + 1 demicercles + 2 1/4 de cercle)
* Mself.lbrin = longueur d'un brin
* Mself.rayon = rayon des parties arrondies du serpentin
* Mself.delta = segments raccord entre extremites et le serpention lui meme
*
* Les equations sont
* Mself.m_Size.x = 2*Mself.rayon + Mself.lbrin
* Mself.m_Size.y = 2*Mself.delta + 2*Mself.nbrin*Mself.rayon
* Mself.lng = 2*Mself.delta // Raccords au serpentin
+ (Mself.nbrin-2) * Mself.lbrin //longueur des brins sauf 1er et dernier
+ (Mself.nbrin+1) * ( PI * Mself.rayon) // longueur des arrondis
+ Mself.lbrin/2 - Melf.rayon*2) // longueur du 1er et dernier brin
*
* Les contraintes sont:
* nbrin >= 2
* Mself.rayon < Mself.m_Size.x
* Mself.m_Size.y = Mself.rayon*4 + 2*Mself.raccord
* Mself.lbrin > Mself.rayon *2
*
* Le calcul est conduit de la facon suivante:
* Initialement:
* nbrin = 2
* rayon = 4 * m_Size.x (valeur fixe arbitraire)
* puis:
* on augmente le nombre de brins jusqu'a la longueur desiree
* ( le rayon est diminue si necessaire )
*
*/
{
EDGE_MODULE* PtSegm, * LastSegm, * FirstSegm, * newedge;
MODULE* Module;
D_PAD* PtPad;
int ii, ll, lextbrin;
double fcoeff;
bool abort = FALSE;
wxString msg;
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); /* efface cadre */
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
if( Self_On == 0 )
{
DisplayError( this, wxT( "Starting point not init.." ) );
return NULL;
}
Self_On = 0;
Mself.m_End = GetScreen()->m_Curseur;
/* Agencement des parametres pour simplifier le calcul : */
/* le point de depart doit avoir la coord depart < celle du point de fin */
if( Mself.orient == 0 ) // Self horizontale
{
Mself.m_End.y = Mself.m_Start.y;
if( Mself.m_Start.x > Mself.m_End.x )
EXCHG( Mself.m_Start.x, Mself.m_End.x );
Mself.m_Size.y = Mself.m_End.x - Mself.m_Start.x;
Mself.lng = Mself.m_Size.y;
}
else // Self verticale
{
Mself.m_End.x = Mself.m_Start.x;
if( Mself.m_Start.y > Mself.m_End.y )
EXCHG( Mself.m_Start.y, Mself.m_End.y );
Mself.m_Size.y = Mself.m_End.y - Mself.m_Start.y;
Mself.lng = Mself.m_Size.y;
}
/* Entree de la vraie longueur desiree */
if( !g_UnitMetric )
{
fcoeff = 10000.0;
msg.Printf( wxT( "%1.4f" ), Mself.lng / fcoeff );
abort = Get_Message( _( "Length(inch):" ), _("Length"), msg, this );
}
else
{
fcoeff = 10000.0 / 25.4;
msg.Printf( wxT( "%2.3f" ), Mself.lng / fcoeff );
abort = Get_Message( _( "Length(mm):" ), _("Length"), msg, this );
}
if( abort )
return NULL;
double fval;
if( !msg.ToDouble( &fval ) )
{
DisplayError( this, _( "Incorrect number, abort" ) );
return NULL;
}
Mself.lng = (int) round( fval * fcoeff );
/* Controle des valeurs ( ii = valeur minimale de la longueur */
if( Mself.lng < Mself.m_Size.y )
{
DisplayError( this, _( "Requested length < minimum length" ) );
return NULL;
}
/* Generation du composant: calcul des elements de la self */
Mself.m_Width = g_DesignSettings.m_CurrentTrackWidth;
Mself.m_Size.x = Mself.m_Size.y / 2;
// Choix d'une Valeur de depart raisonnable pour le rayon des arcs de cercle
Mself.rayon = MIN( Mself.m_Width * 5, Mself.m_Size.x / 4 );
/* Calcul des parametres */
for( Mself.nbrin = 2; ; Mself.nbrin++ )
{
Mself.delta = ( Mself.m_Size.y - ( Mself.rayon * 2 * Mself.nbrin ) ) / 2;
if( Mself.delta < Mself.m_Size.y / 10 ) // C.a.d. si m_Size.yeur self > m_Size.yeur specifiee
{ // Reduction du rayon des arrondis
Mself.delta = Mself.m_Size.y / 10;
Mself.rayon = (Mself.m_Size.y - 2 * Mself.delta) / ( 2 * Mself.nbrin);
if( Mself.rayon < Mself.m_Width )
{ // Rayon vraiment trop petit...
Affiche_Message( _( "Unable to create line: Requested length is too big" ) );
return NULL;
}
}
Mself.lbrin = Mself.m_Size.x - (Mself.rayon * 2);
lextbrin = (Mself.lbrin / 2) - Mself.rayon;
ll = 2 * lextbrin; // Longueur du 1er et dernier brin
ll += 2 * Mself.delta; // Longueur des raccord au serpentin
ll += Mself.nbrin * (Mself.lbrin - 2); // longueur des autres brins
ll += ( (Mself.nbrin + 1) * 314 * Mself.rayon ) / 100;
msg.Printf( _( "Segm count = %d, Length = " ), Mself.nbrin );
wxString stlen;
valeur_param( ll, stlen );
msg += stlen;
Affiche_Message( msg );
if( ll >= Mself.lng )
break;
}
/* Generation du composant : le calcul est fait self Verticale */
Module = Create_1_Module( DC, wxEmptyString );
if( Module == NULL )
return NULL;
// here the Module is already in the BOARD, Create_1_Module() does that.
Module->m_LibRef = wxT( "MuSelf" );
Module->m_Attributs = MOD_VIRTUAL | MOD_CMS;
Module->m_Flags = 0;
Module->Draw( DrawPanel, DC, GR_XOR );
/* Generation des elements speciaux: drawsegments */
FirstSegm = PtSegm = new EDGE_MODULE( Module );
Module->m_Drawings.PushBack( PtSegm );
PtSegm->m_Start = Mself.m_Start;
PtSegm->m_End.x = Mself.m_Start.x;
PtSegm->m_End.y = PtSegm->m_Start.y + Mself.delta;
PtSegm->m_Width = Mself.m_Width;
PtSegm->SetLayer( Module->GetLayer() );
PtSegm->m_Shape = S_SEGMENT;
newedge = new EDGE_MODULE( Module );
newedge->Copy( PtSegm );
Module->m_Drawings.PushBack( newedge );
PtSegm = newedge;
PtSegm->m_Start = PtSegm->m_End;
PtSegm = gen_arc( Module, PtSegm, PtSegm->m_End.x - Mself.rayon, PtSegm->m_End.y, -900 );
if( lextbrin )
{
newedge = new EDGE_MODULE( Module );
newedge->Copy( PtSegm );
Module->m_Drawings.PushBack( newedge );
PtSegm = newedge;
PtSegm->m_Start = PtSegm->m_End;
PtSegm->m_End.x -= lextbrin;
}
/* Trace du serpentin */
for( ii = 1; ii < Mself.nbrin; ii++ )
{
int arc_angle;
newedge = new EDGE_MODULE( Module );
newedge->Copy( PtSegm );
Module->m_Drawings.PushBack( newedge );
PtSegm = newedge;
PtSegm->m_Start = PtSegm->m_End;
if( ii & 1 ) /* brin d'ordre impair : cercles de sens > 0 */
arc_angle = 1800;
else
arc_angle = -1800;
PtSegm = gen_arc( Module, PtSegm, PtSegm->m_End.x,
PtSegm->m_End.y + Mself.rayon, arc_angle );
if( ii < Mself.nbrin - 1 )
{
newedge = new EDGE_MODULE( Module );
newedge->Copy( PtSegm );
Module->m_Drawings.Insert( newedge, PtSegm->Next() );
PtSegm = newedge;
PtSegm->m_Start = PtSegm->m_End;
if( ii & 1 )
PtSegm->m_End.x += Mself.lbrin;
else
PtSegm->m_End.x -= Mself.lbrin;
}
}
/* Trace du point final */
if( ii & 1 ) /* brin final de sens > 0 */
{
if( lextbrin )
{
newedge = new EDGE_MODULE( Module );
newedge->Copy( PtSegm );
Module->m_Drawings.Insert( newedge, PtSegm->Next() );
PtSegm = newedge;
PtSegm->m_Start = PtSegm->m_End;
PtSegm->m_End.x -= lextbrin;
}
newedge = new EDGE_MODULE( Module );
newedge->Copy( PtSegm );
Module->m_Drawings.PushBack( newedge );
PtSegm = newedge;
PtSegm->m_Start.x = PtSegm->m_End.x; PtSegm->m_Start.y = PtSegm->m_End.y;
PtSegm = gen_arc( Module, PtSegm, PtSegm->m_End.x, PtSegm->m_End.y + Mself.rayon, 900 );
}
else
{
if( lextbrin )
{
newedge = new EDGE_MODULE( Module );
newedge->Copy( PtSegm );
Module->m_Drawings.Insert( newedge, PtSegm->Next() );
PtSegm = newedge;
PtSegm->m_Start = PtSegm->m_End;
PtSegm->m_End.x += lextbrin;
}
newedge = new EDGE_MODULE( Module );
newedge->Copy( PtSegm );
Module->m_Drawings.PushBack( newedge );
PtSegm = newedge;
PtSegm->m_Start = PtSegm->m_End;
PtSegm = gen_arc( Module, PtSegm, PtSegm->m_End.x, PtSegm->m_End.y + Mself.rayon, -900 );
}
newedge = new EDGE_MODULE( Module );
newedge->Copy( PtSegm );
Module->m_Drawings.Insert( newedge, PtSegm->Next() );
PtSegm = newedge;
PtSegm->m_Start = PtSegm->m_End;
PtSegm->m_End = Mself.m_End;
/* Rotation de la self si le trace doit etre horizontal : */
LastSegm = PtSegm;
if( Mself.orient == 0 )
{
for( PtSegm = FirstSegm; PtSegm != NULL; PtSegm = (EDGE_MODULE*) PtSegm->Next() )
{
RotatePoint( &PtSegm->m_Start.x, &PtSegm->m_Start.y,
FirstSegm->m_Start.x, FirstSegm->m_Start.y, 900 );
if( PtSegm != LastSegm )
RotatePoint( &PtSegm->m_End.x, &PtSegm->m_End.y,
FirstSegm->m_Start.x, FirstSegm->m_Start.y, 900 );
}
}
/* Modif position ancre */
Module->m_Pos = LastSegm->m_End;
/* Placement des 2 pads sur extremite */
PtPad = new D_PAD( Module );
Module->m_Pads.PushFront( PtPad );
PtPad->SetPadName( wxT( "1" ) );
PtPad->m_Pos = LastSegm->m_End;
PtPad->m_Pos0 = PtPad->m_Pos - Module->m_Pos;
PtPad->m_Size.x = PtPad->m_Size.y = LastSegm->m_Width;
PtPad->m_Masque_Layer = g_TabOneLayerMask[LastSegm->GetLayer()];
PtPad->m_Attribut = PAD_SMD;
PtPad->m_PadShape = PAD_CIRCLE;
PtPad->m_Rayon = PtPad->m_Size.x / 2;
D_PAD* newpad = new D_PAD( Module );
newpad->Copy( PtPad );
Module->m_Pads.Insert( newpad, PtPad->Next() );
PtPad = newpad;
PtPad->SetPadName( wxT( "2" ) );
PtPad->m_Pos = FirstSegm->m_Start;
PtPad->m_Pos0 = PtPad->m_Pos - Module->m_Pos;
/* Modif des positions textes */
Module->Display_Infos( this );
Module->m_Value->m_Pos.x = Module->m_Reference->m_Pos.x = ( FirstSegm->m_Start.x +
LastSegm->m_End.x ) / 2;
Module->m_Value->m_Pos.y = Module->m_Reference->m_Pos.y = ( FirstSegm->m_Start.y +
LastSegm->m_End.y ) / 2;
Module->m_Reference->m_Pos.y -= Module->m_Reference->m_Size.y;
Module->m_Value->m_Pos.y += Module->m_Value->m_Size.y;
Module->m_Reference->m_Pos0 = Module->m_Reference->m_Pos - Module->m_Pos;
Module->m_Value->m_Pos0 = Module->m_Value->m_Pos - Module->m_Pos;
/* Init des Coord locales des segments */
for( PtSegm = FirstSegm; PtSegm; PtSegm = PtSegm->Next() )
{
PtSegm->m_Start0 = PtSegm->m_Start - Module->m_Pos;
PtSegm->m_End0 = PtSegm->m_End - Module->m_Pos;
}
Module->Set_Rectangle_Encadrement();
Module->Draw( DrawPanel, DC, GR_OR );
return Module;
}
/**************************************************************************/
static EDGE_MODULE* gen_arc( MODULE* aModule, EDGE_MODULE* PtSegm, int cX, int cY, int angle )
/**************************************************************************/
/* Genere un arc de EDGE_MODULE :
* de centre cX,cY
* d'angle "angle"
* de point de depart donne dans la structure pointee par PtSegm, qui doit
* entre a jour (type,net..)
* Retourne un pointeur sur la derniere structure EDGE_MODULE generee
*/
{
int ii, nb_seg;
double alpha, beta, fsin, fcos;
int x0, xr0, y0, yr0;
EDGE_MODULE* newedge;
angle = -angle;
y0 = PtSegm->m_Start.x - cX;
x0 = PtSegm->m_Start.y - cY;
nb_seg = ( abs( angle ) ) / 225; if( nb_seg == 0 )
nb_seg = 1;
alpha = ( (double) angle * 3.14159 / 1800 ) / nb_seg;
for( ii = 1; ii <= nb_seg; ii++ )
{
if( ii > 1 )
{
newedge = new EDGE_MODULE( aModule );
newedge->Copy( PtSegm );
aModule->m_Drawings.PushBack( newedge );
PtSegm = newedge;
PtSegm->m_Start = PtSegm->m_End;
}
beta = (alpha * ii);
fcos = cos( beta ); fsin = sin( beta );
xr0 = (int) (x0 * fcos + y0 * fsin);
yr0 = (int) (y0 * fcos - x0 * fsin);
PtSegm->m_End.x = cX + yr0;
PtSegm->m_End.y = cY + xr0;
}
return PtSegm;
}
/***************************************************************************/
MODULE* WinEDA_PcbFrame::Create_MuWaveBasicShape( const wxString& name, int pad_count )
......
......@@ -69,11 +69,11 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
case ID_CONFIG_READ:
FullFileName = GetScreen()->m_FileName.AfterLast( '/' );
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
FullFileName = EDA_FileSelector( _( "Read config file" ),
FullFileName = EDA_FileSelector( _( "Read Config File" ),
wxPathOnly( GetScreen()->m_FileName ), /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */
FullFileName, /* Masque d'affichage */
wxString( wxT("*")) + g_Prj_Config_Filename_ext,
this,
wxFD_OPEN,
TRUE /* ne change pas de repertoire courant */
......@@ -183,10 +183,9 @@ bool Read_Config( const wxString& project_name )
ScreenPcb->AddGrid( g_UserGrid, g_UserGrid_Unit, ID_POPUP_GRID_USER );
}
g_DesignSettings.m_TrackWidthHistory[0] =
g_DesignSettings.m_CurrentTrackWidth;
g_DesignSettings.m_ViaSizeHistory[0] =
g_DesignSettings.m_CurrentViaSize;
g_DesignSettings.m_TrackWidthHistory[0] = g_DesignSettings.m_CurrentTrackWidth;
g_DesignSettings.m_ViaSizeHistory[0] = g_DesignSettings.m_CurrentViaSize;
for( ii = 1; ii < HISTORY_NUMBER; ii++ )
{
g_DesignSettings.m_TrackWidthHistory[ii] = 0;
......
......@@ -429,22 +429,21 @@ void Plot_Edges_Modules( BOARD* pcb, int format_plot, int masque_layer )
/* Trace les contours des modules */
{
int nb_items; /* Pour affichage activite: nbr modules traites */
MODULE* Module;
EDGE_MODULE* PtEdge;
wxString msg;
nb_items = 0;
Module = pcb->m_Modules;
for( ; Module != NULL; Module = Module->Next() )
for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
{
PtEdge = (EDGE_MODULE*) Module->m_Drawings.GetFirst();
for( ; PtEdge != NULL; PtEdge = PtEdge->Next() )
EDGE_MODULE* edge = (EDGE_MODULE*) module->m_Drawings.GetFirst();
for( ; edge; edge = edge->Next() )
{
if( PtEdge->Type() != TYPE_EDGE_MODULE )
if( edge->Type() != TYPE_EDGE_MODULE )
continue;
if( (g_TabOneLayerMask[PtEdge->GetLayer()] & masque_layer) == 0 )
if( (g_TabOneLayerMask[edge->GetLayer()] & masque_layer) == 0 )
continue;
Plot_1_EdgeModule( format_plot, PtEdge );
Plot_1_EdgeModule( format_plot, edge );
}
/* Affichage du nombre de modules traites */
......@@ -470,8 +469,12 @@ void Plot_1_EdgeModule( int format_plot, EDGE_MODULE* PtEdge )
type_trace = PtEdge->m_Shape;
thickness = PtEdge->m_Width;
if( g_Plot_Mode == FILAIRE )
{
thickness = g_PlotLine_Width;
wxLogDebug( wxT("changing edgemodule thickness to g_PlotLine_Width") );
}
pos = PtEdge->m_Start;
end = PtEdge->m_End;
......@@ -484,6 +487,7 @@ void Plot_1_EdgeModule( int format_plot, EDGE_MODULE* PtEdge )
switch( format_plot )
{
case PLOT_FORMAT_GERBER:
SelectD_CODE_For_LineDraw(thickness);
PlotGERBERLine( pos, end, thickness );
break;
......
......@@ -84,10 +84,13 @@ void WinEDA_BasePcbFrame::Genere_GERBER( const wxString& FullFileName, int Layer
/* Calculate scaling from pcbnew units (in 0.1 mil or 0.0001 inch) to gerber units */
Gerb_scale_plot = 1.0; /* for format 3.4 (4 digits for decimal format means 0.1 mil per gerber unit */
scale_x = Scale_X * Gerb_scale_plot;
scale_y = Scale_Y * Gerb_scale_plot;
g_PlotOffset.x = 0;
g_PlotOffset.y = 0;
if( PlotOriginIsAuxAxis )
g_PlotOffset = m_Auxiliary_Axis_Position;
......@@ -175,35 +178,30 @@ void WinEDA_BasePcbFrame::Plot_Layer_GERBER( FILE* File, int masque_layer,
{
wxPoint pos;
wxSize size;
MODULE* Module;
D_PAD* PtPad;
TRACK* track;
EDA_BaseStruct* PtStruct;
wxString msg;
/* Draw items type Drawings Pcb matching with masque_layer: */
PtStruct = m_Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
for( BOARD_ITEM* item = m_Pcb->m_Drawings; item; item = item->Next() )
{
switch( PtStruct->Type() )
switch( item->Type() )
{
case TYPE_DRAWSEGMENT:
PlotDrawSegment( (DRAWSEGMENT*) PtStruct, PLOT_FORMAT_GERBER,
PlotDrawSegment( (DRAWSEGMENT*) item, PLOT_FORMAT_GERBER,
masque_layer );
break;
case TYPE_TEXTE:
PlotTextePcb( (TEXTE_PCB*) PtStruct, PLOT_FORMAT_GERBER,
PlotTextePcb( (TEXTE_PCB*) item, PLOT_FORMAT_GERBER,
masque_layer );
break;
case TYPE_COTATION:
PlotCotation( (COTATION*) PtStruct, PLOT_FORMAT_GERBER,
PlotCotation( (COTATION*) item, PLOT_FORMAT_GERBER,
masque_layer );
break;
case TYPE_MIRE:
PlotMirePcb( (MIREPCB*) PtStruct, PLOT_FORMAT_GERBER,
PlotMirePcb( (MIREPCB*) item, PLOT_FORMAT_GERBER,
masque_layer );
break;
......@@ -216,18 +214,16 @@ void WinEDA_BasePcbFrame::Plot_Layer_GERBER( FILE* File, int masque_layer,
}
}
/* Draw footprints shapes without pads (pads will plotted later) */
Module = m_Pcb->m_Modules;
for( ; Module != NULL; Module = (MODULE*) Module->Next() )
/* Draw footprint shapes without pads (pads will plotted later) */
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
{
PtStruct = Module->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
for( BOARD_ITEM* item = module->m_Drawings; item; item = item->Next() )
{
switch( PtStruct->Type() )
switch( item->Type() )
{
case TYPE_EDGE_MODULE:
if( masque_layer & g_TabOneLayerMask[( (EDGE_MODULE*) PtStruct )->GetLayer()] )
Plot_1_EdgeModule( PLOT_FORMAT_GERBER, (EDGE_MODULE*) PtStruct );
if( masque_layer & g_TabOneLayerMask[( (EDGE_MODULE*) item)->GetLayer()] )
Plot_1_EdgeModule( PLOT_FORMAT_GERBER, (EDGE_MODULE*) item );
break;
default:
......@@ -237,26 +233,25 @@ void WinEDA_BasePcbFrame::Plot_Layer_GERBER( FILE* File, int masque_layer,
}
/* Plot footprint pads */
Module = m_Pcb->m_Modules;
for( ; Module != NULL; Module = (MODULE*) Module->Next() )
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
{
PtPad = (D_PAD*) Module->m_Pads;
for( ; PtPad != NULL; PtPad = (D_PAD*) PtPad->Next() )
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
{
wxPoint shape_pos;
if( (PtPad->m_Masque_Layer & masque_layer) == 0 )
if( (pad->m_Masque_Layer & masque_layer) == 0 )
continue;
shape_pos = PtPad->ReturnShapePos();
shape_pos = pad->ReturnShapePos();
pos = shape_pos;
size.x = PtPad->m_Size.x + 2 * garde;
size.y = PtPad->m_Size.y + 2 * garde;
size.x = pad->m_Size.x + 2 * garde;
size.y = pad->m_Size.y + 2 * garde;
/* Don't draw a null size item : */
if( size.x <= 0 || size.y <= 0 )
continue;
switch( PtPad->m_PadShape )
switch( pad->m_PadShape )
{
case PAD_CIRCLE:
Plot_1_CIRCLE_pad_GERBER( pos, size.x );
......@@ -268,20 +263,20 @@ void WinEDA_BasePcbFrame::Plot_Layer_GERBER( FILE* File, int masque_layer,
if( size.x == size.y )
Plot_1_CIRCLE_pad_GERBER( pos, size.x );
else
trace_1_pastille_OVALE_GERBER( pos, size, PtPad->m_Orient );
trace_1_pastille_OVALE_GERBER( pos, size, pad->m_Orient );
break;
case PAD_TRAPEZOID:
{
wxSize delta = PtPad->m_DeltaSize;
wxSize delta = pad->m_DeltaSize;
trace_1_pad_TRAPEZE_GERBER( pos, size,
delta, PtPad->m_Orient, FILLED );
delta, pad->m_Orient, FILLED );
}
break;
case PAD_RECT:
default:
PlotRectangularPad_GERBER( pos, size, PtPad->m_Orient );
PlotRectangularPad_GERBER( pos, size, pad->m_Orient );
break;
}
}
......@@ -290,39 +285,46 @@ void WinEDA_BasePcbFrame::Plot_Layer_GERBER( FILE* File, int masque_layer,
/* Plot vias : */
if( tracevia )
{
for( track = m_Pcb->m_Track; track != NULL; track = (TRACK*) track->Next() )
for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() )
{
if( track->Type() != TYPE_VIA )
continue;
SEGVIA* Via = (SEGVIA*) track;
// vias not plotted if not on selected layer, but if layer
// == SOLDERMASK_LAYER_CU or SOLDERMASK_LAYER_CMP, vias are drawn,
// if they are on a external copper layer
int via_mask_layer = Via->ReturnMaskLayer();
if( via_mask_layer & CUIVRE_LAYER )
via_mask_layer |= SOLDERMASK_LAYER_CU;
if( via_mask_layer & CMP_LAYER )
via_mask_layer |= SOLDERMASK_LAYER_CMP;
if( ( via_mask_layer & masque_layer) == 0 )
continue;
pos = Via->m_Start;
size.x = size.y = Via->m_Width + 2 * garde;
/* Don't draw a null size item : */
if( size.x <= 0 )
continue;
Plot_1_CIRCLE_pad_GERBER( pos, size.x );
}
}
/* Plot tracks (not vias) : */
for( track = m_Pcb->m_Track; track != NULL; track = (TRACK*) track->Next() )
for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() )
{
wxPoint end;
if( track->Type() == TYPE_VIA )
continue;
if( (g_TabOneLayerMask[track->GetLayer()] & masque_layer) == 0 )
continue;
......@@ -335,7 +337,7 @@ void WinEDA_BasePcbFrame::Plot_Layer_GERBER( FILE* File, int masque_layer,
}
/* Plot zones: */
for( track = m_Pcb->m_Zone; track != NULL; track = (TRACK*) track->Next() )
for( TRACK* track = m_Pcb->m_Zone; track; track = track->Next() )
{
wxPoint end;
......@@ -781,9 +783,6 @@ int Gen_D_CODE_File( FILE* penfile )
/*****************************/
void CloseFileGERBER( void )
/****************************/
/** Function CloseFileGERBER
*/
{
char line[1024];
wxString TmpFileName, msg;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment