Commit 91f85dd0 authored by Brian Sidebotham's avatar Brian Sidebotham
Browse files

* Merge Trunk

parents d4b94b9b e617c5e6
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1053,7 +1053,8 @@ void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event )
    if( fn.GetName() != NAMELESS_PROJECT )
    {
        // was: wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParametersList() );
        Prj().ConfigSave( Kiface().KifaceSearch(), GROUP_SCH, GetProjectFileParametersList() );
        Prj().ConfigSave( Kiface().KifaceSearch(), GROUP_SCH_EDITOR,
                          GetProjectFileParametersList() );
    }
}

+12 −11
Original line number Diff line number Diff line
@@ -60,11 +60,12 @@ void PNS_LINE_PLACER::setWorld ( PNS_NODE* aWorld )
}


void PNS_LINE_PLACER::AddVia( bool aEnabled, int aDiameter, int aDrill )
void PNS_LINE_PLACER::AddVia( bool aEnabled, int aDiameter, int aDrill, VIATYPE_T aType )
{
    m_viaDiameter = aDiameter;
    m_viaDrill = aDrill;
    m_placingVia = aEnabled;
    m_viaType = aType;
}


@@ -73,7 +74,7 @@ void PNS_LINE_PLACER::startPlacement( const VECTOR2I& aStart, int aNet, int aWid
    assert( m_world != NULL );
    
    m_direction = m_initial_direction;
    TRACE( 1, "world %p, intitial-direction %s layer %d\n",
    TRACE( 1, "world %p, initial-direction %s layer %d\n",
            m_world % m_direction.Format().c_str() % aLayer );
    m_head.SetNet( aNet );
    m_tail.SetNet( aNet );
@@ -379,8 +380,8 @@ bool PNS_LINE_PLACER::handleViaPlacement( PNS_LINE& aHead )
    if( !m_placingVia )
        return true;

    PNS_LAYERSET allLayers( 0, MAX_CU_LAYERS - 1 );
    PNS_VIA v( aHead.CPoint( -1 ), allLayers, m_viaDiameter, m_viaDrill, aHead.Net() );
    PNS_LAYERSET layers( Settings().GetLayerTop(), Settings().GetLayerBottom() );
    PNS_VIA v( aHead.CPoint( -1 ), layers, m_viaDiameter, m_viaDrill, aHead.Net(), m_viaType );

    VECTOR2I force;
    VECTOR2I lead = aHead.CPoint( -1 ) - aHead.CPoint( 0 );
@@ -439,8 +440,8 @@ bool PNS_LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead )
    }
    else if( m_placingVia && viaOk )
    {
        PNS_LAYERSET allLayers( 0, MAX_CU_LAYERS - 1 );
        PNS_VIA v1( walkFull.CPoint( -1 ), allLayers, m_viaDiameter, m_viaDrill );
        PNS_LAYERSET layers( Settings().GetLayerTop(), Settings().GetLayerBottom() );
        PNS_VIA v1( walkFull.CPoint( -1 ), layers, m_viaDiameter, m_viaDrill, -1, m_viaType );
        walkFull.AppendVia( v1 );
    }

@@ -464,8 +465,8 @@ bool PNS_LINE_PLACER::rhMarkObstacles( const VECTOR2I& aP, PNS_LINE& aNewHead )
    
    if( m_placingVia )
    {
        PNS_LAYERSET allLayers( 0, MAX_CU_LAYERS - 1 );
        PNS_VIA v1( m_head.CPoint( -1 ), allLayers, m_viaDiameter, m_viaDrill );
        PNS_LAYERSET layers( Settings().GetLayerTop(), Settings().GetLayerBottom() );
        PNS_VIA v1( m_head.CPoint( -1 ), layers, m_viaDiameter, m_viaDrill, -1, m_viaType );
        m_head.AppendVia( v1 );
    }

@@ -507,9 +508,9 @@ bool PNS_LINE_PLACER::rhShoveOnly ( const VECTOR2I& aP, PNS_LINE& aNewHead )

    if( m_placingVia )
    {
        PNS_LAYERSET allLayers( 0, MAX_CU_LAYERS - 1 );
        PNS_VIA v1( l.CPoint( -1 ), allLayers, m_viaDiameter, m_viaDrill );
        PNS_VIA v2( l2.CPoint( -1 ), allLayers, m_viaDiameter, m_viaDrill );
        PNS_LAYERSET layers( Settings().GetLayerTop(), Settings().GetLayerBottom() );
        PNS_VIA v1( l.CPoint( -1 ), layers, m_viaDiameter, m_viaDrill, -1, m_viaType );
        PNS_VIA v2( l2.CPoint( -1 ), layers, m_viaDiameter, m_viaDrill, -1, m_viaType );

        l.AppendVia( v1 );
        l2.AppendVia( v2 );
+5 −1
Original line number Diff line number Diff line
@@ -84,8 +84,9 @@ public:
     * @param aEnabled if true, a via is attached during placement
     * @param aDiameter diameter of the via
     * @param aDrill drill of the via
     * @param aType Type of the via
     */
    void AddVia( bool aEnabled, int aDiameter, int aDrill );
    void AddVia( bool aEnabled, int aDiameter, int aDrill, VIATYPE_T aType );

    /**
     * Function SetLayer()
@@ -386,6 +387,9 @@ private:
    ///> current via drill
    int m_viaDrill;
    
    ///> current via type
    VIATYPE_T m_viaType;

    ///> current track width
    int m_currentWidth;

+22 −2
Original line number Diff line number Diff line
@@ -895,12 +895,32 @@ void PNS_ROUTER::SwitchLayer( int aLayer )
}


void PNS_ROUTER::ToggleViaPlacement()
void PNS_ROUTER::ToggleViaPlacement(VIATYPE_T type)
{
    const int layercount = m_board->GetDesignSettings().GetCopperLayerCount();

    // Cannot place microvias or blind vias if not allowed (obvious)
    if( ( type == VIA_BLIND_BURIED ) && ( !m_board->GetDesignSettings().m_BlindBuriedViaAllowed ) )
        return;
    if( ( type == VIA_MICROVIA ) && ( !m_board->GetDesignSettings().m_MicroViasAllowed ) )
        return;
    
    //Can only place through vias on 2-layer boards
    if( ( type != VIA_THROUGH ) && ( layercount <= 2 ) )
        return;
    
    //Can only place microvias if we're on an outer layer, or directly adjacent to one
    if( ( type == VIA_MICROVIA ) && ( m_currentLayer > In1_Cu ) && ( m_currentLayer < layercount-2 ) )
        return;
    
    //Cannot place blind vias with front/back as the layer pair, this doesn't make sense
    if( ( type == VIA_BLIND_BURIED ) && ( Settings().GetLayerTop() == F_Cu ) && ( Settings().GetLayerBottom() == B_Cu ) )
        return;
    
    if( m_state == ROUTE_TRACK )
    {
        m_placingVia = !m_placingVia;
        m_placer->AddVia( m_placingVia, m_settings.GetViaDiameter(), m_settings.GetViaDrill() );
        m_placer->AddVia( m_placingVia, m_settings.GetViaDiameter(), m_settings.GetViaDrill(), type );
    }
}

+9 −9
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ public:

    void SwitchLayer( int layer );

    void ToggleViaPlacement();
    void ToggleViaPlacement( VIATYPE_T type = VIA_NOT_DEFINED );

    int GetCurrentLayer() const;
    int GetCurrentNet() const;
Loading