From d4c36230d2b84c2c99bec4ca2c890c028741c1fc Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 12 Jan 2021 10:00:21 +0100 Subject: [PATCH] Pcbnew, Graphic items: show the locked status in msg panel and dialog properties. --- pcbnew/dialogs/dialog_text_properties.cpp | 4 + .../dialogs/dialog_text_properties_base.cpp | 13 ++- .../dialogs/dialog_text_properties_base.fbp | 79 ++++++++++++++++++- pcbnew/dialogs/dialog_text_properties_base.h | 5 +- pcbnew/fp_text.cpp | 3 + pcbnew/pcb_shape.cpp | 3 + pcbnew/pcb_text.cpp | 3 + 7 files changed, 103 insertions(+), 7 deletions(-) diff --git a/pcbnew/dialogs/dialog_text_properties.cpp b/pcbnew/dialogs/dialog_text_properties.cpp index 828706f3f8..d225d4a796 100644 --- a/pcbnew/dialogs/dialog_text_properties.cpp +++ b/pcbnew/dialogs/dialog_text_properties.cpp @@ -288,6 +288,8 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow() m_statusLine->Show( false ); } + m_cbLocked->SetValue( m_item->IsLocked() ); + m_LayerSelectionCtrl->SetLayerSelection( m_item->GetLayer() ); m_textWidth.SetValue( m_edaText->GetTextSize().x ); @@ -356,6 +358,8 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow() } } + m_item->SetLocked( m_cbLocked->GetValue() ); + m_item->SetLayer( ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ) ); m_edaText->SetTextSize( wxSize( m_textWidth.GetValue(), m_textHeight.GetValue() ) ); diff --git a/pcbnew/dialogs/dialog_text_properties_base.cpp b/pcbnew/dialogs/dialog_text_properties_base.cpp index a64101bc2f..5dce4c29a3 100644 --- a/pcbnew/dialogs/dialog_text_properties_base.cpp +++ b/pcbnew/dialogs/dialog_text_properties_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.9.0 Nov 1 2020) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -56,7 +56,7 @@ DIALOG_TEXT_PROPERTIES_BASE::DIALOG_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWi m_MultiLineText->SetSelForeground( true, wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) ); m_MultiLineText->SetToolTip( _("Enter the text placed on selected layer.") ); - m_MultiLineSizer->Add( m_MultiLineText, 1, wxEXPAND | wxALL, 5 ); + m_MultiLineSizer->Add( m_MultiLineText, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bMainSizer->Add( m_MultiLineSizer, 20, wxEXPAND|wxALL, 10 ); @@ -73,6 +73,15 @@ DIALOG_TEXT_PROPERTIES_BASE::DIALOG_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWi bMainSizer->Add( m_SingleLineSizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 ); + wxBoxSizer* bSizerLocked; + bSizerLocked = new wxBoxSizer( wxHORIZONTAL ); + + m_cbLocked = new wxCheckBox( this, wxID_ANY, _("Locked"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerLocked->Add( m_cbLocked, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + bMainSizer->Add( bSizerLocked, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 ); + wxFlexGridSizer* fgSizerSetup; fgSizerSetup = new wxFlexGridSizer( 0, 5, 4, 0 ); fgSizerSetup->AddGrowableCol( 1 ); diff --git a/pcbnew/dialogs/dialog_text_properties_base.fbp b/pcbnew/dialogs/dialog_text_properties_base.fbp index c5fa98403b..1950fed00f 100644 --- a/pcbnew/dialogs/dialog_text_properties_base.fbp +++ b/pcbnew/dialogs/dialog_text_properties_base.fbp @@ -14,7 +14,6 @@ dialog_text_properties_base 1000 none - 1 DIALOG_TEXT_PROPERTIES_BASE @@ -26,7 +25,6 @@ 1 1 UI - 0 0 0 @@ -133,7 +131,7 @@ 5 - wxEXPAND | wxALL + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 1 1 @@ -337,6 +335,81 @@ + + 10 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + + bSizerLocked + wxHORIZONTAL + none + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Locked + + 0 + + + 0 + + 1 + m_cbLocked + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 10 wxEXPAND|wxRIGHT|wxLEFT diff --git a/pcbnew/dialogs/dialog_text_properties_base.h b/pcbnew/dialogs/dialog_text_properties_base.h index 1b8da3e0eb..1f7f8f9fa2 100644 --- a/pcbnew/dialogs/dialog_text_properties_base.h +++ b/pcbnew/dialogs/dialog_text_properties_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.9.0 Nov 1 2020) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -22,8 +22,8 @@ class PCB_LAYER_BOX_SELECTOR; #include #include #include -#include #include +#include #include #include #include @@ -46,6 +46,7 @@ class DIALOG_TEXT_PROPERTIES_BASE : public DIALOG_SHIM wxBoxSizer* m_SingleLineSizer; wxStaticText* m_TextLabel; wxTextCtrl* m_SingleLineText; + wxCheckBox* m_cbLocked; wxStaticText* m_LayerLabel; PCB_LAYER_BOX_SELECTOR* m_LayerSelectionCtrl; wxCheckBox* m_Visible; diff --git a/pcbnew/fp_text.cpp b/pcbnew/fp_text.cpp index 896aa5c26b..fd90b4905c 100644 --- a/pcbnew/fp_text.cpp +++ b/pcbnew/fp_text.cpp @@ -287,6 +287,9 @@ void FP_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector= TEXT_is_REFERENCE && m_Type <= TEXT_is_DIVERS ); aList.emplace_back( _( "Type" ), text_type_msg[m_Type] ); + if( IsLocked() ) + aList.emplace_back( _( "Status" ), _( "locked" ) ); + aList.emplace_back( _( "Display" ), IsVisible() ? _( "Yes" ) : _( "No" ) ); // Display text layer diff --git a/pcbnew/pcb_shape.cpp b/pcbnew/pcb_shape.cpp index e40c3ba792..5fb0d65d5a 100644 --- a/pcbnew/pcb_shape.cpp +++ b/pcbnew/pcb_shape.cpp @@ -471,6 +471,9 @@ void PCB_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector