Add done messages to various plotters.

Fixes https://gitlab.com/kicad/code/kicad/issues/9172
This commit is contained in:
Jeff Young 2021-09-18 10:34:02 +01:00
parent 847c9e32c8
commit 4779850c10
4 changed files with 82 additions and 78 deletions

View File

@ -398,19 +398,19 @@ void DIALOG_PLOT_SCHEMATIC::plotSchematic( bool aPlotAll )
{ {
default: default:
case PLOT_FORMAT::POST: case PLOT_FORMAT::POST:
createPSFile( aPlotAll, getPlotDrawingSheet(), &renderSettings ); createPSFiles( aPlotAll, getPlotDrawingSheet(), &renderSettings );
break; break;
case PLOT_FORMAT::DXF: case PLOT_FORMAT::DXF:
createDxfFile( aPlotAll, getPlotDrawingSheet(), &renderSettings ); createDXFFiles( aPlotAll, getPlotDrawingSheet(), &renderSettings );
break; break;
case PLOT_FORMAT::PDF: case PLOT_FORMAT::PDF:
createPDFFile( aPlotAll, getPlotDrawingSheet(), &renderSettings ); createPDFFile( aPlotAll, getPlotDrawingSheet(), &renderSettings );
break; break;
case PLOT_FORMAT::SVG: case PLOT_FORMAT::SVG:
createSVGFile( aPlotAll, getPlotDrawingSheet(), &renderSettings ); createSVGFiles( aPlotAll, getPlotDrawingSheet(), &renderSettings );
break; break;
case PLOT_FORMAT::HPGL: case PLOT_FORMAT::HPGL:
createHPGLFile( aPlotAll, getPlotDrawingSheet(), &renderSettings ); createHPGLFiles( aPlotAll, getPlotDrawingSheet(), &renderSettings );
break; break;
} }
} }
@ -433,8 +433,7 @@ wxFileName DIALOG_PLOT_SCHEMATIC::createPlotFileName( const wxString& aPlotFileN
retv.SetExt( aExtension ); retv.SetExt( aExtension );
if( !EnsureFileDirectoryExists( &tmp, retv.GetFullName(), aReporter ) if( !EnsureFileDirectoryExists( &tmp, retv.GetFullName(), aReporter ) || !tmp.IsDirWritable() )
|| !tmp.IsDirWritable() )
{ {
wxString msg = wxString::Format( _( "Failed to write plot files to folder '%s'." ), wxString msg = wxString::Format( _( "Failed to write plot files to folder '%s'." ),
tmp.GetPath() ); tmp.GetPath() );
@ -457,17 +456,16 @@ wxFileName DIALOG_PLOT_SCHEMATIC::createPlotFileName( const wxString& aPlotFileN
} }
void DIALOG_PLOT_SCHEMATIC::createDxfFile( bool aPlotAll, bool aPlotDrawingSheet, void DIALOG_PLOT_SCHEMATIC::createDXFFiles( bool aPlotAll, bool aPlotDrawingSheet,
RENDER_SETTINGS* aRenderSettings ) RENDER_SETTINGS* aRenderSettings )
{ {
SCH_EDIT_FRAME* schframe = m_parent; SCH_EDIT_FRAME* schframe = m_parent;
SCH_SHEET_PATH oldsheetpath = schframe->GetCurrentSheet(); SCH_SHEET_PATH oldsheetpath = schframe->GetCurrentSheet();
/* When printing all pages, the printed page is not the current page. /* When printing all pages, the printed page is not the current page. In complex hierarchies,
* In complex hierarchies, we must setup references and others parameters * we must update symbol references and other parameters in the given printed SCH_SCREEN,
* in the printed SCH_SCREEN * according to the sheet path because in complex hierarchies a SCH_SCREEN (a drawing ) is
* because in complex hierarchies a SCH_SCREEN (a schematic drawings) * shared between many sheets and symbol references depend on the actual sheet path used.
* is shared between many sheets
*/ */
SCH_SHEET_LIST sheetList; SCH_SHEET_LIST sheetList;
@ -508,7 +506,7 @@ void DIALOG_PLOT_SCHEMATIC::createDxfFile( bool aPlotAll, bool aPlotDrawingSheet
if( !plotFileName.IsOk() ) if( !plotFileName.IsOk() )
return; return;
if( plotOneSheetDxf( plotFileName.GetFullPath(), screen, aRenderSettings, if( plotOneSheetDXF( plotFileName.GetFullPath(), screen, aRenderSettings,
plot_offset, 1.0, aPlotDrawingSheet ) ) plot_offset, 1.0, aPlotDrawingSheet ) )
{ {
msg.Printf( _( "Plotted to '%s'." ), plotFileName.GetFullPath() ); msg.Printf( _( "Plotted to '%s'." ), plotFileName.GetFullPath() );
@ -531,13 +529,15 @@ void DIALOG_PLOT_SCHEMATIC::createDxfFile( bool aPlotAll, bool aPlotDrawingSheet
} }
} }
reporter.ReportTail( _( "Done." ), RPT_SEVERITY_INFO );
schframe->SetCurrentSheet( oldsheetpath ); schframe->SetCurrentSheet( oldsheetpath );
schframe->GetCurrentSheet().UpdateAllScreenReferences(); schframe->GetCurrentSheet().UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount(); schframe->SetSheetNumberAndCount();
} }
bool DIALOG_PLOT_SCHEMATIC::plotOneSheetDxf( const wxString& aFileName, bool DIALOG_PLOT_SCHEMATIC::plotOneSheetDXF( const wxString& aFileName,
SCH_SCREEN* aScreen, SCH_SCREEN* aScreen,
RENDER_SETTINGS* aRenderSettings, RENDER_SETTINGS* aRenderSettings,
const wxPoint& aPlotOffset, const wxPoint& aPlotOffset,
@ -602,17 +602,16 @@ void DIALOG_PLOT_SCHEMATIC::setHpglPenWidth()
} }
void DIALOG_PLOT_SCHEMATIC::createHPGLFile( bool aPlotAll, bool aPlotFrameRef, void DIALOG_PLOT_SCHEMATIC::createHPGLFiles( bool aPlotAll, bool aPlotFrameRef,
RENDER_SETTINGS* aRenderSettings ) RENDER_SETTINGS* aRenderSettings )
{ {
SCH_SCREEN* screen = m_parent->GetScreen(); SCH_SCREEN* screen = m_parent->GetScreen();
SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet(); SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet();
/* When printing all pages, the printed page is not the current page. /* When printing all pages, the printed page is not the current page. In complex hierarchies,
* In complex hierarchies, we must setup references and other parameters * we must update symbol references and other parameters in the given printed SCH_SCREEN,
* in the printed SCH_SCREEN * according to the sheet path because in complex hierarchies a SCH_SCREEN (a drawing ) is
* because in complex hierarchies a SCH_SCREEN (a schematic drawings) * shared between many sheets and symbol references depend on the actual sheet path used.
* is shared between many sheets
*/ */
SCH_SHEET_LIST sheetList; SCH_SHEET_LIST sheetList;
@ -695,9 +694,10 @@ void DIALOG_PLOT_SCHEMATIC::createHPGLFile( bool aPlotAll, bool aPlotFrameRef,
msg.Printf( wxT( "HPGL Plotter exception: %s"), e.What() ); msg.Printf( wxT( "HPGL Plotter exception: %s"), e.What() );
reporter.Report( msg, RPT_SEVERITY_ERROR ); reporter.Report( msg, RPT_SEVERITY_ERROR );
} }
} }
reporter.ReportTail( _( "Done." ), RPT_SEVERITY_INFO );
m_parent->SetCurrentSheet( oldsheetpath ); m_parent->SetCurrentSheet( oldsheetpath );
m_parent->GetCurrentSheet().UpdateAllScreenReferences(); m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount(); m_parent->SetSheetNumberAndCount();
@ -780,12 +780,10 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotDrawingSheet
{ {
SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet(); // sheetpath is saved here SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet(); // sheetpath is saved here
/* When printing all pages, the printed page is not the current page. In /* When printing all pages, the printed page is not the current page. In complex hierarchies,
* complex hierarchies, we must update symbol references and other * we must update symbol references and other parameters in the given printed SCH_SCREEN,
* parameters in the given printed SCH_SCREEN, accordant to the sheet path * according to the sheet path because in complex hierarchies a SCH_SCREEN (a drawing ) is
* because in complex hierarchies a SCH_SCREEN (a drawing ) is shared * shared between many sheets and symbol references depend on the actual sheet path used.
* between many sheets and symbol references depend on the actual sheet
* path used
*/ */
SCH_SHEET_LIST sheetList; SCH_SHEET_LIST sheetList;
@ -820,14 +818,13 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotDrawingSheet
if( i == 0 ) if( i == 0 )
{ {
try try
{ {
wxString fname = m_parent->GetUniqueFilenameForCurrentSheet(); wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
// The sub sheet can be in a sub_hierarchy, but we plot the file in the // The sub sheet can be in a sub_hierarchy, but we plot the file in the main
// main project folder (or the folder specified by the caller), // project folder (or the folder specified by the caller), so replace separators
// so replace separators to create a unique filename: // to create a unique filename:
fname.Replace( "/", "_" ); fname.Replace( "/", "_" );
fname.Replace( "\\", "_" ); fname.Replace( "\\", "_" );
wxString ext = PDF_PLOTTER::GetDefaultFileExtension(); wxString ext = PDF_PLOTTER::GetDefaultFileExtension();
@ -874,6 +871,7 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotDrawingSheet
// Everything done, close the plot and restore the environment // Everything done, close the plot and restore the environment
msg.Printf( _( "Plotted to '%s'.\n" ), plotFileName.GetFullPath() ); msg.Printf( _( "Plotted to '%s'.\n" ), plotFileName.GetFullPath() );
reporter.Report( msg, RPT_SEVERITY_ACTION ); reporter.Report( msg, RPT_SEVERITY_ACTION );
reporter.ReportTail( _( "Done." ), RPT_SEVERITY_INFO );
restoreEnvironment( plotter, oldsheetpath ); restoreEnvironment( plotter, oldsheetpath );
} }
@ -955,11 +953,13 @@ void DIALOG_PLOT_SCHEMATIC::setupPlotPagePDF( PLOTTER* aPlotter, SCH_SCREEN* aSc
} }
void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef, void DIALOG_PLOT_SCHEMATIC::createPSFiles( bool aPlotAll, bool aPlotFrameRef,
RENDER_SETTINGS* aRenderSettings ) RENDER_SETTINGS* aRenderSettings )
{ {
SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet(); // sheetpath is saved here SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet(); // sheetpath is saved here
PAGE_INFO plotPage; // page size selected to plot PAGE_INFO plotPage; // page size selected to plot
wxString msg;
REPORTER& reporter = m_MessagesBox->Reporter();
/* When printing all pages, the printed page is not the current page. /* When printing all pages, the printed page is not the current page.
* In complex hierarchies, we must update symbol references and other parameters in the * In complex hierarchies, we must update symbol references and other parameters in the
@ -1008,14 +1008,9 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef,
double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils(); double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils();
double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils(); double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils();
double scale = std::min( scalex, scaley ); double scale = std::min( scalex, scaley );
wxPoint plot_offset; wxPoint plot_offset;
wxString msg;
REPORTER& reporter = m_MessagesBox->Reporter();
try try
{ {
wxString fname = m_parent->GetUniqueFilenameForCurrentSheet(); wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
@ -1052,6 +1047,8 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef,
} }
} }
reporter.ReportTail( _( "Done." ), RPT_SEVERITY_INFO );
m_parent->SetCurrentSheet( oldsheetpath ); m_parent->SetCurrentSheet( oldsheetpath );
m_parent->GetCurrentSheet().UpdateAllScreenReferences(); m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount(); m_parent->SetSheetNumberAndCount();
@ -1090,8 +1087,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
if( m_plotBackgroundColor->GetValue() ) if( m_plotBackgroundColor->GetValue() )
{ {
plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) ); plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
wxPoint end( plotter->PageSettings().GetWidthIU(), wxPoint end( plotter->PageSettings().GetWidthIU(), plotter->PageSettings().GetHeightIU() );
plotter->PageSettings().GetHeightIU() );
plotter->Rect( wxPoint( 0, 0 ), end, FILL_TYPE::FILLED_SHAPE, 1.0 ); plotter->Rect( wxPoint( 0, 0 ), end, FILL_TYPE::FILLED_SHAPE, 1.0 );
} }
@ -1114,7 +1110,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
} }
void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef, void DIALOG_PLOT_SCHEMATIC::createSVGFiles( bool aPrintAll, bool aPrintFrameRef,
RENDER_SETTINGS* aRenderSettings ) RENDER_SETTINGS* aRenderSettings )
{ {
wxString msg; wxString msg;
@ -1178,6 +1174,8 @@ void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef,
} }
} }
reporter.ReportTail( _( "Done" ), RPT_SEVERITY_INFO );
m_parent->SetCurrentSheet( oldsheetpath ); m_parent->SetCurrentSheet( oldsheetpath );
m_parent->GetCurrentSheet().UpdateAllScreenReferences(); m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount(); m_parent->SetSheetNumberAndCount();
@ -1283,9 +1281,8 @@ wxString DIALOG_PLOT_SCHEMATIC::getOutputPath()
} }
else else
{ {
wxMessageDialog dlg( this, msg, _( "Warning" ), wxMessageDialog dlg( this, msg, _( "Warning" ), wxOK | wxCENTER | wxRESIZE_BORDER
wxOK | wxCENTER | wxRESIZE_BORDER | wxICON_EXCLAMATION | | wxICON_EXCLAMATION | wxSTAY_ON_TOP );
wxSTAY_ON_TOP );
dlg.SetExtendedMessage( extMsg ); dlg.SetExtendedMessage( extMsg );
dlg.ShowModal(); dlg.ShowModal();
@ -1297,9 +1294,8 @@ wxString DIALOG_PLOT_SCHEMATIC::getOutputPath()
{ {
msg = _( "No project or path defined for the current schematic." ); msg = _( "No project or path defined for the current schematic." );
wxMessageDialog dlg( this, msg, _( "Warning" ), wxMessageDialog dlg( this, msg, _( "Warning" ), wxOK | wxCENTER | wxRESIZE_BORDER
wxOK | wxCENTER | wxRESIZE_BORDER | wxICON_EXCLAMATION | | wxICON_EXCLAMATION | wxSTAY_ON_TOP );
wxSTAY_ON_TOP );
dlg.SetExtendedMessage( extMsg ); dlg.SetExtendedMessage( extMsg );
dlg.ShowModal(); dlg.ShowModal();

View File

@ -110,8 +110,8 @@ private:
void restoreEnvironment( PDF_PLOTTER* aPlotter, SCH_SHEET_PATH& aOldsheetpath ); void restoreEnvironment( PDF_PLOTTER* aPlotter, SCH_SHEET_PATH& aOldsheetpath );
// DXF // DXF
void createDxfFile( bool aPlotAll, bool aPlotDrawingSheet, RENDER_SETTINGS* aRenderSettings ); void createDXFFiles( bool aPlotAll, bool aPlotDrawingSheet, RENDER_SETTINGS* aRenderSettings );
bool plotOneSheetDxf( const wxString& aFileName, SCH_SCREEN* aScreen, bool plotOneSheetDXF( const wxString& aFileName, SCH_SCREEN* aScreen,
RENDER_SETTINGS* aRenderSettings, const wxPoint& aPlotOffset, RENDER_SETTINGS* aRenderSettings, const wxPoint& aPlotOffset,
double aScale, bool aPlotFrameRef ); double aScale, bool aPlotFrameRef );
@ -151,7 +151,7 @@ private:
} }
} }
void createHPGLFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aRenderSettings ); void createHPGLFiles( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aRenderSettings );
void setHpglPenWidth(); void setHpglPenWidth();
bool plotOneSheetHpgl( const wxString& aFileName, SCH_SCREEN* aScreen, bool plotOneSheetHpgl( const wxString& aFileName, SCH_SCREEN* aScreen,
const PAGE_INFO& aPageInfo, RENDER_SETTINGS* aRenderSettings, const PAGE_INFO& aPageInfo, RENDER_SETTINGS* aRenderSettings,
@ -159,13 +159,13 @@ private:
HPGL_PLOT_ORIGIN_AND_UNITS aOriginAndUnits ); HPGL_PLOT_ORIGIN_AND_UNITS aOriginAndUnits );
// PS // PS
void createPSFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aSettings ); void createPSFiles( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aSettings );
bool plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen, bool plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen,
RENDER_SETTINGS* aRenderSettings, const PAGE_INFO& aPageInfo, RENDER_SETTINGS* aRenderSettings, const PAGE_INFO& aPageInfo,
const wxPoint& aPlot0ffset, double aScale, bool aPlotFrameRef ); const wxPoint& aPlot0ffset, double aScale, bool aPlotFrameRef );
// SVG // SVG
void createSVGFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aSettings ); void createSVGFiles( bool aPrintAll, bool aPrintFrameRef, RENDER_SETTINGS* aRenderSettings );
bool plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScreen, bool plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScreen,
RENDER_SETTINGS* aRenderSettings, bool aPlotBlackAndWhite, RENDER_SETTINGS* aRenderSettings, bool aPlotBlackAndWhite,
bool aPlotFrameRef ); bool aPlotFrameRef );

View File

@ -41,7 +41,6 @@
#include <dialog_gendrill.h> #include <dialog_gendrill.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <reporter.h> #include <reporter.h>
#include <wx/stdpaths.h>
#include <wx/msgdlg.h> #include <wx/msgdlg.h>
#include <wx/dirdlg.h> #include <wx/dirdlg.h>
#include <wx/filedlg.h> #include <wx/filedlg.h>
@ -217,7 +216,9 @@ void DIALOG_GENDRILL::onFileFormatSelection( wxCommandEvent& event )
m_radioBoxOvalHoleMode->Enable( enbl_Excellon ); m_radioBoxOvalHoleMode->Enable( enbl_Excellon );
if( enbl_Excellon ) if( enbl_Excellon )
{
UpdatePrecisionOptions(); UpdatePrecisionOptions();
}
else else
{ {
m_staticTextPrecision->Enable( true ); m_staticTextPrecision->Enable( true );
@ -310,9 +311,11 @@ void DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
if( dialog.ShowModal() == wxID_YES ) if( dialog.ShowModal() == wxID_YES )
{ {
if( !dirName.MakeRelativeTo( defaultPath ) ) if( !dirName.MakeRelativeTo( defaultPath ) )
{
wxMessageBox( _( "Cannot make path relative (target volume different from file volume)!" ), wxMessageBox( _( "Cannot make path relative (target volume different from file volume)!" ),
_( "Plot Output Directory" ), wxOK | wxICON_ERROR ); _( "Plot Output Directory" ), wxOK | wxICON_ERROR );
} }
}
m_outputDirectoryName->SetValue( dirName.GetFullPath() ); m_outputDirectoryName->SetValue( dirName.GetFullPath() );
} }
@ -471,4 +474,6 @@ void DIALOG_GENDRILL::OnGenReportFile( wxCommandEvent& event )
msg.Printf( _( "Report file '%s' created." ), dlg.GetPath() ); msg.Printf( _( "Report file '%s' created." ), dlg.GetPath() );
m_messagesBox->AppendText( msg ); m_messagesBox->AppendText( msg );
} }
m_messagesBox->AppendText( _( "Done." ) );
} }

View File

@ -116,7 +116,9 @@ void DIALOG_PLOT::init_Dialog()
// Test for a reasonable scale value. Set to 1 if problem // Test for a reasonable scale value. Set to 1 if problem
if( m_XScaleAdjust < PLOT_MIN_SCALE || m_YScaleAdjust < PLOT_MIN_SCALE if( m_XScaleAdjust < PLOT_MIN_SCALE || m_YScaleAdjust < PLOT_MIN_SCALE
|| m_XScaleAdjust > PLOT_MAX_SCALE || m_YScaleAdjust > PLOT_MAX_SCALE ) || m_XScaleAdjust > PLOT_MAX_SCALE || m_YScaleAdjust > PLOT_MAX_SCALE )
{
m_XScaleAdjust = m_YScaleAdjust = 1.0; m_XScaleAdjust = m_YScaleAdjust = 1.0;
}
m_fineAdjustXCtrl->SetValue( StringFromValue( EDA_UNITS::UNSCALED, m_XScaleAdjust ) ); m_fineAdjustXCtrl->SetValue( StringFromValue( EDA_UNITS::UNSCALED, m_XScaleAdjust ) );
m_fineAdjustYCtrl->SetValue( StringFromValue( EDA_UNITS::UNSCALED, m_YScaleAdjust ) ); m_fineAdjustYCtrl->SetValue( StringFromValue( EDA_UNITS::UNSCALED, m_YScaleAdjust ) );
@ -246,8 +248,7 @@ void DIALOG_PLOT::reInitDialog()
if( knownViolations || exclusions ) if( knownViolations || exclusions )
{ {
m_DRCExclusionsWarning->SetLabel( wxString::Format( m_DRCWarningTemplate, m_DRCExclusionsWarning->SetLabel( wxString::Format( m_DRCWarningTemplate, knownViolations,
knownViolations,
exclusions ) ); exclusions ) );
m_DRCExclusionsWarning->Show(); m_DRCExclusionsWarning->Show();
} }
@ -281,10 +282,8 @@ void DIALOG_PLOT::OnRightClick( wxMouseEvent& event )
// Select or deselect groups of layers in the layers list: // Select or deselect groups of layers in the layers list:
void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event ) void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event )
{ {
// Build a list of layers for usual fabrication: // Build a list of layers for usual fabrication: copper layers + tech layers without courtyard
// copper layers + tech layers without courtyard LSET fab_layer_set = ( LSET::AllCuMask() | LSET::AllTechMask() ) & ~LSET( 2, B_CrtYd, F_CrtYd );
LSET fab_layer_set = ( LSET::AllCuMask() | LSET::AllTechMask() )
& ~LSET( 2, B_CrtYd, F_CrtYd );
switch( event.GetId() ) switch( event.GetId() )
{ {
@ -334,8 +333,7 @@ void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event )
void DIALOG_PLOT::CreateDrillFile( wxCommandEvent& event ) void DIALOG_PLOT::CreateDrillFile( wxCommandEvent& event )
{ {
// Be sure drill file use the same settings (axis option, plot directory) // Be sure drill file use the same settings (axis option, plot directory) as plot files:
// as plot files:
applyPlotSettings(); applyPlotSettings();
DIALOG_GENDRILL dlg( m_parent, this ); DIALOG_GENDRILL dlg( m_parent, this );
@ -349,12 +347,12 @@ void DIALOG_PLOT::CreateDrillFile( wxCommandEvent& event )
void DIALOG_PLOT::OnChangeDXFPlotMode( wxCommandEvent& event ) void DIALOG_PLOT::OnChangeDXFPlotMode( wxCommandEvent& event )
{ {
// m_DXF_plotTextStrokeFontOpt is disabled if m_DXF_plotModeOpt // m_DXF_plotTextStrokeFontOpt is disabled if m_DXF_plotModeOpt is checked (plot in DXF
// is checked (plot in DXF polygon mode) // polygon mode)
m_DXF_plotTextStrokeFontOpt->Enable( !m_DXF_plotModeOpt->GetValue() ); m_DXF_plotTextStrokeFontOpt->Enable( !m_DXF_plotModeOpt->GetValue() );
// if m_DXF_plotTextStrokeFontOpt option is disabled (plot DXF in polygon mode), // if m_DXF_plotTextStrokeFontOpt option is disabled (plot DXF in polygon mode), force
// force m_DXF_plotTextStrokeFontOpt to true to use Pcbnew stroke font // m_DXF_plotTextStrokeFontOpt to true to use Pcbnew stroke font
if( !m_DXF_plotTextStrokeFontOpt->IsEnabled() ) if( !m_DXF_plotTextStrokeFontOpt->IsEnabled() )
m_DXF_plotTextStrokeFontOpt->SetValue( true ); m_DXF_plotTextStrokeFontOpt->SetValue( true );
} }
@ -435,8 +433,8 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
BOARD* board = m_parent->GetBoard(); BOARD* board = m_parent->GetBoard();
const BOARD_DESIGN_SETTINGS& brd_settings = board->GetDesignSettings(); const BOARD_DESIGN_SETTINGS& brd_settings = board->GetDesignSettings();
if( getPlotFormat() == PLOT_FORMAT::GERBER && if( getPlotFormat() == PLOT_FORMAT::GERBER
( brd_settings.m_SolderMaskMargin || brd_settings.m_SolderMaskMinWidth ) ) && ( brd_settings.m_SolderMaskMargin || brd_settings.m_SolderMaskMinWidth ) )
{ {
m_PlotOptionsSizer->Show( m_SizerSolderMaskAlert ); m_PlotOptionsSizer->Show( m_SizerSolderMaskAlert );
} }
@ -591,8 +589,7 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
} }
// A helper function to "clip" aValue between aMin and aMax // A helper function to "clip" aValue between aMin and aMax and write result in * aResult
// and write result in * aResult
// return false if clipped, true if aValue is just copied into * aResult // return false if clipped, true if aValue is just copied into * aResult
static bool setDouble( double* aResult, double aValue, double aMin, double aMax ) static bool setDouble( double* aResult, double aValue, double aMin, double aMax )
{ {
@ -682,7 +679,9 @@ void DIALOG_PLOT::applyPlotSettings()
} }
} }
else // keep the last value (initial value if no HPGL plot made) else // keep the last value (initial value if no HPGL plot made)
{
tempOptions.SetHPGLPenDiameter( m_plotOpts.GetHPGLPenDiameter() ); tempOptions.SetHPGLPenDiameter( m_plotOpts.GetHPGLPenDiameter() );
}
// X scale // X scale
double tmpDouble; double tmpDouble;
@ -717,8 +716,8 @@ void DIALOG_PLOT::applyPlotSettings()
cfg->m_Plot.check_zones_before_plotting = m_zoneFillCheck->GetValue(); cfg->m_Plot.check_zones_before_plotting = m_zoneFillCheck->GetValue();
// PS Width correction // PS Width correction
if( !setInt( &m_PSWidthAdjust, m_trackWidthCorrection.GetValue(), if( !setInt( &m_PSWidthAdjust, m_trackWidthCorrection.GetValue(), m_widthAdjustMinValue,
m_widthAdjustMinValue, m_widthAdjustMaxValue ) ) m_widthAdjustMaxValue ) )
{ {
m_trackWidthCorrection.SetValue( m_PSWidthAdjust ); m_trackWidthCorrection.SetValue( m_PSWidthAdjust );
msg.Printf( _( "Width correction constrained. " msg.Printf( _( "Width correction constrained. "
@ -745,11 +744,13 @@ void DIALOG_PLOT::applyPlotSettings()
tempOptions.SetSvgPrecision( m_svgPrecsision->GetValue(), m_svgUnits->GetSelection() ); tempOptions.SetSvgPrecision( m_svgPrecsision->GetValue(), m_svgUnits->GetSelection() );
LSET selectedLayers; LSET selectedLayers;
for( unsigned i = 0; i < m_layerList.size(); i++ ) for( unsigned i = 0; i < m_layerList.size(); i++ )
{ {
if( m_layerCheckListBox->IsChecked( i ) ) if( m_layerCheckListBox->IsChecked( i ) )
selectedLayers.set( m_layerList[i] ); selectedLayers.set( m_layerList[i] );
} }
// Get a list of copper layers that aren't being used by inverting enabled layers. // Get a list of copper layers that aren't being used by inverting enabled layers.
LSET disabledCopperLayers = LSET::AllCuMask() & ~m_parent->GetBoard()->GetEnabledLayers(); LSET disabledCopperLayers = LSET::AllCuMask() & ~m_parent->GetBoard()->GetEnabledLayers();
// Enable all of the disabled copper layers. // Enable all of the disabled copper layers.
@ -924,6 +925,8 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
BuildPlotFileName( &fn, outputDir.GetPath(), "job", GerberJobFileExtension ); BuildPlotFileName( &fn, outputDir.GetPath(), "job", GerberJobFileExtension );
jobfile_writer.CreateJobFile( fn.GetFullPath() ); jobfile_writer.CreateJobFile( fn.GetFullPath() );
} }
reporter.ReportTail( _( "Done." ), RPT_SEVERITY_INFO );
} }