Code formatting and clean-up

This commit is contained in:
Maciej Suminski 2017-06-23 13:56:28 +02:00
parent 113163257d
commit f3fbce9560
28 changed files with 456 additions and 1205 deletions

View File

@ -61,7 +61,6 @@ class MARKER_PCB;
class MSG_PANEL_ITEM;
class NETLIST;
class REPORTER;
class RN_DATA;
class SHAPE_POLY_SET;
class CONNECTIVITY_DATA;
@ -292,9 +291,8 @@ public:
/**
* Function GetConnectivity()
* returns list of missing connections between components/tracks.
* @return RATSNEST* is an object that contains informations about missing connections.
* @return an object that contains informations about missing connections.
*/
std::shared_ptr<CONNECTIVITY_DATA> GetConnectivity() const
{
return m_connectivity;

View File

@ -320,7 +320,6 @@ bool TRACKS_CLEANER::cleanupVias()
for( VIA* via = GetFirstVia( m_brd->m_Track ); via != NULL;
via = GetFirstVia( via->Next() ) )
{
if( via->GetFlags() & TRACK_LOCKED )
continue;
@ -675,10 +674,7 @@ TRACK* TRACKS_CLEANER::mergeCollinearSegmentIfPossible( TRACK* aTrackRef, TRACK*
* and if this point is not on a pad, it can be removed and the 2 segments will be merged
*/
auto connectivity=m_brd->GetConnectivity();
updateConn(aTrackRef, connectivity);
updateConn(aCandidate, connectivity);
#if 0
@ -712,7 +708,10 @@ TRACK* TRACKS_CLEANER::mergeCollinearSegmentIfPossible( TRACK* aTrackRef, TRACK*
#endif
auto connectivity = m_brd->GetConnectivity();
updateConn( aTrackRef, connectivity );
updateConn( aCandidate, connectivity );
if( aEndType == ENDPOINT_START )
{
@ -741,8 +740,6 @@ TRACK* TRACKS_CLEANER::mergeCollinearSegmentIfPossible( TRACK* aTrackRef, TRACK*
}
else // aEndType == END
{
// We do not have a pad, which is a always terminal point for a track
if( aTrackRef->GetState( END_ON_PAD ) )
return NULL;

View File

@ -59,13 +59,6 @@ bool CONNECTIVITY_DATA::Remove( BOARD_ITEM* aItem )
}
/**
* Function Update()
* Updates the connectivity data for an item.
* @param aItem is an item to be updated.
* @return True if operation succeeded. The item will not be updated if it was not previously
* added to the ratsnest.
*/
bool CONNECTIVITY_DATA::Update( BOARD_ITEM* aItem )
{
m_connAlgo->Remove( aItem );
@ -122,6 +115,7 @@ void CONNECTIVITY_DATA::updateRatsnest()
}
}
} /* end of parallel section */
#ifdef PROFILE
rnUpdate.Show();
#endif /* PROFILE */
@ -339,13 +333,13 @@ const std::list<BOARD_CONNECTED_ITEM*> CONNECTIVITY_DATA::GetConnectedItems(
aTypes, aItem->GetNetCode() );
for( auto cl : clusters )
{
if( cl->Contains( aItem ) )
{
for( const auto item : *cl )
rv.push_back( item->Parent() );
}
}
return rv;
}
@ -467,6 +461,7 @@ unsigned int CONNECTIVITY_DATA::GetPadCount( int aNet ) const
for( auto pad : m_connAlgo->PadList() )
{
auto dpad = static_cast<D_PAD*>( pad->Parent() );
if( aNet < 0 || aNet == dpad->GetNetCode() )
{
n++;
@ -513,12 +508,12 @@ const std::vector<VECTOR2I> CONNECTIVITY_DATA::NearestUnconnectedTargets(
{
if( item->Parent()->GetNetCode() == refNet
&& item->Parent()->Type() != PCB_ZONE_AREA_T )
{
for( auto anchor : item->Anchors() )
{
anchors.insert( anchor->Pos() );
}
}
}
}
}
@ -538,9 +533,9 @@ const std::vector<VECTOR2I> CONNECTIVITY_DATA::NearestUnconnectedTargets(
return rv;
}
void CONNECTIVITY_DATA::GetUnconnectedEdges( std::vector<CN_EDGE>& aEdges) const
{
for( auto rnNet : m_nets )
{
if( rnNet )
@ -553,7 +548,9 @@ void CONNECTIVITY_DATA::GetUnconnectedEdges( std::vector<CN_EDGE>& aEdges) const
}
}
const std::vector<BOARD_CONNECTED_ITEM*> CONNECTIVITY_DATA::GetConnectedItems( const BOARD_CONNECTED_ITEM* aItem, const VECTOR2I& aAnchor, KICAD_T aTypes[] )
const std::vector<BOARD_CONNECTED_ITEM*> CONNECTIVITY_DATA::GetConnectedItems(
const BOARD_CONNECTED_ITEM* aItem, const VECTOR2I& aAnchor, KICAD_T aTypes[] )
{
auto& entry = m_connAlgo->ItemEntry( aItem );
std::vector<BOARD_CONNECTED_ITEM* > rv;

View File

@ -28,6 +28,8 @@
#include <profile.h>
#endif
using namespace std::placeholders;
bool operator<( const CN_ANCHOR_PTR a, const CN_ANCHOR_PTR b )
{
if( a->Pos().x == b->Pos().x )
@ -36,11 +38,13 @@ bool operator<( const CN_ANCHOR_PTR a, const CN_ANCHOR_PTR b )
return a->Pos().x < b->Pos().x;
}
bool CN_ANCHOR::IsDirty() const
{
return m_item->Dirty();
}
CN_CLUSTER::CN_CLUSTER()
{
m_items.reserve( 64 );
@ -49,11 +53,12 @@ CN_CLUSTER::CN_CLUSTER()
m_conflicting = false;
}
CN_CLUSTER::~CN_CLUSTER()
{
}
wxString CN_CLUSTER::OriginNetName() const
{
if( !m_originPad )
@ -62,6 +67,7 @@ wxString CN_CLUSTER::OriginNetName() const
return m_originPad->Parent()->GetNetname();
}
bool CN_CLUSTER::Contains( const CN_ITEM* aItem )
{
return std::find( m_items.begin(), m_items.end(), aItem ) != m_items.end();
@ -71,14 +77,19 @@ bool CN_CLUSTER::Contains( const CN_ITEM* aItem )
bool CN_CLUSTER::Contains( const BOARD_CONNECTED_ITEM* aItem )
{
for( auto item : m_items )
{
if( item->Parent() == aItem )
return true;
}
return false;
}
void CN_ITEM::Dump()
{
printf(" valid: %d, connected: \n", !!Valid());
for( auto i : m_connected )
{
TRACK* t = static_cast<TRACK*>( i->Parent() );
@ -86,6 +97,7 @@ void CN_ITEM::Dump()
}
}
void CN_CLUSTER::Dump()
{
for( auto item : m_items )
@ -95,13 +107,12 @@ void CN_CLUSTER::Dump()
printf( "- item : %p bitem : %p type : %d inet %s\n", item, item->Parent(),
item->Parent()->Type(), (const char*) item->Parent()->GetNetname().c_str() );
item->Dump();
}
}
}
}
void CN_CLUSTER::Add( CN_ITEM* item )
{
m_items.push_back( item );
if( m_originNet < 0 )
@ -116,6 +127,7 @@ void CN_CLUSTER::Add( CN_ITEM* item )
m_originPad = item;
m_originNet = item->Net();
}
if( m_originPad && item->Net() != m_originNet )
{
m_conflicting = true;
@ -128,11 +140,13 @@ CN_CONNECTIVITY_ALGO::CN_CONNECTIVITY_ALGO()
{
}
CN_CONNECTIVITY_ALGO::~CN_CONNECTIVITY_ALGO()
{
Clear();
}
bool CN_CONNECTIVITY_ALGO::Remove( BOARD_ITEM* aItem )
{
markItemNetAsDirty( aItem );
@ -145,9 +159,10 @@ bool CN_CONNECTIVITY_ALGO::Remove( BOARD_ITEM* aItem )
m_itemMap[ static_cast<BOARD_CONNECTED_ITEM*>( pad ) ].MarkItemsAsInvalid();
m_itemMap.erase( static_cast<BOARD_CONNECTED_ITEM*>( pad ) );
}
m_padList.SetDirty(true);
m_padList.SetDirty( true );
break;
case PCB_PAD_T:
m_itemMap[ static_cast<BOARD_CONNECTED_ITEM*>( aItem ) ].MarkItemsAsInvalid();
m_itemMap.erase( static_cast<BOARD_CONNECTED_ITEM*>( aItem ) );
@ -164,37 +179,38 @@ bool CN_CONNECTIVITY_ALGO::Remove( BOARD_ITEM* aItem )
m_itemMap[ static_cast<BOARD_CONNECTED_ITEM*>( aItem ) ].MarkItemsAsInvalid();
m_itemMap.erase( static_cast<BOARD_CONNECTED_ITEM*>( aItem ) );
m_viaList.SetDirty( true );
break;
case PCB_ZONE_AREA_T:
case PCB_ZONE_T:
{
m_itemMap[ static_cast<BOARD_CONNECTED_ITEM*>( aItem ) ].MarkItemsAsInvalid();
m_itemMap.erase ( static_cast<BOARD_CONNECTED_ITEM*>( aItem ) );
m_zoneList.SetDirty( true );
break;
}
default:
return false;
}
return true;
}
void CN_CONNECTIVITY_ALGO::markItemNetAsDirty( const BOARD_ITEM* aItem )
{
if( aItem->IsConnected() )
{
auto citem = static_cast<const BOARD_CONNECTED_ITEM*>( aItem );
markNetAsDirty( citem->GetNetCode() );
} else {
}
else
{
if( aItem->Type() == PCB_MODULE_T )
{
auto mod = static_cast <const MODULE*>( aItem );
for( D_PAD* pad = mod->PadsList(); pad; pad = pad->Next() )
markNetAsDirty( pad->GetNetCode() );
}
@ -236,6 +252,7 @@ bool CN_CONNECTIVITY_ALGO::Add( BOARD_ITEM* aItem )
break;
}
case PCB_VIA_T:
if( m_itemMap.find( static_cast<VIA*>( aItem ) ) != m_itemMap.end() )
return false;
@ -244,7 +261,6 @@ bool CN_CONNECTIVITY_ALGO::Add( BOARD_ITEM* aItem )
break;
case PCB_ZONE_AREA_T:
case PCB_ZONE_T:
{
@ -260,6 +276,7 @@ bool CN_CONNECTIVITY_ALGO::Add( BOARD_ITEM* aItem )
break;
}
default:
return false;
}
@ -286,7 +303,6 @@ void CN_CONNECTIVITY_ALGO::searchConnections( bool aIncludeZones )
{
const auto parent = aRefItem->Parent();
assert( point->Item() );
assert( point->Item()->Parent() );
assert( aRefItem->Parent() );
@ -313,6 +329,7 @@ void CN_CONNECTIVITY_ALGO::searchConnections( bool aIncludeZones )
CN_ITEM::Connect( aRefItem, point->Item() );
break;
case PCB_TRACE_T:
{
const auto track = static_cast<TRACK*> ( parent );
@ -324,7 +341,6 @@ void CN_CONNECTIVITY_ALGO::searchConnections( bool aIncludeZones )
|| d_end.EuclideanNorm() < aMaxDist )
CN_ITEM::Connect( aRefItem, point->Item() );
break;
}
case PCB_ZONE_T:
@ -366,37 +382,37 @@ void CN_CONNECTIVITY_ALGO::searchConnections( bool aIncludeZones )
if( testedZone->Parent() == aRefZone->Parent() )
return;
if( testedZone->Net() != parentZone->GetNetCode() )
return; // we only test zones belonging to the same net
if( !( testedZone->Parent()->GetLayerSet() &
parentZone->GetLayerSet() ).any() )
if( !( testedZone->Parent()->GetLayerSet() & parentZone->GetLayerSet() ).any() )
return; // and on same layer
const auto& outline = parentZone->GetFilledPolysList().COutline( aRefZone->SubpolyIndex() );
for( int i = 0; i < outline.PointCount(); i++ )
{
if( testedZone->ContainsPoint( outline.CPoint( i ) ) )
{
CN_ITEM::Connect( aRefZone, testedZone );
return;
}
}
const auto testedZoneParent = static_cast<const ZONE_CONTAINER*>( testedZone->Parent() );
const auto& outline2 = testedZoneParent->GetFilledPolysList().COutline( testedZone->SubpolyIndex() );
for( int i = 0; i < outline2.PointCount(); i++ )
{
if( aRefZone->ContainsPoint( outline2.CPoint( i ) ) )
{
CN_ITEM::Connect( aRefZone, testedZone );
return;
}
}
};
#ifdef CONNECTIVITY_DEBUG
printf("Search start\n");
#endif
@ -416,18 +432,18 @@ void CN_CONNECTIVITY_ALGO::searchConnections( bool aIncludeZones )
#ifdef CONNECTIVITY_DEBUG
for( auto item : m_padList )
if ( all.find( item->Parent() ) == all.end() ) { printf("FAiling pad : %p\n", item->Parent() ); assert ( false ); }
if( all.find( item->Parent() ) == all.end() ) { printf("Failing pad : %p\n", item->Parent() ); assert ( false ); }
for( auto item : m_viaList )
if ( all.find( item->Parent() ) == all.end() ) { printf("FAiling via : %p\n", item->Parent() ); assert ( false ); }
if( all.find( item->Parent() ) == all.end() ) { printf("Failing via : %p\n", item->Parent() ); assert ( false ); }
for( auto item : m_trackList )
if ( all.find( item->Parent() ) == all.end() ) { printf("FAiling track : %p\n", item->Parent() ); assert ( false ); }
if( all.find( item->Parent() ) == all.end() ) { printf("Failing track : %p\n", item->Parent() ); assert ( false ); }
for( auto item : m_zoneList )
if ( all.find( item->Parent() ) == all.end() ) { printf("FAiling zome : %p\n", item->Parent() ); assert ( false ); }
if( all.find( item->Parent() ) == all.end() ) { printf("Failing zome : %p\n", item->Parent() ); assert ( false ); }
#endif
using namespace std::placeholders;
#ifdef PROFILE
PROF_COUNTER search_cnt( "search-connections" );
PROF_COUNTER search_basic( "search-basic" );
@ -488,9 +504,6 @@ void CN_CONNECTIVITY_ALGO::searchConnections( bool aIncludeZones )
m_padList.FindNearby( zoneItem->BBox(), searchZones );
m_zoneList.FindNearbyZones( zoneItem->BBox(), std::bind( checkInterZoneConnection, _1, zoneItem ) );
}
}
m_zoneList.ClearDirtyFlags();
@ -507,24 +520,24 @@ void CN_CONNECTIVITY_ALGO::searchConnections( bool aIncludeZones )
#ifdef PROFILE
search_cnt.Show();
#endif
}
void CN_ITEM::RemoveInvalidRefs()
{
auto lastConn = std::remove_if(m_connected.begin(), m_connected.end(), [] ( CN_ITEM * item) {
return !item->Valid();
} );
m_connected.resize( lastConn - m_connected.begin() );
}
void CN_LIST::RemoveInvalidItems( std::vector<CN_ITEM*>& aGarbage )
{
auto lastAnchor = std::remove_if(m_anchors.begin(), m_anchors.end(), [] ( const CN_ANCHOR_PTR anchor) {
auto lastAnchor = std::remove_if(m_anchors.begin(), m_anchors.end(),
[] ( const CN_ANCHOR_PTR anchor ) {
return !anchor->Valid();
} );
m_anchors.resize( lastAnchor - m_anchors.begin() );
@ -553,13 +566,16 @@ bool CN_CONNECTIVITY_ALGO::isDirty() const
return m_viaList.IsDirty() || m_trackList.IsDirty() || m_zoneList.IsDirty() || m_padList.IsDirty();
}
const CN_CONNECTIVITY_ALGO::CLUSTERS CN_CONNECTIVITY_ALGO::SearchClusters( CLUSTER_SEARCH_MODE aMode )
{
constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_PAD_T, PCB_VIA_T, PCB_ZONE_AREA_T, PCB_MODULE_T, EOT };
return SearchClusters( aMode, types, -1 );
}
const CN_CONNECTIVITY_ALGO::CLUSTERS CN_CONNECTIVITY_ALGO::SearchClusters( CLUSTER_SEARCH_MODE aMode, const KICAD_T aTypes[], int aSingleNet )
const CN_CONNECTIVITY_ALGO::CLUSTERS CN_CONNECTIVITY_ALGO::SearchClusters( CLUSTER_SEARCH_MODE aMode,
const KICAD_T aTypes[], int aSingleNet )
{
bool includeZones = ( aMode != CSM_PROPAGATE );
bool withinAnyNet = ( aMode != CSM_PROPAGATE );
@ -585,11 +601,13 @@ const CN_CONNECTIVITY_ALGO::CLUSTERS CN_CONNECTIVITY_ALGO::SearchClusters( CLUST
bool found = false;
for( int i = 0; aTypes[i] != EOT; i++ )
{
if( aItem->Parent()->Type() == aTypes[i] )
{
found = true;
break;
}
}
if( !found )
return;
@ -656,6 +674,7 @@ const CN_CONNECTIVITY_ALGO::CLUSTERS CN_CONNECTIVITY_ALGO::SearchClusters( CLUST
#ifdef CONNECTIVITY_DEBUG
printf("Active clusters: %d\n");
for( auto cl : clusters )
{
printf( "Net %d\n", cl->OriginNet() );
@ -666,6 +685,7 @@ const CN_CONNECTIVITY_ALGO::CLUSTERS CN_CONNECTIVITY_ALGO::SearchClusters( CLUST
return clusters;
}
void CN_CONNECTIVITY_ALGO::Build( BOARD* aBoard )
{
for( int i = 0; i<aBoard->GetAreaCount(); i++ )
@ -678,14 +698,17 @@ void CN_CONNECTIVITY_ALGO::Build( BOARD* aBoard )
Add( tv );
for( auto mod : aBoard->Modules() )
{
for( auto pad : mod->Pads() )
Add( pad );
}
/*wxLogTrace( "CN", "zones : %lu, pads : %lu vias : %lu tracks : %lu\n",
m_zoneList.Size(), m_padList.Size(),
m_viaList.Size(), m_trackList.Size() );*/
}
void CN_CONNECTIVITY_ALGO::Build( const std::vector<BOARD_ITEM*>& aItems )
{
for( auto item : aItems )
@ -715,6 +738,7 @@ void CN_CONNECTIVITY_ALGO::Build( const std::vector<BOARD_ITEM *> &aItems )
}
}
void CN_CONNECTIVITY_ALGO::propagateConnections()
{
for( auto cluster : m_connClusters )
@ -764,9 +788,9 @@ void CN_CONNECTIVITY_ALGO::PropagateNets()
propagateConnections();
}
void CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands( ZONE_CONTAINER* aZone, std::vector<int>& aIslands )
{
if( aZone->GetFilledPolysList().IsEmpty() )
return;
@ -778,6 +802,7 @@ void CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands( ZONE_CONTAINER* aZone, std
m_connClusters = SearchClusters( CSM_CONNECTIVITY_CHECK );
for( auto cluster : m_connClusters )
{
if( cluster->Contains( aZone ) && cluster->IsOrphaned() )
{
for( auto z : *cluster )
@ -788,15 +813,18 @@ void CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands( ZONE_CONTAINER* aZone, std
}
}
}
}
wxLogTrace( "CN", "Found %llu isolated islands\n", aIslands.size() );
}
const CN_CONNECTIVITY_ALGO::CLUSTERS& CN_CONNECTIVITY_ALGO::GetClusters()
{
m_ratsnestClusters = SearchClusters( CSM_RATSNEST );
return m_ratsnestClusters;
};
}
void CN_CONNECTIVITY_ALGO::markNetAsDirty( int aNet )
{
@ -805,14 +833,17 @@ void CN_CONNECTIVITY_ALGO::markNetAsDirty ( int aNet )
if(m_dirtyNets.size() <= aNet )
m_dirtyNets.resize( aNet + 1 );
m_dirtyNets[aNet] = true;
}
int CN_ITEM::AnchorCount() const
{
return m_parent->Type() == PCB_TRACE_T ? 2 : 1;
}
const VECTOR2I CN_ITEM::GetAnchor( int n ) const
{
switch( m_parent->Type() )
@ -838,6 +869,7 @@ const VECTOR2I CN_ITEM::GetAnchor( int n ) const
}
}
int CN_ZONE::AnchorCount() const
{
const auto zone = static_cast<const ZONE_CONTAINER*>( Parent() );
@ -846,6 +878,7 @@ int CN_ZONE::AnchorCount() const
return outline.PointCount() ? 1 : 0;
}
const VECTOR2I CN_ZONE::GetAnchor( int n ) const
{
const auto zone = static_cast<const ZONE_CONTAINER*> ( Parent() );
@ -854,6 +887,7 @@ const VECTOR2I CN_ZONE::GetAnchor(int n ) const
return outline.CPoint( 0 );
}
/*const std::vector<VECTOR2I> CN_CLUSTER::GetAnchors()
{
std::vector<VECTOR2I> anchors;
@ -870,10 +904,12 @@ const VECTOR2I CN_ZONE::GetAnchor(int n ) const
return anchors;
}*/
int CN_ITEM::Net() const
{
if( !m_parent )
return -1;
return m_parent->GetNetCode();
}
@ -888,9 +924,11 @@ bool CN_ANCHOR::Valid() const
{
if( !m_item )
return false;
return m_item->Valid();
}
void CN_CONNECTIVITY_ALGO::Clear()
{
m_ratsnestClusters.clear();
@ -903,30 +941,39 @@ void CN_CONNECTIVITY_ALGO::Clear()
}
void CN_CONNECTIVITY_ALGO::ForEachItem( std::function<void(CN_ITEM*)> aFunc )
{
for( auto item : m_padList )
aFunc( item );
for( auto item : m_viaList )
aFunc( item );
for( auto item : m_trackList )
aFunc( item );
for( auto item : m_zoneList )
aFunc( item );
}
void CN_CONNECTIVITY_ALGO::ForEachAnchor( std::function<void(CN_ANCHOR_PTR)> aFunc )
{
for( auto anchor : m_padList.Anchors() )
aFunc( anchor );
for( auto anchor : m_viaList.Anchors() )
aFunc( anchor );
for( auto anchor : m_trackList.Anchors() )
aFunc( anchor );
for( auto anchor : m_zoneList.Anchors() )
aFunc( anchor );
}
bool CN_ANCHOR::IsDangling() const
{
if( !m_cluster )
@ -935,8 +982,10 @@ bool CN_ANCHOR::IsDangling() const
int validCount = 0;
for( auto item : *m_cluster )
{
if( item->Valid() )
validCount++;
}
return validCount <= 1;
}

View File

@ -145,6 +145,7 @@ private:
typedef std::shared_ptr<CN_ANCHOR> CN_ANCHOR_PTR;
typedef std::vector<CN_ANCHOR_PTR> CN_ANCHORS;
class CN_EDGE
{
public:
@ -189,6 +190,7 @@ private:
bool m_visible = true;
};
class CN_CLUSTER
{
private:
@ -248,6 +250,7 @@ public:
typedef std::shared_ptr<CN_CLUSTER> CN_CLUSTER_PTR;
// a lightweight intrusive list container
template <class T>
class INTRUSIVE_LIST
@ -320,6 +323,7 @@ private:
T* m_root;
};
// basic connectivity item
class CN_ITEM : public INTRUSIVE_LIST<CN_ITEM>
{
@ -328,21 +332,21 @@ private:
using CONNECTED_ITEMS = std::vector<CN_ITEM*>;
// list of items physically connected (touching)
///> list of items physically connected (touching)
CONNECTED_ITEMS m_connected;
CN_ANCHORS m_anchors;
// visited flag for the BFS scan
///> visited flag for the BFS scan
bool m_visited;
// can the net propagator modify the netcode?
///> can the net propagator modify the netcode?
bool m_canChangeNet;
// valid flag, used to identify garbage items (we use lazy removal)
///> valid flag, used to identify garbage items (we use lazy removal)
bool m_valid;
// dirty flag, used to identify recently added item not yet scanned into the connectivity search
///> dirty flag, used to identify recently added item not yet scanned into the connectivity search
bool m_dirty;
public:
@ -461,6 +465,7 @@ public:
typedef std::shared_ptr<CN_ITEM> CN_ITEM_PTR;
class CN_LIST
{
private:
@ -491,7 +496,7 @@ public:
CN_LIST()
{
m_dirty = false;
};
}
void Clear()
{
@ -558,7 +563,6 @@ public:
class CN_PAD_LIST : public CN_LIST
{
public:
CN_ITEM* Add( D_PAD* pad )
{
auto item = new CN_ITEM( pad, false, 2 );
@ -568,8 +572,9 @@ public:
SetDirty();
return item;
}
};
};
class CN_TRACK_LIST : public CN_LIST
{
@ -585,8 +590,9 @@ public:
SetDirty();
return item;
}
};
};
class CN_VIA_LIST : public CN_LIST
{
@ -599,8 +605,9 @@ public:
addAnchor( via->GetStart(), item );
SetDirty();
return item;
}
};
};
class CN_ZONE : public CN_ITEM
{
@ -674,22 +681,23 @@ public:
}
return rv;
};
}
template <class T>
void FindNearbyZones( BOX2I aBBox, T aFunc, bool aDirtyOnly = false );
};
template <class T>
void CN_LIST::FindNearby( BOX2I aBBox, T aFunc, bool aDirtyOnly )
{
for( auto p : m_anchors )
{
if( p->Valid() && aBBox.Contains( p->Pos() ) )
{
if( !aDirtyOnly || p->IsDirty() )
aFunc( p );
}
}
}
@ -787,8 +795,6 @@ void CN_LIST::FindNearby( VECTOR2I aPosition, int aDistMax, T aFunc, bool aDirty
if( p->Valid() )
if( !aDirtyOnly || p->IsDirty() )
aFunc( p );
}
// search previous candidates in list
@ -805,10 +811,10 @@ void CN_LIST::FindNearby( VECTOR2I aPosition, int aDistMax, T aFunc, bool aDirty
// We have here a good candidate:add it
if( p->Valid() )
{
if( !aDirtyOnly || p->IsDirty() )
aFunc( p );
}
}
}

