KiCad PCB EDA Suite
Loading...
Searching...
No Matches
base_screen.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2012 Jean-Pierre Charras, [email protected]
5 * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
6 * Copyright (C) 2012 Wayne Stambaugh <[email protected]>
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
27#include <base_screen.h>
28#include <eda_item.h>
29#include <trace_helpers.h>
30
31
32wxString BASE_SCREEN::m_DrawingSheetFileName; // the name of the drawing sheet file.
33
34
36 EDA_ITEM( aParent, aType )
37{
39 m_pageCount = 1; // Hierarchy: Root: ScreenNumber = 1
40 m_Center = true;
41
42 m_flagModified = false; // Set when any change is made on board.
43}
44
45
46void BASE_SCREEN::InitDataPoints( const VECTOR2I& aPageSizeIU )
47{
48 if( m_Center )
49 {
50 m_DrawOrg.x = -aPageSizeIU.x / 2;
51 m_DrawOrg.y = -aPageSizeIU.y / 2;
52 }
53 else
54 {
55 m_DrawOrg.x = 0;
56 m_DrawOrg.y = 0;
57 }
58
59 m_LocalOrigin = { 0, 0 };
60}
61
62
63void BASE_SCREEN::SetPageCount( int aPageCount )
64{
65 if( aPageCount > 0 )
66 m_pageCount = aPageCount;
67}
68
69
70const wxString& BASE_SCREEN::GetPageNumber() const
71{
72 static wxString pageNumber;
73
74 if( m_pageNumber.IsEmpty() )
75 pageNumber.Printf( wxS( "%d" ), m_virtualPageNumber );
76 else
77 pageNumber = m_pageNumber;
78
79 return pageNumber;
80}
81
82
83#if defined(DEBUG)
84
85void BASE_SCREEN::Show( int nestLevel, std::ostream& os ) const
86{
87 // for now, make it look like XML, expand on this later.
88 NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n";
89
90 NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
91}
92
93#endif
BASE_SCREEN class implementation.
void SetPageCount(int aPageCount)
Definition: base_screen.cpp:63
int m_virtualPageNumber
An integer based page number used for printing a range of pages.
Definition: base_screen.h:119
bool m_Center
Center on screen.
Definition: base_screen.h:96
VECTOR2I m_DrawOrg
offsets for drawing the circuit on the screen
Definition: base_screen.h:88
static wxString m_DrawingSheetFileName
the name of the drawing sheet file, or empty to use the default drawing sheet
Definition: base_screen.h:85
virtual wxString GetClass() const override
Return the class name.
Definition: base_screen.h:67
int m_pageCount
The number of BASE_SCREEN objects in this design.
Definition: base_screen.h:111
const wxString & GetPageNumber() const
Definition: base_screen.cpp:70
wxString m_pageNumber
A user defined string page number used for printing and plotting.
Definition: base_screen.h:129
bool m_flagModified
Indicates current drawing has been modified.
Definition: base_screen.h:132
VECTOR2D m_LocalOrigin
Relative Screen cursor coordinate (on grid) in user units.
Definition: base_screen.h:90
BASE_SCREEN(EDA_ITEM *aParent, KICAD_T aType=SCREEN_T)
Definition: base_screen.cpp:35
void InitDataPoints(const VECTOR2I &aPageSizeInternalUnits)
Definition: base_screen.cpp:46
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:89
wxLogTrace helper definitions.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78