KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pl_properties.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#pragma once
21
22#include <base_units.h>
25#include <eda_item.h>
26
35{
36public:
37 explicit PL_ITEM_PROPERTIES( DS_DATA_ITEM* aItem ) :
39 m_item( aItem )
40 {
41 }
42
43 wxString GetClass() const override { return wxS( "PL_ITEM_PROPERTIES" ); }
44 wxString GetFriendlyName() const override { return m_item->GetClassName(); }
45 DS_DATA_ITEM* GetItem() const { return m_item; }
46
47 wxString GetComment() const { return m_item->m_Info; }
48 void SetComment( wxString aValue ) { m_item->m_Info = aValue; }
49
50 PAGE_OPTION GetPageOption() const { return m_item->GetPage1Option(); }
51 void SetPageOption( PAGE_OPTION aValue ) { m_item->SetPage1Option( aValue ); }
52
53 int GetStartX() const { return KiROUND( m_item->m_Pos.m_Pos.x * drawSheetIUScale.IU_PER_MM ); }
54 void SetStartX( int aValue ) { m_item->m_Pos.m_Pos.x = aValue / drawSheetIUScale.IU_PER_MM; }
55
56 int GetStartY() const { return KiROUND( m_item->m_Pos.m_Pos.y * drawSheetIUScale.IU_PER_MM ); }
57 void SetStartY( int aValue ) { m_item->m_Pos.m_Pos.y = aValue / drawSheetIUScale.IU_PER_MM; }
58
59 CORNER_ANCHOR GetStartAnchor() const { return static_cast<CORNER_ANCHOR>( m_item->m_Pos.m_Anchor ); }
60 void SetStartAnchor( CORNER_ANCHOR aValue ) { m_item->m_Pos.m_Anchor = aValue; }
61
62 int GetEndX() const { return KiROUND( m_item->m_End.m_Pos.x * drawSheetIUScale.IU_PER_MM ); }
63 void SetEndX( int aValue ) { m_item->m_End.m_Pos.x = aValue / drawSheetIUScale.IU_PER_MM; }
64
65 int GetEndY() const { return KiROUND( m_item->m_End.m_Pos.y * drawSheetIUScale.IU_PER_MM ); }
66 void SetEndY( int aValue ) { m_item->m_End.m_Pos.y = aValue / drawSheetIUScale.IU_PER_MM; }
67
68 CORNER_ANCHOR GetEndAnchor() const { return static_cast<CORNER_ANCHOR>( m_item->m_End.m_Anchor ); }
69 void SetEndAnchor( CORNER_ANCHOR aValue ) { m_item->m_End.m_Anchor = aValue; }
70
71 int GetLineWidth() const { return KiROUND( m_item->m_LineWidth * drawSheetIUScale.IU_PER_MM ); }
72 void SetLineWidth( int aValue ) { m_item->m_LineWidth = aValue / drawSheetIUScale.IU_PER_MM; }
73
74 int GetRepeatCount() const { return m_item->m_RepeatCount; }
75 void SetRepeatCount( int aValue ) { m_item->m_RepeatCount = aValue; }
76
77 int GetStepX() const { return KiROUND( m_item->m_IncrementVector.x * drawSheetIUScale.IU_PER_MM ); }
78 void SetStepX( int aValue ) { m_item->m_IncrementVector.x = aValue / drawSheetIUScale.IU_PER_MM; }
79
80 int GetStepY() const { return KiROUND( m_item->m_IncrementVector.y * drawSheetIUScale.IU_PER_MM ); }
81 void SetStepY( int aValue ) { m_item->m_IncrementVector.y = aValue / drawSheetIUScale.IU_PER_MM; }
82
83 int GetLabelIncrement() const { return m_item->m_IncrementLabel; }
84 void SetLabelIncrement( int aValue ) { m_item->m_IncrementLabel = aValue; }
85
86 wxString GetText() const { return text()->m_TextBase; }
87 void SetText( wxString aValue ) { text()->m_TextBase = aValue; }
88
89 int GetTextWidth() const { return KiROUND( text()->m_TextSize.x * drawSheetIUScale.IU_PER_MM ); }
90 void SetTextWidth( int aValue ) { text()->m_TextSize.x = aValue / drawSheetIUScale.IU_PER_MM; }
91
92 int GetTextHeight() const { return KiROUND( text()->m_TextSize.y * drawSheetIUScale.IU_PER_MM ); }
93 void SetTextHeight( int aValue ) { text()->m_TextSize.y = aValue / drawSheetIUScale.IU_PER_MM; }
94
95 int GetConstraintWidth() const { return KiROUND( text()->m_BoundingBoxSize.x * drawSheetIUScale.IU_PER_MM ); }
96 void SetConstraintWidth( int aValue ) { text()->m_BoundingBoxSize.x = aValue / drawSheetIUScale.IU_PER_MM; }
97
98 int GetConstraintHeight() const { return KiROUND( text()->m_BoundingBoxSize.y * drawSheetIUScale.IU_PER_MM ); }
99 void SetConstraintHeight( int aValue ) { text()->m_BoundingBoxSize.y = aValue / drawSheetIUScale.IU_PER_MM; }
100
102 void SetHAlign( GR_TEXT_H_ALIGN_T aValue ) { text()->m_Hjustify = aValue; }
103
105 void SetVAlign( GR_TEXT_V_ALIGN_T aValue ) { text()->m_Vjustify = aValue; }
106
108 void SetTextColor( KIGFX::COLOR4D aValue ) { text()->m_TextColor = aValue; }
109
110 int GetPPI() const { return static_cast<DS_DATA_ITEM_BITMAP*>( m_item )->GetPPI(); }
111 void SetPPI( int aValue ) { static_cast<DS_DATA_ITEM_BITMAP*>( m_item )->SetPPI( aValue ); }
112
113 double GetRotation() const;
114 void SetRotation( double aValue );
115
116 wxString GetFont() const;
117 void SetFont( wxString aValue );
118 bool GetBold() const { return text()->m_Bold; }
119 void SetBold( bool aValue );
120 bool GetItalic() const { return text()->m_Italic; }
121 void SetItalic( bool aValue );
122
123private:
124 DS_DATA_ITEM_TEXT* text() const { return static_cast<DS_DATA_ITEM_TEXT*>( m_item ); }
126};
127
128
131{
132public:
133 explicit PL_PAGE_PROPERTIES( DS_DATA_MODEL& aModel ) :
135 m_model( aModel )
136 {
137 }
138
139 wxString GetClass() const override { return wxS( "PL_PAGE_PROPERTIES" ); }
140 wxString GetFriendlyName() const override { return _( "Drawing Sheet Defaults" ); }
141
142 int GetDefaultTextWidth() const { return KiROUND( m_model.m_DefaultTextSize.x * drawSheetIUScale.IU_PER_MM ); }
143 void SetDefaultTextWidth( int aValue ) { m_model.m_DefaultTextSize.x = aValue / drawSheetIUScale.IU_PER_MM; }
144
145 int GetDefaultTextHeight() const { return KiROUND( m_model.m_DefaultTextSize.y * drawSheetIUScale.IU_PER_MM ); }
146 void SetDefaultTextHeight( int aValue ) { m_model.m_DefaultTextSize.y = aValue / drawSheetIUScale.IU_PER_MM; }
147
148 int GetDefaultLineWidth() const { return KiROUND( m_model.m_DefaultLineWidth * drawSheetIUScale.IU_PER_MM ); }
149 void SetDefaultLineWidth( int aValue ) { m_model.m_DefaultLineWidth = aValue / drawSheetIUScale.IU_PER_MM; }
150
152 {
153 return KiROUND( m_model.m_DefaultTextThickness * drawSheetIUScale.IU_PER_MM );
154 }
155 void SetDefaultTextThickness( int aValue ) { m_model.m_DefaultTextThickness = aValue / drawSheetIUScale.IU_PER_MM; }
156
157 int GetLeftMargin() const { return KiROUND( m_model.GetLeftMargin() * drawSheetIUScale.IU_PER_MM ); }
158 void SetLeftMargin( int aValue ) { m_model.SetLeftMargin( aValue / drawSheetIUScale.IU_PER_MM ); }
159
160 int GetRightMargin() const { return KiROUND( m_model.GetRightMargin() * drawSheetIUScale.IU_PER_MM ); }
161 void SetRightMargin( int aValue ) { m_model.SetRightMargin( aValue / drawSheetIUScale.IU_PER_MM ); }
162
163 int GetTopMargin() const { return KiROUND( m_model.GetTopMargin() * drawSheetIUScale.IU_PER_MM ); }
164 void SetTopMargin( int aValue ) { m_model.SetTopMargin( aValue / drawSheetIUScale.IU_PER_MM ); }
165
166 int GetBottomMargin() const { return KiROUND( m_model.GetBottomMargin() * drawSheetIUScale.IU_PER_MM ); }
167 void SetBottomMargin( int aValue ) { m_model.SetBottomMargin( aValue / drawSheetIUScale.IU_PER_MM ); }
168
169private:
171};
constexpr EDA_IU_SCALE drawSheetIUScale
Definition base_units.h:129
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition box2.h:982
GR_TEXT_H_ALIGN_T m_Hjustify
KIGFX::COLOR4D m_TextColor
VECTOR2D m_BoundingBoxSize
GR_TEXT_V_ALIGN_T m_Vjustify
Drawing sheet structure type definitions.
Handle the graphic items list to draw/plot the frame and title block.
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:84
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
void SetTextHeight(int aValue)
int GetStepX() const
void SetStartAnchor(CORNER_ANCHOR aValue)
void SetStartX(int aValue)
KIGFX::COLOR4D GetTextColor() const
void SetRotation(double aValue)
void SetLineWidth(int aValue)
void SetConstraintHeight(int aValue)
int GetEndY() const
void SetLabelIncrement(int aValue)
GR_TEXT_H_ALIGN_T GetHAlign() const
void SetEndX(int aValue)
int GetTextWidth() const
void SetFont(wxString aValue)
int GetTextHeight() const
int GetLineWidth() const
int GetEndX() const
void SetComment(wxString aValue)
PAGE_OPTION GetPageOption() const
void SetStepY(int aValue)
int GetStepY() const
int GetConstraintWidth() const
PL_ITEM_PROPERTIES(DS_DATA_ITEM *aItem)
int GetStartY() const
void SetItalic(bool aValue)
void SetText(wxString aValue)
int GetConstraintHeight() const
void SetPageOption(PAGE_OPTION aValue)
DS_DATA_ITEM * GetItem() const
CORNER_ANCHOR GetStartAnchor() const
void SetConstraintWidth(int aValue)
void SetStartY(int aValue)
GR_TEXT_V_ALIGN_T GetVAlign() const
DS_DATA_ITEM_TEXT * text() const
int GetRepeatCount() const
void SetEndAnchor(CORNER_ANCHOR aValue)
void SetEndY(int aValue)
wxString GetFont() const
wxString GetText() const
CORNER_ANCHOR GetEndAnchor() const
int GetLabelIncrement() const
void SetHAlign(GR_TEXT_H_ALIGN_T aValue)
wxString GetClass() const override
Return the class name.
void SetRepeatCount(int aValue)
void SetTextWidth(int aValue)
bool GetItalic() const
void SetVAlign(GR_TEXT_V_ALIGN_T aValue)
wxString GetFriendlyName() const override
int GetStartX() const
bool GetBold() const
void SetStepX(int aValue)
void SetPPI(int aValue)
void SetTextColor(KIGFX::COLOR4D aValue)
DS_DATA_ITEM * m_item
double GetRotation() const
wxString GetComment() const
void SetBold(bool aValue)
int GetDefaultTextWidth() const
PL_PAGE_PROPERTIES(DS_DATA_MODEL &aModel)
int GetTopMargin() const
DS_DATA_MODEL & m_model
void SetRightMargin(int aValue)
void SetBottomMargin(int aValue)
int GetBottomMargin() const
int GetLeftMargin() const
void SetLeftMargin(int aValue)
int GetDefaultLineWidth() const
int GetDefaultTextHeight() const
void SetTopMargin(int aValue)
void SetDefaultLineWidth(int aValue)
void SetDefaultTextWidth(int aValue)
int GetDefaultTextThickness() const
wxString GetClass() const override
Return the class name.
void SetDefaultTextThickness(int aValue)
wxString GetFriendlyName() const override
void SetDefaultTextHeight(int aValue)
int GetRightMargin() const
PAGE_OPTION
CORNER_ANCHOR
A coordinate is relative to a page corner.
#define _(s)
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
GR_TEXT_V_ALIGN_T
This is API surface mapped to common.types.VertialAlignment.
@ TYPE_NOT_INIT
Definition typeinfo.h:73