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(
"PAPER" ) );
106 aVars->push_back( wxT(
"LAYER" ) );
115 std::function<bool( wxString* )> wsResolver =
116 [ this ]( wxString* token ) ->
bool
118 bool tokenUpdated =
false;
120 if( token->IsSameAs( wxT(
"KICAD_VERSION" ) ) &&
PgmOrNull() )
125 *token = wxString::Format( wxT(
"%s%s %s" ),
127 Pgm().App().GetAppName(),
131 else if( token->IsSameAs( wxT(
"#" ) ) )
133 *token = wxString::Format( wxT(
"%s" ), m_pageNumber );
136 else if( token->IsSameAs( wxT(
"##" ) ) )
138 *token = wxString::Format( wxT(
"%d" ), m_sheetCount );
141 else if( token->IsSameAs( wxT(
"SHEETNAME" ) ) )
143 *token = m_sheetName;
146 else if( token->IsSameAs( wxT(
"SHEETPATH" ) ) )
148 *token = m_sheetPath;
151 else if( token->IsSameAs( wxT(
"FILENAME" ) ) )
153 wxFileName fn( m_fileName );
154 *token = fn.GetFullName();
157 else if( token->IsSameAs( wxT(
"PAPER" ) ) )
159 *token = m_paperFormat;
162 else if( token->IsSameAs( wxT(
"LAYER" ) ) )
164 *token = m_sheetLayer;
167 else if( m_titleBlock )
171 if( m_titleBlock->TextVarResolver( token, m_project ) )
174 else if( m_properties && m_properties->count( *token ) )
176 *token = m_properties->at( *token );
186 if( m_project && m_project->TextVarResolver( token ) )
198 auto item =
dynamic_cast<const EDA_ITEM*
>( aItem );
203 switch( item->Type() )
211 default:
return false;
220 m_gal->SetIsStroke(
true );
221 m_gal->SetIsFill(
false );
222 m_gal->SetStrokeColor( m_renderSettings.GetColor( aItem, aLayer ) );
223 m_gal->SetLineWidth( std::max( aItem->
GetPenWidth(), m_renderSettings.GetDefaultPenWidth() ) );
230 m_gal->SetIsStroke(
true );
231 m_gal->SetIsFill(
false );
232 m_gal->SetStrokeColor( m_renderSettings.GetColor( aItem, aLayer ) );
233 m_gal->SetLineWidth( std::max( aItem->
GetPenWidth(), m_renderSettings.GetDefaultPenWidth() ) );
240 m_gal->SetFillColor( m_renderSettings.GetColor( aItem, aLayer ) );
241 m_gal->SetIsFill(
true );
242 m_gal->SetIsStroke(
false );
249 m_gal->DrawPolygon( outline );
264 const COLOR4D&
color = m_renderSettings.GetColor( aItem, aLayer );
266 m_gal->SetStrokeColor(
color );
267 m_gal->SetFillColor(
color );
271 m_renderSettings.GetDefaultPenWidth() );
284 m_gal->Translate( position );
287 if( !( bitmap && bitmap->m_ImageBitmap
288 && bitmap->m_ImageBitmap->GetImageData() ) )
295 double img_scale = bitmap->m_ImageBitmap->GetScale();
297 if( img_scale != 1.0 )
298 m_gal->Scale(
VECTOR2D( img_scale, img_scale ) );
300 m_gal->DrawBitmap( *bitmap->m_ImageBitmap );
304 m_gal->SetIsFill(
true );
305 m_gal->SetIsStroke(
true );
306 m_gal->SetFillColor(
COLOR4D( 1, 1, 1, 0.4 ) );
307 m_gal->SetStrokeColor(
COLOR4D( 0, 0, 0, 1 ) );
309 if( img_scale != 1.0 )
310 m_gal->Scale(
VECTOR2D( 1.0, 1.0 ) );
326 m_gal->SetIsStroke(
true );
329 m_gal->SetStrokeColor( m_renderSettings.m_pageBorderColor );
330 m_gal->SetIsFill(
false );
331 m_gal->SetLineWidth( m_renderSettings.GetDefaultPenWidth() );
333 m_gal->DrawRectangle( origin, end );
338 m_gal->SetStrokeColor( m_renderSettings.m_pageBorderColor );
342 m_gal->DrawCircle( pos, marker_size );
343 m_gal->DrawLine(
VECTOR2D( pos.
x - marker_size, pos.
y - marker_size),
344 VECTOR2D( pos.
x + marker_size, pos.
y + marker_size ) );
345 m_gal->DrawLine(
VECTOR2D( pos.
x + marker_size, pos.
y - marker_size),
346 VECTOR2D( pos.
x - marker_size, pos.
y + marker_size ) );
356 m_gal->SetIsStroke(
true );
358 m_gal->SetStrokeColor( m_renderSettings.m_pageBorderColor );
359 m_gal->SetIsFill(
false );
360 m_gal->DrawRectangle( origin, end );
BASE_SCREEN class implementation.
wxString GetBuildVersion()
Get the full KiCad version string.
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)
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.
int GetHeightMils() 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.
static void GetContextualTextVars(wxArrayString *aVars)
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
PGM_BASE * PgmOrNull()
similar to PGM_BASE& Pgm(), but return a reference that can be nullptr when running a shared lib from...
static const wxString productName
@ LAYER_SCHEMATIC_DRAWINGSHEET
@ LAYER_SCHEMATIC_BACKGROUND
The Cairo implementation of the graphics abstraction layer.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
VECTOR2< double > VECTOR2D