Commit cc623057 authored by dickelbeck's avatar dickelbeck

see change_log.txt for 2007-Aug-22

parent 4da2971d
...@@ -202,13 +202,14 @@ void Pcb3D_GLCanvas::Draw3D_Track(TRACK * track) ...@@ -202,13 +202,14 @@ void Pcb3D_GLCanvas::Draw3D_Track(TRACK * track)
/************************************************/ /************************************************/
{ {
double zpos; double zpos;
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[track->m_Layer]; int layer = track->GetLayer();
int layer = track->m_Layer; int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
double ox, oy, fx, fy; double ox, oy, fx, fy;
double w; double w;
if ( color & ITEM_NOT_SHOW ) return; if ( color & ITEM_NOT_SHOW ) return;
if ( track->m_Layer == CMP_N ) layer = g_Parm_3D_Visu.m_Layers -1; if ( layer == CMP_N )
layer = g_Parm_3D_Visu.m_Layers -1;
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer]; zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
SetGLColor(color); SetGLColor(color);
...@@ -268,7 +269,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawSegment(DRAWSEGMENT * segment) ...@@ -268,7 +269,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawSegment(DRAWSEGMENT * segment)
int layer; int layer;
double x, y, xf, yf; double x, y, xf, yf;
double zpos, w; double zpos, w;
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[segment->m_Layer]; int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[segment->GetLayer()];
if ( color & ITEM_NOT_SHOW ) return; if ( color & ITEM_NOT_SHOW ) return;
...@@ -279,7 +280,7 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[segment->m_Layer]; ...@@ -279,7 +280,7 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[segment->m_Layer];
xf = segment->m_End.x * g_Parm_3D_Visu.m_BoardScale; xf = segment->m_End.x * g_Parm_3D_Visu.m_BoardScale;
yf = segment->m_End.y * g_Parm_3D_Visu.m_BoardScale; yf = segment->m_End.y * g_Parm_3D_Visu.m_BoardScale;
if ( segment->m_Layer == EDGE_N) if ( segment->GetLayer() == EDGE_N)
{ {
for ( layer = 0; layer < g_Parm_3D_Visu.m_Layers; layer++ ) for ( layer = 0; layer < g_Parm_3D_Visu.m_Layers; layer++ )
{ {
...@@ -291,7 +292,7 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[segment->m_Layer]; ...@@ -291,7 +292,7 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[segment->m_Layer];
else else
{ {
zpos = g_Parm_3D_Visu.m_LayerZcoord[segment->m_Layer]; zpos = g_Parm_3D_Visu.m_LayerZcoord[segment->GetLayer()];
Draw3D_FilledSegment( x, -y, xf, -yf, w, zpos); Draw3D_FilledSegment( x, -y, xf, -yf, w, zpos);
} }
} }
......
...@@ -5,16 +5,36 @@ Please add newer entries at the top, list the date and your name with ...@@ -5,16 +5,36 @@ Please add newer entries at the top, list the date and your name with
email address. email address.
2007-Aug-23 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
@todo add constructor initializers for classes that were derived from
EDA_BaseLineStruct but are now not. Its late, will do tomorrow.
@todo test yesterday's changes, it builds, may not run right yet.
2007-Aug-22 UPDATE Dick Hollenbeck <dick@softplc.com> 2007-Aug-22 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
+ eeschema & pcbnew + eeschema & pcbnew
Things are still pretty transient, should be stable a day or two:
* Fixed a filename case sensitivity problem that would show up on Linux * Fixed a filename case sensitivity problem that would show up on Linux
but probably not on Windows: bitmap/Reload.xpm needed uppercase R. but probably not on Windows: bitmap/Reload.xpm needed uppercase R.
* Since so many classes introduced m_Layer, I moved m_Layer into * Wedged a new class BOARD_ITEM underneath all PCB drawable classes, this is
EDA_BaseStruct so all classes can inherit it and that way we can test a big change and may introduce a bug or two, but it is worth it for the
layer using a general, polymorphic test, i.e. don't have to cast a future, because we can introduce virtual functions there that do not impact
EDA_BaseStruct* to a class specific pointer to test layer. Could also have the entire project (since everything is derived from EDA_BaseStruct).
used a virtual function but too many places use m_Layer directly. The corresponding class in EESCHEMA seems to be DrawPartStruct, so we had
nothing in PCBNEW like that.
BOARD_ITEM::GetLayer() and SetLayer() introduced, more functions to come.
Much of this work is geared towards making collectors.cpp's ARROWCOLLECTOR::Inspect()
very very simple, and that can be model for future work.
* Changed min() and max() macros to MIN() and MAX() because min() and max()
are actually reserved according to the C++ standard! (and their usage prevented
the use of #include <vector>).
* Added files class_collector.h, collectors.h, and collectors.cpp.
File collectors.cpp is still unfinished.
* Started using a function and class comment style that will make sense to the
Doxygen source code documenter program.
* Beautified more un-beautified files.
2007-aug-21 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2007-aug-21 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
......
...@@ -106,7 +106,6 @@ void EDA_BaseStruct::InitVars( void ) ...@@ -106,7 +106,6 @@ void EDA_BaseStruct::InitVars( void )
m_TimeStamp = 0; // Time stamp used for logical links m_TimeStamp = 0; // Time stamp used for logical links
m_Status = 0; m_Status = 0;
m_Selected = 0; /* Used by block commands, and selective editing */ m_Selected = 0; /* Used by block commands, and selective editing */
m_Layer = 0;
} }
...@@ -283,6 +282,7 @@ std::ostream& EDA_BaseStruct::NestedSpace( int nestLevel, std::ostream& os ) ...@@ -283,6 +282,7 @@ std::ostream& EDA_BaseStruct::NestedSpace( int nestLevel, std::ostream& os )
#endif #endif
/**********************************************************************************************/ /**********************************************************************************************/
EDA_BaseLineStruct::EDA_BaseLineStruct( EDA_BaseStruct* StructFather, DrawStructureType idtype ) : EDA_BaseLineStruct::EDA_BaseLineStruct( EDA_BaseStruct* StructFather, DrawStructureType idtype ) :
EDA_BaseStruct( StructFather, idtype ) EDA_BaseStruct( StructFather, idtype )
......
This diff is collapsed.
...@@ -107,10 +107,10 @@ public: ...@@ -107,10 +107,10 @@ public:
}; };
class DrawSheetLabelStruct : public EDA_BaseStruct class DrawSheetLabelStruct : public EDA_BaseStruct, public EDA_TextStruct
, public EDA_TextStruct
{ {
public: public:
int m_Layer;
int m_Edge, m_Shape; int m_Edge, m_Shape;
bool m_IsDangling; // TRUE si non connect bool m_IsDangling; // TRUE si non connect
...@@ -141,6 +141,7 @@ public: ...@@ -141,6 +141,7 @@ public:
int m_FileNameSize; int m_FileNameSize;
wxPoint m_Pos; wxPoint m_Pos;
wxSize m_Size; /* Position and Size of sheet symbol */ wxSize m_Size; /* Position and Size of sheet symbol */
int m_Layer;
DrawSheetLabelStruct* m_Label; /* Points de connection */ DrawSheetLabelStruct* m_Label; /* Points de connection */
int m_NbLabel; /* Nombre de points de connexion */ int m_NbLabel; /* Nombre de points de connexion */
......
This diff is collapsed.
...@@ -39,7 +39,8 @@ typedef enum ...@@ -39,7 +39,8 @@ typedef enum
class PartTextStruct: public EDA_BaseStruct, public EDA_TextStruct class PartTextStruct: public EDA_BaseStruct, public EDA_TextStruct
{ {
public: public:
int m_FieldId; int m_Layer;
int m_FieldId;
wxString m_Name; /* Field name (ref, value,pcb, sheet, filed 1.. wxString m_Name; /* Field name (ref, value,pcb, sheet, filed 1..
and for fields 1 to 8 the name is editable */ and for fields 1 to 8 the name is editable */
...@@ -54,6 +55,7 @@ public: ...@@ -54,6 +55,7 @@ public:
void SwapData(PartTextStruct * copyitem); void SwapData(PartTextStruct * copyitem);
}; };
/* the class DrawPartStruct describes a basic virtual component /* the class DrawPartStruct describes a basic virtual component
Not used directly: Not used directly:
used classes are EDA_SchComponentStruct (the "classic" schematic component used classes are EDA_SchComponentStruct (the "classic" schematic component
...@@ -62,6 +64,7 @@ public: ...@@ -62,6 +64,7 @@ public:
class DrawPartStruct: public EDA_BaseStruct class DrawPartStruct: public EDA_BaseStruct
{ {
public: public:
int m_Layer;
wxString m_ChipName; /* Key to look for in the library, i.e. "74LS00". */ wxString m_ChipName; /* Key to look for in the library, i.e. "74LS00". */
PartTextStruct m_Field[NUMBER_OF_FIELDS]; PartTextStruct m_Field[NUMBER_OF_FIELDS];
wxPoint m_Pos; /* Exact position of part. */ wxPoint m_Pos; /* Exact position of part. */
......
...@@ -106,6 +106,7 @@ class DrawBusEntryStruct: public EDA_BaseStruct /* Struct de descr 1 raccord ...@@ -106,6 +106,7 @@ class DrawBusEntryStruct: public EDA_BaseStruct /* Struct de descr 1 raccord
a 45 degres de BUS ou WIRE */ a 45 degres de BUS ou WIRE */
{ {
public: public:
int m_Layer;
int m_Width; int m_Width;
wxPoint m_Pos; wxPoint m_Pos;
wxSize m_Size; wxSize m_Size;
...@@ -121,6 +122,7 @@ public: ...@@ -121,6 +122,7 @@ public:
class DrawPolylineStruct: public EDA_BaseStruct /* Polyligne (serie de segments) */ class DrawPolylineStruct: public EDA_BaseStruct /* Polyligne (serie de segments) */
{ {
public: public:
int m_Layer;
int m_Width; int m_Width;
int m_NumOfPoints; /* Number of XY pairs in Points array. */ int m_NumOfPoints; /* Number of XY pairs in Points array. */
int *m_Points; /* XY pairs that forms the polyline. */ int *m_Points; /* XY pairs that forms the polyline. */
...@@ -135,6 +137,7 @@ public: ...@@ -135,6 +137,7 @@ public:
class DrawJunctionStruct: public EDA_BaseStruct class DrawJunctionStruct: public EDA_BaseStruct
{ {
public: public:
int m_Layer;
wxPoint m_Pos; /* XY coordinates of connection. */ wxPoint m_Pos; /* XY coordinates of connection. */
public: public:
...@@ -147,6 +150,7 @@ public: ...@@ -147,6 +150,7 @@ public:
class DrawTextStruct: public EDA_BaseStruct, public EDA_TextStruct class DrawTextStruct: public EDA_BaseStruct, public EDA_TextStruct
{ {
public: public:
int m_Layer;
int m_Shape; int m_Shape;
bool m_IsDangling; // TRUE si non connect bool m_IsDangling; // TRUE si non connect
...@@ -163,6 +167,7 @@ private: ...@@ -163,6 +167,7 @@ private:
void DrawAsGlobalLabel(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint & offset, int draw_mode, int Color); void DrawAsGlobalLabel(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint & offset, int draw_mode, int Color);
}; };
class DrawLabelStruct: public DrawTextStruct class DrawLabelStruct: public DrawTextStruct
{ {
public: public:
...@@ -170,6 +175,7 @@ public: ...@@ -170,6 +175,7 @@ public:
~DrawLabelStruct(void) {} ~DrawLabelStruct(void) {}
}; };
class DrawGlobalLabelStruct: public DrawTextStruct class DrawGlobalLabelStruct: public DrawTextStruct
{ {
public: public:
......
/**********************************************************/ /**********************************************************/
/* Routines d'affichage de parametres et caracteristiques */ /* Routines d'affichage de parametres et caracteristiques */
/**********************************************************/ /**********************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
...@@ -13,96 +13,102 @@ ...@@ -13,96 +13,102 @@
/* Routines locales */ /* Routines locales */
/****************************************************************************/ /****************************************************************************/
void Affiche_Infos_PCB_Texte(WinEDA_BasePcbFrame * frame, TEXTE_PCB* pt_texte) void Affiche_Infos_PCB_Texte( WinEDA_BasePcbFrame* frame, TEXTE_PCB* pt_texte )
/****************************************************************************/ /****************************************************************************/
/* Affiche en bas d'ecran les caract du texte sur PCB /* Affiche en bas d'ecran les caract du texte sur PCB
Entree : * Entree :
pointeur de la description du texte * pointeur de la description du texte
*/ */
{ {
wxString Line; wxString Line;
frame->MsgPanel->EraseMsgBox(); frame->MsgPanel->EraseMsgBox();
if( pt_texte->m_StructType == TYPECOTATION ) if( pt_texte->m_StructType == TYPECOTATION )
Affiche_1_Parametre(frame, 1,_("COTATION"),pt_texte->m_Text, DARKGREEN); Affiche_1_Parametre( frame, 1, _( "COTATION" ), pt_texte->m_Text, DARKGREEN );
else else
Affiche_1_Parametre(frame, 1,_("PCB Text"),pt_texte->m_Text, DARKGREEN); Affiche_1_Parametre( frame, 1, _( "PCB Text" ), pt_texte->m_Text, DARKGREEN );
Line = _("Layer "); Line << pt_texte->m_Layer + 1; Line = _( "Layer " );
Affiche_1_Parametre(frame, 28, _("Layer:"), Line, g_DesignSettings.m_LayerColor[pt_texte->m_Layer] ); Line << pt_texte->GetLayer() + 1;
Affiche_1_Parametre( frame, 28, _( "Layer:" ), Line,
g_DesignSettings.m_LayerColor[pt_texte->GetLayer()] );
Affiche_1_Parametre(frame, 36, _("Mirror"),wxEmptyString,GREEN) ; Affiche_1_Parametre( frame, 36, _( "Mirror" ), wxEmptyString, GREEN );
if( (pt_texte->m_Miroir & 1) )
Affiche_1_Parametre(frame, -1,wxEmptyString, _("No"), DARKGREEN) ; if( (pt_texte->m_Miroir & 1) )
else Affiche_1_Parametre(frame, -1,wxEmptyString, _("Yes"), DARKGREEN) ; Affiche_1_Parametre( frame, -1, wxEmptyString, _( "No" ), DARKGREEN );
else
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Yes" ), DARKGREEN );
Line.Printf( wxT("%.1f"),(float)pt_texte->m_Orient/10 );
Affiche_1_Parametre(frame, 43,_("Orient"), Line, DARKGREEN) ;
valeur_param(pt_texte->m_Width,Line) ; Line.Printf( wxT( "%.1f" ), (float) pt_texte->m_Orient / 10 );
Affiche_1_Parametre(frame, 50,_("Width"), Line,MAGENTA) ; Affiche_1_Parametre( frame, 43, _( "Orient" ), Line, DARKGREEN );
valeur_param(pt_texte->m_Size.x,Line) ; valeur_param( pt_texte->m_Width, Line );
Affiche_1_Parametre(frame, 60,_("H Size"), Line,RED) ; Affiche_1_Parametre( frame, 50, _( "Width" ), Line, MAGENTA );
valeur_param(pt_texte->m_Size.y,Line); valeur_param( pt_texte->m_Size.x, Line );
Affiche_1_Parametre(frame, 70,_("V Size"), Line,RED) ; Affiche_1_Parametre( frame, 60, _( "H Size" ), Line, RED );
valeur_param( pt_texte->m_Size.y, Line );
Affiche_1_Parametre( frame, 70, _( "V Size" ), Line, RED );
} }
/*********************************************************************/ /*********************************************************************/
void Affiche_Infos_Piste(WinEDA_BasePcbFrame * frame, TRACK * pt_piste) void Affiche_Infos_Piste( WinEDA_BasePcbFrame* frame, TRACK* pt_piste )
/*********************************************************************/ /*********************************************************************/
/* Affiche les caract principales d'un segment de piste en bas d'ecran */ /* Affiche les caract principales d'un segment de piste en bas d'ecran */
{ {
int d_index, ii = -1; int d_index, ii = -1;
D_CODE * pt_D_code; D_CODE* pt_D_code;
int layer = frame->GetScreen()->m_Active_Layer; int layer = frame->GetScreen()->m_Active_Layer;
wxString msg; wxString msg;
frame->MsgPanel->EraseMsgBox(); frame->MsgPanel->EraseMsgBox();
d_index = pt_piste->m_NetCode; d_index = pt_piste->m_NetCode;
pt_D_code = ReturnToolDescr(layer, d_index, &ii); pt_D_code = ReturnToolDescr( layer, d_index, &ii );
switch(pt_piste->m_StructType) switch( pt_piste->m_StructType )
{ {
case TYPETRACK: case TYPETRACK:
if ( pt_piste->m_Shape < S_SPOT_CIRCLE ) msg = wxT("LINE"); if( pt_piste->m_Shape < S_SPOT_CIRCLE )
else msg = wxT("FLASH"); msg = wxT( "LINE" );
break; else
msg = wxT( "FLASH" );
case TYPEZONE: break;
msg = wxT("ZONE"); break;
case TYPEZONE:
default: msg = wxT( "ZONE" ); break;
msg = wxT("????"); break;
}
Affiche_1_Parametre(frame, 1, _("Type"), msg, DARKCYAN);
msg.Printf( wxT("%d"), ii+1);
Affiche_1_Parametre(frame, 10, _("Tool"), msg, RED);
if ( pt_D_code )
{
msg.Printf( wxT("D%d"), d_index);
Affiche_1_Parametre(frame, 20, _("D CODE"),msg, BLUE);
Affiche_1_Parametre(frame, 30, _("D type"),
pt_D_code ? g_GERBER_Tool_Type[pt_D_code->m_Shape] : _("????"),
BLUE);
}
msg.Printf( wxT("%d"),pt_piste->m_Layer + 1);
Affiche_1_Parametre(frame, 40, _("Layer"), msg, BROWN) ;
/* Affiche Epaisseur */
valeur_param((unsigned)(pt_piste->m_Width), msg) ;
Affiche_1_Parametre(frame, 50, _("Width"), msg, DARKCYAN) ;
}
default:
msg = wxT( "????" ); break;
}
Affiche_1_Parametre( frame, 1, _( "Type" ), msg, DARKCYAN );
msg.Printf( wxT( "%d" ), ii + 1 );
Affiche_1_Parametre( frame, 10, _( "Tool" ), msg, RED );
if( pt_D_code )
{
msg.Printf( wxT( "D%d" ), d_index );
Affiche_1_Parametre( frame, 20, _( "D CODE" ), msg, BLUE );
Affiche_1_Parametre( frame, 30, _( "D type" ),
pt_D_code ? g_GERBER_Tool_Type[pt_D_code->m_Shape] : _( "????" ),
BLUE );
}
msg.Printf( wxT( "%d" ), pt_piste->GetLayer() + 1 );
Affiche_1_Parametre( frame, 40, _( "Layer" ), msg, BROWN );
/* Affiche Epaisseur */
valeur_param( (unsigned) (pt_piste->m_Width), msg );
Affiche_1_Parametre( frame, 50, _( "Width" ), msg, DARKCYAN );
}
...@@ -340,7 +340,7 @@ D_CODE * pt_Dcode; /* Pointeur sur le D code*/ ...@@ -340,7 +340,7 @@ D_CODE * pt_Dcode; /* Pointeur sur le D code*/
track = m_Pcb->m_Track; track = m_Pcb->m_Track;
for ( ; track != NULL ; track = (TRACK*) track->Pnext ) for ( ; track != NULL ; track = (TRACK*) track->Pnext )
{ {
pt_Dcode = ReturnToolDescr(track->m_Layer, track->m_NetCode); pt_Dcode = ReturnToolDescr(track->GetLayer(), track->m_NetCode);
pt_Dcode->m_InUse = TRUE; pt_Dcode->m_InUse = TRUE;
if ( // Line Item if ( // Line Item
...@@ -359,8 +359,8 @@ D_CODE * pt_Dcode; /* Pointeur sur le D code*/ ...@@ -359,8 +359,8 @@ D_CODE * pt_Dcode; /* Pointeur sur le D code*/
int width, len; int width, len;
wxSize size = pt_Dcode->m_Size; wxSize size = pt_Dcode->m_Size;
width = min( size.x, size.y ); width = MIN( size.x, size.y );
len = max( size.x, size.y ) - width; len = MAX( size.x, size.y ) - width;
track->m_Width = width; track->m_Width = width;
......
...@@ -30,7 +30,7 @@ void WinEDA_GerberFrame::Delete_DCode_Items( wxDC* DC, int dcode_value, int laye ...@@ -30,7 +30,7 @@ void WinEDA_GerberFrame::Delete_DCode_Items( wxDC* DC, int dcode_value, int laye
next_track = track->Next(); next_track = track->Next();
if( dcode_value != track->m_NetCode ) if( dcode_value != track->m_NetCode )
continue; continue;
if( layer_number >= 0 && layer_number != track->m_Layer ) if( layer_number >= 0 && layer_number != track->GetLayer() )
continue; continue;
Delete_Segment( DC, track ); Delete_Segment( DC, track );
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -102,7 +102,7 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int typeloc ) ...@@ -102,7 +102,7 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int typeloc )
* NULL si rien trouve * NULL si rien trouve
*/ */
{ {
EDA_BaseStruct* PtStruct; BOARD_ITEM* PtStruct;
DRAWSEGMENT* pts; DRAWSEGMENT* pts;
wxPoint ref; wxPoint ref;
PCB_SCREEN* screen = (PCB_SCREEN*) ActiveScreen; PCB_SCREEN* screen = (PCB_SCREEN*) ActiveScreen;
...@@ -110,7 +110,7 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int typeloc ) ...@@ -110,7 +110,7 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int typeloc )
SET_REF_POS( ref ); SET_REF_POS( ref );
PtStruct = Pcb->m_Drawings; PtStruct = Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{ {
if( PtStruct->m_StructType != TYPEDRAWSEGMENT ) if( PtStruct->m_StructType != TYPEDRAWSEGMENT )
continue; continue;
...@@ -121,7 +121,7 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int typeloc ) ...@@ -121,7 +121,7 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int typeloc )
spot_cX = ref.x - ux0; spot_cY = ref.y - uy0; spot_cX = ref.x - ux0; spot_cY = ref.y - uy0;
/* detection : */ /* detection : */
if( pts->m_Layer != screen->m_Active_Layer ) if( pts->GetLayer() != screen->m_Active_Layer )
continue; continue;
if( (pts->m_Shape == S_CIRCLE) || (pts->m_Shape == S_ARC) ) if( (pts->m_Shape == S_CIRCLE) || (pts->m_Shape == S_ARC) )
...@@ -208,7 +208,7 @@ TRACK* Locate_Pistes( TRACK* start_adresse, wxPoint ref, int Layer ) ...@@ -208,7 +208,7 @@ TRACK* Locate_Pistes( TRACK* start_adresse, wxPoint ref, int Layer )
} }
if( Layer >= 0 ) if( Layer >= 0 )
if( Track->m_Layer != Layer ) if( Track->GetLayer() != Layer )
continue;/* Segments sur couches differentes */ continue;/* Segments sur couches differentes */
if( distance( l_piste ) ) if( distance( l_piste ) )
return Track; return Track;
...@@ -260,7 +260,7 @@ TRACK* Locate_Zone( TRACK* start_adresse, wxPoint ref, int layer ) ...@@ -260,7 +260,7 @@ TRACK* Locate_Zone( TRACK* start_adresse, wxPoint ref, int layer )
dx -= ux0; dy -= uy0; dx -= ux0; dy -= uy0;
spot_cX = ref.x - ux0; spot_cY = ref.y - uy0; spot_cX = ref.x - ux0; spot_cY = ref.y - uy0;
if( (layer != -1) && (Zone->m_Layer != layer) ) if( (layer != -1) && (Zone->GetLayer() != layer) )
continue; continue;
if( distance( l_segm ) ) if( distance( l_segm ) )
return Zone; return Zone;
......
...@@ -105,7 +105,7 @@ TRACK * track; ...@@ -105,7 +105,7 @@ TRACK * track;
track = new TRACK(frame->m_Pcb); track = new TRACK(frame->m_Pcb);
track->Insert(frame->m_Pcb, NULL); track->Insert(frame->m_Pcb, NULL);
track->m_Layer = frame->GetScreen()->m_Active_Layer; track->SetLayer( frame->GetScreen()->m_Active_Layer );
track->m_Width = diametre ; track->m_Width = diametre ;
track->m_Start = track->m_End = pos; track->m_Start = track->m_End = pos;
NEGATE(track->m_Start.y); NEGATE(track->m_Start.y);
...@@ -129,13 +129,13 @@ static void Append_1_Flash_GERBER(int Dcode_index, ...@@ -129,13 +129,13 @@ static void Append_1_Flash_GERBER(int Dcode_index,
TRACK * track; TRACK * track;
int width, len; int width, len;
width = min( size.x, size.y ); width = MIN( size.x, size.y );
len = max( size.x, size.y ) - width; len = MAX( size.x, size.y ) - width;
track = new TRACK(frame->m_Pcb); track = new TRACK(frame->m_Pcb);
track->Insert(frame->m_Pcb, NULL); track->Insert(frame->m_Pcb, NULL);
track->m_Layer = frame->GetScreen()->m_Active_Layer; track->SetLayer( frame->GetScreen()->m_Active_Layer );
track->m_Width = width; track->m_Width = width;
track->m_Start = track->m_End = pos; track->m_Start = track->m_End = pos;
NEGATE(track->m_Start.y); NEGATE(track->m_Start.y);
...@@ -176,7 +176,7 @@ TRACK * track; ...@@ -176,7 +176,7 @@ TRACK * track;
track = new TRACK( frame->m_Pcb ); track = new TRACK( frame->m_Pcb );
track->Insert(frame->m_Pcb, NULL); track->Insert(frame->m_Pcb, NULL);
track->m_Layer = frame->GetScreen()->m_Active_Layer ; track->SetLayer( frame->GetScreen()->m_Active_Layer );
track->m_Width = largeur ; track->m_Width = largeur ;
track->m_Start = startpoint; track->m_Start = startpoint;
NEGATE(track->m_Start.y); NEGATE(track->m_Start.y);
...@@ -213,7 +213,7 @@ wxPoint center, delta; ...@@ -213,7 +213,7 @@ wxPoint center, delta;
track->Insert(frame->m_Pcb, NULL); track->Insert(frame->m_Pcb, NULL);
track->m_Shape = S_ARC; track->m_Shape = S_ARC;
track->m_Layer = frame->GetScreen()->m_Active_Layer ; track->SetLayer( frame->GetScreen()->m_Active_Layer );
track->m_Width = largeur ; track->m_Width = largeur ;
if ( multiquadrant ) if ( multiquadrant )
...@@ -555,7 +555,7 @@ bool GERBER_Descr::Execute_G_Command(char * &text, int G_commande) ...@@ -555,7 +555,7 @@ bool GERBER_Descr::Execute_G_Command(char * &text, int G_commande)
if ( D_commande < FIRST_DCODE) return FALSE; if ( D_commande < FIRST_DCODE) return FALSE;
if (D_commande > (MAX_TOOLS-1)) D_commande = MAX_TOOLS-1; if (D_commande > (MAX_TOOLS-1)) D_commande = MAX_TOOLS-1;
m_Current_Tool = D_commande; m_Current_Tool = D_commande;
D_CODE * pt_Dcode = ReturnToolDescr(m_Layer, D_commande); D_CODE * pt_Dcode = ReturnToolDescr( m_Layer, D_commande );
if ( pt_Dcode ) pt_Dcode->m_InUse = TRUE; if ( pt_Dcode ) pt_Dcode->m_InUse = TRUE;
break; break;
} }
...@@ -643,7 +643,7 @@ wxString msg; ...@@ -643,7 +643,7 @@ wxString msg;
if ( last ) while (last->Pnext ) last = (SEGZONE*)last->Pnext; if ( last ) while (last->Pnext ) last = (SEGZONE*)last->Pnext;
edge_poly->Insert(frame->m_Pcb, last); edge_poly->Insert(frame->m_Pcb, last);
edge_poly->m_Layer = frame->GetScreen()->m_Active_Layer ; edge_poly->SetLayer( frame->GetScreen()->m_Active_Layer );
edge_poly->m_Width = 1; edge_poly->m_Width = 1;
edge_poly->m_Start = m_PreviousPos; edge_poly->m_Start = m_PreviousPos;
NEGATE(edge_poly->m_Start.y); NEGATE(edge_poly->m_Start.y);
......
...@@ -116,7 +116,7 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay ...@@ -116,7 +116,7 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
{ {
if( nbpoints ) if( nbpoints )
{ {
int Color = g_DesignSettings.m_LayerColor[track->m_Layer]; int Color = g_DesignSettings.m_LayerColor[track->GetLayer()];
GRClosedPoly( &DrawPanel->m_ClipBox, DC, nbpoints, coord, GRClosedPoly( &DrawPanel->m_ClipBox, DC, nbpoints, coord,
1, Color, Color ); 1, Color, Color );
} }
...@@ -141,7 +141,7 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay ...@@ -141,7 +141,7 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
} }
if( track->Next() == NULL ) // Last point if( track->Next() == NULL ) // Last point
{ {
int Color = g_DesignSettings.m_LayerColor[track->m_Layer]; int Color = g_DesignSettings.m_LayerColor[track->GetLayer()];
GRClosedPoly( &DrawPanel->m_ClipBox, DC, nbpoints, coord, GRClosedPoly( &DrawPanel->m_ClipBox, DC, nbpoints, coord,
1, Color, Color ); 1, Color, Color );
} }
......
This diff is collapsed.
...@@ -110,7 +110,7 @@ public: ...@@ -110,7 +110,7 @@ public:
* *
* @param testItem An EDA_BaseStruct to examine. * @param testItem An EDA_BaseStruct to examine.
* @param testData is arbitrary data needed by the inspector to determine * @param testData is arbitrary data needed by the inspector to determine
* if the EDA_BaseStruct under test meets its match criteria. * if the BOARD_ITEM under test meets its match criteria.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan, * @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE; * else SCAN_CONTINUE;
*/ */
...@@ -154,7 +154,7 @@ public: ...@@ -154,7 +154,7 @@ public:
unsigned long m_TimeStamp; // Time stamp used for logical links unsigned long m_TimeStamp; // Time stamp used for logical links
int m_Selected; /* Used by block commands, and selective editing */ int m_Selected; /* Used by block commands, and selective editing */
int m_Layer; ///< used by many derived classes, so make common // int m_Layer; ///< used by many derived classes, so make common
private: private:
int m_Status; int m_Status;
...@@ -298,21 +298,6 @@ public: ...@@ -298,21 +298,6 @@ public:
**/ **/
static std::ostream& NestedSpace( int nestLevel, std::ostream& os ); static std::ostream& NestedSpace( int nestLevel, std::ostream& os );
/**
* Function ListHas
* scans the given array and detects if the given type t is present.
* @param list An array of KICAD_T, terminated with EOT.
* @param t A KICAD_T to check for.
* @return bool - true if present, else false.
*/
static bool ListHas( const KICAD_T list[], KICAD_T t )
{
for( const KICAD_T* p = list; *p != EOT; ++p )
if( *p == t )
return true;
return false;
}
#endif #endif
}; };
...@@ -383,12 +368,59 @@ public: ...@@ -383,12 +368,59 @@ public:
}; };
/* Basic class for build items like lines, which have 1 start point and 1 end point. /**
* Arc and circles can use this class. * Class BOARD_ITEM
* is an abstract base class for any item which can be embedded within the BOARD
* container class, and therefore instances of derived classes should only be
* found in PCBNEW or other programs that use class BOARD and its contents.
* The corresponding class in EESCHEMA seems to be DrawPartStruct.
*/
class BOARD_ITEM : public EDA_BaseStruct
{
protected:
int m_Layer;
public:
BOARD_ITEM( BOARD_ITEM* StructFather, DrawStructureType idtype ) :
EDA_BaseStruct( StructFather, idtype ),
m_Layer(0)
{
}
BOARD_ITEM( const BOARD_ITEM& src ) :
EDA_BaseStruct( src.m_Parent, src.m_StructType ),
m_Layer( src.m_Layer )
{
}
BOARD_ITEM* Next() { return (BOARD_ITEM*) Pnext; }
/**
* Function GetLayer
* returns the layer this item is on.
*/
int GetLayer() const { return m_Layer; }
/**
* Function SetLayer
* sets the layer this item is on.
* @param aLayer The layer number.
*/
void SetLayer( int aLayer ) { m_Layer = aLayer; }
};
/* Base class for building items like lines, which have 1 start point and 1 end point.
* Arc and circles can use this class.
*/ */
class EDA_BaseLineStruct : public EDA_BaseStruct class EDA_BaseLineStruct : public EDA_BaseStruct
{ {
public: public:
int m_Layer; // Layer number
int m_Width; // 0 = line, > 0 = tracks, bus ... int m_Width; // 0 = line, > 0 = tracks, bus ...
wxPoint m_Start; // Line start point wxPoint m_Start; // Line start point
wxPoint m_End; // Line end point wxPoint m_End; // Line end point
......
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2004-2007 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef COLLECTOR_H
#define COLLECTOR_H
#include <vector>
//#include <cstdlib> // abs()
#include "fctsys.h"
#include "base_struct.h" // SEARCH_RESULT
#include "common.h" // GetTimeStamp()
class EDA_BaseStruct;
class BOARD;
/**
* Class COLLECTOR
* is an abstract class that will find and hold all the objects according to
* an inspection done by the Inspect() function which must be implemented by
* any derived class. When Inspect() finds an object that it wants to collect,
* i.e. one that it "likes", then it only has to do an Append( testItem )
* on it to add it to its collection, but in all cases for the scan to continue,
* Inspect() must return SEARCH_CONTINUE.
*
* Later, after collection, the user can iterate through all the objects
* in the remembered collection using GetCount() and the [int] operator.
*
* Philosophy: this class knows nothing of the context in which as BOARD is used
* and that means it knows nothing about which layers are visible or current,
* but can handle those concerns by the SetPreferredLayer() function.
*/
class COLLECTOR : public INSPECTOR
{
protected:
// int m_Type;
/// Which object types to scan
const KICAD_T* m_ScanTypes;
/// The layer that is desired as a primary search criterion
int m_PreferredLayer;
/// A place to hold collected objects without taking ownership of their memory.
std::vector<EDA_BaseStruct*> list;
/// The point at which the snapshot was taken.
wxPoint m_RefPos;
/// The time at which the collection was made.
int m_TimeAtCollection;
public:
COLLECTOR()
{
m_PreferredLayer = 0;
m_ScanTypes = 0;
}
virtual ~COLLECTOR()
{
// empty the list so that ~list() does not try and delete all
// the objects that it holds. list is not the owner of such objects
// and this prevents a double free()ing.
Empty();
}
/**
* Function Type
* returns the type of the collector.
int Type() const { return m_Type; }
*/
void SetPreferredLayer( int aPreferredLayer )
{
m_PreferredLayer = aPreferredLayer;
}
/**
* Function GetCount
* returns the number of objects in the list
*/
int GetCount() const
{
return list.size();
}
/**
* Function Empty
* sets the list to empty
*/
void Empty()
{
list.clear();
}
/**
* Function Append
* adds an item to the end of the list.
* @param item An EDA_BaseStruct* to add.
*/
void Append( EDA_BaseStruct* item )
{
list.push_back( item );
}
/**
* Function operator[int]
* is used for read only access and returns the object at index ndx.
* @param ndx The index into the list.
* @return EDA_BaseStruct* - or something derived from it, or NULL.
*/
EDA_BaseStruct* operator[]( int ndx ) const
{
if( (unsigned)ndx < (unsigned)GetCount() )
return list[ ndx ];
return NULL;
}
void SetScanTypes( const KICAD_T* scanTypes )
{
m_ScanTypes = scanTypes;
}
wxPoint GetRefPos() const { return m_RefPos; }
void SetRefPos( const wxPoint& arefPos )
{
m_RefPos = arefPos;
}
void SetTimeNow()
{
m_TimeAtCollection = GetTimeStamp();
}
int GetTime()
{
return m_TimeAtCollection;
}
/**
* Function IsSimilarPointAndTime
* returns true if the given reference point is "similar" (defined here)
* to the internal reference point and the current time is within a few
* seconds of the internal m_TimeAtCollection.
*
* @param aRefPos A wxPoint to compare to.
* @return bool - true if the point and time are similar, else false.
*/
bool IsSimilarPointAndTime( const wxPoint& aRefPos )
{
const int distMax = 2; // adjust these here
const int timeMax = 3; // seconds, I think
int dx = abs( aRefPos.x - m_RefPos.x );
int dy = abs( aRefPos.y - m_RefPos.y );
if( dx <= distMax && dy <= distMax
&& GetTimeStamp()-m_TimeAtCollection <= timeMax )
return true;
else
return false;
}
/**
* Function Inspect
* is the examining function within the INSPECTOR which is passed to the
* Iterate function. It is used primarily for searching, but not limited to
* that. It can also collect or modify the scanned objects.
*
* @param testItem An EDA_BaseStruct to examine.
* @param testData is arbitrary data needed by the inspector to determine
* if the EDA_BaseStruct under test meets its match criteria.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE;
*
* implement in derived class:
SEARCH_RESULT virtual Inspect( EDA_BaseStruct* testItem,
const void* testData ) = 0;
*/
/**
* Function Scan
* scans a BOARD using this class's Inspector method, which does the collection.
* @param board A BOARD to scan.
* @param refPos A wxPoint to use in hit-testing.
*
* example implementation, in derived class:
*
virtual void Scan( BOARD* board, const wxPoint& refPos )
{
example implementation:
SetRefPos( refPos ); // remember where the snapshot was taken from
Empty(); // empty the collection
// visit the board with the INSPECTOR (me).
board->Visit( this, // INSPECTOR* inspector
NULL, // const void* testData,
m_ScanTypes);
SetTimeNow(); // when it was taken
}
*/
};
#endif // COLLECTOR_H
...@@ -11,12 +11,14 @@ ...@@ -11,12 +11,14 @@
#define CONV_FROM_UTF8(utf8string) (utf8string) #define CONV_FROM_UTF8(utf8string) (utf8string)
#endif #endif
/* violation of C++ standard, cannot use MIN() and MAX()
#ifndef min #ifndef min
#define min(x, y) ((x) > (y) ? (y) : (x)) #define MIN(x, y) ((x) > (y) ? (y) : (x))
#endif #endif
#ifndef max #ifndef max
#define max(x, y) ((x) > (y) ? (x) : (y)) #define MAX(x, y) ((x) > (y) ? (x) : (y))
#endif #endif
*/
#ifndef MIN #ifndef MIN
#define MIN(x, y) ((x) > (y) ? (y) : (x)) #define MIN(x, y) ((x) > (y) ? (y) : (x))
......
...@@ -187,7 +187,7 @@ enum DisplayViaMode { ...@@ -187,7 +187,7 @@ enum DisplayViaMode {
}; };
class BOARD : public EDA_BaseStruct class BOARD : public BOARD_ITEM
{ {
public: public:
WinEDA_BasePcbFrame* m_PcbFrame; // Window de visualisation WinEDA_BasePcbFrame* m_PcbFrame; // Window de visualisation
...@@ -204,7 +204,7 @@ public: ...@@ -204,7 +204,7 @@ public:
int m_NbSegmTrack; // nombre d'elements de type segments de piste int m_NbSegmTrack; // nombre d'elements de type segments de piste
int m_NbSegmZone; // nombre d'elements de type segments de zone int m_NbSegmZone; // nombre d'elements de type segments de zone
EDA_BaseStruct* m_Drawings; // pointeur sur liste drawings BOARD_ITEM* m_Drawings; // pointeur sur liste drawings
MODULE* m_Modules; // pointeur sur liste zone modules MODULE* m_Modules; // pointeur sur liste zone modules
EQUIPOT* m_Equipots; // pointeur liste zone equipot EQUIPOT* m_Equipots; // pointeur liste zone equipot
TRACK* m_Track; // pointeur relatif zone piste TRACK* m_Track; // pointeur relatif zone piste
...@@ -339,15 +339,19 @@ public: ...@@ -339,15 +339,19 @@ public:
/* Description des elements du PCB */ /* Description des elements du PCB */
/***********************************/ /***********************************/
class DRAWSEGMENT : public EDA_BaseLineStruct class DRAWSEGMENT : public BOARD_ITEM
{ {
public: public:
int m_Width; // 0 = line, > 0 = tracks, bus ...
wxPoint m_Start; // Line start point
wxPoint m_End; // Line end point
int m_Shape; // forme: Segment , Cercle.. int m_Shape; // forme: Segment , Cercle..
int m_Type; // numero de sous type ( cotation.. ) int m_Type; // numero de sous type ( cotation.. )
int m_Angle; // pour les arcs: "longueur" de l'arc en 1/10 deg int m_Angle; // pour les arcs: "longueur" de l'arc en 1/10 deg
public: public:
DRAWSEGMENT( EDA_BaseStruct* StructFather, DrawStructureType idtype = TYPEDRAWSEGMENT ); DRAWSEGMENT( BOARD_ITEM* StructFather, DrawStructureType idtype = TYPEDRAWSEGMENT );
~DRAWSEGMENT( void ); ~DRAWSEGMENT( void );
// Read/write data // Read/write data
...@@ -405,7 +409,7 @@ public: ...@@ -405,7 +409,7 @@ public:
class EDGE_ZONE : public DRAWSEGMENT class EDGE_ZONE : public DRAWSEGMENT
{ {
public: public:
EDGE_ZONE( EDA_BaseStruct* StructFather ); EDGE_ZONE( BOARD_ITEM* StructFather );
EDGE_ZONE( const EDGE_ZONE& edgezone ); EDGE_ZONE( const EDGE_ZONE& edgezone );
~EDGE_ZONE( void ); ~EDGE_ZONE( void );
}; };
...@@ -415,7 +419,7 @@ public: ...@@ -415,7 +419,7 @@ public:
/* Gestion des marqueurs sur le PCB */ /* Gestion des marqueurs sur le PCB */
/************************************/ /************************************/
class MARQUEUR : public EDA_BaseStruct class MARQUEUR : public BOARD_ITEM
{ {
/* Description d'un marqueur */ /* Description d'un marqueur */
public: public:
...@@ -426,7 +430,7 @@ public: ...@@ -426,7 +430,7 @@ public:
wxString m_Diag; /* Associated text (comment) */ wxString m_Diag; /* Associated text (comment) */
public: public:
MARQUEUR( EDA_BaseStruct* StructFather ); MARQUEUR( BOARD_ITEM* StructFather );
~MARQUEUR( void ); ~MARQUEUR( void );
void UnLink( void ); void UnLink( void );
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode ); void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode );
......
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
#define eda_global extern #define eda_global extern
#endif #endif
#include <vector>
#include <wx/socket.h> #include <wx/socket.h>
#include "wx/log.h" #include "wx/log.h"
#include "wx/config.h" #include "wx/config.h"
...@@ -98,6 +96,7 @@ class WinEDA3D_DrawFrame; ...@@ -98,6 +96,7 @@ class WinEDA3D_DrawFrame;
class PARAM_CFG_BASE; class PARAM_CFG_BASE;
class Ki_PageDescr; class Ki_PageDescr;
class Ki_HotkeyInfo; class Ki_HotkeyInfo;
class ARROWCOLLECTOR;
enum id_librarytype { enum id_librarytype {
...@@ -519,9 +518,7 @@ private: ...@@ -519,9 +518,7 @@ private:
wxMenu* m_FilesMenu; wxMenu* m_FilesMenu;
#if defined(DEBUG) #if defined(DEBUG)
class COLLECTOR; ARROWCOLLECTOR* m_ArrowCollector; ///< while arrow icon tool
COLLECTOR* m_GeneralCollector; ///< while arrow icon tool
COLLECTOR* m_RatsModuleCollector; ///< while find1rats icon tool
#endif #endif
......
...@@ -448,7 +448,7 @@ int WinEDA_PcbFrame::GenPlaceBoard( void ) ...@@ -448,7 +448,7 @@ int WinEDA_PcbFrame::GenPlaceBoard( void )
PtStruct = m_Pcb->m_Drawings; PtStruct = m_Pcb->m_Drawings;
TRACK TmpSegm( NULL ); TRACK TmpSegm( NULL );
TmpSegm.m_Layer = -1; TmpSegm.SetLayer( -1 );
TmpSegm.m_NetCode = -1; TmpSegm.m_NetCode = -1;
TmpSegm.m_Width = g_GridRoutingSize / 2; TmpSegm.m_Width = g_GridRoutingSize / 2;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
...@@ -459,7 +459,7 @@ int WinEDA_PcbFrame::GenPlaceBoard( void ) ...@@ -459,7 +459,7 @@ int WinEDA_PcbFrame::GenPlaceBoard( void )
{ {
case TYPEDRAWSEGMENT: case TYPEDRAWSEGMENT:
DrawSegm = (DRAWSEGMENT*) PtStruct; DrawSegm = (DRAWSEGMENT*) PtStruct;
if( DrawSegm->m_Layer != EDGE_N ) if( DrawSegm->GetLayer() != EDGE_N )
break; break;
TmpSegm.m_Start = DrawSegm->m_Start; TmpSegm.m_Start = DrawSegm->m_Start;
...@@ -536,9 +536,9 @@ void WinEDA_PcbFrame::GenModuleOnBoard( MODULE* Module ) ...@@ -536,9 +536,9 @@ void WinEDA_PcbFrame::GenModuleOnBoard( MODULE* Module )
fy = m_Pcb->m_BoundaryBox.GetBottom(); fy = m_Pcb->m_BoundaryBox.GetBottom();
masque_layer = 0; masque_layer = 0;
if( Module->m_Layer == CMP_N ) if( Module->GetLayer() == CMP_N )
masque_layer = CMP_LAYER; masque_layer = CMP_LAYER;
if( Module->m_Layer == CUIVRE_N ) if( Module->GetLayer() == CUIVRE_N )
masque_layer = CUIVRE_LAYER; masque_layer = CUIVRE_LAYER;
TraceFilledRectangle( m_Pcb, ox, oy, fx, fy, masque_layer, TraceFilledRectangle( m_Pcb, ox, oy, fx, fy, masque_layer,
...@@ -615,7 +615,7 @@ int WinEDA_PcbFrame::RecherchePlacementModule( MODULE* Module, wxDC* DC ) ...@@ -615,7 +615,7 @@ int WinEDA_PcbFrame::RecherchePlacementModule( MODULE* Module, wxDC* DC )
{ {
D_PAD* Pad; int masque_otherlayer; D_PAD* Pad; int masque_otherlayer;
masque_otherlayer = CUIVRE_LAYER; masque_otherlayer = CUIVRE_LAYER;
if( Module->m_Layer == CUIVRE_N ) if( Module->GetLayer() == CUIVRE_N )
masque_otherlayer = CMP_LAYER; masque_otherlayer = CMP_LAYER;
for( Pad = Module->m_Pads; Pad != NULL; Pad = (D_PAD*) Pad->Pnext ) for( Pad = Module->m_Pads; Pad != NULL; Pad = (D_PAD*) Pad->Pnext )
...@@ -823,7 +823,7 @@ int TstModuleOnBoard( BOARD* Pcb, MODULE* Module, bool TstOtherSide ) ...@@ -823,7 +823,7 @@ int TstModuleOnBoard( BOARD* Pcb, MODULE* Module, bool TstOtherSide )
int error, Penalite, marge, side, otherside; int error, Penalite, marge, side, otherside;
side = TOP; otherside = BOTTOM; side = TOP; otherside = BOTTOM;
if( Module->m_Layer == CUIVRE_N ) if( Module->GetLayer() == CUIVRE_N )
{ {
side = BOTTOM; otherside = TOP; side = BOTTOM; otherside = TOP;
} }
...@@ -1064,7 +1064,7 @@ static void TracePenaliteRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int u ...@@ -1064,7 +1064,7 @@ static void TracePenaliteRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int u
if( trace & 2 ) if( trace & 2 )
{ {
data = GetDist( row, col, TOP ); data = GetDist( row, col, TOP );
data = max( data, LocalPenalite ); data = MAX( data, LocalPenalite );
SetDist( row, col, TOP, data ); SetDist( row, col, TOP, data );
} }
} }
...@@ -1193,7 +1193,7 @@ bool WinEDA_PcbFrame::SetBoardBoundaryBoxFromEdgesOnly( void ) ...@@ -1193,7 +1193,7 @@ bool WinEDA_PcbFrame::SetBoardBoundaryBoxFromEdgesOnly( void )
{ {
int rayon, cx, cy, d; int rayon, cx, cy, d;
int xmax, ymax; int xmax, ymax;
EDA_BaseStruct* PtStruct; BOARD_ITEM* PtStruct;
DRAWSEGMENT* ptr; DRAWSEGMENT* ptr;
bool succes = FALSE; bool succes = FALSE;
...@@ -1205,7 +1205,7 @@ bool WinEDA_PcbFrame::SetBoardBoundaryBoxFromEdgesOnly( void ) ...@@ -1205,7 +1205,7 @@ bool WinEDA_PcbFrame::SetBoardBoundaryBoxFromEdgesOnly( void )
/* Analyse des Contours PCB */ /* Analyse des Contours PCB */
PtStruct = m_Pcb->m_Drawings; PtStruct = m_Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{ {
if( PtStruct->m_StructType != TYPEDRAWSEGMENT ) if( PtStruct->m_StructType != TYPEDRAWSEGMENT )
continue; continue;
...@@ -1217,21 +1217,21 @@ bool WinEDA_PcbFrame::SetBoardBoundaryBoxFromEdgesOnly( void ) ...@@ -1217,21 +1217,21 @@ bool WinEDA_PcbFrame::SetBoardBoundaryBoxFromEdgesOnly( void )
cx = ptr->m_Start.x; cy = ptr->m_Start.y; cx = ptr->m_Start.x; cy = ptr->m_Start.y;
rayon = (int) hypot( (double) (ptr->m_End.x - cx), (double) (ptr->m_End.y - cy) ); rayon = (int) hypot( (double) (ptr->m_End.x - cx), (double) (ptr->m_End.y - cy) );
rayon += d; rayon += d;
m_Pcb->m_BoundaryBox.m_Pos.x = min( m_Pcb->m_BoundaryBox.m_Pos.x, cx - rayon ); m_Pcb->m_BoundaryBox.m_Pos.x = MIN( m_Pcb->m_BoundaryBox.m_Pos.x, cx - rayon );
m_Pcb->m_BoundaryBox.m_Pos.y = min( m_Pcb->m_BoundaryBox.m_Pos.y, cy - rayon ); m_Pcb->m_BoundaryBox.m_Pos.y = MIN( m_Pcb->m_BoundaryBox.m_Pos.y, cy - rayon );
xmax = max( xmax, cx + rayon ); xmax = MAX( xmax, cx + rayon );
ymax = max( ymax, cy + rayon ); ymax = MAX( ymax, cy + rayon );
} }
else else
{ {
cx = min( ptr->m_Start.x, ptr->m_End.x ); cx = MIN( ptr->m_Start.x, ptr->m_End.x );
cy = min( ptr->m_Start.y, ptr->m_End.y ); cy = MIN( ptr->m_Start.y, ptr->m_End.y );
m_Pcb->m_BoundaryBox.m_Pos.x = min( m_Pcb->m_BoundaryBox.m_Pos.x, cx - d ); m_Pcb->m_BoundaryBox.m_Pos.x = MIN( m_Pcb->m_BoundaryBox.m_Pos.x, cx - d );
m_Pcb->m_BoundaryBox.m_Pos.y = min( m_Pcb->m_BoundaryBox.m_Pos.y, cy - d ); m_Pcb->m_BoundaryBox.m_Pos.y = MIN( m_Pcb->m_BoundaryBox.m_Pos.y, cy - d );
cx = max( ptr->m_Start.x, ptr->m_End.x ); cx = MAX( ptr->m_Start.x, ptr->m_End.x );
cy = max( ptr->m_Start.y, ptr->m_End.y ); cy = MAX( ptr->m_Start.y, ptr->m_End.y );
xmax = max( xmax, cx + d ); xmax = MAX( xmax, cx + d );
ymax = max( ymax, cy + d ); ymax = MAX( ymax, cy + d );
} }
} }
......
This diff is collapsed.
...@@ -395,8 +395,8 @@ void CopyMarkedItems( MODULE* module, wxPoint offset ) ...@@ -395,8 +395,8 @@ void CopyMarkedItems( MODULE* module, wxPoint offset )
/* Copy marked items, at new position = old position + offset /* Copy marked items, at new position = old position + offset
*/ */
{ {
EDA_BaseStruct* item; BOARD_ITEM* item;
EDA_BaseStruct* NewStruct; BOARD_ITEM* NewStruct;
if( module == NULL ) if( module == NULL )
return; return;
......
...@@ -186,7 +186,7 @@ void PlaceCells( BOARD* Pcb, int net_code, int flag ) ...@@ -186,7 +186,7 @@ void PlaceCells( BOARD* Pcb, int net_code, int flag )
TRACK* pt_segm; TRACK* pt_segm;
TEXTE_PCB* PtText; TEXTE_PCB* PtText;
DRAWSEGMENT* DrawSegm; DRAWSEGMENT* DrawSegm;
EDA_BaseStruct* PtStruct; BOARD_ITEM* PtStruct;
int ux0 = 0, uy0 = 0, ux1, uy1, dx, dy; int ux0 = 0, uy0 = 0, ux1, uy1, dx, dy;
int marge, via_marge; int marge, via_marge;
int masque_layer; int masque_layer;
...@@ -211,19 +211,19 @@ void PlaceCells( BOARD* Pcb, int net_code, int flag ) ...@@ -211,19 +211,19 @@ void PlaceCells( BOARD* Pcb, int net_code, int flag )
// Placement des elements de modules sur PCB // // Placement des elements de modules sur PCB //
/////////////////////////////////////////////// ///////////////////////////////////////////////
PtStruct = Pcb->m_Modules; PtStruct = Pcb->m_Modules;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{ {
EDA_BaseStruct* PtModStruct = ( (MODULE*) PtStruct )->m_Drawings; BOARD_ITEM* PtModStruct = ( (MODULE*) PtStruct )->m_Drawings;
for( ; PtModStruct != NULL; PtModStruct = PtModStruct->Pnext ) for( ; PtModStruct != NULL; PtModStruct = PtModStruct->Next() )
{ {
switch( PtModStruct->m_StructType ) switch( PtModStruct->m_StructType )
{ {
case TYPEEDGEMODULE: case TYPEEDGEMODULE:
{ {
TRACK* TmpSegm = new TRACK( NULL ); TRACK* TmpSegm = new TRACK( NULL );
TmpSegm->m_Layer = ( (EDGE_MODULE*) PtModStruct )->m_Layer; TmpSegm->SetLayer( ( (EDGE_MODULE*) PtModStruct )->GetLayer() );
if( TmpSegm->m_Layer == EDGE_N ) if( TmpSegm->GetLayer() == EDGE_N )
TmpSegm->m_Layer = -1; TmpSegm->SetLayer( -1 );
TmpSegm->m_Start = ( (EDGE_MODULE*) PtModStruct )->m_Start; TmpSegm->m_Start = ( (EDGE_MODULE*) PtModStruct )->m_Start;
TmpSegm->m_End = ( (EDGE_MODULE*) PtModStruct )->m_End; TmpSegm->m_End = ( (EDGE_MODULE*) PtModStruct )->m_End;
...@@ -249,7 +249,7 @@ void PlaceCells( BOARD* Pcb, int net_code, int flag ) ...@@ -249,7 +249,7 @@ void PlaceCells( BOARD* Pcb, int net_code, int flag )
// Placement des contours et segments PCB // // Placement des contours et segments PCB //
//////////////////////////////////////////// ////////////////////////////////////////////
PtStruct = Pcb->m_Drawings; PtStruct = Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{ {
switch( PtStruct->m_StructType ) switch( PtStruct->m_StructType )
{ {
...@@ -258,10 +258,10 @@ void PlaceCells( BOARD* Pcb, int net_code, int flag ) ...@@ -258,10 +258,10 @@ void PlaceCells( BOARD* Pcb, int net_code, int flag )
int type_cell = HOLE; int type_cell = HOLE;
TRACK* TmpSegm = new TRACK( NULL ); TRACK* TmpSegm = new TRACK( NULL );
DrawSegm = (DRAWSEGMENT*) PtStruct; DrawSegm = (DRAWSEGMENT*) PtStruct;
TmpSegm->m_Layer = DrawSegm->m_Layer; TmpSegm->SetLayer( DrawSegm->GetLayer() );
if( DrawSegm->m_Layer == EDGE_N ) if( DrawSegm->GetLayer() == EDGE_N )
{ {
TmpSegm->m_Layer = -1; TmpSegm->SetLayer( -1 );
type_cell |= CELL_is_EDGE; type_cell |= CELL_is_EDGE;
} }
...@@ -293,7 +293,7 @@ void PlaceCells( BOARD* Pcb, int net_code, int flag ) ...@@ -293,7 +293,7 @@ void PlaceCells( BOARD* Pcb, int net_code, int flag )
ux1 = ux0 + dx; uy1 = uy0 + dy; ux1 = ux0 + dx; uy1 = uy0 + dy;
ux0 -= dx; uy0 -= dy; ux0 -= dx; uy0 -= dy;
masque_layer = g_TabOneLayerMask[PtText->m_Layer]; masque_layer = g_TabOneLayerMask[PtText->GetLayer()];
TraceFilledRectangle( Pcb, ux0 - marge, uy0 - marge, ux1 + marge, uy1 + marge, TraceFilledRectangle( Pcb, ux0 - marge, uy0 - marge, ux1 + marge, uy1 + marge,
(int) (PtText->m_Orient), (int) (PtText->m_Orient),
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
/* Constructor */ /* Constructor */
BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) : BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) :
EDA_BaseStruct( parent, TYPEPCB ) BOARD_ITEM( (BOARD_ITEM*) parent, TYPEPCB )
{ {
m_PcbFrame = frame; m_PcbFrame = frame;
m_Status_Pcb = 0; // Mot d'etat: Bit 1 = Chevelu calcule m_Status_Pcb = 0; // Mot d'etat: Bit 1 = Chevelu calcule
...@@ -24,7 +24,7 @@ BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) : ...@@ -24,7 +24,7 @@ BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) :
m_NbPads = 0; // nombre total de pads m_NbPads = 0; // nombre total de pads
m_NbNodes = 0; // nombre de pads connectes m_NbNodes = 0; // nombre de pads connectes
m_NbLinks = 0; // nombre de chevelus (donc aussi nombre m_NbLinks = 0; // nombre de chevelus (donc aussi nombre
// minimal de pistes a tracer // minimal de pistes a tracer
m_NbSegmTrack = 0; // nombre d'elements de type segments de piste m_NbSegmTrack = 0; // nombre d'elements de type segments de piste
m_NbSegmZone = 0; // nombre d'elements de type segments de zone m_NbSegmZone = 0; // nombre d'elements de type segments de zone
m_NbNoconnect = 0; // nombre de chevelus actifs m_NbNoconnect = 0; // nombre de chevelus actifs
...@@ -39,7 +39,7 @@ BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) : ...@@ -39,7 +39,7 @@ BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) :
m_Ratsnest = NULL; // pointeur liste rats m_Ratsnest = NULL; // pointeur liste rats
m_LocalRatsnest = NULL; // pointeur liste rats local m_LocalRatsnest = NULL; // pointeur liste rats local
m_CurrentLimitZone = NULL; // pointeur liste des EDEGE_ZONES m_CurrentLimitZone = NULL; // pointeur liste des EDEGE_ZONES
// de determination des contours de zone // de determination des contours de zone
} }
...@@ -160,22 +160,22 @@ bool BOARD::ComputeBoundaryBox( void ) ...@@ -160,22 +160,22 @@ bool BOARD::ComputeBoundaryBox( void )
cx = ptr->m_Start.x; cy = ptr->m_Start.y; cx = ptr->m_Start.x; cy = ptr->m_Start.y;
rayon = (int) hypot( (double) (ptr->m_End.x - cx), (double) (ptr->m_End.y - cy) ); rayon = (int) hypot( (double) (ptr->m_End.x - cx), (double) (ptr->m_End.y - cy) );
rayon += d; rayon += d;
xmin = min( xmin, cx - rayon ); xmin = MIN( xmin, cx - rayon );
ymin = min( ymin, cy - rayon ); ymin = MIN( ymin, cy - rayon );
xmax = max( xmax, cx + rayon ); xmax = MAX( xmax, cx + rayon );
ymax = max( ymax, cy + rayon ); ymax = MAX( ymax, cy + rayon );
Has_Items = TRUE; Has_Items = TRUE;
} }
else else
{ {
cx = min( ptr->m_Start.x, ptr->m_End.x ); cx = MIN( ptr->m_Start.x, ptr->m_End.x );
cy = min( ptr->m_Start.y, ptr->m_End.y ); cy = MIN( ptr->m_Start.y, ptr->m_End.y );
xmin = min( xmin, cx - d ); xmin = MIN( xmin, cx - d );
ymin = min( ymin, cy - d ); ymin = MIN( ymin, cy - d );
cx = max( ptr->m_Start.x, ptr->m_End.x ); cx = MAX( ptr->m_Start.x, ptr->m_End.x );
cy = max( ptr->m_Start.y, ptr->m_End.y ); cy = MAX( ptr->m_Start.y, ptr->m_End.y );
xmax = max( xmax, cx + d ); xmax = MAX( xmax, cx + d );
ymax = max( ymax, cy + d ); ymax = MAX( ymax, cy + d );
Has_Items = TRUE; Has_Items = TRUE;
} }
} }
...@@ -185,19 +185,19 @@ bool BOARD::ComputeBoundaryBox( void ) ...@@ -185,19 +185,19 @@ bool BOARD::ComputeBoundaryBox( void )
for( ; module != NULL; module = (MODULE*) module->Pnext ) for( ; module != NULL; module = (MODULE*) module->Pnext )
{ {
Has_Items = TRUE; Has_Items = TRUE;
xmin = min( xmin, ( module->m_Pos.x + module->m_BoundaryBox.GetX() ) ); xmin = MIN( xmin, ( module->m_Pos.x + module->m_BoundaryBox.GetX() ) );
ymin = min( ymin, ( module->m_Pos.y + module->m_BoundaryBox.GetY() ) ); ymin = MIN( ymin, ( module->m_Pos.y + module->m_BoundaryBox.GetY() ) );
xmax = max( xmax, module->m_Pos.x + module->m_BoundaryBox.GetRight() ); xmax = MAX( xmax, module->m_Pos.x + module->m_BoundaryBox.GetRight() );
ymax = max( ymax, module->m_Pos.y + module->m_BoundaryBox.GetBottom() ); ymax = MAX( ymax, module->m_Pos.y + module->m_BoundaryBox.GetBottom() );
D_PAD* pt_pad = module->m_Pads; D_PAD* pt_pad = module->m_Pads;
for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext ) for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext )
{ {
d = pt_pad->m_Rayon; d = pt_pad->m_Rayon;
xmin = min( xmin, pt_pad->m_Pos.x - d ); xmin = MIN( xmin, pt_pad->m_Pos.x - d );
ymin = min( ymin, pt_pad->m_Pos.y - d ); ymin = MIN( ymin, pt_pad->m_Pos.y - d );
xmax = max( xmax, pt_pad->m_Pos.x + d ); xmax = MAX( xmax, pt_pad->m_Pos.x + d );
ymax = max( ymax, pt_pad->m_Pos.y + d ); ymax = MAX( ymax, pt_pad->m_Pos.y + d );
} }
} }
...@@ -205,28 +205,28 @@ bool BOARD::ComputeBoundaryBox( void ) ...@@ -205,28 +205,28 @@ bool BOARD::ComputeBoundaryBox( void )
for( Track = m_Track; Track != NULL; Track = (TRACK*) Track->Pnext ) for( Track = m_Track; Track != NULL; Track = (TRACK*) Track->Pnext )
{ {
d = (Track->m_Width / 2) + 1; d = (Track->m_Width / 2) + 1;
cx = min( Track->m_Start.x, Track->m_End.x ); cx = MIN( Track->m_Start.x, Track->m_End.x );
cy = min( Track->m_Start.y, Track->m_End.y ); cy = MIN( Track->m_Start.y, Track->m_End.y );
xmin = min( xmin, cx - d ); xmin = MIN( xmin, cx - d );
ymin = min( ymin, cy - d ); ymin = MIN( ymin, cy - d );
cx = max( Track->m_Start.x, Track->m_End.x ); cx = MAX( Track->m_Start.x, Track->m_End.x );
cy = max( Track->m_Start.y, Track->m_End.y ); cy = MAX( Track->m_Start.y, Track->m_End.y );
xmax = max( xmax, cx + d ); xmax = MAX( xmax, cx + d );
ymax = max( ymax, cy + d ); ymax = MAX( ymax, cy + d );
Has_Items = TRUE; Has_Items = TRUE;
} }
for( Track = m_Zone; Track != NULL; Track = (TRACK*) Track->Pnext ) for( Track = m_Zone; Track != NULL; Track = (TRACK*) Track->Pnext )
{ {
d = (Track->m_Width / 2) + 1; d = (Track->m_Width / 2) + 1;
cx = min( Track->m_Start.x, Track->m_End.x ); cx = MIN( Track->m_Start.x, Track->m_End.x );
cy = min( Track->m_Start.y, Track->m_End.y ); cy = MIN( Track->m_Start.y, Track->m_End.y );
xmin = min( xmin, cx - d ); xmin = MIN( xmin, cx - d );
ymin = min( ymin, cy - d ); ymin = MIN( ymin, cy - d );
cx = max( Track->m_Start.x, Track->m_End.x ); cx = MAX( Track->m_Start.x, Track->m_End.x );
cy = max( Track->m_Start.y, Track->m_End.y ); cy = MAX( Track->m_Start.y, Track->m_End.y );
xmax = max( xmax, cx + d ); xmax = MAX( xmax, cx + d );
ymax = max( ymax, cy + d ); ymax = MAX( ymax, cy + d );
Has_Items = TRUE; Has_Items = TRUE;
} }
...@@ -378,7 +378,7 @@ EDA_BaseStruct* BOARD::FindPadOrModule( const wxPoint& refPos, int layer ) ...@@ -378,7 +378,7 @@ EDA_BaseStruct* BOARD::FindPadOrModule( const wxPoint& refPos, int layer )
class PadOrModule : public INSPECTOR class PadOrModule : public INSPECTOR
{ {
public: public:
EDA_BaseStruct* found; BOARD_ITEM* found;
int layer; int layer;
int layer_mask; int layer_mask;
...@@ -388,46 +388,47 @@ EDA_BaseStruct* BOARD::FindPadOrModule( const wxPoint& refPos, int layer ) ...@@ -388,46 +388,47 @@ EDA_BaseStruct* BOARD::FindPadOrModule( const wxPoint& refPos, int layer )
SEARCH_RESULT Inspect( EDA_BaseStruct* testItem, const void* testData ) SEARCH_RESULT Inspect( EDA_BaseStruct* testItem, const void* testData )
{ {
const wxPoint& refPos = *(const wxPoint*) testData; BOARD_ITEM* item = (BOARD_ITEM*) testItem;
const wxPoint& refPos = *(const wxPoint*) testData;
if( testItem->m_StructType == TYPEPAD ) if( item->m_StructType == TYPEPAD )
{ {
D_PAD* pad = (D_PAD*) testItem; D_PAD* pad = (D_PAD*) item;
if( pad->HitTest( refPos ) ) if( pad->HitTest( refPos ) )
{ {
if( layer_mask & pad->m_Masque_Layer ) if( layer_mask & pad->m_Masque_Layer )
{ {
found = testItem; found = item;
return SEARCH_QUIT; return SEARCH_QUIT;
} }
else if( !found ) else if( !found )
{ {
MODULE* parent = (MODULE*) pad->m_Parent; MODULE* parent = (MODULE*) pad->m_Parent;
if( IsModuleLayerVisible( parent->m_Layer ) ) if( IsModuleLayerVisible( parent->GetLayer() ) )
found = testItem; found = item;
} }
} }
} }
else if( testItem->m_StructType == TYPEMODULE ) else if( item->m_StructType == TYPEMODULE )
{ {
MODULE* module = (MODULE*) testItem; MODULE* module = (MODULE*) item;
// consider only visible modules // consider only visible modules
if( IsModuleLayerVisible( module->m_Layer ) ) if( IsModuleLayerVisible( module->GetLayer() ) )
{ {
if( module->HitTest( refPos ) ) if( module->HitTest( refPos ) )
{ {
if( layer == module->m_Layer ) if( layer == module->GetLayer() )
{ {
found = testItem; found = item;
return SEARCH_QUIT; return SEARCH_QUIT;
} }
// layer mismatch, save in case we don't find a // layer mismatch, save in case we don't find a
// future layer match hit. // future layer match hit.
if( !found ) if( !found )
found = testItem; found = item;
} }
} }
} }
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
#include "wxstruct.h" #include "wxstruct.h"
COTATION::COTATION( EDA_BaseStruct* StructFather ) : COTATION::COTATION( BOARD_ITEM* StructFather ) :
EDA_BaseStruct( StructFather, TYPECOTATION ) BOARD_ITEM( StructFather, TYPECOTATION )
{ {
m_Layer = DRAW_LAYER; m_Layer = DRAW_LAYER;
m_Width = 50; m_Width = 50;
...@@ -24,7 +24,7 @@ COTATION::COTATION( EDA_BaseStruct* StructFather ) : ...@@ -24,7 +24,7 @@ COTATION::COTATION( EDA_BaseStruct* StructFather ) :
/* Effacement memoire de la structure */ /* Effacement memoire de la structure */
COTATION::~COTATION( void ) COTATION::~COTATION()
{ {
delete m_Text; delete m_Text;
} }
...@@ -44,7 +44,7 @@ void COTATION::UnLink( void ) ...@@ -44,7 +44,7 @@ void COTATION::UnLink( void )
} }
else /* Le chainage arriere pointe sur la structure "Pere" */ else /* Le chainage arriere pointe sur la structure "Pere" */
{ {
( (BOARD*) Pback )->m_Drawings = Pnext; ( (BOARD*) Pback )->m_Drawings = (BOARD_ITEM*) Pnext;
} }
} }
...@@ -68,7 +68,7 @@ void COTATION::Copy( COTATION* source ) ...@@ -68,7 +68,7 @@ void COTATION::Copy( COTATION* source )
/*************************************/ /*************************************/
{ {
m_Value = source->m_Value; m_Value = source->m_Value;
m_Layer = source->m_Layer; SetLayer( source->GetLayer() );
m_Width = source->m_Width; m_Width = source->m_Width;
m_Pos = source->m_Pos; m_Pos = source->m_Pos;
m_Shape = source->m_Shape; m_Shape = source->m_Shape;
...@@ -112,15 +112,18 @@ bool COTATION::ReadCotationDescr( FILE* File, int* LineNum ) ...@@ -112,15 +112,18 @@ bool COTATION::ReadCotationDescr( FILE* File, int* LineNum )
if( Line[0] == 'G' ) if( Line[0] == 'G' )
{ {
sscanf( Line + 2, " %d %d %lX", &m_Shape, &m_Layer, &m_TimeStamp ); int layer;
sscanf( Line + 2, " %d %d %lX", &m_Shape, &layer, &m_TimeStamp );
/* Mise a jour des param .layer des sous structures */ /* Mise a jour des param .layer des sous structures */
if( m_Layer < FIRST_NO_COPPER_LAYER ) if( layer < FIRST_NO_COPPER_LAYER )
m_Layer = FIRST_NO_COPPER_LAYER; layer = FIRST_NO_COPPER_LAYER;
if( m_Layer > LAST_NO_COPPER_LAYER ) if( layer > LAST_NO_COPPER_LAYER )
m_Layer = LAST_NO_COPPER_LAYER; layer = LAST_NO_COPPER_LAYER;
m_Text->m_Layer = m_Layer; SetLayer( layer );
m_Text->SetLayer( layer );
continue; continue;
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "base_struct.h" #include "base_struct.h"
class COTATION : public EDA_BaseStruct class COTATION : public BOARD_ITEM
{ {
public: public:
int m_Width; int m_Width;
...@@ -25,8 +25,8 @@ public: ...@@ -25,8 +25,8 @@ public:
int FlecheG2_ox, FlecheG2_oy, FlecheG2_fx, FlecheG2_fy; int FlecheG2_ox, FlecheG2_oy, FlecheG2_fx, FlecheG2_fy;
public: public:
COTATION( EDA_BaseStruct* StructFather ); COTATION( BOARD_ITEM* StructFather );
~COTATION( void ); ~COTATION();
bool ReadCotationDescr( FILE* File, int* LineNum ); bool ReadCotationDescr( FILE* File, int* LineNum );
bool WriteCotationDescr( FILE* File ); bool WriteCotationDescr( FILE* File );
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
/******************************************/ /******************************************/
EDGE_MODULE::EDGE_MODULE( MODULE* parent ) : EDGE_MODULE::EDGE_MODULE( MODULE* parent ) :
EDA_BaseLineStruct( parent, TYPEEDGEMODULE ) BOARD_ITEM( parent, TYPEEDGEMODULE )
{ {
m_Shape = S_SEGMENT; m_Shape = S_SEGMENT;
m_Angle = 0; m_Angle = 0;
...@@ -91,7 +91,7 @@ void EDGE_MODULE::UnLink( void ) ...@@ -91,7 +91,7 @@ void EDGE_MODULE::UnLink( void )
} }
else /* Le chainage arriere pointe sur la structure "Pere" */ else /* Le chainage arriere pointe sur la structure "Pere" */
{ {
( (MODULE*) Pback )->m_Drawings = Pnext; ( (MODULE*) Pback )->m_Drawings = (BOARD_ITEM*) Pnext;
} }
} }
...@@ -287,10 +287,10 @@ void EDGE_MODULE::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -287,10 +287,10 @@ void EDGE_MODULE::Display_Infos( WinEDA_DrawFrame* frame )
Affiche_1_Parametre( frame, 24, _( "TimeStamp" ), bufcar, BROWN ); Affiche_1_Parametre( frame, 24, _( "TimeStamp" ), bufcar, BROWN );
Affiche_1_Parametre( frame, 34, _( "Mod Layer" ), ReturnPcbLayerName( module->m_Layer ), RED ); Affiche_1_Parametre( frame, 34, _( "Mod Layer" ), ReturnPcbLayerName( module->GetLayer() ), RED );
Affiche_1_Parametre( frame, 44, _( "Seg Layer" ), Affiche_1_Parametre( frame, 44, _( "Seg Layer" ),
ReturnPcbLayerName( module->m_Layer ), RED ); ReturnPcbLayerName( module->GetLayer() ), RED );
valeur_param( m_Width, bufcar ); valeur_param( m_Width, bufcar );
Affiche_1_Parametre( frame, 54, _( "Width" ), bufcar, BLUE ); Affiche_1_Parametre( frame, 54, _( "Width" ), bufcar, BLUE );
......
...@@ -7,9 +7,13 @@ class Pcb3D_GLCanvas; ...@@ -7,9 +7,13 @@ class Pcb3D_GLCanvas;
/* description des contours (empreintes ) et TYPES des CONTOURS : */ /* description des contours (empreintes ) et TYPES des CONTOURS : */
class EDGE_MODULE : public EDA_BaseLineStruct class EDGE_MODULE : public BOARD_ITEM
{ {
public: public:
int m_Width; // 0 = line, > 0 = tracks, bus ...
wxPoint m_Start; // Line start point
wxPoint m_End; // Line end point
int m_Shape; // voir "enum Track_Shapes" int m_Shape; // voir "enum Track_Shapes"
wxPoint m_Start0; // coord relatives a l'ancre du point de depart(Orient 0) wxPoint m_Start0; // coord relatives a l'ancre du point de depart(Orient 0)
wxPoint m_End0; // coord relatives a l'ancre du point de fin (Orient 0) wxPoint m_End0; // coord relatives a l'ancre du point de fin (Orient 0)
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
/*********************************************************/ /*********************************************************/
/* Constructeur de la classe EQUIPOT */ /* Constructeur de la classe EQUIPOT */
EQUIPOT::EQUIPOT( EDA_BaseStruct* StructFather ) : EQUIPOT::EQUIPOT( BOARD_ITEM* StructFather ) :
EDA_BaseStruct( StructFather, PCB_EQUIPOT_STRUCT_TYPE ) BOARD_ITEM( StructFather, PCB_EQUIPOT_STRUCT_TYPE )
{ {
m_NetCode = 0; m_NetCode = 0;
m_NbNodes = m_NbLink = m_NbNoconn = 0; m_NbNodes = m_NbLink = m_NbNoconn = 0;
...@@ -39,7 +39,7 @@ EQUIPOT::EQUIPOT( EDA_BaseStruct* StructFather ) : ...@@ -39,7 +39,7 @@ EQUIPOT::EQUIPOT( EDA_BaseStruct* StructFather ) :
/* destructeut */ /* destructeut */
EQUIPOT::~EQUIPOT( void ) EQUIPOT::~EQUIPOT()
{ {
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
/* Representation des descriptions des equipotentielles */ /* Representation des descriptions des equipotentielles */
class EQUIPOT : public EDA_BaseStruct class EQUIPOT : public BOARD_ITEM
{ {
public: public:
wxString m_Netname; // nom du net wxString m_Netname; // nom du net
...@@ -22,8 +22,8 @@ public: ...@@ -22,8 +22,8 @@ public:
CHEVELU* m_RatsnestStart; // pointeur sur debut de liste ratsnests du net CHEVELU* m_RatsnestStart; // pointeur sur debut de liste ratsnests du net
CHEVELU* m_RatsnestEnd; // pointeur sur fin de liste ratsnests du net CHEVELU* m_RatsnestEnd; // pointeur sur fin de liste ratsnests du net
EQUIPOT( EDA_BaseStruct* StructFather ); EQUIPOT( BOARD_ITEM* StructFather );
~EQUIPOT( void ); ~EQUIPOT();
/* Effacement memoire de la structure */ /* Effacement memoire de la structure */
void UnLink( void ); void UnLink( void );
......
...@@ -9,15 +9,15 @@ ...@@ -9,15 +9,15 @@
#include "pcbnew.h" #include "pcbnew.h"
MIREPCB::MIREPCB( EDA_BaseStruct* StructFather ) : MIREPCB::MIREPCB( BOARD_ITEM* StructFather ) :
EDA_BaseStruct( StructFather, TYPEMIRE ) BOARD_ITEM( StructFather, TYPEMIRE )
{ {
m_Shape = 0; m_Shape = 0;
m_Size = 5000; m_Size = 5000;
} }
MIREPCB::~MIREPCB( void ) MIREPCB::~MIREPCB()
{ {
} }
...@@ -39,7 +39,7 @@ void MIREPCB::UnLink( void ) ...@@ -39,7 +39,7 @@ void MIREPCB::UnLink( void )
} }
else /* Le chainage arriere pointe sur la structure "Pere" */ else /* Le chainage arriere pointe sur la structure "Pere" */
{ {
( (BOARD*) Pback )->m_Drawings = Pnext; ( (BOARD*) Pback )->m_Drawings = (BOARD_ITEM*) Pnext;
} }
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "base_struct.h" #include "base_struct.h"
class MIREPCB : public EDA_BaseStruct class MIREPCB : public BOARD_ITEM
{ {
public: public:
int m_Width; int m_Width;
...@@ -16,8 +16,8 @@ public: ...@@ -16,8 +16,8 @@ public:
int m_Size; int m_Size;
public: public:
MIREPCB( EDA_BaseStruct* StructFather ); MIREPCB( BOARD_ITEM* StructFather );
~MIREPCB( void ); ~MIREPCB();
bool WriteMirePcbDescr( FILE* File ); bool WriteMirePcbDescr( FILE* File );
bool ReadMirePcbDescr( FILE* File, int* LineNum ); bool ReadMirePcbDescr( FILE* File, int* LineNum );
......
...@@ -58,7 +58,8 @@ void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset ...@@ -58,7 +58,8 @@ void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset
/*************************************************/ /*************************************************/
/* Constructeur de la classe MODULE */ /* Constructeur de la classe MODULE */
MODULE::MODULE( BOARD* parent ) : EDA_BaseStruct( parent, TYPEMODULE ) MODULE::MODULE( BOARD* parent ) :
BOARD_ITEM( parent, TYPEMODULE )
{ {
m_Pads = NULL; m_Pads = NULL;
m_Drawings = NULL; m_Drawings = NULL;
...@@ -168,9 +169,9 @@ void MODULE::Copy( MODULE* Module ) ...@@ -168,9 +169,9 @@ void MODULE::Copy( MODULE* Module )
} }
/* Copy des structures auxiliaires: Drawings */ /* Copy des structures auxiliaires: Drawings */
EDA_BaseStruct* OldStruct = (EDA_BaseStruct*) Module->m_Drawings; BOARD_ITEM* OldStruct = Module->m_Drawings;
EDA_BaseStruct* NewStruct, * LastStruct = NULL; BOARD_ITEM* NewStruct, * LastStruct = NULL;
for( ; OldStruct; OldStruct = OldStruct->Pnext ) for( ; OldStruct; OldStruct = OldStruct->Next() )
{ {
NewStruct = NULL; NewStruct = NULL;
...@@ -423,7 +424,7 @@ int MODULE::WriteDescr( FILE* File ) ...@@ -423,7 +424,7 @@ int MODULE::WriteDescr( FILE* File )
m_Reference->m_Size.y, m_Reference->m_Size.x, m_Reference->m_Size.y, m_Reference->m_Size.x,
m_Reference->m_Orient + m_Orient, m_Reference->m_Width, m_Reference->m_Orient + m_Orient, m_Reference->m_Width,
m_Reference->m_Miroir ? 'N' : 'M', m_Reference->m_NoShow ? 'I' : 'V', m_Reference->m_Miroir ? 'N' : 'M', m_Reference->m_NoShow ? 'I' : 'V',
m_Reference->m_Layer, m_Reference->GetLayer(),
CONV_TO_UTF8( m_Reference->m_Text ) ); CONV_TO_UTF8( m_Reference->m_Text ) );
NbLigne++; NbLigne++;
...@@ -434,7 +435,7 @@ int MODULE::WriteDescr( FILE* File ) ...@@ -434,7 +435,7 @@ int MODULE::WriteDescr( FILE* File )
m_Value->m_Size.y, m_Value->m_Size.x, m_Value->m_Size.y, m_Value->m_Size.x,
m_Value->m_Orient + m_Orient, m_Value->m_Width, m_Value->m_Orient + m_Orient, m_Value->m_Width,
m_Value->m_Miroir ? 'N' : 'M', m_Value->m_NoShow ? 'I' : 'V', m_Value->m_Miroir ? 'N' : 'M', m_Value->m_NoShow ? 'I' : 'V',
m_Value->m_Layer, m_Value->GetLayer(),
CONV_TO_UTF8( m_Value->m_Text ) ); CONV_TO_UTF8( m_Value->m_Text ) );
NbLigne++; NbLigne++;
...@@ -453,7 +454,7 @@ int MODULE::WriteDescr( FILE* File ) ...@@ -453,7 +454,7 @@ int MODULE::WriteDescr( FILE* File )
PtText->m_Orient + m_Orient, PtText->m_Width, PtText->m_Orient + m_Orient, PtText->m_Width,
PtText->m_Miroir ? 'N' : 'M', PtText->m_Miroir ? 'N' : 'M',
PtText->m_NoShow ? 'I' : 'V', PtText->m_NoShow ? 'I' : 'V',
PtText->m_Layer, CONV_TO_UTF8( PtText->m_Text ) ); PtText->GetLayer(), CONV_TO_UTF8( PtText->m_Text ) );
NbLigne++; NbLigne++;
break; break;
...@@ -720,22 +721,23 @@ int MODULE::ReadDescr( FILE* File, int* LineNum ) ...@@ -720,22 +721,23 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
if( LastModStruct == NULL ) if( LastModStruct == NULL )
{ {
DrawText->Pback = this; DrawText->Pback = this;
m_Drawings = (EDA_BaseStruct*) DrawText; m_Drawings = DrawText;
} }
else else
{ {
DrawText->Pback = LastModStruct; DrawText->Pback = LastModStruct;
LastModStruct->Pnext = DrawText; LastModStruct->Pnext = DrawText;
} }
LastModStruct = (EDA_BaseStruct*) DrawText; LastModStruct = DrawText;
} }
int layer;
sscanf( Line + 1, "%d %d %d %d %d %d %d %s %s %d", sscanf( Line + 1, "%d %d %d %d %d %d %d %s %s %d",
&itmp1, &itmp1,
&DrawText->m_Pos0.x, &DrawText->m_Pos0.y, &DrawText->m_Pos0.x, &DrawText->m_Pos0.y,
&DrawText->m_Size.y, &DrawText->m_Size.x, &DrawText->m_Size.y, &DrawText->m_Size.x,
&DrawText->m_Orient, &DrawText->m_Width, &DrawText->m_Orient, &DrawText->m_Width,
BufCar1, BufCar2, &DrawText->m_Layer ); BufCar1, BufCar2, &layer );
DrawText->m_Type = itmp1; DrawText->m_Type = itmp1;
DrawText->m_Orient -= m_Orient; // m_Orient texte relative au module DrawText->m_Orient -= m_Orient; // m_Orient texte relative au module
...@@ -748,11 +750,13 @@ int MODULE::ReadDescr( FILE* File, int* LineNum ) ...@@ -748,11 +750,13 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
else else
DrawText->m_NoShow = 0; DrawText->m_NoShow = 0;
if( m_Layer == CUIVRE_N ) if( layer == CUIVRE_N )
DrawText->m_Layer = SILKSCREEN_N_CU; layer = SILKSCREEN_N_CU;
if( m_Layer == CMP_N ) else if( layer == CMP_N )
DrawText->m_Layer = SILKSCREEN_N_CMP; layer = SILKSCREEN_N_CMP;
DrawText->SetLayer( layer );
/* calcul de la position vraie */ /* calcul de la position vraie */
DrawText->SetDrawCoord(); DrawText->SetDrawCoord();
/* Lecture de la chaine "text" */ /* Lecture de la chaine "text" */
...@@ -961,22 +965,22 @@ void MODULE::Set_Rectangle_Encadrement( void ) ...@@ -961,22 +965,22 @@ void MODULE::Set_Rectangle_Encadrement( void )
uxf = pt_edge_mod->m_End0.x; uyf = pt_edge_mod->m_End0.y; uxf = pt_edge_mod->m_End0.x; uyf = pt_edge_mod->m_End0.y;
rayon = (int) hypot( (double) (cx - uxf), (double) (cy - uyf) ); rayon = (int) hypot( (double) (cx - uxf), (double) (cy - uyf) );
rayon += width; rayon += width;
m_BoundaryBox.m_Pos.x = min( m_BoundaryBox.m_Pos.x, cx - rayon ); m_BoundaryBox.m_Pos.x = MIN( m_BoundaryBox.m_Pos.x, cx - rayon );
m_BoundaryBox.m_Pos.y = min( m_BoundaryBox.m_Pos.y, cy - rayon ); m_BoundaryBox.m_Pos.y = MIN( m_BoundaryBox.m_Pos.y, cy - rayon );
xmax = max( xmax, cx + rayon ); xmax = MAX( xmax, cx + rayon );
ymax = max( ymax, cy + rayon ); ymax = MAX( ymax, cy + rayon );
break; break;
} }
default: default:
m_BoundaryBox.m_Pos.x = min( m_BoundaryBox.m_Pos.x, pt_edge_mod->m_Start0.x - width ); m_BoundaryBox.m_Pos.x = MIN( m_BoundaryBox.m_Pos.x, pt_edge_mod->m_Start0.x - width );
m_BoundaryBox.m_Pos.x = min( m_BoundaryBox.m_Pos.x, pt_edge_mod->m_End0.x - width ); m_BoundaryBox.m_Pos.x = MIN( m_BoundaryBox.m_Pos.x, pt_edge_mod->m_End0.x - width );
m_BoundaryBox.m_Pos.y = min( m_BoundaryBox.m_Pos.y, pt_edge_mod->m_Start0.y - width ); m_BoundaryBox.m_Pos.y = MIN( m_BoundaryBox.m_Pos.y, pt_edge_mod->m_Start0.y - width );
m_BoundaryBox.m_Pos.y = min( m_BoundaryBox.m_Pos.y, pt_edge_mod->m_End0.y - width ); m_BoundaryBox.m_Pos.y = MIN( m_BoundaryBox.m_Pos.y, pt_edge_mod->m_End0.y - width );
xmax = max( xmax, pt_edge_mod->m_Start0.x + width ); xmax = MAX( xmax, pt_edge_mod->m_Start0.x + width );
xmax = max( xmax, pt_edge_mod->m_End0.x + width ); xmax = MAX( xmax, pt_edge_mod->m_End0.x + width );
ymax = max( ymax, pt_edge_mod->m_Start0.y + width ); ymax = MAX( ymax, pt_edge_mod->m_Start0.y + width );
ymax = max( ymax, pt_edge_mod->m_End0.y + width ); ymax = MAX( ymax, pt_edge_mod->m_End0.y + width );
break; break;
} }
} }
...@@ -986,10 +990,10 @@ void MODULE::Set_Rectangle_Encadrement( void ) ...@@ -986,10 +990,10 @@ void MODULE::Set_Rectangle_Encadrement( void )
{ {
rayon = pad->m_Rayon; rayon = pad->m_Rayon;
cx = pad->m_Pos0.x; cy = pad->m_Pos0.y; cx = pad->m_Pos0.x; cy = pad->m_Pos0.y;
m_BoundaryBox.m_Pos.x = min( m_BoundaryBox.m_Pos.x, cx - rayon ); m_BoundaryBox.m_Pos.x = MIN( m_BoundaryBox.m_Pos.x, cx - rayon );
m_BoundaryBox.m_Pos.y = min( m_BoundaryBox.m_Pos.y, cy - rayon ); m_BoundaryBox.m_Pos.y = MIN( m_BoundaryBox.m_Pos.y, cy - rayon );
xmax = max( xmax, cx + rayon ); xmax = MAX( xmax, cx + rayon );
ymax = max( ymax, cy + rayon ); ymax = MAX( ymax, cy + rayon );
} }
m_BoundaryBox.SetWidth( xmax - m_BoundaryBox.m_Pos.x ); m_BoundaryBox.SetWidth( xmax - m_BoundaryBox.m_Pos.x );
...@@ -1035,22 +1039,22 @@ void MODULE::SetRectangleExinscrit( void ) ...@@ -1035,22 +1039,22 @@ void MODULE::SetRectangleExinscrit( void )
uxf = EdgeMod->m_End.x; uyf = EdgeMod->m_End.y; uxf = EdgeMod->m_End.x; uyf = EdgeMod->m_End.y;
rayon = (int) hypot( (double) (cx - uxf), (double) (cy - uyf) ); rayon = (int) hypot( (double) (cx - uxf), (double) (cy - uyf) );
rayon += width; rayon += width;
m_RealBoundaryBox.m_Pos.x = min( m_RealBoundaryBox.m_Pos.x, cx - rayon ); m_RealBoundaryBox.m_Pos.x = MIN( m_RealBoundaryBox.m_Pos.x, cx - rayon );
m_RealBoundaryBox.m_Pos.y = min( m_RealBoundaryBox.m_Pos.y, cy - rayon ); m_RealBoundaryBox.m_Pos.y = MIN( m_RealBoundaryBox.m_Pos.y, cy - rayon );
xmax = max( xmax, cx + rayon ); xmax = MAX( xmax, cx + rayon );
ymax = max( ymax, cy + rayon ); ymax = MAX( ymax, cy + rayon );
break; break;
} }
default: default:
m_RealBoundaryBox.m_Pos.x = min( m_RealBoundaryBox.m_Pos.x, EdgeMod->m_Start.x - width ); m_RealBoundaryBox.m_Pos.x = MIN( m_RealBoundaryBox.m_Pos.x, EdgeMod->m_Start.x - width );
m_RealBoundaryBox.m_Pos.x = min( m_RealBoundaryBox.m_Pos.x, EdgeMod->m_End.x - width ); m_RealBoundaryBox.m_Pos.x = MIN( m_RealBoundaryBox.m_Pos.x, EdgeMod->m_End.x - width );
m_RealBoundaryBox.m_Pos.y = min( m_RealBoundaryBox.m_Pos.y, EdgeMod->m_Start.y - width ); m_RealBoundaryBox.m_Pos.y = MIN( m_RealBoundaryBox.m_Pos.y, EdgeMod->m_Start.y - width );
m_RealBoundaryBox.m_Pos.y = min( m_RealBoundaryBox.m_Pos.y, EdgeMod->m_End.y - width ); m_RealBoundaryBox.m_Pos.y = MIN( m_RealBoundaryBox.m_Pos.y, EdgeMod->m_End.y - width );
xmax = max( xmax, EdgeMod->m_Start.x + width ); xmax = MAX( xmax, EdgeMod->m_Start.x + width );
xmax = max( xmax, EdgeMod->m_End.x + width ); xmax = MAX( xmax, EdgeMod->m_End.x + width );
ymax = max( ymax, EdgeMod->m_Start.y + width ); ymax = MAX( ymax, EdgeMod->m_Start.y + width );
ymax = max( ymax, EdgeMod->m_End.y + width ); ymax = MAX( ymax, EdgeMod->m_End.y + width );
break; break;
} }
} }
...@@ -1060,10 +1064,10 @@ void MODULE::SetRectangleExinscrit( void ) ...@@ -1060,10 +1064,10 @@ void MODULE::SetRectangleExinscrit( void )
{ {
rayon = Pad->m_Rayon; rayon = Pad->m_Rayon;
cx = Pad->m_Pos.x; cy = Pad->m_Pos.y; cx = Pad->m_Pos.x; cy = Pad->m_Pos.y;
m_RealBoundaryBox.m_Pos.x = min( m_RealBoundaryBox.m_Pos.x, cx - rayon ); m_RealBoundaryBox.m_Pos.x = MIN( m_RealBoundaryBox.m_Pos.x, cx - rayon );
m_RealBoundaryBox.m_Pos.y = min( m_RealBoundaryBox.m_Pos.y, cy - rayon ); m_RealBoundaryBox.m_Pos.y = MIN( m_RealBoundaryBox.m_Pos.y, cy - rayon );
xmax = max( xmax, cx + rayon ); xmax = MAX( xmax, cx + rayon );
ymax = max( ymax, cy + rayon ); ymax = MAX( ymax, cy + rayon );
} }
m_RealBoundaryBox.SetWidth( xmax - m_RealBoundaryBox.m_Pos.x ); m_RealBoundaryBox.SetWidth( xmax - m_RealBoundaryBox.m_Pos.x );
......
...@@ -35,12 +35,12 @@ enum Mod_Attribut /* Attributs d'un module */ ...@@ -35,12 +35,12 @@ enum Mod_Attribut /* Attributs d'un module */
#define MODULE_is_PLACED 0x02 /* In autoplace: module automatically placed */ #define MODULE_is_PLACED 0x02 /* In autoplace: module automatically placed */
#define MODULE_to_PLACE 0x04 /* In autoplace: module waiting for autoplace */ #define MODULE_to_PLACE 0x04 /* In autoplace: module waiting for autoplace */
class MODULE : public EDA_BaseStruct class MODULE : public BOARD_ITEM
{ {
public: public:
wxPoint m_Pos; // Real coord on board wxPoint m_Pos; // Real coord on board
D_PAD* m_Pads; /* Pad list (linked list) */ D_PAD* m_Pads; /* Pad list (linked list) */
EDA_BaseStruct* m_Drawings; /* Graphic items list (linked list) */ BOARD_ITEM* m_Drawings; /* Graphic items list (linked list) */
Struct3D_Master* m_3D_Drawings; /* Pointeur sur la liste des elements de trace 3D*/ Struct3D_Master* m_3D_Drawings; /* Pointeur sur la liste des elements de trace 3D*/
TEXTE_MODULE* m_Reference; // texte reference du composant (U34, R18..) TEXTE_MODULE* m_Reference; // texte reference du composant (U34, R18..)
TEXTE_MODULE* m_Value; // texte valeur du composant (74LS00, 22K..) TEXTE_MODULE* m_Value; // texte valeur du composant (74LS00, 22K..)
...@@ -72,9 +72,9 @@ public: ...@@ -72,9 +72,9 @@ public:
MODULE( MODULE* module ); MODULE( MODULE* module );
~MODULE( void ); ~MODULE( void );
void Copy( MODULE* Module ); // Copy structure void Copy( MODULE* Module ); // Copy structure
MODULE* Next( void ) { return (MODULE*) Pnext; } MODULE* Next() { return (MODULE*) Pnext; }
void Set_Rectangle_Encadrement( void );/* mise a jour du rect d'encadrement void Set_Rectangle_Encadrement( void );/* mise a jour du rect d'encadrement
* en coord locales (orient 0 et origine = pos module) */ * en coord locales (orient 0 et origine = pos module) */
......
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
/* classe D_PAD : constructeur */ /* classe D_PAD : constructeur */
/*******************************/ /*******************************/
D_PAD::D_PAD( MODULE* parent ) : EDA_BaseStruct( parent, TYPEPAD ) D_PAD::D_PAD( MODULE* parent ) :
BOARD_ITEM( parent, TYPEPAD )
{ {
m_NumPadName = 0; m_NumPadName = 0;
m_Masque_Layer = CUIVRE_LAYER; m_Masque_Layer = CUIVRE_LAYER;
...@@ -520,7 +521,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int ...@@ -520,7 +521,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
/* Trace du symbole "No connect" ( / ou \ ou croix en X) si necessaire : */ /* Trace du symbole "No connect" ( / ou \ ou croix en X) si necessaire : */
if( m_Netname.IsEmpty() && DisplayOpt.DisplayPadNoConn ) if( m_Netname.IsEmpty() && DisplayOpt.DisplayPadNoConn )
{ {
dx0 = min( dx0, dy0 ); dx0 = MIN( dx0, dy0 );
int nc_color = BLUE; int nc_color = BLUE;
if( m_Masque_Layer & CMP_LAYER ) /* Trace forme \ */ if( m_Masque_Layer & CMP_LAYER ) /* Trace forme \ */
GRLine( &panel->m_ClipBox, DC, cx0 - dx0, cy0 - dx0, GRLine( &panel->m_ClipBox, DC, cx0 - dx0, cy0 - dx0,
...@@ -535,7 +536,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int ...@@ -535,7 +536,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
if( !frame->m_DisplayPadNum ) if( !frame->m_DisplayPadNum )
return; return;
dx = min( m_Size.x, m_Size.y ); /* dx = text size */ dx = MIN( m_Size.x, m_Size.y ); /* dx = text size */
if( (dx / zoom) > 12 ) /* size must be enought to draw 2 chars */ if( (dx / zoom) > 12 ) /* size must be enought to draw 2 chars */
{ {
wxString buffer; wxString buffer;
......
...@@ -20,7 +20,7 @@ class Pcb3D_GLCanvas; ...@@ -20,7 +20,7 @@ class Pcb3D_GLCanvas;
#define PAD_STACK 0x80 // bit 7 de .attrib (flag) #define PAD_STACK 0x80 // bit 7 de .attrib (flag)
/* Definition type Structure d'un pad */ /* Definition type Structure d'un pad */
class D_PAD : public EDA_BaseStruct class D_PAD : public BOARD_ITEM
{ {
public: public:
union union
......
...@@ -15,15 +15,15 @@ ...@@ -15,15 +15,15 @@
/* class TEXTE_PCB */ /* class TEXTE_PCB */
/*******************/ /*******************/
TEXTE_PCB::TEXTE_PCB( EDA_BaseStruct* parent ) : TEXTE_PCB::TEXTE_PCB( BOARD_ITEM* parent ) :
EDA_BaseStruct( parent, TYPETEXTE ), BOARD_ITEM( parent, TYPETEXTE ),
EDA_TextStruct() EDA_TextStruct()
{ {
} }
/* Destructeur */ /* Destructeur */
TEXTE_PCB:: ~TEXTE_PCB( void ) TEXTE_PCB:: ~TEXTE_PCB()
{ {
} }
...@@ -59,7 +59,7 @@ void TEXTE_PCB::UnLink( void ) ...@@ -59,7 +59,7 @@ void TEXTE_PCB::UnLink( void )
} }
else /* Le chainage arriere pointe sur la structure "Pere" */ else /* Le chainage arriere pointe sur la structure "Pere" */
{ {
( (BOARD*) Pback )->m_Drawings = Pnext; ( (BOARD*) Pback )->m_Drawings = (BOARD_ITEM*) Pnext;
} }
} }
......
...@@ -6,25 +6,25 @@ ...@@ -6,25 +6,25 @@
#include "base_struct.h" #include "base_struct.h"
class TEXTE_PCB : public EDA_BaseStruct, public EDA_TextStruct class TEXTE_PCB : public BOARD_ITEM, public EDA_TextStruct
{ {
public: public:
TEXTE_PCB(EDA_BaseStruct * parent); TEXTE_PCB( BOARD_ITEM* parent );
TEXTE_PCB(TEXTE_PCB * textepcb); TEXTE_PCB( TEXTE_PCB* textepcb );
~TEXTE_PCB(void); ~TEXTE_PCB();
/* supprime du chainage la structure Struct */ /* supprime du chainage la structure Struct */
void UnLink( void ); void UnLink( void );
/* duplicate structure */ /* duplicate structure */
void Copy(TEXTE_PCB * source); void Copy( TEXTE_PCB* source );
void Draw(WinEDA_DrawPanel * panel, wxDC * DC, void Draw( WinEDA_DrawPanel * panel, wxDC * DC,
const wxPoint & offset, int DrawMode); const wxPoint & offset, int DrawMode );
// File Operations: // File Operations:
int ReadTextePcbDescr(FILE * File, int * LineNum); int ReadTextePcbDescr( FILE* File, int* LineNum );
int WriteTextePcbDescr(FILE * File); int WriteTextePcbDescr( FILE* File );
/** /**
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
/* Constructeur de TEXTE_MODULE */ /* Constructeur de TEXTE_MODULE */
TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) : TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) :
EDA_BaseStruct( parent, TYPETEXTEMODULE ) BOARD_ITEM( parent, TYPETEXTEMODULE )
{ {
MODULE* Module = (MODULE*) m_Parent; MODULE* Module = (MODULE*) m_Parent;
...@@ -41,18 +41,27 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) : ...@@ -41,18 +41,27 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) :
m_Orient = 0; /* en 1/10 degre */ m_Orient = 0; /* en 1/10 degre */
m_Miroir = 1; // Mode normal (pas de miroir) m_Miroir = 1; // Mode normal (pas de miroir)
m_Unused = 0; m_Unused = 0;
m_Layer = SILKSCREEN_N_CMP;
SetLayer( SILKSCREEN_N_CMP );
if( Module && (Module->m_StructType == TYPEMODULE) ) if( Module && (Module->m_StructType == TYPEMODULE) )
{ {
m_Pos = Module->m_Pos; m_Pos = Module->m_Pos;
m_Layer = Module->m_Layer;
if( Module->m_Layer == CUIVRE_N ) int moduleLayer = Module->GetLayer();
m_Layer = SILKSCREEN_N_CU;
if( Module->m_Layer == CMP_N ) if( moduleLayer == CUIVRE_N )
m_Layer = SILKSCREEN_N_CMP; SetLayer( SILKSCREEN_N_CU );
if( (Module->m_Layer == SILKSCREEN_N_CU) else if( moduleLayer == CMP_N )
|| (Module->m_Layer == ADHESIVE_N_CU) || (Module->m_Layer == CUIVRE_N) ) SetLayer( SILKSCREEN_N_CMP );
else
SetLayer( moduleLayer );
if( moduleLayer == SILKSCREEN_N_CU
|| moduleLayer == ADHESIVE_N_CU
|| moduleLayer == CUIVRE_N )
{
m_Miroir = 0; m_Miroir = 0;
}
} }
} }
...@@ -68,7 +77,7 @@ void TEXTE_MODULE::Copy( TEXTE_MODULE* source ) // copy structure ...@@ -68,7 +77,7 @@ void TEXTE_MODULE::Copy( TEXTE_MODULE* source ) // copy structure
return; return;
m_Pos = source->m_Pos; m_Pos = source->m_Pos;
m_Layer = source->m_Layer; SetLayer( source->GetLayer() );
m_Miroir = source->m_Miroir; // vue normale / miroir m_Miroir = source->m_Miroir; // vue normale / miroir
m_NoShow = source->m_NoShow; // 0: visible 1: invisible m_NoShow = source->m_NoShow; // 0: visible 1: invisible
...@@ -97,7 +106,7 @@ void TEXTE_MODULE::UnLink( void ) ...@@ -97,7 +106,7 @@ void TEXTE_MODULE::UnLink( void )
} }
else /* Le chainage arriere pointe sur la structure "Pere" */ else /* Le chainage arriere pointe sur la structure "Pere" */
{ {
( (MODULE*) Pback )->m_Drawings = Pnext; ( (MODULE*) Pback )->m_Drawings = (BOARD_ITEM*) Pnext;
} }
} }
...@@ -245,11 +254,12 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, wxPoint offset, int ...@@ -245,11 +254,12 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, wxPoint offset, int
pos.x, pos.y + anchor_size, 0, g_AnchorColor ); pos.x, pos.y + anchor_size, 0, g_AnchorColor );
} }
color = g_DesignSettings.m_LayerColor[Module->m_Layer]; color = g_DesignSettings.m_LayerColor[Module->GetLayer()];
if( Module && Module->m_Layer == CUIVRE_N ) if( Module && Module->GetLayer() == CUIVRE_N )
color = g_ModuleTextCUColor; color = g_ModuleTextCUColor;
if( Module && Module->m_Layer == CMP_N )
else if( Module && Module->GetLayer() == CMP_N )
color = g_ModuleTextCMPColor; color = g_ModuleTextCMPColor;
if( (color & ITEM_NOT_SHOW) != 0 ) if( (color & ITEM_NOT_SHOW) != 0 )
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#define TEXT_is_DIVERS 2 #define TEXT_is_DIVERS 2
class TEXTE_MODULE : public EDA_BaseStruct class TEXTE_MODULE : public BOARD_ITEM
{ {
public: public:
int m_Width; int m_Width;
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
/* Constructeur des classes type pistes, vias et zones */ /* Constructeur des classes type pistes, vias et zones */
TRACK::TRACK( EDA_BaseStruct* StructFather, DrawStructureType idtype ) : TRACK::TRACK( BOARD_ITEM* StructFather, DrawStructureType idtype ) :
EDA_BaseLineStruct( StructFather, idtype ) BOARD_ITEM( StructFather, idtype )
{ {
m_Shape = S_SEGMENT; m_Shape = S_SEGMENT;
start = end = NULL; start = end = NULL;
...@@ -35,13 +35,13 @@ TRACK::TRACK( EDA_BaseStruct* StructFather, DrawStructureType idtype ) : ...@@ -35,13 +35,13 @@ TRACK::TRACK( EDA_BaseStruct* StructFather, DrawStructureType idtype ) :
SEGZONE::SEGZONE( EDA_BaseStruct* StructFather ) : SEGZONE::SEGZONE( BOARD_ITEM* StructFather ) :
TRACK( StructFather, TYPEZONE ) TRACK( StructFather, TYPEZONE )
{ {
} }
SEGVIA::SEGVIA( EDA_BaseStruct* StructFather ) : SEGVIA::SEGVIA( BOARD_ITEM* StructFather ) :
TRACK( StructFather, TYPEVIA ) TRACK( StructFather, TYPEVIA )
{ {
} }
...@@ -50,7 +50,7 @@ SEGVIA::SEGVIA( EDA_BaseStruct* StructFather ) : ...@@ -50,7 +50,7 @@ SEGVIA::SEGVIA( EDA_BaseStruct* StructFather ) :
/* Copy constructor */ /* Copy constructor */
TRACK::TRACK( const TRACK& Source ) : TRACK::TRACK( const TRACK& Source ) :
EDA_BaseLineStruct( Source.m_Parent, (DrawStructureType)Source.m_StructType ) BOARD_ITEM( (const BOARD_ITEM&) Source )
{ {
m_StructType = Source.m_StructType; m_StructType = Source.m_StructType;
m_Shape = Source.m_Shape; m_Shape = Source.m_Shape;
...@@ -235,14 +235,6 @@ void SEGVIA::ReturnLayerPair( int* top_layer, int* bottom_layer ) ...@@ -235,14 +235,6 @@ void SEGVIA::ReturnLayerPair( int* top_layer, int* bottom_layer )
} }
/************************/
TRACK* TRACK::Next( void )
/************************/
{
return (TRACK*) Pnext;
}
/* supprime du chainage la structure Struct /* supprime du chainage la structure Struct
* les structures arrieres et avant sont chainees directement * les structures arrieres et avant sont chainees directement
*/ */
......
...@@ -19,12 +19,19 @@ ...@@ -19,12 +19,19 @@
/***/ /***/
class TRACK : public EDA_BaseLineStruct class TRACK : public BOARD_ITEM
{ {
public: public:
int m_Width; // 0 = line, > 0 = tracks, bus ...
wxPoint m_Start; // Line start point
wxPoint m_End; // Line end point
int m_Shape; // vias: shape and type, Track = shape.. int m_Shape; // vias: shape and type, Track = shape..
int m_Drill; // for vias: via drill (- 1 for default value) int m_Drill; // for vias: via drill (- 1 for default value)
EDA_BaseStruct* start, * end; // pointers on a connected item (pad or track)
BOARD_ITEM* start; // pointers on a connected item (pad or track)
BOARD_ITEM* end;
int m_NetCode; // Net number int m_NetCode; // Net number
int m_Sous_Netcode; /* In rastnest routines : for the current net, int m_Sous_Netcode; /* In rastnest routines : for the current net,
* block number (number common to the current connected items found) */ * block number (number common to the current connected items found) */
...@@ -33,15 +40,12 @@ public: ...@@ -33,15 +40,12 @@ public:
int m_Param; // Auxiliary variable ( used in some computations ) int m_Param; // Auxiliary variable ( used in some computations )
public: public:
TRACK( EDA_BaseStruct* StructFather, DrawStructureType idtype = TYPETRACK ); TRACK( BOARD_ITEM* StructFather, DrawStructureType idtype = TYPETRACK );
TRACK( const TRACK& track ); TRACK( const TRACK& track );
TRACK* Next( void ); // Retourne le chainage avant TRACK* Next() { return (TRACK*) Pnext; }
TRACK* Back( void ) // Retourne le chainage avant TRACK* Back() { return (TRACK*) Pback; }
{
return (TRACK*) Pback;
}
/* supprime du chainage la structure Struct */ /* supprime du chainage la structure Struct */
...@@ -122,7 +126,7 @@ public: ...@@ -122,7 +126,7 @@ public:
class SEGZONE : public TRACK class SEGZONE : public TRACK
{ {
public: public:
SEGZONE( EDA_BaseStruct* StructFather ); SEGZONE( BOARD_ITEM* StructFather );
#if defined(DEBUG) #if defined(DEBUG)
/** /**
...@@ -141,7 +145,7 @@ public: ...@@ -141,7 +145,7 @@ public:
class SEGVIA : public TRACK class SEGVIA : public TRACK
{ {
public: public:
SEGVIA( EDA_BaseStruct* StructFather ); SEGVIA( BOARD_ITEM* StructFather );
bool IsViaOnLayer( int layer ); bool IsViaOnLayer( int layer );
void SetLayerPair( int top_layer, int bottom_layer ); void SetLayerPair( int top_layer, int bottom_layer );
void ReturnLayerPair( int* top_layer, int* bottom_layer ); void ReturnLayerPair( int* top_layer, int* bottom_layer );
......
...@@ -35,7 +35,7 @@ void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC ) ...@@ -35,7 +35,7 @@ void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
/**********************/ /**********************/
/* Classe EDGE_ZONE: constructeur */ /* Classe EDGE_ZONE: constructeur */
EDGE_ZONE::EDGE_ZONE( EDA_BaseStruct* parent ) : EDGE_ZONE::EDGE_ZONE( BOARD_ITEM* parent ) :
DRAWSEGMENT( parent, TYPEEDGEZONE ) DRAWSEGMENT( parent, TYPEEDGEZONE )
{ {
} }
...@@ -52,8 +52,8 @@ EDGE_ZONE:: ~EDGE_ZONE( void ) ...@@ -52,8 +52,8 @@ EDGE_ZONE:: ~EDGE_ZONE( void )
/**********************/ /**********************/
/* Classe DRAWSEGMENT: constructeur */ /* Classe DRAWSEGMENT: constructeur */
DRAWSEGMENT::DRAWSEGMENT( EDA_BaseStruct* StructFather, DrawStructureType idtype ) : DRAWSEGMENT::DRAWSEGMENT( BOARD_ITEM* StructFather, DrawStructureType idtype ) :
EDA_BaseLineStruct( StructFather, idtype ) BOARD_ITEM( StructFather, idtype )
{ {
m_Flags = m_Shape = m_Type = m_Angle = 0; m_Flags = m_Shape = m_Type = m_Angle = 0;
} }
...@@ -76,7 +76,7 @@ void DRAWSEGMENT::UnLink( void ) ...@@ -76,7 +76,7 @@ void DRAWSEGMENT::UnLink( void )
} }
else /* Le chainage arriere pointe sur la structure "Pere" */ else /* Le chainage arriere pointe sur la structure "Pere" */
{ {
( (BOARD*) Pback )->m_Drawings = Pnext; ( (BOARD*) Pback )->m_Drawings = (BOARD_ITEM*) Pnext;
} }
} }
...@@ -262,8 +262,8 @@ bool DRAWSEGMENT::HitTest( const wxPoint& ref_pos ) ...@@ -262,8 +262,8 @@ bool DRAWSEGMENT::HitTest( const wxPoint& ref_pos )
/* Classe MARQUEUR */ /* Classe MARQUEUR */
/*******************/ /*******************/
MARQUEUR::MARQUEUR( EDA_BaseStruct* StructFather ) : MARQUEUR::MARQUEUR( BOARD_ITEM* StructFather ) :
EDA_BaseStruct( StructFather, TYPEMARQUEUR ) BOARD_ITEM( StructFather, TYPEMARQUEUR )
{ {
m_Bitmap = NULL; m_Bitmap = NULL;
m_Type = 0; m_Type = 0;
...@@ -291,7 +291,7 @@ void MARQUEUR::UnLink( void ) ...@@ -291,7 +291,7 @@ void MARQUEUR::UnLink( void )
} }
else /* Le chainage arriere pointe sur la structure "Pere" */ else /* Le chainage arriere pointe sur la structure "Pere" */
{ {
( (BOARD*) Pback )->m_Drawings = Pnext; ( (BOARD*) Pback )->m_Drawings = (BOARD_ITEM*) Pnext;
} }
} }
......
...@@ -379,7 +379,7 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ) ...@@ -379,7 +379,7 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC )
if( PtSegm->m_StructType != pt_aux->m_StructType ) if( PtSegm->m_StructType != pt_aux->m_StructType )
continue; continue;
if( PtSegm->m_Layer != pt_aux->m_Layer ) if( PtSegm->GetLayer() != pt_aux->GetLayer() )
continue; continue;
if( PtSegm->m_NetCode != pt_aux->m_NetCode ) if( PtSegm->m_NetCode != pt_aux->m_NetCode )
break; break;
...@@ -587,7 +587,7 @@ static TRACK* AlignSegment( BOARD* Pcb, TRACK* pt_ref, TRACK* pt_segm, int extre ...@@ -587,7 +587,7 @@ static TRACK* AlignSegment( BOARD* Pcb, TRACK* pt_ref, TRACK* pt_segm, int extre
{ {
/* Ce ne doit pas etre sur un pad */ /* Ce ne doit pas etre sur un pad */
if( Fast_Locate_Pad_Connecte( Pcb, pt_ref->m_Start, if( Fast_Locate_Pad_Connecte( Pcb, pt_ref->m_Start,
g_TabOneLayerMask[pt_ref->m_Layer] ) ) g_TabOneLayerMask[pt_ref->GetLayer()] ) )
return NULL; return NULL;
if( (pt_ref->m_Start.x == pt_segm->m_Start.x) if( (pt_ref->m_Start.x == pt_segm->m_Start.x)
...@@ -605,7 +605,7 @@ static TRACK* AlignSegment( BOARD* Pcb, TRACK* pt_ref, TRACK* pt_segm, int extre ...@@ -605,7 +605,7 @@ static TRACK* AlignSegment( BOARD* Pcb, TRACK* pt_ref, TRACK* pt_segm, int extre
else /* extremite == END */ else /* extremite == END */
{ {
/* Ce ne doit pas etre sur un pad */ /* Ce ne doit pas etre sur un pad */
if( Fast_Locate_Pad_Connecte( Pcb, pt_ref->m_End, g_TabOneLayerMask[pt_ref->m_Layer] ) ) if( Fast_Locate_Pad_Connecte( Pcb, pt_ref->m_End, g_TabOneLayerMask[pt_ref->GetLayer()] ) )
return NULL; return NULL;
if( pt_ref->m_End == pt_segm->m_Start ) if( pt_ref->m_End == pt_segm->m_Start )
......
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2004-2007 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#if defined(DEBUG)
#include "collectors.h"
#include "pcbnew.h" // class BOARD
/* This module contains out of line member functions for classes given in
collectors.h. Those classes augment the functionality of class WinEDA_PcbFrame.
*/
// see collectors.h
const KICAD_T ARROWCOLLECTOR::AllBoardItems[] = {
TYPETEXTE,
TYPEDRAWSEGMENT,
TYPECOTATION,
TYPEVIA,
TYPETRACK,
TYPEPAD,
TYPETEXTEMODULE,
TYPEMODULE,
EOT
};
/**
* Function Inspect
* is the examining function within the INSPECTOR which is passed to the
* Iterate function. Searches and collects all the objects that the old
* function PcbGeneralLocateAndDisplay() would find, except that it keeps all
* that it finds and does not do any displaying.
*
* @param testItem An EDA_BaseStruct to examine.
* @param notUsed The const void* testData.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE;
*/
SEARCH_RESULT ARROWCOLLECTOR::Inspect( EDA_BaseStruct* testItem, const void* notUsed )
{
BOARD_ITEM* item = (BOARD_ITEM*) testItem;
switch( item->m_StructType )
{
case TYPEPAD:
case TYPEVIA:
/*
if( item->IsOnOneOfTheseLayers( m_LayerMask ) )
{
if( item->HitTest( refPos ) )
Append2nd( testItem );
}
*/
break;
case TYPETRACK:
case TYPETEXTE:
case TYPEDRAWSEGMENT:
case TYPECOTATION:
case TYPETEXTEMODULE:
case TYPEMODULE:
if( item->GetLayer() == m_PreferredLayer )
{
if( item->HitTest( m_RefPos ) )
Append( item );
}
/*
else if( item->IsOnOneOfTheseLayers( m_LayerMask ) )
{
if( item->HitTest( m_RefPos ) )
Append2nd( item );
}
*/
break;
default:
; // nothing
}
return SEARCH_CONTINUE;
}
// see collectors.h
void ARROWCOLLECTOR::Scan( BOARD* board, const wxPoint& refPos,
int aPreferredLayer, int aLayerMask )
{
Empty(); // empty the collection, primary criteria list
Empty2nd(); // empty the collection, secondary criteria list
/* remember where the snapshot was taken from and pass refPos to
the Inspect() function.
*/
SetRefPos( refPos );
// visit the board with the INSPECTOR (me).
board->Visit( this, // INSPECTOR* inspector
NULL, // const void* testData, not used here
m_ScanTypes);
SetTimeNow(); // when snapshot was taken
// @todo: append 2nd list onto end of the first "list"
Empty2nd();
}
#endif // DEBUG
//EOF
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2004-2007 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef COLLECTORS_H
#define COLLECTORS_H
/* This module contains a number of COLLECTOR implementations which are used
to augment the functionality of class WinEDA_PcbFrame.
*/
#include "class_collector.h"
class RAT1COLLECTOR : public COLLECTOR
{
;
};
/**
* Class ARROWCOLLECTOR
* is intended for use when the right click button is pressed, or when the
* plain "arrow" tool is in effect. This class can be used by window classes
* such as WinEDA_PcbFrame.
*
* Philosophy: this class knows nothing of the context in which as BOARD is used
* and that means it knows nothing about which layers are visible or current,
* but can handle those concerns by the SetPreferredLayer() function and the
* SetLayerMask() fuction.
*/
class ARROWCOLLECTOR : public COLLECTOR
{
/**
* A place to hold collected objects which don't match precisely the search
* criteria, but would be acceptable if nothing else is found.
* "2nd" choice, which will be appended to the end of COLLECTOR's prime
* "list" at the end of the search.
*/
std::vector<EDA_BaseStruct*> list2nd;
/**
* A bit-mapped layer mask that defines any layers which are acceptable
* on a secondary search criterion basis.
*/
int m_LayerMask;
public:
/// A scan list for all editable board items, like PcbGeneralLocateAndDisplay()
static const KICAD_T AllBoardItems[];
/**
* Constructor ARROWCOLLECTOR
*/
ARROWCOLLECTOR()
{
m_LayerMask = 0;
SetScanTypes( AllBoardItems );
}
void Empty2nd()
{
list2nd.clear();
}
void Append2nd( EDA_BaseStruct* item )
{
list2nd.push_back( item );
}
/**
* Function SetLayerMask
* takes a bit-mapped layer mask and records it. During the scan/search,
* this is used as a secondary criterion. That is, if there is no direct
* layer match with COLLECTOR::m_PreferredLayer (the primary criterion),
* then an object on any layer given in this bit-map is recorded as a
* second choice object if it also HitTest()s true.
*
* @param aLayerMask A layer mask which has bits in it indicating which
* layers are acceptable. Caller must pay attention to which layers are
* visible, selected, etc. All those concerns are handled outside this
* class, as stated in the class Philosophy above.
*/
void SetLayerMask( int aLayerMask )
{
m_LayerMask = aLayerMask;
}
/**
* Function Inspect
* is the examining function within the INSPECTOR which is passed to the
* Iterate function.
*
* @param testItem An EDA_BaseStruct to examine.
* @param testData is not used in this class.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE;
*/
SEARCH_RESULT Inspect( EDA_BaseStruct* testItem, const void* testData );
/**
* Function Scan
* scans a BOARD using this class's Inspector method, which does the collection.
* @param board A BOARD to scan.
* @param refPos A wxPoint to use in hit-testing.
*/
void Scan( BOARD* board, const wxPoint& refPos, int aPreferredLayer, int aLayerMask );
};
#endif // COLLECTORS_H
This diff is collapsed.
This diff is collapsed.
...@@ -68,7 +68,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* Track ) ...@@ -68,7 +68,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* Track )
delete Track; delete Track;
g_TrackSegmentCount--; g_TrackSegmentCount--;
if( g_CurrentTrackSegment && (g_CurrentTrackSegment->m_StructType != TYPEVIA) ) if( g_CurrentTrackSegment && (g_CurrentTrackSegment->m_StructType != TYPEVIA) )
previous_layer = g_CurrentTrackSegment->m_Layer; previous_layer = g_CurrentTrackSegment->GetLayer();
} }
if( g_CurrentTrackSegment ) if( g_CurrentTrackSegment )
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -915,7 +915,7 @@ wxString msg; ...@@ -915,7 +915,7 @@ wxString msg;
float Xscale = (float) (SheetSize.x - (marge*2)) / dX; float Xscale = (float) (SheetSize.x - (marge*2)) / dX;
float Yscale = (float) (SheetSize.y * 0.6 - (marge*2)) / dY; float Yscale = (float) (SheetSize.y * 0.6 - (marge*2)) / dY;
scale_x = scale_y = min(Xscale, Yscale); scale_x = scale_y = MIN(Xscale, Yscale);
g_PlotOffset.x = - (SheetSize.x/2) + g_PlotOffset.x = - (SheetSize.x/2) +
(int)(BoardCentre.x * scale_x) + marge; (int)(BoardCentre.x * scale_x) + marge;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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