From fe97521bdacaa3db1e9cca1f3550dcbec72df4cb Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 26 Jan 2014 18:30:20 +0100 Subject: [PATCH] Pcbnew: fix Bug #1272926 (Texts are now not accepted on edge cuts layer) --- pcbnew/dialogs/dialog_pcb_text_properties.cpp | 9 +++++++++ pcbnew/onleftclick.cpp | 9 ++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/pcbnew/dialogs/dialog_pcb_text_properties.cpp b/pcbnew/dialogs/dialog_pcb_text_properties.cpp index 820b0f6ec3..4a0f91440e 100644 --- a/pcbnew/dialogs/dialog_pcb_text_properties.cpp +++ b/pcbnew/dialogs/dialog_pcb_text_properties.cpp @@ -172,6 +172,15 @@ void DIALOG_PCB_TEXT_PROPERTIES::OnCancelClick( wxCommandEvent& event ) void DIALOG_PCB_TEXT_PROPERTIES::OnOkClick( wxCommandEvent& event ) { + // Test for acceptable layer. + // Incorrect layer can happen for old boards, + // having texts on edge cut layer for instance + if( m_LayerSelectionCtrl->GetLayerSelection() < 0 ) + { + wxMessageBox( wxT("No layer selected, Please select the text layer") ); + return; + } + wxPoint newPosition; wxSize newSize; diff --git a/pcbnew/onleftclick.cpp b/pcbnew/onleftclick.cpp index 5c79ce4962..28451e4b68 100644 --- a/pcbnew/onleftclick.cpp +++ b/pcbnew/onleftclick.cpp @@ -325,6 +325,13 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) break; case ID_PCB_ADD_TEXT_BUTT: + if( IsLayerInList( EDGE_LAYER, getActiveLayer() ) ) + { + DisplayError( this, + _( "Texts not allowed on Edge Cut layers" ) ); + break; + } + if( (DrawStruct == NULL) || (DrawStruct->GetFlags() == 0) ) { SetCurItem( CreateTextePcb( aDC ) ); @@ -367,7 +374,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) break; case ID_PCB_DIMENSION_BUTT: - if( IsLayerInList( EDGE_LAYER|ALL_CU_LAYERS ,getActiveLayer() ) ) + if( IsLayerInList( EDGE_LAYER|ALL_CU_LAYERS, getActiveLayer() ) ) { DisplayError( this, _( "Dimension not allowed on Copper or Edge Cut layers" ) );