Ipelib
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ipe::CanvasBase Class Referenceabstract

#include <ipecanvas.h>

Inherited by Canvas, ipe::Canvas, ipe::Canvas, and ipe::Canvas.

Classes

struct  Style
 

Public Types

enum  TModifiers {
  EShift = 0x100 , EControl = 0x200 , EAlt = 0x400 , EMeta = 0x800 ,
  ECommand = 0x1000
}
 
enum  TCursor { EStandardCursor , EHandCursor , ECrossCursor , EDotCursor }
 

Public Member Functions

virtual ~CanvasBase ()
 
void setPage (const Page *page, int pno, int view, const Cascade *sheet)
 
void setResources (const PdfResources *resources)
 
Vector pan () const
 
double zoom () const
 
const Cascadecascade () const
 
Vector center () const
 
Vector pos () const
 
Vector unsnappedPos () const
 
Vector globalPos () const
 
Vector simpleSnapPos () const
 
const Snapsnap () const
 
void setInkMode (bool ink)
 
int additionalModifiers () const
 
void setAdditionalModifiers (int mod)
 
bool type3Font ()
 
Vector devToUser (const Vector &arg) const
 
Vector userToDev (const Vector &arg) const
 
void setCanvasStyle (const Style &style)
 
Style canvasStyle () const
 
void setPan (const Vector &v)
 
void setZoom (double zoom)
 
void setSnap (const Snap &s)
 
void setDimmed (bool dimmed)
 
void setAutoOrigin (const Vector &v)
 
Matrix canvasTfm () const
 
void setObserver (CanvasObserver *observer)
 
void setFifiVisible (bool visible)
 
void setSelectionVisible (bool visible)
 
void setTool (Tool *tool)
 
void finishTool ()
 
Tooltool ()
 
void update ()
 
void updateTool ()
 
int canvasWidth () const
 
int canvasHeight () const
 
virtual void setCursor (TCursor cursor, double w=1.0, Color *color=nullptr)=0
 
virtual void invalidate (int x, int y, int w, int h)=0
 

Static Public Member Functions

static int selectPageOrView (Document *doc, int page=-1, int startIndex=0, int pageWidth=240, int width=600, int height=480)
 

Protected Member Functions

 CanvasBase ()
 
void drawPaper (cairo_t *cc)
 
void drawFrame (cairo_t *cc)
 
void drawAxes (cairo_t *cc)
 
void drawGrid (cairo_t *cc)
 
void drawObjects (cairo_t *cc)
 
void drawTool (Painter &painter)
 
void snapToPaperAndFrame ()
 
void refreshSurface ()
 
void computeFifi (double x, double y)
 
void drawFifi (cairo_t *cr)
 
virtual void invalidate ()=0
 

Protected Attributes

CanvasObserveriObserver
 
TooliTool
 
const PageiPage
 
int iPageNumber
 
int iView
 
const CascadeiCascade
 
Style iStyle
 
Vector iPan
 
double iZoom
 
Snap iSnap
 
bool iDimmed
 
bool iAutoSnap
 
Vector iAutoOrigin
 
int iAdditionalModifiers
 
bool isInkMode
 
bool iRepaintObjects
 
double iWidth
 
double iHeight
 
double iBWidth
 
double iBHeight
 
cairo_surface_t * iSurface
 
Vector iUnsnappedMousePos
 
Vector iMousePos
 
Vector iGlobalPos
 
Vector iOldFifi
 
bool iFifiVisible
 
Snap::TSnapModes iFifiMode
 
bool iSelectionVisible
 
const PdfResourcesiResources
 
std::unique_ptr< FontsiFonts
 
bool iType3Font
 

Member Enumeration Documentation

◆ TModifiers

Keyboard modifiers.

Enumerator
EShift 
EControl 
EAlt 
EMeta 
ECommand 

◆ TCursor

Enumerator
EStandardCursor 
EHandCursor 
ECrossCursor 
EDotCursor 

Constructor & Destructor Documentation

◆ ~CanvasBase()

CanvasBase::~CanvasBase ( )
virtual

destructor.

References iSurface, and iTool.

◆ CanvasBase()

CanvasBase::CanvasBase ( )
protected

Member Function Documentation

◆ setPage()

void CanvasBase::setPage ( const Page page,
int  pno,
int  view,
const Cascade sheet 
)

Set the page to be displayed.

Doesn't take ownership of any argument. The page number pno is only needed if page numbering is turned on.

References iCascade, iPage, iPageNumber, and iView.

◆ setResources()

void CanvasBase::setResources ( const PdfResources resources)

set information about Latex fonts (from ipe::Document)

References iFonts, and iResources.

◆ pan()

Vector ipe::CanvasBase::pan ( ) const
inline

Return current pan.

References iPan.

Referenced by Canvas::magnify(), and ipe::PanTool::mouseButton().

◆ zoom()

double ipe::CanvasBase::zoom ( ) const
inline

Return current zoom.

References iZoom.

Referenced by ipe::SelectTool::draw(), ipe::SelectTool::SelectTool(), and setZoom().

◆ cascade()

const Cascade* ipe::CanvasBase::cascade ( ) const
inline

Return current style sheet cascade.

References iCascade.

Referenced by ipe::PanTool::draw().

◆ center()

Vector ipe::CanvasBase::center ( ) const
inline

Return center of canvas.

References iHeight, and iWidth.

Referenced by canvasTfm(), devToUser(), and userToDev().

◆ pos()

Vector ipe::CanvasBase::pos ( ) const
inline

Return last mouse position (snapped!) in user coordinates.

References iMousePos.

Referenced by ipe::TransformTool::mouseButton(), ipe::TransformTool::mouseMove(), simpleSnapPos(), and ipe::TransformTool::TransformTool().

◆ unsnappedPos()

Vector ipe::CanvasBase::unsnappedPos ( ) const
inline

Return last unsnapped mouse position in user coordinates.

References iUnsnappedMousePos.

Referenced by ipe::PanTool::mouseButton(), ipe::PanTool::mouseMove(), ipe::SelectTool::mouseMove(), ipe::PanTool::PanTool(), and ipe::SelectTool::SelectTool().

◆ globalPos()

Vector ipe::CanvasBase::globalPos ( ) const
inline

Return global mouse position of last mouse press/release.

References iGlobalPos.

Referenced by ipe::Canvas::tabletEvent().

◆ simpleSnapPos()

Vector CanvasBase::simpleSnapPos ( ) const

Return snapped mouse position without angular snapping.

References iPage, iSnap, ipe::Snap::iSnapDistance, iUnsnappedMousePos, iView, iZoom, pos(), and ipe::Snap::simpleSnap().

◆ snap()

const Snap& ipe::CanvasBase::snap ( ) const
inline

Return current snapping information.

References iSnap.

Referenced by ipe::TransformTool::TransformTool().

◆ setInkMode()

void ipe::CanvasBase::setInkMode ( bool  ink)
inline

Set ink mode.

References isInkMode.

◆ additionalModifiers()

int ipe::CanvasBase::additionalModifiers ( ) const
inline

Return current additional modifiers.

References iAdditionalModifiers.

◆ setAdditionalModifiers()

void CanvasBase::setAdditionalModifiers ( int  mod)

Set additional modifiers.

These modifier bits are passed to the Tool when a key is pressed or a drawing action is performed in addition to the actual keyboard modifiers.

References iAdditionalModifiers.

◆ type3Font()

bool CanvasBase::type3Font ( )

Has an attempt been made to use a Type3 font?

References iType3Font.

◆ devToUser()

Vector CanvasBase::devToUser ( const Vector arg) const

Convert canvas (device) coordinates to user coordinates.

References center(), iPan, iZoom, ipe::Vector::x, and ipe::Vector::y.

Referenced by computeFifi(), drawGrid(), and Canvas::magnify().

◆ userToDev()

Vector CanvasBase::userToDev ( const Vector arg) const

Convert user coordinates to canvas (device) coordinates.

References center(), iPan, iZoom, ipe::Vector::x, and ipe::Vector::y.

Referenced by computeFifi(), drawFifi(), and ipe::Canvas::drawFifi().

◆ setCanvasStyle()

void CanvasBase::setCanvasStyle ( const Style style)

Set style of canvas drawing.

Includes paper color, pretty text, and grid.

References iStyle.

◆ canvasStyle()

