KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_print_using_printer.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) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2015-2023 KiCad Developers, see AUTHORS.TXT for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#include <pgm_base.h>
26#include <confirm.h>
27#include <sch_screen.h>
28#include <sch_edit_frame.h>
29#include <base_units.h>
30#include <math/vector2wx.h>
33#include <sch_sheet.h>
34#include <schematic.h>
35#include <sch_sheet_path.h>
37#include <sch_painter.h>
38#include <wx/print.h>
39#include <wx/printdlg.h>
40
41
43{
44public:
47
48protected:
49 void OnOutputChoice( wxCommandEvent& event ) override;
50 void OnUseColorThemeChecked( wxCommandEvent& event ) override;
51
52private:
53 bool TransferDataToWindow() override;
54 bool TransferDataFromWindow() override;
55
56 void OnPageSetup( wxCommandEvent& event ) override;
57 void OnPrintPreview( wxCommandEvent& event ) override;
58
59 void SavePrintOptions();
60
62};
63
64
65
69class SCH_PRINTOUT : public wxPrintout
70{
71public:
72 SCH_PRINTOUT( SCH_EDIT_FRAME* aParent, const wxString& aTitle ) :
73 wxPrintout( aTitle )
74 {
75 wxASSERT( aParent != nullptr );
76 m_parent = aParent;
77 }
78
79 bool OnPrintPage( int page ) override;
80 bool HasPage( int page ) override;
81 bool OnBeginDocument( int startPage, int endPage ) override;
82 void GetPageInfo( int* minPage, int* maxPage, int* selPageFrom, int* selPageTo ) override;
83 void PrintPage( SCH_SCREEN* aScreen );
84
85private:
87};
88
89
94class SCH_PREVIEW_FRAME : public wxPreviewFrame
95{
96public:
97 SCH_PREVIEW_FRAME( wxPrintPreview* aPreview, wxWindow* aParent,
98 const wxString& aTitle, const wxPoint& aPos = wxDefaultPosition,
99 const wxSize& aSize = wxDefaultSize ) :
100 wxPreviewFrame( aPreview, aParent, aTitle, aPos, aSize )
101 {
102 }
103
104 bool Show( bool show ) override
105 {
106 bool ret;
107
108 // Show or hide the window. If hiding, save current position and size.
109 // If showing, use previous position and size.
110 if( show )
111 {
112 ret = wxPreviewFrame::Show( show );
113
114 if( s_size.x != 0 && s_size.y != 0 )
115 SetSize( s_pos.x, s_pos.y, s_size.x, s_size.y, 0 );
116 }
117 else
118 {
119 // Save the dialog's position & size before hiding
120 s_size = GetSize();
121 s_pos = GetPosition();
122
123 ret = wxPreviewFrame::Show( show );
124 }
125
126 return ret;
127 }
128
129private:
130 static wxPoint s_pos;
131 static wxSize s_size;
132};
133
134
137
138
141 m_parent( aParent )
142{
143 wxASSERT( aParent );
144
145 SetupStandardButtons( { { wxID_OK, _( "Print" ) },
146 { wxID_APPLY, _( "Print Preview" ) },
147 { wxID_CANCEL, _( "Close" ) } } );
148
149#ifdef __WXMAC__
150 // Problems with modal on wx-2.9 - Anyway preview is standard for OSX
151 m_sdbSizer1Apply->Hide();
152#endif
153
154 m_sdbSizer1OK->SetFocus();
155
157}
158
159
161{
163}
164
165
167{
169
170 if( cfg->m_Printing.monochrome )
171 {
172 m_checkBackgroundColor->SetValue( false );
173 m_checkBackgroundColor->Enable( false );
174 }
175
176 m_checkReference->SetValue( cfg->m_Printing.title_block );
177 m_colorPrint->SetSelection( cfg->m_Printing.monochrome ? 1 : 0 );
179 m_checkUseColorTheme->SetValue( cfg->m_Printing.use_theme );
180
181 m_colorTheme->Clear();
182
183 int width = 0;
184 int height = 0;
185 int minwidth = width;
186
187 wxString target = cfg->m_Printing.use_theme ? cfg->m_Printing.color_theme : cfg->m_ColorTheme;
188
189 for( COLOR_SETTINGS* settings : Pgm().GetSettingsManager().GetColorSettingsList() )
190 {
191 int pos = m_colorTheme->Append( settings->GetName(), static_cast<void*>( settings ) );
192
193 if( settings->GetFilename() == target )
194 m_colorTheme->SetSelection( pos );
195
196 m_colorTheme->GetTextExtent( settings->GetName(), &width, &height );
197 minwidth = std::max( minwidth, width );
198 }
199
200 m_colorTheme->SetMinSize( wxSize( minwidth + 50, -1 ) );
201
202 m_colorTheme->Enable( cfg->m_Printing.use_theme );
203
204 // Initialize page specific print setup dialog settings.
205 const PAGE_INFO& pageInfo = m_parent->GetScreen()->GetPageSettings();
206 wxPageSetupDialogData& pageSetupDialogData = m_parent->GetPageSetupData();
207
208 pageSetupDialogData.SetPaperId( pageInfo.GetPaperId() );
209
210 if( pageInfo.IsCustom() )
211 {
212 if( pageInfo.IsPortrait() )
213 pageSetupDialogData.SetPaperSize( wxSize( EDA_UNIT_UTILS::Mils2mm( pageInfo.GetWidthMils() ),
214 EDA_UNIT_UTILS::Mils2mm( pageInfo.GetHeightMils() ) ) );
215 else
216 pageSetupDialogData.SetPaperSize( wxSize( EDA_UNIT_UTILS::Mils2mm( pageInfo.GetHeightMils() ),
217 EDA_UNIT_UTILS::Mils2mm( pageInfo.GetWidthMils() ) ) );
218 }
219
220 pageSetupDialogData.GetPrintData().SetOrientation( pageInfo.GetWxOrientation() );
221
222 Layout();
223
224 return true;
225}
226
227
229{
230 m_colorTheme->Enable( m_checkUseColorTheme->GetValue() );
231}
232
233
235{
236 long sel = event.GetSelection();
237 m_checkBackgroundColor->Enable( sel == 0 );
238
239 if( sel )
240 m_checkBackgroundColor->SetValue( false );
241 else
243}
244
245
247{
249
250 cfg->m_Printing.monochrome = !!m_colorPrint->GetSelection();
251 cfg->m_Printing.title_block = m_checkReference->IsChecked();
252
253 if( m_checkBackgroundColor->IsEnabled() )
254 cfg->m_Printing.background = m_checkBackgroundColor->IsChecked();
255 else
256 cfg->m_Printing.background = false;
257
258 cfg->m_Printing.use_theme = m_checkUseColorTheme->IsChecked();
259
260 COLOR_SETTINGS* theme = static_cast<COLOR_SETTINGS*>(
261 m_colorTheme->GetClientData( m_colorTheme->GetSelection() ) );
262
263 if( theme && m_checkUseColorTheme->IsChecked() )
264 cfg->m_Printing.color_theme = theme->GetFilename();
265}
266
267
268void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event )
269{
270 wxPageSetupDialog pageSetupDialog( this, &m_parent->GetPageSetupData() );
271 pageSetupDialog.ShowModal();
272
273 m_parent->GetPageSetupData() = pageSetupDialog.GetPageSetupDialogData();
274}
275
276
278{
280
281 // Pass two printout objects: for preview, and possible printing.
282 wxString title = _( "Preview" );
283 wxPrintPreview* preview = new wxPrintPreview( new SCH_PRINTOUT( m_parent, title ),
284 new SCH_PRINTOUT( m_parent, title ),
285 &m_parent->GetPageSetupData().GetPrintData() );
286
287 preview->SetZoom( 100 );
288
289 SCH_PREVIEW_FRAME* frame = new SCH_PREVIEW_FRAME( preview, this, title );
290
291 // On wxGTK, set the flag wxTOPLEVEL_EX_DIALOG is mandatory, if we want
292 // close the frame using the X box in caption, when the preview frame is run
293 // from a dialog
294 frame->SetExtraStyle( frame->GetExtraStyle() | wxTOPLEVEL_EX_DIALOG );
295
296 // We use here wxPreviewFrame_WindowModal option to make the wxPrintPreview frame
297 // modal for its caller only.
298 // another reason is the fact when closing the frame without this option,
299 // all top level frames are reenabled.
300 // With this option, only the parent is reenabled.
301 // Reenabling all top level frames should be made by the parent dialog.
302 frame->InitializeWithModality( wxPreviewFrame_WindowModal );
303
304 // on first invocation in this runtime session, set to 3/4 size of parent,
305 // but will be changed in Show() if not first time as will position.
306 // Must be called after InitializeWithModality because otherwise in some wxWidget
307 // versions it is not always taken in account
308 frame->SetMinSize( wxSize( 650, 500 ) );
309 frame->SetSize( (m_parent->GetSize() * 3) / 4 );
310
311 frame->Raise(); // Needed on Ubuntu/Unity to display the frame
312 frame->Show( true );
313}
314
315
317{
318 if( Pgm().m_Printing )
319 {
320 DisplayError( this, _( "Previous print job not yet complete." ) );
321 return false;
322 }
323
325
326 int sheet_count = m_parent->Schematic().Root().CountSheets();
327
328 wxPrintData data = m_parent->GetPageSetupData().GetPrintData();
329
330#if defined( __WXGTK__ ) && !wxCHECK_VERSION( 3, 2, 3 )
331 // In GTK, the default bottom margin is bigger by 0.31 inches for
332 // Letter, Legal, A4 paper sizes (see gtk_paper_size_get_default_bottom_margin).
333 //
334 // wxWidgets doesn't handle this properly when paper is in
335 // landscape orientation.
336 //
337 // Using custom page size avoids the problematic
338 // gtk_page_setup_set_paper_size_and_default_margins call in wxWidgets.
339
340 wxPaperSize paperId = data.GetPaperId();
341 const wxChar* paperType = nullptr;
342
343 // clang-format off
344 std::set<wxPaperSize> letterSizes = {
345 // na_letter
346 wxPAPER_LETTER,
347 wxPAPER_LETTERSMALL,
348 wxPAPER_NOTE,
349 wxPAPER_LETTER_TRANSVERSE,
350 wxPAPER_LETTER_ROTATED
351 };
352
353 std::set<wxPaperSize> legalSizes = {
354 // na_legal
355 wxPAPER_LEGAL
356 };
357
358 std::set<wxPaperSize> a4Sizes = {
359 // iso_a4
360 wxPAPER_A4,
361 wxPAPER_A4SMALL,
362 wxPAPER_A4_TRANSVERSE,
363 wxPAPER_A4_ROTATED
364 };
365 // clang-format on
366
367 if( letterSizes.count( paperId ) )
368 paperType = PAGE_INFO::USLetter;
369 else if( legalSizes.count( paperId ) )
370 paperType = PAGE_INFO::USLegal;
371 else if( a4Sizes.count( paperId ) )
372 paperType = PAGE_INFO::A4;
373
374 if( paperType )
375 {
376 PAGE_INFO pageInfo( paperType, data.GetOrientation() == wxPORTRAIT );
377
378 if( pageInfo.IsPortrait() )
379 data.SetPaperSize( wxSize( EDA_UNIT_UTILS::Mils2mm( pageInfo.GetWidthMils() ),
380 EDA_UNIT_UTILS::Mils2mm( pageInfo.GetHeightMils() ) ) );
381 else
382 data.SetPaperSize( wxSize( EDA_UNIT_UTILS::Mils2mm( pageInfo.GetHeightMils() ),
383 EDA_UNIT_UTILS::Mils2mm( pageInfo.GetWidthMils() ) ) );
384
385 data.SetOrientation( pageInfo.GetWxOrientation() );
386 data.SetPaperId( wxPAPER_NONE );
387 }
388#endif
389
390 wxPrintDialogData printDialogData( data );
391 printDialogData.SetMaxPage( sheet_count );
392
393 if( sheet_count > 1 )
394 printDialogData.EnablePageNumbers( true );
395
396 wxPrinter printer( &printDialogData );
397 SCH_PRINTOUT printout( m_parent, _( "Print Schematic" ) );
398
399 Pgm().m_Printing = true;
400 {
401 if( !printer.Print( this, &printout, true ) )
402 {
403 if( wxPrinter::GetLastError() == wxPRINTER_ERROR )
404 DisplayError( this, _( "An error occurred attempting to print the schematic." ) );
405 }
406 else
407 {
408 m_parent->GetPageSetupData() = printer.GetPrintDialogData().GetPrintData();
409 }
410 }
411
412 Pgm().m_Printing = false;
413
414 return true;
415}
416
417
419{
421
422 wxCHECK_MSG( page >= 1 && page <= (int)sheetList.size(), false,
423 wxT( "Cannot print invalid page number." ) );
424
425 wxCHECK_MSG( sheetList[ page - 1].LastScreen() != nullptr, false,
426 wxT( "Cannot print page with NULL screen." ) );
427
428 wxString msg;
429 msg.Printf( _( "Print page %d" ), page );
430 m_parent->SetMsgPanel( msg, wxEmptyString );
431
432 SCH_SCREEN* screen = m_parent->GetScreen();
433 SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet();
434 m_parent->SetCurrentSheet( sheetList[ page - 1 ] );
438 screen = m_parent->GetCurrentSheet().LastScreen();
439 PrintPage( screen );
440 m_parent->SetCurrentSheet( oldsheetpath );
443
444 return true;
445}
446
447
448void SCH_PRINTOUT::GetPageInfo( int* minPage, int* maxPage, int* selPageFrom, int* selPageTo )
449{
450 *minPage = *selPageFrom = 1;
451 *maxPage = *selPageTo = m_parent->Schematic().Root().CountSheets();
452}
453
454
455bool SCH_PRINTOUT::HasPage( int pageNum )
456{
457 return m_parent->Schematic().Root().CountSheets() >= pageNum;
458}
459
460
461bool SCH_PRINTOUT::OnBeginDocument( int startPage, int endPage )
462{
463 if( !wxPrintout::OnBeginDocument( startPage, endPage ) )
464 return false;
465
466 return true;
467}
468
469
470/*
471 * This is the real print function: print the active screen
472 */
474{
475 // Warning:
476 // When printing many pages, changes in the current wxDC will affect all next printings
477 // because all prints are using the same wxPrinterDC after creation
478 // So be careful and reinit parameters, especially when using offsets.
479
480 VECTOR2I tmp_startvisu;
481 wxSize pageSizeIU; // Page size in internal units
482 VECTOR2I old_org;
483 wxRect fitRect;
484 wxDC* dc = GetDC();
485
486 wxBusyCursor dummy;
487
488 // Save current offsets and clip box.
489 tmp_startvisu = aScreen->m_StartVisu;
490 old_org = aScreen->m_DrawOrg;
491
492 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
495
496 // Change scale factor and offset to print the whole page.
497 bool printDrawingSheet = cfg->m_Printing.title_block;
498
499 pageSizeIU = ToWxSize( aScreen->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS ) );
500 FitThisSizeToPaper( pageSizeIU );
501
502 fitRect = GetLogicalPaperRect();
503
504 // When is the actual paper size does not match the schematic page size, the drawing will
505 // not be centered on X or Y axis. Give a draw offset to center the schematic page on the
506 // paper draw area.
507 int xoffset = ( fitRect.width - pageSizeIU.x ) / 2;
508 int yoffset = ( fitRect.height - pageSizeIU.y ) / 2;
509
510 // Using a wxAffineMatrix2D has a big advantage: it handles different pages orientations
511 //(PORTRAIT/LANDSCAPE), but the affine matrix is not always supported
512 if( dc->CanUseTransformMatrix() )
513 {
514 wxAffineMatrix2D matrix; // starts from a unity matrix (the current wxDC default)
515
516 // Check for portrait/landscape mismatch:
517 if( ( fitRect.width > fitRect.height ) != ( pageSizeIU.x > pageSizeIU.y ) )
518 {
519 // Rotate the coordinates, and keep the draw coordinates inside the page
520 matrix.Rotate( M_PI_2 );
521 matrix.Translate( 0, -pageSizeIU.y );
522
523 // Recalculate the offsets and page sizes according to the page rotation
524 std::swap( pageSizeIU.x, pageSizeIU.y );
525 FitThisSizeToPaper( pageSizeIU );
526 fitRect = GetLogicalPaperRect();
527
528 xoffset = ( fitRect.width - pageSizeIU.x ) / 2;
529 yoffset = ( fitRect.height - pageSizeIU.y ) / 2;
530
531 // All the coordinates will be rotated 90 deg when printing,
532 // so the X,Y offset vector must be rotated -90 deg before printing
533 std::swap( xoffset, yoffset );
534 std::swap( fitRect.width, fitRect.height );
535 yoffset = -yoffset;
536 }
537
538 matrix.Translate( xoffset, yoffset );
539 dc->SetTransformMatrix( matrix );
540
541 fitRect.x -= xoffset;
542 fitRect.y -= yoffset;
543 }
544 else
545 {
546 SetLogicalOrigin( 0, 0 ); // Reset all offset settings made previously.
547 // When printing previous pages (all prints are using the same wxDC)
548 OffsetLogicalOrigin( xoffset, yoffset );
549 }
550
551 dc->SetLogicalFunction( wxCOPY );
552 GRResetPenAndBrush( dc );
553
554 COLOR4D savedBgColor = m_parent->GetDrawBgColor();
556
557 if( cfg->m_Printing.background )
558 {
559 if( cfg->m_Printing.use_theme && theme )
560 bgColor = theme->GetColor( LAYER_SCHEMATIC_BACKGROUND );
561 }
562 else
563 {
564 bgColor = COLOR4D::WHITE;
565 }
566
567 m_parent->SetDrawBgColor( bgColor );
568
569 GRSFilledRect( dc, fitRect.GetX(), fitRect.GetY(), fitRect.GetRight(), fitRect.GetBottom(), 0,
570 bgColor, bgColor );
571
572 if( cfg->m_Printing.monochrome )
573 GRForceBlackPen( true );
574
576 renderSettings.SetPrintDC( dc );
577
578 if( cfg->m_Printing.use_theme && theme )
579 renderSettings.LoadColors( theme );
580
581 renderSettings.SetBackgroundColor( bgColor );
582
583 // The drawing-sheet-item print code is shared between PCBNew and Eeschema, so it's easier
584 // if they just use the PCB layer.
585 renderSettings.SetLayerColor( LAYER_DRAWINGSHEET,
587
588 renderSettings.SetDefaultFont( cfg->m_Appearance.default_font );
589
590 if( printDrawingSheet )
591 {
592 m_parent->PrintDrawingSheet( &renderSettings, aScreen, aScreen->Schematic()->GetProperties(),
593 schIUScale.IU_PER_MILS, aScreen->GetFileName(), wxEmptyString );
594 }
595
596 renderSettings.SetIsPrinting( true );
597
598 aScreen->Print( &renderSettings );
599
600 m_parent->SetDrawBgColor( savedBgColor );
601
602 GRForceBlackPen( false );
603
604 aScreen->m_StartVisu = tmp_startvisu;
605 aScreen->m_DrawOrg = old_org;
606}
607
608
610{
611 DIALOG_PRINT_USING_PRINTER dlg( aCaller );
612
613 return dlg.ShowModal();
614}
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:172
VECTOR2I m_DrawOrg
offsets for drawing the circuit on the screen
Definition: base_screen.h:88
VECTOR2I m_StartVisu
Coordinates in drawing units of the current view position (upper left corner of device)
Definition: base_screen.h:93
Color settings are a bit different than most of the settings objects in that there can be more than o...
COLOR4D GetColor(int aLayer) const
Class DIALOG_PRINT_USING_PRINTER_BASE.
void OnPrintPreview(wxCommandEvent &event) override
DIALOG_PRINT_USING_PRINTER(SCH_EDIT_FRAME *aParent)
void OnUseColorThemeChecked(wxCommandEvent &event) override
void OnPageSetup(wxCommandEvent &event) override
void OnOutputChoice(wxCommandEvent &event) override
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
virtual void SetDrawBgColor(const COLOR4D &aColor)
void PrintDrawingSheet(const RENDER_SETTINGS *aSettings, BASE_SCREEN *aScreen, const std::map< wxString, wxString > *aProperties, double aMils2Iu, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
Prints the drawing-sheet (frame and title block).
wxString GetFilename() const
Definition: json_settings.h:73
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
void SetLayerColor(int aLayer, const COLOR4D &aColor)
Change the color used to draw a layer.
void SetDefaultFont(const wxString &aFont)
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
void SetPrintDC(wxDC *aDC)
void SetIsPrinting(bool isPrinting)
Store schematic specific render settings.
Definition: sch_painter.h:71
void SetBackgroundColor(const COLOR4D &aColor) override
Set the background color.
Definition: sch_painter.h:94
void LoadColors(const COLOR_SETTINGS *aSettings) override
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:53
static const wxChar USLetter[]
Definition: page_info.h:73
static const wxChar USLegal[]
Definition: page_info.h:74
static const wxChar A4[]
Definition: page_info.h:62
wxPrintOrientation GetWxOrientation() const
Definition: page_info.h:121
const VECTOR2I GetSizeIU(double aIUScale) const
Gets the page size in internal units.
Definition: page_info.h:161
int GetHeightMils() const
Definition: page_info.h:132
wxPaperSize GetPaperId() const
Definition: page_info.h:126
int GetWidthMils() const
Definition: page_info.h:129
bool IsCustom() const
Definition: page_info.cpp:183
bool IsPortrait() const
Definition: page_info.h:116
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:100
const std::map< wxString, wxString > * GetProperties()
Definition: schematic.h:93
SCH_SHEET & Root() const
Definition: schematic.h:105
EESCHEMA_SETTINGS * eeconfig() const
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Returns a pointer to the active color theme settings.
COLOR4D GetDrawBgColor() const override
Schematic editor (Eeschema) main window.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
wxPageSetupDialogData & GetPageSetupData()
SCH_SHEET_PATH & GetCurrentSheet() const
SCHEMATIC & Schematic() const
void RecomputeIntersheetRefs()
Update the schematic's page reference map for all global labels, and refresh the labels so that they ...
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
Custom schematic print preview frame.
bool Show(bool show) override
SCH_PREVIEW_FRAME(wxPrintPreview *aPreview, wxWindow *aParent, const wxString &aTitle, const wxPoint &aPos=wxDefaultPosition, const wxSize &aSize=wxDefaultSize)
Custom print out for printing schematics.
bool HasPage(int page) override
bool OnPrintPage(int page) override
void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo) override
SCH_PRINTOUT(SCH_EDIT_FRAME *aParent, const wxString &aTitle)
SCH_EDIT_FRAME * m_parent
void PrintPage(SCH_SCREEN *aScreen)
bool OnBeginDocument(int startPage, int endPage) override
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:131
void Print(const RENDER_SETTINGS *aSettings)
Print all the items in the screen to aDC.
const wxString & GetFileName() const
Definition: sch_screen.h:144
SCHEMATIC * Schematic() const
Definition: sch_screen.cpp:99
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
void UpdateAllScreenReferences() const
Update all the symbol references for this sheet path.
SCH_SCREEN * LastScreen()
int CountSheets() const
Count the number of sheets found in "this" sheet including all of the subsheets.
Definition: sch_sheet.cpp:784
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:280
This file is part of the common library.
int InvokeDialogPrintUsingPrinter(SCH_EDIT_FRAME *aCaller)
Create and show DIALOG_PRINT_USING_PRINTER and return whatever DIALOG_PRINT_USING_PRINTER::ShowModal(...
#define _(s)
void GRForceBlackPen(bool flagforce)
Definition: gr_basic.cpp:159
void GRResetPenAndBrush(wxDC *DC)
Definition: gr_basic.cpp:73
void GRSFilledRect(wxDC *aDC, int x1, int y1, int x2, int y2, int aWidth, const COLOR4D &aColor, const COLOR4D &aBgColor)
Definition: gr_basic.cpp:422
@ LAYER_DRAWINGSHEET
drawingsheet frame and titleblock
Definition: layer_ids.h:218
@ LAYER_SCHEMATIC_DRAWINGSHEET
Definition: layer_ids.h:388
@ LAYER_SCHEMATIC_BACKGROUND
Definition: layer_ids.h:382
KICOMMON_API int Mils2mm(double aVal)
Convert mils to mm.
Definition: eda_units.cpp:62
SETTINGS_MANAGER * GetSettingsManager()
see class PGM_BASE
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:115
std::vector< FAB_LAYER_COLOR > dummy
bool monochrome
Whether or not to print in monochrome.
Definition: app_settings.h:128
bool background
Whether or not to print background color.
Definition: app_settings.h:127
wxString color_theme
Color theme to use for printing.
Definition: app_settings.h:131
bool title_block
Whether or not to print title block.
Definition: app_settings.h:132
bool use_theme
If false, display color theme will be used.
Definition: app_settings.h:130
const double IU_PER_MILS
Definition: base_units.h:78
#define M_PI_2
Definition: transline.cpp:40
wxSize ToWxSize(const VECTOR2I &aSize)
Definition: vector2wx.h:55