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.

114 lines
3.4 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2018 KiCad Developers, see change_log.txt for contributors.
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version 2
  9. * of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, you may find one here:
  18. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  19. * or you may search the http://www.gnu.org website for the version 2 license,
  20. * or you may write to the Free Software Foundation, Inc.,
  21. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  22. */
  23. #ifndef PANEL_SETUP_LAYERS_H
  24. #define PANEL_SETUP_LAYERS_H
  25. #include <widgets/unit_binder.h>
  26. #include <widgets/paged_dialog.h>
  27. #include <panel_setup_layers_base.h>
  28. class PCB_EDIT_FRAME;
  29. class BOARD;
  30. class BOARD_DESIGN_SETTINGS;
  31. /**
  32. * Holds the 3 UI control pointers for a single board layer.
  33. */
  34. struct PANEL_SETUP_LAYERS_CTLs
  35. {
  36. PANEL_SETUP_LAYERS_CTLs( wxControl* aName, wxCheckBox* aCheckBox, wxControl* aChoiceOrDesc )
  37. {
  38. name = aName;
  39. checkbox = aCheckBox;
  40. choice = aChoiceOrDesc;
  41. }
  42. wxControl* name;
  43. wxCheckBox* checkbox;
  44. wxControl* choice;
  45. };
  46. class PANEL_SETUP_LAYERS : public PANEL_SETUP_LAYERS_BASE
  47. {
  48. public:
  49. PANEL_SETUP_LAYERS( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame );
  50. void ImportSettingsFrom( BOARD* aBoard );
  51. private:
  52. PAGED_DIALOG* m_Parent;
  53. PCB_EDIT_FRAME* m_frame;
  54. BOARD* m_pcb;
  55. LSET m_enabledLayers;
  56. UNIT_BINDER m_pcbThickness;
  57. void setLayerCheckBox( LAYER_NUM layer, bool isChecked );
  58. void setCopperLayerCheckBoxes( int copperCount );
  59. void setMandatoryLayerCheckBoxes();
  60. void showCopperChoice( int copperCount );
  61. void showBoardLayerNames();
  62. void showSelectedLayerCheckBoxes( LSET enableLayerMask );
  63. void showLayerTypes();
  64. void showPresets( LSET enabledLayerMask );
  65. /** Return the selected layer mask within the UI checkboxes */
  66. LSET getUILayerMask();
  67. wxString getLayerName( LAYER_NUM layer );
  68. int getLayerTypeIndex( LAYER_NUM layer );
  69. void OnCheckBox( wxCommandEvent& event ) override;
  70. void DenyChangeCheckBox( wxCommandEvent& event ) override;
  71. void OnPresetsChoice( wxCommandEvent& event ) override;
  72. void OnCopperLayersChoice( wxCommandEvent& event ) override;
  73. bool TransferDataToWindow() override;
  74. bool TransferDataFromWindow() override;
  75. bool testLayerNames();
  76. /**
  77. * Return a list of layers removed from the board that contain items.
  78. */
  79. LSEQ getRemovedLayersWithItems();
  80. /**
  81. * Return a list of layers in use in footprints, and therefore not removable.
  82. */
  83. LSEQ getNonRemovableLayers();
  84. PANEL_SETUP_LAYERS_CTLs getCTLs( LAYER_NUM aLayerNumber );
  85. wxControl* getName( LAYER_NUM aLayer );
  86. wxCheckBox* getCheckBox( LAYER_NUM aLayer );
  87. wxChoice* getChoice( LAYER_NUM aLayer );
  88. };
  89. #endif //PANEL_SETUP_LAYERS_H