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" ) );
115 std::function<bool( wxString* )> wsResolver =
116 [&]( wxString* token ) ->
bool
118 bool tokenUpdated =
false;
120 if( token->IsSameAs( wxT(
"KICAD_VERSION" ) ) &&
PgmOrNull() )
125 else if( token->IsSameAs( wxT(
"#" ) ) )
127 *token = wxString::Format( wxT(
"%s" ), m_pageNumber );
130 else if( token->IsSameAs( wxT(
"##" ) ) )
132 *token = wxString::Format( wxT(
"%d" ), m_sheetCount );
135 else if( token->IsSameAs( wxT(
"SHEETNAME" ) ) )
137 *token = m_sheetName;
140 else if( token->IsSameAs( wxT(
"SHEETPATH" ) ) )
142 *token = m_sheetPath;
145 else if( token->IsSameAs( wxT(
"FILENAME" ) ) )
147 wxFileName fn( m_fileName );
148 *token = fn.GetFullName();
151 else if( token->IsSameAs( wxT(
"FILEPATH" ) ) )
153 wxFileName fn( m_fileName );
154 *token = fn.GetFullPath();
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 )
169 if( m_titleBlock->TextVarResolver( token, m_project, m_flags ) )
179 m_titleBlock =
nullptr;
183 m_titleBlock = savedTitleBlock;
188 else if( m_properties && m_properties->count( *token ) )
190 *token = m_properties->at( *token );
200 if( m_project && m_project->TextVarResolver( token ) )
212 auto item =
dynamic_cast<const EDA_ITEM*
>( aItem );
217 switch( item->Type() )
225 default:
return false;
234 m_gal->SetIsStroke(
true );
235 m_gal->SetIsFill(
false );
236 m_gal->SetStrokeColor( m_renderSettings.GetColor( aItem, aLayer ) );
237 m_gal->SetLineWidth( std::max( aItem->
GetPenWidth(), m_renderSettings.GetDefaultPenWidth() ) );
244 m_gal->SetIsStroke(
true );
245 m_gal->SetIsFill(
false );
246 m_gal->SetStrokeColor( m_renderSettings.GetColor( aItem, aLayer ) );
247 m_gal->SetLineWidth( std::max( aItem->
GetPenWidth(), m_renderSettings.GetDefaultPenWidth() ) );
254 m_gal->SetFillColor( m_renderSettings.GetColor( aItem, aLayer ) );
255 m_gal->SetIsFill(
true );
256 m_gal->SetIsStroke(
false );
263 m_gal->DrawPolygon( outline );
278 const COLOR4D&
color = m_renderSettings.GetColor( aItem, aLayer );
280 m_gal->SetStrokeColor(
color );
281 m_gal->SetFillColor(
color );
285 m_renderSettings.GetDefaultPenWidth() );
298 m_gal->Translate( position );
301 if( !( bitmap && bitmap->m_ImageBitmap
302 && bitmap->m_ImageBitmap->GetImageData() ) )
309 double img_scale = bitmap->m_ImageBitmap->GetScale();
311 if( img_scale != 1.0 )
312 m_gal->Scale(
VECTOR2D( img_scale, img_scale ) );
314 m_gal->DrawBitmap( *bitmap->m_ImageBitmap );
318 m_gal->SetIsFill(
true );
319 m_gal->SetIsStroke(
true );
320 m_gal->SetFillColor(
COLOR4D( 1, 1, 1, 0.4 ) );
321 m_gal->SetStrokeColor(
COLOR4D( 0, 0, 0, 1 ) );
323 if( img_scale != 1.0 )
324 m_gal->Scale(
VECTOR2D( 1.0, 1.0 ) );
340 m_gal->SetIsStroke(
true );
343 m_gal->SetStrokeColor( m_renderSettings.m_pageBorderColor );
344 m_gal->SetIsFill(
false );
345 m_gal->SetLineWidth( m_renderSettings.GetDefaultPenWidth() );
347 m_gal->DrawRectangle( origin, end );
352 m_gal->SetStrokeColor( m_renderSettings.m_pageBorderColor );
356 m_gal->DrawCircle( pos, marker_size );
357 m_gal->DrawLine(
VECTOR2D( pos.
x - marker_size, pos.
y - marker_size),
358 VECTOR2D( pos.
x + marker_size, pos.
y + marker_size ) );
359 m_gal->DrawLine(
VECTOR2D( pos.
x + marker_size, pos.
y - marker_size),
360 VECTOR2D( pos.
x - marker_size, pos.
y + marker_size ) );
370 m_gal->SetIsStroke(
true );
373 m_gal->SetStrokeColor( m_renderSettings.m_pageBorderColor );
374 m_gal->SetIsFill(
false );
375 m_gal->SetLineWidth( m_renderSettings.GetDefaultPenWidth() );
376 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.
std::map< int, COLOR4D > m_layerColors
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()
Return a reference that can be nullptr when running a shared lib from a script, not from a kicad app.
VECTOR2< double > VECTOR2D