From 60a55d75fad8c4955b953b62f68b0b70753f3ab8 Mon Sep 17 00:00:00 2001 From: Andrew Zonenberg Date: Tue, 21 Aug 2018 12:01:07 -0700 Subject: [PATCH] Split prohibited text layers for footprints and the rest of the PCB Fixes: lp:1788268 * https://bugs.launchpad.net/kicad/+bug/1788268 --- common/lset.cpp | 53 ++++++++++++++++++++++- include/layers_id_colors_and_visibility.h | 15 ++++++- pcbnew/dialogs/dialog_text_properties.cpp | 7 ++- pcbnew/text_mod_grid_table.cpp | 2 +- 4 files changed, 72 insertions(+), 5 deletions(-) diff --git a/common/lset.cpp b/common/lset.cpp index 1a5e80954d..723834592e 100644 --- a/common/lset.cpp +++ b/common/lset.cpp @@ -783,9 +783,58 @@ LSET LSET::BackMask() } -LSET LSET::ForbiddenTextLayers() +LSET LSET::ForbiddenTextLayersForBoard() { - static const LSET saved( 6, Edge_Cuts, Margin, F_Paste, B_Paste, F_Mask, B_Mask ); + static const LSET saved( 2, Edge_Cuts, Margin ); + return saved; +} + +LSET LSET::ForbiddenTextLayersForFootprint() +{ + static const PCB_LAYER_ID bad_layers[] = { + F_Cu, + B_Cu, + In1_Cu, + In2_Cu, + In3_Cu, + In4_Cu, + In5_Cu, + In6_Cu, + In7_Cu, + In8_Cu, + In9_Cu, + In10_Cu, + In11_Cu, + In12_Cu, + In13_Cu, + In14_Cu, + In15_Cu, + In16_Cu, + In17_Cu, + In18_Cu, + In19_Cu, + In20_Cu, + In21_Cu, + In22_Cu, + In23_Cu, + In24_Cu, + In25_Cu, + In26_Cu, + In27_Cu, + In28_Cu, + In29_Cu, + In30_Cu, + Edge_Cuts, + Margin, + F_Paste, + B_Paste, + F_Mask, + B_Mask, + F_Adhes, + B_Adhes + }; + + static const LSET saved( bad_layers, DIM( bad_layers ) ); return saved; } diff --git a/include/layers_id_colors_and_visibility.h b/include/layers_id_colors_and_visibility.h index 1a08615fa6..0249381aa6 100644 --- a/include/layers_id_colors_and_visibility.h +++ b/include/layers_id_colors_and_visibility.h @@ -523,7 +523,20 @@ public: static LSET UserMask(); - static LSET ForbiddenTextLayers(); + /** + * Function ForbiddenTextLayersForBoard + * returns the layer set that should not be allowed for free text on the board + * Currently this is only EdgeCuts and Margin + */ + static LSET ForbiddenTextLayersForBoard(); + + /** + * Function ForbiddenTextLayersForFootprint + * returns the layer set that should not be allowed in text that is attached to a + * footprint. Currently, this is any copper layer (not handled by router or fills) + * and any of the aperture layers (mask, paste, adhesive) + */ + static LSET ForbiddenTextLayersForFootprint(); /** * Function CuStack diff --git a/pcbnew/dialogs/dialog_text_properties.cpp b/pcbnew/dialogs/dialog_text_properties.cpp index 180ec789c6..8a3069de46 100644 --- a/pcbnew/dialogs/dialog_text_properties.cpp +++ b/pcbnew/dialogs/dialog_text_properties.cpp @@ -120,7 +120,12 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BO m_LayerSelectionCtrl->ShowNonActivatedLayers( true ); m_LayerSelectionCtrl->SetLayersHotkeys( false ); - m_LayerSelectionCtrl->SetNotAllowedLayerSet( LSET::ForbiddenTextLayers() ); + + if( m_item->Type() == PCB_MODULE_TEXT_T ) + m_LayerSelectionCtrl->SetNotAllowedLayerSet( LSET::ForbiddenTextLayersForFootprint() ); + else + m_LayerSelectionCtrl->SetNotAllowedLayerSet( LSET::ForbiddenTextLayersForBoard() ); + m_LayerSelectionCtrl->SetBoardFrame( m_Parent ); m_LayerSelectionCtrl->Resync(); diff --git a/pcbnew/text_mod_grid_table.cpp b/pcbnew/text_mod_grid_table.cpp index b93654bec7..c803223bd8 100644 --- a/pcbnew/text_mod_grid_table.cpp +++ b/pcbnew/text_mod_grid_table.cpp @@ -65,7 +65,7 @@ TEXT_MOD_GRID_TABLE::TEXT_MOD_GRID_TABLE( EDA_UNITS_T aUserUnits, PCB_BASE_FRAME m_layerColAttr = new wxGridCellAttr; m_layerColAttr->SetRenderer( new GRID_CELL_LAYER_RENDERER( m_frame ) ); - m_layerColAttr->SetEditor( new GRID_CELL_LAYER_SELECTOR( m_frame, LSET::ForbiddenTextLayers() ) ); + m_layerColAttr->SetEditor( new GRID_CELL_LAYER_SELECTOR( m_frame, LSET::ForbiddenTextLayersForBoard() ) ); }