|
|
|
@ -39,6 +39,8 @@ |
|
|
|
#include <dialogs/eda_view_switcher.h>
|
|
|
|
#include <layer_widget.h>
|
|
|
|
#include <class_dimension.h>
|
|
|
|
#include <wildcards_and_files_ext.h>
|
|
|
|
|
|
|
|
|
|
|
|
PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent, |
|
|
|
FRAME_T aFrameType, const wxString& aTitle, |
|
|
|
@ -129,6 +131,17 @@ void PCB_BASE_EDIT_FRAME::SetBoard( BOARD* aBoard ) |
|
|
|
{ |
|
|
|
bool new_board = ( aBoard != m_Pcb ); |
|
|
|
|
|
|
|
if( new_board ) |
|
|
|
{ |
|
|
|
if( m_toolManager ) |
|
|
|
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD ); |
|
|
|
|
|
|
|
GetCanvas()->GetView()->Clear(); |
|
|
|
GetCanvas()->GetView()->InitPreview(); |
|
|
|
} |
|
|
|
|
|
|
|
PCB_BASE_FRAME::SetBoard( aBoard ); |
|
|
|
|
|
|
|
if( new_board ) |
|
|
|
{ |
|
|
|
BOARD_DESIGN_SETTINGS& bds = aBoard->GetDesignSettings(); |
|
|
|
@ -136,23 +149,15 @@ void PCB_BASE_EDIT_FRAME::SetBoard( BOARD* aBoard ) |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
bds.m_DRCEngine->InitEngine( Prj().AbsolutePath( "drc-rules" ) ); |
|
|
|
bds.m_DRCEngine->InitEngine( GetDesignRulesPath() ); |
|
|
|
} |
|
|
|
catch( PARSE_ERROR& pe ) |
|
|
|
{ |
|
|
|
// TODO: We could redirect to Board Setup here and report the error. Or we could
|
|
|
|
// wait till they run DRC or do an Inspect Clearance. Not sure which is better....
|
|
|
|
} |
|
|
|
|
|
|
|
if( m_toolManager ) |
|
|
|
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD ); |
|
|
|
|
|
|
|
GetCanvas()->GetView()->Clear(); |
|
|
|
GetCanvas()->GetView()->InitPreview(); |
|
|
|
} |
|
|
|
|
|
|
|
PCB_BASE_FRAME::SetBoard( aBoard ); |
|
|
|
|
|
|
|
GetCanvas()->GetGAL()->SetGridOrigin( VECTOR2D( aBoard->GetDesignSettings().m_GridOrigin ) ); |
|
|
|
|
|
|
|
// update the tool manager with the new board and its view.
|
|
|
|
@ -217,3 +222,12 @@ COLOR_SETTINGS* PCB_BASE_EDIT_FRAME::GetColorSettings() |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
wxString PCB_BASE_EDIT_FRAME::GetDesignRulesPath() |
|
|
|
{ |
|
|
|
if( !GetBoard() ) |
|
|
|
return wxEmptyString; |
|
|
|
|
|
|
|
wxFileName fn = GetBoard()->GetFileName(); |
|
|
|
fn.SetExt( DesignRulesFileExtension ); |
|
|
|
return Prj().AbsolutePath( fn.GetFullName() ); |
|
|
|
} |