Commit 40ee7265 authored by Dick Hollenbeck's avatar Dick Hollenbeck

++PCBNew

  * Removed Pcb_Frame argument from BOARD() constructor, since it precludes
    having a BOARD being edited by more than one editor, it was a bad design.
    And this meant removing m_PcbFrame from BOARD.
  * removed BOARD::SetWindowFrame(), since BOARD::m_PcbFrame gone.
  * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
  * Added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
  * A couple of dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
    such as dialog_mask_clearance, dialog_drc, etc.
  * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
    with build_version.h's #define BOARD_FILE_VERSION, although there may be a
    better place for this constant.
  * Made the public functions in PARAM_CFG_ARRAY be type const.
    void SaveParam(..) const and void ReadParam(..) const
  * PARAM_CFG_BASE now has virtual destructor since we have various ways of
    destroying the derived classes and boost::ptr_vector must be told about this.
  * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
    an automatic PARAM_CFG_ARRAY which is on the stack.
  * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
    since it has to access the current BOARD and the BOARD can change.
    Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
  * Made the m_BoundingBox member private, this was a brutally hard task,
    and indicative of the lack of commitment to accessors and object oriented
    design on the part of KiCad developers.  We must do better.
    Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
  * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
parents f311bb4d b26580d5
...@@ -156,12 +156,15 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List() ...@@ -156,12 +156,15 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
m_gllist = glGenLists( 1 ); m_gllist = glGenLists( 1 );
pcb->ComputeBoundingBox(); EDA_RECT bbbox = pcbframe->GetBoardBoundingBox();
g_Parm_3D_Visu.m_BoardSettings = pcb->GetBoardDesignSettings();
g_Parm_3D_Visu.m_BoardSize = pcb->m_BoundaryBox.GetSize(); g_Parm_3D_Visu.m_BoardSettings = &pcb->GetDesignSettings();
g_Parm_3D_Visu.m_BoardPos = pcb->m_BoundaryBox.Centre();
g_Parm_3D_Visu.m_BoardPos.y = -g_Parm_3D_Visu.m_BoardPos.y; g_Parm_3D_Visu.m_BoardSize = bbbox.GetSize();
g_Parm_3D_Visu.m_Layers = pcb->GetCopperLayerCount(); g_Parm_3D_Visu.m_BoardPos = bbbox.Centre();
g_Parm_3D_Visu.m_BoardPos.y = -g_Parm_3D_Visu.m_BoardPos.y;
g_Parm_3D_Visu.m_Layers = pcb->GetCopperLayerCount();
// Ensure the board has 2 sides for 3D views, because it is hard to find // Ensure the board has 2 sides for 3D views, because it is hard to find
// a *really* single side board in the true life... // a *really* single side board in the true life...
...@@ -175,7 +178,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List() ...@@ -175,7 +178,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
// because all boards thickness no not match with this setup: // because all boards thickness no not match with this setup:
// double epoxy_width = 1.6; // epoxy width in mm // double epoxy_width = 1.6; // epoxy width in mm
g_Parm_3D_Visu.m_Epoxy_Width = pcb->GetBoardDesignSettings()->m_BoardThickness g_Parm_3D_Visu.m_Epoxy_Width = pcb->GetDesignSettings().m_BoardThickness
* g_Parm_3D_Visu.m_BoardScale; * g_Parm_3D_Visu.m_BoardScale;
/* calculate z position for each layer */ /* calculate z position for each layer */
......
...@@ -150,8 +150,10 @@ public: ...@@ -150,8 +150,10 @@ public:
wxPoint m_BoardPos; wxPoint m_BoardPos;
wxSize m_BoardSize; wxSize m_BoardSize;
int m_Layers; int m_Layers;
BOARD_DESIGN_SETTINGS* m_BoardSettings; // Link to current board design settings
double m_Epoxy_Width; // Epoxy thickness (normalized) const BOARD_DESIGN_SETTINGS* m_BoardSettings; // Link to current board design settings
double m_Epoxy_Width; // Epoxy thickness (normalized)
double m_BoardScale; /* Normalization scale for coordinates: double m_BoardScale; /* Normalization scale for coordinates:
* when scaled between -1.0 and +1.0 */ * when scaled between -1.0 and +1.0 */
......
...@@ -4,6 +4,36 @@ KiCad ChangeLog 2010 ...@@ -4,6 +4,36 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2011-Dec-5 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), since BOARD::m_PcbFrame gone.
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* Added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* A couple of dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various ways of
destroying the derived classes and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-Dec-04, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> 2011-Dec-04, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================ ================================================================================
Pcbnew: Pcbnew:
...@@ -17,7 +47,7 @@ Pcbnew: ...@@ -17,7 +47,7 @@ Pcbnew:
2011-Nov-27 UPDATE Dick Hollenbeck <dick@softplc.com> 2011-Nov-27 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
PCBNew ++PCBNew
* Add PLUGIN and IO_MGR classes. * Add PLUGIN and IO_MGR classes.
* Remove one argument from BOARD constructor, * Remove one argument from BOARD constructor,
* add BOARD::SetWindowFrame() * add BOARD::SetWindowFrame()
......
...@@ -53,4 +53,7 @@ E6) Start initial work for changing component library file format to use Dick's ...@@ -53,4 +53,7 @@ E6) Start initial work for changing component library file format to use Dick's
PCBNew PCBNew
------ ------
* Make the zone hit testing be done in screen coordinates, not internal units.
See the @todos in class_zone.cpp
...@@ -85,8 +85,6 @@ const wxString ModuleFileExtension( wxT( "mod" ) ); ...@@ -85,8 +85,6 @@ const wxString ModuleFileExtension( wxT( "mod" ) );
/* PCB file name wild card definitions. */ /* PCB file name wild card definitions. */
const wxString ModuleFileWildcard( _( "KiCad footprint library files (*.mod)|*.mod" ) ); const wxString ModuleFileWildcard( _( "KiCad footprint library files (*.mod)|*.mod" ) );
int g_CurrentVersionPCB = 1;
int g_RotationAngle; int g_RotationAngle;
int g_AnchorColor = BLUE; int g_AnchorColor = BLUE;
......
...@@ -169,7 +169,7 @@ void EDA_APP::WriteProjectConfig( const wxString& fileName, ...@@ -169,7 +169,7 @@ void EDA_APP::WriteProjectConfig( const wxString& fileName,
void EDA_APP::WriteProjectConfig( const wxString& fileName, void EDA_APP::WriteProjectConfig( const wxString& fileName,
const wxString& GroupName, const wxString& GroupName,
PARAM_CFG_ARRAY& params ) const PARAM_CFG_ARRAY& params )
{ {
ReCreatePrjConfig( fileName, GroupName, FORCE_LOCAL_CONFIG ); ReCreatePrjConfig( fileName, GroupName, FORCE_LOCAL_CONFIG );
...@@ -189,7 +189,7 @@ void EDA_APP::WriteProjectConfig( const wxString& fileName, ...@@ -189,7 +189,7 @@ void EDA_APP::WriteProjectConfig( const wxString& fileName,
m_ProjectConfig->Write( wxT( "version" ), CONFIG_VERSION ); m_ProjectConfig->Write( wxT( "version" ), CONFIG_VERSION );
m_ProjectConfig->SetPath( wxCONFIG_PATH_SEPARATOR ); m_ProjectConfig->SetPath( wxCONFIG_PATH_SEPARATOR );
BOOST_FOREACH( PARAM_CFG_BASE& param, params ) BOOST_FOREACH( const PARAM_CFG_BASE& param, params )
{ {
if( param.m_Group ) if( param.m_Group )
m_ProjectConfig->SetPath( param.m_Group ); m_ProjectConfig->SetPath( param.m_Group );
...@@ -248,12 +248,12 @@ void EDA_APP::SaveCurrentSetupValues( PARAM_CFG_BASE** aList ) ...@@ -248,12 +248,12 @@ void EDA_APP::SaveCurrentSetupValues( PARAM_CFG_BASE** aList )
} }
void EDA_APP::SaveCurrentSetupValues( PARAM_CFG_ARRAY& List ) void EDA_APP::SaveCurrentSetupValues( const PARAM_CFG_ARRAY& List )
{ {
if( m_EDA_Config == NULL ) if( m_EDA_Config == NULL )
return; return;
BOOST_FOREACH( PARAM_CFG_BASE& param, List ) BOOST_FOREACH( const PARAM_CFG_BASE& param, List )
{ {
if( param.m_Setup == false ) if( param.m_Setup == false )
continue; continue;
...@@ -326,7 +326,7 @@ bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename, ...@@ -326,7 +326,7 @@ bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename,
bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename, bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename,
const wxString& GroupName, const wxString& GroupName,
PARAM_CFG_ARRAY& params, const PARAM_CFG_ARRAY& params,
bool Load_Only_if_New ) bool Load_Only_if_New )
{ {
wxString timestamp; wxString timestamp;
...@@ -356,7 +356,7 @@ bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename, ...@@ -356,7 +356,7 @@ bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename,
m_CurrentOptionFile = g_Prj_Config_LocalFilename; m_CurrentOptionFile = g_Prj_Config_LocalFilename;
} }
BOOST_FOREACH( PARAM_CFG_BASE& param, params ) BOOST_FOREACH( const PARAM_CFG_BASE& param, params )
{ {
if( param.m_Group ) if( param.m_Group )
m_ProjectConfig->SetPath( param.m_Group ); m_ProjectConfig->SetPath( param.m_Group );
...@@ -392,9 +392,9 @@ void EDA_APP::ReadCurrentSetupValues( PARAM_CFG_BASE** aList ) ...@@ -392,9 +392,9 @@ void EDA_APP::ReadCurrentSetupValues( PARAM_CFG_BASE** aList )
} }
void EDA_APP::ReadCurrentSetupValues( PARAM_CFG_ARRAY& List ) void EDA_APP::ReadCurrentSetupValues( const PARAM_CFG_ARRAY& List )
{ {
BOOST_FOREACH( PARAM_CFG_BASE& param, List ) BOOST_FOREACH( const PARAM_CFG_BASE& param, List )
{ {
if( param.m_Setup == false ) if( param.m_Setup == false )
continue; continue;
...@@ -443,7 +443,7 @@ PARAM_CFG_INT::PARAM_CFG_INT( bool Insetup, const wxChar* ident, int* ptparam, ...@@ -443,7 +443,7 @@ PARAM_CFG_INT::PARAM_CFG_INT( bool Insetup, const wxChar* ident, int* ptparam,
* read the value of parameter this stored in aConfig * read the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter * @param aConfig = the wxConfigBase that store the parameter
*/ */
void PARAM_CFG_INT::ReadParam( wxConfigBase* aConfig ) void PARAM_CFG_INT::ReadParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) if( m_Pt_param == NULL || aConfig == NULL )
return; return;
...@@ -461,7 +461,7 @@ void PARAM_CFG_INT::ReadParam( wxConfigBase* aConfig ) ...@@ -461,7 +461,7 @@ void PARAM_CFG_INT::ReadParam( wxConfigBase* aConfig )
* save the value of parameter this stored in aConfig * save the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter * @param aConfig = the wxConfigBase that can store the parameter
*/ */
void PARAM_CFG_INT::SaveParam( wxConfigBase* aConfig ) void PARAM_CFG_INT::SaveParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) if( m_Pt_param == NULL || aConfig == NULL )
return; return;
...@@ -497,7 +497,7 @@ PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( bool Insetup, ...@@ -497,7 +497,7 @@ PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( bool Insetup,
* read the value of parameter this stored in aConfig * read the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter * @param aConfig = the wxConfigBase that store the parameter
*/ */
void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) if( m_Pt_param == NULL || aConfig == NULL )
return; return;
...@@ -513,7 +513,7 @@ void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) ...@@ -513,7 +513,7 @@ void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig )
* save the the value of parameter this stored in aConfig * save the the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter * @param aConfig = the wxConfigBase that can store the parameter
*/ */
void PARAM_CFG_SETCOLOR::SaveParam( wxConfigBase* aConfig ) void PARAM_CFG_SETCOLOR::SaveParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) if( m_Pt_param == NULL || aConfig == NULL )
return; return;
...@@ -555,7 +555,7 @@ PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( bool Insetup, ...@@ -555,7 +555,7 @@ PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( bool Insetup,
* read the value of parameter this stored in aConfig * read the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter * @param aConfig = the wxConfigBase that store the parameter
*/ */
void PARAM_CFG_DOUBLE::ReadParam( wxConfigBase* aConfig ) void PARAM_CFG_DOUBLE::ReadParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) if( m_Pt_param == NULL || aConfig == NULL )
return; return;
...@@ -584,7 +584,7 @@ void PARAM_CFG_DOUBLE::ReadParam( wxConfigBase* aConfig ) ...@@ -584,7 +584,7 @@ void PARAM_CFG_DOUBLE::ReadParam( wxConfigBase* aConfig )
* save the the value of parameter this stored in aConfig * save the the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter * @param aConfig = the wxConfigBase that can store the parameter
*/ */
void PARAM_CFG_DOUBLE::SaveParam( wxConfigBase* aConfig ) void PARAM_CFG_DOUBLE::SaveParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) if( m_Pt_param == NULL || aConfig == NULL )
return; return;
...@@ -619,7 +619,7 @@ PARAM_CFG_BOOL::PARAM_CFG_BOOL( bool Insetup, ...@@ -619,7 +619,7 @@ PARAM_CFG_BOOL::PARAM_CFG_BOOL( bool Insetup,
* read the value of parameter this stored in aConfig * read the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter * @param aConfig = the wxConfigBase that store the parameter
*/ */
void PARAM_CFG_BOOL::ReadParam( wxConfigBase* aConfig ) void PARAM_CFG_BOOL::ReadParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) if( m_Pt_param == NULL || aConfig == NULL )
return; return;
...@@ -634,7 +634,7 @@ void PARAM_CFG_BOOL::ReadParam( wxConfigBase* aConfig ) ...@@ -634,7 +634,7 @@ void PARAM_CFG_BOOL::ReadParam( wxConfigBase* aConfig )
* save the the value of parameter this stored in aConfig * save the the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter * @param aConfig = the wxConfigBase that can store the parameter
*/ */
void PARAM_CFG_BOOL::SaveParam( wxConfigBase* aConfig ) void PARAM_CFG_BOOL::SaveParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) if( m_Pt_param == NULL || aConfig == NULL )
return; return;
...@@ -668,7 +668,7 @@ PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( bool Insetup, const wxChar* ident, ...@@ -668,7 +668,7 @@ PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( bool Insetup, const wxChar* ident,
* read the value of parameter this stored in aConfig * read the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter * @param aConfig = the wxConfigBase that store the parameter
*/ */
void PARAM_CFG_WXSTRING::ReadParam( wxConfigBase* aConfig ) void PARAM_CFG_WXSTRING::ReadParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) if( m_Pt_param == NULL || aConfig == NULL )
return; return;
...@@ -680,7 +680,7 @@ void PARAM_CFG_WXSTRING::ReadParam( wxConfigBase* aConfig ) ...@@ -680,7 +680,7 @@ void PARAM_CFG_WXSTRING::ReadParam( wxConfigBase* aConfig )
* save the value of parameter this stored in aConfig * save the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter * @param aConfig = the wxConfigBase that can store the parameter
*/ */
void PARAM_CFG_WXSTRING::SaveParam( wxConfigBase* aConfig ) void PARAM_CFG_WXSTRING::SaveParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) if( m_Pt_param == NULL || aConfig == NULL )
return; return;
...@@ -703,7 +703,7 @@ PARAM_CFG_FILENAME::PARAM_CFG_FILENAME( const wxChar* ident, ...@@ -703,7 +703,7 @@ PARAM_CFG_FILENAME::PARAM_CFG_FILENAME( const wxChar* ident,
* read the value of parameter this stored in aConfig * read the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter * @param aConfig = the wxConfigBase that store the parameter
*/ */
void PARAM_CFG_FILENAME::ReadParam( wxConfigBase* aConfig ) void PARAM_CFG_FILENAME::ReadParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) if( m_Pt_param == NULL || aConfig == NULL )
return; return;
...@@ -722,7 +722,7 @@ void PARAM_CFG_FILENAME::ReadParam( wxConfigBase* aConfig ) ...@@ -722,7 +722,7 @@ void PARAM_CFG_FILENAME::ReadParam( wxConfigBase* aConfig )
* save the value of parameter this stored in aConfig * save the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter * @param aConfig = the wxConfigBase that can store the parameter
*/ */
void PARAM_CFG_FILENAME::SaveParam( wxConfigBase* aConfig ) void PARAM_CFG_FILENAME::SaveParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) if( m_Pt_param == NULL || aConfig == NULL )
return; return;
...@@ -747,7 +747,7 @@ PARAM_CFG_LIBNAME_LIST::PARAM_CFG_LIBNAME_LIST( const wxChar* ident, ...@@ -747,7 +747,7 @@ PARAM_CFG_LIBNAME_LIST::PARAM_CFG_LIBNAME_LIST( const wxChar* ident,
* read the value of parameter this stored in aConfig * read the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter * @param aConfig = the wxConfigBase that store the parameter
*/ */
void PARAM_CFG_LIBNAME_LIST::ReadParam( wxConfigBase* aConfig ) void PARAM_CFG_LIBNAME_LIST::ReadParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) if( m_Pt_param == NULL || aConfig == NULL )
return; return;
...@@ -780,7 +780,7 @@ void PARAM_CFG_LIBNAME_LIST::ReadParam( wxConfigBase* aConfig ) ...@@ -780,7 +780,7 @@ void PARAM_CFG_LIBNAME_LIST::ReadParam( wxConfigBase* aConfig )
* save the value of parameter this in aConfig (list of parameters) * save the value of parameter this in aConfig (list of parameters)
* @param aConfig = the wxConfigBase that can store the parameter * @param aConfig = the wxConfigBase that can store the parameter
*/ */
void PARAM_CFG_LIBNAME_LIST::SaveParam( wxConfigBase* aConfig ) void PARAM_CFG_LIBNAME_LIST::SaveParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) if( m_Pt_param == NULL || aConfig == NULL )
return; return;
......
...@@ -61,7 +61,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father, ...@@ -61,7 +61,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
icon.CopyFromBitmap( KiBitmap( icon_cvpcb_xpm ) ); icon.CopyFromBitmap( KiBitmap( icon_cvpcb_xpm ) );
SetIcon( icon ); SetIcon( icon );
SetBoard( new BOARD( this ) ); SetBoard( new BOARD() );
SetScreen( new PCB_SCREEN() ); SetScreen( new PCB_SCREEN() );
LoadSettings(); LoadSettings();
......
...@@ -252,7 +252,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event ) ...@@ -252,7 +252,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
} }
PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters( void ) PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters()
{ {
if( !m_projectFileParams.empty() ) if( !m_projectFileParams.empty() )
return m_projectFileParams; return m_projectFileParams;
......
...@@ -134,6 +134,8 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin ...@@ -134,6 +134,8 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
wxColour bgColor = MakeColour( g_DrawBgColor ); wxColour bgColor = MakeColour( g_DrawBgColor );
wxBrush bgBrush( bgColor, wxSOLID ); wxBrush bgBrush( bgColor, wxSOLID );
GERBVIEW_FRAME* gerbFrame = (GERBVIEW_FRAME*) aPanel->GetParent();
int bitmapWidth, bitmapHeight; int bitmapWidth, bitmapHeight;
wxDC* plotDC = aDC; wxDC* plotDC = aDC;
...@@ -188,7 +190,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin ...@@ -188,7 +190,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
for( int layer = 0; !end; layer++ ) for( int layer = 0; !end; layer++ )
{ {
int active_layer = ( (GERBVIEW_FRAME*) m_PcbFrame )->getActiveLayer(); int active_layer = gerbFrame->getActiveLayer();
if( layer == active_layer ) // active layer will be drawn after other layers if( layer == active_layer ) // active layer will be drawn after other layers
continue; continue;
...@@ -269,7 +271,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin ...@@ -269,7 +271,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
int dcode_highlight = 0; int dcode_highlight = 0;
if( layer == ( (GERBVIEW_FRAME*) m_PcbFrame )->getActiveLayer() ) if( layer == gerbFrame->getActiveLayer() )
dcode_highlight = gerber->m_Selected_Tool; dcode_highlight = gerber->m_Selected_Tool;
int layerdrawMode = GR_COPY; int layerdrawMode = GR_COPY;
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "class_gerber_draw_item.h" #include "class_gerber_draw_item.h"
#include "select_layers_to_pcb.h" #include "select_layers_to_pcb.h"
#include "build_version.h" // BOARD_FILE_VERSION
/* A helper class to export a Gerber set of files to Pcbnew /* A helper class to export a Gerber set of files to Pcbnew
...@@ -51,7 +52,7 @@ GBR_TO_PCB_EXPORTER::GBR_TO_PCB_EXPORTER( GERBVIEW_FRAME * aFrame, FILE * aFile ...@@ -51,7 +52,7 @@ GBR_TO_PCB_EXPORTER::GBR_TO_PCB_EXPORTER( GERBVIEW_FRAME * aFrame, FILE * aFile
{ {
m_gerbview_frame = aFrame; m_gerbview_frame = aFrame;
m_file = aFile; m_file = aFile;
m_pcb = new BOARD( m_gerbview_frame ); m_pcb = new BOARD();
} }
...@@ -177,7 +178,7 @@ bool GBR_TO_PCB_EXPORTER::WriteGeneralDescrPcb( ) ...@@ -177,7 +178,7 @@ bool GBR_TO_PCB_EXPORTER::WriteGeneralDescrPcb( )
{ {
int nbLayers; int nbLayers;
/* Print the copper layer count */ // Print the copper layer count
nbLayers = m_pcb->GetCopperLayerCount(); nbLayers = m_pcb->GetCopperLayerCount();
if( nbLayers <= 1 ) // Minimal layers count in Pcbnew is 2 if( nbLayers <= 1 ) // Minimal layers count in Pcbnew is 2
...@@ -190,12 +191,13 @@ bool GBR_TO_PCB_EXPORTER::WriteGeneralDescrPcb( ) ...@@ -190,12 +191,13 @@ bool GBR_TO_PCB_EXPORTER::WriteGeneralDescrPcb( )
fprintf( m_file, "encoding utf-8\n"); fprintf( m_file, "encoding utf-8\n");
fprintf( m_file, "LayerCount %d\n", nbLayers ); fprintf( m_file, "LayerCount %d\n", nbLayers );
/* Compute and print the board bounding box */ // Compute and print the board bounding box
m_pcb->ComputeBoundingBox(); EDA_RECT bbbox = m_pcb->ComputeBoundingBox();
fprintf( m_file, "Di %d %d %d %d\n", fprintf( m_file, "Di %d %d %d %d\n",
m_pcb->m_BoundaryBox.GetX(), m_pcb->m_BoundaryBox.GetY(), bbbox.GetX(), bbbox.GetY(),
m_pcb->m_BoundaryBox.GetRight(), bbbox.GetRight(),
m_pcb->m_BoundaryBox.GetBottom() ); bbbox.GetBottom() );
fprintf( m_file, "$EndGENERAL\n\n" ); fprintf( m_file, "$EndGENERAL\n\n" );
return true; return true;
...@@ -237,7 +239,7 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable ) ...@@ -237,7 +239,7 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable )
SetLocaleTo_C_standard(); SetLocaleTo_C_standard();
// write PCB header // write PCB header
fprintf( m_file, "PCBNEW-BOARD Version %d date %s\n\n", g_CurrentVersionPCB, fprintf( m_file, "PCBNEW-BOARD Version %d date %s\n\n", BOARD_FILE_VERSION,
TO_UTF8( DateAndTime() ) ); TO_UTF8( DateAndTime() ) );
WriteGeneralDescrPcb( ); WriteGeneralDescrPcb( );
WriteSetup( ); WriteSetup( );
......
...@@ -61,7 +61,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father, ...@@ -61,7 +61,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
SetScreen( new PCB_SCREEN() ); SetScreen( new PCB_SCREEN() );
GetScreen()->m_CurrentSheetDesc = &g_Sheet_GERBER; GetScreen()->m_CurrentSheetDesc = &g_Sheet_GERBER;
SetBoard( new BOARD( this ) ); SetBoard( new BOARD() );
GetBoard()->SetEnabledLayers( FULL_LAYERS ); // All 32 layers enabled at first. GetBoard()->SetEnabledLayers( FULL_LAYERS ); // All 32 layers enabled at first.
GetBoard()->SetVisibleLayers( FULL_LAYERS ); // All 32 layers visible. GetBoard()->SetVisibleLayers( FULL_LAYERS ); // All 32 layers visible.
......
...@@ -62,8 +62,8 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query ) ...@@ -62,8 +62,8 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query )
} }
} }
GetBoard()->m_BoundaryBox.SetOrigin( 0, 0 ); GetBoard()->SetBoundingBox( EDA_RECT() );
GetBoard()->m_BoundaryBox.SetSize( 0, 0 );
GetBoard()->m_Status_Pcb = 0; GetBoard()->m_Status_Pcb = 0;
GetBoard()->m_NbNodes = 0; GetBoard()->m_NbNodes = 0;
GetBoard()->m_NbNoconnect = 0; GetBoard()->m_NbNoconnect = 0;
......
...@@ -176,9 +176,10 @@ public: EDA_APP(); ...@@ -176,9 +176,10 @@ public: EDA_APP();
void WriteProjectConfig( const wxString& local_config_filename, void WriteProjectConfig( const wxString& local_config_filename,
const wxString& GroupName, const wxString& GroupName,
PARAM_CFG_BASE** List ); PARAM_CFG_BASE** List );
void WriteProjectConfig( const wxString& fileName, void WriteProjectConfig( const wxString& fileName,
const wxString& GroupName, const wxString& GroupName,
PARAM_CFG_ARRAY& params ); const PARAM_CFG_ARRAY& params );
/** /**
* Function SaveCurrentSetupValues * Function SaveCurrentSetupValues
...@@ -188,7 +189,7 @@ public: EDA_APP(); ...@@ -188,7 +189,7 @@ public: EDA_APP();
* @param aList = array of PARAM_CFG_BASE pointers * @param aList = array of PARAM_CFG_BASE pointers
*/ */
void SaveCurrentSetupValues( PARAM_CFG_BASE** aList ); void SaveCurrentSetupValues( PARAM_CFG_BASE** aList );
void SaveCurrentSetupValues( PARAM_CFG_ARRAY& List ); void SaveCurrentSetupValues( const PARAM_CFG_ARRAY& List );
/** /**
* Function ReadCurrentSetupValues * Function ReadCurrentSetupValues
...@@ -198,7 +199,7 @@ public: EDA_APP(); ...@@ -198,7 +199,7 @@ public: EDA_APP();
* @param aList = array of PARAM_CFG_BASE pointers * @param aList = array of PARAM_CFG_BASE pointers
*/ */
void ReadCurrentSetupValues( PARAM_CFG_BASE** aList ); void ReadCurrentSetupValues( PARAM_CFG_BASE** aList );
void ReadCurrentSetupValues( PARAM_CFG_ARRAY& List ); void ReadCurrentSetupValues( const PARAM_CFG_ARRAY& List );
/** /**
* Function ReadProjectConfig * Function ReadProjectConfig
...@@ -220,7 +221,7 @@ public: EDA_APP(); ...@@ -220,7 +221,7 @@ public: EDA_APP();
bool Load_Only_if_New ); bool Load_Only_if_New );
bool ReadProjectConfig( const wxString& local_config_filename, bool ReadProjectConfig( const wxString& local_config_filename,
const wxString& GroupName, const wxString& GroupName,
PARAM_CFG_ARRAY& List, const PARAM_CFG_ARRAY& List,
bool Load_Only_if_New ); bool Load_Only_if_New );
/** /**
......
...@@ -12,4 +12,8 @@ class wxString; ...@@ -12,4 +12,8 @@ class wxString;
*/ */
wxString GetBuildVersion(); wxString GetBuildVersion();
/// The file format revision of the *.brd file created by this build
#define BOARD_FILE_VERSION 1
#endif // KICAD_BUILD_VERSION_H #endif // KICAD_BUILD_VERSION_H
...@@ -11,34 +11,33 @@ ...@@ -11,34 +11,33 @@
class BOARD_DESIGN_SETTINGS class BOARD_DESIGN_SETTINGS
{ {
protected: protected:
int m_CopperLayerCount; // Number of copper layers for this design int m_CopperLayerCount; ///< Number of copper layers for this design
int m_EnabledLayers; ///< Bit-mask for layer enabling
int m_VisibleLayers; ///< Bit-mask for layer visibility
int m_VisibleElements; ///< Bit-mask for element category visibility
public: public:
bool m_MicroViasAllowed; // true to allow micro vias bool m_MicroViasAllowed; ///< true to allow micro vias
int m_CurrentViaType; // via type (VIA_BLIND_BURIED, VIA_TROUGHT VIA_MICROVIA) int m_CurrentViaType; ///< via type (VIA_BLIND_BURIED, VIA_TROUGHT VIA_MICROVIA)
// if true, when creating a new track starting on an existing track, use this track width /// if true, when creating a new track starting on an existing track, use this track width
bool m_UseConnectedTrackWidth; bool m_UseConnectedTrackWidth;
int m_DrawSegmentWidth; // current graphic line width (not EDGE layer) int m_DrawSegmentWidth; ///< current graphic line width (not EDGE layer)
int m_EdgeSegmentWidth; // current graphic line width (EDGE layer only) int m_EdgeSegmentWidth; ///< current graphic line width (EDGE layer only)
int m_PcbTextWidth; // current Pcb (not module) Text width int m_PcbTextWidth; ///< current Pcb (not module) Text width
wxSize m_PcbTextSize; // current Pcb (not module) Text size wxSize m_PcbTextSize; ///< current Pcb (not module) Text size
int m_TrackMinWidth; // track min value for width ((min copper size value int m_TrackMinWidth; ///< track min value for width ((min copper size value
int m_ViasMinSize; // vias (not micro vias) min diameter int m_ViasMinSize; ///< vias (not micro vias) min diameter
int m_ViasMinDrill; // vias (not micro vias) min drill diameter int m_ViasMinDrill; ///< vias (not micro vias) min drill diameter
int m_MicroViasMinSize; // micro vias (not vias) min diameter int m_MicroViasMinSize; ///< micro vias (not vias) min diameter
int m_MicroViasMinDrill; // micro vias (not vias) min drill diameter int m_MicroViasMinDrill; ///< micro vias (not vias) min drill diameter
// Global mask margins: // Global mask margins:
int m_SolderMaskMargin; // Solder mask margin int m_SolderMaskMargin; ///< Solder mask margin
int m_SolderPasteMargin; // Solder paste margin absolute value int m_SolderPasteMargin; ///< Solder paste margin absolute value
double m_SolderPasteMarginRatio; // Solder pask margin ratio value of pad size double m_SolderPasteMarginRatio; ///< Solder pask margin ratio value of pad size
// The final margin is the sum of these 2 values ///< The final margin is the sum of these 2 values
int m_BoardThickness; // Board Thickness for 3D viewer int m_BoardThickness; ///< Board Thickness for 3D viewer
protected:
int m_EnabledLayers; // Bit-mask for layer enabling
int m_VisibleLayers; // Bit-mask for layer visibility
int m_VisibleElements; // Bit-mask for element category visibility
public: public:
BOARD_DESIGN_SETTINGS(); BOARD_DESIGN_SETTINGS();
...@@ -79,7 +78,6 @@ public: ...@@ -79,7 +78,6 @@ public:
return (bool) ( m_VisibleLayers & m_EnabledLayers & (1 << aLayerIndex) ); return (bool) ( m_VisibleLayers & m_EnabledLayers & (1 << aLayerIndex) );
} }
/** /**
* Function SetLayerVisibility * Function SetLayerVisibility
* changes the visibility of a given layer * changes the visibility of a given layer
...@@ -98,7 +96,6 @@ public: ...@@ -98,7 +96,6 @@ public:
return m_VisibleElements; return m_VisibleElements;
} }
/** /**
* Function SetVisibleElements * Function SetVisibleElements
* changes the bit-mask of visible element categories * changes the bit-mask of visible element categories
...@@ -159,7 +156,6 @@ public: ...@@ -159,7 +156,6 @@ public:
return bool( m_EnabledLayers & (1 << aLayerIndex) ); return bool( m_EnabledLayers & (1 << aLayerIndex) );
} }
/** /**
* Function GetCopperLayerCount * Function GetCopperLayerCount
* @return int - the number of neabled copper layers * @return int - the number of neabled copper layers
...@@ -169,7 +165,6 @@ public: ...@@ -169,7 +165,6 @@ public:
return m_CopperLayerCount; return m_CopperLayerCount;
} }
/** /**
* Function SetCopperLayerCount * Function SetCopperLayerCount
* do what its name says... * do what its name says...
......
...@@ -48,7 +48,6 @@ class BOARD_ITEM : public EDA_ITEM ...@@ -48,7 +48,6 @@ class BOARD_ITEM : public EDA_ITEM
void SetNext( EDA_ITEM* aNext ) { Pnext = aNext; } void SetNext( EDA_ITEM* aNext ) { Pnext = aNext; }
void SetBack( EDA_ITEM* aBack ) { Pback = aBack; } void SetBack( EDA_ITEM* aBack ) { Pback = aBack; }
protected: protected:
int m_Layer; int m_Layer;
...@@ -60,7 +59,6 @@ public: ...@@ -60,7 +59,6 @@ public:
{ {
} }
BOARD_ITEM( const BOARD_ITEM& src ) : BOARD_ITEM( const BOARD_ITEM& src ) :
EDA_ITEM( src.m_Parent, src.Type() ) EDA_ITEM( src.m_Parent, src.Type() )
, m_Layer( src.m_Layer ) , m_Layer( src.m_Layer )
...@@ -68,7 +66,6 @@ public: ...@@ -68,7 +66,6 @@ public:
m_Flags = src.m_Flags; m_Flags = src.m_Flags;
} }
/** /**
* A value of wxPoint(0,0) which can be passed to the Draw() functions. * A value of wxPoint(0,0) which can be passed to the Draw() functions.
*/ */
...@@ -107,7 +104,6 @@ public: ...@@ -107,7 +104,6 @@ public:
*/ */
virtual void SetLayer( int aLayer ) { m_Layer = aLayer; } virtual void SetLayer( int aLayer ) { m_Layer = aLayer; }
/** /**
* Function Draw * Function Draw
* BOARD_ITEMs have their own color information. * BOARD_ITEMs have their own color information.
...@@ -115,7 +111,6 @@ public: ...@@ -115,7 +111,6 @@ public:
virtual void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, virtual void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
int aDrawMode, const wxPoint& offset = ZeroOffset ) = 0; int aDrawMode, const wxPoint& offset = ZeroOffset ) = 0;
/** /**
* Function IsOnLayer * Function IsOnLayer
* tests to see if this object is on the given layer. Is virtual so * tests to see if this object is on the given layer. Is virtual so
...@@ -214,7 +209,6 @@ public: ...@@ -214,7 +209,6 @@ public:
wxMessageBox( wxT( "virtual BOARD_ITEM::Flip used, should not occur" ), GetClass() ); wxMessageBox( wxT( "virtual BOARD_ITEM::Flip used, should not occur" ), GetClass() );
} }
/** /**
* Function GetBoard * Function GetBoard
* returns the BOARD in which this BOARD_ITEM resides, or NULL if none. * returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
* @file param_config.h * @file param_config.h
*/ */
#ifndef __PARAM_CONFIG_H__ #ifndef PARAM_CONFIG_H_
#define __PARAM_CONFIG_H__ 1 #define PARAM_CONFIG_H_
#include "wx/confbase.h" #include "wx/confbase.h"
#include "wx/fileconf.h" #include "wx/fileconf.h"
...@@ -45,21 +45,23 @@ public: ...@@ -45,21 +45,23 @@ public:
const wxChar* m_Group; ///< Group name (this is like a path in the config data) const wxChar* m_Group; ///< Group name (this is like a path in the config data)
bool m_Setup; ///< Install or Project based parameter, true == install bool m_Setup; ///< Install or Project based parameter, true == install
public: PARAM_CFG_BASE( const wxChar* ident, const paramcfg_id type, const wxChar* group = NULL ); public:
PARAM_CFG_BASE( const wxChar* ident, const paramcfg_id type, const wxChar* group = NULL );
virtual ~PARAM_CFG_BASE() {}
/** /**
* Function ReadParam * Function ReadParam
* reads the value of the parameter stored in aConfig * reads the value of the parameter stored in aConfig
* @param aConfig = the wxConfigBase that holds the parameter * @param aConfig = the wxConfigBase that holds the parameter
*/ */
virtual void ReadParam( wxConfigBase* aConfig ) {}; virtual void ReadParam( wxConfigBase* aConfig ) const {};
/** /**
* Function SaveParam * Function SaveParam
* saves the value of the parameter stored in aConfig * saves the value of the parameter stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter * @param aConfig = the wxConfigBase that can store the parameter
*/ */
virtual void SaveParam( wxConfigBase* aConfig ) {}; virtual void SaveParam( wxConfigBase* aConfig ) const {};
}; };
...@@ -74,15 +76,16 @@ public: ...@@ -74,15 +76,16 @@ public:
int m_Min, m_Max; ///< Minimum and maximum values of the param type int m_Min, m_Max; ///< Minimum and maximum values of the param type
int m_Default; ///< The default value of the parameter int m_Default; ///< The default value of the parameter
public: PARAM_CFG_INT( const wxChar* ident, int* ptparam, public:
PARAM_CFG_INT( const wxChar* ident, int* ptparam,
int default_val = 0, int min = INT_MINVAL, int max = INT_MAXVAL, int default_val = 0, int min = INT_MINVAL, int max = INT_MAXVAL,
const wxChar* group = NULL ); const wxChar* group = NULL );
PARAM_CFG_INT( bool Insetup, const wxChar* ident, int* ptparam, PARAM_CFG_INT( bool Insetup, const wxChar* ident, int* ptparam,
int default_val = 0, int min = INT_MINVAL, int max = INT_MAXVAL, int default_val = 0, int min = INT_MINVAL, int max = INT_MAXVAL,
const wxChar* group = NULL ); const wxChar* group = NULL );
virtual void ReadParam( wxConfigBase* aConfig ); virtual void ReadParam( wxConfigBase* aConfig ) const;
virtual void SaveParam( wxConfigBase* aConfig ); virtual void SaveParam( wxConfigBase* aConfig ) const;
}; };
...@@ -96,13 +99,14 @@ public: ...@@ -96,13 +99,14 @@ public:
int* m_Pt_param; ///< Pointer to the parameter value int* m_Pt_param; ///< Pointer to the parameter value
int m_Default; ///< The default value of the parameter int m_Default; ///< The default value of the parameter
public: PARAM_CFG_SETCOLOR( const wxChar* ident, int* ptparam, public:
PARAM_CFG_SETCOLOR( const wxChar* ident, int* ptparam,
int default_val, const wxChar* group = NULL ); int default_val, const wxChar* group = NULL );
PARAM_CFG_SETCOLOR( bool Insetup, const wxChar* ident, int* ptparam, PARAM_CFG_SETCOLOR( bool Insetup, const wxChar* ident, int* ptparam,
int default_val, const wxChar* group = NULL ); int default_val, const wxChar* group = NULL );
virtual void ReadParam( wxConfigBase* aConfig ); virtual void ReadParam( wxConfigBase* aConfig ) const;
virtual void SaveParam( wxConfigBase* aConfig ); virtual void SaveParam( wxConfigBase* aConfig ) const;
}; };
...@@ -117,15 +121,16 @@ public: ...@@ -117,15 +121,16 @@ public:
double m_Default; ///< The default value of the parameter double m_Default; ///< The default value of the parameter
double m_Min, m_Max; ///< Minimum and maximum values of the param type double m_Min, m_Max; ///< Minimum and maximum values of the param type
public: PARAM_CFG_DOUBLE( const wxChar* ident, double* ptparam, public:
PARAM_CFG_DOUBLE( const wxChar* ident, double* ptparam,
double default_val = 0.0, double min = 0.0, double max = 10000.0, double default_val = 0.0, double min = 0.0, double max = 10000.0,
const wxChar* group = NULL ); const wxChar* group = NULL );
PARAM_CFG_DOUBLE( bool Insetup, const wxChar* ident, double* ptparam, PARAM_CFG_DOUBLE( bool Insetup, const wxChar* ident, double* ptparam,
double default_val = 0.0, double min = 0.0, double max = 10000.0, double default_val = 0.0, double min = 0.0, double max = 10000.0,
const wxChar* group = NULL ); const wxChar* group = NULL );
virtual void ReadParam( wxConfigBase* aConfig ); virtual void ReadParam( wxConfigBase* aConfig ) const;
virtual void SaveParam( wxConfigBase* aConfig ); virtual void SaveParam( wxConfigBase* aConfig ) const;
}; };
...@@ -139,13 +144,14 @@ public: ...@@ -139,13 +144,14 @@ public:
bool* m_Pt_param; ///< Pointer to the parameter value bool* m_Pt_param; ///< Pointer to the parameter value
int m_Default; ///< The default value of the parameter int m_Default; ///< The default value of the parameter
public: PARAM_CFG_BOOL( const wxChar* ident, bool* ptparam, public:
PARAM_CFG_BOOL( const wxChar* ident, bool* ptparam,
int default_val = false, const wxChar* group = NULL ); int default_val = false, const wxChar* group = NULL );
PARAM_CFG_BOOL( bool Insetup, const wxChar* ident, bool* ptparam, PARAM_CFG_BOOL( bool Insetup, const wxChar* ident, bool* ptparam,
int default_val = false, const wxChar* group = NULL ); int default_val = false, const wxChar* group = NULL );
virtual void ReadParam( wxConfigBase* aConfig ); virtual void ReadParam( wxConfigBase* aConfig ) const;
virtual void SaveParam( wxConfigBase* aConfig ); virtual void SaveParam( wxConfigBase* aConfig ) const;
}; };
...@@ -167,12 +173,11 @@ public: ...@@ -167,12 +173,11 @@ public:
const wxString& default_val = wxEmptyString, const wxString& default_val = wxEmptyString,
const wxChar* group = NULL ); const wxChar* group = NULL );
virtual ~PARAM_CFG_WXSTRING() {} virtual void ReadParam( wxConfigBase* aConfig ) const;
virtual void SaveParam( wxConfigBase* aConfig ) const;
virtual void ReadParam( wxConfigBase* aConfig );
virtual void SaveParam( wxConfigBase* aConfig );
}; };
/** /**
* Configuration parameter - PARAM_CFG_FILENAME Class * Configuration parameter - PARAM_CFG_FILENAME Class
* Same as PARAM_CFG_WXSTRING, but stores "\" as "/". * Same as PARAM_CFG_WXSTRING, but stores "\" as "/".
...@@ -184,9 +189,10 @@ class PARAM_CFG_FILENAME : public PARAM_CFG_BASE ...@@ -184,9 +189,10 @@ class PARAM_CFG_FILENAME : public PARAM_CFG_BASE
public: public:
wxString* m_Pt_param; ///< Pointer to the parameter value wxString* m_Pt_param; ///< Pointer to the parameter value
public: PARAM_CFG_FILENAME( const wxChar* ident, wxString* ptparam, const wxChar* group = NULL ); public:
virtual void ReadParam( wxConfigBase* aConfig ); PARAM_CFG_FILENAME( const wxChar* ident, wxString* ptparam, const wxChar* group = NULL );
virtual void SaveParam( wxConfigBase* aConfig ); virtual void ReadParam( wxConfigBase* aConfig ) const;
virtual void SaveParam( wxConfigBase* aConfig ) const;
}; };
...@@ -195,16 +201,17 @@ class PARAM_CFG_LIBNAME_LIST : public PARAM_CFG_BASE ...@@ -195,16 +201,17 @@ class PARAM_CFG_LIBNAME_LIST : public PARAM_CFG_BASE
public: public:
wxArrayString* m_Pt_param; ///< Pointer to the parameter value wxArrayString* m_Pt_param; ///< Pointer to the parameter value
public: PARAM_CFG_LIBNAME_LIST( const wxChar* ident, public:
PARAM_CFG_LIBNAME_LIST( const wxChar* ident,
wxArrayString* ptparam, wxArrayString* ptparam,
const wxChar* group = NULL ); const wxChar* group = NULL );
virtual void ReadParam( wxConfigBase* aConfig ); virtual void ReadParam( wxConfigBase* aConfig ) const;
virtual void SaveParam( wxConfigBase* aConfig ); virtual void SaveParam( wxConfigBase* aConfig ) const;
}; };
/** A list of parameters type */ /** A list of parameters type */
typedef boost::ptr_vector<PARAM_CFG_BASE> PARAM_CFG_ARRAY; typedef boost::ptr_vector<PARAM_CFG_BASE> PARAM_CFG_ARRAY;
#endif /* __PARAM_CONFIG_H__ */ #endif // PARAM_CONFIG_H_
...@@ -54,7 +54,7 @@ class TEXTE_MODULE; ...@@ -54,7 +54,7 @@ class TEXTE_MODULE;
class EDA_3D_FRAME; class EDA_3D_FRAME;
class GENERAL_COLLECTOR; class GENERAL_COLLECTOR;
class GENERAL_COLLECTORS_GUIDE; class GENERAL_COLLECTORS_GUIDE;
class BOARD_DESIGN_SETTINGS;
/** /**
* class PCB_BASE_FRAME * class PCB_BASE_FRAME
...@@ -80,13 +80,17 @@ public: ...@@ -80,13 +80,17 @@ public:
FOOTPRINT_EDIT_FRAME* m_ModuleEditFrame; FOOTPRINT_EDIT_FRAME* m_ModuleEditFrame;
protected: protected:
BOARD* m_Pcb; // EDA_RECT m_BoundaryBox; // Board size and position
GENERAL_COLLECTOR* m_Collector; BOARD* m_Pcb;
GENERAL_COLLECTOR* m_Collector;
void updateGridSelectBox(); void updateGridSelectBox();
void updateZoomSelectBox(); void updateZoomSelectBox();
virtual void unitsChangeRefresh(); virtual void unitsChangeRefresh();
public: public:
PCB_BASE_FRAME( wxWindow* father, int idtype, const wxString& title, PCB_BASE_FRAME( wxWindow* father, int idtype, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
...@@ -94,6 +98,14 @@ public: ...@@ -94,6 +98,14 @@ public:
~PCB_BASE_FRAME(); ~PCB_BASE_FRAME();
/**
* Function GetBoardBoundingBox
* calculates the bounding box containing all board items (or board edge segments).
* @param aBoardEdgesOnly is true if we are interested in board edge segments only.
* @return EDA_RECT - the board's bounding box
*/
EDA_RECT GetBoardBoundingBox( bool aBoardEdgesOnly = false ) const;
/** /**
* Function SetBoard * Function SetBoard
* sets the m_Pcb member in such as way as to ensure deleting any previous * sets the m_Pcb member in such as way as to ensure deleting any previous
...@@ -108,6 +120,8 @@ public: ...@@ -108,6 +120,8 @@ public:
return m_Pcb; return m_Pcb;
} }
BOARD_DESIGN_SETTINGS* GetDesignSettings();
// General // General
virtual void OnCloseWindow( wxCloseEvent& Event ) = 0; virtual void OnCloseWindow( wxCloseEvent& Event ) = 0;
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) { } virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) { }
......
...@@ -88,7 +88,6 @@ protected: ...@@ -88,7 +88,6 @@ protected:
DRC* m_drc; ///< the DRC controller, see drc.cpp DRC* m_drc; ///< the DRC controller, see drc.cpp
PARAM_CFG_ARRAY m_projectFileParams; ///< List of Pcbnew project file settings.
PARAM_CFG_ARRAY m_configSettings; ///< List of Pcbnew configuration settings. PARAM_CFG_ARRAY m_configSettings; ///< List of Pcbnew configuration settings.
wxString m_lastNetListRead; ///< Last net list read with relative path. wxString m_lastNetListRead; ///< Last net list read with relative path.
...@@ -276,16 +275,17 @@ public: ...@@ -276,16 +275,17 @@ public:
/** /**
* Function GetProjectFileParameters * Function GetProjectFileParameters
* returns the project file parameter list for Pcbnew. * returns a project file parameter list for Pcbnew.
* <p> * <p>
* Populate the project file parameter array specific to Pcbnew if it hasn't * Populate a project file parameter array specific to Pcbnew.
* already been populated and return a reference to the array to the caller.
* Creating the parameter list at run time has the advantage of being able * Creating the parameter list at run time has the advantage of being able
* to define local variables. The old method of statically building the array * to define local variables. The old method of statically building the array
* at compile time requiring global variable definitions by design. * at compile time requiring global variable definitions by design.
* </p> * </p>
* @return PARAM_CFG_ARRAY - it is only good until SetBoard() is called, so
* don't keep it around past that event.
*/ */
PARAM_CFG_ARRAY& GetProjectFileParameters(); PARAM_CFG_ARRAY GetProjectFileParameters();
void SaveProjectSettings(); void SaveProjectSettings();
...@@ -302,13 +302,13 @@ public: ...@@ -302,13 +302,13 @@ public:
* Function GetConfigurationSettings * Function GetConfigurationSettings
* returns the Pcbnew applications settings list. * returns the Pcbnew applications settings list.
* *
* This replaces the old statically define list that had the project * This replaces the old statically defined list that had the project
* file settings and the application settings mixed together. This * file settings and the application settings mixed together. This
* was confusing and caused some settings to get saved and loaded * was confusing and caused some settings to get saved and loaded
* incorrectly. Currently, only the settings that are needed at start * incorrectly. Currently, only the settings that are needed at start
* up by the main window are defined here. There are other locally used * up by the main window are defined here. There are other locally used
* settings are scattered throughout the Pcbnew source code. If you need * settings that are scattered throughout the Pcbnew source code. If you need
* to define a configuration setting that need to be loaded at run time, * to define a configuration setting that needs to be loaded at run time,
* this is the place to define it. * this is the place to define it.
* *
* @todo: Define the configuration variables as member variables instead of * @todo: Define the configuration variables as member variables instead of
......
...@@ -182,7 +182,6 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb ) ...@@ -182,7 +182,6 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
wxPoint start, current; wxPoint start, current;
int Ymax_size, Xsize_allowed; int Ymax_size, Xsize_allowed;
int pas_grille = (int) GetScreen()->GetGridSize().x; int pas_grille = (int) GetScreen()->GetGridSize().x;
bool edgesExists;
double surface; double surface;
if( GetBoard()->m_Modules == NULL ) if( GetBoard()->m_Modules == NULL )
...@@ -195,9 +194,12 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb ) ...@@ -195,9 +194,12 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
if( !IsOK( this, _( "Move modules?" ) ) ) if( !IsOK( this, _( "Move modules?" ) ) )
return; return;
edgesExists = GetBoard()->ComputeBoundingBox( true ); EDA_RECT bbbox = GetBoard()->ComputeBoundingBox( true );
if( PlaceModulesHorsPcb && !edgesExists ) bool edgesExist = ( bbbox.GetWidth() || bbbox.GetHeight() );
// no edges exist
if( PlaceModulesHorsPcb && !edgesExist )
{ {
DisplayError( this, DisplayError( this,
_( "Could not automatically place modules. No board outlines detected." ) ); _( "Could not automatically place modules. No board outlines detected." ) );
...@@ -218,12 +220,12 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb ) ...@@ -218,12 +220,12 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
/* to move modules outside the board, the cursor is placed below /* to move modules outside the board, the cursor is placed below
* the current board, to avoid placing components in board area. * the current board, to avoid placing components in board area.
*/ */
if( PlaceModulesHorsPcb && edgesExists ) if( PlaceModulesHorsPcb && edgesExist )
{ {
if( GetScreen()->GetCrossHairPosition().y < (GetBoard()->m_BoundaryBox.GetBottom() + 2000) ) if( GetScreen()->GetCrossHairPosition().y < (bbbox.GetBottom() + 2000) )
{ {
wxPoint pos = GetScreen()->GetCrossHairPosition(); wxPoint pos = GetScreen()->GetCrossHairPosition();
pos.y = GetBoard()->m_BoundaryBox.GetBottom() + 2000; pos.y = bbbox.GetBottom() + 2000;
GetScreen()->SetCrossHairPosition( pos ); GetScreen()->SetCrossHairPosition( pos );
} }
} }
...@@ -235,9 +237,9 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb ) ...@@ -235,9 +237,9 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
{ {
Module = moduleList[ii]; Module = moduleList[ii];
if( PlaceModulesHorsPcb && edgesExists ) if( PlaceModulesHorsPcb && edgesExist )
{ {
if( GetBoard()->m_BoundaryBox.Contains( Module->m_Pos ) ) if( bbbox.Contains( Module->m_Pos ) )
continue; continue;
} }
...@@ -256,9 +258,9 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb ) ...@@ -256,9 +258,9 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
if( Module->IsLocked() ) if( Module->IsLocked() )
continue; continue;
if( PlaceModulesHorsPcb && edgesExists ) if( PlaceModulesHorsPcb && edgesExist )
{ {
if( GetBoard()->m_BoundaryBox.Contains( Module->m_Pos ) ) if( bbbox.Contains( Module->m_Pos ) )
continue; continue;
} }
......
...@@ -75,6 +75,9 @@ static const float OrientPenality[11] = ...@@ -75,6 +75,9 @@ static const float OrientPenality[11] =
#define OUT_OF_BOARD -2 #define OUT_OF_BOARD -2
#define OCCUPED_By_MODULE -1 #define OCCUPED_By_MODULE -1
static EDA_RECT bbbox; // boards bounding box
static wxPoint CurrPosition; // Current position of the current module placement static wxPoint CurrPosition; // Current position of the current module placement
static bool AutoPlaceShowAll = true; static bool AutoPlaceShowAll = true;
...@@ -182,7 +185,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC ) ...@@ -182,7 +185,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
if( Module->m_ModuleStatus & MODULE_is_LOCKED ) if( Module->m_ModuleStatus & MODULE_is_LOCKED )
break; break;
if( !GetBoard()->m_BoundaryBox.Contains( Module->m_Pos ) ) if( !bbbox.Contains( Module->m_Pos ) )
Module->m_ModuleStatus |= MODULE_to_PLACE; Module->m_ModuleStatus |= MODULE_to_PLACE;
break; break;
...@@ -367,11 +370,11 @@ void PCB_EDIT_FRAME::DrawInfoPlace( wxDC* DC ) ...@@ -367,11 +370,11 @@ void PCB_EDIT_FRAME::DrawInfoPlace( wxDC* DC )
for( ii = 0; ii < Board.m_Nrows; ii++ ) for( ii = 0; ii < Board.m_Nrows; ii++ )
{ {
oy = GetBoard()->m_BoundaryBox.m_Pos.y + ( ii * Board.m_GridRouting ); oy = bbbox.m_Pos.y + ( ii * Board.m_GridRouting );
for( jj = 0; jj < Board.m_Ncols; jj++ ) for( jj = 0; jj < Board.m_Ncols; jj++ )
{ {
ox = GetBoard()->m_BoundaryBox.m_Pos.x + (jj * Board.m_GridRouting); ox = bbbox.m_Pos.x + (jj * Board.m_GridRouting);
color = BLACK; color = BLACK;
top_state = GetCell( ii, jj, TOP ); top_state = GetCell( ii, jj, TOP );
...@@ -408,28 +411,28 @@ int PCB_EDIT_FRAME::GenPlaceBoard() ...@@ -408,28 +411,28 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
Board.UnInitBoard(); Board.UnInitBoard();
if( !GetBoard()->ComputeBoundingBox( true ) ) bbbox = GetBoard()->ComputeBoundingBox( true );
if( bbbox.GetWidth() == 0 && bbbox.GetHeight() == 0 )
{ {
DisplayError( this, _( "No PCB edge found, unknown board size!" ) ); DisplayError( this, _( "No PCB edge found, unknown board size!" ) );
return 0; return 0;
} }
/* The boundary box must have its start point on placing grid: */ /* The boundary box must have its start point on placing grid: */
GetBoard()->m_BoundaryBox.m_Pos.x -= GetBoard()->m_BoundaryBox.m_Pos.x % bbbox.m_Pos.x -= bbbox.m_Pos.x % Board.m_GridRouting;
Board.m_GridRouting; bbbox.m_Pos.y -= bbbox.m_Pos.y % Board.m_GridRouting;
GetBoard()->m_BoundaryBox.m_Pos.y -= GetBoard()->m_BoundaryBox.m_Pos.y %
Board.m_GridRouting;
/* The boundary box must have its end point on placing grid: */ /* The boundary box must have its end point on placing grid: */
wxPoint end = GetBoard()->m_BoundaryBox.GetEnd(); wxPoint end = bbbox.GetEnd();
end.x -= end.x % Board.m_GridRouting; end.x -= end.x % Board.m_GridRouting;
end.x += Board.m_GridRouting; end.x += Board.m_GridRouting;
end.y -= end.y % Board.m_GridRouting; end.y -= end.y % Board.m_GridRouting;
end.y += Board.m_GridRouting; end.y += Board.m_GridRouting;
GetBoard()->m_BoundaryBox.SetEnd( end ); bbbox.SetEnd( end );
Nrows = GetBoard()->m_BoundaryBox.GetHeight() / Board.m_GridRouting; Nrows = bbbox.GetHeight() / Board.m_GridRouting;
Ncols = GetBoard()->m_BoundaryBox.GetWidth() / Board.m_GridRouting; Ncols = bbbox.GetWidth() / Board.m_GridRouting;
/* get a small margin for memory allocation: */ /* get a small margin for memory allocation: */
Ncols += 2; Nrows += 2; Ncols += 2; Nrows += 2;
NbCells = Ncols * Nrows; NbCells = Ncols * Nrows;
...@@ -533,29 +536,29 @@ void PCB_EDIT_FRAME::GenModuleOnBoard( MODULE* Module ) ...@@ -533,29 +536,29 @@ void PCB_EDIT_FRAME::GenModuleOnBoard( MODULE* Module )
oy = Module->m_BoundaryBox.m_Pos.y - marge; oy = Module->m_BoundaryBox.m_Pos.y - marge;
fy = Module->m_BoundaryBox.GetBottom() + marge; fy = Module->m_BoundaryBox.GetBottom() + marge;
if( ox < GetBoard()->m_BoundaryBox.m_Pos.x ) if( ox < bbbox.m_Pos.x )
ox = GetBoard()->m_BoundaryBox.m_Pos.x; ox = bbbox.m_Pos.x;
if( ox > GetBoard()->m_BoundaryBox.GetRight() ) if( ox > bbbox.GetRight() )
ox = GetBoard()->m_BoundaryBox.GetRight(); ox = bbbox.GetRight();
if( fx < GetBoard()->m_BoundaryBox.m_Pos.x ) if( fx < bbbox.m_Pos.x )
fx = GetBoard()->m_BoundaryBox.m_Pos.x; fx = bbbox.m_Pos.x;
if( fx > GetBoard()->m_BoundaryBox.GetRight() ) if( fx > bbbox.GetRight() )
fx = GetBoard()->m_BoundaryBox.GetRight(); fx = bbbox.GetRight();
if( oy < GetBoard()->m_BoundaryBox.m_Pos.y ) if( oy < bbbox.m_Pos.y )
oy = GetBoard()->m_BoundaryBox.m_Pos.y; oy = bbbox.m_Pos.y;
if( oy > GetBoard()->m_BoundaryBox.GetBottom() ) if( oy > bbbox.GetBottom() )
oy = GetBoard()->m_BoundaryBox.GetBottom(); oy = bbbox.GetBottom();
if( fy < GetBoard()->m_BoundaryBox.m_Pos.y ) if( fy < bbbox.m_Pos.y )
fy = GetBoard()->m_BoundaryBox.m_Pos.y; fy = bbbox.m_Pos.y;
if( fy > GetBoard()->m_BoundaryBox.GetBottom() ) if( fy > bbbox.GetBottom() )
fy = GetBoard()->m_BoundaryBox.GetBottom(); fy = bbbox.GetBottom();
layerMask = 0; layerMask = 0;
...@@ -598,8 +601,8 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC ) ...@@ -598,8 +601,8 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
aModule->DisplayInfo( this ); aModule->DisplayInfo( this );
LastPosOK.x = GetBoard()->m_BoundaryBox.m_Pos.x; LastPosOK.x = bbbox.m_Pos.x;
LastPosOK.y = GetBoard()->m_BoundaryBox.m_Pos.y; LastPosOK.y = bbbox.m_Pos.y;
cx = aModule->m_Pos.x; cy = aModule->m_Pos.y; cx = aModule->m_Pos.x; cy = aModule->m_Pos.y;
ox = aModule->m_BoundaryBox.m_Pos.x - cx; ox = aModule->m_BoundaryBox.m_Pos.x - cx;
...@@ -607,8 +610,8 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC ) ...@@ -607,8 +610,8 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
oy = aModule->m_BoundaryBox.m_Pos.y - cy; oy = aModule->m_BoundaryBox.m_Pos.y - cy;
fy = aModule->m_BoundaryBox.m_Size.y + oy; fy = aModule->m_BoundaryBox.m_Size.y + oy;
CurrPosition.x = GetBoard()->m_BoundaryBox.m_Pos.x - ox; CurrPosition.x = bbbox.m_Pos.x - ox;
CurrPosition.y = GetBoard()->m_BoundaryBox.m_Pos.y - oy; CurrPosition.y = bbbox.m_Pos.y - oy;
/* Module placement on grid. */ /* Module placement on grid. */
CurrPosition.x -= CurrPosition.x % Board.m_GridRouting; CurrPosition.x -= CurrPosition.x % Board.m_GridRouting;
...@@ -647,7 +650,7 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC ) ...@@ -647,7 +650,7 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
mincout = -1.0; mincout = -1.0;
SetStatusText( wxT( "Score ??, pos ??" ) ); SetStatusText( wxT( "Score ??, pos ??" ) );
for( ; CurrPosition.x < GetBoard()->m_BoundaryBox.GetRight() - fx; for( ; CurrPosition.x < bbbox.GetRight() - fx;
CurrPosition.x += Board.m_GridRouting ) CurrPosition.x += Board.m_GridRouting )
{ {
wxYield(); wxYield();
...@@ -667,14 +670,14 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC ) ...@@ -667,14 +670,14 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
DrawModuleOutlines( DrawPanel, aDC, aModule ); DrawModuleOutlines( DrawPanel, aDC, aModule );
g_Offset_Module.x = cx - CurrPosition.x; g_Offset_Module.x = cx - CurrPosition.x;
CurrPosition.y = GetBoard()->m_BoundaryBox.m_Pos.y - oy; CurrPosition.y = bbbox.m_Pos.y - oy;
/* Placement on grid. */ /* Placement on grid. */
CurrPosition.y -= CurrPosition.y % Board.m_GridRouting; CurrPosition.y -= CurrPosition.y % Board.m_GridRouting;
DrawModuleOutlines( DrawPanel, aDC, aModule ); DrawModuleOutlines( DrawPanel, aDC, aModule );
for( ; CurrPosition.y < GetBoard()->m_BoundaryBox.GetBottom() - fy; for( ; CurrPosition.y < bbbox.GetBottom() - fy;
CurrPosition.y += Board.m_GridRouting ) CurrPosition.y += Board.m_GridRouting )
{ {
/* Erase traces. */ /* Erase traces. */
...@@ -748,10 +751,10 @@ int TstRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1, int side ) ...@@ -748,10 +751,10 @@ int TstRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1, int side )
int row_min, row_max, col_min, col_max; int row_min, row_max, col_min, col_max;
unsigned int data; unsigned int data;
ux0 -= Pcb->m_BoundaryBox.m_Pos.x; ux0 -= Pcb->GetBoundingBox().m_Pos.x;
uy0 -= Pcb->m_BoundaryBox.m_Pos.y; uy0 -= Pcb->GetBoundingBox().m_Pos.y;
ux1 -= Pcb->m_BoundaryBox.m_Pos.x; ux1 -= Pcb->GetBoundingBox().m_Pos.x;
uy1 -= Pcb->m_BoundaryBox.m_Pos.y; uy1 -= Pcb->GetBoundingBox().m_Pos.y;
row_max = uy1 / Board.m_GridRouting; row_max = uy1 / Board.m_GridRouting;
col_max = ux1 / Board.m_GridRouting; col_max = ux1 / Board.m_GridRouting;
...@@ -805,10 +808,10 @@ unsigned int CalculateKeepOutArea( BOARD* Pcb, int ux0, int uy0, int ux1, int uy ...@@ -805,10 +808,10 @@ unsigned int CalculateKeepOutArea( BOARD* Pcb, int ux0, int uy0, int ux1, int uy
int row_min, row_max, col_min, col_max; int row_min, row_max, col_min, col_max;
unsigned int keepOut; unsigned int keepOut;
ux0 -= Pcb->m_BoundaryBox.m_Pos.x; ux0 -= Pcb->GetBoundingBox().m_Pos.x;
uy0 -= Pcb->m_BoundaryBox.m_Pos.y; uy0 -= Pcb->GetBoundingBox().m_Pos.y;
ux1 -= Pcb->m_BoundaryBox.m_Pos.x; ux1 -= Pcb->GetBoundingBox().m_Pos.x;
uy1 -= Pcb->m_BoundaryBox.m_Pos.y; uy1 -= Pcb->GetBoundingBox().m_Pos.y;
row_max = uy1 / Board.m_GridRouting; row_max = uy1 / Board.m_GridRouting;
col_max = ux1 / Board.m_GridRouting; col_max = ux1 / Board.m_GridRouting;
...@@ -979,10 +982,10 @@ static void CreateKeepOutRectangle( BOARD* Pcb, ...@@ -979,10 +982,10 @@ static void CreateKeepOutRectangle( BOARD* Pcb,
if( trace == 0 ) if( trace == 0 )
return; return;
ux0 -= Pcb->m_BoundaryBox.m_Pos.x; ux0 -= Pcb->GetBoundingBox().m_Pos.x;
uy0 -= Pcb->m_BoundaryBox.m_Pos.y; uy0 -= Pcb->GetBoundingBox().m_Pos.y;
ux1 -= Pcb->m_BoundaryBox.m_Pos.x; ux1 -= Pcb->GetBoundingBox().m_Pos.x;
uy1 -= Pcb->m_BoundaryBox.m_Pos.y; uy1 -= Pcb->GetBoundingBox().m_Pos.y;
ux0 -= marge; ux1 += marge; ux0 -= marge; ux1 += marge;
uy0 -= marge; uy1 += marge; uy0 -= marge; uy1 += marge;
......
...@@ -110,6 +110,8 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* father, ...@@ -110,6 +110,8 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* father,
PCB_BASE_FRAME::~PCB_BASE_FRAME() PCB_BASE_FRAME::~PCB_BASE_FRAME()
{ {
delete m_Collector; delete m_Collector;
// delete m_Pcb;
} }
...@@ -122,19 +124,55 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard ) ...@@ -122,19 +124,55 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
} }
EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
{
wxASSERT( m_Pcb );
EDA_RECT area = m_Pcb->ComputeBoundingBox( aBoardEdgesOnly );
if( area.GetWidth() == 0 && area.GetHeight() == 0 )
{
if( m_Draw_Sheet_Ref )
{
area.SetOrigin( 0, 0 );
area.SetEnd( GetScreen()->ReturnPageSize().x,
GetScreen()->ReturnPageSize().y );
}
else
{
area.SetOrigin( -GetScreen()->ReturnPageSize().x / 2,
-GetScreen()->ReturnPageSize().y / 2 );
area.SetEnd( GetScreen()->ReturnPageSize().x / 2,
GetScreen()->ReturnPageSize().y / 2 );
}
}
return area;
}
BOARD_DESIGN_SETTINGS* PCB_BASE_FRAME::GetDesignSettings()
{
wxASSERT( m_Pcb );
return m_Pcb ? &m_Pcb->GetDesignSettings() : NULL;
}
double PCB_BASE_FRAME::BestZoom( void ) double PCB_BASE_FRAME::BestZoom( void )
{ {
int dx, dy; int dx, dy;
double ii, jj; double ii, jj;
wxSize size; wxSize size;
if( m_Pcb == NULL ) if( m_Pcb == NULL )
return 32.0; return 32.0;
m_Pcb->ComputeBoundingBox(); EDA_RECT bbbox = GetBoardBoundingBox();
dx = bbbox.GetWidth();
dy = bbbox.GetHeight();
dx = m_Pcb->m_BoundaryBox.GetWidth();
dy = m_Pcb->m_BoundaryBox.GetHeight();
size = DrawPanel->GetClientSize(); size = DrawPanel->GetClientSize();
if( size.x ) if( size.x )
...@@ -149,7 +187,7 @@ double PCB_BASE_FRAME::BestZoom( void ) ...@@ -149,7 +187,7 @@ double PCB_BASE_FRAME::BestZoom( void )
double bestzoom = MAX( ii, jj ); double bestzoom = MAX( ii, jj );
GetScreen()->SetScrollCenterPosition( m_Pcb->m_BoundaryBox.Centre() ); GetScreen()->SetScrollCenterPosition( bbbox.Centre() );
return bestzoom ; return bestzoom ;
} }
......
...@@ -48,20 +48,25 @@ bool MATRIX_ROUTING_HEAD::ComputeMatrixSize( BOARD* aPcb ) ...@@ -48,20 +48,25 @@ bool MATRIX_ROUTING_HEAD::ComputeMatrixSize( BOARD* aPcb )
{ {
aPcb->ComputeBoundingBox(); aPcb->ComputeBoundingBox();
/* The boundary box must have its start point on routing grid: */ // The boundary box must have its start point on routing grid:
aPcb->m_BoundaryBox.m_Pos.x -= aPcb->m_BoundaryBox.m_Pos.x % m_GridRouting; m_BrdBox = aPcb->GetBoundingBox();
aPcb->m_BoundaryBox.m_Pos.y -= aPcb->m_BoundaryBox.m_Pos.y % m_GridRouting;
m_BrdBox = aPcb->m_BoundaryBox;
/* The boundary box must have its end point on routing grid: */ m_BrdBox.m_Pos.x -= m_BrdBox.m_Pos.x % m_GridRouting;
m_BrdBox.m_Pos.y -= m_BrdBox.m_Pos.y % m_GridRouting;
// The boundary box must have its end point on routing grid:
wxPoint end = m_BrdBox.GetEnd(); wxPoint end = m_BrdBox.GetEnd();
end.x -= end.x % m_GridRouting; end.x -= end.x % m_GridRouting;
end.x += m_GridRouting; end.x += m_GridRouting;
end.y -= end.y % m_GridRouting; end.y -= end.y % m_GridRouting;
end.y += m_GridRouting; end.y += m_GridRouting;
aPcb->m_BoundaryBox.SetEnd( end );
m_BrdBox.SetEnd(end); m_BrdBox.SetEnd(end);
aPcb->SetBoundingBox( m_BrdBox );
m_Nrows = Nrows = m_BrdBox.m_Size.y / m_GridRouting; m_Nrows = Nrows = m_BrdBox.m_Size.y / m_GridRouting;
m_Ncols = Ncols = m_BrdBox.m_Size.x / m_GridRouting; m_Ncols = Ncols = m_BrdBox.m_Size.x / m_GridRouting;
...@@ -330,12 +335,14 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag ) ...@@ -330,12 +335,14 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
int Build_Work( BOARD* Pcb ) int Build_Work( BOARD* Pcb )
{ {
RATSNEST_ITEM* pt_rats; RATSNEST_ITEM* pt_rats;
D_PAD* pt_pad; D_PAD* pt_pad;
int r1, r2, c1, c2, current_net_code; int r1, r2, c1, c2, current_net_code;
RATSNEST_ITEM* pt_ch; RATSNEST_ITEM* pt_ch;
int demi_pas = Board.m_GridRouting / 2; int demi_pas = Board.m_GridRouting / 2;
wxString msg; wxString msg;
EDA_RECT bbbox = Pcb->GetBoundingBox();
InitWork(); /* clear work list */ InitWork(); /* clear work list */
Ntotal = 0; Ntotal = 0;
...@@ -361,48 +368,48 @@ int Build_Work( BOARD* Pcb ) ...@@ -361,48 +368,48 @@ int Build_Work( BOARD* Pcb )
current_net_code = pt_pad->GetNet(); current_net_code = pt_pad->GetNet();
pt_ch = pt_rats; pt_ch = pt_rats;
r1 = ( pt_pad->GetPosition().y - Pcb->m_BoundaryBox.m_Pos.y r1 = ( pt_pad->GetPosition().y - bbbox.m_Pos.y
+ demi_pas ) / Board.m_GridRouting; + demi_pas ) / Board.m_GridRouting;
if( r1 < 0 || r1 >= Nrows ) if( r1 < 0 || r1 >= Nrows )
{ {
msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r1, msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r1,
pt_pad->GetPosition().y, Pcb->m_BoundaryBox.m_Pos.y ); pt_pad->GetPosition().y, bbbox.m_Pos.y );
wxMessageBox( msg ); wxMessageBox( msg );
return 0; return 0;
} }
c1 = ( pt_pad->GetPosition().x - Pcb->m_BoundaryBox.m_Pos.x c1 = ( pt_pad->GetPosition().x - bbbox.m_Pos.x
+ demi_pas ) / Board.m_GridRouting; + demi_pas ) / Board.m_GridRouting;
if( c1 < 0 || c1 >= Ncols ) if( c1 < 0 || c1 >= Ncols )
{ {
msg.Printf( wxT( "error : col = %d ( padX %d pcbX %d) " ), c1, msg.Printf( wxT( "error : col = %d ( padX %d pcbX %d) " ), c1,
pt_pad->GetPosition().x, Pcb->m_BoundaryBox.m_Pos.x ); pt_pad->GetPosition().x, bbbox.m_Pos.x );
wxMessageBox( msg ); wxMessageBox( msg );
return 0; return 0;
} }
pt_pad = pt_rats->m_PadEnd; pt_pad = pt_rats->m_PadEnd;
r2 = ( pt_pad->GetPosition().y - Pcb->m_BoundaryBox.m_Pos.y r2 = ( pt_pad->GetPosition().y - bbbox.m_Pos.y
+ demi_pas ) / Board.m_GridRouting; + demi_pas ) / Board.m_GridRouting;
if( r2 < 0 || r2 >= Nrows ) if( r2 < 0 || r2 >= Nrows )
{ {
msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r2, msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r2,
pt_pad->GetPosition().y, Pcb->m_BoundaryBox.m_Pos.y ); pt_pad->GetPosition().y, bbbox.m_Pos.y );
wxMessageBox( msg ); wxMessageBox( msg );
return 0; return 0;
} }
c2 = ( pt_pad->GetPosition().x - Pcb->m_BoundaryBox.m_Pos.x c2 = ( pt_pad->GetPosition().x - bbbox.m_Pos.x
+ demi_pas ) / Board.m_GridRouting; + demi_pas ) / Board.m_GridRouting;
if( c2 < 0 || c2 >= Ncols ) if( c2 < 0 || c2 >= Ncols )
{ {
msg.Printf( wxT( "error : col = %d ( padX %d pcbX %d) " ), c2, msg.Printf( wxT( "error : col = %d ( padX %d pcbX %d) " ), c2,
pt_pad->GetPosition().x, Pcb->m_BoundaryBox.m_Pos.x ); pt_pad->GetPosition().x, bbbox.m_Pos.x );
wxMessageBox( msg ); wxMessageBox( msg );
return 0; return 0;
} }
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "common.h" #include "common.h"
#include "pcbcommon.h" #include "pcbcommon.h"
#include "wxBasePcbFrame.h" #include "wxBasePcbFrame.h"
#include "build_version.h" // BOARD_FILE_VERSION
#include "pcbnew.h" #include "pcbnew.h"
#include "colors_selection.h" #include "colors_selection.h"
...@@ -27,18 +28,14 @@ ...@@ -27,18 +28,14 @@
wxPoint BOARD_ITEM::ZeroOffset( 0, 0 ); wxPoint BOARD_ITEM::ZeroOffset( 0, 0 );
// Current design settings (used also to read configs): BOARD::BOARD() :
BOARD_DESIGN_SETTINGS boardDesignSettings;
BOARD::BOARD( PCB_BASE_FRAME* frame ) :
BOARD_ITEM( (BOARD_ITEM*) NULL, PCB_T ), BOARD_ITEM( (BOARD_ITEM*) NULL, PCB_T ),
m_NetClasses( this ) m_NetClasses( this )
{ {
m_PcbFrame = frame; // we have not loaded a board yet, assume latest until then.
m_fileFormatVersionAtLoad = BOARD_FILE_VERSION;
m_Status_Pcb = 0; // Status word: bit 1 = calculate. m_Status_Pcb = 0; // Status word: bit 1 = calculate.
SetBoardDesignSettings( &boardDesignSettings );
SetColorsSettings( &g_ColorsSettings ); SetColorsSettings( &g_ColorsSettings );
m_NbNodes = 0; // Number of connected pads. m_NbNodes = 0; // Number of connected pads.
m_NbNoconnect = 0; // Number of unconnected nets. m_NbNoconnect = 0; // Number of unconnected nets.
...@@ -69,8 +66,12 @@ BOARD::BOARD( PCB_BASE_FRAME* frame ) : ...@@ -69,8 +66,12 @@ BOARD::BOARD( PCB_BASE_FRAME* frame ) :
BOARD::~BOARD() BOARD::~BOARD()
{ {
/* @todo
NO! this has nothing to do with a BOARD
Do this in the UI, not in the storage container please.
if( m_PcbFrame && m_PcbFrame->GetScreen() ) if( m_PcbFrame && m_PcbFrame->GetScreen() )
m_PcbFrame->GetScreen()->ClearUndoRedoList(); m_PcbFrame->GetScreen()->ClearUndoRedoList();
*/
while( m_ZoneDescriptorList.size() ) while( m_ZoneDescriptorList.size() )
{ {
...@@ -92,6 +93,13 @@ BOARD::~BOARD() ...@@ -92,6 +93,13 @@ BOARD::~BOARD()
} }
void BOARD::SetDesignSettings( const BOARD_DESIGN_SETTINGS& aDesignSettings )
{
// copy all members.
m_designSettings = aDesignSettings;
}
void BOARD::chainMarkedSegments( wxPoint aPosition, int aLayerMask, TRACK_PTRS* aList ) void BOARD::chainMarkedSegments( wxPoint aPosition, int aLayerMask, TRACK_PTRS* aList )
{ {
TRACK* segment; // The current segment being analyzed. TRACK* segment; // The current segment being analyzed.
...@@ -466,36 +474,36 @@ LAYER_T LAYER::ParseType( const char* aType ) ...@@ -466,36 +474,36 @@ LAYER_T LAYER::ParseType( const char* aType )
int BOARD::GetCopperLayerCount() const int BOARD::GetCopperLayerCount() const
{ {
return GetBoardDesignSettings()->GetCopperLayerCount(); return m_designSettings.GetCopperLayerCount();
} }
void BOARD::SetCopperLayerCount( int aCount ) void BOARD::SetCopperLayerCount( int aCount )
{ {
GetBoardDesignSettings()->SetCopperLayerCount( aCount ); m_designSettings.SetCopperLayerCount( aCount );
} }
int BOARD::GetEnabledLayers() const int BOARD::GetEnabledLayers() const
{ {
return GetBoardDesignSettings()->GetEnabledLayers(); return m_designSettings.GetEnabledLayers();
} }
int BOARD::GetVisibleLayers() const int BOARD::GetVisibleLayers() const
{ {
return GetBoardDesignSettings()->GetVisibleLayers(); return m_designSettings.GetVisibleLayers();
} }
void BOARD::SetEnabledLayers( int aLayerMask ) void BOARD::SetEnabledLayers( int aLayerMask )
{ {
GetBoardDesignSettings()->SetEnabledLayers( aLayerMask ); m_designSettings.SetEnabledLayers( aLayerMask );
} }
void BOARD::SetVisibleLayers( int aLayerMask ) void BOARD::SetVisibleLayers( int aLayerMask )
{ {
GetBoardDesignSettings()->SetVisibleLayers( aLayerMask ); m_designSettings.SetVisibleLayers( aLayerMask );
} }
...@@ -529,13 +537,13 @@ void BOARD::SetVisibleAlls( ) ...@@ -529,13 +537,13 @@ void BOARD::SetVisibleAlls( )
int BOARD::GetVisibleElements() const int BOARD::GetVisibleElements() const
{ {
return GetBoardDesignSettings()->GetVisibleElements(); return m_designSettings.GetVisibleElements();
} }
bool BOARD::IsElementVisible( int aPCB_VISIBLE ) const bool BOARD::IsElementVisible( int aPCB_VISIBLE ) const
{ {
return GetBoardDesignSettings()->IsElementVisible( aPCB_VISIBLE ); return m_designSettings.IsElementVisible( aPCB_VISIBLE );
} }
...@@ -544,7 +552,7 @@ void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled ) ...@@ -544,7 +552,7 @@ void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled )
switch( aPCB_VISIBLE ) switch( aPCB_VISIBLE )
{ {
case RATSNEST_VISIBLE: case RATSNEST_VISIBLE:
GetBoardDesignSettings()->SetElementVisibility( aPCB_VISIBLE, isEnabled ); m_designSettings.SetElementVisibility( aPCB_VISIBLE, isEnabled );
// we must clear or set the CH_VISIBLE flags to hide/show ratsnet // we must clear or set the CH_VISIBLE flags to hide/show ratsnet
// because we have a tool to show hide ratsnest relative to a pad or a module // because we have a tool to show hide ratsnest relative to a pad or a module
// so the hide/show option is a per item selection // so the hide/show option is a per item selection
...@@ -563,7 +571,7 @@ void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled ) ...@@ -563,7 +571,7 @@ void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled )
default: default:
GetBoardDesignSettings()->SetElementVisibility( aPCB_VISIBLE, isEnabled ); m_designSettings.SetElementVisibility( aPCB_VISIBLE, isEnabled );
} }
} }
...@@ -829,7 +837,7 @@ unsigned BOARD::GetNodesCount() ...@@ -829,7 +837,7 @@ unsigned BOARD::GetNodesCount()
} }
bool BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) EDA_RECT BOARD::ComputeBoundingBox( bool aBoardEdgesOnly )
{ {
bool hasItems = false; bool hasItems = false;
EDA_RECT area; EDA_RECT area;
...@@ -898,26 +906,9 @@ bool BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) ...@@ -898,26 +906,9 @@ bool BOARD::ComputeBoundingBox( bool aBoardEdgesOnly )
} }
} }
if( !hasItems && m_PcbFrame ) m_BoundingBox = area; // save for BOARD::GetBoundingBox()
{
if( m_PcbFrame->m_Draw_Sheet_Ref )
{
area.SetOrigin( 0, 0 );
area.SetEnd( m_PcbFrame->GetScreen()->ReturnPageSize().x,
m_PcbFrame->GetScreen()->ReturnPageSize().y );
}
else
{
area.SetOrigin( -m_PcbFrame->GetScreen()->ReturnPageSize().x / 2,
-m_PcbFrame->GetScreen()->ReturnPageSize().y / 2 );
area.SetEnd( m_PcbFrame->GetScreen()->ReturnPageSize().x / 2,
m_PcbFrame->GetScreen()->ReturnPageSize().y / 2 );
}
}
m_BoundaryBox = area;
return hasItems; return area;
} }
...@@ -1782,7 +1773,7 @@ TRACK* BOARD::GetTrace( TRACK* aTrace, const wxPoint& aPosition, int aLayerMask ...@@ -1782,7 +1773,7 @@ TRACK* BOARD::GetTrace( TRACK* aTrace, const wxPoint& aPosition, int aLayerMask
if( track->GetState( BUSY | IS_DELETED ) ) if( track->GetState( BUSY | IS_DELETED ) )
continue; continue;
if( GetBoardDesignSettings()->IsLayerVisible( layer ) == false ) if( m_designSettings.IsLayerVisible( layer ) == false )
continue; continue;
if( track->Type() == PCB_VIA_T ) /* VIA encountered. */ if( track->Type() == PCB_VIA_T ) /* VIA encountered. */
......
...@@ -152,28 +152,24 @@ private: ...@@ -152,28 +152,24 @@ private:
typedef std::vector<MARKER_PCB*> MARKERS; typedef std::vector<MARKER_PCB*> MARKERS;
/// MARKER_PCBs for clearance problems, owned by pointer. /// MARKER_PCBs for clearance problems, owned by pointer.
MARKERS m_markers; MARKERS m_markers;
// @todo: switch to boost::ptr_vector, and change ~BOARD() // @todo: switch to boost::ptr_vector, and change ~BOARD()
typedef std::vector<ZONE_CONTAINER*> ZONE_CONTAINERS; typedef std::vector<ZONE_CONTAINER*> ZONE_CONTAINERS;
/// edge zone descriptors, owned by pointer. /// edge zone descriptors, owned by pointer.
ZONE_CONTAINERS m_ZoneDescriptorList; ZONE_CONTAINERS m_ZoneDescriptorList;
LAYER m_Layer[NB_COPPER_LAYERS]; LAYER m_Layer[NB_COPPER_LAYERS];
// if true m_hightLight_NetCode is used // if true m_hightLight_NetCode is used
HIGH_LIGHT_INFO m_hightLight; // current high light data HIGH_LIGHT_INFO m_hightLight; // current high light data
HIGH_LIGHT_INFO m_hightLightPrevious; // a previously stored high light data HIGH_LIGHT_INFO m_hightLightPrevious; // a previously stored high light data
public: int m_fileFormatVersionAtLoad; ///< the version in the *.brd header on first line
PCB_BASE_FRAME* m_PcbFrame; // Window of visualization
void SetWindowFrame( PCB_BASE_FRAME* aFrame ) EDA_RECT m_BoundingBox;
{
m_PcbFrame = aFrame;
}
EDA_RECT m_BoundaryBox; // Board size and position public:
/// Flags used in ratsnest calculation and update. /// Flags used in ratsnest calculation and update.
int m_Status_Pcb; int m_Status_Pcb;
...@@ -184,29 +180,29 @@ public: ...@@ -184,29 +180,29 @@ public:
/// Active ratsnest count (ratsnests not already connected by tracks) /// Active ratsnest count (ratsnests not already connected by tracks)
int m_NbNoconnect; int m_NbNoconnect;
DLIST<BOARD_ITEM> m_Drawings; // linked list of lines & texts DLIST<BOARD_ITEM> m_Drawings; // linked list of lines & texts
DLIST<MODULE> m_Modules; // linked list of MODULEs DLIST<MODULE> m_Modules; // linked list of MODULEs
DLIST<TRACK> m_Track; // linked list of TRACKs and SEGVIAs DLIST<TRACK> m_Track; // linked list of TRACKs and SEGVIAs
DLIST<SEGZONE> m_Zone; // linked list of SEGZONEs DLIST<SEGZONE> m_Zone; // linked list of SEGZONEs
/// nets info list (name, design constraints .. /// nets info list (name, design constraints ..
NETINFO_LIST* m_NetInfo; NETINFO_LIST* m_NetInfo;
/// Ratsnest list for the BOARD /// Ratsnest list for the BOARD
std::vector<RATSNEST_ITEM> m_FullRatsnest; std::vector<RATSNEST_ITEM> m_FullRatsnest;
/// Ratsnest list relative to a given footprint (used while moving a footprint). /// Ratsnest list relative to a given footprint (used while moving a footprint).
std::vector<RATSNEST_ITEM> m_LocalRatsnest; std::vector<RATSNEST_ITEM> m_LocalRatsnest;
/// zone contour currently in progress /// zone contour currently in progress
ZONE_CONTAINER* m_CurrentZoneContour; ZONE_CONTAINER* m_CurrentZoneContour;
/// List of current netclasses. There is always the default netclass. /// List of current netclasses. There is always the default netclass.
NETCLASSES m_NetClasses; NETCLASSES m_NetClasses;
/// Current net class name used to display netclass info. /// Current net class name used to display netclass info.
/// This is also the last used netclass after starting a track. /// This is also the last used netclass after starting a track.
wxString m_CurrentNetClassName; wxString m_CurrentNetClassName;
// handling of vias and tracks size: // handling of vias and tracks size:
// the first value is always the value of the current NetClass // the first value is always the value of the current NetClass
...@@ -228,7 +224,7 @@ public: ...@@ -228,7 +224,7 @@ public:
unsigned m_TrackWidthSelector; unsigned m_TrackWidthSelector;
private: private:
BOARD_DESIGN_SETTINGS* m_boardDesignSettings; // Link to current design settings BOARD_DESIGN_SETTINGS m_designSettings;
COLORS_DESIGN_SETTINGS* m_colorsSettings; // Link to current colors settings COLORS_DESIGN_SETTINGS* m_colorsSettings; // Link to current colors settings
/** /**
...@@ -243,9 +239,13 @@ private: ...@@ -243,9 +239,13 @@ private:
void chainMarkedSegments( wxPoint aPosition, int aLayerMask, TRACK_PTRS* aList ); void chainMarkedSegments( wxPoint aPosition, int aLayerMask, TRACK_PTRS* aList );
public: public:
BOARD( PCB_BASE_FRAME* frame ); BOARD();
~BOARD(); ~BOARD();
void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; }
int GetFileFormatVersionAtLoad() const { return m_fileFormatVersionAtLoad; }
/** /**
* Function GetDefaultLayerName * Function GetDefaultLayerName
* returns a default name of a PCB layer when given \a aLayerNumber. This * returns a default name of a PCB layer when given \a aLayerNumber. This
...@@ -275,7 +275,6 @@ public: ...@@ -275,7 +275,6 @@ public:
#define ADD_APPEND 1 ///< aControl flag for Add( aControl ), appends not inserts #define ADD_APPEND 1 ///< aControl flag for Add( aControl ), appends not inserts
/** /**
* Function Delete * Function Delete
* removes the given single item from this BOARD and deletes its memory. * removes the given single item from this BOARD and deletes its memory.
...@@ -427,7 +426,7 @@ public: ...@@ -427,7 +426,7 @@ public:
*/ */
bool IsLayerEnabled( int aLayer ) const bool IsLayerEnabled( int aLayer ) const
{ {
return GetBoardDesignSettings()->IsLayerEnabled( aLayer ); return m_designSettings.IsLayerEnabled( aLayer );
} }
/** /**
...@@ -439,7 +438,7 @@ public: ...@@ -439,7 +438,7 @@ public:
*/ */
bool IsLayerVisible( int aLayerIndex ) const bool IsLayerVisible( int aLayerIndex ) const
{ {
return GetBoardDesignSettings()->IsLayerVisible( aLayerIndex ); return m_designSettings.IsLayerVisible( aLayerIndex );
} }
/** /**
...@@ -524,24 +523,20 @@ public: ...@@ -524,24 +523,20 @@ public:
void SetVisibleElementColor( int aPCB_VISIBLE, int aColor ); void SetVisibleElementColor( int aPCB_VISIBLE, int aColor );
/** /**
* Function GetBoardDesignSettings * Function GetDesignSettings
* @return the current BOARD_DESIGN_SETTINGS in use * @return the BOARD_DESIGN_SETTINGS for this BOARD
*/ */
BOARD_DESIGN_SETTINGS* GetBoardDesignSettings() const // const BOARD_DESIGN_SETTINGS& GetDesignSettings() const want to use this one
BOARD_DESIGN_SETTINGS& GetDesignSettings()
{ {
return m_boardDesignSettings; return m_designSettings;
} }
/** /**
* Function SetBoardDesignSettings * Function SetDesignSettings
* @param aDesignSettings = the new BOARD_DESIGN_SETTINGS to use * @param aDesignSettings the new BOARD_DESIGN_SETTINGS to use
*/ */
void SetBoardDesignSettings( BOARD_DESIGN_SETTINGS* aDesignSettings) void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aDesignSettings );
{
m_boardDesignSettings = aDesignSettings;
}
/** /**
* Function SetBoardSettings * Function SetBoardSettings
...@@ -652,9 +647,20 @@ public: ...@@ -652,9 +647,20 @@ public:
* Function ComputeBoundingBox * Function ComputeBoundingBox
* calculates the bounding box containing all board items (or board edge segments). * calculates the bounding box containing all board items (or board edge segments).
* @param aBoardEdgesOnly is true if we are interested in board edge segments only. * @param aBoardEdgesOnly is true if we are interested in board edge segments only.
* @return bool - True if items (or board edge segments) were found. * @return EDA_RECT - the board's bounding box
* @see PCB_BASE_FRAME::GetBoardBoundingBox() which calls this and doctors the result
*/ */
bool ComputeBoundingBox( bool aBoardEdgesOnly = false ); EDA_RECT ComputeBoundingBox( bool aBoardEdgesOnly = false );
/**
* Function GetBoundingBox
* may be called soon after ComputeBoundingBox() to return the same EDA_RECT,
* as long as the BOARD has not changed. Remember, ComputeBoundingBox()'s
* aBoardEdgesOnly argument is considered in this return value also.
*/
EDA_RECT GetBoundingBox() const { return m_BoundingBox; } // override
void SetBoundingBox( const EDA_RECT& aBox ) { m_BoundingBox = aBox; }
/** /**
* Function DisplayInfo * Function DisplayInfo
......
...@@ -17,7 +17,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() ...@@ -17,7 +17,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS()
{ {
m_EnabledLayers = ALL_LAYERS; // All layers enabled at first. m_EnabledLayers = ALL_LAYERS; // All layers enabled at first.
// SetCopperLayerCount() will adjust this. // SetCopperLayerCount() will adjust this.
SetVisibleAlls( ); // All layers and all elements visible at first. SetVisibleAlls(); // All layers and all elements visible at first.
SetCopperLayerCount( 2 ); // Default design is a double sided board SetCopperLayerCount( 2 ); // Default design is a double sided board
...@@ -47,7 +47,6 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() ...@@ -47,7 +47,6 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS()
// Layer thickness for 3D viewer // Layer thickness for 3D viewer
m_BoardThickness = (int)(1.6 * PCB_INTERNAL_UNIT / 25.4); m_BoardThickness = (int)(1.6 * PCB_INTERNAL_UNIT / 25.4);
} }
......
...@@ -35,11 +35,9 @@ ...@@ -35,11 +35,9 @@
#include "class_netclass.h" #include "class_netclass.h"
// Current design settings (used also to read configs):
extern BOARD_DESIGN_SETTINGS boardDesignSettings;
// This will get mapped to "kicad_default" in the specctra_export. // This will get mapped to "kicad_default" in the specctra_export.
const wxString NETCLASS::Default = wxT("Default"); const wxString NETCLASS::Default = wxT("Default");
// Initial values for netclass initialization // Initial values for netclass initialization
int NETCLASS::DEFAULT_CLEARANCE = 100; // track to track and track to pads clearance int NETCLASS::DEFAULT_CLEARANCE = 100; // track to track and track to pads clearance
int NETCLASS::DEFAULT_VIA_DRILL = 250; // default via drill int NETCLASS::DEFAULT_VIA_DRILL = 250; // default via drill
...@@ -68,16 +66,17 @@ void NETCLASS::SetParams( const NETCLASS* defaults ) ...@@ -68,16 +66,17 @@ void NETCLASS::SetParams( const NETCLASS* defaults )
SetuViaDrill( defaults->GetuViaDrill() ); SetuViaDrill( defaults->GetuViaDrill() );
} }
else else
{ // We should use m_Parent->GetBoardDesignSettings() { // We should use m_Parent->GetDesignSettings()
// But when the NETCLASSES constructor is called // But when the NETCLASSES constructor is called
// (it call NETCLASS constructor), the m_Parent constructor (see BOARD::BOARD) // (it call NETCLASS constructor), the m_Parent constructor (see BOARD::BOARD)
// is not run, and GetBoardDesignSettings() return a bad value // is not run, and GetDesignSettings() return a bad value
// TODO: see how change that. // TODO: see how change that.
const BOARD_DESIGN_SETTINGS& g = boardDesignSettings; const BOARD_DESIGN_SETTINGS& g = m_Parent->GetDesignSettings(); // like that?
SetTrackWidth( g.m_TrackMinWidth ); SetTrackWidth( g.m_TrackMinWidth );
SetViaDiameter( g.m_ViasMinSize ); SetViaDiameter( g.m_ViasMinSize );
SetuViaDiameter(g.m_MicroViasMinSize ); SetuViaDiameter(g.m_MicroViasMinSize );
// Use default values for next parameters: // Use default values for next parameters:
SetClearance( DEFAULT_CLEARANCE ); SetClearance( DEFAULT_CLEARANCE );
SetViaDrill( DEFAULT_VIA_DRILL ); SetViaDrill( DEFAULT_VIA_DRILL );
...@@ -410,27 +409,26 @@ bool NETCLASS::ReadDescr( LINE_READER* aReader ) ...@@ -410,27 +409,26 @@ bool NETCLASS::ReadDescr( LINE_READER* aReader )
int NETCLASS::GetTrackMinWidth() const int NETCLASS::GetTrackMinWidth() const
{ {
return m_Parent->GetBoardDesignSettings()->m_TrackMinWidth; return m_Parent->GetDesignSettings().m_TrackMinWidth;
} }
int NETCLASS::GetViaMinDiameter() const int NETCLASS::GetViaMinDiameter() const
{ {
return m_Parent->GetBoardDesignSettings()->m_ViasMinSize; return m_Parent->GetDesignSettings().m_ViasMinSize;
} }
int NETCLASS::GetViaMinDrill() const int NETCLASS::GetViaMinDrill() const
{ {
return m_Parent->GetBoardDesignSettings()->m_ViasMinDrill; return m_Parent->GetDesignSettings().m_ViasMinDrill;
} }
int NETCLASS::GetuViaMinDiameter() const int NETCLASS::GetuViaMinDiameter() const
{ {
return m_Parent->GetBoardDesignSettings()->m_MicroViasMinSize; return m_Parent->GetDesignSettings().m_MicroViasMinSize;
} }
int NETCLASS::GetuViaMinDrill() const int NETCLASS::GetuViaMinDrill() const
{ {
return m_Parent->GetBoardDesignSettings()->m_MicroViasMinDrill; return m_Parent->GetDesignSettings().m_MicroViasMinDrill;
} }
...@@ -304,7 +304,7 @@ int D_PAD::GetSolderMaskMargin() ...@@ -304,7 +304,7 @@ int D_PAD::GetSolderMaskMargin()
if( margin == 0 ) if( margin == 0 )
{ {
BOARD * brd = GetBoard(); BOARD * brd = GetBoard();
margin = brd->GetBoardDesignSettings()->m_SolderMaskMargin; margin = brd->GetDesignSettings().m_SolderMaskMargin;
} }
} }
...@@ -344,14 +344,14 @@ wxSize D_PAD::GetSolderPasteMargin() ...@@ -344,14 +344,14 @@ wxSize D_PAD::GetSolderPasteMargin()
BOARD * brd = GetBoard(); BOARD * brd = GetBoard();
if( margin == 0 ) if( margin == 0 )
margin = brd->GetBoardDesignSettings()->m_SolderPasteMargin; margin = brd->GetDesignSettings().m_SolderPasteMargin;
if( mratio == 0.0 ) if( mratio == 0.0 )
mratio = module->m_LocalSolderPasteMarginRatio; mratio = module->m_LocalSolderPasteMarginRatio;
if( mratio == 0.0 ) if( mratio == 0.0 )
{ {
mratio = brd->GetBoardDesignSettings()->m_SolderPasteMarginRatio; mratio = brd->GetDesignSettings().m_SolderPasteMarginRatio;
} }
} }
......
...@@ -59,7 +59,7 @@ public: ...@@ -59,7 +59,7 @@ public:
} }
void SetVisible( bool isVisible ) { m_NoShow = !isVisible; } void SetVisible( bool isVisible ) { m_NoShow = !isVisible; }
void SetInvisible( bool isHidden ) { m_NoShow = isHidden; } bool IsVisible() const { return !m_NoShow; }
void SetPos0( const wxPoint& aPos ) { m_Pos0 = aPos; } void SetPos0( const wxPoint& aPos ) { m_Pos0 = aPos; }
......
...@@ -843,16 +843,22 @@ bool ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos ) ...@@ -843,16 +843,22 @@ bool ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
m_CornerSelection = -1; // Set to not found m_CornerSelection = -1; // Set to not found
// distance (in internal units) to detect a corner in a zone outline. // distance (in internal units) to detect a corner in a zone outline.
// @todo use a scaling factor here of actual screen coordinates, so that
// when nanometers come, it still works.
#define CORNER_MIN_DIST 100 #define CORNER_MIN_DIST 100
int min_dist = CORNER_MIN_DIST + 1; int min_dist = CORNER_MIN_DIST + 1;
#if 0
// Dick: I don't see this as reasonable. The mouse distance from the zone is
// not a function of the grid, it is a fixed number of pixels, regardless of zoom.
if( GetBoard() && GetBoard()->m_PcbFrame ) if( GetBoard() && GetBoard()->m_PcbFrame )
{ {
// Use grid size because it is known // Use grid size because it is known
wxRealPoint grid = GetBoard()->m_PcbFrame->DrawPanel->GetGrid(); wxRealPoint grid = GetBoard()->m_PcbFrame->DrawPanel->GetGrid();
min_dist = wxRound( MIN( grid.x, grid.y ) ); min_dist = wxRound( MIN( grid.x, grid.y ) );
} }
#endif
wxPoint delta; wxPoint delta;
unsigned lim = m_Poly->corner.size(); unsigned lim = m_Poly->corner.size();
...@@ -861,6 +867,7 @@ bool ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos ) ...@@ -861,6 +867,7 @@ bool ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
{ {
delta.x = refPos.x - m_Poly->corner[item_pos].x; delta.x = refPos.x - m_Poly->corner[item_pos].x;
delta.y = refPos.y - m_Poly->corner[item_pos].y; delta.y = refPos.y - m_Poly->corner[item_pos].y;
// Calculate a distance: // Calculate a distance:
int dist = MAX( abs( delta.x ), abs( delta.y ) ); int dist = MAX( abs( delta.x ), abs( delta.y ) );
...@@ -881,15 +888,23 @@ bool ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos ) ...@@ -881,15 +888,23 @@ bool ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos )
m_CornerSelection = -1; // Set to not found m_CornerSelection = -1; // Set to not found
// @todo use a scaling factor here of actual screen coordinates, so that
// when nanometers come, it still works. This should be done in screen coordinates
// not internal units.
#define EDGE_MIN_DIST 200 // distance (in internal units) to detect a zone outline #define EDGE_MIN_DIST 200 // distance (in internal units) to detect a zone outline
int min_dist = EDGE_MIN_DIST+1; int min_dist = EDGE_MIN_DIST+1;
#if 0
// Dick: I don't see this as reasonable. The mouse distance from the zone is
// not a function of the grid, it is a fixed number of pixels, regardless of zoom.
if( GetBoard() && GetBoard()->m_PcbFrame ) if( GetBoard() && GetBoard()->m_PcbFrame )
{ {
// Use grid size because it is known // Use grid size because it is known
wxRealPoint grid = GetBoard()->m_PcbFrame->DrawPanel->GetGrid(); wxRealPoint grid = GetBoard()->m_PcbFrame->DrawPanel->GetGrid();
min_dist = wxRound( MIN( grid.x, grid.y ) ); min_dist = wxRound( MIN( grid.x, grid.y ) );
} }
#endif
unsigned first_corner_pos = 0; unsigned first_corner_pos = 0;
......
...@@ -213,18 +213,18 @@ void DIALOG_DESIGN_RULES::PrintCurrentSettings() ...@@ -213,18 +213,18 @@ void DIALOG_DESIGN_RULES::PrintCurrentSettings()
// Display min values: // Display min values:
value = ReturnStringFromValue( g_UserUnit, value = ReturnStringFromValue( g_UserUnit,
m_BrdSettings->m_TrackMinWidth, m_BrdSettings.m_TrackMinWidth,
internal_units, internal_units,
true ); true );
msg.Printf( _( "Minimum value for tracks width: <b>%s</b><br>\n" ), GetChars( value ) ); msg.Printf( _( "Minimum value for tracks width: <b>%s</b><br>\n" ), GetChars( value ) );
m_MessagesList->AppendToPage( msg ); m_MessagesList->AppendToPage( msg );
value = ReturnStringFromValue( g_UserUnit, m_BrdSettings->m_ViasMinSize, internal_units, true ); value = ReturnStringFromValue( g_UserUnit, m_BrdSettings.m_ViasMinSize, internal_units, true );
msg.Printf( _( "Minimum value for vias diameter: <b>%s</b><br>\n" ), GetChars( value ) ); msg.Printf( _( "Minimum value for vias diameter: <b>%s</b><br>\n" ), GetChars( value ) );
m_MessagesList->AppendToPage( msg ); m_MessagesList->AppendToPage( msg );
value = ReturnStringFromValue( g_UserUnit, value = ReturnStringFromValue( g_UserUnit,
m_BrdSettings->m_MicroViasMinSize, m_BrdSettings.m_MicroViasMinSize,
internal_units, internal_units,
true ); true );
msg.Printf( _( "Minimum value for microvias diameter: <b>%s</b><br>\n" ), GetChars( value ) ); msg.Printf( _( "Minimum value for microvias diameter: <b>%s</b><br>\n" ), GetChars( value ) );
...@@ -240,7 +240,7 @@ void DIALOG_DESIGN_RULES::InitDialogRules() ...@@ -240,7 +240,7 @@ void DIALOG_DESIGN_RULES::InitDialogRules()
SetReturnCode( 0 ); SetReturnCode( 0 );
m_Pcb = m_Parent->GetBoard(); m_Pcb = m_Parent->GetBoard();
m_BrdSettings = m_Pcb->GetBoardDesignSettings(); m_BrdSettings = m_Pcb->GetDesignSettings();
// Initialize the Rules List // Initialize the Rules List
InitRulesList(); InitRulesList();
...@@ -291,21 +291,21 @@ void DIALOG_DESIGN_RULES::InitGlobalRules() ...@@ -291,21 +291,21 @@ void DIALOG_DESIGN_RULES::InitGlobalRules()
AddUnitSymbol( *m_TrackMinWidthTitle ); AddUnitSymbol( *m_TrackMinWidthTitle );
int Internal_Unit = m_Parent->m_InternalUnits; int Internal_Unit = m_Parent->m_InternalUnits;
PutValueInLocalUnits( *m_SetViasMinSizeCtrl, m_BrdSettings->m_ViasMinSize, Internal_Unit ); PutValueInLocalUnits( *m_SetViasMinSizeCtrl, m_BrdSettings.m_ViasMinSize, Internal_Unit );
PutValueInLocalUnits( *m_SetViasMinDrillCtrl, m_BrdSettings->m_ViasMinDrill, Internal_Unit ); PutValueInLocalUnits( *m_SetViasMinDrillCtrl, m_BrdSettings.m_ViasMinDrill, Internal_Unit );
if( m_BrdSettings->m_CurrentViaType != VIA_THROUGH ) if( m_BrdSettings.m_CurrentViaType != VIA_THROUGH )
m_OptViaType->SetSelection( 1 ); m_OptViaType->SetSelection( 1 );
m_AllowMicroViaCtrl->SetSelection( m_BrdSettings->m_MicroViasAllowed ? 1 : 0 ); m_AllowMicroViaCtrl->SetSelection( m_BrdSettings.m_MicroViasAllowed ? 1 : 0 );
PutValueInLocalUnits( *m_SetMicroViasMinSizeCtrl, PutValueInLocalUnits( *m_SetMicroViasMinSizeCtrl,
m_BrdSettings->m_MicroViasMinSize, m_BrdSettings.m_MicroViasMinSize,
Internal_Unit ); Internal_Unit );
PutValueInLocalUnits( *m_SetMicroViasMinDrillCtrl, PutValueInLocalUnits( *m_SetMicroViasMinDrillCtrl,
m_BrdSettings->m_MicroViasMinDrill, m_BrdSettings.m_MicroViasMinDrill,
Internal_Unit ); Internal_Unit );
PutValueInLocalUnits( *m_SetTrackMinWidthCtrl, m_BrdSettings->m_TrackMinWidth, Internal_Unit ); PutValueInLocalUnits( *m_SetTrackMinWidthCtrl, m_BrdSettings.m_TrackMinWidth, Internal_Unit );
// Initialize Vias and Tracks sizes lists. // Initialize Vias and Tracks sizes lists.
// note we display only extra values, never the current netclass value. // note we display only extra values, never the current netclass value.
...@@ -605,26 +605,26 @@ void DIALOG_DESIGN_RULES::CopyRulesListToBoard() ...@@ -605,26 +605,26 @@ void DIALOG_DESIGN_RULES::CopyRulesListToBoard()
void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard() void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard()
/*************************************************/ /*************************************************/
{ {
m_BrdSettings->m_CurrentViaType = VIA_THROUGH; m_BrdSettings.m_CurrentViaType = VIA_THROUGH;
if( m_OptViaType->GetSelection() > 0 ) if( m_OptViaType->GetSelection() > 0 )
m_BrdSettings->m_CurrentViaType = VIA_BLIND_BURIED; m_BrdSettings.m_CurrentViaType = VIA_BLIND_BURIED;
// Update vias minimum values for DRC // Update vias minimum values for DRC
m_BrdSettings->m_ViasMinSize = m_BrdSettings.m_ViasMinSize =
ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl, m_Parent->m_InternalUnits );
m_BrdSettings->m_ViasMinDrill = m_BrdSettings.m_ViasMinDrill =
ReturnValueFromTextCtrl( *m_SetViasMinDrillCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetViasMinDrillCtrl, m_Parent->m_InternalUnits );
m_BrdSettings->m_MicroViasAllowed = m_AllowMicroViaCtrl->GetSelection() == 1; m_BrdSettings.m_MicroViasAllowed = m_AllowMicroViaCtrl->GetSelection() == 1;
// Update microvias minimum values for DRC // Update microvias minimum values for DRC
m_BrdSettings->m_MicroViasMinSize = m_BrdSettings.m_MicroViasMinSize =
ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl, m_Parent->m_InternalUnits );
m_BrdSettings->m_MicroViasMinDrill = m_BrdSettings.m_MicroViasMinDrill =
ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl, m_Parent->m_InternalUnits );
// Update tracks minimum values for DRC // Update tracks minimum values for DRC
m_BrdSettings->m_TrackMinWidth = m_BrdSettings.m_TrackMinWidth =
ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits );
} }
...@@ -708,6 +708,8 @@ void DIALOG_DESIGN_RULES::OnOkButtonClick( wxCommandEvent& event ) ...@@ -708,6 +708,8 @@ void DIALOG_DESIGN_RULES::OnOkButtonClick( wxCommandEvent& event )
return; return;
} }
m_Pcb->SetDesignSettings( m_BrdSettings );
CopyRulesListToBoard(); CopyRulesListToBoard();
CopyGlobalRulesToBoard(); CopyGlobalRulesToBoard();
CopyDimensionsListsToBoard(); CopyDimensionsListsToBoard();
......
...@@ -40,7 +40,7 @@ private: ...@@ -40,7 +40,7 @@ private:
PCB_EDIT_FRAME* m_Parent; PCB_EDIT_FRAME* m_Parent;
BOARD* m_Pcb; BOARD* m_Pcb;
BOARD_DESIGN_SETTINGS* m_BrdSettings; BOARD_DESIGN_SETTINGS m_BrdSettings;
static int s_LastTabSelection; ///< which tab user had open last static int s_LastTabSelection; ///< which tab user had open last
......
...@@ -46,7 +46,7 @@ DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* parent ) : ...@@ -46,7 +46,7 @@ DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* parent ) :
{ {
m_tester = aTester; m_tester = aTester;
m_Parent = parent; m_Parent = parent;
m_BrdSettings = m_Parent->GetBoard()->GetBoardDesignSettings(); m_BrdSettings = m_Parent->GetBoard()->GetDesignSettings();
InitValues(); InitValues();
if( GetSizer() ) if( GetSizer() )
...@@ -130,12 +130,14 @@ void DIALOG_DRC_CONTROL::InitValues() ...@@ -130,12 +130,14 @@ void DIALOG_DRC_CONTROL::InitValues()
*/ */
void DIALOG_DRC_CONTROL::SetDrcParmeters( ) void DIALOG_DRC_CONTROL::SetDrcParmeters( )
{ {
m_BrdSettings->m_TrackMinWidth = m_BrdSettings.m_TrackMinWidth =
ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits );
m_BrdSettings->m_ViasMinSize = m_BrdSettings.m_ViasMinSize =
ReturnValueFromTextCtrl( *m_SetViaMinSizeCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetViaMinSizeCtrl, m_Parent->m_InternalUnits );
m_BrdSettings->m_MicroViasMinSize = m_BrdSettings.m_MicroViasMinSize =
ReturnValueFromTextCtrl( *m_SetMicroViakMinSizeCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetMicroViakMinSizeCtrl, m_Parent->m_InternalUnits );
m_Parent->GetBoard()->SetDesignSettings( m_BrdSettings );
} }
...@@ -160,7 +162,7 @@ void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event ) ...@@ -160,7 +162,7 @@ void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event )
reportName = m_RptFilenameCtrl->GetValue(); reportName = m_RptFilenameCtrl->GetValue();
} }
SetDrcParmeters( ); SetDrcParmeters();
m_tester->SetSettings( true, // Pad to pad DRC test enabled m_tester->SetSettings( true, // Pad to pad DRC test enabled
true, // unconnected pdas DRC test enabled true, // unconnected pdas DRC test enabled
...@@ -238,7 +240,7 @@ void DIALOG_DRC_CONTROL::OnListUnconnectedClick( wxCommandEvent& event ) ...@@ -238,7 +240,7 @@ void DIALOG_DRC_CONTROL::OnListUnconnectedClick( wxCommandEvent& event )
reportName = m_RptFilenameCtrl->GetValue(); reportName = m_RptFilenameCtrl->GetValue();
} }
SetDrcParmeters( ); SetDrcParmeters();
m_tester->SetSettings( true, // Pad to pad DRC test enabled m_tester->SetSettings( true, // Pad to pad DRC test enabled
true, // unconnected pdas DRC test enabled true, // unconnected pdas DRC test enabled
...@@ -311,7 +313,7 @@ void DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick( wxCommandEvent& event ) ...@@ -311,7 +313,7 @@ void DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick( wxCommandEvent& event )
void DIALOG_DRC_CONTROL::OnOkClick( wxCommandEvent& event ) void DIALOG_DRC_CONTROL::OnOkClick( wxCommandEvent& event )
{ {
SetReturnCode( wxID_OK ); SetReturnCode( wxID_OK );
SetDrcParmeters( ); SetDrcParmeters();
m_tester->DestroyDialog( wxID_OK ); m_tester->DestroyDialog( wxID_OK );
} }
......
...@@ -44,7 +44,7 @@ class BOARD_DESIGN_SETTINGS; ...@@ -44,7 +44,7 @@ class BOARD_DESIGN_SETTINGS;
class DIALOG_DRC_CONTROL: public DIALOG_DRC_CONTROL_BASE class DIALOG_DRC_CONTROL: public DIALOG_DRC_CONTROL_BASE
{ {
public: public:
BOARD_DESIGN_SETTINGS* m_BrdSettings; BOARD_DESIGN_SETTINGS m_BrdSettings;
/// Constructors /// Constructors
DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* parent ); DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* parent );
......
...@@ -33,7 +33,7 @@ private: ...@@ -33,7 +33,7 @@ private:
PCB_EDIT_FRAME* m_Parent; PCB_EDIT_FRAME* m_Parent;
wxDC* m_DC; wxDC* m_DC;
DRAWSEGMENT* m_Item; DRAWSEGMENT* m_Item;
BOARD_DESIGN_SETTINGS* m_BrdSettings; BOARD_DESIGN_SETTINGS m_BrdSettings;
public: public:
DialogGraphicItemProperties( PCB_EDIT_FRAME* aParent, DRAWSEGMENT * aItem, wxDC * aDC); DialogGraphicItemProperties( PCB_EDIT_FRAME* aParent, DRAWSEGMENT * aItem, wxDC * aDC);
...@@ -53,7 +53,7 @@ DialogGraphicItemProperties::DialogGraphicItemProperties( PCB_EDIT_FRAME* aParen ...@@ -53,7 +53,7 @@ DialogGraphicItemProperties::DialogGraphicItemProperties( PCB_EDIT_FRAME* aParen
m_Parent = aParent; m_Parent = aParent;
m_DC = aDC; m_DC = aDC;
m_Item = aItem; m_Item = aItem;
m_BrdSettings = m_Parent->GetBoard()->GetBoardDesignSettings(); m_BrdSettings = m_Parent->GetBoard()->GetDesignSettings();
initDlg(); initDlg();
Layout(); Layout();
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
...@@ -88,32 +88,34 @@ void DialogGraphicItemProperties::initDlg( ) ...@@ -88,32 +88,34 @@ void DialogGraphicItemProperties::initDlg( )
SetFocus(); SetFocus();
wxString msg; wxString msg;
// Change texts according to the segment shape: // Change texts according to the segment shape:
switch ( m_Item->m_Shape ) switch ( m_Item->m_Shape )
{ {
case S_CIRCLE: case S_CIRCLE:
m_Start_Center_XText->SetLabel(_("Center X")); m_Start_Center_XText->SetLabel(_("Center X"));
m_Start_Center_YText->SetLabel(_("Center Y")); m_Start_Center_YText->SetLabel(_("Center Y"));
m_EndX_Radius_Text->SetLabel(_("Point X")); m_EndX_Radius_Text->SetLabel(_("Point X"));
m_EndY_Text->SetLabel(_("Point Y")); m_EndY_Text->SetLabel(_("Point Y"));
m_Angle_Text->Show(false); m_Angle_Text->Show(false);
m_Angle_Ctrl->Show(false); m_Angle_Ctrl->Show(false);
break; break;
case S_ARC: case S_ARC:
m_Start_Center_XText->SetLabel(_("Center X")); m_Start_Center_XText->SetLabel(_("Center X"));
m_Start_Center_YText->SetLabel(_("Center Y")); m_Start_Center_YText->SetLabel(_("Center Y"));
m_EndX_Radius_Text->SetLabel(_("Start Point X")); m_EndX_Radius_Text->SetLabel(_("Start Point X"));
m_EndY_Text->SetLabel(_("Start Point Y")); m_EndY_Text->SetLabel(_("Start Point Y"));
msg << m_Item->m_Angle; msg << m_Item->m_Angle;
m_Angle_Ctrl->SetValue(msg); m_Angle_Ctrl->SetValue(msg);
break; break;
default: default:
m_Angle_Text->Show(false); m_Angle_Text->Show(false);
m_Angle_Ctrl->Show(false); m_Angle_Ctrl->Show(false);
break; break;
} }
AddUnitSymbol( *m_Start_Center_XText ); AddUnitSymbol( *m_Start_Center_XText );
PutValueInLocalUnits( *m_Center_StartXCtrl, m_Item->m_Start.x, PutValueInLocalUnits( *m_Center_StartXCtrl, m_Item->m_Start.x,
...@@ -136,11 +138,14 @@ void DialogGraphicItemProperties::initDlg( ) ...@@ -136,11 +138,14 @@ void DialogGraphicItemProperties::initDlg( )
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
AddUnitSymbol( *m_DefaultThicknessText ); AddUnitSymbol( *m_DefaultThicknessText );
int thickness; int thickness;
if( m_Item->GetLayer() == EDGE_N ) if( m_Item->GetLayer() == EDGE_N )
thickness = m_BrdSettings->m_EdgeSegmentWidth; thickness = m_BrdSettings.m_EdgeSegmentWidth;
else else
thickness = m_BrdSettings->m_DrawSegmentWidth; thickness = m_BrdSettings.m_DrawSegmentWidth;
PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness, PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
...@@ -156,8 +161,6 @@ void DialogGraphicItemProperties::initDlg( ) ...@@ -156,8 +161,6 @@ void DialogGraphicItemProperties::initDlg( )
if ( layer > LAST_NO_COPPER_LAYER ) if ( layer > LAST_NO_COPPER_LAYER )
layer = LAST_NO_COPPER_LAYER; layer = LAST_NO_COPPER_LAYER;
m_LayerSelection->SetSelection( layer - FIRST_NO_COPPER_LAYER ); m_LayerSelection->SetSelection( layer - FIRST_NO_COPPER_LAYER );
} }
...@@ -166,10 +169,12 @@ void DialogGraphicItemProperties::OnLayerChoice( wxCommandEvent& event ) ...@@ -166,10 +169,12 @@ void DialogGraphicItemProperties::OnLayerChoice( wxCommandEvent& event )
/*******************************************************************/ /*******************************************************************/
{ {
int thickness; int thickness;
if( (m_LayerSelection->GetCurrentSelection() + FIRST_NO_COPPER_LAYER) == EDGE_N ) if( (m_LayerSelection->GetCurrentSelection() + FIRST_NO_COPPER_LAYER) == EDGE_N )
thickness = m_BrdSettings->m_EdgeSegmentWidth; thickness = m_BrdSettings.m_EdgeSegmentWidth;
else else
thickness = m_BrdSettings->m_DrawSegmentWidth; thickness = m_BrdSettings.m_DrawSegmentWidth;
PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness, PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
} }
...@@ -183,7 +188,7 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event ) ...@@ -183,7 +188,7 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event )
m_Parent->SaveCopyInUndoList( m_Item, UR_CHANGED ); m_Parent->SaveCopyInUndoList( m_Item, UR_CHANGED );
wxString msg; wxString msg;
if ( m_DC ) if( m_DC )
m_Item->Draw( m_Parent->DrawPanel, m_DC, GR_XOR ); m_Item->Draw( m_Parent->DrawPanel, m_DC, GR_XOR );
msg = m_Center_StartXCtrl->GetValue(); msg = m_Center_StartXCtrl->GetValue();
...@@ -213,11 +218,11 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event ) ...@@ -213,11 +218,11 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event )
m_Item->SetLayer( m_LayerSelection->GetCurrentSelection() + FIRST_NO_COPPER_LAYER); m_Item->SetLayer( m_LayerSelection->GetCurrentSelection() + FIRST_NO_COPPER_LAYER);
if( m_Item->GetLayer() == EDGE_N ) if( m_Item->GetLayer() == EDGE_N )
m_BrdSettings->m_EdgeSegmentWidth = thickness; m_BrdSettings.m_EdgeSegmentWidth = thickness;
else else
m_BrdSettings->m_DrawSegmentWidth = thickness; m_BrdSettings.m_DrawSegmentWidth = thickness;
if ( m_Item->m_Shape == S_ARC ) if( m_Item->m_Shape == S_ARC )
{ {
long angle; long angle;
m_Angle_Ctrl->GetValue().ToLong(&angle); m_Angle_Ctrl->GetValue().ToLong(&angle);
...@@ -226,10 +231,12 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event ) ...@@ -226,10 +231,12 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event )
} }
m_Parent->OnModify(); m_Parent->OnModify();
if ( m_DC ) if( m_DC )
m_Item->Draw( m_Parent->DrawPanel, m_DC, GR_OR ); m_Item->Draw( m_Parent->DrawPanel, m_DC, GR_OR );
m_Item->DisplayInfo( m_Parent ); m_Item->DisplayInfo( m_Parent );
m_Parent->GetBoard()->SetDesignSettings( m_BrdSettings );
Close( TRUE ); Close( TRUE );
} }
......
...@@ -40,7 +40,7 @@ DIALOG_GRAPHIC_ITEMS_OPTIONS::DIALOG_GRAPHIC_ITEMS_OPTIONS( PCB_BASE_FRAME* pare ...@@ -40,7 +40,7 @@ DIALOG_GRAPHIC_ITEMS_OPTIONS::DIALOG_GRAPHIC_ITEMS_OPTIONS( PCB_BASE_FRAME* pare
: DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE( parent ) : DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE( parent )
{ {
m_Parent = parent; m_Parent = parent;
m_BrdSettings = m_Parent->GetBoard()->GetBoardDesignSettings(); m_BrdSettings = m_Parent->GetBoard()->GetDesignSettings();
initValues( ); initValues( );
m_sdbSizer1OK->SetDefault(); m_sdbSizer1OK->SetDefault();
...@@ -49,7 +49,7 @@ DIALOG_GRAPHIC_ITEMS_OPTIONS::DIALOG_GRAPHIC_ITEMS_OPTIONS( PCB_BASE_FRAME* pare ...@@ -49,7 +49,7 @@ DIALOG_GRAPHIC_ITEMS_OPTIONS::DIALOG_GRAPHIC_ITEMS_OPTIONS( PCB_BASE_FRAME* pare
Centre(); Centre();
} }
DIALOG_GRAPHIC_ITEMS_OPTIONS::~DIALOG_GRAPHIC_ITEMS_OPTIONS( ) DIALOG_GRAPHIC_ITEMS_OPTIONS::~DIALOG_GRAPHIC_ITEMS_OPTIONS()
{ {
} }
...@@ -61,26 +61,26 @@ void DIALOG_GRAPHIC_ITEMS_OPTIONS::initValues() ...@@ -61,26 +61,26 @@ void DIALOG_GRAPHIC_ITEMS_OPTIONS::initValues()
/* Drawings width */ /* Drawings width */
AddUnitSymbol( *m_GraphicSegmWidthTitle ); AddUnitSymbol( *m_GraphicSegmWidthTitle );
PutValueInLocalUnits( *m_OptPcbSegmWidth, PutValueInLocalUnits( *m_OptPcbSegmWidth,
m_BrdSettings->m_DrawSegmentWidth, m_BrdSettings.m_DrawSegmentWidth,
PCB_INTERNAL_UNIT ); PCB_INTERNAL_UNIT );
/* Edges width */ /* Edges width */
AddUnitSymbol( *m_BoardEdgesWidthTitle ); AddUnitSymbol( *m_BoardEdgesWidthTitle );
PutValueInLocalUnits( *m_OptPcbEdgesWidth, PutValueInLocalUnits( *m_OptPcbEdgesWidth,
m_BrdSettings->m_EdgeSegmentWidth, m_BrdSettings.m_EdgeSegmentWidth,
PCB_INTERNAL_UNIT ); PCB_INTERNAL_UNIT );
/* Pcb Textes (Size & Width) */ /* Pcb Textes (Size & Width) */
AddUnitSymbol( *m_CopperTextWidthTitle ); AddUnitSymbol( *m_CopperTextWidthTitle );
PutValueInLocalUnits( *m_OptPcbTextWidth, PutValueInLocalUnits( *m_OptPcbTextWidth,
m_BrdSettings->m_PcbTextWidth, PCB_INTERNAL_UNIT ); m_BrdSettings.m_PcbTextWidth, PCB_INTERNAL_UNIT );
AddUnitSymbol( *m_TextSizeVTitle ); AddUnitSymbol( *m_TextSizeVTitle );
PutValueInLocalUnits( *m_OptPcbTextVSize, PutValueInLocalUnits( *m_OptPcbTextVSize,
m_BrdSettings->m_PcbTextSize.y, PCB_INTERNAL_UNIT ); m_BrdSettings.m_PcbTextSize.y, PCB_INTERNAL_UNIT );
AddUnitSymbol( *m_TextSizeHTitle ); AddUnitSymbol( *m_TextSizeHTitle );
PutValueInLocalUnits( *m_OptPcbTextHSize, PutValueInLocalUnits( *m_OptPcbTextHSize,
m_BrdSettings->m_PcbTextSize.x, PCB_INTERNAL_UNIT ); m_BrdSettings.m_PcbTextSize.x, PCB_INTERNAL_UNIT );
/* Modules: Edges width */ /* Modules: Edges width */
...@@ -109,17 +109,19 @@ void DIALOG_GRAPHIC_ITEMS_OPTIONS::initValues() ...@@ -109,17 +109,19 @@ void DIALOG_GRAPHIC_ITEMS_OPTIONS::initValues()
void DIALOG_GRAPHIC_ITEMS_OPTIONS::OnOkClick( wxCommandEvent& event ) void DIALOG_GRAPHIC_ITEMS_OPTIONS::OnOkClick( wxCommandEvent& event )
{ {
m_BrdSettings->m_DrawSegmentWidth = m_BrdSettings.m_DrawSegmentWidth =
ReturnValueFromTextCtrl( *m_OptPcbSegmWidth, PCB_INTERNAL_UNIT ); ReturnValueFromTextCtrl( *m_OptPcbSegmWidth, PCB_INTERNAL_UNIT );
m_BrdSettings->m_EdgeSegmentWidth = m_BrdSettings.m_EdgeSegmentWidth =
ReturnValueFromTextCtrl( *m_OptPcbEdgesWidth, PCB_INTERNAL_UNIT ); ReturnValueFromTextCtrl( *m_OptPcbEdgesWidth, PCB_INTERNAL_UNIT );
m_BrdSettings->m_PcbTextWidth = m_BrdSettings.m_PcbTextWidth =
ReturnValueFromTextCtrl( *m_OptPcbTextWidth, PCB_INTERNAL_UNIT ); ReturnValueFromTextCtrl( *m_OptPcbTextWidth, PCB_INTERNAL_UNIT );
m_BrdSettings->m_PcbTextSize.y = m_BrdSettings.m_PcbTextSize.y =
ReturnValueFromTextCtrl( *m_OptPcbTextVSize, PCB_INTERNAL_UNIT ); ReturnValueFromTextCtrl( *m_OptPcbTextVSize, PCB_INTERNAL_UNIT );
m_BrdSettings->m_PcbTextSize.x = m_BrdSettings.m_PcbTextSize.x =
ReturnValueFromTextCtrl( *m_OptPcbTextHSize, PCB_INTERNAL_UNIT ); ReturnValueFromTextCtrl( *m_OptPcbTextHSize, PCB_INTERNAL_UNIT );
m_Parent->GetBoard()->SetDesignSettings( m_BrdSettings );
g_ModuleSegmentWidth = g_ModuleSegmentWidth =
ReturnValueFromTextCtrl( *m_OptModuleEdgesWidth, PCB_INTERNAL_UNIT ); ReturnValueFromTextCtrl( *m_OptModuleEdgesWidth, PCB_INTERNAL_UNIT );
g_ModuleTextWidth = g_ModuleTextWidth =
...@@ -139,7 +141,6 @@ void DIALOG_GRAPHIC_ITEMS_OPTIONS::OnOkClick( wxCommandEvent& event ) ...@@ -139,7 +141,6 @@ void DIALOG_GRAPHIC_ITEMS_OPTIONS::OnOkClick( wxCommandEvent& event )
} }
/*! /*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/ */
......
...@@ -38,8 +38,8 @@ ...@@ -38,8 +38,8 @@
class DIALOG_GRAPHIC_ITEMS_OPTIONS: public DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE class DIALOG_GRAPHIC_ITEMS_OPTIONS: public DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE
{ {
public: public:
BOARD_DESIGN_SETTINGS* m_BrdSettings; BOARD_DESIGN_SETTINGS m_BrdSettings;
PCB_BASE_FRAME * m_Parent; PCB_BASE_FRAME * m_Parent;
public: public:
DIALOG_GRAPHIC_ITEMS_OPTIONS( PCB_BASE_FRAME* parent ); DIALOG_GRAPHIC_ITEMS_OPTIONS( PCB_BASE_FRAME* parent );
......
...@@ -26,7 +26,7 @@ DIALOG_PADS_MASK_CLEARANCE::DIALOG_PADS_MASK_CLEARANCE( PCB_EDIT_FRAME* parent ) ...@@ -26,7 +26,7 @@ DIALOG_PADS_MASK_CLEARANCE::DIALOG_PADS_MASK_CLEARANCE( PCB_EDIT_FRAME* parent )
DIALOG_PADS_MASK_CLEARANCE_BASE( parent ) DIALOG_PADS_MASK_CLEARANCE_BASE( parent )
{ {
m_Parent = parent; m_Parent = parent;
m_BrdSettings = m_Parent->GetBoard()->GetBoardDesignSettings(); m_BrdSettings = m_Parent->GetBoard()->GetDesignSettings();
MyInit(); MyInit();
m_sdbButtonsSizerOK->SetDefault(); m_sdbButtonsSizerOK->SetDefault();
...@@ -44,20 +44,20 @@ void DIALOG_PADS_MASK_CLEARANCE::MyInit() ...@@ -44,20 +44,20 @@ void DIALOG_PADS_MASK_CLEARANCE::MyInit()
int Internal_Unit = m_Parent->m_InternalUnits; int Internal_Unit = m_Parent->m_InternalUnits;
PutValueInLocalUnits( *m_SolderMaskMarginCtrl, PutValueInLocalUnits( *m_SolderMaskMarginCtrl,
m_BrdSettings->m_SolderMaskMargin, m_BrdSettings.m_SolderMaskMargin,
Internal_Unit ); Internal_Unit );
// These 2 parameters are usually < 0, so prepare entering a negative // These 2 parameters are usually < 0, so prepare entering a negative
// value, if current is 0 // value, if current is 0
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 && if( m_BrdSettings.m_SolderPasteMarginRatio == 0.0 &&
msg[0] == '0') // Sometimes Printf add a sign if the value is small msg[0] == '0') // Sometimes Printf add a sign if the value is small
m_SolderPasteMarginRatioCtrl->SetValue( wxT( "-" ) + msg ); m_SolderPasteMarginRatioCtrl->SetValue( wxT( "-" ) + msg );
else else
...@@ -69,10 +69,12 @@ void DIALOG_PADS_MASK_CLEARANCE::MyInit() ...@@ -69,10 +69,12 @@ void DIALOG_PADS_MASK_CLEARANCE::MyInit()
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->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->m_InternalUnits );
m_BrdSettings->m_SolderPasteMargin =
m_BrdSettings.m_SolderPasteMargin =
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->m_InternalUnits );
double dtmp = 0; double dtmp = 0;
wxString msg = m_SolderPasteMarginRatioCtrl->GetValue(); wxString msg = m_SolderPasteMarginRatioCtrl->GetValue();
msg.ToDouble( &dtmp ); msg.ToDouble( &dtmp );
...@@ -82,7 +84,10 @@ void DIALOG_PADS_MASK_CLEARANCE::OnButtonOkClick( wxCommandEvent& event ) ...@@ -82,7 +84,10 @@ void DIALOG_PADS_MASK_CLEARANCE::OnButtonOkClick( wxCommandEvent& event )
dtmp = -50; dtmp = -50;
if( dtmp > +100 ) if( dtmp > +100 )
dtmp = +100; dtmp = +100;
m_BrdSettings->m_SolderPasteMarginRatio = dtmp / 100;
m_BrdSettings.m_SolderPasteMarginRatio = dtmp / 100;
m_Parent->GetBoard()->SetDesignSettings( m_BrdSettings );
EndModal( 1 ); EndModal( 1 );
} }
......
...@@ -20,7 +20,7 @@ class DIALOG_PADS_MASK_CLEARANCE : public DIALOG_PADS_MASK_CLEARANCE_BASE ...@@ -20,7 +20,7 @@ class DIALOG_PADS_MASK_CLEARANCE : public DIALOG_PADS_MASK_CLEARANCE_BASE
{ {
private: private:
PCB_EDIT_FRAME* m_Parent; PCB_EDIT_FRAME* m_Parent;
BOARD_DESIGN_SETTINGS* m_BrdSettings; BOARD_DESIGN_SETTINGS m_BrdSettings;
public: public:
DIALOG_PADS_MASK_CLEARANCE( PCB_EDIT_FRAME* parent ); DIALOG_PADS_MASK_CLEARANCE( PCB_EDIT_FRAME* parent );
......
...@@ -249,8 +249,8 @@ DIMENSION* PCB_EDIT_FRAME::EditDimension( DIMENSION* aDimension, wxDC* aDC ) ...@@ -249,8 +249,8 @@ DIMENSION* PCB_EDIT_FRAME::EditDimension( DIMENSION* aDimension, wxDC* aDC )
aDimension->m_arrowD2Ox = aDimension->m_arrowD2Fx = pos.x; aDimension->m_arrowD2Ox = aDimension->m_arrowD2Fx = pos.x;
aDimension->m_arrowD2Oy = aDimension->m_arrowD2Fy = pos.y; aDimension->m_arrowD2Oy = aDimension->m_arrowD2Fy = pos.y;
aDimension->m_Text->m_Size = GetBoard()->GetBoardDesignSettings()->m_PcbTextSize; aDimension->m_Text->m_Size = GetBoard()->GetDesignSettings().m_PcbTextSize;
int width = GetBoard()->GetBoardDesignSettings()->m_PcbTextWidth; int width = GetBoard()->GetDesignSettings().m_PcbTextWidth;
int maxthickness = Clamp_Text_PenSize(width, aDimension->m_Text->m_Size ); int maxthickness = Clamp_Text_PenSize(width, aDimension->m_Text->m_Size );
if( width > maxthickness ) if( width > maxthickness )
......
...@@ -55,13 +55,13 @@ void DRC::ShowDialog() ...@@ -55,13 +55,13 @@ void DRC::ShowDialog()
// copy data retained in this DRC object into the m_ui DrcPanel: // copy data retained in this DRC object into the m_ui DrcPanel:
PutValueInLocalUnits( *m_ui->m_SetTrackMinWidthCtrl, PutValueInLocalUnits( *m_ui->m_SetTrackMinWidthCtrl,
m_pcb->GetBoardDesignSettings()->m_TrackMinWidth, m_pcb->GetDesignSettings().m_TrackMinWidth,
m_mainWindow->m_InternalUnits ); m_mainWindow->m_InternalUnits );
PutValueInLocalUnits( *m_ui->m_SetViaMinSizeCtrl, PutValueInLocalUnits( *m_ui->m_SetViaMinSizeCtrl,
m_pcb->GetBoardDesignSettings()->m_ViasMinSize, m_pcb->GetDesignSettings().m_ViasMinSize,
m_mainWindow->m_InternalUnits ); m_mainWindow->m_InternalUnits );
PutValueInLocalUnits( *m_ui->m_SetMicroViakMinSizeCtrl, PutValueInLocalUnits( *m_ui->m_SetMicroViakMinSizeCtrl,
m_pcb->GetBoardDesignSettings()->m_MicroViasMinSize, m_pcb->GetDesignSettings().m_MicroViasMinSize,
m_mainWindow->m_InternalUnits ); m_mainWindow->m_InternalUnits );
m_ui->m_CreateRptCtrl->SetValue( m_doCreateRptFile ); m_ui->m_CreateRptCtrl->SetValue( m_doCreateRptFile );
...@@ -292,7 +292,7 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg ) ...@@ -292,7 +292,7 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
{ {
bool ret = true; bool ret = true;
const BOARD_DESIGN_SETTINGS& g = *m_pcb->GetBoardDesignSettings(); const BOARD_DESIGN_SETTINGS& g = m_pcb->GetDesignSettings();
#define FmtVal( x ) GetChars( ReturnStringFromValue( g_UserUnit, x, PCB_INTERNAL_UNIT ) ) #define FmtVal( x ) GetChars( ReturnStringFromValue( g_UserUnit, x, PCB_INTERNAL_UNIT ) )
......
...@@ -221,7 +221,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) ...@@ -221,7 +221,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
if( layer1 == LAYER_N_BACK && layer2 == LAYER_N_2 ) if( layer1 == LAYER_N_BACK && layer2 == LAYER_N_2 )
err = false; err = false;
if( layer1 == (m_pcb->GetBoardDesignSettings()->GetCopperLayerCount() - 2 ) if( layer1 == (m_pcb->GetDesignSettings().GetCopperLayerCount() - 2 )
&& layer2 == LAYER_N_FRONT ) && layer2 == LAYER_N_FRONT )
err = false; err = false;
......
...@@ -352,14 +352,14 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -352,14 +352,14 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
} }
else else
{ {
int v_type = GetBoard()->GetBoardDesignSettings()->m_CurrentViaType; int v_type = GetBoard()->GetDesignSettings().m_CurrentViaType;
// place micro via and switch layer. // place micro via and switch layer.
if( id == ID_POPUP_PCB_PLACE_MICROVIA ) if( id == ID_POPUP_PCB_PLACE_MICROVIA )
GetBoard()->GetBoardDesignSettings()->m_CurrentViaType = VIA_MICROVIA; GetBoard()->GetDesignSettings().m_CurrentViaType = VIA_MICROVIA;
Other_Layer_Route( (TRACK*) GetCurItem(), &dc ); Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
GetBoard()->GetBoardDesignSettings()->m_CurrentViaType = v_type; GetBoard()->GetDesignSettings().m_CurrentViaType = v_type;
if( DisplayOpt.ContrastModeDisplay ) if( DisplayOpt.ContrastModeDisplay )
DrawPanel->Refresh(); DrawPanel->Refresh();
......
...@@ -166,9 +166,9 @@ TEXTE_PCB* PCB_EDIT_FRAME::Create_Texte_Pcb( wxDC* DC ) ...@@ -166,9 +166,9 @@ TEXTE_PCB* PCB_EDIT_FRAME::Create_Texte_Pcb( wxDC* DC )
if( TextePcb->GetLayer() == LAYER_N_BACK ) if( TextePcb->GetLayer() == LAYER_N_BACK )
TextePcb->m_Mirror = true; TextePcb->m_Mirror = true;
TextePcb->m_Size = GetBoard()->GetBoardDesignSettings()->m_PcbTextSize; TextePcb->m_Size = GetBoard()->GetDesignSettings().m_PcbTextSize;
TextePcb->m_Pos = GetScreen()->GetCrossHairPosition(); TextePcb->m_Pos = GetScreen()->GetCrossHairPosition();
TextePcb->m_Thickness = GetBoard()->GetBoardDesignSettings()->m_PcbTextWidth; TextePcb->m_Thickness = GetBoard()->GetDesignSettings().m_PcbTextWidth;
InstallTextPCBOptionsFrame( TextePcb, DC ); InstallTextPCBOptionsFrame( TextePcb, DC );
......
...@@ -209,11 +209,11 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape, ...@@ -209,11 +209,11 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape,
int s_large; int s_large;
DRAWSEGMENT* DrawItem; DRAWSEGMENT* DrawItem;
s_large = GetBoard()->GetBoardDesignSettings()->m_DrawSegmentWidth; s_large = GetBoard()->GetDesignSettings().m_DrawSegmentWidth;
if( getActiveLayer() == EDGE_N ) if( getActiveLayer() == EDGE_N )
{ {
s_large = GetBoard()->GetBoardDesignSettings()->m_EdgeSegmentWidth; s_large = GetBoard()->GetDesignSettings().m_EdgeSegmentWidth;
} }
if( Segment == NULL ) /* Create new trace. */ if( Segment == NULL ) /* Create new trace. */
......
...@@ -97,7 +97,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) ...@@ -97,7 +97,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
/* create the via */ /* create the via */
SEGVIA* via = new SEGVIA( GetBoard() ); SEGVIA* via = new SEGVIA( GetBoard() );
via->m_Flags = IS_NEW; via->m_Flags = IS_NEW;
via->m_Shape = GetBoard()->GetBoardDesignSettings()->m_CurrentViaType; via->m_Shape = GetBoard()->GetDesignSettings().m_CurrentViaType;
via->m_Width = GetBoard()->GetCurrentViaSize(); via->m_Width = GetBoard()->GetCurrentViaSize();
via->SetNet( GetBoard()->GetHighLightNetCode() ); via->SetNet( GetBoard()->GetHighLightNetCode() );
via->m_Start = via->m_End = g_CurrentTrackSegment->m_End; via->m_Start = via->m_End = g_CurrentTrackSegment->m_End;
......
...@@ -166,7 +166,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) ...@@ -166,7 +166,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer ); g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer );
g_CurrentTrackSegment->m_Width = GetBoard()->GetCurrentTrackWidth(); g_CurrentTrackSegment->m_Width = GetBoard()->GetCurrentTrackWidth();
if( GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth ) if( GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth )
{ {
if( TrackOnStartPoint && TrackOnStartPoint->Type() == PCB_TRACE_T ) if( TrackOnStartPoint && TrackOnStartPoint->Type() == PCB_TRACE_T )
g_CurrentTrackSegment->m_Width = TrackOnStartPoint->m_Width; g_CurrentTrackSegment->m_Width = TrackOnStartPoint->m_Width;
...@@ -271,7 +271,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) ...@@ -271,7 +271,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
newTrack->SetLayer( ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer ); newTrack->SetLayer( ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer );
if( !GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth ) if( !GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth )
newTrack->m_Width = GetBoard()->GetCurrentTrackWidth(); newTrack->m_Width = GetBoard()->GetCurrentTrackWidth();
D( g_CurrentTrackList.VerifyListIntegrity(); ); D( g_CurrentTrackList.VerifyListIntegrity(); );
...@@ -695,7 +695,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo ...@@ -695,7 +695,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
// Set track parameters, that can be modified while creating the track // Set track parameters, that can be modified while creating the track
g_CurrentTrackSegment->SetLayer( screen->m_Active_Layer ); g_CurrentTrackSegment->SetLayer( screen->m_Active_Layer );
if( !frame->GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth ) if( !frame->GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth )
g_CurrentTrackSegment->m_Width = frame->GetBoard()->GetCurrentTrackWidth(); g_CurrentTrackSegment->m_Width = frame->GetBoard()->GetCurrentTrackWidth();
if( g_TwoSegmentTrackBuild ) if( g_TwoSegmentTrackBuild )
...@@ -706,7 +706,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo ...@@ -706,7 +706,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
{ {
previous_track->SetLayer( screen->m_Active_Layer ); previous_track->SetLayer( screen->m_Active_Layer );
if( !frame->GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth ) if( !frame->GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth )
previous_track->m_Width = frame->GetBoard()->GetCurrentTrackWidth(); previous_track->m_Width = frame->GetBoard()->GetCurrentTrackWidth();
} }
} }
......
...@@ -285,8 +285,8 @@ void PCB_BASE_FRAME::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC ) ...@@ -285,8 +285,8 @@ void PCB_BASE_FRAME::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC )
switch( aItem->Type() ) switch( aItem->Type() )
{ {
case PCB_TEXT_T: case PCB_TEXT_T:
newSize = GetBoard()->GetBoardDesignSettings()->m_PcbTextSize; newSize = GetBoard()->GetDesignSettings().m_PcbTextSize;
newThickness = GetBoard()->GetBoardDesignSettings()->m_PcbTextWidth; newThickness = GetBoard()->GetDesignSettings().m_PcbTextWidth;
pcbText = (TEXTE_PCB*) aItem; pcbText = (TEXTE_PCB*) aItem;
text = (EDA_TEXT*) pcbText; text = (EDA_TEXT*) pcbText;
break; break;
......
...@@ -35,19 +35,19 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) ...@@ -35,19 +35,19 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH: case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth =
not GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth; not GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth;
break; break;
case ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES: case ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES:
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = false; GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth = false;
GetBoard()->m_TrackWidthSelector = 0; GetBoard()->m_TrackWidthSelector = 0;
GetBoard()->m_ViaSizeSelector = 0; GetBoard()->m_ViaSizeSelector = 0;
break; break;
case ID_POPUP_PCB_SELECT_AUTO_WIDTH: case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = true; GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth = true;
break; break;
case ID_POPUP_PCB_SELECT_WIDTH1: // this is the default Netclass selection case ID_POPUP_PCB_SELECT_WIDTH1: // this is the default Netclass selection
...@@ -59,7 +59,7 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) ...@@ -59,7 +59,7 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
case ID_POPUP_PCB_SELECT_WIDTH7: case ID_POPUP_PCB_SELECT_WIDTH7:
case ID_POPUP_PCB_SELECT_WIDTH8: case ID_POPUP_PCB_SELECT_WIDTH8:
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = false; GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth = false;
ii = id - ID_POPUP_PCB_SELECT_WIDTH1; ii = id - ID_POPUP_PCB_SELECT_WIDTH1;
GetBoard()->m_TrackWidthSelector = ii; GetBoard()->m_TrackWidthSelector = ii;
break; break;
......
This diff is collapsed.
...@@ -369,7 +369,7 @@ static void compute_layer_Zs( BOARD* pcb ) /*{{{*/ ...@@ -369,7 +369,7 @@ static void compute_layer_Zs( BOARD* pcb ) /*{{{*/
int copper_layers = pcb->GetCopperLayerCount( ); int copper_layers = pcb->GetCopperLayerCount( );
// We call it 'layer' thickness, but it's the whole board thickness! // We call it 'layer' thickness, but it's the whole board thickness!
double board_thickness = pcb->GetBoardDesignSettings()->m_BoardThickness; double board_thickness = pcb->GetDesignSettings().m_BoardThickness;
double half_thickness = board_thickness / 2; double half_thickness = board_thickness / 2;
/* Compute each layer's Z value, more or less like the 3d view */ /* Compute each layer's Z value, more or less like the 3d view */
...@@ -1249,9 +1249,11 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString & aFullFileName, ...@@ -1249,9 +1249,11 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString & aFullFileName,
/* Define the translation to have the board centre to the 2D axis origin /* Define the translation to have the board centre to the 2D axis origin
* more easy for rotations... * more easy for rotations...
*/ */
pcb->ComputeBoundingBox(); EDA_RECT bbbox = pcb->ComputeBoundingBox();
double dx = board_scaling_factor * pcb->m_BoundaryBox.Centre().x * aScale;
double dy = board_scaling_factor * pcb->m_BoundaryBox.Centre().y * aScale; double dx = board_scaling_factor * bbbox.Centre().x * aScale;
double dy = board_scaling_factor * bbbox.Centre().y * aScale;
fprintf( output_file, " translation %g %g 0.0\n", -dx, dy ); fprintf( output_file, " translation %g %g 0.0\n", -dx, dy );
fprintf( output_file, " children [\n" ); fprintf( output_file, " children [\n" );
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
#include "io_mgr.h" #include "io_mgr.h"
#include "class_board.h" #include "class_board.h"
#include "build_version.h" // BOARD_FILE_VERSION
static const wxString pcbBackupFileExtension( wxT( "000" ) ); static const wxString pcbBackupFileExtension( wxT( "000" ) );
...@@ -226,12 +226,12 @@ the changes?" ) ) ) ...@@ -226,12 +226,12 @@ the changes?" ) ) )
int ver; int ver;
sscanf( reader.Line() , "PCBNEW-BOARD Version %d date", &ver ); sscanf( reader.Line() , "PCBNEW-BOARD Version %d date", &ver );
if ( ver > g_CurrentVersionPCB ) if ( ver > BOARD_FILE_VERSION )
{ {
DisplayInfoMessage( this, _( "This file was created by a more recent \ DisplayInfoMessage( this, _( "This file was created by a more recent \
version of Pcbnew and may not load correctly. Please consider updating!" ) ); version of Pcbnew and may not load correctly. Please consider updating!" ) );
} }
else if ( ver < g_CurrentVersionPCB ) else if ( ver < BOARD_FILE_VERSION )
{ {
DisplayInfoMessage( this, _( "This file was created by an older \ DisplayInfoMessage( this, _( "This file was created by an older \
version of Pcbnew. It will be stored in the new file format when you save \ version of Pcbnew. It will be stored in the new file format when you save \
...@@ -278,7 +278,16 @@ this file again." ) ); ...@@ -278,7 +278,16 @@ this file again." ) );
NULL ); NULL );
if( !aAppend ) if( !aAppend )
{
if( board->GetFileFormatVersionAtLoad() < BOARD_FILE_VERSION )
{
DisplayInfoMessage( this, _( "This file was created by an older \
version of Pcbnew. It will be stored in the new file format when you save \
this file again." ) );
}
SetBoard( board ); SetBoard( board );
}
} }
catch( IO_ERROR ioe ) catch( IO_ERROR ioe )
{ {
......
...@@ -41,11 +41,11 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName, ...@@ -41,11 +41,11 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
SetLocaleTo_C_standard(); // Use the standard notation for float numbers SetLocaleTo_C_standard(); // Use the standard notation for float numbers
// Calculate dimensions and center of PCB // Calculate dimensions and center of PCB
aPcb->ComputeBoundingBox(); EDA_RECT bbbox = aPcb->ComputeBoundingBox();
dX = aPcb->m_BoundaryBox.GetWidth(); dX = bbbox.GetWidth();
dY = aPcb->m_BoundaryBox.GetHeight(); dY = bbbox.GetHeight();
BoardCentre = aPcb->m_BoundaryBox.Centre(); BoardCentre = bbbox.Centre();
// Calculate the scale for the format type, scale 1 in HPGL, drawing on // Calculate the scale for the format type, scale 1 in HPGL, drawing on
// an A4 sheet in PS, + text description of symbols // an A4 sheet in PS, + text description of symbols
...@@ -163,8 +163,8 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName, ...@@ -163,8 +163,8 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
intervalle = (int) ( CharSize * CharScale ) + TextWidth; intervalle = (int) ( CharSize * CharScale ) + TextWidth;
/* Trace information. */ /* Trace information. */
plotX = (int) ( (double) aPcb->m_BoundaryBox.GetX() + 200.0 * CharScale ); plotX = (int) ( (double) bbbox.GetX() + 200.0 * CharScale );
plotY = aPcb->m_BoundaryBox.GetBottom() + intervalle; plotY = bbbox.GetBottom() + intervalle;
/* Plot title "Info" */ /* Plot title "Info" */
wxString Text = wxT( "Drill Map:" ); wxString Text = wxT( "Drill Map:" );
......
...@@ -33,6 +33,12 @@ public: ...@@ -33,6 +33,12 @@ public:
}; };
#if 1
static const double conv_unit = 0.0001; // units = INCHES
#else
static const double conv_unit = 0.000254; // units = mm
#endif
static wxPoint File_Place_Offset; /* Offset coordinates for generated file. */ static wxPoint File_Place_Offset; /* Offset coordinates for generated file. */
static void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile ); static void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile );
...@@ -87,11 +93,6 @@ void PCB_EDIT_FRAME::GenModulesPosition( wxCommandEvent& event ) ...@@ -87,11 +93,6 @@ void PCB_EDIT_FRAME::GenModulesPosition( wxCommandEvent& event )
FILE* fpBack = 0; FILE* fpBack = 0;
bool switchedLocale = false; bool switchedLocale = false;
/* Calculate conversion scales. */
double conv_unit = 0.0001; /* unites = INCHES */
// if(IF_DRILL_METRIC) conv_unit = 0.000254; /* unites = mm */
File_Place_Offset = m_Auxiliary_Axis_Position; File_Place_Offset = m_Auxiliary_Axis_Position;
/* Calculating the number of useful modules (CMS attribute, not VIRTUAL) */ /* Calculating the number of useful modules (CMS attribute, not VIRTUAL) */
...@@ -319,7 +320,6 @@ exit: // the only safe way out of here, no returns please. ...@@ -319,7 +320,6 @@ exit: // the only safe way out of here, no returns please.
*/ */
void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event ) void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event )
{ {
double conv_unit;
MODULE* Module; MODULE* Module;
D_PAD* pad; D_PAD* pad;
char line[1024]; char line[1024];
...@@ -328,10 +328,6 @@ void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event ) ...@@ -328,10 +328,6 @@ void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event )
FILE* rptfile; FILE* rptfile;
wxPoint module_pos; wxPoint module_pos;
conv_unit = 0.0001; /* unites = INCHES */
// if(IF_DRILL_METRIC) conv_unit = 0.000254; /* unites = mm */
File_Place_Offset = wxPoint( 0, 0 ); File_Place_Offset = wxPoint( 0, 0 );
wxString boardFilePath = ( (wxFileName) GetScreen()->GetFileName()).GetPath(); wxString boardFilePath = ( (wxFileName) GetScreen()->GetFileName()).GetPath();
...@@ -369,17 +365,20 @@ void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event ) ...@@ -369,17 +365,20 @@ void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event )
fputs( "##\n", rptfile ); fputs( "##\n", rptfile );
fputs( "\n$BeginDESCRIPTION\n", rptfile ); fputs( "\n$BeginDESCRIPTION\n", rptfile );
GetBoard()->ComputeBoundingBox(); EDA_RECT bbbox = GetBoard()->ComputeBoundingBox();
fputs( "\n$BOARD\n", rptfile ); fputs( "\n$BOARD\n", rptfile );
fputs( "unit INCH\n", rptfile ); fputs( "unit INCH\n", rptfile );
sprintf( line, "upper_left_corner %9.6f %9.6f\n", sprintf( line, "upper_left_corner %9.6f %9.6f\n",
GetBoard()->m_BoundaryBox.GetX() * conv_unit, bbbox.GetX() * conv_unit,
GetBoard()->m_BoundaryBox.GetY() * conv_unit ); bbbox.GetY() * conv_unit );
fputs( line, rptfile ); fputs( line, rptfile );
sprintf( line, "lower_right_corner %9.6f %9.6f\n", sprintf( line, "lower_right_corner %9.6f %9.6f\n",
GetBoard()->m_BoundaryBox.GetRight() * conv_unit, bbbox.GetRight() * conv_unit,
GetBoard()->m_BoundaryBox.GetBottom() * conv_unit ); bbbox.GetBottom() * conv_unit );
fputs( line, rptfile ); fputs( line, rptfile );
fputs( "$EndBOARD\n\n", rptfile ); fputs( "$EndBOARD\n\n", rptfile );
...@@ -512,12 +511,10 @@ void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event ) ...@@ -512,12 +511,10 @@ void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event )
*/ */
void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile ) void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile )
{ {
double conv_unit, ux0, uy0, dx, dy; double ux0, uy0, dx, dy;
double radius, width; double radius, width;
char line[1024]; char line[1024];
conv_unit = 0.0001; /* units = INCHES */
ux0 = PtDrawSegment->m_Start.x * conv_unit; ux0 = PtDrawSegment->m_Start.x * conv_unit;
uy0 = PtDrawSegment->m_Start.y * conv_unit; uy0 = PtDrawSegment->m_Start.y * conv_unit;
......
...@@ -197,8 +197,8 @@ void TraceFilledCircle( BOARD* Pcb, ...@@ -197,8 +197,8 @@ void TraceFilledCircle( BOARD* Pcb,
break; break;
} }
cx -= Pcb->m_BoundaryBox.m_Pos.x; cx -= Pcb->GetBoundingBox().m_Pos.x;
cy -= Pcb->m_BoundaryBox.m_Pos.y; cy -= Pcb->GetBoundingBox().m_Pos.y;
distmin = radius; distmin = radius;
...@@ -298,10 +298,10 @@ void TraceSegmentPcb( BOARD* Pcb, TRACK* pt_segm, int color, int marge, int op_l ...@@ -298,10 +298,10 @@ void TraceSegmentPcb( BOARD* Pcb, TRACK* pt_segm, int color, int marge, int op_l
half_width = ( pt_segm->m_Width / 2 ) + marge; half_width = ( pt_segm->m_Width / 2 ) + marge;
/* Calculate the bounding rectangle of the segment (if H, V or Via) */ /* Calculate the bounding rectangle of the segment (if H, V or Via) */
ux0 = pt_segm->m_Start.x - Pcb->m_BoundaryBox.m_Pos.x; ux0 = pt_segm->m_Start.x - Pcb->GetBoundingBox().m_Pos.x;
uy0 = pt_segm->m_Start.y - Pcb->m_BoundaryBox.m_Pos.y; uy0 = pt_segm->m_Start.y - Pcb->GetBoundingBox().m_Pos.y;
ux1 = pt_segm->m_End.x - Pcb->m_BoundaryBox.m_Pos.x; ux1 = pt_segm->m_End.x - Pcb->GetBoundingBox().m_Pos.x;
uy1 = pt_segm->m_End.y - Pcb->m_BoundaryBox.m_Pos.y; uy1 = pt_segm->m_End.y - Pcb->GetBoundingBox().m_Pos.y;
/* Test if VIA (filled circle was drawn) */ /* Test if VIA (filled circle was drawn) */
if( pt_segm->Type() == PCB_VIA_T ) if( pt_segm->Type() == PCB_VIA_T )
...@@ -558,10 +558,10 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1, ...@@ -558,10 +558,10 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
break; break;
} }
ux0 -= Pcb->m_BoundaryBox.m_Pos.x; ux0 -= Pcb->GetBoundingBox().m_Pos.x;
uy0 -= Pcb->m_BoundaryBox.m_Pos.y; uy0 -= Pcb->GetBoundingBox().m_Pos.y;
ux1 -= Pcb->m_BoundaryBox.m_Pos.x; ux1 -= Pcb->GetBoundingBox().m_Pos.x;
uy1 -= Pcb->m_BoundaryBox.m_Pos.y; uy1 -= Pcb->GetBoundingBox().m_Pos.y;
/* Calculating limits coord cells belonging to the rectangle. */ /* Calculating limits coord cells belonging to the rectangle. */
row_max = uy1 / Board.m_GridRouting; row_max = uy1 / Board.m_GridRouting;
...@@ -650,10 +650,10 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1, ...@@ -650,10 +650,10 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
break; break;
} }
ux0 -= Pcb->m_BoundaryBox.m_Pos.x; ux0 -= Pcb->GetBoundingBox().m_Pos.x;
uy0 -= Pcb->m_BoundaryBox.m_Pos.y; uy0 -= Pcb->GetBoundingBox().m_Pos.y;
ux1 -= Pcb->m_BoundaryBox.m_Pos.x; ux1 -= Pcb->GetBoundingBox().m_Pos.x;
uy1 -= Pcb->m_BoundaryBox.m_Pos.y; uy1 -= Pcb->GetBoundingBox().m_Pos.y;
cx = (ux0 + ux1) / 2; cx = (ux0 + ux1) / 2;
cy = (uy0 + uy1) / 2; cy = (uy0 + uy1) / 2;
......
...@@ -39,7 +39,7 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery ) ...@@ -39,7 +39,7 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
// delete the old BOARD and create a new BOARD so that the default // delete the old BOARD and create a new BOARD so that the default
// layer names are put into the BOARD. // layer names are put into the BOARD.
SetBoard( new BOARD( this ) ); SetBoard( new BOARD() );
SetCurItem( NULL ); SetCurItem( NULL );
/* clear filename, to avoid overwriting an old file */ /* clear filename, to avoid overwriting an old file */
......
...@@ -163,41 +163,6 @@ class PLUGIN ...@@ -163,41 +163,6 @@ class PLUGIN
{ {
public: public:
virtual ~PLUGIN() {}
/**
* Class RELEASER
* releases a PLUGIN in the context of a potential thrown exception, through
* its destructor.
*/
class RELEASER
{
PLUGIN* plugin;
public:
RELEASER( PLUGIN* aPlugin = NULL ) :
plugin( aPlugin )
{
}
~RELEASER()
{
if( plugin )
IO_MGR::PluginRelease( plugin );
}
operator PLUGIN* ()
{
return plugin;
}
PLUGIN* operator -> ()
{
return plugin;
}
};
//-----<PUBLIC PLUGIN API>------------------------------------------------- //-----<PUBLIC PLUGIN API>-------------------------------------------------
/** /**
...@@ -259,6 +224,40 @@ public: ...@@ -259,6 +224,40 @@ public:
PROPERTIES* aProperties = NULL ); PROPERTIES* aProperties = NULL );
//-----</PUBLIC PLUGIN API>------------------------------------------------ //-----</PUBLIC PLUGIN API>------------------------------------------------
virtual ~PLUGIN() {}
/**
* Class RELEASER
* releases a PLUGIN in the context of a potential thrown exception, through
* its destructor.
*/
class RELEASER
{
PLUGIN* plugin;
public:
RELEASER( PLUGIN* aPlugin = NULL ) :
plugin( aPlugin )
{
}
~RELEASER()
{
if( plugin )
IO_MGR::PluginRelease( plugin );
}
operator PLUGIN* ()
{
return plugin;
}
PLUGIN* operator -> ()
{
return plugin;
}
};
}; };
......
This diff is collapsed.
This diff is collapsed.
...@@ -54,16 +54,16 @@ public: ...@@ -54,16 +54,16 @@ public:
//-----<PLUGIN>------------------------------------------------------------- //-----<PLUGIN>-------------------------------------------------------------
BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe, PROPERTIES* aProperties = NULL ); // overload
void Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* aProperties = NULL ); // overload
const wxString& PluginName() const wxString& PluginName()
{ {
static const wxString name = wxT( "KiCad" ); static const wxString name = wxT( "KiCad" );
return name; return name;
} }
BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe, PROPERTIES* aProperties = NULL ); // overload
void Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* aProperties = NULL ); // overload
//-----</PLUGIN>------------------------------------------------------------ //-----</PLUGIN>------------------------------------------------------------
protected: protected:
...@@ -71,7 +71,9 @@ protected: ...@@ -71,7 +71,9 @@ protected:
wxString m_error; ///< for throwing exceptions wxString m_error; ///< for throwing exceptions
BOARD* m_board; ///< which BOARD, no ownership here BOARD* m_board; ///< which BOARD, no ownership here
LINE_READER* aReader; ///< no ownership here. LINE_READER* m_reader; ///< no ownership here.
wxString m_field; ///< reused to stuff MODULE fields.
/// initialize PLUGIN like a constructor would, and futz with fresh BOARD if needed. /// initialize PLUGIN like a constructor would, and futz with fresh BOARD if needed.
void init( PROPERTIES* aProperties ); void init( PROPERTIES* aProperties );
...@@ -117,7 +119,9 @@ protected: ...@@ -117,7 +119,9 @@ protected:
*/ */
double degParse( const char* aValue, const char** nptrptr = NULL ); double degParse( const char* aValue, const char** nptrptr = NULL );
// load / parse functions //-----<load/parse functions>-----------------------------------------------
void checkVersion();
void loadAllSections( bool doAppend ); void loadAllSections( bool doAppend );
...@@ -152,13 +156,7 @@ protected: ...@@ -152,13 +156,7 @@ protected:
void loadDIMENSION(); // "$COTATION" void loadDIMENSION(); // "$COTATION"
void loadPCB_TARGET(); // "$PCB_TARGET" void loadPCB_TARGET(); // "$PCB_TARGET"
//-----</ load/parse functions>---------------------------------------------
/* @todo
void load( NETINFO* me );
void load( TRACK* me );
*/
// void load( SEGZONE* me );
}; };
#endif // KICAD_PLUGIN_H_ #endif // KICAD_PLUGIN_H_
...@@ -214,7 +214,7 @@ PCB_TARGET* PCB_EDIT_FRAME::CreateTarget( wxDC* DC ) ...@@ -214,7 +214,7 @@ PCB_TARGET* PCB_EDIT_FRAME::CreateTarget( wxDC* DC )
GetBoard()->Add( target ); GetBoard()->Add( target );
target->SetLayer( EDGE_N ); target->SetLayer( EDGE_N );
target->m_Width = GetBoard()->GetBoardDesignSettings()->m_EdgeSegmentWidth; target->m_Width = GetBoard()->GetDesignSettings().m_EdgeSegmentWidth;
target->m_Size = MireDefaultSize; target->m_Size = MireDefaultSize;
target->m_Pos = DrawPanel->GetScreen()->GetCrossHairPosition(); target->m_Pos = DrawPanel->GetScreen()->GetCrossHairPosition();
......
...@@ -155,16 +155,15 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( wxWindow* father, ...@@ -155,16 +155,15 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( wxWindow* father,
UpdateTitle(); UpdateTitle();
if( g_ModuleEditor_Pcb == NULL ) if( g_ModuleEditor_Pcb == NULL )
g_ModuleEditor_Pcb = new BOARD( this ); g_ModuleEditor_Pcb = new BOARD();
SetBoard( g_ModuleEditor_Pcb ); SetBoard( g_ModuleEditor_Pcb );
GetBoard()->m_PcbFrame = this;
if( s_screenModule == NULL ) if( s_screenModule == NULL )
s_screenModule = new PCB_SCREEN(); s_screenModule = new PCB_SCREEN();
SetScreen( s_screenModule ); SetScreen( s_screenModule );
GetBoard()->SetBoardDesignSettings( &s_ModuleEditorDesignSetting ); GetBoard()->SetDesignSettings( s_ModuleEditorDesignSetting );
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
LoadSettings(); LoadSettings();
......
...@@ -1114,9 +1114,11 @@ bool NETLIST_READER::loadNewModules() ...@@ -1114,9 +1114,11 @@ bool NETLIST_READER::loadNewModules()
sort( m_newModulesList.begin(), m_newModulesList.end(), SortByLibName ); sort( m_newModulesList.begin(), m_newModulesList.end(), SortByLibName );
// Calculate the footprint "best" position: // Calculate the footprint "best" position:
if( pcb->ComputeBoundingBox( true ) ) EDA_RECT bbbox = pcb->ComputeBoundingBox( true );
if( bbbox.GetWidth() || bbbox.GetHeight() )
{ {
ModuleBestPosition = pcb->m_BoundaryBox.GetEnd(); ModuleBestPosition = bbbox.GetEnd();
ModuleBestPosition.y += 5000; ModuleBestPosition.y += 5000;
} }
......
...@@ -835,12 +835,12 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard ) ...@@ -835,12 +835,12 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard )
_( "Use the track width when starting on a track, otherwise the current track width" ), _( "Use the track width when starting on a track, otherwise the current track width" ),
true ); true );
if( aBoard->GetBoardDesignSettings()->m_UseConnectedTrackWidth ) if( aBoard->GetDesignSettings().m_UseConnectedTrackWidth )
trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, true ); trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, true );
if( aBoard->m_ViaSizeSelector != 0 if( aBoard->m_ViaSizeSelector != 0
|| aBoard->m_TrackWidthSelector != 0 || aBoard->m_TrackWidthSelector != 0
|| aBoard->GetBoardDesignSettings()->m_UseConnectedTrackWidth ) || aBoard->GetDesignSettings().m_UseConnectedTrackWidth )
trackwidth_menu->Append( ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES, trackwidth_menu->Append( ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES,
_( "Use Netclass Values" ), _( "Use Netclass Values" ),
_( "Use track and via sizes from their Netclass values" ), _( "Use track and via sizes from their Netclass values" ),
......
...@@ -283,7 +283,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title, ...@@ -283,7 +283,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
for ( int i = 0; i < 10; i++ ) for ( int i = 0; i < 10; i++ )
m_Macros[i].m_Record.clear(); m_Macros[i].m_Record.clear();
SetBoard( new BOARD( this ) ); SetBoard( new BOARD() );
// Create the PCB_LAYER_WIDGET *after* SetBoard(): // Create the PCB_LAYER_WIDGET *after* SetBoard():
...@@ -617,7 +617,7 @@ bool PCB_EDIT_FRAME::IsMicroViaAcceptable( void ) ...@@ -617,7 +617,7 @@ bool PCB_EDIT_FRAME::IsMicroViaAcceptable( void )
int copperlayercnt = GetBoard()->GetCopperLayerCount( ); int copperlayercnt = GetBoard()->GetCopperLayerCount( );
int currLayer = getActiveLayer(); int currLayer = getActiveLayer();
if( !GetBoard()->GetBoardDesignSettings()->m_MicroViasAllowed ) if( !GetBoard()->GetDesignSettings().m_MicroViasAllowed )
return false; // Obvious.. return false; // Obvious..
if( copperlayercnt < 4 ) if( copperlayercnt < 4 )
......
...@@ -169,12 +169,12 @@ bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName ) ...@@ -169,12 +169,12 @@ bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName )
wxGetApp().RemoveLibraryPath( g_UserLibDirBuffer ); wxGetApp().RemoveLibraryPath( g_UserLibDirBuffer );
/* Initialize default values. */ // Initialize default values.
g_LibraryNames.Clear(); g_LibraryNames.Clear();
wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false ); wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false );
/* User library path takes precedent over default library search paths. */ // User library path takes precedent over default library search paths.
wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1 ); wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1 );
/* Reset the items visibility flag when loading a new configuration because it could /* Reset the items visibility flag when loading a new configuration because it could
...@@ -207,58 +207,64 @@ void PCB_EDIT_FRAME::SaveProjectSettings() ...@@ -207,58 +207,64 @@ void PCB_EDIT_FRAME::SaveProjectSettings()
} }
PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetProjectFileParameters() PARAM_CFG_ARRAY PCB_EDIT_FRAME::GetProjectFileParameters()
{ {
if( !m_projectFileParams.empty() ) PARAM_CFG_ARRAY pca;
return m_projectFileParams; BOARD_DESIGN_SETTINGS& bds = *GetDesignSettings();
m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "LibDir" ),&g_UserLibDirBuffer, pca.push_back( new PARAM_CFG_FILENAME( wxT( "LibDir" ),&g_UserLibDirBuffer,
GROUPLIB ) ); GROUPLIB ) );
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ), pca.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ),
&g_LibraryNames, &g_LibraryNames,
GROUPLIB ) ); GROUPLIB ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "PadDrlX" ), &g_Pad_Master.m_Drill.x, pca.push_back( new PARAM_CFG_INT( wxT( "PadDrlX" ), &g_Pad_Master.m_Drill.x,
320, 0, 0x7FFF ) ); 320, 0, 0x7FFF ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "PadDimH" ), &g_Pad_Master.m_Size.x, pca.push_back( new PARAM_CFG_INT( wxT( "PadDimH" ), &g_Pad_Master.m_Size.x,
550, 0, 0x7FFF ) ); 550, 0, 0x7FFF ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "PadDimV" ), &g_Pad_Master.m_Size.y, pca.push_back( new PARAM_CFG_INT( wxT( "PadDimV" ), &g_Pad_Master.m_Size.y,
550, 0, 0x7FFF ) ); 550, 0, 0x7FFF ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "BoardThickness" ),
&boardDesignSettings.m_BoardThickness, pca.push_back( new PARAM_CFG_INT( wxT( "BoardThickness" ),
&bds.m_BoardThickness,
630, 0, 0xFFFF ) ); 630, 0, 0xFFFF ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "TxtPcbV" ),
&boardDesignSettings.m_PcbTextSize.y, pca.push_back( new PARAM_CFG_INT( wxT( "TxtPcbV" ),
&bds.m_PcbTextSize.y,
600, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) ); 600, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "TxtPcbH" ),
&boardDesignSettings.m_PcbTextSize.x, pca.push_back( new PARAM_CFG_INT( wxT( "TxtPcbH" ),
&bds.m_PcbTextSize.x,
600, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) ); 600, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "TxtModV" ), &g_ModuleTextSize.y,
pca.push_back( new PARAM_CFG_INT( wxT( "TxtModV" ), &g_ModuleTextSize.y,
500, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) ); 500, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "TxtModH" ), &g_ModuleTextSize.x, pca.push_back( new PARAM_CFG_INT( wxT( "TxtModH" ), &g_ModuleTextSize.x,
500, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) ); 500, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "TxtModW" ), &g_ModuleTextWidth, pca.push_back( new PARAM_CFG_INT( wxT( "TxtModW" ), &g_ModuleTextWidth,
100, 1, TEXTS_MAX_WIDTH ) ); 100, 1, TEXTS_MAX_WIDTH ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "VEgarde" ),
&boardDesignSettings.m_SolderMaskMargin, pca.push_back( new PARAM_CFG_INT( wxT( "VEgarde" ),
&bds.m_SolderMaskMargin,
100, 0, 10000 ) ); 100, 0, 10000 ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "DrawLar" ),
&boardDesignSettings.m_DrawSegmentWidth, pca.push_back( new PARAM_CFG_INT( wxT( "DrawLar" ),
&bds.m_DrawSegmentWidth,
120, 0, 0xFFFF ) ); 120, 0, 0xFFFF ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "EdgeLar" ),
&boardDesignSettings.m_EdgeSegmentWidth, pca.push_back( new PARAM_CFG_INT( wxT( "EdgeLar" ),
&bds.m_EdgeSegmentWidth,
120, 0, 0xFFFF ) ); 120, 0, 0xFFFF ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "TxtLar" ), pca.push_back( new PARAM_CFG_INT( wxT( "TxtLar" ),
&boardDesignSettings.m_PcbTextWidth, &bds.m_PcbTextWidth,
120, 0, 0xFFFF ) ); 120, 0, 0xFFFF ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "MSegLar" ), &g_ModuleSegmentWidth, pca.push_back( new PARAM_CFG_INT( wxT( "MSegLar" ), &g_ModuleSegmentWidth,
120, 0, 0xFFFF ) ); 120, 0, 0xFFFF ) );
m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "LastNetListRead" ), pca.push_back( new PARAM_CFG_FILENAME( wxT( "LastNetListRead" ),
&m_lastNetListRead ) ); &m_lastNetListRead ) );
return m_projectFileParams; return pca;
} }
PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings() PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings()
{ {
if( !m_configSettings.empty() ) if( !m_configSettings.empty() )
......
...@@ -9,20 +9,13 @@ ...@@ -9,20 +9,13 @@
#include "param_config.h" #include "param_config.h"
#include "colors_selection.h" #include "colors_selection.h"
class BOARD_DESIGN_SETTINGS;
#define GROUP wxT( "/pcbnew" ) #define GROUP wxT( "/pcbnew" )
#define GROUPLIB wxT( "/pcbnew/libraries" ) #define GROUPLIB wxT( "/pcbnew/libraries" )
#define GROUPCOMMON wxT( "/common" ) #define GROUPCOMMON wxT( "/common" )
/* Useful macro : */ /* Useful macro : */
#define LOC_COLOR(layer) &g_ColorsSettings.m_LayersColors[layer] #define LOC_COLOR(layer) &g_ColorsSettings.m_LayersColors[layer]
#define ITEM_COLOR(item_visible) &g_ColorsSettings.m_ItemsColors[item_visible] #define ITEM_COLOR(item_visible) &g_ColorsSettings.m_ItemsColors[item_visible]
/* Configuration parameters. */
extern BOARD_DESIGN_SETTINGS boardDesignSettings;
#endif // _PCBNEW_CONFIG_H_ #endif // _PCBNEW_CONFIG_H_
...@@ -917,7 +917,7 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter, ...@@ -917,7 +917,7 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
// If the current layer is a solder mask, use the global mask // If the current layer is a solder mask, use the global mask
// clearance for vias // clearance for vias
if( ( aLayerMask & ( SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT ) ) ) if( ( aLayerMask & ( SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT ) ) )
via_margin = GetBoard()->GetBoardDesignSettings()->m_SolderMaskMargin; via_margin = GetBoard()->GetDesignSettings().m_SolderMaskMargin;
pos = Via->m_Start; pos = Via->m_Start;
size.x = size.y = Via->m_Width + 2 * via_margin; size.x = size.y = Via->m_Width + 2 * via_margin;
......
...@@ -62,10 +62,11 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer ...@@ -62,10 +62,11 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
SheetSize.x = currentsheet->m_Size.x * U_PCB; SheetSize.x = currentsheet->m_Size.x * U_PCB;
SheetSize.y = currentsheet->m_Size.y * U_PCB; SheetSize.y = currentsheet->m_Size.y * U_PCB;
/* Calculate the center of the PCB. */ // Calculate the center of the PCB
m_Pcb->ComputeBoundingBox(); EDA_RECT bbbox = GetBoardBoundingBox();
BoardSize = m_Pcb->m_BoundaryBox.GetSize();
BoardCenter = m_Pcb->m_BoundaryBox.Centre(); BoardSize = bbbox.GetSize();
BoardCenter = bbbox.Centre();
if( g_PcbPlotOptions.m_AutoScale ) // Optimum scale if( g_PcbPlotOptions.m_AutoScale ) // Optimum scale
{ {
......
...@@ -68,9 +68,10 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int ...@@ -68,9 +68,10 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
paperscale = 1; paperscale = 1;
} }
m_Pcb->ComputeBoundingBox(); EDA_RECT bbbox = GetBoardBoundingBox();
BoardSize = m_Pcb->m_BoundaryBox.GetSize();
BoardCenter = m_Pcb->m_BoundaryBox.Centre(); BoardSize = bbbox.GetSize();
BoardCenter = bbbox.Centre();
if( g_PcbPlotOptions.m_AutoScale ) // Optimum scale if( g_PcbPlotOptions.m_AutoScale ) // Optimum scale
{ {
...@@ -119,10 +120,10 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int ...@@ -119,10 +120,10 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
int margin = 500; // Add a 0.5 inch margin around the board int margin = 500; // Add a 0.5 inch margin around the board
plotter->set_negative( true ); plotter->set_negative( true );
plotter->set_color( WHITE ); // Which will be plotted as black plotter->set_color( WHITE ); // Which will be plotted as black
plotter->rect( wxPoint( m_Pcb->m_BoundaryBox.GetX() - margin, plotter->rect( wxPoint( bbbox.GetX() - margin,
m_Pcb->m_BoundaryBox.GetY() - margin ), bbbox.GetY() - margin ),
wxPoint( m_Pcb->m_BoundaryBox.GetRight() + margin, wxPoint( bbbox.GetRight() + margin,
m_Pcb->m_BoundaryBox.GetBottom() + margin ), bbbox.GetBottom() + margin ),
FILLED_SHAPE ); FILLED_SHAPE );
plotter->set_color( BLACK ); plotter->set_color( BLACK );
} }
......
...@@ -167,8 +167,8 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage() ...@@ -167,8 +167,8 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
SheetSize.y *= m_Parent->m_InternalUnits / 1000; // size in internal units SheetSize.y *= m_Parent->m_InternalUnits / 1000; // size in internal units
PCB_BASE_FRAME* pcbframe = (PCB_BASE_FRAME*) m_Parent; PCB_BASE_FRAME* pcbframe = (PCB_BASE_FRAME*) m_Parent;
pcbframe->GetBoard()->ComputeBoundingBox();
EDA_RECT brd_BBox = pcbframe->GetBoard()->m_BoundaryBox; EDA_RECT brd_BBox = pcbframe->GetBoard()->ComputeBoundingBox();
// In module editor, the module is located at 0,0 but for printing // In module editor, the module is located at 0,0 but for printing
// it is moved to SheetSize.x/2, SheetSize.y/2. // it is moved to SheetSize.x/2, SheetSize.y/2.
......
...@@ -312,10 +312,10 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides ) ...@@ -312,10 +312,10 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides )
} }
pt_cur_ch = pt_cur_ch; pt_cur_ch = pt_cur_ch;
segm_oX = GetBoard()->m_BoundaryBox.m_Pos.x + (Board.m_GridRouting * col_source); segm_oX = GetBoard()->GetBoundingBox().m_Pos.x + (Board.m_GridRouting * col_source);
segm_oY = GetBoard()->m_BoundaryBox.m_Pos.y + (Board.m_GridRouting * row_source); segm_oY = GetBoard()->GetBoundingBox().m_Pos.y + (Board.m_GridRouting * row_source);
segm_fX = GetBoard()->m_BoundaryBox.m_Pos.x + (Board.m_GridRouting * col_target); segm_fX = GetBoard()->GetBoundingBox().m_Pos.x + (Board.m_GridRouting * col_target);
segm_fY = GetBoard()->m_BoundaryBox.m_Pos.y + (Board.m_GridRouting * row_target); segm_fY = GetBoard()->GetBoundingBox().m_Pos.y + (Board.m_GridRouting * row_target);
/* Draw segment. */ /* Draw segment. */
GRLine( &DrawPanel->m_ClipBox, GRLine( &DrawPanel->m_ClipBox,
...@@ -461,9 +461,9 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe, ...@@ -461,9 +461,9 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
*/ */
{ {
int cX = ( Board.m_GridRouting * col_source ) int cX = ( Board.m_GridRouting * col_source )
+ pcbframe->GetBoard()->m_BoundaryBox.m_Pos.x; + pcbframe->GetBoard()->GetBoundingBox().m_Pos.x;
int cY = ( Board.m_GridRouting * row_source ) int cY = ( Board.m_GridRouting * row_source )
+ pcbframe->GetBoard()->m_BoundaryBox.m_Pos.y; + pcbframe->GetBoard()->GetBoundingBox().m_Pos.y;
int dx = pt_cur_ch->m_PadStart->m_Size.x / 2; int dx = pt_cur_ch->m_PadStart->m_Size.x / 2;
int dy = pt_cur_ch->m_PadStart->m_Size.y / 2; int dy = pt_cur_ch->m_PadStart->m_Size.y / 2;
int px = pt_cur_ch->m_PadStart->GetPosition().x; int px = pt_cur_ch->m_PadStart->GetPosition().x;
...@@ -476,9 +476,9 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe, ...@@ -476,9 +476,9 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
goto end_of_route; goto end_of_route;
cX = ( Board.m_GridRouting * col_target ) cX = ( Board.m_GridRouting * col_target )
+ pcbframe->GetBoard()->m_BoundaryBox.m_Pos.x; + pcbframe->GetBoard()->GetBoundingBox().m_Pos.x;
cY = ( Board.m_GridRouting * row_target ) cY = ( Board.m_GridRouting * row_target )
+ pcbframe->GetBoard()->m_BoundaryBox.m_Pos.y; + pcbframe->GetBoard()->GetBoundingBox().m_Pos.y;
dx = pt_cur_ch->m_PadEnd->m_Size.x / 2; dx = pt_cur_ch->m_PadEnd->m_Size.x / 2;
dy = pt_cur_ch->m_PadEnd->m_Size.y / 2; dy = pt_cur_ch->m_PadEnd->m_Size.y / 2;
px = pt_cur_ch->m_PadEnd->GetPosition().x; px = pt_cur_ch->m_PadEnd->GetPosition().x;
...@@ -1163,15 +1163,15 @@ static void OrCell_Trace( BOARD* pcb, int col, int row, ...@@ -1163,15 +1163,15 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
g_CurrentTrackSegment->SetLayer( 0x0F ); g_CurrentTrackSegment->SetLayer( 0x0F );
g_CurrentTrackSegment->m_Start.x = g_CurrentTrackSegment->m_Start.x =
g_CurrentTrackSegment->m_End.x = pcb->m_BoundaryBox.m_Pos.x + g_CurrentTrackSegment->m_End.x = pcb->GetBoundingBox().m_Pos.x +
( Board.m_GridRouting * row ); ( Board.m_GridRouting * row );
g_CurrentTrackSegment->m_Start.y = g_CurrentTrackSegment->m_Start.y =
g_CurrentTrackSegment->m_End.y = pcb->m_BoundaryBox.m_Pos.y + g_CurrentTrackSegment->m_End.y = pcb->GetBoundingBox().m_Pos.y +
( Board.m_GridRouting * col ); ( Board.m_GridRouting * col );
g_CurrentTrackSegment->m_Width = pcb->GetCurrentViaSize(); g_CurrentTrackSegment->m_Width = pcb->GetCurrentViaSize();
g_CurrentTrackSegment->m_Shape = pcb->GetBoardDesignSettings()->m_CurrentViaType; g_CurrentTrackSegment->m_Shape = pcb->GetDesignSettings().m_CurrentViaType;
g_CurrentTrackSegment->SetNet( current_net_code ); g_CurrentTrackSegment->SetNet( current_net_code );
} }
...@@ -1187,9 +1187,9 @@ static void OrCell_Trace( BOARD* pcb, int col, int row, ...@@ -1187,9 +1187,9 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
g_CurrentTrackSegment->SetLayer( Route_Layer_TOP ); g_CurrentTrackSegment->SetLayer( Route_Layer_TOP );
g_CurrentTrackSegment->SetState( TRACK_AR, ON ); g_CurrentTrackSegment->SetState( TRACK_AR, ON );
g_CurrentTrackSegment->m_End.x = pcb->m_BoundaryBox.m_Pos.x + g_CurrentTrackSegment->m_End.x = pcb->GetBoundingBox().m_Pos.x +
( Board.m_GridRouting * row ); ( Board.m_GridRouting * row );
g_CurrentTrackSegment->m_End.y = pcb->m_BoundaryBox.m_Pos.y + g_CurrentTrackSegment->m_End.y = pcb->GetBoundingBox().m_Pos.y +
( Board.m_GridRouting * col ); ( Board.m_GridRouting * col );
g_CurrentTrackSegment->SetNet( current_net_code ); g_CurrentTrackSegment->SetNet( current_net_code );
......
...@@ -890,7 +890,7 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER ...@@ -890,7 +890,7 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER
} }
else else
{ {
aBoard->ComputeBoundingBox(); EDA_RECT bbbox = aBoard->ComputeBoundingBox();
RECTANGLE* rect = new RECTANGLE( boundary ); RECTANGLE* rect = new RECTANGLE( boundary );
boundary->rectangle = rect; boundary->rectangle = rect;
...@@ -898,11 +898,9 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER ...@@ -898,11 +898,9 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER
rect->layer_id = "pcb"; rect->layer_id = "pcb";
// opposite corners // opposite corners
wxPoint bottomRight; wxPoint bottomRight( bbbox.GetRight(), bbbox.GetBottom() );
bottomRight.x = aBoard->m_BoundaryBox.GetRight();
bottomRight.y = aBoard->m_BoundaryBox.GetBottom();
rect->SetCorners( mapPt( aBoard->m_BoundaryBox.GetOrigin() ), rect->SetCorners( mapPt( bbbox.GetOrigin() ),
mapPt( bottomRight ) ); mapPt( bottomRight ) );
} }
} }
......
...@@ -102,7 +102,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator() ...@@ -102,7 +102,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator()
change = true; change = true;
} }
int via_type = GetBoard()->GetBoardDesignSettings()->m_CurrentViaType; int via_type = GetBoard()->GetDesignSettings().m_CurrentViaType;
via_color = GetBoard()->GetVisibleElementColor(VIAS_VISIBLE+via_type); via_color = GetBoard()->GetVisibleElementColor(VIAS_VISIBLE+via_type);
if( previous_via_color != via_color ) if( previous_via_color != via_color )
......
...@@ -35,7 +35,7 @@ void PCB_EDIT_FRAME::OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent ) ...@@ -35,7 +35,7 @@ void PCB_EDIT_FRAME::OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent )
{ {
bool check = ( ( ( ID_POPUP_PCB_SELECT_WIDTH1 + bool check = ( ( ( ID_POPUP_PCB_SELECT_WIDTH1 +
(int) GetBoard()->m_TrackWidthSelector ) == aEvent.GetId() ) && (int) GetBoard()->m_TrackWidthSelector ) == aEvent.GetId() ) &&
!GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth ); !GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth );
aEvent.Check( check ); aEvent.Check( check );
} }
} }
...@@ -43,7 +43,7 @@ void PCB_EDIT_FRAME::OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent ) ...@@ -43,7 +43,7 @@ void PCB_EDIT_FRAME::OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent )
void PCB_EDIT_FRAME::OnUpdateSelectAutoTrackWidth( wxUpdateUIEvent& aEvent ) void PCB_EDIT_FRAME::OnUpdateSelectAutoTrackWidth( wxUpdateUIEvent& aEvent )
{ {
aEvent.Check( GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth ); aEvent.Check( GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth );
} }
...@@ -60,7 +60,7 @@ void PCB_EDIT_FRAME::OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent ) ...@@ -60,7 +60,7 @@ void PCB_EDIT_FRAME::OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent )
{ {
bool check = ( ( ( ID_POPUP_PCB_SELECT_VIASIZE1 + bool check = ( ( ( ID_POPUP_PCB_SELECT_VIASIZE1 +
(int) GetBoard()->m_ViaSizeSelector ) == aEvent.GetId() ) && (int) GetBoard()->m_ViaSizeSelector ) == aEvent.GetId() ) &&
!GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth ); !GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth );
aEvent.Check( check ); aEvent.Check( check );
} }
......
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