本文整理汇总了C++中PCB_BASE_FRAME::GetScreen方法的典型用法代码示例。如果您正苦于以下问题:C++ PCB_BASE_FRAME::GetScreen方法的具体用法?C++ PCB_BASE_FRAME::GetScreen怎么用?C++ PCB_BASE_FRAME::GetScreen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PCB_BASE_FRAME
的用法示例。
在下文中一共展示了PCB_BASE_FRAME::GetScreen方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
void DIALOG_NON_COPPER_ZONES_EDITOR::Init()
{
BOARD* board = m_parent->GetBoard();
SetReturnCode( ZONE_ABORT ); // Will be changed on button click
AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit );
wxString msg = StringFromValue( g_UserUnit, m_settings.m_ZoneMinThickness );
m_ZoneMinThicknessCtrl->SetValue( msg );
if( m_settings.m_Zone_45_Only )
m_OrientEdgesOpt->SetSelection( 1 );
switch( m_settings.m_Zone_HatchingStyle )
{
case CPolyLine::NO_HATCH:
m_OutlineAppearanceCtrl->SetSelection( 0 );
break;
case CPolyLine::DIAGONAL_EDGE:
m_OutlineAppearanceCtrl->SetSelection( 1 );
break;
case CPolyLine::DIAGONAL_FULL:
m_OutlineAppearanceCtrl->SetSelection( 2 );
break;
}
// Create one column in m_LayerSelectionCtrl
wxListItem column0;
column0.SetId( 0 );
m_LayerSelectionCtrl->InsertColumn( 0, column0 );
// Create an icon list:
wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL );
int ii = 0;
int lyrSelect = ( (PCB_SCREEN*) m_parent->GetScreen() )->m_Active_Layer;
if( m_zone )
lyrSelect = m_zone->GetLayer();
for( LSEQ seq = LSET::AllNonCuMask().Seq(); seq; ++seq, ++ii )
{
LAYER_ID layer = *seq;
EDA_COLOR_T layerColor = board->GetLayerColor( layer );
imageList->Add( makeLayerBitmap( layerColor ) );
wxString msg = board->GetLayerName( layer );
msg.Trim();
int itemIndex = m_LayerSelectionCtrl->InsertItem(
m_LayerSelectionCtrl->GetItemCount(), msg, ii );
if(lyrSelect == layer )
m_LayerSelectionCtrl->Select( itemIndex );
}
}
示例2: Draw
void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
const wxPoint& aOffset )
{
int radius;
LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
int fillvia = 0;
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent();
PCB_SCREEN* screen = frame->GetScreen();
if( frame->m_DisplayViaFill == FILLED )
fillvia = 1;
GRSetDrawMode( aDC, aDrawMode );
BOARD * brd = GetBoard( );
EDA_COLOR_T color = brd->GetVisibleElementColor(VIAS_VISIBLE + GetViaType());
if( brd->IsElementVisible( PCB_VISIBLE(VIAS_VISIBLE + GetViaType()) ) == false
&& ( color & HIGHLIGHT_FLAG ) != HIGHLIGHT_FLAG )
return;
if( DisplayOpt.ContrastModeDisplay )
{
if( !IsOnLayer( curr_layer ) )
ColorTurnToDarkDarkGray( &color );
}
if( aDrawMode & GR_HIGHLIGHT )
ColorChangeHighlightFlag( &color, !(aDrawMode & GR_AND) );
ColorApplyHighlightFlag( &color );
SetAlpha( &color, 150 );
radius = m_Width >> 1;
// for small via size on screen (radius < 4 pixels) draw a simplified shape
int radius_in_pixels = aDC->LogicalToDeviceXRel( radius );
bool fast_draw = false;
// Vias are drawn as a filled circle or a double circle. The hole will be drawn later
int drill_radius = GetDrillValue() / 2;
int inner_radius = radius - aDC->DeviceToLogicalXRel( 2 );
if( radius_in_pixels < MIN_VIA_DRAW_SIZE )
{
fast_draw = true;
fillvia = false;
}
if( fillvia )
{
GRFilledCircle( panel->GetClipBox(), aDC, m_Start + aOffset, radius, color );
}
else
{
GRCircle( panel->GetClipBox(), aDC, m_Start + aOffset, radius, 0, color );
if ( fast_draw )
return;
GRCircle( panel->GetClipBox(), aDC, m_Start + aOffset, inner_radius, 0, color );
}
// Draw the via hole if the display option allows it
if( DisplayOpt.m_DisplayViaMode != VIA_HOLE_NOT_SHOW )
{
// Display all drill holes requested or Display non default holes requested
if( (DisplayOpt.m_DisplayViaMode == ALL_VIA_HOLE_SHOW)
|| ( (drill_radius > 0 ) && !IsDrillDefault() ) )
{
if( fillvia )
{
bool blackpenstate = false;
if( screen->m_IsPrinting )
{
blackpenstate = GetGRForceBlackPenState();
GRForceBlackPen( false );
color = WHITE;
}
else
{
color = BLACK; // or DARKGRAY;
}
if( (aDrawMode & GR_XOR) == 0)
GRSetDrawMode( aDC, GR_COPY );
if( aDC->LogicalToDeviceXRel( drill_radius ) > MIN_DRAW_WIDTH ) // Draw hole if large enough.
GRFilledCircle( panel->GetClipBox(), aDC, m_Start.x + aOffset.x,
m_Start.y + aOffset.y, drill_radius, 0, color, color );
if( screen->m_IsPrinting )
GRForceBlackPen( blackpenstate );
}
//.........这里部分代码省略.........
示例3: Draw
void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
const wxPoint& aOffset )
{
wxSize mask_margin; // margin (clearance) used for some non copper layers
#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
int showActualMaskSize = 0; /* Layer number if the actual pad size on mask layer can
* be displayed i.e. if only one layer is shown for this pad
* and this layer is a mask (solder mask or solder paste
*/
#endif
if( m_Flags & DO_NOT_DRAW )
return;
PAD_DRAWINFO drawInfo;
drawInfo.m_Offset = aOffset;
/* We can show/hide pads from the layer manager.
* options are show/hide pads on front and/or back side of the board
* For through pads, we hide them only if both sides are hidden.
* smd pads on back are hidden for all layers (copper and technical layers)
* on back side of the board
* smd pads on front are hidden for all layers (copper and technical layers)
* on front side of the board
* ECO, edge and Draw layers and not considered
*/
BOARD* brd = GetBoard();
bool frontVisible = brd->IsElementVisible( PCB_VISIBLE( PAD_FR_VISIBLE ) );
bool backVisible = brd->IsElementVisible( PCB_VISIBLE( PAD_BK_VISIBLE ) );
if( !frontVisible && !backVisible )
return;
// If pad is only on front side (no layer on back side)
// and if hide front side pads is enabled, do not draw
if( !frontVisible && !( m_layerMask & LSET::BackMask() ).any() )
return;
// If pad is only on back side (no layer on front side)
// and if hide back side pads is enabled, do not draw
if( !backVisible && !( m_layerMask & LSET::FrontMask() ).any() )
return;
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) aPanel->GetParent();
wxCHECK_RET( frame != NULL, wxT( "Panel has no parent frame window." ) );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)frame->GetDisplayOptions();
PCB_SCREEN* screen = frame->GetScreen();
if( displ_opts && displ_opts->m_DisplayPadFill == SKETCH )
drawInfo.m_ShowPadFilled = false;
else
drawInfo.m_ShowPadFilled = true;
EDA_COLOR_T color = BLACK;
if( m_layerMask[F_Cu] )
{
color = brd->GetVisibleElementColor( PAD_FR_VISIBLE );
}
if( m_layerMask[B_Cu] )
{
color = ColorMix( color, brd->GetVisibleElementColor( PAD_BK_VISIBLE ) );
}
if( color == BLACK ) // Not on a visible copper layer (i.e. still nothing to show)
{
// If the pad is on only one tech layer, use the layer color else use DARKGRAY
LSET mask_non_copper_layers = m_layerMask & ~LSET::AllCuMask();
#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
mask_non_copper_layers &= brd->GetVisibleLayers();
#endif
LAYER_ID pad_layer = mask_non_copper_layers.ExtractLayer();
switch( (int) pad_layer )
{
case UNDEFINED_LAYER: // More than one layer
color = DARKGRAY;
break;
case UNSELECTED_LAYER: // Shouldn't really happen...
break;
default:
color = brd->GetLayerColor( pad_layer );
#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
showActualMaskSize = pad_layer;
#endif
}
}
// if SMD or connector pad and high contrast mode
if( ( aDraw_mode & GR_ALLOW_HIGHCONTRAST ) &&
( GetAttribute() == PAD_SMD || GetAttribute() == PAD_CONN ) &&
//.........这里部分代码省略.........
示例4: Init
void DIALOG_NON_COPPER_ZONES_EDITOR::Init()
{
BOARD* board = m_parent->GetBoard();
SetReturnCode( ZONE_ABORT ); // Will be changed on button click
AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit );
wxString msg = StringFromValue( g_UserUnit, m_settings.m_ZoneMinThickness );
m_ZoneMinThicknessCtrl->SetValue( msg );
if( m_settings.m_Zone_45_Only )
m_OrientEdgesOpt->SetSelection( 1 );
switch( m_settings.m_Zone_HatchingStyle )
{
case CPolyLine::NO_HATCH:
m_OutlineAppearanceCtrl->SetSelection( 0 );
break;
case CPolyLine::DIAGONAL_EDGE:
m_OutlineAppearanceCtrl->SetSelection( 1 );
break;
case CPolyLine::DIAGONAL_FULL:
m_OutlineAppearanceCtrl->SetSelection( 2 );
break;
}
// Create one column in m_LayerSelectionCtrl
wxListItem column0;
column0.SetId( 0 );
m_LayerSelectionCtrl->InsertColumn( 0, column0 );
// Create an icon list:
wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL );
int lyrSelect = ( (PCB_SCREEN*) m_parent->GetScreen() )->m_Active_Layer;
if( m_zone )
lyrSelect = m_zone->GetLayer();
int ctrlWidth = 0; // Min width for m_LayerSelectionCtrl to show the layers names
int imgIdx = 0;
for( LSEQ seq = LSET::AllNonCuMask().Seq(); seq; ++seq, ++imgIdx )
{
LAYER_ID layer = *seq;
EDA_COLOR_T layerColor = board->GetLayerColor( layer );
imageList->Add( makeLayerBitmap( layerColor ) );
wxString msg = board->GetLayerName( layer );
msg.Trim();
int itemIndex = m_LayerSelectionCtrl->InsertItem(
m_LayerSelectionCtrl->GetItemCount(), msg, imgIdx );
if(lyrSelect == layer )
m_LayerSelectionCtrl->Select( itemIndex );
wxSize tsize( GetTextSize( msg, m_LayerSelectionCtrl ) );
ctrlWidth = std::max( ctrlWidth, tsize.x );
}
// The most easy way to ensure the right size is to use wxLIST_AUTOSIZE
// unfortunately this option does not work well both on
// wxWidgets 2.8 ( column witdth too small), and
// wxWidgets 2.9 ( column witdth too large)
ctrlWidth += LAYER_BITMAP_SIZE_X + 25; // Add bitmap width + margin between bitmap and text
m_LayerSelectionCtrl->SetColumnWidth( 0, ctrlWidth );
ctrlWidth += 25; // add small margin between text and window borders
// and room for vertical scroll bar
m_LayerSelectionCtrl->SetMinSize( wxSize( ctrlWidth, -1 ) );
}
示例5: Draw
void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDraw_mode, const wxPoint& aOffset )
{
int color = 0;
wxSize mask_margin; // margin (clearance) used for some non copper layers
#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
int showActualMaskSize = 0; /* Layer number if the actual pad size on mask layer can
* be displayed i.e. if only one layer is shown for this pad
* and this layer is a mask (solder mask or sloder paste
*/
#endif
if( m_Flags & DO_NOT_DRAW )
return;
PAD_DRAWINFO drawInfo;
drawInfo.m_Offset = aOffset;
/* We can show/hide pads from the layer manager.
* options are show/hide pads on front and/or back side of the board
* For through pads, we hide them only if both sides are hidden.
* smd pads on back are hidden for all layers (copper and technical layers)
* on back side of the board
* smd pads on front are hidden for all layers (copper and technical layers)
* on front side of the board
* ECO, edge and Draw layers and not considered
*/
// Mask layers for Back side of board
#define BACK_SIDE_LAYERS \
(LAYER_BACK | ADHESIVE_LAYER_BACK | SOLDERPASTE_LAYER_BACK \
| SILKSCREEN_LAYER_BACK | SOLDERMASK_LAYER_BACK)
// Mask layers for Front side of board
#define FRONT_SIDE_LAYERS \
(LAYER_FRONT | ADHESIVE_LAYER_FRONT | SOLDERPASTE_LAYER_FRONT \
| SILKSCREEN_LAYER_FRONT | SOLDERMASK_LAYER_FRONT)
BOARD* brd = GetBoard();
bool frontVisible = brd->IsElementVisible( PCB_VISIBLE( PAD_FR_VISIBLE ) );
bool backVisible = brd->IsElementVisible( PCB_VISIBLE( PAD_BK_VISIBLE ) );
if( !frontVisible && !backVisible )
return;
/* If pad are only on front side (no layer on back side)
* and if hide front side pads is enabled, do not draw
*/
if( !frontVisible && ( (m_layerMask & BACK_SIDE_LAYERS) == 0 ) )
return;
/* If pad are only on back side (no layer on front side)
* and if hide back side pads is enabled, do not draw
*/
if( !backVisible && ( (m_layerMask & FRONT_SIDE_LAYERS) == 0 ) )
return;
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) aPanel->GetParent();
PCB_SCREEN* screen = frame->GetScreen();
if( frame->m_DisplayPadFill == FILLED )
drawInfo.m_ShowPadFilled = true;
else
drawInfo.m_ShowPadFilled = false;
if( m_layerMask & LAYER_FRONT )
{
color = brd->GetVisibleElementColor( PAD_FR_VISIBLE );
}
if( m_layerMask & LAYER_BACK )
{
color |= brd->GetVisibleElementColor( PAD_BK_VISIBLE );
}
if( color == 0 ) /* Not on copper layer */
{
// If the pad in on only one tech layer, use the layer color else use DARKGRAY
int mask_non_copper_layers = m_layerMask & ~ALL_CU_LAYERS;
#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
mask_non_copper_layers &= brd->GetVisibleLayers();
#endif
switch( mask_non_copper_layers )
{
case 0:
break;
case ADHESIVE_LAYER_BACK:
color = brd->GetLayerColor( ADHESIVE_N_BACK );
break;
case ADHESIVE_LAYER_FRONT:
color = brd->GetLayerColor( ADHESIVE_N_FRONT );
break;
case SOLDERPASTE_LAYER_BACK:
color = brd->GetLayerColor( SOLDERPASTE_N_BACK );
#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
//.........这里部分代码省略.........
示例6: Draw
void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, const wxPoint& aOffset )
{
wxCHECK_RET( panel != NULL, wxT( "VIA::Draw panel cannot be NULL." ) );
int radius;
PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
int fillvia = 0;
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent();
PCB_SCREEN* screen = frame->GetScreen();
auto displ_opts = (PCB_DISPLAY_OPTIONS*)( frame->GetDisplayOptions() );
if( displ_opts->m_DisplayViaFill == FILLED )
fillvia = 1;
GRSetDrawMode( aDC, aDrawMode );
BOARD * brd = GetBoard();
COLOR4D color = frame->Settings().Colors().GetItemColor( LAYER_VIAS + GetViaType() );
if( brd->IsElementVisible( LAYER_VIAS + GetViaType() ) == false
&& !( aDrawMode & GR_HIGHLIGHT ) )
return;
// Only draw the via if at least one of the layers it crosses is being displayed
if( !( brd->GetVisibleLayers() & GetLayerSet() ).any() )
return;
if( displ_opts->m_ContrastModeDisplay )
{
if( !IsOnLayer( curr_layer ) )
color = COLOR4D( DARKDARKGRAY );
}
if( ( aDrawMode & GR_HIGHLIGHT ) && !( aDrawMode & GR_AND ) )
color.SetToLegacyHighlightColor();
color.a = 0.588;
radius = m_Width >> 1;
// for small via size on screen (radius < 4 pixels) draw a simplified shape
int radius_in_pixels = aDC->LogicalToDeviceXRel( radius );
bool fast_draw = false;
// Vias are drawn as a filled circle or a double circle. The hole will be drawn later
int drill_radius = GetDrillValue() / 2;
int inner_radius = radius - aDC->DeviceToLogicalXRel( 2 );
if( radius_in_pixels < MIN_VIA_DRAW_SIZE )
{
fast_draw = true;
fillvia = false;
}
if( fillvia )
{
GRFilledCircle( panel->GetClipBox(), aDC, m_Start + aOffset, radius, color );
}
else
{
GRCircle( panel->GetClipBox(), aDC, m_Start + aOffset, radius, 0, color );
if ( fast_draw )
return;
GRCircle( panel->GetClipBox(), aDC, m_Start + aOffset, inner_radius, 0, color );
}
if( fillvia )
{
bool blackpenstate = false;
if( screen->m_IsPrinting )
{
blackpenstate = GetGRForceBlackPenState();
GRForceBlackPen( false );
color = WHITE;
}
else
{
color = BLACK; // or DARKGRAY;
}
if( (aDrawMode & GR_XOR) == 0)
GRSetDrawMode( aDC, GR_COPY );
// Draw hole if the radius is > 1pixel.
if( aDC->LogicalToDeviceXRel( drill_radius ) > 1 )
GRFilledCircle( panel->GetClipBox(), aDC, m_Start.x + aOffset.x,
m_Start.y + aOffset.y, drill_radius, 0, color, color );
if( screen->m_IsPrinting )
GRForceBlackPen( blackpenstate );
}
else
{
//.........这里部分代码省略.........