42 #include <wx/msgdlg.h> 57 wxASSERT( aParent !=
nullptr );
62 bool HasPage(
int aPageNum )
override {
return ( aPageNum <= 2 ); }
63 void GetPageInfo(
int* minPage,
int* maxPage,
int* selPageFrom,
int* selPageTo )
override;
77 const wxString& aTitle,
const wxPoint& aPos = wxDefaultPosition,
78 const wxSize& aSize = wxDefaultSize ) :
79 wxPreviewFrame( aPreview, aParent, aTitle, aPos, aSize )
84 bool Show(
bool show )
override 97 s_pos = wxDefaultPosition;
106 ret = wxPreviewFrame::Show( show );
112 s_pos = GetPosition();
114 ret = wxPreviewFrame::Show( show );
125 DECLARE_EVENT_TABLE()
144 PrintPage( aPageNum );
150 int* selPageFrom,
int* selPageTo )
152 *minPage = *selPageFrom = 1;
153 *maxPage = *selPageTo = 2;
159 wxPoint tmp_startvisu;
173 FitThisSizeToPaper( pageSizeIU );
174 fitRect = GetLogicalPaperRect();
176 int xoffset = ( fitRect.width - pageSizeIU.x ) / 2;
177 int yoffset = ( fitRect.height - pageSizeIU.y ) / 2;
179 OffsetLogicalOrigin( xoffset, yoffset );
201 BITMAP_BASE* bitmap = static_cast<DS_DATA_ITEM_BITMAP*>( dataItem )->m_ImageBitmap;
222 wxPageSetupDialogData* aPageSetupData )
226 wxPrintDialogData printDialogData( *aPrintData );
227 printDialogData.SetMaxPage( pageCount );
230 printDialogData.EnablePageNumbers(
true );
232 wxPrinter printer( &printDialogData );
235 if( !printer.Print( aCaller, &printout,
true ) )
237 if( wxPrinter::GetLastError() == wxPRINTER_ERROR )
238 wxMessageBox(
_(
"An error occurred attempting to print the drawing sheet." ),
239 _(
"Printing" ), wxOK );
243 *aPageSetupData = printer.GetPrintDialogData().GetPrintData();
252 wxString title =
_(
"Preview" );
253 wxPrintPreview* preview =
new wxPrintPreview(
new PLEDITOR_PRINTOUT( aCaller, title ),
257 preview->SetZoom( 70 );
void GRResetPenAndBrush(wxDC *DC)
Handle the graphic items list to draw/plot the frame and title block.
void SetVirtualPageNumber(int aPageNumber)
PL_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
const PAGE_INFO & GetPageSettings() const override
Implementation of conversion functions that require both schematic and board internal units.
bool OnPrintPage(int aPageNum) override
void PrintPage(int aPageNum)
void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo) override
The main window used in the drawing sheet editor.
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.
int InvokeDialogPrintPreview(PL_EDITOR_FRAME *aCaller, wxPrintData *aPrintData)
Create and show a print preview dialog returns 1 if OK, 0 , there is a problem.
std::vector< DS_DATA_ITEM * > & GetItems()
void DisplayDrawingSheet()
Build and update the list of WS_DRAW_ITEM_xxx showing the frame layout.
bool Show(bool show) override
Store page-layout-specific render settings.
This class handle bitmap images in KiCad.
wxPoint m_StartVisu
Coordinates in drawing units of the current view position (upper left corner of device)
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
void GRForceBlackPen(bool flagforce)
Handles how to draw a screen (a board, a schematic ...)
Custom print preview frame.
bool HasPage(int aPageNum) override
void SetLayerColor(int aLayer, const COLOR4D &aColor)
Change the color used to draw a layer.
PLEDITOR_PRINTOUT(PL_EDITOR_FRAME *aParent, const wxString &aTitle)
drawingsheet frame and titleblock
void PrintDrawingSheet(const RENDER_SETTINGS *aSettings, BASE_SCREEN *aScreen, double aMils2Iu, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
Prints the drawing-sheet (frame and title block).
void SetPixelSizeIu(double aPixSize)
PLEDITOR_PREVIEW_FRAME(wxPrintPreview *aPreview, PL_EDITOR_FRAME *aParent, const wxString &aTitle, const wxPoint &aPos=wxDefaultPosition, const wxSize &aSize=wxDefaultSize)
PL_EDITOR_FRAME * m_parent
Drawing sheet structure type definitions.
wxPoint m_DrawOrg
offsets for drawing the circuit on the screen
Custom print out for printing schematics.
virtual COLOR4D GetDrawBgColor() const
void SetDefaultPenWidth(int aWidth)
PL_EDITOR_FRAME * m_parent
void SetPrintDC(wxDC *aDC)
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual void SetDrawBgColor(const COLOR4D &aColor)
A color representation with 4 components: red, green, blue, alpha.