View File

@ -208,7 +208,6 @@ void DRAG_LIST::fillList( std::vector<D_PAD*>& aList )
// store track connected to the pad
for( auto track : connectedTracks )
{
if( pad->HitTest( track->GetStart() ) )
{
track->start = pad;

View File

@ -1744,7 +1744,8 @@ void EAGLE_PLUGIN::loadSignals( wxXmlNode* aSignals )
if( !v.diam || via->GetWidth() <= via->GetDrill() )
{
double annulus = Clamp( m_rules->rlMinViaOuter, (double) (via->GetWidth() / 2 - via->GetDrill()), m_rules->rlMaxViaOuter );
double annulus = Clamp( m_rules->rlMinViaOuter,
(double)( via->GetWidth() / 2 - via->GetDrill() ), m_rules->rlMaxViaOuter );
via->SetWidth( drillz + 2 * annulus );
}
@ -1770,6 +1771,7 @@ void EAGLE_PLUGIN::loadSignals( wxXmlNode* aSignals )
via->SetNetCode( netCode );
}
m_xpath->pop();
}

View File

@ -160,6 +160,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
DBG( g_CurrentTrackList.VerifyListIntegrity() );
int net = -1;
if( lockPoint )
net = lockPoint->GetNetCode();

View File

@ -65,6 +65,7 @@ static const wxString traceFootprintLibrary( wxT( "KicadFootprintLib" ) );
void filterNetClass( const BOARD& aBoard, NETCLASS& aNetClass )
{
auto connectivity = aBoard.GetConnectivity();
for( NETCLASS::iterator it = aNetClass.begin(); it != aNetClass.end(); )
{
NETINFO_ITEM* netinfo = aBoard.FindNet( *it );
@ -74,7 +75,6 @@ void filterNetClass( const BOARD& aBoard, NETCLASS& aNetClass )
else
++it;
}
}
/**

View File

@ -54,6 +54,7 @@ static uint64_t getDistance( const CN_ANCHOR_PTR& aNode1, const CN_ANCHOR_PTR& a
return sqrt( dx * dx + dy * dy );
}
static bool sortWeight( const CN_EDGE& aEdge1, const CN_EDGE& aEdge2 )
{
return aEdge1.GetWeight() < aEdge2.GetWeight();
@ -181,6 +182,7 @@ static const std::vector<CN_EDGE> kruskalMST( std::list<CN_EDGE>& aEdges,
return mst;
}
class RN_NET::TRIANGULATOR_STATE
{
private:
@ -297,16 +299,15 @@ public:
}
};
#include <profile.h>
RN_NET::RN_NET() : m_dirty( true )
{
m_triangulator.reset( new TRIANGULATOR_STATE );
}
void RN_NET::compute()
{
// Special cases do not need complicated algorithms (actually, it does not work well with
// the Delaunay triangulator)
//printf("compute nodes : %d\n", m_nodes.size() );
@ -333,7 +334,6 @@ void RN_NET::compute()
node->SetTag( 0 );
}
return;
}
@ -675,6 +675,7 @@ void RN_NET::AddCluster( CN_CLUSTER_PTR aCluster )
}
}
bool RN_NET::NearestBicoloredPair( const RN_NET& aOtherNet, CN_ANCHOR_PTR& aNode1,
CN_ANCHOR_PTR& aNode2 ) const
{
@ -710,6 +711,7 @@ unsigned int RN_NET::GetNodeCount() const
return m_nodes.size();
}
void RN_NET::SetVisible( bool aEnabled )
{
for( auto& edge : m_rnEdges )

View File

@ -109,7 +109,6 @@ public:
void AddCluster( std::shared_ptr<CN_CLUSTER> aCluster );
unsigned int GetNodeCount() const;
/**
@ -176,7 +175,7 @@ public:
protected:
///> Recomputes ratsnset from scratch.
///> Recomputes ratsnest from scratch.
void compute();
///> Vector of nodes
@ -196,5 +195,4 @@ protected:
std::shared_ptr<TRIANGULATOR_STATE> m_triangulator;
};
#endif /* RATSNEST_DATA_H */

View File

@ -1,804 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013-2016 CERN
* Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "common_actions.h"
#include <tool/action_manager.h>
#include <pcbnew_id.h>
#include <layers_id_colors_and_visibility.h>
#include <bitmaps.h>
#include <wx/defs.h>
#include <hotkeys.h>
// These members are static in class COMMON_ACTIONS: Build them here:
// Selection tool actions
TOOL_ACTION COMMON_ACTIONS::selectionActivate( "pcbnew.InteractiveSelection",
AS_GLOBAL, 0,
"", "", NULL, AF_ACTIVATE ); // No description, it is not supposed to be shown anywhere
TOOL_ACTION COMMON_ACTIONS::selectionCursor( "pcbnew.InteractiveSelection.Cursor",
AS_GLOBAL, 0,
"", "" ); // No description, it is not supposed to be shown anywhere
TOOL_ACTION COMMON_ACTIONS::selectItem( "pcbnew.InteractiveSelection.SelectItem",
AS_GLOBAL, 0,
"", "" ); // No description, it is not supposed to be shown anywhere
TOOL_ACTION COMMON_ACTIONS::unselectItem( "pcbnew.InteractiveSelection.UnselectItem",
AS_GLOBAL, 0,
"", "" ); // No description, it is not supposed to be shown anywhere
TOOL_ACTION COMMON_ACTIONS::selectionClear( "pcbnew.InteractiveSelection.Clear",
AS_GLOBAL, 0,
"", "" ); // No description, it is not supposed to be shown anywhere
TOOL_ACTION COMMON_ACTIONS::selectConnection( "pcbnew.InteractiveSelection.SelectConnection",
AS_GLOBAL, 'U',
_( "Trivial Connection" ), _( "Selects a connection between two junctions." ) );
TOOL_ACTION COMMON_ACTIONS::selectCopper( "pcbnew.InteractiveSelection.SelectCopper",
AS_GLOBAL, 'I',
_( "Copper Connection" ), _( "Selects whole copper connection." ) );
TOOL_ACTION COMMON_ACTIONS::selectNet( "pcbnew.InteractiveSelection.SelectNet",
AS_GLOBAL, 0,
_( "Whole Net" ), _( "Selects all tracks & vias belonging to the same net." ) );
TOOL_ACTION COMMON_ACTIONS::selectSameSheet( "pcbnew.InteractiveSelection.SelectSameSheet",
AS_GLOBAL, 'P',
_( "Same Sheet" ), _( "Selects all modules and tracks in the same schematic sheet" ) );
TOOL_ACTION COMMON_ACTIONS::find( "pcbnew.InteractiveSelection.Find",
AS_GLOBAL, 0, //TOOL_ACTION::LegacyHotKey( HK_FIND_ITEM ), // handled by wxWidgets
_( "Find Item" ), _( "Searches the document for an item" ), find_xpm );
TOOL_ACTION COMMON_ACTIONS::findMove( "pcbnew.InteractiveSelection.FindMove",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_GET_AND_MOVE_FOOTPRINT ) );
// Edit tool actions
TOOL_ACTION COMMON_ACTIONS::editFootprintInFpEditor( "pcbnew.InteractiveEdit.editFootprintInFpEditor",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_MODULE_WITH_MODEDIT ),
_( "Open in Footprint Editor" ),
_( "Opens the selected footprint in the Footprint Editor" ),
module_editor_xpm );
TOOL_ACTION COMMON_ACTIONS::copyPadToSettings( "pcbnew.InteractiveEdit.copyPadToSettings",
AS_GLOBAL, 0,
_( "Copy Pad Settings to Current Settings" ),
_( "Copies the properties of selected pad to the current template pad settings." ) );
TOOL_ACTION COMMON_ACTIONS::copySettingsToPads( "pcbnew.InteractiveEdit.copySettingsToPads",
AS_GLOBAL, 0,
_( "Copy Current Settings to Pads" ),
_( "Copies the current template pad settings to the selected pad(s)." ) );
TOOL_ACTION COMMON_ACTIONS::globalEditPads( "pcbnew.InteractiveEdit.globalPadEdit",
AS_GLOBAL, 0,
_( "Global Pad Edition" ),
_( "Changes pad properties globally." ), push_pad_settings_xpm );
TOOL_ACTION COMMON_ACTIONS::editActivate( "pcbnew.InteractiveEdit",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_MOVE_ITEM ),
_( "Move" ), _( "Moves the selected item(s)" ), move_xpm, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::drag( "pcbnew.InteractiveEdit.dragItem",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DRAG_TRACK_KEEP_SLOPE ),
_( "Drag" ), _( "Drags the selected item(s)" ), drag_track_segment_xpm );
TOOL_ACTION COMMON_ACTIONS::duplicate( "pcbnew.InteractiveEdit.duplicate",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DUPLICATE_ITEM ),
_( "Duplicate" ), _( "Duplicates the selected item(s)" ), duplicate_module_xpm );
TOOL_ACTION COMMON_ACTIONS::duplicateIncrement( "pcbnew.InteractiveEdit.duplicateIncrementPads",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DUPLICATE_ITEM_AND_INCREMENT ),
_( "Duplicate" ), _( "Duplicates the selected item(s), incrementing pad numbers" ) );
TOOL_ACTION COMMON_ACTIONS::moveExact( "pcbnew.InteractiveEdit.moveExact",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_MOVE_ITEM_EXACT ),
_( "Move Exactly..." ), _( "Moves the selected item(s) by an exact amount" ),
move_module_xpm );
TOOL_ACTION COMMON_ACTIONS::createArray( "pcbnew.InteractiveEdit.createArray",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_CREATE_ARRAY ),
_( "Create Array" ), _( "Create array" ), array_module_xpm, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::rotateCw( "pcbnew.InteractiveEdit.rotateCw",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROTATE_ITEM ),
_( "Rotate Clockwise" ), _( "Rotates selected item(s) clockwise" ),
rotate_cw_xpm, AF_NONE, (void*) 1 );
TOOL_ACTION COMMON_ACTIONS::rotateCcw( "pcbnew.InteractiveEdit.rotateCcw",
AS_GLOBAL, MD_SHIFT + 'R',
_( "Rotate Counter-clockwise" ), _( "Rotates selected item(s) counter-clockwise" ),
rotate_ccw_xpm, AF_NONE, (void*) -1 );
TOOL_ACTION COMMON_ACTIONS::flip( "pcbnew.InteractiveEdit.flip",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_FLIP_ITEM ),
_( "Flip" ), _( "Flips selected item(s)" ), swap_layer_xpm );
TOOL_ACTION COMMON_ACTIONS::mirror( "pcbnew.InteractiveEdit.mirror",
AS_GLOBAL, 0,
_( "Mirror" ), _( "Mirrors selected item" ), mirror_h_xpm );
TOOL_ACTION COMMON_ACTIONS::remove( "pcbnew.InteractiveEdit.remove",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_BACK_SPACE ),
_( "Remove" ), _( "Deletes selected item(s)" ), delete_xpm,
AF_NONE, (void*) REMOVE_FLAGS::NORMAL );
TOOL_ACTION COMMON_ACTIONS::removeAlt( "pcbnew.InteractiveEdit.removeAlt",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DELETE ),
_( "Remove (Alternative)" ), _( "Deletes selected item(s)" ), delete_xpm,
AF_NONE, (void*) REMOVE_FLAGS::ALT );
TOOL_ACTION COMMON_ACTIONS::exchangeFootprints( "pcbnew.InteractiveEdit.ExchangeFootprints",
AS_GLOBAL, 0,
_( "Exchange Footprint(s)" ), _( "Change the footprint used for modules" ),
import_module_xpm );
TOOL_ACTION COMMON_ACTIONS::properties( "pcbnew.InteractiveEdit.properties",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_ITEM ),
_( "Properties..." ), _( "Displays item properties dialog" ), editor_xpm );
TOOL_ACTION COMMON_ACTIONS::editModifiedSelection( "pcbnew.InteractiveEdit.ModifiedSelection",
AS_GLOBAL, 0,
"", "" );
// Drawing tool actions
TOOL_ACTION COMMON_ACTIONS::drawLine( "pcbnew.InteractiveDrawing.line",
AS_GLOBAL, 0,
_( "Draw Line" ), _( "Draw a line" ), NULL, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::drawCircle( "pcbnew.InteractiveDrawing.circle",
AS_GLOBAL, 0,
_( "Draw Circle" ), _( "Draw a circle" ), NULL, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::drawArc( "pcbnew.InteractiveDrawing.arc",
AS_GLOBAL, 0,
_( "Draw Arc" ), _( "Draw an arc" ), NULL, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::placeText( "pcbnew.InteractiveDrawing.text",
AS_GLOBAL, 0,
_( "Add Text" ), _( "Add a text" ), NULL, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::drawDimension( "pcbnew.InteractiveDrawing.dimension",
AS_GLOBAL, 0,
_( "Add Dimension" ), _( "Add a dimension" ), NULL, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::drawZone( "pcbnew.InteractiveDrawing.zone",
AS_GLOBAL, 0,
_( "Add Filled Zone" ), _( "Add a filled zone" ), NULL, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::drawKeepout( "pcbnew.InteractiveDrawing.keepout",
AS_GLOBAL, 0,
_( "Add Keepout Area" ), _( "Add a keepout area" ), NULL, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::drawZoneCutout( "pcbnew.InteractiveDrawing.zoneCutout",
AS_GLOBAL, 0,
_( "Add a Zone Cutout" ), _( "Add a cutout area of an existing zone" ),
add_zone_cutout_xpm, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::drawSimilarZone( "pcbnew.InteractiveDrawing.similarZone",
AS_GLOBAL, 0,
_( "Add a Similar Zone" ), _( "Add a zone with the same settings as an existing zone" ),
add_zone_xpm, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::placeDXF( "pcbnew.InteractiveDrawing.placeDXF",
AS_GLOBAL, 0,
"Place DXF", "", NULL, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::setAnchor( "pcbnew.InteractiveDrawing.setAnchor",
AS_GLOBAL, 0,
_( "Place the Footprint Anchor" ), _( "Place the footprint anchor" ),
NULL, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::incWidth( "pcbnew.InteractiveDrawing.incWidth",
AS_CONTEXT, '+',
_( "Increase Line Width" ), _( "Increase the line width" ) );
TOOL_ACTION COMMON_ACTIONS::decWidth( "pcbnew.InteractiveDrawing.decWidth",
AS_CONTEXT, '-',
_( "Decrease Line Width" ), _( "Decrease the line width" ) );
TOOL_ACTION COMMON_ACTIONS::arcPosture( "pcbnew.InteractiveDrawing.arcPosture",
AS_CONTEXT, TOOL_ACTION::LegacyHotKey( HK_SWITCH_TRACK_POSTURE ),
_( "Switch Arc Posture" ), _( "Switch the arc posture" ) );
// View Controls
TOOL_ACTION COMMON_ACTIONS::zoomIn( "common.Control.zoomIn",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_IN ),
_( "Zoom In" ), "", zoom_in_xpm );
TOOL_ACTION COMMON_ACTIONS::zoomOut( "common.Control.zoomOut",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_OUT ),
_( "Zoom Out" ), "", zoom_out_xpm );
TOOL_ACTION COMMON_ACTIONS::zoomInCenter( "common.Control.zoomInCenter",
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION COMMON_ACTIONS::zoomOutCenter( "common.Control.zoomOutCenter",
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION COMMON_ACTIONS::zoomCenter( "common.Control.zoomCenter",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_CENTER ),
_( "Center" ), "", zoom_center_on_screen_xpm );
TOOL_ACTION COMMON_ACTIONS::zoomFitScreen( "common.Control.zoomFitScreen",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_AUTO ),
_( "Zoom Auto" ), "", zoom_fit_in_page_xpm );
TOOL_ACTION COMMON_ACTIONS::zoomPreset( "common.Control.zoomPreset",
AS_GLOBAL, 0,
"", "" );
// Display modes
TOOL_ACTION COMMON_ACTIONS::trackDisplayMode( "pcbnew.Control.trackDisplayMode",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_TRACK_DISPLAY_MODE ),
"", "" );
TOOL_ACTION COMMON_ACTIONS::padDisplayMode( "pcbnew.Control.padDisplayMode",
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION COMMON_ACTIONS::viaDisplayMode( "pcbnew.Control.viaDisplayMode",
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION COMMON_ACTIONS::zoneDisplayEnable( "pcbnew.Control.zoneDisplayEnable",
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION COMMON_ACTIONS::zoneDisplayDisable( "pcbnew.Control.zoneDisplayDisable",
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION COMMON_ACTIONS::zoneDisplayOutlines( "pcbnew.Control.zoneDisplayOutlines",
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION COMMON_ACTIONS::highContrastMode( "pcbnew.Control.highContrastMode",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_HIGHCONTRAST_MODE ),
"", "" );
TOOL_ACTION COMMON_ACTIONS::highContrastInc( "pcbnew.Control.highContrastInc",
AS_GLOBAL, '>',
"", "" );
TOOL_ACTION COMMON_ACTIONS::highContrastDec( "pcbnew.Control.highContrastDec",
AS_GLOBAL, '<',
"", "" );
// Layer control
TOOL_ACTION COMMON_ACTIONS::layerTop( "pcbnew.Control.layerTop",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_COMPONENT ),
"", "", NULL, AF_NONE, (void*) F_Cu );
TOOL_ACTION COMMON_ACTIONS::layerInner1( "pcbnew.Control.layerInner1",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER1 ),
"", "", NULL, AF_NONE, (void*) In1_Cu );
TOOL_ACTION COMMON_ACTIONS::layerInner2( "pcbnew.Control.layerInner2",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER2 ),
"", "", NULL, AF_NONE, (void*) In2_Cu );
TOOL_ACTION COMMON_ACTIONS::layerInner3( "pcbnew.Control.layerInner3",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER3 ),
"", "", NULL, AF_NONE, (void*) In3_Cu );
TOOL_ACTION COMMON_ACTIONS::layerInner4( "pcbnew.Control.layerInner4",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER4 ),
"", "", NULL, AF_NONE, (void*) In4_Cu );
TOOL_ACTION COMMON_ACTIONS::layerInner5( "pcbnew.Control.layerInner5",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER5 ),
"", "", NULL, AF_NONE, (void*) In5_Cu );
TOOL_ACTION COMMON_ACTIONS::layerInner6( "pcbnew.Control.layerInner6",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER6 ),
"", "", NULL, AF_NONE, (void*) In6_Cu );
TOOL_ACTION COMMON_ACTIONS::layerBottom( "pcbnew.Control.layerBottom",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_COPPER ),
"", "", NULL, AF_NONE, (void*) B_Cu );
TOOL_ACTION COMMON_ACTIONS::layerNext( "pcbnew.Control.layerNext",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_NEXT ),
"", "" );
TOOL_ACTION COMMON_ACTIONS::layerPrev( "pcbnew.Control.layerPrev",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_PREVIOUS ),
"", "" );
TOOL_ACTION COMMON_ACTIONS::layerToggle( "pcbnew.Control.layerToggle",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_THROUGH_VIA ),
"", "" );
TOOL_ACTION COMMON_ACTIONS::layerAlphaInc( "pcbnew.Control.layerAlphaInc",
AS_GLOBAL, '}',
"", "" );
TOOL_ACTION COMMON_ACTIONS::layerAlphaDec( "pcbnew.Control.layerAlphaDec",
AS_GLOBAL, '{',
"", "" );
TOOL_ACTION COMMON_ACTIONS::layerChanged( "pcbnew.Control.layerChanged",
AS_GLOBAL, 0,
"", "", NULL, AF_NOTIFY );
// Grid control
TOOL_ACTION COMMON_ACTIONS::gridFast1( "common.Control.gridFast1",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_GRID_TO_FASTGRID1 ),
"", "" );
TOOL_ACTION COMMON_ACTIONS::gridFast2( "common.Control.gridFast2",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_GRID_TO_FASTGRID2 ),
"", "" );
TOOL_ACTION COMMON_ACTIONS::gridNext( "common.Control.gridNext",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_GRID_TO_NEXT ),
"", "" );
TOOL_ACTION COMMON_ACTIONS::gridPrev( "common.Control.gridPrev",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_GRID_TO_PREVIOUS ),
"", "" );
TOOL_ACTION COMMON_ACTIONS::gridSetOrigin( "common.Control.gridSetOrigin",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SET_GRID_ORIGIN ),
"", "" );
TOOL_ACTION COMMON_ACTIONS::gridResetOrigin( "common.Control.gridResetOrigin",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_RESET_GRID_ORIGIN ),
"", "" );
TOOL_ACTION COMMON_ACTIONS::gridPreset( "common.Control.gridPreset",
AS_GLOBAL, 0,
"", "" );
// Track & via size control
TOOL_ACTION COMMON_ACTIONS::trackWidthInc( "pcbnew.EditorControl.trackWidthInc",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_TRACK_WIDTH_TO_NEXT ),
"", "" );
TOOL_ACTION COMMON_ACTIONS::trackWidthDec( "pcbnew.EditorControl.trackWidthDec",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_TRACK_WIDTH_TO_PREVIOUS ),
"", "" );
TOOL_ACTION COMMON_ACTIONS::viaSizeInc( "pcbnew.EditorControl.viaSizeInc",
AS_GLOBAL, '\'',
"", "" );
TOOL_ACTION COMMON_ACTIONS::viaSizeDec( "pcbnew.EditorControl.viaSizeDec",
AS_GLOBAL, '\\',
"", "" );
TOOL_ACTION COMMON_ACTIONS::trackViaSizeChanged( "pcbnew.EditorControl.trackViaSizeChanged",
AS_GLOBAL, 0,
"", "", NULL, AF_NOTIFY );
// Zone actions
TOOL_ACTION COMMON_ACTIONS::zoneFill( "pcbnew.EditorControl.zoneFill",
AS_GLOBAL, 0,
_( "Fill" ), _( "Fill zone(s)" ), fill_zone_xpm );
TOOL_ACTION COMMON_ACTIONS::zoneFillAll( "pcbnew.EditorControl.zoneFillAll",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZONE_FILL_OR_REFILL ),
_( "Fill All" ), _( "Fill all zones" ) );
TOOL_ACTION COMMON_ACTIONS::zoneUnfill( "pcbnew.EditorControl.zoneUnfill",
AS_GLOBAL, 0,
_( "Unfill" ), _( "Unfill zone(s)" ), zone_unfill_xpm );
TOOL_ACTION COMMON_ACTIONS::zoneUnfillAll( "pcbnew.EditorControl.zoneUnfillAll",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZONE_REMOVE_FILLED ),
_( "Unfill All" ), _( "Unfill all zones" ) );
TOOL_ACTION COMMON_ACTIONS::zoneMerge( "pcbnew.EditorControl.zoneMerge",
AS_GLOBAL, 0,
_( "Merge Zones" ), _( "Merge zones" ) );
TOOL_ACTION COMMON_ACTIONS::zoneDuplicate( "pcbnew.EditorControl.zoneDuplicate",
AS_GLOBAL, 0,
_( "Duplicate Zone onto Layer" ), _( "Duplicate zone outline onto a different layer" ),
zone_duplicate_xpm );
TOOL_ACTION COMMON_ACTIONS::placeTarget( "pcbnew.EditorControl.placeTarget",
AS_GLOBAL, 0,
_( "Add Layer Alignment Target" ), _( "Add a layer alignment target" ), NULL, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::placeModule( "pcbnew.EditorControl.placeModule",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_MODULE ),
_( "Add Footprint" ), _( "Add a footprint" ), NULL, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::drillOrigin( "pcbnew.EditorControl.drillOrigin",
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION COMMON_ACTIONS::crossProbeSchToPcb( "pcbnew.EditorControl.crossProbSchToPcb",
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION COMMON_ACTIONS::toggleLock( "pcbnew.EditorControl.toggleLock",
AS_GLOBAL, 'L',
"Toggle Lock", "" );
TOOL_ACTION COMMON_ACTIONS::lock( "pcbnew.EditorControl.lock",
AS_GLOBAL, 0,
_( "Lock" ), "" );
TOOL_ACTION COMMON_ACTIONS::unlock( "pcbnew.EditorControl.unlock",
AS_GLOBAL, 0,
_( "Unlock" ), "" );
TOOL_ACTION COMMON_ACTIONS::appendBoard( "pcbnew.EditorControl.appendBoard",
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION COMMON_ACTIONS::highlightNet( "pcbnew.EditorControl.highlightNet",
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION COMMON_ACTIONS::highlightNetCursor( "pcbnew.EditorControl.highlightNetCursor",
AS_GLOBAL, 0,
"", "" );
// Module editor tools
TOOL_ACTION COMMON_ACTIONS::placePad( "pcbnew.ModuleEditor.placePad",
AS_GLOBAL, 0,
_( "Add Pad" ), _( "Add a pad" ), NULL, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::enumeratePads( "pcbnew.ModuleEditor.enumeratePads",
AS_GLOBAL, 0,
_( "Enumerate Pads" ), _( "Enumerate pads" ), pad_enumerate_xpm, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::copyItems( "pcbnew.ModuleEditor.copyItems",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_COPY_ITEM ),
_( "Copy" ), _( "Copy items" ), NULL, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::pasteItems( "pcbnew.ModuleEditor.pasteItems",
AS_GLOBAL, MD_CTRL + int( 'V' ),
_( "Paste" ), _( "Paste items" ), NULL, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::moduleEdgeOutlines( "pcbnew.ModuleEditor.graphicOutlines",
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION COMMON_ACTIONS::moduleTextOutlines( "pcbnew.ModuleEditor.textOutlines",
AS_GLOBAL, 0,
"", "" );
// Pad tools
TOOL_ACTION COMMON_ACTIONS::copyPadSettings(
"pcbnew.PadTool.CopyPadSettings",
AS_GLOBAL, 0,
_( "Copy Pad Settings" ), _( "Copy current pad's settings to the board design settings" ),
copy_pad_settings_xpm );
TOOL_ACTION COMMON_ACTIONS::applyPadSettings(
"pcbnew.PadTool.ApplyPadSettings",
AS_GLOBAL, 0,
_( "Apply Pad Settings" ), _( "Copy the board design settings pad properties to the current pad" ),
apply_pad_settings_xpm );
TOOL_ACTION COMMON_ACTIONS::pushPadSettings(
"pcbnew.PadTool.PushPadSettings",
AS_GLOBAL, 0,
_( "Push Pad Settings" ), _( "Copy the current pad settings to other pads" ),
push_pad_settings_xpm );
// Cursor control
TOOL_ACTION COMMON_ACTIONS::cursorUp( "pcbnew.Control.cursorUp",
AS_GLOBAL, WXK_UP, "", "", NULL, AF_NONE, (void*) CURSOR_UP );
TOOL_ACTION COMMON_ACTIONS::cursorDown( "pcbnew.Control.cursorDown",
AS_GLOBAL, WXK_DOWN, "", "" , NULL, AF_NONE, (void*) CURSOR_DOWN );
TOOL_ACTION COMMON_ACTIONS::cursorLeft( "pcbnew.Control.cursorLeft",
AS_GLOBAL, WXK_LEFT, "", "" , NULL, AF_NONE, (void*) CURSOR_LEFT );
TOOL_ACTION COMMON_ACTIONS::cursorRight( "pcbnew.Control.cursorRight",
AS_GLOBAL, WXK_RIGHT, "", "" , NULL, AF_NONE, (void*) CURSOR_RIGHT );
TOOL_ACTION COMMON_ACTIONS::cursorUpFast( "pcbnew.Control.cursorUpFast",
AS_GLOBAL, MD_CTRL + WXK_UP, "", "", NULL, AF_NONE, (void*) ( CURSOR_UP | CURSOR_FAST_MOVE ) );
TOOL_ACTION COMMON_ACTIONS::cursorDownFast( "pcbnew.Control.cursorDownFast",
AS_GLOBAL, MD_CTRL + WXK_DOWN, "", "" , NULL, AF_NONE, (void*) ( CURSOR_DOWN | CURSOR_FAST_MOVE ) );
TOOL_ACTION COMMON_ACTIONS::cursorLeftFast( "pcbnew.Control.cursorLeftFast",
AS_GLOBAL, MD_CTRL + WXK_LEFT, "", "" , NULL, AF_NONE, (void*) ( CURSOR_LEFT | CURSOR_FAST_MOVE ) );
TOOL_ACTION COMMON_ACTIONS::cursorRightFast( "pcbnew.Control.cursorRightFast",
AS_GLOBAL, MD_CTRL + WXK_RIGHT, "", "" , NULL, AF_NONE, (void*) ( CURSOR_RIGHT | CURSOR_FAST_MOVE ) );
TOOL_ACTION COMMON_ACTIONS::cursorClick( "pcbnew.Control.cursorClick",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_LEFT_CLICK ),
"", "", NULL, AF_NONE, (void*) CURSOR_CLICK );
TOOL_ACTION COMMON_ACTIONS::cursorDblClick( "pcbnew.Control.cursorDblClick",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_LEFT_DCLICK ),
"", "", NULL, AF_NONE, (void*) CURSOR_DBL_CLICK );
TOOL_ACTION COMMON_ACTIONS::panUp( "pcbnew.Control.panUp",
AS_GLOBAL, MD_SHIFT + WXK_UP, "", "", NULL, AF_NONE, (void*) CURSOR_UP );
TOOL_ACTION COMMON_ACTIONS::panDown( "pcbnew.Control.panDown",
AS_GLOBAL, MD_SHIFT + WXK_DOWN, "", "" , NULL, AF_NONE, (void*) CURSOR_DOWN );
TOOL_ACTION COMMON_ACTIONS::panLeft( "pcbnew.Control.panLeft",
AS_GLOBAL, MD_SHIFT + WXK_LEFT, "", "" , NULL, AF_NONE, (void*) CURSOR_LEFT );
TOOL_ACTION COMMON_ACTIONS::panRight( "pcbnew.Control.panRight",
AS_GLOBAL, MD_SHIFT + WXK_RIGHT, "", "" , NULL, AF_NONE, (void*) CURSOR_RIGHT );
// Miscellaneous
TOOL_ACTION COMMON_ACTIONS::selectionTool( "pcbnew.Control.selectionTool",
AS_GLOBAL, 0,
"", "", NULL, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::zoomTool( "pcbnew.Control.zoomTool",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_SELECTION ),
_( "Zoom to Selection" ), "", NULL, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::pickerTool( "pcbnew.Picker", AS_GLOBAL, 0, "", "", NULL, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::resetCoords( "pcbnew.Control.resetCoords",
AS_GLOBAL, ' ',
"", "" );
TOOL_ACTION COMMON_ACTIONS::switchCursor( "pcbnew.Control.switchCursor",
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION COMMON_ACTIONS::switchUnits( "pcbnew.Control.switchUnits",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_UNITS ),
"", "" );
TOOL_ACTION COMMON_ACTIONS::deleteItemCursor( "pcbnew.Control.deleteItemCursor",
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION COMMON_ACTIONS::showHelp( "pcbnew.Control.showHelp",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HELP ),
"", "" );
TOOL_ACTION COMMON_ACTIONS::toBeDone( "pcbnew.Control.toBeDone",
AS_GLOBAL, 0, // dialog saying it is not implemented yet
"", "" ); // so users are aware of that
TOOL_ACTION COMMON_ACTIONS::routerActivateSingle( "pcbnew.InteractiveRouter.SingleTrack",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_NEW_TRACK ),
_( "Interactive Router (Single Tracks)" ),
_( "Run push & shove router (single tracks)" ), ps_router_xpm, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::routerActivateDiffPair( "pcbnew.InteractiveRouter.DiffPair",
AS_GLOBAL, '6',
_( "Interactive Router (Differential Pairs)" ),
_( "Run push & shove router (differential pairs)" ), ps_diff_pair_xpm, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::routerActivateSettingsDialog( "pcbnew.InteractiveRouter.SettingsDialog",
AS_GLOBAL, 0,
_( "Interactive Router Settings" ),
_( "Open Interactive Router settings" ), NULL, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::routerActivateDpDimensionsDialog( "pcbnew.InteractiveRouter.DpDimensionsDialog",
AS_GLOBAL, 0,
_( "Differential Pair Dimension settings" ),
_( "Open Differential Pair Dimension settings" ), ps_diff_pair_gap_xpm, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::routerActivateTuneSingleTrace( "pcbnew.LengthTuner.TuneSingleTrack",
AS_GLOBAL, '7',
_( "Tune length of a single track" ), "", ps_tune_length_xpm, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::routerActivateTuneDiffPair( "pcbnew.LengthTuner.TuneDiffPair",
AS_GLOBAL, '8',
_( "Tune length of a differential pair" ), "", NULL, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::routerActivateTuneDiffPairSkew( "pcbnew.LengthTuner.TuneDiffPairSkew",
AS_GLOBAL, '9',
_( "Tune skew of a differential pair" ), "", NULL, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::routerInlineDrag( "pcbnew.InteractiveRouter.InlineDrag",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DRAG_TRACK_KEEP_SLOPE ),
_( "Drag Track/Via" ), _( "Drags tracks and vias without breaking connections" ),
drag_track_segment_xpm );
// Point editor
TOOL_ACTION COMMON_ACTIONS::pointEditorAddCorner( "pcbnew.PointEditor.addCorner",
AS_GLOBAL, 0,
_( "Create Corner" ), _( "Create a corner" ), add_corner_xpm );
TOOL_ACTION COMMON_ACTIONS::pointEditorRemoveCorner( "pcbnew.PointEditor.removeCorner",
AS_GLOBAL, 0,
_( "Remove Corner" ), _( "Remove corner" ), delete_xpm );
// Placement tool
TOOL_ACTION COMMON_ACTIONS::alignTop( "pcbnew.Place.alignTop",
AS_GLOBAL, 0,
_( "Align to Top" ),
_( "Aligns selected items to the top edge" ), up_xpm );
TOOL_ACTION COMMON_ACTIONS::alignBottom( "pcbnew.Place.alignBottom",
AS_GLOBAL, 0,
_( "Align to Bottom" ),
_( "Aligns selected items to the bottom edge" ), down_xpm );
TOOL_ACTION COMMON_ACTIONS::alignLeft( "pcbnew.Place.alignLeft",
AS_GLOBAL, 0,
_( "Align to Left" ),
_( "Aligns selected items to the left edge" ), left_xpm );
TOOL_ACTION COMMON_ACTIONS::alignRight( "pcbnew.Place.alignRight",
AS_GLOBAL, 0,
_( "Align to Right" ),
_( "Aligns selected items to the right edge" ), right_xpm );
TOOL_ACTION COMMON_ACTIONS::distributeHorizontally( "pcbnew.Place.distributeHorizontally",
AS_GLOBAL, 0,
_( "Distribute Horizontally" ),
_( "Distributes selected items along the horizontal axis" ), distribute_horizontal_xpm );
TOOL_ACTION COMMON_ACTIONS::distributeVertically( "pcbnew.Place.distributeVertically",
AS_GLOBAL, 0,
_( "Distribute Vertically" ),
_( "Distributes selected items along the vertical axis" ), distribute_vertical_xpm );
boost::optional<TOOL_EVENT> COMMON_ACTIONS::TranslateLegacyId( int aId )
{
switch( aId )
{
case ID_PCB_MODULE_BUTT:
return COMMON_ACTIONS::placeModule.MakeEvent();
case ID_TRACK_BUTT:
return COMMON_ACTIONS::routerActivateSingle.MakeEvent();
case ID_DIFF_PAIR_BUTT:
return COMMON_ACTIONS::routerActivateDiffPair.MakeEvent();
case ID_TUNE_SINGLE_TRACK_LEN_BUTT:
return COMMON_ACTIONS::routerActivateTuneSingleTrace.MakeEvent();
case ID_TUNE_DIFF_PAIR_LEN_BUTT:
return COMMON_ACTIONS::routerActivateTuneDiffPair.MakeEvent();
case ID_TUNE_DIFF_PAIR_SKEW_BUTT:
return COMMON_ACTIONS::routerActivateTuneDiffPairSkew.MakeEvent();
case ID_MENU_INTERACTIVE_ROUTER_SETTINGS:
return COMMON_ACTIONS::routerActivateSettingsDialog.MakeEvent();
case ID_MENU_DIFF_PAIR_DIMENSIONS:
return COMMON_ACTIONS::routerActivateDpDimensionsDialog.MakeEvent();
case ID_PCB_ZONES_BUTT:
return COMMON_ACTIONS::drawZone.MakeEvent();
case ID_PCB_KEEPOUT_AREA_BUTT:
return COMMON_ACTIONS::drawKeepout.MakeEvent();
case ID_PCB_ADD_LINE_BUTT:
case ID_MODEDIT_LINE_TOOL:
return COMMON_ACTIONS::drawLine.MakeEvent();
case ID_PCB_CIRCLE_BUTT:
case ID_MODEDIT_CIRCLE_TOOL:
return COMMON_ACTIONS::drawCircle.MakeEvent();
case ID_PCB_ARC_BUTT:
case ID_MODEDIT_ARC_TOOL:
return COMMON_ACTIONS::drawArc.MakeEvent();
case ID_PCB_ADD_TEXT_BUTT:
case ID_MODEDIT_TEXT_TOOL:
return COMMON_ACTIONS::placeText.MakeEvent();
case ID_PCB_DIMENSION_BUTT:
return COMMON_ACTIONS::drawDimension.MakeEvent();
case ID_PCB_MIRE_BUTT:
return COMMON_ACTIONS::placeTarget.MakeEvent();
case ID_MODEDIT_PAD_TOOL:
return COMMON_ACTIONS::placePad.MakeEvent();
case ID_GEN_IMPORT_DXF_FILE:
return COMMON_ACTIONS::placeDXF.MakeEvent();
case ID_MODEDIT_ANCHOR_TOOL:
return COMMON_ACTIONS::setAnchor.MakeEvent();
case ID_PCB_PLACE_GRID_COORD_BUTT:
case ID_MODEDIT_PLACE_GRID_COORD:
return COMMON_ACTIONS::gridSetOrigin.MakeEvent();
case ID_ZOOM_IN: // toolbar button "Zoom In"
return COMMON_ACTIONS::zoomInCenter.MakeEvent();
case ID_ZOOM_OUT: // toolbar button "Zoom In"
return COMMON_ACTIONS::zoomOutCenter.MakeEvent();
case ID_ZOOM_PAGE: // toolbar button "Fit on Screen"
return COMMON_ACTIONS::zoomFitScreen.MakeEvent();
case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH:
return COMMON_ACTIONS::trackDisplayMode.MakeEvent();
case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
return COMMON_ACTIONS::padDisplayMode.MakeEvent();
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
return COMMON_ACTIONS::viaDisplayMode.MakeEvent();
case ID_TB_OPTIONS_SHOW_ZONES:
return COMMON_ACTIONS::zoneDisplayEnable.MakeEvent();
case ID_TB_OPTIONS_SHOW_ZONES_DISABLE:
return COMMON_ACTIONS::zoneDisplayDisable.MakeEvent();
case ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY:
return COMMON_ACTIONS::zoneDisplayOutlines.MakeEvent();
case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH:
return COMMON_ACTIONS::moduleEdgeOutlines.MakeEvent();
case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH:
return COMMON_ACTIONS::moduleTextOutlines.MakeEvent();
case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE:
return COMMON_ACTIONS::highContrastMode.MakeEvent();
case ID_FIND_ITEMS:
return COMMON_ACTIONS::find.MakeEvent();
case ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST:
return COMMON_ACTIONS::findMove.MakeEvent();
case ID_NO_TOOL_SELECTED:
return COMMON_ACTIONS::selectionTool.MakeEvent();
case ID_ZOOM_SELECTION:
return COMMON_ACTIONS::zoomTool.MakeEvent();
case ID_PCB_DELETE_ITEM_BUTT:
case ID_MODEDIT_DELETE_TOOL:
return COMMON_ACTIONS::deleteItemCursor.MakeEvent();
case ID_PCB_PLACE_OFFSET_COORD_BUTT:
return COMMON_ACTIONS::drillOrigin.MakeEvent();
case ID_PCB_HIGHLIGHT_BUTT:
return COMMON_ACTIONS::highlightNetCursor.MakeEvent();
case ID_APPEND_FILE:
return COMMON_ACTIONS::appendBoard.MakeEvent();
case ID_PCB_SHOW_1_RATSNEST_BUTT:
return COMMON_ACTIONS::showLocalRatsnest.MakeEvent();
}
return boost::optional<TOOL_EVENT>();
}

View File

@ -1389,19 +1389,19 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
const auto lset = aVia->GetLayerSet();
for( auto tv : m_board->Tracks() ) // fixme: move to BOARD class?
if( tv->HitTest( pos ) && (tv->GetLayerSet() &
lset ).any() )
{
if( tv->HitTest( pos ) && ( tv->GetLayerSet() & lset ).any() )
return -1;
}
for( auto mod : m_board->Modules() )
{
for( auto pad : mod->Pads() )
if( pad->HitTest( pos ) && (pad->GetLayerSet() &
lset ).any() )
{
if( pad->HitTest( pos ) && ( pad->GetLayerSet() & lset ).any() )
return -1;
}
}
std::vector<ZONE_CONTAINER*> foundZones;
@ -1511,7 +1511,6 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
break;
}
return std::unique_ptr<BOARD_ITEM>( via );
}
};
@ -1520,8 +1519,7 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
frame()->SetToolID( ID_PCB_DRAW_VIA_BUTT, wxCURSOR_PENCIL, _( "Add vias" ) );
doInteractiveItemPlacement( &placer, _(
"Place via" ),
doInteractiveItemPlacement( &placer, _( "Place via" ),
IPO_REPEAT | IPO_SINGLE_CLICK | IPO_ROTATE | IPO_FLIP | IPO_PROPERTIES );
frame()->SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString );

View File

@ -532,6 +532,7 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
return 0;
}
/*!
* Mirror a point about the vertical axis passing through another point
*/
@ -1149,6 +1150,7 @@ void EDIT_TOOL::SetTransitions()
Go( &EDIT_TOOL::MeasureTool, PCB_ACTIONS::measureTool.MakeEvent() );
}
void EDIT_TOOL::updateRatsnest( bool aRedraw )
{
auto& selection = m_selectionTool->GetSelection();
@ -1161,6 +1163,7 @@ void EDIT_TOOL::updateRatsnest( bool aRedraw )
connectivity->ComputeDynamicRatsnest( items );
}
wxPoint EDIT_TOOL::getModificationPoint( const SELECTION& aSelection )
{
if( aSelection.Size() == 1 )
@ -1178,6 +1181,7 @@ wxPoint EDIT_TOOL::getModificationPoint( const SELECTION& aSelection )
}
}
int EDIT_TOOL::editFootprintInFpEditor( const TOOL_EVENT& aEvent )
{
const auto& selection = m_selectionTool->RequestSelection();
@ -1214,6 +1218,7 @@ int EDIT_TOOL::editFootprintInFpEditor( const TOOL_EVENT& aEvent )
return 0;
}
template<class T>
T* EDIT_TOOL::uniqueSelected()
{

View File

@ -145,8 +145,6 @@ private:
///> of edit reference point).
VECTOR2I m_cursor;
std::unique_ptr<CONNECTIVITY_DATA> m_dynamicConnectivity;
///> Updates ratsnest for selected items.
///> @param aRedraw says if selected items should be drawn using the simple mode (e.g. one line
///> per item).

View File

@ -1088,6 +1088,7 @@ int PCB_EDITOR_CONTROL::HighlightNetCursor( const TOOL_EVENT& aEvent )
return 0;
}
static bool showLocalRatsnest( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition )
{
auto selectionTool = aToolMgr->GetTool<SELECTION_TOOL>();
@ -1114,6 +1115,7 @@ static bool showLocalRatsnest( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition
return true;
}
int PCB_EDITOR_CONTROL::ShowLocalRatsnest( const TOOL_EVENT& aEvent )
{
Activate();
@ -1130,6 +1132,7 @@ int PCB_EDITOR_CONTROL::ShowLocalRatsnest( const TOOL_EVENT& aEvent )
return 0;
}
int PCB_EDITOR_CONTROL::UpdateSelectionRatsnest( const TOOL_EVENT& aEvent )
{
return 0;

View File

@ -144,6 +144,7 @@ void PCB_TOOL::doInteractiveItemPlacement( INTERACTIVE_PLACER_BASE *aPlacer,
controls()->CaptureCursor( false );
controls()->SetAutoPan( false );
controls()->ShowCursor( true );
if( !( aOptions & IPO_REPEAT ) )
break;
@ -156,7 +157,6 @@ void PCB_TOOL::doInteractiveItemPlacement( INTERACTIVE_PLACER_BASE *aPlacer,
preview.Add( newItem.get() );
}
}
}

View File

@ -189,7 +189,9 @@ int PCB_EDIT_FRAME::Fill_All_Zones( wxWindow * aActiveWindow, bool aVerbose )
// Recalculate the active ratsnest, i.e. the unconnected links
//TestForActiveLinksInRatsnest( 0 );
if( progressDialog )
progressDialog->Destroy();
return errorLevel;
}