KiCad PCB EDA Suite
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-2022 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 <common.h>
28#include <sch_plotter.h>
29#include <locale_io.h>
33
34#include <pgm_base.h>
35#include <trace_helpers.h>
36
37#include <sch_edit_frame.h>
38#include <sch_painter.h>
39#include <schematic.h>
40#include <sch_screen.h>
42
43
44static const wxChar* plot_sheet_list( HPGL_PAGE_SIZE aSize )
45{
46 switch( aSize )
47 {
48 default:
49 case HPGL_PAGE_SIZE::DEFAULT: return nullptr;
50 case HPGL_PAGE_SIZE::SIZE_A5: return wxT( "A5" );
51 case HPGL_PAGE_SIZE::SIZE_A4: return wxT( "A4" );
52 case HPGL_PAGE_SIZE::SIZE_A3: return wxT( "A3" );
53 case HPGL_PAGE_SIZE::SIZE_A2: return wxT( "A2" );
54 case HPGL_PAGE_SIZE::SIZE_A1: return wxT( "A1" );
55 case HPGL_PAGE_SIZE::SIZE_A0: return wxT( "A0" );
56 case HPGL_PAGE_SIZE::SIZE_A: return wxT( "A" );
57 case HPGL_PAGE_SIZE::SIZE_B: return wxT( "B" );
58 case HPGL_PAGE_SIZE::SIZE_C: return wxT( "C" );
59 case HPGL_PAGE_SIZE::SIZE_D: return wxT( "D" );
60 case HPGL_PAGE_SIZE::SIZE_E: return wxT( "E" );
61 }
62}
63
64
66 m_schFrame( nullptr ),
67 m_schematic( aSchematic )
68{
69 m_colorSettings = nullptr;
70}
71
72
74 m_schFrame( aFrame ),
75 m_schematic( &aFrame->Schematic() )
76{
77 m_colorSettings = nullptr;
78}
79
80
82 REPORTER* aReporter, const wxString& aExt )
83{
84 if( !aPlotSettings.m_outputFile.empty() )
85 return aPlotSettings.m_outputFile;
86 else
87 {
89
90 // The sub sheet can be in a sub_hierarchy, but we plot the file in the main
91 // project folder (or the folder specified by the caller), so replace separators
92 // to create a unique filename:
93 fname.Replace( "/", "_" );
94 fname.Replace( "\\", "_" );
95
96 return createPlotFileName( aPlotSettings, fname, aExt, aReporter );
97 }
98
99}
100
101
103 RENDER_SETTINGS* aRenderSettings, REPORTER* aReporter )
104{
105 SCH_SHEET_PATH oldsheetpath = m_schematic->CurrentSheet(); // sheetpath is saved here
106
107 /* When printing all pages, the printed page is not the current page. In complex hierarchies,
108 * we must update symbol references and other parameters in the given printed SCH_SCREEN,
109 * according to the sheet path because in complex hierarchies a SCH_SCREEN (a drawing ) is
110 * shared between many sheets and symbol references depend on the actual sheet path used.
111 */
112 SCH_SHEET_LIST sheetList;
113
114 if( aPlotSettings.m_plotAll )
115 {
116 sheetList.BuildSheetList( &m_schematic->Root(), true );
117 sheetList.SortByPageNumbers();
118 }
119 else
120 {
121 sheetList.push_back( m_schematic->CurrentSheet() );
122 }
123
124 // Allocate the plotter and set the job level parameter
125 PDF_PLOTTER* plotter = new PDF_PLOTTER();
126 plotter->SetRenderSettings( aRenderSettings );
127 plotter->SetColorMode( !aPlotSettings.m_blackAndWhite );
128 plotter->SetCreator( wxT( "Eeschema-PDF" ) );
130 &m_schematic->Prj() ) );
131
132 wxString msg;
133 wxFileName plotFileName;
134 LOCALE_IO toggle; // Switch the locale to standard C
135
136 for( unsigned i = 0; i < sheetList.size(); i++ )
137 {
138 if( m_schFrame )
139 m_schFrame->SetCurrentSheet( sheetList[i] );
140 else
141 m_schematic->SetCurrentSheet( sheetList[i] );
142
144
146
148
149 if( i == 0 )
150 {
151 try
152 {
154 plotFileName = getOutputFilenameSingle( aPlotSettings, aReporter, ext );
155
156 m_lastOutputFilePath = plotFileName.GetFullPath();
157
158 if( !plotFileName.IsOk() )
159 return;
160
161 if( !plotter->OpenFile( plotFileName.GetFullPath() ) )
162 {
163 if( aReporter )
164 {
165 msg.Printf( _( "Failed to create file '%s'." ),
166 plotFileName.GetFullPath() );
167 aReporter->Report( msg, RPT_SEVERITY_ERROR );
168 }
169 delete plotter;
170 return;
171 }
172
173 // Open the plotter and do the first page
174 setupPlotPagePDF( plotter, screen, aPlotSettings );
175 plotter->StartPlot( sheetList[i].GetPageNumber(), _( "Root" ) );
176 }
177 catch( const IO_ERROR& e )
178 {
179 // Cannot plot PDF file
180 if( aReporter )
181 {
182 msg.Printf( wxT( "PDF Plotter exception: %s" ), e.What() );
183 aReporter->Report( msg, RPT_SEVERITY_ERROR );
184 }
185
186 restoreEnvironment( plotter, oldsheetpath );
187 return;
188 }
189 }
190 else
191 {
192 /* For the following pages you need to close the (finished) page,
193 * reconfigure, and then start a new one */
194 plotter->ClosePage();
195 setupPlotPagePDF( plotter, screen, aPlotSettings );
196 plotter->StartPage( sheetList[i].GetPageNumber(),
197 sheetList[i].Last()->GetFields()[SHEETNAME].GetShownText() );
198 }
199
200 plotOneSheetPDF( plotter, screen, aPlotSettings );
201 }
202
203 // Everything done, close the plot and restore the environment
204 if( aReporter )
205 {
206 msg.Printf( _( "Plotted to '%s'.\n" ), plotFileName.GetFullPath() );
207 aReporter->Report( msg, RPT_SEVERITY_ACTION );
208 aReporter->ReportTail( _( "Done." ), RPT_SEVERITY_INFO );
209 }
210
211 restoreEnvironment( plotter, oldsheetpath );
212}
213
214
216 const SCH_PLOT_SETTINGS& aPlotSettings )
217{
218 if( aPlotSettings.m_useBackgroundColor && aPlotter->GetColorMode() )
219 {
220 aPlotter->SetColor( aPlotter->RenderSettings()->GetBackgroundColor() );
221 wxPoint end( aPlotter->PageSettings().GetWidthIU( schIUScale.IU_PER_MILS ),
223 aPlotter->Rect( wxPoint( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 );
224 }
225
226 if( aPlotSettings.m_plotDrawingSheet )
227 {
229
230 if( aPlotter->GetColorMode() )
232
233 wxString sheetName = m_schematic->CurrentSheet().Last()->GetName();
234 wxString sheetPath = m_schematic->CurrentSheet().PathHumanReadable();
235 const PAGE_INFO& actualPage = aScreen->GetPageSettings(); // page size selected in schematic
236
237 PlotDrawingSheet( aPlotter, &aScreen->Schematic()->Prj(),
239 actualPage,
240 aScreen->Schematic()->GetProperties(),
241 aScreen->GetPageNumber(), aScreen->GetPageCount(), sheetName, sheetPath,
242 aScreen->GetFileName(), color, aScreen->GetVirtualPageNumber() == 1 );
243 }
244
245 aScreen->Plot( aPlotter );
246}
247
248
250 const SCH_PLOT_SETTINGS& aPlotSettings )
251{
252 PAGE_INFO plotPage; // page size selected to plot
253
254 // Considerations on page size and scaling requests
255 const PAGE_INFO& actualPage = aScreen->GetPageSettings(); // page size selected in schematic
256
257 switch( aPlotSettings.m_pageSizeSelect )
258 {
259 case PAGE_SIZE_A:
260 plotPage.SetType( wxT( "A" ) );
261 plotPage.SetPortrait( actualPage.IsPortrait() );
262 break;
263
264 case PAGE_SIZE_A4:
265 plotPage.SetType( wxT( "A4" ) );
266 plotPage.SetPortrait( actualPage.IsPortrait() );
267 break;
268
269 case PAGE_SIZE_AUTO:
270 default:
271 plotPage = actualPage;
272 break;
273 }
274
275 double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils();
276 double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils();
277 double scale = std::min( scalex, scaley );
278 aPlotter->SetPageSettings( plotPage );
279
280 // Currently, plot units are in decimil
281 aPlotter->SetViewport( wxPoint( 0, 0 ), schIUScale.IU_PER_MILS/10, scale, false );
282}
283
284
286 RENDER_SETTINGS* aRenderSettings, REPORTER* aReporter )
287{
288 SCH_SHEET_PATH oldsheetpath = m_schematic->CurrentSheet(); // sheetpath is saved here
289 PAGE_INFO plotPage; // page size selected to plot
290 wxString msg;
291
292 /* When printing all pages, the printed page is not the current page.
293 * In complex hierarchies, we must update symbol references and other parameters in the
294 * given printed SCH_SCREEN, accordant to the sheet path because in complex hierarchies
295 * a SCH_SCREEN (a drawing ) is shared between many sheets and symbol references
296 * depend on the actual sheet path used.
297 */
298 SCH_SHEET_LIST sheetList;
299
300 if( aPlotSettings.m_plotAll )
301 {
302 sheetList.BuildSheetList( &m_schematic->Root(), true );
303 sheetList.SortByPageNumbers();
304 }
305 else
306 {
307 sheetList.push_back( m_schematic->CurrentSheet() );
308 }
309
310 for( unsigned i = 0; i < sheetList.size(); i++ )
311 {
312 if( m_schFrame )
313 m_schFrame->SetCurrentSheet( sheetList[i] );
314 else
315 m_schematic->SetCurrentSheet( sheetList[i] );
316
318
320
322 PAGE_INFO actualPage = screen->GetPageSettings();
323
324 switch( aPlotSettings.m_pageSizeSelect )
325 {
326 case PAGE_SIZE_A:
327 plotPage.SetType( wxT( "A" ) );
328 plotPage.SetPortrait( actualPage.IsPortrait() );
329 break;
330
331 case PAGE_SIZE_A4:
332 plotPage.SetType( wxT( "A4" ) );
333 plotPage.SetPortrait( actualPage.IsPortrait() );
334 break;
335
336 case PAGE_SIZE_AUTO:
337 default: plotPage = actualPage; break;
338 }
339
340 double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils();
341 double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils();
342 double scale = std::min( scalex, scaley );
343 wxPoint plot_offset;
344
345 try
346 {
348
349 // The sub sheet can be in a sub_hierarchy, but we plot the file in the
350 // main project folder (or the folder specified by the caller),
351 // so replace separators to create a unique filename:
352 fname.Replace( "/", "_" );
353 fname.Replace( "\\", "_" );
355 wxFileName plotFileName = createPlotFileName( aPlotSettings, fname, ext, aReporter );
356
357 m_lastOutputFilePath = plotFileName.GetFullPath();
358
359 if( !plotFileName.IsOk() )
360 return;
361
362 if( plotOneSheetPS( plotFileName.GetFullPath(), screen, aRenderSettings, actualPage,
363 plot_offset, scale, aPlotSettings ) )
364 {
365 if( aReporter )
366 {
367 msg.Printf( _( "Plotted to '%s'." ), plotFileName.GetFullPath() );
368 aReporter->Report( msg, RPT_SEVERITY_ACTION );
369 }
370 }
371 else
372 {
373 if( aReporter )
374 {
375 // Error
376 msg.Printf( _( "Failed to create file '%s'." ), plotFileName.GetFullPath() );
377 aReporter->Report( msg, RPT_SEVERITY_ERROR );
378 }
379 }
380 }
381 catch( IO_ERROR& e )
382 {
383 if( aReporter )
384 {
385 msg.Printf( wxT( "PS Plotter exception: %s" ), e.What() );
386 aReporter->Report( msg, RPT_SEVERITY_ERROR );
387 }
388 }
389 }
390
391 if( aReporter )
392 {
393 aReporter->ReportTail( _( "Done." ), RPT_SEVERITY_INFO );
394 }
395
396 if( m_schFrame )
397 m_schFrame->SetCurrentSheet( oldsheetpath );
398 else
399 m_schematic->SetCurrentSheet( oldsheetpath );
400
402
404}
405
406
407bool SCH_PLOTTER::plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen,
408 RENDER_SETTINGS* aRenderSettings,
409 const PAGE_INFO& aPageInfo, const wxPoint& aPlot0ffset,
410 double aScale, const SCH_PLOT_SETTINGS& aPlotSettings )
411{
412 PS_PLOTTER* plotter = new PS_PLOTTER();
413 plotter->SetRenderSettings( aRenderSettings );
414 plotter->SetPageSettings( aPageInfo );
415 plotter->SetColorMode( !aPlotSettings.m_blackAndWhite );
416
417 // Currently, plot units are in decimil
418 plotter->SetViewport( aPlot0ffset, schIUScale.IU_PER_MILS / 10, aScale, false );
419
420 // Init :
421 plotter->SetCreator( wxT( "Eeschema-PS" ) );
422
423 if( !plotter->OpenFile( aFileName ) )
424 {
425 delete plotter;
426 return false;
427 }
428
429 LOCALE_IO toggle; // Switch the locale to standard C
430
432
433 if( aPlotSettings.m_useBackgroundColor && plotter->GetColorMode() )
434 {
436
437 wxPoint end( plotter->PageSettings().GetWidthIU( schIUScale.IU_PER_MILS ),
439 plotter->Rect( wxPoint( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 );
440 }
441
442 if( aPlotSettings.m_plotDrawingSheet )
443 {
444 wxString sheetName = m_schematic->CurrentSheet().Last()->GetName();
445 wxString sheetPath = m_schematic->CurrentSheet().PathHumanReadable();
447
448 PlotDrawingSheet( plotter, &aScreen->Schematic()->Prj(),
450 aPageInfo, aScreen->Schematic()->GetProperties(),
451 aScreen->GetPageNumber(), aScreen->GetPageCount(), sheetName, sheetPath,
452 aScreen->GetFileName(), plotter->GetColorMode() ? color : COLOR4D::BLACK,
453 aScreen->GetVirtualPageNumber() == 1 );
454 }
455
456 aScreen->Plot( plotter );
457
458 plotter->EndPlot();
459 delete plotter;
460
461 return true;
462}
463
464
466 RENDER_SETTINGS* aRenderSettings, REPORTER* aReporter )
467{
468 wxString msg;
469 SCH_SHEET_PATH oldsheetpath = m_schematic->CurrentSheet();
470 SCH_SHEET_LIST sheetList;
471
472 if( aPlotSettings.m_plotAll )
473 {
474 sheetList.BuildSheetList( &m_schematic->Root(), true );
475 sheetList.SortByPageNumbers();
476 }
477 else
478 {
479 sheetList.push_back( m_schematic->CurrentSheet() );
480 }
481
482 for( unsigned i = 0; i < sheetList.size(); i++ )
483 {
484 SCH_SCREEN* screen;
485 if( m_schFrame )
486 m_schFrame->SetCurrentSheet( sheetList[i] );
487 else
488 m_schematic->SetCurrentSheet( sheetList[i] );
489
491
493
494 screen = m_schematic->CurrentSheet().LastScreen();
495
496 try
497 {
499
500 // The sub sheet can be in a sub_hierarchy, but we plot the file in the
501 // main project folder (or the folder specified by the caller),
502 // so replace separators to create a unique filename:
503 fname.Replace( "/", "_" );
504 fname.Replace( "\\", "_" );
506 wxFileName plotFileName = createPlotFileName( aPlotSettings, fname, ext, aReporter );
507
508 m_lastOutputFilePath = plotFileName.GetFullPath();
509
510 if( !plotFileName.IsOk() )
511 return;
512
513 bool success = plotOneSheetSVG( plotFileName.GetFullPath(), screen, aRenderSettings,
514 aPlotSettings );
515
516 if( !success )
517 {
518 if( aReporter )
519 {
520 msg.Printf( _( "Failed to create file '%s'." ), plotFileName.GetFullPath() );
521 aReporter->Report( msg, RPT_SEVERITY_ERROR );
522 }
523 }
524 else
525 {
526 if( aReporter )
527 {
528 msg.Printf( _( "Plotted to '%s'." ), plotFileName.GetFullPath() );
529 aReporter->Report( msg, RPT_SEVERITY_ACTION );
530 }
531 }
532 }
533 catch( const IO_ERROR& e )
534 {
535 if( aReporter )
536 {
537 // Cannot plot SVG file
538 msg.Printf( wxT( "SVG Plotter exception: %s" ), e.What() );
539 aReporter->Report( msg, RPT_SEVERITY_ERROR );
540 }
541 break;
542 }
543 }
544
545 if( aReporter )
546 {
547 aReporter->ReportTail( _( "Done" ), RPT_SEVERITY_INFO );
548 }
549
550 if( m_schFrame )
551 m_schFrame->SetCurrentSheet( oldsheetpath );
552 else
553 m_schematic->SetCurrentSheet( oldsheetpath );
554
556
558}
559
560
561bool SCH_PLOTTER::plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScreen,
562 RENDER_SETTINGS* aRenderSettings,
563 const SCH_PLOT_SETTINGS& aPlotSettings )
564{
565 PAGE_INFO plotPage;
566 // Adjust page size and scaling requests
567 const PAGE_INFO& actualPage = aScreen->GetPageSettings(); // page size selected in schematic
568
569 switch( aPlotSettings.m_pageSizeSelect )
570 {
571 case PAGE_SIZE_A:
572 plotPage.SetType( wxT( "A" ) );
573 plotPage.SetPortrait( actualPage.IsPortrait() );
574 break;
575
576 case PAGE_SIZE_A4:
577 plotPage.SetType( wxT( "A4" ) );
578 plotPage.SetPortrait( actualPage.IsPortrait() );
579 break;
580
581 case PAGE_SIZE_AUTO:
582 default:
583 plotPage = actualPage;
584 break;
585 }
586
587 SVG_PLOTTER* plotter = new SVG_PLOTTER();
588 plotter->SetRenderSettings( aRenderSettings );
589 plotter->SetPageSettings( plotPage );
590 plotter->SetColorMode( aPlotSettings.m_blackAndWhite ? false : true );
591 wxPoint plot_offset;
592
593 double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils();
594 double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils();
595 double scale = std::min( scalex, scaley );
596
597 // Currently, plot units are in decimil
598 plotter->SetViewport( plot_offset, schIUScale.IU_PER_MILS / 10, scale, false );
599
600 // Init :
601 plotter->SetCreator( wxT( "Eeschema-SVG" ) );
602
603 if( !plotter->OpenFile( aFileName ) )
604 {
605 delete plotter;
606 return false;
607 }
608
609 LOCALE_IO toggle;
610
612
613 if( aPlotSettings.m_useBackgroundColor && plotter->GetColorMode() )
614 {
616 wxPoint end( plotter->PageSettings().GetWidthIU( schIUScale.IU_PER_MILS ),
618 plotter->Rect( wxPoint( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 );
619 }
620
621 if( aPlotSettings.m_plotDrawingSheet )
622 {
623 wxString sheetName = m_schematic->CurrentSheet().Last()->GetName();
624 wxString sheetPath = m_schematic->CurrentSheet().PathHumanReadable();
626
627 PlotDrawingSheet( plotter, &aScreen->Schematic()->Prj(),
629 actualPage, aScreen->Schematic()->GetProperties(), aScreen->GetPageNumber(),
630 aScreen->GetPageCount(), sheetName, sheetPath, aScreen->GetFileName(),
631 plotter->GetColorMode() ? color : COLOR4D::BLACK,
632 aScreen->GetVirtualPageNumber() == 1 );
633 }
634
635 aScreen->Plot( plotter );
636
637 plotter->EndPlot();
638 delete plotter;
639
640 return true;
641}
642
643
645 RENDER_SETTINGS* aRenderSettings, REPORTER* aReporter )
646{
647 SCH_SCREEN* screen = m_schematic->RootScreen();
648 SCH_SHEET_PATH oldsheetpath = m_schematic->CurrentSheet();
649
650 /* When printing all pages, the printed page is not the current page. In complex hierarchies,
651 * we must update symbol references and other parameters in the given printed SCH_SCREEN,
652 * according to the sheet path because in complex hierarchies a SCH_SCREEN (a drawing ) is
653 * shared between many sheets and symbol references depend on the actual sheet path used.
654 */
655 SCH_SHEET_LIST sheetList;
656
657 if( aPlotSettings.m_plotAll )
658 {
659 sheetList.BuildSheetList( &m_schematic->Root(), true );
660 sheetList.SortByPageNumbers();
661 }
662 else
663 {
664 sheetList.push_back( m_schematic->CurrentSheet() );
665 }
666
667 for( unsigned i = 0; i < sheetList.size(); i++ )
668 {
669 if( m_schFrame )
670 m_schFrame->SetCurrentSheet( sheetList[i] );
671 else
672 m_schematic->SetCurrentSheet( sheetList[i] );
674
676
677 screen = m_schematic->CurrentSheet().LastScreen();
678
679 if( !screen ) // LastScreen() may return NULL
680 screen = m_schematic->RootScreen();
681
682 const PAGE_INFO& curPage = screen->GetPageSettings();
683
684 PAGE_INFO plotPage = curPage;
685
686 // if plotting on a page size other than curPage
687 plotPage.SetType( plot_sheet_list( aPlotSettings.m_HPGLPaperSizeSelect ) );
688
689 // Calculation of conversion scales.
690 double plot_scale = (double) plotPage.GetWidthMils() / curPage.GetWidthMils();
691
692 // Calculate offsets
693 wxPoint plotOffset;
694 wxString msg;
695
697 {
698 plotOffset.x = plotPage.GetWidthIU( schIUScale.IU_PER_MILS ) / 2;
699 plotOffset.y = -plotPage.GetHeightIU( schIUScale.IU_PER_MILS ) / 2;
700 }
701
702 try
703 {
705 // The sub sheet can be in a sub_hierarchy, but we plot the file in the
706 // main project folder (or the folder specified by the caller),
707 // so replace separators to create a unique filename:
708 fname.Replace( "/", "_" );
709 fname.Replace( "\\", "_" );
711 wxFileName plotFileName = createPlotFileName( aPlotSettings, fname, ext, aReporter );
712
713 if( !plotFileName.IsOk() )
714 return;
715
716 LOCALE_IO toggle;
717
718 if( plotOneSheetHpgl( plotFileName.GetFullPath(), screen, curPage, aRenderSettings,
719 plotOffset, plot_scale, aPlotSettings ) )
720 {
721 if( aReporter )
722 {
723 msg.Printf( _( "Plotted to '%s'." ), plotFileName.GetFullPath() );
724 aReporter->Report( msg, RPT_SEVERITY_ACTION );
725 }
726 }
727 else
728 {
729 if( aReporter )
730 {
731 msg.Printf( _( "Failed to create file '%s'." ), plotFileName.GetFullPath() );
732 aReporter->Report( msg, RPT_SEVERITY_ERROR );
733 }
734 }
735 }
736 catch( IO_ERROR& e )
737 {
738 if( aReporter )
739 {
740 msg.Printf( wxT( "HPGL Plotter exception: %s" ), e.What() );
741 aReporter->Report( msg, RPT_SEVERITY_ERROR );
742 }
743 }
744 }
745
746 if( aReporter )
747 {
748 aReporter->ReportTail( _( "Done." ), RPT_SEVERITY_INFO );
749 }
750
751 if( m_schFrame )
752 m_schFrame->SetCurrentSheet( oldsheetpath );
753 else
754 m_schematic->SetCurrentSheet( oldsheetpath );
755
757
759}
760
761
762bool SCH_PLOTTER::plotOneSheetHpgl( const wxString& aFileName,
763 SCH_SCREEN* aScreen,
764 const PAGE_INFO& aPageInfo,
765 RENDER_SETTINGS* aRenderSettings,
766 const wxPoint& aPlot0ffset,
767 double aScale,
768 const SCH_PLOT_SETTINGS& aPlotSettings )
769{
770 HPGL_PLOTTER* plotter = new HPGL_PLOTTER();
771 // Currently, plot units are in decimil
772
773 plotter->SetPageSettings( aPageInfo );
774 plotter->SetRenderSettings( aRenderSettings );
776 plotter->SetColorMode( !aPlotSettings.m_blackAndWhite );
777 plotter->SetViewport( aPlot0ffset, schIUScale.IU_PER_MILS/10, aScale, false );
778
779 // TODO this could be configurable
780 plotter->SetTargetChordLength( schIUScale.mmToIU( 0.6 ) );
781
782 switch( aPlotSettings.m_HPGLPlotOrigin )
783 {
786 default:
787 plotter->SetUserCoords( false );
788 break;
790 plotter->SetUserCoords( true );
791 plotter->SetUserCoordsFit( false );
792 break;
794 plotter->SetUserCoords( true );
795 plotter->SetUserCoordsFit( true );
796 break;
797 }
798
799 // Init :
800 plotter->SetCreator( wxT( "Eeschema-HPGL" ) );
801
802 if( !plotter->OpenFile( aFileName ) )
803 {
804 delete plotter;
805 return false;
806 }
807
808 LOCALE_IO toggle;
809
810 // Pen num and pen speed are not initialized here.
811 // Default HPGL driver values are used
812 plotter->SetPenDiameter( aPlotSettings.m_HPGLPenSize );
814
815 if( aPlotSettings.m_plotDrawingSheet )
816 {
817 wxString sheetName = m_schematic->CurrentSheet().Last()->GetName();
818 wxString sheetPath = m_schematic->CurrentSheet().PathHumanReadable();
819
821 aPageInfo,
822 aScreen->Schematic()->GetProperties(), aScreen->GetPageNumber(),
823 aScreen->GetPageCount(), sheetName, sheetPath, aScreen->GetFileName(),
824 COLOR4D::BLACK, aScreen->GetVirtualPageNumber() == 1 );
825 }
826
827 aScreen->Plot( plotter );
828
829 plotter->EndPlot();
830
831 delete plotter;
832
833 return true;
834}
835
836
838 RENDER_SETTINGS* aRenderSettings, REPORTER* aReporter )
839{
840 SCH_SHEET_PATH oldsheetpath = m_schematic->CurrentSheet();
841
842 /* When printing all pages, the printed page is not the current page. In complex hierarchies,
843 * we must update symbol references and other parameters in the given printed SCH_SCREEN,
844 * according to the sheet path because in complex hierarchies a SCH_SCREEN (a drawing ) is
845 * shared between many sheets and symbol references depend on the actual sheet path used.
846 */
847 SCH_SHEET_LIST sheetList;
848
849 if( aPlotSettings.m_plotAll )
850 {
851 sheetList.BuildSheetList( &m_schematic->Root(), true );
852 sheetList.SortByPageNumbers();
853 }
854 else
855 {
856 sheetList.push_back( m_schematic->CurrentSheet() );
857 }
858
859 for( unsigned i = 0; i < sheetList.size(); i++ )
860 {
861 if( m_schFrame )
862 m_schFrame->SetCurrentSheet( sheetList[i] );
863 else
864 m_schematic->SetCurrentSheet( sheetList[i] );
866
868
870 wxPoint plot_offset;
871 wxString msg;
872
873 try
874 {
876
877 // The sub sheet can be in a sub_hierarchy, but we plot the file in the
878 // main project folder (or the folder specified by the caller),
879 // so replace separators to create a unique filename:
880 fname.Replace( "/", "_" );
881 fname.Replace( "\\", "_" );
883 wxFileName plotFileName = createPlotFileName( aPlotSettings, fname, ext, aReporter );
884
885 m_lastOutputFilePath = plotFileName.GetFullPath();
886
887 if( !plotFileName.IsOk() )
888 return;
889
890 if( plotOneSheetDXF( plotFileName.GetFullPath(), screen, aRenderSettings, plot_offset,
891 1.0, aPlotSettings ) )
892 {
893 if( aReporter )
894 {
895 msg.Printf( _( "Plotted to '%s'." ), plotFileName.GetFullPath() );
896 aReporter->Report( msg, RPT_SEVERITY_ACTION );
897 }
898 }
899 else // Error
900 {
901 if( aReporter )
902 {
903 msg.Printf( _( "Failed to create file '%s'." ), plotFileName.GetFullPath() );
904 aReporter->Report( msg, RPT_SEVERITY_ERROR );
905 }
906 }
907 }
908 catch( IO_ERROR& e )
909 {
910 if( aReporter )
911 {
912 msg.Printf( wxT( "DXF Plotter exception: %s" ), e.What() );
913 aReporter->Report( msg, RPT_SEVERITY_ERROR );
914 }
915
916 if( m_schFrame )
917 m_schFrame->SetCurrentSheet( oldsheetpath );
918 else
919 m_schematic->SetCurrentSheet( oldsheetpath );
920
922
924 return;
925 }
926 }
927
928 if( aReporter )
929 aReporter->ReportTail( _( "Done." ), RPT_SEVERITY_INFO );
930
931 if( m_schFrame )
932 m_schFrame->SetCurrentSheet( oldsheetpath );
933 else
934 m_schematic->SetCurrentSheet( oldsheetpath );
935
937
939}
940
941
942bool SCH_PLOTTER::plotOneSheetDXF( const wxString& aFileName, SCH_SCREEN* aScreen,
943 RENDER_SETTINGS* aRenderSettings, const wxPoint& aPlotOffset,
944 double aScale, const SCH_PLOT_SETTINGS& aPlotSettings )
945{
946 aRenderSettings->LoadColors( m_colorSettings );
947 aRenderSettings->SetDefaultPenWidth( 0 );
948
949 const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
950 DXF_PLOTTER* plotter = new DXF_PLOTTER();
951
952 plotter->SetRenderSettings( aRenderSettings );
953 plotter->SetPageSettings( pageInfo );
954 plotter->SetColorMode( !aPlotSettings.m_blackAndWhite );
955
956 // Currently, plot units are in decimil
957 plotter->SetViewport( aPlotOffset, schIUScale.IU_PER_MILS / 10, aScale, false );
958
959 // Init :
960 plotter->SetCreator( wxT( "Eeschema-DXF" ) );
961
962 if( !plotter->OpenFile( aFileName ) )
963 {
964 delete plotter;
965 return false;
966 }
967
968 LOCALE_IO toggle;
969
971
972 if( aPlotSettings.m_plotDrawingSheet )
973 {
974 wxString sheetName = m_schematic->CurrentSheet().Last()->GetName();
975 wxString sheetPath = m_schematic->CurrentSheet().PathHumanReadable();
977
979 pageInfo,
980 aScreen->Schematic()->GetProperties(), aScreen->GetPageNumber(),
981 aScreen->GetPageCount(), sheetName, sheetPath, aScreen->GetFileName(),
982 plotter->GetColorMode() ? color : COLOR4D::BLACK,
983 aScreen->GetVirtualPageNumber() == 1 );
984 }
985
986 aScreen->Plot( plotter );
987
988 // finish
989 plotter->EndPlot();
990 delete plotter;
991
992 return true;
993}
994
995
997{
998 aPlotter->EndPlot();
999 delete aPlotter;
1000
1001 // Restore the previous sheet
1002 if( m_schFrame )
1003 m_schFrame->SetCurrentSheet( aOldsheetpath );
1004 else
1005 m_schematic->SetCurrentSheet( aOldsheetpath );
1006
1008
1010}
1011
1012
1014 const wxString& aPlotFileName,
1015 const wxString& aExtension, REPORTER* aReporter )
1016{
1017 wxFileName retv;
1018 wxFileName tmp;
1019
1020 tmp.SetPath( aPlotSettings.m_outputDirectory );
1021 retv.SetPath( tmp.GetPath() );
1022
1023 if( !aPlotFileName.IsEmpty() )
1024 retv.SetName( aPlotFileName );
1025 else
1026 retv.SetName( _( "Schematic" ) );
1027
1028 retv.SetExt( aExtension );
1029
1030 if( !EnsureFileDirectoryExists( &tmp, retv.GetFullName(), aReporter ) || !tmp.IsDirWritable() )
1031 {
1032 if( aReporter )
1033 {
1034 wxString msg = wxString::Format( _( "Failed to write plot files to folder '%s'." ),
1035 tmp.GetPath() );
1036 aReporter->Report( msg, RPT_SEVERITY_ERROR );
1037 }
1038 retv.Clear();
1039
1041 settings.m_PlotDirectoryName.Clear();
1042 }
1043 else
1044 {
1045 retv.SetPath( tmp.GetPath() );
1046 }
1047
1048 wxLogTrace( tracePathsAndFiles, "Writing plot file '%s'.", retv.GetFullPath() );
1049
1050 return retv;
1051}
1052
1053
1054void SCH_PLOTTER::Plot( PLOT_FORMAT aPlotFormat, const SCH_PLOT_SETTINGS& aPlotSettings,
1055 RENDER_SETTINGS* aRenderSettings, REPORTER* aReporter )
1056{
1057 SETTINGS_MANAGER& settingsMgr = Pgm().GetSettingsManager();
1058
1059 m_colorSettings = settingsMgr.GetColorSettings( aPlotSettings.m_theme );
1060
1061 switch( aPlotFormat )
1062 {
1063 default:
1064 case PLOT_FORMAT::POST: createPSFiles( aPlotSettings, aRenderSettings, aReporter ); break;
1065 case PLOT_FORMAT::DXF: createDXFFiles( aPlotSettings, aRenderSettings, aReporter ); break;
1066 case PLOT_FORMAT::PDF: createPDFFile( aPlotSettings, aRenderSettings, aReporter ); break;
1067 case PLOT_FORMAT::SVG: createSVGFiles( aPlotSettings, aRenderSettings, aReporter ); break;
1068 case PLOT_FORMAT::HPGL: createHPGLFiles( aPlotSettings, aRenderSettings, aReporter ); break;
1069 }
1070}
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:104
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:187
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:120
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:61
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:120
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:178
void SetCurrentSheet(const SCH_SHEET_PATH &aPath) override
Definition: schematic.h:125
SCH_SCREEN * RootScreen() const
Helper to retrieve the screen of the root sheet.
Definition: schematic.cpp:119
const std::map< wxString, wxString > * GetProperties()
Definition: schematic.h:79
SCH_SHEET & Root() const
Definition: schematic.h:91
wxString GetUniqueFilenameForCurrentSheet()
Definition: schematic.cpp:496
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
Definition: schematic.cpp:512
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
Definition: schematic.h:76
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:81
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 wxPoint &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:73
bool plotOneSheetDXF(const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, const wxPoint &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
bool plotOneSheetPS(const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, const PAGE_INFO &aPageInfo, const wxPoint &aPlot0ffset, double aScale, const SCH_PLOT_SETTINGS &aPlotSettings)
void setupPlotPagePDF(PLOTTER *aPlotter, SCH_SCREEN *aScreen, 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:92
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:103
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
@ BLACK
Definition: color4d.h:44
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)
@ FILLED_SHAPE
const wxChar *const tracePathsAndFiles
Flag to enable path and file name debug output.
@ LAYER_SCHEMATIC_DRAWINGSHEET
Definition: layer_ids.h:382
@ LAYER_SCHEMATIC_BACKGROUND
Definition: layer_ids.h:376
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)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
@ RPT_SEVERITY_ERROR
@ RPT_SEVERITY_INFO
@ RPT_SEVERITY_ACTION
static const wxChar * plot_sheet_list(HPGL_PAGE_SIZE aSize)
Definition: sch_plotter.cpp:44
@ 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:111
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.