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.

101 lines
2.9 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
  5. * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
  6. * Copyright (C) 2012 Wayne Stambaugh <stambaughw@gmail.com>
  7. * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version 2
  12. * of the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, you may find one here:
  21. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  22. * or you may search the http://www.gnu.org website for the version 2 license,
  23. * or you may write to the Free Software Foundation, Inc.,
  24. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  25. */
  26. #include <base_screen.h>
  27. #include <eda_item.h>
  28. #include <trace_helpers.h>
  29. wxString BASE_SCREEN::m_PageLayoutDescrFileName; // the name of the page layout descr file.
  30. BASE_SCREEN::BASE_SCREEN( EDA_ITEM* aParent, KICAD_T aType ) :
  31. EDA_ITEM( aParent, aType )
  32. {
  33. m_virtualPageNumber = 1;
  34. m_pageCount = 1; // Hierarchy: Root: ScreenNumber = 1
  35. m_Center = true;
  36. m_flagModified = false; // Set when any change is made on board.
  37. m_flagSave = false; // Used in auto save set when an auto save is required.
  38. }
  39. void BASE_SCREEN::InitDataPoints( const wxSize& aPageSizeIU )
  40. {
  41. if( m_Center )
  42. {
  43. m_crossHairPosition.x = 0;
  44. m_crossHairPosition.y = 0;
  45. m_DrawOrg.x = -aPageSizeIU.x / 2;
  46. m_DrawOrg.y = -aPageSizeIU.y / 2;
  47. }
  48. else
  49. {
  50. m_crossHairPosition.x = aPageSizeIU.x / 2;
  51. m_crossHairPosition.y = aPageSizeIU.y / 2;
  52. m_DrawOrg.x = 0;
  53. m_DrawOrg.y = 0;
  54. }
  55. m_LocalOrigin = { 0, 0 };
  56. }
  57. void BASE_SCREEN::SetPageCount( int aPageCount )
  58. {
  59. wxCHECK( aPageCount > 0, /* void */ );
  60. m_pageCount = aPageCount;
  61. }
  62. const wxString& BASE_SCREEN::GetPageNumber() const
  63. {
  64. static wxString pageNumber;
  65. if( m_pageNumber.IsEmpty() )
  66. pageNumber.Printf( "%d", m_virtualPageNumber );
  67. else
  68. pageNumber = m_pageNumber;
  69. return pageNumber;
  70. }
  71. #if defined(DEBUG)
  72. void BASE_SCREEN::Show( int nestLevel, std::ostream& os ) const
  73. {
  74. // for now, make it look like XML, expand on this later.
  75. NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n";
  76. NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
  77. }
  78. #endif