code and files cleanup

This commit is contained in:
charras 2009-10-28 11:48:47 +00:00
parent 4a5151969d
commit e027e65971
71 changed files with 710 additions and 1440 deletions

View File

@ -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 )
@ -406,7 +407,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawSegment( DRAWSEGMENT* segment )
double zpos, w;
int layer = segment->GetLayer();
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
return;

View File

@ -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

View File

@ -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] = {

View File

@ -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

View File

@ -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 );

View File

@ -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"

View File

@ -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 );
}

View File

@ -16,6 +16,7 @@
#include "gerbview.h"
#include "pcbnew.h"
#include "class_board_design_settings.h"
#include "protos.h"
@ -443,7 +444,7 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings()
g_DCodesColor = CurrentColor[33];
DisplayOpt.DisplayPadNum = laytool_list[33]->m_CheckBox->GetValue();
// Additional command required for updating visibility of grid.
m_Parent->m_Draw_Grid = s_showGrid;
}

View File

@ -1,26 +1,21 @@
/*****************************************/
/* Routines generales d'affichage du PCB */
/*****************************************/
/* fichier TRACEPCB.CPP */
/****************/
/* tracepcb.cpp */
/****************/
/*
* Routines d'affichage grille, Boite de coordonnees, Curseurs, marqueurs ...
* Redraw the screen.
*/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "class_drawpanel.h"
#include "drawtxt.h"
#include "gerbview.h"
#include "pcbplot.h"
#include "protos.h"
/* Externes */
/* Variables Locales */
#include "class_board_design_settings.h"
/************************************************************************************************************/
@ -106,6 +101,7 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
{
}
/***********************************************************************************/
void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklayer )
/***********************************************************************************/
@ -193,9 +189,277 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
GetScreen()->ClrRefreshReq();
}
/***************************************************************************************************/
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 )
{
wxMessageBox( 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);
}
}
/* Virtual fonction needed by the PCB_SCREEN class derived from BASE_SCREEN
* this is a virtaul pure function in BASE_SCREEN
* this is a virtual pure function in BASE_SCREEN
* do nothing in gerbview
* could be removed later
*/

View File

@ -1,287 +0,0 @@
/*****************************************************************/
/* 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);
}
}

View File

@ -0,0 +1,182 @@
/**********************************************************/
/* 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

View File

@ -1,5 +1,5 @@
/**************************************************************/
/* 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 {

View File

@ -14,6 +14,7 @@
#include "autorout.h"
#include "zones.h"
#include "cell.h"
#include "class_board_design_settings.h"
#include "protos.h"

View File

@ -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;

View File

@ -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();

View File

@ -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

View File

@ -0,0 +1,122 @@
/***************************************************************************/
/* 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;
}

View File

@ -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"

View File

@ -11,6 +11,7 @@
#include "kicad_string.h"
#include "pcbnew.h"
#include "class_board_design_settings.h"
#include "trigo.h"
#include "protos.h"

View File

@ -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...

View File

@ -9,6 +9,7 @@
#include "kicad_string.h"
#include "pcbnew.h"
#include "class_board_design_settings.h"
#include "trigo.h"
#include "protos.h"

View File

@ -14,6 +14,7 @@
#include "pcbcommon.h"
#include "pcbnew.h"
#include "class_board_design_settings.h"
#include "autorout.h"
#include "drag.h"

View File

@ -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.

View File

@ -7,6 +7,7 @@
#include "common.h"
#include "kicad_string.h"
#include "pcbnew.h"
#include "class_board_design_settings.h"
/*********************************************************/

View File

@ -11,6 +11,7 @@
#include "drawtxt.h"
#include "pcbnew.h"
#include "class_board_design_settings.h"
/*******************************************************************************************/

View File

@ -11,6 +11,7 @@
#include "kicad_string.h"
#include "pcbnew.h"
#include "class_board_design_settings.h"
#include "trigo.h"
#include "protos.h"

View File

@ -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"
/************************************************************************/

View File

@ -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 );
}

View File

@ -13,6 +13,7 @@
#include "PolyLine.h"
#include "pcbnew.h"
#include "zones.h"
#include "class_board_design_settings.h"
#include "protos.h"

View File

@ -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 );
}

View File

@ -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 );

View File

@ -1,216 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// 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;
}

View File

@ -1,36 +0,0 @@
///////////////////////////////////////////////////////////////////////////////
/// 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_

View File

@ -1,116 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// 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 );
}

View File

@ -1,349 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="9" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">dialog_copper_layers_setup_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="internationalize">1</property>
<property name="name">dialog_copper_layers_setup_base</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
<property name="bg"></property>
<property name="center"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size">-1,-1</property>
<property name="name">DIALOG_COPPER_LAYERS_SETUP_BASE</property>
<property name="pos"></property>
<property name="size">558,598</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property>
<property name="title">Copper layers setup</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnActivate"></event>
<event name="OnActivateApp"></event>
<event name="OnChar"></event>
<event name="OnClose"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHibernate"></event>
<event name="OnIconize"></event>
<event name="OnIdle"></event>
<event name="OnInitDialog"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bMainSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bMainSizerLayers</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxRadioBox" expanded="1">
<property name="bg"></property>
<property name="choices">&quot;1&quot; &quot;2&quot; &quot;4&quot; &quot;6&quot; &quot;8&quot; &quot;10&quot; &quot;12&quot; &quot;14&quot; &quot;16&quot;</property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">ID_LAYERS_COUNT_SELECTION</property>
<property name="label">Layers Count</property>
<property name="majorDimension">1</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_LayersCountSelection</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="selection">1</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRadioBox">OnLayerCountClick</event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxGrid" expanded="1">
<property name="autosize_cols">0</property>
<property name="autosize_rows">1</property>
<property name="bg"></property>
<property name="cell_bg"></property>
<property name="cell_font"></property>
<property name="cell_horiz_alignment">wxALIGN_CENTRE</property>
<property name="cell_text"></property>
<property name="cell_vert_alignment">wxALIGN_CENTRE</property>
<property name="col_label_horiz_alignment">wxALIGN_CENTRE</property>
<property name="col_label_size">30</property>
<property name="col_label_values">&quot;Active&quot; &quot;Status&quot; &quot;Name&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTRE</property>
<property name="cols">3</property>
<property name="column_sizes">100,100,150</property>
<property name="context_help"></property>
<property name="drag_col_move">0</property>
<property name="drag_col_size">1</property>
<property name="drag_grid_size">0</property>
<property name="drag_row_size">1</property>
<property name="editing">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="grid_line_color"></property>
<property name="grid_lines">1</property>
<property name="hidden">0</property>
<property name="id">ID_LAYERS_PROPERTIES</property>
<property name="label_bg"></property>
<property name="label_font"></property>
<property name="label_text"></property>
<property name="margin_height">0</property>
<property name="margin_width">0</property>
<property name="maximum_size"></property>
<property name="minimum_size">-1,-1</property>
<property name="name">m_gridLayersProperties</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="row_label_horiz_alignment">wxALIGN_CENTRE</property>
<property name="row_label_size">80</property>
<property name="row_label_values">&quot;Top Layer&quot; &quot;Inner 14&quot; &quot;Inner 13&quot; &quot;Inner 12&quot; &quot;Inner 11&quot; &quot;Inner 10&quot; &quot;Inner 9&quot; &quot;Inner 8&quot; &quot;Inner 7&quot; &quot;Inner 6&quot; &quot;Inner 5&quot; &quot;Inner 4&quot; &quot;Inner 3&quot; &quot;Inner 2&quot; &quot;Inner 1&quot; &quot;Bottom Layer&quot;</property>
<property name="row_label_vert_alignment">wxALIGN_CENTRE</property>
<property name="row_sizes"></property>
<property name="rows">16</property>
<property name="size"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnGridCellChange"></event>
<event name="OnGridCellLeftClick">OnLayerGridLeftClick</event>
<event name="OnGridCellLeftDClick"></event>
<event name="OnGridCellRightClick">OnLayerGridRighttClick</event>
<event name="OnGridCellRightDClick"></event>
<event name="OnGridCmdCellChange"></event>
<event name="OnGridCmdCellLeftClick"></event>
<event name="OnGridCmdCellLeftDClick"></event>
<event name="OnGridCmdCellRightClick"></event>
<event name="OnGridCmdCellRightDClick"></event>
<event name="OnGridCmdColSize"></event>
<event name="OnGridCmdEditorCreated"></event>
<event name="OnGridCmdEditorHidden"></event>
<event name="OnGridCmdEditorShown"></event>
<event name="OnGridCmdLabelLeftClick"></event>
<event name="OnGridCmdLabelLeftDClick"></event>
<event name="OnGridCmdLabelRightClick"></event>
<event name="OnGridCmdLabelRightDClick"></event>
<event name="OnGridCmdRangeSelect"></event>
<event name="OnGridCmdRowSize"></event>
<event name="OnGridCmdSelectCell"></event>
<event name="OnGridColSize"></event>
<event name="OnGridEditorCreated"></event>
<event name="OnGridEditorHidden"></event>
<event name="OnGridEditorShown"></event>
<event name="OnGridLabelLeftClick"></event>
<event name="OnGridLabelLeftDClick"></event>
<event name="OnGridLabelRightClick"></event>
<event name="OnGridLabelRightDClick"></event>
<event name="OnGridRangeSelect"></event>
<event name="OnGridRowSize"></event>
<event name="OnGridSelectCell"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Messages:</property>
<property name="minimum_size"></property>
<property name="name">sbSizer1</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxHtmlWindow" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size">-1,150</property>
<property name="name">m_MessagesList</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style">wxHW_SCROLLBAR_AUTO</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHtmlCellClicked"></event>
<event name="OnHtmlCellHover"></event>
<event name="OnHtmlLinkClicked"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_RIGHT</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="1">
<property name="Apply">0</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="No">0</property>
<property name="OK">1</property>
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="name">m_sdbSizer1</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick">OnCancelButtonClick</event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event>
<event name="OnOKButtonClick">OnOkButtonClick</event>
<event name="OnSaveButtonClick"></event>
<event name="OnYesButtonClick"></event>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

View File

@ -1,60 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// 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__

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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 );

View File

@ -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>

View File

@ -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 )
{

View File

@ -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

View File

@ -9,6 +9,7 @@
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "protos.h"

View File

@ -10,6 +10,7 @@
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "protos.h"

View File

@ -11,6 +11,7 @@
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "protos.h"

View File

@ -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 );

View File

@ -9,6 +9,7 @@
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "drc_stuff.h"
#include "trigo.h"

View File

@ -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)

View File

@ -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;

View File

@ -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
}

View File

@ -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++;

View File

@ -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 );

View File

@ -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 );

View File

@ -7,6 +7,7 @@
#include "common.h"
#include "pcbnew.h"
#include "class_board_design_settings.h"
#include "protos.h"

View File

@ -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"

View File

@ -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 );

View File

@ -13,6 +13,7 @@
#include "gestfich.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "protos.h"
/* Fonctions locales */

View File

@ -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 );

View File

@ -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 */

View File

@ -13,6 +13,7 @@
#include "pcbnew.h"
#include "pcbplot.h"
#include "trigo.h"
#include "class_board_design_settings.h"
/* Fonctions locales */

View File

@ -8,6 +8,7 @@
#include "class_drawpanel.h"
#include "pcbnew.h"
#include "class_board_design_settings.h"
#include "pcbplot.h"
#include "protos.h"

View File

@ -10,6 +10,7 @@
#include "confirm.h"
#include "pcbnew.h"
#include "autorout.h"
#include "class_board_design_settings.h"
#include "protos.h"

View File

@ -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<69>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++ )
{

View File

@ -12,6 +12,7 @@
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
//#include "protos.h"

View File

@ -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;

View File

@ -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

View File

@ -7,6 +7,7 @@
#include "common.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "bitmaps.h"

View File

@ -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

View File

@ -8,6 +8,7 @@
#include "confirm.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "pcbnew_id.h"