diff --git a/eeschema/dialogs/dialog_eeschema_options.cpp b/eeschema/dialogs/dialog_eeschema_options.cpp index 2dddd1ac78..8fa5e10eb4 100644 --- a/eeschema/dialogs/dialog_eeschema_options.cpp +++ b/eeschema/dialogs/dialog_eeschema_options.cpp @@ -72,15 +72,15 @@ DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS( wxWindow* parent ) : selectedField = -1; ignoreSelection = false; - // Set the html help for th template editor - m_htmlWin2->SetPage( - _( "Template Field Names
" - "

Field names must be unique, and should be alpha-numeric only

" - "

Some field names are reserved and cannot be used. The following fieldnames are " - "reserved:

" ) ); - // Make sure we select the first tab of the options tab page m_notebook1->SetSelection( 0 ); + + // Connect the edit controls for the template field names to the kill focus event which + // doesn't propogate, hence the need to connect it here. + + fieldNameTextCtrl->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_EESCHEMA_OPTIONS::OnEditControlKillFocus ), NULL, this ); + fieldDefaultValueTextCtrl->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_EESCHEMA_OPTIONS::OnEditControlKillFocus ), NULL, this ); + fieldVisibleCheckbox->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_EESCHEMA_OPTIONS::OnEditControlKillFocus ), NULL, this ); } @@ -262,6 +262,14 @@ void DIALOG_EESCHEMA_OPTIONS::copyPanelToSelected( void ) } +void DIALOG_EESCHEMA_OPTIONS::OnEditControlKillFocus( wxFocusEvent& event ) +{ + // Update the data + UI + copyPanelToSelected(); + RefreshTemplateFieldView(); +} + + void DIALOG_EESCHEMA_OPTIONS::copySelectedToPanel( void ) { if( ( selectedField < 0 ) || ( selectedField >= templateFields.size() ) ) diff --git a/eeschema/dialogs/dialog_eeschema_options.h b/eeschema/dialogs/dialog_eeschema_options.h index 2876d21f21..3319258737 100644 --- a/eeschema/dialogs/dialog_eeschema_options.h +++ b/eeschema/dialogs/dialog_eeschema_options.h @@ -71,6 +71,7 @@ protected: */ void OnDeleteButtonClick( wxCommandEvent& event ); void OnInitDialog( wxInitDialogEvent& event ); + void OnEditControlKillFocus( wxFocusEvent& event ); /** * Function copyPanelToSelected diff --git a/eeschema/dialogs/dialog_eeschema_options_base.cpp b/eeschema/dialogs/dialog_eeschema_options_base.cpp index b834a98e6a..1600c43ed3 100644 --- a/eeschema/dialogs/dialog_eeschema_options_base.cpp +++ b/eeschema/dialogs/dialog_eeschema_options_base.cpp @@ -223,7 +223,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx bSizer6->Add( templateFieldListCtrl, 1, wxALIGN_TOP|wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 8 ); wxStaticBoxSizer* fieldSizer; - fieldSizer = new wxStaticBoxSizer( new wxStaticBox( m_panel2, wxID_ANY, _("Field") ), wxVERTICAL ); + fieldSizer = new wxStaticBoxSizer( new wxStaticBox( m_panel2, wxID_ANY, _("Field Settings") ), wxVERTICAL ); fieldNameLabel = new wxStaticText( m_panel2, wxID_ANY, _("Name"), wxDefaultPosition, wxDefaultSize, 0 ); fieldNameLabel->Wrap( -1 ); @@ -242,11 +242,8 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx fieldVisibleCheckbox = new wxCheckBox( m_panel2, wxID_ANY, _("Visible"), wxDefaultPosition, wxDefaultSize, 0 ); fieldSizer->Add( fieldVisibleCheckbox, 0, wxALL, 5 ); - m_htmlWin2 = new wxHtmlWindow( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO ); - fieldSizer->Add( m_htmlWin2, 1, wxALL|wxEXPAND, 5 ); - - bSizer6->Add( fieldSizer, 1, wxEXPAND, 5 ); + bSizer6->Add( fieldSizer, 0, wxEXPAND, 5 ); addFieldButton = new wxButton( m_panel2, wxID_ADD_FIELD, _("Add"), wxDefaultPosition, wxDefaultSize, 0 ); bSizer6->Add( addFieldButton, 0, wxALL|wxEXPAND, 5 ); diff --git a/eeschema/dialogs/dialog_eeschema_options_base.fbp b/eeschema/dialogs/dialog_eeschema_options_base.fbp index 4ce88cd812..a8db4f6c6f 100644 --- a/eeschema/dialogs/dialog_eeschema_options_base.fbp +++ b/eeschema/dialogs/dialog_eeschema_options_base.fbp @@ -1961,7 +1961,7 @@ protected 1 - Resizable + Fixed 1 @@ -3607,10 +3607,10 @@ 5 wxEXPAND - 1 + 0 wxID_ANY - Field + Field Settings fieldSizer wxVERTICAL @@ -4052,90 +4052,6 @@ - - 5 - wxALL|wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_htmlWin2 - 1 - - - protected - 1 - - Resizable - 1 - - wxHW_SCROLLBAR_AUTO - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eeschema/dialogs/dialog_eeschema_options_base.h b/eeschema/dialogs/dialog_eeschema_options_base.h index 9e91572fc6..53381bd668 100644 --- a/eeschema/dialogs/dialog_eeschema_options_base.h +++ b/eeschema/dialogs/dialog_eeschema_options_base.h @@ -31,7 +31,6 @@ class DIALOG_SHIM; #include #include #include -#include #include #include #include @@ -111,7 +110,6 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM wxStaticText* fieldDefaultValueLabel; wxTextCtrl* fieldDefaultValueTextCtrl; wxCheckBox* fieldVisibleCheckbox; - wxHtmlWindow* m_htmlWin2; wxButton* addFieldButton; wxButton* deleteFieldButton; wxStdDialogButtonSizer* m_sdbSizer1;