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