45 #include <wx/msgdlg.h> 59 wxASSERT( aParent !=
NULL );
64 bool HasPage(
int aPageNum )
override {
return ( aPageNum <= 2 ); }
65 void GetPageInfo(
int* minPage,
int* maxPage,
int* selPageFrom,
int* selPageTo )
override;
79 const wxString& aTitle,
const wxPoint& aPos = wxDefaultPosition,
80 const wxSize& aSize = wxDefaultSize ) :
81 wxPreviewFrame( aPreview, aParent, aTitle, aPos, aSize )
86 bool Show(
bool show )
override 98 s_pos = wxDefaultPosition;
107 ret = wxPreviewFrame::Show( show );
113 s_pos = GetPosition();
115 ret = wxPreviewFrame::Show( show );
125 DECLARE_EVENT_TABLE()
144 PrintPage( aPageNum );
150 int* selPageFrom,
int* selPageTo )
152 *minPage = *selPageFrom = 1;
153 *maxPage = *selPageTo = 2;
161 wxPoint tmp_startvisu;
175 FitThisSizeToPaper( pageSizeIU );
176 fitRect = GetLogicalPaperRect();
178 int xoffset = ( fitRect.width - pageSizeIU.x ) / 2;
179 int yoffset = ( fitRect.height - pageSizeIU.y ) / 2;
181 OffsetLogicalOrigin( xoffset, yoffset );
203 BITMAP_BASE* bitmap = static_cast<DS_DATA_ITEM_BITMAP*>( dataItem )->m_ImageBitmap;
224 wxPageSetupDialogData* aPageSetupData )
228 wxPrintDialogData printDialogData( *aPrintData );
229 printDialogData.SetMaxPage( pageCount );
232 printDialogData.EnablePageNumbers(
true );
234 wxPrinter printer( &printDialogData );
237 if( !printer.Print( aCaller, &printout,
true ) )
239 if( wxPrinter::GetLastError() == wxPRINTER_ERROR )
240 wxMessageBox(
_(
"An error occurred attempting to print the page layout." ),
241 _(
"Printing" ), wxOK );
245 *aPageSetupData = printer.GetPrintDialogData().GetPrintData();
254 wxString title =
_(
"Preview" );
255 wxPrintPreview* preview =
new wxPrintPreview(
new PLEDITOR_PRINTOUT( aCaller, title ),
259 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
PL_EDITOR_FRAME is 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.
virtual void SetDrawBgColor(COLOR4D aColor)
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()
bool Show(bool show) override
void DisplayWorksheet()
Build and update the list of WS_DRAW_ITEM_xxx showing the frame layout.
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)
Function GRForceBlackPen.
Handles how to draw a screen (a board, a schematic ...)
Custom print preview frame.
bool HasPage(int aPageNum) override
Helper dialog and control classes.
void SetLayerColor(int aLayer, const COLOR4D &aColor)
Change the color used to draw a layer.
PLEDITOR_PRINTOUT(PL_EDITOR_FRAME *aParent, const wxString &aTitle)
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
drawingsheet frame and titleblock
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.
A color representation with 4 components: red, green, blue, alpha.