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  * @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 
25 #ifndef WS_PROXY_VIEW_ITEM_H
26 #define WS_PROXY_VIEW_ITEM_H
27 
28 #include <base_struct.h>
29 
30 class BOARD;
31 class PAGE_INFO;
32 class TITLE_BLOCK;
33 class WS_DRAW_ITEM_LINE;
34 class WS_DRAW_ITEM_RECT;
35 class WS_DRAW_ITEM_TEXT;
37 class WS_DRAW_ITEM_LIST;
38 
39 namespace KIGFX
40 {
41 class VIEW;
42 class GAL;
43 
45 {
46 public:
47  WS_PROXY_VIEW_ITEM( int aScaleFactor, const PAGE_INFO* aPageInfo, const PROJECT* aProject,
48  const TITLE_BLOCK* aTitleBlock );
49 
54  void SetFileName( const std::string& aFileName ) { m_fileName = aFileName; }
55 
60  void SetSheetName( const std::string& aSheetName ) { m_sheetName = aSheetName; }
61 
66  void SetSheetNumber( int aSheetNumber ) { m_sheetNumber = aSheetNumber; }
67 
72  void SetSheetCount( int aSheetCount ) { m_sheetCount = aSheetCount; }
73 
78  void SetColorLayer( int aLayerId )
79  {
80  m_colorLayer = aLayerId;
81  }
82 
87  void SetPageBorderColorLayer( int aLayerId )
88  {
89  m_pageBorderColorLayer = aLayerId;
90  }
91 
92  const PAGE_INFO& GetPageInfo() { return *m_pageInfo; }
93  const TITLE_BLOCK& GetTitleBlock() { return *m_titleBlock; }
94 
96  const BOX2I ViewBBox() const override;
97 
99  void ViewDraw( int aLayer, VIEW* aView ) const override;
100 
102  void ViewGetLayers( int aLayers[], int& aCount ) const override;
103 
104 #if defined(DEBUG)
105  void Show( int x, std::ostream& st ) const override { }
107 #endif
108 
112  virtual wxString GetClass() const override
113  {
114  return wxT( "WS_PROXY_VIEW_ITEM" );
115  }
116 
117  bool HitTestWorksheetItems( VIEW* aView, const wxPoint& aPosition );
118 
119 protected:
120  void buildDrawList( VIEW* aView, WS_DRAW_ITEM_LIST* aDrawList ) const;
121 
125 
126  std::string m_fileName;
127  std::string m_sheetName;
133 
136 
139 };
140 }
141 
142 #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:61
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)
Function SetSheetName() Sets 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)
Function SetFileName() Sets the file name displayed in the title block.
bool HitTestWorksheetItems(VIEW *aView, const wxPoint &aPosition)
void SetSheetCount(int aSheetCount)
Function SetSheetCount() Changes 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
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.
int m_mils2IUscalefactor
the factor between mils (units used in worksheet and internal units) it is the value IU_PER_MILS used...
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
VIEW.
Definition: view.h:61
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.
void SetSheetNumber(int aSheetNumber)
Function SetSheetNumber() Changes the sheet number displayed in the title block.
const PAGE_INFO & GetPageInfo()