X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Factions%2Frs_actionzoomwindow.cpp;h=4f370eb48a14b15f031e2361a4c833a76a879280;hb=3f46c180da0806c9c263e6d87d0f1404632402da;hp=65c09ffb3fae7f73dcc8b0228bd19eeb12576191;hpb=16ce54abf01ca3032e42a5bb11a4afcf9014dcca;p=architektonas diff --git a/src/actions/rs_actionzoomwindow.cpp b/src/actions/rs_actionzoomwindow.cpp index 65c09ff..4f370eb 100644 --- a/src/actions/rs_actionzoomwindow.cpp +++ b/src/actions/rs_actionzoomwindow.cpp @@ -1,36 +1,22 @@ -/**************************************************************************** -** $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 +// +// 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 +#include "rs_dialogfactory.h" +#include "rs_graphicview.h" +#include "rs_preview.h" /** * Default constructor. @@ -40,19 +26,14 @@ * area will be fit to the viewport. */ RS_ActionZoomWindow::RS_ActionZoomWindow(RS_EntityContainer & container, - RS_GraphicView& graphicView, bool keepAspectRatio): + RS_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) @@ -92,20 +73,20 @@ void RS_ActionZoomWindow::mouseMoveEvent(QMouseEvent * e) 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()) { @@ -126,23 +107,19 @@ void RS_ActionZoomWindow::mouseReleaseEvent(QMouseEvent * e) { 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() @@ -154,9 +131,11 @@ 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;