KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_plotter.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 1992-2018 Jean-Pierre Charras jp.charras at wanadoo.fr
5 * Copyright (C) 1992-2010 Lorenzo Marcantonio
6 * Copyright (C) 2011 Wayne Stambaugh <[email protected]>
7 * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
27#include <wx/log.h>
28#include <common.h>
29#include <sch_plotter.h>
30#include <locale_io.h>
34
35#include <pgm_base.h>
36#include <trace_helpers.h>
37
38#include <sch_edit_frame.h>
39#include <sch_painter.h>
40#include <schematic.h>
41#include <sch_screen.h>
43
44
45static const wxChar* plot_sheet_list( HPGL_PAGE_SIZE aSize )
46{
47 switch( aSize )
48 {
49 default:
50 case HPGL_PAGE_SIZE::DEFAULT: return nullptr;
51 case HPGL_PAGE_SIZE::SIZE_A5: return wxT( "A5" );
52 case HPGL_PAGE_SIZE::SIZE_A4: return wxT( "A4" );
53 case HPGL_PAGE_SIZE::SIZE_A3: return wxT( "A3" );
54 case HPGL_PAGE_SIZE::SIZE_A2: return wxT( "A2" );
55 case HPGL_PAGE_SIZE::SIZE_A1: return wxT( "A1" );
56 case HPGL_PAGE_SIZE::SIZE_A0: return wxT( "A0" );
57 case HPGL_PAGE_SIZE::SIZE_A: return wxT( "A" );
58 case HPGL_PAGE_SIZE::SIZE_B: return wxT( "B" );
59 case HPGL_PAGE_SIZE::SIZE_C: return wxT( "C" );
60 case HPGL_PAGE_SIZE::SIZE_D: return wxT( "D" );
61 case HPGL_PAGE_SIZE::SIZE_E: return wxT( "E" );
62 }
63}
64
65
67 m_schFrame( nullptr ),
68 m_schematic( aSchematic )
69{
70 m_colorSettings = nullptr;
71}
72
73
75 m_schFrame( aFrame ),
76 m_schematic( &aFrame->Schematic() )
77{
78 m_colorSettings = nullptr;
79}
80
81
83 REPORTER* aReporter, const wxString& aExt )
84{
85 if( !aPlotSettings.m_outputFile.empty() )
86 return aPlotSettings.m_outputFile;
87 else
88 {
90
91 // The sub sheet can be in a sub_hierarchy, but we plot the file in the main
92 // project folder (or the folder specified by the caller), so replace separators
93 // to create a unique filename:
94 fname.Replace( "/", "_" );
95 fname.Replace( "\\", "_" );
96
97 return createPlotFileName( aPlotSettings, fname, aExt, aReporter );
98 }
99
100}
101
102
104 RENDER_SETTINGS* aRenderSettings, REPORTER* aReporter )
105{
106 SCH_SHEET_PATH oldsheetpath = m_schematic->CurrentSheet(); // sheetpath is saved here
107
108 /* When printing all pages, the printed page is not the current page. In complex hierarchies,
109 * we must update symbol references and other parameters in the given printed SCH_SCREEN,
110 * according to the sheet path because in complex hierarchies a SCH_SCREEN (a drawing ) is
111 * shared between many sheets and symbol references depend on the actual sheet path used.
112 */
113 SCH_SHEET_LIST sheetList;
114
115 if( aPlotSettings.m_plotAll )
116 {
117 sheetList.BuildSheetList( &m_schematic->Root(), true );
118 sheetList.SortByPageNumbers();
119 }
120 else
121 {
122 sheetList.push_back( m_schematic->CurrentSheet() );
123 }
124
125 // Allocate the plotter and set the job level parameter
126 PDF_PLOTTER* plotter = new PDF_PLOTTER();
127 plotter->SetRenderSettings( aRenderSettings );
128 plotter->SetColorMode( !aPlotSettings.m_blackAndWhite );
129 plotter->SetCreator( wxT( "Eeschema-PDF" ) );
131 &m_schematic->Prj() ) );
132
133 wxString msg;
134 wxFileName plotFileName;
135 LOCALE_IO toggle; // Switch the locale to standard C
136
137 for( unsigned i = 0; i < sheetList.size(); i++ )
138 {
139 if( m_schFrame )
140 m_schFrame->SetCurrentSheet( sheetList[i] );
141 else
142 m_schematic->SetCurrentSheet( sheetList[i] );
143
145
147
149
150 if( i == 0 )
151 {
152 try
153 {
155 plotFileName = getOutputFilenameSingle( aPlotSettings, aReporter, ext );
156
157 m_lastOutputFilePath = plotFileName.GetFullPath();
158
159 if( !plotFileName.IsOk() )
160 return;
161
162 if( !plotter->OpenFile( plotFileName.GetFullPath() ) )
163 {
164 if( aReporter )
165 {
166 msg.Printf( _( "Failed to create file '%s'." ),
167 plotFileName.GetFullPath() );
168 aReporter->Report( msg, RPT_SEVERITY_ERROR );
169 }
170 delete plotter;
171 return;
172 }
173
174 // Open the plotter and do the first page
175 setupPlotPagePDF( plotter, screen, aPlotSettings );
176 plotter->StartPlot( sheetList[i].GetPageNumber(), _( "Root" ) );
177 }
178 catch( const IO_ERROR& e )
179 {
180 // Cannot plot PDF file
181 if( aReporter )
182 {
183 msg.Printf( wxT( "PDF Plotter exception: %s" ), e.What() );
184 aReporter->Report( msg, RPT_SEVERITY_ERROR );
185 }
186
187 restoreEnvironment( plotter, oldsheetpath );
188 return;
189 }
190 }
191 else
192 {
193 /* For the following pages you need to close the (finished) page,
194 * reconfigure, and then start a new one */
195 plotter->ClosePage();
196 setupPlotPagePDF( plotter, screen, aPlotSettings );
197 plotter->StartPage( sheetList[i].GetPageNumber(),
198 sheetList[i].Last()->GetFields()[SHEETNAME].GetShownText( false ) );
199 }
200
201 plotOneSheetPDF( plotter, screen, aPlotSettings );
202 }
203
204 // Everything done, close the plot and restore the environment
205 if( aReporter )
206 {
207 msg.Printf( _( "Plotted to '%s'.\n" ), plotFileName.GetFullPath() );
208 aReporter->Report( msg, RPT_SEVERITY_ACTION );
209 aReporter->ReportTail( _( "Done." ), RPT_SEVERITY_INFO );
210 }
211
212 restoreEnvironment( plotter, oldsheetpath );
213}
214
215
217 const SCH_PLOT_SETTINGS& aPlotSettings )
218{
219 if( aPlotSettings.m_useBackgroundColor && aPlotter->GetColorMode() )
220 {
221 aPlotter->SetColor( aPlotter->RenderSettings()->GetBackgroundColor() );
224 aPlotter->Rect( VECTOR2I( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 );
225 }
226
227 if( aPlotSettings.m_plotDrawingSheet )
228 {
229 COLOR4D color = COLOR4D::BLACK;
230
231 if( aPlotter->GetColorMode() )
233
234 wxString sheetName = m_schematic->CurrentSheet().Last()->GetName();
235 wxString sheetPath = m_schematic->CurrentSheet().PathHumanReadable();
236 const PAGE_INFO& actualPage = aScreen->GetPageSettings(); // page size selected in schematic
237
238 PlotDrawingSheet( aPlotter, &aScreen->Schematic()->Prj(),
239 aScreen->GetTitleBlock(),
240 actualPage,
241 aScreen->Schematic()->GetProperties(),
242 aScreen->GetPageNumber(), aScreen->GetPageCount(), sheetName, sheetPath,
243 aScreen->GetFileName(), color, aScreen->GetVirtualPageNumber() == 1 );
244 }
245
246 aScreen->Plot( aPlotter );
247}
248
249
251 const SCH_PLOT_SETTINGS& aPlotSettings )
252{
253 PAGE_INFO plotPage; // page size selected to plot
254
255 // Considerations on page size and scaling requests
256 const PAGE_INFO& actualPage = aScreen->GetPageSettings(); // page size selected in schematic
257
258 switch( aPlotSettings.m_pageSizeSelect )
259 {
260 case PAGE_SIZE_A:
261 plotPage.SetType( wxT( "A" ) );
262 plotPage.SetPortrait( actualPage.IsPortrait() );
263 break;
264
265 case PAGE_SIZE_A4:
266 plotPage.SetType( wxT( "A4" ) );
267 plotPage.SetPortrait( actualPage.IsPortrait() );
268 break;
269
270 case PAGE_SIZE_AUTO:
271 default:
272 plotPage = actualPage;
273 break;
274 }
275
276 double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils();
277 double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils();
278 double scale = std::min( scalex, scaley );
279 aPlotter->SetPageSettings( plotPage );
280
281 // Currently, plot units are in decimil
282 aPlotter->SetViewport( VECTOR2I( 0, 0 ), schIUScale.IU_PER_MILS / 10, scale, false );
283}
284
285
287 RENDER_SETTINGS* aRenderSettings, REPORTER* aReporter )
288{
289 SCH_SHEET_PATH oldsheetpath = m_schematic->CurrentSheet(); // sheetpath is saved here
290 PAGE_INFO plotPage; // page size selected to plot
291 wxString msg;
292
293 /* When printing all pages, the printed page is not the current page.
294 * In complex hierarchies, we must update symbol references and other parameters in the
295 * given printed SCH_SCREEN, accordant to the sheet path because in complex hierarchies
296 * a SCH_SCREEN (a drawing ) is shared between many sheets and symbol references
297 * depend on the actual sheet path used.
298 */
299 SCH_SHEET_LIST sheetList;
300
301 if( aPlotSettings.m_plotAll )
302 {
303 sheetList.BuildSheetList( &m_schematic->Root(), true );
304 sheetList.SortByPageNumbers();
305 }
306 else
307 {
308 sheetList.push_back( m_schematic->CurrentSheet() );
309 }
310
311 for( unsigned i = 0; i < sheetList.size(); i++ )
312 {
313 if( m_schFrame )
314 m_schFrame->SetCurrentSheet( sheetList[i] );
315 else
316 m_schematic->SetCurrentSheet( sheetList[i] );
317
319
321
323 PAGE_INFO actualPage = screen->GetPageSettings();
324
325 switch( aPlotSettings.m_pageSizeSelect )
326 {
327 case PAGE_SIZE_A:
328 plotPage.SetType( wxT( "A" ) );
329 plotPage.SetPortrait( actualPage.IsPortrait() );
330 break;
331
332 case PAGE_SIZE_A4:
333 plotPage.SetType( wxT( "A4" ) );
334 plotPage.SetPortrait( actualPage.IsPortrait() );
335 break;
336
337 case PAGE_SIZE_AUTO:
338 default: plotPage = actualPage; break;
339 }
340
341 double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils();
342 double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils();
343 double scale = std::min( scalex, scaley );
344 VECTOR2I plot_offset;
345
346 try
347 {
349
350 // The sub sheet can be in a sub_hierarchy, but we plot the file in the
351 // main project folder (or the folder specified by the caller),
352 // so replace separators to create a unique filename:
353 fname.Replace( "/", "_" );
354 fname.Replace( "\\", "_" );
356 wxFileName plotFileName = createPlotFileName( aPlotSettings, fname, ext, aReporter );
357
358 m_lastOutputFilePath = plotFileName.GetFullPath();
359
360 if( !plotFileName.IsOk() )
361 return;
362
363 if( plotOneSheetPS( plotFileName.GetFullPath(), screen, aRenderSettings, actualPage,
364 plot_offset, scale, aPlotSettings ) )
365 {
366 if( aReporter )
367 {
368 msg.Printf( _( "Plotted to '%s'." ), plotFileName.GetFullPath() );
369 aReporter->Report( msg, RPT_SEVERITY_ACTION );
370 }
371 }
372 else
373 {
374 if( aReporter )
375 {
376 // Error
377 msg.Printf( _( "Failed to create file '%s'." ), plotFileName.GetFullPath() );
378 aReporter->Report( msg, RPT_SEVERITY_ERROR );
379 }
380 }
381 }
382 catch( IO_ERROR& e )
383 {
384 if( aReporter )
385 {
386 msg.Printf( wxT( "PS Plotter exception: %s" ), e.What() );
387 aReporter->Report( msg, RPT_SEVERITY_ERROR );
388 }
389 }
390 }
391
392 if( aReporter )
393 {
394 aReporter->ReportTail( _( "Done." ), RPT_SEVERITY_INFO );
395 }
396
397 if( m_schFrame )
398 m_schFrame->SetCurrentSheet( oldsheetpath );
399 else
400 m_schematic->SetCurrentSheet( oldsheetpath );
401
403
405}
406
407
408bool SCH_PLOTTER::plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen,
409 RENDER_SETTINGS* aRenderSettings,
410 const PAGE_INFO& aPageInfo, const VECTOR2I& aPlot0ffset,
411 double aScale, const SCH_PLOT_SETTINGS& aPlotSettings )
412{
413 PS_PLOTTER* plotter = new PS_PLOTTER();
414 plotter->SetRenderSettings( aRenderSettings );
415 plotter->SetPageSettings( aPageInfo );
416 plotter->SetColorMode( !aPlotSettings.m_blackAndWhite );
417
418 // Currently, plot units are in decimil
419 plotter->SetViewport( aPlot0ffset, schIUScale.IU_PER_MILS / 10, aScale, false );
420
421 // Init :
422 plotter->SetCreator( wxT( "Eeschema-PS" ) );
423
424 if( !plotter->OpenFile( aFileName ) )
425 {
426 delete plotter;
427 return false;
428 }
429
430 LOCALE_IO toggle; // Switch the locale to standard C
431
433
434 if( aPlotSettings.m_useBackgroundColor && plotter->GetColorMode() )
435 {
437
440 plotter->Rect( VECTOR2I( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 );
441 }
442
443 if( aPlotSettings.m_plotDrawingSheet )
444 {
445 wxString sheetName = m_schematic->CurrentSheet().Last()->GetName();
446 wxString sheetPath = m_schematic->CurrentSheet().PathHumanReadable();
448
449 PlotDrawingSheet( plotter, &aScreen->Schematic()->Prj(),
450 aScreen->GetTitleBlock(),
451 aPageInfo, aScreen->Schematic()->GetProperties(),
452 aScreen->GetPageNumber(), aScreen->GetPageCount(), sheetName, sheetPath,
453 aScreen->GetFileName(), plotter->GetColorMode() ? color : COLOR4D::BLACK,
454 aScreen->GetVirtualPageNumber() == 1 );
455 }
456
457 aScreen->Plot( plotter );
458
459 plotter->EndPlot();
460 delete plotter;
461
462 return true;
463}
464
465
467 RENDER_SETTINGS* aRenderSettings, REPORTER* aReporter )
468{
469 wxString msg;
470 SCH_SHEET_PATH oldsheetpath = m_schematic->CurrentSheet();
471 SCH_SHEET_LIST sheetList;
472
473 if( aPlotSettings.m_plotAll )
474 {
475 sheetList.BuildSheetList( &m_schematic->Root(), true );
476 sheetList.SortByPageNumbers();
477 }
478 else
479 {
480 sheetList.push_back( m_schematic->CurrentSheet() );
481 }
482
483 for( unsigned i = 0; i < sheetList.size(); i++ )
484 {
485 SCH_SCREEN* screen;
486 if( m_schFrame )
487 m_schFrame->SetCurrentSheet( sheetList[i] );
488 else
489 m_schematic->SetCurrentSheet( sheetList[i] );
490
492
494
495 screen = m_schematic->CurrentSheet().LastScreen();
496
497 try
498 {
500
501 // The sub sheet can be in a sub_hierarchy, but we plot the file in the
502 // main project folder (or the folder specified by the caller),
503 // so replace separators to create a unique filename:
504 fname.Replace( "/", "_" );
505 fname.Replace( "\\", "_" );
507 wxFileName plotFileName = createPlotFileName( aPlotSettings, fname, ext, aReporter );
508
509 m_lastOutputFilePath = plotFileName.GetFullPath();
510
511 if( !plotFileName.IsOk() )
512 return;
513
514 bool success = plotOneSheetSVG( plotFileName.GetFullPath(), screen, aRenderSettings,
515 aPlotSettings );
516
517 if( !success )
518 {
519 if( aReporter )
520 {
521 msg.Printf( _( "Failed to create file '%s'." ), plotFileName.GetFullPath() );
522 aReporter->Report( msg, RPT_SEVERITY_ERROR );
523 }
524 }
525 else
526 {
527 if( aReporter )
528 {
529 msg.Printf( _( "Plotted to '%s'." ), plotFileName.GetFullPath() );
530 aReporter->Report( msg, RPT_SEVERITY_ACTION );
531 }
532 }
533 }
534 catch( const IO_ERROR& e )
535 {
536 if( aReporter )
537 {
538 // Cannot plot SVG file
539 msg.Printf( wxT( "SVG Plotter exception: %s" ), e.What() );
540 aReporter->Report( msg, RPT_SEVERITY_ERROR );
541 }
542 break;
543 }
544 }
545
546 if( aReporter )
547 {
548 aReporter->ReportTail( _( "Done" ), RPT_SEVERITY_INFO );
549 }
550
551 if( m_schFrame )
552 m_schFrame->SetCurrentSheet( oldsheetpath );
553 else
554 m_schematic->SetCurrentSheet( oldsheetpath );
555
557
559}
560
561
562bool SCH_PLOTTER::plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScreen,
563 RENDER_SETTINGS* aRenderSettings,
564 const SCH_PLOT_SETTINGS& aPlotSettings )
565{
566 PAGE_INFO plotPage;
567 // Adjust page size and scaling requests
568 const PAGE_INFO& actualPage = aScreen->GetPageSettings(); // page size selected in schematic
569
570 switch( aPlotSettings.m_pageSizeSelect )
571 {
572 case PAGE_SIZE_A:
573 plotPage.SetType( wxT( "A" ) );
574 plotPage.SetPortrait( actualPage.IsPortrait() );
575 break;
576
577 case PAGE_SIZE_A4:
578 plotPage.SetType( wxT( "A4" ) );
579 plotPage.SetPortrait( actualPage.IsPortrait() );
580 break;
581
582 case PAGE_SIZE_AUTO:
583 default:
584 plotPage = actualPage;
585 break;
586 }
587
588 SVG_PLOTTER* plotter = new SVG_PLOTTER();
589 plotter->SetRenderSettings( aRenderSettings );
590 plotter->SetPageSettings( plotPage );
591 plotter->SetColorMode( aPlotSettings.m_blackAndWhite ? false : true );
592 VECTOR2I plot_offset;
593
594 double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils();
595 double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils();
596 double scale = std::min( scalex, scaley );
597
598 // Currently, plot units are in decimil
599 plotter->SetViewport( plot_offset, schIUScale.IU_PER_MILS / 10, scale, false );
600
601 // Init :
602 plotter->SetCreator( wxT( "Eeschema-SVG" ) );
603
604 if( !plotter->OpenFile( aFileName ) )
605 {
606 delete plotter;
607 return false;
608 }
609
610 LOCALE_IO toggle;
611
613
614 if( aPlotSettings.m_useBackgroundColor && plotter->GetColorMode() )
615 {
619 plotter->Rect( VECTOR2I( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 );
620 }
621
622 if( aPlotSettings.m_plotDrawingSheet )
623 {
624 wxString sheetName = m_schematic->CurrentSheet().Last()->GetName();
625 wxString sheetPath = m_schematic->CurrentSheet().PathHumanReadable();
627
628 PlotDrawingSheet( plotter, &aScreen->Schematic()->Prj(),
629 aScreen->GetTitleBlock(),
630 actualPage, aScreen->Schematic()->GetProperties(), aScreen->GetPageNumber(),
631 aScreen->GetPageCount(), sheetName, sheetPath, aScreen->GetFileName(),
632 plotter->GetColorMode() ? color : COLOR4D::BLACK,
633 aScreen->GetVirtualPageNumber() == 1 );
634 }
635
636 aScreen->Plot( plotter );
637
638 plotter->EndPlot();
639 delete plotter;
640
641 return true;
642}
643
644
646 RENDER_SETTINGS* aRenderSettings, REPORTER* aReporter )
647{
648 SCH_SCREEN* screen = m_schematic->RootScreen();
649 SCH_SHEET_PATH oldsheetpath = m_schematic->CurrentSheet();
650
651 /* When printing all pages, the printed page is not the current page. In complex hierarchies,
652 * we must update symbol references and other parameters in the given printed SCH_SCREEN,
653 * according to the sheet path because in complex hierarchies a SCH_SCREEN (a drawing ) is
654 * shared between many sheets and symbol references depend on the actual sheet path used.
655 */
656 SCH_SHEET_LIST sheetList;
657
658 if( aPlotSettings.m_plotAll )
659 {
660 sheetList.BuildSheetList( &m_schematic->Root(), true );
661 sheetList.SortByPageNumbers();
662 }
663 else
664 {
665 sheetList.push_back( m_schematic->CurrentSheet() );
666 }
667
668 for( unsigned i = 0; i < sheetList.size(); i++ )
669 {
670 if( m_schFrame )
671 m_schFrame->SetCurrentSheet( sheetList[i] );
672 else
673 m_schematic->SetCurrentSheet( sheetList[i] );
675
677
678 screen = m_schematic->CurrentSheet().LastScreen();
679
680 if( !screen ) // LastScreen() may return NULL
681 screen = m_schematic->RootScreen();
682
683 const PAGE_INFO& curPage = screen->GetPageSettings();
684
685 PAGE_INFO plotPage = curPage;
686
687 // if plotting on a page size other than curPage
688 plotPage.SetType( plot_sheet_list( aPlotSettings.m_HPGLPaperSizeSelect ) );
689
690 // Calculation of conversion scales.
691 double plot_scale = (double) plotPage.GetWidthMils() / curPage.GetWidthMils();
692
693 // Calculate offsets
694 VECTOR2I plotOffset;
695 wxString msg;
696
697 if( aPlotSettings.m_HPGLPlotOrigin == HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_CENTER )
698 {
699 plotOffset.x = plotPage.GetWidthIU( schIUScale.IU_PER_MILS ) / 2;
700 plotOffset.y = -plotPage.GetHeightIU( schIUScale.IU_PER_MILS ) / 2;
701 }
702
703 try
704 {
706 // The sub sheet can be in a sub_hierarchy, but we plot the file in the
707 // main project folder (or the folder specified by the caller),
708 // so replace separators to create a unique filename:
709 fname.Replace( "/", "_" );
710 fname.Replace( "\\", "_" );
712 wxFileName plotFileName = createPlotFileName( aPlotSettings, fname, ext, aReporter );
713
714 if( !plotFileName.IsOk() )
715 return;
716
717 LOCALE_IO toggle;
718
719 if( plotOneSheetHpgl( plotFileName.GetFullPath(), screen, curPage, aRenderSettings,
720 plotOffset, plot_scale, aPlotSettings ) )
721 {
722 if( aReporter )
723 {
724 msg.Printf( _( "Plotted to '%s'." ), plotFileName.GetFullPath() );
725 aReporter->Report( msg, RPT_SEVERITY_ACTION );
726 }
727 }
728 else
729 {
730 if( aReporter )
731 {
732 msg.Printf( _( "Failed to create file '%s'." ), plotFileName.GetFullPath() );
733 aReporter->Report( msg, RPT_SEVERITY_ERROR );
734 }
735 }
736 }
737 catch( IO_ERROR& e )
738 {
739 if( aReporter )
740 {
741 msg.Printf( wxT( "HPGL Plotter exception: %s" ), e.What() );
742 aReporter->Report( msg, RPT_SEVERITY_ERROR );
743 }
744 }
745 }
746
747 if( aReporter )
748 {
749 aReporter->ReportTail( _( "Done." ), RPT_SEVERITY_INFO );
750 }
751
752 if( m_schFrame )
753 m_schFrame->SetCurrentSheet( oldsheetpath );
754 else
755 m_schematic->SetCurrentSheet( oldsheetpath );
756
758
760}
761
762
763bool SCH_PLOTTER::plotOneSheetHpgl( const wxString& aFileName,
764 SCH_SCREEN* aScreen,
765 const PAGE_INFO& aPageInfo,
766 RENDER_SETTINGS* aRenderSettings,
767 const VECTOR2I& aPlot0ffset,
768 double aScale,
769 const SCH_PLOT_SETTINGS& aPlotSettings )
770{
771 HPGL_PLOTTER* plotter = new HPGL_PLOTTER();
772 // Currently, plot units are in decimil
773
774 plotter->SetPageSettings( aPageInfo );
775 plotter->SetRenderSettings( aRenderSettings );
777 plotter->SetColorMode( !aPlotSettings.m_blackAndWhite );
778 plotter->SetViewport( aPlot0ffset, schIUScale.IU_PER_MILS/10, aScale, false );
779
780 // TODO this could be configurable
781 plotter->SetTargetChordLength( schIUScale.mmToIU( 0.6 ) );
782
783 switch( aPlotSettings.m_HPGLPlotOrigin )
784 {
785 case HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_BOT_LEFT:
786 case HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_CENTER:
787 default:
788 plotter->SetUserCoords( false );
789 break;
790 case HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_PAGE:
791 plotter->SetUserCoords( true );
792 plotter->SetUserCoordsFit( false );
793 break;
794 case HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_CONTENT:
795 plotter->SetUserCoords( true );
796 plotter->SetUserCoordsFit( true );
797 break;
798 }
799
800 // Init :
801 plotter->SetCreator( wxT( "Eeschema-HPGL" ) );
802
803 if( !plotter->OpenFile( aFileName ) )
804 {
805 delete plotter;
806 return false;
807 }
808
809 LOCALE_IO toggle;
810
811 // Pen num and pen speed are not initialized here.
812 // Default HPGL driver values are used
813 plotter->SetPenDiameter( aPlotSettings.m_HPGLPenSize );
815
816 if( aPlotSettings.m_plotDrawingSheet )
817 {
818 wxString sheetName = m_schematic->CurrentSheet().Last()->GetName();
819 wxString sheetPath = m_schematic->CurrentSheet().PathHumanReadable();
820
821 PlotDrawingSheet( plotter, &m_schematic->Prj(),
822 aScreen->GetTitleBlock(),
823 aPageInfo,
824 aScreen->Schematic()->GetProperties(), aScreen->GetPageNumber(),
825 aScreen->GetPageCount(), sheetName, sheetPath, aScreen->GetFileName(),
826 COLOR4D::BLACK, aScreen->GetVirtualPageNumber() == 1 );
827 }
828
829 aScreen->Plot( plotter );
830
831 plotter->EndPlot();
832
833 delete plotter;
834
835 return true;
836}
837
838
840 RENDER_SETTINGS* aRenderSettings, REPORTER* aReporter )
841{
842 SCH_SHEET_PATH oldsheetpath = m_schematic->CurrentSheet();
843
844 /* When printing all pages, the printed page is not the current page. In complex hierarchies,
845 * we must update symbol references and other parameters in the given printed SCH_SCREEN,
846 * according to the sheet path because in complex hierarchies a SCH_SCREEN (a drawing ) is
847 * shared between many sheets and symbol references depend on the actual sheet path used.
848 */
849 SCH_SHEET_LIST sheetList;
850
851 if( aPlotSettings.m_plotAll )
852 {
853 sheetList.BuildSheetList( &m_schematic->Root(), true );
854 sheetList.SortByPageNumbers();
855 }
856 else
857 {
858 sheetList.push_back( m_schematic->CurrentSheet() );
859 }
860
861 for( unsigned i = 0; i < sheetList.size(); i++ )
862 {
863 if( m_schFrame )
864 m_schFrame->SetCurrentSheet( sheetList[i] );
865 else
866 m_schematic->SetCurrentSheet( sheetList[i] );
868
870
872 VECTOR2I plot_offset;
873 wxString msg;
874
875 try
876 {
878
879 // The sub sheet can be in a sub_hierarchy, but we plot the file in the
880 // main project folder (or the folder specified by the caller),
881 // so replace separators to create a unique filename:
882 fname.Replace( "/", "_" );
883 fname.Replace( "\\", "_" );
885 wxFileName plotFileName = createPlotFileName( aPlotSettings, fname, ext, aReporter );
886
887 m_lastOutputFilePath = plotFileName.GetFullPath();
888
889 if( !plotFileName.IsOk() )
890 return;
891
892 if( plotOneSheetDXF( plotFileName.GetFullPath(), screen, aRenderSettings, plot_offset,
893 1.0, aPlotSettings ) )
894 {
895 if( aReporter )
896 {
897 msg.Printf( _( "Plotted to '%s'." ), plotFileName.GetFullPath() );
898 aReporter->Report( msg, RPT_SEVERITY_ACTION );
899 }
900 }
901 else // Error
902 {
903 if( aReporter )
904 {
905 msg.Printf( _( "Failed to create file '%s'." ), plotFileName.GetFullPath() );
906 aReporter->Report( msg, RPT_SEVERITY_ERROR );
907 }
908 }
909 }
910 catch( IO_ERROR& e )
911 {
912 if( aReporter )
913 {
914 msg.Printf( wxT( "DXF Plotter exception: %s" ), e.What() );
915 aReporter->Report( msg, RPT_SEVERITY_ERROR );
916 }
917
918 if( m_schFrame )
919 m_schFrame->SetCurrentSheet( oldsheetpath );
920 else
921 m_schematic->SetCurrentSheet( oldsheetpath );
922
924
926 return;
927 }
928 }
929
930 if( aReporter )
931 aReporter->ReportTail( _( "Done." ), RPT_SEVERITY_INFO );
932
933 if( m_schFrame )
934 m_schFrame->SetCurrentSheet( oldsheetpath );
935 else
936 m_schematic->SetCurrentSheet( oldsheetpath );
937
939
941}
942
943
944bool SCH_PLOTTER::plotOneSheetDXF( const wxString& aFileName, SCH_SCREEN* aScreen,
945 RENDER_SETTINGS* aRenderSettings, const VECTOR2I& aPlotOffset,
946 double aScale, const SCH_PLOT_SETTINGS& aPlotSettings )
947{
948 aRenderSettings->LoadColors( m_colorSettings );
949 aRenderSettings->SetDefaultPenWidth( 0 );
950
951 const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
952 DXF_PLOTTER* plotter = new DXF_PLOTTER();
953
954 plotter->SetRenderSettings( aRenderSettings );
955 plotter->SetPageSettings( pageInfo );
956 plotter->SetColorMode( !aPlotSettings.m_blackAndWhite );
957
958 // Currently, plot units are in decimil
959 plotter->SetViewport( aPlotOffset, schIUScale.IU_PER_MILS / 10, aScale, false );
960
961 // Init :
962 plotter->SetCreator( wxT( "Eeschema-DXF" ) );
963
964 if( !plotter->OpenFile( aFileName ) )
965 {
966 delete plotter;
967 return false;
968 }
969
970 LOCALE_IO toggle;
971
973
974 if( aPlotSettings.m_plotDrawingSheet )
975 {
976 wxString sheetName = m_schematic->CurrentSheet().Last()->GetName();
977 wxString sheetPath = m_schematic->CurrentSheet().PathHumanReadable();
979
980 PlotDrawingSheet( plotter, &m_schematic->Prj(),
981 aScreen->GetTitleBlock(),
982 pageInfo,
983 aScreen->Schematic()->GetProperties(), aScreen->GetPageNumber(),
984 aScreen->GetPageCount(), sheetName, sheetPath, aScreen->GetFileName(),
985 plotter->GetColorMode() ? color : COLOR4D::BLACK,
986 aScreen->GetVirtualPageNumber() == 1 );
987 }
988
989 aScreen->Plot( plotter );
990
991 // finish
992 plotter->EndPlot();
993 delete plotter;
994
995 return true;
996}
997
998
1000{
1001 aPlotter->EndPlot();
1002 delete aPlotter;
1003
1004 // Restore the previous sheet
1005 if( m_schFrame )
1006 m_schFrame->SetCurrentSheet( aOldsheetpath );
1007 else
1008 m_schematic->SetCurrentSheet( aOldsheetpath );
1009
1011
1013}
1014
1015
1017 const wxString& aPlotFileName,
1018 const wxString& aExtension, REPORTER* aReporter )
1019{
1020 wxFileName retv;
1021 wxFileName tmp;
1022
1023 tmp.SetPath( aPlotSettings.m_outputDirectory );
1024 retv.SetPath( tmp.GetPath() );
1025
1026 if( !aPlotFileName.IsEmpty() )
1027 retv.SetName( aPlotFileName );
1028 else
1029 retv.SetName( _( "Schematic" ) );
1030
1031 retv.SetExt( aExtension );
1032
1033 if( !EnsureFileDirectoryExists( &tmp, retv.GetFullName(), aReporter ) || !tmp.IsDirWritable() )
1034 {
1035 if( aReporter )
1036 {
1037 wxString msg = wxString::Format( _( "Failed to write plot files to folder '%s'." ),
1038 tmp.GetPath() );
1039 aReporter->Report( msg, RPT_SEVERITY_ERROR );
1040 }
1041 retv.Clear();
1042
1044 settings.m_PlotDirectoryName.Clear();
1045 }
1046 else
1047 {
1048 retv.SetPath( tmp.GetPath() );
1049 }
1050
1051 wxLogTrace( tracePathsAndFiles, "Writing plot file '%s'.", retv.GetFullPath() );
1052
1053 return retv;
1054}
1055
1056
1057void SCH_PLOTTER::Plot( PLOT_FORMAT aPlotFormat, const SCH_PLOT_SETTINGS& aPlotSettings,
1058 RENDER_SETTINGS* aRenderSettings, REPORTER* aReporter )
1059{
1060 SETTINGS_MANAGER& settingsMgr = Pgm().GetSettingsManager();
1061
1062 m_colorSettings = settingsMgr.GetColorSettings( aPlotSettings.m_theme );
1063
1064 switch( aPlotFormat )
1065 {
1066 default:
1067 case PLOT_FORMAT::POST: createPSFiles( aPlotSettings, aRenderSettings, aReporter ); break;
1068 case PLOT_FORMAT::DXF: createDXFFiles( aPlotSettings, aRenderSettings, aReporter ); break;
1069 case PLOT_FORMAT::PDF: createPDFFile( aPlotSettings, aRenderSettings, aReporter ); break;
1070 case PLOT_FORMAT::SVG: createSVGFiles( aPlotSettings, aRenderSettings, aReporter ); break;
1071 case PLOT_FORMAT::HPGL: createHPGLFiles( aPlotSettings, aRenderSettings, aReporter ); break;
1072 }
1073}
int color
Definition: DXF_plotter.cpp:57
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
int GetPageCount() const
Definition: base_screen.h:72
int GetVirtualPageNumber() const
Definition: base_screen.h:75
const wxString & GetPageNumber() const
Definition: base_screen.cpp:71
static wxString GetDefaultFileExtension()
Definition: plotter_dxf.h:47
virtual void SetViewport(const VECTOR2I &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the scale/position for the DXF plot.
virtual bool StartPlot(const wxString &aPageNumber) override
Open the DXF plot with a skeleton header.
virtual bool EndPlot() override
void SetUserCoordsFit(bool user_coords_fit)
Set whether the user coordinate system is fit to content.
Definition: plotter_hpgl.h:59
void SetTargetChordLength(double chord_len)
Set the target length of chords used to draw approximated circles and arcs.
static wxString GetDefaultFileExtension()
Definition: plotter_hpgl.h:43
void SetUserCoords(bool user_coords)
Switch to the user coordinate system.
Definition: plotter_hpgl.h:56
virtual bool StartPlot(const wxString &aPageNumber) override
At the start of the HPGL plot pen speed and number are requested.
virtual void SetViewport(const VECTOR2I &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
virtual void SetPenDiameter(double diameter)
virtual bool EndPlot() override
HPGL end of plot: sort and emit graphics, pen return and release.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
void SetDefaultPenWidth(int aWidth)
virtual void LoadColors(const COLOR_SETTINGS *aSettings)
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
virtual const COLOR4D & GetBackgroundColor() const =0
Return current background color settings.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:41
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
void SetPortrait(bool aIsPortrait)
Rotate the paper page 90 degrees.
Definition: page_info.cpp:188
int GetHeightIU(double aIUScale) const
Gets the page height in IU.
Definition: page_info.h:153
int GetHeightMils() const
Definition: page_info.h:133
int GetWidthMils() const
Definition: page_info.h:130
int GetWidthIU(double aIUScale) const
Gets the page width in IU.
Definition: page_info.h:144
bool IsPortrait() const
Definition: page_info.h:117
bool SetType(const wxString &aStandardPageDescriptionName, bool aIsPortrait=false)
Set the name of the page type and also the sizes and margins commonly associated with that type name.
Definition: page_info.cpp:121
virtual void StartPage(const wxString &aPageNumber, const wxString &aPageName=wxEmptyString)
Start a new page in the PDF document.
virtual void ClosePage()
Close the current page in the PDF document (and emit its compressed stream).
virtual bool EndPlot() override
virtual bool OpenFile(const wxString &aFullFilename) override
Open or create the plot file aFullFilename.
virtual bool StartPlot(const wxString &aPageNumber) override
The PDF engine supports multiple pages; the first one is opened 'for free' the following are to be cl...
static wxString GetDefaultFileExtension()
Base plotter engine class.
Definition: plotter.h:110
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
Definition: plotter.cpp:74
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: plotter.h:143
void SetRenderSettings(RENDER_SETTINGS *aSettings)
Definition: plotter.h:140
virtual void SetTitle(const wxString &aTitle)
Definition: plotter.h:161
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:141
virtual void SetCreator(const wxString &aCreator)
Definition: plotter.h:159
bool GetColorMode() const
Definition: plotter.h:138
PAGE_INFO & PageSettings()
Definition: plotter.h:144
virtual void SetViewport(const VECTOR2I &aOffset, double aIusPerDecimil, double aScale, bool aMirror)=0
Set the plot offset and scaling for the current plot.
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
Definition: plotter.h:137
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
virtual void SetColor(const COLOR4D &color)=0
virtual void SetColor(const COLOR4D &color) override
The SetColor implementation is split with the subclasses: The PSLIKE computes the rgb values,...
Definition: PS_plotter.cpp:62
virtual bool EndPlot() override
Definition: PS_plotter.cpp:926
virtual void SetViewport(const VECTOR2I &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
Definition: PS_plotter.cpp:384
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
Definition: PS_plotter.cpp:546
virtual bool StartPlot(const wxString &aPageNumber) override
The code within this function (and the CloseFilePS function) creates postscript files whose contents ...
Definition: PS_plotter.cpp:765
static wxString GetDefaultFileExtension()
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:71
virtual REPORTER & ReportTail(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Places the report at the end of the list, for objects that support report ordering.
Definition: reporter.h:99
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
These settings were stored in SCH_BASE_FRAME previously.
Holds all the data relating to one schematic.
Definition: schematic.h:72
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:133
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:205
void SetCurrentSheet(const SCH_SHEET_PATH &aPath) override
Definition: schematic.h:138
SCH_SCREEN * RootScreen() const
Helper to retrieve the screen of the root sheet.
Definition: schematic.cpp:122
const std::map< wxString, wxString > * GetProperties()
Definition: schematic.h:90
SCH_SHEET & Root() const
Definition: schematic.h:102
wxString GetUniqueFilenameForCurrentSheet()
Definition: schematic.cpp:523
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
Definition: schematic.cpp:539
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
Definition: schematic.h:87
Schematic editor (Eeschema) main window.
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
void createSVGFiles(const SCH_PLOT_SETTINGS &aPlotSettings, RENDER_SETTINGS *aRenderSettings, REPORTER *aReporter)
void createDXFFiles(const SCH_PLOT_SETTINGS &aPlotSettings, RENDER_SETTINGS *aRenderSettings, REPORTER *aReporter)
void createPSFiles(const SCH_PLOT_SETTINGS &aPlotSettings, RENDER_SETTINGS *aRenderSettings, REPORTER *aReporter)
wxFileName getOutputFilenameSingle(const SCH_PLOT_SETTINGS &aPlotSettings, REPORTER *aReporter, const wxString &ext)
Returns the output filename for formats where the output is a single file.
Definition: sch_plotter.cpp:82
wxFileName createPlotFileName(const SCH_PLOT_SETTINGS &aPlotSettings, const wxString &aPlotFileName, const wxString &aExtension, REPORTER *aReporter=nullptr)
Create a file name with an absolute path name.
bool plotOneSheetHpgl(const wxString &aFileName, SCH_SCREEN *aScreen, const PAGE_INFO &aPageInfo, RENDER_SETTINGS *aRenderSettings, const VECTOR2I &aPlot0ffset, double aScale, const SCH_PLOT_SETTINGS &aPlotSettings)
SCH_PLOTTER(SCH_EDIT_FRAME *aFrame)
Constructor for usage with a frame having the schematic we want to print loaded.
Definition: sch_plotter.cpp:74
bool plotOneSheetDXF(const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, const VECTOR2I &aPlotOffset, double aScale, const SCH_PLOT_SETTINGS &aPlotSettings)
bool plotOneSheetSVG(const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, const SCH_PLOT_SETTINGS &aPlotSettings)
void Plot(PLOT_FORMAT aPlotFormat, const SCH_PLOT_SETTINGS &aPlotSettings, RENDER_SETTINGS *aRenderSettings, REPORTER *aReporter=nullptr)
Perform the plotting of the schematic using the given aPlotFormat and aPlotSettings.
wxString m_lastOutputFilePath
Definition: sch_plotter.h:219
void restoreEnvironment(PDF_PLOTTER *aPlotter, SCH_SHEET_PATH &aOldsheetpath)
Everything done, close the plot and restore the environment.
SCH_EDIT_FRAME * m_schFrame
Definition: sch_plotter.h:214
void setupPlotPagePDF(PLOTTER *aPlotter, SCH_SCREEN *aScreen, const SCH_PLOT_SETTINGS &aPlotSettings)
bool plotOneSheetPS(const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, const PAGE_INFO &aPageInfo, const VECTOR2I &aPlot0ffset, double aScale, const SCH_PLOT_SETTINGS &aPlotSettings)
COLOR_SETTINGS * m_colorSettings
Definition: sch_plotter.h:217
void createPDFFile(const SCH_PLOT_SETTINGS &aPlotSettings, RENDER_SETTINGS *aRenderSettings, REPORTER *aReporter)
void plotOneSheetPDF(PLOTTER *aPlotter, SCH_SCREEN *aScreen, const SCH_PLOT_SETTINGS &aPlotSettings)
SCHEMATIC * m_schematic
Definition: sch_plotter.h:215
void createHPGLFiles(const SCH_PLOT_SETTINGS &aPlotSettings, RENDER_SETTINGS *aRenderSettings, REPORTER *aReporter)
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:131
const wxString & GetFileName() const
Definition: sch_screen.h:144
SCHEMATIC * Schematic() const
Definition: sch_screen.cpp:91
void Plot(PLOTTER *aPlotter) const
Plot all the schematic objects to aPlotter.
const TITLE_BLOCK & GetTitleBlock() const
Definition: sch_screen.h:155
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
void SortByPageNumbers(bool aUpdateVirtualPageNums=true)
Sort the list of sheets by page number.
void BuildSheetList(SCH_SHEET *aSheet, bool aCheckIntegrity)
Build the list of sheets and their sheet path from aSheet.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
wxString PathHumanReadable(bool aUseShortRootName=true, bool aStripTrailingSeparator=false) const
Return the sheet path in a human readable form made from the sheet names.
void UpdateAllScreenReferences() const
Update all the symbol references for this sheet path.
SCH_SCREEN * LastScreen()
wxString GetPageNumber() const
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
wxString GetName() const
Definition: sch_sheet.h:107
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
virtual bool StartPlot(const wxString &aPageNumber) override
Create SVG file header.
virtual void SetViewport(const VECTOR2I &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
virtual bool EndPlot() override
virtual void SetColor(const COLOR4D &color) override
The SetColor implementation is split with the subclasses: The PSLIKE computes the rgb values,...
static wxString GetDefaultFileExtension()
const wxString & GetTitle() const
Definition: title_block.h:63
bool EnsureFileDirectoryExists(wxFileName *aTargetFullFileName, const wxString &aBaseFilename, REPORTER *aReporter)
Make aTargetFullFileName absolute and create the path of this file if it doesn't yet exist.
Definition: common.cpp:327
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
Definition: common.cpp:58
The common library.
void PlotDrawingSheet(PLOTTER *plotter, const PROJECT *aProject, const TITLE_BLOCK &aTitleBlock, const PAGE_INFO &aPageInfo, const std::map< wxString, wxString > *aProperties, const wxString &aSheetNumber, int aSheetCount, const wxString &aSheetName, const wxString &aSheetPath, const wxString &aFilename, COLOR4D aColor, bool aIsFirstPage)
#define _(s)
const wxChar *const tracePathsAndFiles
Flag to enable path and file name debug output.
@ LAYER_SCHEMATIC_DRAWINGSHEET
Definition: layer_ids.h:386
@ LAYER_SCHEMATIC_BACKGROUND
Definition: layer_ids.h:380
see class PGM_BASE
PLOT_FORMAT
The set of supported output plot formats.
Definition: plotter.h:70
Plotting engine (DXF)
Plotting engine (HPGL)
Plotting engines similar to ps (PostScript, Gerber, svg)
@ RPT_SEVERITY_ERROR
@ RPT_SEVERITY_INFO
@ RPT_SEVERITY_ACTION
static const wxChar * plot_sheet_list(HPGL_PAGE_SIZE aSize)
Definition: sch_plotter.cpp:45
@ PAGE_SIZE_AUTO
Definition: sch_plotter.h:56
@ PAGE_SIZE_A
Definition: sch_plotter.h:58
@ PAGE_SIZE_A4
Definition: sch_plotter.h:57
HPGL_PAGE_SIZE
Definition: sch_plotter.h:63
@ SHEETNAME
Definition: sch_sheet.h:45
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:115
const int scale
const double IU_PER_MILS
Definition: base_units.h:78
constexpr int mmToIU(double mm) const
Definition: base_units.h:89
double m_HPGLPenSize
Definition: sch_plotter.h:86
wxString m_theme
Definition: sch_plotter.h:88
HPGL_PAGE_SIZE m_HPGLPaperSizeSelect
Definition: sch_plotter.h:87
HPGL_PLOT_ORIGIN_AND_UNITS m_HPGLPlotOrigin
Definition: sch_plotter.h:93
bool m_useBackgroundColor
Definition: sch_plotter.h:85
wxString m_outputDirectory
Definition: sch_plotter.h:90
wxString m_outputFile
Definition: sch_plotter.h:91
wxLogTrace helper definitions.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:588