beautification, hit test improvements
This commit is contained in:
parent
ea6aba8212
commit
8a8377ff6a
1847
pcbnew/autoplac.cpp
1847
pcbnew/autoplac.cpp
File diff suppressed because it is too large
Load Diff
|
@ -332,9 +332,10 @@ EDA_BaseStruct* BOARD::FindPadOrModule( const wxPoint& refPos, int layer )
|
|||
public:
|
||||
EDA_BaseStruct* found;
|
||||
int layer;
|
||||
int layer_mask;
|
||||
|
||||
PadOrModule( int alayer ) :
|
||||
found(0), layer(alayer)
|
||||
found(0), layer(alayer), layer_mask( g_TabOneLayerMask[alayer] )
|
||||
{}
|
||||
|
||||
SEARCH_RESULT Inspect( EDA_BaseStruct* testItem, const void* testData )
|
||||
|
@ -343,23 +344,33 @@ EDA_BaseStruct* BOARD::FindPadOrModule( const wxPoint& refPos, int layer )
|
|||
|
||||
if( testItem->m_StructType == TYPEPAD )
|
||||
{
|
||||
if( testItem->HitTest( refPos ) )
|
||||
D_PAD* pad = (D_PAD*) testItem;
|
||||
if( pad->HitTest( refPos ) )
|
||||
{
|
||||
found = testItem;
|
||||
return SEARCH_QUIT;
|
||||
if( layer_mask & pad->m_Masque_Layer )
|
||||
{
|
||||
found = testItem;
|
||||
return SEARCH_QUIT;
|
||||
}
|
||||
else if( !found )
|
||||
{
|
||||
MODULE* parent = (MODULE*) pad->m_Parent;
|
||||
if( IsModuleLayerVisible( parent->m_Layer ) )
|
||||
found = testItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if( testItem->m_StructType == TYPEMODULE )
|
||||
{
|
||||
int mlayer = ((MODULE*)testItem)->m_Layer;
|
||||
MODULE* module = (MODULE*) testItem;
|
||||
|
||||
// consider only visible modules
|
||||
if( IsModuleLayerVisible( mlayer ) )
|
||||
if( IsModuleLayerVisible( module->m_Layer ) )
|
||||
{
|
||||
if( testItem->HitTest( refPos ) )
|
||||
if( module->HitTest( refPos ) )
|
||||
{
|
||||
if( layer == mlayer )
|
||||
if( layer == module->m_Layer )
|
||||
{
|
||||
found = testItem;
|
||||
return SEARCH_QUIT;
|
||||
|
|
|
@ -27,11 +27,13 @@
|
|||
|
||||
D_PAD::D_PAD( MODULE* parent ) : EDA_BaseStruct( parent, TYPEPAD )
|
||||
{
|
||||
m_NumPadName = 0;
|
||||
m_Masque_Layer = CUIVRE_LAYER;
|
||||
m_NetCode = 0; /* Numero de net pour comparaisons rapides */
|
||||
m_DrillShape = CIRCLE; // Drill shape = circle
|
||||
m_NumPadName = 0;
|
||||
m_Masque_Layer = CUIVRE_LAYER;
|
||||
m_NetCode = 0; /* Numero de net pour comparaisons rapides */
|
||||
m_DrillShape = CIRCLE; // Drill shape = circle
|
||||
|
||||
m_Size.x = m_Size.y = 500;
|
||||
|
||||
if( m_Parent && (m_Parent->m_StructType == TYPEMODULE) )
|
||||
{
|
||||
m_Pos = ( (MODULE*) m_Parent )->m_Pos;
|
||||
|
@ -91,7 +93,8 @@ const wxPoint D_PAD::ReturnShapePos( void )
|
|||
wxPoint shape_pos;
|
||||
int dX, dY;
|
||||
|
||||
dX = m_Offset.x; dY = m_Offset.y;
|
||||
dX = m_Offset.x;
|
||||
dY = m_Offset.y;
|
||||
|
||||
RotatePoint( &dX, &dY, m_Orient );
|
||||
|
||||
|
@ -458,12 +461,13 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
|
|||
|
||||
GRClosedPoly( &panel->m_ClipBox, DC, 4, (int*) coord, 0, color, color );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Draw the pad hole */
|
||||
int cx0 = m_Pos.x - offset.x;
|
||||
|
|
1462
pcbnew/clean.cpp
1462
pcbnew/clean.cpp
File diff suppressed because it is too large
Load Diff
|
@ -336,9 +336,11 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
|||
bool keep_on_grid = TRUE;
|
||||
if( m_ID_current_state == ID_PCB_DELETE_ITEM_BUTT )
|
||||
keep_on_grid = FALSE;
|
||||
|
||||
/* Cursor is left off grid if no block in progress and no moving object */
|
||||
if( GetScreen()->BlockLocate.m_State != STATE_NO_BLOCK )
|
||||
keep_on_grid = TRUE;
|
||||
|
||||
EDA_BaseStruct* DrawStruct = GetScreen()->m_CurrentItem;
|
||||
if( DrawStruct && DrawStruct->m_Flags )
|
||||
keep_on_grid = TRUE;
|
||||
|
|
|
@ -35,7 +35,8 @@ void WinEDA_PcbFrame::InstallFindFrame( const wxPoint& pos, wxDC* DC )
|
|||
{
|
||||
WinEDA_PcbFindFrame* frame = new WinEDA_PcbFindFrame( this, DC, pos );
|
||||
|
||||
frame->ShowModal(); frame->Destroy();
|
||||
frame->ShowModal();
|
||||
frame->Destroy();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,510 +1,526 @@
|
|||
/****************************************************/
|
||||
/* Gestion des composants specifiques aux microndes */
|
||||
/* Generation d'une self */
|
||||
/****************************************************/
|
||||
/****************************************************/
|
||||
/* Gestion des composants specifiques aux microndes */
|
||||
/* Generation d'une self */
|
||||
/****************************************************/
|
||||
|
||||
/* Fichier GEN_SELF.H */
|
||||
/* 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);
|
||||
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
|
||||
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
|
||||
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 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)
|
||||
static void ShowCadreSelf( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||
/*************************************************************************/
|
||||
/* Routine d'affichage a l'ecran du cadre de la self */
|
||||
{
|
||||
int deltaX, deltaY;
|
||||
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
|
||||
*/
|
||||
/* 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);
|
||||
}
|
||||
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;
|
||||
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;
|
||||
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);
|
||||
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)
|
||||
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;
|
||||
}
|
||||
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)
|
||||
void WinEDA_PcbFrame::Begin_Self( wxDC* DC )
|
||||
/*******************************************/
|
||||
|
||||
/*
|
||||
Routine d'initialisation d'un trace de self
|
||||
*/
|
||||
* Routine d'initialisation d'un trace de self
|
||||
*/
|
||||
{
|
||||
if( Self_On )
|
||||
{
|
||||
Genere_Self( DC );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( Self_On )
|
||||
{
|
||||
Genere_Self(DC);
|
||||
return;
|
||||
}
|
||||
|
||||
Mself.m_Start = GetScreen()->m_Curseur;
|
||||
Mself.m_Start = GetScreen()->m_Curseur;
|
||||
|
||||
Self_On = 1;
|
||||
Self_On = 1;
|
||||
|
||||
/* Mise a jour de l'origine des coord relatives */
|
||||
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
|
||||
Affiche_Status_Box();
|
||||
/* 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;
|
||||
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 */
|
||||
DrawPanel->ManageCurseur = ShowCadreSelf;
|
||||
DrawPanel->ForceCloseManageCurseur = Exit_Self;
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, 0 ); /* Affiche cadre */
|
||||
}
|
||||
|
||||
|
||||
/**********************************************/
|
||||
MODULE * WinEDA_PcbFrame::Genere_Self( wxDC *DC)
|
||||
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 )
|
||||
|
||||
*/
|
||||
* - 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;
|
||||
float fcoeff;
|
||||
bool abort = FALSE;
|
||||
wxString msg;
|
||||
|
||||
DrawPanel->ManageCurseur(DrawPanel, DC, FALSE); /* efface cadre */
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||
EDGE_MODULE* PtSegm, * LastSegm, * FirstSegm, * newedge;
|
||||
MODULE* Module;
|
||||
D_PAD* PtPad;
|
||||
int ii, ll, lextbrin;
|
||||
float fcoeff;
|
||||
bool abort = FALSE;
|
||||
wxString msg;
|
||||
|
||||
if(Self_On == 0)
|
||||
{
|
||||
DisplayError(this, wxT("Starting point not init..")); return NULL;
|
||||
}
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); /* efface cadre */
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||
|
||||
Self_On = 0;
|
||||
if( Self_On == 0 )
|
||||
{
|
||||
DisplayError( this, wxT( "Starting point not init.." ) ); return NULL;
|
||||
}
|
||||
|
||||
Mself.m_End = m_CurrentScreen->m_Curseur;
|
||||
Self_On = 0;
|
||||
|
||||
/* Agencement des parametres pour simplifier le calcul : */
|
||||
/* le point de depart doit avoir la coord depart < celle du point de fin */
|
||||
Mself.m_End = m_CurrentScreen->m_Curseur;
|
||||
|
||||
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;
|
||||
}
|
||||
/* Agencement des parametres pour simplifier le calcul : */
|
||||
/* le point de depart doit avoir la coord depart < celle du point de fin */
|
||||
|
||||
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;
|
||||
}
|
||||
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):"),msg, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
fcoeff = 10000.0/25.4 ;
|
||||
msg.Printf( wxT("%2.3f"), Mself.lng /fcoeff);
|
||||
abort = Get_Message( _("Length(mm):"),msg, this);
|
||||
}
|
||||
if ( abort ) return NULL;
|
||||
/* 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):" ), msg, this );
|
||||
}
|
||||
else
|
||||
{
|
||||
fcoeff = 10000.0 / 25.4;
|
||||
msg.Printf( wxT( "%2.3f" ), Mself.lng / fcoeff );
|
||||
abort = Get_Message( _( "Length(mm):" ), 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 );
|
||||
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;
|
||||
}
|
||||
/* 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 */
|
||||
/* 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;
|
||||
|
||||
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 ;
|
||||
// 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 */
|
||||
|
||||
msg.Printf( _("Segm count = %d, Lenght = "), Mself.nbrin);
|
||||
wxString stlen;
|
||||
valeur_param(ll, stlen); msg += stlen;
|
||||
Affiche_Message(msg);
|
||||
if ( ll >= Mself.lng) break;
|
||||
}
|
||||
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;
|
||||
|
||||
/* Generation du composant : le calcul est fait self Verticale */
|
||||
if( Create_1_Module(DC, wxEmptyString) == NULL ) return NULL;
|
||||
msg.Printf( _( "Segm count = %d, Lenght = " ), Mself.nbrin );
|
||||
wxString stlen;
|
||||
valeur_param( ll, stlen ); msg += stlen;
|
||||
Affiche_Message( msg );
|
||||
if( ll >= Mself.lng )
|
||||
break;
|
||||
}
|
||||
|
||||
Module = m_Pcb->m_Modules;
|
||||
Module->m_LibRef = wxT("MuSelf");
|
||||
Module->m_Attributs = MOD_VIRTUAL | MOD_CMS;
|
||||
Module->m_Flags = 0;
|
||||
/* Generation du composant : le calcul est fait self Verticale */
|
||||
if( Create_1_Module( DC, wxEmptyString ) == NULL )
|
||||
return NULL;
|
||||
|
||||
Module->Draw(DrawPanel, DC, wxPoint(0,0), GR_XOR);
|
||||
Module = m_Pcb->m_Modules;
|
||||
Module->m_LibRef = wxT( "MuSelf" );
|
||||
Module->m_Attributs = MOD_VIRTUAL | MOD_CMS;
|
||||
Module->m_Flags = 0;
|
||||
|
||||
/* Generation des elements speciaux: drawsegments */
|
||||
LastSegm = (EDGE_MODULE*) Module->m_Drawings;
|
||||
if( LastSegm ) while( LastSegm->Pnext) LastSegm = (EDGE_MODULE*)LastSegm->Pnext;
|
||||
Module->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
|
||||
|
||||
FirstSegm = PtSegm = new EDGE_MODULE(Module);
|
||||
if (LastSegm )
|
||||
{
|
||||
LastSegm->Pnext = PtSegm;
|
||||
PtSegm->Pback = LastSegm;
|
||||
}
|
||||
else
|
||||
{
|
||||
Module->m_Drawings = PtSegm; PtSegm->Pback = Module;
|
||||
}
|
||||
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->m_Layer = Module->m_Layer;
|
||||
PtSegm->m_Shape = S_SEGMENT;
|
||||
/* Generation des elements speciaux: drawsegments */
|
||||
LastSegm = (EDGE_MODULE*) Module->m_Drawings;
|
||||
if( LastSegm )
|
||||
while( LastSegm->Pnext )
|
||||
LastSegm = (EDGE_MODULE*) LastSegm->Pnext;
|
||||
|
||||
newedge = new EDGE_MODULE(Module);
|
||||
newedge->Copy(PtSegm);
|
||||
newedge->AddToChain(PtSegm);
|
||||
PtSegm = newedge;
|
||||
PtSegm->m_Start = PtSegm->m_End;
|
||||
PtSegm = gen_arc(PtSegm,PtSegm->m_End.x - Mself.rayon, PtSegm->m_End.y, -900);
|
||||
FirstSegm = PtSegm = new EDGE_MODULE( Module );
|
||||
if( LastSegm )
|
||||
{
|
||||
LastSegm->Pnext = PtSegm;
|
||||
PtSegm->Pback = LastSegm;
|
||||
}
|
||||
else
|
||||
{
|
||||
Module->m_Drawings = PtSegm; PtSegm->Pback = Module;
|
||||
}
|
||||
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->m_Layer = Module->m_Layer;
|
||||
PtSegm->m_Shape = S_SEGMENT;
|
||||
|
||||
if(lextbrin)
|
||||
{
|
||||
newedge = new EDGE_MODULE(Module);
|
||||
newedge->Copy(PtSegm);
|
||||
newedge->AddToChain(PtSegm);
|
||||
PtSegm = newedge;
|
||||
PtSegm->m_Start = PtSegm->m_End;
|
||||
PtSegm->m_End.x -= lextbrin;
|
||||
}
|
||||
newedge = new EDGE_MODULE( Module );
|
||||
newedge->Copy( PtSegm );
|
||||
newedge->AddToChain( PtSegm );
|
||||
PtSegm = newedge;
|
||||
PtSegm->m_Start = PtSegm->m_End;
|
||||
PtSegm = gen_arc( PtSegm, PtSegm->m_End.x - Mself.rayon, PtSegm->m_End.y, -900 );
|
||||
|
||||
/* Trace du serpentin */
|
||||
for (ii = 1 ; ii < Mself.nbrin; ii++)
|
||||
{
|
||||
int arc_angle;
|
||||
newedge = new EDGE_MODULE(Module);
|
||||
newedge->Copy(PtSegm);
|
||||
newedge->AddToChain(PtSegm);
|
||||
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;
|
||||
if( lextbrin )
|
||||
{
|
||||
newedge = new EDGE_MODULE( Module );
|
||||
newedge->Copy( PtSegm );
|
||||
newedge->AddToChain( PtSegm );
|
||||
PtSegm = newedge;
|
||||
PtSegm->m_Start = PtSegm->m_End;
|
||||
PtSegm->m_End.x -= lextbrin;
|
||||
}
|
||||
|
||||
PtSegm = gen_arc(PtSegm, PtSegm->m_End.x,
|
||||
PtSegm->m_End.y + Mself.rayon, arc_angle);
|
||||
/* Trace du serpentin */
|
||||
for( ii = 1; ii < Mself.nbrin; ii++ )
|
||||
{
|
||||
int arc_angle;
|
||||
newedge = new EDGE_MODULE( Module );
|
||||
newedge->Copy( PtSegm );
|
||||
newedge->AddToChain( PtSegm );
|
||||
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;
|
||||
|
||||
if( ii < Mself.nbrin-1)
|
||||
{
|
||||
newedge = new EDGE_MODULE(Module);
|
||||
newedge->Copy(PtSegm);
|
||||
newedge->AddToChain(PtSegm);
|
||||
PtSegm = newedge;
|
||||
PtSegm->m_Start = PtSegm->m_End;
|
||||
if( ii & 1) PtSegm->m_End.x += Mself.lbrin;
|
||||
else PtSegm->m_End.x -= Mself.lbrin;
|
||||
}
|
||||
}
|
||||
PtSegm = gen_arc( PtSegm, PtSegm->m_End.x,
|
||||
PtSegm->m_End.y + Mself.rayon, arc_angle );
|
||||
|
||||
/* Trace du point final */
|
||||
if( ii < Mself.nbrin - 1 )
|
||||
{
|
||||
newedge = new EDGE_MODULE( Module );
|
||||
newedge->Copy( PtSegm );
|
||||
newedge->AddToChain( PtSegm );
|
||||
PtSegm = newedge;
|
||||
PtSegm->m_Start = PtSegm->m_End;
|
||||
if( ii & 1 )
|
||||
PtSegm->m_End.x += Mself.lbrin;
|
||||
else
|
||||
PtSegm->m_End.x -= Mself.lbrin;
|
||||
}
|
||||
}
|
||||
|
||||
if( ii & 1) /* brin final de sens > 0 */
|
||||
{
|
||||
if(lextbrin)
|
||||
{
|
||||
newedge = new EDGE_MODULE(Module);
|
||||
newedge->Copy(PtSegm);
|
||||
newedge->AddToChain(PtSegm);
|
||||
PtSegm = newedge;
|
||||
PtSegm->m_Start = PtSegm->m_End;
|
||||
PtSegm->m_End.x -= lextbrin;
|
||||
}
|
||||
/* Trace du point final */
|
||||
|
||||
newedge = new EDGE_MODULE(Module);
|
||||
newedge->Copy(PtSegm);
|
||||
newedge->AddToChain(PtSegm);
|
||||
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);
|
||||
newedge->AddToChain(PtSegm);
|
||||
PtSegm = newedge;
|
||||
PtSegm->m_Start = PtSegm->m_End;
|
||||
PtSegm->m_End.x += lextbrin;
|
||||
}
|
||||
newedge = new EDGE_MODULE(Module);
|
||||
newedge->Copy(PtSegm);
|
||||
newedge->AddToChain(PtSegm);
|
||||
PtSegm = newedge;
|
||||
PtSegm->m_Start = PtSegm->m_End;
|
||||
PtSegm = gen_arc(PtSegm, PtSegm->m_End.x, PtSegm->m_End.y + Mself.rayon, -900);
|
||||
}
|
||||
if( ii & 1 ) /* brin final de sens > 0 */
|
||||
{
|
||||
if( lextbrin )
|
||||
{
|
||||
newedge = new EDGE_MODULE( Module );
|
||||
newedge->Copy( PtSegm );
|
||||
newedge->AddToChain( PtSegm );
|
||||
PtSegm = newedge;
|
||||
PtSegm->m_Start = PtSegm->m_End;
|
||||
PtSegm->m_End.x -= lextbrin;
|
||||
}
|
||||
|
||||
newedge = new EDGE_MODULE(Module);
|
||||
newedge->Copy(PtSegm);
|
||||
newedge->AddToChain(PtSegm);
|
||||
PtSegm = newedge;
|
||||
PtSegm->m_Start = PtSegm->m_End;
|
||||
PtSegm->m_End = Mself.m_End;
|
||||
PtSegm->Pnext = NULL;
|
||||
newedge = new EDGE_MODULE( Module );
|
||||
newedge->Copy( PtSegm );
|
||||
newedge->AddToChain( PtSegm );
|
||||
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 );
|
||||
newedge->AddToChain( PtSegm );
|
||||
PtSegm = newedge;
|
||||
PtSegm->m_Start = PtSegm->m_End;
|
||||
PtSegm->m_End.x += lextbrin;
|
||||
}
|
||||
newedge = new EDGE_MODULE( Module );
|
||||
newedge->Copy( PtSegm );
|
||||
newedge->AddToChain( PtSegm );
|
||||
PtSegm = newedge;
|
||||
PtSegm->m_Start = PtSegm->m_End;
|
||||
PtSegm = gen_arc( PtSegm, PtSegm->m_End.x, PtSegm->m_End.y + Mself.rayon, -900 );
|
||||
}
|
||||
|
||||
/* 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->Pnext )
|
||||
{
|
||||
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 );
|
||||
}
|
||||
}
|
||||
newedge = new EDGE_MODULE( Module );
|
||||
newedge->Copy( PtSegm );
|
||||
newedge->AddToChain( PtSegm );
|
||||
PtSegm = newedge;
|
||||
PtSegm->m_Start = PtSegm->m_End;
|
||||
PtSegm->m_End = Mself.m_End;
|
||||
PtSegm->Pnext = NULL;
|
||||
|
||||
/* Modif position ancre */
|
||||
Module->m_Pos.x = LastSegm->m_End.x; Module->m_Pos.y = LastSegm->m_End.y;
|
||||
/* 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->Pnext )
|
||||
{
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
/* Placement des 2 pads sur extremite */
|
||||
PtPad = new D_PAD(Module);
|
||||
/* Modif position ancre */
|
||||
Module->m_Pos.x = LastSegm->m_End.x; Module->m_Pos.y = LastSegm->m_End.y;
|
||||
|
||||
Module->m_Pads = PtPad; PtPad->Pback = Module;
|
||||
PtPad->SetPadName( wxT("1") );
|
||||
PtPad->m_Pos.x = LastSegm->m_End.x; PtPad->m_Pos.y = LastSegm->m_End.y;
|
||||
PtPad->m_Pos0.x = PtPad->m_Pos.x - Module->m_Pos.x;
|
||||
PtPad->m_Pos0.y = PtPad->m_Pos.y - Module->m_Pos.y;
|
||||
PtPad->m_Size.x = PtPad->m_Size.y = LastSegm->m_Width;
|
||||
PtPad->m_Masque_Layer = g_TabOneLayerMask[LastSegm->m_Layer];
|
||||
PtPad->m_Attribut = SMD;
|
||||
PtPad->m_PadShape = CIRCLE;
|
||||
PtPad->m_Rayon = PtPad->m_Size.x / 2;
|
||||
/* Placement des 2 pads sur extremite */
|
||||
PtPad = new D_PAD( Module );
|
||||
|
||||
D_PAD * newpad = new D_PAD(Module);
|
||||
newpad->Copy(PtPad);
|
||||
newpad->AddToChain(PtPad);
|
||||
PtPad = newpad;
|
||||
PtPad->SetPadName( wxT("2") );
|
||||
PtPad->m_Pos.x = FirstSegm->m_Start.x; PtPad->m_Pos.y = FirstSegm->m_Start.y;
|
||||
PtPad->m_Pos0.x = PtPad->m_Pos.x - Module->m_Pos.x;
|
||||
PtPad->m_Pos0.y = PtPad->m_Pos.y - Module->m_Pos.y;
|
||||
Module->m_Pads = PtPad; PtPad->Pback = Module;
|
||||
PtPad->SetPadName( wxT( "1" ) );
|
||||
PtPad->m_Pos.x = LastSegm->m_End.x; PtPad->m_Pos.y = LastSegm->m_End.y;
|
||||
PtPad->m_Pos0.x = PtPad->m_Pos.x - Module->m_Pos.x;
|
||||
PtPad->m_Pos0.y = PtPad->m_Pos.y - Module->m_Pos.y;
|
||||
PtPad->m_Size.x = PtPad->m_Size.y = LastSegm->m_Width;
|
||||
PtPad->m_Masque_Layer = g_TabOneLayerMask[LastSegm->m_Layer];
|
||||
PtPad->m_Attribut = SMD;
|
||||
PtPad->m_PadShape = CIRCLE;
|
||||
PtPad->m_Rayon = PtPad->m_Size.x / 2;
|
||||
|
||||
/* 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 ;
|
||||
D_PAD* newpad = new D_PAD( Module );
|
||||
newpad->Copy( PtPad );
|
||||
newpad->AddToChain( PtPad );
|
||||
PtPad = newpad;
|
||||
PtPad->SetPadName( wxT( "2" ) );
|
||||
PtPad->m_Pos.x = FirstSegm->m_Start.x; PtPad->m_Pos.y = FirstSegm->m_Start.y;
|
||||
PtPad->m_Pos0.x = PtPad->m_Pos.x - Module->m_Pos.x;
|
||||
PtPad->m_Pos0.y = PtPad->m_Pos.y - Module->m_Pos.y;
|
||||
|
||||
Module->m_Reference->m_Pos.y -= Module->m_Reference->m_Size.y;
|
||||
Module->m_Value->m_Pos.y += Module->m_Value->m_Size.y;
|
||||
/* 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_Pos0.x = Module->m_Reference->m_Pos.x - Module->m_Pos.x;
|
||||
Module->m_Reference->m_Pos0.y = Module->m_Reference->m_Pos.y - Module->m_Pos.y;
|
||||
Module->m_Value->m_Pos0.x = Module->m_Value->m_Pos.x - Module->m_Pos.x;
|
||||
Module->m_Value->m_Pos0.y = Module->m_Value->m_Pos.y - Module->m_Pos.y;
|
||||
Module->m_Reference->m_Pos.y -= Module->m_Reference->m_Size.y;
|
||||
Module->m_Value->m_Pos.y += Module->m_Value->m_Size.y;
|
||||
|
||||
/* Init des Coord locales des segments */
|
||||
for( PtSegm = FirstSegm; PtSegm != NULL; PtSegm = (EDGE_MODULE*) PtSegm->Pnext )
|
||||
{
|
||||
PtSegm->m_Start0.x = PtSegm->m_Start.x - Module->m_Pos.x;
|
||||
PtSegm->m_Start0.y = PtSegm->m_Start.y - Module->m_Pos.y;
|
||||
PtSegm->m_End0.x = PtSegm->m_End.x - Module->m_Pos.x;
|
||||
PtSegm->m_End0.y = PtSegm->m_End.y - Module->m_Pos.y;
|
||||
}
|
||||
Module->m_Reference->m_Pos0.x = Module->m_Reference->m_Pos.x - Module->m_Pos.x;
|
||||
Module->m_Reference->m_Pos0.y = Module->m_Reference->m_Pos.y - Module->m_Pos.y;
|
||||
Module->m_Value->m_Pos0.x = Module->m_Value->m_Pos.x - Module->m_Pos.x;
|
||||
Module->m_Value->m_Pos0.y = Module->m_Value->m_Pos.y - Module->m_Pos.y;
|
||||
|
||||
Module->Set_Rectangle_Encadrement();
|
||||
/* Init des Coord locales des segments */
|
||||
for( PtSegm = FirstSegm; PtSegm != NULL; PtSegm = (EDGE_MODULE*) PtSegm->Pnext )
|
||||
{
|
||||
PtSegm->m_Start0.x = PtSegm->m_Start.x - Module->m_Pos.x;
|
||||
PtSegm->m_Start0.y = PtSegm->m_Start.y - Module->m_Pos.y;
|
||||
PtSegm->m_End0.x = PtSegm->m_End.x - Module->m_Pos.x;
|
||||
PtSegm->m_End0.y = PtSegm->m_End.y - Module->m_Pos.y;
|
||||
}
|
||||
|
||||
Module->Draw(DrawPanel, DC, wxPoint(0,0), GR_OR);
|
||||
Module->Set_Rectangle_Encadrement();
|
||||
|
||||
return Module;
|
||||
Module->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
|
||||
|
||||
return Module;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
static EDGE_MODULE * gen_arc(EDGE_MODULE * PtSegm, int cX, int cY, int angle)
|
||||
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
|
||||
*/
|
||||
* 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;
|
||||
float alpha, beta, fsin, fcos;
|
||||
int x0, xr0, y0, yr0;
|
||||
EDGE_MODULE * newedge;
|
||||
int ii, nb_seg;
|
||||
float 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;
|
||||
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 = ( (float)angle * 3.14159 / 1800 ) / nb_seg;
|
||||
nb_seg = ( abs( angle ) ) / 225; if( nb_seg == 0 )
|
||||
nb_seg = 1;
|
||||
alpha = ( (float) 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->m_Parent = PtSegm->m_Parent;
|
||||
newedge->AddToChain(PtSegm);
|
||||
PtSegm = newedge;
|
||||
PtSegm->m_Start.x = PtSegm->m_End.x; PtSegm->m_Start.y = PtSegm->m_End.y;
|
||||
}
|
||||
for( ii = 1; ii <= nb_seg; ii++ )
|
||||
{
|
||||
if( ii > 1 )
|
||||
{
|
||||
newedge = new EDGE_MODULE( (MODULE*) NULL );
|
||||
newedge->Copy( PtSegm );
|
||||
newedge->m_Parent = PtSegm->m_Parent;
|
||||
newedge->AddToChain( PtSegm );
|
||||
PtSegm = newedge;
|
||||
PtSegm->m_Start.x = PtSegm->m_End.x; PtSegm->m_Start.y = PtSegm->m_End.y;
|
||||
}
|
||||
|
||||
beta = (alpha * ii);
|
||||
fcos = cos(beta); fsin = sin(beta);
|
||||
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 );
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
/* fonctions locales */
|
||||
EDA_BaseStruct* Locate_MirePcb( EDA_BaseStruct* PtStruct, int LayerSearch, int typeloc );
|
||||
D_PAD* Locate_Any_Pad( BOARD* Pcb, const wxPoint& ref_pos, bool OnlyCurrentLayer );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -390,10 +391,10 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int LayerSearch, int typeloc )
|
|||
}
|
||||
|
||||
|
||||
/*************************************************/
|
||||
/* D_PAD * Locate_Any_Pad(int typeloc, bool OnlyCurrentLayer) */
|
||||
/* D_PAD* Locate_Any_Pad(int ref_pos, bool OnlyCurrentLayer) */
|
||||
/*************************************************/
|
||||
/*************************************************
|
||||
* D_PAD * Locate_Any_Pad(int typeloc, bool OnlyCurrentLayer)
|
||||
* D_PAD* Locate_Any_Pad(int ref_pos, bool OnlyCurrentLayer)
|
||||
*************************************************/
|
||||
|
||||
/*
|
||||
* localisation de la pastille pointee par la coordonnee ref_pos.x,,ref_pos.y, ou
|
||||
|
|
1085
pcbnew/modules.cpp
1085
pcbnew/modules.cpp
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,4 @@
|
|||
/* Set up the basic primitives for Layer control */
|
||||
/* Set up the basic primitives for Layer control */
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
|
@ -14,11 +14,12 @@
|
|||
/* Fonctions locales: */
|
||||
|
||||
enum layer_sel_id {
|
||||
ID_LAYER_OK = 1800,
|
||||
ID_LAYER_CANCEL,
|
||||
ID_LAYER_SELECT_TOP,
|
||||
ID_LAYER_SELECT_BOTTOM,
|
||||
ID_LAYER_SELECT
|
||||
ID_LAYER_OK = 1800,
|
||||
ID_LAYER_CANCEL,
|
||||
ID_LAYER_SELECT_TOP,
|
||||
ID_LAYER_SELECT_BOTTOM,
|
||||
ID_LAYER_SELECT
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -26,122 +27,136 @@ enum layer_sel_id {
|
|||
/* classe pour la frame de selection de layers */
|
||||
/***********************************************/
|
||||
|
||||
class WinEDA_SelLayerFrame: public wxDialog
|
||||
class WinEDA_SelLayerFrame : public wxDialog
|
||||
{
|
||||
private:
|
||||
WinEDA_BasePcbFrame *m_Parent;
|
||||
wxRadioBox * m_LayerList;
|
||||
int m_LayerId[NB_LAYERS];
|
||||
WinEDA_BasePcbFrame* m_Parent;
|
||||
wxRadioBox* m_LayerList;
|
||||
int m_LayerId[NB_LAYERS];
|
||||
|
||||
public:
|
||||
// Constructor and destructor
|
||||
WinEDA_SelLayerFrame(WinEDA_BasePcbFrame *parent, int default_layer,
|
||||
int min_layer, int max_layer);
|
||||
~WinEDA_SelLayerFrame(void) {};
|
||||
|
||||
// Constructor and destructor
|
||||
WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent, int default_layer,
|
||||
int min_layer, int max_layer );
|
||||
~WinEDA_SelLayerFrame( void ) { };
|
||||
|
||||
private:
|
||||
void Sel_Layer(wxCommandEvent& event);
|
||||
void Cancel(wxCommandEvent& event);
|
||||
DECLARE_EVENT_TABLE()
|
||||
void Sel_Layer( wxCommandEvent& event );
|
||||
void Cancel( wxCommandEvent& event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
/* Table des evenements pour WinEDA_SelLayerFrame */
|
||||
BEGIN_EVENT_TABLE(WinEDA_SelLayerFrame, wxDialog)
|
||||
EVT_BUTTON(ID_LAYER_OK, WinEDA_SelLayerFrame::Sel_Layer)
|
||||
EVT_BUTTON(ID_LAYER_CANCEL, WinEDA_SelLayerFrame::Cancel)
|
||||
EVT_RADIOBOX(ID_LAYER_SELECT, WinEDA_SelLayerFrame::Sel_Layer)
|
||||
BEGIN_EVENT_TABLE( WinEDA_SelLayerFrame, wxDialog )
|
||||
EVT_BUTTON( ID_LAYER_OK, WinEDA_SelLayerFrame::Sel_Layer )
|
||||
EVT_BUTTON( ID_LAYER_CANCEL, WinEDA_SelLayerFrame::Cancel )
|
||||
EVT_RADIOBOX( ID_LAYER_SELECT, WinEDA_SelLayerFrame::Sel_Layer )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
/***********************************************************************************/
|
||||
int WinEDA_BasePcbFrame::SelectLayer(int default_layer, int min_layer, int max_layer)
|
||||
int WinEDA_BasePcbFrame::SelectLayer( int default_layer, int min_layer, int max_layer )
|
||||
/***********************************************************************************/
|
||||
|
||||
/* Install the dialog box for layer selection
|
||||
default_layer = Preselection
|
||||
min_layer = val min de layer selectionnable (-1 si pas de val mini)
|
||||
max_layer = val max de layer selectionnable (-1 si pas de val maxi)
|
||||
*/
|
||||
* default_layer = Preselection
|
||||
* min_layer = val min de layer selectionnable (-1 si pas de val mini)
|
||||
* max_layer = val max de layer selectionnable (-1 si pas de val maxi)
|
||||
*/
|
||||
{
|
||||
int layer;
|
||||
WinEDA_SelLayerFrame * frame =
|
||||
new WinEDA_SelLayerFrame(this, default_layer,min_layer, max_layer);
|
||||
layer = frame->ShowModal(); frame->Destroy();
|
||||
return layer;
|
||||
int layer;
|
||||
WinEDA_SelLayerFrame* frame =
|
||||
new WinEDA_SelLayerFrame( this, default_layer, min_layer, max_layer );
|
||||
|
||||
layer = frame->ShowModal(); frame->Destroy();
|
||||
return layer;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
WinEDA_SelLayerFrame::WinEDA_SelLayerFrame(WinEDA_BasePcbFrame *parent,
|
||||
int default_layer, int min_layer, int max_layer):
|
||||
wxDialog(parent, -1, _("Select Layer:"),wxPoint(-1,-1),
|
||||
wxSize(470, 250),
|
||||
DIALOG_STYLE )
|
||||
WinEDA_SelLayerFrame::WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent,
|
||||
int default_layer, int min_layer, int max_layer ) :
|
||||
wxDialog( parent, -1, _( "Select Layer:" ), wxPoint( -1, -1 ),
|
||||
wxSize( 470, 250 ),
|
||||
DIALOG_STYLE )
|
||||
/***********************************************************************/
|
||||
{
|
||||
wxButton * Button;
|
||||
int ii, yy, xx;
|
||||
wxPoint pos;
|
||||
wxString LayerList[NB_LAYERS];
|
||||
int LayerCount, LayerSelect = -1;
|
||||
wxButton* Button;
|
||||
int ii, yy, xx;
|
||||
wxPoint pos;
|
||||
wxString LayerList[NB_LAYERS];
|
||||
int LayerCount, LayerSelect = -1;
|
||||
|
||||
m_Parent = parent;
|
||||
SetFont(*g_DialogFont);
|
||||
m_Parent = parent;
|
||||
SetFont( *g_DialogFont );
|
||||
|
||||
/* Construction de la liste des couches autorisées */
|
||||
LayerCount = 0;
|
||||
int Masque_Layer = g_TabAllCopperLayerMask[g_DesignSettings.m_CopperLayerCount-1];
|
||||
Masque_Layer += ALL_NO_CU_LAYERS;
|
||||
for ( ii = 0; ii < NB_LAYERS ; ii ++ )
|
||||
{
|
||||
m_LayerId[ii] = 0;
|
||||
if ( (g_TabOneLayerMask[ii] & Masque_Layer) )
|
||||
{
|
||||
if ( min_layer > ii ) continue;
|
||||
if ( (max_layer >= 0) && (max_layer < ii) ) break;
|
||||
LayerList[LayerCount] = ReturnPcbLayerName(ii);
|
||||
if ( ii == default_layer ) LayerSelect = LayerCount;
|
||||
m_LayerId[LayerCount] = ii;
|
||||
LayerCount++;
|
||||
}
|
||||
}
|
||||
/* Construction de la liste des couches autoris<69>s */
|
||||
LayerCount = 0;
|
||||
int Masque_Layer = g_TabAllCopperLayerMask[g_DesignSettings.m_CopperLayerCount - 1];
|
||||
Masque_Layer += ALL_NO_CU_LAYERS;
|
||||
for( ii = 0; ii < NB_LAYERS; ii++ )
|
||||
{
|
||||
m_LayerId[ii] = 0;
|
||||
if( (g_TabOneLayerMask[ii] & Masque_Layer) )
|
||||
{
|
||||
if( min_layer > ii )
|
||||
continue;
|
||||
|
||||
if( (max_layer >= 0) && (max_layer < ii) )
|
||||
break;
|
||||
|
||||
LayerList[LayerCount] = ReturnPcbLayerName( ii );
|
||||
if( ii == default_layer )
|
||||
LayerSelect = LayerCount;
|
||||
|
||||
m_LayerId[LayerCount] = ii;
|
||||
LayerCount++;
|
||||
}
|
||||
}
|
||||
|
||||
pos.x = 5; pos.y = 5;
|
||||
pos.x = 5; pos.y = 5;
|
||||
|
||||
m_LayerList = new wxRadioBox(this, ID_LAYER_SELECT, _("Layer"),
|
||||
pos, wxSize(-1,-1), LayerCount, LayerList,
|
||||
(LayerCount < 8) ? LayerCount : 8, wxRA_SPECIFY_ROWS);
|
||||
m_LayerList = new wxRadioBox( this, ID_LAYER_SELECT, _( "Layer" ),
|
||||
pos, wxSize( -1, -1 ), LayerCount, LayerList,
|
||||
(LayerCount < 8) ? LayerCount : 8, wxRA_SPECIFY_ROWS );
|
||||
|
||||
if ( LayerSelect >= 0 ) m_LayerList->SetSelection(LayerSelect);
|
||||
if( LayerSelect >= 0 )
|
||||
m_LayerList->SetSelection( LayerSelect );
|
||||
|
||||
m_LayerList->GetSize(&xx, &yy);
|
||||
pos.x += xx + 12;
|
||||
Button = new wxButton(this,ID_LAYER_OK,
|
||||
_("OK"), pos);
|
||||
Button->SetForegroundColour(*wxBLUE);
|
||||
m_LayerList->GetSize( &xx, &yy );
|
||||
pos.x += xx + 12;
|
||||
Button = new wxButton( this, ID_LAYER_OK,
|
||||
_( "OK" ), pos );
|
||||
Button->SetForegroundColour( *wxBLUE );
|
||||
|
||||
pos.y += Button->GetSize().y + 5;
|
||||
Button = new wxButton(this,ID_LAYER_CANCEL,
|
||||
_("Cancel"), pos);
|
||||
Button->SetForegroundColour(*wxRED);
|
||||
pos.y += Button->GetSize().y + 5;
|
||||
Button = new wxButton( this, ID_LAYER_CANCEL,
|
||||
_( "Cancel" ), pos );
|
||||
Button->SetForegroundColour( *wxRED );
|
||||
|
||||
/* Redimensionnement de la boite de dialogue: */
|
||||
pos.x += Button->GetSize().x + 10;
|
||||
SetSize(-1, -1, pos.x , yy + 35);
|
||||
pos.x += Button->GetSize().x + 10;
|
||||
SetSize( -1, -1, pos.x, yy + 35 );
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
void WinEDA_SelLayerFrame::Sel_Layer(wxCommandEvent& event)
|
||||
void WinEDA_SelLayerFrame::Sel_Layer( wxCommandEvent& event )
|
||||
/***************************************************************/
|
||||
{
|
||||
int ii = m_LayerId[m_LayerList->GetSelection()];
|
||||
EndModal(ii);
|
||||
int ii = m_LayerId[m_LayerList->GetSelection()];
|
||||
|
||||
EndModal( ii );
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
void WinEDA_SelLayerFrame::Cancel(wxCommandEvent& event)
|
||||
void WinEDA_SelLayerFrame::Cancel( wxCommandEvent& event )
|
||||
/***************************************************************/
|
||||
{
|
||||
EndModal(-1);
|
||||
EndModal( -1 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -149,129 +164,130 @@ void WinEDA_SelLayerFrame::Cancel(wxCommandEvent& event)
|
|||
/* classe pour la frame de selection de paires de layers */
|
||||
/*********************************************************/
|
||||
|
||||
class WinEDA_SelLayerPairFrame: public wxDialog
|
||||
class WinEDA_SelLayerPairFrame : public wxDialog
|
||||
{
|
||||
private:
|
||||
WinEDA_BasePcbFrame *m_Parent;
|
||||
wxRadioBox * m_LayerListTOP;
|
||||
wxRadioBox * m_LayerListBOTTOM;
|
||||
int m_LayerId[NB_COPPER_LAYERS];
|
||||
WinEDA_BasePcbFrame* m_Parent;
|
||||
wxRadioBox* m_LayerListTOP;
|
||||
wxRadioBox* m_LayerListBOTTOM;
|
||||
int m_LayerId[NB_COPPER_LAYERS];
|
||||
|
||||
public:
|
||||
|
||||
// Constructor and destructor
|
||||
WinEDA_SelLayerPairFrame(WinEDA_BasePcbFrame *parent);
|
||||
~WinEDA_SelLayerPairFrame(void) {};
|
||||
// Constructor and destructor
|
||||
WinEDA_SelLayerPairFrame( WinEDA_BasePcbFrame* parent );
|
||||
~WinEDA_SelLayerPairFrame( void ) { };
|
||||
|
||||
private:
|
||||
void Sel_Layer(wxCommandEvent& event);
|
||||
void Cancel(wxCommandEvent& event);
|
||||
DECLARE_EVENT_TABLE()
|
||||
void Sel_Layer( wxCommandEvent& event );
|
||||
void Cancel( wxCommandEvent& event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
/* Table des evenements pour WinEDA_SelLayerPairFrame */
|
||||
BEGIN_EVENT_TABLE(WinEDA_SelLayerPairFrame, wxDialog)
|
||||
EVT_BUTTON(ID_LAYER_OK, WinEDA_SelLayerPairFrame::Sel_Layer)
|
||||
EVT_BUTTON(ID_LAYER_CANCEL, WinEDA_SelLayerPairFrame::Cancel)
|
||||
EVT_RADIOBOX(ID_LAYER_SELECT, WinEDA_SelLayerPairFrame::Sel_Layer)
|
||||
BEGIN_EVENT_TABLE( WinEDA_SelLayerPairFrame, wxDialog )
|
||||
EVT_BUTTON( ID_LAYER_OK, WinEDA_SelLayerPairFrame::Sel_Layer )
|
||||
EVT_BUTTON( ID_LAYER_CANCEL, WinEDA_SelLayerPairFrame::Cancel )
|
||||
EVT_RADIOBOX( ID_LAYER_SELECT, WinEDA_SelLayerPairFrame::Sel_Layer )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
/***********************************************/
|
||||
void WinEDA_BasePcbFrame::SelectLayerPair(void)
|
||||
void WinEDA_BasePcbFrame::SelectLayerPair( void )
|
||||
/***********************************************/
|
||||
|
||||
/* Affiche une double liste de layers cuivre pour selection d'une paire de layers
|
||||
pour autorutage, vias...
|
||||
*/
|
||||
* pour autorutage, vias...
|
||||
*/
|
||||
{
|
||||
WinEDA_SelLayerPairFrame * frame =
|
||||
new WinEDA_SelLayerPairFrame(this);
|
||||
frame->ShowModal(); frame->Destroy();
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
SetToolbars();
|
||||
WinEDA_SelLayerPairFrame* frame =
|
||||
new WinEDA_SelLayerPairFrame( this );
|
||||
|
||||
frame->ShowModal(); frame->Destroy();
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
SetToolbars();
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************/
|
||||
WinEDA_SelLayerPairFrame::WinEDA_SelLayerPairFrame(WinEDA_BasePcbFrame *parent):
|
||||
wxDialog(parent, -1, _("Select Layer Pair:"),wxPoint(-1,-1),
|
||||
wxSize(470, 250), DIALOG_STYLE )
|
||||
WinEDA_SelLayerPairFrame::WinEDA_SelLayerPairFrame( WinEDA_BasePcbFrame* parent ) :
|
||||
wxDialog( parent, -1, _( "Select Layer Pair:" ), wxPoint( -1, -1 ),
|
||||
wxSize( 470, 250 ), DIALOG_STYLE )
|
||||
/*******************************************************************************/
|
||||
{
|
||||
wxButton * Button;
|
||||
int ii, LayerCount;
|
||||
int yy, xx;
|
||||
wxPoint pos;
|
||||
wxString LayerList[NB_COPPER_LAYERS];
|
||||
int LayerTopSelect = 0, LayerBottomSelect = 0 ;
|
||||
wxButton* Button;
|
||||
int ii, LayerCount;
|
||||
int yy, xx;
|
||||
wxPoint pos;
|
||||
wxString LayerList[NB_COPPER_LAYERS];
|
||||
int LayerTopSelect = 0, LayerBottomSelect = 0;
|
||||
|
||||
m_Parent = parent;
|
||||
SetFont(*g_DialogFont);
|
||||
m_Parent = parent;
|
||||
SetFont( *g_DialogFont );
|
||||
|
||||
PCB_SCREEN * screen = (PCB_SCREEN *) m_Parent->m_CurrentScreen;
|
||||
/* Construction de la liste des couches autorisées */
|
||||
int Masque_Layer = g_TabAllCopperLayerMask[g_DesignSettings.m_CopperLayerCount-1];
|
||||
Masque_Layer += ALL_NO_CU_LAYERS;
|
||||
for ( ii = 0, LayerCount = 0; ii < NB_COPPER_LAYERS ; ii ++ )
|
||||
{
|
||||
m_LayerId[ii] = 0;
|
||||
if ( (g_TabOneLayerMask[ii] & Masque_Layer) )
|
||||
{
|
||||
LayerList[LayerCount] = ReturnPcbLayerName(ii);
|
||||
if ( ii == screen->m_Route_Layer_TOP )
|
||||
LayerTopSelect = LayerCount;
|
||||
if ( ii == screen->m_Route_Layer_BOTTOM )
|
||||
LayerBottomSelect = LayerCount;
|
||||
m_LayerId[LayerCount] = ii;
|
||||
LayerCount++;
|
||||
}
|
||||
}
|
||||
PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->m_CurrentScreen;
|
||||
/* Construction de la liste des couches autoris<69>s */
|
||||
int Masque_Layer = g_TabAllCopperLayerMask[g_DesignSettings.m_CopperLayerCount - 1];
|
||||
Masque_Layer += ALL_NO_CU_LAYERS;
|
||||
for( ii = 0, LayerCount = 0; ii < NB_COPPER_LAYERS; ii++ )
|
||||
{
|
||||
m_LayerId[ii] = 0;
|
||||
if( (g_TabOneLayerMask[ii] & Masque_Layer) )
|
||||
{
|
||||
LayerList[LayerCount] = ReturnPcbLayerName( ii );
|
||||
if( ii == screen->m_Route_Layer_TOP )
|
||||
LayerTopSelect = LayerCount;
|
||||
if( ii == screen->m_Route_Layer_BOTTOM )
|
||||
LayerBottomSelect = LayerCount;
|
||||
m_LayerId[LayerCount] = ii;
|
||||
LayerCount++;
|
||||
}
|
||||
}
|
||||
|
||||
pos.x = 5; pos.y = 5;
|
||||
m_LayerListTOP = new wxRadioBox(this, ID_LAYER_SELECT_TOP, _("Top Layer"),
|
||||
pos, wxSize(-1,-1), LayerCount, LayerList,
|
||||
(LayerCount < 8) ? LayerCount : 8, wxRA_SPECIFY_ROWS);
|
||||
m_LayerListTOP->SetSelection(LayerTopSelect);
|
||||
pos.x = 5; pos.y = 5;
|
||||
m_LayerListTOP = new wxRadioBox( this, ID_LAYER_SELECT_TOP, _( "Top Layer" ),
|
||||
pos, wxSize( -1, -1 ), LayerCount, LayerList,
|
||||
(LayerCount < 8) ? LayerCount : 8, wxRA_SPECIFY_ROWS );
|
||||
m_LayerListTOP->SetSelection( LayerTopSelect );
|
||||
|
||||
m_LayerListTOP->GetSize(&xx, &yy);
|
||||
pos.x += xx + 12;
|
||||
m_LayerListBOTTOM = new wxRadioBox(this, ID_LAYER_SELECT_BOTTOM, _("Bottom Layer"),
|
||||
pos, wxSize(-1,-1), LayerCount, LayerList,
|
||||
(LayerCount < 8) ? LayerCount : 8, wxRA_SPECIFY_ROWS);
|
||||
m_LayerListBOTTOM->SetSelection(LayerBottomSelect);
|
||||
m_LayerListTOP->GetSize( &xx, &yy );
|
||||
pos.x += xx + 12;
|
||||
m_LayerListBOTTOM = new wxRadioBox( this, ID_LAYER_SELECT_BOTTOM, _( "Bottom Layer" ),
|
||||
pos, wxSize( -1, -1 ), LayerCount, LayerList,
|
||||
(LayerCount < 8) ? LayerCount : 8, wxRA_SPECIFY_ROWS );
|
||||
m_LayerListBOTTOM->SetSelection( LayerBottomSelect );
|
||||
|
||||
m_LayerListBOTTOM->GetSize(&xx, &yy);
|
||||
pos.x += xx + 12;
|
||||
Button = new wxButton(this,ID_LAYER_OK,
|
||||
_("OK"), pos);
|
||||
Button->SetForegroundColour(*wxBLUE);
|
||||
m_LayerListBOTTOM->GetSize( &xx, &yy );
|
||||
pos.x += xx + 12;
|
||||
Button = new wxButton( this, ID_LAYER_OK, _( "OK" ), pos );
|
||||
Button->SetForegroundColour( *wxBLUE );
|
||||
|
||||
pos.y += Button->GetSize().y + 5;
|
||||
Button = new wxButton(this,ID_LAYER_CANCEL,
|
||||
_("Cancel"), pos);
|
||||
Button->SetForegroundColour(*wxRED);
|
||||
pos.y += Button->GetSize().y + 5;
|
||||
Button = new wxButton( this, ID_LAYER_CANCEL, _( "Cancel" ), pos );
|
||||
Button->SetForegroundColour( *wxRED );
|
||||
|
||||
/* Redimensionnement de la boite de dialogue: */
|
||||
pos.x += Button->GetSize().x + 10;
|
||||
SetSize(-1, -1, pos.x , yy + 35);
|
||||
pos.x += Button->GetSize().x + 10;
|
||||
SetSize( -1, -1, pos.x, yy + 35 );
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
void WinEDA_SelLayerPairFrame::Sel_Layer(wxCommandEvent& event)
|
||||
void WinEDA_SelLayerPairFrame::Sel_Layer( wxCommandEvent& event )
|
||||
/***************************************************************/
|
||||
{
|
||||
PCB_SCREEN * screen = (PCB_SCREEN *) m_Parent->m_CurrentScreen;
|
||||
PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->m_CurrentScreen;
|
||||
|
||||
screen->m_Route_Layer_TOP = m_LayerId[m_LayerListTOP->GetSelection()];
|
||||
screen->m_Route_Layer_BOTTOM = m_LayerId[m_LayerListBOTTOM->GetSelection()];
|
||||
EndModal(0);
|
||||
screen->m_Route_Layer_TOP = m_LayerId[m_LayerListTOP->GetSelection()];
|
||||
screen->m_Route_Layer_BOTTOM = m_LayerId[m_LayerListBOTTOM->GetSelection()];
|
||||
EndModal( 0 );
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
void WinEDA_SelLayerPairFrame::Cancel(wxCommandEvent& event)
|
||||
void WinEDA_SelLayerPairFrame::Cancel( wxCommandEvent& event )
|
||||
/***************************************************************/
|
||||
{
|
||||
EndModal(-1);
|
||||
EndModal( -1 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************/
|
||||
/* affichage des empreintes */
|
||||
/****************************/
|
||||
/****************************/
|
||||
/* affichage des empreintes */
|
||||
/****************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
|
@ -12,160 +12,171 @@
|
|||
|
||||
#define Pad_fill (Pad_Fill_Item.State == RUN)
|
||||
|
||||
static void Pad_Surbrillance(WinEDA_DrawPanel * panel, wxDC * DC, MODULE * Module, int NetCode);
|
||||
static void Pad_Surbrillance( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module, int NetCode );
|
||||
|
||||
/* variables locales : */
|
||||
static int draw_mode ;
|
||||
static int draw_mode;
|
||||
|
||||
|
||||
/*********************************************************/
|
||||
void WinEDA_PcbFrame::Liste_Equipot(wxCommandEvent & event)
|
||||
void WinEDA_PcbFrame::Liste_Equipot( wxCommandEvent& event )
|
||||
/*********************************************************/
|
||||
|
||||
/* Display a filtered list of equipot names
|
||||
if an equipot is selected the corresponding tracks and pads are highlighted
|
||||
*/
|
||||
* if an equipot is selected the corresponding tracks and pads are highlighted
|
||||
*/
|
||||
{
|
||||
EQUIPOT * Equipot ;
|
||||
wxString msg;
|
||||
WinEDA_TextFrame * List;
|
||||
int ii, jj;
|
||||
EQUIPOT* Equipot;
|
||||
wxString msg;
|
||||
WinEDA_TextFrame* List;
|
||||
int ii, jj;
|
||||
|
||||
msg = wxT("*");
|
||||
Get_Message(_("Filter for net names:"),msg, this);
|
||||
if ( msg.IsEmpty() ) return;
|
||||
msg = wxT( "*" );
|
||||
Get_Message( _( "Filter for net names:" ), msg, this );
|
||||
if( msg.IsEmpty() )
|
||||
return;
|
||||
|
||||
List = new WinEDA_TextFrame(this, _("List Nets") );
|
||||
List = new WinEDA_TextFrame( this, _( "List Nets" ) );
|
||||
|
||||
Equipot = (EQUIPOT*) m_Pcb->m_Equipots;
|
||||
for ( ; Equipot != NULL; Equipot = (EQUIPOT*)Equipot->Pnext )
|
||||
{
|
||||
wxString Line;
|
||||
/* calcul adr relative du nom de la pastille reference de la piste */
|
||||
if( ! WildCompareString(msg, Equipot->m_Netname, FALSE ) ) continue ;
|
||||
Equipot = (EQUIPOT*) m_Pcb->m_Equipots;
|
||||
for( ; Equipot != NULL; Equipot = (EQUIPOT*) Equipot->Pnext )
|
||||
{
|
||||
wxString Line;
|
||||
/* calcul adr relative du nom de la pastille reference de la piste */
|
||||
if( !WildCompareString( msg, Equipot->m_Netname, FALSE ) )
|
||||
continue;
|
||||
|
||||
Line.Printf( wxT("net_code = %3.3d [%.16s] "),Equipot->m_NetCode,
|
||||
Equipot->m_Netname.GetData());
|
||||
List->Append(Line);
|
||||
}
|
||||
ii = List->ShowModal(); List->Destroy();
|
||||
if (ii < 0) return;
|
||||
Line.Printf( wxT( "net_code = %3.3d [%.16s] " ), Equipot->m_NetCode,
|
||||
Equipot->m_Netname.GetData() );
|
||||
List->Append( Line );
|
||||
}
|
||||
|
||||
/* Recherche du numero de net rellement selectionné */
|
||||
Equipot = (EQUIPOT*) m_Pcb->m_Equipots;
|
||||
for ( jj = 0; Equipot != NULL; Equipot = (EQUIPOT*)Equipot->Pnext )
|
||||
{
|
||||
/* calcul adr relative du nom de la pastille reference de la piste */
|
||||
if( ! WildCompareString(msg, Equipot->m_Netname, FALSE) ) continue ;
|
||||
if ( ii == jj )
|
||||
{
|
||||
ii = Equipot->m_NetCode;
|
||||
break;
|
||||
}
|
||||
jj++;
|
||||
}
|
||||
ii = List->ShowModal(); List->Destroy();
|
||||
if( ii < 0 )
|
||||
return;
|
||||
|
||||
/* Recherche du numero de net rellement selectionn<6E>*/
|
||||
Equipot = (EQUIPOT*) m_Pcb->m_Equipots;
|
||||
for( jj = 0; Equipot != NULL; Equipot = (EQUIPOT*) Equipot->Pnext )
|
||||
{
|
||||
/* calcul adr relative du nom de la pastille reference de la piste */
|
||||
if( !WildCompareString( msg, Equipot->m_Netname, FALSE ) )
|
||||
continue;
|
||||
if( ii == jj )
|
||||
{
|
||||
ii = Equipot->m_NetCode;
|
||||
break;
|
||||
}
|
||||
jj++;
|
||||
}
|
||||
|
||||
wxClientDC dc(DrawPanel);
|
||||
DrawPanel->PrepareGraphicContext(&dc);
|
||||
wxClientDC dc( DrawPanel );
|
||||
|
||||
if(g_HightLigt_Status) Hight_Light(&dc);
|
||||
g_HightLigth_NetCode = ii;
|
||||
Hight_Light(&dc);
|
||||
DrawPanel->PrepareGraphicContext( &dc );
|
||||
|
||||
if( g_HightLigt_Status )
|
||||
Hight_Light( &dc );
|
||||
g_HightLigth_NetCode = ii;
|
||||
Hight_Light( &dc );
|
||||
}
|
||||
|
||||
|
||||
/**************************************************/
|
||||
int WinEDA_PcbFrame::Select_High_Light(wxDC * DC)
|
||||
int WinEDA_PcbFrame::Select_High_Light( wxDC* DC )
|
||||
/**************************************************/
|
||||
|
||||
/* Localise track ou pad et met en surbrillance le net correspondant
|
||||
Retourne le netcode, ou -1 si pas de net localisé */
|
||||
* Retourne le netcode, ou -1 si pas de net localis<EFBFBD>*/
|
||||
{
|
||||
TRACK * pt_piste;
|
||||
D_PAD* pt_pad ;
|
||||
int masquelayer = g_TabOneLayerMask[GetScreen()->m_Active_Layer];
|
||||
int code = -1;
|
||||
TRACK* pt_piste;
|
||||
D_PAD* pt_pad;
|
||||
int masquelayer = g_TabOneLayerMask[GetScreen()->m_Active_Layer];
|
||||
int code = -1;
|
||||
|
||||
if ( g_HightLigt_Status ) Hight_Light(DC);
|
||||
pt_piste = Locate_Pistes(m_Pcb->m_Track, masquelayer, CURSEUR_OFF_GRILLE);
|
||||
if ( pt_piste)
|
||||
{
|
||||
code = g_HightLigth_NetCode = pt_piste->m_NetCode;
|
||||
Hight_Light(DC);
|
||||
}
|
||||
else
|
||||
{
|
||||
pt_pad = Locate_Any_Pad(m_Pcb, CURSEUR_OFF_GRILLE);
|
||||
if( pt_pad != NULL )
|
||||
{
|
||||
code = g_HightLigth_NetCode = pt_pad->m_NetCode ;
|
||||
Hight_Light(DC) ;
|
||||
}
|
||||
}
|
||||
if( g_HightLigt_Status )
|
||||
Hight_Light( DC );
|
||||
pt_piste = Locate_Pistes( m_Pcb->m_Track, masquelayer, CURSEUR_OFF_GRILLE );
|
||||
if( pt_piste )
|
||||
{
|
||||
code = g_HightLigth_NetCode = pt_piste->m_NetCode;
|
||||
Hight_Light( DC );
|
||||
}
|
||||
else
|
||||
{
|
||||
pt_pad = Locate_Any_Pad( m_Pcb, CURSEUR_OFF_GRILLE );
|
||||
if( pt_pad != NULL )
|
||||
{
|
||||
code = g_HightLigth_NetCode = pt_pad->m_NetCode;
|
||||
Hight_Light( DC );
|
||||
}
|
||||
}
|
||||
|
||||
return code;
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************/
|
||||
void WinEDA_PcbFrame::Hight_Light(wxDC * DC)
|
||||
void WinEDA_PcbFrame::Hight_Light( wxDC* DC )
|
||||
/*******************************************/
|
||||
|
||||
/*
|
||||
fonction d'appel de Surbrillance a partir du menu
|
||||
Met ou supprime la surbrillance d'un net pointe par la souris
|
||||
*/
|
||||
* fonction d'appel de Surbrillance a partir du menu
|
||||
* Met ou supprime la surbrillance d'un net pointe par la souris
|
||||
*/
|
||||
{
|
||||
g_HightLigt_Status = !g_HightLigt_Status;
|
||||
DrawHightLight( DC, g_HightLigth_NetCode) ;
|
||||
g_HightLigt_Status = !g_HightLigt_Status;
|
||||
DrawHightLight( DC, g_HightLigth_NetCode );
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
void WinEDA_PcbFrame::DrawHightLight( wxDC* DC, int NetCode )
|
||||
/****************************************************************/
|
||||
|
||||
/****************************************************************/
|
||||
void WinEDA_PcbFrame::DrawHightLight(wxDC * DC, int NetCode)
|
||||
/****************************************************************/
|
||||
/* Turn On or OFF the HightLight for trcak and pads with the netcode "NetCode'
|
||||
*/
|
||||
*/
|
||||
{
|
||||
TRACK * pts ;
|
||||
MODULE * Module;
|
||||
TRACK* pts;
|
||||
MODULE* Module;
|
||||
|
||||
if(g_HightLigt_Status ) draw_mode = GR_SURBRILL | GR_OR;
|
||||
else draw_mode = GR_AND | GR_SURBRILL;
|
||||
if( g_HightLigt_Status )
|
||||
draw_mode = GR_SURBRILL | GR_OR;
|
||||
else
|
||||
draw_mode = GR_AND | GR_SURBRILL;
|
||||
|
||||
Module = m_Pcb->m_Modules;
|
||||
Module = m_Pcb->m_Modules;
|
||||
|
||||
/* Redraw pads */
|
||||
for( ; Module != NULL; Module = (MODULE*) Module->Pnext )
|
||||
{
|
||||
Pad_Surbrillance(DrawPanel, DC, Module, NetCode) ;
|
||||
}
|
||||
/* Redraw pads */
|
||||
for( ; Module != NULL; Module = (MODULE*) Module->Pnext )
|
||||
{
|
||||
Pad_Surbrillance( DrawPanel, DC, Module, NetCode );
|
||||
}
|
||||
|
||||
/* Redraw track and vias: */
|
||||
for ( pts = m_Pcb->m_Track; pts != NULL; pts = (TRACK*) pts->Pnext)
|
||||
{
|
||||
if( pts->m_NetCode == NetCode )
|
||||
{
|
||||
pts->Draw(DrawPanel, DC, draw_mode);
|
||||
}
|
||||
}
|
||||
/* Redraw track and vias: */
|
||||
for( pts = m_Pcb->m_Track; pts != NULL; pts = (TRACK*) pts->Pnext )
|
||||
{
|
||||
if( pts->m_NetCode == NetCode )
|
||||
{
|
||||
pts->Draw( DrawPanel, DC, draw_mode );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************/
|
||||
static void Pad_Surbrillance(WinEDA_DrawPanel * panel,
|
||||
wxDC * DC, MODULE * Module, int NetCode)
|
||||
static void Pad_Surbrillance( WinEDA_DrawPanel* panel,
|
||||
wxDC* DC, MODULE* Module, int NetCode )
|
||||
/*******************************************************/
|
||||
/* Mise en Surbrillance des Pads */
|
||||
{
|
||||
D_PAD * pt_pad ;
|
||||
D_PAD* pt_pad;
|
||||
|
||||
/* trace des pastilles */
|
||||
for(pt_pad = Module->m_Pads; pt_pad != NULL; pt_pad = (D_PAD*)pt_pad->Pnext)
|
||||
{
|
||||
if ( pt_pad->m_NetCode == NetCode )
|
||||
{
|
||||
pt_pad->Draw(panel, DC, wxPoint(0,0),draw_mode);
|
||||
}
|
||||
}
|
||||
/* trace des pastilles */
|
||||
for( pt_pad = Module->m_Pads; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext )
|
||||
{
|
||||
if( pt_pad->m_NetCode == NetCode )
|
||||
{
|
||||
pt_pad->Draw( panel, DC, wxPoint( 0, 0 ), draw_mode );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
|
||||
/* Data to build the layer pair indicator button */
|
||||
static wxBitmap* LayerPairBitmap = NULL;
|
||||
static char s_BitmapLayerIcon[16][16] = {
|
||||
static const char s_BitmapLayerIcon[16][16] = {
|
||||
// 0 = draw pixel with active layer color
|
||||
// 1 = draw pixel with top layer color (top/bottom layer used in autoroute and place via)
|
||||
// 2 = draw pixel with bottom layer color
|
||||
|
|
1925
pcbnew/zones.cpp
1925
pcbnew/zones.cpp
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue