KiCad PCB EDA Suite
ds_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 DS_PROXY_VIEW_ITEM_H
27 #define DS_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 DS_DRAW_ITEM_LINE;
36 class DS_DRAW_ITEM_RECT;
37 class DS_DRAW_ITEM_TEXT;
39 class DS_DRAW_ITEM_LIST;
40 
41 namespace KIGFX
42 {
43 class VIEW;
44 class GAL;
45 }
46 
48 {
49 public:
50  DS_PROXY_VIEW_ITEM( int aScaleFactor, const PAGE_INFO* aPageInfo, const PROJECT* aProject,
51  const TITLE_BLOCK* aTitleBlock );
52 
56  void SetFileName( const std::string& aFileName ) { m_fileName = aFileName; }
57 
61  void SetSheetName( const std::string& aSheetName ) { m_sheetName = aSheetName; }
62 
66  void SetPageNumber( const std::string& aPageNumber ) { m_pageNumber = aPageNumber; }
67 
71  void SetSheetCount( int aSheetCount ) { m_sheetCount = aSheetCount; }
72 
79  void SetIsFirstPage( bool aIsFirstPage ) { m_isFirstPage = aIsFirstPage; }
80 
85  void SetColorLayer( int aLayerId )
86  {
87  m_colorLayer = aLayerId;
88  }
89 
94  void SetPageBorderColorLayer( int aLayerId )
95  {
96  m_pageBorderColorLayer = aLayerId;
97  }
98 
99  const PAGE_INFO& GetPageInfo() { return *m_pageInfo; }
100  const TITLE_BLOCK& GetTitleBlock() { return *m_titleBlock; }
101 
103  const BOX2I ViewBBox() const override;
104 
106  void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override;
107 
109  void ViewGetLayers( int aLayers[], int& aCount ) const override;
110 
111 #if defined(DEBUG)
112  void Show( int x, std::ostream& st ) const override { }
114 #endif
115 
119  virtual wxString GetClass() const override
120  {
121  return wxT( "DS_PROXY_VIEW_ITEM" );
122  }
123 
124  bool HitTestDrawingSheetItems( KIGFX::VIEW* aView, const wxPoint& aPosition );
125 
126 protected:
127  void buildDrawList( KIGFX::VIEW* aView, DS_DRAW_ITEM_LIST* aDrawList ) const;
128 
132 
133  std::string m_fileName;
134  std::string m_sheetName;
137  std::string m_pageNumber;
141 
144 
147 };
148 
149 #endif /* DS_PROXY_VIEW_ITEM_H */
void SetIsFirstPage(bool aIsFirstPage)
Change if this is first page.
int m_pageBorderColorLayer
Layer that is used for page border color.
const PAGE_INFO & GetPageInfo()
Container for project specific data.
Definition: project.h:62
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:175
void SetColorLayer(int aLayerId)
Can be used to override which layer ID is used for worksheet item colors.
void ViewGetLayers(int aLayers[], int &aCount) const override
void SetFileName(const std::string &aFileName)
Set the file name displayed in the title block.
bool HitTestDrawingSheetItems(KIGFX::VIEW *aView, const wxPoint &aPosition)
void SetSheetCount(int aSheetCount)
Changes the sheet-count number displayed in the title block.
Hold the information shown in the lower right corner of a plot, printout, or editing view.
Definition: title_block.h:40
void SetSheetName(const std::string &aSheetName)
Set the sheet name displayed in the title block.
BOX2 handles a 2-D bounding box, built on top of an origin point and size vector, both of templated c...
Definition: box2.h:43
DS_PROXY_VIEW_ITEM(int aScaleFactor, const PAGE_INFO *aPageInfo, const PROJECT *aProject, const TITLE_BLOCK *aTitleBlock)
A graphic text.
Definition: ds_draw_item.h:297
int m_colorLayer
Layer that is used for worksheet color (LAYER_DRAWINGSHEET is always used for visibility)
int m_mils2IUscalefactor
the factor between mils (units used in worksheet and internal units) it is the value IU_PER_MILS used...
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:53
void buildDrawList(KIGFX::VIEW *aView, DS_DRAW_ITEM_LIST *aDrawList) const
virtual wxString GetClass() const override
Get class name.
const TITLE_BLOCK * m_titleBlock
const PAGE_INFO * m_pageInfo
Non filled rectangle with thick segment.
Definition: ds_draw_item.h:205
void ViewDraw(int aLayer, KIGFX::VIEW *aView) const override
const BOX2I ViewBBox() const override
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
const TITLE_BLOCK & GetTitleBlock()
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
Store the list of graphic items: rect, lines, polygons and texts to draw/plot the title block and fra...
Definition: ds_draw_item.h:376
void SetPageNumber(const std::string &aPageNumber)
Changes the page number displayed in the title block.
void SetPageBorderColorLayer(int aLayerId)
Overrides the layer used to pick the color of the page border (normally LAYER_GRID)
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:67
const PROJECT * m_project