7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-19 21:41:40 +00:00

Harmonize print/plot APIs.

This commit is contained in:
Jeff Young 2024-04-05 22:35:32 +01:00
parent 5dd8747ecb
commit 1028a76e4a
74 changed files with 759 additions and 780 deletions

View File

@ -376,7 +376,7 @@ void SCH_EDIT_FRAME::AnnotateSymbols( SCH_COMMIT* aCommit, ANNOTATE_SCOPE_T aAn
if( symbol->GetUnitCount() > 1 )
{
msg.Printf( _( "Updated %s (unit %s) from %s to %s." ),
symbol->GetValueFieldText( true, sheet, false ),
symbol->GetValue( true, sheet, false ),
symbol->SubReference( symbol->GetUnit(), false ),
prevRef,
newRef );
@ -384,7 +384,7 @@ void SCH_EDIT_FRAME::AnnotateSymbols( SCH_COMMIT* aCommit, ANNOTATE_SCOPE_T aAn
else
{
msg.Printf( _( "Updated %s from %s to %s." ),
symbol->GetValueFieldText( true, sheet, false ),
symbol->GetValue( true, sheet, false ),
prevRef,
newRef );
}
@ -394,14 +394,14 @@ void SCH_EDIT_FRAME::AnnotateSymbols( SCH_COMMIT* aCommit, ANNOTATE_SCOPE_T aAn
if( symbol->GetUnitCount() > 1 )
{
msg.Printf( _( "Annotated %s (unit %s) as %s." ),
symbol->GetValueFieldText( true, sheet, false ),
symbol->GetValue( true, sheet, false ),
symbol->SubReference( symbol->GetUnit(), false ),
newRef );
}
else
{
msg.Printf( _( "Annotated %s as %s." ),
symbol->GetValueFieldText( true, sheet, false ),
symbol->GetValue( true, sheet, false ),
newRef );
}
}

View File

@ -146,9 +146,13 @@ bool CONNECTION_SUBGRAPH::ResolveDrivers( bool aCheckMultipleDrivers )
{
PRIORITY item_priority = GetDriverPriority( item );
if( item_priority == PRIORITY::PIN
&& !static_cast<SCH_PIN*>( item )->GetParentSymbol()->IsInNetlist() )
continue;
if( item_priority == PRIORITY::PIN )
{
SCH_PIN* pin = static_cast<SCH_PIN*>( item );
if( !static_cast<SCH_SYMBOL*>( pin->GetParentSymbol() )->IsInNetlist() )
continue;
}
if( item_priority >= PRIORITY::HIER_LABEL )
strong_drivers.insert( item );
@ -500,7 +504,7 @@ CONNECTION_SUBGRAPH::PRIORITY CONNECTION_SUBGRAPH::GetDriverPriority( SCH_ITEM*
case SCH_PIN_T:
{
SCH_PIN* sch_pin = static_cast<SCH_PIN*>( aDriver );
SCH_SYMBOL* sym = sch_pin->GetParentSymbol();
const SCH_SYMBOL* sym = static_cast<SCH_SYMBOL*>( sch_pin->GetParentSymbol() );
if( sch_pin->IsGlobalPower() )
return PRIORITY::POWER_PIN;
@ -1460,7 +1464,7 @@ void CONNECTION_GRAPH::generateGlobalPowerPinSubGraphs()
// in the symbol, but we support legacy non-power symbols with global
// power connections based on invisible, power-in, pin's names.
if( pin->GetLibPin()->GetParentSymbol()->IsPower() )
connection->SetName( pin->GetParentSymbol()->GetValueFieldText( true, &sheet, false ) );
connection->SetName( pin->GetParentSymbol()->GetValue( true, &sheet, false ) );
else
connection->SetName( pin->GetShownName() );

View File

@ -317,9 +317,9 @@ void SCH_EDIT_FRAME::SendSelectItemsToPcb( const std::vector<EDA_ITEM*>& aItems,
case SCH_PIN_T:
{
SCH_PIN* pin = static_cast<SCH_PIN*>( item );
SCH_SYMBOL* symbol = pin->GetParentSymbol();
wxString ref = symbol->GetField( REFERENCE_FIELD )->GetText();
SCH_PIN* pin = static_cast<SCH_PIN*>( item );
SYMBOL* symbol = pin->GetParentSymbol();
wxString ref = symbol->GetRef( &GetCurrentSheet(), false );
parts.push_back( wxT( "P" ) + EscapeString( ref, CTX_IPC ) + wxT( "/" )
+ EscapeString( pin->GetShownNumber(), CTX_IPC ) );

View File

@ -407,7 +407,7 @@ void DIALOG_PIN_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
renderSettings.m_Transform = DefaultTransform;
renderSettings.SetPrintDC( &dc );
m_dummyPin->Print( &renderSettings, -bBox.Centre(), false, false );
m_dummyPin->Print( &renderSettings, 0, 0, -bBox.Centre(), false, false );
event.Skip();
}

View File

@ -378,24 +378,22 @@ void DIALOG_PLOT_SCHEMATIC::plotSchematic( bool aPlotAll )
COLOR_SETTINGS* colors = getColorSettings();
SCH_PLOT_SETTINGS plotSettings;
plotSettings.m_plotDrawingSheet = getPlotDrawingSheet();
plotSettings.m_plotAll = aPlotAll;
plotSettings.m_blackAndWhite = !getModeColor();
plotSettings.m_useBackgroundColor = m_plotBackgroundColor->GetValue();
plotSettings.m_theme = colors->GetFilename();
plotSettings.m_PDFPropertyPopups = m_plotPDFPropertyPopups->GetValue();
plotSettings.m_PDFMetadata = m_plotPDFMetadata->GetValue();
plotSettings.m_HPGLPaperSizeSelect = static_cast<HPGL_PAGE_SIZE>( m_HPGLPaperSizeSelect );
plotSettings.m_HPGLPlotOrigin =
SCH_PLOT_OPTS plotOpts;
plotOpts.m_plotDrawingSheet = getPlotDrawingSheet();
plotOpts.m_plotAll = aPlotAll;
plotOpts.m_blackAndWhite = !getModeColor();
plotOpts.m_useBackgroundColor = m_plotBackgroundColor->GetValue();
plotOpts.m_theme = colors->GetFilename();
plotOpts.m_PDFPropertyPopups = m_plotPDFPropertyPopups->GetValue();
plotOpts.m_PDFMetadata = m_plotPDFMetadata->GetValue();
plotOpts.m_HPGLPaperSizeSelect = static_cast<HPGL_PAGE_SIZE>( m_HPGLPaperSizeSelect );
plotOpts.m_HPGLPlotOrigin =
static_cast<HPGL_PLOT_ORIGIN_AND_UNITS>( m_plotOriginOpt->GetSelection() );
plotSettings.m_HPGLPenSize = m_HPGLPenSize;
plotSettings.m_outputDirectory = getOutputPath();
plotSettings.m_pageSizeSelect = m_pageSizeSelect;
plotOpts.m_HPGLPenSize = m_HPGLPenSize;
plotOpts.m_outputDirectory = getOutputPath();
plotOpts.m_pageSizeSelect = m_pageSizeSelect;
schPlotter->Plot( GetPlotFileFormat(), plotSettings, &renderSettings,
&m_MessagesBox->Reporter() );
schPlotter->Plot( GetPlotFileFormat(), plotOpts, &renderSettings, &m_MessagesBox->Reporter() );
if( GetPlotFileFormat() == PLOT_FORMAT::PDF && getOpenFileAfterPlot() )
wxLaunchDefaultApplication( schPlotter->GetLastOutputFilePath() );

View File

@ -208,23 +208,23 @@ int EESCHEMA_JOBS_HANDLER::JobExportPlot( JOB* aJob )
case JOB_PAGE_SIZE::PAGE_SIZE_AUTO: pageSizeSelect = PageFormatReq::PAGE_SIZE_AUTO; break;
}
SCH_PLOT_SETTINGS settings;
settings.m_blackAndWhite = aPlotJob->m_blackAndWhite;
settings.m_HPGLPaperSizeSelect = hpglPageSize;
settings.m_HPGLPenSize = aPlotJob->m_HPGLPenSize;
settings.m_HPGLPlotOrigin = hpglOrigin;
settings.m_PDFPropertyPopups = aPlotJob->m_PDFPropertyPopups;
settings.m_PDFMetadata = aPlotJob->m_PDFMetadata;
settings.m_outputDirectory = aPlotJob->m_outputDirectory;
settings.m_outputFile = aPlotJob->m_outputFile;
settings.m_pageSizeSelect = pageSizeSelect;
settings.m_plotAll = aPlotJob->m_plotAll;
settings.m_plotDrawingSheet = aPlotJob->m_plotDrawingSheet;
settings.m_plotPages = aPlotJob->m_plotPages;
settings.m_theme = aPlotJob->m_theme;
settings.m_useBackgroundColor = aPlotJob->m_useBackgroundColor;
SCH_PLOT_OPTS plotOpts;
plotOpts.m_blackAndWhite = aPlotJob->m_blackAndWhite;
plotOpts.m_HPGLPaperSizeSelect = hpglPageSize;
plotOpts.m_HPGLPenSize = aPlotJob->m_HPGLPenSize;
plotOpts.m_HPGLPlotOrigin = hpglOrigin;
plotOpts.m_PDFPropertyPopups = aPlotJob->m_PDFPropertyPopups;
plotOpts.m_PDFMetadata = aPlotJob->m_PDFMetadata;
plotOpts.m_outputDirectory = aPlotJob->m_outputDirectory;
plotOpts.m_outputFile = aPlotJob->m_outputFile;
plotOpts.m_pageSizeSelect = pageSizeSelect;
plotOpts.m_plotAll = aPlotJob->m_plotAll;
plotOpts.m_plotDrawingSheet = aPlotJob->m_plotDrawingSheet;
plotOpts.m_plotPages = aPlotJob->m_plotPages;
plotOpts.m_theme = aPlotJob->m_theme;
plotOpts.m_useBackgroundColor = aPlotJob->m_useBackgroundColor;
schPlotter->Plot( format, settings, renderSettings.get(), m_reporter );
schPlotter->Plot( format, plotOpts, renderSettings.get(), m_reporter );
return CLI::EXIT_CODES::OK;
}
@ -772,25 +772,23 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob,
return CLI::EXIT_CODES::ERR_INVALID_INPUT_FILE;
}
LOCALE_IO toggle;
LOCALE_IO toggle;
SCH_PLOT_OPTS plotOpts;
plotter->StartPlot( wxT( "1" ) );
bool background = true;
TRANSFORM temp; // Uses default transform
VECTOR2I plotPos;
plotPos.x = pageInfo.GetWidthIU( schIUScale.IU_PER_MILS ) / 2;
plotPos.y = pageInfo.GetHeightIU( schIUScale.IU_PER_MILS ) / 2;
bool background = true;
VECTOR2I offset( pageInfo.GetWidthIU( schIUScale.IU_PER_MILS ) / 2,
pageInfo.GetHeightIU( schIUScale.IU_PER_MILS ) / 2 );
// note, we want the fields from the original symbol pointer (in case of non-alias)
symbolToPlot->Plot( plotter, unit, bodyStyle, background, plotPos, temp, false );
symbol->PlotLibFields( plotter, unit, bodyStyle, background, plotPos, temp, false,
aSvgJob->m_includeHiddenFields );
symbolToPlot->Plot( plotter, background, plotOpts, unit, bodyStyle, offset, false );
symbol->PlotFields( plotter, background, plotOpts, unit, bodyStyle, offset, false,
aSvgJob->m_includeHiddenFields );
symbolToPlot->Plot( plotter, unit, bodyStyle, !background, plotPos, temp, false );
symbol->PlotLibFields( plotter, unit, bodyStyle, !background, plotPos, temp, false,
aSvgJob->m_includeHiddenFields );
symbolToPlot->Plot( plotter, !background, plotOpts, unit, bodyStyle, offset, false );
symbol->PlotFields( plotter, !background, plotOpts, unit, bodyStyle, offset, false,
aSvgJob->m_includeHiddenFields );
plotter->EndPlot();
delete plotter;

View File

@ -127,15 +127,15 @@ KIFONT::FONT* LIB_FIELD::getDrawFont() const
}
void LIB_FIELD::print( const SCH_RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
bool aForceNoFill, bool aDimmed )
void LIB_FIELD::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
{
wxDC* DC = aSettings->GetPrintDC();
COLOR4D color = aSettings->GetLayerColor( IsVisible() ? GetDefaultLayer() : LAYER_HIDDEN );
COLOR4D bg = aSettings->GetBackgroundColor();
bool blackAndWhiteMode = GetGRForceBlackPenState();
int penWidth = GetEffectivePenWidth( aSettings );
VECTOR2I text_pos = aSettings->m_Transform.TransformCoordinate( GetTextPos() ) + aOffset;
VECTOR2I text_pos = aSettings->TransformCoordinate( GetTextPos() ) + aOffset;
if( blackAndWhiteMode || bg == COLOR4D::UNSPECIFIED )
bg = COLOR4D::WHITE;
@ -332,18 +332,18 @@ void LIB_FIELD::Rotate( const VECTOR2I& center, bool aRotateCCW )
}
void LIB_FIELD::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
const TRANSFORM& aTransform, bool aDimmed ) const
void LIB_FIELD::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed )
{
if( GetText().IsEmpty() || aBackground )
return;
RENDER_SETTINGS* renderSettings = aPlotter->RenderSettings();
SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter );
// Calculate the text orientation, according to the symbol orientation/mirror.
EDA_ANGLE orient = GetTextAngle();
if( aTransform.y1 ) // Rotate symbol 90 deg.
if( renderSettings->m_Transform.y1 ) // Rotate symbol 90 deg.
{
if( orient.IsHorizontal() )
orient = ANGLE_VERTICAL;
@ -356,7 +356,7 @@ void LIB_FIELD::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffs
GR_TEXT_H_ALIGN_T hjustify = GR_TEXT_H_ALIGN_CENTER;
GR_TEXT_V_ALIGN_T vjustify = GR_TEXT_V_ALIGN_CENTER;
VECTOR2I textpos = aTransform.TransformCoordinate( bbox.Centre() ) + aOffset;
VECTOR2I textpos = renderSettings->TransformCoordinate( bbox.Centre() ) + aOffset;
COLOR4D color;
COLOR4D bg;

View File

@ -175,8 +175,11 @@ public:
void MirrorVertically( int aCenter ) override;
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) override;
void Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
const TRANSFORM& aTransform, bool aDimmed ) const override;
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed ) override;
void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
@ -218,15 +221,6 @@ private:
*/
int compare( const LIB_ITEM& aOther, int aCompareFlags = 0 ) const override;
/**
* Print the field.
*
* If \a aData not NULL, \a aData must point a wxString which is used instead of
* the m_Text
*/
void print( const SCH_RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, bool aForceNoFill,
bool aDimmed ) override;
/**
* Calculate the new circle at \a aPosition when editing.
*

View File

@ -169,13 +169,6 @@ const KIFONT::METRICS& LIB_ITEM::GetFontMetrics() const
}
void LIB_ITEM::Print( const SCH_RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
bool aForceNoFill, bool aDimmed )
{
print( aSettings, aOffset, aForceNoFill, aDimmed );
}
void LIB_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
{
// Basic fallback

View File

@ -173,22 +173,13 @@ public:
*/
virtual void CalcEdit( const VECTOR2I& aPosition ) {}
/**
* Draw an item
*
* @param aOffset Offset to draw
* @param aDimmed Dim the color on the printout
*/
virtual void Print( const SCH_RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
bool aForceNoFill, bool aDimmed );
virtual int GetPenWidth() const = 0;
const wxString& GetDefaultFont() const;
const KIFONT::METRICS& GetFontMetrics() const;
virtual int GetEffectivePenWidth( const RENDER_SETTINGS* aSettings ) const
virtual int GetEffectivePenWidth( const SCH_RENDER_SETTINGS* aSettings ) const
{
// For historical reasons, a stored value of 0 means "default width" and negative
// numbers meant "don't stroke".
@ -328,18 +319,29 @@ public:
virtual void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) = 0;
/**
* Plot the draw item using the plot object.
* Print an item.
*
* @param aUnit - which unit to print.
* @param aBodyStyle - which body style to print.
* @param aOffset - relative offset.
* @param aForceNoFill - disable printing of fills.
* @param aDimmed - reduce brightness of item.
*/
virtual void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed ) = 0;
/**
* Plot the item to \a aPlotter.
*
* @param aPlotter The plot object to plot to.
* @param aBackground a poor-man's Z-order. The routine will get called twice, first with
* aBackground true and then with aBackground false.
* @param aOffset Plot offset position.
* @param aFill Flag to indicate whether or not the object is filled.
* @param aTransform The plot transform.
* @param aDimmed if true, reduce color to background
* @param aUnit - which unit to print.
* @param aBodyStyle - which body style to print.
* @param aOffset relative offset.
* @param aDimmed reduce brightness of item.
*/
virtual void Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
const TRANSFORM& aTransform, bool aDimmed ) const = 0;
virtual void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) = 0;
void SetUnit( int aUnit ) { m_unit = aUnit; }
int GetUnit() const { return m_unit; }
@ -360,6 +362,11 @@ public:
#endif
protected:
SCH_RENDER_SETTINGS* getRenderSettings( PLOTTER* aPlotter ) const
{
return static_cast<SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
}
/**
* Provide the draw object specific comparison called by the == and < operators.
*
@ -382,13 +389,6 @@ protected:
*/
virtual int compare( const LIB_ITEM& aOther, int aCompareFlags = 0 ) const;
/**
* @param aOffset A reference to a wxPoint object containing the offset where to draw
* from the object's current position.
*/
virtual void print( const SCH_RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
bool aForceNoFill, bool aDimmed ) = 0;
private:
friend class LIB_SYMBOL;

View File

@ -195,8 +195,8 @@ VECTOR2I LIB_PIN::GetPinRoot() const
}
void LIB_PIN::print( const SCH_RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
bool aForceNoFill, bool aDimmed )
void LIB_PIN::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
{
LIB_SYMBOL* part = dynamic_cast<LIB_SYMBOL*>( GetParentSymbol() );
@ -206,7 +206,7 @@ void LIB_PIN::print( const SCH_RENDER_SETTINGS* aSettings, const VECTOR2I& aOffs
PIN_ORIENTATION orient = PinDrawOrient( aSettings->m_Transform );
/* Calculate the pin position */
VECTOR2I pos1 = aSettings->m_Transform.TransformCoordinate( m_position ) + aOffset;
VECTOR2I pos1 = aSettings->TransformCoordinate( m_position ) + aOffset;
if( IsVisible() || aSettings->m_ShowHiddenLibFields )
{
@ -244,7 +244,7 @@ void LIB_PIN::print( const SCH_RENDER_SETTINGS* aSettings, const VECTOR2I& aOffs
}
void LIB_PIN::printPinSymbol( const RENDER_SETTINGS* aSettings, const VECTOR2I& aPos,
void LIB_PIN::printPinSymbol( const SCH_RENDER_SETTINGS* aSettings, const VECTOR2I& aPos,
PIN_ORIENTATION aOrient, bool aDimmed )
{
wxDC* DC = aSettings->GetPrintDC();
@ -616,13 +616,14 @@ void LIB_PIN::printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, VECT
}
void LIB_PIN::PlotSymbol( PLOTTER *aPlotter, const VECTOR2I &aPosition,
PIN_ORIENTATION aOrientation, bool aDimmed ) const
void LIB_PIN::PlotPinType( PLOTTER *aPlotter, const VECTOR2I &aPosition,
PIN_ORIENTATION aOrientation, bool aDimmed ) const
{
int MapX1, MapY1, x1, y1;
COLOR4D color = aPlotter->RenderSettings()->GetLayerColor( LAYER_PIN );
COLOR4D bg = aPlotter->RenderSettings()->GetBackgroundColor();
int penWidth = GetEffectivePenWidth( aPlotter->RenderSettings() );
int MapX1, MapY1, x1, y1;
SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter );
COLOR4D color = renderSettings->GetLayerColor( LAYER_PIN );
COLOR4D bg = renderSettings->GetBackgroundColor();
int penWidth = GetEffectivePenWidth( renderSettings );
if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
bg = COLOR4D::WHITE;
@ -1163,18 +1164,19 @@ void LIB_PIN::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
}
void LIB_PIN::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
const TRANSFORM& aTransform, bool aDimmed ) const
void LIB_PIN::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed )
{
if( !IsVisible() || aBackground )
return;
const SYMBOL* part = GetParentSymbol();
SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter );
const SYMBOL* part = GetParentSymbol();
PIN_ORIENTATION orient = PinDrawOrient( renderSettings->m_Transform );
PIN_ORIENTATION orient = PinDrawOrient( aTransform );
VECTOR2I pos = aTransform.TransformCoordinate( m_position ) + aOffset;
VECTOR2I pos = renderSettings->TransformCoordinate( m_position ) + aOffset;
PlotSymbol( aPlotter, pos, orient, aDimmed );
PlotPinType( aPlotter, pos, orient, aDimmed );
PlotPinTexts( aPlotter, pos, orient, part->GetPinNameOffset(), part->GetShowPinNumbers(),
part->GetShowPinNames(), aDimmed );
}

View File

@ -143,13 +143,8 @@ public:
ALT GetAlt( const wxString& aAlt ) { return m_alternates[ aAlt ]; }
/**
* Print a pin, with or without the pin texts
*
* @param aOffset Offset to draw
*/
void print( const SCH_RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, bool aForceNoFill,
bool aDimmed ) override;
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed ) override;
/**
* Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT),
@ -209,19 +204,6 @@ public:
int GetPenWidth() const override;
/**
* Plot the pin number and pin text info, given the pin line coordinates.
* Same as DrawPinTexts((), but output is the plotter
* The line must be vertical or horizontal.
* If TextInside then the text is been put inside (moving from x1, y1 in
* the opposite direction to x2,y2), otherwise all is drawn outside.
*/
void PlotPinTexts( PLOTTER *aPlotter, const VECTOR2I &aPinPos, PIN_ORIENTATION aPinOrient,
int aTextInside, bool aDrawPinNum, bool aDrawPinName, bool aDimmed ) const;
void PlotSymbol( PLOTTER *aPlotter, const VECTOR2I &aPosition, PIN_ORIENTATION aOrientation,
bool aDimmed ) const;
void Offset( const VECTOR2I& aOffset ) override;
void MoveTo( const VECTOR2I& aNewPosition ) override;
@ -241,8 +223,21 @@ public:
void MirrorVertically( int aCenter ) override;
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) override;
void Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
const TRANSFORM& aTransform, bool aDimmed ) const override;
/**
* Plot the pin number and pin text info, given the pin line coordinates.
* Same as DrawPinTexts((), but output is the plotter
* The line must be vertical or horizontal.
* If TextInside then the text is been put inside (moving from x1, y1 in
* the opposite direction to x2,y2), otherwise all is drawn outside.
*/
void PlotPinTexts( PLOTTER *aPlotter, const VECTOR2I &aPinPos, PIN_ORIENTATION aPinOrient,
int aTextInside, bool aDrawPinNum, bool aDrawPinName, bool aDimmed ) const;
void PlotPinType( PLOTTER *aPlotter, const VECTOR2I &aPosition, PIN_ORIENTATION aOrientation,
bool aDimmed ) const;
void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
BITMAPS GetMenuImage() const override;
@ -287,7 +282,7 @@ protected:
* Print the pin symbol without text.
* If \a aColor != 0, draw with \a aColor, else with the normal pin color.
*/
void printPinSymbol( const RENDER_SETTINGS *aSettings, const VECTOR2I &aPos,
void printPinSymbol( const SCH_RENDER_SETTINGS *aSettings, const VECTOR2I &aPos,
PIN_ORIENTATION aOrientation, bool aDimmed );
/**

View File

@ -131,14 +131,16 @@ void LIB_SHAPE::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
}
void LIB_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
const TRANSFORM& aTransform, bool aDimmed ) const
void LIB_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed )
{
if( IsPrivate() )
return;
VECTOR2I start = aTransform.TransformCoordinate( m_start ) + aOffset;
VECTOR2I end = aTransform.TransformCoordinate( m_end ) + aOffset;
SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter );
VECTOR2I start = renderSettings->TransformCoordinate( m_start ) + aOffset;
VECTOR2I end = renderSettings->TransformCoordinate( m_end ) + aOffset;
static std::vector<VECTOR2I> cornerList;
@ -148,14 +150,14 @@ void LIB_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffs
cornerList.clear();
for( const VECTOR2I& pt : poly.CPoints() )
cornerList.push_back( aTransform.TransformCoordinate( pt ) + aOffset );
cornerList.push_back( renderSettings->TransformCoordinate( pt ) + aOffset );
}
else if( GetShape() == SHAPE_T::BEZIER )
{
cornerList.clear();
for( const VECTOR2I& pt : m_bezierPoints )
cornerList.push_back( aTransform.TransformCoordinate( pt ) + aOffset );
cornerList.push_back( renderSettings->TransformCoordinate( pt ) + aOffset );
}
int penWidth;
@ -178,7 +180,7 @@ void LIB_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffs
break;
case FILL_T::FILLED_WITH_BG_BODYCOLOR:
color = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND );
color = renderSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
break;
default:
@ -191,7 +193,7 @@ void LIB_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffs
else
{
if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
color = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE );
color = renderSettings->GetLayerColor( LAYER_DEVICE );
if( lineStyle == LINE_STYLE::DEFAULT )
lineStyle = LINE_STYLE::SOLID;
@ -201,10 +203,10 @@ void LIB_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffs
else
fill = FILL_T::NO_FILL;
penWidth = GetEffectivePenWidth( aPlotter->RenderSettings() );
penWidth = GetEffectivePenWidth( renderSettings );
}
COLOR4D bg = aPlotter->RenderSettings()->GetBackgroundColor();
COLOR4D bg = renderSettings->GetBackgroundColor();
if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
bg = COLOR4D::WHITE;
@ -222,7 +224,7 @@ void LIB_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffs
{
case SHAPE_T::ARC:
{
VECTOR2I mid = aTransform.TransformCoordinate( GetArcMid() ) + aOffset;
VECTOR2I mid = renderSettings->TransformCoordinate( GetArcMid() ) + aOffset;
aPlotter->Arc( start, mid, end, fill, penWidth );
break;
@ -230,7 +232,7 @@ void LIB_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffs
case SHAPE_T::CIRCLE:
{
VECTOR2I center = aTransform.TransformCoordinate( getCenter() ) + aOffset;
VECTOR2I center = renderSettings->TransformCoordinate( getCenter() ) + aOffset;
aPlotter->Circle( center, GetRadius() * 2, fill, penWidth );
break;
@ -259,8 +261,8 @@ int LIB_SHAPE::GetPenWidth() const
}
void LIB_SHAPE::print( const SCH_RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
bool aForceNoFill, bool aDimmed )
void LIB_SHAPE::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
{
if( IsPrivate() )
return;

View File

@ -109,8 +109,11 @@ public:
void MirrorVertically( int aCenter ) override;
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) override;
void Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
const TRANSFORM& aTransform, bool aDimmed ) const override;
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed ) override;
void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
@ -134,9 +137,6 @@ private:
* - Circle radius.
*/
int compare( const LIB_ITEM& aOther, int aCompareFlags = 0 ) const override;
void print( const SCH_RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, bool aForceNoFill,
bool aDimmed ) override;
};

