|
Ipelib
|
#include <ipetool.h>
Inherits ipe::Tool.
Public Types | |
| enum | TType { ETranslate, EScale, EStretch, ERotate } |
Public Member Functions | |
| TransformTool (CanvasBase *canvas, Page *page, int view, TType type, bool withShift) | |
| bool | isValid () const |
| virtual void | draw (Painter &painter) const |
| virtual void | mouseButton (int button, bool press) |
| virtual void | mouseMove () |
| virtual void | report () |
Public Member Functions inherited from ipe::Tool | |
| virtual | ~Tool () |
| virtual bool | key (String text, int modifiers) |
| virtual void | snapVtx (const Vector &mouse, Vector &pos, double &bound, bool cp) const |
Protected Member Functions | |
| void | compute (const Vector &v) |
Protected Member Functions inherited from ipe::Tool | |
| Tool (CanvasBase *canvas) | |
Protected Attributes | |
| Page * | iPage |
| int | iView |
| TType | iType |
| bool | iWithShift |
| bool | iOnlyHorizontal |
| bool | iOnlyVertical |
| Vector | iMouseDown |
| Matrix | iTransform |
| Vector | iOrigin |
| bool | iValid |
Protected Attributes inherited from ipe::Tool | |
| CanvasBase * | iCanvas |
A tool for transforming the selected objects on the canvas.
Supports moving, rotating, scaling, and stretching.
| TransformTool::TransformTool | ( | CanvasBase * | canvas, |
| Page * | page, | ||
| int | view, | ||
| TType | type, | ||
| bool | withShift | ||
| ) |
Constructor starts transformation.
After constructing a TransformTool, you must call isValid() to ensure that the transformation can be performed.
A transformation can fail because the selection contains pinned objects, or because the initial mouse position is identical to the transformation origin.
References ipe::Rect::addRect(), ipe::Page::bbox(), ipe::Rect::bottomLeft(), ipe::Page::count(), ipe::EFixedPin, ipe::CanvasBase::EHandCursor, ipe::ENoPin, EScale, EStretch, ETranslate, ipe::EVerticalPin, ipe::Tool::iCanvas, iMouseDown, iOnlyHorizontal, iOnlyVertical, ipe::Snap::iOrigin, iOrigin, iPage, iType, iValid, iView, ipe::Snap::iWithAxes, iWithShift, ipe::Page::object(), ipe::Object::pinned(), ipe::CanvasBase::pos(), ipe::Page::select(), ipe::CanvasBase::setAutoOrigin(), ipe::CanvasBase::setCursor(), ipe::CanvasBase::snap(), ipe::Rect::topRight(), ipe::Vector::x, and ipe::Vector::y.
| bool TransformTool::isValid | ( | ) | const |
Check that the transformation can be performed.
References iValid.
|
virtual |
Implements ipe::Tool.
References ipe::Page::count(), ipe::Object::drawSimple(), iPage, iTransform, ipe::Page::object(), ipe::Page::select(), ipe::Painter::setStroke(), and ipe::Painter::transform().
|
virtual |
Called when a mouse button is pressed or released on the canvas.
button is 1, 2, or 3, with Shift/Ctrl/Alt/Meta modifiers added in (as defined in CanvasBase::TModifiers. press is true for button-down, and false for button-up.
Reimplemented from ipe::Tool.
References compute(), ipe::CanvasBase::finishTool(), ipe::Tool::iCanvas, ipe::CanvasBase::pos(), and report().
|
virtual |
Called when the mouse is moved on the canvas.
Reimplemented from ipe::Tool.
References compute(), ipe::Tool::iCanvas, ipe::CanvasBase::pos(), and ipe::CanvasBase::updateTool().
|
virtual |
Report the final transformation chosen.
The implementation in TransformTool does nothing. Derived classes should reimplement report().
Referenced by mouseButton().
|
protected |
References ipe::abs(), ipe::Vector::angle(), ERotate, EScale, EStretch, ETranslate, iMouseDown, iOnlyHorizontal, iOnlyVertical, iOrigin, iTransform, iType, iWithShift, ipe::Vector::sqLen(), ipe::Vector::x, and ipe::Vector::y.
Referenced by mouseButton(), and mouseMove().
|
protected |
Referenced by draw(), and TransformTool().
|
protected |
Referenced by TransformTool().
|
protected |
Referenced by compute(), and TransformTool().
|
protected |
Referenced by compute(), and TransformTool().
|
protected |
Referenced by compute(), and TransformTool().
|
protected |
Referenced by compute(), and TransformTool().
|
protected |
Referenced by compute(), and TransformTool().
|
protected |
Referenced by compute(), and TransformTool().
|
protected |
Referenced by isValid(), and TransformTool().