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()
m_gllist = glGenLists( 1 );
pcb->ComputeBoundingBox();
g_Parm_3D_Visu.m_BoardSettings = pcb->GetBoardDesignSettings();
g_Parm_3D_Visu.m_BoardSize = pcb->m_BoundaryBox.GetSize();
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_Layers = pcb->GetCopperLayerCount();
EDA_RECT bbbox = pcbframe->GetBoardBoundingBox();
g_Parm_3D_Visu.m_BoardSettings = &pcb->GetDesignSettings();
g_Parm_3D_Visu.m_BoardSize = bbbox.GetSize();
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
// a *really* single side board in the true life...
......@@ -175,7 +178,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
// because all boards thickness no not match with this setup:
// 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;
/* calculate z position for each layer */
......
......@@ -150,8 +150,10 @@ public:
wxPoint m_BoardPos;
wxSize m_BoardSize;
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:
* when scaled between -1.0 and +1.0 */
......
......@@ -4,6 +4,36 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
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>
================================================================================
Pcbnew:
......@@ -17,7 +47,7 @@ Pcbnew:
2011-Nov-27 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
PCBNew
++PCBNew
* Add PLUGIN and IO_MGR classes.
* Remove one argument from BOARD constructor,
* add BOARD::SetWindowFrame()
......
......@@ -53,4 +53,7 @@ E6) Start initial work for changing component library file format to use Dick's
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" ) );
/* PCB file name wild card definitions. */
const wxString ModuleFileWildcard( _( "KiCad footprint library files (*.mod)|*.mod" ) );
int g_CurrentVersionPCB = 1;
int g_RotationAngle;
int g_AnchorColor = BLUE;
......
......@@ -169,7 +169,7 @@ void EDA_APP::WriteProjectConfig( const wxString& fileName,
void EDA_APP::WriteProjectConfig( const wxString& fileName,
const wxString& GroupName,
PARAM_CFG_ARRAY& params )
const PARAM_CFG_ARRAY& params )
{
ReCreatePrjConfig( fileName, GroupName, FORCE_LOCAL_CONFIG );
......@@ -189,7 +189,7 @@ void EDA_APP::WriteProjectConfig( const wxString& fileName,
m_ProjectConfig->Write( wxT( "version" ), CONFIG_VERSION );
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 )
m_ProjectConfig->SetPath( param.m_Group );
......@@ -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 )
return;
BOOST_FOREACH( PARAM_CFG_BASE& param, List )
BOOST_FOREACH( const PARAM_CFG_BASE& param, List )
{
if( param.m_Setup == false )
continue;
......@@ -326,7 +326,7 @@ bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename,
bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename,
const wxString& GroupName,
PARAM_CFG_ARRAY& params,
const PARAM_CFG_ARRAY& params,
bool Load_Only_if_New )
{
wxString timestamp;
......@@ -356,7 +356,7 @@ bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename,
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 )
m_ProjectConfig->SetPath( param.m_Group );
......@@ -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 )
continue;
......@@ -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
* @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 )
return;
......@@ -461,7 +461,7 @@ void PARAM_CFG_INT::ReadParam( wxConfigBase* aConfig )
* save the value of parameter this stored in aConfig
* @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 )
return;
......@@ -497,7 +497,7 @@ PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( bool Insetup,
* read the value of parameter this stored in aConfig
* @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 )
return;
......@@ -513,7 +513,7 @@ void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig )
* save the the value of parameter this stored in aConfig
* @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 )
return;
......@@ -555,7 +555,7 @@ PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( bool Insetup,
* read the value of parameter this stored in aConfig
* @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 )
return;
......@@ -584,7 +584,7 @@ void PARAM_CFG_DOUBLE::ReadParam( wxConfigBase* aConfig )
* save the the value of parameter this stored in aConfig
* @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 )
return;
......@@ -619,7 +619,7 @@ PARAM_CFG_BOOL::PARAM_CFG_BOOL( bool Insetup,
* read the value of parameter this stored in aConfig
* @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 )
return;
......@@ -634,7 +634,7 @@ void PARAM_CFG_BOOL::ReadParam( wxConfigBase* aConfig )
* save the the value of parameter this stored in aConfig
* @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 )
return;
......@@ -668,7 +668,7 @@ PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( bool Insetup, const wxChar* ident,
* read the value of parameter this stored in aConfig
* @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 )
return;
......@@ -680,7 +680,7 @@ void PARAM_CFG_WXSTRING::ReadParam( wxConfigBase* aConfig )
* save the value of parameter this stored in aConfig
* @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 )
return;
......@@ -703,7 +703,7 @@ PARAM_CFG_FILENAME::PARAM_CFG_FILENAME( const wxChar* ident,
* read the value of parameter this stored in aConfig
* @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 )
return;
......@@ -722,7 +722,7 @@ void PARAM_CFG_FILENAME::ReadParam( wxConfigBase* aConfig )
* save the value of parameter this stored in aConfig
* @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 )
return;
......@@ -747,7 +747,7 @@ PARAM_CFG_LIBNAME_LIST::PARAM_CFG_LIBNAME_LIST( const wxChar* ident,
* read the value of parameter this stored in aConfig
* @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 )
return;
......@@ -780,7 +780,7 @@ void PARAM_CFG_LIBNAME_LIST::ReadParam( wxConfigBase* aConfig )
* save the value of parameter this in aConfig (list of parameters)
* @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 )
return;
......
......@@ -61,7 +61,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
icon.CopyFromBitmap( KiBitmap( icon_cvpcb_xpm ) );
SetIcon( icon );
SetBoard( new BOARD( this ) );
SetBoard( new BOARD() );
SetScreen( new PCB_SCREEN() );
LoadSettings();
......
......@@ -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() )
return m_projectFileParams;
......
......@@ -134,6 +134,8 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
wxColour bgColor = MakeColour( g_DrawBgColor );
wxBrush bgBrush( bgColor, wxSOLID );
GERBVIEW_FRAME* gerbFrame = (GERBVIEW_FRAME*) aPanel->GetParent();
int bitmapWidth, bitmapHeight;
wxDC* plotDC = aDC;
......@@ -188,7 +190,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
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
continue;
......@@ -269,7 +271,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
int dcode_highlight = 0;
if( layer == ( (GERBVIEW_FRAME*) m_PcbFrame )->getActiveLayer() )
if( layer == gerbFrame->getActiveLayer() )
dcode_highlight = gerber->m_Selected_Tool;
int layerdrawMode = GR_COPY;
......
......@@ -19,6 +19,7 @@
#include "class_board_design_settings.h"
#include "class_gerber_draw_item.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
......@@ -51,7 +52,7 @@ GBR_TO_PCB_EXPORTER::GBR_TO_PCB_EXPORTER( GERBVIEW_FRAME * aFrame, FILE * aFile
{
m_gerbview_frame = aFrame;
m_file = aFile;
m_pcb = new BOARD( m_gerbview_frame );
m_pcb = new BOARD();
}
......@@ -177,7 +178,7 @@ bool GBR_TO_PCB_EXPORTER::WriteGeneralDescrPcb( )
{
int nbLayers;
/* Print the copper layer count */
// Print the copper layer count
nbLayers = m_pcb->GetCopperLayerCount();
if( nbLayers <= 1 ) // Minimal layers count in Pcbnew is 2
......@@ -190,12 +191,13 @@ bool GBR_TO_PCB_EXPORTER::WriteGeneralDescrPcb( )
fprintf( m_file, "encoding utf-8\n");
fprintf( m_file, "LayerCount %d\n", nbLayers );
/* Compute and print the board bounding box */
m_pcb->ComputeBoundingBox();
// Compute and print the board bounding box
EDA_RECT bbbox = m_pcb->ComputeBoundingBox();
fprintf( m_file, "Di %d %d %d %d\n",
m_pcb->m_BoundaryBox.GetX(), m_pcb->m_BoundaryBox.GetY(),
m_pcb->m_BoundaryBox.GetRight(),
m_pcb->m_BoundaryBox.GetBottom() );
bbbox.GetX(), bbbox.GetY(),
bbbox.GetRight(),
bbbox.GetBottom() );
fprintf( m_file, "$EndGENERAL\n\n" );
return true;
......@@ -237,7 +239,7 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable )
SetLocaleTo_C_standard();
// 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() ) );
WriteGeneralDescrPcb( );
WriteSetup( );
......
......@@ -61,7 +61,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
SetScreen( new PCB_SCREEN() );
GetScreen()->m_CurrentSheetDesc = &g_Sheet_GERBER;
SetBoard( new BOARD( this ) );
SetBoard( new BOARD() );
GetBoard()->SetEnabledLayers( FULL_LAYERS ); // All 32 layers enabled at first.
GetBoard()->SetVisibleLayers( FULL_LAYERS ); // All 32 layers visible.
......
......@@ -62,8 +62,8 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query )
}
}
GetBoard()->m_BoundaryBox.SetOrigin( 0, 0 );
GetBoard()->m_BoundaryBox.SetSize( 0, 0 );
GetBoard()->SetBoundingBox( EDA_RECT() );
GetBoard()->m_Status_Pcb = 0;
GetBoard()->m_NbNodes = 0;
GetBoard()->m_NbNoconnect = 0;
......
......@@ -176,9 +176,10 @@ public: EDA_APP();
void WriteProjectConfig( const wxString& local_config_filename,
const wxString& GroupName,
PARAM_CFG_BASE** List );
void WriteProjectConfig( const wxString& fileName,
const wxString& GroupName,
PARAM_CFG_ARRAY& params );
const PARAM_CFG_ARRAY& params );
/**
* Function SaveCurrentSetupValues
......@@ -188,7 +189,7 @@ public: EDA_APP();
* @param aList = array of PARAM_CFG_BASE pointers
*/
void SaveCurrentSetupValues( PARAM_CFG_BASE** aList );
void SaveCurrentSetupValues( PARAM_CFG_ARRAY& List );
void SaveCurrentSetupValues( const PARAM_CFG_ARRAY& List );
/**
* Function ReadCurrentSetupValues
......@@ -198,7 +199,7 @@ public: EDA_APP();
* @param aList = array of PARAM_CFG_BASE pointers
*/
void ReadCurrentSetupValues( PARAM_CFG_BASE** aList );
void ReadCurrentSetupValues( PARAM_CFG_ARRAY& List );
void ReadCurrentSetupValues( const PARAM_CFG_ARRAY& List );
/**
* Function ReadProjectConfig
......@@ -220,7 +221,7 @@ public: EDA_APP();
bool Load_Only_if_New );
bool ReadProjectConfig( const wxString& local_config_filename,
const wxString& GroupName,
PARAM_CFG_ARRAY& List,
const PARAM_CFG_ARRAY& List,
bool Load_Only_if_New );
/**
......
......@@ -12,4 +12,8 @@ class wxString;
*/
wxString GetBuildVersion();
/// The file format revision of the *.brd file created by this build
#define BOARD_FILE_VERSION 1
#endif // KICAD_BUILD_VERSION_H
......@@ -11,34 +11,33 @@
class BOARD_DESIGN_SETTINGS
{
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:
bool m_MicroViasAllowed; // true to allow micro vias
int m_CurrentViaType; // via type (VIA_BLIND_BURIED, VIA_TROUGHT VIA_MICROVIA)
bool m_MicroViasAllowed; ///< true to allow micro vias
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;
int m_DrawSegmentWidth; // current graphic line width (not EDGE layer)
int m_EdgeSegmentWidth; // current graphic line width (EDGE layer only)
int m_PcbTextWidth; // current Pcb (not module) Text width
wxSize m_PcbTextSize; // current Pcb (not module) Text size
int m_TrackMinWidth; // track min value for width ((min copper size value
int m_ViasMinSize; // vias (not micro vias) min diameter
int m_ViasMinDrill; // vias (not micro vias) min drill diameter
int m_MicroViasMinSize; // micro vias (not vias) min diameter
int m_MicroViasMinDrill; // micro vias (not vias) min drill diameter
int m_DrawSegmentWidth; ///< current graphic line width (not EDGE layer)
int m_EdgeSegmentWidth; ///< current graphic line width (EDGE layer only)
int m_PcbTextWidth; ///< current Pcb (not module) Text width
wxSize m_PcbTextSize; ///< current Pcb (not module) Text size
int m_TrackMinWidth; ///< track min value for width ((min copper size value
int m_ViasMinSize; ///< vias (not micro vias) min diameter
int m_ViasMinDrill; ///< vias (not micro vias) min drill diameter
int m_MicroViasMinSize; ///< micro vias (not vias) min diameter
int m_MicroViasMinDrill; ///< micro vias (not vias) min drill diameter
// Global mask margins:
int m_SolderMaskMargin; // Solder mask margin
int m_SolderPasteMargin; // Solder paste margin absolute value
double m_SolderPasteMarginRatio; // Solder pask margin ratio value of pad size
// The final margin is the sum of these 2 values
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
int m_SolderMaskMargin; ///< Solder mask margin
int m_SolderPasteMargin; ///< Solder paste margin absolute value
double m_SolderPasteMarginRatio; ///< Solder pask margin ratio value of pad size
///< The final margin is the sum of these 2 values
int m_BoardThickness; ///< Board Thickness for 3D viewer
public:
BOARD_DESIGN_SETTINGS();
......@@ -79,7 +78,6 @@ public:
return (bool) ( m_VisibleLayers & m_EnabledLayers & (1 << aLayerIndex) );
}
/**
* Function SetLayerVisibility
* changes the visibility of a given layer
......@@ -98,7 +96,6 @@ public:
return m_VisibleElements;
}
/**
* Function SetVisibleElements
* changes the bit-mask of visible element categories
......@@ -159,7 +156,6 @@ public:
return bool( m_EnabledLayers & (1 << aLayerIndex) );
}
/**
* Function GetCopperLayerCount
* @return int - the number of neabled copper layers
......@@ -169,7 +165,6 @@ public:
return m_CopperLayerCount;
}
/**
* Function SetCopperLayerCount
* do what its name says...
......
......@@ -48,7 +48,6 @@ class BOARD_ITEM : public EDA_ITEM
void SetNext( EDA_ITEM* aNext ) { Pnext = aNext; }
void SetBack( EDA_ITEM* aBack ) { Pback = aBack; }
protected:
int m_Layer;
......@@ -60,7 +59,6 @@ public:
{
}
BOARD_ITEM( const BOARD_ITEM& src ) :
EDA_ITEM( src.m_Parent, src.Type() )
, m_Layer( src.m_Layer )
......@@ -68,7 +66,6 @@ public:
m_Flags = src.m_Flags;
}
/**
* A value of wxPoint(0,0) which can be passed to the Draw() functions.
*/
......@@ -107,7 +104,6 @@ public:
*/
virtual void SetLayer( int aLayer ) { m_Layer = aLayer; }
/**
* Function Draw
* BOARD_ITEMs have their own color information.
......@@ -115,7 +111,6 @@ public:
virtual void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
int aDrawMode, const wxPoint& offset = ZeroOffset ) = 0;
/**
* Function IsOnLayer
* tests to see if this object is on the given layer. Is virtual so
......@@ -214,7 +209,6 @@ public:
wxMessageBox( wxT( "virtual BOARD_ITEM::Flip used, should not occur" ), GetClass() );
}
/**
* Function GetBoard
* returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
......
......@@ -3,8 +3,8 @@
* @file param_config.h
*/
#ifndef __PARAM_CONFIG_H__
#define __PARAM_CONFIG_H__ 1
#ifndef PARAM_CONFIG_H_
#define PARAM_CONFIG_H_
#include "wx/confbase.h"
#include "wx/fileconf.h"
......@@ -45,21 +45,23 @@ public:
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
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
* reads the value of the parameter stored in aConfig
* @param aConfig = the wxConfigBase that holds the parameter
*/
virtual void ReadParam( wxConfigBase* aConfig ) {};
virtual void ReadParam( wxConfigBase* aConfig ) const {};
/**
* Function SaveParam
* saves the value of the parameter stored in aConfig
* @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:
int m_Min, m_Max; ///< Minimum and maximum values of the param type
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,
const wxChar* group = NULL );
PARAM_CFG_INT( bool Insetup, const wxChar* ident, int* ptparam,
int default_val = 0, int min = INT_MINVAL, int max = INT_MAXVAL,
const wxChar* group = NULL );
virtual void ReadParam( wxConfigBase* aConfig );
virtual void SaveParam( wxConfigBase* aConfig );
virtual void ReadParam( wxConfigBase* aConfig ) const;
virtual void SaveParam( wxConfigBase* aConfig ) const;
};
......@@ -96,13 +99,14 @@ public:
int* m_Pt_param; ///< Pointer to the parameter value
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 );
PARAM_CFG_SETCOLOR( bool Insetup, const wxChar* ident, int* ptparam,
int default_val, const wxChar* group = NULL );
virtual void ReadParam( wxConfigBase* aConfig );
virtual void SaveParam( wxConfigBase* aConfig );
virtual void ReadParam( wxConfigBase* aConfig ) const;
virtual void SaveParam( wxConfigBase* aConfig ) const;
};
......@@ -117,15 +121,16 @@ public:
double m_Default; ///< The default value of the parameter
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,
const wxChar* group = NULL );
PARAM_CFG_DOUBLE( bool Insetup, const wxChar* ident, double* ptparam,
double default_val = 0.0, double min = 0.0, double max = 10000.0,
const wxChar* group = NULL );
virtual void ReadParam( wxConfigBase* aConfig );
virtual void SaveParam( wxConfigBase* aConfig );
virtual void ReadParam( wxConfigBase* aConfig ) const;
virtual void SaveParam( wxConfigBase* aConfig ) const;
};
......@@ -139,13 +144,14 @@ public:
bool* m_Pt_param; ///< Pointer to the parameter value
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 );
PARAM_CFG_BOOL( bool Insetup, const wxChar* ident, bool* ptparam,
int default_val = false, const wxChar* group = NULL );
virtual void ReadParam( wxConfigBase* aConfig );
virtual void SaveParam( wxConfigBase* aConfig );
virtual void ReadParam( wxConfigBase* aConfig ) const;
virtual void SaveParam( wxConfigBase* aConfig ) const;
};
......@@ -167,12 +173,11 @@ public:
const wxString& default_val = wxEmptyString,
const wxChar* group = NULL );
virtual ~PARAM_CFG_WXSTRING() {}
virtual void ReadParam( wxConfigBase* aConfig );
virtual void SaveParam( wxConfigBase* aConfig );
virtual void ReadParam( wxConfigBase* aConfig ) const;
virtual void SaveParam( wxConfigBase* aConfig ) const;
};
/**
* Configuration parameter - PARAM_CFG_FILENAME Class
* Same as PARAM_CFG_WXSTRING, but stores "\" as "/".
......@@ -184,9 +189,10 @@ class PARAM_CFG_FILENAME : public PARAM_CFG_BASE
public:
wxString* m_Pt_param; ///< Pointer to the parameter value
public: PARAM_CFG_FILENAME( const wxChar* ident, wxString* ptparam, const wxChar* group = NULL );
virtual void ReadParam( wxConfigBase* aConfig );
virtual void SaveParam( wxConfigBase* aConfig );
public:
PARAM_CFG_FILENAME( const wxChar* ident, wxString* ptparam, const wxChar* group = NULL );
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
public:
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,
const wxChar* group = NULL );
virtual void ReadParam( wxConfigBase* aConfig );
virtual void SaveParam( wxConfigBase* aConfig );
virtual void ReadParam( wxConfigBase* aConfig ) const;
virtual void SaveParam( wxConfigBase* aConfig ) const;
};
/** A list of parameters type */
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;
class EDA_3D_FRAME;
class GENERAL_COLLECTOR;
class GENERAL_COLLECTORS_GUIDE;
class BOARD_DESIGN_SETTINGS;
/**
* class PCB_BASE_FRAME
......@@ -80,13 +80,17 @@ public:
FOOTPRINT_EDIT_FRAME* m_ModuleEditFrame;
protected:
BOARD* m_Pcb;
GENERAL_COLLECTOR* m_Collector;
// EDA_RECT m_BoundaryBox; // Board size and position
BOARD* m_Pcb;
GENERAL_COLLECTOR* m_Collector;
void updateGridSelectBox();
void updateZoomSelectBox();
virtual void unitsChangeRefresh();
public:
PCB_BASE_FRAME( wxWindow* father, int idtype, const wxString& title,
const wxPoint& pos, const wxSize& size,
......@@ -94,6 +98,14 @@ public:
~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
* sets the m_Pcb member in such as way as to ensure deleting any previous
......@@ -108,6 +120,8 @@ public:
return m_Pcb;
}
BOARD_DESIGN_SETTINGS* GetDesignSettings();
// General
virtual void OnCloseWindow( wxCloseEvent& Event ) = 0;
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) { }
......
......@@ -88,7 +88,6 @@ protected:
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.
wxString m_lastNetListRead; ///< Last net list read with relative path.
......@@ -276,16 +275,17 @@ public:
/**
* Function GetProjectFileParameters
* returns the project file parameter list for Pcbnew.
* returns a project file parameter list for Pcbnew.
* <p>
* Populate the project file parameter array specific to Pcbnew if it hasn't
* already been populated and return a reference to the array to the caller.
* Populate a project file parameter array specific to Pcbnew.
* 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
* at compile time requiring global variable definitions by design.
* </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();
......@@ -302,13 +302,13 @@ public:
* Function GetConfigurationSettings
* 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
* was confusing and caused some settings to get saved and loaded
* incorrectly. Currently, only the settings that are needed at start
* up by the main window are defined here. There are other locally used
* settings are scattered throughout the Pcbnew source code. If you need
* to define a configuration setting that need to be loaded at run time,
* settings that are scattered throughout the Pcbnew source code. If you need
* to define a configuration setting that needs to be loaded at run time,
* this is the place to define it.
*
* @todo: Define the configuration variables as member variables instead of
......
......@@ -182,7 +182,6 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
wxPoint start, current;
int Ymax_size, Xsize_allowed;
int pas_grille = (int) GetScreen()->GetGridSize().x;
bool edgesExists;
double surface;
if( GetBoard()->m_Modules == NULL )
......@@ -195,9 +194,12 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
if( !IsOK( this, _( "Move modules?" ) ) )
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,
_( "Could not automatically place modules. No board outlines detected." ) );
......@@ -218,12 +220,12 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
/* to move modules outside the board, the cursor is placed below
* 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();
pos.y = GetBoard()->m_BoundaryBox.GetBottom() + 2000;
pos.y = bbbox.GetBottom() + 2000;
GetScreen()->SetCrossHairPosition( pos );
}
}
......@@ -235,9 +237,9 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
{
Module = moduleList[ii];
if( PlaceModulesHorsPcb && edgesExists )
if( PlaceModulesHorsPcb && edgesExist )
{
if( GetBoard()->m_BoundaryBox.Contains( Module->m_Pos ) )
if( bbbox.Contains( Module->m_Pos ) )
continue;
}
......@@ -256,9 +258,9 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
if( Module->IsLocked() )
continue;
if( PlaceModulesHorsPcb && edgesExists )
if( PlaceModulesHorsPcb && edgesExist )
{
if( GetBoard()->m_BoundaryBox.Contains( Module->m_Pos ) )
if( bbbox.Contains( Module->m_Pos ) )
continue;
}
......
......@@ -75,6 +75,9 @@ static const float OrientPenality[11] =
#define OUT_OF_BOARD -2
#define OCCUPED_By_MODULE -1
static EDA_RECT bbbox; // boards bounding box
static wxPoint CurrPosition; // Current position of the current module placement
static bool AutoPlaceShowAll = true;
......@@ -182,7 +185,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
if( Module->m_ModuleStatus & MODULE_is_LOCKED )
break;
if( !GetBoard()->m_BoundaryBox.Contains( Module->m_Pos ) )
if( !bbbox.Contains( Module->m_Pos ) )
Module->m_ModuleStatus |= MODULE_to_PLACE;
break;
......@@ -367,11 +370,11 @@ void PCB_EDIT_FRAME::DrawInfoPlace( wxDC* DC )
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++ )
{
ox = GetBoard()->m_BoundaryBox.m_Pos.x + (jj * Board.m_GridRouting);
ox = bbbox.m_Pos.x + (jj * Board.m_GridRouting);
color = BLACK;
top_state = GetCell( ii, jj, TOP );
......@@ -408,28 +411,28 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
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!" ) );
return 0;
}
/* The boundary box must have its start point on placing grid: */
GetBoard()->m_BoundaryBox.m_Pos.x -= GetBoard()->m_BoundaryBox.m_Pos.x %
Board.m_GridRouting;
GetBoard()->m_BoundaryBox.m_Pos.y -= GetBoard()->m_BoundaryBox.m_Pos.y %
Board.m_GridRouting;
bbbox.m_Pos.x -= bbbox.m_Pos.x % Board.m_GridRouting;
bbbox.m_Pos.y -= bbbox.m_Pos.y % Board.m_GridRouting;
/* 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 += Board.m_GridRouting;
end.y -= 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;
Ncols = GetBoard()->m_BoundaryBox.GetWidth() / Board.m_GridRouting;
Nrows = bbbox.GetHeight() / Board.m_GridRouting;
Ncols = bbbox.GetWidth() / Board.m_GridRouting;
/* get a small margin for memory allocation: */
Ncols += 2; Nrows += 2;
NbCells = Ncols * Nrows;
......@@ -533,29 +536,29 @@ void PCB_EDIT_FRAME::GenModuleOnBoard( MODULE* Module )
oy = Module->m_BoundaryBox.m_Pos.y - marge;
fy = Module->m_BoundaryBox.GetBottom() + marge;
if( ox < GetBoard()->m_BoundaryBox.m_Pos.x )
ox = GetBoard()->m_BoundaryBox.m_Pos.x;
if( ox < bbbox.m_Pos.x )
ox = bbbox.m_Pos.x;
if( ox > GetBoard()->m_BoundaryBox.GetRight() )
ox = GetBoard()->m_BoundaryBox.GetRight();
if( ox > bbbox.GetRight() )
ox = bbbox.GetRight();
if( fx < GetBoard()->m_BoundaryBox.m_Pos.x )
fx = GetBoard()->m_BoundaryBox.m_Pos.x;
if( fx < bbbox.m_Pos.x )
fx = bbbox.m_Pos.x;
if( fx > GetBoard()->m_BoundaryBox.GetRight() )
fx = GetBoard()->m_BoundaryBox.GetRight();
if( fx > bbbox.GetRight() )
fx = bbbox.GetRight();
if( oy < GetBoard()->m_BoundaryBox.m_Pos.y )
oy = GetBoard()->m_BoundaryBox.m_Pos.y;
if( oy < bbbox.m_Pos.y )
oy = bbbox.m_Pos.y;
if( oy > GetBoard()->m_BoundaryBox.GetBottom() )
oy = GetBoard()->m_BoundaryBox.GetBottom();
if( oy > bbbox.GetBottom() )
oy = bbbox.GetBottom();
if( fy < GetBoard()->m_BoundaryBox.m_Pos.y )
fy = GetBoard()->m_BoundaryBox.m_Pos.y;
if( fy < bbbox.m_Pos.y )
fy = bbbox.m_Pos.y;
if( fy > GetBoard()->m_BoundaryBox.GetBottom() )
fy = GetBoard()->m_BoundaryBox.GetBottom();
if( fy > bbbox.GetBottom() )
fy = bbbox.GetBottom();
layerMask = 0;
......@@ -598,8 +601,8 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
aModule->DisplayInfo( this );
LastPosOK.x = GetBoard()->m_BoundaryBox.m_Pos.x;
LastPosOK.y = GetBoard()->m_BoundaryBox.m_Pos.y;
LastPosOK.x = bbbox.m_Pos.x;
LastPosOK.y = bbbox.m_Pos.y;
cx = aModule->m_Pos.x; cy = aModule->m_Pos.y;
ox = aModule->m_BoundaryBox.m_Pos.x - cx;
......@@ -607,8 +610,8 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
oy = aModule->m_BoundaryBox.m_Pos.y - cy;
fy = aModule->m_BoundaryBox.m_Size.y + oy;
CurrPosition.x = GetBoard()->m_BoundaryBox.m_Pos.x - ox;
CurrPosition.y = GetBoard()->m_BoundaryBox.m_Pos.y - oy;
CurrPosition.x = bbbox.m_Pos.x - ox;
CurrPosition.y = bbbox.m_Pos.y - oy;
/* Module placement on grid. */
CurrPosition.x -= CurrPosition.x % Board.m_GridRouting;
......@@ -647,7 +650,7 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
mincout = -1.0;
SetStatusText( wxT( "Score ??, pos ??" ) );
for( ; CurrPosition.x < GetBoard()->m_BoundaryBox.GetRight() - fx;
for( ; CurrPosition.x < bbbox.GetRight() - fx;
CurrPosition.x += Board.m_GridRouting )
{
wxYield();
......@@ -667,14 +670,14 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
DrawModuleOutlines( DrawPanel, aDC, aModule );
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. */
CurrPosition.y -= CurrPosition.y % Board.m_GridRouting;
DrawModuleOutlines( DrawPanel, aDC, aModule );
for( ; CurrPosition.y < GetBoard()->m_BoundaryBox.GetBottom() - fy;
for( ; CurrPosition.y < bbbox.GetBottom() - fy;
CurrPosition.y += Board.m_GridRouting )
{
/* Erase traces. */
......@@ -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;
unsigned int data;
ux0 -= Pcb->m_BoundaryBox.m_Pos.x;
uy0 -= Pcb->m_BoundaryBox.m_Pos.y;
ux1 -= Pcb->m_BoundaryBox.m_Pos.x;
uy1 -= Pcb->m_BoundaryBox.m_Pos.y;
ux0 -= Pcb->GetBoundingBox().m_Pos.x;
uy0 -= Pcb->GetBoundingBox().m_Pos.y;
ux1 -= Pcb->GetBoundingBox().m_Pos.x;
uy1 -= Pcb->GetBoundingBox().m_Pos.y;
row_max = uy1 / 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
int row_min, row_max, col_min, col_max;
unsigned int keepOut;
ux0 -= Pcb->m_BoundaryBox.m_Pos.x;
uy0 -= Pcb->m_BoundaryBox.m_Pos.y;
ux1 -= Pcb->m_BoundaryBox.m_Pos.x;
uy1 -= Pcb->m_BoundaryBox.m_Pos.y;
ux0 -= Pcb->GetBoundingBox().m_Pos.x;
uy0 -= Pcb->GetBoundingBox().m_Pos.y;
ux1 -= Pcb->GetBoundingBox().m_Pos.x;
uy1 -= Pcb->GetBoundingBox().m_Pos.y;
row_max = uy1 / Board.m_GridRouting;
col_max = ux1 / Board.m_GridRouting;
......@@ -979,10 +982,10 @@ static void CreateKeepOutRectangle( BOARD* Pcb,
if( trace == 0 )
return;
ux0 -= Pcb->m_BoundaryBox.m_Pos.x;
uy0 -= Pcb->m_BoundaryBox.m_Pos.y;
ux1 -= Pcb->m_BoundaryBox.m_Pos.x;
uy1 -= Pcb->m_BoundaryBox.m_Pos.y;
ux0 -= Pcb->GetBoundingBox().m_Pos.x;
uy0 -= Pcb->GetBoundingBox().m_Pos.y;
ux1 -= Pcb->GetBoundingBox().m_Pos.x;
uy1 -= Pcb->GetBoundingBox().m_Pos.y;
ux0 -= marge; ux1 += marge;
uy0 -= marge; uy1 += marge;
......
......@@ -110,6 +110,8 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* father,
PCB_BASE_FRAME::~PCB_BASE_FRAME()
{
delete m_Collector;
// delete m_Pcb;
}
......@@ -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 )
{
int dx, dy;
double ii, jj;
wxSize size;
if( m_Pcb == NULL )
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();
if( size.x )
......@@ -149,7 +187,7 @@ double PCB_BASE_FRAME::BestZoom( void )
double bestzoom = MAX( ii, jj );
GetScreen()->SetScrollCenterPosition( m_Pcb->m_BoundaryBox.Centre() );
GetScreen()->SetScrollCenterPosition( bbbox.Centre() );
return bestzoom ;
}
......
......@@ -48,20 +48,25 @@ bool MATRIX_ROUTING_HEAD::ComputeMatrixSize( BOARD* aPcb )
{
aPcb->ComputeBoundingBox();
/* 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;
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 start point on routing grid:
m_BrdBox = aPcb->GetBoundingBox();
/* 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();
end.x -= end.x % m_GridRouting;
end.x += m_GridRouting;
end.y -= end.y % m_GridRouting;
end.y += m_GridRouting;
aPcb->m_BoundaryBox.SetEnd( end );
m_BrdBox.SetEnd(end);
aPcb->SetBoundingBox( m_BrdBox );
m_Nrows = Nrows = m_BrdBox.m_Size.y / 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 )
int Build_Work( BOARD* Pcb )
{
RATSNEST_ITEM* pt_rats;
D_PAD* pt_pad;
int r1, r2, c1, c2, current_net_code;
RATSNEST_ITEM* pt_ch;
int demi_pas = Board.m_GridRouting / 2;
wxString msg;
RATSNEST_ITEM* pt_rats;
D_PAD* pt_pad;
int r1, r2, c1, c2, current_net_code;
RATSNEST_ITEM* pt_ch;
int demi_pas = Board.m_GridRouting / 2;
wxString msg;
EDA_RECT bbbox = Pcb->GetBoundingBox();
InitWork(); /* clear work list */
Ntotal = 0;
......@@ -361,48 +368,48 @@ int Build_Work( BOARD* Pcb )
current_net_code = pt_pad->GetNet();
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;
if( r1 < 0 || r1 >= Nrows )
{
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 );
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;
if( c1 < 0 || c1 >= Ncols )
{
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 );
return 0;
}
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;
if( r2 < 0 || r2 >= Nrows )
{
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 );
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;
if( c2 < 0 || c2 >= Ncols )
{
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 );
return 0;
}
......
......@@ -10,6 +10,7 @@
#include "common.h"
#include "pcbcommon.h"
#include "wxBasePcbFrame.h"
#include "build_version.h" // BOARD_FILE_VERSION
#include "pcbnew.h"
#include "colors_selection.h"
......@@ -27,18 +28,14 @@
wxPoint BOARD_ITEM::ZeroOffset( 0, 0 );
// Current design settings (used also to read configs):
BOARD_DESIGN_SETTINGS boardDesignSettings;
BOARD::BOARD( PCB_BASE_FRAME* frame ) :
BOARD::BOARD() :
BOARD_ITEM( (BOARD_ITEM*) NULL, PCB_T ),
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.
SetBoardDesignSettings( &boardDesignSettings );
SetColorsSettings( &g_ColorsSettings );
m_NbNodes = 0; // Number of connected pads.
m_NbNoconnect = 0; // Number of unconnected nets.
......@@ -69,8 +66,12 @@ BOARD::BOARD( PCB_BASE_FRAME* frame ) :
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() )
m_PcbFrame->GetScreen()->ClearUndoRedoList();
*/
while( m_ZoneDescriptorList.size() )
{
......@@ -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 )
{
TRACK* segment; // The current segment being analyzed.
......@@ -466,36 +474,36 @@ LAYER_T LAYER::ParseType( const char* aType )
int BOARD::GetCopperLayerCount() const
{
return GetBoardDesignSettings()->GetCopperLayerCount();
return m_designSettings.GetCopperLayerCount();
}
void BOARD::SetCopperLayerCount( int aCount )
{
GetBoardDesignSettings()->SetCopperLayerCount( aCount );
m_designSettings.SetCopperLayerCount( aCount );
}
int BOARD::GetEnabledLayers() const
{
return GetBoardDesignSettings()->GetEnabledLayers();
return m_designSettings.GetEnabledLayers();
}
int BOARD::GetVisibleLayers() const
{
return GetBoardDesignSettings()->GetVisibleLayers();
return m_designSettings.GetVisibleLayers();
}
void BOARD::SetEnabledLayers( int aLayerMask )
{
GetBoardDesignSettings()->SetEnabledLayers( aLayerMask );
m_designSettings.SetEnabledLayers( aLayerMask );
}
void BOARD::SetVisibleLayers( int aLayerMask )
{
GetBoardDesignSettings()->SetVisibleLayers( aLayerMask );
m_designSettings.SetVisibleLayers( aLayerMask );
}
......@@ -529,13 +537,13 @@ void BOARD::SetVisibleAlls( )
int BOARD::GetVisibleElements() const
{
return GetBoardDesignSettings()->GetVisibleElements();
return m_designSettings.GetVisibleElements();
}
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 )
switch( aPCB_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
// 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
......@@ -563,7 +571,7 @@ void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled )
default:
GetBoardDesignSettings()->SetElementVisibility( aPCB_VISIBLE, isEnabled );
m_designSettings.SetElementVisibility( aPCB_VISIBLE, isEnabled );
}
}
......@@ -829,7 +837,7 @@ unsigned BOARD::GetNodesCount()
}
bool BOARD::ComputeBoundingBox( bool aBoardEdgesOnly )
EDA_RECT BOARD::ComputeBoundingBox( bool aBoardEdgesOnly )
{
bool hasItems = false;
EDA_RECT area;
......@@ -898,26 +906,9 @@ bool BOARD::ComputeBoundingBox( bool aBoardEdgesOnly )
}
}
if( !hasItems && m_PcbFrame )
{
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;
m_BoundingBox = area; // save for BOARD::GetBoundingBox()
return hasItems;
return area;
}
......@@ -1782,7 +1773,7 @@ TRACK* BOARD::GetTrace( TRACK* aTrace, const wxPoint& aPosition, int aLayerMask
if( track->GetState( BUSY | IS_DELETED ) )
continue;
if( GetBoardDesignSettings()->IsLayerVisible( layer ) == false )
if( m_designSettings.IsLayerVisible( layer ) == false )
continue;
if( track->Type() == PCB_VIA_T ) /* VIA encountered. */
......
......@@ -152,28 +152,24 @@ private:
typedef std::vector<MARKER_PCB*> MARKERS;
/// MARKER_PCBs for clearance problems, owned by pointer.
MARKERS m_markers;
MARKERS m_markers;
// @todo: switch to boost::ptr_vector, and change ~BOARD()
typedef std::vector<ZONE_CONTAINER*> ZONE_CONTAINERS;
/// edge zone descriptors, owned by pointer.
ZONE_CONTAINERS m_ZoneDescriptorList;
ZONE_CONTAINERS m_ZoneDescriptorList;
LAYER m_Layer[NB_COPPER_LAYERS];
// if true m_hightLight_NetCode is used
HIGH_LIGHT_INFO m_hightLight; // current high light data
HIGH_LIGHT_INFO m_hightLightPrevious; // a previously stored high light data
LAYER m_Layer[NB_COPPER_LAYERS];
// if true m_hightLight_NetCode is used
HIGH_LIGHT_INFO m_hightLight; // current high light data
HIGH_LIGHT_INFO m_hightLightPrevious; // a previously stored high light data
public:
PCB_BASE_FRAME* m_PcbFrame; // Window of visualization
int m_fileFormatVersionAtLoad; ///< the version in the *.brd header on first line
void SetWindowFrame( PCB_BASE_FRAME* aFrame )
{
m_PcbFrame = aFrame;
}
EDA_RECT m_BoundingBox;
EDA_RECT m_BoundaryBox; // Board size and position
public:
/// Flags used in ratsnest calculation and update.
int m_Status_Pcb;
......@@ -184,29 +180,29 @@ public:
/// Active ratsnest count (ratsnests not already connected by tracks)
int m_NbNoconnect;
DLIST<BOARD_ITEM> m_Drawings; // linked list of lines & texts
DLIST<MODULE> m_Modules; // linked list of MODULEs
DLIST<TRACK> m_Track; // linked list of TRACKs and SEGVIAs
DLIST<SEGZONE> m_Zone; // linked list of SEGZONEs
DLIST<BOARD_ITEM> m_Drawings; // linked list of lines & texts
DLIST<MODULE> m_Modules; // linked list of MODULEs
DLIST<TRACK> m_Track; // linked list of TRACKs and SEGVIAs
DLIST<SEGZONE> m_Zone; // linked list of SEGZONEs
/// nets info list (name, design constraints ..
NETINFO_LIST* m_NetInfo;
NETINFO_LIST* m_NetInfo;
/// 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).
std::vector<RATSNEST_ITEM> m_LocalRatsnest;
std::vector<RATSNEST_ITEM> m_LocalRatsnest;
/// zone contour currently in progress
ZONE_CONTAINER* m_CurrentZoneContour;
ZONE_CONTAINER* m_CurrentZoneContour;
/// 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.
/// This is also the last used netclass after starting a track.
wxString m_CurrentNetClassName;
wxString m_CurrentNetClassName;
// handling of vias and tracks size:
// the first value is always the value of the current NetClass
......@@ -228,7 +224,7 @@ public:
unsigned m_TrackWidthSelector;
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
/**
......@@ -243,9 +239,13 @@ private:
void chainMarkedSegments( wxPoint aPosition, int aLayerMask, TRACK_PTRS* aList );
public:
BOARD( PCB_BASE_FRAME* frame );
BOARD();
~BOARD();
void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; }
int GetFileFormatVersionAtLoad() const { return m_fileFormatVersionAtLoad; }
/**
* Function GetDefaultLayerName
* returns a default name of a PCB layer when given \a aLayerNumber. This
......@@ -275,7 +275,6 @@ public:
#define ADD_APPEND 1 ///< aControl flag for Add( aControl ), appends not inserts
/**
* Function Delete
* removes the given single item from this BOARD and deletes its memory.
......@@ -427,7 +426,7 @@ public:
*/
bool IsLayerEnabled( int aLayer ) const
{
return GetBoardDesignSettings()->IsLayerEnabled( aLayer );
return m_designSettings.IsLayerEnabled( aLayer );
}
/**
......@@ -439,7 +438,7 @@ public:
*/
bool IsLayerVisible( int aLayerIndex ) const
{
return GetBoardDesignSettings()->IsLayerVisible( aLayerIndex );
return m_designSettings.IsLayerVisible( aLayerIndex );
}
/**
......@@ -524,24 +523,20 @@ public:
void SetVisibleElementColor( int aPCB_VISIBLE, int aColor );
/**
* Function GetBoardDesignSettings
* @return the current BOARD_DESIGN_SETTINGS in use
* Function GetDesignSettings
* @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
* @param aDesignSettings = the new BOARD_DESIGN_SETTINGS to use
* Function SetDesignSettings
* @param aDesignSettings the new BOARD_DESIGN_SETTINGS to use
*/
void SetBoardDesignSettings( BOARD_DESIGN_SETTINGS* aDesignSettings)
{
m_boardDesignSettings = aDesignSettings;
}
void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aDesignSettings );
/**
* Function SetBoardSettings
......@@ -652,9 +647,20 @@ public:
* Function ComputeBoundingBox
* 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 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
......
......@@ -17,7 +17,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS()
{
m_EnabledLayers = ALL_LAYERS; // All layers enabled at first.
// 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
......@@ -47,7 +47,6 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS()
// Layer thickness for 3D viewer
m_BoardThickness = (int)(1.6 * PCB_INTERNAL_UNIT / 25.4);
}
......
......@@ -35,11 +35,9 @@
#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.
const wxString NETCLASS::Default = wxT("Default");
// Initial values for netclass initialization
int NETCLASS::DEFAULT_CLEARANCE = 100; // track to track and track to pads clearance
int NETCLASS::DEFAULT_VIA_DRILL = 250; // default via drill
......@@ -68,16 +66,17 @@ void NETCLASS::SetParams( const NETCLASS* defaults )
SetuViaDrill( defaults->GetuViaDrill() );
}
else
{ // We should use m_Parent->GetBoardDesignSettings()
{ // We should use m_Parent->GetDesignSettings()
// But when the NETCLASSES constructor is called
// (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.
const BOARD_DESIGN_SETTINGS& g = boardDesignSettings;
const BOARD_DESIGN_SETTINGS& g = m_Parent->GetDesignSettings(); // like that?
SetTrackWidth( g.m_TrackMinWidth );
SetViaDiameter( g.m_ViasMinSize );
SetuViaDiameter(g.m_MicroViasMinSize );
// Use default values for next parameters:
SetClearance( DEFAULT_CLEARANCE );
SetViaDrill( DEFAULT_VIA_DRILL );
......@@ -410,27 +409,26 @@ bool NETCLASS::ReadDescr( LINE_READER* aReader )
int NETCLASS::GetTrackMinWidth() const
{
return m_Parent->GetBoardDesignSettings()->m_TrackMinWidth;
return m_Parent->GetDesignSettings().m_TrackMinWidth;
}
int NETCLASS::GetViaMinDiameter() const
{
return m_Parent->GetBoardDesignSettings()->m_ViasMinSize;
return m_Parent->GetDesignSettings().m_ViasMinSize;
}
int NETCLASS::GetViaMinDrill() const
{
return m_Parent->GetBoardDesignSettings()->m_ViasMinDrill;
return m_Parent->GetDesignSettings().m_ViasMinDrill;
}
int NETCLASS::GetuViaMinDiameter() const
{
return m_Parent->GetBoardDesignSettings()->m_MicroViasMinSize;
return m_Parent->GetDesignSettings().m_MicroViasMinSize;
}
int NETCLASS::GetuViaMinDrill() const
{
return m_Parent->GetBoardDesignSettings()->m_MicroViasMinDrill;
return m_Parent->GetDesignSettings().m_MicroViasMinDrill;
}
......@@ -304,7 +304,7 @@ int D_PAD::GetSolderMaskMargin()
if( margin == 0 )
{
BOARD * brd = GetBoard();
margin = brd->GetBoardDesignSettings()->m_SolderMaskMargin;
margin = brd->GetDesignSettings().m_SolderMaskMargin;
}
}
......@@ -344,14 +344,14 @@ wxSize D_PAD::GetSolderPasteMargin()
BOARD * brd = GetBoard();
if( margin == 0 )
margin = brd->GetBoardDesignSettings()->m_SolderPasteMargin;
margin = brd->GetDesignSettings().m_SolderPasteMargin;
if( mratio == 0.0 )
mratio = module->m_LocalSolderPasteMarginRatio;
if( mratio == 0.0 )
{
mratio = brd->GetBoardDesignSettings()->m_SolderPasteMarginRatio;
mratio = brd->GetDesignSettings().m_SolderPasteMarginRatio;
}
}
......
......@@ -59,7 +59,7 @@ public:
}
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; }
......
......@@ -843,16 +843,22 @@ bool ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
m_CornerSelection = -1; // Set to not found
// 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
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 )
{
// Use grid size because it is known
wxRealPoint grid = GetBoard()->m_PcbFrame->DrawPanel->GetGrid();
min_dist = wxRound( MIN( grid.x, grid.y ) );
}
#endif
wxPoint delta;
unsigned lim = m_Poly->corner.size();
......@@ -861,6 +867,7 @@ bool ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
{
delta.x = refPos.x - m_Poly->corner[item_pos].x;
delta.y = refPos.y - m_Poly->corner[item_pos].y;
// Calculate a distance:
int dist = MAX( abs( delta.x ), abs( delta.y ) );
......@@ -881,15 +888,23 @@ bool ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos )
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
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 )
{
// Use grid size because it is known
wxRealPoint grid = GetBoard()->m_PcbFrame->DrawPanel->GetGrid();
min_dist = wxRound( MIN( grid.x, grid.y ) );
}
#endif
unsigned first_corner_pos = 0;
......
......@@ -213,18 +213,18 @@ void DIALOG_DESIGN_RULES::PrintCurrentSettings()
// Display min values:
value = ReturnStringFromValue( g_UserUnit,
m_BrdSettings->m_TrackMinWidth,
m_BrdSettings.m_TrackMinWidth,
internal_units,
true );
msg.Printf( _( "Minimum value for tracks width: <b>%s</b><br>\n" ), GetChars( value ) );
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 ) );
m_MessagesList->AppendToPage( msg );
value = ReturnStringFromValue( g_UserUnit,
m_BrdSettings->m_MicroViasMinSize,
m_BrdSettings.m_MicroViasMinSize,
internal_units,
true );
msg.Printf( _( "Minimum value for microvias diameter: <b>%s</b><br>\n" ), GetChars( value ) );
......@@ -240,7 +240,7 @@ void DIALOG_DESIGN_RULES::InitDialogRules()
SetReturnCode( 0 );
m_Pcb = m_Parent->GetBoard();
m_BrdSettings = m_Pcb->GetBoardDesignSettings();
m_BrdSettings = m_Pcb->GetDesignSettings();
// Initialize the Rules List
InitRulesList();
......@@ -291,21 +291,21 @@ void DIALOG_DESIGN_RULES::InitGlobalRules()
AddUnitSymbol( *m_TrackMinWidthTitle );
int Internal_Unit = m_Parent->m_InternalUnits;
PutValueInLocalUnits( *m_SetViasMinSizeCtrl, m_BrdSettings->m_ViasMinSize, Internal_Unit );
PutValueInLocalUnits( *m_SetViasMinDrillCtrl, m_BrdSettings->m_ViasMinDrill, Internal_Unit );
PutValueInLocalUnits( *m_SetViasMinSizeCtrl, m_BrdSettings.m_ViasMinSize, 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_AllowMicroViaCtrl->SetSelection( m_BrdSettings->m_MicroViasAllowed ? 1 : 0 );
m_AllowMicroViaCtrl->SetSelection( m_BrdSettings.m_MicroViasAllowed ? 1 : 0 );
PutValueInLocalUnits( *m_SetMicroViasMinSizeCtrl,
m_BrdSettings->m_MicroViasMinSize,
m_BrdSettings.m_MicroViasMinSize,
Internal_Unit );
PutValueInLocalUnits( *m_SetMicroViasMinDrillCtrl,
m_BrdSettings->m_MicroViasMinDrill,
m_BrdSettings.m_MicroViasMinDrill,
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.
// note we display only extra values, never the current netclass value.
......@@ -605,26 +605,26 @@ void DIALOG_DESIGN_RULES::CopyRulesListToBoard()
void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard()
/*************************************************/
{
m_BrdSettings->m_CurrentViaType = VIA_THROUGH;
m_BrdSettings.m_CurrentViaType = VIA_THROUGH;
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
m_BrdSettings->m_ViasMinSize =
m_BrdSettings.m_ViasMinSize =
ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl, m_Parent->m_InternalUnits );
m_BrdSettings->m_ViasMinDrill =
m_BrdSettings.m_ViasMinDrill =
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
m_BrdSettings->m_MicroViasMinSize =
m_BrdSettings.m_MicroViasMinSize =
ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl, m_Parent->m_InternalUnits );
m_BrdSettings->m_MicroViasMinDrill =
m_BrdSettings.m_MicroViasMinDrill =
ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl, m_Parent->m_InternalUnits );
// Update tracks minimum values for DRC
m_BrdSettings->m_TrackMinWidth =
m_BrdSettings.m_TrackMinWidth =
ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits );
}
......@@ -708,6 +708,8 @@ void DIALOG_DESIGN_RULES::OnOkButtonClick( wxCommandEvent& event )
return;
}
m_Pcb->SetDesignSettings( m_BrdSettings );
CopyRulesListToBoard();
CopyGlobalRulesToBoard();
CopyDimensionsListsToBoard();
......
......@@ -40,7 +40,7 @@ private:
PCB_EDIT_FRAME* m_Parent;
BOARD* m_Pcb;
BOARD_DESIGN_SETTINGS* m_BrdSettings;
BOARD_DESIGN_SETTINGS m_BrdSettings;
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 ) :
{
m_tester = aTester;
m_Parent = parent;
m_BrdSettings = m_Parent->GetBoard()->GetBoardDesignSettings();
m_BrdSettings = m_Parent->GetBoard()->GetDesignSettings();
InitValues();
if( GetSizer() )
......@@ -130,12 +130,14 @@ void DIALOG_DRC_CONTROL::InitValues()
*/
void DIALOG_DRC_CONTROL::SetDrcParmeters( )
{
m_BrdSettings->m_TrackMinWidth =
m_BrdSettings.m_TrackMinWidth =
ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits );
m_BrdSettings->m_ViasMinSize =
m_BrdSettings.m_ViasMinSize =
ReturnValueFromTextCtrl( *m_SetViaMinSizeCtrl, m_Parent->m_InternalUnits );
m_BrdSettings->m_MicroViasMinSize =
m_BrdSettings.m_MicroViasMinSize =
ReturnValueFromTextCtrl( *m_SetMicroViakMinSizeCtrl, m_Parent->m_InternalUnits );
m_Parent->GetBoard()->SetDesignSettings( m_BrdSettings );
}
......@@ -160,7 +162,7 @@ void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event )
reportName = m_RptFilenameCtrl->GetValue();
}
SetDrcParmeters( );
SetDrcParmeters();
m_tester->SetSettings( true, // Pad to pad DRC test enabled
true, // unconnected pdas DRC test enabled
......@@ -238,7 +240,7 @@ void DIALOG_DRC_CONTROL::OnListUnconnectedClick( wxCommandEvent& event )
reportName = m_RptFilenameCtrl->GetValue();
}
SetDrcParmeters( );
SetDrcParmeters();
m_tester->SetSettings( true, // Pad to pad DRC test enabled
true, // unconnected pdas DRC test enabled
......@@ -311,7 +313,7 @@ void DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick( wxCommandEvent& event )
void DIALOG_DRC_CONTROL::OnOkClick( wxCommandEvent& event )
{
SetReturnCode( wxID_OK );
SetDrcParmeters( );
SetDrcParmeters();
m_tester->DestroyDialog( wxID_OK );
}
......
......@@ -44,7 +44,7 @@ class BOARD_DESIGN_SETTINGS;
class DIALOG_DRC_CONTROL: public DIALOG_DRC_CONTROL_BASE
{
public:
BOARD_DESIGN_SETTINGS* m_BrdSettings;
BOARD_DESIGN_SETTINGS m_BrdSettings;
/// Constructors
DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* parent );
......
......@@ -33,7 +33,7 @@ private:
PCB_EDIT_FRAME* m_Parent;
wxDC* m_DC;
DRAWSEGMENT* m_Item;
BOARD_DESIGN_SETTINGS* m_BrdSettings;
BOARD_DESIGN_SETTINGS m_BrdSettings;
public:
DialogGraphicItemProperties( PCB_EDIT_FRAME* aParent, DRAWSEGMENT * aItem, wxDC * aDC);
......@@ -53,7 +53,7 @@ DialogGraphicItemProperties::DialogGraphicItemProperties( PCB_EDIT_FRAME* aParen
m_Parent = aParent;
m_DC = aDC;
m_Item = aItem;
m_BrdSettings = m_Parent->GetBoard()->GetBoardDesignSettings();
m_BrdSettings = m_Parent->GetBoard()->GetDesignSettings();
initDlg();
Layout();
GetSizer()->SetSizeHints( this );
......@@ -88,32 +88,34 @@ void DialogGraphicItemProperties::initDlg( )
SetFocus();
wxString msg;
// Change texts according to the segment shape:
switch ( m_Item->m_Shape )
{
case S_CIRCLE:
m_Start_Center_XText->SetLabel(_("Center X"));
m_Start_Center_YText->SetLabel(_("Center Y"));
m_EndX_Radius_Text->SetLabel(_("Point X"));
m_EndY_Text->SetLabel(_("Point Y"));
m_Angle_Text->Show(false);
m_Angle_Ctrl->Show(false);
break;
case S_ARC:
m_Start_Center_XText->SetLabel(_("Center X"));
m_Start_Center_YText->SetLabel(_("Center Y"));
m_EndX_Radius_Text->SetLabel(_("Start Point X"));
m_EndY_Text->SetLabel(_("Start Point Y"));
msg << m_Item->m_Angle;
m_Angle_Ctrl->SetValue(msg);
break;
default:
m_Angle_Text->Show(false);
m_Angle_Ctrl->Show(false);
break;
case S_CIRCLE:
m_Start_Center_XText->SetLabel(_("Center X"));
m_Start_Center_YText->SetLabel(_("Center Y"));
m_EndX_Radius_Text->SetLabel(_("Point X"));
m_EndY_Text->SetLabel(_("Point Y"));
m_Angle_Text->Show(false);
m_Angle_Ctrl->Show(false);
break;
case S_ARC:
m_Start_Center_XText->SetLabel(_("Center X"));
m_Start_Center_YText->SetLabel(_("Center Y"));
m_EndX_Radius_Text->SetLabel(_("Start Point X"));
m_EndY_Text->SetLabel(_("Start Point Y"));
msg << m_Item->m_Angle;
m_Angle_Ctrl->SetValue(msg);
break;
default:
m_Angle_Text->Show(false);
m_Angle_Ctrl->Show(false);
break;
}
AddUnitSymbol( *m_Start_Center_XText );
PutValueInLocalUnits( *m_Center_StartXCtrl, m_Item->m_Start.x,
......@@ -136,11 +138,14 @@ void DialogGraphicItemProperties::initDlg( )
m_Parent->m_InternalUnits );
AddUnitSymbol( *m_DefaultThicknessText );
int thickness;
if( m_Item->GetLayer() == EDGE_N )
thickness = m_BrdSettings->m_EdgeSegmentWidth;
thickness = m_BrdSettings.m_EdgeSegmentWidth;
else
thickness = m_BrdSettings->m_DrawSegmentWidth;
thickness = m_BrdSettings.m_DrawSegmentWidth;
PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness,
m_Parent->m_InternalUnits );
......@@ -156,8 +161,6 @@ void DialogGraphicItemProperties::initDlg( )
if ( layer > LAST_NO_COPPER_LAYER )
layer = LAST_NO_COPPER_LAYER;
m_LayerSelection->SetSelection( layer - FIRST_NO_COPPER_LAYER );
}
......@@ -166,10 +169,12 @@ void DialogGraphicItemProperties::OnLayerChoice( wxCommandEvent& event )
/*******************************************************************/
{
int thickness;
if( (m_LayerSelection->GetCurrentSelection() + FIRST_NO_COPPER_LAYER) == EDGE_N )
thickness = m_BrdSettings->m_EdgeSegmentWidth;
thickness = m_BrdSettings.m_EdgeSegmentWidth;
else
thickness = m_BrdSettings->m_DrawSegmentWidth;
thickness = m_BrdSettings.m_DrawSegmentWidth;
PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness,
m_Parent->m_InternalUnits );
}
......@@ -183,7 +188,7 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event )
m_Parent->SaveCopyInUndoList( m_Item, UR_CHANGED );
wxString msg;
if ( m_DC )
if( m_DC )
m_Item->Draw( m_Parent->DrawPanel, m_DC, GR_XOR );
msg = m_Center_StartXCtrl->GetValue();
......@@ -213,11 +218,11 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event )
m_Item->SetLayer( m_LayerSelection->GetCurrentSelection() + FIRST_NO_COPPER_LAYER);
if( m_Item->GetLayer() == EDGE_N )
m_BrdSettings->m_EdgeSegmentWidth = thickness;
m_BrdSettings.m_EdgeSegmentWidth = thickness;
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;
m_Angle_Ctrl->GetValue().ToLong(&angle);
......@@ -226,10 +231,12 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event )
}
m_Parent->OnModify();
if ( m_DC )
if( m_DC )
m_Item->Draw( m_Parent->DrawPanel, m_DC, GR_OR );
m_Item->DisplayInfo( m_Parent );
m_Parent->GetBoard()->SetDesignSettings( m_BrdSettings );
Close( TRUE );
}
......
......@@ -40,7 +40,7 @@ DIALOG_GRAPHIC_ITEMS_OPTIONS::DIALOG_GRAPHIC_ITEMS_OPTIONS( PCB_BASE_FRAME* pare
: DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE( parent )
{
m_Parent = parent;
m_BrdSettings = m_Parent->GetBoard()->GetBoardDesignSettings();
m_BrdSettings = m_Parent->GetBoard()->GetDesignSettings();
initValues( );
m_sdbSizer1OK->SetDefault();
......@@ -49,7 +49,7 @@ DIALOG_GRAPHIC_ITEMS_OPTIONS::DIALOG_GRAPHIC_ITEMS_OPTIONS( PCB_BASE_FRAME* pare
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()
/* Drawings width */
AddUnitSymbol( *m_GraphicSegmWidthTitle );
PutValueInLocalUnits( *m_OptPcbSegmWidth,
m_BrdSettings->m_DrawSegmentWidth,
m_BrdSettings.m_DrawSegmentWidth,
PCB_INTERNAL_UNIT );
/* Edges width */
AddUnitSymbol( *m_BoardEdgesWidthTitle );
PutValueInLocalUnits( *m_OptPcbEdgesWidth,
m_BrdSettings->m_EdgeSegmentWidth,
m_BrdSettings.m_EdgeSegmentWidth,
PCB_INTERNAL_UNIT );
/* Pcb Textes (Size & Width) */
AddUnitSymbol( *m_CopperTextWidthTitle );
PutValueInLocalUnits( *m_OptPcbTextWidth,
m_BrdSettings->m_PcbTextWidth, PCB_INTERNAL_UNIT );
m_BrdSettings.m_PcbTextWidth, PCB_INTERNAL_UNIT );
AddUnitSymbol( *m_TextSizeVTitle );
PutValueInLocalUnits( *m_OptPcbTextVSize,
m_BrdSettings->m_PcbTextSize.y, PCB_INTERNAL_UNIT );
m_BrdSettings.m_PcbTextSize.y, PCB_INTERNAL_UNIT );
AddUnitSymbol( *m_TextSizeHTitle );
PutValueInLocalUnits( *m_OptPcbTextHSize,
m_BrdSettings->m_PcbTextSize.x, PCB_INTERNAL_UNIT );
m_BrdSettings.m_PcbTextSize.x, PCB_INTERNAL_UNIT );
/* Modules: Edges width */
......@@ -109,17 +109,19 @@ void DIALOG_GRAPHIC_ITEMS_OPTIONS::initValues()
void DIALOG_GRAPHIC_ITEMS_OPTIONS::OnOkClick( wxCommandEvent& event )
{
m_BrdSettings->m_DrawSegmentWidth =
m_BrdSettings.m_DrawSegmentWidth =
ReturnValueFromTextCtrl( *m_OptPcbSegmWidth, PCB_INTERNAL_UNIT );
m_BrdSettings->m_EdgeSegmentWidth =
m_BrdSettings.m_EdgeSegmentWidth =
ReturnValueFromTextCtrl( *m_OptPcbEdgesWidth, PCB_INTERNAL_UNIT );
m_BrdSettings->m_PcbTextWidth =
m_BrdSettings.m_PcbTextWidth =
ReturnValueFromTextCtrl( *m_OptPcbTextWidth, PCB_INTERNAL_UNIT );
m_BrdSettings->m_PcbTextSize.y =
m_BrdSettings.m_PcbTextSize.y =
ReturnValueFromTextCtrl( *m_OptPcbTextVSize, PCB_INTERNAL_UNIT );
m_BrdSettings->m_PcbTextSize.x =
m_BrdSettings.m_PcbTextSize.x =
ReturnValueFromTextCtrl( *m_OptPcbTextHSize, PCB_INTERNAL_UNIT );
m_Parent->GetBoard()->SetDesignSettings( m_BrdSettings );
g_ModuleSegmentWidth =
ReturnValueFromTextCtrl( *m_OptModuleEdgesWidth, PCB_INTERNAL_UNIT );
g_ModuleTextWidth =
......@@ -139,7 +141,6 @@ void DIALOG_GRAPHIC_ITEMS_OPTIONS::OnOkClick( wxCommandEvent& event )
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/
......
......@@ -38,8 +38,8 @@
class DIALOG_GRAPHIC_ITEMS_OPTIONS: public DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE
{
public:
BOARD_DESIGN_SETTINGS* m_BrdSettings;
PCB_BASE_FRAME * m_Parent;
BOARD_DESIGN_SETTINGS m_BrdSettings;
PCB_BASE_FRAME * m_Parent;
public:
DIALOG_GRAPHIC_ITEMS_OPTIONS( PCB_BASE_FRAME* parent );
......
......@@ -26,7 +26,7 @@ DIALOG_PADS_MASK_CLEARANCE::DIALOG_PADS_MASK_CLEARANCE( PCB_EDIT_FRAME* parent )
DIALOG_PADS_MASK_CLEARANCE_BASE( parent )
{
m_Parent = parent;
m_BrdSettings = m_Parent->GetBoard()->GetBoardDesignSettings();
m_BrdSettings = m_Parent->GetBoard()->GetDesignSettings();
MyInit();
m_sdbButtonsSizerOK->SetDefault();
......@@ -44,20 +44,20 @@ void DIALOG_PADS_MASK_CLEARANCE::MyInit()
int Internal_Unit = m_Parent->m_InternalUnits;
PutValueInLocalUnits( *m_SolderMaskMarginCtrl,
m_BrdSettings->m_SolderMaskMargin,
m_BrdSettings.m_SolderMaskMargin,
Internal_Unit );
// These 2 parameters are usually < 0, so prepare entering a negative
// value, if current is 0
PutValueInLocalUnits( *m_SolderPasteMarginCtrl,
m_BrdSettings->m_SolderPasteMargin,
m_BrdSettings.m_SolderPasteMargin,
Internal_Unit );
if( m_BrdSettings->m_SolderPasteMargin == 0 )
if( m_BrdSettings.m_SolderPasteMargin == 0 )
m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) +
m_SolderPasteMarginCtrl->GetValue() );
wxString msg;
msg.Printf( wxT( "%f" ), m_BrdSettings->m_SolderPasteMarginRatio * 100.0 );
if( m_BrdSettings->m_SolderPasteMarginRatio == 0.0 &&
msg.Printf( wxT( "%f" ), m_BrdSettings.m_SolderPasteMarginRatio * 100.0 );
if( m_BrdSettings.m_SolderPasteMarginRatio == 0.0 &&
msg[0] == '0') // Sometimes Printf add a sign if the value is small
m_SolderPasteMarginRatioCtrl->SetValue( wxT( "-" ) + msg );
else
......@@ -69,10 +69,12 @@ void DIALOG_PADS_MASK_CLEARANCE::MyInit()
void DIALOG_PADS_MASK_CLEARANCE::OnButtonOkClick( wxCommandEvent& event )
/*******************************************************************/
{
m_BrdSettings->m_SolderMaskMargin =
m_BrdSettings.m_SolderMaskMargin =
ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->m_InternalUnits );
m_BrdSettings->m_SolderPasteMargin =
m_BrdSettings.m_SolderPasteMargin =
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->m_InternalUnits );
double dtmp = 0;
wxString msg = m_SolderPasteMarginRatioCtrl->GetValue();
msg.ToDouble( &dtmp );
......@@ -82,7 +84,10 @@ void DIALOG_PADS_MASK_CLEARANCE::OnButtonOkClick( wxCommandEvent& event )
dtmp = -50;
if( dtmp > +100 )
dtmp = +100;
m_BrdSettings->m_SolderPasteMarginRatio = dtmp / 100;
m_BrdSettings.m_SolderPasteMarginRatio = dtmp / 100;
m_Parent->GetBoard()->SetDesignSettings( m_BrdSettings );
EndModal( 1 );
}
......
......@@ -20,7 +20,7 @@ class DIALOG_PADS_MASK_CLEARANCE : public DIALOG_PADS_MASK_CLEARANCE_BASE
{
private:
PCB_EDIT_FRAME* m_Parent;
BOARD_DESIGN_SETTINGS* m_BrdSettings;
BOARD_DESIGN_SETTINGS m_BrdSettings;
public:
DIALOG_PADS_MASK_CLEARANCE( PCB_EDIT_FRAME* parent );
......
......@@ -249,8 +249,8 @@ DIMENSION* PCB_EDIT_FRAME::EditDimension( DIMENSION* aDimension, wxDC* aDC )
aDimension->m_arrowD2Ox = aDimension->m_arrowD2Fx = pos.x;
aDimension->m_arrowD2Oy = aDimension->m_arrowD2Fy = pos.y;
aDimension->m_Text->m_Size = GetBoard()->GetBoardDesignSettings()->m_PcbTextSize;
int width = GetBoard()->GetBoardDesignSettings()->m_PcbTextWidth;
aDimension->m_Text->m_Size = GetBoard()->GetDesignSettings().m_PcbTextSize;
int width = GetBoard()->GetDesignSettings().m_PcbTextWidth;
int maxthickness = Clamp_Text_PenSize(width, aDimension->m_Text->m_Size );
if( width > maxthickness )
......
......@@ -55,13 +55,13 @@ void DRC::ShowDialog()
// copy data retained in this DRC object into the m_ui DrcPanel:
PutValueInLocalUnits( *m_ui->m_SetTrackMinWidthCtrl,
m_pcb->GetBoardDesignSettings()->m_TrackMinWidth,
m_pcb->GetDesignSettings().m_TrackMinWidth,
m_mainWindow->m_InternalUnits );
PutValueInLocalUnits( *m_ui->m_SetViaMinSizeCtrl,
m_pcb->GetBoardDesignSettings()->m_ViasMinSize,
m_pcb->GetDesignSettings().m_ViasMinSize,
m_mainWindow->m_InternalUnits );
PutValueInLocalUnits( *m_ui->m_SetMicroViakMinSizeCtrl,
m_pcb->GetBoardDesignSettings()->m_MicroViasMinSize,
m_pcb->GetDesignSettings().m_MicroViasMinSize,
m_mainWindow->m_InternalUnits );
m_ui->m_CreateRptCtrl->SetValue( m_doCreateRptFile );
......@@ -292,7 +292,7 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
{
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 ) )
......
......@@ -221,7 +221,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
if( layer1 == LAYER_N_BACK && layer2 == LAYER_N_2 )
err = false;
if( layer1 == (m_pcb->GetBoardDesignSettings()->GetCopperLayerCount() - 2 )
if( layer1 == (m_pcb->GetDesignSettings().GetCopperLayerCount() - 2 )
&& layer2 == LAYER_N_FRONT )
err = false;
......
......@@ -352,14 +352,14 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
}
else
{
int v_type = GetBoard()->GetBoardDesignSettings()->m_CurrentViaType;
int v_type = GetBoard()->GetDesignSettings().m_CurrentViaType;
// place micro via and switch layer.
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 );
GetBoard()->GetBoardDesignSettings()->m_CurrentViaType = v_type;
GetBoard()->GetDesignSettings().m_CurrentViaType = v_type;
if( DisplayOpt.ContrastModeDisplay )
DrawPanel->Refresh();
......
......@@ -166,9 +166,9 @@ TEXTE_PCB* PCB_EDIT_FRAME::Create_Texte_Pcb( wxDC* DC )
if( TextePcb->GetLayer() == LAYER_N_BACK )
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_Thickness = GetBoard()->GetBoardDesignSettings()->m_PcbTextWidth;
TextePcb->m_Thickness = GetBoard()->GetDesignSettings().m_PcbTextWidth;
InstallTextPCBOptionsFrame( TextePcb, DC );
......
......@@ -209,11 +209,11 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape,
int s_large;
DRAWSEGMENT* DrawItem;
s_large = GetBoard()->GetBoardDesignSettings()->m_DrawSegmentWidth;
s_large = GetBoard()->GetDesignSettings().m_DrawSegmentWidth;
if( getActiveLayer() == EDGE_N )
{
s_large = GetBoard()->GetBoardDesignSettings()->m_EdgeSegmentWidth;
s_large = GetBoard()->GetDesignSettings().m_EdgeSegmentWidth;
}
if( Segment == NULL ) /* Create new trace. */
......
......@@ -97,7 +97,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
/* create the via */
SEGVIA* via = new SEGVIA( GetBoard() );
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->SetNet( GetBoard()->GetHighLightNetCode() );
via->m_Start = via->m_End = g_CurrentTrackSegment->m_End;
......
......@@ -166,7 +166,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer );
g_CurrentTrackSegment->m_Width = GetBoard()->GetCurrentTrackWidth();
if( GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth )
if( GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth )
{
if( TrackOnStartPoint && TrackOnStartPoint->Type() == PCB_TRACE_T )
g_CurrentTrackSegment->m_Width = TrackOnStartPoint->m_Width;
......@@ -271,7 +271,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
newTrack->SetLayer( ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer );
if( !GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth )
if( !GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth )
newTrack->m_Width = GetBoard()->GetCurrentTrackWidth();
D( g_CurrentTrackList.VerifyListIntegrity(); );
......@@ -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
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();
if( g_TwoSegmentTrackBuild )
......@@ -706,7 +706,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
{
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();
}
}
......
......@@ -285,8 +285,8 @@ void PCB_BASE_FRAME::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC )
switch( aItem->Type() )
{
case PCB_TEXT_T:
newSize = GetBoard()->GetBoardDesignSettings()->m_PcbTextSize;
newThickness = GetBoard()->GetBoardDesignSettings()->m_PcbTextWidth;
newSize = GetBoard()->GetDesignSettings().m_PcbTextSize;
newThickness = GetBoard()->GetDesignSettings().m_PcbTextWidth;
pcbText = (TEXTE_PCB*) aItem;
text = (EDA_TEXT*) pcbText;
break;
......
......@@ -35,19 +35,19 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
switch( id )
{
case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth =
not GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth;
GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth =
not GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth;
break;
case ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES:
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = false;
GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth = false;
GetBoard()->m_TrackWidthSelector = 0;
GetBoard()->m_ViaSizeSelector = 0;
break;
case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
DrawPanel->MoveCursorToCrossHair();
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = true;
GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth = true;
break;
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 )
case ID_POPUP_PCB_SELECT_WIDTH7:
case ID_POPUP_PCB_SELECT_WIDTH8:
DrawPanel->MoveCursorToCrossHair();
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = false;
GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth = false;
ii = id - ID_POPUP_PCB_SELECT_WIDTH1;
GetBoard()->m_TrackWidthSelector = ii;
break;
......
This diff is collapsed.
......@@ -369,7 +369,7 @@ static void compute_layer_Zs( BOARD* pcb ) /*{{{*/
int copper_layers = pcb->GetCopperLayerCount( );
// 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;
/* 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,
/* Define the translation to have the board centre to the 2D axis origin
* more easy for rotations...
*/
pcb->ComputeBoundingBox();
double dx = board_scaling_factor * pcb->m_BoundaryBox.Centre().x * aScale;
double dy = board_scaling_factor * pcb->m_BoundaryBox.Centre().y * aScale;
EDA_RECT bbbox = pcb->ComputeBoundingBox();
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, " children [\n" );
......
......@@ -47,7 +47,7 @@
#include "io_mgr.h"
#include "class_board.h"
#include "build_version.h" // BOARD_FILE_VERSION
static const wxString pcbBackupFileExtension( wxT( "000" ) );
......@@ -226,12 +226,12 @@ the changes?" ) ) )
int 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 \
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 \
version of Pcbnew. It will be stored in the new file format when you save \
......@@ -278,7 +278,16 @@ this file again." ) );
NULL );
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 );
}
}
catch( IO_ERROR ioe )
{
......
......@@ -41,11 +41,11 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
SetLocaleTo_C_standard(); // Use the standard notation for float numbers
// Calculate dimensions and center of PCB
aPcb->ComputeBoundingBox();
EDA_RECT bbbox = aPcb->ComputeBoundingBox();
dX = aPcb->m_BoundaryBox.GetWidth();
dY = aPcb->m_BoundaryBox.GetHeight();
BoardCentre = aPcb->m_BoundaryBox.Centre();
dX = bbbox.GetWidth();
dY = bbbox.GetHeight();
BoardCentre = bbbox.Centre();
// Calculate the scale for the format type, scale 1 in HPGL, drawing on
// an A4 sheet in PS, + text description of symbols
......@@ -163,8 +163,8 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
intervalle = (int) ( CharSize * CharScale ) + TextWidth;
/* Trace information. */
plotX = (int) ( (double) aPcb->m_BoundaryBox.GetX() + 200.0 * CharScale );
plotY = aPcb->m_BoundaryBox.GetBottom() + intervalle;
plotX = (int) ( (double) bbbox.GetX() + 200.0 * CharScale );
plotY = bbbox.GetBottom() + intervalle;
/* Plot title "Info" */
wxString Text = wxT( "Drill Map:" );
......
......@@ -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 void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile );
......@@ -87,11 +93,6 @@ void PCB_EDIT_FRAME::GenModulesPosition( wxCommandEvent& event )
FILE* fpBack = 0;
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;
/* 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.
*/
void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event )
{
double conv_unit;
MODULE* Module;
D_PAD* pad;
char line[1024];
......@@ -328,10 +328,6 @@ void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event )
FILE* rptfile;
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 );
wxString boardFilePath = ( (wxFileName) GetScreen()->GetFileName()).GetPath();
......@@ -369,17 +365,20 @@ void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event )
fputs( "##\n", rptfile );
fputs( "\n$BeginDESCRIPTION\n", rptfile );
GetBoard()->ComputeBoundingBox();
EDA_RECT bbbox = GetBoard()->ComputeBoundingBox();
fputs( "\n$BOARD\n", rptfile );
fputs( "unit INCH\n", rptfile );
sprintf( line, "upper_left_corner %9.6f %9.6f\n",
GetBoard()->m_BoundaryBox.GetX() * conv_unit,
GetBoard()->m_BoundaryBox.GetY() * conv_unit );
bbbox.GetX() * conv_unit,
bbbox.GetY() * conv_unit );
fputs( line, rptfile );
sprintf( line, "lower_right_corner %9.6f %9.6f\n",
GetBoard()->m_BoundaryBox.GetRight() * conv_unit,
GetBoard()->m_BoundaryBox.GetBottom() * conv_unit );
bbbox.GetRight() * conv_unit,
bbbox.GetBottom() * conv_unit );
fputs( line, rptfile );
fputs( "$EndBOARD\n\n", rptfile );
......@@ -512,12 +511,10 @@ void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event )
*/
void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile )
{
double conv_unit, ux0, uy0, dx, dy;
double ux0, uy0, dx, dy;
double radius, width;
char line[1024];
conv_unit = 0.0001; /* units = INCHES */
ux0 = PtDrawSegment->m_Start.x * conv_unit;
uy0 = PtDrawSegment->m_Start.y * conv_unit;
......
......@@ -197,8 +197,8 @@ void TraceFilledCircle( BOARD* Pcb,
break;
}
cx -= Pcb->m_BoundaryBox.m_Pos.x;
cy -= Pcb->m_BoundaryBox.m_Pos.y;
cx -= Pcb->GetBoundingBox().m_Pos.x;
cy -= Pcb->GetBoundingBox().m_Pos.y;
distmin = radius;
......@@ -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;
/* Calculate the bounding rectangle of the segment (if H, V or Via) */
ux0 = pt_segm->m_Start.x - Pcb->m_BoundaryBox.m_Pos.x;
uy0 = pt_segm->m_Start.y - Pcb->m_BoundaryBox.m_Pos.y;
ux1 = pt_segm->m_End.x - Pcb->m_BoundaryBox.m_Pos.x;
uy1 = pt_segm->m_End.y - Pcb->m_BoundaryBox.m_Pos.y;
ux0 = pt_segm->m_Start.x - Pcb->GetBoundingBox().m_Pos.x;
uy0 = pt_segm->m_Start.y - Pcb->GetBoundingBox().m_Pos.y;
ux1 = pt_segm->m_End.x - Pcb->GetBoundingBox().m_Pos.x;
uy1 = pt_segm->m_End.y - Pcb->GetBoundingBox().m_Pos.y;
/* Test if VIA (filled circle was drawn) */
if( pt_segm->Type() == PCB_VIA_T )
......@@ -558,10 +558,10 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
break;
}
ux0 -= Pcb->m_BoundaryBox.m_Pos.x;
uy0 -= Pcb->m_BoundaryBox.m_Pos.y;
ux1 -= Pcb->m_BoundaryBox.m_Pos.x;
uy1 -= Pcb->m_BoundaryBox.m_Pos.y;
ux0 -= Pcb->GetBoundingBox().m_Pos.x;
uy0 -= Pcb->GetBoundingBox().m_Pos.y;
ux1 -= Pcb->GetBoundingBox().m_Pos.x;
uy1 -= Pcb->GetBoundingBox().m_Pos.y;
/* Calculating limits coord cells belonging to the rectangle. */
row_max = uy1 / Board.m_GridRouting;
......@@ -650,10 +650,10 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
break;
}
ux0 -= Pcb->m_BoundaryBox.m_Pos.x;
uy0 -= Pcb->m_BoundaryBox.m_Pos.y;
ux1 -= Pcb->m_BoundaryBox.m_Pos.x;
uy1 -= Pcb->m_BoundaryBox.m_Pos.y;
ux0 -= Pcb->GetBoundingBox().m_Pos.x;
uy0 -= Pcb->GetBoundingBox().m_Pos.y;
ux1 -= Pcb->GetBoundingBox().m_Pos.x;
uy1 -= Pcb->GetBoundingBox().m_Pos.y;
cx = (ux0 + ux1) / 2;
cy = (uy0 + uy1) / 2;
......
......@@ -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
// layer names are put into the BOARD.
SetBoard( new BOARD( this ) );
SetBoard( new BOARD() );
SetCurItem( NULL );
/* clear filename, to avoid overwriting an old file */
......
......@@ -163,41 +163,6 @@ class PLUGIN
{
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>-------------------------------------------------
/**
......@@ -259,6 +224,40 @@ public:
PROPERTIES* aProperties = NULL );
//-----</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:
//-----<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()
{
static const wxString name = wxT( "KiCad" );
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>------------------------------------------------------------
protected:
......@@ -71,7 +71,9 @@ protected:
wxString m_error; ///< for throwing exceptions
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.
void init( PROPERTIES* aProperties );
......@@ -117,7 +119,9 @@ protected:
*/
double degParse( const char* aValue, const char** nptrptr = NULL );
// load / parse functions
//-----<load/parse functions>-----------------------------------------------
void checkVersion();
void loadAllSections( bool doAppend );
......@@ -152,13 +156,7 @@ protected:
void loadDIMENSION(); // "$COTATION"
void loadPCB_TARGET(); // "$PCB_TARGET"
/* @todo
void load( NETINFO* me );
void load( TRACK* me );
*/
// void load( SEGZONE* me );
//-----</ load/parse functions>---------------------------------------------
};
#endif // KICAD_PLUGIN_H_
......@@ -214,7 +214,7 @@ PCB_TARGET* PCB_EDIT_FRAME::CreateTarget( wxDC* DC )
GetBoard()->Add( target );
target->SetLayer( EDGE_N );
target->m_Width = GetBoard()->GetBoardDesignSettings()->m_EdgeSegmentWidth;
target->m_Width = GetBoard()->GetDesignSettings().m_EdgeSegmentWidth;
target->m_Size = MireDefaultSize;
target->m_Pos = DrawPanel->GetScreen()->GetCrossHairPosition();
......
......@@ -155,16 +155,15 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( wxWindow* father,
UpdateTitle();
if( g_ModuleEditor_Pcb == NULL )
g_ModuleEditor_Pcb = new BOARD( this );
g_ModuleEditor_Pcb = new BOARD();
SetBoard( g_ModuleEditor_Pcb );
GetBoard()->m_PcbFrame = this;
if( s_screenModule == NULL )
s_screenModule = new PCB_SCREEN();
SetScreen( s_screenModule );
GetBoard()->SetBoardDesignSettings( &s_ModuleEditorDesignSetting );
GetBoard()->SetDesignSettings( s_ModuleEditorDesignSetting );
GetScreen()->SetCurItem( NULL );
LoadSettings();
......
......@@ -1114,9 +1114,11 @@ bool NETLIST_READER::loadNewModules()
sort( m_newModulesList.begin(), m_newModulesList.end(), SortByLibName );
// 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;
}
......
......@@ -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" ),
true );
if( aBoard->GetBoardDesignSettings()->m_UseConnectedTrackWidth )
if( aBoard->GetDesignSettings().m_UseConnectedTrackWidth )
trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, true );
if( aBoard->m_ViaSizeSelector != 0
|| aBoard->m_TrackWidthSelector != 0
|| aBoard->GetBoardDesignSettings()->m_UseConnectedTrackWidth )
|| aBoard->GetDesignSettings().m_UseConnectedTrackWidth )
trackwidth_menu->Append( ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES,
_( "Use 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,
for ( int i = 0; i < 10; i++ )
m_Macros[i].m_Record.clear();
SetBoard( new BOARD( this ) );
SetBoard( new BOARD() );
// Create the PCB_LAYER_WIDGET *after* SetBoard():
......@@ -617,7 +617,7 @@ bool PCB_EDIT_FRAME::IsMicroViaAcceptable( void )
int copperlayercnt = GetBoard()->GetCopperLayerCount( );
int currLayer = getActiveLayer();
if( !GetBoard()->GetBoardDesignSettings()->m_MicroViasAllowed )
if( !GetBoard()->GetDesignSettings().m_MicroViasAllowed )
return false; // Obvious..
if( copperlayercnt < 4 )
......
......@@ -169,12 +169,12 @@ bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName )
wxGetApp().RemoveLibraryPath( g_UserLibDirBuffer );
/* Initialize default values. */
// Initialize default values.
g_LibraryNames.Clear();
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 );
/* Reset the items visibility flag when loading a new configuration because it could
......@@ -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() )
return m_projectFileParams;
PARAM_CFG_ARRAY pca;
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 ) );
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ),
pca.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ),
&g_LibraryNames,
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 ) );
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 ) );
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 ) );
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 ) );
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 ) );
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 ) );
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 ) );
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 ) );
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 ) );
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 ) );
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 ) );
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 ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "TxtLar" ),
&boardDesignSettings.m_PcbTextWidth,
pca.push_back( new PARAM_CFG_INT( wxT( "TxtLar" ),
&bds.m_PcbTextWidth,
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 ) );
m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "LastNetListRead" ),
pca.push_back( new PARAM_CFG_FILENAME( wxT( "LastNetListRead" ),
&m_lastNetListRead ) );
return m_projectFileParams;
return pca;
}
PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings()
{
if( !m_configSettings.empty() )
......
......@@ -9,20 +9,13 @@
#include "param_config.h"
#include "colors_selection.h"
class BOARD_DESIGN_SETTINGS;
#define GROUP wxT( "/pcbnew" )
#define GROUPLIB wxT( "/pcbnew/libraries" )
#define GROUPCOMMON wxT( "/common" )
/* Useful macro : */
#define LOC_COLOR(layer) &g_ColorsSettings.m_LayersColors[layer]
#define ITEM_COLOR(item_visible) &g_ColorsSettings.m_ItemsColors[item_visible]
/* Configuration parameters. */
extern BOARD_DESIGN_SETTINGS boardDesignSettings;
#define LOC_COLOR(layer) &g_ColorsSettings.m_LayersColors[layer]
#define ITEM_COLOR(item_visible) &g_ColorsSettings.m_ItemsColors[item_visible]
#endif // _PCBNEW_CONFIG_H_
......@@ -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
// clearance for vias
if( ( aLayerMask & ( SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT ) ) )
via_margin = GetBoard()->GetBoardDesignSettings()->m_SolderMaskMargin;
via_margin = GetBoard()->GetDesignSettings().m_SolderMaskMargin;
pos = Via->m_Start;
size.x = size.y = Via->m_Width + 2 * via_margin;
......
......@@ -62,10 +62,11 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
SheetSize.x = currentsheet->m_Size.x * U_PCB;
SheetSize.y = currentsheet->m_Size.y * U_PCB;
/* Calculate the center of the PCB. */
m_Pcb->ComputeBoundingBox();
BoardSize = m_Pcb->m_BoundaryBox.GetSize();
BoardCenter = m_Pcb->m_BoundaryBox.Centre();
// Calculate the center of the PCB
EDA_RECT bbbox = GetBoardBoundingBox();
BoardSize = bbbox.GetSize();
BoardCenter = bbbox.Centre();
if( g_PcbPlotOptions.m_AutoScale ) // Optimum scale
{
......
......@@ -68,9 +68,10 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
paperscale = 1;
}
m_Pcb->ComputeBoundingBox();
BoardSize = m_Pcb->m_BoundaryBox.GetSize();
BoardCenter = m_Pcb->m_BoundaryBox.Centre();
EDA_RECT bbbox = GetBoardBoundingBox();
BoardSize = bbbox.GetSize();
BoardCenter = bbbox.Centre();
if( g_PcbPlotOptions.m_AutoScale ) // Optimum scale
{
......@@ -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
plotter->set_negative( true );
plotter->set_color( WHITE ); // Which will be plotted as black
plotter->rect( wxPoint( m_Pcb->m_BoundaryBox.GetX() - margin,
m_Pcb->m_BoundaryBox.GetY() - margin ),
wxPoint( m_Pcb->m_BoundaryBox.GetRight() + margin,
m_Pcb->m_BoundaryBox.GetBottom() + margin ),
plotter->rect( wxPoint( bbbox.GetX() - margin,
bbbox.GetY() - margin ),
wxPoint( bbbox.GetRight() + margin,
bbbox.GetBottom() + margin ),
FILLED_SHAPE );
plotter->set_color( BLACK );
}
......
......@@ -167,8 +167,8 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
SheetSize.y *= m_Parent->m_InternalUnits / 1000; // size in internal units
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
// it is moved to SheetSize.x/2, SheetSize.y/2.
......
......@@ -312,10 +312,10 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides )
}
pt_cur_ch = pt_cur_ch;
segm_oX = GetBoard()->m_BoundaryBox.m_Pos.x + (Board.m_GridRouting * col_source);
segm_oY = GetBoard()->m_BoundaryBox.m_Pos.y + (Board.m_GridRouting * row_source);
segm_fX = GetBoard()->m_BoundaryBox.m_Pos.x + (Board.m_GridRouting * col_target);
segm_fY = GetBoard()->m_BoundaryBox.m_Pos.y + (Board.m_GridRouting * row_target);
segm_oX = GetBoard()->GetBoundingBox().m_Pos.x + (Board.m_GridRouting * col_source);
segm_oY = GetBoard()->GetBoundingBox().m_Pos.y + (Board.m_GridRouting * row_source);
segm_fX = GetBoard()->GetBoundingBox().m_Pos.x + (Board.m_GridRouting * col_target);
segm_fY = GetBoard()->GetBoundingBox().m_Pos.y + (Board.m_GridRouting * row_target);
/* Draw segment. */
GRLine( &DrawPanel->m_ClipBox,
......@@ -461,9 +461,9 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
*/
{
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 )
+ 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 dy = pt_cur_ch->m_PadStart->m_Size.y / 2;
int px = pt_cur_ch->m_PadStart->GetPosition().x;
......@@ -476,9 +476,9 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
goto end_of_route;
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 )
+ pcbframe->GetBoard()->m_BoundaryBox.m_Pos.y;
+ pcbframe->GetBoard()->GetBoundingBox().m_Pos.y;
dx = pt_cur_ch->m_PadEnd->m_Size.x / 2;
dy = pt_cur_ch->m_PadEnd->m_Size.y / 2;
px = pt_cur_ch->m_PadEnd->GetPosition().x;
......@@ -1163,15 +1163,15 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
g_CurrentTrackSegment->SetLayer( 0x0F );
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 );
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 );
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 );
}
......@@ -1187,9 +1187,9 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
g_CurrentTrackSegment->SetLayer( Route_Layer_TOP );
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 );
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 );
g_CurrentTrackSegment->SetNet( current_net_code );
......
......@@ -890,7 +890,7 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER
}
else
{
aBoard->ComputeBoundingBox();
EDA_RECT bbbox = aBoard->ComputeBoundingBox();
RECTANGLE* rect = new RECTANGLE( boundary );
boundary->rectangle = rect;
......@@ -898,11 +898,9 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER
rect->layer_id = "pcb";
// opposite corners
wxPoint bottomRight;
bottomRight.x = aBoard->m_BoundaryBox.GetRight();
bottomRight.y = aBoard->m_BoundaryBox.GetBottom();
wxPoint bottomRight( bbbox.GetRight(), bbbox.GetBottom() );
rect->SetCorners( mapPt( aBoard->m_BoundaryBox.GetOrigin() ),
rect->SetCorners( mapPt( bbbox.GetOrigin() ),
mapPt( bottomRight ) );
}
}
......
......@@ -102,7 +102,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator()
change = true;
}
int via_type = GetBoard()->GetBoardDesignSettings()->m_CurrentViaType;
int via_type = GetBoard()->GetDesignSettings().m_CurrentViaType;
via_color = GetBoard()->GetVisibleElementColor(VIAS_VISIBLE+via_type);
if( previous_via_color != via_color )
......
......@@ -35,7 +35,7 @@ void PCB_EDIT_FRAME::OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent )
{
bool check = ( ( ( ID_POPUP_PCB_SELECT_WIDTH1 +
(int) GetBoard()->m_TrackWidthSelector ) == aEvent.GetId() ) &&
!GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth );
!GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth );
aEvent.Check( check );
}
}
......@@ -43,7 +43,7 @@ void PCB_EDIT_FRAME::OnUpdateSelectTrackWidth( 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 )
{
bool check = ( ( ( ID_POPUP_PCB_SELECT_VIASIZE1 +
(int) GetBoard()->m_ViaSizeSelector ) == aEvent.GetId() ) &&
!GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth );
!GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth );
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