From 95265c765bf7cae09ca4834e321e841d81073569 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 2 Sep 2019 09:51:15 +0200 Subject: [PATCH] Pcbnew, DIALOG_TEXT_PROPERTIES: make lines thickness editable when editing a dimension. From Master branch (commit 762dabd7) Fixes: lp:1841797 https://bugs.launchpad.net/kicad/+bug/1841797 --- pcbnew/dialogs/dialog_text_properties.cpp | 10 + pcbnew/dialogs/dialog_text_properties.h | 1 + .../dialogs/dialog_text_properties_base.cpp | 18 +- .../dialogs/dialog_text_properties_base.fbp | 199 ++++++++++++++++++ pcbnew/dialogs/dialog_text_properties_base.h | 5 +- 5 files changed, 231 insertions(+), 2 deletions(-) diff --git a/pcbnew/dialogs/dialog_text_properties.cpp b/pcbnew/dialogs/dialog_text_properties.cpp index de97648668..ccd949fca6 100644 --- a/pcbnew/dialogs/dialog_text_properties.cpp +++ b/pcbnew/dialogs/dialog_text_properties.cpp @@ -63,10 +63,16 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BO m_thickness( aParent, m_ThicknessLabel, m_ThicknessCtrl, m_ThicknessUnits, true ), m_posX( aParent, m_PositionXLabel, m_PositionXCtrl, m_PositionXUnits ), m_posY( aParent, m_PositionYLabel, m_PositionYCtrl, m_PositionYUnits ), + m_linesThickness( aParent, m_LinesThicknessLabel, m_LinesThicknessCtrl, + m_LinesThicknessUnits, true ), m_OrientValidator( 1, &m_OrientValue ) { wxString title; + m_LinesThicknessLabel->Show( m_item->Type() == PCB_DIMENSION_T ); + m_LinesThicknessCtrl->Show( m_item->Type() == PCB_DIMENSION_T ); + m_LinesThicknessUnits->Show( m_item->Type() == PCB_DIMENSION_T ); + if( m_item->Type() == PCB_DIMENSION_T ) { title = _( "Dimension Text Properties" ); @@ -162,6 +168,7 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BO m_ThicknessCtrl, m_PositionXCtrl, m_PositionYCtrl, + m_LinesThicknessCtrl, m_Visible, m_Italic, m_JustifyChoice, @@ -296,6 +303,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow() dimension->GetUnits( units, useMils ); m_DimensionUnitsOpt->SetSelection( units == MILLIMETRES ? 2 : useMils ? 1 : 0 ); + m_linesThickness.SetValue( dimension->GetWidth() ); } if( m_item->Type() == PCB_MODULE_TEXT_T && m_modText ) @@ -403,6 +411,8 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow() case 2: dimension->SetUnits( MILLIMETRES, false ); break; default: break; } + + dimension->SetWidth( m_linesThickness.GetValue() ); } m_item->SetLayer( ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ) ); diff --git a/pcbnew/dialogs/dialog_text_properties.h b/pcbnew/dialogs/dialog_text_properties.h index 0fe7997962..52a81f6589 100644 --- a/pcbnew/dialogs/dialog_text_properties.h +++ b/pcbnew/dialogs/dialog_text_properties.h @@ -56,6 +56,7 @@ private: UNIT_BINDER m_thickness; UNIT_BINDER m_posX; UNIT_BINDER m_posY; + UNIT_BINDER m_linesThickness; // lines thikness for dimension graphic wxFloatingPointValidator m_OrientValidator; double m_OrientValue; diff --git a/pcbnew/dialogs/dialog_text_properties_base.cpp b/pcbnew/dialogs/dialog_text_properties_base.cpp index 51029e0ec6..11f23d4ac7 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 Nov 10 2018) +// C++ code generated with wxFormBuilder (version Jul 10 2019) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -186,6 +186,20 @@ DIALOG_TEXT_PROPERTIES_BASE::DIALOG_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWi fgSizerSetup->Add( m_KeepUpright, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + fgSizerSetup->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_LinesThicknessLabel = new wxStaticText( this, wxID_ANY, _("Lines thickness:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_LinesThicknessLabel->Wrap( -1 ); + fgSizerSetup->Add( m_LinesThicknessLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + m_LinesThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); + fgSizerSetup->Add( m_LinesThicknessCtrl, 0, wxTOP|wxBOTTOM|wxEXPAND, 5 ); + + m_LinesThicknessUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_LinesThicknessUnits->Wrap( -1 ); + fgSizerSetup->Add( m_LinesThicknessUnits, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + bMainSizer->Add( fgSizerSetup, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 ); @@ -241,6 +255,7 @@ DIALOG_TEXT_PROPERTIES_BASE::DIALOG_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWi m_OrientCtrl->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::OnOkClick ), NULL, this ); m_PositionXCtrl->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::OnOkClick ), NULL, this ); m_PositionYCtrl->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::OnOkClick ), NULL, this ); + m_LinesThicknessCtrl->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::OnOkClick ), NULL, this ); m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::OnOkClick ), NULL, this ); } @@ -257,6 +272,7 @@ DIALOG_TEXT_PROPERTIES_BASE::~DIALOG_TEXT_PROPERTIES_BASE() m_OrientCtrl->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::OnOkClick ), NULL, this ); m_PositionXCtrl->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::OnOkClick ), NULL, this ); m_PositionYCtrl->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::OnOkClick ), NULL, this ); + m_LinesThicknessCtrl->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::OnOkClick ), NULL, this ); m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::OnOkClick ), NULL, this ); } diff --git a/pcbnew/dialogs/dialog_text_properties_base.fbp b/pcbnew/dialogs/dialog_text_properties_base.fbp index 426cb91523..ab7c7ae360 100644 --- a/pcbnew/dialogs/dialog_text_properties_base.fbp +++ b/pcbnew/dialogs/dialog_text_properties_base.fbp @@ -14,6 +14,7 @@ dialog_text_properties_base 1000 none + 1 DIALOG_TEXT_PROPERTIES_BASE @@ -25,6 +26,7 @@ 1 1 UI + 0 0 0 @@ -2227,6 +2229,203 @@ + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Lines thickness: + 0 + + 0 + + + 0 + + 1 + m_LinesThicknessLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxTOP|wxBOTTOM|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_LinesThicknessCtrl + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_PROCESS_ENTER + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + OnOkClick + + + + 5 + wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + unit + 0 + + 0 + + + 0 + + 1 + m_LinesThicknessUnits + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + diff --git a/pcbnew/dialogs/dialog_text_properties_base.h b/pcbnew/dialogs/dialog_text_properties_base.h index 0997e329f8..e277105dc9 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 Nov 10 2018) +// C++ code generated with wxFormBuilder (version Jul 10 2019) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -75,6 +75,9 @@ class DIALOG_TEXT_PROPERTIES_BASE : public DIALOG_SHIM wxTextCtrl* m_PositionYCtrl; wxStaticText* m_PositionYUnits; wxCheckBox* m_KeepUpright; + wxStaticText* m_LinesThicknessLabel; + wxTextCtrl* m_LinesThicknessCtrl; + wxStaticText* m_LinesThicknessUnits; wxStaticText* m_statusLine; wxStaticLine* m_staticline; wxStdDialogButtonSizer* m_sdbSizer;