Eeschema plot: fix some (minor) issues with page size option set to a fixed page-size
Fixes #13062 Fixes #13056 Fixes #13057 However, DXF and HPGL is not perfect, but OTOH this is not an usual format for schematic. PS format is not tested for now.
This commit is contained in:
parent
ef83d01455
commit
0562eaa7b1
|
@ -357,6 +357,8 @@ void DIALOG_PLOT_SCHEMATIC::OnPlotAll( wxCommandEvent& event )
|
||||||
|
|
||||||
void DIALOG_PLOT_SCHEMATIC::plotSchematic( bool aPlotAll )
|
void DIALOG_PLOT_SCHEMATIC::plotSchematic( bool aPlotAll )
|
||||||
{
|
{
|
||||||
|
wxBusyCursor dummy;
|
||||||
|
|
||||||
KIGFX::SCH_RENDER_SETTINGS renderSettings( *m_parent->GetRenderSettings() );
|
KIGFX::SCH_RENDER_SETTINGS renderSettings( *m_parent->GetRenderSettings() );
|
||||||
|
|
||||||
getPlotOptions( &renderSettings );
|
getPlotOptions( &renderSettings );
|
||||||
|
|
|
@ -232,10 +232,11 @@ void SCH_PLOTTER::plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen,
|
||||||
|
|
||||||
wxString sheetName = m_schematic->CurrentSheet().Last()->GetName();
|
wxString sheetName = m_schematic->CurrentSheet().Last()->GetName();
|
||||||
wxString sheetPath = m_schematic->CurrentSheet().PathHumanReadable();
|
wxString sheetPath = m_schematic->CurrentSheet().PathHumanReadable();
|
||||||
|
const PAGE_INFO& actualPage = aScreen->GetPageSettings(); // page size selected in schematic
|
||||||
|
|
||||||
PlotDrawingSheet( aPlotter, &aScreen->Schematic()->Prj(),
|
PlotDrawingSheet( aPlotter, &aScreen->Schematic()->Prj(),
|
||||||
m_schematic->RootScreen()->GetTitleBlock(),
|
m_schematic->RootScreen()->GetTitleBlock(),
|
||||||
aPlotter->PageSettings(),
|
actualPage,
|
||||||
aScreen->Schematic()->GetProperties(),
|
aScreen->Schematic()->GetProperties(),
|
||||||
aScreen->GetPageNumber(), aScreen->GetPageCount(), sheetName, sheetPath,
|
aScreen->GetPageNumber(), aScreen->GetPageCount(), sheetName, sheetPath,
|
||||||
aScreen->GetFileName(), color, aScreen->GetVirtualPageNumber() == 1 );
|
aScreen->GetFileName(), color, aScreen->GetVirtualPageNumber() == 1 );
|
||||||
|
@ -358,7 +359,7 @@ void SCH_PLOTTER::createPSFiles( const SCH_PLOT_SETTINGS& aPlotSettings,
|
||||||
if( !plotFileName.IsOk() )
|
if( !plotFileName.IsOk() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( plotOneSheetPS( plotFileName.GetFullPath(), screen, aRenderSettings, plotPage,
|
if( plotOneSheetPS( plotFileName.GetFullPath(), screen, aRenderSettings, actualPage,
|
||||||
plot_offset, scale, aPlotSettings ) )
|
plot_offset, scale, aPlotSettings ) )
|
||||||
{
|
{
|
||||||
if( aReporter )
|
if( aReporter )
|
||||||
|
@ -561,14 +562,37 @@ bool SCH_PLOTTER::plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScree
|
||||||
RENDER_SETTINGS* aRenderSettings,
|
RENDER_SETTINGS* aRenderSettings,
|
||||||
const SCH_PLOT_SETTINGS& aPlotSettings )
|
const SCH_PLOT_SETTINGS& aPlotSettings )
|
||||||
{
|
{
|
||||||
const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
|
PAGE_INFO plotPage;
|
||||||
|
// Adjust page size and scaling requests
|
||||||
|
const PAGE_INFO& actualPage = aScreen->GetPageSettings(); // page size selected in schematic
|
||||||
|
|
||||||
|
switch( aPlotSettings.m_pageSizeSelect )
|
||||||
|
{
|
||||||
|
case PAGE_SIZE_A:
|
||||||
|
plotPage.SetType( wxT( "A" ) );
|
||||||
|
plotPage.SetPortrait( actualPage.IsPortrait() );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PAGE_SIZE_A4:
|
||||||
|
plotPage.SetType( wxT( "A4" ) );
|
||||||
|
plotPage.SetPortrait( actualPage.IsPortrait() );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PAGE_SIZE_AUTO:
|
||||||
|
default:
|
||||||
|
plotPage = actualPage;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
SVG_PLOTTER* plotter = new SVG_PLOTTER();
|
SVG_PLOTTER* plotter = new SVG_PLOTTER();
|
||||||
plotter->SetRenderSettings( aRenderSettings );
|
plotter->SetRenderSettings( aRenderSettings );
|
||||||
plotter->SetPageSettings( pageInfo );
|
plotter->SetPageSettings( plotPage );
|
||||||
plotter->SetColorMode( aPlotSettings.m_blackAndWhite ? false : true );
|
plotter->SetColorMode( aPlotSettings.m_blackAndWhite ? false : true );
|
||||||
wxPoint plot_offset;
|
wxPoint plot_offset;
|
||||||
double scale = 1.0;
|
|
||||||
|
double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils();
|
||||||
|
double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils();
|
||||||
|
double scale = std::min( scalex, scaley );
|
||||||
|
|
||||||
// Currently, plot units are in decimil
|
// Currently, plot units are in decimil
|
||||||
plotter->SetViewport( plot_offset, schIUScale.IU_PER_MILS / 10, scale, false );
|
plotter->SetViewport( plot_offset, schIUScale.IU_PER_MILS / 10, scale, false );
|
||||||
|
@ -602,7 +626,7 @@ bool SCH_PLOTTER::plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScree
|
||||||
|
|
||||||
PlotDrawingSheet( plotter, &aScreen->Schematic()->Prj(),
|
PlotDrawingSheet( plotter, &aScreen->Schematic()->Prj(),
|
||||||
m_schematic->RootScreen()->GetTitleBlock(),
|
m_schematic->RootScreen()->GetTitleBlock(),
|
||||||
pageInfo, aScreen->Schematic()->GetProperties(), aScreen->GetPageNumber(),
|
actualPage, aScreen->Schematic()->GetProperties(), aScreen->GetPageNumber(),
|
||||||
aScreen->GetPageCount(), sheetName, sheetPath, aScreen->GetFileName(),
|
aScreen->GetPageCount(), sheetName, sheetPath, aScreen->GetFileName(),
|
||||||
plotter->GetColorMode() ? color : COLOR4D::BLACK,
|
plotter->GetColorMode() ? color : COLOR4D::BLACK,
|
||||||
aScreen->GetVirtualPageNumber() == 1 );
|
aScreen->GetVirtualPageNumber() == 1 );
|
||||||
|
@ -691,7 +715,7 @@ void SCH_PLOTTER::createHPGLFiles( const SCH_PLOT_SETTINGS& aPlotSettings,
|
||||||
|
|
||||||
LOCALE_IO toggle;
|
LOCALE_IO toggle;
|
||||||
|
|
||||||
if( plotOneSheetHpgl( plotFileName.GetFullPath(), screen, plotPage, aRenderSettings,
|
if( plotOneSheetHpgl( plotFileName.GetFullPath(), screen, curPage, aRenderSettings,
|
||||||
plotOffset, plot_scale, aPlotSettings ) )
|
plotOffset, plot_scale, aPlotSettings ) )
|
||||||
{
|
{
|
||||||
if( aReporter )
|
if( aReporter )
|
||||||
|
@ -803,6 +827,7 @@ bool SCH_PLOTTER::plotOneSheetHpgl( const wxString& aFileName,
|
||||||
aScreen->Plot( plotter );
|
aScreen->Plot( plotter );
|
||||||
|
|
||||||
plotter->EndPlot();
|
plotter->EndPlot();
|
||||||
|
|
||||||
delete plotter;
|
delete plotter;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue