void PCB_DRAW_PANEL_GAL::SyncLayersVisibility( const BOARD* aBoard ) { // Load layer & elements visibility settings for( LAYER_NUM i = 0; i < LAYER_ID_COUNT; ++i ) { m_view->SetLayerVisible( i, aBoard->IsLayerVisible( LAYER_ID( i ) ) ); // Synchronize netname layers as well if( IsCopperLayer( i ) ) m_view->SetLayerVisible( GetNetnameLayer( i ), aBoard->IsLayerVisible( LAYER_ID( i ) ) ); } for( LAYER_NUM i = 0; i < END_PCB_VISIBLE_LIST; ++i ) { m_view->SetLayerVisible( ITEM_GAL_LAYER( i ), aBoard->IsElementVisible( i ) ); } // Enable some layers that are GAL specific m_view->SetLayerVisible( ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), true ); m_view->SetLayerVisible( ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), true ); m_view->SetLayerVisible( ITEM_GAL_LAYER( WORKSHEET ), true ); m_view->SetLayerVisible( ITEM_GAL_LAYER( GP_OVERLAY ), true ); }
PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings() { DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); if( m_configSettings.empty() ) { COLORS_DESIGN_SETTINGS cds; // constructor fills this with sensible colors // Units used in dialogs and toolbars m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ), (int*)&g_UserUnit, MILLIMETRES ) ); m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "DisplayPolarCoords" ), &displ_opts->m_DisplayPolarCood, false ) ); // Display options and modes: m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ViaHoleDisplayMode" ), (int*) &displ_opts->m_DisplayViaMode, VIA_SPECIAL_HOLE_SHOW, VIA_HOLE_NOT_SHOW, OPT_VIA_HOLE_END - 1 ) ); m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ShowNetNamesMode" ), &displ_opts->m_DisplayNetNamesMode, 3, 0, 3 ) ); m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "DisplayTrackFilled" ), &displ_opts->m_DisplayPcbTrackFill, true ) ); m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "TrackDisplayClearance" ), (int*) &displ_opts->m_ShowTrackClearanceMode, SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) ); m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PadFill" ), &displ_opts->m_DisplayPadFill, true ) ); m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "ViaFill" ), &displ_opts->m_DisplayViaFill, true ) ); m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PadAffG" ), &displ_opts->m_DisplayPadIsol, true ) ); m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PadSNum" ), &displ_opts->m_DisplayPadNum, true ) ); m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "ModAffC" ), &displ_opts->m_DisplayModEdgeFill, FILLED ) ); m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "ModAffT" ), &displ_opts->m_DisplayModTextFill, FILLED ) ); m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PcbAffT" ), &displ_opts->m_DisplayDrawItemsFill, FILLED ) ); m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "PcbShowZonesMode" ), &displ_opts->m_DisplayZonesMode, 0, 0, 2 ) ); // layer colors: wxASSERT( DIM( cds.m_LayersColors ) == LAYER_ID_COUNT ); for( int i = 0; i<LAYER_ID_COUNT; ++i ) { wxString vn = wxString::Format( wxT( "ColorPCBLayer_%s" ), LSET::Name( LAYER_ID( i ) ) ); m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, vn, LOC_COLOR( i ), cds.m_LayersColors[i] ) ); } m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorTxtFrontEx" ), ITEM_COLOR( MOD_TEXT_FR_VISIBLE ), LIGHTGRAY ) ); m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorTxtBackEx" ), ITEM_COLOR( MOD_TEXT_BK_VISIBLE ), BLUE ) ); m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorTxtInvisEx" ), ITEM_COLOR( MOD_TEXT_INVISIBLE ), DARKGRAY ) ); m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorAnchorEx" ), ITEM_COLOR( ANCHOR_VISIBLE ), BLUE ) ); m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPadBackEx" ), ITEM_COLOR( PAD_BK_VISIBLE ), GREEN ) ); m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPadFrontEx" ), ITEM_COLOR( PAD_FR_VISIBLE ), RED ) ); m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorViaThruEx" ), ITEM_COLOR( VIA_THROUGH_VISIBLE ), LIGHTGRAY ) ); m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorViaBBlindEx" ), ITEM_COLOR( VIA_BBLIND_VISIBLE ), BROWN ) ); m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorViaMicroEx" ), ITEM_COLOR( VIA_MICROVIA_VISIBLE ), CYAN ) ); m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNonPlatedEx" ), ITEM_COLOR( NON_PLATED_VISIBLE ), YELLOW ) ); m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorRatsEx" ), ITEM_COLOR( RATSNEST_VISIBLE ), WHITE ) ); // Miscellaneous: m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "RotationAngle" ), &m_rotationAngle, 900, 1, 900 ) ); m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "MaxLnkS" ), &displ_opts->m_MaxLinksShowed, 3, 0, 15 ) ); m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "ShowMRa" ), &displ_opts->m_Show_Module_Ratsnest, true ) ); m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "TwoSegT" ), &g_TwoSegmentTrackBuild, true ) ); m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "SegmPcb45Only" ) , &g_Segments_45_Only, true ) ); } return m_configSettings; }
void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode, void* aData) { const GR_DRAWMODE drawmode = (GR_DRAWMODE) 0; DISPLAY_OPTIONS save_opt; BOARD* Pcb = GetBoard(); int defaultPenSize = Millimeter2iu( 0.2 ); bool onePagePerLayer = false; PRINT_PARAMETERS* printParameters = (PRINT_PARAMETERS*) aData; // can be null DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); if( printParameters && printParameters->m_OptionPrintPage == 0 ) onePagePerLayer = true; PRINT_PARAMETERS::DrillShapeOptT drillShapeOpt = PRINT_PARAMETERS::FULL_DRILL_SHAPE; if( printParameters ) { drillShapeOpt = printParameters->m_DrillShapeOpt; defaultPenSize = printParameters->m_PenDefaultSize; } save_opt = *displ_opts; LAYER_ID activeLayer = GetScreen()->m_Active_Layer; displ_opts->m_ContrastModeDisplay = false; displ_opts->m_DisplayPadFill = true; displ_opts->m_DisplayViaFill = true; if( !( aPrintMask & LSET::AllCuMask() ).any() ) { if( onePagePerLayer ) { // We can print mask layers (solder mask and solder paste) with the actual // pad sizes. To do that, we must set ContrastModeDisplay to true and set // the GetScreen()->m_Active_Layer to the current printed layer displ_opts->m_ContrastModeDisplay = true; displ_opts->m_DisplayPadFill = true; // Calculate the active layer number to print from its mask layer: GetScreen()->m_Active_Layer = B_Cu; for( LAYER_NUM id = LAYER_ID_COUNT-1; id >= 0; --id ) { if( aPrintMask[id] ) { GetScreen()->m_Active_Layer = LAYER_ID( id ); break; } } // pads on Silkscreen layer are usually plot in sketch mode: if( GetScreen()->m_Active_Layer == B_SilkS || GetScreen()->m_Active_Layer == F_SilkS ) { displ_opts->m_DisplayPadFill = false; } } else { displ_opts->m_DisplayPadFill = false; } } displ_opts->m_DisplayPadNum = false; bool nctmp = GetBoard()->IsElementVisible( NO_CONNECTS_VISIBLE ); GetBoard()->SetElementVisibility( NO_CONNECTS_VISIBLE, false ); bool anchorsTmp = GetBoard()->IsElementVisible( ANCHOR_VISIBLE ); GetBoard()->SetElementVisibility( ANCHOR_VISIBLE, false ); displ_opts->m_DisplayPadIsol = false; displ_opts->m_DisplayModEdgeFill = FILLED; displ_opts->m_DisplayModTextFill = FILLED; displ_opts->m_DisplayPcbTrackFill = true; displ_opts->m_ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE; displ_opts->m_DisplayDrawItemsFill = FILLED; displ_opts->m_DisplayZonesMode = 0; displ_opts->m_DisplayNetNamesMode = 0; m_canvas->SetPrintMirrored( aPrintMirrorMode ); for( BOARD_ITEM* item = Pcb->m_Drawings; item; item = item->Next() ) { switch( item->Type() ) { case PCB_LINE_T: case PCB_DIMENSION_T: case PCB_TEXT_T: case PCB_TARGET_T: if( aPrintMask[item->GetLayer()] ) item->Draw( m_canvas, aDC, drawmode ); break; case PCB_MARKER_T: default: break; } } // Print tracks for( TRACK* track = Pcb->m_Track; track; track = track->Next() ) { if( !( aPrintMask & track->GetLayerSet() ).any() ) continue; if( track->Type() == PCB_VIA_T ) // VIA encountered. { int radius = track->GetWidth() / 2; const VIA* via = static_cast<const VIA*>( track ); EDA_COLOR_T color = g_ColorsSettings.GetItemColor( VIAS_VISIBLE + via->GetViaType() ); GRFilledCircle( m_canvas->GetClipBox(), aDC, via->GetStart().x, via->GetStart().y, radius, 0, color, color ); } else { track->Draw( m_canvas, aDC, drawmode ); } } // Outdated: only for compatibility to old boards for( TRACK* track = Pcb->m_Zone; track; track = track->Next() ) { if( !( aPrintMask & track->GetLayerSet() ).any() ) continue; track->Draw( m_canvas, aDC, drawmode ); } // Draw filled areas (i.e. zones) for( int ii = 0; ii < Pcb->GetAreaCount(); ii++ ) { ZONE_CONTAINER* zone = Pcb->GetArea( ii ); if( aPrintMask[zone->GetLayer()] ) zone->DrawFilledArea( m_canvas, aDC, drawmode ); } // Draw footprints, this is done at last in order to print the pad holes in // white after the tracks and zones int tmp = D_PAD::m_PadSketchModePenSize; D_PAD::m_PadSketchModePenSize = defaultPenSize; for( MODULE* module = (MODULE*) Pcb->m_Modules; module; module = module->Next() ) { Print_Module( m_canvas, aDC, module, drawmode, aPrintMask, drillShapeOpt ); } D_PAD::m_PadSketchModePenSize = tmp; /* Print via holes in bg color: Not sure it is good for buried or blind * vias */ if( drillShapeOpt != PRINT_PARAMETERS::NO_DRILL_SHAPE ) { TRACK* track = Pcb->m_Track; EDA_COLOR_T color = WHITE; bool blackpenstate = GetGRForceBlackPenState(); GRForceBlackPen( false ); for( ; track; track = track->Next() ) { if( !( aPrintMask & track->GetLayerSet() ).any() ) continue; if( track->Type() == PCB_VIA_T ) // VIA encountered. { int diameter; const VIA *via = static_cast<const VIA*>( track ); if( drillShapeOpt == PRINT_PARAMETERS::SMALL_DRILL_SHAPE ) diameter = std::min( SMALL_DRILL, via->GetDrillValue() ); else diameter = via->GetDrillValue(); GRFilledCircle( m_canvas->GetClipBox(), aDC, track->GetStart().x, track->GetStart().y, diameter/2, 0, color, color ); } } GRForceBlackPen( blackpenstate ); } m_canvas->SetPrintMirrored( false ); *displ_opts = save_opt; GetScreen()->m_Active_Layer = activeLayer; GetBoard()->SetElementVisibility( NO_CONNECTS_VISIBLE, nctmp ); GetBoard()->SetElementVisibility( ANCHOR_VISIBLE, anchorsTmp ); }
// Returns true if the layer id is enabled (i.e. is it should be displayed) bool IsLayerEnabled( LAYER_NUM aLayer ) const override { return m_brd->IsLayerEnabled( LAYER_ID( aLayer ) ); }