]> Shamusworld >> Repos - architektonas/blob - src/actions/actionzoomin.cpp
Bugfixes related to removing Snapper class.
[architektonas] / src / actions / actionzoomin.cpp
1 // actionzoomin.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 // Portions copyright (C) 2001-2003 RibbonSoft
7 // Copyright (C) 2010 Underground Software
8 // See the README and GPLv2 files for licensing and warranty information
9 //
10 // JLH = James L. Hammons <jlhamm@acm.org>
11 //
12 // Who  When        What
13 // ---  ----------  -----------------------------------------------------------
14 // JLH  05/28/2010  Added this text. :-)
15 //
16
17 #include "actionzoomin.h"
18
19 #include "graphicview.h"
20
21 /**
22  * Default constructor.
23  *
24  * @param direction In for zooming in, Out for zooming out.
25  * @param axis Axis that are affected by the zoom (OnlyX, OnlyY or Both)
26  */
27 ActionZoomIn::ActionZoomIn(EntityContainer & container, GraphicView & graphicView, RS2::ZoomDirection direction, RS2::Axis axis, const Vector & center):
28         ActionInterface("Zoom in", container, graphicView)
29 {
30         this->direction = direction;
31         this->axis = axis;
32         this->center = center;
33 }
34
35 ActionZoomIn::~ActionZoomIn()
36 {
37 }
38
39 void ActionZoomIn::init(int status)
40 {
41         ActionInterface::init(status);
42         trigger();
43 }
44
45 void ActionZoomIn::trigger()
46 {
47         switch (axis)
48         {
49         case RS2::OnlyX:
50
51                 if (direction == RS2::In)
52                         graphicView->zoomInX();
53                 else
54                         graphicView->zoomOutX();
55                 break;
56
57         case RS2::OnlyY:
58
59                 if (direction == RS2::In)
60                         graphicView->zoomInY();
61                 else
62                         graphicView->zoomOutY();
63                 break;
64
65         case RS2::Both:
66
67                 if (direction == RS2::In)
68                         graphicView->zoomIn(1.25, center);
69                 else
70                         graphicView->zoomOut(1.25, center);
71                 break;
72         }
73
74         finish();
75 }
76
77