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, ...@@ -28,7 +28,8 @@ bool WinEDA_PcbFrame::SetTrackSegmentWidth( TRACK* aTrackItem,
PICKED_ITEMS_LIST* aItemsListPicker, PICKED_ITEMS_LIST* aItemsListPicker,
bool aUseNetclassValue ) 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; bool change_ok = false;
NETINFO_ITEM* net = NULL; NETINFO_ITEM* net = NULL;
...@@ -36,12 +37,15 @@ bool WinEDA_PcbFrame::SetTrackSegmentWidth( TRACK* aTrackItem, ...@@ -36,12 +37,15 @@ bool WinEDA_PcbFrame::SetTrackSegmentWidth( TRACK* aTrackItem,
net = GetBoard()->FindNet( aTrackItem->GetNet() ); net = GetBoard()->FindNet( aTrackItem->GetNet() );
initial_width = aTrackItem->m_Width; initial_width = aTrackItem->m_Width;
if( net ) if( net )
new_width = net->GetTrackWidth(); new_width = net->GetTrackWidth();
else else
new_width = GetBoard()->GetCurrentTrackWidth(); new_width = GetBoard()->GetCurrentTrackWidth();
if( aTrackItem->Type() == TYPE_VIA ) if( aTrackItem->Type() == TYPE_VIA )
{ {
if( !aTrackItem->IsDrillDefault() )
initial_drill = aTrackItem->GetDrillValue();
if( net ) if( net )
new_width = net->GetViaSize(); new_width = net->GetViaSize();
else else
...@@ -57,11 +61,6 @@ bool WinEDA_PcbFrame::SetTrackSegmentWidth( TRACK* aTrackItem, ...@@ -57,11 +61,6 @@ bool WinEDA_PcbFrame::SetTrackSegmentWidth( TRACK* aTrackItem,
new_width = net->GetMicroViaSize(); 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; aTrackItem->m_Width = new_width;
...@@ -76,7 +75,10 @@ bool WinEDA_PcbFrame::SetTrackSegmentWidth( TRACK* aTrackItem, ...@@ -76,7 +75,10 @@ bool WinEDA_PcbFrame::SetTrackSegmentWidth( TRACK* aTrackItem,
else if( initial_width > new_width ) else if( initial_width > new_width )
change_ok = true; 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 ) if( change_ok )
{ {
...@@ -88,6 +90,14 @@ bool WinEDA_PcbFrame::SetTrackSegmentWidth( TRACK* aTrackItem, ...@@ -88,6 +90,14 @@ bool WinEDA_PcbFrame::SetTrackSegmentWidth( TRACK* aTrackItem,
picker.m_Link = aTrackItem->Copy(); picker.m_Link = aTrackItem->Copy();
aItemsListPicker->PushItem( picker ); aItemsListPicker->PushItem( picker );
aTrackItem->m_Width = new_width; 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 else
......
...@@ -471,28 +471,22 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu ) ...@@ -471,28 +471,22 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
{ {
if( Track->Type() == TYPE_VIA ) if( Track->Type() == TYPE_VIA )
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TRACKSEG, _( msg = AddHotkeyName( _( "Change Via Size and Drill" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM );
"Change Via Size and Drill" ), width_segment_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TRACKSEG, msg, width_segment_xpm );
} }
else else
{ {
msg = AddHotkeyName( _( "Change Segment Width" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); msg = AddHotkeyName( _( "Change Segment Width" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TRACKSEG, ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TRACKSEG, msg, width_segment_xpm );
msg, width_segment_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TRACK, ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TRACK,
_( "Change Track Width" ), width_track_xpm ); _( "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() ), ADD_MENUITEM_WITH_SUBMENU( PopMenu, Append_Track_Width_List( GetBoard() ),
ID_POPUP_PCB_SELECT_WIDTH, ID_POPUP_PCB_SELECT_WIDTH,
_( "Select Track Width" ), width_track_xpm ); _( "Select Track Width" ), width_track_xpm );
}
// Delete control: // Delete control:
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
......
release version: release version:
2010 dec 03 (BZR R2365) 2010 dec 03 (BZR R2639)
files (.zip,.tgz): files (.zip,.tgz):
kicad-2010-12-03-testing 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