]> Shamusworld >> Repos - architektonas/blobdiff - src/actions/actiondrawarc.cpp
Removed unnecessary RS_ prefix from classes and whatnot.
[architektonas] / src / actions / actiondrawarc.cpp
index be608fe3f193c29df31a60fe1ab11dadfd343ba0..a833e58caa481b42c94fa5de44c60a253e194b5a 100644 (file)
@@ -23,7 +23,7 @@
 #include "graphicview.h"
 #include "preview.h"
 
-ActionDrawArc::ActionDrawArc(RS_EntityContainer & container, GraphicView & graphicView):
+ActionDrawArc::ActionDrawArc(EntityContainer & container, GraphicView & graphicView):
        ActionInterface("Draw arcs", container, graphicView)
 {
        reset();
@@ -41,9 +41,9 @@ RS2::ActionType ActionDrawArc::rtti()
 void ActionDrawArc::reset()
 {
        if (data.reversed)
-               data = RS_ArcData(Vector(false), 0.0, 2 * M_PI, 0.0, true);
+               data = ArcData(Vector(false), 0.0, 2 * M_PI, 0.0, true);
        else
-               data = RS_ArcData(Vector(false), 0.0, 0.0, 2 * M_PI, false);
+               data = ArcData(Vector(false), 0.0, 0.0, 2 * M_PI, false);
 }
 
 void ActionDrawArc::init(int status)
@@ -56,7 +56,7 @@ void ActionDrawArc::trigger()
 {
        ActionInterface::trigger();
 
-       RS_Arc * arc = new RS_Arc(container, data);
+       Arc * arc = new Arc(container, data);
        arc->setLayerToActive();
        arc->setPenToActive();
        container->addEntity(arc);
@@ -78,12 +78,12 @@ void ActionDrawArc::trigger()
        setStatus(SetCenter);
        reset();
 
-       RS_DEBUG->print("ActionDrawArc::trigger(): arc added: %d", arc->getId());
+       DEBUG->print("ActionDrawArc::trigger(): arc added: %d", arc->getId());
 }
 
 void ActionDrawArc::mouseMoveEvent(QMouseEvent * e)
 {
-       RS_DEBUG->print("ActionDrawArc::mouseMoveEvent begin");
+       DEBUG->print("ActionDrawArc::mouseMoveEvent begin");
        Vector mouse = snapPoint(e);
 
        switch (getStatus())
@@ -99,7 +99,7 @@ void ActionDrawArc::mouseMoveEvent(QMouseEvent * e)
                        data.radius = data.center.distanceTo(mouse);
                        deletePreview();
                        clearPreview();
-//                     preview->addEntity(new RS_Circle(preview, RS_CircleData(data.center, data.radius)));
+//                     preview->addEntity(new Circle(preview, CircleData(data.center, data.radius)));
                        drawPreview();
                }
                break;
@@ -108,13 +108,13 @@ void ActionDrawArc::mouseMoveEvent(QMouseEvent * e)
                data.angle1 = data.center.angleTo(mouse);
 
                if (data.reversed)
-                       data.angle2 = RS_Math::correctAngle(data.angle1 - M_PI / 3);
+                       data.angle2 = Math::correctAngle(data.angle1 - M_PI / 3);
                else
-                       data.angle2 = RS_Math::correctAngle(data.angle1 + M_PI / 3);
+                       data.angle2 = Math::correctAngle(data.angle1 + M_PI / 3);
 
                deletePreview();
                clearPreview();
-//             preview->addEntity(new RS_Arc(preview, data));
+//             preview->addEntity(new Arc(preview, data));
                drawPreview();
                break;
 
@@ -122,7 +122,7 @@ void ActionDrawArc::mouseMoveEvent(QMouseEvent * e)
                data.angle2 = data.center.angleTo(mouse);
                deletePreview();
                clearPreview();
-//             preview->addEntity(new RS_Arc(preview, data));
+//             preview->addEntity(new Arc(preview, data));
                drawPreview();
                break;
 
@@ -130,7 +130,7 @@ void ActionDrawArc::mouseMoveEvent(QMouseEvent * e)
                data.angle2 = data.angle1 + data.center.angleTo(mouse);
                deletePreview();
                clearPreview();
-//             preview->addEntity(new RS_Arc(preview, data));
+//             preview->addEntity(new Arc(preview, data));
                drawPreview();
                break;
 
@@ -143,7 +143,7 @@ void ActionDrawArc::mouseMoveEvent(QMouseEvent * e)
                        data.angle2 = data.angle1 + asin(x / (2 * data.radius)) * 2;
                        deletePreview();
                        clearPreview();
-//                     preview->addEntity(new RS_Arc(preview, data));
+//                     preview->addEntity(new Arc(preview, data));
                        drawPreview();
                }
        }
@@ -153,7 +153,7 @@ void ActionDrawArc::mouseMoveEvent(QMouseEvent * e)
                break;
        }
 
-       RS_DEBUG->print("ActionDrawArc::mouseMoveEvent end");
+       DEBUG->print("ActionDrawArc::mouseMoveEvent end");
 }
 
 void ActionDrawArc::mouseReleaseEvent(QMouseEvent * e)
@@ -227,25 +227,25 @@ void ActionDrawArc::coordinateEvent(Vector * e)
        }
 }
 
-void ActionDrawArc::commandEvent(RS_CommandEvent * e)
+void ActionDrawArc::commandEvent(CommandEvent * e)
 {
        QString c = e->getCommand().toLower();
 
-       if (RS_COMMANDS->checkCommand("help", c))
+       if (COMMANDS->checkCommand("help", c))
        {
-               if (RS_DIALOGFACTORY != NULL)
-                       RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+               if (DIALOGFACTORY != NULL)
+                       DIALOGFACTORY->commandMessage(msgAvailableCommands()
                                + getAvailableCommands().join(", "));
                return;
        }
 
-       if (RS_COMMANDS->checkCommand("reversed", c))
+       if (COMMANDS->checkCommand("reversed", c))
        {
                e->accept();
                setReversed(!isReversed());
 
-               if (RS_DIALOGFACTORY != NULL)
-                       RS_DIALOGFACTORY->requestOptions(this, true, true);
+               if (DIALOGFACTORY != NULL)
+                       DIALOGFACTORY->requestOptions(this, true, true);
                return;
        }
 
@@ -253,74 +253,74 @@ void ActionDrawArc::commandEvent(RS_CommandEvent * e)
        {
        case SetRadius: {
                bool ok;
-               double r = RS_Math::eval(c, &ok);
+               double r = Math::eval(c, &ok);
 
                if (ok == true)
                {
                        data.radius = r;
                        setStatus(SetAngle1);
                }
-               else if (RS_DIALOGFACTORY != NULL)
-                       RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+               else if (DIALOGFACTORY != NULL)
+                       DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
 
        }
        break;
 
        case SetAngle1: {
                bool ok;
-               double a = RS_Math::eval(c, &ok);
+               double a = Math::eval(c, &ok);
 
                if (ok == true)
                {
-                       data.angle1 = RS_Math::deg2rad(a);
+                       data.angle1 = Math::deg2rad(a);
                        setStatus(SetAngle2);
                }
-               else if (RS_DIALOGFACTORY != NULL)
-                       RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+               else if (DIALOGFACTORY != NULL)
+                       DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
 
        }
        break;
 
        case SetAngle2:
 
-               if (RS_COMMANDS->checkCommand("angle", c))
+               if (COMMANDS->checkCommand("angle", c))
                        setStatus(SetIncAngle);
-               else if (RS_COMMANDS->checkCommand("chord length", c))
+               else if (COMMANDS->checkCommand("chord length", c))
                        setStatus(SetChordLength);
                else
                {
                        bool ok;
-                       double a = RS_Math::eval(c, &ok);
+                       double a = Math::eval(c, &ok);
 
                        if (ok == true)
                        {
-                               data.angle2 = RS_Math::deg2rad(a);
+                               data.angle2 = Math::deg2rad(a);
                                trigger();
                        }
-                       else if (RS_DIALOGFACTORY != NULL)
-                               RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+                       else if (DIALOGFACTORY != NULL)
+                               DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
 
                }
                break;
 
        case SetIncAngle: {
                bool ok;
-               double a = RS_Math::eval(c, &ok);
+               double a = Math::eval(c, &ok);
 
                if (ok == true)
                {
-                       data.angle2 = data.angle1 + RS_Math::deg2rad(a);
+                       data.angle2 = data.angle1 + Math::deg2rad(a);
                        trigger();
                }
-               else if (RS_DIALOGFACTORY != NULL)
-                       RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+               else if (DIALOGFACTORY != NULL)
+                       DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
 
        }
        break;
 
        case SetChordLength: {
                bool ok;
-               double l = RS_Math::eval(c, &ok);
+               double l = Math::eval(c, &ok);
 
                if (ok == true)
                {
@@ -329,13 +329,13 @@ void ActionDrawArc::commandEvent(RS_CommandEvent * e)
                                data.angle2 = data.angle1 + asin(l / (2 * data.radius)) * 2;
                                trigger();
                        }
-                       else if (RS_DIALOGFACTORY != NULL)
-                               RS_DIALOGFACTORY->commandMessage(
+                       else if (DIALOGFACTORY != NULL)
+                               DIALOGFACTORY->commandMessage(
                                        tr("Not a valid chord length"));
 
                }
-               else if (RS_DIALOGFACTORY != NULL)
-                       RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+               else if (DIALOGFACTORY != NULL)
+                       DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
 
        }
        break;
@@ -348,47 +348,47 @@ void ActionDrawArc::commandEvent(RS_CommandEvent * e)
 QStringList ActionDrawArc::getAvailableCommands()
 {
        QStringList cmd;
-       cmd += RS_COMMANDS->command("reversed");
+       cmd += COMMANDS->command("reversed");
        return cmd;
 }
 
 void ActionDrawArc::updateMouseButtonHints()
 {
-       if (RS_DIALOGFACTORY != NULL)
+       if (DIALOGFACTORY != NULL)
        {
                switch (getStatus())
                {
                case SetCenter:
-                       RS_DIALOGFACTORY->updateMouseWidget(tr("Specify center"), tr("Cancel"));
+                       DIALOGFACTORY->updateMouseWidget(tr("Specify center"), tr("Cancel"));
                        break;
 
                case SetRadius:
-                       RS_DIALOGFACTORY->updateMouseWidget(tr("Specify radius"), tr("Back"));
+                       DIALOGFACTORY->updateMouseWidget(tr("Specify radius"), tr("Back"));
                        break;
 
                case SetAngle1:
-                       RS_DIALOGFACTORY->updateMouseWidget(
+                       DIALOGFACTORY->updateMouseWidget(
                                tr("Specify start angle:"), tr("Back"));
                        break;
 
                case SetAngle2:
-                       RS_DIALOGFACTORY->updateMouseWidget(
+                       DIALOGFACTORY->updateMouseWidget(
                                tr("Specify end angle or [Angle/chord Length]"),
                                tr("Back"));
                        break;
 
                case SetIncAngle:
-                       RS_DIALOGFACTORY->updateMouseWidget(tr("Specify included angle:"),
+                       DIALOGFACTORY->updateMouseWidget(tr("Specify included angle:"),
                                tr("Back"));
                        break;
 
                case SetChordLength:
-                       RS_DIALOGFACTORY->updateMouseWidget(tr("Specify chord length:"),
+                       DIALOGFACTORY->updateMouseWidget(tr("Specify chord length:"),
                                tr("Back"));
                        break;
 
                default:
-                       RS_DIALOGFACTORY->updateMouseWidget("", "");
+                       DIALOGFACTORY->updateMouseWidget("", "");
                        break;
                }
        }
@@ -398,16 +398,16 @@ void ActionDrawArc::showOptions()
 {
        ActionInterface::showOptions();
 
-       if (RS_DIALOGFACTORY)
-               RS_DIALOGFACTORY->requestOptions(this, true);
+       if (DIALOGFACTORY)
+               DIALOGFACTORY->requestOptions(this, true);
 }
 
 void ActionDrawArc::hideOptions()
 {
        ActionInterface::hideOptions();
 
-       if (RS_DIALOGFACTORY)
-               RS_DIALOGFACTORY->requestOptions(this, false);
+       if (DIALOGFACTORY)
+               DIALOGFACTORY->requestOptions(this, false);
 }
 
 void ActionDrawArc::updateMouseCursor()
@@ -417,13 +417,13 @@ void ActionDrawArc::updateMouseCursor()
 
 void ActionDrawArc::updateToolBar()
 {
-       if (!RS_DIALOGFACTORY)
+       if (!DIALOGFACTORY)
                return;
 
        if (!isFinished())
-               RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+               DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
        else
-               RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarArcs);
+               DIALOGFACTORY->requestToolBar(RS2::ToolBarArcs);
 }
 
 bool ActionDrawArc::isReversed()