void PCB_DRAW_PANEL_GAL::setDefaultLayerDeps() { for( LAYER_NUM i = 0; (unsigned) i < sizeof( GAL_LAYER_ORDER ) / sizeof( LAYER_NUM ); ++i ) { LAYER_NUM layer = GAL_LAYER_ORDER[i]; wxASSERT( layer < KIGFX::VIEW::VIEW_MAX_LAYERS ); if( IsCopperLayer( layer ) ) { // Copper layers are required for netname layers m_view->SetRequired( GetNetnameLayer( layer ), layer ); m_view->SetLayerTarget( layer, KIGFX::TARGET_CACHED ); } else if( IsNetnameLayer( layer ) ) { // Netnames are drawn only when scale is sufficient (level of details) // so there is no point in caching them m_view->SetLayerTarget( layer, KIGFX::TARGET_NONCACHED ); m_view->SetLayerDisplayOnly( layer ); } } m_view->SetLayerTarget( ITEM_GAL_LAYER( ANCHOR_VISIBLE ), KIGFX::TARGET_NONCACHED ); m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( ANCHOR_VISIBLE ) ); // Some more required layers settings m_view->SetRequired( ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ) ); m_view->SetRequired( ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) ); m_view->SetRequired( NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) ); // Front modules m_view->SetRequired( ITEM_GAL_LAYER( PAD_FR_VISIBLE ), ITEM_GAL_LAYER( MOD_FR_VISIBLE ) ); m_view->SetRequired( ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE ), ITEM_GAL_LAYER( MOD_FR_VISIBLE ) ); m_view->SetRequired( NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ) ); m_view->SetRequired( F_Adhes, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) ); m_view->SetRequired( F_Paste, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) ); m_view->SetRequired( F_Mask, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) ); m_view->SetRequired( F_CrtYd, ITEM_GAL_LAYER( MOD_FR_VISIBLE ) ); m_view->SetRequired( F_Fab, ITEM_GAL_LAYER( MOD_FR_VISIBLE ) ); // Back modules m_view->SetRequired( ITEM_GAL_LAYER( PAD_BK_VISIBLE ), ITEM_GAL_LAYER( MOD_BK_VISIBLE ) ); m_view->SetRequired( ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE ), ITEM_GAL_LAYER( MOD_BK_VISIBLE ) ); m_view->SetRequired( NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ) ); m_view->SetRequired( B_Adhes, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) ); m_view->SetRequired( B_Paste, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) ); m_view->SetRequired( B_Mask, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) ); m_view->SetRequired( B_CrtYd, ITEM_GAL_LAYER( MOD_BK_VISIBLE ) ); m_view->SetRequired( B_Fab, ITEM_GAL_LAYER( MOD_BK_VISIBLE ) ); m_view->SetLayerTarget( ITEM_GAL_LAYER( GP_OVERLAY ), KIGFX::TARGET_OVERLAY ); m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( GP_OVERLAY ) ); m_view->SetLayerTarget( ITEM_GAL_LAYER( RATSNEST_VISIBLE ), KIGFX::TARGET_OVERLAY ); m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( RATSNEST_VISIBLE ) ); m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( WORKSHEET ) ); m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( GRID_VISIBLE ) ); m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( DRC_VISIBLE ) ); }
PCB_DRAW_PANEL_GAL::PCB_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindowId, const wxPoint& aPosition, const wxSize& aSize, GalType aGalType ) : EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aGalType ) { m_worksheet = NULL; m_ratsnest = NULL; // Set rendering order and properties of layers for( LAYER_NUM i = 0; (unsigned) i < sizeof(GAL_LAYER_ORDER) / sizeof(LAYER_NUM); ++i ) { LAYER_NUM layer = GAL_LAYER_ORDER[i]; wxASSERT( layer < KIGFX::VIEW::VIEW_MAX_LAYERS ); m_view->SetLayerOrder( layer, i ); if( IsCopperLayer( layer ) ) { // Copper layers are required for netname layers m_view->SetRequired( GetNetnameLayer( layer ), layer ); m_view->SetLayerTarget( layer, KIGFX::TARGET_CACHED ); } else if( IsNetnameLayer( layer ) ) { // Netnames are drawn only when scale is sufficient (level of details) // so there is no point in caching them m_view->SetLayerTarget( layer, KIGFX::TARGET_NONCACHED ); } } m_view->SetLayerTarget( ITEM_GAL_LAYER( ANCHOR_VISIBLE ), KIGFX::TARGET_NONCACHED ); // Some more required layers settings m_view->SetRequired( ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ) ); m_view->SetRequired( ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) ); m_view->SetRequired( NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) ); m_view->SetRequired( NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ) ); m_view->SetRequired( F_Adhes, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) ); m_view->SetRequired( F_Paste, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) ); m_view->SetRequired( F_Mask, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) ); m_view->SetRequired( NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ) ); m_view->SetRequired( B_Adhes, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) ); m_view->SetRequired( B_Paste, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) ); m_view->SetRequired( B_Mask, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) ); m_view->SetRequired( ITEM_GAL_LAYER( PAD_FR_VISIBLE ), ITEM_GAL_LAYER( MOD_FR_VISIBLE ) ); m_view->SetRequired( ITEM_GAL_LAYER( PAD_BK_VISIBLE ), ITEM_GAL_LAYER( MOD_BK_VISIBLE ) ); m_view->SetLayerTarget( ITEM_GAL_LAYER( GP_OVERLAY ), KIGFX::TARGET_OVERLAY ); m_view->SetLayerTarget( ITEM_GAL_LAYER( RATSNEST_VISIBLE ), KIGFX::TARGET_OVERLAY ); // Load display options (such as filled/outline display of items) static_cast<KIGFX::PCB_RENDER_SETTINGS*>( m_view->GetPainter()->GetSettings() )->LoadDisplayOptions( DisplayOpt ); }
unsigned int TRACK::ViewGetLOD( int aLayer ) const { // Netnames will be shown only if zoom is appropriate if( IsNetnameLayer( aLayer ) ) { return ( 20000000 / ( m_Width + 1 ) ); } // Other layers are shown without any conditions return 0; }
unsigned int D_PAD::ViewGetLOD( int aLayer ) const { // Netnames and soldermasks will be shown only if zoom is appropriate if( IsNetnameLayer( aLayer ) ) { return ( 100000000 / std::max( m_Size.x, m_Size.y ) ); } // Other layers are shown without any conditions return 0; }
unsigned int D_PAD::ViewGetLOD( int aLayer ) const { // Netnames will be shown only if zoom is appropriate if( IsNetnameLayer( aLayer ) ) { // Pad sizes can be zero briefly when someone is typing a number like "0.5" in the pad properties dialog. // Fail gracefully if this happens. if( ( m_Size.x == 0 ) && ( m_Size.y == 0 ) ) return UINT_MAX; return ( 100000000 / std::max( m_Size.x, m_Size.y ) ); } // Other layers are shown without any conditions return 0; }
unsigned int TRACK::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const { const int HIDE = std::numeric_limits<unsigned int>::max(); if( !aView->IsLayerVisible( LAYER_TRACKS ) ) return HIDE; // Netnames will be shown only if zoom is appropriate if( IsNetnameLayer( aLayer ) ) { return ( 40000000 / ( m_Width + 1 ) ); } // Other layers are shown without any conditions return 0; }
unsigned int D_PAD::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const { if( aView->GetPrintMode() > 0 ) // In printing mode the pad is always drawable return 0; const int HIDE = std::numeric_limits<unsigned int>::max(); BOARD* board = GetBoard(); // Handle Render tab switches if( ( GetAttribute() == PAD_ATTRIB_STANDARD || GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED ) && !aView->IsLayerVisible( LAYER_PADS_TH ) ) return HIDE; if( !IsFlipped() && !aView->IsLayerVisible( LAYER_MOD_FR ) ) return HIDE; if( IsFlipped() && !aView->IsLayerVisible( LAYER_MOD_BK ) ) return HIDE; if( IsFrontLayer( ( PCB_LAYER_ID )aLayer ) && !aView->IsLayerVisible( LAYER_PAD_FR ) ) return HIDE; if( IsBackLayer( ( PCB_LAYER_ID )aLayer ) && !aView->IsLayerVisible( LAYER_PAD_BK ) ) return HIDE; // Only draw the pad if at least one of the layers it crosses is being displayed if( board && !( board->GetVisibleLayers() & GetLayerSet() ).any() ) return HIDE; // Netnames will be shown only if zoom is appropriate if( IsNetnameLayer( aLayer ) ) { int divisor = std::max( m_Size.x, m_Size.y ); // Pad sizes can be zero briefly when someone is typing a number like "0.5" // in the pad properties dialog if( divisor == 0 ) return HIDE; return ( Millimeter2iu( 10 ) / divisor ); } // Other layers are shown without any conditions return 0; }
unsigned int D_PAD::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const { // Netnames will be shown only if zoom is appropriate if( IsNetnameLayer( aLayer ) ) { int divisor = std::max( m_Size.x, m_Size.y ); // Pad sizes can be zero briefly when someone is typing a number like "0.5" // in the pad properties dialog if( divisor == 0 ) return UINT_MAX; return ( Millimeter2iu( 100 ) / divisor ); } // Other layers are shown without any conditions return 0; }
void PCB_BASE_FRAME::LoadSettings() { wxASSERT( wxGetApp().GetSettings() != NULL ); wxConfig* cfg = wxGetApp().GetSettings(); EDA_DRAW_FRAME::LoadSettings(); // Ensure grid id is an existent grid id: if( (m_LastGridSizeId <= 0) || (m_LastGridSizeId > (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000)) ) m_LastGridSizeId = ID_POPUP_GRID_LEVEL_500 - ID_POPUP_GRID_LEVEL_1000; cfg->Read( m_FrameName + UserGridSizeXEntry, &m_UserGridSize.x, 0.01 ); cfg->Read( m_FrameName + UserGridSizeYEntry, &m_UserGridSize.y, 0.01 ); long itmp; cfg->Read( m_FrameName + UserGridUnitsEntry, &itmp, ( long )INCHES ); m_UserGridUnit = (EDA_UNITS_T) itmp; cfg->Read( m_FrameName + DisplayPadFillEntry, &m_DisplayPadFill, true ); cfg->Read( m_FrameName + DisplayViaFillEntry, &m_DisplayViaFill, true ); cfg->Read( m_FrameName + DisplayPadNumberEntry, &m_DisplayPadNum, true ); cfg->Read( m_FrameName + DisplayModuleEdgeEntry, &m_DisplayModEdge, ( long )FILLED ); cfg->Read( m_FrameName + FastGrid1Entry, &itmp, ( long )0); m_FastGrid1 = itmp; cfg->Read( m_FrameName + FastGrid2Entry, &itmp, ( long )0); m_FastGrid2 = itmp; if( m_DisplayModEdge < LINE || m_DisplayModEdge > SKETCH ) m_DisplayModEdge = FILLED; cfg->Read( m_FrameName + DisplayModuleTextEntry, &m_DisplayModText, ( long )FILLED ); if( m_DisplayModText < LINE || m_DisplayModText > SKETCH ) m_DisplayModText = FILLED; // Apply display settings for GAL KIGFX::VIEW* view = GetGalCanvas()->GetView(); // Set rendering order and properties of layers for( LAYER_NUM i = 0; (unsigned) i < sizeof(GAL_LAYER_ORDER) / sizeof(LAYER_NUM); ++i ) { LAYER_NUM layer = GAL_LAYER_ORDER[i]; wxASSERT( layer < KIGFX::VIEW::VIEW_MAX_LAYERS ); view->SetLayerOrder( layer, i ); if( IsCopperLayer( layer ) ) { // Copper layers are required for netname layers view->SetRequired( GetNetnameLayer( layer ), layer ); view->SetLayerTarget( layer, KIGFX::TARGET_CACHED ); } else if( IsNetnameLayer( layer ) ) { // Netnames are drawn only when scale is sufficient (level of details) // so there is no point in caching them view->SetLayerTarget( layer, KIGFX::TARGET_NONCACHED ); } } // Some more required layers settings view->SetRequired( ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( VIAS_VISIBLE ) ); view->SetRequired( ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) ); view->SetRequired( NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) ); view->SetRequired( NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ) ); view->SetRequired( ADHESIVE_N_FRONT, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) ); view->SetRequired( SOLDERPASTE_N_FRONT, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) ); view->SetRequired( SOLDERMASK_N_FRONT, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) ); view->SetRequired( NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ) ); view->SetRequired( ADHESIVE_N_BACK, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) ); view->SetRequired( SOLDERPASTE_N_BACK, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) ); view->SetRequired( SOLDERMASK_N_BACK, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) ); view->SetLayerTarget( ITEM_GAL_LAYER( GP_OVERLAY ), KIGFX::TARGET_OVERLAY ); view->SetLayerTarget( ITEM_GAL_LAYER( RATSNEST_VISIBLE ), KIGFX::TARGET_OVERLAY ); // Apply layer coloring scheme & display options if( view->GetPainter() ) { KIGFX::PCB_RENDER_SETTINGS* settings = new KIGFX::PCB_RENDER_SETTINGS(); // Load layers' colors from PCB data settings->ImportLegacyColors( m_Pcb->GetColorsSettings() ); view->GetPainter()->ApplySettings( settings ); // Load display options (such as filled/outline display of items) settings->LoadDisplayOptions( DisplayOpt ); } // WxWidgets 2.9.1 seems call setlocale( LC_NUMERIC, "" ) // when reading doubles in config, // but forget to back to current locale. So we call SetLocaleTo_Default SetLocaleTo_Default( ); }
PCB_DRAW_PANEL_GAL::PCB_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindowId, const wxPoint& aPosition, const wxSize& aSize, GalType aGalType ) : EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aGalType ) { m_worksheet = NULL; m_ratsnest = NULL; // Set rendering order and properties of layers for( LAYER_NUM i = 0; (unsigned) i < sizeof(GAL_LAYER_ORDER) / sizeof(LAYER_NUM); ++i ) { LAYER_NUM layer = GAL_LAYER_ORDER[i]; wxASSERT( layer < KIGFX::VIEW::VIEW_MAX_LAYERS ); m_view->SetLayerOrder( layer, i ); if( IsCopperLayer( layer ) ) { // Copper layers are required for netname layers m_view->SetRequired( GetNetnameLayer( layer ), layer ); m_view->SetLayerTarget( layer, KIGFX::TARGET_CACHED ); } else if( IsNetnameLayer( layer ) ) { // Netnames are drawn only when scale is sufficient (level of details) // so there is no point in caching them m_view->SetLayerTarget( layer, KIGFX::TARGET_NONCACHED ); m_view->SetLayerDisplayOnly( layer ); } } m_view->SetLayerTarget( ITEM_GAL_LAYER( ANCHOR_VISIBLE ), KIGFX::TARGET_NONCACHED ); m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( ANCHOR_VISIBLE ) ); // Some more required layers settings m_view->SetRequired( ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ) ); m_view->SetRequired( ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) ); m_view->SetRequired( NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) ); // Front modules m_view->SetRequired( ITEM_GAL_LAYER( PAD_FR_VISIBLE ), ITEM_GAL_LAYER( MOD_FR_VISIBLE ) ); m_view->SetRequired( ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE ), ITEM_GAL_LAYER( MOD_FR_VISIBLE ) ); m_view->SetRequired( NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ) ); m_view->SetRequired( F_Adhes, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) ); m_view->SetRequired( F_Paste, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) ); m_view->SetRequired( F_Mask, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) ); m_view->SetRequired( F_CrtYd, ITEM_GAL_LAYER( MOD_FR_VISIBLE ) ); m_view->SetRequired( F_Fab, ITEM_GAL_LAYER( MOD_FR_VISIBLE ) ); // Back modules m_view->SetRequired( ITEM_GAL_LAYER( PAD_BK_VISIBLE ), ITEM_GAL_LAYER( MOD_BK_VISIBLE ) ); m_view->SetRequired( ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE ), ITEM_GAL_LAYER( MOD_BK_VISIBLE ) ); m_view->SetRequired( NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ) ); m_view->SetRequired( B_Adhes, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) ); m_view->SetRequired( B_Paste, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) ); m_view->SetRequired( B_Mask, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) ); m_view->SetRequired( B_CrtYd, ITEM_GAL_LAYER( MOD_BK_VISIBLE ) ); m_view->SetRequired( B_Fab, ITEM_GAL_LAYER( MOD_BK_VISIBLE ) ); m_view->SetLayerTarget( ITEM_GAL_LAYER( GP_OVERLAY ), KIGFX::TARGET_OVERLAY ); m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( GP_OVERLAY ) ); m_view->SetLayerTarget( ITEM_GAL_LAYER( RATSNEST_VISIBLE ), KIGFX::TARGET_OVERLAY ); m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( RATSNEST_VISIBLE ) ); m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( WORKSHEET ) ); m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( GRID_VISIBLE ) ); m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( DRC_VISIBLE ) ); // Load display options (such as filled/outline display of items). // Can be made only if the parent windos is a EDA_DRAW_FRAME (or a derived class) // which is not always the case (namely when it is used from a wxDialog like the pad editor) EDA_DRAW_FRAME* frame = dynamic_cast<EDA_DRAW_FRAME*>( aParentWindow ); if( frame ) { DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*) frame->GetDisplayOptions(); static_cast<KIGFX::PCB_RENDER_SETTINGS*>( m_view->GetPainter()->GetSettings() )->LoadDisplayOptions( displ_opts ); } }