diff --git a/eeschema/dialogs/dialog_eeschema_options.cpp b/eeschema/dialogs/dialog_eeschema_options.cpp index 14424143c6..10d2df9a31 100644 --- a/eeschema/dialogs/dialog_eeschema_options.cpp +++ b/eeschema/dialogs/dialog_eeschema_options.cpp @@ -31,12 +31,57 @@ #include +#include "wx/settings.h" DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS( wxWindow* parent ) : DIALOG_EESCHEMA_OPTIONS_BASE( parent ) { m_choiceUnits->SetFocus(); m_sdbSizer1OK->SetDefault(); + + // Dialog should not shrink beyond it's minimal size. + GetSizer()->SetSizeHints( this ); + + wxListItem col0; + col0.SetId( 0 ); + col0.SetText( _( "Field Name" ) ); + + wxListItem col1; + col1.SetId( 1 ); + col1.SetText( _( "Default Value" ) ); + + wxListItem col2; + col2.SetId( 2 ); + col2.SetText( _( "Visible" ) ); + + templateFieldListCtrl->InsertColumn( 0, col0 ); + templateFieldListCtrl->InsertColumn( 1, col1 ); + templateFieldListCtrl->InsertColumn( 2, col2 ); + + templateFieldListCtrl->SetColumnWidth( 0, templateFieldListCtrl->GetSize().GetWidth() / 3.5 ); + templateFieldListCtrl->SetColumnWidth( 1, templateFieldListCtrl->GetSize().GetWidth() / 3.5 ); + templateFieldListCtrl->SetColumnWidth( 2, templateFieldListCtrl->GetSize().GetWidth() / 3.5 ); + + // Invalid field selected and don't ignore selection events because + // they'll be from the user + selectedField = 0; + selectionValid = false; + ignoreSelection = false; + + // 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 ); } @@ -49,6 +94,7 @@ void DIALOG_EESCHEMA_OPTIONS::SetUnits( const wxArrayString& units, int select ) m_choiceUnits->SetSelection( select ); } + void DIALOG_EESCHEMA_OPTIONS::SetRefIdSeparator( wxChar aSep, wxChar aFirstId) { // m_choiceSeparatorRefId displays one of @@ -101,107 +147,196 @@ void DIALOG_EESCHEMA_OPTIONS::GetRefIdSeparator( int& aSep, int& aFirstId) } -void DIALOG_EESCHEMA_OPTIONS::SetGridSizes( const GRIDS& grid_sizes, int grid_id ) +void DIALOG_EESCHEMA_OPTIONS::SetGridSizes( const GRIDS& aGridSizes, int aGridId ) { - wxASSERT( grid_sizes.size() > 0 ); + wxASSERT( aGridSizes.size() > 0 ); int select = wxNOT_FOUND; - for( size_t i = 0; i < grid_sizes.size(); i++ ) + for( size_t i = 0; i < aGridSizes.size(); i++ ) { wxString tmp; - tmp.Printf( wxT( "%0.1f" ), grid_sizes[i].m_Size.x ); + tmp.Printf( wxT( "%0.1f" ), aGridSizes[i].m_Size.x ); m_choiceGridSize->Append( tmp ); - if( grid_sizes[i].m_Id == grid_id ) + if( aGridSizes[i].m_Id == aGridId ) select = (int) i; } m_choiceGridSize->SetSelection( select ); } -void DIALOG_EESCHEMA_OPTIONS::SetFieldName( int aNdx, wxString aName ) + +void DIALOG_EESCHEMA_OPTIONS::RefreshTemplateFieldView( void ) { - switch( aNdx ) + // Delete all items in the template field list control and add all of the + // current template fields + templateFieldListCtrl->DeleteAllItems(); + + // Loop through the template fieldnames and add then to the list control + for( TEMPLATE_FIELDNAMES::iterator fld = templateFields.begin(); + fld != templateFields.end(); ++fld ) { - case 0: - m_fieldName1->SetValue( aName ); - break; + long itemindex = templateFieldListCtrl->InsertItem( + templateFieldListCtrl->GetItemCount(), fld->m_Name ); - case 1: - m_fieldName2->SetValue( aName ); - break; + templateFieldListCtrl->SetItem( itemindex, 1, fld->m_Value ); - 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; + templateFieldListCtrl->SetItem( itemindex, 2, + ( fld->m_Visible == true ) ? _( "Visible" ) : _( "Hidden" ) ); } } -wxString DIALOG_EESCHEMA_OPTIONS::GetFieldName( int aNdx ) + +void DIALOG_EESCHEMA_OPTIONS::SelectTemplateField( int aItem ) { - wxString nme; + // Only select valid items! + if( !selectionValid || ( aItem >= templateFieldListCtrl->GetItemCount() ) ) + return; - switch ( aNdx ) + // Make sure we select the new item + ignoreSelection = true; + templateFieldListCtrl->SetItemState( aItem, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); +} + + +void DIALOG_EESCHEMA_OPTIONS::OnAddButtonClick( wxCommandEvent& event ) +{ + // If there is currently a valid selection, copy the edit panel to the + // selected field so as not to lose the data + if( selectionValid && ( selectedField < templateFields.size() ) ) + copyPanelToSelected(); + + // Add a new fieldname to the fieldname list + TEMPLATE_FIELDNAME newFieldname = TEMPLATE_FIELDNAME( "Fieldname" ); + newFieldname.m_Value = wxT( "Value" ); + newFieldname.m_Visible = false; + templateFields.push_back( newFieldname ); + + // Select the newly added field and then copy that data to the edit panel. + // Make sure any previously selected state is cleared and then select the + // new field + selectedField = templateFields.size() - 1; + selectionValid = true; + + // Update the display to reflect the new data + RefreshTemplateFieldView(); + copySelectedToPanel(); + + // Make sure we select the new item + SelectTemplateField( selectedField ); + + event.Skip(); +} + + +void DIALOG_EESCHEMA_OPTIONS::OnDeleteButtonClick( wxCommandEvent& event ) +{ + // If there is currently a valid selection, delete the template field from + // the template field list + if( selectionValid && ( selectedField < templateFields.size() ) ) { - case 0: - nme = m_fieldName1->GetValue(); - break; + // Delete the fieldname from the fieldname list + templateFields.erase( templateFields.begin() + selectedField ); - case 1: - nme = m_fieldName2->GetValue(); - break; + // If the selectedField is still not in the templateField range now, + // make sure we stay in range and when there are no fields present + // move to -1 + if( selectedField >= templateFields.size() ) + selectedField = templateFields.size() - 1; - case 2: - nme = m_fieldName3->GetValue(); - break; + // Update the display to reflect the new data + RefreshTemplateFieldView(); + copySelectedToPanel(); - 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; + // Make sure after the refresh that the selected item is correct + SelectTemplateField( selectedField ); } - return nme; + event.Skip(); } + +void DIALOG_EESCHEMA_OPTIONS::copyPanelToSelected( void ) +{ + if( !selectionValid || ( selectedField >= templateFields.size() ) ) + return; + + // Update the template field from the edit panel + templateFields[selectedField].m_Name = fieldNameTextCtrl->GetValue(); + templateFields[selectedField].m_Value = fieldDefaultValueTextCtrl->GetValue(); + templateFields[selectedField].m_Visible = fieldVisibleCheckbox->GetValue(); +} + + +void DIALOG_EESCHEMA_OPTIONS::OnEditControlKillFocus( wxFocusEvent& event ) +{ + // Update the data + UI + copyPanelToSelected(); + RefreshTemplateFieldView(); + SelectTemplateField( selectedField ); + + event.Skip(); +} + + +void DIALOG_EESCHEMA_OPTIONS::copySelectedToPanel( void ) +{ + if( !selectionValid || ( selectedField >= templateFields.size() ) ) + return; + + // Update the panel data from the selected template field + fieldNameTextCtrl->SetValue( templateFields[selectedField].m_Name ); + fieldDefaultValueTextCtrl->SetValue( templateFields[selectedField].m_Value ); + fieldVisibleCheckbox->SetValue( templateFields[selectedField].m_Visible ); +} + + +void DIALOG_EESCHEMA_OPTIONS::OnTemplateFieldSelected( wxListEvent& event ) +{ + // If the class has generated the event and asked to ignore it, honour that and reset the + // ignore flag for the next user event. + if( ignoreSelection ) + { + ignoreSelection = false; + event.Skip(); + return; + } + + // Before getting the new field data, make sure we save the old! + copyPanelToSelected(); + + // Now update the selected field and copy the data from the field to the + // edit panel + selectedField = event.GetIndex(); + selectionValid = true; + copySelectedToPanel(); + + // Refresh the template field view - this deletes all fields and then + // re-fills the entire data grid. It then re-selects the currently + // selected field. This will be recursive, so disable this event while + // we refresh the view + RefreshTemplateFieldView(); + + // If an item was selected, make sure we re-select it, or at least the + // same position in the grid + SelectTemplateField( selectedField ); + + event.Skip(); +} + + +void DIALOG_EESCHEMA_OPTIONS::SetTemplateFields( const TEMPLATE_FIELDNAMES& aFields ) +{ + // Set the template fields object + templateFields = aFields; + + // Refresh the view + RefreshTemplateFieldView(); +} + + +TEMPLATE_FIELDNAMES DIALOG_EESCHEMA_OPTIONS::GetTemplateFields( void ) +{ + return templateFields; +} + diff --git a/eeschema/dialogs/dialog_eeschema_options.h b/eeschema/dialogs/dialog_eeschema_options.h index 01ce909728..c0fba1709d 100644 --- a/eeschema/dialogs/dialog_eeschema_options.h +++ b/eeschema/dialogs/dialog_eeschema_options.h @@ -32,100 +32,400 @@ #define __dialog_eeschema_options__ #include +#include class DIALOG_EESCHEMA_OPTIONS : public DIALOG_EESCHEMA_OPTIONS_BASE { +protected: + /** @brief The template fieldnames for this dialog */ + TEMPLATE_FIELDNAMES templateFields; + + /** @brief The current row selected in the template fieldname wxListCtrl which is also in the + edit panel */ + size_t selectedField; + + /** @brief The selectedField value is only valid when this bool is set to true */ + bool selectionValid; + + /** @brief Set to true internally when OnTemplateFieldSelected() an event needs to be + ignored */ + bool ignoreSelection; + + /** + * Function OnAddButtonClick + * Process the wxWidgets @a event produced when the user presses the Add buton for the + * template fieldnames control + * + * @param event The wxWidgets produced event information + * + * Adds a new template fieldname (with default values) to the template fieldnames data + */ + + void OnAddButtonClick( wxCommandEvent& event ); + + /** + * Function OnDeleteButtonClick + * Process the wxWidgets @a event produced when the user presses the Delete button for the + * template fieldnames control + * + * @param event The wxWidgets produced event information + * + * Deletes the selected template fieldname from the template fieldnames data + */ + void OnDeleteButtonClick( wxCommandEvent& event ); + + /** + * Function OnEditControlKillFocus + * This Focus Event Handler should be connected to any controls in the template field edit box + * so that any loss of focus results in the data being saved to the currently selected template + * field + * + * @param event The wxWidgets produced event information + * + * Copies data from the edit box to the selected field template + */ + void OnEditControlKillFocus( wxFocusEvent& event ); + + /** + * Function copyPanelToSelected + * Copies the data from the edit panel to the selected template fieldname + */ + void copyPanelToSelected( void ); + + /** + * Function copySelectedToPanel + * Copies the data from the selected template fieldname and fills in the edit panel + */ + void copySelectedToPanel( void ); + + /** + * Function OnTemplateFieldSelected + * Event handler for the wxListCtrl containing the template fieldnames + * + * @param event The event information provided by wxWidgets + * + * Processes data exchange between the edit panel and the selected template fieldname + */ + void OnTemplateFieldSelected( wxListEvent& event ); + + /** + * Function RefreshTemplateFieldView + * Refresh the template fieldname wxListCtrl + * + * Deletes all data from the wxListCtrl and then re-polpulates the control with the data in + * the template fieldnames. + * + * Use any time the template field data has changed + */ + void RefreshTemplateFieldView( void ); + + /** + * Function SelectTemplateField + * Selects @a aItem from the wxListCtrl populated with the template fieldnames + * + * @param aItem The item index of the row to be selected + * + * When RefreshTemplateFieldView() is used the selection is lost because all of the items are + * removed from the wxListCtrl and then the control is re-populated. This function can be used + * to re-select an item that was previously selected so that the selection is not lost. + * + * NOTE: This function first sets the ignoreSelection flag before making the selection. + * This means the class can select something in the wxListCtrl without causing further + * selection events. + */ + void SelectTemplateField( int aItem ); + public: + /** + * Public constructor + * + * @param parent The dialog's parent + */ DIALOG_EESCHEMA_OPTIONS( wxWindow* parent ); - void SetUnits( const wxArrayString& units, int select = 0 ); + /** + * Function GetUnitsSelection + * Returns the currently selected grid size in the dialog + */ int GetUnitsSelection( void ) { return m_choiceUnits->GetSelection(); } - void SetGridSelection( int select ) { m_choiceGridSize->SetSelection( select ); } + /** + * Function SetUnits + * Set the unit options + * + * @param units The array of strings representing the unit options + * @param select The unit to select from the unit options + * + * Appends the @a units options to the list of unit options and selects the @a aSelect option + */ + void SetUnits( const wxArrayString& units, int aSelect = 0 ); + + /** + * Function GetGridSelection + * Returns the curent grid size selected in the dialog + */ int GetGridSelection( void ) { return m_choiceGridSize->GetSelection(); } - void SetGridSizes( const GRIDS& grid_sizes, int grid_id ); - void SetBusWidth( int aWidth ) - { - m_spinBusWidth->SetValue( aWidth ); - } + /** + * Function SetGridSizes + * Sets the available grid size choices @a aGridSizes and selectd the current option @a aGridId + * + * @param aGridSizes The grid sizes that are able to be chosen from + * @param aGridId The grid size to select from the grid size options + */ + void SetGridSizes( const GRIDS& aGridSizes, int aGridId ); - int GetBusWidth( void ) - { - return m_spinBusWidth->GetValue(); - } + /** + * Function GetBusWidth + * Get the current bus width setting from the dialog + */ + int GetBusWidth( void ) { return m_spinBusWidth->GetValue(); } + /** + * Function SetBusWidth + * Sets the bus width setting in the dialog + * + * @param aWidth The bus width to set the dialog edit spinbox with + */ + void SetBusWidth( int aWidth ) { m_spinBusWidth->SetValue( aWidth ); } + + /** + * Function SetLineWidth + * Sets the current LineWidth value in the dialog + * @param aWidth The line width to set in the dialog + */ void SetLineWidth( int aWidth ) { m_spinLineWidth->SetValue( aWidth ); } + + /** + * Function GetLineWidth + * Returns the current LineWidth value from the dialog + */ int GetLineWidth( void ) { return m_spinLineWidth->GetValue(); } + /** + * Function SetTextSize + * Sets the current default TextSize value in the dialog + * @param text_size The text size to set in the dialog + */ void SetTextSize( int text_size ) { m_spinTextSize->SetValue( text_size ); } + + /** + * Function GetTextSize + * Returns the current default TextSize value from the dialog + */ int GetTextSize( void ) { return m_spinTextSize->GetValue(); } + /** + * Function SetRepeatHorizontal + * Sets the current RepeatHorizontal displacement value in the dialog + * @param displacement The displacement to set in the dialog + */ void SetRepeatHorizontal( int displacement ) { m_spinRepeatHorizontal->SetValue( displacement ); } + + /** + * Function GetRepeatHorizontal + * Returns the current RepeatHorizontal displacement value from the dialog + */ int GetRepeatHorizontal( void ) { return m_spinRepeatHorizontal->GetValue(); } + + /** + * Function SetRepeatVertical + * Sets the current RepeatVertical displacement value in the dialog + * @param displacement The displacement to set in the dialog + */ void SetRepeatVertical( int displacement ) { m_spinRepeatVertical->SetValue( displacement ); } + /** + * Function GetRepeatVertical + * Returns the current RepeatVertical displacement value from the dialog + */ int GetRepeatVertical( void ) { return m_spinRepeatVertical->GetValue(); } + + /** + * Function SetRepeatLabel + * Sets the current RepeatLabel increment value in the dialog + * @param increment The increment to set in the dialog + */ void SetRepeatLabel( int increment ) { m_spinRepeatLabel->SetValue( increment ); } + + /** + * Function GetRepeatLabel + * Returns the current RepeatLabel increment value from the dialog + */ int GetRepeatLabel( void ) { return m_spinRepeatLabel->GetValue(); } + /** + * Function SetAutoSaveInterval + * Sets the current AutoSaveInterval value in the dialog + * @param aInterval The interval to set in the dialog + */ void SetAutoSaveInterval( int aInterval ) { m_spinAutoSaveInterval->SetValue( aInterval ); } + + /** + * Function GetAutoSaveInterval + * Returns the current AutoSaveInterval value from the dialog + */ int GetAutoSaveInterval() const { return m_spinAutoSaveInterval->GetValue(); } + /** + * Function SetRefIdSeparator + * Sets the current RefIdSeparator value in the dialog + * @param aSep The seperator to use between the reference and the part ID + * @param aFirstId The first part ID, currently either 'A' or '1' + */ void SetRefIdSeparator( wxChar aSep, wxChar aFirstId); + + /** + * Function GetRefIdSeparator + * Returns the current RefIdSeparator value from the dialog + * @param aSep The OUTPUT seperator value + * @param aFirstId The OUTPUT reference first ID + */ void GetRefIdSeparator( int& aSep, int& aFirstId); + /** + * Function SetShowGrid + * Sets the current ShowGrid value in the dialog + * @param show The ShowGrid value to set in the dialog + */ void SetShowGrid( bool show ) { m_checkShowGrid->SetValue( show ); } + + /** + * Function GetShowGrid + * Returns the current ShowGrid value from the dialog + */ bool GetShowGrid( void ) { return m_checkShowGrid->GetValue(); } + /** + * Function SetShowHiddenPins + * Sets the current ShowHiddenPins value in the dialog + * @param show The ShowHiddenPins value to set in the dialog + */ void SetShowHiddenPins( bool show ) { m_checkShowHiddenPins->SetValue( show ); } + + /** + * Function GetShowHiddenPins + * Returns the current ShowHiddenPins value from the dialog + */ bool GetShowHiddenPins( void ) { return m_checkShowHiddenPins->GetValue(); } + /** + * Function SetEnableZoomNoCenter + * Sets the current ZoomNoCenter value in the dialog + * @param enable The ZoomNoCenter value to set in the dialog + */ void SetEnableZoomNoCenter( bool enable ) { m_checkEnableZoomNoCenter->SetValue( enable ); } + /** + * Function GetEnableZoomNoCenter + * Returns the current ZoomNoCenter value from the dialog + */ bool GetEnableZoomNoCenter( void ) { return m_checkEnableZoomNoCenter->GetValue(); } + + /** + * Function SetEnableMiddleButtonPan + * Sets the current MiddleButtonPan value in the dialog + * + * @param enable The boolean value to set the MiddleButtonPan value in the dialog + */ void SetEnableMiddleButtonPan( bool enable ) { m_checkEnableMiddleButtonPan->SetValue( enable ); m_checkMiddleButtonPanLimited->Enable( enable ); } + /** + * Function GetEnableMiddleButtonPan + * Returns the current MiddleButtonPan setting from the dialog + */ bool GetEnableMiddleButtonPan( void ) { return m_checkEnableMiddleButtonPan->GetValue(); } + + /** + * Function SetMiddleButtonPanLimited + * Sets the MiddleButtonPanLimited value in the dialog + * + * @param enable The boolean value to set the MiddleButtonPanLimted value in the dialog + */ void SetMiddleButtonPanLimited( bool enable ) { m_checkMiddleButtonPanLimited->SetValue( enable ); } + + /** + * Function GetMiddleButtonPanLimited + * Returns the MiddleButtonPanLimited setting from the dialog + */ bool GetMiddleButtonPanLimited( void ) { return m_checkMiddleButtonPanLimited->GetValue(); } + /** + * Function SetEnableAutoPan + * Sets the AutoPan setting in the dialog + * + * @param enable The boolean value to set the AutoPan value in the dialog + */ void SetEnableAutoPan( bool enable ) { m_checkAutoPan->SetValue( enable ); } + + /** + * Function GetEnableAutoPan + * Return the AutoPan setting from the dialog + */ bool GetEnableAutoPan( void ) { return m_checkAutoPan->GetValue(); } + /** + * Function SetEnableHVBusOrientation + * Set the HVBusOrientation setting in the dialog + * + * @param enable The boolean value to set the HVBusOrientation value in the dialog + */ void SetEnableHVBusOrientation( bool enable ) { m_checkHVOrientation->SetValue( enable ); } + + /** + * Function GetEnableHVBusOrientation + * Get the HVBusOrientation setting from the dialog + */ bool GetEnableHVBusOrientation( void ) { return m_checkHVOrientation->GetValue(); } + /** + * Function + * Set the ShowPageLimits setting in the dialog + */ void SetShowPageLimits( bool show ) { m_checkPageLimits->SetValue( show ); } + + /** + * Function + * Return the current ShowPageLimits setting from the dialog + */ bool GetShowPageLimits( void ) { return m_checkPageLimits->GetValue(); } - /** Set the field \a aNdx textctrl to \a aName */ - void SetFieldName( int aNdx, wxString aName ); + /** + * Function SetTemplateFields + * Set the template field data in the dialog + * + * @param aFields The template fieldnames that the dialog should start with before any editing + */ + void SetTemplateFields( const TEMPLATE_FIELDNAMES& aFields ); - /** Get the field \a aNdx name from the fields textctrl */ - wxString GetFieldName( int aNdx ); + /** + * Function GetTemplateFields + * Get the dialog's template field data + * + */ + 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 e921389d25..cbe1dbe6dc 100644 --- a/eeschema/dialogs/dialog_eeschema_options_base.cpp +++ b/eeschema/dialogs/dialog_eeschema_options_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 5 2014) +// C++ code generated with wxFormBuilder (version Jun 6 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -10,8 +10,13 @@ /////////////////////////////////////////////////////////////////////////// BEGIN_EVENT_TABLE( DIALOG_EESCHEMA_OPTIONS_BASE, DIALOG_SHIM ) + EVT_SIZE( DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnSize ) EVT_CHOICE( wxID_ANY, DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnChooseUnits ) EVT_CHECKBOX( xwID_ANY, DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnMiddleBtnPanEnbl ) + EVT_LIST_ITEM_DESELECTED( wxID_ANY, DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnTemplateFieldDeselected ) + EVT_LIST_ITEM_SELECTED( wxID_ANY, DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnTemplateFieldSelected ) + 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 ) @@ -205,109 +210,54 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx m_panel1->SetSizer( p1mainSizer ); m_panel1->Layout(); p1mainSizer->Fit( m_panel1 ); - m_notebook1->AddPage( m_panel1, _("General Options"), true ); + m_notebook1->AddPage( m_panel1, _("General Options"), false ); m_panel2 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_panel2->SetToolTip( _("User defined field names for schematic components. ") ); wxBoxSizer* bSizer6; bSizer6 = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* bSizer8; - bSizer8 = new wxBoxSizer( wxVERTICAL ); + templateFieldListCtrl = new wxListCtrl( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES ); + templateFieldListCtrl->SetMinSize( wxSize( 500,-1 ) ); - 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( templateFieldListCtrl, 1, wxALIGN_TOP|wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 8 ); + + wxStaticBoxSizer* fieldSizer; + 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 ); + fieldSizer->Add( fieldNameLabel, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); + + fieldNameTextCtrl = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fieldSizer->Add( fieldNameTextCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + + fieldDefaultValueLabel = new wxStaticText( m_panel2, wxID_ANY, _("Default Value"), wxDefaultPosition, wxDefaultSize, 0 ); + fieldDefaultValueLabel->Wrap( -1 ); + fieldSizer->Add( fieldDefaultValueLabel, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); + + fieldDefaultValueTextCtrl = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fieldSizer->Add( fieldDefaultValueTextCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + + fieldVisibleCheckbox = new wxCheckBox( m_panel2, wxID_ANY, _("Visible"), wxDefaultPosition, wxDefaultSize, 0 ); + fieldSizer->Add( fieldVisibleCheckbox, 0, wxALL, 5 ); - bSizer6->Add( bSizer8, 0, wxEXPAND, 5 ); + bSizer6->Add( fieldSizer, 0, wxEXPAND, 5 ); - wxBoxSizer* bSizer7; - bSizer7 = new wxBoxSizer( wxVERTICAL ); + addFieldButton = new wxButton( m_panel2, wxID_ADD_FIELD, _("Add"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer6->Add( addFieldButton, 0, wxALL|wxEXPAND, 5 ); - 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 ); + deleteFieldButton = new wxButton( m_panel2, wxID_DELETE_FIELD, _("Delete"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer6->Add( deleteFieldButton, 0, wxALL|wxEXPAND, 5 ); m_panel2->SetSizer( bSizer6 ); m_panel2->Layout(); bSizer6->Fit( m_panel2 ); - m_notebook1->AddPage( m_panel2, _("Template Field Names"), false ); + 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 ); @@ -316,7 +266,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 ); @@ -324,6 +274,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 7739c44ca0..493e01eed1 100644 --- a/eeschema/dialogs/dialog_eeschema_options_base.fbp +++ b/eeschema/dialogs/dialog_eeschema_options_base.fbp @@ -44,8 +44,8 @@ DIALOG_EESCHEMA_OPTIONS_BASE - 508,583 - wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + -1,-1 + wxDEFAULT_DIALOG_STYLE DIALOG_SHIM; dialog_shim.h Schematic Editor Options @@ -86,7 +86,7 @@ - + OnSize @@ -103,8 +103,8 @@ wxVERTICAL none - 0 - wxEXPAND + 5 + wxALL|wxEXPAND 1 1 @@ -187,7 +187,7 @@ General Options - 1 + 0 1 1 @@ -276,11 +276,11 @@ bSizer3 wxVERTICAL none - + 0 wxALIGN_CENTER|wxEXPAND 0 - + 3 wxHORIZONTAL 0,1,2 @@ -727,11 +727,11 @@ - + 3 wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -810,11 +810,11 @@ - + 3 wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND 0 - + 1 1 1 @@ -898,11 +898,11 @@ - + 3 wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -1961,7 +1961,7 @@ protected 1 - Resizable + Fixed 1 @@ -2432,11 +2432,11 @@ - + 5 wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL 0 - + 1 1 1 @@ -2515,11 +2515,11 @@ - + 5 wxALL|wxEXPAND 0 - + 1 1 1 @@ -2603,11 +2603,11 @@ - + 5 wxEXPAND 1 - + 0 protected 0 @@ -2619,16 +2619,16 @@ 0 wxEXPAND 0 - + bSizer2 wxVERTICAL none - + 5 wxEXPAND | wxALL 0 - + 1 1 1 @@ -2881,11 +2881,11 @@ - + 3 wxTOP|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -2969,11 +2969,11 @@ - + 3 wxTOP|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -3057,11 +3057,11 @@ - + 3 wxTOP|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -3419,7 +3419,7 @@ Template Field Names - 0 + 1 1 1 @@ -3500,19 +3500,127 @@ 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 + 500,-1 + 1 + templateFieldListCtrl + 1 + + + protected + 1 + + Resizable + 1 + + wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnTemplateFieldDeselected + + + + OnTemplateFieldSelected + + + + + + + + + + + + + + + + + 5 wxEXPAND 0 - + + wxID_ANY + Field Settings - bSizer8 + fieldSizer wxVERTICAL none - + + 5 - wxALIGN_CENTER_HORIZONTAL|wxALL + wxLEFT|wxRIGHT|wxTOP 0 - + 1 1 1 @@ -3540,7 +3648,7 @@ 0 0 wxID_ANY - Please enter fieldnames which you want presented in the component fieldname (property) editors. Names may not include (, ), or " characters. + Name 0 @@ -3548,7 +3656,7 @@ 0 1 - m_staticText211 + fieldNameLabel 1 @@ -3565,7 +3673,7 @@ - 400 + -1 @@ -3591,1427 +3699,535 @@ + + 5 + wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + fieldNameTextCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxLEFT|wxRIGHT|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Default Value + + 0 + + + 0 + + 1 + fieldDefaultValueLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + fieldDefaultValueTextCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Visible + + 0 + + + 0 + + 1 + fieldVisibleCheckbox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - 12 + 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 - bSizer7 - wxVERTICAL - none - - 5 - wxALIGN_CENTER|wxEXPAND - 1 - - 2 - wxHORIZONTAL - 1 - - 0 - - fgSizer2 - wxFLEX_GROWMODE_SPECIFIED - none - 8 - 0 - - 3 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Custom field 1 - - 0 - - - 0 - - 1 - m_staticText15 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALL|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_fieldName1 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Custom field 2 - - 0 - - - 0 - - 1 - m_staticText161 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALL|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_fieldName2 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Custom field 3 - - 0 - - - 0 - - 1 - m_staticText17 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALL|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_fieldName3 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Custom field 4 - - 0 - - - 0 - - 1 - m_staticText18 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALL|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_fieldName4 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Custom field 5 - - 0 - - - 0 - - 1 - m_staticText19 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALL|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_fieldName5 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Custom field 6 - - 0 - - - 0 - - 1 - m_staticText20 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALL|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_fieldName6 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Custom field 7 - - 0 - - - 0 - - 1 - m_staticText21 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALL|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_fieldName7 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Custom field 8 - - 0 - - - 0 - - 1 - m_staticText22 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALL|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_fieldName8 - 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 + + + + + + + + + + + + + + + + + + + + + + + @@ -5021,7 +4237,7 @@ 6 - wxALL|wxEXPAND + wxALIGN_BOTTOM|wxALL|wxEXPAND 0 0 diff --git a/eeschema/dialogs/dialog_eeschema_options_base.h b/eeschema/dialogs/dialog_eeschema_options_base.h index 1413565d90..53381bd668 100644 --- a/eeschema/dialogs/dialog_eeschema_options_base.h +++ b/eeschema/dialogs/dialog_eeschema_options_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 5 2014) +// C++ code generated with wxFormBuilder (version Jun 6 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -29,9 +29,11 @@ class DIALOG_SHIM; #include #include #include +#include #include -#include +#include #include +#include #include /////////////////////////////////////////////////////////////////////////// @@ -45,15 +47,22 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM private: // Private event handlers + void _wxFB_OnSize( wxSizeEvent& event ){ OnSize( event ); } void _wxFB_OnChooseUnits( wxCommandEvent& event ){ OnChooseUnits( event ); } void _wxFB_OnMiddleBtnPanEnbl( wxCommandEvent& event ){ OnMiddleBtnPanEnbl( event ); } + void _wxFB_OnTemplateFieldDeselected( wxListEvent& event ){ OnTemplateFieldDeselected( event ); } + void _wxFB_OnTemplateFieldSelected( wxListEvent& event ){ OnTemplateFieldSelected( 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; @@ -95,35 +104,31 @@ 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; + wxStaticText* fieldNameLabel; + wxTextCtrl* fieldNameTextCtrl; + wxStaticText* fieldDefaultValueLabel; + wxTextCtrl* fieldDefaultValueTextCtrl; + wxCheckBox* fieldVisibleCheckbox; + wxButton* addFieldButton; + wxButton* deleteFieldButton; wxStdDialogButtonSizer* m_sdbSizer1; wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1Cancel; // Virtual event handlers, overide them in your derived class + virtual void OnSize( wxSizeEvent& event ) { event.Skip(); } virtual void OnChooseUnits( wxCommandEvent& event ) { event.Skip(); } virtual void OnMiddleBtnPanEnbl( wxCommandEvent& event ) { event.Skip(); } + virtual void OnTemplateFieldDeselected( wxListEvent& event ) { event.Skip(); } + virtual void OnTemplateFieldSelected( wxListEvent& 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,583 ), 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 ); ~DIALOG_EESCHEMA_OPTIONS_BASE(); }; diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 87d2aadf5b..a9dbf74966 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -323,7 +323,7 @@ void SCH_EDIT_FRAME::OnPreferencesOptions( wxCommandEvent& event ) dlg.SetRepeatVertical( g_RepeatStep.y ); dlg.SetRepeatLabel( g_RepeatDeltaLabel ); dlg.SetAutoSaveInterval( GetAutoSaveInterval() / 60 ); - dlg.SetRefIdSeparator( LIB_PART::GetSubpartIdSeparator( ), + dlg.SetRefIdSeparator( LIB_PART::GetSubpartIdSeparator(), LIB_PART::GetSubpartFirstId() ); dlg.SetShowGrid( IsGridVisible() ); @@ -337,15 +337,7 @@ void SCH_EDIT_FRAME::OnPreferencesOptions( wxCommandEvent& event ) dlg.Layout(); dlg.Fit(); dlg.SetMinSize( dlg.GetSize() ); - - const TEMPLATE_FIELDNAMES& tfnames = m_TemplateFieldNames.GetTemplateFieldNames(); - - for( unsigned i=0; i