amazing free specctra software

This commit is contained in:
dickelbeck 2008-02-12 01:02:53 +00:00
parent dd141c1794
commit 2b215d81ba
12 changed files with 806 additions and 682 deletions

View File

@ -6,6 +6,21 @@ Please add newer entries at the top, list the date and your name with
email address. email address.
2008-Feb-11 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+pcbnew
* Added case TYPETRACK, TYPEVIA, and TYPEMODULE support to Board::Add() so
that we can over time hide more of the storage architecture of a BOARD and
isolate those dependencies in fewer places.
* Fixed some pad orientation issues in specctra_export.
* Added VIA_MICROVIA & VIA_BLIND_BURIED support to SPECCTRA::makeVIA().
* Commented out the specctra design import menu choice for now, don't have
time or need for this import.
* Specctra export adds 1/2 mil to clearance rules for freerouter so that
the routed board clears our DRC checker OK.
* Session import seems done now.
2008-Feb-7 UPDATE Dick Hollenbeck <dick@softplc.com> 2008-Feb-7 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
+pcbnew +pcbnew

View File

@ -20,7 +20,8 @@ void WinEDA_GerberFrame::UnDeleteItem( wxDC* DC )
/* Restitution d'un element (MODULE ou TRACK ) Efface /* Restitution d'un element (MODULE ou TRACK ) Efface
*/ */
{ {
EDA_BaseStruct* PtStruct, * PtNext; BOARD_ITEM* item;
BOARD_ITEM* next;
TRACK* pt_track; TRACK* pt_track;
int net_code; int net_code;
@ -28,25 +29,25 @@ void WinEDA_GerberFrame::UnDeleteItem( wxDC* DC )
return; return;
g_UnDeleteStackPtr--; g_UnDeleteStackPtr--;
PtStruct = g_UnDeleteStack[g_UnDeleteStackPtr]; item = g_UnDeleteStack[g_UnDeleteStackPtr];
if( PtStruct == NULL ) if( item == NULL )
return; // Ne devrait pas se produire return; // Ne devrait pas se produire
switch( PtStruct->Type() ) switch( item->Type() )
{ {
case TYPEVIA: case TYPEVIA:
case TYPETRACK: case TYPETRACK:
for( ; PtStruct != NULL; PtStruct = PtNext ) for( ; item; item = next )
{ {
PtNext = PtStruct->Pnext; next = item->Next();
PtStruct->SetState( DELETED, OFF ); /* Effacement du bit DELETED */ item->SetState( DELETED, OFF ); /* Effacement du bit DELETED */
Trace_Segment( DrawPanel, DC, (TRACK*) PtStruct, GR_OR ); Trace_Segment( DrawPanel, DC, (TRACK*) item, GR_OR );
} }
PtStruct = g_UnDeleteStack[g_UnDeleteStackPtr]; item = g_UnDeleteStack[g_UnDeleteStackPtr];
net_code = ( (TRACK*) PtStruct )->GetNet(); net_code = ((TRACK*) item)->GetNet();
pt_track = ( (TRACK*) PtStruct )->GetBestInsertPoint( m_Pcb );
( (TRACK*) PtStruct )->Insert( m_Pcb, pt_track ); m_Pcb->Add( item );
g_UnDeleteStack[g_UnDeleteStackPtr] = NULL; g_UnDeleteStack[g_UnDeleteStackPtr] = NULL;
break; break;

View File

@ -71,10 +71,10 @@ BOARD::~BOARD()
m_LocalRatsnest = 0; m_LocalRatsnest = 0;
DeleteMARKERs(); DeleteMARKERs();
DeleteZONEOutlines(); DeleteZONEOutlines();
delete m_CurrentZoneContour; delete m_CurrentZoneContour;
m_CurrentZoneContour = NULL; m_CurrentZoneContour = NULL;
} }
@ -122,11 +122,11 @@ void BOARD::UnLink()
void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl ) void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
{ {
if ( aBoardItem == NULL ) if ( aBoardItem == NULL )
{ {
wxFAIL_MSG( wxT("BOARD::Add() param error: aBoardItem NULL") ); wxFAIL_MSG( wxT("BOARD::Add() param error: aBoardItem NULL") );
return; return;
} }
switch( aBoardItem->Type() ) switch( aBoardItem->Type() )
{ {
@ -142,6 +142,26 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
m_ZoneDescriptorList.push_back( (ZONE_CONTAINER*) aBoardItem ); m_ZoneDescriptorList.push_back( (ZONE_CONTAINER*) aBoardItem );
break; break;
case TYPETRACK:
case TYPEVIA:
{
TRACK* insertAid = ((TRACK*)aBoardItem)->GetBestInsertPoint( this );
((TRACK*)aBoardItem)->Insert( this, insertAid );
}
break;
case TYPEMODULE:
// this is an insert, not an append which may also be needed.
{
aBoardItem->Pback = this;
BOARD_ITEM* next = m_Modules;
aBoardItem->Pnext = next;
if( next )
next->Pback = aBoardItem;
m_Modules = (MODULE*) aBoardItem;
}
break;
// other types may use linked list // other types may use linked list
default: default:
wxFAIL_MSG( wxT("BOARD::Add() needs work") ); wxFAIL_MSG( wxT("BOARD::Add() needs work") );
@ -151,7 +171,7 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
void BOARD::Delete( BOARD_ITEM* aBoardItem ) void BOARD::Delete( BOARD_ITEM* aBoardItem )
{ {
if ( aBoardItem == NULL ) return; if ( aBoardItem == NULL ) return;
switch( aBoardItem->Type() ) switch( aBoardItem->Type() )
{ {
@ -174,7 +194,7 @@ void BOARD::Delete( BOARD_ITEM* aBoardItem )
if( m_ZoneDescriptorList[i] == (ZONE_CONTAINER*) aBoardItem ) if( m_ZoneDescriptorList[i] == (ZONE_CONTAINER*) aBoardItem )
{ {
delete m_ZoneDescriptorList[i]; delete m_ZoneDescriptorList[i];
m_ZoneDescriptorList.erase(m_ZoneDescriptorList.begin() + i); m_ZoneDescriptorList.erase(m_ZoneDescriptorList.begin() + i);
break; break;
} }
} }
@ -518,16 +538,16 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
#if 0 // both these are on same list, so we must scan it twice in order to get VIA priority, #if 0 // both these are on same list, so we must scan it twice in order to get VIA priority,
// using new #else code below. // using new #else code below.
// But we are not using separte lists for TRACKs and SEGVIAs, because items are ordered (sortered) in the linked // But we are not using separte lists for TRACKs and SEGVIAs, because items are ordered (sortered) in the linked
// list by netcode AND by physical distance: // list by netcode AND by physical distance:
// when created, if a track or via is connected to an existing track or via, it is put in linked list // when created, if a track or via is connected to an existing track or via, it is put in linked list
// after this existing track or via // after this existing track or via
// So usually, connected tracks or vias are grouped in this list // So usually, connected tracks or vias are grouped in this list
// So the algorithm (used in rastnest computations) which computes the track connectivity is faster (more than 100 time regarding to // So the algorithm (used in rastnest computations) which computes the track connectivity is faster (more than 100 time regarding to
// a non ordered list) because when it searchs for a connexion, first it tests the near (near in term of linked list) 50 items // a non ordered list) because when it searchs for a connexion, first it tests the near (near in term of linked list) 50 items
// from the current item (track or via) in test. // from the current item (track or via) in test.
// Usually, because of this sort, a connected item (if exists) is found. // 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, // If not found (and only in this case) an exhaustive (and time consumming) search is made,
// but this case is statistically rare. // but this case is statistically rare.
case TYPEVIA: case TYPEVIA:
case TYPETRACK: case TYPETRACK:
result = IterateForward( m_Track, inspector, testData, p ); result = IterateForward( m_Track, inspector, testData, p );
@ -763,19 +783,19 @@ MODULE* BOARD::FindModuleByReference( const wxString& aReference ) const
// Sort nets by name // Sort nets by name
int s_SortByNames(const void * ptr1, const void * ptr2) int s_SortByNames(const void * ptr1, const void * ptr2)
{ {
EQUIPOT* item1 = * (EQUIPOT**) ptr1; EQUIPOT* item1 = * (EQUIPOT**) ptr1;
EQUIPOT* item2 = * (EQUIPOT**) ptr2; EQUIPOT* item2 = * (EQUIPOT**) ptr2;
return item1->m_Netname.CmpNoCase(item2->m_Netname); return item1->m_Netname.CmpNoCase(item2->m_Netname);
} }
// Sort nets by decreasing pad count // Sort nets by decreasing pad count
int s_SortByNodes(const void * ptr1, const void * ptr2) int s_SortByNodes(const void * ptr1, const void * ptr2)
{ {
EQUIPOT* item1 = * (EQUIPOT**) ptr1; EQUIPOT* item1 = * (EQUIPOT**) ptr1;
EQUIPOT* item2 = * (EQUIPOT**) ptr2; EQUIPOT* item2 = * (EQUIPOT**) ptr2;
if ( (item1->m_NbNodes - item2->m_NbNodes) != 0 ) if ( (item1->m_NbNodes - item2->m_NbNodes) != 0 )
return - (item1->m_NbNodes - item2->m_NbNodes); return - (item1->m_NbNodes - item2->m_NbNodes);
return item1->m_Netname.CmpNoCase(item2->m_Netname); return item1->m_Netname.CmpNoCase(item2->m_Netname);
} }
@ -788,52 +808,52 @@ int s_SortByNodes(const void * ptr1, const void * ptr2)
*/ */
int BOARD::ReturnSortedNetnamesList( wxArrayString & aNames, const int aSort_Type) int BOARD::ReturnSortedNetnamesList( wxArrayString & aNames, const int aSort_Type)
{ {
int NetCount = 0; int NetCount = 0;
int ii; int ii;
EQUIPOT* net; EQUIPOT* net;
/* count items to list and sort */ /* count items to list and sort */
for( net = m_Equipots; net; net=net->Next() ) for( net = m_Equipots; net; net=net->Next() )
{ {
if ( net->m_Netname.IsEmpty() ) continue; if ( net->m_Netname.IsEmpty() ) continue;
NetCount++; NetCount++;
} }
if ( NetCount == 0 ) return 0; if ( NetCount == 0 ) return 0;
/* Build the list */ /* Build the list */
EQUIPOT* * net_ptr_list = (EQUIPOT* *) MyMalloc( NetCount * sizeof(* net_ptr_list) ); EQUIPOT* * net_ptr_list = (EQUIPOT* *) MyMalloc( NetCount * sizeof(* net_ptr_list) );
for( ii = 0, net = m_Equipots; net; net=net->Next() ) for( ii = 0, net = m_Equipots; net; net=net->Next() )
{ {
if ( net->m_Netname.IsEmpty() ) continue; if ( net->m_Netname.IsEmpty() ) continue;
net_ptr_list[ii] = net; net_ptr_list[ii] = net;
ii++; ii++;
} }
/* sort the list */ /* sort the list */
switch ( aSort_Type ) switch ( aSort_Type )
{ {
case NO_SORT : break; case NO_SORT : break;
case ALPHA_SORT : case ALPHA_SORT :
qsort (net_ptr_list, NetCount, sizeof(EQUIPOT*), s_SortByNames); qsort (net_ptr_list, NetCount, sizeof(EQUIPOT*), s_SortByNames);
break; break;
case PAD_CNT_SORT: case PAD_CNT_SORT:
qsort (net_ptr_list, NetCount, sizeof(EQUIPOT*), s_SortByNodes); qsort (net_ptr_list, NetCount, sizeof(EQUIPOT*), s_SortByNodes);
break; break;
} }
/* fill the given list */ /* fill the given list */
for( ii = 0; ii < NetCount; ii++ ) for( ii = 0; ii < NetCount; ii++ )
{ {
net = net_ptr_list[ii]; net = net_ptr_list[ii];
aNames.Add(net->m_Netname); aNames.Add(net->m_Netname);
} }
MyFree(net_ptr_list); MyFree(net_ptr_list);
return NetCount; return NetCount;
} }
/************************************/ /************************************/
@ -891,11 +911,11 @@ bool BOARD::Save( FILE* aFile ) const
fprintf( aFile, "$EndZONE\n" ); fprintf( aFile, "$EndZONE\n" );
// save the zone edges // save the zone edges
for( unsigned ii = 0; ii < m_ZoneDescriptorList.size(); ii++ ) for( unsigned ii = 0; ii < m_ZoneDescriptorList.size(); ii++ )
{ {
ZONE_CONTAINER* edge_zone = m_ZoneDescriptorList[ii]; ZONE_CONTAINER* edge_zone = m_ZoneDescriptorList[ii];
edge_zone->Save( aFile ); edge_zone->Save( aFile );
} }
if( fprintf( aFile, "$EndBOARD\n" ) != sizeof("$EndBOARD\n")-1 ) if( fprintf( aFile, "$EndBOARD\n" ) != sizeof("$EndBOARD\n")-1 )
@ -917,12 +937,12 @@ void BOARD::RedrawAreasOutlines(WinEDA_DrawPanel* panel, wxDC * aDC, int aDrawMo
{ {
if ( ! aDC ) return; if ( ! aDC ) return;
for( int ii = 0; ii < GetAreaCount(); ii++ ) for( int ii = 0; ii < GetAreaCount(); ii++ )
{ {
ZONE_CONTAINER* edge_zone = GetArea(ii); ZONE_CONTAINER* edge_zone = GetArea(ii);
if( (aLayer < 0) || (aLayer == edge_zone->GetLayer()) ) if( (aLayer < 0) || (aLayer == edge_zone->GetLayer()) )
edge_zone->Draw( panel, aDC, wxPoint( 0, 0 ), aDrawMode ); edge_zone->Draw( panel, aDC, wxPoint( 0, 0 ), aDrawMode );
} }
} }

View File

@ -71,6 +71,8 @@ public:
* @param aControl An int which can vary how the item is added. * @param aControl An int which can vary how the item is added.
*/ */
void Add( BOARD_ITEM* aBoardItem, int aControl = 0 ); void Add( BOARD_ITEM* aBoardItem, int aControl = 0 );
#define ADD_APPEND 1 ///< aControl flag for Add( aControl ), appends not inserts
/** /**
* Function Delete * Function Delete
@ -90,7 +92,7 @@ public:
* Function DeleteZONEOutlines * Function DeleteZONEOutlines
* deletes ALL zone outlines from the board. * deletes ALL zone outlines from the board.
*/ */
void DeleteZONEOutlines(); void DeleteZONEOutlines();
/** /**
@ -221,11 +223,11 @@ public:
* @param aSort_Type : NO_SORT = no sort, ALPHA_SORT = sort by alphabetic order, PAD_CNT_SORT = sort by active pads count. * @param aSort_Type : NO_SORT = no sort, ALPHA_SORT = sort by alphabetic order, PAD_CNT_SORT = sort by active pads count.
* @return int - net names count. * @return int - net names count.
*/ */
enum netname_sort_type { enum netname_sort_type {
NO_SORT, NO_SORT,
ALPHA_SORT, ALPHA_SORT,
PAD_CNT_SORT PAD_CNT_SORT
}; };
int ReturnSortedNetnamesList( wxArrayString & aNames, const int aSort_Type); int ReturnSortedNetnamesList( wxArrayString & aNames, const int aSort_Type);
@ -260,33 +262,33 @@ public:
#endif #endif
/**************************/ /**************************/
/* footprint operations : */ /* footprint operations : */
/**************************/ /**************************/
void Change_Side_Module( MODULE* Module, wxDC* DC ); void Change_Side_Module( MODULE* Module, wxDC* DC );
/*************************/ /*************************/
/* Copper Areas handling */ /* Copper Areas handling */
/*************************/ /*************************/
/** /**
* Function RedrawAreasOutlines * Function RedrawAreasOutlines
* Redraw all areas outlines on layer aLayer ( redraw all if aLayer < 0 ) * Redraw all areas outlines on layer aLayer ( redraw all if aLayer < 0 )
*/ */
void RedrawAreasOutlines(WinEDA_DrawPanel* panel, wxDC * aDC, int aDrawMode, int aLayer); void RedrawAreasOutlines(WinEDA_DrawPanel* panel, wxDC * aDC, int aDrawMode, int aLayer);
/** /**
* Function SetAreasNetCodesFromNetNames * Function SetAreasNetCodesFromNetNames
* Set the .m_NetCode member of all copper areas, according to the area Net Name * Set the .m_NetCode member of all copper areas, according to the area Net Name
* The SetNetCodesFromNetNames is an equivalent to net name, for fas comparisons. * The SetNetCodesFromNetNames is an equivalent to net name, for fas comparisons.
* However the Netcode is an arbitrary equyivalence, it must be set after each netlist read * However the Netcode is an arbitrary equyivalence, it must be set after each netlist read
* or net change * or net change
* Must be called after pad netcodes are calculated * Must be called after pad netcodes are calculated
* @return : error count * @return : error count
*/ */
int SetAreasNetCodesFromNetNames(void); int SetAreasNetCodesFromNetNames(void);
/** /**
* Function GetArea * Function GetArea
* returns the Area (Zone Container) at a given index. * returns the Area (Zone Container) at a given index.
* @param index The array type index into a collection of ZONE_CONTAINER *. * @param index The array type index into a collection of ZONE_CONTAINER *.
@ -299,7 +301,7 @@ public:
return NULL; return NULL;
} }
/** /**
* Function GetAreaIndex * Function GetAreaIndex
* returns the Area Index for the given Zone Container. * returns the Area Index for the given Zone Container.
* @param aArea :The ZONE_CONTAINER to find. * @param aArea :The ZONE_CONTAINER to find.
@ -308,10 +310,10 @@ public:
int GetAreaIndex( const ZONE_CONTAINER* aArea) const int GetAreaIndex( const ZONE_CONTAINER* aArea) const
{ {
for( int ii = 0; ii < GetAreaCount(); ii++ ) // Search for aArea in list for( int ii = 0; ii < GetAreaCount(); ii++ ) // Search for aArea in list
{ {
if ( aArea == GetArea( ii ) ) // Found ! if ( aArea == GetArea( ii ) ) // Found !
return ii; return ii;
} }
return -1; return -1;
} }
@ -324,132 +326,132 @@ public:
return (int) m_ZoneDescriptorList.size(); return (int) m_ZoneDescriptorList.size();
} }
/* Functions used in test, merge and cut outlines */ /* Functions used in test, merge and cut outlines */
/** /**
* Function AddArea * Function AddArea
* add empty copper area to net * add empty copper area to net
* @return pointer to the new area * @return pointer to the new area
*/ */
ZONE_CONTAINER* AddArea( int netcode, int layer, int x, int y, int hatch ); ZONE_CONTAINER* AddArea( int netcode, int layer, int x, int y, int hatch );
/** /**
* remove copper area from net * remove copper area from net
* @param area = area to remove * @param area = area to remove
* @return 0 * @return 0
*/ */
int RemoveArea( ZONE_CONTAINER* area_to_remove ); int RemoveArea( ZONE_CONTAINER* area_to_remove );
/** /**
* Function InsertArea * Function InsertArea
* add empty copper area to net, inserting after m_ZoneDescriptorList[iarea] * add empty copper area to net, inserting after m_ZoneDescriptorList[iarea]
* @return pointer to the new area * @return pointer to the new area
*/ */
ZONE_CONTAINER* InsertArea( int netcode, int iarea, int layer, int x, int y, int hatch ); ZONE_CONTAINER* InsertArea( int netcode, int iarea, int layer, int x, int y, int hatch );
/** /**
Function CompleteArea Function CompleteArea
* complete copper area contour by adding a line from last to first corner * complete copper area contour by adding a line from last to first corner
* if there is only 1 or 2 corners, remove (delete) the area * if there is only 1 or 2 corners, remove (delete) the area
* @param area_to_complete = area to complete or remove * @param area_to_complete = area to complete or remove
* @param style = style of last corner * @param style = style of last corner
* @return 1 if Ok, 0 if area removed * @return 1 if Ok, 0 if area removed
*/ */
int CompleteArea( ZONE_CONTAINER* area_to_complete, int style ); int CompleteArea( ZONE_CONTAINER* area_to_complete, int style );
/** /**
* Function TestAreaPolygon * Function TestAreaPolygon
* Test an area for self-intersection. * Test an area for self-intersection.
* *
* @param CurrArea = copper area to test * @param CurrArea = copper area to test
* @return : * @return :
* -1 if arcs intersect other sides * -1 if arcs intersect other sides
* 0 if no intersecting sides * 0 if no intersecting sides
* 1 if intersecting sides, but no intersecting arcs * 1 if intersecting sides, but no intersecting arcs
* Also sets utility2 flag of area with return value * Also sets utility2 flag of area with return value
*/ */
int TestAreaPolygon( ZONE_CONTAINER* CurrArea ); int TestAreaPolygon( ZONE_CONTAINER* CurrArea );
/** /**
* Function ClipAreaPolygon * Function ClipAreaPolygon
* Process an area that has been modified, by clipping its polygon against itself. * Process an area that has been modified, by clipping its polygon against itself.
* This may change the number and order of copper areas in the net. * This may change the number and order of copper areas in the net.
* @param bMessageBoxInt == TRUE, shows message when clipping occurs. * @param bMessageBoxInt == TRUE, shows message when clipping occurs.
* @param bMessageBoxArc == TRUE, shows message when clipping can't be done due to arcs. * @param bMessageBoxArc == TRUE, shows message when clipping can't be done due to arcs.
* @return: * @return:
* -1 if arcs intersect other sides, so polygon can't be clipped * -1 if arcs intersect other sides, so polygon can't be clipped
* 0 if no intersecting sides * 0 if no intersecting sides
* 1 if intersecting sides * 1 if intersecting sides
* Also sets areas->utility1 flags if areas are modified * Also sets areas->utility1 flags if areas are modified
*/ */
int ClipAreaPolygon( ZONE_CONTAINER* CurrArea, int ClipAreaPolygon( ZONE_CONTAINER* CurrArea,
bool bMessageBoxArc, bool bMessageBoxInt, bool bRetainArcs = TRUE ); bool bMessageBoxArc, bool bMessageBoxInt, bool bRetainArcs = TRUE );
/** /**
* Process an area that has been modified, by clipping its polygon against * Process an area that has been modified, by clipping its polygon against
* itself and the polygons for any other areas on the same net. * itself and the polygons for any other areas on the same net.
* This may change the number and order of copper areas in the net. * This may change the number and order of copper areas in the net.
* @param modified_area = area to test * @param modified_area = area to test
* @param bMessageBox : if TRUE, shows message boxes when clipping occurs. * @param bMessageBox : if TRUE, shows message boxes when clipping occurs.
* @return : * @return :
* -1 if arcs intersect other sides, so polygon can't be clipped * -1 if arcs intersect other sides, so polygon can't be clipped
* 0 if no intersecting sides * 0 if no intersecting sides
* 1 if intersecting sides, polygon clipped * 1 if intersecting sides, polygon clipped
*/ */
int AreaPolygonModified( ZONE_CONTAINER* modified_area, int AreaPolygonModified( ZONE_CONTAINER* modified_area,
bool bMessageBoxArc, bool bMessageBoxArc,
bool bMessageBoxInt ); bool bMessageBoxInt );
/** /**
* Function CombineAllAreasInNet * Function CombineAllAreasInNet
* Checks all copper areas in net for intersections, combining them if found * Checks all copper areas in net for intersections, combining them if found
* @param aNetCode = net to consider * @param aNetCode = net to consider
* @param bMessageBox : if true display warning message box * @param bMessageBox : if true display warning message box
* @param bUseUtility : if true, don't check areas if both utility flags are 0 * @param bUseUtility : if true, don't check areas if both utility flags are 0
* Sets utility flag = 1 for any areas modified * Sets utility flag = 1 for any areas modified
* If an area has self-intersecting arcs, doesn't try to combine it * If an area has self-intersecting arcs, doesn't try to combine it
*/ */
int CombineAllAreasInNet( int aNetCode, bool bMessageBox, bool bUseUtility ); int CombineAllAreasInNet( int aNetCode, bool bMessageBox, bool bUseUtility );
/** /**
* Function TestAreaIntersections * Function TestAreaIntersections
* Check for intersection of a given copper area with other areas in same net * Check for intersection of a given copper area with other areas in same net
* @param area_to_test = area to compare to all other areas in the same net * @param area_to_test = area to compare to all other areas in the same net
*/ */
bool TestAreaIntersections( ZONE_CONTAINER* area_to_test ); bool TestAreaIntersections( ZONE_CONTAINER* area_to_test );
/** /**
* Function TestAreaIntersection * Function TestAreaIntersection
* Test for intersection of 2 copper areas * Test for intersection of 2 copper areas
* area_to_test must be after area_ref in m_ZoneDescriptorList * area_to_test must be after area_ref in m_ZoneDescriptorList
* @param area_ref = area reference * @param area_ref = area reference
* @param area_to_test = area to compare for intersection calculations * @param area_to_test = area to compare for intersection calculations
* @return : 0 if no intersection * @return : 0 if no intersection
* 1 if intersection * 1 if intersection
* 2 if arcs intersect * 2 if arcs intersect
*/ */
int TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_to_test ); int TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_to_test );
/** /**
* Function CombineAreas * Function CombineAreas
* If possible, combine 2 copper areas * If possible, combine 2 copper areas
* area_ref must be BEFORE area_to_combine * area_ref must be BEFORE area_to_combine
* area_to_combine will be deleted, if areas are combined * area_to_combine will be deleted, if areas are combined
* @return : 0 if no intersection * @return : 0 if no intersection
* 1 if intersection * 1 if intersection
* 2 if arcs intersect * 2 if arcs intersect
*/ */
int CombineAreas( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_to_combine ); int CombineAreas( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_to_combine );
/** /**
* Function Test_Drc_Areas_Outlines_To_Areas_Outlines * Function Test_Drc_Areas_Outlines_To_Areas_Outlines
* Test Areas outlines for DRC: * Test Areas outlines for DRC:
* Test areas inside other areas * Test areas inside other areas
* Test areas too close * Test areas too close
* @param aArea_To_Examine: area to compare with other areas. if NULL: all areas are compared tp all others * @param aArea_To_Examine: area to compare with other areas. if NULL: all areas are compared tp all others
* @param aCreate_Markers: if true create DRC markers. False: do not creates anything * @param aCreate_Markers: if true create DRC markers. False: do not creates anything
* @return errors count * @return errors count
*/ */
int Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_Examine,bool aCreate_Markers ); int Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_Examine,bool aCreate_Markers );
}; };
#endif // #ifndef CLASS_BOARD_H #endif // #ifndef CLASS_BOARD_H

View File

@ -150,7 +150,7 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
m_ViaDrill = 250; // defualt via drill (for the entire board) m_ViaDrill = 250; // defualt via drill (for the entire board)
m_ViaDrillCustomValue = 250; // via drill for vias which must have a defined drill value m_ViaDrillCustomValue = 250; // via drill for vias which must have a defined drill value
m_CurrentViaSize = 450; // Current via size m_CurrentViaSize = 450; // Current via size
m_CurrentViaType = VIA_THROUGH; // via type (VIA_BLIND_BURIED, VIA_TROUGHT VIA_MICROVIA) m_CurrentViaType = VIA_THROUGH; // via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA)
m_CurrentTrackWidth = 170; // current track width m_CurrentTrackWidth = 170; // current track width
m_UseConnectedTrackWidth = false; // if true, when creating a new track starting on an existing track, use this track width m_UseConnectedTrackWidth = false; // if true, when creating a new track starting on an existing track, use this track width
m_MicroViaDrill = 50; // micro via drill (for the entire board) m_MicroViaDrill = 50; // micro via drill (for the entire board)

View File

@ -387,7 +387,6 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC )
* Routine de fin de trace d'une piste (succession de segments) * Routine de fin de trace d'une piste (succession de segments)
*/ */
{ {
TRACK* pt_track;
int masquelayer = g_TabOneLayerMask[GetScreen()->m_Active_Layer]; int masquelayer = g_TabOneLayerMask[GetScreen()->m_Active_Layer];
wxPoint pos; wxPoint pos;
EDA_BaseStruct* LockPoint; EDA_BaseStruct* LockPoint;
@ -453,11 +452,8 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC )
/* Test if no segment left. Can happend on a double click on the start point */ /* Test if no segment left. Can happend on a double click on the start point */
if( g_FirstTrackSegment != NULL ) if( g_FirstTrackSegment != NULL )
{ {
/* Put new track in buffer: search the best insertion poinr */ // Put new track in board
pt_track = g_FirstTrackSegment->GetBestInsertPoint( m_Pcb ); m_Pcb->Add( g_FirstTrackSegment );
/* Uut track in linked list */
g_FirstTrackSegment->Insert( m_Pcb, pt_track );
trace_ratsnest_pad( DC ); trace_ratsnest_pad( DC );
Trace_Une_Piste( DrawPanel, DC, g_FirstTrackSegment, g_TrackSegmentCount, GR_OR ); Trace_Une_Piste( DrawPanel, DC, g_FirstTrackSegment, g_TrackSegmentCount, GR_OR );
@ -466,7 +462,8 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC )
TRACK* ptr = g_FirstTrackSegment; int ii; TRACK* ptr = g_FirstTrackSegment; int ii;
for( ii = 0; (ptr != NULL) && (ii < g_TrackSegmentCount); ii++ ) for( ii = 0; (ptr != NULL) && (ii < g_TrackSegmentCount); ii++ )
{ {
ptr->m_Flags = 0; ptr = ptr->Next(); ptr->m_Flags = 0;
ptr = ptr->Next();
} }
/* Delete the old track, if exists */ /* Delete the old track, if exists */
@ -527,16 +524,16 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
/* dessin de la nouvelle piste : mise a jour du point d'arrivee */ /* dessin de la nouvelle piste : mise a jour du point d'arrivee */
g_CurrentTrackSegment->SetLayer( screen->m_Active_Layer ); g_CurrentTrackSegment->SetLayer( screen->m_Active_Layer );
if( ! g_DesignSettings.m_UseConnectedTrackWidth ) if( ! g_DesignSettings.m_UseConnectedTrackWidth )
g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth; g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth;
if( g_TwoSegmentTrackBuild ) if( g_TwoSegmentTrackBuild )
{ {
TRACK* previous_track = (TRACK*) g_CurrentTrackSegment->Pback; TRACK* previous_track = (TRACK*) g_CurrentTrackSegment->Pback;
if( previous_track && (previous_track->Type() == TYPETRACK) ) if( previous_track && (previous_track->Type() == TYPETRACK) )
{ {
previous_track->SetLayer( screen->m_Active_Layer ); previous_track->SetLayer( screen->m_Active_Layer );
if( ! g_DesignSettings.m_UseConnectedTrackWidth ) if( ! g_DesignSettings.m_UseConnectedTrackWidth )
previous_track->m_Width = g_DesignSettings.m_CurrentTrackWidth; previous_track->m_Width = g_DesignSettings.m_CurrentTrackWidth;
} }
} }
if( Track_45_Only ) if( Track_45_Only )

View File

@ -30,313 +30,315 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
int ii; int ii;
wxMenuBar * menuBar = GetMenuBar(); wxMenuBar * menuBar = GetMenuBar();
if( menuBar == NULL ) if( menuBar == NULL )
{ {
menuBar = new wxMenuBar(); menuBar = new wxMenuBar();
////////////////// //////////////////
// Menu "Files" // // Menu "Files" //
////////////////// //////////////////
m_FilesMenu = new wxMenu; m_FilesMenu = new wxMenu;
wxMenuItem *item = new wxMenuItem(m_FilesMenu, ID_MENU_LOAD_FILE, wxMenuItem *item = new wxMenuItem(m_FilesMenu, ID_MENU_LOAD_FILE,
_("Load Board Ctrl-O"), _("Load Board Ctrl-O"),
_("Delete old Board and Load new Board")); _("Delete old Board and Load new Board"));
item->SetBitmap(open_xpm); item->SetBitmap(open_xpm);
m_FilesMenu->Append(item); m_FilesMenu->Append(item);
item = new wxMenuItem(m_FilesMenu, ID_MENU_APPEND_FILE, item = new wxMenuItem(m_FilesMenu, ID_MENU_APPEND_FILE,
_("Append Board"), _("Append Board"),
_("Add Board to old Board")); _("Add Board to old Board"));
item->SetBitmap(import_xpm); item->SetBitmap(import_xpm);
m_FilesMenu->Append(item); m_FilesMenu->Append(item);
item = new wxMenuItem(m_FilesMenu, ID_MENU_NEW_BOARD, item = new wxMenuItem(m_FilesMenu, ID_MENU_NEW_BOARD,
_("&New board"), _("&New board"),
_("Clear old PCB and init a new one")); _("Clear old PCB and init a new one"));
item->SetBitmap(new_xpm); item->SetBitmap(new_xpm);
m_FilesMenu->Append(item); m_FilesMenu->Append(item);
item = new wxMenuItem(m_FilesMenu, ID_MENU_RECOVER_BOARD, item = new wxMenuItem(m_FilesMenu, ID_MENU_RECOVER_BOARD,
_("&Rescue"), _("&Rescue"),
_("Clear old board and get last rescue file")); _("Clear old board and get last rescue file"));
item->SetBitmap(hammer_xpm); item->SetBitmap(hammer_xpm);
m_FilesMenu->Append(item); m_FilesMenu->Append(item);
item = new wxMenuItem(m_FilesMenu, ID_MENU_READ_LAST_SAVED_VERSION_BOARD, item = new wxMenuItem(m_FilesMenu, ID_MENU_READ_LAST_SAVED_VERSION_BOARD,
_("&Previous version"), _("&Previous version"),
_("Clear old board and get old version of board") ); _("Clear old board and get old version of board") );
item->SetBitmap(jigsaw_xpm); item->SetBitmap(jigsaw_xpm);
m_FilesMenu->Append(item); m_FilesMenu->Append(item);
// Add save menu // Add save menu
m_FilesMenu->AppendSeparator(); m_FilesMenu->AppendSeparator();
item = new wxMenuItem(m_FilesMenu, ID_MENU_SAVE_BOARD, item = new wxMenuItem(m_FilesMenu, ID_MENU_SAVE_BOARD,
_("&Save board Ctrl-S"), _("&Save board Ctrl-S"),
_("Save current board") ); _("Save current board") );
item->SetBitmap(save_xpm); item->SetBitmap(save_xpm);
m_FilesMenu->Append(item); m_FilesMenu->Append(item);
item = new wxMenuItem(m_FilesMenu, ID_MENU_SAVE_BOARD_AS, item = new wxMenuItem(m_FilesMenu, ID_MENU_SAVE_BOARD_AS,
_("Save Board as.."), _("Save Board as.."),
_("Save current board as..") ); _("Save current board as..") );
item->SetBitmap(save_as_xpm); item->SetBitmap(save_as_xpm);
m_FilesMenu->Append(item); m_FilesMenu->Append(item);
// Add print menu // Add print menu
m_FilesMenu->AppendSeparator(); m_FilesMenu->AppendSeparator();
item = new wxMenuItem(m_FilesMenu, ID_GEN_PRINT, item = new wxMenuItem(m_FilesMenu, ID_GEN_PRINT,
_("P&rint"), _("Print on current printer")); _("P&rint"), _("Print on current printer"));
item->SetBitmap(print_button); item->SetBitmap(print_button);
m_FilesMenu->Append(item); m_FilesMenu->Append(item);
// Add plot menu // Add plot menu
item = new wxMenuItem(m_FilesMenu, ID_GEN_PLOT, _("&Plot"), item = new wxMenuItem(m_FilesMenu, ID_GEN_PLOT, _("&Plot"),
_("Plot (HPGL, PostScript, or Gerber format)")); _("Plot (HPGL, PostScript, or Gerber format)"));
item->SetBitmap(plot_xpm); item->SetBitmap(plot_xpm);
m_FilesMenu->Append(item); m_FilesMenu->Append(item);
// Add Export menu // Add Export menu
m_FilesMenu->AppendSeparator(); m_FilesMenu->AppendSeparator();
wxMenu * submenuexport = new wxMenu(); wxMenu * submenuexport = new wxMenu();
item = new wxMenuItem(submenuexport, ID_GEN_EXPORT_SPECCTRA, item = new wxMenuItem(submenuexport, ID_GEN_EXPORT_SPECCTRA,
_("&Specctra DSN"), _("Export the current board to a \"Specctra DSN\" file") ); _("&Specctra DSN"), _("Export the current board to a \"Specctra DSN\" file") );
item->SetBitmap(export_xpm); item->SetBitmap(export_xpm);
submenuexport->Append(item); submenuexport->Append(item);
item = new wxMenuItem(submenuexport, ID_GEN_EXPORT_FILE_GENCADFORMAT, item = new wxMenuItem(submenuexport, ID_GEN_EXPORT_FILE_GENCADFORMAT,
_("&GenCAD"), _("Export GenCAD Format") ); _("&GenCAD"), _("Export GenCAD Format") );
item->SetBitmap(export_xpm); item->SetBitmap(export_xpm);
submenuexport->Append(item); submenuexport->Append(item);
item = new wxMenuItem(submenuexport, ID_GEN_EXPORT_FILE_MODULE_REPORT, item = new wxMenuItem(submenuexport, ID_GEN_EXPORT_FILE_MODULE_REPORT,
_("&Module report"), _("Create a pcb report (footprint report)") ); _("&Module report"), _("Create a pcb report (footprint report)") );
item->SetBitmap(tools_xpm); item->SetBitmap(tools_xpm);
submenuexport->Append(item); submenuexport->Append(item);
ADD_MENUITEM_WITH_HELP_AND_SUBMENU(m_FilesMenu, submenuexport, ADD_MENUITEM_WITH_HELP_AND_SUBMENU(m_FilesMenu, submenuexport,
ID_GEN_EXPORT_FILE, _("E&xport"), _("Export board"), export_xpm); ID_GEN_EXPORT_FILE, _("E&xport"), _("Export board"), export_xpm);
//-----<Add import menu>----------------------------------------------- //-----<Add import menu>-----------------------------------------------
// no separator, keep it next to Import // no separator, keep it next to Import
wxMenu * submenuImport = new wxMenu(); wxMenu * submenuImport = new wxMenu();
item = new wxMenuItem(submenuImport, ID_GEN_IMPORT_SPECCTRA_SESSION, item = new wxMenuItem(submenuImport, ID_GEN_IMPORT_SPECCTRA_SESSION,
_("&Specctra Session"), _("Import a routed \"Specctra Session\" (*.ses) file") ); _("&Specctra Session"), _("Import a routed \"Specctra Session\" (*.ses) file") );
item->SetBitmap(export_xpm); // @todo need better bitmap item->SetBitmap(export_xpm); // @todo need better bitmap
submenuImport->Append(item); submenuImport->Append(item);
item = new wxMenuItem(submenuImport, ID_GEN_IMPORT_SPECCTRA_DESIGN, /* would be implemented in WinEDA_PcbFrame::ImportSpecctraDesign() in specctra_import.cpp
_("&Specctra Design"), _("Import a \"Specctra Design\" (*.dsn) file") ); item = new wxMenuItem(submenuImport, ID_GEN_IMPORT_SPECCTRA_DESIGN,
item->SetBitmap(export_xpm); // @todo need better bitmap _("&Specctra Design"), _("Import a \"Specctra Design\" (*.dsn) file") );
submenuImport->Append(item); item->SetBitmap(export_xpm); // @todo need better bitmap
submenuImport->Append(item);
*/
ADD_MENUITEM_WITH_HELP_AND_SUBMENU(m_FilesMenu, submenuImport, ADD_MENUITEM_WITH_HELP_AND_SUBMENU(m_FilesMenu, submenuImport,
ID_GEN_IMPORT_FILE, _("Import"), _("Import files"), export_xpm); ID_GEN_IMPORT_FILE, _("Import"), _("Import files"), export_xpm);
//-----</Add import menu>---------------------------------------------- //-----</Add import menu>----------------------------------------------
// Add archive footprints menu // Add archive footprints menu
m_FilesMenu->AppendSeparator(); m_FilesMenu->AppendSeparator();
wxMenu * submenuarchive = new wxMenu(); wxMenu * submenuarchive = new wxMenu();
item = new wxMenuItem(submenuarchive, ID_MENU_ARCHIVE_NEW_MODULES, item = new wxMenuItem(submenuarchive, ID_MENU_ARCHIVE_NEW_MODULES,
_("Add new footprints"), _("Add new footprints"),
_("Archive new footprints only in a library (keep other footprints in this lib)") ); _("Archive new footprints only in a library (keep other footprints in this lib)") );
item->SetBitmap(library_update_xpm); item->SetBitmap(library_update_xpm);
submenuarchive->Append(item); submenuarchive->Append(item);
item = new wxMenuItem(submenuarchive, ID_MENU_ARCHIVE_ALL_MODULES, item = new wxMenuItem(submenuarchive, ID_MENU_ARCHIVE_ALL_MODULES,
_("Create footprint archive"), _("Create footprint archive"),
_("Archive all footprints in a library(old lib will be deleted)") ); _("Archive all footprints in a library(old lib will be deleted)") );
item->SetBitmap(library_xpm); item->SetBitmap(library_xpm);
submenuarchive->Append(item); submenuarchive->Append(item);
ADD_MENUITEM_WITH_HELP_AND_SUBMENU(m_FilesMenu, submenuarchive, ADD_MENUITEM_WITH_HELP_AND_SUBMENU(m_FilesMenu, submenuarchive,
ID_MENU_ARCHIVE_MODULES, ID_MENU_ARCHIVE_MODULES,
_("Archive footprints"), _("Archive footprints"),
_("Archive or Add footprints in a library file"), library_xpm); _("Archive or Add footprints in a library file"), library_xpm);
// Add exit menu // Add exit menu
m_FilesMenu->AppendSeparator(); m_FilesMenu->AppendSeparator();
item = new wxMenuItem(m_FilesMenu, ID_EXIT, _("E&xit"), _("Quit pcbnew") ); item = new wxMenuItem(m_FilesMenu, ID_EXIT, _("E&xit"), _("Quit pcbnew") );
item->SetBitmap(exit_xpm); item->SetBitmap(exit_xpm);
m_FilesMenu->Append(item); m_FilesMenu->Append(item);
// Creation des selections des anciens fichiers // Creation des selections des anciens fichiers
m_FilesMenu->AppendSeparator(); m_FilesMenu->AppendSeparator();
int max_file = m_Parent->m_LastProjectMaxCount; int max_file = m_Parent->m_LastProjectMaxCount;
for ( ii = 0; ii < max_file; ii++ ) for ( ii = 0; ii < max_file; ii++ )
{ {
if ( GetLastProject(ii).IsEmpty() ) break; if ( GetLastProject(ii).IsEmpty() ) break;
m_FilesMenu->Append(ID_LOAD_FILE_1 + ii, GetLastProject(ii) ); m_FilesMenu->Append(ID_LOAD_FILE_1 + ii, GetLastProject(ii) );
} }
/////////////////////////////////// ///////////////////////////////////
// Configuration et preferences: // // Configuration et preferences: //
/////////////////////////////////// ///////////////////////////////////
wxMenu * configmenu = new wxMenu; wxMenu * configmenu = new wxMenu;
item = new wxMenuItem(configmenu, ID_CONFIG_REQ, _("&Libs and Dir"), item = new wxMenuItem(configmenu, ID_CONFIG_REQ, _("&Libs and Dir"),
_("Setting Libraries, Directories and others...")); _("Setting Libraries, Directories and others..."));
item->SetBitmap(library_xpm); item->SetBitmap(library_xpm);
configmenu->Append(item); configmenu->Append(item);
item = new wxMenuItem(configmenu, ID_COLORS_SETUP, _("&Colors"), item = new wxMenuItem(configmenu, ID_COLORS_SETUP, _("&Colors"),
_("Select Colors and Display for PCB items")); _("Select Colors and Display for PCB items"));
item->SetBitmap(palette_xpm); item->SetBitmap(palette_xpm);
configmenu->Append(item); configmenu->Append(item);
item = new wxMenuItem(configmenu, ID_OPTIONS_SETUP, _("&General Options"), item = new wxMenuItem(configmenu, ID_OPTIONS_SETUP, _("&General Options"),
_("Select general options for pcbnew")); _("Select general options for pcbnew"));
item->SetBitmap(preference_xpm); item->SetBitmap(preference_xpm);
configmenu->Append(item); configmenu->Append(item);
item = new wxMenuItem(configmenu, ID_PCB_LOOK_SETUP, _("&Display Options"), item = new wxMenuItem(configmenu, ID_PCB_LOOK_SETUP, _("&Display Options"),
_("Select what items are displayed")); _("Select what items are displayed"));
item->SetBitmap(display_options_xpm); item->SetBitmap(display_options_xpm);
configmenu->Append(item); configmenu->Append(item);
// Font selection and setup // Font selection and setup
AddFontSelectionMenu(configmenu); AddFontSelectionMenu(configmenu);
m_Parent->SetLanguageList(configmenu); m_Parent->SetLanguageList(configmenu);
configmenu->AppendSeparator(); configmenu->AppendSeparator();
item = new wxMenuItem(configmenu, ID_CONFIG_SAVE, _("&Save preferences"), item = new wxMenuItem(configmenu, ID_CONFIG_SAVE, _("&Save preferences"),
_("Save application preferences")); _("Save application preferences"));
item->SetBitmap(save_setup_xpm); item->SetBitmap(save_setup_xpm);
configmenu->Append(item); configmenu->Append(item);
item = new wxMenuItem(configmenu, ID_CONFIG_READ, _("&Read preferences"), item = new wxMenuItem(configmenu, ID_CONFIG_READ, _("&Read preferences"),
_("Read application preferences")); _("Read application preferences"));
item->SetBitmap(read_setup_xpm); item->SetBitmap(read_setup_xpm);
configmenu->Append(item); configmenu->Append(item);
configmenu->AppendSeparator(); configmenu->AppendSeparator();
AddHotkeyConfigMenu( configmenu ); AddHotkeyConfigMenu( configmenu );
///////////////////////////// /////////////////////////////
// Ajustage de dimensions: // // Ajustage de dimensions: //
///////////////////////////// /////////////////////////////
wxMenu * sizes_menu = new wxMenu; wxMenu * sizes_menu = new wxMenu;
item = new wxMenuItem(sizes_menu, ID_PCB_TRACK_SIZE_SETUP, _("Tracks and Vias"), item = new wxMenuItem(sizes_menu, ID_PCB_TRACK_SIZE_SETUP, _("Tracks and Vias"),
_("Adjust size and width for tracks, vias")); _("Adjust size and width for tracks, vias"));
item->SetBitmap(showtrack_xpm); item->SetBitmap(showtrack_xpm);
sizes_menu->Append(item); sizes_menu->Append(item);
item = new wxMenuItem(sizes_menu, ID_PCB_USER_GRID_SETUP, _("User Grid Size"), item = new wxMenuItem(sizes_menu, ID_PCB_USER_GRID_SETUP, _("User Grid Size"),
_("Adjust User Grid")); _("Adjust User Grid"));
item->SetBitmap(grid_xpm); item->SetBitmap(grid_xpm);
sizes_menu->Append(item); sizes_menu->Append(item);
item = new wxMenuItem(sizes_menu, ID_PCB_DRAWINGS_WIDTHS_SETUP, _("Texts and Drawings"), item = new wxMenuItem(sizes_menu, ID_PCB_DRAWINGS_WIDTHS_SETUP, _("Texts and Drawings"),
_("Adjust width for texts and drawings")); _("Adjust width for texts and drawings"));
item->SetBitmap(options_text_xpm); item->SetBitmap(options_text_xpm);
sizes_menu->Append(item); sizes_menu->Append(item);
item = new wxMenuItem(sizes_menu, ID_PCB_PAD_SETUP, _("Pad Settings"), item = new wxMenuItem(sizes_menu, ID_PCB_PAD_SETUP, _("Pad Settings"),
_("Adjust size,shape,layers... for Pads")); _("Adjust size,shape,layers... for Pads"));
item->SetBitmap(pad_xpm); item->SetBitmap(pad_xpm);
sizes_menu->Append(item); sizes_menu->Append(item);
sizes_menu->AppendSeparator(); sizes_menu->AppendSeparator();
item = new wxMenuItem(sizes_menu, ID_CONFIG_SAVE, _("&Save Setup"), item = new wxMenuItem(sizes_menu, ID_CONFIG_SAVE, _("&Save Setup"),
_("Save options in current directory")); _("Save options in current directory"));
item->SetBitmap(save_xpm); item->SetBitmap(save_xpm);
sizes_menu->Append(item); sizes_menu->Append(item);
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
// Menu postprocess ( generation fichiers percage, placement... // // Menu postprocess ( generation fichiers percage, placement... //
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
wxMenu *postprocess_menu = new wxMenu; wxMenu *postprocess_menu = new wxMenu;
item = new wxMenuItem(postprocess_menu, ID_PCB_GEN_POS_MODULES_FILE, item = new wxMenuItem(postprocess_menu, ID_PCB_GEN_POS_MODULES_FILE,
_("Create &Modules Pos"), _("Create &Modules Pos"),
_("Gen Position modules file")); _("Gen Position modules file"));
item->SetBitmap(post_compo_xpm); item->SetBitmap(post_compo_xpm);
postprocess_menu->Append(item); postprocess_menu->Append(item);
item = new wxMenuItem(postprocess_menu, ID_PCB_GEN_DRILL_FILE, _("Create &Drill file"), item = new wxMenuItem(postprocess_menu, ID_PCB_GEN_DRILL_FILE, _("Create &Drill file"),
_("Gen Drill (EXCELLON] file and/or Drill sheet")); _("Gen Drill (EXCELLON] file and/or Drill sheet"));
item->SetBitmap(post_drill_xpm); item->SetBitmap(post_drill_xpm);
postprocess_menu->Append(item); postprocess_menu->Append(item);
item = new wxMenuItem(postprocess_menu, ID_PCB_GEN_CMP_FILE, _("Create &Cmp file"), item = new wxMenuItem(postprocess_menu, ID_PCB_GEN_CMP_FILE, _("Create &Cmp file"),
_("Recreate .cmp file for CvPcb")); _("Recreate .cmp file for CvPcb"));
item->SetBitmap(save_cmpstuff_xpm); item->SetBitmap(save_cmpstuff_xpm);
postprocess_menu->Append(item); postprocess_menu->Append(item);
////////////////////////// //////////////////////////
// Menu d'outils divers // // Menu d'outils divers //
////////////////////////// //////////////////////////
wxMenu *miscellaneous_menu = new wxMenu; wxMenu *miscellaneous_menu = new wxMenu;
item = new wxMenuItem(miscellaneous_menu, ID_PCB_GLOBAL_DELETE, _("Global &Deletions"), item = new wxMenuItem(miscellaneous_menu, ID_PCB_GLOBAL_DELETE, _("Global &Deletions"),
_("Delete Tracks, Modules, Texts... on Board")); _("Delete Tracks, Modules, Texts... on Board"));
item->SetBitmap(general_deletions_xpm); item->SetBitmap(general_deletions_xpm);
miscellaneous_menu->Append(item); miscellaneous_menu->Append(item);
item = new wxMenuItem(miscellaneous_menu, ID_MENU_LIST_NETS, _("&List nets"), item = new wxMenuItem(miscellaneous_menu, ID_MENU_LIST_NETS, _("&List nets"),
_("List nets (names and id)")); _("List nets (names and id)"));
item->SetBitmap(tools_xpm); item->SetBitmap(tools_xpm);
miscellaneous_menu->Append(item); miscellaneous_menu->Append(item);
item = new wxMenuItem(miscellaneous_menu, ID_MENU_PCB_CLEAN, _("&Track operations"), item = new wxMenuItem(miscellaneous_menu, ID_MENU_PCB_CLEAN, _("&Track operations"),
_("Clean stubs, vias, delete break points, or connect dangling tracks to pads and vias")); _("Clean stubs, vias, delete break points, or connect dangling tracks to pads and vias"));
item->SetBitmap(delete_body_xpm); item->SetBitmap(delete_body_xpm);
miscellaneous_menu->Append(item); miscellaneous_menu->Append(item);
item = new wxMenuItem(miscellaneous_menu, ID_MENU_PCB_SWAP_LAYERS, _("&Swap layers"), item = new wxMenuItem(miscellaneous_menu, ID_MENU_PCB_SWAP_LAYERS, _("&Swap layers"),
_("Swap tracks on copper layers or drawings on others layers")); _("Swap tracks on copper layers or drawings on others layers"));
item->SetBitmap(swap_layer_xpm); item->SetBitmap(swap_layer_xpm);
miscellaneous_menu->Append(item); miscellaneous_menu->Append(item);
//////////////// ////////////////
// Menu Help: // // Menu Help: //
//////////////// ////////////////
wxMenu *helpMenu = new wxMenu; wxMenu *helpMenu = new wxMenu;
item = new wxMenuItem(helpMenu , ID_GENERAL_HELP, _("&Contents"), _("Open the pcbnew manual")); item = new wxMenuItem(helpMenu , ID_GENERAL_HELP, _("&Contents"), _("Open the pcbnew manual"));
item->SetBitmap(help_xpm); item->SetBitmap(help_xpm);
helpMenu->Append(item); helpMenu->Append(item);
item = new wxMenuItem(helpMenu , ID_KICAD_ABOUT, _("&About"), _("About this application")); item = new wxMenuItem(helpMenu , ID_KICAD_ABOUT, _("&About"), _("About this application"));
item->SetBitmap(info_xpm); item->SetBitmap(info_xpm);
helpMenu->Append(item); helpMenu->Append(item);
////////////////////// //////////////////////
// Menu Display 3D: // // Menu Display 3D: //
////////////////////// //////////////////////
wxMenu *Display3DMenu = new wxMenu; wxMenu *Display3DMenu = new wxMenu;
item = new wxMenuItem(Display3DMenu , ID_MENU_PCB_SHOW_3D_FRAME, _("3D Display"), _("Show Board in 3D Mode")); item = new wxMenuItem(Display3DMenu , ID_MENU_PCB_SHOW_3D_FRAME, _("3D Display"), _("Show Board in 3D Mode"));
item->SetBitmap(show_3d_xpm); item->SetBitmap(show_3d_xpm);
Display3DMenu->Append(item); Display3DMenu->Append(item);
menuBar->Append(m_FilesMenu, _("&File")); menuBar->Append(m_FilesMenu, _("&File"));
menuBar->Append(configmenu, _("&Preferences")); menuBar->Append(configmenu, _("&Preferences"));
menuBar->Append(sizes_menu, _("&Dimensions")); menuBar->Append(sizes_menu, _("&Dimensions"));
menuBar->Append(miscellaneous_menu, _("&Miscellaneous")); menuBar->Append(miscellaneous_menu, _("&Miscellaneous"));
menuBar->Append(postprocess_menu, _("P&ostprocess")); menuBar->Append(postprocess_menu, _("P&ostprocess"));
menuBar->Append(Display3DMenu, _("&3D Display")); menuBar->Append(Display3DMenu, _("&3D Display"));
menuBar->Append(helpMenu, _("&Help")); menuBar->Append(helpMenu, _("&Help"));
// Associate the menu bar with the frame // Associate the menu bar with the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
} }
else // simple mise a jour de la liste des fichiers anciens else // simple mise a jour de la liste des fichiers anciens
{ {
wxMenuItem * item; wxMenuItem * item;
int max_file = m_Parent->m_LastProjectMaxCount; int max_file = m_Parent->m_LastProjectMaxCount;
for ( ii = max_file-1; ii >=0 ; ii-- ) for ( ii = max_file-1; ii >=0 ; ii-- )
{ {
if( m_FilesMenu->FindItem(ID_LOAD_FILE_1 + ii) ) if( m_FilesMenu->FindItem(ID_LOAD_FILE_1 + ii) )
{ {
item = m_FilesMenu->Remove(ID_LOAD_FILE_1 + ii); item = m_FilesMenu->Remove(ID_LOAD_FILE_1 + ii);
if ( item ) delete item; if ( item ) delete item;
} }
} }
for ( ii = 0; ii < max_file; ii++ ) for ( ii = 0; ii < max_file; ii++ )
{ {
if ( GetLastProject(ii).IsEmpty() ) break; if ( GetLastProject(ii).IsEmpty() ) break;
m_FilesMenu->Append(ID_LOAD_FILE_1 + ii, GetLastProject(ii) ); m_FilesMenu->Append(ID_LOAD_FILE_1 + ii, GetLastProject(ii) );
} }
} }
} }

View File

@ -1082,8 +1082,7 @@ static void Place_Piste_en_Buffer( WinEDA_PcbFrame* pcbframe, wxDC* DC )
g_CurrentTrackSegment->SetState( END_ONPAD, ON ); g_CurrentTrackSegment->SetState( END_ONPAD, ON );
/* recherche de la zone de rangement et insertion de la nouvelle piste */ /* recherche de la zone de rangement et insertion de la nouvelle piste */
pt_track = g_FirstTrackSegment->GetBestInsertPoint( pcbframe->m_Pcb ); pcbframe->m_Pcb->Add( g_FirstTrackSegment );
g_FirstTrackSegment->Insert( pcbframe->m_Pcb, pt_track );
Trace_Une_Piste( panel, DC, g_FirstTrackSegment, g_TrackSegmentCount, GR_OR ); Trace_Une_Piste( panel, DC, g_FirstTrackSegment, g_TrackSegmentCount, GR_OR );

View File

@ -3760,7 +3760,12 @@ class SPECCTRA_DB : public OUTPUTFORMATTER
TRACK* makeTRACK( PATH* aPath, int aPointIndex, int aNetcode ) throw( IOError ); TRACK* makeTRACK( PATH* aPath, int aPointIndex, int aNetcode ) throw( IOError );
SEGVIA* makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNetCode ); /**
* Function makeVIA
* instantiates a Kicad SEGVIA on the heap and initializes it with internal
* values consistent with the given PADSTACK, POINT, and netcode.
*/
SEGVIA* makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNetCode ) throw( IOError );
//-----</FromSESSION>---------------------------------------------------- //-----</FromSESSION>----------------------------------------------------

View File

@ -37,6 +37,8 @@
#include "wxPcbStruct.h" // Change_Side_Module() #include "wxPcbStruct.h" // Change_Side_Module()
#include "pcbstruct.h" // HISTORY_NUMBER #include "pcbstruct.h" // HISTORY_NUMBER
#include "autorout.h" // NET_CODES_OK #include "autorout.h" // NET_CODES_OK
#include "trigo.h" // RotatePoint()
#include <set> // std::set #include <set> // std::set
@ -351,8 +353,38 @@ IMAGE* SPECCTRA_DB::makeIMAGE( MODULE* aModule )
pin->padstack_id = padstack->padstack_id; pin->padstack_id = padstack->padstack_id;
pin->pin_id = CONV_TO_UTF8( pad->ReturnStringPadName() ); pin->pin_id = CONV_TO_UTF8( pad->ReturnStringPadName() );
// copper shape's position is hole position + offset #if 0
wxPoint pos = pad->m_Pos0 + pad->m_Offset; if( pad->m_Orient )
{
int angle = pad->m_Orient - aModule->m_Orient; // tenths of degrees
NORMALIZE_ANGLE_POS(angle);
pin->SetRotation( angle / 10.0 );
}
#else
{
int angle = pad->m_Orient - aModule->m_Orient; // tenths of degrees
if( angle )
{
NORMALIZE_ANGLE_POS(angle);
pin->SetRotation( angle / 10.0 );
}
}
#endif
wxPoint pos;
int angle = pad->m_Orient - aModule->m_Orient; // tenths of degrees
if( angle && (pad->m_Offset.x || pad->m_Offset.y) )
{
wxPoint offset( pad->m_Offset.x, pad->m_Offset.y );
RotatePoint( &offset, angle );
pos = pad->m_Pos0 + offset;
}
else
{
// copper shape's position is hole position + offset
pos = pad->m_Pos0 + pad->m_Offset;
}
pin->SetVertex( mapPt( pos ) ); pin->SetVertex( mapPt( pos ) );
} }
@ -385,8 +417,8 @@ PADSTACK* SPECCTRA_DB::makeVia( const SEGVIA* aVia )
circle->SetLayerId( "signal" ); circle->SetLayerId( "signal" );
snprintf( name, sizeof(name), "Via_%.6g:%.6g_mil", dsnDiameter, snprintf( name, sizeof(name), "Via[A]%.6g:%.6g_mil", dsnDiameter,
// encode the drill value in the name for later import // encode the drill value into the name for later import
scale( aVia->GetDrillValue() ) ); scale( aVia->GetDrillValue() ) );
name[ sizeof(name)-1 ] = 0; name[ sizeof(name)-1 ] = 0;
padstack->SetPadstackId( name ); padstack->SetPadstackId( name );
@ -418,7 +450,7 @@ PADSTACK* SPECCTRA_DB::makeVia( const SEGVIA* aVia )
snprintf( name, sizeof(name), "Via[%d-%d]_%.6g:%.6g_mil", snprintf( name, sizeof(name), "Via[%d-%d]_%.6g:%.6g_mil",
topLayer, botLayer, dsnDiameter, topLayer, botLayer, dsnDiameter,
// encode the drill value in the name for later import // encode the drill value into the name for later import
scale( aVia->GetDrillValue() ) scale( aVia->GetDrillValue() )
); );
name[ sizeof(name)-1 ] = 0; name[ sizeof(name)-1 ] = 0;
@ -446,8 +478,8 @@ PADSTACK* SPECCTRA_DB::makeVia( int aCopperDiameter, int aDrillDiameter )
circle->SetLayerId( "signal" ); circle->SetLayerId( "signal" );
snprintf( name, sizeof(name), "Via_%.6g:%.6g_mil", dsnDiameter, snprintf( name, sizeof(name), "Via[A]%.6g:%.6g_mil", dsnDiameter,
// encode the drill value in the name for later import // encode the drill value into the name for later import
scale( aDrillDiameter ) ); scale( aDrillDiameter ) );
name[ sizeof(name)-1 ] = 0; name[ sizeof(name)-1 ] = 0;
padstack->SetPadstackId( name ); padstack->SetPadstackId( name );

View File

@ -150,6 +150,14 @@ static int scale( double distance, UNIT_RES* aResolution )
return ret; return ret;
} }
/**
* Function mapPt
* translates a point from the Specctra Session format coordinate system
* to the Kicad coordinate system.
* @param aPoint The session point to translate
* @return wxPoint - The Kicad coordinate system point.
*/
static wxPoint mapPt( const POINT& aPoint, UNIT_RES* aResolution ) static wxPoint mapPt( const POINT& aPoint, UNIT_RES* aResolution )
{ {
wxPoint ret( scale( aPoint.x, aResolution ), wxPoint ret( scale( aPoint.x, aResolution ),
@ -182,16 +190,14 @@ TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode ) thro
} }
SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNetCode ) SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNetCode ) throw( IOError )
{ {
SEGVIA* via = 0; SEGVIA* via = 0;
SHAPE* shape; SHAPE* shape;
int shapeCount = aPadstack->Length(); int shapeCount = aPadstack->Length();
int drillDiam = -1; int drillDiam = -1;
int viaDiam = 400; int copperLayerCount = sessionBoard->GetCopperLayerCount();
// @todo this needs a lot of work yet, it is not complete yet.
// The drill diameter is encoded in the padstack name if PCBNEW did the DSN export. // The drill diameter is encoded in the padstack name if PCBNEW did the DSN export.
@ -200,15 +206,16 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
if( drillStartNdx != -1 ) if( drillStartNdx != -1 )
{ {
++drillStartNdx; // skip over the ':'
int drillEndNdx = aPadstack->padstack_id.rfind( '_' ); int drillEndNdx = aPadstack->padstack_id.rfind( '_' );
if( drillEndNdx != -1 ) if( drillEndNdx != -1 )
{ {
std::string diamTxt( aPadstack->padstack_id, drillStartNdx+1, drillEndNdx-drillStartNdx-1 ); std::string diamTxt( aPadstack->padstack_id, drillStartNdx, drillEndNdx-drillStartNdx );
const char* sdiamTxt = diamTxt.c_str(); const char* sdiamTxt = diamTxt.c_str();
double drillMils = strtod( sdiamTxt, 0 ); double drillMils = strtod( sdiamTxt, 0 );
// drillMils is not in the session units, but actual mils so we don't use scale() // drillMils is not in the session units, but actual mils so we don't use scale()
drillDiam = drillMils * 10; drillDiam = (int) (drillMils * 10);
if( drillDiam == g_DesignSettings.m_ViaDrill ) // default if( drillDiam == g_DesignSettings.m_ViaDrill ) // default
drillDiam = -1; // import as default drillDiam = -1; // import as default
@ -217,38 +224,94 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
if( shapeCount == 0 ) if( shapeCount == 0 )
{ {
ThrowIOError( _( "Session via padstack has no shapes") );
} }
else if( shapeCount == 1 ) else if( shapeCount == 1 )
{ {
shape = (SHAPE*) (*aPadstack)[0]; shape = (SHAPE*) (*aPadstack)[0];
if( shape->shape->Type() == T_circle ) DSN_T type = shape->shape->Type();
{ if( type != T_circle )
CIRCLE* circle = (CIRCLE*) shape->shape; ThrowIOError( _( "Unsupported via shape: \"%s\""),
viaDiam = scale( circle->diameter, routeResolution ); LEXER::GetTokenString( type ).GetData() );
via = new SEGVIA( sessionBoard ); CIRCLE* circle = (CIRCLE*) shape->shape;
via->SetPosition( mapPt( aPoint, routeResolution ) ); int viaDiam = scale( circle->diameter, routeResolution );
via->SetDrillValue( drillDiam );
via->m_Shape = VIA_THROUGH; via = new SEGVIA( sessionBoard );
via->m_Width = viaDiam; via->SetPosition( mapPt( aPoint, routeResolution ) );
via->SetLayerPair( CMP_N, COPPER_LAYER_N ); via->SetDrillValue( drillDiam );
} via->m_Shape = VIA_THROUGH;
via->m_Width = viaDiam;
via->SetLayerPair( CMP_N, COPPER_LAYER_N );
} }
else if( shapeCount == sessionBoard->GetCopperLayerCount() ) else if( shapeCount == copperLayerCount )
{ {
shape = (SHAPE*) (*aPadstack)[0]; shape = (SHAPE*) (*aPadstack)[0];
if( shape->shape->Type() == T_circle ) DSN_T type = shape->shape->Type();
{ if( type != T_circle )
CIRCLE* circle = (CIRCLE*) shape->shape; ThrowIOError( _( "Unsupported via shape: \"%s\""),
viaDiam = scale( circle->diameter, routeResolution ); LEXER::GetTokenString( type ).GetData() );
via = new SEGVIA( sessionBoard ); CIRCLE* circle = (CIRCLE*) shape->shape;
via->SetPosition( mapPt( aPoint, routeResolution ) ); int viaDiam = scale( circle->diameter, routeResolution );
via->SetDrillValue( drillDiam );
via->m_Shape = VIA_THROUGH; via = new SEGVIA( sessionBoard );
via->m_Width = viaDiam; via->SetPosition( mapPt( aPoint, routeResolution ) );
via->SetLayerPair( CMP_N, COPPER_LAYER_N ); via->SetDrillValue( drillDiam );
via->m_Shape = VIA_THROUGH;
via->m_Width = viaDiam;
via->SetLayerPair( CMP_N, COPPER_LAYER_N );
}
else // VIA_MICROVIA or VIA_BLIND_BURIED
{
int topLayerNdx = -1;
int botLayerNdx = 7000;
int viaDiam = -1;
for( int i=0; i<shapeCount; ++i )
{
shape = (SHAPE*) (*aPadstack)[i];
DSN_T type = shape->shape->Type();
if( type != T_circle )
ThrowIOError( _( "Unsupported via shape: \"%s\""),
LEXER::GetTokenString( type ).GetData() );
CIRCLE* circle = (CIRCLE*) shape->shape;
int layerNdx = findLayerName( circle->layer_id );
if( layerNdx == -1 )
{
wxString layerName = CONV_FROM_UTF8( circle->layer_id.c_str() );
ThrowIOError( _("Session file uses invalid layer id \"%s\""),
layerName.GetData() );
}
if( layerNdx > topLayerNdx )
topLayerNdx = layerNdx;
if( layerNdx < botLayerNdx )
botLayerNdx = layerNdx;
if( viaDiam == -1 )
viaDiam = scale( circle->diameter, routeResolution );
} }
via = new SEGVIA( sessionBoard );
via->SetPosition( mapPt( aPoint, routeResolution ) );
via->SetDrillValue( drillDiam );
if( (topLayerNdx==0 && botLayerNdx==1)
|| (topLayerNdx==copperLayerCount-2 && botLayerNdx==copperLayerCount-1))
via->m_Shape = VIA_MICROVIA;
else
via->m_Shape = VIA_BLIND_BURIED;
via->m_Width = viaDiam;
topLayerNdx = pcbLayer2kicad[topLayerNdx];
botLayerNdx = pcbLayer2kicad[botLayerNdx];
via->SetLayerPair( topLayerNdx, botLayerNdx );
} }
if( via ) if( via )
@ -365,7 +428,6 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
// else netCode remains 0 // else netCode remains 0
} }
WIRES& wires = net->wires; WIRES& wires = net->wires;
for( unsigned i=0; i<wires.size(); ++i ) for( unsigned i=0; i<wires.size(); ++i )
{ {
@ -386,9 +448,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
for( unsigned pt=0; pt<path->points.size()-1; ++pt ) for( unsigned pt=0; pt<path->points.size()-1; ++pt )
{ {
TRACK* track = makeTRACK( path, pt, netCode ); TRACK* track = makeTRACK( path, pt, netCode );
aBoard->Add( track );
TRACK* insertAid = track->GetBestInsertPoint( aBoard );
track->Insert( aBoard, insertAid );
} }
} }
@ -428,12 +488,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
for( unsigned v=0; v<wire_via->vertexes.size(); ++v ) for( unsigned v=0; v<wire_via->vertexes.size(); ++v )
{ {
SEGVIA* via = makeVIA( padstack, wire_via->vertexes[v], netCode ); SEGVIA* via = makeVIA( padstack, wire_via->vertexes[v], netCode );
aBoard->Add( via );
if( !via )
ThrowIOError( _("Unable to make a via") );
TRACK* insertAid = via->GetBestInsertPoint( aBoard );
via->Insert( aBoard, insertAid );
} }
} }
} }

View File

@ -21,33 +21,33 @@ void WinEDA_PcbFrame::UnDeleteItem( wxDC* DC )
/* Restitution d'un element (MODULE ou TRACK ) Efface /* Restitution d'un element (MODULE ou TRACK ) Efface
*/ */
{ {
BOARD_ITEM* PtStruct, * PtNext; BOARD_ITEM* item;
TRACK* pt_track; BOARD_ITEM* next;
int net_code; int net_code;
if( !g_UnDeleteStackPtr ) if( !g_UnDeleteStackPtr )
return; return;
g_UnDeleteStackPtr--; g_UnDeleteStackPtr--;
PtStruct = g_UnDeleteStack[g_UnDeleteStackPtr]; item = g_UnDeleteStack[g_UnDeleteStackPtr];
if( PtStruct == NULL ) if( item == NULL )
return; // Ne devrait pas se produire return; // Ne devrait pas se produire
switch( PtStruct->Type() ) switch( item->Type() )
{ {
case TYPEVIA: case TYPEVIA:
case TYPETRACK: case TYPETRACK:
for( ; PtStruct != NULL; PtStruct = PtNext ) for( ; item; item = next )
{ {
PtNext = PtStruct->Next(); next = item->Next();
PtStruct->SetState( DELETED, OFF ); /* Effacement du bit DELETED */ item->SetState( DELETED, OFF ); /* Effacement du bit DELETED */
( (TRACK*) PtStruct )->Draw( DrawPanel, DC, GR_OR ); ((TRACK*) item)->Draw( DrawPanel, DC, GR_OR );
} }
PtStruct = g_UnDeleteStack[g_UnDeleteStackPtr]; item = g_UnDeleteStack[g_UnDeleteStackPtr];
net_code = ( (TRACK*) PtStruct )->GetNet(); net_code = ((TRACK*) item)->GetNet();
pt_track = ( (TRACK*) PtStruct )->GetBestInsertPoint( m_Pcb );
( (TRACK*) PtStruct )->Insert( m_Pcb, pt_track ); m_Pcb->Add( item );
g_UnDeleteStack[g_UnDeleteStackPtr] = NULL; g_UnDeleteStack[g_UnDeleteStackPtr] = NULL;
test_1_net_connexion( DC, net_code ); test_1_net_connexion( DC, net_code );
@ -61,18 +61,14 @@ void WinEDA_PcbFrame::UnDeleteItem( wxDC* DC )
/* Reinsertion du module dans la liste chainee des modules, /* Reinsertion du module dans la liste chainee des modules,
* en debut de chaine */ * en debut de chaine */
PtStruct->Pback = m_Pcb; m_Pcb->Add( item );
PtNext = m_Pcb->m_Modules;
PtStruct->Pnext = PtNext;
if( PtNext )
PtNext->Pback = PtStruct;
m_Pcb->m_Modules = (MODULE*) PtStruct;
g_UnDeleteStack[g_UnDeleteStackPtr] = NULL; g_UnDeleteStack[g_UnDeleteStackPtr] = NULL;
( (MODULE*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR ); ((MODULE*) item)->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
PtStruct->SetState( DELETED, OFF ); /* Creal DELETED flag */ item->SetState( DELETED, OFF ); /* Creal DELETED flag */
PtStruct->m_Flags = 0; item->m_Flags = 0;
m_Pcb->m_Status_Pcb = 0; m_Pcb->m_Status_Pcb = 0;
build_liste_pads(); build_liste_pads();
ReCompile_Ratsnest_After_Changes( DC ); ReCompile_Ratsnest_After_Changes( DC );