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