Commit 3bb1764d authored by dickelbeck's avatar dickelbeck
Browse files

delete track uses dirty rect

parent 920ea810
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ email address.
2008-Mar-10 UPDATE   Dick Hollenbeck <dick@softplc.com>
================================================================================
+pcbnew
  * Improved some comments on new functions.
  * Improved some comments on new functions dirty area functions
  * Changed
    void    ConvertPcbUnitsToPixelsUnits( EDA_Rect& aRect ); to
    void    ConvertPcbUnitsToPixelsUnits( EDA_Rect* aRect );
@@ -21,6 +21,9 @@ email address.
  * Changed from "new wxDCClip()" to use an automatic wxDCClip() variable in
    drawpanel.cpp
  * Removed a printf() from "release" build of drawpanel.cpp
  * Added WinEDA_DrawPanel::PostDirtyRect()
  * Renamed Supprime_Une_Piste() to Remove_One_Track() and it now uses
    PostDirtyRect().


2008-Mar-10 UPDATE  Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
+12 −0
Original line number Diff line number Diff line
@@ -96,6 +96,18 @@ public:
    wxPoint CursorRealPosition( const wxPoint& ScreenPos );
    wxPoint CursorScreenPosition();

    /**
     * Function PostDirtyRect
     * appends the given rectangle in pcb units to the DrawPanel's invalid
     * region list so that very soon (but not immediately), this rectangle
     * along with any other recently posted rectangles is redrawn.  Conversion
     * to pixels is done in here.
     * @param aRect The rectangle to append, it must be orthogonal
     *   (vertical and horizontal edges only), and it must be [,) in nature, i.e.
     *   [pos, dim) == [inclusive, exclusive)
     */
    void    PostDirtyRect( EDA_Rect aRect );

    /**
     * Function ConvertPcbUnitsToPixelsUnits
     * converts pos and size of the given EDA_Rect to pos and size in pixels,
+2 −2
Original line number Diff line number Diff line
@@ -476,7 +476,7 @@ public:
    TRACK*              Delete_Segment( wxDC* DC, TRACK* Track );
    void                Delete_Track( wxDC* DC, TRACK* Track );
    void                Delete_net( wxDC* DC, TRACK* Track );
    void                Supprime_Une_Piste( wxDC* DC, TRACK* pt_segm );
    void                Remove_One_Track( wxDC* DC, TRACK* pt_segm );
    bool                Resize_Pistes_Vias( wxDC* DC, bool Track, bool Via );
    void                Edit_Net_Width( wxDC* DC, int Netcode );
    void                Edit_Track_Width( wxDC* DC, TRACK* Track );
+30 −39
Original line number Diff line number Diff line
@@ -210,11 +210,37 @@ EDA_Rect TRACK::GetBoundingBox() const
    // end of track is round, this is its radius, rounded up
    int radius = ( m_Width+1 )/2;

    int ymax = MAX( m_Start.y, m_End.y );
    int xmax = MAX( m_Start.x, m_End.x );
    int ymax;
    int xmax;

    int ymin = MIN( m_Start.y, m_End.y );
    int xmin = MIN( m_Start.x, m_End.x );
    int ymin;
    int xmin;

    if( Type() == TYPEVIA )
    {
        // because vias are sometimes drawn larger than their m_Width would
        // provide, erasing them using a dirty rect must also compensate for
        // possibility (that the via is larger than its m_Width would provide).
        // because it is cheap to return a larger BoundingBox, do it so that
        // the via gets erased properly.  Do not divide width by 2 for this reason.
        radius = m_Width;

        ymax = m_Start.y;
        xmax = m_Start.x;

        ymin = m_Start.y;
        xmin = m_Start.x;
    }
    else
    {
        radius = ( m_Width+1 )/2;

        ymax = MAX( m_Start.y, m_End.y );
        xmax = MAX( m_Start.x, m_End.x );

        ymin = MIN( m_Start.y, m_End.y );
        xmin = MIN( m_Start.x, m_End.x );
    }

    ymax += radius;
    xmax += radius;
@@ -890,39 +916,6 @@ void TRACK::Display_Infos( WinEDA_DrawFrame* frame )
 */
bool TRACK::HitTest( const wxPoint& ref_pos )
{
#if 0
    int l_piste;          /* demi-largeur de la piste */
    int dx, dy, spot_cX, spot_cY;
    int ux0, uy0;

    /* calcul des coordonnees du segment teste */
    l_piste = m_Width >> 1;  /* l_piste = demi largeur piste */

    ux0 = m_Start.x;
    uy0 = m_Start.y;         /* coord de depart */

    dx = m_End.x;
    dy = m_End.y;            /* coord d'arrivee */

    /* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
    dx -= ux0;
    dy -= uy0;

    spot_cX = ref_pos.x - ux0;
    spot_cY = ref_pos.y - uy0;

    if( Type() == TYPEVIA )   /* VIA rencontree */
    {
        return (double) spot_cX * spot_cX + (double) spot_cY * spot_cY <=
                (double) l_piste * l_piste;
    }
    else
    {
        if( DistanceTest( l_piste, dx, dy, spot_cX, spot_cY ) )
            return true;
    }
#else

    int radius = m_Width >> 1;

    // (dx, dy) is a vector from m_Start to m_End (an origin of m_Start)
@@ -944,8 +937,6 @@ bool TRACK::HitTest( const wxPoint& ref_pos )
            return true;
    }

#endif

    return false;
}

+140 −140
Original line number Diff line number Diff line
@@ -792,7 +792,7 @@ int Netliste_Controle_piste( WinEDA_PcbFrame* frame, wxDC* DC, int affiche )
            oldpercent = -1;
            frame->m_Pcb->m_Status_Pcb = 0;

            frame->Supprime_Une_Piste( DC, segment );
            frame->Remove_One_Track( DC, segment );

            next = frame->m_Pcb->m_Track;  /* NextS a peut etre ete efface */
            if( affiche )
Loading