View File

@ -377,13 +377,9 @@ int LIB_SYMBOL::Compare( const LIB_SYMBOL& aRhs, int aCompareFlags, REPORTER* aR
bField = aRhs.FindField( aField->GetName() );
if( !bField )
{
tmp = 1;
}
else
{
tmp = aFieldItem->compare( *bField, aCompareFlags );
}
if( tmp )
{
@ -738,42 +734,8 @@ wxString LIB_SYMBOL::LetterSubReference( int aUnit, int aFirstId )
}
void LIB_SYMBOL::PrintBackground( const SCH_RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
int aUnit, int aBodyStyle, bool aForceNoFill, bool aDimmed )
{
/* draw background for filled items using background option
* Solid lines will be drawn after the background
* Note also, background is not drawn when printing in black and white
*/
if( !GetGRForceBlackPenState() )
{
for( LIB_ITEM& item : m_drawings )
{
// Do not print private items
if( item.IsPrivate() )
continue;
if( item.Type() == LIB_SHAPE_T )
{
LIB_SHAPE& shape = static_cast<LIB_SHAPE&>( item );
// Do not draw items not attached to the current part
if( aUnit && shape.m_unit && ( shape.m_unit != aUnit ) )
continue;
if( aBodyStyle && shape.m_bodyStyle && ( shape.m_bodyStyle != aBodyStyle ) )
continue;
if( shape.GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR )
shape.Print( aSettings, aOffset, false, aDimmed );
}
}
}
}
void LIB_SYMBOL::Print( const SCH_RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
int aUnit, int aBodyStyle, bool aForceNoFill, bool aDimmed )
void LIB_SYMBOL::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
{
for( LIB_ITEM& item : m_drawings )
{
@ -801,11 +763,11 @@ void LIB_SYMBOL::Print( const SCH_RENDER_SETTINGS* aSettings, const VECTOR2I& aO
if( item.Type() == LIB_PIN_T )
{
item.Print( aSettings, aOffset, aForceNoFill, aDimmed );
item.Print( aSettings, aUnit, aBodyStyle, aOffset, aForceNoFill, aDimmed );
}
else if( item.Type() == LIB_FIELD_T )
{
item.Print( aSettings, aOffset, aForceNoFill, aDimmed );
item.Print( aSettings, aUnit, aBodyStyle, aOffset, aForceNoFill, aDimmed );
}
else if( item.Type() == LIB_SHAPE_T )
{
@ -814,23 +776,58 @@ void LIB_SYMBOL::Print( const SCH_RENDER_SETTINGS* aSettings, const VECTOR2I& aO
if( shape.GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR )
aForceNoFill = true;
shape.Print( aSettings, aOffset, aForceNoFill, aDimmed );
shape.Print( aSettings, aUnit, aBodyStyle, aOffset, aForceNoFill, aDimmed );
}
else
{
item.Print( aSettings, aOffset, aForceNoFill, aDimmed );
item.Print( aSettings, aUnit, aBodyStyle, aOffset, aForceNoFill, aDimmed );
}
}
}
void LIB_SYMBOL::Plot( PLOTTER *aPlotter, int aUnit, int aBodyStyle, bool aBackground,
const VECTOR2I &aOffset, const TRANSFORM &aTransform, bool aDimmed ) const
void LIB_SYMBOL::PrintBackground( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
const VECTOR2I& aOffset, bool aDimmed )
{
/* draw background for filled items using background option
* Solid lines will be drawn after the background
* Note also, background is not drawn when printing in black and white
*/
if( !GetGRForceBlackPenState() )
{
for( LIB_ITEM& item : m_drawings )
{
// Do not print private items
if( item.IsPrivate() )
continue;
if( item.Type() == LIB_SHAPE_T )
{
LIB_SHAPE& shape = static_cast<LIB_SHAPE&>( item );
// Do not draw items not attached to the current part
if( aUnit && shape.m_unit && ( shape.m_unit != aUnit ) )
continue;
if( aBodyStyle && shape.m_bodyStyle && ( shape.m_bodyStyle != aBodyStyle ) )
continue;
if( shape.GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR )
shape.Print( aSettings, aUnit, aBodyStyle, aOffset, false, aDimmed );
}
}
}
}
void LIB_SYMBOL::Plot( PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed )
{
wxASSERT( aPlotter != nullptr );
COLOR4D color = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE );
COLOR4D bg = aPlotter->RenderSettings()->GetBackgroundColor();
SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter );
COLOR4D color = renderSettings->GetLayerColor( LAYER_DEVICE );
COLOR4D bg = renderSettings->GetBackgroundColor();
if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
bg = COLOR4D::WHITE;
@ -843,7 +840,7 @@ void LIB_SYMBOL::Plot( PLOTTER *aPlotter, int aUnit, int aBodyStyle, bool aBackg
aPlotter->SetColor( color );
for( const LIB_ITEM& item : m_drawings )
for( LIB_ITEM& item : m_drawings )
{
// Do not plot private items
if( item.IsPrivate() )
@ -860,19 +857,20 @@ void LIB_SYMBOL::Plot( PLOTTER *aPlotter, int aUnit, int aBodyStyle, bool aBackg
if( aBodyStyle && item.m_bodyStyle && ( item.m_bodyStyle != aBodyStyle ) )
continue;
item.Plot( aPlotter, aBackground, aOffset, aTransform, aDimmed );
item.Plot( aPlotter, aBackground, aPlotOpts, aUnit, aBodyStyle, aOffset, aDimmed );
}
}
void LIB_SYMBOL::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aBodyStyle, bool aBackground,
const VECTOR2I& aOffset, const TRANSFORM& aTransform, bool aDimmed,
bool aPlotHidden )
void LIB_SYMBOL::PlotFields( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed,
bool aPlotHidden )
{
wxASSERT( aPlotter != nullptr );
COLOR4D color = aPlotter->RenderSettings()->GetLayerColor( LAYER_FIELDS );
COLOR4D bg = aPlotter->RenderSettings()->GetBackgroundColor();
SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter );
COLOR4D color = renderSettings->GetLayerColor( LAYER_FIELDS );
COLOR4D bg = renderSettings->GetBackgroundColor();
if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
bg = COLOR4D::WHITE;
@ -890,17 +888,11 @@ void LIB_SYMBOL::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aBodyStyle, bo
if( item.Type() != LIB_FIELD_T )
continue;
if( !aPlotHidden && !( (LIB_FIELD&) item ).IsVisible() )
continue;
LIB_FIELD& field = static_cast<LIB_FIELD&>( item );
if( aUnit && item.m_unit && ( item.m_unit != aUnit ) )
if( !aPlotHidden && !field.IsVisible() )
continue;
if( aBodyStyle && item.m_bodyStyle && ( item.m_bodyStyle != aBodyStyle ) )
continue;
LIB_FIELD& field = (LIB_FIELD&) item;
// The reference is a special case: we should change the basic text
// to add '?' and the part id
wxString tmp = field.GetShownText( true );
@ -911,7 +903,7 @@ void LIB_SYMBOL::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aBodyStyle, bo
field.SetText( text );
}
item.Plot( aPlotter, aBackground, aOffset, aTransform, aDimmed );
item.Plot( aPlotter, aBackground, aPlotOpts, aUnit, aBodyStyle, aOffset, aDimmed );
field.SetText( tmp );
}
}
@ -1133,20 +1125,17 @@ const BOX2I LIB_SYMBOL::GetUnitBoundingBox( int aUnit, int aBodyStyle,
for( const LIB_ITEM& item : m_drawings )
{
if( item.m_unit > 0
&& m_unitCount > 1
&& aUnit > 0
&& aUnit != item.m_unit )
{
if( item.m_unit > 0 && m_unitCount > 1 && aUnit > 0 && aUnit != item.m_unit )
continue;
}
if( item.m_bodyStyle > 0 && aBodyStyle > 0 && aBodyStyle != item.m_bodyStyle )
continue;
if( aIgnoreHiddenFields && ( item.Type() == LIB_FIELD_T )
&& !( (LIB_FIELD&) item ).IsVisible() )
{
continue;
}
bBox.Merge( item.GetBoundingBox() );
}

View File

@ -323,6 +323,20 @@ public:
wxString GetPrefix();
const wxString GetRef( const SCH_SHEET_PATH* aSheet, bool aIncludeUnit = false ) const override
{
return GetReferenceField().GetText();
}
const wxString GetValue( bool aResolve, const SCH_SHEET_PATH* aPath,
bool aAllowExtraText ) const override
{
return GetValueField().GetText();
}
int GetUnit() const override { return 0; }
int GetBodyStyle() const override { return 0; }
// JEY TODO: reconcile with RunOnChildren when LIB_ITEM collapses to SCH_ITEM
void RunOnLibChildren( const std::function<void( LIB_ITEM* )>& aFunction );
@ -337,59 +351,21 @@ public:
int GetNextAvailableFieldId() const;
/**
* Print symbol.
*
* @param aOffset - Position of symbol.
* @param aMulti - unit if multiple units per symbol.
* @param aBodyStyle - Symbol alternate body style (DeMorgan) if available.
* @param aDimmed - Reduce brightness of symbol
*/
void Print( const SCH_RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, int aMulti,
int aBodyStyle, bool aForceNoFill, bool aDimmed ) override;
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed ) override;
void PrintBackground( const SCH_RENDER_SETTINGS *aSettings, int aUnit, int aBodyStyle,
const VECTOR2I& aOffset, bool aDimmed ) override;
void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
/**
* Print just the background fills of a symbol
*
* @param aOffset - Position of symbol.
* @param aMulti - unit if multiple units per symbol.
* @param aBodyStyle - Symbol alternate body style (DeMorgan) if available.
* @param aDimmed - Reduce brightness of symbol
* Plot symbol fields.
*/
void PrintBackground( const SCH_RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset,
int aMulti, int aBodyStyle, bool aForceNoFill, bool aDimmed ) override;
/**
* Plot lib symbol to plotter.
* Lib Fields not are plotted here, because this plot function
* is used to plot schematic items, which have they own fields
*
* @param aPlotter - Plotter object to plot to.
* @param aUnit - Symbol symbol to plot.
* @param aBodyStyle - Symbol alternate body style to plot.
* @param aBackground - A poor-man's Z-order.
* @param aOffset - Distance to shift the plot coordinates.
* @param aTransform - Symbol plot transform matrix.
* @param aDimmed - Reduce brightness of symbol
*/
void Plot( PLOTTER* aPlotter, int aUnit, int aBodyStyle, bool aBackground,
const VECTOR2I& aOffset, const TRANSFORM& aTransform, bool aDimmed ) const override;
/**
* Plot Lib Fields only of the symbol to plotter.
* is used to plot the full lib symbol, outside the schematic
*
* @param aPlotter - Plotter object to plot to.
* @param aUnit - Symbol to plot.
* @param aBodyStyle - Symbol alternate body style to plot.
* @param aBackground - A poor-man's Z-order.
* @param aOffset - Distance to shift the plot coordinates.
* @param aTransform - Symbol plot transform matrix.
* @param aDimmed - reduce brightness of fields
*/
void PlotLibFields( PLOTTER* aPlotter, int aUnit, int aBodyStyle, bool aBackground,
const VECTOR2I& aOffset, const TRANSFORM& aTransform, bool aDimmed,
bool aPlotHidden = true );
void PlotFields( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed,
bool aPlotHidden );
/**
* Add a new draw \a aItem to the draw object list and sort according to \a aSort.

View File

@ -253,8 +253,8 @@ void LIB_TEXT::Rotate( const VECTOR2I& center, bool aRotateCCW )
}
void LIB_TEXT::Plot( PLOTTER* plotter, bool aBackground, const VECTOR2I& offset,
const TRANSFORM& aTransform, bool aDimmed ) const
void LIB_TEXT::Plot( PLOTTER* plotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
int aUnit, int aBodyStyle, const VECTOR2I& offset, bool aDimmed )
{
wxASSERT( plotter != nullptr );
@ -264,7 +264,7 @@ void LIB_TEXT::Plot( PLOTTER* plotter, bool aBackground, const VECTOR2I& offset,
if( aBackground )
return;
RENDER_SETTINGS* settings = plotter->RenderSettings();
SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( plotter );
BOX2I bBox = GetBoundingBox();
// convert coordinates from draw Y axis to symbol_editor Y axis
@ -288,16 +288,16 @@ void LIB_TEXT::Plot( PLOTTER* plotter, bool aBackground, const VECTOR2I& offset,
// The text orientation may need to be flipped if the transformation matrix causes xy
// axes to be flipped.
int t1 = ( aTransform.x1 != 0 ) ^ ( GetTextAngle() != ANGLE_HORIZONTAL );
VECTOR2I pos = aTransform.TransformCoordinate( txtpos ) + offset;
int t1 = ( renderSettings->m_Transform.x1 != 0 ) ^ ( GetTextAngle() != ANGLE_HORIZONTAL );
VECTOR2I pos = renderSettings->TransformCoordinate( txtpos ) + offset;
COLOR4D color = GetTextColor();
COLOR4D bg = settings->GetBackgroundColor();
COLOR4D bg = renderSettings->GetBackgroundColor();
if( !plotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
color = settings->GetLayerColor( LAYER_DEVICE );
color = renderSettings->GetLayerColor( LAYER_DEVICE );
if( !IsVisible() )
bg = settings->GetLayerColor( LAYER_HIDDEN );
bg = renderSettings->GetLayerColor( LAYER_HIDDEN );
else if( bg == COLOR4D::UNSPECIFIED || !plotter->GetColorMode() )
bg = COLOR4D::WHITE;
@ -307,12 +307,12 @@ void LIB_TEXT::Plot( PLOTTER* plotter, bool aBackground, const VECTOR2I& offset,
color = color.Mix( bg, 0.5f );
}
int penWidth = std::max( GetEffectiveTextPenWidth(), settings->GetMinPenWidth() );
int penWidth = std::max( GetEffectiveTextPenWidth(), renderSettings->GetMinPenWidth() );
KIFONT::FONT* font = GetFont();
if( !font )
font = KIFONT::FONT::GetFont( settings->GetDefaultFont(), IsBold(), IsItalic() );
font = KIFONT::FONT::GetFont( renderSettings->GetDefaultFont(), IsBold(), IsItalic() );
attrs.m_StrokeWidth = penWidth;
attrs.m_Angle = t1 ? ANGLE_HORIZONTAL : ANGLE_VERTICAL;
@ -338,8 +338,8 @@ KIFONT::FONT* LIB_TEXT::getDrawFont() const
}
void LIB_TEXT::print( const SCH_RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
bool aForceNoFill, bool aDimmed )
void LIB_TEXT::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
{
wxDC* DC = aSettings->GetPrintDC();
COLOR4D color = GetTextColor();

View File

@ -103,8 +103,11 @@ public:
void NormalizeJustification( bool inverse );
void Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
const TRANSFORM& aTransform, bool aDimmed ) const override;
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed ) override;
void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
@ -129,9 +132,6 @@ private:
* - Text height.
*/
int compare( const LIB_ITEM& aOther, int aCompareFlags = 0 ) const override;
void print( const SCH_RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, bool aForceNoFill,
bool aDimmed ) override;
};

