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(); }
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(); }
void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled ) { BOARD* brd = myframe->GetBoard(); wxASSERT( aId > GAL_LAYER_ID_START && aId < GAL_LAYER_ID_END ); if( myframe->IsType( FRAME_PCB ) ) { // The layer visibility status is saved in the board file so set the board // modified state so the user has the option to save the changes. if( brd->IsElementVisible( static_cast<GAL_LAYER_ID>( aId ) ) != isEnabled ) myframe->OnModify(); } brd->SetElementVisibility( static_cast<GAL_LAYER_ID>( aId ), isEnabled ); EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas(); if( galCanvas && myframe->IsGalCanvasActive() ) { if( aId == LAYER_GRID ) { galCanvas->GetGAL()->SetGridVisibility( myframe->IsGridVisible() ); galCanvas->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); } else if( aId == LAYER_RATSNEST ) { // don't touch the layers. ratsnest is enabled on per-item basis. galCanvas->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); galCanvas->GetView()->SetLayerVisible( aId, true ); } else galCanvas->GetView()->SetLayerVisible( aId, isEnabled ); galCanvas->Refresh(); } myframe->GetCanvas()->Refresh(); }