Commit c41752fd authored by Dick Hollenbeck's avatar Dick Hollenbeck

Load BOARD project settings before loading BOARD in case BOARD has

any configuration overrides.

Call SetDesignSettings() in PCB_BASE_FRAME::ReadSetup().
parent 75d2dc73
/////////////////////////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////////////////////
// Name: dialog_mask_clearance.cpp
// Author: jean-pierre Charras
// Modified by:
// Created: 17 feb 2009
// Licence: GPL
/////////////////////////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////////////////////
#include <fctsys.h>
#include <confirm.h>
......@@ -17,15 +17,15 @@
#include <dialog_mask_clearance.h>
/**
* DIALOG_PADS_MASK_CLEARANCE_BASE, derived from DIALOG_PADS_MASK_CLEARANCE_BASE_BASE
* @see dialog_dialog_mask_clearance_base.h and dialog_mask_clearance.cpp,
* automatically created by wxFormBuilder
* Class DIALOG_PADS_MASK_CLEARANCE
* is derived from DIALOG_PADS_MASK_CLEARANCE_BASE.
* @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* parent ) :
DIALOG_PADS_MASK_CLEARANCE_BASE( parent )
DIALOG_PADS_MASK_CLEARANCE::DIALOG_PADS_MASK_CLEARANCE( PCB_EDIT_FRAME* aParent ) :
DIALOG_PADS_MASK_CLEARANCE_BASE( aParent )
{
m_Parent = parent;
m_Parent = aParent;
m_BrdSettings = m_Parent->GetBoard()->GetDesignSettings();
MyInit();
......@@ -44,30 +44,31 @@ void DIALOG_PADS_MASK_CLEARANCE::MyInit()
int Internal_Unit = m_Parent->GetInternalUnits();
PutValueInLocalUnits( *m_SolderMaskMarginCtrl,
m_BrdSettings.m_SolderMaskMargin,
m_BrdSettings.m_SolderMaskMargin,
Internal_Unit );
// These 2 parameters are usually < 0, so prepare entering a negative
// value, if current is 0
PutValueInLocalUnits( *m_SolderPasteMarginCtrl,
m_BrdSettings.m_SolderPasteMargin,
m_BrdSettings.m_SolderPasteMargin,
Internal_Unit );
if( m_BrdSettings.m_SolderPasteMargin == 0 )
m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) +
m_SolderPasteMarginCtrl->GetValue() );
wxString msg;
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 );
else
m_SolderPasteMarginRatioCtrl->SetValue( msg );
}
/*******************************************************************/
void DIALOG_PADS_MASK_CLEARANCE::OnButtonOkClick( wxCommandEvent& event )
/*******************************************************************/
{
m_BrdSettings.m_SolderMaskMargin =
ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->GetInternalUnits() );
......@@ -75,13 +76,15 @@ void DIALOG_PADS_MASK_CLEARANCE::OnButtonOkClick( wxCommandEvent& event )
m_BrdSettings.m_SolderPasteMargin =
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->GetInternalUnits() );
double dtmp = 0;
wxString msg = m_SolderPasteMarginRatioCtrl->GetValue();
double dtmp = 0;
wxString msg = m_SolderPasteMarginRatioCtrl->GetValue();
msg.ToDouble( &dtmp );
// A margin ratio de -50% means no paste on a pad, the ratio must be >= 50 %
if( dtmp < -50 )
dtmp = -50;
if( 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 )
{
EndModal( 0 );
......
......@@ -258,8 +258,10 @@ this file again." ) );
m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_DisplayViaFill = DisplayOpt.DisplayViaFill;
ReadPcbFile( &reader, false );
// load project settings before BOARD, in case BOARD file has overrides.
LoadProjectSettings( GetScreen()->GetFileName() );
ReadPcbFile( &reader, false );
}
#else
......@@ -272,6 +274,9 @@ this file again." ) );
m_DisplayModEdge = DisplayOpt.DisplayModEdge;
m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_DisplayViaFill = DisplayOpt.DisplayViaFill;
// load project settings before BOARD, in case BOARD file has overrides.
LoadProjectSettings( GetScreen()->GetFileName() );
}
else
{
......@@ -306,11 +311,6 @@ this file again." ) );
wxMessageBox( msg, _( "Open Board File" ), wxOK | wxICON_ERROR );
}
if( !aAppend )
{
LoadProjectSettings( GetScreen()->GetFileName() );
}
if( loadedBoard )
{
// we should not ask PLUGINs to do these items:
......
......@@ -382,6 +382,8 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
// projects.
GetBoard()->m_NetClasses.GetDefault()->SetParams();
GetBoard()->SetDesignSettings( bds );
GetBoard()->SetZoneSettings( zoneInfo );
return 0;
......
......@@ -103,30 +103,30 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
break;
case ID_CONFIG_READ:
{
fn = GetScreen()->GetFileName();
fn.SetExt( ProjectFileExtension );
{
fn = GetScreen()->GetFileName();
fn.SetExt( ProjectFileExtension );
wxFileDialog dlg( this, _( "Read Project File" ), fn.GetPath(),
fn.GetFullName(), ProjectFileWildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
wxFileDialog dlg( this, _( "Read Project File" ), fn.GetPath(),
fn.GetFullName(), ProjectFileWildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
if( dlg.ShowModal() == wxID_CANCEL )
break;
if( dlg.ShowModal() == wxID_CANCEL )
break;
if( !wxFileExists( dlg.GetPath() ) )
{
wxString msg;
msg.Printf( _( "File %s not found" ), GetChars( dlg.GetPath() ) );
DisplayError( this, msg );
break;
}
if( !wxFileExists( dlg.GetPath() ) )
{
wxString msg;
msg.Printf( _( "File %s not found" ), GetChars( dlg.GetPath() ) );
DisplayError( this, msg );
break;
}
LoadProjectSettings( dlg.GetPath() );
LoadProjectSettings( dlg.GetPath() );
}
break;
}
/* Hotkey IDs */
// Hotkey IDs
case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG:
ExportHotkeyConfigToFile( g_Board_Editor_Hokeys_Descr );
break;
......@@ -144,7 +144,7 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
DisplayHotkeyList( this, g_Board_Editor_Hokeys_Descr );
break;
/* Macros IDs*/
// Macros IDs
case ID_PREFRENCES_MACROS_SAVE:
SaveMacros();
break;
......
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