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.

137 lines
4.9 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2004-2010 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr
  5. * Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
  6. * Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version 2
  11. * of the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, you may find one here:
  20. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  21. * or you may search the http://www.gnu.org website for the version 2 license,
  22. * or you may write to the Free Software Foundation, Inc.,
  23. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  24. */
  25. /************************************************************/
  26. /* class_gerber_layer_widget.h : header for the layers manager */
  27. /************************************************************/
  28. #ifndef _CLASS_GERBER_LAYER_WIDGET_H_
  29. #define _CLASS_GERBER_LAYER_WIDGET_H_
  30. #include <layer_widget.h>
  31. // popup menu ids. in layer manager
  32. enum LAYER_MANAGER
  33. {
  34. ID_LAYER_MANAGER_START = wxID_HIGHEST+1,
  35. ID_SHOW_ALL_LAYERS = ID_LAYER_MANAGER_START,
  36. ID_SHOW_NO_LAYERS,
  37. ID_SHOW_NO_LAYERS_BUT_ACTIVE,
  38. ID_ALWAYS_SHOW_NO_LAYERS_BUT_ACTIVE,
  39. ID_SORT_GBR_LAYERS,
  40. ID_LAYER_MANAGER_END = ID_SORT_GBR_LAYERS,
  41. };
  42. /**
  43. * Class GERBER_LAYER_WIDGET
  44. * is here to implement the abtract functions of LAYER_WIDGET so they
  45. * may be tied into the GERBVIEW_FRAME's data and so we can add a popup
  46. * menu which is specific to Pcbnew's needs.
  47. */
  48. class GERBER_LAYER_WIDGET : public LAYER_WIDGET
  49. {
  50. GERBVIEW_FRAME* myframe;
  51. bool m_alwaysShowActiveLayer; // If true: Only shows the current active layer
  52. // even if it is changed
  53. /**
  54. * Function OnRightDownLayers
  55. * puts up a popup menu for the layer panel.
  56. */
  57. void onRightDownLayers( wxMouseEvent& event );
  58. void onPopupSelection( wxCommandEvent& event );
  59. /// this is for the popup menu, the right click handler has to be installed
  60. /// on every child control within the layer panel.
  61. void installRightLayerClickHandler();
  62. /**
  63. * Virtual Function useAlternateBitmap
  64. * @return true if bitmaps shown in Render layer list
  65. * are alternate bitmaps, or false if they are "normal" bitmaps
  66. */
  67. virtual bool useAlternateBitmap(int aRow);
  68. GERBER_FILE_IMAGE_LIST* GetImagesList();
  69. public:
  70. /**
  71. * Constructor
  72. * @param aParent : the parent frame
  73. * @param aFocusOwner : the window that has the keyboard focus.
  74. * @param aPointSize is the font point size to use within the widget. This
  75. * effectively sets the overal size of the widget via the row height and bitmap
  76. * button sizes.
  77. */
  78. GERBER_LAYER_WIDGET( GERBVIEW_FRAME* aParent, wxWindow* aFocusOwner, int aPointSize = 10 );
  79. void ReFill();
  80. /**
  81. * Function ReFillRender
  82. * Rebuild Render for instance after the config is read
  83. */
  84. void ReFillRender();
  85. //-----<implement LAYER_WIDGET abstract callback functions>-----------
  86. void OnLayerColorChange( int aLayer, EDA_COLOR_T aColor );
  87. bool OnLayerSelect( int aLayer );
  88. void OnLayerVisible( int aLayer, bool isVisible, bool isFinal );
  89. void OnRenderColorChange( int aId, EDA_COLOR_T aColor );
  90. void OnRenderEnable( int aId, bool isEnabled );
  91. /**
  92. * Function SetLayersManagerTabsText
  93. * Update the layer manager tabs labels
  94. * Useful when changing Language or to set labels to a non default value
  95. */
  96. void SetLayersManagerTabsText( );
  97. //-----</implement LAYER_WIDGET abstract callback functions>----------
  98. /**
  99. * Function OnLayerSelected
  100. * ensure the active layer is visible, and other layers not visible
  101. * when m_alwaysShowActiveLayer is true
  102. * Otherwise do nothing.
  103. * @return true m_alwaysShowActiveLayer is true and the canvas is refreshed,
  104. * and false if do nothing
  105. */
  106. bool OnLayerSelected(); // postprocess after an active layer selection
  107. // ensure active layer visible if
  108. // m_alwaysShowActiveCopperLayer is true;
  109. /**
  110. * Function UpdateLayerIcons
  111. * Update the layer manager icons (layers only)
  112. * Useful when loading a file or clearing a layer because they change
  113. */
  114. void UpdateLayerIcons();
  115. };
  116. #endif // _CLASS_GERBER_LAYER_WIDGET_H_