7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-19 12:01:42 +00:00

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

This commit is contained in:
dickelbeck 2007-08-20 19:33:15 +00:00
parent 0421987b32
commit 49e32e096e
47 changed files with 1989 additions and 1803 deletions

View File

@ -4,6 +4,26 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
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>
================================================================================
+ eeschema & pcbnew
@ -14,13 +34,13 @@ email address.
2007-aug-20 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+ eeschema & pcbnew
modify hotkeys.cpp code (large modifications).
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
modify hotkeys.cpp code (large modifications).
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
+ pcbnew
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)
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)
2007-Aug-19 UPDATE Dick Hollenbeck <dick@softplc.com>

View File

@ -13,10 +13,6 @@
#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,

View File

@ -24,18 +24,6 @@
#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 */
#define IS_SELECTED 1

View File

@ -1,6 +1,6 @@
/***************************************************/
/* Localisation des elements pointes par la souris */
/***************************************************/
/***************************************************/
/* Localisation des elements pointes par la souris */
/***************************************************/
#include "fctsys.h"
@ -12,139 +12,148 @@
/* variables locales */
int ux0 , uy0 ,dx, dy, spot_cX, spot_cY; /* Variables utilisees pour
la localisation des segments */
int ux0, uy0, dx, dy, spot_cX, spot_cY; /* Variables utilisees pour
* la localisation des segments */
/* fonctions locales */
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_Pistes(TRACK * start_adresse,int Layer, int typeloc );
static TRACK * Locate_Pistes(TRACK * start_adresse, wxPoint ref,int Layer);
static DRAWSEGMENT * Locate_Segment_Pcb(BOARD * Pcb, int typeloc);
static TEXTE_PCB * Locate_Texte_Pcb(TEXTE_PCB* pt_txt_pcb, int typeloc);
static int distance(int seuil);
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_Pistes( TRACK* start_adresse, int Layer, int typeloc );
static TRACK* Locate_Pistes( TRACK* start_adresse, wxPoint ref, int Layer );
static DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int typeloc );
static TEXTE_PCB* Locate_Texte_Pcb( TEXTE_PCB* pt_txt_pcb, int typeloc );
static int distance( int seuil );
/**/
/* Macro de calcul de la coord de pointage selon le curseur
(ON/OFF grille) choisi
*/
#define SET_REF_POS(ref) if(typeloc == CURSEUR_ON_GRILLE) \
{ ref = ActiveScreen->m_Curseur;} \
else { ref = ActiveScreen->m_MousePosition; }
* (ON/OFF grille) choisi
*/
#define SET_REF_POS( ref ) if( typeloc == CURSEUR_ON_GRILLE ) \
{ ref = ActiveScreen->m_Curseur; } \
else { ref = ActiveScreen->m_MousePosition; }
/*************************************************************/
EDA_BaseStruct * WinEDA_GerberFrame::Locate( int typeloc )
EDA_BaseStruct* WinEDA_GerberFrame::Locate( int typeloc )
/*************************************************************/
/* Fonction de localisation generale
Affiche les caract de la stucture localisée et retourne un pointeur
sur celle-ci
*/
* Affiche les caract de la stucture localisée et retourne un pointeur
* sur celle-ci
*/
{
TEXTE_PCB * pt_texte_pcb;
TRACK * Track , * TrackLocate ;
DRAWSEGMENT * DrawSegm;
int layer;
TEXTE_PCB* pt_texte_pcb;
TRACK* Track, * TrackLocate;
DRAWSEGMENT* DrawSegm;
int layer;
/* Localistion des pistes et vias, avec priorite aux vias */
layer = GetScreen()->m_Active_Layer;
Track = Locate_Pistes( m_Pcb->m_Track, -1, typeloc );
if ( Track != NULL )
{
TrackLocate = Track ; /* Reperage d'une piste ou via */
/* recherche de 1 via eventuelle */
while((TrackLocate = Locate_Pistes(TrackLocate, layer,typeloc)) != NULL )
{
Track = TrackLocate;
if(TrackLocate->m_StructType == TYPEVIA) break ;
TrackLocate = (TRACK*) TrackLocate->Pnext;
}
Affiche_Infos_Piste(this, Track) ;
return Track;
}
/* Localistion des pistes et vias, avec priorite aux vias */
layer = GetScreen()->m_Active_Layer;
Track = Locate_Pistes( m_Pcb->m_Track, -1, typeloc );
if( Track != NULL )
{
TrackLocate = Track; /* Reperage d'une piste ou via */
/* recherche de 1 via eventuelle */
while( ( TrackLocate = Locate_Pistes( TrackLocate, layer, typeloc ) ) != NULL )
{
Track = TrackLocate;
if( TrackLocate->m_StructType == TYPEVIA )
break;
TrackLocate = (TRACK*) TrackLocate->Pnext;
}
pt_texte_pcb = Locate_Texte_Pcb((TEXTE_PCB*) m_Pcb->m_Drawings, typeloc);
if(pt_texte_pcb ) // texte type PCB localise
{
Affiche_Infos_PCB_Texte(this, pt_texte_pcb); return pt_texte_pcb;
}
Track->Display_Infos( this );
return Track;
}
if ( (DrawSegm = Locate_Segment_Pcb(m_Pcb, typeloc)) != NULL)
{
return DrawSegm;
}
if( (TrackLocate = Locate_Zone((TRACK*)m_Pcb->m_Zone,
GetScreen()->m_Active_Layer,typeloc)) != NULL )
{
Affiche_Infos_Piste(this, TrackLocate) ; return TrackLocate;
}
pt_texte_pcb = Locate_Texte_Pcb( (TEXTE_PCB*) m_Pcb->m_Drawings, typeloc );
if( pt_texte_pcb ) // texte type PCB localise
{
pt_texte_pcb->Display_Infos( this );
return pt_texte_pcb;
}
MsgPanel->EraseMsgBox();
return NULL;
if( ( DrawSegm = Locate_Segment_Pcb( m_Pcb, typeloc ) ) != NULL )
{
return DrawSegm;
}
if( ( TrackLocate = Locate_Zone( (TRACK*) m_Pcb->m_Zone,
GetScreen()->m_Active_Layer, typeloc ) ) != NULL )
{
TrackLocate->Display_Infos( this );
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
(selon couche active)
Retourne:
Pointeur sur DEBUT du segment localise
NULL si rien trouve
*/
* (selon couche active)
* Retourne:
* Pointeur sur DEBUT du segment localise
* NULL si rien trouve
*/
{
EDA_BaseStruct * PtStruct;
DRAWSEGMENT * pts;
wxPoint ref;
PCB_SCREEN * screen = (PCB_SCREEN *) ActiveScreen;
SET_REF_POS(ref);
EDA_BaseStruct* PtStruct;
DRAWSEGMENT* pts;
wxPoint ref;
PCB_SCREEN* screen = (PCB_SCREEN*) ActiveScreen;
PtStruct = Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
{
if( PtStruct->m_StructType != TYPEDRAWSEGMENT ) continue;
pts = ( DRAWSEGMENT * ) PtStruct;
ux0 = pts->m_Start.x ; uy0 = pts->m_Start.y;
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
dx = pts->m_End.x - ux0 ; dy = pts->m_End.y - uy0 ;
spot_cX = ref.x - ux0; spot_cY = ref.y - uy0 ;
SET_REF_POS( ref );
/* detection : */
if(pts->m_Layer != screen->m_Active_Layer) continue;
PtStruct = Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
{
if( PtStruct->m_StructType != TYPEDRAWSEGMENT )
continue;
pts = (DRAWSEGMENT*) PtStruct;
ux0 = pts->m_Start.x; uy0 = pts->m_Start.y;
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
dx = pts->m_End.x - ux0; dy = pts->m_End.y - uy0;
spot_cX = ref.x - ux0; spot_cY = ref.y - uy0;
if( (pts->m_Shape == S_CIRCLE) || (pts->m_Shape == S_ARC) )
{
int rayon, dist, StAngle, EndAngle, MouseAngle;
rayon = (int) hypot((double)(dx),(double)(dy) );
dist = (int) hypot((double)(spot_cX),(double)(spot_cY) );
if( abs(rayon-dist) <= (pts->m_Width/2) )
{
if(pts->m_Shape == S_CIRCLE) return(pts);
/* pour un arc, controle complementaire */
MouseAngle = (int) ArcTangente(spot_cY, spot_cX);
StAngle = (int) ArcTangente(dy, dx);
EndAngle = StAngle + pts->m_Angle;
/* detection : */
if( pts->m_Layer != screen->m_Active_Layer )
continue;
if( EndAngle > 3600 )
{
StAngle -= 3600; EndAngle -= 3600;
}
if( (MouseAngle >= StAngle) && (MouseAngle <= EndAngle) )
return(pts);
}
}
if( (pts->m_Shape == S_CIRCLE) || (pts->m_Shape == S_ARC) )
{
int rayon, dist, StAngle, EndAngle, MouseAngle;
rayon = (int) hypot( (double) (dx), (double) (dy) );
dist = (int) hypot( (double) (spot_cX), (double) (spot_cY) );
if( abs( rayon - dist ) <= (pts->m_Width / 2) )
{
if( pts->m_Shape == S_CIRCLE )
return pts;
/* pour un arc, controle complementaire */
MouseAngle = (int) ArcTangente( spot_cY, spot_cX );
StAngle = (int) ArcTangente( dy, dx );
EndAngle = StAngle + pts->m_Angle;
else
{
if( distance( pts->m_Width /2 ) ) return( pts ) ;
}
}
return(NULL) ;
if( EndAngle > 3600 )
{
StAngle -= 3600; EndAngle -= 3600;
}
if( (MouseAngle >= StAngle) && (MouseAngle <= EndAngle) )
return pts;
}
}
else
{
if( distance( pts->m_Width / 2 ) )
return pts;
}
}
return NULL;
}
@ -154,294 +163,303 @@ PCB_SCREEN * screen = (PCB_SCREEN *) ActiveScreen;
/****************************************************************************/
/*
1 - routine de localisation du segment de piste pointe par la souris.
2 - routine de localisation du segment de piste pointe par le point
ref_pX , ref_pY.r
* 1 - routine de localisation du segment de piste pointe par la souris.
* 2 - routine de localisation du segment de piste pointe par le point
* 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 */
int l_piste ; /* demi-largeur de la piste */
TRACK* Track; /* pointeur sur les pistes */
int l_piste; /* demi-largeur de la piste */
for( Track = start_adresse; Track != NULL; Track = (TRACK*) Track->Pnext)
{
if( Track->GetState(BUSY|DELETED) ) continue;
/* calcul des coordonnees du segment teste */
l_piste = Track->m_Width >> 1; /* l_piste = demi largeur piste */
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 */
for( Track = start_adresse; Track != NULL; Track = (TRACK*) Track->Pnext )
{
if( Track->GetState( BUSY | DELETED ) )
continue;
/* calcul des coordonnees du segment teste */
l_piste = Track->m_Width >> 1; /* l_piste = demi largeur piste */
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 ;
spot_cX = ref.x - ux0 ; spot_cY = ref.y - uy0 ;
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
dx -= ux0; dy -= uy0;
spot_cX = ref.x - ux0; spot_cY = ref.y - uy0;
if ( Track->m_StructType == TYPEVIA ) /* VIA rencontree */
{
if ((abs(spot_cX) <= l_piste ) && (abs(spot_cY) <=l_piste))
{
return(Track) ;
}
continue ;
}
if( Track->m_StructType == TYPEVIA ) /* VIA rencontree */
{
if( (abs( spot_cX ) <= l_piste ) && (abs( spot_cY ) <=l_piste) )
{
return Track;
}
continue;
}
if(Layer >= 0)
if( Track->m_Layer != Layer )
continue; /* Segments sur couches differentes */
if( distance(l_piste) ) return(Track) ;
}
return(NULL) ;
if( Layer >= 0 )
if( Track->m_Layer != Layer )
continue;/* Segments sur couches differentes */
if( distance( l_piste ) )
return Track;
}
return NULL;
}
/****************************************************************/
/* TRACK * Locate_Zone(TRACK * start_adresse, int layer, */
/* int typeloc) */
/* TRACK * Locate_Zone(TRACK * start_adresse,wxPoint ref, int layer) */
/****************************************************************/
/****************************************************************/
/* 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.
2 - routine de localisation du segment de zone pointe par le point
ref_pX , ref_pY.r
* 1 - routine de localisation du segment de zone pointe par la souris.
* 2 - routine de localisation du segment de zone pointe par le point
* 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
*/
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 )
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 */
int l_segm ; /* demi-largeur de la piste */
TRACK* Zone; /* pointeur sur les pistes */
int l_segm; /* demi-largeur de la piste */
for( Zone = start_adresse; Zone != NULL; Zone = (TRACK *) Zone->Pnext)
{
/* calcul des coordonnees du segment teste */
l_segm = Zone->m_Width >> 1; /* l_piste = demi largeur piste */
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 */
for( Zone = start_adresse; Zone != NULL; Zone = (TRACK*) Zone->Pnext )
{
/* calcul des coordonnees du segment teste */
l_segm = Zone->m_Width >> 1; /* l_piste = demi largeur piste */
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 */
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
dx -= ux0 ; dy -= uy0 ;
spot_cX = ref.x - ux0 ; spot_cY = ref.y - uy0 ;
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
dx -= ux0; dy -= uy0;
spot_cX = ref.x - ux0; spot_cY = ref.y - uy0;
if((layer != -1) && (Zone->m_Layer != layer)) continue;
if( distance(l_segm) ) return(Zone) ;
}
return(NULL) ;
if( (layer != -1) && (Zone->m_Layer != layer) )
continue;
if( distance( l_segm ) )
return Zone;
}
return NULL;
}
/***************************************************************/
/* TEXTE_PCB * Locate_Texte_Pcb(char * pt_txt_pcb,int typeloc) */
/***************************************************************/
/***************************************************************/
/* TEXTE_PCB * Locate_Texte_Pcb(char * pt_txt_pcb,int typeloc) */
/***************************************************************/
/* localisation des inscriptions sur le Pcb:
* 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:
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)
TEXTE_PCB* Locate_Texte_Pcb( TEXTE_PCB* pt_txt_pcb, int typeloc )
{
int angle ;
EDA_BaseStruct * PtStruct;
wxPoint ref;
int angle;
EDA_BaseStruct* PtStruct;
wxPoint ref;
SET_REF_POS(ref);
PtStruct = (EDA_BaseStruct *) pt_txt_pcb ;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
{
if( PtStruct->m_StructType != TYPETEXTE ) continue;
pt_txt_pcb = (TEXTE_PCB *) PtStruct;
SET_REF_POS( ref );
PtStruct = (EDA_BaseStruct*) pt_txt_pcb;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
{
if( PtStruct->m_StructType != TYPETEXTE )
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;
dx = (pt_txt_pcb->m_Size.x * pt_txt_pcb->GetLength()) / 2;
dy = pt_txt_pcb->m_Size.y /2 ;
angle = pt_txt_pcb->m_Orient;
ux0 = pt_txt_pcb->m_Pos.x; uy0 = pt_txt_pcb->m_Pos.y;
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 ;
RotatePoint(&spot_cX, &spot_cY, -angle);
if( (abs(spot_cX) <= abs(dx) ) && ( abs(spot_cY) <= abs(dy) ) )
return(pt_txt_pcb) ;
}
return(NULL) ;
/* la souris est-elle dans ce rectangle autour du centre */
spot_cX = ref.x - ux0; spot_cY = ref.y - uy0;
RotatePoint( &spot_cX, &spot_cY, -angle );
if( ( abs( spot_cX ) <= abs( dx ) ) && ( abs( spot_cY ) <= abs( dy ) ) )
return pt_txt_pcb;
}
return NULL;
}
/*****************************/
/* int distance(int seuil) */
/*****************************/
/*****************************/
/* int distance(int seuil) */
/*****************************/
/*
Calcul de la distance du curseur souris a un segment de droite :
( piste, edge, contour module ..
retourne:
0 si distance > seuil
1 si distance <= seuil
Variables utilisees ( doivent etre initialisees avant appel , et
sont ramenees au repere centre sur l'origine du segment)
dx, dy = coord de l'extremite segment.
spot_cX,spot_cY = coord du curseur souris
la recherche se fait selon 4 cas:
segment horizontal
segment vertical
segment 45
segment quelconque
*/
* Calcul de la distance du curseur souris a un segment de droite :
* ( piste, edge, contour module ..
* retourne:
* 0 si distance > seuil
* 1 si distance <= seuil
* Variables utilisees ( doivent etre initialisees avant appel , et
* sont ramenees au repere centre sur l'origine du segment)
* dx, dy = coord de l'extremite segment.
* spot_cX,spot_cY = coord du curseur souris
* la recherche se fait selon 4 cas:
* segment horizontal
* segment vertical
* segment 45
* segment quelconque
*/
int distance(int seuil)
int distance( int seuil )
{
int cXrot, cYrot , /* coord du point (souris) dans le repere tourne */
segX, segY; /* coord extremite segment tj >= 0 */
int pointX, pointY; /* coord point a tester dans repere modifie dans lequel
segX et segY sont >=0 */
int cXrot, cYrot, /* coord du point (souris) dans le repere tourne */
segX, segY; /* coord extremite segment tj >= 0 */
int pointX, pointY;/* coord point a tester dans repere modifie dans lequel
* 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)*/
if (segX < 0) /* mise en >0 par symetrie par rapport a l'axe Y */
{
segX = -segX ; pointX = - pointX ;
}
if (segY < 0) /* mise en > 0 par symetrie par rapport a l'axe X */
{
segY = -segY ; pointY = -pointY ;
}
/*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 */
{
segX = -segX; pointX = -pointX;
}
if( segY < 0 ) /* mise en > 0 par symetrie par rapport a l'axe X */
{
segY = -segY; pointY = -pointY;
}
if ( segY == 0 ) /* piste Horizontale */
{
if(abs(pointY) <= seuil )
{
if((pointX >= 0) && (pointX <= segX) ) return(1);
/* Etude des extremites : cercle de rayon seuil */
if( (pointX < 0) && (pointX >= -seuil) )
{
if( ((pointX * pointX) + (pointY*pointY)) <= (seuil*seuil) )
return(1);
}
if( (pointX > segX) && (pointX <= (segX+seuil)) )
{
if( (((pointX-segX) * (pointX-segX)) + (pointY*pointY)) <= (seuil*seuil) )
return(1);
}
}
}
if( segY == 0 ) /* piste Horizontale */
{
if( abs( pointY ) <= seuil )
{
if( (pointX >= 0) && (pointX <= segX) )
return 1;
/* Etude des extremites : cercle de rayon seuil */
if( (pointX < 0) && (pointX >= -seuil) )
{
if( ( (pointX * pointX) + (pointY * pointY) ) <= (seuil * seuil) )
return 1;
}
if( (pointX > segX) && ( pointX <= (segX + seuil) ) )
{
if( ( ( (pointX - segX) * (pointX - segX) ) + (pointY * pointY) ) <=
(seuil * seuil) )
return 1;
}
}
}
else if( segX == 0 ) /* piste verticale */
{
if( abs( pointX ) <= seuil )
{
if( (pointY >= 0 ) && (pointY <= segY) )
return 1;
if( (pointY < 0) && (pointY >= -seuil) )
{
if( ( (pointY * pointY) + (pointX * pointX) ) <= (seuil * seuil) )
return 1;
}
if( (pointY > segY) && ( pointY <= (segY + seuil) ) )
{
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
* coord : x1 = x*cos45 + y*sin45
* y1 = y*cos45 - x*sin45
* et le segment de piste est alors horizontal.
* recalcul des coord de la souris ( sin45 = cos45 = .707 = 7/10
* remarque : sin ou cos45 = .707, et lors du recalcul des coord
* dx45 et dy45, lec coeff .707 est neglige, dx et dy sont en fait .707 fois
* trop grands. (c.a.d trop petits)
* spot_cX,Y doit etre * par .707 * .707 = 0.5 */
else if ( segX == 0 ) /* piste verticale */
{
if( abs(pointX) <= seuil)
{
if((pointY >= 0 ) && (pointY <= segY) ) return(1);
if( (pointY < 0) && (pointY >= -seuil) )
{
if( ((pointY * pointY) + (pointX*pointX)) <= (seuil*seuil) )
return(1);
}
if( (pointY > segY) && (pointY <= (segY+seuil)) )
{
if( ( ((pointY-segY) * (pointY-segY)) + (pointX*pointX)) <= (seuil*seuil) )
return(1);
}
}
}
cXrot = (pointX + pointY) >> 1;
cYrot = (pointY - pointX) >> 1;
else if ( segX == segY ) /* piste a 45 degre */
{
/* on fait tourner les axes de 45 degre. la souris a alors les
coord : x1 = x*cos45 + y*sin45
y1 = y*cos45 - x*sin45
et le segment de piste est alors horizontal.
recalcul des coord de la souris ( sin45 = cos45 = .707 = 7/10
remarque : sin ou cos45 = .707, et lors du recalcul des coord
dx45 et dy45, lec coeff .707 est neglige, dx et dy sont en fait .707 fois
trop grands. (c.a.d trop petits)
spot_cX,Y doit etre * par .707 * .707 = 0.5 */
/* recalcul des coord de l'extremite du segment , qui sera vertical
* suite a l'orientation des axes sur l'ecran : dx45 = pointX (ou pointY)
* et est en fait 1,414 plus grand , et dy45 = 0 */
cXrot = (pointX + pointY) >> 1 ;
cYrot = (pointY - pointX) >> 1 ;
// seuil doit etre * .707 pour tenir compte du coeff de reduction sur dx,dy
seuil *= 7; seuil /= 10;
if( abs( cYrot ) <= seuil ) /* ok sur axe vertical) */
{
if( (cXrot >= 0) && (cXrot <= segX) )
return 1;
/* recalcul des coord de l'extremite du segment , qui sera vertical
suite a l'orientation des axes sur l'ecran : dx45 = pointX (ou pointY)
et est en fait 1,414 plus grand , et dy45 = 0 */
// seuil doit etre * .707 pour tenir compte du coeff de reduction sur dx,dy
seuil *= 7 ; seuil /= 10 ;
if ( abs(cYrot) <= seuil) /* ok sur axe vertical) */
{
if ((cXrot >= 0) && (cXrot <= segX) ) return(1) ;
/* Etude des extremites : cercle de rayon seuil */
if( (cXrot < 0) && (cXrot >= -seuil) )
{
if( ( (cXrot * cXrot) + (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 */
int angle;
/* Etude des extremites : cercle de rayon seuil */
if( (cXrot < 0) && (cXrot >= -seuil) )
{
if( ((cXrot * cXrot) + (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 */
int angle;
angle = (int) ( atan2( (float) segY, (float) segX ) * 1800 / M_PI);
cXrot = pointX; cYrot = pointY;
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;
RotatePoint(&cXrot, &cYrot, angle); /* Rotation du point a tester */
RotatePoint(&segX, &segY, angle) ; /* Rotation du segment */
/*la piste est Horizontale , par suite des modifs de coordonnes
* et d'axe, donc segX = longueur du segment */
/*la piste est Horizontale , par suite des modifs de coordonnes
et d'axe, donc segX = longueur du segment */
if ( abs(cYrot) <= seuil ) /* ok sur axe vertical) */
{
if ((cXrot >= 0) && (cXrot <= segX) ) return(1) ;
/* Etude des extremites : cercle de rayon seuil */
if( (cXrot < 0) && (cXrot >= -seuil) )
{
if( ((cXrot * cXrot) + (cYrot*cYrot)) <= (seuil*seuil) )
return(1);
}
if( (cXrot > segX) && (cXrot <= (segX+seuil)) )
{
if( (((cXrot-segX) * (cXrot-segX)) + (cYrot*cYrot)) <= (seuil*seuil) )
return(1);
}
}
}
return(0) ;
if( abs( cYrot ) <= seuil ) /* ok sur axe vertical) */
{
if( (cXrot >= 0) && (cXrot <= segX) )
return 1;
/* Etude des extremites : cercle de rayon seuil */
if( (cXrot < 0) && (cXrot >= -seuil) )
{
if( ( (cXrot * cXrot) + (cYrot * cYrot) ) <= (seuil * seuil) )
return 1;
}
if( (cXrot > segX) && ( cXrot <= (segX + seuil) ) )
{
if( ( ( (cXrot - segX) * (cXrot - segX) ) + (cYrot * cYrot) ) <= (seuil * seuil) )
return 1;
}
}
}
return 0;
}

View File

@ -83,7 +83,7 @@ enum SEARCH_RESULT {
typedef DrawStructureType KICAD_T; // shorter name
class EDA_BaseStruct;
class WinEDA_DrawFrame;
/**
* Class INSPECTOR
@ -132,7 +132,26 @@ public:
EDA_BaseStruct* m_Parent; /* Linked list: Link (parent struct) */
EDA_BaseStruct* m_Son; /* Linked list: Link (son struct) */
EDA_BaseStruct* m_Image; /* Link to an image copy for undelete or abort command */
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
int m_Selected; /* Used by block commands, and selective editing */
@ -178,6 +197,19 @@ public:
int draw_mode,
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
* tests if the given wxPoint is within the bounds of this object.

View File

@ -234,6 +234,16 @@ public:
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
* may be re-implemented for each derived class in order to handle
@ -262,6 +272,15 @@ public:
*/
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)
/**
@ -340,6 +359,17 @@ public:
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
* tests if the given wxPoint is within the bounds of this object.

View File

@ -14,353 +14,6 @@
/* 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 )
@ -376,7 +29,7 @@ void Affiche_Infos_Equipot( int netcode, WinEDA_BasePcbFrame* frame )
frame->MsgPanel->EraseMsgBox();
equipot = GetEquipot( frame->m_Pcb, netcode );
equipot = frame->m_Pcb->FindNet( netcode );
if( equipot )
Affiche_1_Parametre( frame, 1, _( "Net Name" ), equipot->m_Netname, RED );
else

View File

@ -29,7 +29,7 @@ void WinEDA_PcbFrame::Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On )
track->SetState( SEGM_FIXE, Flag_On );
track->Draw( DrawPanel, DC, GR_OR | GR_SURBRILL );
DrawPanel->CursorOn( DC ); // Display cursor shape
Affiche_Infos_Piste( this, track );
track->Display_Infos( this );
}

View File

@ -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
SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
const KICAD_T scanTypes[] )
@ -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)
/**

View File

@ -8,6 +8,8 @@
#include "common.h"
#include "pcbnew.h"
#include "trigo.h"
#include "wxstruct.h"
COTATION::COTATION( EDA_BaseStruct* StructFather ) :
EDA_BaseStruct( StructFather, TYPECOTATION )
@ -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
* tests if the given wxPoint is within the bounds of this object.

View File

@ -42,6 +42,16 @@ public:
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
* tests if the given wxPoint is within the bounds of this object.

View File

@ -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 )
/*****************************************/

View File

@ -42,6 +42,17 @@ public:
int draw_mode );
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
* tests if the given wxPoint is within the bounds of this object.

View File

@ -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 )
/*********************************************************/

View File

@ -130,7 +130,12 @@ public:
void DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC,
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 );

View 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 */
{

View File

@ -89,8 +89,14 @@ public:
void ComputeRayon( void ); // met a jour m_Rayon, rayon du cercle exinscrit
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

View File

@ -150,6 +150,44 @@ void TEXTE_PCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
(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)
/**

View File

@ -6,7 +6,7 @@
#include "base_struct.h"
class TEXTE_PCB: public EDA_BaseStruct, public EDA_TextStruct
class TEXTE_PCB : public EDA_BaseStruct, public EDA_TextStruct
{
public:
TEXTE_PCB(EDA_BaseStruct * parent);
@ -26,6 +26,17 @@ public:
int ReadTextePcbDescr(FILE * File, int * LineNum);
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)
/**
* Function GetClass

View File

@ -295,6 +295,70 @@ int TEXTE_MODULE::GetDrawRotation( void )
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)
/**
* Function Show

View File

@ -56,6 +56,17 @@ public:
/* drawing functions */
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
* tests if the given wxPoint is within the bounds of this object.

View File

@ -13,6 +13,7 @@
#endif
#include "trigo.h"
#include "protos.h"
/**************************************/
@ -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
* tests if the given wxPoint is within the bounds of this object.

View File

@ -76,6 +76,17 @@ public:
int IsPointOnEnds( const wxPoint& point, int min_dist = 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
* tests if the given wxPoint is within the bounds of this object.

View File

@ -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
* tests if the given wxPoint is within the bounds of this object.

View File

@ -34,7 +34,7 @@ void RemoteCommand( const char* cmdline )
char* idcmd;
char* text;
WinEDA_PcbFrame* frame = EDA_Appl->m_PcbFrame;
MODULE* module;
MODULE* module = 0;
strncpy( line, cmdline, sizeof(line) - 1 );
msg = CONV_FROM_UTF8( line );

Some files were not shown because too many files have changed in this diff Show More