Commit aab39d1d authored by dickelbeck's avatar dickelbeck

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

parent 67fa1ddb
......@@ -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;
......
......@@ -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;
......
......@@ -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; }
......
......@@ -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
......
......@@ -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
......
......@@ -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 )
......
......@@ -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;
......
......@@ -11,7 +11,7 @@
/******************************************************************/
void SetStructFather( EDA_BaseStruct* Struct, BASE_SCREEN* Screen )
void SetaParent( EDA_BaseStruct* Struct, BASE_SCREEN* Screen )
/******************************************************************/
{
switch( Struct->Type() )
......
......@@ -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 */
......
......@@ -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
......
......@@ -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
......
......@@ -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;
......
......@@ -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;
......
......@@ -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 );
......
......@@ -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 );
}
}
......
......@@ -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();
}
......
......@@ -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;
......
......@@ -22,6 +22,7 @@ OBJECTS= \
gerberframe.o\
onrightclick.o\
class_board.o\
class_board_item.o\
class_drawsegment.o\
class_track.o \
class_drc_item.o \
......
......@@ -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"));
......
......@@ -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�e du centre relativement au startpoint
*
* si multiquadrant == false arc de 0 � 90 entierement contenu dans le meme quadrant
* et rel_center est la coordonn�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�e du centre relativement au startpoint
si multiquadrant == false arc de 0 � 90 entierement contenu dans le meme quadrant
et rel_center est la coordonn�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 );
......
......@@ -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:
......
......@@ -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,16 +117,15 @@ 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
{
......@@ -134,15 +133,19 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
{
int Color = g_DesignSettings.m_LayerColor[track->GetLayer()];
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;
GRClosedPoly( &DrawPanel->m_ClipBox, DC, nbpoints, coord,
filled, Color, Color );
}
......
......@@ -29,7 +29,6 @@ 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];
int dcode_hightlight = 0;
......@@ -37,22 +36,21 @@ void Draw_Track_Buffer( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int draw_
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 )
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,13 +68,16 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo
int fillopt;
static bool show_err;
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();
GRSetDrawMode( DC, draw_mode );
if( draw_mode & GR_SURBRILL )
{
if( draw_mode & GR_AND )
......@@ -86,6 +87,11 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo
}
if( color & HIGHT_LIGHT_FLAG )
color = ColorRefs[color & MASKCOLOR].m_LightColor;
}
GRSetDrawMode( DC, draw_mode );
zoom = panel->GetZoom();
rayon = l_piste = track->m_Width >> 1;
......@@ -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 )
......
......@@ -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;
......
......@@ -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,
......
/**********************************************************************************************/
/* 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 */
......@@ -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 >--------------------------------------
......
......@@ -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
#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 0x0100 /* Bit flag de Status pour structures effacee
#define DELETED (1 << 8) /* 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 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) */
......
......@@ -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
......
......@@ -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();
}
......
......@@ -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
......
......@@ -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() )
{
Pcb->m_NbPads++;
}
}
/* 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() )
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
{
*pt_liste_pad = PtPad;
PtPad->SetSubNet( 0 );
PtPad->SetSubRatsnest( 0 );
PtPad->SetParent( Module );
if( PtPad->GetNet() )
Pcb->m_NbNodes++;
pt_liste_pad++;
aPcb->m_Pads.push_back( pad );
pad->SetSubNet( 0 );
pad->SetSubRatsnest( 0 );
pad->SetParent( module );
if( pad->GetNet() )
aPcb->m_NbNodes++;
}
}
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;
......
......@@ -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;
}
......
......@@ -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
......
This diff is collapsed.
......@@ -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 ) )
{
......
......@@ -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:
case TYPE_EDGE_MODULE:
{
EDGE_MODULE* edge = (EDGE_MODULE*) item;
TRACK* TmpSegm = new TRACK( NULL );
TmpSegm->SetLayer( ( (EDGE_MODULE*) PtModStruct )->GetLayer() );
TmpSegm->SetLayer( edge->GetLayer() );
if( TmpSegm->GetLayer() == EDGE_N )
TmpSegm->SetLayer( -1 );
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->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( Pcb, TmpSegm, HOLE, marge, WRITE_CELL );
TraceSegmentPcb( Pcb, TmpSegm, VIA_IMPOSSIBLE, via_marge,
TraceSegmentPcb( aPcb, TmpSegm, HOLE, marge, WRITE_CELL );
TraceSegmentPcb( aPcb, TmpSegm, VIA_IMPOSSIBLE, via_marge,
WRITE_OR_CELL );
delete TmpSegm;
break;
}
break;
default:
break;
......@@ -249,16 +246,17 @@ 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:
case TYPE_DRAWSEGMENT:
{
DRAWSEGMENT* DrawSegm;
int type_cell = HOLE;
TRACK* TmpSegm = new TRACK( NULL );
DrawSegm = (DRAWSEGMENT*) PtStruct;
DrawSegm = (DRAWSEGMENT*) item;
TmpSegm->SetLayer( DrawSegm->GetLayer() );
if( DrawSegm->GetLayer() == EDGE_N )
{
......@@ -273,33 +271,42 @@ void PlaceCells( BOARD* Pcb, int net_code, int flag )
TmpSegm->m_Param = DrawSegm->m_Angle;
TmpSegm->SetNet( -1 );
TraceSegmentPcb( Pcb, TmpSegm, type_cell, marge, WRITE_CELL );
TraceSegmentPcb( aPcb, TmpSegm, type_cell, marge, WRITE_CELL );
// TraceSegmentPcb(Pcb, TmpSegm, VIA_IMPOSSIBLE, via_marge,WRITE_OR_CELL );
// TraceSegmentPcb(Pcb, TmpSegm, VIA_IMPOSSIBLE, via_marge,WRITE_OR_CELL );
delete TmpSegm;
break;
}
break;
case TYPE_TEXTE:
TEXTE_PCB* PtText;
PtText = (TEXTE_PCB*) item;
case TYPETEXTE:
PtText = (TEXTE_PCB*) PtStruct;
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 );
}
}
......
This diff is collapsed.
......@@ -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();
/**
......
......@@ -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;
......
......@@ -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 );
}
......@@ -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 )
{
......
......@@ -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 );
......
......@@ -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 )
/*******************************************/
......
......@@ -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 );
......
......@@ -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];
......
......@@ -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
/**
......
......@@ -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 )
/*********************************************************/
......
......@@ -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 );
......
......@@ -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();
......
......@@ -23,7 +23,7 @@ protected:
public:
MARKER( BOARD_ITEM* StructFather );
MARKER( BOARD_ITEM* aParent );
/**
* Constructor
......
......@@ -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 )
/**********************************/
......
......@@ -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 );
......
This diff is collapsed.
......@@ -39,8 +39,8 @@ 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) */
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..)
......@@ -124,9 +124,6 @@ public:
void SetPosition( const wxPoint& newpos );
void SetOrientation( int newangle );
/* Remove this from the linked list */
void UnLink();
/**
* Function IsLocked
......
......@@ -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 )
/*******************************************************************************************/
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -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()
/******************************************/
......
......@@ -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 */
......
This diff is collapsed.
......@@ -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 )
......
......@@ -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
......
......@@ -59,9 +59,6 @@ public:
*/
wxPoint& GetPosition();
void UnLink( void )
{
};
/**
* Function copy
......
......@@ -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 };
......
This diff is collapsed.
......@@ -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;
......
......@@ -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
......
This diff is collapsed.
......@@ -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 )
{
......
......@@ -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;
......
......@@ -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();
......
This diff is collapsed.
......@@ -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
{
......
......@@ -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,7 +462,7 @@ 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 )
......@@ -498,7 +498,7 @@ 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 )
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -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" );
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment