Commit 4195d71f authored by CHARRAS's avatar CHARRAS
Browse files

Bugs about fill zones and block delete removed

parent 8237a9eb
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -4,6 +4,14 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
Please add newer entries at the top, list the date and your name with
email address.
email address.



2008-Jan-24 UPDATE  Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+pcbnew:
	Bugs about fill zones removed (not all, of course).
	Fixed an old bug in block delete (could crashes pcbnew after deleting footprints).


2008-Jan-23 UPDATE   Dick Hollenbeck <dick@softplc.com>
2008-Jan-23 UPDATE   Dick Hollenbeck <dick@softplc.com>
================================================================================
================================================================================
+pcbnew:
+pcbnew:
+17 −7
Original line number Original line Diff line number Diff line
@@ -203,31 +203,41 @@ void DisplayBoard( WinEDA_DrawPanel* panel, wxDC* DC )
    int dcell0, dcell1 = 0, color;
    int dcell0, dcell1 = 0, color;
    int maxi;
    int maxi;


    maxi = ( /*ActiveScreen->Lim_XD - 20*/ 500) / Ncols;
    maxi = 600 / Ncols;
    maxi = (maxi * 3 ) / 4;
    maxi = (maxi * 3 ) / 4;
    if( !maxi )
    if( !maxi )
        maxi = 1;
        maxi = 1;


    GRSetDrawMode( DC, GR_COPY );
    for( col = 0; col < Ncols; col++ )
    for( col = 0; col < Ncols; col++ )
    {
    {
        for( row = 0; row < Nrows; row++ )
        for( row = 0; row < Nrows; row++ )
        {
        {
            color  = 0;
            color  = 0;
            dcell0 = GetCell( row, col, BOTTOM ); if( dcell0 & HOLE )
            dcell0 = GetCell( row, col, BOTTOM );
			if( dcell0 & HOLE )
                color = GREEN;
                color = GREEN;
            if( Nb_Sides )
//            if( Nb_Sides )
                dcell1 = GetCell( row, col, TOP );
//                dcell1 = GetCell( row, col, TOP );
            if( dcell1 & HOLE )
            if( dcell1 & HOLE )
                color |= RED;
                color |= RED;
            dcell0 |= dcell1;
//            dcell0 |= dcell1;
            if( !color && (dcell0 & VIA_IMPOSSIBLE) )
            if( !color && (dcell0 & VIA_IMPOSSIBLE) )
                color = BLUE;
                color = BLUE;
            if( color )
			if( dcell0 & CELL_is_EDGE )
                color = YELLOW;
			else if( dcell0 & CELL_is_ZONE )
                color = YELLOW;
			
			#define DRAW_OFFSET_X -20
			#define DRAW_OFFSET_Y 20
//            if( color )
            {
            {
                for( i = 0; i < maxi; i++ )
                for( i = 0; i < maxi; i++ )
                    for( j = 0; j < maxi; j++ )
                    for( j = 0; j < maxi; j++ )
                        GRSPutPixel( &panel->m_ClipBox, DC,
                        GRSPutPixel( &panel->m_ClipBox, DC,
                                     (col * maxi) + i + 10, (row * maxi) + 60 + j, color );
                                     (col * maxi) + i + DRAW_OFFSET_X,
									 (row * maxi) + j + DRAW_OFFSET_Y, color );


            }
            }
        }
        }
+6 −0
Original line number Original line Diff line number Diff line
@@ -579,6 +579,12 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
    DrawPanel->Refresh( TRUE );
    DrawPanel->Refresh( TRUE );
    if( g_Show_Ratsnest )
    if( g_Show_Ratsnest )
        Compile_Ratsnest( DC, TRUE );
        Compile_Ratsnest( DC, TRUE );
	else
	{
	    m_Pcb->m_Status_Pcb = 0;        /* we need (later) a full ratnest computation */
		build_liste_pads();
	}

}
}




