Commit 249267ed authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: fix minor bug in via edition.

parent 61edf743
......@@ -28,7 +28,8 @@ bool WinEDA_PcbFrame::SetTrackSegmentWidth( TRACK* aTrackItem,
PICKED_ITEMS_LIST* aItemsListPicker,
bool aUseNetclassValue )
{
int initial_width, new_width, new_drill = -1;
int initial_width, new_width;
int initial_drill = -1,new_drill = -1;
bool change_ok = false;
NETINFO_ITEM* net = NULL;
......@@ -36,12 +37,15 @@ bool WinEDA_PcbFrame::SetTrackSegmentWidth( TRACK* aTrackItem,
net = GetBoard()->FindNet( aTrackItem->GetNet() );
initial_width = aTrackItem->m_Width;
if( net )
new_width = net->GetTrackWidth();
else
new_width = GetBoard()->GetCurrentTrackWidth();
if( aTrackItem->Type() == TYPE_VIA )
{
if( !aTrackItem->IsDrillDefault() )
initial_drill = aTrackItem->GetDrillValue();
if( net )
new_width = net->GetViaSize();
else
......@@ -57,11 +61,6 @@ bool WinEDA_PcbFrame::SetTrackSegmentWidth( TRACK* aTrackItem,
new_width = net->GetMicroViaSize();
}
// Set drill value. Note: currently microvias have only a default drill value
if( new_drill > 0 )
aTrackItem->SetDrillValue(new_drill);
else
aTrackItem->SetDrillDefault( );
}
aTrackItem->m_Width = new_width;
......@@ -76,7 +75,10 @@ bool WinEDA_PcbFrame::SetTrackSegmentWidth( TRACK* aTrackItem,
else if( initial_width > new_width )
change_ok = true;
// if new width == initial_width: do nothing
// if new width == initial_width: do nothing,
// unless a via has its drill value changed
else if( (aTrackItem->Type() == TYPE_VIA) && (initial_drill != new_drill) )
change_ok = true;
if( change_ok )
{
......@@ -88,6 +90,14 @@ bool WinEDA_PcbFrame::SetTrackSegmentWidth( TRACK* aTrackItem,
picker.m_Link = aTrackItem->Copy();
aItemsListPicker->PushItem( picker );
aTrackItem->m_Width = new_width;
if( aTrackItem->Type() == TYPE_VIA )
{
// Set new drill value. Note: currently microvias have only a default drill value
if( new_drill > 0 )
aTrackItem->SetDrillValue(new_drill);
else
aTrackItem->SetDrillDefault( );
}
}
}
else
......
......@@ -471,28 +471,22 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
{
if( Track->Type() == TYPE_VIA )
{
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TRACKSEG, _(
"Change Via Size and Drill" ), width_segment_xpm );
msg = AddHotkeyName( _( "Change Via Size and Drill" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TRACKSEG, msg, width_segment_xpm );
}
else
{
msg = AddHotkeyName( _( "Change Segment Width" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TRACKSEG,
msg, width_segment_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TRACKSEG, msg, width_segment_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TRACK,
_( "Change Track Width" ), width_track_xpm );
}
ADD_MENUITEM_WITH_SUBMENU( PopMenu, Append_Track_Width_List( GetBoard() ),
ID_POPUP_PCB_SELECT_WIDTH,
_( "Select Track Width" ), width_track_xpm );
}
else // Allows switching to an other track/via size when routing
{
// Allows switching to an other track/via size when routing
ADD_MENUITEM_WITH_SUBMENU( PopMenu, Append_Track_Width_List( GetBoard() ),
ID_POPUP_PCB_SELECT_WIDTH,
_( "Select Track Width" ), width_track_xpm );
}
// Delete control:
PopMenu->AppendSeparator();
......
release version:
2010 dec 03 (BZR R2365)
2010 dec 03 (BZR R2639)
files (.zip,.tgz):
kicad-2010-12-03-testing
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