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.
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>
================================================================================
+pcbnew

View File

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

View File

@ -51,30 +51,30 @@ BOARD::~BOARD()
m_Modules->DeleteStructList();
m_Modules = 0;
m_Equipots->DeleteStructList();
m_Equipots = 0;
m_Track->DeleteStructList();
m_Track = 0;
m_Zone->DeleteStructList();
m_Zone = 0;
MyFree( m_Pads );
m_Pads = 0;
MyFree( m_Ratsnest );
m_Ratsnest = 0;
MyFree( m_LocalRatsnest );
m_LocalRatsnest = 0;
DeleteMARKERs();
DeleteZONEOutlines();
delete m_CurrentZoneContour;
m_CurrentZoneContour = NULL;
DeleteZONEOutlines();
delete m_CurrentZoneContour;
m_CurrentZoneContour = NULL;
}
@ -122,12 +122,12 @@ void BOARD::UnLink()
void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
{
if ( aBoardItem == NULL )
{
if ( aBoardItem == NULL )
{
wxFAIL_MSG( wxT("BOARD::Add() param error: aBoardItem NULL") );
return;
}
return;
}
switch( aBoardItem->Type() )
{
// this one uses a vector
@ -135,13 +135,33 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
aBoardItem->m_Parent = this;
m_markers.push_back( (MARKER*) aBoardItem );
break;
// this one uses a vector
case TYPEZONE_CONTAINER:
aBoardItem->m_Parent = this;
m_ZoneDescriptorList.push_back( (ZONE_CONTAINER*) aBoardItem );
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
default:
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 )
{
if ( aBoardItem == NULL ) return;
if ( aBoardItem == NULL ) return;
switch( aBoardItem->Type() )
{
@ -174,12 +194,12 @@ void BOARD::Delete( BOARD_ITEM* aBoardItem )
if( m_ZoneDescriptorList[i] == (ZONE_CONTAINER*) aBoardItem )
{
delete m_ZoneDescriptorList[i];
m_ZoneDescriptorList.erase(m_ZoneDescriptorList.begin() + i);
m_ZoneDescriptorList.erase(m_ZoneDescriptorList.begin() + i);
break;
}
}
break;
// other types may use linked list
default:
wxFAIL_MSG( wxT("BOARD::Delete() needs work") );
@ -191,7 +211,7 @@ void BOARD::DeleteMARKER( int aIndex )
{
if( (unsigned) aIndex < m_markers.size() )
{
delete m_markers[aIndex];
delete m_markers[aIndex];
m_markers.erase( m_markers.begin() + aIndex );
}
}
@ -202,7 +222,7 @@ void BOARD::DeleteMARKERs()
// the vector does not know how to delete the MARKER, it holds pointers
for( unsigned i=0; i<m_markers.size(); ++i )
delete m_markers[i];
m_markers.clear();
}
@ -211,7 +231,7 @@ void BOARD::DeleteZONEOutlines()
// the vector does not know how to delete the ZONE Outlines, it holds pointers
for( unsigned i=0; i<m_ZoneDescriptorList.size(); ++i )
delete m_ZoneDescriptorList[i];
m_ZoneDescriptorList.clear();
}
@ -266,7 +286,7 @@ bool BOARD::ComputeBoundaryBox()
* Calculate the bounding box of the board
* This box contains pcb edges, pads , vias and tracks
* Update m_PcbBox member
*
*
* @return 0 for an empty board (no items), else 1
*/
{
@ -288,7 +308,7 @@ bool BOARD::ComputeBoundaryBox()
ptr = (DRAWSEGMENT*) PtStruct;
d = (ptr->m_Width / 2) + 1;
if( ptr->m_Shape == S_CIRCLE )
{
cx = ptr->m_Start.x; cy = ptr->m_Start.y;
@ -328,7 +348,7 @@ bool BOARD::ComputeBoundaryBox()
for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext )
{
const wxPoint& pos = pt_pad->GetPosition();
d = pt_pad->m_Rayon;
xmin = MIN( xmin, pos.x - d );
ymin = MIN( ymin, pos.y - d );
@ -440,8 +460,8 @@ void BOARD::Display_Infos( WinEDA_DrawFrame* frame )
}
// virtual, see pcbstruct.h
SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
// virtual, see pcbstruct.h
SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
const KICAD_T scanTypes[] )
{
KICAD_T stype;
@ -451,8 +471,8 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
#if 0 && defined(DEBUG)
std::cout << GetClass().mb_str() << ' ';
#endif
#endif
while( !done )
{
stype = *p;
@ -466,11 +486,11 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
/* Instances of the requested KICAD_T live in a list, either one
that I manage, or that my modules manage. If it's a type managed
by class MODULE, then simply pass it on to each module's
MODULE::Visit() function by way of the
by class MODULE, then simply pass it on to each module's
MODULE::Visit() function by way of the
IterateForward( m_Modules, ... ) call.
*/
*/
case TYPEMODULE:
case TYPEPAD:
case TYPETEXTEMODULE:
@ -515,19 +535,19 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
;
break;
#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.
// 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:
// 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
// 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
// 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.
// Usually, because of this sort, a connected item (if exists) is found.
// If not found (and only in this case) an exhaustive (and time consumming) search is made,
// but this case is statistically rare.
// 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
// after this existing track or via
// 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
// 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.
// Usually, because of this sort, a connected item (if exists) is found.
// If not found (and only in this case) an exhaustive (and time consumming) search is made,
// but this case is statistically rare.
case TYPEVIA:
case TYPETRACK:
result = IterateForward( m_Track, inspector, testData, p );
@ -549,7 +569,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
result = IterateForward( m_Track, inspector, testData, p );
++p;
break;
case TYPETRACK:
result = IterateForward( m_Track, inspector, testData, p );
++p;
@ -581,31 +601,31 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
case PCB_EQUIPOT_STRUCT_TYPE:
result = IterateForward( m_Equipots, inspector, testData, p );
++p;
break;
break;
case TYPEZONE:
result = IterateForward( m_Zone, inspector, testData, p );
++p;
break;
case TYPEZONE_UNUSED: // Unused type
break;
break;
default: // catch EOT or ANY OTHER type here and return.
done = true;
break;
}
if( result == SEARCH_QUIT )
break;
}
return result;
return result;
}
/* now using PcbGeneralLocateAndDisplay()
// see pcbstruct.h
// see pcbstruct.h
BOARD_ITEM* BOARD::FindPadOrModule( const wxPoint& refPos, int layer )
{
class PadOrModule : public INSPECTOR
@ -614,22 +634,22 @@ BOARD_ITEM* BOARD::FindPadOrModule( const wxPoint& refPos, int layer )
BOARD_ITEM* found;
int layer;
int layer_mask;
PadOrModule( int alayer ) :
found(0), layer(alayer), layer_mask( g_TabOneLayerMask[alayer] )
{}
SEARCH_RESULT Inspect( EDA_BaseStruct* testItem, const void* testData )
{
BOARD_ITEM* item = (BOARD_ITEM*) testItem;
const wxPoint& refPos = *(const wxPoint*) testData;
if( item->Type() == TYPEPAD )
{
D_PAD* pad = (D_PAD*) item;
if( pad->HitTest( refPos ) )
{
if( layer_mask & pad->m_Masque_Layer )
if( layer_mask & pad->m_Masque_Layer )
{
found = item;
return SEARCH_QUIT;
@ -642,7 +662,7 @@ BOARD_ITEM* BOARD::FindPadOrModule( const wxPoint& refPos, int layer )
}
}
}
else if( item->Type() == TYPEMODULE )
{
MODULE* module = (MODULE*) item;
@ -657,7 +677,7 @@ BOARD_ITEM* BOARD::FindPadOrModule( const wxPoint& refPos, int layer )
found = item;
return SEARCH_QUIT;
}
// layer mismatch, save in case we don't find a
// future layer match hit.
if( !found )
@ -668,7 +688,7 @@ BOARD_ITEM* BOARD::FindPadOrModule( const wxPoint& refPos, int layer )
return SEARCH_CONTINUE;
}
};
PadOrModule inspector( layer );
// search only for PADs first, then MODULES, and preferably a layer match
@ -676,7 +696,7 @@ BOARD_ITEM* BOARD::FindPadOrModule( const wxPoint& refPos, int layer )
// visit this BOARD with the above inspector
Visit( &inspector, &refPos, scanTypes );
return inspector.found;
}
*/
@ -692,7 +712,7 @@ EQUIPOT* BOARD::FindNet( int anetcode ) const
{
// the first valid netcode is 1.
// zero is reserved for "no connection" and is not used.
if( anetcode > 0 )
if( anetcode > 0 )
{
for( EQUIPOT* net = m_Equipots; net; net=net->Next() )
{
@ -714,7 +734,7 @@ EQUIPOT* BOARD::FindNet( const wxString & aNetname ) const
{
// the first valid netcode is 1.
// zero is reserved for "no connection" and is not used.
if( ! aNetname.IsEmpty() )
if( ! aNetname.IsEmpty() )
{
for( EQUIPOT* net = m_Equipots; net; net=net->Next() )
{
@ -754,7 +774,7 @@ MODULE* BOARD::FindModuleByReference( const wxString& aReference ) const
// visit this BOARD with the above inspector
BOARD* nonconstMe = (BOARD*) this;
nonconstMe->Visit( &inspector, &aReference, scanTypes );
return inspector.found;
}
@ -763,19 +783,19 @@ MODULE* BOARD::FindModuleByReference( const wxString& aReference ) const
// Sort nets by name
int s_SortByNames(const void * ptr1, const void * ptr2)
{
EQUIPOT* item1 = * (EQUIPOT**) ptr1;
EQUIPOT* item2 = * (EQUIPOT**) ptr2;
return item1->m_Netname.CmpNoCase(item2->m_Netname);
EQUIPOT* item1 = * (EQUIPOT**) ptr1;
EQUIPOT* item2 = * (EQUIPOT**) ptr2;
return item1->m_Netname.CmpNoCase(item2->m_Netname);
}
// Sort nets by decreasing pad count
int s_SortByNodes(const void * ptr1, const void * ptr2)
{
EQUIPOT* item1 = * (EQUIPOT**) ptr1;
EQUIPOT* item2 = * (EQUIPOT**) ptr2;
if ( (item1->m_NbNodes - item2->m_NbNodes) != 0 )
return - (item1->m_NbNodes - item2->m_NbNodes);
return item1->m_Netname.CmpNoCase(item2->m_Netname);
EQUIPOT* item1 = * (EQUIPOT**) ptr1;
EQUIPOT* item2 = * (EQUIPOT**) ptr2;
if ( (item1->m_NbNodes - item2->m_NbNodes) != 0 )
return - (item1->m_NbNodes - item2->m_NbNodes);
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 NetCount = 0;
int ii;
EQUIPOT* net;
/* count items to list and sort */
for( net = m_Equipots; net; net=net->Next() )
{
if ( net->m_Netname.IsEmpty() ) continue;
NetCount++;
}
int NetCount = 0;
int ii;
EQUIPOT* net;
if ( NetCount == 0 ) return 0;
/* count items to list and sort */
for( net = m_Equipots; net; net=net->Next() )
{
if ( net->m_Netname.IsEmpty() ) continue;
NetCount++;
}
/* Build the list */
EQUIPOT* * net_ptr_list = (EQUIPOT* *) MyMalloc( NetCount * sizeof(* net_ptr_list) );
for( ii = 0, net = m_Equipots; net; net=net->Next() )
{
if ( net->m_Netname.IsEmpty() ) continue;
net_ptr_list[ii] = net;
ii++;
}
/* sort the list */
switch ( aSort_Type )
{
case NO_SORT : break;
if ( NetCount == 0 ) return 0;
case ALPHA_SORT :
qsort (net_ptr_list, NetCount, sizeof(EQUIPOT*), s_SortByNames);
break;
/* Build the list */
EQUIPOT* * net_ptr_list = (EQUIPOT* *) MyMalloc( NetCount * sizeof(* net_ptr_list) );
for( ii = 0, net = m_Equipots; net; net=net->Next() )
{
if ( net->m_Netname.IsEmpty() ) continue;
net_ptr_list[ii] = net;
ii++;
}
case PAD_CNT_SORT:
qsort (net_ptr_list, NetCount, sizeof(EQUIPOT*), s_SortByNodes);
break;
}
/* sort the list */
switch ( aSort_Type )
{
case NO_SORT : break;
/* fill the given list */
for( ii = 0; ii < NetCount; ii++ )
{
net = net_ptr_list[ii];
aNames.Add(net->m_Netname);
}
MyFree(net_ptr_list);
return NetCount;
case ALPHA_SORT :
qsort (net_ptr_list, NetCount, sizeof(EQUIPOT*), s_SortByNames);
break;
case PAD_CNT_SORT:
qsort (net_ptr_list, NetCount, sizeof(EQUIPOT*), s_SortByNodes);
break;
}
/* fill the given list */
for( ii = 0; ii < NetCount; ii++ )
{
net = net_ptr_list[ii];
aNames.Add(net->m_Netname);
}
MyFree(net_ptr_list);
return NetCount;
}
/************************************/
@ -847,12 +867,12 @@ bool BOARD::Save( FILE* aFile ) const
for( item = m_Equipots; item; item=item->Next() )
if( !item->Save( aFile ) )
goto out;
// save the modules
for( item = m_Modules; item; item=item->Next() )
if( !item->Save( aFile ) )
goto out;
for( item = m_Drawings; item; item=item->Next() )
{
switch( item->Type() )
@ -867,15 +887,15 @@ bool BOARD::Save( FILE* aFile ) const
default:
// future: throw exception here
#if defined(DEBUG)
#if defined(DEBUG)
printf( "BOARD::Save() ignoring m_Drawings type %d\n", item->Type() );
#endif
#endif
break;
}
}
// do not save MARKERs, they can be regenerated easily
// do not save MARKERs, they can be regenerated easily
// save the tracks & vias
fprintf( aFile, "$TRACK\n" );
for( item = m_Track; item; item=item->Next() )
@ -889,22 +909,22 @@ bool BOARD::Save( FILE* aFile ) const
if( !item->Save( aFile ) )
goto out;
fprintf( aFile, "$EndZONE\n" );
// save the zone edges
for( unsigned ii = 0; ii < m_ZoneDescriptorList.size(); ii++ )
{
ZONE_CONTAINER* edge_zone = m_ZoneDescriptorList[ii];
edge_zone->Save( aFile );
}
for( unsigned ii = 0; ii < m_ZoneDescriptorList.size(); ii++ )
{
ZONE_CONTAINER* edge_zone = m_ZoneDescriptorList[ii];
edge_zone->Save( aFile );
}
if( fprintf( aFile, "$EndBOARD\n" ) != sizeof("$EndBOARD\n")-1 )
goto out;
rc = true; // wrote all OK
rc = true; // wrote all OK
out:
return rc;
return rc;
}
/***********************************************************************************************/
@ -917,12 +937,12 @@ void BOARD::RedrawAreasOutlines(WinEDA_DrawPanel* panel, wxDC * aDC, int aDrawMo
{
if ( ! aDC ) return;
for( int ii = 0; ii < GetAreaCount(); ii++ )
{
ZONE_CONTAINER* edge_zone = GetArea(ii);
if( (aLayer < 0) || (aLayer == edge_zone->GetLayer()) )
edge_zone->Draw( panel, aDC, wxPoint( 0, 0 ), aDrawMode );
}
for( int ii = 0; ii < GetAreaCount(); ii++ )
{
ZONE_CONTAINER* edge_zone = GetArea(ii);
if( (aLayer < 0) || (aLayer == edge_zone->GetLayer()) )
edge_zone->Draw( panel, aDC, wxPoint( 0, 0 ), aDrawMode );
}
}
@ -932,14 +952,14 @@ void BOARD::RedrawAreasOutlines(WinEDA_DrawPanel* panel, wxDC * aDC, int aDrawMo
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
void BOARD::Show( int nestLevel, std::ostream& os )
{
BOARD_ITEM* p;
// for now, make it look like XML:
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n";
@ -955,7 +975,7 @@ void BOARD::Show( int nestLevel, std::ostream& os )
for( ; p; p = p->Next() )
p->Show( nestLevel+2, os );
NestedSpace( nestLevel+1, os ) << "</pdrawings>\n";
NestedSpace( nestLevel+1, os ) << "<nets>\n";
p = m_Equipots;
for( ; p; p = p->Next() )
@ -963,13 +983,13 @@ void BOARD::Show( int nestLevel, std::ostream& os )
NestedSpace( nestLevel+1, os ) << "</nets>\n";
NestedSpace( nestLevel+1, os ) << "<tracks>\n";
p = m_Track;
p = m_Track;
for( ; p; p = p->Next() )
p->Show( nestLevel+2, os );
NestedSpace( nestLevel+1, os ) << "</tracks>\n";
NestedSpace( nestLevel+1, os ) << "<zones>\n";
p = m_Zone;
p = m_Zone;
for( ; p; p = p->Next() )
p->Show( nestLevel+2, os );
NestedSpace( nestLevel+1, os ) << "</zones>\n";
@ -978,13 +998,13 @@ void BOARD::Show( int nestLevel, std::ostream& os )
for( ZONE_CONTAINERS::iterator i=m_ZoneDescriptorList.begin(); i!=m_ZoneDescriptorList.end(); ++i )
(*i)->Show( nestLevel+2, os );
NestedSpace( nestLevel+1, os ) << "</zone_container>\n";
p = (BOARD_ITEM*) m_Son;
for( ; p; p = p->Next() )
{
p->Show( nestLevel+1, os );
}
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
}

View File

@ -16,11 +16,11 @@ class EDA_BoardDesignSettings;
class BOARD : public BOARD_ITEM
{
friend class WinEDA_PcbFrame;
private:
typedef std::vector<MARKER*> MARKERS; // @todo: switch to boost:ptr_vector, and change ~BOARD()
MARKERS m_markers; ///< MARKERs for clearance problems, owned by pointer
typedef std::vector<ZONE_CONTAINER*> ZONE_CONTAINERS; // @todo: switch to boost::ptr_vector, and change ~BOARD()
ZONE_CONTAINERS m_ZoneDescriptorList; ///< edge zone descriptors, owned by pointer
@ -60,7 +60,7 @@ public:
* @return const wxPoint& of (0,0)
*/
wxPoint& GetPosition();
/* supprime du chainage la structure Struct */
void UnLink();
@ -68,9 +68,11 @@ public:
* Function Add
* adds the given item to this BOARD and takes ownership of its memory.
* @param aBoardItem The item to add to this board.
* @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 );
#define ADD_APPEND 1 ///< aControl flag for Add( aControl ), appends not inserts
/**
* Function Delete
@ -90,17 +92,17 @@ public:
* Function DeleteZONEOutlines
* deletes ALL zone outlines from the board.
*/
void DeleteZONEOutlines();
void DeleteZONEOutlines();
/**
* Function DeleteMARKER
* deletes one MARKER from the board.
* @param aIndex The index of the marker to delete.
*/
void DeleteMARKER( int aIndex );
/**
* Function GetMARKER
* returns the MARKER at a given index.
@ -114,7 +116,7 @@ public:
return NULL;
}
/**
* Function GetMARKERCount
* @return int - The number of MARKERS.
@ -129,7 +131,7 @@ public:
* @return int - The number of copper layers in the BOARD.
*/
int GetCopperLayerCount() const;
/**
* Function GetLayerName
* returns the name of the requested layer. Hopefully layer names will
@ -138,13 +140,13 @@ public:
* @param aLayerIndex A layer index, like COPPER_LAYER_N, etc.
* @return wxString - the layer name.
*/
wxString GetLayerName( int aLayerIndex ) const;
wxString GetLayerName( int aLayerIndex ) const;
/* Routines de calcul des nombres de segments pistes et zones */
int GetNumSegmTrack();
int GetNumSegmZone();
int GetNumNoconnect(); // retourne le nombre de connexions manquantes
/**
* Function GetNumRatsnests
* @return int - The number of rats
@ -153,23 +155,23 @@ public:
{
return m_NbLinks;
}
int GetNumNodes(); // retourne le nombre de pads a netcode > 0
// Calcul du rectangle d'encadrement:
bool ComputeBoundaryBox();
/**
* Function Display_Infos
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Is virtual from EDA_BaseStruct.
* @param frame A WinEDA_DrawFrame in which to print status information.
*/
*/
void Display_Infos( WinEDA_DrawFrame* frame );
/**
* Function Visit
* may be re-implemented for each derived class in order to handle
@ -178,12 +180,12 @@ public:
* to do so on lists of such data.
* @param inspector An INSPECTOR instance to use in the inspection.
* @param testData Arbitrary data used by the inspector.
* @param scanTypes Which KICAD_T types are of interest and the order
* @param scanTypes Which KICAD_T types are of interest and the order
* is significant too, terminated by EOT.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE, and determined by the inspector.
*/
SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData,
SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData,
const KICAD_T scanTypes[] );
@ -213,7 +215,7 @@ public:
* designator, else NULL.
*/
MODULE* FindModuleByReference( const wxString& aReference ) const;
/**
* Function ReturnSortedNetnamesList
* searches for a net with the given netcode.
@ -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.
* @return int - net names count.
*/
enum netname_sort_type {
NO_SORT,
ALPHA_SORT,
PAD_CNT_SORT
};
enum netname_sort_type {
NO_SORT,
ALPHA_SORT,
PAD_CNT_SORT
};
int ReturnSortedNetnamesList( wxArrayString & aNames, const int aSort_Type);
@ -234,10 +236,10 @@ public:
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
*/
bool Save( FILE* aFile ) const;
/**
* Function GetClass
* returns the class name.
@ -252,41 +254,41 @@ public:
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
void Show( int nestLevel, std::ostream& os );
#endif
/**************************/
/* footprint operations : */
/**************************/
void Change_Side_Module( MODULE* Module, wxDC* DC );
/**************************/
/* footprint operations : */
/**************************/
void Change_Side_Module( MODULE* Module, wxDC* DC );
/*************************/
/* Copper Areas handling */
/*************************/
/**
* Function RedrawAreasOutlines
* Redraw all areas outlines on layer aLayer ( redraw all if aLayer < 0 )
*/
void RedrawAreasOutlines(WinEDA_DrawPanel* panel, wxDC * aDC, int aDrawMode, int aLayer);
/**
* Function SetAreasNetCodesFromNetNames
* 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.
* However the Netcode is an arbitrary equyivalence, it must be set after each netlist read
* or net change
* Must be called after pad netcodes are calculated
* @return : error count
*/
int SetAreasNetCodesFromNetNames(void);
/*************************/
/* Copper Areas handling */
/*************************/
/**
/**
* Function RedrawAreasOutlines
* Redraw all areas outlines on layer aLayer ( redraw all if aLayer < 0 )
*/
void RedrawAreasOutlines(WinEDA_DrawPanel* panel, wxDC * aDC, int aDrawMode, int aLayer);
/**
* Function SetAreasNetCodesFromNetNames
* 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.
* However the Netcode is an arbitrary equyivalence, it must be set after each netlist read
* or net change
* Must be called after pad netcodes are calculated
* @return : error count
*/
int SetAreasNetCodesFromNetNames(void);
/**
* Function GetArea
* returns the Area (Zone Container) at a given index.
* @param index The array type index into a collection of ZONE_CONTAINER *.
@ -299,7 +301,7 @@ public:
return NULL;
}
/**
/**
* Function GetAreaIndex
* returns the Area Index for the given Zone Container.
* @param aArea :The ZONE_CONTAINER to find.
@ -308,13 +310,13 @@ public:
int GetAreaIndex( const ZONE_CONTAINER* aArea) const
{
for( int ii = 0; ii < GetAreaCount(); ii++ ) // Search for aArea in list
{
{
if ( aArea == GetArea( ii ) ) // Found !
return ii;
}
return ii;
}
return -1;
}
/**
* Function GetAreaCount
* @return int - The number of Areas or ZONE_CONTAINER.
@ -324,132 +326,132 @@ public:
return (int) m_ZoneDescriptorList.size();
}
/* Functions used in test, merge and cut outlines */
/**
* Function AddArea
* add empty copper area to net
* @return pointer to the new area
*/
ZONE_CONTAINER* AddArea( int netcode, int layer, int x, int y, int hatch );
/* Functions used in test, merge and cut outlines */
/**
* Function AddArea
* add empty copper area to net
* @return pointer to the new area
*/
ZONE_CONTAINER* AddArea( int netcode, int layer, int x, int y, int hatch );
/**
* remove copper area from net
* @param area = area to remove
* @return 0
*/
int RemoveArea( ZONE_CONTAINER* area_to_remove );
/**
* remove copper area from net
* @param area = area to remove
* @return 0
*/
int RemoveArea( ZONE_CONTAINER* area_to_remove );
/**
* Function InsertArea
* add empty copper area to net, inserting after m_ZoneDescriptorList[iarea]
* @return pointer to the new area
*/
ZONE_CONTAINER* InsertArea( int netcode, int iarea, int layer, int x, int y, int hatch );
/**
* Function InsertArea
* add empty copper area to net, inserting after m_ZoneDescriptorList[iarea]
* @return pointer to the new area
*/
ZONE_CONTAINER* InsertArea( int netcode, int iarea, int layer, int x, int y, int hatch );
/**
Function CompleteArea
* 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
* @param area_to_complete = area to complete or remove
* @param style = style of last corner
* @return 1 if Ok, 0 if area removed
*/
int CompleteArea( ZONE_CONTAINER* area_to_complete, int style );
/**
Function CompleteArea
* 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
* @param area_to_complete = area to complete or remove
* @param style = style of last corner
* @return 1 if Ok, 0 if area removed
*/
int CompleteArea( ZONE_CONTAINER* area_to_complete, int style );
/**
* Function TestAreaPolygon
* Test an area for self-intersection.
*
* @param CurrArea = copper area to test
* @return :
* -1 if arcs intersect other sides
* 0 if no intersecting sides
* 1 if intersecting sides, but no intersecting arcs
* Also sets utility2 flag of area with return value
*/
int TestAreaPolygon( ZONE_CONTAINER* CurrArea );
/**
* Function TestAreaPolygon
* Test an area for self-intersection.
*
* @param CurrArea = copper area to test
* @return :
* -1 if arcs intersect other sides
* 0 if no intersecting sides
* 1 if intersecting sides, but no intersecting arcs
* Also sets utility2 flag of area with return value
*/
int TestAreaPolygon( ZONE_CONTAINER* CurrArea );
/**
* Function ClipAreaPolygon
* 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.
* @param bMessageBoxInt == TRUE, shows message when clipping occurs.
* @param bMessageBoxArc == TRUE, shows message when clipping can't be done due to arcs.
* @return:
* -1 if arcs intersect other sides, so polygon can't be clipped
* 0 if no intersecting sides
* 1 if intersecting sides
* Also sets areas->utility1 flags if areas are modified
*/
int ClipAreaPolygon( ZONE_CONTAINER* CurrArea,
bool bMessageBoxArc, bool bMessageBoxInt, bool bRetainArcs = TRUE );
/**
* Function ClipAreaPolygon
* 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.
* @param bMessageBoxInt == TRUE, shows message when clipping occurs.
* @param bMessageBoxArc == TRUE, shows message when clipping can't be done due to arcs.
* @return:
* -1 if arcs intersect other sides, so polygon can't be clipped
* 0 if no intersecting sides
* 1 if intersecting sides
* Also sets areas->utility1 flags if areas are modified
*/
int ClipAreaPolygon( ZONE_CONTAINER* CurrArea,
bool bMessageBoxArc, bool bMessageBoxInt, bool bRetainArcs = TRUE );
/**
* Process an area that has been modified, by clipping its polygon against
* 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.
* @param modified_area = area to test
* @param bMessageBox : if TRUE, shows message boxes when clipping occurs.
* @return :
* -1 if arcs intersect other sides, so polygon can't be clipped
* 0 if no intersecting sides
* 1 if intersecting sides, polygon clipped
*/
int AreaPolygonModified( ZONE_CONTAINER* modified_area,
bool bMessageBoxArc,
bool bMessageBoxInt );
/**
* Process an area that has been modified, by clipping its polygon against
* 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.
* @param modified_area = area to test
* @param bMessageBox : if TRUE, shows message boxes when clipping occurs.
* @return :
* -1 if arcs intersect other sides, so polygon can't be clipped
* 0 if no intersecting sides
* 1 if intersecting sides, polygon clipped
*/
int AreaPolygonModified( ZONE_CONTAINER* modified_area,
bool bMessageBoxArc,
bool bMessageBoxInt );
/**
* Function CombineAllAreasInNet
* Checks all copper areas in net for intersections, combining them if found
* @param aNetCode = net to consider
* @param bMessageBox : if true display warning message box
* @param bUseUtility : if true, don't check areas if both utility flags are 0
* Sets utility flag = 1 for any areas modified
* If an area has self-intersecting arcs, doesn't try to combine it
*/
int CombineAllAreasInNet( int aNetCode, bool bMessageBox, bool bUseUtility );
/**
* Function CombineAllAreasInNet
* Checks all copper areas in net for intersections, combining them if found
* @param aNetCode = net to consider
* @param bMessageBox : if true display warning message box
* @param bUseUtility : if true, don't check areas if both utility flags are 0
* Sets utility flag = 1 for any areas modified
* If an area has self-intersecting arcs, doesn't try to combine it
*/
int CombineAllAreasInNet( int aNetCode, bool bMessageBox, bool bUseUtility );
/**
* Function TestAreaIntersections
* 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
*/
bool TestAreaIntersections( ZONE_CONTAINER* area_to_test );
/**
* Function TestAreaIntersections
* 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
*/
bool TestAreaIntersections( ZONE_CONTAINER* area_to_test );
/**
* Function TestAreaIntersection
* Test for intersection of 2 copper areas
* area_to_test must be after area_ref in m_ZoneDescriptorList
* @param area_ref = area reference
* @param area_to_test = area to compare for intersection calculations
* @return : 0 if no intersection
* 1 if intersection
* 2 if arcs intersect
*/
int TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_to_test );
/**
* Function TestAreaIntersection
* Test for intersection of 2 copper areas
* area_to_test must be after area_ref in m_ZoneDescriptorList
* @param area_ref = area reference
* @param area_to_test = area to compare for intersection calculations
* @return : 0 if no intersection
* 1 if intersection
* 2 if arcs intersect
*/
int TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_to_test );
/**
* Function CombineAreas
* If possible, combine 2 copper areas
* area_ref must be BEFORE area_to_combine
* area_to_combine will be deleted, if areas are combined
* @return : 0 if no intersection
* 1 if intersection
* 2 if arcs intersect
*/
int CombineAreas( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_to_combine );
/**
* Function CombineAreas
* If possible, combine 2 copper areas
* area_ref must be BEFORE area_to_combine
* area_to_combine will be deleted, if areas are combined
* @return : 0 if no intersection
* 1 if intersection
* 2 if arcs intersect
*/
int CombineAreas( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_to_combine );
/**
* Function Test_Drc_Areas_Outlines_To_Areas_Outlines
* Test Areas outlines for DRC:
* Test areas inside other areas
* Test areas too close
* @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
* @return errors count
*/
int Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_Examine,bool aCreate_Markers );
/**
* Function Test_Drc_Areas_Outlines_To_Areas_Outlines
* Test Areas outlines for DRC:
* Test areas inside other areas
* Test areas too close
* @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
* @return errors count
*/
int Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_Examine,bool aCreate_Markers );
};
#endif // #ifndef CLASS_BOARD_H

