本文整理汇总了C++中EDA_DRAW_PANEL_GAL类的典型用法代码示例。如果您正苦于以下问题:C++ EDA_DRAW_PANEL_GAL类的具体用法?C++ EDA_DRAW_PANEL_GAL怎么用?C++ EDA_DRAW_PANEL_GAL使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EDA_DRAW_PANEL_GAL类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetGalCanvas
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: wxASSERT
void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, COLOR4D aColor )
{
wxASSERT( aId > GAL_LAYER_ID_START && aId < GAL_LAYER_ID_END );
myframe->Settings().Colors().SetItemColor( static_cast<GAL_LAYER_ID>( aId ), aColor );
EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
if( galCanvas && myframe->IsGalCanvasActive() )
{
if( aId == LAYER_GRID )
galCanvas->GetGAL()->SetGridColor( aColor );
KIGFX::VIEW* view = galCanvas->GetView();
view->GetPainter()->GetSettings()->ImportLegacyColors( &myframe->Settings().Colors() );
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); // useful to update rastnest
view->UpdateLayerColor( aId );
// plated-through-holes don't have their own color; they use the background color
if( aId == LAYER_PCB_BACKGROUND )
view->UpdateLayerColor( LAYER_PADS_PLATEDHOLES );
galCanvas->ForceRefresh();
}
myframe->ReCreateHToolbar();
myframe->GetCanvas()->Refresh();
}
示例3: getView
int PCBNEW_CONTROL::ZoomFitScreen( const TOOL_EVENT& aEvent )
{
KIGFX::VIEW* view = getView();
EDA_DRAW_PANEL_GAL* galCanvas = m_frame->GetGalCanvas();
BOARD* board = getModel<BOARD>();
board->ComputeBoundingBox();
BOX2I boardBBox = board->ViewBBox();
VECTOR2D scrollbarSize = VECTOR2D( galCanvas->GetSize() - galCanvas->GetClientSize() );
VECTOR2D screenSize = view->ToWorld( galCanvas->GetClientSize(), false );
if( boardBBox.GetWidth() == 0 || boardBBox.GetHeight() == 0 )
{
// Empty view
view->SetScale( 17.0 ); // works fine for the standard worksheet frame
view->SetCenter( screenSize / 2.0 );
}
else
{
VECTOR2D vsize = boardBBox.GetSize();
double scale = view->GetScale() / std::max( fabs( vsize.x / screenSize.x ),
fabs( vsize.y / screenSize.y ) );
view->SetScale( scale );
view->SetCenter( boardBBox.Centre() );
}
// Take scrollbars into account
VECTOR2D worldScrollbarSize = view->ToWorld( scrollbarSize, false );
view->SetCenter( view->GetCenter() + worldScrollbarSize / 2.0 );
return 0;
}
示例4: GetGalCanvas
void PCB_BASE_FRAME::UseGalCanvas()
{
EDA_DRAW_FRAME::UseGalCanvas();
EDA_DRAW_PANEL_GAL* galCanvas = GetGalCanvas();
if( m_toolManager )
{
m_toolManager->SetEnvironment( m_Pcb, GetGalCanvas()->GetView(),
GetGalCanvas()->GetViewControls(), this );
}
SetBoard( m_Pcb );
if( m_toolManager )
m_toolManager->ResetTools( TOOL_BASE::GAL_SWITCH );
// Transfer latest current display options from legacy to GAL canvas:
auto painter = static_cast<KIGFX::PCB_PAINTER*>( galCanvas->GetView()->GetPainter() );
auto settings = painter->GetSettings();
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
settings->LoadDisplayOptions( displ_opts, ShowPageLimits() );
galCanvas->GetView()->RecacheAllItems();
galCanvas->SetEventDispatcher( m_toolDispatcher );
galCanvas->StartDrawing();
}
示例5: OnLayerVisible
void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal )
{
BOARD* brd = myframe->GetBoard();
LSET visibleLayers = brd->GetVisibleLayers();
visibleLayers.set( aLayer, isVisible );
brd->SetVisibleLayers( visibleLayers );
EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
if( galCanvas )
{
KIGFX::VIEW* view = galCanvas->GetView();
view->SetLayerVisible( aLayer, isVisible );
view->RecacheAllItems( true );
}
if( isFinal )
myframe->GetCanvas()->Refresh();
}
示例6: OnRenderEnable
void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
{
BOARD* brd = myframe->GetBoard();
brd->SetElementVisibility( aId, isEnabled );
EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
if( galCanvas )
{
if( aId == GRID_VISIBLE )
{
galCanvas->GetGAL()->SetGridVisibility( myframe->IsGridVisible() );
galCanvas->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
}
else
galCanvas->GetView()->SetLayerVisible( ITEM_GAL_LAYER( aId ), isEnabled );
}
if( galCanvas && myframe->IsGalCanvasActive() )
galCanvas->Refresh();
else
myframe->GetCanvas()->Refresh();
}
示例7: GetLayerMask
void PCB_LAYER_WIDGET::OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal )
{
BOARD* brd = myframe->GetBoard();
LAYER_MSK visibleLayers = brd->GetVisibleLayers();
if( isVisible )
visibleLayers |= GetLayerMask( aLayer );
else
visibleLayers &= ~GetLayerMask( aLayer );
brd->SetVisibleLayers( visibleLayers );
EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
if( galCanvas )
{
KIGFX::VIEW* view = galCanvas->GetView();
view->SetLayerVisible( aLayer, isVisible );
}
if( isFinal )
myframe->GetCanvas()->Refresh();
}
示例8: OnLayerVisible
void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal )
{
BOARD* brd = myframe->GetBoard();
LSET visibleLayers = brd->GetVisibleLayers();
if( visibleLayers.test( aLayer ) != isVisible )
{
visibleLayers.set( aLayer, isVisible );
brd->SetVisibleLayers( visibleLayers );
myframe->OnModify();
EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
if( galCanvas )
galCanvas->GetView()->SetLayerVisible( aLayer, isVisible );
}
if( isFinal )
myframe->GetCanvas()->Refresh();
}
示例9: GetActiveLayer
bool GERBVIEW_FRAME::Read_EXCELLON_File( const wxString& aFullFileName )
{
wxString msg;
int layerId = GetActiveLayer(); // current layer used in GerbView
GERBER_FILE_IMAGE_LIST* images = GetGerberLayout()->GetImagesList();
auto gerber_layer = images->GetGbrImage( layerId );
auto drill_layer = dynamic_cast<EXCELLON_IMAGE*>( gerber_layer );
if( gerber_layer && !drill_layer )
{
// The active layer contains old gerber data we have to clear
Erase_Current_DrawLayer( false );
}
if( drill_layer == nullptr )
{
drill_layer = new EXCELLON_IMAGE( layerId );
layerId = images->AddGbrImage( drill_layer, layerId );
}
if( layerId < 0 )
{
DisplayError( this, _( "No room to load file" ) );
return false;
}
// Read the Excellon drill file:
bool success = drill_layer->LoadFile( aFullFileName );
if( !success )
{
msg.Printf( _( "File %s not found" ), GetChars( aFullFileName ) );
DisplayError( this, msg );
return false;
}
// Display errors list
if( drill_layer->GetMessages().size() > 0 )
{
HTML_MESSAGE_BOX dlg( this, _( "Error reading EXCELLON drill file" ) );
dlg.ListSet( drill_layer->GetMessages() );
dlg.ShowModal();
}
if( success )
{
EDA_DRAW_PANEL_GAL* canvas = GetGalCanvas();
if( canvas )
{
KIGFX::VIEW* view = canvas->GetView();
for( GERBER_DRAW_ITEM* item = drill_layer->GetItemsList(); item; item = item->Next() )
{
view->Add( (KIGFX::VIEW_ITEM*) item );
}
}
}
return success;
}