KiCad PCB EDA Suite
printout_controler.h
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) 2009 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
5  * Copyright (C) 1992-2016 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 
31 #ifndef PRINTOUT_CONTROLLER_H
32 #define PRINTOUT_CONTROLLER_H
33 
34 
35 #include <wx/dcps.h>
37 #include <wx/print.h>
38 
39 #define DEFAULT_ORIENTATION_PAPER wxLANDSCAPE // other option is wxPORTRAIT
40 
41 
48 {
49 public:
50  int m_PenDefaultSize; // The default value pen size to plot/print items
51  // that have no defined pen size
52  double m_PrintScale; // general scale when printing
53  double m_XScaleAdjust; // fine scale adjust for X axis
54  double m_YScaleAdjust; // fine scale adjust for Y axis
55  bool m_Print_Sheet_Ref; // Option: print page references
56  LSET m_PrintMaskLayer; // Layers to print
57  bool m_PrintMirror; // Option: Print mirrored
58  bool m_Print_Black_and_White; // Option: Print in B&W or Color
59  int m_OptionPrintPage; // Option: 0 = a layer per page, 1 = all layers at once
60  int m_PageCount; // Number of pages to print
61  bool m_ForceCentered; // Force plot origin to page centre (used in modedit)
62  int m_Flags; // Can be used to pass some other info
63  wxPageSetupDialogData* m_PageSetupData; // A wxPageSetupDialogData for page options (margins)
64 
69  };
70 
71  DrillShapeOptT m_DrillShapeOpt; // Options to print pads and via holes
72 
73 public:
75 
83  bool PrintBorderAndTitleBlock() const { return m_PrintScale <= 1.0 && m_Print_Sheet_Ref; }
84 
90  bool CenterOnBoardOutline() const
91  {
92  return !PrintBorderAndTitleBlock() && ( m_ForceCentered || (m_PrintScale > 1.0) ||
93  (m_PrintScale == 0) );
94  }
95 };
96 
97 
103 class BOARD_PRINTOUT_CONTROLLER : public wxPrintout
104 {
105 private:
108 
109 public:
111  EDA_DRAW_FRAME* aParent,
112  const wxString& aTitle );
113 
114  bool OnPrintPage( int aPage ) override;
115 
116  bool HasPage( int aPage ) override
117  {
118  if( aPage <= m_PrintParams.m_PageCount )
119  return true;
120  else
121  return false;
122  }
123 
124  void GetPageInfo( int* minPage, int* maxPage, int* selPageFrom, int* selPageTo ) override;
125 
134  void DrawPage( const wxString& aLayerName = wxEmptyString,
135  int aPageNum = 1, int aPageCount = 1 );
136 };
137 
138 #endif // PRINTOUT_CONTROLLER_H
BOARD_PRINTOUT_CONTROLLER(const PRINT_PARAMETERS &aParams, EDA_DRAW_FRAME *aParent, const wxString &aTitle)
Class PRINT_PARAMETERS handles the parameters used to print a board drawing.
bool PrintBorderAndTitleBlock() const
Function PrintBorderAndTitleBlock returns true if the drawing border and title block should be printe...
void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo) override
bool HasPage(int aPage) override
void DrawPage(const wxString &aLayerName=wxEmptyString, int aPageNum=1, int aPageCount=1)
Print a page ( or a set of pages ).
Class EDA_DRAW_FRAME is the base class for create windows for drawing purpose.
Definition: draw_frame.h:54
Class LSET is a set of PCB_LAYER_IDs.
bool OnPrintPage(int aPage) override
DrillShapeOptT m_DrillShapeOpt
wxPageSetupDialogData * m_PageSetupData
Board layer functions and definitions.
Class BOARD_PRINTOUT_CONTROLLER is a class derived from wxPrintout to handle the necessary informatio...
bool CenterOnBoardOutline() const
Function CenterOnBoardOutline returns true if the print should be centered by the board outline inste...