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.

131 lines
4.7 KiB

2 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright The KiCad Developers, see AUTHORS.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 SCH_VIEW_H_
  24. #define SCH_VIEW_H_
  25. #include <layer_ids.h>
  26. #include <math/vector2d.h>
  27. #include <view/view.h>
  28. #include <memory>
  29. #include <vector>
  30. class SCH_SHEET;
  31. class SCH_SCREEN;
  32. class LIB_SYMBOL;
  33. class SCH_PIN;
  34. class SCH_BASE_FRAME;
  35. class DS_PROXY_VIEW_ITEM;
  36. // Eeschema 100nm as the internal units
  37. constexpr double SCH_WORLD_UNIT ( 1e-7 / 0.0254 );
  38. static const int SCH_LAYER_ORDER[] = { LAYER_GP_OVERLAY,
  39. LAYER_SELECT_OVERLAY,
  40. LAYER_ERC_ERR,
  41. LAYER_ERC_WARN,
  42. LAYER_ERC_EXCLUSION,
  43. LAYER_DANGLING,
  44. LAYER_OP_VOLTAGES,
  45. LAYER_OP_CURRENTS,
  46. LAYER_REFERENCEPART,
  47. LAYER_VALUEPART,
  48. LAYER_FIELDS,
  49. LAYER_PINNUM,
  50. LAYER_PINNAM,
  51. LAYER_INTERSHEET_REFS,
  52. LAYER_NETCLASS_REFS,
  53. LAYER_RULE_AREAS,
  54. LAYER_BUS_JUNCTION,
  55. LAYER_JUNCTION,
  56. LAYER_NOCONNECT,
  57. LAYER_HIERLABEL,
  58. LAYER_GLOBLABEL,
  59. LAYER_LOCLABEL,
  60. LAYER_SHEETFILENAME,
  61. LAYER_SHEETNAME,
  62. LAYER_SHEETLABEL,
  63. LAYER_SHEETFIELDS,
  64. LAYER_NOTES,
  65. LAYER_PRIVATE_NOTES,
  66. LAYER_WIRE,
  67. LAYER_BUS,
  68. LAYER_DEVICE,
  69. LAYER_SHEET,
  70. LAYER_SELECTION_SHADOWS,
  71. LAYER_DRAW_BITMAPS,
  72. LAYER_SHAPES_BACKGROUND,
  73. LAYER_DEVICE_BACKGROUND,
  74. LAYER_SHEET_BACKGROUND,
  75. LAYER_NOTES_BACKGROUND,
  76. LAYER_DRAWINGSHEET };
  77. namespace KIGFX
  78. {
  79. class VIEW_GROUP;
  80. namespace PREVIEW
  81. {
  82. class SELECTION_AREA;
  83. };
  84. class SCH_VIEW : public KIGFX::VIEW
  85. {
  86. public:
  87. // Note: aFrame is used to know the sheet path name when drawing the drawing sheet.
  88. // It can be null.
  89. SCH_VIEW( SCH_BASE_FRAME* aFrame );
  90. ~SCH_VIEW();
  91. void Update( const KIGFX::VIEW_ITEM* aItem, int aUpdateFlags ) const override;
  92. void Update( const KIGFX::VIEW_ITEM* aItem ) const override;
  93. void Cleanup();
  94. void DisplaySheet( const SCH_SCREEN* aScreen );
  95. void DisplaySymbol( LIB_SYMBOL* aSymbol );
  96. void SetScale( double aScale, VECTOR2D aAnchor = { 0, 0 } ) override;
  97. /**
  98. * Clear the hide flag of all items in the view
  99. */
  100. void ClearHiddenFlags();
  101. void HideDrawingSheet();
  102. DS_PROXY_VIEW_ITEM* GetDrawingSheet() const { return m_drawingSheet.get(); }
  103. private:
  104. SCH_BASE_FRAME* m_frame; // The frame using this view. Can be null. Used mainly
  105. // to know the sheet path name when drawing the drawing sheet
  106. std::unique_ptr<DS_PROXY_VIEW_ITEM> m_drawingSheet;
  107. };
  108. }; // namespace
  109. #endif