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 "rs_graphicview.h"
19 RS_ActionZoomPan::RS_ActionZoomPan(RS_EntityContainer & container, RS_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 //v1 = v2 = Vector(false);
34 x1 = y1 = x2 = y2 = -1;
35 //graphicView->saveView();
38 void RS_ActionZoomPan::trigger()
40 /*if (v1.valid && v2.valid) {
41 graphicView->zoomPan(v2-v1);
46 graphicView->zoomPan(x2 - x1, y2 - y1);
52 void RS_ActionZoomPan::mouseMoveEvent(QMouseEvent * e)
58 //if (getStatus()==1 && graphicView->toGuiDX((v2-v1).magnitude())>10) {
59 if (getStatus() == 1 && (abs(x2 - x1) > 7 || abs(y2 - y1) > 7))
63 void RS_ActionZoomPan::mousePressEvent(QMouseEvent * e)
65 if (e->button() == Qt::MidButton
66 || e->button() == Qt::LeftButton)
75 void RS_ActionZoomPan::mouseReleaseEvent(QMouseEvent * e)
77 if (e->button() == Qt::RightButton)
78 init(getStatus() - 1);
79 else if (e->button() == Qt::MidButton)
84 //RS_DEBUG->print("RS_ActionZoomPan::mousePressEvent(): %f %f", v1.x, v1.y);
87 void RS_ActionZoomPan::updateMouseCursor()
90 graphicView->setMouseCursor(RS2::SizeAllCursor);