Commit ad750def authored by Dick Hollenbeck's avatar Dick Hollenbeck

LAYER_ID work

parent 9c8d221f
...@@ -285,7 +285,7 @@ void EDA_3D_CANVAS::BuildBoard3DView() ...@@ -285,7 +285,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
// but I assume that's backwards // but I assume that's backwards
for( unsigned i=0; i<DIM(cu_seq); ++i ) for( unsigned i=0; i<DIM(cu_seq); ++i )
cu_seq[i] = LAYER_ID( B_Cu - i ); cu_seq[i] = ToLAYER_ID( B_Cu - i );
for( LSEQ cu = cu_set.Seq( cu_seq, DIM(cu_seq) ); cu; ++cu ) for( LSEQ cu = cu_set.Seq( cu_seq, DIM(cu_seq) ); cu; ++cu )
#else #else
......
...@@ -120,7 +120,7 @@ void LAYER_BOX_SELECTOR::ResyncBitmapOnly() ...@@ -120,7 +120,7 @@ void LAYER_BOX_SELECTOR::ResyncBitmapOnly()
for( LAYER_NUM i = 0; i < elements; ++i ) for( LAYER_NUM i = 0; i < elements; ++i )
{ {
wxBitmap layerbmp( 14, 14 ); wxBitmap layerbmp( 14, 14 );
SetBitmapLayer( layerbmp, LAYER_ID( i ) ); SetBitmapLayer( layerbmp, ToLAYER_ID( i ) );
} }
} }
...@@ -469,7 +469,7 @@ LSET FlipLayerMask( LSET aMask ) ...@@ -469,7 +469,7 @@ LSET FlipLayerMask( LSET aMask )
} }
LAYER_ID LSET::ExtractLayer() LAYER_ID LSET::ExtractLayer() const
{ {
unsigned set_count = count(); unsigned set_count = count();
...@@ -632,3 +632,5 @@ LSEQ LSET::UIOrder() const ...@@ -632,3 +632,5 @@ LSEQ LSET::UIOrder() const
return Seq( order, DIM( order ) ); return Seq( order, DIM( order ) );
} }
LAYER_ID ToLAYER_ID( int aLayer );
...@@ -49,7 +49,7 @@ void GBR_LAYER_BOX_SELECTOR::Resync() ...@@ -49,7 +49,7 @@ void GBR_LAYER_BOX_SELECTOR::Resync()
continue; continue;
// Prepare Bitmap // Prepare Bitmap
SetBitmapLayer( layerbmp, (LAYER_ID)layerid ); SetBitmapLayer( layerbmp, ToLAYER_ID( layerid ) );
layername = GetLayerName( layerid ); layername = GetLayerName( layerid );
......
...@@ -14,7 +14,9 @@ GBR_LAYOUT::GBR_LAYOUT() ...@@ -14,7 +14,9 @@ GBR_LAYOUT::GBR_LAYOUT()
{ {
PAGE_INFO pageInfo( wxT( "GERBER" ) ); PAGE_INFO pageInfo( wxT( "GERBER" ) );
SetPageSettings( pageInfo ); SetPageSettings( pageInfo );
m_printLayersMask = -1;
// no m_printLayersMask = -1;
m_printLayersMask.set();
} }
......
...@@ -156,7 +156,7 @@ public: ...@@ -156,7 +156,7 @@ public:
* @param aLayer The layer to test for. * @param aLayer The layer to test for.
* @return bool - true if on given layer, else false. * @return bool - true if on given layer, else false.
*/ */
virtual bool IsOnLayer( LAYER_NUM aLayer ) const virtual bool IsOnLayer( LAYER_ID aLayer ) const
{ {
return m_Layer == aLayer; return m_Layer == aLayer;
} }
......
...@@ -198,6 +198,10 @@ class LSET : public BASE_SET ...@@ -198,6 +198,10 @@ class LSET : public BASE_SET
{ {
public: public:
/**
* Constructor LSET()
* creates an empty (cleared) set.
*/
LSET() : LSET() :
BASE_SET() BASE_SET()
{} {}
...@@ -209,9 +213,21 @@ public: ...@@ -209,9 +213,21 @@ public:
/** /**
* Constructor LSET( LAYER_ID ) * Constructor LSET( LAYER_ID )
* takes a LAYER_ID and sets that bit. * takes a LAYER_ID and sets that bit. This makes the following code into
* a bug typically:
*
* <code> LSET s = 0; </code>
*
* since that will call this constructor and set bit zero, probably not what was
* intended. Use
*
* <code>
* LSET s;
* </code>
*
* for an empty set.
*/ */
LSET( int aLayer ) LSET( LAYER_ID aLayer ) // LAYER_ID deliberately exludes int and relatives
{ {
set( aLayer ); set( aLayer );
} }
...@@ -225,7 +241,7 @@ public: ...@@ -225,7 +241,7 @@ public:
/** /**
* Constructor LSET( int, ...) * Constructor LSET( int, ...)
* takes a variable number of LAYER_IDs in the argument list to construct * takes a variable number of LAYER_IDs in the argument list to construct
* the set. * the set. Typically used only in static construction.
* @param aIdCount is the number of LAYER_IDs which follow. * @param aIdCount is the number of LAYER_IDs which follow.
*/ */
LSET( size_t aIdCount, ... ); LSET( size_t aIdCount, ... );
...@@ -341,24 +357,13 @@ public: ...@@ -341,24 +357,13 @@ public:
* Find the first set LAYER_ID. Returns UNDEFINED_LAYER if more * Find the first set LAYER_ID. Returns UNDEFINED_LAYER if more
* than one is set or UNSELECTED_LAYER if none is set. * than one is set or UNSELECTED_LAYER if none is set.
*/ */
LAYER_ID ExtractLayer(); LAYER_ID ExtractLayer() const;
private: private:
}; };
/**
* @return bool if 2 layer masks have a comman layer
* @param aMask1 = a layer mask
* @param aMask2 = an other layer mask
*/
inline bool IsLayerMasksIntersect( LSET aMask1, LSET aMask2 )
{
return (aMask1 & aMask2).any();
}
/** /**
* Enum PCB_VISIBLE * Enum PCB_VISIBLE
* is a set of visible PCB elements. * is a set of visible PCB elements.
...@@ -618,4 +623,7 @@ inline bool IsNetnameLayer( LAYER_NUM aLayer ) ...@@ -618,4 +623,7 @@ inline bool IsNetnameLayer( LAYER_NUM aLayer )
aLayer < NETNAMES_GAL_LAYER( END_NETNAMES_VISIBLE_LIST ); aLayer < NETNAMES_GAL_LAYER( END_NETNAMES_VISIBLE_LIST );
} }
LAYER_ID ToLAYER_ID( int aLayer );
#endif // LAYERS_ID_AND_VISIBILITY_H_ #endif // LAYERS_ID_AND_VISIBILITY_H_
...@@ -83,7 +83,7 @@ BOARD::BOARD() : ...@@ -83,7 +83,7 @@ BOARD::BOARD() :
for( LAYER_NUM layer = 0; layer < LAYER_ID_COUNT; ++layer ) for( LAYER_NUM layer = 0; layer < LAYER_ID_COUNT; ++layer )
{ {
m_Layer[layer].m_name = GetStandardLayerName( LAYER_ID( layer ) ); m_Layer[layer].m_name = GetStandardLayerName( ToLAYER_ID( layer ) );
if( IsCopperLayer( layer ) ) if( IsCopperLayer( layer ) )
m_Layer[layer].m_type = LT_SIGNAL; m_Layer[layer].m_type = LT_SIGNAL;
......
...@@ -173,7 +173,8 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, ...@@ -173,7 +173,8 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
int l_trace; int l_trace;
int mode; int mode;
int radius; int radius;
LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
EDA_COLOR_T color; EDA_COLOR_T color;
BOARD * brd = GetBoard( ); BOARD * brd = GetBoard( );
...@@ -189,9 +190,8 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, ...@@ -189,9 +190,8 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
ColorTurnToDarkDarkGray( &color ); ColorTurnToDarkDarkGray( &color );
} }
GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( DC, draw_mode );
l_trace = m_Width >> 1; /* half trace width */ l_trace = m_Width >> 1; // half trace width
// Line start point or Circle and Arc center // Line start point or Circle and Arc center
ux0 = m_Start.x + aOffset.x; ux0 = m_Start.x + aOffset.x;
...@@ -247,7 +247,6 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, ...@@ -247,7 +247,6 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
EXCHG( StAngle, EndAngle ); EXCHG( StAngle, EndAngle );
} }
if( mode == LINE ) if( mode == LINE )
GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius, color ); GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius, color );
...@@ -612,4 +611,3 @@ EDA_ITEM* DRAWSEGMENT::Clone() const ...@@ -612,4 +611,3 @@ EDA_ITEM* DRAWSEGMENT::Clone() const
{ {
return new DRAWSEGMENT( *this ); return new DRAWSEGMENT( *this );
} }
...@@ -114,15 +114,14 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, ...@@ -114,15 +114,14 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
int ux0, uy0, dx, dy, radius, StAngle, EndAngle; int ux0, uy0, dx, dy, radius, StAngle, EndAngle;
int type_trace; int type_trace;
int typeaff; int typeaff;
LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
PCB_BASE_FRAME* frame;
MODULE* module = (MODULE*) m_Parent; MODULE* module = (MODULE*) m_Parent;
if( module == NULL ) if( !module )
return; return;
BOARD* brd = GetBoard( );
BOARD * brd = GetBoard( );
if( brd->IsLayerVisible( m_Layer ) == false ) if( brd->IsLayerVisible( m_Layer ) == false )
return; return;
...@@ -135,8 +134,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, ...@@ -135,8 +134,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
ColorTurnToDarkDarkGray( &color ); ColorTurnToDarkDarkGray( &color );
} }
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent();
frame = (PCB_BASE_FRAME*) panel->GetParent();
type_trace = m_Shape; type_trace = m_Shape;
......
...@@ -40,26 +40,34 @@ ...@@ -40,26 +40,34 @@
#include <class_pcb_layer_box_selector.h> #include <class_pcb_layer_box_selector.h>
// translate aLayer to its hotkey
#define DECLARE_LAYERS_HOTKEY(list) int list[] = \ static int layer2hotkey_id( LAYER_ID aLayer )
{ \ {
HK_SWITCH_LAYER_TO_COPPER, \ switch( aLayer )
HK_SWITCH_LAYER_TO_INNER1, \ {
HK_SWITCH_LAYER_TO_INNER2, \ case F_Cu: return HK_SWITCH_LAYER_TO_COMPONENT;
HK_SWITCH_LAYER_TO_INNER3, \
HK_SWITCH_LAYER_TO_INNER4, \ case B_Cu: return HK_SWITCH_LAYER_TO_COPPER;
HK_SWITCH_LAYER_TO_INNER5, \
HK_SWITCH_LAYER_TO_INNER6, \ case In1_Cu: return HK_SWITCH_LAYER_TO_INNER1;
HK_SWITCH_LAYER_TO_INNER7, \ case In2_Cu: return HK_SWITCH_LAYER_TO_INNER2;
HK_SWITCH_LAYER_TO_INNER8, \ case In3_Cu: return HK_SWITCH_LAYER_TO_INNER3;
HK_SWITCH_LAYER_TO_INNER9, \ case In4_Cu: return HK_SWITCH_LAYER_TO_INNER4;
HK_SWITCH_LAYER_TO_INNER10, \ case In5_Cu: return HK_SWITCH_LAYER_TO_INNER5;
HK_SWITCH_LAYER_TO_INNER11, \ case In6_Cu: return HK_SWITCH_LAYER_TO_INNER6;
HK_SWITCH_LAYER_TO_INNER12, \ case In7_Cu: return HK_SWITCH_LAYER_TO_INNER7;
HK_SWITCH_LAYER_TO_INNER13, \ case In8_Cu: return HK_SWITCH_LAYER_TO_INNER8;
HK_SWITCH_LAYER_TO_INNER14, \ case In9_Cu: return HK_SWITCH_LAYER_TO_INNER9;
HK_SWITCH_LAYER_TO_COMPONENT \ case In10_Cu: return HK_SWITCH_LAYER_TO_INNER10;
}; case In11_Cu: return HK_SWITCH_LAYER_TO_INNER11;
case In12_Cu: return HK_SWITCH_LAYER_TO_INNER12;
case In13_Cu: return HK_SWITCH_LAYER_TO_INNER13;
case In14_Cu: return HK_SWITCH_LAYER_TO_INNER14;
default:
return -1;
}
}
// class to display a layer list in a wxBitmapComboBox. // class to display a layer list in a wxBitmapComboBox.
...@@ -69,14 +77,12 @@ void PCB_LAYER_BOX_SELECTOR::Resync() ...@@ -69,14 +77,12 @@ void PCB_LAYER_BOX_SELECTOR::Resync()
{ {
Clear(); Clear();
static const DECLARE_LAYERS_HOTKEY( layerhk );
// Tray to fix a minimum width fot the BitmapComboBox // Tray to fix a minimum width fot the BitmapComboBox
int minwidth = 80, h; int minwidth = 80;
wxClientDC dc( GetParent() ); // The DC for "this" is not always initialized wxClientDC dc( GetParent() ); // The DC for "this" is not always initialized
#define BM_SIZE 14 const int BM_SIZE = 14;
LSET show = getEnabledLayers() & ~m_layerMaskDisable; LSET show = getEnabledLayers() & ~m_layerMaskDisable;
...@@ -90,16 +96,20 @@ void PCB_LAYER_BOX_SELECTOR::Resync() ...@@ -90,16 +96,20 @@ void PCB_LAYER_BOX_SELECTOR::Resync()
wxString layername = GetLayerName( layerid ); wxString layername = GetLayerName( layerid );
if( m_layerhotkeys && m_hotkeys && layerid < DIM(layerhk) ) if( m_layerhotkeys && m_hotkeys )
{ {
layername = AddHotkeyName( layername, m_hotkeys, int id = layer2hotkey_id( layerid );
layerhk[layerid], IS_COMMENT );
if( id != -1 )
layername = AddHotkeyName( layername, m_hotkeys, id, IS_COMMENT );
} }
Append( layername, layerbmp, (void*)(intptr_t) layerid ); Append( layername, layerbmp, (void*)(intptr_t) layerid );
int w; int w, h;
dc.GetTextExtent ( layername, &w, &h ); dc.GetTextExtent ( layername, &w, &h );
minwidth = std::max( minwidth, w ); minwidth = std::max( minwidth, w );
} }
...@@ -115,7 +125,7 @@ bool PCB_LAYER_BOX_SELECTOR::IsLayerEnabled( LAYER_NUM aLayer ) const ...@@ -115,7 +125,7 @@ bool PCB_LAYER_BOX_SELECTOR::IsLayerEnabled( LAYER_NUM aLayer ) const
BOARD* board = m_boardFrame->GetBoard(); BOARD* board = m_boardFrame->GetBoard();
wxASSERT( board != NULL ); wxASSERT( board != NULL );
return board->IsLayerEnabled( (LAYER_ID) aLayer ); return board->IsLayerEnabled( ToLAYER_ID( aLayer ) );
} }
...@@ -136,7 +146,7 @@ EDA_COLOR_T PCB_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayer ) const ...@@ -136,7 +146,7 @@ EDA_COLOR_T PCB_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayer ) const
BOARD* board = m_boardFrame->GetBoard(); BOARD* board = m_boardFrame->GetBoard();
wxASSERT( board ); wxASSERT( board );
return board->GetLayerColor( (LAYER_ID) aLayer ); return board->GetLayerColor( ToLAYER_ID( aLayer ) );
} }
...@@ -147,6 +157,6 @@ wxString PCB_LAYER_BOX_SELECTOR::GetLayerName( LAYER_NUM aLayer ) const ...@@ -147,6 +157,6 @@ wxString PCB_LAYER_BOX_SELECTOR::GetLayerName( LAYER_NUM aLayer ) const
BOARD* board = m_boardFrame->GetBoard(); BOARD* board = m_boardFrame->GetBoard();
wxASSERT( board ); wxASSERT( board );
return board->GetLayerName( (LAYER_ID) aLayer ); return board->GetLayerName( ToLAYER_ID( aLayer ) );
} }
...@@ -32,7 +32,6 @@ public: ...@@ -32,7 +32,6 @@ public:
LAYER_BOX_SELECTOR( parent, id, pos, size, n, choices ) LAYER_BOX_SELECTOR( parent, id, pos, size, n, choices )
{ {
m_boardFrame = NULL; m_boardFrame = NULL;
m_layerMaskDisable = 0;
} }
// Accessors // Accessors
......
...@@ -168,7 +168,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) ...@@ -168,7 +168,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
for( int row = rowCount-1; row>=0; --row ) for( int row = rowCount-1; row>=0; --row )
{ {
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 ); wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 );
LAYER_ID layer = (LAYER_ID) getDecodedId( cb->GetId() ); LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
if( IsCopperLayer( layer ) ) if( IsCopperLayer( layer ) )
{ {
...@@ -181,7 +181,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) ...@@ -181,7 +181,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
for( int row=0; row<rowCount; ++row ) for( int row=0; row<rowCount; ++row )
{ {
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 ); wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 );
LAYER_ID layer = (LAYER_ID) getDecodedId( cb->GetId() ); LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
if( IsCopperLayer( layer ) ) if( IsCopperLayer( layer ) )
{ {
...@@ -266,7 +266,7 @@ void PCB_LAYER_WIDGET::SyncLayerVisibilities() ...@@ -266,7 +266,7 @@ void PCB_LAYER_WIDGET::SyncLayerVisibilities()
wxWindow* w = getLayerComp( row, 0 ); wxWindow* w = getLayerComp( row, 0 );
LAYER_ID layerId = (LAYER_ID) getDecodedId( w->GetId() ); LAYER_ID layerId = ToLAYER_ID( getDecodedId( w->GetId() ) );
// this does not fire a UI event // this does not fire a UI event
SetLayerVisible( layerId, board->IsLayerVisible( layerId ) ); SetLayerVisible( layerId, board->IsLayerVisible( layerId ) );
...@@ -351,7 +351,7 @@ void PCB_LAYER_WIDGET::ReFill() ...@@ -351,7 +351,7 @@ void PCB_LAYER_WIDGET::ReFill()
void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, EDA_COLOR_T aColor ) void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, EDA_COLOR_T aColor )
{ {
myframe->GetBoard()->SetLayerColor( (LAYER_ID) aLayer, aColor ); myframe->GetBoard()->SetLayerColor( ToLAYER_ID( aLayer ), aColor );
myframe->ReCreateLayerBox( false ); myframe->ReCreateLayerBox( false );
if( myframe->IsGalCanvasActive() ) if( myframe->IsGalCanvasActive() )
...@@ -369,7 +369,7 @@ bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer ) ...@@ -369,7 +369,7 @@ bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer )
{ {
// the layer change from the PCB_LAYER_WIDGET can be denied by returning // the layer change from the PCB_LAYER_WIDGET can be denied by returning
// false from this function. // false from this function.
myframe->SetActiveLayer( (LAYER_ID) aLayer, false ); myframe->SetActiveLayer( ToLAYER_ID( aLayer ), false );
if( m_alwaysShowActiveCopperLayer ) if( m_alwaysShowActiveCopperLayer )
OnLayerSelected(); OnLayerSelected();
......
...@@ -140,13 +140,13 @@ const wxPoint& ZONE_CONTAINER::GetPosition() const ...@@ -140,13 +140,13 @@ const wxPoint& ZONE_CONTAINER::GetPosition() const
void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE aDrawMode, void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE aDrawMode,
const wxPoint& offset ) const wxPoint& offset )
{ {
if( DC == NULL ) if( !DC )
return; return;
wxPoint seg_start, seg_end; wxPoint seg_start, seg_end;
LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
BOARD* brd = GetBoard(); BOARD* brd = GetBoard();
EDA_COLOR_T color = brd->GetLayerColor( m_Layer ); EDA_COLOR_T color = brd->GetLayerColor( m_Layer );
if( brd->IsLayerVisible( m_Layer ) == false && ( color & HIGHLIGHT_FLAG ) != HIGHLIGHT_FLAG ) if( brd->IsLayerVisible( m_Layer ) == false && ( color & HIGHLIGHT_FLAG ) != HIGHLIGHT_FLAG )
...@@ -228,7 +228,7 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel, ...@@ -228,7 +228,7 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
return; return;
BOARD* brd = GetBoard(); BOARD* brd = GetBoard();
LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
EDA_COLOR_T color = brd->GetLayerColor( m_Layer ); EDA_COLOR_T color = brd->GetLayerColor( m_Layer );
if( brd->IsLayerVisible( m_Layer ) == false && ( color & HIGHLIGHT_FLAG ) != HIGHLIGHT_FLAG ) if( brd->IsLayerVisible( m_Layer ) == false && ( color & HIGHLIGHT_FLAG ) != HIGHLIGHT_FLAG )
...@@ -366,10 +366,10 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC, ...@@ -366,10 +366,10 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC,
bool is_close_segment = false; bool is_close_segment = false;
wxPoint seg_start, seg_end; wxPoint seg_start, seg_end;
if( DC == NULL ) if( !DC )
return; return;
LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
BOARD* brd = GetBoard(); BOARD* brd = GetBoard();
EDA_COLOR_T color = brd->GetLayerColor( m_Layer ); EDA_COLOR_T color = brd->GetLayerColor( m_Layer );
......
...@@ -468,7 +468,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab ...@@ -468,7 +468,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab
return false; return false;
} }
m_settings.m_CurrentZone_Layer = (LAYER_ID) m_LayerId[ii]; m_settings.m_CurrentZone_Layer = ToLAYER_ID( m_LayerId[ii] );
// Get the net name selection for this zone // Get the net name selection for this zone
ii = m_ListNetNameSelection->GetSelection(); ii = m_ListNetNameSelection->GetSelection();
......
...@@ -69,7 +69,7 @@ void PCB_EDIT_FRAME::InstallPcbGlobalDeleteFrame( const wxPoint& pos ) ...@@ -69,7 +69,7 @@ void PCB_EDIT_FRAME::InstallPcbGlobalDeleteFrame( const wxPoint& pos )
void DIALOG_GLOBAL_DELETION::SetCurrentLayer( LAYER_NUM aLayer ) void DIALOG_GLOBAL_DELETION::SetCurrentLayer( LAYER_NUM aLayer )
{ {
m_currentLayer = aLayer; m_currentLayer = aLayer;
m_textCtrlCurrLayer->SetValue( m_Parent->GetBoard()->GetLayerName( LAYER_ID( aLayer ) ) ); m_textCtrlCurrLayer->SetValue( m_Parent->GetBoard()->GetLayerName( ToLAYER_ID( aLayer ) ) );
} }
......
...@@ -232,7 +232,7 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event ) ...@@ -232,7 +232,7 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event )
msg = m_DefaultThicknessCtrl->GetValue(); msg = m_DefaultThicknessCtrl->GetValue();
int thickness = ValueFromString( g_UserUnit, msg ); int thickness = ValueFromString( g_UserUnit, msg );
m_Item->SetLayer( (LAYER_ID) m_LayerSelectionCtrl->GetLayerSelection() ); m_Item->SetLayer( ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ) );
if( m_Item->GetLayer() == Edge_Cuts ) if( m_Item->GetLayer() == Edge_Cuts )
m_brdSettings.m_EdgeSegmentWidth = thickness; m_brdSettings.m_EdgeSegmentWidth = thickness;
......
...@@ -220,7 +220,7 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event ) ...@@ -220,7 +220,7 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event )
m_brdSettings.m_ModuleSegmentWidth = thickness; m_brdSettings.m_ModuleSegmentWidth = thickness;
m_parent->SetDesignSettings( m_brdSettings ); m_parent->SetDesignSettings( m_brdSettings );
m_item->SetLayer( LAYER_ID( layer ) ); m_item->SetLayer( ToLAYER_ID( layer ) );
if( m_item->GetShape() == S_ARC ) if( m_item->GetShape() == S_ARC )
{ {
......
...@@ -222,7 +222,7 @@ bool DIALOG_KEEPOUT_AREA_PROPERTIES::AcceptOptionsForKeepOut() ...@@ -222,7 +222,7 @@ bool DIALOG_KEEPOUT_AREA_PROPERTIES::AcceptOptionsForKeepOut()
return false; return false;
} }
m_zonesettings.m_CurrentZone_Layer = (LAYER_ID) m_layerId[ii]; m_zonesettings.m_CurrentZone_Layer = ToLAYER_ID( m_layerId[ii] );
switch( m_OutlineAppearanceCtrl->GetSelection() ) switch( m_OutlineAppearanceCtrl->GetSelection() )
{ {
case 0: case 0:
......
...@@ -250,7 +250,7 @@ void DIALOG_PCB_TEXT_PROPERTIES::OnOkClick( wxCommandEvent& event ) ...@@ -250,7 +250,7 @@ void DIALOG_PCB_TEXT_PROPERTIES::OnOkClick( wxCommandEvent& event )
} }
// Set the layer on which the PCB text is laying // Set the layer on which the PCB text is laying
m_SelectedPCBText->SetLayer( (LAYER_ID) m_LayerSelectionCtrl->GetLayerSelection() ); m_SelectedPCBText->SetLayer( ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ) );
// Set whether the PCB text is mirrored (faced down from layer face perspective) // Set whether the PCB text is mirrored (faced down from layer face perspective)
m_SelectedPCBText->SetMirrored( m_DisplayCtrl->GetSelection() == 1 ); m_SelectedPCBText->SetMirrored( m_DisplayCtrl->GetSelection() == 1 );
......
...@@ -208,7 +208,7 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event ) ...@@ -208,7 +208,7 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event )
CurrentDimension->Text().SetMirrored( ( m_rbMirror->GetSelection() == 1 ) ? true : false ); CurrentDimension->Text().SetMirrored( ( m_rbMirror->GetSelection() == 1 ) ? true : false );
CurrentDimension->SetLayer( (LAYER_ID) m_SelLayerBox->GetLayerSelection() ); CurrentDimension->SetLayer( ToLAYER_ID( m_SelLayerBox->GetLayerSelection() ) );
#ifndef USE_WX_OVERLAY #ifndef USE_WX_OVERLAY
if( m_DC ) // Display new text if( m_DC ) // Display new text
{ {
......
...@@ -2708,7 +2708,7 @@ LAYER_ID EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) const ...@@ -2708,7 +2708,7 @@ LAYER_ID EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) const
} }
} }
return LAYER_ID( kiLayer ); return ToLAYER_ID( kiLayer );
} }
......
...@@ -564,8 +564,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -564,8 +564,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
m_canvas->SetAutoPanRequest( true ); m_canvas->SetAutoPanRequest( true );
Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->GetSelectedCorner(), false ); Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->GetSelectedCorner(), false );
break;
} }
break;
case ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT: case ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT:
{ {
...@@ -573,8 +573,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -573,8 +573,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
m_canvas->SetAutoPanRequest( true ); m_canvas->SetAutoPanRequest( true );
Start_Move_Zone_Drag_Outline_Edge( &dc, zone_cont, zone_cont->GetSelectedCorner() ); Start_Move_Zone_Drag_Outline_Edge( &dc, zone_cont, zone_cont->GetSelectedCorner() );
break;
} }
break;
case ID_POPUP_PCB_MOVE_ZONE_OUTLINES: case ID_POPUP_PCB_MOVE_ZONE_OUTLINES:
{ {
...@@ -582,8 +582,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -582,8 +582,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
m_canvas->SetAutoPanRequest( true ); m_canvas->SetAutoPanRequest( true );
Start_Move_Zone_Outlines( &dc, zone_cont ); Start_Move_Zone_Outlines( &dc, zone_cont );
break;
} }
break;
case ID_POPUP_PCB_ADD_ZONE_CORNER: case ID_POPUP_PCB_ADD_ZONE_CORNER:
{ {
...@@ -601,8 +601,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -601,8 +601,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
zone_cont->Draw( m_canvas, &dc, GR_XOR ); zone_cont->Draw( m_canvas, &dc, GR_XOR );
m_canvas->SetAutoPanRequest( true ); m_canvas->SetAutoPanRequest( true );
Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->GetSelectedCorner(), true ); Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->GetSelectedCorner(), true );
break;
} }
break;
case ID_POPUP_PCB_PLACE_ZONE_OUTLINES: case ID_POPUP_PCB_PLACE_ZONE_OUTLINES:
case ID_POPUP_PCB_PLACE_ZONE_CORNER: case ID_POPUP_PCB_PLACE_ZONE_CORNER:
...@@ -611,8 +611,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -611,8 +611,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
End_Move_Zone_Corner_Or_Outlines( &dc, zone_cont ); End_Move_Zone_Corner_Or_Outlines( &dc, zone_cont );
m_canvas->SetAutoPanRequest( false ); m_canvas->SetAutoPanRequest( false );
break;
} }
break;
case ID_POPUP_PCB_FILL_ALL_ZONES: case ID_POPUP_PCB_FILL_ALL_ZONES:
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
...@@ -1007,7 +1007,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -1007,7 +1007,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_TOOLBARH_PCB_SELECT_LAYER: case ID_TOOLBARH_PCB_SELECT_LAYER:
SetActiveLayer( (LAYER_ID) m_SelLayerBox->GetLayerSelection() ); SetActiveLayer( ToLAYER_ID( m_SelLayerBox->GetLayerSelection() ) );
if( DisplayOpt.ContrastModeDisplay ) if( DisplayOpt.ContrastModeDisplay )
m_canvas->Refresh( true ); m_canvas->Refresh( true );
......
...@@ -126,7 +126,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) ...@@ -126,7 +126,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
case VIA_MICROVIA: // from external to the near neighbor inner layer case VIA_MICROVIA: // from external to the near neighbor inner layer
{ {
LAYER_ID last_inner_layer = (LAYER_ID) ( GetBoard()->GetCopperLayerCount() - 2 ); LAYER_ID last_inner_layer = ToLAYER_ID( ( GetBoard()->GetCopperLayerCount() - 2 ) );
if( first_layer == B_Cu ) if( first_layer == B_Cu )
last_layer = last_inner_layer; last_layer = last_inner_layer;
......
...@@ -321,8 +321,8 @@ bool EXCELLON_WRITER::GenDrillReportFile( const wxString& aFullFileName ) ...@@ -321,8 +321,8 @@ bool EXCELLON_WRITER::GenDrillReportFile( const wxString& aFullFileName )
fputs( "Drill report for buried and blind vias :\n\n", m_file ); fputs( "Drill report for buried and blind vias :\n\n", m_file );
sprintf( line, "Drill report for holes from layer %s to layer %s :\n", sprintf( line, "Drill report for holes from layer %s to layer %s :\n",
TO_UTF8( m_pcb->GetLayerName( (LAYER_ID) layer1 ) ), TO_UTF8( m_pcb->GetLayerName( ToLAYER_ID( layer1 ) ) ),
TO_UTF8( m_pcb->GetLayerName( (LAYER_ID) layer2 ) ) ); TO_UTF8( m_pcb->GetLayerName( ToLAYER_ID( layer2 ) ) ) );
} }
fputs( line, m_file ); fputs( line, m_file );
......
...@@ -37,10 +37,12 @@ static EDA_HOTKEY HkMouseLeftClick( wxT( "Mouse Left Click" ), ...@@ -37,10 +37,12 @@ static EDA_HOTKEY HkMouseLeftClick( wxT( "Mouse Left Click" ),
static EDA_HOTKEY HkMouseLeftDClick( wxT( "Mouse Left DClick" ), static EDA_HOTKEY HkMouseLeftDClick( wxT( "Mouse Left DClick" ),
HK_LEFT_DCLICK, WXK_END, 0 ); HK_LEFT_DCLICK, WXK_END, 0 );
static EDA_HOTKEY HkSwitch2CopperLayer( wxT( "Switch to Copper layer" ), static EDA_HOTKEY HkSwitch2CopperLayer( wxT( "Switch to Copper (B.Cu) layer" ),
HK_SWITCH_LAYER_TO_COPPER, WXK_PAGEDOWN ); HK_SWITCH_LAYER_TO_COPPER, WXK_PAGEDOWN );
static EDA_HOTKEY HkSwitch2ComponentLayer( wxT( "Switch to Component layer" ),
static EDA_HOTKEY HkSwitch2ComponentLayer( wxT( "Switch to Component (F.Cu) layer" ),
HK_SWITCH_LAYER_TO_COMPONENT, WXK_PAGEUP ); HK_SWITCH_LAYER_TO_COMPONENT, WXK_PAGEUP );
static EDA_HOTKEY HkSwitch2InnerLayer1( wxT( "Switch to Inner layer 1" ), static EDA_HOTKEY HkSwitch2InnerLayer1( wxT( "Switch to Inner layer 1" ),
HK_SWITCH_LAYER_TO_INNER1, WXK_F5 ); HK_SWITCH_LAYER_TO_INNER1, WXK_F5 );
static EDA_HOTKEY HkSwitch2InnerLayer2( wxT( "Switch to Inner layer 2" ), static EDA_HOTKEY HkSwitch2InnerLayer2( wxT( "Switch to Inner layer 2" ),
......
...@@ -248,11 +248,11 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit ...@@ -248,11 +248,11 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
if( ll == F_Cu ) if( ll == F_Cu )
ll = B_Cu; ll = B_Cu;
else if( ll == B_Cu ) else if( ll == B_Cu )
ll = (LAYER_ID) GetBoard()->GetCopperLayerCount() - 2; ll = ToLAYER_ID( GetBoard()->GetCopperLayerCount() - 2 );
else else
ll = ll - 1; ll = ll - 1;
SwitchLayer( aDC, (LAYER_ID) ll ); SwitchLayer( aDC, ToLAYER_ID( ll ) );
break; break;
case HK_SWITCH_LAYER_TO_NEXT: case HK_SWITCH_LAYER_TO_NEXT:
...@@ -266,7 +266,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit ...@@ -266,7 +266,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
else if( ++ll >= GetBoard()->GetCopperLayerCount() - 1 ) else if( ++ll >= GetBoard()->GetCopperLayerCount() - 1 )
ll = B_Cu; ll = B_Cu;
SwitchLayer( aDC, (LAYER_ID) ll ); SwitchLayer( aDC, ToLAYER_ID( ll ) );
break; break;
case HK_SWITCH_LAYER_TO_COMPONENT: case HK_SWITCH_LAYER_TO_COMPONENT:
......
...@@ -124,7 +124,7 @@ void DXF2BRD_CONVERTER::addLine( const DRW_Line& data ) ...@@ -124,7 +124,7 @@ void DXF2BRD_CONVERTER::addLine( const DRW_Line& data )
{ {
DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd ); DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd );
segm->SetLayer( (LAYER_ID) m_brdLayer ); segm->SetLayer( ToLAYER_ID( m_brdLayer ) );
wxPoint start( mapX( data.basePoint.x ), mapY( data.basePoint.y ) ); wxPoint start( mapX( data.basePoint.x ), mapY( data.basePoint.y ) );
...@@ -146,7 +146,7 @@ void DXF2BRD_CONVERTER::addCircle( const DRW_Circle& data ) ...@@ -146,7 +146,7 @@ void DXF2BRD_CONVERTER::addCircle( const DRW_Circle& data )
{ {
DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd ); DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd );
segm->SetLayer( (LAYER_ID) m_brdLayer ); segm->SetLayer( ToLAYER_ID( m_brdLayer ) );
segm->SetShape( S_CIRCLE ); segm->SetShape( S_CIRCLE );
wxPoint center( mapX( data.basePoint.x ), mapY( data.basePoint.y ) ); wxPoint center( mapX( data.basePoint.x ), mapY( data.basePoint.y ) );
segm->SetCenter( center ); segm->SetCenter( center );
...@@ -166,7 +166,7 @@ void DXF2BRD_CONVERTER::addArc( const DRW_Arc& data ) ...@@ -166,7 +166,7 @@ void DXF2BRD_CONVERTER::addArc( const DRW_Arc& data )
{ {
DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd ); DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd );
segm->SetLayer( (LAYER_ID) m_brdLayer ); segm->SetLayer( ToLAYER_ID( m_brdLayer ) );
segm->SetShape( S_ARC ); segm->SetShape( S_ARC );
// Init arc centre: // Init arc centre:
...@@ -203,7 +203,7 @@ void DXF2BRD_CONVERTER::addArc( const DRW_Arc& data ) ...@@ -203,7 +203,7 @@ void DXF2BRD_CONVERTER::addArc( const DRW_Arc& data )
void DXF2BRD_CONVERTER::addText(const DRW_Text& data) void DXF2BRD_CONVERTER::addText(const DRW_Text& data)
{ {
TEXTE_PCB* pcb_text = new TEXTE_PCB( m_brd ); TEXTE_PCB* pcb_text = new TEXTE_PCB( m_brd );
pcb_text->SetLayer( (LAYER_ID) m_brdLayer ); pcb_text->SetLayer( ToLAYER_ID( m_brdLayer ) );
wxPoint refPoint( mapX(data.basePoint.x), mapY(data.basePoint.y) ); wxPoint refPoint( mapX(data.basePoint.x), mapY(data.basePoint.y) );
wxPoint secPoint( mapX(data.secPoint.x), mapY(data.secPoint.y) ); wxPoint secPoint( mapX(data.secPoint.x), mapY(data.secPoint.y) );
...@@ -331,7 +331,7 @@ void DXF2BRD_CONVERTER::addMText( const DRW_MText& data ) ...@@ -331,7 +331,7 @@ void DXF2BRD_CONVERTER::addMText( const DRW_MText& data )
} }
TEXTE_PCB* pcb_text = new TEXTE_PCB( m_brd ); TEXTE_PCB* pcb_text = new TEXTE_PCB( m_brd );
pcb_text->SetLayer( (LAYER_ID) m_brdLayer ); pcb_text->SetLayer( ToLAYER_ID( m_brdLayer ) );
wxPoint textpos( mapX( data.basePoint.x ), mapY( data.basePoint.y ) ); wxPoint textpos( mapX( data.basePoint.x ), mapY( data.basePoint.y ) );
pcb_text->SetTextPosition( textpos ); pcb_text->SetTextPosition( textpos );
......
...@@ -517,7 +517,7 @@ void PCB::MapLayer( XNODE* aNode ) ...@@ -517,7 +517,7 @@ void PCB::MapLayer( XNODE* aNode )
#if 0 // was: #if 0 // was:
KiCadLayer = FIRST_COPPER_LAYER + m_layersStackup.GetCount() - 1 - layernum; KiCadLayer = FIRST_COPPER_LAYER + m_layersStackup.GetCount() - 1 - layernum;
#else #else
KiCadLayer = LAYER_ID( layernum ); KiCadLayer = ToLAYER_ID( layernum );
#endif #endif
} }
......
...@@ -967,7 +967,7 @@ void PCB_EDIT_FRAME::syncLayerVisibilities() ...@@ -967,7 +967,7 @@ void PCB_EDIT_FRAME::syncLayerVisibilities()
for( LAYER_NUM i = 0; i < END_PCB_VISIBLE_LIST; ++i ) for( LAYER_NUM i = 0; i < END_PCB_VISIBLE_LIST; ++i )
{ {
view->SetLayerVisible( ITEM_GAL_LAYER( i ), m_Pcb->IsElementVisible( LAYER_ID( i ) ) ); view->SetLayerVisible( ITEM_GAL_LAYER( i ), m_Pcb->IsElementVisible( i ) );
} }
// Enable some layers that are GAL specific // Enable some layers that are GAL specific
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
EDA_COLOR_T BRDITEMS_PLOTTER::getColor( LAYER_NUM aLayer ) EDA_COLOR_T BRDITEMS_PLOTTER::getColor( LAYER_NUM aLayer )
{ {
EDA_COLOR_T color = m_board->GetLayerColor( (LAYER_ID) aLayer ); EDA_COLOR_T color = m_board->GetLayerColor( ToLAYER_ID( aLayer ) );
if (color == WHITE) if (color == WHITE)
color = LIGHTGRAY; color = LIGHTGRAY;
return color; return color;
......
...@@ -145,7 +145,8 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, ...@@ -145,7 +145,8 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
} }
save_opt = DisplayOpt; save_opt = DisplayOpt;
LAYER_NUM activeLayer = GetScreen()->m_Active_Layer;
LAYER_ID activeLayer = GetScreen()->m_Active_Layer;
DisplayOpt.ContrastModeDisplay = false; DisplayOpt.ContrastModeDisplay = false;
DisplayOpt.DisplayPadFill = true; DisplayOpt.DisplayPadFill = true;
...@@ -333,15 +334,16 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, ...@@ -333,15 +334,16 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
m_canvas->SetPrintMirrored( false ); m_canvas->SetPrintMirrored( false );
DisplayOpt = save_opt; DisplayOpt = save_opt;
GetScreen()->m_Active_Layer = LAYER_ID( activeLayer ); GetScreen()->m_Active_Layer = activeLayer;
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill; m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
m_DisplayPadFill = DisplayOpt.DisplayPadFill; m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_DisplayViaFill = DisplayOpt.DisplayViaFill; m_DisplayViaFill = DisplayOpt.DisplayViaFill;
m_DisplayPadNum = DisplayOpt.DisplayPadNum; m_DisplayPadNum = DisplayOpt.DisplayPadNum;
m_DisplayModEdge = DisplayOpt.DisplayModEdge; m_DisplayModEdge = DisplayOpt.DisplayModEdge;
m_DisplayModText = DisplayOpt.DisplayModText; m_DisplayModText = DisplayOpt.DisplayModText;
GetBoard()->SetElementVisibility(NO_CONNECTS_VISIBLE, nctmp);
GetBoard()->SetElementVisibility(ANCHOR_VISIBLE, anchorsTmp); GetBoard()->SetElementVisibility( NO_CONNECTS_VISIBLE, nctmp );
GetBoard()->SetElementVisibility( ANCHOR_VISIBLE, anchorsTmp );
} }
......
...@@ -744,7 +744,7 @@ void PNS_ROUTER::CommitRouting( PNS_NODE* aNode ) ...@@ -744,7 +744,7 @@ void PNS_ROUTER::CommitRouting( PNS_NODE* aNode )
track->SetStart( wxPoint( s.A.x, s.A.y ) ); track->SetStart( wxPoint( s.A.x, s.A.y ) );
track->SetEnd( wxPoint( s.B.x, s.B.y ) ); track->SetEnd( wxPoint( s.B.x, s.B.y ) );
track->SetWidth( seg->Width() ); track->SetWidth( seg->Width() );
track->SetLayer( (LAYER_ID) seg->Layers().Start() ); track->SetLayer( ToLAYER_ID( seg->Layers().Start() ) );
track->SetNetCode( seg->Net() ); track->SetNetCode( seg->Net() );
newBI = track; newBI = track;
break; break;
......
...@@ -538,7 +538,7 @@ void ROUTER_TOOL::performRouting() ...@@ -538,7 +538,7 @@ void ROUTER_TOOL::performRouting()
m_router->SwitchLayer( m_startLayer ); m_router->SwitchLayer( m_startLayer );
frame->SetActiveLayer( (LAYER_ID) m_startLayer ); frame->SetActiveLayer( ToLAYER_ID( m_startLayer ) );
frame->GetGalCanvas()->SetFocus(); frame->GetGalCanvas()->SetFocus();
if( m_startItem && m_startItem->Net() >= 0 ) if( m_startItem && m_startItem->Net() >= 0 )
...@@ -578,7 +578,7 @@ void ROUTER_TOOL::performRouting() ...@@ -578,7 +578,7 @@ void ROUTER_TOOL::performRouting()
else if( evt->IsAction( &ACT_PlaceThroughVia ) ) else if( evt->IsAction( &ACT_PlaceThroughVia ) )
{ {
m_router->ToggleViaPlacement(); m_router->ToggleViaPlacement();
frame->SetTopLayer( (LAYER_ID) m_router->GetCurrentLayer() ); frame->SetTopLayer( ToLAYER_ID( m_router->GetCurrentLayer() ) );
m_router->Move( m_endSnapPoint, m_endItem ); m_router->Move( m_endSnapPoint, m_endItem );
} }
else if( evt->IsAction( &ACT_SwitchPosture ) ) else if( evt->IsAction( &ACT_SwitchPosture ) )
...@@ -590,13 +590,13 @@ void ROUTER_TOOL::performRouting() ...@@ -590,13 +590,13 @@ void ROUTER_TOOL::performRouting()
{ {
m_router->SwitchLayer( m_router->NextCopperLayer( true ) ); m_router->SwitchLayer( m_router->NextCopperLayer( true ) );
updateEndItem( *evt ); updateEndItem( *evt );
frame->SetActiveLayer( (LAYER_ID) m_router->GetCurrentLayer() ); frame->SetActiveLayer( ToLAYER_ID( m_router->GetCurrentLayer() ) );
m_router->Move( m_endSnapPoint, m_endItem ); m_router->Move( m_endSnapPoint, m_endItem );
} }
else if( evt->IsAction( &COMMON_ACTIONS::layerPrev ) ) else if( evt->IsAction( &COMMON_ACTIONS::layerPrev ) )
{ {
m_router->SwitchLayer( m_router->NextCopperLayer( false ) ); m_router->SwitchLayer( m_router->NextCopperLayer( false ) );
frame->SetActiveLayer( (LAYER_ID) m_router->GetCurrentLayer() ); frame->SetActiveLayer( ToLAYER_ID( m_router->GetCurrentLayer() ) );
m_router->Move( m_endSnapPoint, m_endItem ); m_router->Move( m_endSnapPoint, m_endItem );
} }
else if( evt->IsAction( &ACT_EndTrack ) ) else if( evt->IsAction( &ACT_EndTrack ) )
......
...@@ -62,13 +62,13 @@ protected: ...@@ -62,13 +62,13 @@ protected:
// Virtual function // Virtual function
EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const
{ {
return m_brd->GetLayerColor( LAYER_ID( aLayer ) ); return m_brd->GetLayerColor( ToLAYER_ID( aLayer ) );
} }
// Returns the name of the layer id // Returns the name of the layer id
wxString GetLayerName( LAYER_NUM aLayer ) const // overrides LAYER_SELECTOR wxString GetLayerName( LAYER_NUM aLayer ) const // overrides LAYER_SELECTOR
{ {
return m_brd->GetLayerName( LAYER_ID( aLayer ) ); return m_brd->GetLayerName( ToLAYER_ID( aLayer ) );
} }
}; };
...@@ -233,7 +233,7 @@ LAYER_ID PCB_BASE_FRAME::SelectLayer( LAYER_ID aDefaultLayer, ...@@ -233,7 +233,7 @@ LAYER_ID PCB_BASE_FRAME::SelectLayer( LAYER_ID aDefaultLayer,
dlg.ShowModal(); dlg.ShowModal();
LAYER_ID layer = (LAYER_ID) dlg.GetLayerSelection(); LAYER_ID layer = ToLAYER_ID( dlg.GetLayerSelection() );
return layer; return layer;
} }
......
...@@ -93,7 +93,7 @@ void SPECCTRA_DB::buildLayerMaps( BOARD* aBoard ) ...@@ -93,7 +93,7 @@ void SPECCTRA_DB::buildLayerMaps( BOARD* aBoard )
kicadLayer2pcb[kilayer] = pcbNdx; kicadLayer2pcb[kilayer] = pcbNdx;
// save the specctra layer name in SPECCTRA_DB::layerIds for later. // save the specctra layer name in SPECCTRA_DB::layerIds for later.
layerIds.push_back( TO_UTF8( aBoard->GetLayerName( LAYER_ID( kilayer ) ) ) ); layerIds.push_back( TO_UTF8( aBoard->GetLayerName( ToLAYER_ID( kilayer ) ) ) );
} }
#else #else
...@@ -110,15 +110,14 @@ void SPECCTRA_DB::buildLayerMaps( BOARD* aBoard ) ...@@ -110,15 +110,14 @@ void SPECCTRA_DB::buildLayerMaps( BOARD* aBoard )
for( unsigned i = 0; i < pcbLayer2kicad.size(); ++i ) for( unsigned i = 0; i < pcbLayer2kicad.size(); ++i )
{ {
if( i < layerCount-1 ) if( i < layerCount-1 )
pcbLayer2kicad[i] = LAYER_ID( i ); pcbLayer2kicad[i] = ToLAYER_ID( i );
else else
pcbLayer2kicad[i] = B_Cu; pcbLayer2kicad[i] = B_Cu;
// save the specctra layer name in SPECCTRA_DB::layerIds for later. // save the specctra layer name in SPECCTRA_DB::layerIds for later.
layerIds.push_back( TO_UTF8( aBoard->GetLayerName( LAYER_ID( i ) ) ) ); layerIds.push_back( TO_UTF8( aBoard->GetLayerName( ToLAYER_ID( i ) ) ) );
} }
#endif #endif
} }
......
...@@ -171,7 +171,7 @@ SWAP_LAYERS_DIALOG::SWAP_LAYERS_DIALOG( PCB_BASE_FRAME* parent, LAYER_ID* aArray ...@@ -171,7 +171,7 @@ SWAP_LAYERS_DIALOG::SWAP_LAYERS_DIALOG( PCB_BASE_FRAME* parent, LAYER_ID* aArray
/* Provide a text string to identify this layer (with trailing spaces /* Provide a text string to identify this layer (with trailing spaces
* within that string being purged). * within that string being purged).
*/ */
label = new wxStaticText( this, wxID_STATIC, board->GetLayerName( LAYER_ID( layer ) ), label = new wxStaticText( this, wxID_STATIC, board->GetLayerName( ToLAYER_ID( layer ) ),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxALIGN_RIGHT ); wxALIGN_RIGHT );
...@@ -212,7 +212,7 @@ SWAP_LAYERS_DIALOG::SWAP_LAYERS_DIALOG( PCB_BASE_FRAME* parent, LAYER_ID* aArray ...@@ -212,7 +212,7 @@ SWAP_LAYERS_DIALOG::SWAP_LAYERS_DIALOG( PCB_BASE_FRAME* parent, LAYER_ID* aArray
for( unsigned jj = 1; jj < DIM( layer_list ); ++jj ) for( unsigned jj = 1; jj < DIM( layer_list ); ++jj )
{ {
text->SetLabel( board->GetLayerName( LAYER_ID( jj ) ) ); text->SetLabel( board->GetLayerName( ToLAYER_ID( jj ) ) );
if( goodSize.x < text->GetSize().x ) if( goodSize.x < text->GetSize().x )
goodSize.x = text->GetSize().x; goodSize.x = text->GetSize().x;
...@@ -292,7 +292,7 @@ void SWAP_LAYERS_DIALOG::Sel_Layer( wxCommandEvent& event ) ...@@ -292,7 +292,7 @@ void SWAP_LAYERS_DIALOG::Sel_Layer( wxCommandEvent& event )
LSET notallowed_mask = IsCopperLayer( ii ) ? LSET::AllNonCuMask() : LSET::AllCuMask(); LSET notallowed_mask = IsCopperLayer( ii ) ? LSET::AllNonCuMask() : LSET::AllCuMask();
layer = m_Parent->SelectLayer( layer == NO_CHANGE ? LAYER_ID( ii ): layer, notallowed_mask ); layer = m_Parent->SelectLayer( layer == NO_CHANGE ? ToLAYER_ID( ii ): layer, notallowed_mask );
if( !IsValidLayer( layer ) ) if( !IsValidLayer( layer ) )
return; return;
......
...@@ -286,6 +286,7 @@ void PCB_EDIT_FRAME::ReCreateHToolbar() ...@@ -286,6 +286,7 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
m_SelLayerBox = new PCB_LAYER_BOX_SELECTOR( m_mainToolBar, ID_TOOLBARH_PCB_SELECT_LAYER ); m_SelLayerBox = new PCB_LAYER_BOX_SELECTOR( m_mainToolBar, ID_TOOLBARH_PCB_SELECT_LAYER );
m_SelLayerBox->SetBoardFrame( this ); m_SelLayerBox->SetBoardFrame( this );
} }
ReCreateLayerBox( false ); ReCreateLayerBox( false );
m_mainToolBar->AddControl( m_SelLayerBox ); m_mainToolBar->AddControl( m_SelLayerBox );
......
...@@ -315,7 +315,7 @@ int PCBNEW_CONTROL::LayerNext( TOOL_EVENT& aEvent ) ...@@ -315,7 +315,7 @@ int PCBNEW_CONTROL::LayerNext( TOOL_EVENT& aEvent )
else else
++layer; ++layer;
editFrame->SwitchLayer( NULL, LAYER_ID( layer ) ); editFrame->SwitchLayer( NULL, ToLAYER_ID( layer ) );
editFrame->GetGalCanvas()->SetFocus(); editFrame->GetGalCanvas()->SetFocus();
setTransitions(); setTransitions();
...@@ -342,7 +342,7 @@ int PCBNEW_CONTROL::LayerPrev( TOOL_EVENT& aEvent ) ...@@ -342,7 +342,7 @@ int PCBNEW_CONTROL::LayerPrev( TOOL_EVENT& aEvent )
--layer; --layer;
assert( IsCopperLayer( layer ) ); assert( IsCopperLayer( layer ) );
editFrame->SwitchLayer( NULL, LAYER_ID( layer ) ); editFrame->SwitchLayer( NULL, ToLAYER_ID( layer ) );
editFrame->GetGalCanvas()->SetFocus(); editFrame->GetGalCanvas()->SetFocus();
setTransitions(); setTransitions();
......
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