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 // Portions copyright (C) 2001-2003 RibbonSoft
7 // Copyright (C) 2010 Underground Software
8 // See the README and GPLv2 files for licensing and warranty information
10 // JLH = James L. Hammons <jlhamm@acm.org>
13 // --- ---------- -----------------------------------------------------------
14 // JLH 06/04/2010 Added this text. :-)
17 #include "actioneditpaste.h"
19 #include "clipboard.h"
20 #include "dialogfactory.h"
21 #include "modification.h"
28 * @param undo true for undo and false for redo.
30 ActionEditPaste::ActionEditPaste(EntityContainer & container, GraphicView & graphicView): ActionInterface("Edit Paste",
31 container, graphicView)
35 ActionEditPaste::~ActionEditPaste()
39 void ActionEditPaste::init(int status)
41 ActionInterface::init(status);
45 void ActionEditPaste::trigger()
51 Modification m(*container, graphicView);
52 m.paste(PasteData(targetPoint, 1.0, 0.0, false, ""));
54 graphicView->redraw();
58 void ActionEditPaste::mouseMoveEvent(QMouseEvent * e)
63 targetPoint = snapPoint(e);
67 // preview->addAllFrom(*CLIPBOARD->getGraphic());
68 // preview->move(targetPoint);
72 RS2::Unit sourceUnit = CLIPBOARD->getGraphic()->getUnit();
73 RS2::Unit targetUnit = graphic->getUnit();
74 double f = Units::convert(1.0, sourceUnit, targetUnit);
75 // preview->scale(targetPoint, Vector(f, f));
86 void ActionEditPaste::mouseReleaseEvent(QMouseEvent * e)
88 if (e->button() == Qt::LeftButton)
90 Vector ce(snapPoint(e));
93 else if (e->button() == Qt::RightButton)
96 init(getStatus() - 1);
100 void ActionEditPaste::coordinateEvent(Vector * e)
109 void ActionEditPaste::updateMouseButtonHints()
114 DIALOGFACTORY->updateMouseWidget(tr("Set reference point"),
119 DIALOGFACTORY->updateMouseWidget("", "");
124 void ActionEditPaste::updateMouseCursor()
126 graphicView->setMouseCursor(RS2::CadCursor);
129 void ActionEditPaste::updateToolBar()
132 DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
134 DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);