Factored out text anchor drawing
More layer classification cleanup
This commit is contained in:
parent
0de48234bc
commit
b525e3be55
|
@ -106,14 +106,14 @@ void LAYER_BOX_SELECTOR::ResyncBitmapOnly()
|
|||
}
|
||||
|
||||
|
||||
void LAYER_BOX_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayerIndex )
|
||||
void LAYER_BOX_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer )
|
||||
{
|
||||
wxMemoryDC bmpDC;
|
||||
wxBrush brush;
|
||||
|
||||
// Prepare Bitmap
|
||||
bmpDC.SelectObject( aLayerbmp );
|
||||
brush.SetColour( MakeColour( GetLayerColor( aLayerIndex ) ) );
|
||||
brush.SetColour( MakeColour( GetLayerColor( aLayer ) ) );
|
||||
brush.SetStyle( wxSOLID );
|
||||
|
||||
bmpDC.SetBrush( brush );
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <cstdlib> // bsearch()
|
||||
#include <cctype>
|
||||
|
||||
|
||||
#include <macros.h>
|
||||
#include <dsnlexer.h>
|
||||
|
||||
//#include "fctsys.h"
|
||||
|
|
|
@ -269,22 +269,12 @@ void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
|||
if( aDrawMode != -1 )
|
||||
GRSetDrawMode( aDC, aDrawMode );
|
||||
|
||||
/* Draw text anchor, if allowed */
|
||||
// Draw text anchor, if requested
|
||||
if( aAnchor_color != UNSPECIFIED_COLOR )
|
||||
{
|
||||
|
||||
int anchor_size = aDC->DeviceToLogicalXRel( 2 );
|
||||
|
||||
aAnchor_color = (EDA_COLOR_T) ( aAnchor_color & MASKCOLOR );
|
||||
|
||||
int cX = aPos.x + aOffset.x;
|
||||
int cY = aPos.y + aOffset.y;
|
||||
|
||||
GRLine( aPanel->GetClipBox(), aDC, cX - anchor_size, cY,
|
||||
cX + anchor_size, cY, 0, aAnchor_color );
|
||||
|
||||
GRLine( aPanel->GetClipBox(), aDC, cX, cY - anchor_size,
|
||||
cX, cY + anchor_size, 0, aAnchor_color );
|
||||
GRDrawAnchor( aPanel->GetClipBox(), aDC,
|
||||
aPos.x + aOffset.x, aPos.y + aOffset.y,
|
||||
DIM_ANCRE_TEXTE, aAnchor_color );
|
||||
}
|
||||
|
||||
if( aFillMode == SKETCH )
|
||||
|
|
|
@ -1551,3 +1551,16 @@ EDA_COLOR_T ColorFindNearest( const wxColour &aColor )
|
|||
|
||||
return candidate;
|
||||
}
|
||||
|
||||
void GRDrawAnchor( EDA_RECT *aClipBox, wxDC *aDC, int x, int y,
|
||||
int aSize, EDA_COLOR_T aColor )
|
||||
{
|
||||
int anchor_size = aDC->DeviceToLogicalXRel( aSize );
|
||||
|
||||
GRLine( aClipBox, aDC,
|
||||
x - anchor_size, y,
|
||||
x + anchor_size, y, 0, aColor );
|
||||
GRLine( aClipBox, aDC,
|
||||
x, y - anchor_size,
|
||||
x, y + anchor_size, 0, aColor );
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <wxstruct.h>
|
||||
#include <dialog_helpers.h>
|
||||
#include <base_units.h>
|
||||
#include <macros.h>
|
||||
|
||||
|
||||
/*******************************************************/
|
||||
|
|
|
@ -28,7 +28,6 @@ typedef boost::ptr_vector< COMPONENT_INFO > COMPONENT_LIST;
|
|||
extern const wxString FootprintAliasFileExtension;
|
||||
extern const wxString RetroFileExtension;
|
||||
|
||||
extern const wxString RetroFileWildcard;
|
||||
extern const wxString FootprintAliasFileWildcard;
|
||||
|
||||
extern const wxString titleLibLoadError;
|
||||
|
|
|
@ -65,18 +65,18 @@ void GBR_LAYER_BOX_SELECTOR::Resync()
|
|||
|
||||
|
||||
// Returns a color index from the layer id
|
||||
EDA_COLOR_T GBR_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayerIndex ) const
|
||||
EDA_COLOR_T GBR_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayer ) const
|
||||
{
|
||||
GERBVIEW_FRAME* frame = (GERBVIEW_FRAME*) GetParent()->GetParent();
|
||||
|
||||
return frame->GetLayerColor( aLayerIndex );
|
||||
return frame->GetLayerColor( aLayer );
|
||||
}
|
||||
|
||||
|
||||
// Returns the name of the layer id
|
||||
wxString GBR_LAYER_BOX_SELECTOR::GetLayerName( LAYER_NUM aLayerIndex ) const
|
||||
wxString GBR_LAYER_BOX_SELECTOR::GetLayerName( LAYER_NUM aLayer ) const
|
||||
{
|
||||
wxString name;
|
||||
name.Printf( _( "Layer %d" ), aLayerIndex + 1 );
|
||||
name.Printf( _( "Layer %d" ), aLayer + 1 );
|
||||
return name;
|
||||
}
|
||||
|
|
|
@ -37,15 +37,15 @@ public:
|
|||
|
||||
// Returns a color index from the layer id
|
||||
// Virtual function
|
||||
EDA_COLOR_T GetLayerColor( LAYER_NUM aLayerIndex ) const;
|
||||
EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const;
|
||||
|
||||
// Returns true if the layer id is enabled (i.e. is it should be displayed)
|
||||
// Virtual function
|
||||
bool IsLayerEnabled( LAYER_NUM aLayerIndex ) const { return true; };
|
||||
bool IsLayerEnabled( LAYER_NUM aLayer ) const { return true; };
|
||||
|
||||
// Returns the name of the layer id
|
||||
// Virtual function
|
||||
wxString GetLayerName( LAYER_NUM aLayerIndex ) const;
|
||||
wxString GetLayerName( LAYER_NUM aLayer ) const;
|
||||
};
|
||||
|
||||
#endif //CLASS_GBR_LAYER_BOX_SELECTOR_H
|
||||
|
|
|
@ -24,12 +24,12 @@ GBR_LAYOUT::~GBR_LAYOUT()
|
|||
|
||||
/* Function IsLayerVisible
|
||||
* tests whether a given layer is visible
|
||||
* param aLayerIndex = The index of the layer to be tested
|
||||
* param aLayer = The layer to be tested
|
||||
* return bool - true if the layer is visible.
|
||||
*/
|
||||
bool GBR_LAYOUT::IsLayerVisible( LAYER_NUM aLayerIndex ) const
|
||||
bool GBR_LAYOUT::IsLayerVisible( LAYER_NUM aLayer ) const
|
||||
{
|
||||
return m_printLayersMask & GetLayerMask( aLayerIndex );
|
||||
return m_printLayersMask & GetLayerMask( aLayer );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -99,10 +99,10 @@ public:
|
|||
/**
|
||||
* Function IsLayerVisible
|
||||
* tests whether a given layer is visible
|
||||
* @param aLayerIndex = The index of the layer to be tested
|
||||
* @param aLayer = The layer to be tested
|
||||
* @return bool - true if the layer is visible.
|
||||
*/
|
||||
bool IsLayerVisible( LAYER_NUM aLayerIndex ) const;
|
||||
bool IsLayerVisible( LAYER_NUM aLayer ) const;
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const; // overload
|
||||
|
|
|
@ -139,7 +139,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
|
|||
|
||||
layer_max = NB_LAYERS;
|
||||
// Create layer list
|
||||
for(LAYER_NUM ii = FIRST_LAYER; ii < layer_max; ++ii )
|
||||
for( LAYER_NUM ii = FIRST_LAYER; ii < layer_max; ++ii )
|
||||
{
|
||||
LAYER_MSK mask = GetLayerMask( ii );
|
||||
msg = _( "Layer" );
|
||||
|
|
|
@ -195,7 +195,7 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( LAYER_NUM* LayerLookUpTable )
|
|||
LAYER_NUM layer = gerb_item->GetLayer();
|
||||
LAYER_NUM pcb_layer_number = LayerLookUpTable[layer];
|
||||
|
||||
if( pcb_layer_number < FIRST_LAYER || pcb_layer_number > LAST_NON_COPPER_LAYER )
|
||||
if( !IsPcbLayer( pcb_layer_number ) )
|
||||
continue;
|
||||
|
||||
if( pcb_layer_number > LAST_COPPER_LAYER )
|
||||
|
|
|
@ -558,15 +558,15 @@ void GERBVIEW_FRAME::SetVisibleLayers( LAYER_MSK aLayerMask )
|
|||
/**
|
||||
* Function IsLayerVisible
|
||||
* tests whether a given layer is visible
|
||||
* @param aLayerIndex = The index of the layer to be tested
|
||||
* @param aLayer = The layer to be tested
|
||||
* @return bool - true if the layer is visible.
|
||||
*/
|
||||
bool GERBVIEW_FRAME::IsLayerVisible( LAYER_NUM aLayerIndex ) const
|
||||
bool GERBVIEW_FRAME::IsLayerVisible( LAYER_NUM aLayer ) const
|
||||
{
|
||||
if( ! m_DisplayOptions.m_IsPrinting )
|
||||
return m_LayersManager->IsLayerVisible( aLayerIndex );
|
||||
return m_LayersManager->IsLayerVisible( aLayer );
|
||||
else
|
||||
return GetLayout()->IsLayerVisible( aLayerIndex );
|
||||
return GetLayout()->IsLayerVisible( aLayer );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -313,10 +313,10 @@ public:
|
|||
/**
|
||||
* Function IsLayerVisible
|
||||
* tests whether a given layer is visible
|
||||
* @param aLayerIndex = The index of the layer to be tested
|
||||
* @param aLayer = The layer to be tested
|
||||
* @return bool - true if the layer is visible.
|
||||
*/
|
||||
bool IsLayerVisible( LAYER_NUM aLayerIndex ) const;
|
||||
bool IsLayerVisible( LAYER_NUM aLayer ) const;
|
||||
|
||||
/**
|
||||
* Function GetVisibleElementColor
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <class_GERBER.h>
|
||||
|
||||
#include <html_messagebox.h>
|
||||
#include <macros.h>
|
||||
|
||||
/* Read a gerber file, RS274D or RS274X format.
|
||||
*/
|
||||
|
|
|
@ -360,12 +360,12 @@ void LAYERS_MAP_DIALOG::OnSelectLayer( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
LAYER_NUM jj = m_layersLookUpTable[m_buttonTable[ii]];
|
||||
if( ( jj < FIRST_LAYER ) || ( jj > NB_LAYERS ) )
|
||||
if( !IsValidLayer( jj ) )
|
||||
jj = LAYER_N_BACK; // (Defaults to "Copper" layer.)
|
||||
|
||||
jj = m_Parent->SelectPCBLayer( jj, m_exportBoardCopperLayersCount, true );
|
||||
|
||||
if( ( jj < FIRST_LAYER ) || ( jj > NB_LAYERS ) )
|
||||
if( !IsValidLayer( jj ) )
|
||||
return;
|
||||
|
||||
if( jj != m_layersLookUpTable[m_buttonTable[ii]] )
|
||||
|
|
|
@ -75,26 +75,22 @@ public:
|
|||
/**
|
||||
* Function IsLayerVisible
|
||||
* tests whether a given layer is visible
|
||||
* @param aLayerIndex = The index of the layer to be tested
|
||||
* @param aLayer = The layer to be tested
|
||||
* @return bool - true if the layer is visible.
|
||||
*/
|
||||
bool IsLayerVisible( LAYER_NUM aLayerIndex ) const
|
||||
bool IsLayerVisible( LAYER_NUM aLayer ) const
|
||||
{
|
||||
// @@IMB: Altough Pcbnew uses only 29, GerbView uses all 32 layers
|
||||
if( aLayerIndex < FIRST_LAYER || aLayerIndex >= NB_LAYERS )
|
||||
return false;
|
||||
|
||||
// If a layer is disabled, it is automatically invisible
|
||||
return bool( m_VisibleLayers & m_EnabledLayers & GetLayerMask( aLayerIndex ) );
|
||||
return m_VisibleLayers & m_EnabledLayers & GetLayerMask( aLayer );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function SetLayerVisibility
|
||||
* changes the visibility of a given layer
|
||||
* @param aLayerIndex = The index of the layer to be changed
|
||||
* @param aLayer = The layer to be changed
|
||||
* @param aNewState = The new visibility state of the layer
|
||||
*/
|
||||
void SetLayerVisibility( LAYER_NUM aLayerIndex, bool aNewState );
|
||||
void SetLayerVisibility( LAYER_NUM aLayer, bool aNewState );
|
||||
|
||||
/**
|
||||
* Function GetVisibleElements
|
||||
|
@ -158,12 +154,12 @@ public:
|
|||
/**
|
||||
* Function IsLayerEnabled
|
||||
* tests whether a given layer is enabled
|
||||
* @param aLayerIndex = The index of the layer to be tested
|
||||
* @param aLayer = The of the layer to be tested
|
||||
* @return bool - true if the layer is enabled
|
||||
*/
|
||||
bool IsLayerEnabled( LAYER_NUM aLayerIndex ) const
|
||||
bool IsLayerEnabled( LAYER_NUM aLayer ) const
|
||||
{
|
||||
return bool( m_EnabledLayers & GetLayerMask( aLayerIndex ) );
|
||||
return m_EnabledLayers & GetLayerMask( aLayer );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -35,15 +35,15 @@ public:
|
|||
|
||||
// Returns a color index from the layer id
|
||||
// Virtual function because GerbView uses its own functions in a derived class
|
||||
virtual EDA_COLOR_T GetLayerColor( LAYER_NUM aLayerIndex ) const = 0;
|
||||
virtual EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const = 0;
|
||||
|
||||
// Returns the name of the layer id
|
||||
// Virtual pure function because GerbView uses its own functions in a derived class
|
||||
virtual wxString GetLayerName( LAYER_NUM aLayerIndex ) const = 0;
|
||||
virtual wxString GetLayerName( LAYER_NUM aLayer ) const = 0;
|
||||
|
||||
// Returns true if the layer id is enabled (i.e. is it should be displayed)
|
||||
// Virtual function pure because GerbView uses its own functions in a derived class
|
||||
virtual bool IsLayerEnabled( LAYER_NUM aLayerIndex ) const = 0;
|
||||
virtual bool IsLayerEnabled( LAYER_NUM aLayer ) const = 0;
|
||||
|
||||
// Get Current Item #
|
||||
int GetChoice();
|
||||
|
@ -66,7 +66,7 @@ public:
|
|||
|
||||
protected:
|
||||
// Fills the layer bitmap aLayerbmp with the layer color
|
||||
void SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayerIndex );
|
||||
void SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer );
|
||||
};
|
||||
|
||||
#define DECLARE_LAYERS_HOTKEY(list) int list[NB_LAYERS] = \
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
#include <base_struct.h>
|
||||
#include <eda_text.h> // EDA_TEXT_HJUSTIFY_T and EDA_TEXT_VJUSTIFY_T
|
||||
|
||||
/// Minimum dimension in pixel for drawing text
|
||||
#define MIN_TEXT_SIZE 5
|
||||
|
||||
class EDA_DRAW_PANEL;
|
||||
class PLOTTER;
|
||||
|
||||
|
|
|
@ -62,6 +62,7 @@ enum EDA_DRAW_MODE_T {
|
|||
|
||||
#define DEFAULT_SIZE_TEXT 60 /* default text height (in mils or 1/1000") */
|
||||
#define TEXT_NO_VISIBLE 1 //< EDA_TEXT::m_Attribut(e?) visibility flag.
|
||||
#define DIM_ANCRE_TEXTE 2 // Anchor size for text
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -260,4 +260,7 @@ void GRSFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1,
|
|||
void GRLineArray( EDA_RECT* aClipBox, wxDC* aDC,std::vector<wxPoint>& aLines,
|
||||
int aWidth, EDA_COLOR_T aColor );
|
||||
|
||||
void GRDrawAnchor( EDA_RECT* aClipBox, wxDC *aDC, int x, int y, int aSize,
|
||||
EDA_COLOR_T aColor );
|
||||
|
||||
#endif /* define GR_BASIC */
|
||||
|
|
|
@ -216,39 +216,52 @@ enum PCB_VISIBLE
|
|||
END_PCB_VISIBLE_LIST // sentinel
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Function IsValidPcbLayerIndex
|
||||
* tests whether a given integer is a valid layer index
|
||||
* @param aLayerIndex = Layer index to test
|
||||
* Function IsValidLayer
|
||||
* tests whether a given integer is a valid layer index, i.e. can
|
||||
* be safely put in a LAYER_NUM
|
||||
* @param aLayerIndex = Layer index to test. It can be an int, so its
|
||||
* useful during I/O
|
||||
* @return true if aLayerIndex is a valid layer index
|
||||
*/
|
||||
inline bool IsValidPcbLayerIndex( LAYER_NUM aLayerIndex )
|
||||
inline bool IsValidLayer( int aLayerIndex )
|
||||
{
|
||||
return aLayerIndex >= FIRST_LAYER && aLayerIndex < NB_PCB_LAYERS;
|
||||
return aLayerIndex >= FIRST_LAYER && aLayerIndex < NB_LAYERS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function IsValidCopperLayerIndex
|
||||
* tests whether an integer is a valid copper layer index
|
||||
* @param aLayerIndex = Layer index to test
|
||||
* @return true if aLayerIndex is a valid copper layer index
|
||||
* Function IsPcbLayer
|
||||
* tests whether a layer is a valid layer for pcbnew
|
||||
* @param aLayer = Layer to test
|
||||
* @return true if aLayer is a layer valid in pcbnew
|
||||
*/
|
||||
inline bool IsValidCopperLayerIndex( LAYER_NUM aLayerIndex )
|
||||
inline bool IsPcbLayer( LAYER_NUM aLayer )
|
||||
{
|
||||
return aLayerIndex >= FIRST_COPPER_LAYER && aLayerIndex <= LAST_COPPER_LAYER;
|
||||
return aLayer >= FIRST_LAYER && aLayer < NB_PCB_LAYERS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function IsValidNonCopperLayerIndex
|
||||
* tests whether an integer is a valid non copper layer index
|
||||
* @param aLayerIndex = Layer index to test
|
||||
* @return true if aLayerIndex is a valid non copper layer index
|
||||
* Function IsCopperLayer
|
||||
* tests whether a layer is a copper layer
|
||||
* @param aLayer = Layer to test
|
||||
* @return true if aLayer is a valid copper layer
|
||||
*/
|
||||
inline bool IsValidNonCopperLayerIndex( LAYER_NUM aLayerIndex )
|
||||
inline bool IsCopperLayer( LAYER_NUM aLayer )
|
||||
{
|
||||
return aLayerIndex >= FIRST_NON_COPPER_LAYER
|
||||
&& aLayerIndex <= LAST_NON_COPPER_LAYER;
|
||||
return aLayer >= FIRST_COPPER_LAYER
|
||||
&& aLayer <= LAST_COPPER_LAYER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function IsNonCopperLayer
|
||||
* tests whether a layer is a non copper layer
|
||||
* @param aLayer = Layer to test
|
||||
* @return true if aLayer is a non copper layer
|
||||
*/
|
||||
inline bool IsNonCopperLayer( LAYER_NUM aLayer )
|
||||
{
|
||||
return aLayer >= FIRST_NON_COPPER_LAYER
|
||||
&& aLayer <= LAST_NON_COPPER_LAYER;
|
||||
}
|
||||
|
||||
/* IMPORTANT: If a layer is not a front layer not necessarily is true
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <wildcards_and_files_ext.h>
|
||||
#include <vector>
|
||||
#include <build_version.h>
|
||||
#include <macros.h>
|
||||
|
||||
#include <wx/dir.h>
|
||||
#include <wx/filename.h>
|
||||
|
|
|
@ -315,7 +315,7 @@ void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, LAYER_NUM layer )
|
|||
|
||||
// Copper layers cannot be selected unconditionally; how many
|
||||
// of those layers are currently enabled needs to be checked.
|
||||
if( IsValidCopperLayerIndex( layer ) )
|
||||
if( IsCopperLayer( layer ) )
|
||||
{
|
||||
// If only one copper layer is enabled, the only such layer
|
||||
// that can be selected to is the "Copper" layer (so the
|
||||
|
|
|
@ -356,23 +356,23 @@ bool BOARD::SetLayer( LAYER_NUM aIndex, const LAYER& aLayer )
|
|||
}
|
||||
|
||||
|
||||
wxString BOARD::GetLayerName( LAYER_NUM aLayerIndex ) const
|
||||
wxString BOARD::GetLayerName( LAYER_NUM aLayer ) const
|
||||
{
|
||||
if( !IsValidPcbLayerIndex( aLayerIndex ) )
|
||||
if( !IsPcbLayer( aLayer ) )
|
||||
return wxEmptyString;
|
||||
|
||||
// All layer names are stored in the BOARD.
|
||||
if( IsLayerEnabled( aLayerIndex ) )
|
||||
if( IsLayerEnabled( aLayer ) )
|
||||
{
|
||||
// Standard names were set in BOARD::BOARD() but they may be
|
||||
// over-ridden by BOARD::SetLayerName().
|
||||
// For copper layers, return the actual copper layer name,
|
||||
// otherwise return the Standard English layer name.
|
||||
if( aLayerIndex < FIRST_NON_COPPER_LAYER )
|
||||
return m_Layer[aLayerIndex].m_Name;
|
||||
if( IsCopperLayer( aLayer ) )
|
||||
return m_Layer[aLayer].m_Name;
|
||||
}
|
||||
|
||||
return GetStandardLayerName( aLayerIndex );
|
||||
return GetStandardLayerName( aLayer );
|
||||
}
|
||||
|
||||
|
||||
|
@ -422,9 +422,9 @@ wxString BOARD::GetStandardLayerName( LAYER_NUM aLayerNumber )
|
|||
}
|
||||
|
||||
|
||||
bool BOARD::SetLayerName( LAYER_NUM aLayerIndex, const wxString& aLayerName )
|
||||
bool BOARD::SetLayerName( LAYER_NUM aLayer, const wxString& aLayerName )
|
||||
{
|
||||
if( !IsValidCopperLayerIndex( aLayerIndex ) )
|
||||
if( !IsCopperLayer( aLayer ) )
|
||||
return false;
|
||||
|
||||
if( aLayerName == wxEmptyString || aLayerName.Len() > 20 )
|
||||
|
@ -439,15 +439,15 @@ bool BOARD::SetLayerName( LAYER_NUM aLayerIndex, const wxString& aLayerName )
|
|||
// replace any spaces with underscores before we do any comparing
|
||||
NameTemp.Replace( wxT( " " ), wxT( "_" ) );
|
||||
|
||||
if( IsLayerEnabled( aLayerIndex ) )
|
||||
if( IsLayerEnabled( aLayer ) )
|
||||
{
|
||||
for( LAYER_NUM i = FIRST_COPPER_LAYER; i < NB_COPPER_LAYERS; ++i )
|
||||
{
|
||||
if( i != aLayerIndex && IsLayerEnabled( i ) && NameTemp == m_Layer[i].m_Name )
|
||||
if( i != aLayer && IsLayerEnabled( i ) && NameTemp == m_Layer[i].m_Name )
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Layer[aLayerIndex].m_Name = NameTemp;
|
||||
m_Layer[aLayer].m_Name = NameTemp;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -456,30 +456,30 @@ bool BOARD::SetLayerName( LAYER_NUM aLayerIndex, const wxString& aLayerName )
|
|||
}
|
||||
|
||||
|
||||
LAYER_T BOARD::GetLayerType( LAYER_NUM aLayerIndex ) const
|
||||
LAYER_T BOARD::GetLayerType( LAYER_NUM aLayer ) const
|
||||
{
|
||||
if( !IsValidCopperLayerIndex( aLayerIndex ) )
|
||||
if( !IsCopperLayer( aLayer ) )
|
||||
return LT_SIGNAL;
|
||||
|
||||
//@@IMB: The original test was broken due to the discontinuity
|
||||
// in the layer sequence.
|
||||
if( IsLayerEnabled( aLayerIndex ) )
|
||||
return m_Layer[aLayerIndex].m_Type;
|
||||
if( IsLayerEnabled( aLayer ) )
|
||||
return m_Layer[aLayer].m_Type;
|
||||
|
||||
return LT_SIGNAL;
|
||||
}
|
||||
|
||||
|
||||
bool BOARD::SetLayerType( LAYER_NUM aLayerIndex, LAYER_T aLayerType )
|
||||
bool BOARD::SetLayerType( LAYER_NUM aLayer, LAYER_T aLayerType )
|
||||
{
|
||||
if( !IsValidCopperLayerIndex( aLayerIndex ) )
|
||||
if( !IsCopperLayer( aLayer ) )
|
||||
return false;
|
||||
|
||||
//@@IMB: The original test was broken due to the discontinuity
|
||||
// in the layer sequence.
|
||||
if( IsLayerEnabled( aLayerIndex ) )
|
||||
if( IsLayerEnabled( aLayer ) )
|
||||
{
|
||||
m_Layer[aLayerIndex].m_Type = aLayerType;
|
||||
m_Layer[aLayer].m_Type = aLayerType;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -451,12 +451,12 @@ public:
|
|||
* Function IsLayerVisible
|
||||
* is a proxy function that calls the correspondent function in m_BoardSettings
|
||||
* tests whether a given layer is visible
|
||||
* @param aLayerIndex = The index of the layer to be tested
|
||||
* @param aLayer = The layer to be tested
|
||||
* @return bool - true if the layer is visible.
|
||||
*/
|
||||
bool IsLayerVisible( LAYER_NUM aLayerIndex ) const
|
||||
bool IsLayerVisible( LAYER_NUM aLayer ) const
|
||||
{
|
||||
return m_designSettings.IsLayerVisible( aLayerIndex );
|
||||
return m_designSettings.IsLayerVisible( aLayer );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -588,26 +588,26 @@ public:
|
|||
|
||||
/**
|
||||
* Function GetLayerName
|
||||
* returns the name of a layer given by aLayerIndex. Copper layers may
|
||||
* returns the name of a layer given by aLayer. Copper layers may
|
||||
* have custom names.
|
||||
*
|
||||
* @param aLayerIndex = A layer index, like LAYER_N_BACK, etc.
|
||||
* @param aLayer = A layer, like LAYER_N_BACK, etc.
|
||||
*
|
||||
* @return wxString - the layer name, which for copper layers may
|
||||
* be custom, else standard.
|
||||
*/
|
||||
wxString GetLayerName( LAYER_NUM aLayerIndex ) const;
|
||||
wxString GetLayerName( LAYER_NUM aLayer ) const;
|
||||
|
||||
/**
|
||||
* Function SetLayerName
|
||||
* changes the name of the layer given by aLayerIndex.
|
||||
* changes the name of the layer given by aLayer.
|
||||
*
|
||||
* @param aLayerIndex A layer index, like LAYER_N_BACK, etc.
|
||||
* @param aLayer A layer, like LAYER_N_BACK, etc.
|
||||
* @param aLayerName The new layer name
|
||||
* @return bool - true if aLayerName was legal and unique among other
|
||||
* layer names at other layer indices and aLayerIndex was within range, else false.
|
||||
* layer names at other layer indices and aLayer was within range, else false.
|
||||
*/
|
||||
bool SetLayerName( LAYER_NUM aLayerIndex, const wxString& aLayerName );
|
||||
bool SetLayerName( LAYER_NUM aLayer, const wxString& aLayerName );
|
||||
|
||||
/**
|
||||
* Function GetStandardLayerName
|
||||
|
@ -626,23 +626,23 @@ public:
|
|||
|
||||
/**
|
||||
* Function GetLayerType
|
||||
* returns the type of the copper layer given by aLayerIndex.
|
||||
* returns the type of the copper layer given by aLayer.
|
||||
*
|
||||
* @param aLayerIndex A layer index, like LAYER_N_BACK, etc.
|
||||
* @param aLayer A layer index, like LAYER_N_BACK, etc.
|
||||
* @return LAYER_T - the layer type, or LAYER_T(-1) if the
|
||||
* index was out of range.
|
||||
*/
|
||||
LAYER_T GetLayerType( LAYER_NUM aLayerIndex ) const;
|
||||
LAYER_T GetLayerType( LAYER_NUM aLayer ) const;
|
||||
|
||||
/**
|
||||
* Function SetLayerType
|
||||
* changes the type of the layer given by aLayerIndex.
|
||||
* changes the type of the layer given by aLayer.
|
||||
*
|
||||
* @param aLayerIndex A layer index, like LAYER_N_BACK, etc.
|
||||
* @param aLayer A layer index, like LAYER_N_BACK, etc.
|
||||
* @param aLayerType The new layer type.
|
||||
* @return bool - true if aLayerType was legal and aLayerIndex was within range, else false.
|
||||
* @return bool - true if aLayerType was legal and aLayer was within range, else false.
|
||||
*/
|
||||
bool SetLayerType( LAYER_NUM aLayerIndex, LAYER_T aLayerType );
|
||||
bool SetLayerType( LAYER_NUM aLayer, LAYER_T aLayerType );
|
||||
|
||||
/**
|
||||
* Function SetLayerColor
|
||||
|
|
|
@ -186,21 +186,16 @@ void BOARD_DESIGN_SETTINGS::SetVisibleAlls()
|
|||
|
||||
void BOARD_DESIGN_SETTINGS::SetVisibleLayers( LAYER_MSK aMask )
|
||||
{
|
||||
// Although Pcbnew uses only 29, GerbView uses all 32 layers
|
||||
m_VisibleLayers = aMask & m_EnabledLayers & FULL_LAYERS;
|
||||
}
|
||||
|
||||
|
||||
void BOARD_DESIGN_SETTINGS::SetLayerVisibility( LAYER_NUM aLayerIndex, bool aNewState )
|
||||
void BOARD_DESIGN_SETTINGS::SetLayerVisibility( LAYER_NUM aLayer, bool aNewState )
|
||||
{
|
||||
// Altough Pcbnew uses only 29, GerbView uses all 32 layers
|
||||
if( aLayerIndex < 0 || aLayerIndex >= 32 )
|
||||
return;
|
||||
|
||||
if( aNewState && IsLayerEnabled( aLayerIndex ) )
|
||||
m_VisibleLayers |= GetLayerMask( aLayerIndex );
|
||||
if( aNewState && IsLayerEnabled( aLayer ) )
|
||||
m_VisibleLayers |= GetLayerMask( aLayer );
|
||||
else
|
||||
m_VisibleLayers &= ~GetLayerMask( aLayerIndex );
|
||||
m_VisibleLayers &= ~GetLayerMask( aLayer );
|
||||
}
|
||||
|
||||
|
||||
|
@ -245,12 +240,5 @@ void BOARD_DESIGN_SETTINGS::SetEnabledLayers( LAYER_MSK aMask )
|
|||
m_VisibleLayers &= aMask;
|
||||
|
||||
// update m_CopperLayerCount to ensure its consistency with m_EnabledLayers
|
||||
m_CopperLayerCount = 0;
|
||||
|
||||
unsigned shiftMask = aMask;
|
||||
for( LAYER_NUM ii = FIRST_LAYER; aMask && ii < NB_COPPER_LAYERS; ++ii, shiftMask >>= 1 )
|
||||
{
|
||||
if( shiftMask & 1 )
|
||||
m_CopperLayerCount++;
|
||||
}
|
||||
m_CopperLayerCount = LayerMaskCountSet( aMask & ALL_CU_LAYERS);
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ MARKER_PCB::~MARKER_PCB()
|
|||
*/
|
||||
bool MARKER_PCB::IsOnLayer( LAYER_NUM aLayer ) const
|
||||
{
|
||||
return IsValidCopperLayerIndex( aLayer );
|
||||
return IsCopperLayer( aLayer );
|
||||
}
|
||||
|
||||
void MARKER_PCB::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
|
||||
|
|
|
@ -181,21 +181,13 @@ MODULE::~MODULE()
|
|||
void MODULE::DrawAncre( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
|
||||
int dim_ancre, GR_DRAWMODE draw_mode )
|
||||
{
|
||||
int anchor_size = DC->DeviceToLogicalXRel( dim_ancre );
|
||||
|
||||
GRSetDrawMode( DC, draw_mode );
|
||||
|
||||
if( GetBoard()->IsElementVisible( ANCHOR_VISIBLE ) )
|
||||
{
|
||||
EDA_COLOR_T color = g_ColorsSettings.GetItemColor( ANCHOR_VISIBLE );
|
||||
GRLine( panel->GetClipBox(), DC,
|
||||
m_Pos.x - offset.x - anchor_size, m_Pos.y - offset.y,
|
||||
m_Pos.x - offset.x + anchor_size, m_Pos.y - offset.y,
|
||||
0, color );
|
||||
GRLine( panel->GetClipBox(), DC,
|
||||
m_Pos.x - offset.x, m_Pos.y - offset.y - anchor_size,
|
||||
m_Pos.x - offset.x, m_Pos.y - offset.y + anchor_size,
|
||||
0, color );
|
||||
GRDrawAnchor( panel->GetClipBox(), DC, m_Pos.x, m_Pos.y,
|
||||
dim_ancre,
|
||||
g_ColorsSettings.GetItemColor( ANCHOR_VISIBLE ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -229,7 +229,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
|
|||
// layer so we can see pads on paste or solder layer and the size of the
|
||||
// mask
|
||||
if( ( aDraw_mode & GR_ALLOW_HIGHCONTRAST ) &&
|
||||
DisplayOpt.ContrastModeDisplay && screen->m_Active_Layer >= FIRST_NON_COPPER_LAYER )
|
||||
DisplayOpt.ContrastModeDisplay && !IsCopperLayer( screen->m_Active_Layer ) )
|
||||
{
|
||||
if( IsOnLayer( screen->m_Active_Layer ) )
|
||||
{
|
||||
|
|
|
@ -83,33 +83,33 @@ void PCB_LAYER_BOX_SELECTOR::Resync()
|
|||
|
||||
|
||||
// Returns true if the layer id is enabled (i.e. is it should be displayed)
|
||||
bool PCB_LAYER_BOX_SELECTOR::IsLayerEnabled( LAYER_NUM aLayerIndex ) const
|
||||
bool PCB_LAYER_BOX_SELECTOR::IsLayerEnabled( LAYER_NUM aLayer ) const
|
||||
{
|
||||
PCB_BASE_FRAME* pcbFrame = (PCB_BASE_FRAME*) GetParent()->GetParent();
|
||||
BOARD* board = pcbFrame->GetBoard();
|
||||
wxASSERT( board != NULL );
|
||||
|
||||
return board->IsLayerEnabled( aLayerIndex );
|
||||
return board->IsLayerEnabled( aLayer );
|
||||
}
|
||||
|
||||
|
||||
// Returns a color index from the layer id
|
||||
EDA_COLOR_T PCB_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayerIndex ) const
|
||||
EDA_COLOR_T PCB_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayer ) const
|
||||
{
|
||||
PCB_BASE_FRAME* pcbFrame = (PCB_BASE_FRAME*) GetParent()->GetParent();
|
||||
BOARD* board = pcbFrame->GetBoard();
|
||||
wxASSERT( board != NULL );
|
||||
|
||||
return board->GetLayerColor( aLayerIndex );
|
||||
return board->GetLayerColor( aLayer );
|
||||
}
|
||||
|
||||
|
||||
// Returns the name of the layer id
|
||||
wxString PCB_LAYER_BOX_SELECTOR::GetLayerName( LAYER_NUM aLayerIndex ) const
|
||||
wxString PCB_LAYER_BOX_SELECTOR::GetLayerName( LAYER_NUM aLayer ) const
|
||||
{
|
||||
PCB_BASE_FRAME* pcbFrame = (PCB_BASE_FRAME*) GetParent()->GetParent();
|
||||
BOARD* board = pcbFrame->GetBoard();
|
||||
wxASSERT( board != NULL );
|
||||
|
||||
return board->GetLayerName( aLayerIndex );
|
||||
return board->GetLayerName( aLayer );
|
||||
}
|
||||
|
|
|
@ -40,15 +40,15 @@ public:
|
|||
|
||||
// Returns a color index from the layer id
|
||||
// Virtual function
|
||||
EDA_COLOR_T GetLayerColor( LAYER_NUM aLayerIndex ) const;
|
||||
EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const;
|
||||
|
||||
// Returns true if the layer id is enabled (i.e. is it should be displayed)
|
||||
// Virtual function
|
||||
bool IsLayerEnabled( LAYER_NUM aLayerIndex ) const;
|
||||
bool IsLayerEnabled( LAYER_NUM aLayer ) const;
|
||||
|
||||
// Returns the name of the layer id
|
||||
// Virtual function
|
||||
wxString GetLayerName( LAYER_NUM aLayerIndex ) const;
|
||||
wxString GetLayerName( LAYER_NUM aLayer ) const;
|
||||
};
|
||||
|
||||
#endif //CLASS_PCB_PCB_LAYER_BOX_SELECTOR_H
|
||||
|
|
|
@ -163,7 +163,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
|
|||
{
|
||||
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 );
|
||||
LAYER_NUM layer = getDecodedId( cb->GetId() );
|
||||
if( IsValidCopperLayerIndex( layer ) )
|
||||
if( IsCopperLayer( layer ) )
|
||||
{
|
||||
lastCu = row;
|
||||
break;
|
||||
|
@ -176,7 +176,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
|
|||
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 );
|
||||
LAYER_NUM layer = getDecodedId( cb->GetId() );
|
||||
|
||||
if( IsValidCopperLayerIndex( layer ) )
|
||||
if( IsCopperLayer( layer ) )
|
||||
{
|
||||
bool loc_visible = visible;
|
||||
if( force_active_layer_visible && (layer == myframe->getActiveLayer() ) )
|
||||
|
@ -262,36 +262,36 @@ void PCB_LAYER_WIDGET::SyncLayerVisibilities()
|
|||
void PCB_LAYER_WIDGET::ReFill()
|
||||
{
|
||||
BOARD* brd = myframe->GetBoard();
|
||||
LAYER_NUM layer;
|
||||
|
||||
int enabledLayers = brd->GetEnabledLayers();
|
||||
|
||||
ClearLayerRows();
|
||||
|
||||
// show all coppers first, with front on top, back on bottom, then technical layers
|
||||
|
||||
layer = LAYER_N_FRONT;
|
||||
if( enabledLayers & GetLayerMask( layer ) )
|
||||
{
|
||||
AppendLayerRow( LAYER_WIDGET::ROW(
|
||||
brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), _("Front copper layer"), true ) );
|
||||
}
|
||||
|
||||
for( layer = LAYER_N_FRONT-1; layer >= 1; --layer )
|
||||
for( LAYER_NUM layer = LAYER_N_FRONT; layer >= FIRST_LAYER; --layer )
|
||||
{
|
||||
if( enabledLayers & GetLayerMask( layer ) )
|
||||
{
|
||||
const wxChar *dsc;
|
||||
switch( layer )
|
||||
{
|
||||
case LAYER_N_FRONT:
|
||||
dsc = _("Front copper layer");
|
||||
break;
|
||||
|
||||
case LAYER_N_BACK:
|
||||
dsc = _("Back copper layer");
|
||||
break;
|
||||
|
||||
default:
|
||||
dsc = _("Inner copper layer");
|
||||
break;
|
||||
}
|
||||
|
||||
AppendLayerRow( LAYER_WIDGET::ROW(
|
||||
brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), _("An innner copper layer"), true ) );
|
||||
brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), dsc, true ) );
|
||||
}
|
||||
}
|
||||
|
||||
layer = LAYER_N_BACK;
|
||||
if( enabledLayers & GetLayerMask( layer ) )
|
||||
{
|
||||
AppendLayerRow( LAYER_WIDGET::ROW(
|
||||
brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), _("Back copper layer"), true ) );
|
||||
}
|
||||
|
||||
// technical layers are shown in this order:
|
||||
static const struct {
|
||||
|
@ -315,7 +315,7 @@ void PCB_LAYER_WIDGET::ReFill()
|
|||
|
||||
for( unsigned i=0; i<DIM(techLayerSeq); ++i )
|
||||
{
|
||||
layer = techLayerSeq[i].layerId;
|
||||
LAYER_NUM layer = techLayerSeq[i].layerId;
|
||||
|
||||
if( !(enabledLayers & GetLayerMask( layer )) )
|
||||
continue;
|
||||
|
|
|
@ -288,14 +288,8 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
|
|||
if( brd->IsElementVisible( ANCHOR_VISIBLE ) )
|
||||
{
|
||||
EDA_COLOR_T anchor_color = brd->GetVisibleElementColor(ANCHOR_VISIBLE);
|
||||
int anchor_size = DC->DeviceToLogicalXRel( 2 );
|
||||
|
||||
GRLine( panel->GetClipBox(), DC,
|
||||
pos.x - anchor_size, pos.y,
|
||||
pos.x + anchor_size, pos.y, 0, anchor_color );
|
||||
GRLine( panel->GetClipBox(), DC,
|
||||
pos.x, pos.y - anchor_size,
|
||||
pos.x, pos.y + anchor_size, 0, anchor_color );
|
||||
GRDrawAnchor( panel->GetClipBox(), DC, pos.x, pos.y,
|
||||
DIM_ANCRE_TEXTE, anchor_color );
|
||||
}
|
||||
|
||||
// Draw the text proper, with the right attributes
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
static bool ShowClearance( const TRACK* aTrack )
|
||||
{
|
||||
// maybe return true for tracks and vias, not for zone segments
|
||||
return aTrack->GetLayer() <= LAST_COPPER_LAYER
|
||||
return IsCopperLayer( aTrack->GetLayer() )
|
||||
&& ( aTrack->Type() == PCB_TRACE_T || aTrack->Type() == PCB_VIA_T )
|
||||
&& ( ( DisplayOpt.ShowTrackClearanceMode == SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS
|
||||
&& ( aTrack->IsDragging() || aTrack->IsMoving() || aTrack->IsNew() ) )
|
||||
|
@ -87,7 +87,8 @@ inline bool IsNear( wxPoint& p1, wxPoint& p2, int max_dist )
|
|||
}
|
||||
|
||||
|
||||
TRACK* GetTrace( TRACK* aStartTrace, TRACK* aEndTrace, const wxPoint& aPosition, LAYER_MSK aLayerMask )
|
||||
TRACK* GetTrace( TRACK* aStartTrace, TRACK* aEndTrace, const wxPoint& aPosition,
|
||||
LAYER_MSK aLayerMask )
|
||||
{
|
||||
TRACK* PtSegm;
|
||||
|
||||
|
@ -389,14 +390,8 @@ void TRACK::Flip( const wxPoint& aCentre )
|
|||
m_Start.y = aCentre.y - (m_Start.y - aCentre.y);
|
||||
m_End.y = aCentre.y - (m_End.y - aCentre.y);
|
||||
|
||||
if( Type() == PCB_VIA_T )
|
||||
{
|
||||
// Huh? Wouldn't it be better to us Type() != VIA and get rid of these brackets?
|
||||
}
|
||||
else
|
||||
{
|
||||
if( Type() != PCB_VIA_T )
|
||||
SetLayer( FlipLayer( GetLayer() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -406,10 +401,6 @@ SEARCH_RESULT TRACK::Visit( INSPECTOR* inspector, const void* testData,
|
|||
{
|
||||
KICAD_T stype = *scanTypes;
|
||||
|
||||
#if 0 && defined(DEBUG)
|
||||
std::cout << GetClass().mb_str() << ' ';
|
||||
#endif
|
||||
|
||||
// If caller wants to inspect my type
|
||||
if( stype == Type() )
|
||||
{
|
||||
|
|
|
@ -156,13 +156,15 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::initDlg( )
|
|||
|
||||
PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness );
|
||||
|
||||
for( LAYER_NUM layer=FIRST_NON_COPPER_LAYER; layer <= LAST_NON_COPPER_LAYER; ++layer )
|
||||
for( LAYER_NUM layer = FIRST_NON_COPPER_LAYER;
|
||||
layer <= LAST_NON_COPPER_LAYER; ++layer )
|
||||
{
|
||||
m_LayerSelectionCtrl->Append( m_parent->GetBoard()->GetLayerName( layer ) );
|
||||
}
|
||||
|
||||
LAYER_NUM layer = m_Item->GetLayer();
|
||||
// Control:
|
||||
|
||||
// It has to be an aux layer
|
||||
if ( layer < FIRST_NON_COPPER_LAYER )
|
||||
layer = FIRST_NON_COPPER_LAYER;
|
||||
if ( layer > LAST_NON_COPPER_LAYER )
|
||||
|
|
|
@ -196,10 +196,10 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
LAYER_NUM layer = m_layerId[idx];
|
||||
if( IsValidCopperLayerIndex( layer ) )
|
||||
if( IsCopperLayer( layer ) )
|
||||
{
|
||||
/* an edge is put on a copper layer, and it is very dangerous. a
|
||||
*confirmation is requested */
|
||||
/* an edge is put on a copper layer: this it is very dangerous. a
|
||||
* confirmation is requested */
|
||||
if( !IsOK( NULL,
|
||||
_( "The graphic item will be on a copper layer. This is very dangerous. Are you sure?" ) ) )
|
||||
return;
|
||||
|
|
|
@ -580,7 +580,7 @@ wxString DIALOG_LAYERS_SETUP::getLayerName( LAYER_NUM aLayer )
|
|||
{
|
||||
wxString ret;
|
||||
|
||||
wxASSERT( aLayer >= FIRST_COPPER_LAYER && aLayer <= LAST_COPPER_LAYER );
|
||||
wxASSERT( IsCopperLayer( aLayer ) );
|
||||
|
||||
wxTextCtrl* ctl = (wxTextCtrl*) getName( aLayer );
|
||||
|
||||
|
|
|
@ -1475,7 +1475,7 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics )
|
|||
ERECT r( gr->second );
|
||||
LAYER_NUM layer = kicad_layer( r.layer );
|
||||
|
||||
if( IsValidCopperLayerIndex( layer ) )
|
||||
if( IsCopperLayer( layer ) )
|
||||
{
|
||||
// use a "netcode = 0" type ZONE:
|
||||
ZONE_CONTAINER* zone = new ZONE_CONTAINER( m_board );
|
||||
|
@ -1910,7 +1910,7 @@ void EAGLE_PLUGIN::packageWire( MODULE* aModule, CPTREE& aTree ) const
|
|||
EWIRE w( aTree );
|
||||
LAYER_NUM layer = kicad_layer( w.layer );
|
||||
|
||||
if( IsValidNonCopperLayerIndex( layer ) ) // skip copper package wires
|
||||
if( IsNonCopperLayer( layer ) ) // skip copper package wires
|
||||
{
|
||||
wxPoint start( kicad_x( w.x1 ), kicad_y( w.y1 ) );
|
||||
wxPoint end( kicad_x( w.x2 ), kicad_y( w.y2 ) );
|
||||
|
@ -2120,7 +2120,7 @@ void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, CPTREE& aTree ) const
|
|||
ERECT r( aTree );
|
||||
LAYER_NUM layer = kicad_layer( r.layer );
|
||||
|
||||
if( IsValidNonCopperLayerIndex( layer ) ) // skip copper "package.rectangle"s
|
||||
if( IsNonCopperLayer( layer ) ) // skip copper "package.rectangle"s
|
||||
{
|
||||
EDGE_MODULE* dwg = new EDGE_MODULE( aModule, S_POLYGON );
|
||||
aModule->GraphicalItems().PushBack( dwg );
|
||||
|
@ -2153,7 +2153,7 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, CPTREE& aTree ) const
|
|||
EPOLYGON p( aTree );
|
||||
LAYER_NUM layer = kicad_layer( p.layer );
|
||||
|
||||
if( IsValidNonCopperLayerIndex( layer ) ) // skip copper "package.rectangle"s
|
||||
if( IsNonCopperLayer( layer ) ) // skip copper "package.rectangle"s
|
||||
{
|
||||
EDGE_MODULE* dwg = new EDGE_MODULE( aModule, S_POLYGON );
|
||||
aModule->GraphicalItems().PushBack( dwg );
|
||||
|
@ -2259,7 +2259,7 @@ void EAGLE_PLUGIN::packageSMD( MODULE* aModule, CPTREE& aTree ) const
|
|||
ESMD e( aTree );
|
||||
LAYER_NUM layer = kicad_layer( e.layer );
|
||||
|
||||
if( !IsValidCopperLayerIndex( layer ) )
|
||||
if( !IsCopperLayer( layer ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -2351,7 +2351,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
|
|||
EWIRE w( it->second );
|
||||
LAYER_NUM layer = kicad_layer( w.layer );
|
||||
|
||||
if( IsValidCopperLayerIndex( layer ) )
|
||||
if( IsCopperLayer( layer ) )
|
||||
{
|
||||
TRACK* t = new TRACK( m_board );
|
||||
|
||||
|
@ -2386,8 +2386,8 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
|
|||
LAYER_NUM layer_front_most = kicad_layer( v.layer_front_most );
|
||||
LAYER_NUM layer_back_most = kicad_layer( v.layer_back_most );
|
||||
|
||||
if( IsValidCopperLayerIndex( layer_front_most ) &&
|
||||
IsValidCopperLayerIndex( layer_back_most ) )
|
||||
if( IsCopperLayer( layer_front_most ) &&
|
||||
IsCopperLayer( layer_back_most ) )
|
||||
{
|
||||
int kidiam;
|
||||
int drillz = kicad( v.drill );
|
||||
|
@ -2464,7 +2464,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
|
|||
EPOLYGON p( it->second );
|
||||
LAYER_NUM layer = kicad_layer( p.layer );
|
||||
|
||||
if( IsValidCopperLayerIndex( layer ) )
|
||||
if( IsCopperLayer( layer ) )
|
||||
{
|
||||
// use a "netcode = 0" type ZONE:
|
||||
ZONE_CONTAINER* zone = new ZONE_CONTAINER( m_board );
|
||||
|
|
|
@ -202,7 +202,7 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* aEdge )
|
|||
if( new_layer < 0 )
|
||||
return;
|
||||
|
||||
if( IsValidCopperLayerIndex( new_layer ) )
|
||||
if( IsCopperLayer( new_layer ) )
|
||||
{
|
||||
/* an edge is put on a copper layer, and it is very dangerous. a
|
||||
*confirmation is requested */
|
||||
|
|
|
@ -1248,7 +1248,7 @@ void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, LAYER_NUM layer )
|
|||
|
||||
// Copper layers cannot be selected unconditionally; how many
|
||||
// of those layers are currently enabled needs to be checked.
|
||||
if( IsValidCopperLayerIndex( layer ) )
|
||||
if( IsCopperLayer( layer ) )
|
||||
{
|
||||
// If only one copper layer is enabled, the only such layer
|
||||
// that can be selected to is the "Back" layer (so the
|
||||
|
|
|
@ -243,7 +243,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
if( GetToolId() == ID_PCB_ARC_BUTT )
|
||||
shape = S_ARC;
|
||||
|
||||
if( getActiveLayer() <= LAST_COPPER_LAYER )
|
||||
if( IsCopperLayer( getActiveLayer() ) )
|
||||
{
|
||||
DisplayError( this, _( "Graphic not authorized on Copper layers" ) );
|
||||
break;
|
||||
|
@ -267,7 +267,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
break;
|
||||
|
||||
case ID_TRACK_BUTT:
|
||||
if( getActiveLayer() > LAST_COPPER_LAYER )
|
||||
if( !IsCopperLayer( getActiveLayer() ) )
|
||||
{
|
||||
DisplayError( this, _( "Tracks on Copper layers only " ) );
|
||||
break;
|
||||
|
@ -366,7 +366,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
break;
|
||||
|
||||
case ID_PCB_DIMENSION_BUTT:
|
||||
if( getActiveLayer() <= LAST_COPPER_LAYER )
|
||||
if( IsCopperLayer( getActiveLayer() ) )
|
||||
{
|
||||
DisplayError( this, _( "Dimension not authorized on Copper layers" ) );
|
||||
break;
|
||||
|
|
|
@ -204,7 +204,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
|||
AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_DRAWING,
|
||||
_( "Delete Drawing" ), KiBitmap( delete_xpm ) );
|
||||
|
||||
if( item->GetLayer() > LAST_COPPER_LAYER )
|
||||
if( !IsCopperLayer( item->GetLayer() ) )
|
||||
AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_DRAWING_LAYER,
|
||||
_( "Delete All Drawings on Layer" ), KiBitmap( delete_xpm ) );
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ void PCB_ARC::Flip()
|
|||
|
||||
void PCB_ARC::AddToModule( MODULE* aModule )
|
||||
{
|
||||
if( IsValidNonCopperLayerIndex( m_KiCadLayer ) )
|
||||
if( IsNonCopperLayer( m_KiCadLayer ) )
|
||||
{
|
||||
EDGE_MODULE* arc = new EDGE_MODULE( aModule, S_ARC );
|
||||
aModule->GraphicalItems().PushBack( arc );
|
||||
|
|
|
@ -116,7 +116,7 @@ void PCB_LINE::Flip()
|
|||
|
||||
void PCB_LINE::AddToModule( MODULE* aModule )
|
||||
{
|
||||
if( IsValidNonCopperLayerIndex( m_KiCadLayer ) )
|
||||
if( IsNonCopperLayer( m_KiCadLayer ) )
|
||||
{
|
||||
EDGE_MODULE* segment = new EDGE_MODULE( aModule, S_SEGMENT );
|
||||
aModule->GraphicalItems().PushBack( segment );
|
||||
|
@ -134,7 +134,7 @@ void PCB_LINE::AddToModule( MODULE* aModule )
|
|||
|
||||
void PCB_LINE::AddToBoard()
|
||||
{
|
||||
if( IsValidCopperLayerIndex( m_KiCadLayer ) )
|
||||
if( IsCopperLayer( m_KiCadLayer ) )
|
||||
{
|
||||
TRACK* track = new TRACK( m_board );
|
||||
m_board->m_Track.Append( track );
|
||||
|
|
|
@ -319,7 +319,7 @@ void PCB_PAD::AddToBoard()
|
|||
if( width == 0 || height == 0 )
|
||||
THROW_IO_ERROR( wxT( "pad or via with zero size" ) );
|
||||
|
||||
if( IsValidCopperLayerIndex( m_KiCadLayer ) )
|
||||
if( IsCopperLayer( m_KiCadLayer ) )
|
||||
{
|
||||
SEGVIA* via = new SEGVIA( m_board );
|
||||
m_board->m_Track.Append( via );
|
||||
|
|
|
@ -29,8 +29,7 @@
|
|||
#define FLG_START 0 // Flag used in locate routines
|
||||
#define FLG_END 1 // Flag used in locate routines
|
||||
|
||||
#define DIM_ANCRE_MODULE 3 /* Anchor size (footprint center) */
|
||||
#define DIM_ANCRE_TEXTE 2 /* Anchor size (Text center) */
|
||||
#define DIM_ANCRE_MODULE 3 // Anchor size (footprint center)
|
||||
|
||||
|
||||
#define TEXTS_MIN_SIZE DMils2iu( 50 ) ///< Minimum text size in Pcbnew units value (50 * 0.0001 mils)
|
||||
|
|
|
@ -291,7 +291,7 @@ void WinEDA_SwapLayerFrame::Sel_Layer( wxCommandEvent& event )
|
|||
|
||||
jj = m_Parent->SelectLayer( jj, UNDEFINED_LAYER, UNDEFINED_LAYER, true );
|
||||
|
||||
if( (jj < FIRST_LAYER) || (jj > NB_PCB_LAYERS) )
|
||||
if( !IsValidLayer( jj ) )
|
||||
return;
|
||||
|
||||
// No change if the selected layer matches the layer being edited.
|
||||
|
|
|
@ -62,7 +62,7 @@ bool BOARD::OnAreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList,
|
|||
CombineAllAreasInNet( aModifiedZonesList, modified_area->GetNet(), true );
|
||||
}
|
||||
|
||||
if( layer >= FIRST_NON_COPPER_LAYER ) // Refill non copper zones on this layer
|
||||
if( !IsCopperLayer( layer ) ) // Refill non copper zones on this layer
|
||||
{
|
||||
for( unsigned ia = 0; ia < m_ZoneDescriptorList.size(); ia++ )
|
||||
if( m_ZoneDescriptorList[ia]->GetLayer() == layer )
|
||||
|
|
Loading…
Reference in New Issue