Commit f068c0d9 authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Pcbnew: Autoplace functions: renamed spread footprint functions. Rewritten.

Now footprints, after loaded by reading a netlist are grouped by sheets by the footprints spread function, and the grouping is better.
Rename 2 files. Fix minor issues. Clean code
parent 251f0c7f
Loading
Loading
Loading
Loading
+0 −2
Original line number Original line Diff line number Diff line
@@ -228,8 +228,6 @@ void EDA_3D_CANVAS::SetView3D( int keycode )


void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent& event )
void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent& event )
{
{
    wxSize size( GetClientSize() );

    if( event.ShiftDown() )
    if( event.ShiftDown() )
    {
    {
        if( event.GetWheelRotation() < 0 )
        if( event.GetWheelRotation() < 0 )
+18 −2
Original line number Original line Diff line number Diff line
@@ -906,11 +906,22 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
    bool offCenterReq = event.ControlDown() && event.ShiftDown();
    bool offCenterReq = event.ControlDown() && event.ShiftDown();
    offCenterReq = offCenterReq || m_enableZoomNoCenter;
    offCenterReq = offCenterReq || m_enableZoomNoCenter;


#if wxMAJOR_VERSION >= 2 && wxMINOR_VERSION >= 9
    int axis = event.GetWheelAxis();
#else
    const int axis = 0;
#endif

    // This is a zoom in or out command
    // This is a zoom in or out command
    if( event.GetWheelRotation() > 0 )
    if( event.GetWheelRotation() > 0 )
    {
    {
        if( event.ShiftDown() && !event.ControlDown() )
        if( event.ShiftDown() && !event.ControlDown() )
        {
            if( axis == 0 )
                cmd.SetId( ID_PAN_UP );
                cmd.SetId( ID_PAN_UP );
            else
                cmd.SetId( ID_PAN_RIGHT );
        }
        else if( event.ControlDown() && !event.ShiftDown() )
        else if( event.ControlDown() && !event.ShiftDown() )
            cmd.SetId( ID_PAN_LEFT );
            cmd.SetId( ID_PAN_LEFT );
        else if( offCenterReq )
        else if( offCenterReq )
@@ -921,7 +932,12 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
    else if( event.GetWheelRotation() < 0 )
    else if( event.GetWheelRotation() < 0 )
    {
    {
        if( event.ShiftDown() && !event.ControlDown() )
        if( event.ShiftDown() && !event.ControlDown() )
        {
            if( axis == 0 )
                cmd.SetId( ID_PAN_DOWN );
                cmd.SetId( ID_PAN_DOWN );
            else
                cmd.SetId( ID_PAN_LEFT );
        }
        else if( event.ControlDown() && !event.ShiftDown() )
        else if( event.ControlDown() && !event.ShiftDown() )
            cmd.SetId( ID_PAN_RIGHT );
            cmd.SetId( ID_PAN_RIGHT );
        else if( offCenterReq )
        else if( offCenterReq )
+12 −2
Original line number Original line Diff line number Diff line
@@ -1494,7 +1494,7 @@ public:




    // Autoplacement:
    // Autoplacement:
    void AutoPlace( wxCommandEvent& event );
    void OnPlaceOrRouteFootprints( wxCommandEvent& event );


    /**
    /**
     * Function ScriptingConsoleEnableDisable
     * Function ScriptingConsoleEnableDisable
@@ -1520,7 +1520,17 @@ public:
     */
     */
    bool ReOrientModules( const wxString& ModuleMask, double Orient, bool include_fixe );
    bool ReOrientModules( const wxString& ModuleMask, double Orient, bool include_fixe );
    void LockModule( MODULE* aModule, bool aLocked );
    void LockModule( MODULE* aModule, bool aLocked );
    void AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb );

    /**
     * Function SpreadFootprints
     * Footprints (after loaded by reading a netlist for instance) are moved
     * to be in a small free area (outside the current board) without overlapping.
     * @param aFootprintsOutsideBoardOnly: true to move only
     * footprints outside the board outlines
     * (they are outside if the position of a footprint is outside
     * the board outlines bounding box
     */
    void SpreadFootprints( bool aFootprintsOutsideBoardOnly );


    /**
    /**
     * Function AutoPlaceModule
     * Function AutoPlaceModule
+4 −2
Original line number Original line Diff line number Diff line
@@ -124,12 +124,14 @@ set( PCBNEW_IMPORT_DXF
    )
    )


set( PCBNEW_AUTOROUTER_SRCS
set( PCBNEW_AUTOROUTER_SRCS
    autorouter/automove.cpp
    autorouter/rect_placement/rect_placement.cpp
    autorouter/autoplac.cpp
    autorouter/move_and_route_event_functions.cpp
    autorouter/auto_place_footprints.cpp
    autorouter/autorout.cpp
    autorouter/autorout.cpp
    autorouter/routing_matrix.cpp
    autorouter/routing_matrix.cpp
    autorouter/dist.cpp
    autorouter/dist.cpp
    autorouter/queue.cpp
    autorouter/queue.cpp
    autorouter/spread_footprints.cpp
    autorouter/solve.cpp
    autorouter/solve.cpp
    autorouter/graphpcb.cpp
    autorouter/graphpcb.cpp
    autorouter/work.cpp
    autorouter/work.cpp
+2 −2
Original line number Original line Diff line number Diff line
@@ -1085,7 +1085,7 @@ static bool Tri_PlaceModules( MODULE* ref, MODULE* compare )
}
}




static bool Tri_RatsModules( MODULE* ref, MODULE* compare )
static bool sortFootprintsByRatsnestSize( MODULE* ref, MODULE* compare )
{
{
    double ff1, ff2;
    double ff1, ff2;


@@ -1141,7 +1141,7 @@ static MODULE* PickModule( PCB_EDIT_FRAME* pcbframe, wxDC* DC )


    pcbframe->GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK;
    pcbframe->GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK;


    sort( moduleList.begin(), moduleList.end(), Tri_RatsModules );
    sort( moduleList.begin(), moduleList.end(), sortFootprintsByRatsnestSize );


    // Search for "best" module.
    // Search for "best" module.
    MODULE* bestModule  = NULL;
    MODULE* bestModule  = NULL;
Loading