Allow printing backgrounds prior to foreground
Eeschema shows background fills on a different z-level than the rest of
the symbols/elements. Print the backgrounds prior to the foregrounds in
order to preserve this view for print output
Fixes https://gitlab.com/kicad/code/kicad/issues/12559
(cherry picked from commit e055302a3c
)
This commit is contained in:
parent
03a1a8e6d3
commit
431aa88612
|
@ -526,7 +526,7 @@ wxString LIB_SYMBOL::SubReference( int aUnit, bool aAddSeparator )
|
|||
}
|
||||
|
||||
|
||||
void LIB_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
||||
void LIB_SYMBOL::PrintBackground( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
||||
int aUnit, int aConvert, const LIB_SYMBOL_OPTIONS& aOpts )
|
||||
{
|
||||
/* draw background for filled items using background option
|
||||
|
@ -553,6 +553,12 @@ void LIB_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LIB_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, int aUnit,
|
||||
int aConvert, const LIB_SYMBOL_OPTIONS& aOpts )
|
||||
{
|
||||
|
||||
for( LIB_ITEM& item : m_drawings )
|
||||
{
|
||||
|
|
|
@ -314,6 +314,17 @@ public:
|
|||
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
||||
int aMulti, int aConvert, const LIB_SYMBOL_OPTIONS& aOpts );
|
||||
|
||||
/**
|
||||
* Print just the background fills of a symbol
|
||||
*
|
||||
* @param aOffset - Position of symbol.
|
||||
* @param aMulti - unit if multiple units per symbol.
|
||||
* @param aConvert - Symbol conversion (DeMorgan) if available.
|
||||
* @param aOpts - Drawing options
|
||||
*/
|
||||
void PrintBackground( const RENDER_SETTINGS *aSettings, const wxPoint &aOffset, int aMulti,
|
||||
int aConvert, const LIB_SYMBOL_OPTIONS &aOpts );
|
||||
|
||||
/**
|
||||
* Plot lib symbol to plotter.
|
||||
* Lib Fields not are plotted here, because this plot function
|
||||
|
|
|
@ -285,6 +285,15 @@ public:
|
|||
*/
|
||||
virtual void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) = 0;
|
||||
|
||||
/**
|
||||
* Print the (optional) backaground elements if they exist
|
||||
* @param aSettings Print settings
|
||||
* @param aOffset is the drawing offset (usually {0,0} but can be different when moving an
|
||||
* object).
|
||||
*/
|
||||
|
||||
virtual void PrintBackground( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) {};
|
||||
|
||||
/**
|
||||
* Move the item by \a aMoveVector to a new position.
|
||||
*/
|
||||
|
|
|
@ -45,7 +45,9 @@
|
|||
|
||||
#include <symbol_library.h>
|
||||
#include <connection_graph.h>
|
||||
#include <lib_item.h>
|
||||
#include <lib_pin.h>
|
||||
#include <lib_shape.h>
|
||||
#include <sch_symbol.h>
|
||||
#include <sch_junction.h>
|
||||
#include <sch_line.h>
|
||||
|
@ -815,18 +817,21 @@ void SCH_SCREEN::Print( const RENDER_SETTINGS* aSettings )
|
|||
}
|
||||
|
||||
/// Sort to ensure plot-order consistency with screen drawing
|
||||
std::sort( other.begin(), other.end(),
|
||||
std::stable_sort( other.begin(), other.end(),
|
||||
[]( const SCH_ITEM* a, const SCH_ITEM* b )
|
||||
{
|
||||
if( a->Type() == b->Type() )
|
||||
return a->GetLayer() > b->GetLayer();
|
||||
|
||||
return a->Type() > b->Type();
|
||||
return a->Type() < b->Type();
|
||||
} );
|
||||
|
||||
for( SCH_ITEM* item : bitmaps )
|
||||
item->Print( aSettings, wxPoint( 0, 0 ) );
|
||||
|
||||
for( SCH_ITEM* item : other )
|
||||
item->PrintBackground( aSettings, wxPoint( 0, 0 ) );
|
||||
|
||||
for( SCH_ITEM* item : other )
|
||||
item->Print( aSettings, wxPoint( 0, 0 ) );
|
||||
|
||||
|
|
|
@ -409,6 +409,19 @@ int SCH_SYMBOL::GetUnitCount() const
|
|||
}
|
||||
|
||||
|
||||
|
||||
void SCH_SYMBOL::PrintBackground( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
|
||||
{
|
||||
LIB_SYMBOL_OPTIONS opts;
|
||||
opts.transform = m_transform;
|
||||
opts.draw_visible_fields = false;
|
||||
opts.draw_hidden_fields = false;
|
||||
|
||||
if( m_part )
|
||||
m_part->PrintBackground( aSettings, m_pos + aOffset, m_unit, m_convert, opts );
|
||||
}
|
||||
|
||||
|
||||
void SCH_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
|
||||
{
|
||||
LIB_SYMBOL_OPTIONS opts;
|
||||
|
|
|
@ -488,12 +488,21 @@ public:
|
|||
/**
|
||||
* Print a symbol.
|
||||
*
|
||||
* @param aDC is the device context (can be null).
|
||||
* @param aOffset is the drawing offset (usually wxPoint(0,0), but can be different when
|
||||
* @param aSettings Render settings controlling output
|
||||
* @param aOffset is the drawing offset (usually VECTOR2I(0,0), but can be different when
|
||||
* moving an object)
|
||||
*/
|
||||
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
|
||||
|
||||
/**
|
||||
* Print only the background parts of a symbol (if any)
|
||||
*
|
||||
* @param aSettings Render settings controlling output
|
||||
* @param aOffset is the drawing offset (usually VECTOR2I(0,0), but can be different when
|
||||
* moving an object)
|
||||
*/
|
||||
void PrintBackground( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
|
||||
|
||||
void SwapData( SCH_ITEM* aItem ) override;
|
||||
|
||||
/**
|
||||
|
|
|
@ -93,5 +93,7 @@ void SYMBOL_EDIT_FRAME::PrintPage( const RENDER_SETTINGS* aSettings )
|
|||
plot_offset.x = pagesize.x / 2;
|
||||
plot_offset.y = pagesize.y / 2;
|
||||
|
||||
m_symbol->PrintBackground( aSettings, plot_offset, m_unit, m_convert, LIB_SYMBOL_OPTIONS() );
|
||||
|
||||
m_symbol->Print( aSettings, plot_offset, m_unit, m_convert, LIB_SYMBOL_OPTIONS() );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue