]> Shamusworld >> Repos - architektonas/blob - src/actions/rs_actionzoomauto.cpp
6d1942b6bc5725be14211947c336ba4a38516f61
[architektonas] / src / actions / rs_actionzoomauto.cpp
1 // rs_actionzoomauto.cpp
2 //
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
7 //
8 // JLH = James L. Hammons <jlhamm@acm.org>
9 //
10 // Who  When        What
11 // ---  ----------  -----------------------------------------------------------
12 // JLH  06/05/2010  Added this text. :-)
13 //
14
15 #include "rs_actionzoomauto.h"
16
17 #include "rs_graphicview.h"
18
19 /**
20  * Constructor.
21  *
22  * @param keepAspectRatio true: keep same zoom value for x/y.
23  *                        false: adjust both x and y individually
24  */
25 RS_ActionZoomAuto::RS_ActionZoomAuto(RS_EntityContainer & container,
26         RS_GraphicView & graphicView, bool keepAspectRatio):
27         RS_ActionInterface("Auto zoom", container, graphicView)
28 {
29         this->keepAspectRatio = keepAspectRatio;
30 }
31
32 RS_ActionZoomAuto::~RS_ActionZoomAuto()
33 {
34 }
35
36 void RS_ActionZoomAuto::init(int status)
37 {
38         RS_ActionInterface::init(status);
39         trigger();
40 }
41
42 void RS_ActionZoomAuto::trigger()
43 {
44         graphicView->zoomAuto(false, keepAspectRatio);
45         finish();
46 }