wxString LayerMaskDescribe( const BOARD *aBoard, LSET aMask ) { // Try to be smart and useful. Check all copper first. if( aMask[F_Cu] && aMask[B_Cu] ) return _( "All copper layers" ); // Check for copper. auto layer = aBoard->GetEnabledLayers().AllCuMask() & aMask; for( int i = 0; i < 2; i++ ) { for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit ) { if( layer[ bit ] ) { wxString layerInfo = aBoard->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) ); if( aMask.count() > 1 ) layerInfo << _( " and others" ); return layerInfo; } } // No copper; check for technicals. layer = aBoard->GetEnabledLayers().AllTechMask() & aMask; } // No copper, no technicals: no layer return _( "no layers" ); }
bool BOARD_PRINTOUT_CONTROLLER::OnPrintPage( int aPage ) { LSET lset = m_PrintParams.m_PrintMaskLayer; int pageCount = lset.count(); wxString layer; LAYER_ID extractLayer; // compute layer mask from page number if we want one page per layer if( m_PrintParams.m_OptionPrintPage == 0 ) // One page per layer { // This sequence is TBD, call a different // sequencer if needed, such as Seq(). Could not find documentation on // page order. LSEQ seq = lset.UIOrder(); // aPage starts at 1, not 0 if( unsigned( aPage-1 ) < seq.size() ) m_PrintParams.m_PrintMaskLayer = LSET( seq[aPage-1] ); } if( !m_PrintParams.m_PrintMaskLayer.any() ) return false; extractLayer = m_PrintParams.m_PrintMaskLayer.ExtractLayer(); if( extractLayer == UNDEFINED_LAYER ) layer = _( "Multiple Layers" ); else layer = LSET::Name( extractLayer ); // In Pcbnew we can want the layer EDGE always printed if( m_PrintParams.m_Flags == 1 ) m_PrintParams.m_PrintMaskLayer.set( Edge_Cuts ); DrawPage( layer, aPage, pageCount ); m_PrintParams.m_PrintMaskLayer = lset; return true; }
void DIALOG_LAYERS_SETUP::OnPresetsChoice( wxCommandEvent& event ) { unsigned presetNdx = m_PresetsChoice->GetCurrentSelection(); if( presetNdx == 0 ) // the Custom setting controls nothing. return; if( presetNdx < DIM(presets) ) { m_EnabledLayers = presets[ presetNdx ]; LSET copperSet = m_EnabledLayers & LSET::AllCuMask(); int copperCount = copperSet.count(); m_CopperLayerCount = copperCount; showCopperChoice( m_CopperLayerCount ); showSelectedLayerCheckBoxes( m_EnabledLayers ); setCopperLayerCheckBoxes( m_CopperLayerCount ); } }