Style ipe::CanvasBase::canvasStyle ( ) const
inline

Return canvas style.

References iStyle.

◆ setPan()

void CanvasBase::setPan ( const Vector v)

Set current pan position.

The pan position is the user coordinate that is displayed at the very center of the canvas.

References iPan.

Referenced by Canvas::magnify(), and ipe::PanTool::mouseButton().

◆ setZoom()

void CanvasBase::setZoom ( double  zoom)

Set current zoom factor.

The zoom factor maps user coordinates to screen pixel coordinates.

References iZoom, and zoom().

Referenced by Canvas::magnify().

◆ setSnap()

void CanvasBase::setSnap ( const Snap s)

Set the snapping information.

References iSnap.

◆ setDimmed()

void CanvasBase::setDimmed ( bool  dimmed)

Dim whole canvas, except for the Tool.

This mode will be reset when the Tool finishes.

References iDimmed.

◆ setAutoOrigin()

void CanvasBase::setAutoOrigin ( const Vector v)

Enable automatic angular snapping with this origin.

References iAutoOrigin, and iAutoSnap.

Referenced by ipe::TransformTool::TransformTool().

◆ canvasTfm()

Matrix CanvasBase::canvasTfm ( ) const

Matrix mapping user coordinates to canvas coordinates.

References center(), iPan, and iZoom.

Referenced by Canvas::drawRect(), and ipe::Canvas::paintEvent().

◆ setObserver()

void CanvasBase::setObserver ( CanvasObserver observer)

Set an observer.

Use 0 to delete current observer.

References iObserver.

◆ setFifiVisible()

void CanvasBase::setFifiVisible ( bool  visible)

Set whether Fifi should be shown.

Fifi will only be shown if a snapping mode is active.

References iFifiVisible, and updateTool().

◆ setSelectionVisible()

void CanvasBase::setSelectionVisible ( bool  visible)

Set whether selection should be shown when there is no tool.

References iSelectionVisible, and updateTool().

◆ setTool()

void CanvasBase::setTool ( Tool tool)

Set a new tool.

Calls canvasObserverToolChanged().

References ipe::CanvasObserver::canvasObserverToolChanged(), iObserver, iTool, tool(), and updateTool().

◆ finishTool()

void CanvasBase::finishTool ( )

◆ tool()

Tool* ipe::CanvasBase::tool ( )
inline

References iTool.

Referenced by setTool().

◆ update()

void CanvasBase::update ( )

Mark for update with redrawing of objects.

References invalidate(), and iRepaintObjects.

Referenced by finishTool(), and Canvas::magnify().

◆ updateTool()

void CanvasBase::updateTool ( )

◆ canvasWidth()

int ipe::CanvasBase::canvasWidth ( ) const
inline

References iWidth.

◆ canvasHeight()

int ipe::CanvasBase::canvasHeight ( ) const
inline

References iHeight.

◆ setCursor()

virtual void ipe::CanvasBase::setCursor ( TCursor  cursor,
double  w = 1.0,
Color color = nullptr 
)
pure virtual

◆ selectPageOrView()

int CanvasBase::selectPageOrView ( Document doc,
int  page = -1,
int  startIndex = 0,
int  pageWidth = 240,
int  width = 600,
int  height = 480 
)
static

Show dialog to select a page or a view.

If page is negative (the default), shows thumbnails of all pages of the document in a dialog. If the user selects a page, the page number is returned. If the dialog is canceled, -1 is returned.

If page is non-negative, all views of this page are shown, and the selected view number is returned.

itemWidth is the width of the page thumbnails (the height is computed automatically).

If page is negative (the default), shows thumbnails of all pages of the document in a dialog. If the user selects a page, the page number is returned. If the dialog is canceled, -1 is returned.

If page is non-negative, all views of this page are shown, and the selected view number is returned.

If page is negative (the default), shows thumbnails of all pages of the document in a dialog. If the user selects a page, the page number is returned. If the dialog is canceled, -1 is returned.

If page is non-negative, all views of this page are shown, and the selected view number is returned.

pageWidth is the width of the page thumbnails (the height is computed automatically).

References ipe::Thumbnail::height(), and ipe::Thumbnail::width().

◆ invalidate() [1/2]

virtual void ipe::CanvasBase::invalidate ( int  x,
int  y,
int  w,
int  h 
)
pure virtual

Implemented in ipe::Canvas.

◆ drawPaper()

void CanvasBase::drawPaper ( cairo_t *  cc)
protected

◆ drawFrame()

void CanvasBase::drawFrame ( cairo_t *  cc)
protected

◆ drawAxes()

void CanvasBase::drawAxes ( cairo_t *  cc)
protected

◆ drawGrid()

void CanvasBase::drawGrid ( cairo_t *  cc)
protected

◆ drawObjects()

void CanvasBase::drawObjects ( cairo_t *  cc)
protected

◆ drawTool()

void CanvasBase::drawTool ( Painter painter)
protected

◆ snapToPaperAndFrame()

void CanvasBase::snapToPaperAndFrame ( )
protected

◆ refreshSurface()

void CanvasBase::refreshSurface ( )
protected

◆ computeFifi()

void CanvasBase::computeFifi ( double  x,
double  y 
)
protected

◆ drawFifi()

void CanvasBase::drawFifi ( cairo_t *  cr)
protected

◆ invalidate() [2/2]

virtual void ipe::CanvasBase::invalidate ( )
protectedpure virtual

Implemented in ipe::Canvas.

Referenced by computeFifi(), update(), and updateTool().

Member Data Documentation

◆ iObserver

CanvasObserver* ipe::CanvasBase::iObserver
protected

◆ iTool

Tool* ipe::CanvasBase::iTool
protected

◆ iPage

const Page* ipe::CanvasBase::iPage
protected

◆ iPageNumber

int ipe::CanvasBase::iPageNumber
protected

Referenced by drawObjects(), and setPage().

◆ iView

int ipe::CanvasBase::iView
protected

◆ iCascade

const Cascade* ipe::CanvasBase::iCascade
protected

◆ iStyle

Style ipe::CanvasBase::iStyle
protected

◆ iPan

Vector ipe::CanvasBase::iPan
protected

◆ iZoom

double ipe::CanvasBase::iZoom
protected

◆ iSnap

Snap ipe::CanvasBase::iSnap
protected

◆ iDimmed

bool ipe::CanvasBase::iDimmed
protected

◆ iAutoSnap

bool ipe::CanvasBase::iAutoSnap
protected

◆ iAutoOrigin

Vector ipe::CanvasBase::iAutoOrigin
protected

Referenced by computeFifi(), and setAutoOrigin().

◆ iAdditionalModifiers

int ipe::CanvasBase::iAdditionalModifiers
protected

◆ isInkMode

bool ipe::CanvasBase::isInkMode
protected

Referenced by CanvasBase(), and setInkMode().

◆ iRepaintObjects

bool ipe::CanvasBase::iRepaintObjects
protected

Referenced by CanvasBase(), refreshSurface(), and update().

◆ iWidth

double ipe::CanvasBase::iWidth
protected

◆ iHeight

double ipe::CanvasBase::iHeight
protected

◆ iBWidth

double ipe::CanvasBase::iBWidth
protected

◆ iBHeight

double ipe::CanvasBase::iBHeight
protected

◆ iSurface

cairo_surface_t* ipe::CanvasBase::iSurface
protected

◆ iUnsnappedMousePos

Vector ipe::CanvasBase::iUnsnappedMousePos
protected

◆ iMousePos

Vector ipe::CanvasBase::iMousePos
protected

◆ iGlobalPos

Vector ipe::CanvasBase::iGlobalPos
protected

◆ iOldFifi

Vector ipe::CanvasBase::iOldFifi
protected

◆ iFifiVisible

bool ipe::CanvasBase::iFifiVisible
protected

◆ iFifiMode

Snap::TSnapModes ipe::CanvasBase::iFifiMode
protected

◆ iSelectionVisible

bool ipe::CanvasBase::iSelectionVisible
protected

◆ iResources

const PdfResources* ipe::CanvasBase::iResources
protected

◆ iFonts

std::unique_ptr<Fonts> ipe::CanvasBase::iFonts
protected

◆ iType3Font

bool ipe::CanvasBase::iType3Font
protected

Referenced by CanvasBase(), drawObjects(), and type3Font().


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