]> Shamusworld >> Repos - architektonas/blobdiff - src/actions/rs_actionzoomin.cpp
Major refactoring of actions: Moved implementation from header files
[architektonas] / src / actions / rs_actionzoomin.cpp
index d0db01f1650b6f6ad131acfcd380aaf1426434ed..56cb9efee47574c26d07fcd917f66e3b5471b2cc 100644 (file)
 
 #include "rs_actionzoomin.h"
 
+#include "rs_graphicview.h"
+
 /**
  * Default constructor.
  *
  * @param direction In for zooming in, Out for zooming out.
  * @param axis Axis that are affected by the zoom (OnlyX, OnlyY or Both)
  */
-RS_ActionZoomIn::RS_ActionZoomIn(RS_EntityContainer& container,
-       RS_GraphicView& graphicView, RS2::ZoomDirection direction,
-       RS2::Axis axis, const Vector& center):
+RS_ActionZoomIn::RS_ActionZoomIn(RS_EntityContainer & container, RS_GraphicView & graphicView, RS2::ZoomDirection direction, RS2::Axis axis, const Vector & center):
        RS_ActionInterface("Zoom in", container, graphicView)
 {
        this->direction = direction;
@@ -30,26 +30,8 @@ RS_ActionZoomIn::RS_ActionZoomIn(RS_EntityContainer& container,
        this->center = center;
 }
 
-QAction * RS_ActionZoomIn::createGUIAction(RS2::ActionType type, QObject * /*parent*/)
+RS_ActionZoomIn::~RS_ActionZoomIn()
 {
-       QAction * action;
-
-       if (type == RS2::ActionZoomIn)
-       {
-               action = new QAction(QIcon(":/res/zoomin.png"), tr("Zoom &In"), 0);
-//             action = new QAction(tr("Zoom in"), QPixmap::fromMimeSource("zoomin.png"),
-//                                                             tr("Zoom &In"), QKeySequence(), NULL);
-               action->setStatusTip(tr("Zooms in"));
-       }
-       else
-       {
-               action = new QAction(QIcon(":/res/zoomout.png"), tr("Zoom &Out"), 0);
-//             action = new QAction(tr("Zoom out"), QPixmap::fromMimeSource("zoomout.png"),
-//                                                             tr("Zoom &Out"), QKeySequence(), NULL);
-               action->setStatusTip(tr("Zooms out"));
-       }
-
-       return action;
 }
 
 void RS_ActionZoomIn::init(int status)
@@ -63,36 +45,27 @@ void RS_ActionZoomIn::trigger()
        switch (axis)
        {
        case RS2::OnlyX:
+
                if (direction == RS2::In)
-               {
                        graphicView->zoomInX();
-               }
                else
-               {
                        graphicView->zoomOutX();
-               }
                break;
 
        case RS2::OnlyY:
+
                if (direction == RS2::In)
-               {
                        graphicView->zoomInY();
-               }
                else
-               {
                        graphicView->zoomOutY();
-               }
                break;
 
        case RS2::Both:
+
                if (direction == RS2::In)
-               {
                        graphicView->zoomIn(1.25, center);
-               }
                else
-               {
                        graphicView->zoomOut(1.25, center);
-               }
                break;
        }