Ipelib
ipe::TransformTool Class Reference

#include <ipetool.h>

Inherits ipe::Tool.

Public Types

enum  TType {
  ETranslate , EScale , EStretch , ERotate ,
  EShear
}

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

PageiPage
int iView
TType iType
bool iWithShift
bool iOnlyHorizontal
bool iOnlyVertical
Vector iMouseDown
Matrix iTransform
Vector iOrigin
Angle iDir
bool iValid
Protected Attributes inherited from ipe::Tool
CanvasBaseiCanvas

Detailed Description

A tool for transforming the selected objects on the canvas.

Supports moving, rotating, scaling, stretching, and shearing.

Member Enumeration Documentation

◆ TType

Enumerator
ETranslate 
EScale 
EStretch 
ERotate 
EShear 

Constructor & Destructor Documentation

◆ TransformTool()

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::Page::count(), ipe::EFixedPin, ipe::ENoPin, EScale, EShear, EStretch, ETranslate, ipe::EVerticalPin, ipe::Tool::iCanvas, iMouseDown, iOnlyHorizontal, iOnlyVertical, iOrigin, iPage, iType, iValid, iView, ipe::Snap::iWithAxes, iWithShift, ipe::Page::object(), ipe::Object::pinned(), ipe::Page::select(), and ipe::Tool::Tool().

Member Function Documentation

◆ isValid()

bool TransformTool::isValid ( ) const

Check that the transformation can be performed.

References iValid.

◆ draw()

void TransformTool::draw ( Painter & painter) const
virtual

◆ mouseButton()

void TransformTool::mouseButton ( int button,
bool press )
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::Tool::iCanvas, and report().

◆ mouseMove()

void TransformTool::mouseMove ( )
virtual

Called when the mouse is moved on the canvas.

Reimplemented from ipe::Tool.

References compute(), and ipe::Tool::iCanvas.

◆ report()

void TransformTool::report ( )
virtual

Report the final transformation chosen.

The implementation in TransformTool does nothing. Derived classes should reimplement report().

Referenced by mouseButton().

◆ compute()

Member Data Documentation

◆ iPage

Page* ipe::TransformTool::iPage
protected

Referenced by draw(), and TransformTool().

◆ iView

int ipe::TransformTool::iView
protected

Referenced by TransformTool().

◆ iType

TType ipe::TransformTool::iType
protected

Referenced by compute(), and TransformTool().

◆ iWithShift

bool ipe::TransformTool::iWithShift
protected

Referenced by compute(), and TransformTool().

◆ iOnlyHorizontal

bool ipe::TransformTool::iOnlyHorizontal
protected

Referenced by compute(), and TransformTool().

◆ iOnlyVertical

bool ipe::TransformTool::iOnlyVertical
protected

Referenced by compute(), and TransformTool().

◆ iMouseDown

Vector ipe::TransformTool::iMouseDown
protected

Referenced by compute(), and TransformTool().

◆ iTransform

Matrix ipe::TransformTool::iTransform
protected

Referenced by compute(), and draw().

◆ iOrigin

Vector ipe::TransformTool::iOrigin
protected

Referenced by compute(), and TransformTool().

◆ iDir

Angle ipe::TransformTool::iDir
protected

Referenced by compute().

◆ iValid

bool ipe::TransformTool::iValid
protected

Referenced by isValid(), and TransformTool().


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