LineMove Class Reference
#include <canvasgesture_linemove.h>


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 |
| PageItem * | m_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 | ( | ) |
| 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] |
Reimplemented from CanvasGesture.
Definition at line 126 of file canvasgesture_linemove.cpp.
References adjustBounds(), PageItem::checkChanges(), doResize(), PageItem::height, CanvasMode::m_canvas, CanvasMode::m_doc, m_haveLineItem, m_line, CanvasMode::m_view, ScribusView::resetMousePressed(), PageItem::rotation, ScribusDoc::setRedrawBounding(), ScribusView::stopGesture(), SingleObservable< OBSERVED >::update(), PageItem::width, PageItem::xPos, and PageItem::yPos.
| 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] |
| 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] |
Definition at line 177 of file canvasgesture_linemove.cpp.
References toolPrefs::constrain, constrainAngle(), Canvas::globalToCanvas(), ScribusDoc::guidesSettings, m_bounds, CanvasMode::m_canvas, CanvasMode::m_doc, CanvasMode::m_view, guidesPrefs::minorGrid, rotation(), setRotation(), ScribusDoc::toolSettings, ScribusView::updateCanvas(), ScribusDoc::useRaster, FPoint::x(), and FPoint::y().
Referenced by mouseMoveEvent(), and mouseReleaseEvent().
| void LineMove::doResize | ( | ) | [private] |
Definition at line 144 of file canvasgesture_linemove.cpp.
References length(), m_bounds, m_line, m_useOriginAsEndpoint, rotation(), PageItem::setHeight(), PageItem::setRotation(), PageItem::setWidth(), PageItem::setXYPos(), and PageItem::updateClip().
Referenced by mouseMoveEvent(), and mouseReleaseEvent().
| 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 87 of file canvasgesture_linemove.h.
Referenced by clear(), deactivate(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), and prepare().
bool LineMove::m_useOriginAsEndpoint [private] |
QRectF LineMove::m_bounds [private] |
Definition at line 89 of file canvasgesture_linemove.h.
Referenced by activate(), adjustBounds(), doResize(), drawControls(), length(), rotation(), setEndPoint(), setRotation(), and setStartPoint().
PageItem* LineMove::m_line [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:
