Remove dead legacy print code.

This commit is contained in:
Jeff Young 2020-04-20 17:02:03 +01:00
parent dce42612d3
commit 7f1b409305
32 changed files with 0 additions and 1172 deletions

View File

@ -455,12 +455,3 @@ void DISPLAY_FOOTPRINTS_FRAME::SyncToolbars()
}
/*
* Redraw the BOARD items but not cursors, axis or grid.
*/
void BOARD::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset )
{
if( !m_modules.empty() )
GetFirstModule()->Print( aFrame, aDC );
}

View File

@ -152,12 +152,6 @@ public:
m_Layer = aLayer;
}
/**
* Function Print
* BOARD_ITEMs have their own color information.
*/
virtual void Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset = ZeroOffset ) = 0;
/**
* Function Duplicate
* creates a copy of a BOARD_ITEM.

View File

@ -62,11 +62,6 @@ public:
void ViewDraw( int aLayer, VIEW* aView ) const override;
void Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset = ZeroOffset ) override
{
wxASSERT( 0 ); // ORIGIN_VIEWITEM never added to BOARD
}
void ViewGetLayers( int aLayers[], int& aCount ) const override
{
aLayers[0] = LAYER_GP_OVERLAY;

View File

@ -287,7 +287,6 @@ set( PCBNEW_CLASS_SRCS
pcbnew_config.cpp
pcbnew_printout.cpp
pcbnew_settings.cpp
pcb_legacy_draw_utils.cpp
pcbplot.cpp
plot_board_layers.cpp
plot_brditems_plotter.cpp

View File

@ -78,7 +78,6 @@ public:
// pure virtuals:
const wxPoint GetPosition() const override { return wxPoint(); }
void SetPosition( const wxPoint& ) override {}
void Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& aOffset ) override {}
#if defined(DEBUG)
void Show( int , std::ostream& ) const override {}

View File

@ -747,16 +747,6 @@ public:
void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
/**
* Function Print.
* Print the BOARD items.
* @param aFrame = the current Frame
* @param aDC = the current device context
* @param aDrawMode = GR_COPY, GR_OR ... (not always used)
* @param aOffset = an draw offset value (default = 0,0)
*/
void Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset = ZeroOffset ) override;
/**
* Function Visit
* may be re-implemented for each derived class in order to handle

View File

@ -356,43 +356,6 @@ void DIMENSION::AdjustDimensionDetails( int aPrecision )
}
void DIMENSION::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset )
{
BOARD* brd = GetBoard();
if( brd->IsLayerVisible( m_Layer ) == false )
return;
m_Text.Print( aFrame, DC, offset );
COLOR4D gcolor = Pgm().GetSettingsManager().GetColorSettings()->GetColor( m_Layer );
auto displ_opts = aFrame->GetDisplayOptions();
bool filled = displ_opts.m_DisplayDrawItemsFill;
int width = m_Width;
if( filled )
{
GRLine( nullptr, DC, m_crossBarO + offset, m_crossBarF + offset, width, gcolor );
GRLine( nullptr, DC, m_featureLineGO + offset, m_featureLineGF + offset, width, gcolor );
GRLine( nullptr, DC, m_featureLineDO + offset, m_featureLineDF + offset, width, gcolor );
GRLine( nullptr, DC, m_crossBarF + offset, m_arrowD1F + offset, width, gcolor );
GRLine( nullptr, DC, m_crossBarF + offset, m_arrowD2F + offset, width, gcolor );
GRLine( nullptr, DC, m_crossBarO + offset, m_arrowG1F + offset, width, gcolor );
GRLine( nullptr, DC, m_crossBarO + offset, m_arrowG2F + offset, width, gcolor );
}
else
{
GRCSegm( nullptr, DC, m_crossBarO + offset, m_crossBarF + offset, width, gcolor );
GRCSegm( nullptr, DC, m_featureLineGO + offset, m_featureLineGF + offset, width, gcolor );
GRCSegm( nullptr, DC, m_featureLineDO + offset, m_featureLineDF + offset, width, gcolor );
GRCSegm( nullptr, DC, m_crossBarF + offset, m_arrowD1F + offset, width, gcolor );
GRCSegm( nullptr, DC, m_crossBarF + offset, m_arrowD2F + offset, width, gcolor );
GRCSegm( nullptr, DC, m_crossBarO + offset, m_arrowG1F + offset, width, gcolor );
GRCSegm( nullptr, DC, m_crossBarO + offset, m_arrowG2F + offset, width, gcolor );
}
}
// see class_cotation.h
void DIMENSION::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList )
{

View File

@ -203,8 +203,6 @@ public:
TEXTE_PCB& Text() { return m_Text; }
TEXTE_PCB& Text() const { return *(const_cast<TEXTE_PCB*> (&m_Text)); }
void Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset = ZeroOffset ) override;
/**
* Function Move
* @param offset : moving vector

View File

@ -342,119 +342,6 @@ MODULE* DRAWSEGMENT::GetParentModule() const
}
void DRAWSEGMENT::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& aOffset )
{
int ux0, uy0, dx, dy;
int l_trace;
int radius;
BOARD* brd = GetBoard( );
if( brd->IsLayerVisible( GetLayer() ) == false )
return;
COLOR4D color = Pgm().GetSettingsManager().GetColorSettings()->GetColor( GetLayer() );
auto displ_opts = aFrame->GetDisplayOptions();
l_trace = m_Width >> 1; // half trace width
// Line start point or Circle and Arc center
ux0 = m_Start.x + aOffset.x;
uy0 = m_Start.y + aOffset.y;
// Line end point or circle and arc start point
dx = m_End.x + aOffset.x;
dy = m_End.y + aOffset.y;
bool filled = displ_opts.m_DisplayDrawItemsFill;
if( m_Flags & FORCE_SKETCH )
filled = SKETCH;
switch( m_Shape )
{
case S_CIRCLE:
radius = KiROUND( Distance( ux0, uy0, dx, dy ) );
if( filled )
{
GRCircle( nullptr, DC, ux0, uy0, radius, m_Width, color );
}
else
{
GRCircle( nullptr, DC, ux0, uy0, radius - l_trace, color );
GRCircle( nullptr, DC, ux0, uy0, radius + l_trace, color );
}
break;
case S_ARC:
double StAngle, EndAngle;
radius = KiROUND( Distance( ux0, uy0, dx, dy ) );
StAngle = ArcTangente( dy - uy0, dx - ux0 );
EndAngle = StAngle + m_Angle;
if( StAngle > EndAngle )
std::swap( StAngle, EndAngle );
if( filled )
{
GRArc( nullptr, DC, ux0, uy0, StAngle, EndAngle, radius, m_Width, color );
}
else
{
GRArc( nullptr, DC, ux0, uy0, StAngle, EndAngle, radius - l_trace, color );
GRArc( nullptr, DC, ux0, uy0, StAngle, EndAngle, radius + l_trace, color );
}
break;
case S_CURVE:
{
RebuildBezierToSegmentsPointsList( m_Width );
wxPoint& startp = m_BezierPoints[0];
for( unsigned int i = 1; i < m_BezierPoints.size(); i++ )
{
wxPoint& endp = m_BezierPoints[i];
if( filled )
GRFilledSegment( nullptr, DC, startp+aOffset, endp+aOffset, m_Width, color );
else
GRCSegm( nullptr, DC, startp+aOffset, endp+aOffset, m_Width, color );
startp = m_BezierPoints[i];
}
}
break;
case S_POLYGON:
{
SHAPE_POLY_SET& outline = GetPolyShape();
// Draw the polygon: only one polygon is expected
// However we provide a multi polygon shape drawing
// ( for the future or to show a non expected shape )
for( int jj = 0; jj < outline.OutlineCount(); ++jj )
{
SHAPE_LINE_CHAIN& poly = outline.Outline( jj );
GRClosedPoly( nullptr, DC, poly.PointCount(), (const wxPoint*) &poly.CPoint( 0 ),
IsPolygonFilled(), GetWidth(), color, color );
}
}
break;
default:
if( filled )
GRFillCSegm( nullptr, DC, ux0, uy0, dx, dy, m_Width, color );
else
GRCSegm( nullptr, DC, ux0, uy0, dx, dy, m_Width, color );
break;
}
}
void DRAWSEGMENT::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList )
{
wxString msg;

View File

@ -215,8 +215,6 @@ public:
void SetPolyPoints( const std::vector<wxPoint>& aPoints );
void Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& aOffset = ZeroOffset ) override;
void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
const EDA_RECT GetBoundingBox() const override;

View File

@ -121,126 +121,6 @@ void EDGE_MODULE::SetDrawCoord()
}
void EDGE_MODULE::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset )
{
int ux0, uy0, dx, dy, radius, StAngle, EndAngle;
MODULE* module = (MODULE*) m_Parent;
BOARD* brd = GetBoard( );
if( !module || !brd->IsLayerVisible( m_Layer ) )
return;
COLOR4D color = Pgm().GetSettingsManager().GetColorSettings()->GetColor( m_Layer );
auto displ_opts = aFrame->GetDisplayOptions();
ux0 = m_Start.x - offset.x;
uy0 = m_Start.y - offset.y;
dx = m_End.x - offset.x;
dy = m_End.y - offset.y;
bool filled = displ_opts.m_DisplayModEdgeFill;
if( IsCopperLayer( m_Layer ) )
filled = displ_opts.m_DisplayPcbTrackFill;
switch( m_Shape )
{
case S_SEGMENT:
if( filled )
GRLine( nullptr, DC, ux0, uy0, dx, dy, m_Width, color );
else
// SKETCH Mode
GRCSegm( nullptr, DC, ux0, uy0, dx, dy, m_Width, color );
break;
case S_CIRCLE:
radius = KiROUND( Distance( ux0, uy0, dx, dy ) );
if( filled )
{
GRCircle( nullptr, DC, ux0, uy0, radius, m_Width, color );
}
else // SKETCH Mode
{
GRCircle( nullptr, DC, ux0, uy0, radius + (m_Width / 2), color );
GRCircle( nullptr, DC, ux0, uy0, radius - (m_Width / 2), color );
}
break;
case S_ARC:
radius = KiROUND( Distance( ux0, uy0, dx, dy ) );
StAngle = ArcTangente( dy - uy0, dx - ux0 );
EndAngle = StAngle + m_Angle;
if( StAngle > EndAngle )
std::swap( StAngle, EndAngle );
if( filled )
{
GRArc( nullptr, DC, ux0, uy0, StAngle, EndAngle, radius, m_Width, color );
}
else // SKETCH Mode
{
GRArc( nullptr, DC, ux0, uy0, StAngle, EndAngle, radius + (m_Width / 2), color );
GRArc( nullptr, DC, ux0, uy0, StAngle, EndAngle, radius - (m_Width / 2), color );
}
break;
case S_POLYGON:
if( m_Poly.IsEmpty() )
break;
{
// We must compute absolute coordinates from m_PolyPoints
// which are relative to module position, orientation 0
std::vector<wxPoint> points;
for( auto iter = m_Poly.CIterate(); iter; iter++ )
{
points.emplace_back( iter->x,iter->y );
}
for( unsigned ii = 0; ii < points.size(); ii++ )
{
wxPoint& pt = points[ii];
RotatePoint( &pt.x, &pt.y, module->GetOrientation() );
pt += module->GetPosition() - offset;
}
GRPoly( nullptr, DC, points.size(), &points[0], true, m_Width, color, color );
}
break;
case S_CURVE:
{
RebuildBezierToSegmentsPointsList( m_Width );
wxPoint& startp = m_BezierPoints[0];
for( unsigned int i = 1; i < m_BezierPoints.size(); i++ )
{
wxPoint& endp = m_BezierPoints[i];
if( filled )
GRFilledSegment( nullptr, DC, startp-offset, endp-offset, m_Width, color );
else
GRCSegm( nullptr, DC, startp-offset, endp-offset, m_Width, color );
startp = m_BezierPoints[i];
}
}
break;
default:
break;
}
}
// see class_edge_mod.h
void EDGE_MODULE::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList )
{

View File

@ -114,8 +114,6 @@ public:
*/
void SetDrawCoord();
void Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset = ZeroOffset ) override;
void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
wxString GetClass() const override

View File

@ -244,11 +244,3 @@ const BOX2I MARKER_PCB::ViewBBox() const
}
void MARKER_PCB::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset )
{
// JEY TODO: needs RENDER_SETTINGS passed in
RENDER_SETTINGS* renderSettings = aFrame->GetCanvas()->GetView()->GetPainter()->GetSettings();
renderSettings->SetPrintDC( aDC );
PrintMarker( renderSettings, aOffset );
}

View File

@ -116,8 +116,6 @@ public:
void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
void Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset = ZeroOffset ) override;
const wxPoint GetPosition() const override { return m_Pos; }
void SetPosition( const wxPoint& aPos ) override { m_Pos = aPos; }

View File

@ -397,39 +397,6 @@ void MODULE::Remove( BOARD_ITEM* aBoardItem )
}
void MODULE::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset )
{
for( auto pad : m_pads )
pad->Print( aFrame, aDC, aOffset );
for( auto zone : m_fp_zones )
zone->Print( aFrame, aDC, aOffset );
BOARD* brd = GetBoard();
// Draw graphic items
if( brd->IsElementVisible( LAYER_MOD_REFERENCES ) )
m_Reference->Print( aFrame, aDC, aOffset );
if( brd->IsElementVisible( LAYER_MOD_VALUES ) )
m_Value->Print( aFrame, aDC, aOffset );
for( auto item : m_drawings )
{
switch( item->Type() )
{
case PCB_MODULE_TEXT_T:
case PCB_MODULE_EDGE_T:
item->Print( aFrame, aDC, aOffset );
break;
default:
break;
}
}
}
void MODULE::CalculateBoundingBox()
{
m_BoundaryBox = GetFootprintRect();

View File

@ -352,15 +352,6 @@ public:
/* drawing functions */
/**
* Function Print
* Prints the footprint to the \a aDC.
* @param aFrame = the current Frame
* @param aDC = Current Device Context
* @param aOffset = draw offset (usually wxPoint(0,0)
*/
void Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset = ZeroOffset ) override;
/**
* function TransformPadsShapesWithClearanceToPolygon
* generate pads shapes on layer aLayer as polygons,

View File

@ -545,8 +545,6 @@ public:
void SetThermalGap( int aGap ) { m_ThermalGap = aGap; }
int GetThermalGap() const;
void Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset = ZeroOffset ) override;
/**
* Function PrintShape
* basic function to print a pad.

View File

@ -72,68 +72,6 @@ PCB_TARGET::~PCB_TARGET()
}
/* Print PCB_TARGET object: 2 segments + 1 circle
* The circle radius is half the radius of the target
* 2 lines have length the diameter of the target
*/
void PCB_TARGET::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset )
{
int radius, ox, oy, width;
int dx1, dx2, dy1, dy2;
ox = m_Pos.x + offset.x;
oy = m_Pos.y + offset.y;
BOARD* brd = GetBoard( );
if( brd->IsLayerVisible( m_Layer ) == false )
return;
COLOR4D gcolor = Pgm().GetSettingsManager().GetColorSettings()->GetColor( m_Layer );
auto displ_opts = aFrame->GetDisplayOptions();
bool filled = displ_opts.m_DisplayDrawItemsFill;
width = m_Width;
radius = m_Size / 3;
if( GetShape() ) // shape X
radius = m_Size / 2;
if( filled )
GRCircle( nullptr, DC, ox, oy, radius, width, gcolor );
else
{
GRCircle( nullptr, DC, ox, oy, radius + (width / 2), gcolor );
GRCircle( nullptr, DC, ox, oy, radius - (width / 2), gcolor );
}
radius = m_Size / 2;
dx1 = radius;
dy1 = 0;
dx2 = 0;
dy2 = radius;
if( GetShape() ) // shape X
{
dx1 = dy1 = radius;
dx2 = dx1;
dy2 = -dy1;
}
if( filled )
{
GRLine( nullptr, DC, ox - dx1, oy - dy1, ox + dx1, oy + dy1, width, gcolor );
GRLine( nullptr, DC, ox - dx2, oy - dy2, ox + dx2, oy + dy2, width, gcolor );
}
else
{
GRCSegm( nullptr, DC, ox - dx1, oy - dy1, ox + dx1, oy + dy1, width, gcolor );
GRCSegm( nullptr, DC, ox - dx2, oy - dy2, ox + dx2, oy + dy2, width, gcolor );
}
}
bool PCB_TARGET::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{
int dX = aPosition.x - m_Pos.x;

View File

@ -83,8 +83,6 @@ public:
void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
void Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset = ZeroOffset ) override;
wxString GetClass() const override
{
return wxT( "PCB_TARGET" );

View File

@ -111,28 +111,6 @@ void TEXTE_PCB::SetTextAngle( double aAngle )
}
void TEXTE_PCB::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset )
{
BOARD* brd = GetBoard();
if( brd->IsLayerVisible( m_Layer ) == false )
return;
auto color = Pgm().GetSettingsManager().GetColorSettings()->GetColor( m_Layer );
EDA_DRAW_MODE_T fillmode = FILLED;
auto& displ_opts = aFrame->GetDisplayOptions();
if( displ_opts.m_DisplayDrawItemsFill == SKETCH )
fillmode = SKETCH;
// JEY TODO: needs RENDER_SETTINGS passed in...
RENDER_SETTINGS* renderSettings = aFrame->GetCanvas()->GetView()->GetPainter()->GetSettings();
renderSettings->SetPrintDC( DC );
EDA_TEXT::Print( renderSettings, offset, color, fillmode );
}
void TEXTE_PCB::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList )
{
wxString msg;

View File

@ -81,8 +81,6 @@ public:
void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
void Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset = ZeroOffset ) override;
void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
bool HitTest( const wxPoint& aPosition, int aAccuracy ) const override

