Commit aa9de21c authored by jean-pierre charras's avatar jean-pierre charras

Ref and Value for footprints: use now the layer color, not a specific color:...

Ref and Value for footprints: use now the layer color, not a specific color: this is needed by the fact these fields can be on an other layer than silk screen, and therefore must have the corresponding color
Also do not allow copper layers, solder paste and solder mask: put Ref or Value on these layers has no sense, and can create serious issues on the board.
parent 260ca0e7
......@@ -66,8 +66,8 @@ const LAYER_WIDGET::ROW PCB_LAYER_WIDGET::s_render_rows[] = {
RR( _( "Pads Front" ), PAD_FR_VISIBLE, WHITE, _( "Show footprint pads on board's front" ) ),
RR( _( "Pads Back" ), PAD_BK_VISIBLE, WHITE, _( "Show footprint pads on board's back" ) ),
RR( _( "Text Front" ), MOD_TEXT_FR_VISIBLE, WHITE, _( "Show footprint text on board's front" ) ),
RR( _( "Text Back" ), MOD_TEXT_BK_VISIBLE, WHITE, _( "Show footprint text on board's back" ) ),
RR( _( "Text Front" ), MOD_TEXT_FR_VISIBLE, UNSPECIFIED_COLOR, _( "Show footprint text on board's front" ) ),
RR( _( "Text Back" ), MOD_TEXT_BK_VISIBLE, UNSPECIFIED_COLOR, _( "Show footprint text on board's back" ) ),
RR( _( "Hidden Text" ), MOD_TEXT_INVISIBLE, WHITE, _( "Show footprint text marked as invisible" ) ),
RR( _( "Anchors" ), ANCHOR_VISIBLE, WHITE, _( "Show footprint and text origins as a cross" ) ),
......
......@@ -250,9 +250,8 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
BOARD* brd = GetBoard( );
/* Reference and values takes the color from the corresponding Visibles
other texts take the color of the layer they are on */
EDA_COLOR_T color;
EDA_COLOR_T color = brd->GetLayerColor( GetLayer() );
/* For reference and value suppress the element if the layer it is
* on is on a disabled side, user text also has standard layer
......@@ -263,25 +262,13 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
(IsBackLayer( text_layer ) && !brd->IsElementVisible( MOD_TEXT_BK_VISIBLE )) )
return;
switch( GetType() )
{
case TEXT_is_REFERENCE:
case TEXT_is_VALUE:
if( IsFrontLayer( text_layer ) )
color = brd->GetVisibleElementColor( MOD_TEXT_FR_VISIBLE );
else
color = brd->GetVisibleElementColor( MOD_TEXT_BK_VISIBLE );
break;
default: // Otherwise the compiler is not sure about initializing color
case TEXT_is_DIVERS:
if( brd->IsLayerVisible( m_Layer ) )
color = brd->GetLayerColor( GetLayer() );
else
// text which are not ref or value are shown only if the layer is visible
// ref or value have a specific display option
if( GetType() == TEXT_is_DIVERS && ! brd->IsLayerVisible( m_Layer ) )
return;
}
// 'Ghost' the element if forced show
// Invisible texts are still drawn (not plotted) in MOD_TEXT_INVISIBLE
// Just because we must have to edit them (at least to make them visible)
if( m_NoShow )
{
if( !brd->IsElementVisible( MOD_TEXT_INVISIBLE ) )
......
......@@ -113,6 +113,11 @@ void DialogEditModuleText::initDlg( )
m_ModuleInfoText->SetLabel( msg );
// Create a list of not allowed layers.
// could be slightly dependent of the type of footprint text.
LSET forbiddenLayers( LSET::AllCuMask() );
forbiddenLayers.set( Edge_Cuts ).set( Margin ).set( F_Paste ).set( B_Paste ).set( F_Mask ).set( B_Mask );
switch( m_currentText->GetType() )
{
case TEXTE_MODULE::TEXT_is_VALUE:
......@@ -154,11 +159,11 @@ void DialogEditModuleText::initDlg( )
m_Orient->SetSelection( 1 );
if( !m_currentText->IsVisible() )
m_Show->SetSelection( 1 );;
m_Show->SetSelection( 1 );
// Configure the layers list selector
m_LayerSelectionCtrl->SetLayersHotkeys( false );
m_LayerSelectionCtrl->SetLayerSet( LSET::InternalCuMask().set( Edge_Cuts ) );
m_LayerSelectionCtrl->SetLayerSet( forbiddenLayers );
m_LayerSelectionCtrl->SetBoardFrame( m_parent );
m_LayerSelectionCtrl->Resync();
......@@ -238,6 +243,7 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event )
LAYER_NUM layer = m_LayerSelectionCtrl->GetLayerSelection();
m_currentText->SetLayer( ToLAYER_ID( layer ) );
m_currentText->SetMirrored( IsBackLayer( m_currentText->GetLayer() ) );
#ifndef USE_WX_OVERLAY
if( m_dc ) // Display new text
......
......@@ -74,6 +74,8 @@ static LSEQ dlg_layers()
// layers that are put out into the dialog UI, coordinate with wxformbuilder and
// getCTLs( LAYER_NUM aLayerNumber )
static const LAYER_ID layers[] = {
F_CrtYd,
F_Fab,
F_Adhes,
F_Paste,
F_SilkS,
......@@ -117,6 +119,8 @@ static LSEQ dlg_layers()
B_SilkS,
B_Paste,
B_Adhes,
B_Fab,
B_CrtYd,
Edge_Cuts,
Margin,
......@@ -257,6 +261,8 @@ CTLs DIALOG_LAYERS_SETUP::getCTLs( LAYER_NUM aLayerNumber )
switch( aLayerNumber )
{
case F_CrtYd: RETAUX( m_CrtYdFront );
case F_Fab: RETAUX( m_FabFront );
case F_Adhes: RETAUX( m_AdhesFront );
case F_Paste: RETAUX( m_SoldPFront );
case F_SilkS: RETAUX( m_SilkSFront );
......@@ -300,6 +306,8 @@ CTLs DIALOG_LAYERS_SETUP::getCTLs( LAYER_NUM aLayerNumber )
case B_SilkS: RETAUX( m_SilkSBack );
case B_Paste: RETAUX( m_SoldPBack );
case B_Adhes: RETAUX( m_AdhesBack );
case B_Fab: RETAUX( m_FabBack );
case B_CrtYd: RETAUX( m_CrtYdBack );
case Edge_Cuts: RETAUX( m_PCBEdges );
case Margin: RETAUX( m_Margin );
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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