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.

93 lines
2.7 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-2015 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__
  25. #define __DIALOG_CREATE_ARRAY__
  26. // Include the wxFormBuider header base:
  27. #include <dialog_create_array_base.h>
  28. #include <array_options.h>
  29. #include <class_board_item.h>
  30. #include <pcb_base_frame.h>
  31. #include <boost/bimap.hpp>
  32. #include <widgets/unit_binder.h>
  33. #include <widgets/widget_save_restore.h>
  34. class DIALOG_CREATE_ARRAY : public DIALOG_CREATE_ARRAY_BASE
  35. {
  36. public:
  37. // Constructor and destructor
  38. DIALOG_CREATE_ARRAY( PCB_BASE_FRAME* aParent, bool enableNumbering,
  39. wxPoint aOrigPos );
  40. ~DIALOG_CREATE_ARRAY();
  41. /*!
  42. * @return the array options set by this dialogue, or NULL if they were
  43. * not set, or could not be set
  44. */
  45. ARRAY_OPTIONS* GetArrayOptions() const
  46. {
  47. return m_settings;
  48. }
  49. private:
  50. /**
  51. * The settings object returned to the caller.
  52. * We retain ownership of this
  53. */
  54. ARRAY_OPTIONS* m_settings;
  55. UNIT_BINDER m_hSpacing, m_vSpacing;
  56. UNIT_BINDER m_hOffset, m_vOffset;
  57. UNIT_BINDER m_hCentre, m_vCentre;
  58. UNIT_BINDER m_circRadius;
  59. UNIT_BINDER m_circAngle;
  60. WIDGET_SAVE_RESTORE m_cfg_persister;
  61. /*
  62. * The position of the original item(s), used for finding radius, etc
  63. */
  64. const wxPoint m_originalItemPosition;
  65. // Event callbacks
  66. void OnParameterChanged( wxCommandEvent& event ) override;
  67. // Internal callback handlers
  68. void setControlEnablement();
  69. void calculateCircularArrayProperties();
  70. bool TransferDataFromWindow() override;
  71. // some uses of arrays might not allow component renumbering
  72. bool m_numberingEnabled;
  73. };
  74. #endif // __DIALOG_CREATE_ARRAY__