wxMaxima
Loading...
Searching...
No Matches
Public Member Functions
RenderContext Class Reference

The state of the current worksheet render pass. More...

#include <RenderContext.h>

Public Member Functions

 RenderContext (const RenderContext &o)
 
RenderContextoperator= (const RenderContext &)=delete
 
wxDC * GetRecalcDC () const
 The dc "recalculate" (measuring text) currently draws to.
 
void SetRecalcDC (wxDC *dc)
 Tells us which dc to measure text sizes on.
 
void AttachWorksheetDC (wxWindow *worksheet)
 Creates a client DC for the given window and measures text on it.
 
void DetachWorksheetDC ()
 Drops the worksheet client DC created by AttachWorksheetDC() again.
 
wxSize GetCanvasSize () const
 The size of the worksheet's visible window.
 
void SetCanvasSize (wxSize siz)
 Sets the size of the worksheet's visible window.
 
wxRect GetUpdateRegion () const
 The rectangle of the worksheet that is currently being redrawn.
 
void SetUpdateRegion (wxRect rect)
 Sets the rectangle of the worksheet that is currently being redrawn.
 
wxRect GetVisibleRegion () const
 The rectangle of the worksheet that is currently visible.
 
void SetVisibleRegion (wxRect visibleRegion)
 Sets the rectangle of the worksheet that is currently visible.
 
bool Printing () const
 Are we currently rendering for the printer rather than the screen?
 
void SetPrinting (bool printing)
 Sets whether we are currently rendering for the printer.
 
void ClearAndEnableRedrawTracing ()
 Starts (or restarts) recording which cells this render pass has drawn.
 
void NotifyOfCellRedraw (const Cell *cell)
 Records that this cell has been drawn, if tracing is enabled.
 
template<typename Report >
void ReportMultipleRedraws (Report report)
 Calls report(count, cell) for each cell that was drawn more than once.
 
bool ClipToDrawRegion () const
 Do we want to omit drawing outside the current update region?
 
void ClipToDrawRegion (bool clipToDrawRegion)
 Whether to omit drawing outside the current update region.
 
wxPoint GetWorksheetPosition () const
 Where is the worksheet to be drawn?
 
void SetWorksheetPosition (wxPoint worksheetPosition)
 Sets where the worksheet is to be drawn.
 
wxBrush GetBackgroundBrush () const
 The brush the worksheet's background is painted with.
 
void SetBackgroundBrush (const wxBrush &brush)
 Sets the brush the worksheet's background is painted with.
 
void SetLayoutDeadline (int seconds)
 Starts a layout deadline this many seconds in the future.
 
void ClearLayoutCancelled ()
 Stops the layout deadline and clears the cancelled flag.
 
bool IsLayoutCancelled () const
 Has the current layout pass exceeded its deadline?
 

Detailed Description

The state of the current worksheet render pass.

Pure state: this class knows nothing about the configuration store, the worksheet or the cells (the redraw trace holds Cell pointers, but only as opaque keys). Copying a RenderContext (for printing, the diff viewer etc.) copies the geometry, the printing flag and the recalc-DC pointer but neither the owned worksheet client DC (the copy doesn't own the window), a running layout deadline, a redraw trace nor the worksheet-size-adjust request (all of which belong to the original's render pass).

Member Function Documentation

◆ AttachWorksheetDC()

void RenderContext::AttachWorksheetDC ( wxWindow *  worksheet)
inline

Creates a client DC for the given window and measures text on it.

Used when a worksheet is attached: measuring on the worksheet's own DC makes the measurements match what drawing on it will produce.

◆ ReportMultipleRedraws()

template<typename Report >
void RenderContext::ReportMultipleRedraws ( Report  report)
inline

Calls report(count, cell) for each cell that was drawn more than once.

The cells are opaque keys to this class; formatting the report is the caller's business. Sorting the trace is over two orders of magnitude faster, per cell, than having counters in a map or hash.


The documentation for this class was generated from the following file: