Commit 49e32e09 authored by dickelbeck's avatar dickelbeck

unified m_Flags, EDA_BaseStruct::Display_Infos(), and ~GetEquipot()

parent 0421987b
...@@ -4,6 +4,26 @@ Started 2007-June-11 ...@@ -4,6 +4,26 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2007-Aug-20 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+ pcbnew & eeschema
* Moved allowed m_Flags values from pcbnew.h, general.h, and eeschema/delete.cpp to base_struct.h
near m_Flags itself. Several of the flags values were changed. I am only
comfortable with this change if m_Flags is not written to disk anywhere,
and we need to give that some thought. If m_Flags is a memory only usage
and not saved to disk, then this change should be safe. I could not find
any case where m_Flags was being saved do disk, but I could have missed one.
The reason for the change was to consolidate into one place the allowed values
so that as new flags are allowed there is no conflict.
* Moved most all the pcbnew/affiche.cpp functions to member functions of their
respective classes with the name Display_Infos().
* Moved GetEquipot() global function to BOARD::FindNet().
These changes are working towards a concise locate.cpp module, on the way
to implementing the multiple choice support. Mass edits should be slowing down
in a day or so.
2007-Aug-20 UPDATE Geoff Harland <gharlandau@yahoo.com.au> 2007-Aug-20 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
================================================================================ ================================================================================
+ eeschema & pcbnew + eeschema & pcbnew
...@@ -14,13 +34,13 @@ email address. ...@@ -14,13 +34,13 @@ email address.
2007-aug-20 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2007-aug-20 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+ eeschema & pcbnew + eeschema & pcbnew
modify hotkeys.cpp code (large modifications). modify hotkeys.cpp code (large modifications).
Added: common code in hotkeys_basic.cpp (in common) and hotkeys_basic.h (in include) Added: common code in hotkeys_basic.cpp (in common) and hotkeys_basic.h (in include)
In the future, i hope hotkeys will be programmed by a config file In the future, i hope hotkeys will be programmed by a config file
+ pcbnew + pcbnew
filename drc_dialog.prj changed to dialog_drc.prj filename drc_dialog.prj changed to dialog_drc.prj
(according to the fulename dialog_drc.cpp and dialog_drc.h created by dialogblock from the .prj) (according to the fulename dialog_drc.cpp and dialog_drc.h created by dialogblock from the .prj)
2007-Aug-19 UPDATE Dick Hollenbeck <dick@softplc.com> 2007-Aug-19 UPDATE Dick Hollenbeck <dick@softplc.com>
......
...@@ -13,10 +13,6 @@ ...@@ -13,10 +13,6 @@
#include "protos.h" #include "protos.h"
#define SELECTEDNODE 1 /* flag indiquant que la structure a deja selectionnee */
#define STRUCT_DELETED 2 /* Bit flag de Status pour structures effacee */
#define CANDIDATE 4 /* flag indiquant que la structure est connectee */
#define SKIP_STRUCT 8 /* flag indiquant que la structure ne doit pas etre traitee */
/********************************************************************************/ /********************************************************************************/
static int CountConnectedItems(WinEDA_SchematicFrame * frame, static int CountConnectedItems(WinEDA_SchematicFrame * frame,
......
...@@ -24,18 +24,6 @@ ...@@ -24,18 +24,6 @@
#define HIGHLIGHT_COLOR WHITE #define HIGHLIGHT_COLOR WHITE
/* Flags used in editing commnands (EDA_BaseStruct, .Flags )*/
#define IS_CHANGED 1
#define IS_LINKED 2
#define IS_MOVED 4
#define IS_NEW 8
#define IS_DELETED 0x10
#define IS_RESIZED 0x20
#define IN_EDIT 0x40
#define IS_WIRE_IMAGE 0x100
#define STARTPOINT 0x200
#define ENDPOINT 0x400
#define SELECTED 0x800
/* Used for EDA_BaseStruct, .m_Select member */ /* Used for EDA_BaseStruct, .m_Select member */
#define IS_SELECTED 1 #define IS_SELECTED 1
......
/***************************************************/ /***************************************************/
/* Localisation des elements pointes par la souris */ /* Localisation des elements pointes par la souris */
/***************************************************/ /***************************************************/
#include "fctsys.h" #include "fctsys.h"
...@@ -12,139 +12,148 @@ ...@@ -12,139 +12,148 @@
/* variables locales */ /* variables locales */
int ux0 , uy0 ,dx, dy, spot_cX, spot_cY; /* Variables utilisees pour int ux0, uy0, dx, dy, spot_cX, spot_cY; /* Variables utilisees pour
la localisation des segments */ * la localisation des segments */
/* fonctions locales */ /* fonctions locales */
static TRACK * Locate_Zone(TRACK * start_adresse,int layer, int typeloc ); static TRACK* Locate_Zone( TRACK* start_adresse, int layer, int typeloc );
static TRACK * Locate_Zone(TRACK * start_adresse, wxPoint ref, int layer); static TRACK* Locate_Zone( TRACK* start_adresse, wxPoint ref, int layer );
static TRACK * Locate_Pistes(TRACK * start_adresse,int Layer, int typeloc ); static TRACK* Locate_Pistes( TRACK* start_adresse, int Layer, int typeloc );
static TRACK * Locate_Pistes(TRACK * start_adresse, wxPoint ref,int Layer); static TRACK* Locate_Pistes( TRACK* start_adresse, wxPoint ref, int Layer );
static DRAWSEGMENT * Locate_Segment_Pcb(BOARD * Pcb, int typeloc); static DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int typeloc );
static TEXTE_PCB * Locate_Texte_Pcb(TEXTE_PCB* pt_txt_pcb, int typeloc); static TEXTE_PCB* Locate_Texte_Pcb( TEXTE_PCB* pt_txt_pcb, int typeloc );
static int distance(int seuil); static int distance( int seuil );
/**/ /**/
/* Macro de calcul de la coord de pointage selon le curseur /* Macro de calcul de la coord de pointage selon le curseur
(ON/OFF grille) choisi * (ON/OFF grille) choisi
*/ */
#define SET_REF_POS(ref) if(typeloc == CURSEUR_ON_GRILLE) \ #define SET_REF_POS( ref ) if( typeloc == CURSEUR_ON_GRILLE ) \
{ ref = ActiveScreen->m_Curseur;} \ { ref = ActiveScreen->m_Curseur; } \
else { ref = ActiveScreen->m_MousePosition; } else { ref = ActiveScreen->m_MousePosition; }
/*************************************************************/ /*************************************************************/
EDA_BaseStruct * WinEDA_GerberFrame::Locate( int typeloc ) EDA_BaseStruct* WinEDA_GerberFrame::Locate( int typeloc )
/*************************************************************/ /*************************************************************/
/* Fonction de localisation generale /* Fonction de localisation generale
Affiche les caract de la stucture localisée et retourne un pointeur * Affiche les caract de la stucture localisée et retourne un pointeur
sur celle-ci * sur celle-ci
*/ */
{ {
TEXTE_PCB * pt_texte_pcb; TEXTE_PCB* pt_texte_pcb;
TRACK * Track , * TrackLocate ; TRACK* Track, * TrackLocate;
DRAWSEGMENT * DrawSegm; DRAWSEGMENT* DrawSegm;
int layer; int layer;
/* Localistion des pistes et vias, avec priorite aux vias */ /* Localistion des pistes et vias, avec priorite aux vias */
layer = GetScreen()->m_Active_Layer; layer = GetScreen()->m_Active_Layer;
Track = Locate_Pistes( m_Pcb->m_Track, -1, typeloc ); Track = Locate_Pistes( m_Pcb->m_Track, -1, typeloc );
if ( Track != NULL ) if( Track != NULL )
{ {
TrackLocate = Track ; /* Reperage d'une piste ou via */ TrackLocate = Track; /* Reperage d'une piste ou via */
/* recherche de 1 via eventuelle */ /* recherche de 1 via eventuelle */
while((TrackLocate = Locate_Pistes(TrackLocate, layer,typeloc)) != NULL ) while( ( TrackLocate = Locate_Pistes( TrackLocate, layer, typeloc ) ) != NULL )
{ {
Track = TrackLocate; Track = TrackLocate;
if(TrackLocate->m_StructType == TYPEVIA) break ; if( TrackLocate->m_StructType == TYPEVIA )
TrackLocate = (TRACK*) TrackLocate->Pnext; break;
} TrackLocate = (TRACK*) TrackLocate->Pnext;
Affiche_Infos_Piste(this, Track) ; }
return Track;
} Track->Display_Infos( this );
return Track;
}
pt_texte_pcb = Locate_Texte_Pcb((TEXTE_PCB*) m_Pcb->m_Drawings, typeloc);
if(pt_texte_pcb ) // texte type PCB localise
{ pt_texte_pcb = Locate_Texte_Pcb( (TEXTE_PCB*) m_Pcb->m_Drawings, typeloc );
Affiche_Infos_PCB_Texte(this, pt_texte_pcb); return pt_texte_pcb; if( pt_texte_pcb ) // texte type PCB localise
} {
pt_texte_pcb->Display_Infos( this );
if ( (DrawSegm = Locate_Segment_Pcb(m_Pcb, typeloc)) != NULL) return pt_texte_pcb;
{ }
return DrawSegm;
} if( ( DrawSegm = Locate_Segment_Pcb( m_Pcb, typeloc ) ) != NULL )
{
if( (TrackLocate = Locate_Zone((TRACK*)m_Pcb->m_Zone, return DrawSegm;
GetScreen()->m_Active_Layer,typeloc)) != NULL ) }
{
Affiche_Infos_Piste(this, TrackLocate) ; return TrackLocate; if( ( TrackLocate = Locate_Zone( (TRACK*) m_Pcb->m_Zone,
} GetScreen()->m_Active_Layer, typeloc ) ) != NULL )
{
MsgPanel->EraseMsgBox(); TrackLocate->Display_Infos( this );
return NULL; return TrackLocate;
}
MsgPanel->EraseMsgBox();
return NULL;
} }
/********************************************************/ /********************************************************/
DRAWSEGMENT * Locate_Segment_Pcb(BOARD * Pcb, int typeloc) DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int typeloc )
/********************************************************/ /********************************************************/
/* Localisation de segments de contour du type edge pcb ou draw /* Localisation de segments de contour du type edge pcb ou draw
(selon couche active) * (selon couche active)
Retourne: * Retourne:
Pointeur sur DEBUT du segment localise * Pointeur sur DEBUT du segment localise
NULL si rien trouve * NULL si rien trouve
*/ */
{ {
EDA_BaseStruct * PtStruct; EDA_BaseStruct* PtStruct;
DRAWSEGMENT * pts; DRAWSEGMENT* pts;
wxPoint ref; wxPoint ref;
PCB_SCREEN * screen = (PCB_SCREEN *) ActiveScreen; PCB_SCREEN* screen = (PCB_SCREEN*) ActiveScreen;
SET_REF_POS(ref);
SET_REF_POS( ref );
PtStruct = Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) PtStruct = Pcb->m_Drawings;
{ for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
if( PtStruct->m_StructType != TYPEDRAWSEGMENT ) continue; {
pts = ( DRAWSEGMENT * ) PtStruct; if( PtStruct->m_StructType != TYPEDRAWSEGMENT )
ux0 = pts->m_Start.x ; uy0 = pts->m_Start.y; continue;
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */ pts = (DRAWSEGMENT*) PtStruct;
dx = pts->m_End.x - ux0 ; dy = pts->m_End.y - uy0 ; ux0 = pts->m_Start.x; uy0 = pts->m_Start.y;
spot_cX = ref.x - ux0; spot_cY = ref.y - uy0 ; /* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
dx = pts->m_End.x - ux0; dy = pts->m_End.y - uy0;
/* detection : */ spot_cX = ref.x - ux0; spot_cY = ref.y - uy0;
if(pts->m_Layer != screen->m_Active_Layer) continue;
/* detection : */
if( (pts->m_Shape == S_CIRCLE) || (pts->m_Shape == S_ARC) ) if( pts->m_Layer != screen->m_Active_Layer )
{ continue;
int rayon, dist, StAngle, EndAngle, MouseAngle;
rayon = (int) hypot((double)(dx),(double)(dy) ); if( (pts->m_Shape == S_CIRCLE) || (pts->m_Shape == S_ARC) )
dist = (int) hypot((double)(spot_cX),(double)(spot_cY) ); {
if( abs(rayon-dist) <= (pts->m_Width/2) ) int rayon, dist, StAngle, EndAngle, MouseAngle;
{ rayon = (int) hypot( (double) (dx), (double) (dy) );
if(pts->m_Shape == S_CIRCLE) return(pts); dist = (int) hypot( (double) (spot_cX), (double) (spot_cY) );
/* pour un arc, controle complementaire */ if( abs( rayon - dist ) <= (pts->m_Width / 2) )
MouseAngle = (int) ArcTangente(spot_cY, spot_cX); {
StAngle = (int) ArcTangente(dy, dx); if( pts->m_Shape == S_CIRCLE )
EndAngle = StAngle + pts->m_Angle; return pts;
/* pour un arc, controle complementaire */
if( EndAngle > 3600 ) MouseAngle = (int) ArcTangente( spot_cY, spot_cX );
{ StAngle = (int) ArcTangente( dy, dx );
StAngle -= 3600; EndAngle -= 3600; EndAngle = StAngle + pts->m_Angle;
}
if( (MouseAngle >= StAngle) && (MouseAngle <= EndAngle) ) if( EndAngle > 3600 )
return(pts); {
} StAngle -= 3600; EndAngle -= 3600;
} }
if( (MouseAngle >= StAngle) && (MouseAngle <= EndAngle) )
else return pts;
{ }
if( distance( pts->m_Width /2 ) ) return( pts ) ; }
} else
} {
return(NULL) ; if( distance( pts->m_Width / 2 ) )
return pts;
}
}
return NULL;
} }
...@@ -154,294 +163,303 @@ PCB_SCREEN * screen = (PCB_SCREEN *) ActiveScreen; ...@@ -154,294 +163,303 @@ PCB_SCREEN * screen = (PCB_SCREEN *) ActiveScreen;
/****************************************************************************/ /****************************************************************************/
/* /*
1 - routine de localisation du segment de piste pointe par la souris. * 1 - routine de localisation du segment de piste pointe par la souris.
2 - routine de localisation du segment de piste pointe par le point * 2 - routine de localisation du segment de piste pointe par le point
ref_pX , ref_pY.r * ref_pX , ref_pY.r
*
La recherche commence a l'adresse start_adresse * La recherche commence a l'adresse start_adresse
*/ */
TRACK * Locate_Pistes(TRACK * start_adresse,int Layer, int typeloc ) TRACK* Locate_Pistes( TRACK* start_adresse, int Layer, int typeloc )
{ {
wxPoint ref; wxPoint ref;
SET_REF_POS(ref); SET_REF_POS( ref );
return( Locate_Pistes(start_adresse, ref, Layer) ); return Locate_Pistes( start_adresse, ref, Layer );
} }
TRACK * Locate_Pistes(TRACK * start_adresse, wxPoint ref, int Layer) TRACK* Locate_Pistes( TRACK* start_adresse, wxPoint ref, int Layer )
{ {
TRACK * Track; /* pointeur sur les pistes */ TRACK* Track; /* pointeur sur les pistes */
int l_piste ; /* demi-largeur de la piste */ int l_piste; /* demi-largeur de la piste */
for( Track = start_adresse; Track != NULL; Track = (TRACK*) Track->Pnext) for( Track = start_adresse; Track != NULL; Track = (TRACK*) Track->Pnext )
{ {
if( Track->GetState(BUSY|DELETED) ) continue; if( Track->GetState( BUSY | DELETED ) )
/* calcul des coordonnees du segment teste */ continue;
l_piste = Track->m_Width >> 1; /* l_piste = demi largeur piste */ /* calcul des coordonnees du segment teste */
ux0 = Track->m_Start.x ; uy0 = Track->m_Start.y ; /* coord de depart */ l_piste = Track->m_Width >> 1; /* l_piste = demi largeur piste */
dx = Track->m_End.x ; dy = Track->m_End.y ; /* coord d'arrivee */ ux0 = Track->m_Start.x; uy0 = Track->m_Start.y; /* coord de depart */
dx = Track->m_End.x; dy = Track->m_End.y; /* coord d'arrivee */
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
dx -= ux0 ; dy -= uy0 ; /* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
spot_cX = ref.x - ux0 ; spot_cY = ref.y - uy0 ; dx -= ux0; dy -= uy0;
spot_cX = ref.x - ux0; spot_cY = ref.y - uy0;
if ( Track->m_StructType == TYPEVIA ) /* VIA rencontree */
{ if( Track->m_StructType == TYPEVIA ) /* VIA rencontree */
if ((abs(spot_cX) <= l_piste ) && (abs(spot_cY) <=l_piste)) {
{ if( (abs( spot_cX ) <= l_piste ) && (abs( spot_cY ) <=l_piste) )
return(Track) ; {
} return Track;
continue ; }
} continue;
}
if(Layer >= 0)
if( Track->m_Layer != Layer ) if( Layer >= 0 )
continue; /* Segments sur couches differentes */ if( Track->m_Layer != Layer )
if( distance(l_piste) ) return(Track) ; continue;/* Segments sur couches differentes */
} if( distance( l_piste ) )
return(NULL) ; return Track;
}
return NULL;
} }
/****************************************************************/
/* TRACK * Locate_Zone(TRACK * start_adresse, int layer, */
/* int typeloc) */
/* TRACK * Locate_Zone(TRACK * start_adresse,wxPoint ref, int layer) */
/****************************************************************/
/* /****************************************************************/
1 - routine de localisation du segment de zone pointe par la souris. /* TRACK * Locate_Zone(TRACK * start_adresse, int layer, */
2 - routine de localisation du segment de zone pointe par le point /* int typeloc) */
ref_pX , ref_pY.r /* TRACK * Locate_Zone(TRACK * start_adresse,wxPoint ref, int layer) */
/****************************************************************/
Si layer == -1 , le tst de la couche n'est pas fait
La recherche commence a l'adresse start_adresse /*
*/ * 1 - routine de localisation du segment de zone pointe par la souris.
* 2 - routine de localisation du segment de zone pointe par le point
TRACK * Locate_Zone(TRACK * start_adresse,int layer, int typeloc ) * ref_pX , ref_pY.r
*
* Si layer == -1 , le tst de la couche n'est pas fait
*
* La recherche commence a l'adresse start_adresse
*/
TRACK* Locate_Zone( TRACK* start_adresse, int layer, int typeloc )
{ {
wxPoint ref; wxPoint ref;
SET_REF_POS(ref); SET_REF_POS( ref );
return( Locate_Zone(start_adresse, ref, layer) ); return Locate_Zone( start_adresse, ref, layer );
} }
TRACK * Locate_Zone(TRACK * start_adresse, wxPoint ref, int layer) TRACK* Locate_Zone( TRACK* start_adresse, wxPoint ref, int layer )
{ {
TRACK * Zone; /* pointeur sur les pistes */ TRACK* Zone; /* pointeur sur les pistes */
int l_segm ; /* demi-largeur de la piste */ int l_segm; /* demi-largeur de la piste */
for( Zone = start_adresse; Zone != NULL; Zone = (TRACK *) Zone->Pnext) for( Zone = start_adresse; Zone != NULL; Zone = (TRACK*) Zone->Pnext )
{ {
/* calcul des coordonnees du segment teste */ /* calcul des coordonnees du segment teste */
l_segm = Zone->m_Width >> 1; /* l_piste = demi largeur piste */ l_segm = Zone->m_Width >> 1; /* l_piste = demi largeur piste */
ux0 = Zone->m_Start.x ; uy0 = Zone->m_Start.y ; /* coord de depart */ ux0 = Zone->m_Start.x; uy0 = Zone->m_Start.y; /* coord de depart */
dx = Zone->m_End.x ; dy = Zone->m_End.y ; /* coord d'arrivee */ dx = Zone->m_End.x; dy = Zone->m_End.y; /* coord d'arrivee */
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */ /* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
dx -= ux0 ; dy -= uy0 ; dx -= ux0; dy -= uy0;
spot_cX = ref.x - ux0 ; spot_cY = ref.y - uy0 ; spot_cX = ref.x - ux0; spot_cY = ref.y - uy0;
if((layer != -1) && (Zone->m_Layer != layer)) continue; if( (layer != -1) && (Zone->m_Layer != layer) )
if( distance(l_segm) ) return(Zone) ; continue;
} if( distance( l_segm ) )
return(NULL) ; return Zone;
}
return NULL;
} }
/***************************************************************/
/* TEXTE_PCB * Locate_Texte_Pcb(char * pt_txt_pcb,int typeloc) */
/***************************************************************/
/***************************************************************/ /* localisation des inscriptions sur le Pcb:
/* TEXTE_PCB * Locate_Texte_Pcb(char * pt_txt_pcb,int typeloc) */ * entree : char pointeur sur le debut de la zone de recherche
/***************************************************************/ * retour : pointeur sur la description du texte localise
*/
/* localisation des inscriptions sur le Pcb: TEXTE_PCB* Locate_Texte_Pcb( TEXTE_PCB* pt_txt_pcb, int typeloc )
entree : char pointeur sur le debut de la zone de recherche
retour : pointeur sur la description du texte localise
*/
TEXTE_PCB * Locate_Texte_Pcb(TEXTE_PCB* pt_txt_pcb, int typeloc)
{ {
int angle ; int angle;
EDA_BaseStruct * PtStruct; EDA_BaseStruct* PtStruct;
wxPoint ref; wxPoint ref;
SET_REF_POS(ref); SET_REF_POS( ref );
PtStruct = (EDA_BaseStruct *) pt_txt_pcb ; PtStruct = (EDA_BaseStruct*) pt_txt_pcb;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
{ {
if( PtStruct->m_StructType != TYPETEXTE ) continue; if( PtStruct->m_StructType != TYPETEXTE )
pt_txt_pcb = (TEXTE_PCB *) PtStruct; continue;
pt_txt_pcb = (TEXTE_PCB*) PtStruct;
angle = pt_txt_pcb->m_Orient;
ux0 = pt_txt_pcb->m_Pos.x; uy0 = pt_txt_pcb->m_Pos.y; angle = pt_txt_pcb->m_Orient;
dx = (pt_txt_pcb->m_Size.x * pt_txt_pcb->GetLength()) / 2; ux0 = pt_txt_pcb->m_Pos.x; uy0 = pt_txt_pcb->m_Pos.y;
dy = pt_txt_pcb->m_Size.y /2 ; dx = ( pt_txt_pcb->m_Size.x * pt_txt_pcb->GetLength() ) / 2;
dy = pt_txt_pcb->m_Size.y / 2;
dx *= 13; dx /= 9; /* Facteur de forme des lettres : 13/9 */
dx *= 13; dx /= 9; /* Facteur de forme des lettres : 13/9 */
/* la souris est-elle dans ce rectangle autour du centre */
spot_cX = ref.x - ux0 ; spot_cY = ref.y - uy0 ; /* la souris est-elle dans ce rectangle autour du centre */
RotatePoint(&spot_cX, &spot_cY, -angle); spot_cX = ref.x - ux0; spot_cY = ref.y - uy0;
if( (abs(spot_cX) <= abs(dx) ) && ( abs(spot_cY) <= abs(dy) ) ) RotatePoint( &spot_cX, &spot_cY, -angle );
return(pt_txt_pcb) ; if( ( abs( spot_cX ) <= abs( dx ) ) && ( abs( spot_cY ) <= abs( dy ) ) )
} return pt_txt_pcb;
return(NULL) ; }
return NULL;
} }
/*****************************/
/*****************************/ /* int distance(int seuil) */
/* int distance(int seuil) */ /*****************************/
/*****************************/
/* /*
Calcul de la distance du curseur souris a un segment de droite : * Calcul de la distance du curseur souris a un segment de droite :
( piste, edge, contour module .. * ( piste, edge, contour module ..
retourne: * retourne:
0 si distance > seuil * 0 si distance > seuil
1 si distance <= seuil * 1 si distance <= seuil
Variables utilisees ( doivent etre initialisees avant appel , et * Variables utilisees ( doivent etre initialisees avant appel , et
sont ramenees au repere centre sur l'origine du segment) * sont ramenees au repere centre sur l'origine du segment)
dx, dy = coord de l'extremite segment. * dx, dy = coord de l'extremite segment.
spot_cX,spot_cY = coord du curseur souris * spot_cX,spot_cY = coord du curseur souris
la recherche se fait selon 4 cas: * la recherche se fait selon 4 cas:
segment horizontal * segment horizontal
segment vertical * segment vertical
segment 45 * segment 45
segment quelconque * segment quelconque
*/ */
int distance(int seuil) 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;
/*Recalcul coord pour que le segment soit dans 1er quadrant (coord >= 0)*/ /*Recalcul coord pour que le segment soit dans 1er quadrant (coord >= 0)*/
if (segX < 0) /* mise en >0 par symetrie par rapport a l'axe Y */ if( segX < 0 ) /* mise en >0 par symetrie par rapport a l'axe Y */
{ {
segX = -segX ; pointX = - pointX ; segX = -segX; pointX = -pointX;
} }
if (segY < 0) /* mise en > 0 par symetrie par rapport a l'axe X */ if( segY < 0 ) /* mise en > 0 par symetrie par rapport a l'axe X */
{ {
segY = -segY ; pointY = -pointY ; segY = -segY; pointY = -pointY;
} }
if ( segY == 0 ) /* piste Horizontale */ if( segY == 0 ) /* piste Horizontale */
{ {
if(abs(pointY) <= seuil ) if( abs( pointY ) <= seuil )
{ {
if((pointX >= 0) && (pointX <= segX) ) return(1); if( (pointX >= 0) && (pointX <= segX) )
/* Etude des extremites : cercle de rayon seuil */ return 1;
if( (pointX < 0) && (pointX >= -seuil) ) /* Etude des extremites : cercle de rayon seuil */
{ if( (pointX < 0) && (pointX >= -seuil) )
if( ((pointX * pointX) + (pointY*pointY)) <= (seuil*seuil) ) {
return(1); if( ( (pointX * pointX) + (pointY * pointY) ) <= (seuil * seuil) )
} return 1;
if( (pointX > segX) && (pointX <= (segX+seuil)) ) }
{ if( (pointX > segX) && ( pointX <= (segX + seuil) ) )
if( (((pointX-segX) * (pointX-segX)) + (pointY*pointY)) <= (seuil*seuil) ) {
return(1); if( ( ( (pointX - segX) * (pointX - segX) ) + (pointY * pointY) ) <=
} (seuil * seuil) )
} return 1;
} }
}
else if ( segX == 0 ) /* piste verticale */ }
{ else if( segX == 0 ) /* piste verticale */
if( abs(pointX) <= seuil) {
{ if( abs( pointX ) <= seuil )
if((pointY >= 0 ) && (pointY <= segY) ) return(1); {
if( (pointY < 0) && (pointY >= -seuil) ) if( (pointY >= 0 ) && (pointY <= segY) )
{ return 1;
if( ((pointY * pointY) + (pointX*pointX)) <= (seuil*seuil) ) if( (pointY < 0) && (pointY >= -seuil) )
return(1); {
} if( ( (pointY * pointY) + (pointX * pointX) ) <= (seuil * seuil) )
if( (pointY > segY) && (pointY <= (segY+seuil)) ) return 1;
{ }
if( ( ((pointY-segY) * (pointY-segY)) + (pointX*pointX)) <= (seuil*seuil) ) if( (pointY > segY) && ( pointY <= (segY + seuil) ) )
return(1); {
} if( ( ( (pointY - segY) * (pointY - segY) ) + (pointX * pointX) ) <=
} (seuil * seuil) )
} return 1;
}
else if ( segX == segY ) /* piste a 45 degre */ }
{ }
/* on fait tourner les axes de 45 degre. la souris a alors les else if( segX == segY ) /* piste a 45 degre */
coord : x1 = x*cos45 + y*sin45 {
y1 = y*cos45 - x*sin45 /* on fait tourner les axes de 45 degre. la souris a alors les
et le segment de piste est alors horizontal. * coord : x1 = x*cos45 + y*sin45
recalcul des coord de la souris ( sin45 = cos45 = .707 = 7/10 * y1 = y*cos45 - x*sin45
remarque : sin ou cos45 = .707, et lors du recalcul des coord * et le segment de piste est alors horizontal.
dx45 et dy45, lec coeff .707 est neglige, dx et dy sont en fait .707 fois * recalcul des coord de la souris ( sin45 = cos45 = .707 = 7/10
trop grands. (c.a.d trop petits) * remarque : sin ou cos45 = .707, et lors du recalcul des coord
spot_cX,Y doit etre * par .707 * .707 = 0.5 */ * dx45 et dy45, lec coeff .707 est neglige, dx et dy sont en fait .707 fois
* trop grands. (c.a.d trop petits)
cXrot = (pointX + pointY) >> 1 ; * spot_cX,Y doit etre * par .707 * .707 = 0.5 */
cYrot = (pointY - pointX) >> 1 ;
cXrot = (pointX + pointY) >> 1;
/* recalcul des coord de l'extremite du segment , qui sera vertical cYrot = (pointY - pointX) >> 1;
suite a l'orientation des axes sur l'ecran : dx45 = pointX (ou pointY)
et est en fait 1,414 plus grand , et dy45 = 0 */ /* recalcul des coord de l'extremite du segment , qui sera vertical
* suite a l'orientation des axes sur l'ecran : dx45 = pointX (ou pointY)
// seuil doit etre * .707 pour tenir compte du coeff de reduction sur dx,dy * et est en fait 1,414 plus grand , et dy45 = 0 */
seuil *= 7 ; seuil /= 10 ;
if ( abs(cYrot) <= seuil) /* ok sur axe vertical) */ // seuil doit etre * .707 pour tenir compte du coeff de reduction sur dx,dy
{ seuil *= 7; seuil /= 10;
if ((cXrot >= 0) && (cXrot <= segX) ) return(1) ; if( abs( cYrot ) <= seuil ) /* ok sur axe vertical) */
{
/* Etude des extremites : cercle de rayon seuil */ if( (cXrot >= 0) && (cXrot <= segX) )
if( (cXrot < 0) && (cXrot >= -seuil) ) return 1;
{
if( ((cXrot * cXrot) + (cYrot*cYrot)) <= (seuil*seuil) ) /* Etude des extremites : cercle de rayon seuil */
return(1); if( (cXrot < 0) && (cXrot >= -seuil) )
} {
if( (cXrot > segX) && (cXrot <= (segX+seuil)) ) if( ( (cXrot * cXrot) + (cYrot * cYrot) ) <= (seuil * seuil) )
{ return 1;
if( (((cXrot-segX) * (cXrot-segX)) + (cYrot*cYrot)) <= (seuil*seuil) ) }
return(1); if( (cXrot > segX) && ( cXrot <= (segX + seuil) ) )
} {
} if( ( ( (cXrot - segX) * (cXrot - segX) ) + (cYrot * cYrot) ) <= (seuil * seuil) )
} return 1;
else /* orientation quelconque */ }
{ }
/* On fait un changement d'axe (rotation) de facon a ce que le segment }
de piste soit horizontal dans le nouveau repere */ else /* orientation quelconque */
int angle; {
/* On fait un changement d'axe (rotation) de facon a ce que le segment
angle = (int)( atan2((float)segY, (float)segX) * 1800 / M_PI) ; * de piste soit horizontal dans le nouveau repere */
cXrot = pointX; cYrot = pointY; int angle;
RotatePoint(&cXrot, &cYrot, angle); /* Rotation du point a tester */
RotatePoint(&segX, &segY, angle) ; /* Rotation du segment */ angle = (int) ( atan2( (float) segY, (float) segX ) * 1800 / M_PI);
cXrot = pointX; cYrot = pointY;
/*la piste est Horizontale , par suite des modifs de coordonnes RotatePoint( &cXrot, &cYrot, angle ); /* Rotation du point a tester */
et d'axe, donc segX = longueur du segment */ RotatePoint( &segX, &segY, angle ); /* Rotation du segment */
if ( abs(cYrot) <= seuil ) /* ok sur axe vertical) */ /*la piste est Horizontale , par suite des modifs de coordonnes
{ * et d'axe, donc segX = longueur du segment */
if ((cXrot >= 0) && (cXrot <= segX) ) return(1) ;
/* Etude des extremites : cercle de rayon seuil */ if( abs( cYrot ) <= seuil ) /* ok sur axe vertical) */
if( (cXrot < 0) && (cXrot >= -seuil) ) {
{ if( (cXrot >= 0) && (cXrot <= segX) )
if( ((cXrot * cXrot) + (cYrot*cYrot)) <= (seuil*seuil) ) return 1;
return(1); /* Etude des extremites : cercle de rayon seuil */
} if( (cXrot < 0) && (cXrot >= -seuil) )
if( (cXrot > segX) && (cXrot <= (segX+seuil)) ) {
{ if( ( (cXrot * cXrot) + (cYrot * cYrot) ) <= (seuil * seuil) )
if( (((cXrot-segX) * (cXrot-segX)) + (cYrot*cYrot)) <= (seuil*seuil) ) return 1;
return(1); }
} if( (cXrot > segX) && ( cXrot <= (segX + seuil) ) )
} {
} if( ( ( (cXrot - segX) * (cXrot - segX) ) + (cYrot * cYrot) ) <= (seuil * seuil) )
return(0) ; return 1;
}
}
}
return 0;
} }
...@@ -83,7 +83,7 @@ enum SEARCH_RESULT { ...@@ -83,7 +83,7 @@ enum SEARCH_RESULT {
typedef DrawStructureType KICAD_T; // shorter name typedef DrawStructureType KICAD_T; // shorter name
class EDA_BaseStruct; class EDA_BaseStruct;
class WinEDA_DrawFrame;
/** /**
* Class INSPECTOR * Class INSPECTOR
...@@ -132,7 +132,26 @@ public: ...@@ -132,7 +132,26 @@ public:
EDA_BaseStruct* m_Parent; /* Linked list: Link (parent struct) */ EDA_BaseStruct* m_Parent; /* Linked list: Link (parent struct) */
EDA_BaseStruct* m_Son; /* Linked list: Link (son struct) */ EDA_BaseStruct* m_Son; /* Linked list: Link (son struct) */
EDA_BaseStruct* m_Image; /* Link to an image copy for undelete or abort command */ EDA_BaseStruct* m_Image; /* Link to an image copy for undelete or abort command */
int m_Flags; // flags for editions and other int m_Flags; // flags for editions and other
#define IS_CHANGED (1<<0)
#define IS_LINKED (1<<1)
#define IN_EDIT (1<<2)
#define IS_MOVED (1<<3)
#define IS_NEW (1<<4)
#define IS_RESIZED (1<<5)
#define IS_DRAGGED (1<<6)
#define IS_DELETED (1<<7)
#define IS_WIRE_IMAGE (1<<8)
#define STARTPOINT (1<<9)
#define ENDPOINT (1<<10)
#define SELECTED (1<<11)
#define SELECTEDNODE (1<<12) ///< flag indiquant que la structure a deja selectionnee
#define STRUCT_DELETED (1<<13) ///< Bit flag de Status pour structures effacee
#define CANDIDATE (1<<14) ///< flag indiquant que la structure est connectee
#define SKIP_STRUCT (1<<15) ///< flag indiquant que la structure ne doit pas etre traitee
unsigned long m_TimeStamp; // Time stamp used for logical links unsigned long m_TimeStamp; // Time stamp used for logical links
int m_Selected; /* Used by block commands, and selective editing */ int m_Selected; /* Used by block commands, and selective editing */
...@@ -178,6 +197,19 @@ public: ...@@ -178,6 +197,19 @@ public:
int draw_mode, int draw_mode,
int Color = -1 ); int Color = -1 );
/**
* Function Display_Infos
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* @param frame A WinEDA_DrawFrame in which to print status information.
*/
virtual void Display_Infos( WinEDA_DrawFrame* frame )
{
// derived classes may implement this
}
/** /**
* Function HitTest * Function HitTest
* tests if the given wxPoint is within the bounds of this object. * tests if the given wxPoint is within the bounds of this object.
......
...@@ -234,6 +234,16 @@ public: ...@@ -234,6 +234,16 @@ public:
bool ComputeBoundaryBox( void ); bool ComputeBoundaryBox( void );
/**
* Function Display_Infos
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Is virtual from EDA_BaseStruct.
* @param frame A WinEDA_BasePcbFrame in which to print status information.
*/
void Display_Infos( WinEDA_DrawFrame* frame );
/** /**
* Function Visit * Function Visit
* may be re-implemented for each derived class in order to handle * may be re-implemented for each derived class in order to handle
...@@ -262,6 +272,15 @@ public: ...@@ -262,6 +272,15 @@ public:
*/ */
EDA_BaseStruct* FindPadOrModule( const wxPoint& refPos, int layer ); EDA_BaseStruct* FindPadOrModule( const wxPoint& refPos, int layer );
/**
* Function FindNet
* searches for a net with the given netcode.
* @param anetcode The netcode to search for.
* @return EQUIPOT* - the net or NULL if not found.
*/
EQUIPOT* FindNet( int anetcode );
#if defined(DEBUG) #if defined(DEBUG)
/** /**
...@@ -340,6 +359,17 @@ public: ...@@ -340,6 +359,17 @@ public:
void Copy( DRAWSEGMENT* source ); void Copy( DRAWSEGMENT* source );
/**
* Function Display_Infos
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Is virtual from EDA_BaseStruct.
* @param frame A WinEDA_BasePcbFrame in which to print status information.
*/
void Display_Infos( WinEDA_DrawFrame* frame );
/** /**
* Function HitTest * Function HitTest
* tests if the given wxPoint is within the bounds of this object. * tests if the given wxPoint is within the bounds of this object.
......
...@@ -14,353 +14,6 @@ ...@@ -14,353 +14,6 @@
/* Routines locales */ /* Routines locales */
/*****************************************************************************/
void Affiche_Infos_PCB_Texte( WinEDA_BasePcbFrame* frame, TEXTE_PCB* pt_texte )
/*****************************************************************************/
/* Affiche en bas d'ecran les caract du texte sur PCB
* Entree :
* pointeur de la description du texte
*/
{
wxString msg;
frame->MsgPanel->EraseMsgBox();
if( pt_texte == NULL )
return;
if( pt_texte->m_StructType == TYPECOTATION )
Affiche_1_Parametre( frame, 1, _( "COTATION" ), pt_texte->m_Text, DARKGREEN );
else
Affiche_1_Parametre( frame, 1, _( "PCB Text" ), pt_texte->m_Text, DARKGREEN );
Affiche_1_Parametre( frame, 28, _( "Layer" ),
ReturnPcbLayerName( pt_texte->m_Layer ),
g_DesignSettings.m_LayerColor[pt_texte->m_Layer] & MASKCOLOR );
Affiche_1_Parametre( frame, 36, _( "Mirror" ), wxEmptyString, GREEN );
if( (pt_texte->m_Miroir & 1) )
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "No" ), DARKGREEN );
else
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Yes" ), DARKGREEN );
msg.Printf( wxT( "%.1f" ), (float) pt_texte->m_Orient / 10 );
Affiche_1_Parametre( frame, 43, _( "Orient" ), msg, DARKGREEN );
valeur_param( pt_texte->m_Width, msg );
Affiche_1_Parametre( frame, 50, _( "Width" ), msg, MAGENTA );
valeur_param( pt_texte->m_Size.x, msg );
Affiche_1_Parametre( frame, 60, _( "H Size" ), msg, RED );
valeur_param( pt_texte->m_Size.y, msg );
Affiche_1_Parametre( frame, 70, _( "V Size" ), msg, RED );
}
/************************************************************************/
void Affiche_Infos_E_Texte( WinEDA_BasePcbFrame* frame, MODULE* Module,
TEXTE_MODULE* pt_texte )
/************************************************************************/
/* Affiche en bas d'ecran les caract du texte sur empreinte
* Entree :
* pointeur de description sur le module
* pointeur de la description du texte
*/
{
wxString msg, Line;
int ii;
static const wxString text_type_msg[3] = {
_( "Ref." ), _( "Value" ), _( "Text" ) };
frame->MsgPanel->EraseMsgBox();
Line = Module->m_Reference->m_Text;
Affiche_1_Parametre( frame, 1, _( "Module" ), Line, DARKCYAN );
Line = pt_texte->m_Text;
Affiche_1_Parametre( frame, 10, _( "Text" ), Line, YELLOW );
ii = pt_texte->m_Type;
if( ii > 2 )
ii = 2;
Affiche_1_Parametre( frame, 20, _( "Type" ), text_type_msg[ii], DARKGREEN );
Affiche_1_Parametre( frame, 25, _( "Display" ), wxEmptyString, DARKGREEN );
if( pt_texte->m_NoShow )
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "No" ), DARKGREEN );
else
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Yes" ), DARKGREEN );
ii = pt_texte->m_Layer;
if( ii <= 28 )
Affiche_1_Parametre( frame, 28, _( "Layer" ), ReturnPcbLayerName( ii ), DARKGREEN );
else
{
msg.Printf( wxT( "%d" ), ii );
Affiche_1_Parametre( frame, 28, _( "Layer" ), msg, DARKGREEN );
}
msg = wxT( " Yes" );
if( pt_texte->m_Miroir & 1 )
msg = wxT( " No" );
Affiche_1_Parametre( frame, 36, _( "Mirror" ), msg, DARKGREEN );
msg.Printf( wxT( "%.1f" ), (float) pt_texte->m_Orient / 10 );
Affiche_1_Parametre( frame, 42, _( "Orient" ), msg, DARKGREEN );
valeur_param( pt_texte->m_Width, msg );
Affiche_1_Parametre( frame, 48, _( "Width" ), msg, DARKGREEN );
valeur_param( pt_texte->m_Size.x, msg );
Affiche_1_Parametre( frame, 56, _( "H Size" ), msg, RED );
valeur_param( pt_texte->m_Size.y, msg );
Affiche_1_Parametre( frame, 64, _( "V Size" ), msg, RED );
}
/*********************************************************************/
void Affiche_Infos_Piste( WinEDA_BasePcbFrame* frame, TRACK* pt_piste )
/********************************************************************/
/* Affiche les caract principales d'un segment de piste en bas d'ecran
*/
{
wxString msg;
int text_pos;
frame->MsgPanel->EraseMsgBox();
switch( pt_piste->m_StructType )
{
case TYPEVIA:
msg = g_ViaType_Name[pt_piste->m_Shape & 255];
break;
case TYPETRACK:
msg = _( "Track" );
break;
case TYPEZONE:
msg = _( "Zone" ); break;
default:
msg = wxT( "????" ); break;
}
text_pos = 1;
Affiche_1_Parametre( frame, text_pos, _( "Type" ), msg, DARKCYAN );
/* Affiche NetName pour les segments de piste type cuivre */
text_pos += 15;
if( ( pt_piste->m_StructType == TYPETRACK )
|| ( pt_piste->m_StructType == TYPEZONE )
|| ( pt_piste->m_StructType == TYPEVIA ) )
{
EQUIPOT* equipot = GetEquipot( frame->m_Pcb, pt_piste->m_NetCode );
if( equipot )
{
msg = equipot->m_Netname;
}
else
msg = wxT( "<noname>" );
Affiche_1_Parametre( frame, text_pos, _( "NetName" ), msg, RED );
/* Affiche net code :*/
msg.Printf( wxT( "%d .%d" ), pt_piste->m_NetCode, pt_piste->m_Sous_Netcode );
text_pos += 18;
Affiche_1_Parametre( frame, text_pos, _( "NetCode" ), msg, RED );
}
else
{
Affiche_1_Parametre( frame, text_pos, _( "Segment" ), wxEmptyString, RED );
if( pt_piste->m_Shape == S_CIRCLE )
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Circle" ), RED );
else
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Standard" ), RED );
}
/* Affiche les flags Status piste */
msg = wxT( ". . " );
if( pt_piste->GetState( SEGM_FIXE ) )
msg[0] = 'F';
if( pt_piste->GetState( SEGM_AR ) )
msg[2] = 'A';
text_pos = 42;
Affiche_1_Parametre( frame, text_pos, _( "Stat" ), msg, MAGENTA );
/* Affiche Layer(s) */
if( pt_piste->m_StructType == TYPEVIA )
{
SEGVIA* Via = (SEGVIA*) pt_piste;
int top_layer, bottom_layer;
Via->ReturnLayerPair( &top_layer, &bottom_layer );
msg = ReturnPcbLayerName( top_layer, TRUE ) + wxT( "/" )
+ ReturnPcbLayerName( bottom_layer, TRUE );
}
else
msg = ReturnPcbLayerName( pt_piste->m_Layer );
text_pos += 5;
Affiche_1_Parametre( frame, text_pos, _( "Layer" ), msg, BROWN );
/* Affiche Epaisseur */
valeur_param( (unsigned) (pt_piste->m_Width), msg );
text_pos += 11;
if( pt_piste->m_StructType == TYPEVIA ) // Display Diam and Drill values
{
Affiche_1_Parametre( frame, text_pos, _( "Diam" ), msg, DARKCYAN );
int drill_value = (pt_piste->m_Drill >= 0 ) ?
pt_piste->m_Drill : g_DesignSettings.m_ViaDrill;
valeur_param( (unsigned) drill_value, msg );
text_pos += 8;
wxString title = _( "Drill" );
if( g_DesignSettings.m_ViaDrill >= 0 )
title += wxT( "*" );
Affiche_1_Parametre( frame, text_pos, _( "Drill" ), msg, RED );
}
else
Affiche_1_Parametre( frame, text_pos, _( "Width" ), msg, DARKCYAN );
}
/************************************************************/
void Affiche_Infos_DrawSegment( WinEDA_BasePcbFrame* frame,
DRAWSEGMENT* DrawSegment )
/************************************************************/
/* Affiche les caract principales d'un segment type drawind PCB en bas d'ecran */
{
int itype;
wxString msg;
frame->MsgPanel->EraseMsgBox();
itype = DrawSegment->m_Type & 0x0F;
msg = wxT( "DRAWING" );
if( DrawSegment->m_StructType == TYPECOTATION )
msg = wxT( "COTATION" );
Affiche_1_Parametre( frame, 1, _( "Type" ), msg, DARKCYAN );
Affiche_1_Parametre( frame, 16, _( "Shape" ), wxEmptyString, RED );
if( DrawSegment->m_Shape == S_CIRCLE )
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Circle" ), RED );
else if( DrawSegment->m_Shape == S_ARC )
{
Affiche_1_Parametre( frame, -1, wxEmptyString, _( " Arc " ), RED );
msg.Printf( wxT( "%d" ), DrawSegment->m_Angle );
Affiche_1_Parametre( frame, 32, wxT( " l.arc " ), msg, RED );
}
else
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Segment" ), RED );
Affiche_1_Parametre( frame, 48, _( "Layer" ), ReturnPcbLayerName(
DrawSegment->m_Layer ), BROWN );
/* Affiche Epaisseur */
valeur_param( (unsigned) (DrawSegment->m_Width), msg );
Affiche_1_Parametre( frame, 60, _( "Width" ), msg, DARKCYAN );
}
/*****************************************************************************/
void Affiche_Infos_Segment_Module( WinEDA_BasePcbFrame* frame,
MODULE* Module, EDGE_MODULE* pt_edge )
/*****************************************************************************/
/* Affiche en bas d'ecran les caract du Segment contour d'un module
* Les parametres du module doivent etre a jour*/
{
wxString bufcar;
if( Module == NULL )
return;
frame->MsgPanel->EraseMsgBox();
Affiche_1_Parametre( frame, 1, _( "Seg" ), wxEmptyString, DARKCYAN );
Affiche_1_Parametre( frame, 5, _( "Module" ), Module->m_Reference->m_Text, DARKCYAN );
Affiche_1_Parametre( frame, 14, _( "Value" ), Module->m_Value->m_Text, BLUE );
bufcar.Printf( wxT( "%8.8lX" ), Module->m_TimeStamp );
Affiche_1_Parametre( frame, 24, _( "TimeStamp" ), bufcar, BROWN );
Affiche_1_Parametre( frame, 34, _( "Mod Layer" ), ReturnPcbLayerName( Module->m_Layer ), RED );
Affiche_1_Parametre( frame, 44, _( "Seg Layer" ),
ReturnPcbLayerName( Module->m_Layer ), RED );
valeur_param( pt_edge->m_Width, bufcar );
Affiche_1_Parametre( frame, 54, _( "Width" ), bufcar, BLUE );
}
/*********************************************************/
void Affiche_Infos_Status_Pcb( WinEDA_BasePcbFrame* frame )
/*********************************************************/
/* Affiche l'etat du PCB : nb de pads, nets , connexions.. */
#define POS_AFF_NBPADS 1
#define POS_AFF_NBVIAS 8
#define POS_AFF_NBNODES 16
#define POS_AFF_NBLINKS 24
#define POS_AFF_NBNETS 32
#define POS_AFF_NBCONNECT 40
#define POS_AFF_NBNOCONNECT 48
{
int nb_vias = 0, ii;
EDA_BaseStruct* Struct;
wxString txt;
frame->MsgPanel->EraseMsgBox();
txt.Printf( wxT( "%d" ), frame->m_Pcb->m_NbPads );
Affiche_1_Parametre( frame, POS_AFF_NBPADS, _( "Pads" ), txt, DARKGREEN );
for( ii = 0, Struct = frame->m_Pcb->m_Track; Struct != NULL; Struct = Struct->Pnext )
{
ii++;
if( Struct->m_StructType == TYPEVIA )
nb_vias++;
}
txt.Printf( wxT( "%d" ), nb_vias );
Affiche_1_Parametre( frame, POS_AFF_NBVIAS, _( "Vias" ), txt, DARKGREEN );
txt.Printf( wxT( "%d" ), frame->m_Pcb->GetNumNodes() );
Affiche_1_Parametre( frame, POS_AFF_NBNODES, _( "Nodes" ), txt, DARKCYAN );
txt.Printf( wxT( "%d" ), frame->m_Pcb->m_NbLinks );
Affiche_1_Parametre( frame, POS_AFF_NBLINKS, _( "Links" ), txt, DARKGREEN );
txt.Printf( wxT( "%d" ), frame->m_Pcb->m_NbNets );
Affiche_1_Parametre( frame, POS_AFF_NBNETS, _( "Nets" ), txt, RED );
txt.Printf( wxT( "%d" ), frame->m_Pcb->m_NbLinks - frame->m_Pcb->GetNumNoconnect() );
Affiche_1_Parametre( frame, POS_AFF_NBCONNECT, _( "Connect" ), txt, DARKGREEN );
txt.Printf( wxT( "%d" ), frame->m_Pcb->GetNumNoconnect() );
Affiche_1_Parametre( frame, POS_AFF_NBNOCONNECT, _( "NoConn" ), txt, BLUE );
}
/*******************************************************************/ /*******************************************************************/
void Affiche_Infos_Equipot( int netcode, WinEDA_BasePcbFrame* frame ) void Affiche_Infos_Equipot( int netcode, WinEDA_BasePcbFrame* frame )
...@@ -376,7 +29,7 @@ void Affiche_Infos_Equipot( int netcode, WinEDA_BasePcbFrame* frame ) ...@@ -376,7 +29,7 @@ void Affiche_Infos_Equipot( int netcode, WinEDA_BasePcbFrame* frame )
frame->MsgPanel->EraseMsgBox(); frame->MsgPanel->EraseMsgBox();
equipot = GetEquipot( frame->m_Pcb, netcode ); equipot = frame->m_Pcb->FindNet( netcode );
if( equipot ) if( equipot )
Affiche_1_Parametre( frame, 1, _( "Net Name" ), equipot->m_Netname, RED ); Affiche_1_Parametre( frame, 1, _( "Net Name" ), equipot->m_Netname, RED );
else else
......
...@@ -29,7 +29,7 @@ void WinEDA_PcbFrame::Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On ) ...@@ -29,7 +29,7 @@ void WinEDA_PcbFrame::Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On )
track->SetState( SEGM_FIXE, Flag_On ); track->SetState( SEGM_FIXE, Flag_On );
track->Draw( DrawPanel, DC, GR_OR | GR_SURBRILL ); track->Draw( DrawPanel, DC, GR_OR | GR_SURBRILL );
DrawPanel->CursorOn( DC ); // Display cursor shape DrawPanel->CursorOn( DC ); // Display cursor shape
Affiche_Infos_Piste( this, track ); track->Display_Infos( this );
} }
......
...@@ -256,6 +256,54 @@ bool BOARD::ComputeBoundaryBox( void ) ...@@ -256,6 +256,54 @@ bool BOARD::ComputeBoundaryBox( void )
} }
// virtual, see pcbstruct.h
void BOARD::Display_Infos( WinEDA_DrawFrame* frame )
{
/* Affiche l'etat du PCB : nb de pads, nets , connexions.. */
#define POS_AFF_NBPADS 1
#define POS_AFF_NBVIAS 8
#define POS_AFF_NBNODES 16
#define POS_AFF_NBLINKS 24
#define POS_AFF_NBNETS 32
#define POS_AFF_NBCONNECT 40
#define POS_AFF_NBNOCONNECT 48
int nb_vias = 0, ii;
EDA_BaseStruct* Struct;
wxString txt;
frame->MsgPanel->EraseMsgBox();
txt.Printf( wxT( "%d" ), m_NbPads );
Affiche_1_Parametre( frame, POS_AFF_NBPADS, _( "Pads" ), txt, DARKGREEN );
for( ii = 0, Struct = m_Track; Struct != NULL; Struct = Struct->Pnext )
{
ii++;
if( Struct->m_StructType == TYPEVIA )
nb_vias++;
}
txt.Printf( wxT( "%d" ), nb_vias );
Affiche_1_Parametre( frame, POS_AFF_NBVIAS, _( "Vias" ), txt, DARKGREEN );
txt.Printf( wxT( "%d" ), GetNumNodes() );
Affiche_1_Parametre( frame, POS_AFF_NBNODES, _( "Nodes" ), txt, DARKCYAN );
txt.Printf( wxT( "%d" ), m_NbLinks );
Affiche_1_Parametre( frame, POS_AFF_NBLINKS, _( "Links" ), txt, DARKGREEN );
txt.Printf( wxT( "%d" ), m_NbNets );
Affiche_1_Parametre( frame, POS_AFF_NBNETS, _( "Nets" ), txt, RED );
txt.Printf( wxT( "%d" ), m_NbLinks - GetNumNoconnect() );
Affiche_1_Parametre( frame, POS_AFF_NBCONNECT, _( "Connect" ), txt, DARKGREEN );
txt.Printf( wxT( "%d" ), GetNumNoconnect() );
Affiche_1_Parametre( frame, POS_AFF_NBNOCONNECT, _( "NoConn" ), txt, BLUE );
}
// virtual, see pcbstruct.h // virtual, see pcbstruct.h
SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData, SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
const KICAD_T scanTypes[] ) const KICAD_T scanTypes[] )
...@@ -398,6 +446,28 @@ EDA_BaseStruct* BOARD::FindPadOrModule( const wxPoint& refPos, int layer ) ...@@ -398,6 +446,28 @@ EDA_BaseStruct* BOARD::FindPadOrModule( const wxPoint& refPos, int layer )
} }
/**
* Function FindNet
* searches for a net with the given netcode.
* @param anetcode The netcode to search for.
* @return EQUIPOT* - the net or NULL if not found.
*/
EQUIPOT* BOARD::FindNet( int anetcode )
{
if( anetcode <= 0 )
return NULL;
EQUIPOT* net = (EQUIPOT*) m_Equipots;
while( net )
{
if( net->m_NetCode == anetcode )
break;
net = (EQUIPOT*) net->Pnext;
}
return net;
}
#if defined(DEBUG) #if defined(DEBUG)
/** /**
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "trigo.h" #include "trigo.h"
#include "wxstruct.h"
COTATION::COTATION( EDA_BaseStruct* StructFather ) : COTATION::COTATION( EDA_BaseStruct* StructFather ) :
EDA_BaseStruct( StructFather, TYPECOTATION ) EDA_BaseStruct( StructFather, TYPECOTATION )
...@@ -362,6 +364,14 @@ void COTATION::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -362,6 +364,14 @@ void COTATION::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
} }
// see class_cotation.h
void COTATION::Display_Infos( WinEDA_DrawFrame* frame )
{
// for now, display only the text within the COTATION using class TEXTE_PCB.
m_Text->Display_Infos( frame );
}
/** /**
* Function HitTest * Function HitTest
* tests if the given wxPoint is within the bounds of this object. * tests if the given wxPoint is within the bounds of this object.
......
...@@ -42,6 +42,16 @@ public: ...@@ -42,6 +42,16 @@ public:
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int mode_color ); void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int mode_color );
/**
* Function Display_Infos
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Is virtual from EDA_BaseStruct.
* @param frame A WinEDA_BasePcbFrame in which to print status information.
*/
void Display_Infos( WinEDA_DrawFrame* frame );
/** /**
* Function HitTest * Function HitTest
* tests if the given wxPoint is within the bounds of this object. * tests if the given wxPoint is within the bounds of this object.
......
...@@ -268,6 +268,35 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -268,6 +268,35 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
} }
// see class_edge_mod.h
void EDGE_MODULE::Display_Infos( WinEDA_DrawFrame* frame )
{
wxString bufcar;
MODULE* module = (MODULE*) m_Parent;
if( !module )
return;
frame->MsgPanel->EraseMsgBox();
Affiche_1_Parametre( frame, 1, _( "Seg" ), wxEmptyString, DARKCYAN );
Affiche_1_Parametre( frame, 5, _( "Module" ), module->m_Reference->m_Text, DARKCYAN );
Affiche_1_Parametre( frame, 14, _( "Value" ), module->m_Value->m_Text, BLUE );
bufcar.Printf( wxT( "%8.8lX" ), module->m_TimeStamp );
Affiche_1_Parametre( frame, 24, _( "TimeStamp" ), bufcar, BROWN );
Affiche_1_Parametre( frame, 34, _( "Mod Layer" ), ReturnPcbLayerName( module->m_Layer ), RED );
Affiche_1_Parametre( frame, 44, _( "Seg Layer" ),
ReturnPcbLayerName( module->m_Layer ), RED );
valeur_param( m_Width, bufcar );
Affiche_1_Parametre( frame, 54, _( "Width" ), bufcar, BLUE );
}
/*****************************************/ /*****************************************/
int EDGE_MODULE::WriteDescr( FILE* File ) int EDGE_MODULE::WriteDescr( FILE* File )
/*****************************************/ /*****************************************/
......
...@@ -42,6 +42,17 @@ public: ...@@ -42,6 +42,17 @@ public:
int draw_mode ); int draw_mode );
void Draw3D( Pcb3D_GLCanvas* glcanvas ); void Draw3D( Pcb3D_GLCanvas* glcanvas );
/**
* Function Display_Infos
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Is virtual from EDA_BaseStruct.
* @param frame A WinEDA_BasePcbFrame in which to print status information.
*/
void Display_Infos( WinEDA_DrawFrame* frame );
/** /**
* Function HitTest * Function HitTest
* tests if the given wxPoint is within the bounds of this object. * tests if the given wxPoint is within the bounds of this object.
......
...@@ -67,31 +67,6 @@ void EQUIPOT::UnLink( void ) ...@@ -67,31 +67,6 @@ void EQUIPOT::UnLink( void )
} }
/*************************************************/
EQUIPOT* GetEquipot( BOARD* pcb, int netcode )
/**************************************************/
/*
* retourne un pointeur sur la structure EQUIPOT de numero netcode
*/
{
EQUIPOT* Equipot;
if( netcode <= 0 )
return NULL;
Equipot = (EQUIPOT*) pcb->m_Equipots;
while( Equipot )
{
if( Equipot->m_NetCode == netcode )
break;
Equipot = (EQUIPOT*) Equipot->Pnext;
}
return Equipot;
}
/*********************************************************/ /*********************************************************/
int EQUIPOT:: ReadEquipotDescr( FILE* File, int* LineNum ) int EQUIPOT:: ReadEquipotDescr( FILE* File, int* LineNum )
/*********************************************************/ /*********************************************************/
......
...@@ -130,7 +130,12 @@ public: ...@@ -130,7 +130,12 @@ public:
void DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, void DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int dim_ancre, int draw_mode ); const wxPoint& offset, int dim_ancre, int draw_mode );
/* miscellaneous */ /**
* Function Display_Infos
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* @param frame A WinEDA_BasePcbFrame in which to print status information.
*/
void Display_Infos( WinEDA_BasePcbFrame* frame ); void Display_Infos( WinEDA_BasePcbFrame* frame );
......
...@@ -786,7 +786,7 @@ int D_PAD::WriteDescr( FILE* File ) ...@@ -786,7 +786,7 @@ int D_PAD::WriteDescr( FILE* File )
/******************************************************/ /******************************************************/
void D_PAD::Display_Infos( WinEDA_BasePcbFrame* frame ) void D_PAD::Display_Infos( WinEDA_DrawFrame* frame )
/******************************************************/ /******************************************************/
/* Affiche en bas d'ecran les caract de la pastille demandee */ /* Affiche en bas d'ecran les caract de la pastille demandee */
{ {
......
...@@ -89,8 +89,14 @@ public: ...@@ -89,8 +89,14 @@ public:
void ComputeRayon( void ); // met a jour m_Rayon, rayon du cercle exinscrit void ComputeRayon( void ); // met a jour m_Rayon, rayon du cercle exinscrit
const wxPoint ReturnShapePos( void ); // retourne la position const wxPoint ReturnShapePos( void ); // retourne la position
// de la forme (pastilles excentrees) /**
void Display_Infos( WinEDA_BasePcbFrame* frame ); * Function Display_Infos
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Is virtual from EDA_BaseStruct.
* @param frame A WinEDA_BasePcbFrame in which to print status information.
*/
void Display_Infos( WinEDA_DrawFrame* frame );
/** /**
* Function HitTest * Function HitTest
......
...@@ -150,6 +150,44 @@ void TEXTE_PCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -150,6 +150,44 @@ void TEXTE_PCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
(g_AnchorColor & ITEM_NOT_SHOW) ? -1 : (g_AnchorColor & MASKCOLOR) ); (g_AnchorColor & ITEM_NOT_SHOW) ? -1 : (g_AnchorColor & MASKCOLOR) );
} }
// see class_pcb_text.h
void TEXTE_PCB::Display_Infos( WinEDA_DrawFrame* frame )
{
wxString msg;
frame->MsgPanel->EraseMsgBox();
if( m_Parent && m_Parent->m_StructType == TYPECOTATION )
Affiche_1_Parametre( frame, 1, _( "COTATION" ), m_Text, DARKGREEN );
else
Affiche_1_Parametre( frame, 1, _( "PCB Text" ), m_Text, DARKGREEN );
Affiche_1_Parametre( frame, 28, _( "Layer" ),
ReturnPcbLayerName( m_Layer ),
g_DesignSettings.m_LayerColor[m_Layer] & MASKCOLOR );
Affiche_1_Parametre( frame, 36, _( "Mirror" ), wxEmptyString, GREEN );
if( m_Miroir & 1 )
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "No" ), DARKGREEN );
else
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Yes" ), DARKGREEN );
msg.Printf( wxT( "%.1f" ), (float) m_Orient / 10 );
Affiche_1_Parametre( frame, 43, _( "Orient" ), msg, DARKGREEN );
valeur_param( m_Width, msg );
Affiche_1_Parametre( frame, 50, _( "Width" ), msg, MAGENTA );
valeur_param( m_Size.x, msg );
Affiche_1_Parametre( frame, 60, _( "H Size" ), msg, RED );
valeur_param( m_Size.y, msg );
Affiche_1_Parametre( frame, 70, _( "V Size" ), msg, RED );
}
#if defined(DEBUG) #if defined(DEBUG)
/** /**
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "base_struct.h" #include "base_struct.h"
class TEXTE_PCB: public EDA_BaseStruct, public EDA_TextStruct class TEXTE_PCB : public EDA_BaseStruct, public EDA_TextStruct
{ {
public: public:
TEXTE_PCB(EDA_BaseStruct * parent); TEXTE_PCB(EDA_BaseStruct * parent);
...@@ -26,6 +26,17 @@ public: ...@@ -26,6 +26,17 @@ public:
int ReadTextePcbDescr(FILE * File, int * LineNum); int ReadTextePcbDescr(FILE * File, int * LineNum);
int WriteTextePcbDescr(FILE * File); int WriteTextePcbDescr(FILE * File);
/**
* Function Display_Infos
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Is virtual from EDA_BaseStruct.
* @param frame A WinEDA_BasePcbFrame in which to print status information.
*/
void Display_Infos( WinEDA_DrawFrame* frame );
#if defined(DEBUG) #if defined(DEBUG)
/** /**
* Function GetClass * Function GetClass
......
...@@ -295,6 +295,70 @@ int TEXTE_MODULE::GetDrawRotation( void ) ...@@ -295,6 +295,70 @@ int TEXTE_MODULE::GetDrawRotation( void )
return rotation; return rotation;
} }
// see class_text_mod.h
void TEXTE_MODULE::Display_Infos( WinEDA_DrawFrame* frame )
{
wxString msg, Line;
int ii;
MODULE* module = (MODULE*) m_Parent;
if( !module )
return;
static const wxString text_type_msg[3] = {
_( "Ref." ), _( "Value" ), _( "Text" ) };
frame->MsgPanel->EraseMsgBox();
Line = module->m_Reference->m_Text;
Affiche_1_Parametre( frame, 1, _( "Module" ), Line, DARKCYAN );
Line = m_Text;
Affiche_1_Parametre( frame, 10, _( "Text" ), Line, YELLOW );
ii = m_Type;
if( ii > 2 )
ii = 2;
Affiche_1_Parametre( frame, 20, _( "Type" ), text_type_msg[ii], DARKGREEN );
Affiche_1_Parametre( frame, 25, _( "Display" ), wxEmptyString, DARKGREEN );
if( m_NoShow )
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "No" ), DARKGREEN );
else
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Yes" ), DARKGREEN );
ii = m_Layer;
if( ii <= 28 )
Affiche_1_Parametre( frame, 28, _( "Layer" ), ReturnPcbLayerName( ii ), DARKGREEN );
else
{
msg.Printf( wxT( "%d" ), ii );
Affiche_1_Parametre( frame, 28, _( "Layer" ), msg, DARKGREEN );
}
msg = wxT( " Yes" );
if( m_Miroir & 1 )
msg = wxT( " No" );
Affiche_1_Parametre( frame, 36, _( "Mirror" ), msg, DARKGREEN );
msg.Printf( wxT( "%.1f" ), (float) m_Orient / 10 );
Affiche_1_Parametre( frame, 42, _( "Orient" ), msg, DARKGREEN );
valeur_param( m_Width, msg );
Affiche_1_Parametre( frame, 48, _( "Width" ), msg, DARKGREEN );
valeur_param( m_Size.x, msg );
Affiche_1_Parametre( frame, 56, _( "H Size" ), msg, RED );
valeur_param( m_Size.y, msg );
Affiche_1_Parametre( frame, 64, _( "V Size" ), msg, RED );
}
#if defined(DEBUG) #if defined(DEBUG)
/** /**
* Function Show * Function Show
......
...@@ -56,6 +56,17 @@ public: ...@@ -56,6 +56,17 @@ public:
/* drawing functions */ /* drawing functions */
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, wxPoint offset, int draw_mode ); void Draw( WinEDA_DrawPanel* panel, wxDC* DC, wxPoint offset, int draw_mode );
/**
* Function Display_Infos
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Is virtual from EDA_BaseStruct.
* @param frame A WinEDA_BasePcbFrame in which to print status information.
*/
void Display_Infos( WinEDA_DrawFrame* frame );
/** /**
* Function HitTest * Function HitTest
* tests if the given wxPoint is within the bounds of this object. * tests if the given wxPoint is within the bounds of this object.
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#endif #endif
#include "trigo.h" #include "trigo.h"
#include "protos.h"
/**************************************/ /**************************************/
...@@ -631,6 +632,115 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode ) ...@@ -631,6 +632,115 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode )
} }
// see class_track.h
void TRACK::Display_Infos( WinEDA_DrawFrame* frame )
{
wxString msg;
int text_pos;
frame->MsgPanel->EraseMsgBox();
switch( m_StructType )
{
case TYPEVIA:
msg = g_ViaType_Name[m_Shape & 255];
break;
case TYPETRACK:
msg = _( "Track" );
break;
case TYPEZONE:
msg = _( "Zone" ); break;
default:
msg = wxT( "????" ); break;
}
text_pos = 1;
Affiche_1_Parametre( frame, text_pos, _( "Type" ), msg, DARKCYAN );
/* Affiche NetName pour les segments de piste type cuivre */
text_pos += 15;
if( m_StructType == TYPETRACK
|| m_StructType == TYPEZONE
|| m_StructType == TYPEVIA )
{
EQUIPOT* equipot = ((WinEDA_PcbFrame*)frame)->m_Pcb->FindNet( m_NetCode );
if( equipot )
{
msg = equipot->m_Netname;
}
else
msg = wxT( "<noname>" );
Affiche_1_Parametre( frame, text_pos, _( "NetName" ), msg, RED );
/* Affiche net code :*/
msg.Printf( wxT( "%d .%d" ), m_NetCode, m_Sous_Netcode );
text_pos += 18;
Affiche_1_Parametre( frame, text_pos, _( "NetCode" ), msg, RED );
}
else
{
Affiche_1_Parametre( frame, text_pos, _( "Segment" ), wxEmptyString, RED );
if( m_Shape == S_CIRCLE )
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Circle" ), RED );
else
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Standard" ), RED );
}
/* Affiche les flags Status piste */
msg = wxT( ". . " );
if( GetState( SEGM_FIXE ) )
msg[0] = 'F';
if( GetState( SEGM_AR ) )
msg[2] = 'A';
text_pos = 42;
Affiche_1_Parametre( frame, text_pos, _( "Stat" ), msg, MAGENTA );
/* Affiche Layer(s) */
if( m_StructType == TYPEVIA )
{
SEGVIA* Via = (SEGVIA*) this;
int top_layer, bottom_layer;
Via->ReturnLayerPair( &top_layer, &bottom_layer );
msg = ReturnPcbLayerName( top_layer, TRUE ) + wxT( "/" )
+ ReturnPcbLayerName( bottom_layer, TRUE );
}
else
msg = ReturnPcbLayerName( m_Layer );
text_pos += 5;
Affiche_1_Parametre( frame, text_pos, _( "Layer" ), msg, BROWN );
/* Affiche Epaisseur */
valeur_param( (unsigned) m_Width, msg );
text_pos += 11;
if( m_StructType == TYPEVIA ) // Display Diam and Drill values
{
Affiche_1_Parametre( frame, text_pos, _( "Diam" ), msg, DARKCYAN );
int drill_value = m_Drill >= 0 ?
m_Drill : g_DesignSettings.m_ViaDrill;
valeur_param( (unsigned) drill_value, msg );
text_pos += 8;
wxString title = _( "Drill" );
if( g_DesignSettings.m_ViaDrill >= 0 )
title += wxT( "*" );
Affiche_1_Parametre( frame, text_pos, _( "Drill" ), msg, RED );
}
else
Affiche_1_Parametre( frame, text_pos, _( "Width" ), msg, DARKCYAN );
}
/** /**
* Function HitTest * Function HitTest
* tests if the given wxPoint is within the bounds of this object. * tests if the given wxPoint is within the bounds of this object.
......
...@@ -76,6 +76,17 @@ public: ...@@ -76,6 +76,17 @@ public:
int IsPointOnEnds( const wxPoint& point, int min_dist = 0 ); int IsPointOnEnds( const wxPoint& point, int min_dist = 0 );
bool IsNull( void ); // return TRUE if segment lenght = 0 bool IsNull( void ); // return TRUE if segment lenght = 0
/**
* Function Display_Infos
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Is virtual from EDA_BaseStruct.
* @param frame A WinEDA_BasePcbFrame in which to print status information.
*/
void Display_Infos( WinEDA_DrawFrame* frame );
/** /**
* Function HitTest * Function HitTest
* tests if the given wxPoint is within the bounds of this object. * tests if the given wxPoint is within the bounds of this object.
......
...@@ -166,6 +166,43 @@ bool DRAWSEGMENT::ReadDrawSegmentDescr( FILE* File, int* LineNum ) ...@@ -166,6 +166,43 @@ bool DRAWSEGMENT::ReadDrawSegmentDescr( FILE* File, int* LineNum )
} }
// see pcbstruct.h
void DRAWSEGMENT::Display_Infos( WinEDA_DrawFrame* frame )
{
int itype;
wxString msg;
frame->MsgPanel->EraseMsgBox();
itype = m_Type & 0x0F;
msg = wxT( "DRAWING" );
Affiche_1_Parametre( frame, 1, _( "Type" ), msg, DARKCYAN );
Affiche_1_Parametre( frame, 16, _( "Shape" ), wxEmptyString, RED );
if( m_Shape == S_CIRCLE )
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Circle" ), RED );
else if( m_Shape == S_ARC )
{
Affiche_1_Parametre( frame, -1, wxEmptyString, _( " Arc " ), RED );
msg.Printf( wxT( "%d" ), m_Angle );
Affiche_1_Parametre( frame, 32, wxT( " l.arc " ), msg, RED );
}
else
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Segment" ), RED );
Affiche_1_Parametre( frame, 48, _( "Layer" ),
ReturnPcbLayerName( m_Layer ), BROWN );
/* Affiche Epaisseur */
valeur_param( (unsigned) m_Width, msg );
Affiche_1_Parametre( frame, 60, _( "Width" ), msg, DARKCYAN );
}
/** /**
* Function HitTest * Function HitTest
* tests if the given wxPoint is within the bounds of this object. * tests if the given wxPoint is within the bounds of this object.
......
...@@ -34,7 +34,7 @@ void RemoteCommand( const char* cmdline ) ...@@ -34,7 +34,7 @@ void RemoteCommand( const char* cmdline )
char* idcmd; char* idcmd;
char* text; char* text;
WinEDA_PcbFrame* frame = EDA_Appl->m_PcbFrame; WinEDA_PcbFrame* frame = EDA_Appl->m_PcbFrame;
MODULE* module; MODULE* module = 0;
strncpy( line, cmdline, sizeof(line) - 1 ); strncpy( line, cmdline, sizeof(line) - 1 );
msg = CONV_FROM_UTF8( line ); msg = CONV_FROM_UTF8( line );
......
...@@ -117,7 +117,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* Track ) ...@@ -117,7 +117,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* Track )
GetScreen()->SetModify(); GetScreen()->SetModify();
test_1_net_connexion( DC, current_net_code ); test_1_net_connexion( DC, current_net_code );
Affiche_Infos_Status_Pcb( this ); m_Pcb->Display_Infos( this );
return NULL; return NULL;
} }
...@@ -132,7 +132,7 @@ void WinEDA_PcbFrame::Delete_Track( wxDC* DC, TRACK* Track ) ...@@ -132,7 +132,7 @@ void WinEDA_PcbFrame::Delete_Track( wxDC* DC, TRACK* Track )
Supprime_Une_Piste( DC, Track ); Supprime_Une_Piste( DC, Track );
GetScreen()->SetModify(); GetScreen()->SetModify();
test_1_net_connexion( DC, current_net_code ); test_1_net_connexion( DC, current_net_code );
Affiche_Infos_Status_Pcb( this ); m_Pcb->Display_Infos( this );
} }
} }
...@@ -170,7 +170,7 @@ void WinEDA_PcbFrame::Delete_net( wxDC* DC, TRACK* Track ) ...@@ -170,7 +170,7 @@ void WinEDA_PcbFrame::Delete_net( wxDC* DC, TRACK* Track )
SaveItemEfface( pt_start, ii ); SaveItemEfface( pt_start, ii );
GetScreen()->SetModify(); GetScreen()->SetModify();
test_1_net_connexion( DC, net_code_delete ); test_1_net_connexion( DC, net_code_delete );
Affiche_Infos_Status_Pcb( this ); m_Pcb->Display_Infos( this );
} }
} }
......
...@@ -336,7 +336,7 @@ int WinEDA_PcbFrame::Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone ) ...@@ -336,7 +336,7 @@ int WinEDA_PcbFrame::Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone )
{ {
wxString msg; wxString msg;
jj = 1; jj = 1;
EQUIPOT* equipot = GetEquipot( m_Pcb, pt_segm->m_NetCode ); EQUIPOT* equipot = m_Pcb->FindNet( pt_segm->m_NetCode );
if( equipot ) if( equipot )
msg = equipot->m_Netname + wxT( " " ); msg = equipot->m_Netname + wxT( " " );
else else
...@@ -409,7 +409,7 @@ int WinEDA_PcbFrame::Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone ) ...@@ -409,7 +409,7 @@ int WinEDA_PcbFrame::Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone )
{ {
jj = 1; jj = 1;
wxString msg; wxString msg;
EQUIPOT* equipot = GetEquipot( m_Pcb, pt_segm->m_NetCode ); EQUIPOT* equipot = m_Pcb->FindNet( pt_segm->m_NetCode );
if( equipot ) if( equipot )
msg = equipot->m_Netname + wxT( " " ); msg = equipot->m_Netname + wxT( " " );
else else
...@@ -1296,7 +1296,7 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, ...@@ -1296,7 +1296,7 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
TRACK* pt_segm; TRACK* pt_segm;
wxString msg; wxString msg;
wxString tracktype, netname1, netname2; wxString tracktype, netname1, netname2;
EQUIPOT* equipot = GetEquipot( Pcb, pt_ref->m_NetCode ); EQUIPOT* equipot = Pcb->FindNet( pt_ref->m_NetCode );
if( equipot ) if( equipot )
netname1 = equipot->m_Netname; netname1 = equipot->m_Netname;
...@@ -1314,7 +1314,7 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, ...@@ -1314,7 +1314,7 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
if( ( (EDA_BaseStruct*) pt_item )->m_StructType == TYPEPAD ) if( ( (EDA_BaseStruct*) pt_item )->m_StructType == TYPEPAD )
{ {
D_PAD* pad = (D_PAD*) pt_item; D_PAD* pad = (D_PAD*) pt_item;
equipot = GetEquipot( Pcb, pad->m_NetCode ); equipot = Pcb->FindNet( pad->m_NetCode );
if( equipot ) if( equipot )
netname2 = equipot->m_Netname; netname2 = equipot->m_Netname;
erc_pos = pad->m_Pos; erc_pos = pad->m_Pos;
...@@ -1330,7 +1330,7 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, ...@@ -1330,7 +1330,7 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
else /* erreur sur segment de piste */ else /* erreur sur segment de piste */
{ {
pt_segm = (TRACK*) pt_item; pt_segm = (TRACK*) pt_item;
equipot = GetEquipot( Pcb, pt_segm->m_NetCode ); equipot = Pcb->FindNet( pt_segm->m_NetCode );
if( equipot ) if( equipot )
netname2 = equipot->m_Netname; netname2 = equipot->m_Netname;
erc_pos = pt_segm->m_Start; erc_pos = pt_segm->m_Start;
...@@ -1393,13 +1393,13 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, ...@@ -1393,13 +1393,13 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
wxString pad_name2 = pad2->ReturnStringPadName(); wxString pad_name2 = pad2->ReturnStringPadName();
wxString module_name2 = ( (MODULE*) (pad2->m_Parent) )->m_Reference->m_Text; wxString module_name2 = ( (MODULE*) (pad2->m_Parent) )->m_Reference->m_Text;
wxString netname1, netname2; wxString netname1, netname2;
EQUIPOT* equipot = GetEquipot( Pcb, pad1->m_NetCode ); EQUIPOT* equipot = Pcb->FindNet( pad1->m_NetCode );
if( equipot ) if( equipot )
netname1 = equipot->m_Netname; netname1 = equipot->m_Netname;
else else
netname1 = wxT( "<noname>" ); netname1 = wxT( "<noname>" );
equipot = GetEquipot( Pcb, pad2->m_NetCode ); equipot = Pcb->FindNet( pad2->m_NetCode );
if( equipot ) if( equipot )
netname2 = equipot->m_Netname; netname2 = equipot->m_Netname;
else else
......
...@@ -121,7 +121,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -121,7 +121,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
int netcode = Select_High_Light( DC ); int netcode = Select_High_Light( DC );
if( netcode < 0 ) if( netcode < 0 )
Affiche_Infos_Status_Pcb( this ); m_Pcb->Display_Infos( this );
else else
Affiche_Infos_Equipot( netcode, this ); Affiche_Infos_Equipot( netcode, this );
} }
......
...@@ -33,7 +33,7 @@ void WinEDA_PcbFrame::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ) ...@@ -33,7 +33,7 @@ void WinEDA_PcbFrame::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
Trace_DrawSegmentPcb( DrawPanel, DC, drawitem, GR_XOR ); Trace_DrawSegmentPcb( DrawPanel, DC, drawitem, GR_XOR );
drawitem->m_Flags |= IS_MOVED; drawitem->m_Flags |= IS_MOVED;
cursor_pos = cursor_pos0 = GetScreen()->m_Curseur; cursor_pos = cursor_pos0 = GetScreen()->m_Curseur;
Affiche_Infos_DrawSegment( this, drawitem ); drawitem->Display_Infos( this );
DrawPanel->ManageCurseur = Move_Segment; DrawPanel->ManageCurseur = Move_Segment;
DrawPanel->ForceCloseManageCurseur = Exit_EditEdge; DrawPanel->ForceCloseManageCurseur = Exit_EditEdge;
GetScreen()->SetCurItem( drawitem ); GetScreen()->SetCurItem( drawitem );
...@@ -145,7 +145,7 @@ void WinEDA_PcbFrame::Drawing_SetNewWidth( DRAWSEGMENT* DrawSegm, wxDC* DC ) ...@@ -145,7 +145,7 @@ void WinEDA_PcbFrame::Drawing_SetNewWidth( DRAWSEGMENT* DrawSegm, wxDC* DC )
Trace_DrawSegmentPcb( DrawPanel, DC, DrawSegm, GR_OR ); Trace_DrawSegmentPcb( DrawPanel, DC, DrawSegm, GR_OR );
Affiche_Infos_DrawSegment( this, DrawSegm ); DrawSegm->Display_Infos( this );
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
......
...@@ -147,7 +147,7 @@ void WinEDA_PcbFrame::ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC ) ...@@ -147,7 +147,7 @@ void WinEDA_PcbFrame::ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC )
} }
test_1_net_connexion( DC, pt_track->m_NetCode ); test_1_net_connexion( DC, pt_track->m_NetCode );
Affiche_Infos_Piste( this, pt_track ); pt_track->Display_Infos( this );
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
...@@ -255,7 +255,7 @@ void WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC ) ...@@ -255,7 +255,7 @@ void WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC )
} }
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
Affiche_Infos_Piste( this, Via ); Via->Display_Infos( this );
Affiche_Status_Box(); Affiche_Status_Box();
SetToolbars(); SetToolbars();
...@@ -276,7 +276,7 @@ void WinEDA_PcbFrame::Affiche_Status_Net( wxDC* DC ) ...@@ -276,7 +276,7 @@ void WinEDA_PcbFrame::Affiche_Status_Net( wxDC* DC )
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 ) if( pt_segm == NULL )
Affiche_Infos_Status_Pcb( this ); m_Pcb->Display_Infos( this );
else else
test_1_net_connexion( DC, pt_segm->m_NetCode ); test_1_net_connexion( DC, pt_segm->m_NetCode );
} }
......
...@@ -153,7 +153,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC ) ...@@ -153,7 +153,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC )
g_FirstTrackSegment->end = g_CurrentTrackSegment; g_FirstTrackSegment->end = g_CurrentTrackSegment;
g_FirstTrackSegment->SetState( BEGIN_ONPAD | END_ONPAD, OFF ); g_FirstTrackSegment->SetState( BEGIN_ONPAD | END_ONPAD, OFF );
} }
Affiche_Infos_Piste( this, g_CurrentTrackSegment ); g_CurrentTrackSegment->Display_Infos( this );
GetScreen()->SetCurItem( g_CurrentTrackSegment ); GetScreen()->SetCurItem( g_CurrentTrackSegment );
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
if( Drc_On && (Drc( this, DC, g_CurrentTrackSegment, m_Pcb->m_Track, 1 ) == BAD_DRC) ) if( Drc_On && (Drc( this, DC, g_CurrentTrackSegment, m_Pcb->m_Track, 1 ) == BAD_DRC) )
...@@ -216,7 +216,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC ) ...@@ -216,7 +216,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC )
/* Show the new position */ /* Show the new position */
ShowNewTrackWhenMovingCursor( DrawPanel, DC, FALSE ); ShowNewTrackWhenMovingCursor( DrawPanel, DC, FALSE );
} }
Affiche_Infos_Piste( this, g_CurrentTrackSegment ); g_CurrentTrackSegment->Display_Infos( this );
} }
GetScreen()->SetCurItem( g_CurrentTrackSegment ); GetScreen()->SetCurItem( g_CurrentTrackSegment );
...@@ -456,7 +456,7 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC ) ...@@ -456,7 +456,7 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC )
test_1_net_connexion( DC, g_FirstTrackSegment->m_NetCode ); test_1_net_connexion( DC, g_FirstTrackSegment->m_NetCode );
GetScreen()->SetModify(); GetScreen()->SetModify();
Affiche_Infos_Status_Pcb( this ); m_Pcb->Display_Infos( this );
} }
/* Finish the work, clear used variables */ /* Finish the work, clear used variables */
g_FirstTrackSegment = NULL; g_FirstTrackSegment = NULL;
......
...@@ -58,7 +58,7 @@ TEXTE_MODULE* WinEDA_BasePcbFrame::CreateTextModule( MODULE* Module, wxDC* DC ) ...@@ -58,7 +58,7 @@ TEXTE_MODULE* WinEDA_BasePcbFrame::CreateTextModule( MODULE* Module, wxDC* DC )
Text->m_Flags = 0; Text->m_Flags = 0;
Text->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR ); Text->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
Affiche_Infos_E_Texte( this, Module, Text ); Text->Display_Infos( this );
return Text; return Text;
} }
...@@ -69,12 +69,10 @@ void WinEDA_BasePcbFrame::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -69,12 +69,10 @@ void WinEDA_BasePcbFrame::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC )
/**************************************************************************/ /**************************************************************************/
/* Rotation de 90 du texte d'un module */ /* Rotation de 90 du texte d'un module */
{ {
MODULE* Module;
if( Text == NULL ) if( Text == NULL )
return; return;
Module = (MODULE*) Text->m_Parent; MODULE* module = (MODULE*) Text->m_Parent;
Text->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR ); Text->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
...@@ -85,9 +83,9 @@ void WinEDA_BasePcbFrame::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -85,9 +83,9 @@ void WinEDA_BasePcbFrame::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC )
/* Redessin du Texte */ /* Redessin du Texte */
Text->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR ); Text->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
Affiche_Infos_E_Texte( this, Module, Text ); Text->Display_Infos( this );
( (MODULE*) Text->m_Parent )->m_LastEdit_Time = time( NULL ); module->m_LastEdit_Time = time( NULL );
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
...@@ -171,7 +169,7 @@ void WinEDA_BasePcbFrame::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -171,7 +169,7 @@ void WinEDA_BasePcbFrame::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC )
MoveVector.x = MoveVector.y = 0; MoveVector.x = MoveVector.y = 0;
CursorInitialPosition = Text->m_Pos; CursorInitialPosition = Text->m_Pos;
Affiche_Infos_E_Texte( this, Module, Text ); Text->Display_Infos( this );
GetScreen()->SetCurItem( Text ); GetScreen()->SetCurItem( Text );
DrawPanel->ManageCurseur = Show_MoveTexte_Module; DrawPanel->ManageCurseur = Show_MoveTexte_Module;
......
...@@ -566,7 +566,7 @@ int nbitems, ii; ...@@ -566,7 +566,7 @@ int nbitems, ii;
if ( old_netcode != track->m_NetCode ) if ( old_netcode != track->m_NetCode )
{ {
old_netcode = track->m_NetCode; old_netcode = track->m_NetCode;
EQUIPOT * equipot = GetEquipot( pcb, track->m_NetCode); EQUIPOT * equipot = pcb->FindNet( track->m_NetCode);
wxString netname; wxString netname;
if (equipot && (equipot->m_Netname != wxEmptyString) ) if (equipot && (equipot->m_Netname != wxEmptyString) )
netname = equipot->m_Netname; netname = equipot->m_Netname;
......
...@@ -230,7 +230,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC* DC, boo ...@@ -230,7 +230,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC* DC, boo
/* liste des pads recalculee avec Affichage des messages d'erreur */ /* liste des pads recalculee avec Affichage des messages d'erreur */
build_liste_pads(); build_liste_pads();
Affiche_Infos_Status_Pcb( this ); m_Pcb->Display_Infos( this );
g_SaveTime = time( NULL ); g_SaveTime = time( NULL );
......
...@@ -92,35 +92,36 @@ EDA_BaseStruct* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch ) ...@@ -92,35 +92,36 @@ EDA_BaseStruct* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch )
* return a pointer to this item ( or NULL ) * return a pointer to this item ( or NULL )
*/ */
{ {
TEXTE_PCB* pt_texte_pcb;
TRACK* Track, * TrackLocate;
DRAWSEGMENT* DrawSegm;
MODULE* module;
D_PAD* pt_pad;
int masque_layer; int masque_layer;
EDA_BaseStruct* item; EDA_BaseStruct* item;
pt_texte_pcb = Locate_Texte_Pcb( m_Pcb->m_Drawings, LayerSearch, typeloc ); item = Locate_Texte_Pcb( m_Pcb->m_Drawings, LayerSearch, typeloc );
if( pt_texte_pcb ) // a PCB text is found if( item )
{ {
Affiche_Infos_PCB_Texte( this, pt_texte_pcb ); item->Display_Infos( this );
return pt_texte_pcb; return item;
} }
DrawSegm = Locate_Segment_Pcb( m_Pcb, LayerSearch, typeloc ); item = Locate_Segment_Pcb( m_Pcb, LayerSearch, typeloc );
if( DrawSegm != NULL ) if( item )
{ {
Affiche_Infos_DrawSegment( this, DrawSegm ); item->Display_Infos( this );
return DrawSegm; return item;
} }
item = Locate_Cotation( m_Pcb, LayerSearch, typeloc ); item = Locate_Cotation( m_Pcb, LayerSearch, typeloc );
if( item != NULL ) if( item )
{
item->Display_Infos( this );
return item; return item;
}
item = Locate_MirePcb( m_Pcb->m_Drawings, LayerSearch, typeloc ); item = Locate_MirePcb( m_Pcb->m_Drawings, LayerSearch, typeloc );
if( item != NULL ) if( item != NULL )
{
item->Display_Infos( this ); // MIRES::Display_Infos() not implemented yet.
return item; return item;
}
/* Search for tracks and vias, with via priority */ /* Search for tracks and vias, with via priority */
if( LayerSearch == -1 ) if( LayerSearch == -1 )
...@@ -128,10 +129,11 @@ EDA_BaseStruct* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch ) ...@@ -128,10 +129,11 @@ EDA_BaseStruct* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch )
else else
masque_layer = g_TabOneLayerMask[LayerSearch]; masque_layer = g_TabOneLayerMask[LayerSearch];
TRACK* Track;
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 */ TRACK* 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,
...@@ -144,16 +146,18 @@ EDA_BaseStruct* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch ) ...@@ -144,16 +146,18 @@ EDA_BaseStruct* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch )
TrackLocate = (TRACK*) TrackLocate->Pnext; TrackLocate = (TRACK*) TrackLocate->Pnext;
} }
Affiche_Infos_Piste( this, Track ); Track->Display_Infos( this );
return Track; return Track;
} }
/* Search for Pads */ item = Locate_Any_Pad( m_Pcb, typeloc );
if( ( pt_pad = Locate_Any_Pad( m_Pcb, typeloc ) ) != NULL ) if( item )
{ {
pt_pad->Display_Infos( this ); return pt_pad; item->Display_Infos( this );
return item;
} }
/* 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
...@@ -162,48 +166,46 @@ EDA_BaseStruct* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch ) ...@@ -162,48 +166,46 @@ EDA_BaseStruct* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch )
// on the same layer // 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 ) MODULE* module = m_Pcb->m_Modules;
for( ; module != NULL; module = (MODULE*) module->Pnext )
{ {
TEXTE_MODULE* pt_texte;
if( module->m_Layer != LayerSearch ) if( module->m_Layer != LayerSearch )
continue; continue;
pt_texte = LocateTexteModule( m_Pcb, &module, typeloc | VISIBLE_ONLY ); item = LocateTexteModule( m_Pcb, &module, typeloc | VISIBLE_ONLY );
if( pt_texte != NULL ) if( item )
{ {
Affiche_Infos_E_Texte( this, module, pt_texte ); item->Display_Infos( this );
return pt_texte; return item;
} }
} }
} }
// Now Search footprint texts on all layers // Now Search footprint texts on all layers
MODULE* module;
module = NULL; module = NULL;
item = LocateTexteModule( m_Pcb, &module, typeloc | VISIBLE_ONLY );
if( item )
{ {
TEXTE_MODULE* pt_texte; item->Display_Infos( this );
pt_texte = LocateTexteModule( m_Pcb, &module, typeloc | VISIBLE_ONLY ); return item;
if( pt_texte != NULL )
{
Affiche_Infos_E_Texte( this, module, pt_texte );
return pt_texte;
}
} }
/* Search for a footprint */ /* Search for a footprint */
module = Locate_Prefered_Module( m_Pcb, typeloc | VISIBLE_ONLY ); item = Locate_Prefered_Module( m_Pcb, typeloc | VISIBLE_ONLY );
if( module != NULL ) if( item )
{ {
module->Display_Infos( this ); item->Display_Infos( this );
return module; return item;
} }
/* Search for zones */ /* Search for zones */
if( ( TrackLocate = Locate_Zone( (TRACK*) m_Pcb->m_Zone, item = Locate_Zone( (TRACK*) m_Pcb->m_Zone,
GetScreen()->m_Active_Layer, typeloc ) ) != NULL ) GetScreen()->m_Active_Layer, typeloc );
if( item )
{ {
Affiche_Infos_Piste( this, TrackLocate ); item->Display_Infos( this );
return TrackLocate; return item;
} }
MsgPanel->EraseMsgBox(); MsgPanel->EraseMsgBox();
......
...@@ -31,7 +31,7 @@ EDA_BaseStruct* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( void ) ...@@ -31,7 +31,7 @@ EDA_BaseStruct* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( void )
DrawStruct = Locate_Edge_Module( Module, CURSEUR_OFF_GRILLE ); DrawStruct = Locate_Edge_Module( Module, CURSEUR_OFF_GRILLE );
if( DrawStruct ) if( DrawStruct )
{ {
Affiche_Infos_Segment_Module( this, Module, (EDGE_MODULE*) DrawStruct ); DrawStruct->Display_Infos( this );
} }
else else
DrawStruct = Locate( CURSEUR_OFF_GRILLE, -1 ); DrawStruct = Locate( CURSEUR_OFF_GRILLE, -1 );
......
...@@ -488,7 +488,7 @@ void WinEDA_PcbFrame::Place_Dupl_Route( Track* Track, wxDC* DC ) ...@@ -488,7 +488,7 @@ void WinEDA_PcbFrame::Place_Dupl_Route( Track* Track, wxDC* DC )
} }
} }
NewTrack = NULL; NewTrack = NULL;
Affiche_Infos_Status_Pcb( Cmd ); m_Pcb->Display_Infos( Cmd );
if( Etat_Surbrillance ) if( Etat_Surbrillance )
Hight_Light( DC ); Hight_Light( DC );
} }
......
/************************************/ /************************************/
/* PCBNEW: traitement des netlistes */ /* PCBNEW: traitement des netlistes */
/************************************/ /************************************/
/* Fichier NETLIST.CPP */ /* Fichier NETLIST.CPP */
/* /*
Fonction de lecture de la netliste pour: * Fonction de lecture de la netliste pour:
- Chargement modules et nouvelles connexions * - Chargement modules et nouvelles connexions
- Test des modules (modules manquants ou en trop * - Test des modules (modules manquants ou en trop
- Recalcul du chevelu * - Recalcul du chevelu
*
Remarque importante: * Remarque importante:
Lors de la lecture de la netliste pour Chargement modules * Lors de la lecture de la netliste pour Chargement modules
et nouvelles connexions, l'identification des modules peut se faire selon * et nouvelles connexions, l'identification des modules peut se faire selon
2 criteres: * 2 criteres:
- la reference (U2, R5 ..): c'est le mode normal * - la reference (U2, R5 ..): c'est le mode normal
- le Time Stamp (Signature Temporelle), a utiliser apres reannotation * - le Time Stamp (Signature Temporelle), a utiliser apres reannotation
d'un schema, donc apres modification des references sans pourtant * d'un schema, donc apres modification des references sans pourtant
avoir reellement modifie le schema * avoir reellement modifie le schema
*/ */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
...@@ -27,929 +27,1005 @@ Remarque importante: ...@@ -27,929 +27,1005 @@ Remarque importante:
#include "protos.h" #include "protos.h"
#define TESTONLY 1 /* ctes utilisees lors de l'appel a */ #define TESTONLY 1 /* ctes utilisees lors de l'appel a */
#define READMODULE 0 /* ReadNetModuleORCADPCB */ #define READMODULE 0 /* ReadNetModuleORCADPCB */
/* Structures locales */ /* Structures locales */
class MODULEtoLOAD : public EDA_BaseStruct class MODULEtoLOAD : public EDA_BaseStruct
{ {
public: public:
wxString m_LibName; wxString m_LibName;
wxString m_CmpName; wxString m_CmpName;
public: public:
MODULEtoLOAD(const wxString & libname, const wxString & cmpname, int timestamp); MODULEtoLOAD( const wxString& libname, const wxString& cmpname, int timestamp );
~MODULEtoLOAD(void){}; ~MODULEtoLOAD( void ) { };
MODULEtoLOAD * Next(void) { return (MODULEtoLOAD *) Pnext; } MODULEtoLOAD* Next( void ) { return (MODULEtoLOAD*) Pnext; }
}; };
/* Fonctions locales : */ /* Fonctions locales : */
static void SortListModulesToLoadByLibname(int NbModules); static void SortListModulesToLoadByLibname( int NbModules );
/* Variables locales */ /* Variables locales */
static int s_NbNewModules; static int s_NbNewModules;
static MODULEtoLOAD * s_ModuleToLoad_List; static MODULEtoLOAD* s_ModuleToLoad_List;
FILE * source; FILE* source;
static bool ChangeExistantModule; static bool ChangeExistantModule;
static bool DisplayWarning = TRUE; static bool DisplayWarning = TRUE;
static int DisplayWarningCount ; static int DisplayWarningCount;
/*****************************/ /*****************************/
/* class WinEDA_NetlistFrame */ /* class WinEDA_NetlistFrame */
/*****************************/ /*****************************/
#include "dialog_netlist.cpp" #include "dialog_netlist.cpp"
/*************************************************************************/ /*************************************************************************/
void WinEDA_PcbFrame::InstallNetlistFrame( wxDC * DC, const wxPoint & pos) void WinEDA_PcbFrame::InstallNetlistFrame( wxDC* DC, const wxPoint& pos )
/*************************************************************************/ /*************************************************************************/
{ {
WinEDA_NetlistFrame * frame = new WinEDA_NetlistFrame(this, DC); WinEDA_NetlistFrame* frame = new WinEDA_NetlistFrame( this, DC );
frame->ShowModal(); frame->Destroy();
}
frame->ShowModal(); frame->Destroy();
}
/***************************************************************/ /***************************************************************/
bool WinEDA_NetlistFrame::OpenNetlistFile(wxCommandEvent& event) bool WinEDA_NetlistFrame::OpenNetlistFile( wxCommandEvent& event )
/***************************************************************/ /***************************************************************/
/* /*
routine de selection et d'ouverture du fichier Netlist * routine de selection et d'ouverture du fichier Netlist
*/ */
{ {
wxString FullFileName; wxString FullFileName;
wxString msg; wxString msg;
if( NetNameBuffer.IsEmpty() ) /* Pas de nom specifie */ if( NetNameBuffer.IsEmpty() ) /* Pas de nom specifie */
Set_NetlisteName(event); Set_NetlisteName( event );
if( NetNameBuffer.IsEmpty() ) return(FALSE); /* toujours Pas de nom specifie */ if( NetNameBuffer.IsEmpty() )
return FALSE; /* toujours Pas de nom specifie */
FullFileName = NetNameBuffer; FullFileName = NetNameBuffer;
source = wxFopen(FullFileName, wxT("rt") ); source = wxFopen( FullFileName, wxT( "rt" ) );
if (source == 0) if( source == 0 )
{ {
msg.Printf(_("Netlist file %s not found"),FullFileName.GetData()) ; msg.Printf( _( "Netlist file %s not found" ), FullFileName.GetData() );
DisplayError(this, msg) ; DisplayError( this, msg );
return FALSE ; return FALSE;
} }
msg = wxT("Netlist "); msg << FullFileName; msg = wxT( "Netlist " ); msg << FullFileName;
SetTitle(msg); SetTitle( msg );
return TRUE; return TRUE;
} }
/**************************************************************/ /**************************************************************/
void WinEDA_NetlistFrame::ReadPcbNetlist(wxCommandEvent& event) void WinEDA_NetlistFrame::ReadPcbNetlist( wxCommandEvent& event )
/**************************************************************/ /**************************************************************/
/* mise a jour des empreintes : /* mise a jour des empreintes :
corrige les Net Names, les textes, les "TIME STAMP" * corrige les Net Names, les textes, les "TIME STAMP"
*
Analyse les lignes: * Analyse les lignes:
# EESchema Netlist Version 1.0 generee le 18/5/2005-12:30:22 # EESchema Netlist Version 1.0 generee le 18/5/2005-12:30:22
( * (
( 40C08647 $noname R20 4,7K {Lib=R} * ( 40C08647 $noname R20 4,7K {Lib=R}
( 1 VCC ) * ( 1 VCC )
( 2 MODB_1 ) * ( 2 MODB_1 )
) * )
( 40C0863F $noname R18 4,7_k {Lib=R} * ( 40C0863F $noname R18 4,7_k {Lib=R}
( 1 VCC ) * ( 1 VCC )
( 2 MODA_1 ) * ( 2 MODA_1 )
) * )
} * }
#End #End
*/ */
{ {
int LineNum, State, Comment; int LineNum, State, Comment;
MODULE * Module = NULL; MODULE* Module = NULL;
D_PAD * PtPad; D_PAD* PtPad;
char Line[256], *Text; char Line[256], * Text;
int UseFichCmp = 1; int UseFichCmp = 1;
wxString msg; wxString msg;
ChangeExistantModule = m_ChangeExistantModuleCtrl->GetSelection() == 1 ? TRUE : FALSE; ChangeExistantModule = m_ChangeExistantModuleCtrl->GetSelection() == 1 ? TRUE : FALSE;
DisplayWarning = m_DisplayWarningCtrl->GetValue(); DisplayWarning = m_DisplayWarningCtrl->GetValue();
if ( DisplayWarning ) DisplayWarningCount = 8; if( DisplayWarning )
else DisplayWarningCount = 0; DisplayWarningCount = 8;
else
if( ! OpenNetlistFile(event) ) return; DisplayWarningCount = 0;
msg = _("Read Netlist ") + NetNameBuffer; if( !OpenNetlistFile( event ) )
m_MessageWindow->AppendText(msg); return;
m_Parent->m_CurrentScreen->SetModify(); msg = _( "Read Netlist " ) + NetNameBuffer;
m_Parent->m_Pcb->m_Status_Pcb = 0 ; State = 0; LineNum = 0; Comment = 0; m_MessageWindow->AppendText( msg );
s_NbNewModules = 0;
m_Parent->m_CurrentScreen->SetModify();
/* Premiere lecture de la netliste: etablissement de la liste m_Parent->m_Pcb->m_Status_Pcb = 0; State = 0; LineNum = 0; Comment = 0;
des modules a charger s_NbNewModules = 0;
*/
while( GetLine( source, Line, &LineNum) ) /* Premiere lecture de la netliste: etablissement de la liste
{ * des modules a charger
Text = StrPurge(Line); */
while( GetLine( source, Line, &LineNum ) )
if ( Comment ) /* Commentaires en cours */ {
{ Text = StrPurge( Line );
if( (Text = strchr(Text,'}') ) == NULL )continue;
Comment = 0; if( Comment ) /* Commentaires en cours */
} {
if ( *Text == '{' ) /* Commentaires */ if( ( Text = strchr( Text, '}' ) ) == NULL )
{ continue;
Comment = 1; Comment = 0;
if( (Text = strchr(Text,'}') ) == NULL ) continue; }
} if( *Text == '{' ) /* Commentaires */
{
if ( *Text == '(' ) State++; Comment = 1;
if ( *Text == ')' ) State--; if( ( Text = strchr( Text, '}' ) ) == NULL )
continue;
if( State == 2 ) }
{
Module = ReadNetModule(Text, & UseFichCmp, TESTONLY); if( *Text == '(' )
continue; State++;
} if( *Text == ')' )
State--;
if( State >= 3 ) /* la ligne de description d'un pad est ici non analysee */
{ if( State == 2 )
State--; {
} Module = ReadNetModule( Text, &UseFichCmp, TESTONLY );
} continue;
}
/* Chargement des nouveaux modules */
if( s_NbNewModules ) if( State >= 3 ) /* la ligne de description d'un pad est ici non analysee */
{ {
LoadListeModules(m_DC); State--;
// Free module list: }
MODULEtoLOAD * item, *next_item; }
for ( item = s_ModuleToLoad_List; item != NULL; item = next_item )
{ /* Chargement des nouveaux modules */
next_item = item->Next(); if( s_NbNewModules )
delete item; {
} LoadListeModules( m_DC );
s_ModuleToLoad_List = NULL;
} // Free module list:
MODULEtoLOAD* item, * next_item;
/* Relecture de la netliste, tous les modules sont ici charges */ for( item = s_ModuleToLoad_List; item != NULL; item = next_item )
fseek(source, 0, SEEK_SET); LineNum = 0; {
while( GetLine( source, Line, &LineNum) ) next_item = item->Next();
{ delete item;
Text = StrPurge(Line); }
if ( Comment ) /* Commentaires en cours */ s_ModuleToLoad_List = NULL;
{ }
if( (Text = strchr(Text,'}') ) == NULL )continue;
Comment = 0; /* Relecture de la netliste, tous les modules sont ici charges */
} fseek( source, 0, SEEK_SET ); LineNum = 0;
if ( *Text == '{' ) /* Commentaires */ while( GetLine( source, Line, &LineNum ) )
{ {
Comment = 1; Text = StrPurge( Line );
if( (Text = strchr(Text,'}') ) == NULL ) continue;
} if( Comment ) /* Commentaires en cours */
{
if ( *Text == '(' ) State++; if( ( Text = strchr( Text, '}' ) ) == NULL )
if ( *Text == ')' ) State--; continue;
Comment = 0;
if( State == 2 ) }
{ if( *Text == '{' ) /* Commentaires */
Module = ReadNetModule(Text, & UseFichCmp, READMODULE ); {
if( Module == NULL ) Comment = 1;
{ /* empreinte non trouvee dans la netliste */ if( ( Text = strchr( Text, '}' ) ) == NULL )
continue ; continue;
} }
else /* Raz netnames sur pads */
{ if( *Text == '(' )
PtPad = Module->m_Pads; State++;
for( ; PtPad != NULL; PtPad = (D_PAD *)PtPad->Pnext ) if( *Text == ')' )
{ State--;
PtPad->m_Netname = wxEmptyString;
} if( State == 2 )
} {
continue; Module = ReadNetModule( Text, &UseFichCmp, READMODULE );
} if( Module == NULL )
{ /* empreinte non trouvee dans la netliste */
if( State >= 3 ) continue;
{ }
if ( Module ) else /* Raz netnames sur pads */
{ {
SetPadNetName( Text, Module); PtPad = Module->m_Pads;
} for( ; PtPad != NULL; PtPad = (D_PAD*) PtPad->Pnext )
State--; {
} PtPad->m_Netname = wxEmptyString;
} }
}
fclose(source); continue;
}
/* Mise a jour et Cleanup du circuit imprime: */
m_Parent->Compile_Ratsnest(m_DC, TRUE); if( State >= 3 )
{
if( m_Parent->m_Pcb->m_Track ) if( Module )
{ {
if( m_DeleteBadTracks->GetSelection() == 1 ) SetPadNetName( Text, Module );
{ }
wxBeginBusyCursor();; State--;
Netliste_Controle_piste(m_Parent, m_DC, TRUE); }
m_Parent->Compile_Ratsnest(m_DC, TRUE); }
wxEndBusyCursor();;
} fclose( source );
}
/* Mise a jour et Cleanup du circuit imprime: */
Affiche_Infos_Status_Pcb(m_Parent); m_Parent->Compile_Ratsnest( m_DC, TRUE );
if( m_Parent->m_Pcb->m_Track )
{
if( m_DeleteBadTracks->GetSelection() == 1 )
{
wxBeginBusyCursor();;
Netliste_Controle_piste( m_Parent, m_DC, TRUE );
m_Parent->Compile_Ratsnest( m_DC, TRUE );
wxEndBusyCursor();;
}
}
m_Parent->m_Pcb->Display_Infos( m_Parent );
} }
/****************************************************************************/ /****************************************************************************/
MODULE * WinEDA_NetlistFrame::ReadNetModule(char * Text, int * UseFichCmp, MODULE* WinEDA_NetlistFrame::ReadNetModule( char* Text, int* UseFichCmp,
int TstOnly) int TstOnly )
/****************************************************************************/ /****************************************************************************/
/* charge la description d'une empreinte ,netliste type PCBNEW /* charge la description d'une empreinte ,netliste type PCBNEW
et met a jour le module correspondant * et met a jour le module correspondant
*
Si TstOnly == 0 si le module n'existe pas, il est charge * Si TstOnly == 0 si le module n'existe pas, il est charge
Si TstOnly != 0 si le module n'existe pas, il est ajoute a la liste des * Si TstOnly != 0 si le module n'existe pas, il est ajoute a la liste des
modules a charger * modules a charger
Text contient la premiere ligne de la description * Text contient la premiere ligne de la description
* UseFichCmp est un flag * UseFichCmp est un flag
si != 0, le fichier des composants .CMP sera utilise * si != 0, le fichier des composants .CMP sera utilise
est remis a 0 si le fichier n'existe pas * est remis a 0 si le fichier n'existe pas
*
Analyse les lignes type: * Analyse les lignes type:
( 40C08647 $noname R20 4,7K {Lib=R} * ( 40C08647 $noname R20 4,7K {Lib=R}
( 1 VCC ) * ( 1 VCC )
( 2 MODB_1 ) * ( 2 MODB_1 )
*/ */
{ {
MODULE * Module; MODULE* Module;
char * text; char* text;
wxString TextTimeStamp; wxString TextTimeStamp;
wxString TextNameLibMod; wxString TextNameLibMod;
wxString TextValeur; wxString TextValeur;
wxString TextCmpName; wxString TextCmpName;
wxString NameLibCmp; wxString NameLibCmp;
unsigned long TimeStamp = 0; unsigned long TimeStamp = 0;
int Error = 0; int Error = 0;
char Line[1024]; char Line[1024];
bool Found; bool Found;
strcpy(Line,Text); strcpy( Line, Text );
TextValeur = wxT("~"); TextValeur = wxT( "~" );
if( (text = strtok(Line, " ()\t\n")) == NULL ) Error = 1; if( ( text = strtok( Line, " ()\t\n" ) ) == NULL )
else TextTimeStamp = CONV_FROM_UTF8(text); Error = 1;
if( ( text = strtok(NULL, " ()\t\n")) == NULL ) Error = 1; else
else TextNameLibMod = CONV_FROM_UTF8(text); TextTimeStamp = CONV_FROM_UTF8( text );
if( (text = strtok(NULL, " ()\t\n")) == NULL ) Error = 1; if( ( text = strtok( NULL, " ()\t\n" ) ) == NULL )
else TextCmpName = CONV_FROM_UTF8(text); Error = 1;
if( (text = strtok(NULL, " ()\t\n")) == NULL ) Error = -1; else
else TextValeur = CONV_FROM_UTF8(text); TextNameLibMod = CONV_FROM_UTF8( text );
if( ( text = strtok( NULL, " ()\t\n" ) ) == NULL )
if( Error > 0 ) return( NULL ); Error = 1;
else
TextTimeStamp.ToULong( &TimeStamp, 16); TextCmpName = CONV_FROM_UTF8( text );
if( ( text = strtok( NULL, " ()\t\n" ) ) == NULL )
/* Tst si composant deja charge */ Error = -1;
Module = (MODULE*) m_Parent->m_Pcb->m_Modules; else
MODULE * NextModule; TextValeur = CONV_FROM_UTF8( text );
for( Found = FALSE; Module != NULL; Module = NextModule )
{ if( Error > 0 )
NextModule = (MODULE*)Module->Pnext; return NULL;
if( m_Select_By_Timestamp->GetSelection() == 1 ) /* Reconnaissance par signature temporelle */
{ TextTimeStamp.ToULong( &TimeStamp, 16 );
if( TimeStamp == Module->m_TimeStamp) Found = TRUE;
} /* Tst si composant deja charge */
else /* Reconnaissance par Reference */ Module = (MODULE*) m_Parent->m_Pcb->m_Modules;
{ MODULE* NextModule;
if( TextCmpName.CmpNoCase(Module->m_Reference->m_Text) == 0 ) for( Found = FALSE; Module != NULL; Module = NextModule )
Found = TRUE; {
} NextModule = (MODULE*) Module->Pnext;
if ( Found ) // Test si module (m_LibRef) et module specifie en netlist concordent if( m_Select_By_Timestamp->GetSelection() == 1 ) /* Reconnaissance par signature temporelle */
{ {
if( TstOnly != TESTONLY ) if( TimeStamp == Module->m_TimeStamp )
{ Found = TRUE;
NameLibCmp = TextNameLibMod; }
if( *UseFichCmp ) else /* Reconnaissance par Reference */
{ {
if( m_Select_By_Timestamp->GetSelection() == 1 ) if( TextCmpName.CmpNoCase( Module->m_Reference->m_Text ) == 0 )
{ /* Reconnaissance par signature temporelle */ Found = TRUE;
*UseFichCmp = ReadListeModules(NULL, TimeStamp, NameLibCmp); }
} if( Found ) // Test si module (m_LibRef) et module specifie en netlist concordent
else /* Reconnaissance par Reference */ {
{ if( TstOnly != TESTONLY )
*UseFichCmp = ReadListeModules(&TextCmpName, 0l, NameLibCmp); {
} NameLibCmp = TextNameLibMod;
} if( *UseFichCmp )
if (Module->m_LibRef.CmpNoCase(NameLibCmp) != 0 ) {
{// Module Mismatch: Current module and module specified in netlist are diff. if( m_Select_By_Timestamp->GetSelection() == 1 )
if ( ChangeExistantModule ) { /* Reconnaissance par signature temporelle */
{ *UseFichCmp = ReadListeModules( NULL, TimeStamp, NameLibCmp );
MODULE * NewModule = }
m_Parent->Get_Librairie_Module(this, wxEmptyString, NameLibCmp, TRUE); else /* Reconnaissance par Reference */
if( NewModule ) /* Nouveau module trouve : changement de module */ {
Module = m_Parent->Exchange_Module(this, Module, NewModule); *UseFichCmp = ReadListeModules( &TextCmpName, 0l, NameLibCmp );
} }
else }
{ if( Module->m_LibRef.CmpNoCase( NameLibCmp ) != 0 )
wxString msg; { // Module Mismatch: Current module and module specified in netlist are diff.
msg.Printf( if( ChangeExistantModule )
_("Cmp %s: Mismatch! module is [%s] and netlist said [%s]\n"), {
TextCmpName.GetData(), Module->m_LibRef.GetData(), NameLibCmp.GetData()); MODULE* NewModule =
m_MessageWindow->AppendText(msg); m_Parent->Get_Librairie_Module( this, wxEmptyString, NameLibCmp, TRUE );
if ( DisplayWarningCount > 0) if( NewModule ) /* Nouveau module trouve : changement de module */
{ Module = m_Parent->Exchange_Module( this, Module, NewModule );
DisplayError(this, msg, 2); }
DisplayWarningCount--; else
} {
} wxString msg;
} msg.Printf(
} _( "Cmp %s: Mismatch! module is [%s] and netlist said [%s]\n" ),
break; TextCmpName.GetData(), Module->m_LibRef.GetData(),
} NameLibCmp.GetData() );
} m_MessageWindow->AppendText( msg );
if( DisplayWarningCount > 0 )
if( Module == NULL ) /* Module a charger */ {
{ DisplayError( this, msg, 2 );
NameLibCmp = TextNameLibMod; DisplayWarningCount--;
}
if( *UseFichCmp ) }
{ }
if( m_Select_By_Timestamp->GetSelection() == 1) }
{ /* Reconnaissance par signature temporelle */ break;
*UseFichCmp = ReadListeModules(NULL, TimeStamp, NameLibCmp); }
} }
else /* Reconnaissance par Reference */
{ if( Module == NULL ) /* Module a charger */
*UseFichCmp = ReadListeModules(&TextCmpName, 0l, NameLibCmp); {
} NameLibCmp = TextNameLibMod;
}
if( *UseFichCmp )
{
if( TstOnly == TESTONLY) if( m_Select_By_Timestamp->GetSelection() == 1 )
AddToList(NameLibCmp, TextCmpName, TimeStamp); { /* Reconnaissance par signature temporelle */
else *UseFichCmp = ReadListeModules( NULL, TimeStamp, NameLibCmp );
{ }
wxString msg; else /* Reconnaissance par Reference */
msg.Printf( _("Component [%s] not found"), TextCmpName.GetData()); {
m_MessageWindow->AppendText( msg + wxT("\n")); *UseFichCmp = ReadListeModules( &TextCmpName, 0l, NameLibCmp );
if (DisplayWarningCount> 0) }
{ }
DisplayError(this, msg, 2);
DisplayWarningCount--;
} if( TstOnly == TESTONLY )
} AddToList( NameLibCmp, TextCmpName, TimeStamp );
return(NULL); /* Le module n'avait pas pu etre charge */ else
} {
wxString msg;
/* mise a jour des reperes ( nom et ref "Time Stamp") si module charge */ msg.Printf( _( "Component [%s] not found" ), TextCmpName.GetData() );
Module->m_Reference->m_Text = TextCmpName; m_MessageWindow->AppendText( msg + wxT( "\n" ) );
Module->m_Value->m_Text = TextValeur; if( DisplayWarningCount> 0 )
Module->m_TimeStamp = TimeStamp; {
DisplayError( this, msg, 2 );
return(Module) ; /* composant trouve */ DisplayWarningCount--;
}
}
return NULL; /* Le module n'avait pas pu etre charge */
}
/* mise a jour des reperes ( nom et ref "Time Stamp") si module charge */
Module->m_Reference->m_Text = TextCmpName;
Module->m_Value->m_Text = TextValeur;
Module->m_TimeStamp = TimeStamp;
return Module; /* composant trouve */
} }
/********************************************************************/ /********************************************************************/
int WinEDA_NetlistFrame::SetPadNetName( char * Text, MODULE * Module) int WinEDA_NetlistFrame::SetPadNetName( char* Text, MODULE* Module )
/********************************************************************/ /********************************************************************/
/* /*
Met a jour le netname de 1 pastille, Netliste ORCADPCB * Met a jour le netname de 1 pastille, Netliste ORCADPCB
entree : * entree :
Text = ligne de netliste lue ( (pad = net) ) * Text = ligne de netliste lue ( (pad = net) )
Module = adresse de la structure MODULE a qui appartient les pads * Module = adresse de la structure MODULE a qui appartient les pads
*/ */
{ {
D_PAD * pad; D_PAD* pad;
char * TextPinName, * TextNetName; char* TextPinName, * TextNetName;
int Error = 0; int Error = 0;
bool trouve; bool trouve;
char Line[256]; char Line[256];
wxString Msg; wxString Msg;
if( Module == NULL ) return ( 0 ); if( Module == NULL )
return 0;
strcpy( Line, Text);
strcpy( Line, Text );
if( (TextPinName = strtok(Line, " ()\t\n")) == NULL ) Error = 1;
if( (TextNetName = strtok(NULL, " ()\t\n")) == NULL ) Error = 1; if( ( TextPinName = strtok( Line, " ()\t\n" ) ) == NULL )
if(Error) return(0); Error = 1;
if( ( TextNetName = strtok( NULL, " ()\t\n" ) ) == NULL )
/* recherche du pad */ Error = 1;
pad = Module->m_Pads; trouve = FALSE; if( Error )
for( ; pad != NULL; pad = (D_PAD *)pad->Pnext ) return 0;
{
if( strnicmp( TextPinName, pad->m_Padname, 4) == 0 ) /* recherche du pad */
{ /* trouve */ pad = Module->m_Pads; trouve = FALSE;
trouve = TRUE; for( ; pad != NULL; pad = (D_PAD*) pad->Pnext )
if( *TextNetName != '?' ) {
pad->m_Netname = CONV_FROM_UTF8(TextNetName); if( strnicmp( TextPinName, pad->m_Padname, 4 ) == 0 )
else pad->m_Netname.Empty(); { /* trouve */
} trouve = TRUE;
} if( *TextNetName != '?' )
pad->m_Netname = CONV_FROM_UTF8( TextNetName );
if( !trouve && (DisplayWarningCount > 0) ) else
{ pad->m_Netname.Empty();
wxString pin_name = CONV_FROM_UTF8(TextPinName); }
Msg.Printf( _("Module [%s]: Pad [%s] not found"), }
Module->m_Reference->m_Text.GetData(), pin_name.GetData() );
DisplayError(this, Msg, 1); if( !trouve && (DisplayWarningCount > 0) )
DisplayWarningCount--; {
} wxString pin_name = CONV_FROM_UTF8( TextPinName );
Msg.Printf( _( "Module [%s]: Pad [%s] not found" ),
return(trouve); Module->m_Reference->m_Text.GetData(), pin_name.GetData() );
DisplayError( this, Msg, 1 );
DisplayWarningCount--;
}
return trouve;
} }
/*****************************************************/ /*****************************************************/
MODULE * WinEDA_PcbFrame::ListAndSelectModuleName(void) MODULE* WinEDA_PcbFrame::ListAndSelectModuleName( void )
/*****************************************************/ /*****************************************************/
/* liste les noms des modules du PCB /* liste les noms des modules du PCB
Retourne: * Retourne:
un pointeur sur le module selectionne * un pointeur sur le module selectionne
NULL si pas de selection * NULL si pas de selection
*/ */
{ {
int ii, jj, nb_empr; int ii, jj, nb_empr;
MODULE * Module; MODULE* Module;
WinEDAListBox * ListBox; WinEDAListBox* ListBox;
const wxChar ** ListNames = NULL; const wxChar** ListNames = NULL;
if( m_Pcb->m_Modules == NULL ) if( m_Pcb->m_Modules == NULL )
{ {
DisplayError(this, _("No Modules") ) ; return(0); DisplayError( this, _( "No Modules" ) ); return 0;
} }
/* Calcul du nombre des modules */ /* Calcul du nombre des modules */
nb_empr = 0; Module = (MODULE*)m_Pcb->m_Modules; nb_empr = 0; Module = (MODULE*) m_Pcb->m_Modules;
for( ;Module != NULL; Module = (MODULE*)Module->Pnext) nb_empr++; for( ; Module != NULL; Module = (MODULE*) Module->Pnext )
ListNames = (const wxChar**) MyZMalloc( (nb_empr + 1) * sizeof(wxChar*) ); nb_empr++;
Module = (MODULE*) m_Pcb->m_Modules;
for( ii = 0; Module != NULL; Module = (MODULE*)Module->Pnext, ii++) ListNames = (const wxChar**) MyZMalloc( (nb_empr + 1) * sizeof(wxChar *) );
{ Module = (MODULE*) m_Pcb->m_Modules;
ListNames[ii] = Module->m_Reference->m_Text.GetData(); for( ii = 0; Module != NULL; Module = (MODULE*) Module->Pnext, ii++ )
} {
ListNames[ii] = Module->m_Reference->m_Text.GetData();
ListBox = new WinEDAListBox(this, _("Components"), }
ListNames, wxEmptyString);
ii = ListBox->ShowModal(); ListBox->Destroy(); ListBox = new WinEDAListBox( this, _( "Components" ),
ListNames, wxEmptyString );
ii = ListBox->ShowModal(); ListBox->Destroy();
if( ii < 0 ) /* Pas de selection */
{
Module = NULL; if( ii < 0 ) /* Pas de selection */
} {
Module = NULL;
else /* Recherche du module selectionne */ }
{ else /* Recherche du module selectionne */
Module = (MODULE*) m_Pcb->m_Modules; {
for( jj = 0; Module != NULL; Module = (MODULE*)Module->Pnext, jj++) Module = (MODULE*) m_Pcb->m_Modules;
{ for( jj = 0; Module != NULL; Module = (MODULE*) Module->Pnext, jj++ )
if( Module->m_Reference->m_Text.Cmp(ListNames[ii]) == 0 ) break; {
} if( Module->m_Reference->m_Text.Cmp( ListNames[ii] ) == 0 )
} break;
}
free(ListNames); }
return(Module);
free( ListNames );
return Module;
} }
/***************************************************************/ /***************************************************************/
void WinEDA_NetlistFrame::ModulesControle(wxCommandEvent& event) void WinEDA_NetlistFrame::ModulesControle( wxCommandEvent& event )
/***************************************************************/ /***************************************************************/
/* donne la liste : /* donne la liste :
1 - des empreintes doubles sur le PCB * 1 - des empreintes doubles sur le PCB
2 - des empreintes manquantes par rapport a la netliste * 2 - des empreintes manquantes par rapport a la netliste
3 - des empreintes supplmentaires par rapport a la netliste * 3 - des empreintes supplmentaires par rapport a la netliste
*/ */
#define MAX_LEN_TXT 32 #define MAX_LEN_TXT 32
{ {
int ii, NbModulesPcb; int ii, NbModulesPcb;
MODULE * Module, * pt_aux; MODULE* Module, * pt_aux;
int NbModulesNetListe ,nberr = 0 ; int NbModulesNetListe, nberr = 0;
WinEDA_TextFrame * List; WinEDA_TextFrame* List;
wxArrayString ModuleListFromNetlist; wxArrayString ModuleListFromNetlist;
/* determination du nombre des modules du PCB*/ /* determination du nombre des modules du PCB*/
NbModulesPcb = 0; Module = (MODULE*) m_Parent->m_Pcb->m_Modules; NbModulesPcb = 0; Module = (MODULE*) m_Parent->m_Pcb->m_Modules;
for( ;Module != NULL; Module = (MODULE*)Module->Pnext) for( ; Module != NULL; Module = (MODULE*) Module->Pnext )
NbModulesPcb++; NbModulesPcb++;
if( NbModulesPcb == 0 ) if( NbModulesPcb == 0 )
{ {
DisplayError(this, _("No modules"), 10); return; DisplayError( this, _( "No modules" ), 10 ); return;
} }
/* Construction de la liste des references des modules de la netliste */ /* Construction de la liste des references des modules de la netliste */
NbModulesNetListe = BuildListeNetModules(event, ModuleListFromNetlist); NbModulesNetListe = BuildListeNetModules( event, ModuleListFromNetlist );
if( NbModulesNetListe < 0 ) return; /* fichier non trouve */ if( NbModulesNetListe < 0 )
return; /* fichier non trouve */
if( NbModulesNetListe == 0 )
{ if( NbModulesNetListe == 0 )
DisplayError(this, _("No modules in NetList"), 10); return; {
} DisplayError( this, _( "No modules in NetList" ), 10 ); return;
}
List = new WinEDA_TextFrame(this, _("Check Modules"));
List = new WinEDA_TextFrame( this, _( "Check Modules" ) );
/* recherche des doubles */
List->Append(_("Duplicates")); /* recherche des doubles */
List->Append( _( "Duplicates" ) );
Module = (MODULE*) m_Parent->m_Pcb->m_Modules;
for( ;Module != NULL; Module = (MODULE*)Module->Pnext) Module = (MODULE*) m_Parent->m_Pcb->m_Modules;
{ for( ; Module != NULL; Module = (MODULE*) Module->Pnext )
pt_aux = (MODULE*)Module->Pnext; {
for( ; pt_aux != NULL; pt_aux = (MODULE*)pt_aux->Pnext) pt_aux = (MODULE*) Module->Pnext;
{ for( ; pt_aux != NULL; pt_aux = (MODULE*) pt_aux->Pnext )
if( Module->m_Reference->m_Text.CmpNoCase(pt_aux->m_Reference->m_Text) == 0 ) {
{ if( Module->m_Reference->m_Text.CmpNoCase( pt_aux->m_Reference->m_Text ) == 0 )
List->Append(Module->m_Reference->m_Text); {
nberr++ ; List->Append( Module->m_Reference->m_Text );
break; nberr++;
} break;
} }
} }
}
/* recherche des manquants par rapport a la netliste*/
List->Append(_("Lack:") ); /* recherche des manquants par rapport a la netliste*/
List->Append( _( "Lack:" ) );
for ( ii = 0 ; ii < NbModulesNetListe ; ii++ )
{ for( ii = 0; ii < NbModulesNetListe; ii++ )
Module = (MODULE*) m_Parent->m_Pcb->m_Modules; {
for( ;Module != NULL; Module = (MODULE*)Module->Pnext) Module = (MODULE*) m_Parent->m_Pcb->m_Modules;
{ for( ; Module != NULL; Module = (MODULE*) Module->Pnext )
if( Module->m_Reference->m_Text.CmpNoCase( {
ModuleListFromNetlist[ii]) == 0 ) if( Module->m_Reference->m_Text.CmpNoCase(
{ ModuleListFromNetlist[ii] ) == 0 )
break; {
} break;
} }
if( Module == NULL ) // Module missing, not found in board }
{
List->Append(ModuleListFromNetlist[ii]); if( Module == NULL ) // Module missing, not found in board
nberr++ ; {
} List->Append( ModuleListFromNetlist[ii] );
} nberr++;
}
/* recherche des modules supplementaires (i.e. Non en Netliste) */ }
List->Append( _("Not in Netlist:") );
/* recherche des modules supplementaires (i.e. Non en Netliste) */
Module = (MODULE*) m_Parent->m_Pcb->m_Modules; List->Append( _( "Not in Netlist:" ) );
for( ;Module != NULL; Module = Module->Next())
{ Module = (MODULE*) m_Parent->m_Pcb->m_Modules;
for (ii = 0; ii < NbModulesNetListe; ii++ ) for( ; Module != NULL; Module = Module->Next() )
{ {
if( Module->m_Reference->m_Text.CmpNoCase( for( ii = 0; ii < NbModulesNetListe; ii++ )
ModuleListFromNetlist[ii]) == 0 ) {
{ if( Module->m_Reference->m_Text.CmpNoCase(
break ;/* Module trouve en netliste */ ModuleListFromNetlist[ii] ) == 0 )
} {
} break;/* Module trouve en netliste */
if( ii == NbModulesNetListe ) /* Module not found in netlist */ }
{ }
List->Append(Module->m_Reference->m_Text);
nberr++ ; if( ii == NbModulesNetListe ) /* Module not found in netlist */
} {
} List->Append( Module->m_Reference->m_Text );
nberr++;
List->ShowModal(); List->Destroy(); }
}
List->ShowModal(); List->Destroy();
} }
/**************************************************************************************************/ /**************************************************************************************************/
int WinEDA_NetlistFrame::BuildListeNetModules(wxCommandEvent& event, wxArrayString & BufName) int WinEDA_NetlistFrame::BuildListeNetModules( wxCommandEvent& event, wxArrayString& BufName )
/**************************************************************************************************/ /**************************************************************************************************/
/* /*
charge en BufName la liste des noms des modules de la netliste, * charge en BufName la liste des noms des modules de la netliste,
retourne le nombre des modules cits dans la netliste * retourne le nombre des modules cits dans la netliste
*/ */
{ {
int textlen; int textlen;
int nb_modules_lus ; int nb_modules_lus;
int State, LineNum, Comment; int State, LineNum, Comment;
char Line[1024], *Text, * LibModName; char Line[1024], * Text, * LibModName;
if( ! OpenNetlistFile(event) ) return -1; if( !OpenNetlistFile( event ) )
return -1;
State = 0; LineNum = 0; Comment = 0;
nb_modules_lus = 0; State = 0; LineNum = 0; Comment = 0;
textlen = MAX_LEN_TXT; nb_modules_lus = 0;
textlen = MAX_LEN_TXT;
while( GetLine( source, Line, &LineNum) )
{ while( GetLine( source, Line, &LineNum ) )
Text = StrPurge(Line); {
if ( Comment ) /* Commentaires en cours */ Text = StrPurge( Line );
{ if( Comment ) /* Commentaires en cours */
if( (Text = strchr(Text,'}') ) == NULL )continue; {
Comment = 0; if( ( Text = strchr( Text, '}' ) ) == NULL )
} continue;
if ( *Text == '{' ) /* Commentaires */ Comment = 0;
{ }
Comment = 1; if( *Text == '{' ) /* Commentaires */
if( (Text = strchr(Text,'}') ) == NULL ) continue; {
} Comment = 1;
if( ( Text = strchr( Text, '}' ) ) == NULL )
if ( *Text == '(' ) State++; continue;
if ( *Text == ')' ) State--; }
if( State == 2 ) if( *Text == '(' )
{ State++;
int Error = 0; if( *Text == ')' )
if( strtok(Line, " ()\t\n") == NULL ) Error = 1; /* TimeStamp */ State--;
if( ( LibModName = strtok(NULL, " ()\t\n")) == NULL ) Error = 1; /* nom Lib */
/* Lecture du nom (reference) du composant: */ if( State == 2 )
if( (Text = strtok(NULL, " ()\t\n")) == NULL ) Error = 1; {
nb_modules_lus++; int Error = 0;
BufName.Add(CONV_FROM_UTF8(Text)); if( strtok( Line, " ()\t\n" ) == NULL )
continue; Error = 1; /* TimeStamp */
} if( ( LibModName = strtok( NULL, " ()\t\n" ) ) == NULL )
Error = 1; /* nom Lib */
if( State >= 3 ) /* Lecture du nom (reference) du composant: */
{ if( ( Text = strtok( NULL, " ()\t\n" ) ) == NULL )
State--; /* Lecture 1 ligne relative au Pad */ Error = 1;
} nb_modules_lus++;
} BufName.Add( CONV_FROM_UTF8( Text ) );
continue;
fclose(source); }
return(nb_modules_lus);
if( State >= 3 )
{
State--; /* Lecture 1 ligne relative au Pad */
}
}
fclose( source );
return nb_modules_lus;
} }
/*****************************************************************************************/ /*****************************************************************************************/
int WinEDA_NetlistFrame::ReadListeModules(const wxString * RefCmp, long TimeStamp, int WinEDA_NetlistFrame::ReadListeModules( const wxString* RefCmp, long TimeStamp,
wxString & NameModule) wxString& NameModule )
/*****************************************************************************************/ /*****************************************************************************************/
/* /*
Lit le fichier .CMP donnant l'equivalence Modules / Composants * Lit le fichier .CMP donnant l'equivalence Modules / Composants
Retourne: * Retourne:
Si ce fichier existe: * Si ce fichier existe:
1 et le nom module dans NameModule * 1 et le nom module dans NameModule
-1 si module non trouve en fichier * -1 si module non trouve en fichier
sinon 0; * sinon 0;
*
parametres d'appel: * parametres d'appel:
RefCmp (NULL si selection par TimeStamp) * RefCmp (NULL si selection par TimeStamp)
TimeStamp (signature temporelle si elle existe, NULL sinon) * TimeStamp (signature temporelle si elle existe, NULL sinon)
pointeur sur le buffer recevant le nom du module * pointeur sur le buffer recevant le nom du module
*
Exemple de fichier: * Exemple de fichier:
*
Cmp-Mod V01 Genere par PcbNew le 29/10/2003-13:11:6 * Cmp-Mod V01 Genere par PcbNew le 29/10/2003-13:11:6
*
BeginCmp * BeginCmp
TimeStamp = 322D3011; * TimeStamp = 322D3011;
Reference = BUS1; * Reference = BUS1;
ValeurCmp = BUSPC; * ValeurCmp = BUSPC;
IdModule = BUS_PC; * IdModule = BUS_PC;
EndCmp * EndCmp
*
BeginCmp * BeginCmp
TimeStamp = 32307DE2; * TimeStamp = 32307DE2;
Reference = C1; * Reference = C1;
ValeurCmp = 47uF; * ValeurCmp = 47uF;
IdModule = CP6; * IdModule = CP6;
EndCmp * EndCmp
*
*/ */
{ {
wxString CmpFullFileName; wxString CmpFullFileName;
wxString refcurrcmp, idmod; wxString refcurrcmp, idmod;
char ia[1024]; char ia[1024];
int timestamp; int timestamp;
char *ptcar; char* ptcar;
FILE * FichCmp; FILE* FichCmp;
if( (RefCmp == NULL) && (TimeStamp == 0) ) return(0); if( (RefCmp == NULL) && (TimeStamp == 0) )
return 0;
CmpFullFileName = NetNameBuffer;
ChangeFileNameExt(CmpFullFileName,NetCmpExtBuffer) ; CmpFullFileName = NetNameBuffer;
ChangeFileNameExt( CmpFullFileName, NetCmpExtBuffer );
FichCmp = wxFopen(CmpFullFileName, wxT("rt") );
if (FichCmp == NULL) FichCmp = wxFopen( CmpFullFileName, wxT( "rt" ) );
{ if( FichCmp == NULL )
wxString msg; {
msg.Printf( _("File <%s> not found, use Netlist for lib module selection"), wxString msg;
CmpFullFileName.GetData()) ; msg.Printf( _( "File <%s> not found, use Netlist for lib module selection" ),
DisplayError(this, msg, 20) ; CmpFullFileName.GetData() );
return(0); DisplayError( this, msg, 20 );
} return 0;
}
while( fgets(ia,sizeof(ia),FichCmp) != NULL )
{ while( fgets( ia, sizeof(ia), FichCmp ) != NULL )
if( strnicmp(ia,"BeginCmp",8) != 0 ) continue; {
if( strnicmp( ia, "BeginCmp", 8 ) != 0 )
/* Ici une description de 1 composant commence */ continue;
refcurrcmp.Empty();
idmod.Empty(); /* Ici une description de 1 composant commence */
timestamp = -1; refcurrcmp.Empty();
while( fgets(ia,sizeof(ia),FichCmp) != NULL ) idmod.Empty();
{ timestamp = -1;
if( strnicmp(ia,"EndCmp",6) == 0 ) break; while( fgets( ia, sizeof(ia), FichCmp ) != NULL )
{
if( strnicmp(ia,"Reference =",11) == 0 ) if( strnicmp( ia, "EndCmp", 6 ) == 0 )
{ break;
ptcar = ia+11;
ptcar = strtok(ptcar," =;\t\n"); if( strnicmp( ia, "Reference =", 11 ) == 0 )
if( ptcar ) refcurrcmp = CONV_FROM_UTF8(ptcar); {
continue; ptcar = ia + 11;
} ptcar = strtok( ptcar, " =;\t\n" );
if( ptcar )
if( strnicmp(ia,"IdModule =",11) == 0 ) refcurrcmp = CONV_FROM_UTF8( ptcar );
{ continue;
ptcar = ia+11; }
ptcar = strtok(ptcar," =;\t\n");
if( ptcar ) idmod = CONV_FROM_UTF8(ptcar); if( strnicmp( ia, "IdModule =", 11 ) == 0 )
continue; {
} ptcar = ia + 11;
if( strnicmp(ia,"TimeStamp =",11) == 0 ) ptcar = strtok( ptcar, " =;\t\n" );
{ if( ptcar )
ptcar = ia+11; idmod = CONV_FROM_UTF8( ptcar );
ptcar = strtok(ptcar," =;\t\n"); continue;
if( ptcar ) sscanf(ptcar, "%X", &timestamp); }
} if( strnicmp( ia, "TimeStamp =", 11 ) == 0 )
}/* Fin lecture 1 descr composant */ {
ptcar = ia + 11;
/* Test du Composant lu en fichier: est-il le bon */ ptcar = strtok( ptcar, " =;\t\n" );
if( RefCmp ) if( ptcar )
{ sscanf( ptcar, "%X", &timestamp );
if( RefCmp->CmpNoCase(refcurrcmp) == 0 ) }
{ }
fclose(FichCmp);
NameModule = idmod; /* Fin lecture 1 descr composant */
return(1);
} /* Test du Composant lu en fichier: est-il le bon */
} if( RefCmp )
else if( TimeStamp != -1 ) {
{ if( RefCmp->CmpNoCase( refcurrcmp ) == 0 )
if( TimeStamp == timestamp ) {
{ fclose( FichCmp );
fclose(FichCmp); NameModule = idmod;
NameModule = idmod; return 1;
return(1); }
} }
} else if( TimeStamp != -1 )
} {
fclose(FichCmp); if( TimeStamp == timestamp )
return(-1); {
fclose( FichCmp );
NameModule = idmod;
return 1;
}
}
}
fclose( FichCmp );
return -1;
} }
/***************************************************************/ /***************************************************************/
void WinEDA_NetlistFrame::Set_NetlisteName(wxCommandEvent& event) void WinEDA_NetlistFrame::Set_NetlisteName( wxCommandEvent& event )
/***************************************************************/ /***************************************************************/
/* Selection un nouveau nom de netliste /* Selection un nouveau nom de netliste
Affiche la liste des fichiers netlistes pour selection sur liste * Affiche la liste des fichiers netlistes pour selection sur liste
*/ */
{ {
wxString fullfilename, mask( wxT("*")); wxString fullfilename, mask( wxT( "*" ) );
mask += NetExtBuffer; mask += NetExtBuffer;
fullfilename = EDA_FileSelector( _("Netlist Selection:"), fullfilename = EDA_FileSelector( _( "Netlist Selection:" ),
wxEmptyString, /* Chemin par defaut */ wxEmptyString, /* Chemin par defaut */
NetNameBuffer, /* nom fichier par defaut */ NetNameBuffer, /* nom fichier par defaut */
NetExtBuffer, /* extension par defaut */ NetExtBuffer, /* extension par defaut */
mask, /* Masque d'affichage */ mask, /* Masque d'affichage */
this, this,
0, 0,
TRUE TRUE
); );
if ( fullfilename.IsEmpty()) return; if( fullfilename.IsEmpty() )
NetNameBuffer = fullfilename; return;
SetTitle(fullfilename); NetNameBuffer = fullfilename;
SetTitle( fullfilename );
} }
/***********************************************************************************/ /***********************************************************************************/
void WinEDA_NetlistFrame::AddToList(const wxString & NameLibCmp, const wxString & CmpName,int TimeStamp ) void WinEDA_NetlistFrame::AddToList( const wxString& NameLibCmp, const wxString& CmpName,
int TimeStamp )
/************************************************************************************/ /************************************************************************************/
/* Fontion copiant en memoire de travail les caracteristiques /* Fontion copiant en memoire de travail les caracteristiques
des nouveaux modules * des nouveaux modules
*/ */
{ {
MODULEtoLOAD * NewMod; MODULEtoLOAD* NewMod;
NewMod = new MODULEtoLOAD(NameLibCmp, CmpName, TimeStamp); NewMod = new MODULEtoLOAD( NameLibCmp, CmpName, TimeStamp );
NewMod->Pnext = s_ModuleToLoad_List; NewMod->Pnext = s_ModuleToLoad_List;
s_ModuleToLoad_List = NewMod; s_ModuleToLoad_List = NewMod;
s_NbNewModules++; s_NbNewModules++;
} }
/***************************************************************/ /***************************************************************/
void WinEDA_NetlistFrame::LoadListeModules(wxDC * DC) void WinEDA_NetlistFrame::LoadListeModules( wxDC* DC )
/***************************************************************/ /***************************************************************/
/* Routine de chargement des nouveaux modules en une seule lecture des /* Routine de chargement des nouveaux modules en une seule lecture des
librairies * librairies
Si un module vient d'etre charge il est duplique, ce qui evite une lecture * Si un module vient d'etre charge il est duplique, ce qui evite une lecture
inutile de la librairie * inutile de la librairie
*/ */
{ {
MODULEtoLOAD * ref, *cmp; MODULEtoLOAD* ref, * cmp;
int ii; int ii;
MODULE * Module = NULL; MODULE* Module = NULL;
wxPoint OldPos = m_Parent->m_CurrentScreen->m_Curseur; wxPoint OldPos = m_Parent->m_CurrentScreen->m_Curseur;
if( s_NbNewModules == 0 ) return; if( s_NbNewModules == 0 )
return;
SortListModulesToLoadByLibname(s_NbNewModules);
ref = cmp = s_ModuleToLoad_List; SortListModulesToLoadByLibname( s_NbNewModules );
ref = cmp = s_ModuleToLoad_List;
// Calcul de la coordonne de placement des modules:
if ( m_Parent->SetBoardBoundaryBoxFromEdgesOnly() ) // Calcul de la coordonne de placement des modules:
{ if( m_Parent->SetBoardBoundaryBoxFromEdgesOnly() )
m_Parent->m_CurrentScreen->m_Curseur.x = m_Parent->m_Pcb->m_BoundaryBox.GetRight() + 5000; {
m_Parent->m_CurrentScreen->m_Curseur.y = m_Parent->m_Pcb->m_BoundaryBox.GetBottom() + 10000; m_Parent->m_CurrentScreen->m_Curseur.x = m_Parent->m_Pcb->m_BoundaryBox.GetRight() + 5000;
} m_Parent->m_CurrentScreen->m_Curseur.y = m_Parent->m_Pcb->m_BoundaryBox.GetBottom() +
else 10000;
{ }
m_Parent->m_CurrentScreen->m_Curseur = wxPoint(0,0); else
} {
m_Parent->m_CurrentScreen->m_Curseur = wxPoint( 0, 0 );
for( ii = 0; ii < s_NbNewModules; ii++, cmp = cmp->Next() ) }
{
if( (ii == 0) || ( ref->m_LibName != cmp->m_LibName) ) for( ii = 0; ii < s_NbNewModules; ii++, cmp = cmp->Next() )
{ /* Nouveau Module a charger */ {
Module = m_Parent->Get_Librairie_Module(this, wxEmptyString, cmp->m_LibName, FALSE ); if( (ii == 0) || ( ref->m_LibName != cmp->m_LibName) )
ref = cmp; { /* Nouveau Module a charger */
if ( Module == NULL ) Module = m_Parent->Get_Librairie_Module( this, wxEmptyString, cmp->m_LibName, FALSE );
{ ref = cmp;
wxString msg; if( Module == NULL )
msg.Printf(_("Component [%s]: footprint <%s> not found"), {
cmp->m_CmpName.GetData(), cmp->m_LibName.GetData()); wxString msg;
DisplayError(this, msg); msg.Printf( _( "Component [%s]: footprint <%s> not found" ),
continue; cmp->m_CmpName.GetData(), cmp->m_LibName.GetData() );
} DisplayError( this, msg );
m_Parent->Place_Module(Module, DC); continue;
/* mise a jour des reperes ( nom et ref "Time Stamp") }
si module charge */ m_Parent->Place_Module( Module, DC );
Module->m_Reference->m_Text = cmp->m_CmpName;
Module->m_TimeStamp = cmp->m_TimeStamp; /* mise a jour des reperes ( nom et ref "Time Stamp")
} * si module charge */
Module->m_Reference->m_Text = cmp->m_CmpName;
else Module->m_TimeStamp = cmp->m_TimeStamp;
{ /* module deja charge, on peut le dupliquer */ }
MODULE * newmodule; else
if ( Module == NULL ) continue; /* module non existant en libr */ {
newmodule = new MODULE(m_Parent->m_Pcb); /* module deja charge, on peut le dupliquer */
newmodule->Copy(Module); MODULE* newmodule;
newmodule->AddToChain(Module); if( Module == NULL )
Module = newmodule; continue; /* module non existant en libr */
Module->m_Reference->m_Text = cmp->m_CmpName; newmodule = new MODULE( m_Parent->m_Pcb );
Module->m_TimeStamp = cmp->m_TimeStamp; newmodule->Copy( Module );
} newmodule->AddToChain( Module );
} Module = newmodule;
m_Parent->m_CurrentScreen->m_Curseur = OldPos; Module->m_Reference->m_Text = cmp->m_CmpName;
Module->m_TimeStamp = cmp->m_TimeStamp;
}
}
m_Parent->m_CurrentScreen->m_Curseur = OldPos;
} }
/* Routine utilisee par qsort pour le tri des modules a charger /* Routine utilisee par qsort pour le tri des modules a charger
*/ */
static int SortByLibName( MODULEtoLOAD ** ref, MODULEtoLOAD ** cmp ) static int SortByLibName( MODULEtoLOAD** ref, MODULEtoLOAD** cmp )
{ {
int ii = (*ref)->m_LibName.CmpNoCase((*cmp)->m_LibName); int ii = (*ref)->m_LibName.CmpNoCase( (*cmp)->m_LibName );
return ii; return ii;
} }
/*************************************************/ /*************************************************/
void SortListModulesToLoadByLibname(int NbModules) void SortListModulesToLoadByLibname( int NbModules )
/**************************************************/ /**************************************************/
/* Rearrage la liste des modules List par ordre alphabetique des noms lib des modules /* Rearrage la liste des modules List par ordre alphabetique des noms lib des modules
*/ */
{ {
MODULEtoLOAD ** base_list, * item; MODULEtoLOAD** base_list, * item;
int ii; int ii;
base_list = (MODULEtoLOAD **) MyMalloc( NbModules * sizeof(MODULEtoLOAD *) ); base_list = (MODULEtoLOAD**) MyMalloc( NbModules * sizeof(MODULEtoLOAD *) );
for ( ii = 0, item = s_ModuleToLoad_List; ii < NbModules; ii++ ) for( ii = 0, item = s_ModuleToLoad_List; ii < NbModules; ii++ )
{ {
base_list[ii] = item; base_list[ii] = item;
item = item->Next(); item = item->Next();
} }
qsort( base_list, NbModules, sizeof(MODULEtoLOAD*),
(int(*)(const void *, const void *) )SortByLibName); qsort( base_list, NbModules, sizeof(MODULEtoLOAD *),
// Reconstruction du chainage: ( int( * ) ( const void*, const void* ) )SortByLibName );
s_ModuleToLoad_List = *base_list;
for ( ii = 0; ii < NbModules-1; ii++ ) // Reconstruction du chainage:
{ s_ModuleToLoad_List = *base_list;
item = base_list[ii]; for( ii = 0; ii < NbModules - 1; ii++ )
item->Pnext = base_list[ii + 1]; {
} item = base_list[ii];
// Dernier item: Pnext = NULL: item->Pnext = base_list[ii + 1];
item = base_list[ii]; }
item->Pnext = NULL;
// Dernier item: Pnext = NULL:
free(base_list); item = base_list[ii];
item->Pnext = NULL;
free( base_list );
} }
/*****************************************************************************/ /*****************************************************************************/
MODULEtoLOAD::MODULEtoLOAD(const wxString & libname, const wxString & cmpname, MODULEtoLOAD::MODULEtoLOAD( const wxString& libname, const wxString& cmpname,
int timestamp) : EDA_BaseStruct(TYPE_NOT_INIT) int timestamp ) : EDA_BaseStruct( TYPE_NOT_INIT )
/*****************************************************************************/ /*****************************************************************************/
{ {
m_LibName = libname; m_LibName = libname;
m_CmpName = cmpname; m_CmpName = cmpname;
m_TimeStamp = timestamp; m_TimeStamp = timestamp;
} }
...@@ -643,6 +643,7 @@ void CreatePopUpMenuForFootprints( MODULE* Module, wxMenu* menu, bool full_menu ...@@ -643,6 +643,7 @@ void CreatePopUpMenuForFootprints( MODULE* Module, wxMenu* menu, bool full_menu
msg << wxT( " " ) << Module->m_Reference->m_Text; msg << wxT( " " ) << Module->m_Reference->m_Text;
sub_menu_footprint = new wxMenu; sub_menu_footprint = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_footprint, -1, msg, module_xpm ) ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_footprint, -1, msg, module_xpm )
if( full_menu ) if( full_menu )
{ {
......
...@@ -36,17 +36,6 @@ ...@@ -36,17 +36,6 @@
#define ZOOM_CENTER -4 #define ZOOM_CENTER -4
#define ZOOM_REDRAW -5 #define ZOOM_REDRAW -5
/* Bits Flags utilis� en �ition (membre .m_Flags de EDA_BaseStruct)*/
#define IS_LINKED 1
#define IN_EDIT 2
#define IS_MOVED 4
#define IS_NEW 8
#define IS_RESIZED 0x10
#define IS_DRAGGED 0x20
#define STARTPOINT 0x100
#define ENDPOINT 0x200
#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 )
......
...@@ -288,7 +288,7 @@ void WinEDA_PcbFrame::StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC ) ...@@ -288,7 +288,7 @@ void WinEDA_PcbFrame::StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC )
old_pos = TextePcb->m_Pos; old_pos = TextePcb->m_Pos;
TextePcb->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR ); TextePcb->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
TextePcb->m_Flags |= IS_MOVED; TextePcb->m_Flags |= IS_MOVED;
Affiche_Infos_PCB_Texte( this, TextePcb ); TextePcb->Display_Infos( this );
DrawPanel->ManageCurseur = Move_Texte_Pcb; DrawPanel->ManageCurseur = Move_Texte_Pcb;
DrawPanel->ForceCloseManageCurseur = Exit_Texte_Pcb; DrawPanel->ForceCloseManageCurseur = Exit_Texte_Pcb;
m_CurrentScreen->SetCurItem( TextePcb ); m_CurrentScreen->SetCurItem( TextePcb );
...@@ -399,7 +399,7 @@ void WinEDA_PcbFrame::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) ...@@ -399,7 +399,7 @@ void WinEDA_PcbFrame::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
/* Redessin du Texte */ /* Redessin du Texte */
TextePcb->Draw( DrawPanel, DC, wxPoint( 0, 0 ), drawmode ); TextePcb->Draw( DrawPanel, DC, wxPoint( 0, 0 ), drawmode );
Affiche_Infos_PCB_Texte( this, TextePcb ); TextePcb->Display_Infos( this );
m_CurrentScreen->SetModify(); m_CurrentScreen->SetModify();
} }
...@@ -18,14 +18,6 @@ LISTE_PAD* CreateSortedPadListByXCoord(BOARD * pcb); ...@@ -18,14 +18,6 @@ LISTE_PAD* CreateSortedPadListByXCoord(BOARD * pcb);
/**************/ /**************/
bool Read_Config(const wxString & project_name); bool Read_Config(const wxString & project_name);
/*********************/
/* CLASS_EQUIPOT.CPP */
/*********************/
EQUIPOT * GetEquipot(BOARD * pcb, int netcode);
/* retourne un pointeur sur la structure EQUIPOT de numero netcode */
/***************/ /***************/
/* TRACEPCB.CPP */ /* TRACEPCB.CPP */
/***************/ /***************/
...@@ -325,23 +317,6 @@ void Affiche_erreur(int nb_err) ; ...@@ -325,23 +317,6 @@ void Affiche_erreur(int nb_err) ;
/*****************************************************************/ /*****************************************************************/
/* AFFICHE.CPP: (Fonctions d'affichage de messages, parametres... */ /* AFFICHE.CPP: (Fonctions d'affichage de messages, parametres... */
/*****************************************************************/ /*****************************************************************/
void Affiche_Infos_Segment_Module(WinEDA_BasePcbFrame * frame, MODULE* pt_module,EDGE_MODULE* pt_edge);
/* Affiche en bas d'ecran les caract du Segment contour d'un module */
void Affiche_Infos_Piste(WinEDA_BasePcbFrame * frame, TRACK* pt_piste) ;
/* Affiche les caract principales d'un segment de piste en bas d'ecran */
void Affiche_Infos_E_Texte(WinEDA_BasePcbFrame * frame, MODULE * adr_empreinte,TEXTE_MODULE *pt_texte) ;
/* Affiche en bas d'ecran les caract du texte sur empreinte */
void Affiche_Infos_PCB_Texte(WinEDA_BasePcbFrame * frame, TEXTE_PCB* pt_texte);
/* Affiche en bas d'ecran les caract du texte type PCB */
void Affiche_Infos_Status_Pcb(WinEDA_BasePcbFrame * frame); /* Affiche l'etat du PCB:
nb de pads, nets , connexions.. */
void Affiche_Infos_DrawSegment(WinEDA_BasePcbFrame * frame, DRAWSEGMENT * DrawSegment);
/* Affiche les caract principales d'un segment type
drawing PCB en bas d'ecran */
void Affiche_Infos_Equipot(int netcode, WinEDA_BasePcbFrame * frame); void Affiche_Infos_Equipot(int netcode, WinEDA_BasePcbFrame * frame);
/************/ /************/
......
...@@ -61,7 +61,8 @@ wxString msg; ...@@ -61,7 +61,8 @@ wxString msg;
// Reaffichage des chevelus actifs // Reaffichage des chevelus actifs
if( g_Show_Ratsnest ) DrawGeneralRatsnest( DC, 0 ); if( g_Show_Ratsnest ) DrawGeneralRatsnest( DC, 0 );
if ( display_status_pcb ) Affiche_Infos_Status_Pcb(this); if ( display_status_pcb )
m_Pcb->Display_Infos( this );
} }
...@@ -376,7 +377,7 @@ EQUIPOT * equipot; ...@@ -376,7 +377,7 @@ EQUIPOT * equipot;
m_Pcb->m_NbLinks += nbpads; m_Pcb->m_NbLinks += nbpads;
/* fin de liste trouvee: calcul du chevelu du net "net_code" */ /* fin de liste trouvee: calcul du chevelu du net "net_code" */
equipot = GetEquipot(m_Pcb, current_net_code); equipot = m_Pcb->FindNet( current_net_code);
if(equipot == NULL) if(equipot == NULL)
DisplayError(this, wxT("Gen ratsnest err: NULL equipot") ); DisplayError(this, wxT("Gen ratsnest err: NULL equipot") );
else else
...@@ -617,7 +618,7 @@ EQUIPOT * equipot; ...@@ -617,7 +618,7 @@ EQUIPOT * equipot;
for ( net_code = 1; ; net_code++) for ( net_code = 1; ; net_code++)
{ {
equipot = GetEquipot(m_Pcb, net_code); equipot = m_Pcb->FindNet( net_code );
if(equipot == NULL ) break; if(equipot == NULL ) break;
if( ref_netcode && (net_code != ref_netcode) ) continue; if( ref_netcode && (net_code != ref_netcode) ) continue;
......
...@@ -179,7 +179,7 @@ int no_conn = Pcb->m_NbPads+1; /* valeur incrementee pour indiquer ...@@ -179,7 +179,7 @@ int no_conn = Pcb->m_NbPads+1; /* valeur incrementee pour indiquer
if ( nb_pads < 2 ) if ( nb_pads < 2 )
{ {
wxString Line; wxString Line;
EQUIPOT * equipot = GetEquipot(Pcb, netcode); EQUIPOT * equipot = Pcb->FindNet( netcode );
Line.Printf( wxT("Warning: %d pad, net %s"), Line.Printf( wxT("Warning: %d pad, net %s"),
nb_pads, equipot->m_Netname.GetData()); nb_pads, equipot->m_Netname.GetData());
DisplayError(NULL, Line,20); DisplayError(NULL, Line,20);
......
...@@ -217,7 +217,7 @@ wxString msg; ...@@ -217,7 +217,7 @@ wxString msg;
} }
Ncurrent++; Ncurrent++;
pt_equipot = GetEquipot(m_Pcb, current_net_code); pt_equipot = m_Pcb->FindNet( current_net_code );
if( pt_equipot) if( pt_equipot)
{ {
msg.Printf( wxT("[%8.8s]"),pt_equipot->m_Netname.GetData()); msg.Printf( wxT("[%8.8s]"),pt_equipot->m_Netname.GetData());
......
/********************************************************/ /********************************************************/
/* Effacements : Routines de sauvegarde et d'effacement */ /* Effacements : Routines de sauvegarde et d'effacement */
/********************************************************/ /********************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
...@@ -15,130 +15,139 @@ ...@@ -15,130 +15,139 @@
/* Routines Locales */ /* Routines Locales */
/********************************************/ /********************************************/
void WinEDA_PcbFrame::UnDeleteItem(wxDC * DC) void WinEDA_PcbFrame::UnDeleteItem( wxDC* DC )
/********************************************/ /********************************************/
/* Restitution d'un element (MODULE ou TRACK ) Efface /* Restitution d'un element (MODULE ou TRACK ) Efface
*/ */
{ {
EDA_BaseStruct * PtStruct, *PtNext; EDA_BaseStruct* PtStruct, * PtNext;
TRACK * pt_track; TRACK* pt_track;
int net_code; int net_code;
if( ! g_UnDeleteStackPtr ) return; if( !g_UnDeleteStackPtr )
return;
g_UnDeleteStackPtr --;
PtStruct = g_UnDeleteStack[g_UnDeleteStackPtr]; g_UnDeleteStackPtr--;
if ( PtStruct == NULL ) return; // Ne devrait pas se produire PtStruct = g_UnDeleteStack[g_UnDeleteStackPtr];
if( PtStruct == NULL )
switch(PtStruct->m_StructType) return; // Ne devrait pas se produire
{
case TYPEVIA: switch( PtStruct->m_StructType )
case TYPETRACK: {
for( ; PtStruct != NULL; PtStruct = PtNext) case TYPEVIA:
{ case TYPETRACK:
PtNext = PtStruct->Pnext; for( ; PtStruct != NULL; PtStruct = PtNext )
PtStruct->SetState(DELETED,OFF); /* Effacement du bit DELETED */ {
((TRACK*)PtStruct)->Draw(DrawPanel, DC, GR_OR); PtNext = PtStruct->Pnext;
} PtStruct->SetState( DELETED, OFF ); /* Effacement du bit DELETED */
( (TRACK*) PtStruct )->Draw( DrawPanel, DC, GR_OR );
PtStruct = g_UnDeleteStack[g_UnDeleteStackPtr]; }
net_code = ((TRACK*)PtStruct)->m_NetCode;
pt_track = ( (TRACK*) PtStruct)->GetBestInsertPoint( m_Pcb ); PtStruct = g_UnDeleteStack[g_UnDeleteStackPtr];
((TRACK*)PtStruct)->Insert(m_Pcb, pt_track); net_code = ( (TRACK*) PtStruct )->m_NetCode;
g_UnDeleteStack[g_UnDeleteStackPtr] = NULL; pt_track = ( (TRACK*) PtStruct )->GetBestInsertPoint( m_Pcb );
( (TRACK*) PtStruct )->Insert( m_Pcb, pt_track );
test_1_net_connexion(DC, net_code ); g_UnDeleteStack[g_UnDeleteStackPtr] = NULL;
Affiche_Infos_Status_Pcb(this);
break; test_1_net_connexion( DC, net_code );
m_Pcb->Display_Infos( this );
case TYPEMODULE: break;
/* Erase general rastnest if needed */
if(g_Show_Ratsnest) DrawGeneralRatsnest(DC); case TYPEMODULE:
/* Reinsertion du module dans la liste chainee des modules, /* Erase general rastnest if needed */
en debut de chaine */ if( g_Show_Ratsnest )
PtStruct->Pback = m_Pcb; DrawGeneralRatsnest( DC );
PtNext = m_Pcb->m_Modules;
PtStruct->Pnext = PtNext; /* Reinsertion du module dans la liste chainee des modules,
if( PtNext) PtNext->Pback = PtStruct; * en debut de chaine */
m_Pcb->m_Modules = (MODULE*)PtStruct; PtStruct->Pback = m_Pcb;
g_UnDeleteStack[g_UnDeleteStackPtr] = NULL; PtNext = m_Pcb->m_Modules;
PtStruct->Pnext = PtNext;
((MODULE *) PtStruct)->Draw(DrawPanel, DC, wxPoint(0,0), GR_OR); if( PtNext )
PtNext->Pback = PtStruct;
PtStruct->SetState(DELETED,OFF); /* Creal DELETED flag */ m_Pcb->m_Modules = (MODULE*) PtStruct;
PtStruct->m_Flags = 0; g_UnDeleteStack[g_UnDeleteStackPtr] = NULL;
m_Pcb->m_Status_Pcb = 0 ;
build_liste_pads(); ( (MODULE*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
ReCompile_Ratsnest_After_Changes( DC );
break; PtStruct->SetState( DELETED, OFF ); /* Creal DELETED flag */
PtStruct->m_Flags = 0;
default: m_Pcb->m_Status_Pcb = 0;
DisplayError(this, wxT("WinEDA_PcbFrame::UnDeleteItem(): unexpected Struct type")); build_liste_pads();
break; ReCompile_Ratsnest_After_Changes( DC );
} break;
default:
DisplayError( this, wxT( "WinEDA_PcbFrame::UnDeleteItem(): unexpected Struct type" ) );
break;
}
} }
/**************************************************************/ /**************************************************************/
/* void * SaveItemEfface(int type, void * PtItem, int nbitems) */ /* void * SaveItemEfface(int type, void * PtItem, int nbitems) */
/**************************************************************/ /**************************************************************/
/* Sauvegarde d'un element aux fins de restitution par Undelete /* Sauvegarde d'un element aux fins de restitution par Undelete
Supporte actuellement : Module et segments de piste * Supporte actuellement : Module et segments de piste
*/ */
EDA_BaseStruct * WinEDA_PcbFrame::SaveItemEfface(EDA_BaseStruct * PtItem, int nbitems) EDA_BaseStruct* WinEDA_PcbFrame::SaveItemEfface( EDA_BaseStruct* PtItem, int nbitems )
{ {
EDA_BaseStruct * NextS, * PtStruct = PtItem; EDA_BaseStruct* NextS, * PtStruct = PtItem;
int ii; int ii;
if( (PtItem == NULL) || (nbitems == 0) ) return NULL; if( (PtItem == NULL) || (nbitems == 0) )
return NULL;
if (g_UnDeleteStackPtr >= UNDELETE_STACK_SIZE )
{ if( g_UnDeleteStackPtr >= UNDELETE_STACK_SIZE )
/* Delete last deleted item, and shift stack. */ {
DeleteStructList(g_UnDeleteStack[0]); /* Delete last deleted item, and shift stack. */
for (ii = 0; ii < (g_UnDeleteStackPtr-1); ii++) DeleteStructList( g_UnDeleteStack[0] );
{ for( ii = 0; ii < (g_UnDeleteStackPtr - 1); ii++ )
g_UnDeleteStack[ii] = g_UnDeleteStack[ii + 1]; {
} g_UnDeleteStack[ii] = g_UnDeleteStack[ii + 1];
g_UnDeleteStackPtr--;; }
}
g_UnDeleteStackPtr--;;
switch ( PtStruct->m_StructType ) }
{
case TYPEVIA: switch( PtStruct->m_StructType )
case TYPETRACK: {
{ case TYPEVIA:
EDA_BaseStruct * Back = NULL; case TYPETRACK:
g_UnDeleteStack[g_UnDeleteStackPtr++] = PtStruct; {
EDA_BaseStruct* Back = NULL;
for ( ; nbitems > 0; nbitems--, PtStruct = NextS) g_UnDeleteStack[g_UnDeleteStackPtr++] = PtStruct;
{
NextS = PtStruct->Pnext; for( ; nbitems > 0; nbitems--, PtStruct = NextS )
((TRACK*)PtStruct)->UnLink(); {
PtStruct->SetState(DELETED, ON); NextS = PtStruct->Pnext;
if( nbitems <= 1 ) NextS = NULL; /* fin de chaine */ ( (TRACK*) PtStruct )->UnLink();
PtStruct->Pnext = NextS; PtStruct->SetState( DELETED, ON );
PtStruct->Pback = Back; Back = PtStruct; if( nbitems <= 1 )
if(NextS == NULL) break; NextS = NULL; /* fin de chaine */
} PtStruct->Pnext = NextS;
} PtStruct->Pback = Back; Back = PtStruct;
break; if( NextS == NULL )
break;
case TYPEMODULE: }
{ }
MODULE * Module = (MODULE*)PtItem; break;
Module->UnLink();
Module->SetState(DELETED, ON); case TYPEMODULE:
g_UnDeleteStack[g_UnDeleteStackPtr++] = Module; {
build_liste_pads(); MODULE* Module = (MODULE*) PtItem;
} Module->UnLink();
break; Module->SetState( DELETED, ON );
g_UnDeleteStack[g_UnDeleteStackPtr++] = Module;
default: break; build_liste_pads();
} }
break;
return(g_UnDeleteStack[g_UnDeleteStackPtr-1]);
default:
break;
}
return g_UnDeleteStack[g_UnDeleteStackPtr - 1];
} }
...@@ -548,7 +548,7 @@ void WinEDA_PcbFrame::CaptureNetName( wxDC* DC ) ...@@ -548,7 +548,7 @@ void WinEDA_PcbFrame::CaptureNetName( wxDC* DC )
} }
else else
{ {
Affiche_Infos_Piste( this, adrpiste ); adrpiste->Display_Infos( this );
netcode = adrpiste->m_NetCode; netcode = adrpiste->m_NetCode;
} }
...@@ -901,7 +901,7 @@ void WinEDA_PcbFrame::Fill_Zone( wxDC* DC ) ...@@ -901,7 +901,7 @@ void WinEDA_PcbFrame::Fill_Zone( wxDC* DC )
/* Affichage du NetName */ /* Affichage du NetName */
if( g_HightLigth_NetCode > 0 ) if( g_HightLigth_NetCode > 0 )
{ {
pt_equipot = GetEquipot( m_Pcb, g_HightLigth_NetCode ); pt_equipot = m_Pcb->FindNet( g_HightLigth_NetCode );
if( pt_equipot == NULL ) if( pt_equipot == NULL )
{ {
if( g_HightLigth_NetCode > 0 ) if( g_HightLigth_NetCode > 0 )
......
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