KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 The 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, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef SCH_VIEW_H_
21#define SCH_VIEW_H_
22
23#include <layer_ids.h>
24#include <math/vector2d.h>
25#include <view/view.h>
26
27#include <memory>
28#include <vector>
29
30class SCH_SHEET;
31class SCH_SCREEN;
32class LIB_SYMBOL;
33class SCH_PIN;
34class SCH_BASE_FRAME;
38
39
40// Eeschema 100nm as the internal units
41constexpr double SCH_WORLD_UNIT ( 1e-7 / 0.0254 );
42
82
83
84namespace KIGFX
85{
86 class VIEW_GROUP;
87
88 namespace PREVIEW
89 {
90 class SELECTION_AREA;
91 };
92
93class SCH_VIEW : public KIGFX::VIEW
94{
95public:
96 // Note: aFrame is used to know the sheet path name when drawing the drawing sheet.
97 // It can be null.
98 SCH_VIEW( SCH_BASE_FRAME* aFrame );
99 ~SCH_VIEW();
100
101 void Update( const KIGFX::VIEW_ITEM* aItem, int aUpdateFlags ) const override;
102 void Update( const KIGFX::VIEW_ITEM* aItem ) const override;
103
104 void Cleanup();
105
112
113 void DisplaySheet( const SCH_SCREEN* aScreen );
114 void DisplaySymbol( LIB_SYMBOL* aSymbol );
115
116 void SetScale( double aScale, VECTOR2D aAnchor = { 0, 0 } ) override;
117
121 void ClearHiddenFlags();
122
123 void HideDrawingSheet();
124
126
127private:
128 SCH_BASE_FRAME* m_frame; // The frame using this view. Can be null. Used mainly
129 // to know the sheet path name when drawing the drawing sheet
130
131 std::unique_ptr<DS_PROXY_VIEW_ITEM> m_drawingSheet;
132
137 std::size_t m_textVarListenerHandle = 0;
139};
140
141}; // namespace
142
143#endif
Represent a selection area (currently a rectangle) in a VIEW, drawn corner-to-corner between two poin...
std::unique_ptr< DS_PROXY_VIEW_ITEM > m_drawingSheet
Definition sch_view.h:131
void Update(const KIGFX::VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition sch_view.cpp:73
SCH_VIEW(SCH_BASE_FRAME *aFrame)
Definition sch_view.cpp:46
std::size_t m_textVarListenerHandle
Reactive invalidation listener state.
Definition sch_view.h:137
void DisplaySymbol(LIB_SYMBOL *aSymbol)
Definition sch_view.cpp:213
DS_PROXY_VIEW_ITEM * GetDrawingSheet() const
Definition sch_view.h:125
void DisplaySheet(const SCH_SCREEN *aScreen)
Definition sch_view.cpp:125
void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 }) override
Set the scaling factor, zooming around a given anchor point.
Definition sch_view.cpp:115
void HideDrawingSheet()
Definition sch_view.cpp:266
void DetachTextVarTracker()
Drop every cached reference into the currently-attached SCHEMATIC's TEXT_VAR_TRACKER: unregister the ...
Definition sch_view.cpp:59
SCH_BASE_FRAME * m_frame
Definition sch_view.h:128
TEXT_VAR_TRACKER * m_textVarListenerTracker
Definition sch_view.h:138
void ClearHiddenFlags()
Clear the hide flag of all items in the view.
Definition sch_view.cpp:254
Extend VIEW_ITEM by possibility of grouping items into a single object.
Definition view_group.h:39
An abstract base class for deriving all objects that can be added to a VIEW.
Definition view_item.h:82
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:63
Define a library symbol object.
Definition lib_symbol.h:79
Bridges SCHEMATIC's listener stream into the generic TEXT_VAR_TRACKER.
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition sch_sheet.h:44
Coordinates the dependency index with change notifications.
@ LAYER_DRAWINGSHEET
Sheet frame and title block.
Definition layer_ids.h:274
@ LAYER_DRAW_BITMAPS
Draw images.
Definition layer_ids.h:280
@ LAYER_GP_OVERLAY
General purpose overlay.
Definition layer_ids.h:275
@ LAYER_SELECT_OVERLAY
Selected items overlay.
Definition layer_ids.h:276
@ LAYER_DANGLING
Definition layer_ids.h:475
@ LAYER_SHAPES_BACKGROUND
Definition layer_ids.h:481
@ LAYER_SHEETNAME
Definition layer_ids.h:470
@ LAYER_ERC_WARN
Definition layer_ids.h:477
@ LAYER_SHEETLABEL
Definition layer_ids.h:473
@ LAYER_PINNUM
Definition layer_ids.h:456
@ LAYER_RULE_AREAS
Definition layer_ids.h:463
@ LAYER_DEVICE
Definition layer_ids.h:464
@ LAYER_SHEET_BACKGROUND
Definition layer_ids.h:483
@ LAYER_ERC_EXCLUSION
Definition layer_ids.h:479
@ LAYER_HIERLABEL
Definition layer_ids.h:455
@ LAYER_PINNAM
Definition layer_ids.h:457
@ LAYER_PRIVATE_NOTES
Definition layer_ids.h:466
@ LAYER_GLOBLABEL
Definition layer_ids.h:454
@ LAYER_WIRE
Definition layer_ids.h:450
@ LAYER_NOTES
Definition layer_ids.h:465
@ LAYER_ERC_ERR
Definition layer_ids.h:478
@ LAYER_VALUEPART
Definition layer_ids.h:459
@ LAYER_BUS
Definition layer_ids.h:451
@ LAYER_FIELDS
Definition layer_ids.h:460
@ LAYER_DEVICE_BACKGROUND
Definition layer_ids.h:482
@ LAYER_LOCLABEL
Definition layer_ids.h:453
@ LAYER_JUNCTION
Definition layer_ids.h:452
@ LAYER_SHEETFIELDS
Definition layer_ids.h:472
@ LAYER_REFERENCEPART
Definition layer_ids.h:458
@ LAYER_NETCLASS_REFS
Definition layer_ids.h:462
@ LAYER_NOTES_BACKGROUND
Definition layer_ids.h:467
@ LAYER_OP_CURRENTS
Definition layer_ids.h:500
@ LAYER_SHEET
Definition layer_ids.h:469
@ LAYER_SELECTION_SHADOWS
Definition layer_ids.h:493
@ LAYER_INTERSHEET_REFS
Definition layer_ids.h:461
@ LAYER_OP_VOLTAGES
Definition layer_ids.h:499
@ LAYER_SHEETFILENAME
Definition layer_ids.h:471
@ LAYER_BUS_JUNCTION
Definition layer_ids.h:496
@ LAYER_NOCONNECT
Definition layer_ids.h:474
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:29
constexpr double SCH_WORLD_UNIT(1e-7/0.0254)
static const int SCH_LAYER_ORDER[]
Definition sch_view.h:43
VECTOR2< double > VECTOR2D
Definition vector2d.h:682