本文整理汇总了C++中kigfx::PCB_PAINTER类的典型用法代码示例。如果您正苦于以下问题:C++ PCB_PAINTER类的具体用法?C++ PCB_PAINTER怎么用?C++ PCB_PAINTER使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PCB_PAINTER类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnTogglePadDrawMode
void PCB_BASE_FRAME::OnTogglePadDrawMode( wxCommandEvent& aEvent )
{
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
displ_opts->m_DisplayPadFill = !displ_opts->m_DisplayPadFill;
EDA_DRAW_PANEL_GAL* gal = GetGalCanvas();
if( gal )
{
// Apply new display options to the GAL canvas
KIGFX::PCB_PAINTER* painter =
static_cast<KIGFX::PCB_PAINTER*> ( gal->GetView()->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings =
static_cast<KIGFX::PCB_RENDER_SETTINGS*> ( painter->GetSettings() );
settings->LoadDisplayOptions( displ_opts );
// Update pads
BOARD* board = GetBoard();
for( MODULE* module = board->m_Modules; module; module = module->Next() )
{
for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() )
pad->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
}
}
m_canvas->Refresh();
}
示例2: ZoneDisplayMode
int PCBNEW_CONTROL::ZoneDisplayMode( const TOOL_EVENT& aEvent )
{
KIGFX::PCB_PAINTER* painter =
static_cast<KIGFX::PCB_PAINTER*>( m_frame->GetGalCanvas()->GetView()->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings =
static_cast<KIGFX::PCB_RENDER_SETTINGS*>( painter->GetSettings() );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_frame->GetDisplayOptions();
// Apply new display options to the GAL canvas
if( aEvent.IsAction( &COMMON_ACTIONS::zoneDisplayEnable ) )
displ_opts->m_DisplayZonesMode = 0;
else if( aEvent.IsAction( &COMMON_ACTIONS::zoneDisplayDisable ) )
displ_opts->m_DisplayZonesMode = 1;
else if( aEvent.IsAction( &COMMON_ACTIONS::zoneDisplayOutlines ) )
displ_opts->m_DisplayZonesMode = 2;
else
assert( false );
settings->LoadDisplayOptions( displ_opts );
BOARD* board = getModel<BOARD>();
for( int i = 0; i < board->GetAreaCount(); ++i )
board->GetArea( i )->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
m_frame->GetGalCanvas()->Refresh();
return 0;
}
示例3: TransferDataFromWindow
/*
* Update variables with new options
*/
bool PANEL_PCBNEW_DISPLAY_OPTIONS::TransferDataFromWindow()
{
PCB_DISPLAY_OPTIONS* displ_opts = (PCB_DISPLAY_OPTIONS*) m_frame->GetDisplayOptions();
displ_opts->m_ShowTrackClearanceMode = UTIL::GetValFromConfig(
traceClearanceSelectMap, m_OptDisplayTracksClearance->GetSelection() );
displ_opts->m_DisplayPadIsol = m_OptDisplayPadClearence->GetValue();
displ_opts->m_DisplayPadNum = m_OptDisplayPadNumber->GetValue();
m_frame->SetElementVisibility( LAYER_NO_CONNECTS, m_OptDisplayPadNoConn->GetValue() );
displ_opts->m_DisplayNetNamesMode = m_ShowNetNamesOption->GetSelection();
displ_opts->m_DisplayRatsnestLinesCurved = m_OptDisplayCurvedRatsnestLines->GetValue();
m_galOptsPanel->TransferDataFromWindow();
// Apply changes to the GAL
KIGFX::VIEW* view = m_frame->GetGalCanvas()->GetView();
KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( view->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings = painter->GetSettings();
settings->LoadDisplayOptions( displ_opts, m_frame->ShowPageLimits() );
view->RecacheAllItems();
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
m_frame->GetCanvas()->Refresh();
return true;
}
示例4: SyncLayerAlphaIndicators
void PCB_LAYER_WIDGET::SyncLayerAlphaIndicators()
{
int count = GetLayerRowCount();
TOOL_MANAGER* mgr = myframe->GetToolManager();
KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( mgr->GetView()->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings = painter->GetSettings();
for( int row = 0; row < count; ++row )
{
// this utilizes more implementation knowledge than ideal, eventually
// add member ROW getRow() or similar to base LAYER_WIDGET.
wxWindow* w = getLayerComp( row, COLUMN_ICON_ACTIVE );
PCB_LAYER_ID layerId = ToLAYER_ID( getDecodedId( w->GetId() ) );
KIGFX::COLOR4D screenColor = settings->GetLayerColor( layerId );
COLOR_SWATCH* swatch = static_cast<COLOR_SWATCH*>( getLayerComp( row, COLUMN_COLORBM ) );
KIGFX::COLOR4D layerColor = swatch->GetSwatchColor();
INDICATOR_ICON* indicator = static_cast<INDICATOR_ICON*>( getLayerComp( row, COLUMN_ALPHA_INDICATOR ) );
if( std::abs( screenColor.a - layerColor.a ) > ALPHA_EPSILON )
{
if( screenColor.a < layerColor.a )
indicator->SetIndicatorState( ROW_ICON_PROVIDER::STATE::DOWN );
else
indicator->SetIndicatorState( ROW_ICON_PROVIDER::STATE::UP );
}
else
indicator->SetIndicatorState( ROW_ICON_PROVIDER::STATE::OFF );
}
}
示例5: OnTogglePadDrawMode
void PCB_BASE_FRAME::OnTogglePadDrawMode( wxCommandEvent& aEvent )
{
m_DisplayPadFill = DisplayOpt.DisplayPadFill = !m_DisplayPadFill;
// Apply new display options to the GAL canvas
KIGFX::PCB_PAINTER* painter =
static_cast<KIGFX::PCB_PAINTER*> ( GetGalCanvas()->GetView()->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings =
static_cast<KIGFX::PCB_RENDER_SETTINGS*> ( painter->GetSettings() );
settings->LoadDisplayOptions( DisplayOpt );
GetGalCanvas()->GetView()->RecacheAllItems( true );
m_canvas->Refresh();
}
示例6: HighContrastMode
int PCBNEW_CONTROL::HighContrastMode( const TOOL_EVENT& aEvent )
{
KIGFX::PCB_PAINTER* painter =
static_cast<KIGFX::PCB_PAINTER*>( m_frame->GetGalCanvas()->GetView()->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings =
static_cast<KIGFX::PCB_RENDER_SETTINGS*> ( painter->GetSettings() );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_frame->GetDisplayOptions();
displ_opts->m_ContrastModeDisplay = !displ_opts->m_ContrastModeDisplay;
settings->LoadDisplayOptions( displ_opts );
m_frame->GetGalCanvas()->SetHighContrastLayer( m_frame->GetActiveLayer() );
return 0;
}
示例7: LayerAlphaDec
int PCBNEW_CONTROL::LayerAlphaDec( const TOOL_EVENT& aEvent )
{
KIGFX::PCB_PAINTER* painter =
static_cast<KIGFX::PCB_PAINTER*>( m_frame->GetGalCanvas()->GetView()->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings =
static_cast<KIGFX::PCB_RENDER_SETTINGS*> ( painter->GetSettings() );
LAYER_NUM currentLayer = m_frame->GetActiveLayer();
KIGFX::COLOR4D currentColor = settings->GetLayerColor( currentLayer );
if( currentColor.a >= 0.05 )
{
currentColor.a -= 0.05;
settings->SetLayerColor( currentLayer, currentColor );
m_frame->GetGalCanvas()->GetView()->UpdateLayerColor( currentLayer );
}
return 0;
}
示例8: ViaDisplayMode
int PCBNEW_CONTROL::ViaDisplayMode( const TOOL_EVENT& aEvent )
{
KIGFX::PCB_PAINTER* painter =
static_cast<KIGFX::PCB_PAINTER*>( m_frame->GetGalCanvas()->GetView()->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings =
static_cast<KIGFX::PCB_RENDER_SETTINGS*>( painter->GetSettings() );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_frame->GetDisplayOptions();
// Apply new display options to the GAL canvas
displ_opts->m_DisplayViaFill = !displ_opts->m_DisplayViaFill;
settings->LoadDisplayOptions( displ_opts );
for( TRACK* track = getModel<BOARD>()->m_Track; track; track = track->Next() )
{
if( track->Type() == PCB_VIA_T )
track->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
}
m_frame->GetGalCanvas()->Refresh();
return 0;
}
示例9: PadDisplayMode
int PCBNEW_CONTROL::PadDisplayMode( const TOOL_EVENT& aEvent )
{
KIGFX::PCB_PAINTER* painter =
static_cast<KIGFX::PCB_PAINTER*>( m_frame->GetGalCanvas()->GetView()->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings =
static_cast<KIGFX::PCB_RENDER_SETTINGS*>( painter->GetSettings() );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_frame->GetDisplayOptions();
// Apply new display options to the GAL canvas
displ_opts->m_DisplayPadFill = !displ_opts->m_DisplayPadFill;
settings->LoadDisplayOptions( displ_opts );
for( MODULE* module = getModel<BOARD>()->m_Modules; module; module = module->Next() )
{
for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() )
pad->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
}
m_frame->GetGalCanvas()->Refresh();
return 0;
}
示例10: OnOkClick
/* Update variables with new options
*/
void DIALOG_DISPLAY_OPTIONS::OnOkClick(wxCommandEvent& event)
{
if ( m_Show_Page_Limits->GetSelection() == 0 )
m_Parent->SetShowPageLimits( true );
else
m_Parent->SetShowPageLimits( false );
if ( m_OptDisplayTracks->GetSelection() == 1 )
DisplayOpt.DisplayPcbTrackFill = true;
else
DisplayOpt.DisplayPcbTrackFill = false;
m_Parent->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
DisplayOpt.m_DisplayViaMode = (VIA_DISPLAY_MODE_T) m_OptDisplayViaHole->GetSelection();
switch ( m_OptDisplayTracksClearance->GetSelection() )
{
case 0:
DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
break;
case 1:
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS;
break;
case 2:
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS;
break;
case 3:
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS;
break;
case 4:
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS;
break;
}
m_Parent->m_DisplayModText = DisplayOpt.DisplayModText = m_OptDisplayModTexts->GetSelection();
m_Parent->m_DisplayModEdge = DisplayOpt.DisplayModEdge = m_OptDisplayModEdges->GetSelection();
if (m_OptDisplayPads->GetSelection() == 1 )
DisplayOpt.DisplayPadFill = true;
else
DisplayOpt.DisplayPadFill = false;
if (m_OptDisplayVias->GetSelection() == 1 )
DisplayOpt.DisplayViaFill = true;
else
DisplayOpt.DisplayViaFill = false;
m_Parent->m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_Parent->m_DisplayViaFill = DisplayOpt.DisplayViaFill;
DisplayOpt.DisplayPadIsol = m_OptDisplayPadClearence->GetValue();
m_Parent->m_DisplayPadNum = DisplayOpt.DisplayPadNum = m_OptDisplayPadNumber->GetValue();
m_Parent->SetElementVisibility( PCB_VISIBLE(NO_CONNECTS_VISIBLE),
m_OptDisplayPadNoConn->GetValue() );
DisplayOpt.DisplayDrawItems = m_OptDisplayDrawings->GetSelection();
DisplayOpt.DisplayNetNamesMode = m_ShowNetNamesOption->GetSelection();
// Apply changes to the GAL
KIGFX::VIEW* view = m_Parent->GetGalCanvas()->GetView();
KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( view->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings =
static_cast<KIGFX::PCB_RENDER_SETTINGS*>( painter->GetSettings() );
settings->LoadDisplayOptions( DisplayOpt );
view->RecacheAllItems( true );
m_Parent->GetCanvas()->Refresh();
EndModal( 1 );
}