Browse Source

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.
pull/1/head
jean-pierre charras 11 years ago
parent
commit
24ed7f50f5
  1. 13
      include/wxPcbStruct.h
  2. 2
      pcbnew/editrack.cpp
  3. 7
      pcbnew/files.cpp
  4. 4
      pcbnew/hotkeys_board_editor.cpp
  5. 5
      pcbnew/modedit.cpp
  6. 4
      pcbnew/onleftclick.cpp
  7. 11
      pcbnew/onrightclick.cpp
  8. 14
      pcbnew/pcbframe.cpp
  9. 6
      pcbnew/router/router_tool.cpp

13
include/wxPcbStruct.h

@ -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.

2
pcbnew/editrack.cpp

@ -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() );

7
pcbnew/files.cpp

@ -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();

4
pcbnew/hotkeys_board_editor.cpp

@ -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;

5
pcbnew/modedit.cpp

@ -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:

4
pcbnew/onleftclick.cpp

@ -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:

11
pcbnew/onrightclick.cpp

@ -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();

14
pcbnew/pcbframe.cpp

@ -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;
}

6
pcbnew/router/router_tool.cpp

@ -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 );

Loading…
Cancel
Save