Scribus Developer Documentation - API
logo-pen

Scribus Developer Documentation - API

LineMove Class Reference

#include <canvasgesture_linemove.h>

Inheritance diagram for LineMove:

Inheritance graph
[legend]
Collaboration diagram for LineMove:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 LineMove (CanvasMode *parent)
 ~LineMove ()
void prepare (QPointF start, QPointF end)
void prepare (PageItem_Line *line, bool useOriginAsEndpoint=false)
void clear ()
virtual void activate (bool)
virtual void deactivate (bool)
virtual void mouseReleaseEvent (QMouseEvent *m)
virtual void mouseMoveEvent (QMouseEvent *m)
virtual void mousePressEvent (QMouseEvent *m)
virtual void drawControls (QPainter *)
void setStartPoint (QPointF canvasStart)
void setEndPoint (QPointF canvasEnd)
QPointF startPoint () const
QPointF endPoint () const
bool haveLineItem () const

Private Member Functions

void adjustBounds (QMouseEvent *m)
void doResize ()
void setRotation (double rot)
double rotation () const
double length () const

Private Attributes

bool m_haveLineItem
bool m_useOriginAsEndpoint
QRectF m_bounds
PageItemm_line


Detailed Description

This class realizes moving the endpoints of a line on behalf of its parent mode. The user presses the mousebutton at one endpoint of the line, drags it to a new position and releases the mousebutton.

When the parent mode becomes active again, it can retrieve the new line with endPoint().

If the constructur with a pageitem is used, the gesture will change the item directly.

Definition at line 49 of file canvasgesture_linemove.h.


Constructor & Destructor Documentation

LineMove::LineMove ( CanvasMode parent  )  [inline]

Definition at line 52 of file canvasgesture_linemove.h.

LineMove::~LineMove (  )  [inline]

Definition at line 53 of file canvasgesture_linemove.h.


Member Function Documentation

void LineMove::prepare ( QPointF  start,
QPointF  end 
)

Prepare a LineMove without attached PageItem

Definition at line 37 of file canvasgesture_linemove.cpp.

References m_haveLineItem, and setStartPoint().

Referenced by mousePressEvent(), and CreateMode::SetupDraw().

void LineMove::prepare ( PageItem_Line line,
bool  useOriginAsEndpoint = false 
)

Prepare a LineMove gesture for a PageItem_Line. useOriginAsEndpoint allows to drag the origin (topleft) in the same way as the other end.

Definition at line 45 of file canvasgesture_linemove.cpp.

References endPoint(), m_haveLineItem, m_line, m_useOriginAsEndpoint, PageItem::rotation, setEndPoint(), setRotation(), setStartPoint(), startPoint(), PageItem::width, PageItem::xPos, and PageItem::yPos.

void LineMove::clear (  ) 

Definition at line 31 of file canvasgesture_linemove.cpp.

References m_haveLineItem.

void LineMove::activate ( bool  fromGesture  )  [virtual]

Is called when this mode becomes active, either because it was selected by the user (fromgesture == false) or because a gesture completed and the canvas returns back to this mode (fromGesture == true)

Reimplemented from CanvasMode.

Definition at line 98 of file canvasgesture_linemove.cpp.

References m_bounds.

void LineMove::deactivate ( bool  forGesture  )  [virtual]

Is called when this mode becomes inactive, either because the canvas switches to another mode (forGesture == false) or because a gesture is activated (forGesture == true)

Reimplemented from CanvasMode.

Definition at line 105 of file canvasgesture_linemove.cpp.

References m_haveLineItem.

void LineMove::mouseReleaseEvent ( QMouseEvent *  m  )  [virtual]

void LineMove::mouseMoveEvent ( QMouseEvent *  m  )  [virtual]

Reimplemented from CanvasGesture.

Definition at line 164 of file canvasgesture_linemove.cpp.

References adjustBounds(), doResize(), CanvasMode::m_canvas, and m_haveLineItem.

void LineMove::mousePressEvent ( QMouseEvent *  m  )  [virtual]

prepares the LineMove for the the current selection. Sets 'haveLineItem' to false if the current selection is not a single lineitem.

Reimplemented from CanvasGesture.

Definition at line 205 of file canvasgesture_linemove.cpp.

References PageItem::asLine(), Selection::count(), endPoint(), Canvas::globalToCanvas(), Canvas::hitsCanvasPoint(), Selection::itemAt(), CanvasMode::m_canvas, CanvasMode::m_doc, m_haveLineItem, ScribusDoc::m_Selection, prepare(), setEndPoint(), setStartPoint(), FPoint::x(), PageItem::xyPos(), and FPoint::y().

Referenced by LegacyMode::mousePressEvent().

void LineMove::drawControls ( QPainter *  p  )  [virtual]

Draws the controls for this mode and the selection marker. If viewmode.drawSelectionWithControls is true, also draws the selection contents first.

Reimplemented from CanvasMode.

Definition at line 113 of file canvasgesture_linemove.cpp.

References m_bounds, CanvasMode::m_canvas, CanvasMode::m_doc, ScribusDoc::minCanvasCoordinate, Canvas::scale(), FPoint::x(), and FPoint::y().

void LineMove::setStartPoint ( QPointF  canvasStart  ) 

Definition at line 86 of file canvasgesture_linemove.cpp.

References m_bounds.

Referenced by mousePressEvent(), and prepare().

void LineMove::setEndPoint ( QPointF  canvasEnd  ) 

Definition at line 92 of file canvasgesture_linemove.cpp.

References m_bounds.

Referenced by mousePressEvent(), and prepare().

QPointF LineMove::startPoint (  )  const [inline]

Definition at line 81 of file canvasgesture_linemove.h.

Referenced by prepare().

QPointF LineMove::endPoint (  )  const [inline]

Definition at line 82 of file canvasgesture_linemove.h.

Referenced by mousePressEvent(), and prepare().

bool LineMove::haveLineItem (  )  const [inline]

Definition at line 84 of file canvasgesture_linemove.h.

Referenced by LegacyMode::mousePressEvent().

void LineMove::adjustBounds ( QMouseEvent *  m  )  [private]

void LineMove::doResize (  )  [private]

void LineMove::setRotation ( double  rot  )  [private]

Definition at line 74 of file canvasgesture_linemove.cpp.

References cosd(), length(), m_bounds, and sind().

Referenced by adjustBounds(), and prepare().

double LineMove::rotation (  )  const [private]

Definition at line 64 of file canvasgesture_linemove.cpp.

References m_bounds, and xy2Deg().

Referenced by adjustBounds(), and doResize().

double LineMove::length (  )  const [private]

Definition at line 80 of file canvasgesture_linemove.cpp.

References distance(), and m_bounds.

Referenced by doResize(), and setRotation().


Member Data Documentation

bool LineMove::m_haveLineItem [private]

Definition at line 88 of file canvasgesture_linemove.h.

Referenced by doResize(), and prepare().

QRectF LineMove::m_bounds [private]

Definition at line 90 of file canvasgesture_linemove.h.

Referenced by doResize(), mouseReleaseEvent(), and prepare().


The documentation for this class was generated from the following files:
Created with personalized Doxygen. This is documentation for GPL software Scribus - Open Source Desktop Publishing.