KiCad PCB EDA Suite
PLEDITOR_PRINTOUT Class Reference

Custom print out for printing schematics. More...

Inheritance diagram for PLEDITOR_PRINTOUT:

Public Member Functions

 PLEDITOR_PRINTOUT (PL_EDITOR_FRAME *aParent, const wxString &aTitle)
 
bool OnPrintPage (int aPageNum) override
 
bool HasPage (int aPageNum) override
 
void GetPageInfo (int *minPage, int *maxPage, int *selPageFrom, int *selPageTo) override
 
void DrawPage (int aPageNum)
 

Private Attributes

PL_EDITOR_FRAMEm_parent
 

Detailed Description

Custom print out for printing schematics.

Definition at line 45 of file dialogs_for_printing.cpp.

Constructor & Destructor Documentation

PLEDITOR_PRINTOUT::PLEDITOR_PRINTOUT ( PL_EDITOR_FRAME aParent,
const wxString &  aTitle 
)
inline

Definition at line 51 of file dialogs_for_printing.cpp.

51  :
52  wxPrintout( aTitle )
53  {
54  wxASSERT( aParent != NULL );
55  m_parent = aParent;
56  }
PL_EDITOR_FRAME * m_parent

Member Function Documentation

void PLEDITOR_PRINTOUT::DrawPage ( int  aPageNum)

Definition at line 150 of file dialogs_for_printing.cpp.

References EDA_DRAW_FRAME::DrawWorkSheet(), EDA_DRAW_FRAME::GetCanvas(), EDA_DRAW_PANEL::GetClipBox(), EDA_DRAW_FRAME::GetDrawBgColor(), PL_EDITOR_FRAME::GetPageSettings(), PL_EDITOR_FRAME::GetScreen(), BASE_SCREEN::GetZoom(), GRForceBlackPen(), GRResetPenAndBrush(), BASE_SCREEN::m_DrawOrg, BASE_SCREEN::m_IsPrinting, BASE_SCREEN::m_ScreenNumber, BASE_SCREEN::m_StartVisu, MakeColour(), MAX_VALUE, EDA_DRAW_PANEL::SetClipBox(), EDA_DRAW_FRAME::SetDrawBgColor(), BASE_SCREEN::SetZoom(), and WHITE.

151 {
152  int oldZoom;
153  wxPoint tmp_startvisu;
154  wxSize pageSizeIU; // Page size in internal units
155  wxPoint old_org;
156  EDA_RECT oldClipBox;
157  wxRect fitRect;
158  wxDC* dc = GetDC();
159  EDA_DRAW_PANEL* panel = m_parent->GetCanvas();
160  PL_EDITOR_SCREEN* screen = m_parent->GetScreen();
161 
162  // Save current scale factor, offsets, and clip box.
163  tmp_startvisu = screen->m_StartVisu;
164  oldZoom = screen->GetZoom();
165  old_org = screen->m_DrawOrg;
166 
167  oldClipBox = *panel->GetClipBox();
168 
169  // Change clip box to print the whole page.
170  #define MAX_VALUE (INT_MAX/2) // MAX_VALUE is the max we can use in an integer
171  // and that allows calculations without overflow
172  panel->SetClipBox( EDA_RECT( wxPoint( 0, 0 ), wxSize( MAX_VALUE, MAX_VALUE ) ) );
173 
174  // Change scale factor and offset to print the whole page.
175 
176  pageSizeIU = m_parent->GetPageSettings().GetSizeIU();
177  FitThisSizeToPaper( pageSizeIU );
178  fitRect = GetLogicalPaperRect();
179 
180  int xoffset = ( fitRect.width - pageSizeIU.x ) / 2;
181  int yoffset = ( fitRect.height - pageSizeIU.y ) / 2;
182 
183  OffsetLogicalOrigin( xoffset, yoffset );
184 
185  GRResetPenAndBrush( dc );
186  GRForceBlackPen( true );
187  screen->m_IsPrinting = true;
188 
189  COLOR4D bg_color = m_parent->GetDrawBgColor();
191 
192  screen->m_ScreenNumber = aPageNum;
193  m_parent->DrawWorkSheet( dc, screen, 0, IU_PER_MILS, wxEmptyString );
194 
195  m_parent->SetDrawBgColor( bg_color );
196  screen->m_IsPrinting = false;
197  panel->SetClipBox( oldClipBox );
198 
199  GRForceBlackPen( false );
200 
201  screen->m_StartVisu = tmp_startvisu;
202  screen->m_DrawOrg = old_org;
203  screen->SetZoom( oldZoom );
204 }
void GRResetPenAndBrush(wxDC *DC)
Definition: gr_basic.cpp:196
const PAGE_INFO & GetPageSettings() const override
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:299
double GetZoom() const
Function GetZoom returns the current "zoom factor", which is a measure of "internal units per device ...
virtual void SetDrawBgColor(COLOR4D aColor)
Definition: draw_frame.h:291
#define MAX_VALUE
void SetClipBox(const EDA_RECT &aRect)
wxPoint m_StartVisu
Coordinates in drawing units of the current view position (upper left corner of device) ...
wxColour MakeColour(EDA_COLOR_T aColor)
Function MakeColour returns a wxWidgets wxColor from a KiCad color index with alpha value...
Definition: colors.h:208
virtual COLOR4D GetDrawBgColor() const
Definition: draw_frame.h:286
void GRForceBlackPen(bool flagforce)
Function GRForceBlackPen.
Definition: gr_basic.cpp:271
PL_EDITOR_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
EDA_RECT * GetClipBox()
bool SetZoom(double iu_per_du)
Function SetZoom adjusts the current zoom factor.
PL_EDITOR_FRAME * m_parent
Class EDA_RECT handles the component boundary box.
wxPoint m_DrawOrg
offsets for drawing the circuit on the screen
Definition: colors.h:49
void DrawWorkSheet(wxDC *aDC, BASE_SCREEN *aScreen, int aLineWidth, double aScale, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
Function DrawWorkSheet Draws on screen the page layout with the frame and the basic inscriptions...
Definition: worksheet.cpp:77
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void PLEDITOR_PRINTOUT::GetPageInfo ( int *  minPage,
int *  maxPage,
int *  selPageFrom,
int *  selPageTo 
)
override

Definition at line 140 of file dialogs_for_printing.cpp.

142 {
143  *minPage = *selPageFrom = 1;
144  *maxPage = *selPageTo = 2;
145 }
bool PLEDITOR_PRINTOUT::HasPage ( int  aPageNum)
inlineoverride

Definition at line 59 of file dialogs_for_printing.cpp.

59 { return ( aPageNum <= 2 ); }
bool PLEDITOR_PRINTOUT::OnPrintPage ( int  aPageNum)
override

Definition at line 133 of file dialogs_for_printing.cpp.

134 {
135  DrawPage( aPageNum );
136  return true;
137 }
void DrawPage(int aPageNum)

Member Data Documentation

PL_EDITOR_FRAME* PLEDITOR_PRINTOUT::m_parent
private

Definition at line 48 of file dialogs_for_printing.cpp.


The documentation for this class was generated from the following file: