Pcbnew: fix design rules dialog tab switching bug on OSX. (fixes lp:1502823)

* Add skip event to notebook page changed event handler.  Apparently OSX
  updates the selected notebook page in this event instead of the page
  changing event used on Window and Linux.
* Improve duplicate net class name error message.
This commit is contained in:
Wayne Stambaugh 2015-10-07 10:15:24 -04:00
parent 53cd964910
commit 40e48a6bb7
1 changed files with 8 additions and 3 deletions

View File

@ -616,6 +616,9 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard()
void DIALOG_DESIGN_RULES::OnNotebookPageChanged( wxNotebookEvent& event ) void DIALOG_DESIGN_RULES::OnNotebookPageChanged( wxNotebookEvent& event )
{ {
s_LastTabSelection = event.GetSelection(); s_LastTabSelection = event.GetSelection();
// Skip() allows OSX to properly refresh controls.
event.Skip();
} }
@ -646,6 +649,8 @@ void DIALOG_DESIGN_RULES::OnAddNetclassClick( wxCommandEvent& event )
{ {
wxString class_name; wxString class_name;
// @todo set validator to ensure net class name is valid rather than all of the checks
// after the OK button has been selected.
wxTextEntryDialog dlg( this, _( "New Net Class Name:" ), wxEmptyString, class_name ); wxTextEntryDialog dlg( this, _( "New Net Class Name:" ), wxEmptyString, class_name );
if( dlg.ShowModal() != wxID_OK ) if( dlg.ShowModal() != wxID_OK )
@ -666,7 +671,7 @@ void DIALOG_DESIGN_RULES::OnAddNetclassClick( wxCommandEvent& event )
if( class_name.CmpNoCase( value ) == 0 ) // Already exists! if( class_name.CmpNoCase( value ) == 0 ) // Already exists!
{ {
DisplayError( this, _( "This NetClass is already existing, cannot add it; Aborted" ) ); DisplayError( this, _( "Duplicate net class names are not allowed." ) );
return; return;
} }
} }
@ -728,7 +733,7 @@ void DIALOG_DESIGN_RULES::OnRemoveNetclassClick( wxCommandEvent& event )
swapNetClass( classname, NETCLASS::Default ); swapNetClass( classname, NETCLASS::Default );
} }
else else
wxMessageBox( _( "The default Netclass cannot be removed" ) ); wxMessageBox( _( "The default net class cannot be removed" ) );
} }
if( reinit ) if( reinit )