Commit e0303a45 authored by Lorenzo Marcantonio's avatar Lorenzo Marcantonio

- New typedef LAYER_MSK to encapsulate a layer bitmap

- Renamed ReturnMaskLayer to GetLayerMask (since it's a plain getter)
parent 1702ab3a
......@@ -320,7 +320,7 @@ void EDA_DRAW_FRAME::ToolOnRightClick( wxCommandEvent& event )
}
void EDA_DRAW_FRAME::PrintPage( wxDC* aDC,int aPrintMask, bool aPrintMirrorMode, void* aData )
void EDA_DRAW_FRAME::PrintPage( wxDC* aDC,LAYER_MSK aPrintMask, bool aPrintMirrorMode, void* aData )
{
wxMessageBox( wxT("EDA_DRAW_FRAME::PrintPage() error") );
}
......
......@@ -71,7 +71,7 @@ int GetLayerMask( int aLayerNumber )
/* Look up Table for conversion copper layer count -> general copper layer
* mask: */
int g_TabAllCopperLayerMask[NB_COPPER_LAYERS] = {
LAYER_MSK g_TabAllCopperLayerMask[NB_COPPER_LAYERS] = {
0x0001, 0x8001, 0x8003, 0x8007,
0x800F, 0x801F, 0x803F, 0x807F,
0x80FF, 0x81FF, 0x83FF, 0x87FF,
......
......@@ -144,7 +144,7 @@ void LIB_EDIT_FRAME::SVG_Print_Component( const wxString& FullFileName )
plotBW, plotFrameRef );
}
void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData)
void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMask, bool aPrintMirrorMode, void* aData)
{
if( ! m_component )
return;
......
......@@ -637,7 +637,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, int aPrintMask,
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMask,
bool aPrintMirrorMode, void* aData = NULL );
/**
......
......@@ -848,7 +848,8 @@ void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event )
}
}
void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData )
void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMask, bool aPrintMirrorMode,
void* aData )
{
GetScreen()->Draw( m_canvas, aDC, GR_DEFAULT_DRAWMODE );
TraceWorkSheet( aDC, GetScreen(), GetDefaultLineThickness(), IU_PER_MILS,
......
......@@ -29,7 +29,7 @@ GBR_LAYOUT::~GBR_LAYOUT()
*/
bool GBR_LAYOUT::IsLayerVisible( int aLayerIndex ) const
{
return m_printLayersMask & (1 << aLayerIndex );
return m_printLayersMask & GetLayerMask( aLayerIndex );
}
......
......@@ -15,6 +15,7 @@
#include <class_title_block.h>
#include <class_gerber_draw_item.h>
#include <gr_basic.h>
/**
* Class GBR_LAYOUT
......@@ -27,7 +28,7 @@ private:
PAGE_INFO m_paper;
TITLE_BLOCK m_titles;
wxPoint m_originAxisPosition;
int m_printLayersMask; // When printing: the list of layers to print
LAYER_MSK m_printLayersMask; // When printing: the list of layers to print
public:
DLIST<GERBER_DRAW_ITEM> m_Drawings; // linked list of Gerber Items
......@@ -90,7 +91,7 @@ public:
* changes the bit-mask of visible layers
* @param aLayerMask = The new bit-mask of visible layers
*/
void SetVisibleLayers( int aLayerMask )
void SetVisibleLayers( LAYER_MSK aLayerMask )
{
m_printLayersMask = aLayerMask;
}
......
......@@ -8,6 +8,7 @@
#include <base_units.h>
#include <class_base_screen.h>
#include <layers_id_colors_and_visibility.h>
#define ZOOM_FACTOR( x ) ( x * IU_PER_DECIMILS )
......
......@@ -31,6 +31,7 @@
#include <base_struct.h>
#include <dlist.h>
#include <layers_id_colors_and_visibility.h>
#include <gr_basic.h>
class GERBER_IMAGE;
......@@ -133,9 +134,9 @@ public:
*/
void SetLayer( int aLayer ) { m_Layer = aLayer; }
int ReturnMaskLayer()
LAYER_MSK GetLayerMask()
{
return 1 << m_Layer;
return ::GetLayerMask( m_Layer );
}
bool GetLayerPolarity()
......
......@@ -163,7 +163,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
int rowCount;
int menuId = event.GetId();
bool visible = (menuId == ID_SHOW_ALL_COPPERS) ? true : false;;
int visibleLayers = 0;
LAYER_MSK visibleLayers = NO_LAYERS;
switch( menuId )
{
......@@ -181,9 +181,9 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 );
cb->SetValue( loc_visible );
if( loc_visible )
visibleLayers |= (1 << row);
visibleLayers |= GetLayerMask( row );
else
visibleLayers &= ~(1 << row);
visibleLayers &= ~GetLayerMask( row );
}
myframe->SetVisibleLayers( visibleLayers );
......@@ -235,12 +235,12 @@ bool GERBER_LAYER_WIDGET::OnLayerSelect( int aLayer )
void GERBER_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal )
{
int visibleLayers = myframe->GetVisibleLayers();
LAYER_MSK visibleLayers = myframe->GetVisibleLayers();
if( isVisible )
visibleLayers |= (1 << aLayer);
visibleLayers |= GetLayerMask( aLayer );
else
visibleLayers &= ~(1 << aLayer);
visibleLayers &= ~GetLayerMask( aLayer );
myframe->SetVisibleLayers( visibleLayers );
......
......@@ -188,7 +188,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
{
m_BoxSelectLayer[layer]->SetValue( option );
if( option )
s_SelectedLayers |= 1 << layer;
s_SelectedLayers |= GetLayerMask( layer );
}
}
}
......@@ -223,15 +223,15 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection()
/**************************************************************/
{
int page_count;
s_Parameters.m_PrintMaskLayer = 0;
int page_count = 0;
s_Parameters.m_PrintMaskLayer = NO_LAYERS;
int ii;
for( ii = 0, page_count = 0; ii < GERBVIEW_LAYER_COUNT; ii++ )
{
if( m_BoxSelectLayer[ii]->IsChecked() )
{
page_count++;
s_Parameters.m_PrintMaskLayer |= 1 << ii;
s_Parameters.m_PrintMaskLayer |= GetLayerMask( ii );
}
}
......
......@@ -41,11 +41,11 @@
#include <class_GERBER.h>
void GERBVIEW_FRAME::PrintPage( wxDC* aDC, int aPrintMasklayer,
void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer,
bool aPrintMirrorMode, void* aData )
{
// Save current draw options, because print mode has specific options:
int visiblemask = GetVisibleLayers();
LAYER_MSK visiblemask = GetVisibleLayers();
GBR_DISPLAY_OPTIONS imgDisplayOptions = m_DisplayOptions;
// Set draw options for printing:
......
......@@ -537,7 +537,7 @@ void GERBVIEW_FRAME::SetVisibleAlls()
* Returns a bit-mask of all the layers that are visible
* @return int - the visible layers in bit-mapped form.
*/
int GERBVIEW_FRAME::GetVisibleLayers() const
LAYER_MSK GERBVIEW_FRAME::GetVisibleLayers() const
{
return -1; // TODO
}
......@@ -549,7 +549,7 @@ int GERBVIEW_FRAME::GetVisibleLayers() const
* changes the bit-mask of visible layers
* @param aLayerMask = The new bit-mask of visible layers
*/
void GERBVIEW_FRAME::SetVisibleLayers( int aLayerMask )
void GERBVIEW_FRAME::SetVisibleLayers( LAYER_MSK aLayerMask )
{
GetLayout()->SetVisibleLayers( aLayerMask );
}
......
......@@ -37,6 +37,7 @@
#include <gerbview.h>
#include <class_gbr_layout.h>
#include <class_gbr_screen.h>
#include <layers_id_colors_and_visibility.h>
#define NO_AVAILABLE_LAYERS -1
......@@ -299,7 +300,7 @@ public:
* Returns a bit-mask of all the layers that are visible
* @return int - the visible layers in bit-mapped form.
*/
int GetVisibleLayers() const;
LAYER_MSK GetVisibleLayers() const;
/**
* Function SetVisibleLayers
......@@ -307,7 +308,7 @@ public:
* changes the bit-mask of visible layers
* @param aLayerMask = The new bit-mask of visible layers
*/
void SetVisibleLayers( int aLayerMask );
void SetVisibleLayers( LAYER_MSK aLayerMask );
/**
* Function IsLayerVisible
......@@ -716,7 +717,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, int aPrintMasklayer, bool aPrintMirrorMode,
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer, bool aPrintMirrorMode,
void* aData = NULL );
/**
......
......@@ -56,7 +56,7 @@ public:
* returns a bit-mask of all the layers that are visible
* @return int - the visible layers in bit-mapped form.
*/
int GetVisibleLayers() const;
LAYER_MSK GetVisibleLayers() const;
/**
* Function SetVisibleAlls
......@@ -70,7 +70,7 @@ public:
* changes the bit-mask of visible layers
* @param aMask = The new bit-mask of visible layers
*/
void SetVisibleLayers( int aMask );
void SetVisibleLayers( LAYER_MSK aMask );
/**
* Function IsLayerVisible
......@@ -85,7 +85,7 @@ public:
return false;
// If a layer is disabled, it is automatically invisible
return (bool) ( m_VisibleLayers & m_EnabledLayers & (1 << aLayerIndex) );
return bool( m_VisibleLayers & m_EnabledLayers & GetLayerMask( aLayerIndex ) );
}
/**
......@@ -143,7 +143,7 @@ public:
* returns a bit-mask of all the layers that are enabled
* @return int - the enabled layers in bit-mapped form.
*/
inline int GetEnabledLayers() const
inline LAYER_MSK GetEnabledLayers() const
{
return m_EnabledLayers;
}
......@@ -153,7 +153,7 @@ public:
* changes the bit-mask of enabled layers
* @param aMask = The new bit-mask of enabled layers
*/
void SetEnabledLayers( int aMask );
void SetEnabledLayers( LAYER_MSK aMask );
/**
* Function IsLayerEnabled
......@@ -163,7 +163,7 @@ public:
*/
bool IsLayerEnabled( int aLayerIndex ) const
{
return bool( m_EnabledLayers & (1 << aLayerIndex) );
return bool( m_EnabledLayers & GetLayerMask( aLayerIndex ) );
}
/**
......@@ -194,11 +194,11 @@ public:
void SetBoardThickness( int aThickness ) { m_boardThickness = aThickness; }
private:
int m_CopperLayerCount; ///< Number of copper layers for this design
int m_EnabledLayers; ///< Bit-mask for layer enabling
int m_VisibleLayers; ///< Bit-mask for layer visibility
int m_VisibleElements; ///< Bit-mask for element category visibility
int m_boardThickness; ///< Board thickness for 3D viewer
int m_CopperLayerCount; ///< Number of copper layers for this design
LAYER_MSK m_EnabledLayers; ///< Bit-mask for layer enabling
LAYER_MSK m_VisibleLayers; ///< Bit-mask for layer visibility
int m_VisibleElements; ///< Bit-mask for element category visibility
int m_boardThickness; ///< Board thickness for 3D viewer
};
#endif // BOARD_DESIGN_SETTINGS_H_
......@@ -34,7 +34,8 @@
#include <base_struct.h>
#include <gr_basic.h>
#include <boost/ptr_container/ptr_vector.hpp>
#include <gr_basic.h>
#include <layers_id_colors_and_visibility.h>
/// Abbrevation for fomatting internal units to a string.
#define FMT_IU BOARD_ITEM::FormatInternalUnits
......
......@@ -5,6 +5,7 @@
#ifndef _COLORS_DESIGN_SETTING_H
#define _COLORS_DESIGN_SETTING_H
#include <layers_id_colors_and_visibility.h>
#define LAYERSCOLORSBUFFERSIZE 32
#define ITEMSCOLORSBUFFERSIZE 32
......
......@@ -3,6 +3,7 @@
#include <hotkeys_basic.h>
#include <wx/bmpcbox.h>
#include <layers_id_colors_and_visibility.h>
class wxAuiToolBar;
......
......@@ -51,6 +51,7 @@
#define LAYER_COUNT 32
// Masks to identify a layer by a bit map
typedef unsigned LAYER_MSK;
#define LAYER_BACK (1 << LAYER_N_BACK) ///< bit mask for copper layer
#define LAYER_2 (1 << LAYER_N_2) ///< bit mask for layer 2
#define LAYER_3 (1 << LAYER_N_3) ///< bit mask for layer 3
......@@ -92,6 +93,16 @@
#define ALL_CU_LAYERS 0x0000FFFF
#define INTERNAL_LAYERS 0x00007FFE
#define EXTERNAL_LAYERS 0x00008001
#define NO_LAYERS 0x00000000
/** return a one bit layer mask from a layer number
* aLayerNumber = the layer number to convert (0 .. LAYERS-1)
*/
inline LAYER_MSK GetLayerMask( unsigned aLayerNumber )
{
return 1 << aLayerNumber;
}
// layers order in dialogs (plot, print and toolbars)
......
......@@ -18,16 +18,8 @@ class TRACK;
class BOARD;
class DISPLAY_OPTIONS;
/**
* Function GetLayerMask
* @return a one bit layer mask from a layer number
* @param aLayerNumber = the layer number to convert (0 .. LAYER_COUNT-1)
*/
int GetLayerMask( int aLayerNumber );
/// Look up Table for conversion copper layer count -> general copper layer mask:
extern int g_TabAllCopperLayerMask[NB_COPPER_LAYERS];
extern LAYER_MSK g_TabAllCopperLayerMask[NB_COPPER_LAYERS];
extern DISPLAY_OPTIONS DisplayOpt;
......
......@@ -1219,7 +1219,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, int aPrintMask,
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMask,
bool aPrintMirrorMode, void* aData = NULL );
void SetSimulatorCommand( const wxString& aCommand ) { m_simulatorCommand = aCommand; }
......
......@@ -270,7 +270,7 @@ public:
* @param aPrintMirrorMode = true to plot mirrored
* @param aData = a pointer on an auxiliary data (NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, int aPrintMaskLayer, bool aPrintMirrorMode,
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMaskLayer, bool aPrintMirrorMode,
void * aData = NULL );
void GetKicadAbout( wxCommandEvent& event );
......
......@@ -43,7 +43,9 @@
#include <wx/docview.h>
#include <colors.h>
#include <fctsys.h>
#include <common.h>
#include <layers_id_colors_and_visibility.h>
#ifdef USE_WX_OVERLAY
#include <wx/overlay.h>
......@@ -880,7 +882,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData = NULL );
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMask, bool aPrintMirrorMode, void* aData = NULL );
/**
* Function CoordinateToString
......
......@@ -127,7 +127,7 @@ void BOARD::Move( const wxPoint& aMoveVector ) // overload
}
void BOARD::chainMarkedSegments( wxPoint aPosition, int aLayerMask, TRACK_PTRS* aList )
void BOARD::chainMarkedSegments( wxPoint aPosition, LAYER_MSK aLayerMask, TRACK_PTRS* aList )
{
TRACK* segment; // The current segment being analyzed.
TRACK* via; // The via identified, eventually destroy
......@@ -166,7 +166,7 @@ void BOARD::chainMarkedSegments( wxPoint aPosition, int aLayerMask, TRACK_PTRS*
if( via )
{
aLayerMask = via->ReturnMaskLayer();
aLayerMask = via->GetLayerMask();
aList->push_back( via );
}
......@@ -212,7 +212,7 @@ void BOARD::chainMarkedSegments( wxPoint aPosition, int aLayerMask, TRACK_PTRS*
* candidate:
* we must analyze connections to its other end
*/
aLayerMask = candidate->ReturnMaskLayer();
aLayerMask = candidate->GetLayerMask();
if( aPosition == candidate->GetStart() )
{
......@@ -227,7 +227,7 @@ void BOARD::chainMarkedSegments( wxPoint aPosition, int aLayerMask, TRACK_PTRS*
/* flag this item an push it in list of selected items */
aList->push_back( candidate );
candidate->SetState( BUSY, ON );
candidate->SetState( BUSY, true );
}
else
{
......@@ -542,25 +542,25 @@ void BOARD::SetCopperLayerCount( int aCount )
}
int BOARD::GetEnabledLayers() const
LAYER_MSK BOARD::GetEnabledLayers() const
{
return m_designSettings.GetEnabledLayers();
}
int BOARD::GetVisibleLayers() const
LAYER_MSK BOARD::GetVisibleLayers() const
{
return m_designSettings.GetVisibleLayers();
}
void BOARD::SetEnabledLayers( int aLayerMask )
void BOARD::SetEnabledLayers( LAYER_MSK aLayerMask )
{
m_designSettings.SetEnabledLayers( aLayerMask );
}
void BOARD::SetVisibleLayers( int aLayerMask )
void BOARD::SetVisibleLayers( LAYER_MSK aLayerMask )
{
m_designSettings.SetVisibleLayers( aLayerMask );
}
......@@ -1557,7 +1557,7 @@ TRACK* BOARD::GetViaByPosition( const wxPoint& aPosition, int aLayerMask )
}
D_PAD* BOARD::GetPad( const wxPoint& aPosition, int aLayerMask )
D_PAD* BOARD::GetPad( const wxPoint& aPosition, LAYER_MSK aLayerMask )
{
D_PAD* pad = NULL;
......@@ -1578,7 +1578,7 @@ D_PAD* BOARD::GetPad( TRACK* aTrace, int aEndPoint )
D_PAD* pad = NULL;
wxPoint aPosition;
int aLayerMask = GetLayerMask( aTrace->GetLayer() );
LAYER_MSK aLayerMask = GetLayerMask( aTrace->GetLayer() );
if( aEndPoint == FLG_START )
{
......@@ -1601,7 +1601,7 @@ D_PAD* BOARD::GetPad( TRACK* aTrace, int aEndPoint )
}
D_PAD* BOARD::GetPadFast( const wxPoint& aPosition, int aLayerMask )
D_PAD* BOARD::GetPadFast( const wxPoint& aPosition, LAYER_MSK aLayerMask )
{
for( unsigned i=0; i<GetPadCount(); ++i )
{
......@@ -1619,7 +1619,7 @@ D_PAD* BOARD::GetPadFast( const wxPoint& aPosition, int aLayerMask )
}
D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, int aLayerMask )
D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, LAYER_MSK aLayerMask )
{
// Search the aPoint coordinates in aPadList
// aPadList is sorted by X then Y values, and a fast binary search is used
......@@ -1643,7 +1643,7 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, i
if( pad->GetPosition() == aPosition ) // candidate found
{
// The pad must match the layer mask:
if( (aLayerMask & pad->GetLayerMask()) != 0 )
if( aLayerMask & pad->GetLayerMask())
return pad;
// More than one pad can be at aPosition
......@@ -1747,7 +1747,7 @@ void BOARD::GetSortedPadListByXthenYCoord( std::vector<D_PAD*>& aVector, int aNe
}
TRACK* BOARD::GetTrace( TRACK* aTrace, const wxPoint& aPosition, int aLayerMask )
TRACK* BOARD::GetTrace( TRACK* aTrace, const wxPoint& aPosition, LAYER_MSK aLayerMask )
{
for( TRACK* track = aTrace; track; track = track->Next() )
{
......@@ -1798,11 +1798,11 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount,
// Ensure the flag BUSY of all tracks of the board is cleared
// because we use it to mark segments of the track
for( TRACK* track = m_Track; track; track = track->Next() )
track->SetState( BUSY, OFF );
track->SetState( BUSY, false );
/* Set flags of the initial track segment */
aTrace->SetState( BUSY, ON );
int layerMask = aTrace->ReturnMaskLayer();
aTrace->SetState( BUSY, true );
LAYER_MSK layerMask = aTrace->GetLayerMask();
trackList.push_back( aTrace );
......@@ -1838,13 +1838,13 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount,
if( Segm1 ) // search for others segments connected to the initial segment start point
{
layerMask = Segm1->ReturnMaskLayer();
layerMask = Segm1->GetLayerMask();
chainMarkedSegments( aTrace->GetStart(), layerMask, &trackList );
}
if( Segm2 ) // search for others segments connected to the initial segment end point
{
layerMask = Segm2->ReturnMaskLayer();
layerMask = Segm2->GetLayerMask();
chainMarkedSegments( aTrace->GetStart(), layerMask, &trackList );
}
}
......@@ -1869,9 +1869,9 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount,
if( via == aTrace )
continue;
via->SetState( BUSY, ON ); // Try to flag it. the flag will be cleared later if needed
via->SetState( BUSY, true ); // Try to flag it. the flag will be cleared later if needed
layerMask = via->ReturnMaskLayer();
layerMask = via->GetLayerMask();
TRACK* track = ::GetTrace( m_Track, NULL, via->GetStart(), layerMask );
......@@ -1901,7 +1901,7 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount,
{
// The via connects segments of an other track: it is removed
// from list because it is member of an other track
via->SetState( BUSY, OFF );
via->SetState( BUSY, false );
break;
}
}
......@@ -1984,7 +1984,7 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount,
if( track->GetState( BUSY ) )
{
NbSegmBusy++;
track->SetState( BUSY, OFF );
track->SetState( BUSY, false );
full_len += track->GetLength();
// Add now length die.
......@@ -2096,7 +2096,7 @@ MODULE* BOARD::GetFootprint( const wxPoint& aPosition, int aActiveLayer,
}
BOARD_CONNECTED_ITEM* BOARD::GetLockPoint( const wxPoint& aPosition, int aLayerMask )
BOARD_CONNECTED_ITEM* BOARD::GetLockPoint( const wxPoint& aPosition, LAYER_MSK aLayerMask )
{
for( MODULE* module = m_Modules; module; module = module->Next() )
{
......@@ -2155,7 +2155,7 @@ TRACK* BOARD::CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS
// The new segment begins at the new point,
newTrack->SetStart(lockPoint);
newTrack->start = aSegment;
newTrack->SetState( BEGIN_ONPAD, OFF );
newTrack->SetState( BEGIN_ONPAD, false );
DLIST<TRACK>* list = (DLIST<TRACK>*)aSegment->GetList();
wxASSERT( list );
......@@ -2177,16 +2177,16 @@ TRACK* BOARD::CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS
// Old track segment now ends at new point.
aSegment->SetEnd(lockPoint);
aSegment->end = newTrack;
aSegment->SetState( END_ONPAD, OFF );
aSegment->SetState( END_ONPAD, false );
D_PAD * pad = GetPad( newTrack, FLG_START );
if ( pad )
{
newTrack->start = pad;
newTrack->SetState( BEGIN_ONPAD, ON );
newTrack->SetState( BEGIN_ONPAD, true );
aSegment->end = pad;
aSegment->SetState( END_ONPAD, ON );
aSegment->SetState( END_ONPAD, true );
}
aPosition = lockPoint;
......
......@@ -234,7 +234,7 @@ private:
* @param aLayerMask The allowed layers for segments to search.
* @param aList The track list to fill with points of flagged segments.
*/
void chainMarkedSegments( wxPoint aPosition, int aLayerMask, TRACK_PTRS* aList );
void chainMarkedSegments( wxPoint aPosition, LAYER_MSK aLayerMask, TRACK_PTRS* aList );
void formatNetClass( NETCLASS* aNetClass, OUTPUTFORMATTER* aFormatter, int aNestLevel,
int aControlBits ) const
......@@ -425,7 +425,7 @@ public:
* Returns a bit-mask of all the layers that are enabled
* @return int - the enabled layers in bit-mapped form.
*/
int GetEnabledLayers() const;
LAYER_MSK GetEnabledLayers() const;
/**
* Function SetEnabledLayers
......@@ -433,7 +433,7 @@ public:
* Changes the bit-mask of enabled layers
* @param aLayerMask = The new bit-mask of enabled layers
*/
void SetEnabledLayers( int aLayerMask );
void SetEnabledLayers( LAYER_MSK aLayerMask );
/**
* Function IsLayerEnabled
......@@ -465,7 +465,7 @@ public:
* Returns a bit-mask of all the layers that are visible
* @return int - the visible layers in bit-mapped form.
*/
int GetVisibleLayers() const;
LAYER_MSK GetVisibleLayers() const;
/**
* Function SetVisibleLayers
......@@ -473,7 +473,7 @@ public:
* changes the bit-mask of visible layers
* @param aLayerMask = The new bit-mask of visible layers
*/
void SetVisibleLayers( int aLayerMask );
void SetVisibleLayers( LAYER_MSK aLayerMask );
// these 2 functions are not tidy at this time, since there are PCB_VISIBLEs that
// are not stored in the bitmap.
......@@ -1223,7 +1223,7 @@ public:
* @param aLayerMask A layer or layers to mask the hit test.
* @return A pointer to a D_PAD object if found or NULL if not found.
*/
D_PAD* GetPad( const wxPoint& aPosition, int aLayerMask = ALL_LAYERS );
D_PAD* GetPad( const wxPoint& aPosition, LAYER_MSK aLayerMask = ALL_LAYERS );
/**
* Function GetPad
......@@ -1245,7 +1245,7 @@ public:
* @param aLayer A layer or layers to mask the hit test.
* @return A pointer to a D_PAD object if found or NULL if not found.
*/
D_PAD* GetPadFast( const wxPoint& aPosition, int aLayer );
D_PAD* GetPadFast( const wxPoint& aPosition, LAYER_MSK aLayerMask );
/**
* Function GetPad
......@@ -1262,7 +1262,7 @@ public:
* @param aLayerMask A layer or layers to mask the hit test.
* @return a D_PAD object pointer to the connected pad.
*/
D_PAD* GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, int aLayerMask );
D_PAD* GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, LAYER_MSK aLayerMask );
/**
* Function GetSortedPadListByXthenYCoord
......@@ -1289,7 +1289,7 @@ public:
* layer mask.
* @return A TRACK object pointer if found otherwise NULL.
*/
TRACK* GetTrace( TRACK* aTrace, const wxPoint& aPosition, int aLayerMask );
TRACK* GetTrace( TRACK* aTrace, const wxPoint& aPosition, LAYER_MSK aLayerMask );
/**
* Function MarkTrace
......@@ -1348,7 +1348,7 @@ public:
* layer mask.
* @return A pointer to a BOARD_ITEM object if found otherwise NULL.
*/
BOARD_CONNECTED_ITEM* GetLockPoint( const wxPoint& aPosition, int aLayerMask );
BOARD_CONNECTED_ITEM* GetLockPoint( const wxPoint& aPosition, LAYER_MSK aLayerMask );
/**
* Function CreateLockPoint
......
......@@ -171,7 +171,7 @@ void BOARD_DESIGN_SETTINGS::AppendConfigs( PARAM_CFG_ARRAY* aResult )
// see pcbstruct.h
int BOARD_DESIGN_SETTINGS::GetVisibleLayers() const
LAYER_MSK BOARD_DESIGN_SETTINGS::GetVisibleLayers() const
{
return m_VisibleLayers;
}
......@@ -184,7 +184,7 @@ void BOARD_DESIGN_SETTINGS::SetVisibleAlls()
}
void BOARD_DESIGN_SETTINGS::SetVisibleLayers( int aMask )
void BOARD_DESIGN_SETTINGS::SetVisibleLayers( LAYER_MSK aMask )
{
// Although Pcbnew uses only 29, GerbView uses all 32 layers
m_VisibleLayers = aMask & m_EnabledLayers & FULL_LAYERS;
......@@ -198,9 +198,9 @@ void BOARD_DESIGN_SETTINGS::SetLayerVisibility( int aLayerIndex, bool aNewState
return;
if( aNewState && IsLayerEnabled( aLayerIndex ) )
m_VisibleLayers |= 1 << aLayerIndex;
m_VisibleLayers |= GetLayerMask( aLayerIndex );
else
m_VisibleLayers &= ~( 1 << aLayerIndex );
m_VisibleLayers &= ~GetLayerMask( aLayerIndex );
}
......@@ -229,12 +229,12 @@ void BOARD_DESIGN_SETTINGS::SetCopperLayerCount( int aNewLayerCount )
if( m_CopperLayerCount > 1 )
m_EnabledLayers |= LAYER_FRONT;
for( int ii = 1; ii < aNewLayerCount - 1; ii++ )
m_EnabledLayers |= 1 << ii;
for( int ii = LAYER_N_2; ii < aNewLayerCount - 1; ++ii )
m_EnabledLayers |= GetLayerMask( ii );
}
void BOARD_DESIGN_SETTINGS::SetEnabledLayers( int aMask )
void BOARD_DESIGN_SETTINGS::SetEnabledLayers( LAYER_MSK aMask )
{
// Back and front layers are always enabled.
aMask |= LAYER_BACK | LAYER_FRONT;
......
......@@ -573,7 +573,7 @@ D_PAD* MODULE::FindPadByName( const wxString& aPadName ) const
}
D_PAD* MODULE::GetPad( const wxPoint& aPosition, int aLayerMask )
D_PAD* MODULE::GetPad( const wxPoint& aPosition, LAYER_MSK aLayerMask )
{
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
{
......
......@@ -312,7 +312,7 @@ public:
* @param aLayerMask A layer or layers to mask the hit test.
* @return A pointer to a D_PAD object if found otherwise NULL.
*/
D_PAD* GetPad( const wxPoint& aPosition, int aLayerMask = ALL_LAYERS );
D_PAD* GetPad( const wxPoint& aPosition, LAYER_MSK aLayerMask = ALL_LAYERS );
/**
* GetPadCount
......
......@@ -79,9 +79,9 @@ int BOARD::ReturnFlippedLayerNumber( int oldlayer )
/* Calculate the mask layer when flipping a footprint
* BACK and FRONT copper layers , mask, paste, solder layers are swapped
*/
int ChangeSideMaskLayer( int aMask )
LAYER_MSK ChangeSideMaskLayer( LAYER_MSK aMask )
{
int newMask;
LAYER_MSK newMask;
newMask = aMask & ~(LAYER_BACK | LAYER_FRONT |
SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT |
......
......@@ -690,7 +690,7 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList )
// see class_pad.h
bool D_PAD::IsOnLayer( int aLayer ) const
{
return (1 << aLayer) & m_layerMask;
return ::GetLayerMask( aLayer ) & m_layerMask;
}
......
......@@ -186,8 +186,8 @@ public:
void SetDrillShape( PAD_SHAPE_T aDrillShape ) { m_DrillShape = aDrillShape; }
PAD_SHAPE_T GetDrillShape() const { return m_DrillShape; }
void SetLayerMask( int aLayerMask ) { m_layerMask = aLayerMask; }
int GetLayerMask() const { return m_layerMask; }
void SetLayerMask( LAYER_MSK aLayerMask ) { m_layerMask = aLayerMask; }
LAYER_MSK GetLayerMask() const { return m_layerMask; }
void SetAttribute( PAD_ATTR_T aAttribute );
PAD_ATTR_T GetAttribute() const { return m_Attribute; }
......@@ -454,7 +454,7 @@ private:
*/
wxPoint m_Offset;
int m_layerMask; ///< Bitwise layer :1= copper layer, 15= cmp,
LAYER_MSK m_layerMask; ///< Bitwise layer :1= copper layer, 15= cmp,
///< 2..14 = internal layers
///< 16 .. 31 = technical layers
......
......@@ -246,8 +246,8 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
// if routing between copper and component layers,
// or the current layer is one of said 2 external copper layers,
// then highlight only the current layer.
if( ( ( 1 << routeTop ) | ( 1 << routeBot ) ) == ( LAYER_BACK | LAYER_FRONT )
|| ( ( 1 << screen->m_Active_Layer ) & ( LAYER_BACK | LAYER_FRONT ) ) )
if( ( ::GetLayerMask( routeTop ) | ::GetLayerMask( routeBot ) ) == ( LAYER_BACK | LAYER_FRONT )
|| ( ::GetLayerMask( screen->m_Active_Layer ) & ( LAYER_BACK | LAYER_FRONT ) ) )
{
if( !IsOnLayer( screen->m_Active_Layer ) )
ColorTurnToDarkDarkGray( &color );
......
......@@ -263,7 +263,7 @@ void PCB_LAYER_WIDGET::ReFill()
// show all coppers first, with front on top, back on bottom, then technical layers
layer = LAYER_N_FRONT;
if( enabledLayers & (1 << layer) )
if( enabledLayers & GetLayerMask( layer ) )
{
AppendLayerRow( LAYER_WIDGET::ROW(
brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), _("Front copper layer"), true ) );
......@@ -271,7 +271,7 @@ void PCB_LAYER_WIDGET::ReFill()
for( layer = LAYER_N_FRONT-1; layer >= 1; --layer )
{
if( enabledLayers & (1 << layer) )
if( enabledLayers & GetLayerMask( layer ) )
{
AppendLayerRow( LAYER_WIDGET::ROW(
brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), _("An innner copper layer"), true ) );
......@@ -279,7 +279,7 @@ void PCB_LAYER_WIDGET::ReFill()
}
layer = LAYER_N_BACK;
if( enabledLayers & (1 << layer) )
if( enabledLayers & GetLayerMask( layer ) )
{
AppendLayerRow( LAYER_WIDGET::ROW(
brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), _("Back copper layer"), true ) );
......@@ -309,7 +309,7 @@ void PCB_LAYER_WIDGET::ReFill()
{
layer = techLayerSeq[i].layerId;
if( !(enabledLayers & (1 << layer)) )
if( !(enabledLayers & GetLayerMask( layer )) )
continue;
AppendLayerRow( LAYER_WIDGET::ROW(
......@@ -349,12 +349,12 @@ void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal
{
BOARD* brd = myframe->GetBoard();
int visibleLayers = brd->GetVisibleLayers();
LAYER_MSK visibleLayers = brd->GetVisibleLayers();
if( isVisible )
visibleLayers |= (1 << aLayer);
visibleLayers |= GetLayerMask( aLayer );
else
visibleLayers &= ~(1 << aLayer);
visibleLayers &= ~GetLayerMask( aLayer );
brd->SetVisibleLayers( visibleLayers );
......
......@@ -87,7 +87,7 @@ inline bool IsNear( wxPoint& p1, wxPoint& p2, int max_dist )
}
TRACK* GetTrace( TRACK* aStartTrace, TRACK* aEndTrace, const wxPoint& aPosition, int aLayerMask )
TRACK* GetTrace( TRACK* aStartTrace, TRACK* aEndTrace, const wxPoint& aPosition, LAYER_MSK aLayerMask )
{
TRACK* PtSegm;
......@@ -100,13 +100,13 @@ TRACK* GetTrace( TRACK* aStartTrace, TRACK* aEndTrace, const wxPoint& aPosition,
{
if( aPosition == PtSegm->GetStart() )
{
if( aLayerMask & PtSegm->ReturnMaskLayer() )
if( aLayerMask & PtSegm->GetLayerMask() )
return PtSegm;
}
if( aPosition == PtSegm->GetEnd() )
{
if( aLayerMask & PtSegm->ReturnMaskLayer() )
if( aLayerMask & PtSegm->GetLayerMask() )
return PtSegm;
}
}
......@@ -429,7 +429,7 @@ bool SEGVIA::IsOnLayer( int layer_number ) const
}
int TRACK::ReturnMaskLayer() const
LAYER_MSK TRACK::GetLayerMask() const
{
if( Type() == PCB_VIA_T )
{
......@@ -445,18 +445,19 @@ int TRACK::ReturnMaskLayer() const
// ReturnLayerPair() knows how layers are stored
( (SEGVIA*) this )->ReturnLayerPair( &top_layer, &bottom_layer );
int layermask = 0;
LAYER_MSK layermask = NO_LAYERS;
while( bottom_layer <= top_layer )
{
layermask |= GetLayerMask( bottom_layer++ );
layermask |= ::GetLayerMask( bottom_layer );
++bottom_layer;
}
return layermask;
}
else
{
return GetLayerMask( m_Layer );
return ::GetLayerMask( m_Layer );
}
}
......@@ -1190,7 +1191,7 @@ bool TRACK::HitTest( const EDA_RECT& aRect ) const
}
TRACK* TRACK::GetVia( const wxPoint& aPosition, int aLayerMask )
TRACK* TRACK::GetVia( const wxPoint& aPosition, int aLayer )
{
TRACK* track;
......@@ -1205,10 +1206,10 @@ TRACK* TRACK::GetVia( const wxPoint& aPosition, int aLayerMask )
if( track->GetState( BUSY | IS_DELETED ) )
continue;
if( aLayerMask < 0 )
if( aLayer < 0 )
break;
if( track->IsOnLayer( aLayerMask ) )
if( track->IsOnLayer( aLayer ) )
break;
}
......@@ -1216,7 +1217,7 @@ TRACK* TRACK::GetVia( const wxPoint& aPosition, int aLayerMask )
}
TRACK* TRACK::GetVia( TRACK* aEndTrace, const wxPoint& aPosition, int aLayerMask )
TRACK* TRACK::GetVia( TRACK* aEndTrace, const wxPoint& aPosition, LAYER_MSK aLayerMask )
{
TRACK* trace;
......@@ -1228,7 +1229,7 @@ TRACK* TRACK::GetVia( TRACK* aEndTrace, const wxPoint& aPosition, int aLayerMask
{
if( trace->GetState( BUSY | IS_DELETED ) == 0 )
{
if( aLayerMask & trace->ReturnMaskLayer() )
if( aLayerMask & trace->GetLayerMask() )
return trace;
}
}
......@@ -1258,7 +1259,7 @@ TRACK* TRACK::GetTrace( TRACK* aStartTrace, TRACK* aEndTrace, int aEndPoint )
else
position = m_End;
Reflayer = ReturnMaskLayer();
Reflayer = GetLayerMask();
previousSegment = nextSegment = this;
......@@ -1282,13 +1283,13 @@ TRACK* TRACK::GetTrace( TRACK* aStartTrace, TRACK* aEndTrace, int aEndPoint )
if( IsNear( position, nextSegment->m_Start, max_dist ) )
{
if( Reflayer & nextSegment->ReturnMaskLayer() )
if( Reflayer & nextSegment->GetLayerMask() )
return nextSegment;
}
if( IsNear( position, nextSegment->m_End, max_dist ) )
{
if( Reflayer & nextSegment->ReturnMaskLayer() )
if( Reflayer & nextSegment->GetLayerMask() )
return nextSegment;
}
suite:
......@@ -1310,13 +1311,13 @@ suite:
if( IsNear( position, previousSegment->m_Start, max_dist ) )
{
if( Reflayer & previousSegment->ReturnMaskLayer() )
if( Reflayer & previousSegment->GetLayerMask() )
return previousSegment;
}
if( IsNear( position, previousSegment->m_End, max_dist ) )
{
if( Reflayer & previousSegment->ReturnMaskLayer() )
if( Reflayer & previousSegment->GetLayerMask() )
return previousSegment;
}
suite1:
......@@ -1352,13 +1353,13 @@ suite1:
if( IsNear( position, nextSegment->m_Start, max_dist ) )
{
if( Reflayer & nextSegment->ReturnMaskLayer() )
if( Reflayer & nextSegment->GetLayerMask() )
return nextSegment;
}
if( IsNear( position, nextSegment->m_End, max_dist ) )
{
if( Reflayer & nextSegment->ReturnMaskLayer() )
if( Reflayer & nextSegment->GetLayerMask() )
return nextSegment;
}
......@@ -1373,7 +1374,8 @@ suite1:
int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace )
{
TRACK* Track, * via, * segm, * TrackListEnd;
int NbEnds, layerMask, ii, ok = 0;
int NbEnds, ii, ok = 0;
LAYER_MSK layerMask;
if( aCount <= 1 )
{
......@@ -1402,12 +1404,12 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace )
if( Track->Type() == PCB_VIA_T )
continue;
layerMask = Track->ReturnMaskLayer();
layerMask = Track->GetLayerMask();
via = GetVia( TrackListEnd, Track->m_Start, layerMask );
if( via )
{
layerMask |= via->ReturnMaskLayer();
layerMask |= via->GetLayerMask();
via->SetState( BUSY, true );
}
......@@ -1449,12 +1451,12 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace )
}
}
layerMask = Track->ReturnMaskLayer();
layerMask = Track->GetLayerMask();
via = GetVia( TrackListEnd, Track->m_End, layerMask );
if( via )
{
layerMask |= via->ReturnMaskLayer();
layerMask |= via->GetLayerMask();
via->SetState( BUSY, true );
}
......
......@@ -68,7 +68,7 @@ class MSG_PANEL_ITEM;
* @return A TRACK object pointer if found otherwise NULL.
*/
extern TRACK* GetTrace( TRACK* aStartTrace, TRACK* aEndTrace, const wxPoint& aPosition,
int aLayerMask );
LAYER_MSK aLayerMask );
class TRACK : public BOARD_CONNECTED_ITEM
......@@ -215,12 +215,12 @@ public:
bool IsDrillDefault() { return m_Drill <= 0; }
/**
* Function ReturnMaskLayer
* Function GetLayerMask
* returns a "layer mask", which is a bitmap of all layers on which the
* TRACK segment or SEGVIA physically resides.
* @return int - a layer mask, see pcbstruct.h's LAYER_BACK, etc.
*/
int ReturnMaskLayer() const;
LAYER_MSK GetLayerMask() const;
/**
* Function IsPointOnEnds
......@@ -265,10 +265,10 @@ public:
* finds the first SEGVIA object at \a aPosition on \a aLayer starting at the trace.
*
* @param aPosition The wxPoint to HitTest() against.
* @param aLayerMask The layer to match, pass -1 for a don't care.
* @param aLayer The layer to match, pass -1 for a don't care.
* @return A pointer to a SEGVIA object if found, else NULL.
*/
TRACK* GetVia( const wxPoint& aPosition, int aLayerMask = -1 );
TRACK* GetVia( const wxPoint& aPosition, int aLayer = -1 );
/**
* Function GetVia
......@@ -280,7 +280,7 @@ public:
* @param aLayerMask The layers to match, pass -1 for a don't care.
* @return A pointer to a SEGVIA object if found, else NULL.
*/
TRACK* GetVia( TRACK* aEndTrace, const wxPoint& aPosition, int aLayerMask );
TRACK* GetVia( TRACK* aEndTrace, const wxPoint& aPosition, LAYER_MSK aLayerMask );
/**
* Function GetTrace
......
......@@ -379,10 +379,10 @@ private:
int m_PreferredLayer;
bool m_IgnorePreferredLayer;
int m_LayerLocked; ///< bit-mapped layer locked bits
LAYER_MSK m_LayerLocked; ///< bit-mapped layer locked bits
bool m_IgnoreLockedLayers;
int m_LayerVisible; ///< bit-mapped layer visible bits
LAYER_MSK m_LayerVisible; ///< bit-mapped layer visible bits
bool m_IgnoreNonVisibleLayers;
bool m_IgnoreLockedItems;
......@@ -407,11 +407,11 @@ public:
* @param aVisibleLayerMask = current visible layers (bit mask)
* @param aPreferredLayer = the layer to search first
*/
GENERAL_COLLECTORS_GUIDE( int aVisibleLayerMask, int aPreferredLayer )
GENERAL_COLLECTORS_GUIDE( LAYER_MSK aVisibleLayerMask, int aPreferredLayer )
{
m_PreferredLayer = LAYER_N_FRONT;
m_IgnorePreferredLayer = false;
m_LayerLocked = 0;
m_LayerLocked = NO_LAYERS;
m_LayerVisible = aVisibleLayerMask;
m_IgnoreLockedLayers = true;
m_IgnoreNonVisibleLayers = true;
......@@ -443,13 +443,16 @@ public:
* Function IsLayerLocked
* @return bool - true if the given layer is locked, else false.
*/
bool IsLayerLocked( int aLayer ) const { return (1<<aLayer) & m_LayerLocked; }
bool IsLayerLocked( int aLayer ) const
{
return GetLayerMask( aLayer ) & m_LayerLocked;
}
void SetLayerLocked( int aLayer, bool isLocked )
{
if( isLocked )
m_LayerLocked |= 1 << aLayer;
m_LayerLocked |= GetLayerMask( aLayer );
else
m_LayerLocked &= ~(1 << aLayer);
m_LayerLocked &= ~GetLayerMask( aLayer );
}
......@@ -457,15 +460,18 @@ public:
* Function IsLayerVisible
* @return bool - true if the given layer is visible, else false.
*/
bool IsLayerVisible( int aLayer ) const { return (1<<aLayer) & m_LayerVisible; }
bool IsLayerVisible( int aLayer ) const
{
return GetLayerMask( aLayer ) & m_LayerVisible;
}
void SetLayerVisible( int aLayer, bool isVisible )
{
if( isVisible )
m_LayerVisible |= 1 << aLayer;
m_LayerVisible |= GetLayerMask( aLayer );
else
m_LayerVisible &= ~(1 << aLayer);
m_LayerVisible &= ~GetLayerMask( aLayer );
}
void SetLayerVisibleBits( int aLayerBits ) { m_LayerVisible = aLayerBits; }
void SetLayerVisibleBits( LAYER_MSK aLayerBits ) { m_LayerVisible = aLayerBits; }
/**
......
......@@ -122,7 +122,7 @@ void CONNECTIONS::SearchTracksConnectedToPads( bool add_to_padlist, bool add_to_
{
CONNECTED_POINT* cp_item = candidates[jj];
if( (pad->GetLayerMask() & cp_item->GetTrack()->ReturnMaskLayer()) == 0 )
if( (pad->GetLayerMask() & cp_item->GetTrack()->GetLayerMask()) == 0 )
continue;
if( pad->HitTest( cp_item->GetPoint() ) )
......@@ -296,7 +296,7 @@ int CONNECTIONS::SearchConnectedTracks( const TRACK * aTrack )
int count = 0;
m_connected.clear();
int layerMask = aTrack->ReturnMaskLayer();
LAYER_MSK layerMask = aTrack->GetLayerMask();
// Search for connections to starting point:
#define USE_EXTENDED_SEARCH
......@@ -318,7 +318,7 @@ int CONNECTIONS::SearchConnectedTracks( const TRACK * aTrack )
continue;
if( m_candidates[ii].GetPoint() != position )
break;
if( (m_candidates[ii].GetTrack()->ReturnMaskLayer() & layerMask ) != 0 )
if( m_candidates[ii].GetTrack()->GetLayerMask() & layerMask )
m_connected.push_back( m_candidates[ii].GetTrack() );
}
// search before:
......@@ -328,7 +328,7 @@ int CONNECTIONS::SearchConnectedTracks( const TRACK * aTrack )
continue;
if( m_candidates[ii].GetPoint() != position )
break;
if( (m_candidates[ii].GetTrack()->ReturnMaskLayer() & layerMask ) != 0 )
if( m_candidates[ii].GetTrack()->GetLayerMask() & layerMask )
m_connected.push_back( m_candidates[ii].GetTrack() );
}
}
......@@ -339,7 +339,7 @@ int CONNECTIONS::SearchConnectedTracks( const TRACK * aTrack )
{
TRACK * ctrack = tracks_candidates[ii]->GetTrack();
if( ( ctrack->ReturnMaskLayer() & layerMask ) == 0 )
if( ( ctrack->GetLayerMask() & layerMask ) == 0 )
continue;
if( ctrack == aTrack )
......
......@@ -127,7 +127,7 @@ void DIALOG_SVG_PRINT::initDialog()
if( m_boxSelectLayer[layer] == NULL )
continue;
long mask = 1 << layer;
LAYER_MSK mask = GetLayerMask( layer );
if( mask & s_SelectedLayers )
m_boxSelectLayer[layer]->SetValue( true );
......@@ -235,7 +235,7 @@ void DIALOG_SVG_PRINT::ExportSVGFile( bool aOnlyOneFile )
SetPenWidth();
// Build layers mask
int printMaskLayer = 0;
LAYER_MSK printMaskLayer = NO_LAYERS;
for( int layer = 0; layer<NB_LAYERS; layer++ )
{
......@@ -246,7 +246,7 @@ void DIALOG_SVG_PRINT::ExportSVGFile( bool aOnlyOneFile )
wxString msg;
for( int layer = 0; layer<NB_LAYERS; layer++ )
{
int currlayer_mask = 1 << layer;
LAYER_MSK currlayer_mask = GetLayerMask( layer );
if( (printMaskLayer & currlayer_mask ) == 0 )
continue;
......
......@@ -17,7 +17,7 @@ private:
PCB_BASE_FRAME* m_parent;
BOARD* m_board;
wxConfig* m_config;
long m_printMaskLayer;
LAYER_MSK m_printMaskLayer;
wxCheckBox* m_boxSelectLayer[32];
bool m_printBW;
wxString m_outputDirectory;
......
......@@ -94,10 +94,10 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( )
}
}
int masque_layer = 0;
int layers_filter = ALL_LAYERS;
LAYER_MSK masque_layer = NO_LAYERS;
LAYER_MSK layers_filter = ALL_LAYERS;
if( m_rbLayersOption->GetSelection() != 0 ) // Use current layer only
layers_filter = 1 << m_currentLayer;
layers_filter = GetLayerMask( m_currentLayer );
if( m_DelDrawings->GetValue() )
......@@ -111,7 +111,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( )
for( item = pcb->m_Drawings; item != NULL; item = nextitem )
{
nextitem = item->Next();
bool removeme = (GetLayerMask( item->GetLayer() ) & masque_layer) != 0;
bool removeme = GetLayerMask( item->GetLayer() ) & masque_layer;
if( ( item->Type() == PCB_TEXT_T ) && m_DelTexts->GetValue() )
removeme = true;
......@@ -162,7 +162,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( )
if( (track->Type() == PCB_VIA_T) && !m_TrackFilterVias->GetValue() )
continue;
if( (track->ReturnMaskLayer() & layers_filter) == 0 )
if( (track->GetLayerMask() & layers_filter) == 0 )
continue;
itemPicker.SetItem( track );
......
......@@ -76,7 +76,7 @@ private:
PCB_EDIT_FRAME* m_Parent;
int m_CopperLayerCount;
int m_EnabledLayers;
LAYER_MSK m_EnabledLayers;
BOARD* m_Pcb;
......@@ -90,12 +90,12 @@ private:
void showCopperChoice( int copperCount );
void showBoardLayerNames();
void showSelectedLayerCheckBoxes( int enableLayerMask );
void showSelectedLayerCheckBoxes( LAYER_MSK enableLayerMask );
void showLayerTypes();
void showPresets( int enabledLayerMask );
void showPresets( LAYER_MSK enabledLayerMask );
/** return the selected layer mask within the UI checkboxes */
int getUILayerMask();
LAYER_MSK getUILayerMask();
wxString getLayerName( int layer );
int getLayerTypeIndex( int layer );
......@@ -171,12 +171,12 @@ public:
// Layer bit masks for each defined "Preset Layer Grouping"
static const int presets[] =
static const LAYER_MSK presets[] =
{
#define FRONT_AUX (SILKSCREEN_LAYER_FRONT | SOLDERMASK_LAYER_FRONT | ADHESIVE_LAYER_FRONT | SOLDERPASTE_LAYER_FRONT)
#define BACK_AUX (SILKSCREEN_LAYER_BACK | SOLDERMASK_LAYER_BACK | ADHESIVE_LAYER_BACK | SOLDERPASTE_LAYER_BACK)
0, // shift the array index up by one, matches with "Custom".
NO_LAYERS, // shift the array index up by one, matches with "Custom".
// "Two layers, parts on Front only"
EDGE_LAYER | LAYER_FRONT | LAYER_BACK | FRONT_AUX,
......@@ -348,16 +348,16 @@ void DIALOG_LAYERS_SETUP::showBoardLayerNames()
}
void DIALOG_LAYERS_SETUP::showSelectedLayerCheckBoxes( int enabledLayers )
void DIALOG_LAYERS_SETUP::showSelectedLayerCheckBoxes( LAYER_MSK enabledLayers )
{
for( int layer=0; layer<NB_LAYERS; ++layer )
{
setLayerCheckBox( layer, (1<<layer) & enabledLayers );
setLayerCheckBox( layer, GetLayerMask( layer ) & enabledLayers );
}
}
void DIALOG_LAYERS_SETUP::showPresets( int enabledLayers )
void DIALOG_LAYERS_SETUP::showPresets( LAYER_MSK enabledLayers )
{
int presetsNdx = 0; // the "Custom" setting, matches nothing
......@@ -385,16 +385,16 @@ void DIALOG_LAYERS_SETUP::showLayerTypes()
}
int DIALOG_LAYERS_SETUP::getUILayerMask()
LAYER_MSK DIALOG_LAYERS_SETUP::getUILayerMask()
{
int layerMaskResult = 0;
LAYER_MSK layerMaskResult = NO_LAYERS;
for( int layer=0; layer<NB_LAYERS; ++layer )
{
wxCheckBox* ctl = getCheckBox( layer );
if( ctl->GetValue() )
{
layerMaskResult |= (1 << layer);
layerMaskResult |= GetLayerMask( layer );
}
}
......
......@@ -65,7 +65,7 @@ static PAD_ATTR_T CodeType[] = {
// Default mask layers setup for pads according to the pad type
static long Std_Pad_Layers[] = {
static const LAYER_MSK Std_Pad_Layers[] = {
// PAD_STANDARD:
PAD_STANDARD_DEFAULT_LAYERS,
......@@ -114,7 +114,7 @@ private:
* updates the CheckBox states in pad layers list,
* @param layer_mask = pad layer mask (ORed layers bit mask)
*/
void setPadLayersList( long layer_mask );
void setPadLayersList( LAYER_MSK layer_mask );
/// Copy values from dialog field to aPad's members
bool transferDataToPad( D_PAD* aPad );
......@@ -592,13 +592,12 @@ void DIALOG_PAD_PROPERTIES::PadOrientEvent( wxCommandEvent& event )
void DIALOG_PAD_PROPERTIES::PadTypeSelected( wxCommandEvent& event )
{
long layer_mask;
unsigned ii = m_PadType->GetSelection();
if( ii >= NBTYPES ) // catches < 0 also
ii = 0;
layer_mask = Std_Pad_Layers[ii];
LAYER_MSK layer_mask = Std_Pad_Layers[ii];
setPadLayersList( layer_mask );
// Enable/disable drill dialog items:
......@@ -619,7 +618,7 @@ void DIALOG_PAD_PROPERTIES::PadTypeSelected( wxCommandEvent& event )
}
void DIALOG_PAD_PROPERTIES::setPadLayersList( long layer_mask )
void DIALOG_PAD_PROPERTIES::setPadLayersList( LAYER_MSK layer_mask )
{
if( ( layer_mask & ALL_CU_LAYERS ) == LAYER_FRONT )
m_rbCopperLayersSel->SetSelection(0);
......@@ -672,7 +671,7 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK()
error_msgs.Add( _( "Incorrect value for pad drill: pad drill bigger than pad size" ) );
}
int padlayers_mask = m_dummyPad->GetLayerMask();
LAYER_MSK padlayers_mask = m_dummyPad->GetLayerMask();
if( ( padlayers_mask == 0 ) && ( m_dummyPad->GetAttribute() != PAD_HOLE_NOT_PLATED ) )
error_msgs.Add( _( "Error: pad has no layer and is not a mechanical pad" ) );
......@@ -851,7 +850,6 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
{
long padLayerMask;
wxString msg;
int x, y;
......@@ -1038,7 +1036,7 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
break;
}
padLayerMask = 0;
LAYER_MSK padLayerMask = NO_LAYERS;
switch( m_rbCopperLayersSel->GetSelection() )
{
......
......@@ -126,11 +126,11 @@ void DIALOG_PCB_TEXT_PROPERTIES::MyInit()
PutValueInLocalUnits( *m_PositionXCtrl, m_SelectedPCBText->GetTextPosition().x );
PutValueInLocalUnits( *m_PositionYCtrl, m_SelectedPCBText->GetTextPosition().y );
int enabledLayers = m_Parent->GetBoard()->GetEnabledLayers();
LAYER_MSK enabledLayers = m_Parent->GetBoard()->GetEnabledLayers();
for( int layer = 0; layer < NB_LAYERS; ++layer )
for( int layer = 0; layer < NB_LAYERS; ++layer )
{
if( enabledLayers & (1 << layer) )
if( enabledLayers & GetLayerMask( layer ) )
{
layerList.push_back( layer );
int itemIndex =
......
......@@ -282,7 +282,7 @@ int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection()
int page_count;
int layers_count = NB_LAYERS;
s_Parameters.m_PrintMaskLayer = 0;
s_Parameters.m_PrintMaskLayer = NO_LAYERS;
int ii;
for( ii = 0, page_count = 0; ii < layers_count; ii++ )
{
......@@ -291,7 +291,7 @@ int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection()
if( m_BoxSelectLayer[ii]->IsChecked() )
{
page_count++;
s_Parameters.m_PrintMaskLayer |= 1 << ii;
s_Parameters.m_PrintMaskLayer |= GetLayerMask( ii );
}
}
......
......@@ -183,7 +183,7 @@ void EraseDragList();
* @param aNetCode = the net code to consider
* @param aMaxDist = max distance from aRefPos to a track end candidate to collect the track
*/
void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, int aLayerMask,
void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, LAYER_MSK aLayerMask,
int aNetCode, int aMaxDist );
/* Add aTrack to the drag list
......
......@@ -334,7 +334,7 @@ void AddSegmentToDragList( int flag, TRACK* aTrack )
}
void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, int aLayerMask,
void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, LAYER_MSK aLayerMask,
int aNetCode, int aMaxDist )
{
TRACK* track = aPcb->m_Track->GetStartNetCode( aNetCode );
......@@ -344,7 +344,7 @@ void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, int aLaye
if( track->GetNet() != aNetCode ) // not the same netcodenet code: all candidates tested
break;
if( ( aLayerMask & track->ReturnMaskLayer() ) == 0 )
if( ( aLayerMask & track->GetLayerMask() ) == 0 )
continue; // Cannot be connected, not on the same layer
if( track->IsDragging() )
......@@ -393,7 +393,7 @@ void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, int aLaye
// If a connected via is found at location aRefPos,
// collect also tracks connected by this via.
if( track->Type() == PCB_VIA_T )
Collect_TrackSegmentsToDrag( aPcb, aRefPos, track->ReturnMaskLayer(),
Collect_TrackSegmentsToDrag( aPcb, aRefPos, track->GetLayerMask(),
aNetCode, track->GetWidth() / 2 );
}
}
......
......@@ -663,7 +663,7 @@ bool DRC::doTrackKeepoutDrc( TRACK* aRefSeg )
bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_limit )
{
int layerMask = aRefPad->GetLayerMask() & ALL_CU_LAYERS;
LAYER_MSK layerMask = aRefPad->GetLayerMask() & ALL_CU_LAYERS;
/* used to test DRC pad to holes: this dummy pad has the size and shape of the hole
* to test pad to pad hole DRC, using the pad to pad DRC test function.
......
......@@ -150,7 +150,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
{
TRACK* track;
wxPoint delta; // lenght on X and Y axis of segments
int layerMask;
LAYER_MSK layerMask;
int net_code_ref;
wxPoint shape_pos;
......@@ -164,7 +164,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
m_segmEnd = delta = aRefSeg->GetEnd() - origin;
m_segmAngle = 0;
layerMask = aRefSeg->ReturnMaskLayer();
layerMask = aRefSeg->GetLayerMask();
net_code_ref = aRefSeg->GetNet();
// Phase 0 : Test vias
......@@ -343,7 +343,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
continue;
// No problem if segment are on different layers :
if( ( layerMask & track->ReturnMaskLayer() ) == 0 )
if( ( layerMask & track->GetLayerMask() ) == 0 )
continue;
// the minimum distance = clearance plus half the reference track
......
......@@ -27,6 +27,7 @@
*/
#include <io_mgr.h>
#include <layers_id_colors_and_visibility.h>
// forward declaration on ptree template so we can confine use of big boost
......
......@@ -99,7 +99,7 @@ static void Abort_Create_Track( EDA_DRAW_PANEL* Panel, wxDC* DC )
TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
{
TRACK* TrackOnStartPoint = NULL;
int layerMask = GetLayerMask( GetScreen()->m_Active_Layer );
LAYER_MSK layerMask = GetLayerMask( GetScreen()->m_Active_Layer );
BOARD_CONNECTED_ITEM* LockPoint;
wxPoint pos = GetScreen()->GetCrossHairPosition();
......@@ -411,7 +411,7 @@ bool PCB_EDIT_FRAME::Add45DegreeSegment( wxDC* aDC )
bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC )
{
int layerMask = GetLayerMask( GetScreen()->m_Active_Layer );
LAYER_MSK layerMask = GetLayerMask( GetScreen()->m_Active_Layer );
if( aTrack == NULL )
return false;
......
......@@ -231,8 +231,8 @@ static int ViaSort( const void* aRefptr, const void* aObjptr )
if( padref->GetDrillValue() != padcmp->GetDrillValue() )
return padref->GetDrillValue() - padcmp->GetDrillValue();
if( padref->ReturnMaskLayer() != padcmp->ReturnMaskLayer() )
return padref->ReturnMaskLayer() - padcmp->ReturnMaskLayer();
if( padref->GetLayerMask() != padcmp->GetLayerMask() )
return padref->GetLayerMask() - padcmp->GetLayerMask();
return 0;
}
......@@ -258,7 +258,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb )
padstacks.resize( 1 ); // We count pads from 1
// The master layermask (i.e. the enabled layers) for padstack generation
unsigned master_layermask = aPcb->GetDesignSettings().GetEnabledLayers();
LAYER_MSK master_layermask = aPcb->GetDesignSettings().GetEnabledLayers();
fputs( "$PADS\n", aFile );
......@@ -293,7 +293,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb )
viastacks.push_back( via );
fprintf( aFile, "PAD V%d.%d.%X ROUND %g\nCIRCLE 0 0 %g\n",
via->GetWidth(), via->GetDrillValue(),
via->ReturnMaskLayer(),
via->GetLayerMask(),
via->GetDrillValue() / SCALE_FACTOR,
via->GetWidth() / (SCALE_FACTOR * 2) );
}
......@@ -434,14 +434,14 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb )
for( unsigned i = 0; i < viastacks.size(); i++ )
{
TRACK* via = viastacks[i];
unsigned mask = via->ReturnMaskLayer() & master_layermask;
LAYER_MSK mask = via->GetLayerMask() & master_layermask;
fprintf( aFile, "PADSTACK VIA%d.%d.%X %g\n",
via->GetWidth(), via->GetDrillValue(), mask,
via->GetDrillValue() / SCALE_FACTOR );
for( int layer = 0; layer < 32; layer++ )
{
if( mask & (1 << layer) )
if( mask & GetLayerMask( layer ) )
{
fprintf( aFile, "PAD V%d.%d.%X %s 0 0\n",
via->GetWidth(), via->GetDrillValue(),
......@@ -465,7 +465,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb )
pad->GetDrillSize().x / SCALE_FACTOR );
for( int layer = 0; layer < 32; layer++ )
{
if( pad->GetLayerMask() & (1 << layer) & master_layermask )
if( pad->GetLayerMask() & GetLayerMask( layer ) & master_layermask )
{
fprintf( aFile, "PAD P%d %s 0 0\n", i,
TO_UTF8( GenCADLayerName[layer] ) );
......@@ -477,7 +477,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb )
pad->GetDrillSize().x / SCALE_FACTOR );
for( int layer = 0; layer < 32; layer++ )
{
if( pad->GetLayerMask() & (1 << layer) & master_layermask )
if( pad->GetLayerMask() & GetLayerMask( layer ) & master_layermask )
{
fprintf( aFile, "PAD P%d %s 0 0\n", i,
TO_UTF8( GenCADLayerNameFlipped[layer] ) );
......@@ -760,7 +760,7 @@ static void CreateRoutesSection( FILE* aFile, BOARD* aPcb )
int vianum = 1;
int old_netcode, old_width, old_layer;
int nbitems, ii;
unsigned master_layermask = aPcb->GetDesignSettings().GetEnabledLayers();
LAYER_MSK master_layermask = aPcb->GetDesignSettings().GetEnabledLayers();
// Count items
nbitems = 0;
......@@ -836,7 +836,7 @@ static void CreateRoutesSection( FILE* aFile, BOARD* aPcb )
{
fprintf( aFile, "VIA VIA%d.%d.%X %g %g ALL %g via%d\n",
track->GetWidth(), track->GetDrillValue(),
track->ReturnMaskLayer() & master_layermask,
track->GetLayerMask() & master_layermask,
MapXTo( track->GetStart().x ), MapYTo( track->GetStart().y ),
track->GetDrillValue() / SCALE_FACTOR, vianum++ );
}
......
......@@ -918,7 +918,7 @@ static void export_vrml_pad( BOARD* pcb, D_PAD* aPad ) //{{{
}
// The pad proper, on the selected layers
int layer_mask = aPad->GetLayerMask();
LAYER_MSK layer_mask = aPad->GetLayerMask();
int copper_layers = pcb->GetCopperLayerCount( );
// The (maybe offseted) pad position
......@@ -939,7 +939,7 @@ static void export_vrml_pad( BOARD* pcb, D_PAD* aPad ) //{{{
if( (layer > FIRST_COPPER_LAYER) && (layer == copper_layers - 1) )
layer = LAST_COPPER_LAYER;
if( layer_mask & (1 << layer) )
if( layer_mask & GetLayerMask( layer ) )
{
// OK, the pad is on this layer, export it
switch( aPad->GetShape() )
......
......@@ -425,7 +425,7 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
m_out->Print( aNestLevel, "(layers\n" );
unsigned mask = LAYER_FRONT;
unsigned layer = LAYER_N_FRONT;
int layer = LAYER_N_FRONT;
// Save only the used copper layers from front to back.
while( mask != 0 )
......@@ -980,12 +980,12 @@ void PCB_IO::format( MODULE* aModule, int aNestLevel ) const
}
void PCB_IO::formatLayers( int aLayerMask, int aNestLevel ) const
void PCB_IO::formatLayers( LAYER_MSK aLayerMask, int aNestLevel ) const
throw( IO_ERROR )
{
m_out->Print( aNestLevel, "(layers" );
int cuMask = ALL_CU_LAYERS;
LAYER_MSK cuMask = ALL_CU_LAYERS;
if( m_board )
cuMask &= m_board->GetEnabledLayers();
......
......@@ -26,6 +26,7 @@
#include <io_mgr.h>
#include <string>
#include <layers_id_colors_and_visibility.h>
class BOARD;
class BOARD_ITEM;
......@@ -189,7 +190,7 @@ private:
void formatLayer( const BOARD_ITEM* aItem ) const;
void formatLayers( int aLayerMask, int aNestLevel = 0 ) const
void formatLayers( LAYER_MSK aLayerMask, int aNestLevel = 0 ) const
throw( IO_ERROR );
/// we only cache one footprint library for now, this determines which one.
......
......@@ -41,6 +41,7 @@
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <layers_id_colors_and_visibility.h>
#include <colors.h>
#define LYR_COLUMN_COUNT 4 ///< Layer tab column count
......
......@@ -409,7 +409,7 @@ void LEGACY_PLUGIN::loadGENERAL()
else if( TESTLINE( "EnabledLayers" ) )
{
int enabledLayers = hexParse( line + SZ( "EnabledLayers" ) );
LAYER_MSK enabledLayers = hexParse( line + SZ( "EnabledLayers" ) );
// layer usage
m_board->SetEnabledLayers( enabledLayers );
......@@ -420,7 +420,7 @@ void LEGACY_PLUGIN::loadGENERAL()
else if( TESTLINE( "VisibleLayers" ) )
{
int visibleLayers = hexParse( line + SZ( "VisibleLayers" ) );
LAYER_MSK visibleLayers = hexParse( line + SZ( "VisibleLayers" ) );
m_board->SetVisibleLayers( visibleLayers );
}
......@@ -1239,7 +1239,6 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule )
// sscanf( PtLine, "%s %s %X", BufLine, BufCar, &m_layerMask );
PAD_ATTR_T attribute;
int layer_mask;
data = strtok( line + SZ( "At" ), delims );
......@@ -1255,7 +1254,7 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule )
data = strtok( NULL, delims ); // skip BufCar
data = strtok( NULL, delims );
layer_mask = hexParse( data );
LAYER_MSK layer_mask = hexParse( data );
pad->SetLayerMask( layer_mask );
pad->SetAttribute( attribute );
......
......@@ -157,7 +157,7 @@ bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize,
if( doPad )
{
int layer_mask = GetLayerMask( screen->m_Active_Layer );
LAYER_MSK layer_mask = GetLayerMask( screen->m_Active_Layer );
D_PAD* pad = m_Pcb->GetPad( pos, layer_mask );
if( pad )
......@@ -192,7 +192,7 @@ bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize,
if( !currTrack )
{
int layer_mask = GetLayerMask( layer );
LAYER_MSK layer_mask = GetLayerMask( layer );
TRACK* track = m_Pcb->GetTrace( m_Pcb->m_Track, pos, layer_mask );
......
......@@ -154,7 +154,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, int aPrintMaskLayer, bool aPrintMirrorMode,
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMaskLayer, bool aPrintMirrorMode,
void * aData = NULL);
// BOARD handling
......
......@@ -629,7 +629,7 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC
if( aCommand != ID_POPUP_PCB_MOVE_TRACK_SEGMENT )
{
Collect_TrackSegmentsToDrag( GetBoard(), aTrack->GetStart(),
aTrack->ReturnMaskLayer(),
aTrack->GetLayerMask(),
aTrack->GetNet(), aTrack->GetWidth() / 2 );
}
......@@ -649,17 +649,17 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT: // drag a segment
pos = aTrack->GetStart();
Collect_TrackSegmentsToDrag( GetBoard(), pos, aTrack->ReturnMaskLayer(),
Collect_TrackSegmentsToDrag( GetBoard(), pos, aTrack->GetLayerMask(),
aTrack->GetNet(), aTrack->GetWidth() / 2 );
pos = aTrack->GetEnd();
aTrack->SetFlags( IS_DRAGGED | ENDPOINT | STARTPOINT );
Collect_TrackSegmentsToDrag( GetBoard(), pos, aTrack->ReturnMaskLayer(),
Collect_TrackSegmentsToDrag( GetBoard(), pos, aTrack->GetLayerMask(),
aTrack->GetNet(), aTrack->GetWidth() / 2 );
break;
case ID_POPUP_PCB_MOVE_TRACK_NODE: // Drag via or move node
pos = (diag & STARTPOINT) ? aTrack->GetStart() : aTrack->GetEnd();
Collect_TrackSegmentsToDrag( GetBoard(), pos, aTrack->ReturnMaskLayer(),
Collect_TrackSegmentsToDrag( GetBoard(), pos, aTrack->GetLayerMask(),
aTrack->GetNet(), aTrack->GetWidth() / 2 );
PosInit = pos;
break;
......@@ -865,7 +865,7 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
/* Test the connections modified by the move
* (only pad connection must be tested, track connection will be
* tested by TestNetConnection() ) */
int layerMask = GetLayerMask( Track->GetLayer() );
LAYER_MSK layerMask = GetLayerMask( Track->GetLayer() );
Track->start = GetBoard()->GetPadFast( Track->GetStart(), layerMask );
if( Track->start )
......
......@@ -31,6 +31,7 @@
#define PCB_CALLBACKS_H_
#include <wx/wx.h>
#include "include/layers_id_colors_and_visibility.h"
enum LAYER_TYPE_T
{
......
......@@ -66,7 +66,7 @@ void PCB_PARSER::init()
std::string untranslated = TO_UTF8( BOARD::GetStandardLayerName( layerNdx ) );
m_layerIndices[ untranslated ] = layerNdx;
m_layerMasks[ untranslated ] = 1 << layerNdx;
m_layerMasks[ untranslated ] = GetLayerMask( layerNdx );
}
m_layerMasks[ "*.Cu" ] = ALL_CU_LAYERS;
......@@ -667,8 +667,8 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR )
std::string type;
int layerIndex;
bool isVisible = true;
int visibleLayers = 0;
int enabledLayers = 0;
LAYER_MSK visibleLayers = NO_LAYERS;
LAYER_MSK enabledLayers = NO_LAYERS;
int copperLayerCount = 0;
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
......@@ -700,13 +700,13 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR )
Expecting( "hide or )" );
}
enabledLayers |= 1 << layerIndex;
enabledLayers |= GetLayerMask( layerIndex );
if( isVisible )
visibleLayers |= 1 << layerIndex;
visibleLayers |= GetLayerMask( layerIndex );
m_layerIndices[ name ] = layerIndex;
m_layerMasks[ name ] = 1 << layerIndex;
m_layerMasks[ name ] = GetLayerMask(layerIndex);
wxString wname = FROM_UTF8( name.c_str() );
enum LAYER_T layerType = LAYER::ParseType( type.c_str() );
......@@ -736,10 +736,11 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR )
}
int PCB_PARSER::lookUpLayer( const LAYER_MAP& aMap ) throw( PARSE_ERROR, IO_ERROR )
template<class T, class M>
T PCB_PARSER::lookUpLayer( const M& aMap ) throw( PARSE_ERROR, IO_ERROR )
{
// avoid constructing another std::string, use lexer's directly
LAYER_MAP::const_iterator it = aMap.find( curText );
typename M::const_iterator it = aMap.find( curText );
if( it == aMap.end() )
{
......@@ -747,7 +748,7 @@ int PCB_PARSER::lookUpLayer( const LAYER_MAP& aMap ) throw( PARSE_ERROR, IO_ERRO
// dump the whole darn table, there's something wrong with it.
for( it = aMap.begin(); it != aMap.end(); ++it )
{
printf( &aMap == &m_layerIndices ? "lm[%s] = %d\n" : "lm[%s] = %08X\n",
printf( &aMap == (void*)&m_layerIndices ? "lm[%s] = %d\n" : "lm[%s] = %08X\n",
it->first.c_str(), it->second );
}
#endif
......@@ -771,7 +772,7 @@ int PCB_PARSER::parseBoardItemLayer() throw( PARSE_ERROR, IO_ERROR )
NextTok();
int layerIndex = lookUpLayer( m_layerIndices );
int layerIndex = lookUpLayer<int>( m_layerIndices );
// Handle closing ) in object parser.
......@@ -779,17 +780,17 @@ int PCB_PARSER::parseBoardItemLayer() throw( PARSE_ERROR, IO_ERROR )
}
int PCB_PARSER::parseBoardItemLayersAsMask() throw( PARSE_ERROR, IO_ERROR )
LAYER_MSK PCB_PARSER::parseBoardItemLayersAsMask() throw( PARSE_ERROR, IO_ERROR )
{
wxCHECK_MSG( CurTok() == T_layers, 0,
wxCHECK_MSG( CurTok() == T_layers, NO_LAYERS,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) +
wxT( " as item layer mask." ) );
int layerMask = 0;
LAYER_MSK layerMask = NO_LAYERS;
for( T token = NextTok(); token != T_RIGHT; token = NextTok() )
{
int mask = lookUpLayer( m_layerMasks );
LAYER_MSK mask = lookUpLayer<LAYER_MSK>( m_layerMasks );
layerMask |= mask;
}
......@@ -2152,7 +2153,7 @@ D_PAD* PCB_PARSER::parseD_PAD() throw( IO_ERROR, PARSE_ERROR )
case T_layers:
{
int layerMask = parseBoardItemLayersAsMask();
LAYER_MSK layerMask = parseBoardItemLayersAsMask();
pad->SetLayerMask( layerMask );
}
break;
......@@ -2324,9 +2325,9 @@ SEGVIA* PCB_PARSER::parseSEGVIA() throw( IO_ERROR, PARSE_ERROR )
{
int layer1, layer2;
NextTok();
layer1 = lookUpLayer( m_layerIndices );
layer1 = lookUpLayer<int>( m_layerIndices );
NextTok();
layer2 = lookUpLayer( m_layerIndices );
layer2 = lookUpLayer<int>( m_layerIndices );
via->SetLayerPair( layer1, layer2 );
NeedRIGHT();
}
......
......@@ -58,11 +58,12 @@ class FPL_CACHE;
*/
class PCB_PARSER : public PCB_LEXER
{
typedef KEYWORD_MAP LAYER_MAP;
typedef boost::unordered_map< std::string, int > LAYER_NUM_MAP;
typedef boost::unordered_map< std::string, LAYER_MSK > LAYER_MSK_MAP;
BOARD* m_board;
LAYER_MAP m_layerIndices; ///< map layer name to it's index
LAYER_MAP m_layerMasks; ///< map layer names to their masks
LAYER_NUM_MAP m_layerIndices; ///< map layer name to it's index
LAYER_MSK_MAP m_layerMasks; ///< map layer names to their masks
/**
......@@ -99,13 +100,14 @@ class PCB_PARSER : public PCB_LEXER
* Function lookUpLayer
* parses the current token for the layer definition of a #BOARD_ITEM object.
*
* @param aMap is the LAYER_MAP to use for the lookup.
* @param aMap is the LAYER_{NUM|MSK}_MAP to use for the lookup.
*
* @throw IO_ERROR if the layer is not valid.
* @throw PARSE_ERROR if the layer syntax is incorrect.
* @return int - The result of the parsed #BOARD_ITEM layer or set designator.
*/
int lookUpLayer( const LAYER_MAP& aMap ) throw( PARSE_ERROR, IO_ERROR );
template<class T, class M>
T lookUpLayer( const M& aMap ) throw( PARSE_ERROR, IO_ERROR );
/**
* Function parseBoardItemLayer
......@@ -125,7 +127,7 @@ class PCB_PARSER : public PCB_LEXER
* @throw PARSE_ERROR if the layers syntax is incorrect.
* @return The mask of layers the parsed #BOARD_ITEM is on.
*/
int parseBoardItemLayersAsMask() throw( PARSE_ERROR, IO_ERROR );
LAYER_MSK parseBoardItemLayersAsMask() throw( PARSE_ERROR, IO_ERROR );
/**
* Function parseXY
......
......@@ -27,6 +27,7 @@
#include <pcb_plot_params_lexer.h>
#include <eda_text.h> // EDA_DRAW_MODE_T
#include <plot_common.h>
#include <layers_id_colors_and_visibility.h>
class PCB_PLOT_PARAMS;
class LINE_READER;
......@@ -115,7 +116,7 @@ private:
bool m_excludeEdgeLayer;
/// Set of layers to plot
long m_layerSelection;
LAYER_MSK m_layerSelection;
/** When plotting gerbers use a conventional set of extensions instead of
* appending a suffix to the board name */
......
......@@ -9,6 +9,7 @@
#include <fctsys.h> // wxWidgets include.
#include <base_struct.h> // IS_DRAGGED and IN_EDIT definitions.
#include <convert_to_biu.h> // to define DMils2iu() conversion function
#include <layers_id_colors_and_visibility.h>
// Arcs are approximated by segments: define the number of segments per 360 deg (KiCad uses 0.1
// deg approximation). Be aware 3600 / ARC_APPROX_SEGMENTS_COUNT_LOW_DEF is an integer.
......
......@@ -255,11 +255,9 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
// Save the current plot options in the board
m_parent->SetPlotSettings( m_plotOpts );
long layerMask = 1;
for( layer = 0; layer < NB_LAYERS; layer++, layerMask <<= 1 )
for( layer = 0; layer < NB_LAYERS; ++layer )
{
if( m_plotOpts.GetLayerSelection() & layerMask )
if( m_plotOpts.GetLayerSelection() & GetLayerMask( layer ) )
{
// Pick the basename from the board file
wxFileName fn( boardFilename );
......
......@@ -32,6 +32,7 @@
#include <wx/filename.h>
#include <pad_shapes.h>
#include <pcb_plot_params.h>
#include <layers_id_colors_and_visibility.h>
class PLOTTER;
class TEXTE_PCB;
......@@ -199,7 +200,7 @@ void PlotOneBoardLayer( BOARD* aBoard, PLOTTER* aPlotter, int aLayer,
* SetDrillMarksType( DrillMarksType aVal ) controle the actual hole:
* no hole, small hole, actual hole
*/
void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, long aLayerMask,
void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LAYER_MSK aLayerMask,
const PCB_PLOT_PARAMS& aPlotOpt );
/**
......@@ -211,7 +212,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, long aLayerMask,
* @param aLayerMask = the mask to define the layers to plot (silkscreen Front and/or Back)
* @param aPlotOpt = the plot options (files, sketch). Has meaning for some formats only
*/
void PlotSilkScreen( BOARD* aBoard, PLOTTER* aPlotter, long aLayerMask,
void PlotSilkScreen( BOARD* aBoard, PLOTTER* aPlotter, LAYER_MSK aLayerMask,
const PCB_PLOT_PARAMS& aPlotOpt );
......
......@@ -67,7 +67,7 @@ static void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter,
* Silkscreen layers have specific requirement for pads (not filled) and texts
* (with option to remove them from some copper areas (pads...)
*/
void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, LAYER_MSK aLayerMask,
const PCB_PLOT_PARAMS& aPlotOpt )
{
BRDITEMS_PLOTTER itemplotter( aPlotter, aBoard, aPlotOpt );
......@@ -93,7 +93,7 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
for( D_PAD * pad = Module->Pads(); pad != NULL; pad = pad->Next() )
{
// See if the pad is on this layer
int masklayer = pad->GetLayerMask();
LAYER_MSK masklayer = pad->GetLayerMask();
if( (masklayer & layersmask_plotpads) == 0 )
continue;
......@@ -124,7 +124,7 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
{
ZONE_CONTAINER* edge_zone = aBoard->GetArea( ii );
if( ( ( 1 << edge_zone->GetLayer() ) & aLayerMask ) == 0 )
if( ( GetLayerMask( edge_zone->GetLayer() ) & aLayerMask ) == 0 )
continue;
itemplotter.PlotFilledAreas( edge_zone );
......@@ -134,7 +134,7 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
// compatibility):
for( SEGZONE* seg = aBoard->m_Zone; seg != NULL; seg = seg->Next() )
{
if( ( ( 1 << seg->GetLayer() ) & aLayerMask ) == 0 )
if( ( GetLayerMask( seg->GetLayer() ) & aLayerMask ) == 0 )
continue;
aPlotter->ThickSegment( seg->GetStart(), seg->GetEnd(), seg->GetWidth(),
......@@ -154,7 +154,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, int aLayer,
// Specify that the contents of the "Edges Pcb" layer are to be plotted
// in addition to the contents of the currently specified layer.
int layer_mask = GetLayerMask( aLayer );
LAYER_MSK layer_mask = GetLayerMask( aLayer );
if( !aPlotOpt.GetExcludeEdgeLayer() )
layer_mask |= EDGE_LAYER;
......@@ -240,7 +240,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, int aLayer,
* Silk screen layers are not plotted here.
*/
void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
long aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt )
LAYER_MSK aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt )
{
BRDITEMS_PLOTTER itemplotter( aPlotter, aBoard, aPlotOpt );
......@@ -367,7 +367,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
// vias are not plotted if not on selected layer, but if layer
// is SOLDERMASK_LAYER_BACK or SOLDERMASK_LAYER_FRONT,vias are drawn,
// only if they are on the corresponding external copper layer
int via_mask_layer = Via->ReturnMaskLayer();
int via_mask_layer = Via->GetLayerMask();
if( aPlotOpt.GetPlotViaOnMaskLayer() )
{
......@@ -435,7 +435,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
{
ZONE_CONTAINER* zone = aBoard->GetArea( ii );
if( ( ( 1 << zone->GetLayer() ) & aLayerMask ) == 0 )
if( ( GetLayerMask(zone->GetLayer() ) & aLayerMask ) == 0 )
continue;
itemplotter.PlotFilledAreas( zone );
......@@ -580,7 +580,7 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter,
// vias are plotted only if they are on the corresponding
// external copper layer
int via_mask_layer = via->ReturnMaskLayer();
LAYER_MSK via_mask_layer = via->GetLayerMask();
if( via_mask_layer & LAYER_BACK )
via_mask_layer |= SOLDERMASK_LAYER_BACK;
......
......@@ -112,7 +112,7 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule )
if( textLayer >= LAYER_COUNT )
return false;
if( ( ( 1 << textLayer ) & m_layerMask ) == 0 )
if( ( GetLayerMask( textLayer ) & m_layerMask ) == 0 )
trace_ref = false;
if( !textModule->IsVisible() && !GetPlotInvisibleText() )
......@@ -124,7 +124,7 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule )
if( textLayer > LAYER_COUNT )
return false;
if( ( (1 << textLayer) & m_layerMask ) == 0 )
if( ( GetLayerMask( textLayer ) & m_layerMask ) == 0 )
trace_val = false;
if( !textModule->IsVisible() && !GetPlotInvisibleText() )
......@@ -164,7 +164,7 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule )
if( textLayer >= LAYER_COUNT )
return false;
if( !( ( 1 << textLayer ) & m_layerMask ) )
if( !( GetLayerMask( textLayer ) & m_layerMask ) )
continue;
PlotTextModule( textModule, getColor( textLayer ) );
......
......@@ -45,11 +45,11 @@
static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule,
GR_DRAWMODE aDraw_mode, int aMasklayer,
GR_DRAWMODE aDraw_mode, LAYER_MSK aMasklayer,
PRINT_PARAMETERS::DrillShapeOptT aDrillShapeOpt );
void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
int aPrintMaskLayer,
LAYER_MSK aPrintMaskLayer,
bool aPrintMirrorMode,
void * aData)
{
......@@ -131,7 +131,7 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
* @param aData = a pointer to an optional data (NULL if not used)
*/
void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
int aPrintMaskLayer,
LAYER_MSK aPrintMaskLayer,
bool aPrintMirrorMode,
void* aData)
{
......@@ -176,7 +176,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
for(int kk = 0; kk < 32; kk ++ )
{
if( ((1 << kk) & aPrintMaskLayer) != 0 )
if( GetLayerMask( kk ) & aPrintMaskLayer )
{
GetScreen()->m_Active_Layer = kk;
break;
......@@ -232,10 +232,8 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
case PCB_DIMENSION_T:
case PCB_TEXT_T:
case PCB_TARGET_T:
if( ( ( 1 << item->GetLayer() ) & aPrintMaskLayer ) == 0 )
break;
item->Draw( m_canvas, aDC, drawmode );
if( GetLayerMask( item->GetLayer() ) & aPrintMaskLayer )
item->Draw( m_canvas, aDC, drawmode );
break;
case PCB_MARKER_T:
......@@ -247,7 +245,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
// Print tracks
for( TRACK * track = Pcb->m_Track; track; track = track->Next() )
{
if( ( aPrintMaskLayer & track->ReturnMaskLayer() ) == 0 )
if( !( aPrintMaskLayer & track->GetLayerMask() ) )
continue;
if( track->Type() == PCB_VIA_T ) // VIA encountered.
......@@ -270,7 +268,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
// Outdated: only for compatibility to old boards
for( TRACK * track = Pcb->m_Zone; track != NULL; track = track->Next() )
{
if( ( aPrintMaskLayer & track->ReturnMaskLayer() ) == 0 )
if( !( aPrintMaskLayer & track->GetLayerMask() ) )
continue;
track->Draw( m_canvas, aDC, drawmode );
......@@ -281,9 +279,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
{
ZONE_CONTAINER* zone = Pcb->GetArea( ii );
if( ( aPrintMaskLayer & ( 1 << zone->GetLayer() ) ) == 0 )
continue;
if( aPrintMaskLayer & GetLayerMask( zone->GetLayer() ) )
zone->DrawFilledArea( m_canvas, aDC, drawmode );
}
......@@ -312,7 +308,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
for( ; track != NULL; track = track->Next() )
{
if( ( aPrintMaskLayer & track->ReturnMaskLayer() ) == 0 )
if( !( aPrintMaskLayer & track->GetLayerMask() ) )
continue;
if( track->Type() == PCB_VIA_T ) // VIA encountered.
......@@ -350,13 +346,13 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule,
GR_DRAWMODE aDraw_mode, int aMasklayer,
GR_DRAWMODE aDraw_mode, LAYER_MSK aMasklayer,
PRINT_PARAMETERS::DrillShapeOptT aDrillShapeOpt )
{
// Print pads
for( D_PAD* pad = aModule->Pads(); pad; pad = pad->Next() )
{
if( (pad->GetLayerMask() & aMasklayer ) == 0 )
if( !(pad->GetLayerMask() & aMasklayer ) )
continue;
// Manage hole according to the print drill option
......@@ -387,7 +383,7 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule,
}
// Print footprint graphic shapes
int mlayer = GetLayerMask( aModule->GetLayer() );
LAYER_MSK mlayer = GetLayerMask( aModule->GetLayer() );
if( aModule->GetLayer() == LAYER_N_BACK )
mlayer = SILKSCREEN_LAYER_BACK;
......
......@@ -95,7 +95,7 @@ bool BOARD_PRINTOUT_CONTROLLER::OnPrintPage( int aPage )
int layers_count = LAYER_COUNT;
#endif
int mask_layer = m_PrintParams.m_PrintMaskLayer;
LAYER_MSK mask_layer = m_PrintParams.m_PrintMaskLayer;
// compute layer mask from page number if we want one page per layer
if( m_PrintParams.m_OptionPrintPage == 0 ) // One page per layer
......
......@@ -33,7 +33,7 @@
#include <wx/dcps.h>
#include <layers_id_colors_and_visibility.h>
#define DEFAULT_ORIENTATION_PAPER wxLANDSCAPE // other option is wxPORTRAIT
......@@ -51,7 +51,7 @@ public:
double m_XScaleAdjust; // fine scale adjust for X axis
double m_YScaleAdjust; // fine scale adjust for Y axis
bool m_Print_Sheet_Ref; // Option: print page references
long m_PrintMaskLayer; // Layers to print
LAYER_MSK m_PrintMaskLayer; // Layers to print
bool m_PrintMirror; // Option: Print mirrored
bool m_Print_Black_and_White; // Option: Print in B&W or Color
int m_OptionPrintPage; // Option: 0 = a layer per page, 1 = all layers at once
......
......@@ -56,7 +56,7 @@ void DrawTraces( EDA_DRAW_PANEL* panel,
* calculates the mask layer when flipping a footprint.
* BACK and FRONT copper layers , mask, paste, solder layers are swapped.
*/
int ChangeSideMaskLayer( int aMask );
LAYER_MSK ChangeSideMaskLayer( LAYER_MSK aMask );
void DrawModuleOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* module );
......
......@@ -107,8 +107,8 @@ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( PCB_BASE_FRAME* parent,
/* Build the layer list */
LayerCount = 0;
int Masque_Layer = g_TabAllCopperLayerMask[board->GetCopperLayerCount() - 1];
Masque_Layer += ALL_NO_CU_LAYERS;
LAYER_MSK Masque_Layer = g_TabAllCopperLayerMask[board->GetCopperLayerCount() - 1];
Masque_Layer |= ALL_NO_CU_LAYERS;
for( ii = 0; ii < NB_LAYERS; ii++ )
{
......@@ -262,8 +262,8 @@ SELECT_LAYERS_PAIR_DIALOG::SELECT_LAYERS_PAIR_DIALOG( PCB_BASE_FRAME* parent ) :
m_Parent = parent;
PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->GetScreen();
int Masque_Layer = g_TabAllCopperLayerMask[board->GetCopperLayerCount() - 1];
Masque_Layer += ALL_NO_CU_LAYERS;
LAYER_MSK Masque_Layer = g_TabAllCopperLayerMask[board->GetCopperLayerCount() - 1];
Masque_Layer |= ALL_NO_CU_LAYERS;
for( ii = 0, LayerCount = 0; ii < NB_COPPER_LAYERS; ii++ )
{
......
......@@ -70,7 +70,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
int ii, jj, nb_segm, nbconnect;
wxPoint start;
wxPoint end;
int startmasklayer, endmasklayer;
LAYER_MSK startmasklayer, endmasklayer;
int netcode = aNewTrack->GetNet();
......@@ -135,14 +135,14 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
return 0;
// Determine layers interconnected these points.
startmasklayer = StartTrack->ReturnMaskLayer();
endmasklayer = EndTrack->ReturnMaskLayer();
startmasklayer = StartTrack->GetLayerMask();
endmasklayer = EndTrack->GetLayerMask();
// There may be a via or a pad on the end points.
pt_segm = m_Pcb->m_Track->GetVia( NULL, start, startmasklayer );
if( pt_segm )
startmasklayer |= pt_segm->ReturnMaskLayer();
startmasklayer |= pt_segm->GetLayerMask();
if( StartTrack->start && ( StartTrack->start->Type() == PCB_PAD_T ) )
{
......@@ -154,7 +154,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
pt_segm = m_Pcb->m_Track->GetVia( NULL, end, endmasklayer );
if( pt_segm )
endmasklayer |= pt_segm->ReturnMaskLayer();
endmasklayer |= pt_segm->GetLayerMask();
if( EndTrack->end && ( EndTrack->end->Type() == PCB_PAD_T ) )
{
......
......@@ -55,7 +55,7 @@
* The pads must appear on the layers selected in LayerMask
*/
static void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module,
int ox, int oy, int LayerMask, GR_DRAWMODE draw_mode );
int ox, int oy, LAYER_MSK LayerMask, GR_DRAWMODE draw_mode );
void FOOTPRINT_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
......@@ -199,7 +199,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, GR_DRAWMODE aDrawMode, const
for( MODULE* module = m_Modules; module; module = module->Next() )
{
bool display = true;
int layerMask = ALL_CU_LAYERS;
LAYER_MSK layerMask = ALL_CU_LAYERS;
if( module->IsMoving() )
continue;
......@@ -286,7 +286,7 @@ void BOARD::DrawHighLight( EDA_DRAW_PANEL* am_canvas, wxDC* DC, int aNetCode )
* The pads must appear on the layers selected in LayerMask
*/
static void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* aModule,
int ox, int oy, int aLayerMask, GR_DRAWMODE draw_mode )
int ox, int oy, LAYER_MSK aLayerMask, GR_DRAWMODE draw_mode )
{
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent();
......
......@@ -19,7 +19,7 @@
#include <pad_shapes.h>
#include <wx/gdicmn.h> // for wxPoint definition
#include <layers_id_colors_and_visibility.h>
#include <polygons_defs.h>
class CRect
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment