wxMaxima
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Data Fields | Static Public Attributes
wxm::PageSettings Struct Reference

The paper a worksheet is printed or exported to PDF on. More...

#include <PageSettings.h>

Public Member Functions

bool operator== (const PageSettings &) const =default
 
wxRealPoint PaperSizeMm () const
 The size of the paper in mm, as it is oriented.
 
wxRealPoint PrintableSizeMm () const
 The size of the part of the paper inside the margins, in mm.
 
wxRealPoint PrintableSizeAt96Dpi () const
 The size of the printable area in the worksheet's unzoomed pixels.
 
PageSettings & Sanitize ()
 Makes the values sensible: margins between 0 and 100 mm, a scale between 0.1 and 4, a layout resolution between 72 and 4800 dpi, a paper size wxWidgets knows.
 
wxString ToXMLAttributes () const
 The attributes a .wxmx's root element stores these settings in.
 

Static Public Member Functions

static std::optional< PageSettings > FromXML (const wxXmlNode *root)
 The settings a .wxmx's root element stores, if it stores any.
 
static wxString PaperName (wxPaperSize paper)
 The paper's name in the language of the user interface ("A4 sheet, 210 x 297 mm")
 

Data Fields

wxPaperSize paper = wxPAPER_A4
 The paper size, as wxWidgets' print dialog knows it.
 
wxPrintOrientation orientation = wxPORTRAIT
 Portrait or landscape.
 
double marginTop = 10
 The margins, in mm.
 
double marginBottom = 10
 
double marginLeft = 10
 
double marginRight = 10
 
double scale = 1.0
 Makes everything on paper bigger (> 1) or smaller (< 1)
 
long layoutDpi = DefaultLayoutDpi
 The printer resolution text is measured for, in dots per inch.
 

Static Public Attributes

static constexpr long DefaultLayoutDpi = 600
 The layoutDpi a document without one gets: the commonest printer resolution.
 

Detailed Description

The paper a worksheet is printed or exported to PDF on.

The user's configuration holds a default (Configuration::DefaultPageSettings()), and a document may carry settings of its own, saved in its .wxmx (Configuration::DocumentPageSettings()). Printing, the PDF export and the page view (Configuration::PageView()) all use the document's settings if it has any, else the default ones (Configuration::PageSettingsInUse()).

The margins are in millimetres. The scale makes everything on the paper bigger or smaller, as the "Print scale" always did.

Member Function Documentation

◆ FromXML()

std::optional< PageSettings > wxm::PageSettings::FromXML ( const wxXmlNode *  root)
static

The settings a .wxmx's root element stores, if it stores any.

Returns
std::nullopt if the document has no page settings of its own (no "page_paper" attribute): it uses the default ones then.

◆ PaperSizeMm()

wxRealPoint wxm::PageSettings::PaperSizeMm ( ) const

The size of the paper in mm, as it is oriented.

A paper size wxWidgets' paper database doesn't know (wxPAPER_NONE, or a value from a newer wxWidgets) is taken to be A4.

◆ PrintableSizeAt96Dpi()

wxRealPoint wxm::PageSettings::PrintableSizeAt96Dpi ( ) const

The size of the printable area in the worksheet's unzoomed pixels.

wxMaxima's sizes are meant for a 96 dpi screen (see Printout), and the scale makes everything on paper bigger, which leaves less of the worksheet's pixels room on a page. Multiplied by the zoom factor this is how wide and tall a page is in the worksheet.

◆ PrintableSizeMm()

wxRealPoint wxm::PageSettings::PrintableSizeMm ( ) const

The size of the part of the paper inside the margins, in mm.

Never less than 10 mm in either direction, however big the margins are, so that something can always be printed.

◆ Sanitize()

PageSettings & wxm::PageSettings::Sanitize ( )

Makes the values sensible: margins between 0 and 100 mm, a scale between 0.1 and 4, a layout resolution between 72 and 4800 dpi, a paper size wxWidgets knows.

Reading a .wxmx someone else wrote must not produce a page nothing fits on.

◆ ToXMLAttributes()

wxString wxm::PageSettings::ToXMLAttributes ( ) const

The attributes a .wxmx's root element stores these settings in.

Starts with a space; each attribute's name starts with "page_", which no older wxMaxima reads, so older versions just ignore it.

Field Documentation

◆ layoutDpi

long wxm::PageSettings::layoutDpi = DefaultLayoutDpi

The printer resolution text is measured for, in dots per inch.

Every text engine rounds the width of each character to whole device pixels, so a line is a little longer or shorter at one resolution than at another (about 0.3% between 600 and 1200 dpi). The page view, the print preview, the printout and the PDF all measure text as if printed at this resolution, whatever the real one, so they break lines and pages in the same places (Configuration::TextExtent()). Setting it to the printer's own resolution makes the printed text fit its room exactly.


The documentation for this struct was generated from the following files: