Formatting.
This commit is contained in:
+12
-11
@@ -28,21 +28,22 @@ void CollectDrillLineItems( BOARD* board, std::vector<DRILL_LINE_ITEM>& out )
|
||||
{
|
||||
out.clear();
|
||||
|
||||
auto addOrIncrement = [&]( const DRILL_LINE_ITEM& d )
|
||||
{
|
||||
for( DRILL_LINE_ITEM& e : out )
|
||||
auto addOrIncrement =
|
||||
[&]( const DRILL_LINE_ITEM& d )
|
||||
{
|
||||
if( e == d )
|
||||
for( DRILL_LINE_ITEM& e : out )
|
||||
{
|
||||
e.m_Qty++;
|
||||
return;
|
||||
if( e == d )
|
||||
{
|
||||
e.m_Qty++;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DRILL_LINE_ITEM n = d;
|
||||
n.m_Qty = 1;
|
||||
out.push_back( n );
|
||||
};
|
||||
DRILL_LINE_ITEM n = d;
|
||||
n.m_Qty = 1;
|
||||
out.push_back( n );
|
||||
};
|
||||
|
||||
if( !board )
|
||||
return;
|
||||
|
||||
@@ -54,14 +54,21 @@ struct DRILL_LINE_ITEM
|
||||
|
||||
bool operator==( const DRILL_LINE_ITEM& other ) const
|
||||
{
|
||||
return xSize == other.xSize && ySize == other.ySize && shape == other.shape
|
||||
&& isPlated == other.isPlated && isPad == other.isPad && startLayer == other.startLayer
|
||||
&& stopLayer == other.stopLayer;
|
||||
return xSize == other.xSize
|
||||
&& ySize == other.ySize
|
||||
&& shape == other.shape
|
||||
&& isPlated == other.isPlated
|
||||
&& isPad == other.isPad
|
||||
&& startLayer == other.startLayer
|
||||
&& stopLayer == other.stopLayer;
|
||||
}
|
||||
|
||||
struct COMPARE
|
||||
{
|
||||
COMPARE( COL_ID aColId, bool aAscending ) : colId( aColId ), ascending( aAscending ) {}
|
||||
COMPARE( COL_ID aColId, bool aAscending ) :
|
||||
colId( aColId ),
|
||||
ascending( aAscending )
|
||||
{}
|
||||
|
||||
bool operator()( const DRILL_LINE_ITEM& aLeft, const DRILL_LINE_ITEM& aRight )
|
||||
{
|
||||
|
||||
@@ -109,10 +109,10 @@ void InitializeBoardStatisticsData( BOARD_STATISTICS_DATA& aData )
|
||||
aData.padEntries.push_back( BOARD_STATISTICS_INFO_ENTRY<PAD_ATTRIB>( PAD_ATTRIB::CONN, _( "Connector:" ) ) );
|
||||
aData.padEntries.push_back( BOARD_STATISTICS_INFO_ENTRY<PAD_ATTRIB>( PAD_ATTRIB::NPTH, _( "NPTH:" ) ) );
|
||||
|
||||
aData.padPropertyEntries.push_back(
|
||||
BOARD_STATISTICS_INFO_ENTRY<PAD_PROP>( PAD_PROP::CASTELLATED, _( "Castellated:" ) ) );
|
||||
aData.padPropertyEntries.push_back(
|
||||
BOARD_STATISTICS_INFO_ENTRY<PAD_PROP>( PAD_PROP::PRESSFIT, _( "Press-fit:" ) ) );
|
||||
aData.padPropertyEntries.push_back( BOARD_STATISTICS_INFO_ENTRY<PAD_PROP>( PAD_PROP::CASTELLATED,
|
||||
_( "Castellated:" ) ) );
|
||||
aData.padPropertyEntries.push_back( BOARD_STATISTICS_INFO_ENTRY<PAD_PROP>( PAD_PROP::PRESSFIT,
|
||||
_( "Press-fit:" ) ) );
|
||||
|
||||
aData.viaEntries.push_back( BOARD_STATISTICS_INFO_ENTRY<VIATYPE>( VIATYPE::THROUGH, _( "Through vias:" ) ) );
|
||||
aData.viaEntries.push_back( BOARD_STATISTICS_INFO_ENTRY<VIATYPE>( VIATYPE::BLIND, _( "Blind vias:" ) ) );
|
||||
@@ -169,8 +169,8 @@ void ComputeBoardStatistics( BOARD* aBoard, const BOARD_STATISTICS_OPTIONS& aOpt
|
||||
switch( footprint->GetSide() )
|
||||
{
|
||||
case F_Cu: entry.frontCount++; break;
|
||||
case B_Cu: entry.backCount++; break;
|
||||
default: break;
|
||||
case B_Cu: entry.backCount++; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -308,6 +308,7 @@ void ComputeBoardStatistics( BOARD* aBoard, const BOARD_STATISTICS_OPTIONS& aOpt
|
||||
|
||||
std::shared_ptr<NET_SETTINGS>& netSettings = aBoard->GetDesignSettings().m_NetSettings;
|
||||
int minPadClearanceOuter = netSettings->GetDefaultNetclass()->GetClearance();
|
||||
|
||||
for( FOOTPRINT* fp : aBoard->Footprints() )
|
||||
{
|
||||
const SHAPE_POLY_SET& frontA = fp->GetCourtyard( F_CrtYd );
|
||||
@@ -365,7 +366,8 @@ void ComputeBoardStatistics( BOARD* aBoard, const BOARD_STATISTICS_OPTIONS& aOpt
|
||||
aBoard->RunOnChildren(
|
||||
[&]( BOARD_ITEM* child )
|
||||
{
|
||||
if( child->Type() == PCB_FOOTPRINT_T || child->Type() == PCB_GROUP_T
|
||||
if( child->Type() == PCB_FOOTPRINT_T
|
||||
|| child->Type() == PCB_GROUP_T
|
||||
|| child->Type() == PCB_GENERATOR_T )
|
||||
{
|
||||
return;
|
||||
@@ -577,25 +579,21 @@ wxString FormatBoardStatisticsReport( const BOARD_STATISTICS_DATA& aData, BOARD*
|
||||
<< aUnitsProvider.MessageTextFromValue( aData.backFootprintCourtyardArea, true, EDA_DATA_TYPE::AREA ) << wxS( "\n" );
|
||||
|
||||
report << wxS( "- " ) << _( "Front component density" ) << wxS( ": " );
|
||||
|
||||
if( aData.hasOutline )
|
||||
{
|
||||
report << wxString::Format( "%.2f %", aData.frontFootprintDensity );
|
||||
}
|
||||
else
|
||||
{
|
||||
report << _( "unknown" );
|
||||
}
|
||||
|
||||
report << wxS( "\n" );
|
||||
|
||||
report << wxS( "- " ) << _( "Back component density" ) << wxS( ": " );
|
||||
|
||||
if( aData.hasOutline )
|
||||
{
|
||||
report << wxString::Format( "%.2f %", aData.backFootprintDensity );
|
||||
}
|
||||
else
|
||||
{
|
||||
report << _( "unknown" );
|
||||
}
|
||||
|
||||
report << wxS( "\n" );
|
||||
|
||||
report << _( "Pads" ) << wxS( "\n----\n" );
|
||||
@@ -670,8 +668,8 @@ wxString FormatBoardStatisticsReport( const BOARD_STATISTICS_DATA& aData, BOARD*
|
||||
switch( drill.shape )
|
||||
{
|
||||
case PAD_DRILL_SHAPE::CIRCLE: shapeStr = _( "Round" ); break;
|
||||
case PAD_DRILL_SHAPE::OBLONG: shapeStr = _( "Slot" ); break;
|
||||
default: shapeStr = _( "???" ); break;
|
||||
case PAD_DRILL_SHAPE::OBLONG: shapeStr = _( "Slot" ); break;
|
||||
default: shapeStr = _( "???" ); break;
|
||||
}
|
||||
|
||||
wxString platedStr = drill.isPlated ? _( "PTH" ) : _( "NPTH" );
|
||||
@@ -745,17 +743,18 @@ wxString FormatBoardStatisticsJson( const BOARD_STATISTICS_DATA& aData, BOARD* a
|
||||
board["back_component_density"] = nlohmann::json();
|
||||
}
|
||||
|
||||
board["front_copper_area"] =
|
||||
aUnitsProvider.MessageTextFromValue( aData.frontCopperArea, true, EDA_DATA_TYPE::AREA );
|
||||
board["back_copper_area"] = aUnitsProvider.MessageTextFromValue( aData.backCopperArea, true, EDA_DATA_TYPE::AREA );
|
||||
board["front_copper_area"] = aUnitsProvider.MessageTextFromValue( aData.frontCopperArea, true,
|
||||
EDA_DATA_TYPE::AREA );
|
||||
board["back_copper_area"] = aUnitsProvider.MessageTextFromValue( aData.backCopperArea, true,
|
||||
EDA_DATA_TYPE::AREA );
|
||||
board["min_track_clearance"] = aUnitsProvider.MessageTextFromValue( aData.minClearanceTrackToTrack );
|
||||
board["min_track_width"] = aUnitsProvider.MessageTextFromValue( aData.minTrackWidth );
|
||||
board["min_drill_diameter"] = aUnitsProvider.MessageTextFromValue( aData.minDrillSize );
|
||||
board["board_thickness"] = aUnitsProvider.MessageTextFromValue( aData.boardThickness );
|
||||
board["front_footprint_area"] =
|
||||
aUnitsProvider.MessageTextFromValue( aData.frontFootprintCourtyardArea, true, EDA_DATA_TYPE::AREA );
|
||||
board["back_footprint_area"] =
|
||||
aUnitsProvider.MessageTextFromValue( aData.backFootprintCourtyardArea, true, EDA_DATA_TYPE::AREA );
|
||||
board["front_footprint_area"] = aUnitsProvider.MessageTextFromValue( aData.frontFootprintCourtyardArea, true,
|
||||
EDA_DATA_TYPE::AREA );
|
||||
board["back_footprint_area"] = aUnitsProvider.MessageTextFromValue( aData.backFootprintCourtyardArea, true,
|
||||
EDA_DATA_TYPE::AREA );
|
||||
|
||||
if( aData.hasOutline )
|
||||
{
|
||||
|
||||
@@ -58,10 +58,8 @@
|
||||
#include <unordered_map>
|
||||
|
||||
|
||||
static bool PromptConnectedPadDecision( PCB_BASE_EDIT_FRAME* aFrame,
|
||||
const std::vector<PAD*>& aPads,
|
||||
const wxString& aDialogTitle,
|
||||
bool& aIncludeConnectedPads )
|
||||
static bool PromptConnectedPadDecision( PCB_BASE_EDIT_FRAME* aFrame, const std::vector<PAD*>& aPads,
|
||||
const wxString& aDialogTitle, bool& aIncludeConnectedPads )
|
||||
{
|
||||
if( aPads.empty() )
|
||||
{
|
||||
@@ -228,7 +226,6 @@ int EDIT_TOOL::SwapPadNets( const TOOL_EVENT& aEvent )
|
||||
for( EDA_ITEM* it : orderedPads )
|
||||
pads.push_back( static_cast<PAD*>( static_cast<BOARD_ITEM*>( it ) ) );
|
||||
|
||||
|
||||
// Record original nets and build selected set for quick membership tests
|
||||
std::vector<int> originalNets( padsCount );
|
||||
std::unordered_set<PAD*> selectedPads;
|
||||
@@ -241,6 +238,7 @@ int EDIT_TOOL::SwapPadNets( const TOOL_EVENT& aEvent )
|
||||
|
||||
// If all nets are the same, nothing to do
|
||||
bool allSame = true;
|
||||
|
||||
for( size_t i = 1; i < padsCount; ++i )
|
||||
{
|
||||
if( originalNets[i] != originalNets[0] )
|
||||
@@ -254,10 +252,11 @@ int EDIT_TOOL::SwapPadNets( const TOOL_EVENT& aEvent )
|
||||
return 0;
|
||||
|
||||
// Desired new nets are a cyclic rotation of original nets (like Swap positions)
|
||||
auto newNetForIndex = [&]( size_t i )
|
||||
{
|
||||
return originalNets[( i + 1 ) % padsCount];
|
||||
};
|
||||
auto newNetForIndex =
|
||||
[&]( size_t i )
|
||||
{
|
||||
return originalNets[( i + 1 ) % padsCount];
|
||||
};
|
||||
|
||||
// Take an event commit since we will eventually support this while actively routing the board
|
||||
BOARD_COMMIT localCommit( this );
|
||||
@@ -313,9 +312,7 @@ int EDIT_TOOL::SwapPadNets( const TOOL_EVENT& aEvent )
|
||||
bool includeConnectedPads = true;
|
||||
|
||||
if( !PromptConnectedPadDecision( frame(), nonSelectedPadsToChange, _( "Swap Pad Nets" ), includeConnectedPads ) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Apply changes
|
||||
// 1) Selected pads get their new nets directly
|
||||
@@ -365,10 +362,12 @@ int EDIT_TOOL::SwapGateNets( const TOOL_EVENT& aEvent )
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto showError = [this]()
|
||||
{
|
||||
frame()->ShowInfoBarError( _( "Gate swapping must be performed on pads within one multi-gate footprint." ) );
|
||||
};
|
||||
auto showError =
|
||||
[this]()
|
||||
{
|
||||
frame()->ShowInfoBarError( _( "Gate swapping must be performed on pads within one multi-gate "
|
||||
"footprint." ) );
|
||||
};
|
||||
|
||||
PCB_SELECTION& selection = m_selectionTool->RequestSelection( &EDIT_TOOL::PadFilter );
|
||||
|
||||
@@ -388,7 +387,9 @@ int EDIT_TOOL::SwapGateNets( const TOOL_EVENT& aEvent )
|
||||
FOOTPRINT* fp = static_cast<PAD*>( static_cast<BOARD_ITEM*>( it ) )->GetParentFootprint();
|
||||
|
||||
if( !targetFp )
|
||||
{
|
||||
targetFp = fp;
|
||||
}
|
||||
else if( fp && targetFp != fp )
|
||||
{
|
||||
fail = true;
|
||||
@@ -462,9 +463,7 @@ int EDIT_TOOL::SwapGateNets( const TOOL_EVENT& aEvent )
|
||||
continue;
|
||||
|
||||
if( units[i].m_pins.size() == units[sourceIdx].m_pins.size() && units[i].m_unitName == targetUnitByName )
|
||||
{
|
||||
targetIdx = static_cast<int>( i );
|
||||
}
|
||||
}
|
||||
|
||||
if( targetIdx < 0 )
|
||||
|
||||
Reference in New Issue
Block a user