View File

@ -150,9 +150,9 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
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_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_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_CurrentMicroViaSize = 150; // Current micro via size
m_MicroViasAllowed = false; // true to allow micro vias

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)
*/
{
TRACK* pt_track;
int masquelayer = g_TabOneLayerMask[GetScreen()->m_Active_Layer];
wxPoint pos;
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 */
if( g_FirstTrackSegment != NULL )
{
/* Put new track in buffer: search the best insertion poinr */
pt_track = g_FirstTrackSegment->GetBestInsertPoint( m_Pcb );
/* Uut track in linked list */
g_FirstTrackSegment->Insert( m_Pcb, pt_track );
// Put new track in board
m_Pcb->Add( g_FirstTrackSegment );
trace_ratsnest_pad( DC );
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;
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 */
@ -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 */
g_CurrentTrackSegment->SetLayer( screen->m_Active_Layer );
if( ! g_DesignSettings.m_UseConnectedTrackWidth )
g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth;
g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth;
if( g_TwoSegmentTrackBuild )
{
TRACK* previous_track = (TRACK*) g_CurrentTrackSegment->Pback;
if( previous_track && (previous_track->Type() == TYPETRACK) )
{
previous_track->SetLayer( screen->m_Active_Layer );
if( ! g_DesignSettings.m_UseConnectedTrackWidth )
previous_track->m_Width = g_DesignSettings.m_CurrentTrackWidth;
}
if( ! g_DesignSettings.m_UseConnectedTrackWidth )
previous_track->m_Width = g_DesignSettings.m_CurrentTrackWidth;
}
}
if( Track_45_Only )

View File

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

View File

@ -312,7 +312,7 @@ int WinEDA_PcbFrame::Solve( wxDC* DC, int two_sides )
* coord destination (row,col)
* net_code
* pointeur sur le chevelu de reference
*
*
* Retourne :
* SUCCESS si route trouvee
* TRIVIAL_SUCCESS si pads connectes par superposition ( pas de piste a tirer)
@ -722,10 +722,10 @@ static long bit[8][9] = { /* OT=Otherside */
* La recherche se fait en sens inverse du routage,
* c.a.d du point d'arrivee (target) vers le point de depart (source)
* du routeur.
*
*
* target_side = cote (TOP / BOTTOM) de depart
* mask_layer_source = masque des couches d'arrivee
*
*
* Retourne:
* 0 si erreur
* > 0 si Ok
@ -983,7 +983,7 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
NewTrack->Insert( pcb, g_CurrentTrackSegment );
g_CurrentTrackSegment->m_Start = pt_cur_ch->pad_end->GetPosition();
NewTrack->m_Start = g_CurrentTrackSegment->m_End;
g_CurrentTrackSegment = NewTrack;
@ -1065,10 +1065,10 @@ static void Place_Piste_en_Buffer( WinEDA_PcbFrame* pcbframe, wxDC* DC )
NewTrack->Insert( pcbframe->m_Pcb, g_CurrentTrackSegment );
NewTrack->m_End = pt_cur_ch->pad_start->GetPosition();
NewTrack->m_Start = g_CurrentTrackSegment->m_End;
g_CurrentTrackSegment = NewTrack;
g_CurrentTrackSegment = NewTrack;
g_TrackSegmentCount++;
}
@ -1082,8 +1082,7 @@ static void Place_Piste_en_Buffer( WinEDA_PcbFrame* pcbframe, wxDC* DC )
g_CurrentTrackSegment->SetState( END_ONPAD, ON );
/* recherche de la zone de rangement et insertion de la nouvelle piste */
pt_track = g_FirstTrackSegment->GetBestInsertPoint( pcbframe->m_Pcb );
g_FirstTrackSegment->Insert( pcbframe->m_Pcb, pt_track );
pcbframe->m_Pcb->Add( g_FirstTrackSegment );
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 );
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>----------------------------------------------------

