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.

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