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.

134 lines
5.6 KiB

4 years ago
4 years ago
4 years ago
4 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2011-2018 Jean-Pierre Charras jp.charras at wanadoo.fr
  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. /**
  25. * @file dialog_layers_select_to_pcb.h
  26. */
  27. #ifndef DIALOG_LAYERS_SELECT_TO_PCB_H_
  28. #define DIALOG_LAYERS_SELECT_TO_PCB_H_
  29. #include <dialogs/dialog_layers_select_to_pcb_base.h>
  30. class GERBVIEW_FRAME;
  31. /**
  32. * Show the Gerber files loaded and allow the user to choose between Gerber layers and pcb layers.
  33. */
  34. class LAYERS_MAP_DIALOG : public LAYERS_MAP_DIALOG_BASE
  35. {
  36. public: LAYERS_MAP_DIALOG( GERBVIEW_FRAME* parent );
  37. ~LAYERS_MAP_DIALOG() {};
  38. int* GetLayersLookUpTable() { return m_layersLookUpTable; }
  39. static int GetCopperLayersCount() { return m_exportBoardCopperLayersCount; }
  40. protected:
  41. bool TransferDataFromWindow() override;
  42. private:
  43. void initDialog();
  44. void normalizeBrdLayersCount();
  45. void OnBrdLayersCountSelection( wxCommandEvent& event ) override;
  46. void OnSelectLayer( wxCommandEvent& event );
  47. void OnStoreSetup( wxCommandEvent& event ) override;
  48. void OnGetSetup( wxCommandEvent& event ) override;
  49. void OnResetClick( wxCommandEvent& event ) override;
  50. /**
  51. * Find number of loaded Gerbers where the matching KiCad layer can be identified.
  52. *
  53. * The passed vector<int> will be returned with the same number of elements
  54. * as there are Gerber files. The indices into it are 1:1 with the loaded Gerber
  55. * files. Any Gerber that maps will have its entry set to the KiCad PCB layer
  56. * number. Gerbers that can be identified or which don't map to an
  57. * equivalent KiCad PCB layer will be set to UNSELECTED_LAYER.
  58. *
  59. * @param aGerber2KicadMapping passed to return KiCad PCB layer number for each Gerber.
  60. *
  61. * @return The number of loaded Gerbers that have Altium extensions.
  62. */
  63. int findKnownGerbersLoaded( std::vector<int>& aGerber2KicadMapping );
  64. /**
  65. * Find number of loaded Gerbers using Altium file extensions.
  66. *
  67. * The passed vector<int> will be returned with the same number of elements
  68. * as there are Gerber files. The indices into it are 1:1 with the loaded Gerber
  69. * files. Any Gerber that maps will have its entry set to the KiCad PCB layer
  70. * number. Gerbers that aren't using Altium extensions or which don't map to an
  71. * equivalent KiCad PCB layer will be set to UNSELECTED_LAYER.
  72. *
  73. * @param aGerber2KicadMapping passed to return KiCad PCB layer number for each Gerber.
  74. *
  75. * @return The number of loaded Gerbers that have Altium extensions.
  76. */
  77. int findNumAltiumGerbersLoaded( std::vector<int>& aGerber2KicadMapping );
  78. /**
  79. * Find number of loaded Gerbers using KiCad naming convention.
  80. *
  81. * The passed vector<int> will be returned with the same number of elements
  82. * as there are Gerber files. The indices into it are 1:1 with the loaded Gerber
  83. * files. Any Gerber that maps will have its entry set to the KiCad PCB layer
  84. * number. Gerbers that aren't using KiCad naming or which don't map to an
  85. * equivalent KiCad PCB layer will be set to UNSELECTED_LAYER.
  86. *
  87. * @param aGerber2KicadMapping passed to return KiCad PCB layer number for each Gerber.
  88. *
  89. * @return The number of loaded Gerbers using KiCad naming conventions.
  90. */
  91. int findNumKiCadGerbersLoaded( std::vector<int>& aGerber2KicadMapping );
  92. /**
  93. * Find number of loaded Gerbers using X2 File Functions to define layers.
  94. *
  95. * The passed vector<int> will be returned with the same number of elements
  96. * as there are Gerber files. The indices into it are 1:1 with the loaded Gerber
  97. * files. Any Gerber that maps will have its entry set to the KiCad PCB layer
  98. * number. Gerbers that aren't using X2 File functions or which don't map to an
  99. * equivalent KiCad PCB layer will be set to UNSELECTED_LAYER.
  100. *
  101. * @param aGerber2KicadMapping passed to return KiCad PCB layer number for each Gerber.
  102. *
  103. * @return The number of loaded Gerbers with X2 File Functions.
  104. */
  105. int findNumX2GerbersLoaded( std::vector<int>& aGerber2KicadMapping );
  106. DECLARE_EVENT_TABLE()
  107. private:
  108. GERBVIEW_FRAME* m_Parent;
  109. int m_gerberActiveLayersCount; // Number of initialized Gerber layers
  110. static int m_exportBoardCopperLayersCount;
  111. // Indexes Gerber layers to PCB file layers; the last value in table is the number of
  112. // copper layers.
  113. int m_layersLookUpTable[ GERBER_DRAWLAYERS_COUNT ];
  114. int m_buttonTable[ int(GERBER_DRAWLAYERS_COUNT) + 1 ];
  115. wxStaticText* m_layersList[ int(GERBER_DRAWLAYERS_COUNT) + 1 ];
  116. };
  117. #endif // DIALOG_LAYERS_SELECT_TO_PCB_H_