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.

100 lines
3.0 KiB

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