1 // rs_actionzoompan.cpp
3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // (C) 2010 Underground Software
8 // JLH = James L. Hammons <jlhamm@acm.org>
11 // --- ---------- -----------------------------------------------------------
12 // JLH 06/05/2010 Added this text. :-)
15 #include "rs_actionzoompan.h"
17 #include "graphicview.h"
19 RS_ActionZoomPan::RS_ActionZoomPan(RS_EntityContainer & container, GraphicView & graphicView):
20 RS_ActionInterface("Zoom Pan", container, graphicView)
24 RS_ActionZoomPan::~RS_ActionZoomPan()
28 void RS_ActionZoomPan::init(int status)
30 RS_ActionInterface::init(status);
31 snapMode = RS2::SnapFree;
32 snapRes = RS2::RestrictNothing;
33 x1 = y1 = x2 = y2 = -1;
36 void RS_ActionZoomPan::trigger()
40 graphicView->zoomPan(x2 - x1, y2 - y1);
46 void RS_ActionZoomPan::mouseMoveEvent(QMouseEvent * e)
51 //This is where we see if the delta was big enough to warrant a redraw...
52 if (getStatus() == 1 && (abs(x2 - x1) > 7 || abs(y2 - y1) > 7))
56 void RS_ActionZoomPan::mousePressEvent(QMouseEvent * e)
58 if (e->button() == Qt::MidButton || e->button() == Qt::LeftButton)
66 void RS_ActionZoomPan::mouseReleaseEvent(QMouseEvent * e)
68 if (e->button() == Qt::RightButton)
69 init(getStatus() - 1);
70 else if (e->button() == Qt::MidButton)
75 //RS_DEBUG->print("RS_ActionZoomPan::mousePressEvent(): %f %f", v1.x, v1.y);
78 void RS_ActionZoomPan::updateMouseCursor()
81 graphicView->setMouseCursor(RS2::SizeAllCursor);