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 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
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>
================================================================================
+pcbnew:
+17 −7
Original line number Diff line number Diff line
@@ -203,31 +203,41 @@ void DisplayBoard( WinEDA_DrawPanel* panel, wxDC* DC )
    int dcell0, dcell1 = 0, color;
    int maxi;

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

    GRSetDrawMode( DC, GR_COPY );
    for( col = 0; col < Ncols; col++ )
    {
        for( row = 0; row < Nrows; row++ )
        {
            color  = 0;
            dcell0 = GetCell( row, col, BOTTOM ); if( dcell0 & HOLE )
            dcell0 = GetCell( row, col, BOTTOM );
			if( dcell0 & HOLE )
                color = GREEN;
            if( Nb_Sides )
                dcell1 = GetCell( row, col, TOP );
//            if( Nb_Sides )
//                dcell1 = GetCell( row, col, TOP );
            if( dcell1 & HOLE )
                color |= RED;
            dcell0 |= dcell1;
//            dcell0 |= dcell1;
            if( !color && (dcell0 & VIA_IMPOSSIBLE) )
                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( j = 0; j < maxi; j++ )
                        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 Diff line number Diff line
@@ -579,6 +579,12 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
    DrawPanel->Refresh( TRUE );
    if( g_Show_Ratsnest )
        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 Diff line number Diff line
@@ -367,6 +367,7 @@ bool ZONE_CONTAINER::HitTest( const wxPoint& refPos )
/**
 * Function HitTestForCorner
 * 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
 * @return -1 if none, corner index in .corner <vector>
 * @param refPos : A wxPoint to test
@@ -374,27 +375,32 @@ bool ZONE_CONTAINER::HitTest( 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
    int dist;
    int dist, min_dist;
	unsigned item_pos, lim;
	lim = m_Poly->corner.size();
	m_CornerSelection = -1;
	
	min_dist = CORNER_MIN_DIST;
	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 );
		if( dist <= CORNER_MIN_DIST )
		if( dist <= min_dist )
		{
			m_CornerSelection = item_pos;
			return item_pos;
			min_dist = dist;
		}
	}

	if ( m_CornerSelection >= 0 )
		return item_pos;

    return -1;
}

/**
 * Function HitTestForEdge
 * 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
 * @return -1 if none,  or index of the starting corner in .corner <vector>
 * @param refPos : A wxPoint to test
@@ -402,13 +408,14 @@ int ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
int ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos )
{
	#define EDGE_MIN_DIST 200	// distance (in internal units) to detect a zone outline
    int dist;
    int dist, min_dist;
	unsigned item_pos, lim;
	lim = m_Poly->corner.size();

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

	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[end_segm].x,
													m_Poly->corner[end_segm].y );
		if( dist <= EDGE_MIN_DIST )
		if( dist <= min_dist )
		{
			m_CornerSelection = item_pos;
			return item_pos;
			min_dist = dist;
		}
	}

	if ( m_CornerSelection >= 0 )
		return item_pos;

    return -1;
}

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

////@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;

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

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

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

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

	default:
    case 2:
        g_GridRoutingSize = 100;
        break;

    case 3:
        g_GridRoutingSize = 250;
        break;
    }
Loading