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.

93 lines
2.7 KiB

3 years ago
  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 The 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_DrawingSheetFileName; // the name of the drawing sheet 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. }
  38. void BASE_SCREEN::InitDataPoints( const VECTOR2I& aPageSizeIU )
  39. {
  40. if( m_Center )
  41. {
  42. m_DrawOrg.x = -aPageSizeIU.x / 2;
  43. m_DrawOrg.y = -aPageSizeIU.y / 2;
  44. }
  45. else
  46. {
  47. m_DrawOrg.x = 0;
  48. m_DrawOrg.y = 0;
  49. }
  50. m_LocalOrigin = { 0, 0 };
  51. }
  52. void BASE_SCREEN::SetPageCount( int aPageCount )
  53. {
  54. if( aPageCount > 0 )
  55. m_pageCount = aPageCount;
  56. }
  57. const wxString& BASE_SCREEN::GetPageNumber() const
  58. {
  59. static wxString pageNumber;
  60. if( m_pageNumber.IsEmpty() )
  61. pageNumber.Printf( wxS( "%d" ), m_virtualPageNumber );
  62. else
  63. pageNumber = m_pageNumber;
  64. return pageNumber;
  65. }
  66. #if defined(DEBUG)
  67. void BASE_SCREEN::Show( int nestLevel, std::ostream& os ) const
  68. {
  69. // for now, make it look like XML, expand on this later.
  70. NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n";
  71. NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
  72. }
  73. #endif