KiCad PCB EDA Suite
worksheet_viewitem.h
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) 2013 CERN
5  * @author Maciej Suminski <maciej.suminski@cern.ch>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
30 #ifndef WORKSHEET_VIEWITEM_H
31 #define WORKSHEET_VIEWITEM_H
32 
33 #include <base_struct.h>
34 
35 class BOARD;
36 class PAGE_INFO;
37 class TITLE_BLOCK;
38 class WS_DRAW_ITEM_LINE;
39 class WS_DRAW_ITEM_RECT;
41 class WS_DRAW_ITEM_TEXT;
43 
44 namespace KIGFX
45 {
46 class VIEW;
47 class GAL;
48 
50 {
51 public:
52  WORKSHEET_VIEWITEM( int aMils2IUscalefactor,
53  const PAGE_INFO* aPageInfo, const TITLE_BLOCK* aTitleBlock );
54 
61  void SetFileName( const std::string& aFileName )
62  {
63  m_fileName = aFileName;
64  }
65 
72  void SetSheetName( const std::string& aSheetName )
73  {
74  m_sheetName = aSheetName;
75  }
76 
83  void SetPageInfo( const PAGE_INFO* aPageInfo );
84 
91  void SetTitleBlock( const TITLE_BLOCK* aTitleBlock );
92 
99  void SetSheetNumber( int aSheetNumber )
100  {
101  m_sheetNumber = aSheetNumber;
102  }
103 
110  void SetSheetCount( int aSheetCount )
111  {
112  m_sheetCount = aSheetCount;
113  }
114 
116  const BOX2I ViewBBox() const override;
117 
119  void ViewDraw( int aLayer, VIEW* aView ) const override;
120 
122  void ViewGetLayers( int aLayers[], int& aCount ) const override;
123 
124 #if defined(DEBUG)
125  void Show( int x, std::ostream& st ) const override
127  {
128  }
129 #endif
130 
134  virtual wxString GetClass() const override
135  {
136  return wxT( "WORKSHEET_VIEWITEM" );
137  }
138 
139 protected:
143 
145  std::string m_fileName;
146 
148  std::string m_sheetName;
149 
152 
155 
158 
161 
162  // Functions for drawing items that makes a worksheet
163  void draw( const WS_DRAW_ITEM_LINE* aItem, GAL* aGal ) const;
164  void draw( const WS_DRAW_ITEM_RECT* aItem, GAL* aGal ) const;
165  void draw( const WS_DRAW_ITEM_POLYGON* aItem, GAL* aGal ) const;
166  void draw( const WS_DRAW_ITEM_TEXT* aItem, GAL* aGal ) const;
167  void draw( const WS_DRAW_ITEM_BITMAP* aItem, GAL* aGal ) const;
168 
170  void drawBorder( GAL* aGal ) const;
171 };
172 }
173 
174 #endif /* WORKSHEET_VIEWITEM_H */
std::string m_sheetName
Sheet name displayed in the title block.
void SetPageInfo(const PAGE_INFO *aPageInfo)
Function SetPageInfo() Changes the PAGE_INFO object used to draw the worksheet.
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:58
const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers. ...
void SetTitleBlock(const TITLE_BLOCK *aTitleBlock)
Function SetTitleBlock() Changes the TITLE_BLOCK object used to draw the worksheet.
int m_sheetCount
Sheets count number displayed in the title block.
void ViewGetLayers(int aLayers[], int &aCount) const override
Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on...
void draw(const WS_DRAW_ITEM_LINE *aItem, GAL *aGal) const
WORKSHEET_VIEWITEM(int aMils2IUscalefactor, const PAGE_INFO *aPageInfo, const TITLE_BLOCK *aTitleBlock)
Class TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout, or editing view.
Definition: title_block.h:40
std::string m_fileName
File name displayed in the title block.
void SetSheetName(const std::string &aSheetName)
Function SetSheetName() Sets the sheet name displayed in the title block.
void drawBorder(GAL *aGal) const
Draws a border that determines the page size.
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
Definition: page_info.h:54
void SetFileName(const std::string &aFileName)
Function SetFileName() Sets the file name displayed in the title block.
void SetSheetNumber(int aSheetNumber)
Function SetSheetNumber() Changes the sheet number displayed in the title block.
void ViewDraw(int aLayer, VIEW *aView) const override
Function ViewDraw() Draws the parts of the object belonging to layer aLayer.
virtual wxString GetClass() const override
Get class name.
const PAGE_INFO * m_pageInfo
Worksheet page information.
int m_sheetNumber
Sheet number displayed in the title block.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
void SetSheetCount(int aSheetCount)
Function SetSheetCount() Changes the sheets count number displayed in the title block.
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:154
const TITLE_BLOCK * m_titleBlock
Title block that contains properties of the title block displayed in the worksheet.
int m_mils2IUscalefactor
the factor between mils (units used in worksheet and internal units) it is the value IU_PER_MILS used...
Basic classes for most KiCad items.
Class VIEW.
Definition: view.h:61
Class GAL is the abstract interface for drawing on a 2D-surface.