Commit e027e659 authored by charras's avatar charras

code and files cleanup

parent 4a515196
......@@ -9,6 +9,7 @@
#include "macros.h"
#include "drawtxt.h"
#include "confirm.h"
#include "class_board_design_settings.h"
#include "3d_viewer.h"
#include "trackball.h"
......@@ -113,7 +114,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
g_Parm_3D_Visu.m_BoardSize = pcb->m_BoundaryBox.GetSize();
g_Parm_3D_Visu.m_BoardPos = pcb->m_BoundaryBox.Centre();
g_Parm_3D_Visu.m_BoardPos.y = -g_Parm_3D_Visu.m_BoardPos.y;
g_Parm_3D_Visu.m_Layers = pcb->m_BoardSettings->m_CopperLayerCount;
g_Parm_3D_Visu.m_Layers = pcb->m_BoardSettings->GetCopperLayerCount();
// Ensure the board has 2 sides for 3D views, because it is hard to find a *really* single side board in the true life...
if ( g_Parm_3D_Visu.m_Layers < 2 )
......
......@@ -57,6 +57,7 @@ set(PCB_COMMON_SRCS
../pcbnew/basepcbframe.cpp
../pcbnew/class_board.cpp
../pcbnew/class_board_connected_item.cpp
../pcbnew/class_board_design_settings.cpp
../pcbnew/class_board_item.cpp
../pcbnew/class_cotation.cpp
../pcbnew/class_drawsegment.cpp
......
......@@ -34,7 +34,7 @@
#include "pcbcommon.h"
#include "plot_common.h"
#include "class_zone_setting.h"
#include "class_board_design_settings.h"
/* Look up Table for conversion one layer number -> one bit layer mask: */
int g_TabOneLayerMask[LAYER_COUNT] = {
......
......@@ -33,8 +33,7 @@ set(GERBVIEW_SRCS
select_layers_to_pcb.cpp
set_color.cpp
tool_gerber.cpp
tracepcb.cpp
trpiste.cpp )
tracepcb.cpp )
set(GERBVIEW_EXTRA_SRCS
../share/setpage.cpp
......
......@@ -12,6 +12,7 @@
#include "gestfich.h"
#include "gerbview.h"
#include "class_board_design_settings.h"
#include "protos.h"
/* Routines Locales : */
......@@ -96,8 +97,8 @@ static int WriteSetup( FILE* File, BOARD* Pcb )
sprintf( text, "InternalUnit %f INCH\n", 1.0 / PCB_INTERNAL_UNIT );
fprintf( File, "%s", text );
Pcb->m_BoardSettings->m_CopperLayerCount = g_DesignSettings.m_CopperLayerCount;
fprintf( File, "Layers %d\n", g_DesignSettings.m_CopperLayerCount );
Pcb->m_BoardSettings->SetCopperLayerCount( g_DesignSettings.GetCopperLayerCount( ) );
fprintf( File, "Layers %d\n", g_DesignSettings.GetCopperLayerCount( ) );
fprintf( File, "$EndSETUP\n\n" );
return 1;
......@@ -111,7 +112,7 @@ static bool WriteGeneralDescrPcb( BOARD* Pcb, FILE* File )
int NbLayers;
/* Print the copper layer count */
NbLayers = Pcb->m_BoardSettings->m_CopperLayerCount;
NbLayers = Pcb->m_BoardSettings->GetCopperLayerCount( );
fprintf( File, "$GENERAL\n" );
fprintf( File, "LayerCount %d\n", NbLayers );
......
......@@ -14,6 +14,7 @@
#include "gerbview.h"
#include "pcbplot.h"
#include "hotkeys.h"
#include "class_board_design_settings.h"
#include "gerbview_config.h"
#include "protos.h"
......
......@@ -7,6 +7,7 @@
#include "fctsys.h"
#include "common.h"
#include "gerbview.h"
#include "class_board_design_settings.h"
#include "protos.h"
......@@ -127,25 +128,26 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( WinEDA_GerberFrame* parent ) :
// buttons should be some other size in that version.
// Compute a reasonable number of copper layers
g_DesignSettings.m_CopperLayerCount = 0;
int pcb_layer_number = 0;
for( ii = 0; ii < 32; ii++ )
{
if( g_GERBER_List[ii] != NULL )
g_DesignSettings.m_CopperLayerCount++;
pcb_layer_number++;
// Specify the default value for each member of these arrays.
ButtonTable[ii] = -1;
LayerLookUpTable[ii] = LAYER_UNSELECTED;
}
g_DesignSettings.SetCopperLayerCount(pcb_layer_number);
int pcb_layer_number = 0;
pcb_layer_number = 0;
for( nb_items = 0, ii = 0; ii < 32; ii++ )
{
if( g_GERBER_List[ii] == NULL )
continue;
if( (pcb_layer_number == g_DesignSettings.m_CopperLayerCount - 1)
&& (g_DesignSettings.m_CopperLayerCount > 1) )
if( (pcb_layer_number == g_DesignSettings.GetCopperLayerCount() - 1)
&& (g_DesignSettings.GetCopperLayerCount() > 1) )
pcb_layer_number = CMP_N;
ButtonTable[nb_items] = ii;
......@@ -375,8 +377,8 @@ void WinEDA_SwapLayerFrame::OnSelectLayer( wxCommandEvent& event )
/*********************************************************/
void WinEDA_SwapLayerFrame::OnCancelClick( wxCommandEvent& event )
{
/*********************************************************/
{
EndModal( -1 );
}
......@@ -391,7 +393,7 @@ void WinEDA_SwapLayerFrame::OnOkClick( wxCommandEvent& event )
/* Compute the number of copper layers
* this is the max layer number + 1 (if some internal layers exist)
*/
g_DesignSettings.m_CopperLayerCount = 1;
int layers_count = 1;
for( ii = 0; ii < 32; ii++ )
{
if( LayerLookUpTable[ii] == CMP_N )
......@@ -400,15 +402,17 @@ void WinEDA_SwapLayerFrame::OnOkClick( wxCommandEvent& event )
{
if( LayerLookUpTable[ii] >= LAST_COPPER_LAYER )
continue; // not a copper layer
if( LayerLookUpTable[ii] >= g_DesignSettings.m_CopperLayerCount )
g_DesignSettings.m_CopperLayerCount++;
if( LayerLookUpTable[ii] >= layers_count )
layers_count++;
}
}
if( AsCmpLayer )
g_DesignSettings.m_CopperLayerCount++;
if( g_DesignSettings.m_CopperLayerCount > NB_COPPER_LAYERS ) // should not occur.
g_DesignSettings.m_CopperLayerCount = NB_COPPER_LAYERS;
layers_count++;
if( layers_count > NB_COPPER_LAYERS ) // should not occur.
layers_count = NB_COPPER_LAYERS;
g_DesignSettings.SetCopperLayerCount( layers_count );
EndModal( 1 );
}
......@@ -16,6 +16,7 @@
#include "gerbview.h"
#include "pcbnew.h"
#include "class_board_design_settings.h"
#include "protos.h"
......
This diff is collapsed.
/*****************************************************************/
/* Routines de tracage des pistes ( Toutes, 1 piste, 1 segment ) */
/*****************************************************************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "class_drawpanel.h"
#include "drawtxt.h"
#include "confirm.h"
#include "gerbview.h"
#include "pcbplot.h"
#include "protos.h"
/* Definition des cas ou l'on force l'affichage en SKETCH (membre .flags) */
#define FORCE_SKETCH (DRAG | EDIT )
/* variables locales : */
/***************************************************************************************************/
void Draw_Track_Buffer( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int draw_mode,
int printmasklayer )
/***************************************************************************************************/
/* Function to draw the tracks (i.e Spots or lines) in gerbview
* Polygons are not handled here (there are in Pcb->m_Zone)
* @param DC = device context to draw
* @param Pcb = Board to draw (only Pcb->m_Track is used)
* @param draw_mode = draw mode for the device context (GR_COPY, GR_OR, GR_XOR ..)
* @param printmasklayer = mask for allowed layer (=-1 to draw all layers)
*/
{
int layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
GERBER* gerber = g_GERBER_List[layer];
int dcode_hightlight = 0;
if( gerber )
dcode_hightlight = gerber->m_Selected_Tool;
for( TRACK* track = Pcb->m_Track; track; track = track->Next() )
{
if( !(track->ReturnMaskLayer() & printmasklayer) )
continue;
D(printf("D:%p\n", track );)
if( dcode_hightlight == track->GetNet() && track->GetLayer()==layer )
Trace_Segment( panel, DC, track, draw_mode | GR_SURBRILL );
else
Trace_Segment( panel, DC, track, draw_mode );
}
}
#if 1
/***********************************************************************************/
void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mode )
/***********************************************************************************/
/* routine de trace de 1 segment de piste.
* Parametres :
* track = adresse de la description de la piste en buflib
* draw_mode = mode ( GR_XOR, GR_OR..)
*/
{
int l_piste;
int color;
int fillopt;
int radius;
int halfPenWidth;
static bool show_err;
if( track->m_Flags & DRAW_ERASED ) // draw in background color, used by classs TRACK in gerbview
{
color = g_DrawBgColor;
}
else
{
if( g_DesignSettings.IsLayerVisible( track->GetLayer() ) == false )
return;
color = g_DesignSettings.m_LayerColor[track->GetLayer()];
if( draw_mode & GR_SURBRILL )
{
if( draw_mode & GR_AND )
color &= ~HIGHT_LIGHT_FLAG;
else
color |= HIGHT_LIGHT_FLAG;
}
if( color & HIGHT_LIGHT_FLAG )
color = ColorRefs[color & MASKCOLOR].m_LightColor;
}
GRSetDrawMode( DC, draw_mode );
fillopt = DisplayOpt.DisplayPcbTrackFill ? FILLED : SKETCH;
switch( track->m_Shape )
{
case S_CIRCLE:
radius = (int) hypot( (double) (track->m_End.x - track->m_Start.x),
(double) (track->m_End.y - track->m_Start.y) );
halfPenWidth = track->m_Width >> 1;
if( panel->GetScreen()->Scale( halfPenWidth ) < L_MIN_DESSIN )
{
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x,
track->m_Start.y, radius, 0, color );
}
if( fillopt == SKETCH )
{
// draw the border of the pen's path using two circles, each as narrow as possible
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
radius - halfPenWidth, 0, color );
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
radius + halfPenWidth, 0, color );
}
else
{
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
radius, track->m_Width, color );
}
break;
case S_ARC:
if( fillopt == SKETCH )
{
GRArc1( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
track->m_End.x, track->m_End.y,
track->m_Param, track->GetSubNet(), 0, color );
}
else
{
GRArc1( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
track->m_End.x, track->m_End.y,
track->m_Param, track->GetSubNet(),
track->m_Width, color );
}
break;
case S_SPOT_CIRCLE:
radius = track->m_Width >> 1;
fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH;
if( panel->GetScreen()->Scale( radius ) < L_MIN_DESSIN )
{
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x,
track->m_Start.y, radius, 0, color );
}
else if( fillopt == SKETCH )
{
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x,
track->m_Start.y, radius, 0, color );
}
else
{
GRFilledCircle( &panel->m_ClipBox, DC, track->m_Start.x,
track->m_Start.y, radius, 0, color, color );
}
break;
case S_SPOT_RECT:
case S_RECT:
l_piste = track->m_Width >> 1;
fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH;
if( panel->GetScreen()->Scale( l_piste ) < L_MIN_DESSIN )
{
GRLine( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
track->m_End.x, track->m_End.y, 0, color );
}
else if( fillopt == SKETCH )
{
GRRect( &panel->m_ClipBox, DC,
track->m_Start.x - l_piste,
track->m_Start.y - l_piste,
track->m_End.x + l_piste,
track->m_End.y + l_piste,
0, color );
}
else
{
GRFilledRect( &panel->m_ClipBox, DC,
track->m_Start.x - l_piste,
track->m_Start.y - l_piste,
track->m_End.x + l_piste,
track->m_End.y + l_piste,
0, color, color );
}
break;
case S_SPOT_OVALE:
fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH;
case S_SEGMENT:
l_piste = track->m_Width >> 1;
if( panel->GetScreen()->Scale( l_piste ) < L_MIN_DESSIN )
{
GRLine( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
track->m_End.x, track->m_End.y, 0, color );
break;
}
if( fillopt == SKETCH )
{
GRCSegm( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
track->m_End.x, track->m_End.y, track->m_Width, color );
}
else
{
GRFillCSegm( &panel->m_ClipBox, DC, track->m_Start.x,
track->m_Start.y, track->m_End.x, track->m_End.y,
track->m_Width, color );
}
break;
default:
if( !show_err )
{
DisplayError( panel, wxT( "Trace_Segment() type error" ) );
show_err = TRUE;
}
break;
}
}
#endif
/*****************************************************************************************/
void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int drawmode )
/*****************************************************************************************/
{
TRACK* track;
wxPoint pos;
int width, orient;
wxString Line;
GRSetDrawMode( DC, drawmode );
track = Pcb->m_Track;
for( ; track != NULL; track = track->Next() )
{
if( (track->m_Shape == S_ARC)
|| (track->m_Shape == S_CIRCLE)
|| (track->m_Shape == S_ARC_RECT) )
{
pos.x = track->m_Start.x;
pos.y = track->m_Start.y;
}
else
{
pos.x = (track->m_Start.x + track->m_End.x) / 2;
pos.y = (track->m_Start.y + track->m_End.y) / 2;
}
Line.Printf( wxT( "D%d" ), track->GetNet() );
width = track->m_Width;
orient = TEXT_ORIENT_HORIZ;
if( track->m_Shape >= S_SPOT_CIRCLE ) // forme flash
{
width /= 3;
}
else // lines
{
int dx, dy;
dx = track->m_Start.x - track->m_End.x;
dy = track->m_Start.y - track->m_End.y;
if( abs( dx ) < abs( dy ) )
orient = TEXT_ORIENT_VERT;
width /= 2;
}
DrawGraphicText( panel, DC,
pos, (EDA_Colors) g_DCodesColor, Line,
orient, wxSize( width, width ),
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
0, false, false, false);
}
}
/**********************************************************/
/* class_board_design_settings.h : handle board options */
/**********************************************************/
#ifndef _BOARD_DESIGN_SETTING_H
#define _BOARD_DESIGN_SETTING_H
// Class for handle current printed board design settings
class EDA_BoardDesignSettings
{
protected:
int m_CopperLayerCount; // Number of copper layers for this design
public:
int m_ViaDrillCustomValue; // via drill for vias that have a specific drill value
int m_CurrentViaSize; // Current via size
int m_CurrentMicroViaSize; // Current micro via size
bool m_MicroViasAllowed; // true to allow micro vias
int m_CurrentViaType; // via type (VIA_BLIND_BURIED, VIA_TROUGHT VIA_MICROVIA)
int m_CurrentTrackWidth; // current track width
bool m_UseConnectedTrackWidth; // if true, when creating a new track starting on an existing track, use this track width
int m_DrawSegmentWidth; // current graphic line width (not EDGE layer)
int m_EdgeSegmentWidth; // current graphic line width (EDGE layer only)
int m_PcbTextWidth; // current Pcb (not module) Text width
wxSize m_PcbTextSize; // current Pcb (not module) Text size
int m_TrackMinWidth; // track min value for width ((min copper size value
int m_ViasMinSize; // vias (not micro vias) min diameter
int m_ViasMinDrill; // vias (not micro vias) min drill diameter
int m_MicroViasMinSize; // micro vias (not vias) min diameter
int m_MicroViasMinDrill; // micro vias (not vias) min drill diameter
int m_MaskMargin; // Solder mask margin
int m_LayerThickness; // Layer Thickness for 3D viewer
protected:
int m_EnabledLayers; // Bit-mask for layer enabling
int m_VisibleLayers; // Bit-mask for layer visibility
int m_VisibleElements; // Bit-mask for element category visibility
public:
// Color options for screen display of the Printed Board:
int m_LayerColor[32]; // Layer colors (tracks and graphic items)
int m_ViaColor[4]; // Via color (depending on is type)
// Pad color for the pads of both sides is m_PadCUColor OR m_PadCMPColor (in terms of colors)
int m_RatsnestColor; // Ratsnest color
public:
EDA_BoardDesignSettings();
/**
* Function GetVisibleLayers
* returns a bit-mask of all the layers that are visible
* @return int - the visible layers in bit-mapped form.
*/
int GetVisibleLayers() const;
/**
* Function SetVisibleLayers
* changes the bit-mask of visible layers
* @param aMask = The new bit-mask of visible layers
*/
void SetVisibleLayers( int aMask );
/**
* Function IsLayerVisible
* 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.
*/
inline bool IsLayerVisible( int aLayerIndex ) const
{
if( aLayerIndex < 0 || aLayerIndex >= 32 ) //@@IMB: Altough Pcbnew uses only 29, Gerbview uses all 32 layers
return false;
// If a layer is disabled, it is automatically invisible
return (bool)( m_VisibleLayers & m_EnabledLayers & 1 << aLayerIndex );
}
/**
* Function SetLayerVisibility
* changes the visibility of a given layer
* @param aLayerIndex = The index of the layer to be changed
* @param aNewState = The new visibility state of the layer
*/
void SetLayerVisibility( int aLayerIndex, bool aNewState );
/**
* Function GetVisibleElements
* returns a bit-mask of all the element categories that are visible
* @return int - the visible element categories in bit-mapped form.
*/
inline int GetVisibleElements() const
{
return m_VisibleElements;
}
/**
* Function SetVisibleElements
* changes the bit-mask of visible element categories
* @param aMask = The new bit-mask of visible element categories
*/
inline void SetVisibleElements( int aMask )
{
m_VisibleElements = aMask;
}
/**
* Function IsElementVisible
* tests whether a given element category is visible
* @param aCategoryIndex = The index of the element category to be tested.
* @return bool - true if the element is visible.
*/
inline bool IsElementVisible( int aCategoryIndex ) const
{
if( aCategoryIndex < 0 || aCategoryIndex > PAD_CMP_VISIBLE )
return false;
return (bool)( m_VisibleElements & 1 << aCategoryIndex );
}
/**
* Function SetElementVisibility
* changes the visibility of an element category
* @param aCategoryIndex = The index of the element category to be changed
* @param aNewState = The new visibility state of the element category
*/
void SetElementVisibility( int aCategoryIndex, bool aNewState );
/**
* Function GetEnabledLayers
* returns a bit-mask of all the layers that are enabled
* @return int - the enabled layers in bit-mapped form.
*/
inline int GetEnabledLayers() const
{
return m_EnabledLayers;
}
/**
* Function SetEnabledLayers
* changes the bit-mask of enabled layers
* @param aMask = The new bit-mask of enabled layers
*/
void SetEnabledLayers( int aMask )
{
// TODO; ensure consistency with m_CopperLayerCount
m_EnabledLayers = aMask;
// A disabled layer cannot be visible
m_VisibleLayers &= aMask;
}
/**
* Function IsLayerEnabled
* tests whether a given layer is enabled
* @param aLayerIndex = The index of the layer to be tested
* @return bool - true if the layer is enabled
*/
inline bool IsLayerEnabled( int aLayerIndex )
{
return (bool)( m_EnabledLayers & 1 << aLayerIndex );
}
/**
* Function GetCopperLayerCount
* @return int - the number of neabled copper layers
*/
inline int GetCopperLayerCount() const
{
return m_CopperLayerCount;
}
/**
* Function SetCopperLayerCount
* do what its name says...
* @param aNewLayerCount = The new number of enabled copper layers
*/
void SetCopperLayerCount( int aNewLayerCount );
};
#endif
// _BOARD_DESIGN_SETTING_H
/**************************************************************/
/* pcbstruct.h : definition des structures de donnees type PCB */
/* pcbstruct.h : some classes and definitions used in pcbnew */
/**************************************************************/
#ifndef PCBSTRUCT_H
......@@ -182,181 +182,6 @@ inline bool IsValidNonCopperLayerIndex( int aLayerIndex )
return aLayerIndex >= FIRST_NO_COPPER_LAYER && aLayerIndex <= LAST_NO_COPPER_LAYER;
}
// Class for handle current printed board design settings
class EDA_BoardDesignSettings
{
public:
int m_CopperLayerCount; // Number of copper layers for this design
int m_ViaDrillCustomValue; // via drill for vias that have a specific drill value
int m_CurrentViaSize; // Current via size
int m_CurrentMicroViaSize; // Current micro via size
bool m_MicroViasAllowed; // true to allow micro vias
int m_CurrentViaType; // via type (VIA_BLIND_BURIED, VIA_TROUGHT VIA_MICROVIA)
int m_CurrentTrackWidth; // current track width
bool m_UseConnectedTrackWidth; // if true, when creating a new track starting on an existing track, use this track width
int m_DrawSegmentWidth; // current graphic line width (not EDGE layer)
int m_EdgeSegmentWidth; // current graphic line width (EDGE layer only)
int m_PcbTextWidth; // current Pcb (not module) Text width
wxSize m_PcbTextSize; // current Pcb (not module) Text size
int m_TrackMinWidth; // track min value for width ((min copper size value
int m_ViasMinSize; // vias (not micro vias) min diameter
int m_ViasMinDrill; // vias (not micro vias) min drill diameter
int m_MicroViasMinSize; // micro vias (not vias) min diameter
int m_MicroViasMinDrill; // micro vias (not vias) min drill diameter
int m_MaskMargin; // Solder mask margin
int m_LayerThickness; // Layer Thickness for 3D viewer
protected:
int m_EnabledLayers; // Bit-mask for layer enabling
int m_VisibleLayers; // Bit-mask for layer visibility
int m_VisibleElements; // Bit-mask for element category visibility
public:
// Color options for screen display of the Printed Board:
int m_LayerColor[32]; // Layer colors (tracks and graphic items)
int m_ViaColor[4]; // Via color (depending on is type)
// Pad color for the pads of both sides is m_PadCUColor OR m_PadCMPColor (in terms of colors)
int m_RatsnestColor; // Ratsnest color
public:
EDA_BoardDesignSettings();
/**
* Function GetVisibleLayers
* returns a bit-mask of all the layers that are visible
* @return int - the visible layers in bit-mapped form.
*/
int GetVisibleLayers() const;
/**
* Function SetVisibleLayers
* changes the bit-mask of visible layers
* @param aMask = The new bit-mask of visible layers
*/
void SetVisibleLayers( int aMask );
/**
* Function IsLayerVisible
* 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.
*/
inline bool IsLayerVisible( int aLayerIndex ) const
{
if( aLayerIndex < 0 || aLayerIndex >= 32 ) //@@IMB: Altough Pcbnew uses only 29, Gerbview uses all 32 layers
return false;
// If a layer is disabled, it is automatically invisible
return (bool)( m_VisibleLayers & m_EnabledLayers & 1 << aLayerIndex );
}
/**
* Function SetLayerVisibility
* changes the visibility of a given layer
* @param aLayerIndex = The index of the layer to be changed
* @param aNewState = The new visibility state of the layer
*/
void SetLayerVisibility( int aLayerIndex, bool aNewState );
/**
* Function GetVisibleElements
* returns a bit-mask of all the element categories that are visible
* @return int - the visible element categories in bit-mapped form.
*/
inline int GetVisibleElements() const
{
return m_VisibleElements;
}
/**
* Function SetVisibleElements
* changes the bit-mask of visible element categories
* @param aMask = The new bit-mask of visible element categories
*/
inline void SetVisibleElements( int aMask )
{
m_VisibleElements = aMask;
}
/**
* Function IsElementVisible
* tests whether a given element category is visible
* @param aCategoryIndex = The index of the element category to be tested.
* @return bool - true if the element is visible.
*/
inline bool IsElementVisible( int aCategoryIndex ) const
{
if( aCategoryIndex < 0 || aCategoryIndex > PAD_CMP_VISIBLE )
return false;
return (bool)( m_VisibleElements & 1 << aCategoryIndex );
}
/**
* Function SetElementVisibility
* changes the visibility of an element category
* @param aCategoryIndex = The index of the element category to be changed
* @param aNewState = The new visibility state of the element category
*/
void SetElementVisibility( int aCategoryIndex, bool aNewState );
/**
* Function GetEnabledLayers
* returns a bit-mask of all the layers that are enabled
* @return int - the enabled layers in bit-mapped form.
*/
inline int GetEnabledLayers() const
{
return m_EnabledLayers;
}
/**
* Function SetEnabledLayers
* changes the bit-mask of enabled layers
* @param aMask = The new bit-mask of enabled layers
*/
void SetEnabledLayers( int aMask )
{
// TODO; ensure consistency with m_CopperLayerCount
m_EnabledLayers = aMask;
// A disabled layer cannot be visible
m_VisibleLayers &= aMask;
}
/**
* Function IsLayerEnabled
* tests whether a given layer is enabled
* @param aLayerIndex = The index of the layer to be tested
* @return bool - true if the layer is enabled
*/
inline bool IsLayerEnabled( int aLayerIndex )
{
return (bool)( m_EnabledLayers & 1 << aLayerIndex );
}
/**
* Function GetCopperLayerCount
* @return int - the number of neabled copper layers
*/
inline int GetCopperLayerCount() const
{
return m_CopperLayerCount;
}
/**
* Function SetCopperLayerCount
* do what its name says...
* @param aNewLayerCount = The new number of enabled copper layers
*/
inline void SetCopperLayerCount( int aNewLayerCount )
{
// TODO; ensure consistency with the m_EnabledLayers member
m_CopperLayerCount = aNewLayerCount;
}
};
// Values for m_DisplayViaMode member:
enum DisplayViaMode {
......
......@@ -14,6 +14,7 @@
#include "autorout.h"
#include "zones.h"
#include "cell.h"
#include "class_board_design_settings.h"
#include "protos.h"
......
......@@ -12,6 +12,7 @@
#include "autorout.h"
#include "cell.h"
#include "zones.h"
#include "class_board_design_settings.h"
#include "protos.h"
......@@ -40,7 +41,7 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
int autoroute_net_code = -1;
wxString msg;
if( g_DesignSettings.m_CopperLayerCount > 1 )
if( g_DesignSettings.GetCopperLayerCount() > 1 )
{
Route_Layer_TOP = ((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP;
Route_Layer_BOTTOM = ((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM;
......
......@@ -16,6 +16,7 @@
#include "bitmaps.h"
#include "protos.h"
#include "pcbnew_id.h"
#include "class_board_design_settings.h"
#include "collectors.h"
#include "class_drawpanel.h"
......@@ -185,7 +186,7 @@ void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
// If only one copper layer is enabled, the only such layer
// that can be selected to is the "Copper" layer (so the
// selection of any other copper layer is disregarded).
if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 )
if( m_Pcb->m_BoardSettings->GetCopperLayerCount() < 2 )
{
if( layer != COPPER_LAYER_N )
{
......@@ -200,7 +201,7 @@ void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
else
{
if( (layer != COPPER_LAYER_N) && (layer != LAYER_CMP_N)
&& (layer >= m_Pcb->m_BoardSettings->m_CopperLayerCount - 1) )
&& (layer >= m_Pcb->m_BoardSettings->GetCopperLayerCount() - 1) )
{
return;
}
......@@ -212,7 +213,7 @@ void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
// and a non-copper layer, or vice-versa?
// ...
((PCB_SCREEN*)GetScreen())->m_Active_Layer = layer;
GetScreen()->m_Active_Layer = layer;
if( DisplayOpt.ContrastModeDisplay )
GetScreen()->SetRefreshReq();
......
......@@ -5,6 +5,7 @@
#include "common.h"
#include "pcbnew.h"
#include "class_board_design_settings.h"
/* This is an odd place for this, but cvpcb won't link if it is
......@@ -264,7 +265,7 @@ LAYER_T LAYER::ParseType( const char* aType )
int BOARD::GetCopperLayerCount() const
{
return m_BoardSettings->m_CopperLayerCount;
return m_BoardSettings->GetCopperLayerCount();
}
int BOARD::GetEnabledLayers() const
......
/***************************************************************************/
/* class_board_design_settings.cpp - EDA_BoardDesignSettings class functions */
/***************************************************************************/
#include "fctsys.h"
#include "common.h"
#include "pcbnew.h"
#include "class_board_design_settings.h"
/*****************************************************/
EDA_BoardDesignSettings::EDA_BoardDesignSettings()
/*****************************************************/
// Default values for designing boards
{
int ii;
static const int default_layer_color[32] =
{
GREEN, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, RED,
LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY,
MAGENTA, CYAN,
LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY,
LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY,
LIGHTGRAY,
LIGHTGRAY,
LIGHTGRAY
};
m_EnabledLayers = ALL_LAYERS; // All layers enabled at first.
// SetCopperLayerCount() will adjust thist.
m_VisibleLayers = 0xffffffff; // IMB: All layers visible at first. TODO: Use a macro for the initial value.
m_VisibleElements = 0x00000fff; // IMB: All elements visible at first. TODO: Use a macro for the initial value.
SetCopperLayerCount( 2 ); // Default design is a double sided board
m_ViaDrillCustomValue = 250; // via drill for vias which must have a defined drill value
m_CurrentViaSize = 450; // Current via size
m_CurrentViaType = VIA_THROUGH; // via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA)
m_CurrentTrackWidth = 170; // current track width
m_UseConnectedTrackWidth = false; // if true, when creating a new track starting on an existing track, use this track width
m_CurrentMicroViaSize = 150; // Current micro via size
m_MicroViasAllowed = false; // true to allow micro vias
m_DrawSegmentWidth = 100; // current graphic line width (not EDGE layer)
m_EdgeSegmentWidth = 100; // current graphic line width (EDGE layer only)
m_PcbTextWidth = 100; // current Pcb (not module) Text width
m_PcbTextSize = wxSize( 500, 500 ); // current Pcb (not module) Text size
m_TrackMinWidth = 80; // track min value for width ((min copper size value
m_ViasMinSize = 350; // vias (not micro vias) min diameter
m_ViasMinDrill = 200; // vias (not micro vias) min drill diameter
m_MicroViasMinSize = 200; // micro vias (not vias) min diameter
m_MicroViasMinDrill = 50; // micro vias (not vias) min drill diameter
m_MaskMargin = 150; // Solder mask margin
/* Color options for screen display of the Printed Board: */
for( ii = 0; ii < 32; ii++ )
m_LayerColor[ii] = default_layer_color[ii];
// Layer colors (tracks and graphic items)
m_ViaColor[VIA_NOT_DEFINED] = DARKGRAY;
m_ViaColor[VIA_MICROVIA] = CYAN;
m_ViaColor[VIA_BLIND_BURIED] = BROWN;
m_ViaColor[VIA_THROUGH] = WHITE;
m_RatsnestColor = WHITE; // Ratsnest color
}
// see pcbstruct.h
int EDA_BoardDesignSettings::GetVisibleLayers() const
{
return m_VisibleLayers;
}
void EDA_BoardDesignSettings::SetVisibleLayers( int aMask )
{
m_VisibleLayers = aMask & m_EnabledLayers & ALL_LAYERS;
}
void EDA_BoardDesignSettings::SetLayerVisibility( int aLayerIndex, bool aNewState )
{
// Altough Pcbnew uses only 29, Gerbview uses all 32 layers
if( aLayerIndex < 0 || aLayerIndex >= 32 )
return;
if( aNewState && IsLayerEnabled( aLayerIndex ))
m_VisibleLayers |= 1 << aLayerIndex;
else
m_VisibleLayers &= ~( 1 << aLayerIndex );
}
void EDA_BoardDesignSettings::SetElementVisibility( int aElementCategory, bool aNewState )
{
if( aElementCategory < 0 || aElementCategory > PAD_CMP_VISIBLE )
return;
if( aNewState )
m_VisibleElements |= 1 << aElementCategory;
else
m_VisibleElements &= ~( 1 << aElementCategory );
}
/**
* Function SetCopperLayerCount
* do what its name says...
* @param aNewLayerCount = The new number of enabled copper layers
*/
void EDA_BoardDesignSettings::SetCopperLayerCount( int aNewLayerCount )
{
m_CopperLayerCount = aNewLayerCount;
// ensure consistency with the m_EnabledLayers member
m_EnabledLayers &= ~ALL_CU_LAYERS;
m_EnabledLayers |= CUIVRE_LAYER;
if ( m_CopperLayerCount > 1 )
m_EnabledLayers |= CMP_LAYER;
for( int ii = 1; ii < aNewLayerCount-1; ii++ )
m_EnabledLayers |= 1 << ii;
}
......@@ -8,6 +8,7 @@
#include "pcbnew.h"
#include "trigo.h"
#include "wxstruct.h"
#include "class_board_design_settings.h"
#include "class_drawpanel.h"
#include "kicad_string.h"
#include "protos.h"
......
......@@ -11,6 +11,7 @@
#include "kicad_string.h"
#include "pcbnew.h"
#include "class_board_design_settings.h"
#include "trigo.h"
#include "protos.h"
......
......@@ -10,13 +10,9 @@
#include "class_drawpanel.h"
#include "confirm.h"
#include "kicad_string.h"
#include "macros.h"
#include "pcbnew.h"
#include "autorout.h"
#include "drag.h"
#include "protos.h"
#include "class_board_design_settings.h"
#define MAX_WIDTH 10000 // Epaisseur (en 1/10000 ") max raisonnable des traits, textes...
......
......@@ -9,6 +9,7 @@
#include "kicad_string.h"
#include "pcbnew.h"
#include "class_board_design_settings.h"
#include "trigo.h"
#include "protos.h"
......
......@@ -14,6 +14,7 @@
#include "pcbcommon.h"
#include "pcbnew.h"
#include "class_board_design_settings.h"
#include "autorout.h"
#include "drag.h"
......
......@@ -29,6 +29,7 @@
#include "common.h"
#include "kicad_string.h"
#include "pcbnew.h"
#include "class_board_design_settings.h"
// This will get mapped to "kicad_default" in the specctra_export.
......
......@@ -7,6 +7,7 @@
#include "common.h"
#include "kicad_string.h"
#include "pcbnew.h"
#include "class_board_design_settings.h"
/*********************************************************/
......
......@@ -11,6 +11,7 @@
#include "drawtxt.h"
#include "pcbnew.h"
#include "class_board_design_settings.h"
/*******************************************************************************************/
......
......@@ -11,6 +11,7 @@
#include "kicad_string.h"
#include "pcbnew.h"
#include "class_board_design_settings.h"
#include "trigo.h"
#include "protos.h"
......
......@@ -12,10 +12,11 @@
#include "drawtxt.h"
#include "kicad_string.h"
#include "pcbcommon.h"
#include "class_board_design_settings.h"
#include "autorout.h"
#include "drag.h"
#include "protos.h"
//#include "autorout.h"
//#include "drag.h"
//#include "protos.h"
/************************************************************************/
......
......@@ -11,6 +11,7 @@
#include "drawtxt.h"
#include "pcbnew.h"
#include "class_board_design_settings.h"
#include "protos.h"
......@@ -862,15 +863,15 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
( (SEGVIA*) this )->ReturnLayerPair( &layer_top, &layer_bottom );
/* lines for the top layer */
RotatePoint( &ax, &ay, layer_top * 3600 / g_DesignSettings.m_CopperLayerCount );
RotatePoint( &bx, &by, layer_top * 3600 / g_DesignSettings.m_CopperLayerCount );
RotatePoint( &ax, &ay, layer_top * 3600 / g_DesignSettings.GetCopperLayerCount( ) );
RotatePoint( &bx, &by, layer_top * 3600 / g_DesignSettings.GetCopperLayerCount( ) );
GRLine( &panel->m_ClipBox, DC, m_Start.x - ax, m_Start.y - ay,
m_Start.x - bx, m_Start.y - by, 0, color );
/* lines for the bottom layer */
ax = 0; ay = rayon; bx = 0; by = drill_rayon;
RotatePoint( &ax, &ay, layer_bottom * 3600 / g_DesignSettings.m_CopperLayerCount );
RotatePoint( &bx, &by, layer_bottom * 3600 / g_DesignSettings.m_CopperLayerCount );
RotatePoint( &ax, &ay, layer_bottom * 3600 / g_DesignSettings.GetCopperLayerCount( ) );
RotatePoint( &bx, &by, layer_bottom * 3600 / g_DesignSettings.GetCopperLayerCount( ) );
GRLine( &panel->m_ClipBox, DC, m_Start.x - ax, m_Start.y - ay,
m_Start.x - bx, m_Start.y - by, 0, color );
}
......
......@@ -13,6 +13,7 @@
#include "PolyLine.h"
#include "pcbnew.h"
#include "zones.h"
#include "class_board_design_settings.h"
#include "protos.h"
......
......@@ -7,6 +7,7 @@
#include "common.h"
#include "pcbnew.h"
#include "class_board_design_settings.h"
#include "trigo.h"
#include "pcbnew_id.h"
......@@ -116,7 +117,7 @@ int PCB_SCREEN::GetInternalUnits( void )
*/
bool PCB_SCREEN::IsMicroViaAcceptable( void )
{
int copperlayercnt = g_DesignSettings.m_CopperLayerCount;
int copperlayercnt = g_DesignSettings.GetCopperLayerCount( );
if( !g_DesignSettings.m_MicroViasAllowed )
return false; // Obvious..
......@@ -124,7 +125,7 @@ bool PCB_SCREEN::IsMicroViaAcceptable( void )
return false; // Only on multilayer boards..
if( ( m_Active_Layer == COPPER_LAYER_N )
|| ( m_Active_Layer == LAYER_CMP_N )
|| ( m_Active_Layer == g_DesignSettings.m_CopperLayerCount - 2 )
|| ( m_Active_Layer == g_DesignSettings.GetCopperLayerCount( ) - 2 )
|| ( m_Active_Layer == LAYER_N_2 ) )
return true;
......@@ -169,110 +170,3 @@ DISPLAY_OPTIONS::DISPLAY_OPTIONS()
DisplayDrawItems = true;
ContrastModeDisplay = false;
}
/*****************************************************/
EDA_BoardDesignSettings::EDA_BoardDesignSettings()
/*****************************************************/
// Default values for designing boards
{
int ii;
static const int default_layer_color[32] =
{
GREEN, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, RED,
LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY,
MAGENTA, CYAN,
LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY,
LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY,
LIGHTGRAY,
LIGHTGRAY,
LIGHTGRAY
};
m_CopperLayerCount = 2; // Default design is a double sided board
m_ViaDrillCustomValue = 250; // via drill for vias which must have a defined drill value
m_CurrentViaSize = 450; // Current via size
m_CurrentViaType = VIA_THROUGH; // via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA)
m_CurrentTrackWidth = 170; // current track width
m_UseConnectedTrackWidth = false; // if true, when creating a new track starting on an existing track, use this track width
m_CurrentMicroViaSize = 150; // Current micro via size
m_MicroViasAllowed = false; // true to allow micro vias
m_DrawSegmentWidth = 100; // current graphic line width (not EDGE layer)
m_EdgeSegmentWidth = 100; // current graphic line width (EDGE layer only)
m_PcbTextWidth = 100; // current Pcb (not module) Text width
m_PcbTextSize = wxSize( 500, 500 ); // current Pcb (not module) Text size
m_TrackMinWidth = 80; // track min value for width ((min copper size value
m_ViasMinSize = 350; // vias (not micro vias) min diameter
m_ViasMinDrill = 200; // vias (not micro vias) min drill diameter
m_MicroViasMinSize = 200; // micro vias (not vias) min diameter
m_MicroViasMinDrill = 50; // micro vias (not vias) min drill diameter
m_MaskMargin = 150; // Solder mask margin
/* Color options for screen display of the Printed Board: */
//@@IMB: Not used m_PcbGridColor = DARKGRAY; // Grid color
m_EnabledLayers = ALL_LAYERS; // All layers enabled at first.
m_VisibleLayers = 0xffffffff; // IMB: All layers visible at first. TODO: Use a macro for the initial value.
m_VisibleElements = 0x00000fff; // IMB: All elements visible at first. TODO: Use a macro for the initial value.
for( ii = 0; ii < 32; ii++ )
m_LayerColor[ii] = default_layer_color[ii];
// Layer colors (tracks and graphic items)
m_ViaColor[VIA_NOT_DEFINED] = DARKGRAY;
m_ViaColor[VIA_MICROVIA] = CYAN;
m_ViaColor[VIA_BLIND_BURIED] = BROWN;
m_ViaColor[VIA_THROUGH] = WHITE;
//@@IMB: Not used m_ModuleTextCMPColor = LIGHTGRAY; // Text module color for modules on the COMPONENT layer
//@@IMB: Not used m_ModuleTextCUColor = MAGENTA; // Text module color for modules on the COPPER layer
//@@IMB: Not used m_ModuleTextNOVColor = DARKGRAY; // Text module color for "invisible" texts (must be BLACK if really not displayed)
//@@IMB: Not used m_AnchorColor = BLUE; // Anchor color for modules and texts
//@@IMB: Not used m_PadCUColor = GREEN; // Pad color for the COMPONENT side of the pad
//@@IMB: Not used m_PadCMPColor = RED; // Pad color for the COPPER side of the pad
m_RatsnestColor = WHITE; // Ratsnest color
}
// see pcbstruct.h
int EDA_BoardDesignSettings::GetVisibleLayers() const
{
return m_VisibleLayers;
}
void EDA_BoardDesignSettings::SetVisibleLayers( int aMask )
{
m_VisibleLayers = aMask & m_EnabledLayers & ALL_LAYERS;
}
void EDA_BoardDesignSettings::SetLayerVisibility( int aLayerIndex, bool aNewState )
{
// Altough Pcbnew uses only 29, Gerbview uses all 32 layers
if( aLayerIndex < 0 || aLayerIndex >= 32 )
return;
if( aNewState && IsLayerEnabled( aLayerIndex ))
m_VisibleLayers |= 1 << aLayerIndex;
else
m_VisibleLayers &= ~( 1 << aLayerIndex );
}
void EDA_BoardDesignSettings::SetElementVisibility( int aElementCategory, bool aNewState )
{
if( aElementCategory < 0 || aElementCategory > PAD_CMP_VISIBLE )
return;
if( aNewState )
m_VisibleElements |= 1 << aElementCategory;
else
m_VisibleElements &= ~( 1 << aElementCategory );
}
......@@ -7,6 +7,7 @@
#include "class_drawpanel.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
/* Routines Locales */
static void Exit_EditCotation( WinEDA_DrawPanel* Panel, wxDC* DC );
......
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_design_rules.cpp
// Author: jean-pierre Charras
/////////////////////////////////////////////////////////////////////////////
/* functions relatives to the design rules editor
*/
#include "fctsys.h"
#include "common.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "pcbnew_id.h"
#include "dialog_copper_layers_setup.h"
#include "wx/generic/gridctrl.h"
// Fields Positions on layer grid
#define LAYERS_GRID_ROUTABLE_POSITION 0
#define LAYERS_GRID_STATUS_POSITION 1
#define LAYERS_GRID_NAME_POSITION 2
/***********************************************************************************/
DIALOG_COPPER_LAYERS_SETUP::DIALOG_COPPER_LAYERS_SETUP( WinEDA_PcbFrame* parent ) :
DIALOG_COPPER_LAYERS_SETUP_BASE( parent )
/***********************************************************************************/
{
m_Parent = parent;
Init();
SetAutoLayout( true );
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
}
/********************************************************************/
void DIALOG_COPPER_LAYERS_SETUP::Init()
/********************************************************************/
{
SetFocus();
SetReturnCode( 0 );
// Initialize the layers grid:
m_ActivesLayersCount = g_DesignSettings.m_CopperLayerCount;
m_Pcb = m_Parent->GetBoard();
m_LayersCountSelection->SetSelection( m_ActivesLayersCount / 2 );
// Initialize the Routable column
SetRoutableLayerStatus();
// Initialize the Status column (layers attribute)
LAYER_T typelist[4] = { LT_SIGNAL, LT_POWER, LT_MIXED, LT_JUMPER };
for( int ii = 0; ii < 4; ii++ )
{
m_LayersType[ii] = typelist[ii];
m_LayersTypeName[ii] = CONV_FROM_UTF8( LAYER::ShowType( typelist[ii] ) );
}
for( int ii = 0; ii < m_gridLayersProperties->GetNumberRows(); ii++ )
{
m_gridLayersProperties->SetCellEditor( ii, LAYERS_GRID_STATUS_POSITION,
new wxGridCellChoiceEditor( WXSIZEOF(
m_LayersTypeName ),
m_LayersTypeName ) );
int select = LT_SIGNAL;
for( int jj = 0; jj < 4; jj++ )
{
int layer = LAYER_CMP_N - ii;
if( m_Pcb->GetLayerType( layer ) == m_LayersType[jj] )
{
select = m_LayersType[jj];
break;
}
}
m_gridLayersProperties->SetCellValue( ii, LAYERS_GRID_STATUS_POSITION,
m_LayersTypeName[select] );
m_gridLayersProperties->SetCellOverflow( ii, LAYERS_GRID_STATUS_POSITION, false );
}
// Initialize the Name column
for( int ii = 0; ii < m_gridLayersProperties->GetNumberRows(); ii++ )
{
wxString layer_name = m_Pcb->GetLayerName( LAYER_CMP_N - ii );
m_gridLayersProperties->SetCellValue( ii, LAYERS_GRID_NAME_POSITION, layer_name );
}
}
/* Initialize the Routable column, and the R/W property of some cells
*/
void DIALOG_COPPER_LAYERS_SETUP::SetRoutableLayerStatus()
{
m_gridLayersProperties->SetColFormatBool( LAYERS_GRID_ROUTABLE_POSITION );
for( int ii = 0; ii < m_gridLayersProperties->GetNumberRows(); ii++ )
{
int layer = LAYER_CMP_N - ii;
wxString value = layer < (m_ActivesLayersCount - 1) ? wxT( "1" ) : wxT( "0" );
if( m_ActivesLayersCount > 1 && layer == LAYER_CMP_N )
value = wxT( "1" );
if( layer == COPPER_LAYER_N )
value = wxT( "1" );
m_gridLayersProperties->SetCellValue( ii, LAYERS_GRID_ROUTABLE_POSITION, value );
m_gridLayersProperties->SetReadOnly( ii, LAYERS_GRID_ROUTABLE_POSITION );
// Set to Read Only cell for non existing copper layers:
m_gridLayersProperties->SetReadOnly( ii, LAYERS_GRID_STATUS_POSITION, value != wxT( "1" ) );
m_gridLayersProperties->SetReadOnly( ii, LAYERS_GRID_NAME_POSITION, value != wxT( "1" ) );
}
}
/*****************************************************************/
void DIALOG_COPPER_LAYERS_SETUP::OnCancelButtonClick( wxCommandEvent& event )
/*****************************************************************/
{
EndModal( 0 );
}
/**************************************************************************/
void DIALOG_COPPER_LAYERS_SETUP::OnOkButtonClick( wxCommandEvent& event )
/**************************************************************************/
{
if( !TestDataValidity() )
{
DisplayError( this, _( "Errors detected, Abort" ) );
return;
}
g_DesignSettings.m_CopperLayerCount = m_ActivesLayersCount;
// Initialize the new layer name
for( int ii = 0; ii < m_gridLayersProperties->GetNumberRows(); ii++ )
{
wxString layer_name = m_gridLayersProperties->GetCellValue( ii, LAYERS_GRID_NAME_POSITION );
if( layer_name != m_Pcb->GetLayerName( LAYER_CMP_N - ii ) )
{
m_Pcb->SetLayerName( LAYER_CMP_N - ii, layer_name );
}
}
// Initialize the layer type
for( int ii = 0; ii < m_gridLayersProperties->GetNumberRows(); ii++ )
{
wxString txt = m_gridLayersProperties->GetCellValue( ii, LAYERS_GRID_STATUS_POSITION );
int layer = LAYER_CMP_N - ii;
for( int jj = 0; jj < 3; jj++ )
{
if( m_LayersTypeName[jj] == txt )
{
m_Pcb->SetLayerType( layer, m_LayersType[jj] );
break;
}
}
}
m_Parent->ReCreateLayerBox( NULL );
EndModal( wxID_OK );
}
/**************************************************************************/
void DIALOG_COPPER_LAYERS_SETUP::OnLayerCountClick( wxCommandEvent& event )
/**************************************************************************/
{
m_ActivesLayersCount = m_LayersCountSelection->GetSelection() * 2;
if( m_ActivesLayersCount <= 0 )
m_ActivesLayersCount = 1;
// Reinit the routable layers status
SetRoutableLayerStatus();
}
/* TestDataValidity
* Performs a control of data validity
* set the background of a bad cell in RED and display an info message
* @return true if Ok, false if error
*/
bool DIALOG_COPPER_LAYERS_SETUP::TestDataValidity()
{
bool success = true;
m_MessagesList->SetPage(wxEmptyString); // Clear message list
// Test duplicate layers names
for( int ii = 0; ii < m_gridLayersProperties->GetNumberRows() - 1; ii++ )
{
wxString value = m_gridLayersProperties->GetCellValue( ii, LAYERS_GRID_NAME_POSITION );
for( int jj = ii+1; jj < m_gridLayersProperties->GetNumberRows(); jj++ )
{
wxString othervalue = m_gridLayersProperties->GetCellValue( ii,
LAYERS_GRID_NAME_POSITION );
othervalue = m_gridLayersProperties->GetCellValue( jj, LAYERS_GRID_NAME_POSITION );
if( value.CmpNoCase( othervalue ) == 0 ) // Already exists!
{
wxString text;
text.Printf( _(
"<small>This layer name <b>%s</b> is already existing<br>" ),
GetChars( value ) );
m_MessagesList->AppendToPage( text );
success = false;
}
}
}
return success;
}
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_COPPER_LAYERS_SETUP
///////////////////////////////////////////////////////////////////////////////
#ifndef __dialog_design_rules_h_
#define __dialog_design_rules_h_
#include "dialog_copper_layers_setup_base.h"
class DIALOG_COPPER_LAYERS_SETUP : public DIALOG_COPPER_LAYERS_SETUP_BASE
{
private:
WinEDA_PcbFrame * m_Parent;
int m_ActivesLayersCount;
BOARD * m_Pcb;
LAYER_T m_LayersType[4];
wxString m_LayersTypeName[4];
private:
void OnCancelButtonClick( wxCommandEvent& event );
void OnOkButtonClick( wxCommandEvent& event );
void OnLayerCountClick( wxCommandEvent& event );
void OnLayerGridLeftClick( wxGridEvent& event ){ event.Skip(); }
void OnLayerGridRighttClick( wxGridEvent& event ){ event.Skip(); }
void Init();
void SetRoutableLayerStatus( );
bool TestDataValidity();
public:
DIALOG_COPPER_LAYERS_SETUP( WinEDA_PcbFrame* parent );
~DIALOG_COPPER_LAYERS_SETUP( ) { };
};
#endif //__dialog_design_rules_h_
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_copper_layers_setup_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_COPPER_LAYERS_SETUP_BASE::DIALOG_COPPER_LAYERS_SETUP_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bMainSizerLayers;
bMainSizerLayers = new wxBoxSizer( wxHORIZONTAL );
wxString m_LayersCountSelectionChoices[] = { _("1"), _("2"), _("4"), _("6"), _("8"), _("10"), _("12"), _("14"), _("16") };
int m_LayersCountSelectionNChoices = sizeof( m_LayersCountSelectionChoices ) / sizeof( wxString );
m_LayersCountSelection = new wxRadioBox( this, ID_LAYERS_COUNT_SELECTION, _("Layers Count"), wxDefaultPosition, wxDefaultSize, m_LayersCountSelectionNChoices, m_LayersCountSelectionChoices, 1, wxRA_SPECIFY_COLS );
m_LayersCountSelection->SetSelection( 1 );
bMainSizerLayers->Add( m_LayersCountSelection, 0, wxALL, 5 );
m_gridLayersProperties = new wxGrid( this, ID_LAYERS_PROPERTIES, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_gridLayersProperties->CreateGrid( 16, 3 );
m_gridLayersProperties->EnableEditing( true );
m_gridLayersProperties->EnableGridLines( true );
m_gridLayersProperties->EnableDragGridSize( false );
m_gridLayersProperties->SetMargins( 0, 0 );
// Columns
m_gridLayersProperties->SetColSize( 0, 100 );
m_gridLayersProperties->SetColSize( 1, 100 );
m_gridLayersProperties->SetColSize( 2, 150 );
m_gridLayersProperties->EnableDragColMove( false );
m_gridLayersProperties->EnableDragColSize( true );
m_gridLayersProperties->SetColLabelSize( 30 );
m_gridLayersProperties->SetColLabelValue( 0, _("Active") );
m_gridLayersProperties->SetColLabelValue( 1, _("Status") );
m_gridLayersProperties->SetColLabelValue( 2, _("Name") );
m_gridLayersProperties->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_gridLayersProperties->AutoSizeRows();
m_gridLayersProperties->EnableDragRowSize( true );
m_gridLayersProperties->SetRowLabelSize( 80 );
m_gridLayersProperties->SetRowLabelValue( 0, _("Top Layer") );
m_gridLayersProperties->SetRowLabelValue( 1, _("Inner 14") );
m_gridLayersProperties->SetRowLabelValue( 2, _("Inner 13") );
m_gridLayersProperties->SetRowLabelValue( 3, _("Inner 12") );
m_gridLayersProperties->SetRowLabelValue( 4, _("Inner 11") );
m_gridLayersProperties->SetRowLabelValue( 5, _("Inner 10") );
m_gridLayersProperties->SetRowLabelValue( 6, _("Inner 9") );
m_gridLayersProperties->SetRowLabelValue( 7, _("Inner 8") );
m_gridLayersProperties->SetRowLabelValue( 8, _("Inner 7") );
m_gridLayersProperties->SetRowLabelValue( 9, _("Inner 6") );
m_gridLayersProperties->SetRowLabelValue( 10, _("Inner 5") );
m_gridLayersProperties->SetRowLabelValue( 11, _("Inner 4") );
m_gridLayersProperties->SetRowLabelValue( 12, _("Inner 3") );
m_gridLayersProperties->SetRowLabelValue( 13, _("Inner 2") );
m_gridLayersProperties->SetRowLabelValue( 14, _("Inner 1") );
m_gridLayersProperties->SetRowLabelValue( 15, _("Bottom Layer") );
m_gridLayersProperties->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_gridLayersProperties->SetDefaultCellAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
bMainSizerLayers->Add( m_gridLayersProperties, 1, wxALL|wxEXPAND, 5 );
bMainSizer->Add( bMainSizerLayers, 1, wxEXPAND, 5 );
wxStaticBoxSizer* sbSizer1;
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Messages:") ), wxVERTICAL );
m_MessagesList = new wxHtmlWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO );
m_MessagesList->SetMinSize( wxSize( -1,150 ) );
sbSizer1->Add( m_MessagesList, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bMainSizer->Add( sbSizer1, 0, wxEXPAND, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
bMainSizer->Add( m_sdbSizer1, 0, wxALIGN_RIGHT, 5 );
this->SetSizer( bMainSizer );
this->Layout();
// Connect Events
m_LayersCountSelection->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_COPPER_LAYERS_SETUP_BASE::OnLayerCountClick ), NULL, this );
m_gridLayersProperties->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_COPPER_LAYERS_SETUP_BASE::OnLayerGridLeftClick ), NULL, this );
m_gridLayersProperties->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( DIALOG_COPPER_LAYERS_SETUP_BASE::OnLayerGridRighttClick ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_LAYERS_SETUP_BASE::OnCancelButtonClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_LAYERS_SETUP_BASE::OnOkButtonClick ), NULL, this );
}
DIALOG_COPPER_LAYERS_SETUP_BASE::~DIALOG_COPPER_LAYERS_SETUP_BASE()
{
// Disconnect Events
m_LayersCountSelection->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_COPPER_LAYERS_SETUP_BASE::OnLayerCountClick ), NULL, this );
m_gridLayersProperties->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_COPPER_LAYERS_SETUP_BASE::OnLayerGridLeftClick ), NULL, this );
m_gridLayersProperties->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( DIALOG_COPPER_LAYERS_SETUP_BASE::OnLayerGridRighttClick ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_LAYERS_SETUP_BASE::OnCancelButtonClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_LAYERS_SETUP_BASE::OnOkButtonClick ), NULL, this );
}
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_copper_layers_setup_base__
#define __dialog_copper_layers_setup_base__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/radiobox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/grid.h>
#include <wx/sizer.h>
#include <wx/html/htmlwin.h>
#include <wx/statbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
#define ID_LAYERS_COUNT_SELECTION 1000
#define ID_LAYERS_PROPERTIES 1001
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_COPPER_LAYERS_SETUP_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_COPPER_LAYERS_SETUP_BASE : public wxDialog
{
private:
protected:
wxRadioBox* m_LayersCountSelection;
wxGrid* m_gridLayersProperties;
wxHtmlWindow* m_MessagesList;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
virtual void OnLayerCountClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnLayerGridLeftClick( wxGridEvent& event ){ event.Skip(); }
virtual void OnLayerGridRighttClick( wxGridEvent& event ){ event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnOkButtonClick( wxCommandEvent& event ){ event.Skip(); }
public:
DIALOG_COPPER_LAYERS_SETUP_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Copper layers setup"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 558,598 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_COPPER_LAYERS_SETUP_BASE();
};
#endif //__dialog_copper_layers_setup_base__
......@@ -37,6 +37,7 @@
#include "confirm.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "pcbnew_id.h"
#include "dialog_design_rules.h"
......
......@@ -11,6 +11,7 @@
#include "dialog_drc.h"
#include "common.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
/* class DIALOG_DRC_CONTROL: a dialog to set DRC parameters (clearance, min cooper size)
* and run DRC tests
......
......@@ -3,8 +3,8 @@
// Author: jean-pierre Charras
/////////////////////////////////////////////////////////////////////////////
/* functions relatives to the dialogs opened from the main menu :
Prefernces/general
Prefernces/display
Preferences/general
Preferences/display
*/
#include "fctsys.h"
#include "common.h"
......@@ -12,6 +12,7 @@
#include "confirm.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "pcbnew_id.h"
......
......@@ -17,6 +17,7 @@
#include "class_drawpanel.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "dialog_graphic_item_properties_base.h"
......
......@@ -10,6 +10,7 @@
#include "confirm.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "pcbnew_id.h"
......@@ -259,7 +260,7 @@ void DialogLayerSetup::SetLayerType( int Layer, LAYER_T Type )
//==============================================================================
// The layer mask for non-copper layers is obtained from the new
// EDA_BoardDesignSettings::m*EnabledLayers, but for compatibility, the mask
// EDA_BoardDesignSettings::m_EnabledLayers, but for compatibility, the mask
// for the copper-layers is obtained from g_DesignSettings::m_CopperLayerCount
// Hopefully in the future we may unify them, perhaps saving only the mask and
......@@ -279,7 +280,7 @@ int DialogLayerSetup::GetLayersMask()
else
Aux /= 2;
return CopperMasks[Aux] | m_Pcb->GetEnabledLayers() & ALL_NO_CU_LAYERS;
return CopperMasks[Aux] | ( m_Pcb->GetEnabledLayers() & ALL_NO_CU_LAYERS );
}
//==============================================================================
......@@ -997,7 +998,7 @@ void DialogLayerSetup::OnOKClick( wxCommandEvent& event )
NumberOfCopperLayers++;
}
m_Pcb->m_BoardSettings->m_CopperLayerCount = NumberOfCopperLayers;
m_Pcb->m_BoardSettings->SetCopperLayerCount( NumberOfCopperLayers );
m_Pcb->SetEnabledLayers( m_LayersMask );
......
......@@ -12,6 +12,7 @@
#include "confirm.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "dialog_track_options.h"
#include <algorithm>
......
......@@ -37,6 +37,7 @@
#include "autorout.h"
#include "trigo.h"
#include "gestfich.h"
#include "class_board_design_settings.h"
#include "protos.h"
......@@ -771,7 +772,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
// test:
if( layer1 == COPPER_LAYER_N && layer2 == LAYER_N_2 )
err = false;
if( layer1 == (g_DesignSettings.m_CopperLayerCount - 2 ) && layer2 == LAYER_CMP_N )
if( layer1 == (g_DesignSettings.GetCopperLayerCount() - 2 ) && layer2 == LAYER_CMP_N )
err = false;
if( err )
{
......
......@@ -12,6 +12,7 @@
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "autorout.h"
#include "protos.h"
......@@ -1105,7 +1106,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
// If only one copper layer is enabled, the only such layer
// that can be selected to is the "Copper" layer (so the
// selection of any other copper layer is disregarded).
if( GetBoard()->m_BoardSettings->m_CopperLayerCount < 2 )
if( GetBoard()->m_BoardSettings->GetCopperLayerCount() < 2 )
{
if( layer != COPPER_LAYER_N )
{
......@@ -1124,7 +1125,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
else
{
if( (layer != COPPER_LAYER_N) && (layer != LAYER_CMP_N)
&& (layer >= GetBoard()->m_BoardSettings->m_CopperLayerCount - 1) )
&& (layer >= GetBoard()->m_BoardSettings->GetCopperLayerCount() - 1) )
{
// Uncomment following command (and line 17) to beep
// the speaker. (Doing that would provide feedback to
......
......@@ -9,6 +9,7 @@
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "protos.h"
......
......@@ -10,6 +10,7 @@
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "protos.h"
......
......@@ -11,6 +11,7 @@
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "protos.h"
......
......@@ -10,6 +10,7 @@
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "protos.h"
......@@ -204,10 +205,11 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
if ( old_layer == COPPER_LAYER_N )
((PCB_SCREEN*)GetScreen())->m_Active_Layer = LAYER_N_2;
else if ( old_layer == LAYER_CMP_N )
((PCB_SCREEN*)GetScreen())->m_Active_Layer = GetBoard()->m_BoardSettings->m_CopperLayerCount - 2;
((PCB_SCREEN*)GetScreen())->m_Active_Layer =
GetBoard()->m_BoardSettings->GetCopperLayerCount() - 2;
else if ( old_layer == LAYER_N_2 )
((PCB_SCREEN*)GetScreen())->m_Active_Layer = COPPER_LAYER_N;
else if ( old_layer == GetBoard()->m_BoardSettings->m_CopperLayerCount - 2 )
else if ( old_layer == GetBoard()->m_BoardSettings->GetCopperLayerCount() - 2 )
((PCB_SCREEN*)GetScreen())->m_Active_Layer = LAYER_CMP_N;
// else error
via->SetLayerPair( old_layer, ((PCB_SCREEN*)GetScreen())->m_Active_Layer );
......
......@@ -9,6 +9,7 @@
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "drc_stuff.h"
#include "trigo.h"
......
......@@ -14,6 +14,7 @@
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
/** Function Tracks_and_Vias_Size_Event
* Event handler for tracks and vias size selection (and some options)
......
......@@ -18,6 +18,7 @@ using namespace std;
#include "pcbnew.h"
#include "pcbplot.h"
#include "macros.h"
#include "class_board_design_settings.h"
#include "gendrill.h"
/**********************************************************************************/
......@@ -394,7 +395,7 @@ void GenDrillReportFile( FILE* aFile, BOARD* aPcb, const wxString& aBoardFilenam
sprintf( line, "\ntotal holes count %d\n\n\n", TotalHoleCount );
fputs( line, aFile );
if( g_DesignSettings.m_CopperLayerCount <= 2 )
if( g_DesignSettings.GetCopperLayerCount() <= 2 )
break;
if( gen_through_holes )
......@@ -404,7 +405,7 @@ void GenDrillReportFile( FILE* aFile, BOARD* aPcb, const wxString& aBoardFilenam
if( layer2 >= LAYER_CMP_N ) // no more layer pair to consider
break;
layer1++; layer2++; // use next layer pair
if( layer2 == g_DesignSettings.m_CopperLayerCount - 1 ) // The last layer is reached
if( layer2 == g_DesignSettings.GetCopperLayerCount() - 1 ) // The last layer is reached
layer2 = LAYER_CMP_N; // the last layer is always the component layer
}
gen_through_holes = false;
......
......@@ -18,6 +18,7 @@
#include "pcbplot.h"
#include "macros.h"
#include "appl_wxstruct.h"
#include "class_board_design_settings.h"
#include "gendrill.h"
......@@ -364,7 +365,7 @@ void WinEDA_DrillFrame::GenDrillFiles( wxCommandEvent& event )
layer1++;
layer2++; // use next layer pair
if( layer2 == g_DesignSettings.m_CopperLayerCount - 1 )
if( layer2 == g_DesignSettings.GetCopperLayerCount() - 1 )
layer2 = LAYER_CMP_N; // the last layer is always the component layer
}
......
......@@ -9,6 +9,7 @@
#include "pcbnew_id.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "class_board_design_settings.h"
#include "hotkeys.h"
#include "protos.h"
......@@ -189,11 +190,11 @@ void WinEDA_PcbFrame::OnHotKey(wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct)
ll = GetScreen()->m_Active_Layer;
if ((ll <= COPPER_LAYER_N) || (ll > CMP_N))
break;
if (GetBoard()->m_BoardSettings->m_CopperLayerCount < 2) // Single layer
if (GetBoard()->m_BoardSettings->GetCopperLayerCount() < 2) // Single layer
ll = COPPER_LAYER_N;
else if (ll == CMP_N)
ll = MAX(COPPER_LAYER_N,
GetBoard()->m_BoardSettings->m_CopperLayerCount - 2);
GetBoard()->m_BoardSettings->GetCopperLayerCount() - 2);
else
ll--;
SwitchLayer(DC, ll);
......@@ -203,9 +204,9 @@ void WinEDA_PcbFrame::OnHotKey(wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct)
ll = GetScreen()->m_Active_Layer;
if ((ll < COPPER_LAYER_N) || (ll >= CMP_N))
break;
if (GetBoard()->m_BoardSettings->m_CopperLayerCount < 2) // Single layer
if (GetBoard()->m_BoardSettings->GetCopperLayerCount() < 2) // Single layer
ll = COPPER_LAYER_N;
else if (ll >= GetBoard()->m_BoardSettings->m_CopperLayerCount - 2)
else if (ll >= GetBoard()->m_BoardSettings->GetCopperLayerCount() - 2)
ll = CMP_N;
else
ll++;
......
......@@ -9,6 +9,7 @@
#include "confirm.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "protos.h"
......@@ -175,10 +176,13 @@ bool WinEDA_PcbFrame::Clear_Pcb( bool aQuery )
GetScreen()->SetGrid( gridsize );
g_HightLigt_Status = 0;
// Enable all layers (SetCopperLayerCount() will adjust the copper layers enabled)
g_DesignSettings.SetEnabledLayers(ALL_LAYERS);
// Default copper layers count set to 2: double layer board
g_DesignSettings.m_CopperLayerCount = 2;
g_DesignSettings.SetCopperLayerCount(2);
// Update display:
g_DesignSettings.SetVisibleLayers( ALL_LAYERS );
SetToolbars();
Zoom_Automatique( true );
......
......@@ -13,6 +13,7 @@
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#ifdef PCBNEW
#include "autorout.h"
......@@ -232,13 +233,14 @@ int WinEDA_BasePcbFrame::ReadGeneralDescrPcb( FILE* File, int* LineNum )
sscanf( data, "%X", &Masque_Layer );
// Setup layer count
GetBoard()->m_BoardSettings->m_CopperLayerCount = 0;
int layer_count = 0;
for( ii = 0; ii < NB_COPPER_LAYERS; ii++ )
{
if( Masque_Layer & 1 )
GetBoard()->m_BoardSettings->m_CopperLayerCount++;
layer_count++;
Masque_Layer >>= 1;
}
GetBoard()->m_BoardSettings->SetCopperLayerCount( layer_count );
continue;
}
......@@ -363,7 +365,7 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
{
int tmp;
sscanf( data, "%d", &tmp );
GetBoard()->m_BoardSettings->m_CopperLayerCount = tmp;
GetBoard()->m_BoardSettings->SetCopperLayerCount( tmp );
continue;
}
......@@ -673,7 +675,7 @@ bool WinEDA_PcbFrame::WriteGeneralDescrPcb( FILE* File )
int NbModules, NbDrawItem, NbLayers;
/* Write copper layer count */
NbLayers = GetBoard()->m_BoardSettings->m_CopperLayerCount;
NbLayers = GetBoard()->m_BoardSettings->GetCopperLayerCount();
fprintf( File, "$GENERAL\n" );
fprintf( File, "LayerCount %d\n", NbLayers );
......
......@@ -7,6 +7,7 @@
#include "common.h"
#include "pcbnew.h"
#include "class_board_design_settings.h"
#include "protos.h"
......
......@@ -12,6 +12,7 @@
#include "common.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "protos.h"
#include "pcbnew_id.h"
......
......@@ -8,6 +8,7 @@
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "protos.h"
......@@ -22,11 +23,6 @@ static MIREPCB s_TargetCopy( NULL ); /* Used to store "old" values of the c
* parameters before edition (used in undo/redo or cancel operations)
*/
enum id_mire_properties {
ID_SIZE_MIRE = 1900, // (Not currently used anywhere else)
ID_LISTBOX_SHAPE_MIRE
};
/************************************/
/* class WinEDA_MirePropertiesFrame */
/************************************/
......@@ -116,7 +112,7 @@ WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent,
// Shape
wxString shape_list[2] = { _( "shape +" ), _( "shape X" ) };
m_MireShape = new wxRadioBox( this, ID_LISTBOX_SHAPE_MIRE,
m_MireShape = new wxRadioBox( this, wxID_ANY,
_( "Target Shape:" ),
wxDefaultPosition, wxSize( -1, -1 ),
2, shape_list, 1 );
......
......@@ -13,6 +13,7 @@
#include "gestfich.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "protos.h"
/* Fonctions locales */
......
......@@ -11,17 +11,15 @@
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
//#include "autorout.h"
#include "pcbnew_id.h"
#include "hotkeys.h"
#include "collectors.h"
//#include "protos.h"
/* Bitmaps */
#include "bitmaps.h"
static wxMenu* Append_Track_Width_List( BOARD * aBoard );
......
......@@ -12,13 +12,13 @@
#include "gestfich.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "pcbplot.h"
#include "pcbnew_config.h"
#include "worksheet.h"
#include "pcbnew_id.h"
#include "hotkeys.h"
#include "protos.h"
//#include "dialog_copper_layers_setup.h"
/* Routines Locales */
......
......@@ -13,6 +13,7 @@
#include "pcbnew.h"
#include "pcbplot.h"
#include "trigo.h"
#include "class_board_design_settings.h"
/* Fonctions locales */
......
......@@ -8,6 +8,7 @@
#include "class_drawpanel.h"
#include "pcbnew.h"
#include "class_board_design_settings.h"
#include "pcbplot.h"
#include "protos.h"
......
......@@ -10,6 +10,7 @@
#include "confirm.h"
#include "pcbnew.h"
#include "autorout.h"
#include "class_board_design_settings.h"
#include "protos.h"
......
......@@ -7,13 +7,10 @@
#include "confirm.h"
#include "pcbnew.h"
#include "class_board_design_settings.h"
#include "protos.h"
/* Variables locales */
/* Fonctions locales: */
enum layer_sel_id {
ID_LAYER_SELECT_TOP = 1800,
ID_LAYER_SELECT_BOTTOM,
......@@ -111,7 +108,7 @@ WinEDA_SelLayerFrame::WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent,
/* Build the layer list */
LayerCount = 0;
int Masque_Layer = g_TabAllCopperLayerMask[g_DesignSettings.m_CopperLayerCount - 1];
int Masque_Layer = g_TabAllCopperLayerMask[g_DesignSettings.GetCopperLayerCount( ) - 1];
Masque_Layer += ALL_NO_CU_LAYERS;
for( ii = 0; ii < NB_LAYERS; ii++ )
{
......@@ -231,7 +228,7 @@ void WinEDA_BasePcbFrame::SelectLayerPair()
// Check whether more than one copper layer has been enabled for the
// current PCB file, as Layer Pairs can only meaningfully be defined
// within PCB files which contain at least two copper layers.
if( GetBoard()->m_BoardSettings->m_CopperLayerCount < 2 )
if( GetBoard()->m_BoardSettings->GetCopperLayerCount( ) < 2 )
{
wxString InfoMsg;
InfoMsg = _( "Less than two copper layers are being used." );
......@@ -273,7 +270,7 @@ WinEDA_SelLayerPairFrame::WinEDA_SelLayerPairFrame( WinEDA_BasePcbFrame* parent
PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->GetScreen();
/* Construction de la liste des couches autoris�s */
int Masque_Layer = g_TabAllCopperLayerMask[g_DesignSettings.m_CopperLayerCount - 1];
int Masque_Layer = g_TabAllCopperLayerMask[g_DesignSettings.GetCopperLayerCount( ) - 1];
Masque_Layer += ALL_NO_CU_LAYERS;
for( ii = 0, LayerCount = 0; ii < NB_COPPER_LAYERS; ii++ )
{
......
......@@ -12,6 +12,7 @@
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
//#include "protos.h"
......
......@@ -12,6 +12,7 @@
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "autorout.h"
#include "zones.h"
#include "protos.h"
......@@ -418,7 +419,7 @@ static int Autoroute_One_Track( WinEDA_PcbFrame* pcbframe, wxDC* DC,
/* Test du cas trivial: connection directe par superposition des pads */
if( (row_source == row_target) && (col_source == col_target)
&& ( pad_masque_layer_e & pad_masque_layer_s &
g_TabAllCopperLayerMask[g_DesignSettings.m_CopperLayerCount - 1]) )
g_TabAllCopperLayerMask[g_DesignSettings.GetCopperLayerCount() - 1]) )
{
result = TRIVIAL_SUCCESS;
goto end_of_route;
......
......@@ -39,6 +39,7 @@
#include "confirm.h" // DisplayError()
#include "gestfich.h" // EDA_FileSelector()
#include "autorout.h" // NET_CODES_OK
#include "class_board_design_settings.h"
#include "trigo.h" // RotatePoint()
#include <set> // std::set
......
......@@ -7,6 +7,7 @@
#include "common.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "bitmaps.h"
......
......@@ -16,6 +16,7 @@
#include "pcbnew_id.h"
#include "drc_stuff.h"
#include "3d_viewer.h"
#include "class_board_design_settings.h"
/* helper to convert an integer value to a string, using mils or mm
* according to g_UnitMetric value
......
......@@ -8,6 +8,7 @@
#include "confirm.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "pcbnew_id.h"
......
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