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.

86 lines
2.8 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2015 John Beard, john.j.beard@gmail.com
  5. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. #ifndef DIALOG_CREATE_ARRAY__H_
  25. #define DIALOG_CREATE_ARRAY__H_
  26. // Include the wxFormBuider header base:
  27. #include <dialog_create_array_base.h>
  28. #include <array_options.h>
  29. #include <board_item.h>
  30. #include <pcb_base_frame.h>
  31. #include <widgets/unit_binder.h>
  32. #include <widgets/widget_save_restore.h>
  33. #include <memory>
  34. class DIALOG_CREATE_ARRAY : public DIALOG_CREATE_ARRAY_BASE
  35. {
  36. public:
  37. /**
  38. * Construct a new dialog.
  39. *
  40. * @param aParent the parent window
  41. * @param aOptions the options that will be re-seated when dialog is validly closed
  42. * @param aEnableNumbering enable pad numbering
  43. * @param aOrigPos original item position (used for computing the circular array radius)
  44. */
  45. DIALOG_CREATE_ARRAY( PCB_BASE_FRAME* aParent, std::unique_ptr<ARRAY_OPTIONS>& aOptions,
  46. bool enableNumbering, const wxPoint& aOrigPos );
  47. private:
  48. // Event callbacks
  49. void OnParameterChanged( wxCommandEvent& event ) override;
  50. // Internal callback handlers
  51. void setControlEnablement();
  52. void calculateCircularArrayProperties();
  53. bool TransferDataFromWindow() override;
  54. /**
  55. * The settings to re-seat on dialog OK.
  56. */
  57. std::unique_ptr<ARRAY_OPTIONS>& m_settings;
  58. /*
  59. * The position of the original item(s), used for finding radius, etc
  60. */
  61. const wxPoint m_originalItemPosition;
  62. // some uses of arrays might not allow component renumbering
  63. bool m_numberingEnabled;
  64. UNIT_BINDER m_hSpacing, m_vSpacing;
  65. UNIT_BINDER m_hOffset, m_vOffset;
  66. UNIT_BINDER m_hCentre, m_vCentre;
  67. UNIT_BINDER m_circRadius;
  68. UNIT_BINDER m_circAngle;
  69. WIDGET_SAVE_RESTORE m_cfg_persister;
  70. };
  71. #endif // DIALOG_CREATE_ARRAY__H_