You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
2.8 KiB

  1. #ifndef __dialog_edit_component_in_schematic__
  2. #define __dialog_edit_component_in_schematic__
  3. #include <sch_field.h>
  4. #include <template_fieldnames.h>
  5. #include <dialog_edit_component_in_schematic_fbp.h>
  6. class SCH_EDIT_FRAME;
  7. /**
  8. * class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC
  9. * is hand coded and implements DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP which
  10. * is maintained by wxFormBuilder. Do not auto-generate this class or file,
  11. * it is hand coded.
  12. */
  13. class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP
  14. {
  15. friend class SCH_EDIT_FRAME;
  16. SCH_EDIT_FRAME* m_Parent;
  17. SCH_COMPONENT* m_Cmp;
  18. LIB_COMPONENT* m_LibEntry;
  19. bool m_skipCopyFromPanel;
  20. static int s_SelectedRow;
  21. /// The size of the dialog window last time it was displayed;
  22. static wxSize s_LastSize;
  23. /// a copy of the edited component's SCH_FIELDs
  24. SCH_FIELDS m_FieldsBuf;
  25. void setSelectedFieldNdx( int aFieldNdx );
  26. int getSelectedFieldNdx();
  27. /**
  28. * Function copySelectedFieldToPanel
  29. * sets the values displayed on the panel according to
  30. * the currently selected field row
  31. */
  32. void copySelectedFieldToPanel();
  33. /**
  34. * Function copyPanelToSelectedField
  35. * copies the values displayed on the panel fields to the currently
  36. * selected field
  37. * @return bool - true if all fields are OK, else false if the user has put
  38. * bad data into a field, and this value can be used to deny a row change.
  39. */
  40. bool copyPanelToSelectedField();
  41. void copyOptionsToPanel();
  42. void copyPanelToOptions();
  43. void setRowItem( int aFieldNdx, const SCH_FIELD& aField );
  44. // event handlers
  45. void OnListItemDeselected( wxListEvent& event );
  46. void OnListItemSelected( wxListEvent& event );
  47. void OnCancelButtonClick( wxCommandEvent& event );
  48. void OnOKButtonClick( wxCommandEvent& event );
  49. void SetInitCmp( wxCommandEvent& event );
  50. void addFieldButtonHandler( wxCommandEvent& event );
  51. void deleteFieldButtonHandler( wxCommandEvent& event );
  52. void moveUpButtonHandler( wxCommandEvent& event );
  53. SCH_FIELD* findField( const wxString& aFieldName );
  54. protected:
  55. public:
  56. /** Constructor */
  57. DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow* parent );
  58. /**
  59. * Function InitBuffers
  60. * sets up to edit the given component.
  61. * @param aComponent The component to edit.
  62. */
  63. void InitBuffers( SCH_COMPONENT* aComponent );
  64. private:
  65. /**
  66. * Function updateDisplay
  67. * update the listbox showing fields, according to the fields texts
  68. * must be called after a text change in fields, if this change is not an edition
  69. */
  70. void updateDisplay( )
  71. {
  72. for( unsigned ii = FIELD1; ii<m_FieldsBuf.size(); ii++ )
  73. setRowItem( ii, m_FieldsBuf[ii] );
  74. }
  75. };
  76. #endif // __dialog_edit_component_in_schematic__