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