KiCad PCB EDA Suite
ws_proxy_view_item.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  * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
6  * @author Maciej Suminski <maciej.suminski@cern.ch>
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 #ifndef WS_PROXY_VIEW_ITEM_H
27 #define WS_PROXY_VIEW_ITEM_H
28 
29 #include <eda_item.h>
30 
31 class BOARD;
32 class PAGE_INFO;
33 class PROJECT;
34 class TITLE_BLOCK;
35 class WS_DRAW_ITEM_LINE;
36 class WS_DRAW_ITEM_RECT;
37 class WS_DRAW_ITEM_TEXT;
39 class WS_DRAW_ITEM_LIST;
40 
41 namespace KIGFX
42 {
43 class VIEW;
44 class GAL;
45 
47 {
48 public:
49  WS_PROXY_VIEW_ITEM( int aScaleFactor, const PAGE_INFO* aPageInfo, const PROJECT* aProject,
50  const TITLE_BLOCK* aTitleBlock );
51 
55  void SetFileName( const std::string& aFileName ) { m_fileName = aFileName; }
56 
60  void SetSheetName( const std::string& aSheetName ) { m_sheetName = aSheetName; }
61 
65  void SetPageNumber( const std::string& aPageNumber ) { m_pageNumber = aPageNumber; }
66 
70  void SetSheetCount( int aSheetCount ) { m_sheetCount = aSheetCount; }
71 
78  void SetIsFirstPage( bool aIsFirstPage ) { m_isFirstPage = aIsFirstPage; }
79 
84  void SetColorLayer( int aLayerId )
85  {
86  m_colorLayer = aLayerId;
87  }
88 
93  void SetPageBorderColorLayer( int aLayerId )
94  {
95  m_pageBorderColorLayer = aLayerId;
96  }
97 
98  const PAGE_INFO& GetPageInfo() { return *m_pageInfo; }
99  const TITLE_BLOCK& GetTitleBlock() { return *m_titleBlock; }
100 
102  const BOX2I ViewBBox() const override;
103 
105  void ViewDraw( int aLayer, VIEW* aView ) const override;
106 
108  void ViewGetLayers( int aLayers[], int& aCount ) const override;
109 
110 #if defined(DEBUG)
111  void Show( int x, std::ostream& st ) const override { }
113 #endif
114 
118  virtual wxString GetClass() const override
119  {
120  return wxT( "WS_PROXY_VIEW_ITEM" );
121  }
122 
123  bool HitTestWorksheetItems( VIEW* aView, const wxPoint& aPosition );
124 
125 protected:
126  void buildDrawList( VIEW* aView, WS_DRAW_ITEM_LIST* aDrawList ) const;
127 
131 
132  std::string m_fileName;
133  std::string m_sheetName;
136  std::string m_pageNumber;
140 
143 
146 };
147 }
148 
149 #endif /* WS_PROXY_VIEW_ITEM_H */
WS_PROXY_VIEW_ITEM(int aScaleFactor, const PAGE_INFO *aPageInfo, const PROJECT *aProject, const TITLE_BLOCK *aTitleBlock)
PROJECT holds project specific data.
Definition: project.h:63
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:175
const TITLE_BLOCK * m_titleBlock
void ViewGetLayers(int aLayers[], int &aCount) const override
Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on.
void SetSheetName(const std::string &aSheetName)
Set the sheet name displayed in the title block.
void buildDrawList(VIEW *aView, WS_DRAW_ITEM_LIST *aDrawList) const
int m_pageBorderColorLayer
Layer that is used for page border color.
void SetColorLayer(int aLayerId)
Can be used to override which layer ID is used for worksheet item colors.
TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout,...
Definition: title_block.h:40
void SetFileName(const std::string &aFileName)
Set the file name displayed in the title block.
Store the list of graphic items: rect, lines, polygons and texts to draw/plot the title block and fra...
Definition: ws_draw_item.h:359
bool HitTestWorksheetItems(VIEW *aView, const wxPoint &aPosition)
void SetSheetCount(int aSheetCount)
Change the sheets count number displayed in the title block.
const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers.
PAGE_INFO describes the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
void SetPageNumber(const std::string &aPageNumber)
Changes the page number displayed in the title block.
const TITLE_BLOCK & GetTitleBlock()
void SetPageBorderColorLayer(int aLayerId)
Overrides the layer used to pick the color of the page border (normally LAYER_GRID)
void ViewDraw(int aLayer, VIEW *aView) const override
Function ViewDraw() Draws the parts of the object belonging to layer aLayer.
void SetIsFirstPage(bool aIsFirstPage)
Change if this is first page.
int m_mils2IUscalefactor
the factor between mils (units used in worksheet and internal units) it is the value IU_PER_MILS used...
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:186
EDA_ITEM is a base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:148
VIEW.
Definition: view.h:63
int m_colorLayer
Layer that is used for worksheet color (LAYER_WORKSHEET is always used for visibility)
virtual wxString GetClass() const override
Get class name.
const PAGE_INFO & GetPageInfo()