View File

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

View File

@ -150,6 +150,14 @@ static int scale( double distance, UNIT_RES* aResolution )
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 )
{
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;
SHAPE* shape;
int shapeCount = aPadstack->Length();
int drillDiam = -1;
int viaDiam = 400;
// @todo this needs a lot of work yet, it is not complete yet.
int copperLayerCount = sessionBoard->GetCopperLayerCount();
// 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 )
{
++drillStartNdx; // skip over the ':'
int drillEndNdx = aPadstack->padstack_id.rfind( '_' );
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();
double drillMils = strtod( sdiamTxt, 0 );
// 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
drillDiam = -1; // import as default
@ -217,38 +224,94 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
if( shapeCount == 0 )
{
ThrowIOError( _( "Session via padstack has no shapes") );
}
else if( shapeCount == 1 )
{
shape = (SHAPE*) (*aPadstack)[0];
if( shape->shape->Type() == T_circle )
{
CIRCLE* circle = (CIRCLE*) shape->shape;
viaDiam = scale( circle->diameter, routeResolution );
DSN_T type = shape->shape->Type();
if( type != T_circle )
ThrowIOError( _( "Unsupported via shape: \"%s\""),
LEXER::GetTokenString( type ).GetData() );
via = new SEGVIA( sessionBoard );
via->SetPosition( mapPt( aPoint, routeResolution ) );
via->SetDrillValue( drillDiam );
via->m_Shape = VIA_THROUGH;
via->m_Width = viaDiam;
via->SetLayerPair( CMP_N, COPPER_LAYER_N );
}
CIRCLE* circle = (CIRCLE*) shape->shape;
int viaDiam = scale( circle->diameter, routeResolution );
via = new SEGVIA( sessionBoard );
via->SetPosition( mapPt( aPoint, routeResolution ) );
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];
if( shape->shape->Type() == T_circle )
{
CIRCLE* circle = (CIRCLE*) shape->shape;
viaDiam = scale( circle->diameter, routeResolution );
DSN_T type = shape->shape->Type();
if( type != T_circle )
ThrowIOError( _( "Unsupported via shape: \"%s\""),
LEXER::GetTokenString( type ).GetData() );
via = new SEGVIA( sessionBoard );
via->SetPosition( mapPt( aPoint, routeResolution ) );
via->SetDrillValue( drillDiam );
via->m_Shape = VIA_THROUGH;
via->m_Width = viaDiam;
via->SetLayerPair( CMP_N, COPPER_LAYER_N );
CIRCLE* circle = (CIRCLE*) shape->shape;
int viaDiam = scale( circle->diameter, routeResolution );
via = new SEGVIA( sessionBoard );
via->SetPosition( mapPt( aPoint, routeResolution ) );
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 )
@ -365,7 +428,6 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
// else netCode remains 0
}
WIRES& wires = net->wires;
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 )
{
TRACK* track = makeTRACK( path, pt, netCode );
TRACK* insertAid = track->GetBestInsertPoint( aBoard );
track->Insert( aBoard, insertAid );
aBoard->Add( track );
}
}
@ -428,12 +488,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
for( unsigned v=0; v<wire_via->vertexes.size(); ++v )
{
SEGVIA* via = makeVIA( padstack, wire_via->vertexes[v], netCode );
if( !via )
ThrowIOError( _("Unable to make a via") );
TRACK* insertAid = via->GetBestInsertPoint( aBoard );
via->Insert( aBoard, insertAid );
aBoard->Add( via );
}
}
}

