Ipelib

- Main Page
- Related Pages
- Modules
- Classes

- Class List
- Class Hierarchy
- Class Members

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 Cascade * | cascade () const
Vector | center () const
Vector | pos () const
Vector | unsnappedPos () const
Vector | globalPos () const
Vector | simpleSnapPos () const
const Snap & | snap () const
void | setInkMode (bool ink)
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 ()
Tool * | tool ()
void | update ()
void | updateTool ()
int | canvasWidth () const
int | canvasHeight () const
virtual void | setCursor (TCursor cursor, double w=1.0, Color *color=0)=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
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 | 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 PdfResources * | iResources
Fonts * | iFonts

## Member Enumeration Documentation

enum ipe::CanvasBase::TModifiers

Keyboard modifiers.

Enumerator
EShift |
EControl |
EAlt |
EMeta |
ECommand |

enum ipe::CanvasBase::TCursor

Enumerator
EStandardCursor |
EHandCursor |
ECrossCursor |
EDotCursor |

## Constructor & Destructor Documentation

CanvasBase::~CanvasBase | ( |  | ) |
| virtual

destructor.

CanvasBase::CanvasBase | ( |  | ) |
| protected

Construct a new canvas.

Referenced by ipe::CanvasObserver::canvasObserverSizeChanged().

## 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::setResources | ( | const PdfResources * | resources | ) |

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

References ipe::Fonts::New().

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

Return current pan.

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

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

Return current zoom.

Referenced by ipe::SelectTool::draw(), Canvas::scrollWheel(), ipe::SelectTool::SelectTool(), and ipe::Canvas::sizeHint().

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

Return current style sheet cascade.

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

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

Return center of canvas.

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

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

Referenced by ipe::TransformTool::mouseButton(), ipe::TransformTool::mouseMove(), ipe::CurveSegment::snapVtx(), ipe::Curve::snapVtx(), and ipe::TransformTool::TransformTool().

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

Return last unsnapped mouse position in user coordinates.

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

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

Return global mouse position of last mouse press/release.

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

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

Return snapped mouse position without angular snapping.

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

Return current snapping information.

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

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

Set ink mode.

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.

References ipe::Vector::x, and ipe::Vector::y.

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

Convert user coordinates to canvas (device) coordinates.

References ipe::Vector::x, and ipe::Vector::y.

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

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.

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

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.

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

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

Matrix mapping user coordinates to canvas coordinates.

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

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 | ( |  | ) |

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

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

void CanvasBase::update | ( |  | ) |

Mark for update with redrawing of objects.

Referenced by Canvas::scrollWheel().

void CanvasBase::updateTool | ( |  | ) |

Mark for update with redrawing of tool only.

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

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.

Referenced by ipe::PanTool::PanTool(), ipe::SelectTool::SelectTool(), and ipe::TransformTool::TransformTool().

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.

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

Referenced by ipe::PageSelector::PageSelector().

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

Implemented in ipe::Canvas.

void CanvasBase::drawPaper | ( | cairo_t * | cc | ) |
| protected

References ipe::Layout::iOrigin, ipe::Layout::iPaperSize, ipe::Vector::x, and ipe::Vector::y.

void CanvasBase::drawFrame | ( | cairo_t * | cc | ) |
| protected

References ipe::Layout::iFrameSize, ipe::Vector::x, and ipe::Vector::y.

void CanvasBase::drawAxes | ( | cairo_t * | cc | ) |
| protected

References ipe::Vector::x, and ipe::Vector::y.

void CanvasBase::drawGrid | ( | cairo_t * | cc | ) |
| protected

References ipe::Vector::x, ipe::Vector::y, and ipe::Vector::ZERO.

void CanvasBase::drawObjects | ( | cairo_t * | cc | ) |
| protected

References ipe::Attribute::BACKGROUND(), ipe::Text::draw(), ipe::Object::draw(), ipe::Symbol::iObject, ipe::Layout::iOrigin, ipe::Layout::iPaperSize, ipe::Painter::popMatrix(), ipe::Painter::pushMatrix(), ipe::CairoPainter::setDimmed(), ipe::Vector::x, and ipe::Vector::y.

void CanvasBase::drawTool | ( | Painter & | painter | ) |
| protected

Draw the current canvas tool.

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

References ipe::EPrimarySelected, ipe::ESecondarySelected, ipe::Painter::setPen(), and ipe::Painter::setStroke().

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

void CanvasBase::snapToPaperAndFrame | ( |  | ) |
| protected

References ipe::Rect::bottomLeft(), ipe::Rect::bottomRight(), ipe::Snap::ESnapBd, ipe::Snap::ESnapVtx, ipe::Layout::iFrameSize, ipe::Layout::paper(), ipe::Vector::snap(), ipe::Rect::topLeft(), ipe::Rect::topRight(), and ipe::Vector::ZERO.

void CanvasBase::refreshSurface | ( |  | ) |
| protected

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

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.

References ipe::Snap::ESnapAuto, ipe::Snap::ESnapNone, ipe::Vector::x, and ipe::Vector::y.

Referenced by Canvas::drawRect(), ipe::Canvas::mouseButton(), Canvas::mouseMove(), ipe::Canvas::mouseMoveEvent(), and ipe::Canvas::tabletEvent().

void CanvasBase::drawFifi | ( | cairo_t * | cr | ) |
| protected

References ipe::Snap::ESnapAngle, ipe::Snap::ESnapAuto, ipe::Snap::ESnapBd, ipe::Snap::ESnapCtl, ipe::Snap::ESnapGrid, ipe::Snap::ESnapInt, ipe::Snap::ESnapNone, and ipe::Snap::ESnapVtx.

virtual void ipe::CanvasBase::invalidate | ( |  | ) |
| protected pure virtual

Implemented in ipe::Canvas.

## Member Data Documentation

CanvasObserver* ipe::CanvasBase::iObserver
| protected

Referenced by Canvas::drawRect(), ipe::Canvas::mouseButton(), Canvas::mouseMove(), ipe::Canvas::mouseMoveEvent(), Canvas::scrollWheel(), ipe::Canvas::tabletEvent(), and ipe::Canvas::wheelEvent().

Tool* ipe::CanvasBase::iTool
| protected

Referenced by Canvas::drawRect(), Canvas::key(), ipe::Canvas::keyPressEvent(), ipe::Canvas::mouseButton(), Canvas::mouseMove(), ipe::Canvas::mouseMoveEvent(), and ipe::Canvas::tabletEvent().

const Page* ipe::CanvasBase::iPage
| protected

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

int ipe::CanvasBase::iPageNumber
| protected

int ipe::CanvasBase::iView
| protected

Referenced by Canvas::Canvas(), Canvas::drawRect(), Canvas::mouseMove(), and ipe::Canvas::~Canvas().

const Cascade* ipe::CanvasBase::iCascade
| protected

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

Style ipe::CanvasBase::iStyle
| protected

Vector ipe::CanvasBase::iPan
| protected

double ipe::CanvasBase::iZoom
| protected

Referenced by Canvas::drawRect().

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

Referenced by Canvas::drawRect(), ipe::Canvas::keyPressEvent(), ipe::Canvas::mouseButton(), and ipe::Canvas::tabletEvent().

bool ipe::CanvasBase::isInkMode
| protected

bool ipe::CanvasBase::iRepaintObjects
| protected

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

double ipe::CanvasBase::iWidth
| protected

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

double ipe::CanvasBase::iHeight
| protected

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

double ipe::CanvasBase::iBWidth
| protected

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

double ipe::CanvasBase::iBHeight
| protected

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

cairo_surface_t* ipe::CanvasBase::iSurface
| protected

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

Vector ipe::CanvasBase::iUnsnappedMousePos
| protected

Vector ipe::CanvasBase::iMousePos
| protected

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

Vector ipe::CanvasBase::iGlobalPos
| protected

Referenced by Canvas::drawRect(), ipe::Canvas::mouseButton(), and ipe::Canvas::tabletEvent().

Vector ipe::CanvasBase::iOldFifi
| protected

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

bool ipe::CanvasBase::iFifiVisible
| protected

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

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

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

bool ipe::CanvasBase::iSelectionVisible
| protected

const PdfResources* ipe::CanvasBase::iResources
| protected

Fonts* ipe::CanvasBase::iFonts
| protected

Referenced by Canvas::drawRect().

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

- ipecanvas.h
- ipecanvas.cpp
- ipeselector_cocoa.cpp
- ipeselector_gtk.cpp
- ipeselector_qt.cpp
- ipeselector_win.cpp