Ipelib
|
#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) |
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 () |
Tool * | tool () |
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 | |
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 |
std::unique_ptr< Fonts > | iFonts |
bool | iType3Font |
|
protected |
Construct a new canvas.
References ipe::CanvasBase::Style::classicGrid, ipe::Snap::ESnapNone, ipe::CanvasBase::Style::gridLineColor, iAdditionalModifiers, ipe::Snap::iAngleSize, iAutoSnap, iBHeight, iBWidth, iCascade, iDimmed, ipe::Snap::iDir, iFifiMode, iFifiVisible, ipe::Snap::iGridSize, ipe::Snap::iGridVisible, iHeight, iObserver, ipe::Snap::iOrigin, iPage, iPan, ipe::IPE_PI, iRepaintObjects, iResources, iSelectionVisible, isInkMode, ipe::Snap::iSnap, iSnap, ipe::Snap::iSnapDistance, iStyle, iSurface, iTool, iType3Font, iWidth, ipe::Snap::iWithAxes, iZoom, ipe::CanvasBase::Style::numberPages, ipe::CanvasBase::Style::paperClip, ipe::CanvasBase::Style::paperColor, ipe::CanvasBase::Style::pretty, ipe::CanvasBase::Style::primarySelectionColor, ipe::CanvasBase::Style::primarySelectionWidth, ipe::CanvasBase::Style::secondarySelectionColor, ipe::CanvasBase::Style::secondarySelectionWidth, ipe::CanvasBase::Style::selectionSurroundColor, ipe::CanvasBase::Style::selectionSurroundWidth, ipe::CanvasBase::Style::thickLine, ipe::CanvasBase::Style::thickStep, ipe::CanvasBase::Style::thinLine, ipe::CanvasBase::Style::thinStep, and ipe::Vector::ZERO.
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.
void CanvasBase::setResources | ( | const PdfResources * | resources | ) |
set information about Latex fonts (from ipe::Document)
References iFonts, and iResources.
|
inline |
Return current pan.
References iPan.
Referenced by Canvas::magnify(), and ipe::PanTool::mouseButton().
|
inline |
Return current zoom.
References iZoom.
Referenced by ipe::SelectTool::draw(), ipe::SelectTool::SelectTool(), and setZoom().
|
inline |
|
inline |
Return center of canvas.
References iHeight, and iWidth.
Referenced by canvasTfm(), devToUser(), and userToDev().
|
inline |
Return last mouse position (snapped!) in user coordinates.
References iMousePos.
Referenced by ipe::TransformTool::mouseButton(), ipe::TransformTool::mouseMove(), simpleSnapPos(), and ipe::TransformTool::TransformTool().
|
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().
|
inline |
Return global mouse position of last mouse press/release.
References iGlobalPos.
Referenced by ipe::Canvas::tabletEvent().
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().
|
inline |
Return current snapping information.
References iSnap.
Referenced by ipe::TransformTool::TransformTool().
|
inline |
Set ink mode.
References isInkMode.
|
inline |
Return current additional modifiers.
References iAdditionalModifiers.
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.
bool CanvasBase::type3Font | ( | ) |
Has an attempt been made to use a Type3 font?
References iType3Font.
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().
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().
void CanvasBase::setCanvasStyle | ( | const Style & | 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.
References iPan.
Referenced by Canvas::magnify(), and ipe::PanTool::mouseButton().
void CanvasBase::setZoom | ( | double | zoom | ) |
Set current zoom factor.
The zoom factor maps user coordinates to screen pixel coordinates.
Referenced by Canvas::magnify().
void CanvasBase::setDimmed | ( | bool | dimmed | ) |
void CanvasBase::setAutoOrigin | ( | const Vector & | v | ) |
Enable automatic angular snapping with this origin.
References iAutoOrigin, and iAutoSnap.
Referenced by ipe::TransformTool::TransformTool().
Matrix CanvasBase::canvasTfm | ( | ) | const |
Matrix mapping user coordinates to canvas coordinates.
References center(), iPan, and iZoom.
Referenced by Canvas::drawRect(), and ipe::Canvas::paintEvent().
void CanvasBase::setObserver | ( | CanvasObserver * | observer | ) |
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().
void CanvasBase::setSelectionVisible | ( | bool | visible | ) |
Set whether selection should be shown when there is no tool.
References iSelectionVisible, and updateTool().
void CanvasBase::setTool | ( | Tool * | tool | ) |
Set a new tool.
Calls canvasObserverToolChanged().
References ipe::CanvasObserver::canvasObserverToolChanged(), iObserver, iTool, tool(), and updateTool().
void CanvasBase::finishTool | ( | ) |
void CanvasBase::update | ( | ) |
Mark for update with redrawing of objects.
References invalidate(), and iRepaintObjects.
Referenced by finishTool(), and Canvas::magnify().
void CanvasBase::updateTool | ( | ) |
Mark for update with redrawing of tool only.
References invalidate().
Referenced by ipe::SelectTool::key(), ipe::PanTool::mouseMove(), ipe::SelectTool::mouseMove(), ipe::TransformTool::mouseMove(), setFifiVisible(), setSelectionVisible(), and setTool().
|
inline |
References iWidth.
|
inline |
References iHeight.
|
pure virtual |
Implemented in ipe::Canvas.
Referenced by finishTool(), ipe::PanTool::PanTool(), ipe::SelectTool::SelectTool(), and ipe::TransformTool::TransformTool().
|
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().
|
pure virtual |
Implemented in ipe::Canvas.
|
protected |
|
protected |
References ipe::Cascade::findLayout(), iCascade, ipe::Layout::iFrameSize, iZoom, ipe::Vector::x, and ipe::Vector::y.
Referenced by refreshSurface().
|
protected |
References ipe::Snap::iAngleSize, ipe::Snap::iDir, iHeight, ipe::Snap::iOrigin, iSnap, iWidth, iZoom, ipe::Vector::x, and ipe::Vector::y.
Referenced by refreshSurface().
|
protected |
References ipe::CanvasBase::Style::classicGrid, devToUser(), ipe::Cascade::findLayout(), ipe::CanvasBase::Style::gridLineColor, ipe::Color::iBlue, iCascade, ipe::Layout::iFrameSize, ipe::Color::iGreen, ipe::Snap::iGridSize, iHeight, ipe::Color::iRed, iSnap, iStyle, iWidth, iZoom, ipe::CanvasBase::Style::thickLine, ipe::CanvasBase::Style::thickStep, ipe::CanvasBase::Style::thinLine, ipe::CanvasBase::Style::thinStep, ipe::Fixed::toDouble(), ipe::Vector::x, ipe::Vector::y, and ipe::Vector::ZERO.
Referenced by refreshSurface().
|
protected |
References ipe::Attribute::BACKGROUND(), ipe::Page::count(), ipe::Text::draw(), ipe::Object::draw(), ipe::Page::findLayer(), ipe::Cascade::findLayout(), ipe::Cascade::findSymbol(), iCascade, iDimmed, iFonts, ipe::Symbol::iObject, ipe::Layout::iOrigin, iPage, iPageNumber, ipe::Layout::iPaperSize, iResources, iStyle, iType3Font, iView, iZoom, ipe::Page::layerMatrices(), ipe::Page::layerOf(), ipe::CanvasBase::Style::numberPages, ipe::Page::object(), ipe::Page::objectVisible(), ipe::PdfResources::pageNumber(), ipe::CanvasBase::Style::paperClip, ipe::Painter::popMatrix(), ipe::CanvasBase::Style::pretty, ipe::Painter::pushMatrix(), ipe::Painter::setAttributeMap(), ipe::CairoPainter::setDimmed(), ipe::Page::titleText(), ipe::Painter::transform(), ipe::CairoPainter::type3Font(), ipe::Page::viewMap(), ipe::Vector::x, and ipe::Vector::y.
Referenced by refreshSurface().
|
protected |
Draw the current canvas tool.
If no tool is set, it draws the selected objects.
References ipe::Page::count(), ipe::Tool::draw(), ipe::Object::drawSimple(), ipe::EPrimarySelected, ipe::ESecondarySelected, iPage, iSelectionVisible, iStyle, iTool, iView, ipe::Page::object(), ipe::Page::objectVisible(), ipe::CanvasBase::Style::primarySelectionColor, ipe::CanvasBase::Style::primarySelectionWidth, ipe::CanvasBase::Style::secondarySelectionColor, ipe::CanvasBase::Style::secondarySelectionWidth, ipe::Page::select(), ipe::CanvasBase::Style::selectionSurroundColor, ipe::CanvasBase::Style::selectionSurroundWidth, ipe::Painter::setPen(), and ipe::Painter::setStroke().
Referenced by Canvas::drawRect(), and ipe::Canvas::paintEvent().
|
protected |
References ipe::Rect::bottomLeft(), ipe::Rect::bottomRight(), ipe::Snap::ESnapBd, ipe::Snap::ESnapVtx, ipe::Cascade::findLayout(), iCascade, iFifiMode, ipe::Layout::iFrameSize, iMousePos, ipe::Snap::iSnap, iSnap, ipe::Snap::iSnapDistance, iZoom, ipe::Layout::paper(), ipe::Vector::snap(), ipe::Segment::snap(), ipe::Rect::topLeft(), ipe::Rect::topRight(), and ipe::Vector::ZERO.
Referenced by computeFifi().
|
protected |
References ipe::CanvasObserver::canvasObserverSizeChanged(), drawAxes(), drawFrame(), drawGrid(), drawObjects(), drawPaper(), iBHeight, iBWidth, ipe::Snap::iGridVisible, iHeight, iObserver, iPage, iPan, iRepaintObjects, iSnap, iStyle, iSurface, iWidth, ipe::Snap::iWithAxes, iZoom, ipe::CanvasBase::Style::pretty, ipe::Vector::x, and ipe::Vector::y.
Referenced by Canvas::drawRect(), and ipe::Canvas::paintEvent().
|
protected |
Stores the mouse position in iUnsnappedMousePos, computes Fifi if snapping is enabled, and stores snapped position in iMousePos.
References devToUser(), ipe::Snap::ESnapAuto, ipe::Snap::ESnapNone, iAutoOrigin, iAutoSnap, iFifiMode, iFifiVisible, iMousePos, invalidate(), iOldFifi, iPage, ipe::Snap::iSnap, iSnap, ipe::Snap::iSnapDistance, iTool, iUnsnappedMousePos, iView, iZoom, ipe::Snap::snap(), snapToPaperAndFrame(), userToDev(), ipe::Vector::x, and ipe::Vector::y.
Referenced by ipe::Canvas::mouseButton(), Canvas::mouseMove(), ipe::Canvas::mouseMoveEvent(), and ipe::Canvas::tabletEvent().
|
protected |
|
protectedpure virtual |
Implemented in ipe::Canvas.
Referenced by computeFifi(), update(), and updateTool().
|
protected |
|
protected |
|
protected |
Referenced by CanvasBase(), computeFifi(), drawObjects(), Canvas::drawRect(), drawTool(), ipe::Canvas::paintEvent(), refreshSurface(), setPage(), and simpleSnapPos().
|
protected |
Referenced by drawObjects(), and setPage().
|
protected |
Referenced by Canvas::Canvas(), computeFifi(), drawObjects(), Canvas::drawRect(), drawTool(), Canvas::magnify(), Canvas::mouseMove(), setPage(), and simpleSnapPos().
|
protected |
Referenced by CanvasBase(), cascade(), drawFrame(), drawGrid(), drawObjects(), drawPaper(), Canvas::drawRect(), ipe::Canvas::paintEvent(), setPage(), and snapToPaperAndFrame().
|
protected |
Referenced by CanvasBase(), canvasStyle(), drawGrid(), drawObjects(), drawPaper(), drawTool(), refreshSurface(), and setCanvasStyle().
|
protected |
Referenced by CanvasBase(), canvasTfm(), devToUser(), pan(), refreshSurface(), setPan(), and userToDev().
|
protected |
|
protected |
Referenced by CanvasBase(), computeFifi(), drawAxes(), drawGrid(), refreshSurface(), setSnap(), simpleSnapPos(), snap(), and snapToPaperAndFrame().
|
protected |
Referenced by CanvasBase(), drawObjects(), finishTool(), and setDimmed().
|
protected |
Referenced by CanvasBase(), computeFifi(), finishTool(), and setAutoOrigin().
|
protected |
Referenced by computeFifi(), and setAutoOrigin().
|
protected |
|
protected |
Referenced by CanvasBase(), and setInkMode().
|
protected |
Referenced by CanvasBase(), refreshSurface(), and update().
|
protected |
Referenced by CanvasBase(), canvasWidth(), center(), drawAxes(), drawGrid(), Canvas::drawRect(), ipe::Canvas::paintEvent(), and refreshSurface().
|
protected |
|
protected |
Referenced by CanvasBase(), Canvas::drawRect(), ipe::Canvas::paintEvent(), and refreshSurface().
|
protected |
Referenced by CanvasBase(), Canvas::drawRect(), ipe::Canvas::paintEvent(), and refreshSurface().
|
protected |
Referenced by CanvasBase(), Canvas::drawRect(), ipe::Canvas::paintEvent(), refreshSurface(), and ~CanvasBase().
|
protected |
Referenced by computeFifi(), simpleSnapPos(), and unsnappedPos().
|
protected |
Referenced by computeFifi(), drawFifi(), ipe::Canvas::drawFifi(), pos(), and snapToPaperAndFrame().
|
protected |
Referenced by globalPos(), ipe::Canvas::mouseButton(), and ipe::Canvas::tabletEvent().
|
protected |
Referenced by computeFifi(), drawFifi(), and ipe::Canvas::drawFifi().
|
protected |
Referenced by CanvasBase(), computeFifi(), Canvas::drawRect(), ipe::Canvas::paintEvent(), and setFifiVisible().
|
protected |
Referenced by CanvasBase(), computeFifi(), drawFifi(), ipe::Canvas::drawFifi(), and snapToPaperAndFrame().
|
protected |
Referenced by CanvasBase(), drawTool(), finishTool(), and setSelectionVisible().
|
protected |
Referenced by CanvasBase(), drawObjects(), and setResources().
|
protected |
Referenced by drawObjects(), Canvas::drawRect(), and setResources().
|
protected |
Referenced by CanvasBase(), drawObjects(), and type3Font().