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.

127 lines
4.1 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2014 CERN
  5. * @author Maciej Suminski <maciej.suminski@cern.ch>
  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 PCB_DRAW_PANEL_GAL_H_
  25. #define PCB_DRAW_PANEL_GAL_H_
  26. #include <class_draw_panel_gal.h>
  27. #include <layers_id_colors_and_visibility.h>
  28. #include <common.h>
  29. namespace KIGFX
  30. {
  31. class WORKSHEET_VIEWITEM;
  32. class RATSNEST_VIEWITEM;
  33. class PCB_VIEW;
  34. }
  35. class COLORS_DESIGN_SETTINGS;
  36. class PCB_DRAW_PANEL_GAL : public EDA_DRAW_PANEL_GAL
  37. {
  38. public:
  39. PCB_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindowId, const wxPoint& aPosition,
  40. const wxSize& aSize, KIGFX::GAL_DISPLAY_OPTIONS& aOptions,
  41. GAL_TYPE aGalType = GAL_TYPE_OPENGL );
  42. virtual ~PCB_DRAW_PANEL_GAL();
  43. /**
  44. * Function DisplayBoard
  45. * adds all items from the current board to the VIEW, so they can be displayed by GAL.
  46. * @param aBoard is the PCB to be loaded.
  47. */
  48. void DisplayBoard( BOARD* aBoard );
  49. /**
  50. * Function SetWorksheet
  51. * Sets (or updates) worksheet used by the draw panel.
  52. * @param aWorksheet is the worksheet to be used.
  53. * The object is then owned by PCB_DRAW_PANEL_GAL.
  54. */
  55. void SetWorksheet( KIGFX::WORKSHEET_VIEWITEM* aWorksheet );
  56. /**
  57. * Function UseColorScheme
  58. * Applies layer color settings.
  59. * @param aSettings are the new settings.
  60. */
  61. void UseColorScheme( const COLORS_DESIGN_SETTINGS* aSettings );
  62. ///> @copydoc EDA_DRAW_PANEL_GAL::SetHighContrastLayer()
  63. virtual void SetHighContrastLayer( int aLayer ) override
  64. {
  65. SetHighContrastLayer( static_cast< PCB_LAYER_ID >( aLayer ) );
  66. }
  67. ///> SetHighContrastLayer(), with some extra smarts for PCB
  68. void SetHighContrastLayer( PCB_LAYER_ID aLayer );
  69. ///> @copydoc EDA_DRAW_PANEL_GAL::SetTopLayer()
  70. virtual void SetTopLayer( int aLayer ) override
  71. {
  72. SetTopLayer( static_cast< PCB_LAYER_ID >( aLayer ) );
  73. }
  74. ///> SetTopLayer(), with some extra smarts for PCB
  75. void SetTopLayer( PCB_LAYER_ID aLayer );
  76. /**
  77. * Function SyncLayersVisibility
  78. * Updates "visibility" property of each layer of a given BOARD.
  79. * @param aBoard contains layers visibility settings to be applied.
  80. */
  81. void SyncLayersVisibility( const BOARD* aBoard );
  82. ///> @copydoc EDA_DRAW_PANEL_GAL::GetMsgPanelInfo()
  83. void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
  84. ///> @copydoc EDA_DRAW_PANEL_GAL::OnShow()
  85. void OnShow() override;
  86. bool SwitchBackend( GAL_TYPE aGalType ) override;
  87. ///> Forces refresh of the ratsnest visual representation
  88. void RedrawRatsnest();
  89. ///> @copydoc EDA_DRAW_PANEL_GAL::GetDefaultViewBBox()
  90. BOX2I GetDefaultViewBBox() const override;
  91. protected:
  92. KIGFX::PCB_VIEW* view() const;
  93. ///> Reassigns layer order to the initial settings.
  94. void setDefaultLayerOrder();
  95. ///> Sets rendering targets & dependencies for layers.
  96. void setDefaultLayerDeps();
  97. ///> Currently used worksheet
  98. std::unique_ptr<KIGFX::WORKSHEET_VIEWITEM> m_worksheet;
  99. ///> Ratsnest view item
  100. std::unique_ptr<KIGFX::RATSNEST_VIEWITEM> m_ratsnest;
  101. };
  102. #endif /* PCB_DRAW_PANEL_GAL_H_ */