View File

@ -249,8 +249,8 @@ KIFONT::FONT* LIB_TEXTBOX::getDrawFont() const
}
void LIB_TEXTBOX::print( const SCH_RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
bool aForceNoFill, bool aDimmed )
void LIB_TEXTBOX::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
{
if( IsPrivate() )
return;
@ -413,8 +413,8 @@ BITMAPS LIB_TEXTBOX::GetMenuImage() const
}
void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
const TRANSFORM& aTransform, bool aDimmed ) const
void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed )
{
wxASSERT( aPlotter != nullptr );
@ -423,14 +423,14 @@ void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOf
if( aBackground )
{
LIB_SHAPE::Plot( aPlotter, aBackground, aOffset, aTransform, aDimmed );
LIB_SHAPE::Plot( aPlotter, aBackground, aPlotOpts, aUnit, aBodyStyle, aOffset, aDimmed );
return;
}
RENDER_SETTINGS* renderSettings = aPlotter->RenderSettings();
VECTOR2I start = aTransform.TransformCoordinate( m_start ) + aOffset;
VECTOR2I end = aTransform.TransformCoordinate( m_end ) + aOffset;
COLOR4D bg = renderSettings->GetBackgroundColor();
SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter );
VECTOR2I start = renderSettings->TransformCoordinate( m_start ) + aOffset;
VECTOR2I end = renderSettings->TransformCoordinate( m_end ) + aOffset;
COLOR4D bg = renderSettings->GetBackgroundColor();
if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
bg = COLOR4D::WHITE;
@ -479,7 +479,7 @@ void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOf
penWidth = std::max( GetEffectiveTextPenWidth(), aPlotter->RenderSettings()->GetMinPenWidth() );
if( aTransform.y1 )
if( renderSettings->m_Transform.y1 )
{
text.SetTextAngle( text.GetTextAngle() == ANGLE_HORIZONTAL ? ANGLE_VERTICAL
: ANGLE_HORIZONTAL );

View File

@ -94,8 +94,11 @@ public:
BITMAPS GetMenuImage() const override;
void Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& offset,
const TRANSFORM& aTransform, bool aDimmed ) const override;
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed ) override;
void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
EDA_ITEM* Clone() const override
{
@ -116,9 +119,6 @@ protected:
private:
int compare( const LIB_ITEM& aOther, int aCompareFlags = 0 ) const override;
void print( const SCH_RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, bool aForceNoFill,
bool aDimmed ) override;
private:
int m_marginLeft;
int m_marginTop;

View File

@ -79,7 +79,7 @@ static wxString GetNetNavigatorItemText( const SCH_ITEM* aItem,
const SCH_PIN* pin = static_cast<const SCH_PIN*>( aItem );
wxCHECK( pin, retv );
SCH_SYMBOL* symbol = pin->GetParentSymbol();
const SYMBOL* symbol = pin->GetParentSymbol();
wxCHECK( symbol, retv );
retv.Printf( _( "Symbol '%s' pin '%s'" ), symbol->GetRef( &aSheetPath, true ),

View File

@ -236,13 +236,11 @@ void NETLIST_EXPORTER_ALLEGRO::extractComponentsInfo()
{
if( item->Type() == SCH_PIN_T )
{
SCH_PIN* pin = static_cast<SCH_PIN*>( item );
SCH_SYMBOL* symbol = pin->GetParentSymbol();
SCH_PIN* pin = static_cast<SCH_PIN*>( item );
SYMBOL* symbol = pin->GetParentSymbol();
if( !symbol || symbol->GetExcludedFromBoard() )
{
continue;
}
net_record->m_Nodes.emplace_back( pin, sheet, nc );
}
@ -320,8 +318,8 @@ void NETLIST_EXPORTER_ALLEGRO::toAllegroPackages()
for( auto it = m_orderedSymbolsSheetpath.begin(); it != m_orderedSymbolsSheetpath.end();
++it )
{
if( it->first->GetValueFieldText( false, &it->second, false )
!= first_ele.first->GetValueFieldText( false, &first_ele.second, false ) )
if( it->first->GetValue( false, &it->second, false )
!= first_ele.first->GetValue( false, &first_ele.second, false ) )
{
continue;
}
@ -369,7 +367,7 @@ void NETLIST_EXPORTER_ALLEGRO::toAllegroPackages()
SCH_SYMBOL* sym = ( beginIter->second ).first;
SCH_SHEET_PATH sheetPath = ( beginIter->second ).second;
wxString valueText = sym->GetValueFieldText( false, &sheetPath, false );
wxString valueText = sym->GetValue( false, &sheetPath, false );
wxString footprintText = sym->GetFootprintFieldText( false, &sheetPath, false);
wxString deviceType = valueText + wxString("_") + footprintText;

View File

@ -88,7 +88,7 @@ bool NETLIST_EXPORTER_CADSTAR::WriteNetlist( const wxString& aOutFileName,
ret |= fprintf( f, "%s ", TO_UTF8( StartCmpDesc ) );
ret |= fprintf( f, "%s", TO_UTF8( msg ) );
msg = symbol->GetValueFieldText( true, &sheetList[ i ], false );
msg = symbol->GetValue( true, &sheetList[ i ], false );
msg.Replace( wxT( " " ), wxT( "_" ) );
ret |= fprintf( f, " \"%s\"", TO_UTF8( msg ) );
ret |= fprintf( f, " \"%s\"", TO_UTF8( footprint ) );

View File

@ -102,7 +102,7 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName,
ret |= fprintf( f, " %s", TO_UTF8( field ) );
field = symbol->GetValueFieldText( true, &sheet, false );
field = symbol->GetValue( true, &sheet, false );
field.Replace( wxT( " " ), wxT( "_" ) );
ret |= fprintf( f, " %s", TO_UTF8( field ) );

View File

@ -78,7 +78,7 @@ bool NETLIST_EXPORTER_PADS::WriteNetlist( const wxString& aOutFileName,
if( footprint.IsEmpty() )
{
// fall back to value field
footprint = symbol->GetValueFieldText( true, &sheetList[i], false );
footprint = symbol->GetValue( true, &sheetList[i], false );
footprint.Replace( wxT( " " ), wxT( "_" ) );
footprint = footprint.Trim( true );
footprint = footprint.Trim( false );

Some files were not shown because too many files have changed in this diff Show More