Commit 7e79113c authored by CHARRAS's avatar CHARRAS
Browse files

pcbnew bug fix in place via (partial drc was made) (old bug)

parent 2cfe92de
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -8,6 +8,8 @@ email address.
================================================================================
================================================================================
+ all
+ all
	* hotkeys handling finished
	* hotkeys handling finished
+ pcbnew
	* bug fix: a subtle bug in place via : partial drc only was made.




2007-Sep-14 UPDATE   Dick Hollenbeck <dick@softplc.com>
2007-Sep-14 UPDATE   Dick Hollenbeck <dick@softplc.com>
+45 −37
Original line number Original line Diff line number Diff line
@@ -162,6 +162,8 @@ void WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC )
 *  if a track is in progress :
 *  if a track is in progress :
 *		put (if possible, i.e. if no DRC problem) a Via on the end of the current
 *		put (if possible, i.e. if no DRC problem) a Via on the end of the current
 *		track, swap the current active layer and start a new trac segment on the new layer
 *		track, swap the current active layer and start a new trac segment on the new layer
 * @param track = track in progress, or NULL
 * @param DC = current device context
 */
 */
{
{
    TRACK*  pt_segm;
    TRACK*  pt_segm;
@@ -191,14 +193,21 @@ void WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC )
            return;
            return;
    }
    }


    /* Is the current segment Ok (no DRC error) */
    /* Is the current segment Ok (no DRC error) ? */
    if( Drc_On )
    if( Drc_On )
    {
        if( Drc( this, DC, g_CurrentTrackSegment, m_Pcb->m_Track, 1 ) == BAD_DRC )
        if( Drc( this, DC, g_CurrentTrackSegment, m_Pcb->m_Track, 1 ) == BAD_DRC )
            /* DRC error, the change layer is not made */
            /* DRC error, the change layer is not made */
            return;
            return;
        if( g_TwoSegmentTrackBuild && g_CurrentTrackSegment->Back() )    // We must handle 2 segments
        {
            if( Drc( this, DC, g_CurrentTrackSegment->Back(), m_Pcb->m_Track, 1 ) == BAD_DRC )
                return;
        }
    }


    /* Saving current state before placing a via.
    /* Saving current state before placing a via.
		If the via canot be placed this current state will be reused */
     *  If the via canot be placed this current state will be reused */
    itmp = g_TrackSegmentCount;
    itmp = g_TrackSegmentCount;
    Begin_Route( g_CurrentTrackSegment, DC );
    Begin_Route( g_CurrentTrackSegment, DC );


@@ -242,23 +251,23 @@ void WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC )
    }
    }


    /* A new via was created. It was Ok.
    /* A new via was created. It was Ok.
	Put it in linked list, after the g_CurrentTrackSegment */
     *  Put it in linked list, after the g_CurrentTrackSegment */
    Via->Pback = g_CurrentTrackSegment;
    Via->Pback = g_CurrentTrackSegment;
    g_CurrentTrackSegment->Pnext = Via;
    g_CurrentTrackSegment->Pnext = Via;
    g_TrackSegmentCount++;
    g_TrackSegmentCount++;


    /* The g_CurrentTrackSegment is now in linked list and we need a new track segment
    /* The g_CurrentTrackSegment is now in linked list and we need a new track segment
	after the via, starting at via location.
     *  after the via, starting at via location.
	it will become the new curren segment (from via to the mouse cursor)
     *  it will become the new curren segment (from via to the mouse cursor)
     */
     */
    g_CurrentTrackSegment = g_CurrentTrackSegment->Copy();  /* create a new segment
    g_CurrentTrackSegment = g_CurrentTrackSegment->Copy();  /* create a new segment
	from the last entered segment, with the current width, flags, netcode, etc... values
                                                             *  from the last entered segment, with the current width, flags, netcode, etc... values
	layer, start and end point are not correct, and will be modified next */
                                                             *  layer, start and end point are not correct, and will be modified next */


    g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer ); // set the layer to the new value
    g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer ); // set the layer to the new value


    /* the start point is the via position,
    /* the start point is the via position,
	and the end point is the cursor which also is on the via (will change when moving mouse)
     *  and the end point is the cursor which also is on the via (will change when moving mouse)
     */
     */
    g_CurrentTrackSegment->m_Start = g_CurrentTrackSegment->m_End = Via->m_Start;
    g_CurrentTrackSegment->m_Start = g_CurrentTrackSegment->m_End = Via->m_Start;


@@ -370,7 +379,6 @@ void WinEDA_PcbFrame::Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC )
                if( item->m_Parent && (item->m_Parent->Type()  == TYPEMODULE) )
                if( item->m_Parent && (item->m_Parent->Type()  == TYPEMODULE) )
                    Module = (MODULE*) item->m_Parent;
                    Module = (MODULE*) item->m_Parent;
            }
            }
            
            else if( item->Type() == TYPEMODULE )
            else if( item->Type() == TYPEMODULE )
            {
            {
                Module = (MODULE*) item;
                Module = (MODULE*) item;
+2 −2
Original line number Original line Diff line number Diff line
@@ -373,7 +373,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
    case HK_ADD_VIA:          // Switch to alternate layer and Place a via if a track is in progress
    case HK_ADD_VIA:          // Switch to alternate layer and Place a via if a track is in progress
        if( m_ID_current_state != ID_TRACK_BUTT )
        if( m_ID_current_state != ID_TRACK_BUTT )
            return;
            return;
        if( ItemFree )
        if( ItemFree )		// no track in progress: switch layer only
        {
        {
            Other_Layer_Route( NULL, DC );
            Other_Layer_Route( NULL, DC );
            break;
            break;
@@ -382,7 +382,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
            return;
            return;
        if( (GetCurItem()->m_Flags & IS_NEW) == 0 )
        if( (GetCurItem()->m_Flags & IS_NEW) == 0 )
            return;
            return;
        Other_Layer_Route( (TRACK*) GetCurItem(), DC );
        Other_Layer_Route( (TRACK*) GetCurItem(), DC );		// place via and switch layer
        if( DisplayOpt.ContrastModeDisplay )
        if( DisplayOpt.ContrastModeDisplay )
            GetScreen()->SetRefreshReq();
            GetScreen()->SetRefreshReq();
        break;
        break;
+4 −1
Original line number Original line Diff line number Diff line
@@ -67,12 +67,15 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
	EVT_MENU_RANGE(ID_CONFIG_AND_PREFERENCES_START, ID_CONFIG_AND_PREFERENCES_END,
	EVT_MENU_RANGE(ID_CONFIG_AND_PREFERENCES_START, ID_CONFIG_AND_PREFERENCES_END,
		WinEDA_PcbFrame::Process_Config)
		WinEDA_PcbFrame::Process_Config)


    EVT_MENU( ID_COLORS_SETUP, WinEDA_PcbFrame::Process_Config )
    EVT_MENU( ID_OPTIONS_SETUP, WinEDA_PcbFrame::Process_Config )
    EVT_MENU( ID_PCB_TRACK_SIZE_SETUP, WinEDA_PcbFrame::Process_Config )
    EVT_MENU( ID_PCB_TRACK_SIZE_SETUP, WinEDA_PcbFrame::Process_Config )
    EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, WinEDA_PcbFrame::Process_Config )
    EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, WinEDA_PcbFrame::Process_Config )
    EVT_MENU( ID_PCB_PAD_SETUP, WinEDA_PcbFrame::Process_Config )
    EVT_MENU( ID_PCB_PAD_SETUP, WinEDA_PcbFrame::Process_Config )
    EVT_MENU( ID_PCB_LOOK_SETUP, WinEDA_PcbFrame::Process_Config )
    EVT_MENU( ID_PCB_LOOK_SETUP, WinEDA_PcbFrame::Process_Config )
    EVT_MENU( ID_CONFIG_SAVE, WinEDA_PcbFrame::Process_Config )
    EVT_MENU( ID_CONFIG_SAVE, WinEDA_PcbFrame::Process_Config )
    EVT_MENU( ID_CONFIG_READ, WinEDA_PcbFrame::Process_Config )
    EVT_MENU( ID_CONFIG_READ, WinEDA_PcbFrame::Process_Config )

	EVT_MENU( ID_PCB_USER_GRID_SETUP, WinEDA_PcbFrame::Process_Special_Functions )
	EVT_MENU( ID_PCB_USER_GRID_SETUP, WinEDA_PcbFrame::Process_Special_Functions )
    
    
    EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
    EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,