+17 −7
Original line number Original line Diff line number Diff line
@@ -367,6 +367,7 @@ bool ZONE_CONTAINER::HitTest( const wxPoint& refPos )
/**
/**
 * Function HitTestForCorner
 * Function HitTestForCorner
 * tests if the given wxPoint near a corner, or near the segment define by 2 corners.
 * tests if the given wxPoint near a corner, or near the segment define by 2 corners.
 * Choose the nearest corner
 * "near" means CORNER_MIN_DIST_IN_PIXELS pixels
 * "near" means CORNER_MIN_DIST_IN_PIXELS pixels
 * @return -1 if none, corner index in .corner <vector>
 * @return -1 if none, corner index in .corner <vector>
 * @param refPos : A wxPoint to test
 * @param refPos : A wxPoint to test
@@ -374,27 +375,32 @@ bool ZONE_CONTAINER::HitTest( const wxPoint& refPos )
int ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
int ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
{
{
	#define CORNER_MIN_DIST 500		// distance (in internal units) to detect a corner in a zone outline
	#define CORNER_MIN_DIST 500		// distance (in internal units) to detect a corner in a zone outline
    int dist;
    int dist, min_dist;
	unsigned item_pos, lim;
	unsigned item_pos, lim;
	lim = m_Poly->corner.size();
	lim = m_Poly->corner.size();
	m_CornerSelection = -1;
	m_CornerSelection = -1;
	
	
	min_dist = CORNER_MIN_DIST;
	for ( item_pos = 0; item_pos < lim; item_pos++ )
	for ( item_pos = 0; item_pos < lim; item_pos++ )
	{
	{
		dist = abs( m_Poly->corner[item_pos].x - refPos.x ) + abs( m_Poly->corner[item_pos].y - refPos.y );
		dist = abs( m_Poly->corner[item_pos].x - refPos.x ) + abs( m_Poly->corner[item_pos].y - refPos.y );
		if( dist <= CORNER_MIN_DIST )
		if( dist <= min_dist )
		{
		{
			m_CornerSelection = item_pos;
			m_CornerSelection = item_pos;
			return item_pos;
			min_dist = dist;
		}
		}
	}
	}


	if ( m_CornerSelection >= 0 )
		return item_pos;

    return -1;
    return -1;
}
}


/**
/**
 * Function HitTestForEdge
 * Function HitTestForEdge
 * tests if the given wxPoint near a corner, or near the segment define by 2 corners.
 * tests if the given wxPoint near a corner, or near the segment define by 2 corners.
 * choose the nearest segment
 * "near" means EDGE_MIN_DIST_IN_PIXELS pixels
 * "near" means EDGE_MIN_DIST_IN_PIXELS pixels
 * @return -1 if none,  or index of the starting corner in .corner <vector>
 * @return -1 if none,  or index of the starting corner in .corner <vector>
 * @param refPos : A wxPoint to test
 * @param refPos : A wxPoint to test
@@ -402,13 +408,14 @@ int ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
int ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos )
int ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos )
{
{
	#define EDGE_MIN_DIST 200	// distance (in internal units) to detect a zone outline
	#define EDGE_MIN_DIST 200	// distance (in internal units) to detect a zone outline
    int dist;
    int dist, min_dist;
	unsigned item_pos, lim;
	unsigned item_pos, lim;
	lim = m_Poly->corner.size();
	lim = m_Poly->corner.size();


    /* Test for an entire segment */
    /* Test for an entire segment */
    unsigned first_corner_pos = 0, end_segm;
    unsigned first_corner_pos = 0, end_segm;
	m_CornerSelection = -1;
	m_CornerSelection = -1;
	min_dist = EDGE_MIN_DIST;


	for ( item_pos = 0; item_pos < lim; item_pos++ )
	for ( item_pos = 0; item_pos < lim; item_pos++ )
	{
	{
@@ -431,13 +438,16 @@ int ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos )
													m_Poly->corner[item_pos].y,
													m_Poly->corner[item_pos].y,
													m_Poly->corner[end_segm].x,
													m_Poly->corner[end_segm].x,
													m_Poly->corner[end_segm].y );
													m_Poly->corner[end_segm].y );
		if( dist <= EDGE_MIN_DIST )
		if( dist <= min_dist )
		{
		{
			m_CornerSelection = item_pos;
			m_CornerSelection = item_pos;
			return item_pos;
			min_dist = dist;
		}
		}
	}
	}


	if ( m_CornerSelection >= 0 )
		return item_pos;

    return -1;
    return -1;
}
}


+9 −4
Original line number Original line Diff line number Diff line
@@ -136,7 +136,7 @@ void WinEDA_ZoneFrame::CreateControls()
    SetFont( *g_DialogFont );
    SetFont( *g_DialogFont );


////@begin WinEDA_ZoneFrame content construction
////@begin WinEDA_ZoneFrame content construction
    // Generated by DialogBlocks, 06/01/2008 15:03:35 (unregistered)
    // Generated by DialogBlocks, 24/01/2008 11:39:58 (unregistered)


    WinEDA_ZoneFrame* itemDialog1 = this;
    WinEDA_ZoneFrame* itemDialog1 = this;


@@ -153,6 +153,7 @@ void WinEDA_ZoneFrame::CreateControls()
    m_GridCtrlStrings.Add(_("0.00000"));
    m_GridCtrlStrings.Add(_("0.00000"));
    m_GridCtrlStrings.Add(_("0.00000"));
    m_GridCtrlStrings.Add(_("0.00000"));
    m_GridCtrlStrings.Add(_("0.00000"));
    m_GridCtrlStrings.Add(_("0.00000"));
    m_GridCtrlStrings.Add(_("0.00000"));
    m_GridCtrl = new wxRadioBox( itemDialog1, ID_RADIOBOX_GRID_SELECTION, _("Grid Size for Filling:"), wxDefaultPosition, wxDefaultSize, m_GridCtrlStrings, 1, wxRA_SPECIFY_COLS );
    m_GridCtrl = new wxRadioBox( itemDialog1, ID_RADIOBOX_GRID_SELECTION, _("Grid Size for Filling:"), wxDefaultPosition, wxDefaultSize, m_GridCtrlStrings, 1, wxRA_SPECIFY_COLS );
    m_GridCtrl->SetSelection(0);
    m_GridCtrl->SetSelection(0);
    itemBoxSizer4->Add(m_GridCtrl, 0, wxGROW|wxALL, 5);
    itemBoxSizer4->Add(m_GridCtrl, 0, wxGROW|wxALL, 5);
@@ -260,7 +261,7 @@ void WinEDA_ZoneFrame::CreateControls()
    if( Zone_45_Only )
    if( Zone_45_Only )
        m_OrientEdgesOpt->SetSelection( 1 );
        m_OrientEdgesOpt->SetSelection( 1 );


    static const int GridList[3] = { 50, 100, 250 };
    static const int GridList[4] = { 25, 50, 100, 250 };
    int selection = 0;
    int selection = 0;


    for( unsigned ii = 0; ii < (unsigned) m_GridCtrl->GetCount(); ii++ )
    for( unsigned ii = 0; ii < (unsigned) m_GridCtrl->GetCount(); ii++ )
@@ -473,15 +474,19 @@ bool WinEDA_ZoneFrame::AcceptOptions(bool aPromptForErrors)
    switch( m_GridCtrl->GetSelection() )
    switch( m_GridCtrl->GetSelection() )
    {
    {
    case 0:
    case 0:
        g_GridRoutingSize = 50;
        g_GridRoutingSize = 25;
        break;
        break;


    case 1:
    case 1:
        g_GridRoutingSize = 100;
        g_GridRoutingSize = 50;
        break;
        break;


	default:
	default:
    case 2:
    case 2:
        g_GridRoutingSize = 100;
        break;

    case 3:
        g_GridRoutingSize = 250;
        g_GridRoutingSize = 250;
        break;
        break;
    }
    }
Loading