View File

@ -261,57 +261,6 @@ const EDA_RECT TEXTE_MODULE::GetBoundingBox() const
}
void TEXTE_MODULE::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset )
{
/* parent must *not* be NULL (a footprint text without a footprint parent has no sense) */
wxASSERT( m_Parent );
BOARD* brd = GetBoard( );
KIGFX::COLOR4D color = Pgm().GetSettingsManager().GetColorSettings()->GetColor( GetLayer() );
PCB_LAYER_ID text_layer = GetLayer();
if( !brd->IsLayerVisible( m_Layer )
|| ( IsFrontLayer( text_layer ) && !brd->IsElementVisible( LAYER_MOD_TEXT_FR ) )
|| ( IsBackLayer( text_layer ) && !brd->IsElementVisible( LAYER_MOD_TEXT_BK ) ) )
return;
if( !brd->IsElementVisible( LAYER_MOD_REFERENCES ) && GetText() == wxT( "${REFERENCE}" ) )
return;
if( !brd->IsElementVisible( LAYER_MOD_VALUES ) && GetText() == wxT( "${VALUE}" ) )
return;
// Invisible texts are still drawn (not plotted) in LAYER_MOD_TEXT_INVISIBLE
// Just because we must have to edit them (at least to make them visible)
if( !IsVisible() )
{
if( !brd->IsElementVisible( LAYER_MOD_TEXT_INVISIBLE ) )
return;
color = Pgm().GetSettingsManager().GetColorSettings()->GetColor( LAYER_MOD_TEXT_INVISIBLE );
}
// Draw mode compensation for the width
int width = GetEffectiveTextPenWidth();
if( aFrame->GetDisplayOptions().m_DisplayModTextFill == SKETCH )
width = -width;
wxPoint pos = GetTextPos() - aOffset;
// Draw the text proper, with the right attributes
wxSize size = GetTextSize();
double orient = GetDrawRotation();
// If the text is mirrored : negate size.x (mirror / Y axis)
if( IsMirrored() )
size.x = -size.x;
GRText( aDC, pos, color, GetShownText(), orient, size, GetHorizJustify(), GetVertJustify(),
width, IsItalic(), IsBold() );
}
double TEXTE_MODULE::GetDrawRotation() const
{
MODULE* module = (MODULE*) m_Parent;

View File

@ -179,17 +179,6 @@ public:
///> Set relative coordinates.
void SetLocalCoord();
/* drawing functions */
/**
* Function Print
* Print the text according to the footprint pos and orient
* @param aFrame = the current Frame
* @param aDC = Current Device Context
* @param aOffset = draw offset (usually wxPoint(0,0)
*/
void Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset = ZeroOffset ) override;
void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
bool TextHitTest( const wxPoint& aPoint, int aAccuracy = 0 ) const override;

