Pcbnew plot: fix a few minor issues:
- SVG export: fix color of PCB texts. - Avoid marking board as modified after plotting layers, when options not saved in board are modified.
This commit is contained in:
parent
557e69f72a
commit
816307e500
|
@ -336,11 +336,6 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName, bool aOnlyO
|
|||
plot_opts.SetMirror( m_printMirror );
|
||||
plot_opts.SetFormat( PLOT_FORMAT_SVG );
|
||||
|
||||
COLOR4D color = COLOR4D::UNSPECIFIED; // Used layer color to plot ref and value
|
||||
|
||||
plot_opts.SetReferenceColor( color );
|
||||
plot_opts.SetValueColor( color );
|
||||
|
||||
PAGE_INFO pageInfo = m_board->GetPageSettings();
|
||||
wxPoint axisorigin = m_board->GetAuxOrigin();
|
||||
|
||||
|
|
|
@ -706,11 +706,15 @@ void DIALOG_PLOT::applyPlotSettings()
|
|||
dirStr.Replace( wxT( "\\" ), wxT( "/" ) );
|
||||
tempOptions.SetOutputDirectory( dirStr );
|
||||
|
||||
if( m_plotOpts != tempOptions )
|
||||
if( !m_plotOpts.IsSameAs( tempOptions, false ) )
|
||||
{
|
||||
// First, mark board as modified only for parameters saved in file
|
||||
if( !m_plotOpts.IsSameAs( tempOptions, true ) )
|
||||
m_parent->OnModify();
|
||||
|
||||
// Now, save any change, for the session
|
||||
m_parent->SetPlotSettings( tempOptions );
|
||||
m_plotOpts = tempOptions;
|
||||
m_parent->OnModify();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -111,8 +111,6 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS()
|
|||
m_widthAdjust = 0.;
|
||||
m_outputDirectory.clear();
|
||||
m_color = BLACK;
|
||||
m_referenceColor = BLACK;
|
||||
m_valueColor = BLACK;
|
||||
m_textMode = PLOTTEXTMODE_DEFAULT;
|
||||
m_layerSelection = LSET( 2, F_SilkS, B_SilkS) | LSET::AllCuMask();
|
||||
|
||||
|
@ -220,7 +218,7 @@ void PCB_PLOT_PARAMS::Parse( PCB_PLOT_PARAMS_PARSER* aParser )
|
|||
}
|
||||
|
||||
|
||||
bool PCB_PLOT_PARAMS::operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const
|
||||
bool PCB_PLOT_PARAMS::IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams, bool aCompareOnlySavedPrms ) const
|
||||
{
|
||||
if( m_layerSelection != aPcbPlotParams.m_layerSelection )
|
||||
return false;
|
||||
|
@ -242,8 +240,11 @@ bool PCB_PLOT_PARAMS::operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const
|
|||
return false;
|
||||
if( m_plotMode != aPcbPlotParams.m_plotMode )
|
||||
return false;
|
||||
if( !aCompareOnlySavedPrms )
|
||||
{
|
||||
if( m_DXFplotPolygonMode != aPcbPlotParams.m_DXFplotPolygonMode )
|
||||
return false;
|
||||
}
|
||||
if( m_useAuxOrigin != aPcbPlotParams.m_useAuxOrigin )
|
||||
return false;
|
||||
if( m_HPGLPenNum != aPcbPlotParams.m_HPGLPenNum )
|
||||
|
@ -284,12 +285,11 @@ bool PCB_PLOT_PARAMS::operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const
|
|||
return false;
|
||||
if( m_widthAdjust != aPcbPlotParams.m_widthAdjust )
|
||||
return false;
|
||||
if( !aCompareOnlySavedPrms )
|
||||
{
|
||||
if( m_color != aPcbPlotParams.m_color )
|
||||
return false;
|
||||
if( m_referenceColor != aPcbPlotParams.m_referenceColor )
|
||||
return false;
|
||||
if( m_valueColor != aPcbPlotParams.m_valueColor )
|
||||
return false;
|
||||
}
|
||||
if( m_textMode != aPcbPlotParams.m_textMode )
|
||||
return false;
|
||||
if( !m_outputDirectory.IsSameAs( aPcbPlotParams.m_outputDirectory ) )
|
||||
|
@ -299,12 +299,6 @@ bool PCB_PLOT_PARAMS::operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const
|
|||
}
|
||||
|
||||
|
||||
bool PCB_PLOT_PARAMS::operator!=( const PCB_PLOT_PARAMS &aPcbPlotParams ) const
|
||||
{
|
||||
return !( *this == aPcbPlotParams );
|
||||
}
|
||||
|
||||
|
||||
bool PCB_PLOT_PARAMS::SetHPGLPenDiameter( int aValue )
|
||||
{
|
||||
return setInt( &m_HPGLPenDiam, aValue, HPGL_PEN_DIAMETER_MIN, HPGL_PEN_DIAMETER_MAX );
|
||||
|
@ -442,18 +436,22 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams )
|
|||
aPcbPlotParams->m_HPGLPenNum = parseInt( HPGL_PEN_NUMBER_MIN,
|
||||
HPGL_PEN_NUMBER_MAX );
|
||||
break;
|
||||
|
||||
case T_hpglpenspeed:
|
||||
aPcbPlotParams->m_HPGLPenSpeed = parseInt( HPGL_PEN_SPEED_MIN,
|
||||
HPGL_PEN_SPEED_MAX );
|
||||
break;
|
||||
|
||||
case T_hpglpendiameter:
|
||||
aPcbPlotParams->m_HPGLPenDiam = parseInt( HPGL_PEN_DIAMETER_MIN,
|
||||
HPGL_PEN_DIAMETER_MAX );
|
||||
break;
|
||||
|
||||
case T_hpglpenoverlay:
|
||||
// No more used. juste here for compatibility with old versions
|
||||
parseInt( 0, HPGL_PEN_DIAMETER_MAX );
|
||||
break;
|
||||
|
||||
case T_pscolor:
|
||||
NeedSYMBOL(); // This actually was never used...
|
||||
break;
|
||||
|
@ -558,6 +556,7 @@ double PCB_PLOT_PARAMS_PARSER::parseDouble()
|
|||
return val;
|
||||
}
|
||||
|
||||
|
||||
void PCB_PLOT_PARAMS_PARSER::skipCurrent()
|
||||
{
|
||||
int curr_level = 0;
|
||||
|
|
|
@ -54,9 +54,10 @@ private:
|
|||
*/
|
||||
EDA_DRAW_MODE_T m_plotMode;
|
||||
|
||||
/// DXF format: Plot items in outline (polygon) mode
|
||||
/// In polygon mode, each item to plot is converted to a polygon, and all
|
||||
/// polygons are merged.
|
||||
/** DXF format: Plot items in outline (polygon) mode
|
||||
* In polygon mode, each item to plot is converted to a polygon, and all
|
||||
* polygons are merged.
|
||||
*/
|
||||
bool m_DXFplotPolygonMode;
|
||||
|
||||
/// Plot format type (chooses the driver to be used)
|
||||
|
@ -68,7 +69,7 @@ private:
|
|||
/// Choose how represent text with PS, PDF and DXF drivers
|
||||
PlotTextMode m_textMode;
|
||||
|
||||
/// The default line width (used for the frame and in LINE mode)
|
||||
/// The default line width (used to draw items having no defined width)
|
||||
int m_lineWidth;
|
||||
|
||||
/// When true set the scale to fit the board in the page
|
||||
|
@ -95,8 +96,10 @@ private:
|
|||
/// Set of layers to plot
|
||||
LSET m_layerSelection;
|
||||
|
||||
/** When plotting gerbers use a conventional set of Protel extensions
|
||||
* instead of appending a suffix to the board name */
|
||||
/** When plotting gerber files, use a conventional set of Protel extensions
|
||||
* instead of .gbr, that is now the offical gerber file extension
|
||||
* this is a deprecated feature
|
||||
*/
|
||||
bool m_useGerberProtelExtensions;
|
||||
|
||||
/// Include attributes from the Gerber X2 format (chapter 5 in revision J2)
|
||||
|
@ -111,7 +114,7 @@ private:
|
|||
/// 5 is the minimal value for professional boards.
|
||||
int m_gerberPrecision;
|
||||
|
||||
/// Plot gerbers using auxiliary (drill) origin instead of page coordinates
|
||||
/// Plot gerbers using auxiliary (drill) origin instead of absolue coordinates
|
||||
bool m_useAuxOrigin;
|
||||
|
||||
/// On gerbers 'scrape' away the solder mask from silkscreen (trim silks)
|
||||
|
@ -135,8 +138,7 @@ private:
|
|||
/// Force plotting of fields marked invisible
|
||||
bool m_plotInvisibleText;
|
||||
|
||||
/// Allows pads outlines on silkscreen layer
|
||||
/// (when pads are also on silk screen)
|
||||
/// Allows pads outlines on silkscreen layer (when pads are also on silk screen)
|
||||
bool m_plotPadsOnSilkLayer;
|
||||
|
||||
/* These next two scale factors are intended to compensate plotters
|
||||
|
@ -144,7 +146,8 @@ private:
|
|||
* near 1.0; only X and Y dimensions are adjusted: circles are plotted as
|
||||
* circles, even if X and Y fine scale differ; because of this it is mostly
|
||||
* useful for printers: postscript plots would be best adjusted using
|
||||
* the prologue (that would change the whole output matrix */
|
||||
* the prologue (that would change the whole output matrix
|
||||
*/
|
||||
|
||||
double m_fineScaleAdjustX; ///< fine scale adjust X axis
|
||||
double m_fineScaleAdjustY; ///< fine scale adjust Y axis
|
||||
|
@ -157,9 +160,7 @@ private:
|
|||
int m_HPGLPenNum; ///< HPGL only: pen number selection(1 to 9)
|
||||
int m_HPGLPenSpeed; ///< HPGL only: pen speed, always in cm/s (1 to 99 cm/s)
|
||||
int m_HPGLPenDiam; ///< HPGL only: pen diameter in MILS, useful to fill areas
|
||||
COLOR4D m_color; ///< Color for plotting the current layer
|
||||
COLOR4D m_referenceColor; ///< Color for plotting references
|
||||
COLOR4D m_valueColor; ///< Color for plotting values
|
||||
COLOR4D m_color; ///< Color for plotting the current layer. Provided, but not really used
|
||||
|
||||
public:
|
||||
PCB_PLOT_PARAMS();
|
||||
|
@ -170,18 +171,18 @@ public:
|
|||
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl=0 ) const;
|
||||
void Parse( PCB_PLOT_PARAMS_PARSER* aParser );
|
||||
|
||||
bool operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const;
|
||||
bool operator!=( const PCB_PLOT_PARAMS &aPcbPlotParams ) const;
|
||||
/**
|
||||
* Compare current settings to aPcbPlotParams, including not saved parameters in brd file
|
||||
* @param aPcbPlotParams = the PCB_PLOT_PARAMS to compare
|
||||
* @param aCompareOnlySavedPrms = true to compare only saved in file parameters,
|
||||
* and false to compare the full set of parameters.
|
||||
* @return true is parameters are same, false if one (or more) parameter does not match
|
||||
*/
|
||||
bool IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams, bool aCompareOnlySavedPrms ) const;
|
||||
|
||||
void SetColor( COLOR4D aVal ) { m_color = aVal; }
|
||||
COLOR4D GetColor() const { return m_color; }
|
||||
|
||||
void SetReferenceColor( COLOR4D aVal ) { m_referenceColor = aVal; }
|
||||
COLOR4D GetReferenceColor() const { return m_referenceColor; }
|
||||
|
||||
void SetValueColor( COLOR4D aVal ) { m_valueColor = aVal; }
|
||||
COLOR4D GetValueColor() const { return m_valueColor; }
|
||||
|
||||
void SetTextMode( PlotTextMode aVal ) { m_textMode = aVal; }
|
||||
PlotTextMode GetTextMode() const { return m_textMode; }
|
||||
|
||||
|
|
|
@ -1004,16 +1004,20 @@ void PCB_EDIT_FRAME::OnModify( )
|
|||
|
||||
void PCB_EDIT_FRAME::SVG_Print( wxCommandEvent& event )
|
||||
{
|
||||
PCB_PLOT_PARAMS tmp = GetPlotSettings();
|
||||
PCB_PLOT_PARAMS plot_prms = GetPlotSettings();
|
||||
|
||||
// we don't want dialogs knowing about complex wxFrame functions so
|
||||
// pass everything the dialog needs without reference to *this frame's class.
|
||||
if( InvokeSVGPrint( this, GetBoard(), &tmp ) )
|
||||
if( InvokeSVGPrint( this, GetBoard(), &plot_prms ) )
|
||||
{
|
||||
if( tmp != GetPlotSettings() )
|
||||
if( !plot_prms.IsSameAs( GetPlotSettings(), false ) )
|
||||
{
|
||||
SetPlotSettings( tmp );
|
||||
// First, mark board as modified only for parameters saved in file
|
||||
if( !plot_prms.IsSameAs( GetPlotSettings(), true ) )
|
||||
OnModify();
|
||||
|
||||
// Now, save any change, for the session
|
||||
SetPlotSettings( plot_prms );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -224,18 +224,12 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule )
|
|||
// Plot text fields, if allowed
|
||||
if( trace_ref )
|
||||
{
|
||||
if( GetReferenceColor() == COLOR4D::UNSPECIFIED )
|
||||
PlotTextModule( &aModule->Reference(), getColor( textLayer ) );
|
||||
else
|
||||
PlotTextModule( &aModule->Reference(), GetReferenceColor() );
|
||||
}
|
||||
|
||||
if( trace_val )
|
||||
{
|
||||
if( GetValueColor() == COLOR4D::UNSPECIFIED )
|
||||
PlotTextModule( &aModule->Value(), getColor( textLayer ) );
|
||||
else
|
||||
PlotTextModule( &aModule->Value(), GetValueColor() );
|
||||
}
|
||||
|
||||
for( BOARD_ITEM* item = aModule->GraphicalItemsList().GetFirst(); item; item = item->Next() )
|
||||
|
@ -345,11 +339,9 @@ void BRDITEMS_PLOTTER::PlotDimension( DIMENSION* aDim )
|
|||
draw.SetWidth( aDim->GetWidth() );
|
||||
draw.SetLayer( aDim->GetLayer() );
|
||||
|
||||
COLOR4D color = aDim->GetBoard()->GetLayerColor( aDim->GetLayer() );
|
||||
COLOR4D color = getColor( aDim->GetLayer() );
|
||||
|
||||
// Set plot color (change WHITE to LIGHTGRAY because
|
||||
// the white items are not seen on a white paper or screen
|
||||
m_plotter->SetColor( color != WHITE ? color : LIGHTGRAY);
|
||||
m_plotter->SetColor( color );
|
||||
|
||||
PlotTextePcb( &aDim->Text() );
|
||||
|
||||
|
@ -565,7 +557,8 @@ void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte )
|
|||
gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_NONCONDUCTOR );
|
||||
}
|
||||
|
||||
m_plotter->SetColor( getColor( pt_texte->GetLayer() ) );
|
||||
COLOR4D color = getColor( pt_texte->GetLayer() );
|
||||
m_plotter->SetColor( color );
|
||||
|
||||
size = pt_texte->GetTextSize();
|
||||
pos = pt_texte->GetTextPos();
|
||||
|
@ -593,14 +586,14 @@ void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte )
|
|||
for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
|
||||
{
|
||||
wxString& txt = strings_list.Item( ii );
|
||||
m_plotter->Text( positions[ii], COLOR4D::UNSPECIFIED, txt, orient, size,
|
||||
m_plotter->Text( positions[ii], color, txt, orient, size,
|
||||
pt_texte->GetHorizJustify(), pt_texte->GetVertJustify(),
|
||||
thickness, pt_texte->IsItalic(), allow_bold, false, &gbr_metadata );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_plotter->Text( pos, COLOR4D::UNSPECIFIED, shownText, orient, size,
|
||||
m_plotter->Text( pos, color, shownText, orient, size,
|
||||
pt_texte->GetHorizJustify(), pt_texte->GetVertJustify(),
|
||||
thickness, pt_texte->IsItalic(), allow_bold, false, &gbr_metadata );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue