Commit 7e79113c authored by CHARRAS's avatar CHARRAS

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

parent 2cfe92de
......@@ -8,6 +8,8 @@ email address.
================================================================================
+ all
* 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>
......
......@@ -162,6 +162,8 @@ void WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC )
* if a track is in progress :
* 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
* @param track = track in progress, or NULL
* @param DC = current device context
*/
{
TRACK* pt_segm;
......@@ -191,14 +193,21 @@ void WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC )
return;
}
/* Is the current segment Ok (no DRC error) */
/* Is the current segment Ok (no DRC error) ? */
if( Drc_On )
{
if( Drc( this, DC, g_CurrentTrackSegment, m_Pcb->m_Track, 1 ) == BAD_DRC )
/* DRC error, the change layer is not made */
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.
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;
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.
Put it in linked list, after the g_CurrentTrackSegment */
* Put it in linked list, after the g_CurrentTrackSegment */
Via->Pback = g_CurrentTrackSegment;
g_CurrentTrackSegment->Pnext = Via;
g_TrackSegmentCount++;
/* The g_CurrentTrackSegment is now in linked list and we need a new track segment
after the via, starting at via location.
it will become the new curren segment (from via to the mouse cursor)
* after the via, starting at via location.
* it will become the new curren segment (from via to the mouse cursor)
*/
g_CurrentTrackSegment = g_CurrentTrackSegment->Copy(); /* create a new segment
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 */
* 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 */
g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer ); // set the layer to the new value
/* 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;
......@@ -370,7 +379,6 @@ void WinEDA_PcbFrame::Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC )
if( item->m_Parent && (item->m_Parent->Type() == TYPEMODULE) )
Module = (MODULE*) item->m_Parent;
}
else if( item->Type() == TYPEMODULE )
{
Module = (MODULE*) item;
......
......@@ -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
if( m_ID_current_state != ID_TRACK_BUTT )
return;
if( ItemFree )
if( ItemFree ) // no track in progress: switch layer only
{
Other_Layer_Route( NULL, DC );
break;
......@@ -382,7 +382,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
return;
if( (GetCurItem()->m_Flags & IS_NEW) == 0 )
return;
Other_Layer_Route( (TRACK*) GetCurItem(), DC );
Other_Layer_Route( (TRACK*) GetCurItem(), DC ); // place via and switch layer
if( DisplayOpt.ContrastModeDisplay )
GetScreen()->SetRefreshReq();
break;
......
......@@ -67,12 +67,15 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
EVT_MENU_RANGE(ID_CONFIG_AND_PREFERENCES_START, ID_CONFIG_AND_PREFERENCES_END,
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_DRAWINGS_WIDTHS_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_CONFIG_SAVE, 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_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment