Commit 24ed7f50 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: fix Bug #1370321 (Change Segment function applies last netclass used).

Also update main toolbar track width and via size info in pns router mode, when starting a track, and other very minor update issue.
parent b653da5e
......@@ -514,6 +514,19 @@ public:
*/
void ReCreateLayerBox( bool aForceResizeToolbar = true );
/**
* Function SetCurrentNetClass
* Must be called after a netclass selection (or after a netclass parameter change
* calls BOARD_DESIGN_SETTINGS::SetCurrentNetClass() and update trace width and via size
* combo boxes on main toolbar
* Initialize vias and tracks values displayed in comb boxes of the auxiliary toolbar
* and some others parameters (netclass name ....)
* @param aNetClassName = the new netclass name
* @return true if lists of tracks and vias sizes are modified
*/
bool SetCurrentNetClass( const wxString& aNetClassName );
/**
* Function OnModify
* must be called after a board change to set the modified flag.
......
......@@ -167,7 +167,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
// Display info about track Net class, and init track and vias sizes:
g_CurrentTrackSegment->SetNetCode( GetBoard()->GetHighLightNetCode() );
GetDesignSettings().SetCurrentNetClass( g_CurrentTrackSegment->GetNetClassName() );
SetCurrentNetClass( g_CurrentTrackSegment->GetNetClassName() );
g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer );
g_CurrentTrackSegment->SetWidth( GetDesignSettings().GetCurrentTrackWidth() );
......
......@@ -559,7 +559,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
GetBoard()->m_Status_Pcb = 0;
// Update info shown by the horizontal toolbars
GetDesignSettings().SetCurrentNetClass( NETCLASS::Default );
SetCurrentNetClass( NETCLASS::Default );
ReFillLayerWidget();
ReCreateLayerBox();
......@@ -573,9 +573,6 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
// See case RATSNEST_VISIBLE: in BOARD::SetElementVisibility()
GetBoard()->SetVisibleElements( GetBoard()->GetVisibleElements() );
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
// Display the loaded board:
Zoom_Automatique( false );
......@@ -681,7 +678,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
// Select default Netclass before writing file.
// Useful to save default values in headers
GetDesignSettings().SetCurrentNetClass( NETCLASS::Default );
SetCurrentNetClass( NETCLASS::Default );
ClearMsgPanel();
......
......@@ -668,7 +668,11 @@ bool PCB_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand )
case PCB_TRACE_T:
case PCB_VIA_T:
if( aIdCommand == HK_EDIT_ITEM )
{
// Be sure the corresponding netclass is selected before edit:
SetCurrentNetClass( ( (BOARD_CONNECTED_ITEM*)item )->GetNetClassName() );
evt_type = ID_POPUP_PCB_EDIT_TRACKSEG;
}
break;
......
......@@ -818,11 +818,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
{
wxPoint pos;
double angle = 900; // Necessary +- 900 (+- 90 degrees).
// Be prudent: because RotateMarkedItems is used to rotate some items
// used the same value as RotateMarkedItems
switch( transform )
{
case ID_MODEDIT_MODULE_ROTATE:
......
......@@ -166,10 +166,8 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case PCB_TRACE_T:
case PCB_VIA_T:
case PCB_PAD_T:
GetDesignSettings().SetCurrentNetClass(
SetCurrentNetClass(
((BOARD_CONNECTED_ITEM*)DrawStruct)->GetNetClassName() );
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
break;
default:
......
......@@ -464,9 +464,7 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
wxPoint cursorPosition = GetCrossHairPosition();
wxString msg;
GetDesignSettings().SetCurrentNetClass( Track->GetNetClassName() );
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
SetCurrentNetClass( Track->GetNetClassName() );
int flags = Track->GetFlags();
......@@ -834,12 +832,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
if( flags ) // Currently in edit, no others commands possible
return;
if( GetDesignSettings().GetCurrentNetClassName() != Pad->GetNetClassName() )
{
GetDesignSettings().SetCurrentNetClass( Pad->GetNetClassName() );
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
}
SetCurrentNetClass( Pad->GetNetClassName() );
wxString msg = Pad->GetSelectMenuText();
......
......@@ -1079,3 +1079,17 @@ void PCB_EDIT_FRAME::ToPlotter( wxCommandEvent& event )
dlg.ShowModal();
}
bool PCB_EDIT_FRAME::SetCurrentNetClass( const wxString& aNetClassName )
{
bool change = GetDesignSettings().SetCurrentNetClass( aNetClassName );
if( change )
{
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
}
return change;
}
......@@ -534,7 +534,13 @@ void ROUTER_TOOL::performRouting()
frame->SetActiveLayer( ToLAYER_ID( m_startLayer ) );
if( m_startItem && m_startItem->Net() >= 0 )
{
highlightNet( true, m_startItem->Net() );
// Update track width and via size shown in main toolbar comboboxes
frame->SetCurrentNetClass( m_startItem->Parent()->GetNetClass()->GetName() );
}
else
frame->SetCurrentNetClass( NETCLASS::Default );
ctls->ForceCursorPosition( false );
ctls->SetAutoPan( true );
......
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