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
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
......
......@@ -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,
......
......@@ -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
......
This diff is collapsed.
......@@ -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.
......
......@@ -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
......@@ -263,6 +273,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)
/**
* Function GetClass
......@@ -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.
......
This diff is collapsed.
......@@ -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 );
}
......
......@@ -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)
/**
......
......@@ -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.
......
......@@ -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.
......
......@@ -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 )
/*****************************************/
......
......@@ -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.
......
......@@ -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 )
/*********************************************************/
......
......@@ -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 );
......
......@@ -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 */
{
......
......@@ -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
......
......@@ -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)
/**
......
......@@ -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
......
......@@ -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
......
......@@ -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.
......
......@@ -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.
......
......@@ -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.
......
......@@ -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.
......
......@@ -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 );
......
......@@ -117,7 +117,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* Track )
GetScreen()->SetModify();
test_1_net_connexion( DC, current_net_code );
Affiche_Infos_Status_Pcb( this );
m_Pcb->Display_Infos( this );
return NULL;
}
......@@ -132,7 +132,7 @@ void WinEDA_PcbFrame::Delete_Track( wxDC* DC, TRACK* Track )
Supprime_Une_Piste( DC, Track );
GetScreen()->SetModify();
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 )
SaveItemEfface( pt_start, ii );
GetScreen()->SetModify();
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 )
{
wxString msg;
jj = 1;
EQUIPOT* equipot = GetEquipot( m_Pcb, pt_segm->m_NetCode );
EQUIPOT* equipot = m_Pcb->FindNet( pt_segm->m_NetCode );
if( equipot )
msg = equipot->m_Netname + wxT( " " );
else
......@@ -409,7 +409,7 @@ int WinEDA_PcbFrame::Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone )
{
jj = 1;
wxString msg;
EQUIPOT* equipot = GetEquipot( m_Pcb, pt_segm->m_NetCode );
EQUIPOT* equipot = m_Pcb->FindNet( pt_segm->m_NetCode );
if( equipot )
msg = equipot->m_Netname + wxT( " " );
else
......@@ -1296,7 +1296,7 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
TRACK* pt_segm;
wxString msg;
wxString tracktype, netname1, netname2;
EQUIPOT* equipot = GetEquipot( Pcb, pt_ref->m_NetCode );
EQUIPOT* equipot = Pcb->FindNet( pt_ref->m_NetCode );
if( equipot )
netname1 = equipot->m_Netname;
......@@ -1314,7 +1314,7 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
if( ( (EDA_BaseStruct*) pt_item )->m_StructType == TYPEPAD )
{
D_PAD* pad = (D_PAD*) pt_item;
equipot = GetEquipot( Pcb, pad->m_NetCode );
equipot = Pcb->FindNet( pad->m_NetCode );
if( equipot )
netname2 = equipot->m_Netname;
erc_pos = pad->m_Pos;
......@@ -1330,7 +1330,7 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
else /* erreur sur segment de piste */
{
pt_segm = (TRACK*) pt_item;
equipot = GetEquipot( Pcb, pt_segm->m_NetCode );
equipot = Pcb->FindNet( pt_segm->m_NetCode );
if( equipot )
netname2 = equipot->m_Netname;
erc_pos = pt_segm->m_Start;
......@@ -1393,13 +1393,13 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
wxString pad_name2 = pad2->ReturnStringPadName();
wxString module_name2 = ( (MODULE*) (pad2->m_Parent) )->m_Reference->m_Text;
wxString netname1, netname2;
EQUIPOT* equipot = GetEquipot( Pcb, pad1->m_NetCode );
EQUIPOT* equipot = Pcb->FindNet( pad1->m_NetCode );
if( equipot )
netname1 = equipot->m_Netname;
else
netname1 = wxT( "<noname>" );
equipot = GetEquipot( Pcb, pad2->m_NetCode );
equipot = Pcb->FindNet( pad2->m_NetCode );
if( equipot )
netname2 = equipot->m_Netname;
else
......
......@@ -121,7 +121,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{
int netcode = Select_High_Light( DC );
if( netcode < 0 )
Affiche_Infos_Status_Pcb( this );
m_Pcb->Display_Infos( this );
else
Affiche_Infos_Equipot( netcode, this );
}
......
......@@ -33,7 +33,7 @@ void WinEDA_PcbFrame::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
Trace_DrawSegmentPcb( DrawPanel, DC, drawitem, GR_XOR );
drawitem->m_Flags |= IS_MOVED;
cursor_pos = cursor_pos0 = GetScreen()->m_Curseur;
Affiche_Infos_DrawSegment( this, drawitem );
drawitem->Display_Infos( this );
DrawPanel->ManageCurseur = Move_Segment;
DrawPanel->ForceCloseManageCurseur = Exit_EditEdge;
GetScreen()->SetCurItem( drawitem );
......@@ -145,7 +145,7 @@ void WinEDA_PcbFrame::Drawing_SetNewWidth( DRAWSEGMENT* DrawSegm, wxDC* DC )
Trace_DrawSegmentPcb( DrawPanel, DC, DrawSegm, GR_OR );
Affiche_Infos_DrawSegment( this, DrawSegm );
DrawSegm->Display_Infos( this );
GetScreen()->SetModify();
}
......
......@@ -147,7 +147,7 @@ void WinEDA_PcbFrame::ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC )
}
test_1_net_connexion( DC, pt_track->m_NetCode );
Affiche_Infos_Piste( this, pt_track );
pt_track->Display_Infos( this );
GetScreen()->SetModify();
}
......@@ -255,7 +255,7 @@ void WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC )
}
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
Affiche_Infos_Piste( this, Via );
Via->Display_Infos( this );
Affiche_Status_Box();
SetToolbars();
......@@ -276,7 +276,7 @@ void WinEDA_PcbFrame::Affiche_Status_Net( wxDC* DC )
pt_segm = Locate_Pistes( m_Pcb->m_Track, masquelayer, CURSEUR_OFF_GRILLE );
if( pt_segm == NULL )
Affiche_Infos_Status_Pcb( this );
m_Pcb->Display_Infos( this );
else
test_1_net_connexion( DC, pt_segm->m_NetCode );
}
......
......@@ -153,7 +153,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC )
g_FirstTrackSegment->end = g_CurrentTrackSegment;
g_FirstTrackSegment->SetState( BEGIN_ONPAD | END_ONPAD, OFF );
}
Affiche_Infos_Piste( this, g_CurrentTrackSegment );
g_CurrentTrackSegment->Display_Infos( this );
GetScreen()->SetCurItem( g_CurrentTrackSegment );
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
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 )
/* Show the new position */
ShowNewTrackWhenMovingCursor( DrawPanel, DC, FALSE );
}
Affiche_Infos_Piste( this, g_CurrentTrackSegment );
g_CurrentTrackSegment->Display_Infos( this );
}
GetScreen()->SetCurItem( g_CurrentTrackSegment );
......@@ -456,7 +456,7 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC )
test_1_net_connexion( DC, g_FirstTrackSegment->m_NetCode );
GetScreen()->SetModify();
Affiche_Infos_Status_Pcb( this );
m_Pcb->Display_Infos( this );
}
/* Finish the work, clear used variables */
g_FirstTrackSegment = NULL;
......
......@@ -58,7 +58,7 @@ TEXTE_MODULE* WinEDA_BasePcbFrame::CreateTextModule( MODULE* Module, wxDC* DC )
Text->m_Flags = 0;
Text->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
Affiche_Infos_E_Texte( this, Module, Text );
Text->Display_Infos( this );
return Text;
}
......@@ -69,12 +69,10 @@ void WinEDA_BasePcbFrame::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC )
/**************************************************************************/
/* Rotation de 90 du texte d'un module */
{
MODULE* Module;
if( Text == NULL )
return;
Module = (MODULE*) Text->m_Parent;
MODULE* module = (MODULE*) Text->m_Parent;
Text->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
......@@ -85,9 +83,9 @@ void WinEDA_BasePcbFrame::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC )
/* Redessin du Texte */
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();
}
......@@ -171,7 +169,7 @@ void WinEDA_BasePcbFrame::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC )
MoveVector.x = MoveVector.y = 0;
CursorInitialPosition = Text->m_Pos;
Affiche_Infos_E_Texte( this, Module, Text );
Text->Display_Infos( this );
GetScreen()->SetCurItem( Text );
DrawPanel->ManageCurseur = Show_MoveTexte_Module;
......
......@@ -566,7 +566,7 @@ int nbitems, ii;
if ( 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;
if (equipot && (equipot->m_Netname != wxEmptyString) )
netname = equipot->m_Netname;
......
......@@ -230,7 +230,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC* DC, boo
/* liste des pads recalculee avec Affichage des messages d'erreur */
build_liste_pads();
Affiche_Infos_Status_Pcb( this );
m_Pcb->Display_Infos( this );
g_SaveTime = time( NULL );
......
......@@ -92,35 +92,36 @@ EDA_BaseStruct* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch )
* 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;
EDA_BaseStruct* item;
pt_texte_pcb = Locate_Texte_Pcb( m_Pcb->m_Drawings, LayerSearch, typeloc );
if( pt_texte_pcb ) // a PCB text is found
item = Locate_Texte_Pcb( m_Pcb->m_Drawings, LayerSearch, typeloc );
if( item )
{
Affiche_Infos_PCB_Texte( this, pt_texte_pcb );
return pt_texte_pcb;
item->Display_Infos( this );
return item;
}
DrawSegm = Locate_Segment_Pcb( m_Pcb, LayerSearch, typeloc );
if( DrawSegm != NULL )
item = Locate_Segment_Pcb( m_Pcb, LayerSearch, typeloc );
if( item )
{
Affiche_Infos_DrawSegment( this, DrawSegm );
return DrawSegm;
item->Display_Infos( this );
return item;
}
item = Locate_Cotation( m_Pcb, LayerSearch, typeloc );
if( item != NULL )
if( item )
{
item->Display_Infos( this );
return item;
}
item = Locate_MirePcb( m_Pcb->m_Drawings, LayerSearch, typeloc );
if( item != NULL )
{
item->Display_Infos( this ); // MIRES::Display_Infos() not implemented yet.
return item;
}
/* Search for tracks and vias, with via priority */
if( LayerSearch == -1 )
......@@ -128,10 +129,11 @@ EDA_BaseStruct* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch )
else
masque_layer = g_TabOneLayerMask[LayerSearch];
TRACK* Track;
Track = Locate_Pistes( m_Pcb->m_Track, masque_layer, typeloc );
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 */
while( ( TrackLocate = Locate_Pistes( TrackLocate,
......@@ -144,16 +146,18 @@ EDA_BaseStruct* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch )
TrackLocate = (TRACK*) TrackLocate->Pnext;
}
Affiche_Infos_Piste( this, Track );
Track->Display_Infos( this );
return Track;
}
/* Search for Pads */
if( ( pt_pad = Locate_Any_Pad( m_Pcb, typeloc ) ) != NULL )
item = Locate_Any_Pad( m_Pcb, typeloc );
if( item )
{
pt_pad->Display_Infos( this ); return pt_pad;
item->Display_Infos( this );
return item;
}
/* Search for a footprint text */
// First search: locate texts for footprints on copper or component layer
......@@ -162,48 +166,46 @@ EDA_BaseStruct* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch )
// on the same layer
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 )
continue;
pt_texte = LocateTexteModule( m_Pcb, &module, typeloc | VISIBLE_ONLY );
if( pt_texte != NULL )
item = LocateTexteModule( m_Pcb, &module, typeloc | VISIBLE_ONLY );
if( item )
{
Affiche_Infos_E_Texte( this, module, pt_texte );
return pt_texte;
item->Display_Infos( this );
return item;
}
}
}
// Now Search footprint texts on all layers
MODULE* module;
module = NULL;
item = LocateTexteModule( m_Pcb, &module, typeloc | VISIBLE_ONLY );
if( item )
{
TEXTE_MODULE* pt_texte;
pt_texte = LocateTexteModule( m_Pcb, &module, typeloc | VISIBLE_ONLY );
if( pt_texte != NULL )
{
Affiche_Infos_E_Texte( this, module, pt_texte );
return pt_texte;
}
item->Display_Infos( this );
return item;
}
/* Search for a footprint */
module = Locate_Prefered_Module( m_Pcb, typeloc | VISIBLE_ONLY );
if( module != NULL )
item = Locate_Prefered_Module( m_Pcb, typeloc | VISIBLE_ONLY );
if( item )
{
module->Display_Infos( this );
return module;
item->Display_Infos( this );
return item;
}
/* Search for zones */
if( ( TrackLocate = Locate_Zone( (TRACK*) m_Pcb->m_Zone,
GetScreen()->m_Active_Layer, typeloc ) ) != NULL )
item = Locate_Zone( (TRACK*) m_Pcb->m_Zone,
GetScreen()->m_Active_Layer, typeloc );
if( item )
{
Affiche_Infos_Piste( this, TrackLocate );
return TrackLocate;
item->Display_Infos( this );
return item;
}
MsgPanel->EraseMsgBox();
......
......@@ -31,7 +31,7 @@ EDA_BaseStruct* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( void )
DrawStruct = Locate_Edge_Module( Module, CURSEUR_OFF_GRILLE );
if( DrawStruct )
{
Affiche_Infos_Segment_Module( this, Module, (EDGE_MODULE*) DrawStruct );
DrawStruct->Display_Infos( this );
}
else
DrawStruct = Locate( CURSEUR_OFF_GRILLE, -1 );
......
......@@ -488,7 +488,7 @@ void WinEDA_PcbFrame::Place_Dupl_Route( Track* Track, wxDC* DC )
}
}
NewTrack = NULL;
Affiche_Infos_Status_Pcb( Cmd );
m_Pcb->Display_Infos( Cmd );
if( Etat_Surbrillance )
Hight_Light( DC );
}
......
This diff is collapsed.
......@@ -643,6 +643,7 @@ void CreatePopUpMenuForFootprints( MODULE* Module, wxMenu* menu, bool full_menu
msg << wxT( " " ) << Module->m_Reference->m_Text;
sub_menu_footprint = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_footprint, -1, msg, module_xpm )
if( full_menu )
{
......
......@@ -36,17 +36,6 @@
#define ZOOM_CENTER -4
#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) */
#define FORCE_SKETCH (DRAG | EDIT )
......
......@@ -288,7 +288,7 @@ void WinEDA_PcbFrame::StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC )
old_pos = TextePcb->m_Pos;
TextePcb->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
TextePcb->m_Flags |= IS_MOVED;
Affiche_Infos_PCB_Texte( this, TextePcb );
TextePcb->Display_Infos( this );
DrawPanel->ManageCurseur = Move_Texte_Pcb;
DrawPanel->ForceCloseManageCurseur = Exit_Texte_Pcb;
m_CurrentScreen->SetCurItem( TextePcb );
......@@ -399,7 +399,7 @@ void WinEDA_PcbFrame::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
/* Redessin du Texte */
TextePcb->Draw( DrawPanel, DC, wxPoint( 0, 0 ), drawmode );
Affiche_Infos_PCB_Texte( this, TextePcb );
TextePcb->Display_Infos( this );
m_CurrentScreen->SetModify();
}
......@@ -18,14 +18,6 @@ LISTE_PAD* CreateSortedPadListByXCoord(BOARD * pcb);
/**************/
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 */
/***************/
......@@ -325,23 +317,6 @@ void Affiche_erreur(int nb_err) ;
/*****************************************************************/
/* 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);
/************/
......
......@@ -61,7 +61,8 @@ wxString msg;
// Reaffichage des chevelus actifs
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;
m_Pcb->m_NbLinks += nbpads;
/* 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)
DisplayError(this, wxT("Gen ratsnest err: NULL equipot") );
else
......@@ -617,7 +618,7 @@ EQUIPOT * equipot;
for ( net_code = 1; ; net_code++)
{
equipot = GetEquipot(m_Pcb, net_code);
equipot = m_Pcb->FindNet( net_code );
if(equipot == NULL ) break;
if( ref_netcode && (net_code != ref_netcode) ) continue;
......
......@@ -179,7 +179,7 @@ int no_conn = Pcb->m_NbPads+1; /* valeur incrementee pour indiquer
if ( nb_pads < 2 )
{
wxString Line;
EQUIPOT * equipot = GetEquipot(Pcb, netcode);
EQUIPOT * equipot = Pcb->FindNet( netcode );
Line.Printf( wxT("Warning: %d pad, net %s"),
nb_pads, equipot->m_Netname.GetData());
DisplayError(NULL, Line,20);
......
......@@ -217,7 +217,7 @@ wxString msg;
}
Ncurrent++;
pt_equipot = GetEquipot(m_Pcb, current_net_code);
pt_equipot = m_Pcb->FindNet( current_net_code );
if( pt_equipot)
{
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 "gr_basic.h"
......@@ -15,130 +15,139 @@
/* Routines Locales */
/********************************************/
void WinEDA_PcbFrame::UnDeleteItem(wxDC * DC)
void WinEDA_PcbFrame::UnDeleteItem( wxDC* DC )
/********************************************/
/* Restitution d'un element (MODULE ou TRACK ) Efface
*/
*/
{
EDA_BaseStruct * PtStruct, *PtNext;
TRACK * pt_track;
int net_code;
EDA_BaseStruct* PtStruct, * PtNext;
TRACK* pt_track;
int net_code;
if( ! g_UnDeleteStackPtr ) return;
if( !g_UnDeleteStackPtr )
return;
g_UnDeleteStackPtr --;
g_UnDeleteStackPtr--;
PtStruct = g_UnDeleteStack[g_UnDeleteStackPtr];
if ( PtStruct == NULL ) return; // Ne devrait pas se produire
if( PtStruct == NULL )
return; // Ne devrait pas se produire
switch(PtStruct->m_StructType)
switch( PtStruct->m_StructType )
{
case TYPEVIA:
case TYPETRACK:
for( ; PtStruct != NULL; PtStruct = PtNext)
for( ; PtStruct != NULL; PtStruct = PtNext )
{
PtNext = PtStruct->Pnext;
PtStruct->SetState(DELETED,OFF); /* Effacement du bit DELETED */
((TRACK*)PtStruct)->Draw(DrawPanel, DC, GR_OR);
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 );
((TRACK*)PtStruct)->Insert(m_Pcb, pt_track);
net_code = ( (TRACK*) PtStruct )->m_NetCode;
pt_track = ( (TRACK*) PtStruct )->GetBestInsertPoint( m_Pcb );
( (TRACK*) PtStruct )->Insert( m_Pcb, pt_track );
g_UnDeleteStack[g_UnDeleteStackPtr] = NULL;
test_1_net_connexion(DC, net_code );
Affiche_Infos_Status_Pcb(this);
test_1_net_connexion( DC, net_code );
m_Pcb->Display_Infos( this );
break;
case TYPEMODULE:
/* Erase general rastnest if needed */
if(g_Show_Ratsnest) DrawGeneralRatsnest(DC);
if( g_Show_Ratsnest )
DrawGeneralRatsnest( DC );
/* Reinsertion du module dans la liste chainee des modules,
en debut de chaine */
* en debut de chaine */
PtStruct->Pback = m_Pcb;
PtNext = m_Pcb->m_Modules;
PtStruct->Pnext = PtNext;
if( PtNext) PtNext->Pback = PtStruct;
m_Pcb->m_Modules = (MODULE*)PtStruct;
if( PtNext )
PtNext->Pback = PtStruct;
m_Pcb->m_Modules = (MODULE*) PtStruct;
g_UnDeleteStack[g_UnDeleteStackPtr] = NULL;
((MODULE *) PtStruct)->Draw(DrawPanel, DC, wxPoint(0,0), GR_OR);
( (MODULE*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
PtStruct->SetState(DELETED,OFF); /* Creal DELETED flag */
PtStruct->SetState( DELETED, OFF ); /* Creal DELETED flag */
PtStruct->m_Flags = 0;
m_Pcb->m_Status_Pcb = 0 ;
m_Pcb->m_Status_Pcb = 0;
build_liste_pads();
ReCompile_Ratsnest_After_Changes( DC );
break;
default:
DisplayError(this, wxT("WinEDA_PcbFrame::UnDeleteItem(): unexpected Struct type"));
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
Supporte actuellement : Module et segments de piste
*/
EDA_BaseStruct * WinEDA_PcbFrame::SaveItemEfface(EDA_BaseStruct * PtItem, int nbitems)
* Supporte actuellement : Module et segments de piste
*/
EDA_BaseStruct* WinEDA_PcbFrame::SaveItemEfface( EDA_BaseStruct* PtItem, int nbitems )
{
EDA_BaseStruct * NextS, * PtStruct = PtItem;
int ii;
EDA_BaseStruct* NextS, * PtStruct = PtItem;
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]);
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_UnDeleteStackPtr--;;
}
switch ( PtStruct->m_StructType )
switch( PtStruct->m_StructType )
{
case TYPEVIA:
case TYPETRACK:
{
EDA_BaseStruct * Back = NULL;
EDA_BaseStruct* Back = NULL;
g_UnDeleteStack[g_UnDeleteStackPtr++] = PtStruct;
for ( ; nbitems > 0; nbitems--, PtStruct = NextS)
for( ; nbitems > 0; nbitems--, PtStruct = NextS )
{
NextS = PtStruct->Pnext;
((TRACK*)PtStruct)->UnLink();
PtStruct->SetState(DELETED, ON);
if( nbitems <= 1 ) NextS = NULL; /* fin de chaine */
( (TRACK*) PtStruct )->UnLink();
PtStruct->SetState( DELETED, ON );
if( nbitems <= 1 )
NextS = NULL; /* fin de chaine */
PtStruct->Pnext = NextS;
PtStruct->Pback = Back; Back = PtStruct;
if(NextS == NULL) break;
if( NextS == NULL )
break;
}
}
break;
case TYPEMODULE:
{
MODULE * Module = (MODULE*)PtItem;
MODULE* Module = (MODULE*) PtItem;
Module->UnLink();
Module->SetState(DELETED, ON);
Module->SetState( DELETED, ON );
g_UnDeleteStack[g_UnDeleteStackPtr++] = Module;
build_liste_pads();
}
break;
default: break;
default:
break;
}
return(g_UnDeleteStack[g_UnDeleteStackPtr-1]);
return g_UnDeleteStack[g_UnDeleteStackPtr - 1];
}
......@@ -548,7 +548,7 @@ void WinEDA_PcbFrame::CaptureNetName( wxDC* DC )
}
else
{
Affiche_Infos_Piste( this, adrpiste );
adrpiste->Display_Infos( this );
netcode = adrpiste->m_NetCode;
}
......@@ -901,7 +901,7 @@ void WinEDA_PcbFrame::Fill_Zone( wxDC* DC )
/* Affichage du NetName */
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( 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