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.

130 lines
5.7 KiB

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