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: ...@@ -514,6 +514,19 @@ public:
*/ */
void ReCreateLayerBox( bool aForceResizeToolbar = true ); 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 * Function OnModify
* must be called after a board change to set the modified flag. * 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 ) ...@@ -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: // Display info about track Net class, and init track and vias sizes:
g_CurrentTrackSegment->SetNetCode( GetBoard()->GetHighLightNetCode() ); g_CurrentTrackSegment->SetNetCode( GetBoard()->GetHighLightNetCode() );
GetDesignSettings().SetCurrentNetClass( g_CurrentTrackSegment->GetNetClassName() ); SetCurrentNetClass( g_CurrentTrackSegment->GetNetClassName() );
g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer ); g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer );
g_CurrentTrackSegment->SetWidth( GetDesignSettings().GetCurrentTrackWidth() ); g_CurrentTrackSegment->SetWidth( GetDesignSettings().GetCurrentTrackWidth() );
......
...@@ -559,7 +559,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in ...@@ -559,7 +559,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
GetBoard()->m_Status_Pcb = 0; GetBoard()->m_Status_Pcb = 0;
// Update info shown by the horizontal toolbars // Update info shown by the horizontal toolbars
GetDesignSettings().SetCurrentNetClass( NETCLASS::Default ); SetCurrentNetClass( NETCLASS::Default );
ReFillLayerWidget(); ReFillLayerWidget();
ReCreateLayerBox(); ReCreateLayerBox();
...@@ -573,9 +573,6 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in ...@@ -573,9 +573,6 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
// See case RATSNEST_VISIBLE: in BOARD::SetElementVisibility() // See case RATSNEST_VISIBLE: in BOARD::SetElementVisibility()
GetBoard()->SetVisibleElements( GetBoard()->GetVisibleElements() ); GetBoard()->SetVisibleElements( GetBoard()->GetVisibleElements() );
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
// Display the loaded board: // Display the loaded board:
Zoom_Automatique( false ); Zoom_Automatique( false );
...@@ -681,7 +678,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF ...@@ -681,7 +678,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
// Select default Netclass before writing file. // Select default Netclass before writing file.
// Useful to save default values in headers // Useful to save default values in headers
GetDesignSettings().SetCurrentNetClass( NETCLASS::Default ); SetCurrentNetClass( NETCLASS::Default );
ClearMsgPanel(); ClearMsgPanel();
......
...@@ -668,7 +668,11 @@ bool PCB_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand ) ...@@ -668,7 +668,11 @@ bool PCB_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand )
case PCB_TRACE_T: case PCB_TRACE_T:
case PCB_VIA_T: case PCB_VIA_T:
if( aIdCommand == HK_EDIT_ITEM ) 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; evt_type = ID_POPUP_PCB_EDIT_TRACKSEG;
}
break; break;
......
...@@ -818,11 +818,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -818,11 +818,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform ) 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 ) switch( transform )
{ {
case ID_MODEDIT_MODULE_ROTATE: case ID_MODEDIT_MODULE_ROTATE:
......
...@@ -166,10 +166,8 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -166,10 +166,8 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case PCB_TRACE_T: case PCB_TRACE_T:
case PCB_VIA_T: case PCB_VIA_T:
case PCB_PAD_T: case PCB_PAD_T:
GetDesignSettings().SetCurrentNetClass( SetCurrentNetClass(
((BOARD_CONNECTED_ITEM*)DrawStruct)->GetNetClassName() ); ((BOARD_CONNECTED_ITEM*)DrawStruct)->GetNetClassName() );
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
break; break;
default: default:
......
...@@ -464,9 +464,7 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu ) ...@@ -464,9 +464,7 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
wxPoint cursorPosition = GetCrossHairPosition(); wxPoint cursorPosition = GetCrossHairPosition();
wxString msg; wxString msg;
GetDesignSettings().SetCurrentNetClass( Track->GetNetClassName() ); SetCurrentNetClass( Track->GetNetClassName() );
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
int flags = Track->GetFlags(); int flags = Track->GetFlags();
...@@ -834,12 +832,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu ) ...@@ -834,12 +832,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
if( flags ) // Currently in edit, no others commands possible if( flags ) // Currently in edit, no others commands possible
return; return;
if( GetDesignSettings().GetCurrentNetClassName() != Pad->GetNetClassName() ) SetCurrentNetClass( Pad->GetNetClassName() );
{
GetDesignSettings().SetCurrentNetClass( Pad->GetNetClassName() );
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
}
wxString msg = Pad->GetSelectMenuText(); wxString msg = Pad->GetSelectMenuText();
......
...@@ -1079,3 +1079,17 @@ void PCB_EDIT_FRAME::ToPlotter( wxCommandEvent& event ) ...@@ -1079,3 +1079,17 @@ void PCB_EDIT_FRAME::ToPlotter( wxCommandEvent& event )
dlg.ShowModal(); 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() ...@@ -534,7 +534,13 @@ void ROUTER_TOOL::performRouting()
frame->SetActiveLayer( ToLAYER_ID( m_startLayer ) ); frame->SetActiveLayer( ToLAYER_ID( m_startLayer ) );
if( m_startItem && m_startItem->Net() >= 0 ) if( m_startItem && m_startItem->Net() >= 0 )
{
highlightNet( true, m_startItem->Net() ); 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->ForceCursorPosition( false );
ctls->SetAutoPan( true ); 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