Unify support for line width magic cookies.
They were added for the Gerber plotter but once there there's the expectation by others that they'll work.
This commit is contained in:
parent
9db2969911
commit
bcea2019d4
|
@ -233,6 +233,7 @@ void PLOTTER::Text( const wxPoint& aPos,
|
||||||
void* aData )
|
void* aData )
|
||||||
{
|
{
|
||||||
SetColor( aColor );
|
SetColor( aColor );
|
||||||
|
SetCurrentLineWidth( aPenWidth );
|
||||||
|
|
||||||
GRText( NULL, aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aPenWidth,
|
GRText( NULL, aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aPenWidth,
|
||||||
aItalic, aBold, nullptr, nullptr, this );
|
aItalic, aBold, nullptr, nullptr, this );
|
||||||
|
|
|
@ -286,6 +286,10 @@ void GERBER_PLOTTER::SetCurrentLineWidth( int aWidth, void* aData )
|
||||||
{
|
{
|
||||||
if( aWidth == DO_NOT_SET_LINE_WIDTH )
|
if( aWidth == DO_NOT_SET_LINE_WIDTH )
|
||||||
return;
|
return;
|
||||||
|
else if( aWidth == USE_DEFAULT_LINE_WIDTH )
|
||||||
|
aWidth = m_renderSettings->GetDefaultPenWidth();
|
||||||
|
|
||||||
|
wxASSERT_MSG( aWidth >= 0, "Plotter called to set negative pen width" );
|
||||||
|
|
||||||
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
|
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
|
||||||
int aperture_attribute = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
|
int aperture_attribute = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
|
||||||
|
|
|
@ -91,9 +91,15 @@ void PDF_PLOTTER::SetCurrentLineWidth( int aWidth, void* aData )
|
||||||
{
|
{
|
||||||
wxASSERT( workFile );
|
wxASSERT( workFile );
|
||||||
|
|
||||||
if( aWidth == 0 )
|
if( aWidth == DO_NOT_SET_LINE_WIDTH )
|
||||||
|
return;
|
||||||
|
else if( aWidth == USE_DEFAULT_LINE_WIDTH )
|
||||||
|
aWidth = m_renderSettings->GetDefaultPenWidth();
|
||||||
|
else if( aWidth == 0 )
|
||||||
aWidth = 1;
|
aWidth = 1;
|
||||||
|
|
||||||
|
wxASSERT_MSG( aWidth > 0, "Plotter called to set negative pen width" );
|
||||||
|
|
||||||
if( aWidth != currentPenWidth )
|
if( aWidth != currentPenWidth )
|
||||||
fprintf( workFile, "%g w\n", userToDeviceSize( aWidth ) );
|
fprintf( workFile, "%g w\n", userToDeviceSize( aWidth ) );
|
||||||
|
|
||||||
|
|
|
@ -521,6 +521,15 @@ void PS_PLOTTER::SetCurrentLineWidth( int aWidth, void* aData )
|
||||||
{
|
{
|
||||||
wxASSERT( outputFile );
|
wxASSERT( outputFile );
|
||||||
|
|
||||||
|
if( aWidth == DO_NOT_SET_LINE_WIDTH )
|
||||||
|
return;
|
||||||
|
else if( aWidth == USE_DEFAULT_LINE_WIDTH )
|
||||||
|
aWidth = m_renderSettings->GetDefaultPenWidth();
|
||||||
|
else if( aWidth == 0 )
|
||||||
|
aWidth = 1;
|
||||||
|
|
||||||
|
wxASSERT_MSG( aWidth > 0, "Plotter called to set negative pen width" );
|
||||||
|
|
||||||
if( aWidth != GetCurrentLineWidth() )
|
if( aWidth != GetCurrentLineWidth() )
|
||||||
fprintf( outputFile, "%g setlinewidth\n", userToDeviceSize( aWidth ) );
|
fprintf( outputFile, "%g setlinewidth\n", userToDeviceSize( aWidth ) );
|
||||||
|
|
||||||
|
|
|
@ -303,6 +303,15 @@ void SVG_PLOTTER::setSVGPlotStyle( bool aIsGroup, const std::string& aExtraStyle
|
||||||
*/
|
*/
|
||||||
void SVG_PLOTTER::SetCurrentLineWidth( int aWidth, void* aData )
|
void SVG_PLOTTER::SetCurrentLineWidth( int aWidth, void* aData )
|
||||||
{
|
{
|
||||||
|
if( aWidth == DO_NOT_SET_LINE_WIDTH )
|
||||||
|
return;
|
||||||
|
else if( aWidth == USE_DEFAULT_LINE_WIDTH )
|
||||||
|
aWidth = m_renderSettings->GetDefaultPenWidth();
|
||||||
|
else if( aWidth == 0 )
|
||||||
|
aWidth = 1;
|
||||||
|
|
||||||
|
wxASSERT_MSG( aWidth > 0, "Plotter called to set negative pen width" );
|
||||||
|
|
||||||
if( aWidth != currentPenWidth )
|
if( aWidth != currentPenWidth )
|
||||||
{
|
{
|
||||||
m_graphics_changed = true;
|
m_graphics_changed = true;
|
||||||
|
|
Loading…
Reference in New Issue