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

@ -177,7 +177,7 @@ void TRACKS_CLEANER::buildTrackConnectionInfo()
//RebuildTrackChain ( m_brd );
// clear flags and variables used in cleanup
// clear flags and variables used in cleanup
for( auto track : m_brd->Tracks() )
{
track->SetState( START_ON_PAD | END_ON_PAD | BUSY, false );
@ -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;
@ -367,7 +366,7 @@ bool TRACKS_CLEANER::testTrackEndpointDangling( TRACK* aTrack, ENDPOINT_T aEndPo
auto connectivity = m_brd->GetConnectivity();
VECTOR2I endpoint ;
if ( aTrack->Type() == PCB_TRACE_T )
if( aTrack->Type() == PCB_TRACE_T )
endpoint = aTrack->GetEndPoint( aEndPoint );
else
endpoint = aTrack->GetStart( );
@ -381,9 +380,9 @@ bool TRACKS_CLEANER::testTrackEndpointDangling( TRACK* aTrack, ENDPOINT_T aEndPo
auto anchors = citem->Anchors();
for ( auto anchor : anchors )
for( auto anchor : anchors )
{
if ( anchor->Pos() == endpoint && anchor->IsDangling() )
if( anchor->Pos() == endpoint && anchor->IsDangling() )
return true;
}
@ -451,7 +450,7 @@ bool TRACKS_CLEANER::deleteNullSegments()
for( auto segment : m_brd->Tracks() )
{
if ( segment->IsNull() ) // Length segment = 0; delete it
if( segment->IsNull() ) // Length segment = 0; delete it
toRemove.insert( segment );
}
@ -467,7 +466,7 @@ void TRACKS_CLEANER::removeDuplicatesOfTrack( const TRACK *aTrack, std::set<BOAR
if( aTrack->GetNetCode() != other->GetNetCode() )
continue;
if ( aTrack == other )
if( aTrack == other )
continue;
// Must be of the same type, on the same layer and the endpoints
@ -554,7 +553,7 @@ bool TRACKS_CLEANER::cleanupSegments()
// Delete redundant segments, i.e. segments having the same end points and layers
// (can happens when blocks are copied on themselve)
for ( auto segment : m_brd->Tracks() )
for( auto segment : m_brd->Tracks() )
removeDuplicatesOfTrack( segment, toRemove );
modified |= removeItems( toRemove );
@ -663,7 +662,7 @@ TRACK* TRACKS_CLEANER::mergeCollinearSegmentIfPossible( TRACK* aTrackRef, TRACK*
return aCandidate;
// Weed out non-parallel tracks
if ( !parallelismTest( aTrackRef->GetEnd().x - aTrackRef->GetStart().x,
if( !parallelismTest( aTrackRef->GetEnd().x - aTrackRef->GetStart().x,
aTrackRef->GetEnd().y - aTrackRef->GetStart().y,
aCandidate->GetEnd().x - aCandidate->GetStart().x,
aCandidate->GetEnd().y - aCandidate->GetStart().y ) )
@ -675,15 +674,12 @@ 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
if (aTrackRef->GetNetCode() == 47)
if(aTrackRef->GetNetCode() == 47)
{
auto pads = m_brd->GetConnectivity()->GetConnectedPads( aTrackRef );
printf("eps ref %d %d-%d %d pads-con %d eop %d sop %d\n",
@ -712,11 +708,14 @@ TRACK* TRACKS_CLEANER::mergeCollinearSegmentIfPossible( TRACK* aTrackRef, TRACK*
#endif
auto connectivity = m_brd->GetConnectivity();
updateConn( aTrackRef, connectivity );
updateConn( aCandidate, connectivity );
if( aEndType == ENDPOINT_START )
{
// We do not have a pad, which is a always terminal point for a track
// We do not have a pad, which is a always terminal point for a track
if( aTrackRef->GetState( START_ON_PAD ) )
return NULL;
@ -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 );
@ -105,9 +98,9 @@ void CONNECTIVITY_DATA::updateRatsnest()
int i;
#ifdef USE_OPENMP
#pragma omp parallel shared(lastNet) private(i)
#pragma omp parallel shared(lastNet) private(i)
{
#pragma omp for schedule(guided, 1)
#pragma omp for schedule(guided, 1)
#else /* USE_OPENMP */
{
#endif
@ -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;
}
@ -354,13 +348,13 @@ const std::list<BOARD_CONNECTED_ITEM*> CONNECTIVITY_DATA::GetConnectedItems(
const std::list<BOARD_CONNECTED_ITEM*> CONNECTIVITY_DATA::GetNetItems( int aNetCode,
const KICAD_T aTypes[] ) const
{
std::set<BOARD_CONNECTED_ITEM *> items;
std::list<BOARD_CONNECTED_ITEM *> rv;
std::set<BOARD_CONNECTED_ITEM*> items;
std::list<BOARD_CONNECTED_ITEM*> rv;
// fixme: apply aTypes
m_connAlgo->ForEachItem( [&items, aNetCode] ( CN_ITEM* aItem) {
if ( aItem->Net() == aNetCode )
m_connAlgo->ForEachItem( [&items, aNetCode] ( CN_ITEM* aItem ) {
if( aItem->Net() == aNetCode )
items.insert( aItem->Parent() );
} );
@ -395,7 +389,7 @@ bool CONNECTIVITY_DATA::CheckConnectivity( std::vector<CN_DISJOINT_NET_ENTRY>& a
}
const std::vector<TRACK*> CONNECTIVITY_DATA::GetConnectedTracks( const BOARD_CONNECTED_ITEM* aItem )
const std::vector<TRACK*> CONNECTIVITY_DATA::GetConnectedTracks( const BOARD_CONNECTED_ITEM* aItem )
const
{
auto& entry = m_connAlgo->ItemEntry( aItem );
@ -417,7 +411,7 @@ const
}
const std::vector<D_PAD*> CONNECTIVITY_DATA::GetConnectedPads( const BOARD_CONNECTED_ITEM* aItem )
const std::vector<D_PAD*> CONNECTIVITY_DATA::GetConnectedPads( const BOARD_CONNECTED_ITEM* aItem )
const
{
auto& entry = m_connAlgo->ItemEntry( aItem );
@ -464,10 +458,11 @@ unsigned int CONNECTIVITY_DATA::GetPadCount( int aNet ) const
{
int n = 0;
for ( auto pad : m_connAlgo->PadList() )
for( auto pad : m_connAlgo->PadList() )
{
auto dpad = static_cast<D_PAD*>( pad->Parent() );
if ( aNet < 0 || aNet == dpad->GetNetCode() )
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,12 +533,12 @@ const std::vector<VECTOR2I> CONNECTIVITY_DATA::NearestUnconnectedTargets(
return rv;
}
void CONNECTIVITY_DATA::GetUnconnectedEdges( std::vector<CN_EDGE>& aEdges) const
{
for ( auto rnNet : m_nets )
for( auto rnNet : m_nets )
{
if ( rnNet )
if( rnNet )
{
for( auto edge : rnNet->GetEdges() )
{
@ -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;
@ -562,11 +559,11 @@ const std::vector<BOARD_CONNECTED_ITEM*> CONNECTIVITY_DATA::GetConnectedItems( c
{
for( auto anchor : cnItem->Anchors() )
{
if ( anchor->Pos() == aAnchor )
if( anchor->Pos() == aAnchor )
{
for( int i = 0; aTypes[i] > 0; i++ )
{
if ( cnItem->Parent()->Type() == aTypes[i] )
if( cnItem->Parent()->Type() == aTypes[i] )
{
rv.push_back( cnItem->Parent() );
break;

View File

@ -184,7 +184,7 @@ public:
* Calculates the temporary dynamic ratsnest (i.e. the ratsnest lines that)
* for the set of items aItems.
*/
void ComputeDynamicRatsnest( const std::vector<BOARD_ITEM*>& aItems );
void ComputeDynamicRatsnest( const std::vector<BOARD_ITEM*>& aItems );
const std::vector<RN_DYNAMIC_LINE>& GetDynamicRatsnest() const;
@ -215,7 +215,7 @@ public:
std::shared_ptr<CN_CONNECTIVITY_ALGO> GetConnectivityAlgo() const
{
return m_connAlgo;
return m_connAlgo;
}
private:

File diff suppressed because it is too large Load Diff

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:
@ -362,7 +366,7 @@ public:
CN_ANCHOR_PTR AddAnchor( const VECTOR2I& aPos )
{
m_anchors.emplace_back( std::make_shared<CN_ANCHOR> ( aPos, this ) );
m_anchors.emplace_back( std::make_shared<CN_ANCHOR>( aPos, this ) );
//printf("%p add %d\n", this, m_anchors.size() );
return m_anchors.back();
}
@ -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,9 +572,10 @@ public:
SetDirty();
return item;
};
}
};
class CN_TRACK_LIST : public CN_LIST
{
public:
@ -585,9 +590,10 @@ public:
SetDirty();
return item;
};
}
};
class CN_VIA_LIST : public CN_LIST
{
public:
@ -599,9 +605,10 @@ public:
addAnchor( via->GetStart(), item );
SetDirty();
return item;
};
}
};
class CN_ZONE : public CN_ITEM
{
public:
@ -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 );
}
}
}
@ -699,7 +707,7 @@ void CN_ZONE_LIST::FindNearbyZones( BOX2I aBBox, T aFunc, bool aDirtyOnly )
{
for( auto item : m_items )
{
auto zone = static_cast<CN_ZONE*> ( item );
auto zone = static_cast<CN_ZONE*>( item );
if( aBBox.Intersects( zone->BBox() ) )
{
@ -735,7 +743,7 @@ void CN_LIST::FindNearby( VECTOR2I aPosition, int aDistMax, T aFunc, bool aDirty
{
// Calculate half size of remaining interval to test.
// Ensure the computed value is not truncated (too small)
if( (delta & 1) && ( delta > 1 ) )
if( ( delta & 1 ) && ( delta > 1 ) )
delta++;
delta /= 2;
@ -787,12 +795,10 @@ 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
for( int ii = idx - 1; ii >=0; ii-- )
for( int ii = idx - 1; ii >=0; ii-- )
{
auto& p = m_anchors[ii];
diff = p->Pos() - aPosition;
@ -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 );
}
}
}
@ -873,7 +879,7 @@ public:
CLUSTERS m_ratsnestClusters;
std::vector<bool> m_dirtyNets;
void searchConnections( bool aIncludeZones = false );
void searchConnections( bool aIncludeZones = false );
void update();
void propagateConnections();
@ -889,8 +895,8 @@ public:
bool addConnectedItem( BOARD_CONNECTED_ITEM* aItem );
bool isDirty() const;
void markNetAsDirty( int aNet );
void markItemNetAsDirty( const BOARD_ITEM* aItem );
void markNetAsDirty( int aNet );
void markItemNetAsDirty( const BOARD_ITEM* aItem );
public:

View File

@ -156,7 +156,7 @@ void DRAG_LIST::BuildDragListe( MODULE* aModule )
std::vector<D_PAD*> padList;
for ( auto pad : aModule->Pads() )
for( auto pad : aModule->Pads() )
padList.push_back( pad );
sort( padList.begin(), padList.end(), sortPadsByXthenYCoord );
@ -192,7 +192,7 @@ void DRAG_LIST::fillList( std::vector<D_PAD*>& aList )
auto connectedTracks = m_Brd->GetConnectivity()->GetConnectedTracks( pad );
// store track connected to the pad
for ( auto track : connectedTracks )
for( auto track : connectedTracks )
{
track->start = NULL;
track->end = NULL;
@ -206,9 +206,8 @@ void DRAG_LIST::fillList( std::vector<D_PAD*>& aList )
auto connectedTracks = m_Brd->GetConnectivity()->GetConnectedTracks( pad );
// store track connected to the pad
for ( auto track : connectedTracks )
for( auto track : connectedTracks )
{
if( pad->HitTest( track->GetStart() ) )
{
track->start = pad;

View File

@ -1740,14 +1740,15 @@ void EAGLE_PLUGIN::loadSignals( wxXmlNode* aSignals )
via->SetDrill( drillz );
// make sure the via diameter respects the restring rules
// make sure the via diameter respects the restring rules
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 );
}
if( kidiam < m_min_via )
m_min_via = kidiam;
@ -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();
@ -798,7 +799,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
// If the starting point is on a pad, add current track length+ length die
if( g_FirstTrackSegment->GetState( BEGIN_ONPAD ) )
{
D_PAD * pad = (D_PAD *) g_FirstTrackSegment->start;
D_PAD* pad = (D_PAD*) g_FirstTrackSegment->start;
lenPadToDie = (double) pad->GetPadToDieLength();
}

View File

@ -116,10 +116,10 @@ static void build_pad_testpoints( BOARD *aPcb,
{
wxPoint origin = aPcb->GetAuxOrigin();
for( MODULE *module = aPcb->m_Modules;
for( MODULE* module = aPcb->m_Modules;
module; module = module->Next() )
{
for( D_PAD *pad = module->PadsList(); pad; pad = pad->Next() )
for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() )
{
D356_RECORD rk;
rk.access = compute_pad_access_code( aPcb, pad->GetLayerSet() );

View File

@ -117,7 +117,7 @@ void GENDRILL_WRITER_BASE::buildHolesList( DRILL_LAYER_PAIR aLayerPair,
// add holes for thru hole pads
for( MODULE* module = m_pcb->m_Modules; module; module = module->Next() )
{
for( auto &pad : module->Pads() )
for( auto& pad : module->Pads() )
{
if( !m_merge_PTH_NPTH )
{

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

@ -91,7 +91,7 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
{
aPlotter->StartBlock( NULL );
for( D_PAD * pad = Module->PadsList(); pad; pad = pad->Next() )
for( D_PAD* pad = Module->PadsList(); pad; pad = pad->Next() )
{
// See if the pad is on this layer
LSET masklayer = pad->GetLayerSet();

View File

@ -238,7 +238,7 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule )
PlotTextModule( &aModule->Value(), GetValueColor() );
}
for( BOARD_ITEM *item = aModule->GraphicalItemsList().GetFirst(); item; item = item->Next() )
for( BOARD_ITEM* item = aModule->GraphicalItemsList().GetFirst(); item; item = item->Next() )
{
textModule = dyn_cast<TEXTE_MODULE*>( item );
@ -810,7 +810,7 @@ void BRDITEMS_PLOTTER::PlotDrillMarks()
if( GetPlotMode() == FILLED )
m_plotter->SetColor( WHITE );
for( TRACK *pts = m_board->m_Track; pts != NULL; pts = pts->Next() )
for( TRACK* pts = m_board->m_Track; pts != NULL; pts = pts->Next() )
{
const VIA* via = dyn_cast<const VIA*>( pts );
@ -820,9 +820,9 @@ void BRDITEMS_PLOTTER::PlotDrillMarks()
wxSize( via->GetWidth(), 0 ), 0, small_drill );
}
for( MODULE *Module = m_board->m_Modules; Module != NULL; Module = Module->Next() )
for( MODULE* Module = m_board->m_Modules; Module != NULL; Module = Module->Next() )
{
for( D_PAD *pad = Module->PadsList(); pad != NULL; pad = pad->Next() )
for( D_PAD* pad = Module->PadsList(); pad != NULL; pad = pad->Next() )
{
if( pad->GetDrillSize().x == 0 )
continue;

View File

@ -60,7 +60,7 @@ void PCB_BASE_FRAME::Compile_Ratsnest( wxDC* aDC, bool aDisplayStatus )
GetBoard()->m_Status_Pcb = 0; // we want a full ratsnest computation, from the scratch
if( GetBoard()->IsElementVisible(LAYER_RATSNEST) && aDC )
if( GetBoard()->IsElementVisible( LAYER_RATSNEST ) && aDC )
DrawGeneralRatsnest( aDC, 0 );
wxString msg;

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:
@ -209,7 +211,7 @@ public:
std::vector<ANCHOR_LIST> anchorChains;
triNodes.reserve( m_allNodes.size() );
anchorChains.reserve ( m_allNodes.size() );
anchorChains.reserve( m_allNodes.size() );
std::sort( m_allNodes.begin(), m_allNodes.end(),
[] ( const CN_ANCHOR_PTR& aNode1, const CN_ANCHOR_PTR& aNode2 )
@ -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;
}
@ -647,13 +647,13 @@ void RN_NET::AddCluster( CN_CLUSTER_PTR aCluster )
auto& anchors = item->Anchors();
int nAnchors = isZone ? 1 : anchors.size();
if ( nAnchors > anchors.size() )
if( nAnchors > anchors.size() )
nAnchors = anchors.size();
//printf("item %p anchors : %d\n", item, anchors.size() );
//printf("add item %p anchors : %d net : %d\n", item, item->Anchors().size(), item->Parent()->GetNetCode() );
for ( int i = 0; i < nAnchors; i++ )
for( int i = 0; i < nAnchors; i++ )
{
// printf("add anchor %p\n", anchors[i].get() );
@ -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,8 +711,9 @@ unsigned int RN_NET::GetNodeCount() const
return m_nodes.size();
}
void RN_NET::SetVisible( bool aEnabled )
{
for ( auto& edge : m_rnEdges )
edge.SetVisible ( aEnabled );
for( auto& edge : m_rnEdges )
edge.SetVisible( aEnabled );
}

View File

@ -69,7 +69,7 @@ public:
* false otherwise.
*/
void SetVisible( bool aEnabled );
/**
* Function MarkDirty()
* Marks ratsnest for given net as 'dirty', i.e. requiring recomputation.
@ -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

@ -70,7 +70,7 @@ public:
protected:
///> Object containing ratsnest data.
std::shared_ptr<CONNECTIVITY_DATA> m_data;
std::shared_ptr<CONNECTIVITY_DATA> m_data;
};
} // namespace KIGFX

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

@ -485,12 +485,12 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
}
}
controls->ShowCursor( false );
controls->ShowCursor( false );
controls->SetSnapping( false );
controls->SetAutoPan( false );
controls->CaptureCursor( false );
view->Remove( &preview );
view->Remove( &preview );
m_frame->SetNoToolSelected();
return 0;
@ -836,23 +836,23 @@ int PCB_EDITOR_CONTROL::ZoneMerge( const TOOL_EVENT& aEvent )
if( firstZone )
{
if( firstZone->GetNetCode() != netcode )
continue;
if( firstZone->GetNetCode() != netcode )
continue;
if( curr_area->GetPriority() != firstZone->GetPriority() )
continue;
if( curr_area->GetPriority() != firstZone->GetPriority() )
continue;
if( curr_area->GetIsKeepout() != firstZone->GetIsKeepout() )
continue;
if( curr_area->GetIsKeepout() != firstZone->GetIsKeepout() )
continue;
if( curr_area->GetLayer() != firstZone->GetLayer() )
continue;
if( curr_area->GetLayer() != firstZone->GetLayer() )
continue;
if( !board->TestAreaIntersection( curr_area, firstZone ) )
continue;
if( !board->TestAreaIntersection( curr_area, firstZone ) )
continue;
toMerge.push_back( curr_area );
}
toMerge.push_back( curr_area );
}
else
{
toMerge.push_back( curr_area );
@ -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>();
@ -1100,11 +1101,11 @@ static bool showLocalRatsnest( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition
if( selection.Empty() )
return true;
for ( auto item : selection )
for( auto item : selection )
{
if ( item->Type() == PCB_MODULE_T )
if( item->Type() == PCB_MODULE_T )
{
for ( auto pad : static_cast<MODULE *> (item)->Pads() )
for( auto pad : static_cast<MODULE *> (item)->Pads() )
{
pad->SetLocalRatsnestVisible( true );
}
@ -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;
@ -1179,7 +1182,7 @@ void PCB_EDITOR_CONTROL::SetTransitions()
Go( &PCB_EDITOR_CONTROL::DrillOrigin, PCB_ACTIONS::drillOrigin.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::HighlightNet, PCB_ACTIONS::highlightNet.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::HighlightNetCursor, PCB_ACTIONS::highlightNetCursor.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ShowLocalRatsnest, PCB_ACTIONS::showLocalRatsnest.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ShowLocalRatsnest, PCB_ACTIONS::showLocalRatsnest.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::UpdateSelectionRatsnest, PCB_ACTIONS::selectionModified.MakeEvent() );
}

View File

@ -35,7 +35,7 @@
#include "pcb_actions.h"
#include "tool_event_utils.h"
void PCB_TOOL::doInteractiveItemPlacement( INTERACTIVE_PLACER_BASE *aPlacer,
void PCB_TOOL::doInteractiveItemPlacement( INTERACTIVE_PLACER_BASE* aPlacer,
const wxString& aCommitMessage,
int aOptions )
{
@ -59,7 +59,7 @@ void PCB_TOOL::doInteractiveItemPlacement( INTERACTIVE_PLACER_BASE *aPlacer,
aPlacer->m_board = board();
aPlacer->m_frame = frame();
if ( aOptions & IPO_SINGLE_CLICK )
if( aOptions & IPO_SINGLE_CLICK )
{
VECTOR2I cursorPos = controls()->GetCursorPosition();
@ -83,7 +83,7 @@ void PCB_TOOL::doInteractiveItemPlacement( INTERACTIVE_PLACER_BASE *aPlacer,
preview.Clear();
if ( aOptions & IPO_SINGLE_CLICK )
if( aOptions & IPO_SINGLE_CLICK )
break;
controls()->SetAutoPan( false );
@ -144,10 +144,11 @@ void PCB_TOOL::doInteractiveItemPlacement( INTERACTIVE_PLACER_BASE *aPlacer,
controls()->CaptureCursor( false );
controls()->SetAutoPan( false );
controls()->ShowCursor( true );
if (! ( aOptions & IPO_REPEAT ) )
if( !( aOptions & IPO_REPEAT ) )
break;
if ( aOptions & IPO_SINGLE_CLICK )
if( aOptions & IPO_SINGLE_CLICK )
{
VECTOR2I pos = controls()->GetCursorPosition();
@ -156,7 +157,6 @@ void PCB_TOOL::doInteractiveItemPlacement( INTERACTIVE_PLACER_BASE *aPlacer,
preview.Add( newItem.get() );
}
}
}

View File

@ -50,8 +50,8 @@ struct INTERACTIVE_PLACER_BASE
virtual std::unique_ptr<BOARD_ITEM> CreateItem() = 0;
virtual bool PlaceItem( BOARD_ITEM *aItem ) { return false; }
PCB_EDIT_FRAME *m_frame;
BOARD *m_board;
PCB_EDIT_FRAME* m_frame;
BOARD* m_board;
};

View File

@ -830,7 +830,7 @@ void SELECTION_TOOL::selectAllItemsConnectedToTrack( TRACK& aSourceTrack )
void SELECTION_TOOL::selectAllItemsConnectedToItem( BOARD_CONNECTED_ITEM& aSourceItem )
{
constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, EOT };
constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, EOT };
auto connectivity = board()->GetConnectivity();
std::list<BOARD_CONNECTED_ITEM*> items;

View File

@ -268,13 +268,13 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
pt_del->UnLink();
pt_del->SetStatus( 0 );
pt_del->ClearFlags();
GetBoard()->GetConnectivity()->Remove ( pt_del );
GetBoard()->GetConnectivity()->Remove( pt_del );
ITEM_PICKER picker( pt_del, UR_DELETED );
aItemsListPicker->PushItem( picker );
}
else
{
GetBoard()->GetConnectivity()->Remove ( pt_del );
GetBoard()->GetConnectivity()->Remove( pt_del );
pt_del->DeleteStructure();
}
}

View File

@ -117,10 +117,10 @@ int PCB_EDIT_FRAME::Fill_Zone( ZONE_CONTAINER* aZone )
wxBusyCursor dummy; // Shows an hourglass cursor (removed by its destructor)
BOARD_COMMIT commit ( this );
BOARD_COMMIT commit( this );
commit.Modify( aZone );
aZone->BuildFilledSolidAreasPolygons( GetBoard() );
commit.Push ( _("Fill Zone"), false );
commit.Push( _( "Fill Zone" ), false );
//GetGalCanvas()->GetView()->Update( aZone, KIGFX::ALL );
//GetBoard()->GetConnectivity()->Update( aZone );
@ -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;
}