Ipelib

- Main Page
- Modules
- Classes

- Class List
- Class Hierarchy
- Class Members

Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes

# ipe::CanvasBase Class Reference

`#include <ipecanvas.h>`

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

List of all members.

## Classes

- struct Style

## Public Types

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

## Public Member Functions

- virtual ~CanvasBase ()
- void setPage (const Page *page, int pno, int view, const Cascade *sheet)
- void setFontPool (const FontPool *fontPool)
- Vector pan () const
- double zoom () const
- const Cascade * cascade () const
- Vector center () const
- Vector pos () const
- Vector unsnappedPos () const
- Vector globalPos () const
- Vector simpleSnapPos () const
- const Snap & snap () const
- int additionalModifiers () const
- void setAdditionalModifiers (int mod)
- 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 ()
- void update ()
- void updateTool ()
- int canvasWidth () const
- int canvasHeight () const
- virtual void setCursor (TCursor cursor, double w=1.0, Color *color=0)=0

## 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)
- bool snapToPaperAndFrame ()
- void refreshSurface ()
- void computeFifi (double x, double y)
- virtual void invalidate ()=0
- virtual void invalidate (int x, int y, int w, int h)=0

## Protected Attributes

- CanvasObserver * iObserver
- Tool * iTool
- const Page * iPage
- int iPageNumber
- int iView
- const Cascade * iCascade
- Style iStyle
- Vector iPan
- double iZoom
- Snap iSnap
- bool iDimmed
- bool iAutoSnap
- Vector iAutoOrigin
- int iAdditionalModifiers
- bool iRepaintObjects
- int iWidth
- int iHeight
- cairo_surface_t * iSurface
- Vector iUnsnappedMousePos
- Vector iMousePos
- Vector iGlobalPos
- Vector iOldFifi
- bool iFifiVisible
- bool iSelectionVisible
- Fonts * iFonts

## Member Enumeration Documentation

enum ipe::CanvasBase::TModifiers

Keyboard modifiers.

Enumerator:

  EShift |
  EControl |
  EAlt |
  EMeta |

enum ipe::CanvasBase::TCursor

Enumerator:

  EStandardCursor |
  EHandCursor |
  ECrossCursor |
  EDotCursor |

## Constructor & Destructor Documentation

CanvasBase::~CanvasBase | ( |  | ) | `[virtual]`

destructor.

CanvasBase::CanvasBase | ( |  | ) | `[protected]`

Construct a new canvas.

## Member Function Documentation

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.

void CanvasBase::setFontPool | ( | const FontPool * | fontPool | ) |

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

Vector ipe::CanvasBase::pan | ( |  | ) | const`[inline]`

Return current pan.

double ipe::CanvasBase::zoom | ( |  | ) | const`[inline]`

Return current zoom.

const Cascade* ipe::CanvasBase::cascade | ( |  | ) | const`[inline]`

Return current style sheet cascade.

Vector ipe::CanvasBase::center | ( |  | ) | const`[inline]`

Return center of canvas.

Vector ipe::CanvasBase::pos | ( |  | ) | const`[inline]`

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

Vector ipe::CanvasBase::unsnappedPos | ( |  | ) | const`[inline]`

Return last unsnapped mouse position in user coordinates.

Vector ipe::CanvasBase::globalPos | ( |  | ) | const`[inline]`

Return global mouse position of last mouse press/release.

Vector CanvasBase::simpleSnapPos | ( |  | ) | const

Return snapped mouse position without angular snapping.

const Snap& ipe::CanvasBase::snap | ( |  | ) | const`[inline]`

Return current snapping information.

int ipe::CanvasBase::additionalModifiers | ( |  | ) | const`[inline]`

Return current additional modifiers.

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.

Vector CanvasBase::devToUser | ( | const Vector & | arg | ) | const

Convert canvas (device) coordinates to user coordinates.

Vector CanvasBase::userToDev | ( | const Vector & | arg | ) | const

Convert user coordinates to canvas (device) coordinates.

void CanvasBase::setCanvasStyle | ( | const Style & | style | ) |

Set style of canvas drawing.

Includes paper color, pretty text, and grid.

Style ipe::CanvasBase::canvasStyle | ( |  | ) | const`[inline]`

Return canvas style.

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.

void CanvasBase::setZoom | ( | double | zoom | ) |

Set current zoom factor.

The zoom factor maps user coordinates to screen pixel coordinates.

void CanvasBase::setSnap | ( | const Snap & | s | ) |

Set the snapping information.

void CanvasBase::setDimmed | ( | bool | dimmed | ) |

