74 wxASSERT( aParent !=
NULL );
79 bool HasPage(
int page )
override;
81 void GetPageInfo(
int* minPage,
int* maxPage,
int* selPageFrom,
int* selPageTo )
override;
94 const wxString& aTitle,
const wxPoint& aPos = wxDefaultPosition,
95 const wxSize& aSize = wxDefaultSize ) :
96 wxPreviewFrame( aPreview, aParent, aTitle, aPos, aSize )
100 bool Show(
bool show )
override 108 ret = wxPreviewFrame::Show( show );
117 s_pos = GetPosition();
119 ret = wxPreviewFrame::Show( show );
180 int minwidth = width;
186 int pos =
m_colorTheme->Append( settings->GetName(), static_cast<void*>( settings ) );
188 if( settings->GetFilename() == target )
191 m_colorTheme->GetTextExtent( settings->GetName(), &width, &height );
192 minwidth = std::max( minwidth, width );
195 m_colorTheme->SetMinSize( wxSize( minwidth + 50, -1 ) );
203 pageSetupDialogData.SetPaperId( pageInfo.
GetPaperId() );
215 pageSetupDialogData.GetPrintData().SetOrientation( pageInfo.
GetWxOrientation() );
262 pageSetupDialog.ShowModal();
275 wxString title =
_(
"Preview" );
280 preview->SetZoom( 100 );
283 frame->SetMinSize( wxSize( 550, 350 ) );
287 frame->SetSize( (
m_parent->GetSize() * 2) / 3 );
293 frame->SetExtraStyle( frame->GetExtraStyle() | wxTOPLEVEL_EX_DIALOG );
301 frame->InitializeWithModality( wxPreviewFrame_WindowModal );
310 if(
Pgm().m_Printing )
312 DisplayError(
this,
_(
"Previous print job not yet complete." ) );
321 printDialogData.SetMaxPage( sheet_count );
323 if( sheet_count > 1 )
324 printDialogData.EnablePageNumbers(
true );
326 wxPrinter printer( &printDialogData );
329 Pgm().m_Printing =
true;
331 if( !printer.Print(
this, &printout,
true ) )
333 if( wxPrinter::GetLastError() == wxPRINTER_ERROR )
334 DisplayError(
this,
_(
"An error occurred attempting to print the schematic." ) );
341 Pgm().m_Printing =
false;
351 wxCHECK_MSG( page >= 1 && page <= (
int)sheetList.size(),
false,
352 wxT(
"Cannot print invalid page number." ) );
354 wxCHECK_MSG( sheetList[ page - 1].LastScreen() !=
NULL,
false,
355 wxT(
"Cannot print page with NULL screen." ) );
358 msg.Printf(
_(
"Print page %d" ), page );
378 *minPage = *selPageFrom = 1;
391 if( !wxPrintout::OnBeginDocument( startPage, endPage ) )
403 wxPoint tmp_startvisu;
423 FitThisSizeToPaper( pageSizeIU );
425 fitRect = GetLogicalPaperRect();
430 int xoffset = ( fitRect.width - pageSizeIU.x ) / 2;
431 int yoffset = ( fitRect.height - pageSizeIU.y ) / 2;
433 if( dc->CanUseTransformMatrix() )
435 wxAffineMatrix2D matrix = dc->GetTransformMatrix();
438 if( ( fitRect.width > fitRect.height ) != ( pageSizeIU.x > pageSizeIU.y ) )
441 xoffset = ( fitRect.height - pageSizeIU.x ) / 2;
442 yoffset = ( fitRect.width - pageSizeIU.y ) / 2;
445 matrix.Translate( xoffset, yoffset );
446 dc->SetTransformMatrix( matrix );
456 OffsetLogicalOrigin( xoffset, yoffset );
459 dc->SetLogicalFunction( wxCOPY );
477 GRSFilledRect(
nullptr, dc, fitRect.GetX(), fitRect.GetY(), fitRect.GetRight(),
478 fitRect.GetBottom(), 0, bgColor, bgColor );
487 renderSettings.LoadColors( theme );
500 renderSettings.SetIsPrinting(
true );
502 aScreen->
Print( &renderSettings );
517 return dlg.ShowModal();
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
void OnMonochromeChecked(wxCommandEvent &event) override
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
void GRResetPenAndBrush(wxDC *DC)
const wxString & GetFileName() const
wxCheckBox * m_checkBackgroundColor
wxPrintOrientation GetWxOrientation() const
void GRSFilledRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, int aWidth, COLOR4D aColor, COLOR4D aBgColor)
Implementation of conversion functions that require both schematic and board internal units.
This file is part of the common library.
int GetHeightMils() const
wxString GetFilename() const
virtual void SetDrawBgColor(COLOR4D aColor)
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
wxString color_theme
Color theme to use for printing.
wxCheckBox * m_checkUseColorTheme
bool title_block
Whether or not to print title block.
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
Schematic editor (Eeschema) main window.
bool TransferDataFromWindow() override
SCH_PREVIEW_FRAME(wxPrintPreview *aPreview, wxWindow *aParent, const wxString &aTitle, const wxPoint &aPos=wxDefaultPosition, const wxSize &aSize=wxDefaultSize)
bool use_theme
If false, display color theme will be used.
void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo) override
void UpdateAllScreenReferences()
Update all the symbol references for this sheet path.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
const PAGE_INFO & GetPageSettings() const
wxButton * m_sdbSizer1Cancel
bool monochrome
Whether or not to print in monochrome.
wxPaperSize GetPaperId() const
wxCheckBox * m_checkMonochrome
EESCHEMA_SETTINGS * eeconfig() const
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCH_EDIT_FRAME * m_parent
wxPoint m_StartVisu
Coordinates in drawing units of the current view position (upper left corner of device)
void PrintPage(SCH_SCREEN *aScreen)
Custom print out for printing schematics.
int InvokeDialogPrintUsingPrinter(SCH_EDIT_FRAME *aCaller)
Create and show DIALOG_PRINT_USING_PRINTER and return whatever DIALOG_PRINT_USING_PRINTER::ShowModal(...
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
void GRForceBlackPen(bool flagforce)
Function GRForceBlackPen.
Describe the page size and margins of a paper page on which to eventually print or plot.
bool OnPrintPage(int page) override
int Mils2mm(double x)
Convert mils to mm.
Class DIALOG_PRINT_USING_PRINTER_BASE.
void OnUseColorThemeChecked(wxCommandEvent &event) override
SCHEMATIC & Schematic() const
wxCheckBox * m_checkReference
Custom schematic print preview frame.
SCH_PRINTOUT(SCH_EDIT_FRAME *aParent, const wxString &aTitle)
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
wxPageSetupDialogData & GetPageSetupData()
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).
COLOR4D GetDrawBgColor() const override
wxStdDialogButtonSizer * m_sdbSizer1
COLOR_SETTINGS * GetColorSettings() const override
Returns a pointer to the active color theme settings.
bool background
Whether or not to print background color.
SETTINGS_MANAGER * GetSettingsManager()
void OnPageSetup(wxCommandEvent &event) override
bool TransferDataToWindow() override
int CountSheets() const
Count the number of sheets found in "this" sheet including all of the subsheets.
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
COLOR4D GetColor(int aLayer) const
~DIALOG_PRINT_USING_PRINTER() override
bool Show(bool show) override
SCH_SCREEN * LastScreen()
void Print(const RENDER_SETTINGS *aSettings)
Print all the items in the screen to aDC.
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
bool OnBeginDocument(int startPage, int endPage) override
wxPoint m_DrawOrg
offsets for drawing the circuit on the screen
SCH_RENDER_SETTINGS Stores schematic-specific render settings.
void OnPrintPreview(wxCommandEvent &event) override
wxButton * m_sdbSizer1Apply
Color settings are a bit different than most of the settings objects in that there can be more than o...
SCH_SHEET_PATH & GetCurrentSheet() const
drawingsheet frame and titleblock
DIALOG_PRINT_USING_PRINTER(SCH_EDIT_FRAME *aParent)
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
SCH_EDIT_FRAME * m_parent
bool HasPage(int page) override
void SetPrintDC(wxDC *aDC)
wxString m_ColorTheme
Active color theme name.
A color representation with 4 components: red, green, blue, alpha.