51 wxASSERT( aParent !=
nullptr );
56 bool HasPage(
int aPageNum )
override {
return ( aPageNum <= 2 ); }
57 void GetPageInfo(
int* minPage,
int* maxPage,
int* selPageFrom,
int* selPageTo )
override;
72 const wxString& aTitle,
const wxPoint& aPos = wxDefaultPosition,
73 const wxSize& aSize = wxDefaultSize ) :
74 wxPreviewFrame( aPreview, aParent, aTitle, aPos, aSize )
79 bool Show(
bool show )
override
92 s_pos = wxDefaultPosition;
101 ret = wxPreviewFrame::Show( show );
107 s_pos = GetPosition();
109 ret = wxPreviewFrame::Show( show );
122 DECLARE_EVENT_TABLE()
147 int* selPageFrom,
int* selPageTo )
149 *minPage = *selPageFrom = 1;
150 *maxPage = *selPageTo = 2;
169 FitThisSizeToPaper( pageSizeIU );
170 fitRect = GetLogicalPaperRect();
172 int xoffset = ( fitRect.width - pageSizeIU.x ) / 2;
173 int yoffset = ( fitRect.height - pageSizeIU.y ) / 2;
175 OffsetLogicalOrigin( xoffset, yoffset );
205 m_parent->SetDrawBgColor( bg_color );
214 m_parent->GetCanvas()->DisplayDrawingSheet();
219 wxPageSetupDialogData* aPageSetupData )
223 wxPrintDialogData printDialogData( *aPrintData );
224 printDialogData.SetMaxPage( pageCount );
227 printDialogData.EnablePageNumbers(
true );
229 wxPrinter printer( &printDialogData );
232 if( !printer.Print( aCaller, &printout,
true ) )
234 if( wxPrinter::GetLastError() == wxPRINTER_ERROR )
235 wxMessageBox(
_(
"An error occurred attempting to print the drawing sheet." ),
236 _(
"Printing" ), wxOK );
240 *aPageSetupData = printer.GetPrintDialogData().GetPrintData();
249 wxString title =
_(
"Preview" );
250 wxPrintPreview* preview =
new wxPrintPreview(
new PLEDITOR_PRINTOUT( aCaller, title ),
254 preview->SetZoom( 70 );
constexpr EDA_IU_SCALE drawSheetIUScale
Handles how to draw a screen (a board, a schematic ...)
void SetVirtualPageNumber(int aPageNumber)
VECTOR2I m_DrawOrg
offsets for drawing the circuit on the screen
VECTOR2I m_StartVisu
Coordinates in drawing units of the current view position (upper left corner of device)
This class handle bitmap images in KiCad.
void SetPixelSizeIu(double aPixSize)
Drawing sheet structure type definitions.
Handle the graphic items list to draw/plot the frame and title block.
static DS_DATA_MODEL & GetTheInstance()
Return the instance of DS_DATA_MODEL used in the application.
A color representation with 4 components: red, green, blue, alpha.
Store page-layout-specific render settings.
void SetDefaultPenWidth(int aWidth)
void SetLayerColor(int aLayer, const COLOR4D &aColor)
Change the color used to draw a layer.
void SetPrintDC(wxDC *aDC)
Custom print preview frame.
PLEDITOR_PREVIEW_FRAME(wxPrintPreview *aPreview, PL_EDITOR_FRAME *aParent, const wxString &aTitle, const wxPoint &aPos=wxDefaultPosition, const wxSize &aSize=wxDefaultSize)
bool Show(bool show) override
PL_EDITOR_FRAME * m_parent
Custom print out for printing schematics.
bool OnPrintPage(int aPageNum) override
PL_EDITOR_FRAME * m_parent
void PrintPage(int aPageNum)
PLEDITOR_PRINTOUT(PL_EDITOR_FRAME *aParent, const wxString &aTitle)
bool HasPage(int aPageNum) override
void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo) override
The main window used in the drawing sheet editor.
int InvokeDialogPrintPreview(PL_EDITOR_FRAME *aCaller, wxPrintData *aPrintData)
Create and show a print preview dialog returns 1 if OK, 0 , there is a problem.
int InvokeDialogPrint(PL_EDITOR_FRAME *aCaller, wxPrintData *aPrintData, wxPageSetupDialogData *aPageSetupData)
Create and show a print dialog returns 1 if OK, 0 , there is a problem.
void GRForceBlackPen(bool flagforce)
void GRResetPenAndBrush(wxDC *DC)
@ LAYER_DRAWINGSHEET
Sheet frame and title block.
VECTOR2< int32_t > VECTOR2I
wxSize ToWxSize(const VECTOR2I &aSize)