Commit a46cd46d authored by charras's avatar charras

pcbnew: More about work on color selection and items visibility:

removed global variables and a lot of redundancies
parent f8215b34
...@@ -114,11 +114,11 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List() ...@@ -114,11 +114,11 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
m_gllist = glGenLists( 1 ); m_gllist = glGenLists( 1 );
pcb->ComputeBoundaryBox(); pcb->ComputeBoundaryBox();
g_Parm_3D_Visu.m_BoardSettings = pcb->m_BoardSettings; g_Parm_3D_Visu.m_BoardSettings = pcb->GetBoardDesignSettings();
g_Parm_3D_Visu.m_BoardSize = pcb->m_BoundaryBox.GetSize(); 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 = pcb->m_BoundaryBox.Centre();
g_Parm_3D_Visu.m_BoardPos.y = -g_Parm_3D_Visu.m_BoardPos.y; g_Parm_3D_Visu.m_BoardPos.y = -g_Parm_3D_Visu.m_BoardPos.y;
g_Parm_3D_Visu.m_Layers = pcb->m_BoardSettings->GetCopperLayerCount(); g_Parm_3D_Visu.m_Layers = pcb->GetCopperLayerCount();
// Ensure the board has 2 sides for 3D views, because it is hard to find // Ensure the board has 2 sides for 3D views, because it is hard to find
// a *really* single side board in the true life... // a *really* single side board in the true life...
...@@ -132,7 +132,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List() ...@@ -132,7 +132,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
// because all boards thickness no not match with this setup: // because all boards thickness no not match with this setup:
// double epoxy_width = 1.6; // epoxy width in mm // double epoxy_width = 1.6; // epoxy width in mm
g_Parm_3D_Visu.m_Epoxy_Width = pcb->m_BoardSettings->m_LayerThickness g_Parm_3D_Visu.m_Epoxy_Width = pcb->GetBoardDesignSettings()->m_BoardThickness
* g_Parm_3D_Visu.m_BoardScale; * g_Parm_3D_Visu.m_BoardScale;
/* calculate z position for each layer */ /* calculate z position for each layer */
......
...@@ -115,7 +115,7 @@ public: ...@@ -115,7 +115,7 @@ public:
wxPoint m_BoardPos; wxPoint m_BoardPos;
wxSize m_BoardSize; wxSize m_BoardSize;
int m_Layers; int m_Layers;
EDA_BoardDesignSettings* m_BoardSettings; // Link to current board design BOARD_DESIGN_SETTINGS* m_BoardSettings; // Link to current board design
// settings // settings
double m_Epoxy_Width; /* Epoxy thickness (normalized) double m_Epoxy_Width; /* Epoxy thickness (normalized)
**/ **/
......
...@@ -4,6 +4,16 @@ KiCad ChangeLog 2010 ...@@ -4,6 +4,16 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2010-Jan-31 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++ pcbnew:
More about work on color selection and items visibility:
removed global variables and a lot of redundancies
Now Modedit does not uses the visiblity options of the board editor
(That can create a problem id hide modules is activated)
work in progress but almost finished
2010-Jan-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> 2010-Jan-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================ ================================================================================
++ pcbnew: ++ pcbnew:
......
...@@ -93,7 +93,7 @@ int COLORS_DESIGN_SETTINGS::GetLayerColor( int aLayer ) ...@@ -93,7 +93,7 @@ int COLORS_DESIGN_SETTINGS::GetLayerColor( int aLayer )
* sets the color for aLayer which is one of the layer indices given * sets the color for aLayer which is one of the layer indices given
* in pcbstruct.h or in schematic * in pcbstruct.h or in schematic
*/ */
void COLORS_DESIGN_SETTINGS:: SetLayerColor( int aLayer, int aColor ) void COLORS_DESIGN_SETTINGS::SetLayerColor( int aLayer, int aColor )
{ {
if( (unsigned) aLayer < DIM(m_LayersColors) ) if( (unsigned) aLayer < DIM(m_LayersColors) )
{ {
...@@ -107,7 +107,7 @@ void COLORS_DESIGN_SETTINGS:: SetLayerColor( int aLayer, int aColor ) ...@@ -107,7 +107,7 @@ void COLORS_DESIGN_SETTINGS:: SetLayerColor( int aLayer, int aColor )
* @return the color for an item which is one of the item indices given * @return the color for an item which is one of the item indices given
* in pcbstruct.h, enum PCB_VISIBLE or in schematic * in pcbstruct.h, enum PCB_VISIBLE or in schematic
*/ */
int COLORS_DESIGN_SETTINGS:: GetItemColor( int aItemIdx ) int COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx )
{ {
if( (unsigned) aItemIdx < DIM(m_ItemsColors) ) if( (unsigned) aItemIdx < DIM(m_ItemsColors) )
{ {
...@@ -122,10 +122,25 @@ int COLORS_DESIGN_SETTINGS:: GetItemColor( int aItemIdx ) ...@@ -122,10 +122,25 @@ int COLORS_DESIGN_SETTINGS:: GetItemColor( int aItemIdx )
* sets the color for an item which is one of the item indices given * sets the color for an item which is one of the item indices given
* in pcbstruct.h, enum PCB_VISIBLE or in schematic * in pcbstruct.h, enum PCB_VISIBLE or in schematic
*/ */
void COLORS_DESIGN_SETTINGS:: SetItemColor( int aItemIdx, int aColor ) void COLORS_DESIGN_SETTINGS::SetItemColor( int aItemIdx, int aColor )
{ {
if( (unsigned) aItemIdx < DIM(m_ItemsColors) ) if( (unsigned) aItemIdx < DIM(m_ItemsColors) )
{ {
m_ItemsColors[aItemIdx] = aColor; m_ItemsColors[aItemIdx] = aColor;
} }
} }
/**
* Function SetAllColorsAs
* sets alls colors to aColor
* Usefull to create a monochrome color selection for printing purpose
*/
void COLORS_DESIGN_SETTINGS::SetAllColorsAs( int aColor)
{
for( unsigned ii = 0; ii < DIM(m_LayersColors); ii++ )
m_LayersColors[ii] = aColor;
for( unsigned ii = 0; ii < DIM(m_ItemsColors); ii++ )
m_ItemsColors[ii] = aColor;
}
...@@ -100,7 +100,7 @@ int g_PadCMPColor = RED; ...@@ -100,7 +100,7 @@ int g_PadCMPColor = RED;
// Current design settings: // Current design settings:
class EDA_BoardDesignSettings g_DesignSettings; class BOARD_DESIGN_SETTINGS g_DesignSettings;
/** /**
* Used in track creation, a list of track segments currently being created, * Used in track creation, a list of track segments currently being created,
......
...@@ -79,7 +79,7 @@ TRACK* WinEDA_GerberFrame::Delete_Segment( wxDC* DC, TRACK* Track ) ...@@ -79,7 +79,7 @@ TRACK* WinEDA_GerberFrame::Delete_Segment( wxDC* DC, TRACK* Track )
return NULL; return NULL;
} }
Trace_Segment( DrawPanel, DC, Track, GR_XOR ); Trace_Segment( GetBoard(), DrawPanel, DC, Track, GR_XOR );
DLIST<TRACK>* container = (DLIST<TRACK>*)Track->GetList(); DLIST<TRACK>* container = (DLIST<TRACK>*)Track->GetList();
wxASSERT( container ); wxASSERT( container );
......
...@@ -191,7 +191,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) ...@@ -191,7 +191,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
BOARD* board = ((WinEDA_BasePcbFrame*)m_Parent)->GetBoard(); BOARD* board = ((WinEDA_BasePcbFrame*)m_Parent)->GetBoard();
for( int layer = 0; layer<NB_LAYERS; layer++, mask <<= 1 ) for( int layer = 0; layer<NB_LAYERS; layer++, mask <<= 1 )
{ {
if( ! board->m_BoardSettings->IsLayerEnabled( layer ) ) if( ! board->IsLayerEnabled( layer ) )
{ {
m_BoxSelectLayer[layer]->Enable( false ); m_BoxSelectLayer[layer]->Enable( false );
m_BoxSelectLayer[layer]->SetValue( false ); m_BoxSelectLayer[layer]->SetValue( false );
......
...@@ -90,9 +90,7 @@ static int WriteSetup( FILE* File, BOARD* Pcb ) ...@@ -90,9 +90,7 @@ static int WriteSetup( FILE* File, BOARD* Pcb )
sprintf( text, "InternalUnit %f INCH\n", 1.0 / PCB_INTERNAL_UNIT ); sprintf( text, "InternalUnit %f INCH\n", 1.0 / PCB_INTERNAL_UNIT );
fprintf( File, "%s", text ); fprintf( File, "%s", text );
Pcb->m_BoardSettings->SetCopperLayerCount( fprintf( File, "Layers %d\n", Pcb->GetCopperLayerCount() );
g_DesignSettings.GetCopperLayerCount() );
fprintf( File, "Layers %d\n", g_DesignSettings.GetCopperLayerCount() );
fprintf( File, "$EndSETUP\n\n" ); fprintf( File, "$EndSETUP\n\n" );
return 1; return 1;
...@@ -104,7 +102,7 @@ static bool WriteGeneralDescrPcb( BOARD* Pcb, FILE* File ) ...@@ -104,7 +102,7 @@ static bool WriteGeneralDescrPcb( BOARD* Pcb, FILE* File )
int NbLayers; int NbLayers;
/* Print the copper layer count */ /* Print the copper layer count */
NbLayers = Pcb->m_BoardSettings->GetCopperLayerCount(); NbLayers = Pcb->GetCopperLayerCount();
fprintf( File, "$GENERAL\n" ); fprintf( File, "$GENERAL\n" );
fprintf( File, "LayerCount %d\n", NbLayers ); fprintf( File, "LayerCount %d\n", NbLayers );
......
...@@ -76,8 +76,6 @@ bool WinEDA_App::OnInit() ...@@ -76,8 +76,6 @@ bool WinEDA_App::OnInit()
ScreenPcb = new PCB_SCREEN(); ScreenPcb = new PCB_SCREEN();
ScreenPcb->m_CurrentSheetDesc = &g_Sheet_GERBER; ScreenPcb->m_CurrentSheetDesc = &g_Sheet_GERBER;
g_DesignSettings.SetEnabledLayers( FULL_LAYERS ); // All 32 layers enabled at first.
ActiveScreen = ScreenPcb; ActiveScreen = ScreenPcb;
// read current setup and reopen last directory if no filename to open in // read current setup and reopen last directory if no filename to open in
...@@ -108,6 +106,8 @@ bool WinEDA_App::OnInit() ...@@ -108,6 +106,8 @@ bool WinEDA_App::OnInit()
/* Gerbview mainframe title */ /* Gerbview mainframe title */
frame->SetTitle( GetTitle() + wxT( " " ) + GetBuildVersion() ); frame->SetTitle( GetTitle() + wxT( " " ) + GetBuildVersion() );
frame->SetBoard( new BOARD( NULL, frame ) ); frame->SetBoard( new BOARD( NULL, frame ) );
frame->GetBoard()->SetEnabledLayers( FULL_LAYERS ); // All 32 layers enabled at first.
// Initialize some display options // Initialize some display options
DisplayOpt.DisplayPadIsol = false; // Pad clearance has no meaning DisplayOpt.DisplayPadIsol = false; // Pad clearance has no meaning
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
/* Useful macro : */ /* Useful macro : */
#define LOC_COLOR(numlayer) &g_ColorsSettings.m_LayersColors[numlayer] #define LOC_COLOR(numlayer) &g_ColorsSettings.m_LayersColors[numlayer]
/* Liste des parametres */ /* Config parameters list */
static PARAM_CFG_WXSTRING PhotoExtBufCfg static PARAM_CFG_WXSTRING PhotoExtBufCfg
( (
...@@ -342,8 +342,7 @@ static PARAM_CFG_SETCOLOR ColorpcbGrilleCfg ...@@ -342,8 +342,7 @@ static PARAM_CFG_SETCOLOR ColorpcbGrilleCfg
( (
INSETUP, INSETUP,
wxT("CoPcbGr"), wxT("CoPcbGr"),
//@@IMB: Wrong object &g_DesignSettings.m_PcbGridColor, /* Adresse du parametre */ &g_GridColor,
&g_GridColor, //@@IMB: This is the real variable.
DARKGRAY DARKGRAY
); );
...@@ -363,22 +362,6 @@ static PARAM_CFG_INT GERBERSpotMiniCfg ...@@ -363,22 +362,6 @@ static PARAM_CFG_INT GERBERSpotMiniCfg
2,0xFFFF 2,0xFFFF
); );
static PARAM_CFG_INT DrawSegmLargeurCfg
(
wxT("DrawLar"),
&g_DesignSettings.m_DrawSegmentWidth,
120,
0,10000
);
static PARAM_CFG_INT EdgeSegmLargeurCfg
(
wxT("EdgeLar"),
&g_DesignSettings.m_EdgeSegmentWidth,
120,
0,10000
);
static PARAM_CFG_INT TimeOutCfg static PARAM_CFG_INT TimeOutCfg
( (
wxT("TimeOut"), wxT("TimeOut"),
...@@ -441,8 +424,6 @@ PARAM_CFG_BASE * ParamCfgList[] = ...@@ -441,8 +424,6 @@ PARAM_CFG_BASE * ParamCfgList[] =
& ColorpcbGrilleCfg, & ColorpcbGrilleCfg,
& ColorDCodesCfg, & ColorDCodesCfg,
& GERBERSpotMiniCfg, & GERBERSpotMiniCfg,
& DrawSegmLargeurCfg,
& EdgeSegmLargeurCfg,
& TimeOutCfg, & TimeOutCfg,
& DisplPolairCfg, & DisplPolairCfg,
NULL NULL
......
...@@ -30,7 +30,7 @@ void Print_PcbItems(BOARD * Pcb, wxDC *DC, int drawmode, int printmasklayer) ...@@ -30,7 +30,7 @@ void Print_PcbItems(BOARD * Pcb, wxDC *DC, int drawmode, int printmasklayer)
for( ; pt_piste != NULL ; pt_piste = pt_piste->Next() ) for( ; pt_piste != NULL ; pt_piste = pt_piste->Next() )
{ {
// if( (printmasklayer & ReturnMaskLayer(pt_piste) ) == 0 ) continue; // if( (printmasklayer & ReturnMaskLayer(pt_piste) ) == 0 ) continue;
Trace_Segment(NULL, DC, pt_piste, drawmode); Trace_Segment(Pcb, NULL, DC, pt_piste, drawmode);
} }
DisplayOpt = save_opt; DisplayOpt = save_opt;
......
/* declarations prototype */ /* declarations prototype */
/***************************/
/* select_layers_to_pcb.cpp*/
/***************************/
int* InstallDialogLayerPairChoice( WinEDA_GerberFrame* parent ); int* InstallDialogLayerPairChoice( WinEDA_GerberFrame* parent );
/***********************/
/* gerbview_config.cpp */
/***********************/
bool Read_Config(); bool Read_Config();
bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose ); bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose );
/****************/
/* lay2plot.cpp */
void Print_PcbItems( BOARD* Pcb, wxDC* DC, int drawmode, int printmasklayer ); void Print_PcbItems( BOARD* Pcb, wxDC* DC, int drawmode, int printmasklayer );
/*****************/ void DisplayColorSetupFrame( WinEDA_GerberFrame* parent, const wxPoint& framepos );
/* set_color.cpp */ void Trace_Segment( BOARD* aBrd, WinEDA_DrawPanel* panel,
/*****************/
void DisplayColorSetupFrame( WinEDA_DrawFrame* parent, const wxPoint& framepos );
/***************/
/* trpiste.cpp */
/***************/
void Trace_Segment( WinEDA_DrawPanel* panel,
wxDC* DC, wxDC* DC,
TRACK* pt_piste, TRACK* pt_piste,
int draw_mode ); int draw_mode );
...@@ -129,7 +129,7 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( WinEDA_GerberFrame* parent ) : ...@@ -129,7 +129,7 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( WinEDA_GerberFrame* parent ) :
ButtonTable[ii] = -1; ButtonTable[ii] = -1;
LayerLookUpTable[ii] = LAYER_UNSELECTED; LayerLookUpTable[ii] = LAYER_UNSELECTED;
} }
g_DesignSettings.SetCopperLayerCount(pcb_layer_number); m_Parent->GetBoard()->SetCopperLayerCount(pcb_layer_number);
pcb_layer_number = 0; pcb_layer_number = 0;
for( nb_items = 0, ii = 0; ii < 32; ii++ ) for( nb_items = 0, ii = 0; ii < 32; ii++ )
...@@ -137,8 +137,8 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( WinEDA_GerberFrame* parent ) : ...@@ -137,8 +137,8 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( WinEDA_GerberFrame* parent ) :
if( g_GERBER_List[ii] == NULL ) if( g_GERBER_List[ii] == NULL )
continue; continue;
if( (pcb_layer_number == g_DesignSettings.GetCopperLayerCount() - 1) if( (pcb_layer_number == m_Parent->GetBoard()->GetCopperLayerCount() - 1)
&& (g_DesignSettings.GetCopperLayerCount() > 1) ) && (m_Parent->GetBoard()->GetCopperLayerCount() > 1) )
pcb_layer_number = LAYER_N_FRONT; pcb_layer_number = LAYER_N_FRONT;
ButtonTable[nb_items] = ii; ButtonTable[nb_items] = ii;
...@@ -399,7 +399,7 @@ void WinEDA_SwapLayerFrame::OnOkClick( wxCommandEvent& event ) ...@@ -399,7 +399,7 @@ void WinEDA_SwapLayerFrame::OnOkClick( wxCommandEvent& event )
if( layers_count > NB_COPPER_LAYERS ) // should not occur. if( layers_count > NB_COPPER_LAYERS ) // should not occur.
layers_count = NB_COPPER_LAYERS; layers_count = NB_COPPER_LAYERS;
g_DesignSettings.SetCopperLayerCount( layers_count ); m_Parent->GetBoard()->SetCopperLayerCount( layers_count );
EndModal( 1 ); EndModal( 1 );
} }
...@@ -41,7 +41,7 @@ END_EVENT_TABLE() ...@@ -41,7 +41,7 @@ END_EVENT_TABLE()
/*****************************************************/ /*****************************************************/
void DisplayColorSetupFrame( WinEDA_DrawFrame* parent, void DisplayColorSetupFrame( WinEDA_GerberFrame* parent,
const wxPoint& framepos ) const wxPoint& framepos )
/*****************************************************/ /*****************************************************/
{ {
...@@ -62,7 +62,7 @@ WinEDA_SetColorsFrame::WinEDA_SetColorsFrame() ...@@ -62,7 +62,7 @@ WinEDA_SetColorsFrame::WinEDA_SetColorsFrame()
// Standard Constructor // Standard Constructor
WinEDA_SetColorsFrame::WinEDA_SetColorsFrame( WinEDA_DrawFrame* parent, WinEDA_SetColorsFrame::WinEDA_SetColorsFrame( WinEDA_GerberFrame* parent,
const wxPoint& framepos ) const wxPoint& framepos )
{ {
m_Parent = parent; m_Parent = parent;
...@@ -210,7 +210,7 @@ void WinEDA_SetColorsFrame::CreateControls() ...@@ -210,7 +210,7 @@ void WinEDA_SetColorsFrame::CreateControls()
if( laytool_list[lyr]->m_NoDisplayIsColor ) if( laytool_list[lyr]->m_NoDisplayIsColor )
{ {
if( g_DesignSettings.IsLayerVisible( lyr )) if( m_Parent->GetBoard()->IsLayerVisible( lyr ))
CheckBox->SetValue( TRUE ); CheckBox->SetValue( TRUE );
else else
CheckBox->SetValue( FALSE ); CheckBox->SetValue( FALSE );
...@@ -426,7 +426,7 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings() ...@@ -426,7 +426,7 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings()
{ {
for( int lyr = 0; lyr < NB_BUTT - 2; lyr++ ) for( int lyr = 0; lyr < NB_BUTT - 2; lyr++ )
{ {
g_DesignSettings.SetLayerVisibility( lyr, laytool_list[lyr]->m_CheckBox->GetValue() ); m_Parent->GetBoard()->GetBoardDesignSettings()->SetLayerVisibility( lyr, laytool_list[lyr]->m_CheckBox->GetValue() );
*laytool_list[lyr]->m_Color = CurrentColor[lyr]; *laytool_list[lyr]->m_Color = CurrentColor[lyr];
} }
......
...@@ -390,7 +390,7 @@ private: ...@@ -390,7 +390,7 @@ private:
DECLARE_DYNAMIC_CLASS( WinEDA_SetColorsFrame ) DECLARE_DYNAMIC_CLASS( WinEDA_SetColorsFrame )
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
WinEDA_DrawFrame* m_Parent; WinEDA_GerberFrame* m_Parent;
wxBoxSizer* OuterBoxSizer; wxBoxSizer* OuterBoxSizer;
wxBoxSizer* MainBoxSizer; wxBoxSizer* MainBoxSizer;
wxFlexGridSizer* FlexColumnBoxSizer; wxFlexGridSizer* FlexColumnBoxSizer;
...@@ -430,7 +430,7 @@ private: ...@@ -430,7 +430,7 @@ private:
public: public:
// Constructors and destructor // Constructors and destructor
WinEDA_SetColorsFrame(); WinEDA_SetColorsFrame();
WinEDA_SetColorsFrame( WinEDA_DrawFrame* parent, const wxPoint& framepos ); WinEDA_SetColorsFrame( WinEDA_GerberFrame* parent, const wxPoint& framepos );
~WinEDA_SetColorsFrame(); ~WinEDA_SetColorsFrame();
}; };
......
...@@ -18,6 +18,10 @@ ...@@ -18,6 +18,10 @@
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "colors_selection.h" #include "colors_selection.h"
/***************/
/* tracepcb.cpp */
/***************/
static void Draw_Track_Buffer( WinEDA_DrawPanel* panel, static void Draw_Track_Buffer( WinEDA_DrawPanel* panel,
wxDC* DC, wxDC* DC,
BOARD* Pcb, BOARD* Pcb,
...@@ -127,7 +131,7 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay ...@@ -127,7 +131,7 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
{ {
if( !(track->ReturnMaskLayer() & printmasklayer) ) if( !(track->ReturnMaskLayer() & printmasklayer) )
continue; continue;
if( g_DesignSettings.IsLayerVisible( track->GetLayer() ) == false ) if( GetBoard()->IsLayerVisible( track->GetLayer() ) == false )
continue; continue;
// D(printf("D:%p\n", track );) // D(printf("D:%p\n", track );)
...@@ -219,9 +223,9 @@ void Draw_Track_Buffer( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int draw_ ...@@ -219,9 +223,9 @@ void Draw_Track_Buffer( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int draw_
// D(printf("D:%p\n", track );) // D(printf("D:%p\n", track );)
if( dcode_hightlight == track->GetNet() && track->GetLayer()==layer ) if( dcode_hightlight == track->GetNet() && track->GetLayer()==layer )
Trace_Segment( panel, DC, track, draw_mode | GR_SURBRILL ); Trace_Segment( Pcb, panel, DC, track, draw_mode | GR_SURBRILL );
else else
Trace_Segment( panel, DC, track, draw_mode ); Trace_Segment( Pcb, panel, DC, track, draw_mode );
} }
} }
...@@ -229,7 +233,7 @@ void Draw_Track_Buffer( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int draw_ ...@@ -229,7 +233,7 @@ void Draw_Track_Buffer( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int draw_
#if 1 #if 1
/***********************************************************************************/ /***********************************************************************************/
void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mode ) void Trace_Segment( BOARD* aBrd, WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mode )
/***********************************************************************************/ /***********************************************************************************/
/* Trace 1 segment of track (segment, spot...). /* Trace 1 segment of track (segment, spot...).
...@@ -251,10 +255,10 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo ...@@ -251,10 +255,10 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo
} }
else else
{ {
if( g_DesignSettings.IsLayerVisible( track->GetLayer() ) == false ) if( aBrd->IsLayerVisible( track->GetLayer() ) == false )
return; return;
color = g_ColorsSettings.GetLayerColor( track->GetLayer() ); color = aBrd->GetLayerColor( track->GetLayer() );
if( draw_mode & GR_SURBRILL ) if( draw_mode & GR_SURBRILL )
{ {
...@@ -420,7 +424,7 @@ void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int d ...@@ -420,7 +424,7 @@ void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int d
track = Pcb->m_Track; track = Pcb->m_Track;
for( ; track != NULL; track = track->Next() ) for( ; track != NULL; track = track->Next() )
{ {
if( g_DesignSettings.IsLayerVisible( track->GetLayer() ) == false ) if( Pcb->IsLayerVisible( track->GetLayer() ) == false )
continue; continue;
if( (track->m_Shape == S_ARC) if( (track->m_Shape == S_ARC)
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "pcbstruct.h" // NB_COLORS #include "pcbstruct.h" // NB_COLORS
// Class for handle current printed board design settings // Class for handle current printed board design settings
class EDA_BoardDesignSettings class BOARD_DESIGN_SETTINGS
{ {
protected: protected:
int m_CopperLayerCount; // Number of copper layers for this design int m_CopperLayerCount; // Number of copper layers for this design
...@@ -30,7 +30,7 @@ public: ...@@ -30,7 +30,7 @@ public:
int m_SolderPasteMargin; // Solder paste margin absolute value int m_SolderPasteMargin; // Solder paste margin absolute value
double m_SolderPasteMarginRatio; // Solder pask margin ratio value of pad size double m_SolderPasteMarginRatio; // Solder pask margin ratio value of pad size
// The final margin is the sum of these 2 values // The final margin is the sum of these 2 values
int m_LayerThickness; // Layer Thickness for 3D viewer int m_BoardThickness; // Board Thickness for 3D viewer
protected: protected:
int m_EnabledLayers; // Bit-mask for layer enabling int m_EnabledLayers; // Bit-mask for layer enabling
...@@ -38,7 +38,7 @@ protected: ...@@ -38,7 +38,7 @@ protected:
int m_VisibleElements; // Bit-mask for element category visibility int m_VisibleElements; // Bit-mask for element category visibility
public: public:
EDA_BoardDesignSettings(); BOARD_DESIGN_SETTINGS();
/** /**
* Function GetVisibleLayers * Function GetVisibleLayers
...@@ -150,7 +150,7 @@ public: ...@@ -150,7 +150,7 @@ public:
* @param aLayerIndex = The index of the layer to be tested * @param aLayerIndex = The index of the layer to be tested
* @return bool - true if the layer is enabled * @return bool - true if the layer is enabled
*/ */
bool IsLayerEnabled( int aLayerIndex ) bool IsLayerEnabled( int aLayerIndex ) const
{ {
return bool( m_EnabledLayers & (1 << aLayerIndex) ); return bool( m_EnabledLayers & (1 << aLayerIndex) );
} }
......
...@@ -53,6 +53,13 @@ public: ...@@ -53,6 +53,13 @@ public:
* in pcbstruct.h, enum PCB_VISIBLE or in schematic * in pcbstruct.h, enum PCB_VISIBLE or in schematic
*/ */
void SetItemColor( int aItemIdx, int aColor ); void SetItemColor( int aItemIdx, int aColor );
/**
* Function SetAllColorsAs
* sets alls colors to aColor
* Usefull to create a monochrome color selection for printing purpose
*/
void SetAllColorsAs( int aColor);
}; };
#endif // _COLORS_DESIGN_SETTING_H #endif // _COLORS_DESIGN_SETTING_H
...@@ -44,14 +44,6 @@ public: ...@@ -44,14 +44,6 @@ public:
void SetCurItem( BOARD_ITEM* aItem ) { BASE_SCREEN::SetCurItem( aItem ); } void SetCurItem( BOARD_ITEM* aItem ) { BASE_SCREEN::SetCurItem( aItem ); }
/* Return true if a microvia can be put on board
* A microvia is a small via restricted to 2 near neighbor layers
* because its is hole is made by laser which can penetrate only one layer
* It is mainly used to connect BGA to the first inner layer
* And it is allowed from an external layer to the first inner layer
*/
bool IsMicroViaAcceptable( void );
/* full undo redo management : */ /* full undo redo management : */
// use BASE_SCREEN::ClearUndoRedoList() // use BASE_SCREEN::ClearUndoRedoList()
......
...@@ -11,7 +11,6 @@ class DPAD; ...@@ -11,7 +11,6 @@ class DPAD;
class BOARD_ITEM; class BOARD_ITEM;
class PCB_SCREEN; class PCB_SCREEN;
class DISPLAY_OPTIONS; class DISPLAY_OPTIONS;
class EDA_BoardDesignSettings;
/* Look up Table for conversion one layer number -> one bit layer mask: */ /* Look up Table for conversion one layer number -> one bit layer mask: */
extern int g_TabOneLayerMask[LAYER_COUNT]; extern int g_TabOneLayerMask[LAYER_COUNT];
...@@ -41,9 +40,6 @@ extern int g_CurrentVersionPCB; ...@@ -41,9 +40,6 @@ extern int g_CurrentVersionPCB;
extern int g_TimeOut; // Timer for automatic saving extern int g_TimeOut; // Timer for automatic saving
extern int g_SaveTime; // Time for next saving extern int g_SaveTime; // Time for next saving
// Current design settings:
extern class EDA_BoardDesignSettings g_DesignSettings;
extern DLIST<TRACK> g_CurrentTrackList; extern DLIST<TRACK> g_CurrentTrackList;
#define g_CurrentTrackSegment \ #define g_CurrentTrackSegment \
......
...@@ -538,6 +538,14 @@ public: ...@@ -538,6 +538,14 @@ public:
// Track and via edition: // Track and via edition:
void Via_Edit_Control( wxCommandEvent& event ); void Via_Edit_Control( wxCommandEvent& event );
/* Return true if a microvia can be put on board
* A microvia is a small via restricted to 2 near neighbor layers
* because its is hole is made by laser which can penetrate only one layer
* It is mainly used to connect BGA to the first inner layer
* And it is allowed from an external layer to the first inner layer
*/
bool IsMicroViaAcceptable( void );
/** /**
* Function Other_Layer_Route * Function Other_Layer_Route
* operates in one of two ways. If argument track is NULL, then swap the * operates in one of two ways. If argument track is NULL, then swap the
...@@ -630,7 +638,7 @@ public: ...@@ -630,7 +638,7 @@ public:
* @param aItemsListPicker = the list picker to use for an undo command * @param aItemsListPicker = the list picker to use for an undo command
* (can be NULL) * (can be NULL)
* @param aUseNetclassValue = true to use NetClass value, false to use * @param aUseNetclassValue = true to use NetClass value, false to use
* g_DesignSettings value * current designSettings value
* @return true if done, false if no not change (because DRC error) * @return true if done, false if no not change (because DRC error)
*/ */
bool SetTrackSegmentWidth( TRACK* aTrackItem, bool SetTrackSegmentWidth( TRACK* aTrackItem,
......
...@@ -39,7 +39,7 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode ) ...@@ -39,7 +39,7 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
int autoroute_net_code = -1; int autoroute_net_code = -1;
wxString msg; wxString msg;
if( g_DesignSettings.GetCopperLayerCount() > 1 ) if( GetBoard()->GetCopperLayerCount() > 1 )
{ {
Route_Layer_TOP = ((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP; Route_Layer_TOP = ((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP;
Route_Layer_BOTTOM = ((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM; Route_Layer_BOTTOM = ((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM;
......
...@@ -178,7 +178,7 @@ void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer ) ...@@ -178,7 +178,7 @@ void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
// If only one copper layer is enabled, the only such layer // If only one copper layer is enabled, the only such layer
// that can be selected to is the "Copper" layer (so the // that can be selected to is the "Copper" layer (so the
// selection of any other copper layer is disregarded). // selection of any other copper layer is disregarded).
if( m_Pcb->m_BoardSettings->GetCopperLayerCount() < 2 ) if( m_Pcb->GetCopperLayerCount() < 2 )
{ {
if( layer != LAYER_N_BACK ) if( layer != LAYER_N_BACK )
{ {
...@@ -193,7 +193,7 @@ void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer ) ...@@ -193,7 +193,7 @@ void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
else else
{ {
if( ( layer != LAYER_N_BACK ) && ( layer != LAYER_N_FRONT ) if( ( layer != LAYER_N_BACK ) && ( layer != LAYER_N_FRONT )
&& ( layer >= m_Pcb->m_BoardSettings->GetCopperLayerCount() - 1 ) ) && ( layer >= m_Pcb->GetCopperLayerCount() - 1 ) )
{ {
return; return;
} }
...@@ -273,15 +273,15 @@ BOARD_ITEM* WinEDA_BasePcbFrame::GetCurItem() ...@@ -273,15 +273,15 @@ BOARD_ITEM* WinEDA_BasePcbFrame::GetCurItem()
GENERAL_COLLECTORS_GUIDE WinEDA_BasePcbFrame::GetCollectorsGuide() GENERAL_COLLECTORS_GUIDE WinEDA_BasePcbFrame::GetCollectorsGuide()
{ {
GENERAL_COLLECTORS_GUIDE guide( m_Pcb->m_BoardSettings->GetVisibleLayers(), GENERAL_COLLECTORS_GUIDE guide( m_Pcb->GetVisibleLayers(),
( (PCB_SCREEN*)GetScreen())->m_Active_Layer ); ( (PCB_SCREEN*)GetScreen())->m_Active_Layer );
// account for the globals // account for the globals
guide.SetIgnoreMTextsMarkedNoShow( ! g_DesignSettings.IsElementVisible( MOD_TEXT_INVISIBLE )); guide.SetIgnoreMTextsMarkedNoShow( ! m_Pcb->IsElementVisible( MOD_TEXT_INVISIBLE ));
guide.SetIgnoreMTextsOnCopper( ! g_DesignSettings.IsElementVisible( MOD_TEXT_BK_VISIBLE )); guide.SetIgnoreMTextsOnCopper( ! m_Pcb->IsElementVisible( MOD_TEXT_BK_VISIBLE ));
guide.SetIgnoreMTextsOnCmp( ! g_DesignSettings.IsElementVisible( MOD_TEXT_FR_VISIBLE )); guide.SetIgnoreMTextsOnCmp( ! m_Pcb->IsElementVisible( MOD_TEXT_FR_VISIBLE ));
guide.SetIgnoreModulesOnCu( !g_DesignSettings.IsElementVisible( MOD_BK_VISIBLE ) ); guide.SetIgnoreModulesOnCu( ! m_Pcb->IsElementVisible( MOD_BK_VISIBLE ) );
guide.SetIgnoreModulesOnCmp( !g_DesignSettings.IsElementVisible( MOD_FR_VISIBLE ) ); guide.SetIgnoreModulesOnCmp( ! m_Pcb->IsElementVisible( MOD_FR_VISIBLE ) );
return guide; return guide;
} }
......
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
*/ */
wxPoint BOARD_ITEM::ZeroOffset( 0, 0 ); wxPoint BOARD_ITEM::ZeroOffset( 0, 0 );
// Current design settings (used also to read configs):
BOARD_DESIGN_SETTINGS boardDesignSettings;
/*****************/ /*****************/
/* Class BOARD: */ /* Class BOARD: */
...@@ -25,7 +28,8 @@ BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) : ...@@ -25,7 +28,8 @@ BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) :
{ {
m_PcbFrame = frame; m_PcbFrame = frame;
m_Status_Pcb = 0; // Status word: bit 1 = calculate. m_Status_Pcb = 0; // Status word: bit 1 = calculate.
m_BoardSettings = &g_DesignSettings; SetBoardDesignSettings(&boardDesignSettings);
SetColorsSettings(&g_ColorsSettings);
m_NbNodes = 0; // Number of connected pads. m_NbNodes = 0; // Number of connected pads.
m_NbNoconnect = 0; // Number of unconnected nets. m_NbNoconnect = 0; // Number of unconnected nets.
...@@ -181,15 +185,13 @@ int BOARD::GetCurrentMicroViaDrill() ...@@ -181,15 +185,13 @@ int BOARD::GetCurrentMicroViaDrill()
} }
wxString BOARD::GetLayerName( int aLayerIndex ) const wxString BOARD::GetLayerName( int aLayerIndex ) const
{ {
if( !IsValidLayerIndex( aLayerIndex ) ) if( !IsValidLayerIndex( aLayerIndex ) )
return wxEmptyString; return wxEmptyString;
// copper layer names are stored in the BOARD. // copper layer names are stored in the BOARD.
if( IsValidCopperLayerIndex( aLayerIndex ) if( IsValidCopperLayerIndex( aLayerIndex ) && IsLayerEnabled( aLayerIndex ) )
&& m_BoardSettings->IsLayerEnabled( aLayerIndex ) )
{ {
// default names were set in BOARD::BOARD() but they may be // default names were set in BOARD::BOARD() but they may be
// over-ridden by BOARD::SetLayerName() // over-ridden by BOARD::SetLayerName()
...@@ -263,11 +265,11 @@ bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName ) ...@@ -263,11 +265,11 @@ bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName )
// replace any spaces with underscores before we do any comparing // replace any spaces with underscores before we do any comparing
NameTemp.Replace( wxT( " " ), wxT( "_" ) ); NameTemp.Replace( wxT( " " ), wxT( "_" ) );
if( m_BoardSettings->IsLayerEnabled( aLayerIndex ) ) if( IsLayerEnabled( aLayerIndex ) )
{ {
for( int i = 0; i < NB_COPPER_LAYERS; i++ ) for( int i = 0; i < NB_COPPER_LAYERS; i++ )
{ {
if( i != aLayerIndex && m_BoardSettings->IsLayerEnabled( i ) if( i != aLayerIndex && IsLayerEnabled( i )
&& NameTemp == m_Layer[i].m_Name ) && NameTemp == m_Layer[i].m_Name )
return false; return false;
} }
...@@ -288,7 +290,7 @@ LAYER_T BOARD::GetLayerType( int aLayerIndex ) const ...@@ -288,7 +290,7 @@ LAYER_T BOARD::GetLayerType( int aLayerIndex ) const
//@@IMB: The original test was broken due to the discontinuity //@@IMB: The original test was broken due to the discontinuity
// in the layer sequence. // in the layer sequence.
if( m_BoardSettings->IsLayerEnabled( aLayerIndex ) ) if( IsLayerEnabled( aLayerIndex ) )
return m_Layer[aLayerIndex].m_Type; return m_Layer[aLayerIndex].m_Type;
return LT_SIGNAL; return LT_SIGNAL;
} }
...@@ -301,7 +303,7 @@ bool BOARD::SetLayerType( int aLayerIndex, LAYER_T aLayerType ) ...@@ -301,7 +303,7 @@ bool BOARD::SetLayerType( int aLayerIndex, LAYER_T aLayerType )
//@@IMB: The original test was broken due to the discontinuity //@@IMB: The original test was broken due to the discontinuity
// in the layer sequence. // in the layer sequence.
if( m_BoardSettings->IsLayerEnabled( aLayerIndex ) ) if( IsLayerEnabled( aLayerIndex ) )
{ {
m_Layer[aLayerIndex].m_Type = aLayerType; m_Layer[aLayerIndex].m_Type = aLayerType;
return true; return true;
...@@ -354,35 +356,36 @@ LAYER_T LAYER::ParseType( const char* aType ) ...@@ -354,35 +356,36 @@ LAYER_T LAYER::ParseType( const char* aType )
int BOARD::GetCopperLayerCount() const int BOARD::GetCopperLayerCount() const
{ {
return m_BoardSettings->GetCopperLayerCount(); return GetBoardDesignSettings()->GetCopperLayerCount();
} }
void BOARD::SetCopperLayerCount( int aCount ) void BOARD::SetCopperLayerCount( int aCount )
{ {
m_BoardSettings->SetCopperLayerCount( aCount ); GetBoardDesignSettings()->SetCopperLayerCount( aCount );
} }
int BOARD::GetEnabledLayers() const int BOARD::GetEnabledLayers() const
{ {
return m_BoardSettings->GetEnabledLayers(); return GetBoardDesignSettings()->GetEnabledLayers();
} }
int BOARD::GetVisibleLayers() const int BOARD::GetVisibleLayers() const
{ {
return m_BoardSettings->GetVisibleLayers(); return GetBoardDesignSettings()->GetVisibleLayers();
} }
void BOARD::SetEnabledLayers( int aLayerMask ) void BOARD::SetEnabledLayers( int aLayerMask )
{ {
m_BoardSettings->SetEnabledLayers( aLayerMask ); GetBoardDesignSettings()->SetEnabledLayers( aLayerMask );
} }
void BOARD::SetVisibleLayers( int aLayerMask ) void BOARD::SetVisibleLayers( int aLayerMask )
{ {
m_BoardSettings->SetVisibleLayers( aLayerMask ); GetBoardDesignSettings()->SetVisibleLayers( aLayerMask );
} }
...@@ -415,23 +418,13 @@ void BOARD::SetVisibleAlls( ) ...@@ -415,23 +418,13 @@ void BOARD::SetVisibleAlls( )
int BOARD::GetVisibleElements() const int BOARD::GetVisibleElements() const
{ {
return m_BoardSettings->GetVisibleElements(); return GetBoardDesignSettings()->GetVisibleElements();
} }
bool BOARD::IsElementVisible( int aPCB_VISIBLE ) const bool BOARD::IsElementVisible( int aPCB_VISIBLE ) const
{ {
// @todo move these special cases into default, by moving globals into the board. return GetBoardDesignSettings()->IsElementVisible( aPCB_VISIBLE );
switch( aPCB_VISIBLE )
{
/*
case GRID_VISIBLE:
myframe->m_Draw_Grid = isEnabled;
break;
*/
default:
return m_BoardSettings->IsElementVisible( aPCB_VISIBLE );
}
} }
...@@ -441,12 +434,12 @@ void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled ) ...@@ -441,12 +434,12 @@ void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled )
{ {
case GRID_VISIBLE: case GRID_VISIBLE:
m_PcbFrame->m_Draw_Grid = isEnabled; m_PcbFrame->m_Draw_Grid = isEnabled;
m_BoardSettings->SetElementVisibility( aPCB_VISIBLE, isEnabled ); GetBoardDesignSettings()->SetElementVisibility( aPCB_VISIBLE, isEnabled );
break; break;
case RATSNEST_VISIBLE: case RATSNEST_VISIBLE:
m_BoardSettings->SetElementVisibility( aPCB_VISIBLE, isEnabled ); GetBoardDesignSettings()->SetElementVisibility( aPCB_VISIBLE, isEnabled );
// we must clear or set the CH_VISIBLE flags to hide/show ratsnet // we must clear or set the CH_VISIBLE flags to hide/show ratsnet
// because we have a tool to show hide ratsnest relative to a pad or a module // because we have a tool to show hide ratsnest relative to a pad or a module
// so the hide/show option is a per item selection // so the hide/show option is a per item selection
...@@ -464,7 +457,7 @@ void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled ) ...@@ -464,7 +457,7 @@ void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled )
default: default:
m_BoardSettings->SetElementVisibility( aPCB_VISIBLE, isEnabled ); GetBoardDesignSettings()->SetElementVisibility( aPCB_VISIBLE, isEnabled );
} }
} }
...@@ -485,7 +478,7 @@ int BOARD::GetVisibleElementColor( int aPCB_VISIBLE ) ...@@ -485,7 +478,7 @@ int BOARD::GetVisibleElementColor( int aPCB_VISIBLE )
case PAD_FR_VISIBLE: case PAD_FR_VISIBLE:
case PAD_BK_VISIBLE: case PAD_BK_VISIBLE:
case RATSNEST_VISIBLE: case RATSNEST_VISIBLE:
color = g_ColorsSettings.GetItemColor( aPCB_VISIBLE ); color = GetColorsSettings()->GetItemColor( aPCB_VISIBLE );
break; break;
case GRID_VISIBLE: case GRID_VISIBLE:
color = g_GridColor; color = g_GridColor;
...@@ -512,10 +505,10 @@ void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, int aColor ) ...@@ -512,10 +505,10 @@ void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, int aColor )
case ANCHOR_VISIBLE: case ANCHOR_VISIBLE:
case PAD_FR_VISIBLE: case PAD_FR_VISIBLE:
case PAD_BK_VISIBLE: case PAD_BK_VISIBLE:
g_ColorsSettings.SetItemColor( aPCB_VISIBLE, aColor ); GetColorsSettings()->SetItemColor( aPCB_VISIBLE, aColor );
break; break;
case RATSNEST_VISIBLE: case RATSNEST_VISIBLE:
g_ColorsSettings.SetItemColor( aPCB_VISIBLE, aColor ); GetColorsSettings()->SetItemColor( aPCB_VISIBLE, aColor );
break; break;
case GRID_VISIBLE: case GRID_VISIBLE:
...@@ -530,15 +523,35 @@ void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, int aColor ) ...@@ -530,15 +523,35 @@ void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, int aColor )
void BOARD::SetLayerColor( int aLayer, int aColor ) void BOARD::SetLayerColor( int aLayer, int aColor )
{ {
g_ColorsSettings.SetLayerColor( aLayer, aColor ); GetColorsSettings()->SetLayerColor( aLayer, aColor );
} }
int BOARD::GetLayerColor( int aLayer ) int BOARD::GetLayerColor( int aLayer )
{ {
return g_ColorsSettings.GetLayerColor( aLayer ); return GetColorsSettings()->GetLayerColor( aLayer );
} }
/**
* Function IsModuleLayerVisible
* expects either of the two layers on which a module can reside, and returns
* whether that layer is visible.
* @param layer One of the two allowed layers for modules: LAYER_N_FRONT or LAYER_N_BACK
* @return bool - true if the layer is visible, else false.
*/
bool BOARD::IsModuleLayerVisible( int layer )
{
if( layer==LAYER_N_FRONT )
return IsElementVisible( PCB_VISIBLE(MOD_FR_VISIBLE) );
else if( layer==LAYER_N_BACK )
return IsElementVisible( PCB_VISIBLE(MOD_BK_VISIBLE) );
else
return true;
}
wxPoint& BOARD::GetPosition() wxPoint& BOARD::GetPosition()
{ {
......
...@@ -7,10 +7,11 @@ ...@@ -7,10 +7,11 @@
#include "dlist.h" #include "dlist.h"
#include "class_netinfo.h" #include "class_netinfo.h"
#include "class_colors_design_settings.h"
#include "class_board_design_settings.h"
class ZONE_CONTAINER; class ZONE_CONTAINER;
class EDA_BoardDesignSettings;
/** /**
...@@ -62,7 +63,7 @@ struct LAYER ...@@ -62,7 +63,7 @@ struct LAYER
/** a small helper class to handle a stock of specific vias diameter and drill pair /** a small helper class to handle a stock of specific vias diameter and drill pair
* in the BOARD class * in the BOARD class
*/ */
class VIA_DIMENSION class VIA_DIMENSION
{ {
public: public:
...@@ -74,15 +75,18 @@ public: ...@@ -74,15 +75,18 @@ public:
m_Diameter = 0; m_Drill = 0; m_Diameter = 0; m_Drill = 0;
} }
bool operator == (const VIA_DIMENSION& other) const
bool operator ==( const VIA_DIMENSION& other ) const
{ {
return (m_Diameter == other.m_Diameter) && return (m_Diameter == other.m_Diameter)
(m_Drill == other.m_Drill); && (m_Drill == other.m_Drill);
} }
bool operator < (const VIA_DIMENSION& other) const
bool operator <( const VIA_DIMENSION& other ) const
{ {
if (m_Diameter != other.m_Diameter) if( m_Diameter != other.m_Diameter )
return (m_Diameter < other.m_Diameter); return m_Diameter < other.m_Diameter;
return m_Drill < other.m_Drill; return m_Drill < other.m_Drill;
} }
}; };
...@@ -110,7 +114,6 @@ public: ...@@ -110,7 +114,6 @@ public:
WinEDA_BasePcbFrame* m_PcbFrame; // Window of visualization WinEDA_BasePcbFrame* m_PcbFrame; // Window of visualization
EDA_Rect m_BoundaryBox; // Board size and position EDA_Rect m_BoundaryBox; // Board size and position
int m_Status_Pcb; // Flags used in ratsnet calculation and update int m_Status_Pcb; // Flags used in ratsnet calculation and update
EDA_BoardDesignSettings* m_BoardSettings; // Link to current design settings
int m_NbNodes; // Active pads (pads attached to a net ) count int m_NbNodes; // Active pads (pads attached to a net ) count
int m_NbNoconnect; // Active ratsnet count (rastnests not already connected by tracks) int m_NbNoconnect; // Active ratsnet count (rastnests not already connected by tracks)
...@@ -144,6 +147,10 @@ public: ...@@ -144,6 +147,10 @@ public:
// 0 is the index selection of the default value Netclass // 0 is the index selection of the default value Netclass
unsigned m_TrackWidthSelector; // index for m_TrackWidthList to select the value unsigned m_TrackWidthSelector; // index for m_TrackWidthList to select the value
private:
BOARD_DESIGN_SETTINGS* m_boardDesignSettings; // Link to current design settings
COLORS_DESIGN_SETTINGS* m_colorsSettings; // Link to current colors settings
/**********************************/ /**********************************/
public: public:
BOARD( EDA_BaseStruct* aParent, WinEDA_BasePcbFrame* frame ); BOARD( EDA_BaseStruct* aParent, WinEDA_BasePcbFrame* frame );
...@@ -267,6 +274,30 @@ public: ...@@ -267,6 +274,30 @@ public:
*/ */
void SetEnabledLayers( int aLayerMask ); void SetEnabledLayers( int aLayerMask );
/**
* Function IsLayerEnabled
* is a proxy function that calls the correspondent function in m_BoardSettings
* tests whether a given layer is enabled
* @param aLayerIndex = The index of the layer to be tested
* @return bool - true if the layer is visible.
*/
bool IsLayerEnabled( int aLayer ) const
{
return GetBoardDesignSettings()->IsLayerEnabled( aLayer );
}
/**
* Function IsLayerVisible
* is a proxy function that calls the correspondent function in m_BoardSettings
* tests whether a given layer is visible
* @param aLayerIndex = The index of the layer to be tested
* @return bool - true if the layer is visible.
*/
bool IsLayerVisible( int aLayerIndex ) const
{
return GetBoardDesignSettings()->IsLayerVisible( aLayerIndex );
}
/** /**
* Function GetVisibleLayers * Function GetVisibleLayers
* is a proxy function that calls the correspondent function in m_BoardSettings * is a proxy function that calls the correspondent function in m_BoardSettings
...@@ -309,7 +340,7 @@ public: ...@@ -309,7 +340,7 @@ public:
* changes the bit-mask of visible element categories and layers * changes the bit-mask of visible element categories and layers
* @see enum PCB_VISIBLE * @see enum PCB_VISIBLE
*/ */
void SetVisibleAlls( ); void SetVisibleAlls();
/** /**
* Function IsElementVisible * Function IsElementVisible
...@@ -330,6 +361,15 @@ public: ...@@ -330,6 +361,15 @@ public:
*/ */
void SetElementVisibility( int aPCB_VISIBLE, bool aNewState ); void SetElementVisibility( int aPCB_VISIBLE, bool aNewState );
/**
* Function IsModuleLayerVisible
* expects either of the two layers on which a module can reside, and returns
* whether that layer is visible.
* @param layer One of the two allowed layers for modules: LAYER_N_FRONT or LAYER_N_BACK
* @return bool - true if the layer is visible, else false.
*/
bool IsModuleLayerVisible( int layer );
/** /**
* Function GetVisibleElementColor * Function GetVisibleElementColor
* returns the color of a pcb visible element. * returns the color of a pcb visible element.
...@@ -339,6 +379,40 @@ public: ...@@ -339,6 +379,40 @@ public:
void SetVisibleElementColor( int aPCB_VISIBLE, int aColor ); void SetVisibleElementColor( int aPCB_VISIBLE, int aColor );
/** Function GetBoardDesignSettings
* @return the current BOARD_DESIGN_SETTINGS in use
*/
BOARD_DESIGN_SETTINGS* GetBoardDesignSettings() const
{
return m_boardDesignSettings;
}
/** Function SetBoardDesignSettings
* @param aDesignSettings = the new BOARD_DESIGN_SETTINGS to use
*/
void SetBoardDesignSettings( BOARD_DESIGN_SETTINGS* aDesignSettings)
{
m_boardDesignSettings = aDesignSettings;
}
/** Function SetBoardSettings
* @return the current COLORS_DESIGN_SETTINGS in use
*/
COLORS_DESIGN_SETTINGS* GetColorsSettings() const
{
return m_colorsSettings;
}
/** Function SetColorsSettings
* @param aColorsSettings = the new COLORS_DESIGN_SETTINGS to use
*/
void SetColorsSettings(COLORS_DESIGN_SETTINGS* aColorsSettings)
{
m_colorsSettings = aColorsSettings;
}
/** /**
* Function GetLayerName * Function GetLayerName
* returns the name of the layer given by aLayerIndex. * returns the name of the layer given by aLayerIndex.
...@@ -391,7 +465,6 @@ public: ...@@ -391,7 +465,6 @@ public:
*/ */
int GetLayerColor( int aLayer ); int GetLayerColor( int aLayer );
/* Functions to get some items count */ /* Functions to get some items count */
int GetNumSegmTrack(); int GetNumSegmTrack();
int GetNumSegmZone(); int GetNumSegmZone();
...@@ -501,6 +574,7 @@ public: ...@@ -501,6 +574,7 @@ public:
/**************************************/ /**************************************/
/** function relative to NetClasses: **/ /** function relative to NetClasses: **/
/**************************************/ /**************************************/
/** /**
* Function SynchronizeNetsAndNetClasses * Function SynchronizeNetsAndNetClasses
* copies NETCLASS info to each NET, based on NET membership in a NETCLASS. * copies NETCLASS info to each NET, based on NET membership in a NETCLASS.
...@@ -537,6 +611,7 @@ public: ...@@ -537,6 +611,7 @@ public:
return m_TrackWidthList[m_TrackWidthSelector]; return m_TrackWidthList[m_TrackWidthSelector];
} }
/** function GetCurrentViaSize /** function GetCurrentViaSize
* @return the current via size, according to the selected options * @return the current via size, according to the selected options
* ( using the default netclass value or a preset value ) * ( using the default netclass value or a preset value )
...@@ -547,6 +622,7 @@ public: ...@@ -547,6 +622,7 @@ public:
return m_ViasDimensionsList[m_ViaSizeSelector].m_Diameter; return m_ViasDimensionsList[m_ViaSizeSelector].m_Diameter;
} }
/** function GetCurrentViaDrill /** function GetCurrentViaDrill
* @return the current via size, according to the selected options * @return the current via size, according to the selected options
* ( using the default netclass value or a preset value ) * ( using the default netclass value or a preset value )
...@@ -558,6 +634,7 @@ public: ...@@ -558,6 +634,7 @@ public:
m_ViasDimensionsList[m_ViaSizeSelector].m_Drill : -1; m_ViasDimensionsList[m_ViaSizeSelector].m_Drill : -1;
} }
/** function GetCurrentMicroViaSize /** function GetCurrentMicroViaSize
* @return the current micro via size, * @return the current micro via size,
* that is the current netclass value * that is the current netclass value
...@@ -571,6 +648,7 @@ public: ...@@ -571,6 +648,7 @@ public:
int GetCurrentMicroViaDrill(); int GetCurrentMicroViaDrill();
/***************************************************************************/ /***************************************************************************/
/** /**
* Function Save * Function Save
* writes the data structures for this object out to a FILE in "*.brd" format. * writes the data structures for this object out to a FILE in "*.brd" format.
...@@ -860,7 +938,6 @@ public: ...@@ -860,7 +938,6 @@ public:
* @param aNetcode = netcode to analyze. if -1, analyze all nets * @param aNetcode = netcode to analyze. if -1, analyze all nets
*/ */
void Test_Connections_To_Copper_Areas( int aNetcode = -1 ); void Test_Connections_To_Copper_Areas( int aNetcode = -1 );
}; };
#endif // #ifndef CLASS_BOARD_H #endif // #ifndef CLASS_BOARD_H
/***************************************************************************/ /***************************************************************************/
/* class_board_design_settings.cpp - EDA_BoardDesignSettings class functions */ /* class_board_design_settings.cpp - BOARD_DESIGN_SETTINGS class functions */
/***************************************************************************/ /***************************************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
/*****************************************************/ /*****************************************************/
EDA_BoardDesignSettings::EDA_BoardDesignSettings() BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS()
/*****************************************************/ /*****************************************************/
// Default values for designing boards // Default values for designing boards
...@@ -40,11 +40,13 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings() ...@@ -40,11 +40,13 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
// The final margin is the sum of these 2 values // The final margin is the sum of these 2 values
// Usually < 0 because the mask is smaller than pad // Usually < 0 because the mask is smaller than pad
m_BoardThickness = 1.6 * PCB_INTERNAL_UNIT / 25.4; // Epoxy thickness for 3D view (and microwave calculations) // Layer Thickness for 3D viewer
} }
// see pcbstruct.h // see pcbstruct.h
int EDA_BoardDesignSettings::GetVisibleLayers() const int BOARD_DESIGN_SETTINGS::GetVisibleLayers() const
{ {
return m_VisibleLayers; return m_VisibleLayers;
} }
...@@ -55,20 +57,20 @@ int EDA_BoardDesignSettings::GetVisibleLayers() const ...@@ -55,20 +57,20 @@ int EDA_BoardDesignSettings::GetVisibleLayers() const
* Set the bit-mask of all visible elements categories, * Set the bit-mask of all visible elements categories,
* including enabled layers * including enabled layers
*/ */
void EDA_BoardDesignSettings::SetVisibleAlls( ) void BOARD_DESIGN_SETTINGS::SetVisibleAlls( )
{ {
SetVisibleLayers( FULL_LAYERS ); SetVisibleLayers( FULL_LAYERS );
m_VisibleElements = 0xFFFFFFFF; m_VisibleElements = 0xFFFFFFFF;
} }
void EDA_BoardDesignSettings::SetVisibleLayers( int aMask ) void BOARD_DESIGN_SETTINGS::SetVisibleLayers( int aMask )
{ {
// Although Pcbnew uses only 29, Gerbview uses all 32 layers // Although Pcbnew uses only 29, Gerbview uses all 32 layers
m_VisibleLayers = aMask & m_EnabledLayers & FULL_LAYERS; m_VisibleLayers = aMask & m_EnabledLayers & FULL_LAYERS;
} }
void EDA_BoardDesignSettings::SetLayerVisibility( int aLayerIndex, bool aNewState ) void BOARD_DESIGN_SETTINGS::SetLayerVisibility( int aLayerIndex, bool aNewState )
{ {
// Altough Pcbnew uses only 29, Gerbview uses all 32 layers // Altough Pcbnew uses only 29, Gerbview uses all 32 layers
if( aLayerIndex < 0 || aLayerIndex >= 32 ) if( aLayerIndex < 0 || aLayerIndex >= 32 )
...@@ -80,7 +82,7 @@ void EDA_BoardDesignSettings::SetLayerVisibility( int aLayerIndex, bool aNewStat ...@@ -80,7 +82,7 @@ void EDA_BoardDesignSettings::SetLayerVisibility( int aLayerIndex, bool aNewStat
} }
void EDA_BoardDesignSettings::SetElementVisibility( int aElementCategory, bool aNewState ) void BOARD_DESIGN_SETTINGS::SetElementVisibility( int aElementCategory, bool aNewState )
{ {
if( aElementCategory < 0 || aElementCategory >= END_PCB_VISIBLE_LIST ) if( aElementCategory < 0 || aElementCategory >= END_PCB_VISIBLE_LIST )
return; return;
...@@ -91,7 +93,7 @@ void EDA_BoardDesignSettings::SetElementVisibility( int aElementCategory, bool a ...@@ -91,7 +93,7 @@ void EDA_BoardDesignSettings::SetElementVisibility( int aElementCategory, bool a
} }
void EDA_BoardDesignSettings::SetCopperLayerCount( int aNewLayerCount ) void BOARD_DESIGN_SETTINGS::SetCopperLayerCount( int aNewLayerCount )
{ {
// if( aNewLayerCount < 2 ) aNewLayerCount = 2; // if( aNewLayerCount < 2 ) aNewLayerCount = 2;
...@@ -113,7 +115,7 @@ void EDA_BoardDesignSettings::SetCopperLayerCount( int aNewLayerCount ) ...@@ -113,7 +115,7 @@ void EDA_BoardDesignSettings::SetCopperLayerCount( int aNewLayerCount )
* changes the bit-mask of enabled layers * changes the bit-mask of enabled layers
* @param aMask = The new bit-mask of enabled layers * @param aMask = The new bit-mask of enabled layers
*/ */
void EDA_BoardDesignSettings::SetEnabledLayers( int aMask ) void BOARD_DESIGN_SETTINGS::SetEnabledLayers( int aMask )
{ {
// Back and front layers are always enabled. // Back and front layers are always enabled.
aMask |= LAYER_BACK | LAYER_FRONT; aMask |= LAYER_BACK | LAYER_FRONT;
......
...@@ -33,7 +33,7 @@ COTATION::~COTATION() ...@@ -33,7 +33,7 @@ COTATION::~COTATION()
/* Setup the dimension text */ /* Setup the dimension text */
void COTATION:: SetText( const wxString& NewText ) void COTATION::SetText( const wxString& NewText )
{ {
m_Text->m_Text = NewText; m_Text->m_Text = NewText;
} }
...@@ -421,10 +421,11 @@ void COTATION::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -421,10 +421,11 @@ void COTATION::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
m_Text->Draw( panel, DC, mode_color, offset ); m_Text->Draw( panel, DC, mode_color, offset );
if( g_DesignSettings.IsLayerVisible( m_Layer ) == false ) BOARD * brd = GetBoard( );
if( brd->IsLayerVisible( m_Layer ) == false )
return; return;
gcolor = g_ColorsSettings.GetLayerColor(m_Layer); gcolor = brd->GetLayerColor(m_Layer);
GRSetDrawMode( DC, mode_color ); GRSetDrawMode( DC, mode_color );
typeaff = DisplayOpt.DisplayDrawItems; typeaff = DisplayOpt.DisplayDrawItems;
......
...@@ -28,15 +28,11 @@ public: ...@@ -28,15 +28,11 @@ public:
COTATION( BOARD_ITEM* aParent ); COTATION( BOARD_ITEM* aParent );
~COTATION(); ~COTATION();
COTATION* Next() const { return (COTATION*) Pnext; }
COTATION* Back() const { return (COTATION*) Pback; }
wxPoint& GetPosition() wxPoint& GetPosition()
{ {
return m_Pos; return m_Pos;
} }
/** /**
* Function SetLayer * Function SetLayer
* sets the layer this item is on. * sets the layer this item is on.
......
...@@ -236,10 +236,11 @@ void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -236,10 +236,11 @@ void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
int color, mode; int color, mode;
int rayon; int rayon;
if( g_DesignSettings.IsLayerVisible( GetLayer() ) == false ) BOARD * brd = GetBoard( );
if( brd->IsLayerVisible( GetLayer() ) == false )
return; return;
color = g_ColorsSettings.GetLayerColor(GetLayer()); color = brd->GetLayerColor(GetLayer());
GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( DC, draw_mode );
l_piste = m_Width >> 1; /* half trace width */ l_piste = m_Width >> 1; /* half trace width */
......
...@@ -160,15 +160,16 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -160,15 +160,16 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
int typeaff; int typeaff;
PCB_SCREEN* screen; PCB_SCREEN* screen;
WinEDA_BasePcbFrame* frame; WinEDA_BasePcbFrame* frame;
MODULE* Module = NULL; MODULE* module = (MODULE*) m_Parent;
if( m_Parent && ( m_Parent->Type() == TYPE_MODULE ) ) if( module == NULL )
Module = (MODULE*) m_Parent; return;
if( g_DesignSettings.IsLayerVisible( m_Layer ) == false ) BOARD * brd = GetBoard( );
if( brd->IsLayerVisible( m_Layer ) == false )
return; return;
color = g_ColorsSettings.GetLayerColor(m_Layer); color = brd->GetLayerColor(m_Layer);
frame = (WinEDA_BasePcbFrame*) panel->GetParent(); frame = (WinEDA_BasePcbFrame*) panel->GetParent();
...@@ -264,15 +265,9 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -264,15 +265,9 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
{ {
wxPoint& pt = points[ii]; wxPoint& pt = points[ii];
if( Module ) RotatePoint( &pt.x, &pt.y, module->m_Orient );
{ pt += module->m_Pos;
RotatePoint( &pt.x, &pt.y, Module->m_Orient ); pt += m_Start0 - offset;
pt.x += Module->m_Pos.x;
pt.y += Module->m_Pos.y;
}
pt.x += m_Start0.x - offset.x;
pt.y += m_Start0.y - offset.y;
} }
GRPoly( &panel->m_ClipBox, DC, points.size(), &points[0], GRPoly( &panel->m_ClipBox, DC, points.size(), &points[0],
......
...@@ -107,10 +107,11 @@ void MIREPCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -107,10 +107,11 @@ void MIREPCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
ox = m_Pos.x + offset.x; ox = m_Pos.x + offset.x;
oy = m_Pos.y + offset.y; oy = m_Pos.y + offset.y;
if( g_DesignSettings.IsLayerVisible( m_Layer ) == false ) BOARD * brd = GetBoard( );
if( brd->IsLayerVisible( m_Layer ) == false )
return; return;
gcolor = g_ColorsSettings.GetLayerColor(m_Layer); gcolor = brd->GetLayerColor(m_Layer);
GRSetDrawMode( DC, mode_color ); GRSetDrawMode( DC, mode_color );
typeaff = DisplayOpt.DisplayDrawItems; typeaff = DisplayOpt.DisplayDrawItems;
......
...@@ -59,7 +59,6 @@ MODULE::~MODULE() ...@@ -59,7 +59,6 @@ MODULE::~MODULE()
delete m_Value; delete m_Value;
} }
/* Draw the anchor cross (vertical) /* Draw the anchor cross (vertical)
* Must be done after the pads, because drawing the hole will erase overwrite * Must be done after the pads, because drawing the hole will erase overwrite
* every thing already drawn. * every thing already drawn.
...@@ -71,7 +70,7 @@ void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset ...@@ -71,7 +70,7 @@ void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset
GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( DC, draw_mode );
if( ((BOARD*)m_Parent)->IsElementVisible( ANCHOR_VISIBLE ) ) if( GetBoard()->IsElementVisible( ANCHOR_VISIBLE ) )
{ {
int color = g_ColorsSettings.GetItemColor(ANCHOR_VISIBLE); int color = g_ColorsSettings.GetItemColor(ANCHOR_VISIBLE);
GRLine( &panel->m_ClipBox, DC, GRLine( &panel->m_ClipBox, DC,
...@@ -192,18 +191,19 @@ void MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -192,18 +191,19 @@ void MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
pad->Draw( panel, DC, draw_mode, offset ); pad->Draw( panel, DC, draw_mode, offset );
} }
BOARD * brd = GetBoard();
// Draws footprint anchor // Draws footprint anchor
DrawAncre( panel, DC, offset, DIM_ANCRE_MODULE, draw_mode ); DrawAncre( panel, DC, offset, DIM_ANCRE_MODULE, draw_mode );
/* Draw graphic items */ /* Draw graphic items */
if( ((BOARD*)m_Parent)->IsElementVisible( MOD_REFERENCES_VISIBLE ) ) if( brd->IsElementVisible( MOD_REFERENCES_VISIBLE ) )
{ {
if( !(m_Reference->m_Flags & IS_MOVED) ) if( !(m_Reference->m_Flags & IS_MOVED) )
m_Reference->Draw( panel, DC, draw_mode, offset ); m_Reference->Draw( panel, DC, draw_mode, offset );
} }
if( ((BOARD*)m_Parent)->IsElementVisible( MOD_VALUES_VISIBLE ) ) if( brd->IsElementVisible( MOD_VALUES_VISIBLE ) )
{ {
if( !(m_Value->m_Flags & IS_MOVED) ) if( !(m_Value->m_Flags & IS_MOVED) )
m_Value->Draw( panel, DC, draw_mode, offset ); m_Value->Draw( panel, DC, draw_mode, offset );
...@@ -826,7 +826,7 @@ void MODULE::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -826,7 +826,7 @@ void MODULE::DisplayInfo( WinEDA_DrawFrame* frame )
char bufcar[512], Line[512]; char bufcar[512], Line[512];
bool flag = FALSE; bool flag = FALSE;
wxString msg; wxString msg;
BOARD* board = (BOARD*) m_Parent; BOARD* board = GetBoard();
frame->EraseMsgBox(); frame->EraseMsgBox();
if( frame->m_Ident != PCB_FRAME ) if( frame->m_Ident != PCB_FRAME )
...@@ -1043,7 +1043,7 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData, ...@@ -1043,7 +1043,7 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData,
*/ */
void MODULE::Show( int nestLevel, std::ostream& os ) void MODULE::Show( int nestLevel, std::ostream& os )
{ {
BOARD* board = (BOARD*) m_Parent; BOARD* board = GetBoard();
// for now, make it look like XML, expand on this later. // for now, make it look like XML, expand on this later.
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
......
...@@ -140,7 +140,6 @@ public: ...@@ -140,7 +140,6 @@ public:
return m_Pos; return m_Pos;
} }
// Moves // Moves
void SetPosition( const wxPoint& newpos ); void SetPosition( const wxPoint& newpos );
void SetOrientation( int newangle ); void SetOrientation( int newangle );
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
// Current design settings (used also to read configs):
extern BOARD_DESIGN_SETTINGS boardDesignSettings;
// This will get mapped to "kicad_default" in the specctra_export. // This will get mapped to "kicad_default" in the specctra_export.
const wxString NETCLASS::Default = wxT("Default"); const wxString NETCLASS::Default = wxT("Default");
...@@ -45,7 +47,7 @@ NETCLASS::NETCLASS( BOARD* aParent, const wxString& aName, const NETCLASS* initi ...@@ -45,7 +47,7 @@ NETCLASS::NETCLASS( BOARD* aParent, const wxString& aName, const NETCLASS* initi
m_Name( aName ) m_Name( aName )
{ {
// use initialParameters if not NULL, else set the initial // use initialParameters if not NULL, else set the initial
// parameters from g_DesignSettings // parameters from boardDesignSettings (try to change this)
SetParams( initialParameters ); SetParams( initialParameters );
} }
...@@ -62,8 +64,12 @@ void NETCLASS::SetParams( const NETCLASS* defaults ) ...@@ -62,8 +64,12 @@ void NETCLASS::SetParams( const NETCLASS* defaults )
SetuViaDrill( defaults->GetuViaDrill() ); SetuViaDrill( defaults->GetuViaDrill() );
} }
else else
{ { // We should use m_Parent->GetBoardDesignSettings()
const EDA_BoardDesignSettings& g = g_DesignSettings; // 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
// TODO: see how change that.
const BOARD_DESIGN_SETTINGS& g = boardDesignSettings;
SetTrackWidth( g.m_TrackMinWidth ); SetTrackWidth( g.m_TrackMinWidth );
SetViaDiameter( g.m_ViasMinSize ); SetViaDiameter( g.m_ViasMinSize );
...@@ -401,27 +407,27 @@ bool NETCLASS::ReadDescr( FILE* aFile, int* aLineNum ) ...@@ -401,27 +407,27 @@ bool NETCLASS::ReadDescr( FILE* aFile, int* aLineNum )
int NETCLASS::GetTrackMinWidth() const int NETCLASS::GetTrackMinWidth() const
{ {
return m_Parent->m_BoardSettings->m_TrackMinWidth; return m_Parent->GetBoardDesignSettings()->m_TrackMinWidth;
} }
int NETCLASS::GetViaMinDiameter() const int NETCLASS::GetViaMinDiameter() const
{ {
return m_Parent->m_BoardSettings->m_ViasMinSize; return m_Parent->GetBoardDesignSettings()->m_ViasMinSize;
} }
int NETCLASS::GetViaMinDrill() const int NETCLASS::GetViaMinDrill() const
{ {
return m_Parent->m_BoardSettings->m_ViasMinDrill; return m_Parent->GetBoardDesignSettings()->m_ViasMinDrill;
} }
int NETCLASS::GetuViaMinDiameter() const int NETCLASS::GetuViaMinDiameter() const
{ {
return m_Parent->m_BoardSettings->m_MicroViasMinSize; return m_Parent->GetBoardDesignSettings()->m_MicroViasMinSize;
} }
int NETCLASS::GetuViaMinDrill() const int NETCLASS::GetuViaMinDrill() const
{ {
return m_Parent->m_BoardSettings->m_MicroViasMinDrill; return m_Parent->GetBoardDesignSettings()->m_MicroViasMinDrill;
} }
...@@ -75,7 +75,8 @@ public: ...@@ -75,7 +75,8 @@ public:
* Name of identifier within BOARD file. * Name of identifier within BOARD file.
* 08-Sept-2009: changed the name from "NETCLASS" to this so we can * 08-Sept-2009: changed the name from "NETCLASS" to this so we can
* toss any previous NETCLASSes in migratory BOARD files which will not have * toss any previous NETCLASSes in migratory BOARD files which will not have
* the proper parameters in the default netclass (from g_DesignSettings) in them. * the proper parameters in the default netclass
* (from m_Parent->m_designSettings) in them.
* Spare the user from having to enter those defaults manually. * Spare the user from having to enter those defaults manually.
*/ */
#define BRD_NETCLASS "NCLASS" #define BRD_NETCLASS "NCLASS"
......
...@@ -237,21 +237,6 @@ public: ...@@ -237,21 +237,6 @@ public:
return m_NetClass->GetTrackWidth(); return m_NetClass->GetTrackWidth();
} }
#if 0
/**
* Function GetTrackMinWidth
* returns the Minimum value for tracks thickness (used in DRC)
*/
int GetTrackMinWidth()
{
return g_DesignSettings.m_TrackMinWidth;
}
#endif
/** /**
* Function GetViaSize * Function GetViaSize
* returns the size of vias used to route this net * returns the size of vias used to route this net
......
...@@ -247,14 +247,20 @@ int D_PAD::GetClearance( BOARD_CONNECTED_ITEM* aItem ) const ...@@ -247,14 +247,20 @@ int D_PAD::GetClearance( BOARD_CONNECTED_ITEM* aItem ) const
int D_PAD::GetSolderMaskMargin() int D_PAD::GetSolderMaskMargin()
{ {
int margin = m_LocalSolderMaskMargin; int margin = m_LocalSolderMaskMargin;
MODULE * module = (MODULE*) GetParent();
if( module )
{
if( margin == 0 ) if( margin == 0 )
{ {
if( GetParent() && ( (MODULE*) GetParent() )->m_LocalSolderMaskMargin ) if( module->m_LocalSolderMaskMargin )
margin = ( (MODULE*) GetParent() )->m_LocalSolderMaskMargin; margin = module->m_LocalSolderMaskMargin;
} }
if( margin == 0 ) if( margin == 0 )
margin = g_DesignSettings.m_SolderMaskMargin; {
BOARD * brd = GetBoard();
margin = brd->GetBoardDesignSettings()->m_SolderMaskMargin;
}
}
// ensure mask have a size always >= 0 // ensure mask have a size always >= 0
if( margin < 0 ) if( margin < 0 )
...@@ -278,17 +284,25 @@ int D_PAD::GetSolderMaskMargin() ...@@ -278,17 +284,25 @@ int D_PAD::GetSolderMaskMargin()
wxSize D_PAD::GetSolderPasteMargin() wxSize D_PAD::GetSolderPasteMargin()
{ {
int margin = m_LocalSolderPasteMargin; int margin = m_LocalSolderPasteMargin;
double mratio = m_LocalSolderPasteMarginRatio;
MODULE * module = (MODULE*) GetParent();
if( margin == 0 && GetParent() ) if( module )
margin = ( (MODULE*) GetParent() )->m_LocalSolderPasteMargin; {
if( margin == 0 && GetParent() ) if( margin == 0 )
margin = g_DesignSettings.m_SolderPasteMargin; margin = module->m_LocalSolderPasteMargin;
BOARD * brd = GetBoard();
if( margin == 0 )
margin = brd->GetBoardDesignSettings()->m_SolderPasteMargin;
double mratio = m_LocalSolderPasteMarginRatio;
if( mratio == 0.0 && GetParent() )
mratio = ( (MODULE*) GetParent() )->m_LocalSolderPasteMarginRatio;
if( mratio == 0.0 ) if( mratio == 0.0 )
mratio = g_DesignSettings.m_SolderPasteMarginRatio; mratio = module->m_LocalSolderPasteMarginRatio;
if( mratio == 0.0 )
{
mratio = brd->GetBoardDesignSettings()->m_SolderPasteMarginRatio;
}
}
wxSize pad_margin; wxSize pad_margin;
pad_margin.x = margin + wxRound( m_Size.x * mratio ); pad_margin.x = margin + wxRound( m_Size.x * mratio );
......
...@@ -59,8 +59,9 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, ...@@ -59,8 +59,9 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
(LAYER_FRONT | ADHESIVE_LAYER_FRONT | SOLDERPASTE_LAYER_FRONT\ (LAYER_FRONT | ADHESIVE_LAYER_FRONT | SOLDERPASTE_LAYER_FRONT\
| SILKSCREEN_LAYER_FRONT | SOLDERMASK_LAYER_FRONT) | SILKSCREEN_LAYER_FRONT | SOLDERMASK_LAYER_FRONT)
bool frontVisible = g_DesignSettings.IsElementVisible( PCB_VISIBLE(PAD_FR_VISIBLE) ); BOARD * brd = GetBoard( );
bool backVisible = g_DesignSettings.IsElementVisible( PCB_VISIBLE(PAD_BK_VISIBLE) ); bool frontVisible = brd->IsElementVisible( PCB_VISIBLE(PAD_FR_VISIBLE) );
bool backVisible = brd->IsElementVisible( PCB_VISIBLE(PAD_BK_VISIBLE) );
if( !frontVisible && !backVisible ) if( !frontVisible && !backVisible )
return; return;
...@@ -90,12 +91,12 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, ...@@ -90,12 +91,12 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
if( m_Masque_Layer & LAYER_FRONT ) if( m_Masque_Layer & LAYER_FRONT )
{ {
color = g_ColorsSettings.GetItemColor(PAD_FR_VISIBLE); color = brd->GetVisibleElementColor(PAD_FR_VISIBLE);
} }
if( m_Masque_Layer & LAYER_BACK ) if( m_Masque_Layer & LAYER_BACK )
{ {
color |= g_ColorsSettings.GetItemColor(PAD_BK_VISIBLE); color |= brd->GetVisibleElementColor(PAD_BK_VISIBLE);
} }
if( color == 0 ) /* Not on copper layer */ if( color == 0 ) /* Not on copper layer */
...@@ -105,55 +106,55 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, ...@@ -105,55 +106,55 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
switch( m_Masque_Layer & ~ALL_CU_LAYERS ) switch( m_Masque_Layer & ~ALL_CU_LAYERS )
{ {
case ADHESIVE_LAYER_BACK: case ADHESIVE_LAYER_BACK:
color = g_ColorsSettings.GetLayerColor(ADHESIVE_N_BACK); color = brd->GetLayerColor(ADHESIVE_N_BACK);
break; break;
case ADHESIVE_LAYER_FRONT: case ADHESIVE_LAYER_FRONT:
color = g_ColorsSettings.GetLayerColor(ADHESIVE_N_FRONT); color = brd->GetLayerColor(ADHESIVE_N_FRONT);
break; break;
case SOLDERPASTE_LAYER_BACK: case SOLDERPASTE_LAYER_BACK:
color = g_ColorsSettings.GetLayerColor(SOLDERPASTE_N_BACK); color = brd->GetLayerColor(SOLDERPASTE_N_BACK);
break; break;
case SOLDERPASTE_LAYER_FRONT: case SOLDERPASTE_LAYER_FRONT:
color = g_ColorsSettings.GetLayerColor(SOLDERPASTE_N_FRONT); color = brd->GetLayerColor(SOLDERPASTE_N_FRONT);
break; break;
case SILKSCREEN_LAYER_BACK: case SILKSCREEN_LAYER_BACK:
color = g_ColorsSettings.GetLayerColor(SILKSCREEN_N_BACK); color = brd->GetLayerColor(SILKSCREEN_N_BACK);
break; break;
case SILKSCREEN_LAYER_FRONT: case SILKSCREEN_LAYER_FRONT:
color = g_ColorsSettings.GetLayerColor(SILKSCREEN_N_FRONT); color = brd->GetLayerColor(SILKSCREEN_N_FRONT);
break; break;
case SOLDERMASK_LAYER_BACK: case SOLDERMASK_LAYER_BACK:
color = g_ColorsSettings.GetLayerColor(SOLDERMASK_N_BACK); color = brd->GetLayerColor(SOLDERMASK_N_BACK);
break; break;
case SOLDERMASK_LAYER_FRONT: case SOLDERMASK_LAYER_FRONT:
color = g_ColorsSettings.GetLayerColor(SOLDERMASK_N_FRONT); color = brd->GetLayerColor(SOLDERMASK_N_FRONT);
break; break;
case DRAW_LAYER: case DRAW_LAYER:
color = g_ColorsSettings.GetLayerColor(DRAW_N); color = brd->GetLayerColor(DRAW_N);
break; break;
case COMMENT_LAYER: case COMMENT_LAYER:
color = g_ColorsSettings.GetLayerColor(COMMENT_N); color = brd->GetLayerColor(COMMENT_N);
break; break;
case ECO1_LAYER: case ECO1_LAYER:
color = g_ColorsSettings.GetLayerColor(ECO1_N); color = brd->GetLayerColor(ECO1_N);
break; break;
case ECO2_LAYER: case ECO2_LAYER:
color = g_ColorsSettings.GetLayerColor(ECO2_N); color = brd->GetLayerColor(ECO2_N);
break; break;
case EDGE_LAYER: case EDGE_LAYER:
color = g_ColorsSettings.GetLayerColor(EDGE_N); color = brd->GetLayerColor(EDGE_N);
break; break;
default: default:
...@@ -218,7 +219,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, ...@@ -218,7 +219,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
{ {
if( IsOnLayer( screen->m_Active_Layer ) ) if( IsOnLayer( screen->m_Active_Layer ) )
{ {
color = g_ColorsSettings.GetLayerColor(screen->m_Active_Layer); color = brd->GetLayerColor(screen->m_Active_Layer);
// In hight contrast mode, and if the active layer is the mask // In hight contrast mode, and if the active layer is the mask
// layer shows the pad size with the mask clearance // layer shows the pad size with the mask clearance
...@@ -470,7 +471,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, ...@@ -470,7 +471,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( DC, draw_mode );
/* Draw "No connect" ( / or \ or cross X ) if necessary. : */ /* Draw "No connect" ( / or \ or cross X ) if necessary. : */
if( m_Netname.IsEmpty() && g_DesignSettings.IsElementVisible( PCB_VISIBLE(NO_CONNECTS_VISIBLE) ) ) if( m_Netname.IsEmpty() && brd->IsElementVisible( PCB_VISIBLE(NO_CONNECTS_VISIBLE) ) )
{ {
dx0 = MIN( dx0, dy0 ); dx0 = MIN( dx0, dy0 );
int nc_color = BLUE; int nc_color = BLUE;
......
...@@ -188,18 +188,20 @@ bool TEXTE_PCB::Save( FILE* aFile ) const ...@@ -188,18 +188,20 @@ bool TEXTE_PCB::Save( FILE* aFile ) const
void TEXTE_PCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC, void TEXTE_PCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
int DrawMode, const wxPoint& offset ) int DrawMode, const wxPoint& offset )
{ {
if( g_DesignSettings.IsLayerVisible( m_Layer ) == false ) BOARD * brd = GetBoard( );
if( brd->IsLayerVisible( m_Layer ) == false )
return; return;
int color = g_ColorsSettings.GetLayerColor(m_Layer); int color = brd->GetLayerColor(m_Layer);
GRTraceMode fillmode = FILLED; GRTraceMode fillmode = FILLED;
if ( DisplayOpt.DisplayDrawItems == SKETCH) if ( DisplayOpt.DisplayDrawItems == SKETCH)
fillmode = SKETCH; fillmode = SKETCH;
int anchor_color = UNSPECIFIED_COLOR; int anchor_color = UNSPECIFIED_COLOR;
if( g_DesignSettings.IsElementVisible( ANCHOR_VISIBLE ) ) if( brd->IsElementVisible( ANCHOR_VISIBLE ) )
anchor_color = g_ColorsSettings.GetItemColor(ANCHOR_VISIBLE); anchor_color = brd->GetVisibleElementColor(ANCHOR_VISIBLE);
EDA_TextStruct::Draw( panel, DC, offset, (EDA_Colors) color, EDA_TextStruct::Draw( panel, DC, offset, (EDA_Colors) color,
DrawMode, fillmode, (EDA_Colors) anchor_color ); DrawMode, fillmode, (EDA_Colors) anchor_color );
......
...@@ -363,9 +363,10 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, ...@@ -363,9 +363,10 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( DC, draw_mode );
if( g_DesignSettings.IsElementVisible( ANCHOR_VISIBLE ) ) BOARD * brd = GetBoard( );
if( brd->IsElementVisible( ANCHOR_VISIBLE ) )
{ {
color = g_ColorsSettings.GetItemColor(ANCHOR_VISIBLE); color = brd->GetVisibleElementColor(ANCHOR_VISIBLE);
int anchor_size = screen->Unscale( 2 ); int anchor_size = screen->Unscale( 2 );
GRLine( &panel->m_ClipBox, DC, GRLine( &panel->m_ClipBox, DC,
pos.x - anchor_size, pos.y, pos.x - anchor_size, pos.y,
...@@ -375,27 +376,27 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, ...@@ -375,27 +376,27 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
pos.x, pos.y + anchor_size, 0, color ); pos.x, pos.y + anchor_size, 0, color );
} }
color = g_ColorsSettings.GetLayerColor(Module->GetLayer()); color = brd->GetLayerColor(Module->GetLayer());
if( Module->GetLayer() == LAYER_N_BACK ) if( Module->GetLayer() == LAYER_N_BACK )
{ {
if( g_DesignSettings.IsElementVisible( MOD_TEXT_BK_VISIBLE ) == false ) if( brd->IsElementVisible( MOD_TEXT_BK_VISIBLE ) == false )
return; return;
color = g_ColorsSettings.GetItemColor(MOD_TEXT_BK_VISIBLE); color = brd->GetVisibleElementColor(MOD_TEXT_BK_VISIBLE);
} }
else if( Module->GetLayer() == LAYER_N_FRONT ) else if( Module->GetLayer() == LAYER_N_FRONT )
{ {
if( g_DesignSettings.IsElementVisible( MOD_TEXT_FR_VISIBLE ) == false ) if( brd->IsElementVisible( MOD_TEXT_FR_VISIBLE ) == false )
return; return;
color = g_ColorsSettings.GetItemColor(MOD_TEXT_FR_VISIBLE); color = brd->GetVisibleElementColor(MOD_TEXT_FR_VISIBLE);
} }
if( m_NoShow ) if( m_NoShow )
{ {
if( g_DesignSettings.IsElementVisible( MOD_TEXT_INVISIBLE ) == false ) if( brd->IsElementVisible( MOD_TEXT_INVISIBLE ) == false )
return; return;
color = g_ColorsSettings.GetItemColor(MOD_TEXT_INVISIBLE); color = brd->GetVisibleElementColor(MOD_TEXT_INVISIBLE);
} }
/* If the text is mirrored : negate size.x (mirror / Y axis) */ /* If the text is mirrored : negate size.x (mirror / Y axis) */
......
...@@ -550,6 +550,7 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin ...@@ -550,6 +550,7 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
if( Type() == TYPE_ZONE && DisplayOpt.DisplayZonesMode != 0 ) if( Type() == TYPE_ZONE && DisplayOpt.DisplayZonesMode != 0 )
return; return;
BOARD * brd = GetBoard( );
if( m_Flags & DRAW_ERASED ) // draw in background color, used by classs TRACK in gerbview if( m_Flags & DRAW_ERASED ) // draw in background color, used by classs TRACK in gerbview
{ {
color = g_DrawBgColor; color = g_DrawBgColor;
...@@ -558,9 +559,9 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin ...@@ -558,9 +559,9 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
} }
else else
{ {
color = g_ColorsSettings.GetLayerColor(m_Layer); color = brd->GetLayerColor(m_Layer);
if( g_DesignSettings.IsLayerVisible( m_Layer ) == false && ( color & HIGHT_LIGHT_FLAG ) != if( brd->IsLayerVisible( m_Layer ) == false && ( color & HIGHT_LIGHT_FLAG ) !=
HIGHT_LIGHT_FLAG ) HIGHT_LIGHT_FLAG )
return; return;
...@@ -724,9 +725,10 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi ...@@ -724,9 +725,10 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( DC, draw_mode );
color = g_ColorsSettings.GetItemColor(VIAS_VISIBLE + m_Shape); BOARD * brd = GetBoard( );
color = brd->GetVisibleElementColor(VIAS_VISIBLE + m_Shape);
if( g_DesignSettings.IsElementVisible( PCB_VISIBLE(VIAS_VISIBLE + m_Shape) ) == false if( brd->IsElementVisible( PCB_VISIBLE(VIAS_VISIBLE + m_Shape) ) == false
&& ( color & HIGHT_LIGHT_FLAG ) != HIGHT_LIGHT_FLAG ) && ( color & HIGHT_LIGHT_FLAG ) != HIGHT_LIGHT_FLAG )
return; return;
...@@ -864,15 +866,15 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi ...@@ -864,15 +866,15 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
( (SEGVIA*) this )->ReturnLayerPair( &layer_top, &layer_bottom ); ( (SEGVIA*) this )->ReturnLayerPair( &layer_top, &layer_bottom );
/* lines for the top layer */ /* lines for the top layer */
RotatePoint( &ax, &ay, layer_top * 3600 / g_DesignSettings.GetCopperLayerCount( ) ); RotatePoint( &ax, &ay, layer_top * 3600 / brd->GetCopperLayerCount( ) );
RotatePoint( &bx, &by, layer_top * 3600 / g_DesignSettings.GetCopperLayerCount( ) ); RotatePoint( &bx, &by, layer_top * 3600 / brd->GetCopperLayerCount( ) );
GRLine( &panel->m_ClipBox, DC, m_Start.x - ax, m_Start.y - ay, GRLine( &panel->m_ClipBox, DC, m_Start.x - ax, m_Start.y - ay,
m_Start.x - bx, m_Start.y - by, 0, color ); m_Start.x - bx, m_Start.y - by, 0, color );
/* lines for the bottom layer */ /* lines for the bottom layer */
ax = 0; ay = rayon; bx = 0; by = drill_rayon; ax = 0; ay = rayon; bx = 0; by = drill_rayon;
RotatePoint( &ax, &ay, layer_bottom * 3600 / g_DesignSettings.GetCopperLayerCount( ) ); RotatePoint( &ax, &ay, layer_bottom * 3600 / brd->GetCopperLayerCount( ) );
RotatePoint( &bx, &by, layer_bottom * 3600 / g_DesignSettings.GetCopperLayerCount( ) ); RotatePoint( &bx, &by, layer_bottom * 3600 / brd->GetCopperLayerCount( ) );
GRLine( &panel->m_ClipBox, DC, m_Start.x - ax, m_Start.y - ay, GRLine( &panel->m_ClipBox, DC, m_Start.x - ax, m_Start.y - ay,
m_Start.x - bx, m_Start.y - by, 0, color ); m_Start.x - bx, m_Start.y - by, 0, color );
} }
......
...@@ -444,9 +444,11 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, con ...@@ -444,9 +444,11 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, con
wxPoint seg_start, seg_end; wxPoint seg_start, seg_end;
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
int color = g_ColorsSettings.GetLayerColor(m_Layer);
if( g_DesignSettings.IsLayerVisible( m_Layer ) == false && BOARD * brd = GetBoard( );
int color = brd->GetLayerColor(m_Layer);
if( brd->IsLayerVisible( m_Layer ) == false &&
( color & HIGHT_LIGHT_FLAG ) != HIGHT_LIGHT_FLAG ) ( color & HIGHT_LIGHT_FLAG ) != HIGHT_LIGHT_FLAG )
return; return;
...@@ -532,10 +534,11 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel, ...@@ -532,10 +534,11 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
if( m_FilledPolysList.size() == 0 ) // Nothing to draw if( m_FilledPolysList.size() == 0 ) // Nothing to draw
return; return;
BOARD * brd = GetBoard( );
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
int color = g_ColorsSettings.GetLayerColor(m_Layer); int color = brd->GetLayerColor(m_Layer);
if( g_DesignSettings.IsLayerVisible( m_Layer ) == false && ( color & HIGHT_LIGHT_FLAG ) != HIGHT_LIGHT_FLAG ) if( brd->IsLayerVisible( m_Layer ) == false && ( color & HIGHT_LIGHT_FLAG ) != HIGHT_LIGHT_FLAG )
return; return;
GRSetDrawMode( DC, aDrawMode ); GRSetDrawMode( DC, aDrawMode );
...@@ -687,7 +690,8 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -687,7 +690,8 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC,
if( DC == NULL ) if( DC == NULL )
return; return;
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
int color = g_ColorsSettings.GetLayerColor(m_Layer) & MASKCOLOR; BOARD * brd = GetBoard( );
int color = brd->GetLayerColor(m_Layer) & MASKCOLOR;
if( DisplayOpt.ContrastModeDisplay ) if( DisplayOpt.ContrastModeDisplay )
{ {
......
...@@ -109,30 +109,6 @@ int PCB_SCREEN::GetInternalUnits( void ) ...@@ -109,30 +109,6 @@ int PCB_SCREEN::GetInternalUnits( void )
} }
/* Return true if a microvia can be put on board
* A microvia ia a small via restricted to 2 near neighbour layers
* because its is hole is made by laser which can penetrate only one layer
* It is mainly used to connect BGA to the first inner layer
* And it is allowed from an external layer to the first inner layer
*/
bool PCB_SCREEN::IsMicroViaAcceptable( void )
{
int copperlayercnt = g_DesignSettings.GetCopperLayerCount( );
if( !g_DesignSettings.m_MicroViasAllowed )
return false; // Obvious..
if( copperlayercnt < 4 )
return false; // Only on multilayer boards..
if( ( m_Active_Layer == LAYER_N_BACK )
|| ( m_Active_Layer == LAYER_N_FRONT )
|| ( m_Active_Layer == g_DesignSettings.GetCopperLayerCount( ) - 2 )
|| ( m_Active_Layer == LAYER_N_2 ) )
return true;
return false;
}
/*************************/ /*************************/
/* class DISPLAY_OPTIONS */ /* class DISPLAY_OPTIONS */
/*************************/ /*************************/
......
...@@ -356,7 +356,7 @@ public: ...@@ -356,7 +356,7 @@ public:
* Constructor GENERAL_COLLECTORS_GUIDE * Constructor GENERAL_COLLECTORS_GUIDE
* grabs stuff from global preferences and uses reasonable defaults. * grabs stuff from global preferences and uses reasonable defaults.
* Add more constructors as needed. * Add more constructors as needed.
* @param settings The EDA_BoardDesignSettings to reference. * @param settings The BOARD_DESIGN_SETTINGS to reference.
*/ */
GENERAL_COLLECTORS_GUIDE( int aVisibleLayerMask, int aPreferredLayer ) GENERAL_COLLECTORS_GUIDE( int aVisibleLayerMask, int aPreferredLayer )
{ {
......
...@@ -156,15 +156,15 @@ void DIALOG_DESIGN_RULES::PrintCurrentSettings( ) ...@@ -156,15 +156,15 @@ void DIALOG_DESIGN_RULES::PrintCurrentSettings( )
m_MessagesList->AppendToPage(_("<b>Current general settings:</b><br>") ); m_MessagesList->AppendToPage(_("<b>Current general settings:</b><br>") );
// Display min values: // Display min values:
value = ReturnStringFromValue( g_UnitMetric, g_DesignSettings.m_TrackMinWidth, internal_units, true ); value = ReturnStringFromValue( g_UnitMetric, m_BrdSettings->m_TrackMinWidth, internal_units, true );
msg.Printf(_("Minimum value for tracks width: <b>%s</b><br>\n"), GetChars( value ) ); msg.Printf(_("Minimum value for tracks width: <b>%s</b><br>\n"), GetChars( value ) );
m_MessagesList->AppendToPage(msg); m_MessagesList->AppendToPage(msg);
value = ReturnStringFromValue( g_UnitMetric, g_DesignSettings.m_ViasMinSize, internal_units, true ); value = ReturnStringFromValue( g_UnitMetric, m_BrdSettings->m_ViasMinSize, internal_units, true );
msg.Printf(_("Minimum value for vias diameter: <b>%s</b><br>\n"), GetChars( value ) ); msg.Printf(_("Minimum value for vias diameter: <b>%s</b><br>\n"), GetChars( value ) );
m_MessagesList->AppendToPage(msg); m_MessagesList->AppendToPage(msg);
value = ReturnStringFromValue( g_UnitMetric, g_DesignSettings.m_MicroViasMinSize, internal_units, true ); value = ReturnStringFromValue( g_UnitMetric, m_BrdSettings->m_MicroViasMinSize, internal_units, true );
msg.Printf(_("Minimum value for microvias diameter: <b>%s</b><br>\n"), GetChars( value ) ); msg.Printf(_("Minimum value for microvias diameter: <b>%s</b><br>\n"), GetChars( value ) );
m_MessagesList->AppendToPage(msg); m_MessagesList->AppendToPage(msg);
...@@ -178,8 +178,8 @@ void DIALOG_DESIGN_RULES::InitDialogRules() ...@@ -178,8 +178,8 @@ void DIALOG_DESIGN_RULES::InitDialogRules()
SetFocus(); SetFocus();
SetReturnCode( 0 ); SetReturnCode( 0 );
// Initialize the layers grid:
m_Pcb = m_Parent->GetBoard(); m_Pcb = m_Parent->GetBoard();
m_BrdSettings = m_Pcb->GetBoardDesignSettings();
// Initialize the Rules List // Initialize the Rules List
InitRulesList(); InitRulesList();
...@@ -229,17 +229,17 @@ void DIALOG_DESIGN_RULES::InitGlobalRules() ...@@ -229,17 +229,17 @@ void DIALOG_DESIGN_RULES::InitGlobalRules()
AddUnitSymbol( *m_TrackMinWidthTitle ); AddUnitSymbol( *m_TrackMinWidthTitle );
int Internal_Unit = m_Parent->m_InternalUnits; int Internal_Unit = m_Parent->m_InternalUnits;
PutValueInLocalUnits( *m_SetViasMinSizeCtrl, g_DesignSettings.m_ViasMinSize, Internal_Unit ); PutValueInLocalUnits( *m_SetViasMinSizeCtrl, m_BrdSettings->m_ViasMinSize, Internal_Unit );
PutValueInLocalUnits( *m_SetViasMinDrillCtrl, g_DesignSettings.m_ViasMinDrill, Internal_Unit ); PutValueInLocalUnits( *m_SetViasMinDrillCtrl, m_BrdSettings->m_ViasMinDrill, Internal_Unit );
if( g_DesignSettings.m_CurrentViaType != VIA_THROUGH ) if( m_BrdSettings->m_CurrentViaType != VIA_THROUGH )
m_OptViaType->SetSelection( 1 ); m_OptViaType->SetSelection( 1 );
m_AllowMicroViaCtrl->SetSelection( g_DesignSettings.m_MicroViasAllowed ? 1 : 0); m_AllowMicroViaCtrl->SetSelection( m_BrdSettings->m_MicroViasAllowed ? 1 : 0);
PutValueInLocalUnits( *m_SetMicroViasMinSizeCtrl, g_DesignSettings.m_MicroViasMinSize, Internal_Unit ); PutValueInLocalUnits( *m_SetMicroViasMinSizeCtrl, m_BrdSettings->m_MicroViasMinSize, Internal_Unit );
PutValueInLocalUnits( *m_SetMicroViasMinDrillCtrl, g_DesignSettings.m_MicroViasMinDrill, Internal_Unit ); PutValueInLocalUnits( *m_SetMicroViasMinDrillCtrl, m_BrdSettings->m_MicroViasMinDrill, Internal_Unit );
PutValueInLocalUnits( *m_SetTrackMinWidthCtrl, g_DesignSettings.m_TrackMinWidth, Internal_Unit ); PutValueInLocalUnits( *m_SetTrackMinWidthCtrl, m_BrdSettings->m_TrackMinWidth, Internal_Unit );
// Initialize Vias and Tracks sizes lists. // Initialize Vias and Tracks sizes lists.
// note we display only extra values, never the current netclass value. // note we display only extra values, never the current netclass value.
...@@ -529,26 +529,26 @@ void DIALOG_DESIGN_RULES::CopyRulesListToBoard() ...@@ -529,26 +529,26 @@ void DIALOG_DESIGN_RULES::CopyRulesListToBoard()
void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard() void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard()
/*************************************************/ /*************************************************/
{ {
g_DesignSettings.m_CurrentViaType = VIA_THROUGH; m_BrdSettings->m_CurrentViaType = VIA_THROUGH;
if( m_OptViaType->GetSelection() > 0 ) if( m_OptViaType->GetSelection() > 0 )
g_DesignSettings.m_CurrentViaType = VIA_BLIND_BURIED; m_BrdSettings->m_CurrentViaType = VIA_BLIND_BURIED;
// Update vias minimum values for DRC // Update vias minimum values for DRC
g_DesignSettings.m_ViasMinSize = m_BrdSettings->m_ViasMinSize =
ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl, m_Parent->m_InternalUnits );
g_DesignSettings.m_ViasMinDrill = m_BrdSettings->m_ViasMinDrill =
ReturnValueFromTextCtrl( *m_SetViasMinDrillCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetViasMinDrillCtrl, m_Parent->m_InternalUnits );
g_DesignSettings.m_MicroViasAllowed = m_AllowMicroViaCtrl->GetSelection() == 1; m_BrdSettings->m_MicroViasAllowed = m_AllowMicroViaCtrl->GetSelection() == 1;
// Update microvias minimum values for DRC // Update microvias minimum values for DRC
g_DesignSettings.m_MicroViasMinSize = m_BrdSettings->m_MicroViasMinSize =
ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl, m_Parent->m_InternalUnits );
g_DesignSettings.m_MicroViasMinDrill = m_BrdSettings->m_MicroViasMinDrill =
ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl, m_Parent->m_InternalUnits );
// Update tracks minimum values for DRC // Update tracks minimum values for DRC
g_DesignSettings.m_TrackMinWidth = m_BrdSettings->m_TrackMinWidth =
ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits );
} }
......
...@@ -33,6 +33,7 @@ private: ...@@ -33,6 +33,7 @@ private:
WinEDA_PcbFrame* m_Parent; WinEDA_PcbFrame* m_Parent;
BOARD* m_Pcb; BOARD* m_Pcb;
BOARD_DESIGN_SETTINGS* m_BrdSettings;
static int s_LastTabSelection; ///< which tab user had open last static int s_LastTabSelection; ///< which tab user had open last
......
...@@ -28,6 +28,7 @@ DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, WinEDA_PcbFrame* parent ) ...@@ -28,6 +28,7 @@ DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, WinEDA_PcbFrame* parent )
{ {
m_tester = aTester; m_tester = aTester;
m_Parent = parent; m_Parent = parent;
m_BrdSettings = m_Parent->GetBoard()->GetBoardDesignSettings();
InitValues(); InitValues();
if( GetSizer() ) if( GetSizer() )
...@@ -118,11 +119,11 @@ void DIALOG_DRC_CONTROL::InitValues() ...@@ -118,11 +119,11 @@ void DIALOG_DRC_CONTROL::InitValues()
*/ */
void DIALOG_DRC_CONTROL::SetDrcParmeters( ) void DIALOG_DRC_CONTROL::SetDrcParmeters( )
{ {
g_DesignSettings.m_TrackMinWidth = m_BrdSettings->m_TrackMinWidth =
ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits );
g_DesignSettings.m_ViasMinSize = m_BrdSettings->m_ViasMinSize =
ReturnValueFromTextCtrl( *m_SetViaMinSizeCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetViaMinSizeCtrl, m_Parent->m_InternalUnits );
g_DesignSettings.m_MicroViasMinSize = m_BrdSettings->m_MicroViasMinSize =
ReturnValueFromTextCtrl( *m_SetMicroViakMinSizeCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetMicroViakMinSizeCtrl, m_Parent->m_InternalUnits );
} }
......
...@@ -38,6 +38,8 @@ class DRCLISTBOX; ...@@ -38,6 +38,8 @@ class DRCLISTBOX;
class DIALOG_DRC_CONTROL: public DIALOG_DRC_CONTROL_BASE class DIALOG_DRC_CONTROL: public DIALOG_DRC_CONTROL_BASE
{ {
public: public:
BOARD_DESIGN_SETTINGS* m_BrdSettings;
/// Constructors /// Constructors
DIALOG_DRC_CONTROL( DRC* aTester, WinEDA_PcbFrame* parent ); DIALOG_DRC_CONTROL( DRC* aTester, WinEDA_PcbFrame* parent );
~DIALOG_DRC_CONTROL(){}; ~DIALOG_DRC_CONTROL(){};
......
...@@ -119,12 +119,12 @@ void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties() ...@@ -119,12 +119,12 @@ void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties()
if( m_CurrentModule->m_LocalSolderPasteMargin == 0 ) if( m_CurrentModule->m_LocalSolderPasteMargin == 0 )
m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) + m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) +
m_SolderPasteMarginCtrl->GetValue() ); m_SolderPasteMarginCtrl->GetValue() );
if( m_CurrentModule->m_LocalSolderPasteMarginRatio == 0.0 )
msg.Printf( wxT( "-%.1f" ),
m_CurrentModule->m_LocalSolderPasteMarginRatio * 100.0 );
else
msg.Printf( wxT( "%.1f" ), msg.Printf( wxT( "%.1f" ),
m_CurrentModule->m_LocalSolderPasteMarginRatio * 100.0 ); m_CurrentModule->m_LocalSolderPasteMarginRatio * 100.0 );
if( m_CurrentModule->m_LocalSolderPasteMarginRatio == 0.0 &&
msg[0] == '0') // Sometimes Printf add a sign if the value is small
m_SolderPasteMarginRatioCtrl->SetValue( wxT("-") + msg );
else
m_SolderPasteMarginRatioCtrl->SetValue( msg ); m_SolderPasteMarginRatioCtrl->SetValue( msg );
} }
...@@ -460,14 +460,15 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event ) ...@@ -460,14 +460,15 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
m_CurrentModule->m_LocalSolderPasteMargin = m_CurrentModule->m_LocalSolderPasteMargin =
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
double dtmp; double dtmp = 0.0;
msg = m_SolderPasteMarginRatioCtrl->GetValue(); msg = m_SolderPasteMarginRatioCtrl->GetValue();
msg.ToDouble( &dtmp ); msg.ToDouble( &dtmp );
// A margin ratio de -50% means no paste on a pad, the ratio must be >= 50 // A margin ratio de -50% means no paste on a pad, the ratio must be >= 50%
// %
if( dtmp < -50 ) if( dtmp < -50 )
dtmp = -50; dtmp = -50;
if( dtmp > +100 )
dtmp = +100;
m_CurrentModule->m_LocalSolderPasteMarginRatio = dtmp / 100; m_CurrentModule->m_LocalSolderPasteMarginRatio = dtmp / 100;
// Set Module Position // Set Module Position
......
...@@ -29,6 +29,7 @@ private: ...@@ -29,6 +29,7 @@ private:
WinEDA_PcbFrame* m_Parent; WinEDA_PcbFrame* m_Parent;
wxDC* m_DC; wxDC* m_DC;
DRAWSEGMENT* m_Item; DRAWSEGMENT* m_Item;
BOARD_DESIGN_SETTINGS* m_BrdSettings;
public: public:
DialogGraphicItemProperties( WinEDA_PcbFrame* aParent, DRAWSEGMENT * aItem, wxDC * aDC); DialogGraphicItemProperties( WinEDA_PcbFrame* aParent, DRAWSEGMENT * aItem, wxDC * aDC);
...@@ -47,6 +48,7 @@ DialogGraphicItemProperties::DialogGraphicItemProperties( WinEDA_PcbFrame* aPare ...@@ -47,6 +48,7 @@ DialogGraphicItemProperties::DialogGraphicItemProperties( WinEDA_PcbFrame* aPare
m_Parent = aParent; m_Parent = aParent;
m_DC = aDC; m_DC = aDC;
m_Item = aItem; m_Item = aItem;
m_BrdSettings = m_Parent->GetBoard()->GetBoardDesignSettings();
Init(); Init();
Layout(); Layout();
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
...@@ -130,9 +132,9 @@ void DialogGraphicItemProperties::Init( ) ...@@ -130,9 +132,9 @@ void DialogGraphicItemProperties::Init( )
AddUnitSymbol( *m_DefaultThicknessText ); AddUnitSymbol( *m_DefaultThicknessText );
int thickness; int thickness;
if( m_Item->GetLayer() == EDGE_N ) if( m_Item->GetLayer() == EDGE_N )
thickness = g_DesignSettings.m_EdgeSegmentWidth; thickness = m_BrdSettings->m_EdgeSegmentWidth;
else else
thickness = g_DesignSettings.m_DrawSegmentWidth; thickness = m_BrdSettings->m_DrawSegmentWidth;
PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness, PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
...@@ -159,9 +161,9 @@ void DialogGraphicItemProperties::OnLayerChoice( wxCommandEvent& event ) ...@@ -159,9 +161,9 @@ void DialogGraphicItemProperties::OnLayerChoice( wxCommandEvent& event )
{ {
int thickness; int thickness;
if( (m_LayerSelection->GetCurrentSelection() + FIRST_NO_COPPER_LAYER) == EDGE_N ) if( (m_LayerSelection->GetCurrentSelection() + FIRST_NO_COPPER_LAYER) == EDGE_N )
thickness = g_DesignSettings.m_EdgeSegmentWidth; thickness = m_BrdSettings->m_EdgeSegmentWidth;
else else
thickness = g_DesignSettings.m_DrawSegmentWidth; thickness = m_BrdSettings->m_DrawSegmentWidth;
PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness, PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
} }
...@@ -205,9 +207,9 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event ) ...@@ -205,9 +207,9 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event )
m_Item->SetLayer( m_LayerSelection->GetCurrentSelection() + FIRST_NO_COPPER_LAYER); m_Item->SetLayer( m_LayerSelection->GetCurrentSelection() + FIRST_NO_COPPER_LAYER);
if( m_Item->GetLayer() == EDGE_N ) if( m_Item->GetLayer() == EDGE_N )
g_DesignSettings.m_EdgeSegmentWidth = thickness; m_BrdSettings->m_EdgeSegmentWidth = thickness;
else else
g_DesignSettings.m_DrawSegmentWidth = thickness; m_BrdSettings->m_DrawSegmentWidth = thickness;
if ( m_Item->m_Shape == S_ARC ) if ( m_Item->m_Shape == S_ARC )
{ {
......
...@@ -25,26 +25,26 @@ void WinEDA_GraphicItemsOptionsDialog::SetDisplayValue() ...@@ -25,26 +25,26 @@ void WinEDA_GraphicItemsOptionsDialog::SetDisplayValue()
/* Drawings width */ /* Drawings width */
AddUnitSymbol( *m_GraphicSegmWidthTitle ); AddUnitSymbol( *m_GraphicSegmWidthTitle );
PutValueInLocalUnits( *m_OptPcbSegmWidth, PutValueInLocalUnits( *m_OptPcbSegmWidth,
g_DesignSettings.m_DrawSegmentWidth, m_BrdSettings->m_DrawSegmentWidth,
PCB_INTERNAL_UNIT ); PCB_INTERNAL_UNIT );
/* Edges width */ /* Edges width */
AddUnitSymbol( *m_BoardEdgesWidthTitle ); AddUnitSymbol( *m_BoardEdgesWidthTitle );
PutValueInLocalUnits( *m_OptPcbEdgesWidth, PutValueInLocalUnits( *m_OptPcbEdgesWidth,
g_DesignSettings.m_EdgeSegmentWidth, m_BrdSettings->m_EdgeSegmentWidth,
PCB_INTERNAL_UNIT ); PCB_INTERNAL_UNIT );
/* Pcb Textes (Size & Width) */ /* Pcb Textes (Size & Width) */
AddUnitSymbol( *m_CopperTextWidthTitle ); AddUnitSymbol( *m_CopperTextWidthTitle );
PutValueInLocalUnits( *m_OptPcbTextWidth, PutValueInLocalUnits( *m_OptPcbTextWidth,
g_DesignSettings.m_PcbTextWidth, PCB_INTERNAL_UNIT ); m_BrdSettings->m_PcbTextWidth, PCB_INTERNAL_UNIT );
AddUnitSymbol( *m_TextSizeVTitle ); AddUnitSymbol( *m_TextSizeVTitle );
PutValueInLocalUnits( *m_OptPcbTextVSize, PutValueInLocalUnits( *m_OptPcbTextVSize,
g_DesignSettings.m_PcbTextSize.y, PCB_INTERNAL_UNIT ); m_BrdSettings->m_PcbTextSize.y, PCB_INTERNAL_UNIT );
AddUnitSymbol( *m_TextSizeHTitle ); AddUnitSymbol( *m_TextSizeHTitle );
PutValueInLocalUnits( *m_OptPcbTextHSize, PutValueInLocalUnits( *m_OptPcbTextHSize,
g_DesignSettings.m_PcbTextSize.x, PCB_INTERNAL_UNIT ); m_BrdSettings->m_PcbTextSize.x, PCB_INTERNAL_UNIT );
/* Modules: Edges width */ /* Modules: Edges width */
...@@ -69,15 +69,15 @@ void WinEDA_GraphicItemsOptionsDialog::SetDisplayValue() ...@@ -69,15 +69,15 @@ void WinEDA_GraphicItemsOptionsDialog::SetDisplayValue()
void WinEDA_GraphicItemsOptionsDialog::AcceptOptions( wxCommandEvent& event ) void WinEDA_GraphicItemsOptionsDialog::AcceptOptions( wxCommandEvent& event )
{ {
g_DesignSettings.m_DrawSegmentWidth = m_BrdSettings->m_DrawSegmentWidth =
ReturnValueFromTextCtrl( *m_OptPcbSegmWidth, PCB_INTERNAL_UNIT ); ReturnValueFromTextCtrl( *m_OptPcbSegmWidth, PCB_INTERNAL_UNIT );
g_DesignSettings.m_EdgeSegmentWidth = m_BrdSettings->m_EdgeSegmentWidth =
ReturnValueFromTextCtrl( *m_OptPcbEdgesWidth, PCB_INTERNAL_UNIT ); ReturnValueFromTextCtrl( *m_OptPcbEdgesWidth, PCB_INTERNAL_UNIT );
g_DesignSettings.m_PcbTextWidth = m_BrdSettings->m_PcbTextWidth =
ReturnValueFromTextCtrl( *m_OptPcbTextWidth, PCB_INTERNAL_UNIT ); ReturnValueFromTextCtrl( *m_OptPcbTextWidth, PCB_INTERNAL_UNIT );
g_DesignSettings.m_PcbTextSize.y = m_BrdSettings->m_PcbTextSize.y =
ReturnValueFromTextCtrl( *m_OptPcbTextVSize, PCB_INTERNAL_UNIT ); ReturnValueFromTextCtrl( *m_OptPcbTextVSize, PCB_INTERNAL_UNIT );
g_DesignSettings.m_PcbTextSize.x = m_BrdSettings->m_PcbTextSize.x =
ReturnValueFromTextCtrl( *m_OptPcbTextHSize, PCB_INTERNAL_UNIT ); ReturnValueFromTextCtrl( *m_OptPcbTextHSize, PCB_INTERNAL_UNIT );
ModuleSegmentWidth = ModuleSegmentWidth =
...@@ -119,6 +119,7 @@ END_EVENT_TABLE() ...@@ -119,6 +119,7 @@ END_EVENT_TABLE()
WinEDA_GraphicItemsOptionsDialog::WinEDA_GraphicItemsOptionsDialog() WinEDA_GraphicItemsOptionsDialog::WinEDA_GraphicItemsOptionsDialog()
{ {
m_BrdSettings = m_Parent->GetBoard()->GetBoardDesignSettings();
} }
......
...@@ -68,6 +68,8 @@ class WinEDA_GraphicItemsOptionsDialog: public wxDialog ...@@ -68,6 +68,8 @@ class WinEDA_GraphicItemsOptionsDialog: public wxDialog
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
public: public:
BOARD_DESIGN_SETTINGS* m_BrdSettings;
/// Constructors /// Constructors
WinEDA_GraphicItemsOptionsDialog( ); WinEDA_GraphicItemsOptionsDialog( );
WinEDA_GraphicItemsOptionsDialog( WinEDA_BasePcbFrame* parent, wxWindowID id = SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_IDNAME, const wxString& caption = SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_TITLE, const wxPoint& pos = SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_POSITION, const wxSize& size = SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_SIZE, long style = SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_STYLE ); WinEDA_GraphicItemsOptionsDialog( WinEDA_BasePcbFrame* parent, wxWindowID id = SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_IDNAME, const wxString& caption = SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_TITLE, const wxPoint& pos = SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_POSITION, const wxSize& size = SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_SIZE, long style = SYMBOL_WINEDA_GRAPHICITEMSOPTIONSDIALOG_STYLE );
......
...@@ -26,6 +26,8 @@ DIALOG_PADS_MASK_CLEARANCE::DIALOG_PADS_MASK_CLEARANCE( WinEDA_PcbFrame* parent ...@@ -26,6 +26,8 @@ DIALOG_PADS_MASK_CLEARANCE::DIALOG_PADS_MASK_CLEARANCE( WinEDA_PcbFrame* parent
DIALOG_PADS_MASK_CLEARANCE_BASE( parent ) DIALOG_PADS_MASK_CLEARANCE_BASE( parent )
{ {
m_Parent = parent; m_Parent = parent;
m_BrdSettings = m_Parent->GetBoard()->GetBoardDesignSettings();
MyInit(); MyInit();
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
Centre(); Centre();
...@@ -41,22 +43,23 @@ void DIALOG_PADS_MASK_CLEARANCE::MyInit() ...@@ -41,22 +43,23 @@ void DIALOG_PADS_MASK_CLEARANCE::MyInit()
int Internal_Unit = m_Parent->m_InternalUnits; int Internal_Unit = m_Parent->m_InternalUnits;
PutValueInLocalUnits( *m_SolderMaskMarginCtrl, PutValueInLocalUnits( *m_SolderMaskMarginCtrl,
g_DesignSettings.m_SolderMaskMargin, m_BrdSettings->m_SolderMaskMargin,
Internal_Unit ); Internal_Unit );
// These 2 parameters are usually < 0, so prepare entering a negative // These 2 parameters are usually < 0, so prepare entering a negative
// value, if current is 0 // value, if current is 0
PutValueInLocalUnits( *m_SolderPasteMarginCtrl, PutValueInLocalUnits( *m_SolderPasteMarginCtrl,
g_DesignSettings.m_SolderPasteMargin, m_BrdSettings->m_SolderPasteMargin,
Internal_Unit ); Internal_Unit );
if( g_DesignSettings.m_SolderPasteMargin == 0 ) if( m_BrdSettings->m_SolderPasteMargin == 0 )
m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) + m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) +
m_SolderPasteMarginCtrl->GetValue() ); m_SolderPasteMarginCtrl->GetValue() );
wxString msg; wxString msg;
if( g_DesignSettings.m_SolderPasteMarginRatio == 0 ) msg.Printf( wxT( "%f" ), m_BrdSettings->m_SolderPasteMarginRatio * 100.0 );
msg.Printf( wxT( "-%f" ), g_DesignSettings.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 else
msg.Printf( wxT( "%f" ), g_DesignSettings.m_SolderPasteMarginRatio * 100.0 );
m_SolderPasteMarginRatioCtrl->SetValue( msg ); m_SolderPasteMarginRatioCtrl->SetValue( msg );
} }
...@@ -65,18 +68,20 @@ void DIALOG_PADS_MASK_CLEARANCE::MyInit() ...@@ -65,18 +68,20 @@ void DIALOG_PADS_MASK_CLEARANCE::MyInit()
void DIALOG_PADS_MASK_CLEARANCE::OnButtonOkClick( wxCommandEvent& event ) void DIALOG_PADS_MASK_CLEARANCE::OnButtonOkClick( wxCommandEvent& event )
/*******************************************************************/ /*******************************************************************/
{ {
g_DesignSettings.m_SolderMaskMargin = m_BrdSettings->m_SolderMaskMargin =
ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->m_InternalUnits );
g_DesignSettings.m_SolderPasteMargin = m_BrdSettings->m_SolderPasteMargin =
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->m_InternalUnits );
double dtmp; double dtmp = 0;
wxString msg = m_SolderPasteMarginRatioCtrl->GetValue(); wxString msg = m_SolderPasteMarginRatioCtrl->GetValue();
msg.ToDouble( &dtmp ); msg.ToDouble( &dtmp );
// A margin ratio de -50% means no paste on a pad, the ratio must be >= 50 % // A margin ratio de -50% means no paste on a pad, the ratio must be >= 50 %
if( dtmp < -50 ) if( dtmp < -50 )
dtmp = -50; dtmp = -50;
g_DesignSettings.m_SolderPasteMarginRatio = dtmp / 100; if( dtmp > +100 )
dtmp = +100;
m_BrdSettings->m_SolderPasteMarginRatio = dtmp / 100;
EndModal( 1 ); EndModal( 1 );
} }
......
...@@ -20,6 +20,7 @@ class DIALOG_PADS_MASK_CLEARANCE : public DIALOG_PADS_MASK_CLEARANCE_BASE ...@@ -20,6 +20,7 @@ class DIALOG_PADS_MASK_CLEARANCE : public DIALOG_PADS_MASK_CLEARANCE_BASE
{ {
private: private:
WinEDA_PcbFrame* m_Parent; WinEDA_PcbFrame* m_Parent;
BOARD_DESIGN_SETTINGS* m_BrdSettings;
public: public:
DIALOG_PADS_MASK_CLEARANCE( WinEDA_PcbFrame* parent ); DIALOG_PADS_MASK_CLEARANCE( WinEDA_PcbFrame* parent );
......
...@@ -159,10 +159,11 @@ void DIALOG_PAD_PROPERTIES::InitDialog( ) ...@@ -159,10 +159,11 @@ void DIALOG_PAD_PROPERTIES::InitDialog( )
PutValueInLocalUnits( *m_SolderPasteMarginCtrl, pad->m_LocalSolderPasteMargin, internalUnits ); PutValueInLocalUnits( *m_SolderPasteMarginCtrl, pad->m_LocalSolderPasteMargin, internalUnits );
if( pad->m_LocalSolderPasteMargin == 0 ) if( pad->m_LocalSolderPasteMargin == 0 )
m_SolderPasteMarginCtrl->SetValue( wxT("-") + m_SolderPasteMarginCtrl->GetValue() ); m_SolderPasteMarginCtrl->SetValue( wxT("-") + m_SolderPasteMarginCtrl->GetValue() );
if( pad->m_LocalSolderPasteMarginRatio == 0.0 )
msg.Printf( wxT( "-%.1f" ), pad->m_LocalSolderPasteMarginRatio * 100.0 );
else
msg.Printf( wxT( "%.1f" ), pad->m_LocalSolderPasteMarginRatio * 100.0 ); msg.Printf( wxT( "%.1f" ), pad->m_LocalSolderPasteMarginRatio * 100.0 );
if( pad->m_LocalSolderPasteMarginRatio == 0.0 &&
msg[0] == '0') // Sometimes Printf add a sign if the value is small
m_SolderPasteMarginRatioCtrl->SetValue( wxT("-") + msg );
else
m_SolderPasteMarginRatioCtrl->SetValue( msg ); m_SolderPasteMarginRatioCtrl->SetValue( msg );
if( m_CurrentPad ) if( m_CurrentPad )
...@@ -425,12 +426,14 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event ) ...@@ -425,12 +426,14 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
g_Pad_Master.m_LocalClearance = ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, internalUnits ); g_Pad_Master.m_LocalClearance = ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, internalUnits );
g_Pad_Master.m_LocalSolderMaskMargin = ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, internalUnits ); g_Pad_Master.m_LocalSolderMaskMargin = ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, internalUnits );
g_Pad_Master.m_LocalSolderPasteMargin = ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, internalUnits ); g_Pad_Master.m_LocalSolderPasteMargin = ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, internalUnits );
double dtmp; double dtmp = 0.0;
msg = m_SolderPasteMarginRatioCtrl->GetValue(); msg = m_SolderPasteMarginRatioCtrl->GetValue();
msg.ToDouble( &dtmp ); msg.ToDouble( &dtmp );
// A margin ratio de -50% means no paste on a pad, the ratio must be >= 50 % // A margin ratio de -50% means no paste on a pad, the ratio must be >= 50 %
if( dtmp < -50 ) if( dtmp < -50 )
dtmp = -50; dtmp = -50;
if( dtmp > +100 )
dtmp = +100;
g_Pad_Master.m_LocalSolderPasteMarginRatio = dtmp / 100; g_Pad_Master.m_LocalSolderPasteMarginRatio = dtmp / 100;
// Read pad position: // Read pad position:
......
...@@ -141,7 +141,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) ...@@ -141,7 +141,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
wxString layerKey; wxString layerKey;
for( layer = 0; layer < NB_LAYERS; ++layer ) for( layer = 0; layer < NB_LAYERS; ++layer )
{ {
if( !board->m_BoardSettings->IsLayerEnabled( layer ) ) if( !board->IsLayerEnabled( layer ) )
m_BoxSelectLayer[layer] = NULL; m_BoxSelectLayer[layer] = NULL;
else else
m_BoxSelectLayer[layer] = m_BoxSelectLayer[layer] =
......
...@@ -226,8 +226,8 @@ COTATION* WinEDA_PcbFrame::Begin_Cotation( COTATION* Cotation, wxDC* DC ) ...@@ -226,8 +226,8 @@ COTATION* WinEDA_PcbFrame::Begin_Cotation( COTATION* Cotation, wxDC* DC )
Cotation = new COTATION( GetBoard() ); Cotation = new COTATION( GetBoard() );
Cotation->m_Flags = IS_NEW; Cotation->m_Flags = IS_NEW;
Cotation->SetLayer( ((PCB_SCREEN*)GetScreen())->m_Active_Layer ); Cotation->SetLayer( getActiveLayer() );
Cotation->m_Width = g_DesignSettings.m_DrawSegmentWidth; Cotation->m_Width = GetBoard()->GetBoardDesignSettings()->m_DrawSegmentWidth;
Cotation->m_Text->m_Width = Cotation->m_Width; Cotation->m_Text->m_Width = Cotation->m_Width;
Cotation->Barre_ox = Cotation->Barre_fx = pos.x; Cotation->Barre_ox = Cotation->Barre_fx = pos.x;
...@@ -251,8 +251,8 @@ COTATION* WinEDA_PcbFrame::Begin_Cotation( COTATION* Cotation, wxDC* DC ) ...@@ -251,8 +251,8 @@ COTATION* WinEDA_PcbFrame::Begin_Cotation( COTATION* Cotation, wxDC* DC )
Cotation->FlecheD2_ox = Cotation->FlecheD2_fx = pos.x; Cotation->FlecheD2_ox = Cotation->FlecheD2_fx = pos.x;
Cotation->FlecheD2_oy = Cotation->FlecheD2_fy = pos.y; Cotation->FlecheD2_oy = Cotation->FlecheD2_fy = pos.y;
Cotation->m_Text->m_Size = g_DesignSettings.m_PcbTextSize; Cotation->m_Text->m_Size = GetBoard()->GetBoardDesignSettings()->m_PcbTextSize;
Cotation->m_Text->m_Width = g_DesignSettings.m_PcbTextWidth; Cotation->m_Text->m_Width = GetBoard()->GetBoardDesignSettings()->m_PcbTextWidth;
Ajuste_Details_Cotation( Cotation ); Ajuste_Details_Cotation( Cotation );
......
...@@ -63,11 +63,11 @@ void DRC::ShowDialog() ...@@ -63,11 +63,11 @@ void DRC::ShowDialog()
// copy data retained in this DRC object into the m_ui DrcPanel: // copy data retained in this DRC object into the m_ui DrcPanel:
PutValueInLocalUnits( *m_ui->m_SetTrackMinWidthCtrl, g_DesignSettings.m_TrackMinWidth, PutValueInLocalUnits( *m_ui->m_SetTrackMinWidthCtrl, m_pcb->GetBoardDesignSettings()->m_TrackMinWidth,
m_mainWindow->m_InternalUnits );; m_mainWindow->m_InternalUnits );;
PutValueInLocalUnits( *m_ui->m_SetViaMinSizeCtrl, g_DesignSettings.m_ViasMinSize, PutValueInLocalUnits( *m_ui->m_SetViaMinSizeCtrl, m_pcb->GetBoardDesignSettings()->m_ViasMinSize,
m_mainWindow->m_InternalUnits );; m_mainWindow->m_InternalUnits );;
PutValueInLocalUnits( *m_ui->m_SetMicroViakMinSizeCtrl, g_DesignSettings.m_MicroViasMinSize, PutValueInLocalUnits( *m_ui->m_SetMicroViakMinSizeCtrl, m_pcb->GetBoardDesignSettings()->m_MicroViasMinSize,
m_mainWindow->m_InternalUnits );; m_mainWindow->m_InternalUnits );;
m_ui->m_CreateRptCtrl->SetValue( m_doCreateRptFile ); m_ui->m_CreateRptCtrl->SetValue( m_doCreateRptFile );
...@@ -315,11 +315,11 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg ) ...@@ -315,11 +315,11 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
{ {
bool ret = true; bool ret = true;
const EDA_BoardDesignSettings& g = g_DesignSettings; const BOARD_DESIGN_SETTINGS& g = *m_pcb->GetBoardDesignSettings();
#define FmtVal( x ) GetChars( ReturnStringFromValue( g_UnitMetric, x, PCB_INTERNAL_UNIT ) ) #define FmtVal( x ) GetChars( ReturnStringFromValue( g_UnitMetric, x, PCB_INTERNAL_UNIT ) )
#if 0 // set to 1 when (if...) EDA_BoardDesignSettings has a m_MinClearance value #if 0 // set to 1 when (if...) BOARD_DESIGN_SETTINGS has a m_MinClearance value
if( nc->GetClearance() < g.m_MinClearance ) if( nc->GetClearance() < g.m_MinClearance )
{ {
msg.Printf( _("NETCLASS: '%s' has Clearance:%s which is less than global:%s"), msg.Printf( _("NETCLASS: '%s' has Clearance:%s which is less than global:%s"),
...@@ -772,7 +772,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) ...@@ -772,7 +772,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
// test: // test:
if( layer1 == LAYER_N_BACK && layer2 == LAYER_N_2 ) if( layer1 == LAYER_N_BACK && layer2 == LAYER_N_2 )
err = false; err = false;
if( layer1 == (g_DesignSettings.GetCopperLayerCount() - 2 ) && layer2 == LAYER_N_FRONT ) if( layer1 == (m_pcb->GetBoardDesignSettings()->GetCopperLayerCount() - 2 ) && layer2 == LAYER_N_FRONT )
err = false; err = false;
if( err ) if( err )
{ {
......
...@@ -64,10 +64,10 @@ ...@@ -64,10 +64,10 @@
#define DRCE_TOO_SMALL_TRACK_WIDTH 27 ///< Too small track width #define DRCE_TOO_SMALL_TRACK_WIDTH 27 ///< Too small track width
#define DRCE_TOO_SMALL_VIA 28 ///< Too small via size #define DRCE_TOO_SMALL_VIA 28 ///< Too small via size
#define DRCE_TOO_SMALL_MICROVIA 29 ///< Too small micro via size #define DRCE_TOO_SMALL_MICROVIA 29 ///< Too small micro via size
#define DRCE_NETCLASS_TRACKWIDTH 30 ///< netclass has TrackWidth < g_DesignSettings.m_TrackMinWidth #define DRCE_NETCLASS_TRACKWIDTH 30 ///< netclass has TrackWidth < board.m_designSettings->m_TrackMinWidth
#define DRCE_NETCLASS_CLEARANCE 31 ///< netclass has Clearance < g_DesignSettings.m_TrackClearance #define DRCE_NETCLASS_CLEARANCE 31 ///< netclass has Clearance < board.m_designSettings->m_TrackClearance
#define DRCE_NETCLASS_VIASIZE 32 ///< netclass has ViaSize < g_DesignSettings.m_ViasMinSize #define DRCE_NETCLASS_VIASIZE 32 ///< netclass has ViaSize < board.m_designSettings->m_ViasMinSize
#define DRCE_NETCLASS_VIADRILLSIZE 33 ///< netclass has ViaDrillSize < g_DesignSettings.m_ViaDrill #define DRCE_NETCLASS_VIADRILLSIZE 33 ///< netclass has ViaDrillSize < board.m_designSettings->m_ViaDrill
#define DRCE_NETCLASS_uVIASIZE 34 #define DRCE_NETCLASS_uVIASIZE 34
#define DRCE_NETCLASS_uVIADRILLSIZE 35 #define DRCE_NETCLASS_uVIADRILLSIZE 35
...@@ -229,7 +229,7 @@ private: ...@@ -229,7 +229,7 @@ private:
/** /**
* Function testNetClasses * Function testNetClasses
* goes through each NETCLASS and verifies that its clearance, via size, * goes through each NETCLASS and verifies that its clearance, via size,
* track width, and track clearance are larger than those in g_DesignSettings. * track width, and track clearance are larger than those in board.m_designSettings.
* This is necessary because the actual DRC checks are run against the NETCLASS * This is necessary because the actual DRC checks are run against the NETCLASS
* limits, so in order enforce global limits, we first check the NETCLASSes against * limits, so in order enforce global limits, we first check the NETCLASSes against
* the global limits. * the global limits.
......
...@@ -340,7 +340,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -340,7 +340,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_PLACE_MICROVIA: case ID_POPUP_PCB_PLACE_MICROVIA:
if( !( (PCB_SCREEN*) GetScreen() )->IsMicroViaAcceptable() ) if( !IsMicroViaAcceptable() )
break; break;
case ID_POPUP_PCB_PLACE_VIA: case ID_POPUP_PCB_PLACE_VIA:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
...@@ -350,11 +350,11 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -350,11 +350,11 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
} }
else else
{ {
int v_type = g_DesignSettings.m_CurrentViaType; int v_type = GetBoard()->GetBoardDesignSettings()->m_CurrentViaType;
if( id == ID_POPUP_PCB_PLACE_MICROVIA ) if( id == ID_POPUP_PCB_PLACE_MICROVIA )
g_DesignSettings.m_CurrentViaType = VIA_MICROVIA; // place micro via and switch layer GetBoard()->GetBoardDesignSettings()->m_CurrentViaType = VIA_MICROVIA; // place micro via and switch layer
Other_Layer_Route( (TRACK*) GetCurItem(), &dc ); Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
g_DesignSettings.m_CurrentViaType = v_type; GetBoard()->GetBoardDesignSettings()->m_CurrentViaType = v_type;
if( DisplayOpt.ContrastModeDisplay ) if( DisplayOpt.ContrastModeDisplay )
( (PCB_SCREEN*) GetScreen() )->SetRefreshReq(); ( (PCB_SCREEN*) GetScreen() )->SetRefreshReq();
} }
...@@ -1077,7 +1077,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer ) ...@@ -1077,7 +1077,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
// If only one copper layer is enabled, the only such layer // If only one copper layer is enabled, the only such layer
// that can be selected to is the "Back" layer (so the // that can be selected to is the "Back" layer (so the
// selection of any other copper layer is disregarded). // selection of any other copper layer is disregarded).
if( GetBoard()->m_BoardSettings->GetCopperLayerCount() < 2 ) if( GetBoard()->GetCopperLayerCount() < 2 )
{ {
if( layer != LAYER_N_BACK ) if( layer != LAYER_N_BACK )
{ {
...@@ -1096,7 +1096,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer ) ...@@ -1096,7 +1096,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
else else
{ {
if( ( layer != LAYER_N_BACK ) && ( layer != LAYER_N_FRONT ) if( ( layer != LAYER_N_BACK ) && ( layer != LAYER_N_FRONT )
&& ( layer >= GetBoard()->m_BoardSettings->GetCopperLayerCount() - 1 ) ) && ( layer >= GetBoard()->GetCopperLayerCount() - 1 ) )
{ {
// Uncomment following command (and line 17) to beep // Uncomment following command (and line 17) to beep
// the speaker. (Doing that would provide feedback to // the speaker. (Doing that would provide feedback to
......
...@@ -163,9 +163,9 @@ TEXTE_PCB* WinEDA_PcbFrame::Create_Texte_Pcb( wxDC* DC ) ...@@ -163,9 +163,9 @@ TEXTE_PCB* WinEDA_PcbFrame::Create_Texte_Pcb( wxDC* DC )
if( TextePcb->GetLayer() == LAYER_N_BACK ) if( TextePcb->GetLayer() == LAYER_N_BACK )
TextePcb->m_Mirror = true; TextePcb->m_Mirror = true;
TextePcb->m_Size = g_DesignSettings.m_PcbTextSize; TextePcb->m_Size = GetBoard()->GetBoardDesignSettings()->m_PcbTextSize;
TextePcb->m_Pos = GetScreen()->m_Curseur; TextePcb->m_Pos = GetScreen()->m_Curseur;
TextePcb->m_Width = g_DesignSettings.m_PcbTextWidth; TextePcb->m_Width = GetBoard()->GetBoardDesignSettings()->m_PcbTextWidth;
InstallTextPCBOptionsFrame( TextePcb, DC ); InstallTextPCBOptionsFrame( TextePcb, DC );
if( TextePcb->m_Text.IsEmpty() ) if( TextePcb->m_Text.IsEmpty() )
......
...@@ -205,10 +205,10 @@ DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment, ...@@ -205,10 +205,10 @@ DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment,
int angle = 0; int angle = 0;
DRAWSEGMENT* DrawItem; DRAWSEGMENT* DrawItem;
s_large = g_DesignSettings.m_DrawSegmentWidth; s_large = GetBoard()->GetBoardDesignSettings()->m_DrawSegmentWidth;
if( ((PCB_SCREEN*)GetScreen())->m_Active_Layer == EDGE_N ) if( getActiveLayer() == EDGE_N )
{ {
s_large = g_DesignSettings.m_EdgeSegmentWidth; s_large = GetBoard()->GetBoardDesignSettings()->m_EdgeSegmentWidth;
} }
if( shape == S_ARC ) if( shape == S_ARC )
...@@ -218,7 +218,7 @@ DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment, ...@@ -218,7 +218,7 @@ DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment,
{ {
SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) ); SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) );
Segment->m_Flags = IS_NEW; Segment->m_Flags = IS_NEW;
Segment->SetLayer( ((PCB_SCREEN*)GetScreen())->m_Active_Layer ); Segment->SetLayer( getActiveLayer() );
Segment->m_Width = s_large; Segment->m_Width = s_large;
Segment->m_Shape = shape; Segment->m_Shape = shape;
Segment->m_Angle = 900; Segment->m_Angle = 900;
......
...@@ -146,7 +146,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) ...@@ -146,7 +146,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
/* create the via */ /* create the via */
SEGVIA* via = new SEGVIA( GetBoard() ); SEGVIA* via = new SEGVIA( GetBoard() );
via->m_Flags = IS_NEW; via->m_Flags = IS_NEW;
via->m_Shape = g_DesignSettings.m_CurrentViaType; via->m_Shape = GetBoard()->GetBoardDesignSettings()->m_CurrentViaType;
via->m_Width = GetBoard()->GetCurrentViaSize(); via->m_Width = GetBoard()->GetCurrentViaSize();
via->SetNet( g_HighLight_NetCode ); via->SetNet( g_HighLight_NetCode );
via->m_Start = via->m_End = g_CurrentTrackSegment->m_End; via->m_Start = via->m_End = g_CurrentTrackSegment->m_End;
...@@ -172,7 +172,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) ...@@ -172,7 +172,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
case VIA_MICROVIA: // from external to the near neighbor inner layer case VIA_MICROVIA: // from external to the near neighbor inner layer
{ {
int last_inner_layer = GetBoard()->m_BoardSettings->GetCopperLayerCount() - 2; int last_inner_layer = GetBoard()->GetCopperLayerCount() - 2;
if ( first_layer == LAYER_N_BACK ) if ( first_layer == LAYER_N_BACK )
last_layer = LAYER_N_2; last_layer = LAYER_N_2;
else if ( first_layer == LAYER_N_FRONT ) else if ( first_layer == LAYER_N_FRONT )
...@@ -271,7 +271,7 @@ void WinEDA_PcbFrame::Affiche_Status_Net( wxDC* DC ) ...@@ -271,7 +271,7 @@ void WinEDA_PcbFrame::Affiche_Status_Net( wxDC* DC )
TRACK* pt_segm; TRACK* pt_segm;
int masquelayer = (1 << getActiveLayer()); int masquelayer = (1 << getActiveLayer());
pt_segm = Locate_Pistes( GetBoard()->m_Track, masquelayer, pt_segm = Locate_Pistes( GetBoard(), GetBoard()->m_Track, masquelayer,
CURSEUR_OFF_GRILLE ); CURSEUR_OFF_GRILLE );
if( pt_segm == NULL ) if( pt_segm == NULL )
GetBoard()->DisplayInfo( this ); GetBoard()->DisplayInfo( this );
......
...@@ -161,7 +161,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC ) ...@@ -161,7 +161,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer ); g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer );
g_CurrentTrackSegment->m_Width = GetBoard()->GetCurrentTrackWidth(); g_CurrentTrackSegment->m_Width = GetBoard()->GetCurrentTrackWidth();
if( g_DesignSettings.m_UseConnectedTrackWidth ) if( GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth )
{ {
if( TrackOnStartPoint && TrackOnStartPoint->Type() == TYPE_TRACK ) if( TrackOnStartPoint && TrackOnStartPoint->Type() == TYPE_TRACK )
g_CurrentTrackSegment->m_Width = TrackOnStartPoint->m_Width; g_CurrentTrackSegment->m_Width = TrackOnStartPoint->m_Width;
...@@ -274,7 +274,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC ) ...@@ -274,7 +274,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
newTrack->m_Start = newTrack->m_End; newTrack->m_Start = newTrack->m_End;
newTrack->SetLayer( ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer ); newTrack->SetLayer( ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer );
if( !g_DesignSettings.m_UseConnectedTrackWidth ) if( !GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth )
{ {
newTrack->m_Width = GetBoard()->GetCurrentTrackWidth(); newTrack->m_Width = GetBoard()->GetCurrentTrackWidth();
} }
...@@ -730,7 +730,7 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, ...@@ -730,7 +730,7 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel,
{ {
previous_track->SetLayer( screen->m_Active_Layer ); previous_track->SetLayer( screen->m_Active_Layer );
if( !g_DesignSettings.m_UseConnectedTrackWidth ) if( !frame->GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth )
previous_track->m_Width = previous_track->m_Width =
frame->GetBoard()->GetCurrentTrackWidth(); frame->GetBoard()->GetCurrentTrackWidth();
} }
......
...@@ -33,12 +33,12 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) ...@@ -33,12 +33,12 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH: case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
g_DesignSettings.m_UseConnectedTrackWidth = not g_DesignSettings.m_UseConnectedTrackWidth; GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = not GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth;
AuxiliaryToolBar_Update_UI( ); AuxiliaryToolBar_Update_UI( );
break; break;
case ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES: case ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES:
g_DesignSettings.m_UseConnectedTrackWidth = false; GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = false;
GetBoard()->m_TrackWidthSelector = 0; GetBoard()->m_TrackWidthSelector = 0;
GetBoard()->m_ViaSizeSelector = 0; GetBoard()->m_ViaSizeSelector = 0;
AuxiliaryToolBar_Update_UI( ); AuxiliaryToolBar_Update_UI( );
...@@ -46,7 +46,7 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) ...@@ -46,7 +46,7 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
case ID_POPUP_PCB_SELECT_AUTO_WIDTH: case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
g_DesignSettings.m_UseConnectedTrackWidth = true; GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = true;
AuxiliaryToolBar_Update_UI( ); AuxiliaryToolBar_Update_UI( );
break; break;
...@@ -59,7 +59,7 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) ...@@ -59,7 +59,7 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
case ID_POPUP_PCB_SELECT_WIDTH7: case ID_POPUP_PCB_SELECT_WIDTH7:
case ID_POPUP_PCB_SELECT_WIDTH8: case ID_POPUP_PCB_SELECT_WIDTH8:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
g_DesignSettings.m_UseConnectedTrackWidth = false; GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = false;
ii = id - ID_POPUP_PCB_SELECT_WIDTH1; ii = id - ID_POPUP_PCB_SELECT_WIDTH1;
GetBoard()->m_TrackWidthSelector = ii; GetBoard()->m_TrackWidthSelector = ii;
AuxiliaryToolBar_Update_UI( ); AuxiliaryToolBar_Update_UI( );
......
...@@ -388,7 +388,7 @@ void GenDrillReportFile( FILE* aFile, BOARD* aPcb, ...@@ -388,7 +388,7 @@ void GenDrillReportFile( FILE* aFile, BOARD* aPcb,
sprintf( line, "\ntotal holes count %d\n\n\n", TotalHoleCount ); sprintf( line, "\ntotal holes count %d\n\n\n", TotalHoleCount );
fputs( line, aFile ); fputs( line, aFile );
if( g_DesignSettings.GetCopperLayerCount() <= 2 ) if( aPcb->GetCopperLayerCount() <= 2 )
break; break;
if( gen_through_holes ) if( gen_through_holes )
...@@ -399,7 +399,7 @@ void GenDrillReportFile( FILE* aFile, BOARD* aPcb, ...@@ -399,7 +399,7 @@ void GenDrillReportFile( FILE* aFile, BOARD* aPcb,
break; break;
layer1++; layer2++; // use next layer pair layer1++; layer2++; // use next layer pair
if( layer2 == g_DesignSettings.GetCopperLayerCount() - 1 ) if( layer2 == aPcb->GetCopperLayerCount() - 1 )
layer2 = LAYER_N_FRONT; // the last layer is always the layer2 = LAYER_N_FRONT; // the last layer is always the
// component layer // component layer
} }
......
...@@ -366,7 +366,7 @@ void WinEDA_DrillFrame::GenDrillFiles( wxCommandEvent& event ) ...@@ -366,7 +366,7 @@ void WinEDA_DrillFrame::GenDrillFiles( wxCommandEvent& event )
layer1++; layer1++;
layer2++; // use next layer pair layer2++; // use next layer pair
if( layer2 == g_DesignSettings.GetCopperLayerCount() - 1 ) if( layer2 == m_Parent->GetBoard()->GetCopperLayerCount() - 1 )
layer2 = LAYER_N_FRONT; // the last layer is always the layer2 = LAYER_N_FRONT; // the last layer is always the
// component layer // component layer
} }
......
...@@ -246,11 +246,11 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ...@@ -246,11 +246,11 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
if( (ll <= LAYER_N_BACK) || (ll > LAYER_N_FRONT) ) if( (ll <= LAYER_N_BACK) || (ll > LAYER_N_FRONT) )
break; break;
if( GetBoard()->m_BoardSettings->GetCopperLayerCount() < 2 ) // Single layer if( GetBoard()->GetCopperLayerCount() < 2 ) // Single layer
ll = LAYER_N_BACK; ll = LAYER_N_BACK;
else if( ll == LAYER_N_FRONT ) else if( ll == LAYER_N_FRONT )
ll = MAX( LAYER_N_BACK, ll = MAX( LAYER_N_BACK,
GetBoard()->m_BoardSettings->GetCopperLayerCount() - 2 ); GetBoard()->GetCopperLayerCount() - 2 );
else else
ll--; ll--;
SwitchLayer( DC, ll ); SwitchLayer( DC, ll );
...@@ -260,9 +260,9 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ...@@ -260,9 +260,9 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
ll = GetScreen()->m_Active_Layer; ll = GetScreen()->m_Active_Layer;
if( (ll < LAYER_N_BACK) || (ll >= LAYER_N_FRONT) ) if( (ll < LAYER_N_BACK) || (ll >= LAYER_N_FRONT) )
break; break;
if( GetBoard()->m_BoardSettings->GetCopperLayerCount() < 2 ) // Single layer if( GetBoard()->GetCopperLayerCount() < 2 ) // Single layer
ll = LAYER_N_BACK; ll = LAYER_N_BACK;
else if( ll >= GetBoard()->m_BoardSettings->GetCopperLayerCount() - 2 ) else if( ll >= GetBoard()->GetCopperLayerCount() - 2 )
ll = LAYER_N_FRONT; ll = LAYER_N_FRONT;
else else
ll++; ll++;
...@@ -456,12 +456,12 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ...@@ -456,12 +456,12 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
return; return;
// place micro via and switch layer // place micro via and switch layer
if( GetScreen()->IsMicroViaAcceptable() ) if( IsMicroViaAcceptable() )
{ {
int v_type = g_DesignSettings.m_CurrentViaType; int v_type = GetBoard()->GetBoardDesignSettings()->m_CurrentViaType;
g_DesignSettings.m_CurrentViaType = VIA_MICROVIA; GetBoard()->GetBoardDesignSettings()->m_CurrentViaType = VIA_MICROVIA;
Other_Layer_Route( (TRACK*) GetCurItem(), DC ); Other_Layer_Route( (TRACK*) GetCurItem(), DC );
g_DesignSettings.m_CurrentViaType = v_type; GetBoard()->GetBoardDesignSettings()->m_CurrentViaType = v_type;
if( DisplayOpt.ContrastModeDisplay ) if( DisplayOpt.ContrastModeDisplay )
GetScreen()->SetRefreshReq(); GetScreen()->SetRefreshReq();
} }
......
This diff is collapsed.
...@@ -272,7 +272,7 @@ MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc ) ...@@ -272,7 +272,7 @@ MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc )
} }
else if( !( typeloc & MATCH_LAYER ) else if( !( typeloc & MATCH_LAYER )
&& ( !( typeloc & VISIBLE_ONLY ) && ( !( typeloc & VISIBLE_ONLY )
|| IsModuleLayerVisible( layer ) ) ) || Pcb->IsModuleLayerVisible( layer ) ) )
{ {
if( dist <= alt_min_dim ) if( dist <= alt_min_dim )
{ {
...@@ -466,15 +466,15 @@ suite1: ...@@ -466,15 +466,15 @@ suite1:
* *
* The search begins to address start_adresse * The search begins to address start_adresse
*/ */
TRACK* Locate_Pistes( TRACK* start_adresse, int MasqueLayer, int typeloc ) TRACK* Locate_Pistes(BOARD* aPcb, TRACK* start_adresse, int MasqueLayer, int typeloc )
{ {
wxPoint ref_pos = RefPos( typeloc ); wxPoint ref_pos = RefPos( typeloc );
return Locate_Pistes( start_adresse, ref_pos, MasqueLayer ); return Locate_Pistes( aPcb, start_adresse, ref_pos, MasqueLayer );
} }
TRACK* Locate_Pistes( TRACK* start_adresse, const wxPoint& ref_pos, TRACK* Locate_Pistes(BOARD* aPcb, TRACK* start_adresse, const wxPoint& ref_pos,
int MasqueLayer ) int MasqueLayer )
{ {
for( TRACK* track = start_adresse; track; track = track->Next() ) for( TRACK* track = start_adresse; track; track = track->Next() )
...@@ -489,7 +489,7 @@ TRACK* Locate_Pistes( TRACK* start_adresse, const wxPoint& ref_pos, ...@@ -489,7 +489,7 @@ TRACK* Locate_Pistes( TRACK* start_adresse, const wxPoint& ref_pos,
continue; continue;
} }
if( g_DesignSettings.IsLayerVisible( layer ) == false ) if( aPcb->GetBoardDesignSettings()->IsLayerVisible( layer ) == false )
continue; continue;
if( track->Type() == TYPE_VIA ) /* VIA encountered. */ if( track->Type() == TYPE_VIA ) /* VIA encountered. */
......
...@@ -184,7 +184,7 @@ bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame, ...@@ -184,7 +184,7 @@ bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame,
{ {
int layer_mask = g_TabOneLayerMask[layer]; int layer_mask = g_TabOneLayerMask[layer];
TRACK* track = Locate_Pistes( m_Pcb->m_Track, layer_mask, CURSEUR_OFF_GRILLE ); TRACK* track = Locate_Pistes( m_Pcb, m_Pcb->m_Track, layer_mask, CURSEUR_OFF_GRILLE );
if( !track || track->Type() != TYPE_TRACK ) if( !track || track->Type() != TYPE_TRACK )
{ {
// D(printf("!currTrack and track=%p not found, layer_mask=0x%X\n", track, layer_mask );) // D(printf("!currTrack and track=%p not found, layer_mask=0x%X\n", track, layer_mask );)
...@@ -217,7 +217,7 @@ bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame, ...@@ -217,7 +217,7 @@ bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame,
if( doCheckNet && currTrack && currTrack->GetNet() != track->GetNet() ) if( doCheckNet && currTrack && currTrack->GetNet() != track->GetNet() )
continue; continue;
if( g_DesignSettings.IsLayerVisible( track->GetLayer() ) == false ) if( m_Pcb->IsLayerVisible( track->GetLayer() ) == false )
continue; continue;
// omit the layer check if moving a via // omit the layer check if moving a via
......
...@@ -220,7 +220,7 @@ MIREPCB* WinEDA_PcbFrame::Create_Mire( wxDC* DC ) ...@@ -220,7 +220,7 @@ MIREPCB* WinEDA_PcbFrame::Create_Mire( wxDC* DC )
GetBoard()->Add( MirePcb ); GetBoard()->Add( MirePcb );
MirePcb->SetLayer( EDGE_N ); MirePcb->SetLayer( EDGE_N );
MirePcb->m_Width = g_DesignSettings.m_EdgeSegmentWidth; MirePcb->m_Width = GetBoard()->GetBoardDesignSettings()->m_EdgeSegmentWidth;
MirePcb->m_Size = MireDefaultSize; MirePcb->m_Size = MireDefaultSize;
MirePcb->m_Pos = DrawPanel->GetScreen()->m_Curseur; MirePcb->m_Pos = DrawPanel->GetScreen()->m_Curseur;
......
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
static PCB_SCREEN* s_screenModule = NULL; // the PCB_SCREEN used by the static PCB_SCREEN* s_screenModule = NULL; // the PCB_SCREEN used by the
// footprint editor // footprint editor
// Design setting for the module editor:
static BOARD_DESIGN_SETTINGS s_ModuleEditorDesignSetting;
/********************************/ /********************************/
/* class WinEDA_ModuleEditFrame */ /* class WinEDA_ModuleEditFrame */
...@@ -170,6 +172,7 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father, ...@@ -170,6 +172,7 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
s_screenModule = new PCB_SCREEN(); s_screenModule = new PCB_SCREEN();
SetBaseScreen( s_screenModule ); SetBaseScreen( s_screenModule );
ActiveScreen = GetScreen(); ActiveScreen = GetScreen();
GetBoard()->SetBoardDesignSettings( &s_ModuleEditorDesignSetting );
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
LoadSettings(); LoadSettings();
......
...@@ -1049,7 +1049,7 @@ BOARD_ITEM* LocateLockPoint( BOARD* Pcb, wxPoint pos, int LayerMask ) ...@@ -1049,7 +1049,7 @@ BOARD_ITEM* LocateLockPoint( BOARD* Pcb, wxPoint pos, int LayerMask )
/* No pad has been located so check for a segment of the trace. */ /* No pad has been located so check for a segment of the trace. */
TRACK* ptsegm = Fast_Locate_Piste( Pcb->m_Track, NULL, pos, LayerMask ); TRACK* ptsegm = Fast_Locate_Piste( Pcb->m_Track, NULL, pos, LayerMask );
if( ptsegm == NULL ) if( ptsegm == NULL )
ptsegm = Locate_Pistes( Pcb->m_Track, pos, LayerMask ); ptsegm = Locate_Pistes( Pcb, Pcb->m_Track, pos, LayerMask );
return ptsegm; return ptsegm;
} }
......
...@@ -449,7 +449,7 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu ) ...@@ -449,7 +449,7 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
PopMenu->Append( ID_POPUP_PCB_PLACE_VIA, msg ); PopMenu->Append( ID_POPUP_PCB_PLACE_VIA, msg );
// See if we can place a Micro Via (4 or more layers, and start from an external layer): // See if we can place a Micro Via (4 or more layers, and start from an external layer):
if( ( (PCB_SCREEN*) GetScreen() )->IsMicroViaAcceptable() ) if( IsMicroViaAcceptable() )
{ {
msg = AddHotkeyName( _( msg = AddHotkeyName( _(
"Place Micro Via" ), s_Board_Editor_Hokeys_Descr, "Place Micro Via" ), s_Board_Editor_Hokeys_Descr,
...@@ -813,12 +813,12 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard ) ...@@ -813,12 +813,12 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard )
"Use the track width when starting on a track, otherwise the current track width" ), "Use the track width when starting on a track, otherwise the current track width" ),
true ); true );
if( g_DesignSettings.m_UseConnectedTrackWidth ) if( aBoard->GetBoardDesignSettings()->m_UseConnectedTrackWidth )
trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, true ); trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, true );
if( aBoard->m_ViaSizeSelector != 0 if( aBoard->m_ViaSizeSelector != 0
|| aBoard->m_TrackWidthSelector != 0 || aBoard->m_TrackWidthSelector != 0
|| g_DesignSettings.m_UseConnectedTrackWidth ) || aBoard->GetBoardDesignSettings()->m_UseConnectedTrackWidth )
trackwidth_menu->Append( ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES, trackwidth_menu->Append( ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES,
_( "Use Netclass Values" ), _( "Use Netclass Values" ),
_( "Use track and via sizes from their Netclass values" ), _( "Use track and via sizes from their Netclass values" ),
...@@ -834,7 +834,7 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard ) ...@@ -834,7 +834,7 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard )
trackwidth_menu->Append( ID_POPUP_PCB_SELECT_WIDTH1 + ii, msg, wxEmptyString, true ); trackwidth_menu->Append( ID_POPUP_PCB_SELECT_WIDTH1 + ii, msg, wxEmptyString, true );
} }
if( g_DesignSettings.m_UseConnectedTrackWidth ) if( aBoard->GetBoardDesignSettings()->m_UseConnectedTrackWidth )
trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, true ); trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, true );
else else
{ {
......
...@@ -872,6 +872,32 @@ void WinEDA_PcbFrame::SaveSettings() ...@@ -872,6 +872,32 @@ void WinEDA_PcbFrame::SaveSettings()
} }
/* Return true if a microvia can be put on board
* A microvia ia a small via restricted to 2 near neighbour layers
* because its is hole is made by laser which can penetrate only one layer
* It is mainly used to connect BGA to the first inner layer
* And it is allowed from an external layer to the first inner layer
*/
bool WinEDA_PcbFrame::IsMicroViaAcceptable( void )
{
int copperlayercnt = GetBoard()->GetCopperLayerCount( );
int currLayer = getActiveLayer();
if( !GetBoard()->GetBoardDesignSettings()->m_MicroViasAllowed )
return false; // Obvious..
if( copperlayercnt < 4 )
return false; // Only on multilayer boards..
if( ( currLayer == LAYER_N_BACK )
|| ( currLayer == LAYER_N_FRONT )
|| ( currLayer == copperlayercnt - 2 )
|| ( currLayer == LAYER_N_2 ) )
return true;
return false;
}
void WinEDA_PcbFrame::syncLayerWidget( ) void WinEDA_PcbFrame::syncLayerWidget( )
{ {
......
...@@ -60,25 +60,6 @@ extern bool g_Raccord_45_Auto; ...@@ -60,25 +60,6 @@ extern bool g_Raccord_45_Auto;
extern const wxString g_FootprintLibFileWildcard; // Wildcard for footprint libraries filesnames extern const wxString g_FootprintLibFileWildcard; // Wildcard for footprint libraries filesnames
/**
* Function IsModuleLayerVisible
* expects either of the two layers on which a module can reside, and returns
* whether that layer is visible.
* @param layer One of the two allowed layers for modules: LAYER_N_FRONT or LAYER_N_BACK
* @return bool - true if the layer is visible, else false.
*/
bool inline IsModuleLayerVisible( int layer )
{
if( layer==LAYER_N_FRONT )
return g_DesignSettings.IsElementVisible( PCB_VISIBLE(MOD_FR_VISIBLE) );
else if( layer==LAYER_N_BACK )
return g_DesignSettings.IsElementVisible( PCB_VISIBLE(MOD_BK_VISIBLE) );
else
return true;
}
extern bool Track_45_Only; extern bool Track_45_Only;
extern bool Segments_45_Only; extern bool Segments_45_Only;
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#define ITEM_COLOR(item_visible) &g_ColorsSettings.m_ItemsColors[item_visible] #define ITEM_COLOR(item_visible) &g_ColorsSettings.m_ItemsColors[item_visible]
/* Configuration parameters. */ /* Configuration parameters. */
extern BOARD_DESIGN_SETTINGS boardDesignSettings;
static PARAM_CFG_WXSTRING UserLibDirBufCfg static PARAM_CFG_WXSTRING UserLibDirBufCfg
( (
...@@ -61,10 +62,10 @@ static PARAM_CFG_INT PadDimVCfg ...@@ -61,10 +62,10 @@ static PARAM_CFG_INT PadDimVCfg
); );
static PARAM_CFG_INT LayerThicknessCfg static PARAM_CFG_INT BoardThicknessCfg
( (
wxT( "LayerThickness" ), wxT( "BoardThickness" ),
&g_DesignSettings.m_LayerThickness, &boardDesignSettings.m_BoardThickness,
630, 630,
0, 0xFFFF 0, 0xFFFF
); );
...@@ -213,7 +214,7 @@ static PARAM_CFG_BOOL SegmPcb45Cfg // Force 45 degrees for segments ...@@ -213,7 +214,7 @@ static PARAM_CFG_BOOL SegmPcb45Cfg // Force 45 degrees for segments
static PARAM_CFG_INT PcbTextDimVCfg static PARAM_CFG_INT PcbTextDimVCfg
( (
wxT( "TxtPcbV" ), wxT( "TxtPcbV" ),
&g_DesignSettings.m_PcbTextSize.y, &boardDesignSettings.m_PcbTextSize.y,
600, 600,
TEXTS_MIN_SIZE, TEXTS_MAX_SIZE TEXTS_MIN_SIZE, TEXTS_MAX_SIZE
); );
...@@ -221,7 +222,7 @@ static PARAM_CFG_INT PcbTextDimVCfg ...@@ -221,7 +222,7 @@ static PARAM_CFG_INT PcbTextDimVCfg
static PARAM_CFG_INT PcbTextDimHCfg static PARAM_CFG_INT PcbTextDimHCfg
( (
wxT( "TxtPcbH" ), wxT( "TxtPcbH" ),
&g_DesignSettings.m_PcbTextSize.x, &boardDesignSettings.m_PcbTextSize.x,
600, 600,
TEXTS_MIN_SIZE, TEXTS_MAX_SIZE TEXTS_MIN_SIZE, TEXTS_MAX_SIZE
); );
...@@ -633,7 +634,7 @@ static PARAM_CFG_INT HPGLrecouvrementCfg ...@@ -633,7 +634,7 @@ static PARAM_CFG_INT HPGLrecouvrementCfg
static PARAM_CFG_INT VernisEpargneGardeCfg static PARAM_CFG_INT VernisEpargneGardeCfg
( (
wxT( "VEgarde" ), wxT( "VEgarde" ),
&g_DesignSettings.m_SolderMaskMargin, &boardDesignSettings.m_SolderMaskMargin,
100, 100,
0, 10000 0, 10000
); );
...@@ -641,7 +642,7 @@ static PARAM_CFG_INT VernisEpargneGardeCfg ...@@ -641,7 +642,7 @@ static PARAM_CFG_INT VernisEpargneGardeCfg
static PARAM_CFG_INT DrawSegmLargeurCfg static PARAM_CFG_INT DrawSegmLargeurCfg
( (
wxT( "DrawLar" ), wxT( "DrawLar" ),
&g_DesignSettings.m_DrawSegmentWidth, &boardDesignSettings.m_DrawSegmentWidth,
120, 120,
0, 0xFFFF 0, 0xFFFF
); );
...@@ -649,7 +650,7 @@ static PARAM_CFG_INT DrawSegmLargeurCfg ...@@ -649,7 +650,7 @@ static PARAM_CFG_INT DrawSegmLargeurCfg
static PARAM_CFG_INT EdgeSegmLargeurCfg static PARAM_CFG_INT EdgeSegmLargeurCfg
( (
wxT( "EdgeLar" ), wxT( "EdgeLar" ),
&g_DesignSettings.m_EdgeSegmentWidth, &boardDesignSettings.m_EdgeSegmentWidth,
120, 120,
0, 0xFFFF 0, 0xFFFF
); );
...@@ -657,7 +658,7 @@ static PARAM_CFG_INT EdgeSegmLargeurCfg ...@@ -657,7 +658,7 @@ static PARAM_CFG_INT EdgeSegmLargeurCfg
static PARAM_CFG_INT TexteSegmLargeurCfg static PARAM_CFG_INT TexteSegmLargeurCfg
( (
wxT( "TxtLar" ), wxT( "TxtLar" ),
&g_DesignSettings.m_PcbTextWidth, &boardDesignSettings.m_PcbTextWidth,
120, 120,
0, 0xFFFF 0, 0xFFFF
); );
...@@ -732,7 +733,7 @@ PARAM_CFG_BASE* ParamCfgList[] = ...@@ -732,7 +733,7 @@ PARAM_CFG_BASE* ParamCfgList[] =
&PadDimVCfg, &PadDimVCfg,
&ViaShowHoleCfg, &ViaShowHoleCfg,
&ShowNetNamesModeCfg, &ShowNetNamesModeCfg,
&LayerThicknessCfg, &BoardThicknessCfg,
&RouteLayTopCfg, &RouteLayTopCfg,
&RouteLayBotCfg, &RouteLayBotCfg,
&Segm45Cfg, &Segm45Cfg,
......
...@@ -194,7 +194,7 @@ void DIALOG_PLOT::Init_Dialog() ...@@ -194,7 +194,7 @@ void DIALOG_PLOT::Init_Dialog()
wxString layerKey; wxString layerKey;
for( layer = 0; layer < NB_LAYERS; ++layer ) for( layer = 0; layer < NB_LAYERS; ++layer )
{ {
if( !board->m_BoardSettings->IsLayerEnabled( layer ) ) if( !board->IsLayerEnabled( layer ) )
m_BoxSelectLayer[layer] = NULL; m_BoxSelectLayer[layer] = NULL;
else else
m_BoxSelectLayer[layer] = m_BoxSelectLayer[layer] =
......
...@@ -923,7 +923,7 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* aPlotter, ...@@ -923,7 +923,7 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* aPlotter,
// If the current layer is a solder mask, use the global mask // If the current layer is a solder mask, use the global mask
// clearance for vias // clearance for vias
if( ( aLayerMask & ( SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT ) ) ) if( ( aLayerMask & ( SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT ) ) )
via_margin = g_DesignSettings.m_SolderMaskMargin; via_margin = GetBoard()->GetBoardDesignSettings()->m_SolderMaskMargin;
pos = Via->m_Start; pos = Via->m_Start;
size.x = size.y = Via->m_Width + 2 * via_margin; size.x = size.y = Via->m_Width + 2 * via_margin;
......
...@@ -128,8 +128,8 @@ TRACK* Locate_Piste_Connectee( TRACK* ptr_piste, TRACK* pt_base, ...@@ -128,8 +128,8 @@ TRACK* Locate_Piste_Connectee( TRACK* ptr_piste, TRACK* pt_base,
* *
* The search begins to address start_adresse * The search begins to address start_adresse
*/ */
TRACK* Locate_Pistes( TRACK* start_adresse, int layer, int typeloc ); TRACK* Locate_Pistes( BOARD* aPcb, TRACK* start_adresse, int layer, int typeloc );
TRACK* Locate_Pistes( TRACK* start_adresse, TRACK* Locate_Pistes( BOARD* aPcb, TRACK* start_adresse,
const wxPoint& ref_pos, int layer ); const wxPoint& ref_pos, int layer );
/* Locate pad connected to the beginning or end of a segment /* Locate pad connected to the beginning or end of a segment
...@@ -138,7 +138,7 @@ TRACK* Locate_Pistes( TRACK* start_adresse, ...@@ -138,7 +138,7 @@ TRACK* Locate_Pistes( TRACK* start_adresse,
* A pointer to the description of the patch if pad was found. * A pointer to the description of the patch if pad was found.
* NULL pointer if pad was not found. * NULL pointer if pad was not found.
*/ */
D_PAD* Locate_Pad_Connecte( BOARD* Pcb, TRACK* ptr_segment, int extr ); D_PAD* Locate_Pad_Connecte( BOARD* aPcb, TRACK* ptr_segment, int extr );
/* /*
...@@ -151,10 +151,10 @@ D_PAD* Locate_Pad_Connecte( BOARD* Pcb, TRACK* ptr_segment, int extr ); ...@@ -151,10 +151,10 @@ D_PAD* Locate_Pad_Connecte( BOARD* Pcb, TRACK* ptr_segment, int extr );
* Pointer to the pad if found * Pointer to the pad if found
* NULL pointer if pad not found * NULL pointer if pad not found
*/ */
D_PAD* Locate_Any_Pad( BOARD* Pcb, D_PAD* Locate_Any_Pad( BOARD* aPcb,
int typeloc, int typeloc,
bool OnlyCurrentLayer = FALSE ); bool OnlyCurrentLayer = FALSE );
D_PAD* Locate_Any_Pad( BOARD* Pcb, D_PAD* Locate_Any_Pad( BOARD* aPcb,
const wxPoint& ref_pos, const wxPoint& ref_pos,
bool OnlyCurrentLayer = FALSE ); bool OnlyCurrentLayer = FALSE );
......
...@@ -107,7 +107,7 @@ WinEDA_SelLayerFrame::WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent, ...@@ -107,7 +107,7 @@ WinEDA_SelLayerFrame::WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent,
/* Build the layer list */ /* Build the layer list */
LayerCount = 0; LayerCount = 0;
int Masque_Layer = int Masque_Layer =
g_TabAllCopperLayerMask[g_DesignSettings.GetCopperLayerCount() - 1]; g_TabAllCopperLayerMask[board->GetCopperLayerCount() - 1];
Masque_Layer += ALL_NO_CU_LAYERS; Masque_Layer += ALL_NO_CU_LAYERS;
for( ii = 0; ii < NB_LAYERS; ii++ ) for( ii = 0; ii < NB_LAYERS; ii++ )
{ {
...@@ -220,7 +220,7 @@ void WinEDA_BasePcbFrame::SelectLayerPair() ...@@ -220,7 +220,7 @@ void WinEDA_BasePcbFrame::SelectLayerPair()
// Check whether more than one copper layer has been enabled for the // Check whether more than one copper layer has been enabled for the
// current PCB file, as Layer Pairs can only meaningfully be defined // current PCB file, as Layer Pairs can only meaningfully be defined
// within PCB files which contain at least two copper layers. // within PCB files which contain at least two copper layers.
if( GetBoard()->m_BoardSettings->GetCopperLayerCount() < 2 ) if( GetBoard()->GetCopperLayerCount() < 2 )
{ {
wxString InfoMsg; wxString InfoMsg;
InfoMsg = _( "Less than two copper layers are being used." ); InfoMsg = _( "Less than two copper layers are being used." );
...@@ -260,7 +260,7 @@ WinEDA_SelLayerPairFrame::WinEDA_SelLayerPairFrame( WinEDA_BasePcbFrame* parent ...@@ -260,7 +260,7 @@ WinEDA_SelLayerPairFrame::WinEDA_SelLayerPairFrame( WinEDA_BasePcbFrame* parent
PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->GetScreen(); PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->GetScreen();
int Masque_Layer = int Masque_Layer =
g_TabAllCopperLayerMask[g_DesignSettings.GetCopperLayerCount() - 1]; g_TabAllCopperLayerMask[board->GetCopperLayerCount() - 1];
Masque_Layer += ALL_NO_CU_LAYERS; Masque_Layer += ALL_NO_CU_LAYERS;
for( ii = 0, LayerCount = 0; ii < NB_COPPER_LAYERS; ii++ ) for( ii = 0, LayerCount = 0; ii < NB_COPPER_LAYERS; ii++ )
......
...@@ -468,7 +468,7 @@ static int Autoroute_One_Track( WinEDA_PcbFrame* pcbframe, ...@@ -468,7 +468,7 @@ static int Autoroute_One_Track( WinEDA_PcbFrame* pcbframe,
/* Test the trivial case: direct connection overlay pads. */ /* Test the trivial case: direct connection overlay pads. */
if( ( row_source == row_target ) && ( col_source == col_target ) if( ( row_source == row_target ) && ( col_source == col_target )
&& ( pad_masque_layer_e & pad_masque_layer_s & && ( pad_masque_layer_e & pad_masque_layer_s &
g_TabAllCopperLayerMask[g_DesignSettings.GetCopperLayerCount() - 1] ) ) g_TabAllCopperLayerMask[pcbframe->GetBoard()->GetCopperLayerCount() - 1] ) )
{ {
result = TRIVIAL_SUCCESS; result = TRIVIAL_SUCCESS;
goto end_of_route; goto end_of_route;
...@@ -1127,7 +1127,7 @@ static void OrCell_Trace( BOARD* pcb, int col, int row, ...@@ -1127,7 +1127,7 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
( g_GridRoutingSize * col ); ( g_GridRoutingSize * col );
g_CurrentTrackSegment->m_Width = pcb->GetCurrentViaSize(); g_CurrentTrackSegment->m_Width = pcb->GetCurrentViaSize();
g_CurrentTrackSegment->m_Shape = g_DesignSettings.m_CurrentViaType; g_CurrentTrackSegment->m_Shape = pcb->GetBoardDesignSettings()->m_CurrentViaType;
g_CurrentTrackSegment->SetNet( current_net_code ); g_CurrentTrackSegment->SetNet( current_net_code );
} }
......
...@@ -69,7 +69,7 @@ void WinEDA_PcbFrame::PrepareLayerIndicator() ...@@ -69,7 +69,7 @@ void WinEDA_PcbFrame::PrepareLayerIndicator()
previous_Route_Layer_BOTTOM_color, previous_via_color; previous_Route_Layer_BOTTOM_color, previous_via_color;
/* get colors, and redraw bitmap button only on changes */ /* get colors, and redraw bitmap button only on changes */
active_layer_color = g_ColorsSettings.GetLayerColor(getActiveLayer()); active_layer_color = GetBoard()->GetLayerColor(getActiveLayer());
if( previous_active_layer_color != active_layer_color ) if( previous_active_layer_color != active_layer_color )
{ {
previous_active_layer_color = active_layer_color; previous_active_layer_color = active_layer_color;
...@@ -87,7 +87,9 @@ void WinEDA_PcbFrame::PrepareLayerIndicator() ...@@ -87,7 +87,9 @@ void WinEDA_PcbFrame::PrepareLayerIndicator()
previous_Route_Layer_BOTTOM_color = Route_Layer_BOTTOM_color; previous_Route_Layer_BOTTOM_color = Route_Layer_BOTTOM_color;
change = true; change = true;
} }
via_color = g_ColorsSettings.GetItemColor(VIAS_VISIBLE+g_DesignSettings.m_CurrentViaType);
int via_type = GetBoard()->GetBoardDesignSettings()->m_CurrentViaType;
via_color = GetBoard()->GetVisibleElementColor(VIAS_VISIBLE+via_type);
if( previous_via_color != via_color ) if( previous_via_color != via_color )
{ {
previous_via_color = via_color; previous_via_color = via_color;
...@@ -707,7 +709,7 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent ) ...@@ -707,7 +709,7 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent )
parent->AddControl( m_SelLayerBox ); parent->AddControl( m_SelLayerBox );
} }
int layer_mask = g_DesignSettings.GetEnabledLayers(); int layer_mask = GetBoard()->GetEnabledLayers();
unsigned length = 0; unsigned length = 0;
m_SelLayerBox->Clear(); m_SelLayerBox->Clear();
......
...@@ -83,7 +83,7 @@ void WinEDA_PcbFrame::AuxiliaryToolBar_Update_UI() ...@@ -83,7 +83,7 @@ void WinEDA_PcbFrame::AuxiliaryToolBar_Update_UI()
AuxiliaryToolBar_DesignRules_Update_UI(); AuxiliaryToolBar_DesignRules_Update_UI();
m_AuxiliaryToolBar->ToggleTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH, m_AuxiliaryToolBar->ToggleTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
g_DesignSettings.m_UseConnectedTrackWidth ); GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth );
if( m_SelTrackWidthBox && m_TrackAndViasSizesList_Changed ) if( m_SelTrackWidthBox && m_TrackAndViasSizesList_Changed )
{ {
......
...@@ -160,14 +160,14 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC, ...@@ -160,14 +160,14 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
if( module->m_Flags & IS_MOVED ) if( module->m_Flags & IS_MOVED )
continue; continue;
if( !g_DesignSettings.IsElementVisible( PCB_VISIBLE(MOD_FR_VISIBLE) ) ) if( !IsElementVisible( PCB_VISIBLE(MOD_FR_VISIBLE) ) )
{ {
if( module->GetLayer() == LAYER_N_FRONT ) if( module->GetLayer() == LAYER_N_FRONT )
display = FALSE; display = FALSE;
layerMask &= ~LAYER_FRONT; layerMask &= ~LAYER_FRONT;
} }
if( !g_DesignSettings.IsElementVisible( PCB_VISIBLE(MOD_BK_VISIBLE) ) ) if( !IsElementVisible( PCB_VISIBLE(MOD_BK_VISIBLE) ) )
{ {
if( module->GetLayer() == LAYER_N_BACK ) if( module->GetLayer() == LAYER_N_BACK )
display = FALSE; display = FALSE;
......
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