Split out FILL_T to its own header to avoid spreading eda_item everywhere

This commit is contained in:
Marek Roszko
2020-10-14 21:51:23 -04:00
parent 5a0281d4ab
commit 1538d737e7
50 changed files with 341 additions and 308 deletions
+23 -25
View File
@@ -91,11 +91,9 @@
* The center of ellipse is automatically calculated.
*/
#include <config.h>
#include <base64.h>
#include <eda_base_frame.h>
#include <eda_rect.h>
#include <eda_item.h>
#include <common.h>
#include <kicad_string.h>
#include <trigo.h>
@@ -168,7 +166,7 @@ SVG_PLOTTER::SVG_PLOTTER()
{
m_graphics_changed = true;
SetTextMode( PLOT_TEXT_MODE::STROKE );
m_fillMode = NO_FILL; // or FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR
m_fillMode = FILL_TYPE::NO_FILL; // or FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR
m_pen_rgb_color = 0; // current color value (black)
m_brush_rgb_color = 0; // current color value (black)
m_dashed = PLOT_DASH_TYPE::SOLID;
@@ -219,7 +217,7 @@ void SVG_PLOTTER::SetColor( COLOR4D color )
}
void SVG_PLOTTER::setFillMode( FILL_T fill )
void SVG_PLOTTER::setFillMode( FILL_TYPE fill )
{
if( m_fillMode != fill )
{
@@ -239,19 +237,19 @@ void SVG_PLOTTER::setSVGPlotStyle( bool aIsGroup, const std::string& aExtraStyle
switch( m_fillMode )
{
case NO_FILL:
case FILL_TYPE::NO_FILL:
fputs( "fill-opacity:0.0; ", outputFile );
break;
case FILLED_SHAPE:
case FILL_TYPE::FILLED_SHAPE:
fputs( "fill-opacity:1.0; ", outputFile );
break;
case FILLED_WITH_BG_BODYCOLOR:
case FILL_TYPE::FILLED_WITH_BG_BODYCOLOR:
fputs( "fill-opacity:0.6; ", outputFile );
break;
case FILLED_WITH_COLOR:
case FILL_TYPE::FILLED_WITH_COLOR:
wxFAIL_MSG( "FILLED_WITH_COLOR not implemented" );
break;
}
@@ -383,7 +381,7 @@ void SVG_PLOTTER::SetDash( PLOT_DASH_TYPE dashed )
}
void SVG_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width )
void SVG_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_TYPE fill, int width )
{
EDA_RECT rect( p1, wxSize( p2.x -p1.x, p2.y -p1.y ) );
rect.Normalize();
@@ -418,7 +416,7 @@ void SVG_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int w
}
void SVG_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T fill, int width )
void SVG_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_TYPE fill, int width )
{
DPOINT pos_dev = userToDeviceCoordinates( pos );
double radius = userToDeviceSize( diametre / 2.0 );
@@ -427,9 +425,9 @@ void SVG_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T fill, int wid
SetCurrentLineWidth( width );
// If diameter is less than width, switch to filled mode
if( fill == NO_FILL && diametre < width )
if( fill == FILL_TYPE::NO_FILL && diametre < width )
{
setFillMode( FILLED_SHAPE );
setFillMode( FILL_TYPE::FILLED_SHAPE );
SetCurrentLineWidth( 0 );
radius = userToDeviceSize( ( diametre / 2.0 ) + ( width / 2.0 ) );
@@ -442,7 +440,7 @@ void SVG_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T fill, int wid
void SVG_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
FILL_T fill, int width )
FILL_TYPE fill, int width )
{
/* Draws an arc of a circle, centred on (xc,yc), with starting point
* (x1, y1) and ending at (x2, y2). The current pen is used for the outline
@@ -454,7 +452,7 @@ void SVG_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, i
if( radius <= 0 )
{
Circle( centre, width, FILLED_SHAPE, 0 );
Circle( centre, width, FILL_TYPE::FILLED_SHAPE, 0 );
return;
}
@@ -521,7 +519,7 @@ void SVG_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, i
// flag arc size (0 = small arc > 180 deg, 1 = large arc > 180 deg),
// sweep arc ( 0 = CCW, 1 = CW),
// end point
if( fill != NO_FILL )
if( fill != FILL_TYPE::NO_FILL )
{
// Filled arcs (in eeschema) consist of the pie wedge and a stroke only on the arc
// This needs to be drawn in two steps.
@@ -534,7 +532,7 @@ void SVG_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, i
end.x, end.y, centre_dev.x, centre_dev.y );
}
setFillMode( NO_FILL );
setFillMode( FILL_TYPE::NO_FILL );
SetCurrentLineWidth( width );
fprintf( outputFile, "<path d=\"M%f %f A%f %f 0.0 %d %d %f %f\" />\n",
start.x, start.y, radius_dev, radius_dev,
@@ -548,7 +546,7 @@ void SVG_PLOTTER::BezierCurve( const wxPoint& aStart, const wxPoint& aControl1,
int aTolerance, int aLineThickness )
{
#if 1
setFillMode( NO_FILL );
setFillMode( FILL_TYPE::NO_FILL );
SetCurrentLineWidth( aLineThickness );
DPOINT start = userToDeviceCoordinates( aStart );
@@ -567,7 +565,7 @@ void SVG_PLOTTER::BezierCurve( const wxPoint& aStart, const wxPoint& aControl1,
void SVG_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
FILL_T aFill, int aWidth, void * aData )
FILL_TYPE aFill, int aWidth, void * aData )
{
if( aCornerList.size() <= 1 )
return;
@@ -578,16 +576,16 @@ void SVG_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
switch( aFill )
{
case NO_FILL:
case FILL_TYPE::NO_FILL:
setSVGPlotStyle( false, "fill:none" );
break;
case FILLED_WITH_BG_BODYCOLOR:
case FILLED_SHAPE:
case FILL_TYPE::FILLED_WITH_BG_BODYCOLOR:
case FILL_TYPE::FILLED_SHAPE:
setSVGPlotStyle( false, "fill-rule:evenodd;" );
break;
case FILLED_WITH_COLOR:
case FILL_TYPE::FILLED_WITH_COLOR:
wxFAIL_MSG( "FILLED_WITH_COLOR not implemented" );
break;
}
@@ -686,9 +684,9 @@ void SVG_PLOTTER::PenTo( const wxPoint& pos, char plume )
// Ensure we do not use a fill mode when moving tne pen,
// in SVG mode (i;e. we are plotting only basic lines, not a filled area
if( m_fillMode != NO_FILL )
if( m_fillMode != FILL_TYPE::NO_FILL )
{
setFillMode( NO_FILL );
setFillMode( FILL_TYPE::NO_FILL );
setSVGPlotStyle();
}
@@ -791,7 +789,7 @@ void SVG_PLOTTER::Text( const wxPoint& aPos,
bool aMultilineAllowed,
void* aData )
{
setFillMode( NO_FILL );
setFillMode( FILL_TYPE::NO_FILL );
SetColor( aColor );
SetCurrentLineWidth( aWidth );