Dim whole canvas, except for the Tool.

This mode will be reset when the Tool finishes.

void CanvasBase::setAutoOrigin | ( | const Vector & | v | ) |

Enable automatic angular snapping with this origin.

Matrix CanvasBase::canvasTfm | ( |  | ) | const

Matrix mapping user coordinates to canvas coordinates.

void CanvasBase::setObserver | ( | CanvasObserver * | observer | ) |

Set an observer.

Use 0 to delete current observer.

void CanvasBase::setFifiVisible | ( | bool | visible | ) |

Set whether Fifi should be shown.

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

void CanvasBase::setSelectionVisible | ( | bool | visible | ) |

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

void CanvasBase::setTool | ( | Tool * | tool | ) |

Set a new tool.

Calls canvasObserverToolChanged().

void CanvasBase::finishTool | ( |  | ) |

void CanvasBase::update | ( |  | ) |

Mark for update with redrawing of objects.

void CanvasBase::updateTool | ( |  | ) |

Mark for update with redrawing of tool only.

int ipe::CanvasBase::canvasWidth | ( |  | ) | const`[inline]`

int ipe::CanvasBase::canvasHeight | ( |  | ) | const`[inline]`

virtual void ipe::CanvasBase::setCursor | ( | TCursor | cursor,
|  | double | w = `1.0`,
|  | Color * | color = `0`
| ) |  | `[pure virtual]`

Implemented in ipe::Canvas.

void CanvasBase::drawPaper | ( | cairo_t * | cc | ) | `[protected]`

void CanvasBase::drawFrame | ( | cairo_t * | cc | ) | `[protected]`

void CanvasBase::drawAxes | ( | cairo_t * | cc | ) | `[protected]`

void CanvasBase::drawGrid | ( | cairo_t * | cc | ) | `[protected]`

void CanvasBase::drawObjects | ( | cairo_t * | cc | ) | `[protected]`

void CanvasBase::drawTool | ( | Painter & | painter | ) | `[protected]`

Draw the current canvas tool.

If no tool is set, it draws the selected objects.

bool CanvasBase::snapToPaperAndFrame | ( |  | ) | `[protected]`

void CanvasBase::refreshSurface | ( |  | ) | `[protected]`

void CanvasBase::computeFifi | ( | double | x,
|  | double | y
| ) |  | `[protected]`

Stores the mouse position in iUnsnappedMousePos, computes Fifi if snapping is enabled, and stores snapped position in iMousePos.

virtual void ipe::CanvasBase::invalidate | ( |  | ) | `[protected, pure virtual]`

Implemented in ipe::Canvas.

virtual void ipe::CanvasBase::invalidate | ( | int | x,
|  | int | y,
|  | int | w,
|  | int | h
| ) |  | `[protected, pure virtual]`

Implemented in ipe::Canvas.

## Member Data Documentation

CanvasObserver* ipe::CanvasBase::iObserver`[protected]`

Tool* ipe::CanvasBase::iTool`[protected]`

const Page* ipe::CanvasBase::iPage`[protected]`

int ipe::CanvasBase::iPageNumber`[protected]`

int ipe::CanvasBase::iView`[protected]`

const Cascade* ipe::CanvasBase::iCascade`[protected]`

Style ipe::CanvasBase::iStyle`[protected]`

Vector ipe::CanvasBase::iPan`[protected]`

double ipe::CanvasBase::iZoom`[protected]`

Snap ipe::CanvasBase::iSnap`[protected]`

bool ipe::CanvasBase::iDimmed`[protected]`

bool ipe::CanvasBase::iAutoSnap`[protected]`

Vector ipe::CanvasBase::iAutoOrigin`[protected]`

int ipe::CanvasBase::iAdditionalModifiers`[protected]`

bool ipe::CanvasBase::iRepaintObjects`[protected]`

int ipe::CanvasBase::iWidth`[protected]`

int ipe::CanvasBase::iHeight`[protected]`

cairo_surface_t* ipe::CanvasBase::iSurface`[protected]`

Vector ipe::CanvasBase::iUnsnappedMousePos`[protected]`

Vector ipe::CanvasBase::iMousePos`[protected]`

Vector ipe::CanvasBase::iGlobalPos`[protected]`

Vector ipe::CanvasBase::iOldFifi`[protected]`

bool ipe::CanvasBase::iFifiVisible`[protected]`

bool ipe::CanvasBase::iSelectionVisible`[protected]`

Fonts* ipe::CanvasBase::iFonts`[protected]`

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

- ipecanvas.h
- ipecanvas.cpp