Factored layer utility functions: classification, layer flip and mask flip

This commit is contained in:
Lorenzo Marcantonio 2013-04-05 21:04:58 +02:00
parent db09deedf7
commit 00f0e27851
24 changed files with 186 additions and 349 deletions

View File

@ -106,7 +106,6 @@ set(PCB_COMMON_SRCS
../pcbnew/class_marker_pcb.cpp
../pcbnew/class_mire.cpp
../pcbnew/class_module.cpp
../pcbnew/class_module_transform_functions.cpp
../pcbnew/class_pad.cpp
../pcbnew/class_pad_draw_functions.cpp
../pcbnew/class_pcb_text.cpp

View File

@ -72,3 +72,115 @@ int g_PadCMPColor = RED;
*/
DLIST<TRACK> g_CurrentTrackList;
LAYER_NUM FlipLayer( LAYER_NUM oldlayer )
{
switch( oldlayer )
{
case LAYER_N_BACK:
return LAYER_N_FRONT;
case LAYER_N_FRONT:
return LAYER_N_BACK;
case SILKSCREEN_N_BACK:
return SILKSCREEN_N_FRONT;
case SILKSCREEN_N_FRONT:
return SILKSCREEN_N_BACK;
case ADHESIVE_N_BACK:
return ADHESIVE_N_FRONT;
case ADHESIVE_N_FRONT:
return ADHESIVE_N_BACK;
case SOLDERMASK_N_BACK:
return SOLDERMASK_N_FRONT;
case SOLDERMASK_N_FRONT:
return SOLDERMASK_N_BACK;
case SOLDERPASTE_N_BACK:
return SOLDERPASTE_N_FRONT;
case SOLDERPASTE_N_FRONT:
return SOLDERPASTE_N_BACK;
// No change for the other layers
default:
return oldlayer;
}
}
LAYER_MSK FlipLayerMask( LAYER_MSK aMask )
{
LAYER_MSK newMask;
newMask = aMask & ~(LAYER_BACK | LAYER_FRONT |
SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT |
ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT |
SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT |
SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT |
ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT);
if( aMask & LAYER_BACK )
newMask |= LAYER_FRONT;
if( aMask & LAYER_FRONT )
newMask |= LAYER_BACK;
if( aMask & SILKSCREEN_LAYER_BACK )
newMask |= SILKSCREEN_LAYER_FRONT;
if( aMask & SILKSCREEN_LAYER_FRONT )
newMask |= SILKSCREEN_LAYER_BACK;
if( aMask & ADHESIVE_LAYER_BACK )
newMask |= ADHESIVE_LAYER_FRONT;
if( aMask & ADHESIVE_LAYER_FRONT )
newMask |= ADHESIVE_LAYER_BACK;
if( aMask & SOLDERMASK_LAYER_BACK )
newMask |= SOLDERMASK_LAYER_FRONT;
if( aMask & SOLDERMASK_LAYER_FRONT )
newMask |= SOLDERMASK_LAYER_BACK;
if( aMask & SOLDERPASTE_LAYER_BACK )
newMask |= SOLDERPASTE_LAYER_FRONT;
if( aMask & SOLDERPASTE_LAYER_FRONT )
newMask |= SOLDERPASTE_LAYER_BACK;
if( aMask & ADHESIVE_LAYER_BACK )
newMask |= ADHESIVE_LAYER_FRONT;
if( aMask & ADHESIVE_LAYER_FRONT )
newMask |= ADHESIVE_LAYER_BACK;
return newMask;
}
LAYER_NUM ExtractLayer( LAYER_MSK aMask )
{
if( aMask == NO_LAYERS )
return UNSELECTED_LAYER;
LAYER_NUM candidate = UNDEFINED_LAYER;
// Scan all the layers and take note of the first set; if other are
// then found return UNDEFINED_LAYER
for( LAYER_NUM i = FIRST_LAYER; i < NB_LAYERS; ++i )
{
if( aMask & GetLayerMask( i ) )
{
if( candidate == UNDEFINED_LAYER )
candidate = i;
else
return UNDEFINED_LAYER;
}
}
return candidate;
}

View File

@ -124,6 +124,12 @@ typedef unsigned LAYER_MSK;
#define ALL_CU_LAYERS 0x0000FFFF
#define INTERNAL_LAYERS 0x00007FFE
#define EXTERNAL_LAYERS 0x00008001
#define BACK_LAYERS (LAYER_BACK | ADHESIVE_LAYER_BACK | \
SOLDERPASTE_LAYER_BACK | SILKSCREEN_LAYER_BACK | \
SOLDERMASK_LAYER_BACK)
#define FRONT_LAYERS (LAYER_FRONT | ADHESIVE_LAYER_FRONT | \
SOLDERPASTE_LAYER_FRONT | SILKSCREEN_LAYER_FRONT | \
SOLDERMASK_LAYER_FRONT)
#define NO_LAYERS 0x00000000
/** return a one bit layer mask from a layer number
@ -271,5 +277,24 @@ inline bool IsBackLayer( LAYER_NUM aLayer )
aLayer == SOLDERPASTE_N_BACK );
}
/**
* Function ReturnFlippedLayerNumber
* @return the layer number after flipping an item
* some (not all) layers: external copper, Mask, Paste, and solder
* are swapped between front and back sides
*/
LAYER_NUM FlipLayer( LAYER_NUM oldlayer );
/**
* Calculate the mask layer when flipping a footprint
* BACK and FRONT copper layers, mask, paste, solder layers are swapped
*/
LAYER_MSK FlipLayerMask( LAYER_MSK aMask );
/**
* Extract the set layer from a mask. Returns UNDEFINED_LAYER if more
* than one is set or UNSELECTED_LAYER if none is
*/
LAYER_NUM ExtractLayer( LAYER_MSK aMask );
#endif // _LAYERS_ID_AND_VISIBILITY_H_

View File

@ -656,14 +656,6 @@ public:
*/
EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const;
/**
* Function ReturnFlippedLayerNumber
* @return the layer number after flipping an item
* some (not all) layers: external copper, Mask, Paste, and solder
* are swapped between front and back sides
*/
static LAYER_NUM ReturnFlippedLayerNumber( LAYER_NUM oldlayer );
/** Functions to get some items count */
int GetNumSegmTrack() const;

View File

@ -176,7 +176,7 @@ void DIMENSION::Rotate( const wxPoint& aRotCentre, double aAngle )
void DIMENSION::Flip( const wxPoint& aCentre )
{
Mirror( aCentre );
SetLayer( BOARD::ReturnFlippedLayerNumber( GetLayer() ) );
SetLayer( FlipLayer( GetLayer() ) );
}

View File

@ -111,7 +111,7 @@ void DRAWSEGMENT::Flip( const wxPoint& aCentre )
NEGATE( m_Angle );
}
SetLayer( BOARD::ReturnFlippedLayerNumber( GetLayer() ) );
SetLayer( FlipLayer( GetLayer() ) );
}
const wxPoint DRAWSEGMENT::GetArcEnd() const

View File

@ -194,7 +194,7 @@ void PCB_TARGET::Rotate(const wxPoint& aRotCentre, double aAngle)
void PCB_TARGET::Flip(const wxPoint& aCentre )
{
m_Pos.y = aCentre.y - ( m_Pos.y - aCentre.y );
SetLayer( BOARD::ReturnFlippedLayerNumber( GetLayer() ) );
SetLayer( FlipLayer( GetLayer() ) );
}

View File

@ -758,7 +758,7 @@ void MODULE::Flip( const wxPoint& aCentre )
SetPosition( finalPos );
// Flip layer
SetLayer( BOARD::ReturnFlippedLayerNumber( GetLayer() ) );
SetLayer( FlipLayer( GetLayer() ) );
// Reverse mirror orientation.
NEGATE( m_Orient );
@ -777,7 +777,7 @@ void MODULE::Flip( const wxPoint& aCentre )
text->m_Mirror = false;
NEGATE_AND_NORMALIZE_ANGLE_POS( text->m_Orient );
text->SetLayer( GetLayer() );
text->SetLayer( BOARD::ReturnFlippedLayerNumber( text->GetLayer() ) );
text->SetLayer( FlipLayer( text->GetLayer() ) );
if( GetLayer() == LAYER_N_BACK )
text->SetLayer( SILKSCREEN_N_BACK );
@ -785,8 +785,7 @@ void MODULE::Flip( const wxPoint& aCentre )
if( GetLayer() == LAYER_N_FRONT )
text->SetLayer( SILKSCREEN_N_FRONT );
if( (GetLayer() == SILKSCREEN_N_BACK)
|| (GetLayer() == ADHESIVE_N_BACK) || (GetLayer() == LAYER_N_BACK) )
if( IsBackLayer( GetLayer() ) )
text->m_Mirror = true;
// Mirror value.
@ -798,7 +797,7 @@ void MODULE::Flip( const wxPoint& aCentre )
text->m_Mirror = false;
NEGATE_AND_NORMALIZE_ANGLE_POS( text->m_Orient );
text->SetLayer( GetLayer() );
text->SetLayer( BOARD::ReturnFlippedLayerNumber( text->GetLayer() ) );
text->SetLayer( FlipLayer( text->GetLayer() ) );
if( GetLayer() == LAYER_N_BACK )
text->SetLayer( SILKSCREEN_N_BACK );
@ -806,8 +805,7 @@ void MODULE::Flip( const wxPoint& aCentre )
if( GetLayer() == LAYER_N_FRONT )
text->SetLayer( SILKSCREEN_N_FRONT );
if( (GetLayer() == SILKSCREEN_N_BACK)
|| (GetLayer() == ADHESIVE_N_BACK) || (GetLayer() == LAYER_N_BACK) )
if( IsBackLayer( GetLayer() ) )
text->m_Mirror = true;
// Reverse mirror module graphics and texts.
@ -839,7 +837,7 @@ void MODULE::Flip( const wxPoint& aCentre )
em->SetAngle( -em->GetAngle() );
}
em->SetLayer( BOARD::ReturnFlippedLayerNumber( em->GetLayer() ) );
em->SetLayer( FlipLayer( em->GetLayer() ) );
}
break;
@ -854,7 +852,7 @@ void MODULE::Flip( const wxPoint& aCentre )
NEGATE_AND_NORMALIZE_ANGLE_POS( text->m_Orient );
text->SetLayer( GetLayer() );
text->SetLayer( BOARD::ReturnFlippedLayerNumber( text->GetLayer() ) );
text->SetLayer( FlipLayer( text->GetLayer() ) );
if( GetLayer() == LAYER_N_BACK )
text->SetLayer( SILKSCREEN_N_BACK );
@ -862,12 +860,8 @@ void MODULE::Flip( const wxPoint& aCentre )
if( GetLayer() == LAYER_N_FRONT )
text->SetLayer( SILKSCREEN_N_FRONT );
if( GetLayer() == SILKSCREEN_N_BACK
|| GetLayer() == ADHESIVE_N_BACK
|| GetLayer() == LAYER_N_BACK )
{
if( IsBackLayer( GetLayer() ) )
text->m_Mirror = true;
}
break;

View File

@ -1,130 +0,0 @@
/**
* @file class_module_transform_functions.cpp
* @brief Functions of class MODULE to handle some geometric changes such as move, rotate ...
*/
#include <fctsys.h>
#include <wxstruct.h>
#include <trigo.h>
#include <pcbcommon.h>
#include <pcbnew.h>
#include <macros.h>
#include <protos.h>
#include <class_board.h>
#include <class_pad.h>
#include <class_edge_mod.h>
#include <class_module.h>
/* Returns the layer number after flipping an item
* some layers: external copper, Mask, Paste, and solder
* are swapped between front and back sides
*/
LAYER_NUM BOARD::ReturnFlippedLayerNumber( LAYER_NUM oldlayer )
{
LAYER_NUM newlayer;
switch( oldlayer )
{
case LAYER_N_BACK:
newlayer = LAYER_N_FRONT;
break;
case LAYER_N_FRONT:
newlayer = LAYER_N_BACK;
break;
case SILKSCREEN_N_BACK:
newlayer = SILKSCREEN_N_FRONT;
break;
case SILKSCREEN_N_FRONT:
newlayer = SILKSCREEN_N_BACK;
break;
case ADHESIVE_N_BACK:
newlayer = ADHESIVE_N_FRONT;
break;
case ADHESIVE_N_FRONT:
newlayer = ADHESIVE_N_BACK;
break;
case SOLDERMASK_N_BACK:
newlayer = SOLDERMASK_N_FRONT;
break;
case SOLDERMASK_N_FRONT:
newlayer = SOLDERMASK_N_BACK;
break;
case SOLDERPASTE_N_BACK:
newlayer = SOLDERPASTE_N_FRONT;
break;
case SOLDERPASTE_N_FRONT:
newlayer = SOLDERPASTE_N_BACK;
break;
default:
newlayer = oldlayer;
}
return newlayer;
}
/* Calculate the mask layer when flipping a footprint
* BACK and FRONT copper layers , mask, paste, solder layers are swapped
*/
LAYER_MSK ChangeSideMaskLayer( LAYER_MSK aMask )
{
LAYER_MSK newMask;
newMask = aMask & ~(LAYER_BACK | LAYER_FRONT |
SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT |
ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT |
SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT |
SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT |
ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT);
if( aMask & LAYER_BACK )
newMask |= LAYER_FRONT;
if( aMask & LAYER_FRONT )
newMask |= LAYER_BACK;
if( aMask & SILKSCREEN_LAYER_BACK )
newMask |= SILKSCREEN_LAYER_FRONT;
if( aMask & SILKSCREEN_LAYER_FRONT )
newMask |= SILKSCREEN_LAYER_BACK;
if( aMask & ADHESIVE_LAYER_BACK )
newMask |= ADHESIVE_LAYER_FRONT;
if( aMask & ADHESIVE_LAYER_FRONT )
newMask |= ADHESIVE_LAYER_BACK;
if( aMask & SOLDERMASK_LAYER_BACK )
newMask |= SOLDERMASK_LAYER_FRONT;
if( aMask & SOLDERMASK_LAYER_FRONT )
newMask |= SOLDERMASK_LAYER_BACK;
if( aMask & SOLDERPASTE_LAYER_BACK )
newMask |= SOLDERPASTE_LAYER_FRONT;
if( aMask & SOLDERPASTE_LAYER_FRONT )
newMask |= SOLDERPASTE_LAYER_BACK;
if( aMask & ADHESIVE_LAYER_BACK )
newMask |= ADHESIVE_LAYER_FRONT;
if( aMask & ADHESIVE_LAYER_FRONT )
newMask |= ADHESIVE_LAYER_BACK;
return newMask;
}

View File

@ -168,7 +168,7 @@ void D_PAD::Flip( int aTranslationY )
SetOrientation( -GetOrientation() );
// flip pads layers
SetLayerMask( ChangeSideMaskLayer( m_layerMask ) );
SetLayerMask( FlipLayerMask( m_layerMask ) );
// m_boundingRadius = -1; the shape has not been changed
}
@ -542,76 +542,31 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList )
if( (m_layerMask & ALL_CU_LAYERS) == 0 ) // pad is not on any copper layers
{
switch( m_layerMask & ~ALL_CU_LAYERS )
LAYER_NUM pad_layer = ExtractLayer( m_layerMask & ~ALL_CU_LAYERS );
switch( pad_layer )
{
case ADHESIVE_LAYER_BACK:
layerInfo = board->GetLayerName( ADHESIVE_N_BACK );
case UNSELECTED_LAYER:
layerInfo = _( "No layers" );
break;
case ADHESIVE_LAYER_FRONT:
layerInfo = board->GetLayerName( ADHESIVE_N_FRONT );
break;
case SOLDERPASTE_LAYER_BACK:
layerInfo = board->GetLayerName( SOLDERPASTE_N_BACK );
break;
case SOLDERPASTE_LAYER_FRONT:
layerInfo = board->GetLayerName( SOLDERPASTE_N_FRONT );
break;
case SILKSCREEN_LAYER_BACK:
layerInfo = board->GetLayerName( SILKSCREEN_N_BACK );
break;
case SILKSCREEN_LAYER_FRONT:
layerInfo = board->GetLayerName( SILKSCREEN_N_FRONT );
break;
case SOLDERMASK_LAYER_BACK:
layerInfo = board->GetLayerName( SOLDERMASK_N_BACK );
break;
case SOLDERMASK_LAYER_FRONT:
layerInfo = board->GetLayerName( SOLDERMASK_N_FRONT );
break;
case DRAW_LAYER:
layerInfo = board->GetLayerName( DRAW_N );
break;
case COMMENT_LAYER:
layerInfo = board->GetLayerName( COMMENT_N );
break;
case ECO1_LAYER:
layerInfo = board->GetLayerName( ECO1_N );
break;
case ECO2_LAYER:
layerInfo = board->GetLayerName( ECO2_N );
break;
case EDGE_LAYER:
layerInfo = board->GetLayerName( EDGE_N );
case UNDEFINED_LAYER:
layerInfo = _( "Non-copper" );
break;
default:
layerInfo = _( "Non-copper" );
layerInfo = board->GetLayerName( pad_layer );
break;
}
}
else
{
#define INTERIOR_COPPER (ALL_CU_LAYERS & ~(LAYER_BACK | LAYER_FRONT))
static const wxChar* andInternal = _( " & int" );
if( (m_layerMask & (LAYER_BACK | LAYER_FRONT)) == LAYER_BACK )
{
layerInfo = board->GetLayerName( LAYER_N_BACK );
if( m_layerMask & INTERIOR_COPPER )
if( m_layerMask & INTERNAL_LAYERS )
layerInfo += andInternal;
}
@ -620,7 +575,7 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList )
layerInfo = board->GetLayerName( LAYER_N_BACK ) + wxT(", ") +
board->GetLayerName( LAYER_N_FRONT );
if( m_layerMask & INTERIOR_COPPER )
if( m_layerMask & INTERNAL_LAYERS )
layerInfo += andInternal;
}
@ -628,10 +583,10 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList )
{
layerInfo = board->GetLayerName( LAYER_N_FRONT );
if( m_layerMask & INTERIOR_COPPER )
if( m_layerMask & INTERNAL_LAYERS )
layerInfo += andInternal;
}
else // necessarily true: if( m_layerMask & INTERIOR_COPPER )
else // necessarily true: if( m_layerMask & INTERNAL_LAYERS )
{
layerInfo = _( "internal" );
}

View File

@ -100,16 +100,6 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
* ECO, edge and Draw layers and not considered
*/
// Mask layers for Back side of board
#define BACK_SIDE_LAYERS \
(LAYER_BACK | ADHESIVE_LAYER_BACK | SOLDERPASTE_LAYER_BACK \
| SILKSCREEN_LAYER_BACK | SOLDERMASK_LAYER_BACK)
// Mask layers for Front side of board
#define FRONT_SIDE_LAYERS \
(LAYER_FRONT | ADHESIVE_LAYER_FRONT | SOLDERPASTE_LAYER_FRONT \
| SILKSCREEN_LAYER_FRONT | SOLDERMASK_LAYER_FRONT)
BOARD* brd = GetBoard();
bool frontVisible = brd->IsElementVisible( PCB_VISIBLE( PAD_FR_VISIBLE ) );
bool backVisible = brd->IsElementVisible( PCB_VISIBLE( PAD_BK_VISIBLE ) );
@ -120,13 +110,13 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
/* If pad are only on front side (no layer on back side)
* and if hide front side pads is enabled, do not draw
*/
if( !frontVisible && ( (m_layerMask & BACK_SIDE_LAYERS) == 0 ) )
if( !frontVisible && ( (m_layerMask & BACK_LAYERS) == 0 ) )
return;
/* If pad are only on back side (no layer on front side)
* and if hide back side pads is enabled, do not draw
*/
if( !backVisible && ( (m_layerMask & FRONT_SIDE_LAYERS) == 0 ) )
if( !backVisible && ( (m_layerMask & FRONT_LAYERS) == 0 ) )
return;
@ -152,86 +142,29 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
if( color == BLACK ) // Not on a visible copper layer (i.e. still nothing to show)
{
// If the pad is on only one tech layer, use the layer color else use DARKGRAY
int mask_non_copper_layers = m_layerMask & ~ALL_CU_LAYERS;
LAYER_MSK mask_non_copper_layers = m_layerMask & ~ALL_CU_LAYERS;
#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
mask_non_copper_layers &= brd->GetVisibleLayers();
#endif
switch( mask_non_copper_layers )
LAYER_NUM pad_layer = ExtractLayer( mask_non_copper_layers );
switch( pad_layer )
{
case 0:
case UNDEFINED_LAYER: // More than one layer
color = DARKGRAY;
break;
case ADHESIVE_LAYER_BACK:
color = brd->GetLayerColor( ADHESIVE_N_BACK );
break;
case ADHESIVE_LAYER_FRONT:
color = brd->GetLayerColor( ADHESIVE_N_FRONT );
break;
case SOLDERPASTE_LAYER_BACK:
color = brd->GetLayerColor( SOLDERPASTE_N_BACK );
#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
showActualMaskSize = SOLDERPASTE_N_BACK;
#endif
break;
case SOLDERPASTE_LAYER_FRONT:
color = brd->GetLayerColor( SOLDERPASTE_N_FRONT );
#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
showActualMaskSize = SOLDERPASTE_N_FRONT;
#endif
break;
case SILKSCREEN_LAYER_BACK:
color = brd->GetLayerColor( SILKSCREEN_N_BACK );
break;
case SILKSCREEN_LAYER_FRONT:
color = brd->GetLayerColor( SILKSCREEN_N_FRONT );
break;
case SOLDERMASK_LAYER_BACK:
color = brd->GetLayerColor( SOLDERMASK_N_BACK );
#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
showActualMaskSize = SOLDERMASK_N_BACK;
#endif
break;
case SOLDERMASK_LAYER_FRONT:
color = brd->GetLayerColor( SOLDERMASK_N_FRONT );
#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
showActualMaskSize = SOLDERMASK_N_FRONT;
#endif
break;
case DRAW_LAYER:
color = brd->GetLayerColor( DRAW_N );
break;
case COMMENT_LAYER:
color = brd->GetLayerColor( COMMENT_N );
break;
case ECO1_LAYER:
color = brd->GetLayerColor( ECO1_N );
break;
case ECO2_LAYER:
color = brd->GetLayerColor( ECO2_N );
break;
case EDGE_LAYER:
color = brd->GetLayerColor( EDGE_N );
case UNSELECTED_LAYER: // Shouldn't really happen...
break;
default:
color = DARKGRAY;
break;
color = brd->GetLayerColor( pad_layer );
#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
showActualMaskSize = pad_layer;
#endif
}
}
// if PAD_SMD pad and high contrast mode
// if SMD or connector pad and high contrast mode
if( ( aDraw_mode & GR_ALLOW_HIGHCONTRAST ) &&
( GetAttribute() == PAD_SMD || GetAttribute() == PAD_CONN ) &&
DisplayOpt.ContrastModeDisplay )
@ -286,6 +219,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
break;
default:
// Another layer which has no margin to handle
break;
}
}

View File

@ -169,7 +169,7 @@ void TEXTE_PCB::Flip(const wxPoint& aCentre )
{
m_Mirror = not m_Mirror; /* inverse mirror */
}
SetLayer( BOARD::ReturnFlippedLayerNumber( GetLayer() ) );
SetLayer( FlipLayer( GetLayer() ) );
}

View File

@ -390,7 +390,7 @@ void TRACK::Flip( const wxPoint& aCentre )
}
else
{
SetLayer( BOARD::ReturnFlippedLayerNumber( GetLayer() ) );
SetLayer( FlipLayer( GetLayer() ) );
}
}

View File

@ -826,7 +826,7 @@ void ZONE_CONTAINER::Rotate( const wxPoint& centre, double angle )
void ZONE_CONTAINER::Flip( const wxPoint& aCentre )
{
Mirror( aCentre );
SetLayer( BOARD::ReturnFlippedLayerNumber( GetLayer() ) );
SetLayer( FlipLayer( GetLayer() ) );
}

View File

@ -294,7 +294,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
m_dummyPad->SetDelta( sz );
// flip pad's layers
m_dummyPad->SetLayerMask( ChangeSideMaskLayer( m_dummyPad->GetLayerMask() ) );
m_dummyPad->SetLayerMask( FlipLayerMask( m_dummyPad->GetLayerMask() ) );
}
m_staticTextWarningPadFlipped->Show(m_isFlipped);
@ -799,7 +799,7 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
}
if( m_isFlipped )
m_currentPad->SetLayerMask( ChangeSideMaskLayer( m_currentPad->GetLayerMask() ) );
m_currentPad->SetLayerMask( FlipLayerMask( m_currentPad->GetLayerMask() ) );
m_currentPad->SetPadName( m_padMaster.GetPadName() );

View File

@ -238,7 +238,7 @@ void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event )
switch( event.GetId() )
{
case ID_LAYER_FAB: // Select layers usually neede d to build a board
case ID_LAYER_FAB: // Select layers usually needed to build a board
for( i = 0; i < m_layerList.size(); i++ )
{
LAYER_MSK layermask = GetLayerMask( m_layerList[ i ] );

View File

@ -144,7 +144,7 @@ void PCB_ARC::Flip()
m_startX = -m_startX;
m_angle = -m_angle;
m_KiCadLayer = FlipLayers( m_KiCadLayer );
m_KiCadLayer = FlipLayer( m_KiCadLayer );
}

View File

@ -43,7 +43,7 @@ PCB_COMPONENT::PCB_COMPONENT( PCB_CALLBACKS* aCallbacks,
m_tag = 0;
m_objType = wxT( '?' );
m_PCadLayer = 0;
m_KiCadLayer = NO_LAYER;
m_KiCadLayer = LAYER_N_FRONT; // It *has* to be somewhere...
m_timestamp = 0;
m_positionX = 0;
m_positionY = 0;
@ -77,39 +77,4 @@ void PCB_COMPONENT::Flip()
m_positionX = -m_positionX;
}
LAYER_NUM PCB_COMPONENT::FlipLayers( LAYER_NUM aLayer )
{
LAYER_NUM result = aLayer; // dafault is no swap
// routed layers
if( aLayer == LAYER_N_BACK )
result = LAYER_N_FRONT;
if( aLayer == LAYER_N_FRONT )
result = LAYER_N_BACK;
// Silk
if( aLayer == SILKSCREEN_N_FRONT )
result = SILKSCREEN_N_BACK;
if( aLayer == SILKSCREEN_N_BACK )
result = SILKSCREEN_N_FRONT;
// Paste
if( aLayer == SOLDERPASTE_N_FRONT )
result = SOLDERPASTE_N_BACK;
if( aLayer == SOLDERPASTE_N_BACK )
result = SOLDERPASTE_N_FRONT;
// Mask
if( aLayer == SOLDERMASK_N_FRONT )
result = SOLDERMASK_N_BACK;
if( aLayer == SOLDERMASK_N_BACK )
result = SOLDERMASK_N_FRONT;
return result;
}
} // namespace PCAD2KICAD

View File

@ -77,8 +77,6 @@ public:
protected:
PCB_CALLBACKS* m_callbacks;
BOARD* m_board;
LAYER_NUM FlipLayers( LAYER_NUM aLayer );
};
WX_DEFINE_ARRAY( PCB_COMPONENT*, PCB_COMPONENTS_ARRAY );

View File

@ -110,7 +110,7 @@ void PCB_LINE::Flip()
PCB_COMPONENT::Flip();
m_toX = -m_toX;
m_KiCadLayer = FlipLayers( m_KiCadLayer );
m_KiCadLayer = FlipLayer( m_KiCadLayer );
}

View File

@ -606,7 +606,7 @@ void PCB_MODULE::Flip()
if( m_mirror == 1 )
{
// Flipped
m_KiCadLayer = FlipLayers( m_KiCadLayer );
m_KiCadLayer = FlipLayer( m_KiCadLayer );
m_rotation = -m_rotation;
m_name.textPositionX = -m_name.textPositionX;
m_name.mirror = m_mirror;

View File

@ -180,7 +180,7 @@ void PCB_PAD::Flip()
m_rotation = -m_rotation;
for( i = 0; i < (int)m_shapes.GetCount(); i++ )
m_shapes[i]->m_KiCadLayer = FlipLayers( m_shapes[i]->m_KiCadLayer );
m_shapes[i]->m_KiCadLayer = FlipLayer( m_shapes[i]->m_KiCadLayer );
}

View File

@ -51,13 +51,6 @@ void DrawTraces( EDA_DRAW_PANEL* panel,
/* MODULES.C */
/*************/
/**
* Function ChangeSideMaskLayer
* calculates the mask layer when flipping a footprint.
* BACK and FRONT copper layers , mask, paste, solder layers are swapped.
*/
LAYER_MSK ChangeSideMaskLayer( LAYER_MSK aMask );
void DrawModuleOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* module );

View File

@ -21,7 +21,7 @@ CPolyLine::CPolyLine()
{
m_hatchStyle = NO_HATCH;
m_hatchPitch = 0;
m_layer = NO_LAYER;
m_layer = LAYER_N_FRONT;
m_utility = 0;
}