38#include <wx/dcprint.h>
40#include <wx/dcmemory.h>
47 wxASSERT( aParent !=
nullptr );
55 *minPage = *selPageFrom = 1;
68 if( !wxPrintout::OnBeginDocument( startPage, endPage ) )
80 wxCHECK_MSG( page >= 1 && page <= (
int)sheetList.size(),
false,
81 wxT(
"Cannot print invalid page number." ) );
83 wxCHECK_MSG( sheetList[ page - 1].LastScreen() !=
nullptr,
false,
84 wxT(
"Cannot print page with NULL screen." ) );
87 msg.Printf(
_(
"Print page %d" ), page );
137 std::unique_ptr<KIGFX::SCH_PAINTER> painter = std::make_unique<KIGFX::SCH_PAINTER>( gal );
149 wxSize dcPPI = dc->GetPPI();
152 pageSizePix = GetLogicalPageRect();
155 dc->SetUserScale( 1, 1 );
157 if( wxMemoryDC* memdc =
dynamic_cast<wxMemoryDC*
>( dc ) )
159 wxBitmap& bm = memdc->GetSelectedBitmap();
160 pageSizePix = wxRect( 0, 0, bm.GetWidth(), bm.GetHeight() );
168 const VECTOR2D pageSizeIn( (
double) pageSizePix.width / dcPPI.x,
169 (
double) pageSizePix.height / dcPPI.y );
172 galPrint->SetSheetSize( pageSizeIn );
175 view->SetPainter( painter.get() );
177 view->SetScale( 1.0 );
202 bgColor = COLOR4D::WHITE;
247 view->SetLayerVisible( i,
true );
267 double scaleX = (double) pageSizeIU.
x / drawingAreaBBox.
GetWidth();
268 double scaleY = (double) pageSizeIU.
y / drawingAreaBBox.
GetHeight();
270 double print_scale = std::min( scaleX, scaleY );
281 gal->
ResizeScreen( pageSizePix.GetWidth(),pageSizePix.GetHeight() );
286 view->UseDrawPriority(
true );
constexpr EDA_IU_SCALE schIUScale
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
int GetVirtualPageNumber() const
const wxString & GetPageNumber() const
constexpr size_type GetWidth() const
constexpr Vec Centre() const
constexpr size_type GetHeight() const
Color settings are a bit different than most of the settings objects in that there can be more than o...
COLOR4D GetColor(int aLayer) const
void SetPageNumber(const std::string &aPageNumber)
Change the page number displayed in the title block.
void SetIsFirstPage(bool aIsFirstPage)
Change if this is first page.
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
A base class for most all the KiCad significant classes used in schematics and boards.
A color representation with 4 components: red, green, blue, alpha.
COLOR4D WithAlpha(double aAlpha) const
Return a color with the same color, but the given alpha.
CAIRO_ANTIALIASING_MODE cairo_antialiasing_mode
The grid style to draw the grid in.
static std::unique_ptr< GAL_PRINT > Create(GAL_DISPLAY_OPTIONS &aOptions, wxDC *aDC)
Abstract interface for drawing on a 2D-surface.
virtual void ResizeScreen(int aWidth, int aHeight)
Resize the canvas.
void SetZoomFactor(double aZoomFactor)
void SetLookAtPoint(const VECTOR2D &aPoint)
Get/set the Point in world space to look at.
virtual void ClearScreen()
Clear the screen.
void SetWorldUnitLength(double aWorldUnitLength)
Set the unit length.
void SetClearColor(const COLOR4D &aColor)
const VECTOR2I & GetScreenPixelSize() const
Return GAL canvas size in pixels.
virtual bool HasNativeLandscapeRotation() const =0
void SetLayerColor(int aLayer, const COLOR4D &aColor)
Change the color used to draw a layer.
void SetDefaultFont(const wxString &aFont)
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
void SetPrintBlackAndWhite(bool aPrintBlackAndWhite)
void SetIsPrinting(bool isPrinting)
DS_PROXY_VIEW_ITEM * GetDrawingSheet() const
static constexpr int VIEW_MAX_LAYERS
Maximum number of layers that may be shown.
std::unique_ptr< VIEW > DataReference() const
Return a new VIEW object that shares the same set of VIEW_ITEMs and LAYERs.
const VECTOR2D GetSizeIU(double aIUScale) const
Gets the page size in internal units.
virtual SETTINGS_MANAGER & GetSettingsManager() const
SCH_SHEET_LIST Hierarchy() const
Return the full schematic flattened hierarchical sheet list.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
EESCHEMA_SETTINGS * eeconfig() const
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Returns a pointer to the active color theme settings.
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
Schematic editor (Eeschema) main window.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCH_SHEET_PATH & GetCurrentSheet() const
SCHEMATIC & Schematic() const
void RecomputeIntersheetRefs()
Update the schematic's page reference map for all global labels, and refresh the labels so that they ...
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
Base class for any item which can be embedded within the SCHEMATIC container class,...
bool HasPage(int page) override
bool OnPrintPage(int page) override
void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo) override
SCH_PRINTOUT(SCH_EDIT_FRAME *aParent, const wxString &aTitle)
const KIGFX::SCH_VIEW * m_view
SCH_EDIT_FRAME * m_parent
Source VIEW object (note that actual printing only refers to this object)
bool PrintPage(SCH_SCREEN *aScreen, wxDC *aDC, bool aForPrinting)
Print the current SCH_SCREEN using a given wxDC.
bool OnBeginDocument(int startPage, int endPage) override
bool m_OverrideItemColors
void SetBackgroundColor(const COLOR4D &aColor) override
Set the background color.
const KIGFX::COLOR4D & GetBackgroundColor() const override
Return current background color settings.
bool m_ShowPinsElectricalType
void LoadColors(const COLOR_SETTINGS *aSettings) override
const PAGE_INFO & GetPageSettings() const
bool CheckIfOnDrawList(const SCH_ITEM *aItem) const
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
void SortByPageNumbers(bool aUpdateVirtualPageNums=true)
Sort the list of sheets by page number.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
void UpdateAllScreenReferences() const
Update all the symbol references for this sheet path.
SCH_SCREEN * LastScreen()
int CountSheets() const
Count the number of sheets found in "this" sheet including all of the subsheets.
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieve a color settings object that applications can read colors from.
#define LAYER_ID_COUNT
Must update this if you add any enums after Gerbview!
@ LAYER_DRAWINGSHEET
Sheet frame and title block.
@ LAYER_SELECT_OVERLAY
Selected items overlay.
@ LAYER_SCHEMATIC_DRAWINGSHEET
@ LAYER_SCHEMATIC_BACKGROUND
@ TARGET_NONCACHED
Auxiliary rendering target (noncached)
PGM_BASE & Pgm()
The global program "get" accessor.
constexpr double SCH_WORLD_UNIT(1e-7/0.0254)
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
bool monochrome
Whether or not to print in monochrome.
bool background
Whether or not to print background color.
wxString color_theme
Color theme to use for printing.
bool title_block
Whether or not to print title block.
bool use_theme
If false, display color theme will be used.
VECTOR2< int32_t > VECTOR2I
#define ZOOM_MIN_LIMIT_EESCHEMA
#define ZOOM_MAX_LIMIT_EESCHEMA