KiCad PCB EDA Suite
sch_view.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) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
24 #ifndef SCH_VIEW_H_
25 #define SCH_VIEW_H_
26 
27 #include <layer_ids.h>
28 #include <math/vector2d.h>
29 #include <view/view.h>
30 
31 #include <memory>
32 #include <vector>
33 
34 class SCH_SHEET;
35 class SCH_SCREEN;
36 class LIB_SYMBOL;
37 class LIB_PIN;
38 class SCH_BASE_FRAME;
39 class DS_PROXY_VIEW_ITEM;
40 
41 
42 // Eeschema 100nm as the internal units
43 constexpr double SCH_WORLD_UNIT ( 1e-7 / 0.0254 );
44 
45 static const LAYER_NUM SCH_LAYER_ORDER[] =
46 {
60 };
61 
62 
63 namespace KIGFX
64 {
65  class VIEW_GROUP;
66 
67  namespace PREVIEW
68  {
69  class SELECTION_AREA;
70  };
71 
72 class SCH_VIEW : public KIGFX::VIEW
73 {
74 public:
75  // Note: aFrame is used to know the sheet path name when drawing the drawing sheet.
76  // It can be null.
77  SCH_VIEW( bool aIsDynamic, SCH_BASE_FRAME* aFrame );
78  ~SCH_VIEW();
79 
80  void Cleanup();
81 
82  void DisplaySheet( const SCH_SCREEN* aScreen );
83  void DisplaySymbol( LIB_SYMBOL* aSymbol );
84 
85  // Call it to set new draw area limits (max working and draw area size)
86  void ResizeSheetWorkingArea( const SCH_SCREEN *aScreen );
87 
88  void SetScale( double aScale, VECTOR2D aAnchor = { 0, 0 } ) override;
89 
93  void ClearHiddenFlags();
94 
95  void HideDrawingSheet();
96 
98 
99 private:
100  SCH_BASE_FRAME* m_frame; // The frame using this view. Can be null. Used mainly
101  // to know the sheet path name when drawing the drawing sheet
102 
103  std::unique_ptr<DS_PROXY_VIEW_ITEM> m_drawingSheet;
104 };
105 
106 }; // namespace
107 
108 #endif
std::unique_ptr< DS_PROXY_VIEW_ITEM > m_drawingSheet
Definition: sch_view.h:103
currently selected items overlay
Definition: layer_ids.h:214
void ClearHiddenFlags()
Clear the hide flag of all items in the view.
Definition: sch_view.cpp:171
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:236
void Cleanup()
Definition: sch_view.cpp:64
int LAYER_NUM
This can be replaced with int and removed.
Definition: layer_ids.h:40
Define a library symbol object.
Definition: lib_symbol.h:96
static const LAYER_NUM SCH_LAYER_ORDER[]
Definition: sch_view.h:45
void DisplaySheet(const SCH_SCREEN *aScreen)
Definition: sch_view.cpp:92
void ResizeSheetWorkingArea(const SCH_SCREEN *aScreen)
Definition: sch_view.cpp:82
drawingsheet frame and titleblock
Definition: layer_ids.h:212
void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 }) override
Set the scaling factor, zooming around a given anchor point.
Definition: sch_view.cpp:72
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:54
void HideDrawingSheet()
Definition: sch_view.cpp:178
constexpr double SCH_WORLD_UNIT(1e-7/0.0254)
general purpose overlay
Definition: layer_ids.h:213
SCH_BASE_FRAME * m_frame
Definition: sch_view.h:100
SCH_VIEW(bool aIsDynamic, SCH_BASE_FRAME *aFrame)
Definition: sch_view.cpp:46
void DisplaySymbol(LIB_SYMBOL *aSymbol)
Definition: sch_view.cpp:121
DS_PROXY_VIEW_ITEM * GetDrawingSheet() const
Definition: sch_view.h:97
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...