injected DLIST<> into many list heads, see change_log.txt

This commit is contained in:
dickelbeck 2008-12-04 04:28:11 +00:00
parent 67fa1ddb92
commit aab39d1de7
137 changed files with 2533 additions and 3079 deletions

View File

@ -70,8 +70,8 @@ void Struct3D_Master::Copy( Struct3D_Master* pattern )
/***************************************************************/
Struct3D_Master::Struct3D_Master( EDA_BaseStruct* StructFather ) :
EDA_BaseStruct( StructFather, NOT_USED )
Struct3D_Master::Struct3D_Master( EDA_BaseStruct* aParent ) :
EDA_BaseStruct( aParent, NOT_USED )
/***************************************************************/
{
m_MatScale.x = m_MatScale.y = m_MatScale.z = 1.0;
@ -102,8 +102,8 @@ Struct3D_Master:: ~Struct3D_Master()
/***************************************************************/
Struct3D_Shape::Struct3D_Shape( EDA_BaseStruct* StructFather ) :
EDA_BaseStruct( StructFather, NOT_USED )
Struct3D_Shape::Struct3D_Shape( EDA_BaseStruct* aParent ) :
EDA_BaseStruct( aParent, NOT_USED )
/***************************************************************/
{
m_3D_Coord = NULL;

View File

@ -197,7 +197,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
/* draw tracks and vias : */
for( track = pcb->m_Track; track != NULL; track = track->Next() )
{
if( track->Type() == TYPEVIA )
if( track->Type() == TYPE_VIA )
Draw3D_Via( (SEGVIA*) track );
else
Draw3D_Track( track );
@ -207,7 +207,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
{
for( segzone = pcb->m_Zone; segzone != NULL; segzone = segzone->Next() )
{
if( segzone->Type() == TYPEZONE )
if( segzone->Type() == TYPE_ZONE )
Draw3D_Track( segzone );
}
}
@ -218,11 +218,11 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
{
switch( PtStruct->Type() )
{
case TYPEDRAWSEGMENT:
case TYPE_DRAWSEGMENT:
Draw3D_DrawSegment( (DRAWSEGMENT*) PtStruct );
break;
case TYPETEXTE:
case TYPE_TEXTE:
Draw3D_DrawText( (TEXTE_PCB*) PtStruct );
break;
@ -513,10 +513,10 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
{
switch( Struct->Type() )
{
case TYPETEXTEMODULE:
case TYPE_TEXTE_MODULE:
break;
case TYPEEDGEMODULE:
case TYPE_EDGE_MODULE:
( (EDGE_MODULE*) Struct )->Draw3D( glcanvas );
break;

View File

@ -70,7 +70,7 @@ public:
public:
Struct3D_Master( EDA_BaseStruct * StructFather );
Struct3D_Master( EDA_BaseStruct * aParent );
~Struct3D_Master();
Struct3D_Master* Next() const { return (Struct3D_Master*) Pnext; }
@ -105,7 +105,7 @@ public:
public:
Struct3D_Shape( EDA_BaseStruct * StructFather );
Struct3D_Shape( EDA_BaseStruct * aParent );
~Struct3D_Shape();
Struct3D_Shape* Next() const { return (Struct3D_Shape*) Pnext; }

View File

@ -5,6 +5,36 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2008-Dec-3 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++pcbnew & gerbview
* added g_CurrentTrackList, and made g_CurrentTrackSegment and g_FirstTrackSegment
be #defines into this DLIST<TRACK>, see pcbnew.h.
* Switched datatype of BOARD::m_Track, BOARD::m_Zone, etc to DLIST<>.
This simplifies BOARD::~BOARD() somewhat, and adds automatic counting of list elements and encapsulation
of all list operations into DHEAD member functions, see common/dlist.cpp.
* Removed TRACK::Insert() since it no long fits with the new BOARD::m_Track and BOARD::m_Zone datatypes.
* Removed the g_UnDeleteStack support from <any>::UnLink(), this may leave a deficiency, but this code needs
to be external to UnLink() anyway.
* Made TRACK::SetNext() and TRACK::SetBack() private so they may not be used,
the only way to put a TRACK on a list is through DLIST<TRACK>::PushFront()
and other member functions of DLIST<TRACK>.
* Switched to std::vector<TRACK*> in track.cpp to hold the temporary static list.
* Made g_UnDeleteStack be a DLIST<TRACK>.
* renamed some KICAD_T to more closely match the corresponding classname.
* Changed to DLIST<> for almost all the list heads in BOARD.
++gerbview
* switched to GR_COPY mode for drawing so we can see the erasures. debugged
erasures in rs274d.cpp.
* Now using order specific TRACK loading, so erasures come after objects they
are intended to erase. Still need layer ordering and polygon ordering support, my todo.
I do not like DeleteStructList() and plan to migrate away from it, DLIST<>:DeletAll()
does something like it.
=======
2008-Dec-03 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
++pcbnew
@ -13,6 +43,7 @@ email address.
results are same, but using segments can be better (faster redraw time) for polygons having a lot
of segments (more than 10000)
>>>>>>> .r1441
2008-Dec-02 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++build fixes

View File

@ -156,8 +156,6 @@ void DHEAD::remove( EDA_BaseStruct* aElement )
aElement->SetList( 0 );
--count;
D( VerifyListIntegrity(); );
}
#if defined(DEBUG)
@ -191,6 +189,8 @@ void DHEAD::VerifyListIntegrity()
wxASSERT( item == NULL );
wxASSERT( i == count );
// printf("list %p has %d items.\n", this, count );
}
#endif

View File

@ -51,15 +51,13 @@ void WinEDA_CvpcbFrame::CreateScreenCmp()
DrawFrame->SetStatusText( msg, 0 );
if( DrawFrame->m_Pcb->m_Modules )
if( DrawFrame->m_Pcb->m_Modules.GetCount() )
{
// there is only one module in the list
DrawFrame->m_Pcb->m_Modules->DeleteStructure();
DrawFrame->m_Pcb->m_Modules = NULL;
DrawFrame->m_Pcb->m_Modules.DeleteAll();
}
DrawFrame->m_Pcb->m_Modules = DrawFrame->Get_Module( FootprintName );
DrawFrame->m_Pcb->m_Modules.PushBack( DrawFrame->Get_Module( FootprintName ) );
DrawFrame->Zoom_Automatique( FALSE );
if( DrawFrame->m_Draw3DFrame )

View File

@ -851,7 +851,7 @@ static SCH_ITEM * CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* sc
;
}
SetStructFather( Struct, screen );
SetaParent( Struct, screen );
PickedList = (DrawPickedStruct*) PickedList->Next();
}
@ -900,7 +900,7 @@ static SCH_ITEM * CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* sc
RedrawOneStruct( panel, DC, NewDrawStruct, GR_DEFAULT_DRAWMODE );
SetStructFather( NewDrawStruct, screen );
SetaParent( NewDrawStruct, screen );
NewDrawStruct->SetNext( screen->EEDrawList );
screen->EEDrawList = NewDrawStruct;
}
@ -1052,7 +1052,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
{
( (SCH_COMPONENT*) Struct )->m_TimeStamp = GetTimeStamp();
( (SCH_COMPONENT*) Struct )->ClearAnnotation(NULL);
SetStructFather( Struct, GetScreen() );
SetaParent( Struct, GetScreen() );
}
PickedList = (DrawPickedStruct*) PickedList->Next();
}
@ -1062,7 +1062,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
{
SCH_ITEM * Struct = PickedList->m_PickedStruct;
Struct->SetNext( GetScreen()->EEDrawList );
SetStructFather( Struct, GetScreen() );
SetaParent( Struct, GetScreen() );
GetScreen()->EEDrawList = Struct;
PickedList = PickedList->Next();
}
@ -1077,7 +1077,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
( (SCH_COMPONENT*) DrawStruct )->m_TimeStamp = GetTimeStamp();
( (SCH_COMPONENT*) DrawStruct )->ClearAnnotation(NULL);
}
SetStructFather( DrawStruct, GetScreen() );
SetaParent( DrawStruct, GetScreen() );
RedrawOneStruct( DrawPanel, DC, DrawStruct, GR_DEFAULT_DRAWMODE );
DrawStruct->SetNext( GetScreen()->EEDrawList );
GetScreen()->EEDrawList = DrawStruct;

View File

@ -11,7 +11,7 @@
/******************************************************************/
void SetStructFather( EDA_BaseStruct* Struct, BASE_SCREEN* Screen )
void SetaParent( EDA_BaseStruct* Struct, BASE_SCREEN* Screen )
/******************************************************************/
{
switch( Struct->Type() )

View File

@ -371,7 +371,7 @@ DrawPickedStruct * BreakSegment(SCH_SCREEN * screen, wxPoint breakpoint,
/* EECLASS.CPP */
/**************/
void SetStructFather(EDA_BaseStruct * Struct, BASE_SCREEN * Screen);
void SetaParent(EDA_BaseStruct * Struct, BASE_SCREEN * Screen);
/***************/
/* LIBALIAS.CPP */

View File

@ -43,6 +43,7 @@ set(GERBVIEW_SRCS
set(GERBVIEW_EXTRA_SRCS
../pcbnew/basepcbframe.cpp
../pcbnew/class_board.cpp
../pcbnew/class_board_item.cpp
../pcbnew/class_board_connected_item.cpp
../pcbnew/class_drawsegment.cpp
../pcbnew/class_drc_item.cpp

View File

@ -25,7 +25,7 @@ void Affiche_Infos_PCB_Texte( WinEDA_BasePcbFrame* frame, TEXTE_PCB* pt_texte )
frame->MsgPanel->EraseMsgBox();
if( pt_texte->Type() == TYPECOTATION )
if( pt_texte->Type() == TYPE_COTATION )
Affiche_1_Parametre( frame, 1, _( "COTATION" ), pt_texte->m_Text, DARKGREEN );
else

View File

@ -398,7 +398,8 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
/* this track segment must be duplicated */
m_Pcb->m_Status_Pcb = 0;
TRACK* new_track = track->Copy();
new_track->Insert( m_Pcb, NULL );
m_Pcb->Add( new_track );
new_track->m_Start += delta;
new_track->m_End += delta;
@ -417,7 +418,8 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
{
/* this zone segment must be duplicated */
SEGZONE * new_zsegment = (SEGZONE*) zsegment->Copy();
new_zsegment->Insert( m_Pcb, NULL );
m_Pcb->Add( new_zsegment );
new_zsegment->m_Start += delta;
new_zsegment->m_End += delta;

View File

@ -55,29 +55,19 @@ TRACK* WinEDA_GerberFrame::Delete_Segment( wxDC* DC, TRACK* Track )
if( Track->m_Flags & IS_NEW ) // Trace en cours, on peut effacer le dernier segment
{
if( g_TrackSegmentCount > 0 )
if( g_CurrentTrackList.GetCount() > 0 )
{
// modification du trace
Track = g_CurrentTrackSegment;
g_CurrentTrackSegment = g_CurrentTrackSegment->Back();
delete g_CurrentTrackList.PopBack();
delete Track;
g_TrackSegmentCount--;
if( g_TrackSegmentCount && (g_CurrentTrackSegment->Type() == TYPEVIA) )
if( g_CurrentTrackList.GetCount() && g_CurrentTrackSegment->Type() == TYPE_VIA )
{
Track = g_CurrentTrackSegment;
g_CurrentTrackSegment = g_CurrentTrackSegment->Back();
delete Track;
g_TrackSegmentCount--;
delete g_CurrentTrackList.PopBack();
}
if( g_CurrentTrackSegment )
g_CurrentTrackSegment->SetNext( NULL );
Affiche_Status_Box();
if( g_TrackSegmentCount == 0 )
if( g_CurrentTrackList.GetCount() == 0 )
{
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;

View File

@ -60,7 +60,7 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DrawStruct = GerberGeneralLocateAndDisplay();
if( DrawStruct == NULL )
break;
if( DrawStruct->Type() == TYPETRACK )
if( DrawStruct->Type() == TYPE_TRACK )
{
Delete_Segment( DC, (TRACK*) DrawStruct );
GetScreen()->SetCurItem( NULL );

View File

@ -155,14 +155,14 @@ static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, FILE* aFile,
if( pcb_layer_number > LAST_COPPER_LAYER )
{
DRAWSEGMENT* drawitem = new DRAWSEGMENT( pcb, TYPEDRAWSEGMENT );
DRAWSEGMENT* drawitem = new DRAWSEGMENT( pcb, TYPE_DRAWSEGMENT );
drawitem->SetLayer( pcb_layer_number );
drawitem->m_Start = track->m_Start;
drawitem->m_End = track->m_End;
drawitem->m_Width = track->m_Width;
drawitem->SetNext( pcb->m_Drawings );
pcb->m_Drawings = drawitem;
pcb->Add( drawitem );
}
else
{
@ -195,7 +195,7 @@ static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, FILE* aFile,
newtrack->SetLayer( pcb_layer_number );
}
newtrack->Insert( pcb, NULL );
pcb->Add( newtrack );
}
}

View File

@ -36,16 +36,11 @@ bool WinEDA_GerberFrame::Clear_Pcb( bool query )
}
}
m_Pcb->m_Drawings->DeleteStructList();
m_Pcb->m_Drawings = NULL;
m_Pcb->m_Drawings.DeleteAll();
m_Pcb->m_Track->DeleteStructList();
m_Pcb->m_Track = NULL;
m_Pcb->m_NbSegmTrack = 0;
m_Pcb->m_Track.DeleteAll();
m_Pcb->m_Zone->DeleteStructList();
m_Pcb->m_Zone = NULL;
m_Pcb->m_NbSegmZone = 0;
m_Pcb->m_Zone.DeleteAll();
for( ; g_UnDeleteStackPtr != 0; )
{
@ -66,12 +61,8 @@ bool WinEDA_GerberFrame::Clear_Pcb( bool query )
m_Pcb->m_Status_Pcb = 0;
m_Pcb->m_NbLoclinks = 0;
m_Pcb->m_NbLinks = 0;
m_Pcb->m_NbPads = 0;
m_Pcb->m_NbNets = 0;
m_Pcb->m_NbNodes = 0;
m_Pcb->m_NbNoconnect = 0;
m_Pcb->m_NbSegmTrack = 0;
m_Pcb->m_NbSegmZone = 0;
/* Init parametres de gestion des ecrans PAD et PCB */
SetBaseScreen( ActiveScreen = ScreenPcb );
@ -88,12 +79,8 @@ void WinEDA_GerberFrame::Erase_Zones( bool query )
if( query && !IsOK( this, _( "Delete zones ?" ) ) )
return;
if( m_Pcb->m_Zone )
{
m_Pcb->m_Zone->DeleteStructList( );
m_Pcb->m_Zone = NULL;
m_Pcb->m_NbSegmZone = 0;
}
m_Pcb->m_Zone.DeleteAll();
ScreenPcb->SetModify();
}
@ -116,10 +103,10 @@ void WinEDA_GerberFrame::Erase_Segments_Pcb( bool all_layers, bool query )
switch( PtStruct->Type() )
{
case TYPEDRAWSEGMENT:
case TYPETEXTE:
case TYPECOTATION:
case TYPEMIRE:
case TYPE_DRAWSEGMENT:
case TYPE_TEXTE:
case TYPE_COTATION:
case TYPE_MIRE:
if( PtStruct->GetLayer() == layer || layer < 0 )
PtStruct->DeleteStructure();
break;
@ -177,7 +164,7 @@ void WinEDA_GerberFrame::Erase_Textes_Pcb( bool query )
for( ; PtStruct != NULL; PtStruct = PtNext )
{
PtNext = PtStruct->Next();
if( PtStruct->Type() == TYPETEXTE )
if( PtStruct->Type() == TYPE_TEXTE )
PtStruct->DeleteStructure();
}

View File

@ -57,7 +57,7 @@ BOARD_ITEM* WinEDA_GerberFrame::Locate( int typeloc )
while( ( TrackLocate = Locate_Pistes( TrackLocate, layer, typeloc ) ) != NULL )
{
Track = TrackLocate;
if( TrackLocate->Type() == TYPEVIA )
if( TrackLocate->Type() == TYPE_VIA )
break;
TrackLocate = TrackLocate->Next();
}
@ -67,7 +67,7 @@ BOARD_ITEM* WinEDA_GerberFrame::Locate( int typeloc )
}
pt_texte_pcb = Locate_Texte_Pcb( (TEXTE_PCB*) m_Pcb->m_Drawings, typeloc );
pt_texte_pcb = Locate_Texte_Pcb( (TEXTE_PCB*) m_Pcb->m_Drawings.GetFirst(), typeloc );
if( pt_texte_pcb ) // texte type PCB localise
{
pt_texte_pcb->Display_Infos( this );
@ -79,7 +79,7 @@ BOARD_ITEM* WinEDA_GerberFrame::Locate( int typeloc )
return DrawSegm;
}
if( ( TrackLocate = Locate_Zone( (TRACK*) m_Pcb->m_Zone,
if( ( TrackLocate = Locate_Zone( m_Pcb->m_Zone,
GetScreen()->m_Active_Layer, typeloc ) ) != NULL )
{
TrackLocate->Display_Infos( this );
@ -112,7 +112,7 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int typeloc )
PtStruct = Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{
if( PtStruct->Type() != TYPEDRAWSEGMENT )
if( PtStruct->Type() != TYPE_DRAWSEGMENT )
continue;
pts = (DRAWSEGMENT*) PtStruct;
ux0 = pts->m_Start.x; uy0 = pts->m_Start.y;
@ -198,7 +198,7 @@ TRACK* Locate_Pistes( TRACK* start_adresse, wxPoint ref, int Layer )
dx -= ux0; dy -= uy0;
spot_cX = ref.x - ux0; spot_cY = ref.y - uy0;
if( Track->Type() == TYPEVIA ) /* VIA rencontree */
if( Track->Type() == TYPE_VIA ) /* VIA rencontree */
{
if( (abs( spot_cX ) <= l_piste ) && (abs( spot_cY ) <=l_piste) )
{
@ -289,7 +289,7 @@ TEXTE_PCB* Locate_Texte_Pcb( TEXTE_PCB* pt_txt_pcb, int typeloc )
PtStruct = (EDA_BaseStruct*) pt_txt_pcb;
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{
if( PtStruct->Type() != TYPETEXTE )
if( PtStruct->Type() != TYPE_TEXTE )
continue;
pt_txt_pcb = (TEXTE_PCB*) PtStruct;

View File

@ -22,10 +22,11 @@ OBJECTS= \
gerberframe.o\
onrightclick.o\
class_board.o\
class_board_item.o\
class_drawsegment.o\
class_track.o \
class_drc_item.o \
class_board_connected_item.o\
class_board_connected_item.o\
drawframe.o\
drawpanel.o\
set_color.o \
@ -53,7 +54,7 @@ OBJECTS= \
controle.o\
basepcbframe.o\
export_to_pcbnew.o\
collectors.o
collectors.o
setpage.o: ../share/setpage.cpp
$(CXX) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp

View File

@ -72,7 +72,7 @@ bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu
switch( DrawStruct->Type() )
{
case TYPETRACK:
case TYPE_TRACK:
// PopMenu->AppendSeparator();
// PopMenu->Append(ID_POPUP_PCB_EDIT_TRACK, _("Edit"));

View File

@ -102,6 +102,13 @@ static void fillRoundFlashTRACK( TRACK* aTrack, int Dcode_index, int aLayer,
NEGATE( aTrack->m_End.y );
aTrack->SetNet( Dcode_index );
aTrack->m_Shape = S_SPOT_CIRCLE;
D(printf("%s: isDark=%s\n", __func__, isDark ? "true" : "false" );)
if( !isDark )
{
aTrack->m_Flags |= DRAW_ERASED;
}
}
@ -148,6 +155,12 @@ static void fillOvalOrRectFlashTRACK( TRACK* aTrack, int Dcode_index, int aLaye
aTrack->m_Start.y -= len;
aTrack->m_End.y += len;
}
D(printf("%s: isDark=%s\n", __func__, isDark ? "true" : "false" );)
if( !isDark )
{
aTrack->m_Flags |= DRAW_ERASED;
}
}
@ -178,6 +191,12 @@ static void fillLineTRACK( TRACK* aTrack, int Dcode_index, int aLayer,
NEGATE( aTrack->m_End.y );
aTrack->SetNet( Dcode_index );
D(printf("%s: isDark=%s\n", __func__, isDark ? "true" : "false" );)
if( !isDark )
{
aTrack->m_Flags |= DRAW_ERASED;
}
}
@ -190,16 +209,17 @@ static void Append_1_SEG_ARC_GERBER( int Dcode_index,
bool trigo_sens, bool multiquadrant, bool isDark )
/*****************************************************************/
/* creation d'un arc:
* si multiquadrant == true arc de 0 a 360 degres
* et rel_center est la coordonn<EFBFBD>e du centre relativement au startpoint
*
* si multiquadrant == false arc de 0 <EFBFBD> 90 entierement contenu dans le meme quadrant
* et rel_center est la coordonn<EFBFBD>e du centre relativement au startpoint,
* mais en VALEUR ABSOLUE et le signe des valeurs x et y de rel_center doit
* etre deduit de cette limite de 90 degres
*
*/
/*
creation d'un arc:
si multiquadrant == true arc de 0 a 360 degres
et rel_center est la coordonn<EFBFBD>e du centre relativement au startpoint
si multiquadrant == false arc de 0 <EFBFBD> 90 entierement contenu dans le meme quadrant
et rel_center est la coordonn<EFBFBD>e du centre relativement au startpoint,
mais en VALEUR ABSOLUE et le signe des valeurs x et y de rel_center doit
etre deduit de cette limite de 90 degres
*/
#endif
@ -291,6 +311,12 @@ static void fillArcTRACK( TRACK* aTrack, int Dcode_index, int aLayer,
NEGATE( aTrack->m_End.y );
aTrack->SetSubNet( -aTrack->GetSubNet() );
if( !isDark )
{
D(printf("%s: isDark=false\n", __func__ );)
aTrack->m_Flags |= DRAW_ERASED;
}
}
@ -811,16 +837,9 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
case 1: // code D01 Draw line, exposure ON
{
m_Exposure = true;
SEGZONE* edge_poly, * last;
edge_poly = new SEGZONE( frame->m_Pcb );
last = (SEGZONE*) frame->m_Pcb->m_Zone;
if( last )
while( last->Next() )
last = (SEGZONE*) last->Next();
edge_poly->Insert( frame->m_Pcb, last );
SEGZONE* edge_poly = new SEGZONE( frame->m_Pcb );
frame->m_Pcb->m_Zone.Append( edge_poly );
edge_poly->SetLayer( activeLayer );
edge_poly->m_Width = 1;
@ -829,6 +848,7 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
edge_poly->m_End = m_CurrentPos;
NEGATE( edge_poly->m_End.y );
edge_poly->SetNet( m_PolygonFillModeState );
m_PreviousPos = m_CurrentPos;
m_PolygonFillModeState = 1;
break;
@ -862,10 +882,10 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
{
case GERB_INTERPOL_LINEAR_1X:
track = new TRACK( frame->m_Pcb );
track->Insert( frame->m_Pcb, NULL );
frame->m_Pcb->m_Track.Append( track );
fillLineTRACK( track, dcode, activeLayer,
m_PreviousPos, m_CurrentPos,
size.x, m_Exposure ^ m_ImageNegative );
size.x, !(m_LayerNegative ^ m_ImageNegative) );
break;
case GERB_INTERPOL_LINEAR_01X:
@ -877,11 +897,11 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
case GERB_INTERPOL_ARC_NEG:
case GERB_INTERPOL_ARC_POS:
track = new TRACK( frame->m_Pcb );
track->Insert( frame->m_Pcb, NULL );
frame->m_Pcb->m_Track.Append( track );
fillArcTRACK( track, dcode, activeLayer,
m_PreviousPos, m_CurrentPos, m_IJPos,
size.x, m_Iterpolation==GERB_INTERPOL_ARC_NEG ? false : true,
m_360Arc_enbl, m_Exposure ^ m_ImageNegative );
m_360Arc_enbl, !(m_LayerNegative ^ m_ImageNegative) );
break;
default:
@ -913,20 +933,20 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
case APT_LINE: // APT_LINE is not in the spec, don't know why it's here
case APT_CIRCLE:
track = new TRACK( frame->m_Pcb );
track->Insert( frame->m_Pcb, NULL );
frame->m_Pcb->m_Track.Append( track );
fillRoundFlashTRACK( track, dcode, activeLayer,
m_CurrentPos,
size.x, true ^ m_ImageNegative );
size.x, !(m_LayerNegative ^ m_ImageNegative) );
break;
case APT_OVAL:
case APT_RECT:
track = new TRACK( frame->m_Pcb );
track->Insert( frame->m_Pcb, NULL );
frame->m_Pcb->m_Track.Append( track );
fillOvalOrRectFlashTRACK( track, dcode, activeLayer,
m_CurrentPos, size,
aperture == APT_RECT ? S_SPOT_RECT : S_SPOT_OVALE,
true ^ m_ImageNegative );
!(m_LayerNegative ^ m_ImageNegative) );
break;
case APT_MACRO:
@ -949,7 +969,7 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
int diameter = scale( p->params[1].GetValue( tool ), m_GerbMetric );
track = new TRACK( frame->m_Pcb );
track->Insert( frame->m_Pcb, NULL );
frame->m_Pcb->m_Track.Append( track );
fillRoundFlashTRACK( track, dcode, activeLayer,
m_CurrentPos,
diameter, exposure );
@ -978,7 +998,7 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
wxPoint midPoint( (start.x + end.x)/2, (start.y+end.y)/2 );
curPos += midPoint;
track = new TRACK( frame->m_Pcb );
track->Insert( frame->m_Pcb, NULL );
frame->m_Pcb->m_Track.Append( track );
fillOvalOrRectFlashTRACK( track, dcode, activeLayer,
curPos, size, S_SPOT_RECT,
exposure );
@ -993,7 +1013,7 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
size.y = msize.y;
curPos += mapPt( p->params[3].GetValue( tool ), p->params[4].GetValue( tool ), m_GerbMetric );
track = new TRACK( frame->m_Pcb );
track->Insert( frame->m_Pcb, NULL );
frame->m_Pcb->m_Track.Append( track );
fillOvalOrRectFlashTRACK( track, dcode, activeLayer,
curPos, size, S_SPOT_RECT,
exposure );
@ -1012,7 +1032,7 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
curPos.y += size.y/2;
curPos.x += size.x/2;
track = new TRACK( frame->m_Pcb );
track->Insert( frame->m_Pcb, NULL );
frame->m_Pcb->m_Track.Append( track );
fillOvalOrRectFlashTRACK( track, dcode, activeLayer,
curPos, size, S_SPOT_RECT,
exposure );

View File

@ -309,16 +309,28 @@ bool GERBER::ExecuteRS274XCommand( int command, char buff[GERBER_BUFZ], char*& t
case IMAGE_POLARITY:
if( strnicmp( text, "NEG", 3 ) == 0 )
{
D(printf("%s: m_ImageNegative=true\n", __func__);)
m_ImageNegative = TRUE;
}
else
{
D(printf("%s: m_ImageNegative=false\n", __func__);)
m_ImageNegative = FALSE;
}
break;
case LAYER_POLARITY:
if( *text == 'C' )
{
D(printf("%s: m_LayerNegative=true\n", __func__);)
m_LayerNegative = TRUE;
}
else
{
D(printf("%s: m_LayerNegative=false\n", __func__);)
m_LayerNegative = FALSE;
}
break;
case INCLUDE_FILE:

View File

@ -28,7 +28,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
/* routine de trace du pcb, avec selection des couches */
{
DISPLAY_OPTIONS save_opt;
int DisplayPolygonsModeImg;
int DisplayPolygonsModeImg;
save_opt = DisplayOpt;
if( printmasklayer & ALL_CU_LAYERS )
@ -44,8 +44,8 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
DisplayOpt.DisplayTrackIsol = 0;
DisplayOpt.DisplayDrawItems = FILLED;
DisplayOpt.DisplayZones = 1;
DisplayPolygonsModeImg = g_DisplayPolygonsModeSketch;
g_DisplayPolygonsModeSketch = 0;
DisplayPolygonsModeImg = g_DisplayPolygonsModeSketch;
g_DisplayPolygonsModeSketch = 0;
m_PrintIsMirrored = aPrintMirrorMode;
@ -57,7 +57,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
m_PrintIsMirrored = false;
DisplayOpt = save_opt;
g_DisplayPolygonsModeSketch = DisplayPolygonsModeImg;
g_DisplayPolygonsModeSketch = DisplayPolygonsModeImg;
}
@ -80,7 +80,7 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
DrawPanel->DrawBackGround( DC );
Trace_Gerber( DC, GR_OR, -1 );
Trace_Gerber( DC, GR_COPY, -1 );
TraceWorkSheet( DC, screen, 0 );
Affiche_Status_Box();
@ -117,32 +117,35 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
// Draw filled polygons
#define NBMAX 20000
TRACK* track;
int nbpoints = 0;
int nbpointsmax = NBMAX;
int* coord = (int*) malloc( nbpointsmax * sizeof(int) * 2 );
int* ptcoord = coord;
track = m_Pcb->m_Zone;
for( ; track != NULL; track = track->Next() )
for( TRACK* track = m_Pcb->m_Zone; track; track = track->Next() )
{
if ( printmasklayer != -1 )
if ( (track->ReturnMaskLayer() & printmasklayer) == 0 ) continue;
if( printmasklayer != -1 && !(track->ReturnMaskLayer() & printmasklayer) )
continue;
if( track->GetNet() == 0 ) // StartPoint
{
if( nbpoints ) // we have found a new polygon: Draw the old polygon
{
int Color = g_DesignSettings.m_LayerColor[track->GetLayer()];
int filled = (g_DisplayPolygonsModeSketch == 0) ? 1 : 0;
int filled = (g_DisplayPolygonsModeSketch == 0) ? 1 : 0;
GRClosedPoly( &DrawPanel->m_ClipBox, DC, nbpoints, coord,
filled, Color, Color );
}
nbpoints = 2;
ptcoord = coord;
*ptcoord = track->m_Start.x; ptcoord++;
*ptcoord = track->m_Start.y; ptcoord++;
*ptcoord = track->m_End.x; ptcoord++;
*ptcoord = track->m_End.y; ptcoord++;
*ptcoord++ = track->m_Start.x;
*ptcoord++ = track->m_Start.y;
*ptcoord++ = track->m_End.x;
*ptcoord++ = track->m_End.y;
}
else
{
@ -153,13 +156,16 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
ptcoord = coord + nbpointsmax;
}
nbpoints++;
*ptcoord = track->m_End.x; ptcoord++;
*ptcoord = track->m_End.y; ptcoord++;
*ptcoord++ = track->m_End.x;
*ptcoord++ = track->m_End.y;
}
if( track->Next() == NULL ) // Last point
{
int Color = g_DesignSettings.m_LayerColor[track->GetLayer()];
int filled = (g_DisplayPolygonsModeSketch == 0) ? 1 : 0;
int filled = (g_DisplayPolygonsModeSketch == 0) ? 1 : 0;
GRClosedPoly( &DrawPanel->m_ClipBox, DC, nbpoints, coord,
filled, Color, Color );
}

View File

@ -29,30 +29,28 @@ void Draw_Track_Buffer( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int draw_
* @param printmasklayer = mask for allowed layer (=-1 to draw all layers)
*/
{
TRACK* Track;
int layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
GERBER* gerber = g_GERBER_List[layer];
GERBER* gerber = g_GERBER_List[layer];
int dcode_hightlight = 0;
if( gerber )
dcode_hightlight = gerber->m_Selected_Tool;
Track = Pcb->m_Track;
for( ; Track != NULL; Track = Track->Next() )
for( TRACK* track = Pcb->m_Track; track; track = track->Next() )
{
if( printmasklayer != -1 )
if( (Track->ReturnMaskLayer() & printmasklayer) == 0 )
continue;
if( !(track->ReturnMaskLayer() & printmasklayer) )
continue;
if( (dcode_hightlight == Track->GetNet())
&& (Track->GetLayer() == layer) )
Trace_Segment( panel, DC, Track, draw_mode | GR_SURBRILL );
if( dcode_hightlight == track->GetNet() && track->GetLayer()==layer )
Trace_Segment( panel, DC, track, draw_mode | GR_SURBRILL );
else
Trace_Segment( panel, DC, Track, draw_mode );
Trace_Segment( panel, DC, track, draw_mode );
}
}
#if 1
/***********************************************************************************/
void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mode )
/***********************************************************************************/
@ -70,22 +68,30 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo
int fillopt;
static bool show_err;
color = g_DesignSettings.m_LayerColor[track->GetLayer()];
if( color & ITEM_NOT_SHOW )
return;
if( track->m_Flags & DRAW_ERASED ) // draw in background color, used by classs TRACK in gerbview
{
color = g_DrawBgColor;
}
else
{
color = g_DesignSettings.m_LayerColor[track->GetLayer()];
if( color & ITEM_NOT_SHOW )
return;
zoom = panel->GetZoom();
if( draw_mode & GR_SURBRILL )
{
if( draw_mode & GR_AND )
color &= ~HIGHT_LIGHT_FLAG;
else
color |= HIGHT_LIGHT_FLAG;
}
if( color & HIGHT_LIGHT_FLAG )
color = ColorRefs[color & MASKCOLOR].m_LightColor;
}
GRSetDrawMode( DC, draw_mode );
if( draw_mode & GR_SURBRILL )
{
if( draw_mode & GR_AND )
color &= ~HIGHT_LIGHT_FLAG;
else
color |= HIGHT_LIGHT_FLAG;
}
if( color & HIGHT_LIGHT_FLAG )
color = ColorRefs[color & MASKCOLOR].m_LightColor;
zoom = panel->GetZoom();
rayon = l_piste = track->m_Width >> 1;
@ -151,8 +157,8 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo
}
break;
case S_SPOT_RECT:
case S_RECT:
case S_SPOT_RECT:
case S_RECT:
fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH;
if( (l_piste / zoom) < L_MIN_DESSIN )
{
@ -179,10 +185,10 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo
}
break;
case S_SPOT_OVALE:
case S_SPOT_OVALE:
fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH;
case S_SEGMENT:
case S_SEGMENT:
if( (l_piste / zoom) < L_MIN_DESSIN )
{
GRLine( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
@ -214,6 +220,8 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo
}
}
#endif
/*****************************************************************************************/
void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int drawmode )

View File

@ -34,8 +34,8 @@ void WinEDA_GerberFrame::UnDeleteItem( wxDC* DC )
switch( item->Type() )
{
case TYPEVIA:
case TYPETRACK:
case TYPE_VIA:
case TYPE_TRACK:
for( ; item; item = next )
{
next = item->Next();
@ -87,8 +87,8 @@ BOARD_ITEM* SaveItemEfface( BOARD_ITEM* PtItem, int nbitems )
switch( PtStruct->Type() )
{
case TYPEVIA:
case TYPETRACK:
case TYPE_VIA:
case TYPE_TRACK:
{
EDA_BaseStruct* Back = NULL;
g_UnDeleteStack[g_UnDeleteStackPtr - 1] = PtStruct;

View File

@ -22,27 +22,28 @@ enum KICAD_T {
EOT = 0, // search types array terminator (End Of Types)
TYPE_NOT_INIT = 0,
TYPEPCB,
TYPE_PCB,
// Items in pcb
PCB_EQUIPOT_STRUCT_TYPE,
TYPEMODULE,
TYPEPAD,
TYPEDRAWSEGMENT,
TYPETEXTE,
TYPETEXTEMODULE,
TYPEEDGEMODULE,
TYPETRACK,
TYPEZONE,
TYPEVIA,
TYPEMARKER,
TYPECOTATION,
TYPEMIRE,
TYPESCREEN,
TYPEBLOCK,
TYPEZONE_UNUSED,
TYPEZONE_EDGE_CORNER,
TYPEZONE_CONTAINER,
TYPE_EQUIPOT,
TYPE_MODULE,
TYPE_PAD,
TYPE_DRAWSEGMENT,
TYPE_TEXTE,
TYPE_TEXTE_MODULE,
TYPE_EDGE_MODULE,
TYPE_TRACK,
TYPE_ZONE,
TYPE_VIA,
TYPE_MARKER,
TYPE_COTATION,
TYPE_MIRE,
TYPE_SCREEN,
TYPE_BLOCK,
TYPE_ZONE_UNUSED,
TYPE_ZONE_EDGE_CORNER,
TYPE_ZONE_CONTAINER,
TYPE_BOARD_ITEM_LIST,
// Draw Items in schematic
DRAW_POLYLINE_STRUCT_TYPE,

View File

@ -1,26 +1,12 @@
/**********************************************************************************************/
/* board_item_struct.h : Basic classes for BOARD_ITEM and BOARD_CONNECTED_ITEM descriptions */
/* board_item_struct.h : Classes BOARD_ITEM and BOARD_CONNECTED_ITEM */
/**********************************************************************************************/
#ifndef BOARD_ITEM_STRUCT_H
#define BOARD_ITEM_STRUCT_H
/**
* Class BOARD_ITEM
* is a 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 is SCH_ITEM.
*/
/**
* Class BOARD_CONNECTED_ITEM
* This is a base class derived from BOARD_ITEM for items that can be connected
* mainly: tracks and pads
* Handle connection info
*
*/
#include <boost/ptr_container/ptr_vector.hpp>
/* Shapes for segments (graphic segments and tracks) ( .shape member ) */
@ -51,8 +37,8 @@ protected:
public:
BOARD_ITEM( BOARD_ITEM* StructFather, KICAD_T idtype ) :
EDA_BaseStruct( StructFather, idtype )
BOARD_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ) :
EDA_BaseStruct( aParent, idtype )
, m_Layer( 0 )
{
}
@ -62,6 +48,7 @@ public:
EDA_BaseStruct( src.m_Parent, src.Type() )
, m_Layer( src.m_Layer )
{
m_Flags = src.m_Flags;
}
@ -130,9 +117,10 @@ public:
/**
* Function UnLink
* detaches this object from its owner.
* detaches this object from its owner. This base class implementation
* should work for all derived classes which are held in a DLIST<>.
*/
virtual void UnLink() = 0;
virtual void UnLink();
/**
@ -183,6 +171,12 @@ public:
};
/**
* Class BOARD_CONNECTED_ITEM
* This is a base class derived from BOARD_ITEM for items that can be connected
* mainly: tracks and pads
* Handle connection info
*/
class BOARD_CONNECTED_ITEM : public BOARD_ITEM
{
protected:
@ -196,7 +190,7 @@ protected:
// handle block number in zone connection
public:
BOARD_CONNECTED_ITEM( BOARD_ITEM* StructFather, KICAD_T idtype );
BOARD_CONNECTED_ITEM( BOARD_ITEM* aParent, KICAD_T idtype );
BOARD_CONNECTED_ITEM( const BOARD_CONNECTED_ITEM& src );
/**
@ -221,5 +215,117 @@ public:
void SetZoneSubNet( int aSubNetCode );
};
class BOARD_ITEM_LIST : public BOARD_ITEM
{
typedef boost::ptr_vector<BOARD_ITEM> ITEM_ARRAY;
ITEM_ARRAY myItems;
BOARD_ITEM_LIST( const BOARD_ITEM_LIST& other ) :
BOARD_ITEM( NULL, TYPE_BOARD_ITEM_LIST )
{
// copy constructor is not supported, is private to cause compiler error
}
public:
BOARD_ITEM_LIST( BOARD_ITEM* aParent = NULL ) :
BOARD_ITEM( aParent, TYPE_BOARD_ITEM_LIST )
{}
//-----< satisfy some virtual functions >------------------------------
wxPoint& GetPosition()
{
static wxPoint dummy;
return dummy;
}
void Draw( WinEDA_DrawPanel* DrawPanel, wxDC* DC,
int aDrawMode, const wxPoint& offset = ZeroOffset )
{
}
void UnLink()
{
/* if it were needed:
DHEAD* list = GetList();
wxASSERT( list );
list->remove( this );
*/
}
bool Save( FILE* aFile ) const
{
return true;
}
//-----</ satisfy some virtual functions >-----------------------------
/**
* Function GetCount
* returns the number of BOARD_ITEMs.
*/
int GetCount() const
{
return myItems.size();
}
void Append( BOARD_ITEM* aItem )
{
myItems.push_back( aItem );
}
BOARD_ITEM* Replace( int aIndex, BOARD_ITEM* aItem )
{
ITEM_ARRAY::auto_type ret = myItems.replace( aIndex, aItem );
return ret.release();
}
BOARD_ITEM* Remove( int aIndex )
{
ITEM_ARRAY::auto_type ret = myItems.release( myItems.begin()+aIndex );
return ret.release();
}
void Insert( int aIndex, BOARD_ITEM* aItem )
{
myItems.insert( myItems.begin()+aIndex, aItem );
}
BOARD_ITEM* At( int aIndex ) const
{
// we have varying sized objects and are using polymorphism, so we
// must return a pointer not a reference.
return (BOARD_ITEM*) &myItems[aIndex];
}
BOARD_ITEM* operator[]( int aIndex ) const
{
return At( aIndex );
}
void Delete( int aIndex )
{
myItems.erase( myItems.begin()+aIndex );
}
void PushBack( BOARD_ITEM* aItem )
{
Append( aItem );
}
BOARD_ITEM* PopBack()
{
if( GetCount() )
return Remove( GetCount()-1 );
return NULL;
}
};
#endif /* BOARD_ITEM_STRUCT_H */

View File

@ -39,7 +39,7 @@ class DHEAD
protected:
EDA_BaseStruct* first; ///< first element in list, or NULL if list empty
EDA_BaseStruct* last; ///< last elment in list, or NULL if empty
unsigned count; ///< how many elements are in the list
unsigned count; ///< how many elements are in the list, automatically maintained.
bool meOwner; ///< I must delete the objects I hold in my destructor
/**
@ -66,7 +66,10 @@ protected:
/**
* Function insert
* puts aNewElement just in front of aElementAfterMe in the list sequence.
* If aElementAfterMe is NULL, then simply Append()
* If aElementAfterMe is NULL, then simply append().
* @param aNewElement The element to insert.
* @param aElementAfterMe The element to insert \a aNewElement before,
* if NULL then append aNewElement onto end of list.
*/
void insert( EDA_BaseStruct* aNewElement, EDA_BaseStruct* aElementAfterMe );
@ -210,9 +213,13 @@ public:
insert( aNewElement );
}
void PushBack( T* aElement )
/**
* Function PushBack
* puts aNewElement at the end of the list sequence.
*/
void PushBack( T* aNewElement )
{
append( aElement );
append( aNewElement );
}
//-----</ STL like functions >--------------------------------------

View File

@ -18,21 +18,23 @@
/* Bits indicateurs du membre .Status, pour pistes, modules... */
#define FLAG1 0x2000 /* flag libre pour calculs locaux */
#define FLAG0 0x1000 /* flag libre pour calculs locaux */
#define BEGIN_ONPAD 0x800 /* flag indiquant un debut de segment sur pad */
#define END_ONPAD 0x400 /* flag indiquant une fin de segment sur pad */
#define BUSY 0x0200 /* flag indiquant que la structure a deja
* ete examinee, dans certaines routines */
#define DELETED 0x0100 /* Bit flag de Status pour structures effacee
* et mises en chaine "DELETED" */
#define NO_TRACE 0x80 /* l'element ne doit pas etre affiche */
#define SURBRILL 0x20 /* element en surbrillance */
#define DRAG 0x10 /* segment en mode drag */
#define EDIT 0x8 /* element en cours d'edition */
#define SEGM_FIXE 0x04 /* segment FIXE ( pas d'effacement global ) */
#define SEGM_AR 0x02 /* segment Auto_Route */
#define CHAIN 0x01 /* segment marque */
#define FLAG1 (1 << 13) /* flag libre pour calculs locaux */
#define FLAG0 (1 << 12) /* flag libre pour calculs locaux */
#define BEGIN_ONPAD (1 << 11) /* flag indiquant un debut de segment sur pad */
#define END_ONPAD (1 << 10) /* flag indiquant une fin de segment sur pad */
#define BUSY (1 << 9) /* flag indiquant que la structure a deja
* ete examinee, dans certaines routines */
#define DELETED (1 << 8) /* Bit flag de Status pour structures effacee
* et mises en chaine "DELETED" */
#define NO_TRACE (1 << 7) /* l'element ne doit pas etre affiche */
#define SURBRILL (1 << 5) /* element en surbrillance */
#define DRAG (1 << 4) /* segment en mode drag */
#define EDIT (1 << 3) /* element en cours d'edition */
#define SEGM_FIXE (1 << 2) /* segment FIXE ( pas d'effacement global ) */
#define SEGM_AR (1 << 1) /* segment Auto_Route */
#define CHAIN (1 << 0) /* segment marque */
/* Layer identification (layer number) */

View File

@ -511,7 +511,7 @@ public:
bool MergeCollinearTracks( TRACK* track, wxDC* DC, int end );
void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC );
void SwitchLayer( wxDC* DC, int layer );
int Add_45_degrees_Segment( wxDC* DC, TRACK* pt_segm );
bool Add_45_degrees_Segment( wxDC* DC );
bool Genere_Pad_Connexion( wxDC* DC, int layer );
// zone handling

View File

@ -55,10 +55,10 @@ void Affiche_Infos_Equipot( int netcode, WinEDA_BasePcbFrame* frame )
for( ii = 0, Struct = frame->m_Pcb->m_Track; Struct != NULL; Struct = Struct->Next() )
{
ii++;
if( Struct->Type() == TYPEVIA )
if( Struct->Type() == TYPE_VIA )
if( ( (SEGVIA*) Struct )->GetNet() == netcode )
nb_vias++;
if( Struct->Type() == TYPETRACK )
if( Struct->Type() == TYPE_TRACK )
if( ( (TRACK*) Struct )->GetNet() == netcode )
lengthnet += ( (TRACK*) Struct )->GetLength();
}

View File

@ -41,7 +41,7 @@ void WinEDA_PcbFrame::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On )
TRACK* Track;
int nb_segm;
if( (track == NULL ) || (track->Type() == TYPEZONE) )
if( (track == NULL ) || (track->Type() == TYPE_ZONE) )
return;
DrawPanel->CursorOff( DC ); // Erase cursor shape

View File

@ -458,7 +458,7 @@ int WinEDA_PcbFrame::GenPlaceBoard()
switch( PtStruct->Type() )
{
case TYPEDRAWSEGMENT:
case TYPE_DRAWSEGMENT:
DrawSegm = (DRAWSEGMENT*) PtStruct;
if( DrawSegm->GetLayer() != EDGE_N )
break;
@ -471,7 +471,7 @@ int WinEDA_PcbFrame::GenPlaceBoard()
TraceSegmentPcb( m_Pcb, &TmpSegm, HOLE | CELL_is_EDGE, g_GridRoutingSize, WRITE_CELL );
break;
case TYPETEXTE:
case TYPE_TEXTE:
default:
break;
}
@ -919,7 +919,7 @@ float WinEDA_PcbFrame::Compute_Ratsnest_PlaceModule( wxDC* DC )
/********************************************/
void Build_PlacedPads_List( BOARD* Pcb )
void Build_PlacedPads_List( BOARD* aPcb )
/********************************************/
/*
@ -937,57 +937,29 @@ void Build_PlacedPads_List( BOARD* Pcb )
* m_Status_Pcb |= LISTE_PAD_OK
*/
{
LISTE_PAD* pt_liste_pad;
MODULE* Module;
D_PAD* PtPad;
aPcb->m_Pads.clear();
if( Pcb->m_Pads )
MyFree( Pcb->m_Pads );
aPcb->m_NbNodes = 0;
pt_liste_pad = Pcb->m_Pads = NULL;
Pcb->m_NbPads = Pcb->m_NbNodes = 0;
/* Calcul du nombre de pads utiles */
Module = Pcb->m_Modules;
for( ; Module != NULL; Module = Module->Next() )
// Initialisation du buffer et des variables de travail
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
{
if( Module->m_ModuleStatus & MODULE_to_PLACE )
if( module->m_ModuleStatus & MODULE_to_PLACE )
continue;
PtPad = (D_PAD*) Module->m_Pads;
for( ; PtPad != NULL; PtPad = PtPad->Next() )
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
{
Pcb->m_NbPads++;
aPcb->m_Pads.push_back( pad );
pad->SetSubNet( 0 );
pad->SetSubRatsnest( 0 );
pad->SetParent( module );
if( pad->GetNet() )
aPcb->m_NbNodes++;
}
}
/* Allocation memoire du buffer */
if( Pcb->m_NbPads > 0 )
{
pt_liste_pad = Pcb->m_Pads
= (D_PAD**) MyMalloc( Pcb->m_NbPads * sizeof(D_PAD *) );
}
/* Initialisation du buffer et des variables de travail */
Module = Pcb->m_Modules;
for( ; (Module != NULL) && (pt_liste_pad != NULL); Module = Module->Next() )
{
if( Module->m_ModuleStatus & MODULE_to_PLACE )
continue;
PtPad = (D_PAD*) Module->m_Pads;
for( ; PtPad != NULL; PtPad = PtPad->Next() )
{
*pt_liste_pad = PtPad;
PtPad->SetSubNet( 0 );
PtPad->SetSubRatsnest( 0 );
PtPad->SetParent( Module );
if( PtPad->GetNet() )
Pcb->m_NbNodes++;
pt_liste_pad++;
}
}
Pcb->m_Status_Pcb |= LISTE_PAD_OK;
Pcb->m_Status_Pcb &= ~(LISTE_CHEVELU_OK | CHEVELU_LOCAL_OK);
aPcb->m_Status_Pcb |= LISTE_PAD_OK;
aPcb->m_Status_Pcb &= ~(LISTE_CHEVELU_OK | CHEVELU_LOCAL_OK);
adr_lowmem = buf_work;
}
@ -1217,7 +1189,7 @@ bool WinEDA_PcbFrame::SetBoardBoundaryBoxFromEdgesOnly()
PtStruct = m_Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{
if( PtStruct->Type() != TYPEDRAWSEGMENT )
if( PtStruct->Type() != TYPE_DRAWSEGMENT )
continue;
succes = TRUE;
ptr = (DRAWSEGMENT*) PtStruct;

View File

@ -46,7 +46,7 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
{
switch( GetScreen()->GetCurItem()->Type() )
{
case TYPEPAD:
case TYPE_PAD:
Pad = (D_PAD*) GetScreen()->GetCurItem();
autoroute_net_code = Pad->GetNet();
break;
@ -63,7 +63,7 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
case ROUTE_MODULE:
Module = (MODULE*) GetScreen()->GetCurItem();
if( (Module == NULL) || (Module->Type() != TYPEMODULE) )
if( (Module == NULL) || (Module->Type() != TYPE_MODULE) )
{
DisplayError( this, _( "Module not selected" ) ); return;
}
@ -71,7 +71,7 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
case ROUTE_PAD:
Pad = (D_PAD*) GetScreen()->GetCurItem();
if( (Pad == NULL) || (Pad->Type() != TYPEPAD) )
if( (Pad == NULL) || (Pad->Type() != TYPE_PAD) )
{
DisplayError( this, _( "Pad not selected" ) ); return;
}

View File

@ -295,7 +295,7 @@ void WinEDA_BasePcbFrame::SetCurItem( BOARD_ITEM* aItem )
{
aItem->Display_Infos( this );
#if 1 && defined(DEBUG)
#if 0 && defined(DEBUG)
aItem->Show( 0, std::cout );
#endif

View File

@ -502,7 +502,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
switch( PtStruct->Type() )
{
case TYPEDRAWSEGMENT:
case TYPE_DRAWSEGMENT:
if( (g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer) == 0 )
break;
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
@ -513,7 +513,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
PtStruct->DeleteStructure();
break;
case TYPETEXTE:
case TYPE_TEXTE:
if( !Block_Include_PcbTextes )
break;
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
@ -524,7 +524,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
PtStruct->DeleteStructure();
break;
case TYPEMIRE:
case TYPE_MIRE:
if( (g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer) == 0 )
break;
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
@ -533,7 +533,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
PtStruct->DeleteStructure();
break;
case TYPECOTATION:
case TYPE_COTATION:
if( (g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer) == 0 )
break;
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
@ -688,9 +688,9 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
{
switch( PtStruct->Type() )
{
case TYPEDRAWSEGMENT:
#undef STRUCT
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
case TYPE_DRAWSEGMENT:
#undef STRUCT
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
@ -699,9 +699,9 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
RotatePoint( &STRUCT->m_End, centre, 900 );
break;
case TYPETEXTE:
#undef STRUCT
#define STRUCT ( (TEXTE_PCB*) PtStruct )
case TYPE_TEXTE:
#undef STRUCT
#define STRUCT ( (TEXTE_PCB*) PtStruct )
if( !Block_Include_PcbTextes )
break;
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
@ -714,9 +714,9 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
STRUCT->CreateDrawData();
break;
case TYPEMIRE:
#undef STRUCT
#define STRUCT ( (MIREPCB*) PtStruct )
case TYPE_MIRE:
#undef STRUCT
#define STRUCT ( (MIREPCB*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
@ -725,9 +725,9 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
RotatePoint( &STRUCT->m_Pos, centre, 900 );
break;
case TYPECOTATION:
#undef STRUCT
#define STRUCT ( (COTATION*) PtStruct )
case TYPE_COTATION:
#undef STRUCT
#define STRUCT ( (COTATION*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
@ -818,7 +818,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
m_Pcb->m_Status_Pcb = 0;
INVERT( track->m_Start.y );
INVERT( track->m_End.y );
if( track->Type() != TYPEVIA )
if( track->Type() != TYPE_VIA )
{
track->SetLayer( ChangeSideNumLayer( track->GetLayer() ) );
}
@ -864,9 +864,9 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
{
switch( PtStruct->Type() )
{
case TYPEDRAWSEGMENT:
#undef STRUCT
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
case TYPE_DRAWSEGMENT:
#undef STRUCT
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
@ -881,9 +881,9 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
STRUCT->SetLayer( ChangeSideNumLayer( STRUCT->GetLayer() ) );
break;
case TYPETEXTE:
#undef STRUCT
#define STRUCT ( (TEXTE_PCB*) PtStruct )
case TYPE_TEXTE:
#undef STRUCT
#define STRUCT ( (TEXTE_PCB*) PtStruct )
if( !Block_Include_PcbTextes )
break;
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
@ -899,9 +899,9 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
STRUCT->CreateDrawData();
break;
case TYPEMIRE:
#undef STRUCT
#define STRUCT ( (MIREPCB*) PtStruct )
case TYPE_MIRE:
#undef STRUCT
#define STRUCT ( (MIREPCB*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
@ -911,9 +911,9 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
STRUCT->SetLayer( ChangeSideNumLayer( STRUCT->GetLayer() ) );
break;
case TYPECOTATION:
#undef STRUCT
#define STRUCT ( (COTATION*) PtStruct )
case TYPE_COTATION:
#undef STRUCT
#define STRUCT ( (COTATION*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
@ -943,8 +943,6 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
* Function to move items withing the selected block
*/
{
MODULE* module;
EDA_BaseStruct* PtStruct;
int masque_layer;
wxPoint oldpos;
wxPoint MoveVector = GetScreen()->BlockLocate.m_MoveVector;
@ -964,13 +962,13 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
if( Block_Include_Modules )
{
bool Show_Ratsnest_tmp = g_Show_Ratsnest; g_Show_Ratsnest = false;
module = m_Pcb->m_Modules;
oldpos = GetScreen()->m_Curseur;
for( ; module != NULL; module = module->Next() )
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
{
if( ! module->HitTest( GetScreen()->BlockLocate ) )
continue;
/* le module est ici bon a etre deplace */
m_Pcb->m_Status_Pcb = 0;
module->m_Flags = 0;
@ -985,9 +983,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
/* Deplacement des Segments de piste */
if( Block_Include_Tracks )
{
TRACK* track;
track = m_Pcb->m_Track;
while( track )
for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() )
{
if( track->HitTest( GetScreen()->BlockLocate ) )
{ /* la piste est ici bonne a etre deplacee */
@ -995,23 +991,19 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
track->m_Start += MoveVector;
track->m_End += MoveVector;
}
track = track->Next();
}
}
/* Deplacement des Segments de Zone */
if( Block_Include_Zones )
{
TRACK* track;
track = (TRACK*) m_Pcb->m_Zone;
while( track )
for( TRACK* track = m_Pcb->m_Zone; track; track = track->Next() )
{
if( track->HitTest( GetScreen()->BlockLocate ) )
{ /* la piste est ici bonne a etre deplacee */
track->m_Start += MoveVector;
track->m_End += MoveVector;
}
track = track->Next();
}
for ( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{
@ -1028,55 +1020,54 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
if( !Block_Include_Edges_Items )
masque_layer &= ~EDGE_LAYER;
PtStruct = m_Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
for( BOARD_ITEM* item = m_Pcb->m_Drawings; item; item = item->Next() )
{
switch( PtStruct->Type() )
switch( item->Type() )
{
case TYPEDRAWSEGMENT:
#undef STRUCT
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
case TYPE_DRAWSEGMENT:
#undef STRUCT
#define STRUCT ( (DRAWSEGMENT*) item )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
if( ! item->HitTest( GetScreen()->BlockLocate ) )
break;
/* l'element est ici bon a etre efface */
STRUCT->m_Start += MoveVector;
STRUCT->m_End += MoveVector;
break;
case TYPETEXTE:
#undef STRUCT
#define STRUCT ( (TEXTE_PCB*) PtStruct )
case TYPE_TEXTE:
#undef STRUCT
#define STRUCT ( (TEXTE_PCB*) item )
if( !Block_Include_PcbTextes )
break;
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
if( ! item->HitTest( GetScreen()->BlockLocate ) )
break;
/* le texte est ici bon a etre deplace */
/* Redessin du Texte */
STRUCT->m_Pos += MoveVector;
break;
case TYPEMIRE:
#undef STRUCT
#define STRUCT ( (MIREPCB*) PtStruct )
case TYPE_MIRE:
#undef STRUCT
#define STRUCT ( (MIREPCB*) item )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
if( ! item->HitTest( GetScreen()->BlockLocate ) )
break;
/* l'element est ici bon a etre efface */
STRUCT->m_Pos += MoveVector;
break;
case TYPECOTATION:
#undef STRUCT
#define STRUCT ( (COTATION*) PtStruct )
case TYPE_COTATION:
#undef STRUCT
#define STRUCT ( (COTATION*) item )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
if( ! item->HitTest( GetScreen()->BlockLocate ) )
break;
/* l'element est ici bon a etre efface */
( (COTATION*) PtStruct )->Move( wxPoint(MoveVector) );
( (COTATION*) item )->Move( wxPoint(MoveVector) );
break;
default:
@ -1098,8 +1089,6 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
* routine de duplication des elements du block deja selectionne
*/
{
MODULE* module;
EDA_BaseStruct* PtStruct;
int masque_layer;
wxPoint oldpos;
wxPoint MoveVector = GetScreen()->BlockLocate.m_MoveVector;
@ -1120,24 +1109,23 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
{
bool Show_Ratsnest_tmp = g_Show_Ratsnest;
g_Show_Ratsnest = false;
module = m_Pcb->m_Modules;
oldpos = GetScreen()->m_Curseur;
for( ; module != NULL; module = module->Next() )
for( MODULE* module= m_Pcb->m_Modules; module; module = module->Next() )
{
MODULE* new_module;
if( ! module->HitTest( GetScreen()->BlockLocate ) )
continue;
/* le module est ici bon a etre deplace */
m_Pcb->m_Status_Pcb = 0;
module->m_Flags = 0;
new_module = new MODULE( m_Pcb );
new_module->Copy( module );
new_module->m_TimeStamp = GetTimeStamp();
new_module->SetNext( m_Pcb->m_Modules );
new_module->SetBack( m_Pcb );
m_Pcb->m_Modules->SetBack( new_module );
m_Pcb->m_Modules = new_module;
m_Pcb->m_Modules.PushFront( new_module );
GetScreen()->m_Curseur = module->m_Pos + MoveVector;
Place_Module( new_module, DC );
}
@ -1158,10 +1146,13 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
{
/* la piste est ici bonne a etre deplacee */
m_Pcb->m_Status_Pcb = 0;
new_track = track->Copy();
new_track->Insert( m_Pcb, NULL );
m_Pcb->m_Track.PushFront( new_track );
new_track->m_Start += MoveVector;
new_track->m_End += MoveVector;
new_track->Draw( DrawPanel, DC, GR_OR ); // reaffichage
}
track = next_track;
@ -1171,19 +1162,19 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
/* Duplicate Zones */
if( Block_Include_Zones )
{
SEGZONE* segzone, * new_segzone;
segzone = m_Pcb->m_Zone;
while( segzone )
for( SEGZONE* segzone = m_Pcb->m_Zone; segzone; segzone = segzone->Next() )
{
if( segzone->HitTest( GetScreen()->BlockLocate ) )
{
new_segzone = (SEGZONE*) segzone->Copy();
new_segzone->Insert( m_Pcb, NULL );
SEGZONE* new_segzone = (SEGZONE*) segzone->Copy();
m_Pcb->m_Zone.PushFront( new_segzone );
new_segzone->m_Start += MoveVector;
new_segzone->m_End += MoveVector;
new_segzone->Draw( DrawPanel, DC, GR_OR );
}
segzone = segzone->Next();
}
unsigned imax = m_Pcb->GetAreaCount();
@ -1207,94 +1198,88 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
if( !Block_Include_Edges_Items )
masque_layer &= ~EDGE_LAYER;
PtStruct = m_Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
for( BOARD_ITEM* item = m_Pcb->m_Drawings; item; item = item->Next() )
{
switch( PtStruct->Type() )
{
case TYPEDRAWSEGMENT:
{
#undef STRUCT
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
break;
/* l'element est ici bon a etre copie */
DRAWSEGMENT* new_drawsegment = new DRAWSEGMENT( m_Pcb );
new_drawsegment->Copy( STRUCT );
new_drawsegment->SetNext( m_Pcb->m_Drawings );
new_drawsegment->SetBack( m_Pcb );
m_Pcb->m_Drawings->SetBack( new_drawsegment );
m_Pcb->m_Drawings = new_drawsegment;
new_drawsegment->m_Start += MoveVector;
new_drawsegment->m_End += MoveVector;
new_drawsegment->Draw( DrawPanel, DC, GR_OR );
break;
}
case TYPETEXTE:
switch( item->Type() )
{
case TYPE_DRAWSEGMENT:
{
#undef STRUCT
#define STRUCT ( (TEXTE_PCB*) PtStruct )
if( !Block_Include_PcbTextes )
break;
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
break;
/* le texte est ici bon a etre deplace */
TEXTE_PCB* new_pcbtext = new TEXTE_PCB( m_Pcb );
new_pcbtext->Copy( STRUCT );
new_pcbtext->SetNext( m_Pcb->m_Drawings );
new_pcbtext->SetBack( m_Pcb );
m_Pcb->m_Drawings->SetBack( new_pcbtext );
m_Pcb->m_Drawings = new_pcbtext;
/* Redessin du Texte */
new_pcbtext->m_Pos += MoveVector;
new_pcbtext->Draw( DrawPanel, DC, GR_OR );
break;
}
#define STRUCT ( (DRAWSEGMENT*) item )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( ! item->HitTest( GetScreen()->BlockLocate ) )
break;
case TYPEMIRE:
{
#undef STRUCT
#define STRUCT ( (MIREPCB*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
break;
/* l'element est ici bon a etre efface */
MIREPCB* new_mire = new MIREPCB( m_Pcb );
new_mire->Copy( STRUCT );
new_mire->SetNext( m_Pcb->m_Drawings );
new_mire->SetBack( m_Pcb );
m_Pcb->m_Drawings->SetBack( new_mire );
m_Pcb->m_Drawings = new_mire;
new_mire->m_Pos += MoveVector;
new_mire->Draw( DrawPanel, DC, GR_OR );
break;
}
/* l'element est ici bon a etre copie */
DRAWSEGMENT* new_drawsegment = new DRAWSEGMENT( m_Pcb );
new_drawsegment->Copy( STRUCT );
case TYPECOTATION:
{
#undef STRUCT
#define STRUCT ( (COTATION*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
break;
/* l'element est ici bon a etre copie */
COTATION* new_cotation = new COTATION( m_Pcb );
new_cotation->Copy( STRUCT );
new_cotation->SetNext( m_Pcb->m_Drawings );
new_cotation->SetBack( m_Pcb );
m_Pcb->m_Drawings->SetBack( new_cotation );
m_Pcb->m_Drawings = new_cotation;
new_cotation->Move( MoveVector );
new_cotation->Draw( DrawPanel, DC, GR_OR );
m_Pcb->Add( new_drawsegment );
new_drawsegment->m_Start += MoveVector;
new_drawsegment->m_End += MoveVector;
new_drawsegment->Draw( DrawPanel, DC, GR_OR );
}
break;
case TYPE_TEXTE:
{
#undef STRUCT
#define STRUCT ( (TEXTE_PCB*) item )
if( !Block_Include_PcbTextes )
break;
if( ! item->HitTest( GetScreen()->BlockLocate ) )
break;
/* le texte est ici bon a etre deplace */
TEXTE_PCB* new_pcbtext = new TEXTE_PCB( m_Pcb );
new_pcbtext->Copy( STRUCT );
m_Pcb->Add( new_pcbtext );
/* Redessin du Texte */
new_pcbtext->m_Pos += MoveVector;
new_pcbtext->Draw( DrawPanel, DC, GR_OR );
}
break;
case TYPE_MIRE:
{
#undef STRUCT
#define STRUCT ( (MIREPCB*) item )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( ! item->HitTest( GetScreen()->BlockLocate ) )
break;
/* l'element est ici bon a etre efface */
MIREPCB* new_mire = new MIREPCB( m_Pcb );
new_mire->Copy( STRUCT );
m_Pcb->Add( new_mire );
new_mire->m_Pos += MoveVector;
new_mire->Draw( DrawPanel, DC, GR_OR );
}
break;
case TYPE_COTATION:
{
#undef STRUCT
#define STRUCT ( (COTATION*) item )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( ! item->HitTest( GetScreen()->BlockLocate ) )
break;
/* l'element est ici bon a etre copie */
COTATION* new_cotation = new COTATION( m_Pcb );
new_cotation->Copy( STRUCT );
m_Pcb->Add( new_cotation );
new_cotation->Move( MoveVector );
new_cotation->Draw( DrawPanel, DC, GR_OR );
}
break;
}
default:
break;

View File

@ -319,8 +319,8 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
switch( item->Type() )
{
case TYPETEXTEMODULE:
case TYPEEDGEMODULE:
case TYPE_TEXTE_MODULE:
case TYPE_EDGE_MODULE:
item->Draw( panel, DC, g_XorMode, move_offset );
break;
@ -361,8 +361,8 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
switch( item->Type() )
{
case TYPETEXTEMODULE:
case TYPEEDGEMODULE:
case TYPE_TEXTE_MODULE:
case TYPE_EDGE_MODULE:
item->Draw( panel, DC, g_XorMode, move_offset );
break;
@ -389,14 +389,10 @@ void CopyMarkedItems( MODULE* module, wxPoint offset )
/* Copy marked items, at new position = old position + offset
*/
{
BOARD_ITEM* item;
BOARD_ITEM* NewStruct;
if( module == NULL )
return;
D_PAD* pad = module->m_Pads;
for( ; pad != NULL; pad = pad->Next() )
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
{
if( pad->m_Selected == 0 )
continue;
@ -404,44 +400,38 @@ void CopyMarkedItems( MODULE* module, wxPoint offset )
D_PAD* NewPad = new D_PAD( module );
NewPad->Copy( pad );
NewPad->m_Selected = IS_SELECTED;
NewPad->SetNext( module->m_Pads );
NewPad->SetBack( module );
module->m_Pads->SetBack( NewPad );
module->m_Pads = NewPad;
module->m_Pads.PushBack( NewPad );
}
item = module->m_Drawings;
for( ; item != NULL; item = item->Next() )
for( BOARD_ITEM* item = module->m_Drawings; item; item->Next() )
{
if( item->m_Selected == 0 )
continue;
item->m_Selected = 0;
NewStruct = NULL;
switch( item->Type() )
{
case TYPETEXTEMODULE:
NewStruct = new TEXTE_MODULE( module );
( (TEXTE_MODULE*) NewStruct )->Copy( (TEXTE_MODULE*) item );
case TYPE_TEXTE_MODULE:
TEXTE_MODULE* textm;
textm = new TEXTE_MODULE( module );
textm->Copy( (TEXTE_MODULE*) item );
textm->m_Selected = IS_SELECTED;
module->m_Drawings.PushFront( textm );
break;
case TYPEEDGEMODULE:
NewStruct = new EDGE_MODULE( module );
( (EDGE_MODULE*) NewStruct )->Copy( (EDGE_MODULE*) item );
case TYPE_EDGE_MODULE:
EDGE_MODULE* edge;
edge = new EDGE_MODULE( module );
edge->Copy( (EDGE_MODULE*) item );
edge->m_Selected = IS_SELECTED;
module->m_Drawings.PushFront( edge );
break;
default:
DisplayError( NULL, wxT( "Internal Err: CopyMarkedItems: type indefini" ) );
break;
}
if( NewStruct == NULL )
break;
NewStruct->m_Selected = IS_SELECTED;
NewStruct->SetNext( module->m_Drawings );
NewStruct->SetBack( module );
module->m_Drawings->SetBack( module );
module->m_Drawings = NewStruct;
}
MoveMarkedItems( module, offset );
@ -479,14 +469,14 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
switch( item->Type() )
{
case TYPETEXTEMODULE:
case TYPE_TEXTE_MODULE:
( (TEXTE_MODULE*) item )->GetPosition().x += offset.x;
( (TEXTE_MODULE*) item )->GetPosition().y += offset.y;
( (TEXTE_MODULE*) item )->m_Pos0.x += offset.x;
( (TEXTE_MODULE*) item )->m_Pos0.y += offset.y;
break;
case TYPEEDGEMODULE:
case TYPE_EDGE_MODULE:
( (EDGE_MODULE*) item )->m_Start.x += offset.x;
( (EDGE_MODULE*) item )->m_Start.y += offset.y;
@ -578,7 +568,7 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
switch( item->Type() )
{
case TYPEEDGEMODULE:
case TYPE_EDGE_MODULE:
SETMIRROR( ( (EDGE_MODULE*) item )->m_Start.x );
( (EDGE_MODULE*) item )->m_Start0.x = ( (EDGE_MODULE*) item )->m_Start.x;
SETMIRROR( ( (EDGE_MODULE*) item )->m_End.x );
@ -586,7 +576,7 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
( (EDGE_MODULE*) item )->m_Angle = -( (EDGE_MODULE*) item )->m_Angle;
break;
case TYPETEXTEMODULE:
case TYPE_TEXTE_MODULE:
SETMIRROR( ( (TEXTE_MODULE*) item )->GetPosition().x );
( (TEXTE_MODULE*) item )->m_Pos0.x = ( (TEXTE_MODULE*) item )->GetPosition().x;
break;
@ -632,14 +622,14 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
switch( item->Type() )
{
case TYPEEDGEMODULE:
case TYPE_EDGE_MODULE:
ROTATE( ( (EDGE_MODULE*) item )->m_Start );
( (EDGE_MODULE*) item )->m_Start0 = ( (EDGE_MODULE*) item )->m_Start;
ROTATE( ( (EDGE_MODULE*) item )->m_End );
( (EDGE_MODULE*) item )->m_End0 = ( (EDGE_MODULE*) item )->m_End;
break;
case TYPETEXTEMODULE:
case TYPE_TEXTE_MODULE:
ROTATE( ( (TEXTE_MODULE*) item )->GetPosition() );
( (TEXTE_MODULE*) item )->m_Pos0 = ( (TEXTE_MODULE*) item )->GetPosition();
( (TEXTE_MODULE*) item )->m_Orient += 900;
@ -708,7 +698,7 @@ int MarkItemsInBloc( MODULE* module, EDA_Rect& Rect )
switch( item->Type() )
{
case TYPEEDGEMODULE:
case TYPE_EDGE_MODULE:
pos = ( (EDGE_MODULE*) item )->m_Start;
if( Rect.Inside( pos ) )
{
@ -723,7 +713,7 @@ int MarkItemsInBloc( MODULE* module, EDA_Rect& Rect )
}
break;
case TYPETEXTEMODULE:
case TYPE_TEXTE_MODULE:
pos = ( (TEXTE_MODULE*) item )->GetPosition();
if( Rect.Inside( pos ) )
{

View File

@ -167,7 +167,7 @@ void BOARDHEAD::UnInitBoard()
/*****************************************************/
void PlaceCells( BOARD* Pcb, int net_code, int flag )
void PlaceCells( BOARD* aPcb, int net_code, int flag )
/*****************************************************/
/* Initialise les cellules du board a la valeur HOLE et VIA_IMPOSSIBLE
@ -182,12 +182,6 @@ void PlaceCells( BOARD* Pcb, int net_code, int flag )
* si FORCE_PADS : tous les pads seront places meme ceux de meme net_code
*/
{
int ii;
LISTE_PAD* ptr;
TRACK* pt_segm;
TEXTE_PCB* PtText;
DRAWSEGMENT* DrawSegm;
BOARD_ITEM* PtStruct;
int ux0 = 0, uy0 = 0, ux1, uy1, dx, dy;
int marge, via_marge;
int masque_layer;
@ -198,47 +192,50 @@ void PlaceCells( BOARD* Pcb, int net_code, int flag )
/////////////////////////////////////
// Placement des PADS sur le board //
/////////////////////////////////////
ptr = (LISTE_PAD*) Pcb->m_Pads; ii = Pcb->m_NbPads;
for( ; ii > 0; ii--, ptr++ )
for( unsigned i=0; i<aPcb->m_Pads.size(); ++i )
{
if( (net_code != (*ptr)->GetNet() ) || (flag & FORCE_PADS) )
D_PAD* pad = aPcb->m_Pads[i];
if( net_code != pad->GetNet() || (flag & FORCE_PADS) )
{
Place_1_Pad_Board( Pcb, *ptr, HOLE, marge, WRITE_CELL );
Place_1_Pad_Board( aPcb, pad, HOLE, marge, WRITE_CELL );
}
Place_1_Pad_Board( Pcb, *ptr, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
Place_1_Pad_Board( aPcb, pad, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
}
///////////////////////////////////////////////
// Placement des elements de modules sur PCB //
///////////////////////////////////////////////
PtStruct = Pcb->m_Modules;
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
{
BOARD_ITEM* PtModStruct = ( (MODULE*) PtStruct )->m_Drawings;
for( ; PtModStruct != NULL; PtModStruct = PtModStruct->Next() )
for( BOARD_ITEM* item = module->m_Drawings; item; item = item->Next() )
{
switch( PtModStruct->Type() )
switch( item->Type() )
{
case TYPEEDGEMODULE:
{
TRACK* TmpSegm = new TRACK( NULL );
TmpSegm->SetLayer( ( (EDGE_MODULE*) PtModStruct )->GetLayer() );
if( TmpSegm->GetLayer() == EDGE_N )
TmpSegm->SetLayer( -1 );
case TYPE_EDGE_MODULE:
{
EDGE_MODULE* edge = (EDGE_MODULE*) item;
TmpSegm->m_Start = ( (EDGE_MODULE*) PtModStruct )->m_Start;
TmpSegm->m_End = ( (EDGE_MODULE*) PtModStruct )->m_End;
TmpSegm->m_Shape = ( (EDGE_MODULE*) PtModStruct )->m_Shape;
TmpSegm->m_Width = ( (EDGE_MODULE*) PtModStruct )->m_Width;
TmpSegm->m_Param = ( (EDGE_MODULE*) PtModStruct )->m_Angle;
TmpSegm->SetNet( -1 );
TRACK* TmpSegm = new TRACK( NULL );
TraceSegmentPcb( Pcb, TmpSegm, HOLE, marge, WRITE_CELL );
TraceSegmentPcb( Pcb, TmpSegm, VIA_IMPOSSIBLE, via_marge,
WRITE_OR_CELL );
delete TmpSegm;
TmpSegm->SetLayer( edge->GetLayer() );
if( TmpSegm->GetLayer() == EDGE_N )
TmpSegm->SetLayer( -1 );
TmpSegm->m_Start = edge->m_Start;
TmpSegm->m_End = edge->m_End;
TmpSegm->m_Shape = edge->m_Shape;
TmpSegm->m_Width = edge->m_Width;
TmpSegm->m_Param = edge->m_Angle;
TmpSegm->SetNet( -1 );
TraceSegmentPcb( aPcb, TmpSegm, HOLE, marge, WRITE_CELL );
TraceSegmentPcb( aPcb, TmpSegm, VIA_IMPOSSIBLE, via_marge,
WRITE_OR_CELL );
delete TmpSegm;
}
break;
}
default:
break;
@ -249,57 +246,67 @@ void PlaceCells( BOARD* Pcb, int net_code, int flag )
////////////////////////////////////////////
// Placement des contours et segments PCB //
////////////////////////////////////////////
PtStruct = Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
for( BOARD_ITEM* item = aPcb->m_Drawings; item; item = item->Next() )
{
switch( PtStruct->Type() )
switch( item->Type() )
{
case TYPEDRAWSEGMENT:
{
int type_cell = HOLE;
TRACK* TmpSegm = new TRACK( NULL );
DrawSegm = (DRAWSEGMENT*) PtStruct;
TmpSegm->SetLayer( DrawSegm->GetLayer() );
if( DrawSegm->GetLayer() == EDGE_N )
case TYPE_DRAWSEGMENT:
{
TmpSegm->SetLayer( -1 );
type_cell |= CELL_is_EDGE;
DRAWSEGMENT* DrawSegm;
int type_cell = HOLE;
TRACK* TmpSegm = new TRACK( NULL );
DrawSegm = (DRAWSEGMENT*) item;
TmpSegm->SetLayer( DrawSegm->GetLayer() );
if( DrawSegm->GetLayer() == EDGE_N )
{
TmpSegm->SetLayer( -1 );
type_cell |= CELL_is_EDGE;
}
TmpSegm->m_Start = DrawSegm->m_Start;
TmpSegm->m_End = DrawSegm->m_End;
TmpSegm->m_Shape = DrawSegm->m_Shape;
TmpSegm->m_Width = DrawSegm->m_Width;
TmpSegm->m_Param = DrawSegm->m_Angle;
TmpSegm->SetNet( -1 );
TraceSegmentPcb( aPcb, TmpSegm, type_cell, marge, WRITE_CELL );
// TraceSegmentPcb(Pcb, TmpSegm, VIA_IMPOSSIBLE, via_marge,WRITE_OR_CELL );
delete TmpSegm;
}
TmpSegm->m_Start = DrawSegm->m_Start;
TmpSegm->m_End = DrawSegm->m_End;
TmpSegm->m_Shape = DrawSegm->m_Shape;
TmpSegm->m_Width = DrawSegm->m_Width;
TmpSegm->m_Param = DrawSegm->m_Angle;
TmpSegm->SetNet( -1 );
TraceSegmentPcb( Pcb, TmpSegm, type_cell, marge, WRITE_CELL );
// TraceSegmentPcb(Pcb, TmpSegm, VIA_IMPOSSIBLE, via_marge,WRITE_OR_CELL );
delete TmpSegm;
break;
}
case TYPETEXTE:
PtText = (TEXTE_PCB*) PtStruct;
case TYPE_TEXTE:
TEXTE_PCB* PtText;
PtText = (TEXTE_PCB*) item;
if( PtText->GetLength() == 0 )
break;
ux0 = PtText->m_Pos.x; uy0 = PtText->m_Pos.y;
dx = PtText->Pitch() * PtText->GetLength();
dy = PtText->m_Size.y + PtText->m_Width;
/* Put bounding box (rectangle) on matrix */
dx /= 2; dy /= 2; /* dx et dy = demi dimensionx X et Y */
ux1 = ux0 + dx; uy1 = uy0 + dy;
ux0 -= dx; uy0 -= dy;
dx /= 2;
dy /= 2; /* dx et dy = demi dimensionx X et Y */
ux1 = ux0 + dx;
uy1 = uy0 + dy;
ux0 -= dx;
uy0 -= dy;
masque_layer = g_TabOneLayerMask[PtText->GetLayer()];
TraceFilledRectangle( Pcb, ux0 - marge, uy0 - marge, ux1 + marge, uy1 + marge,
TraceFilledRectangle( aPcb, ux0 - marge, uy0 - marge, ux1 + marge, uy1 + marge,
(int) (PtText->m_Orient),
masque_layer, HOLE, WRITE_CELL );
TraceFilledRectangle( Pcb, ux0 - via_marge, uy0 - via_marge,
TraceFilledRectangle( aPcb, ux0 - via_marge, uy0 - via_marge,
ux1 + via_marge, uy1 + via_marge,
(int) (PtText->m_Orient),
masque_layer, VIA_IMPOSSIBLE, WRITE_OR_CELL );
@ -311,24 +318,23 @@ void PlaceCells( BOARD* Pcb, int net_code, int flag )
}
/* Put tracks and vias on matrix */
pt_segm = Pcb->m_Track;
for( ; pt_segm != NULL; pt_segm = pt_segm->Next() )
for( TRACK* track = aPcb->m_Track; track; track = track->Next() )
{
if( net_code == pt_segm->GetNet() )
if( net_code == track->GetNet() )
continue;
TraceSegmentPcb( Pcb, pt_segm, HOLE, marge, WRITE_CELL );
TraceSegmentPcb( Pcb, pt_segm, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
TraceSegmentPcb( aPcb, track, HOLE, marge, WRITE_CELL );
TraceSegmentPcb( aPcb, track, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
}
/* Put zone filling on matrix */
pt_segm = (TRACK*) Pcb->m_Zone;
for( ; pt_segm != NULL; pt_segm = pt_segm->Next() )
// Put zone filling on matrix
for( SEGZONE* zone = aPcb->m_Zone; zone; zone = zone->Next() )
{
if( net_code == pt_segm->GetNet() )
if( net_code == zone->GetNet() )
continue;
TraceSegmentPcb( Pcb, pt_segm, HOLE, marge, WRITE_CELL );
TraceSegmentPcb( Pcb, pt_segm, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
TraceSegmentPcb( aPcb, zone, HOLE, marge, WRITE_CELL );
TraceSegmentPcb( aPcb, zone, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
}
}

View File

@ -30,30 +30,20 @@ void SCH_ITEM::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
/* Constructor */
BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) :
BOARD_ITEM( (BOARD_ITEM*) parent, TYPEPCB )
BOARD_ITEM( (BOARD_ITEM*) parent, TYPE_PCB )
{
m_PcbFrame = frame;
m_Status_Pcb = 0; // Mot d'etat: Bit 1 = Chevelu calcule
m_NbNets = 0; // Nombre de nets (equipotentielles)
m_BoardSettings = &g_DesignSettings;
m_NbPads = 0; // nombre total de pads
m_NbNodes = 0; // nombre de pads connectes
m_NbLinks = 0; // nombre de chevelus (donc aussi nombre
// minimal de pistes a tracer
m_NbSegmTrack = 0; // nombre d'elements de type segments de piste
m_NbSegmZone = 0; // nombre d'elements de type segments de zone
m_NbNoconnect = 0; // nombre de chevelus actifs
m_NbLoclinks = 0; // nb ratsnest local
m_Drawings = NULL; // pointeur sur liste drawings
m_Modules = NULL; // pointeur sur liste zone modules
m_Equipots = NULL; // pointeur liste zone equipot
m_Track = NULL; // pointeur relatif zone piste
m_Zone = NULL; // pointeur tableau zone zones de cuivre
m_Pads = NULL; // pointeur liste d'acces aux pads
m_Ratsnest = NULL; // pointeur liste rats
m_LocalRatsnest = NULL; // pointeur liste rats local
m_CurrentZoneContour = NULL; // This ZONE_CONTAINER handle the zone contour currently in progress
m_CurrentZoneContour = NULL; // This ZONE_CONTAINER handle the zone contour cuurently in progress
// de determination des contours de zone
for( int layer=0; layer<NB_COPPER_LAYERS; ++layer )
@ -69,31 +59,12 @@ BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) :
/***************/
BOARD::~BOARD()
{
m_Drawings->DeleteStructList();
m_Drawings = 0;
m_Modules->DeleteStructList();
m_Modules = 0;
m_Equipots->DeleteStructList();
m_Equipots = 0;
m_Track->DeleteStructList();
m_Track = 0;
m_Zone->DeleteStructList();
m_Zone = 0;
while ( m_ZoneDescriptorList.size() )
{
ZONE_CONTAINER* area_to_remove = m_ZoneDescriptorList[0];
Delete( area_to_remove );
}
MyFree( m_Pads );
m_Pads = 0;
MyFree( m_Ratsnest );
m_Ratsnest = 0;
@ -226,7 +197,7 @@ void BOARD::UnLink()
/* Update back link */
if( Back() )
{
if( Back()->Type() == TYPEPCB )
if( Back()->Type() == TYPE_PCB )
{
Back()->SetNext( Next() );
}
@ -252,47 +223,59 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
switch( aBoardItem->Type() )
{
// this one uses a vector
case TYPEMARKER:
case TYPE_MARKER:
aBoardItem->SetParent( this );
m_markers.push_back( (MARKER*) aBoardItem );
break;
// this one uses a vector
case TYPEZONE_CONTAINER:
case TYPE_ZONE_CONTAINER:
aBoardItem->SetParent( this );
m_ZoneDescriptorList.push_back( (ZONE_CONTAINER*) aBoardItem );
break;
case TYPETRACK:
case TYPEVIA:
case TYPE_TRACK:
case TYPE_VIA:
{
TRACK* insertAid = ((TRACK*)aBoardItem)->GetBestInsertPoint( this );
((TRACK*)aBoardItem)->Insert( this, insertAid );
m_Track.Insert( (TRACK*)aBoardItem, insertAid );
}
break;
case TYPEZONE:
{ // Add item to head of list (starting in m_Zone)
aBoardItem->SetParent( this );
aBoardItem->SetBack( this ); // item will be the first item: back chain to the board
BOARD_ITEM* next_item = m_Zone; // Remember old the first item
aBoardItem->SetNext( next_item ); // Chain the new one ton the old item
if( next_item ) // Back chain the old item to the new one
next_item->SetBack( aBoardItem );
m_Zone = (SEGZONE*) aBoardItem; // Add to head of list
}
case TYPE_ZONE:
if( aControl & ADD_APPEND )
m_Zone.PushBack( (SEGZONE*) aBoardItem );
else
m_Zone.PushFront( (SEGZONE*) aBoardItem );
aBoardItem->SetParent( this );
break;
case TYPEMODULE:
// this is an insert, not an append which may also be needed.
{
aBoardItem->SetBack( this );
BOARD_ITEM* next = m_Modules;
aBoardItem->SetNext( next );
if( next )
next->SetBack( aBoardItem );
m_Modules = (MODULE*) aBoardItem;
}
case TYPE_MODULE:
if( aControl & ADD_APPEND )
m_Modules.PushBack( (MODULE*) aBoardItem );
else
m_Modules.PushFront( (MODULE*) aBoardItem );
aBoardItem->SetParent( this );
break;
case TYPE_COTATION:
case TYPE_DRAWSEGMENT:
case TYPE_TEXTE:
case TYPE_EDGE_MODULE:
case TYPE_MIRE:
if( aControl & ADD_APPEND )
m_Drawings.PushBack( aBoardItem );
else
m_Drawings.PushFront( aBoardItem );
aBoardItem->SetParent( this );
break;
case TYPE_EQUIPOT:
if( aControl & ADD_APPEND )
m_Equipots.PushBack( (EQUIPOT*) aBoardItem );
else
m_Equipots.PushFront( (EQUIPOT*) aBoardItem );
aBoardItem->SetParent( this );
break;
// other types may use linked list
@ -308,7 +291,7 @@ void BOARD::Delete( BOARD_ITEM* aBoardItem )
switch( aBoardItem->Type() )
{
case TYPEMARKER: // this one uses a vector
case TYPE_MARKER: // this one uses a vector
// find the item in the vector, then delete then erase it.
for( unsigned i=0; i<m_markers.size(); ++i )
{
@ -320,7 +303,7 @@ void BOARD::Delete( BOARD_ITEM* aBoardItem )
}
break;
case TYPEZONE_CONTAINER: // this one uses a vector
case TYPE_ZONE_CONTAINER: // this one uses a vector
// find the item in the vector, then delete then erase it.
for( unsigned i=0; i<m_ZoneDescriptorList.size(); ++i )
{
@ -372,28 +355,14 @@ void BOARD::DeleteZONEOutlines()
/* Calculate the track segment count */
int BOARD::GetNumSegmTrack()
{
TRACK* CurTrack = m_Track;
int ii = 0;
for( ; CurTrack != NULL; CurTrack = CurTrack->Next() )
ii++;
m_NbSegmTrack = ii;
return ii;
return m_Track.GetCount();
}
/* Calculate the zone segment count */
int BOARD::GetNumSegmZone()
{
TRACK* CurTrack = m_Zone;
int ii = 0;
for( ; CurTrack != NULL; CurTrack = CurTrack->Next() )
ii++;
m_NbSegmZone = ii;
return ii;
return m_Zone.GetCount();
}
@ -435,7 +404,7 @@ bool BOARD::ComputeBoundaryBox()
PtStruct = m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{
if( PtStruct->Type() != TYPEDRAWSEGMENT )
if( PtStruct->Type() != TYPE_DRAWSEGMENT )
continue;
ptr = (DRAWSEGMENT*) PtStruct;
@ -560,13 +529,13 @@ void BOARD::Display_Infos( WinEDA_DrawFrame* frame )
frame->MsgPanel->EraseMsgBox();
txt.Printf( wxT( "%d" ), m_NbPads );
txt.Printf( wxT( "%d" ), m_Pads.size() );
Affiche_1_Parametre( frame, POS_AFF_NBPADS, _( "Pads" ), txt, DARKGREEN );
int nb_vias = 0;
for( BOARD_ITEM* item = m_Track; item; item = item->Next() )
{
if( item->Type() == TYPEVIA )
if( item->Type() == TYPE_VIA )
nb_vias++;
}
@ -579,7 +548,7 @@ void BOARD::Display_Infos( WinEDA_DrawFrame* frame )
txt.Printf( wxT( "%d" ), m_NbLinks );
Affiche_1_Parametre( frame, POS_AFF_NBLINKS, _( "Links" ), txt, DARKGREEN );
txt.Printf( wxT( "%d" ), m_NbNets );
txt.Printf( wxT( "%d" ), m_Equipots.GetCount() );
Affiche_1_Parametre( frame, POS_AFF_NBNETS, _( "Nets" ), txt, RED );
txt.Printf( wxT( "%d" ), m_NbLinks - GetNumNoconnect() );
@ -608,7 +577,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
stype = *p;
switch( stype )
{
case TYPEPCB:
case TYPE_PCB:
result = inspector->Inspect( this, testData ); // inspect me
// skip over any types handled in the above call.
++p;
@ -621,10 +590,10 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
IterateForward( m_Modules, ... ) call.
*/
case TYPEMODULE:
case TYPEPAD:
case TYPETEXTEMODULE:
case TYPEEDGEMODULE:
case TYPE_MODULE:
case TYPE_PAD:
case TYPE_TEXTE_MODULE:
case TYPE_EDGE_MODULE:
// this calls MODULE::Visit() on each module.
result = IterateForward( m_Modules, inspector, testData, p );
// skip over any types handled in the above call.
@ -632,10 +601,10 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
{
switch( stype = *++p )
{
case TYPEMODULE:
case TYPEPAD:
case TYPETEXTEMODULE:
case TYPEEDGEMODULE:
case TYPE_MODULE:
case TYPE_PAD:
case TYPE_TEXTE_MODULE:
case TYPE_EDGE_MODULE:
continue;
default:;
}
@ -643,20 +612,20 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
}
break;
case TYPEDRAWSEGMENT:
case TYPETEXTE:
case TYPECOTATION:
case TYPEMIRE:
case TYPE_DRAWSEGMENT:
case TYPE_TEXTE:
case TYPE_COTATION:
case TYPE_MIRE:
result = IterateForward( m_Drawings, inspector, testData, p );
// skip over any types handled in the above call.
for(;;)
{
switch( stype = *++p )
{
case TYPEDRAWSEGMENT:
case TYPETEXTE:
case TYPECOTATION:
case TYPEMIRE:
case TYPE_DRAWSEGMENT:
case TYPE_TEXTE:
case TYPE_COTATION:
case TYPE_MIRE:
continue;
default:;
}
@ -678,16 +647,16 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
// Usually, because of this sort, a connected item (if exists) is found.
// If not found (and only in this case) an exhaustive (and time consumming) search is made,
// but this case is statistically rare.
case TYPEVIA:
case TYPETRACK:
case TYPE_VIA:
case TYPE_TRACK:
result = IterateForward( m_Track, inspector, testData, p );
// skip over any types handled in the above call.
for(;;)
{
switch( stype = *++p )
{
case TYPEVIA:
case TYPETRACK:
case TYPE_VIA:
case TYPE_TRACK:
continue;
default:;
}
@ -695,18 +664,18 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
}
break;
#else
case TYPEVIA:
case TYPE_VIA:
result = IterateForward( m_Track, inspector, testData, p );
++p;
break;
case TYPETRACK:
case TYPE_TRACK:
result = IterateForward( m_Track, inspector, testData, p );
++p;
break;
#endif
case TYPEMARKER:
case TYPE_MARKER:
// MARKERS are in the m_markers std::vector
for( unsigned i=0; i<m_markers.size(); ++i )
{
@ -717,8 +686,8 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
++p;
break;
case TYPEZONE_CONTAINER:
// TYPEZONE_CONTAINER are in the m_ZoneDescriptorList std::vector
case TYPE_ZONE_CONTAINER:
// TYPE_ZONE_CONTAINER are in the m_ZoneDescriptorList std::vector
for( unsigned i=0; i< m_ZoneDescriptorList.size(); ++i )
{
result = m_ZoneDescriptorList[i]->Visit( inspector, testData, p );
@ -728,17 +697,17 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
++p;
break;
case PCB_EQUIPOT_STRUCT_TYPE:
case TYPE_EQUIPOT:
result = IterateForward( m_Equipots, inspector, testData, p );
++p;
break;
case TYPEZONE:
case TYPE_ZONE:
result = IterateForward( m_Zone, inspector, testData, p );
++p;
break;
case TYPEZONE_UNUSED: // Unused type
case TYPE_ZONE_UNUSED: // Unused type
break;
default: // catch EOT or ANY OTHER type here and return.
@ -775,7 +744,7 @@ BOARD_ITEM* BOARD::FindPadOrModule( const wxPoint& refPos, int layer )
BOARD_ITEM* item = (BOARD_ITEM*) testItem;
const wxPoint& refPos = *(const wxPoint*) testData;
if( item->Type() == TYPEPAD )
if( item->Type() == TYPE_PAD )
{
D_PAD* pad = (D_PAD*) item;
if( pad->HitTest( refPos ) )
@ -794,7 +763,7 @@ BOARD_ITEM* BOARD::FindPadOrModule( const wxPoint& refPos, int layer )
}
}
else if( item->Type() == TYPEMODULE )
else if( item->Type() == TYPE_MODULE )
{
MODULE* module = (MODULE*) item;
@ -823,7 +792,7 @@ BOARD_ITEM* BOARD::FindPadOrModule( const wxPoint& refPos, int layer )
PadOrModule inspector( layer );
// search only for PADs first, then MODULES, and preferably a layer match
static const KICAD_T scanTypes[] = { TYPEPAD, TYPEMODULE, EOT };
static const KICAD_T scanTypes[] = { TYPE_PAD, TYPE_MODULE, EOT };
// visit this BOARD with the above inspector
Visit( &inspector, &refPos, scanTypes );
@ -900,7 +869,7 @@ MODULE* BOARD::FindModuleByReference( const wxString& aReference ) const
} inspector;
// search only for MODULES
static const KICAD_T scanTypes[] = { TYPEMODULE, EOT };
static const KICAD_T scanTypes[] = { TYPE_MODULE, EOT };
// visit this BOARD with the above inspector
BOARD* nonconstMe = (BOARD*) this;
@ -1008,10 +977,10 @@ bool BOARD::Save( FILE* aFile ) const
{
switch( item->Type() )
{
case TYPETEXTE:
case TYPEDRAWSEGMENT:
case TYPEMIRE:
case TYPECOTATION:
case TYPE_TEXTE:
case TYPE_DRAWSEGMENT:
case TYPE_MIRE:
case TYPE_COTATION:
if( !item->Save( aFile ) )
goto out;
break;

View File

@ -5,6 +5,10 @@
#ifndef CLASS_BOARD_H
#define CLASS_BOARD_H
#include "dlist.h"
class ZONE_CONTAINER;
class EDA_BoardDesignSettings;
@ -80,27 +84,27 @@ public:
int m_Unused;
int m_Status_Pcb; // Flags used in ratsnet calculation and update
EDA_BoardDesignSettings* m_BoardSettings; // Link to current design settings
int m_NbNets; // Nets (equipotentielles) count
int m_NbNodes; // Active pads (pads attached to a net ) count
int m_NbLinks; // Ratsnet count
int m_NbLoclinks; // Rastests to shew while creating a track
int m_NbNoconnect; // Active ratsnet count (rastnest not alraedy connected by tracks
int m_NbSegmTrack; // Track items count
int m_NbSegmZone; // Zone items count
BOARD_ITEM* m_Drawings; // linked list of lines & texts
MODULE* m_Modules; // linked list of MODULEs
EQUIPOT* m_Equipots; // linked list of nets
TRACK* m_Track; // linked list of TRACKs and SEGVIAs
SEGZONE* m_Zone; // linked list of SEGZONEs
D_PAD** m_Pads; // Entry for a sorted pad list (used in ratsnest calculations)
int m_NbPads; // Pad count
DLIST<BOARD_ITEM> m_Drawings; // linked list of lines & texts
DLIST<MODULE> m_Modules; // linked list of MODULEs
DLIST<EQUIPOT> m_Equipots; // linked list of nets
DLIST<TRACK> m_Track; // linked list of TRACKs and SEGVIAs
DLIST<SEGZONE> m_Zone; // linked list of SEGZONEs
std::vector<D_PAD*> m_Pads; // Entry for a sorted pad list (used in ratsnest calculations)
CHEVELU* m_Ratsnest; // Rastnest list
CHEVELU* m_LocalRatsnest; // Rastnest list used while moving a footprint
ZONE_CONTAINER* m_CurrentZoneContour; // zone contour currently in progress
BOARD( EDA_BaseStruct* StructFather, WinEDA_BasePcbFrame* frame );
BOARD( EDA_BaseStruct* aParent, WinEDA_BasePcbFrame* frame );
~BOARD();
/**

View File

@ -12,8 +12,8 @@
#include "cvpcb.h"
#endif
BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( BOARD_ITEM* StructFather, KICAD_T idtype ) :
BOARD_ITEM( StructFather, idtype )
BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ) :
BOARD_ITEM( aParent, idtype )
{
m_NetCode = 0;
m_Subnet = 0;

View File

@ -36,6 +36,8 @@ wxString BOARD_ITEM::ShowShape( Track_Shapes aShape )
}
#if !defined(GERBVIEW)
/********************************************************/
wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
/********************************************************/
@ -53,17 +55,17 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
switch( item->Type() )
{
case PCB_EQUIPOT_STRUCT_TYPE:
case TYPE_EQUIPOT:
text << _( "Net" ) << ( (EQUIPOT*) item )->m_Netname << wxT( " " ) <<
( (EQUIPOT*) item )->GetNet();
break;
case TYPEMODULE:
case TYPE_MODULE:
text << _( "Footprint" ) << wxT( " " ) << ( (MODULE*) item )->GetReference();
text << wxT( " (" ) << aPcb->GetLayerName( item->m_Layer ).Trim() << wxT( ")" );
break;
case TYPEPAD:
case TYPE_PAD:
pad = (D_PAD *) this;
text << _( "Pad" ) << wxT( " \"" ) << pad->ReturnStringPadName()
<< wxT( "\" (" );
@ -77,14 +79,14 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
text << _( ") of " ) << ( (MODULE*) GetParent() )->GetReference();
break;
case TYPEDRAWSEGMENT:
case TYPE_DRAWSEGMENT:
text << _( "Pcb Graphic" ) << wxT(": ")
<< ShowShape( (Track_Shapes) ((DRAWSEGMENT*)item)->m_Shape )
<< wxChar(' ') << _("Length:") << valeur_param( (int) ((DRAWSEGMENT*)item)->GetLength(), temp )
<< _( " on " ) << aPcb->GetLayerName( item->GetLayer() ).Trim();
break;
case TYPETEXTE:
case TYPE_TEXTE:
text << _( "Pcb Text" ) << wxT( " " );;
if( ( (TEXTE_PCB*) item )->m_Text.Len() < 12 )
text << ( (TEXTE_PCB*) item )->m_Text;
@ -93,7 +95,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
text << _( " on " ) << aPcb->GetLayerName( item->GetLayer() ).Trim();
break;
case TYPETEXTEMODULE:
case TYPE_TEXTE_MODULE:
switch( ( (TEXTE_MODULE*) item )->m_Type )
{
case TEXT_is_REFERENCE:
@ -113,7 +115,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
}
break;
case TYPEEDGEMODULE:
case TYPE_EDGE_MODULE:
text << _( "Graphic" ) << wxT( " " );
text << ShowShape( (Track_Shapes) ( (EDGE_MODULE*) item )->m_Shape );
text << wxT( " (" ) << aPcb->GetLayerName( ((EDGE_MODULE*) item )->m_Layer ).Trim() << wxT( ")" );
@ -121,7 +123,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
<< ( (MODULE*) GetParent() )->GetReference();
break;
case TYPETRACK:
case TYPE_TRACK:
// deleting tracks requires all the information we can get to
// disambiguate all the choices under the cursor!
text << _( "Track" ) << wxT( " " ) << ((TRACK*)item)->ShowWidth();
@ -135,7 +137,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
<< wxT(" ") << _("Length:") << valeur_param( (int) ((TRACK*)item)->GetLength(), temp );
break;
case TYPEZONE_CONTAINER:
case TYPE_ZONE_CONTAINER:
text = _( "Zone Outline" );
{
ZONE_CONTAINER* area = (ZONE_CONTAINER*) this;
@ -169,7 +171,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
text << _( " on " ) << aPcb->GetLayerName( item->GetLayer() ).Trim();
break;
case TYPEZONE:
case TYPE_ZONE:
text = _( "Zone" );
text << wxT( " " );
{
@ -185,7 +187,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
text << _( " on " ) << aPcb->GetLayerName( item->GetLayer() ).Trim();
break;
case TYPEVIA:
case TYPE_VIA:
{
SEGVIA* via = (SEGVIA*) item;
text << _( "Via" ) << wxT( " " ) << via->ShowWidth();
@ -216,23 +218,23 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
}
break;
case TYPEMARKER:
case TYPE_MARKER:
text << _( "Marker" ) << wxT( " @(" ) << ((MARKER*)item)->GetPos().x
<< wxT(",") << ((MARKER*)item)->GetPos().y << wxT(")");
break;
case TYPECOTATION:
case TYPE_COTATION:
text << _( "Dimension" ) << wxT( " \"" ) << ( (COTATION*) item )->GetText() << wxT( "\"" );
break;
case TYPEMIRE:
case TYPE_MIRE:
valeur_param( ((MIREPCB*)item)->m_Size, msg );
text << _( "Target" ) << _( " on " ) << aPcb->GetLayerName( item->GetLayer() ).Trim()
<< wxT( " " ) << _( "size" ) << wxT( " " ) << msg
;
break;
case TYPEZONE_UNUSED:
case TYPE_ZONE_UNUSED:
text << wxT( "Unused" );
break;
@ -258,60 +260,60 @@ const char** BOARD_ITEM::MenuIcon() const
switch( item->Type() )
{
case PCB_EQUIPOT_STRUCT_TYPE:
case TYPE_EQUIPOT:
xpm = general_ratsnet_xpm;
break;
case TYPEMODULE:
case TYPE_MODULE:
xpm = module_xpm;
break;
case TYPEPAD:
case TYPE_PAD:
xpm = pad_xpm;
break;
case TYPEDRAWSEGMENT:
case TYPE_DRAWSEGMENT:
xpm = add_dashed_line_xpm;
break;
case TYPETEXTE:
case TYPE_TEXTE:
xpm = add_text_xpm;
break;
case TYPETEXTEMODULE:
case TYPE_TEXTE_MODULE:
xpm = footprint_text_xpm;
break;
case TYPEEDGEMODULE:
case TYPE_EDGE_MODULE:
xpm = show_mod_edge_xpm;
break;
case TYPETRACK:
case TYPE_TRACK:
xpm = showtrack_xpm;
break;
case TYPEZONE_CONTAINER:
case TYPEZONE:
case TYPE_ZONE_CONTAINER:
case TYPE_ZONE:
xpm = add_zone_xpm;
break;
case TYPEVIA:
case TYPE_VIA:
xpm = pad_sketch_xpm;
break;
case TYPEMARKER:
case TYPE_MARKER:
xpm = pad_xpm; // @todo: create and use marker xpm
break;
case TYPECOTATION:
case TYPE_COTATION:
xpm = add_cotation_xpm;
break;
case TYPEMIRE:
case TYPE_MIRE:
xpm = add_mires_xpm;
break;
case TYPEZONE_UNUSED:
case TYPE_ZONE_UNUSED:
xpm = 0; // unused
break;
@ -323,3 +325,13 @@ const char** BOARD_ITEM::MenuIcon() const
return (const char**) xpm;
}
#endif // !defined(GERBVIEW)
void BOARD_ITEM::UnLink()
{
DLIST<BOARD_ITEM>* list = (DLIST<BOARD_ITEM>*) GetList();
wxASSERT( list );
if( list )
list->Remove( this );
}

View File

@ -11,8 +11,8 @@
#include "wxstruct.h"
COTATION::COTATION( BOARD_ITEM* StructFather ) :
BOARD_ITEM( StructFather, TYPECOTATION )
COTATION::COTATION( BOARD_ITEM* aParent ) :
BOARD_ITEM( aParent, TYPE_COTATION )
{
m_Layer = DRAW_LAYER;
m_Width = 50;
@ -30,31 +30,6 @@ COTATION::~COTATION()
}
/* supprime du chainage la structure Struct
* les structures arrieres et avant sont chainees directement
*/
void COTATION::UnLink()
{
if( Back() )
{
if( Back()->Type() != TYPEPCB )
{
Back()->SetNext( Next() );
}
else /* Le chainage arriere pointe sur la structure "Pere" */
{
((BOARD*) Back() )->m_Drawings = Next();
}
}
if( Next() )
Next()->SetBack( Back() );
SetNext( 0 );
SetBack( 0 );
}
/* Setup the dimension text */
void COTATION:: SetText( const wxString& NewText )
{

View File

@ -25,7 +25,7 @@ public:
int FlecheG2_ox, FlecheG2_oy, FlecheG2_fx, FlecheG2_fy;
public:
COTATION( BOARD_ITEM* StructFather );
COTATION( BOARD_ITEM* aParent );
~COTATION();
COTATION* Next() const { return (COTATION*) Pnext; }
@ -47,9 +47,6 @@ public:
*/
bool Save( FILE* aFile ) const;
/* supprime du chainage la structure Struct */
void UnLink();
/* Modification du texte de la cotation */
void SetText( const wxString& NewText );
wxString GetText( void );

View File

@ -17,8 +17,8 @@
#include "trigo.h"
/* DRAWSEGMENT: constructor */
DRAWSEGMENT::DRAWSEGMENT( BOARD_ITEM* StructFather, KICAD_T idtype ) :
BOARD_ITEM( StructFather, idtype )
DRAWSEGMENT::DRAWSEGMENT( BOARD_ITEM* aParent, KICAD_T idtype ) :
BOARD_ITEM( aParent, idtype )
{
m_Width = m_Flags = m_Shape = m_Type = m_Angle = 0;
}
@ -30,29 +30,6 @@ DRAWSEGMENT:: ~DRAWSEGMENT()
}
void DRAWSEGMENT::UnLink()
{
if( Back() )
{
if( Back()->Type() != TYPEPCB )
{
Back()->SetNext( Next() );
}
else /* Le chainage arriere pointe sur la structure "Pere" */
{
( (BOARD*) Back() )->m_Drawings = Next();
}
}
/* erase forward link */
if( Next() )
Next()->SetBack( Back() );
SetNext( 0 );
SetBack( 0 );
}
/*******************************************/
void DRAWSEGMENT::Copy( DRAWSEGMENT* source )
/*******************************************/

View File

@ -17,7 +17,7 @@ public:
int m_Angle; // Used only for Arcs: Arc angle in 1/10 deg
public:
DRAWSEGMENT( BOARD_ITEM* StructFather, KICAD_T idtype = TYPEDRAWSEGMENT );
DRAWSEGMENT( BOARD_ITEM* aParent, KICAD_T idtype = TYPE_DRAWSEGMENT );
~DRAWSEGMENT();
DRAWSEGMENT* Next() const { return (DRAWSEGMENT*) Pnext; }
@ -57,12 +57,6 @@ public:
bool ReadDrawSegmentDescr( FILE* File, int* LineNum );
/**
* Function UnLink
* remove item from linked list.
*/
void UnLink();
void Copy( DRAWSEGMENT* source );

View File

@ -29,7 +29,7 @@
/******************************************/
EDGE_MODULE::EDGE_MODULE( MODULE* parent ) :
BOARD_ITEM( parent, TYPEEDGEMODULE )
BOARD_ITEM( parent, TYPE_EDGE_MODULE )
{
m_Width = 0;
m_Shape = S_SEGMENT;
@ -78,33 +78,6 @@ void EDGE_MODULE:: Copy( EDGE_MODULE* source ) // copy structure
}
}
/********************************/
void EDGE_MODULE::UnLink()
/********************************/
{
/* Modification du chainage arriere */
if( Back() )
{
if( Back()->Type() != TYPEMODULE )
{
Back()->SetNext( Next() );
}
else /* Le chainage arriere pointe sur la structure "Pere" */
{
( (MODULE*) Back() )->m_Drawings = Next();
}
}
/* Modification du chainage avant */
if( Next() )
Next()->SetBack( Back() );
SetNext( 0 );
SetBack( 0 );
}
/***********************************/
void EDGE_MODULE::SetDrawCoord()
/***********************************/
@ -148,7 +121,7 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
WinEDA_BasePcbFrame* frame;
MODULE* Module = NULL;
if( m_Parent && (m_Parent->Type() == TYPEMODULE) )
if( m_Parent && (m_Parent->Type() == TYPE_MODULE) )
Module = (MODULE*) m_Parent;
color = g_DesignSettings.m_LayerColor[m_Layer];

View File

@ -33,11 +33,6 @@ public:
EDGE_MODULE* Back() const { return (EDGE_MODULE*) Pback; }
/**
* Function UnLink
* remove item from linked list.
*/
/**
* Function GetPosition
* returns the position of this object.
@ -48,10 +43,6 @@ public:
return m_Start;
}
/* supprime du chainage la structure Struct */
void UnLink();
void Copy( EDGE_MODULE* source ); // copy structure
/**

View File

@ -22,8 +22,8 @@
/*********************************************************/
/* Constructeur de la classe EQUIPOT */
EQUIPOT::EQUIPOT( BOARD_ITEM* StructFather ) :
BOARD_ITEM( StructFather, PCB_EQUIPOT_STRUCT_TYPE )
EQUIPOT::EQUIPOT( BOARD_ITEM* aParent ) :
BOARD_ITEM( aParent, TYPE_EQUIPOT )
{
SetNet( 0 );
m_NbNodes = m_NbLink = m_NbNoconn = 0;
@ -51,31 +51,6 @@ wxPoint& EQUIPOT::GetPosition()
return dummy;
}
void EQUIPOT::UnLink()
{
/* Modification du chainage arriere */
if( Back() )
{
if( Back()->Type() != TYPEPCB )
{
Back()->SetNext( Next() );
}
else /* Le chainage arriere pointe sur la structure "Pere" */
{
( (BOARD*) Back() )->m_Equipots = Next();
}
}
/* Modification du chainage avant */
if( Next() )
Next()->SetBack( Back() );
SetNext( 0 );
SetBack( 0 );
}
/*********************************************************/
int EQUIPOT:: ReadEquipotDescr( FILE* File, int* LineNum )
/*********************************************************/

View File

@ -25,7 +25,7 @@ public:
CHEVELU* m_RatsnestStart; // pointeur sur debut de liste ratsnests du net
CHEVELU* m_RatsnestEnd; // pointeur sur fin de liste ratsnests du net
EQUIPOT( BOARD_ITEM* StructFather );
EQUIPOT( BOARD_ITEM* aParent );
~EQUIPOT();
EQUIPOT* Next() const { return (EQUIPOT*) Pnext; }
@ -40,10 +40,6 @@ public:
*/
wxPoint& GetPosition();
/* Effacement memoire de la structure */
void UnLink();
/* Readind and writing data on files */
int ReadEquipotDescr( FILE* File, int* LineNum );

View File

@ -48,8 +48,8 @@ void MARKER::init()
m_Size.y = Default_MarkerBitmap[1];
}
MARKER::MARKER( BOARD_ITEM* StructFather ) :
BOARD_ITEM( StructFather, TYPEMARKER ),
MARKER::MARKER( BOARD_ITEM* aParent ) :
BOARD_ITEM( aParent, TYPE_MARKER ),
m_drc()
{
init();
@ -59,7 +59,7 @@ MARKER::MARKER( BOARD_ITEM* StructFather ) :
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()
BOARD_ITEM( NULL, TYPE_MARKER ) // parent set during BOARD::Add()
{
init();
@ -70,7 +70,7 @@ MARKER::MARKER( int aErrorCode, const wxPoint& aMarkerPos,
MARKER::MARKER( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText, const wxPoint& aPos ) :
BOARD_ITEM( NULL, TYPEMARKER ) // parent set during BOARD::Add()
BOARD_ITEM( NULL, TYPE_MARKER ) // parent set during BOARD::Add()
{
init();

View File

@ -23,7 +23,7 @@ protected:
public:
MARKER( BOARD_ITEM* StructFather );
MARKER( BOARD_ITEM* aParent );
/**
* Constructor

View File

@ -9,8 +9,8 @@
#include "pcbnew.h"
MIREPCB::MIREPCB( BOARD_ITEM* StructFather ) :
BOARD_ITEM( StructFather, TYPEMIRE )
MIREPCB::MIREPCB( BOARD_ITEM* aParent ) :
BOARD_ITEM( aParent, TYPE_MIRE )
{
m_Shape = 0;
m_Size = 5000;
@ -22,30 +22,6 @@ MIREPCB::~MIREPCB()
}
/***************************/
void MIREPCB::UnLink()
/***************************/
{
if( Back() )
{
if( Back()->Type() != TYPEPCB )
{
Back()->SetNext( Next() );
}
else /* Le chainage arriere pointe sur la structure "Pere" */
{
( (BOARD*) Back() )->m_Drawings = Next();
}
}
if( Next() )
Next()->SetBack( Back() );
SetNext( 0 );
SetBack( 0 );
}
/**********************************/
void MIREPCB::Copy( MIREPCB* source )
/**********************************/

View File

@ -16,7 +16,7 @@ public:
int m_Size;
public:
MIREPCB( BOARD_ITEM* StructFather );
MIREPCB( BOARD_ITEM* aParent );
~MIREPCB();
MIREPCB* Next() const { return (MIREPCB*) Pnext; }
@ -38,9 +38,6 @@ public:
bool ReadMirePcbDescr( FILE* File, int* LineNum );
/* supprime du chainage la structure Struct */
void UnLink();
void Copy( MIREPCB* source );
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& offset = ZeroOffset );

View File

@ -55,10 +55,8 @@ void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset
/* Class MODULE : description d'un composant pcb */
/*************************************************/
MODULE::MODULE( BOARD* parent ) :
BOARD_ITEM( parent, TYPEMODULE )
BOARD_ITEM( parent, TYPE_MODULE )
{
m_Pads = NULL;
m_Drawings = NULL;
m_3D_Drawings = NULL;
m_Attributs = MOD_DEFAULT;
m_Layer = CMP_N;
@ -92,31 +90,6 @@ MODULE::~MODULE()
next = item->Next();
delete item;
}
for( item = m_Pads; item; item = next )
{
next = item->Next();
delete item;
}
/* effacement des elements de trace */
for( item = m_Drawings; item; item = next )
{
next = item->Next();
switch( item->Type() )
{
case TYPEEDGEMODULE:
case TYPETEXTEMODULE:
delete item;
break;
default:
DisplayError( NULL, wxT( "Warning: Item Type not handled in delete MODULE" ) );
next = NULL;
break;
}
}
}
@ -124,8 +97,6 @@ MODULE::~MODULE()
void MODULE::Copy( MODULE* Module )
/*********************************/
{
D_PAD* lastpad;
m_Pos = Module->m_Pos;
m_Layer = Module->m_Layer;
m_LibRef = Module->m_LibRef;
@ -144,65 +115,37 @@ void MODULE::Copy( MODULE* Module )
m_Value->Copy( Module->m_Value );
/* Copie des structures auxiliaires: Pads */
lastpad = NULL;
for( D_PAD* pad = Module->m_Pads; pad; pad = pad->Next() )
{
D_PAD* newpad = new D_PAD( this );
newpad->Copy( pad );
if( m_Pads == NULL )
{
newpad->SetBack( this );
m_Pads = newpad;
}
else
{
newpad->SetBack( lastpad );
lastpad->SetNext( newpad );
}
lastpad = newpad;
m_Pads.PushBack( newpad );
}
/* Copy des structures auxiliaires: Drawings */
BOARD_ITEM* NewStruct, * LastStruct = NULL;
BOARD_ITEM* OldStruct = Module->m_Drawings;
for( ; OldStruct; OldStruct = OldStruct->Next() )
for( BOARD_ITEM* item = Module->m_Drawings; item; item = item->Next() )
{
NewStruct = NULL;
switch( OldStruct->Type() )
switch( item->Type() )
{
case TYPETEXTEMODULE:
NewStruct = new TEXTE_MODULE( this );
( (TEXTE_MODULE*) NewStruct )->Copy( (TEXTE_MODULE*) OldStruct );
case TYPE_TEXTE_MODULE:
TEXTE_MODULE* textm;
textm = new TEXTE_MODULE( this );
textm->Copy( (TEXTE_MODULE*) item );
m_Drawings.PushBack( textm );
break;
case TYPEEDGEMODULE:
NewStruct = new EDGE_MODULE( this );
( (EDGE_MODULE*) NewStruct )->Copy( (EDGE_MODULE*) OldStruct );
case TYPE_EDGE_MODULE:
EDGE_MODULE* edge;
edge = new EDGE_MODULE( this );
edge->Copy( (EDGE_MODULE*) item );
m_Drawings.PushBack( edge );
break;
default:
DisplayError( NULL, wxT( "Internal Err: CopyModule: type indefini" ) );
break;
}
if( NewStruct == NULL )
break;
if( m_Drawings == NULL )
{
NewStruct->SetBack( this );
m_Drawings = NewStruct;
}
else
{
NewStruct->SetBack( LastStruct );
LastStruct->SetNext( NewStruct );
}
LastStruct = NewStruct;
}
/* Copy des elements complementaires Drawings 3D */
@ -227,39 +170,6 @@ void MODULE::Copy( MODULE* Module )
}
/* supprime du chainage la structure Struct
* les structures arrieres et avant sont chainees directement
*/
void MODULE::UnLink()
{
if( Back() )
{
if( Back()->Type() != TYPEPCB )
{
Back()->SetNext( Next() );
}
else /* Le chainage arriere pointe sur la structure "Pere" */
{
if( GetState( DELETED ) ) // A REVOIR car Pback = NULL si place en undelete
{
if( g_UnDeleteStackPtr )
g_UnDeleteStack[g_UnDeleteStackPtr - 1] = Next();
}
else
( (BOARD*) Back() )->m_Modules = Next();
}
}
/* Modification du chainage avant */
if( Next() )
Next()->SetBack( Back() );
SetNext( 0 );
SetBack( 0 );
}
/**********************************************************/
void MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
int draw_mode, const wxPoint& offset )
@ -301,8 +211,8 @@ void MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
switch( item->Type() )
{
case TYPETEXTEMODULE:
case TYPEEDGEMODULE:
case TYPE_TEXTE_MODULE:
case TYPE_EDGE_MODULE:
item->Draw( panel, DC, draw_mode, offset );
break;
@ -330,7 +240,7 @@ void MODULE::DrawEdgesOnly( WinEDA_DrawPanel* panel, wxDC* DC,
{
switch( item->Type() )
{
case TYPEEDGEMODULE:
case TYPE_EDGE_MODULE:
item->Draw( panel, DC, draw_mode, offset );
break;
@ -412,8 +322,8 @@ bool MODULE::Save( FILE* aFile ) const
{
switch( item->Type() )
{
case TYPETEXTEMODULE:
case TYPEEDGEMODULE:
case TYPE_TEXTE_MODULE:
case TYPE_EDGE_MODULE:
if( !item->Save( aFile ) )
goto out;
break;
@ -567,10 +477,6 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
* retourne 0 si OK
*/
{
D_PAD* LastPad = NULL, * ptpad;
EDA_BaseStruct* LastModStruct = NULL;
EDGE_MODULE* DrawSegm;
TEXTE_MODULE* DrawText;
char Line[256], BufLine[256], BufCar1[128], * PtLine;
int itmp1, itmp2;
@ -582,23 +488,13 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
break;
if( Line[1] == 'P' )
{
ptpad = new D_PAD( this );
ptpad->ReadDescr( File, LineNum );
RotatePoint( &ptpad->m_Pos.x, &ptpad->m_Pos.y, m_Orient );
ptpad->m_Pos.x += m_Pos.x;
ptpad->m_Pos.y += m_Pos.y;
D_PAD* pad = new D_PAD( this );
pad->ReadDescr( File, LineNum );
RotatePoint( &pad->m_Pos.x, &pad->m_Pos.y, m_Orient );
pad->m_Pos.x += m_Pos.x;
pad->m_Pos.y += m_Pos.y;
if( LastPad == NULL )
{
ptpad->SetBack( this );
m_Pads = ptpad;
}
else
{
ptpad->SetBack( LastPad );
LastPad->SetNext( ptpad );
}
LastPad = ptpad;
m_Pads.PushBack( pad );
continue;
}
if( Line[1] == 'S' )
@ -673,47 +569,26 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
break;
case 'T': /* Read a footprint text description (ref, value, or drawing */
TEXTE_MODULE* textm;
sscanf( Line + 1, "%d", &itmp1 );
if( itmp1 == TEXT_is_REFERENCE )
DrawText = m_Reference;
textm = m_Reference;
else if( itmp1 == TEXT_is_VALUE )
DrawText = m_Value;
textm = m_Value;
else /* text is a drawing */
{
DrawText = new TEXTE_MODULE( this );
if( LastModStruct == NULL )
{
DrawText->SetBack( this );
m_Drawings = DrawText;
}
else
{
DrawText->SetBack( LastModStruct );
LastModStruct->SetNext( DrawText );
}
LastModStruct = DrawText;
textm = new TEXTE_MODULE( this );
m_Drawings.PushBack( textm );
}
DrawText->ReadDescr( Line, File, LineNum );
textm->ReadDescr( Line, File, LineNum );
break;
case 'D': /* lecture du contour */
DrawSegm = new EDGE_MODULE( this );
if( LastModStruct == NULL )
{
DrawSegm->SetBack( this );
m_Drawings = DrawSegm;
}
else
{
DrawSegm->SetBack( LastModStruct );
LastModStruct->SetNext( DrawSegm );
}
LastModStruct = DrawSegm;
DrawSegm->ReadDescr( Line, File, LineNum );
DrawSegm->SetDrawCoord();
EDGE_MODULE* edge;
edge = new EDGE_MODULE( this );
m_Drawings.PushBack( edge );
edge->ReadDescr( Line, File, LineNum );
edge->SetDrawCoord();
break;
case 'C': /* Lecture de la doc */
@ -769,14 +644,14 @@ void MODULE::SetPosition( const wxPoint& newpos )
{
switch( PtStruct->Type() )
{
case TYPEEDGEMODULE:
case TYPE_EDGE_MODULE:
{
EDGE_MODULE* pt_edgmod = (EDGE_MODULE*) PtStruct;
pt_edgmod->SetDrawCoord();
break;
}
case TYPETEXTEMODULE:
case TYPE_TEXTE_MODULE:
{
TEXTE_MODULE* pt_texte = (TEXTE_MODULE*) PtStruct;
pt_texte->m_Pos.x += deltaX;
@ -829,12 +704,12 @@ void MODULE::SetOrientation( int newangle )
EDA_BaseStruct* PtStruct = m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{
if( PtStruct->Type() == TYPEEDGEMODULE )
if( PtStruct->Type() == TYPE_EDGE_MODULE )
{
EDGE_MODULE* pt_edgmod = (EDGE_MODULE*) PtStruct;
pt_edgmod->SetDrawCoord();
}
if( PtStruct->Type() == TYPETEXTEMODULE )
if( PtStruct->Type() == TYPE_TEXTE_MODULE )
{
/* deplacement des inscriptions : */
TEXTE_MODULE* pt_texte = (TEXTE_MODULE*) PtStruct;
@ -871,10 +746,10 @@ void MODULE::Set_Rectangle_Encadrement()
m_BoundaryBox.m_Pos.y = -500; ymax = 500;
/* Contours: Recherche des coord min et max et mise a jour du cadre */
for( EDGE_MODULE* pt_edge_mod = (EDGE_MODULE*) m_Drawings;
for( EDGE_MODULE* pt_edge_mod = (EDGE_MODULE*) m_Drawings.GetFirst();
pt_edge_mod; pt_edge_mod = pt_edge_mod->Next() )
{
if( pt_edge_mod->Type() != TYPEEDGEMODULE )
if( pt_edge_mod->Type() != TYPE_EDGE_MODULE )
continue;
width = pt_edge_mod->m_Width / 2;
@ -944,9 +819,9 @@ void MODULE::SetRectangleExinscrit()
m_RealBoundaryBox.m_Pos.y = ymax = m_Pos.y;
/* Contours: Recherche des coord min et max et mise a jour du cadre */
for( EDGE_MODULE* edge = (EDGE_MODULE*) m_Drawings; edge; edge = edge->Next() )
for( EDGE_MODULE* edge = (EDGE_MODULE*) m_Drawings.GetFirst(); edge; edge = edge->Next() )
{
if( edge->Type() != TYPEEDGEMODULE )
if( edge->Type() != TYPE_EDGE_MODULE )
continue;
width = edge->m_Width / 2;
@ -1020,9 +895,9 @@ EDA_Rect MODULE::GetBoundingBox()
text_area = m_Value->GetBoundingBox();
area.Merge( text_area );
for( EDGE_MODULE* edge = (EDGE_MODULE*) m_Drawings; edge; edge = edge->Next() )
for( EDGE_MODULE* edge = (EDGE_MODULE*) m_Drawings.GetFirst(); edge; edge = edge->Next() )
{
if( edge->Type() != TYPETEXTEMODULE )
if( edge->Type() != TYPE_TEXTE_MODULE )
continue;
text_area = ((TEXTE_MODULE*)edge)->GetBoundingBox();
area.Merge( text_area );
@ -1201,17 +1076,17 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData,
switch( stype )
{
case TYPEMODULE:
case TYPE_MODULE:
result = inspector->Inspect( this, testData ); // inspect me
++p;
break;
case TYPEPAD:
case TYPE_PAD:
result = IterateForward( m_Pads, inspector, testData, p );
++p;
break;
case TYPETEXTEMODULE:
case TYPE_TEXTE_MODULE:
result = inspector->Inspect( m_Reference, testData );
if( result == SEARCH_QUIT )
break;
@ -1222,7 +1097,7 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData,
// m_Drawings can hold TYPETEXTMODULE also, so fall thru
case TYPEEDGEMODULE:
case TYPE_EDGE_MODULE:
result = IterateForward( m_Drawings, inspector, testData, p );
// skip over any types handled in the above call.
@ -1230,8 +1105,8 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData,
{
switch( stype = *++p )
{
case TYPETEXTEMODULE:
case TYPEEDGEMODULE:
case TYPE_TEXTE_MODULE:
case TYPE_EDGE_MODULE:
continue;
default:

View File

@ -38,14 +38,14 @@ enum Mod_Attribut /* Attributs used for modules */
class MODULE : public BOARD_ITEM
{
public:
wxPoint m_Pos; // Real coord on board
D_PAD* m_Pads; /* Pad list (linked list) */
BOARD_ITEM* m_Drawings; /* Graphic items list (linked list) */
Struct3D_Master* m_3D_Drawings; /* First item of the 3D shapes (linked list)*/
TEXTE_MODULE* m_Reference; // Component reference (U34, R18..)
TEXTE_MODULE* m_Value; // Component value (74LS00, 22K..)
wxString m_LibRef; /* Name of the module in library (and the default value when loading amodule from the library) */
wxString m_AlternateReference; /* Used when m_Reference cannot be used to
wxPoint m_Pos; // Real coord on board
DLIST<D_PAD> m_Pads; /* Pad list (linked list) */
DLIST<BOARD_ITEM> m_Drawings; /* Graphic items list (linked list) */
Struct3D_Master* m_3D_Drawings; /* First item of the 3D shapes (linked list)*/
TEXTE_MODULE* m_Reference; // Component reference (U34, R18..)
TEXTE_MODULE* m_Value; // Component value (74LS00, 22K..)
wxString m_LibRef; /* Name of the module in library (and the default value when loading amodule from the library) */
wxString m_AlternateReference; /* Used when m_Reference cannot be used to
* identify the footprint ( after a full reannotation of the schematic */
int m_Attributs; /* Flags(ORed bits) ( see Mod_Attribut ) */
@ -124,9 +124,6 @@ public:
void SetPosition( const wxPoint& newpos );
void SetOrientation( int newangle );
/* Remove this from the linked list */
void UnLink();
/**
* Function IsLocked

View File

@ -26,7 +26,7 @@
/* classe D_PAD : constructeur */
/*******************************/
D_PAD::D_PAD( MODULE* parent ) : BOARD_CONNECTED_ITEM( parent, TYPEPAD )
D_PAD::D_PAD( MODULE* parent ) : BOARD_CONNECTED_ITEM( parent, TYPE_PAD )
{
m_NumPadName = 0;
m_Masque_Layer = CUIVRE_LAYER;
@ -34,7 +34,7 @@ D_PAD::D_PAD( MODULE* parent ) : BOARD_CONNECTED_ITEM( parent, TYPEPAD )
m_Size.x = m_Size.y = 500;
if( m_Parent && (m_Parent->Type() == TYPEMODULE) )
if( m_Parent && (m_Parent->Type() == TYPE_MODULE) )
{
m_Pos = ( (MODULE*) m_Parent )->GetPosition();
}
@ -202,36 +202,6 @@ void D_PAD::Copy( D_PAD* source )
}
/**************************/
void D_PAD::UnLink()
/**************************/
/* supprime du chainage la structure Struct
* les structures arrieres et avant sont chainees directement
*/
{
/* Modification du chainage arriere */
if( Back() )
{
if( Back()->Type() != TYPEMODULE )
{
Back()->SetNext( Next() );
}
else /* Le chainage arriere pointe sur la structure "Pere" */
{
( (MODULE*) Back() )->m_Pads = Next();
}
}
/* Modification du chainage avant */
if( Next() )
Next()->SetBack( Back() );
SetNext( 0 );
SetBack( 0 );
}
/*******************************************************************************************/
void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoint& offset )
/*******************************************************************************************/

View File

@ -89,10 +89,6 @@ public:
m_Pos = aPos;
}
/* remove from linked list */
void UnLink();
/* Reading and writing data on files */
int ReadDescr( FILE* File, int* LineNum = NULL );

View File

@ -16,7 +16,7 @@
/*******************/
TEXTE_PCB::TEXTE_PCB( BOARD_ITEM* parent ) :
BOARD_ITEM( parent, TYPETEXTE ),
BOARD_ITEM( parent, TYPE_TEXTE ),
EDA_TextStruct()
{
}
@ -48,30 +48,6 @@ void TEXTE_PCB::Copy( TEXTE_PCB* source )
}
void TEXTE_PCB::UnLink()
{
/* Modification du chainage arriere */
if( Back() )
{
if( Back()->Type() != TYPEPCB )
{
Back()->SetNext( Next() );
}
else /* Le chainage arriere pointe sur la structure "Pere" */
{
( (BOARD*) Back() )->m_Drawings = Next();
}
}
/* Modification du chainage avant */
if( Next() )
Next()->SetBack( Back() );
SetNext( 0 );
SetBack( 0 );
}
/****************************************************************/
int TEXTE_PCB::ReadTextePcbDescr( FILE* File, int* LineNum )
/****************************************************************/
@ -175,7 +151,7 @@ void TEXTE_PCB::Display_Infos( WinEDA_DrawFrame* frame )
BOARD_ITEM* parent = (BOARD_ITEM*) m_Parent;
wxASSERT( parent );
if( parent->Type() == TYPECOTATION )
if( parent->Type() == TYPE_COTATION )
board = (BOARD*) parent->GetParent();
else
board = (BOARD*) parent;
@ -183,7 +159,7 @@ void TEXTE_PCB::Display_Infos( WinEDA_DrawFrame* frame )
frame->MsgPanel->EraseMsgBox();
if( m_Parent && m_Parent->Type() == TYPECOTATION )
if( m_Parent && m_Parent->Type() == TYPE_COTATION )
Affiche_1_Parametre( frame, 1, _( "COTATION" ), m_Text, DARKGREEN );
else
Affiche_1_Parametre( frame, 1, _( "PCB Text" ), m_Text, DARKGREEN );

View File

@ -13,7 +13,6 @@ public:
TEXTE_PCB( TEXTE_PCB* textepcb );
~TEXTE_PCB();
/**
* Function GetPosition
* returns the position of this object.
@ -25,10 +24,6 @@ public:
return m_Pos; // within EDA_TextStruct
}
/* supprime du chainage la structure Struct */
void UnLink();
/* duplicate structure */
void Copy( TEXTE_PCB* source );

View File

@ -28,7 +28,7 @@
/* Constructeur de TEXTE_MODULE */
TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) :
BOARD_ITEM( parent, TYPETEXTEMODULE )
BOARD_ITEM( parent, TYPE_TEXTE_MODULE )
{
MODULE* Module = (MODULE*) m_Parent;
@ -43,7 +43,7 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) :
m_Unused = 0;
SetLayer( SILKSCREEN_N_CMP );
if( Module && (Module->Type() == TYPEMODULE) )
if( Module && (Module->Type() == TYPE_MODULE) )
{
m_Pos = Module->m_Pos;
@ -205,33 +205,6 @@ void TEXTE_MODULE::Copy( TEXTE_MODULE* source )
}
/* Remove this from the linked list
* Update Pback and Pnext pointers
*/
void TEXTE_MODULE::UnLink()
{
/* Modification du chainage arriere */
if( Back() )
{
if( Back()->Type() != TYPEMODULE )
{
Back()->SetNext( Next() );
}
else /* Le chainage arriere pointe sur la structure "Pere" */
{
( (MODULE*) Back() )->m_Drawings = Next();
}
}
/* Modification du chainage avant */
if( Next() )
Next()->SetBack( Back() );
SetNext( 0 );
SetBack( 0 );
}
/******************************************/
int TEXTE_MODULE:: GetLength()
/******************************************/

View File

@ -47,10 +47,6 @@ public:
return m_Pos;
}
/* supprime du chainage la structure Struct */
void UnLink();
void Copy( TEXTE_MODULE* source ); // copy structure
/* Gestion du texte */

View File

@ -8,7 +8,6 @@
#include "common.h"
#include "pcbnew.h"
#ifdef CVPCB
#include "cvpcb.h"
#endif
@ -39,9 +38,9 @@ void DbgDisplayTrackInfos( TRACK* track )
wxMessageBox( msg );
}
#endif
/**
* Function ShowClearance
* tests to see if the clearance border is drawn on the given track.
@ -49,16 +48,18 @@ void DbgDisplayTrackInfos( TRACK* track )
*/
static bool ShowClearance( const TRACK* aTrack )
{
// maybe return true for (for tracks and vias, not for zone segments
return ( DisplayOpt.DisplayTrackIsol && ( aTrack->GetLayer() <= LAST_COPPER_LAYER )
&& ( aTrack->Type() == TYPETRACK || aTrack->Type() == TYPEVIA) );
// maybe return true for tracks and vias, not for zone segments
return !(aTrack->m_Flags & DRAW_ERASED)
&& DisplayOpt.DisplayTrackIsol
&& aTrack->GetLayer() <= LAST_COPPER_LAYER
&& ( aTrack->Type() == TYPE_TRACK || aTrack->Type() == TYPE_VIA );
}
/**********************************************************/
TRACK::TRACK( BOARD_ITEM* StructFather, KICAD_T idtype ) :
BOARD_CONNECTED_ITEM( StructFather, idtype )
TRACK::TRACK( BOARD_ITEM* aParent, KICAD_T idtype ) :
BOARD_CONNECTED_ITEM( aParent, idtype )
/**********************************************************/
{
m_Width = 0;
@ -81,14 +82,14 @@ wxString TRACK::ShowWidth()
}
SEGZONE::SEGZONE( BOARD_ITEM* StructFather ) :
TRACK( StructFather, TYPEZONE )
SEGZONE::SEGZONE( BOARD_ITEM* aParent ) :
TRACK( aParent, TYPE_ZONE )
{
}
SEGVIA::SEGVIA( BOARD_ITEM* StructFather ) :
TRACK( StructFather, TYPEVIA )
SEGVIA::SEGVIA( BOARD_ITEM* aParent ) :
TRACK( aParent, TYPE_VIA )
{
}
@ -99,6 +100,7 @@ TRACK::TRACK( const TRACK& Source ) :
{
m_Shape = Source.m_Shape;
SetNet( Source.GetNet() );
m_Flags = Source.m_Flags;
m_TimeStamp = Source.m_TimeStamp;
SetStatus( Source.ReturnStatus() );
@ -119,13 +121,13 @@ TRACK::TRACK( const TRACK& Source ) :
*/
TRACK* TRACK::Copy() const
{
if( Type() == TYPETRACK )
if( Type() == TYPE_TRACK )
return new TRACK( *this );
if( Type() == TYPEVIA )
if( Type() == TYPE_VIA )
return new SEGVIA( (const SEGVIA &) * this );
if( Type() == TYPEZONE )
if( Type() == TYPE_ZONE )
return new SEGZONE( (const SEGZONE &) * this );
return NULL; // should never happen
@ -139,7 +141,7 @@ TRACK* TRACK::Copy() const
*/
int TRACK::GetDrillValue() const
{
if ( Type() != TYPEVIA )
if ( Type() != TYPE_VIA )
return 0;
if ( m_Drill >= 0 )
@ -158,7 +160,7 @@ bool TRACK::IsNull()
// return TRUE if segment length = 0
{
if( ( Type() != TYPEVIA ) && ( m_Start == m_End ) )
if( ( Type() != TYPE_VIA ) && ( m_Start == m_End ) )
return TRUE;
else
return FALSE;
@ -228,7 +230,7 @@ EDA_Rect TRACK::GetBoundingBox()
int ymin;
int xmin;
if( Type() == TYPEVIA )
if( Type() == TYPE_VIA )
{
// Because vias are sometimes drawn larger than their m_Width would
// provide, erasing them using a dirty rect must also compensate for this
@ -323,7 +325,7 @@ int TRACK::ReturnMaskLayer()
* for a via, there is more than one layer used
*/
{
if( Type() == TYPEVIA )
if( Type() == TYPE_VIA )
{
int via_type = Shape();
@ -404,94 +406,6 @@ void SEGVIA::ReturnLayerPair( int* top_layer, int* bottom_layer ) const
}
/* Remove this from the track or zone linked list
*/
void TRACK::UnLink()
{
/* Remove the back link */
if( Back() )
{
if( Back()->Type() != TYPEPCB )
{
Back()->SetNext( Next() );
}
else /* Le chainage arriere pointe sur la structure "Pere" */
{
if( GetState( DELETED ) ) // A REVOIR car Pback = NULL si place en undelete
{
if( g_UnDeleteStackPtr )
g_UnDeleteStack[g_UnDeleteStackPtr - 1] = (BOARD_ITEM*) Pnext;
}
else
{
if( Type() == TYPEZONE )
{
( (BOARD*) Back() )->m_Zone = (SEGZONE*) Next();
}
else
{
( (BOARD*) Back() )->m_Track = Next();
}
}
}
}
/* Remove the forward link */
if( Next() )
Next()->SetBack( Back() );
SetNext( 0 );
SetBack( 0 );
}
/************************************************************/
void TRACK::Insert( BOARD* Pcb, TRACK* InsertPoint )
/************************************************************/
/* insert this (and its linked segments is exists)
* in the track linked list
* @param InsertPoint = insert point within the linked list
* if NULL: insert as first element of Pcb->m_Tracks
*/
{
TRACK* track;
TRACK* NextS;
if( InsertPoint == NULL )
{
Pback = Pcb;
if( Type() == TYPEZONE ) // put SEGZONE on front of m_Zone list
{
NextS = Pcb->m_Zone;
Pcb->m_Zone = (SEGZONE*) this;
}
else // put TRACK or SEGVIA on front of m_Track list
{
NextS = Pcb->m_Track;
Pcb->m_Track = this;
}
}
else
{
NextS = InsertPoint->Next();
Pback = InsertPoint;
InsertPoint->SetNext( this );
}
/* Set the forward link */
track = this;
while( track->Next() ) // Search the end of added chain
track = track->Next();
/* Link the end of chain */
track->SetNext( NextS );
if( NextS )
NextS->SetBack( track );
}
/***********************************************/
TRACK* TRACK::GetBestInsertPoint( BOARD* Pcb )
/***********************************************/
@ -502,29 +416,20 @@ TRACK* TRACK::GetBestInsertPoint( BOARD* Pcb )
* @return the item found in the linked list (or NULL if no track)
*/
{
TRACK* track, * NextTrack;
TRACK* track;
if( Type() == TYPEZONE )
if( Type() == TYPE_ZONE )
track = Pcb->m_Zone;
else
track = Pcb->m_Track;
/* Traitement du debut de liste */
if( track == NULL )
return NULL; /* No tracks ! */
if( GetNet() < track->GetNet() ) /* no net code or net code = 0 (track not connected) */
return NULL;
while( (NextTrack = (TRACK*) track->Pnext) != NULL )
for( ; track; track = track->Next() )
{
if( NextTrack->GetNet() > this->GetNet() )
break;
track = NextTrack;
if( GetNet() <= track->GetNet() )
return track;
}
return track;
return NULL;
}
@ -606,7 +511,7 @@ bool TRACK::Save( FILE* aFile ) const
{
int type = 0;
if( Type() == TYPEVIA )
if( Type() == TYPE_VIA )
type = 1;
if( GetState( DELETED ) )
@ -634,38 +539,47 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
int rayon;
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
if( Type() == TYPEZONE && !DisplayOpt.DisplayZones )
if( Type() == TYPE_ZONE && !DisplayOpt.DisplayZones )
return;
if( m_Flags & DRAW_ERASED ) // draw in background color, used by classs TRACK in gerbview
{
color = g_DrawBgColor;
D(printf("DRAW_ERASED in Track::Draw, g_DrawBgColor=%04X\n", g_DrawBgColor );)
}
else
{
color = g_DesignSettings.m_LayerColor[m_Layer];
if( ( color & (ITEM_NOT_SHOW | HIGHT_LIGHT_FLAG) ) == ITEM_NOT_SHOW )
return;
if( DisplayOpt.ContrastModeDisplay )
{
if( !IsOnLayer( curr_layer ) )
{
color &= ~MASKCOLOR;
color |= DARKDARKGRAY;
}
}
if( draw_mode & GR_SURBRILL )
{
if( draw_mode & GR_AND )
color &= ~HIGHT_LIGHT_FLAG;
else
color |= HIGHT_LIGHT_FLAG;
}
if( color & HIGHT_LIGHT_FLAG )
color = ColorRefs[color & MASKCOLOR].m_LightColor;
SetAlpha( &color, 150 );
}
GRSetDrawMode( DC, draw_mode );
color = g_DesignSettings.m_LayerColor[m_Layer];
if( ( color & (ITEM_NOT_SHOW | HIGHT_LIGHT_FLAG) ) == ITEM_NOT_SHOW )
return;
if( DisplayOpt.ContrastModeDisplay )
{
if( !IsOnLayer( curr_layer ) )
{
color &= ~MASKCOLOR;
color |= DARKDARKGRAY;
}
}
if( draw_mode & GR_SURBRILL )
{
if( draw_mode & GR_AND )
color &= ~HIGHT_LIGHT_FLAG;
else
color |= HIGHT_LIGHT_FLAG;
}
if( color & HIGHT_LIGHT_FLAG )
color = ColorRefs[color & MASKCOLOR].m_LightColor;
SetAlpha( &color, 150 );
zoom = panel->GetZoom();
l_piste = m_Width >> 1;
@ -705,7 +619,7 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
return;
}
if( (!DisplayOpt.DisplayPcbTrackFill) || GetState( FORCE_SKETCH ) )
if( !DisplayOpt.DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
{
GRCSegm( &panel->m_ClipBox, DC, m_Start.x, m_Start.y,
m_End.x, m_End.y, m_Width, color );
@ -735,9 +649,6 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
int rayon;
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
if( Type() == TYPEZONE && !DisplayOpt.DisplayZones )
return;
GRSetDrawMode( DC, draw_mode );
color = g_DesignSettings.m_ViaColor[m_Shape];
@ -874,15 +785,15 @@ void TRACK::Display_Infos( WinEDA_DrawFrame* frame )
switch( Type() )
{
case TYPEVIA:
case TYPE_VIA:
msg = g_ViaType_Name[Shape()];
break;
case TYPETRACK:
case TYPE_TRACK:
msg = _( "Track" );
break;
case TYPEZONE:
case TYPE_ZONE:
msg = _( "Zone" ); break;
default:
@ -890,15 +801,17 @@ void TRACK::Display_Infos( WinEDA_DrawFrame* frame )
}
text_pos = 1;
Affiche_1_Parametre( frame, text_pos, _( "Type" ), msg, DARKCYAN );
text_pos += 10;
/* Display NetName pour les segments de piste type cuivre */
text_pos += 15;
if( Type() == TYPETRACK
|| Type() == TYPEZONE
|| Type() == TYPEVIA )
if( Type() == TYPE_TRACK
|| Type() == TYPE_ZONE
|| Type() == TYPE_VIA )
{
/* Display NetName pour les segments de piste type cuivre */
EQUIPOT* equipot = board->FindNet( GetNet() );
if( equipot )
@ -907,11 +820,13 @@ void TRACK::Display_Infos( WinEDA_DrawFrame* frame )
msg = wxT( "<noname>" );
Affiche_1_Parametre( frame, text_pos, _( "NetName" ), msg, RED );
text_pos += 20;
/* Display net code : (usefull in test or debug) */
msg.Printf( wxT( "%d .%d" ), GetNet(), GetSubNet() );
text_pos += 18;
Affiche_1_Parametre( frame, text_pos, _( "NetCode" ), msg, RED );
text_pos += 8;
}
else
{
@ -920,9 +835,19 @@ void TRACK::Display_Infos( WinEDA_DrawFrame* frame )
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Circle" ), RED );
else
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Standard" ), RED );
text_pos += 8;
}
/* Display the Status flags */
#if defined(DEBUG)
/* Display the flags */
msg.Printf( wxT("0x%08X"), m_Flags );
Affiche_1_Parametre( frame, text_pos, _( "Flags" ), msg, BLUE );
text_pos += 8;
#endif
/* Display the State member */
msg = wxT( ". . " );
if( GetState( SEGM_FIXE ) )
msg[0] = 'F';
@ -930,11 +855,11 @@ void TRACK::Display_Infos( WinEDA_DrawFrame* frame )
if( GetState( SEGM_AR ) )
msg[2] = 'A';
text_pos = 42;
Affiche_1_Parametre( frame, text_pos, _( "Stat" ), msg, MAGENTA );
text_pos += 6;
/* Display layer or layer pair) */
if( Type() == TYPEVIA )
if( Type() == TYPE_VIA )
{
SEGVIA* Via = (SEGVIA*) this;
int top_layer, bottom_layer;
@ -946,22 +871,21 @@ void TRACK::Display_Infos( WinEDA_DrawFrame* frame )
else
msg = board->GetLayerName( m_Layer );
text_pos += 5;
Affiche_1_Parametre( frame, text_pos, _( "Layer" ), msg, BROWN );
text_pos += 15;
/* Display width */
valeur_param( (unsigned) m_Width, msg );
text_pos += 11;
if( Type() == TYPEVIA ) // Display Diam and Drill values
if( Type() == TYPE_VIA ) // Display Diam and Drill values
{
Affiche_1_Parametre( frame, text_pos, _( "Diam" ), msg, DARKCYAN );
text_pos += 8;
int drill_value = GetDrillValue();
valeur_param( (unsigned) drill_value, msg );
text_pos += 8;
wxString title = _( "Drill" );
if( g_DesignSettings.m_ViaDrill >= 0 )
@ -992,7 +916,7 @@ bool TRACK::HitTest( const wxPoint& ref_pos )
int spot_cX = ref_pos.x - m_Start.x;
int spot_cY = ref_pos.y - m_Start.y;
if( Type() == TYPEVIA ) /* VIA rencontree */
if( Type() == TYPE_VIA ) /* VIA rencontree */
{
return (double) spot_cX * spot_cX + (double) spot_cY * spot_cY <=
(double) radius * radius;
@ -1037,8 +961,11 @@ void TRACK::Show( int nestLevel, std::ostream& os )
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
// " shape=\"" << m_Shape << '"' <<
" addr=\"" << std::hex << this << std::dec << '"' <<
" layer=\"" << m_Layer << '"' <<
" width=\"" << m_Width << '"' <<
" flags=\"" << m_Flags << '"' <<
" status=\"" << GetState(-1) << '"' <<
// " drill=\"" << GetDrillValue() << '"' <<
" netcode=\"" << GetNet() << "\">" <<
@ -1103,4 +1030,38 @@ void SEGVIA::Show( int nestLevel, std::ostream& os )
}
wxString TRACK::ShowState( int stateBits )
{
wxString ret;
if( stateBits & CHAIN )
ret << wxT(" | CHAIN");
if( stateBits & SEGM_AR )
ret << wxT(" | SEGM_AR");
if( stateBits & SEGM_FIXE )
ret << wxT(" | SEGM_FIXE");
if( stateBits & EDIT )
ret << wxT(" | EDIT");
if( stateBits & DRAG )
ret << wxT(" | DRAG");
if( stateBits & SURBRILL )
ret << wxT(" | SURBRILL");
if( stateBits & NO_TRACE )
ret << wxT(" | NO_TRACE");
if( stateBits & DELETED )
ret << wxT(" | DELETED");
if( stateBits & BUSY )
ret << wxT(" | BUSY");
if( stateBits & END_ONPAD)
ret << wxT(" | END_ONPAD");
if( stateBits & BEGIN_ONPAD)
ret << wxT(" | BEGIN_ONPAD");
if( stateBits & FLAG0)
ret << wxT(" | FLAG0");
if( stateBits & FLAG1 )
ret << wxT(" | FLAG1");
return ret;
}
#endif

View File

@ -18,6 +18,13 @@
class TRACK : public BOARD_CONNECTED_ITEM
{
// make SetNext() and SetBack() private so that they may not be called from anywhere.
// list management is done on TRACKs using DLIST<TRACK> only.
private:
void SetNext( EDA_BaseStruct* aNext ) { Pnext = aNext; }
void SetBack( EDA_BaseStruct* aBack ) { Pback = aBack; }
public:
int m_Width; // 0 = line, > 0 = tracks, bus ...
wxPoint m_Start; // Line start point
@ -38,7 +45,7 @@ protected:
TRACK( const TRACK& track ); // protected so Copy() is used instead.
public:
TRACK( BOARD_ITEM* StructFather, KICAD_T idtype = TYPETRACK );
TRACK( BOARD_ITEM* aParent, KICAD_T idtype = TYPE_TRACK );
/**
* Function Copy
@ -66,10 +73,6 @@ public:
EDA_Rect GetBoundingBox();
/* Remove "this" from the linked list */
void UnLink();
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
@ -78,19 +81,6 @@ public:
*/
bool Save( FILE* aFile ) const;
/**
* Function Insert
* inserts a single TRACK, SEGVIA or SEGZONE, or a list of such,
* into the proper list within a BOARD, either at the
* list's front or immediately after the InsertPoint.
* If Insertpoint == NULL, then insert at the beginning of the proper list.
* If InsertPoint != NULL, then insert immediately after InsertPoint.
* TRACKs and SEGVIAs are put on the m_Track list, SEGZONE on the m_Zone list.
* @param aPcb The BOARD to insert into.
* @param InsertPoint See above
*/
void Insert( BOARD* aPcb, TRACK* InsertPoint );
/**
* Function GetBestInsertPoint
* searches the "best" insertion point within the track linked list.
@ -167,8 +157,11 @@ public:
int IsPointOnEnds( const wxPoint& point, int min_dist = 0 );
bool IsNull(); // return TRUE if segment lenght = 0
/**
* Function IsNull
* returns true if segment length is zero.
*/
bool IsNull();
/**
* Function Display_Infos
@ -242,6 +235,14 @@ public:
*/
void Show( int nestLevel, std::ostream& os );
/**
* Function ShowState
* converts a set of state bits to a wxString
* @param stateBits Is an OR-ed together set of bits like BUSY, EDIT, etc.
*/
static wxString ShowState( int stateBits );
#endif
};
@ -249,7 +250,7 @@ public:
class SEGZONE : public TRACK
{
public:
SEGZONE( BOARD_ITEM* StructFather );
SEGZONE( BOARD_ITEM* aParent );
/**
* Function GetClass
@ -269,7 +270,7 @@ public:
class SEGVIA : public TRACK
{
public:
SEGVIA( BOARD_ITEM* StructFather );
SEGVIA( BOARD_ITEM* aParent );
SEGVIA( const SEGVIA& source ) :
TRACK( source )

View File

@ -19,7 +19,7 @@
/************************/
ZONE_CONTAINER::ZONE_CONTAINER( BOARD* parent ) :
BOARD_ITEM( parent, TYPEZONE_CONTAINER )
BOARD_ITEM( parent, TYPE_ZONE_CONTAINER )
{
m_NetCode = -1; // Net number for fast comparisons

View File

@ -59,9 +59,6 @@ public:
*/
wxPoint& GetPosition();
void UnLink( void )
{
};
/**
* Function copy

View File

@ -22,7 +22,7 @@
/* Class SCREEN: classe de gestion d'un affichage */
/***************************************************/
/* Constructeur de SCREEN */
PCB_SCREEN::PCB_SCREEN( int idscreen ) : BASE_SCREEN( TYPESCREEN )
PCB_SCREEN::PCB_SCREEN( int idscreen ) : BASE_SCREEN( TYPE_SCREEN )
{
// a zero terminated list
static const int zoom_list[] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 0 };

View File

@ -180,15 +180,13 @@ static void DeleteUnconnectedTracks( WinEDA_PcbFrame* frame, wxDC* DC )
frame->Affiche_Message( _( "Delete unconnected tracks:" ) );
frame->DrawPanel->m_AbortRequest = FALSE;
// correct via m_End defects and count number of segments
frame->m_Pcb->m_NbSegmTrack = 0;
// correct via m_End defects
ii = 0;
for( segment = frame->m_Pcb->m_Track; segment; segment = next )
{
frame->m_Pcb->m_NbSegmTrack++;
next = segment->Next();
if( segment->Type() == TYPEVIA )
if( segment->Type() == TYPE_VIA )
{
if( segment->m_Start != segment->m_End )
{
@ -213,13 +211,13 @@ static void DeleteUnconnectedTracks( WinEDA_PcbFrame* frame, wxDC* DC )
next = segment->Next();
// display activity
percent = (100 * ii) / frame->m_Pcb->m_NbSegmTrack;
percent = (100 * ii) / frame->m_Pcb->m_Track.GetCount();
if( percent != oldpercent )
{
oldpercent = percent;
frame->DisplayActivity( percent, wxT( "No Conn: " ) );
msg.Printf( wxT( "%d " ), frame->m_Pcb->m_NbSegmTrack );
msg.Printf( wxT( "%d " ), frame->m_Pcb->m_Track.GetCount() );
Affiche_1_Parametre( frame, POS_AFF_MAX, wxT( "Max" ), msg, GREEN );
msg.Printf( wxT( "%d " ), ii );
@ -268,7 +266,7 @@ static void DeleteUnconnectedTracks( WinEDA_PcbFrame* frame, wxDC* DC )
if( other == NULL ) // Test a connection to zones
{
if( segment->Type() != TYPEVIA )
if( segment->Type() != TYPE_VIA )
{
zone = frame->m_Pcb->HitTestForAnyFilledArea(segment->m_Start, segment->GetLayer() );
}
@ -288,7 +286,7 @@ static void DeleteUnconnectedTracks( WinEDA_PcbFrame* frame, wxDC* DC )
segment->start = other;
// If a via is connected to this end, test if this via has a second item connected
// if no, remove it with the current segment
if( other && other->Type() == TYPEVIA )
if( other && other->Type() == TYPE_VIA )
{
// search for another segment following the via
@ -318,7 +316,7 @@ static void DeleteUnconnectedTracks( WinEDA_PcbFrame* frame, wxDC* DC )
NULL, END );
if( other == NULL ) // Test a connection to zones
{
if( segment->Type() != TYPEVIA )
if( segment->Type() != TYPE_VIA )
zone = frame->m_Pcb->HitTestForAnyFilledArea(segment->m_End, segment->GetLayer() );
else
@ -334,9 +332,10 @@ static void DeleteUnconnectedTracks( WinEDA_PcbFrame* frame, wxDC* DC )
else // segment, via or zone connected to this end
{
segment->end = other;
// If a via is connected to this end, test if this via has a second item connected
// if no, remove it with the current segment
if( other && other->Type() == TYPEVIA )
if( other && other->Type() == TYPE_VIA )
{
// search for another segment following the via
@ -442,13 +441,13 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC )
for( segment = frame->m_Pcb->m_Track, ii = 0; segment; segment = segment->Next(), ii++ )
{
/* Display activity */
percent = (100 * ii) / frame->m_Pcb->m_NbSegmTrack;
percent = (100 * ii) / frame->m_Pcb->m_Track.GetCount();
if( percent != oldpercent )
{
frame->DisplayActivity( percent, wxT( "Id segm: " ) );
oldpercent = percent;
msg.Printf( wxT( "%d" ), frame->m_Pcb->m_NbSegmTrack );
msg.Printf( wxT( "%d" ), frame->m_Pcb->m_Track.GetCount() );
Affiche_1_Parametre( frame, POS_AFF_MAX, wxT( "Max" ), msg, GREEN );
msg.Printf( wxT( "%d" ), ii );
@ -519,13 +518,13 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC )
next = segment->Next();
ii++;
percent = (100 * ii) / frame->m_Pcb->m_NbSegmTrack;
percent = (100 * ii) / frame->m_Pcb->m_Track.GetCount();
if( percent != oldpercent )
{
frame->DisplayActivity( percent, _( "Merge: " ) );
oldpercent = percent;
msg.Printf( wxT( "%d" ), frame->m_Pcb->m_NbSegmTrack );
msg.Printf( wxT( "%d" ), frame->m_Pcb->m_Track.GetCount() );
Affiche_1_Parametre( frame, POS_AFF_MAX, wxT( "Max" ), msg, GREEN );
msg.Printf( wxT( "%d" ), ii );
@ -535,7 +534,7 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC )
return -1;
}
if( segment->Type() != TYPETRACK )
if( segment->Type() != TYPE_TRACK )
continue;
flag = no_inc = 0;
@ -552,7 +551,7 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC )
break;
// it cannot be a via
if( segStart->Type() != TYPETRACK )
if( segStart->Type() != TYPE_TRACK )
break;
/* We must have only one segment connected */
@ -588,7 +587,7 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC )
if( segment->m_Width != segEnd->m_Width )
break;
if( segEnd->Type() != TYPETRACK )
if( segEnd->Type() != TYPE_TRACK )
break;
/* We must have only one segment connected */
@ -764,16 +763,16 @@ int Netliste_Controle_piste( WinEDA_PcbFrame* frame, wxDC* DC, int affiche )
{
// display activity
ii++;
percent = (100 * ii) / frame->m_Pcb->m_NbSegmTrack;
percent = (100 * ii) / frame->m_Pcb->m_Track.GetCount();
if( percent != oldpercent )
{
frame->DisplayActivity( percent, wxT( "Drc: " ) );
oldpercent = percent;
msg.Printf( wxT( "%d" ), frame->m_Pcb->m_NbSegmTrack );
msg.Printf( wxT( "%d" ), frame->m_Pcb->m_Track.GetCount() );
Affiche_1_Parametre( frame, POS_AFF_MAX, wxT( "Max" ), msg, GREEN );
msg.Printf( wxT( "%d" ), frame->m_Pcb->m_NbSegmTrack );
msg.Printf( wxT( "%d" ), frame->m_Pcb->m_Track.GetCount() );
Affiche_1_Parametre( frame, POS_AFF_NUMSEGM, wxT( "Segm" ), msg, CYAN );
if( frame->DrawPanel->m_AbortRequest )
@ -784,7 +783,7 @@ int Netliste_Controle_piste( WinEDA_PcbFrame* frame, wxDC* DC, int affiche )
// find the netcode for segment using anything connected to the "start" of "segment"
net_code_s = -1;
if( segment->start && segment->start->Type()==TYPEPAD )
if( segment->start && segment->start->Type()==TYPE_PAD )
{
// get the netcode of the pad to propagate.
net_code_s = ((D_PAD*)(segment->start))->GetNet();
@ -802,7 +801,7 @@ int Netliste_Controle_piste( WinEDA_PcbFrame* frame, wxDC* DC, int affiche )
// find the netcode for segment using anything connected to the "end" of "segment"
net_code_e = -1;
if( segment->end && segment->end->Type()==TYPEPAD )
if( segment->end && segment->end->Type()==TYPE_PAD )
{
net_code_e = ((D_PAD*)(segment->end))->GetNet();
}
@ -885,13 +884,13 @@ static void Gen_Raccord_Track( WinEDA_PcbFrame* frame, wxDC* DC )
{
// display activity
ii++;
percent = (100 * ii) / frame->m_Pcb->m_NbSegmTrack;
percent = (100 * ii) / frame->m_Pcb->m_Track.GetCount();
if( percent != oldpercent )
{
frame->DisplayActivity( percent, wxT( "Tracks: " ) );
oldpercent = percent;
msg.Printf( wxT( "%d" ), frame->m_Pcb->m_NbSegmTrack );
msg.Printf( wxT( "%d" ), frame->m_Pcb->m_Track.GetCount() );
Affiche_1_Parametre( frame, POS_AFF_MAX, wxT( "Max" ), msg, GREEN );
msg.Printf( wxT( "%d" ), ii );
@ -915,7 +914,7 @@ static void Gen_Raccord_Track( WinEDA_PcbFrame* frame, wxDC* DC )
if( other == segment )
continue;
if( other->Type() == TYPEVIA )
if( other->Type() == TYPE_VIA )
continue;
if( segment->m_Start == other->m_Start )
@ -937,11 +936,10 @@ static void Gen_Raccord_Track( WinEDA_PcbFrame* frame, wxDC* DC )
msg.Printf( wxT( "%d" ), nn );
Affiche_1_Parametre( frame, POS_AFF_VAR, wxT( "New <" ), msg, YELLOW );
frame->m_Pcb->m_NbSegmTrack++;
// create a new segment and insert it next to "other", then shorten other.
newTrack = other->Copy();
newTrack->Insert( frame->m_Pcb, other );
frame->m_Pcb->m_Track.Insert( newTrack, other->Next() );
other->m_End = segment->m_Start;
newTrack->m_Start = segment->m_Start;
@ -964,7 +962,7 @@ static void Gen_Raccord_Track( WinEDA_PcbFrame* frame, wxDC* DC )
if( other == segment )
continue;
if( other->Type() == TYPEVIA )
if( other->Type() == TYPE_VIA )
continue;
if( segment->m_End == other->m_Start )
@ -985,11 +983,9 @@ static void Gen_Raccord_Track( WinEDA_PcbFrame* frame, wxDC* DC )
msg.Printf( wxT( "%d" ), nn );
Affiche_1_Parametre( frame, POS_AFF_VAR, wxT( "New >" ), msg, YELLOW );
frame->m_Pcb->m_NbSegmTrack++;
// create a new segment and insert it next to "other", then shorten other.
newTrack = other->Copy();
newTrack->Insert( frame->m_Pcb, other );
frame->m_Pcb->m_Track.Insert( newTrack, other->Next() );
other->m_End = segment->m_End;
newTrack->m_Start = segment->m_End;
@ -1023,7 +1019,7 @@ static void ConnectDanglingEndToVia( BOARD* pcb )
{
SEGVIA* via;
if( track->Type()!=TYPEVIA || (via = (SEGVIA*)track)->GetNet()!=0 )
if( track->Type()!=TYPE_VIA || (via = (SEGVIA*)track)->GetNet()!=0 )
continue;
for( TRACK* other = pcb->m_Track; other; other = other->Next() )
@ -1039,7 +1035,8 @@ static void ConnectDanglingEndToVia( BOARD* pcb )
if( other->m_End!=via->GetPosition() && via->HitTest( other->m_Start ) && !other->start )
{
TRACK* newTrack = other->Copy();
newTrack->Insert( pcb, other );
pcb->m_Track.Insert( newTrack, other->Next() );
newTrack->m_End = via->GetPosition();
@ -1061,7 +1058,8 @@ static void ConnectDanglingEndToVia( BOARD* pcb )
else if( other->m_Start!=via->GetPosition() && via->HitTest( other->m_End ) && !other->end )
{
TRACK* newTrack = other->Copy();
newTrack->Insert( pcb, other );
pcb->m_Track.Insert( newTrack, other->Next() );
newTrack->m_Start = via->GetPosition();
@ -1111,13 +1109,13 @@ void ConnectDanglingEndToPad( WinEDA_PcbFrame* frame, wxDC* DC )
D_PAD* pad;
ii++;
percent = (100 * ii) / frame->m_Pcb->m_NbSegmTrack;
percent = (100 * ii) / frame->m_Pcb->m_Track.GetCount();
if( percent != oldpercent )
{
frame->DisplayActivity( percent, _( "Pads: " ) );
oldpercent = percent;
msg.Printf( wxT( "%d" ), frame->m_Pcb->m_NbSegmTrack );
msg.Printf( wxT( "%d" ), frame->m_Pcb->m_Track.GetCount() );
Affiche_1_Parametre( frame, POS_AFF_MAX, _( "Max" ), msg, GREEN );
msg.Printf( wxT( "%d" ), ii );
@ -1137,7 +1135,8 @@ void ConnectDanglingEndToPad( WinEDA_PcbFrame* frame, wxDC* DC )
NULL, START ) == NULL )
{
TRACK* newTrack = segment->Copy();
newTrack->Insert( frame->m_Pcb, segment );
frame->m_Pcb->m_Track.Insert( newTrack, segment->Next() );
newTrack->m_End = pad->m_Pos;
@ -1162,7 +1161,8 @@ void ConnectDanglingEndToPad( WinEDA_PcbFrame* frame, wxDC* DC )
NULL, END ) == NULL )
{
TRACK* newTrack = segment->Copy();
newTrack->Insert( frame->m_Pcb, segment );
frame->m_Pcb->m_Track.Insert( newTrack, segment->Next() );
newTrack->m_Start = pad->m_Pos;

View File

@ -36,86 +36,86 @@ const KICAD_T GENERAL_COLLECTOR::AllBoardItems[] = {
// there are some restrictions on the order of items in the general case.
// all items in m_Drawings for instance should be contiguous.
// *** all items in a same list (shown here) must be contiguous ****
TYPEMARKER, // in m_markers
TYPETEXTE, // in m_Drawings
TYPEDRAWSEGMENT, // in m_Drawings
TYPECOTATION, // in m_Drawings
TYPEMIRE, // in m_Drawings
TYPEVIA, // in m_Tracks
TYPETRACK, // in m_Tracks
TYPEPAD, // in modules
TYPETEXTEMODULE, // in modules
TYPEMODULE, // in m_Modules
TYPEZONE, // in m_Zones
TYPEZONE_CONTAINER, // in m_ZoneDescriptorList
TYPE_MARKER, // in m_markers
TYPE_TEXTE, // in m_Drawings
TYPE_DRAWSEGMENT, // in m_Drawings
TYPE_COTATION, // in m_Drawings
TYPE_MIRE, // in m_Drawings
TYPE_VIA, // in m_Tracks
TYPE_TRACK, // in m_Tracks
TYPE_PAD, // in modules
TYPE_TEXTE_MODULE, // in modules
TYPE_MODULE, // in m_Modules
TYPE_ZONE, // in m_Zones
TYPE_ZONE_CONTAINER, // in m_ZoneDescriptorList
EOT
};
/*
* const KICAD_T GENERAL_COLLECTOR::PrimaryItems[] = {
* TYPETEXTE,
* TYPEDRAWSEGMENT,
* TYPECOTATION,
* TYPEVIA,
* TYPETRACK,
* TYPEMODULE,
* TYPE_TEXTE,
* TYPE_DRAWSEGMENT,
* TYPE_COTATION,
* TYPE_VIA,
* TYPE_TRACK,
* TYPE_MODULE,
* EOT
* };
*/
const KICAD_T GENERAL_COLLECTOR::AllButZones[] = {
TYPEMARKER,
TYPETEXTE,
TYPEDRAWSEGMENT,
TYPECOTATION,
TYPEMIRE,
TYPEVIA,
TYPETRACK,
TYPEPAD,
TYPETEXTEMODULE,
TYPEMODULE,
TYPEZONE_CONTAINER, // if it is visible on screen, it should be selectable
TYPE_MARKER,
TYPE_TEXTE,
TYPE_DRAWSEGMENT,
TYPE_COTATION,
TYPE_MIRE,
TYPE_VIA,
TYPE_TRACK,
TYPE_PAD,
TYPE_TEXTE_MODULE,
TYPE_MODULE,
TYPE_ZONE_CONTAINER, // if it is visible on screen, it should be selectable
EOT
};
const KICAD_T GENERAL_COLLECTOR::ModuleItems[] = {
TYPEMODULE,
TYPE_MODULE,
EOT
};
const KICAD_T GENERAL_COLLECTOR::PadsOrModules[] = {
TYPEPAD,
TYPEMODULE,
TYPE_PAD,
TYPE_MODULE,
EOT
};
const KICAD_T GENERAL_COLLECTOR::PadsTracksOrZones[] = {
TYPEPAD,
TYPEVIA,
TYPETRACK,
TYPEZONE,
TYPEZONE_CONTAINER,
TYPE_PAD,
TYPE_VIA,
TYPE_TRACK,
TYPE_ZONE,
TYPE_ZONE_CONTAINER,
EOT
};
const KICAD_T GENERAL_COLLECTOR::ModulesAndTheirItems[] = {
TYPETEXTEMODULE,
TYPEEDGEMODULE,
TYPEPAD,
TYPEMODULE,
TYPE_TEXTE_MODULE,
TYPE_EDGE_MODULE,
TYPE_PAD,
TYPE_MODULE,
EOT
};
const KICAD_T GENERAL_COLLECTOR::Tracks[] = {
TYPETRACK,
TYPEVIA,
TYPE_TRACK,
TYPE_VIA,
EOT
};
@ -142,7 +142,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
switch( item->Type() )
{
case TYPEPAD:
case TYPE_PAD:
{
MODULE* m = (MODULE*) item->GetParent();
if( m->GetReference() == wxT( "Y2" ) )
@ -152,31 +152,31 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
}
break;
case TYPEVIA:
case TYPE_VIA:
breakhere++;
break;
case TYPETRACK:
case TYPE_TRACK:
breakhere++;
break;
case TYPEZONE:
case TYPE_ZONE:
breakhere++;
break;
case TYPETEXTE:
case TYPE_TEXTE:
breakhere++;
break;
case TYPEDRAWSEGMENT:
case TYPE_DRAWSEGMENT:
breakhere++;
break;
case TYPECOTATION:
case TYPE_COTATION:
breakhere++;
break;
case TYPETEXTEMODULE:
case TYPE_TEXTE_MODULE:
{
TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
if( tm->m_Text == wxT( "10uH" ) )
@ -186,7 +186,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
}
break;
case TYPEMODULE:
case TYPE_MODULE:
{
MODULE* m = (MODULE*) item;
if( m->GetReference() == wxT( "C98" ) )
@ -206,7 +206,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
switch( item->Type() )
{
case TYPEPAD:
case TYPE_PAD:
// if pad is a thru hole, then it can be visible when its parent module is not.
if( ( (D_PAD*) item )->m_Attribut != PAD_SMD ) // a hole is present, so multiple layers
@ -219,31 +219,31 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
module = (MODULE*) item->GetParent();
break;
case TYPEVIA:
case TYPE_VIA:
break;
case TYPETRACK:
case TYPE_TRACK:
break;
case TYPEZONE:
case TYPE_ZONE:
break;
case TYPEZONE_CONTAINER:
case TYPE_ZONE_CONTAINER:
break;
case TYPETEXTE:
case TYPE_TEXTE:
break;
case TYPEDRAWSEGMENT:
case TYPE_DRAWSEGMENT:
break;
case TYPECOTATION:
case TYPE_COTATION:
break;
case TYPEMIRE:
case TYPE_MIRE:
break;
case TYPETEXTEMODULE:
case TYPE_TEXTE_MODULE:
module = (MODULE*) item->GetParent();
if( m_Guide->IgnoreMTextsMarkedNoShow() && ( (TEXTE_MODULE*) item )->m_NoShow )
@ -259,7 +259,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
}
break;
case TYPEMODULE:
case TYPE_MODULE:
module = (MODULE*) item;
break;
@ -269,7 +269,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
// common tests:
if( module ) // true from case TYPEPAD, TYPETEXTEMODULE, or TYPEMODULE
if( module ) // true from case TYPE_PAD, TYPE_TEXTE_MODULE, or TYPE_MODULE
{
if( m_Guide->IgnoreModulesOnCu() && module->GetLayer()==COPPER_LAYER_N )
goto exit;

View File

@ -121,7 +121,7 @@ public:
* Function IgnoreZones
* @return bool - true if should ignore zones.
virtual bool IgnoreZones() const = 0;
can simply omit from scanTypes[] TYPEZONE */
can simply omit from scanTypes[] TYPE_ZONE */
/**
* Function IgnoreMTextsOnCu

View File

@ -11,6 +11,7 @@
#include "protos.h"
//#include <algorithm>
extern void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb );
extern void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode );
@ -19,7 +20,6 @@ extern void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode );
static void Propagate_SubNet( TRACK* pt_start_conn, TRACK* pt_end_conn );
static void Build_Pads_Info_Connections_By_Tracks( TRACK* pt_start_conn, TRACK* pt_end_conn );
static void RebuildTrackChain( BOARD* pcb );
static int Sort_By_NetCode( TRACK** pt_ref, TRACK** pt_compare );
/*..*/
@ -65,14 +65,14 @@ static int Merge_Two_SubNets( TRACK* pt_start_conn, TRACK* pt_end_conn, int old_
nb_change++;
pt_conn->SetSubNet( new_val );
if( pt_conn->start && ( pt_conn->start->Type() == TYPEPAD) )
if( pt_conn->start && ( pt_conn->start->Type() == TYPE_PAD) )
{
pt_pad = (D_PAD*) (pt_conn->start);
if( pt_pad->GetSubNet() == old_val )
pt_pad->SetSubNet(pt_conn->GetSubNet());
}
if( pt_conn->end && (pt_conn->end->Type() == TYPEPAD) )
if( pt_conn->end && (pt_conn->end->Type() == TYPE_PAD) )
{
pt_pad = (D_PAD*) (pt_conn->end);
if( pt_pad->GetSubNet() == old_val )
@ -114,11 +114,11 @@ static void Propagate_SubNet( TRACK* pt_start_conn, TRACK* pt_end_conn )
{
pt_conn->SetSubNet( 0 );
PtStruct = pt_conn->start;
if( PtStruct && (PtStruct->Type() == TYPEPAD) )
if( PtStruct && (PtStruct->Type() == TYPE_PAD) )
( (D_PAD*) PtStruct )->SetSubNet( 0);
PtStruct = pt_conn->end;
if( PtStruct && (PtStruct->Type() == TYPEPAD) )
if( PtStruct && (PtStruct->Type() == TYPE_PAD) )
( (D_PAD*) PtStruct )->SetSubNet( 0);
if( pt_conn == pt_end_conn )
@ -136,7 +136,7 @@ static void Propagate_SubNet( TRACK* pt_start_conn, TRACK* pt_end_conn )
PtStruct = pt_conn->start;
/* The segment starts on a pad */
if( PtStruct && (PtStruct->Type() == TYPEPAD) )
if( PtStruct && (PtStruct->Type() == TYPE_PAD) )
{
pt_pad = (D_PAD*) PtStruct;
if( pt_conn->GetSubNet() ) /* the track segment is already a cluster member */
@ -165,7 +165,7 @@ static void Propagate_SubNet( TRACK* pt_start_conn, TRACK* pt_end_conn )
}
PtStruct = pt_conn->end;
if( PtStruct && (PtStruct->Type() == TYPEPAD) )
if( PtStruct && (PtStruct->Type() == TYPE_PAD) )
/* The segment end on a pad */
{
pt_pad = (D_PAD*) PtStruct;
@ -197,7 +197,7 @@ static void Propagate_SubNet( TRACK* pt_start_conn, TRACK* pt_end_conn )
/* Test connections between segments */
PtStruct = pt_conn->start;
if( PtStruct && (PtStruct->Type() != TYPEPAD) )
if( PtStruct && (PtStruct->Type() != TYPE_PAD) )
{
/* The segment starts on an other track */
pt_autre_piste = (TRACK*) PtStruct;
@ -230,7 +230,7 @@ static void Propagate_SubNet( TRACK* pt_start_conn, TRACK* pt_end_conn )
}
PtStruct = pt_conn->end; // Do the same calculations for the segment end point
if( PtStruct && (PtStruct->Type() != TYPEPAD) )
if( PtStruct && (PtStruct->Type() != TYPE_PAD) )
{
pt_autre_piste = (TRACK*) PtStruct;
@ -276,31 +276,29 @@ void WinEDA_BasePcbFrame::test_connexions( wxDC* DC )
* @param DC = current Device Context
*/
{
TRACK* pt_start_conn, * pt_end_conn;
int ii;
LISTE_PAD* pt_pad;
int current_net_code;
/* Clear the cluster identifier for all pads */
pt_pad = m_Pcb->m_Pads;
for( ii = 0; ii < m_Pcb->m_NbPads; ii++, pt_pad++ )
// Clear the cluster identifier for all pads
for( unsigned i = 0; i< m_Pcb->m_Pads.size(); ++i )
{
(*pt_pad)->SetZoneSubNet( 0 );
(*pt_pad)->SetSubNet( 0 );
D_PAD* pad = m_Pcb->m_Pads[i];
pad->SetZoneSubNet( 0 );
pad->SetSubNet( 0 );
}
m_Pcb->Test_Connections_To_Copper_Areas( );
m_Pcb->Test_Connections_To_Copper_Areas();
/* Test existing connections net by net */
pt_start_conn = m_Pcb->m_Track; // this is the first segment of the first net
while( pt_start_conn != NULL )
// Test existing connections net by net
for( TRACK* track = m_Pcb->m_Track; track; )
{
current_net_code = pt_start_conn->GetNet(); // this is the current net because pt_start_conn is the first segment of the net
pt_end_conn = pt_start_conn->GetEndNetCode( current_net_code ); // this is the last segment of the current net
// this is the current net because pt_start_conn is the first segment of the net
int current_net_code = track->GetNet();
Build_Pads_Info_Connections_By_Tracks( pt_start_conn, pt_end_conn );
// this is the last segment of the current net
TRACK* pt_end_conn = track->GetEndNetCode( current_net_code );
pt_start_conn = pt_end_conn->Next(); // this is now the first segment of the next net
Build_Pads_Info_Connections_By_Tracks( track, pt_end_conn );
track = pt_end_conn->Next(); // this is now the first segment of the next net
}
Merge_SubNets_Connected_By_CopperAreas( m_Pcb );
@ -319,9 +317,6 @@ void WinEDA_BasePcbFrame::test_1_net_connexion( wxDC* DC, int net_code )
* @param net_code = net code to test
*/
{
TRACK* pt_start_conn, * pt_end_conn;
int ii, nb_net_noconnect = 0;
LISTE_PAD* pt_pad;
wxString msg;
if( net_code == 0 )
@ -330,17 +325,19 @@ void WinEDA_BasePcbFrame::test_1_net_connexion( wxDC* DC, int net_code )
if( (m_Pcb->m_Status_Pcb & LISTE_CHEVELU_OK) == 0 )
Compile_Ratsnest( DC, TRUE );
pt_pad = (LISTE_PAD*) m_Pcb->m_Pads;
for( ii = 0; ii < m_Pcb->m_NbPads; ii++, pt_pad++ )
for( unsigned i=0; i<m_Pcb->m_Pads.size(); ++i )
{
int pad_net_code = (*pt_pad)->GetNet();
D_PAD* pad = m_Pcb->m_Pads[i];
int pad_net_code = pad->GetNet();
if( pad_net_code < net_code )
continue;
if( pad_net_code > net_code )
break;
(*pt_pad)->SetSubNet( 0 );
pad->SetSubNet( 0 );
}
m_Pcb->Test_Connections_To_Copper_Areas( net_code );
@ -348,8 +345,11 @@ void WinEDA_BasePcbFrame::test_1_net_connexion( wxDC* DC, int net_code )
/* Search for the first and the last segment relative to the given net code */
if( m_Pcb->m_Track )
{
TRACK* pt_start_conn;
TRACK* pt_end_conn;
pt_end_conn = NULL;
pt_start_conn = m_Pcb->m_Track->GetStartNetCode( net_code );
pt_start_conn = m_Pcb->m_Track.GetFirst()->GetStartNetCode( net_code );
if( pt_start_conn )
pt_end_conn = pt_start_conn->GetEndNetCode( net_code );
@ -362,7 +362,7 @@ void WinEDA_BasePcbFrame::test_1_net_connexion( wxDC* DC, int net_code )
Merge_SubNets_Connected_By_CopperAreas( m_Pcb, net_code );
/* Test the rastnest for this net */
nb_net_noconnect = Test_1_Net_Ratsnest( DC, net_code );
int nb_net_noconnect = Test_1_Net_Ratsnest( DC, net_code );
/* Display results */
msg.Printf( wxT( "links %d nc %d net:nc %d" ),
@ -408,7 +408,7 @@ static void Build_Pads_Info_Connections_By_Tracks( TRACK* pt_start_conn, TRACK*
/* Update connections type track to track */
for( Track = pt_start_conn; Track != NULL; Track = Track->Next() )
{
if( Track->Type() == TYPEVIA ) // A via can connect many tracks, we must search for all track segments in this net
if( Track->Type() == TYPE_VIA ) // A via can connect many tracks, we must search for all track segments in this net
{
TRACK* pt_segm;
int layermask = Track->ReturnMaskLayer();
@ -452,14 +452,11 @@ static void Build_Pads_Info_Connections_By_Tracks( TRACK* pt_start_conn, TRACK*
#define POS_AFF_CHREF 62
/******************************************************************************/
static D_PAD* SuperFast_Locate_Pad_Connecte( BOARD* aPcb, LISTE_PAD* pt_liste,
const wxPoint & posref, int masque_layer )
/******************************************************************************/
/** Function SuperFast_Locate_Pad_Connecte
* Locate the pad connected to a track ended at coord px, py
* A track is seen as connected if the px, py position is same as the pad position
/**
* Function SuperFast_Locate_Pad_Connecte
* locates the pad connected to a track ended at coord px, py.
* A track is seen as connected if the px, py position is same as the pad position.
*
* @param aPcb = the board.
* @param pt_liste = Pointers to pads buffer
* This buffer is a list like the list created by build_liste_pad, but sorted by increasing X pad coordinate
@ -471,13 +468,16 @@ static D_PAD* SuperFast_Locate_Pad_Connecte( BOARD* aPcb, LISTE_PAD* pt_liste,
*
* (Note: The usual pad list (created by build_liste_pad) m_Pcb->m_Pads is sorted by increasing netcodes )
*/
static D_PAD* SuperFast_Locate_Pad_Connecte( BOARD* aPcb, LISTE_PAD* pt_liste,
const wxPoint& posref, int masque_layer )
{
D_PAD* pad;
LISTE_PAD* ptr_pad, * lim;
int nb_pad = aPcb->m_NbPads;
int ii;
lim = pt_liste + (aPcb->m_NbPads - 1 );
int nb_pad = aPcb->m_Pads.size();
LISTE_PAD* ptr_pad = pt_liste;
LISTE_PAD* lim = pt_liste + nb_pad - 1;
ptr_pad = pt_liste;
while( nb_pad )
{
@ -540,10 +540,12 @@ static D_PAD* SuperFast_Locate_Pad_Connecte( BOARD* aPcb, LISTE_PAD* pt_liste,
}
static int SortPadsByXCoord( const void* pt_ref, const void* pt_comp )
/* used to Sort a pad list by x coordinate value
/**
* Function SortPadsByXCoord
* is used to Sort a pad list by x coordinate value.
*/
static int SortPadsByXCoord( const void* pt_ref, const void* pt_comp )
{
D_PAD* ref = *(LISTE_PAD*) pt_ref;
D_PAD* comp = *(LISTE_PAD*) pt_comp;
@ -552,15 +554,14 @@ static int SortPadsByXCoord( const void* pt_ref, const void* pt_comp )
}
/*****************************************************************************/
void CreateSortedPadListByXCoord( BOARD* aBoard, std::vector<D_PAD*>* aVector )
/*****************************************************************************/
{
aVector->resize( aBoard->m_NbPads );
aVector->insert( aVector->end(), aBoard->m_Pads.begin(), aBoard->m_Pads.end() );
memcpy( &(*aVector)[0], aBoard->m_Pads, aBoard->m_NbPads * sizeof( D_PAD*) );
qsort( &(*aVector)[0], aBoard->m_NbPads, sizeof( D_PAD*), SortPadsByXCoord );
qsort( &(*aVector)[0], aBoard->m_Pads.size(), sizeof( D_PAD*), SortPadsByXCoord );
}
@ -584,7 +585,7 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche )
int masque_layer;
wxString msg;
if( m_Pcb->m_NbPads == 0 )
if( m_Pcb->m_Pads.size() == 0 )
return;
a_color = CYAN;
@ -692,7 +693,7 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche )
/* look for vias which could be connect many tracks */
for( TRACK* via = m_Pcb->m_Track; via != NULL; via = via->Next() )
{
if( via->Type() != TYPEVIA )
if( via->Type() != TYPE_VIA )
continue;
if( via->GetNet() > 0 )
@ -729,7 +730,7 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche )
{
/* look for the connection to the current segment starting point */
PtStruct = (BOARD_ITEM*) pt_piste->start;
if( PtStruct && (PtStruct->Type() != TYPEPAD) )
if( PtStruct && (PtStruct->Type() != TYPE_PAD) )
{
// Begin on an other track segment
pt_next = (TRACK*) PtStruct;
@ -753,7 +754,7 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche )
/* look for the connection to the current segment ending point */
PtStruct = pt_piste->end;
if( PtStruct &&(PtStruct->Type() != TYPEPAD) )
if( PtStruct &&(PtStruct->Type() != TYPE_PAD) )
{
pt_next = (TRACK*) PtStruct;
@ -788,60 +789,53 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche )
}
/*
* Sort function for track segments used in RebuildTrackChain() (for the qsort C function)
* The sorting is made by net code
/**
* Function Sort_By_NetCode
* sorts track segments used in RebuildTrackChain() (for the qsort C function)
* The sorting is made by net code.
*/
int Sort_By_NetCode( TRACK** pt_ref, TRACK** pt_compare )
static int Sort_By_NetCode( const void* left, const void* right )
{
int ii;
TRACK* pt_ref = *(TRACK**) left;
TRACK* pt_compare = *(TRACK**) right;
ii = (*pt_ref)->GetNet() - (*pt_compare)->GetNet();
return ii;
int ret = pt_ref->GetNet() - pt_compare->GetNet();
return ret;
}
/*****************************************/
static void RebuildTrackChain( BOARD* pcb )
/*****************************************/
/** Function RebuildTrackChain()
/**
* Function RebuildTrackChain
* rebuilds the track segment linked list in order to have a chain
* sorted by increasing netcodes.
* @param pcb = board to rebuild
* Rebuild the track segment linked list in order to have a chain sorted by increasing netcodes
*/
static void RebuildTrackChain( BOARD* pcb )
{
TRACK* Track, ** Liste;
int ii, nbsegm;
/* Count segments */
nbsegm = pcb->GetNumSegmTrack();
if( pcb->m_Track == NULL )
return;
Liste = (TRACK**) MyZMalloc( (nbsegm + 1) * sizeof(TRACK*) );
int nbsegm = pcb->m_Track.GetCount();
ii = 0; Track = pcb->m_Track;
for( ; Track != NULL; ii++, Track = Track->Next() )
TRACK** array = (TRACK**) MyZMalloc( nbsegm * sizeof(TRACK*) );
for( int i=0; i<nbsegm; ++i )
{
Liste[ii] = Track;
array[i] = pcb->m_Track.PopFront();
wxASSERT( array[i] );
}
qsort( Liste, nbsegm, sizeof(TRACK*),
( int( * ) ( const void*, const void* ) )Sort_By_NetCode );
// the list is empty now
wxASSERT( pcb->m_Track == NULL && pcb->m_Track.GetCount()==0 );
/* Update the linked list pointers */
qsort( array, nbsegm, sizeof(TRACK*), Sort_By_NetCode );
Track = Liste[0];
Track->SetBack( pcb );
Track->SetNext( Liste[1] );
pcb->m_Track = Track;
for( ii = 1; ii < nbsegm; ii++ )
// add them back to the list
for( int i=0; i<nbsegm; ++i )
{
Track = Liste[ii];
Track->SetBack( Liste[ii - 1] );
Track->SetNext( Liste[ii + 1] );
pcb->m_Track.PushBack( array[i] );
}
MyFree( Liste );
MyFree( array );
}

View File

@ -30,7 +30,7 @@ static BOARD_ITEM* AllAreModulesAndReturnSmallestIfSo( GENERAL_COLLECTOR* aColle
for( int i = 0; i<count; ++i )
{
if( (*aCollector)[i]->Type() != TYPEMODULE )
if( (*aCollector)[i]->Type() != TYPE_MODULE )
return NULL;
}
@ -131,7 +131,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
for( int ii = 0; ii < m_Collector->GetCount(); ii++ )
{
item = (*m_Collector)[ii];
if( item->Type() != TYPEZONE )
if( item->Type() != TYPE_ZONE )
continue;
/* Found a TYPE ZONE */
@ -151,9 +151,9 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
}
// If the count is 2, and first item is a pad or moduletext, and the 2nd item is its parent module:
else if( m_Collector->GetCount() == 2
&& ( (*m_Collector)[0]->Type() == TYPEPAD || (*m_Collector)[0]->Type() ==
TYPETEXTEMODULE )
&& (*m_Collector)[1]->Type() == TYPEMODULE && (*m_Collector)[0]->GetParent()==
&& ( (*m_Collector)[0]->Type() == TYPE_PAD || (*m_Collector)[0]->Type() ==
TYPE_TEXTE_MODULE )
&& (*m_Collector)[1]->Type() == TYPE_MODULE && (*m_Collector)[0]->GetParent()==
(*m_Collector)[1] )
{
item = (*m_Collector)[0];
@ -271,15 +271,12 @@ static bool Join( wxPoint* res, wxPoint a0, wxPoint a1, wxPoint b0, wxPoint b1 )
*/
bool Project( wxPoint* res, wxPoint on_grid, const TRACK* track )
{
wxPoint vec;
double t;
if( track->m_Start == track->m_End )
return false;
vec = track->m_End-track->m_Start;
wxPoint vec = track->m_End - track->m_Start;
t = double( on_grid.x - track->m_Start.x ) * vec.x +
double t = double( on_grid.x - track->m_Start.x ) * vec.x +
double( on_grid.y - track->m_Start.y ) * vec.y;
t /= (double) vec.x * vec.x + (double) vec.y * vec.y;
@ -313,7 +310,7 @@ static bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame,
// D( printf( "currTrack=%p currItem=%p currTrack->Type()=%d currItem->Type()=%d\n", currTrack, currItem, currTrack ? currTrack->Type() : 0, currItem ? currItem->Type() : 0 ); )
if( !currTrack && currItem && currItem->Type()==TYPEVIA && currItem->m_Flags )
if( !currTrack && currItem && currItem->Type()==TYPE_VIA && currItem->m_Flags )
{
// moving a VIA
currTrack = (TRACK*) currItem;
@ -381,7 +378,7 @@ static bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame,
}
else
{
// D( printf( "skipping self\n" ); )
//D( printf( "skipping self\n" ); )
}
}
@ -390,8 +387,11 @@ static bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame,
int layer_mask = g_TabOneLayerMask[layer];
TRACK* track = Locate_Pistes( m_Pcb->m_Track, layer_mask, CURSEUR_OFF_GRILLE );
if( !track || track->Type() != TYPETRACK )
if( !track || track->Type() != TYPE_TRACK )
{
// D(printf("!currTrack and track=%p not found, layer_mask=0x%X\n", track, layer_mask );)
return false;
}
// D( printf( "Project\n" ); )
return Project( curpos, on_grid, track );
@ -413,13 +413,13 @@ static bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame,
for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() )
{
if( track->Type() != TYPETRACK )
if( track->Type() != TYPE_TRACK )
continue;
if( doCheckNet && currTrack && currTrack->GetNet() != track->GetNet() )
continue;
if( (g_DesignSettings.m_LayerColor[track->GetLayer()] & ITEM_NOT_SHOW) )
if( g_DesignSettings.m_LayerColor[track->GetLayer()] & ITEM_NOT_SHOW )
continue;
// omit the layer check if moving a via
@ -429,6 +429,8 @@ static bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame,
if( !track->HitTest( *curpos ) )
continue;
D(printf( "have track prospect\n");)
if( Join( curpos, track->m_Start, track->m_End, currTrack->m_Start, currTrack->m_End ) )
{
// D(printf( "join currTrack->Type()=%d\n", currTrack->Type() );)
@ -448,8 +450,8 @@ static bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame,
double( curpos->y - track->m_End.y ));
// if track not via, or if its a via dragging but not with its adjacent track
if( currTrack->Type() != TYPEVIA
|| ( currTrack->m_Start!=track->m_Start && currTrack->m_Start!=track->m_End ))
if( currTrack->Type() != TYPE_VIA
|| ( currTrack->m_Start != track->m_Start && currTrack->m_Start != track->m_End ))
{
if( distStart <= currTrack->m_Width/2 )
{

View File

@ -280,12 +280,7 @@ COTATION* WinEDA_PcbFrame::Begin_Cotation( COTATION* Cotation, wxDC* DC )
Cotation->m_Flags = 0;
/* Insertion de la structure dans le Chainage .Drawings du PCB */
Cotation->SetBack( m_Pcb );
Cotation->SetNext( m_Pcb->m_Drawings );
if( m_Pcb->m_Drawings )
m_Pcb->m_Drawings->SetBack( Cotation );
m_Pcb->m_Drawings = Cotation;
m_Pcb->Add( Cotation );
GetScreen()->SetModify();
DrawPanel->ManageCurseur = NULL;

View File

@ -148,13 +148,13 @@ void WinEDA_PcbFrame::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
switch( objectToSync->Type() )
{
case TYPEMODULE:
case TYPE_MODULE:
module = (MODULE*) objectToSync;
sprintf( cmd, "$PART: \"%s\"",
CONV_TO_UTF8( module->m_Reference->m_Text ) );
break;
case TYPEPAD:
case TYPE_PAD:
module = (MODULE*) objectToSync->GetParent();
pad = (D_PAD*) objectToSync;
msg = pad->ReturnStringPadName();
@ -163,7 +163,7 @@ void WinEDA_PcbFrame::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
CONV_TO_UTF8( msg ) );
break;
case TYPETEXTEMODULE:
case TYPE_TEXTE_MODULE:
#define REFERENCE 0
#define VALUE 1
module = (MODULE*) objectToSync->GetParent();

View File

@ -17,7 +17,7 @@
/***************************************************************/
TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* Track )
TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )
/***************************************************************/
/* Supprime 1 segment de piste.
@ -29,58 +29,49 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* Track )
{
int current_net_code;
if( Track == NULL )
if( aTrack == NULL )
return NULL;
if( Track->GetState( DELETED ) )
if( aTrack->GetState( DELETED ) )
{
D( printf( "WinEDA_PcbFrame::Delete_Segment(): bug deleted already deleted TRACK\n" ); )
return NULL;
}
if( Track->m_Flags & IS_NEW ) // Trace en cours, on peut effacer le dernier segment
if( aTrack->m_Flags & IS_NEW ) // Trace in progress, erase the last segment
{
if( g_TrackSegmentCount > 0 )
if( g_CurrentTrackList.GetCount() > 0 )
{
int previous_layer = ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer;
D( g_CurrentTrackList.VerifyListIntegrity(); )
// effacement de la piste en cours
ShowNewTrackWhenMovingCursor( DrawPanel, DC, FALSE );
// modification du trace
Track = g_CurrentTrackSegment;
g_CurrentTrackSegment = g_CurrentTrackSegment->Back();
delete Track;
g_TrackSegmentCount--;
// delete the most recently entered
delete g_CurrentTrackList.PopBack();
if( g_TwoSegmentTrackBuild )
{
// g_CurrentTrackSegment->Back() must not be a via, or we want delete also the via
if( (g_TrackSegmentCount >= 2)
&& (g_CurrentTrackSegment->Type() != TYPEVIA)
&& (g_CurrentTrackSegment->Back()->Type() == TYPEVIA) )
// if in 2 track mode, and the next most recent is a segment not a via,
// and the one previous to that is a via, then delete up to the via.
if( g_CurrentTrackList.GetCount() >= 2
&& g_CurrentTrackSegment->Type() != TYPE_VIA
&& g_CurrentTrackSegment->Back()->Type() == TYPE_VIA )
{
Track = g_CurrentTrackSegment;
g_CurrentTrackSegment = g_CurrentTrackSegment->Back();
delete Track;
g_TrackSegmentCount--;
delete g_CurrentTrackList.PopBack();
}
}
while( g_TrackSegmentCount && g_CurrentTrackSegment
&& (g_CurrentTrackSegment->Type() == TYPEVIA) )
while( g_CurrentTrackSegment && g_CurrentTrackSegment->Type() == TYPE_VIA )
{
Track = g_CurrentTrackSegment;
g_CurrentTrackSegment = g_CurrentTrackSegment->Back();
delete Track;
g_TrackSegmentCount--;
if( g_CurrentTrackSegment && (g_CurrentTrackSegment->Type() != TYPEVIA) )
delete g_CurrentTrackList.PopBack();
if( g_CurrentTrackSegment && g_CurrentTrackSegment->Type() != TYPE_VIA )
previous_layer = g_CurrentTrackSegment->GetLayer();
}
if( g_CurrentTrackSegment )
g_CurrentTrackSegment->SetNext( NULL );
// Rectification couche active qui a pu changer si une via
// a ete effacee
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = previous_layer;
@ -88,21 +79,20 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* Track )
Affiche_Status_Box();
if( g_TwoSegmentTrackBuild ) // We must have 2 segments or more, or 0
{
if( ( g_TrackSegmentCount == 1 )
&& (g_CurrentTrackSegment->Type() != TYPEVIA) )
if( g_CurrentTrackList.GetCount()==1 && g_CurrentTrackSegment->Type() != TYPE_VIA )
{
delete g_CurrentTrackSegment;
g_TrackSegmentCount = 0;
delete g_CurrentTrackList.PopBack();
}
}
if( g_TrackSegmentCount == 0 )
if( g_CurrentTrackList.GetCount() == 0 )
{
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
if( g_HightLigt_Status )
Hight_Light( DC );
g_CurrentTrackSegment = NULL;
g_FirstTrackSegment = NULL;
SetCurItem( NULL );
return NULL;
}
@ -110,19 +100,19 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* Track )
{
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
return g_CurrentTrackSegment;
}
}
return NULL;
} // Fin traitement si trace en cours
}
current_net_code = Track->GetNet();
current_net_code = aTrack->GetNet();
// redraw the area where the track was
DrawPanel->PostDirtyRect( Track->GetBoundingBox() );
DrawPanel->PostDirtyRect( aTrack->GetBoundingBox() );
SaveItemEfface( Track, 1 );
SaveItemEfface( aTrack, 1 );
GetScreen()->SetModify();
test_1_net_connexion( DC, current_net_code );
@ -132,13 +122,13 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* Track )
/**********************************************************/
void WinEDA_PcbFrame::Delete_Track( wxDC* DC, TRACK* Track )
void WinEDA_PcbFrame::Delete_Track( wxDC* DC, TRACK* aTrack )
/**********************************************************/
{
if( Track != NULL )
if( aTrack != NULL )
{
int current_net_code = Track->GetNet();
Remove_One_Track( DC, Track );
int current_net_code = aTrack->GetNet();
Remove_One_Track( DC, aTrack );
GetScreen()->SetModify();
test_1_net_connexion( DC, current_net_code );
}
@ -146,24 +136,23 @@ void WinEDA_PcbFrame::Delete_Track( wxDC* DC, TRACK* Track )
/********************************************************/
void WinEDA_PcbFrame::Delete_net( wxDC* DC, TRACK* Track )
void WinEDA_PcbFrame::Delete_net( wxDC* DC, TRACK* aTrack )
/********************************************************/
{
if( Track == NULL )
if( aTrack == NULL )
return;
if( IsOK( this, _( "Delete NET ?" ) ) )
{
int net_code_delete = Track->GetNet();
int net_code_delete = aTrack->GetNet();
/* Recherche du debut de la zone des pistes du net_code courant */
TRACK* trackList = m_Pcb->m_Track->GetStartNetCode( net_code_delete );
/* Decompte du nombre de segments de la sous-chaine */
int ii;
TRACK* segm = trackList;
for( ii = 0; segm; segm = segm->Next(), ++ii )
int ii = 0;
for( TRACK* segm = trackList; segm; segm = segm->Next(), ++ii )
{
if( segm->GetNet() != net_code_delete )
break;
@ -188,22 +177,24 @@ void WinEDA_PcbFrame::Remove_One_Track( wxDC* DC, TRACK* pt_segm )
* jusqu'a un pad ou un point de jonction de plus de 2 segments
*/
{
TRACK* trackList;
int nb_segm;
if( pt_segm == NULL )
return;
trackList = Marque_Une_Piste( this, DC, pt_segm, &nb_segm, 0 );
TRACK* trackList = Marque_Une_Piste( this, DC, pt_segm, &nb_segm, 0 );
if( nb_segm ) /* Il y a nb_segm segments de piste a effacer */
{
TRACK* t;
int ii;
for( t = trackList, ii=0; ii<nb_segm; ii++, t = t->Next() )
int ii = 0;
for( TRACK* t = trackList; ii<nb_segm; ii++, t = t->Next() )
{
t->SetState( BUSY, OFF );
D(printf("%s: track %p status=\"%s\"\n", __func__, t,
CONV_TO_UTF8( TRACK::ShowState( t->GetState(-1)) )
);)
DrawPanel->PostDirtyRect( t->GetBoundingBox() );
}

View File

@ -735,7 +735,7 @@ void WinEDA_ModulePropertiesFrame::ReCreateFieldListBox()
EDA_BaseStruct* item = m_CurrentModule->m_Drawings;
while( item )
{
if( item->Type() == TYPETEXTEMODULE )
if( item->Type() == TYPE_TEXTE_MODULE )
m_TextListBox->Append( ( (TEXTE_MODULE*) item )->m_Text );
item = item->Next();
}
@ -789,7 +789,7 @@ void WinEDA_ModulePropertiesFrame::EditOrDelTextModule( wxCommandEvent& event )
int jj = 2;
while( item )
{
if( item->Type() == TYPETEXTEMODULE )
if( item->Type() == TYPE_TEXTE_MODULE )
{
if( jj == TextType ) // Texte trouvé
{

View File

@ -445,8 +445,8 @@ void WinEDA_PcbTracksDialog::AcceptPcbOptions( wxCommandEvent& event )
m_Parent->DisplayTrackSettings();
m_Parent->AddHistory( g_DesignSettings.m_CurrentViaSize, TYPEVIA );
m_Parent->AddHistory( g_DesignSettings.m_CurrentTrackWidth, TYPETRACK );
m_Parent->AddHistory( g_DesignSettings.m_CurrentViaSize, TYPE_VIA );
m_Parent->AddHistory( g_DesignSettings.m_CurrentTrackWidth, TYPE_TRACK );
EndModal( 1 );
}
@ -462,19 +462,19 @@ void WinEDA_BasePcbFrame::AddHistory( int value, KICAD_T type )
switch( type )
{
case TYPETRACK:
case TYPE_TRACK:
for( ii = 0; ii < HISTORY_NUMBER; ii++ )
{
if( g_DesignSettings.m_TrackWidthHistory[ii] == value )
{
addhistory = FALSE;
addhistory = FALSE;
break;
}
}
if( !addhistory )
break;
for( ii = HISTORY_NUMBER-1; ii > 0; ii-- )
{
g_DesignSettings.m_TrackWidthHistory[ii] = g_DesignSettings.m_TrackWidthHistory[ii-1];
@ -487,7 +487,7 @@ void WinEDA_BasePcbFrame::AddHistory( int value, KICAD_T type )
{
if( g_DesignSettings.m_TrackWidthHistory[ii+1] == 0 )
break; // Fin de liste
if( g_DesignSettings.m_TrackWidthHistory[ii] >
g_DesignSettings.m_TrackWidthHistory[ii+1] )
{
@ -498,12 +498,12 @@ void WinEDA_BasePcbFrame::AddHistory( int value, KICAD_T type )
break;
case TYPEVIA:
case TYPE_VIA:
for( ii = 0; ii < HISTORY_NUMBER; ii++ )
{
if( g_DesignSettings.m_ViaSizeHistory[ii] == value )
{
addhistory = FALSE;
addhistory = FALSE;
break;
}
}
@ -523,7 +523,7 @@ void WinEDA_BasePcbFrame::AddHistory( int value, KICAD_T type )
{
if( g_DesignSettings.m_ViaSizeHistory[ii+1] == 0 )
break; // Fin de liste
if( g_DesignSettings.m_ViaSizeHistory[ii] > g_DesignSettings.m_ViaSizeHistory[ii+1] )
{
EXCHG( g_DesignSettings.m_ViaSizeHistory[ii],

View File

@ -198,26 +198,26 @@ void Collect_TrackSegmentsToDrag( WinEDA_DrawPanel* panel, wxDC* DC,
{
BOARD* pcb = ( (WinEDA_BasePcbFrame*) (panel->m_Parent) )->m_Pcb;
TRACK* Track = pcb->m_Track->GetStartNetCode( net_code );
for( ; Track; Track = Track->Next() )
TRACK* track = pcb->m_Track->GetStartNetCode( net_code );
for( ; track; track = track->Next() )
{
if( Track->GetNet() != net_code )
if( track->GetNet() != net_code )
break; /* hors zone */
if( ( MasqueLayer & Track->ReturnMaskLayer() ) == 0 )
if( ( MasqueLayer & track->ReturnMaskLayer() ) == 0 )
continue; /* couches differentes */
if( Track->m_Flags & IS_DRAGGED )
if( track->m_Flags & IS_DRAGGED )
continue; // already in list
if( Track->m_Start == point )
if( track->m_Start == point )
{
AddSegmentToDragList( panel, DC, STARTPOINT, Track );
AddSegmentToDragList( panel, DC, STARTPOINT, track );
}
if( Track->m_End == point )
if( track->m_End == point )
{
AddSegmentToDragList( panel, DC, ENDPOINT, Track );
AddSegmentToDragList( panel, DC, ENDPOINT, track );
}
}
}

View File

@ -145,7 +145,7 @@ int DRC::Drc( TRACK* aRefSegm, TRACK* aList )
{
updatePointers();
if( !doTrackDrc( aRefSegm, aList ) )
if( !doTrackDrc( aRefSegm, aList, true ) )
{
wxASSERT( m_currentMarker );
@ -239,7 +239,7 @@ void DRC::testTracks()
{
for( TRACK* segm = m_pcb->m_Track; segm && segm->Next(); segm=segm->Next() )
{
if( !doTrackDrc( segm, segm->Next() ) )
if( !doTrackDrc( segm, segm->Next(), true ) )
{
wxASSERT( m_currentMarker );
m_pcb->Add( m_currentMarker );
@ -336,29 +336,22 @@ void DRC::testZones(bool adoTestFillSegments)
TRACK* zoneSeg;
/* this was for display purposes, don't know that we need it anymore
m_pcb->m_NbSegmZone = 0;
for( zoneSeg = m_pcb->m_Zone; zoneSeg; zoneSeg = zoneSeg->Next() )
++m_pcb->m_NbSegmZone;
*/
if ( ! adoTestFillSegments ) return;
for( zoneSeg = m_pcb->m_Zone; zoneSeg && zoneSeg->Next(); zoneSeg=zoneSeg->Next() )
if( !adoTestFillSegments )
return;
for( zoneSeg = m_pcb->m_Zone; zoneSeg && zoneSeg->Next(); zoneSeg = zoneSeg->Next() )
{
// Test zoneSeg with other zone segments and with all pads
if( !doTrackDrc( zoneSeg, zoneSeg->Next() ) )
if( !doTrackDrc( zoneSeg, zoneSeg->Next(), true ) )
{
wxASSERT( m_currentMarker );
m_pcb->Add( m_currentMarker );
m_currentMarker = 0;
}
// Test zoneSeg with all track segments
int tmp = m_pcb->m_NbPads;
m_pcb->m_NbPads = 0; // Pads already tested: disable pad test
bool rc = doTrackDrc( zoneSeg, m_pcb->m_Track );
m_pcb->m_NbPads = tmp;
// Pads already tested: disable pad test
bool rc = doTrackDrc( zoneSeg, m_pcb->m_Track, false );
if( !rc )
{
wxASSERT( m_currentMarker );
@ -382,13 +375,13 @@ MARKER* DRC::fillMarker( TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode, MARKE
textB = aItem->MenuText( m_pcb );
posB = aItem->GetPosition();
if( aItem->Type() == TYPEPAD )
if( aItem->Type() == TYPE_PAD )
position = aItem->GetPosition();
else if( aItem->Type() == TYPEVIA )
else if( aItem->Type() == TYPE_VIA )
position = aItem->GetPosition();
else if( aItem->Type() == TYPETRACK )
else if( aItem->Type() == TYPE_TRACK )
{
TRACK* track = (TRACK*) aItem;
wxPoint endPos = track->m_End;
@ -483,7 +476,7 @@ MARKER* DRC::fillMarker( const ZONE_CONTAINER * aArea, const wxPoint & aPos, int
/***********************************************************************/
bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart )
bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
/***********************************************************************/
{
TRACK* track;
@ -508,7 +501,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart )
/* Phase 0 : Test vias : */
if( aRefSeg->Type() == TYPEVIA )
if( aRefSeg->Type() == TYPE_VIA )
{
// test if via's hole is bigger than its diameter
// This test seems necessary since the dialog box that displays the
@ -570,57 +563,61 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart )
// Compute the min distance to pads
w_dist = aRefSeg->m_Width >> 1;
for( int ii=0; ii<m_pcb->m_NbPads; ++ii )
{
D_PAD* pad = m_pcb->m_Pads[ii];
/* No problem if pads are on an other layer,
* But if a drill hole exists (a pad on a single layer can have a hole!)
* we must test the hole
*/
if( (pad->m_Masque_Layer & layerMask ) == 0 )
if( testPads )
{
for( unsigned ii=0; ii<m_pcb->m_Pads.size(); ++ii )
{
/* We must test the pad hole. In order to use the function "checkClearanceSegmToPad",
* a pseudo pad is used, with a shape and a size like the hole
D_PAD* pad = m_pcb->m_Pads[ii];
/* No problem if pads are on an other layer,
* But if a drill hole exists (a pad on a single layer can have a hole!)
* we must test the hole
*/
if( pad->m_Drill.x == 0 )
if( (pad->m_Masque_Layer & layerMask ) == 0 )
{
/* We must test the pad hole. In order to use the function "checkClearanceSegmToPad",
* a pseudo pad is used, with a shape and a size like the hole
*/
if( pad->m_Drill.x == 0 )
continue;
pseudo_pad.m_Size = pad->m_Drill;
pseudo_pad.SetPosition( pad->GetPosition() );
pseudo_pad.m_PadShape = pad->m_DrillShape;
pseudo_pad.m_Orient = pad->m_Orient;
pseudo_pad.ComputeRayon(); // compute the radius
m_spotcx = pseudo_pad.GetPosition().x - org_X;
m_spotcy = pseudo_pad.GetPosition().y - org_Y;
if( !checkClearanceSegmToPad( &pseudo_pad, w_dist,
g_DesignSettings.m_TrackClearence ) )
{
m_currentMarker = fillMarker( aRefSeg, pad,
DRCE_TRACK_NEAR_THROUGH_HOLE, m_currentMarker );
return false;
}
continue;
}
/* The pad must be in a net (i.e pt_pad->GetNet() != 0 )
* but no problem if the pad netcode is the current netcode (same net)
*/
if( pad->GetNet() && // the pad must be connected
net_code_ref == pad->GetNet() ) // the pad net is the same as current net -> Ok
continue;
pseudo_pad.m_Size = pad->m_Drill;
pseudo_pad.SetPosition( pad->GetPosition() );
pseudo_pad.m_PadShape = pad->m_DrillShape;
pseudo_pad.m_Orient = pad->m_Orient;
pseudo_pad.ComputeRayon(); // compute the radius
m_spotcx = pseudo_pad.GetPosition().x - org_X;
m_spotcy = pseudo_pad.GetPosition().y - org_Y;
if( !checkClearanceSegmToPad( &pseudo_pad, w_dist,
g_DesignSettings.m_TrackClearence ) )
// DRC for the pad
shape_pos = pad->ReturnShapePos();
m_spotcx = shape_pos.x - org_X;
m_spotcy = shape_pos.y - org_Y;
if( !checkClearanceSegmToPad( pad, w_dist, g_DesignSettings.m_TrackClearence ) )
{
m_currentMarker = fillMarker( aRefSeg, pad,
DRCE_TRACK_NEAR_THROUGH_HOLE, m_currentMarker );
DRCE_TRACK_NEAR_PAD, m_currentMarker );
return false;
}
continue;
}
/* The pad must be in a net (i.e pt_pad->GetNet() != 0 )
* but no problem if the pad netcode is the current netcode (same net)
*/
if( pad->GetNet() && // the pad must be connected
net_code_ref == pad->GetNet() ) // the pad net is the same as current net -> Ok
continue;
// DRC for the pad
shape_pos = pad->ReturnShapePos();
m_spotcx = shape_pos.x - org_X;
m_spotcy = shape_pos.y - org_Y;
if( !checkClearanceSegmToPad( pad, w_dist, g_DesignSettings.m_TrackClearence ) )
{
m_currentMarker = fillMarker( aRefSeg, pad,
DRCE_TRACK_NEAR_PAD, m_currentMarker );
return false;
}
}
@ -654,7 +651,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart )
w_dist += g_DesignSettings.m_TrackClearence;
// If the reference segment is a via, we test it here
if( aRefSeg->Type() == TYPEVIA )
if( aRefSeg->Type() == TYPE_VIA )
{
int orgx, orgy; // origine du repere d'axe X = segment a comparer
int angle = 0; // angle du segment a tester;
@ -668,7 +665,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart )
x0 = aRefSeg->m_Start.x - orgx;
y0 = aRefSeg->m_Start.y - orgy;
if( track->Type() == TYPEVIA )
if( track->Type() == TYPE_VIA )
{
// Test distance between two vias
if( (int) hypot( x0, y0 ) < w_dist )
@ -710,7 +707,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart )
RotatePoint( &x0, &y0, m_segmAngle );
RotatePoint( &xf, &yf, m_segmAngle );
if( track->Type() == TYPEVIA )
if( track->Type() == TYPE_VIA )
{
if( checkMarginToCircle( x0, y0, w_dist, m_segmLength ) )
continue;

View File

@ -428,10 +428,11 @@ private:
* tests the current segment.
* @param aRefSeg The segment to test
* @param aStart The head of a list of tracks to test against (usually BOARD::m_Track)
* @param doPads true if should do pads test
* @return bool - true if no poblems, else false and m_currentMarker is
* filled in with the problem information.
*/
bool doTrackDrc( TRACK* aRefSeg, TRACK* aStart );
bool doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool doPads = true );
/**
@ -443,7 +444,6 @@ private:
* @param aCornerIndex The first corner of the segment to test.
* @return bool - false if DRC error or true if OK
*/
bool doEdgeZoneDrc( ZONE_CONTAINER * aArea, int aCornerIndex );
//-----<single tests>----------------------------------------------

View File

@ -159,10 +159,10 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Width( EDGE_MODULE* Edge, wxDC* DC )
if( Edge == NULL )
{
Edge = (EDGE_MODULE*) Module->m_Drawings;
Edge = (EDGE_MODULE*)(BOARD_ITEM*) Module->m_Drawings;
for( ; Edge != NULL; Edge = Edge->Next() )
{
if( Edge->Type() != TYPEEDGEMODULE )
if( Edge->Type() != TYPE_EDGE_MODULE )
continue;
Edge->m_Width = ModuleSegmentWidth;
}
@ -209,10 +209,10 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Layer( EDGE_MODULE* Edge, wxDC* DC )
if( Edge == NULL )
{
Edge = (EDGE_MODULE*) Module->m_Drawings;
Edge = (EDGE_MODULE*)(BOARD_ITEM*) Module->m_Drawings;
for( ; Edge != NULL; Edge = Edge->Next() )
{
if( Edge->Type() != TYPEEDGEMODULE )
if( Edge->Type() != TYPE_EDGE_MODULE )
continue;
Edge->SetLayer( new_layer );
}
@ -276,9 +276,9 @@ void WinEDA_ModuleEditFrame::Delete_Edge_Module( EDGE_MODULE* Edge, wxDC* DC )
{
if( Edge == NULL )
return;
if( Edge->Type() != TYPEEDGEMODULE )
if( Edge->Type() != TYPE_EDGE_MODULE )
{
DisplayError( this, wxT( "StructType error: TYPEEDGEMODULE expected" ) );
DisplayError( this, wxT( "StructType error: TYPE_EDGE_MODULE expected" ) );
return;
}
@ -301,7 +301,7 @@ static void Exit_EditEdge_Module( WinEDA_DrawPanel* Panel, wxDC* DC )
{
EDGE_MODULE* Edge = (EDGE_MODULE*) Panel->GetScreen()->GetCurItem();
if( Edge && (Edge->Type() == TYPEEDGEMODULE) ) /* error si non */
if( Edge && (Edge->Type() == TYPE_EDGE_MODULE) ) /* error si non */
{
if( Edge->m_Flags & IS_NEW ) /* effacement du nouveau contour */
{
@ -348,11 +348,7 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
MoveVector.x = MoveVector.y = 0;
/* Add the new item to the Drawings list head*/
Edge->SetBack( Module );
Edge->SetNext( Module->m_Drawings );
if( Module->m_Drawings )
Module->m_Drawings->SetBack( Edge );
Module->m_Drawings = Edge;
Module->m_Drawings.PushFront( Edge );
/* Mise a jour des caracteristiques du segment ou de l'arc */
Edge->m_Flags = IS_NEW;

View File

@ -545,8 +545,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
Fill_All_Zones( &dc );
break;
case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE:
if ( ( GetCurItem())->Type() == TYPEZONE_CONTAINER)
case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE:
if ( ( GetCurItem())->Type() == TYPE_ZONE_CONTAINER)
{
ZONE_CONTAINER* zone_container = (ZONE_CONTAINER* )GetCurItem();
zone_container->m_FilledPolysList.clear();
@ -557,12 +557,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES: // Remove all zones :
if( m_Pcb->m_Zone )
{
m_Pcb->m_Zone->DeleteStructList();
m_Pcb->m_Zone = NULL;
m_Pcb->m_NbSegmZone = 0;
}
m_Pcb->m_Zone.DeleteAll();
for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{
ZONE_CONTAINER* zone_container = m_Pcb->GetArea( ii );
@ -596,9 +591,9 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_MOVE_MODULE_REQUEST:
// If the current Item is a pad, text module ...: Get the parent
if( GetCurItem()->Type() != TYPEMODULE )
if( GetCurItem()->Type() != TYPE_MODULE )
SetCurItem( GetCurItem()->GetParent() );
if( !GetCurItem() || GetCurItem()->Type() != TYPEMODULE )
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
{
g_Drag_Pistes_On = FALSE;
break;
@ -620,10 +615,10 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MouseToCursorSchema();
// If the current Item is a pad, text module ...: Get the parent
if( GetCurItem()->Type() != TYPEMODULE )
if( GetCurItem()->Type() != TYPE_MODULE )
SetCurItem( GetCurItem()->GetParent() );
if( !GetCurItem() || GetCurItem()->Type() != TYPEMODULE )
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
break;
if( Delete_Module( (MODULE*) GetCurItem(), &dc, true ) )
{
@ -635,10 +630,10 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MouseToCursorSchema();
// If the current Item is a pad, text module ...: Get the parent
if( GetCurItem()->Type() != TYPEMODULE )
if( GetCurItem()->Type() != TYPE_MODULE )
SetCurItem( GetCurItem()->GetParent() );
if( !GetCurItem() || GetCurItem()->Type() != TYPEMODULE )
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
break;
Rotate_Module( &dc, (MODULE*) GetCurItem(), -900, TRUE );
break;
@ -647,10 +642,10 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MouseToCursorSchema();
// If the current Item is a pad, text module ...: Get the parent
if( GetCurItem()->Type() != TYPEMODULE )
if( GetCurItem()->Type() != TYPE_MODULE )
SetCurItem( GetCurItem()->GetParent() );
if( !GetCurItem() || GetCurItem()->Type() != TYPEMODULE )
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
break;
Rotate_Module( &dc, (MODULE*) GetCurItem(), 900, TRUE );
break;
@ -659,9 +654,9 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MouseToCursorSchema();
// If the current Item is a pad, text module ...: Get the parent
if( GetCurItem()->Type() != TYPEMODULE )
if( GetCurItem()->Type() != TYPE_MODULE )
SetCurItem( GetCurItem()->GetParent() );
if( !GetCurItem() || GetCurItem()->Type() != TYPEMODULE )
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
break;
m_Pcb->Change_Side_Module( (MODULE*) GetCurItem(), &dc );
break;
@ -669,9 +664,9 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_EDIT_MODULE:
// If the current Item is a pad, text module ...: Get the parent
if( GetCurItem()->Type() != TYPEMODULE )
if( GetCurItem()->Type() != TYPE_MODULE )
SetCurItem( GetCurItem()->GetParent() );
if( !GetCurItem() || GetCurItem()->Type() != TYPEMODULE )
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
break;
InstallModuleOptionsFrame( (MODULE*) GetCurItem(), &dc, pos );
DrawPanel->MouseToCursorSchema();
@ -1031,7 +1026,7 @@ static void Process_Move_Item( WinEDA_PcbFrame* frame,
switch( DrawStruct->Type() )
{
case TYPETEXTE:
case TYPE_TEXTE:
frame->StartMoveTextePcb( (TEXTE_PCB*) DrawStruct, DC );
break;
@ -1055,39 +1050,39 @@ void WinEDA_PcbFrame::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
switch( Item->Type() )
{
case TYPEMODULE:
case TYPE_MODULE:
Delete_Module( (MODULE*) Item, DC, true );
break;
case TYPECOTATION:
case TYPE_COTATION:
Delete_Cotation( (COTATION*) Item, DC );
break;
case TYPEMIRE:
case TYPE_MIRE:
Delete_Mire( (MIREPCB*) Item, DC );
break;
case TYPEDRAWSEGMENT:
case TYPE_DRAWSEGMENT:
Delete_Segment_Edge( (DRAWSEGMENT*) Item, DC );
break;
case TYPETEXTE:
case TYPE_TEXTE:
Delete_Texte_Pcb( (TEXTE_PCB*) Item, DC );
break;
case TYPETRACK:
case TYPE_TRACK:
Delete_Track( DC, (TRACK*) Item );
break;
case TYPEVIA:
case TYPE_VIA:
Delete_Segment( DC, (TRACK*) Item );
break;
case TYPEZONE:
case TYPE_ZONE:
Delete_Zone_Fill( DC, (SEGZONE*) Item );
break;
case TYPEMARKER:
case TYPE_MARKER:
if( Item == GetCurItem() )
SetCurItem( NULL );
( (MARKER*) Item )->Draw( DrawPanel, DC, GR_XOR );
@ -1096,14 +1091,14 @@ void WinEDA_PcbFrame::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
m_Pcb->Delete( Item );
break;
case TYPEPAD:
case TYPETEXTEMODULE:
case TYPEEDGEMODULE:
case TYPE_PAD:
case TYPE_TEXTE_MODULE:
case TYPE_EDGE_MODULE:
break;
case TYPE_NOT_INIT:
case PCB_EQUIPOT_STRUCT_TYPE:
case TYPEPCB:
case TYPE_EQUIPOT:
case TYPE_PCB:
default:
{
wxString Line;
@ -1168,7 +1163,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
// See if we are drawing a segment; if so, add a via?
if( m_ID_current_state == ID_TRACK_BUTT && current != NULL )
{
if( current->Type() == TYPETRACK && (current->m_Flags & IS_NEW) )
if( current->Type() == TYPE_TRACK && (current->m_Flags & IS_NEW) )
{
// Want to set the routing layers so that it switches properly -
// see the implementation of Other_Layer_Route - the working

View File

@ -31,7 +31,7 @@ int WinEDA_PcbFrame::Edit_TrackSegm_Width( wxDC* DC, TRACK* pt_segm )
/* Test DRC and width change */
old_w = pt_segm->m_Width;
consigne = pt_segm->m_Width = g_DesignSettings.m_CurrentTrackWidth;
if( pt_segm->Type() == TYPEVIA )
if( pt_segm->Type() == TYPE_VIA )
{
consigne = pt_segm->m_Width = g_DesignSettings.m_CurrentViaSize;
if ( pt_segm->m_Shape == VIA_MICROVIA )
@ -144,7 +144,7 @@ bool WinEDA_PcbFrame::Resize_Pistes_Vias( wxDC* DC, bool Track, bool Via )
pt_segm = m_Pcb->m_Track;
for( ; pt_segm != NULL; pt_segm = pt_segm->Next() )
{
if( pt_segm->Type() == TYPEVIA ) /* mise a jour du diametre de la via */
if( pt_segm->Type() == TYPE_VIA ) /* mise a jour du diametre de la via */
{
if( Via )
{

View File

@ -110,7 +110,7 @@ void WinEDA_PcbFrame::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
Segment->Draw( DrawPanel, DC, GR_XOR );
PtStruct = Segment->Back();
Segment ->DeleteStructure();
if( PtStruct && (PtStruct->Type() == TYPEDRAWSEGMENT ) )
if( PtStruct && (PtStruct->Type() == TYPE_DRAWSEGMENT ) )
Segment = (DRAWSEGMENT*) PtStruct;
DisplayOpt.DisplayDrawItems = track_fill_copy;
SetCurItem( NULL );
@ -181,9 +181,9 @@ void WinEDA_PcbFrame::Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC
switch( item->Type() )
{
case TYPEDRAWSEGMENT:
case TYPETEXTE:
case TYPECOTATION:
case TYPE_DRAWSEGMENT:
case TYPE_TEXTE:
case TYPE_COTATION:
if( item->GetLayer() == layer )
{
item->Draw( DrawPanel, DC, GR_XOR );
@ -265,16 +265,12 @@ DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment,
else /* trace en cours : les coord du point d'arrivee ont ete mises
* a jour par la routine Montre_Position_NewSegment*/
{
if( (Segment->m_Start.x != Segment->m_End.x )
|| (Segment->m_Start.y != Segment->m_End.y ) )
if( Segment->m_Start != Segment->m_End )
{
if( Segment->m_Shape == S_SEGMENT )
{
Segment->SetNext( m_Pcb->m_Drawings );
Segment->SetBack( m_Pcb );
if( m_Pcb->m_Drawings )
m_Pcb->m_Drawings->SetBack( Segment );
m_Pcb->m_Drawings = Segment;
m_Pcb->Add( Segment );
GetScreen()->SetModify();
Segment->m_Flags = 0;
@ -320,11 +316,9 @@ void WinEDA_PcbFrame::End_Edge( DRAWSEGMENT* Segment, wxDC* DC )
else
{
Segment->m_Flags = 0;
Segment->SetNext( m_Pcb->m_Drawings );
Segment->SetBack( m_Pcb );
if( m_Pcb->m_Drawings )
m_Pcb->m_Drawings->SetBack( Segment );
m_Pcb->m_Drawings = Segment;
m_Pcb->Add( Segment );
GetScreen()->SetModify();
}

View File

@ -101,14 +101,14 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod, wxDC* DC )
{
switch( PtStruct->Type() )
{
case TYPEEDGEMODULE:
case TYPE_EDGE_MODULE:
#undef STRUCT
#define STRUCT ( (EDGE_MODULE*) PtStruct )
STRUCT->m_Start0.x += deltaX; STRUCT->m_Start0.y += deltaY;
STRUCT->m_End0.x += deltaX; STRUCT->m_End0.y += deltaY;
break;
case TYPETEXTEMODULE:
case TYPE_TEXTE_MODULE:
#undef STRUCT
#define STRUCT ( (TEXTE_MODULE*) PtStruct )
STRUCT->m_Pos0.x += deltaX; STRUCT->m_Pos0.y += deltaY;
@ -133,11 +133,11 @@ void WinEDA_ModuleEditFrame::RemoveStruct( EDA_BaseStruct* Item, wxDC* DC )
switch( Item->Type() )
{
case TYPEPAD:
case TYPE_PAD:
DeletePad( (D_PAD*) Item, DC );
break;
case TYPETEXTEMODULE:
case TYPE_TEXTE_MODULE:
{
TEXTE_MODULE* text = (TEXTE_MODULE*) Item;
if( text->m_Type == TEXT_is_REFERENCE )
@ -154,11 +154,11 @@ void WinEDA_ModuleEditFrame::RemoveStruct( EDA_BaseStruct* Item, wxDC* DC )
}
break;
case TYPEEDGEMODULE:
case TYPE_EDGE_MODULE:
Delete_Edge_Module( (EDGE_MODULE*) Item, DC );
break;
case TYPEMODULE:
case TYPE_MODULE:
break;
default:

View File

@ -93,7 +93,7 @@ void WinEDA_PcbFrame::ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC )
TRACK* pt_track;
int l1, l2, nb_segm;
if( (pt_segm == NULL ) || ( pt_segm->Type() == TYPEZONE ) )
if( (pt_segm == NULL ) || ( pt_segm->Type() == TYPE_ZONE ) )
{
return;
}
@ -114,7 +114,7 @@ void WinEDA_PcbFrame::ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC )
ii = 0; pt_segm = pt_track;
for( ; ii < nb_segm; ii++, pt_segm = (TRACK*) pt_segm->Next() )
{
if( pt_segm->Type() == TYPEVIA )
if( pt_segm->Type() == TYPE_VIA )
continue;
/* inversion des couches */
@ -127,7 +127,7 @@ void WinEDA_PcbFrame::ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC )
{
/* Annulation du changement */
ii = 0; pt_segm = pt_track;
for( ; ii < nb_segm; ii++, pt_segm = (TRACK*) pt_segm->Next() )
for( ; ii < nb_segm; ii++, pt_segm = pt_segm->Next() )
{
pt_segm->SetLayer( pt_segm->m_Param );
}
@ -141,7 +141,7 @@ void WinEDA_PcbFrame::ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC )
Trace_Une_Piste( DrawPanel, DC, pt_track, nb_segm, GR_OR | GR_SURBRILL );
/* controle des extremites de segments: sont-ils sur un pad */
ii = 0; pt_segm = pt_track;
for( ; ii < nb_segm; pt_segm = (TRACK*) pt_segm->Next(), ii++ )
for( ; ii < nb_segm; pt_segm = pt_segm->Next(), ii++ )
{
pt_segm->start = Locate_Pad_Connecte( m_Pcb, pt_segm, START );
pt_segm->end = Locate_Pad_Connecte( m_Pcb, pt_segm, END );
@ -155,20 +155,18 @@ void WinEDA_PcbFrame::ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC )
/****************************************************************/
bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC )
bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
/****************************************************************/
{
TRACK* pt_segm;
SEGVIA* Via;
int ii;
int itmp;
unsigned itmp;
if( track == NULL )
if( aTrack == NULL )
{
if( ((PCB_SCREEN*)GetScreen())->m_Active_Layer != ((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP )
((PCB_SCREEN*)GetScreen())->m_Active_Layer = ((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP;
else
((PCB_SCREEN*)GetScreen())->m_Active_Layer = ((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM;
Affiche_Status_Box();
SetToolbars();
return true;
@ -178,11 +176,9 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC )
if( Locate_Via( m_Pcb, g_CurrentTrackSegment->m_End, g_CurrentTrackSegment->GetLayer() ) )
return false;
pt_segm = g_FirstTrackSegment;
for( ii = 0; ii < g_TrackSegmentCount - 1; ii++, pt_segm = (TRACK*) pt_segm->Next() )
for( TRACK* segm = g_FirstTrackSegment; segm; segm = segm->Next() )
{
if( (pt_segm->Type() == TYPEVIA)
&& (g_CurrentTrackSegment->m_End == pt_segm->m_Start) )
if( segm->Type()==TYPE_VIA && g_CurrentTrackSegment->m_End==segm->m_Start )
return false;
}
@ -200,20 +196,21 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC )
}
}
/* Saving current state before placing a via.
* If the via canot be placed this current state will be reused */
itmp = g_TrackSegmentCount;
/* Save current state before placing a via.
* If the via canot be placed this current state will be reused
*/
itmp = g_CurrentTrackList.GetCount();
Begin_Route( g_CurrentTrackSegment, DC );
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
/* create the via */
Via = new SEGVIA( m_Pcb );
Via->m_Flags = IS_NEW;
Via->m_Shape = g_DesignSettings.m_CurrentViaType;
Via->m_Width = g_DesignSettings.m_CurrentViaSize;
Via->SetNet( g_HightLigth_NetCode );
Via->m_Start = Via->m_End = g_CurrentTrackSegment->m_End;
SEGVIA* via = new SEGVIA( m_Pcb );
via->m_Flags = IS_NEW;
via->m_Shape = g_DesignSettings.m_CurrentViaType;
via->m_Width = g_DesignSettings.m_CurrentViaSize;
via->SetNet( g_HightLigth_NetCode );
via->m_Start = via->m_End = g_CurrentTrackSegment->m_End;
int old_layer = ((PCB_SCREEN*)GetScreen())->m_Active_Layer;
//swap the layers.
@ -223,10 +220,10 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC )
((PCB_SCREEN*)GetScreen())->m_Active_Layer = ((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM;
/* Adjust the via layer pair */
switch ( Via->Shape() )
switch ( via->Shape() )
{
case VIA_BLIND_BURIED:
Via->SetLayerPair( old_layer, ((PCB_SCREEN*)GetScreen())->m_Active_Layer );
via->SetLayerPair( old_layer, ((PCB_SCREEN*)GetScreen())->m_Active_Layer );
break;
case VIA_MICROVIA: // from external to the near neghbour inner layer
@ -239,27 +236,27 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC )
else if ( old_layer == m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 )
((PCB_SCREEN*)GetScreen())->m_Active_Layer = LAYER_CMP_N;
// else error
Via->SetLayerPair( old_layer, ((PCB_SCREEN*)GetScreen())->m_Active_Layer );
Via->m_Width = g_DesignSettings.m_CurrentMicroViaSize;
via->SetLayerPair( old_layer, ((PCB_SCREEN*)GetScreen())->m_Active_Layer );
via->m_Width = g_DesignSettings.m_CurrentMicroViaSize;
break;
default:
// Usual via is from copper to component; layer pair is 0 and 0x0F.
Via->SetLayerPair( COPPER_LAYER_N, LAYER_CMP_N );
via->SetLayerPair( COPPER_LAYER_N, LAYER_CMP_N );
break;
}
if( Drc_On && BAD_DRC==m_drc->Drc( Via, m_Pcb->m_Track ) )
if( Drc_On && BAD_DRC==m_drc->Drc( via, m_Pcb->m_Track ) )
{
/* DRC fault: the Via cannot be placed here ... */
delete Via;
delete via;
((PCB_SCREEN*)GetScreen())->m_Active_Layer = old_layer;
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
// delete the track(s) added in Begin_Route()
while( g_TrackSegmentCount > itmp )
while( g_CurrentTrackList.GetCount() > itmp )
{
Delete_Segment( DC, g_CurrentTrackSegment );
}
@ -272,51 +269,45 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC )
return false;
}
TRACK* lastNonVia = g_CurrentTrackSegment;
/* A new via was created. It was Ok.
* Put it in linked list, after the g_CurrentTrackSegment */
Via->SetBack( g_CurrentTrackSegment );
g_CurrentTrackSegment->SetNext( Via );
g_TrackSegmentCount++;
/* The g_CurrentTrackSegment is now in linked list and we need a new track segment
* after the via, starting at via location.
* it will become the new curren segment (from via to the mouse cursor)
*/
g_CurrentTrackSegment = g_CurrentTrackSegment->Copy(); /* create a new segment
* from the last entered segment, with the current width, flags, netcode, etc... values
* layer, start and end point are not correct, and will be modified next */
g_CurrentTrackList.PushBack( via );
g_CurrentTrackSegment->SetLayer( ((PCB_SCREEN*)GetScreen())->m_Active_Layer ); // set the layer to the new value
/* The via is now in linked list and we need a new track segment
* after the via, starting at via location.
* it will become the new current segment (from via to the mouse cursor)
*/
TRACK* track = lastNonVia->Copy();
/* the above creates a new segment from the last entered segment, with the
* current width, flags, netcode, etc... values.
* layer, start and end point are not correct,
* and will be modified next
*/
track->SetLayer( ((PCB_SCREEN*)GetScreen())->m_Active_Layer ); // set the layer to the new value
/* the start point is the via position,
* and the end point is the cursor which also is on the via (will change when moving mouse)
* and the end point is the cursor which also is on the via (will change when moving mouse)
*/
g_CurrentTrackSegment->m_Start = g_CurrentTrackSegment->m_End = Via->m_Start;
track->m_Start = track->m_End = via->m_Start;
g_TrackSegmentCount++;
g_CurrentTrackSegment->SetBack( Via );
Via->SetNext( g_CurrentTrackSegment );
g_CurrentTrackList.PushBack( track );
if( g_TwoSegmentTrackBuild )
{
// Create a second segment (we must have 2 track segments to adjust)
TRACK* track = g_CurrentTrackSegment;
g_CurrentTrackSegment = track->Copy();
g_TrackSegmentCount++;
g_CurrentTrackSegment->SetBack( track );
track->SetNext( g_CurrentTrackSegment );
g_CurrentTrackList.PushBack( g_CurrentTrackSegment->Copy() );
}
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
Via->Display_Infos( this );
via->Display_Infos( this );
Affiche_Status_Box();
D(printf("Other_Layer_Route\n");)
SetToolbars();
return true;
@ -368,7 +359,7 @@ void WinEDA_PcbFrame::Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC )
if( item )
{
if( item->Type() == TYPEPAD )
if( item->Type() == TYPE_PAD )
{
pt_pad = (D_PAD*) item;
Module = (MODULE*) pt_pad->GetParent();
@ -400,12 +391,12 @@ void WinEDA_PcbFrame::Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC )
}
else
{
if( item->Type() == TYPETEXTEMODULE )
if( item->Type() == TYPE_TEXTE_MODULE )
{
if( item->GetParent() && (item->GetParent()->Type() == TYPEMODULE) )
if( item->GetParent() && (item->GetParent()->Type() == TYPE_MODULE) )
Module = (MODULE*) item->GetParent();
}
else if( item->Type() == TYPEMODULE )
else if( item->Type() == TYPE_MODULE )
{
Module = (MODULE*) item;
}

View File

@ -21,7 +21,8 @@ static void Exit_Editrack( WinEDA_DrawPanel* panel, wxDC* DC );
void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel,
wxDC* DC, bool erase );
static void ComputeBreakPoint( TRACK* track, int n, wxPoint end );
static TRACK* DeleteNullTrackSegments( BOARD* pcb, TRACK* track, int* segmcount );
static void DeleteNullTrackSegments( BOARD* pcb, DLIST<TRACK>& aTrackList );
static void EnsureEndTrackOnPad( D_PAD* Pad );
/* variables locales */
@ -40,7 +41,7 @@ static void Exit_Editrack( WinEDA_DrawPanel* Panel, wxDC* DC )
WinEDA_PcbFrame* frame = (WinEDA_PcbFrame*) Panel->m_Parent;
TRACK* track = (TRACK*) frame->GetCurItem();
if( track && ( track->Type()==TYPEVIA || track->Type()==TYPETRACK ) )
if( track && ( track->Type()==TYPE_VIA || track->Type()==TYPE_TRACK ) )
{
/* Erase the current drawing */
ShowNewTrackWhenMovingCursor( Panel, DC, FALSE );
@ -54,12 +55,7 @@ static void Exit_Editrack( WinEDA_DrawPanel* Panel, wxDC* DC )
frame->MsgPanel->EraseMsgBox();
// Delete current (new) track
TRACK* previoustrack;
for( ; track; track = previoustrack )
{
previoustrack = track->Back();
delete track;
}
g_CurrentTrackList.DeleteAll();
}
Panel->ManageCurseur = NULL;
@ -69,7 +65,7 @@ static void Exit_Editrack( WinEDA_DrawPanel* Panel, wxDC* DC )
/*************************************************************/
TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC )
TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
/*************************************************************/
/*
@ -87,18 +83,21 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC )
*/
{
D_PAD* pt_pad = NULL;
TRACK* TrackOnStartPoint = NULL, * Track;
TRACK* TrackOnStartPoint = NULL;
int masquelayer = g_TabOneLayerMask[((PCB_SCREEN*)GetScreen())->m_Active_Layer];
EDA_BaseStruct* LockPoint;
wxPoint pos = GetScreen()->m_Curseur;
static int InitialTrackWidthValue; /* first track segment width.
* used when we are in the auto tack width mode */
DrawPanel->ManageCurseur = ShowNewTrackWhenMovingCursor;
DrawPanel->ForceCloseManageCurseur = Exit_Editrack;
if( track == NULL ) /* Starting a new track */
if( aTrack == NULL ) /* Starting a new track */
{
D(printf("Begin_Route NULL\n");)
/* erase old highlight */
OldNetCodeSurbrillance = g_HightLigth_NetCode;
OldEtatSurbrillance = g_HightLigt_Status;
@ -107,17 +106,18 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC )
Hight_Light( DC );
InitialTrackWidthValue = -1; // Set to "no value"
g_FirstTrackSegment = g_CurrentTrackSegment = new TRACK( m_Pcb );
g_CurrentTrackList.PushBack( new TRACK( m_Pcb ) );
g_CurrentTrackSegment->m_Flags = IS_NEW;
g_TrackSegmentCount = 1;
g_HightLigth_NetCode = 0;
/* Search for a pad at starting point of the new track: */
// Search for a starting point of the new track, a track or pad
LockPoint = LocateLockPoint( m_Pcb, pos, masquelayer );
if( LockPoint ) // An item (pad or track) is found
{
if( LockPoint->Type() == TYPEPAD )
if( LockPoint->Type() == TYPE_PAD )
{
pt_pad = (D_PAD*) LockPoint;
@ -135,28 +135,39 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC )
else // no starting point, but a filled zone area can exist. This is also a good starting point.
{
ZONE_CONTAINER* zone = m_Pcb->HitTestForAnyFilledArea(pos, GetScreen()->m_Active_Layer );
if ( zone )
ZONE_CONTAINER* zone = m_Pcb->HitTestForAnyFilledArea( pos, GetScreen()->m_Active_Layer );
if( zone )
g_HightLigth_NetCode = zone->GetNet();
}
D( g_CurrentTrackList.VerifyListIntegrity(); );
build_ratsnest_pad( LockPoint, wxPoint( 0, 0 ), TRUE );
D( g_CurrentTrackList.VerifyListIntegrity(); );
Hight_Light( DC );
/* done above
g_CurrentTrackSegment->m_Flags = IS_NEW;
*/
g_CurrentTrackSegment->SetLayer( ((PCB_SCREEN*)GetScreen())->m_Active_Layer );
g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth;
if( g_DesignSettings.m_UseConnectedTrackWidth )
{
if( TrackOnStartPoint && TrackOnStartPoint->Type() == TYPETRACK )
if( TrackOnStartPoint && TrackOnStartPoint->Type() == TYPE_TRACK )
{
InitialTrackWidthValue = TrackOnStartPoint->m_Width;
g_CurrentTrackSegment->m_Width = InitialTrackWidthValue;
}
}
g_CurrentTrackSegment->m_Start = pos;
g_CurrentTrackSegment->m_End = g_CurrentTrackSegment->m_Start;
g_CurrentTrackSegment->m_End = pos;
g_CurrentTrackSegment->SetNet( g_HightLigth_NetCode );
if( pt_pad )
{
g_CurrentTrackSegment->start = pt_pad;
@ -167,15 +178,19 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC )
if( g_TwoSegmentTrackBuild )
{
// Create 2 segments
g_CurrentTrackSegment = g_CurrentTrackSegment->Copy();
g_TrackSegmentCount++;
g_CurrentTrackSegment->SetBack( g_FirstTrackSegment );
g_FirstTrackSegment->SetNext( g_CurrentTrackSegment );
// Create 2nd segment
g_CurrentTrackList.PushBack( g_CurrentTrackSegment->Copy() );
D( g_CurrentTrackList.VerifyListIntegrity(); );
g_CurrentTrackSegment->start = g_FirstTrackSegment;
g_FirstTrackSegment->end = g_CurrentTrackSegment;
g_FirstTrackSegment->end = g_CurrentTrackSegment;
g_FirstTrackSegment->SetState( BEGIN_ONPAD | END_ONPAD, OFF );
}
D( g_CurrentTrackList.VerifyListIntegrity(); );
g_CurrentTrackSegment->Display_Infos( this );
SetCurItem( g_CurrentTrackSegment );
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
@ -190,14 +205,16 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC )
}
else /* Track in progress : segment coordinates are updated by ShowNewTrackWhenMovingCursor*/
{
D(printf("Begin_Route in progress\n");)
/* Tst for a D.R.C. error: */
if( Drc_On )
{
if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, m_Pcb->m_Track ) )
return NULL;
if( g_TwoSegmentTrackBuild // We must handle 2 segments
&& g_CurrentTrackSegment->Back() )
// We must handle 2 segments
if( g_TwoSegmentTrackBuild && g_CurrentTrackSegment->Back() )
{
if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment->Back(), m_Pcb->m_Track ) )
return NULL;
@ -205,45 +222,59 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC )
}
/* Current track is Ok: current segment is kept, and a new one is created
* unless the current segment is null, or 2 last are null if a 2 segments track build
* unless the current segment is null, or 2 last are null if a 2 segments track build
*/
bool CanCreateNewSegment = TRUE;
if( !g_TwoSegmentTrackBuild && g_CurrentTrackSegment->IsNull() )
CanCreateNewSegment = FALSE;
if( g_TwoSegmentTrackBuild && g_CurrentTrackSegment->IsNull()
&& g_CurrentTrackSegment->Back() && g_CurrentTrackSegment->Back()->IsNull() )
CanCreateNewSegment = FALSE;
if( CanCreateNewSegment )
{
/* Erase old track on screen */
D( g_CurrentTrackList.VerifyListIntegrity(); );
ShowNewTrackWhenMovingCursor( DrawPanel, DC, FALSE );
D( g_CurrentTrackList.VerifyListIntegrity(); );
if( g_Raccord_45_Auto )
{
if( Add_45_degrees_Segment( DC, g_CurrentTrackSegment ) != 0 )
g_TrackSegmentCount++;
Add_45_degrees_Segment( DC );
}
Track = g_CurrentTrackSegment->Copy();
Track->Insert( m_Pcb, g_CurrentTrackSegment );
Track->SetState( BEGIN_ONPAD | END_ONPAD, OFF );
g_CurrentTrackSegment->end = Locate_Pad_Connecte( m_Pcb, g_CurrentTrackSegment, END );
if( g_CurrentTrackSegment->end )
TRACK* oneBeforeLatest = g_CurrentTrackSegment;
TRACK* newTrack = g_CurrentTrackSegment->Copy();
g_CurrentTrackList.PushBack( newTrack );
newTrack->m_Flags = IS_NEW;
newTrack->SetState( BEGIN_ONPAD | END_ONPAD, OFF );
oneBeforeLatest->end = Locate_Pad_Connecte( m_Pcb, oneBeforeLatest, END );
if( oneBeforeLatest->end )
{
g_CurrentTrackSegment->SetState( END_ONPAD, ON );
Track->SetState( BEGIN_ONPAD, ON );
oneBeforeLatest->SetState( END_ONPAD, ON );
newTrack->SetState( BEGIN_ONPAD, ON );
}
Track->start = g_CurrentTrackSegment->end;
newTrack->start = oneBeforeLatest->end;
D( g_CurrentTrackList.VerifyListIntegrity(); );
newTrack->m_Start = newTrack->m_End;
newTrack->SetLayer( ((PCB_SCREEN*)GetScreen())->m_Active_Layer );
g_CurrentTrackSegment = Track;
g_CurrentTrackSegment->m_Flags = IS_NEW;
g_TrackSegmentCount++;
g_CurrentTrackSegment->m_Start = g_CurrentTrackSegment->m_End;
g_CurrentTrackSegment->SetLayer( ((PCB_SCREEN*)GetScreen())->m_Active_Layer );
if( !g_DesignSettings.m_UseConnectedTrackWidth )
{
g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth;
newTrack->m_Width = g_DesignSettings.m_CurrentTrackWidth;
}
D( g_CurrentTrackList.VerifyListIntegrity(); );
/* Show the new position */
ShowNewTrackWhenMovingCursor( DrawPanel, DC, FALSE );
}
@ -256,7 +287,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC )
/**************************************************************************/
int WinEDA_PcbFrame::Add_45_degrees_Segment( wxDC* DC, TRACK* pt_segm )
bool WinEDA_PcbFrame::Add_45_degrees_Segment( wxDC* DC )
/***************************************************************************/
/* rectifie un virage a 90 et le modifie par 2 coudes a 45
@ -270,57 +301,54 @@ int WinEDA_PcbFrame::Add_45_degrees_Segment( wxDC* DC, TRACK* pt_segm )
* 0 si impossible
*/
{
TRACK* Previous;
TRACK* NewTrack;
int pas_45;
int dx0, dy0, dx1, dy1;
if( g_TrackSegmentCount < 2 )
return 0; /* il faut au moins 2 segments */
if( g_CurrentTrackList.GetCount() < 2 )
return false; /* il faut au moins 2 segments */
Previous = pt_segm->Back(); // pointe le segment precedent
TRACK* curTrack = g_CurrentTrackSegment;
TRACK* prevTrack = curTrack->Back();
// Test s'il y a 2 segments consecutifs a raccorder
if( (pt_segm->Type() != TYPETRACK )
|| (Previous->Type() != TYPETRACK) )
if( curTrack->Type() != TYPE_TRACK || prevTrack->Type() != TYPE_TRACK )
{
return 0;
return false;
}
pas_45 = GetScreen()->GetGrid().x / 2;
if( pas_45 < pt_segm->m_Width )
if( pas_45 < curTrack->m_Width )
pas_45 = GetScreen()->GetGrid().x;
while( pas_45 < pt_segm->m_Width )
while( pas_45 < curTrack->m_Width )
pas_45 *= 2;
// OK : tst si les segments sont a 90 degre et vertic ou horiz
dx0 = Previous->m_End.x - Previous->m_Start.x;
dy0 = Previous->m_End.y - Previous->m_Start.y;
dx1 = pt_segm->m_End.x - pt_segm->m_Start.x;
dy1 = pt_segm->m_End.y - pt_segm->m_Start.y;
dx0 = prevTrack->m_End.x - prevTrack->m_Start.x;
dy0 = prevTrack->m_End.y - prevTrack->m_Start.y;
dx1 = curTrack->m_End.x - curTrack->m_Start.x;
dy1 = curTrack->m_End.y - curTrack->m_Start.y;
// les segments doivent etre de longueur suffisante:
if( MAX( abs( dx0 ), abs( dy0 ) ) < (pas_45 * 2) )
return 0;
return false;
if( MAX( abs( dx1 ), abs( dy1 ) ) < (pas_45 * 2) )
return 0;
return false;
/* creation du nouveau segment, raccordant des 2 segm: */
NewTrack = pt_segm->Copy();
TRACK* newTrack = curTrack->Copy();
NewTrack->m_Start.x = Previous->m_End.x;
NewTrack->m_Start.y = Previous->m_End.y;
NewTrack->m_End.x = pt_segm->m_Start.x;
NewTrack->m_End.y = pt_segm->m_Start.y;
newTrack->m_Start = prevTrack->m_End;
newTrack->m_End = curTrack->m_Start;
if( dx0 == 0 ) // Segment precedent Vertical
{
if( dy1 != 0 ) // les 2 segments ne sont pas a 90 ;
{
delete NewTrack;
return 0;
delete newTrack;
return false;
}
/* Calcul des coordonnees du point de raccord :
@ -328,33 +356,34 @@ int WinEDA_PcbFrame::Add_45_degrees_Segment( wxDC* DC, TRACK* pt_segm )
* au 2eme segment Horizontal */
if( dy0 > 0 )
NewTrack->m_Start.y -= pas_45;
newTrack->m_Start.y -= pas_45;
else
NewTrack->m_Start.y += pas_45;
newTrack->m_Start.y += pas_45;
if( dx1 > 0 )
NewTrack->m_End.x += pas_45;
newTrack->m_End.x += pas_45;
else
NewTrack->m_End.x -= pas_45;
newTrack->m_End.x -= pas_45;
if( Drc_On && BAD_DRC==m_drc->Drc( pt_segm, m_Pcb->m_Track ) )
if( Drc_On && BAD_DRC==m_drc->Drc( curTrack, m_Pcb->m_Track ) )
{
delete NewTrack;
return 0;
delete newTrack;
return false;
}
Previous->m_End = NewTrack->m_Start;
pt_segm->m_Start = NewTrack->m_End;
NewTrack->Insert( m_Pcb, Previous );
return 1;
prevTrack->m_End = newTrack->m_Start;
curTrack->m_Start = newTrack->m_End;
g_CurrentTrackList.Insert( newTrack, curTrack );
return true;
}
if( dy0 == 0 ) // Segment precedent Horizontal : dy0 = 0
{
if( dx1 != 0 ) // les 2 segments ne sont pas a 90 ;
{
delete NewTrack;
return 0;
delete newTrack;
return false;
}
// Segments a 90
@ -364,67 +393,69 @@ int WinEDA_PcbFrame::Add_45_degrees_Segment( wxDC* DC, TRACK* pt_segm )
* au 2eme segment Vertical */
if( dx0 > 0 )
NewTrack->m_Start.x -= pas_45;
newTrack->m_Start.x -= pas_45;
else
NewTrack->m_Start.x += pas_45;
newTrack->m_Start.x += pas_45;
if( dy1 > 0 )
NewTrack->m_End.y += pas_45;
newTrack->m_End.y += pas_45;
else
NewTrack->m_End.y -= pas_45;
newTrack->m_End.y -= pas_45;
if( Drc_On && BAD_DRC==m_drc->Drc( NewTrack, m_Pcb->m_Track ) )
if( Drc_On && BAD_DRC==m_drc->Drc( newTrack, m_Pcb->m_Track ) )
{
delete NewTrack;
return 0;
delete newTrack;
return false;
}
Previous->m_End = NewTrack->m_Start;
pt_segm->m_Start = NewTrack->m_End;
NewTrack->Insert( m_Pcb, Previous );
return 1;
prevTrack->m_End = newTrack->m_Start;
curTrack->m_Start = newTrack->m_End;
g_CurrentTrackList.Insert( newTrack, curTrack );
return true;
}
return 0;
return false;
}
/**************************************************************/
void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC )
void WinEDA_PcbFrame::End_Route( TRACK* aTrack, wxDC* DC )
/*************************************************************/
/*
* Routine de fin de trace d'une piste (succession de segments)
*/
{
int masquelayer = g_TabOneLayerMask[((PCB_SCREEN*)GetScreen())->m_Active_Layer];
wxPoint pos;
EDA_BaseStruct* LockPoint;
TRACK* adr_buf;
int masquelayer = g_TabOneLayerMask[((PCB_SCREEN*)GetScreen())->m_Active_Layer];
if( track == NULL )
if( aTrack == NULL )
return;
if( Drc_On && BAD_DRC==m_drc->Drc( g_CurrentTrackSegment, m_Pcb->m_Track ) )
return;
/* Sauvegarde des coord du point terminal de la piste */
pos = g_CurrentTrackSegment->m_End;
wxPoint pos = g_CurrentTrackSegment->m_End;
if( Begin_Route( track, DC ) == NULL )
D( g_CurrentTrackList.VerifyListIntegrity(); );
if( Begin_Route( aTrack, DC ) == NULL )
return;
ShowNewTrackWhenMovingCursor( DrawPanel, DC, TRUE ); /* mise a jour trace reel */
ShowNewTrackWhenMovingCursor( DrawPanel, DC, FALSE ); /* efface trace piste*/
trace_ratsnest_pad( DC ); /* efface trace chevelu*/
// cleanup
/* cleanup
if( g_CurrentTrackSegment->Next() != NULL )
{
delete g_CurrentTrackSegment->Next();
g_CurrentTrackSegment->SetNext( NULL );
}
*/
D( g_CurrentTrackList.VerifyListIntegrity(); );
/* La piste est ici non chainee a la liste des segments de piste.
@ -433,18 +464,18 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC )
* ceci contribue a la reduction du temps de calcul */
/* Accrochage de la fin de la piste */
LockPoint = LocateLockPoint( m_Pcb, pos, masquelayer );
EDA_BaseStruct* LockPoint = LocateLockPoint( m_Pcb, pos, masquelayer );
if( LockPoint ) /* La fin de la piste est sur un PAD */
{
if( LockPoint->Type() == TYPEPAD )
if( LockPoint->Type() == TYPE_PAD )
{
EnsureEndTrackOnPad( (D_PAD*) LockPoint );
}
else /* la fin de la piste est sur une autre piste: il faudra
* peut-etre creer un point d'ancrage */
{
adr_buf = (TRACK*) LockPoint;
TRACK* adr_buf = (TRACK*) LockPoint;
g_HightLigth_NetCode = adr_buf->GetNet();
/* creation eventuelle d'un point d'accrochage */
@ -455,42 +486,50 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC )
}
}
// Delete Null segments:
g_FirstTrackSegment = DeleteNullTrackSegments( m_Pcb,
g_FirstTrackSegment,
&g_TrackSegmentCount );
/* Test if no segment left. Can happend on a double click on the start point */
DeleteNullTrackSegments( m_Pcb, g_CurrentTrackList );
// Insert new segments if they exist. This can be NULL on a double click on the start point
if( g_FirstTrackSegment != NULL )
{
// Put new track in board
m_Pcb->Add( g_FirstTrackSegment );
int netcode = g_FirstTrackSegment->GetNet();
TRACK* firstTrack = g_FirstTrackSegment;
int newCount = g_CurrentTrackList.GetCount();
trace_ratsnest_pad( DC );
Trace_Une_Piste( DrawPanel, DC, g_FirstTrackSegment, g_TrackSegmentCount, GR_OR );
// Reset flags:
TRACK* ptr = g_FirstTrackSegment; int ii;
for( ii = 0; (ptr != NULL) && (ii < g_TrackSegmentCount); ii++ )
// Put entire new current segment list in BOARD
TRACK* track;
TRACK* insertBeforeMe = g_CurrentTrackSegment->GetBestInsertPoint( m_Pcb );
while( (track = g_CurrentTrackList.PopFront()) != NULL )
{
ptr->m_Flags = 0;
ptr = ptr->Next();
m_Pcb->m_Track.Insert( track, insertBeforeMe );
}
/* Delete the old track, if exists */
trace_ratsnest_pad( DC );
Trace_Une_Piste( DrawPanel, DC, firstTrack, newCount, GR_OR );
int i = 0;
for( track=firstTrack; track && i<newCount; ++i, track = track->Next() )
{
track->m_Flags = 0;
}
// erase the old track, if exists
if( g_AutoDeleteOldTrack )
{
EraseOldTrack( this, m_Pcb, DC, g_FirstTrackSegment, g_TrackSegmentCount );
EraseOldTrack( this, m_Pcb, DC, firstTrack, newCount );
}
/* compute the new rastnest : */
test_1_net_connexion( DC, g_FirstTrackSegment->GetNet() );
test_1_net_connexion( DC, netcode );
GetScreen()->SetModify();
m_Pcb->Display_Infos( this );
}
/* Finish the work, clear used variables */
g_FirstTrackSegment = NULL;
wxASSERT( g_FirstTrackSegment==NULL );
wxASSERT( g_CurrentTrackSegment==NULL );
wxASSERT( g_CurrentTrackList.GetCount()==0 );
if( g_HightLigt_Status )
Hight_Light( DC );
@ -515,7 +554,7 @@ TRACK* LocateIntrusion( TRACK* start, int net, int width )
for( TRACK* track = start; track; track = track->Next() )
{
if( track->Type() == TYPETRACK ) // skip vias
if( track->Type() == TYPE_TRACK ) // skip vias
{
if( track->GetState( BUSY | DELETED ) )
continue;
@ -631,6 +670,8 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
* est aussi affichee
*/
{
D( g_CurrentTrackList.VerifyListIntegrity(); );
int IsolTmp, Track_fill_copy;
PCB_SCREEN* screen = (PCB_SCREEN*) panel->GetScreen();
@ -644,7 +685,7 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
/* efface ancienne position si elle a ete deja dessinee */
if( erase )
{
Trace_Une_Piste( panel, DC, g_FirstTrackSegment, g_TrackSegmentCount, GR_XOR );
Trace_Une_Piste( panel, DC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR );
( (WinEDA_BasePcbFrame*) (panel->m_Parent) )->trace_ratsnest_pad( DC );
}
@ -652,10 +693,11 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
g_CurrentTrackSegment->SetLayer( screen->m_Active_Layer );
if( ! g_DesignSettings.m_UseConnectedTrackWidth )
g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth;
if( g_TwoSegmentTrackBuild )
{
TRACK* previous_track = g_CurrentTrackSegment->Back();
if( previous_track && (previous_track->Type() == TYPETRACK) )
if( previous_track && previous_track->Type()==TYPE_TRACK )
{
previous_track->SetLayer( screen->m_Active_Layer );
if( ! g_DesignSettings.m_UseConnectedTrackWidth )
@ -665,17 +707,21 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
if( Track_45_Only )
{
if( g_TwoSegmentTrackBuild ) {
g_CurrentTrackSegment->m_End = ActiveScreen->m_Curseur;
if (Drc_On)
PushTrack(panel);
ComputeBreakPoint( g_CurrentTrackSegment, g_TrackSegmentCount,
g_CurrentTrackSegment->m_End);
}
if( g_TwoSegmentTrackBuild )
{
g_CurrentTrackSegment->m_End = ActiveScreen->m_Curseur;
if( Drc_On )
PushTrack(panel);
ComputeBreakPoint( g_CurrentTrackSegment, g_CurrentTrackList.GetCount(),
g_CurrentTrackSegment->m_End );
}
else
{
/* Calcul de l'extremite de la piste pour orientations permises:
* horiz,vertical ou 45 degre */
* horiz,vertical ou 45 degre
*/
Calcule_Coord_Extremite_45( g_CurrentTrackSegment->m_Start.x,
g_CurrentTrackSegment->m_Start.y,
&g_CurrentTrackSegment->m_End.x,
@ -687,7 +733,8 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
g_CurrentTrackSegment->m_End = screen->m_Curseur;
}
Trace_Une_Piste( panel, DC, g_FirstTrackSegment, g_TrackSegmentCount, GR_XOR );
D( g_CurrentTrackList.VerifyListIntegrity(); );
Trace_Une_Piste( panel, DC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR );
DisplayOpt.DisplayTrackIsol = IsolTmp;
DisplayOpt.DisplayPcbTrackFill = Track_fill_copy;
@ -712,8 +759,12 @@ void Calcule_Coord_Extremite_45( int ox, int oy, int* fx, int* fy )
deltax = ActiveScreen->m_Curseur.x - ox;
deltay = ActiveScreen->m_Curseur.y - oy;
/* calcul de l'angle preferentiel : 0, 45 , 90 degre */
deltax = abs( deltax ); deltay = abs( deltay ); angle = 45;
deltax = abs( deltax );
deltay = abs( deltay );
angle = 45;
if( deltax >= deltay )
{
if( deltax == 0 )
@ -724,6 +775,7 @@ void Calcule_Coord_Extremite_45( int ox, int oy, int* fx, int* fy )
else
{
angle = 45;
if( deltay == 0 )
angle = 90;
else if( ( (deltax << 6 ) / deltay ) < 26 )
@ -738,12 +790,15 @@ void Calcule_Coord_Extremite_45( int ox, int oy, int* fx, int* fy )
break;
case 45:
deltax = MIN( deltax, deltay ); deltay = deltax;
deltax = MIN( deltax, deltay );
deltay = deltax;
/* recalcul des signes de deltax et deltay */
if( (ActiveScreen->m_Curseur.x - ox) < 0 )
deltax = -deltax;
if( (ActiveScreen->m_Curseur.y - oy) < 0 )
deltay = -deltay;
*fx = ox + deltax;
*fy = oy + deltay;
break;
@ -773,7 +828,7 @@ void ComputeBreakPoint( TRACK* track, int SegmentCount, wxPoint end )
if( track == NULL )
return;
TRACK* NewTrack = track;
TRACK* newTrack = track;
track = track->Back();
SegmentCount--;
if( track )
@ -785,11 +840,11 @@ void ComputeBreakPoint( TRACK* track, int SegmentCount, wxPoint end )
iDy = abs( iDy );
}
TRACK* LastTrack = track ? track->Back() : NULL;
if( LastTrack )
TRACK* lastTrack = track ? track->Back() : NULL;
if( lastTrack )
{
if( (LastTrack->m_End.x == LastTrack->m_Start.x)
|| (LastTrack->m_End.y == LastTrack->m_Start.y) )
if( (lastTrack->m_End.x == lastTrack->m_Start.x)
|| (lastTrack->m_End.y == lastTrack->m_Start.y) )
{
iAngle = 45;
}
@ -822,11 +877,13 @@ void ComputeBreakPoint( TRACK* track, int SegmentCount, wxPoint end )
case 45:
iDx = MIN( iDx, iDy );
iDy = iDx;
/* recalcul des signes de deltax et deltay */
if( (end.x - track->m_Start.x) < 0 )
iDx = -iDx;
if( (end.y - track->m_Start.y) < 0 )
iDy = -iDy;
track->m_End.x = track->m_Start.x + iDx;
track->m_End.y = track->m_Start.y + iDy;
break;
@ -836,6 +893,7 @@ void ComputeBreakPoint( TRACK* track, int SegmentCount, wxPoint end )
track->m_End.y = end.y + iDx;
else
track->m_End.y = end.y - iDx;
track->m_End.x = track->m_Start.x;
break;
}
@ -844,51 +902,47 @@ void ComputeBreakPoint( TRACK* track, int SegmentCount, wxPoint end )
{
if( track->IsNull() )
track->m_End = end;
NewTrack->m_Start = track->m_End;
newTrack->m_Start = track->m_End;
}
NewTrack->m_End = end;
newTrack->m_End = end;
}
/****************************************************************************/
TRACK* DeleteNullTrackSegments( BOARD* pcb, TRACK* track, int* segmcount )
void DeleteNullTrackSegments( BOARD* pcb, DLIST<TRACK>& aTrackList )
/****************************************************************************/
/* Delete track segments which have len = 0; after creating a new track
* return a pointer on the first segment (start of track list)
*/
{
if( aTrackList.GetCount() == 0 )
return;
TRACK* track = aTrackList.GetFirst();
TRACK* firsttrack = track;
TRACK* oldtrack;
int nn = 0;
BOARD_ITEM* LockPoint;
if( track == 0 )
return NULL;
LockPoint = track->start;
BOARD_ITEM* LockPoint = track->start;
while( track != NULL )
{
oldtrack = track;
track = track->Next();
if( !oldtrack->IsNull() )
{
nn++;
continue;
}
// NULL segment, delete it
if( firsttrack == oldtrack )
firsttrack = track;
oldtrack->UnLink();
delete oldtrack;
delete aTrackList.Remove( oldtrack );
}
if( segmcount )
*segmcount = nn;
if( nn == 0 )
return NULL; // all the new track segments have been deleted
if( aTrackList.GetCount() == 0 )
return; // all the new track segments have been deleted
// we must set the pointers on connected items and the connection status
oldtrack = track = firsttrack;
@ -898,13 +952,15 @@ TRACK* DeleteNullTrackSegments( BOARD* pcb, TRACK* track, int* segmcount )
oldtrack = track;
track = track->Next();
oldtrack->end = track;
if( track )
track->start = oldtrack;
oldtrack->SetStatus( 0 );
}
firsttrack->start = LockPoint;
if( LockPoint && (LockPoint->Type() == TYPEPAD ) )
if( LockPoint && LockPoint->Type()==TYPE_PAD )
firsttrack->SetState( BEGIN_ONPAD, ON );
track = firsttrack;
@ -924,8 +980,6 @@ TRACK* DeleteNullTrackSegments( BOARD* pcb, TRACK* track, int* segmcount )
}
track = next_track;
}
return firsttrack;
}
@ -949,10 +1003,8 @@ void EnsureEndTrackOnPad( D_PAD* Pad )
if( !g_CurrentTrackSegment->IsNull() )
{
/* Must create a new segment, from track end to pad center */
g_CurrentTrackSegment = lasttrack->Copy();
g_TrackSegmentCount++;
lasttrack->SetNext( g_CurrentTrackSegment );
g_CurrentTrackSegment->SetBack( lasttrack );
g_CurrentTrackList.PushBack( lasttrack->Copy() );
lasttrack->end = g_CurrentTrackSegment;
}
@ -962,3 +1014,4 @@ void EnsureEndTrackOnPad( D_PAD* Pad )
g_CurrentTrackSegment->end = Pad;
g_CurrentTrackSegment->SetState( END_ONPAD, ON );
}

View File

@ -38,12 +38,8 @@ TEXTE_MODULE* WinEDA_BasePcbFrame::CreateTextModule( MODULE* Module, wxDC* DC )
Text = new TEXTE_MODULE( Module );
/* Chainage de la nouvelle structure en tete de liste drawings */
Text->SetNext( Module->m_Drawings );
Text->SetBack( Module );
Module->m_Drawings.PushFront( Text );
if( Module->m_Drawings )
Module->m_Drawings->SetBack( Text );
Module->m_Drawings = Text;
Text->m_Flags = IS_NEW;
Text->m_Text = wxT( "text" );

View File

@ -162,30 +162,24 @@ void CreatePadsShapesSection( FILE* file, BOARD* pcb )
* pour les formes de pad PAD1 a PADn
*/
{
D_PAD* pad;
D_PAD** padlist;
D_PAD** pad_list_base = NULL;
std::vector<D_PAD*> pads;
const char* pad_type;
int memsize, ii, dx, dy;
D_PAD* old_pad = NULL;
int pad_name_number;
fputs( "$PADS\n", file );
if( pcb->m_NbPads > 0 ) // pcb->m_Pads is NULL unless this is true
if( pcb->m_Pads.size() > 0 )
{
// Generation de la liste des pads tries par forme et dimensions:
memsize = (pcb->m_NbPads + 1) * sizeof(D_PAD *);
pad_list_base = (D_PAD**) MyZMalloc( memsize );
memcpy( pad_list_base, pcb->m_Pads, memsize );
qsort( pad_list_base, pcb->m_NbPads, sizeof(D_PAD *), Pad_list_Sort_by_Shapes );
pads.insert( pads.end(), pcb->m_Pads.begin(), pcb->m_Pads.end() );
qsort( &pads[0], pcb->m_Pads.size(), sizeof( D_PAD* ), Pad_list_Sort_by_Shapes );
}
pad_name_number = 0;
for( padlist = pad_list_base, ii = 0; ii < pcb->m_NbPads; padlist++, ii++ )
D_PAD* old_pad = NULL;
int pad_name_number = 0;
for( unsigned i=0; i<pads.size(); ++i )
{
pad = *padlist;
D_PAD* pad = pads[i];
pad->SetSubRatsnest( pad_name_number );
if( old_pad && 0==D_PAD::Compare( old_pad, pad ) )
@ -198,8 +192,8 @@ void CreatePadsShapesSection( FILE* file, BOARD* pcb )
fprintf( file, "PAD PAD%d", pad->GetSubRatsnest() );
dx = pad->m_Size.x / 2;
dy = pad->m_Size.y / 2;
int dx = pad->m_Size.x / 2;
int dy = pad->m_Size.y / 2;
switch( pad->m_PadShape )
{
@ -273,8 +267,6 @@ void CreatePadsShapesSection( FILE* file, BOARD* pcb )
}
fputs( "$ENDPADS\n\n", file );
MyFree( pad_list_base );
}
@ -564,7 +556,7 @@ void CreateRoutesSection( FILE* file, BOARD* pcb )
for( track = pcb->m_Zone; track != NULL; track = track->Next() )
{
if( track->Type() == TYPEZONE )
if( track->Type() == TYPE_ZONE )
nbitems++;
}
@ -576,7 +568,7 @@ void CreateRoutesSection( FILE* file, BOARD* pcb )
for( track = pcb->m_Zone; track != NULL; track = track->Next() )
{
if( track->Type() == TYPEZONE )
if( track->Type() == TYPE_ZONE )
tracklist[nbitems++] = track;
}
@ -608,7 +600,7 @@ void CreateRoutesSection( FILE* file, BOARD* pcb )
fprintf( file, "TRACK TRACK%d\n", track->m_Width );
}
if( (track->Type() == TYPETRACK) || (track->Type() == TYPEZONE) )
if( (track->Type() == TYPE_TRACK) || (track->Type() == TYPE_ZONE) )
{
if( old_layer != track->GetLayer() )
{
@ -621,7 +613,7 @@ void CreateRoutesSection( FILE* file, BOARD* pcb )
mapXto( track->m_Start.x ), mapYto( track->m_Start.y ),
mapXto( track->m_End.x ), mapYto( track->m_End.y ) );
}
if( track->Type() == TYPEVIA )
if( track->Type() == TYPE_VIA )
{
fprintf( file, "VIA viapad%d %d %d ALL %d via%d\n",
track->m_Width,
@ -816,10 +808,10 @@ void ModuleWriteShape( FILE* file, MODULE* module )
{
switch( PtStruct->Type() )
{
case TYPETEXTEMODULE:
case TYPE_TEXTE_MODULE:
break;
case TYPEEDGEMODULE:
case TYPE_EDGE_MODULE:
PtEdge = (EDGE_MODULE*) PtStruct;
switch( PtEdge->m_Shape )

View File

@ -131,23 +131,23 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName, w
{
switch( PtStruct->Type() )
{
case TYPEDRAWSEGMENT:
case TYPE_DRAWSEGMENT:
PlotDrawSegment( (DRAWSEGMENT*) PtStruct, format, EDGE_LAYER );
break;
case TYPETEXTE:
case TYPE_TEXTE:
PlotTextePcb( (TEXTE_PCB*) PtStruct, format, EDGE_LAYER );
break;
case TYPECOTATION:
case TYPE_COTATION:
PlotCotation( (COTATION*) PtStruct, format, EDGE_LAYER );
break;
case TYPEMIRE:
case TYPE_MIRE:
PlotMirePcb( (MIREPCB*) PtStruct, format, EDGE_LAYER );
break;
case TYPEMARKER: // do not draw
case TYPE_MARKER: // do not draw
break;
default:

View File

@ -66,7 +66,7 @@ void Build_Holes_List( BOARD* aPcb,
TRACK* track = aPcb->m_Track;
for( ; track != NULL; track = track->Next() )
{
if( track->Type() != TYPEVIA )
if( track->Type() != TYPE_VIA )
continue;
SEGVIA* via = (SEGVIA*) track;
hole_value = via->GetDrillValue();

View File

@ -449,7 +449,7 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event )
EDA_BaseStruct* PtStruct;
for( PtStruct = m_Pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
{
if( PtStruct->Type() != TYPEDRAWSEGMENT )
if( PtStruct->Type() != TYPE_DRAWSEGMENT )
continue;
if( ( (DRAWSEGMENT*) PtStruct )->GetLayer() != EDGE_N )
continue;

View File

@ -288,21 +288,10 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
Module->Draw( DrawPanel, DC, GR_XOR );
/* Generation des elements speciaux: drawsegments */
LastSegm = (EDGE_MODULE*) Module->m_Drawings;
if( LastSegm )
while( LastSegm->Next() )
LastSegm = (EDGE_MODULE*) LastSegm->Next();
FirstSegm = PtSegm = new EDGE_MODULE( Module );
if( LastSegm )
{
LastSegm->SetNext( PtSegm );
PtSegm->SetBack( LastSegm );
}
else
{
Module->m_Drawings = PtSegm; PtSegm->SetBack( Module );
}
Module->m_Drawings.PushBack( PtSegm );
PtSegm->m_Start = Mself.m_Start;
PtSegm->m_End.x = Mself.m_Start.x;
PtSegm->m_End.y = PtSegm->m_Start.y + Mself.delta;
@ -336,6 +325,7 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
newedge->AddToChain( PtSegm );
PtSegm = newedge;
PtSegm->m_Start = PtSegm->m_End;
if( ii & 1 ) /* brin d'ordre impair : cercles de sens > 0 */
arc_angle = 1800;
else
@ -427,8 +417,7 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
/* Placement des 2 pads sur extremite */
PtPad = new D_PAD( Module );
Module->m_Pads = PtPad;
PtPad->SetBack( Module );
Module->m_Pads.PushFront( PtPad );
PtPad->SetPadName( wxT( "1" ) );
PtPad->m_Pos.x = LastSegm->m_End.x; PtPad->m_Pos.y = LastSegm->m_End.y;

View File

@ -108,7 +108,7 @@ void WinEDA_DrillFrame::InitDisplayParams( void )
m_BlindOrBuriedViasCount = 0;
for( TRACK* track = m_Parent->m_Pcb->m_Track; track != NULL; track = track->Next() )
{
if( track->Type() != TYPEVIA )
if( track->Type() != TYPE_VIA )
continue;
if( track->Shape() == VIA_THROUGH )
m_ThroughViasCount++;

View File

@ -159,8 +159,8 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
char Line[1024];
int NbLine = 0;
long ibuf[100];
EDGE_MODULE* DrawSegm, * LastModStruct = NULL;
D_PAD* LastPad = NULL, * Pad;
EDGE_MODULE* DrawSegm;
D_PAD* Pad;
wxArrayString params;
int iprmcnt, icnt_max, iflgidx;
@ -251,21 +251,14 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
DrawSegm->SetLayer( SILKSCREEN_N_CMP );
DrawSegm->m_Shape = S_SEGMENT;
if( LastModStruct == NULL )
{
DrawSegm->SetBack( this );
m_Drawings = DrawSegm;
}
else
{
DrawSegm->SetBack( LastModStruct );
LastModStruct->SetNext( DrawSegm );
}
m_Drawings.PushBack( DrawSegm );
int* list[5] = {
&DrawSegm->m_Start0.x, &DrawSegm->m_Start0.y,
&DrawSegm->m_End0.x, &DrawSegm->m_End0.y,
&DrawSegm->m_Width
};
for( unsigned ii = 0; ii < 5; ii++ )
{
long dim;
@ -277,7 +270,6 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
}
DrawSegm->SetDrawCoord();
LastModStruct = DrawSegm;
continue;
}
@ -288,16 +280,8 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
DrawSegm->SetLayer( SILKSCREEN_N_CMP );
DrawSegm->m_Shape = S_ARC;
if( LastModStruct == NULL )
{
DrawSegm->SetBack( this );
m_Drawings = DrawSegm;
}
else
{
DrawSegm->SetBack( LastModStruct );
LastModStruct->SetNext( DrawSegm );
}
m_Drawings.PushBack( DrawSegm );
for( unsigned ii = 0; ii < 7; ii++ )
{
long dim;
@ -327,7 +311,6 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
DrawSegm->m_Width = (int) round( ibuf[6] * conv_unit );
DrawSegm->SetDrawCoord();
LastModStruct = DrawSegm;
continue;
}
@ -376,18 +359,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
Pad->m_PadShape = PAD_OVAL;
}
if( LastPad == NULL )
{
Pad->SetBack( (EDA_BaseStruct*) this );
m_Pads = Pad;
}
else
{
Pad->SetBack( (EDA_BaseStruct*) LastPad );
LastPad->SetNext( (EDA_BaseStruct*) Pad );
}
LastPad = Pad;
m_Pads.PushBack( Pad );
continue;
}
@ -400,8 +372,10 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
SOLDERMASK_LAYER_CMP |
SOLDERMASK_LAYER_CU;
iflgidx = params.GetCount() - 2;
if( TestFlags( params[iflgidx], 0x0100, wxT( "square" ) ) )
Pad->m_PadShape = PAD_RECT;
for( unsigned ii = 0; ii < 6; ii++ )
{
if( ii < params.GetCount() - 2 )
@ -431,17 +405,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
if( (Pad->m_PadShape == PAD_ROUND) && (Pad->m_Size.x != Pad->m_Size.y) )
Pad->m_PadShape = PAD_OVAL;
if( LastPad == NULL )
{
Pad->SetBack( (EDA_BaseStruct*) this );
m_Pads = Pad;
}
else
{
Pad->SetBack( (EDA_BaseStruct*) LastPad );
LastPad->SetNext( (EDA_BaseStruct*) Pad );
}
LastPad = Pad;
m_Pads.PushBack( Pad );
continue;
}
}

View File

@ -272,23 +272,23 @@ void TraceSegmentPcb( BOARD* Pcb, TRACK* pt_segm, int color, int marge, int op_l
uy1 = pt_segm->m_End.y - Pcb->m_BoundaryBox.m_Pos.y;
/* Test si VIA (cercle plein a tracer) */
if( pt_segm->Type() == TYPEVIA )
if( pt_segm->Type() == TYPE_VIA )
{
int mask_layer = 0;
if ( pt_segm->IsOnLayer(Route_Layer_BOTTOM) )
mask_layer = 1 << Route_Layer_BOTTOM;
if ( pt_segm->IsOnLayer(Route_Layer_TOP) )
{
if ( mask_layer == 0 )
mask_layer = 1 << Route_Layer_TOP;
else mask_layer = -1;
}
int mask_layer = 0;
if ( pt_segm->IsOnLayer(Route_Layer_BOTTOM) )
mask_layer = 1 << Route_Layer_BOTTOM;
if ( pt_segm->IsOnLayer(Route_Layer_TOP) )
{
if ( mask_layer == 0 )
mask_layer = 1 << Route_Layer_TOP;
else mask_layer = -1;
}
if( color == VIA_IMPOSSIBLE )
mask_layer = -1;
if( color == VIA_IMPOSSIBLE )
mask_layer = -1;
if ( mask_layer )
TraceFilledCercle( Pcb, pt_segm->m_Start.x, pt_segm->m_Start.y, demi_largeur,
if ( mask_layer )
TraceFilledCercle( Pcb, pt_segm->m_Start.x, pt_segm->m_Start.y, demi_largeur,
mask_layer, color, op_logique );
return;
}

View File

@ -315,15 +315,15 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
DrawStruct = PcbGeneralLocateAndDisplay();
// don't let backspace delete modules!!
if( DrawStruct && (DrawStruct->Type() == TYPETRACK
|| DrawStruct->Type() == TYPEVIA) )
if( DrawStruct && (DrawStruct->Type() == TYPE_TRACK
|| DrawStruct->Type() == TYPE_VIA) )
{
Delete_Segment( DC, (TRACK*) DrawStruct );
SetCurItem(NULL);
}
GetScreen()->SetModify();
}
else if( GetCurItem()->Type() == TYPETRACK )
else if( GetCurItem()->Type() == TYPE_TRACK )
{
// then an element is being edited - remove the last segment.
// simple lines for debugger:
@ -336,7 +336,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
break;
case HK_END_TRACK:
if( ! ItemFree && (GetCurItem()->Type() == TYPETRACK) && ((GetCurItem()->m_Flags & IS_NEW) != 0) )
if( ! ItemFree && (GetCurItem()->Type() == TYPE_TRACK) && ((GetCurItem()->m_Flags & IS_NEW) != 0) )
{
// A new track is in progress: call to End_Route()
DrawPanel->MouseToCursorSchema();
@ -387,7 +387,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
return;
if( ItemFree ) // no track in progress: nothing to do
break;
if( GetCurItem()->Type() != TYPETRACK ) // Should not occur
if( GetCurItem()->Type() != TYPE_TRACK ) // Should not occur
return;
if( (GetCurItem()->m_Flags & IS_NEW) == 0 )
return;
@ -412,7 +412,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
Other_Layer_Route( NULL, DC );
break;
}
if( GetCurItem()->Type() != TYPETRACK )
if( GetCurItem()->Type() != TYPE_TRACK )
return;
if( (GetCurItem()->m_Flags & IS_NEW) == 0 )
return;
@ -426,7 +426,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
// get any module, locked or not locked and toggle its locked status
if( ItemFree )
module = Locate_Prefered_Module( m_Pcb, CURSEUR_OFF_GRILLE | VISIBLE_ONLY );
else if( GetCurItem()->Type() == TYPEMODULE )
else if( GetCurItem()->Type() == TYPE_MODULE )
module = (MODULE*) GetCurItem();
if( module )
{
@ -471,7 +471,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
}
}
}
else if( GetCurItem()->Type() == TYPEMODULE )
else if( GetCurItem()->Type() == TYPE_MODULE )
{
module = (MODULE*) GetCurItem();
@ -606,11 +606,11 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct )
if( ItemFree )
{
DrawStruct = PcbGeneralLocateAndDisplay();
if( DrawStruct && DrawStruct->Type() != TYPETRACK )
if( DrawStruct && DrawStruct->Type() != TYPE_TRACK )
return FALSE;
Delete_Track( DC, (TRACK*) DrawStruct );
}
else if( GetCurItem()->Type() == TYPETRACK )
else if( GetCurItem()->Type() == TYPE_TRACK )
{
// simple lines for debugger:
TRACK* track = (TRACK*) GetCurItem();

View File

@ -131,10 +131,10 @@ bool WinEDA_BasePcbFrame::Clear_Pcb( bool query )
// layer names are put into the BOARD.
SetBOARD( new BOARD( NULL, this ) );
for( ; g_UnDeleteStackPtr != 0; )
while( g_UnDeleteStackPtr > 0 )
{
g_UnDeleteStackPtr--;
g_UnDeleteStack[g_UnDeleteStackPtr]->DeleteStructList();
g_UnDeleteStack[g_UnDeleteStackPtr]->DeleteStructList();
}
/* init pointeurs et variables */
@ -175,13 +175,7 @@ void WinEDA_PcbFrame::Erase_Zones( bool query )
if( query && !IsOK( this, _( "Delete Zones ?" ) ) )
return;
if( m_Pcb->m_Zone )
{
m_Pcb->m_Zone->DeleteStructList();
m_Pcb->m_Zone = NULL;
m_Pcb->m_NbSegmZone = 0;
}
m_Pcb->m_Zone.DeleteAll();
m_Pcb->DeleteZONEOutlines();
GetScreen()->SetModify();
@ -215,10 +209,10 @@ void WinEDA_PcbFrame::Erase_Segments_Pcb( bool is_edges, bool query )
switch( PtStruct->Type() )
{
case TYPEDRAWSEGMENT:
case TYPETEXTE:
case TYPECOTATION:
case TYPEMIRE:
case TYPE_DRAWSEGMENT:
case TYPE_TEXTE:
case TYPE_COTATION:
case TYPE_MIRE:
if( g_TabOneLayerMask[ PtStruct->GetLayer()] & masque_layer )
PtStruct->DeleteStructure();
break;
@ -272,12 +266,9 @@ void WinEDA_PcbFrame::Erase_Modules( bool query )
if( query && !IsOK( this, _( "Delete Modules?" ) ) )
return;
m_Pcb->m_Modules->DeleteStructList();
m_Pcb->m_Modules = 0;
m_Pcb->m_Modules.DeleteAll();
m_Pcb->m_Status_Pcb = 0;
m_Pcb->m_NbNets = 0;
m_Pcb->m_NbPads = 0;
m_Pcb->m_NbNodes = 0;
m_Pcb->m_NbLinks = 0;
m_Pcb->m_NbNoconnect = 0;
@ -299,8 +290,10 @@ void WinEDA_PcbFrame::Erase_Textes_Pcb( bool query )
for( ; PtStruct != NULL; PtStruct = PtNext )
{
PtNext = PtStruct->Next();
if( PtStruct->Type() == TYPETEXTE )
PtStruct ->DeleteStructure();
if( PtStruct->Type() == TYPE_TEXTE )
{
PtStruct->DeleteStructure();
}
}
GetScreen()->SetModify();

View File

@ -79,7 +79,7 @@ int NbDraw, NbTrack, NbZone, NbMod, NbNets;
/**********************************************************************/
int WinEDA_BasePcbFrame::ReadListeSegmentDescr( FILE* File,
TRACK* PtSegm, int StructType, int* LineNum, int NumSegm )
TRACK* insertBeforeMe, int StructType, int* LineNum, int NumSegm )
/**********************************************************************/
/** Read a list of segments (Tracks, zones)
@ -91,7 +91,7 @@ int WinEDA_BasePcbFrame::ReadListeSegmentDescr( FILE* File,
char line1[256];
char line2[256];
TRACK* NewTrack;
TRACK* newTrack;
while( GetLine( File, line1, LineNum ) )
{
@ -104,9 +104,9 @@ int WinEDA_BasePcbFrame::ReadListeSegmentDescr( FILE* File,
}
// Read the 2nd line to determine the exact type, one of:
// TYPETRACK, TYPEVIA, or TYPEZONE. The type field in 2nd line
// differentiates between TYPETRACK and TYPEVIA. With virtual
// functions in use, it is critical to instantiate the TYPEVIA exactly.
// TYPE_TRACK, TYPE_VIA, or TYPE_ZONE. The type field in 2nd line
// differentiates between TYPE_TRACK and TYPE_VIA. With virtual
// functions in use, it is critical to instantiate the TYPE_VIA exactly.
if( GetLine( File, line2, LineNum ) == NULL )
break;
@ -117,49 +117,48 @@ int WinEDA_BasePcbFrame::ReadListeSegmentDescr( FILE* File,
sscanf( line2 + 2, " %d %d %d %lX %X", &layer, &type, &net_code,
&timeStamp, &flags );
if( StructType==TYPETRACK && type==1 )
makeType = TYPEVIA;
if( StructType==TYPE_TRACK && type==1 )
makeType = TYPE_VIA;
else
makeType = StructType;
switch( makeType )
{
default:
case TYPETRACK:
NewTrack = new TRACK( m_Pcb );
case TYPE_TRACK:
newTrack = new TRACK( m_Pcb );
m_Pcb->m_Track.Insert( newTrack, insertBeforeMe );
break;
case TYPEVIA:
NewTrack = new SEGVIA( m_Pcb );
case TYPE_VIA:
newTrack = new SEGVIA( m_Pcb );
m_Pcb->m_Track.Insert( newTrack, insertBeforeMe );
break;
case TYPEZONE:
NewTrack = new SEGZONE( m_Pcb );
case TYPE_ZONE:
newTrack = new SEGZONE( m_Pcb );
m_Pcb->m_Zone.Insert( (SEGZONE*)newTrack, (SEGZONE*)insertBeforeMe );
break;
}
NewTrack->Insert( m_Pcb, PtSegm );
PtSegm = NewTrack;
PtSegm->m_TimeStamp = timeStamp;
newTrack->m_TimeStamp = timeStamp;
int arg_count = sscanf( line1 + 2, " %d %d %d %d %d %d %d", &shape,
&PtSegm->m_Start.x, &PtSegm->m_Start.y,
&PtSegm->m_End.x, &PtSegm->m_End.y, &width,
&newTrack->m_Start.x, &newTrack->m_Start.y,
&newTrack->m_End.x, &newTrack->m_End.y, &width,
&drill );
PtSegm->m_Width = width;
PtSegm->m_Shape = shape;
newTrack->m_Width = width;
newTrack->m_Shape = shape;
if( arg_count < 7 || drill <= 0 )
PtSegm->SetDrillDefault();
newTrack->SetDrillDefault();
else
PtSegm->SetDrillValue(drill);
newTrack->SetDrillValue(drill);
PtSegm->SetLayer( layer );
PtSegm->SetNet( net_code );
PtSegm->SetState( flags, ON );
newTrack->SetLayer( layer );
newTrack->SetNet( net_code );
newTrack->SetState( flags, ON );
}
DisplayError( this, _( "Error: Unexpected end of file !" ) );
@ -330,14 +329,14 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
if( stricmp( Line, "TrackWidth" ) == 0 )
{
g_DesignSettings.m_CurrentTrackWidth = atoi( data );
AddHistory( g_DesignSettings.m_CurrentTrackWidth, TYPETRACK );
AddHistory( g_DesignSettings.m_CurrentTrackWidth, TYPE_TRACK );
continue;
}
if( stricmp( Line, "TrackWidthHistory" ) == 0 )
{
int tmp = atoi( data );
AddHistory( tmp, TYPETRACK );
AddHistory( tmp, TYPE_TRACK );
continue;
}
@ -407,7 +406,7 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
if( stricmp( Line, "ViaSize" ) == 0 )
{
g_DesignSettings.m_CurrentViaSize = atoi( data );
AddHistory( g_DesignSettings.m_CurrentViaSize, TYPEVIA );
AddHistory( g_DesignSettings.m_CurrentViaSize, TYPE_VIA );
continue;
}
@ -420,7 +419,7 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
if( stricmp( Line, "ViaSizeHistory" ) == 0 )
{
int tmp = atoi( data );
AddHistory( tmp, TYPEVIA );
AddHistory( tmp, TYPE_VIA );
continue;
}
@ -616,7 +615,7 @@ bool WinEDA_PcbFrame::WriteGeneralDescrPcb( FILE* File )
fprintf( File, "Nzone %d\n", m_Pcb->GetNumSegmZone() );
fprintf( File, "Nmodule %d\n", NbModules );
fprintf( File, "Nnets %d\n", m_Pcb->m_NbNets );
fprintf( File, "Nnets %d\n", m_Pcb->m_Equipots.GetCount() );
fprintf( File, "$EndGENERAL\n\n" );
return TRUE;
@ -762,10 +761,6 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append )
{
char Line[1024];
int LineNum = 0;
int nbsegm, nbmod;
BOARD_ITEM* LastStructPcb = NULL, * StructPcb;
MODULE* LastModule = NULL, * Module;
EQUIPOT* LastEquipot = NULL, * Equipot;
wxBusyCursor dummy;
@ -773,33 +768,7 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append )
SetLocaleTo_C_standard( );
NbDraw = NbTrack = NbZone = NbMod = NbNets = -1;
m_Pcb->m_NbNets = 0;
m_Pcb->m_Status_Pcb = 0;
nbmod = 0;
if( Append )
{
LastModule = m_Pcb->m_Modules;
for( ; LastModule != NULL; LastModule = (MODULE*) LastModule->Next() )
{
if( LastModule->Next() == NULL )
break;
}
LastStructPcb = m_Pcb->m_Drawings;
for( ; LastStructPcb != NULL; LastStructPcb = LastStructPcb->Next() )
{
if( LastStructPcb->Next() == NULL )
break;
}
LastEquipot = m_Pcb->m_Equipots;
for( ; LastEquipot != NULL; LastEquipot = (EQUIPOT*) LastEquipot->Next() )
{
if( LastEquipot->Next() == NULL )
break;
}
}
while( GetLine( File, Line, &LineNum ) != NULL )
{
@ -835,20 +804,9 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append )
if( strnicmp( Line, "$EQUIPOT", 7 ) == 0 )
{
Equipot = new EQUIPOT( m_Pcb );
EQUIPOT* Equipot = new EQUIPOT( m_Pcb );
m_Pcb->m_Equipots.PushBack( Equipot );
Equipot->ReadEquipotDescr( File, &LineNum );
if( LastEquipot == NULL )
{
m_Pcb->m_Equipots = Equipot;
Equipot->SetBack( m_Pcb );
}
else
{
Equipot->SetBack( LastEquipot );
LastEquipot->SetNext( Equipot );
}
LastEquipot = Equipot;
m_Pcb->m_NbNets++;
continue;
}
@ -864,140 +822,67 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append )
if( strnicmp( Line, "$MODULE", 7 ) == 0 )
{
Module = new MODULE( m_Pcb );
MODULE* Module = new MODULE( m_Pcb );
if( Module == NULL )
continue;
Module->ReadDescr( File, &LineNum );
if( LastModule == NULL )
{
m_Pcb->m_Modules = Module;
Module->SetBack( m_Pcb );
}
else
{
Module->SetBack( LastModule );
LastModule->SetNext( Module );
}
LastModule = Module;
nbmod++;
m_Pcb->Add( Module, ADD_APPEND );
Module->ReadDescr( File, &LineNum );
continue;
}
if( strnicmp( Line, "$TEXTPCB", 8 ) == 0 )
{
TEXTE_PCB* pcbtxt = new TEXTE_PCB( m_Pcb );
StructPcb = pcbtxt;
m_Pcb->Add( pcbtxt, ADD_APPEND );
pcbtxt->ReadTextePcbDescr( File, &LineNum );
if( LastStructPcb == NULL )
{
m_Pcb->m_Drawings = StructPcb;
StructPcb->SetBack( m_Pcb );
}
else
{
StructPcb->SetBack( LastStructPcb );
LastStructPcb->SetNext( StructPcb );
}
LastStructPcb = StructPcb;
continue;
}
if( strnicmp( Line, "$DRAWSEGMENT", 10 ) == 0 )
{
DRAWSEGMENT* DrawSegm = new DRAWSEGMENT( m_Pcb );
m_Pcb->Add( DrawSegm, ADD_APPEND );
DrawSegm->ReadDrawSegmentDescr( File, &LineNum );
if( LastStructPcb == NULL )
{
m_Pcb->m_Drawings = DrawSegm;
DrawSegm->SetBack( m_Pcb );
}
else
{
DrawSegm->SetBack( LastStructPcb );
LastStructPcb->SetNext( DrawSegm );
}
LastStructPcb = DrawSegm;
continue;
}
if( strnicmp( Line, "$COTATION", 9 ) == 0 )
{
COTATION* Cotation = new COTATION( m_Pcb );
m_Pcb->Add( Cotation, ADD_APPEND );
Cotation->ReadCotationDescr( File, &LineNum );
if( LastStructPcb == NULL )
{
m_Pcb->m_Drawings = Cotation;
Cotation->SetBack( m_Pcb );
}
else
{
Cotation->SetBack( LastStructPcb );
LastStructPcb->SetNext( Cotation );
}
LastStructPcb = Cotation;
continue;
}
if( strnicmp( Line, "$MIREPCB", 8 ) == 0 )
{
MIREPCB* Mire = new MIREPCB( m_Pcb );
m_Pcb->Add( Mire, ADD_APPEND );
Mire->ReadMirePcbDescr( File, &LineNum );
if( LastStructPcb == NULL )
{
m_Pcb->m_Drawings = Mire;
Mire->SetBack( m_Pcb );
}
else
{
Mire->SetBack( LastStructPcb );
LastStructPcb->SetNext( Mire );
}
LastStructPcb = Mire;
continue;
}
if( strnicmp( Line, "$TRACK", 6 ) == 0 )
{
TRACK* StartTrack = m_Pcb->m_Track;
nbsegm = 0;
if( Append )
{
for( ; StartTrack != NULL; StartTrack = StartTrack->Next() )
{
if( StartTrack->Next() == NULL )
break;
}
}
#ifdef PCBNEW
int ii = ReadListeSegmentDescr( File, StartTrack, TYPETRACK,
TRACK* insertBeforeMe = Append ? NULL : m_Pcb->m_Track.GetFirst();
ReadListeSegmentDescr( File, insertBeforeMe, TYPE_TRACK,
&LineNum, NbTrack );
m_Pcb->m_NbSegmTrack += ii;
D( m_Pcb->m_Track.VerifyListIntegrity(); )
#endif
continue;
}
if( strnicmp( Line, "$ZONE", 5 ) == 0 )
{
SEGZONE* StartZone = m_Pcb->m_Zone;
if( Append )
{
for( ; StartZone != NULL; StartZone = StartZone->Next() )
{
if( StartZone->Next() == NULL )
break;
}
}
#ifdef PCBNEW
int ii = ReadListeSegmentDescr( File, StartZone, TYPEZONE,
SEGZONE* insertBeforeMe = Append ? NULL : m_Pcb->m_Zone.GetFirst();
ReadListeSegmentDescr( File, insertBeforeMe, TYPE_ZONE,
&LineNum, NbZone );
m_Pcb->m_NbSegmZone += ii;
D( m_Pcb->m_Zone.VerifyListIntegrity(); )
#endif
continue;
}

View File

@ -58,17 +58,17 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
{
switch( item->Type() )
{
case TYPEDRAWSEGMENT:
case TYPECOTATION:
case TYPETEXTE:
case TYPEMIRE:
case TYPE_DRAWSEGMENT:
case TYPE_COTATION:
case TYPE_TEXTE:
case TYPE_MIRE:
if( ((1<<item->GetLayer()) & printmasklayer) == 0 )
break;
item->Draw( this, DC, drawmode );
break;
case TYPEMARKER: /* Trace des marqueurs */
case TYPE_MARKER: /* Trace des marqueurs */
default:
break;
}
@ -80,7 +80,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
{
if( ( printmasklayer & pt_piste->ReturnMaskLayer() ) == 0 )
continue;
if( pt_piste->Type() == TYPEVIA ) /* VIA rencontree */
if( pt_piste->Type() == TYPE_VIA ) /* VIA rencontree */
{
int rayon = pt_piste->m_Width >> 1;
int color = g_DesignSettings.m_ViaColor[pt_piste->m_Shape];
@ -118,7 +118,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
{
if( ( printmasklayer & pt_piste->ReturnMaskLayer() ) == 0 )
continue;
if( pt_piste->Type() == TYPEVIA ) /* VIA rencontree */
if( pt_piste->Type() == TYPE_VIA ) /* VIA rencontree */
{
GRSetDrawMode( DC, drawmode );
GRFilledCircle( &m_ClipBox, DC, pt_piste->m_Start.x, pt_piste->m_Start.y,
@ -206,7 +206,7 @@ static void Plot_Module( WinEDA_DrawPanel* panel, wxDC* DC,
{
switch( PtStruct->Type() )
{
case TYPETEXTEMODULE:
case TYPE_TEXTE_MODULE:
if( (mlayer & masklayer ) == 0 )
break;
@ -214,7 +214,7 @@ static void Plot_Module( WinEDA_DrawPanel* panel, wxDC* DC,
TextMod->Draw( panel, DC, draw_mode );
break;
case TYPEEDGEMODULE:
case TYPE_EDGE_MODULE:
{
EDGE_MODULE* edge = (EDGE_MODULE*) PtStruct;
if( (g_TabOneLayerMask[edge->GetLayer()] & masklayer ) == 0 )

View File

@ -123,13 +123,7 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC )
}
/* Insert footprint in list*/
if( m_Pcb->m_Modules )
{
m_Pcb->m_Modules->SetBack( module );
}
module->SetNext( m_Pcb->m_Modules );
module->SetBack( m_Pcb );
m_Pcb->m_Modules = module;
m_Pcb->Add( module );
/* Display info : */
module->Display_Infos( this );
@ -734,13 +728,7 @@ MODULE* WinEDA_BasePcbFrame::Create_1_Module( wxDC* DC, const wxString& module_n
// Creates the new module and add it to the head of the linked list of modules
Module = new MODULE( m_Pcb );
Module->SetNext( m_Pcb->m_Modules );
Module->SetBack( m_Pcb );
if( m_Pcb->m_Modules )
{
m_Pcb->m_Modules->SetBack( Module );
}
m_Pcb->m_Modules = Module;
m_Pcb->Add( Module );
/* Update parameters: position, timestamp ... */
newpos = GetScreen()->m_Curseur;

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