Commit ad750def authored by Dick Hollenbeck's avatar Dick Hollenbeck

LAYER_ID work

parent 9c8d221f
......@@ -285,7 +285,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
// but I assume that's backwards
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 )
#else
......
......@@ -120,7 +120,7 @@ void LAYER_BOX_SELECTOR::ResyncBitmapOnly()
for( LAYER_NUM i = 0; i < elements; ++i )
{
wxBitmap layerbmp( 14, 14 );
SetBitmapLayer( layerbmp, LAYER_ID( i ) );
SetBitmapLayer( layerbmp, ToLAYER_ID( i ) );
}
}
......@@ -469,7 +469,7 @@ LSET FlipLayerMask( LSET aMask )
}
LAYER_ID LSET::ExtractLayer()
LAYER_ID LSET::ExtractLayer() const
{
unsigned set_count = count();
......@@ -632,3 +632,5 @@ LSEQ LSET::UIOrder() const
return Seq( order, DIM( order ) );
}
LAYER_ID ToLAYER_ID( int aLayer );
......@@ -49,7 +49,7 @@ void GBR_LAYER_BOX_SELECTOR::Resync()
continue;
// Prepare Bitmap
SetBitmapLayer( layerbmp, (LAYER_ID)layerid );
SetBitmapLayer( layerbmp, ToLAYER_ID( layerid ) );
layername = GetLayerName( layerid );
......
......@@ -14,7 +14,9 @@ GBR_LAYOUT::GBR_LAYOUT()
{
PAGE_INFO pageInfo( wxT( "GERBER" ) );
SetPageSettings( pageInfo );
m_printLayersMask = -1;
// no m_printLayersMask = -1;
m_printLayersMask.set();
}
......
......@@ -156,7 +156,7 @@ public:
* @param aLayer The layer to test for.
* @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;
}
......
......@@ -198,6 +198,10 @@ class LSET : public BASE_SET
{
public:
/**
* Constructor LSET()
* creates an empty (cleared) set.
*/
LSET() :
BASE_SET()
{}
......@@ -209,9 +213,21 @@ public:
/**
* 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 );
}
......@@ -225,7 +241,7 @@ public:
/**
* Constructor LSET( int, ...)
* 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.
*/
LSET( size_t aIdCount, ... );
......@@ -341,24 +357,13 @@ public:
* Find the first set LAYER_ID. Returns UNDEFINED_LAYER if more
* than one is set or UNSELECTED_LAYER if none is set.
*/
LAYER_ID ExtractLayer();
LAYER_ID ExtractLayer() const;
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
* is a set of visible PCB elements.
......@@ -618,4 +623,7 @@ inline bool IsNetnameLayer( LAYER_NUM aLayer )
aLayer < NETNAMES_GAL_LAYER( END_NETNAMES_VISIBLE_LIST );
}
LAYER_ID ToLAYER_ID( int aLayer );
#endif // LAYERS_ID_AND_VISIBILITY_H_
......@@ -83,7 +83,7 @@ BOARD::BOARD() :
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 ) )
m_Layer[layer].m_type = LT_SIGNAL;
......
......@@ -173,7 +173,8 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
int l_trace;
int mode;
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;
BOARD * brd = GetBoard( );
......@@ -189,9 +190,8 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
ColorTurnToDarkDarkGray( &color );
}
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
ux0 = m_Start.x + aOffset.x;
......@@ -247,7 +247,6 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
EXCHG( StAngle, EndAngle );
}
if( mode == LINE )
GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius, color );
......@@ -612,4 +611,3 @@ EDA_ITEM* DRAWSEGMENT::Clone() const
{
return new DRAWSEGMENT( *this );
}
......@@ -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 type_trace;
int typeaff;
LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
PCB_BASE_FRAME* frame;
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
MODULE* module = (MODULE*) m_Parent;
if( module == NULL )
if( !module )
return;
BOARD * brd = GetBoard( );
BOARD* brd = GetBoard( );
if( brd->IsLayerVisible( m_Layer ) == false )
return;
......@@ -135,8 +134,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
ColorTurnToDarkDarkGray( &color );
}
frame = (PCB_BASE_FRAME*) panel->GetParent();
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent();
type_trace = m_Shape;
......
......@@ -40,26 +40,34 @@
#include <class_pcb_layer_box_selector.h>
#define DECLARE_LAYERS_HOTKEY(list) int list[] = \
{ \
HK_SWITCH_LAYER_TO_COPPER, \
HK_SWITCH_LAYER_TO_INNER1, \
HK_SWITCH_LAYER_TO_INNER2, \
HK_SWITCH_LAYER_TO_INNER3, \
HK_SWITCH_LAYER_TO_INNER4, \
HK_SWITCH_LAYER_TO_INNER5, \
HK_SWITCH_LAYER_TO_INNER6, \
HK_SWITCH_LAYER_TO_INNER7, \
HK_SWITCH_LAYER_TO_INNER8, \
HK_SWITCH_LAYER_TO_INNER9, \
HK_SWITCH_LAYER_TO_INNER10, \
HK_SWITCH_LAYER_TO_INNER11, \
HK_SWITCH_LAYER_TO_INNER12, \
HK_SWITCH_LAYER_TO_INNER13, \
HK_SWITCH_LAYER_TO_INNER14, \
HK_SWITCH_LAYER_TO_COMPONENT \
};
// translate aLayer to its hotkey
static int layer2hotkey_id( LAYER_ID aLayer )
{
switch( aLayer )
{
case F_Cu: return HK_SWITCH_LAYER_TO_COMPONENT;
case B_Cu: return HK_SWITCH_LAYER_TO_COPPER;
case In1_Cu: return HK_SWITCH_LAYER_TO_INNER1;
case In2_Cu: return HK_SWITCH_LAYER_TO_INNER2;
case In3_Cu: return HK_SWITCH_LAYER_TO_INNER3;
case In4_Cu: return HK_SWITCH_LAYER_TO_INNER4;
case In5_Cu: return HK_SWITCH_LAYER_TO_INNER5;
case In6_Cu: return HK_SWITCH_LAYER_TO_INNER6;
case In7_Cu: return HK_SWITCH_LAYER_TO_INNER7;
case In8_Cu: return HK_SWITCH_LAYER_TO_INNER8;
case In9_Cu: return HK_SWITCH_LAYER_TO_INNER9;
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.
......@@ -69,14 +77,12 @@ void PCB_LAYER_BOX_SELECTOR::Resync()
{
Clear();
static const DECLARE_LAYERS_HOTKEY( layerhk );
// 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
#define BM_SIZE 14
const int BM_SIZE = 14;
LSET show = getEnabledLayers() & ~m_layerMaskDisable;
......@@ -90,16 +96,20 @@ void PCB_LAYER_BOX_SELECTOR::Resync()
wxString layername = GetLayerName( layerid );
if( m_layerhotkeys && m_hotkeys && layerid < DIM(layerhk) )
if( m_layerhotkeys && m_hotkeys )
{
layername = AddHotkeyName( layername, m_hotkeys,
layerhk[layerid], IS_COMMENT );
int id = layer2hotkey_id( layerid );
if( id != -1 )
layername = AddHotkeyName( layername, m_hotkeys, id, IS_COMMENT );
}
Append( layername, layerbmp, (void*)(intptr_t) layerid );
int w;
int w, h;
dc.GetTextExtent ( layername, &w, &h );
minwidth = std::max( minwidth, w );
}
......@@ -115,7 +125,7 @@ bool PCB_LAYER_BOX_SELECTOR::IsLayerEnabled( LAYER_NUM aLayer ) const
BOARD* board = m_boardFrame->GetBoard();
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
BOARD* board = m_boardFrame->GetBoard();
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
BOARD* board = m_boardFrame->GetBoard();
wxASSERT( board );
return board->GetLayerName( (LAYER_ID) aLayer );
return board->GetLayerName( ToLAYER_ID( aLayer ) );
}
......@@ -32,7 +32,6 @@ public:
LAYER_BOX_SELECTOR( parent, id, pos, size, n, choices )
{
m_boardFrame = NULL;
m_layerMaskDisable = 0;
}
// Accessors
......
......@@ -168,7 +168,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
for( int row = rowCount-1; row>=0; --row )
{
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 ) )
{
......@@ -181,7 +181,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
for( int row=0; row<rowCount; ++row )
{
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 ) )
{
......@@ -266,7 +266,7 @@ void PCB_LAYER_WIDGET::SyncLayerVisibilities()
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
SetLayerVisible( layerId, board->IsLayerVisible( layerId ) );
......@@ -351,7 +351,7 @@ void PCB_LAYER_WIDGET::ReFill()
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 );
if( myframe->IsGalCanvasActive() )
......@@ -369,7 +369,7 @@ bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer )
{
// the layer change from the PCB_LAYER_WIDGET can be denied by returning
// false from this function.
myframe->SetActiveLayer( (LAYER_ID) aLayer, false );
myframe->SetActiveLayer( ToLAYER_ID( aLayer ), false );
if( m_alwaysShowActiveCopperLayer )
OnLayerSelected();
......
......@@ -140,13 +140,13 @@ const wxPoint& ZONE_CONTAINER::GetPosition() const
void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE aDrawMode,
const wxPoint& offset )
{
if( DC == NULL )
if( !DC )
return;
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();
EDA_COLOR_T color = brd->GetLayerColor( m_Layer );
if( brd->IsLayerVisible( m_Layer ) == false && ( color & HIGHLIGHT_FLAG ) != HIGHLIGHT_FLAG )
......@@ -228,7 +228,7 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
return;
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 );
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,
bool is_close_segment = false;
wxPoint seg_start, seg_end;
if( DC == NULL )
if( !DC )
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();
EDA_COLOR_T color = brd->GetLayerColor( m_Layer );
......
......@@ -468,7 +468,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab
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
ii = m_ListNetNameSelection->GetSelection();
......
......@@ -69,7 +69,7 @@ void PCB_EDIT_FRAME::InstallPcbGlobalDeleteFrame( const wxPoint& pos )
void DIALOG_GLOBAL_DELETION::SetCurrentLayer( LAYER_NUM 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 )
msg = m_DefaultThicknessCtrl->GetValue();
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 )
m_brdSettings.m_EdgeSegmentWidth = thickness;
......
......@@ -220,7 +220,7 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event )
m_brdSettings.m_ModuleSegmentWidth = thickness;
m_parent->SetDesignSettings( m_brdSettings );
m_item->SetLayer( LAYER_ID( layer ) );
m_item->SetLayer( ToLAYER_ID( layer ) );
if( m_item->GetShape() == S_ARC )
{
......
......@@ -222,7 +222,7 @@ bool DIALOG_KEEPOUT_AREA_PROPERTIES::AcceptOptionsForKeepOut()
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() )
{
case 0:
......
......@@ -250,7 +250,7 @@ void DIALOG_PCB_TEXT_PROPERTIES::OnOkClick( wxCommandEvent& event )
}
// 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)
m_SelectedPCBText->SetMirrored( m_DisplayCtrl->GetSelection() == 1 );
......
......@@ -208,7 +208,7 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event )
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
if( m_DC ) // Display new text
{
......
......@@ -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 )
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
m_canvas->SetAutoPanRequest( true );
Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->GetSelectedCorner(), false );
break;
}
break;
case ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT:
{
......@@ -573,8 +573,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
m_canvas->SetAutoPanRequest( true );
Start_Move_Zone_Drag_Outline_Edge( &dc, zone_cont, zone_cont->GetSelectedCorner() );
break;
}
break;
case ID_POPUP_PCB_MOVE_ZONE_OUTLINES:
{
......@@ -582,8 +582,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
m_canvas->SetAutoPanRequest( true );
Start_Move_Zone_Outlines( &dc, zone_cont );
break;
}
break;
case ID_POPUP_PCB_ADD_ZONE_CORNER:
{
......@@ -601,8 +601,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
zone_cont->Draw( m_canvas, &dc, GR_XOR );
m_canvas->SetAutoPanRequest( 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_CORNER:
......@@ -611,8 +611,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
End_Move_Zone_Corner_Or_Outlines( &dc, zone_cont );
m_canvas->SetAutoPanRequest( false );
break;
}
break;
case ID_POPUP_PCB_FILL_ALL_ZONES:
m_canvas->MoveCursorToCrossHair();
......@@ -1007,7 +1007,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_TOOLBARH_PCB_SELECT_LAYER:
SetActiveLayer( (LAYER_ID) m_SelLayerBox->GetLayerSelection() );
SetActiveLayer( ToLAYER_ID( m_SelLayerBox->GetLayerSelection() ) );
if( DisplayOpt.ContrastModeDisplay )
m_canvas->Refresh( true );
......
......@@ -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
{
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 )
last_layer = last_inner_layer;
......
......@@ -321,8 +321,8 @@ bool EXCELLON_WRITER::GenDrillReportFile( const wxString& aFullFileName )
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",
TO_UTF8( m_pcb->GetLayerName( (LAYER_ID) layer1 ) ),
TO_UTF8( m_pcb->GetLayerName( (LAYER_ID) layer2 ) ) );
TO_UTF8( m_pcb->GetLayerName( ToLAYER_ID( layer1 ) ) ),
TO_UTF8( m_pcb->GetLayerName( ToLAYER_ID( layer2 ) ) ) );
}
fputs( line, m_file );
......
......@@ -37,10 +37,12 @@ static EDA_HOTKEY HkMouseLeftClick( wxT( "Mouse Left Click" ),
static EDA_HOTKEY HkMouseLeftDClick( wxT( "Mouse Left DClick" ),
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 );
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 );
static EDA_HOTKEY HkSwitch2InnerLayer1( wxT( "Switch to Inner layer 1" ),
HK_SWITCH_LAYER_TO_INNER1, WXK_F5 );
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
if( ll == F_Cu )
ll = B_Cu;
else if( ll == B_Cu )
ll = (LAYER_ID) GetBoard()->GetCopperLayerCount() - 2;
ll = ToLAYER_ID( GetBoard()->GetCopperLayerCount() - 2 );
else
ll = ll - 1;
SwitchLayer( aDC, (LAYER_ID) ll );
SwitchLayer( aDC, ToLAYER_ID( ll ) );
break;
case HK_SWITCH_LAYER_TO_NEXT:
......@@ -266,7 +266,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
else if( ++ll >= GetBoard()->GetCopperLayerCount() - 1 )
ll = B_Cu;
SwitchLayer( aDC, (LAYER_ID) ll );
SwitchLayer( aDC, ToLAYER_ID( ll ) );
break;
case HK_SWITCH_LAYER_TO_COMPONENT:
......
......@@ -124,7 +124,7 @@ void DXF2BRD_CONVERTER::addLine( const DRW_Line& data )
{
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 ) );
......@@ -146,7 +146,7 @@ void DXF2BRD_CONVERTER::addCircle( const DRW_Circle& data )
{
DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd );
segm->SetLayer( (LAYER_ID) m_brdLayer );
segm->SetLayer( ToLAYER_ID( m_brdLayer ) );
segm->SetShape( S_CIRCLE );
wxPoint center( mapX( data.basePoint.x ), mapY( data.basePoint.y ) );
segm->SetCenter( center );
......@@ -166,7 +166,7 @@ void DXF2BRD_CONVERTER::addArc( const DRW_Arc& data )
{
DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd );
segm->SetLayer( (LAYER_ID) m_brdLayer );
segm->SetLayer( ToLAYER_ID( m_brdLayer ) );
segm->SetShape( S_ARC );
// Init arc centre:
......@@ -203,7 +203,7 @@ void DXF2BRD_CONVERTER::addArc( const DRW_Arc& data )
void DXF2BRD_CONVERTER::addText(const DRW_Text& data)
{
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 secPoint( mapX(data.secPoint.x), mapY(data.secPoint.y) );
......@@ -331,7 +331,7 @@ void DXF2BRD_CONVERTER::addMText( const DRW_MText& data )
}
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 ) );
pcb_text->SetTextPosition( textpos );
......
......@@ -517,7 +517,7 @@ void PCB::MapLayer( XNODE* aNode )
#if 0 // was:
KiCadLayer = FIRST_COPPER_LAYER + m_layersStackup.GetCount() - 1 - layernum;
#else
KiCadLayer = LAYER_ID( layernum );
KiCadLayer = ToLAYER_ID( layernum );
#endif
}
......
......@@ -967,7 +967,7 @@ void PCB_EDIT_FRAME::syncLayerVisibilities()
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
......
......@@ -57,7 +57,7 @@
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)
color = LIGHTGRAY;
return color;
......
......@@ -145,7 +145,8 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
}
save_opt = DisplayOpt;
LAYER_NUM activeLayer = GetScreen()->m_Active_Layer;
LAYER_ID activeLayer = GetScreen()->m_Active_Layer;
DisplayOpt.ContrastModeDisplay = false;
DisplayOpt.DisplayPadFill = true;
......@@ -333,15 +334,16 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
m_canvas->SetPrintMirrored( false );
DisplayOpt = save_opt;
GetScreen()->m_Active_Layer = LAYER_ID( activeLayer );
GetScreen()->m_Active_Layer = activeLayer;
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_DisplayViaFill = DisplayOpt.DisplayViaFill;
m_DisplayPadNum = DisplayOpt.DisplayPadNum;
m_DisplayModEdge = DisplayOpt.DisplayModEdge;
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 )
track->SetStart( wxPoint( s.A.x, s.A.y ) );
track->SetEnd( wxPoint( s.B.x, s.B.y ) );
track->SetWidth( seg->Width() );
track->SetLayer( (LAYER_ID) seg->Layers().Start() );
track->SetLayer( ToLAYER_ID( seg->Layers().Start() ) );
track->SetNetCode( seg->Net() );
newBI = track;
break;
......
......@@ -538,7 +538,7 @@ void ROUTER_TOOL::performRouting()
m_router->SwitchLayer( m_startLayer );
frame->SetActiveLayer( (LAYER_ID) m_startLayer );
frame->SetActiveLayer( ToLAYER_ID( m_startLayer ) );
frame->GetGalCanvas()->SetFocus();
if( m_startItem && m_startItem->Net() >= 0 )
......@@ -578,7 +578,7 @@ void ROUTER_TOOL::performRouting()
else if( evt->IsAction( &ACT_PlaceThroughVia ) )
{
m_router->ToggleViaPlacement();
frame->SetTopLayer( (LAYER_ID) m_router->GetCurrentLayer() );
frame->SetTopLayer( ToLAYER_ID( m_router->GetCurrentLayer() ) );
m_router->Move( m_endSnapPoint, m_endItem );
}
else if( evt->IsAction( &ACT_SwitchPosture ) )
......@@ -590,13 +590,13 @@ void ROUTER_TOOL::performRouting()
{
m_router->SwitchLayer( m_router->NextCopperLayer( true ) );
updateEndItem( *evt );
frame->SetActiveLayer( (LAYER_ID) m_router->GetCurrentLayer() );
frame->SetActiveLayer( ToLAYER_ID( m_router->GetCurrentLayer() ) );
m_router->Move( m_endSnapPoint, m_endItem );
}
else if( evt->IsAction( &COMMON_ACTIONS::layerPrev ) )
{
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 );
}
else if( evt->IsAction( &ACT_EndTrack ) )
......
......@@ -62,13 +62,13 @@ protected:
// Virtual function
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
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,
dlg.ShowModal();
LAYER_ID layer = (LAYER_ID) dlg.GetLayerSelection();
LAYER_ID layer = ToLAYER_ID( dlg.GetLayerSelection() );
return layer;
}
......
......@@ -93,7 +93,7 @@ void SPECCTRA_DB::buildLayerMaps( BOARD* aBoard )
kicadLayer2pcb[kilayer] = pcbNdx;
// 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
......@@ -110,15 +110,14 @@ void SPECCTRA_DB::buildLayerMaps( BOARD* aBoard )
for( unsigned i = 0; i < pcbLayer2kicad.size(); ++i )
{
if( i < layerCount-1 )
pcbLayer2kicad[i] = LAYER_ID( i );
pcbLayer2kicad[i] = ToLAYER_ID( i );
else
pcbLayer2kicad[i] = B_Cu;
// 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
}
......
......@@ -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
* 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,
wxALIGN_RIGHT );
......@@ -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 )
{
text->SetLabel( board->GetLayerName( LAYER_ID( jj ) ) );
text->SetLabel( board->GetLayerName( ToLAYER_ID( jj ) ) );
if( goodSize.x < text->GetSize().x )
goodSize.x = text->GetSize().x;
......@@ -292,7 +292,7 @@ void SWAP_LAYERS_DIALOG::Sel_Layer( wxCommandEvent& event )
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 ) )
return;
......
......@@ -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->SetBoardFrame( this );
}
ReCreateLayerBox( false );
m_mainToolBar->AddControl( m_SelLayerBox );
......
......@@ -315,7 +315,7 @@ int PCBNEW_CONTROL::LayerNext( TOOL_EVENT& aEvent )
else
++layer;
editFrame->SwitchLayer( NULL, LAYER_ID( layer ) );
editFrame->SwitchLayer( NULL, ToLAYER_ID( layer ) );
editFrame->GetGalCanvas()->SetFocus();
setTransitions();
......@@ -342,7 +342,7 @@ int PCBNEW_CONTROL::LayerPrev( TOOL_EVENT& aEvent )
--layer;
assert( IsCopperLayer( layer ) );
editFrame->SwitchLayer( NULL, LAYER_ID( layer ) );
editFrame->SwitchLayer( NULL, ToLAYER_ID( layer ) );
editFrame->GetGalCanvas()->SetFocus();
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