View File

@ -21,33 +21,33 @@ void WinEDA_PcbFrame::UnDeleteItem( wxDC* DC )
/* Restitution d'un element (MODULE ou TRACK ) Efface
*/
{
BOARD_ITEM* PtStruct, * PtNext;
TRACK* pt_track;
BOARD_ITEM* item;
BOARD_ITEM* next;
int net_code;
if( !g_UnDeleteStackPtr )
return;
g_UnDeleteStackPtr--;
PtStruct = g_UnDeleteStack[g_UnDeleteStackPtr];
if( PtStruct == NULL )
item = g_UnDeleteStack[g_UnDeleteStackPtr];
if( item == NULL )
return; // Ne devrait pas se produire
switch( PtStruct->Type() )
switch( item->Type() )
{
case TYPEVIA:
case TYPETRACK:
for( ; PtStruct != NULL; PtStruct = PtNext )
for( ; item; item = next )
{
PtNext = PtStruct->Next();
PtStruct->SetState( DELETED, OFF ); /* Effacement du bit DELETED */
( (TRACK*) PtStruct )->Draw( DrawPanel, DC, GR_OR );
next = item->Next();
item->SetState( DELETED, OFF ); /* Effacement du bit DELETED */
((TRACK*) item)->Draw( DrawPanel, DC, GR_OR );
}
PtStruct = g_UnDeleteStack[g_UnDeleteStackPtr];
net_code = ( (TRACK*) PtStruct )->GetNet();
pt_track = ( (TRACK*) PtStruct )->GetBestInsertPoint( m_Pcb );
( (TRACK*) PtStruct )->Insert( m_Pcb, pt_track );
item = g_UnDeleteStack[g_UnDeleteStackPtr];
net_code = ((TRACK*) item)->GetNet();
m_Pcb->Add( item );
g_UnDeleteStack[g_UnDeleteStackPtr] = NULL;
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,
* en debut de chaine */
PtStruct->Pback = m_Pcb;
PtNext = m_Pcb->m_Modules;
PtStruct->Pnext = PtNext;
if( PtNext )
PtNext->Pback = PtStruct;
m_Pcb->m_Modules = (MODULE*) PtStruct;
m_Pcb->Add( item );
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 */
PtStruct->m_Flags = 0;
item->SetState( DELETED, OFF ); /* Creal DELETED flag */
item->m_Flags = 0;
m_Pcb->m_Status_Pcb = 0;
build_liste_pads();
ReCompile_Ratsnest_After_Changes( DC );
@ -124,11 +120,11 @@ BOARD_ITEM* WinEDA_PcbFrame::SaveItemEfface( BOARD_ITEM* PtItem, int nbitems )
{
NextS = PtStruct->Next();
( (TRACK*) PtStruct )->UnLink();
PtStruct->SetState( DELETED, ON );
if( nbitems <= 1 )
NextS = NULL; /* fin de chaine */
PtStruct->Pnext = NextS;
PtStruct->Pback = Back; Back = PtStruct;
if( NextS == NULL )