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 <[email protected]>
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
31class BOARD;
32class PAGE_INFO;
33class PROJECT;
34class TITLE_BLOCK;
40
41namespace KIGFX
42{
43class VIEW;
44class GAL;
45}
46
48{
49public:
50 DS_PROXY_VIEW_ITEM( int aScaleFactor, const PAGE_INFO* aPageInfo, const PROJECT* aProject,
51 const TITLE_BLOCK* aTitleBlock,
52 const std::map<wxString, wxString>* aProperties );
53
57 void SetFileName( const std::string& aFileName ) { m_fileName = aFileName; }
58
62 void SetSheetName( const std::string& aSheetName ) { m_sheetName = aSheetName; }
63
67 void SetSheetPath( const std::string& aSheetPath ) { m_sheetPath = aSheetPath; }
68
72 void SetPageNumber( const std::string& aPageNumber ) { m_pageNumber = aPageNumber; }
73
77 void SetSheetCount( int aSheetCount ) { m_sheetCount = aSheetCount; }
78
85 void SetIsFirstPage( bool aIsFirstPage ) { m_isFirstPage = aIsFirstPage; }
86
91 void SetColorLayer( int aLayerId )
92 {
93 m_colorLayer = aLayerId;
94 }
95
100 void SetPageBorderColorLayer( int aLayerId )
101 {
102 m_pageBorderColorLayer = aLayerId;
103 }
104
105 const PAGE_INFO& GetPageInfo() { return *m_pageInfo; }
107
109 const BOX2I ViewBBox() const override;
110
112 void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override;
113
115 void ViewGetLayers( int aLayers[], int& aCount ) const override;
116
117#if defined(DEBUG)
119 void Show( int x, std::ostream& st ) const override { }
120#endif
121
125 virtual wxString GetClass() const override
126 {
127 return wxT( "DS_PROXY_VIEW_ITEM" );
128 }
129
130 bool HitTestDrawingSheetItems( KIGFX::VIEW* aView, const VECTOR2I& aPosition );
131
132protected:
133 void buildDrawList( KIGFX::VIEW* aView, const std::map<wxString, wxString>* aProperties,
134 DS_DRAW_ITEM_LIST* aDrawList ) const;
135
139
140 std::string m_fileName;
141 std::string m_sheetName;
142 std::string m_sheetPath;
145 std::string m_pageNumber;
149
150 const std::map<wxString, wxString>* m_properties;
151
154
157};
158
159#endif /* DS_PROXY_VIEW_ITEM_H */
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
Store the list of graphic items: rect, lines, polygons and texts to draw/plot the title block and fra...
Definition: ds_draw_item.h:383
Non filled rectangle with thick segment.
Definition: ds_draw_item.h:207
A graphic text.
Definition: ds_draw_item.h:302
void SetSheetPath(const std::string &aSheetPath)
Set the sheet path displayed in the title block.
void SetSheetCount(int aSheetCount)
Changes the sheet-count number displayed in the title block.
const PROJECT * m_project
void SetPageNumber(const std::string &aPageNumber)
Changes the page number displayed in the title block.
int m_colorLayer
Layer that is used for drawing sheet color (LAYER_DRAWINGSHEET is always used for visibility)
const BOX2I ViewBBox() const override
const TITLE_BLOCK * m_titleBlock
void SetSheetName(const std::string &aSheetName)
Set the sheet name displayed in the title block.
void SetPageBorderColorLayer(int aLayerId)
Overrides the layer used to pick the color of the page border (normally LAYER_GRID)
const PAGE_INFO & GetPageInfo()
void SetIsFirstPage(bool aIsFirstPage)
Change if this is first page.
const std::map< wxString, wxString > * m_properties
const TITLE_BLOCK & GetTitleBlock()
bool HitTestDrawingSheetItems(KIGFX::VIEW *aView, const VECTOR2I &aPosition)
void SetFileName(const std::string &aFileName)
Set the file name displayed in the title block.
void ViewDraw(int aLayer, KIGFX::VIEW *aView) const override
void SetColorLayer(int aLayerId)
Can be used to override which layer ID is used for drawing sheet item colors.
int m_mils2IUscalefactor
the factor between mils (units used in drawing sheet and internal units) it is the value IU_PER_MILS ...
void buildDrawList(KIGFX::VIEW *aView, const std::map< wxString, wxString > *aProperties, DS_DRAW_ITEM_LIST *aDrawList) const
DS_PROXY_VIEW_ITEM(int aScaleFactor, const PAGE_INFO *aPageInfo, const PROJECT *aProject, const TITLE_BLOCK *aTitleBlock, const std::map< wxString, wxString > *aProperties)
virtual wxString GetClass() const override
Get class name.
const PAGE_INFO * m_pageInfo
void ViewGetLayers(int aLayers[], int &aCount) const override
int m_pageBorderColorLayer
Layer that is used for page border color.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:69
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
Container for project specific data.
Definition: project.h:63
Hold the information shown in the lower right corner of a plot, printout, or editing view.
Definition: title_block.h:41
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:243