99 aVars->push_back( wxT(
"KICAD_VERSION" ) );
100 aVars->push_back( wxT(
"#" ) );
101 aVars->push_back( wxT(
"##" ) );
102 aVars->push_back( wxT(
"SHEETNAME" ) );
103 aVars->push_back( wxT(
"SHEETPATH" ) );
104 aVars->push_back( wxT(
"FILENAME" ) );
105 aVars->push_back( wxT(
"FILEPATH" ) );
106 aVars->push_back( wxT(
"PROJECTNAME" ) );
107 aVars->push_back( wxT(
"PAPER" ) );
108 aVars->push_back( wxT(
"LAYER" ) );
117 std::function<bool( wxString* )> wsResolver =
118 [&]( wxString* token ) ->
bool
120 bool tokenUpdated =
false;
122 if( token->IsSameAs( wxT(
"KICAD_VERSION" ) ) &&
PgmOrNull() )
127 else if( token->IsSameAs( wxT(
"#" ) ) )
129 *token = wxString::Format( wxT(
"%s" ), m_pageNumber );
132 else if( token->IsSameAs( wxT(
"##" ) ) )
134 *token = wxString::Format( wxT(
"%d" ), m_sheetCount );
137 else if( token->IsSameAs( wxT(
"SHEETNAME" ) ) )
139 *token = m_sheetName;
142 else if( token->IsSameAs( wxT(
"SHEETPATH" ) ) )
144 *token = m_sheetPath;
147 else if( token->IsSameAs( wxT(
"FILENAME" ) ) )
149 wxFileName fn( m_fileName );
150 *token = fn.GetFullName();
153 else if( token->IsSameAs( wxT(
"FILEPATH" ) ) )
155 wxFileName fn( m_fileName );
156 *token = fn.GetFullPath();
159 else if( token->IsSameAs( wxT(
"PROJECTNAME" ) ) && m_project )
161 *token = m_project->GetProjectName();
164 else if( token->IsSameAs( wxT(
"PAPER" ) ) )
166 *token = m_paperFormat;
169 else if( token->IsSameAs( wxT(
"LAYER" ) ) )
171 *token = m_sheetLayer;
174 else if( m_titleBlock )
176 if( m_titleBlock->TextVarResolver( token, m_project, m_flags ) )
186 m_titleBlock =
nullptr;
190 m_titleBlock = savedTitleBlock;
195 else if( m_properties && m_properties->count( *token ) )
197 *token = m_properties->at( *token );
207 if( m_project && m_project->TextVarResolver( token ) )
219 auto item =
dynamic_cast<const EDA_ITEM*
>( aItem );
224 switch( item->Type() )
232 default:
return false;
241 m_gal->SetIsStroke(
true );
242 m_gal->SetIsFill(
false );
243 m_gal->SetStrokeColor( m_renderSettings.GetColor( aItem, aLayer ) );
244 m_gal->SetLineWidth( std::max( aItem->
GetPenWidth(), m_renderSettings.GetDefaultPenWidth() ) );
251 m_gal->SetIsStroke(
true );
252 m_gal->SetIsFill(
false );
253 m_gal->SetStrokeColor( m_renderSettings.GetColor( aItem, aLayer ) );
254 m_gal->SetLineWidth( std::max( aItem->
GetPenWidth(), m_renderSettings.GetDefaultPenWidth() ) );
261 m_gal->SetFillColor( m_renderSettings.GetColor( aItem, aLayer ) );
262 m_gal->SetIsFill(
true );
263 m_gal->SetIsStroke(
false );
270 m_gal->DrawPolygon( outline );
285 const COLOR4D&
color = m_renderSettings.GetColor( aItem, aLayer );
287 m_gal->SetStrokeColor(
color );
288 m_gal->SetFillColor(
color );
292 m_renderSettings.GetDefaultPenWidth() );
305 m_gal->Translate( position );
308 if( !( bitmap && bitmap->m_ImageBitmap
309 && bitmap->m_ImageBitmap->GetImageData() ) )
316 double img_scale = bitmap->m_ImageBitmap->GetScale();
318 if( img_scale != 1.0 )
319 m_gal->Scale(
VECTOR2D( img_scale, img_scale ) );
321 m_gal->DrawBitmap( *bitmap->m_ImageBitmap );
325 m_gal->SetIsFill(
true );
326 m_gal->SetIsStroke(
true );
327 m_gal->SetFillColor(
COLOR4D( 1, 1, 1, 0.4 ) );
328 m_gal->SetStrokeColor(
COLOR4D( 0, 0, 0, 1 ) );
330 if( img_scale != 1.0 )
331 m_gal->Scale(
VECTOR2D( 1.0, 1.0 ) );
347 m_gal->SetIsStroke(
true );
350 m_gal->SetStrokeColor( m_renderSettings.m_pageBorderColor );
351 m_gal->SetIsFill(
false );
352 m_gal->SetLineWidth( m_renderSettings.GetDefaultPenWidth() );
354 m_gal->DrawRectangle( origin, end );
359 m_gal->SetStrokeColor( m_renderSettings.m_pageBorderColor );
363 m_gal->DrawCircle( pos, marker_size );
364 m_gal->DrawLine(
VECTOR2D( pos.
x - marker_size, pos.
y - marker_size),
365 VECTOR2D( pos.
x + marker_size, pos.
y + marker_size ) );
366 m_gal->DrawLine(
VECTOR2D( pos.
x + marker_size, pos.
y - marker_size),
367 VECTOR2D( pos.
x - marker_size, pos.
y + marker_size ) );
377 m_gal->SetIsStroke(
true );
379 m_gal->SetStrokeColor( m_renderSettings.m_pageBorderColor );
380 m_gal->SetIsFill(
false );
381 m_gal->SetLineWidth( m_renderSettings.GetDefaultPenWidth() );
382 m_gal->DrawRectangle( origin, end );
BASE_SCREEN class implementation.
wxString GetBaseVersion()
Get the KiCad version string without the information added by the packagers.
constexpr const Vec GetEnd() const
constexpr const Vec & GetOrigin() const
Color settings are a bit different than most of the settings objects in that there can be more than o...
COLOR4D GetColor(int aLayer) const
virtual int GetPenWidth() const
DS_DATA_ITEM * GetPeer() const
const KIFONT::METRICS & GetFontMetrics() const
VECTOR2I GetPosition() const override
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
const VECTOR2I & GetStart() const
const VECTOR2I & GetEnd() const
static void GetTextVars(wxArrayString *aVars)
wxString BuildFullText(const wxString &aTextbase)
A rectangle with thick segment showing the page limits and a marker showing the coordinate origin.
const VECTOR2I & GetMarkerPos() const
double GetMarkerSize() const
VECTOR2I GetPageSize() const
SHAPE_POLY_SET & GetPolygons()
Non filled rectangle with thick segment.
const VECTOR2I & GetEnd() const
const VECTOR2I & GetStart() const
A base class for most all the KiCad significant classes used in schematics and boards.
KICAD_T Type() const
Returns the type of object.
bool IsBrightened() const
const VECTOR2I & GetTextPos() const
KIFONT::FONT * GetFont() const
const TEXT_ATTRIBUTES & GetAttributes() const
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
virtual wxString GetShownText(bool aAllowExtraText, int aDepth=0) const
Return the string actually shown after processing of the base text.
FONT is an abstract base class for both outline and stroke fonts.
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false, const std::vector< wxString > *aEmbeddedFiles=nullptr, bool aForDrawingSheet=false)
void Draw(KIGFX::GAL *aGal, const wxString &aText, const VECTOR2I &aPosition, const VECTOR2I &aCursor, const TEXT_ATTRIBUTES &aAttributes, const METRICS &aFontMetrics) const
Draw a string.
A color representation with 4 components: red, green, blue, alpha.
COLOR4D Brightened(double aFactor) const
Return a color that is brighter by a given factor, without modifying object.
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
void DrawBorder(const PAGE_INFO *aPageInfo, int aScaleFactor) const
void draw(const DS_DRAW_ITEM_LINE *aItem, int aLayer) const
virtual bool Draw(const VIEW_ITEM *, int) override
Takes an instance of VIEW_ITEM and passes it to a function that knows how to draw the item.
COLOR4D m_pageBorderColor
void LoadColors(const COLOR_SETTINGS *aSettings) override
virtual COLOR4D GetColor(const VIEW_ITEM *aItem, int aLayer) const override
Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using curr...
COLOR4D m_brightenedColor
COLOR4D m_backgroundColor
virtual void update()
Precalculates extra colors for layers (e.g.
COLOR4D m_layerColors[LAYER_ID_COUNT]
An abstract base class for deriving all objects that can be added to a VIEW.
Describe the page size and margins of a paper page on which to eventually print or plot.
double GetHeightMils() const
double GetWidthMils() const
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
int OutlineCount() const
Return the number of outlines in the set.
Hold the information shown in the lower right corner of a plot, printout, or editing view.
static void GetContextualTextVars(wxArrayString *aVars)
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject, int aFlags)
static const wxString productName
@ LAYER_SCHEMATIC_DRAWINGSHEET
@ LAYER_SCHEMATIC_BACKGROUND
The Cairo implementation of the graphics abstraction layer.
PGM_BASE * PgmOrNull()
similar to PGM_BASE& Pgm(), but return a reference that can be nullptr when running a shared lib from...
VECTOR2< double > VECTOR2D