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 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, see <https://www.gnu.org/licenses/>.
21 */
22
23#include <base_screen.h>
24#include <eda_item.h>
25#include <trace_helpers.h>
26
27
28wxString BASE_SCREEN::m_DrawingSheetFileName; // the name of the drawing sheet file.
29
30
32 EDA_ITEM( aParent, aType )
33{
35 m_pageCount = 1; // Hierarchy: Root: ScreenNumber = 1
36 m_Center = true;
37
38 m_flagModified = false; // Set when any change is made on board.
39}
40
41
42void BASE_SCREEN::InitDataPoints( const VECTOR2I& aPageSizeIU )
43{
44 if( m_Center )
45 {
46 m_DrawOrg.x = -aPageSizeIU.x / 2;
47 m_DrawOrg.y = -aPageSizeIU.y / 2;
48 }
49 else
50 {
51 m_DrawOrg.x = 0;
52 m_DrawOrg.y = 0;
53 }
54
55 m_LocalOrigin = { 0, 0 };
56}
57
58
59void BASE_SCREEN::SetPageCount( int aPageCount )
60{
61 if( aPageCount > 0 )
62 m_pageCount = aPageCount;
63}
64
65
66const wxString& BASE_SCREEN::GetPageNumber() const
67{
68 static wxString pageNumber;
69
70 if( m_pageNumber.IsEmpty() )
71 pageNumber.Printf( wxS( "%d" ), m_virtualPageNumber );
72 else
73 pageNumber = m_pageNumber;
74
75 return pageNumber;
76}
77
78
79#if defined(DEBUG)
80
81void BASE_SCREEN::Show( int nestLevel, std::ostream& os ) const
82{
83 // for now, make it look like XML, expand on this later.
84 NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n";
85
86 NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
87}
88
89#endif
BASE_SCREEN class implementation.
void SetPageCount(int aPageCount)
int m_virtualPageNumber
An integer based page number used for printing a range of pages.
bool m_Center
Center on screen.
Definition base_screen.h:92
VECTOR2I m_DrawOrg
offsets for drawing the circuit on the screen
Definition base_screen.h:84
static wxString m_DrawingSheetFileName
the name of the drawing sheet file, or empty to use the default drawing sheet
Definition base_screen.h:81
virtual wxString GetClass() const override
Return the class name.
Definition base_screen.h:63
int m_pageCount
The number of BASE_SCREEN objects in this design.
const wxString & GetPageNumber() const
wxString m_pageNumber
A user defined string page number used for printing and plotting.
bool m_flagModified
Indicates current drawing has been modified.
VECTOR2D m_LocalOrigin
Relative Screen cursor coordinate (on grid) in user units.
Definition base_screen.h:86
BASE_SCREEN(EDA_ITEM *aParent, KICAD_T aType=SCREEN_T)
void InitDataPoints(const VECTOR2I &aPageSizeInternalUnits)
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:37
wxLogTrace helper definitions.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition typeinfo.h:71
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683