From 8145a8c067e18a6307951bf5135df156d253d73b Mon Sep 17 00:00:00 2001 From: Brian Sidebotham Date: Fri, 7 Mar 2014 17:52:43 +0000 Subject: [PATCH] Changes --- eeschema/dialogs/dialog_eeschema_options.cpp | 119 +-- eeschema/dialogs/dialog_eeschema_options.h | 13 +- .../dialogs/dialog_eeschema_options_base.cpp | 156 +-- .../dialogs/dialog_eeschema_options_base.fbp | 971 +++++------------- .../dialogs/dialog_eeschema_options_base.h | 32 +- eeschema/eeschema_config.cpp | 9 +- 6 files changed, 357 insertions(+), 943 deletions(-) diff --git a/eeschema/dialogs/dialog_eeschema_options.cpp b/eeschema/dialogs/dialog_eeschema_options.cpp index 14424143c6..3dce163983 100644 --- a/eeschema/dialogs/dialog_eeschema_options.cpp +++ b/eeschema/dialogs/dialog_eeschema_options.cpp @@ -37,6 +37,25 @@ DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS( wxWindow* parent ) : { m_choiceUnits->SetFocus(); m_sdbSizer1OK->SetDefault(); + + wxListItem col0; + col0.SetId( 0 ); + col0.SetText( _( "ID" ) ); + col0.SetWidth( 50 ); + + wxListItem col1; + col1.SetId( 1 ); + col1.SetText( _( "Name" ) ); + col1.SetWidth( 150 ); + + wxListItem col2; + col2.SetId( 2 ); + col2.SetText( _( "Default Value" ) ); + col2.SetWidth( 250 ); + + templateFieldListCtrl->InsertColumn( 0, col0 ); + templateFieldListCtrl->InsertColumn( 1, col1 ); + templateFieldListCtrl->InsertColumn( 2, col2 ); } @@ -120,88 +139,32 @@ void DIALOG_EESCHEMA_OPTIONS::SetGridSizes( const GRIDS& grid_sizes, int grid_id m_choiceGridSize->SetSelection( select ); } -void DIALOG_EESCHEMA_OPTIONS::SetFieldName( int aNdx, wxString aName ) + +void DIALOG_EESCHEMA_OPTIONS::OnAddButtonClick( wxCommandEvent& event ) { - switch( aNdx ) + long itemindex = templateFieldListCtrl->InsertItem( 0, wxT( "ID" ) ); + templateFieldListCtrl->SetItem( itemindex, 1, wxT( "Next Fieldname" ) ); + templateFieldListCtrl->SetItem( itemindex, 2, wxT( "A Default value" ) ); + + event.Skip(); +} + + +void DIALOG_EESCHEMA_OPTIONS::SetTemplateFields( const TEMPLATE_FIELDNAMES& aFields ) +{ + printf( "SetTemplateFields %d\n", aFields.size() ); + + for( size_t i = 0; i < aFields.size(); i++ ) { - case 0: - m_fieldName1->SetValue( aName ); - break; - - case 1: - m_fieldName2->SetValue( aName ); - break; - - case 2: - m_fieldName3->SetValue( aName ); - break; - - case 3: - m_fieldName4->SetValue( aName ); - break; - - case 4: - m_fieldName5->SetValue( aName ); - break; - - case 5: - m_fieldName6->SetValue( aName ); - break; - - case 6: - m_fieldName7->SetValue( aName ); - break; - - case 7: - m_fieldName8->SetValue( aName ); - break; - - default: - break; + long itemindex = templateFieldListCtrl->InsertItem( 0, wxT( "?" ) ); + templateFieldListCtrl->SetItem( itemindex, 1, aFields[i].m_Name ); + templateFieldListCtrl->SetItem( itemindex, 2, aFields[i].m_Value ); } } -wxString DIALOG_EESCHEMA_OPTIONS::GetFieldName( int aNdx ) + +TEMPLATE_FIELDNAMES* DIALOG_EESCHEMA_OPTIONS::GetTemplateFields( void ) { - wxString nme; - - switch ( aNdx ) - { - case 0: - nme = m_fieldName1->GetValue(); - break; - - case 1: - nme = m_fieldName2->GetValue(); - break; - - case 2: - nme = m_fieldName3->GetValue(); - break; - - case 3: - nme = m_fieldName4->GetValue(); - break; - - case 4: - nme = m_fieldName5->GetValue(); - break; - - case 5: - nme = m_fieldName6->GetValue(); - break; - - case 6: - nme = m_fieldName7->GetValue(); - break; - - case 7: - nme = m_fieldName8->GetValue(); - break; - - default: - break; - } - - return nme; + return &templateFields; } + diff --git a/eeschema/dialogs/dialog_eeschema_options.h b/eeschema/dialogs/dialog_eeschema_options.h index 01ce909728..1eaca0ec0a 100644 --- a/eeschema/dialogs/dialog_eeschema_options.h +++ b/eeschema/dialogs/dialog_eeschema_options.h @@ -32,9 +32,15 @@ #define __dialog_eeschema_options__ #include +#include class DIALOG_EESCHEMA_OPTIONS : public DIALOG_EESCHEMA_OPTIONS_BASE { +protected: + TEMPLATE_FIELDNAMES templateFields; + + void OnAddButtonClick( wxCommandEvent& event ); + public: DIALOG_EESCHEMA_OPTIONS( wxWindow* parent ); @@ -121,11 +127,8 @@ public: void SetShowPageLimits( bool show ) { m_checkPageLimits->SetValue( show ); } bool GetShowPageLimits( void ) { return m_checkPageLimits->GetValue(); } - /** Set the field \a aNdx textctrl to \a aName */ - void SetFieldName( int aNdx, wxString aName ); - - /** Get the field \a aNdx name from the fields textctrl */ - wxString GetFieldName( int aNdx ); + void SetTemplateFields( const TEMPLATE_FIELDNAMES& aFields ); + TEMPLATE_FIELDNAMES* GetTemplateFields( void ); private: void OnMiddleBtnPanEnbl( wxCommandEvent& event ) diff --git a/eeschema/dialogs/dialog_eeschema_options_base.cpp b/eeschema/dialogs/dialog_eeschema_options_base.cpp index ce75352bda..39b271f70b 100644 --- a/eeschema/dialogs/dialog_eeschema_options_base.cpp +++ b/eeschema/dialogs/dialog_eeschema_options_base.cpp @@ -12,6 +12,8 @@ BEGIN_EVENT_TABLE( DIALOG_EESCHEMA_OPTIONS_BASE, DIALOG_SHIM ) EVT_CHOICE( wxID_ANY, DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnChooseUnits ) EVT_CHECKBOX( xwID_ANY, DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnMiddleBtnPanEnbl ) + EVT_BUTTON( wxID_ADD_FIELD, DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnAddButtonClick ) + EVT_BUTTON( wxID_DELETE_FIELD, DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnDeleteButtonClick ) END_EVENT_TABLE() DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) @@ -212,153 +214,16 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx wxBoxSizer* bSizer6; bSizer6 = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* bSizer8; - bSizer8 = new wxBoxSizer( wxVERTICAL ); - - m_staticText211 = new wxStaticText( m_panel2, wxID_ANY, _("Please enter fieldnames which you want presented in the component fieldname (property) editors. Names may not include (, ), or \" characters."), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText211->Wrap( 400 ); - bSizer8->Add( m_staticText211, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); - - - bSizer6->Add( bSizer8, 0, wxEXPAND, 5 ); - - wxBoxSizer* bSizer7; - bSizer7 = new wxBoxSizer( wxVERTICAL ); - - wxFlexGridSizer* fgSizer2; - fgSizer2 = new wxFlexGridSizer( 8, 2, 0, 0 ); - fgSizer2->AddGrowableCol( 1 ); - fgSizer2->SetFlexibleDirection( wxHORIZONTAL ); - fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - m_staticText15 = new wxStaticText( m_panel2, wxID_ANY, _("Custom field 1"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText15->Wrap( -1 ); - fgSizer2->Add( m_staticText15, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 3 ); - - m_fieldName1 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_fieldName1->SetMaxLength( 0 ); - fgSizer2->Add( m_fieldName1, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); - - m_staticText161 = new wxStaticText( m_panel2, wxID_ANY, _("Custom field 2"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText161->Wrap( -1 ); - fgSizer2->Add( m_staticText161, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 3 ); - - m_fieldName2 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_fieldName2->SetMaxLength( 0 ); - fgSizer2->Add( m_fieldName2, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); - - m_staticText17 = new wxStaticText( m_panel2, wxID_ANY, _("Custom field 3"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText17->Wrap( -1 ); - fgSizer2->Add( m_staticText17, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 3 ); - - m_fieldName3 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_fieldName3->SetMaxLength( 0 ); - fgSizer2->Add( m_fieldName3, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); - - m_staticText18 = new wxStaticText( m_panel2, wxID_ANY, _("Custom field 4"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText18->Wrap( -1 ); - fgSizer2->Add( m_staticText18, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 3 ); - - m_fieldName4 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_fieldName4->SetMaxLength( 0 ); - fgSizer2->Add( m_fieldName4, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); - - m_staticText19 = new wxStaticText( m_panel2, wxID_ANY, _("Custom field 5"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText19->Wrap( -1 ); - fgSizer2->Add( m_staticText19, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 3 ); - - m_fieldName5 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_fieldName5->SetMaxLength( 0 ); - fgSizer2->Add( m_fieldName5, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); - - m_staticText20 = new wxStaticText( m_panel2, wxID_ANY, _("Custom field 6"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText20->Wrap( -1 ); - fgSizer2->Add( m_staticText20, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 3 ); - - m_fieldName6 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_fieldName6->SetMaxLength( 0 ); - fgSizer2->Add( m_fieldName6, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); - - m_staticText21 = new wxStaticText( m_panel2, wxID_ANY, _("Custom field 7"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText21->Wrap( -1 ); - fgSizer2->Add( m_staticText21, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 3 ); - - m_fieldName7 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_fieldName7->SetMaxLength( 0 ); - fgSizer2->Add( m_fieldName7, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); - - m_staticText22 = new wxStaticText( m_panel2, wxID_ANY, _("Custom field 8"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText22->Wrap( -1 ); - fgSizer2->Add( m_staticText22, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 3 ); - - m_fieldName8 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_fieldName8->SetMaxLength( 0 ); - fgSizer2->Add( m_fieldName8, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); - - - bSizer7->Add( fgSizer2, 1, wxALIGN_CENTER|wxEXPAND, 5 ); - - - bSizer6->Add( bSizer7, 1, wxALL|wxEXPAND, 12 ); - - wxBoxSizer* bSizer9; - bSizer9 = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer* bSizer10; - bSizer10 = new wxBoxSizer( wxVERTICAL ); - - templateFieldListCtrl = new wxListCtrl( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_ICON ); + templateFieldListCtrl = new wxListCtrl( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_VRULES ); templateFieldListCtrl->SetMinSize( wxSize( 220,-1 ) ); - bSizer10->Add( templateFieldListCtrl, 0, wxALL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 8 ); + bSizer6->Add( templateFieldListCtrl, 1, wxALIGN_TOP|wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 8 ); - addFieldButton = new wxButton( m_panel2, wxID_ANY, _("MyButton"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer10->Add( addFieldButton, 0, wxALL, 5 ); + addFieldButton = new wxButton( m_panel2, wxID_ADD_FIELD, _("Add"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer6->Add( addFieldButton, 0, wxALL|wxEXPAND, 5 ); - deleteFieldButton = new wxButton( m_panel2, wxID_ANY, _("MyButton"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer10->Add( deleteFieldButton, 0, wxALL, 5 ); - - - bSizer9->Add( bSizer10, 1, wxEXPAND, 5 ); - - wxBoxSizer* bSizer11; - bSizer11 = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizer12; - bSizer12 = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText27 = new wxStaticText( m_panel2, wxID_ANY, _("Name"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText27->Wrap( -1 ); - bSizer12->Add( m_staticText27, 0, wxALL, 5 ); - - fieldName = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fieldName->SetMinSize( wxSize( 220,-1 ) ); - - bSizer12->Add( fieldName, 0, wxALL, 5 ); - - - bSizer11->Add( bSizer12, 1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); - - wxBoxSizer* bSizer13; - bSizer13 = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText28 = new wxStaticText( m_panel2, wxID_ANY, _("Default Value"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText28->Wrap( -1 ); - bSizer13->Add( m_staticText28, 0, wxALL, 5 ); - - fieldDefault = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fieldDefault->SetMinSize( wxSize( 220,-1 ) ); - - bSizer13->Add( fieldDefault, 0, wxALL, 5 ); - - - bSizer11->Add( bSizer13, 1, wxEXPAND, 5 ); - - - bSizer9->Add( bSizer11, 1, wxEXPAND, 5 ); - - - bSizer6->Add( bSizer9, 1, wxEXPAND, 5 ); + deleteFieldButton = new wxButton( m_panel2, wxID_DELETE_FIELD, _("Delete"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer6->Add( deleteFieldButton, 0, wxALL|wxEXPAND, 5 ); m_panel2->SetSizer( bSizer6 ); @@ -366,7 +231,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx bSizer6->Fit( m_panel2 ); m_notebook1->AddPage( m_panel2, _("Template Field Names"), true ); - bOptionsSizer->Add( m_notebook1, 1, wxEXPAND, 0 ); + bOptionsSizer->Add( m_notebook1, 1, wxALL|wxEXPAND, 5 ); m_sdbSizer1 = new wxStdDialogButtonSizer(); m_sdbSizer1OK = new wxButton( this, wxID_OK ); @@ -375,7 +240,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); m_sdbSizer1->Realize(); - bOptionsSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 6 ); + bOptionsSizer->Add( m_sdbSizer1, 0, wxALIGN_BOTTOM|wxALL|wxEXPAND, 6 ); mainSizer->Add( bOptionsSizer, 1, wxEXPAND, 12 ); @@ -383,6 +248,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx this->SetSizer( mainSizer ); this->Layout(); + mainSizer->Fit( this ); this->Centre( wxBOTH ); } diff --git a/eeschema/dialogs/dialog_eeschema_options_base.fbp b/eeschema/dialogs/dialog_eeschema_options_base.fbp index 892de3e244..78a506a726 100644 --- a/eeschema/dialogs/dialog_eeschema_options_base.fbp +++ b/eeschema/dialogs/dialog_eeschema_options_base.fbp @@ -42,7 +42,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE - 508,560 + -1,-1 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Schematic Editor Options @@ -101,8 +101,8 @@ wxVERTICAL none - 0 - wxEXPAND + 5 + wxALL|wxEXPAND 1 1 @@ -186,7 +186,7 @@ General Options 0 - + 1 1 1 @@ -260,16 +260,16 @@ - + p1mainSizer wxHORIZONTAL none - + 6 wxALL|wxEXPAND 1 - + bSizer3 wxVERTICAL @@ -2606,7 +2606,7 @@ - + 0 wxEXPAND 0 @@ -3490,688 +3490,285 @@ bSizer6 wxVERTICAL none - + + 8 + wxALIGN_TOP|wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + 220,-1 + 1 + templateFieldListCtrl + 1 + + + protected + 1 + + Resizable + 1 + + wxLC_HRULES|wxLC_REPORT|wxLC_VRULES + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 wxALL|wxEXPAND - 1 - + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ADD_FIELD + Add + + 0 + + + 0 - bSizer9 - wxHORIZONTAL - none - - 5 - wxEXPAND - 1 - - - bSizer10 - wxVERTICAL - none - - 8 - wxALL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP - 3 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - 220,-1 - 1 - templateFieldListCtrl - 1 - - - protected - 1 - - Resizable - 1 - - wxLC_HRULES|wxLC_VRULES - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - MyButton - - 0 - - - 0 - - 1 - addFieldButton - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - MyButton - - 0 - - - 0 - - 1 - deleteFieldButton - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - - bSizer11 - wxVERTICAL - none - - 5 - wxLEFT|wxRIGHT|wxTOP - 1 - - - bSizer12 - wxHORIZONTAL - none - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Name - - 0 - - - 0 - - 1 - m_staticText27 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - 220,-1 - 1 - fieldName - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxLEFT|wxRIGHT|wxTOP - 1 - - - bSizer13 - wxHORIZONTAL - none - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Default Value - - 0 - - - 0 - - 1 - m_staticText28 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - 220,-1 - 1 - fieldDefault - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 1 + addFieldButton + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnAddButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_DELETE_FIELD + Delete + + 0 + + + 0 + + 1 + deleteFieldButton + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnDeleteButtonClick + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eeschema/dialogs/dialog_eeschema_options_base.h b/eeschema/dialogs/dialog_eeschema_options_base.h index 2ad172523f..d9bb8cee08 100644 --- a/eeschema/dialogs/dialog_eeschema_options_base.h +++ b/eeschema/dialogs/dialog_eeschema_options_base.h @@ -29,7 +29,6 @@ class DIALOG_SHIM; #include #include #include -#include #include #include #include @@ -48,13 +47,17 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM // Private event handlers void _wxFB_OnChooseUnits( wxCommandEvent& event ){ OnChooseUnits( event ); } void _wxFB_OnMiddleBtnPanEnbl( wxCommandEvent& event ){ OnMiddleBtnPanEnbl( event ); } + void _wxFB_OnAddButtonClick( wxCommandEvent& event ){ OnAddButtonClick( event ); } + void _wxFB_OnDeleteButtonClick( wxCommandEvent& event ){ OnDeleteButtonClick( event ); } protected: enum { ID_M_SPINAUTOSAVEINTERVAL = 1000, - xwID_ANY + xwID_ANY, + wxID_ADD_FIELD, + wxID_DELETE_FIELD }; wxNotebook* m_notebook1; @@ -96,30 +99,9 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM wxCheckBox* m_checkHVOrientation; wxCheckBox* m_checkPageLimits; wxPanel* m_panel2; - wxStaticText* m_staticText211; - wxStaticText* m_staticText15; - wxTextCtrl* m_fieldName1; - wxStaticText* m_staticText161; - wxTextCtrl* m_fieldName2; - wxStaticText* m_staticText17; - wxTextCtrl* m_fieldName3; - wxStaticText* m_staticText18; - wxTextCtrl* m_fieldName4; - wxStaticText* m_staticText19; - wxTextCtrl* m_fieldName5; - wxStaticText* m_staticText20; - wxTextCtrl* m_fieldName6; - wxStaticText* m_staticText21; - wxTextCtrl* m_fieldName7; - wxStaticText* m_staticText22; - wxTextCtrl* m_fieldName8; wxListCtrl* templateFieldListCtrl; wxButton* addFieldButton; wxButton* deleteFieldButton; - wxStaticText* m_staticText27; - wxTextCtrl* fieldName; - wxStaticText* m_staticText28; - wxTextCtrl* fieldDefault; wxStdDialogButtonSizer* m_sdbSizer1; wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1Cancel; @@ -127,11 +109,13 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM // Virtual event handlers, overide them in your derived class virtual void OnChooseUnits( wxCommandEvent& event ) { event.Skip(); } virtual void OnMiddleBtnPanEnbl( wxCommandEvent& event ) { event.Skip(); } + virtual void OnAddButtonClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnDeleteButtonClick( wxCommandEvent& event ) { event.Skip(); } public: - DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Schematic Editor Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 508,560 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Schematic Editor Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_EESCHEMA_OPTIONS_BASE(); }; diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 43e5ec21e3..511832cc00 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -287,7 +287,8 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event ) dlg.Layout(); dlg.Fit(); dlg.SetMinSize( dlg.GetSize() ); - + dlg.SetTemplateFields( m_TemplateFieldNames.GetTemplateFieldNames() ); +/* const TEMPLATE_FIELDNAMES& tfnames = m_TemplateFieldNames.GetTemplateFieldNames(); for( unsigned i=0; iRefresh( true ); }