]> Shamusworld >> Repos - architektonas/blobdiff - src/base/entity.cpp
In the middle of chasing down MDI not activating bug, renaming of Graphic to
[architektonas] / src / base / entity.cpp
index bf5be9cff0eaf6b824fcaf2cf9298756c9cc01d1..aa6abb7541369ab109b3bccfe991e0f854c7e47a 100644 (file)
@@ -38,7 +38,7 @@
  *               E.g. a line might have a graphic entity or
  *               a polyline entity as parent.
  */
-RS_Entity::RS_Entity(RS_EntityContainer * parent)
+Entity::Entity(EntityContainer * parent)
 {
        this->parent = parent;
        init();
@@ -47,7 +47,7 @@ RS_Entity::RS_Entity(RS_EntityContainer * parent)
 /**
  * Copy constructor.
  */
-/*RS_Entity::RS_Entity(const RS_Entity& e) : RS_Flags(e.getFlags()) {
+/*Entity::Entity(const Entity& e) : Flags(e.getFlags()) {
        cout << "copy constructor called\n";
        init();
        parent = e.parent;
@@ -61,11 +61,11 @@ RS_Entity::RS_Entity(RS_EntityContainer * parent)
 /**
  * Destructor.
  */
-RS_Entity::~RS_Entity()
+Entity::~Entity()
 {
 }
 
-/*virtual*/ void RS_Entity::reparent(RS_EntityContainer * parent)
+/*virtual*/ void Entity::reparent(EntityContainer * parent)
 {
        this->parent = parent;
 }
@@ -73,13 +73,13 @@ RS_Entity::~RS_Entity()
 /**
  * Initialisation. Called from all constructors.
  */
-void RS_Entity::init()
+void Entity::init()
 {
        resetBorders();
 
        setFlag(RS2::FlagVisible);
        //layer = NULL;
-       //pen = RS_Pen();
+       //pen = Pen();
        updateEnabled = true;
        setLayerToActive();
        setPenToActive();
@@ -89,7 +89,7 @@ void RS_Entity::init()
 /**
  * Gives this entity a new unique id.
  */
-void RS_Entity::initId()
+void Entity::initId()
 {
        static unsigned long int idCounter = 0;
        id = idCounter++;
@@ -98,7 +98,7 @@ void RS_Entity::initId()
 /**
  * Resets the borders of this element.
  */
-void RS_Entity::resetBorders()
+void Entity::resetBorders()
 {
        // TODO: Check that. windoze XP crashes with MAXDOUBLE
        double maxd = RS_MAXDOUBLE;
@@ -112,7 +112,7 @@ void RS_Entity::resetBorders()
  * Must be overwritten to return the rtti of this entity
  * (e.g. RS2::EntityArc).
  */
-/*virtual*/ RS2::EntityType RS_Entity::rtti() const
+/*virtual*/ RS2::EntityType Entity::rtti() const
 {
        return RS2::EntityUnknown;
 }
@@ -121,7 +121,7 @@ void RS_Entity::resetBorders()
  * Identify all entities as undoable entities.
  * @return RS2::UndoableEntity
  */
-/*virtual*/ RS2::UndoableType RS_Entity::undoRtti()
+/*virtual*/ RS2::UndoableType Entity::undoRtti()
 {
        return RS2::UndoableEntity;
 }
@@ -129,7 +129,7 @@ void RS_Entity::resetBorders()
 /**
  * @return Unique Id of this entity.
  */
-unsigned long int RS_Entity::getId() const
+unsigned long int Entity::getId() const
 {
        return id;
 }
@@ -139,7 +139,7 @@ unsigned long int RS_Entity::getId() const
  * is a potential edge entity of a contour. By default
  * this returns false.
  */
-/*virtual*/ bool RS_Entity::isEdge() const
+/*virtual*/ bool Entity::isEdge() const
 {
        return false;
 }
@@ -148,7 +148,7 @@ unsigned long int RS_Entity::getId() const
  * @return true for all document entities (e.g. Graphics or Blocks).
  * false otherwise.
  */
-/*virtual*/ bool RS_Entity::isDocument() const
+/*virtual*/ bool Entity::isDocument() const
 {
        return false;
 }
@@ -158,7 +158,7 @@ unsigned long int RS_Entity::getId() const
  *
  * @param select True to select, false to deselect.
  */
-bool RS_Entity::setSelected(bool select)
+bool Entity::setSelected(bool select)
 {
        // layer is locked:
        if (select && isLocked())
@@ -175,7 +175,7 @@ bool RS_Entity::setSelected(bool select)
 /**
  * Toggles select on this entity.
  */
-bool RS_Entity::toggleSelected()
+bool Entity::toggleSelected()
 {
        return setSelected(!isSelected());
        //toggleFlag(RS2::FlagSelected);
@@ -186,7 +186,7 @@ bool RS_Entity::toggleSelected()
  * not be selected but one of its parents is selected. In that case
  * this function returns false.
  */
-bool RS_Entity::isSelected() const
+bool Entity::isSelected() const
 {
        return getFlag(RS2::FlagSelected);
 }
@@ -194,18 +194,18 @@ bool RS_Entity::isSelected() const
 /**
  * @return true if a parent entity of this entity is selected.
  */
-bool RS_Entity::isParentSelected()
+bool Entity::isParentSelected()
 {
-       RS_Entity * p = this;
+       Entity * p = this;
 
        do
        {
                p = p->getParent();
 
-               if (p != NULL && p->isSelected() == true)
+               if (p && p->isSelected() == true)
                        return true;
        }
-       while(p != NULL);
+       while (p);
 
        return false;
 }
@@ -215,7 +215,7 @@ bool RS_Entity::isParentSelected()
  *
  * @param on True to set, false to reset.
  */
-void RS_Entity::setProcessed(bool on)
+void Entity::setProcessed(bool on)
 {
        if (on)
                setFlag(RS2::FlagProcessed);
@@ -226,7 +226,7 @@ void RS_Entity::setProcessed(bool on)
 /**
  * @return True if the processed flag is set.
  */
-bool RS_Entity::isProcessed() const
+bool Entity::isProcessed() const
 {
        return getFlag(RS2::FlagProcessed);
 }
@@ -237,7 +237,7 @@ bool RS_Entity::isProcessed() const
  * @param undone true: entity has become invisible.
  *               false: entity has become visible.
  */
-void RS_Entity::undoStateChanged(bool /*undone*/)
+void Entity::undoStateChanged(bool /*undone*/)
 {
        setSelected(false);
        update();
@@ -246,18 +246,18 @@ void RS_Entity::undoStateChanged(bool /*undone*/)
 /**
  * @return true if this entity or any parent entities are undone.
  */
-bool RS_Entity::isUndone() const
+bool Entity::isUndone() const
 {
        if (parent == NULL)
-               return RS_Undoable::isUndone();
+               return Undoable::isUndone();
 
-       return RS_Undoable::isUndone() || parent->isUndone();
+       return Undoable::isUndone() || parent->isUndone();
 }
 
 /**
  * @return True if the entity is in the given range.
  */
-bool RS_Entity::isInWindow(Vector v1, Vector v2)
+bool Entity::isInWindow(Vector v1, Vector v2)
 {
        double right, left, top, bottom;
 
@@ -276,13 +276,13 @@ bool RS_Entity::isInWindow(Vector v1, Vector v2)
  * @retval true if the given point is on this entity.
  * @retval false otherwise
  */
-bool RS_Entity::isPointOnEntity(const Vector & coord, double tolerance)
+bool Entity::isPointOnEntity(const Vector & coord, double tolerance)
 {
        double dist = getDistanceToPoint(coord, NULL, RS2::ResolveNone);
        return (dist <= tolerance);
 }
 
-/*virtual*/ bool RS_Entity::hasEndpointsWithinWindow(Vector /*v1*/, Vector /*v2*/)
+/*virtual*/ bool Entity::hasEndpointsWithinWindow(Vector /*v1*/, Vector /*v2*/)
 {
        return false;
 }
@@ -294,7 +294,7 @@ bool RS_Entity::isPointOnEntity(const Vector & coord, double tolerance)
  * The Layer might also be NULL. In that case the layer visiblity
 * is ignored.
  */
-/*virtual*/ bool RS_Entity::isVisible()
+/*virtual*/ bool Entity::isVisible()
 {
        if (!getFlag(RS2::FlagVisible))
                return false;
@@ -302,7 +302,7 @@ bool RS_Entity::isPointOnEntity(const Vector & coord, double tolerance)
        if (isUndone())
                return false;
 
-       /*RS_EntityCotnainer* parent = getParent();
+       /*EntityCotnainer* parent = getParent();
        if (parent!=NULL && parent->isUndone()) {
                return false;
        }*/
@@ -359,7 +359,7 @@ bool RS_Entity::isPointOnEntity(const Vector & coord, double tolerance)
        return false;
 }
 
-/*virtual*/ void RS_Entity::setVisible(bool v)
+/*virtual*/ void Entity::setVisible(bool v)
 {
        if (v)
                setFlag(RS2::FlagVisible);
@@ -371,7 +371,7 @@ bool RS_Entity::isPointOnEntity(const Vector & coord, double tolerance)
  * Sets the highlight status of the entity. Highlighted entities
  * usually indicate a feedback to a user action.
  */
-void RS_Entity::setHighlighted(bool on)
+void Entity::setHighlighted(bool on)
 {
        if (on)
                setFlag(RS2::FlagHighlighted);
@@ -382,7 +382,7 @@ void RS_Entity::setHighlighted(bool on)
 /**
  * @return true if the entity is highlighted.
  */
-bool RS_Entity::isHighlighted()
+bool Entity::isHighlighted()
 {
        return getFlag(RS2::FlagHighlighted);
 }
@@ -390,7 +390,7 @@ bool RS_Entity::isHighlighted()
 /**
  * @return true if the layer this entity is on is locked.
  */
-bool RS_Entity::isLocked()
+bool Entity::isLocked()
 {
        if (getLayer(true) != NULL && getLayer()->isLocked())
                return true;
@@ -402,7 +402,7 @@ bool RS_Entity::isLocked()
  * Implementations must return the total length of the entity
  * or a negative number if the entity has no length (e.g. a text or hatch).
  */
-/*virtual*/ double RS_Entity::getLength()
+/*virtual*/ double Entity::getLength()
 {
        return -1.0;
 }
@@ -410,7 +410,7 @@ bool RS_Entity::isLocked()
 /**
  * @return Parent of this entity or NULL if this is a root entity.
  */
-RS_EntityContainer * RS_Entity::getParent() const
+EntityContainer * Entity::getParent() const
 {
        return parent;
 }
@@ -418,7 +418,7 @@ RS_EntityContainer * RS_Entity::getParent() const
 /**
  * Reparents this entity.
  */
-void RS_Entity::setParent(RS_EntityContainer * p)
+void Entity::setParent(EntityContainer * p)
 {
        parent = p;
 }
@@ -428,14 +428,14 @@ void RS_Entity::setParent(RS_EntityContainer * p)
  * or the parent's parent graphic or NULL if none of the parents
  * are stored in a graphic.
  */
-Drawing * RS_Entity::getGraphic()
+Drawing * Entity::GetDrawing()
 {
-       if (rtti() == RS2::EntityGraphic)
+       if (rtti() == RS2::EntityDrawing)
                return (Drawing *)this;
        else if (parent == NULL)
                return NULL;
        else
-               return parent->getGraphic();
+               return parent->GetDrawing();
 }
 
 /**
@@ -443,10 +443,10 @@ Drawing * RS_Entity::getGraphic()
  * or the parent's parent block or NULL if none of the parents
  * are stored in a block.
  */
-RS_Block * RS_Entity::getBlock()
+Block * Entity::getBlock()
 {
        if (rtti() == RS2::EntityBlock)
-               return (RS_Block *)this;
+               return (Block *)this;
        else if (parent == NULL)
                return NULL;
        else
@@ -458,10 +458,10 @@ RS_Block * RS_Entity::getBlock()
  * or the parent's parent block or NULL if none of the parents
  * are stored in a block.
  */
-RS_Insert * RS_Entity::getInsert()
+Insert * Entity::getInsert()
 {
        if (rtti() == RS2::EntityInsert)
-               return (RS_Insert *)this;
+               return (Insert *)this;
        else if (parent == NULL)
                return NULL;
        else
@@ -473,7 +473,7 @@ RS_Insert * RS_Entity::getInsert()
  * or the parent's parent block or insert or NULL if none of the parents
  * are stored in a block or insert.
  */
-RS_Entity * RS_Entity::getBlockOrInsert()
+Entity * Entity::getBlockOrInsert()
 {
        if (rtti() == RS2::EntityBlock || rtti() == RS2::EntityInsert)
                return this;
@@ -489,10 +489,10 @@ RS_Entity * RS_Entity::getBlockOrInsert()
  * are stored in a document. Note that a document is usually
  * either a Graphic or a Block.
  */
-RS_Document * RS_Entity::getDocument()
+Document * Entity::getDocument()
 {
        if (isDocument() == true)
-               return (RS_Document *)this;
+               return (Document *)this;
        else if (parent == NULL)
                return NULL;
        else
@@ -504,11 +504,11 @@ RS_Document * RS_Entity::getDocument()
  * temporary subentities. update() is called if the entity's
  * paramters or undo state changed.
  */
-/*virtual*/ void RS_Entity::update()
+/*virtual*/ void Entity::update()
 {
 }
 
-/*virtual*/ void RS_Entity::setUpdateEnabled(bool on)
+/*virtual*/ void Entity::setUpdateEnabled(bool on)
 {
        updateEnabled = on;
 }
@@ -518,7 +518,7 @@ RS_Document * RS_Entity::getDocument()
  * @return minimum coordinate of the entity.
  * @see calculateBorders()
  */
-Vector RS_Entity::getMin() const
+Vector Entity::getMin() const
 {
        return minV;
 }
@@ -528,7 +528,7 @@ Vector RS_Entity::getMin() const
  * @return minimum coordinate of the entity.
  * @see calculateBorders()
  */
-Vector RS_Entity::getMax() const
+Vector Entity::getMax() const
 {
        return maxV;
 }
@@ -541,7 +541,7 @@ Vector RS_Entity::getMax() const
  * @see getMin()
  * @see getMax()
  */
-Vector RS_Entity::getSize() const
+Vector Entity::getSize() const
 {
        return maxV - minV;
 }
@@ -552,12 +552,12 @@ Vector RS_Entity::getSize() const
  * @param key Variable name (e.g. "$DIMASZ")
  * @param val Default value
  */
-void RS_Entity::addGraphicVariable(const QString & key, double val, int code)
+void Entity::addGraphicVariable(const QString & key, double val, int code)
 {
-       Drawing * graphic = getGraphic();
+       Drawing * drawing = GetDrawing();
 
-       if (graphic != NULL)
-               graphic->addVariable(key, val, code);
+       if (drawing)
+               drawing->addVariable(key, val, code);
 }
 
 /**
@@ -566,12 +566,12 @@ void RS_Entity::addGraphicVariable(const QString & key, double val, int code)
  * @param key Variable name (e.g. "$DIMASZ")
  * @param val Default value
  */
-void RS_Entity::addGraphicVariable(const QString & key, int val, int code)
+void Entity::addGraphicVariable(const QString & key, int val, int code)
 {
-       Drawing * graphic = getGraphic();
+       Drawing * drawing = GetDrawing();
 
-       if (graphic != NULL)
-               graphic->addVariable(key, val, code);
+       if (drawing)
+               drawing->addVariable(key, val, code);
 }
 
 /**
@@ -580,12 +580,12 @@ void RS_Entity::addGraphicVariable(const QString & key, int val, int code)
  * @param key Variable name (e.g. "$DIMASZ")
  * @param val Default value
  */
-void RS_Entity::addGraphicVariable(const QString & key, const QString & val, int code)
+void Entity::addGraphicVariable(const QString & key, const QString & val, int code)
 {
-       Drawing * graphic = getGraphic();
+       Drawing * drawing = GetDrawing();
 
-       if (graphic != NULL)
-               graphic->addVariable(key, val, code);
+       if (drawing)
+               drawing->addVariable(key, val, code);
 }
 
 /**
@@ -597,13 +597,13 @@ void RS_Entity::addGraphicVariable(const QString & key, const QString & val, int
  * @return value of variable or default value if the given variable
  *    doesn't exist.
  */
-double RS_Entity::getGraphicVariableDouble(const QString & key, double def)
+double Entity::getGraphicVariableDouble(const QString & key, double def)
 {
-       Drawing * graphic = getGraphic();
+       Drawing * drawing = GetDrawing();
        double ret = def;
 
-       if (graphic != NULL)
-               ret = graphic->getVariableDouble(key, def);
+       if (drawing)
+               ret = drawing->getVariableDouble(key, def);
 
        return ret;
 }
@@ -617,13 +617,13 @@ double RS_Entity::getGraphicVariableDouble(const QString & key, double def)
  * @return value of variable or default value if the given variable
  *    doesn't exist.
  */
-int RS_Entity::getGraphicVariableInt(const QString & key, int def)
+int Entity::getGraphicVariableInt(const QString & key, int def)
 {
-       Drawing * graphic = getGraphic();
+       Drawing * drawing = GetDrawing();
        int ret = def;
 
-       if (graphic != NULL)
-               ret = graphic->getVariableInt(key, def);
+       if (drawing)
+               ret = drawing->getVariableInt(key, def);
 
        return ret;
 }
@@ -637,13 +637,13 @@ int RS_Entity::getGraphicVariableInt(const QString & key, int def)
  * @return value of variable or default value if the given variable
  *    doesn't exist.
  */
-QString RS_Entity::getGraphicVariableString(const QString & key, const QString & def)
+QString Entity::getGraphicVariableString(const QString & key, const QString & def)
 {
-       Drawing * graphic = getGraphic();
+       Drawing * drawing = GetDrawing();
        QString ret = def;
 
-       if (graphic != NULL)
-               ret = graphic->getVariableString(key, def);
+       if (drawing)
+               ret = drawing->getVariableString(key, def);
 
        return ret;
 }
@@ -652,13 +652,13 @@ QString RS_Entity::getGraphicVariableString(const QString & key, const QString &
  * @return The unit the parent graphic works on or None if there's no
  * parent graphic.
  */
-RS2::Unit RS_Entity::getGraphicUnit()
+RS2::Unit Entity::getGraphicUnit()
 {
-       Drawing * graphic = getGraphic();
+       Drawing * drawing = GetDrawing();
        RS2::Unit ret = RS2::None;
 
-       if (graphic != NULL)
-               ret = graphic->getUnit();
+       if (drawing)
+               ret = drawing->getUnit();
 
        return ret;
 }
@@ -666,10 +666,9 @@ RS2::Unit RS_Entity::getGraphicUnit()
 /**
  * Must be overwritten to get all reference points of the entity.
  */
-/*virtual*/ VectorSolutions RS_Entity::getRefPoints()
+/*virtual*/ VectorSolutions Entity::getRefPoints()
 {
-       VectorSolutions ret;
-       return ret;
+       return VectorSolutions();
 }
 
 /**
@@ -681,7 +680,7 @@ RS2::Unit RS_Entity::getGraphicUnit()
  *
  * @return The point with the given distance to the start- or endpoint.
  */
-/*virtual*/ Vector RS_Entity::getNearestDist(double /*distance*/, bool /*startp*/)
+/*virtual*/ Vector Entity::getNearestDist(double /*distance*/, bool /*startp*/)
 {
        return Vector(false);
 }
@@ -697,7 +696,7 @@ RS2::Unit RS_Entity::getGraphicUnit()
  *
  * @return The closest point with the given distance to the endpoint.
  */
-/*virtual*/ Vector RS_Entity::getNearestRef(const Vector & coord, double * dist/*= NULL*/)
+/*virtual*/ Vector Entity::getNearestRef(const Vector & coord, double * dist/*= NULL*/)
 {
        VectorSolutions s = getRefPoints();
 
@@ -717,7 +716,7 @@ RS2::Unit RS_Entity::getGraphicUnit()
  *
  * @return The closest point with the given distance to the endpoint.
  */
-/*virtual*/ Vector RS_Entity::getNearestSelectedRef(const Vector & coord, double * dist/*= NULL*/)
+/*virtual*/ Vector Entity::getNearestSelectedRef(const Vector & coord, double * dist/*= NULL*/)
 {
        if (isSelected())
                return getNearestRef(coord, dist);
@@ -729,7 +728,7 @@ RS2::Unit RS_Entity::getGraphicUnit()
  * Acts like scale(Vector) but with equal factors.
  * Equal to scale(center, Vector(factor, factor)).
  */
-/*virtual*/ void RS_Entity::scale(Vector center, double factor)
+/*virtual*/ void Entity::scale(Vector center, double factor)
 {
        scale(center, Vector(factor, factor));
 }
@@ -738,7 +737,7 @@ RS2::Unit RS_Entity::getGraphicUnit()
  * Implementations must drag the reference point(s) of all
  * (sub-)entities that are very close to ref by offset.
  */
-/*virtual*/ void RS_Entity::moveRef(const Vector &/*ref*/, const Vector &/*offset*/)
+/*virtual*/ void Entity::moveRef(const Vector &/*ref*/, const Vector &/*offset*/)
 {
        return;
 }
@@ -747,7 +746,7 @@ RS2::Unit RS_Entity::getGraphicUnit()
  * Implementations must drag the reference point(s) of selected
  * (sub-)entities that are very close to ref by offset.
  */
-/*virtual*/ void RS_Entity::moveSelectedRef(const Vector &/*ref*/, const Vector &/*offset*/)
+/*virtual*/ void Entity::moveSelectedRef(const Vector &/*ref*/, const Vector &/*offset*/)
 {
        return;
 }
@@ -764,7 +763,7 @@ RS2::Unit RS_Entity::getGraphicUnit()
  * layer NULL is returned. If all parents are on layer NULL, NULL
  * is returned.
  */
-RS_Layer * RS_Entity::getLayer(bool resolve) const
+Layer * Entity::getLayer(bool resolve) const
 {
        if (resolve)
        {
@@ -786,20 +785,16 @@ RS_Layer * RS_Entity::getLayer(bool resolve) const
 /**
  * Sets the layer of this entity to the layer with the given name
  */
-void RS_Entity::setLayer(const QString & name)
+void Entity::setLayer(const QString & name)
 {
-       Drawing * graphic = getGraphic();
-
-       if (graphic != NULL)
-               layer = graphic->findLayer(name);
-       else
-               layer = NULL;
+       Drawing * drawing = GetDrawing();
+       layer = (drawing ? drawing->findLayer(name) : NULL);
 }
 
 /**
  * Sets the layer of this entity to the layer given.
  */
-void RS_Entity::setLayer(RS_Layer * l)
+void Entity::setLayer(Layer * l)
 {
     layer = l;
 }
@@ -809,14 +804,10 @@ void RS_Entity::setLayer(RS_Layer * l)
  * the graphic this entity is in. If this entity (and none
  * of its parents) are in a graphic the layer is set to NULL.
  */
-void RS_Entity::setLayerToActive()
+void Entity::setLayerToActive()
 {
-       Drawing * graphic = getGraphic();
-
-       if (graphic != NULL)
-               layer = graphic->getActiveLayer();
-       else
-               layer = NULL;
+       Drawing * drawing = GetDrawing();
+       layer = (drawing ? drawing->getActiveLayer() : NULL);
 }
 
 /**
@@ -830,14 +821,14 @@ void RS_Entity::setLayerToActive()
  *
  * @return Pen for this entity.
  */
-RS_Pen RS_Entity::getPen(bool resolve) const
+Pen Entity::getPen(bool resolve) const
 {
        if (!resolve)
                return pen;
        else
        {
-               RS_Pen p = pen;
-               RS_Layer * l = getLayer(true);
+               Pen p = pen;
+               Layer * l = getLayer(true);
 
                // use parental attributes (e.g. vertex of a polyline, block
                // entities when they are drawn in block documents):
@@ -876,7 +867,7 @@ RS_Pen RS_Entity::getPen(bool resolve) const
  * Sets the explicit pen for this entity or a pen with special
  * attributes such as BY_LAYER, ..
  */
-void RS_Entity::setPen(const RS_Pen & pen)
+void Entity::setPen(const Pen & pen)
 {
        this->pen = pen;
 }
@@ -886,19 +877,19 @@ void RS_Entity::setPen(const RS_Pen & pen)
  * the graphic this entity is in. If this entity (and none
  * of its parents) are in a graphic the pen is not changed.
  */
-void RS_Entity::setPenToActive()
+void Entity::setPenToActive()
 {
-       RS_Document * doc = getDocument();
+       Document * doc = getDocument();
 
        if (doc != NULL)
                pen = doc->getActivePen();
        else
        {
-               //RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Entity::setPenToActive(): "
+               //DEBUG->print(Debug::D_WARNING, "Entity::setPenToActive(): "
                //                "No document / active pen linked to this entity.");
        }
        //else {
-       //   pen = RS_Pen();
+       //   pen = Pen();
        //}
 }
 
@@ -907,7 +898,7 @@ void RS_Entity::setPenToActive()
  * by the given offset. This default implementation moves the
  * whole entity if it is completely inside the given range.
  */
-void RS_Entity::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
+void Entity::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
 {
        //e->calculateBorders();
        if (getMin().isInWindow(firstCorner, secondCorner)
@@ -919,7 +910,7 @@ void RS_Entity::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
  * @return Factor for scaling the line styles considering the current
  * paper scaling and the fact that styles are stored in Millimeter.
  */
-double RS_Entity::getStyleFactor(GraphicView * view)
+double Entity::getStyleFactor(GraphicView * view)
 {
        double styleFactor = 1.0;
 
@@ -932,13 +923,13 @@ double RS_Entity::getStyleFactor(GraphicView * view)
                        //styleFactor = getStyleFactor();
                        // the factor caused by the unit:
                        RS2::Unit unit = RS2::None;
-                       Drawing * g = getGraphic();
+                       Drawing * d = GetDrawing();
 
-                       if (g != NULL)
+                       if (d)
                        {
-                               unit = g->getUnit();
-                               //double scale = g->getPaperScale();
-                               styleFactor = RS_Units::convert(1.0, RS2::Millimeter, unit);
+                               unit = d->getUnit();
+                               //double scale = d->getPaperScale();
+                               styleFactor = Units::convert(1.0, RS2::Millimeter, unit);
                                // / scale;
                        }
 
@@ -951,15 +942,15 @@ double RS_Entity::getStyleFactor(GraphicView * view)
 
                if (view->isPrinting() || view->isPrintPreview() || view->isDraftMode() == false)
                {
-                       Drawing * graphic = getGraphic();
+                       Drawing * drawing = GetDrawing();
 
-                       if (graphic != NULL && graphic->getPaperScale() > 1.0e-6)
-                               styleFactor /= graphic->getPaperScale();
+                       if (drawing && drawing->getPaperScale() > 1.0e-6)
+                               styleFactor /= drawing->getPaperScale();
                }
        }
 
-       //RS_DEBUG->print("stylefactor: %f", styleFactor);
-       //RS_DEBUG->print("viewfactor: %f", view->getFactor().x);
+       //DEBUG->print("stylefactor: %f", styleFactor);
+       //DEBUG->print("viewfactor: %f", view->getFactor().x);
 
        if (styleFactor * view->getFactor().x < 0.2)
                styleFactor = -1.0;
@@ -970,7 +961,7 @@ double RS_Entity::getStyleFactor(GraphicView * view)
 /**
  * @return User defined variable connected to this entity.
  */
-QString * RS_Entity::getUserDefVar(QString key)
+QString * Entity::getUserDefVar(QString key)
 {
 //     return (this->varList.find(key));
        return (this->varList.value(key));
@@ -979,7 +970,7 @@ QString * RS_Entity::getUserDefVar(QString key)
 /**
  * Add a user defined variable to this entity.
  */
-void RS_Entity::setUserDefVar(QString key, QString val)
+void Entity::setUserDefVar(QString key, QString val)
 {
        varList.insert(key, new QString(val));
 }
@@ -987,7 +978,7 @@ void RS_Entity::setUserDefVar(QString key, QString val)
 /**
  * Deletes the given user defined variable.
  */
-void RS_Entity::delUserDefVar(QString key)
+void Entity::delUserDefVar(QString key)
 {
        varList.remove(key);
 }
@@ -995,7 +986,7 @@ void RS_Entity::delUserDefVar(QString key)
 /**
  * @return A list of all keys connected to this entity.
  */
-QStringList RS_Entity::getAllKeys()
+QStringList Entity::getAllKeys()
 {
        QStringList keys;
 //     Q3DictIterator<QString> it(varList);
@@ -1015,7 +1006,7 @@ QStringList RS_Entity::getAllKeys()
 /**
  * Dumps the elements data to stdout.
  */
-std::ostream & operator<<(std::ostream & os, RS_Entity & e)
+std::ostream & operator<<(std::ostream & os, Entity & e)
 {
        //os << "Warning: Virtual entity!\n";
        //return os;
@@ -1058,39 +1049,39 @@ std::ostream & operator<<(std::ostream & os, RS_Entity & e)
        }
 #endif
 
-       // There should be a better way then this...
+       // There should be a better way than this...
        switch (e.rtti())
        {
        case RS2::EntityPoint:
-               os << (RS_Point &)e;
+               os << (Point &)e;
                break;
 
        case RS2::EntityLine:
-               os << (RS_Line &)e;
+               os << (Line &)e;
                break;
 
        case RS2::EntityPolyline:
-               os << (RS_Polyline &)e;
+               os << (Polyline &)e;
                break;
 
        case RS2::EntityArc:
-               os << (RS_Arc &)e;
+               os << (Arc &)e;
                break;
 
        case RS2::EntityCircle:
-               os << (RS_Circle &)e;
+               os << (Circle &)e;
                break;
 
        case RS2::EntityEllipse:
-               os << (RS_Ellipse &)e;
+               os << (Ellipse &)e;
                break;
 
        case RS2::EntityInsert:
-               os << (RS_Insert &)e;
+               os << (Insert &)e;
                break;
 
        case RS2::EntityText:
-               os << (RS_Text &)e;
+               os << (Text &)e;
                break;
 
        default: