Commit 204d085b authored by Lorenzo Marcantonio's avatar Lorenzo Marcantonio

More cleanup on layer code usage

Better description for entities on right click menu and panel
Typo fixes and some comment reformats
parent 9ebb4afa
......@@ -26,6 +26,7 @@
// For some unknown reasons, polygon.hpp shoul be included first
#include <boost/polygon/polygon.hpp>
#include <wx/wx.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
......
......@@ -108,7 +108,7 @@ void BLOCK_SELECTOR::SetMessageBlock( EDA_DRAW_FRAME* frame )
break;
default:
msg = wxT( "????" );
msg = wxT( "???" );
break;
}
......
......@@ -51,7 +51,7 @@
* parameter
*/
#define HERSHEY_SCALE_FACTOR 1 / 21.0
double s_HerscheyScaleFactor = HERSHEY_SCALE_FACTOR;
double s_HersheyScaleFactor = HERSHEY_SCALE_FACTOR;
/* Helper function for texts with over bar
......@@ -186,7 +186,7 @@ int ReturnGraphicTextWidth( const wxString& aText, int aXSize, bool aItalic, boo
// Get metrics
int xsta = *shape_ptr++ - 'R';
int xsto = *shape_ptr++ - 'R';
tally += KiROUND( aXSize * (xsto - xsta) * s_HerscheyScaleFactor );
tally += KiROUND( aXSize * (xsto - xsta) * s_HersheyScaleFactor );
}
// For italic correction, add 1/8 size
......@@ -429,10 +429,8 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
overbar_italic_comp = 0;
}
;
int overbars = 0; /* Number of '~' seen (except '~~') */
ptr = 0; /* ptr = text index */
int overbars = 0; // Number of '~' seen (except '~~')
ptr = 0; // ptr = text index
while( ptr < char_count )
{
......@@ -444,7 +442,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
else
{
/* Found an overbar, adjust the pointers */
// Found an overbar, adjust the pointers
overbars++;
if( overbars & 1 ) // odd overbars count
......@@ -469,7 +467,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
sketch_mode, 2, coord, aCallback, aPlotter );
}
continue; /* Skip ~ processing */
continue; // Skip ~ processing
}
}
......@@ -504,7 +502,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
hc1 -= 'R';
hc2 -= 'R';
/* Pen up request */
// Pen up request
if( hc1 == -50 && hc2 == 0 )
{
if( point_count )
......@@ -523,8 +521,8 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
{
wxPoint currpoint;
hc1 -= xsta; hc2 -= 11; // Align the midpoint
hc1 = KiROUND( hc1 * size_h * s_HerscheyScaleFactor );
hc2 = KiROUND( hc2 * size_v * s_HerscheyScaleFactor );
hc1 = KiROUND( hc1 * size_h * s_HersheyScaleFactor );
hc2 = KiROUND( hc2 * size_v * s_HersheyScaleFactor );
// To simulate an italic font,
// add a x offset depending on the y offset
......@@ -545,18 +543,19 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
ptr++;
// Apply the advance width
current_char_pos.x += KiROUND( size_h * (xsto - xsta) * s_HerscheyScaleFactor );
current_char_pos.x += KiROUND( size_h * (xsto - xsta) * s_HersheyScaleFactor );
}
if( overbars % 2 )
{
/* Close the last overbar */
// Close the last overbar
coord[0] = overbar_pos;
overbar_pos = current_char_pos;
overbar_pos.y -= OverbarPositionY( size_v, aWidth );
RotatePoint( &overbar_pos, aPos, aOrient );
coord[1] = overbar_pos;
/* Plot the overbar segment */
// Plot the overbar segment
DrawGraphicTextPline( clipBox, aDC, aColor, aWidth,
sketch_mode, 2, coord, aCallback, aPlotter );
}
......
......@@ -34,6 +34,7 @@
#include <pcbcommon.h>
#include <plot_common.h>
#include <class_board.h>
#include <class_pad.h>
#include <class_zone_settings.h>
#include <class_board_design_settings.h>
......@@ -52,7 +53,7 @@ LAYER_MSK g_TabAllCopperLayerMask[NB_COPPER_LAYERS] = {
};
DISPLAY_OPTIONS DisplayOpt; /* Display options for board items */
DISPLAY_OPTIONS DisplayOpt; // Display options for board items
int g_RotationAngle;
......@@ -184,3 +185,44 @@ LAYER_NUM ExtractLayer( LAYER_MSK aMask )
}
return candidate;
}
wxString LayerMaskDescribe( const BOARD *aBoard, LAYER_MSK aMask )
{
// Try the single or no- layer case (easy)
LAYER_NUM layer = ExtractLayer( aMask );
switch( layer )
{
case UNSELECTED_LAYER:
return _( "No layers" );
case UNDEFINED_LAYER:
break;
default:
return aBoard->GetLayerName( layer );
}
// Try to be smart and useful, starting with outer copper
// (which are more important than internal ones)
wxString layerInfo;
if( aMask & LAYER_FRONT )
AccumulateDescription( layerInfo, aBoard->GetLayerName( LAYER_N_FRONT ) );
if( aMask & LAYER_BACK )
AccumulateDescription( layerInfo, aBoard->GetLayerName( LAYER_N_BACK ) );
if( aMask & INTERNAL_CU_LAYERS )
AccumulateDescription( layerInfo, _("Internal" ) );
if( aMask & ALL_NO_CU_LAYERS )
AccumulateDescription( layerInfo, _("Non-copper" ) );
return layerInfo;
}
void AccumulateDescription( wxString &aDesc, const wxString &aItem )
{
if( !aDesc.IsEmpty() )
aDesc << wxT(", ");
aDesc << aItem;
}
......@@ -179,7 +179,7 @@ const wxChar* MsgPinElectricType[] =
wxT( "openCol" ),
wxT( "openEm" ),
wxT( "NotConnected" ),
wxT( "?????" )
wxT( "???" )
};
......@@ -1852,7 +1852,7 @@ void LIB_PIN::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), Text, DARKGREEN ) );
/* Display pin length */
// Display pin length
Text = ReturnStringFromValue( g_UserUnit, m_length, true );
aList.push_back( MSG_PANEL_ITEM( _( "Length" ), Text, MAGENTA ) );
......
......@@ -49,7 +49,7 @@ const wxChar* NameMarqueurType[] =
wxT( "ERC" ),
wxT( "PCB" ),
wxT( "SIMUL" ),
wxT( "?????" )
wxT( "???" )
};
......
......@@ -57,7 +57,7 @@ const char* SheetLabelType[] =
"BiDi",
"3State",
"UnSpc",
"?????"
"???"
};
/* Coding polygons for global symbol graphic shapes.
......
......@@ -395,7 +395,7 @@ void GBR_TO_PCB_EXPORTER::writePcbHeader()
// Write copper layer count
fprintf( m_fp, "LayerCount %d\n", m_pcbCopperLayersCount );
// Write enabled layer mask:
int lmask = ALL_NO_CU_LAYERS | EXTERNAL_LAYERS;
int lmask = ALL_NO_CU_LAYERS | EXTERNAL_CU_LAYERS;
for( int ii = 0; ii < m_pcbCopperLayersCount - 2; ii++ )
lmask |= 2 << ii;
......
......@@ -30,6 +30,8 @@
#ifndef _LAYERS_ID_AND_VISIBILITY_H_
#define _LAYERS_ID_AND_VISIBILITY_H_
class BOARD;
/* NOTE: the idea here is to have LAYER_NUM and LAYER_MSK as abstract
* type as possible (even if they're currently implemented as int and
* unsigned int, respectively). In this way it would be reasonably easy
......@@ -117,19 +119,24 @@ typedef unsigned LAYER_MSK;
#define EDGE_LAYER (1 << EDGE_N)
// extra bits 0xE0000000
/* Helpful global layers mask : */
// Helpful global layer masks:
// ALL_AUX_LAYERS layers are technical layers, ALL_NO_CU_LAYERS has user
// and edge layers too!
#define ALL_LAYERS 0x1FFFFFFF // Pcbnew used 29 layers
#define FULL_LAYERS 0xFFFFFFFF // Gerbview used 32 layers
#define ALL_NO_CU_LAYERS 0x1FFF0000
#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 INTERNAL_CU_LAYERS 0x00007FFE
#define EXTERNAL_CU_LAYERS 0x00008001
#define FRONT_AUX_LAYERS (SILKSCREEN_LAYER_FRONT | SOLDERMASK_LAYER_FRONT \
| ADHESIVE_LAYER_FRONT | SOLDERPASTE_LAYER_FRONT)
#define BACK_AUX_LAYERS (SILKSCREEN_LAYER_BACK | SOLDERMASK_LAYER_BACK \
| ADHESIVE_LAYER_BACK | SOLDERPASTE_LAYER_BACK)
#define ALL_AUX_LAYERS (FRONT_AUX_LAYERS | BACK_AUX_LAYERS)
#define BACK_LAYERS (LAYER_BACK | BACK_AUX_LAYERS)
#define FRONT_LAYERS (LAYER_FRONT | FRONT_AUX_LAYERS)
#define NO_LAYERS 0x00000000
/** return a one bit layer mask from a layer number
......@@ -297,4 +304,11 @@ LAYER_MSK FlipLayerMask( LAYER_MSK aMask );
*/
LAYER_NUM ExtractLayer( LAYER_MSK aMask );
/**
* Return a string (to be shown to the user) describing a layer mask.
* Useful for showing where is a pad, track, entity, etc.
* The BOARD is needed because layer names are (somewhat) customizable
*/
wxString LayerMaskDescribe( const BOARD *aBoard, LAYER_MSK aMask );
#endif // _LAYERS_ID_AND_VISIBILITY_H_
......@@ -34,5 +34,7 @@ extern DLIST<TRACK> g_CurrentTrackList;
#define g_FirstTrackSegment g_CurrentTrackList.GetFirst() ///< first segment created
/// Utility for comma separated lists
void AccumulateDescription( wxString &aDesc, const wxString &aItem );
#endif // PCBCOMMON_H_
......@@ -697,12 +697,18 @@ EDA_COLOR_T BOARD::GetLayerColor( LAYER_NUM aLayer ) const
bool BOARD::IsModuleLayerVisible( LAYER_NUM layer )
{
if( layer==LAYER_N_FRONT )
switch( layer )
{
case LAYER_N_FRONT:
return IsElementVisible( PCB_VISIBLE(MOD_FR_VISIBLE) );
else if( layer==LAYER_N_BACK )
case LAYER_N_BACK:
return IsElementVisible( PCB_VISIBLE(MOD_BK_VISIBLE) );
else
default:
wxFAIL_MSG( wxT( "BOARD::IsModuleLayerVisible() param error: bad layer" ) );
return true;
}
}
......@@ -2023,10 +2029,10 @@ MODULE* BOARD::GetFootprint( const wxPoint& aPosition, LAYER_NUM aActiveLayer,
{
MODULE* pt_module;
MODULE* module = NULL;
MODULE* Altmodule = NULL;
MODULE* alt_module = NULL;
int min_dim = 0x7FFFFFFF;
int alt_min_dim = 0x7FFFFFFF;
LAYER_NUM layer;
bool current_layer_back = IsBackLayer( aActiveLayer );
for( pt_module = m_Modules; pt_module; pt_module = (MODULE*) pt_module->Next() )
{
......@@ -2038,35 +2044,24 @@ MODULE* BOARD::GetFootprint( const wxPoint& aPosition, LAYER_NUM aActiveLayer,
if( aIgnoreLocked && pt_module->IsLocked() )
continue;
/* Calculate priority: the priority is given to the layer of the
* module and the copper layer if the module layer is indelible,
* adhesive copper, a layer if cmp module layer is indelible,
* adhesive component.
*/
layer = pt_module->GetLayer();
if( layer==ADHESIVE_N_BACK || layer==SILKSCREEN_N_BACK )
layer = LAYER_N_BACK;
else if( layer==ADHESIVE_N_FRONT || layer==SILKSCREEN_N_FRONT )
layer = LAYER_N_FRONT;
/* Test of minimum size to choosing the best candidate. */
LAYER_NUM layer = pt_module->GetLayer();
// Filter non visible modules if requested
if( (!aVisibleOnly) || IsModuleLayerVisible( layer ) )
{
EDA_RECT bb = pt_module->GetFootPrintRect();
int offx = bb.GetX() + bb.GetWidth() / 2;
int offy = bb.GetY() + bb.GetHeight() / 2;
//off x & offy point to the middle of the box.
int dist = abs( aPosition.x - offx ) + abs( aPosition.y - offy );
//int dist = std::min(lx, ly); // to pick the smallest module (kinda
// screwy with same-sized modules -- this is bad!)
// off x & offy point to the middle of the box.
int dist = ( aPosition.x - offx ) * ( aPosition.x - offx ) +
( aPosition.y - offy ) * ( aPosition.y - offy );
if( aActiveLayer == layer )
if( current_layer_back == IsBackLayer( layer ) )
{
if( dist <= min_dim )
{
/* better footprint shown on the active layer */
// better footprint shown on the active side
module = pt_module;
min_dim = dist;
}
......@@ -2075,21 +2070,22 @@ MODULE* BOARD::GetFootprint( const wxPoint& aPosition, LAYER_NUM aActiveLayer,
{
if( dist <= alt_min_dim )
{
/* better footprint shown on other layers */
Altmodule = pt_module;
// better footprint shown on the other side
alt_module = pt_module;
alt_min_dim = dist;
}
}
}
}
if( module )
{
return module;
}
if( Altmodule )
if( alt_module)
{
return Altmodule;
return alt_module;
}
return NULL;
......
......@@ -490,7 +490,8 @@ wxString DIMENSION::GetSelectMenuText() const
{
wxString text;
text << _( "Dimension" ) << wxT( " \"" ) << GetText() << wxT( "\"" );
text << _( "Dimension" ) << wxT( " \"" ) << GetText() << wxT( "\" on " )
<< GetLayerName();
return text;
}
......
......@@ -356,7 +356,7 @@ void DRAWSEGMENT::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
end << GetEnd();
aList.push_back( MSG_PANEL_ITEM( start, end, DARKGREEN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), board->GetLayerName( m_Layer ), DARKBROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), DARKBROWN ) );
msg = ::CoordinateToString( m_Width );
aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, DARKCYAN ) );
}
......@@ -534,7 +534,7 @@ wxString DRAWSEGMENT::GetSelectMenuText() const
wxString text;
wxString temp = ::LengthDoubleToString( GetLength() );
text.Printf( _( "Pcb Graphic: %s length: %s on %s" ),
text.Printf( _( "Pcb Graphic: %s, length %s on %s" ),
GetChars( ShowShape( (STROKE_T) m_Shape ) ),
GetChars( temp ), GetChars( GetLayerName() ) );
......
......@@ -250,9 +250,10 @@ void EDGE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Value" ), module->GetValue(), BLUE ) );
msg.Printf( wxT( "%8.8lX" ), module->GetTimeStamp() );
aList.push_back( MSG_PANEL_ITEM( _( "TimeStamp" ), msg, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Mod Layer" ), board->GetLayerName( module->GetLayer() ),
RED ) );
aList.push_back( MSG_PANEL_ITEM( _( "Seg Layer" ), board->GetLayerName( GetLayer() ), RED ) );
aList.push_back( MSG_PANEL_ITEM( _( "Mod Layer" ),
module->GetLayerName(), RED ) );
aList.push_back( MSG_PANEL_ITEM( _( "Seg Layer" ),
GetLayerName(), RED ) );
msg = ::CoordinateToString( m_Width );
aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, BLUE ) );
}
......@@ -264,7 +265,7 @@ wxString EDGE_MODULE::GetSelectMenuText() const
wxString text;
text << _( "Graphic" ) << wxT( " " ) << ShowShape( (STROKE_T) m_Shape );
text << wxT( " (" ) << GetLayerName() << wxT( ")" );
text << wxT( " on " ) << GetLayerName();
text << _( " of " ) << ( (MODULE*) GetParent() )->GetReference();
return text;
......
......@@ -217,8 +217,8 @@ wxString PCB_TARGET::GetSelectMenuText() const
msg = ::CoordinateToString( m_Size );
text.Printf( _( "Target on %s size %s" ),
GetChars( GetLayerName() ), GetChars( msg ) );
// Targets are on *every* layer by definition
text.Printf( _( "Target size %s" ), GetChars( msg ) );
return text;
}
......
......@@ -72,9 +72,9 @@ MODULE::MODULE( BOARD* parent ) :
m_ThermalWidth = 0; // Use zone setting by default
m_ThermalGap = 0; // Use zone setting by default
m_Reference = new TEXTE_MODULE( this, TEXT_is_REFERENCE );
m_Reference = new TEXTE_MODULE( this, TEXTE_MODULE::TEXT_is_REFERENCE );
m_Value = new TEXTE_MODULE( this, TEXT_is_VALUE );
m_Value = new TEXTE_MODULE( this, TEXTE_MODULE::TEXT_is_VALUE );
// Reserve one void 3D entry, to avoid problems with void list
m_3D_Drawings.PushBack( new S3D_MASTER( this ) );
......@@ -440,7 +440,6 @@ void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
int nbpad;
char bufcar[512], Line[512];
wxString msg;
BOARD* board = GetBoard();
aList.push_back( MSG_PANEL_ITEM( m_Reference->GetText(), m_Value->GetText(), DARKCYAN ) );
......@@ -458,7 +457,7 @@ void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
// display time stamp in schematic
msg.Printf( wxT( "%8.8lX" ), m_TimeStamp );
aList.push_back( MSG_PANEL_ITEM( _( "Netlist path" ), m_Path, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), board->GetLayerName( m_Layer ), RED ) );
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), RED ) );
EDA_ITEM* PtStruct = m_Pads;
nbpad = 0;
......@@ -485,7 +484,7 @@ void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
msg.Printf( wxT( "%.1f" ), (float) m_Orient / 10 );
aList.push_back( MSG_PANEL_ITEM( _( "Orient" ), msg, BROWN ) );
/* Controls on right side of the dialog */
// Controls on right side of the dialog
switch( m_Attributs & 255 )
{
case 0:
......@@ -684,7 +683,7 @@ wxString MODULE::GetSelectMenuText() const
wxString text;
text << _( "Footprint" ) << wxT( " " ) << GetReference();
text << wxT( " (" ) << GetLayerName() << wxT( ")" );
text << wxT( " on " ) << GetLayerName();
return text;
}
......@@ -771,22 +770,12 @@ void MODULE::Flip( const wxPoint& aCentre )
// Mirror reference.
text = m_Reference;
text->m_Pos.y -= m_Pos.y;
text->m_Pos.y = -text->m_Pos.y;
NEGATE( text->m_Pos.y );
text->m_Pos.y += m_Pos.y;
NEGATE(text->m_Pos0.y);
text->m_Mirror = false;
NEGATE_AND_NORMALIZE_ANGLE_POS( text->m_Orient );
text->SetLayer( GetLayer() );
text->SetLayer( FlipLayer( text->GetLayer() ) );
if( GetLayer() == LAYER_N_BACK )
text->SetLayer( SILKSCREEN_N_BACK );
if( GetLayer() == LAYER_N_FRONT )
text->SetLayer( SILKSCREEN_N_FRONT );
if( IsBackLayer( GetLayer() ) )
text->m_Mirror = true;
text->m_Mirror = IsBackLayer( GetLayer() );
// Mirror value.
text = m_Value;
......@@ -794,19 +783,9 @@ void MODULE::Flip( const wxPoint& aCentre )
NEGATE( text->m_Pos.y );
text->m_Pos.y += m_Pos.y;
NEGATE( text->m_Pos0.y );
text->m_Mirror = false;
NEGATE_AND_NORMALIZE_ANGLE_POS( text->m_Orient );
text->SetLayer( GetLayer() );
text->SetLayer( FlipLayer( text->GetLayer() ) );
if( GetLayer() == LAYER_N_BACK )
text->SetLayer( SILKSCREEN_N_BACK );
if( GetLayer() == LAYER_N_FRONT )
text->SetLayer( SILKSCREEN_N_FRONT );
if( IsBackLayer( GetLayer() ) )
text->m_Mirror = true;
text->m_Mirror = IsBackLayer( GetLayer() );
// Reverse mirror module graphics and texts.
for( EDA_ITEM* item = m_Drawings; item; item = item->Next() )
......@@ -842,27 +821,14 @@ void MODULE::Flip( const wxPoint& aCentre )
break;
case PCB_MODULE_TEXT_T:
// Reverse mirror position and mirror.
text = (TEXTE_MODULE*) item;
text->m_Pos.y -= m_Pos.y;
text->m_Pos.y = -text->m_Pos.y;
NEGATE( text->m_Pos0.y );
text->m_Pos.y += m_Pos.y;
NEGATE( text->m_Pos0.y );
text->m_Mirror = false;
NEGATE_AND_NORMALIZE_ANGLE_POS( text->m_Orient );
text->SetLayer( GetLayer() );
text->SetLayer( FlipLayer( text->GetLayer() ) );
if( GetLayer() == LAYER_N_BACK )
text->SetLayer( SILKSCREEN_N_BACK );
if( GetLayer() == LAYER_N_FRONT )
text->SetLayer( SILKSCREEN_N_FRONT );
if( IsBackLayer( GetLayer() ) )
text->m_Mirror = true;
text->m_Mirror = IsBackLayer( GetLayer() );
break;
default:
......@@ -1021,13 +987,11 @@ void MODULE::SetOrientation( double newangle )
void MODULE::Show( int nestLevel, std::ostream& os ) const
{
BOARD* board = GetBoard();
// for now, make it look like XML, expand on this later.
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
" ref=\"" << m_Reference->GetText().mb_str() << '"' <<
" value=\"" << m_Value->GetText().mb_str() << '"' <<
" layer=\"" << board->GetLayerName( m_Layer ).mb_str() << '"' <<
" layer=\"" << GetLayerName().mb_str() << '"' <<
">\n";
NestedSpace( nestLevel + 1, os ) << "<boundingBox" << m_BoundaryBox.GetPosition()
......
......@@ -538,61 +538,8 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList )
board = GetBoard();
wxString layerInfo;
if( (m_layerMask & ALL_CU_LAYERS) == 0 ) // pad is not on any copper layers
{
LAYER_NUM pad_layer = ExtractLayer( m_layerMask & ~ALL_CU_LAYERS );
switch( pad_layer )
{
case UNSELECTED_LAYER:
layerInfo = _( "No layers" );
break;
case UNDEFINED_LAYER:
layerInfo = _( "Non-copper" );
break;
default:
layerInfo = board->GetLayerName( pad_layer );
break;
}
}
else
{
static const wxChar* andInternal = _( " & int" );
if( (m_layerMask & (LAYER_BACK | LAYER_FRONT)) == LAYER_BACK )
{
layerInfo = board->GetLayerName( LAYER_N_BACK );
if( m_layerMask & INTERNAL_LAYERS )
layerInfo += andInternal;
}
else if( (m_layerMask & (LAYER_BACK | LAYER_FRONT)) == (LAYER_BACK | LAYER_FRONT) )
{
layerInfo = board->GetLayerName( LAYER_N_BACK ) + wxT(", ") +
board->GetLayerName( LAYER_N_FRONT );
if( m_layerMask & INTERNAL_LAYERS )
layerInfo += andInternal;
}
else if( (m_layerMask & (LAYER_BACK | LAYER_FRONT)) == LAYER_FRONT )
{
layerInfo = board->GetLayerName( LAYER_N_FRONT );
if( m_layerMask & INTERNAL_LAYERS )
layerInfo += andInternal;
}
else // necessarily true: if( m_layerMask & INTERNAL_LAYERS )
{
layerInfo = _( "internal" );
}
}
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), layerInfo, DARKGREEN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ),
LayerMaskDescribe( board, m_layerMask ), DARKGREEN ) );
aList.push_back( MSG_PANEL_ITEM( ShowPadShape(), ShowPadAttr(), DARKGREEN ) );
......@@ -758,7 +705,7 @@ wxString D_PAD::ShowPadShape() const
return _( "Trap" );
default:
return wxT( "??Unknown??" );
return wxT( "???" );
}
}
......@@ -771,7 +718,7 @@ wxString D_PAD::ShowPadAttr() const
return _( "Std" );
case PAD_SMD:
return _( "Smd" );
return _( "SMD" );
case PAD_CONN:
return _( "Conn" );
......@@ -780,7 +727,7 @@ wxString D_PAD::ShowPadAttr() const
return _( "Not Plated" );
default:
return wxT( "??Unkown??" );
return wxT( "???" );
}
}
......@@ -788,22 +735,21 @@ wxString D_PAD::ShowPadAttr() const
wxString D_PAD::GetSelectMenuText() const
{
wxString text;
wxString padlayers;
BOARD * board = GetBoard();
wxString padlayers( LayerMaskDescribe( GetBoard(), m_layerMask ) );
wxString padname( GetPadName() );
if ( (m_layerMask & ALL_CU_LAYERS) == ALL_CU_LAYERS )
padlayers = _("all copper layers");
else if( (m_layerMask & LAYER_BACK ) == LAYER_BACK )
padlayers = board->GetLayerName(LAYER_N_BACK);
else if( (m_layerMask & LAYER_FRONT) == LAYER_FRONT )
padlayers = board->GetLayerName(LAYER_N_FRONT);
if( padname.IsEmpty() )
{
text.Printf( _( "Pad on %s of %s" ),
GetChars( padlayers ),
GetChars(( (MODULE*) GetParent() )->GetReference() ) );
}
else
padlayers = _( "???" );
text.Printf( _( "Pad [%s] (%s) of %s" ),
{
text.Printf( _( "Pad %s on %s of %s" ),
GetChars(GetPadName() ), GetChars( padlayers ),
GetChars(( (MODULE*) GetParent() )->GetReference() ) );
}
return text;
}
......
......@@ -265,8 +265,6 @@ void PCB_LAYER_WIDGET::ReFill()
int enabledLayers = brd->GetEnabledLayers();
// m_Layers->Freeze(); // no screen updates until done modifying
ClearLayerRows();
// show all coppers first, with front on top, back on bottom, then technical layers
......@@ -327,8 +325,6 @@ void PCB_LAYER_WIDGET::ReFill()
}
installRightLayerClickHandler();
// m_Layers->Thaw();
}
//-----<LAYER_WIDGET callbacks>-------------------------------------------
......
......@@ -124,12 +124,11 @@ void TEXTE_PCB::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
wxASSERT( board );
if( m_Parent && m_Parent->Type() == PCB_DIMENSION_T )
aList.push_back( MSG_PANEL_ITEM( _( "DIMENSION" ), m_Text, DARKGREEN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Dimension" ), m_Text, DARKGREEN ) );
else
aList.push_back( MSG_PANEL_ITEM( _( "PCB Text" ), m_Text, DARKGREEN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ),
board->GetLayerName( m_Layer ), BLUE ) );
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), BLUE ) );
if( !m_Mirror )
aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), _( "No" ), DARKGREEN ) );
......@@ -161,15 +160,8 @@ void TEXTE_PCB::Rotate( const wxPoint& aRotCentre, double aAngle )
void TEXTE_PCB::Flip(const wxPoint& aCentre )
{
m_Pos.y = aCentre.y - ( m_Pos.y - aCentre.y );
// NEGATE( m_Orient ); not needed: m_Mirror handles this
if( GetLayer() == LAYER_N_BACK
|| GetLayer() == LAYER_N_FRONT
|| GetLayer() == SILKSCREEN_N_BACK
|| GetLayer() == SILKSCREEN_N_FRONT )
{
m_Mirror = not m_Mirror; /* inverse mirror */
}
SetLayer( FlipLayer( GetLayer() ) );
m_Mirror = !m_Mirror;
}
......
......@@ -49,16 +49,13 @@
#include <pcbnew.h>
TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) :
TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, TEXT_TYPE text_type ) :
BOARD_ITEM( parent, PCB_MODULE_TEXT_T ),
EDA_TEXT()
{
MODULE* module = (MODULE*) m_Parent;
m_Type = text_type; /* Reference */
if( (m_Type != TEXT_is_REFERENCE) && (m_Type != TEXT_is_VALUE) )
m_Type = TEXT_is_DIVERS;
m_Type = text_type;
m_NoShow = false;
......@@ -71,20 +68,15 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) :
{
m_Pos = module->GetPosition();
LAYER_NUM moduleLayer = module->GetLayer();
if( moduleLayer == LAYER_N_BACK )
if( IsBackLayer( module->GetLayer() ) )
{
SetLayer( SILKSCREEN_N_BACK );
else if( moduleLayer == LAYER_N_FRONT )
SetLayer( SILKSCREEN_N_FRONT );
m_Mirror = true;
}
else
SetLayer( moduleLayer );
if( moduleLayer == SILKSCREEN_N_BACK
|| moduleLayer == ADHESIVE_N_BACK
|| moduleLayer == LAYER_N_BACK )
{
m_Mirror = true;
SetLayer( SILKSCREEN_N_FRONT );
m_Mirror = false;
}
}
}
......@@ -367,7 +359,6 @@ void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
return;
wxString msg, Line;
int ii;
static const wxString text_type_msg[3] =
{
......@@ -380,12 +371,8 @@ void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
Line = m_Text;
aList.push_back( MSG_PANEL_ITEM( _( "Text" ), Line, BROWN ) );
ii = m_Type;
if( ii > 2 )
ii = 2;
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), text_type_msg[ii], DARKGREEN ) );
wxASSERT( m_Type >= TEXT_is_REFERENCE && m_Type <= TEXT_is_DIVERS );
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), text_type_msg[m_Type], DARKGREEN ) );
if( m_NoShow )
msg = _( "No" );
......@@ -394,21 +381,13 @@ void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Display" ), msg, DARKGREEN ) );
// Display text layer (use layer name if possible)
BOARD* board = NULL;
board = (BOARD*) module->GetParent();
if( m_Layer < NB_PCB_LAYERS && board )
msg = board->GetLayerName( m_Layer );
else
msg.Printf( wxT( "%d" ), m_Layer );
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), msg, DARKGREEN ) );
msg = _( " No" );
// Display text layer
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), DARKGREEN ) );
if( m_Mirror )
msg = _( " Yes" );
else
msg = _( " No" );
aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), msg, DARKGREEN ) );
......@@ -426,39 +405,6 @@ void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
}
// see class_text_mod.h
bool TEXTE_MODULE::IsOnLayer( LAYER_NUM aLayer ) const
{
if( m_Layer == aLayer )
return true;
/* test the parent, which is a MODULE */
if( aLayer == GetParent()->GetLayer() )
return true;
if( aLayer == LAYER_N_BACK )
{
if( m_Layer==ADHESIVE_N_BACK || m_Layer==SILKSCREEN_N_BACK )
return true;
}
else if( aLayer == LAYER_N_FRONT )
{
if( m_Layer==ADHESIVE_N_FRONT || m_Layer==SILKSCREEN_N_FRONT )
return true;
}
return false;
}
/* see class_text_mod.h
* bool TEXTE_MODULE::IsOnOneOfTheseLayers( int aLayerMask ) const
* {
*
* }
*/
wxString TEXTE_MODULE::GetSelectMenuText() const
{
wxString text;
......@@ -476,7 +422,8 @@ wxString TEXTE_MODULE::GetSelectMenuText() const
default: // wrap this one in quotes:
text << _( "Text" ) << wxT( " \"" ) << m_Text << wxT( "\"" ) << _( " of " )
<< ( (MODULE*) GetParent() )->GetReference();
<< ( (MODULE*) GetParent() )->GetReference() << _( " on " )
<< GetLayerName();
break;
}
......
......@@ -43,10 +43,6 @@ class MODULE;
class MSG_PANEL_ITEM;
#define TEXT_is_REFERENCE 0
#define TEXT_is_VALUE 1
#define TEXT_is_DIVERS 2
#define UMBILICAL_COLOR LIGHTBLUE
......@@ -56,18 +52,28 @@ class TEXTE_MODULE : public BOARD_ITEM, public EDA_TEXT
friend class MODULE;
friend class FOOTPRINT_EDIT_FRAME;
public:
enum TEXT_TYPE
{
TEXT_is_REFERENCE = 0,
TEXT_is_VALUE = 1,
TEXT_is_DIVERS = 2
};
private:
/* Note: orientation in 1/10 deg relative to the footprint
* Physical orient is m_Orient + m_Parent->m_Orient
*/
int m_Type; ///< 0=ref, 1=val, etc.
TEXT_TYPE m_Type; ///< 0=ref, 1=val, etc.
bool m_NoShow; ///< true = invisible
wxPoint m_Pos0; ///< text coordinates relatives to the footprint anchor, orient 0.
///< text coordinate ref point is the text centre
public:
TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS );
TEXTE_MODULE( MODULE* parent, TEXT_TYPE text_type = TEXT_is_DIVERS );
// Do not create a copy constructor. The one generated by the compiler is adequate.
......@@ -77,9 +83,10 @@ public:
TEXTE_MODULE* Back() const { return (TEXTE_MODULE*) Pback; }
/// @deprecated it seems
void SetType( int aType ) { m_Type = aType; }
int GetType() const { return m_Type; }
/// @deprecated it seems (but the type is used to 'protect'
//reference and value from deletion, and for identification)
void SetType( TEXT_TYPE aType ) { m_Type = aType; }
TEXT_TYPE GetType() const { return m_Type; }
void SetVisible( bool isVisible ) { m_NoShow = !isVisible; }
bool IsVisible() const { return !m_NoShow; }
......@@ -89,7 +96,7 @@ public:
void Copy( TEXTE_MODULE* source ); // copy structure
int GetLength() const; /* text length */
int GetLength() const; // text length
int GetDrawRotation() const; // Return text rotation for drawings and plotting
......@@ -130,9 +137,6 @@ public:
bool HitTest( const wxPoint& aPosition );
bool IsOnLayer( LAYER_NUM aLayer ) const;
wxString GetClass() const
{
return wxT( "MTEXT" );
......
......@@ -172,7 +172,8 @@ wxString SEGZONE::GetSelectMenuText() const
}
else
{
text << _( "** BOARD NOT DEFINED **" );
wxFAIL_MSG( wxT( "SEGZONE::GetSelectMenuText: BOARD is NULL" ) );
text << wxT( "???" );
}
text << _( " on " ) << GetLayerName();
......@@ -200,16 +201,16 @@ wxString SEGVIA::GetSelectMenuText() const
NETINFO_ITEM* net;
BOARD* board = GetBoard();
text << _( "Via" ) << wxT( " " ) << ShowWidth();
int shape = GetShape();
if( shape == VIA_BLIND_BURIED )
text << wxT( " " ) << _( "Blind/Buried" );
text << wxT( " " ) << _( "Blind/Buried " );
else if( shape == VIA_MICROVIA )
text << wxT( " " ) << _( "Micro Via" );
text << wxT( " " ) << _( "Micro " );
// else say nothing about normal (through) vias
text << _( "Via" ) << wxT( " " ) << ShowWidth();
if( board )
{
net = board->FindNet( GetNet() );
......@@ -219,19 +220,17 @@ wxString SEGVIA::GetSelectMenuText() const
text << wxChar( ' ' ) << _( "Net:" ) << GetNet();
if( shape != VIA_THROUGH )
{
// say which layers, only two for now
LAYER_NUM topLayer;
LAYER_NUM botLayer;
ReturnLayerPair( &topLayer, &botLayer );
text << _( " on " ) << board->GetLayerName( topLayer ).Trim() << wxT( " <-> " )
<< board->GetLayerName( botLayer ).Trim();
}
text << _( " on " ) << board->GetLayerName( topLayer ) << wxT( "/" )
<< board->GetLayerName( botLayer );
}
else
{
text << _( "** BOARD NOT DEFINED **" );
wxFAIL_MSG( wxT( "SEGVIA::GetSelectMenuText: BOARD is NULL" ) );
text << wxT( "???" );
}
return text;
......@@ -1020,7 +1019,7 @@ void TRACK::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
{
default:
case 0:
msg = _( "??? Via" ); // Not used yet, does not exist currently
msg = wxT( "???" ); // Not used yet, does not exist currently
break;
case 1:
......@@ -1049,7 +1048,7 @@ void TRACK::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
break;
default:
msg = wxT( "????" );
msg = wxT( "???" );
break;
}
......@@ -1068,7 +1067,7 @@ void TRACK::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( _( "NetName" ), msg, RED ) );
/* Display net code : (useful in test or debug) */
msg.Printf( wxT( "%d .%d" ), GetNet(), GetSubNet() );
msg.Printf( wxT( "%d.%d" ), GetNet(), GetSubNet() );
aList.push_back( MSG_PANEL_ITEM( _( "NetCode" ), msg, RED ) );
}
......@@ -1117,7 +1116,8 @@ void TRACK::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
LAYER_NUM top_layer, bottom_layer;
Via->ReturnLayerPair( &top_layer, &bottom_layer );
msg = board->GetLayerName( top_layer ) + wxT( "/" ) + board->GetLayerName( bottom_layer );
msg = board->GetLayerName( top_layer ) + wxT( "/" )
+ board->GetLayerName( bottom_layer );
}
else
{
......@@ -1126,7 +1126,7 @@ void TRACK::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), msg, BROWN ) );
/* Display width */
// Display width
msg = ::CoordinateToString( (unsigned) m_Width );
if( Type() == PCB_VIA_T ) // Display Diam and Drill values
......@@ -1330,7 +1330,7 @@ suite1:
}
}
/* General search. */
// General search
for( nextSegment = aStartTrace; nextSegment != NULL; nextSegment = nextSegment->Next() )
{
if( nextSegment->GetState( IS_DELETED | BUSY ) )
......@@ -1524,11 +1524,12 @@ wxString TRACK::GetSelectMenuText() const
}
else
{
text << _( "** BOARD NOT DEFINED **" );
wxFAIL_MSG( wxT( "TRACK::GetSelectMenuText: BOARD is NULL" ) );
text << wxT( "???" );
}
text << _( " on " ) << GetLayerName() << wxT(" ") << _("Net:") << GetNet()
<< wxT(" ") << _("Length:") << ::LengthDoubleToString( GetLength() );
text << _( " on " ) << GetLayerName() << wxT(", ") << _("Net:") << GetNet()
<< wxT(", ") << _("Length:") << ::LengthDoubleToString( GetLength() );
return text;
}
......@@ -1591,8 +1592,8 @@ void SEGVIA::Show( int nestLevel, std::ostream& os ) const
" type=\"" << cp << '"';
if( board )
os << " layers=\"" << board->GetLayerName( topLayer ).Trim().mb_str() << ","
<< board->GetLayerName( botLayer ).Trim().mb_str() << '"';
os << " layers=\"" << board->GetLayerName( topLayer ).mb_str() << ","
<< board->GetLayerName( botLayer ).mb_str() << '"';
os << " width=\"" << m_Width << '"'
<< " drill=\"" << GetDrillValue() << '"'
......
......@@ -657,23 +657,13 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
msg.Empty();
if( GetDoNotAllowVias() )
msg = _("No via");
AccumulateDescription( msg, _("No via") );
if( GetDoNotAllowTracks() )
{
if( !msg.IsEmpty() )
msg += wxT(", ");
msg += _("No track");
}
AccumulateDescription( msg, _("No track") );
if( GetDoNotAllowCopperPour() )
{
if( !msg.IsEmpty() )
msg += wxT(", ");
msg += _("No copper pour");
}
AccumulateDescription( msg, _("No copper pour") );
aList.push_back( MSG_PANEL_ITEM( _( "Keepout" ), msg, RED ) );
}
......@@ -712,8 +702,7 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Non Copper Zone" ), wxEmptyString, RED ) );
}
msg = board->GetLayerName( m_Layer );
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), msg, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), BROWN ) );
msg.Printf( wxT( "%d" ), (int) m_Poly->m_CornersList.size() );
aList.push_back( MSG_PANEL_ITEM( _( "Corners" ), msg, BLUE ) );
......@@ -975,7 +964,7 @@ wxString ZONE_CONTAINER::GetSelectMenuText() const
}
}
text << _( " on layer " ) << GetLayerName();
text << _( " on " ) << GetLayerName();
return text;
}
......@@ -171,14 +171,12 @@ void PCB_EDIT_FRAME::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
break;
case PCB_MODULE_TEXT_T:
#define REFERENCE 0
#define VALUE 1
module = (MODULE*) objectToSync->GetParent();
text_mod = (TEXTE_MODULE*) objectToSync;
if( text_mod->GetType() == REFERENCE )
if( text_mod->GetType() == TEXTE_MODULE::TEXT_is_REFERENCE )
text_key = "$REF:";
else if( text_mod->GetType() == VALUE )
else if( text_mod->GetType() == TEXTE_MODULE::TEXT_is_VALUE )
text_key = "$VAL:";
else
break;
......
......@@ -131,13 +131,20 @@ void DialogEditModuleText::initDlg( )
m_ModuleInfoText->SetLabel( msg );
if( m_currentText->GetType() == TEXT_is_VALUE )
switch( m_currentText->GetType() )
{
case TEXTE_MODULE::TEXT_is_VALUE:
m_TextDataTitle->SetLabel( _( "Value:" ) );
else if( m_currentText->GetType() == TEXT_is_DIVERS )
break;
case TEXTE_MODULE::TEXT_is_DIVERS:
m_TextDataTitle->SetLabel( _( "Text:" ) );
else if( m_currentText->GetType() != TEXT_is_REFERENCE )
m_TextDataTitle->SetLabel( wxT( "???" ) );
break;
default:
m_TextDataTitle->SetLabel( _( "Reference:" ) );
break;
}
m_Name->SetValue( m_currentText->GetText() );
......
......@@ -173,25 +173,22 @@ public:
// Layer bit masks for each defined "Preset Layer Grouping"
static const LAYER_MSK presets[] =
{
#define FRONT_AUX (SILKSCREEN_LAYER_FRONT | SOLDERMASK_LAYER_FRONT | ADHESIVE_LAYER_FRONT | SOLDERPASTE_LAYER_FRONT)
#define BACK_AUX (SILKSCREEN_LAYER_BACK | SOLDERMASK_LAYER_BACK | ADHESIVE_LAYER_BACK | SOLDERPASTE_LAYER_BACK)
NO_LAYERS, // shift the array index up by one, matches with "Custom".
// "Two layers, parts on Front only"
EDGE_LAYER | LAYER_FRONT | LAYER_BACK | FRONT_AUX,
EDGE_LAYER | LAYER_FRONT | LAYER_BACK | FRONT_AUX_LAYERS,
// "Two layers, parts on Back only",
EDGE_LAYER | LAYER_FRONT | LAYER_BACK | BACK_AUX,
EDGE_LAYER | LAYER_FRONT | LAYER_BACK | BACK_AUX_LAYERS,
// "Two layers, parts on Front and Back",
EDGE_LAYER | LAYER_FRONT | LAYER_BACK | BACK_AUX | FRONT_AUX,
EDGE_LAYER | LAYER_FRONT | LAYER_BACK | ALL_AUX_LAYERS,
// "Four layers, parts on Front only"
EDGE_LAYER | LAYER_FRONT | LAYER_BACK | LAYER_2 | LAYER_3 | FRONT_AUX,
EDGE_LAYER | LAYER_FRONT | LAYER_BACK | LAYER_2 | LAYER_3 | FRONT_AUX_LAYERS,
// "Four layers, parts on Front and Back"
EDGE_LAYER | LAYER_FRONT | LAYER_BACK | LAYER_2 | LAYER_3 | FRONT_AUX | BACK_AUX,
EDGE_LAYER | LAYER_FRONT | LAYER_BACK | LAYER_2 | LAYER_3 | ALL_AUX_LAYERS,
// "All layers on",
ALL_LAYERS,
......
......@@ -242,11 +242,7 @@ void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event )
for( i = 0; i < m_layerList.size(); i++ )
{
LAYER_MSK layermask = GetLayerMask( m_layerList[ i ] );
if( ( layermask &
( ALL_CU_LAYERS | SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT |
SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT |
SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT ) )
!= 0 )
if( layermask & ( ALL_CU_LAYERS | ALL_AUX_LAYERS ) )
m_layerCheckListBox->Check( i, true );
else
m_layerCheckListBox->Check( i, false );
......
......@@ -340,11 +340,11 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* aEdge,
aEdge->SetWidth( GetDesignSettings().m_ModuleSegmentWidth );
aEdge->SetLayer( module->GetLayer() );
if( module->GetLayer() == LAYER_N_FRONT )
aEdge->SetLayer( SILKSCREEN_N_FRONT );
if( module->GetLayer() == LAYER_N_BACK )
// The default layer for an edge is the corresponding silk layer
if( module->IsFlipped() )
aEdge->SetLayer( SILKSCREEN_N_BACK );
else
aEdge->SetLayer( SILKSCREEN_N_FRONT );
// Initialize the starting point of the new segment or arc
aEdge->SetStart( GetScreen()->GetCrossHairPosition() );
......
......@@ -152,7 +152,7 @@ void PCB_EDIT_FRAME::Delete_Drawings_All_Layer( LAYER_NUM aLayer )
return;
}
wxString msg = _( "Delete Layer " ) + GetBoard()->GetLayerName( aLayer );
wxString msg = _( "Delete everything on layer " ) + GetBoard()->GetLayerName( aLayer );
if( !IsOK( this, msg ) )
return;
......
......@@ -79,20 +79,20 @@ void FOOTPRINT_EDIT_FRAME::RemoveStruct( EDA_ITEM* Item )
{
TEXTE_MODULE* text = (TEXTE_MODULE*) Item;
if( text->GetType() == TEXT_is_REFERENCE )
switch( text->GetType() )
{
case TEXTE_MODULE::TEXT_is_REFERENCE:
DisplayError( this, _( "Cannot delete REFERENCE!" ) );
break;
}
if( text->GetType() == TEXT_is_VALUE )
{
case TEXTE_MODULE::TEXT_is_VALUE:
DisplayError( this, _( "Cannot delete VALUE!" ) );
break;
}
default:
DeleteTextModule( text );
}
}
break;
case PCB_MODULE_EDGE_T:
......
......@@ -139,7 +139,7 @@ void PCB_BASE_FRAME::DeleteTextModule( TEXTE_MODULE* Text )
Module = (MODULE*) Text->GetParent();
if( Text->GetType() == TEXT_is_DIVERS )
if( Text->GetType() == TEXTE_MODULE::TEXT_is_DIVERS )
{
m_canvas->RefreshDrawingRect( Text->GetBoundingBox() );
Text->DeleteStructure();
......
......@@ -677,7 +677,7 @@ bool PCB_EDIT_FRAME::DoGenFootprintsReport( const wxString& aFullFilename, bool
double(pad->GetOrientation() - Module->GetOrientation()) / 10 );
fputs( line, rptfile );
static const char* shape_name[6] = { "??? ", "Circ", "Rect", "Oval", "trap", "spec" };
static const char* shape_name[6] = { "???", "Circ", "Rect", "Oval", "Trap", "Spec" };
sprintf( line, "Shape %s\n", shape_name[pad->GetShape()] );
fputs( line, rptfile );
......@@ -690,7 +690,7 @@ bool PCB_EDIT_FRAME::DoGenFootprintsReport( const wxString& aFullFilename, bool
if( pad->GetLayerMask() & LAYER_FRONT )
layer |= 2;
static const char* layer_name[4] = { "??? ", "copper", "component", "all" };
static const char* layer_name[4] = { "none", "back", "front", "both" };
sprintf( line, "Layer %s\n", layer_name[layer] );
fputs( line, rptfile );
......
......@@ -1187,8 +1187,8 @@ void PCB_IO::format( TEXTE_MODULE* aText, int aNestLevel ) const
switch( aText->GetType() )
{
case 0: type = wxT( "reference" ); break;
case 1: type = wxT( "value" ); break;
case TEXTE_MODULE::TEXT_is_REFERENCE: type = wxT( "reference" ); break;
case TEXTE_MODULE::TEXT_is_VALUE: type = wxT( "value" ); break;
default: type = wxT( "user" );
}
......
......@@ -948,12 +948,17 @@ MODULE* LEGACY_PLUGIN::LoadMODULE()
TEXTE_MODULE* textm;
if( tnum == TEXT_is_REFERENCE )
switch( tnum )
{
case TEXTE_MODULE::TEXT_is_REFERENCE:
textm = &module->Reference();
else if( tnum == TEXT_is_VALUE )
break;
case TEXTE_MODULE::TEXT_is_VALUE:
textm = &module->Value();
else
{
break;
default:
// text is a drawing
textm = new TEXTE_MODULE( module.get() );
module->GraphicalItems().PushBack( textm );
......@@ -1551,10 +1556,11 @@ void LEGACY_PLUGIN::loadMODULE_TEXT( TEXTE_MODULE* aText )
char* hjust = strtok( (char*) txt_end, delims );
char* vjust = strtok( NULL, delims );
if( type != TEXT_is_REFERENCE && type != TEXT_is_VALUE )
type = TEXT_is_DIVERS;
if( type != TEXTE_MODULE::TEXT_is_REFERENCE
&& type != TEXTE_MODULE::TEXT_is_VALUE )
type = TEXTE_MODULE::TEXT_is_DIVERS;
aText->SetType( type );
aText->SetType( static_cast<TEXTE_MODULE::TEXT_TYPE>( type ) );
aText->SetPos0( wxPoint( pos0_x, pos0_y ) );
aText->SetSize( wxSize( size0_x, size0_y ) );
......@@ -1730,8 +1736,8 @@ void LEGACY_PLUGIN::loadPCB_LINE()
dseg->SetTimeStamp( timestamp );
break;
case 4:
int state;
state = hexParse( data );
STATUS_FLAGS state;
state = static_cast<STATUS_FLAGS>( hexParse( data ) );
dseg->SetState( state, true );
break;
......
......@@ -482,12 +482,12 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( val && ref )
{
ref->SetType( TEXT_is_REFERENCE ); // just in case ...
ref->SetType( TEXTE_MODULE::TEXT_is_REFERENCE ); // just in case ...
if( ref->GetLength() == 0 )
ref->SetText( wxT( "Ref**" ) );
val->SetType( TEXT_is_VALUE ); // just in case ...
val->SetType( TEXTE_MODULE::TEXT_is_VALUE ); // just in case ...
if( val->GetLength() == 0 )
val->SetText( L"Val**" );
......
......@@ -314,7 +314,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
HK_EDIT_ITEM );
AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_TEXTMODULE, msg, KiBitmap( edit_text_xpm ) );
if( ( (TEXTE_MODULE*) item )->GetType() == TEXT_is_DIVERS )
if( ( (TEXTE_MODULE*) item )->GetType() == TEXTE_MODULE::TEXT_is_DIVERS )
{
msg = AddHotkeyName( _("Delete Text Mod." ), g_Module_Editor_Hokeys_Descr,
HK_DELETE );
......
......@@ -775,7 +775,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* me
}
// Graphic texts can be deleted only if are not currently edited.
if( !flags && FpText->GetType() == TEXT_is_DIVERS )
if( !flags && FpText->GetType() == TEXTE_MODULE::TEXT_is_DIVERS )
{
AddMenuItem( sub_menu_Fp_text, ID_POPUP_PCB_DELETE_TEXTMODULE,
_( "Delete" ), KiBitmap( delete_xpm ) );
......
......@@ -519,7 +519,7 @@ void PCB_MODULE::AddToBoard()
TEXTE_MODULE* ref_text = &module->Reference();
ref_text->SetText( m_name.text );
ref_text->SetType( TEXT_is_REFERENCE );
ref_text->SetType( TEXTE_MODULE::TEXT_is_REFERENCE );
ref_text->SetPos0( wxPoint( m_name.correctedPositionX, m_name.correctedPositionY ) );
ref_text->SetSize( wxSize( KiROUND( m_name.textHeight / 2 ),
......@@ -540,7 +540,7 @@ void PCB_MODULE::AddToBoard()
TEXTE_MODULE* val_text = &module->Value();
val_text->SetText( m_value.text );
val_text->SetType( TEXT_is_REFERENCE );
val_text->SetType( TEXTE_MODULE::TEXT_is_REFERENCE );
val_text->SetPos0( wxPoint( m_value.correctedPositionX, m_value.correctedPositionY ) );
val_text->SetSize( wxSize( KiROUND( m_value.textHeight / 2 ),
......
......@@ -1669,18 +1669,19 @@ MODULE* PCB_PARSER::parseMODULE() throw( IO_ERROR, PARSE_ERROR )
text->SetOrientation( orientation );
text->SetDrawCoord();
if( text->GetType() == TEXT_is_REFERENCE )
switch( text->GetType() )
{
case TEXTE_MODULE::TEXT_is_REFERENCE:
module->Reference() = *text;
delete text;
}
else if( text->GetType() == TEXT_is_VALUE )
{
break;
case TEXTE_MODULE::TEXT_is_VALUE:
module->Value() = *text;
delete text;
}
else
{
break;
default:
module->GraphicalItems().PushBack( text );
}
......@@ -1743,11 +1744,11 @@ TEXTE_MODULE* PCB_PARSER::parseTEXTE_MODULE() throw( IO_ERROR, PARSE_ERROR )
switch( token )
{
case T_reference:
text->SetType( TEXT_is_REFERENCE );
text->SetType( TEXTE_MODULE::TEXT_is_REFERENCE );
break;
case T_value:
text->SetType( TEXT_is_VALUE );
text->SetType( TEXTE_MODULE::TEXT_is_VALUE );
break;
case T_user:
......
......@@ -104,7 +104,7 @@ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( PCB_BASE_FRAME* parent,
m_Parent = parent;
/* Build the layer list */
// Build the layer list
LayerCount = 0;
LAYER_MSK Masque_Layer = g_TabAllCopperLayerMask[board->GetCopperLayerCount() - 1];
Masque_Layer |= ALL_NO_CU_LAYERS;
......
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