]> Shamusworld >> Repos - architektonas/blobdiff - src/actions/rs_actiondimension.h
Major refactoring of actions: Moved implementation from header files
[architektonas] / src / actions / rs_actiondimension.h
index f207d86c824de01ff912a6178d84f84c35b82ce5..1c4735b354c2152abb24dd735c22382f7b1d0e97 100644 (file)
-/****************************************************************************
-** $Id: rs_actiondimension.h 1119 2004-04-12 22:44:04Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use 
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
 #ifndef RS_ACTIONDIMENSION_H
 #define RS_ACTIONDIMENSION_H
 
-#include "rs_previewactioninterface.h"
+#include <QtCore>
 #include "rs_dimension.h"
+#include "rs_previewactioninterface.h"
 
 /**
  * Base class for dimension actions.
  *
  * @author Andrew Mustun
  */
-class RS_ActionDimension : public RS_PreviewActionInterface {
-    //Q_OBJECT
-public:
-    RS_ActionDimension(const char* name,
-                       RS_EntityContainer& container,
-                       RS_GraphicView& graphicView);
-    ~RS_ActionDimension();
-
-    virtual void reset();
-
-    virtual void init(int status=0);
-
-    virtual void hideOptions();
-    virtual void showOptions();
-
-    virtual void updateMouseCursor();
-    virtual void updateToolBar();
-
-    QString getText() {
-               if (!data.text.isEmpty()) {
-                       return data.text;
-               }
-       
-        QString l = label;
-
-        if (l.isEmpty() &&
-            (diameter==true || !tol1.isEmpty() || !tol2.isEmpty())) {
-            l = "<>";
-        }
-
-        if (diameter==true) {
-            l = QChar(0x2205) + l;
-        }
-
-        if (!tol1.isEmpty() || !tol2.isEmpty()) {
-            l += QString("\\S%1\\%2;").arg(tol1).arg(tol2);
-        }
-
-        return l;
-    }
-       
-    void setText(const QString& t) {
-        data.text = t;
-       }
-
-       QString getLabel() {
-               return label;
-       }
-    void setLabel(const QString& t) {
-        //data.text = t;
-        label = t;
-    }
-       QString getTol1() {
-               return tol1;
-       }
-    void setTol1(const QString& t) {
-        tol1 = t;
-    }
-       QString getTol2() {
-               return tol2;
-       }
-    void setTol2(const QString& t) {
-        tol2 = t;
-    }
-       bool getDiameter() {
-               return diameter;
-       }
-    void setDiameter(bool d) {
-        diameter = d;
-    }
-
-    static bool isDimensionAction(RS2::ActionType type) {
-        return (type==RS2::ActionDimAligned ||
-                type==RS2::ActionDimLinear ||
-                type==RS2::ActionDimAngular ||
-                type==RS2::ActionDimDiametric ||
-                type==RS2::ActionDimRadial);
-    }
-
-protected:
-    /**
-     * Generic dimension data.
-     */
-    RS_DimensionData data;
-
-    QString label;
-    QString tol1;
-    QString tol2;
-    bool diameter;
-
-
-    /**
-     * Commands.
-     */
-    /*
-      QString cmdText;
-      QString cmdText2;
-    */
+class RS_ActionDimension: public RS_PreviewActionInterface
+{
+       public:
+               RS_ActionDimension(const char * name, RS_EntityContainer & container, RS_GraphicView & graphicView);
+               ~RS_ActionDimension();
+
+               virtual void reset();
+               virtual void init(int status = 0);
+               virtual void hideOptions();
+               virtual void showOptions();
+               virtual void updateMouseCursor();
+               virtual void updateToolBar();
+               QString getText();
+               void setText(const QString & t);
+               QString getLabel();
+               void setLabel(const QString & t);
+               QString getTol1();
+               void setTol1(const QString & t);
+               QString getTol2();
+               void setTol2(const QString & t);
+               bool getDiameter();
+               void setDiameter(bool d);
+               static bool isDimensionAction(RS2::ActionType type);
+
+       protected:
+               /**
+                * Generic dimension data.
+                */
+               RS_DimensionData data;
+
+               QString label;
+               QString tol1;
+               QString tol2;
+               bool diameter;
 };
 
 #endif