-/****************************************************************************
-** $Id: rs_actionzoomwindow.cpp 1134 2004-07-13 23:26:13Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
+// rs_actionzoomwindow.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/05/2010 Added this text. :-)
+//
#include "rs_actionzoomwindow.h"
-#include "rs.h"
-#include "rs_snapper.h"
-#include "rs_point.h"
-//Added by qt3to4:
-//#include <QIcon>
+#include "rs_dialogfactory.h"
+#include "graphicview.h"
+#include "rs_preview.h"
/**
* Default constructor.
* area will be fit to the viewport.
*/
RS_ActionZoomWindow::RS_ActionZoomWindow(RS_EntityContainer & container,
- RS_GraphicView& graphicView, bool keepAspectRatio):
+ GraphicView & graphicView, bool keepAspectRatio):
RS_PreviewActionInterface("Zoom Window", container, graphicView)
{
this->keepAspectRatio = keepAspectRatio;
}
-QAction* RS_ActionZoomWindow::createGUIAction(RS2::ActionType /*type*/, QObject * /*parent*/)
+RS_ActionZoomWindow::~RS_ActionZoomWindow()
{
- QAction * action = new QAction(QIcon(":/res/zoomwindow.png"), tr("&Window Zoom"), 0);
-// QAction* action = new QAction(tr("Window Zoom"), QPixmap::fromMimeSource("zoomwindow.png"),
-// tr("&Window Zoom"), QKeySequence(), NULL);
- action->setStatusTip(tr("Zooms in a window"));
- return action;
}
void RS_ActionZoomWindow::init(int status)
deletePreview();
clearPreview();
preview->addEntity(new RS_Line(preview,
- RS_LineData(Vector(v1.x, v1.y), Vector(v2.x, v1.y))));
+ RS_LineData(Vector(v1.x, v1.y), Vector(v2.x, v1.y))));
preview->addEntity(new RS_Line(preview,
- RS_LineData(Vector(v2.x, v1.y), Vector(v2.x, v2.y))));
+ RS_LineData(Vector(v2.x, v1.y), Vector(v2.x, v2.y))));
preview->addEntity(new RS_Line(preview,
- RS_LineData(Vector(v2.x, v2.y), Vector(v1.x, v2.y))));
+ RS_LineData(Vector(v2.x, v2.y), Vector(v1.x, v2.y))));
preview->addEntity(new RS_Line(preview,
- RS_LineData(Vector(v1.x, v2.y), Vector(v1.x, v1.y))));
+ RS_LineData(Vector(v1.x, v2.y), Vector(v1.x, v1.y))));
drawPreview();
}
}
void RS_ActionZoomWindow::mousePressEvent(QMouseEvent * e)
{
- if (RS2::qtToRsButtonState(e->button()) == RS2::LeftButton)
+ if (e->button() == Qt::LeftButton)
{
switch (getStatus())
{
{
RS_DEBUG->print("RS_ActionZoomWindow::mouseReleaseEvent()");
- if (RS2::qtToRsButtonState(e->button()) == RS2::RightButton)
+ if (e->button() == Qt::RightButton)
{
if (getStatus() == 1)
- {
deletePreview();
- }
init(getStatus() - 1);
}
- else if (RS2::qtToRsButtonState(e->button()) == RS2::LeftButton)
- {
+ else if (e->button() == Qt::LeftButton)
if (getStatus() == 1)
{
v2 = snapPoint(e);
trigger();
}
- }
}
void RS_ActionZoomWindow::updateMouseButtonHints()
case 0:
RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first edge"), tr("Cancel"));
break;
+
case 1:
RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second edge"), tr("Back"));
break;
+
default:
RS_DIALOGFACTORY->updateMouseWidget("", "");
break;