From 79cdd608af5d3f6cd3cd67789c53dd8c6a885349 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 8 Jun 2020 20:41:09 +0100 Subject: [PATCH] Make sure Footprint ID gets initialized when calling chooser. Also make some of the labels in the dialog more explicit. --- ...dialog_edit_component_in_schematic_base.cpp | 4 ++-- ...dialog_edit_component_in_schematic_base.fbp | 4 +--- .../dialog_edit_component_in_schematic_base.h | 2 +- eeschema/dialogs/dialog_edit_one_field.cpp | 18 +++++++++++++++++- eeschema/dialogs/dialog_lib_edit_text_base.cpp | 14 +++++++------- eeschema/dialogs/dialog_lib_edit_text_base.fbp | 16 ++++++++-------- eeschema/dialogs/dialog_lib_edit_text_base.h | 5 +++-- 7 files changed, 39 insertions(+), 24 deletions(-) diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_base.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic_base.cpp index 8e12fa0d37..af62514293 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic_base.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jul 10 2019) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -212,7 +212,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE m_textCtrlTimeStamp->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) ); m_textCtrlTimeStamp->SetToolTip( _("Unique ID that identifies the symbol") ); - bSizerUUID->Add( m_textCtrlTimeStamp, 1, wxBOTTOM|wxEXPAND|wxRIGHT|wxTOP, 5 ); + bSizerUUID->Add( m_textCtrlTimeStamp, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxTOP, 5 ); bSizerBottom->Add( bSizerUUID, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_base.fbp b/eeschema/dialogs/dialog_edit_component_in_schematic_base.fbp index 8df48d17f6..bc3c2ad416 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic_base.fbp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic_base.fbp @@ -14,7 +14,6 @@ dialog_edit_component_in_schematic_base 1000 none - 1 dialog_edit_component_in_schematic_base @@ -26,7 +25,6 @@ 1 1 UI - 0 0 0 @@ -1357,7 +1355,7 @@ 5 - wxBOTTOM|wxEXPAND|wxRIGHT|wxTOP + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxTOP 1 1 diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_base.h b/eeschema/dialogs/dialog_edit_component_in_schematic_base.h index 01242b5e25..d81efbe36d 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic_base.h +++ b/eeschema/dialogs/dialog_edit_component_in_schematic_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jul 10 2019) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! diff --git a/eeschema/dialogs/dialog_edit_one_field.cpp b/eeschema/dialogs/dialog_edit_one_field.cpp index e49e2b462c..fbffbc99cb 100644 --- a/eeschema/dialogs/dialog_edit_one_field.cpp +++ b/eeschema/dialogs/dialog_edit_one_field.cpp @@ -82,6 +82,16 @@ void DIALOG_EDIT_ONE_FIELD::init() { SCH_BASE_FRAME* parent = GetParent(); bool libedit = parent->IsType( FRAME_SCH_LIB_EDITOR ); + + switch( m_fieldId ) + { + case REFERENCE: m_textLabel->SetLabel( _( "Reference designator:" ) ); break; + case VALUE: m_textLabel->SetLabel( _( "Value:" ) ); break; + case FOOTPRINT: m_textLabel->SetLabel( _( "Footprint ID:" ) ); break; + case DATASHEET: m_textLabel->SetLabel( _( "Datasheet URL:" ) ); break; + default: break; + } + m_TextCtrl->SetValidator( SCH_FIELD_VALIDATOR( libedit, m_fieldId, &m_text ) ); // Disable options for graphic text editing which are not needed for fields. @@ -100,6 +110,7 @@ void DIALOG_EDIT_ONE_FIELD::init() } // Show the footprint selection dialog if this is the footprint field. + m_TextValueSelectButton->SetBitmap( KiBitmap( small_library_xpm ) ); m_TextValueSelectButton->Show( m_fieldId == FOOTPRINT ); // Value fields of power components cannot be modified. This will grey out @@ -137,7 +148,12 @@ void DIALOG_EDIT_ONE_FIELD::init() void DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick( wxCommandEvent& aEvent ) { // pick a footprint using the footprint picker. - wxString fpid = m_TextCtrl->GetValue(); + wxString fpid; + + if( m_StyledTextCtrl->IsShown() ) + fpid = m_StyledTextCtrl->GetValue(); + else + fpid = m_TextCtrl->GetValue(); KIWAY_PLAYER* frame = Kiway().Player( FRAME_FOOTPRINT_VIEWER_MODAL, true ); diff --git a/eeschema/dialogs/dialog_lib_edit_text_base.cpp b/eeschema/dialogs/dialog_lib_edit_text_base.cpp index 15ea74c3d7..1502b73411 100644 --- a/eeschema/dialogs/dialog_lib_edit_text_base.cpp +++ b/eeschema/dialogs/dialog_lib_edit_text_base.cpp @@ -25,12 +25,12 @@ DIALOG_LIB_EDIT_TEXT_BASE::DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindow wxBoxSizer* bTextValueBoxSizer; bTextValueBoxSizer = new wxBoxSizer( wxHORIZONTAL ); - m_staticText1 = new wxStaticText( this, wxID_ANY, _("Text:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText1->Wrap( -1 ); - bTextValueBoxSizer->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + m_textLabel = new wxStaticText( this, wxID_ANY, _("Text:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_textLabel->Wrap( -1 ); + bTextValueBoxSizer->Add( m_textLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); m_TextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bTextValueBoxSizer->Add( m_TextCtrl, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + bTextValueBoxSizer->Add( m_TextCtrl, 1, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); m_StyledTextCtrl = new wxStyledTextCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN, wxEmptyString ); m_StyledTextCtrl->SetUseTabs( true ); @@ -67,13 +67,13 @@ DIALOG_LIB_EDIT_TEXT_BASE::DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindow m_PowerComponentValues->Wrap( -1 ); m_PowerComponentValues->SetFont( wxFont( 11, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) ); - bTextValueBoxSizer->Add( m_PowerComponentValues, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bTextValueBoxSizer->Add( m_PowerComponentValues, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - m_TextValueSelectButton = new wxButton( this, wxID_ANY, _("Select"), wxDefaultPosition, wxDefaultSize, 0 ); + m_TextValueSelectButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); bTextValueBoxSizer->Add( m_TextValueSelectButton, 0, wxALIGN_CENTER_VERTICAL, 5 ); - bUpperBoxSizer->Add( bTextValueBoxSizer, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + bUpperBoxSizer->Add( bTextValueBoxSizer, 1, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 ); bPropertiesSizer->Add( bUpperBoxSizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); diff --git a/eeschema/dialogs/dialog_lib_edit_text_base.fbp b/eeschema/dialogs/dialog_lib_edit_text_base.fbp index ede9b71637..cd7bc57f94 100644 --- a/eeschema/dialogs/dialog_lib_edit_text_base.fbp +++ b/eeschema/dialogs/dialog_lib_edit_text_base.fbp @@ -79,7 +79,7 @@ none 5 - wxEXPAND|wxTOP|wxBOTTOM + wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT 1 @@ -127,7 +127,7 @@ 0 1 - m_staticText1 + m_textLabel 1 @@ -149,7 +149,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + wxALIGN_CENTER_VERTICAL|wxLEFT 1 1 @@ -281,7 +281,7 @@ 5 - wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxLEFT 0 1 @@ -340,11 +340,11 @@ -1 - + 5 wxALIGN_CENTER_VERTICAL 0 - + 1 1 1 @@ -377,7 +377,7 @@ 0 0 wxID_ANY - Select + Select... 0 @@ -400,7 +400,7 @@ 1 - + ; ; forward_declare 0 diff --git a/eeschema/dialogs/dialog_lib_edit_text_base.h b/eeschema/dialogs/dialog_lib_edit_text_base.h index 545b755cd4..67e5b726e8 100644 --- a/eeschema/dialogs/dialog_lib_edit_text_base.h +++ b/eeschema/dialogs/dialog_lib_edit_text_base.h @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -39,11 +40,11 @@ class DIALOG_LIB_EDIT_TEXT_BASE : public DIALOG_SHIM private: protected: - wxStaticText* m_staticText1; + wxStaticText* m_textLabel; wxTextCtrl* m_TextCtrl; wxStyledTextCtrl* m_StyledTextCtrl; wxStaticText* m_PowerComponentValues; - wxButton* m_TextValueSelectButton; + wxBitmapButton* m_TextValueSelectButton; wxCheckBox* m_visible; wxStaticText* m_xPosLabel; wxTextCtrl* m_xPosCtrl;