Eeschema: Normalize layer ordering between plot and screen
Fixes: lp:1833428 * https://bugs.launchpad.net/kicad/+bug/1833428
This commit is contained in:
parent
b124599de3
commit
8f7278e34f
|
@ -41,8 +41,7 @@ SCH_BITMAP::SCH_BITMAP( const wxPoint& pos ) :
|
||||||
SCH_ITEM( NULL, SCH_BITMAP_T )
|
SCH_ITEM( NULL, SCH_BITMAP_T )
|
||||||
{
|
{
|
||||||
m_pos = pos;
|
m_pos = pos;
|
||||||
m_Layer = LAYER_NOTES; // used only to draw/plot a rectangle,
|
m_Layer = LAYER_SCHEMATIC_BITMAPS;
|
||||||
// when a bitmap cannot be drawn or plotted
|
|
||||||
m_image = new BITMAP_BASE();
|
m_image = new BITMAP_BASE();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -509,9 +509,11 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode
|
||||||
* library editor and library viewer do not use m_drawList, and therefore
|
* library editor and library viewer do not use m_drawList, and therefore
|
||||||
* their SCH_SCREEN::Draw() draws nothing
|
* their SCH_SCREEN::Draw() draws nothing
|
||||||
*/
|
*/
|
||||||
std::vector< SCH_ITEM* > junctions;
|
std::vector< SCH_ITEM* > items;
|
||||||
std::vector< SCH_ITEM* > bitmaps;
|
|
||||||
std::vector< SCH_ITEM* > other;
|
|
||||||
|
// Ensure links are up to date, even if a library was reloaded for some reason:
|
||||||
|
UpdateSymbolLinks();
|
||||||
|
|
||||||
// Ensure links are up to date, even if a library was reloaded for some reason:
|
// Ensure links are up to date, even if a library was reloaded for some reason:
|
||||||
UpdateSymbolLinks();
|
UpdateSymbolLinks();
|
||||||
|
@ -521,36 +523,25 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode
|
||||||
if( item->IsMoving() || item->IsResized() )
|
if( item->IsMoving() || item->IsResized() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( item->Type() == SCH_JUNCTION_T )
|
items.push_back( item );
|
||||||
junctions.push_back( item );
|
|
||||||
else if( item->Type() == SCH_BITMAP_T )
|
|
||||||
bitmaps.push_back( item );
|
|
||||||
else
|
|
||||||
// uncomment line below when there is a virtual EDA_ITEM::GetBoundingBox()
|
|
||||||
// if( panel->GetClipBox().Intersects( item->GetBoundingBox() ) )
|
|
||||||
other.push_back( item );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bitmaps are drawn first to ensure they are in the background
|
std::sort( items.begin(), items.end(), [] ( const SCH_ITEM* a, const SCH_ITEM* b )
|
||||||
// This is particularly important for the wxPostscriptDC (used in *nix printers) as
|
{
|
||||||
// the bitmap PS command clears the screen
|
if( a->Type() == b->Type() )
|
||||||
for( auto item : bitmaps )
|
return a->GetLayer() > b->GetLayer();
|
||||||
item->Draw( aCanvas, aDC, wxPoint( 0, 0 ), aDrawMode, aColor );
|
|
||||||
|
|
||||||
for( auto item : other )
|
return a->Type() > b->Type();
|
||||||
item->Draw( aCanvas, aDC, wxPoint( 0, 0 ), aDrawMode, aColor );
|
} );
|
||||||
|
|
||||||
for( auto item : junctions )
|
for( auto item : items )
|
||||||
item->Draw( aCanvas, aDC, wxPoint( 0, 0 ), aDrawMode, aColor );
|
item->Draw( aCanvas, aDC, wxPoint( 0, 0 ), aDrawMode, aColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SCREEN::Plot( PLOTTER* aPlotter )
|
void SCH_SCREEN::Plot( PLOTTER* aPlotter )
|
||||||
{
|
{
|
||||||
// Ensure links are up to date, even if a library was reloaded for some reason:
|
std::vector< SCH_ITEM* > items;
|
||||||
std::vector< SCH_ITEM* > junctions;
|
|
||||||
std::vector< SCH_ITEM* > bitmaps;
|
|
||||||
std::vector< SCH_ITEM* > other;
|
|
||||||
|
|
||||||
// Ensure links are up to date, even if a library was reloaded for some reason:
|
// Ensure links are up to date, even if a library was reloaded for some reason:
|
||||||
UpdateSymbolLinks();
|
UpdateSymbolLinks();
|
||||||
|
@ -560,32 +551,18 @@ void SCH_SCREEN::Plot( PLOTTER* aPlotter )
|
||||||
if( item->IsMoving() || item->IsResized() )
|
if( item->IsMoving() || item->IsResized() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( item->Type() == SCH_JUNCTION_T )
|
items.push_back( item );
|
||||||
junctions.push_back( item );
|
|
||||||
else if( item->Type() == SCH_BITMAP_T )
|
|
||||||
bitmaps.push_back( item );
|
|
||||||
else
|
|
||||||
// uncomment line below when there is a virtual EDA_ITEM::GetBoundingBox()
|
|
||||||
// if( panel->GetClipBox().Intersects( item->GetBoundingBox() ) )
|
|
||||||
other.push_back( item );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bitmaps are drawn first to ensure they are in the background
|
std::sort( items.begin(), items.end(), [] ( const SCH_ITEM* a, const SCH_ITEM* b )
|
||||||
// This is particularly important for the wxPostscriptDC (used in *nix printers) as
|
|
||||||
// the bitmap PS command clears the screen
|
|
||||||
for( auto item : bitmaps )
|
|
||||||
{
|
{
|
||||||
aPlotter->SetCurrentLineWidth( item->GetPenSize() );
|
if( a->Type() == b->Type() )
|
||||||
item->Plot( aPlotter );
|
return a->GetLayer() > b->GetLayer();
|
||||||
}
|
|
||||||
|
|
||||||
for( auto item : other )
|
return a->Type() > b->Type();
|
||||||
{
|
} );
|
||||||
aPlotter->SetCurrentLineWidth( item->GetPenSize() );
|
|
||||||
item->Plot( aPlotter );
|
|
||||||
}
|
|
||||||
|
|
||||||
for( auto item : junctions )
|
for( auto item : items )
|
||||||
{
|
{
|
||||||
aPlotter->SetCurrentLineWidth( item->GetPenSize() );
|
aPlotter->SetCurrentLineWidth( item->GetPenSize() );
|
||||||
item->Plot( aPlotter );
|
item->Plot( aPlotter );
|
||||||
|
|
|
@ -46,14 +46,17 @@ static const LAYER_NUM SCH_LAYER_ORDER[] =
|
||||||
LAYER_GP_OVERLAY, LAYER_SELECT_OVERLAY,
|
LAYER_GP_OVERLAY, LAYER_SELECT_OVERLAY,
|
||||||
LAYER_ERC_ERR, LAYER_ERC_WARN,
|
LAYER_ERC_ERR, LAYER_ERC_WARN,
|
||||||
LAYER_REFERENCEPART, LAYER_VALUEPART, LAYER_FIELDS,
|
LAYER_REFERENCEPART, LAYER_VALUEPART, LAYER_FIELDS,
|
||||||
LAYER_JUNCTION, LAYER_NOCONNECT,
|
LAYER_NOCONNECT,
|
||||||
|
LAYER_JUNCTION,
|
||||||
LAYER_HIERLABEL,
|
LAYER_HIERLABEL,
|
||||||
LAYER_WIRE, LAYER_BUS,
|
LAYER_WIRE,
|
||||||
|
LAYER_BUS,
|
||||||
|
LAYER_NOTES,
|
||||||
LAYER_DEVICE,
|
LAYER_DEVICE,
|
||||||
LAYER_DEVICE_BACKGROUND,
|
LAYER_DEVICE_BACKGROUND,
|
||||||
LAYER_NOTES,
|
|
||||||
LAYER_SHEET,
|
LAYER_SHEET,
|
||||||
LAYER_SHEET_BACKGROUND,
|
LAYER_SHEET_BACKGROUND,
|
||||||
|
LAYER_SCHEMATIC_BITMAPS,
|
||||||
LAYER_WORKSHEET
|
LAYER_WORKSHEET
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -104,23 +104,22 @@ enum KICAD_T
|
||||||
PCB_NETINFO_T, ///< class NETINFO_ITEM, a description of a net
|
PCB_NETINFO_T, ///< class NETINFO_ITEM, a description of a net
|
||||||
|
|
||||||
// Schematic draw Items. The order of these items effects the sort order.
|
// Schematic draw Items. The order of these items effects the sort order.
|
||||||
// It is currently ordered to mimic the old Eeschema locate behavior where
|
// The SCH_MARKER_T is drawn last (on top of others)
|
||||||
// the smallest item is the selected item.
|
|
||||||
SCH_MARKER_T,
|
SCH_MARKER_T,
|
||||||
SCH_JUNCTION_T,
|
|
||||||
SCH_NO_CONNECT_T,
|
SCH_NO_CONNECT_T,
|
||||||
SCH_BUS_WIRE_ENTRY_T,
|
SCH_JUNCTION_T,
|
||||||
SCH_BUS_BUS_ENTRY_T,
|
|
||||||
SCH_LINE_T,
|
|
||||||
SCH_BITMAP_T,
|
|
||||||
SCH_TEXT_T,
|
SCH_TEXT_T,
|
||||||
SCH_LABEL_T,
|
SCH_LABEL_T,
|
||||||
SCH_GLOBAL_LABEL_T,
|
SCH_GLOBAL_LABEL_T,
|
||||||
SCH_HIERARCHICAL_LABEL_T,
|
SCH_HIERARCHICAL_LABEL_T,
|
||||||
|
SCH_BUS_WIRE_ENTRY_T,
|
||||||
|
SCH_BUS_BUS_ENTRY_T,
|
||||||
|
SCH_LINE_T,
|
||||||
SCH_FIELD_T,
|
SCH_FIELD_T,
|
||||||
SCH_COMPONENT_T,
|
SCH_COMPONENT_T,
|
||||||
SCH_SHEET_PIN_T,
|
SCH_SHEET_PIN_T,
|
||||||
SCH_SHEET_T,
|
SCH_SHEET_T,
|
||||||
|
SCH_BITMAP_T,
|
||||||
|
|
||||||
// Be prudent with these 3 types:
|
// Be prudent with these 3 types:
|
||||||
// they should be used only to locate a specific field type
|
// they should be used only to locate a specific field type
|
||||||
|
|
|
@ -257,6 +257,7 @@ enum SCH_LAYER_ID: int
|
||||||
LAYER_ERC_ERR,
|
LAYER_ERC_ERR,
|
||||||
LAYER_DEVICE_BACKGROUND,
|
LAYER_DEVICE_BACKGROUND,
|
||||||
LAYER_SHEET_BACKGROUND,
|
LAYER_SHEET_BACKGROUND,
|
||||||
|
LAYER_SCHEMATIC_BITMAPS,
|
||||||
LAYER_SCHEMATIC_GRID,
|
LAYER_SCHEMATIC_GRID,
|
||||||
LAYER_SCHEMATIC_BACKGROUND,
|
LAYER_SCHEMATIC_BACKGROUND,
|
||||||
LAYER_SCHEMATIC_CURSOR,
|
LAYER_SCHEMATIC_CURSOR,
|
||||||
|
|
Loading…
Reference in New Issue