Commit f3cd8f57 authored by dickelbeck's avatar dickelbeck

fixed a bug in "ratsnest on module or pad", and beautification

parent 8bb93b8d
...@@ -138,7 +138,8 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -138,7 +138,8 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
// Save the board after the time out : // Save the board after the time out :
int CurrentTime = time( NULL ); int CurrentTime = time( NULL );
if( !GetScreen()->IsModify() || GetScreen()->IsSave() ) if( !GetScreen()->IsModify() || GetScreen()->IsSave() )
{ /* If no change, reset the time out */ {
/* If no change, reset the time out */
g_SaveTime = CurrentTime; g_SaveTime = CurrentTime;
} }
...@@ -147,7 +148,9 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -147,7 +148,9 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
wxString tmpFileName = GetScreen()->m_FileName; wxString tmpFileName = GetScreen()->m_FileName;
wxString filename = g_SaveFileName + PcbExtBuffer; wxString filename = g_SaveFileName + PcbExtBuffer;
bool flgmodify = GetScreen()->IsModify(); bool flgmodify = GetScreen()->IsModify();
( (WinEDA_PcbFrame*) this )->SavePcbFile( filename ); ( (WinEDA_PcbFrame*) this )->SavePcbFile( filename );
if( flgmodify ) // Set the flags m_Modify cleared by SavePcbFile() if( flgmodify ) // Set the flags m_Modify cleared by SavePcbFile()
{ {
GetScreen()->SetModify(); GetScreen()->SetModify();
...@@ -326,8 +329,8 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -326,8 +329,8 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
GetScreen()->m_Curseur = curpos; GetScreen()->m_Curseur = curpos;
/* Put cursor on grid or a pad centre if requested /* Put cursor on grid or a pad centre if requested
* But if the tool DELETE is active the cursor is left off grid * But if the tool DELETE is active the cursor is left off grid
* this is better to reach items to delete off grid * this is better to reach items to delete off grid
*/ */
D_PAD* pad; D_PAD* pad;
bool keep_on_grid = TRUE; bool keep_on_grid = TRUE;
......
...@@ -126,7 +126,8 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -126,7 +126,8 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_PCB_SHOW_1_RATSNEST_BUTT: case ID_PCB_SHOW_1_RATSNEST_BUTT:
DrawStruct = PcbGeneralLocateAndDisplay(); DrawStruct = PcbGeneralLocateAndDisplay();
Show_1_Ratsnest( DrawStruct, DC ); if( DrawStruct )
Show_1_Ratsnest( DrawStruct, DC );
break; break;
case ID_PCB_MIRE_BUTT: case ID_PCB_MIRE_BUTT:
......
/*******************************/ /*******************************/
/* Edition des pistes */ /* Edition des pistes */
/* Routines de trace de pistes */ /* Routines de trace de pistes */
/*******************************/ /*******************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
...@@ -18,371 +18,410 @@ ...@@ -18,371 +18,410 @@
/* variables locales */ /* variables locales */
/***********************************************/ /***********************************************/
void WinEDA_PcbFrame::DisplayTrackSettings(void) void WinEDA_PcbFrame::DisplayTrackSettings( void )
/***********************************************/ /***********************************************/
/* Display the current track width and via diameter /* Display the current track width and via diameter
*/ */
{ {
wxString msg; wxString msg;
wxString buftrc, bufvia; wxString buftrc, bufvia;
valeur_param(g_DesignSettings.m_CurrentTrackWidth, buftrc); valeur_param( g_DesignSettings.m_CurrentTrackWidth, buftrc );
valeur_param(g_DesignSettings.m_CurrentViaSize, bufvia); valeur_param( g_DesignSettings.m_CurrentViaSize, bufvia );
msg.Printf( _("Track Width: %s Vias Size : %s"), msg.Printf( _( "Track Width: %s Vias Size : %s" ),
buftrc.GetData(), bufvia.GetData()); buftrc.GetData(), bufvia.GetData() );
Affiche_Message( msg); Affiche_Message( msg );
m_SelTrackWidthBox_Changed = TRUE; m_SelTrackWidthBox_Changed = TRUE;
m_SelViaSizeBox_Changed = TRUE; m_SelViaSizeBox_Changed = TRUE;
} }
/***********************************************/ /***********************************************/
void WinEDA_PcbFrame::Ratsnest_On_Off(wxDC * DC) void WinEDA_PcbFrame::Ratsnest_On_Off( wxDC* DC )
/***********************************************/ /***********************************************/
/* Affiche ou efface le chevelu selon l'etat du bouton d'appel */ /* Affiche ou efface le chevelu selon l'etat du bouton d'appel */
{ {
int ii; int ii;
CHEVELU * pt_chevelu; CHEVELU* pt_chevelu;
if((m_Pcb->m_Status_Pcb & LISTE_CHEVELU_OK) == 0 ) if( (m_Pcb->m_Status_Pcb & LISTE_CHEVELU_OK) == 0 )
{ {
if ( g_Show_Ratsnest ) Compile_Ratsnest( DC, TRUE ); if( g_Show_Ratsnest )
return; Compile_Ratsnest( DC, TRUE );
} return;
}
DrawGeneralRatsnest(DC, 0); /* effacement eventuel du chevelu affiche */
DrawGeneralRatsnest( DC, 0 ); /* effacement eventuel du chevelu affiche */
pt_chevelu = m_Pcb->m_Ratsnest;
if ( pt_chevelu == NULL ) return; pt_chevelu = m_Pcb->m_Ratsnest;
if( pt_chevelu == NULL )
if(g_Show_Ratsnest) return;
{
for( ii = m_Pcb->GetNumRatsnests(); ii > 0 ; pt_chevelu++, ii--) if( g_Show_Ratsnest )
{ {
pt_chevelu->status |= CH_VISIBLE; for( ii = m_Pcb->GetNumRatsnests(); ii > 0; pt_chevelu++, ii-- )
} {
DrawGeneralRatsnest(DC, 0); pt_chevelu->status |= CH_VISIBLE;
} }
else DrawGeneralRatsnest( DC, 0 );
{ }
for( ii = m_Pcb->GetNumRatsnests(); ii > 0; pt_chevelu++, ii--) else
{ {
pt_chevelu->status &= ~CH_VISIBLE; for( ii = m_Pcb->GetNumRatsnests(); ii > 0; pt_chevelu++, ii-- )
} {
} pt_chevelu->status &= ~CH_VISIBLE;
}
}
} }
/*************************************************************************/ /*************************************************************************/
void WinEDA_PcbFrame::ExChange_Track_Layer(TRACK *pt_segm, wxDC * DC) void WinEDA_PcbFrame::ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC )
/*************************************************************************/ /*************************************************************************/
/* /*
change de couche la piste pointee par la souris : * change de couche la piste pointee par la souris :
la piste doit etre sur une des couches de travail, * la piste doit etre sur une des couches de travail,
elle est mise sur l'autre couche de travail, si cela est possible * elle est mise sur l'autre couche de travail, si cela est possible
(ou si DRC = Off ). * (ou si DRC = Off ).
*/ */
{ {
int ii; int ii;
TRACK *pt_track; TRACK* pt_track;
int l1, l2 , nb_segm; int l1, l2, nb_segm;
if ( (pt_segm == NULL ) || ( pt_segm->m_StructType == TYPEZONE ) ) if( (pt_segm == NULL ) || ( pt_segm->m_StructType == TYPEZONE ) )
{ {
return; return;
} }
l1 = Route_Layer_TOP; l2 = Route_Layer_BOTTOM; l1 = Route_Layer_TOP; l2 = Route_Layer_BOTTOM;
pt_track = Marque_Une_Piste(this, DC, pt_segm, &nb_segm, GR_XOR); pt_track = Marque_Une_Piste( this, DC, pt_segm, &nb_segm, GR_XOR );
/* effacement du flag BUSY et sauvegarde en membre .param de la couche /* effacement du flag BUSY et sauvegarde en membre .param de la couche
initiale */ * initiale */
ii = nb_segm; pt_segm = pt_track; ii = nb_segm; pt_segm = pt_track;
for (; ii > 0; ii -- , pt_segm = (TRACK*)pt_segm->Pnext) for( ; ii > 0; ii--, pt_segm = (TRACK*) pt_segm->Pnext )
{ {
pt_segm->SetState(BUSY,OFF); pt_segm->SetState( BUSY, OFF );
pt_segm->m_Param = pt_segm->m_Layer; /* pour sauvegarde */ pt_segm->m_Param = pt_segm->m_Layer; /* pour sauvegarde */
} }
ii = 0; pt_segm = pt_track; ii = 0; pt_segm = pt_track;
for ( ; ii < nb_segm; ii++, pt_segm = (TRACK*) pt_segm->Pnext ) for( ; ii < nb_segm; ii++, pt_segm = (TRACK*) pt_segm->Pnext )
{ {
if( pt_segm->m_StructType == TYPEVIA) continue; if( pt_segm->m_StructType == TYPEVIA )
continue;
/* inversion des couches */
if( pt_segm->m_Layer == l1 ) pt_segm->m_Layer = l2 ; /* inversion des couches */
else if(pt_segm->m_Layer == l2 ) pt_segm->m_Layer = l1 ; if( pt_segm->m_Layer == l1 )
pt_segm->m_Layer = l2;
if( (Drc_On) && ( Drc(this, DC,pt_segm,m_Pcb->m_Track,1) == BAD_DRC ) ) else if( pt_segm->m_Layer == l2 )
{ /* Annulation du changement */ pt_segm->m_Layer = l1;
ii = 0; pt_segm = pt_track;
for ( ; ii < nb_segm; ii++, pt_segm = (TRACK*) pt_segm->Pnext ) if( (Drc_On) && ( Drc( this, DC, pt_segm, m_Pcb->m_Track, 1 ) == BAD_DRC ) )
{ { /* Annulation du changement */
pt_segm->m_Layer = pt_segm->m_Param; ii = 0; pt_segm = pt_track;
} for( ; ii < nb_segm; ii++, pt_segm = (TRACK*) pt_segm->Pnext )
Trace_Une_Piste(DrawPanel, DC, pt_track, nb_segm, GR_OR); {
DisplayError(this, _("Drc error, cancelled"), 10); pt_segm->m_Layer = pt_segm->m_Param;
return; }
}
} Trace_Une_Piste( DrawPanel, DC, pt_track, nb_segm, GR_OR );
Trace_Une_Piste(DrawPanel, DC, pt_track, nb_segm, GR_OR | GR_SURBRILL); DisplayError( this, _( "Drc error, cancelled" ), 10 );
/* controle des extremites de segments: sont-ils sur un pad */ return;
ii = 0; pt_segm = pt_track; }
for(; ii < nb_segm; pt_segm = (TRACK*)pt_segm->Pnext, ii++) }
{
pt_segm->start = Locate_Pad_Connecte(m_Pcb, pt_segm, START); Trace_Une_Piste( DrawPanel, DC, pt_track, nb_segm, GR_OR | GR_SURBRILL );
pt_segm->end = Locate_Pad_Connecte(m_Pcb, pt_segm, END); /* controle des extremites de segments: sont-ils sur un pad */
} ii = 0; pt_segm = pt_track;
test_1_net_connexion(DC, pt_track->m_NetCode ); for( ; ii < nb_segm; pt_segm = (TRACK*) pt_segm->Pnext, ii++ )
Affiche_Infos_Piste(this, pt_track) ; {
GetScreen()->SetModify(); pt_segm->start = Locate_Pad_Connecte( m_Pcb, pt_segm, START );
pt_segm->end = Locate_Pad_Connecte( m_Pcb, pt_segm, END );
}
test_1_net_connexion( DC, pt_track->m_NetCode );
Affiche_Infos_Piste( this, pt_track );
GetScreen()->SetModify();
} }
/****************************************************************/ /****************************************************************/
void WinEDA_PcbFrame::Other_Layer_Route(TRACK * track, wxDC * DC) void WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC )
/****************************************************************/ /****************************************************************/
/* /*
Change de couche active pour le routage. * Change de couche active pour le routage.
Si une piste est en cours de trace : placement d'une Via * Si une piste est en cours de trace : placement d'une Via
*/ */
{ {
TRACK * pt_segm; TRACK* pt_segm;
SEGVIA * Via; SEGVIA* Via;
int ii; int ii;
int itmp; int itmp;
if(track == NULL) if( track == NULL )
{ {
if(GetScreen()->m_Active_Layer != GetScreen()->m_Route_Layer_TOP) if( GetScreen()->m_Active_Layer != GetScreen()->m_Route_Layer_TOP )
GetScreen()->m_Active_Layer = GetScreen()->m_Route_Layer_TOP; GetScreen()->m_Active_Layer = GetScreen()->m_Route_Layer_TOP;
else GetScreen()->m_Active_Layer = GetScreen()->m_Route_Layer_BOTTOM ; else
Affiche_Status_Box(); GetScreen()->m_Active_Layer = GetScreen()->m_Route_Layer_BOTTOM;
SetToolbars(); Affiche_Status_Box();
return; SetToolbars();
} return;
}
/* Les vias ne doivent pas etre inutilement empilees: */
if( Locate_Via(m_Pcb, g_CurrentTrackSegment->m_End, g_CurrentTrackSegment->m_Layer)) /* Les vias ne doivent pas etre inutilement empilees: */
return; if( Locate_Via( m_Pcb, g_CurrentTrackSegment->m_End, g_CurrentTrackSegment->m_Layer ) )
pt_segm = g_FirstTrackSegment; return;
for ( ii = 0; ii < g_TrackSegmentCount-1 ; ii++, pt_segm = (TRACK*)pt_segm->Pnext) pt_segm = g_FirstTrackSegment;
{ for( ii = 0; ii < g_TrackSegmentCount - 1; ii++, pt_segm = (TRACK*) pt_segm->Pnext )
if( (pt_segm->m_StructType == TYPEVIA) && {
(g_CurrentTrackSegment->m_End == pt_segm->m_Start) ) if( (pt_segm->m_StructType == TYPEVIA)
return; && (g_CurrentTrackSegment->m_End == pt_segm->m_Start) )
} return;
/* Test si segment possible a placer */ }
if ( Drc_On )
if ( Drc(this, DC,g_CurrentTrackSegment,m_Pcb->m_Track,1) == BAD_DRC ) /* Test si segment possible a placer */
return ; if( Drc_On )
if( Drc( this, DC, g_CurrentTrackSegment, m_Pcb->m_Track, 1 ) == BAD_DRC )
/* save etat actuel pour regeneration si via impossible a placer */ return;
itmp = g_TrackSegmentCount;
Begin_Route(g_CurrentTrackSegment, DC); /* save etat actuel pour regeneration si via impossible a placer */
itmp = g_TrackSegmentCount;
DrawPanel->ManageCurseur(DrawPanel, DC, FALSE); Begin_Route( g_CurrentTrackSegment, DC );
Via = new SEGVIA(m_Pcb); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
Via->m_Flags = IS_NEW;
Via->m_Width = g_DesignSettings.m_CurrentViaSize; Via = new SEGVIA( m_Pcb );
Via->m_Shape = g_DesignSettings.m_CurrentViaType ; Via->m_Flags = IS_NEW;
Via->m_NetCode = g_HightLigth_NetCode ; Via->m_Width = g_DesignSettings.m_CurrentViaSize;
Via->m_Start = Via->m_End = g_CurrentTrackSegment->m_End; Via->m_Shape = g_DesignSettings.m_CurrentViaType;
Via->m_NetCode = g_HightLigth_NetCode;
Via->m_Layer = GetScreen()->m_Active_Layer; Via->m_Start = Via->m_End = g_CurrentTrackSegment->m_End;
// Provisoirement. indicate the first layer (?)
Via->m_Layer = GetScreen()->m_Active_Layer;
//swap the layers.
if( GetScreen()->m_Active_Layer != GetScreen()->m_Route_Layer_TOP) // Provisoirement. indicate the first layer (?)
GetScreen()->m_Active_Layer = GetScreen()->m_Route_Layer_TOP ;
else GetScreen()->m_Active_Layer = GetScreen()->m_Route_Layer_BOTTOM ; //swap the layers.
if( GetScreen()->m_Active_Layer != GetScreen()->m_Route_Layer_TOP )
if ( (Via->m_Shape & 15) == VIA_ENTERREE ) GetScreen()->m_Active_Layer = GetScreen()->m_Route_Layer_TOP;
{ else
Via->m_Layer |= GetScreen()->m_Active_Layer << 4; GetScreen()->m_Active_Layer = GetScreen()->m_Route_Layer_BOTTOM;
}
else if ( (Via->m_Shape & 15) == VIA_BORGNE ) //blind via if( (Via->m_Shape & 15) == VIA_ENTERREE )
{ // A revoir! ( la via devrait deboucher sur 1 cote ) {
Via->m_Layer |= GetScreen()->m_Active_Layer << 4; Via->m_Layer |= GetScreen()->m_Active_Layer << 4;
} }
else Via->m_Layer = 0x0F; else if( (Via->m_Shape & 15) == VIA_BORGNE ) //blind via
{ // A revoir! ( la via devrait deboucher sur 1 cote )
if ( Drc_On &&( Drc(this, DC,Via,m_Pcb->m_Track,1 ) == BAD_DRC ) ) Via->m_Layer |= GetScreen()->m_Active_Layer << 4;
{ /* Via impossible a placer ici */ }
delete Via; else
GetScreen()->m_Active_Layer = g_CurrentTrackSegment->m_Layer ; Via->m_Layer = 0x0F;
DrawPanel->ManageCurseur(DrawPanel, DC, FALSE);
return; if( Drc_On &&( Drc( this, DC, Via, m_Pcb->m_Track, 1 ) == BAD_DRC ) )
} { /* Via impossible a placer ici */
delete Via;
/* la via est OK et est inseree apres le segment courant */ GetScreen()->m_Active_Layer = g_CurrentTrackSegment->m_Layer;
Via->Pback = g_CurrentTrackSegment; DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
g_CurrentTrackSegment->Pnext = Via; return;
g_TrackSegmentCount++; }
g_CurrentTrackSegment = new TRACK(*g_CurrentTrackSegment);
g_CurrentTrackSegment->m_Layer = GetScreen()->m_Active_Layer; /* la via est OK et est inseree apres le segment courant */
g_CurrentTrackSegment->m_Start = g_CurrentTrackSegment->m_End = Via->m_Start; Via->Pback = g_CurrentTrackSegment;
g_TrackSegmentCount++; g_CurrentTrackSegment->Pnext = Via;
g_CurrentTrackSegment->Pback = Via; g_TrackSegmentCount++;
Via->Pnext = g_CurrentTrackSegment; g_CurrentTrackSegment = new TRACK( *g_CurrentTrackSegment );
if ( g_TwoSegmentTrackBuild ) g_CurrentTrackSegment->m_Layer = GetScreen()->m_Active_Layer;
{ // Create a second segment (we must have 2 track segments to adjust) g_CurrentTrackSegment->m_Start = g_CurrentTrackSegment->m_End = Via->m_Start;
TRACK * track = g_CurrentTrackSegment; g_TrackSegmentCount++;
g_CurrentTrackSegment = new TRACK(*track); g_CurrentTrackSegment->Pback = Via;
g_TrackSegmentCount++; Via->Pnext = g_CurrentTrackSegment;
g_CurrentTrackSegment->Pback = track; if( g_TwoSegmentTrackBuild )
track->Pnext = g_CurrentTrackSegment; { // Create a second segment (we must have 2 track segments to adjust)
} TRACK* track = g_CurrentTrackSegment;
g_CurrentTrackSegment = new TRACK( *track );
DrawPanel->ManageCurseur(DrawPanel, DC, FALSE); g_TrackSegmentCount++;
Affiche_Infos_Piste(this, Via); g_CurrentTrackSegment->Pback = track;
track->Pnext = g_CurrentTrackSegment;
Affiche_Status_Box(); }
SetToolbars();
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
Affiche_Infos_Piste( this, Via );
Affiche_Status_Box();
SetToolbars();
} }
/*************************************************/ /*************************************************/
void WinEDA_PcbFrame::Affiche_Status_Net(wxDC * DC) void WinEDA_PcbFrame::Affiche_Status_Net( wxDC* DC )
/*************************************************/ /*************************************************/
/* Affiche: /* Affiche:
le status du net en haut d'ecran du segment pointe par la souris * le status du net en haut d'ecran du segment pointe par la souris
ou le status PCB en bas d'ecran si pas de segment pointe * ou le status PCB en bas d'ecran si pas de segment pointe
*/ */
{ {
TRACK * pt_segm; TRACK* pt_segm;
int masquelayer = g_TabOneLayerMask[GetScreen()->m_Active_Layer]; int masquelayer = g_TabOneLayerMask[GetScreen()->m_Active_Layer];
pt_segm = Locate_Pistes(m_Pcb->m_Track, masquelayer, CURSEUR_OFF_GRILLE); pt_segm = Locate_Pistes( m_Pcb->m_Track, masquelayer, CURSEUR_OFF_GRILLE );
if(pt_segm == NULL) Affiche_Infos_Status_Pcb(this); if( pt_segm == NULL )
else test_1_net_connexion(DC, pt_segm->m_NetCode); Affiche_Infos_Status_Pcb( this );
else
test_1_net_connexion( DC, pt_segm->m_NetCode );
} }
/**********************************************************************/ /**********************************************************************/
void WinEDA_PcbFrame::Show_1_Ratsnest(EDA_BaseStruct * item, wxDC * DC) void WinEDA_PcbFrame::Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC )
/**********************************************************************/ /**********************************************************************/
/* Affiche le ratsnest relatif /* Affiche le ratsnest relatif
au net du pad pointe par la souris * au net du pad pointe par la souris
ou au module localise par la souris * ou au module localise par la souris
Efface le chevelu affiche si aucun module ou pad n'est selectionne * Efface le chevelu affiche si aucun module ou pad n'est selectionne
*/ */
{ {
int ii; int ii;
CHEVELU * pt_chevelu; CHEVELU* pt_chevelu;
D_PAD * pt_pad = NULL; D_PAD* pt_pad = NULL;
MODULE * Module = NULL; MODULE* Module = NULL;
if (g_Show_Ratsnest) return; // Deja Affich� if( g_Show_Ratsnest )
return; // Deja Affich�
if((m_Pcb->m_Status_Pcb & LISTE_CHEVELU_OK) == 0 )
{ if( !item )
Compile_Ratsnest( DC, TRUE ); return;
}
if( (m_Pcb->m_Status_Pcb & LISTE_CHEVELU_OK) == 0 )
if ( item && (item->m_StructType == TYPEPAD) ) {
{ Compile_Ratsnest( DC, TRUE );
pt_pad = (D_PAD*)item; }
Module = (MODULE *) pt_pad->m_Parent;
} if( item->m_StructType == TYPEPAD )
{
if ( pt_pad ) /* Affichage du chevelu du net correspondant */ pt_pad = (D_PAD*) item;
{ Module = (MODULE*) pt_pad->m_Parent;
pt_pad->Display_Infos(this); }
pt_chevelu = (CHEVELU*) m_Pcb->m_Ratsnest;
for( ii = m_Pcb->GetNumRatsnests(); ii > 0; pt_chevelu++, ii--) if( pt_pad ) /* Affichage du chevelu du net correspondant */
{ {
if( pt_chevelu->m_NetCode == pt_pad->m_NetCode) pt_pad->Display_Infos( this );
{ pt_chevelu = (CHEVELU*) m_Pcb->m_Ratsnest;
if( (pt_chevelu->status & CH_VISIBLE) != 0 ) continue; for( ii = m_Pcb->GetNumRatsnests(); ii > 0; pt_chevelu++, ii-- )
pt_chevelu->status |= CH_VISIBLE; {
if( (pt_chevelu->status & CH_ACTIF) == 0 ) continue; if( pt_chevelu->m_NetCode == pt_pad->m_NetCode )
{
GRSetDrawMode(DC, GR_XOR); if( (pt_chevelu->status & CH_VISIBLE) != 0 )
GRLine( &DrawPanel->m_ClipBox, DC, pt_chevelu->pad_start->m_Pos.x, continue;
pt_chevelu->pad_start->m_Pos.y, pt_chevelu->status |= CH_VISIBLE;
pt_chevelu->pad_end->m_Pos.x, if( (pt_chevelu->status & CH_ACTIF) == 0 )
pt_chevelu->pad_end->m_Pos.y, continue;
0,
g_DesignSettings.m_RatsnestColor); GRSetDrawMode( DC, GR_XOR );
} GRLine( &DrawPanel->m_ClipBox, DC, pt_chevelu->pad_start->m_Pos.x,
} pt_chevelu->pad_start->m_Pos.y,
} pt_chevelu->pad_end->m_Pos.x,
else pt_chevelu->pad_end->m_Pos.y,
{ 0,
if ( item && (item->m_StructType == TYPEMODULE) ) g_DesignSettings.m_RatsnestColor );
{ }
Module = (MODULE*)item; }
} }
else
if( Module) {
{ if( item->m_StructType == TYPETEXTEMODULE )
Module->Display_Infos(this); {
pt_pad = Module->m_Pads; Module = (MODULE*) item->m_Parent;
for( ; pt_pad != NULL; pt_pad = (D_PAD*)pt_pad->Pnext) }
{
pt_chevelu = (CHEVELU*) m_Pcb->m_Ratsnest; else if( item->m_StructType == TYPEMODULE )
for( ii = m_Pcb->GetNumRatsnests(); ii > 0; pt_chevelu++, ii--) {
{ Module = (MODULE*) item;
if( (pt_chevelu->pad_start == pt_pad) || }
(pt_chevelu->pad_end == pt_pad) )
{ if( Module )
if( pt_chevelu->status & CH_VISIBLE ) continue; {
pt_chevelu->status |= CH_VISIBLE; Module->Display_Infos( this );
if( (pt_chevelu->status & CH_ACTIF) == 0 ) continue; pt_pad = Module->m_Pads;
for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext )
GRSetDrawMode(DC, GR_XOR); {
GRLine(&DrawPanel->m_ClipBox, DC, pt_chevelu->pad_start->m_Pos.x, pt_chevelu = (CHEVELU*) m_Pcb->m_Ratsnest;
pt_chevelu->pad_start->m_Pos.y, for( ii = m_Pcb->GetNumRatsnests(); ii > 0; pt_chevelu++, ii-- )
pt_chevelu->pad_end->m_Pos.x, {
pt_chevelu->pad_end->m_Pos.y, if( (pt_chevelu->pad_start == pt_pad)
0, || (pt_chevelu->pad_end == pt_pad) )
g_DesignSettings.m_RatsnestColor); {
} if( pt_chevelu->status & CH_VISIBLE )
} continue;
}
pt_pad = NULL; pt_chevelu->status |= CH_VISIBLE;
} if( (pt_chevelu->status & CH_ACTIF) == 0 )
} continue;
/* Effacement complet des selections GRSetDrawMode( DC, GR_XOR );
si aucun pad ou module n'a ete localise */ GRLine( &DrawPanel->m_ClipBox, DC, pt_chevelu->pad_start->m_Pos.x,
if( (pt_pad == NULL) && (Module == NULL) ) pt_chevelu->pad_start->m_Pos.y,
{ pt_chevelu->pad_end->m_Pos.x,
MsgPanel->EraseMsgBox(); pt_chevelu->pad_end->m_Pos.y,
DrawGeneralRatsnest(DC); 0,
pt_chevelu = (CHEVELU*) m_Pcb->m_Ratsnest; g_DesignSettings.m_RatsnestColor );
for( ii = m_Pcb->GetNumRatsnests();(ii > 0) && pt_chevelu; pt_chevelu++, ii--) }
pt_chevelu->status &= ~CH_VISIBLE; }
} }
pt_pad = NULL;
}
}
/* Effacement complet des selections
* si aucun pad ou module n'a ete localise */
if( (pt_pad == NULL) && (Module == NULL) )
{
MsgPanel->EraseMsgBox();
DrawGeneralRatsnest( DC );
pt_chevelu = (CHEVELU*) m_Pcb->m_Ratsnest;
for( ii = m_Pcb->GetNumRatsnests(); (ii > 0) && pt_chevelu; pt_chevelu++, ii-- )
pt_chevelu->status &= ~CH_VISIBLE;
}
} }
/*****************************************************/ /*****************************************************/
void WinEDA_PcbFrame::Affiche_PadsNoConnect(wxDC * DC) void WinEDA_PcbFrame::Affiche_PadsNoConnect( wxDC* DC )
/*****************************************************/ /*****************************************************/
/* Met en surbrillance les pads non encore connectes ( correspondants aux /* Met en surbrillance les pads non encore connectes ( correspondants aux
chevelus actifs * chevelus actifs
*/ */
{ {
int ii; int ii;
CHEVELU * pt_chevelu; CHEVELU* pt_chevelu;
D_PAD * pt_pad; D_PAD* pt_pad;
pt_chevelu = (CHEVELU*)m_Pcb->m_Ratsnest; pt_chevelu = (CHEVELU*) m_Pcb->m_Ratsnest;
for( ii = m_Pcb->GetNumRatsnests();ii > 0; pt_chevelu++, ii--) for( ii = m_Pcb->GetNumRatsnests(); ii > 0; pt_chevelu++, ii-- )
{ {
if( (pt_chevelu->status & CH_ACTIF) == 0 ) continue; if( (pt_chevelu->status & CH_ACTIF) == 0 )
pt_pad = pt_chevelu->pad_start; continue;
if (pt_pad) pt_pad = pt_chevelu->pad_start;
pt_pad->Draw(DrawPanel,DC, wxPoint(0,0), GR_OR | GR_SURBRILL);
if( pt_pad )
pt_pad = pt_chevelu->pad_end; pt_pad->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR | GR_SURBRILL );
if (pt_pad)
pt_pad->Draw(DrawPanel,DC, wxPoint(0,0), GR_OR | GR_SURBRILL); pt_pad = pt_chevelu->pad_end;
} if( pt_pad )
pt_pad->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR | GR_SURBRILL );
}
} }
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
/* Localisation des elements */ /* Localisation des elements */
/*****************************/ /*****************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
...@@ -19,15 +20,24 @@ int ux0, uy0, dx, dy, spot_cX, spot_cY; /* Variables utilisees pour ...@@ -19,15 +20,24 @@ int ux0, uy0, dx, dy, spot_cX, spot_cY; /* Variables utilisees pour
/* fonctions locales */ /* fonctions locales */
EDA_BaseStruct* Locate_MirePcb( EDA_BaseStruct* PtStruct, int LayerSearch, int typeloc ); EDA_BaseStruct* Locate_MirePcb( EDA_BaseStruct* PtStruct, int LayerSearch, int typeloc );
/**/
/* Macro de calcul de la coord de pointage selon le curseur /**
* (ON/OFF grille) choisi * Function RefPos
* returns the reference position, coming from either the mouse position or the
* the cursor position, based on whether the typeloc has the CURSEUR_OFF_GRILLE
* flag ORed in or not.
* @param typeloc int with possible CURSEUR_OFF_GRILLE bit on.
* @return wxPoint - The reference point, either the mouse position or
* the cursor position.
*/ */
#define SET_REF_POS( ref_pos ) if( typeloc == CURSEUR_ON_GRILLE ) \ wxPoint inline RefPos( int typeloc )
{ ref_pos = ActiveScreen->m_Curseur; } \ {
else { ref_pos = ActiveScreen->m_MousePosition; } if( typeloc & CURSEUR_OFF_GRILLE )
return ActiveScreen->m_MousePosition;
else
return ActiveScreen->m_Curseur;
}
/** /**
* Function IsModuleLayerVisible * Function IsModuleLayerVisible
...@@ -36,7 +46,8 @@ EDA_BaseStruct* Locate_MirePcb( EDA_BaseStruct* PtStruct, int LayerSearch, int t ...@@ -36,7 +46,8 @@ EDA_BaseStruct* Locate_MirePcb( EDA_BaseStruct* PtStruct, int LayerSearch, int t
* @param layer One of the two allowed layers for modules: CMP_N or CUIVRE_N * @param layer One of the two allowed layers for modules: CMP_N or CUIVRE_N
* @return bool - true if the layer is visible, else false. * @return bool - true if the layer is visible, else false.
*/ */
bool inline IsModuleLayerVisible( int layer ) { bool inline IsModuleLayerVisible( int layer )
{
if( layer==CMP_N ) if( layer==CMP_N )
return DisplayOpt.Show_Modules_Cmp; return DisplayOpt.Show_Modules_Cmp;
...@@ -102,8 +113,8 @@ EDA_BaseStruct* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch ) ...@@ -102,8 +113,8 @@ EDA_BaseStruct* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch )
/*******************************************************************************/ /*******************************************************************************/
/* General locate function /* General locate function
* Display infos relatives to the item found * Display infos relatives to the item found
* return a pointer to this item ( or NULL ) * return a pointer to this item ( or NULL )
*/ */
{ {
TEXTE_PCB* pt_texte_pcb; TEXTE_PCB* pt_texte_pcb;
...@@ -145,7 +156,8 @@ EDA_BaseStruct* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch ) ...@@ -145,7 +156,8 @@ EDA_BaseStruct* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch )
Track = Locate_Pistes( m_Pcb->m_Track, masque_layer, typeloc ); Track = Locate_Pistes( m_Pcb->m_Track, masque_layer, typeloc );
if( Track != NULL ) if( Track != NULL )
{ {
TrackLocate = Track; /* a track or a via is found*/ TrackLocate = Track; /* a track or a via is found */
/* Search for a via */ /* Search for a via */
while( ( TrackLocate = Locate_Pistes( TrackLocate, while( ( TrackLocate = Locate_Pistes( TrackLocate,
masque_layer, typeloc ) ) != NULL ) masque_layer, typeloc ) ) != NULL )
...@@ -153,6 +165,7 @@ EDA_BaseStruct* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch ) ...@@ -153,6 +165,7 @@ EDA_BaseStruct* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch )
Track = TrackLocate; Track = TrackLocate;
if( TrackLocate->m_StructType == TYPEVIA ) if( TrackLocate->m_StructType == TYPEVIA )
break; break;
TrackLocate = (TRACK*) TrackLocate->Pnext; TrackLocate = (TRACK*) TrackLocate->Pnext;
} }
...@@ -169,8 +182,9 @@ EDA_BaseStruct* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch ) ...@@ -169,8 +182,9 @@ EDA_BaseStruct* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch )
/* Search for a footprint text */ /* Search for a footprint text */
// First search: locate texts for footprints on copper or component layer // First search: locate texts for footprints on copper or component layer
// Priority to the active layer (component or copper. // Priority to the active layer (component or copper).
// this is useful for small smd components when 2 texts overlap but are not on the same layer // This is useful for small smd components when 2 texts overlap but are not
// on the same layer
if( LayerSearch == LAYER_CUIVRE_N || LayerSearch == CMP_N ) if( LayerSearch == LAYER_CUIVRE_N || LayerSearch == CMP_N )
{ {
for( module = m_Pcb->m_Modules; module != NULL; module = (MODULE*) module->Pnext ) for( module = m_Pcb->m_Modules; module != NULL; module = (MODULE*) module->Pnext )
...@@ -315,15 +329,15 @@ EDGE_MODULE* Locate_Edge_Module( MODULE* module, int typeloc ) ...@@ -315,15 +329,15 @@ EDGE_MODULE* Locate_Edge_Module( MODULE* module, int typeloc )
EDA_BaseStruct* PtStruct; EDA_BaseStruct* PtStruct;
int uxf, uyf, type_trace; int uxf, uyf, type_trace;
int rayon, dist; int rayon, dist;
wxPoint ref_pos; /* coord du point de localisation */ wxPoint ref_pos; /* coord du point de localisation */
int StAngle, EndAngle, MouseAngle;/* pour localisation d'arcs,
* angle du point de debut, de fin et du point /* pour localisation d'arcs, angle du point de debut, de fin et du point de reference */
* de reference */ int StAngle, EndAngle, MouseAngle;
if( !module ) if( !module )
return NULL; return NULL;
SET_REF_POS( ref_pos ); ref_pos = RefPos( typeloc );
PtStruct = module->m_Drawings; PtStruct = module->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
...@@ -397,7 +411,7 @@ EDA_BaseStruct* Locate_Cotation( BOARD* Pcb, int LayerSearch, int typeloc ) ...@@ -397,7 +411,7 @@ EDA_BaseStruct* Locate_Cotation( BOARD* Pcb, int LayerSearch, int typeloc )
wxPoint ref_pos; wxPoint ref_pos;
int ux0, uy0; int ux0, uy0;
SET_REF_POS( ref_pos ); ref_pos = RefPos( typeloc );
PtStruct = Pcb->m_Drawings; PtStruct = Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
...@@ -418,6 +432,7 @@ EDA_BaseStruct* Locate_Cotation( BOARD* Pcb, int LayerSearch, int typeloc ) ...@@ -418,6 +432,7 @@ EDA_BaseStruct* Locate_Cotation( BOARD* Pcb, int LayerSearch, int typeloc )
/* Localisation des SEGMENTS ?) */ /* Localisation des SEGMENTS ?) */
ux0 = Cotation->Barre_ox; uy0 = Cotation->Barre_oy; ux0 = Cotation->Barre_ox; uy0 = Cotation->Barre_oy;
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */ /* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
dx = Cotation->Barre_fx - ux0; dy = Cotation->Barre_fy - uy0; dx = Cotation->Barre_fx - ux0; dy = Cotation->Barre_fy - uy0;
spot_cX = ref_pos.x - ux0; spot_cY = ref_pos.y - uy0; spot_cX = ref_pos.x - ux0; spot_cY = ref_pos.y - uy0;
...@@ -427,6 +442,7 @@ EDA_BaseStruct* Locate_Cotation( BOARD* Pcb, int LayerSearch, int typeloc ) ...@@ -427,6 +442,7 @@ EDA_BaseStruct* Locate_Cotation( BOARD* Pcb, int LayerSearch, int typeloc )
return PtStruct; return PtStruct;
ux0 = Cotation->TraitG_ox; uy0 = Cotation->TraitG_oy; ux0 = Cotation->TraitG_ox; uy0 = Cotation->TraitG_oy;
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */ /* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
dx = Cotation->TraitG_fx - ux0; dy = Cotation->TraitG_fy - uy0; dx = Cotation->TraitG_fx - ux0; dy = Cotation->TraitG_fy - uy0;
spot_cX = ref_pos.x - ux0; spot_cY = ref_pos.y - uy0; spot_cX = ref_pos.x - ux0; spot_cY = ref_pos.y - uy0;
...@@ -436,6 +452,7 @@ EDA_BaseStruct* Locate_Cotation( BOARD* Pcb, int LayerSearch, int typeloc ) ...@@ -436,6 +452,7 @@ EDA_BaseStruct* Locate_Cotation( BOARD* Pcb, int LayerSearch, int typeloc )
return PtStruct; return PtStruct;
ux0 = Cotation->TraitD_ox; uy0 = Cotation->TraitD_oy; ux0 = Cotation->TraitD_ox; uy0 = Cotation->TraitD_oy;
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */ /* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
dx = Cotation->TraitD_fx - ux0; dy = Cotation->TraitD_fy - uy0; dx = Cotation->TraitD_fx - ux0; dy = Cotation->TraitD_fy - uy0;
spot_cX = ref_pos.x - ux0; spot_cY = ref_pos.y - uy0; spot_cX = ref_pos.x - ux0; spot_cY = ref_pos.y - uy0;
...@@ -445,6 +462,7 @@ EDA_BaseStruct* Locate_Cotation( BOARD* Pcb, int LayerSearch, int typeloc ) ...@@ -445,6 +462,7 @@ EDA_BaseStruct* Locate_Cotation( BOARD* Pcb, int LayerSearch, int typeloc )
return PtStruct; return PtStruct;
ux0 = Cotation->FlecheD1_ox; uy0 = Cotation->FlecheD1_oy; ux0 = Cotation->FlecheD1_ox; uy0 = Cotation->FlecheD1_oy;
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */ /* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
dx = Cotation->FlecheD1_fx - ux0; dy = Cotation->FlecheD1_fy - uy0; dx = Cotation->FlecheD1_fx - ux0; dy = Cotation->FlecheD1_fy - uy0;
spot_cX = ref_pos.x - ux0; spot_cY = ref_pos.y - uy0; spot_cX = ref_pos.x - ux0; spot_cY = ref_pos.y - uy0;
...@@ -454,6 +472,7 @@ EDA_BaseStruct* Locate_Cotation( BOARD* Pcb, int LayerSearch, int typeloc ) ...@@ -454,6 +472,7 @@ EDA_BaseStruct* Locate_Cotation( BOARD* Pcb, int LayerSearch, int typeloc )
return PtStruct; return PtStruct;
ux0 = Cotation->FlecheD2_ox; uy0 = Cotation->FlecheD2_oy; ux0 = Cotation->FlecheD2_ox; uy0 = Cotation->FlecheD2_oy;
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */ /* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
dx = Cotation->FlecheD2_fx - ux0; dy = Cotation->FlecheD2_fy - uy0; dx = Cotation->FlecheD2_fx - ux0; dy = Cotation->FlecheD2_fy - uy0;
spot_cX = ref_pos.x - ux0; spot_cY = ref_pos.y - uy0; spot_cX = ref_pos.x - ux0; spot_cY = ref_pos.y - uy0;
...@@ -463,6 +482,7 @@ EDA_BaseStruct* Locate_Cotation( BOARD* Pcb, int LayerSearch, int typeloc ) ...@@ -463,6 +482,7 @@ EDA_BaseStruct* Locate_Cotation( BOARD* Pcb, int LayerSearch, int typeloc )
return PtStruct; return PtStruct;
ux0 = Cotation->FlecheG1_ox; uy0 = Cotation->FlecheG1_oy; ux0 = Cotation->FlecheG1_ox; uy0 = Cotation->FlecheG1_oy;
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */ /* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
dx = Cotation->FlecheG1_fx - ux0; dy = Cotation->FlecheG1_fy - uy0; dx = Cotation->FlecheG1_fx - ux0; dy = Cotation->FlecheG1_fy - uy0;
spot_cX = ref_pos.x - ux0; spot_cY = ref_pos.y - uy0; spot_cX = ref_pos.x - ux0; spot_cY = ref_pos.y - uy0;
...@@ -472,6 +492,7 @@ EDA_BaseStruct* Locate_Cotation( BOARD* Pcb, int LayerSearch, int typeloc ) ...@@ -472,6 +492,7 @@ EDA_BaseStruct* Locate_Cotation( BOARD* Pcb, int LayerSearch, int typeloc )
return PtStruct; return PtStruct;
ux0 = Cotation->FlecheG2_ox; uy0 = Cotation->FlecheG2_oy; ux0 = Cotation->FlecheG2_ox; uy0 = Cotation->FlecheG2_oy;
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */ /* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
dx = Cotation->FlecheG2_fx - ux0; dy = Cotation->FlecheG2_fy - uy0; dx = Cotation->FlecheG2_fx - ux0; dy = Cotation->FlecheG2_fy - uy0;
spot_cX = ref_pos.x - ux0; spot_cY = ref_pos.y - uy0; spot_cX = ref_pos.x - ux0; spot_cY = ref_pos.y - uy0;
...@@ -501,7 +522,7 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int LayerSearch, int typeloc ) ...@@ -501,7 +522,7 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int LayerSearch, int typeloc )
wxPoint ref_pos; wxPoint ref_pos;
PCB_SCREEN* screen = (PCB_SCREEN*) ActiveScreen; PCB_SCREEN* screen = (PCB_SCREEN*) ActiveScreen;
SET_REF_POS( ref_pos ); ref_pos = RefPos( typeloc );
PtStruct = Pcb->m_Drawings; PtStruct = Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
...@@ -511,7 +532,9 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int LayerSearch, int typeloc ) ...@@ -511,7 +532,9 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int LayerSearch, int typeloc )
pts = (DRAWSEGMENT*) PtStruct; pts = (DRAWSEGMENT*) PtStruct;
if( (pts->m_Layer != LayerSearch) && (LayerSearch != -1) ) if( (pts->m_Layer != LayerSearch) && (LayerSearch != -1) )
continue; continue;
ux0 = pts->m_Start.x; uy0 = pts->m_Start.y; ux0 = pts->m_Start.x; uy0 = pts->m_Start.y;
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */ /* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
dx = pts->m_End.x - ux0; dy = pts->m_End.y - uy0; dx = pts->m_End.x - ux0; dy = pts->m_End.y - uy0;
spot_cX = ref_pos.x - ux0; spot_cY = ref_pos.y - uy0; spot_cX = ref_pos.x - ux0; spot_cY = ref_pos.y - uy0;
...@@ -520,8 +543,10 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int LayerSearch, int typeloc ) ...@@ -520,8 +543,10 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int LayerSearch, int typeloc )
if( (pts->m_Shape == S_CIRCLE) || (pts->m_Shape == S_ARC) ) if( (pts->m_Shape == S_CIRCLE) || (pts->m_Shape == S_ARC) )
{ {
int rayon, dist, StAngle, EndAngle, MouseAngle; int rayon, dist, StAngle, EndAngle, MouseAngle;
rayon = (int) hypot( (double) (dx), (double) (dy) ); rayon = (int) hypot( (double) (dx), (double) (dy) );
dist = (int) hypot( (double) (spot_cX), (double) (spot_cY) ); dist = (int) hypot( (double) (spot_cX), (double) (spot_cY) );
if( abs( rayon - dist ) <= (pts->m_Width / 2) ) if( abs( rayon - dist ) <= (pts->m_Width / 2) )
{ {
if( pts->m_Shape == S_CIRCLE ) if( pts->m_Shape == S_CIRCLE )
...@@ -531,6 +556,7 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int LayerSearch, int typeloc ) ...@@ -531,6 +556,7 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int LayerSearch, int typeloc )
else if( !locate_segm ) else if( !locate_segm )
locate_segm = pts; locate_segm = pts;
} }
/* pour un arc, controle complementaire */ /* pour un arc, controle complementaire */
MouseAngle = (int) ArcTangente( spot_cY, spot_cX ); MouseAngle = (int) ArcTangente( spot_cY, spot_cX );
StAngle = (int) ArcTangente( dy, dx ); StAngle = (int) ArcTangente( dy, dx );
...@@ -586,9 +612,7 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int LayerSearch, int typeloc ) ...@@ -586,9 +612,7 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int LayerSearch, int typeloc )
D_PAD* Locate_Any_Pad( BOARD* Pcb, int typeloc, bool OnlyCurrentLayer ) D_PAD* Locate_Any_Pad( BOARD* Pcb, int typeloc, bool OnlyCurrentLayer )
{ {
wxPoint ref_pos; wxPoint ref_pos = RefPos( typeloc );
SET_REF_POS( ref_pos );
return Locate_Any_Pad( Pcb, ref_pos, OnlyCurrentLayer ); return Locate_Any_Pad( Pcb, ref_pos, OnlyCurrentLayer );
} }
...@@ -635,9 +659,7 @@ D_PAD* Locate_Any_Pad( BOARD* Pcb, const wxPoint& ref_pos, bool OnlyCurrentLayer ...@@ -635,9 +659,7 @@ D_PAD* Locate_Any_Pad( BOARD* Pcb, const wxPoint& ref_pos, bool OnlyCurrentLayer
D_PAD* Locate_Pads( MODULE* module, int masque_layer, int typeloc ) D_PAD* Locate_Pads( MODULE* module, int masque_layer, int typeloc )
{ {
wxPoint ref_pos; wxPoint ref_pos = RefPos( typeloc );
SET_REF_POS( ref_pos );
return Locate_Pads( module, ref_pos, masque_layer ); return Locate_Pads( module, ref_pos, masque_layer );
} }
...@@ -713,7 +735,8 @@ MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc ) ...@@ -713,7 +735,8 @@ MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc )
int layer; /* pour calcul de couches prioritaires */ int layer; /* pour calcul de couches prioritaires */
wxPoint ref_pos; /* coord du point de reference pour la localisation */ wxPoint ref_pos; /* coord du point de reference pour la localisation */
SET_REF_POS( ref_pos ); ref_pos = RefPos( typeloc );
pt_module = Pcb->m_Modules; pt_module = Pcb->m_Modules;
for( ; pt_module; pt_module = (MODULE*) pt_module->Pnext ) for( ; pt_module; pt_module = (MODULE*) pt_module->Pnext )
{ {
...@@ -757,7 +780,7 @@ MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc ) ...@@ -757,7 +780,7 @@ MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc )
} }
} }
else if( !(typeloc & MATCH_LAYER) else if( !(typeloc & MATCH_LAYER)
&& ( !(typeloc & VISIBLE_ONLY) || IsModuleLayerVisible( layer ) ) ) && ( !(typeloc & VISIBLE_ONLY) || IsModuleLayerVisible( layer ) ) )
{ {
if( min( lx, ly ) <= alt_min_dim ) if( min( lx, ly ) <= alt_min_dim )
{ {
...@@ -795,7 +818,8 @@ TEXTE_MODULE* LocateTexteModule( BOARD* Pcb, MODULE** PtModule, int typeloc ) ...@@ -795,7 +818,8 @@ TEXTE_MODULE* LocateTexteModule( BOARD* Pcb, MODULE** PtModule, int typeloc )
* - pointeur sur le texte localise ( ou NULL ) * - pointeur sur le texte localise ( ou NULL )
* - si Ptmodule != NULL: pointeur sur module module ( non modifie sinon ) * - si Ptmodule != NULL: pointeur sur module module ( non modifie sinon )
* *
* if typeloc bas the flag VISIBLE_ONLY set, only footprints which are "visible" are considered * if typeloc has the flag VISIBLE_ONLY set, only footprints which are
* "visible" are considered
*/ */
{ {
EDA_BaseStruct* PtStruct; EDA_BaseStruct* PtStruct;
...@@ -803,7 +827,7 @@ TEXTE_MODULE* LocateTexteModule( BOARD* Pcb, MODULE** PtModule, int typeloc ) ...@@ -803,7 +827,7 @@ TEXTE_MODULE* LocateTexteModule( BOARD* Pcb, MODULE** PtModule, int typeloc )
MODULE* module; MODULE* module;
wxPoint ref_pos; wxPoint ref_pos;
SET_REF_POS( ref_pos ); ref_pos = RefPos( typeloc );
module = *PtModule; module = *PtModule;
if( module == NULL ) if( module == NULL )
...@@ -831,9 +855,8 @@ TEXTE_MODULE* LocateTexteModule( BOARD* Pcb, MODULE** PtModule, int typeloc ) ...@@ -831,9 +855,8 @@ TEXTE_MODULE* LocateTexteModule( BOARD* Pcb, MODULE** PtModule, int typeloc )
continue; continue;
} }
// hit-test the reference text
pt_txt_mod = module->m_Reference; pt_txt_mod = module->m_Reference;
/* la souris est-elle dans le rectangle autour du texte*/
if( pt_txt_mod->Locate( ref_pos ) ) if( pt_txt_mod->Locate( ref_pos ) )
{ {
if( PtModule ) if( PtModule )
...@@ -841,9 +864,8 @@ TEXTE_MODULE* LocateTexteModule( BOARD* Pcb, MODULE** PtModule, int typeloc ) ...@@ -841,9 +864,8 @@ TEXTE_MODULE* LocateTexteModule( BOARD* Pcb, MODULE** PtModule, int typeloc )
return pt_txt_mod; return pt_txt_mod;
} }
// hit-test the value text
pt_txt_mod = module->m_Value; pt_txt_mod = module->m_Value;
/* la souris est-elle dans le rectangle autour du texte*/
if( pt_txt_mod->Locate( ref_pos ) ) if( pt_txt_mod->Locate( ref_pos ) )
{ {
if( PtModule ) if( PtModule )
...@@ -851,13 +873,14 @@ TEXTE_MODULE* LocateTexteModule( BOARD* Pcb, MODULE** PtModule, int typeloc ) ...@@ -851,13 +873,14 @@ TEXTE_MODULE* LocateTexteModule( BOARD* Pcb, MODULE** PtModule, int typeloc )
return pt_txt_mod; return pt_txt_mod;
} }
// hit-test any other texts
PtStruct = module->m_Drawings; PtStruct = module->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
{ {
if( PtStruct->m_StructType != TYPETEXTEMODULE ) if( PtStruct->m_StructType != TYPETEXTEMODULE )
continue; continue;
pt_txt_mod = (TEXTE_MODULE*) PtStruct; pt_txt_mod = (TEXTE_MODULE*) PtStruct;
/* la souris est-elle dans le rectangle autour du texte*/
if( pt_txt_mod->Locate( ref_pos ) ) if( pt_txt_mod->Locate( ref_pos ) )
{ {
if( PtModule ) if( PtModule )
...@@ -1014,9 +1037,7 @@ suite1: ...@@ -1014,9 +1037,7 @@ suite1:
TRACK* Locate_Pistes( TRACK* start_adresse, int MasqueLayer, int typeloc ) TRACK* Locate_Pistes( TRACK* start_adresse, int MasqueLayer, int typeloc )
{ {
wxPoint ref_pos; wxPoint ref_pos = RefPos( typeloc );
SET_REF_POS( ref_pos );
return Locate_Pistes( start_adresse, ref_pos, MasqueLayer ); return Locate_Pistes( start_adresse, ref_pos, MasqueLayer );
} }
...@@ -1082,9 +1103,7 @@ TRACK* Locate_Pistes( TRACK* start_adresse, const wxPoint& ref_pos, int MasqueLa ...@@ -1082,9 +1103,7 @@ TRACK* Locate_Pistes( TRACK* start_adresse, const wxPoint& ref_pos, int MasqueLa
TRACK* Locate_Zone( TRACK* start_adresse, int layer, int typeloc ) TRACK* Locate_Zone( TRACK* start_adresse, int layer, int typeloc )
{ {
wxPoint ref_pos; wxPoint ref_pos = RefPos( typeloc );
SET_REF_POS( ref_pos );
return Locate_Zone( start_adresse, ref_pos, layer ); return Locate_Zone( start_adresse, ref_pos, layer );
} }
...@@ -1125,9 +1144,8 @@ TEXTE_PCB* Locate_Texte_Pcb( EDA_BaseStruct* PtStruct, int LayerSearch, int type ...@@ -1125,9 +1144,8 @@ TEXTE_PCB* Locate_Texte_Pcb( EDA_BaseStruct* PtStruct, int LayerSearch, int type
* retour : pointeur sur la description du texte localise * retour : pointeur sur la description du texte localise
*/ */
{ {
wxPoint ref; wxPoint ref = RefPos( typeloc );
SET_REF_POS( ref );
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
{ {
if( PtStruct->m_StructType != TYPETEXTE ) if( PtStruct->m_StructType != TYPETEXTE )
...@@ -1167,8 +1185,8 @@ int distance( int seuil ) ...@@ -1167,8 +1185,8 @@ int distance( int seuil )
{ {
int cXrot, cYrot, /* coord du point (souris) dans le repere tourne */ int cXrot, cYrot, /* coord du point (souris) dans le repere tourne */
segX, segY; /* coord extremite segment tj >= 0 */ segX, segY; /* coord extremite segment tj >= 0 */
int pointX, pointY;/* coord point a tester dans repere modifie dans lequel int pointX, pointY; /* coord point a tester dans repere modifie dans lequel
* segX et segY sont >=0 */ * segX et segY sont >=0 */
segX = dx; segY = dy; pointX = spot_cX; pointY = spot_cY; segX = dx; segY = dy; pointX = spot_cX; pointY = spot_cY;
...@@ -1264,7 +1282,7 @@ int distance( int seuil ) ...@@ -1264,7 +1282,7 @@ int distance( int seuil )
else /* orientation quelconque */ else /* orientation quelconque */
{ {
/* On fait un changement d'axe (rotation) de facon a ce que le segment /* On fait un changement d'axe (rotation) de facon a ce que le segment
* de piste soit horizontal dans le nouveau repere */ * de piste soit horizontal dans le nouveau repere */
int angle; int angle;
angle = (int) ( atan2( (float) segY, (float) segX ) * 1800 / M_PI); angle = (int) ( atan2( (float) segY, (float) segX ) * 1800 / M_PI);
...@@ -1272,13 +1290,14 @@ int distance( int seuil ) ...@@ -1272,13 +1290,14 @@ int distance( int seuil )
RotatePoint( &cXrot, &cYrot, angle ); /* Rotation du point a tester */ RotatePoint( &cXrot, &cYrot, angle ); /* Rotation du point a tester */
RotatePoint( &segX, &segY, angle ); /* Rotation du segment */ RotatePoint( &segX, &segY, angle ); /* Rotation du segment */
/*la piste est Horizontale , par suite des modifs de coordonnes /* la piste est Horizontale , par suite des modifs de coordonnes
* et d'axe, donc segX = longueur du segment */ * et d'axe, donc segX = longueur du segment */
if( abs( cYrot ) <= seuil ) /* ok sur axe vertical) */ if( abs( cYrot ) <= seuil ) /* ok sur axe vertical) */
{ {
if( (cXrot >= 0) && (cXrot <= segX) ) if( (cXrot >= 0) && (cXrot <= segX) )
return 1; return 1;
/* Etude des extremites : cercle de rayon seuil */ /* Etude des extremites : cercle de rayon seuil */
if( (cXrot < 0) && (cXrot >= -seuil) ) if( (cXrot < 0) && (cXrot >= -seuil) )
{ {
...@@ -1347,18 +1366,21 @@ TRACK* Fast_Locate_Piste( TRACK* start_adr, TRACK* end_adr, ...@@ -1347,18 +1366,21 @@ TRACK* Fast_Locate_Piste( TRACK* start_adr, TRACK* end_adr,
if( start_adr == NULL ) if( start_adr == NULL )
return NULL; return NULL;
for( PtSegm = start_adr; PtSegm != NULL; PtSegm = (TRACK*) PtSegm->Pnext ) for( PtSegm = start_adr; PtSegm != NULL; PtSegm = (TRACK*) PtSegm->Pnext )
{ {
if( PtSegm->GetState( DELETED | BUSY ) == 0 ) if( PtSegm->GetState( DELETED | BUSY ) == 0 )
{ {
if( ref_pos == PtSegm->m_Start ) if( ref_pos == PtSegm->m_Start )
{ /* Test des couches */ {
/* Test des couches */
if( MaskLayer & PtSegm->ReturnMaskLayer() ) if( MaskLayer & PtSegm->ReturnMaskLayer() )
return PtSegm; return PtSegm;
} }
if( ref_pos == PtSegm->m_End ) if( ref_pos == PtSegm->m_End )
{ /* Test des couches */ {
/* Test des couches */
if( MaskLayer & PtSegm->ReturnMaskLayer() ) if( MaskLayer & PtSegm->ReturnMaskLayer() )
return PtSegm; return PtSegm;
} }
...@@ -1392,7 +1414,8 @@ TRACK* Fast_Locate_Via( TRACK* start_adr, TRACK* end_adr, ...@@ -1392,7 +1414,8 @@ TRACK* Fast_Locate_Via( TRACK* start_adr, TRACK* end_adr,
if( pos == PtSegm->m_Start ) if( pos == PtSegm->m_Start )
{ {
if( PtSegm->GetState( BUSY | DELETED ) == 0 ) if( PtSegm->GetState( BUSY | DELETED ) == 0 )
{ /* Test des couches */ {
/* Test des couches */
if( MaskLayer & PtSegm->ReturnMaskLayer() ) if( MaskLayer & PtSegm->ReturnMaskLayer() )
return PtSegm; return PtSegm;
} }
...@@ -1420,13 +1443,14 @@ EDA_BaseStruct* Locate_MirePcb( EDA_BaseStruct* PtStruct, int LayerSearch, ...@@ -1420,13 +1443,14 @@ EDA_BaseStruct* Locate_MirePcb( EDA_BaseStruct* PtStruct, int LayerSearch,
if( PtStruct == NULL ) if( PtStruct == NULL )
return NULL; return NULL;
SET_REF_POS( ref_pos ); ref_pos = RefPos( typeloc );
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
{ {
MIREPCB* item; MIREPCB* item;
if( PtStruct->m_StructType != TYPEMIRE ) if( PtStruct->m_StructType != TYPEMIRE )
continue; continue;
item = (MIREPCB*) PtStruct; item = (MIREPCB*) PtStruct;
if( LayerSearch != -1 && item->m_Layer != LayerSearch ) if( LayerSearch != -1 && item->m_Layer != LayerSearch )
continue; continue;
...@@ -1434,8 +1458,9 @@ EDA_BaseStruct* Locate_MirePcb( EDA_BaseStruct* PtStruct, int LayerSearch, ...@@ -1434,8 +1458,9 @@ EDA_BaseStruct* Locate_MirePcb( EDA_BaseStruct* PtStruct, int LayerSearch,
dX = ref_pos.x - item->m_Pos.x; dX = ref_pos.x - item->m_Pos.x;
dY = ref_pos.y - item->m_Pos.y; dY = ref_pos.y - item->m_Pos.y;
rayon = item->m_Size / 2; rayon = item->m_Size / 2;
if( (abs( dX ) <= rayon ) && ( abs( dY ) <= rayon ) ) if( (abs( dX ) <= rayon ) && ( abs( dY ) <= rayon ) )
break;/* Mire Localisee */ break; /* Mire Localisee */
} }
return PtStruct; return PtStruct;
......
/**************************************/ /**************************************/
/* PCBNEW.H : dclarations communes */ /* PCBNEW.H : d�larations communes */
/**************************************/ /**************************************/
#ifndef PCBNEW_H #ifndef PCBNEW_H
#define PCBNEW_H #define PCBNEW_H
...@@ -11,68 +11,70 @@ ...@@ -11,68 +11,70 @@
#include "pcbstruct.h" #include "pcbstruct.h"
#include "macros.h" #include "macros.h"
#define U_PCB (PCB_INTERNAL_UNIT/EESCHEMA_INTERNAL_UNIT) #define U_PCB (PCB_INTERNAL_UNIT / EESCHEMA_INTERNAL_UNIT)
/* valeur de flag indicant si le pointeur de reference pour une localisation /* valeur de flag indicant si le pointeur de reference pour une localisation
est le curseur sur grille ou le curseur a deplacement fin hors grille */ * est le curseur sur grille ou le curseur a deplacement fin hors grille */
#define CURSEUR_ON_GRILLE (0<<0) #define CURSEUR_ON_GRILLE (0 << 0)
#define CURSEUR_OFF_GRILLE (1<<0) #define CURSEUR_OFF_GRILLE (1 << 0)
#define IGNORE_LOCKED (1<<1) ///< if module is locked, do not select for single module operation #define IGNORE_LOCKED (1 << 1) ///< if module is locked, do not select for single module operation
#define MATCH_LAYER (1<<2) ///< if module not on current layer, do not select #define MATCH_LAYER (1 << 2) ///< if module not on current layer, do not select
#define VISIBLE_ONLY (1<<3) ///< if module not on a visible layer, do not select #define VISIBLE_ONLY (1 << 3) ///< if module not on a visible layer, do not select
#define START 0 /* ctes parametre dans les routines de localisation */ #define START 0 /* ctes parametre dans les routines de localisation */
#define END 1 #define END 1
#define DIM_ANCRE_MODULE 3 /* dim du symbole de l'ancre (centre) des modules */ #define DIM_ANCRE_MODULE 3 /* dim du symbole de l'ancre (centre) des modules */
#define DIM_ANCRE_TEXTE 2 /* dim du symbole de l'ancre (centre) des textes */ #define DIM_ANCRE_TEXTE 2 /* dim du symbole de l'ancre (centre) des textes */
/* Gestion du Menu Zoom */ /* Gestion du Menu Zoom */
#define ZOOM_PLUS -1 #define ZOOM_PLUS -1
#define ZOOM_MOINS -2 #define ZOOM_MOINS -2
#define ZOOM_AUTO -3 #define ZOOM_AUTO -3
#define ZOOM_CENTER -4 #define ZOOM_CENTER -4
#define ZOOM_REDRAW -5 #define ZOOM_REDRAW -5
/* Bits Flags utiliss en dition (membre .m_Flags de EDA_BaseStruct)*/ /* Bits Flags utilis� en �ition (membre .m_Flags de EDA_BaseStruct)*/
#define IS_LINKED 1 #define IS_LINKED 1
#define IN_EDIT 2 #define IN_EDIT 2
#define IS_MOVED 4 #define IS_MOVED 4
#define IS_NEW 8 #define IS_NEW 8
#define IS_RESIZED 0x10 #define IS_RESIZED 0x10
#define IS_DRAGGED 0x20 #define IS_DRAGGED 0x20
#define STARTPOINT 0x100 #define STARTPOINT 0x100
#define ENDPOINT 0x200 #define ENDPOINT 0x200
#define SELECTED 0x400 #define SELECTED 0x400
/* Definition des cas ou l'on force l'affichage en SKETCH (membre .flags) */ /* Definition des cas ou l'on force l'affichage en SKETCH (membre .flags) */
#define FORCE_SKETCH (DRAG | EDIT ) #define FORCE_SKETCH (DRAG | EDIT )
/* Constantes pour options lecture fichier PCB */ /* Constantes pour options lecture fichier PCB */
#define APPEND_PCB 1 /* pour ajout d'un nouveau circuit */ #define APPEND_PCB 1 /* pour ajout d'un nouveau circuit */
#define NEWPCB 0 /* pour chargement normal */ #define NEWPCB 0 /* pour chargement normal */
eda_global wxArrayString g_LibName_List; // library list to load eda_global wxArrayString g_LibName_List; // library list to load
eda_global wxSize g_GridList[] eda_global wxSize g_GridList[]
#ifdef MAIN #ifdef MAIN
= { = {
wxSize(1000,1000), wxSize(500,500), wxSize(250,250), wxSize(200,200), wxSize( 1000, 1000 ), wxSize( 500, 500 ), wxSize( 250, 250 ), wxSize( 200, 200 ),
wxSize(100,100), wxSize(50,50), wxSize(25,25), wxSize(20,20), wxSize( 100, 100 ), wxSize( 50, 50 ), wxSize( 25, 25 ), wxSize( 20, 20 ),
wxSize(10,10), wxSize(5,5), wxSize(2,2), wxSize(1,1), wxSize( 10, 10 ), wxSize( 5, 5 ), wxSize( 2, 2 ), wxSize( 1, 1 ),
wxSize(-1,-1), wxSize(0,0) wxSize( -1, -1 ), wxSize( 0, 0 )
} }
#endif #endif
; ;
#define UNDELETE_STACK_SIZE 10 #define UNDELETE_STACK_SIZE 10
eda_global EDA_BaseStruct * g_UnDeleteStack[UNDELETE_STACK_SIZE]; //Liste des elements supprimes eda_global EDA_BaseStruct* g_UnDeleteStack[UNDELETE_STACK_SIZE]; //Liste des elements supprimes
eda_global int g_UnDeleteStackPtr; eda_global int g_UnDeleteStackPtr;
eda_global bool g_ShowGrid eda_global bool g_ShowGrid
#ifdef MAIN #ifdef MAIN
= TRUE = TRUE
#endif #endif
...@@ -81,29 +83,30 @@ eda_global bool g_ShowGrid ...@@ -81,29 +83,30 @@ eda_global bool g_ShowGrid
/* Look up Table for conversion one layer number -> one bit layer mask: */ /* Look up Table for conversion one layer number -> one bit layer mask: */
eda_global int g_TabOneLayerMask[LAYER_COUNT] eda_global int g_TabOneLayerMask[LAYER_COUNT]
#if defined MAIN #if defined MAIN
= { 0x00000001,0x00000002,0x00000004,0x00000008, = {
0x00000010,0x00000020,0x00000040,0x00000080, 0x00000001, 0x00000002, 0x00000004, 0x00000008,
0x00000100,0x00000200,0x00000400,0x00000800, 0x00000010, 0x00000020, 0x00000040, 0x00000080,
0x00001000,0x00002000,0x00004000,0x00008000, 0x00000100, 0x00000200, 0x00000400, 0x00000800,
0x00010000,0x00020000,0x00040000,0x00080000, 0x00001000, 0x00002000, 0x00004000, 0x00008000,
0x00100000,0x00200000,0x00400000,0x00800000, 0x00010000, 0x00020000, 0x00040000, 0x00080000,
0x01000000,0x02000000,0x04000000,0x08000000, 0x00100000, 0x00200000, 0x00400000, 0x00800000,
0x10000000,0x20000000,0x40000000,0x80000000 0x01000000, 0x02000000, 0x04000000, 0x08000000,
} 0x10000000, 0x20000000, 0x40000000, 0x80000000
}
#endif #endif
; ;
/* Look up Table for conversion copper layer count -> general copper layer mask: */ /* Look up Table for conversion copper layer count -> general copper layer mask: */
eda_global int g_TabAllCopperLayerMask[NB_COPPER_LAYERS] eda_global int g_TabAllCopperLayerMask[NB_COPPER_LAYERS]
#if defined MAIN #if defined MAIN
= { = {
0x0001, 0x8001, 0x8003, 0x8007, 0x0001, 0x8001, 0x8003, 0x8007,
0x800F, 0x801F, 0x803F, 0x807F, 0x800F, 0x801F, 0x803F, 0x807F,
0x80FF, 0x81FF, 0x83FF, 0x87FF, 0x80FF, 0x81FF, 0x83FF, 0x87FF,
0x8FFF, 0x9FFF, 0xCFFF, 0xFFFF 0x8FFF, 0x9FFF, 0xCFFF, 0xFFFF
}; };
#endif #endif
; ;
/* variables */ /* variables */
...@@ -114,8 +117,8 @@ eda_global bool Drc_On ...@@ -114,8 +117,8 @@ eda_global bool Drc_On
= TRUE = TRUE
#endif #endif
; ;
eda_global bool g_AutoDeleteOldTrack /* autorise effacement automatique eda_global bool g_AutoDeleteOldTrack /* autorise effacement automatique
de l'ancienne piste lors des redessins de pistes */ * de l'ancienne piste lors des redessins de pistes */
#ifdef MAIN #ifdef MAIN
= TRUE = TRUE
#endif #endif
...@@ -135,53 +138,53 @@ eda_global bool g_Raccord_45_Auto ...@@ -135,53 +138,53 @@ eda_global bool g_Raccord_45_Auto
#endif #endif
; ;
eda_global bool g_ShowIsolDuringCreateTrack; /* .State controle l'affichage eda_global bool g_ShowIsolDuringCreateTrack; /* .State controle l'affichage
de l'isolation en trace de piste */ * de l'isolation en trace de piste */
/**************************************************************/ /**************************************************************/
/* Options d'affichages (remplissages des segments, textes..) */ /* Options d'affichages (remplissages des segments, textes..) */
/**************************************************************/ /**************************************************************/
eda_global DISPLAY_OPTIONS DisplayOpt; eda_global DISPLAY_OPTIONS DisplayOpt;
eda_global bool Track_45_Only; /* Flag pour limiter l'inclinaison eda_global bool Track_45_Only; /* Flag pour limiter l'inclinaison
pistes a 45 degres seulement */ * pistes a 45 degres seulement */
eda_global bool Segments_45_Only ; /* Flag pour limiter l'inclinaison eda_global bool Segments_45_Only;/* Flag pour limiter l'inclinaison
edge pcb a 45 degres seulement */ * edge pcb a 45 degres seulement */
eda_global wxString PcbExtBuffer eda_global wxString PcbExtBuffer
#ifdef MAIN #ifdef MAIN
( wxT(".brd")) ( wxT( ".brd" ) )
#endif #endif
; ;
eda_global wxString g_SaveFileName // File Name for periodic saving eda_global wxString g_SaveFileName // File Name for periodic saving
#ifdef MAIN #ifdef MAIN
( wxT("$savepcb") ) ( wxT( "$savepcb" ) )
#endif #endif
; ;
eda_global wxString NetNameBuffer; eda_global wxString NetNameBuffer;
eda_global wxString NetExtBuffer eda_global wxString NetExtBuffer
#ifdef MAIN #ifdef MAIN
( wxT(".net") ) ( wxT( ".net" ) )
#endif #endif
; ;
eda_global wxString NetCmpExtBuffer eda_global wxString NetCmpExtBuffer
#ifdef MAIN #ifdef MAIN
( wxT(".cmp") ) ( wxT( ".cmp" ) )
#endif #endif
; ;
// Gestion de la liste des librairies // Gestion de la liste des librairies
eda_global wxString LibExtBuffer eda_global wxString LibExtBuffer
#ifdef MAIN #ifdef MAIN
( wxT(".mod") ) ( wxT( ".mod" ) )
#endif #endif
; ;
eda_global wxString g_Shapes3DExtBuffer // extension des fichiers de formes 3D eda_global wxString g_Shapes3DExtBuffer // extension des fichiers de formes 3D
#ifdef MAIN #ifdef MAIN
( wxT(".wrl") ) ( wxT( ".wrl" ) )
#endif #endif
; ;
eda_global int g_NetType; // for cvpcb: Net type identifier eda_global int g_NetType; // for cvpcb: Net type identifier
eda_global int g_CurrentVersionPCB eda_global int g_CurrentVersionPCB
#ifdef MAIN #ifdef MAIN
...@@ -189,33 +192,33 @@ eda_global int g_CurrentVersionPCB ...@@ -189,33 +192,33 @@ eda_global int g_CurrentVersionPCB
#endif #endif
; ;
#define BUFMEMSIZE 256000 /* taille du buffer de travail (en octets) */ #define BUFMEMSIZE 256000 /* taille du buffer de travail (en octets) */
eda_global char *buf_work ; /* pointeur sur le buffer de travail */ eda_global char* buf_work; /* pointeur sur le buffer de travail */
eda_global char * adr_lowmem ; /* adresse de base memoire de calcul disponible*/ eda_global char* adr_lowmem; /* adresse de base memoire de calcul disponible*/
eda_global char * adr_himem ; /* adresse haute limite de la memoire disponible*/ eda_global char* adr_himem; /* adresse haute limite de la memoire disponible*/
eda_global char * adr_max ; /* adresse haute maxi utilisee pour la memoire */ eda_global char* adr_max; /* adresse haute maxi utilisee pour la memoire */
/* variables gnerales */ /* variables gerales */
eda_global char cbuf[1024] ; /* buffer de formatage texte */ eda_global char cbuf[1024]; /* buffer de formatage texte */
eda_global BOARD * g_ModuleEditor_Pcb; /* Pointeur de l'entete pcb de l'editeur de module*/ eda_global BOARD* g_ModuleEditor_Pcb; /* Pointeur de l'entete pcb de l'editeur de module*/
eda_global int g_TimeOut; // Duree entre 2 sauvegardes automatiques eda_global int g_TimeOut; // Duree entre 2 sauvegardes automatiques
eda_global int g_SaveTime; // heure de la prochaine sauvegarde eda_global int g_SaveTime; // heure de la prochaine sauvegarde
/* Variables generales d'empreintes */ /* Variables generales d'empreintes */
extern int Angle_Rot_Module; extern int Angle_Rot_Module;
eda_global wxSize ModuleTextSize; /* dim des textes sur Modules par defaut */ eda_global wxSize ModuleTextSize; /* dim des textes sur Modules par defaut */
eda_global int ModuleTextWidth; eda_global int ModuleTextWidth;
eda_global int ModuleSegmentWidth; eda_global int ModuleSegmentWidth;
eda_global int Texte_Module_Type; eda_global int Texte_Module_Type;
/***********************/ /***********************/
/* pistes , vias , pads*/ /* pistes , vias , pads*/
/***********************/ /***********************/
#define L_MIN_DESSIN 1 /* seuil de largeur des pistes pour trace autre que filaire */ #define L_MIN_DESSIN 1 /* seuil de largeur des pistes pour trace autre que filaire */
// Current designe settings: // Current designe settings:
eda_global class EDA_BoardDesignSettings g_DesignSettings; eda_global class EDA_BoardDesignSettings g_DesignSettings;
...@@ -223,19 +226,20 @@ eda_global class EDA_BoardDesignSettings g_DesignSettings; ...@@ -223,19 +226,20 @@ eda_global class EDA_BoardDesignSettings g_DesignSettings;
// valeurs par defaut des caract. des pads // valeurs par defaut des caract. des pads
#ifndef GERBVIEW #ifndef GERBVIEW
#ifdef MAIN #ifdef MAIN
D_PAD g_Pad_Master( (MODULE *) NULL); D_PAD g_Pad_Master( (MODULE*) NULL );
#else #else
extern D_PAD g_Pad_Master; extern D_PAD g_Pad_Master;
#endif #endif
#endif #endif
eda_global int Route_Layer_TOP ; eda_global int Route_Layer_TOP;
eda_global int Route_Layer_BOTTOM; /* couches de routage actif */ eda_global int Route_Layer_BOTTOM; /* couches de routage actif */
eda_global int g_MaxLinksShowed; // determine le nombre max de links affichs eda_global int g_MaxLinksShowed; // determine le nombre max de links affich�
// en routage manuel // en routage manuel
eda_global bool g_TwoSegmentTrackBuild // FALSE = 1 segment build, TRUE = 2 45 deg segm build eda_global bool g_TwoSegmentTrackBuild // FALSE = 1 segment build, TRUE = 2 45 deg segm build
#ifdef MAIN #ifdef MAIN
= TRUE = TRUE
#endif #endif
...@@ -243,71 +247,74 @@ eda_global bool g_TwoSegmentTrackBuild // FALSE = 1 segment build, TRUE = 2 45 d ...@@ -243,71 +247,74 @@ eda_global bool g_TwoSegmentTrackBuild // FALSE = 1 segment build, TRUE = 2 45 d
/* How to handle magentic pad: feature to move the pcb cursor on a pad center */ /* How to handle magentic pad: feature to move the pcb cursor on a pad center */
enum MagneticPadOptionValues { enum MagneticPadOptionValues {
no_effect, no_effect,
capture_cursor_in_track_tool, capture_cursor_in_track_tool,
capture_always capture_always
}; };
eda_global int g_MagneticPadOption eda_global int g_MagneticPadOption
#ifdef MAIN #ifdef MAIN
= capture_cursor_in_track_tool = capture_cursor_in_track_tool
#endif #endif
; ;
eda_global bool g_HightLigt_Status; eda_global bool g_HightLigt_Status;
eda_global int g_HightLigth_NetCode /* pour mise en surbrillance des pistes */ eda_global int g_HightLigth_NetCode /* pour mise en surbrillance des pistes */
#ifdef MAIN #ifdef MAIN
= -1 = -1
#endif #endif
; /* net_code du net a mettre en surbrillance */ ; /* net_code du net a mettre en surbrillance */
eda_global TRACK * g_CurrentTrackSegment ; // pointeur sur le segment en cours de trace eda_global TRACK* g_CurrentTrackSegment; // pointeur sur le segment en cours de trace
eda_global TRACK * g_FirstTrackSegment ; // pointeur sur le debut de la piste en cours eda_global TRACK* g_FirstTrackSegment; // pointeur sur le debut de la piste en cours
eda_global int g_TrackSegmentCount ; // nombre de points deja traces eda_global int g_TrackSegmentCount; // nombre de points deja traces
eda_global wxString g_ViaType_Name[4] eda_global wxString g_ViaType_Name[4]
#if defined MAIN #if defined MAIN
= { = {
wxT("???"), // Unused wxT( "???" ), // Unused
_("Blind Via"), // from inner layer to external layer (TOP or BOTTOM) _( "Blind Via" ), // from inner layer to external layer (TOP or BOTTOM)
_("Buried Via"), // from inner to inner layer _( "Buried Via" ), // from inner to inner layer
_("Standard Via") // Usual via (from TOP to BOTTOM layer) _( "Standard Via" ) // Usual via (from TOP to BOTTOM layer)
} }
#endif #endif
; ;
eda_global int g_ViaHoleLastValue; // Last value for non default value via hole eda_global int g_ViaHoleLastValue; // Last value for non default value via hole
/* Couleur de fond affichage de bas d'ecran */ /* Couleur de fond affichage de bas d'ecran */
eda_global int g_PcbGridColor; eda_global int g_PcbGridColor;
/* couleurs des autres items des empreintes */ /* couleurs des autres items des empreintes */
#if defined MAIN #if defined MAIN
int g_PadCMPColor = RED; int g_PadCMPColor = RED;
int g_PadCUColor = GREEN; int g_PadCUColor = GREEN;
int g_AnchorColor = BLUE; int g_AnchorColor = BLUE;
int g_ModuleTextCMPColor = LIGHTGRAY; int g_ModuleTextCMPColor = LIGHTGRAY;
int g_ModuleTextCUColor = MAGENTA; int g_ModuleTextCUColor = MAGENTA;
int g_ModuleTextNOVColor = DARKGRAY; int g_ModuleTextNOVColor = DARKGRAY;
#else #else
eda_global int g_ModuleTextCMPColor; eda_global int g_ModuleTextCMPColor;
eda_global int g_ModuleTextCUColor; eda_global int g_ModuleTextCUColor;
eda_global int g_ModuleTextNOVColor; eda_global int g_ModuleTextNOVColor;
eda_global int g_AnchorColor; eda_global int g_AnchorColor;
eda_global int g_PadCUColor; eda_global int g_PadCUColor;
eda_global int g_PadCMPColor; eda_global int g_PadCMPColor;
#endif #endif
eda_global PCB_SCREEN* ScreenPcb; /* Ecran principal */ eda_global PCB_SCREEN* ScreenPcb; /* Ecran principal */
eda_global PCB_SCREEN* ScreenModule; /* Ecran de l'editeur de modules */ eda_global PCB_SCREEN* ScreenModule; /* Ecran de l'editeur de modules */
/****************************************************/ /****************************************************/
/* Gestion du deplacement des modules et des pistes */ /* Gestion du deplacement des modules et des pistes */
/****************************************************/ /****************************************************/
eda_global wxPoint g_Offset_Module; /* Offset de trace du modul en depl */ eda_global wxPoint g_Offset_Module;/* Offset de trace du modul en depl */
/* Pad editing */ /* Pad editing */
eda_global wxString g_Current_PadName; // Last used pad name (pad num) eda_global wxString g_Current_PadName; // Last used pad name (pad num)
#endif /* PCBNEW_H */ #endif /* PCBNEW_H */
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