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.

135 lines
4.9 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2015 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
  5. * Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
  6. * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.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. * @file base_screen.h
  27. * @brief BASE_SCREEN class implementation.
  28. */
  29. #ifndef BASE_SCREEN_H
  30. #define BASE_SCREEN_H
  31. #include <eda_item.h>
  32. /**
  33. * Handles how to draw a screen (a board, a schematic ...)
  34. */
  35. class BASE_SCREEN : public EDA_ITEM
  36. {
  37. public:
  38. BASE_SCREEN( EDA_ITEM* aParent, KICAD_T aType = SCREEN_T );
  39. BASE_SCREEN( const wxSize& aPageSizeIU, KICAD_T aType = SCREEN_T ) :
  40. BASE_SCREEN( nullptr, aType )
  41. {
  42. InitDataPoints( aPageSizeIU );
  43. }
  44. BASE_SCREEN( KICAD_T aType = SCREEN_T ) :
  45. BASE_SCREEN( nullptr, aType )
  46. {}
  47. ~BASE_SCREEN() override { }
  48. void InitDataPoints( const wxSize& aPageSizeInternalUnits );
  49. void SetContentModified( bool aModified = true ) { m_flagModified = aModified; }
  50. bool IsContentModified() const { return m_flagModified; }
  51. /**
  52. * Return the class name.
  53. *
  54. * @return wxString
  55. */
  56. virtual wxString GetClass() const override
  57. {
  58. return wxT( "BASE_SCREEN" );
  59. }
  60. int GetPageCount() const { return m_pageCount; }
  61. void SetPageCount( int aPageCount );
  62. int GetVirtualPageNumber() const { return m_virtualPageNumber; }
  63. void SetVirtualPageNumber( int aPageNumber ) { m_virtualPageNumber = aPageNumber; }
  64. const wxString& GetPageNumber() const;
  65. void SetPageNumber( const wxString& aPageNumber ) { m_pageNumber = aPageNumber; }
  66. #if defined(DEBUG)
  67. void Show( int nestLevel, std::ostream& os ) const override;
  68. #endif
  69. static wxString m_DrawingSheetFileName; ///< the name of the drawing sheet file, or empty
  70. ///< to use the default drawing sheet
  71. VECTOR2I m_DrawOrg; ///< offsets for drawing the circuit on the screen
  72. VECTOR2D m_LocalOrigin; ///< Relative Screen cursor coordinate (on grid)
  73. ///< in user units. (coordinates from last reset position)
  74. VECTOR2I m_StartVisu; ///< Coordinates in drawing units of the current
  75. ///< view position (upper left corner of device)
  76. bool m_Center; ///< Center on screen. If true (0.0) is centered on screen
  77. ///< coordinates can be < 0 and > 0 except for schematics.
  78. ///< false: when coordinates can only be >= 0 (schematics).
  79. VECTOR2D m_ScrollCenter; ///< Current scroll center point in logical units.
  80. protected:
  81. /**
  82. * The number of #BASE_SCREEN objects in this design.
  83. *
  84. * This currently only has meaning for #SCH_SCREEN objects because #PCB_SCREEN object
  85. * are limited to a single file. The count is virtual because #SCH_SCREEN objects can be
  86. * used more than once so the screen (page) count can be more than the number of screen
  87. * objects.
  88. */
  89. int m_pageCount;
  90. /**
  91. * An integer based page number used for printing a range of pages.
  92. *
  93. * This page number is set before printing and plotting because page numbering does not
  94. * reflect the actual page number in complex hiearachies in #SCH_SCREEN objects.
  95. */
  96. int m_virtualPageNumber;
  97. /**
  98. * A user defined string page number used for printing and plotting.
  99. *
  100. * This currently only has meaning for #SCH_SCREEN objects because #PCB_SCREEN object
  101. * are limited to a single file. This must be set before displaying, printing, or
  102. * plotting the current sheet. If empty, the #m_virtualPageNumber value is converted
  103. * to a string.
  104. */
  105. wxString m_pageNumber;
  106. private:
  107. bool m_flagModified; ///< Indicates current drawing has been modified.
  108. };
  109. #endif // BASE_SCREEN_H