1 // actionprintpreview.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 // 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 "actionprintpreview.h"
19 #include "dialogfactory.h"
21 #include "graphicview.h"
26 ActionPrintPreview::ActionPrintPreview(EntityContainer & container, GraphicView & graphicView):
27 ActionInterface("Print Preview", container, graphicView)
32 ActionPrintPreview::~ActionPrintPreview()
36 /*virtual*/ RS2::ActionType ActionPrintPreview::rtti()
38 return RS2::ActionPrintPreview;
41 void ActionPrintPreview::init(int status)
43 ActionInterface::init(status);
47 void ActionPrintPreview::trigger()
51 void ActionPrintPreview::mouseMoveEvent(QMouseEvent * e)
56 v2 = graphicView->toGraph(e->x(), e->y());
60 Vector pinsbase = graphic->getPaperInsertionBase();
61 double scale = graphic->getPaperScale();
62 graphic->setPaperInsertionBase(pinsbase - v2 * scale + v1 * scale);
66 graphicView->redraw();
74 void ActionPrintPreview::mousePressEvent(QMouseEvent * e)
76 if (e->button() == Qt::LeftButton)
81 v1 = graphicView->toGraph(e->x(), e->y());
91 void ActionPrintPreview::mouseReleaseEvent(QMouseEvent * e)
100 DIALOGFACTORY->requestPreviousMenu();
106 void ActionPrintPreview::coordinateEvent(Vector *)
110 void ActionPrintPreview::commandEvent(CommandEvent *)
114 QStringList ActionPrintPreview::getAvailableCommands()
120 void ActionPrintPreview::showOptions()
122 ActionInterface::showOptions();
124 DIALOGFACTORY->requestOptions(this, true);
127 void ActionPrintPreview::hideOptions()
129 ActionInterface::hideOptions();
131 DIALOGFACTORY->requestOptions(this, false);
134 void ActionPrintPreview::updateMouseButtonHints()
138 void ActionPrintPreview::updateMouseCursor()
140 graphicView->setMouseCursor(RS2::MovingHandCursor);
143 void ActionPrintPreview::updateToolBar()
147 void ActionPrintPreview::center()
151 graphic->centerToPage();
152 graphicView->redraw();
156 void ActionPrintPreview::fit()
160 graphic->fitToPage();
161 graphicView->redraw();
165 void ActionPrintPreview::setScale(double f)
169 graphic->setPaperScale(f);
170 graphicView->redraw();
174 double ActionPrintPreview::getScale()
179 ret = graphic->getPaperScale();
184 void ActionPrintPreview::setBlackWhite(bool bw)
187 graphicView->setDrawingMode(RS2::ModeBW);
189 graphicView->setDrawingMode(RS2::ModeFull);
191 graphicView->redraw();
194 RS2::Unit ActionPrintPreview::getUnit()
197 return graphic->getUnit();