Load BOARD project settings before loading BOARD in case BOARD has

any configuration overrides.

Call SetDesignSettings() in PCB_BASE_FRAME::ReadSetup().
This commit is contained in:
Dick Hollenbeck 2012-02-29 09:25:38 -06:00
parent 75d2dc7311
commit c41752fdf4
4 changed files with 49 additions and 48 deletions

View File

@ -17,15 +17,15 @@
#include <dialog_mask_clearance.h> #include <dialog_mask_clearance.h>
/** /**
* DIALOG_PADS_MASK_CLEARANCE_BASE, derived from DIALOG_PADS_MASK_CLEARANCE_BASE_BASE * Class DIALOG_PADS_MASK_CLEARANCE
* @see dialog_dialog_mask_clearance_base.h and dialog_mask_clearance.cpp, * is derived from DIALOG_PADS_MASK_CLEARANCE_BASE.
* automatically created by wxFormBuilder * @see dialog_dialog_mask_clearance_base.h and dialog_mask_clearance_base.cpp,
* which are maintained by wxFormBuilder
*/ */
DIALOG_PADS_MASK_CLEARANCE::DIALOG_PADS_MASK_CLEARANCE( PCB_EDIT_FRAME* aParent ) :
DIALOG_PADS_MASK_CLEARANCE::DIALOG_PADS_MASK_CLEARANCE( PCB_EDIT_FRAME* parent ) : DIALOG_PADS_MASK_CLEARANCE_BASE( aParent )
DIALOG_PADS_MASK_CLEARANCE_BASE( parent )
{ {
m_Parent = parent; m_Parent = aParent;
m_BrdSettings = m_Parent->GetBoard()->GetDesignSettings(); m_BrdSettings = m_Parent->GetBoard()->GetDesignSettings();
MyInit(); MyInit();
@ -52,22 +52,23 @@ void DIALOG_PADS_MASK_CLEARANCE::MyInit()
PutValueInLocalUnits( *m_SolderPasteMarginCtrl, PutValueInLocalUnits( *m_SolderPasteMarginCtrl,
m_BrdSettings.m_SolderPasteMargin, m_BrdSettings.m_SolderPasteMargin,
Internal_Unit ); Internal_Unit );
if( m_BrdSettings.m_SolderPasteMargin == 0 ) if( m_BrdSettings.m_SolderPasteMargin == 0 )
m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) + m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) +
m_SolderPasteMarginCtrl->GetValue() ); m_SolderPasteMarginCtrl->GetValue() );
wxString msg; wxString msg;
msg.Printf( wxT( "%f" ), m_BrdSettings.m_SolderPasteMarginRatio * 100.0 ); msg.Printf( wxT( "%f" ), m_BrdSettings.m_SolderPasteMarginRatio * 100.0 );
if( m_BrdSettings.m_SolderPasteMarginRatio == 0.0 &&
msg[0] == '0') // Sometimes Printf add a sign if the value is small // Sometimes Printf adds a sign if the value is small
if( m_BrdSettings.m_SolderPasteMarginRatio == 0.0 && msg[0] == '0' )
m_SolderPasteMarginRatioCtrl->SetValue( wxT( "-" ) + msg ); m_SolderPasteMarginRatioCtrl->SetValue( wxT( "-" ) + msg );
else else
m_SolderPasteMarginRatioCtrl->SetValue( msg ); m_SolderPasteMarginRatioCtrl->SetValue( msg );
} }
/*******************************************************************/
void DIALOG_PADS_MASK_CLEARANCE::OnButtonOkClick( wxCommandEvent& event ) void DIALOG_PADS_MASK_CLEARANCE::OnButtonOkClick( wxCommandEvent& event )
/*******************************************************************/
{ {
m_BrdSettings.m_SolderMaskMargin = m_BrdSettings.m_SolderMaskMargin =
ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->GetInternalUnits() ); ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->GetInternalUnits() );
@ -77,11 +78,13 @@ void DIALOG_PADS_MASK_CLEARANCE::OnButtonOkClick( wxCommandEvent& event )
double dtmp = 0; double dtmp = 0;
wxString msg = m_SolderPasteMarginRatioCtrl->GetValue(); wxString msg = m_SolderPasteMarginRatioCtrl->GetValue();
msg.ToDouble( &dtmp ); msg.ToDouble( &dtmp );
// A margin ratio de -50% means no paste on a pad, the ratio must be >= 50 % // A margin ratio de -50% means no paste on a pad, the ratio must be >= 50 %
if( dtmp < -50 ) if( dtmp < -50 )
dtmp = -50; dtmp = -50;
if( dtmp > +100 ) if( dtmp > +100 )
dtmp = +100; dtmp = +100;
@ -93,10 +96,6 @@ void DIALOG_PADS_MASK_CLEARANCE::OnButtonOkClick( wxCommandEvent& event )
} }
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/
void DIALOG_PADS_MASK_CLEARANCE::OnButtonCancelClick( wxCommandEvent& event ) void DIALOG_PADS_MASK_CLEARANCE::OnButtonCancelClick( wxCommandEvent& event )
{ {
EndModal( 0 ); EndModal( 0 );

View File

@ -258,8 +258,10 @@ this file again." ) );
m_DisplayPadFill = DisplayOpt.DisplayPadFill; m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_DisplayViaFill = DisplayOpt.DisplayViaFill; m_DisplayViaFill = DisplayOpt.DisplayViaFill;
ReadPcbFile( &reader, false ); // load project settings before BOARD, in case BOARD file has overrides.
LoadProjectSettings( GetScreen()->GetFileName() ); LoadProjectSettings( GetScreen()->GetFileName() );
ReadPcbFile( &reader, false );
} }
#else #else
@ -272,6 +274,9 @@ this file again." ) );
m_DisplayModEdge = DisplayOpt.DisplayModEdge; m_DisplayModEdge = DisplayOpt.DisplayModEdge;
m_DisplayPadFill = DisplayOpt.DisplayPadFill; m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_DisplayViaFill = DisplayOpt.DisplayViaFill; m_DisplayViaFill = DisplayOpt.DisplayViaFill;
// load project settings before BOARD, in case BOARD file has overrides.
LoadProjectSettings( GetScreen()->GetFileName() );
} }
else else
{ {
@ -306,11 +311,6 @@ this file again." ) );
wxMessageBox( msg, _( "Open Board File" ), wxOK | wxICON_ERROR ); wxMessageBox( msg, _( "Open Board File" ), wxOK | wxICON_ERROR );
} }
if( !aAppend )
{
LoadProjectSettings( GetScreen()->GetFileName() );
}
if( loadedBoard ) if( loadedBoard )
{ {
// we should not ask PLUGINs to do these items: // we should not ask PLUGINs to do these items:

View File

@ -382,6 +382,8 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
// projects. // projects.
GetBoard()->m_NetClasses.GetDefault()->SetParams(); GetBoard()->m_NetClasses.GetDefault()->SetParams();
GetBoard()->SetDesignSettings( bds );
GetBoard()->SetZoneSettings( zoneInfo ); GetBoard()->SetZoneSettings( zoneInfo );
return 0; return 0;

View File

@ -123,10 +123,10 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
} }
LoadProjectSettings( dlg.GetPath() ); LoadProjectSettings( dlg.GetPath() );
break;
} }
break;
/* Hotkey IDs */ // Hotkey IDs
case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG: case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG:
ExportHotkeyConfigToFile( g_Board_Editor_Hokeys_Descr ); ExportHotkeyConfigToFile( g_Board_Editor_Hokeys_Descr );
break; break;
@ -144,7 +144,7 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
DisplayHotkeyList( this, g_Board_Editor_Hokeys_Descr ); DisplayHotkeyList( this, g_Board_Editor_Hokeys_Descr );
break; break;
/* Macros IDs*/ // Macros IDs
case ID_PREFRENCES_MACROS_SAVE: case ID_PREFRENCES_MACROS_SAVE:
SaveMacros(); SaveMacros();
break; break;