bool DIALOG_SWAP_LAYERS::TransferDataToWindow()
{
    LSET enabledCopperLayers = LSET::AllCuMask( m_parent->GetBoard()->GetCopperLayerCount() );
    int row = 0;

    for( size_t layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
    {
        if( enabledCopperLayers.test( layer ) )
        {
            auto attr = new wxGridCellAttr;
            attr->SetRenderer( new GRID_CELL_LAYER_RENDERER( m_parent ) );
            attr->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_MENU ) );
            attr->SetReadOnly();
            m_grid->SetAttr( row, 0, attr );

            attr = new wxGridCellAttr;
            attr->SetRenderer( new GRID_CELL_LAYER_RENDERER( m_parent ) );
            attr->SetEditor( new GRID_CELL_LAYER_SELECTOR( m_parent, LSET::AllNonCuMask() ) );
            m_grid->SetAttr( row, 1, attr );

            m_grid->GetTable()->SetValueAsLong( row, 0, (long) layer );
            m_grid->GetTable()->SetValueAsLong( row, 1, (long) layer );

            ++row;
        }
    }

    return true;
}
bool DIALOG_SWAP_LAYERS::TransferDataFromWindow()
{
    if( !m_grid->CommitPendingChanges() )
        return false;

    LSET enabledCopperLayers = LSET::AllCuMask( m_parent->GetBoard()->GetCopperLayerCount() );
    wxGridTableBase* table = m_grid->GetTable();
    int row = 0;

    for( size_t layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
    {
        if( enabledCopperLayers.test( layer ) )
            m_layerDestinations[ layer ] = (PCB_LAYER_ID) table->GetValueAsLong( row++, 1 );
        else
            m_layerDestinations[ layer ] = (PCB_LAYER_ID) layer;
    }

    return true;
}
Пример #3
0
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();
}
Пример #4
0
bool PCB_LAYER_WIDGET::isLayerAllowedInFpMode( PCB_LAYER_ID aLayer )
{
    static LSET allowed = LSET::AllTechMask();
    allowed.set( F_Cu ).set( B_Cu );
    return allowed.test( aLayer );
}