View File

@ -429,37 +429,6 @@ void VIA::SanitizeLayers()
}
void TRACK::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset )
{
BOARD* brd = GetBoard();
auto color = Pgm().GetSettingsManager().GetColorSettings()->GetColor( m_Layer );
if( !brd->IsLayerVisible( m_Layer ) || !brd->IsElementVisible( LAYER_TRACKS ) )
return;
auto displ_opts = aFrame->GetDisplayOptions();
color.a = 0.588;
// Draw track as line if width <= 1pixel:
if( aDC->LogicalToDeviceXRel( m_Width ) <= 1 )
{
GRLine( nullptr, aDC, m_Start + aOffset, m_End + aOffset, m_Width, color );
return;
}
if( !displ_opts.m_DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
{
GRCSegm( nullptr, aDC, m_Start + aOffset, m_End + aOffset, m_Width, color );
}
else
{
GRFillCSegm( nullptr, aDC, m_Start.x + aOffset.x, m_Start.y + aOffset.y,
m_End.x + aOffset.x, m_End.y + aOffset.y, m_Width, color );
}
}
void TRACK::ViewGetLayers( int aLayers[], int& aCount ) const
{
// Show the track and its netname on different layers
@ -495,176 +464,6 @@ const BOX2I TRACK::ViewBBox() const
}
void VIA::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset )
{
int radius;
int fillvia = 0;
PCB_SCREEN* screen = aFrame->GetScreen();
auto& displ_opts = aFrame->GetDisplayOptions();
BOARD* brd = GetBoard();
COLOR4D color = Pgm().GetSettingsManager().GetColorSettings()->GetColor(
LAYER_VIAS + static_cast<int>( GetViaType() ) );
if( displ_opts.m_DisplayViaFill == FILLED )
fillvia = 1;
if( !brd->IsElementVisible( LAYER_VIAS + static_cast<int>( GetViaType() ) ) )
return;
// Only draw the via if at least one of the layers it crosses is being displayed
if( !( brd->GetVisibleLayers() & GetLayerSet() ).any() )
return;
color.a = 0.588;
radius = m_Width >> 1;
// for small via size on screen (radius < 4 pixels) draw a simplified shape
int radius_in_pixels = aDC->LogicalToDeviceXRel( radius );
bool fast_draw = false;
// Vias are drawn as a filled circle or a double circle. The hole will be drawn later
int drill_radius = GetDrillValue() / 2;
int inner_radius = radius - aDC->DeviceToLogicalXRel( 2 );
if( radius_in_pixels < MIN_VIA_DRAW_SIZE )
{
fast_draw = true;
fillvia = false;
}
if( fillvia )
{
GRFilledCircle( nullptr, aDC, m_Start + aOffset, radius, color );
}
else
{
GRCircle( nullptr, aDC, m_Start + aOffset, radius, 0, color );
if ( fast_draw )
return;
GRCircle( nullptr, aDC, m_Start + aOffset, inner_radius, 0, color );
}
if( fillvia )
{
bool blackpenstate = false;
if( screen->m_IsPrinting )
{
blackpenstate = GetGRForceBlackPenState();
GRForceBlackPen( false );
color = WHITE;
}
else
{
color = BLACK; // or DARKGRAY;
}
// Draw hole if the radius is > 1pixel.
if( aDC->LogicalToDeviceXRel( drill_radius ) > 1 )
GRFilledCircle( nullptr, aDC, m_Start.x + aOffset.x, m_Start.y + aOffset.y,
drill_radius, 0, color, color );
if( screen->m_IsPrinting )
GRForceBlackPen( blackpenstate );
}
else
{
if( drill_radius < inner_radius ) // We can show the via hole
GRCircle( nullptr, aDC, m_Start + aOffset, drill_radius, 0, color );
}
if( ShowClearance( displ_opts, this ) )
{
GRCircle( nullptr, aDC, m_Start + aOffset, radius + GetClearance(), 0, color );
}
// for Micro Vias, draw a partial cross : X on component layer, or + on copper layer
// (so we can see 2 superimposed microvias ):
if( GetViaType() == VIATYPE::MICROVIA )
{
int ax, ay, bx, by;
if( IsOnLayer( B_Cu ) )
{
ax = radius; ay = 0;
bx = drill_radius; by = 0;
}
else
{
ax = ay = (radius * 707) / 1000;
bx = by = (drill_radius * 707) / 1000;
}
// lines '|' or '\'
GRLine( nullptr, aDC, m_Start.x + aOffset.x - ax, m_Start.y + aOffset.y - ay,
m_Start.x + aOffset.x - bx, m_Start.y + aOffset.y - by, 0, color );
GRLine( nullptr, aDC, m_Start.x + aOffset.x + bx, m_Start.y + aOffset.y + by,
m_Start.x + aOffset.x + ax, m_Start.y + aOffset.y + ay, 0, color );
// lines - or '/'
GRLine( nullptr, aDC, m_Start.x + aOffset.x + ay, m_Start.y + aOffset.y - ax,
m_Start.x + aOffset.x + by, m_Start.y + aOffset.y - bx, 0, color );
GRLine( nullptr, aDC, m_Start.x + aOffset.x - by, m_Start.y + aOffset.y + bx,
m_Start.x + aOffset.x - ay, m_Start.y + aOffset.y + ax, 0, color );
}
// for Buried Vias, draw a partial line : orient depending on layer pair
// (so we can see superimposed buried vias ):
if( GetViaType() == VIATYPE::BLIND_BURIED )
{
int ax = 0, ay = radius, bx = 0, by = drill_radius;
PCB_LAYER_ID layer_top, layer_bottom;
LayerPair( &layer_top, &layer_bottom );
// lines for the top layer
RotatePoint( &ax, &ay, layer_top * 3600.0 / brd->GetCopperLayerCount( ) );
RotatePoint( &bx, &by, layer_top * 3600.0 / brd->GetCopperLayerCount( ) );
GRLine( nullptr, aDC, m_Start.x + aOffset.x - ax, m_Start.y + aOffset.y - ay,
m_Start.x + aOffset.x - bx, m_Start.y + aOffset.y - by, 0, color );
// lines for the bottom layer
ax = 0; ay = radius; bx = 0; by = drill_radius;
RotatePoint( &ax, &ay, layer_bottom * 3600.0 / brd->GetCopperLayerCount( ) );
RotatePoint( &bx, &by, layer_bottom * 3600.0 / brd->GetCopperLayerCount( ) );
GRLine( nullptr, aDC, m_Start.x + aOffset.x - ax, m_Start.y + aOffset.y - ay,
m_Start.x + aOffset.x - bx, m_Start.y + aOffset.y - by, 0, color );
}
// Display the short netname:
if( GetNetCode() == NETINFO_LIST::UNCONNECTED )
return;
if( displ_opts.m_DisplayNetNamesMode == 0 || displ_opts.m_DisplayNetNamesMode == 1 )
return;
NETINFO_ITEM* net = GetNet();
if( net == NULL )
return;
wxString text = UnescapeString( net->GetShortNetname() );
int len = text.Len();
if( len > 0 )
{
// calculate a good size for the text
int tsize = m_Width / len;
if( aDC->LogicalToDeviceXRel( tsize ) >= MIN_TEXT_SIZE )
{
tsize = (tsize * 7) / 10; // small reduction to give a better look, inside via
GRHaloText( aDC, m_Start, color, WHITE, BLACK, text, 0, wxSize( tsize, tsize ),
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, tsize/7, false, false );
}
}
}
void VIA::ViewGetLayers( int aLayers[], int& aCount ) const
{
aLayers[0] = LAYER_VIAS_HOLES;

View File

@ -143,8 +143,6 @@ public:
return GetLineLength( m_Start, m_End );
}
void Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& aOffset = ZeroOffset ) override;
/**
* Function TransformShapeWithClearanceToPolygon
* Convert the track shape to a closed polygon
@ -349,8 +347,6 @@ public:
// Do not create a copy constructor. The one generated by the compiler is adequate.
void Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& aOffset = ZeroOffset ) override;
bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
virtual LSET GetLayerSet() const override;

View File

@ -318,118 +318,6 @@ bool ZONE_CONTAINER::IsOnLayer( PCB_LAYER_ID aLayer ) const
}
void ZONE_CONTAINER::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset )
{
if( !DC )
return;
wxPoint seg_start, seg_end;
PCB_LAYER_ID curr_layer = aFrame->GetActiveLayer();
BOARD* brd = GetBoard();
PCB_LAYER_ID draw_layer = UNDEFINED_LAYER;
LSET layers = GetLayerSet() & brd->GetVisibleLayers();
// If there are no visible layers, return
if( layers.count() == 0 )
return;
/* Keepout zones can exist on multiple layers
* Thus, determining which color to use to render them is a bit tricky.
* In descending order of priority:
*
* 1. If in GR_HIGHLIGHT mode:
* a. If zone is on selected layer, use layer color!
* b. Else, use grey
* 1. Not in GR_HIGHLIGHT mode
* a. If zone is on selected layer, use layer color
* b. Else, use color of top-most (visible) layer
*
*/
if( GetIsKeepout() )
{
// At least one layer must be provided!
assert( GetLayerSet().count() > 0 );
// Not on any visible layer?
if( layers.count() == 0 )
return;
// Is keepout zone present on the selected layer?
if( layers.test( curr_layer ) )
{
draw_layer = curr_layer;
}
else
{
// Select the first (top) visible layer
if( layers.count() > 0 )
{
draw_layer = layers.Seq()[0];
}
else
{
draw_layer = GetLayerSet().Seq()[0];
}
}
}
/* Non-keepout zones are easier to deal with
*/
else
{
if( brd->IsLayerVisible( GetLayer() ) == false )
return;
draw_layer = GetLayer();
}
assert( draw_layer != UNDEFINED_LAYER );
COLOR4D color = Pgm().GetSettingsManager().GetColorSettings()->GetColor( draw_layer );
auto displ_opts = aFrame->GetDisplayOptions();
if( displ_opts.m_ContrastModeDisplay )
{
if( !IsOnLayer( curr_layer ) )
color = COLOR4D( DARKDARKGRAY );
}
color.a = 0.588;
// draw the lines
std::vector<wxPoint> lines;
lines.reserve( (GetNumCorners() * 2) + 2 );
// Iterate through the segments of the outline
for( auto iterator = m_Poly->IterateSegmentsWithHoles(); iterator; iterator++ )
{
// Create the segment
SEG segment = *iterator;
lines.push_back( static_cast<wxPoint>( segment.A ) + offset );
lines.push_back( static_cast<wxPoint>( segment.B ) + offset );
}
GRLineArray( nullptr, DC, lines, 0, color );
// draw hatches
lines.clear();
lines.reserve( (m_HatchLines.size() * 2) + 2 );
for( unsigned ic = 0; ic < m_HatchLines.size(); ic++ )
{
seg_start = static_cast<wxPoint>( m_HatchLines[ic].A ) + offset;
seg_end = static_cast<wxPoint>( m_HatchLines[ic].B ) + offset;
lines.push_back( seg_start );
lines.push_back( seg_end );
}
GRLineArray( nullptr, DC, lines, 0, color );
}
void ZONE_CONTAINER::PrintFilledArea( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset )
{
static std::vector <wxPoint> CornersBuffer;

View File

@ -105,16 +105,6 @@ public:
virtual LSET GetLayerSet() const override;
/**
* Function Print
* Prints the zone outline.
* @param aFrame = current Frame
* @param DC = current Device Context
* @param aDrawMode = GR_OR, GR_XOR, GR_COPY ..
* @param offset = Draw offset (usually wxPoint(0,0))
*/
void Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset = ZeroOffset ) override;
/**
* Function PrintFilledArea
* Draws the filled area for this zone (polygon list .m_FilledPolysList)

View File

@ -210,13 +210,6 @@ public:
#endif
/**
* Function Peinr
* @todo we actually could show a NET, simply show all the tracks and
* a pads or net name on pad and vias
*/
void Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset ) override;
/**
* Function GetNet
* @return int - the netcode

View File

@ -68,14 +68,6 @@ NETINFO_ITEM::~NETINFO_ITEM()
}
/**
* Function Print (TODO)
*/
void NETINFO_ITEM::Print( PCB_BASE_FRAME* frame, wxDC* DC, const wxPoint& aOffset )
{
}
void NETINFO_ITEM::SetClass( const NETCLASSPTR& aNetClass )
{
wxCHECK( m_parent, /* void */ );

View File

@ -57,143 +57,6 @@ PAD_DRAWINFO::PAD_DRAWINFO()
}
void D_PAD::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset )
{
wxSize mask_margin; // margin (clearance) used for some non copper layers
if( m_Flags & DO_NOT_DRAW )
return;
PAD_DRAWINFO drawInfo;
drawInfo.m_Offset = aOffset;
/* We can show/hide pads from the layer manager.
* options are show/hide pads on front and/or back side of the board
* For through pads, we hide them only if both sides are hidden.
* smd pads on back are hidden for all layers (copper and technical layers)
* on back side of the board
* smd pads on front are hidden for all layers (copper and technical layers)
* on front side of the board
* ECO, edge and Draw layers and not considered
*/
BOARD* brd = GetBoard();
bool frontVisible = brd->IsElementVisible( LAYER_PAD_FR );
bool backVisible = brd->IsElementVisible( LAYER_PAD_BK );
if( !frontVisible && !backVisible )
return;
// If pad is only on front side (no layer on back side)
// and if hide front side pads is enabled, do not draw
if( !frontVisible && !( m_layerMask & LSET::BackMask() ).any() )
return;
// If pad is only on back side (no layer on front side)
// and if hide back side pads is enabled, do not draw
if( !backVisible && !( m_layerMask & LSET::FrontMask() ).any() )
return;
auto& displ_opts = aFrame->GetDisplayOptions();
PCB_SCREEN* screen = aFrame->GetScreen();
if( displ_opts.m_DisplayPadFill == SKETCH )
drawInfo.m_ShowPadFilled = false;
else
drawInfo.m_ShowPadFilled = true;
COLOR4D color = COLOR4D::BLACK;
if( m_layerMask[F_Cu] )
{
color = aFrame->ColorSettings()->GetColor( LAYER_PAD_FR );
}
if( m_layerMask[B_Cu] )
{
color = color.LegacyMix( aFrame->ColorSettings()->GetColor( LAYER_PAD_BK ) );
}
if( color == BLACK ) // Not on a visible copper layer (i.e. still nothing to show)
{
// If the pad is on only one tech layer, use the layer color else use DARKGRAY
LSET mask_non_copper_layers = m_layerMask & ~LSET::AllCuMask();
PCB_LAYER_ID pad_layer = mask_non_copper_layers.ExtractLayer();
switch( (int) pad_layer )
{
case UNDEFINED_LAYER: // More than one layer
color = DARKGRAY;
break;
case UNSELECTED_LAYER: // Shouldn't really happen...
break;
default:
color = aFrame->ColorSettings()->GetColor( pad_layer );
}
}
if( ( IsOnLayer( B_Paste ) && brd->IsLayerVisible( B_Paste ) ) ||
( IsOnLayer( F_Paste ) && brd->IsLayerVisible( F_Paste ) ) )
{
mask_margin = GetSolderPasteMargin();
}
if( ( IsOnLayer( B_Mask ) && brd->IsLayerVisible( B_Mask ) ) ||
( IsOnLayer( F_Mask ) && brd->IsLayerVisible( F_Mask ) ) )
{
mask_margin.x = std::max( mask_margin.x, GetSolderMaskMargin() );
mask_margin.y = std::max( mask_margin.y, GetSolderMaskMargin() );
}
bool DisplayIsol = displ_opts.m_DisplayPadIsol;
if( !( m_layerMask & LSET::AllCuMask() ).any() )
DisplayIsol = false;
if( ( GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED ) &&
brd->IsElementVisible( LAYER_NON_PLATEDHOLES ) )
{
drawInfo.m_ShowNotPlatedHole = true;
drawInfo.m_NPHoleColor = aFrame->ColorSettings()->GetColor( LAYER_NON_PLATEDHOLES );
}
// Don't let pads that *should* be NPTHs get lost
else if ( PadShouldBeNPTH() )
{
drawInfo.m_ShowNotPlatedHole = true;
drawInfo.m_NPHoleColor = aFrame->ColorSettings()->GetColor( LAYER_MOD_TEXT_INVISIBLE );
}
drawInfo.m_Color = color;
drawInfo.m_NoNetMarkColor = aFrame->ColorSettings()->GetColor( LAYER_NO_CONNECTS );
drawInfo.m_Mask_margin = mask_margin;
drawInfo.m_ShowNCMark = brd->IsElementVisible( LAYER_NO_CONNECTS );
drawInfo.m_IsPrinting = screen->m_IsPrinting;
color.a = 0.666;
/* Get the pad clearance. This has a meaning only for Pcbnew.
* for CvPcb GetClearance() creates debug errors because
* there is no net classes so a call to GetClearance() is made only when
* needed (never needed in CvPcb)
*/
drawInfo.m_PadClearance = DisplayIsol ? GetClearance() : 0;
// Draw the pad number
if( !displ_opts.m_DisplayPadNum )
drawInfo.m_Display_padnum = false;
if( ( displ_opts.m_DisplayNetNamesMode == 0 ) || ( displ_opts.m_DisplayNetNamesMode == 2 ) )
drawInfo.m_Display_netname = false;
PrintShape( aDC, drawInfo );
}
void D_PAD::PrintShape( wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
{
#define SEGCOUNT 32 // number of segments to approximate a circle

View File

@ -1,176 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <pcb_edit_frame.h>
#include <base_units.h>
#include <class_board.h>
#include <class_module.h>
#include <class_track.h>
#include <class_zone.h>
#include <class_marker_pcb.h>
#include <pcbnew.h>
#include <footprint_edit_frame.h>
#include <pcbplot.h>
#include <wx/overlay.h>
// Local functions:
/* Trace the pads of a module in sketch mode.
* Used to display pads when when the module visibility is set to not visible
* and we want to see pad through.
* The pads must appear on the layers selected in LayerMask
*/
static void Trace_Pads_Only( PCB_BASE_FRAME* aFrame, wxDC* DC, MODULE* Module,
int ox, int oy, LSET LayerMask );
// Redraw the BOARD items but not cursors, axis or grid
void BOARD::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset )
{
/* The order of drawing is flexible on some systems and not on others. For
* OSes which use OR to draw, the order is not important except for the
* effect of the highlight and its relationship to markers. See comment
* below.
* This order independence comes from the fact that a binary OR operation is
* commutative in nature.
* However on the OSX, the OR operation is not used, and so this sequence
* below is chosen to give MODULEs the highest visible priority.
*/
/* Draw all tracks and zones. As long as dark colors are used for the
* tracks, Then the OR draw mode should show tracks underneath other
* tracks. But a white track will cover any other color since it has
* more bits to OR in.
*/
for( auto track : m_tracks )
{
if( track->IsMoving() )
continue;
track->Print( aFrame, DC );
}
// Draw areas (i.e. zones)
for( int ii = 0; ii < GetAreaCount(); ii++ )
{
ZONE_CONTAINER* zone = GetArea( ii );
// Areas must be drawn here only if not moved or dragged,
// because these areas are drawn by ManageCursor() in a specific manner
if( ( zone->GetEditFlags() & (IN_EDIT | IS_DRAGGED | IS_MOVED) ) == 0 )
{
zone->Print( aFrame, DC );
zone->PrintFilledArea( aFrame, DC );
}
}
// Draw the graphic items
for( auto item : m_drawings )
{
if( item->IsMoving() )
continue;
switch( item->Type() )
{
case PCB_DIMENSION_T:
case PCB_TEXT_T:
case PCB_TARGET_T:
case PCB_LINE_T:
item->Print( aFrame, DC );
break;
default:
break;
}
}
LSET all_cu = LSET::AllCuMask();
for( auto module : m_modules )
{
bool display = true;
LSET layerMask = all_cu;
if( module->IsMoving() )
continue;
if( !IsElementVisible( LAYER_MOD_FR ) )
{
if( module->GetLayer() == F_Cu )
display = false;
layerMask.set( F_Cu, false );
}
if( !IsElementVisible( LAYER_MOD_BK ) )
{
if( module->GetLayer() == B_Cu )
display = false;
layerMask.set( B_Cu, false );
}
if( display )
module->Print( aFrame, DC );
else
Trace_Pads_Only( aFrame, DC, module, 0, 0, layerMask );
}
// draw the BOARD's markers last, otherwise the high light will erase any marker on a pad
for( unsigned i = 0; i < m_markers.size(); ++i )
{
m_markers[i]->Print( aFrame, DC );
}
}
/* Trace the pads of a module in sketch mode.
* Used to display pads when when the module visibility is set to not visible
* and we want to see pad through.
* The pads must appear on the layers selected in LayerMask
*/
static void Trace_Pads_Only( PCB_BASE_FRAME* aFrame, wxDC* DC, MODULE* aModule,
int ox, int oy, LSET aLayerMask )
{
PCB_DISPLAY_OPTIONS displ_opts = aFrame->GetDisplayOptions();
int tmp = displ_opts.m_DisplayPadFill;
displ_opts.m_DisplayPadFill = false;
aFrame->SetDisplayOptions( displ_opts );
// Draw pads.
for( auto pad : aModule->Pads() )
{
if( (pad->GetLayerSet() & aLayerMask) == 0 )
continue;
pad->Print( aFrame, DC, wxPoint( ox, oy ) );
}
displ_opts.m_DisplayPadFill = tmp;
aFrame->SetDisplayOptions( displ_opts );
}

View File

@ -141,11 +141,6 @@ KIFACE_I& Kiface()
FP_LIB_TABLE GFootprintTable;
void BOARD::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset )
{
}
DIALOG_FIND::DIALOG_FIND( PCB_BASE_FRAME* aParent ) : DIALOG_FIND_BASE( aParent )
{
// these members are initialized to avoid warnings about non initialized vars