Commit 128521f0 authored by dickelbeck's avatar dickelbeck

2nd of 3 commits for DrcDialog rework

parent cea3f06a
...@@ -4,10 +4,25 @@ Started 2007-June-11 ...@@ -4,10 +4,25 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2007-Nov-30 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+pcbnew
* added virtual GetPosition() to BOARD_ITEM and derivatives.
* added classes DRC, REPORT_ISSUE, DRC_ITEM and rearranged drc.cpp entirely
to comprize the DRC class. The result has finer granularity of functions
and each is fairly well documented in English, see drc_stuff.h.
Keeping old stuff commented out at bottom of drc.cpp until some more usage
and testing is done.
* Made the DRC dialog modeless, so it can sit off to the side while the MARKER
are inspected one by one.
Need another 4-8 hours or so to finish the actual dialog display, remove
debug statements and finish testing.
2007-Nov-29 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2007-Nov-29 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+pcbnew: +pcbnew:
Removed a bug (function block() ) which crashes pcbnew when erasing a zone by block delete Removed a bug (function block() ) which crashes pcbnew when erasing a zone by block delete
2007-Nov-27 UPDATE Dick Hollenbeck <dick@softplc.com> 2007-Nov-27 UPDATE Dick Hollenbeck <dick@softplc.com>
...@@ -50,7 +65,7 @@ email address. ...@@ -50,7 +65,7 @@ email address.
2007-Nov-15 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2007-Nov-15 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+pcbnew: +pcbnew:
Removed a bug (function Delete_Zone() ) which crashes pcbnew when erasing a zone by popup menu Removed a bug (function Delete_Zone() ) which crashes pcbnew when erasing a zone by popup menu
2007-Nov-13 UPDATE Geoff Harland <gharlandau@yahoo.com.au> 2007-Nov-13 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
......
...@@ -456,6 +456,13 @@ public: ...@@ -456,6 +456,13 @@ public:
BOARD_ITEM* Back() const { return (BOARD_ITEM*) Pback; } BOARD_ITEM* Back() const { return (BOARD_ITEM*) Pback; }
BOARD_ITEM* GetParent() const { return (BOARD_ITEM*) m_Parent; } BOARD_ITEM* GetParent() const { return (BOARD_ITEM*) m_Parent; }
/**
* Function GetPosition
* returns the position of this object.
* @return wxPoint& - The position of this object, non-const so it
* can be changed
*/
virtual wxPoint& GetPosition() = 0;
/** /**
* Function GetLayer * Function GetLayer
......
...@@ -199,8 +199,11 @@ enum DisplayViaMode { ...@@ -199,8 +199,11 @@ enum DisplayViaMode {
class BOARD : public BOARD_ITEM class BOARD : public BOARD_ITEM
{ {
friend class WinEDA_PcbFrame; friend class WinEDA_PcbFrame;
private: private:
std::vector<MARKER*> m_markers; ///< MARKERs which we own by pointer std::vector<MARKER*> m_markers; ///< MARKERs for clearance problems, owned by pointer
// std::vector<MARKER*> m_markersUnconnected; ///< MARKERs for unconnected problems, owned by pointer
public: public:
WinEDA_BasePcbFrame* m_PcbFrame; // Window de visualisation WinEDA_BasePcbFrame* m_PcbFrame; // Window de visualisation
...@@ -233,6 +236,14 @@ public: ...@@ -233,6 +236,14 @@ public:
BOARD( EDA_BaseStruct* StructFather, WinEDA_BasePcbFrame* frame ); BOARD( EDA_BaseStruct* StructFather, WinEDA_BasePcbFrame* frame );
~BOARD(); ~BOARD();
/**
* Function GetPosition
* is here to satisfy BOARD_ITEM's requirements, but this implementation
* is a dummy.
* @return const wxPoint& of (0,0)
*/
wxPoint& GetPosition();
/* supprime du chainage la structure Struct */ /* supprime du chainage la structure Struct */
void UnLink(); void UnLink();
...@@ -275,7 +286,16 @@ public: ...@@ -275,7 +286,16 @@ public:
int GetNumSegmTrack(); int GetNumSegmTrack();
int GetNumSegmZone(); int GetNumSegmZone();
int GetNumNoconnect(); // retourne le nombre de connexions manquantes int GetNumNoconnect(); // retourne le nombre de connexions manquantes
int GetNumRatsnests(); // retourne le nombre de chevelus
/**
* Function GetNumRatsnests
* @return int - The number of rats
*/
int GetNumRatsnests()
{
return m_NbLinks;
}
int GetNumNodes(); // retourne le nombre de pads a netcode > 0 int GetNumNodes(); // retourne le nombre de pads a netcode > 0
// Calcul du rectangle d'encadrement: // Calcul du rectangle d'encadrement:
...@@ -407,7 +427,18 @@ public: ...@@ -407,7 +427,18 @@ public:
DRAWSEGMENT( BOARD_ITEM* StructFather, KICAD_T idtype = TYPEDRAWSEGMENT ); DRAWSEGMENT( BOARD_ITEM* StructFather, KICAD_T idtype = TYPEDRAWSEGMENT );
~DRAWSEGMENT(); ~DRAWSEGMENT();
// Read/write data
/**
* Function GetPosition
* returns the position of this object.
* Required by pure virtual BOARD_ITEM::GetPosition()
* @return const wxPoint& - The position of this object.
*/
wxPoint& GetPosition()
{
return m_Start;
}
/** /**
* Function Save * Function Save
......
...@@ -101,6 +101,7 @@ class Ki_PageDescr; ...@@ -101,6 +101,7 @@ class Ki_PageDescr;
class Ki_HotkeyInfo; class Ki_HotkeyInfo;
class GENERAL_COLLECTOR; class GENERAL_COLLECTOR;
class GENERAL_COLLECTORS_GUIDE; class GENERAL_COLLECTORS_GUIDE;
class DRC;
enum id_librarytype { enum id_librarytype {
...@@ -574,6 +575,9 @@ private: ...@@ -574,6 +575,9 @@ private:
bool m_SelViaSizeBox_Changed; bool m_SelViaSizeBox_Changed;
wxMenu* m_FilesMenu; wxMenu* m_FilesMenu;
DRC* m_drc; ///< the DRC controller, see drc.cpp
// we'll use lower case function names for private member functions. // we'll use lower case function names for private member functions.
void createPopUpMenuForFootprints( MODULE* aModule, wxMenu* aPopMenu ); void createPopUpMenuForFootprints( MODULE* aModule, wxMenu* aPopMenu );
void createPopUpMenuForFpTexts( TEXTE_MODULE* aText, wxMenu* aPopMenu ); void createPopUpMenuForFpTexts( TEXTE_MODULE* aText, wxMenu* aPopMenu );
...@@ -655,7 +659,6 @@ public: ...@@ -655,7 +659,6 @@ public:
MODULE* ListAndSelectModuleName(); MODULE* ListAndSelectModuleName();
void Liste_Equipot( wxCommandEvent& event ); void Liste_Equipot( wxCommandEvent& event );
void Swap_Layers( wxCommandEvent& event ); void Swap_Layers( wxCommandEvent& event );
int Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone );
void Install_Test_DRC_Frame( wxDC* DC ); void Install_Test_DRC_Frame( wxDC* DC );
void Trace_Pcb( wxDC* DC, int mode ); void Trace_Pcb( wxDC* DC, int mode );
...@@ -719,6 +722,8 @@ public: ...@@ -719,6 +722,8 @@ public:
bool PlaceDraggedTrackSegment( TRACK* Track, wxDC* DC ); bool PlaceDraggedTrackSegment( TRACK* Track, wxDC* DC );
void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC ); void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC );
void SwitchLayer( wxDC* DC, int layer ); void SwitchLayer( wxDC* DC, int layer );
int Add_45_degrees_Segment( wxDC* DC, TRACK* pt_segm );
bool Genere_Pad_Connexion( wxDC* DC, int layer );
// zone handling // zone handling
EDGE_ZONE* Del_SegmEdgeZone( wxDC* DC, EDGE_ZONE* edge_zone ); EDGE_ZONE* Del_SegmEdgeZone( wxDC* DC, EDGE_ZONE* edge_zone );
......
...@@ -865,22 +865,25 @@ float WinEDA_PcbFrame::Compute_Ratsnest_PlaceModule( wxDC* DC ) ...@@ -865,22 +865,25 @@ float WinEDA_PcbFrame::Compute_Ratsnest_PlaceModule( wxDC* DC )
CHEVELU* pt_local_chevelu; CHEVELU* pt_local_chevelu;
int ii; int ii;
float cout, icout; float cout, icout;
int ox, oy, fx, fy, dx, dy; int ox, oy;
int fx, fy;
int dx, dy;
if( (m_Pcb->m_Status_Pcb & CHEVELU_LOCAL_OK) == 0 ) if( (m_Pcb->m_Status_Pcb & CHEVELU_LOCAL_OK) == 0 )
return -1; return -1;
pt_local_chevelu = local_liste_chevelu; pt_local_chevelu = local_liste_chevelu;
ii = nb_local_chevelu; cout = 0; ii = nb_local_chevelu;
cout = 0;
while( ii-- > 0 ) while( ii-- > 0 )
{ {
if( !(pt_local_chevelu->status & LOCAL_CHEVELU) ) if( !(pt_local_chevelu->status & LOCAL_CHEVELU) )
{ {
ox = pt_local_chevelu->pad_start->m_Pos.x - g_Offset_Module.x; ox = pt_local_chevelu->pad_start->GetPosition().x - g_Offset_Module.x;
oy = pt_local_chevelu->pad_start->m_Pos.y - g_Offset_Module.y; oy = pt_local_chevelu->pad_start->GetPosition().y - g_Offset_Module.y;
fx = pt_local_chevelu->pad_end->m_Pos.x; fx = pt_local_chevelu->pad_end->GetPosition().x;
fy = pt_local_chevelu->pad_end->m_Pos.y; fy = pt_local_chevelu->pad_end->GetPosition().y;
if( AutoPlaceShowAll ) if( AutoPlaceShowAll )
{ {
...@@ -889,12 +892,18 @@ float WinEDA_PcbFrame::Compute_Ratsnest_PlaceModule( wxDC* DC ) ...@@ -889,12 +892,18 @@ float WinEDA_PcbFrame::Compute_Ratsnest_PlaceModule( wxDC* DC )
} }
/* Evaluation du cout du chevelu: */ /* Evaluation du cout du chevelu: */
dx = fx - ox; dy = fy - oy; dx = fx - ox;
dx = abs( dx ); dy = abs( dy ); dy = fy - oy;
dx = abs( dx );
dy = abs( dy );
if( dx < dy ) if( dx < dy )
EXCHG( dx, dy );/* dx >= dy */ EXCHG( dx, dy );/* dx >= dy */
/* cout de la distance: */ /* cout de la distance: */
icout = (float) dx * dx; icout = (float) dx * dx;
/* cout de l'inclinaison */ /* cout de l'inclinaison */
icout += 3 * (float) dy * dy; icout += 3 * (float) dy * dy;
icout = sqrt( icout ); icout = sqrt( icout );
......
...@@ -55,9 +55,10 @@ public: ...@@ -55,9 +55,10 @@ public:
void SetNet( int aNetCode ) void SetNet( int aNetCode )
{ {
m_NetCode = aNetCode; m_NetCode = aNetCode;
}; }
}; };
/****************************************************************/ /****************************************************************/
/* description d'un point de piste pour le suivi des connexions */ /* description d'un point de piste pour le suivi des connexions */
/****************************************************************/ /****************************************************************/
...@@ -81,9 +82,6 @@ enum StatusPcbFlags { ...@@ -81,9 +82,6 @@ enum StatusPcbFlags {
DO_NOT_SHOW_GENERAL_RASTNEST = 0x20 /* Do not display the general rastnest (used in module moves) */ DO_NOT_SHOW_GENERAL_RASTNEST = 0x20 /* Do not display the general rastnest (used in module moves) */
}; };
#define OK_DRC 0
#define BAD_DRC 1
/* Commandes d'autoplacement / autorouage possibles */ /* Commandes d'autoplacement / autorouage possibles */
enum CommandOpt { enum CommandOpt {
...@@ -170,4 +168,5 @@ eda_global BOARDHEAD Board; /* 2-sided board */ ...@@ -170,4 +168,5 @@ eda_global BOARDHEAD Board; /* 2-sided board */
#include "ar_protos.h" #include "ar_protos.h"
#endif /* AUTOROUT_H */ #endif // AUTOROUT_H
...@@ -471,8 +471,8 @@ void MoveMarkedItems( MODULE* module, wxPoint offset ) ...@@ -471,8 +471,8 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
{ {
if( pad->m_Selected == 0 ) if( pad->m_Selected == 0 )
continue; continue;
pad->m_Pos.x += offset.x; pad->GetPosition().x += offset.x;
pad->m_Pos.y += offset.y; pad->GetPosition().y += offset.y;
pad->m_Pos0.x += offset.x; pad->m_Pos0.x += offset.x;
pad->m_Pos0.y += offset.y; pad->m_Pos0.y += offset.y;
} }
...@@ -486,8 +486,8 @@ void MoveMarkedItems( MODULE* module, wxPoint offset ) ...@@ -486,8 +486,8 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
switch( item->Type() ) switch( item->Type() )
{ {
case TYPETEXTEMODULE: case TYPETEXTEMODULE:
( (TEXTE_MODULE*) item )->m_Pos.x += offset.x; ( (TEXTE_MODULE*) item )->GetPosition().x += offset.x;
( (TEXTE_MODULE*) item )->m_Pos.y += offset.y; ( (TEXTE_MODULE*) item )->GetPosition().y += offset.y;
( (TEXTE_MODULE*) item )->m_Pos0.x += offset.x; ( (TEXTE_MODULE*) item )->m_Pos0.x += offset.x;
( (TEXTE_MODULE*) item )->m_Pos0.y += offset.y; ( (TEXTE_MODULE*) item )->m_Pos0.y += offset.y;
break; break;
...@@ -495,10 +495,13 @@ void MoveMarkedItems( MODULE* module, wxPoint offset ) ...@@ -495,10 +495,13 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
case TYPEEDGEMODULE: case TYPEEDGEMODULE:
( (EDGE_MODULE*) item )->m_Start.x += offset.x; ( (EDGE_MODULE*) item )->m_Start.x += offset.x;
( (EDGE_MODULE*) item )->m_Start.y += offset.y; ( (EDGE_MODULE*) item )->m_Start.y += offset.y;
( (EDGE_MODULE*) item )->m_End.x += offset.x; ( (EDGE_MODULE*) item )->m_End.x += offset.x;
( (EDGE_MODULE*) item )->m_End.y += offset.y; ( (EDGE_MODULE*) item )->m_End.y += offset.y;
( (EDGE_MODULE*) item )->m_Start0.x += offset.x; ( (EDGE_MODULE*) item )->m_Start0.x += offset.x;
( (EDGE_MODULE*) item )->m_Start0.y += offset.y; ( (EDGE_MODULE*) item )->m_Start0.y += offset.y;
( (EDGE_MODULE*) item )->m_End0.x += offset.x; ( (EDGE_MODULE*) item )->m_End0.x += offset.x;
( (EDGE_MODULE*) item )->m_End0.y += offset.y; ( (EDGE_MODULE*) item )->m_End0.y += offset.y;
break; break;
...@@ -565,8 +568,8 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset ) ...@@ -565,8 +568,8 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
{ {
if( pad->m_Selected == 0 ) if( pad->m_Selected == 0 )
continue; continue;
SETMIRROR( pad->m_Pos.x ); SETMIRROR( pad->GetPosition().x );
pad->m_Pos0.x = pad->m_Pos.x; pad->m_Pos0.x = pad->GetPosition().x;
pad->m_Offset.x = -pad->m_Offset.x; pad->m_Offset.x = -pad->m_Offset.x;
pad->m_DeltaSize.x = -pad->m_DeltaSize.x; pad->m_DeltaSize.x = -pad->m_DeltaSize.x;
pad->m_Orient = 1800 - pad->m_Orient; pad->m_Orient = 1800 - pad->m_Orient;
...@@ -590,8 +593,8 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset ) ...@@ -590,8 +593,8 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
break; break;
case TYPETEXTEMODULE: case TYPETEXTEMODULE:
SETMIRROR( ( (TEXTE_MODULE*) item )->m_Pos.x ); SETMIRROR( ( (TEXTE_MODULE*) item )->GetPosition().x );
( (TEXTE_MODULE*) item )->m_Pos0.x = ( (TEXTE_MODULE*) item )->m_Pos.x; ( (TEXTE_MODULE*) item )->m_Pos0.x = ( (TEXTE_MODULE*) item )->GetPosition().x;
break; break;
default: default:
...@@ -621,8 +624,8 @@ void RotateMarkedItems( MODULE* module, wxPoint offset ) ...@@ -621,8 +624,8 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
{ {
if( pad->m_Selected == 0 ) if( pad->m_Selected == 0 )
continue; continue;
ROTATE( pad->m_Pos ); ROTATE( pad->GetPosition() );
pad->m_Pos0 = pad->m_Pos; pad->m_Pos0 = pad->GetPosition();
pad->m_Orient += 900; pad->m_Orient += 900;
NORMALIZE_ANGLE( pad->m_Orient ); NORMALIZE_ANGLE( pad->m_Orient );
} }
...@@ -643,8 +646,8 @@ void RotateMarkedItems( MODULE* module, wxPoint offset ) ...@@ -643,8 +646,8 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
break; break;
case TYPETEXTEMODULE: case TYPETEXTEMODULE:
ROTATE( ( (TEXTE_MODULE*) item )->m_Pos ); ROTATE( ( (TEXTE_MODULE*) item )->GetPosition() );
( (TEXTE_MODULE*) item )->m_Pos0 = ( (TEXTE_MODULE*) item )->m_Pos; ( (TEXTE_MODULE*) item )->m_Pos0 = ( (TEXTE_MODULE*) item )->GetPosition();
( (TEXTE_MODULE*) item )->m_Orient += 900; ( (TEXTE_MODULE*) item )->m_Orient += 900;
break; break;
...@@ -696,7 +699,7 @@ int MarkItemsInBloc( MODULE* module, EDA_Rect& Rect ) ...@@ -696,7 +699,7 @@ int MarkItemsInBloc( MODULE* module, EDA_Rect& Rect )
for( ; pad != NULL; pad = pad->Next() ) for( ; pad != NULL; pad = pad->Next() )
{ {
pad->m_Selected = 0; pad->m_Selected = 0;
pos = pad->m_Pos; pos = pad->GetPosition();
if( Rect.Inside( pos ) ) if( Rect.Inside( pos ) )
{ {
pad->m_Selected = IS_SELECTED; pad->m_Selected = IS_SELECTED;
...@@ -727,7 +730,7 @@ int MarkItemsInBloc( MODULE* module, EDA_Rect& Rect ) ...@@ -727,7 +730,7 @@ int MarkItemsInBloc( MODULE* module, EDA_Rect& Rect )
break; break;
case TYPETEXTEMODULE: case TYPETEXTEMODULE:
pos = ( (TEXTE_MODULE*) item )->m_Pos; pos = ( (TEXTE_MODULE*) item )->GetPosition();
if( Rect.Inside( pos ) ) if( Rect.Inside( pos ) )
{ {
item->m_Selected = IS_SELECTED; item->m_Selected = IS_SELECTED;
......
...@@ -360,38 +360,38 @@ int Build_Work( BOARD* Pcb, CHEVELU* pt_base_chevelu ) ...@@ -360,38 +360,38 @@ int Build_Work( BOARD* Pcb, CHEVELU* pt_base_chevelu )
current_net_code = pt_pad->GetNet(); current_net_code = pt_pad->GetNet();
pt_ch = pt_rats; pt_ch = pt_rats;
r1 = (pt_pad->m_Pos.y - Pcb->m_BoundaryBox.m_Pos.y + demi_pas ) / g_GridRoutingSize; r1 = (pt_pad->GetPosition().y - Pcb->m_BoundaryBox.m_Pos.y + demi_pas ) / g_GridRoutingSize;
if( r1 < 0 || r1 >= Nrows ) if( r1 < 0 || r1 >= Nrows )
{ {
msg.Printf( wxT( "erreur : row = %d ( padY %d pcbY %d) " ), r1, msg.Printf( wxT( "erreur : row = %d ( padY %d pcbY %d) " ), r1,
pt_pad->m_Pos.y, Pcb->m_BoundaryBox.m_Pos.y ); pt_pad->GetPosition().y, Pcb->m_BoundaryBox.m_Pos.y );
DisplayError( NULL, msg ); DisplayError( NULL, msg );
return 0; return 0;
} }
c1 = (pt_pad->m_Pos.x - Pcb->m_BoundaryBox.m_Pos.x + demi_pas ) / g_GridRoutingSize; c1 = (pt_pad->GetPosition().x - Pcb->m_BoundaryBox.m_Pos.x + demi_pas ) / g_GridRoutingSize;
if( c1 < 0 || c1 >= Ncols ) if( c1 < 0 || c1 >= Ncols )
{ {
msg.Printf( wxT( "erreur : col = %d ( padX %d pcbX %d) " ), c1, msg.Printf( wxT( "erreur : col = %d ( padX %d pcbX %d) " ), c1,
pt_pad->m_Pos.x, Pcb->m_BoundaryBox.m_Pos.x ); pt_pad->GetPosition().x, Pcb->m_BoundaryBox.m_Pos.x );
DisplayError( NULL, msg ); DisplayError( NULL, msg );
return 0; return 0;
} }
pt_pad = pt_rats->pad_end; pt_pad = pt_rats->pad_end;
r2 = (pt_pad->m_Pos.y - Pcb->m_BoundaryBox.m_Pos.y + demi_pas ) / g_GridRoutingSize; r2 = (pt_pad->GetPosition().y - Pcb->m_BoundaryBox.m_Pos.y + demi_pas ) / g_GridRoutingSize;
if( r2 < 0 || r2 >= Nrows ) if( r2 < 0 || r2 >= Nrows )
{ {
msg.Printf( wxT( "erreur : row = %d ( padY %d pcbY %d) " ), r2, msg.Printf( wxT( "erreur : row = %d ( padY %d pcbY %d) " ), r2,
pt_pad->m_Pos.y, Pcb->m_BoundaryBox.m_Pos.y ); pt_pad->GetPosition().y, Pcb->m_BoundaryBox.m_Pos.y );
DisplayError( NULL, msg ); DisplayError( NULL, msg );
return 0; return 0;
} }
c2 = (pt_pad->m_Pos.x - Pcb->m_BoundaryBox.m_Pos.x + demi_pas ) / g_GridRoutingSize; c2 = (pt_pad->GetPosition().x - Pcb->m_BoundaryBox.m_Pos.x + demi_pas ) / g_GridRoutingSize;
if( c2 < 0 || c2 >= Ncols ) if( c2 < 0 || c2 >= Ncols )
{ {
msg.Printf( wxT( "erreur : col = %d ( padX %d pcbX %d) " ), c2, msg.Printf( wxT( "erreur : col = %d ( padX %d pcbX %d) " ), c2,
pt_pad->m_Pos.x, Pcb->m_BoundaryBox.m_Pos.x ); pt_pad->GetPosition().x, Pcb->m_BoundaryBox.m_Pos.x );
DisplayError( NULL, msg ); DisplayError( NULL, msg );
return 0; return 0;
} }
......
...@@ -79,6 +79,13 @@ BOARD::~BOARD() ...@@ -79,6 +79,13 @@ BOARD::~BOARD()
} }
wxPoint& BOARD::GetPosition()
{
static wxPoint dummy(0,0);
return dummy; // a reference
}
void BOARD::UnLink() void BOARD::UnLink()
{ {
/* Modification du chainage arriere */ /* Modification du chainage arriere */
...@@ -108,6 +115,7 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl ) ...@@ -108,6 +115,7 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
{ {
// this one uses a vector // this one uses a vector
case TYPEMARKER: case TYPEMARKER:
aBoardItem->m_Parent = this;
m_markers.push_back( (MARKER*) aBoardItem ); m_markers.push_back( (MARKER*) aBoardItem );
break; break;
...@@ -188,13 +196,6 @@ int BOARD::GetNumNoconnect() ...@@ -188,13 +196,6 @@ int BOARD::GetNumNoconnect()
} }
// retourne le nombre de chevelus
int BOARD::GetNumRatsnests()
{
return m_NbLinks;
}
// retourne le nombre de pads a netcode > 0 // retourne le nombre de pads a netcode > 0
int BOARD::GetNumNodes() int BOARD::GetNumNodes()
{ {
...@@ -273,11 +274,13 @@ bool BOARD::ComputeBoundaryBox() ...@@ -273,11 +274,13 @@ bool BOARD::ComputeBoundaryBox()
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 )
{ {
const wxPoint& pos = pt_pad->GetPosition();
d = pt_pad->m_Rayon; d = pt_pad->m_Rayon;
xmin = MIN( xmin, pt_pad->m_Pos.x - d ); xmin = MIN( xmin, pos.x - d );
ymin = MIN( ymin, pt_pad->m_Pos.y - d ); ymin = MIN( ymin, pos.y - d );
xmax = MAX( xmax, pt_pad->m_Pos.x + d ); xmax = MAX( xmax, pos.x + d );
ymax = MAX( ymax, pt_pad->m_Pos.y + d ); ymax = MAX( ymax, pos.y + d );
} }
} }
......
...@@ -195,7 +195,8 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const ...@@ -195,7 +195,8 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
break; break;
case TYPEMARKER: case TYPEMARKER:
text << _( "Marker" ) << wxT( " @(" ) << ((MARKER*)item)->m_Pos.x << wxT(",") << ((MARKER*)item)->m_Pos.y << wxT(")"); text << _( "Marker" ) << wxT( " @(" ) << ((MARKER*)item)->GetPos().x
<< wxT(",") << ((MARKER*)item)->GetPos().y << wxT(")");
break; break;
case TYPECOTATION: case TYPECOTATION:
......
...@@ -28,6 +28,12 @@ public: ...@@ -28,6 +28,12 @@ public:
COTATION( BOARD_ITEM* StructFather ); COTATION( BOARD_ITEM* StructFather );
~COTATION(); ~COTATION();
wxPoint& GetPosition()
{
return m_Pos;
}
bool ReadCotationDescr( FILE* File, int* LineNum ); bool ReadCotationDescr( FILE* File, int* LineNum );
/** /**
......
...@@ -29,6 +29,18 @@ public: ...@@ -29,6 +29,18 @@ public:
EDGE_MODULE( EDGE_MODULE* edge ); EDGE_MODULE( EDGE_MODULE* edge );
~EDGE_MODULE(); ~EDGE_MODULE();
/**
* Function GetPosition
* returns the position of this object.
* @return const wxPoint& - The position of this object.
*/
wxPoint& GetPosition()
{
return m_Start;
}
/* supprime du chainage la structure Struct */ /* supprime du chainage la structure Struct */
void UnLink(); void UnLink();
......
...@@ -44,6 +44,13 @@ EQUIPOT::~EQUIPOT() ...@@ -44,6 +44,13 @@ EQUIPOT::~EQUIPOT()
} }
wxPoint& EQUIPOT::GetPosition()
{
static wxPoint dummy;
return dummy;
}
void EQUIPOT::UnLink() void EQUIPOT::UnLink()
{ {
/* Modification du chainage arriere */ /* Modification du chainage arriere */
......
...@@ -29,6 +29,16 @@ public: ...@@ -29,6 +29,16 @@ public:
~EQUIPOT(); ~EQUIPOT();
EQUIPOT* Next() { return (EQUIPOT*) Pnext; } EQUIPOT* Next() { return (EQUIPOT*) Pnext; }
/**
* Function GetPosition
* returns the position of this object.
* @return wxPoint& - The position of this object, non-const so it
* can be changed
* A dummy to satisfy pure virtual BOARD::GetPosition()
*/
wxPoint& GetPosition();
/* Effacement memoire de la structure */ /* Effacement memoire de la structure */
void UnLink(); void UnLink();
......
...@@ -38,8 +38,7 @@ static char Default_MarkerBitmap[] = ...@@ -38,8 +38,7 @@ static char Default_MarkerBitmap[] =
/* Classe MARKER */ /* Classe MARKER */
/*******************/ /*******************/
MARKER::MARKER( BOARD_ITEM* StructFather ) : void MARKER::init()
BOARD_ITEM( StructFather, TYPEMARKER )
{ {
m_Bitmap = NULL; m_Bitmap = NULL;
m_Type = 0; m_Type = 0;
...@@ -49,6 +48,26 @@ MARKER::MARKER( BOARD_ITEM* StructFather ) : ...@@ -49,6 +48,26 @@ MARKER::MARKER( BOARD_ITEM* StructFather ) :
m_Size.y = Default_MarkerBitmap[1]; m_Size.y = Default_MarkerBitmap[1];
} }
MARKER::MARKER( BOARD_ITEM* StructFather ) :
BOARD_ITEM( StructFather, TYPEMARKER ),
m_drc()
{
init();
}
MARKER::MARKER( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText, const wxPoint& aPos,
const wxString& bText, const wxPoint& bPos ) :
BOARD_ITEM( NULL, TYPEMARKER ) // parent set during BOARD::Add()
{
init();
SetData( aErrorCode, aMarkerPos,
aText, aPos,
bText, bPos );
}
/* Effacement memoire de la structure */ /* Effacement memoire de la structure */
MARKER::~MARKER() MARKER::~MARKER()
...@@ -59,6 +78,19 @@ MARKER::~MARKER() ...@@ -59,6 +78,19 @@ MARKER::~MARKER()
} }
void MARKER::SetData( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText, const wxPoint& aPos,
const wxString& bText, const wxPoint& bPos )
{
m_drc.SetData( aErrorCode, aMarkerPos,
aText, bText,
aPos, bPos );
// @todo: switch on error code to set error code specific color, and possibly bitmap.
m_Color = WHITE;
}
/* 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
*/ */
...@@ -78,7 +110,7 @@ void MARKER::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -78,7 +110,7 @@ void MARKER::Display_Infos( WinEDA_DrawFrame* frame )
Affiche_1_Parametre( frame, text_pos, _( "Type" ), _("Marker"), DARKCYAN ); Affiche_1_Parametre( frame, text_pos, _( "Type" ), _("Marker"), DARKCYAN );
text_pos = 12; text_pos = 12;
Affiche_1_Parametre( frame, text_pos, _( "Marker Error Text" ), m_Diag, RED ); Affiche_1_Parametre( frame, text_pos, _( "Marker Error Text" ), GetOneLineMessage(), RED );
} }
...@@ -95,9 +127,11 @@ bool MARKER::HitTest( const wxPoint& refPos ) ...@@ -95,9 +127,11 @@ bool MARKER::HitTest( const wxPoint& refPos )
TrueSize.x *= ActiveScreen->GetZoom(); TrueSize.x *= ActiveScreen->GetZoom();
TrueSize.y *= ActiveScreen->GetZoom(); TrueSize.y *= ActiveScreen->GetZoom();
} }
wxPoint pos = GetPosition();
int dx = refPos.x - m_Pos.x; int dx = refPos.x - pos.x;
int dy = refPos.y - m_Pos.y; int dy = refPos.y - pos.y;
/* is refPos in the box: Marker size to right an bottom, /* is refPos in the box: Marker size to right an bottom,
or size/2 to left or top */ or size/2 to left or top */
...@@ -130,8 +164,8 @@ void MARKER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode ) ...@@ -130,8 +164,8 @@ void MARKER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode )
GRSetDrawMode( DC, DrawMode ); GRSetDrawMode( DC, DrawMode );
px = GRMapX( m_Pos.x ); px = GRMapX( GetPosition().x );
py = GRMapY( m_Pos.y ); py = GRMapY( GetPosition().y );
/* Get the bitmap size */ /* Get the bitmap size */
m_Size.x = *(pt_bitmap++); m_Size.x = *(pt_bitmap++);
......
...@@ -7,39 +7,106 @@ ...@@ -7,39 +7,106 @@
#include "base_struct.h" #include "base_struct.h"
#include "drc_stuff.h"
class MARKER : public BOARD_ITEM class MARKER : public BOARD_ITEM
{ {
private: protected:
wxString m_Diag; /* Associated text (comment) */ char* m_Bitmap; ///< Shape (bitmap)
public:
wxPoint m_Pos;
char* m_Bitmap; /* Shape (bitmap) */
int m_Type; int m_Type;
int m_Color; /* color */ int m_Color; ///< color
wxSize m_Size; /* Size of the graphic symbol */ wxSize m_Size; ///< Size of the graphic symbol
DRC_ITEM m_drc;
void init();
public: public:
MARKER( BOARD_ITEM* StructFather ); MARKER( BOARD_ITEM* StructFather );
/**
* Constructor
* @param aErrorCode The categorizing identifier for an error
* @param aMarkerPos The position of the MARKER on the BOARD
* @param aText Text describing the first of two objects
* @param aPos The position of the first of two objects
* @param bText Text describing the second of the two conflicting objects
* @param bPos The position of the second of two objects
*/
MARKER( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText, const wxPoint& aPos,
const wxString& bText, const wxPoint& bPos );
~MARKER(); ~MARKER();
void UnLink(); void UnLink();
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode ); void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode );
/**
* Function GetPosition
* returns the position of this MARKER.
*/
wxPoint& GetPosition()
{
return (wxPoint&) m_drc.GetPosition();
}
/**
* Function GetPos
* returns the position of this MARKER, const.
*/
const wxPoint& GetPos() const
{
return m_drc.GetPosition();
}
/**
* Function SetData
* fills in all the reportable data associated with a MARKER.
* @param aErrorCode The categorizing identifier for an error
* @param aMarkerPos The position of the MARKER on the BOARD
* @param aText Text describing the first of two objects
* @param aPos The position of the first of two objects
* @param bText Text describing the second of the two conflicting objects
* @param bPos The position of the second of two objects
*/
void SetData( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText, const wxPoint& aPos,
const wxString& bText, const wxPoint& bPos );
/** /**
* Function GetMessage * Function GetMessage
* @return const wxString& - the diagnostic message * @return const wxString& - the diagnostic message
*/ */
const wxString& GetMessage() const wxString GetOneLineMessage()
{ {
return m_Diag; return m_drc.ShowText();
} }
/**
* Function GetReporter
* returns the REPORT_ISSUE held within this MARKER so that its
* interface may be used.
* @return const& REPORT_ISSUE
*/
const REPORT_ISSUE& GetReporter() const
{
return m_drc;
}
/*
void SetMessage( const wxString& aMsg ) void SetMessage( const wxString& aMsg )
{ {
m_Diag = aMsg; m_Diag = aMsg;
} }
*/
/** /**
...@@ -75,4 +142,4 @@ public: ...@@ -75,4 +142,4 @@ public:
}; };
#endif // end #ifndef CLASS_MARKER_H #endif // CLASS_MARKER_H
...@@ -19,6 +19,12 @@ public: ...@@ -19,6 +19,12 @@ public:
MIREPCB( BOARD_ITEM* StructFather ); MIREPCB( BOARD_ITEM* StructFather );
~MIREPCB(); ~MIREPCB();
wxPoint& GetPosition()
{
return m_Pos;
}
/** /**
* Function Save * Function Save
* writes the data structures for this object out to a FILE in "*.brd" format. * writes the data structures for this object out to a FILE in "*.brd" format.
......
...@@ -37,6 +37,7 @@ enum Mod_Attribut /* Attributs d'un module */ ...@@ -37,6 +37,7 @@ enum Mod_Attribut /* Attributs d'un module */
class MODULE : public BOARD_ITEM 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) */
...@@ -82,6 +83,18 @@ public: ...@@ -82,6 +83,18 @@ public:
void SetRectangleExinscrit();/* mise a jour du rect d'encadrement void SetRectangleExinscrit();/* mise a jour du rect d'encadrement
* et de la surface en coord reelles */ * et de la surface en coord reelles */
/**
* Function GetPosition
* returns the position of this object.
* Required by pure virtual BOARD_ITEM::GetPosition()
* @return const wxPoint& - The position of this object.
*/
wxPoint& GetPosition()
{
return m_Pos;
}
// deplacements // deplacements
void SetPosition( const wxPoint& newpos ); void SetPosition( const wxPoint& newpos );
void SetOrientation( int newangle ); void SetOrientation( int newangle );
......
...@@ -38,7 +38,7 @@ D_PAD::D_PAD( MODULE* parent ) : ...@@ -38,7 +38,7 @@ D_PAD::D_PAD( MODULE* parent ) :
if( m_Parent && (m_Parent->Type() == TYPEMODULE) ) if( m_Parent && (m_Parent->Type() == TYPEMODULE) )
{ {
m_Pos = ( (MODULE*) m_Parent )->m_Pos; m_Pos = ( (MODULE*) m_Parent )->GetPosition();
} }
m_PadShape = CIRCLE; // forme CERCLE, RECT OVALE TRAPEZE ou libre m_PadShape = CIRCLE; // forme CERCLE, RECT OVALE TRAPEZE ou libre
...@@ -75,8 +75,8 @@ void D_PAD::ComputeRayon() ...@@ -75,8 +75,8 @@ void D_PAD::ComputeRayon()
case RECT: case RECT:
case TRAPEZE: case TRAPEZE:
m_Rayon = (int) (sqrt( (float) m_Size.y * m_Size.y m_Rayon = (int) (sqrt( (double) m_Size.y * m_Size.y
+ (float) m_Size.x * m_Size.x ) / 2); + (double) m_Size.x * m_Size.x ) / 2);
break; break;
} }
} }
...@@ -88,7 +88,7 @@ const wxPoint D_PAD::ReturnShapePos() ...@@ -88,7 +88,7 @@ const wxPoint D_PAD::ReturnShapePos()
// retourne la position de la forme (pastilles excentrees) // retourne la position de la forme (pastilles excentrees)
{ {
if( (m_Offset.x == 0) && (m_Offset.y == 0) ) if( m_Offset.x == 0 && m_Offset.y == 0 )
return m_Pos; return m_Pos;
wxPoint shape_pos; wxPoint shape_pos;
......
...@@ -23,8 +23,11 @@ class D_PAD : public BOARD_ITEM ...@@ -23,8 +23,11 @@ class D_PAD : public BOARD_ITEM
{ {
private: private:
int m_NetCode; // Net number for fast comparisons int m_NetCode; // Net number for fast comparisons
public: public:
wxPoint m_Pos; // pad Position on board
union union
{ {
unsigned long m_NumPadName; unsigned long m_NumPadName;
...@@ -42,7 +45,6 @@ public: ...@@ -42,7 +45,6 @@ public:
int m_PadShape; // Shape: CIRCLE, RECT, OVAL, TRAPEZOID int m_PadShape; // Shape: CIRCLE, RECT, OVAL, TRAPEZOID
int m_DrillShape; // Shape CIRCLE, OVAL int m_DrillShape; // Shape CIRCLE, OVAL
wxPoint m_Pos; // pad Position on board
wxSize m_Drill; // Drill diam (drill shape = CIRCLE) or drill size(shape = OVAL) wxSize m_Drill; // Drill diam (drill shape = CIRCLE) or drill size(shape = OVAL)
// for drill shape = CIRCLE, drill diam = m_Drill.x // for drill shape = CIRCLE, drill diam = m_Drill.x
...@@ -72,6 +74,21 @@ public: ...@@ -72,6 +74,21 @@ public:
D_PAD* Next() { return (D_PAD*) Pnext; } D_PAD* Next() { return (D_PAD*) Pnext; }
/**
* Function GetPosition
* returns the position of this object.
* @return const wxPoint& - The position of this object.
*/
wxPoint& GetPosition()
{
return m_Pos;
}
void SetPosition( const wxPoint& aPos )
{
m_Pos = aPos;
}
/* remove from linked list */ /* remove from linked list */
void UnLink(); void UnLink();
...@@ -86,6 +103,7 @@ public: ...@@ -86,6 +103,7 @@ public:
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/* drawing functions */ /* drawing functions */
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode ); void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode );
......
...@@ -13,6 +13,19 @@ public: ...@@ -13,6 +13,19 @@ public:
TEXTE_PCB( TEXTE_PCB* textepcb ); TEXTE_PCB( TEXTE_PCB* textepcb );
~TEXTE_PCB(); ~TEXTE_PCB();
/**
* Function GetPosition
* returns the position of this object.
* @return wxPoint& - The position of this object, non-const so it
* can be changed
*/
wxPoint& GetPosition()
{
return m_Pos; // within EDA_TextStruct
}
/* supprime du chainage la structure Struct */ /* supprime du chainage la structure Struct */
void UnLink(); void UnLink();
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
class TEXTE_MODULE : public BOARD_ITEM class TEXTE_MODULE : public BOARD_ITEM
{ {
public: public:
int m_Width;
wxPoint m_Pos; // Real coord wxPoint m_Pos; // Real coord
int m_Width;
wxPoint m_Pos0; // coord du debut du texte /ancre, orient 0 wxPoint m_Pos0; // coord du debut du texte /ancre, orient 0
char m_Unused; // unused (reserved for future extensions) char m_Unused; // unused (reserved for future extensions)
char m_Miroir; // vue normale / miroir char m_Miroir; // vue normale / miroir
...@@ -31,6 +31,18 @@ public: ...@@ -31,6 +31,18 @@ public:
TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS ); TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS );
~TEXTE_MODULE(); ~TEXTE_MODULE();
/**
* Function GetPosition
* returns the position of this object.
* Required by pure virtual BOARD_ITEM::GetPosition()
* @return const wxPoint& - The position of this object.
*/
wxPoint& GetPosition()
{
return m_Pos;
}
/* supprime du chainage la structure Struct */ /* supprime du chainage la structure Struct */
void UnLink(); void UnLink();
......
...@@ -144,21 +144,6 @@ bool TRACK::IsNull() ...@@ -144,21 +144,6 @@ bool TRACK::IsNull()
} }
/*************************************************************/
double TRACK::GetLength() const
/*************************************************************/
{
int dx = m_Start.x - m_End.x;
int dy = m_Start.y - m_End.y;
double dist = ( (double) dx * dx ) + ( (double) dy * dy );
dist = sqrt( dist );
return dist;
}
/*************************************************************/ /*************************************************************/
int TRACK::IsPointOnEnds( const wxPoint& point, int min_dist ) int TRACK::IsPointOnEnds( const wxPoint& point, int min_dist )
/*************************************************************/ /*************************************************************/
......
...@@ -55,6 +55,16 @@ public: ...@@ -55,6 +55,16 @@ public:
TRACK* Back() const { return (TRACK*) Pback; } TRACK* Back() const { return (TRACK*) Pback; }
/**
* Function GetPosition
* returns the position of this object.
* @return const wxPoint& - The position of this object.
*/
wxPoint& GetPosition()
{
return m_Start; // it had to be start or end.
}
/* supprime du chainage la structure Struct */ /* supprime du chainage la structure Struct */
void UnLink(); void UnLink();
...@@ -122,7 +132,12 @@ public: ...@@ -122,7 +132,12 @@ public:
* returns the length of the track using the hypotenuse calculation. * returns the length of the track using the hypotenuse calculation.
* @return double - the length of the track * @return double - the length of the track
*/ */
double GetLength() const; double GetLength() const
{
int dx = m_Start.x - m_End.x;
int dy = m_Start.y - m_End.y;
return hypot( dx, dy );
}
/* Display on screen: */ /* Display on screen: */
...@@ -255,8 +270,16 @@ public: ...@@ -255,8 +270,16 @@ public:
void SetLayerPair( int top_layer, int bottom_layer ); void SetLayerPair( int top_layer, int bottom_layer );
void ReturnLayerPair( int* top_layer, int* bottom_layer ) const; void ReturnLayerPair( int* top_layer, int* bottom_layer ) const;
const wxPoint& GetPos() const { return m_Start; } /**
void SetPos( const wxPoint& aPoint ) { m_Start=aPoint; m_End=aPoint; } * Function GetPosition
* returns the position of this object.
* @return const wxPoint& - The position of this object.
*/
wxPoint& GetPosition()
{
return m_Start;
}
void SetPosition( const wxPoint& aPoint ) { m_Start=aPoint; m_End=aPoint; }
/** /**
* Function GetClass * Function GetClass
......
...@@ -985,12 +985,12 @@ static void ConnectDanglingEndToVia( BOARD* pcb ) ...@@ -985,12 +985,12 @@ static void ConnectDanglingEndToVia( BOARD* pcb )
// if the other track's m_End does not match the via position, and the track's m_Start is // if the other track's m_End does not match the via position, and the track's m_Start is
// within the bounds of the via, and the other track has no start // within the bounds of the via, and the other track has no start
if( other->m_End!=via->GetPos() && via->HitTest( other->m_Start ) && !other->start ) if( other->m_End!=via->GetPosition() && via->HitTest( other->m_Start ) && !other->start )
{ {
TRACK* newTrack = other->Copy(); TRACK* newTrack = other->Copy();
newTrack->Insert( pcb, other ); newTrack->Insert( pcb, other );
newTrack->m_End = via->GetPos(); newTrack->m_End = via->GetPosition();
newTrack->start = other; newTrack->start = other;
newTrack->end = via; newTrack->end = via;
...@@ -1007,12 +1007,12 @@ static void ConnectDanglingEndToVia( BOARD* pcb ) ...@@ -1007,12 +1007,12 @@ static void ConnectDanglingEndToVia( BOARD* pcb )
// if the other track's m_Start does not match the via position, and the track's m_End is // if the other track's m_Start does not match the via position, and the track's m_End is
// within the bounds of the via, and the other track has no end // within the bounds of the via, and the other track has no end
else if( other->m_Start!=via->GetPos() && via->HitTest( other->m_End ) && !other->end ) else if( other->m_Start!=via->GetPosition() && via->HitTest( other->m_End ) && !other->end )
{ {
TRACK* newTrack = other->Copy(); TRACK* newTrack = other->Copy();
newTrack->Insert( pcb, other ); newTrack->Insert( pcb, other );
newTrack->m_Start = via->GetPos(); newTrack->m_Start = via->GetPosition();
newTrack->start = via; newTrack->start = via;
newTrack->end = other; newTrack->end = other;
......
...@@ -58,7 +58,7 @@ void RemoteCommand( const char* cmdline ) ...@@ -58,7 +58,7 @@ void RemoteCommand( const char* cmdline )
frame->DrawPanel->PrepareGraphicContext( &dc ); frame->DrawPanel->PrepareGraphicContext( &dc );
frame->DrawPanel->CursorOff( &dc ); frame->DrawPanel->CursorOff( &dc );
frame->GetScreen()->m_Curseur = module->m_Pos; frame->GetScreen()->m_Curseur = module->GetPosition();
frame->DrawPanel->CursorOn( &dc ); frame->DrawPanel->CursorOn( &dc );
} }
} }
...@@ -96,7 +96,7 @@ void RemoteCommand( const char* cmdline ) ...@@ -96,7 +96,7 @@ void RemoteCommand( const char* cmdline )
frame->Hight_Light( &dc ); /* hightlighted the new one */ frame->Hight_Light( &dc ); /* hightlighted the new one */
frame->DrawPanel->CursorOff( &dc ); frame->DrawPanel->CursorOff( &dc );
frame->GetScreen()->m_Curseur = pad->m_Pos; frame->GetScreen()->m_Curseur = pad->GetPosition();
frame->DrawPanel->CursorOn( &dc ); frame->DrawPanel->CursorOn( &dc );
} }
......
This diff is collapsed.
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
*/ */
////@begin includes ////@begin includes
#include "wx/valgen.h"
#include "wx/notebook.h" #include "wx/notebook.h"
////@end includes ////@end includes
...@@ -50,8 +49,8 @@ class wxStdDialogButtonSizer; ...@@ -50,8 +49,8 @@ class wxStdDialogButtonSizer;
#define ID_TEXTCTRL3 10014 #define ID_TEXTCTRL3 10014
#define ID_BUTTON_BROWSE_RPT_FILE 10018 #define ID_BUTTON_BROWSE_RPT_FILE 10018
#define ID_CHECKBOX2 10019 #define ID_CHECKBOX2 10019
#define ID_CHECKBOX3 10020
#define ID_CHECKBOX7 10021 #define ID_CHECKBOX7 10021
#define ID_CHECKBOX3 10011
#define ID_STARTDRC 10006 #define ID_STARTDRC 10006
#define ID_LIST_UNCONNECTED 10003 #define ID_LIST_UNCONNECTED 10003
#define ID_DELETE_ALL 10005 #define ID_DELETE_ALL 10005
...@@ -59,14 +58,14 @@ class wxStdDialogButtonSizer; ...@@ -59,14 +58,14 @@ class wxStdDialogButtonSizer;
#define ID_NOTEBOOK1 10008 #define ID_NOTEBOOK1 10008
#define ID_CLEARANCE_LIST 10001 #define ID_CLEARANCE_LIST 10001
#define ID_UNCONNECTED_LIST 10009 #define ID_UNCONNECTED_LIST 10009
#define SYMBOL_WINEDA_DRCFRAME_STYLE wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER #define SYMBOL_DRCDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxMAXIMIZE_BOX|wxMINIMIZE_BOX
#define SYMBOL_WINEDA_DRCFRAME_TITLE _("DRC Control") #define SYMBOL_DRCDIALOG_TITLE _("DRC Control")
#define SYMBOL_WINEDA_DRCFRAME_IDNAME ID_DIALOG #define SYMBOL_DRCDIALOG_IDNAME ID_DIALOG
#define SYMBOL_WINEDA_DRCFRAME_SIZE wxSize(400, 300) #define SYMBOL_DRCDIALOG_SIZE wxSize(400, 300)
#define SYMBOL_WINEDA_DRCFRAME_POSITION wxDefaultPosition #define SYMBOL_DRCDIALOG_POSITION wxDefaultPosition
////@end control identifiers ////@end control identifiers
#define ID_DRCLISTCTRL 10001 // outside @end control identifiers since DialogBlocks knows not DRCLISTBOX #define ID_DRCLISTCTRL 14000 // outside @end control identifiers since DialogBlocks knows not DRCLISTBOX
/*! /*!
* Compatibility * Compatibility
...@@ -77,35 +76,38 @@ class wxStdDialogButtonSizer; ...@@ -77,35 +76,38 @@ class wxStdDialogButtonSizer;
#endif #endif
/*! /*!
* WinEDA_DrcFrame class declaration * DrcDialog class declaration
*/ */
class WinEDA_DrcFrame: public wxDialog class DrcDialog: public wxDialog
{ {
DECLARE_DYNAMIC_CLASS( WinEDA_DrcFrame ) DECLARE_DYNAMIC_CLASS( DrcDialog )
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
public: public:
/// Constructors /// Constructors
WinEDA_DrcFrame( ); DrcDialog( );
WinEDA_DrcFrame( DRC_TESTER* aDrc_tester, WinEDA_PcbFrame* parent, wxDC * panelDC, DrcDialog( DRC* aTester, WinEDA_PcbFrame* parent,
wxWindowID id = SYMBOL_WINEDA_DRCFRAME_IDNAME, wxWindowID id = SYMBOL_DRCDIALOG_IDNAME,
const wxString& caption = SYMBOL_WINEDA_DRCFRAME_TITLE, const wxString& caption = SYMBOL_DRCDIALOG_TITLE,
const wxPoint& pos = SYMBOL_WINEDA_DRCFRAME_POSITION, const wxPoint& pos = SYMBOL_DRCDIALOG_POSITION,
const wxSize& size = SYMBOL_WINEDA_DRCFRAME_SIZE, const wxSize& size = SYMBOL_DRCDIALOG_SIZE,
long style = SYMBOL_WINEDA_DRCFRAME_STYLE ); long style = SYMBOL_DRCDIALOG_STYLE );
/// Creation /// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_DRCFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_DRCFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_DRCFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_DRCFRAME_SIZE, long style = SYMBOL_WINEDA_DRCFRAME_STYLE ); bool Create( wxWindow* parent, wxWindowID id = SYMBOL_DRCDIALOG_IDNAME, const wxString& caption = SYMBOL_DRCDIALOG_TITLE, const wxPoint& pos = SYMBOL_DRCDIALOG_POSITION, const wxSize& size = SYMBOL_DRCDIALOG_SIZE, long style = SYMBOL_DRCDIALOG_STYLE );
/// Creates the controls and sizers /// Creates the controls and sizers
void CreateControls(); void CreateControls();
////@begin WinEDA_DrcFrame event handler declarations ////@begin DrcDialog event handler declarations
/// wxEVT_INIT_DIALOG event handler for ID_DIALOG /// wxEVT_INIT_DIALOG event handler for ID_DIALOG
void OnInitDialog( wxInitDialogEvent& event ); void OnInitDialog( wxInitDialogEvent& event );
/// wxEVT_DESTROY event handler for ID_DIALOG
void OnDestroy( wxWindowDestroyEvent& event );
/// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX
void OnReportCheckBoxClicked( wxCommandEvent& event ); void OnReportCheckBoxClicked( wxCommandEvent& event );
...@@ -139,16 +141,16 @@ public: ...@@ -139,16 +141,16 @@ public:
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
void OnOkClick( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
////@end WinEDA_DrcFrame event handler declarations ////@end DrcDialog event handler declarations
////@begin WinEDA_DrcFrame member function declarations ////@begin DrcDialog member function declarations
/// Retrieves bitmap resources /// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name ); wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources /// Retrieves icon resources
wxIcon GetIconResource( const wxString& name ); wxIcon GetIconResource( const wxString& name );
////@end WinEDA_DrcFrame member function declarations ////@end DrcDialog member function declarations
void OnMarkerSelectionEvent( wxCommandEvent& event ); void OnMarkerSelectionEvent( wxCommandEvent& event );
void OnUnconnectedSelectionEvent( wxCommandEvent& event ); void OnUnconnectedSelectionEvent( wxCommandEvent& event );
...@@ -156,11 +158,11 @@ public: ...@@ -156,11 +158,11 @@ public:
/// Should we show tooltips? /// Should we show tooltips?
static bool ShowToolTips(); static bool ShowToolTips();
void TestDrc(wxCommandEvent & event); void CmdDrc();
void DelDRCMarkers(wxCommandEvent & event); void DelDRCMarkers(wxCommandEvent & event);
void ListUnconnectedPads(wxCommandEvent & event); void ListUnconnectedPads(wxCommandEvent & event);
////@begin WinEDA_DrcFrame member variables ////@begin DrcDialog member variables
wxBoxSizer* m_MainSizer; wxBoxSizer* m_MainSizer;
wxBoxSizer* m_CommandSizer; wxBoxSizer* m_CommandSizer;
wxStaticText* m_ClearenceTitle; wxStaticText* m_ClearenceTitle;
...@@ -169,18 +171,18 @@ public: ...@@ -169,18 +171,18 @@ public:
wxTextCtrl* m_RptFilenameCtrl; wxTextCtrl* m_RptFilenameCtrl;
wxButton* m_BrowseButton; wxButton* m_BrowseButton;
wxCheckBox* m_Pad2PadTestCtrl; wxCheckBox* m_Pad2PadTestCtrl;
wxCheckBox* m_UnconnectedTestCtrl;
wxCheckBox* m_ZonesTestCtrl; wxCheckBox* m_ZonesTestCtrl;
wxCheckBox* m_UnconnectedTestCtrl;
wxButton* m_DeleteAllButton;
wxButton* m_DeleteCurrentMarkerButton; wxButton* m_DeleteCurrentMarkerButton;
DRCLISTBOX* m_ClearanceListBox; DRCLISTBOX* m_ClearanceListBox;
DRCLISTBOX* m_UnconnectedListBox; DRCLISTBOX* m_UnconnectedListBox;
wxStdDialogButtonSizer* StdDialogButtonSizer; wxStdDialogButtonSizer* StdDialogButtonSizer;
////@end WinEDA_DrcFrame member variables ////@end DrcDialog member variables
DRC_TESTER* m_Tester; DRC* m_tester;
WinEDA_PcbFrame* m_Parent; WinEDA_PcbFrame* m_Parent;
wxDC* m_DC;
int m_UnconnectedCount; int m_UnconnectedCount;
}; };
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/***************************************************************/ /***************************************************************/
/* Edition des pistes: Routines de modification de dimensions: */ /* Edition des pistes: Routines de modification de dimensions: */
/* Modif de largeurs de segment, piste, net , zone et diam Via */ /* Modif de largeurs de segment, piste, net , zone et diam Via */
/***************************************************************/ /***************************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
...@@ -15,142 +15,158 @@ ...@@ -15,142 +15,158 @@
/* Routines Locales */ /* Routines Locales */
/*********************************************************************/ /*********************************************************************/
int WinEDA_PcbFrame::Edit_TrackSegm_Width(wxDC * DC, TRACK * pt_segm) int WinEDA_PcbFrame::Edit_TrackSegm_Width( wxDC* DC, TRACK* pt_segm )
/*********************************************************************/ /*********************************************************************/
/* Routine to modify one track segment width or one via diameter. /* Routine to modify one track segment width or one via diameter.
Basic routine used by other routines when editing tracks or vias * Basic routine used by other routines when editing tracks or vias
*/ */
{ {
int errdrc = OK_DRC; int errdrc = OK_DRC;
int old_w, consigne ; int old_w, consigne;
DrawPanel->CursorOff(DC); // Erase cursor shape DrawPanel->CursorOff( DC ); // Erase cursor shape
pt_segm->Draw(DrawPanel, DC, GR_XOR) ; // Erase old track shape pt_segm->Draw( DrawPanel, DC, GR_XOR ); // Erase old track shape
/* Test DRC and width change */ /* Test DRC and width change */
old_w = pt_segm->m_Width; old_w = pt_segm->m_Width;
consigne = pt_segm->m_Width = g_DesignSettings.m_CurrentTrackWidth; consigne = pt_segm->m_Width = g_DesignSettings.m_CurrentTrackWidth;
if( pt_segm->Type() == TYPEVIA ) if( pt_segm->Type() == TYPEVIA )
{ {
consigne = pt_segm->m_Width = g_DesignSettings.m_CurrentViaSize; consigne = pt_segm->m_Width = g_DesignSettings.m_CurrentViaSize;
} }
if ( old_w < consigne) /* DRC utile puisque augm de dimension */ if( old_w < consigne ) /* DRC utile puisque augm de dimension */
{ {
if(Drc_On) errdrc = Drc(this, DC, pt_segm, m_Pcb->m_Track,1); if( Drc_On )
if(errdrc == BAD_DRC) pt_segm->m_Width = old_w; errdrc = m_drc->Drc( pt_segm, m_Pcb->m_Track );
else GetScreen()->SetModify(); if( errdrc == BAD_DRC )
} pt_segm->m_Width = old_w;
else
else GetScreen()->SetModify(); /* Correction systematiquement faite si reduction */ GetScreen()->SetModify();
}
pt_segm->Draw(DrawPanel, DC, GR_OR) ; // Display new track shape else
DrawPanel->CursorOn(DC); // Display cursor shape GetScreen()->SetModify(); /* Correction systematiquement faite si reduction */
return(errdrc);
pt_segm->Draw( DrawPanel, DC, GR_OR ); // Display new track shape
DrawPanel->CursorOn( DC ); // Display cursor shape
return errdrc;
} }
/*****************************************************************/ /*****************************************************************/
void WinEDA_PcbFrame::Edit_Track_Width(wxDC * DC,TRACK * pt_segm) void WinEDA_PcbFrame::Edit_Track_Width( wxDC* DC, TRACK* pt_segm )
/*****************************************************************/ /*****************************************************************/
{ {
int ii; int ii;
TRACK * pt_track; TRACK* pt_track;
int errdrc; int errdrc;
int nb_segm, nb_segm_modifies = 0, nb_segm_non_modifies = 0; int nb_segm, nb_segm_modifies = 0, nb_segm_non_modifies = 0;
if( pt_segm == NULL) return; if( pt_segm == NULL )
return;
pt_track = Marque_Une_Piste(this, DC, pt_segm, &nb_segm, 0);
for(ii = 0; ii < nb_segm; ii++, pt_track = (TRACK*) pt_track->Pnext) pt_track = Marque_Une_Piste( this, DC, pt_segm, &nb_segm, 0 );
{ for( ii = 0; ii < nb_segm; ii++, pt_track = (TRACK*) pt_track->Pnext )
pt_track->SetState(BUSY,OFF); {
errdrc = Edit_TrackSegm_Width(DC, pt_track); pt_track->SetState( BUSY, OFF );
if(errdrc == BAD_DRC) nb_segm_non_modifies++; errdrc = Edit_TrackSegm_Width( DC, pt_track );
else nb_segm_modifies++; if( errdrc == BAD_DRC )
} nb_segm_non_modifies++;
else
nb_segm_modifies++;
}
} }
/***********************************************************/ /***********************************************************/
void WinEDA_PcbFrame::Edit_Net_Width(wxDC * DC, int Netcode) void WinEDA_PcbFrame::Edit_Net_Width( wxDC* DC, int Netcode )
/***********************************************************/ /***********************************************************/
{ {
TRACK *pt_segm; TRACK* pt_segm;
int errdrc; int errdrc;
int nb_segm_modifies = 0; int nb_segm_modifies = 0;
int nb_segm_non_modifies = 0; int nb_segm_non_modifies = 0;
if (Netcode <= 0 ) return; if( Netcode <= 0 )
return;
if( ! IsOK(this, _("Change track width (entire NET) ?") ) ) return;
if( !IsOK( this, _( "Change track width (entire NET) ?" ) ) )
/* balayage des segments */ return;
for( pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = (TRACK*) pt_segm->Pnext )
{ /* balayage des segments */
if ( Netcode != pt_segm->GetNet() ) /* mauvaise piste */ for( pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = (TRACK*) pt_segm->Pnext )
continue ; {
/* piste d'un net trouvee */ if( Netcode != pt_segm->GetNet() ) /* mauvaise piste */
errdrc = Edit_TrackSegm_Width(DC, pt_segm); continue;
if(errdrc == BAD_DRC) nb_segm_non_modifies++; /* piste d'un net trouvee */
else nb_segm_modifies++; errdrc = Edit_TrackSegm_Width( DC, pt_segm );
} if( errdrc == BAD_DRC )
nb_segm_non_modifies++;
else
nb_segm_modifies++;
}
} }
/*************************************************************************/ /*************************************************************************/
bool WinEDA_PcbFrame::Resize_Pistes_Vias(wxDC * DC, bool Track, bool Via) bool WinEDA_PcbFrame::Resize_Pistes_Vias( wxDC* DC, bool Track, bool Via )
/*************************************************************************/ /*************************************************************************/
/* remet a jour la largeur des pistes et/ou le diametre des vias /* remet a jour la largeur des pistes et/ou le diametre des vias
Si piste == 0 , pas de cht sur les pistes * Si piste == 0 , pas de cht sur les pistes
Si via == 0 , pas de cht sur les vias * Si via == 0 , pas de cht sur les vias
*/ */
{ {
TRACK * pt_segm ; TRACK* pt_segm;
int errdrc; int errdrc;
int nb_segm_modifies = 0; int nb_segm_modifies = 0;
int nb_segm_non_modifies = 0; int nb_segm_non_modifies = 0;
if ( Track && Via) if( Track && Via )
{ {
if( ! IsOK(this, _("Edit All Tracks and Vias Sizes")) ) return FALSE; if( !IsOK( this, _( "Edit All Tracks and Vias Sizes" ) ) )
} return FALSE;
}
else if ( Via ) else if( Via )
{ {
if( ! IsOK(this, _("Edit All Via Sizes")) ) return FALSE; if( !IsOK( this, _( "Edit All Via Sizes" ) ) )
} return FALSE;
}
else if( Track ) else if( Track )
{ {
if( ! IsOK(this, _("Edit All Track Sizes")) ) return FALSE; if( !IsOK( this, _( "Edit All Track Sizes" ) ) )
} return FALSE;
}
pt_segm = m_Pcb->m_Track ;
for ( ; pt_segm != NULL; pt_segm = (TRACK*) pt_segm->Pnext ) pt_segm = m_Pcb->m_Track;
{ for( ; pt_segm != NULL; pt_segm = (TRACK*) pt_segm->Pnext )
if( pt_segm->Type() == TYPEVIA ) /* mise a jour du diametre de la via */ {
{ if( pt_segm->Type() == TYPEVIA ) /* mise a jour du diametre de la via */
if ( Via ) {
{ if( Via )
errdrc = Edit_TrackSegm_Width(DC, pt_segm); {
if(errdrc == BAD_DRC) nb_segm_non_modifies++; errdrc = Edit_TrackSegm_Width( DC, pt_segm );
else nb_segm_modifies++; if( errdrc == BAD_DRC )
} nb_segm_non_modifies++;
} else
else /* mise a jour de la largeur du segment */ nb_segm_modifies++;
{ }
if ( Track ) }
{ else /* mise a jour de la largeur du segment */
errdrc = Edit_TrackSegm_Width(DC, pt_segm); {
if(errdrc == BAD_DRC) nb_segm_non_modifies++; if( Track )
else nb_segm_modifies++; {
} errdrc = Edit_TrackSegm_Width( DC, pt_segm );
} if( errdrc == BAD_DRC )
} nb_segm_non_modifies++;
else
if ( nb_segm_modifies ) return TRUE; nb_segm_modifies++;
return FALSE; }
}
}
if( nb_segm_modifies )
return TRUE;
return FALSE;
} }
...@@ -123,8 +123,9 @@ void WinEDA_PcbFrame::ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC ) ...@@ -123,8 +123,9 @@ void WinEDA_PcbFrame::ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC )
else if( pt_segm->GetLayer() == l2 ) else if( pt_segm->GetLayer() == l2 )
pt_segm->SetLayer( l1 ); pt_segm->SetLayer( l1 );
if( (Drc_On) && ( Drc( this, DC, pt_segm, m_Pcb->m_Track, 1 ) == BAD_DRC ) ) if( Drc_On && BAD_DRC==m_drc->Drc( pt_segm, m_Pcb->m_Track ) )
{ /* Annulation du changement */ {
/* Annulation du changement */
ii = 0; pt_segm = pt_track; ii = 0; pt_segm = pt_track;
for( ; ii < nb_segm; ii++, pt_segm = (TRACK*) pt_segm->Pnext ) for( ; ii < nb_segm; ii++, pt_segm = (TRACK*) pt_segm->Pnext )
{ {
...@@ -197,12 +198,13 @@ void WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC ) ...@@ -197,12 +198,13 @@ void WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC )
/* Is the current segment Ok (no DRC error) ? */ /* Is the current segment Ok (no DRC error) ? */
if( Drc_On ) if( Drc_On )
{ {
if( Drc( this, DC, g_CurrentTrackSegment, m_Pcb->m_Track, 1 ) == BAD_DRC ) if( BAD_DRC==m_drc->Drc( g_CurrentTrackSegment, m_Pcb->m_Track ) )
/* DRC error, the change layer is not made */ /* DRC error, the change layer is not made */
return; return;
if( g_TwoSegmentTrackBuild && g_CurrentTrackSegment->Back() ) // We must handle 2 segments if( g_TwoSegmentTrackBuild && g_CurrentTrackSegment->Back() ) // We must handle 2 segments
{ {
if( Drc( this, DC, g_CurrentTrackSegment->Back(), m_Pcb->m_Track, 1 ) == BAD_DRC ) if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment->Back(), m_Pcb->m_Track ) )
return; return;
} }
} }
...@@ -248,7 +250,7 @@ void WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC ) ...@@ -248,7 +250,7 @@ void WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC )
Via->SetLayerPair( COPPER_LAYER_N, LAYER_CMP_N ); Via->SetLayerPair( COPPER_LAYER_N, LAYER_CMP_N );
} }
if( Drc_On &&( Drc( this, DC, Via, m_Pcb->m_Track, 1 ) == BAD_DRC ) ) if( Drc_On && BAD_DRC==m_drc->Drc( Via, m_Pcb->m_Track ) )
{ {
/* DRC fault: the Via cannot be placed here ... */ /* DRC fault: the Via cannot be placed here ... */
delete Via; delete Via;
......
...@@ -11,14 +11,13 @@ ...@@ -11,14 +11,13 @@
#include "autorout.h" #include "autorout.h"
#include "protos.h" #include "protos.h"
#include "drc_stuff.h"
/* Routines Locales */ /* Routines Locales */
static void Exit_Editrack( WinEDA_DrawPanel* panel, wxDC* DC ); static void Exit_Editrack( WinEDA_DrawPanel* panel, wxDC* DC );
void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel,
wxDC* DC, bool erase ); wxDC* DC, bool erase );
static int Add_45_degrees_Segment( WinEDA_BasePcbFrame* frame, wxDC* DC,
TRACK* ptfinsegment );
static void ComputeBreakPoint( TRACK* track, int n ); static void ComputeBreakPoint( TRACK* track, int n );
static TRACK* DeleteNullTrackSegments( BOARD* pcb, TRACK* track, int* segmcount ); static TRACK* DeleteNullTrackSegments( BOARD* pcb, TRACK* track, int* segmcount );
static void EnsureEndTrackOnPad( D_PAD* Pad ); static void EnsureEndTrackOnPad( D_PAD* Pad );
...@@ -160,9 +159,13 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC ) ...@@ -160,9 +159,13 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC )
g_CurrentTrackSegment->Display_Infos( this ); g_CurrentTrackSegment->Display_Infos( this );
SetCurItem( g_CurrentTrackSegment ); SetCurItem( g_CurrentTrackSegment );
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
if( Drc_On && (Drc( this, DC, g_CurrentTrackSegment, m_Pcb->m_Track, 1 ) == BAD_DRC) )
if( Drc_On )
{ {
return g_CurrentTrackSegment; if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, m_Pcb->m_Track ) )
{
return g_CurrentTrackSegment;
}
} }
} }
else /* Track in progress : segment coordinates are updated by ShowNewTrackWhenMovingCursor*/ else /* Track in progress : segment coordinates are updated by ShowNewTrackWhenMovingCursor*/
...@@ -170,12 +173,13 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC ) ...@@ -170,12 +173,13 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC )
/* Tst for a D.R.C. error: */ /* Tst for a D.R.C. error: */
if( Drc_On ) if( Drc_On )
{ {
if( Drc( this, DC, g_CurrentTrackSegment, m_Pcb->m_Track, 1 ) == BAD_DRC ) if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, m_Pcb->m_Track ) )
return NULL; return NULL;
if( g_TwoSegmentTrackBuild // We must handle 2 segments if( g_TwoSegmentTrackBuild // We must handle 2 segments
&& g_CurrentTrackSegment->Back() ) && g_CurrentTrackSegment->Back() )
{ {
if( Drc( this, DC, g_CurrentTrackSegment->Back(), m_Pcb->m_Track, 1 ) == BAD_DRC ) if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment->Back(), m_Pcb->m_Track ) )
return NULL; return NULL;
} }
} }
...@@ -196,7 +200,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC ) ...@@ -196,7 +200,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC )
if( g_Raccord_45_Auto ) if( g_Raccord_45_Auto )
{ {
if( Add_45_degrees_Segment( this, DC, g_CurrentTrackSegment ) != 0 ) if( Add_45_degrees_Segment( DC, g_CurrentTrackSegment ) != 0 )
g_TrackSegmentCount++; g_TrackSegmentCount++;
} }
Track = g_CurrentTrackSegment->Copy(); Track = g_CurrentTrackSegment->Copy();
...@@ -229,7 +233,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC ) ...@@ -229,7 +233,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC )
/**************************************************************************/ /**************************************************************************/
int Add_45_degrees_Segment( WinEDA_BasePcbFrame* frame, wxDC* DC, TRACK* pt_segm ) int WinEDA_PcbFrame::Add_45_degrees_Segment( wxDC* DC, TRACK* pt_segm )
/***************************************************************************/ /***************************************************************************/
/* rectifie un virage a 90 et le modifie par 2 coudes a 45 /* rectifie un virage a 90 et le modifie par 2 coudes a 45
...@@ -260,9 +264,9 @@ int Add_45_degrees_Segment( WinEDA_BasePcbFrame* frame, wxDC* DC, TRACK* pt_segm ...@@ -260,9 +264,9 @@ int Add_45_degrees_Segment( WinEDA_BasePcbFrame* frame, wxDC* DC, TRACK* pt_segm
return 0; return 0;
} }
pas_45 = frame->GetScreen()->GetGrid().x / 2; pas_45 = GetScreen()->GetGrid().x / 2;
if( pas_45 < pt_segm->m_Width ) if( pas_45 < pt_segm->m_Width )
pas_45 = frame->GetScreen()->GetGrid().x; pas_45 = GetScreen()->GetGrid().x;
while( pas_45 < pt_segm->m_Width ) while( pas_45 < pt_segm->m_Width )
pas_45 *= 2; pas_45 *= 2;
...@@ -309,7 +313,7 @@ int Add_45_degrees_Segment( WinEDA_BasePcbFrame* frame, wxDC* DC, TRACK* pt_segm ...@@ -309,7 +313,7 @@ int Add_45_degrees_Segment( WinEDA_BasePcbFrame* frame, wxDC* DC, TRACK* pt_segm
else else
NewTrack->m_End.x -= pas_45; NewTrack->m_End.x -= pas_45;
if( Drc_On && (Drc( frame, DC, pt_segm, frame->m_Pcb->m_Track, 1 ) == BAD_DRC) ) if( Drc_On && BAD_DRC==m_drc->Drc( pt_segm, m_Pcb->m_Track ) )
{ {
delete NewTrack; delete NewTrack;
return 0; return 0;
...@@ -317,7 +321,7 @@ int Add_45_degrees_Segment( WinEDA_BasePcbFrame* frame, wxDC* DC, TRACK* pt_segm ...@@ -317,7 +321,7 @@ int Add_45_degrees_Segment( WinEDA_BasePcbFrame* frame, wxDC* DC, TRACK* pt_segm
Previous->m_End = NewTrack->m_Start; Previous->m_End = NewTrack->m_Start;
pt_segm->m_Start = NewTrack->m_End; pt_segm->m_Start = NewTrack->m_End;
NewTrack->Insert( frame->m_Pcb, Previous ); NewTrack->Insert( m_Pcb, Previous );
return 1; return 1;
} }
...@@ -345,7 +349,7 @@ int Add_45_degrees_Segment( WinEDA_BasePcbFrame* frame, wxDC* DC, TRACK* pt_segm ...@@ -345,7 +349,7 @@ int Add_45_degrees_Segment( WinEDA_BasePcbFrame* frame, wxDC* DC, TRACK* pt_segm
else else
NewTrack->m_End.y -= pas_45; NewTrack->m_End.y -= pas_45;
if( Drc_On && (Drc( frame, DC, NewTrack, frame->m_Pcb->m_Track, 1 ) == BAD_DRC) ) if( Drc_On && BAD_DRC==m_drc->Drc( NewTrack, m_Pcb->m_Track ) )
{ {
delete NewTrack; delete NewTrack;
return 0; return 0;
...@@ -353,7 +357,7 @@ int Add_45_degrees_Segment( WinEDA_BasePcbFrame* frame, wxDC* DC, TRACK* pt_segm ...@@ -353,7 +357,7 @@ int Add_45_degrees_Segment( WinEDA_BasePcbFrame* frame, wxDC* DC, TRACK* pt_segm
Previous->m_End = NewTrack->m_Start; Previous->m_End = NewTrack->m_Start;
pt_segm->m_Start = NewTrack->m_End; pt_segm->m_Start = NewTrack->m_End;
NewTrack->Insert( frame->m_Pcb, Previous ); NewTrack->Insert( m_Pcb, Previous );
return 1; return 1;
} }
...@@ -378,7 +382,7 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC ) ...@@ -378,7 +382,7 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC )
if( track == NULL ) if( track == NULL )
return; return;
if( Drc_On && Drc( this, DC, g_CurrentTrackSegment, m_Pcb->m_Track, 1 )==BAD_DRC ) if( Drc_On && BAD_DRC==m_drc->Drc( g_CurrentTrackSegment, m_Pcb->m_Track) )
return; return;
/* Sauvegarde des coord du point terminal de la piste */ /* Sauvegarde des coord du point terminal de la piste */
......
...@@ -75,7 +75,7 @@ void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event ) ...@@ -75,7 +75,7 @@ void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event )
if( marker ) if( marker )
{ {
foundItem = marker; foundItem = marker;
locate_pos = marker->m_Pos; locate_pos = marker->GetPosition();
} }
} }
else else
...@@ -89,7 +89,7 @@ void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event ) ...@@ -89,7 +89,7 @@ void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event )
if( StartCount > s_ItemCount ) if( StartCount > s_ItemCount )
{ {
foundItem = module; foundItem = module;
locate_pos = module->m_Pos; locate_pos = module->GetPosition();
s_ItemCount++; s_ItemCount++;
break; break;
} }
......
...@@ -351,5 +351,6 @@ void WinEDA_PcbFrame::Erase_Marqueurs() ...@@ -351,5 +351,6 @@ void WinEDA_PcbFrame::Erase_Marqueurs()
{ {
m_Pcb->DeleteMARKERs(); m_Pcb->DeleteMARKERs();
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
...@@ -783,14 +783,14 @@ bool WinEDA_PcbFrame::PlaceDraggedTrackSegment( TRACK* Track, wxDC* DC ) ...@@ -783,14 +783,14 @@ bool WinEDA_PcbFrame::PlaceDraggedTrackSegment( TRACK* Track, wxDC* DC )
// DRC control: // DRC control:
if( Drc_On ) if( Drc_On )
{ {
errdrc = Drc( this, DC, Track, m_Pcb->m_Track, 1 ); errdrc = m_drc->Drc( Track, m_Pcb->m_Track );
if( errdrc == BAD_DRC ) if( errdrc == BAD_DRC )
return FALSE; return FALSE;
/* Redraw the dragged segments */ /* Redraw the dragged segments */
pt_drag = g_DragSegmentList; pt_drag = g_DragSegmentList;
for( ; pt_drag != NULL; pt_drag = pt_drag->Pnext ) for( ; pt_drag != NULL; pt_drag = pt_drag->Pnext )
{ {
errdrc = Drc( this, DC, pt_drag->m_Segm, m_Pcb->m_Track, 1 ); errdrc = m_drc->Drc( pt_drag->m_Segm, m_Pcb->m_Track );
if( errdrc == BAD_DRC ) if( errdrc == BAD_DRC )
return FALSE; return FALSE;
} }
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "bitmaps.h" #include "bitmaps.h"
#include "protos.h" #include "protos.h"
#include "id.h" #include "id.h"
#include "drc_stuff.h"
/*******************************/ /*******************************/
...@@ -191,6 +192,8 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, ...@@ -191,6 +192,8 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent,
m_ZoomMaxValue = 2048; m_ZoomMaxValue = 2048;
m_SelTrackWidthBox_Changed = FALSE; m_SelTrackWidthBox_Changed = FALSE;
m_SelViaSizeBox_Changed = FALSE; m_SelViaSizeBox_Changed = FALSE;
m_drc = new DRC( this ); // these 2 objects point to each other
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill; m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
m_DisplayPadFill = DisplayOpt.DisplayPadFill; m_DisplayPadFill = DisplayOpt.DisplayPadFill;
...@@ -237,6 +240,7 @@ WinEDA_PcbFrame::~WinEDA_PcbFrame() ...@@ -237,6 +240,7 @@ WinEDA_PcbFrame::~WinEDA_PcbFrame()
{ {
m_Parent->m_PcbFrame = NULL; m_Parent->m_PcbFrame = NULL;
m_CurrentScreen = ScreenPcb; m_CurrentScreen = ScreenPcb;
delete m_drc;
} }
......
...@@ -380,8 +380,8 @@ static int Route_1_Trace( WinEDA_PcbFrame* pcbframe, wxDC* DC, ...@@ -380,8 +380,8 @@ static int Route_1_Trace( WinEDA_PcbFrame* pcbframe, wxDC* DC,
int cY = (g_GridRoutingSize * row_source) + pcbframe->m_Pcb->m_BoundaryBox.m_Pos.y; int cY = (g_GridRoutingSize * row_source) + pcbframe->m_Pcb->m_BoundaryBox.m_Pos.y;
int dx = pt_cur_ch->pad_start->m_Size.x / 2; int dx = pt_cur_ch->pad_start->m_Size.x / 2;
int dy = pt_cur_ch->pad_start->m_Size.y / 2; int dy = pt_cur_ch->pad_start->m_Size.y / 2;
int px = pt_cur_ch->pad_start->m_Pos.x; int px = pt_cur_ch->pad_start->GetPosition().x;
int py = pt_cur_ch->pad_start->m_Pos.y; int py = pt_cur_ch->pad_start->GetPosition().y;
if( ( (pt_cur_ch->pad_start->m_Orient / 900) & 1 ) != 0 ) if( ( (pt_cur_ch->pad_start->m_Orient / 900) & 1 ) != 0 )
EXCHG( dx, dy ); EXCHG( dx, dy );
...@@ -392,8 +392,8 @@ static int Route_1_Trace( WinEDA_PcbFrame* pcbframe, wxDC* DC, ...@@ -392,8 +392,8 @@ static int Route_1_Trace( WinEDA_PcbFrame* pcbframe, wxDC* DC,
cY = (g_GridRoutingSize * row_target) + pcbframe->m_Pcb->m_BoundaryBox.m_Pos.y; cY = (g_GridRoutingSize * row_target) + pcbframe->m_Pcb->m_BoundaryBox.m_Pos.y;
dx = pt_cur_ch->pad_end->m_Size.x / 2; dx = pt_cur_ch->pad_end->m_Size.x / 2;
dy = pt_cur_ch->pad_end->m_Size.y / 2; dy = pt_cur_ch->pad_end->m_Size.y / 2;
px = pt_cur_ch->pad_end->m_Pos.x; px = pt_cur_ch->pad_end->GetPosition().x;
py = pt_cur_ch->pad_end->m_Pos.y; py = pt_cur_ch->pad_end->GetPosition().y;
if( ( (pt_cur_ch->pad_end->m_Orient / 900) & 1 ) != 0 ) if( ( (pt_cur_ch->pad_end->m_Orient / 900) & 1 ) != 0 )
EXCHG( dx, dy ); EXCHG( dx, dy );
...@@ -968,14 +968,13 @@ static void OrCell_Trace( BOARD* pcb, int col, int row, ...@@ -968,14 +968,13 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
/* Replacement sur le centre du pad si hors grille */ /* Replacement sur le centre du pad si hors grille */
dx1 = g_CurrentTrackSegment->m_End.x - g_CurrentTrackSegment->m_Start.x; dx1 = g_CurrentTrackSegment->m_End.x - g_CurrentTrackSegment->m_Start.x;
dy1 = g_CurrentTrackSegment->m_End.y - g_CurrentTrackSegment->m_Start.y; dy1 = g_CurrentTrackSegment->m_End.y - g_CurrentTrackSegment->m_Start.y;
dx0 = pt_cur_ch->pad_end->m_Pos.x - g_CurrentTrackSegment->m_Start.x; dx0 = pt_cur_ch->pad_end->GetPosition().x - g_CurrentTrackSegment->m_Start.x;
dy0 = pt_cur_ch->pad_end->m_Pos.y - g_CurrentTrackSegment->m_Start.y; dy0 = pt_cur_ch->pad_end->GetPosition().y - g_CurrentTrackSegment->m_Start.y;
/* si aligne: modif du point origine */ /* si aligne: modif du point origine */
if( abs( dx0 * dy1 ) == abs( dx1 * dy0 ) ) /* Alignes ! */ if( abs( dx0 * dy1 ) == abs( dx1 * dy0 ) ) /* Alignes ! */
{ {
g_CurrentTrackSegment->m_Start.x = pt_cur_ch->pad_end->m_Pos.x; g_CurrentTrackSegment->m_Start = pt_cur_ch->pad_end->GetPosition();
g_CurrentTrackSegment->m_Start.y = pt_cur_ch->pad_end->m_Pos.y;
} }
else /* Creation d'un segment suppl raccord */ else /* Creation d'un segment suppl raccord */
{ {
...@@ -983,10 +982,9 @@ static void OrCell_Trace( BOARD* pcb, int col, int row, ...@@ -983,10 +982,9 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
g_TrackSegmentCount++; g_TrackSegmentCount++;
NewTrack->Insert( pcb, g_CurrentTrackSegment ); NewTrack->Insert( pcb, g_CurrentTrackSegment );
g_CurrentTrackSegment->m_Start.x = pt_cur_ch->pad_end->m_Pos.x; g_CurrentTrackSegment->m_Start = pt_cur_ch->pad_end->GetPosition();
g_CurrentTrackSegment->m_Start.y = pt_cur_ch->pad_end->m_Pos.y;
NewTrack->m_Start.x = g_CurrentTrackSegment->m_End.x; NewTrack->m_Start = g_CurrentTrackSegment->m_End;
NewTrack->m_Start.y = g_CurrentTrackSegment->m_End.y;
g_CurrentTrackSegment = NewTrack; g_CurrentTrackSegment = NewTrack;
} }
...@@ -1053,26 +1051,25 @@ static void Place_Piste_en_Buffer( WinEDA_PcbFrame* pcbframe, wxDC* DC ) ...@@ -1053,26 +1051,25 @@ static void Place_Piste_en_Buffer( WinEDA_PcbFrame* pcbframe, wxDC* DC )
dy1 = g_CurrentTrackSegment->m_End.y - g_CurrentTrackSegment->m_Start.y; dy1 = g_CurrentTrackSegment->m_End.y - g_CurrentTrackSegment->m_Start.y;
/* Replacement sur le centre du pad si hors grille */ /* Replacement sur le centre du pad si hors grille */
dx0 = pt_cur_ch->pad_start->m_Pos.x - g_CurrentTrackSegment->m_Start.x; dx0 = pt_cur_ch->pad_start->GetPosition().x - g_CurrentTrackSegment->m_Start.x;
dy0 = pt_cur_ch->pad_start->m_Pos.y - g_CurrentTrackSegment->m_Start.y; dy0 = pt_cur_ch->pad_start->GetPosition().y - g_CurrentTrackSegment->m_Start.y;
/* si aligne: modif du point origine */ /* si aligne: modif du point origine */
if( abs( dx0 * dy1 ) == abs( dx1 * dy0 ) ) /* Alignes ! */ if( abs( dx0 * dy1 ) == abs( dx1 * dy0 ) ) /* Alignes ! */
{ {
g_CurrentTrackSegment->m_End.x = pt_cur_ch->pad_start->m_Pos.x; g_CurrentTrackSegment->m_End = pt_cur_ch->pad_start->GetPosition();
g_CurrentTrackSegment->m_End.y = pt_cur_ch->pad_start->m_Pos.y;
} }
else /* Creation d'un segment suppl raccord */ else /* Creation d'un segment suppl raccord */
{ {
TRACK* NewTrack = g_CurrentTrackSegment->Copy(); TRACK* NewTrack = g_CurrentTrackSegment->Copy();
NewTrack->Insert( pcbframe->m_Pcb, g_CurrentTrackSegment ); NewTrack->Insert( pcbframe->m_Pcb, g_CurrentTrackSegment );
NewTrack->m_End.x = pt_cur_ch->pad_start->m_Pos.x; NewTrack->m_End = pt_cur_ch->pad_start->GetPosition();
NewTrack->m_End.y = pt_cur_ch->pad_start->m_Pos.y;
NewTrack->m_Start.x = g_CurrentTrackSegment->m_End.x; NewTrack->m_Start = g_CurrentTrackSegment->m_End;
NewTrack->m_Start.y = g_CurrentTrackSegment->m_End.y;
g_CurrentTrackSegment = NewTrack; g_TrackSegmentCount++; g_CurrentTrackSegment = NewTrack;
g_TrackSegmentCount++;
} }
......
...@@ -40,7 +40,6 @@ static void Display_Zone_Netname( WinEDA_PcbFrame* frame ); ...@@ -40,7 +40,6 @@ static void Display_Zone_Netname( WinEDA_PcbFrame* frame );
static void Exit_Zones( WinEDA_DrawPanel* Panel, wxDC* DC ); static void Exit_Zones( WinEDA_DrawPanel* Panel, wxDC* DC );
static void Show_Zone_Edge_While_MoveMouse( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void Show_Zone_Edge_While_MoveMouse( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static void Genere_Segments_Zone( WinEDA_PcbFrame* frame, wxDC* DC, int net_code ); static void Genere_Segments_Zone( WinEDA_PcbFrame* frame, wxDC* DC, int net_code );
static bool Genere_Pad_Connexion( WinEDA_PcbFrame* frame, wxDC* DC, int layer );
/* Local variables */ /* Local variables */
static bool Zone_Debug = FALSE; static bool Zone_Debug = FALSE;
...@@ -1037,7 +1036,7 @@ void WinEDA_PcbFrame::Fill_Zone( wxDC* DC ) ...@@ -1037,7 +1036,7 @@ void WinEDA_PcbFrame::Fill_Zone( wxDC* DC )
/* Create the thermal reliefs */ /* Create the thermal reliefs */
g_DesignSettings.m_CurrentTrackWidth = lp_tmp; g_DesignSettings.m_CurrentTrackWidth = lp_tmp;
if( Zone_Exclude_Pads && s_Zone_Create_Thermal_Relief ) if( Zone_Exclude_Pads && s_Zone_Create_Thermal_Relief )
Genere_Pad_Connexion( this, DC, GetScreen()->m_Active_Layer ); Genere_Pad_Connexion( DC, GetScreen()->m_Active_Layer );
g_DesignSettings.m_TrackClearence = save_isol; g_DesignSettings.m_TrackClearence = save_isol;
...@@ -1313,7 +1312,7 @@ int Propagation( WinEDA_PcbFrame* frame ) ...@@ -1313,7 +1312,7 @@ int Propagation( WinEDA_PcbFrame* frame )
/*****************************************************************************/ /*****************************************************************************/
static bool Genere_Pad_Connexion( WinEDA_PcbFrame* frame, wxDC* DC, int layer ) bool WinEDA_PcbFrame::Genere_Pad_Connexion( wxDC* DC, int layer )
/*****************************************************************************/ /*****************************************************************************/
/* Create the thermal relief for each pad in the zone: /* Create the thermal relief for each pad in the zone:
...@@ -1329,16 +1328,16 @@ static bool Genere_Pad_Connexion( WinEDA_PcbFrame* frame, wxDC* DC, int layer ) ...@@ -1329,16 +1328,16 @@ static bool Genere_Pad_Connexion( WinEDA_PcbFrame* frame, wxDC* DC, int layer )
int sommet[4][2]; int sommet[4][2];
wxString msg; wxString msg;
if( frame->m_Pcb->m_Zone == NULL ) if( m_Pcb->m_Zone == NULL )
return FALSE; /* error: no zone */ return FALSE; /* error: no zone */
if( frame->m_Pcb->m_Zone->m_TimeStamp != s_TimeStamp ) /* error: this is not the new zone */ if( m_Pcb->m_Zone->m_TimeStamp != s_TimeStamp ) /* error: this is not the new zone */
return FALSE; return FALSE;
/* Count the pads, i.e. the thermal relief to create count, and displays it */ /* Count the pads, i.e. the thermal relief to create count, and displays it */
Affiche_1_Parametre( frame, 50, wxT( "NPads" ), wxT( " " ), CYAN ); Affiche_1_Parametre( this, 50, wxT( "NPads" ), wxT( " " ), CYAN );
pt_liste_pad = (LISTE_PAD*) frame->m_Pcb->m_Pads; pt_liste_pad = (LISTE_PAD*) m_Pcb->m_Pads;
for( ii = 0, Npads = 0; ii < frame->m_Pcb->m_NbPads; ii++, pt_liste_pad++ ) for( ii = 0, Npads = 0; ii < m_Pcb->m_NbPads; ii++, pt_liste_pad++ )
{ {
pt_pad = *pt_liste_pad; pt_pad = *pt_liste_pad;
...@@ -1353,12 +1352,12 @@ static bool Genere_Pad_Connexion( WinEDA_PcbFrame* frame, wxDC* DC, int layer ) ...@@ -1353,12 +1352,12 @@ static bool Genere_Pad_Connexion( WinEDA_PcbFrame* frame, wxDC* DC, int layer )
} }
msg.Printf( wxT( "%d" ), Npads ); msg.Printf( wxT( "%d" ), Npads );
Affiche_1_Parametre( frame, -1, wxEmptyString, msg, CYAN ); Affiche_1_Parametre( this, -1, wxEmptyString, msg, CYAN );
/* Create the thermal reliefs */ /* Create the thermal reliefs */
Affiche_1_Parametre( frame, 57, wxT( "Pads" ), wxT( " " ), CYAN ); Affiche_1_Parametre( this, 57, wxT( "Pads" ), wxT( " " ), CYAN );
pt_liste_pad = (LISTE_PAD*) frame->m_Pcb->m_Pads; pt_liste_pad = (LISTE_PAD*) m_Pcb->m_Pads;
for( ii = 0, Npads = 0; ii < frame->m_Pcb->m_NbPads; ii++, pt_liste_pad++ ) for( ii = 0, Npads = 0; ii < m_Pcb->m_NbPads; ii++, pt_liste_pad++ )
{ {
pt_pad = *pt_liste_pad; pt_pad = *pt_liste_pad;
...@@ -1370,11 +1369,17 @@ static bool Genere_Pad_Connexion( WinEDA_PcbFrame* frame, wxDC* DC, int layer ) ...@@ -1370,11 +1369,17 @@ static bool Genere_Pad_Connexion( WinEDA_PcbFrame* frame, wxDC* DC, int layer )
continue; continue;
/* Create the theram relief for the current pad */ /* Create the theram relief for the current pad */
Npads++; msg.Printf( wxT( "%d" ), Npads ); Npads++;
Affiche_1_Parametre( frame, -1, wxEmptyString, msg, CYAN );
cX = pt_pad->m_Pos.x; cY = pt_pad->m_Pos.y; msg.Printf( wxT( "%d" ), Npads );
Affiche_1_Parametre( this, -1, wxEmptyString, msg, CYAN );
cX = pt_pad->GetPosition().x;
cY = pt_pad->GetPosition().y;
dx = pt_pad->m_Size.x / 2; dx = pt_pad->m_Size.x / 2;
dy = pt_pad->m_Size.y / 2; dy = pt_pad->m_Size.y / 2;
dx += g_DesignSettings.m_TrackClearence + g_GridRoutingSize; dx += g_DesignSettings.m_TrackClearence + g_GridRoutingSize;
dy += g_DesignSettings.m_TrackClearence + g_GridRoutingSize; dy += g_DesignSettings.m_TrackClearence + g_GridRoutingSize;
...@@ -1395,7 +1400,7 @@ static bool Genere_Pad_Connexion( WinEDA_PcbFrame* frame, wxDC* DC, int layer ) ...@@ -1395,7 +1400,7 @@ static bool Genere_Pad_Connexion( WinEDA_PcbFrame* frame, wxDC* DC, int layer )
{ {
RotatePoint( &sommet[jj][0], &sommet[jj][1], angle ); RotatePoint( &sommet[jj][0], &sommet[jj][1], angle );
pt_track = new SEGZONE( frame->m_Pcb ); pt_track = new SEGZONE( m_Pcb );
pt_track->SetLayer( layer ); pt_track->SetLayer( layer );
pt_track->m_Width = g_DesignSettings.m_CurrentTrackWidth; pt_track->m_Width = g_DesignSettings.m_CurrentTrackWidth;
...@@ -1407,20 +1412,22 @@ static bool Genere_Pad_Connexion( WinEDA_PcbFrame* frame, wxDC* DC, int layer ) ...@@ -1407,20 +1412,22 @@ static bool Genere_Pad_Connexion( WinEDA_PcbFrame* frame, wxDC* DC, int layer )
pt_track->m_TimeStamp = s_TimeStamp; pt_track->m_TimeStamp = s_TimeStamp;
/* Test if the segment is allowed */ /* Test if the segment is allowed */
if( Drc( frame, DC, pt_track, frame->m_Pcb->m_Track, 0 ) == BAD_DRC ) if( BAD_DRC==m_drc->DrcBlind( pt_track, m_Pcb->m_Track ) )
{ {
delete pt_track; continue; delete pt_track;
continue;
} }
/* Search for a zone segment */ /* Search for a zone segment */
loctrack = Locate_Zone( frame->m_Pcb->m_Zone, pt_track->m_End, layer ); loctrack = Locate_Zone( m_Pcb->m_Zone, pt_track->m_End, layer );
if( (loctrack == NULL) || (loctrack->m_TimeStamp != s_TimeStamp) ) if( (loctrack == NULL) || (loctrack->m_TimeStamp != s_TimeStamp) )
{ {
delete pt_track; continue; delete pt_track;
continue;
} }
pt_track->Insert( frame->m_Pcb, NULL ); pt_track->Insert( m_Pcb, NULL );
pt_track->Draw( frame->DrawPanel, DC, GR_OR ); pt_track->Draw( DrawPanel, DC, GR_OR );
} }
} }
......
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