mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-20 15:51:41 +00:00
Clean up some LSEQ functions
We are derived from std::vector now. We don't need our own prima donna increment and dereference overload as these just create bloat and non-standard coding practices
This commit is contained in:
parent
5ad5be0924
commit
293075426b
3d-viewer/3d_canvas
common
gerbview
include
pcbnew
board_connected_item.cppboard_item.cpp
dialogs
exporters
footprint.cpppcb_edit_frame.cpppcb_io/kicad_sexpr
pcb_painter.cpppcb_shape.cpppcb_track.cpppcbnew_jobs_handler.cppplot_board_layers.cpppython/scripting
sel_layer.cppwidgets
zone.cppzone_settings.cpp@ -222,9 +222,9 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
for( unsigned i = 0; i < arrayDim( cu_seq ); ++i )
|
||||
cu_seq[i] = ToLAYER_ID( B_Cu - i );
|
||||
|
||||
for( LSEQ cu = cu_set.Seq( cu_seq, arrayDim( cu_seq ) ); cu; ++cu )
|
||||
for( PCB_LAYER_ID layer : cu_set.Seq( cu_seq, arrayDim( cu_seq ) ) )
|
||||
{
|
||||
const PCB_LAYER_ID layer = *cu;
|
||||
if( !Is3dLayerEnabled( layer, visibilityFlags ) ) // Skip non enabled layers
|
||||
|
||||
if( !Is3dLayerEnabled( layer, visibilityFlags ) ) // Skip non enabled layers
|
||||
continue;
|
||||
|
@ -453,10 +453,10 @@ LSEQ LSET::Seq( const LSEQ& aSequence ) const
|
||||
{
|
||||
LSEQ ret;
|
||||
|
||||
for( LSEQ seq = aSequence; seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : aSequence )
|
||||
{
|
||||
if( test( *seq ) )
|
||||
ret.push_back( *seq );
|
||||
if( test( layer ) )
|
||||
ret.push_back( layer );
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -84,8 +84,8 @@ void GERBVIEW_PRINTOUT::setupViewLayers( KIGFX::VIEW& aView, const LSET& aLayerS
|
||||
{
|
||||
BOARD_PRINTOUT::setupViewLayers( aView, aLayerSet );
|
||||
|
||||
for( LSEQ layerSeq = m_settings.m_LayerSet.Seq(); layerSeq; ++layerSeq )
|
||||
aView.SetLayerVisible( static_cast<int>( GERBVIEW_LAYER_ID_START ) + *layerSeq, true );
|
||||
for( PCB_LAYER_ID layer : m_settings.m_LayerSet.Seq() )
|
||||
aView.SetLayerVisible( static_cast<int>( GERBVIEW_LAYER_ID_START ) + layer, true );
|
||||
}
|
||||
|
||||
|
||||
|
@ -538,11 +538,6 @@ public:
|
||||
BASE_SEQ( aLayers ), m_index( 0 )
|
||||
{}
|
||||
|
||||
void Rewind() { m_index = 0; }
|
||||
|
||||
void operator ++ () { ++m_index; } // returns nothing, used in simple statements only.
|
||||
|
||||
void operator ++ (int) { ++m_index; }
|
||||
|
||||
operator bool () { return m_index < size(); }
|
||||
|
||||
|
@ -167,8 +167,8 @@ static struct BOARD_CONNECTED_ITEM_DESC
|
||||
{
|
||||
layerEnum.Undefined( UNDEFINED_LAYER );
|
||||
|
||||
for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
|
||||
layerEnum.Map( *seq, LSET::Name( *seq ) );
|
||||
for( PCB_LAYER_ID layer : LSET::AllLayersMask().Seq() )
|
||||
layerEnum.Map( layer, LSET::Name( layer ) );
|
||||
}
|
||||
|
||||
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
|
||||
|
@ -348,8 +348,8 @@ static struct BOARD_ITEM_DESC
|
||||
{
|
||||
layerEnum.Undefined( UNDEFINED_LAYER );
|
||||
|
||||
for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
|
||||
layerEnum.Map( *seq, LSET::Name( *seq ) );
|
||||
for( PCB_LAYER_ID layer : LSET::AllLayersMask().Seq() )
|
||||
layerEnum.Map( layer, LSET::Name( layer ) );
|
||||
}
|
||||
|
||||
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
|
||||
|
@ -192,9 +192,8 @@ void DIALOG_EXPORT_SVG::initDialog()
|
||||
m_ModeColorOption->SetSelection( m_printBW ? 1 : 0 );
|
||||
m_printMirrorOpt->SetValue( m_printMirror );
|
||||
|
||||
for( LSEQ seq = m_board->GetEnabledLayers().UIOrder(); seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : m_board->GetEnabledLayers().UIOrder() )
|
||||
{
|
||||
PCB_LAYER_ID layer = *seq;
|
||||
int checkIndex;
|
||||
|
||||
if( IsCopperLayer( layer ) )
|
||||
@ -334,9 +333,8 @@ void DIALOG_EXPORT_SVG::ExportSVGFile( bool aOnlyOneFile )
|
||||
svgPlotOptions.m_plotFrame = svgPlotOptions.m_pageSizeMode == 0;
|
||||
svgPlotOptions.m_drillShapeOption = 2; // actual size hole.
|
||||
|
||||
for( LSEQ seq = all_selected.Seq(); seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : all_selected.Seq() )
|
||||
{
|
||||
PCB_LAYER_ID layer = *seq;
|
||||
wxFileName fn( boardFilename );
|
||||
wxString suffix = aOnlyOneFile ? wxString( wxT( "brd" ) ) : m_board->GetStandardLayerName( layer );
|
||||
|
||||
|
@ -105,20 +105,19 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) :
|
||||
std::vector<PCB_LAYER_ID> layersIdChoiceList;
|
||||
int textWidth = 0;
|
||||
|
||||
for( LSEQ seq = board->GetEnabledLayers().SeqStackupForPlotting(); seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : board->GetEnabledLayers().SeqStackupForPlotting() )
|
||||
{
|
||||
PCB_LAYER_ID id = *seq;
|
||||
wxString layerName = board->GetLayerName( id );
|
||||
wxString layerName = board->GetLayerName( layer );
|
||||
|
||||
// wxCOL_WIDTH_AUTOSIZE doesn't work on all platforms, so we calculate width here
|
||||
textWidth = std::max( textWidth, KIUI::GetTextSize( layerName, m_layerCheckListBox ).x );
|
||||
|
||||
plotAllLayersChoicesStrings.Add( layerName );
|
||||
layersIdChoiceList.push_back( id );
|
||||
layersIdChoiceList.push_back( layer );
|
||||
|
||||
size_t size = plotOnAllLayersSelection.size();
|
||||
|
||||
if( ( static_cast<size_t>( id ) <= size ) && plotOnAllLayersSelection.test( id ) )
|
||||
if( ( static_cast<size_t>( layer ) <= size ) && plotOnAllLayersSelection.test( layer ) )
|
||||
plotAllLayersOrder.push_back( order );
|
||||
else
|
||||
plotAllLayersOrder.push_back( ~order );
|
||||
@ -286,10 +285,8 @@ void DIALOG_PLOT::init_Dialog()
|
||||
m_layerList = board->GetEnabledLayers().UIOrder();
|
||||
|
||||
// Populate the check list box by all enabled layers names.
|
||||
for( LSEQ seq = m_layerList; seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : m_layerList )
|
||||
{
|
||||
PCB_LAYER_ID layer = *seq;
|
||||
|
||||
int checkIndex = m_layerCheckListBox->Append( board->GetLayerName( layer ) );
|
||||
|
||||
if( m_plotOpts.GetLayerSelection()[layer] )
|
||||
@ -443,9 +440,9 @@ void DIALOG_PLOT::arrangeAllLayersList( const LSEQ& aSeq )
|
||||
|
||||
int idx = 0;
|
||||
|
||||
for( LSEQ seq = aSeq; seq; ++seq, ++idx )
|
||||
for( PCB_LAYER_ID layer : aSeq )
|
||||
{
|
||||
int currentPos = findLayer( m_plotAllLayersList, *seq );
|
||||
int currentPos = findLayer( m_plotAllLayersList, layer );
|
||||
|
||||
while( currentPos > idx )
|
||||
{
|
||||
@ -1174,12 +1171,12 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
|
||||
|
||||
wxBusyCursor dummy;
|
||||
|
||||
for( LSEQ seq = m_plotOpts.GetLayerSelection().UIOrder(); seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : m_plotOpts.GetLayerSelection().UIOrder() )
|
||||
{
|
||||
LSEQ plotSequence;
|
||||
|
||||
// Base layer always gets plotted first.
|
||||
plotSequence.push_back( *seq );
|
||||
plotSequence.push_back( layer );
|
||||
|
||||
// Add selected layers from plot on all layers list in order set by user.
|
||||
wxArrayInt plotOnAllLayers;
|
||||
@ -1191,17 +1188,16 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
|
||||
for( size_t i = 0; i < count; i++ )
|
||||
{
|
||||
int index = plotOnAllLayers.Item( i );
|
||||
PCB_LAYER_ID layer = getLayerClientData( m_plotAllLayersList, index )->Layer();
|
||||
PCB_LAYER_ID client_layer = getLayerClientData( m_plotAllLayersList, index )->Layer();
|
||||
|
||||
// Don't plot the same layer more than once;
|
||||
if( find( plotSequence.begin(), plotSequence.end(), layer ) != plotSequence.end() )
|
||||
if( find( plotSequence.begin(), plotSequence.end(), client_layer ) != plotSequence.end() )
|
||||
continue;
|
||||
|
||||
plotSequence.push_back( layer );
|
||||
plotSequence.push_back( client_layer );
|
||||
}
|
||||
}
|
||||
|
||||
PCB_LAYER_ID layer = *seq;
|
||||
wxString layerName = board->GetLayerName( layer );
|
||||
//@todo allow controlling the sheet name and path that will be displayed in the title block
|
||||
// Leave blank for now
|
||||
|
@ -146,10 +146,8 @@ bool DIALOG_PRINT_PCBNEW::TransferDataToWindow()
|
||||
m_layerList = board->GetEnabledLayers().UIOrder();
|
||||
|
||||
// Populate the check list box by all enabled layers names
|
||||
for( LSEQ seq = m_layerList; seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : m_layerList )
|
||||
{
|
||||
PCB_LAYER_ID layer = *seq;
|
||||
|
||||
int checkIndex = m_layerCheckListBox->Append( board->GetLayerName( layer ) );
|
||||
|
||||
if( settings()->m_LayerSet.test( layer ) )
|
||||
|
@ -271,9 +271,8 @@ void PANEL_SETUP_LAYERS::setMandatoryLayerCheckBoxes()
|
||||
|
||||
void PANEL_SETUP_LAYERS::setUserDefinedLayerCheckBoxes()
|
||||
{
|
||||
for( LSEQ seq = LSET::UserDefinedLayers().Seq(); seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : LSET::UserDefinedLayers().Seq() )
|
||||
{
|
||||
PCB_LAYER_ID layer = *seq;
|
||||
bool state = m_pcb->IsLayerEnabled( layer );
|
||||
|
||||
#ifdef HIDE_INACTIVE_LAYERS
|
||||
@ -305,9 +304,8 @@ void PANEL_SETUP_LAYERS::showBoardLayerNames()
|
||||
// Set all the board's layer names into the dialog by calling BOARD::GetLayerName(),
|
||||
// which will call BOARD::GetStandardLayerName() for non-coppers.
|
||||
|
||||
for( LSEQ seq = dlg_layers(); seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : dlg_layers() )
|
||||
{
|
||||
PCB_LAYER_ID layer = *seq;
|
||||
wxControl* ctl = getName( layer );
|
||||
|
||||
if( ctl )
|
||||
@ -326,11 +324,8 @@ void PANEL_SETUP_LAYERS::showBoardLayerNames()
|
||||
void PANEL_SETUP_LAYERS::showSelectedLayerCheckBoxes( LSET enabledLayers )
|
||||
{
|
||||
// The check boxes
|
||||
for( LSEQ seq = dlg_layers(); seq; ++seq )
|
||||
{
|
||||
PCB_LAYER_ID layer = *seq;
|
||||
for( PCB_LAYER_ID layer : dlg_layers() )
|
||||
setLayerCheckBox( layer, enabledLayers[layer] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -359,9 +354,8 @@ LSET PANEL_SETUP_LAYERS::GetUILayerMask()
|
||||
{
|
||||
LSET layerMaskResult;
|
||||
|
||||
for( LSEQ seq = dlg_layers(); seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : dlg_layers() )
|
||||
{
|
||||
PCB_LAYER_ID layer = *seq;
|
||||
wxCheckBox* ctl = getCheckBox( layer );
|
||||
|
||||
if( !ctl || ctl->GetValue() )
|
||||
@ -397,9 +391,8 @@ void PANEL_SETUP_LAYERS::setCopperLayerCheckBoxes( int copperCount )
|
||||
--copperCount;
|
||||
}
|
||||
|
||||
for( LSEQ seq = LSET::InternalCuMask().Seq(); seq; ++seq, --copperCount )
|
||||
for( PCB_LAYER_ID layer : LSET::InternalCuMask().Seq() )
|
||||
{
|
||||
PCB_LAYER_ID layer = *seq;
|
||||
bool state = copperCount > 0;
|
||||
|
||||
#ifdef HIDE_INACTIVE_LAYERS
|
||||
@ -436,9 +429,9 @@ void PANEL_SETUP_LAYERS::DenyChangeCheckBox( wxCommandEvent& event )
|
||||
{
|
||||
wxObject* source = event.GetEventObject();
|
||||
|
||||
for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : LSET::AllCuMask().Seq() )
|
||||
{
|
||||
wxCheckBox* copper = getCheckBox( *seq );
|
||||
wxCheckBox* copper = getCheckBox( layer );
|
||||
|
||||
if( source == copper )
|
||||
{
|
||||
@ -582,10 +575,8 @@ bool PANEL_SETUP_LAYERS::TransferDataFromWindow()
|
||||
modified = true;
|
||||
}
|
||||
|
||||
for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : LSET::AllLayersMask().Seq() )
|
||||
{
|
||||
PCB_LAYER_ID layer = *seq;
|
||||
|
||||
if( m_enabledLayers[layer] )
|
||||
{
|
||||
const wxString& newLayerName = GetLayerName( layer );
|
||||
@ -636,9 +627,8 @@ bool PANEL_SETUP_LAYERS::TransferDataFromWindow()
|
||||
}
|
||||
}
|
||||
|
||||
for( LSEQ seq = LSET::UserDefinedLayers().Seq(); seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : LSET::UserDefinedLayers().Seq() )
|
||||
{
|
||||
PCB_LAYER_ID layer = *seq;
|
||||
const wxString& newLayerName = GetLayerName( layer );
|
||||
|
||||
if( m_enabledLayers[ layer ] && m_pcb->GetLayerName( layer ) != newLayerName )
|
||||
@ -688,10 +678,8 @@ bool PANEL_SETUP_LAYERS::testLayerNames()
|
||||
std::vector<wxString> names;
|
||||
wxTextCtrl* ctl;
|
||||
|
||||
for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : LSET::AllLayersMask().Seq() )
|
||||
{
|
||||
PCB_LAYER_ID layer = *seq;
|
||||
|
||||
// we _can_ rely on m_enabledLayers being current here:
|
||||
|
||||
if( !m_enabledLayers[layer] )
|
||||
@ -878,15 +866,15 @@ void PANEL_SETUP_LAYERS::addUserDefinedLayer( wxCommandEvent& aEvent )
|
||||
// Build the available user-defined layers list:
|
||||
std::vector<wxArrayString> list;
|
||||
|
||||
for( LSEQ seq = LSET::UserDefinedLayers().Seq(); seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : LSET::UserDefinedLayers().Seq() )
|
||||
{
|
||||
wxCheckBox* checkBox = getCheckBox( *seq );
|
||||
wxCheckBox* checkBox = getCheckBox( layer );
|
||||
|
||||
if( checkBox && checkBox->IsShown() )
|
||||
continue;
|
||||
|
||||
wxArrayString available_user_layer;
|
||||
available_user_layer.Add( LayerName( *seq ) );
|
||||
available_user_layer.Add( LayerName( layer ) );
|
||||
|
||||
list.emplace_back( available_user_layer );
|
||||
}
|
||||
@ -906,21 +894,24 @@ void PANEL_SETUP_LAYERS::addUserDefinedLayer( wxCommandEvent& aEvent )
|
||||
if( dlg.ShowModal() == wxID_CANCEL || dlg.GetTextSelection().IsEmpty() )
|
||||
return;
|
||||
|
||||
LSEQ seq;
|
||||
PCB_LAYER_ID layer = UNDEFINED_LAYER;
|
||||
|
||||
for( seq = LSET::UserDefinedLayers().Seq(); seq; ++seq )
|
||||
for( PCB_LAYER_ID layer2 : LSET::UserDefinedLayers().Seq() )
|
||||
{
|
||||
if( LayerName( *seq ) == dlg.GetTextSelection() )
|
||||
if( LayerName( layer2 ) == dlg.GetTextSelection() )
|
||||
{
|
||||
layer = layer2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
wxCHECK( *seq >= User_1 && *seq <= User_9, /* void */ );
|
||||
wxCHECK( layer >= User_1 && layer <= User_9, /* void */ );
|
||||
|
||||
LSET newLayer( *seq );
|
||||
LSET newLayer( layer );
|
||||
|
||||
m_enabledLayers |= newLayer;
|
||||
|
||||
PANEL_SETUP_LAYERS_CTLs ctl = getCTLs( *seq );
|
||||
PANEL_SETUP_LAYERS_CTLs ctl = getCTLs( layer );
|
||||
|
||||
// All user-defined layers should have a checkbox
|
||||
wxASSERT( ctl.checkbox );
|
||||
@ -929,7 +920,7 @@ void PANEL_SETUP_LAYERS::addUserDefinedLayer( wxCommandEvent& aEvent )
|
||||
wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( ctl.name );
|
||||
|
||||
wxCHECK( textCtrl, /* void */ );
|
||||
textCtrl->ChangeValue( LSET::Name( *seq ) );
|
||||
textCtrl->ChangeValue( LSET::Name( layer ) );
|
||||
|
||||
wxChoice* userLayerType = dynamic_cast<wxChoice*>( ctl.choice );
|
||||
|
||||
|
@ -589,10 +589,8 @@ void GENCAD_EXPORTER::CreatePadsShapesSection()
|
||||
fmt_mask( mask ).c_str(),
|
||||
via->GetDrillValue() / SCALE_FACTOR );
|
||||
|
||||
for( LSEQ seq = mask.Seq( gc_seq, arrayDim( gc_seq ) ); seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : mask.Seq( gc_seq, arrayDim( gc_seq ) ) )
|
||||
{
|
||||
PCB_LAYER_ID layer = *seq;
|
||||
|
||||
fprintf( m_file, "PAD V%d.%d.%s %s 0 0\n",
|
||||
via->GetWidth(), via->GetDrillValue(),
|
||||
fmt_mask( mask ).c_str(),
|
||||
@ -615,10 +613,8 @@ void GENCAD_EXPORTER::CreatePadsShapesSection()
|
||||
LSET pad_set = pad->GetLayerSet() & master_layermask;
|
||||
|
||||
// the special gc_seq
|
||||
for( LSEQ seq = pad_set.Seq( gc_seq, arrayDim( gc_seq ) ); seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : pad_set.Seq( gc_seq, arrayDim( gc_seq ) ) )
|
||||
{
|
||||
PCB_LAYER_ID layer = *seq;
|
||||
|
||||
fprintf( m_file, "PAD P%u %s 0 0\n", i, GenCADLayerName( cu_count, layer ).c_str() );
|
||||
}
|
||||
|
||||
@ -628,10 +624,8 @@ void GENCAD_EXPORTER::CreatePadsShapesSection()
|
||||
fprintf( m_file, "PADSTACK PAD%uF %g\n", i, pad->GetDrillSize().x / SCALE_FACTOR );
|
||||
|
||||
// the normal PCB_LAYER_ID sequence is inverted from gc_seq[]
|
||||
for( LSEQ seq = pad_set.Seq(); seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : pad_set.Seq() )
|
||||
{
|
||||
PCB_LAYER_ID layer = *seq;
|
||||
|
||||
fprintf( m_file, "PAD P%u %s 0 0\n", i,
|
||||
GenCADLayerNameFlipped( cu_count, layer ).c_str() );
|
||||
}
|
||||
|
@ -726,9 +726,9 @@ void EXPORTER_PCB_VRML::ComputeLayer3D_Zpos()
|
||||
double half_thickness = m_brd_thickness / 2;
|
||||
|
||||
// Compute each layer's Z value, more or less like the 3d view
|
||||
for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : LSET::AllCuMask().Seq() )
|
||||
{
|
||||
int i = static_cast<int>( *seq );
|
||||
int i = static_cast<int>( layer );
|
||||
|
||||
if( i < copper_layers )
|
||||
SetLayerZ( i, half_thickness - m_brd_thickness * i / (copper_layers - 1) );
|
||||
|
@ -430,12 +430,12 @@ bool GENDRILL_WRITER_BASE::GenDrillReportFile( const wxString& aFullFileName )
|
||||
|
||||
int conventional_layer_num = 1;
|
||||
|
||||
for( LSEQ seq = cu.Seq(); seq; ++seq, ++conventional_layer_num )
|
||||
for( PCB_LAYER_ID layer : cu.Seq() )
|
||||
{
|
||||
out.Print( 0, " L%-2d: %-25s %s\n",
|
||||
conventional_layer_num,
|
||||
TO_UTF8( m_pcb->GetLayerName( *seq ) ),
|
||||
layerName( *seq ).c_str() ); // generic layer name
|
||||
TO_UTF8( m_pcb->GetLayerName( layer ) ),
|
||||
layerName( layer ).c_str() ); // generic layer name
|
||||
}
|
||||
|
||||
out.Print( 0, "\n\n" );
|
||||
|
@ -3721,8 +3721,8 @@ static struct FOOTPRINT_DESC
|
||||
{
|
||||
layerEnum.Undefined( UNDEFINED_LAYER );
|
||||
|
||||
for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
|
||||
layerEnum.Map( *seq, LSET::Name( *seq ) );
|
||||
for( PCB_LAYER_ID layer : LSET::AllLayersMask().Seq() )
|
||||
layerEnum.Map( layer, LSET::Name( layer ) );
|
||||
}
|
||||
|
||||
wxPGChoices fpLayers; // footprints might be placed only on F.Cu & B.Cu
|
||||
|
@ -1519,13 +1519,13 @@ void PCB_EDIT_FRAME::onBoardLoaded()
|
||||
layerEnum.Choices().Clear();
|
||||
layerEnum.Undefined( UNDEFINED_LAYER );
|
||||
|
||||
for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : LSET::AllLayersMask().Seq() )
|
||||
{
|
||||
// Canonical name
|
||||
layerEnum.Map( *seq, LSET::Name( *seq ) );
|
||||
layerEnum.Map( layer, LSET::Name( layer ) );
|
||||
|
||||
// User name
|
||||
layerEnum.Map( *seq, GetBoard()->GetLayerName( *seq ) );
|
||||
layerEnum.Map( layer, GetBoard()->GetLayerName( layer ) );
|
||||
}
|
||||
|
||||
DRC_TOOL* drcTool = m_toolManager->GetTool<DRC_TOOL>();
|
||||
@ -1741,13 +1741,13 @@ void PCB_EDIT_FRAME::UpdateUserInterface()
|
||||
layerEnum.Choices().Clear();
|
||||
layerEnum.Undefined( UNDEFINED_LAYER );
|
||||
|
||||
for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : LSET::AllLayersMask().Seq() )
|
||||
{
|
||||
// Canonical name
|
||||
layerEnum.Map( *seq, LSET::Name( *seq ) );
|
||||
layerEnum.Map( layer, LSET::Name( layer ) );
|
||||
|
||||
// User name
|
||||
layerEnum.Map( *seq, GetBoard()->GetLayerName( *seq ) );
|
||||
layerEnum.Map( layer, GetBoard()->GetLayerName( layer ) );
|
||||
}
|
||||
|
||||
// Sync visibility with canvas
|
||||
|
@ -655,9 +655,8 @@ void PCB_IO_KICAD_SEXPR::formatBoardLayers( const BOARD* aBoard, int aNestLevel
|
||||
|
||||
// Save only the used copper layers from front to back.
|
||||
|
||||
for( LSEQ cu = aBoard->GetEnabledLayers().CuStack(); cu; ++cu )
|
||||
for( PCB_LAYER_ID layer : aBoard->GetEnabledLayers().CuStack() )
|
||||
{
|
||||
PCB_LAYER_ID layer = *cu;
|
||||
|
||||
m_out->Print( aNestLevel+1, "(%d %s %s",
|
||||
layer,
|
||||
@ -703,10 +702,8 @@ void PCB_IO_KICAD_SEXPR::formatBoardLayers( const BOARD* aBoard, int aNestLevel
|
||||
User_9
|
||||
};
|
||||
|
||||
for( LSEQ seq = aBoard->GetEnabledLayers().Seq( non_cu, arrayDim( non_cu ) ); seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : aBoard->GetEnabledLayers().Seq( non_cu, arrayDim( non_cu ) ) )
|
||||
{
|
||||
PCB_LAYER_ID layer = *seq;
|
||||
|
||||
m_out->Print( aNestLevel+1, "(%d %s",
|
||||
layer,
|
||||
m_out->Quotew( LSET::Name( layer ) ).c_str() );
|
||||
@ -1580,10 +1577,10 @@ void PCB_IO_KICAD_SEXPR::format( const PAD* aPad, int aNestLevel ) const
|
||||
{
|
||||
m_out->Print( 0, " (zone_layer_connections" );
|
||||
|
||||
for( LSEQ cu = board->GetEnabledLayers().CuStack(); cu; ++cu )
|
||||
for( PCB_LAYER_ID layer : board->GetEnabledLayers().CuStack() )
|
||||
{
|
||||
if( aPad->GetZoneLayerOverride( *cu ) == ZLO_FORCE_FLASHED )
|
||||
m_out->Print( 0, " %s", m_out->Quotew( LSET::Name( *cu ) ).c_str() );
|
||||
if( aPad->GetZoneLayerOverride( layer ) == ZLO_FORCE_FLASHED )
|
||||
m_out->Print( 0, " %s", m_out->Quotew( LSET::Name( layer ) ).c_str() );
|
||||
}
|
||||
|
||||
m_out->Print( 0, ")" );
|
||||
@ -2263,10 +2260,10 @@ void PCB_IO_KICAD_SEXPR::format( const PCB_TRACK* aTrack, int aNestLevel ) const
|
||||
{
|
||||
m_out->Print( 0, " (zone_layer_connections" );
|
||||
|
||||
for( LSEQ cu = board->GetEnabledLayers().CuStack(); cu; ++cu )
|
||||
for( PCB_LAYER_ID layer : board->GetEnabledLayers().CuStack() )
|
||||
{
|
||||
if( via->GetZoneLayerOverride( *cu ) == ZLO_FORCE_FLASHED )
|
||||
m_out->Print( 0, " %s", m_out->Quotew( LSET::Name( *cu ) ).c_str() );
|
||||
if( via->GetZoneLayerOverride( layer ) == ZLO_FORCE_FLASHED )
|
||||
m_out->Print( 0, " %s", m_out->Quotew( LSET::Name( layer ) ).c_str() );
|
||||
}
|
||||
|
||||
m_out->Print( 0, ")" );
|
||||
|
@ -157,11 +157,10 @@ void PCB_RENDER_SETTINGS::LoadColors( const COLOR_SETTINGS* aSettings )
|
||||
m_layerColors[LAYER_PAD_BK_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
|
||||
|
||||
// Netnames for copper layers
|
||||
for( LSEQ cu = LSET::AllCuMask().CuStack(); cu; ++cu )
|
||||
for( PCB_LAYER_ID layer : LSET::AllCuMask().CuStack() )
|
||||
{
|
||||
const COLOR4D lightLabel( 1.0, 1.0, 1.0, 0.7 );
|
||||
const COLOR4D darkLabel = lightLabel.Inverted();
|
||||
PCB_LAYER_ID layer = *cu;
|
||||
|
||||
if( m_layerColors[layer].GetBrightness() > 0.5 )
|
||||
m_layerColors[GetNetnameLayer( layer )] = darkLabel;
|
||||
|
@ -916,8 +916,8 @@ static struct PCB_SHAPE_DESC
|
||||
{
|
||||
layerEnum.Undefined( UNDEFINED_LAYER );
|
||||
|
||||
for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
|
||||
layerEnum.Map( *seq, LSET::Name( *seq ) );
|
||||
for( PCB_LAYER_ID layer : LSET::AllLayersMask().Seq() )
|
||||
layerEnum.Map( layer, LSET::Name( layer ) );
|
||||
}
|
||||
|
||||
void ( PCB_SHAPE::*shapeLayerSetter )( PCB_LAYER_ID ) = &PCB_SHAPE::SetLayer;
|
||||
|
@ -1733,8 +1733,8 @@ static struct TRACK_VIA_DESC
|
||||
{
|
||||
layerEnum.Undefined( UNDEFINED_LAYER );
|
||||
|
||||
for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
|
||||
layerEnum.Map( *seq, LSET::Name( *seq ) );
|
||||
for( PCB_LAYER_ID layer : LSET::AllLayersMask().Seq() )
|
||||
layerEnum.Map( layer, LSET::Name( layer ) );
|
||||
}
|
||||
|
||||
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
|
||||
|
@ -671,26 +671,25 @@ int PCBNEW_JOBS_HANDLER::JobExportGerbers( JOB* aJob )
|
||||
aGerberJob->m_layersIncludeOnAll = plotOnAllLayersSelection;
|
||||
}
|
||||
|
||||
for( LSEQ seq = LSET( aGerberJob->m_printMaskLayer ).UIOrder(); seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : LSET( aGerberJob->m_printMaskLayer ).UIOrder() )
|
||||
{
|
||||
LSEQ plotSequence;
|
||||
|
||||
// Base layer always gets plotted first.
|
||||
plotSequence.push_back( *seq );
|
||||
plotSequence.push_back( layer );
|
||||
|
||||
// Now all the "include on all" layers
|
||||
for( LSEQ seqAll = aGerberJob->m_layersIncludeOnAll.UIOrder(); seqAll; ++seqAll )
|
||||
for( PCB_LAYER_ID layer_all : aGerberJob->m_layersIncludeOnAll.UIOrder() )
|
||||
{
|
||||
// Don't plot the same layer more than once;
|
||||
if( find( plotSequence.begin(), plotSequence.end(), *seqAll ) != plotSequence.end() )
|
||||
if( find( plotSequence.begin(), plotSequence.end(), layer_all ) != plotSequence.end() )
|
||||
continue;
|
||||
|
||||
plotSequence.push_back( *seqAll );
|
||||
plotSequence.push_back( layer_all );
|
||||
}
|
||||
|
||||
// Pick the basename from the board file
|
||||
wxFileName fn( brd->GetFileName() );
|
||||
PCB_LAYER_ID layer = *seq;
|
||||
wxString layerName = brd->GetLayerName( layer );
|
||||
wxString sheetName;
|
||||
wxString sheetPath;
|
||||
|
@ -63,24 +63,24 @@ void PlotBoardLayers( BOARD* aBoard, PLOTTER* aPlotter, const LSEQ& aLayers,
|
||||
// white shape *after* all other shapes are plotted
|
||||
bool plot_mark = aPlotOptions.GetDrillMarksType() != DRILL_MARKS::NO_DRILL_SHAPE;
|
||||
|
||||
for( LSEQ seq = aLayers; seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : aLayers )
|
||||
{
|
||||
// copper layers with drill marks will be plotted after all other layers
|
||||
if( *seq <= B_Cu && plot_mark )
|
||||
if( layer <= B_Cu && plot_mark )
|
||||
continue;
|
||||
|
||||
PlotOneBoardLayer( aBoard, aPlotter, *seq, aPlotOptions );
|
||||
PlotOneBoardLayer( aBoard, aPlotter, layer, aPlotOptions );
|
||||
}
|
||||
|
||||
if( !plot_mark )
|
||||
return;
|
||||
|
||||
for( LSEQ seq = aLayers; seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : aLayers )
|
||||
{
|
||||
if( *seq > B_Cu ) // already plotted
|
||||
if( layer > B_Cu ) // already plotted
|
||||
continue;
|
||||
|
||||
PlotOneBoardLayer( aBoard, aPlotter, *seq, aPlotOptions );
|
||||
PlotOneBoardLayer( aBoard, aPlotter, layer, aPlotOptions );
|
||||
}
|
||||
}
|
||||
|
||||
@ -739,10 +739,8 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
|
||||
|
||||
SHAPE_POLY_SET outlines;
|
||||
|
||||
for( LSEQ seq = aLayerMask.Seq( aLayerMask.SeqStackupForPlotting() ); seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : aLayerMask.Seq( aLayerMask.SeqStackupForPlotting() ) )
|
||||
{
|
||||
PCB_LAYER_ID layer = *seq;
|
||||
|
||||
outlines.RemoveAllContours();
|
||||
aBoard->ConvertBrdLayerToPolygonalContours( layer, outlines );
|
||||
|
||||
|
@ -197,13 +197,13 @@ BOARD* LoadBoard( wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat, bool aSet
|
||||
layerEnum.Choices().Clear();
|
||||
layerEnum.Undefined( UNDEFINED_LAYER );
|
||||
|
||||
for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : LSET::AllLayersMask().Seq() )
|
||||
{
|
||||
// Canonical name
|
||||
layerEnum.Map( *seq, LSET::Name( *seq ) );
|
||||
layerEnum.Map( layer, LSET::Name( layer ) );
|
||||
|
||||
// User name
|
||||
layerEnum.Map( *seq, brd->GetLayerName( *seq ) );
|
||||
layerEnum.Map( layer, brd->GetLayerName( layer ) );
|
||||
}
|
||||
|
||||
brd->SetProject( project );
|
||||
@ -557,10 +557,10 @@ bool WriteDRCReport( BOARD* aBoard, const wxString& aFileName, EDA_UNITS aUnits,
|
||||
layerEnum.Choices().Clear();
|
||||
layerEnum.Undefined( UNDEFINED_LAYER );
|
||||
|
||||
for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
|
||||
for( PCB_LAYER_ID layer : LSET::AllLayersMask().Seq() )
|
||||
{
|
||||
layerEnum.Map( *seq, LSET::Name( *seq ) ); // Add Canonical name
|
||||
layerEnum.Map( *seq, aBoard->GetLayerName( *seq ) ); // Add User name
|
||||
layerEnum.Map( layer, LSET::Name( layer ) ); // Add Canonical name
|
||||
layerEnum.Map( layer, aBoard->GetLayerName( layer ) ); // Add User name
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -202,10 +202,8 @@ void PCB_ONE_LAYER_SELECTOR::buildList()
|
||||
int right_row = 0;
|
||||
wxString layername;
|
||||
|
||||
for( LSEQ ui_seq = m_brd->GetEnabledLayers().UIOrder(); ui_seq; ++ui_seq )
|
||||
for( PCB_LAYER_ID layerid : m_brd->GetEnabledLayers().UIOrder() )
|
||||
{
|
||||
PCB_LAYER_ID layerid = *ui_seq;
|
||||
|
||||
if( m_notAllowedLayersMask[layerid] )
|
||||
continue;
|
||||
|
||||
@ -385,10 +383,8 @@ void SELECT_COPPER_LAYERS_PAIR_DIALOG::buildList()
|
||||
int row = 0;
|
||||
wxString layername;
|
||||
|
||||
for( LSEQ ui_seq = m_brd->GetEnabledLayers().UIOrder(); ui_seq; ++ui_seq )
|
||||
for( PCB_LAYER_ID layerid : m_brd->GetEnabledLayers().UIOrder() )
|
||||
{
|
||||
PCB_LAYER_ID layerid = *ui_seq;
|
||||
|
||||
if( !IsCopperLayer( layerid ) )
|
||||
continue;
|
||||
|
||||
|
@ -1727,9 +1727,8 @@ void APPEARANCE_CONTROLS::rebuildLayers()
|
||||
auto layer_it = m_layerSettings.begin();
|
||||
|
||||
// show all coppers first, with front on top, back on bottom, then technical layers
|
||||
for( LSEQ cu_stack = enabled.CuStack(); cu_stack; ++cu_stack, ++layer_it )
|
||||
for( PCB_LAYER_ID layer : enabled.CuStack() )
|
||||
{
|
||||
PCB_LAYER_ID layer = *cu_stack;
|
||||
wxString dsc;
|
||||
|
||||
switch( layer )
|
||||
|
@ -239,11 +239,11 @@ void PCB_PROPERTIES_PANEL::updateLists( const BOARD* aBoard )
|
||||
wxPGChoices fonts;
|
||||
|
||||
// Regenerate all layers
|
||||
for( LSEQ seq = aBoard->GetEnabledLayers().UIOrder(); seq; ++seq )
|
||||
layersAll.Add( LSET::Name( *seq ), *seq );
|
||||
for( PCB_LAYER_ID layer : aBoard->GetEnabledLayers().UIOrder() )
|
||||
layersAll.Add( LSET::Name( layer ), layer );
|
||||
|
||||
for( LSEQ seq = LSET( aBoard->GetEnabledLayers() & LSET::AllCuMask() ).UIOrder(); seq; ++seq )
|
||||
layersCu.Add( LSET::Name( *seq ), *seq );
|
||||
for( PCB_LAYER_ID layer : LSET( aBoard->GetEnabledLayers() & LSET::AllCuMask() ).UIOrder() )
|
||||
layersCu.Add( LSET::Name( layer ), layer );
|
||||
|
||||
m_propMgr.GetProperty( TYPE_HASH( BOARD_ITEM ), _HKI( "Layer" ) )->SetChoices( layersAll );
|
||||
m_propMgr.GetProperty( TYPE_HASH( PCB_SHAPE ), _HKI( "Layer" ) )->SetChoices( layersAll );
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user