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 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 <memory>
28 #include <view/view.h>
29 #include <math/box2.h>
30 
31 #include <view/wx_view_controls.h>
32 #include <worksheet_viewitem.h>
34 
35 class SCH_SHEET;
36 class SCH_SCREEN;
37 class LIB_PART;
38 
39 // Eeschema uses mils as the internal units
40 constexpr double SCH_WORLD_UNIT = 0.001;
41 
42 static const LAYER_NUM SCH_LAYER_ORDER[] =
43  {
55  };
56 
57 
58 namespace KIGFX
59 {
60  class VIEW_GROUP;
61  class WORKSHEET_VIEWITEM;
62 
63  namespace PREVIEW
64  {
65  class SELECTION_AREA;
66  };
67 
68 class SCH_VIEW : public KIGFX::VIEW
69 {
70 public:
71  SCH_VIEW( bool aIsDynamic );
72  ~SCH_VIEW();
73 
74  void DisplaySheet( SCH_SHEET *aSheet );
75  void DisplaySheet( SCH_SCREEN *aScreen );
76  void DisplayComponent( LIB_PART *aPart );
77 
78  KIGFX::PREVIEW::SELECTION_AREA* GetSelectionArea() const { return m_selectionArea.get(); }
79 
80  KIGFX::VIEW_GROUP* GetPreview() const { return m_preview.get(); }
81 
82  void ClearPreview();
83  void AddToPreview( EDA_ITEM *aItem, bool takeOwnership = true );
84 
85  void ShowSelectionArea( bool aShow = true );
86  void ShowPreview( bool aShow = true );
87 
88  void ClearHiddenFlags();
89  void HideWorksheet();
90 
91 private:
92  std::unique_ptr<WORKSHEET_VIEWITEM> m_worksheet;
93  std::unique_ptr<KIGFX::PREVIEW::SELECTION_AREA> m_selectionArea;
94  std::unique_ptr<KIGFX::VIEW_GROUP> m_preview;
95  std::vector<EDA_ITEM *> m_ownedItems;
96 };
97 
98 }; // namespace
99 
100 #endif
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:58
KIGFX::PREVIEW::SELECTION_AREA * GetSelectionArea() const
Definition: sch_view.h:78
constexpr double SCH_WORLD_UNIT
Definition: sch_view.h:40
std::unique_ptr< KIGFX::PREVIEW::SELECTION_AREA > m_selectionArea
Definition: sch_view.h:93
WX_VIEW_CONTROLS class definition.
std::vector< EDA_ITEM * > m_ownedItems
Definition: sch_view.h:95
static const LAYER_NUM SCH_LAYER_ORDER[]
Definition: sch_view.h:42
KIGFX::VIEW_GROUP * GetPreview() const
Definition: sch_view.h:80
Class that handles properties and drawing of worksheet layout.
Define a library symbol object.
general purpose overlay
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:209
std::unique_ptr< WORKSHEET_VIEWITEM > m_worksheet
Definition: sch_view.h:92
Board layer functions and definitions.
currently selected items overlay
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:154
Class SELECTION_AREA.
Class VIEW.
Definition: view.h:61
std::unique_ptr< KIGFX::VIEW_GROUP > m_preview
Definition: sch_view.h:94